/* * Copyright (C) 2007-2016 Apple Inc. All rights reserved. * Copyright (C) 2008 Matt Lilek. All rights reserved. * Copyright (C) 2008-2009 Anthony Ricaud * Copyright (C) 2009-2010 Joseph Pecoraro. All rights reserved. * Copyright (C) 2009-2011 Google Inc. All rights reserved. * Copyright (C) 2009 280 North Inc. All Rights Reserved. * Copyright (C) 2010 Nikita Vasilyev. All rights reserved. * Copyright (C) 2011 Brian Grinstead All rights reserved. * Copyright (C) 2013 Matt Holden * Copyright (C) 2013 Samsung Electronics. All rights reserved. * Copyright (C) 2013 Seokju Kwon (seokju.kwon@gmail.com) * Copyright (C) 2013 Adobe Systems Inc. All rights reserved. * Copyright (C) 2013-2015 University of Washington. All rights reserved. * Copyright (C) 2014-2015 Saam Barati * Copyright (C) 2014 Antoine Quint * Copyright (C) 2015 Tobias Reiss * Copyright (C) 2015-2016 Devin Rousso . All rights reserved. * Copyright (C) 2017 Sony Interactive Entertainment Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ var WebInspector={};WebInspector.Platform={name:InspectorFrontendHost.platform(),isNightlyBuild:false,version:{base:0,release:0,name:""}};(function(){var versionMatch=/ AppleWebKit\/([^ ]+)/.exec(navigator.userAgent);if(versionMatch&&versionMatch[1].indexOf("+")!==-1&&document.styleSheets.length<10) WebInspector.Platform.isNightlyBuild=true;var osVersionMatch=/ Mac OS X (\d+)_(\d+)/.exec(navigator.appVersion);if(osVersionMatch&&osVersionMatch[1]==="10"){WebInspector.Platform.version.base=10;WebInspector.Platform.version.release=parseInt(osVersionMatch[2]);switch(osVersionMatch[2]){case"12":WebInspector.Platform.version.name="sierra";break;case"11":WebInspector.Platform.version.name="el-capitan";break;case"10":WebInspector.Platform.version.name="yosemite";break;default:WebInspector.Platform.version.name="unknown-mac";break;}}})();class LinkedList {constructor() {this.head=new LinkedListNode;this.head.next=this.head.prev=this.head;this.length=0;} clear() {this.head.next=this.head.prev=this.head;this.length=0;} get last() {return this.head.prev;} push(item) {let newNode=new LinkedListNode(item);let last=this.last;let head=this.head;last.next=newNode;newNode.next=head;head.prev=newNode;newNode.prev=last;this.length++;return newNode;} remove(node) {if(!node) return false;node.prev.next=node.next;node.next.prev=node.prev;this.length--;return true;} forEach(callback) {let node=this.head;for(let i=0,length=this.length;iwrapper.resolve(event));return wrapper.promise;} static hasEventListeners(eventType) {if(!this._listeners) return false;let listenersTable=this._listeners.get(eventType);return listenersTable&&listenersTable.size>0;} static retainedObjectsWithPrototype(proto) {let results=new Set;if(this._listeners){this._listeners.forEach(function(listenersTable,eventType){listenersTable.forEach(function(pair){let thisObject=pair[0];if(thisObject instanceof proto) results.add(thisObject);});});} return results;} addEventListener(){return WebInspector.Object.addEventListener.apply(this,arguments);} singleFireEventListener(){return WebInspector.Object.singleFireEventListener.apply(this,arguments);} removeEventListener(){return WebInspector.Object.removeEventListener.apply(this,arguments);} awaitEvent(){return WebInspector.Object.awaitEvent.apply(this,arguments);} hasEventListeners(){return WebInspector.Object.hasEventListeners.apply(this,arguments);} retainedObjectsWithPrototype(){return WebInspector.Object.retainedObjectsWithPrototype.apply(this,arguments);} dispatchEventToListeners(eventType,eventData) {let event=new WebInspector.Event(this,eventType,eventData);function dispatch(object) {if(!object||event._stoppedPropagation) return;let listenerTypesMap=object._listeners;if(!listenerTypesMap||!object.hasOwnProperty("_listeners")) return;let listenersTable=listenerTypesMap.get(eventType);if(!listenersTable) return;let listeners=listenersTable.toArray();for(let i=0,length=listeners.length;i-1) tagIdSelector=tagIdSelector.substring(0,classSelectorIndex);var roleSelector=WebInspector.roleSelectorForNode(node);link.textContent=tagIdSelector+roleSelector;link.title+=roleSelector;return link;};WebInspector.linkifyNodeReference=function(node,options={}) {let displayName=node.displayName;if(!isNaN(options.maxLength)) displayName=displayName.truncate(options.maxLength);let link=document.createElement("span");link.append(displayName);return WebInspector.linkifyNodeReferenceElement(node,link,Object.shallowMerge(options,{displayName}));};WebInspector.linkifyNodeReferenceElement=function(node,element,options={}) {element.setAttribute("role","link");element.title=options.displayName||node.displayName;let nodeType=node.nodeType();if((nodeType!==Node.DOCUMENT_NODE||node.parentNode)&&nodeType!==Node.TEXT_NODE) element.classList.add("node-link");element.addEventListener("click",WebInspector.domTreeManager.inspectElement.bind(WebInspector.domTreeManager,node.id));element.addEventListener("mouseover",WebInspector.domTreeManager.highlightDOMNode.bind(WebInspector.domTreeManager,node.id,"all"));element.addEventListener("mouseout",WebInspector.domTreeManager.hideDOMNodeHighlight.bind(WebInspector.domTreeManager));element.addEventListener("contextmenu",(event)=>{let contextMenu=WebInspector.ContextMenu.createFromEvent(event);WebInspector.appendContextMenuItemsForDOMNode(contextMenu,node,options);});return element;};function createSVGElement(tagName) {return document.createElementNS("http://www.w3.org/2000/svg",tagName);} WebInspector.cssPath=function(node) {if(node.nodeType()!==Node.ELEMENT_NODE) return"";let suffix="";if(node.isPseudoElement()){suffix="::"+node.pseudoType();node=node.parentNode;} let components=[];while(node){let component=WebInspector.cssPathComponent(node);if(!component) break;components.push(component);if(component.done) break;node=node.parentNode;} components.reverse();return components.map((x)=>x.value).join(" > ")+suffix;};WebInspector.cssPathComponent=function(node) {if(node.nodeType()!==Node.ELEMENT_NODE) return null;let nodeName=node.nodeNameInCorrectCase();let lowerNodeName=node.nodeName().toLowerCase();if(lowerNodeName==="body"||lowerNodeName==="head"||lowerNodeName==="html") return{value:nodeName,done:true};let id=node.getAttribute("id");if(id) return{value:node.escapedIdSelector,done:true};if(!node.parentNode||node.parentNode.nodeType()===Node.DOCUMENT_NODE) return{value:nodeName,done:true}; function classNames(node){let classAttribute=node.getAttribute("class");return classAttribute?classAttribute.trim().split(/\s+/):[];} let nthChildIndex=-1;let hasUniqueTagName=true;let uniqueClasses=new Set(classNames(node));let siblings=node.parentNode.children;let elementIndex=0;for(let sibling of siblings){if(sibling.nodeType()!==Node.ELEMENT_NODE) continue;elementIndex++;if(sibling===node){nthChildIndex=elementIndex;continue;} if(sibling.nodeNameInCorrectCase()===nodeName) hasUniqueTagName=false;if(uniqueClasses.size){let siblingClassNames=classNames(sibling);for(let className of siblingClassNames) uniqueClasses.delete(className);}} let selector=nodeName;if(lowerNodeName==="input"&&node.getAttribute("type")&&!uniqueClasses.size) selector+=`[type="${node.getAttribute("type")}"]`;if(!hasUniqueTagName){if(uniqueClasses.size) selector+=node.escapedClassSelector;else selector+=`:nth-child(${nthChildIndex})`;} return{value:selector,done:false};};WebInspector.xpath=function(node) {if(node.nodeType()===Node.DOCUMENT_NODE) return"/";let components=[];while(node){let component=WebInspector.xpathComponent(node);if(!component) break;components.push(component);if(component.done) break;node=node.parentNode;} components.reverse();let prefix=components.length&&components[0].done?"":"/";return prefix+components.map((x)=>x.value).join("/");};WebInspector.xpathComponent=function(node) {let index=WebInspector.xpathIndex(node);if(index===-1) return null;let value;switch(node.nodeType()){case Node.DOCUMENT_NODE:return{value:"",done:true};case Node.ELEMENT_NODE:var id=node.getAttribute("id");if(id) return{value:`//*[@id="${id}"]`,done:true};value=node.localName();break;case Node.ATTRIBUTE_NODE:value=`@${node.nodeName()}`;break;case Node.TEXT_NODE:case Node.CDATA_SECTION_NODE:value="text()";break;case Node.COMMENT_NODE:value="comment()";break;case Node.PROCESSING_INSTRUCTION_NODE:value="processing-instruction()";break;default:value="";break;} if(index>0) value+=`[${index}]`;return{value,done:false};};WebInspector.xpathIndex=function(node) {if(!node.parentNode) return 0;let siblings=node.parentNode.children;if(siblings.length<=1) return 0; function isSimiliarNode(a,b){if(a===b) return true;let aType=a.nodeType();let bType=b.nodeType();if(aType===Node.ELEMENT_NODE&&bType===Node.ELEMENT_NODE) return a.localName()===b.localName();if(aType===Node.CDATA_SECTION_NODE) return aType===Node.TEXT_NODE;if(bType===Node.CDATA_SECTION_NODE) return bType===Node.TEXT_NODE;return aType===bType;} let unique=true;let xPathIndex=-1;let xPathIndexCounter=1;for(let sibling of siblings){if(!isSimiliarNode(node,sibling)) continue;if(node===sibling){xPathIndex=xPathIndexCounter;if(!unique) return xPathIndex;}else{unique=false;if(xPathIndex!==-1) return xPathIndex;} xPathIndexCounter++;} if(unique) return 0;return xPathIndex;};WebInspector.EventListener=class EventListener {constructor(thisObject,fireOnce) {this._thisObject=thisObject;this._emitter=null;this._callback=null;this._fireOnce=fireOnce;} connect(emitter,type,callback,usesCapture) {var emitterIsValid=emitter&&(emitter instanceof WebInspector.Object||emitter instanceof Node||(typeof emitter.addEventListener==="function"));if(!emitterIsValid||!type||!callback) return;this._emitter=emitter;this._type=type;this._usesCapture=!!usesCapture;if(emitter instanceof Node) callback=callback.bind(this._thisObject);if(this._fireOnce){var listener=this;this._callback=function(){listener.disconnect();callback.apply(this,arguments);};}else this._callback=callback;if(this._emitter instanceof Node) this._emitter.addEventListener(this._type,this._callback,this._usesCapture);else this._emitter.addEventListener(this._type,this._callback,this._thisObject);} disconnect() {if(!this._emitter||!this._callback) return;if(this._emitter instanceof Node) this._emitter.removeEventListener(this._type,this._callback,this._usesCapture);else this._emitter.removeEventListener(this._type,this._callback,this._thisObject);if(this._fireOnce) delete this._thisObject;delete this._emitter;delete this._type;delete this._callback;}}; WebInspector.EventListenerSet=class EventListenerSet {constructor(defaultThisObject,name) {this.name=name;this._defaultThisObject=defaultThisObject;this._listeners=[];this._installed=false;} register(emitter,type,callback,thisObject,usesCapture) {var emitterIsValid=emitter&&(emitter instanceof WebInspector.Object||emitter instanceof Node||(typeof emitter.addEventListener==="function"));if(!emitterIsValid||!type||!callback) return;this._listeners.push({listener:new WebInspector.EventListener(thisObject||this._defaultThisObject),emitter,type,callback,usesCapture});} unregister() {if(this._installed) this.uninstall();this._listeners=[];} install() {if(this._installed) return;this._installed=true;for(var data of this._listeners) data.listener.connect(data.emitter,data.type,data.callback,data.usesCapture);} uninstall(unregisterListeners) {if(!this._installed) return;this._installed=false;for(var data of this._listeners) data.listener.disconnect();if(unregisterListeners) this._listeners=[];}};function useSVGSymbol(url,className,title) {const svgNamespace="http://www.w3.org/2000/svg";const xlinkNamespace="http://www.w3.org/1999/xlink";let svgElement=document.createElementNS(svgNamespace,"svg");svgElement.style.width="100%";svgElement.style.height="100%"; if(!url.includes("#")) url+="#root";let useElement=document.createElementNS(svgNamespace,"use");useElement.setAttributeNS(xlinkNamespace,"xlink:href",url);svgElement.appendChild(useElement);let wrapper=document.createElement("div");wrapper.appendChild(svgElement);if(className) wrapper.className=className;if(title) wrapper.title=title;return wrapper;} (function(){if(WebInspector.dontLocalizeUserInterface) return;let localizedStringsURL=InspectorFrontendHost.localizedStringsURL();if(localizedStringsURL) document.write("");})();WebInspector.unlocalizedString=function(string) { return string;};WebInspector.UIString=function(string,vararg) {if(WebInspector.dontLocalizeUserInterface) return string;if(window.localizedStrings&&string in window.localizedStrings) return window.localizedStrings[string];if(!window.localizedStrings) console.error(`Attempted to load localized string "${string}" before localizedStrings was initialized.`);if(!this._missingLocalizedStrings) this._missingLocalizedStrings={};if(!(string in this._missingLocalizedStrings)){console.error("Localized string \""+string+"\" was not found.");this._missingLocalizedStrings[string]=true;} return"LOCALIZED STRING NOT FOUND";};WebInspector.fileExtensionForURL=function(url) {var lastPathComponent=parseURL(url).lastPathComponent;if(!lastPathComponent) return"";var index=lastPathComponent.indexOf(".");if(index===-1) return"";return lastPathComponent.substr(index+1);};WebInspector.mimeTypeForFileExtension=function(extension) {const extensionToMIMEType={"html":"text/html","xhtml":"application/xhtml+xml","xml":"text/xml","js":"text/javascript","json":"application/json","clj":"text/x-clojure","coffee":"text/x-coffeescript","ls":"text/x-livescript","ts":"text/typescript","css":"text/css","less":"text/x-less","sass":"text/x-sass","scss":"text/x-scss","bmp":"image/bmp","gif":"image/gif","jpeg":"image/jpeg","jpg":"image/jpeg","pdf":"application/pdf","png":"image/png","tif":"image/tiff","tiff":"image/tiff","svg":"image/svg+xml","txt":"text/plain","xsl":"text/xsl"};return extensionToMIMEType[extension]||null;};WebInspector.fileExtensionForMIMEType=function(mimeType) {const mimeTypeToExtension={"text/html":"html","application/xhtml+xml":"xhtml","text/xml":"xml","text/javascript":"js","application/json":"json","text/x-clojure":"clj","text/x-coffeescript":"coffee","text/x-livescript":"ls","text/typescript":"ts","text/css":"css","text/x-less":"less","text/x-sass":"sass","text/x-scss":"scss","image/bmp":"bmp","image/gif":"gif","image/jpeg":"jpg","application/pdf":"pdf","image/png":"png","image/tiff":"tiff","image/svg+xml":"svg","text/plain":"txt","text/xsl":"xsl",};let extension=mimeTypeToExtension[mimeType];return extension?`.${extension}`:null;};WebInspector.rangeForNextCSSNameOrValue=function(text,index=0){let from=0;let to=0;let colonIndex=text.indexOf(":");if(index=0) return url.substring(0,hashIndex);return url;} function relativePath(path,basePath) {var pathComponents=path.split("/");var baseComponents=basePath.replace(/\/$/,"").split("/");var finalComponents=[];var index=1;for(;index=0;--i){if(stopCharacters.indexOf(node.nodeValue[i])!==-1){startNode=node;startOffset=i+1;break;}}} if(startNode) break;node=node.traversePreviousNode(stayWithinNode);} if(!startNode){startNode=stayWithinNode;startOffset=0;}}else{startNode=this;startOffset=offset;} if(!direction||direction==="forward"||direction==="both"){node=this;while(node){if(node===stayWithinNode){if(!endNode) endNode=stayWithinNode;break;} if(node.nodeType===Node.TEXT_NODE){var start=(node===this?offset:0);for(var i=start;i=0;--i){if(this[i]===value){this.splice(i,1);if(onlyFirst) return;}}}});Object.defineProperty(Array.prototype,"toggleIncludes",{value:function(value,force) {let exists=this.includes(value);if(exists===!!force) return;if(exists) this.remove(value);else this.push(value);}});Object.defineProperty(Array.prototype,"insertAtIndex",{value:function(value,index) {this.splice(index,0,value);}});Object.defineProperty(Array.prototype,"keySet",{value:function() {let keys=Object.create(null);for(var i=0;i>1;var rightHalf=maxLength-leftHalf-1;return this.substr(0,leftHalf)+ellipsis+this.substr(this.length-rightHalf,rightHalf);}});Object.defineProperty(String.prototype,"trimEnd",{value:function(maxLength) {if(this.length<=maxLength) return this;return this.substr(0,maxLength-1)+ellipsis;}});Object.defineProperty(String.prototype,"truncate",{value:function(maxLength) {"use strict";if(this.length<=maxLength) return this;let clipped=this.slice(0,maxLength);let indexOfLastWhitespace=clipped.search(/\s\S*$/);if(indexOfLastWhitespace>Math.floor(maxLength/2)) clipped=clipped.slice(0,indexOfLastWhitespace-1);return clipped+ellipsis;}});Object.defineProperty(String.prototype,"collapseWhitespace",{value:function() {return this.replace(/[\s\xA0]+/g," ");}});Object.defineProperty(String.prototype,"removeWhitespace",{value:function() {return this.replace(/[\s\xA0]+/g,"");}});Object.defineProperty(String.prototype,"escapeCharacters",{value:function(chars) {var foundChar=false;for(var i=0;i0&&format[index]==="$"){substitutionIndex=(number-1);++index;}} const defaultPrecision=6;let precision=defaultPrecision;if(format[index]==="."){++index;precision=parseInt(format.substring(index),10);if(isNaN(precision)) precision=defaultPrecision;while(!isNaN(format[index])) ++index;} addSpecifierToken(format[index],precision,substitutionIndex);++substitutionIndex;++index;} addStringToken(format.substring(index));return tokens;}});Object.defineProperty(String.prototype,"hash",{get:function() {const stringHashingStartValue=0x9e3779b9;var result=stringHashingStartValue;var pendingCharacter=null;for(var i=0;i>11;pendingCharacter=null;} if(pendingCharacter!==null){result+=pendingCharacter;result^=result<<11;result+=result>>17;} result^=result<<3;result+=result>>5;result^=result<<2;result+=result>>15;result^=result<<10;return(0xffffffff+result+1).toString(36);}});Object.defineProperty(String,"standardFormatters",{value:{d:function(substitution) {return parseInt(substitution).toLocaleString();},f:function(substitution,token) {let value=parseFloat(substitution);if(isNaN(value)) return NaN;let options={minimumFractionDigits:token.precision,maximumFractionDigits:token.precision,useGrouping:false};return value.toLocaleString(undefined,options);},s:function(substitution) {return substitution;}}});Object.defineProperty(String,"format",{value:function(format,substitutions,formatters,initialValue,append) {if(!format||!substitutions||!substitutions.length) return{formattedResult:append(initialValue,format),unusedSubstitutions:substitutions};function prettyFunctionName() {return"String.format(\""+format+"\", \""+Array.from(substitutions).join("\", \"")+"\")";} function warn(msg) {console.warn(prettyFunctionName()+": "+msg);} function error(msg) {console.error(prettyFunctionName()+": "+msg);} var result=initialValue;var tokens=String.tokenizeFormatString(format);var usedSubstitutionIndexes={};for(var i=0;i=substitutions.length){ error("not enough substitution arguments. Had "+substitutions.length+" but needed "+(token.substitutionIndex+1)+", so substitution was skipped.");result=append(result,"%"+(token.precision>-1?token.precision:"")+token.specifier);continue;} usedSubstitutionIndexes[token.substitutionIndex]=true;if(!(token.specifier in formatters)){warn("unsupported format character \u201C"+token.specifier+"\u201D. Treating as a string.");result=append(result,substitutions[token.substitutionIndex]);continue;} result=append(result,formatters[token.specifier](substitutions[token.substitutionIndex],token));} var unusedSubstitutions=[];for(var i=0;i=0){indexesOfNeedle.push(index);index=this.indexOf(needle,index+1);} return indexesOfNeedle;}});Object.defineProperty(String.prototype,"levenshteinDistance",{value:function(s) {var m=this.length;var n=s.length;var d=new Array(m+1);for(var i=0;i<=m;++i){d[i]=new Array(n+1);d[i][0]=i;} for(var j=0;j<=n;++j) d[0][j]=j;for(var j=1;j<=n;++j){for(var i=1;i<=m;++i){if(this[i-1]===s[j-1]) d[i][j]=d[i-1][j-1];else{var deletion=d[i-1][j]+1;var insertion=d[i][j-1]+1;var substitution=d[i-1][j-1]+1;d[i][j]=Math.min(deletion,insertion,substitution);}}} return d[m][n];}});Object.defineProperty(String.prototype,"toCamelCase",{value:function() {return this.toLowerCase().replace(/[^\w]+(\w)/g,(match,group)=>group.toUpperCase());}});Object.defineProperty(String.prototype,"hasMatchingEscapedQuotes",{value:function() {return/^\"(?:[^\"\\]|\\.)*\"$/.test(this) || /^\'(?:[^\'\\]|\\.)*\'$/.test(this); } }); Object.defineProperty(Math, "roundTo", { value: function(num, step) { return Math.round(num / step) * step; } }); Object.defineProperty(Number, "constrain", { value: function(num, min, max) { if (max < min) return min; if (num < min) num = min; else if (num > max) num = max; return num; } }); Object.defineProperty(Number, "percentageString", { value: function(fraction, precision = 1) { return fraction.toLocaleString(undefined, {minimumFractionDigits: precision, style: "percent"}); } }); Object.defineProperty(Number, "secondsToMillisecondsString", { value: function(seconds, higherResolution) { let ms = seconds * 1000; if (higherResolution) return WebInspector.UIString("%.2fms").format(ms); return WebInspector.UIString("%.1fms").format(ms); } }); Object.defineProperty(Number, "secondsToString", { value: function(seconds, higherResolution) { let ms = seconds * 1000; if (!ms) return WebInspector.UIString("%.0fms").format(0); if (Math.abs(ms) < 10) { if (higherResolution) return WebInspector.UIString("%.3fms").format(ms); return WebInspector.UIString("%.2fms").format(ms); } if (Math.abs(ms) < 100) { if (higherResolution) return WebInspector.UIString("%.2fms").format(ms); return WebInspector.UIString("%.1fms").format(ms); } if (Math.abs(ms) < 1000) { if (higherResolution) return WebInspector.UIString("%.1fms").format(ms); return WebInspector.UIString("%.0fms").format(ms); } // Do not go over seconds when in high resolution mode. if (higherResolution || Math.abs(seconds) < 60) return WebInspector.UIString("%.2fs").format(seconds); let minutes = seconds / 60; if (Math.abs(minutes) < 60) return WebInspector.UIString("%.1fmin").format(minutes); let hours = minutes / 60; if (Math.abs(hours) < 24) return WebInspector.UIString("%.1fhrs").format(hours); let days = hours / 24; return WebInspector.UIString("%.1f days").format(days); } }); Object.defineProperty(Number, "bytesToString", { value: function(bytes, higherResolution) { if (higherResolution === undefined) higherResolution = true; if (Math.abs(bytes) < 1024) return WebInspector.UIString("%.0f B").format(bytes); let kilobytes = bytes / 1024; if (Math.abs(kilobytes) < 1024) { if (higherResolution || Math.abs(kilobytes) < 10) return WebInspector.UIString("%.2f KB").format(kilobytes); return WebInspector.UIString("%.1f KB").format(kilobytes); } let megabytes = kilobytes / 1024; if (Math.abs(megabytes) < 1024) { if (higherResolution || Math.abs(megabytes) < 10) return WebInspector.UIString("%.2f MB").format(megabytes); return WebInspector.UIString("%.1f MB").format(megabytes); } let gigabytes = megabytes / 1024; if (higherResolution || Math.abs(gigabytes) < 10) return WebInspector.UIString("%.2f GB").format(gigabytes); return WebInspector.UIString("%.1f GB").format(gigabytes); } }); Object.defineProperty(Number, "abbreviate", { value: function(num) { if (num < 1000) return num.toLocaleString(); if (num < 1000000) return WebInspector.UIString("%.1fK").format(Math.round(num / 100) / 10); if (num < 1000000000) return WebInspector.UIString("%.1fM").format(Math.round(num / 100000) / 10); return WebInspector.UIString("%.1fB").format(Math.round(num / 100000000) / 10); } }); Object.defineProperty(Number.prototype, "maxDecimals", { value(decimals) { let power = 10 ** decimals; return Math.round(this * power) / power; } }); Object.defineProperty(Uint32Array, "isLittleEndian", { value: function() { if ("_isLittleEndian" in this) return this._isLittleEndian; var buffer = new ArrayBuffer(4); var longData = new Uint32Array(buffer); var data = new Uint8Array(buffer); longData[0] = 0x0a0b0c0d; this._isLittleEndian = data[0] === 0x0d && data[1] === 0x0c && data[2] === 0x0b && data[3] === 0x0a; return this._isLittleEndian; } }); function isEmptyObject(object) { for (var property in object) return false; return true; } function isEnterKey(event) { // Check if this is an IME event. return event.keyCode !== 229 && event.keyIdentifier === "Enter"; } function resolveDotsInPath(path) { if (!path) return path; if (path.indexOf("./") === -1) return path; var result = []; var components = path.split("/"); for (var i = 0; i < components.length; ++i) { var component = components[i]; // Skip over "./". if (component === ".") continue; // Rewind one component for "../". if (component === "..") { if (result.length === 1) continue; result.pop(); continue; } result.push(component); } return result.join("/"); } function parseMIMEType(fullMimeType) { if (!fullMimeType) return {type: fullMimeType, boundary: null, encoding: null}; var typeParts = fullMimeType.split(/\s*;\s*/); var type = typeParts[0]; var boundary = null; var encoding = null; for (var i = 1; i < typeParts.length; ++i) { var subparts = typeParts[i].split(/\s*=\s*/); if (subparts.length !== 2) continue; if (subparts[0].toLowerCase() === "boundary") boundary = subparts[1]; else if (subparts[0].toLowerCase() === "charset") encoding = subparts[1].replace("^\"|\"$","");} return{type,boundary:boundary||null,encoding:encoding||null};} function simpleGlobStringToRegExp(globString,regExpFlags) {if(!globString) return null;var regexString=globString.escapeCharacters("^[]{}()\\.$+?|");regexString=regexString.replace(/\\\\\*/g,"\\*");var unescapedAsteriskRegex=/(^|[^\\])\*+/g;if(unescapedAsteriskRegex.test(globString)){regexString=regexString.replace(unescapedAsteriskRegex,"$1.*"); regexString="\\b"+regexString+"\\b";} return new RegExp(regexString,regExpFlags);} Object.defineProperty(Array.prototype,"lowerBound",{ value:function(object,comparator) {function defaultComparator(a,b) {return a-b;} comparator=comparator||defaultComparator;var l=0;var r=this.length;while(l>1;if(comparator(object,this[m])>0) l=m+1;else r=m;} return r;}});Object.defineProperty(Array.prototype,"upperBound",{ value:function(object,comparator) {function defaultComparator(a,b) {return a-b;} comparator=comparator||defaultComparator;var l=0;var r=this.length;while(l>1;if(comparator(object,this[m])>=0) l=m+1;else r=m;} return r;}});Object.defineProperty(Array.prototype,"binaryIndexOf",{value:function(value,comparator) {var index=this.lowerBound(value,comparator);return index{let original=target[property];if(original[debounceTimeoutSymbol]) clearTimeout(original[debounceTimeoutSymbol]);let performWork=()=>{original[debounceTimeoutSymbol]=undefined;original.apply(target,args);};original[debounceTimeoutSymbol]=setTimeout(performWork,delay);};}});}});Object.defineProperty(Function.prototype,"cancelDebounce",{value:function() {if(!this[debounceTimeoutSymbol]) return;clearTimeout(this[debounceTimeoutSymbol]);this[debounceTimeoutSymbol]=undefined;}});const requestAnimationFrameSymbol=Symbol("peform-on-animation-frame");const requestAnimationFrameProxySymbol=Symbol("perform-on-animation-frame-proxy");Object.defineProperty(Object.prototype,"onNextFrame",{get:function() {if(!this[requestAnimationFrameProxySymbol]){this[requestAnimationFrameProxySymbol]=new Proxy(this,{get(target,property,receiver){return(...args)=>{let original=target[property];if(original[requestAnimationFrameSymbol]) return;let performWork=()=>{original[requestAnimationFrameSymbol]=undefined;original.apply(target,args);};original[requestAnimationFrameSymbol]=requestAnimationFrame(performWork);};}});} return this[requestAnimationFrameProxySymbol];}});})();function appendWebInspectorSourceURL(string) {if(string.includes("//# sourceURL")) return string;return"\n//# sourceURL=__WebInspectorInternal__\n"+string;} function appendWebInspectorConsoleEvaluationSourceURL(string) {if(string.includes("//# sourceURL")) return string;return"\n//# sourceURL=__WebInspectorConsoleEvaluation__\n"+string;} function isWebInspectorInternalScript(url) {return url==="__WebInspectorInternal__";} function isWebInspectorConsoleEvaluationScript(url) {return url==="__WebInspectorConsoleEvaluation__";} function isWebKitInjectedScript(url) {return url&&url.startsWith("__InjectedScript_")&&url.endsWith(".js");} function isWebKitInternalScript(url) {if(isWebInspectorConsoleEvaluationScript(url)) return false;if(isWebKitInjectedScript(url)) return true;return url&&url.startsWith("__Web")&&url.endsWith("__");} function isFunctionStringNativeCode(str) {return str.endsWith("{\n [native code]\n}");} function isTextLikelyMinified(content) {const autoFormatMaxCharactersToCheck=5000;const autoFormatWhitespaceRatio=0.2;let whitespaceScore=0;let size=Math.min(autoFormatMaxCharactersToCheck,content.length);for(let i=0;i1?"-"+inspectionLevel:"";this._localStorageKey=`com.apple.WebInspector${levelString}.${name}`;this._defaultValue=defaultValue;} get name() {return this._name;} get value() {if("_value"in this) return this._value;this._value=JSON.parse(JSON.stringify(this._defaultValue));if(!window.InspectorTest&&window.localStorage&&this._localStorageKey in window.localStorage){try{this._value=JSON.parse(window.localStorage[this._localStorageKey]);}catch(e){delete window.localStorage[this._localStorageKey];}} return this._value;} set value(value) {if(this._value===value) return;this._value=value;if(!window.InspectorTest&&window.localStorage){try{if(Object.shallowEqual(this._value,this._defaultValue)) delete window.localStorage[this._localStorageKey];else window.localStorage[this._localStorageKey]=JSON.stringify(this._value);}catch(e){console.error("Error saving setting with name: "+this._name);}} this.dispatchEventToListeners(WebInspector.Setting.Event.Changed,this._value,{name:this._name});} reset() {this.value=JSON.parse(JSON.stringify(this._defaultValue));}};WebInspector.Setting.Event={Changed:"setting-changed"};WebInspector.settings={autoLogProtocolMessages:new WebInspector.Setting("auto-collect-protocol-messages",false),autoLogTimeStats:new WebInspector.Setting("auto-collect-time-stats",false),enableUncaughtExceptionReporter:new WebInspector.Setting("enable-uncaught-exception-reporter",true),enableLineWrapping:new WebInspector.Setting("enable-line-wrapping",false),indentUnit:new WebInspector.Setting("indent-unit",4),tabSize:new WebInspector.Setting("tab-size",4),indentWithTabs:new WebInspector.Setting("indent-with-tabs",false),showWhitespaceCharacters:new WebInspector.Setting("show-whitespace-characters",false),showInvalidCharacters:new WebInspector.Setting("show-invalid-characters",false),clearLogOnNavigate:new WebInspector.Setting("clear-log-on-navigate",true),clearNetworkOnNavigate:new WebInspector.Setting("clear-network-on-navigate",true),zoomFactor:new WebInspector.Setting("zoom-factor",1),layoutDirection:new WebInspector.Setting("layout-direction-override","system"),stylesShowInlineWarnings:new WebInspector.Setting("styles-show-inline-warning",true),stylesInsertNewline:new WebInspector.Setting("styles-insert-newline",true),stylesSelectOnFirstClick:new WebInspector.Setting("styles-select-on-first-click",true),showScopeChainOnPause:new WebInspector.Setting("show-scope-chain-sidebar",true),showImageGrid:new WebInspector.Setting("show-image-grid",false), experimentalShowCanvasContextsInResources:new WebInspector.Setting("experimental-show-canvas-contexts-in-resources",false),};WebInspector.YieldableTask=class YieldableTask extends WebInspector.Object {constructor(delegate,items,options={}) {super();let{workInterval,idleInterval}=options;this._workInterval=workInterval||10;this._idleInterval=idleInterval||0;this._delegate=delegate;this._items=items;this._idleTimeoutIdentifier=undefined;this._processing=false;this._processing=false;this._cancelled=false;} get processing(){return this._processing;} get cancelled(){return this._cancelled;} get idleInterval(){return this._idleInterval;} get workInterval(){return this._workInterval;} start() {if(this._processing) return;if(this._cancelled) return;function*createIteratorForProcessingItems() {let startTime=Date.now();let processedItems=[];for(let item of this._items){if(this._cancelled) break;this._delegate.yieldableTaskWillProcessItem(this,item);processedItems.push(item);if(this._cancelled) break;let elapsedTime=Date.now()-startTime;if(elapsedTime>this._workInterval){let returnedItems=processedItems.slice();processedItems=[];this._willYield(returnedItems,elapsedTime);yield;startTime=Date.now();}} if(processedItems.length) this._willYield(processedItems,Date.now()-startTime);} this._processing=true;this._pendingItemsIterator=createIteratorForProcessingItems.call(this);this._processPendingItems();} cancel() {if(!this._processing) return;this._cancelled=true;} _processPendingItems() {if(this._cancelled) return;if(!this._pendingItemsIterator.next().done){this._idleTimeoutIdentifier=setTimeout(()=>{this._processPendingItems();},this._idleInterval);return;} this._didFinish();} _willYield(processedItems,elapsedTime) {if(typeof this._delegate.yieldableTaskDidYield==="function") this._delegate.yieldableTaskDidYield(this,processedItems,elapsedTime);} _didFinish() {this._processing=false;this._pendingItemsIterator=null;if(this._idleTimeoutIdentifier){clearTimeout(this._idleTimeoutIdentifier);this._idleTimeoutIdentifier=undefined;} if(typeof this._delegate.yieldableTaskDidFinish==="function") this._delegate.yieldableTaskDidFinish(this);}};WebInspector.ProtocolTracer=class ProtocolTracer extends WebInspector.Object { logStarted() {} logFrontendException(message,exception) {} logProtocolError(message,error) {} logFrontendRequest(message) {} logWillHandleResponse(message) {} logDidHandleResponse(message,timings=null) {} logWillHandleEvent(message) {} logDidHandleEvent(message,timings=null) {} logFinished() {}};WebInspector.LoggingProtocolTracer=class LoggingProtocolTracer extends WebInspector.ProtocolTracer {constructor() {super();this._dumpMessagesToConsole=false;this._dumpTimingDataToConsole=false;this._logToConsole=window.InspectorTest?InspectorFrontendHost.unbufferedLog.bind(InspectorFrontendHost):console.log.bind(console);} set dumpMessagesToConsole(value) {this._dumpMessagesToConsole=!!value;} get dumpMessagesToConsole() {return this._dumpMessagesToConsole;} set dumpTimingDataToConsole(value) {this._dumpTimingDataToConsole=!!value;} get dumpTimingDataToConsole() {return this._dumpTimingDataToConsole;} logFrontendException(message,exception) {this._processEntry({type:"exception",message,exception});} logProtocolError(message,error) {this._processEntry({type:"error",message,error});} logFrontendRequest(message) {this._processEntry({type:"request",message});} logWillHandleResponse(message) {let entry={type:"response",message};this._processEntry(entry);} logDidHandleResponse(message,timings=null) {let entry={type:"response",message};if(timings) entry.timings=Object.shallowCopy(timings);this._processEntry(entry);} logWillHandleEvent(message) {let entry={type:"event",message};this._processEntry(entry);} logDidHandleEvent(message,timings=null) {let entry={type:"event",message};if(timings) entry.timings=Object.shallowCopy(timings);this._processEntry(entry);} _processEntry(entry) {if(this._dumpTimingDataToConsole&&entry.timings){if(entry.timings.rtt&&entry.timings.dispatch) this._logToConsole(`time-stats: Handling: ${entry.timings.dispatch || NaN}ms; RTT: ${entry.timings.rtt}ms`);else if(entry.timings.dispatch) this._logToConsole(`time-stats: Handling: ${entry.timings.dispatch || NaN}ms`);}else if(this._dumpMessagesToConsole&&!entry.timings){this._logToConsole(`${entry.type}: ${JSON.stringify(entry.message)}`);if(entry.exception){this._logToConsole(entry.exception);if(entry.exception.stack) this._logToConsole(entry.exception.stack);}}}};InspectorBackendClass=class InspectorBackendClass {constructor() {this._agents={};this._customTracer=null;this._defaultTracer=new WebInspector.LoggingProtocolTracer;this._activeTracers=[this._defaultTracer];this._workerSupportedDomains=[];WebInspector.settings.autoLogProtocolMessages.addEventListener(WebInspector.Setting.Event.Changed,this._startOrStopAutomaticTracing,this);WebInspector.settings.autoLogTimeStats.addEventListener(WebInspector.Setting.Event.Changed,this._startOrStopAutomaticTracing,this);this._startOrStopAutomaticTracing();this.currentDispatchState={event:null,request:null,response:null,};} get workerSupportedDomains(){return this._workerSupportedDomains;} set dumpInspectorProtocolMessages(value) {WebInspector.settings.autoLogProtocolMessages.value=value;this._defaultTracer.dumpMessagesToConsole=value;} get dumpInspectorProtocolMessages() {return WebInspector.settings.autoLogProtocolMessages.value;} set dumpInspectorTimeStats(value) {WebInspector.settings.autoLogTimeStats.value=value;if(!this.dumpInspectorProtocolMessages) this.dumpInspectorProtocolMessages=true;this._defaultTracer.dumpTimingDataToConsole=value;} get dumpInspectorTimeStats() {return WebInspector.settings.autoLogTimeStats.value;} set customTracer(tracer) {if(!tracer&&!this._customTracer) return;if(tracer===this._customTracer) return;if(tracer===this._defaultTracer) return;if(this._customTracer) this._customTracer.logFinished();this._customTracer=tracer;this._activeTracers=[this._defaultTracer];if(this._customTracer){this._customTracer.logStarted();this._activeTracers.push(this._customTracer);}} get activeTracers() {return this._activeTracers;} registerCommand(qualifiedName,callSignature,replySignature) {var[domainName,commandName]=qualifiedName.split(".");var agent=this._agentForDomain(domainName);agent.addCommand(InspectorBackend.Command.create(agent,qualifiedName,callSignature,replySignature));} registerEnum(qualifiedName,enumValues) {var[domainName,enumName]=qualifiedName.split(".");var agent=this._agentForDomain(domainName);agent.addEnum(enumName,enumValues);} registerEvent(qualifiedName,signature) {var[domainName,eventName]=qualifiedName.split(".");var agent=this._agentForDomain(domainName);agent.addEvent(new InspectorBackend.Event(eventName,signature));} registerDomainDispatcher(domainName,dispatcher) {var agent=this._agentForDomain(domainName);agent.dispatcher=dispatcher;} dispatch(message) {InspectorBackend.mainConnection.dispatch(message);} runAfterPendingDispatches(script) {InspectorBackend.mainConnection.runAfterPendingDispatches(script);} activateDomain(domainName,activationDebuggableType) {if(!activationDebuggableType||InspectorFrontendHost.debuggableType()===activationDebuggableType){var agent=this._agents[domainName];agent.activate();return agent;} return null;} workerSupportedDomain(domainName) {this._workerSupportedDomains.push(domainName);} _startOrStopAutomaticTracing() {this._defaultTracer.dumpMessagesToConsole=this.dumpInspectorProtocolMessages;this._defaultTracer.dumpTimingDataToConsole=this.dumpTimingDataToConsole;} _agentForDomain(domainName) {if(this._agents[domainName]) return this._agents[domainName];var agent=new InspectorBackend.Agent(domainName);this._agents[domainName]=agent;return agent;}};InspectorBackend=new InspectorBackendClass;InspectorBackend.Agent=class InspectorBackendAgent {constructor(domainName) {this._domainName=domainName;this._connection=InspectorBackend.mainConnection;this._dispatcher=null;this._active=false; this._events={};} get domainName() {return this._domainName;} get active() {return this._active;} get connection() {return this._connection;} set connection(connection) {this._connection=connection;} get dispatcher() {return this._dispatcher;} set dispatcher(value) {this._dispatcher=value;} addEnum(enumName,enumValues) {this[enumName]=enumValues;} addCommand(command) {this[command.commandName]=command;} addEvent(event) {this._events[event.eventName]=event;} getEvent(eventName) {return this._events[eventName];} hasEvent(eventName) {return eventName in this._events;} hasEventParameter(eventName,eventParameterName) {let event=this._events[eventName];return event&&event.parameterNames.includes(eventParameterName);} activate() {this._active=true;window[this._domainName+"Agent"]=this;} dispatchEvent(eventName,eventArguments) {if(!(eventName in this._dispatcher)){console.error("Protocol Error: Attempted to dispatch an unimplemented method '"+this._domainName+"."+eventName+"'");return false;} this._dispatcher[eventName].apply(this._dispatcher,eventArguments);return true;}};InspectorBackend.Command=function(agent,qualifiedName,callSignature,replySignature) {"use strict";this._agent=agent;this._instance=this;let[domainName,commandName]=qualifiedName.split(".");this._qualifiedName=qualifiedName;this._commandName=commandName;this._callSignature=callSignature||[];this._replySignature=replySignature||[];};InspectorBackend.Command.create=function(agent,commandName,callSignature,replySignature) {"use strict";let instance=new InspectorBackend.Command(agent,commandName,callSignature,replySignature);function callable(){return instance._invokeWithArguments.call(instance,this,Array.from(arguments));} callable._instance=instance;Object.setPrototypeOf(callable,InspectorBackend.Command.prototype);return callable;};InspectorBackend.Command.prototype={__proto__:Function.prototype, get qualifiedName() {return this._instance._qualifiedName;},get commandName() {return this._instance._commandName;},get callSignature() {return this._instance._callSignature;},get replySignature() {return this._instance._replySignature;},invoke(commandArguments,callback,agent) {"use strict";agent=agent||this._instance._agent;if(typeof callback==="function") agent._connection._sendCommandToBackendWithCallback(this._instance,commandArguments,callback);else return agent._connection._sendCommandToBackendExpectingPromise(this._instance,commandArguments);},supports(parameterName) {"use strict";return this._instance.callSignature.some((parameter)=>parameter["name"]===parameterName);}, _invokeWithArguments(agent,commandArguments) {"use strict";let instance=this._instance;let callback=typeof commandArguments.lastValue==="function"?commandArguments.pop():null;function deliverFailure(message){console.error(`Protocol Error: ${message}`);if(callback) setTimeout(callback.bind(null,message),0);else return Promise.reject(new Error(message));} let parameters={};for(let parameter of instance.callSignature){let parameterName=parameter["name"];let typeName=parameter["type"];let optionalFlag=parameter["optional"];if(!commandArguments.length&&!optionalFlag) return deliverFailure(`Invalid number of arguments for command '${instance.qualifiedName}'.`);let value=commandArguments.shift();if(optionalFlag&&value===undefined) continue;if(typeof value!==typeName) return deliverFailure(`Invalid type of argument '${parameterName}' for command '${instance.qualifiedName}' call. It must be '${typeName}' but it is '${typeof value}'.`);parameters[parameterName]=value;} if(!callback&&commandArguments.length===1&&commandArguments[0]!==undefined) return deliverFailure(`Protocol Error: Optional callback argument for command '${instance.qualifiedName}' call must be a function but its type is '${typeof commandArguments[0]}'.`);if(callback) agent._connection._sendCommandToBackendWithCallback(instance,parameters,callback);else return agent._connection._sendCommandToBackendExpectingPromise(instance,parameters);}};InspectorBackend.Event=class Event {constructor(eventName,parameterNames) {this.eventName=eventName;this.parameterNames=parameterNames;}};InspectorBackend.Connection=class InspectorBackendConnection {constructor() {this._lastSequenceId=1;this._pendingResponses=new Map;this._agents={};this._deferredScripts=[];this._target=null;} get target() {return this._target;} set target(target) {this._target=target;for(let domain in this._agents){let dispatcher=this._agents[domain].dispatcher;if(dispatcher) dispatcher.target=target;}} dispatch(message) {let messageObject=(typeof message==="string")?JSON.parse(message):message;if("id"in messageObject) this._dispatchResponse(messageObject);else this._dispatchEvent(messageObject);} runAfterPendingDispatches(script) {if(!this._pendingResponses.size) script.call(this);else this._deferredScripts.push(script);} sendMessageToBackend(message) {throw new Error("Should be implemented by a InspectorBackend.Connection subclass");} _dispatchResponse(messageObject) {if(messageObject["error"]){if(messageObject["error"].code!==-32000) console.error("Request with id = "+messageObject["id"]+" failed. "+JSON.stringify(messageObject["error"]));} let sequenceId=messageObject["id"];let responseData=this._pendingResponses.take(sequenceId)||{};let{request,command,callback,promise}=responseData;let processingStartTimestamp=timestamp();for(let tracer of InspectorBackend.activeTracers) tracer.logWillHandleResponse(messageObject);InspectorBackend.currentDispatchState.request=request;InspectorBackend.currentDispatchState.response=messageObject;if(typeof callback==="function") this._dispatchResponseToCallback(command,request,messageObject,callback);else if(typeof promise==="object") this._dispatchResponseToPromise(command,messageObject,promise);else console.error("Received a command response without a corresponding callback or promise.",messageObject,command);InspectorBackend.currentDispatchState.request=null;InspectorBackend.currentDispatchState.response=null;let processingTime=(timestamp()-processingStartTimestamp).toFixed(3);let roundTripTime=(processingStartTimestamp-responseData.sendRequestTimestamp).toFixed(3);for(let tracer of InspectorBackend.activeTracers) tracer.logDidHandleResponse(messageObject,{rtt:roundTripTime,dispatch:processingTime});if(this._deferredScripts.length&&!this._pendingResponses.size) this._flushPendingScripts();} _dispatchResponseToCallback(command,requestObject,responseObject,callback) {let callbackArguments=[];callbackArguments.push(responseObject["error"]?responseObject["error"].message:null);if(responseObject["result"]){for(let parameterName of command.replySignature) callbackArguments.push(responseObject["result"][parameterName]);} try{callback.apply(null,callbackArguments);}catch(e){WebInspector.reportInternalError(e,{"cause":`An uncaught exception was thrown while dispatching response callback for command ${command.qualifiedName}.`});}} _dispatchResponseToPromise(command,messageObject,promise) {let{resolve,reject}=promise;if(messageObject["error"]) reject(new Error(messageObject["error"].message));else resolve(messageObject["result"]);} _dispatchEvent(messageObject) {let qualifiedName=messageObject["method"];let[domainName,eventName]=qualifiedName.split(".");if(!(domainName in this._agents)){console.error("Protocol Error: Attempted to dispatch method '"+eventName+"' for non-existing domain '"+domainName+"'");return;} let agent=this._agents[domainName];if(!agent.active){console.error("Protocol Error: Attempted to dispatch method for domain '"+domainName+"' which exists but is not active.");return;} let event=agent.getEvent(eventName);if(!event){console.error("Protocol Error: Attempted to dispatch an unspecified method '"+qualifiedName+"'");return;} let eventArguments=[];if(messageObject["params"]) eventArguments=event.parameterNames.map((name)=>messageObject["params"][name]);let processingStartTimestamp=timestamp();for(let tracer of InspectorBackend.activeTracers) tracer.logWillHandleEvent(messageObject);InspectorBackend.currentDispatchState.event=messageObject;try{agent.dispatchEvent(eventName,eventArguments);}catch(e){for(let tracer of InspectorBackend.activeTracers) tracer.logFrontendException(messageObject,e);WebInspector.reportInternalError(e,{"cause":`An uncaught exception was thrown while handling event: ${qualifiedName}`});} InspectorBackend.currentDispatchState.event=null;let processingDuration=(timestamp()-processingStartTimestamp).toFixed(3);for(let tracer of InspectorBackend.activeTracers) tracer.logDidHandleEvent(messageObject,{dispatch:processingDuration});} _sendCommandToBackendWithCallback(command,parameters,callback) {let sequenceId=this._lastSequenceId++;let messageObject={"id":sequenceId,"method":command.qualifiedName,};if(!isEmptyObject(parameters)) messageObject["params"]=parameters;let responseData={command,request:messageObject,callback};if(InspectorBackend.activeTracer) responseData.sendRequestTimestamp=timestamp();this._pendingResponses.set(sequenceId,responseData);this._sendMessageToBackend(messageObject);} _sendCommandToBackendExpectingPromise(command,parameters) {let sequenceId=this._lastSequenceId++;let messageObject={"id":sequenceId,"method":command.qualifiedName,};if(!isEmptyObject(parameters)) messageObject["params"]=parameters;let responseData={command,request:messageObject};if(InspectorBackend.activeTracer) responseData.sendRequestTimestamp=timestamp();let responsePromise=new Promise(function(resolve,reject){responseData.promise={resolve,reject};});this._pendingResponses.set(sequenceId,responseData);this._sendMessageToBackend(messageObject);return responsePromise;} _sendMessageToBackend(messageObject) {for(let tracer of InspectorBackend.activeTracers) tracer.logFrontendRequest(messageObject);this.sendMessageToBackend(JSON.stringify(messageObject));} _flushPendingScripts() {let scriptsToRun=this._deferredScripts;this._deferredScripts=[];for(let script of scriptsToRun) script.call(this);}};InspectorBackend.MainConnection=class InspectorBackendPageConnection extends InspectorBackend.Connection {constructor() {super();this._agents=InspectorBackend._agents;} sendMessageToBackend(message) {InspectorFrontendHost.sendMessageToBackend(message);}};InspectorBackend.WorkerConnection=class InspectorBackendWorkerConnection extends InspectorBackend.Connection {constructor(workerId) {super();this._workerId=workerId;const workerDomains=InspectorBackend.workerSupportedDomains;for(let domain of workerDomains){let agent=InspectorBackend._agents[domain];let clone=Object.create(InspectorBackend._agents[domain]);clone.connection=this;clone.dispatcher=new agent.dispatcher.constructor;this._agents[domain]=clone;}} sendMessageToBackend(message) {WorkerAgent.sendMessageToWorker(this._workerId,message);}};InspectorBackend.mainConnection=new InspectorBackend.MainConnection;InspectorFrontendAPI={_loaded:false,_pendingCommands:[],savedURL:function(url) {},appendedToURL:function(url) {},isTimelineProfilingEnabled:function() {return WebInspector.timelineManager.isCapturing();},setTimelineProfilingEnabled:function(enabled) {if(WebInspector.timelineManager.isCapturing()===enabled) return;if(enabled) WebInspector.timelineManager.startCapturing();else WebInspector.timelineManager.stopCapturing();},setElementSelectionEnabled:function(enabled) {WebInspector.domTreeManager.inspectModeEnabled=enabled;},setDockingUnavailable:function(unavailable) {WebInspector.updateDockingAvailability(!unavailable);},setDockSide:function(side) {WebInspector.updateDockedState(side);},setIsVisible:function(visible) {WebInspector.updateVisibilityState(visible);},showConsole:function() {WebInspector.showConsoleTab();WebInspector.quickConsole.prompt.focus();if(document.readyState!=="complete") document.addEventListener("readystatechange",this);if(document.visibilityState!=="visible") document.addEventListener("visibilitychange",this);},handleEvent:function(event) {if(document.readyState==="complete"&&document.visibilityState==="visible"){WebInspector.quickConsole.prompt.focus();document.removeEventListener("readystatechange",this);document.removeEventListener("visibilitychange",this);}},showResources:function() {WebInspector.showResourcesTab();},showTimelines:function() {WebInspector.showTimelineTab();},showMainResourceForFrame:function(frameIdentifier) {const options={ignoreNetworkTab:true,ignoreSearchTab:true,};WebInspector.showSourceCodeForFrame(frameIdentifier,options);},contextMenuItemSelected:function(id) {try{WebInspector.ContextMenu.contextMenuItemSelected(id);}catch(e){console.error("Uncaught exception in inspector page under contextMenuItemSelected",e);}},contextMenuCleared:function() {WebInspector.ContextMenu.contextMenuCleared();},dispatchMessageAsync:function(messageObject) {WebInspector.dispatchMessageFromBackend(messageObject);},dispatchMessage:function(messageObject) {InspectorBackend.dispatch(messageObject);},dispatch:function(signature) {if(!InspectorFrontendAPI._loaded){InspectorFrontendAPI._pendingCommands.push(signature);return null;} var methodName=signature.shift();if(!InspectorFrontendAPI[methodName]) return null;return InspectorFrontendAPI[methodName].apply(InspectorFrontendAPI,signature);},loadCompleted:function() {InspectorFrontendAPI._loaded=true;for(var i=0;i");})();WebInspector._messagesToDispatch=[];WebInspector.dispatchNextQueuedMessageFromBackend=function() {const startCount=WebInspector._messagesToDispatch.length;const startTimestamp=timestamp();const timeLimitPerRunLoop=10; let i=0;for(;itimeLimitPerRunLoop) break;InspectorBackend.dispatch(WebInspector._messagesToDispatch[i]);} if(i===WebInspector._messagesToDispatch.length){WebInspector._messagesToDispatch=[];WebInspector._dispatchTimeout=null;}else{WebInspector._messagesToDispatch=WebInspector._messagesToDispatch.slice(i);WebInspector._dispatchTimeout=setTimeout(WebInspector.dispatchNextQueuedMessageFromBackend,0);} if(InspectorBackend.dumpInspectorTimeStats){let messageDuration=(timestamp()-startTimestamp).toFixed(3);let dispatchedCount=startCount-WebInspector._messagesToDispatch.length;let remainingCount=WebInspector._messagesToDispatch.length;console.log(`time-stats: --- RunLoop duration: ${messageDuration}ms; dispatched: ${dispatchedCount}; remaining: ${remainingCount}`);}};WebInspector.dispatchMessageFromBackend=function(message) {this._messagesToDispatch.push(message); if(window.__uncaughtExceptions&&window.__uncaughtExceptions.length) return;if(this._dispatchTimeout) return;this._dispatchTimeout=setTimeout(this.dispatchNextQueuedMessageFromBackend,0);};WebInspector.RemoteObject=class RemoteObject {constructor(target,objectId,type,subtype,value,description,size,classPrototype,className,preview) {this._target=target||WebInspector.mainTarget;this._type=type;this._subtype=subtype;if(objectId){this._objectId=objectId;this._description=description||"";this._hasChildren=type!=="symbol";this._size=size;this._classPrototype=classPrototype;this._preview=preview;if(subtype==="class"){this._functionDescription=this._description;this._description="class "+className;}}else{this._description=description||(value+"");this._hasChildren=false;this._value=value;}} static createFakeRemoteObject() {return new WebInspector.RemoteObject(undefined,WebInspector.RemoteObject.FakeRemoteObjectId,"object");} static fromPrimitiveValue(value) {return new WebInspector.RemoteObject(undefined,undefined,typeof value,undefined,value,undefined,undefined,undefined,undefined);} static fromPayload(payload,target) {if(payload.subtype==="array"){var match=payload.description.match(/\[(\d+)\]$/);if(match){payload.size=parseInt(match[1]);payload.description=payload.description.replace(/\[\d+\]$/,"");}} if(payload.classPrototype) payload.classPrototype=WebInspector.RemoteObject.fromPayload(payload.classPrototype,target);if(payload.preview){ if(!payload.preview.type){payload.preview.type=payload.type;payload.preview.subtype=payload.subtype;payload.preview.description=payload.description;payload.preview.size=payload.size;} payload.preview=WebInspector.ObjectPreview.fromPayload(payload.preview);} return new WebInspector.RemoteObject(target,payload.objectId,payload.type,payload.subtype,payload.value,payload.description,payload.size,payload.classPrototype,payload.className,payload.preview);} static createCallArgument(valueOrObject) {if(valueOrObject instanceof WebInspector.RemoteObject){if(valueOrObject.objectId) return{objectId:valueOrObject.objectId};return{value:valueOrObject.value};} return{value:valueOrObject};} static resolveNode(node,objectGroup,callback) {DOMAgent.resolveNode(node.id,objectGroup,function(error,object){if(!callback) return;if(error||!object) callback(null);else callback(WebInspector.RemoteObject.fromPayload(object,WebInspector.mainTarget));});} static resolveWebSocket(webSocketResource,objectGroup,callback) {NetworkAgent.resolveWebSocket(webSocketResource.requestIdentifier,objectGroup,(error,object)=>{if(error||!object) callback(null);else callback(WebInspector.RemoteObject.fromPayload(object,webSocketResource.target));});} static resolveCanvasContext(canvas,objectGroup,callback) {CanvasAgent.resolveCanvasContext(canvas.identifier,objectGroup,(error,object)=>{if(error||!object) callback(null);else callback(WebInspector.RemoteObject.fromPayload(object,WebInspector.mainTarget));});} static type(remoteObject) {if(remoteObject===null) return"null";var type=typeof remoteObject;if(type!=="object"&&type!=="function") return type;return remoteObject.type;} get target() {return this._target;} get objectId() {return this._objectId;} get type() {return this._type;} get subtype() {return this._subtype;} get description() {return this._description;} get functionDescription() {return this._functionDescription||this._description;} get hasChildren() {return this._hasChildren;} get value() {return this._value;} get size() {return this._size||0;} get classPrototype() {return this._classPrototype;} get preview() {return this._preview;} hasSize() {return this.isArray()||this.isCollectionType();} hasValue() {return"_value"in this;} canLoadPreview() {if(this._failedToLoadPreview) return false;if(this._type!=="object") return false;if(!this._objectId||this._isSymbol()||this._isFakeObject()) return false;return true;} updatePreview(callback) {if(!this.canLoadPreview()){callback(null);return;} if(!RuntimeAgent.getPreview){this._failedToLoadPreview=true;callback(null);return;} this._target.RuntimeAgent.getPreview(this._objectId,(error,payload)=>{if(error){this._failedToLoadPreview=true;callback(null);return;} this._preview=WebInspector.ObjectPreview.fromPayload(payload);callback(this._preview);});} getOwnPropertyDescriptors(callback) {this._getPropertyDescriptors(true,callback);} getAllPropertyDescriptors(callback) {this._getPropertyDescriptors(false,callback);} getDisplayablePropertyDescriptors(callback) {if(!this._objectId||this._isSymbol()||this._isFakeObject()){callback([]);return;} if(!RuntimeAgent.getDisplayableProperties){this._target.RuntimeAgent.getProperties(this._objectId,function(error,allProperties){var ownOrGetterPropertiesList=[];if(allProperties){for(var property of allProperties){if(property.isOwn||property.name==="__proto__"){ownOrGetterPropertiesList.push(property);}else if(property.value&&property.name!==property.name.toUpperCase()){var type=property.value.type;if(type&&type!=="function"&&property.name!=="constructor"){ownOrGetterPropertiesList.push(property);}}}} this._getPropertyDescriptorsResolver(callback,error,ownOrGetterPropertiesList);}.bind(this));return;} this._target.RuntimeAgent.getDisplayableProperties(this._objectId,true,this._getPropertyDescriptorsResolver.bind(this,callback));} deprecatedGetOwnProperties(callback) {this._deprecatedGetProperties(true,callback);} deprecatedGetAllProperties(callback) {this._deprecatedGetProperties(false,callback);} deprecatedGetDisplayableProperties(callback) {if(!this._objectId||this._isSymbol()||this._isFakeObject()){callback([]);return;} if(!RuntimeAgent.getDisplayableProperties){this._target.RuntimeAgent.getProperties(this._objectId,function(error,allProperties){var ownOrGetterPropertiesList=[];if(allProperties){for(var property of allProperties){if(property.isOwn||property.get||property.name==="__proto__"){ownOrGetterPropertiesList.push(property);}else if(property.value&&property.name!==property.name.toUpperCase()){var type=property.value.type;if(type&&type!=="function"&&property.name!=="constructor"){ownOrGetterPropertiesList.push(property);}}}} this._deprecatedGetPropertiesResolver(callback,error,ownOrGetterPropertiesList);}.bind(this));return;} this._target.RuntimeAgent.getDisplayableProperties(this._objectId,this._deprecatedGetPropertiesResolver.bind(this,callback));} setPropertyValue(name,value,callback) {if(!this._objectId||this._isSymbol()||this._isFakeObject()){callback("Can't set a property of non-object.");return;} this._target.RuntimeAgent.evaluate.invoke({expression:appendWebInspectorSourceURL(value),doNotPauseOnExceptionsAndMuteConsole:true},evaluatedCallback.bind(this),this._target.RuntimeAgent);function evaluatedCallback(error,result,wasThrown) {if(error||wasThrown){callback(error||result.description);return;} function setPropertyValue(propertyName,propertyValue) {this[propertyName]=propertyValue;} delete result.description;this._target.RuntimeAgent.callFunctionOn(this._objectId,appendWebInspectorSourceURL(setPropertyValue.toString()),[{value:name},result],true,undefined,propertySetCallback.bind(this));if(result._objectId) this._target.RuntimeAgent.releaseObject(result._objectId);} function propertySetCallback(error,result,wasThrown) {if(error||wasThrown){callback(error||result.description);return;} callback();}} isUndefined() {return this._type==="undefined";} isNode() {return this._subtype==="node";} isArray() {return this._subtype==="array";} isClass() {return this._subtype==="class";} isCollectionType() {return this._subtype==="map"||this._subtype==="set"||this._subtype==="weakmap"||this._subtype==="weakset";} isWeakCollection() {return this._subtype==="weakmap"||this._subtype==="weakset";} getCollectionEntries(start,numberToFetch,callback) {start=typeof start==="number"?start:0;numberToFetch=typeof numberToFetch==="number"?numberToFetch:100;let objectGroup=this.isWeakCollection()?this._weakCollectionObjectGroup():"";this._target.RuntimeAgent.getCollectionEntries(this._objectId,objectGroup,start,numberToFetch,(error,entries)=>{entries=entries.map((x)=>WebInspector.CollectionEntry.fromPayload(x,this._target));callback(entries);});} releaseWeakCollectionEntries() {this._target.RuntimeAgent.releaseObjectGroup(this._weakCollectionObjectGroup());} pushNodeToFrontend(callback) {if(this._objectId) WebInspector.domTreeManager.pushNodeToFrontend(this._objectId,callback);else callback(0);} getProperty(propertyName,callback) {function inspectedPage_object_getProperty(property){return this[property];} this.callFunction(inspectedPage_object_getProperty,[propertyName],true,callback);} callFunction(functionDeclaration,args,generatePreview,callback) {function mycallback(error,result,wasThrown) {result=result?WebInspector.RemoteObject.fromPayload(result,this._target):null;if(callback&&typeof callback==="function") callback(error,result,wasThrown);} if(args) args=args.map(WebInspector.RemoteObject.createCallArgument);this._target.RuntimeAgent.callFunctionOn(this._objectId,appendWebInspectorSourceURL(functionDeclaration.toString()),args,true,undefined,!!generatePreview,mycallback.bind(this));} callFunctionJSON(functionDeclaration,args,callback) {function mycallback(error,result,wasThrown) {callback((error||wasThrown)?null:result.value);} this._target.RuntimeAgent.callFunctionOn(this._objectId,appendWebInspectorSourceURL(functionDeclaration.toString()),args,true,true,mycallback);} invokeGetter(getterRemoteObject,callback) {function backendInvokeGetter(getter) {return getter?getter.call(this):undefined;} this.callFunction(backendInvokeGetter,[getterRemoteObject],true,callback);} getOwnPropertyDescriptor(propertyName,callback) {function backendGetOwnPropertyDescriptor(propertyName) {return this[propertyName];} function wrappedCallback(error,result,wasThrown) {if(error||wasThrown||!(result instanceof WebInspector.RemoteObject)){callback(null);return;} var fakeDescriptor={name:propertyName,value:result,writable:true,configurable:true,enumerable:false};var fakePropertyDescriptor=new WebInspector.PropertyDescriptor(fakeDescriptor,null,true,false,false,false);callback(fakePropertyDescriptor);} this.callFunction(backendGetOwnPropertyDescriptor,[propertyName],false,wrappedCallback.bind(this));} release() {if(this._objectId&&!this._isFakeObject()) this._target.RuntimeAgent.releaseObject(this._objectId);} arrayLength() {if(this._subtype!=="array") return 0;var matches=this._description.match(/\[([0-9]+)\]/);if(!matches) return 0;return parseInt(matches[1],10);} asCallArgument() {return WebInspector.RemoteObject.createCallArgument(this);} findFunctionSourceCodeLocation() {var result=new WebInspector.WrappedPromise;if(!this._isFunction()||!this._objectId){result.resolve(WebInspector.RemoteObject.SourceCodeLocationPromise.MissingObjectId);return result.promise;} this._target.DebuggerAgent.getFunctionDetails(this._objectId,(error,response)=>{if(error){result.reject(error);return;} var location=response.location;var sourceCode=WebInspector.debuggerManager.scriptForIdentifier(location.scriptId,this._target);if(!sourceCode||(!WebInspector.isDebugUIEnabled()&&isWebKitInternalScript(sourceCode.sourceURL))){result.resolve(WebInspector.RemoteObject.SourceCodeLocationPromise.NoSourceFound);return;} var sourceCodeLocation=sourceCode.createSourceCodeLocation(location.lineNumber,location.columnNumber||0);result.resolve(sourceCodeLocation);});return result.promise;} _isFakeObject() {return this._objectId===WebInspector.RemoteObject.FakeRemoteObjectId;} _isSymbol() {return this._type==="symbol";} _isFunction() {return this._type==="function";} _weakCollectionObjectGroup() {return JSON.stringify(this._objectId)+"-"+this._subtype;} _getPropertyDescriptors(ownProperties,callback) {if(!this._objectId||this._isSymbol()||this._isFakeObject()){callback([]);return;} this._target.RuntimeAgent.getProperties(this._objectId,ownProperties,true,this._getPropertyDescriptorsResolver.bind(this,callback));} getOwnPropertyDescriptorsAsObject(callback) {this.getOwnPropertyDescriptors(function(properties){var propertiesResult={};var internalPropertiesResult={};for(var propertyDescriptor of properties){var object=propertyDescriptor.isInternalProperty?internalPropertiesResult:propertiesResult;object[propertyDescriptor.name]=propertyDescriptor;} callback(propertiesResult,internalPropertiesResult);});} _getPropertyDescriptorsResolver(callback,error,properties,internalProperties) {if(error){callback(null);return;} let descriptors=properties.map((payload)=>{return WebInspector.PropertyDescriptor.fromPayload(payload,false,this._target);});if(internalProperties){descriptors=descriptors.concat(internalProperties.map((payload)=>{return WebInspector.PropertyDescriptor.fromPayload(payload,true,this._target);}));} callback(descriptors);} _deprecatedGetProperties(ownProperties,callback) {if(!this._objectId||this._isSymbol()||this._isFakeObject()){callback([]);return;} this._target.RuntimeAgent.getProperties(this._objectId,ownProperties,this._deprecatedGetPropertiesResolver.bind(this,callback));} _deprecatedGetPropertiesResolver(callback,error,properties,internalProperties) {if(error){callback(null);return;} if(internalProperties){properties=properties.concat(internalProperties.map(function(descriptor){descriptor.writable=false;descriptor.configurable=false;descriptor.enumerable=false;descriptor.isOwn=true;return descriptor;}));} var result=[];for(var i=0;properties&&i{let snapshot=WebInspector.HeapSnapshotProxy.deserialize(objectId,serializedSnapshot);WebInspector.timelineManager.heapSnapshotAdded(timestamp,snapshot);});}};WebInspector.DOMObserver=class DOMObserver {documentUpdated() {WebInspector.domTreeManager._documentUpdated();} setChildNodes(parentId,payloads) {WebInspector.domTreeManager._setChildNodes(parentId,payloads);} attributeModified(nodeId,name,value) {WebInspector.domTreeManager._attributeModified(nodeId,name,value);} attributeRemoved(nodeId,name) {WebInspector.domTreeManager._attributeRemoved(nodeId,name);} inlineStyleInvalidated(nodeIds) {WebInspector.domTreeManager._inlineStyleInvalidated(nodeIds);} characterDataModified(nodeId,characterData) {WebInspector.domTreeManager._characterDataModified(nodeId,characterData);} childNodeCountUpdated(nodeId,childNodeCount) {WebInspector.domTreeManager._childNodeCountUpdated(nodeId,childNodeCount);} childNodeInserted(parentNodeId,previousNodeId,payload) {WebInspector.domTreeManager._childNodeInserted(parentNodeId,previousNodeId,payload);} childNodeRemoved(parentNodeId,nodeId) {WebInspector.domTreeManager._childNodeRemoved(parentNodeId,nodeId);} shadowRootPushed(parentNodeId,nodeId) {WebInspector.domTreeManager._childNodeInserted(parentNodeId,0,nodeId);} shadowRootPopped(parentNodeId,nodeId) {WebInspector.domTreeManager._childNodeRemoved(parentNodeId,nodeId);} customElementStateChanged(nodeId,customElementState) {WebInspector.domTreeManager._customElementStateChanged(nodeId,customElementState);} pseudoElementAdded(parentNodeId,pseudoElement) {WebInspector.domTreeManager._pseudoElementAdded(parentNodeId,pseudoElement);} pseudoElementRemoved(parentNodeId,pseudoElementId) {WebInspector.domTreeManager._pseudoElementRemoved(parentNodeId,pseudoElementId);}};WebInspector.DOMStorageObserver=class DOMStorageObserver {domStorageItemsCleared(storageId) {WebInspector.storageManager.itemsCleared(storageId);} domStorageItemRemoved(storageId,key) {WebInspector.storageManager.itemRemoved(storageId,key);} domStorageItemAdded(storageId,key,value) {WebInspector.storageManager.itemAdded(storageId,key,value);} domStorageItemUpdated(storageId,key,oldValue,value) {WebInspector.storageManager.itemUpdated(storageId,key,oldValue,value);}};WebInspector.DatabaseObserver=class DatabaseObserver {addDatabase(database) {WebInspector.storageManager.databaseWasAdded(database.id,database.domain,database.name,database.version);}};WebInspector.DebuggerObserver=class DebuggerObserver {constructor() {this._legacyScriptParsed=DebuggerAgent.hasEventParameter("scriptParsed","hasSourceURL");} globalObjectCleared() {WebInspector.debuggerManager.reset();} scriptParsed(scriptId,url,startLine,startColumn,endLine,endColumn,isContentScript,sourceURL,sourceMapURL,isModule) {if(this._legacyScriptParsed){ let legacySourceMapURL=arguments[7];let hasSourceURL=arguments[8];let legacySourceURL=hasSourceURL?url:undefined;WebInspector.debuggerManager.scriptDidParse(this.target,scriptId,url,startLine,startColumn,endLine,endColumn,isModule,isContentScript,legacySourceURL,legacySourceMapURL);return;} WebInspector.debuggerManager.scriptDidParse(this.target,scriptId,url,startLine,startColumn,endLine,endColumn,isModule,isContentScript,sourceURL,sourceMapURL);} scriptFailedToParse(url,scriptSource,startLine,errorLine,errorMessage) {} breakpointResolved(breakpointId,location) {WebInspector.debuggerManager.breakpointResolved(this.target,breakpointId,location);} paused(callFrames,reason,data,asyncStackTrace) {WebInspector.debuggerManager.debuggerDidPause(this.target,callFrames,reason,data,asyncStackTrace);} resumed() {WebInspector.debuggerManager.debuggerDidResume(this.target);} playBreakpointActionSound(breakpointActionIdentifier) {WebInspector.debuggerManager.playBreakpointActionSound(breakpointActionIdentifier);} didSampleProbe(sample) {WebInspector.probeManager.didSampleProbe(this.target,sample);}};WebInspector.HeapObserver=class HeapObserver {garbageCollected(collection) {WebInspector.heapManager.garbageCollected(this.target,collection);} trackingStart(timestamp,snapshotStringData) {let workerProxy=WebInspector.HeapSnapshotWorkerProxy.singleton();workerProxy.createSnapshot(snapshotStringData,({objectId,snapshot:serializedSnapshot})=>{let snapshot=WebInspector.HeapSnapshotProxy.deserialize(objectId,serializedSnapshot);WebInspector.timelineManager.heapTrackingStarted(timestamp,snapshot);});} trackingComplete(timestamp,snapshotStringData) {let workerProxy=WebInspector.HeapSnapshotWorkerProxy.singleton();workerProxy.createSnapshot(snapshotStringData,({objectId,snapshot:serializedSnapshot})=>{let snapshot=WebInspector.HeapSnapshotProxy.deserialize(objectId,serializedSnapshot);WebInspector.timelineManager.heapTrackingCompleted(timestamp,snapshot);});}};WebInspector.InspectorObserver=class InspectorObserver {evaluateForTestInFrontend(script) {if(!InspectorFrontendHost.isUnderTest()) return;InspectorBackend.runAfterPendingDispatches(function(){window.eval(script);});} inspect(payload,hints) {var remoteObject=WebInspector.RemoteObject.fromPayload(payload,WebInspector.mainTarget);if(remoteObject.subtype==="node"){WebInspector.domTreeManager.inspectNodeObject(remoteObject);return;} if(hints.databaseId) WebInspector.storageManager.inspectDatabase(hints.databaseId);else if(hints.domStorageId) WebInspector.storageManager.inspectDOMStorage(hints.domStorageId);remoteObject.release();} activateExtraDomains(domains) {WebInspector.activateExtraDomains(domains);}};WebInspector.LayerTreeObserver=class LayerTreeObserver {layerTreeDidChange() {if(WebInspector.layerTreeManager.supported) WebInspector.layerTreeManager.layerTreeDidChange();}};WebInspector.MemoryObserver=class MemoryObserver {memoryPressure(timestamp,severity) {WebInspector.memoryManager.memoryPressure(timestamp,severity);} trackingStart(timestamp) {WebInspector.timelineManager.memoryTrackingStart(timestamp);} trackingUpdate(event) {WebInspector.timelineManager.memoryTrackingUpdate(event);} trackingComplete() {WebInspector.timelineManager.memoryTrackingComplete();}};WebInspector.NetworkObserver=class NetworkObserver {requestWillBeSent(requestId,frameId,loaderId,documentURL,request,timestamp,initiator,redirectResponse,type,targetId) {WebInspector.frameResourceManager.resourceRequestWillBeSent(requestId,frameId,loaderId,request,type,redirectResponse,timestamp,initiator,targetId);} requestServedFromCache(requestId) {WebInspector.frameResourceManager.markResourceRequestAsServedFromMemoryCache(requestId);} responseReceived(requestId,frameId,loaderId,timestamp,type,response) {WebInspector.frameResourceManager.resourceRequestDidReceiveResponse(requestId,frameId,loaderId,type,response,timestamp);} dataReceived(requestId,timestamp,dataLength,encodedDataLength) {WebInspector.frameResourceManager.resourceRequestDidReceiveData(requestId,dataLength,encodedDataLength,timestamp);} loadingFinished(requestId,timestamp,sourceMapURL,metrics) {WebInspector.frameResourceManager.resourceRequestDidFinishLoading(requestId,timestamp,sourceMapURL,metrics);} loadingFailed(requestId,timestamp,errorText,canceled) {WebInspector.frameResourceManager.resourceRequestDidFailLoading(requestId,canceled,timestamp,errorText);} requestServedFromMemoryCache(requestId,frameId,loaderId,documentURL,timestamp,initiator,resource) {WebInspector.frameResourceManager.resourceRequestWasServedFromMemoryCache(requestId,frameId,loaderId,resource,timestamp,initiator);} webSocketCreated(requestId,url) {WebInspector.frameResourceManager.webSocketCreated(requestId,url);} webSocketWillSendHandshakeRequest(requestId,timestamp,walltime,request) {WebInspector.frameResourceManager.webSocketWillSendHandshakeRequest(requestId,timestamp,walltime,request);} webSocketHandshakeResponseReceived(requestId,timestamp,response) {WebInspector.frameResourceManager.webSocketHandshakeResponseReceived(requestId,timestamp,response);} webSocketClosed(requestId,timestamp) {WebInspector.frameResourceManager.webSocketClosed(requestId,timestamp);} webSocketFrameReceived(requestId,timestamp,response) {WebInspector.frameResourceManager.webSocketFrameReceived(requestId,timestamp,response);} webSocketFrameSent(requestId,timestamp,response) {WebInspector.frameResourceManager.webSocketFrameSent(requestId,timestamp,response);} webSocketFrameError(requestId,timestamp,errorMessage) {}};WebInspector.PageObserver=class PageObserver {domContentEventFired(timestamp) {WebInspector.timelineManager.pageDOMContentLoadedEventFired(timestamp);} loadEventFired(timestamp) {WebInspector.timelineManager.pageLoadEventFired(timestamp);} frameNavigated(frame,loaderId) {WebInspector.frameResourceManager.frameDidNavigate(frame,loaderId);} frameDetached(frameId) {WebInspector.frameResourceManager.frameDidDetach(frameId);} frameStartedLoading(frameId) {} frameStoppedLoading(frameId) {} frameScheduledNavigation(frameId,delay) {} frameClearedScheduledNavigation(frameId) {} javascriptDialogOpening(message) {} javascriptDialogClosed() {} scriptsEnabled(enabled) {}};WebInspector.RuntimeObserver=class RuntimeObserver {executionContextCreated(contextPayload) {WebInspector.frameResourceManager.executionContextCreated(contextPayload);}};WebInspector.ScriptProfilerObserver=class ScriptProfilerObserver {trackingStart(timestamp) {WebInspector.timelineManager.scriptProfilerTrackingStarted(timestamp);} trackingUpdate(event) {WebInspector.timelineManager.scriptProfilerTrackingUpdated(event);} trackingComplete(samples) {WebInspector.timelineManager.scriptProfilerTrackingCompleted(samples);} programmaticCaptureStarted() {WebInspector.timelineManager.scriptProfilerProgrammaticCaptureStarted();} programmaticCaptureStopped() {WebInspector.timelineManager.scriptProfilerProgrammaticCaptureStopped();}};WebInspector.TimelineObserver=class TimelineObserver {eventRecorded(record) {WebInspector.timelineManager.eventRecorded(record);} recordingStarted(startTime) {WebInspector.timelineManager.capturingStarted(startTime);} recordingStopped(endTime) {WebInspector.timelineManager.capturingStopped(endTime);} autoCaptureStarted() {WebInspector.timelineManager.autoCaptureStarted();} programmaticCaptureStarted() {WebInspector.timelineManager.programmaticCaptureStarted();} programmaticCaptureStopped() {WebInspector.timelineManager.programmaticCaptureStopped();}};WebInspector.WorkerObserver=class WorkerObserver {workerCreated(workerId,url) {WebInspector.workerManager.workerCreated(workerId,url);} workerTerminated(workerId) {WebInspector.workerManager.workerTerminated(workerId);} dispatchMessageFromWorker(workerId,message) {WebInspector.workerManager.dispatchMessageFromWorker(workerId,message);}};WebInspector.BreakpointAction=class BreakpointAction extends WebInspector.Object {constructor(breakpoint,typeOrInfo,data) {super();this._breakpoint=breakpoint;if(typeof typeOrInfo==="string"){this._type=typeOrInfo;this._data=data||null;}else if(typeof typeOrInfo==="object"){this._type=typeOrInfo.type;this._data=typeOrInfo.data||null;}else console.error("Unexpected type passed to WebInspector.BreakpointAction");this._id=WebInspector.debuggerManager.nextBreakpointActionIdentifier();} get breakpoint(){return this._breakpoint;} get id(){return this._id;} get type(){return this._type;} get data() {return this._data;} set data(data) {if(this._data===data) return;this._data=data;this._breakpoint.breakpointActionDidChange(this);} get info() {var obj={type:this._type,id:this._id};if(this._data) obj.data=this._data;return obj;}};WebInspector.BreakpointAction.Type={Log:"log",Evaluate:"evaluate",Sound:"sound",Probe:"probe"};WebInspector.ConsoleMessage=class ConsoleMessage extends WebInspector.Object {constructor(target,source,level,message,type,url,line,column,repeatCount,parameters,callFrames,request) {super();this._target=target;this._source=source;this._level=level;this._messageText=message;this._type=type||WebInspector.ConsoleMessage.MessageType.Log;this._url=url||null;this._line=line||0;this._column=column||0;this._sourceCodeLocation=undefined;this._repeatCount=repeatCount||0;this._parameters=parameters;callFrames=callFrames||[];this._stackTrace=WebInspector.StackTrace.fromPayload(this._target,{callFrames});this._request=request;} get target(){return this._target;} get source(){return this._source;} get level(){return this._level;} get messageText(){return this._messageText;} get type(){return this._type;} get url(){return this._url;} get line(){return this._line;} get column(){return this._column;} get repeatCount(){return this._repeatCount;} get parameters(){return this._parameters;} get stackTrace(){return this._stackTrace;} get request(){return this._request;} get sourceCodeLocation() {if(this._sourceCodeLocation!==undefined) return this._sourceCodeLocation;let topCallFrame=this._stackTrace.callFrames[0];if(topCallFrame&&topCallFrame.sourceCodeLocation){this._sourceCodeLocation=topCallFrame.sourceCodeLocation;return this._sourceCodeLocation;} if(this._url&&this._url!=="undefined"){let sourceCode=WebInspector.frameResourceManager.resourceForURL(this._url);if(sourceCode){let lineNumber=this._line>0?this._line-1:0;let columnNumber=this._column>0?this._column-1:0;this._sourceCodeLocation=new WebInspector.SourceCodeLocation(sourceCode,lineNumber,columnNumber);return this._sourceCodeLocation;}} this._sourceCodeLocation=null;return this._sourceCodeLocation;}};WebInspector.ConsoleMessage.MessageSource={HTML:"html",XML:"xml",JS:"javascript",Network:"network",ConsoleAPI:"console-api",Storage:"storage",Appcache:"appcache",Rendering:"rendering",CSS:"css",Security:"security",Other:"other",};WebInspector.ConsoleMessage.MessageType={Log:"log",Dir:"dir",DirXML:"dirxml",Table:"table",Trace:"trace",StartGroup:"startGroup",StartGroupCollapsed:"startGroupCollapsed",EndGroup:"endGroup",Assert:"assert",Timing:"timing",Profile:"profile",ProfileEnd:"profileEnd",Result:"result",};WebInspector.ConsoleMessage.MessageLevel={Log:"log",Info:"info",Warning:"warning",Error:"error",Debug:"debug",};WebInspector.Instrument=class Instrument extends WebInspector.Object { static createForTimelineType(type) {switch(type){case WebInspector.TimelineRecord.Type.Network:return new WebInspector.NetworkInstrument;case WebInspector.TimelineRecord.Type.Layout:return new WebInspector.LayoutInstrument;case WebInspector.TimelineRecord.Type.Script:return new WebInspector.ScriptInstrument;case WebInspector.TimelineRecord.Type.RenderingFrame:return new WebInspector.FPSInstrument;case WebInspector.TimelineRecord.Type.Memory:return new WebInspector.MemoryInstrument;case WebInspector.TimelineRecord.Type.HeapAllocations:return new WebInspector.HeapAllocationsInstrument;default:console.error("Unknown TimelineRecord.Type: "+type);return null;}} static startLegacyTimelineAgent(initiatedByBackend) {if(WebInspector.Instrument._legacyTimelineAgentStarted) return;WebInspector.Instrument._legacyTimelineAgentStarted=true;if(initiatedByBackend) return;let result=TimelineAgent.start();if(!TimelineAgent.hasEvent("recordingStarted")){result.then(function(){WebInspector.timelineManager.capturingStarted();});}} static stopLegacyTimelineAgent(initiatedByBackend) {if(!WebInspector.Instrument._legacyTimelineAgentStarted) return;WebInspector.Instrument._legacyTimelineAgentStarted=false;if(initiatedByBackend) return;TimelineAgent.stop();} get timelineRecordType() {return null;} startInstrumentation(initiatedByBackend) {WebInspector.Instrument.startLegacyTimelineAgent(initiatedByBackend);} stopInstrumentation(initiatedByBackend) {WebInspector.Instrument.stopLegacyTimelineAgent(initiatedByBackend);}};WebInspector.Instrument._legacyTimelineAgentStarted=false;WebInspector.SourceCode=class SourceCode extends WebInspector.Object {constructor() {super();this._originalRevision=new WebInspector.SourceCodeRevision(this,null,false);this._currentRevision=this._originalRevision;this._sourceMaps=null;this._formatterSourceMap=null;this._requestContentPromise=null;} get displayName() {console.error("Needs to be implemented by a subclass.");return"";} get originalRevision() {return this._originalRevision;} get currentRevision() {return this._currentRevision;} set currentRevision(revision) {if(!(revision instanceof WebInspector.SourceCodeRevision)) return;if(revision.sourceCode!==this) return;this._currentRevision=revision;this.dispatchEventToListeners(WebInspector.SourceCode.Event.ContentDidChange);} get content() {return this._currentRevision.content;} get url() {} get contentIdentifier() { return this.url;} get sourceMaps() {return this._sourceMaps||[];} addSourceMap(sourceMap) {if(!this._sourceMaps) this._sourceMaps=[];this._sourceMaps.push(sourceMap);this.dispatchEventToListeners(WebInspector.SourceCode.Event.SourceMapAdded);} get formatterSourceMap() {return this._formatterSourceMap;} set formatterSourceMap(formatterSourceMap) {this._formatterSourceMap=formatterSourceMap;this.dispatchEventToListeners(WebInspector.SourceCode.Event.FormatterDidChange);} requestContent() {this._requestContentPromise=this._requestContentPromise||this.requestContentFromBackend().then(this._processContent.bind(this));return this._requestContentPromise;} createSourceCodeLocation(lineNumber,columnNumber) {return new WebInspector.SourceCodeLocation(this,lineNumber,columnNumber);} createLazySourceCodeLocation(lineNumber,columnNumber) {return new WebInspector.LazySourceCodeLocation(this,lineNumber,columnNumber);} createSourceCodeTextRange(textRange) {return new WebInspector.SourceCodeTextRange(this,textRange);} revisionContentDidChange(revision) {if(this._ignoreRevisionContentDidChangeEvent) return;if(revision!==this._currentRevision) return;this.handleCurrentRevisionContentChange();this.dispatchEventToListeners(WebInspector.SourceCode.Event.ContentDidChange);} handleCurrentRevisionContentChange() {} get revisionForRequestedContent() {return this._originalRevision;} markContentAsStale() {this._requestContentPromise=null;this._contentReceived=false;} requestContentFromBackend() {console.error("Needs to be implemented by a subclass.");return Promise.reject(new Error("Needs to be implemented by a subclass."));} get mimeType() {console.error("Needs to be implemented by a subclass.");} _processContent(parameters) {var content=parameters.content||parameters.body||parameters.text||parameters.scriptSource;var error=parameters.error;if(parameters.base64Encoded) content=decodeBase64ToBlob(content,this.mimeType);var revision=this.revisionForRequestedContent;this._ignoreRevisionContentDidChangeEvent=true;revision.content=content||null;this._ignoreRevisionContentDidChangeEvent=false; return Promise.resolve({error,sourceCode:this,content,});}};WebInspector.SourceCode.Event={ContentDidChange:"source-code-content-did-change",SourceMapAdded:"source-code-source-map-added",FormatterDidChange:"source-code-formatter-did-change",LoadingDidFinish:"source-code-loading-did-finish",LoadingDidFail:"source-code-loading-did-fail"};WebInspector.SourceCodeLocation=class SourceCodeLocation extends WebInspector.Object {constructor(sourceCode,lineNumber,columnNumber) {super();this._sourceCode=sourceCode||null;this._lineNumber=lineNumber;this._columnNumber=columnNumber;this._resolveFormattedLocation();if(this._sourceCode){this._sourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded,this._sourceCodeSourceMapAdded,this);this._sourceCode.addEventListener(WebInspector.SourceCode.Event.FormatterDidChange,this._sourceCodeFormatterDidChange,this);} this._resetMappedLocation();} isEqual(other) {if(!other) return false;return this._sourceCode===other._sourceCode&&this._lineNumber===other._lineNumber&&this._columnNumber===other._columnNumber;} get sourceCode() {return this._sourceCode;} set sourceCode(sourceCode) {this.setSourceCode(sourceCode);} get lineNumber() {return this._lineNumber;} get columnNumber() {return this._columnNumber;} position() {return new WebInspector.SourceCodePosition(this.lineNumber,this.columnNumber);} get formattedLineNumber() {return this._formattedLineNumber;} get formattedColumnNumber() {return this._formattedColumnNumber;} formattedPosition() {return new WebInspector.SourceCodePosition(this.formattedLineNumber,this.formattedColumnNumber);} get displaySourceCode() {this.resolveMappedLocation();return this._mappedResource||this._sourceCode;} get displayLineNumber() {this.resolveMappedLocation();return isNaN(this._mappedLineNumber)?this._formattedLineNumber:this._mappedLineNumber;} get displayColumnNumber() {this.resolveMappedLocation();return isNaN(this._mappedColumnNumber)?this._formattedColumnNumber:this._mappedColumnNumber;} displayPosition() {return new WebInspector.SourceCodePosition(this.displayLineNumber,this.displayColumnNumber);} originalLocationString(columnStyle,nameStyle,prefix) {return this._locationString(this.sourceCode,this.lineNumber,this.columnNumber,columnStyle,nameStyle,prefix);} formattedLocationString(columnStyle,nameStyle,prefix) {return this._locationString(this.sourceCode,this.formattedLineNumber,this.formattedColumn,columnStyle,nameStyle,prefix);} displayLocationString(columnStyle,nameStyle,prefix) {return this._locationString(this.displaySourceCode,this.displayLineNumber,this.displayColumnNumber,columnStyle,nameStyle,prefix);} tooltipString() {if(!this.hasDifferentDisplayLocation()) return this.originalLocationString(WebInspector.SourceCodeLocation.ColumnStyle.Shown,WebInspector.SourceCodeLocation.NameStyle.Full);var tooltip=WebInspector.UIString("Located at %s").format(this.displayLocationString(WebInspector.SourceCodeLocation.ColumnStyle.Shown,WebInspector.SourceCodeLocation.NameStyle.Full));tooltip+="\n"+WebInspector.UIString("Originally %s").format(this.originalLocationString(WebInspector.SourceCodeLocation.ColumnStyle.Shown,WebInspector.SourceCodeLocation.NameStyle.Full));return tooltip;} hasMappedLocation() {this.resolveMappedLocation();return this._mappedResource!==null;} hasFormattedLocation() {return this._formattedLineNumber!==this._lineNumber||this._formattedColumnNumber!==this._columnNumber;} hasDifferentDisplayLocation() {return this.hasMappedLocation()||this.hasFormattedLocation();} update(sourceCode,lineNumber,columnNumber) {if(sourceCode===this._sourceCode&&lineNumber===this._lineNumber&&columnNumber===this._columnNumber) return;if(this._mappedResource&&sourceCode===this._mappedResource&&lineNumber===this._mappedLineNumber&&columnNumber===this._mappedColumnNumber) return;var newSourceCodeLocation=sourceCode.createSourceCodeLocation(lineNumber,columnNumber);this._makeChangeAndDispatchChangeEventIfNeeded(function(){this._lineNumber=newSourceCodeLocation._lineNumber;this._columnNumber=newSourceCodeLocation._columnNumber;if(newSourceCodeLocation._mappedLocationIsResolved){this._mappedLocationIsResolved=true;this._mappedResource=newSourceCodeLocation._mappedResource;this._mappedLineNumber=newSourceCodeLocation._mappedLineNumber;this._mappedColumnNumber=newSourceCodeLocation._mappedColumnNumber;}});} populateLiveDisplayLocationTooltip(element,prefix) {prefix=prefix||"";element.title=prefix+this.tooltipString();this.addEventListener(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged,function(event){if(this.sourceCode) element.title=prefix+this.tooltipString();},this);} populateLiveDisplayLocationString(element,propertyName,columnStyle,nameStyle,prefix) {var currentDisplay;function updateDisplayString(showAlternativeLocation,forceUpdate) {if(!forceUpdate&¤tDisplay===showAlternativeLocation) return;currentDisplay=showAlternativeLocation;if(!showAlternativeLocation){element[propertyName]=this.displayLocationString(columnStyle,nameStyle,prefix);element.classList.toggle(WebInspector.SourceCodeLocation.DisplayLocationClassName,this.hasDifferentDisplayLocation());}else if(this.hasDifferentDisplayLocation()){element[propertyName]=this.originalLocationString(columnStyle,nameStyle,prefix);element.classList.remove(WebInspector.SourceCodeLocation.DisplayLocationClassName);}} function mouseOverOrMove(event) {updateDisplayString.call(this,event.metaKey&&!event.altKey&&!event.shiftKey);} updateDisplayString.call(this,false);this.addEventListener(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged,function(event){if(this.sourceCode) updateDisplayString.call(this,currentDisplay,true);},this);var boundMouseOverOrMove=mouseOverOrMove.bind(this);element.addEventListener("mouseover",boundMouseOverOrMove);element.addEventListener("mousemove",boundMouseOverOrMove);element.addEventListener("mouseout",(event)=>{updateDisplayString.call(this,false);});} setSourceCode(sourceCode) {if(sourceCode===this._sourceCode) return;this._makeChangeAndDispatchChangeEventIfNeeded(function(){if(this._sourceCode){this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.SourceMapAdded,this._sourceCodeSourceMapAdded,this);this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.FormatterDidChange,this._sourceCodeFormatterDidChange,this);} this._sourceCode=sourceCode;if(this._sourceCode){this._sourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded,this._sourceCodeSourceMapAdded,this);this._sourceCode.addEventListener(WebInspector.SourceCode.Event.FormatterDidChange,this._sourceCodeFormatterDidChange,this);}});} resolveMappedLocation() {if(this._mappedLocationIsResolved) return;this._mappedLocationIsResolved=true;if(!this._sourceCode) return;var sourceMaps=this._sourceCode.sourceMaps;if(!sourceMaps.length) return;for(var i=0;i0) lineString+=":"+(columnNumber+1);else if(columnStyle===WebInspector.SourceCodeLocation.ColumnStyle.OnlyIfLarge&&columnNumber>WebInspector.SourceCodeLocation.LargeColumnNumber) lineString+=":"+(columnNumber+1);else if(columnStyle===WebInspector.SourceCodeLocation.ColumnStyle.Hidden) lineString="";switch(nameStyle){case WebInspector.SourceCodeLocation.NameStyle.None:return prefix+lineString;case WebInspector.SourceCodeLocation.NameStyle.Short:case WebInspector.SourceCodeLocation.NameStyle.Full:var displayURL=sourceCode.displayURL;var name=nameStyle===WebInspector.SourceCodeLocation.NameStyle.Full&&displayURL?displayURL:sourceCode.displayName;if(columnStyle===WebInspector.SourceCodeLocation.ColumnStyle.Hidden) return prefix+name;var lineSuffix=displayURL?":"+lineString:WebInspector.UIString(" (line %s)").format(lineString);return prefix+name+lineSuffix;default:console.error("Unknown nameStyle: "+nameStyle);return prefix+lineString;}} _resetMappedLocation() {this._mappedLocationIsResolved=false;this._mappedResource=null;this._mappedLineNumber=NaN;this._mappedColumnNumber=NaN;} _setMappedLocation(mappedResource,mappedLineNumber,mappedColumnNumber) {this._mappedLocationIsResolved=true;this._mappedResource=mappedResource;this._mappedLineNumber=mappedLineNumber;this._mappedColumnNumber=mappedColumnNumber;} _resolveFormattedLocation() {if(this._sourceCode&&this._sourceCode.formatterSourceMap){var formattedLocation=this._sourceCode.formatterSourceMap.originalToFormatted(this._lineNumber,this._columnNumber);this._formattedLineNumber=formattedLocation.lineNumber;this._formattedColumnNumber=formattedLocation.columnNumber;}else{this._formattedLineNumber=this._lineNumber;this._formattedColumnNumber=this._columnNumber;}} _makeChangeAndDispatchChangeEventIfNeeded(changeFunction) {var oldSourceCode=this._sourceCode;var oldLineNumber=this._lineNumber;var oldColumnNumber=this._columnNumber;var oldFormattedLineNumber=this._formattedLineNumber;var oldFormattedColumnNumber=this._formattedColumnNumber;var oldDisplaySourceCode=this.displaySourceCode;var oldDisplayLineNumber=this.displayLineNumber;var oldDisplayColumnNumber=this.displayColumnNumber;this._resetMappedLocation();if(changeFunction) changeFunction.call(this);this.resolveMappedLocation();this._resolveFormattedLocation();var displayLocationChanged=false;var newDisplaySourceCode=this.displaySourceCode;if(oldDisplaySourceCode!==newDisplaySourceCode) displayLocationChanged=true;else if(newDisplaySourceCode&&(oldDisplayLineNumber!==this.displayLineNumber||oldDisplayColumnNumber!==this.displayColumnNumber)) displayLocationChanged=true;var anyLocationChanged=false;if(displayLocationChanged) anyLocationChanged=true;else if(oldSourceCode!==this._sourceCode) anyLocationChanged=true;else if(this._sourceCode&&(oldLineNumber!==this._lineNumber||oldColumnNumber!==this._columnNumber)) anyLocationChanged=true;else if(this._sourceCode&&(oldFormattedLineNumber!==this._formattedLineNumber||oldFormattedColumnNumber!==this._formattedColumnNumber)) anyLocationChanged=true;if(displayLocationChanged||anyLocationChanged){var oldData={oldSourceCode,oldLineNumber,oldColumnNumber,oldFormattedLineNumber,oldFormattedColumnNumber,oldDisplaySourceCode,oldDisplayLineNumber,oldDisplayColumnNumber};if(displayLocationChanged) this.dispatchEventToListeners(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged,oldData);if(anyLocationChanged) this.dispatchEventToListeners(WebInspector.SourceCodeLocation.Event.LocationChanged,oldData);}} _sourceCodeSourceMapAdded() {this._makeChangeAndDispatchChangeEventIfNeeded(null);} _sourceCodeFormatterDidChange() {this._makeChangeAndDispatchChangeEventIfNeeded(null);}};WebInspector.SourceCodeLocation.DisplayLocationClassName="display-location";WebInspector.SourceCodeLocation.LargeColumnNumber=80;WebInspector.SourceCodeLocation.NameStyle={None:"none",Short:"short",Full:"full"};WebInspector.SourceCodeLocation.ColumnStyle={Hidden:"hidden",OnlyIfLarge:"only-if-large",Shown:"shown"};WebInspector.SourceCodeLocation.Event={LocationChanged:"source-code-location-location-changed",DisplayLocationChanged:"source-code-location-display-location-changed"};WebInspector.Timeline=class Timeline extends WebInspector.Object {constructor(type) {super();this._type=type;this.reset(true);} static create(type) {if(type===WebInspector.TimelineRecord.Type.Network) return new WebInspector.NetworkTimeline(type);if(type===WebInspector.TimelineRecord.Type.Memory) return new WebInspector.MemoryTimeline(type);return new WebInspector.Timeline(type);} get type(){return this._type;} get startTime(){return this._startTime;} get endTime(){return this._endTime;} get records(){return this._records;} reset(suppressEvents) {this._records=[];this._startTime=NaN;this._endTime=NaN;if(!suppressEvents){this.dispatchEventToListeners(WebInspector.Timeline.Event.TimesUpdated);this.dispatchEventToListeners(WebInspector.Timeline.Event.Reset);}} addRecord(record) {if(record.updatesDynamically) record.addEventListener(WebInspector.TimelineRecord.Event.Updated,this._recordUpdated,this); this._tryInsertingRecordInSortedOrder(record);this._updateTimesIfNeeded(record);this.dispatchEventToListeners(WebInspector.Timeline.Event.RecordAdded,{record});} saveIdentityToCookie(cookie) {cookie[WebInspector.Timeline.TimelineTypeCookieKey]=this._type;} refresh() {this.dispatchEventToListeners(WebInspector.Timeline.Event.Refreshed);} recordsInTimeRange(startTime,endTime,includeRecordBeforeStart) {let lowerIndex=this._records.lowerBound(startTime,(time,record)=>time-record.timestamp);let upperIndex=this._records.upperBound(endTime,(time,record)=>time-record.timestamp);if(includeRecordBeforeStart&&lowerIndex>0) lowerIndex--;return this._records.slice(lowerIndex,upperIndex);} _updateTimesIfNeeded(record) {var changed=false;if(isNaN(this._startTime)||record.startTime=end;--i){if(this._records[i].startTime=0;--i) this._revisions[i].revert();} lock() {this._locked=true;} unlock() {this._locked=false;}};WebInspector.Breakpoint=class Breakpoint extends WebInspector.Object {constructor(sourceCodeLocationOrInfo,disabled,condition) {super();if(sourceCodeLocationOrInfo instanceof WebInspector.SourceCodeLocation){var sourceCode=sourceCodeLocationOrInfo.sourceCode;var contentIdentifier=sourceCode?sourceCode.contentIdentifier:null;var scriptIdentifier=sourceCode instanceof WebInspector.Script?sourceCode.id:null;var target=sourceCode instanceof WebInspector.Script?sourceCode.target:null;var location=sourceCodeLocationOrInfo;}else if(sourceCodeLocationOrInfo&&typeof sourceCodeLocationOrInfo==="object"){var contentIdentifier=sourceCodeLocationOrInfo.contentIdentifier||sourceCodeLocationOrInfo.url;var lineNumber=sourceCodeLocationOrInfo.lineNumber||0;var columnNumber=sourceCodeLocationOrInfo.columnNumber||0;var location=new WebInspector.SourceCodeLocation(null,lineNumber,columnNumber);var ignoreCount=sourceCodeLocationOrInfo.ignoreCount||0;var autoContinue=sourceCodeLocationOrInfo.autoContinue||false;var actions=sourceCodeLocationOrInfo.actions||[];for(var i=0;i",null);this._totalNumberOfSamples=0;} totalDurationInTimeRange(startTime,endTime) {return this._root.filteredTimestampsAndDuration(startTime,endTime).duration;} updateTreeWithStackTrace({timestamp,stackFrames},duration) {this._totalNumberOfSamples++;let node=this._root;node.addTimestampAndExpressionLocation(timestamp,duration,null);switch(this._type){case WebInspector.CallingContextTree.Type.TopDown:for(let i=stackFrames.length;i--;){let stackFrame=stackFrames[i];node=node.findOrMakeChild(stackFrame);node.addTimestampAndExpressionLocation(timestamp,duration,stackFrame.expressionLocation||null,i===0);} break;case WebInspector.CallingContextTree.Type.BottomUp:for(let i=0;i{if(child.hasStackTraceInTimeRange(startTime,endTime)) roots.push(child.toCPUProfileNode(numSamplesInTimeRange,startTime,endTime));});cpuProfile.rootNodes=roots;return cpuProfile;} forEachChild(callback) {this._root.forEachChild(callback);} forEachNode(callback) {this._root.forEachNode(callback);} static __test_makeTreeFromProtocolMessageObject(messageObject) {let tree=new WebInspector.CallingContextTree;let stackTraces=messageObject.params.samples.stackTraces;for(let i=0;iendTime) return false;let timestamps=this._timestamps;let length=timestamps.length;if(!length) return false;let index=timestamps.lowerBound(startTime);if(index===length) return false;let hasTimestampInRange=timestamps[index]<=endTime;return hasTimestampInRange;} filteredTimestampsAndDuration(startTime,endTime) {let lowerIndex=this._timestamps.lowerBound(startTime);let upperIndex=this._timestamps.upperBound(endTime);let totalDuration=0;for(let i=lowerIndex;i{if(child.hasStackTraceInTimeRange(startTime,endTime)) children.push(child.toCPUProfileNode(numSamples,startTime,endTime));});let cpuProfileNode={id:this._uid,functionName:this._name,url:this._url,lineNumber:this._line,columnNumber:this._column,children:children};let timestamps=[];let frameStartTime=Number.MAX_VALUE;let frameEndTime=Number.MIN_VALUE;for(let i=0;i{child.__test_buildLeafLinkedLists(linkedListNode,result);});}else{result.push(linkedListNode);}}};WebInspector.CallingContextTreeNode.__uid=0;WebInspector.CSSCompletions=class CSSCompletions {constructor(properties,acceptEmptyPrefix) {this._values=[];this._longhands={};this._shorthands={};if(properties.length&&typeof properties[0]==="string") this._values=this._values.concat(properties);else{for(var property of properties){var propertyName=property.name;this._values.push(propertyName);var longhands=property.longhands;if(longhands){this._longhands[propertyName]=longhands;for(var j=0;j>1;if(this._values[middleIndex].startsWith(prefix)){foundIndex=middleIndex;break;} if(this._values[middleIndex]selector.isPseudoElementSelector());} get style() {return this._style;} get mediaList() {return this._mediaList;} get mediaText() {if(!this._mediaList.length) return"";let mediaText="";for(let media of this._mediaList) mediaText+=media.text;return mediaText;} isEqualTo(rule) {if(!rule) return false;return Object.shallowEqual(this._id,rule.id);} get mostSpecificSelector() {if(!this._mostSpecificSelector) this._mostSpecificSelector=this._determineMostSpecificSelector();return this._mostSpecificSelector;} selectorIsGreater(otherSelector) {var mostSpecificSelector=this.mostSpecificSelector;if(!mostSpecificSelector) return false;return mostSpecificSelector.isGreaterThan(otherSelector);} get nodeStyles() {return this._nodeStyles;} _determineMostSpecificSelector() {if(!this._selectors||!this._selectors.length) return null;var selectors=this.matchedSelectors;if(!selectors.length) selectors=this._selectors;var specificSelector=selectors[0];for(var selector of selectors){if(selector.isGreaterThan(specificSelector)) specificSelector=selector;} return specificSelector;} _selectorRejected(error) {this.dispatchEventToListeners(WebInspector.CSSRule.Event.SelectorChanged,{valid:!error});} _selectorResolved(rulePayload) {this.dispatchEventToListeners(WebInspector.CSSRule.Event.SelectorChanged,{valid:!!rulePayload});}};WebInspector.CSSRule.Event={Changed:"css-rule-changed",SelectorChanged:"css-rule-invalid-selector"};WebInspector.CSSSelector=class CSSSelector extends WebInspector.Object {constructor(text,specificity,dynamic) {super();this._text=text;this._specificity=specificity||null;this._dynamic=dynamic||false;} get text(){return this._text;} get specificity(){return this._specificity;} get dynamic(){return this._dynamic;} isGreaterThan(selector) {if(!selector||!selector.specificity) return true;for(var i=0;iselector.specificity[i];} return false;} isPseudoElementSelector() {return WebInspector.CSSStyleManager.PseudoElementNames.some((name)=>this._text.includes(`:${name}`));}};WebInspector.CSSStyleDeclaration=class CSSStyleDeclaration extends WebInspector.Object {constructor(nodeStyles,ownerStyleSheet,id,type,node,inherited,text,properties,styleSheetTextRange) {super();this._nodeStyles=nodeStyles;this._ownerRule=null;this._ownerStyleSheet=ownerStyleSheet||null;this._id=id||null;this._type=type||null;this._node=node||null;this._inherited=inherited||false;this._pendingProperties=[];this._propertyNameMap={};this._initialText=text;this._hasModifiedInitialText=false;this.update(text,properties,styleSheetTextRange,true);} get id() {return this._id;} get ownerStyleSheet() {return this._ownerStyleSheet;} get type() {return this._type;} get inherited() {return this._inherited;} get node() {return this._node;} get editable() {if(!this._id) return false;if(this._type===WebInspector.CSSStyleDeclaration.Type.Rule) return this._ownerRule&&this._ownerRule.editable;if(this._type===WebInspector.CSSStyleDeclaration.Type.Inline) return!this._node.isInUserAgentShadowTree();return false;} update(text,properties,styleSheetTextRange,dontFireEvents) {text=text||"";properties=properties||[];var oldProperties=this._properties||[];var oldText=this._text;this._text=text;this._properties=properties;this._styleSheetTextRange=styleSheetTextRange;this._propertyNameMap={};delete this._visibleProperties;var editable=this.editable;for(var i=0;i=0;--i) styleText+=indentString.repeat(mediaQueriesCount-i-1)+"@media "+mediaList[i].text+" {\n";styleText+=indentString.repeat(mediaQueriesCount)+this.selectorText+" {\n";for(let property of this._properties){if(property.anonymous) continue;styleText+=indentString.repeat(mediaQueriesCount+1)+property.text.trim();if(!styleText.endsWith(";")) styleText+=";";styleText+="\n";} for(let i=mediaQueriesCount;i>0;--i) styleText+=indentString.repeat(i)+"}\n";styleText+="}";return styleText;} isInspectorRule() {return this._ownerRule&&this._ownerRule.type===WebInspector.CSSStyleSheet.Type.Inspector;} hasProperties() {return!!this._properties.length;} get nodeStyles() {return this._nodeStyles;}};WebInspector.CSSStyleDeclaration.Event={PropertiesChanged:"css-style-declaration-properties-changed",InitialTextModified:"css-style-declaration-initial-text-modified"};WebInspector.CSSStyleDeclaration.Type={Rule:"css-style-declaration-type-rule",Inline:"css-style-declaration-type-inline",Attribute:"css-style-declaration-type-attribute",Computed:"css-style-declaration-type-computed"};WebInspector.CSSStyleSheet=class CSSStyleSheet extends WebInspector.SourceCode {constructor(id) {super();this._id=id||null;this._url=null;this._parentFrame=null;this._origin=null;this._startLineNumber=0;this._startColumnNumber=0;this._inlineStyleAttribute=false;this._inlineStyleTag=false;this._hasInfo=false;} static resetUniqueDisplayNameNumbers() {WebInspector.CSSStyleSheet._nextUniqueDisplayNameNumber=1;} get id() {return this._id;} get parentFrame() {return this._parentFrame;} get origin() {return this._origin;} get url() {return this._url;} get urlComponents() {if(!this._urlComponents) this._urlComponents=parseURL(this._url);return this._urlComponents;} get mimeType() {return"text/css";} get displayName() {if(this._url) return WebInspector.displayNameForURL(this._url,this.urlComponents);if(!this._uniqueDisplayNameNumber) this._uniqueDisplayNameNumber=this.constructor._nextUniqueDisplayNameNumber++;return WebInspector.UIString("Anonymous StyleSheet %d").format(this._uniqueDisplayNameNumber);} get startLineNumber() {return this._startLineNumber;} get startColumnNumber() {return this._startColumnNumber;} hasInfo() {return this._hasInfo;} isInspectorStyleSheet() {return this._origin===WebInspector.CSSStyleSheet.Type.Inspector;} isInlineStyleTag() {return this._inlineStyleTag;} isInlineStyleAttributeStyleSheet() {return this._inlineStyleAttribute;} markAsInlineStyleAttributeStyleSheet() {this._inlineStyleAttribute=true;} offsetSourceCodeLocation(sourceCodeLocation) {if(!sourceCodeLocation) return null;if(!this._hasInfo) return sourceCodeLocation;let sourceCode=sourceCodeLocation.sourceCode;let lineNumber=this._startLineNumber+sourceCodeLocation.lineNumber;let columnNumber=this._startColumnNumber+sourceCodeLocation.columnNumber;return sourceCode.createSourceCodeLocation(lineNumber,columnNumber);} updateInfo(url,parentFrame,origin,inlineStyle,startLineNumber,startColumnNumber) {this._hasInfo=true;this._url=url||null;this._urlComponents=undefined;this._parentFrame=parentFrame||null;this._origin=origin;this._inlineStyleTag=inlineStyle;this._startLineNumber=startLineNumber;this._startColumnNumber=startColumnNumber;} get revisionForRequestedContent() {return this.currentRevision;} handleCurrentRevisionContentChange() {if(!this._id) return;function contentDidChange(error) {if(error) return;DOMAgent.markUndoableState();this.dispatchEventToListeners(WebInspector.CSSStyleSheet.Event.ContentDidChange);} this._ignoreNextContentDidChangeNotification=true;CSSAgent.setStyleSheetText(this._id,this.currentRevision.content,contentDidChange.bind(this));} requestContentFromBackend() {if(!this._id){ return Promise.reject(new Error("There is no identifier to request content with."));} return CSSAgent.getStyleSheetText(this._id);} noteContentDidChange() {if(this._ignoreNextContentDidChangeNotification){this._ignoreNextContentDidChangeNotification=false;return false;} this.markContentAsStale();this.dispatchEventToListeners(WebInspector.CSSStyleSheet.Event.ContentDidChange);return true;}};WebInspector.CSSStyleSheet._nextUniqueDisplayNameNumber=1;WebInspector.CSSStyleSheet.Event={ContentDidChange:"stylesheet-content-did-change"};WebInspector.CSSStyleSheet.Type={Author:"css-stylesheet-type-author",User:"css-stylesheet-type-user",UserAgent:"css-stylesheet-type-user-agent",Inspector:"css-stylesheet-type-inspector"};WebInspector.CallFrame=class CallFrame extends WebInspector.Object {constructor(target,id,sourceCodeLocation,functionName,thisObject,scopeChain,nativeCode,programCode,isTailDeleted) {super();this._isConsoleEvaluation=sourceCodeLocation&&isWebInspectorConsoleEvaluationScript(sourceCodeLocation.sourceCode.sourceURL);if(this._isConsoleEvaluation){functionName=WebInspector.UIString("Console Evaluation");programCode=true;} this._target=target;this._id=id||null;this._sourceCodeLocation=sourceCodeLocation||null;this._functionName=functionName||"";this._thisObject=thisObject||null;this._scopeChain=scopeChain||[];this._nativeCode=nativeCode||false;this._programCode=programCode||false;this._isTailDeleted=isTailDeleted||false;} get target(){return this._target;} get id(){return this._id;} get sourceCodeLocation(){return this._sourceCodeLocation;} get functionName(){return this._functionName;} get nativeCode(){return this._nativeCode;} get programCode(){return this._programCode;} get thisObject(){return this._thisObject;} get scopeChain(){return this._scopeChain;} get isTailDeleted(){return this._isTailDeleted;} get isConsoleEvaluation(){return this._isConsoleEvaluation;} saveIdentityToCookie() { } collectScopeChainVariableNames(callback) {var result={this:true,__proto__:null};var pendingRequests=this._scopeChain.length;function propertiesCollected(properties) {for(var i=0;properties&&i=0;--i){let scope=scopes[i];markAsBaseIfNeeded(scope);if(shouldMergeClosureScopes(scope,lastScope,lastMerge)){let type=WebInspector.ScopeChainNode.Type.Closure;let objects=lastScope.objects.concat(scope.objects);let merged=new WebInspector.ScopeChainNode(type,objects,scope.name,scope.location);merged.__baseClosureScope=true;mergedScopes.pop();mergedScopes.push(merged);lastMerge=merged;lastScope=null;}else{mergedScopes.push(scope);lastMerge=null;lastScope=scope;}} mergedScopes=mergedScopes.reverse();for(let scope of mergedScopes){if(scope.type===WebInspector.ScopeChainNode.Type.Closure){if(scope.name===this._functionName) scope.convertToLocalScope();break;}} return mergedScopes;} static functionNameFromPayload(payload) {let functionName=payload.functionName;if(functionName==="global code") return WebInspector.UIString("Global Code");if(functionName==="eval code") return WebInspector.UIString("Eval Code");if(functionName==="module code") return WebInspector.UIString("Module Code");return functionName;} static programCodeFromPayload(payload) {return payload.functionName.endsWith(" code");} static fromDebuggerPayload(target,payload,scopeChain,sourceCodeLocation) {let id=payload.callFrameId;let thisObject=WebInspector.RemoteObject.fromPayload(payload.this,target);let functionName=WebInspector.CallFrame.functionNameFromPayload(payload);let nativeCode=false;let programCode=WebInspector.CallFrame.programCodeFromPayload(payload);let isTailDeleted=payload.isTailDeleted;return new WebInspector.CallFrame(target,id,sourceCodeLocation,functionName,thisObject,scopeChain,nativeCode,programCode,isTailDeleted);} static fromPayload(target,payload) {let{url,scriptId}=payload;let nativeCode=false;let sourceCodeLocation=null;let functionName=WebInspector.CallFrame.functionNameFromPayload(payload);let programCode=WebInspector.CallFrame.programCodeFromPayload(payload);if(url==="[native code]"){nativeCode=true;url=null;}else if(url||scriptId){let sourceCode=null;if(scriptId){sourceCode=WebInspector.debuggerManager.scriptForIdentifier(scriptId,target);if(sourceCode&&sourceCode.resource) sourceCode=sourceCode.resource;} if(!sourceCode) sourceCode=WebInspector.frameResourceManager.resourceForURL(url);if(!sourceCode) sourceCode=WebInspector.debuggerManager.scriptsForURL(url,target)[0];if(sourceCode){let lineNumber=payload.lineNumber-1;sourceCodeLocation=sourceCode.createLazySourceCodeLocation(lineNumber,payload.columnNumber);}else{nativeCode=true;url=null;}} const id=null;const thisObject=null;const scopeChain=null;const isTailDeleted=false;return new WebInspector.CallFrame(target,id,sourceCodeLocation,functionName,thisObject,scopeChain,nativeCode,programCode,isTailDeleted);}};WebInspector.Canvas=class Canvas extends WebInspector.Object {constructor(identifier,contextType,frame,{domNode,cssCanvasName,contextAttributes,memoryCost}={}) {super();this._identifier=identifier;this._contextType=contextType;this._frame=frame;this._domNode=domNode||null;this._cssCanvasName=cssCanvasName||"";this._contextAttributes=contextAttributes||{};this._memoryCost=memoryCost||NaN;this._cssCanvasClientNodes=null;} static fromPayload(payload) {let contextType=null;switch(payload.contextType){case CanvasAgent.ContextType.Canvas2D:contextType=WebInspector.Canvas.ContextType.Canvas2D;break;case CanvasAgent.ContextType.WebGL:contextType=WebInspector.Canvas.ContextType.WebGL;break;case CanvasAgent.ContextType.WebGL2:contextType=WebInspector.Canvas.ContextType.WebGL2;break;case CanvasAgent.ContextType.WebGPU:contextType=WebInspector.Canvas.ContextType.WebGPU;break;default:console.error("Invalid canvas context type",payload.contextType);} let frame=WebInspector.frameResourceManager.frameForIdentifier(payload.frameId);return new WebInspector.Canvas(payload.canvasId,contextType,frame,{domNode:payload.nodeId?WebInspector.domTreeManager.nodeForId(payload.nodeId):null,cssCanvasName:payload.cssCanvasName,contextAttributes:payload.contextAttributes,memoryCost:payload.memoryCost,});} static displayNameForContextType(contextType) {switch(contextType){case WebInspector.Canvas.ContextType.Canvas2D:return WebInspector.UIString("2D");case WebInspector.Canvas.ContextType.WebGL:return WebInspector.unlocalizedString("WebGL");case WebInspector.Canvas.ContextType.WebGL2:return WebInspector.unlocalizedString("WebGL2");case WebInspector.Canvas.ContextType.WebGPU:return WebInspector.unlocalizedString("WebGPU");default:console.error("Invalid canvas context type",contextType);}} static resetUniqueDisplayNameNumbers() {WebInspector.Canvas._nextUniqueDisplayNameNumber=1;} get identifier(){return this._identifier;} get contextType(){return this._contextType;} get frame(){return this._frame;} get cssCanvasName(){return this._cssCanvasName;} get contextAttributes(){return this._contextAttributes;} get memoryCost() {return this._memoryCost;} set memoryCost(memoryCost) {if(memoryCost===this._memoryCost) return;this._memoryCost=memoryCost;this.dispatchEventToListeners(WebInspector.Canvas.Event.MemoryChanged);} get displayName() {if(this._cssCanvasName) return WebInspector.UIString("CSS canvas “%s”").format(this._cssCanvasName);if(this._domNode){let idSelector=this._domNode.escapedIdSelector;if(idSelector) return WebInspector.UIString("Canvas %s").format(idSelector);} if(!this._uniqueDisplayNameNumber) this._uniqueDisplayNameNumber=this.constructor._nextUniqueDisplayNameNumber++;return WebInspector.UIString("Canvas %d").format(this._uniqueDisplayNameNumber);} requestNode(callback) {if(this._domNode){callback(this._domNode);return;} WebInspector.domTreeManager.ensureDocument();CanvasAgent.requestNode(this._identifier,(error,nodeId)=>{if(error){callback(null);return;} this._domNode=WebInspector.domTreeManager.nodeForId(nodeId);callback(this._domNode);});} requestContent(callback) {CanvasAgent.requestContent(this._identifier,(error,content)=>{if(error){callback(null);return;} callback(content);});} requestCSSCanvasClientNodes(callback) {if(!this._cssCanvasName){callback([]);return;} if(this._cssCanvasClientNodes){callback(this._cssCanvasClientNodes);return;} WebInspector.domTreeManager.ensureDocument();CanvasAgent.requestCSSCanvasClientNodes(this._identifier,(error,clientNodeIds)=>{if(error){callback([]);return;} clientNodeIds=Array.isArray(clientNodeIds)?clientNodeIds:[];this._cssCanvasClientNodes=clientNodeIds.map((clientNodeId)=>WebInspector.domTreeManager.nodeForId(clientNodeId));callback(this._cssCanvasClientNodes);});} saveIdentityToCookie(cookie) {cookie[WebInspector.Canvas.FrameURLCookieKey]=this._frame.url.hash;if(this._cssCanvasName) cookie[WebInspector.Canvas.CSSCanvasNameCookieKey]=this._cssCanvasName;else if(this._domNode) cookie[WebInspector.Canvas.NodePathCookieKey]=this._domNode.path;} cssCanvasClientNodesChanged() {if(!this._cssCanvasName) return;this._cssCanvasClientNodes=null;this.dispatchEventToListeners(WebInspector.Canvas.Event.CSSCanvasClientNodesChanged);}};WebInspector.Canvas._nextUniqueDisplayNameNumber=1;WebInspector.Canvas.FrameURLCookieKey="canvas-frame-url";WebInspector.Canvas.CSSCanvasNameCookieKey="canvas-css-canvas-name";WebInspector.Canvas.ContextType={Canvas2D:"canvas-2d",WebGL:"webgl",WebGL2:"webgl2",WebGPU:"webgpu",};WebInspector.Canvas.ResourceSidebarType="resource-type-canvas";WebInspector.Canvas.Event={MemoryChanged:"canvas-memory-changed",CSSCanvasClientNodesChanged:"canvas-css-canvas-client-nodes-changed",};WebInspector.Collection=class Collection extends WebInspector.Object {constructor(typeVerifier) {super();this._items=new Set;this._typeVerifier=typeVerifier||WebInspector.Collection.TypeVerifier.Any;} get items(){return this._items;} get typeVerifier(){return this._typeVerifier;} add(item) {let isValidType=this._typeVerifier(item);if(!isValidType) return;this._items.add(item);this.itemAdded(item);this.dispatchEventToListeners(WebInspector.Collection.Event.ItemAdded,{item});} remove(item) {let wasRemoved=this._items.delete(item);this.itemRemoved(item);this.dispatchEventToListeners(WebInspector.Collection.Event.ItemRemoved,{item});} clear() {let items=new Set(this._items);this._items.clear();this.itemsCleared(items);for(let item of items) this.dispatchEventToListeners(WebInspector.Collection.Event.ItemRemoved,{item});} toArray() {return Array.from(this._items);} toJSON() {return this.toArray();} itemAdded(item) {} itemRemoved(item) {} itemsCleared(items) {}};WebInspector.Collection.Event={ItemAdded:"collection-item-added",ItemRemoved:"collection-item-removed",};WebInspector.Collection.TypeVerifier={Any:(object)=>true,ContentFlow:(object)=>object instanceof WebInspector.ContentFlow,Frame:(object)=>object instanceof WebInspector.Frame,Resource:(object)=>object instanceof WebInspector.Resource,Script:(object)=>object instanceof WebInspector.Script,CSSStyleSheet:(object)=>object instanceof WebInspector.CSSStyleSheet,Canvas:(object)=>object instanceof WebInspector.Canvas,};WebInspector.CollectionEntry=class CollectionEntry extends WebInspector.Object {constructor(key,value) {super();this._key=key;this._value=value;} static fromPayload(payload,target) {if(payload.key) payload.key=WebInspector.RemoteObject.fromPayload(payload.key,target);if(payload.value) payload.value=WebInspector.RemoteObject.fromPayload(payload.value,target);return new WebInspector.CollectionEntry(payload.key,payload.value);} get key(){return this._key;} get value(){return this._value;}};WebInspector.CollectionEntryPreview=class CollectionEntryPreview extends WebInspector.Object {constructor(keyPreview,valuePreview) {super();this._key=keyPreview;this._value=valuePreview;} static fromPayload(payload) {if(payload.key) payload.key=WebInspector.ObjectPreview.fromPayload(payload.key);if(payload.value) payload.value=WebInspector.ObjectPreview.fromPayload(payload.value);return new WebInspector.CollectionEntryPreview(payload.key,payload.value);} get keyPreview(){return this._key;} get valuePreview(){return this._value;}};WebInspector.Color=class Color {constructor(format,components) {this.format=format;if(format===WebInspector.Color.Format.HSL||format===WebInspector.Color.Format.HSLA) this._hsla=components;else this._rgba=components;this.valid=!components.some(isNaN);} static fromString(colorString) {let value=colorString.toLowerCase().replace(/%|\s+/g,"");let transparentKeywords=["transparent","rgba(0,0,0,0)","hsla(0,0,0,0)"];if(transparentKeywords.includes(value)){let color=new WebInspector.Color(WebInspector.Color.Format.Keyword,[0,0,0,0]);color.keyword="transparent";color.original=colorString;return color;} let simple=/^(?:#([0-9a-f]{3,8})|rgb\(([^)]+)\)|(\w+)|hsl\(([^)]+)\))$/i;let match=colorString.match(simple);if(match){if(match[1]){ let hex=match[1].toUpperCase();let len=hex.length;if(len===3){return new WebInspector.Color(WebInspector.Color.Format.ShortHEX,[parseInt(hex.charAt(0)+hex.charAt(0),16),parseInt(hex.charAt(1)+hex.charAt(1),16),parseInt(hex.charAt(2)+hex.charAt(2),16),1]);}else if(len===6){return new WebInspector.Color(WebInspector.Color.Format.HEX,[parseInt(hex.substring(0,2),16),parseInt(hex.substring(2,4),16),parseInt(hex.substring(4,6),16),1]);}else if(len===4){return new WebInspector.Color(WebInspector.Color.Format.ShortHEXAlpha,[parseInt(hex.charAt(0)+hex.charAt(0),16),parseInt(hex.charAt(1)+hex.charAt(1),16),parseInt(hex.charAt(2)+hex.charAt(2),16),parseInt(hex.charAt(3)+hex.charAt(3),16)/255]);}else if(len===8){return new WebInspector.Color(WebInspector.Color.Format.HEXAlpha,[parseInt(hex.substring(0,2),16),parseInt(hex.substring(2,4),16),parseInt(hex.substring(4,6),16),parseInt(hex.substring(6,8),16)/255]);}else return null;}else if(match[2]){ let rgb=match[2].split(/\s*,\s*/);if(rgb.length!==3) return null;return new WebInspector.Color(WebInspector.Color.Format.RGB,[parseInt(rgb[0]),parseInt(rgb[1]),parseInt(rgb[2]),1]);}else if(match[3]){ let keyword=match[3].toLowerCase();if(!WebInspector.Color.Keywords.hasOwnProperty(keyword)) return null;let color=new WebInspector.Color(WebInspector.Color.Format.Keyword,WebInspector.Color.Keywords[keyword].concat(1));color.keyword=keyword;color.original=colorString;return color;}else if(match[4]){ let hsl=match[4].replace(/%/g,"").split(/\s*,\s*/);if(hsl.length!==3) return null;return new WebInspector.Color(WebInspector.Color.Format.HSL,[parseInt(hsl[0]),parseInt(hsl[1]),parseInt(hsl[2]),1]);}} let advanced=/^(?:rgba\(([^)]+)\)|hsla\(([^)]+)\))$/i;match=colorString.match(advanced);if(match){if(match[1]){ let rgba=match[1].split(/\s*,\s*/);if(rgba.length!==4) return null;return new WebInspector.Color(WebInspector.Color.Format.RGBA,[parseInt(rgba[0]),parseInt(rgba[1]),parseInt(rgba[2]),Number.constrain(parseFloat(rgba[3]),0,1)]);}else if(match[2]){ let hsla=match[2].replace(/%/g,"").split(/\s*,\s*/);if(hsla.length!==4) return null;return new WebInspector.Color(WebInspector.Color.Format.HSLA,[parseInt(hsla[0]),parseInt(hsla[1]),parseInt(hsla[2]),Number.constrain(parseFloat(hsla[3]),0,1)]);}} return null;} static rgb2hsv(r,g,b) {r/=255;g/=255;b/=255;let min=Math.min(Math.min(r,g),b);let max=Math.max(Math.max(r,g),b);let delta=max-min;let h;let s;let v=max;if(delta===0) h=0;else if(max===r) h=(60*((g-b)/delta))%360;else if(max===g) h=60*((b-r)/delta)+120;else if(max===b) h=60*((r-g)/delta)+240;if(h<0) h+=360; if(max===0) s=0;else s=1-(min/max);return[h,s,v];} static hsv2rgb(h,s,v) {if(s===0) return[v,v,v];h/=60;let i=Math.floor(h);let data=[v*(1-s),v*(1-s*(h-i)),v*(1-s*(1-(h-i)))];let rgb;switch(i){case 0:rgb=[v,data[2],data[0]];break;case 1:rgb=[data[1],v,data[0]];break;case 2:rgb=[data[0],v,data[2]];break;case 3:rgb=[data[0],data[1],v];break;case 4:rgb=[data[2],data[0],v];break;default:rgb=[v,data[0],data[1]];break;} return rgb;} nextFormat(format) {format=format||this.format;switch(format){case WebInspector.Color.Format.Original:case WebInspector.Color.Format.HEX:case WebInspector.Color.Format.HEXAlpha:return this.simple?WebInspector.Color.Format.RGB:WebInspector.Color.Format.RGBA;case WebInspector.Color.Format.RGB:case WebInspector.Color.Format.RGBA:return this.simple?WebInspector.Color.Format.HSL:WebInspector.Color.Format.HSLA;case WebInspector.Color.Format.HSL:case WebInspector.Color.Format.HSLA:if(this.isKeyword()) return WebInspector.Color.Format.Keyword;if(this.simple) return this.canBeSerializedAsShortHEX()?WebInspector.Color.Format.ShortHEX:WebInspector.Color.Format.HEX;return this.canBeSerializedAsShortHEX()?WebInspector.Color.Format.ShortHEXAlpha:WebInspector.Color.Format.HEXAlpha;case WebInspector.Color.Format.ShortHEX:return WebInspector.Color.Format.HEX;case WebInspector.Color.Format.ShortHEXAlpha:return WebInspector.Color.Format.HEXAlpha;case WebInspector.Color.Format.Keyword:if(this.simple) return this.canBeSerializedAsShortHEX()?WebInspector.Color.Format.ShortHEX:WebInspector.Color.Format.HEX;return this.canBeSerializedAsShortHEX()?WebInspector.Color.Format.ShortHEXAlpha:WebInspector.Color.Format.HEXAlpha;default:console.error("Unknown color format.");return null;}} get alpha() {return this._rgba?this._rgba[3]:this._hsla[3];} get simple() {return this.alpha===1;} get rgb() {let rgb=this.rgba.slice();rgb.pop();return rgb;} get hsl() {let hsl=this.hsla.slice();hsl.pop();return hsl;} get rgba() {if(!this._rgba) this._rgba=this._hslaToRGBA(this._hsla);return this._rgba;} get hsla() {if(!this._hsla) this._hsla=this._rgbaToHSLA(this.rgba);return this._hsla;} copy() {switch(this.format){case WebInspector.Color.Format.RGB:case WebInspector.Color.Format.HEX:case WebInspector.Color.Format.ShortHEX:case WebInspector.Color.Format.HEXAlpha:case WebInspector.Color.Format.ShortHEXAlpha:case WebInspector.Color.Format.Keyword:case WebInspector.Color.Format.RGBA:return new WebInspector.Color(this.format,this.rgba);case WebInspector.Color.Format.HSL:case WebInspector.Color.Format.HSLA:return new WebInspector.Color(this.format,this.hsla);}} toString(format) {if(!format) format=this.format;switch(format){case WebInspector.Color.Format.Original:return this._toOriginalString();case WebInspector.Color.Format.RGB:return this._toRGBString();case WebInspector.Color.Format.RGBA:return this._toRGBAString();case WebInspector.Color.Format.HSL:return this._toHSLString();case WebInspector.Color.Format.HSLA:return this._toHSLAString();case WebInspector.Color.Format.HEX:return this._toHEXString();case WebInspector.Color.Format.ShortHEX:return this._toShortHEXString();case WebInspector.Color.Format.HEXAlpha:return this._toHEXAlphaString();case WebInspector.Color.Format.ShortHEXAlpha:return this._toShortHEXAlphaString();case WebInspector.Color.Format.Keyword:return this._toKeywordString();} throw"invalid color format";} isKeyword() {if(this.keyword) return true;if(!this.simple) return Array.shallowEqual(this._rgba,[0,0,0,0])||Array.shallowEqual(this._hsla,[0,0,0,0]);let rgb=(this._rgba&&this._rgba.slice(0,3))||this._hslToRGB(this._hsla);return Object.keys(WebInspector.Color.Keywords).some(key=>Array.shallowEqual(WebInspector.Color.Keywords[key],rgb));} canBeSerializedAsShortHEX() {let rgba=this.rgba||this._hslaToRGBA(this._hsla);let r=this._componentToHexValue(rgba[0]);if(r[0]!==r[1]) return false;let g=this._componentToHexValue(rgba[1]);if(g[0]!==g[1]) return false;let b=this._componentToHexValue(rgba[2]);if(b[0]!==b[1]) return false;if(!this.simple){let a=this._componentToHexValue(Math.round(rgba[3]*255));if(a[0]!==a[1]) return false;} return true;} _toOriginalString() {return this.original||this._toKeywordString();} _toKeywordString() {if(this.keyword) return this.keyword;let rgba=this.rgba;if(!this.simple){if(rgba[0]===0&&rgba[1]===0&&rgba[2]===0&&rgba[3]===0) return"transparent";return this._toRGBAString();} let keywords=WebInspector.Color.Keywords;for(let keyword in keywords){if(!keywords.hasOwnProperty(keyword)) continue;let keywordRGB=keywords[keyword];if(keywordRGB[0]===rgba[0]&&keywordRGB[1]===rgba[1]&&keywordRGB[2]===rgba[2]) return keyword;} return this._toRGBString();} _toShortHEXString() {if(!this.simple) return this._toRGBAString();let rgba=this.rgba;let r=this._componentToHexValue(rgba[0]);let g=this._componentToHexValue(rgba[1]);let b=this._componentToHexValue(rgba[2]);if(r[0]===r[1]&&g[0]===g[1]&&b[0]===b[1]) return"#"+r[0]+g[0]+b[0];else return"#"+r+g+b;} _toHEXString() {if(!this.simple) return this._toRGBAString();let rgba=this.rgba;let r=this._componentToHexValue(rgba[0]);let g=this._componentToHexValue(rgba[1]);let b=this._componentToHexValue(rgba[2]);return"#"+r+g+b;} _toShortHEXAlphaString() {let rgba=this.rgba;let r=this._componentToHexValue(rgba[0]);let g=this._componentToHexValue(rgba[1]);let b=this._componentToHexValue(rgba[2]);let a=this._componentToHexValue(Math.round(rgba[3]*255));if(r[0]===r[1]&&g[0]===g[1]&&b[0]===b[1]&&a[0]===a[1]) return"#"+r[0]+g[0]+b[0]+a[0];else return"#"+r+g+b+a;} _toHEXAlphaString() {let rgba=this.rgba;let r=this._componentToHexValue(rgba[0]);let g=this._componentToHexValue(rgba[1]);let b=this._componentToHexValue(rgba[2]);let a=this._componentToHexValue(Math.round(rgba[3]*255));return"#"+r+g+b+a;} _toRGBString() {if(!this.simple) return this._toRGBAString();let rgba=this.rgba.slice(0,-1);rgba=rgba.map((value)=>value.maxDecimals(2));return"rgb("+rgba.join(", ")+")";} _toRGBAString() {let rgba=this.rgba;rgba=rgba.map((value)=>value.maxDecimals(2));return"rgba("+rgba.join(", ")+")";} _toHSLString() {if(!this.simple) return this._toHSLAString();let hsla=this.hsla;hsla=hsla.map((value)=>value.maxDecimals(2));return"hsl("+hsla[0]+", "+hsla[1]+"%, "+hsla[2]+"%)";} _toHSLAString() {let hsla=this.hsla;hsla=hsla.map((value)=>value.maxDecimals(2));return"hsla("+hsla[0]+", "+hsla[1]+"%, "+hsla[2]+"%, "+hsla[3]+")";} _componentToNumber(value) {return Number.constrain(value,0,255);} _componentToHexValue(value) {let hex=this._componentToNumber(value).toString(16);if(hex.length===1) hex="0"+hex;return hex;} _rgbToHSL(rgb) {let r=this._componentToNumber(rgb[0])/255;let g=this._componentToNumber(rgb[1])/255;let b=this._componentToNumber(rgb[2])/255;let max=Math.max(r,g,b);let min=Math.min(r,g,b);let diff=max-min;let add=max+min;let h;let s;let l=0.5*add;if(min===max) h=0;else if(r===max) h=((60*(g-b)/diff)+360)%360;else if(g===max) h=(60*(b-r)/diff)+120;else h=(60*(r-g)/diff)+240;if(l===0) s=0;else if(l===1) s=1;else if(l<=0.5) s=diff/add;else s=diff/(2-add);return[Math.round(h),Math.round(s*100),Math.round(l*100)];} _hslToRGB(hsl) {let h=parseFloat(hsl[0])/360;let s=parseFloat(hsl[1])/100;let l=parseFloat(hsl[2])/100;h*=6;let sArray=[l+=s*=l<.5?l:1-l,l-h%1*s*2,l-=s*=2,l,l+h%1*s,l+s];return[Math.round(sArray[~~h%6]*255),Math.round(sArray[(h|16)%6]*255),Math.round(sArray[(h|8)%6]*255)];} _rgbaToHSLA(rgba) {let hsl=this._rgbToHSL(rgba);hsl.push(rgba[3]);return hsl;} _hslaToRGBA(hsla) {let rgba=this._hslToRGB(hsla);rgba.push(hsla[3]);return rgba;}};WebInspector.Color.Format={Original:"color-format-original",Keyword:"color-format-keyword",HEX:"color-format-hex",ShortHEX:"color-format-short-hex",HEXAlpha:"color-format-hex-alpha",ShortHEXAlpha:"color-format-short-hex-alpha",RGB:"color-format-rgb",RGBA:"color-format-rgba",HSL:"color-format-hsl",HSLA:"color-format-hsla"};WebInspector.Color.Keywords={"aliceblue":[240,248,255],"antiquewhite":[250,235,215],"aquamarine":[127,255,212],"azure":[240,255,255],"beige":[245,245,220],"bisque":[255,228,196],"black":[0,0,0],"blanchedalmond":[255,235,205],"blue":[0,0,255],"blueviolet":[138,43,226],"brown":[165,42,42],"burlywood":[222,184,135],"cadetblue":[95,158,160],"chartreuse":[127,255,0],"chocolate":[210,105,30],"coral":[255,127,80],"cornflowerblue":[100,149,237],"cornsilk":[255,248,220],"crimson":[237,164,61],"cyan":[0,255,255],"darkblue":[0,0,139],"darkcyan":[0,139,139],"darkgoldenrod":[184,134,11],"darkgray":[169,169,169],"darkgreen":[0,100,0],"darkgrey":[169,169,169],"darkkhaki":[189,183,107],"darkmagenta":[139,0,139],"darkolivegreen":[85,107,47],"darkorange":[255,140,0],"darkorchid":[153,50,204],"darkred":[139,0,0],"darksalmon":[233,150,122],"darkseagreen":[143,188,143],"darkslateblue":[72,61,139],"darkslategray":[47,79,79],"darkslategrey":[47,79,79],"darkturquoise":[0,206,209],"darkviolet":[148,0,211],"deeppink":[255,20,147],"deepskyblue":[0,191,255],"dimgray":[105,105,105],"dimgrey":[105,105,105],"dodgerblue":[30,144,255],"firebrick":[178,34,34],"floralwhite":[255,250,240],"forestgreen":[34,139,34],"gainsboro":[220,220,220],"ghostwhite":[248,248,255],"gold":[255,215,0],"goldenrod":[218,165,32],"gray":[128,128,128],"green":[0,128,0],"greenyellow":[173,255,47],"grey":[128,128,128],"honeydew":[240,255,240],"hotpink":[255,105,180],"indianred":[205,92,92],"indigo":[75,0,130],"ivory":[255,255,240],"khaki":[240,230,140],"lavender":[230,230,250],"lavenderblush":[255,240,245],"lawngreen":[124,252,0],"lemonchiffon":[255,250,205],"lightblue":[173,216,230],"lightcoral":[240,128,128],"lightcyan":[224,255,255],"lightgoldenrodyellow":[250,250,210],"lightgray":[211,211,211],"lightgreen":[144,238,144],"lightgrey":[211,211,211],"lightpink":[255,182,193],"lightsalmon":[255,160,122],"lightseagreen":[32,178,170],"lightskyblue":[135,206,250],"lightslategray":[119,136,153],"lightslategrey":[119,136,153],"lightsteelblue":[176,196,222],"lightyellow":[255,255,224],"lime":[0,255,0],"limegreen":[50,205,50],"linen":[250,240,230],"magenta":[255,0,255],"maroon":[128,0,0],"mediumaquamarine":[102,205,170],"mediumblue":[0,0,205],"mediumorchid":[186,85,211],"mediumpurple":[147,112,219],"mediumseagreen":[60,179,113],"mediumslateblue":[123,104,238],"mediumspringgreen":[0,250,154],"mediumturquoise":[72,209,204],"mediumvioletred":[199,21,133],"midnightblue":[25,25,112],"mintcream":[245,255,250],"mistyrose":[255,228,225],"moccasin":[255,228,181],"navajowhite":[255,222,173],"navy":[0,0,128],"oldlace":[253,245,230],"olive":[128,128,0],"olivedrab":[107,142,35],"orange":[255,165,0],"orangered":[255,69,0],"orchid":[218,112,214],"palegoldenrod":[238,232,170],"palegreen":[152,251,152],"paleturquoise":[175,238,238],"palevioletred":[219,112,147],"papayawhip":[255,239,213],"peachpuff":[255,218,185],"peru":[205,133,63],"pink":[255,192,203],"plum":[221,160,221],"powderblue":[176,224,230],"purple":[128,0,128],"rebeccapurple":[102,51,153],"red":[255,0,0],"rosybrown":[188,143,143],"royalblue":[65,105,225],"saddlebrown":[139,69,19],"salmon":[250,128,114],"sandybrown":[244,164,96],"seagreen":[46,139,87],"seashell":[255,245,238],"sienna":[160,82,45],"silver":[192,192,192],"skyblue":[135,206,235],"slateblue":[106,90,205],"slategray":[112,128,144],"slategrey":[112,128,144],"snow":[255,250,250],"springgreen":[0,255,127],"steelblue":[70,130,180],"tan":[210,180,140],"teal":[0,128,128],"thistle":[216,191,216],"tomato":[255,99,71],"turquoise":[64,224,208],"violet":[238,130,238],"wheat":[245,222,179],"white":[255,255,255],"whitesmoke":[245,245,245],"yellow":[255,255,0],"yellowgreen":[154,205,50]};WebInspector.ConsoleCommandResultMessage=class ConsoleCommandResult extends WebInspector.ConsoleMessage {constructor(target,result,wasThrown,savedResultIndex,shouldRevealConsole=true) {let source=WebInspector.ConsoleMessage.MessageSource.JS;let level=wasThrown?WebInspector.ConsoleMessage.MessageLevel.Error:WebInspector.ConsoleMessage.MessageLevel.Log;let type=WebInspector.ConsoleMessage.MessageType.Result;super(target,source,level,"",type,undefined,undefined,undefined,0,[result],undefined,undefined);this._savedResultIndex=savedResultIndex;this._shouldRevealConsole=shouldRevealConsole;if(this._savedResultIndex&&this._savedResultIndex>WebInspector.ConsoleCommandResultMessage.maximumSavedResultIndex) WebInspector.ConsoleCommandResultMessage.maximumSavedResultIndex=this._savedResultIndex;} static clearMaximumSavedResultIndex() {WebInspector.ConsoleCommandResultMessage.maximumSavedResultIndex=0;} get savedResultIndex() {return this._savedResultIndex;} get shouldRevealConsole() {return this._shouldRevealConsole;}};WebInspector.ConsoleCommandResultMessage.maximumSavedResultIndex=0;WebInspector.ContentFlow=class ContentFlow extends WebInspector.Object {constructor(documentNodeIdentifier,name,overset,contentNodes) {super();this._documentNodeIdentifier=documentNodeIdentifier;this._name=name;this._overset=overset;this._contentNodes=contentNodes;} get id() {return this._documentNodeIdentifier+":"+this._name;} get documentNodeIdentifier() {return this._documentNodeIdentifier;} get name() {return this._name;} get overset() {return this._overset;} set overset(overset) {if(this._overset===overset) return;this._overset=overset;this.dispatchEventToListeners(WebInspector.ContentFlow.Event.FlowOversetWasChanged);} get contentNodes() {return this._contentNodes;} insertContentNodeBefore(contentNode,referenceNode) {var index=this._contentNodes.indexOf(referenceNode);this._contentNodes.splice(index,0,contentNode);this.dispatchEventToListeners(WebInspector.ContentFlow.Event.ContentNodeWasAdded,{node:contentNode,before:referenceNode});} appendContentNode(contentNode) {this._contentNodes.push(contentNode);this.dispatchEventToListeners(WebInspector.ContentFlow.Event.ContentNodeWasAdded,{node:contentNode});} removeContentNode(contentNode) {var index=this._contentNodes.indexOf(contentNode);this._contentNodes.splice(index,1);this.dispatchEventToListeners(WebInspector.ContentFlow.Event.ContentNodeWasRemoved,{node:contentNode});}};WebInspector.ContentFlow.Event={OversetWasChanged:"content-flow-overset-was-changed",ContentNodeWasAdded:"content-flow-content-node-was-added",ContentNodeWasRemoved:"content-flow-content-node-was-removed"};WebInspector.CookieStorageObject=class CookieStorageObject {constructor(host) {this._host=host;} static cookieMatchesResourceURL(cookie,resourceURL) {var parsedURL=parseURL(resourceURL);if(!parsedURL||!WebInspector.CookieStorageObject.cookieDomainMatchesResourceDomain(cookie.domain,parsedURL.host)) return false;return parsedURL.path.startsWith(cookie.path)&&(!cookie.port||parsedURL.port===cookie.port)&&(!cookie.secure||parsedURL.scheme==="https");} static cookieDomainMatchesResourceDomain(cookieDomain,resourceDomain) {if(cookieDomain.charAt(0)!==".") return resourceDomain===cookieDomain;return!!resourceDomain.match(new RegExp("^(?:[^\\.]+\\.)*"+cookieDomain.substring(1).escapeForRegExp()+"$"),"i");} get host() {return this._host;} saveIdentityToCookie(cookie) {cookie[WebInspector.CookieStorageObject.CookieHostCookieKey]=this.host;}};WebInspector.CookieStorageObject.TypeIdentifier="cookie-storage";WebInspector.CookieStorageObject.CookieHostCookieKey="cookie-storage-host";WebInspector.DOMBreakpoint=class DOMBreakpoint extends WebInspector.Object {constructor(domNodeOrInfo,type,disabled) {super();if(domNodeOrInfo instanceof WebInspector.DOMNode){this._domNodeIdentifier=domNodeOrInfo.id;this._path=domNodeOrInfo.path();this._url=WebInspector.frameResourceManager.mainFrame.url;}else if(domNodeOrInfo&&typeof domNodeOrInfo==="object"){this._domNodeIdentifier=null;this._path=domNodeOrInfo.path;this._url=domNodeOrInfo.url;} this._type=type;this._disabled=disabled||false;} get type(){return this._type;} get url(){return this._url;} get path(){return this._path;} get disabled() {return this._disabled;} set disabled(disabled) {if(this._disabled===disabled) return;this._disabled=disabled;this.dispatchEventToListeners(WebInspector.DOMBreakpoint.Event.DisabledStateDidChange);} get domNodeIdentifier() {return this._domNodeIdentifier;} set domNodeIdentifier(nodeIdentifier) {if(this._domNodeIdentifier===nodeIdentifier) return;let data={};if(!nodeIdentifier) data.oldNodeIdentifier=this._domNodeIdentifier;this._domNodeIdentifier=nodeIdentifier;this.dispatchEventToListeners(WebInspector.DOMBreakpoint.Event.ResolvedStateDidChange,data);} get serializableInfo() {let info={url:this._url,path:this._path,type:this._type};if(this._disabled) info.disabled=true;return info;} saveIdentityToCookie(cookie) {cookie[WebInspector.DOMBreakpoint.DocumentURLCookieKey]=this.url;cookie[WebInspector.DOMBreakpoint.NodePathCookieKey]=this.path;cookie[WebInspector.DOMBreakpoint.TypeCookieKey]=this.type;}};WebInspector.DOMBreakpoint.DocumentURLCookieKey="dom-breakpoint-document-url";WebInspector.DOMBreakpoint.NodePathCookieKey="dom-breakpoint-node-path";WebInspector.DOMBreakpoint.TypeCookieKey="dom-breakpoint-type";WebInspector.DOMBreakpoint.Type={SubtreeModified:"subtree-modified",AttributeModified:"attribute-modified",NodeRemoved:"node-removed",};WebInspector.DOMBreakpoint.Event={DisabledStateDidChange:"dom-breakpoint-disabled-state-did-change",ResolvedStateDidChange:"dom-breakpoint-resolved-state-did-change",};WebInspector.DOMNode=class DOMNode extends WebInspector.Object {constructor(domTreeManager,doc,isInShadowTree,payload) {super();this._domTreeManager=domTreeManager;this._isInShadowTree=isInShadowTree;this.id=payload.nodeId;this._domTreeManager._idToDOMNode[this.id]=this;this._nodeType=payload.nodeType;this._nodeName=payload.nodeName;this._localName=payload.localName;this._nodeValue=payload.nodeValue;this._pseudoType=payload.pseudoType;this._shadowRootType=payload.shadowRootType;this._computedRole=payload.role;this._contentSecurityPolicyHash=payload.contentSecurityPolicyHash;if(this._nodeType===Node.DOCUMENT_NODE) this.ownerDocument=this;else this.ownerDocument=doc;this._attributes=[];this._attributesMap=new Map;if(payload.attributes) this._setAttributesPayload(payload.attributes);this._childNodeCount=payload.childNodeCount;this._children=null;this._filteredChildren=null;this._filteredChildrenNeedsUpdating=true;this._nextSibling=null;this._previousSibling=null;this.parentNode=null;this._enabledPseudoClasses=[]; this._shadowRoots=[];if(payload.shadowRoots){for(var i=0;i0) return children[0];return null;} get lastChild() {var children=this.children;if(children&&children.length>0) return children.lastValue;return null;} get nextSibling() {if(WebInspector.showShadowDOMSetting.value) return this._nextSibling;var node=this._nextSibling;while(node){if(!node._isInShadowTree) return node;node=node._nextSibling;} return null;} get previousSibling() {if(WebInspector.showShadowDOMSetting.value) return this._previousSibling;var node=this._previousSibling;while(node){if(!node._isInShadowTree) return node;node=node._previousSibling;} return null;} get childNodeCount() {var children=this.children;if(children) return children.length;if(WebInspector.showShadowDOMSetting.value) return this._childNodeCount+this._shadowRoots.length;return this._childNodeCount;} set childNodeCount(count) {this._childNodeCount=count;} computedRole() {return this._computedRole;} contentSecurityPolicyHash() {return this._contentSecurityPolicyHash;} hasAttributes() {return this._attributes.length>0;} hasChildNodes() {return this.childNodeCount>0;} hasShadowRoots() {return!!this._shadowRoots.length;} isInShadowTree() {return this._isInShadowTree;} isInUserAgentShadowTree() {return this._isInShadowTree&&this.ancestorShadowRoot().isUserAgentShadowRoot();} isCustomElement() {return this._customElementState===WebInspector.DOMNode.CustomElementState.Custom;} customElementState() {return this._customElementState;} isShadowRoot() {return!!this._shadowRootType;} isUserAgentShadowRoot() {return this._shadowRootType===WebInspector.DOMNode.ShadowRootType.UserAgent;} ancestorShadowRoot() {if(!this._isInShadowTree) return null;let node=this;while(node&&!node.isShadowRoot()) node=node.parentNode;return node;} ancestorShadowHost() {let shadowRoot=this.ancestorShadowRoot();return shadowRoot?shadowRoot.parentNode:null;} isPseudoElement() {return this._pseudoType!==undefined;} nodeType() {return this._nodeType;} nodeName() {return this._nodeName;} nodeNameInCorrectCase() {return this.isXMLNode()?this.nodeName():this.nodeName().toLowerCase();} setNodeName(name,callback) {DOMAgent.setNodeName(this.id,name,this._makeUndoableCallback(callback));} localName() {return this._localName;} templateContent() {return this._templateContent||null;} pseudoType() {return this._pseudoType;} hasPseudoElements() {return this._pseudoElements.size>0;} pseudoElements() {return this._pseudoElements;} beforePseudoElement() {return this._pseudoElements.get(WebInspector.DOMNode.PseudoElementType.Before)||null;} afterPseudoElement() {return this._pseudoElements.get(WebInspector.DOMNode.PseudoElementType.After)||null;} shadowRoots() {return this._shadowRoots;} shadowRootType() {return this._shadowRootType;} nodeValue() {return this._nodeValue;} setNodeValue(value,callback) {DOMAgent.setNodeValue(this.id,value,this._makeUndoableCallback(callback));} getAttribute(name) {let attr=this._attributesMap.get(name);return attr?attr.value:undefined;} setAttribute(name,text,callback) {DOMAgent.setAttributesAsText(this.id,text,name,this._makeUndoableCallback(callback));} setAttributeValue(name,value,callback) {DOMAgent.setAttributeValue(this.id,name,value,this._makeUndoableCallback(callback));} attributes() {return this._attributes;} removeAttribute(name,callback) {function mycallback(error,success) {if(!error){this._attributesMap.delete(name);for(var i=0;i{if(!className.length||foundClasses.has(className)) return selector;foundClasses.add(className);return`${selector}.${CSS.escape(className)}`;},"");} get displayName() {return this.nodeNameInCorrectCase()+this.escapedIdSelector+this.escapedClassSelector;} appropriateSelectorFor(justSelector) {if(this.isPseudoElement()) return this.parentNode.appropriateSelectorFor()+"::"+this._pseudoType;let lowerCaseName=this.localName()||this.nodeName().toLowerCase();let id=this.escapedIdSelector;if(id.length) return justSelector?id:lowerCaseName+id;let classes=this.escapedClassSelector;if(classes.length) return justSelector?classes:lowerCaseName+classes;if(lowerCaseName==="input"&&this.getAttribute("type")) return lowerCaseName+"[type=\""+this.getAttribute("type")+"\"]";return lowerCaseName;} isAncestor(node) {if(!node) return false;var currentNode=node.parentNode;while(currentNode){if(this===currentNode) return true;currentNode=currentNode.parentNode;} return false;} isDescendant(descendant) {return descendant!==null&&descendant.isAncestor(this);} get ownerSVGElement() {if(this._nodeName==="svg") return this;if(!this.parentNode) return null;return this.parentNode.ownerSVGElement;} isSVGElement() {return!!this.ownerSVGElement;} _setAttributesPayload(attrs) {this._attributes=[];this._attributesMap=new Map;for(var i=0;i=0?this._children[i-1]:null;child.parentNode=this;}} _addAttribute(name,value) {let attr={name,value,_node:this};this._attributesMap.set(name,attr);this._attributes.push(attr);} _setAttribute(name,value) {let attr=this._attributesMap.get(name);if(attr) attr.value=value;else this._addAttribute(name,value);} _removeAttribute(name) {let attr=this._attributesMap.get(name);if(attr){this._attributes.remove(attr);this._attributesMap.delete(name);}} moveTo(targetNode,anchorNode,callback) {DOMAgent.moveTo(this.id,targetNode.id,anchorNode?anchorNode.id:undefined,this._makeUndoableCallback(callback));} isXMLNode() {return!!this.ownerDocument&&!!this.ownerDocument.xmlVersion;} get enabledPseudoClasses() {return this._enabledPseudoClasses;} setPseudoClassEnabled(pseudoClass,enabled) {var pseudoClasses=this._enabledPseudoClasses;if(enabled){if(pseudoClasses.includes(pseudoClass)) return;pseudoClasses.push(pseudoClass);}else{if(!pseudoClasses.includes(pseudoClass)) return;pseudoClasses.remove(pseudoClass);} function changed(error) {if(!error) this.dispatchEventToListeners(WebInspector.DOMNode.Event.EnabledPseudoClassesChanged);} CSSAgent.forcePseudoState(this.id,pseudoClasses,changed.bind(this));} _makeUndoableCallback(callback) {return function(error) {if(!error) DOMAgent.markUndoableState();if(callback) callback.apply(null,arguments);};}};WebInspector.DOMNode.Event={EnabledPseudoClassesChanged:"dom-node-enabled-pseudo-classes-did-change",AttributeModified:"dom-node-attribute-modified",AttributeRemoved:"dom-node-attribute-removed"};WebInspector.DOMNode.PseudoElementType={Before:"before",After:"after",};WebInspector.DOMNode.ShadowRootType={UserAgent:"user-agent",Closed:"closed",Open:"open",};WebInspector.DOMNode.CustomElementState={Builtin:"builtin",Custom:"custom",Waiting:"waiting",Failed:"failed",};WebInspector.DOMNodeStyles=class DOMNodeStyles extends WebInspector.Object {constructor(node) {super();this._node=node||null;this._rulesMap={};this._styleDeclarationsMap={};this._matchedRules=[];this._inheritedRules=[];this._pseudoElements={};this._inlineStyle=null;this._attributesStyle=null;this._computedStyle=null;this._orderedStyles=[];this._propertyNameToEffectivePropertyMap={};this._pendingRefreshTask=null;this.refresh();} get node() {return this._node;} get needsRefresh() {return this._pendingRefreshTask||this._needsRefresh;} refreshIfNeeded() {if(!this._needsRefresh) return;this.refresh();} refresh() {if(this._pendingRefreshTask) return this._pendingRefreshTask;this._needsRefresh=false;let fetchedMatchedStylesPromise=new WebInspector.WrappedPromise;let fetchedInlineStylesPromise=new WebInspector.WrappedPromise;let fetchedComputedStylesPromise=new WebInspector.WrappedPromise;function wrap(func,promise){return(...args)=>{try{func.apply(this,args);}catch(e){console.error(e);promise.resolve();}};} function parseRuleMatchArrayPayload(matchArray,node,inherited) {var result=[];var ruleOccurrences={};for(var i=matchArray.length-1;i>=0;--i){var rule=this._parseRulePayload(matchArray[i].rule,matchArray[i].matchingSelectors,node,inherited,ruleOccurrences);if(!rule) continue;result.push(rule);} return result;} function fetchedMatchedStyles(error,matchedRulesPayload,pseudoElementRulesPayload,inheritedRulesPayload) {matchedRulesPayload=matchedRulesPayload||[];pseudoElementRulesPayload=pseudoElementRulesPayload||[];inheritedRulesPayload=inheritedRulesPayload||[];this._previousRulesMap=this._rulesMap;this._previousStyleDeclarationsMap=this._styleDeclarationsMap;this._rulesMap={};this._styleDeclarationsMap={};this._matchedRules=parseRuleMatchArrayPayload.call(this,matchedRulesPayload,this._node);this._pseudoElements={};for(var pseudoElementRulePayload of pseudoElementRulesPayload){var pseudoElementRules=parseRuleMatchArrayPayload.call(this,pseudoElementRulePayload.matches,this._node);this._pseudoElements[pseudoElementRulePayload.pseudoId]={matchedRules:pseudoElementRules};} this._inheritedRules=[];var i=0;var currentNode=this._node.parentNode;while(currentNode&&i{this._pendingRefreshTask=null;});return this._pendingRefreshTask;} addRule(selector,text,styleSheetId) {selector=selector||this._node.appropriateSelectorFor(true);function completed() {DOMAgent.markUndoableState();this.refresh();} function styleChanged(error,stylePayload) {if(error) return;completed.call(this);} function addedRule(error,rulePayload) {if(error) return;if(!text||!text.length){completed.call(this);return;} CSSAgent.setStyleText(rulePayload.style.styleId,text,styleChanged.bind(this));} if(!CSSAgent.createStyleSheet){CSSAgent.addRule.invoke({contextNodeId:this._node.id,selector},addedRule.bind(this));return;} function inspectorStyleSheetAvailable(styleSheet) {if(!styleSheet) return;CSSAgent.addRule(styleSheet.id,selector,addedRule.bind(this));} if(styleSheetId) inspectorStyleSheetAvailable.call(this,WebInspector.cssStyleManager.styleSheetForIdentifier(styleSheetId));else WebInspector.cssStyleManager.preferredInspectorStyleSheetForFrame(this._node.frame,inspectorStyleSheetAvailable.bind(this));} rulesForSelector(selector) {selector=selector||this._node.appropriateSelectorFor(true);function ruleHasSelector(rule){return!rule.mediaList.length&&rule.selectorText===selector;} let rules=this._matchedRules.filter(ruleHasSelector);for(let id in this._pseudoElements) rules=rules.concat(this._pseudoElements[id].matchedRules.filter(ruleHasSelector));return rules;} get matchedRules() {return this._matchedRules;} get inheritedRules() {return this._inheritedRules;} get inlineStyle() {return this._inlineStyle;} get attributesStyle() {return this._attributesStyle;} get pseudoElements() {return this._pseudoElements;} get computedStyle() {return this._computedStyle;} get orderedStyles() {return this._orderedStyles;} effectivePropertyForName(name) {let property=this._propertyNameToEffectivePropertyMap[name];if(property) return property;let canonicalName=WebInspector.cssStyleManager.canonicalNameForPropertyName(name);return this._propertyNameToEffectivePropertyMap[canonicalName]||null;} mediaQueryResultDidChange() {this._markAsNeedsRefresh();} pseudoClassesDidChange(node) {this._includeUserAgentRulesOnNextRefresh=true;this._markAsNeedsRefresh();} attributeDidChange(node,attributeName) {this._markAsNeedsRefresh();} changeRule(rule,selector,text) {if(!rule) return;selector=selector||"";function changeCompleted() {DOMAgent.markUndoableState();this.refresh();} function styleChanged(error,stylePayload) {if(error) return;changeCompleted.call(this);} function changeText(styleId) {if(!text||!text.length){changeCompleted.call(this);return;} CSSAgent.setStyleText(styleId,text,styleChanged.bind(this));} function ruleSelectorChanged(error,rulePayload) {if(error) return;changeText.call(this,rulePayload.style.styleId);} this._needsRefresh=true;this._ignoreNextContentDidChangeForStyleSheet=rule.ownerStyleSheet;CSSAgent.setRuleSelector(rule.id,selector,ruleSelectorChanged.bind(this));} changeRuleSelector(rule,selector) {selector=selector||"";let result=new WebInspector.WrappedPromise;function ruleSelectorChanged(error,rulePayload) {if(error){result.reject(error);return;} DOMAgent.markUndoableState(); this.refresh().then(()=>{result.resolve(rulePayload);});} this._needsRefresh=true;this._ignoreNextContentDidChangeForStyleSheet=rule.ownerStyleSheet;CSSAgent.setRuleSelector(rule.id,selector,ruleSelectorChanged.bind(this));return result.promise;} changeStyleText(style,text) {if(!style.ownerStyleSheet||!style.styleSheetTextRange) return;text=text||"";function styleChanged(error,stylePayload) {if(error) return;this.refresh();} CSSAgent.setStyleText(style.id,text,styleChanged.bind(this));} _createSourceCodeLocation(sourceURL,sourceLine,sourceColumn) {if(!sourceURL) return null;var sourceCode;if(this._node.ownerDocument){var mainResource=WebInspector.frameResourceManager.resourceForURL(this._node.ownerDocument.documentURL);if(mainResource){var parentFrame=mainResource.parentFrame;sourceCode=parentFrame.resourceForURL(sourceURL);}} if(!sourceCode) sourceCode=WebInspector.frameResourceManager.resourceForURL(sourceURL);if(!sourceCode) return null;return sourceCode.createSourceCodeLocation(sourceLine||0,sourceColumn||0);} _parseSourceRangePayload(payload) {if(!payload) return null;return new WebInspector.TextRange(payload.startLine,payload.startColumn,payload.endLine,payload.endColumn);} _parseStylePropertyPayload(payload,index,styleDeclaration,styleText) {var text=payload.text||"";var name=payload.name;var value=(payload.value||"").replace(/\s*!important\s*$/,"");var priority=payload.priority||"";var enabled=true;var overridden=false;var implicit=payload.implicit||false;var anonymous=false;var valid="parsedOk"in payload?payload.parsedOk:true;switch(payload.status||"style"){case"active":enabled=true;break;case"inactive":overridden=true;enabled=true;break;case"disabled":enabled=false;break;case"style":anonymous=true;break;} var styleSheetTextRange=this._parseSourceRangePayload(payload.range);if(styleDeclaration){var property=isNaN(index)?styleDeclaration.propertyForName(name,true):styleDeclaration.properties[index]; if(property&&property.name===name&&(property.index===index||(isNaN(property.index)&&isNaN(index)))){property.update(text,name,value,priority,enabled,overridden,implicit,anonymous,valid,styleSheetTextRange);return property;} var pendingProperties=styleDeclaration.pendingProperties;for(var i=0;i{return style.properties.some((property)=>property.name===propertyName);});}};WebInspector.DOMNodeStyles.Event={NeedsRefresh:"dom-node-styles-needs-refresh",Refreshed:"dom-node-styles-refreshed"};WebInspector.DOMSearchMatchObject=class DOMSearchMatchObject extends WebInspector.Object {constructor(resource,domNode,title,searchTerm,textRange) {super();this._resource=resource;this._domNode=domNode;this._title=title;this._searchTerm=searchTerm;this._sourceCodeTextRange=resource.createSourceCodeTextRange(textRange);} static titleForDOMNode(domNode) {switch(domNode.nodeType()){case Node.ELEMENT_NODE:var title="<"+domNode.nodeNameInCorrectCase();for(var attribute of domNode.attributes()){title+=" "+attribute.name;if(attribute.value.length) title+="=\""+attribute.value+"\"";} return title+">";case Node.TEXT_NODE:return"\""+domNode.nodeValue()+"\"";case Node.COMMENT_NODE:return"";case Node.DOCUMENT_TYPE_NODE:var title="";case Node.CDATA_SECTION_NODE:return"";case Node.PROCESSING_INSTRUCTION_NODE:var data=domNode.nodeValue();var dataString=data.length?" "+data:"";var title="";return title;default:console.error("Unknown DOM node type: ",domNode.nodeType());return domNode.nodeNameInCorrectCase();}} get resource() {return this._resource;} get domNode() {return this._domNode;} get title() {return this._title;} get className() {if(!this._className) this._className=this._generateClassName();return this._className;} get searchTerm() {return this._searchTerm;} get sourceCodeTextRange() {return this._sourceCodeTextRange;} saveIdentityToCookie(cookie) {cookie[WebInspector.DOMSearchMatchObject.URLCookieKey]=this._resource.url.hash;cookie[WebInspector.DOMSearchMatchObject.TitleKey]=this._title;var textRange=this._sourceCodeTextRange.textRange;cookie[WebInspector.DOMSearchMatchObject.TextRangeKey]=[textRange.startLine,textRange.startColumn,textRange.endLine,textRange.endColumn].join();} _generateClassName() {switch(this._domNode.nodeType()){case Node.ELEMENT_NODE:return WebInspector.DOMSearchMatchObject.DOMMatchElementIconStyleClassName;case Node.TEXT_NODE:return WebInspector.DOMSearchMatchObject.DOMMatchTextNodeIconStyleClassName;case Node.COMMENT_NODE:return WebInspector.DOMSearchMatchObject.DOMMatchCommentIconStyleClassName;case Node.DOCUMENT_TYPE_NODE:return WebInspector.DOMSearchMatchObject.DOMMatchDocumentTypeIconStyleClassName;case Node.CDATA_SECTION_NODE:return WebInspector.DOMSearchMatchObject.DOMMatchCharacterDataIconStyleClassName;case Node.PROCESSING_INSTRUCTION_NODE: return WebInspector.DOMSearchMatchObject.DOMMatchDocumentTypeIconStyleClassName;default:console.error("Unknown DOM node type: ",this._domNode.nodeType());return WebInspector.DOMSearchMatchObject.DOMMatchNodeIconStyleClassName;}}};WebInspector.DOMSearchMatchObject.DOMMatchElementIconStyleClassName="dom-match-element-icon";WebInspector.DOMSearchMatchObject.DOMMatchTextNodeIconStyleClassName="dom-match-text-node-icon";WebInspector.DOMSearchMatchObject.DOMMatchCommentIconStyleClassName="dom-match-comment-icon";WebInspector.DOMSearchMatchObject.DOMMatchDocumentTypeIconStyleClassName="dom-match-document-type-icon";WebInspector.DOMSearchMatchObject.DOMMatchCharacterDataIconStyleClassName="dom-match-character-data-icon";WebInspector.DOMSearchMatchObject.DOMMatchNodeIconStyleClassName="dom-match-node-icon";WebInspector.DOMSearchMatchObject.TypeIdentifier="dom-search-match-object";WebInspector.DOMSearchMatchObject.URLCookieKey="resource-url";WebInspector.DOMSearchMatchObject.TitleKey="title";WebInspector.DOMSearchMatchObject.TextRangeKey="text-range";WebInspector.DOMStorageObject=class DOMStorageObject extends WebInspector.Object {constructor(id,host,isLocalStorage) {super();this._id=id;this._host=host;this._isLocalStorage=isLocalStorage;this._entries=new Map;} get id(){return this._id;} get host(){return this._host;} get entries(){return this._entries;} saveIdentityToCookie(cookie) {cookie[WebInspector.DOMStorageObject.HostCookieKey]=this.host;cookie[WebInspector.DOMStorageObject.LocalStorageCookieKey]=this.isLocalStorage();} isLocalStorage() {return this._isLocalStorage;} getEntries(callback) {function innerCallback(error,entries) {if(error) return;for(let[key,value]of entries){if(!key||!value) continue;this._entries.set(key,value);} callback(error,entries);} DOMStorageAgent.getDOMStorageItems(this._id,innerCallback.bind(this));} removeItem(key) {DOMStorageAgent.removeDOMStorageItem(this._id,key);} setItem(key,value) {DOMStorageAgent.setDOMStorageItem(this._id,key,value);} itemsCleared() {this._entries.clear();this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemsCleared);} itemRemoved(key) {this._entries.delete(key);this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemRemoved,{key});} itemAdded(key,value) {this._entries.set(key,value);this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemAdded,{key,value});} itemUpdated(key,oldValue,value) {this._entries.set(key,value);this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemUpdated,{key,oldValue,value});}};WebInspector.DOMStorageObject.TypeIdentifier="dom-storage";WebInspector.DOMStorageObject.HostCookieKey="dom-storage-object-host";WebInspector.DOMStorageObject.LocalStorageCookieKey="dom-storage-object-local-storage";WebInspector.DOMStorageObject.Event={ItemsCleared:"dom-storage-object-items-cleared",ItemAdded:"dom-storage-object-item-added",ItemRemoved:"dom-storage-object-item-removed",ItemUpdated:"dom-storage-object-updated",};WebInspector.DOMTree=class DOMTree extends WebInspector.Object {constructor(frame) {super();this._frame=frame;this._rootDOMNode=null;this._requestIdentifier=0;this._contentFlowCollection=new WebInspector.Collection(WebInspector.Collection.TypeVerifier.ContentFlow);this._frame.addEventListener(WebInspector.Frame.Event.PageExecutionContextChanged,this._framePageExecutionContextChanged,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.DocumentUpdated,this._documentUpdated,this);if(!this._frame.isMainFrame()){WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeRemoved,this._nodeRemoved,this);this._frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._frameMainResourceDidChange,this);} WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowListWasUpdated,this._contentFlowListWasUpdated,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowWasAdded,this._contentFlowWasAdded,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowWasRemoved,this._contentFlowWasRemoved,this);} get frame(){return this._frame;} get contentFlowCollection(){return this._contentFlowCollection;} disconnect() {WebInspector.domTreeManager.removeEventListener(null,null,this);this._frame.removeEventListener(null,null,this);} invalidate() {this._rootDOMNode=null; this._pendingRootDOMNodeRequests=null;if(this._invalidateTimeoutIdentifier) return;function performInvalidate() {this._invalidateTimeoutIdentifier=undefined;this.dispatchEventToListeners(WebInspector.DOMTree.Event.RootDOMNodeInvalidated);} this._invalidateTimeoutIdentifier=setTimeout(performInvalidate.bind(this),0);} requestRootDOMNode(callback) {if(typeof callback!=="function") return;if(this._rootDOMNode){callback(this._rootDOMNode);return;} if(!this._frame.isMainFrame()&&!this._frame.pageExecutionContext){this._rootDOMNodeRequestWaitingForExecutionContext=true;if(!this._pendingRootDOMNodeRequests) this._pendingRootDOMNodeRequests=[];this._pendingRootDOMNodeRequests.push(callback);return;} if(this._pendingRootDOMNodeRequests){this._pendingRootDOMNodeRequests.push(callback);return;} this._pendingRootDOMNodeRequests=[callback];this._requestRootDOMNode();} requestContentFlowList() {this.requestRootDOMNode(function(rootNode){WebInspector.domTreeManager.getNamedFlowCollection(rootNode.id);});} _requestRootDOMNode() {var requestIdentifier=++this._requestIdentifier;function rootObjectAvailable(error,result) {if(!this._pendingRootDOMNodeRequests||requestIdentifier!==this._requestIdentifier) return;if(error){console.error(JSON.stringify(error));this._rootDOMNode=null;dispatchCallbacks.call(this);return;} var remoteObject=WebInspector.RemoteObject.fromPayload(result);remoteObject.pushNodeToFrontend(rootDOMNodeAvailable.bind(this,remoteObject));} function rootDOMNodeAvailable(remoteObject,nodeId) {remoteObject.release();if(!this._pendingRootDOMNodeRequests||requestIdentifier!==this._requestIdentifier) return;if(!nodeId){this._rootDOMNode=null;dispatchCallbacks.call(this);return;} this._rootDOMNode=WebInspector.domTreeManager.nodeForId(nodeId);if(!this._rootDOMNode){dispatchCallbacks.call(this);return;} this._rootDOMNode.getChildNodes(dispatchCallbacks.bind(this));} function mainDocumentAvailable(document) {this._rootDOMNode=document;dispatchCallbacks.call(this);} function dispatchCallbacks() {if(!this._pendingRootDOMNodeRequests||requestIdentifier!==this._requestIdentifier) return;for(var i=0;i=1000) timeIntervalDelay=100;else if(duration>=60000) timeIntervalDelay=1000;else if(duration>=3600000) timeIntervalDelay=10000;if(timeIntervalDelay!==this._timeIntervalDelay){this._timeIntervalDelay=timeIntervalDelay;clearInterval(this._timeIntervalIdentifier);this._timeIntervalIdentifier=setInterval(this._updateTime.bind(this),this._timeIntervalDelay);} var mainFrame=WebInspector.frameResourceManager.mainFrame;var mainFrameStartTime=mainFrame.mainResource.firstTimestamp;var mainFrameLoadEventTime=mainFrame.loadEventTimestamp;if(isNaN(mainFrameStartTime)||isNaN(mainFrameLoadEventTime)){this.time=duration/1000;return;} this.time=mainFrameLoadEventTime-mainFrameStartTime;this._stopUpdatingTime();} _consoleMessageAdded(event) {var message=event.data.message;this._lastConsoleMessageType=message.level;this._incrementConsoleMessageType(message.level,message.repeatCount);} _consoleMessageWasRepeated(event) {this._incrementConsoleMessageType(this._lastConsoleMessageType,1);} _incrementConsoleMessageType(type,increment) {switch(type){case WebInspector.ConsoleMessage.MessageLevel.Log:case WebInspector.ConsoleMessage.MessageLevel.Info:case WebInspector.ConsoleMessage.MessageLevel.Debug:this.logs+=increment;break;case WebInspector.ConsoleMessage.MessageLevel.Warning:this.issues+=increment;break;case WebInspector.ConsoleMessage.MessageLevel.Error:this.errors+=increment;break;}} _consoleWasCleared(event) {this._logs=0;this._issues=0;this._errors=0;this._dataDidChange();}};WebInspector.DefaultDashboard.Event={DataDidChange:"default-dashboard-data-did-change"};WebInspector.ExecutionContext=class ExecutionContext extends WebInspector.Object {constructor(target,id,name,isPageContext,frame) {super();this._target=target;this._id=id;this._name=name;this._isPageContext=isPageContext||false;this._frame=frame||null;} get target(){return this._target;} get id(){return this._id;} get name(){return this._name;} get isPageContext(){return this._isPageContext;} get frame(){return this._frame;}};WebInspector.ExecutionContextList=class ExecutionContextList extends WebInspector.Object {constructor() {super();this._contexts=[];this._pageExecutionContext=null;} get pageExecutionContext() {return this._pageExecutionContext;} get contexts() {return this._contexts;} add(context) {if(context.isPageContext&&this._pageExecutionContext){return false;} this._contexts.push(context);if(context.isPageContext){this._pageExecutionContext=context;return true;} return false;} clear() {this._contexts=[];this._pageExecutionContext=null;}};WebInspector.FPSInstrument=class FPSInstrument extends WebInspector.Instrument {constructor() {super();} static supported() {return window.TimelineAgent&&TimelineAgent.EventType.RenderingFrame;} get timelineRecordType() {return WebInspector.TimelineRecord.Type.RenderingFrame;}};WebInspector.Frame=class Frame extends WebInspector.Object {constructor(id,name,securityOrigin,loaderIdentifier,mainResource) {super();this._id=id;this._name=null;this._securityOrigin=null;this._resourceCollection=new WebInspector.ResourceCollection;this._provisionalResourceCollection=new WebInspector.ResourceCollection;this._extraScriptCollection=new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Script);this._canvasCollection=new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Canvas);this._childFrameCollection=new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Frame);this._childFrameIdentifierMap=new Map;this._parentFrame=null;this._isMainFrame=false;this._domContentReadyEventTimestamp=NaN;this._loadEventTimestamp=NaN;this._executionContextList=new WebInspector.ExecutionContextList;this.initialize(name,securityOrigin,loaderIdentifier,mainResource);} get resourceCollection(){return this._resourceCollection;} get extraScriptCollection(){return this._extraScriptCollection;} get canvasCollection(){return this._canvasCollection;} get childFrameCollection(){return this._childFrameCollection;} initialize(name,securityOrigin,loaderIdentifier,mainResource) {var oldName=this._name;var oldSecurityOrigin=this._securityOrigin;var oldMainResource=this._mainResource;this._name=name||null;this._securityOrigin=securityOrigin||null;this._loaderIdentifier=loaderIdentifier||null;this._mainResource=mainResource;this._mainResource._parentFrame=this;if(oldMainResource&&this._mainResource!==oldMainResource) this._disassociateWithResource(oldMainResource);this.removeAllResources();this.removeAllChildFrames();this.clearExecutionContexts();this.clearProvisionalLoad();if(this._mainResource!==oldMainResource) this._dispatchMainResourceDidChangeEvent(oldMainResource);if(this._securityOrigin!==oldSecurityOrigin) this.dispatchEventToListeners(WebInspector.Frame.Event.SecurityOriginDidChange,{oldSecurityOrigin});if(this._name!==oldName) this.dispatchEventToListeners(WebInspector.Frame.Event.NameDidChange,{oldName});} startProvisionalLoad(provisionalMainResource) {this._provisionalMainResource=provisionalMainResource;this._provisionalMainResource._parentFrame=this;this._provisionalLoaderIdentifier=provisionalMainResource.loaderIdentifier;this._provisionalResourceCollection.clear();this.dispatchEventToListeners(WebInspector.Frame.Event.ProvisionalLoadStarted);} commitProvisionalLoad(securityOrigin) {if(!this._provisionalLoaderIdentifier) return;var oldSecurityOrigin=this._securityOrigin;var oldMainResource=this._mainResource;this._securityOrigin=securityOrigin||null;this._loaderIdentifier=this._provisionalLoaderIdentifier;this._mainResource=this._provisionalMainResource;this._domContentReadyEventTimestamp=NaN;this._loadEventTimestamp=NaN;if(oldMainResource&&this._mainResource!==oldMainResource) this._disassociateWithResource(oldMainResource);this.removeAllResources();this._resourceCollection=this._provisionalResourceCollection;this._provisionalResourceCollection=new WebInspector.ResourceCollection;this._extraScriptCollection.clear();this._canvasCollection.clear();this.clearExecutionContexts(true);this.clearProvisionalLoad(true);this.removeAllChildFrames();this.dispatchEventToListeners(WebInspector.Frame.Event.ProvisionalLoadCommitted);if(this._mainResource!==oldMainResource) this._dispatchMainResourceDidChangeEvent(oldMainResource);if(this._securityOrigin!==oldSecurityOrigin) this.dispatchEventToListeners(WebInspector.Frame.Event.SecurityOriginDidChange,{oldSecurityOrigin});} clearProvisionalLoad(skipProvisionalLoadClearedEvent) {if(!this._provisionalLoaderIdentifier) return;this._provisionalLoaderIdentifier=null;this._provisionalMainResource=null;this._provisionalResourceCollection.clear();if(!skipProvisionalLoadClearedEvent) this.dispatchEventToListeners(WebInspector.Frame.Event.ProvisionalLoadCleared);} get id() {return this._id;} get loaderIdentifier() {return this._loaderIdentifier;} get provisionalLoaderIdentifier() {return this._provisionalLoaderIdentifier;} get name() {return this._name;} get securityOrigin() {return this._securityOrigin;} get url() {return this._mainResource._url;} get domTree() {if(!this._domTree) this._domTree=new WebInspector.DOMTree(this);return this._domTree;} get pageExecutionContext() {return this._executionContextList.pageExecutionContext;} get executionContextList() {return this._executionContextList;} clearExecutionContexts(committingProvisionalLoad) {if(this._executionContextList.contexts.length){let contexts=this._executionContextList.contexts.slice();this._executionContextList.clear();this.dispatchEventToListeners(WebInspector.Frame.Event.ExecutionContextsCleared,{committingProvisionalLoad:!!committingProvisionalLoad,contexts});}} addExecutionContext(context) {var changedPageContext=this._executionContextList.add(context);if(changedPageContext) this.dispatchEventToListeners(WebInspector.Frame.Event.PageExecutionContextChanged);} get mainResource() {return this._mainResource;} get provisionalMainResource() {return this._provisionalMainResource;} get parentFrame() {return this._parentFrame;} get domContentReadyEventTimestamp() {return this._domContentReadyEventTimestamp;} get loadEventTimestamp() {return this._loadEventTimestamp;} isMainFrame() {return this._isMainFrame;} markAsMainFrame() {this._isMainFrame=true;} unmarkAsMainFrame() {this._isMainFrame=false;} markDOMContentReadyEvent(timestamp) {this._domContentReadyEventTimestamp=timestamp||NaN;} markLoadEvent(timestamp) {this._loadEventTimestamp=timestamp||NaN;} isDetached() {var frame=this;while(frame){if(frame.isMainFrame()) return false;frame=frame.parentFrame;} return true;} childFrameForIdentifier(frameId) {return this._childFrameIdentifierMap.get(frameId)||null;} addChildFrame(frame) {if(!(frame instanceof WebInspector.Frame)) return;if(frame._parentFrame===this) return;if(frame._parentFrame) frame._parentFrame.removeChildFrame(frame);this._childFrameCollection.add(frame);this._childFrameIdentifierMap.set(frame._id,frame);frame._parentFrame=this;this.dispatchEventToListeners(WebInspector.Frame.Event.ChildFrameWasAdded,{childFrame:frame});} removeChildFrame(frameOrFrameId) {let childFrameId=frameOrFrameId;if(childFrameId instanceof WebInspector.Frame) childFrameId=frameOrFrameId._id; let childFrame=this.childFrameForIdentifier(childFrameId);if(!(childFrame instanceof WebInspector.Frame)) return;this._childFrameCollection.remove(childFrame);this._childFrameIdentifierMap.delete(childFrame._id);childFrame._detachFromParentFrame();this.dispatchEventToListeners(WebInspector.Frame.Event.ChildFrameWasRemoved,{childFrame});} removeAllChildFrames() {this._detachFromParentFrame();for(let childFrame of this._childFrameCollection.items) childFrame.removeAllChildFrames();this._childFrameCollection.clear();this._childFrameIdentifierMap.clear();this.dispatchEventToListeners(WebInspector.Frame.Event.AllChildFramesRemoved);} resourceForURL(url,recursivelySearchChildFrames) {var resource=this._resourceCollection.resourceForURL(url);if(resource) return resource;for(let childFrame of this._childFrameCollection.items){resource=childFrame.mainResource;if(resource.url===url) return resource;} if(!recursivelySearchChildFrames) return null;for(let childFrame of this._childFrameCollection.items){resource=childFrame.resourceForURL(url,true);if(resource) return resource;} return null;} resourceCollectionForType(type) {return this._resourceCollection.resourceCollectionForType(type);} addResource(resource) {if(!(resource instanceof WebInspector.Resource)) return;if(resource.parentFrame===this) return;if(resource.parentFrame) resource.parentFrame.remove(resource);this._associateWithResource(resource);if(this._isProvisionalResource(resource)){this._provisionalResourceCollection.add(resource);this.dispatchEventToListeners(WebInspector.Frame.Event.ProvisionalResourceWasAdded,{resource});}else{this._resourceCollection.add(resource);this.dispatchEventToListeners(WebInspector.Frame.Event.ResourceWasAdded,{resource});}} removeResource(resource) {this._resourceCollection.remove(resource);this._disassociateWithResource(resource);this.dispatchEventToListeners(WebInspector.Frame.Event.ResourceWasRemoved,{resource});} removeAllResources() {let resources=this._resourceCollection.items;if(!resources.size) return;for(let resource of resources) this._disassociateWithResource(resource);this._resourceCollection.clear();this.dispatchEventToListeners(WebInspector.Frame.Event.AllResourcesRemoved);} addExtraScript(script) {this._extraScriptCollection.add(script);this.dispatchEventToListeners(WebInspector.Frame.Event.ExtraScriptAdded,{script});} saveIdentityToCookie(cookie) {cookie[WebInspector.Frame.MainResourceURLCookieKey]=this.mainResource.url.hash;cookie[WebInspector.Frame.IsMainFrameCookieKey]=this._isMainFrame;} _detachFromParentFrame() {if(this._domTree){this._domTree.disconnect();this._domTree=null;} this._parentFrame=null;} _isProvisionalResource(resource) {return resource.loaderIdentifier&&this._provisionalLoaderIdentifier&&resource.loaderIdentifier===this._provisionalLoaderIdentifier;} _associateWithResource(resource) {if(resource._parentFrame) return;resource._parentFrame=this;} _disassociateWithResource(resource) {if(resource.parentFrame!==this) return;resource._parentFrame=null;} _dispatchMainResourceDidChangeEvent(oldMainResource) {this.dispatchEventToListeners(WebInspector.Frame.Event.MainResourceDidChange,{oldMainResource});}};WebInspector.Frame.Event={NameDidChange:"frame-name-did-change",SecurityOriginDidChange:"frame-security-origin-did-change",MainResourceDidChange:"frame-main-resource-did-change",ProvisionalLoadStarted:"frame-provisional-load-started",ProvisionalLoadCommitted:"frame-provisional-load-committed",ProvisionalLoadCleared:"frame-provisional-load-cleared",ProvisionalResourceWasAdded:"frame-provisional-resource-was-added",ResourceWasAdded:"frame-resource-was-added",ResourceWasRemoved:"frame-resource-was-removed",AllResourcesRemoved:"frame-all-resources-removed",ExtraScriptAdded:"frame-extra-script-added",ChildFrameWasAdded:"frame-child-frame-was-added",ChildFrameWasRemoved:"frame-child-frame-was-removed",AllChildFramesRemoved:"frame-all-child-frames-removed",PageExecutionContextChanged:"frame-page-execution-context-changed",ExecutionContextsCleared:"frame-execution-contexts-cleared"};WebInspector.Frame.TypeIdentifier="Frame";WebInspector.Frame.MainResourceURLCookieKey="frame-main-resource-url";WebInspector.Frame.IsMainFrameCookieKey="frame-is-main-frame";WebInspector.GarbageCollection=class GarbageCollection extends WebInspector.Object {constructor(type,startTime,endTime) {super();this._type=type;this._startTime=startTime;this._endTime=endTime;} static fromPayload(payload) {let type=WebInspector.GarbageCollection.Type.Full;if(payload.type===HeapAgent.GarbageCollectionType.Partial) type=WebInspector.GarbageCollection.Type.Partial;return new WebInspector.GarbageCollection(type,payload.startTime,payload.endTime);} get type(){return this._type;} get startTime(){return this._startTime;} get endTime(){return this._endTime;} get duration() {return this._endTime-this._startTime;}};WebInspector.GarbageCollection.Type={Partial:Symbol("Partial"),Full:Symbol("Full")};WebInspector.Point=class Point {constructor(x,y) {this.x=x||0;this.y=y||0;} static fromEvent(event) {return new WebInspector.Point(event.pageX,event.pageY);} static fromEventInElement(event,element) {var wkPoint=window.webkitConvertPointFromPageToNode(element,new WebKitPoint(event.pageX,event.pageY));return new WebInspector.Point(wkPoint.x,wkPoint.y);} toString() {return"WebInspector.Point["+this.x+","+this.y+"]";} copy() {return new WebInspector.Point(this.x,this.y);} equals(anotherPoint) {return this.x===anotherPoint.x&&this.y===anotherPoint.y;} distance(anotherPoint) {var dx=anotherPoint.x-this.x;var dy=anotherPoint.y-this.y;return Math.sqrt(dx*dx,dy*dy);}};WebInspector.Size=class Size {constructor(width,height) {this.width=width||0;this.height=height||0;} toString() {return"WebInspector.Size["+this.width+","+this.height+"]";} copy() {return new WebInspector.Size(this.width,this.height);} equals(anotherSize) {return this.width===anotherSize.width&&this.height===anotherSize.height;}};WebInspector.Size.ZERO_SIZE=new WebInspector.Size(0,0);WebInspector.Rect=class Rect {constructor(x,y,width,height) {this.origin=new WebInspector.Point(x||0,y||0);this.size=new WebInspector.Size(width||0,height||0);} static rectFromClientRect(clientRect) {return new WebInspector.Rect(clientRect.left,clientRect.top,clientRect.width,clientRect.height);} static unionOfRects(rects) {var union=rects[0];for(var i=1;ix2) return WebInspector.Rect.ZERO_RECT;var intersection=new WebInspector.Rect;intersection.origin.x=x1;intersection.size.width=x2-x1;var y1=Math.max(this.minY(),rect.minY());var y2=Math.min(this.maxY(),rect.maxY());if(y1>y2) return WebInspector.Rect.ZERO_RECT;intersection.origin.y=y1;intersection.size.height=y2-y1;return intersection;} unionWithRect(rect) {var x=Math.min(this.minX(),rect.minX());var y=Math.min(this.minY(),rect.minY());var width=Math.max(this.maxX(),rect.maxX())-x;var height=Math.max(this.maxY(),rect.maxY())-y;return new WebInspector.Rect(x,y,width,height);} round() {return new WebInspector.Rect(Math.floor(this.origin.x),Math.floor(this.origin.y),Math.ceil(this.size.width),Math.ceil(this.size.height));}};WebInspector.Rect.ZERO_RECT=new WebInspector.Rect(0,0,0,0);WebInspector.EdgeInsets=class EdgeInsets {constructor(top,right,bottom,left) {if(arguments.length===1){this.top=top;this.right=top;this.bottom=top;this.left=top;}else if(arguments.length===4){this.top=top;this.right=right;this.bottom=bottom;this.left=left;}} equals(anotherInset) {return this.top===anotherInset.top&&this.right===anotherInset.right&&this.bottom===anotherInset.bottom&&this.left===anotherInset.left;} copy() {return new WebInspector.EdgeInsets(this.top,this.right,this.bottom,this.left);}};WebInspector.RectEdge={MIN_X:0,MIN_Y:1,MAX_X:2,MAX_Y:3};WebInspector.Quad=class Quad {constructor(quad) {this.points=[new WebInspector.Point(quad[0],quad[1]), new WebInspector.Point(quad[2],quad[3]), new WebInspector.Point(quad[4],quad[5]), new WebInspector.Point(quad[6],quad[7]) ];this.width=Math.round(Math.sqrt(Math.pow(quad[0]-quad[2],2)+Math.pow(quad[1]-quad[3],2)));this.height=Math.round(Math.sqrt(Math.pow(quad[0]-quad[6],2)+Math.pow(quad[1]-quad[7],2)));} toProtocol() {return[this.points[0].x,this.points[0].y,this.points[1].x,this.points[1].y,this.points[2].x,this.points[2].y,this.points[3].x,this.points[3].y];}};WebInspector.Polygon=class Polygon {constructor(points) {this.points=points;} bounds() {var minX=Number.MAX_VALUE;var minY=Number.MAX_VALUE;var maxX=-Number.MAX_VALUE;var maxY=-Number.MAX_VALUE;for(var point of this.points){minX=Math.min(minX,point.x);maxX=Math.max(maxX,point.x);minY=Math.min(minY,point.y);maxY=Math.max(maxY,point.y);} return new WebInspector.Rect(minX,minY,maxX-minX,maxY-minY);}};WebInspector.CubicBezier=class CubicBezier {constructor(x1,y1,x2,y2) {this._inPoint=new WebInspector.Point(x1,y1);this._outPoint=new WebInspector.Point(x2,y2);this._curveInfo={x:{c:3.0*x1},y:{c:3.0*y1}};this._curveInfo.x.b=3.0*(x2-x1)-this._curveInfo.x.c;this._curveInfo.x.a=1.0-this._curveInfo.x.c-this._curveInfo.x.b;this._curveInfo.y.b=3.0*(y2-y1)-this._curveInfo.y.c;this._curveInfo.y.a=1.0-this._curveInfo.y.c-this._curveInfo.y.b;} static fromCoordinates(coordinates) {if(!coordinates||coordinates.length<4) return null;coordinates=coordinates.map(Number);if(coordinates.includes(NaN)) return null;return new WebInspector.CubicBezier(coordinates[0],coordinates[1],coordinates[2],coordinates[3]);} static fromString(text) {if(!text||!text.length) return null;var trimmedText=text.toLowerCase().replace(/\s/g,"");if(!trimmedText.length) return null;if(Object.keys(WebInspector.CubicBezier.keywordValues).includes(trimmedText)) return WebInspector.CubicBezier.fromCoordinates(WebInspector.CubicBezier.keywordValues[trimmedText]);var matches=trimmedText.match(/^cubic-bezier\(([-\d.]+),([-\d.]+),([-\d.]+),([-\d.]+)\)$/);if(!matches) return null;matches.splice(0,1);return WebInspector.CubicBezier.fromCoordinates(matches);} get inPoint() {return this._inPoint;} get outPoint() {return this._outPoint;} copy() {return new WebInspector.CubicBezier(this._inPoint.x,this._inPoint.y,this._outPoint.x,this._outPoint.y);} toString() {var values=[this._inPoint.x,this._inPoint.y,this._outPoint.x,this._outPoint.y];for(var key in WebInspector.CubicBezier.keywordValues){if(Array.shallowEqual(WebInspector.CubicBezier.keywordValues[key],values)) return key;} return"cubic-bezier("+values.join(", ")+")";} solve(x,epsilon) {return this._sampleCurveY(this._solveCurveX(x,epsilon));} _sampleCurveX(t) {return((this._curveInfo.x.a*t+this._curveInfo.x.b)*t+this._curveInfo.x.c)*t;} _sampleCurveY(t) {return((this._curveInfo.y.a*t+this._curveInfo.y.b)*t+this._curveInfo.y.c)*t;} _sampleCurveDerivativeX(t) {return(3.0*this._curveInfo.x.a*t+2.0*this._curveInfo.x.b)*t+this._curveInfo.x.c;} _solveCurveX(x,epsilon) {var t0,t1,t2,x2,d2,i;for(t2=x,i=0;i<8;i++){x2=this._sampleCurveX(t2)-x;if(Math.abs(x2)t1) return t1;while(t0x2) t0=t2;else t1=t2;t2=(t1-t0)*0.5+t0;} return t2;}};WebInspector.CubicBezier.keywordValues={"ease":[0.25,0.1,0.25,1],"ease-in":[0.42,0,1,1],"ease-out":[0,0,0.58,1],"ease-in-out":[0.42,0,0.58,1],"linear":[0,0,1,1]};WebInspector.Spring=class Spring {constructor(mass,stiffness,damping,initialVelocity) {this.mass=Math.max(1,mass);this.stiffness=Math.max(1,stiffness);this.damping=Math.max(0,damping);this.initialVelocity=initialVelocity;} static fromValues(values) {if(!values||values.length<4) return null;values=values.map(Number);if(values.includes(NaN)) return null;return new WebInspector.Spring(...values);} static fromString(text) {if(!text||!text.length) return null;let trimmedText=text.toLowerCase().trim();if(!trimmedText.length) return null;let matches=trimmedText.match(/^spring\(([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([-\d.]+)\)$/);if(!matches) return null;return WebInspector.Spring.fromValues(matches.slice(1));} copy() {return new WebInspector.Spring(this.mass,this.stiffness,this.damping,this.initialVelocity);} toString() {return`spring(${this.mass} ${this.stiffness} ${this.damping} ${this.initialVelocity})`;} solve(t) {let w0=Math.sqrt(this.stiffness/this.mass);let zeta=this.damping/(2*Math.sqrt(this.stiffness*this.mass));let wd=0;let A=1;let B=-this.initialVelocity+w0;if(zeta<1){wd=w0*Math.sqrt(1-zeta*zeta);A=1;B=(zeta*w0+-this.initialVelocity)/wd;} if(zeta<1) t=Math.exp(-t*zeta*w0)*(A*Math.cos(wd*t)+B*Math.sin(wd*t));else t=(A+B*t)*Math.exp(-t*w0);return 1-t;} calculateDuration(epsilon) {epsilon=epsilon||0.0001;let t=0;let current=0;let minimum=Number.POSITIVE_INFINITY;while(current>=epsilon||minimum>=epsilon){current=Math.abs(1-this.solve(t)); if(minimum=epsilon) minimum=Number.POSITIVE_INFINITY; else if(current0||(!isComma&&!isSpace)) currentParam+=c;ch++;} if(openParentheses!==-1) return null;var gradient;if(type===WebInspector.Gradient.Types.Linear) gradient=WebInspector.LinearGradient.fromComponents(components);else gradient=WebInspector.RadialGradient.fromComponents(components);if(gradient) gradient.repeats=typeString.startsWith("repeating");return gradient;} static stopsWithComponents(components) {var stops=components.map(function(component){while(component.length){var color=WebInspector.Color.fromString(component.shift());if(!color) continue;var stop={color};if(component.length&&component[0].substr(-1)==="%") stop.offset=parseFloat(component.shift())/100;return stop;}});if(!stops.length) return null;for(var i=0,count=stops.length;i{let snapshot=WebInspector.HeapSnapshotProxy.deserialize(objectId,serializedSnapshot);WebInspector.timelineManager.heapSnapshotAdded(timestamp,snapshot);});});}};WebInspector.HeapAllocationsTimelineRecord=class HeapAllocationsTimelineRecord extends WebInspector.TimelineRecord {constructor(timestamp,heapSnapshot) {super(WebInspector.TimelineRecord.Type.HeapAllocations,timestamp,timestamp);this._timestamp=timestamp;this._heapSnapshot=heapSnapshot;} get timestamp(){return this._timestamp;} get heapSnapshot(){return this._heapSnapshot;}};WebInspector.HeapSnapshotRootPath=class HeapSnapshotRootPath extends WebInspector.Object {constructor(node,pathComponent,parent,isGlobalScope) {super();this._node=node||null;this._parent=parent||null;this._pathComponent=typeof pathComponent==="string"?pathComponent:null;this._isGlobalScope=isGlobalScope||false;if(this._parent&&this._parent.isEmpty()) this._parent=null;} static emptyPath() {return new WebInspector.HeapSnapshotRootPath(null);} static pathComponentForIndividualEdge(edge) {switch(edge.type){case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Internal:return null;case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Index:return"["+edge.data+"]";case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Property:case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Variable:if(WebInspector.HeapSnapshotRootPath.canPropertyNameBeDotAccess(edge.data)) return edge.data;return"["+doubleQuotedString(edge.data)+"]";}} static canPropertyNameBeDotAccess(propertyName) {return/^(?![0-9])\w+$/.test(propertyName);} get node(){return this._node;} get parent(){return this._parent;} get pathComponent(){return this._pathComponent;} get rootNode() {return this._parent?this._parent.rootNode:this._node;} get fullPath() {let components=[];for(let p=this;p&&p.pathComponent;p=p.parent) components.push(p.pathComponent);components.reverse();return components.join("");} isRoot() {return!this._parent;} isEmpty() {return!this._node;} isGlobalScope() {return this._isGlobalScope;} isPathComponentImpossible() {return this._pathComponent&&this._pathComponent.startsWith("@");} isFullPathImpossible() {if(this.isEmpty()) return true;if(this.isPathComponentImpossible()) return true;if(this._parent) return this._parent.isFullPathImpossible();return false;} appendInternal(node) {return new WebInspector.HeapSnapshotRootPath(node,WebInspector.HeapSnapshotRootPath.SpecialPathComponent.InternalPropertyName,this);} appendArrayIndex(node,index) {let component="["+index+"]";return new WebInspector.HeapSnapshotRootPath(node,component,this);} appendPropertyName(node,propertyName) {let component=WebInspector.HeapSnapshotRootPath.canPropertyNameBeDotAccess(propertyName)?"."+propertyName:"["+doubleQuotedString(propertyName)+"]";return new WebInspector.HeapSnapshotRootPath(node,component,this);} appendVariableName(node,variableName) {if(this._isGlobalScope) return this.appendPropertyName(node,variableName);return new WebInspector.HeapSnapshotRootPath(node,variableName,this);} appendGlobalScopeName(node,globalScopeName) {return new WebInspector.HeapSnapshotRootPath(node,globalScopeName,this,true);} appendEdge(edge) {switch(edge.type){case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Internal:return this.appendInternal(edge.to);case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Index:return this.appendArrayIndex(edge.to,edge.data);case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Property:return this.appendPropertyName(edge.to,edge.data);case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Variable:return this.appendVariableName(edge.to,edge.data);} console.error("Unexpected edge type",edge.type);}};WebInspector.HeapSnapshotRootPath.SpecialPathComponent={InternalPropertyName:"@internal",};WebInspector.IndexedDatabase=class IndexedDatabase extends WebInspector.Object {constructor(name,securityOrigin,version,objectStores) {super();this._name=name;this._securityOrigin=securityOrigin;this._host=parseSecurityOrigin(securityOrigin).host;this._version=version;this._objectStores=objectStores||[];for(var objectStore of this._objectStores) objectStore.establishRelationship(this);} get name(){return this._name;} get securityOrigin(){return this._securityOrigin;} get host(){return this._host;} get version(){return this._version;} get objectStores(){return this._objectStores;} saveIdentityToCookie(cookie) {cookie[WebInspector.IndexedDatabase.NameCookieKey]=this._name;cookie[WebInspector.IndexedDatabase.HostCookieKey]=this._host;}};WebInspector.IndexedDatabase.TypeIdentifier="indexed-database";WebInspector.IndexedDatabase.NameCookieKey="indexed-database-name";WebInspector.IndexedDatabase.HostCookieKey="indexed-database-host";WebInspector.IndexedDatabaseObjectStore=class IndexedDatabaseObjectStore extends WebInspector.Object {constructor(name,keyPath,autoIncrement,indexes) {super();this._name=name;this._keyPath=keyPath;this._autoIncrement=autoIncrement||false;this._indexes=indexes||[];this._parentDatabase=null;for(var index of this._indexes) index.establishRelationship(this);} get name(){return this._name;} get keyPath(){return this._keyPath;} get autoIncrement(){return this._autoIncrement;} get parentDatabase(){return this._parentDatabase;} get indexes(){return this._indexes;} saveIdentityToCookie(cookie) {cookie[WebInspector.IndexedDatabaseObjectStore.NameCookieKey]=this._name;cookie[WebInspector.IndexedDatabaseObjectStore.KeyPathCookieKey]=this._keyPath;} establishRelationship(parentDatabase) {this._parentDatabase=parentDatabase||null;}};WebInspector.IndexedDatabaseObjectStore.TypeIdentifier="indexed-database-object-store";WebInspector.IndexedDatabaseObjectStore.NameCookieKey="indexed-database-object-store-name";WebInspector.IndexedDatabaseObjectStore.KeyPathCookieKey="indexed-database-object-store-key-path";WebInspector.IndexedDatabaseObjectStoreIndex=class IndexedDatabaseObjectStoreIndex extends WebInspector.Object {constructor(name,keyPath,unique,multiEntry) {super();this._name=name;this._keyPath=keyPath;this._unique=unique||false;this._multiEntry=multiEntry||false;this._parentObjectStore=null;} get name(){return this._name;} get keyPath(){return this._keyPath;} get unique(){return this._unique;} get multiEntry(){return this._multiEntry;} get parentObjectStore(){return this._parentObjectStore;} saveIdentityToCookie(cookie) {cookie[WebInspector.IndexedDatabaseObjectStoreIndex.NameCookieKey]=this._name;cookie[WebInspector.IndexedDatabaseObjectStoreIndex.KeyPathCookieKey]=this._keyPath;} establishRelationship(parentObjectStore) {this._parentObjectStore=parentObjectStore||null;}};WebInspector.IndexedDatabaseObjectStoreIndex.TypeIdentifier="indexed-database-object-store-index";WebInspector.IndexedDatabaseObjectStoreIndex.NameCookieKey="indexed-database-object-store-index-name";WebInspector.IndexedDatabaseObjectStoreIndex.KeyPathCookieKey="indexed-database-object-store-index-key-path";WebInspector.IssueMessage=class IssueMessage extends WebInspector.Object {constructor(consoleMessage) {super();this._consoleMessage=consoleMessage;this._text=this._issueText();switch(this._consoleMessage.source){case"javascript": var prefixRegex=/^([^:]+): (?:DOM Exception \d+: )?/;var match=prefixRegex.exec(this._text);if(match&&match[1]in WebInspector.IssueMessage.Type._prefixTypeMap){this._type=WebInspector.IssueMessage.Type._prefixTypeMap[match[1]];this._text=this._text.substring(match[0].length);}else this._type=WebInspector.IssueMessage.Type.OtherIssue;break;case"css":case"xml":this._type=WebInspector.IssueMessage.Type.PageIssue;break;case"network":this._type=WebInspector.IssueMessage.Type.NetworkIssue;break;case"security":this._type=WebInspector.IssueMessage.Type.SecurityIssue;break;case"console-api":case"storage":case"appcache":case"rendering":case"other":this._type=WebInspector.IssueMessage.Type.OtherIssue;break;default:console.error("Unknown issue source:",this._consoleMessage.source);this._type=WebInspector.IssueMessage.Type.OtherIssue;} this._sourceCodeLocation=consoleMessage.sourceCodeLocation;if(this._sourceCodeLocation) this._sourceCodeLocation.addEventListener(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged,this._sourceCodeLocationDisplayLocationChanged,this);} static displayName(type) {switch(type){case WebInspector.IssueMessage.Type.SemanticIssue:return WebInspector.UIString("Semantic Issue");case WebInspector.IssueMessage.Type.RangeIssue:return WebInspector.UIString("Range Issue");case WebInspector.IssueMessage.Type.ReferenceIssue:return WebInspector.UIString("Reference Issue");case WebInspector.IssueMessage.Type.TypeIssue:return WebInspector.UIString("Type Issue");case WebInspector.IssueMessage.Type.PageIssue:return WebInspector.UIString("Page Issue");case WebInspector.IssueMessage.Type.NetworkIssue:return WebInspector.UIString("Network Issue");case WebInspector.IssueMessage.Type.SecurityIssue:return WebInspector.UIString("Security Issue");case WebInspector.IssueMessage.Type.OtherIssue:return WebInspector.UIString("Other Issue");default:console.error("Unknown issue message type:",type);return WebInspector.UIString("Other Issue");}} get text(){return this._text;} get type(){return this._type;} get level(){return this._consoleMessage.level;} get source(){return this._consoleMessage.source;} get url(){return this._consoleMessage.url;} get sourceCodeLocation(){return this._sourceCodeLocation;} saveIdentityToCookie(cookie) {cookie[WebInspector.IssueMessage.URLCookieKey]=this.url;cookie[WebInspector.IssueMessage.LineNumberCookieKey]=this._sourceCodeLocation?this._sourceCodeLocation.lineNumber:0;cookie[WebInspector.IssueMessage.ColumnNumberCookieKey]=this._sourceCodeLocation?this._sourceCodeLocation.columnNumber:0;} _issueText() {let parameters=this._consoleMessage.parameters;if(!parameters) return this._consoleMessage.messageText;if(WebInspector.RemoteObject.type(parameters[0])!=="string") return this._consoleMessage.messageText;function valueFormatter(obj) {return obj.description;} let formatters={};formatters.o=valueFormatter;formatters.s=valueFormatter;formatters.f=valueFormatter;formatters.i=valueFormatter;formatters.d=valueFormatter;function append(a,b) {a+=b;return a;} let result=String.format(parameters[0].description,parameters.slice(1),formatters,"",append);let resultText=result.formattedResult;for(let i=0;icall.endTime||rangeEndTime=0) return;this._frameIndex=WebInspector.RenderingFrameTimelineRecord._nextFrameIndex++;} durationForTask(taskType) {if(this._durationByTaskType.has(taskType)) return this._durationByTaskType.get(taskType);var duration;if(taskType===WebInspector.RenderingFrameTimelineRecord.TaskType.Other) duration=this._calculateDurationRemainder();else{duration=this.children.reduce(function(previousValue,currentValue){if(taskType!==WebInspector.RenderingFrameTimelineRecord.taskTypeForTimelineRecord(currentValue)) return previousValue;var currentDuration=currentValue.duration;if(currentValue.usesActiveStartTime) currentDuration-=currentValue.inactiveDuration;return previousValue+currentDuration;},0);if(taskType===WebInspector.RenderingFrameTimelineRecord.TaskType.Script){ duration-=this.children.reduce(function(previousValue,currentValue){if(currentValue.type===WebInspector.TimelineRecord.Type.Layout&&(currentValue.sourceCodeLocation||currentValue.callFrames)) return previousValue+currentValue.duration;return previousValue;},0);}} this._durationByTaskType.set(taskType,duration);return duration;} _calculateDurationRemainder() {return Object.keys(WebInspector.RenderingFrameTimelineRecord.TaskType).reduce((previousValue,key)=>{let taskType=WebInspector.RenderingFrameTimelineRecord.TaskType[key];if(taskType===WebInspector.RenderingFrameTimelineRecord.TaskType.Other) return previousValue;return previousValue-this.durationForTask(taskType);},this.duration);}};WebInspector.RenderingFrameTimelineRecord.TaskType={Script:"rendering-frame-timeline-record-script",Layout:"rendering-frame-timeline-record-layout",Paint:"rendering-frame-timeline-record-paint",Other:"rendering-frame-timeline-record-other"};WebInspector.RenderingFrameTimelineRecord.TypeIdentifier="rendering-frame-timeline-record";WebInspector.RenderingFrameTimelineRecord._nextFrameIndex=0;WebInspector.Resource=class Resource extends WebInspector.SourceCode {constructor(url,mimeType,type,loaderIdentifier,targetId,requestIdentifier,requestMethod,requestHeaders,requestData,requestSentTimestamp,initiatorSourceCodeLocation,originalRequestWillBeSentTimestamp) {super();if(type in WebInspector.Resource.Type) type=WebInspector.Resource.Type[type];this._url=url;this._urlComponents=null;this._mimeType=mimeType;this._mimeTypeComponents=null;this._type=type||WebInspector.Resource.typeFromMIMEType(mimeType);this._loaderIdentifier=loaderIdentifier||null;this._requestIdentifier=requestIdentifier||null;this._requestMethod=requestMethod||null;this._requestData=requestData||null;this._requestHeaders=requestHeaders||{};this._responseHeaders={};this._parentFrame=null;this._initiatorSourceCodeLocation=initiatorSourceCodeLocation||null;this._initiatedResources=[];this._originalRequestWillBeSentTimestamp=originalRequestWillBeSentTimestamp||null;this._requestSentTimestamp=requestSentTimestamp||NaN;this._responseReceivedTimestamp=NaN;this._lastRedirectReceivedTimestamp=NaN;this._lastDataReceivedTimestamp=NaN;this._finishedOrFailedTimestamp=NaN;this._finishThenRequestContentPromise=null;this._statusCode=NaN;this._statusText=null;this._cached=false;this._canceled=false;this._failed=false;this._failureReasonText=null;this._receivedNetworkLoadMetrics=false;this._responseSource=WebInspector.Resource.ResponseSource.Unknown;this._timingData=new WebInspector.ResourceTimingData(this);this._protocol=null;this._priority=WebInspector.Resource.NetworkPriority.Unknown;this._remoteAddress=null;this._connectionIdentifier=null;this._target=targetId?WebInspector.targetManager.targetForIdentifier(targetId):WebInspector.mainTarget;this._requestHeadersTransferSize=NaN;this._requestBodyTransferSize=NaN;this._responseHeadersTransferSize=NaN;this._responseBodyTransferSize=NaN;this._responseBodySize=NaN;this._cachedResponseBodySize=NaN;this._estimatedSize=NaN;this._estimatedTransferSize=NaN;this._estimatedResponseHeadersSize=NaN;if(this._initiatorSourceCodeLocation&&this._initiatorSourceCodeLocation.sourceCode instanceof WebInspector.Resource) this._initiatorSourceCodeLocation.sourceCode.addInitiatedResource(this);} static typeFromMIMEType(mimeType) {if(!mimeType) return WebInspector.Resource.Type.Other;mimeType=parseMIMEType(mimeType).type;if(mimeType in WebInspector.Resource._mimeTypeMap) return WebInspector.Resource._mimeTypeMap[mimeType];if(mimeType.startsWith("image/")) return WebInspector.Resource.Type.Image;if(mimeType.startsWith("font/")) return WebInspector.Resource.Type.Font;return WebInspector.Resource.Type.Other;} static displayNameForType(type,plural) {switch(type){case WebInspector.Resource.Type.Document:if(plural) return WebInspector.UIString("Documents");return WebInspector.UIString("Document");case WebInspector.Resource.Type.Stylesheet:if(plural) return WebInspector.UIString("Stylesheets");return WebInspector.UIString("Stylesheet");case WebInspector.Resource.Type.Image:if(plural) return WebInspector.UIString("Images");return WebInspector.UIString("Image");case WebInspector.Resource.Type.Font:if(plural) return WebInspector.UIString("Fonts");return WebInspector.UIString("Font");case WebInspector.Resource.Type.Script:if(plural) return WebInspector.UIString("Scripts");return WebInspector.UIString("Script");case WebInspector.Resource.Type.XHR:if(plural) return WebInspector.UIString("XHRs");return WebInspector.UIString("XHR");case WebInspector.Resource.Type.Fetch:if(plural) return WebInspector.UIString("Fetches");return WebInspector.UIString("Fetch");case WebInspector.Resource.Type.WebSocket:if(plural) return WebInspector.UIString("Sockets");return WebInspector.UIString("Socket");case WebInspector.Resource.Type.Other:return WebInspector.UIString("Other");default:console.error("Unknown resource type",type);return null;}} static displayNameForProtocol(protocol) {switch(protocol){case"h2":return"HTTP/2";case"http/1.0":return"HTTP/1.0";case"http/1.1":return"HTTP/1.1";case"spdy/2":return"SPDY/2";case"spdy/3":return"SPDY/3";case"spdy/3.1":return"SPDY/3.1";default:return null;}} static comparePriority(a,b) {const map={[WebInspector.Resource.NetworkPriority.Unknown]:0,[WebInspector.Resource.NetworkPriority.Low]:1,[WebInspector.Resource.NetworkPriority.Medium]:2,[WebInspector.Resource.NetworkPriority.High]:3,};let aNum=map[a]||0;let bNum=map[b]||0;return aNum-bNum;} static displayNameForPriority(priority) {switch(priority){case WebInspector.Resource.NetworkPriority.Low:return WebInspector.UIString("Low");case WebInspector.Resource.NetworkPriority.Medium:return WebInspector.UIString("Medium");case WebInspector.Resource.NetworkPriority.High:return WebInspector.UIString("High");default:return null;}} static responseSourceFromPayload(source) {if(!source) return WebInspector.Resource.ResponseSource.Unknown;switch(source){case NetworkAgent.ResponseSource.Unknown:return WebInspector.Resource.ResponseSource.Unknown;case NetworkAgent.ResponseSource.Network:return WebInspector.Resource.ResponseSource.Network;case NetworkAgent.ResponseSource.MemoryCache:return WebInspector.Resource.ResponseSource.MemoryCache;case NetworkAgent.ResponseSource.DiskCache:return WebInspector.Resource.ResponseSource.DiskCache;default:console.error("Unknown response source type",source);return WebInspector.Resource.ResponseSource.Unknown;}} static networkPriorityFromPayload(priority) {switch(priority){case NetworkAgent.MetricsPriority.Low:return WebInspector.Resource.NetworkPriority.Low;case NetworkAgent.MetricsPriority.Medium:return WebInspector.Resource.NetworkPriority.Medium;case NetworkAgent.MetricsPriority.High:return WebInspector.Resource.NetworkPriority.High;default:console.error("Unknown metrics priority",priority);return WebInspector.Resource.NetworkPriority.Unknown;}} static connectionIdentifierFromPayload(connectionIdentifier) {if(!WebInspector.Resource.connectionIdentifierMap){WebInspector.Resource.connectionIdentifierMap=new Map;WebInspector.Resource.nextConnectionIdentifier=1;} let id=WebInspector.Resource.connectionIdentifierMap.get(connectionIdentifier);if(id) return id;id=WebInspector.Resource.nextConnectionIdentifier++;WebInspector.Resource.connectionIdentifierMap.set(connectionIdentifier,id);return id;} get target(){return this._target;} get type(){return this._type;} get loaderIdentifier(){return this._loaderIdentifier;} get requestIdentifier(){return this._requestIdentifier;} get requestMethod(){return this._requestMethod;} get requestData(){return this._requestData;} get statusCode(){return this._statusCode;} get statusText(){return this._statusText;} get responseSource(){return this._responseSource;} get timingData(){return this._timingData;} get protocol(){return this._protocol;} get priority(){return this._priority;} get remoteAddress(){return this._remoteAddress;} get connectionIdentifier(){return this._connectionIdentifier;} get url() {return this._url;} get urlComponents() {if(!this._urlComponents) this._urlComponents=parseURL(this._url);return this._urlComponents;} get displayName() {return WebInspector.displayNameForURL(this._url,this.urlComponents);} get displayURL() {const isMultiLine=true;const dataURIMaxSize=64;return WebInspector.truncateURL(this._url,isMultiLine,dataURIMaxSize);} get initiatorSourceCodeLocation() {return this._initiatorSourceCodeLocation;} get initiatedResources() {return this._initiatedResources;} get originalRequestWillBeSentTimestamp() {return this._originalRequestWillBeSentTimestamp;} get mimeType() {return this._mimeType;} get mimeTypeComponents() {if(!this._mimeTypeComponents) this._mimeTypeComponents=parseMIMEType(this._mimeType);return this._mimeTypeComponents;} get syntheticMIMEType() { if(this._type===WebInspector.Resource.typeFromMIMEType(this._mimeType)) return this._mimeType; switch(this._type){case WebInspector.Resource.Type.Stylesheet:return"text/css";case WebInspector.Resource.Type.Script:return"text/javascript";} return this._mimeType;} createObjectURL() {let content=this.content;if(!content) return this._url;if(content instanceof Blob) return URL.createObjectURL(content);return null;} isMainResource() {return this._parentFrame?this._parentFrame.mainResource===this:false;} addInitiatedResource(resource) {if(!(resource instanceof WebInspector.Resource)) return;this._initiatedResources.push(resource);this.dispatchEventToListeners(WebInspector.Resource.Event.InitiatedResourcesDidChange);} get parentFrame() {return this._parentFrame;} get finished() {return this._finished;} get failed() {return this._failed;} get canceled() {return this._canceled;} get failureReasonText() {return this._failureReasonText;} get requestDataContentType() {return this._requestHeaders.valueForCaseInsensitiveKey("Content-Type")||null;} get requestHeaders() {return this._requestHeaders;} get responseHeaders() {return this._responseHeaders;} get requestSentTimestamp() {return this._requestSentTimestamp;} get lastRedirectReceivedTimestamp() {return this._lastRedirectReceivedTimestamp;} get responseReceivedTimestamp() {return this._responseReceivedTimestamp;} get lastDataReceivedTimestamp() {return this._lastDataReceivedTimestamp;} get finishedOrFailedTimestamp() {return this._finishedOrFailedTimestamp;} get firstTimestamp() {return this.timingData.startTime||this.lastRedirectReceivedTimestamp||this.responseReceivedTimestamp||this.lastDataReceivedTimestamp||this.finishedOrFailedTimestamp;} get lastTimestamp() {return this.timingData.responseEnd||this.lastDataReceivedTimestamp||this.responseReceivedTimestamp||this.lastRedirectReceivedTimestamp||this.requestSentTimestamp;} get duration() {return this.timingData.responseEnd-this.timingData.requestStart;} get latency() {return this.timingData.responseStart-this.timingData.requestStart;} get receiveDuration() {return this.timingData.responseEnd-this.timingData.responseStart;} get cached() {return this._cached;} get requestHeadersTransferSize(){return this._requestHeadersTransferSize;} get requestBodyTransferSize(){return this._requestBodyTransferSize;} get responseHeadersTransferSize(){return this._responseHeadersTransferSize;} get responseBodyTransferSize(){return this._responseBodyTransferSize;} get cachedResponseBodySize(){return this._cachedResponseBodySize;} get size() {if(!isNaN(this._cachedResponseBodySize)) return this._cachedResponseBodySize;if(!isNaN(this._responseBodySize)&&this._responseBodySize!==0) return this._responseBodySize;return this._estimatedSize;} get networkEncodedSize() {return this._responseBodyTransferSize;} get networkDecodedSize() {return this._responseBodySize;} get networkTotalTransferSize() {return this._responseHeadersTransferSize+this._responseBodyTransferSize;} get estimatedNetworkEncodedSize() {let exact=this.networkEncodedSize;if(!isNaN(exact)) return exact;if(this._cached) return 0; if(WebInspector.Platform.name==="mac"){let contentLength=Number(this._responseHeaders.valueForCaseInsensitiveKey("Content-Length"));if(!isNaN(contentLength)) return contentLength;} if(!isNaN(this._estimatedTransferSize)) return this._estimatedTransferSize; return Number(this._responseHeaders.valueForCaseInsensitiveKey("Content-Length")||this._estimatedSize);} get estimatedTotalTransferSize() {let exact=this.networkTotalTransferSize;if(!isNaN(exact)) return exact;if(this.statusCode===304) return this._estimatedResponseHeadersSize;if(this._cached) return 0;return this._estimatedResponseHeadersSize+this.estimatedNetworkEncodedSize;} get compressed() {let contentEncoding=this._responseHeaders.valueForCaseInsensitiveKey("Content-Encoding");return!!(contentEncoding&&/\b(?:gzip|deflate)\b/.test(contentEncoding));} get scripts() {return this._scripts||[];} scriptForLocation(sourceCodeLocation) {if(sourceCodeLocation.sourceCode!==this) return null;var lineNumber=sourceCodeLocation.lineNumber;var columnNumber=sourceCodeLocation.columnNumber;for(var i=0;i=lineNumber){if(script.range.startLine===lineNumber&&columnNumberscript.range.endColumn) continue;return script;}} return null;} updateForRedirectResponse(url,requestHeaders,elapsedTime) {var oldURL=this._url;this._url=url;this._requestHeaders=requestHeaders||{};this._lastRedirectReceivedTimestamp=elapsedTime||NaN;if(oldURL!==url){this._urlComponents=null;this.dispatchEventToListeners(WebInspector.Resource.Event.URLDidChange,{oldURL});} this.dispatchEventToListeners(WebInspector.Resource.Event.RequestHeadersDidChange);this.dispatchEventToListeners(WebInspector.Resource.Event.TimestampsDidChange);} hasResponse() {return!isNaN(this._statusCode);} updateForResponse(url,mimeType,type,responseHeaders,statusCode,statusText,elapsedTime,timingData,source) {let oldURL=this._url;let oldMIMEType=this._mimeType;let oldType=this._type;if(type in WebInspector.Resource.Type) type=WebInspector.Resource.Type[type];this._url=url;this._mimeType=mimeType;this._type=type||WebInspector.Resource.typeFromMIMEType(mimeType);this._statusCode=statusCode;this._statusText=statusText;this._responseHeaders=responseHeaders||{};this._responseReceivedTimestamp=elapsedTime||NaN;this._timingData=WebInspector.ResourceTimingData.fromPayload(timingData,this);if(source) this._responseSource=WebInspector.Resource.responseSourceFromPayload(source);const headerBaseSize=12;const headerPad=4;this._estimatedResponseHeadersSize=String(this._statusCode).length+this._statusText.length+headerBaseSize;for(let name in this._responseHeaders) this._estimatedResponseHeadersSize+=name.length+this._responseHeaders[name].length+headerPad;if(!this._cached){if(statusCode===304||(this._responseSource===WebInspector.Resource.ResponseSource.MemoryCache||this._responseSource===WebInspector.Resource.ResponseSource.DiskCache)) this.markAsCached();} if(oldURL!==url){this._urlComponents=null;this.dispatchEventToListeners(WebInspector.Resource.Event.URLDidChange,{oldURL});} if(oldMIMEType!==mimeType){this._mimeTypeComponents=null;this.dispatchEventToListeners(WebInspector.Resource.Event.MIMETypeDidChange,{oldMIMEType});} if(oldType!==type) this.dispatchEventToListeners(WebInspector.Resource.Event.TypeDidChange,{oldType}); if(statusCode===304||this._responseHeaders.valueForCaseInsensitiveKey("Content-Length")) this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);this.dispatchEventToListeners(WebInspector.Resource.Event.ResponseReceived);this.dispatchEventToListeners(WebInspector.Resource.Event.TimestampsDidChange);} updateWithMetrics(metrics) {this._receivedNetworkLoadMetrics=true;if(metrics.protocol) this._protocol=metrics.protocol;if(metrics.priority) this._priority=WebInspector.Resource.networkPriorityFromPayload(metrics.priority);if(metrics.remoteAddress) this._remoteAddress=metrics.remoteAddress;if(metrics.connectionIdentifier) this._connectionIdentifier=WebInspector.Resource.connectionIdentifierFromPayload(metrics.connectionIdentifier);if(metrics.requestHeaders){this._requestHeaders=metrics.requestHeaders;this.dispatchEventToListeners(WebInspector.Resource.Event.RequestHeadersDidChange);} if("requestHeaderBytesSent"in metrics){this._requestHeadersTransferSize=metrics.requestHeaderBytesSent;this._requestBodyTransferSize=metrics.requestBodyBytesSent;this._responseHeadersTransferSize=metrics.responseHeaderBytesReceived;this._responseBodyTransferSize=metrics.responseBodyBytesReceived;this._responseBodySize=metrics.responseBodyDecodedSize;this.dispatchEventToListeners(WebInspector.Resource.Event.SizeDidChange,{previousSize:this._estimatedSize});this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);}} setCachedResponseBodySize(size) {this._cachedResponseBodySize=size;} requestContentFromBackend() {if(this._requestIdentifier) return NetworkAgent.getResponseBody(this._requestIdentifier);if(this._parentFrame) return PageAgent.getResourceContent(this._parentFrame.id,this._url);return Promise.reject(new Error("Content request failed."));} increaseSize(dataLength,elapsedTime) {if(isNaN(this._estimatedSize)) this._estimatedSize=0;let previousSize=this._estimatedSize;this._estimatedSize+=dataLength;this._lastDataReceivedTimestamp=elapsedTime||NaN;this.dispatchEventToListeners(WebInspector.Resource.Event.SizeDidChange,{previousSize});if(isNaN(this._estimatedTransferSize)&&this._statusCode!==304&&!this._responseHeaders.valueForCaseInsensitiveKey("Content-Length")) this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);} increaseTransferSize(encodedDataLength) {if(isNaN(this._estimatedTransferSize)) this._estimatedTransferSize=0;this._estimatedTransferSize+=encodedDataLength;this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);} markAsCached() {this._cached=true;this.dispatchEventToListeners(WebInspector.Resource.Event.CacheStatusDidChange);if(this._statusCode!==304) this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);} markAsFinished(elapsedTime) {this._finished=true;this._finishedOrFailedTimestamp=elapsedTime||NaN;this._timingData.markResponseEndTime(elapsedTime||NaN);if(this._finishThenRequestContentPromise) this._finishThenRequestContentPromise=null;this.dispatchEventToListeners(WebInspector.Resource.Event.LoadingDidFinish);this.dispatchEventToListeners(WebInspector.Resource.Event.TimestampsDidChange);} markAsFailed(canceled,elapsedTime,errorText) {this._failed=true;this._canceled=canceled;this._finishedOrFailedTimestamp=elapsedTime||NaN;if(!this._failureReasonText) this._failureReasonText=errorText||null;this.dispatchEventToListeners(WebInspector.Resource.Event.LoadingDidFail);this.dispatchEventToListeners(WebInspector.Resource.Event.TimestampsDidChange);} revertMarkAsFinished() {this._finished=false;this._finishedOrFailedTimestamp=NaN;} legacyMarkServedFromMemoryCache() {this._responseSource=WebInspector.Resource.ResponseSource.MemoryCache;this.markAsCached();} legacyMarkServedFromDiskCache() {this._responseSource=WebInspector.Resource.ResponseSource.DiskCache;this.markAsCached();} hadLoadingError() {return this._failed||this._canceled||this._statusCode>=400;} getImageSize(callback) {if(this.type!==WebInspector.Resource.Type.Image) throw"Resource is not an image.";if(this._imageSize!==undefined){callback(this._imageSize);return;} var objectURL=null;function imageDidLoad(){URL.revokeObjectURL(objectURL);this._imageSize={width:image.width,height:image.height};callback(this._imageSize);} function requestContentFailure(){this._imageSize=null;callback(this._imageSize);} var image=new Image;image.addEventListener("load",imageDidLoad.bind(this),false);this.requestContent().then((content)=>{objectURL=image.src=content.sourceCode.createObjectURL();if(!objectURL) requestContentFailure.call(this);},requestContentFailure.bind(this));} requestContent() {if(this._finished) return super.requestContent();if(this._failed) return Promise.resolve({error:WebInspector.UIString("An error occurred trying to load the resource.")});if(!this._finishThenRequestContentPromise){this._finishThenRequestContentPromise=new Promise((resolve,reject)=>{this.addEventListener(WebInspector.Resource.Event.LoadingDidFinish,resolve);this.addEventListener(WebInspector.Resource.Event.LoadingDidFail,reject);}).then(WebInspector.SourceCode.prototype.requestContent.bind(this));} return this._finishThenRequestContentPromise;} associateWithScript(script) {if(!this._scripts) this._scripts=[];this._scripts.push(script);if(this._type===WebInspector.Resource.Type.Other||this._type===WebInspector.Resource.Type.XHR){let oldType=this._type;this._type=WebInspector.Resource.Type.Script;this.dispatchEventToListeners(WebInspector.Resource.Event.TypeDidChange,{oldType});}} saveIdentityToCookie(cookie) {cookie[WebInspector.Resource.URLCookieKey]=this.url.hash;cookie[WebInspector.Resource.MainResourceCookieKey]=this.isMainResource();} generateCURLCommand() {function escapeStringPosix(str){function escapeCharacter(x){let code=x.charCodeAt(0);let hex=code.toString(16);if(code<256) return"\\x"+hex.padStart(2,"0");return"\\u"+hex.padStart(4,"0");} if(/[^\x20-\x7E]|'/.test(str)){return"$'"+str.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/!/g,"\\041").replace(/[^\x20-\x7E]/g,escapeCharacter)+"'";}else{return`'${str}'`;}} let command=["curl "+escapeStringPosix(this.url).replace(/[[{}\]]/g,"\\$&")];command.push(`-X${this.requestMethod}`);for(let key in this.requestHeaders) command.push("-H "+escapeStringPosix(`${key}: ${this.requestHeaders[key]}`));if(this.requestDataContentType&&this.requestMethod!=="GET"&&this.requestData){if(this.requestDataContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i)) command.push("--data "+escapeStringPosix(this.requestData));else command.push("--data-binary "+escapeStringPosix(this.requestData));} let curlCommand=command.join(" \\\n");InspectorFrontendHost.copyText(curlCommand);return curlCommand;}};WebInspector.Resource.TypeIdentifier="resource";WebInspector.Resource.URLCookieKey="resource-url";WebInspector.Resource.MainResourceCookieKey="resource-is-main-resource";WebInspector.Resource.Event={URLDidChange:"resource-url-did-change",MIMETypeDidChange:"resource-mime-type-did-change",TypeDidChange:"resource-type-did-change",RequestHeadersDidChange:"resource-request-headers-did-change",ResponseReceived:"resource-response-received",LoadingDidFinish:"resource-loading-did-finish",LoadingDidFail:"resource-loading-did-fail",TimestampsDidChange:"resource-timestamps-did-change",SizeDidChange:"resource-size-did-change",TransferSizeDidChange:"resource-transfer-size-did-change",CacheStatusDidChange:"resource-cached-did-change",InitiatedResourcesDidChange:"resource-initiated-resources-did-change",};WebInspector.Resource.Type={Document:"resource-type-document",Stylesheet:"resource-type-stylesheet",Image:"resource-type-image",Font:"resource-type-font",Script:"resource-type-script",XHR:"resource-type-xhr",Fetch:"resource-type-fetch",WebSocket:"resource-type-websocket",Other:"resource-type-other"};WebInspector.Resource.ResponseSource={Unknown:Symbol("unknown"),Network:Symbol("network"),MemoryCache:Symbol("memory-cache"),DiskCache:Symbol("disk-cache"),};WebInspector.Resource.NetworkPriority={Unknown:Symbol("unknown"),Low:Symbol("low"),Medium:Symbol("medium"),High:Symbol("high"),};WebInspector.Resource._mimeTypeMap={"text/html":WebInspector.Resource.Type.Document,"text/xml":WebInspector.Resource.Type.Document,"text/plain":WebInspector.Resource.Type.Document,"application/xhtml+xml":WebInspector.Resource.Type.Document,"image/svg+xml":WebInspector.Resource.Type.Document,"text/css":WebInspector.Resource.Type.Stylesheet,"text/xsl":WebInspector.Resource.Type.Stylesheet,"text/x-less":WebInspector.Resource.Type.Stylesheet,"text/x-sass":WebInspector.Resource.Type.Stylesheet,"text/x-scss":WebInspector.Resource.Type.Stylesheet,"application/pdf":WebInspector.Resource.Type.Image,"application/x-font-type1":WebInspector.Resource.Type.Font,"application/x-font-ttf":WebInspector.Resource.Type.Font,"application/x-font-woff":WebInspector.Resource.Type.Font,"application/x-truetype-font":WebInspector.Resource.Type.Font,"text/javascript":WebInspector.Resource.Type.Script,"text/ecmascript":WebInspector.Resource.Type.Script,"application/javascript":WebInspector.Resource.Type.Script,"application/ecmascript":WebInspector.Resource.Type.Script,"application/x-javascript":WebInspector.Resource.Type.Script,"application/json":WebInspector.Resource.Type.Script,"application/x-json":WebInspector.Resource.Type.Script,"text/x-javascript":WebInspector.Resource.Type.Script,"text/x-json":WebInspector.Resource.Type.Script,"text/javascript1.1":WebInspector.Resource.Type.Script,"text/javascript1.2":WebInspector.Resource.Type.Script,"text/javascript1.3":WebInspector.Resource.Type.Script,"text/jscript":WebInspector.Resource.Type.Script,"text/livescript":WebInspector.Resource.Type.Script,"text/x-livescript":WebInspector.Resource.Type.Script,"text/typescript":WebInspector.Resource.Type.Script,"text/x-clojure":WebInspector.Resource.Type.Script,"text/x-coffeescript":WebInspector.Resource.Type.Script};WebInspector.ResourceCollection=class ResourceCollection extends WebInspector.Collection {constructor(resourceType) {super(WebInspector.ResourceCollection.verifierForType(resourceType));this._resourceType=resourceType||null;this._resourceURLMap=new Map;this._resourcesTypeMap=new Map;} static verifierForType(type){switch(type){case WebInspector.Resource.Type.Document:return WebInspector.ResourceCollection.TypeVerifier.Document;case WebInspector.Resource.Type.Stylesheet:return WebInspector.ResourceCollection.TypeVerifier.Stylesheet;case WebInspector.Resource.Type.Image:return WebInspector.ResourceCollection.TypeVerifier.Image;case WebInspector.Resource.Type.Font:return WebInspector.ResourceCollection.TypeVerifier.Font;case WebInspector.Resource.Type.Script:return WebInspector.ResourceCollection.TypeVerifier.Script;case WebInspector.Resource.Type.XHR:return WebInspector.ResourceCollection.TypeVerifier.XHR;case WebInspector.Resource.Type.Fetch:return WebInspector.ResourceCollection.TypeVerifier.Fetch;case WebInspector.Resource.Type.WebSocket:return WebInspector.ResourceCollection.TypeVerifier.WebSocket;case WebInspector.Resource.Type.Other:return WebInspector.ResourceCollection.TypeVerifier.Other;default:return WebInspector.Collection.TypeVerifier.Resource;}} resourceForURL(url) {return this._resourceURLMap.get(url)||null;} resourceCollectionForType(type) {if(this._resourceType){return this;} let resourcesCollectionForType=this._resourcesTypeMap.get(type);if(!resourcesCollectionForType){resourcesCollectionForType=new WebInspector.ResourceCollection(type);this._resourcesTypeMap.set(type,resourcesCollectionForType);} return resourcesCollectionForType;} clear() {super.clear();this._resourceURLMap.clear();if(!this._resourceType) this._resourcesTypeMap.clear();} itemAdded(item) {this._associateWithResource(item);} itemRemoved(item) {this._disassociateWithResource(item);} itemsCleared(items) {const skipRemoval=true;for(let item of items) this._disassociateWithResource(item,skipRemoval);} _associateWithResource(resource) {this._resourceURLMap.set(resource.url,resource);if(!this._resourceType){let resourcesCollectionForType=this.resourceCollectionForType(resource.type);resourcesCollectionForType.add(resource);} resource.addEventListener(WebInspector.Resource.Event.URLDidChange,this._resourceURLDidChange,this);resource.addEventListener(WebInspector.Resource.Event.TypeDidChange,this._resourceTypeDidChange,this);} _disassociateWithResource(resource,skipRemoval) {resource.removeEventListener(WebInspector.Resource.Event.URLDidChange,this._resourceURLDidChange,this);resource.removeEventListener(WebInspector.Resource.Event.TypeDidChange,this._resourceTypeDidChange,this);if(skipRemoval) return;if(!this._resourceType){let resourcesCollectionForType=this.resourceCollectionForType(resource.type);resourcesCollectionForType.remove(resource);} this._resourceURLMap.delete(resource.url);} _resourceURLDidChange(event) {let resource=event.target;if(!(resource instanceof WebInspector.Resource)) return;let oldURL=event.data.oldURL;if(!oldURL) return;this._resourceURLMap.set(resource.url,resource);this._resourceURLMap.delete(oldURL);} _resourceTypeDidChange(event) {let resource=event.target;if(!(resource instanceof WebInspector.Resource)) return;if(this._resourceType){this.remove(resource);return;} let resourcesWithNewType=this.resourceCollectionForType(resource.type);resourcesWithNewType.add(resource); }};WebInspector.ResourceCollection.TypeVerifier={Document:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.Document,Stylesheet:(object)=>{if(WebInspector.Collection.TypeVerifier.CSSStyleSheet(object)) return true;return WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.Stylesheet},Image:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.Image,Font:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.Font,Script:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.Script,XHR:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.XHR,Fetch:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.Fetch,WebSocket:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.WebSocket,Other:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.Other,};WebInspector.ResourceQueryMatch=class QueryMatch extends WebInspector.Object {constructor(type,index,queryIndex) {super();this._type=type;this._index=index;this._queryIndex=queryIndex;this._rank=undefined;} get type(){return this._type;} get index(){return this._index;} get queryIndex(){return this._queryIndex;}};WebInspector.ResourceQueryMatch.Type={Normal:Symbol("normal"),Special:Symbol("special")};WebInspector.ResourceQueryResult=class QueryResult extends WebInspector.Object {constructor(resource,matches,cookie) {super();this._resource=resource;this._matches=matches;this._cookie=cookie||null;} get resource(){return this._resource;} get cookie(){return this._cookie;} get rank() {if(this._rank===undefined) this._calculateRank();return this._rank;} get matchingTextRanges() {if(!this._matchingTextRanges) this._matchingTextRanges=this._createMatchingTextRanges();return this._matchingTextRanges;} _calculateRank() {const normalWeight=10;const consecutiveWeight=5;const specialMultiplier=5;function getMultiplier(match){if(match.type===WebInspector.ResourceQueryMatch.Type.Special) return specialMultiplier;return 1;} this._rank=0;let previousMatch=null;let consecutiveMatchStart=null;for(let match of this._matches){this._rank+=normalWeight*getMultiplier(match);let consecutive=previousMatch&&previousMatch.index===match.index-1;if(consecutive){if(!consecutiveMatchStart) consecutiveMatchStart=previousMatch; this._rank+=consecutiveWeight*getMultiplier(consecutiveMatchStart)*(match.index-consecutiveMatchStart.index);}else if(consecutiveMatchStart) consecutiveMatchStart=null;previousMatch=match; if(!consecutive) this._rank-=match.index*getMultiplier(match);}} _createMatchingTextRanges() {if(!this._matches.length) return[];let ranges=[];let startIndex=this._matches[0].index;let endIndex=startIndex;for(let i=1;i=this._domainLookupEnd) this._domainLookupStart=this._domainLookupEnd=NaN;if(this._connectStart>=this._connectEnd) this._connectStart=this._connectEnd=NaN;} static fromPayload(payload,resource) {payload=payload||{};if(typeof payload.requestTime==="number"||typeof payload.navigationStart==="number") payload={};function offsetToTimestamp(offset){return offset>0?payload.startTime+(offset/1000):NaN;} let data={startTime:payload.startTime,domainLookupStart:offsetToTimestamp(payload.domainLookupStart),domainLookupEnd:offsetToTimestamp(payload.domainLookupEnd),connectStart:offsetToTimestamp(payload.connectStart),connectEnd:offsetToTimestamp(payload.connectEnd),secureConnectionStart:offsetToTimestamp(payload.secureConnectionStart),requestStart:offsetToTimestamp(payload.requestStart),responseStart:offsetToTimestamp(payload.responseStart),responseEnd:offsetToTimestamp(payload.responseEnd)};if(isNaN(data.connectStart)&&!isNaN(data.secureConnectionStart)) data.connectStart=data.secureConnectionStart;return new WebInspector.ResourceTimingData(resource,data);} get startTime(){return this._startTime||this._resource.requestSentTimestamp;} get domainLookupStart(){return this._domainLookupStart;} get domainLookupEnd(){return this._domainLookupEnd;} get connectStart(){return this._connectStart;} get connectEnd(){return this._connectEnd;} get secureConnectionStart(){return this._secureConnectionStart;} get requestStart(){return this._requestStart||this._startTime||this._resource.requestSentTimestamp;} get responseStart(){return this._responseStart||this._startTime||this._resource.responseReceivedTimestamp;} get responseEnd(){return this._responseEnd||this._resource.finishedOrFailedTimestamp;} markResponseEndTime(responseEnd) {this._responseEnd=responseEnd;}};WebInspector.Revision=class Revision extends WebInspector.Object { apply() {console.error("Needs to be implemented by a subclass.");} revert() {console.error("Needs to be implemented by a subclass.");} copy() {return this;}};WebInspector.ScopeChainNode=class ScopeChainNode extends WebInspector.Object {constructor(type,objects,name,location,empty) {super();if(type in WebInspector.ScopeChainNode.Type) type=WebInspector.ScopeChainNode.Type[type];this._type=type||null;this._objects=objects||[];this._name=name||"";this._location=location||null;this._empty=empty||false;} get type(){return this._type;} get objects(){return this._objects;} get name(){return this._name;} get location(){return this._location;} get empty(){return this._empty;} get hash() {if(this._hash) return this._hash;this._hash=this._name;if(this._location) this._hash+=`:${this._location.scriptId}:${this._location.lineNumber}:${this._location.columnNumber}`;return this._hash;} convertToLocalScope() {this._type=WebInspector.ScopeChainNode.Type.Local;}};WebInspector.ScopeChainNode.Type={Local:"scope-chain-type-local",Global:"scope-chain-type-global",GlobalLexicalEnvironment:"scope-chain-type-global-lexical-environment",With:"scope-chain-type-with",Closure:"scope-chain-type-closure",Catch:"scope-chain-type-catch",FunctionName:"scope-chain-type-function-name",Block:"scope-chain-type-block",};WebInspector.Script=class Script extends WebInspector.SourceCode {constructor(target,id,range,url,sourceType,injected,sourceURL,sourceMapURL) {super();this._target=target;this._id=id||null;this._range=range||null;this._url=url||null;this._sourceType=sourceType||WebInspector.Script.SourceType.Program;this._sourceURL=sourceURL||null;this._sourceMappingURL=sourceMapURL||null;this._injected=injected||false;this._dynamicallyAddedScriptElement=false;this._scriptSyntaxTree=null;this._resource=this._resolveResource(); if(this._resource&&this._resource.type===WebInspector.Resource.Type.Document&&!this._range.startLine&&!this._range.startColumn){let documentResource=this._resource;this._resource=null;this._dynamicallyAddedScriptElement=true;documentResource.parentFrame.addExtraScript(this);this._dynamicallyAddedScriptElementNumber=documentResource.parentFrame.extraScriptCollection.items.size;}else if(this._resource) this._resource.associateWithScript(this);if(isWebInspectorConsoleEvaluationScript(this._sourceURL)){this._uniqueDisplayNameNumber=this.constructor._nextUniqueConsoleDisplayNameNumber++;} if(this._sourceMappingURL) WebInspector.sourceMapManager.downloadSourceMap(this._sourceMappingURL,this._url,this);} static resetUniqueDisplayNameNumbers() {WebInspector.Script._nextUniqueDisplayNameNumber=1;WebInspector.Script._nextUniqueConsoleDisplayNameNumber=1;} get target(){return this._target;} get id(){return this._id;} get range(){return this._range;} get url(){return this._url;} get sourceType(){return this._sourceType;} get sourceURL(){return this._sourceURL;} get sourceMappingURL(){return this._sourceMappingURL;} get injected(){return this._injected;} get contentIdentifier() {if(this._url) return this._url;if(!this._sourceURL) return null; if(isWebInspectorConsoleEvaluationScript(this._sourceURL)) return null;if(isWebInspectorInternalScript(this._sourceURL)) return null;return this._sourceURL;} get urlComponents() {if(!this._urlComponents) this._urlComponents=parseURL(this._url);return this._urlComponents;} get mimeType() {return this._resource.mimeType;} get displayName() {if(this._url&&!this._dynamicallyAddedScriptElement) return WebInspector.displayNameForURL(this._url,this.urlComponents);if(isWebInspectorConsoleEvaluationScript(this._sourceURL)){return WebInspector.UIString("Console Evaluation %d").format(this._uniqueDisplayNameNumber);} if(this._sourceURL){if(!this._sourceURLComponents) this._sourceURLComponents=parseURL(this._sourceURL);return WebInspector.displayNameForURL(this._sourceURL,this._sourceURLComponents);} if(this._dynamicallyAddedScriptElement) return WebInspector.UIString("Script Element %d").format(this._dynamicallyAddedScriptElementNumber);if(!this._uniqueDisplayNameNumber) this._uniqueDisplayNameNumber=this.constructor._nextUniqueDisplayNameNumber++;return WebInspector.UIString("Anonymous Script %d").format(this._uniqueDisplayNameNumber);} get displayURL() {const isMultiLine=true;const dataURIMaxSize=64;if(this._url) return WebInspector.truncateURL(this._url,isMultiLine,dataURIMaxSize);if(this._sourceURL) return WebInspector.truncateURL(this._sourceURL,isMultiLine,dataURIMaxSize);return null;} get dynamicallyAddedScriptElement() {return this._dynamicallyAddedScriptElement;} get anonymous() {return!this._resource&&!this._url&&!this._sourceURL;} get resource() {return this._resource;} get scriptSyntaxTree() {return this._scriptSyntaxTree;} isMainResource() {return this._target.mainResource===this;} requestContentFromBackend() {if(!this._id){ return Promise.reject(new Error("There is no identifier to request content with."));} return this._target.DebuggerAgent.getScriptSource(this._id);} saveIdentityToCookie(cookie) {cookie[WebInspector.Script.URLCookieKey]=this.url;cookie[WebInspector.Script.DisplayNameCookieKey]=this.displayName;} requestScriptSyntaxTree(callback) {if(this._scriptSyntaxTree){setTimeout(()=>{callback(this._scriptSyntaxTree);},0);return;} var makeSyntaxTreeAndCallCallback=(content)=>{this._makeSyntaxTree(content);callback(this._scriptSyntaxTree);};var content=this.content;if(!content&&this._resource&&this._resource.type===WebInspector.Resource.Type.Script&&this._resource.finished) content=this._resource.content;if(content){setTimeout(makeSyntaxTreeAndCallCallback,0,content);return;} this.requestContent().then(function(parameters){makeSyntaxTreeAndCallCallback(parameters.sourceCode.content);}).catch(function(error){makeSyntaxTreeAndCallCallback(null);});} _resolveResource() { if(!this._url) return null;let resolver=WebInspector.frameResourceManager;if(this._target!==WebInspector.mainTarget) resolver=this._target.resourceCollection;try{let resource=resolver.resourceForURL(this._url);if(resource) return resource;let decodedURL=decodeURI(this._url);if(decodedURL!==this._url){resource=resolver.resourceForURL(decodedURL);if(resource) return resource;} let urlWithoutFragment=removeURLFragment(this._url);if(urlWithoutFragment!==this._url){resource=resolver.resourceForURL(urlWithoutFragment);if(resource) return resource;} let decodedURLWithoutFragment=removeURLFragment(decodedURL);if(decodedURLWithoutFragment!==decodedURL){resource=resolver.resourceForURL(decodedURLWithoutFragment);if(resource) return resource;}}catch(e){} return null;} _makeSyntaxTree(sourceText) {if(this._scriptSyntaxTree||!sourceText) return;this._scriptSyntaxTree=new WebInspector.ScriptSyntaxTree(sourceText,this);}};WebInspector.Script.SourceType={Program:"script-source-type-program",Module:"script-source-type-module",};WebInspector.Script.TypeIdentifier="script";WebInspector.Script.URLCookieKey="script-url";WebInspector.Script.DisplayNameCookieKey="script-display-name";WebInspector.Script._nextUniqueDisplayNameNumber=1;WebInspector.Script._nextUniqueConsoleDisplayNameNumber=1;WebInspector.ScriptInstrument=class ScriptInstrument extends WebInspector.Instrument { get timelineRecordType() {return WebInspector.TimelineRecord.Type.Script;} startInstrumentation(initiatedByBackend) {if(!window.ScriptProfilerAgent){super.startInstrumentation();return;} const includeSamples=true;if(!initiatedByBackend) ScriptProfilerAgent.startTracking(includeSamples);} stopInstrumentation(initiatedByBackend) {if(!window.ScriptProfilerAgent){super.stopInstrumentation();return;} if(!initiatedByBackend) ScriptProfilerAgent.stopTracking();}};WebInspector.ScriptSyntaxTree=class ScriptSyntaxTree extends WebInspector.Object {constructor(sourceText,script) {super();this._script=script;try{let sourceType=this._script.sourceType===WebInspector.Script.SourceType.Module?"module":"script";let esprimaSyntaxTree=esprima.parse(sourceText,{range:true,sourceType});this._syntaxTree=this._createInternalSyntaxTree(esprimaSyntaxTree);this._parsedSuccessfully=true;}catch(error){this._parsedSuccessfully=false;this._syntaxTree=null;console.error("Couldn't parse JavaScript File: "+script.url,error);}} get parsedSuccessfully() {return this._parsedSuccessfully;} forEachNode(callback) {if(!this._parsedSuccessfully) return;this._recurse(this._syntaxTree,callback,this._defaultParserState());} filter(predicate,startNode) {if(!this._parsedSuccessfully) return[];var nodes=[];function filter(node,state) {if(predicate(node)) nodes.push(node);else state.skipChildNodes=true;} this._recurse(startNode,filter,this._defaultParserState());return nodes;} containersOfOffset(offset) {if(!this._parsedSuccessfully) return[];let allNodes=[];const start=0;const end=1;this.forEachNode((node,state)=>{if(node.range[end]offset) state.shouldStopEarly=true;if(node.range[start]<=offset&&node.range[end]>=offset) allNodes.push(node);});return allNodes;} filterByRange(startOffset,endOffset) {if(!this._parsedSuccessfully) return[];var allNodes=[];var start=0;var end=1;function filterForNodesInRange(node,state) { if(node.range[end]endOffset) state.shouldStopEarly=true;} this.forEachNode(filterForNodesInRange);return allNodes;} containsNonEmptyReturnStatement(startNode) {if(!this._parsedSuccessfully) return false;if(startNode.attachments._hasNonEmptyReturnStatement!==undefined) return startNode.attachments._hasNonEmptyReturnStatement;function removeFunctionsFilter(node) {return node.type!==WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression&&node.type!==WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration&&node.type!==WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression;} var nodes=this.filter(removeFunctionsFilter,startNode);var hasNonEmptyReturnStatement=false;var returnStatementType=WebInspector.ScriptSyntaxTree.NodeType.ReturnStatement;for(var node of nodes){if(node.type===returnStatementType&&node.argument){hasNonEmptyReturnStatement=true;break;}} startNode.attachments._hasNonEmptyReturnStatement=hasNonEmptyReturnStatement;return hasNonEmptyReturnStatement;} static functionReturnDivot(node) {if(!DOMAgent.hasEvent("pseudoElementAdded")) return node.body.range[0];return node.typeProfilingReturnDivot;} updateTypes(nodesToUpdate,callback) {if(!this._parsedSuccessfully) return;var allRequests=[];var allRequestNodes=[];var sourceID=this._script.id;for(var node of nodesToUpdate){switch(node.type){case WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration:case WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression:case WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression:for(var param of node.params){for(var identifier of this._gatherIdentifiersInDeclaration(param)){allRequests.push({typeInformationDescriptor:WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.NormalExpression,sourceID,divot:identifier.range[0]});allRequestNodes.push(identifier);}} allRequests.push({typeInformationDescriptor:WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.FunctionReturn,sourceID,divot:WebInspector.ScriptSyntaxTree.functionReturnDivot(node)});allRequestNodes.push(node);break;case WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator:for(var identifier of this._gatherIdentifiersInDeclaration(node.id)){allRequests.push({typeInformationDescriptor:WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.NormalExpression,sourceID,divot:identifier.range[0]});allRequestNodes.push(identifier);} break;}} function handleTypes(error,typeInformationArray) {if(error) return;for(var i=0;i1){var step=count>>1;var middle=first+step;var mapping=this._mappings[middle];if(lineNumber>=1;return negative?-result:result;}};WebInspector.SourceMap.VLQ_BASE_SHIFT=5;WebInspector.SourceMap.VLQ_BASE_MASK=(1<<5)-1;WebInspector.SourceMap.VLQ_CONTINUATION_MASK=1<<5;WebInspector.SourceMap.StringCharIterator=class StringCharIterator {constructor(string) {this._string=string;this._position=0;} next() {return this._string.charAt(this._position++);} peek() {return this._string.charAt(this._position);} hasNext() {return this._position=400||error) return sourceMapResourceNotAvailable(error,content,mimeType,statusCode);this.markAsFinished();return Promise.resolve({content,mimeType,base64encoded,statusCode});} if(!window.NetworkAgent||!NetworkAgent.loadResource) return sourceMapResourceLoadError.call(this);var frameIdentifier=null;if(this._sourceMap.originalSourceCode instanceof WebInspector.Resource&&this._sourceMap.originalSourceCode.parentFrame) frameIdentifier=this._sourceMap.originalSourceCode.parentFrame.id;if(!frameIdentifier) frameIdentifier=WebInspector.frameResourceManager.mainFrame.id;return NetworkAgent.loadResource(frameIdentifier,this.url).then(sourceMapResourceLoaded.bind(this)).catch(sourceMapResourceLoadError.bind(this));} createSourceCodeLocation(lineNumber,columnNumber) {var entry=this._sourceMap.findEntryReversed(this.url,lineNumber);var rawLineNumber=entry[0];var rawColumnNumber=entry[1];var originalSourceCode=this._sourceMap.originalSourceCode;if(originalSourceCode instanceof WebInspector.Script){if(rawLineNumber===0) rawColumnNumber+=originalSourceCode.range.startColumn;rawLineNumber+=originalSourceCode.range.startLine;} var location=originalSourceCode.createSourceCodeLocation(rawLineNumber,rawColumnNumber);location._setMappedLocation(this,lineNumber,columnNumber);return location;} createSourceCodeTextRange(textRange) {var startSourceCodeLocation=this.createSourceCodeLocation(textRange.startLine,textRange.startColumn);var endSourceCodeLocation=this.createSourceCodeLocation(textRange.endLine,textRange.endColumn);return new WebInspector.SourceCodeTextRange(this._sourceMap.originalSourceCode,startSourceCodeLocation,endSourceCodeLocation);}};WebInspector.StackTrace=class StackTrace extends WebInspector.Object {constructor(callFrames,topCallFrameIsBoundary,truncated,parentStackTrace) {super();this._callFrames=callFrames;this._topCallFrameIsBoundary=topCallFrameIsBoundary||false;this._truncated=truncated||false;this._parentStackTrace=parentStackTrace||null;} static fromPayload(target,payload) {let result=null;let previousStackTrace=null;while(payload){let callFrames=payload.callFrames.map((x)=>WebInspector.CallFrame.fromPayload(target,x));let stackTrace=new WebInspector.StackTrace(callFrames,payload.topCallFrameIsBoundary,payload.truncated);if(!result) result=stackTrace;if(previousStackTrace) previousStackTrace._parentStackTrace=stackTrace;previousStackTrace=stackTrace;payload=payload.parentStackTrace;} return result;} static fromString(target,stack) {let callFrames=WebInspector.StackTrace._parseStackTrace(stack);return WebInspector.StackTrace.fromPayload(target,{callFrames});} static isLikelyStackTrace(stack) {const smallestPossibleStackTraceLength="http://a.bc/:9:1".length;if(stack.lengthapproximateStackLengthOf50Items) return false;if(/^[^a-z$_]/i.test(stack[0])) return false;const reasonablyLongLineLength=500;const reasonablyLongNativeMethodLength=120;const stackTraceLine=`(.{1,${reasonablyLongLineLength}}:\\d+:\\d+|eval code|.{1,${reasonablyLongNativeMethodLength}}@\\[native code\\])`;const stackTrace=new RegExp(`^${stackTraceLine}(\\n${stackTraceLine})*$`,"g");return stackTrace.test(stack);} static _parseStackTrace(stack) {var lines=stack.split(/\n/g);var result=[];for(var line of lines){var functionName="";var url="";var lineNumber=0;var columnNumber=0;var atIndex=line.indexOf("@");if(atIndex!==-1){functionName=line.slice(0,atIndex);({url,lineNumber,columnNumber}=WebInspector.StackTrace._parseLocation(line.slice(atIndex+1)));}else if(line.includes("/")) ({url,lineNumber,columnNumber}=WebInspector.StackTrace._parseLocation(line));else functionName=line;result.push({functionName,url,lineNumber,columnNumber});} return result;} static _parseLocation(locationString) {var result={url:"",lineNumber:0,columnNumber:0};var locationRegEx=/(.+?)(?::(\d+)(?::(\d+))?)?$/;var matched=locationString.match(locationRegEx);if(!matched) return result;result.url=matched[1];if(matched[2]) result.lineNumber=parseInt(matched[2]);if(matched[3]) result.columnNumber=parseInt(matched[3]);return result;} get callFrames() {return this._callFrames;} get firstNonNativeCallFrame() {for(let frame of this._callFrames){if(!frame.nativeCode) return frame;} return null;} get firstNonNativeNonAnonymousCallFrame() {for(let frame of this._callFrames){if(frame.nativeCode) continue;if(frame.sourceCodeLocation){let sourceCode=frame.sourceCodeLocation.sourceCode;if(sourceCode instanceof WebInspector.Script&&sourceCode.anonymous) continue;} return frame;} return null;} get topCallFrameIsBoundary(){return this._topCallFrameIsBoundary;} get truncated(){return this._truncated;} get parentStackTrace(){return this._parentStackTrace;}};WebInspector.StructureDescription=class StructureDescription extends WebInspector.Object {constructor(fields,optionalFields,constructorName,prototypeStructure,imprecise) {super();this._fields=fields||null;this._optionalFields=optionalFields||null;this._constructorName=constructorName||"";this._prototypeStructure=prototypeStructure||null;this._imprecise=imprecise||false;} static fromPayload(payload) {if(payload.prototypeStructure) payload.prototypeStructure=WebInspector.StructureDescription.fromPayload(payload.prototypeStructure);return new WebInspector.StructureDescription(payload.fields,payload.optionalFields,payload.constructorName,payload.prototypeStructure,payload.imprecise);} get fields(){return this._fields;} get optionalFields(){return this._optionalFields;} get constructorName(){return this._constructorName;} get prototypeStructure(){return this._prototypeStructure;} get imprecise(){return this._imprecise;}};WebInspector.TextMarker=class TextMarker extends WebInspector.Object {constructor(codeMirrorTextMarker,type) {super();this._codeMirrorTextMarker=codeMirrorTextMarker;codeMirrorTextMarker.__webInspectorTextMarker=this;this._type=type||WebInspector.TextMarker.Type.Plain;} static textMarkerForCodeMirrorTextMarker(codeMirrorTextMarker) {return codeMirrorTextMarker.__webInspectorTextMarker||new WebInspector.TextMarker(codeMirrorTextMarker);} get codeMirrorTextMarker() {return this._codeMirrorTextMarker;} get type() {return this._type;} get range() {var range=this._codeMirrorTextMarker.find();if(!range) return null;return new WebInspector.TextRange(range.from.line,range.from.ch,range.to.line,range.to.ch);} get rects() {var range=this._codeMirrorTextMarker.find();if(!range) return WebInspector.Rect.ZERO_RECT;return this._codeMirrorTextMarker.doc.cm.rectsForRange({start:range.from,end:range.to});} clear() {this._codeMirrorTextMarker.clear();}};WebInspector.TextMarker.Type={Color:"text-marker-type-color",Gradient:"text-marker-type-gradient",Plain:"text-marker-type-plain",CubicBezier:"text-marker-type-cubic-bezier",Spring:"text-marker-type-spring",Variable:"text-marker-type-variable",};WebInspector.TextRange=class TextRange extends WebInspector.Object {constructor(startLineOrStartOffset,startColumnOrEndOffset,endLine,endColumn) {super();if(arguments.length===4){this._startLine=typeof startLineOrStartOffset==="number"?startLineOrStartOffset:NaN;this._startColumn=typeof startColumnOrEndOffset==="number"?startColumnOrEndOffset:NaN;this._endLine=typeof endLine==="number"?endLine:NaN;this._endColumn=typeof endColumn==="number"?endColumn:NaN;this._startOffset=NaN;this._endOffset=NaN;}else if(arguments.length===2){this._startOffset=typeof startLineOrStartOffset==="number"?startLineOrStartOffset:NaN;this._endOffset=typeof startColumnOrEndOffset==="number"?startColumnOrEndOffset:NaN;this._startLine=NaN;this._startColumn=NaN;this._endLine=NaN;this._endColumn=NaN;}} get startLine(){return this._startLine;} get startColumn(){return this._startColumn;} get endLine(){return this._endLine;} get endColumn(){return this._endColumn;} get startOffset(){return this._startOffset;} get endOffset(){return this._endOffset;} startPosition() {return new WebInspector.SourceCodePosition(this._startLine,this._startColumn);} endPosition() {return new WebInspector.SourceCodePosition(this._endLine,this._endColumn);} resolveOffsets(text) {if(typeof text!=="string") return;if(isNaN(this._startLine)||isNaN(this._startColumn)||isNaN(this._endLine)||isNaN(this._endColumn)) return;var lastNewLineOffset=0;for(var i=0;ithis._endLine) return false;if(line===this._startLine&&columnthis._endColumn) return false;return true;}};WebInspector.TimelineMarker=class TimelineMarker extends WebInspector.Object {constructor(time,type,details) {super();this._time=time||0;this._type=type;this._details=details||null;} get time() {return this._time;} set time(x) {x=x||0;if(this._time===x) return;this._time=x;this.dispatchEventToListeners(WebInspector.TimelineMarker.Event.TimeChanged);} get type() {return this._type;} get details() {return this._details;}};WebInspector.TimelineMarker.Event={TimeChanged:"timeline-marker-time-changed"};WebInspector.TimelineMarker.Type={CurrentTime:"current-time",LoadEvent:"load-event",DOMContentEvent:"dom-content-event",TimeStamp:"timestamp"};WebInspector.TimelineRecording=class TimelineRecording extends WebInspector.Object {constructor(identifier,displayName,instruments) {super();this._identifier=identifier;this._timelines=new Map;this._displayName=displayName;this._capturing=false;this._readonly=false;this._instruments=instruments||[];this._topDownCallingContextTree=new WebInspector.CallingContextTree(WebInspector.CallingContextTree.Type.TopDown);this._bottomUpCallingContextTree=new WebInspector.CallingContextTree(WebInspector.CallingContextTree.Type.BottomUp);this._topFunctionsTopDownCallingContextTree=new WebInspector.CallingContextTree(WebInspector.CallingContextTree.Type.TopFunctionsTopDown);this._topFunctionsBottomUpCallingContextTree=new WebInspector.CallingContextTree(WebInspector.CallingContextTree.Type.TopFunctionsBottomUp);for(let type of WebInspector.TimelineManager.availableTimelineTypes()){let timeline=WebInspector.Timeline.create(type);this._timelines.set(type,timeline);timeline.addEventListener(WebInspector.Timeline.Event.TimesUpdated,this._timelineTimesUpdated,this);} this._legacyFirstRecordedTimestamp=NaN;this.reset(true);} static sourceCodeTimelinesSupported() {return WebInspector.debuggableType===WebInspector.DebuggableType.Web;} get displayName(){return this._displayName;} get identifier(){return this._identifier;} get timelines(){return this._timelines;} get instruments(){return this._instruments;} get readonly(){return this._readonly;} get startTime(){return this._startTime;} get endTime(){return this._endTime;} get topDownCallingContextTree(){return this._topDownCallingContextTree;} get bottomUpCallingContextTree(){return this._bottomUpCallingContextTree;} get topFunctionsTopDownCallingContextTree(){return this._topFunctionsTopDownCallingContextTree;} get topFunctionsBottomUpCallingContextTree(){return this._topFunctionsBottomUpCallingContextTree;} start(initiatedByBackend) {this._capturing=true;for(let instrument of this._instruments) instrument.startInstrumentation(initiatedByBackend);} stop(initiatedByBackend) {this._capturing=false;for(let instrument of this._instruments) instrument.stopInstrumentation(initiatedByBackend);} saveIdentityToCookie() { } isEmpty() {for(var timeline of this._timelines.values()){if(timeline.records.length) return false;} return true;} unloaded() {this._readonly=true;this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.Unloaded);} reset(suppressEvents) {this._sourceCodeTimelinesMap=new Map;this._eventMarkers=[];this._startTime=NaN;this._endTime=NaN;this._discontinuities=[];this._topDownCallingContextTree.reset();this._bottomUpCallingContextTree.reset();this._topFunctionsTopDownCallingContextTree.reset();this._topFunctionsBottomUpCallingContextTree.reset();for(var timeline of this._timelines.values()) timeline.reset(suppressEvents);WebInspector.RenderingFrameTimelineRecord.resetFrameIndex();if(!suppressEvents){this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.Reset);this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.TimesUpdated);}} sourceCodeTimelinesForSourceCode(sourceCode) {var timelines=this._sourceCodeTimelinesMap.get(sourceCode);if(!timelines) return[];return[...timelines.values()];} timelineForInstrument(instrument) {return this._timelines.get(instrument.timelineRecordType);} instrumentForTimeline(timeline) {return this._instruments.find((instrument)=>instrument.timelineRecordType===timeline.type);} timelineForRecordType(recordType) {return this._timelines.get(recordType);} addInstrument(instrument) {this._instruments.push(instrument);this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.InstrumentAdded,{instrument});} removeInstrument(instrument) {this._instruments.remove(instrument);this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.InstrumentRemoved,{instrument});} addEventMarker(marker) {if(!this._capturing) return;this._eventMarkers.push(marker);this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.MarkerAdded,{marker});} addRecord(record) {var timeline=this._timelines.get(record.type);if(!timeline) return;timeline.addRecord(record);if(record.type===WebInspector.TimelineRecord.Type.Network||record.type===WebInspector.TimelineRecord.Type.RenderingFrame||record.type===WebInspector.TimelineRecord.Type.Memory||record.type===WebInspector.TimelineRecord.Type.HeapAllocations) return;if(!WebInspector.TimelineRecording.sourceCodeTimelinesSupported()) return;var activeMainResource=WebInspector.frameResourceManager.mainFrame.provisionalMainResource||WebInspector.frameResourceManager.mainFrame.mainResource;var sourceCode=record.sourceCodeLocation?record.sourceCodeLocation.sourceCode:activeMainResource;var sourceCodeTimelines=this._sourceCodeTimelinesMap.get(sourceCode);if(!sourceCodeTimelines){sourceCodeTimelines=new Map;this._sourceCodeTimelinesMap.set(sourceCode,sourceCodeTimelines);} var newTimeline=false;var key=this._keyForRecord(record);var sourceCodeTimeline=sourceCodeTimelines.get(key);if(!sourceCodeTimeline){sourceCodeTimeline=new WebInspector.SourceCodeTimeline(sourceCode,record.sourceCodeLocation,record.type,record.eventType);sourceCodeTimelines.set(key,sourceCodeTimeline);newTimeline=true;} sourceCodeTimeline.addRecord(record);if(newTimeline) this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.SourceCodeTimelineAdded,{sourceCodeTimeline});} addMemoryPressureEvent(memoryPressureEvent) {let memoryTimeline=this._timelines.get(WebInspector.TimelineRecord.Type.Memory);if(!memoryTimeline) return;memoryTimeline.addMemoryPressureEvent(memoryPressureEvent);} addDiscontinuity(startTime,endTime) {this._discontinuities.push({startTime,endTime});} discontinuitiesInTimeRange(startTime,endTime) {return this._discontinuities.filter((item)=>item.startTimestartTime);} addScriptInstrumentForProgrammaticCapture() {for(let instrument of this._instruments){if(instrument instanceof WebInspector.ScriptInstrument) return;} this.addInstrument(new WebInspector.ScriptInstrument);let instrumentTypes=this._instruments.map((instrument)=>instrument.timelineRecordType);WebInspector.timelineManager.enabledTimelineTypes=instrumentTypes;} computeElapsedTime(timestamp) {if(!timestamp||isNaN(timestamp)) return NaN; if(WebInspector.TimelineRecording.isLegacy===undefined) WebInspector.TimelineRecording.isLegacy=timestamp>WebInspector.TimelineRecording.TimestampThresholdForLegacyRecordConversion;if(!WebInspector.TimelineRecording.isLegacy) return timestamp; if(timestamp{this._resolveCallback=resolve;this._rejectCallback=reject; if(work&&typeof work==="function") return work(this.resolve.bind(this),this.reject.bind(this));});} get settled() {return this._settled;} get promise() {return this._promise;} resolve(value) {if(this._settled) throw new Error("Promise is already settled, cannot call resolve().");this._settled=true;this._resolveCallback(value);} reject(value) {if(this._settled) throw new Error("Promise is already settled, cannot call reject().");this._settled=true;this._rejectCallback(value);}};WebInspector.XHRBreakpoint=class XHRBreakpoint extends WebInspector.Object {constructor(type,url,disabled) {super();this._type=type||WebInspector.XHRBreakpoint.Type.Text;this._url=url||"";this._disabled=disabled||false;} get type(){return this._type;} get url(){return this._url;} get disabled() {return this._disabled;} set disabled(disabled) {if(this._disabled===disabled) return;this._disabled=disabled;this.dispatchEventToListeners(WebInspector.XHRBreakpoint.Event.DisabledStateDidChange);} get serializableInfo() {let info={type:this._type,url:this._url};if(this._disabled) info.disabled=true;return info;} saveIdentityToCookie(cookie) {cookie[WebInspector.XHRBreakpoint.URLCookieKey]=this._url;}};WebInspector.XHRBreakpoint.URLCookieKey="xhr-breakpoint-url";WebInspector.XHRBreakpoint.Event={DisabledStateDidChange:"xhr-breakpoint-disabled-state-did-change",ResolvedStateDidChange:"xhr-breakpoint-resolved-state-did-change",};WebInspector.XHRBreakpoint.Type={Text:"text",RegularExpression:"regex",};WebInspector.FormatterWorkerProxy=class FormatterWorkerProxy extends WebInspector.Object {constructor() {super();this._formatterWorker=new Worker("Workers/Formatter/FormatterWorker.js");this._formatterWorker.addEventListener("message",this._handleMessage.bind(this));this._nextCallId=1;this._callbacks=new Map;} static singleton() {if(!FormatterWorkerProxy.instance) FormatterWorkerProxy.instance=new FormatterWorkerProxy;return FormatterWorkerProxy.instance;} formatJavaScript(sourceText,isModule,indentString,includeSourceMapData) {this.performAction("formatJavaScript",...arguments);} performAction(actionName) {let callId=this._nextCallId++;let callback=arguments[arguments.length-1];let actionArguments=Array.prototype.slice.call(arguments,1,arguments.length-1);this._callbacks.set(callId,callback);this._postMessage({callId,actionName,actionArguments});} _postMessage() {this._formatterWorker.postMessage(...arguments);} _handleMessage(event) {let data=event.data;if(data.callId){let callback=this._callbacks.get(data.callId);this._callbacks.delete(data.callId);callback(data.result);return;} console.error("Unexpected FormatterWorker message",data);}};WebInspector.HeapSnapshotDiffProxy=class HeapSnapshotDiffProxy extends WebInspector.Object {constructor(snapshotDiffObjectId,snapshot1,snapshot2,totalSize,totalObjectCount,categories) {super();this._proxyObjectId=snapshotDiffObjectId;this._snapshot1=snapshot1;this._snapshot2=snapshot2;this._totalSize=totalSize;this._totalObjectCount=totalObjectCount;this._categories=Map.fromObject(categories);} static deserialize(objectId,serializedSnapshotDiff) {let{snapshot1:serializedSnapshot1,snapshot2:serializedSnapshot2,totalSize,totalObjectCount,categories}=serializedSnapshotDiff; let snapshot1=WebInspector.HeapSnapshotProxy.deserialize(objectId,serializedSnapshot1);let snapshot2=WebInspector.HeapSnapshotProxy.deserialize(objectId,serializedSnapshot2);return new WebInspector.HeapSnapshotDiffProxy(objectId,snapshot1,snapshot2,totalSize,totalObjectCount,categories);} get snapshot1(){return this._snapshot1;} get snapshot2(){return this._snapshot2;} get totalSize(){return this._totalSize;} get totalObjectCount(){return this._totalObjectCount;} get categories(){return this._categories;} get invalid(){return this._snapshot1.invalid||this._snapshot2.invalid;} updateForCollectionEvent(event) {if(!event.data.affectedSnapshots.includes(this._snapshot2._identifier)) return;this.update(()=>{this.dispatchEventToListeners(WebInspector.HeapSnapshotProxy.Event.CollectedNodes,event.data);});} allocationBucketCounts(bucketSizes,callback) {WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"allocationBucketCounts",bucketSizes,callback);} instancesWithClassName(className,callback) {WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"instancesWithClassName",className,(serializedNodes)=>{callback(serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null,this._proxyObjectId)));});} update(callback) {WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"update",({liveSize,categories})=>{this._categories=Map.fromObject(categories);callback();});} nodeWithIdentifier(nodeIdentifier,callback) {WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"nodeWithIdentifier",nodeIdentifier,(serializedNode)=>{callback(WebInspector.HeapSnapshotNodeProxy.deserialize(this._proxyObjectId,serializedNode));});}};WebInspector.HeapSnapshotEdgeProxy=class HeapSnapshotEdgeProxy {constructor(objectId,fromIdentifier,toIdentifier,type,data) {this._proxyObjectId=objectId;this.fromIdentifier=fromIdentifier;this.toIdentifier=toIdentifier;this.type=type;this.data=data;this.from=null;this.to=null;} isPrivateSymbol() {if(WebInspector.isDebugUIEnabled()) return false;return typeof this.data==="string"&&this.data.startsWith("PrivateSymbol");} static deserialize(objectId,serializedEdge) {let{from,to,type,data}=serializedEdge;return new WebInspector.HeapSnapshotEdgeProxy(objectId,from,to,type,data);}};WebInspector.HeapSnapshotEdgeProxy.EdgeType={Internal:"Internal",Property:"Property",Index:"Index",Variable:"Variable",};WebInspector.HeapSnapshotNodeProxy=class HeapSnapshotNodeProxy {constructor(snapshotObjectId,identifier,className,size,retainedSize,internal,gcRoot,dead,dominatorNodeIdentifier,hasChildren) {this._proxyObjectId=snapshotObjectId;this.id=identifier;this.className=className;this.size=size;this.retainedSize=retainedSize;this.internal=internal;this.gcRoot=gcRoot;this.dead=dead;this.dominatorNodeIdentifier=dominatorNodeIdentifier;this.hasChildren=hasChildren;} static deserialize(objectId,serializedNode) {let{id,className,size,retainedSize,internal,gcRoot,dead,dominatorNodeIdentifier,hasChildren}=serializedNode;return new WebInspector.HeapSnapshotNodeProxy(objectId,id,className,size,retainedSize,internal,gcRoot,dead,dominatorNodeIdentifier,hasChildren);} shortestGCRootPath(callback) {WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"shortestGCRootPath",this.id,(serializedPath)=>{let isNode=false;let path=serializedPath.map((component)=>{isNode=!isNode;if(isNode) return WebInspector.HeapSnapshotNodeProxy.deserialize(this._proxyObjectId,component);return WebInspector.HeapSnapshotEdgeProxy.deserialize(this._proxyObjectId,component);});for(let i=1;i{callback(serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null,this._proxyObjectId)));});} retainedNodes(callback) {WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"retainedNodes",this.id,({retainedNodes:serializedNodes,edges:serializedEdges})=>{let deserializedNodes=serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null,this._proxyObjectId));let deserializedEdges=serializedEdges.map(WebInspector.HeapSnapshotEdgeProxy.deserialize.bind(null,this._proxyObjectId));callback(deserializedNodes,deserializedEdges);});} retainers(callback) {WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"retainers",this.id,({retainers:serializedNodes,edges:serializedEdges})=>{let deserializedNodes=serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null,this._proxyObjectId));let deserializedEdges=serializedEdges.map(WebInspector.HeapSnapshotEdgeProxy.deserialize.bind(null,this._proxyObjectId));callback(deserializedNodes,deserializedEdges);});}};WebInspector.HeapSnapshotProxy=class HeapSnapshotProxy extends WebInspector.Object {constructor(snapshotObjectId,identifier,title,totalSize,totalObjectCount,liveSize,categories) {super();this._proxyObjectId=snapshotObjectId;this._identifier=identifier;this._title=title;this._totalSize=totalSize;this._totalObjectCount=totalObjectCount;this._liveSize=liveSize;this._categories=Map.fromObject(categories);if(!WebInspector.HeapSnapshotProxy.ValidSnapshotProxies) WebInspector.HeapSnapshotProxy.ValidSnapshotProxies=[];WebInspector.HeapSnapshotProxy.ValidSnapshotProxies.push(this);} static deserialize(objectId,serializedSnapshot) {let{identifier,title,totalSize,totalObjectCount,liveSize,categories}=serializedSnapshot;return new WebInspector.HeapSnapshotProxy(objectId,identifier,title,totalSize,totalObjectCount,liveSize,categories);} static invalidateSnapshotProxies() {if(!WebInspector.HeapSnapshotProxy.ValidSnapshotProxies) return;for(let snapshotProxy of WebInspector.HeapSnapshotProxy.ValidSnapshotProxies) snapshotProxy._invalidate();WebInspector.HeapSnapshotProxy.ValidSnapshotProxies=null;} get proxyObjectId(){return this._proxyObjectId;} get identifier(){return this._identifier;} get title(){return this._title;} get totalSize(){return this._totalSize;} get totalObjectCount(){return this._totalObjectCount;} get liveSize(){return this._liveSize;} get categories(){return this._categories;} get invalid(){return this._proxyObjectId===0;} updateForCollectionEvent(event) {if(!event.data.affectedSnapshots.includes(this._identifier)) return;this.update(()=>{this.dispatchEventToListeners(WebInspector.HeapSnapshotProxy.Event.CollectedNodes,event.data);});} allocationBucketCounts(bucketSizes,callback) {WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"allocationBucketCounts",bucketSizes,callback);} instancesWithClassName(className,callback) {WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"instancesWithClassName",className,(serializedNodes)=>{callback(serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null,this._proxyObjectId)));});} update(callback) {WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"update",({liveSize,categories})=>{this._liveSize=liveSize;this._categories=Map.fromObject(categories);callback();});} nodeWithIdentifier(nodeIdentifier,callback) {WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"nodeWithIdentifier",nodeIdentifier,(serializedNode)=>{callback(WebInspector.HeapSnapshotNodeProxy.deserialize(this._proxyObjectId,serializedNode));});} _invalidate() {this._proxyObjectId=0;this._liveSize=0;this.dispatchEventToListeners(WebInspector.HeapSnapshotProxy.Event.Invalidated);}};WebInspector.HeapSnapshotProxy.Event={CollectedNodes:"heap-snapshot-proxy-collected-nodes",Invalidated:"heap-snapshot-proxy-invalidated",};WebInspector.HeapSnapshotWorkerProxy=class HeapSnapshotWorkerProxy extends WebInspector.Object {constructor() {super();this._heapSnapshotWorker=new Worker("Workers/HeapSnapshot/HeapSnapshotWorker.js");this._heapSnapshotWorker.addEventListener("message",this._handleMessage.bind(this));this._nextCallId=1;this._callbacks=new Map;WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);} static singleton() {if(!HeapSnapshotWorkerProxy.instance) HeapSnapshotWorkerProxy.instance=new HeapSnapshotWorkerProxy;return HeapSnapshotWorkerProxy.instance;} clearSnapshots(callback) {this.performAction("clearSnapshots",callback);} createSnapshot(snapshotStringData,callback) {this.performAction("createSnapshot",...arguments);} createSnapshotDiff(objectId1,objectId2,callback) {this.performAction("createSnapshotDiff",...arguments);} performAction(actionName) {let callId=this._nextCallId++;let callback=arguments[arguments.length-1];let actionArguments=Array.prototype.slice.call(arguments,1,arguments.length-1);this._callbacks.set(callId,callback);this._postMessage({callId,actionName,actionArguments});} callMethod(objectId,methodName) {let callId=this._nextCallId++;let callback=arguments[arguments.length-1];let methodArguments=Array.prototype.slice.call(arguments,2,arguments.length-1);this._callbacks.set(callId,callback);this._postMessage({callId,objectId,methodName,methodArguments});} _mainResourceDidChange(event) {if(!event.target.isMainFrame()) return;this.clearSnapshots(()=>{WebInspector.HeapSnapshotProxy.invalidateSnapshotProxies();});} _postMessage() {this._heapSnapshotWorker.postMessage(...arguments);} _handleMessage(event) {let data=event.data;if(data.error){this._callbacks.delete(data.callId);return;} if(data.eventName){this.dispatchEventToListeners(data.eventName,data.eventData);return;} if(data.callId){let callback=this._callbacks.get(data.callId);this._callbacks.delete(data.callId);callback(data.result);return;} console.error("Unexpected HeapSnapshotWorker message",data);}};WebInspector.View=class View extends WebInspector.Object {constructor(element) {super();this._element=element||document.createElement("div");this._element.__view=this;this._parentView=null;this._subviews=[];this._dirty=false;this._dirtyDescendantsCount=0;this._needsLayoutWhenAttachedToRoot=false;this._isAttachedToRoot=false;this._layoutReason=null;this._didInitialLayout=false;} static rootView() {if(!WebInspector.View._rootView) WebInspector.View._rootView=new WebInspector.View(document.body);return WebInspector.View._rootView;} get element() {return this._element;} get layoutPending() {return this._dirty;} get parentView() {return this._parentView;} get subviews() {return this._subviews;} isDescendantOf(view) {let parentView=this._parentView;while(parentView){if(parentView===view) return true;parentView=parentView.parentView;} return false;} addSubview(view) {this.insertSubviewBefore(view,null);} insertSubviewBefore(view,referenceView) {if(this._subviews.includes(view)){return;} const beforeIndex=referenceView?this._subviews.indexOf(referenceView):this._subviews.length;if(beforeIndex===-1){return;} this._subviews.insertAtIndex(view,beforeIndex);if(!view.element.parentNode) this._element.insertBefore(view.element,referenceView?referenceView.element:null);view.didMoveToParent(this);} removeSubview(view) {if(!this._subviews.includes(view)){return;} this._subviews.remove(view,true);this._element.removeChild(view.element);view.didMoveToParent(null);} replaceSubview(oldView,newView) {this.insertSubviewBefore(newView,oldView);this.removeSubview(oldView);} updateLayout(layoutReason) {this.cancelLayout();this._setLayoutReason(layoutReason);this._layoutSubtree();} updateLayoutIfNeeded(layoutReason) {if(!this._dirty&&this._didInitialLayout) return;this.updateLayout(layoutReason);} needsLayout(layoutReason) {this._setLayoutReason(layoutReason);if(this._dirty) return;WebInspector.View._scheduleLayoutForView(this);} cancelLayout() {WebInspector.View._cancelScheduledLayoutForView(this);} get layoutReason(){return this._layoutReason;} didMoveToWindow(isAttachedToRoot) {this._isAttachedToRoot=isAttachedToRoot;if(this._isAttachedToRoot&&this._needsLayoutWhenAttachedToRoot){WebInspector.View._scheduleLayoutForView(this);this._needsLayoutWhenAttachedToRoot=false;} for(let view of this._subviews) view.didMoveToWindow(isAttachedToRoot);} didMoveToParent(parentView) {this._parentView=parentView;let isAttachedToRoot=this.isDescendantOf(WebInspector.View._rootView);this.didMoveToWindow(isAttachedToRoot);if(!this._parentView) return;let pendingLayoutsCount=this._dirtyDescendantsCount;if(this._dirty) pendingLayoutsCount++;let view=this._parentView;while(view){view._dirtyDescendantsCount+=pendingLayoutsCount;view=view.parentView;}} initialLayout() { } layout() {} sizeDidChange() {} _layoutSubtree() {this._dirty=false;this._dirtyDescendantsCount=0;if(!this._didInitialLayout){this.initialLayout();this._didInitialLayout=true;} if(this._layoutReason===WebInspector.View.LayoutReason.Resize) this.sizeDidChange();this.layout();for(let view of this._subviews){view._setLayoutReason(this._layoutReason);view._layoutSubtree();} this._layoutReason=null;} _setLayoutReason(layoutReason) {if(this._layoutReason===WebInspector.View.LayoutReason.Resize) return;this._layoutReason=layoutReason||WebInspector.View.LayoutReason.Dirty;} static _scheduleLayoutForView(view) {view._dirty=true;let parentView=view.parentView;while(parentView){parentView._dirtyDescendantsCount++;parentView=parentView.parentView;} if(!view._isAttachedToRoot){view._needsLayoutWhenAttachedToRoot=true;return;} if(WebInspector.View._scheduledLayoutUpdateIdentifier) return;WebInspector.View._scheduledLayoutUpdateIdentifier=requestAnimationFrame(WebInspector.View._visitViewTreeForLayout);} static _cancelScheduledLayoutForView(view) {let cancelledLayoutsCount=view._dirtyDescendantsCount;if(view.layoutPending) cancelledLayoutsCount++;let parentView=view.parentView;while(parentView){parentView._dirtyDescendantsCount=Math.max(0,parentView._dirtyDescendantsCount-cancelledLayoutsCount);parentView=parentView.parentView;} if(!WebInspector.View._scheduledLayoutUpdateIdentifier) return;let rootView=WebInspector.View._rootView;if(!rootView||rootView._dirtyDescendantsCount) return;cancelAnimationFrame(WebInspector.View._scheduledLayoutUpdateIdentifier);WebInspector.View._scheduledLayoutUpdateIdentifier=undefined;} static _visitViewTreeForLayout() {WebInspector.View._scheduledLayoutUpdateIdentifier=undefined;let views=[WebInspector.View._rootView];while(views.length){let view=views.shift();if(view.layoutPending) view._layoutSubtree();else if(view._dirtyDescendantsCount){views=views.concat(view.subviews);view._dirtyDescendantsCount=0;}}}};WebInspector.View.LayoutReason={Dirty:Symbol("layout-reason-dirty"),Resize:Symbol("layout-reason-resize")};WebInspector.View._rootView=null;WebInspector.View._scheduledLayoutUpdateIdentifier=undefined;WebInspector.ConsoleCommandView=class ConsoleCommandView extends WebInspector.Object {constructor(commandText,className) {super();this._commandText=commandText;this._className=className||"";} render() {this._element=document.createElement("div");this._element.classList.add("console-user-command");this._element.setAttribute("data-labelprefix",WebInspector.UIString("Input: "));if(this._className) this._element.classList.add(this._className);this._formattedCommandElement=this._element.appendChild(document.createElement("span"));this._formattedCommandElement.classList.add("console-message-text");this._formattedCommandElement.textContent=this._commandText; this._element.__commandView=this;} get element() {return this._element;} get commandText() {return this._commandText;} toClipboardString(isPrefixOptional) {return(isPrefixOptional?"":"> ")+this._commandText.removeWordBreakCharacters();}};WebInspector.ConsoleMessageView=class ConsoleMessageView extends WebInspector.Object {constructor(message) {super();this._message=message;this._expandable=false;this._repeatCount=message._repeatCount||0;this._extraParameters=message.parameters;} render() {this._element=document.createElement("div");this._element.classList.add("console-message"); this._element.__message=this._message;this._element.__messageView=this;if(this._message.type===WebInspector.ConsoleMessage.MessageType.Result){this._element.classList.add("console-user-command-result");this._element.setAttribute("data-labelprefix",WebInspector.UIString("Output: "));}else if(this._message.type===WebInspector.ConsoleMessage.MessageType.StartGroup||this._message.type===WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed) this._element.classList.add("console-group-title");switch(this._message.level){case WebInspector.ConsoleMessage.MessageLevel.Log:this._element.classList.add("console-log-level");this._element.setAttribute("data-labelprefix",WebInspector.UIString("Log: "));break;case WebInspector.ConsoleMessage.MessageLevel.Info:this._element.classList.add("console-info-level");this._element.setAttribute("data-labelprefix",WebInspector.UIString("Info: "));break;case WebInspector.ConsoleMessage.MessageLevel.Debug:this._element.classList.add("console-debug-level");this._element.setAttribute("data-labelprefix",WebInspector.UIString("Debug: "));break;case WebInspector.ConsoleMessage.MessageLevel.Warning:this._element.classList.add("console-warning-level");this._element.setAttribute("data-labelprefix",WebInspector.UIString("Warning: "));break;case WebInspector.ConsoleMessage.MessageLevel.Error:this._element.classList.add("console-error-level");this._element.setAttribute("data-labelprefix",WebInspector.UIString("Error: "));break;} this._appendLocationLink();this._messageTextElement=this._element.appendChild(document.createElement("span"));this._messageTextElement.classList.add("console-top-level-message");this._messageTextElement.classList.add("console-message-text");this._appendMessageTextAndArguments(this._messageTextElement);this._appendSavedResultIndex();this._appendExtraParameters();this._appendStackTrace();this._renderRepeatCount();} get element() {return this._element;} get message() {return this._message;} get repeatCount() {return this._repeatCount;} set repeatCount(count) {if(this._repeatCount===count) return;this._repeatCount=count;if(this._element) this._renderRepeatCount();} _renderRepeatCount() {let count=this._repeatCount;if(count<=1){if(this._repeatCountElement){this._repeatCountElement.remove();this._repeatCountElement=null;} return;} if(!this._repeatCountElement){this._repeatCountElement=document.createElement("span");this._repeatCountElement.classList.add("repeat-count");this._element.insertBefore(this._repeatCountElement,this._element.firstChild);} this._repeatCountElement.textContent=Number.abbreviate(count);} get expandable() {if(this._expandable) return true;if(this._objectTree) return true;return false;} expand() {if(this._expandable) this._element.classList.add("expanded");if(this._objectTree&&this._message.type!==WebInspector.ConsoleMessage.MessageType.Trace){if(!this._extraParameters||this._extraParameters.length<=1) this._objectTree.expand();}} collapse() {if(this._expandable) this._element.classList.remove("expanded");if(this._objectTree){if(!this._extraParameters||this._extraParameters.length<=1) this._objectTree.collapse();}} toggle() {if(this._element.classList.contains("expanded")) this.collapse();else this.expand();} toClipboardString(isPrefixOptional) {let clipboardString=this._messageTextElement.innerText.removeWordBreakCharacters();if(this._message.savedResultIndex) clipboardString=clipboardString.replace(/\s*=\s*(\$\d+)$/,"");let hasStackTrace=this._shouldShowStackTrace();if(!hasStackTrace){let repeatString=this.repeatCount>1?"x"+this.repeatCount:"";let urlLine="";if(this._message.url){let components=[WebInspector.displayNameForURL(this._message.url),"line "+this._message.line];if(repeatString) components.push(repeatString);urlLine=" ("+components.join(", ")+")";}else if(repeatString) urlLine=" ("+repeatString+")";if(urlLine){let lines=clipboardString.split("\n");lines[0]+=urlLine;clipboardString=lines.join("\n");}} if(this._extraElementsList) clipboardString+="\n"+this._extraElementsList.innerText.removeWordBreakCharacters().trim();if(hasStackTrace){this._message.stackTrace.callFrames.forEach(function(frame){clipboardString+="\n\t"+(frame.functionName||WebInspector.UIString("(anonymous function)"));if(frame.sourceCodeLocation) clipboardString+=" ("+frame.sourceCodeLocation.originalLocationString()+")";});} if(!isPrefixOptional||this._enforcesClipboardPrefixString()) return this._clipboardPrefixString()+clipboardString;return clipboardString;} _appendMessageTextAndArguments(element) {if(this._message.source===WebInspector.ConsoleMessage.MessageSource.ConsoleAPI){switch(this._message.type){case WebInspector.ConsoleMessage.MessageType.Trace:var args=[WebInspector.UIString("Trace")];if(this._message.parameters){if(this._message.parameters[0].type==="string"){var prefixedFormatString=WebInspector.UIString("Trace: %s").format(this._message.parameters[0].description);args=[prefixedFormatString].concat(this._message.parameters.slice(1));}else args=args.concat(this._message.parameters);} this._appendFormattedArguments(element,args);break;case WebInspector.ConsoleMessage.MessageType.Assert:var args=[WebInspector.UIString("Assertion Failed")];if(this._message.parameters){if(this._message.parameters[0].type==="string"){var prefixedFormatString=WebInspector.UIString("Assertion Failed: %s").format(this._message.parameters[0].description);args=[prefixedFormatString].concat(this._message.parameters.slice(1));}else args=args.concat(this._message.parameters);} this._appendFormattedArguments(element,args);break;case WebInspector.ConsoleMessage.MessageType.Dir:var obj=this._message.parameters?this._message.parameters[0]:undefined;this._appendFormattedArguments(element,["%O",obj]);break;case WebInspector.ConsoleMessage.MessageType.Table:var args=this._message.parameters;element.appendChild(this._formatParameterAsTable(args));this._extraParameters=null;break;case WebInspector.ConsoleMessage.MessageType.StartGroup:case WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed:var args=this._message.parameters||[this._message.messageText||WebInspector.UIString("Group")];this._formatWithSubstitutionString(args,element);this._extraParameters=null;break;default:var args=this._message.parameters||[this._message.messageText];this._appendFormattedArguments(element,args);break;} return;} var args=this._message.parameters||[this._message.messageText];this._appendFormattedArguments(element,args);} _appendSavedResultIndex(element) {if(!this._message.savedResultIndex) return;var savedVariableElement=document.createElement("span");savedVariableElement.classList.add("console-saved-variable");savedVariableElement.textContent=" = $"+this._message.savedResultIndex;if(this._objectTree) this._objectTree.appendTitleSuffix(savedVariableElement);else this._messageTextElement.appendChild(savedVariableElement);} _appendLocationLink() {if(this._message.source===WebInspector.ConsoleMessage.MessageSource.Network){if(this._message.url){var anchor=WebInspector.linkifyURLAsNode(this._message.url,this._message.url,"console-message-url");anchor.classList.add("console-message-location");this._element.appendChild(anchor);} return;} var firstNonNativeNonAnonymousCallFrame=this._message.stackTrace.firstNonNativeNonAnonymousCallFrame;var callFrame;if(firstNonNativeNonAnonymousCallFrame){callFrame=firstNonNativeNonAnonymousCallFrame;}else if(this._message.url&&!this._shouldHideURL(this._message.url)){callFrame=WebInspector.CallFrame.fromPayload(this._message.target,{functionName:"",url:this._message.url,lineNumber:this._message.line,columnNumber:this._message.column});} if(callFrame&&(!callFrame.isConsoleEvaluation||WebInspector.isDebugUIEnabled())){const showFunctionName=!!callFrame.functionName;var locationElement=new WebInspector.CallFrameView(callFrame,showFunctionName);locationElement.classList.add("console-message-location");this._element.appendChild(locationElement);return;} if(this._message.parameters&&this._message.parameters.length===1){var parameter=this._createRemoteObjectIfNeeded(this._message.parameters[0]);parameter.findFunctionSourceCodeLocation().then(function(result){if(result===WebInspector.RemoteObject.SourceCodeLocationPromise.NoSourceFound||result===WebInspector.RemoteObject.SourceCodeLocationPromise.MissingObjectId) return;var link=this._linkifyLocation(result.sourceCode.url,result.lineNumber,result.columnNumber);link.classList.add("console-message-location");if(this._element.hasChildNodes()) this._element.insertBefore(link,this._element.firstChild);else this._element.appendChild(link);}.bind(this));}} _appendExtraParameters() {if(!this._extraParameters||!this._extraParameters.length) return;this._makeExpandable();if(this._extraParameters.length>1) this.expand();this._extraElementsList=this._element.appendChild(document.createElement("ol"));this._extraElementsList.classList.add("console-message-extra-parameters-container");for(var parameter of this._extraParameters){var listItemElement=this._extraElementsList.appendChild(document.createElement("li"));const forceObjectFormat=parameter.type==="object"&&(parameter.subtype!=="null"&¶meter.subtype!=="regexp"&¶meter.subtype!=="node"&¶meter.subtype!=="error");listItemElement.classList.add("console-message-extra-parameter");listItemElement.appendChild(this._formatParameter(parameter,forceObjectFormat));}} _appendStackTrace() {if(!this._shouldShowStackTrace()) return;this._makeExpandable();if(this._message.type===WebInspector.ConsoleMessage.MessageType.Trace) this.expand();this._stackTraceElement=this._element.appendChild(document.createElement("div"));this._stackTraceElement.classList.add("console-message-text","console-message-stack-trace-container");var callFramesElement=new WebInspector.StackTraceView(this._message.stackTrace).element;this._stackTraceElement.appendChild(callFramesElement);} _createRemoteObjectIfNeeded(parameter) {if(parameter instanceof WebInspector.RemoteObject) return parameter;if(typeof parameter==="object") return WebInspector.RemoteObject.fromPayload(parameter,this._message.target);return WebInspector.RemoteObject.fromPrimitiveValue(parameter);} _appendFormattedArguments(element,parameters) {if(!parameters.length) return;for(var i=0;imaxLength||description.slice(0,maxLength).includes("\n");return!longOrMultiLineString;} return object.type!=="object"||object.subtype==="null"||object.subtype==="regexp";} _formatParameter(parameter,forceObjectFormat) {var type;if(forceObjectFormat) type="object";else if(parameter instanceof WebInspector.RemoteObject) type=parameter.subtype||parameter.type;else{type=typeof parameter;} var formatters={"object":this._formatParameterAsObject,"error":this._formatParameterAsError,"map":this._formatParameterAsObject,"set":this._formatParameterAsObject,"weakmap":this._formatParameterAsObject,"weakset":this._formatParameterAsObject,"iterator":this._formatParameterAsObject,"class":this._formatParameterAsObject,"proxy":this._formatParameterAsObject,"array":this._formatParameterAsArray,"node":this._formatParameterAsNode,"string":this._formatParameterAsString,};var formatter=formatters[type]||this._formatParameterAsValue;const fragment=document.createDocumentFragment();formatter.call(this,parameter,fragment,forceObjectFormat);return fragment;} _formatParameterAsValue(value,fragment) {fragment.appendChild(WebInspector.FormattedValue.createElementForRemoteObject(value));} _formatParameterAsString(object,fragment) {if(this._isStackTrace(object)){let stackTrace=WebInspector.StackTrace.fromString(this._message.target,object.description);if(stackTrace.callFrames.length){let stackView=new WebInspector.StackTraceView(stackTrace);fragment.appendChild(stackView.element);return;}} fragment.appendChild(WebInspector.FormattedValue.createLinkifiedElementString(object.description));} _formatParameterAsNode(object,fragment) {fragment.appendChild(WebInspector.FormattedValue.createElementForNode(object));} _formatParameterAsObject(object,fragment,forceExpansion) {this._objectTree=new WebInspector.ObjectTreeView(object,null,this._rootPropertyPathForObject(object),forceExpansion);fragment.appendChild(this._objectTree.element);} _formatParameterAsError(object,fragment) {this._objectTree=new WebInspector.ErrorObjectView(object);fragment.appendChild(this._objectTree.element);} _formatParameterAsArray(array,fragment) {this._objectTree=new WebInspector.ObjectTreeView(array,WebInspector.ObjectTreeView.Mode.Properties,this._rootPropertyPathForObject(array));fragment.appendChild(this._objectTree.element);} _rootPropertyPathForObject(object) {if(!this._message.savedResultIndex) return null;return new WebInspector.PropertyPath(object,"$"+this._message.savedResultIndex);} _formatWithSubstitutionString(parameters,formattedResult) {function parameterFormatter(force,obj) {return this._formatParameter(obj,force);} function stringFormatter(obj) {return obj.description;} function floatFormatter(obj,token) {let value=typeof obj.value==="number"?obj.value:obj.description;return String.standardFormatters.f(value,token);} function integerFormatter(obj) {let value=typeof obj.value==="number"?obj.value:obj.description;return String.standardFormatters.d(value);} var currentStyle=null;function styleFormatter(obj) {currentStyle={};var buffer=document.createElement("span");buffer.setAttribute("style",obj.description);for(var i=0;i{this.goBack();};let goForward=()=>{this.goForward();};let backShortcutKey=isRTL?WebInspector.KeyboardShortcut.Key.Right:WebInspector.KeyboardShortcut.Key.Left;let forwardShortcutKey=isRTL?WebInspector.KeyboardShortcut.Key.Left:WebInspector.KeyboardShortcut.Key.Right;this._backKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Control,backShortcutKey,goBack,this.element);this._forwardKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Control,forwardShortcutKey,goForward,this.element);let leftArrow="Images/BackForwardArrows.svg#left-arrow-mask";let rightArrow="Images/BackForwardArrows.svg#right-arrow-mask";let backButtonImage=isRTL?rightArrow:leftArrow;let forwardButtonImage=isRTL?leftArrow:rightArrow;this._backNavigationItem=new WebInspector.ButtonNavigationItem("back",WebInspector.UIString("Back (%s)").format(this._backKeyboardShortcut.displayName),backButtonImage,8,13);this._backNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,goBack);this._backNavigationItem.enabled=false;this._navigationBar.addNavigationItem(this._backNavigationItem);this._forwardNavigationItem=new WebInspector.ButtonNavigationItem("forward",WebInspector.UIString("Forward (%s)").format(this._forwardKeyboardShortcut.displayName),forwardButtonImage,8,13);this._forwardNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,goForward);this._forwardNavigationItem.enabled=false;this._navigationBar.addNavigationItem(this._forwardNavigationItem);this._navigationBar.addNavigationItem(new WebInspector.DividerNavigationItem);} if(!disableFindBanner){this._findBanner=new WebInspector.FindBanner(this);this._findBanner.addEventListener(WebInspector.FindBanner.Event.DidShow,this._findBannerDidShow,this);this._findBanner.addEventListener(WebInspector.FindBanner.Event.DidHide,this._findBannerDidHide,this);} this._hierarchicalPathNavigationItem=new WebInspector.HierarchicalPathNavigationItem;this._hierarchicalPathNavigationItem.addEventListener(WebInspector.HierarchicalPathNavigationItem.Event.PathComponentWasSelected,this._hierarchicalPathComponentWasSelected,this);this._navigationBar.addNavigationItem(this._hierarchicalPathNavigationItem);this._contentViewSelectionPathNavigationItem=new WebInspector.HierarchicalPathNavigationItem;this._dividingFlexibleSpaceNavigationItem=new WebInspector.FlexibleSpaceNavigationItem;this._navigationBar.addNavigationItem(this._dividingFlexibleSpaceNavigationItem);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange,this._contentViewSelectionPathComponentDidChange,this);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange,this._contentViewSupplementalRepresentedObjectsDidChange,this);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange,this._contentViewNumberOfSearchResultsDidChange,this);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange,this._contentViewNavigationItemsDidChange,this);this._delegate=delegate||null;this._currentContentViewNavigationItems=[];} get navigationBar() {return this._navigationBar;} get contentViewContainer() {return this._contentViewContainer;} get delegate() {return this._delegate;} set delegate(newDelegate) {this._delegate=newDelegate||null;} get currentContentView() {return this._contentViewContainer.currentContentView;} get currentRepresentedObjects() {var representedObjects=[];var lastComponent=this._hierarchicalPathNavigationItem.lastComponent;if(lastComponent&&lastComponent.representedObject) representedObjects.push(lastComponent.representedObject);lastComponent=this._contentViewSelectionPathNavigationItem.lastComponent;if(lastComponent&&lastComponent.representedObject) representedObjects.push(lastComponent.representedObject);var currentContentView=this.currentContentView;if(currentContentView){var supplementalRepresentedObjects=currentContentView.supplementalRepresentedObjects;if(supplementalRepresentedObjects&&supplementalRepresentedObjects.length) representedObjects=representedObjects.concat(supplementalRepresentedObjects);} return representedObjects;} showContentViewForRepresentedObject(representedObject,cookie,extraArguments) {var contentView=this.contentViewForRepresentedObject(representedObject,false,extraArguments);return this._contentViewContainer.showContentView(contentView,cookie);} showContentView(contentView,cookie) {return this._contentViewContainer.showContentView(contentView,cookie);} contentViewForRepresentedObject(representedObject,onlyExisting,extraArguments) {return this._contentViewContainer.contentViewForRepresentedObject(representedObject,onlyExisting,extraArguments);} updateHierarchicalPathForCurrentContentView() {var currentContentView=this.currentContentView;this._updateHierarchicalPathNavigationItem(currentContentView?currentContentView.representedObject:null);} canGoBack() {var currentContentView=this.currentContentView;if(currentContentView&¤tContentView.canGoBack()) return true;return this._contentViewContainer.canGoBack();} canGoForward() {var currentContentView=this.currentContentView;if(currentContentView&¤tContentView.canGoForward()) return true;return this._contentViewContainer.canGoForward();} goBack() {var currentContentView=this.currentContentView;if(currentContentView&¤tContentView.canGoBack()){currentContentView.goBack();this._updateBackForwardButtons();return;} this._contentViewContainer.goBack();} goForward() {var currentContentView=this.currentContentView;if(currentContentView&¤tContentView.canGoForward()){currentContentView.goForward();this._updateBackForwardButtons();return;} this._contentViewContainer.goForward();} showFindBanner() {if(!this._findBanner) return;var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return;if(currentContentView.supportsCustomFindBanner){currentContentView.showCustomFindBanner();return;} this._findBanner.show();} findBannerPerformSearch(findBanner,query) {var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return;currentContentView.performSearch(query);} findBannerSearchCleared(findBanner) {var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return;currentContentView.searchCleared();} findBannerSearchQueryForSelection(findBanner) {var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return null;return currentContentView.searchQueryWithSelection();} findBannerRevealPreviousResult(findBanner) {var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return;currentContentView.revealPreviousSearchResult(!findBanner.showing);} findBannerRevealNextResult(findBanner) {var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return;currentContentView.revealNextSearchResult(!findBanner.showing);} shown() {this._contentViewContainer.shown();if(this._findBanner) this._findBanner.enableKeyboardShortcuts();} hidden() {this._contentViewContainer.hidden();if(this._findBanner) this._findBanner.disableKeyboardShortcuts();} _findBannerDidShow(event) {var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return;currentContentView.automaticallyRevealFirstSearchResult=true;if(this._findBanner.searchQuery!=="") currentContentView.performSearch(this._findBanner.searchQuery);} _findBannerDidHide(event) {var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return;currentContentView.automaticallyRevealFirstSearchResult=false;currentContentView.searchCleared();} _contentViewNumberOfSearchResultsDidChange(event) {if(!this._findBanner) return;if(event.target!==this.currentContentView) return;this._findBanner.numberOfResults=this.currentContentView.numberOfSearchResults;} _updateHierarchicalPathNavigationItem(representedObject) {if(!this.delegate||typeof this.delegate.contentBrowserTreeElementForRepresentedObject!=="function") return;var treeElement=representedObject?this.delegate.contentBrowserTreeElementForRepresentedObject(this,representedObject):null;var pathComponents=[];while(treeElement&&!treeElement.root){var pathComponent=new WebInspector.GeneralTreeElementPathComponent(treeElement);pathComponents.unshift(pathComponent);treeElement=treeElement.parent;} this._hierarchicalPathNavigationItem.components=pathComponents;} _updateContentViewSelectionPathNavigationItem(contentView) {var selectionPathComponents=contentView?contentView.selectionPathComponents||[]:[];this._contentViewSelectionPathNavigationItem.components=selectionPathComponents;if(!selectionPathComponents.length){this._hierarchicalPathNavigationItem.alwaysShowLastPathComponentSeparator=false;this._navigationBar.removeNavigationItem(this._contentViewSelectionPathNavigationItem);return;} if(!this._navigationBar.navigationItems.includes(this._contentViewSelectionPathNavigationItem)){var hierarchicalPathItemIndex=this._navigationBar.navigationItems.indexOf(this._hierarchicalPathNavigationItem);this._navigationBar.insertNavigationItem(this._contentViewSelectionPathNavigationItem,hierarchicalPathItemIndex+1);this._hierarchicalPathNavigationItem.alwaysShowLastPathComponentSeparator=true;}} _updateBackForwardButtons() {if(!this._backNavigationItem||!this._forwardNavigationItem) return;this._backNavigationItem.enabled=this.canGoBack();this._forwardNavigationItem.enabled=this.canGoForward();} _updateContentViewNavigationItems(forceUpdate) {let currentContentView=this.currentContentView;if(!currentContentView){this._removeAllNavigationItems();this._currentContentViewNavigationItems=[];return;} if(currentContentView.parentContainer!==this._contentViewContainer) return;if(!forceUpdate){let previousItems=this._currentContentViewNavigationItems.filter((item)=>!(item instanceof WebInspector.DividerNavigationItem));let isUnchanged=Array.shallowEqual(previousItems,currentContentView.navigationItems);if(isUnchanged) return;} this._removeAllNavigationItems();let navigationBar=this.navigationBar;let insertionIndex=navigationBar.navigationItems.indexOf(this._dividingFlexibleSpaceNavigationItem)+1;let newNavigationItems=[];currentContentView.navigationItems.forEach(function(navigationItem,index){if(index!==0||navigationItem instanceof WebInspector.ButtonNavigationItem){let divider=new WebInspector.DividerNavigationItem;navigationBar.insertNavigationItem(divider,insertionIndex++);newNavigationItems.push(divider);} navigationBar.insertNavigationItem(navigationItem,insertionIndex++);newNavigationItems.push(navigationItem);}); this._currentContentViewNavigationItems=newNavigationItems;} _removeAllNavigationItems() {for(let navigationItem of this._currentContentViewNavigationItems){if(navigationItem.parentNavigationBar) navigationItem.parentNavigationBar.removeNavigationItem(navigationItem);}} _updateFindBanner(currentContentView) {if(!this._findBanner) return;if(!currentContentView){this._findBanner.targetElement=null;this._findBanner.numberOfResults=null;return;} this._findBanner.targetElement=currentContentView.element;this._findBanner.numberOfResults=currentContentView.hasPerformedSearch?currentContentView.numberOfSearchResults:null;if(currentContentView.supportsSearch&&this._findBanner.searchQuery){currentContentView.automaticallyRevealFirstSearchResult=this._findBanner.showing;currentContentView.performSearch(this._findBanner.searchQuery);}} _dispatchCurrentRepresentedObjectsDidChangeEvent() {this._dispatchCurrentRepresentedObjectsDidChangeEvent.cancelDebounce();this.dispatchEventToListeners(WebInspector.ContentBrowser.Event.CurrentRepresentedObjectsDidChange);} _contentViewSelectionPathComponentDidChange(event) {if(event.target!==this.currentContentView) return;this._updateContentViewSelectionPathNavigationItem(event.target);this._updateBackForwardButtons();this._updateContentViewNavigationItems();this._navigationBar.needsLayout();this.soon._dispatchCurrentRepresentedObjectsDidChangeEvent();} _contentViewSupplementalRepresentedObjectsDidChange(event) {if(event.target!==this.currentContentView) return;this.soon._dispatchCurrentRepresentedObjectsDidChangeEvent();} _currentContentViewDidChange(event) {var currentContentView=this.currentContentView;this._updateHierarchicalPathNavigationItem(currentContentView?currentContentView.representedObject:null);this._updateContentViewSelectionPathNavigationItem(currentContentView);this._updateBackForwardButtons();this._updateContentViewNavigationItems();this._updateFindBanner(currentContentView);this._navigationBar.needsLayout();this.dispatchEventToListeners(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange);this._dispatchCurrentRepresentedObjectsDidChangeEvent();} _contentViewNavigationItemsDidChange(event) {if(event.target!==this.currentContentView) return;const forceUpdate=true;this._updateContentViewNavigationItems(forceUpdate);this._navigationBar.needsLayout();} _hierarchicalPathComponentWasSelected(event) {var treeElement=event.data.pathComponent.generalTreeElement;var originalTreeElement=treeElement;while(treeElement&&!WebInspector.ContentView.isViewable(treeElement.representedObject)) treeElement=treeElement.traverseNextTreeElement(false,originalTreeElement,false);if(!treeElement) return;treeElement.revealAndSelect();}};WebInspector.ContentBrowser.Event={CurrentRepresentedObjectsDidChange:"content-browser-current-represented-objects-did-change",CurrentContentViewDidChange:"content-browser-current-content-view-did-change"};WebInspector.ContentView=class ContentView extends WebInspector.View {constructor(representedObject,extraArguments) {super();this._representedObject=representedObject;this.element.classList.add("content-view");this._parentContainer=null;} static createFromRepresentedObject(representedObject,extraArguments) {if(representedObject instanceof WebInspector.Frame) return new WebInspector.ResourceClusterContentView(representedObject.mainResource,extraArguments);if(representedObject instanceof WebInspector.Resource) return new WebInspector.ResourceClusterContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.Script) return new WebInspector.ScriptContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.CSSStyleSheet) return new WebInspector.TextResourceContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.Canvas) return new WebInspector.CanvasContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.TimelineRecording) return new WebInspector.TimelineRecordingContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.Timeline){var timelineType=representedObject.type;if(timelineType===WebInspector.TimelineRecord.Type.Network) return new WebInspector.NetworkTimelineView(representedObject,extraArguments);if(timelineType===WebInspector.TimelineRecord.Type.Layout) return new WebInspector.LayoutTimelineView(representedObject,extraArguments);if(timelineType===WebInspector.TimelineRecord.Type.Script) return new WebInspector.ScriptClusterTimelineView(representedObject,extraArguments);if(timelineType===WebInspector.TimelineRecord.Type.RenderingFrame) return new WebInspector.RenderingFrameTimelineView(representedObject,extraArguments);if(timelineType===WebInspector.TimelineRecord.Type.Memory) return new WebInspector.MemoryTimelineView(representedObject,extraArguments);if(timelineType===WebInspector.TimelineRecord.Type.HeapAllocations) return new WebInspector.HeapAllocationsTimelineView(representedObject,extraArguments);} if(representedObject instanceof WebInspector.Breakpoint||representedObject instanceof WebInspector.IssueMessage){if(representedObject.sourceCodeLocation) return WebInspector.ContentView.createFromRepresentedObject(representedObject.sourceCodeLocation.displaySourceCode,extraArguments);} if(representedObject instanceof WebInspector.DOMStorageObject) return new WebInspector.DOMStorageContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.CookieStorageObject) return new WebInspector.CookieStorageContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.DatabaseTableObject) return new WebInspector.DatabaseTableContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.DatabaseObject) return new WebInspector.DatabaseContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.IndexedDatabase) return new WebInspector.IndexedDatabaseContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.IndexedDatabaseObjectStore) return new WebInspector.IndexedDatabaseObjectStoreContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex) return new WebInspector.IndexedDatabaseObjectStoreContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.ApplicationCacheFrame) return new WebInspector.ApplicationCacheFrameContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.DOMTree) return new WebInspector.FrameDOMTreeContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.DOMSearchMatchObject){var resultView=new WebInspector.FrameDOMTreeContentView(WebInspector.frameResourceManager.mainFrame.domTree,extraArguments);resultView.restoreFromCookie({nodeToSelect:representedObject.domNode});return resultView;} if(representedObject instanceof WebInspector.DOMNode){if(representedObject.frame){let resultView=WebInspector.ContentView.createFromRepresentedObject(representedObject.frame,extraArguments);resultView.restoreFromCookie({nodeToSelect:representedObject});return resultView;}} if(representedObject instanceof WebInspector.SourceCodeSearchMatchObject){var resultView;if(representedObject.sourceCode instanceof WebInspector.Resource) resultView=new WebInspector.ResourceClusterContentView(representedObject.sourceCode,extraArguments);else if(representedObject.sourceCode instanceof WebInspector.Script) resultView=new WebInspector.ScriptContentView(representedObject.sourceCode,extraArguments);else console.error("Unknown SourceCode",representedObject.sourceCode);var textRangeToSelect=representedObject.sourceCodeTextRange.formattedTextRange;var startPosition=textRangeToSelect.startPosition();resultView.restoreFromCookie({lineNumber:startPosition.lineNumber,columnNumber:startPosition.columnNumber});return resultView;} if(representedObject instanceof WebInspector.LogObject) return new WebInspector.LogContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.ContentFlow) return new WebInspector.ContentFlowDOMTreeContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.CallingContextTree) return new WebInspector.ProfileView(representedObject,extraArguments);if(representedObject instanceof WebInspector.HeapSnapshotProxy||representedObject instanceof WebInspector.HeapSnapshotDiffProxy) return new WebInspector.HeapSnapshotClusterContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.Collection) return new WebInspector.CollectionContentView(representedObject,extraArguments);if(typeof representedObject==="string"||representedObject instanceof String) return new WebInspector.TextContentView(representedObject,extraArguments);throw new Error("Can't make a ContentView for an unknown representedObject of type: "+representedObject.constructor.name);} static contentViewForRepresentedObject(representedObject,onlyExisting,extraArguments) {let resolvedRepresentedObject=WebInspector.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject);if(!resolvedRepresentedObject) return null;let existingContentView=resolvedRepresentedObject[WebInspector.ContentView.ContentViewForRepresentedObjectSymbol];if(existingContentView) return existingContentView;if(onlyExisting) return null;let newContentView=WebInspector.ContentView.createFromRepresentedObject(representedObject,extraArguments);if(!newContentView) return null;newContentView.representedObject[WebInspector.ContentView.ContentViewForRepresentedObjectSymbol]=newContentView;return newContentView;} static closedContentViewForRepresentedObject(representedObject) {let resolvedRepresentedObject=WebInspector.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject);resolvedRepresentedObject[WebInspector.ContentView.ContentViewForRepresentedObjectSymbol]=null;} static resolvedRepresentedObjectForRepresentedObject(representedObject) {if(representedObject instanceof WebInspector.Frame) return representedObject.mainResource;if(representedObject instanceof WebInspector.Breakpoint||representedObject instanceof WebInspector.IssueMessage){if(representedObject.sourceCodeLocation) return representedObject.sourceCodeLocation.displaySourceCode;} if(representedObject instanceof WebInspector.DOMBreakpoint){if(representedObject.domNode) return WebInspector.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject.domNode);} if(representedObject instanceof WebInspector.DOMNode){if(representedObject.frame) return WebInspector.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject.frame);} if(representedObject instanceof WebInspector.DOMSearchMatchObject) return WebInspector.frameResourceManager.mainFrame.domTree;if(representedObject instanceof WebInspector.SourceCodeSearchMatchObject) return representedObject.sourceCode;return representedObject;} static isViewable(representedObject) {if(representedObject instanceof WebInspector.Frame) return true;if(representedObject instanceof WebInspector.Resource) return true;if(representedObject instanceof WebInspector.Script) return true;if(representedObject instanceof WebInspector.CSSStyleSheet) return true;if(representedObject instanceof WebInspector.Canvas) return true;if(representedObject instanceof WebInspector.TimelineRecording) return true;if(representedObject instanceof WebInspector.Timeline) return true;if(representedObject instanceof WebInspector.Breakpoint||representedObject instanceof WebInspector.IssueMessage) return representedObject.sourceCodeLocation;if(representedObject instanceof WebInspector.DOMStorageObject) return true;if(representedObject instanceof WebInspector.CookieStorageObject) return true;if(representedObject instanceof WebInspector.DatabaseTableObject) return true;if(representedObject instanceof WebInspector.DatabaseObject) return true;if(representedObject instanceof WebInspector.IndexedDatabase) return true;if(representedObject instanceof WebInspector.IndexedDatabaseObjectStore) return true;if(representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex) return true;if(representedObject instanceof WebInspector.ApplicationCacheFrame) return true;if(representedObject instanceof WebInspector.DOMTree) return true;if(representedObject instanceof WebInspector.DOMSearchMatchObject) return true;if(representedObject instanceof WebInspector.SourceCodeSearchMatchObject) return true;if(representedObject instanceof WebInspector.LogObject) return true;if(representedObject instanceof WebInspector.ContentFlow) return true;if(representedObject instanceof WebInspector.CallingContextTree) return true;if(representedObject instanceof WebInspector.HeapSnapshotProxy||representedObject instanceof WebInspector.HeapSnapshotDiffProxy) return true;if(representedObject instanceof WebInspector.Collection) return true;if(typeof representedObject==="string"||representedObject instanceof String) return true;return false;} get representedObject() {return this._representedObject;} get navigationItems() {return[];} get parentContainer() {return this._parentContainer;} get visible() {return this._visible;} set visible(flag) {this._visible=flag;} get scrollableElements() {return[];} get shouldKeepElementsScrolledToBottom() {return false;} get selectionPathComponents() {return[];} get supplementalRepresentedObjects() {return[];} get supportsSplitContentBrowser() {return WebInspector.dockedConfigurationSupportsSplitContentBrowser();} shown() {} hidden() {} closed() {} saveToCookie(cookie) {} restoreFromCookie(cookie) {} canGoBack() {return false;} canGoForward() {return false;} goBack() {} goForward() {} get supportsSearch() {return false;} get supportsCustomFindBanner() {return false;} showCustomFindBanner() {} get numberOfSearchResults() {return null;} get hasPerformedSearch() {return false;} set automaticallyRevealFirstSearchResult(reveal) {} performSearch(query) {} searchCleared() {} searchQueryWithSelection() {return null;} revealPreviousSearchResult(changeFocus) {} revealNextSearchResult(changeFocus) {}};WebInspector.ContentView.Event={SelectionPathComponentsDidChange:"content-view-selection-path-components-did-change",SupplementalRepresentedObjectsDidChange:"content-view-supplemental-represented-objects-did-change",NumberOfSearchResultsDidChange:"content-view-number-of-search-results-did-change",NavigationItemsDidChange:"content-view-navigation-items-did-change"};WebInspector.ContentView.ContentViewForRepresentedObjectSymbol=Symbol("content-view-for-represented-object");WebInspector.DataGrid=class DataGrid extends WebInspector.View {constructor(columnsData,editCallback,deleteCallback,preferredColumnOrder) {super();this.columns=new Map;this.orderedColumns=[];this._settingsIdentifier=null;this._sortColumnIdentifier=null;this._sortColumnIdentifierSetting=null;this._sortOrder=WebInspector.DataGrid.SortOrder.Indeterminate;this._sortOrderSetting=null;this._columnVisibilitySetting=null;this._columnChooserEnabled=false;this._headerVisible=true;this._rows=[];this.children=[];this.selectedNode=null;this.expandNodesWhenArrowing=false;this.root=true;this.hasChildren=false;this.expanded=true;this.revealed=true;this.selected=false;this.dataGrid=this;this.indentWidth=15;this.rowHeight=20;this.resizers=[];this._columnWidthsInitialized=false;this._scrollbarWidth=0;this._cachedScrollTop=NaN;this._cachedScrollableOffsetHeight=NaN;this._previousRevealedRowCount=NaN;this._topDataTableMarginHeight=NaN;this._bottomDataTableMarginHeight=NaN;this._filterText="";this._filterDelegate=null;this._filterDidModifyNodeWhileProcessingItems=false;this.element.className="data-grid";this.element.tabIndex=0;this.element.addEventListener("keydown",this._keyDown.bind(this),false);this.element.copyHandler=this;this._headerWrapperElement=document.createElement("div");this._headerWrapperElement.classList.add("header-wrapper");this._headerTableElement=document.createElement("table");this._headerTableElement.className="header";this._headerWrapperElement.appendChild(this._headerTableElement);this._headerTableColumnGroupElement=this._headerTableElement.createChild("colgroup");this._headerTableBodyElement=this._headerTableElement.createChild("tbody");this._headerTableRowElement=this._headerTableBodyElement.createChild("tr");this._headerTableRowElement.addEventListener("contextmenu",this._contextMenuInHeader.bind(this),true);this._headerTableCellElements=new Map;this._scrollContainerElement=document.createElement("div");this._scrollContainerElement.className="data-container";this._scrollListener=()=>this._noteScrollPositionChanged();this._updateScrollListeners();this._topDataTableMarginElement=this._scrollContainerElement.createChild("div");this._dataTableElement=this._scrollContainerElement.createChild("table","data");this._bottomDataTableMarginElement=this._scrollContainerElement.createChild("div");this._dataTableElement.addEventListener("mousedown",this._mouseDownInDataTable.bind(this));this._dataTableElement.addEventListener("click",this._clickInDataTable.bind(this));this._dataTableElement.addEventListener("contextmenu",this._contextMenuInDataTable.bind(this),true); if(editCallback){this._dataTableElement.addEventListener("dblclick",this._ondblclick.bind(this),false);this._editCallback=editCallback;} if(deleteCallback) this._deleteCallback=deleteCallback;this._dataTableColumnGroupElement=this._headerTableColumnGroupElement.cloneNode(true);this._dataTableElement.appendChild(this._dataTableColumnGroupElement);this.dataTableBodyElement=this._dataTableElement.createChild("tbody");this._fillerRowElement=this.dataTableBodyElement.createChild("tr","filler");this.element.appendChild(this._headerWrapperElement);this.element.appendChild(this._scrollContainerElement);if(preferredColumnOrder){for(var columnIdentifier of preferredColumnOrder) this.insertColumn(columnIdentifier,columnsData[columnIdentifier]);}else{for(var columnIdentifier in columnsData) this.insertColumn(columnIdentifier,columnsData[columnIdentifier]);} this._updateScrollbarPadding();this._copyTextDelimiter="\t";} _updateScrollbarPadding() {if(this._inline) return;let scrollbarWidth=this._scrollContainerElement.offsetWidth-this._scrollContainerElement.scrollWidth;if(this._scrollbarWidth===scrollbarWidth) return;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL) this._headerWrapperElement.style.setProperty("padding-left",`${scrollbarWidth}px`);else this._headerWrapperElement.style.setProperty("padding-right",`${scrollbarWidth}px`);this._scrollbarWidth=scrollbarWidth;} static createSortableDataGrid(columnNames,values) {var numColumns=columnNames.length;if(!numColumns) return null;var columnsData={};for(var columnName of columnNames){columnsData[columnName]={width:columnName.length,title:columnName,sortable:true,};} var dataGrid=new WebInspector.DataGrid(columnsData,undefined,undefined,columnNames);for(var i=0;inumber2?1:0);}else comparison=item1item2?1:0);return comparison;} dataGrid.sortNodes(comparator);} dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged,sortDataGrid,this);dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Ascending;dataGrid.sortColumnIdentifier=columnNames[0];return dataGrid;} get headerVisible(){return this._headerVisible;} set headerVisible(x) {if(x===this._headerVisible) return;this._headerVisible=x;this.element.classList.toggle("no-header",!this._headerVisible);} get columnChooserEnabled(){return this._columnChooserEnabled;} set columnChooserEnabled(x){this._columnChooserEnabled=x;} get refreshCallback() {return this._refreshCallback;} set refreshCallback(refreshCallback) {this._refreshCallback=refreshCallback;} get sortOrder() {return this._sortOrder;} set sortOrder(order) {if(!order||order===this._sortOrder) return;this._sortOrder=order;if(this._sortOrderSetting) this._sortOrderSetting.value=this._sortOrder;if(!this._sortColumnIdentifier) return;var sortHeaderCellElement=this._headerTableCellElements.get(this._sortColumnIdentifier);sortHeaderCellElement.classList.toggle(WebInspector.DataGrid.SortColumnAscendingStyleClassName,this._sortOrder===WebInspector.DataGrid.SortOrder.Ascending);sortHeaderCellElement.classList.toggle(WebInspector.DataGrid.SortColumnDescendingStyleClassName,this._sortOrder===WebInspector.DataGrid.SortOrder.Descending);this.dispatchEventToListeners(WebInspector.DataGrid.Event.SortChanged);} get sortColumnIdentifier() {return this._sortColumnIdentifier;} set sortColumnIdentifier(columnIdentifier) {if(this._sortColumnIdentifier===columnIdentifier) return;let oldSortColumnIdentifier=this._sortColumnIdentifier;this._sortColumnIdentifier=columnIdentifier;this._updateSortedColumn(oldSortColumnIdentifier);} get inline(){return this._inline;} set inline(x) {if(this._inline===x) return;this._inline=x||false;this._element.classList.toggle("inline",this._inline);this._updateScrollListeners();} get variableHeightRows(){return this._variableHeightRows;} set variableHeightRows(x) {if(this._variableHeightRows===x) return;this._variableHeightRows=x||false;this._element.classList.toggle("variable-height-rows",this._variableHeightRows);this._updateScrollListeners();} get filterText(){return this._filterText;} set filterText(x) {if(this._filterText===x) return;this._filterText=x;this.filterDidChange();} get filterDelegate(){return this._filterDelegate;} set filterDelegate(delegate) {this._filterDelegate=delegate;this.filterDidChange();} filterDidChange() {if(this._scheduledFilterUpdateIdentifier) return;if(this._applyFilterToNodesTask){this._applyFilterToNodesTask.cancel();this._applyFilterToNodesTask=null;} this._scheduledFilterUpdateIdentifier=requestAnimationFrame(this._updateFilter.bind(this));} hasFilters() {return this._textFilterRegex||this._hasFilterDelegate();} matchNodeAgainstCustomFilters(node) {if(!this._hasFilterDelegate()) return true;return this._filterDelegate.dataGridMatchNodeAgainstCustomFilters(node);} createSettings(identifier) {if(this._settingsIdentifier===identifier) return;this._settingsIdentifier=identifier;this._sortColumnIdentifierSetting=new WebInspector.Setting(this._settingsIdentifier+"-sort",this._sortColumnIdentifier);this._sortOrderSetting=new WebInspector.Setting(this._settingsIdentifier+"-sort-order",this._sortOrder);this._columnVisibilitySetting=new WebInspector.Setting(this._settingsIdentifier+"-column-visibility",{});if(!this.columns) return;if(this._sortColumnIdentifierSetting.value){this.sortColumnIdentifier=this._sortColumnIdentifierSetting.value;this.sortOrder=this._sortOrderSetting.value;} let visibilitySettings=this._columnVisibilitySetting.value;for(let columnIdentifier in visibilitySettings){let visible=visibilitySettings[columnIdentifier];this.setColumnVisible(columnIdentifier,visible);}} _updateScrollListeners() {if(this._inline||this._variableHeightRows){this._scrollContainerElement.removeEventListener("scroll",this._scrollListener);this._scrollContainerElement.removeEventListener("mousewheel",this._scrollListener);}else{this._scrollContainerElement.addEventListener("scroll",this._scrollListener);this._scrollContainerElement.addEventListener("mousewheel",this._scrollListener);}} _applyFiltersToNodeAndDispatchEvent(node) {const nodeWasHidden=node.hidden;this._applyFiltersToNode(node);if(nodeWasHidden!==node.hidden) this.dispatchEventToListeners(WebInspector.DataGrid.Event.NodeWasFiltered,{node});return nodeWasHidden!==node.hidden;} _applyFiltersToNode(node) {if(!this.hasFilters()){node.hidden=false;if(node.expanded&&node[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol]){node[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol]=false;node.collapse();} return;} let filterableData=node.filterableData||[];let flags={expandNode:false};let filterRegex=this._textFilterRegex;function matchTextFilter() {if(!filterableData.length||!filterRegex) return true;if(filterableData.some((value)=>filterRegex.test(value))){flags.expandNode=true;return true;} return false;} function makeVisible() {node.hidden=false;let currentAncestor=node.parent;while(currentAncestor&&!currentAncestor.root){currentAncestor.hidden=false;if(flags.expandNode&&!currentAncestor.expanded){currentAncestor[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol]=true;currentAncestor.expand();} currentAncestor=currentAncestor.parent;}} if(matchTextFilter()&&this.matchNodeAgainstCustomFilters(node)){makeVisible();if(!flags.expandNode&&node.expanded&&node[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol]){node[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol]=false;node.collapse();} return;} node.hidden=true;} _updateSortedColumn(oldSortColumnIdentifier) {if(this._sortColumnIdentifierSetting) this._sortColumnIdentifierSetting.value=this._sortColumnIdentifier;if(oldSortColumnIdentifier){let oldSortHeaderCellElement=this._headerTableCellElements.get(oldSortColumnIdentifier);oldSortHeaderCellElement.classList.remove(WebInspector.DataGrid.SortColumnAscendingStyleClassName);oldSortHeaderCellElement.classList.remove(WebInspector.DataGrid.SortColumnDescendingStyleClassName);} if(this._sortColumnIdentifier){let newSortHeaderCellElement=this._headerTableCellElements.get(this._sortColumnIdentifier);newSortHeaderCellElement.classList.toggle(WebInspector.DataGrid.SortColumnAscendingStyleClassName,this._sortOrder===WebInspector.DataGrid.SortOrder.Ascending);newSortHeaderCellElement.classList.toggle(WebInspector.DataGrid.SortColumnDescendingStyleClassName,this._sortOrder===WebInspector.DataGrid.SortOrder.Descending);} this.dispatchEventToListeners(WebInspector.DataGrid.Event.SortChanged);} _hasFilterDelegate() {return this._filterDelegate&&typeof this._filterDelegate.dataGridMatchNodeAgainstCustomFilters==="function";} _ondblclick(event) {if(this._editing||this._editingNode) return;this._startEditing(event.target);} _startEditingNodeAtColumnIndex(node,columnIndex) {this._editing=true;this._editingNode=node;this._editingNode.select();var element=this._editingNode._element.children[columnIndex];WebInspector.startEditing(element,this._startEditingConfig(element));window.getSelection().setBaseAndExtent(element,0,element,1);} _startEditing(target) {var element=target.enclosingNodeOrSelfWithNodeName("td");if(!element) return;this._editingNode=this.dataGridNodeFromNode(target);if(!this._editingNode){if(!this.placeholderNode) return;this._editingNode=this.placeholderNode;} if(this._editingNode.isPlaceholderNode) return this._startEditingNodeAtColumnIndex(this._editingNode,0);this._editing=true;WebInspector.startEditing(element,this._startEditingConfig(element));window.getSelection().setBaseAndExtent(element,0,element,1);} _startEditingConfig(element) {return new WebInspector.EditingConfig(this._editingCommitted.bind(this),this._editingCancelled.bind(this),element.textContent);} _editingCommitted(element,newText,oldText,context,moveDirection) {var columnIdentifier=element.__columnIdentifier;var columnIndex=this.orderedColumns.indexOf(columnIdentifier);var textBeforeEditing=this._editingNode.data[columnIdentifier]||"";var currentEditingNode=this._editingNode; function determineNextCell(valueDidChange){if(moveDirection==="forward"){if(columnIndex0) return{shouldSort:false,editingNode:currentEditingNode,columnIndex:columnIndex-1};var previousDataGridNode=currentEditingNode.traversePreviousNode(true,null,true);return{shouldSort:true,editingNode:previousDataGridNode||currentEditingNode,columnIndex:this.orderedColumns.length-1};} return{shouldSort:true};} function moveToNextCell(valueDidChange){var moveCommand=determineNextCell.call(this,valueDidChange);if(moveCommand.shouldSort&&this._sortAfterEditingCallback){this._sortAfterEditingCallback();this._sortAfterEditingCallback=null;} if(moveCommand.editingNode) this._startEditingNodeAtColumnIndex(moveCommand.editingNode,moveCommand.columnIndex);} this._editingCancelled(element);currentEditingNode.data[columnIdentifier]=newText.trim();this._editCallback(currentEditingNode,columnIdentifier,textBeforeEditing,newText,moveDirection);var textDidChange=textBeforeEditing.trim()!==newText.trim();moveToNextCell.call(this,textDidChange);} _editingCancelled(element) {this._editingNode.refresh();this._editing=false;this._editingNode=null;} autoSizeColumns(minPercent,maxPercent,maxDescentLevel) {if(minPercent) minPercent=Math.min(minPercent,Math.floor(100/this.orderedColumns.length));var widths={};for(var[identifier,column]of this.columns) widths[identifier]=(column["title"]||"").length;var children=maxDescentLevel?this._enumerateChildren(this,[],maxDescentLevel+1):this.children;for(var node of children){for(var identifier of this.columns.keys()){var text=this.textForDataGridNodeColumn(node,identifier);if(text.length>widths[identifier]) widths[identifier]=text.length;}} var totalColumnWidths=0;for(var identifier of this.columns.keys()) totalColumnWidths+=widths[identifier];var recoupPercent=0;for(var identifier of this.columns.keys()){var width=Math.round(100*widths[identifier]/totalColumnWidths);if(minPercent&&widthmaxPercent){recoupPercent-=(width-maxPercent);width=maxPercent;} widths[identifier]=width;} while(minPercent&&recoupPercent>0){for(var identifier of this.columns.keys()){if(widths[identifier]>minPercent){--widths[identifier];--recoupPercent;if(!recoupPercent) break;}}} while(maxPercent&&recoupPercent<0){for(var identifier of this.columns.keys()){if(widths[identifier]=insertionIndex) existingColumn["ordinal"]=ordinal+1;} this.columns.set(columnIdentifier,column);if(column["disclosure"]) this.disclosureColumnIdentifier=columnIdentifier;var headerColumnElement=document.createElement("col");if(column["width"]) headerColumnElement.style.width=column["width"];column["element"]=headerColumnElement;var referenceElement=this._headerTableColumnGroupElement.children[insertionIndex];this._headerTableColumnGroupElement.insertBefore(headerColumnElement,referenceElement);var headerCellElement=document.createElement("th");headerCellElement.className=columnIdentifier+"-column";headerCellElement.columnIdentifier=columnIdentifier;if(column["aligned"]) headerCellElement.classList.add(column["aligned"]);this._headerTableCellElements.set(columnIdentifier,headerCellElement);var referenceElement=this._headerTableRowElement.children[insertionIndex];this._headerTableRowElement.insertBefore(headerCellElement,referenceElement);if(column["headerView"]){let headerView=column["headerView"];headerCellElement.appendChild(headerView.element);this.addSubview(headerView);}else{let titleElement=headerCellElement.createChild("div");if(column["titleDOMFragment"]) titleElement.appendChild(column["titleDOMFragment"]);else titleElement.textContent=column["title"]||"";} if(column["sortable"]){listeners.register(headerCellElement,"click",this._headerCellClicked);headerCellElement.classList.add(WebInspector.DataGrid.SortableColumnStyleClassName);} if(column["group"]) headerCellElement.classList.add("column-group-"+column["group"]);if(column["tooltip"]) headerCellElement.title=column["tooltip"];if(column["collapsesGroup"]){headerCellElement.createChild("div","divider");var collapseDiv=headerCellElement.createChild("div","collapser-button");collapseDiv.title=this._collapserButtonCollapseColumnsToolTip();listeners.register(collapseDiv,"mouseover",this._mouseoverColumnCollapser);listeners.register(collapseDiv,"mouseout",this._mouseoutColumnCollapser);listeners.register(collapseDiv,"click",this._clickInColumnCollapser);headerCellElement.collapsesGroup=column["collapsesGroup"];headerCellElement.classList.add("collapser");} this._headerTableColumnGroupElement.span=this.orderedColumns.length;var dataColumnElement=headerColumnElement.cloneNode();var referenceElement=this._dataTableColumnGroupElement.children[insertionIndex];this._dataTableColumnGroupElement.insertBefore(dataColumnElement,referenceElement);column["bodyElement"]=dataColumnElement;var fillerCellElement=document.createElement("td");fillerCellElement.className=columnIdentifier+"-column";fillerCellElement.__columnIdentifier=columnIdentifier;if(column["group"]) fillerCellElement.classList.add("column-group-"+column["group"]);var referenceElement=this._fillerRowElement.children[insertionIndex];this._fillerRowElement.insertBefore(fillerCellElement,referenceElement);listeners.install();this.setColumnVisible(columnIdentifier,!column.hidden);} removeColumn(columnIdentifier) {var removedColumn=this.columns.get(columnIdentifier);this.columns.delete(columnIdentifier);this.orderedColumns.splice(this.orderedColumns.indexOf(columnIdentifier),1);var removedOrdinal=removedColumn["ordinal"];for(var[identifier,column]of this.columns){var ordinal=column["ordinal"];if(ordinal>removedOrdinal) column["ordinal"]=ordinal-1;} removedColumn["listeners"].uninstall(true);if(removedColumn["disclosure"]) this.disclosureColumnIdentifier=undefined;if(this.sortColumnIdentifier===columnIdentifier) this.sortColumnIdentifier=null;this._headerTableCellElements.delete(columnIdentifier);this._headerTableRowElement.children[removedOrdinal].remove();this._headerTableColumnGroupElement.children[removedOrdinal].remove();this._dataTableColumnGroupElement.children[removedOrdinal].remove();this._fillerRowElement.children[removedOrdinal].remove();this._headerTableColumnGroupElement.span=this.orderedColumns.length;for(var child of this.children) child.refresh();} _enumerateChildren(rootNode,result,maxLevel) {if(!rootNode.root) result.push(rootNode);if(!maxLevel) return;for(var i=0;i=0;--i){let rowElement=this._rows[i].element;if(rowElement.nextSibling!==nextElement) this.dataTableBodyElement.insertBefore(rowElement,nextElement);nextElement=rowElement;} return;} let rowHeight=this.rowHeight;let updateOffsetThreshold=rowHeight*5;let overflowPadding=updateOffsetThreshold*3;if(isNaN(this._cachedScrollTop)) this._cachedScrollTop=this._scrollContainerElement.scrollTop;if(isNaN(this._cachedScrollableOffsetHeight)) this._cachedScrollableOffsetHeight=this._scrollContainerElement.offsetHeight;let scrollTop=this._cachedScrollTop;let scrollableOffsetHeight=this._cachedScrollableOffsetHeight;let visibleRowCount=Math.ceil((scrollableOffsetHeight+(overflowPadding*2))/rowHeight);let currentTopMargin=this._topDataTableMarginHeight;let currentBottomMargin=this._bottomDataTableMarginHeight;let currentTableBottom=currentTopMargin+(visibleRowCount*rowHeight);let belowTopThreshold=!currentTopMargin||scrollTop>currentTopMargin+updateOffsetThreshold;let aboveBottomThreshold=!currentBottomMargin||scrollTop+scrollableOffsetHeightrow.revealed&&!row.hidden);this._previousRevealedRowCount=revealedRows.length;let topHiddenRowCount=Math.max(0,Math.floor((scrollTop-overflowPadding)/rowHeight));let bottomHiddenRowCount=Math.max(0,this._previousRevealedRowCount-topHiddenRowCount-visibleRowCount);let marginTop=topHiddenRowCount*rowHeight;let marginBottom=bottomHiddenRowCount*rowHeight;if(this._topDataTableMarginHeight!==marginTop){this._topDataTableMarginHeight=marginTop;this._topDataTableMarginElement.style.height=marginTop+"px";} if(this._bottomDataTableMarginElement!==marginBottom){this._bottomDataTableMarginHeight=marginBottom;this._bottomDataTableMarginElement.style.height=marginBottom+"px";} this._dataTableElement.classList.toggle("odd-first-zebra-stripe",!!(topHiddenRowCount%2));this.dataTableBodyElement.removeChildren();for(let i=topHiddenRowCount;i{this._selectSortColumnAndSetOrder(columnIdentifier,WebInspector.DataGrid.SortOrder.Ascending);});} if(this.sortColumnIdentifier!==columnIdentifier||this.sortOrder!==WebInspector.DataGrid.SortOrder.Descending){contextMenu.appendItem(WebInspector.UIString("Sort Descending"),()=>{this._selectSortColumnAndSetOrder(columnIdentifier,WebInspector.DataGrid.SortOrder.Descending);});}} if(this._columnChooserEnabled){let didAddSeparator=false;for(let[identifier,columnInfo]of this.columns){if(columnInfo.locked) continue;if(!didAddSeparator){contextMenu.appendSeparator();didAddSeparator=true;} contextMenu.appendCheckboxItem(columnInfo.title,()=>{this.setColumnVisible(identifier,!!columnInfo.hidden);},!columnInfo.hidden);}}} _contextMenuInDataTable(event) {let contextMenu=WebInspector.ContextMenu.createFromEvent(event);let gridNode=this.dataGridNodeFromNode(event.target);if(gridNode) gridNode.appendContextMenuItems(contextMenu);if(this.dataGrid._refreshCallback&&(!gridNode||gridNode!==this.placeholderNode)) contextMenu.appendItem(WebInspector.UIString("Refresh"),this._refreshCallback.bind(this));if(gridNode){if(gridNode.selectable&&gridNode.copyable&&!gridNode.isEventWithinDisclosureTriangle(event)){contextMenu.appendItem(WebInspector.UIString("Copy Row"),this._copyRow.bind(this,event.target));contextMenu.appendItem(WebInspector.UIString("Copy Table"),this._copyTable.bind(this));if(this.dataGrid._editCallback){if(gridNode===this.placeholderNode) contextMenu.appendItem(WebInspector.UIString("Add New"),this._startEditing.bind(this,event.target));else{let element=event.target.enclosingNodeOrSelfWithNodeName("td");let columnIdentifier=element.__columnIdentifier;let columnTitle=this.dataGrid.columns.get(columnIdentifier)["title"];contextMenu.appendItem(WebInspector.UIString("Edit “%s”").format(columnTitle),this._startEditing.bind(this,event.target));}} if(this.dataGrid._deleteCallback&&gridNode!==this.placeholderNode) contextMenu.appendItem(WebInspector.UIString("Delete"),this._deleteCallback.bind(this,gridNode));} if(gridNode.children.some((child)=>child.hasChildren)||(gridNode.hasChildren&&!gridNode.children.length)){contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Expand All"),gridNode.expandRecursively.bind(gridNode));contextMenu.appendItem(WebInspector.UIString("Collapse All"),gridNode.collapseRecursively.bind(gridNode));}}} _clickInDataTable(event) {var gridNode=this.dataGridNodeFromNode(event.target);if(!gridNode||!gridNode.hasChildren) return;if(!gridNode.isEventWithinDisclosureTriangle(event)) return;if(gridNode.expanded){if(event.altKey) gridNode.collapseRecursively();else gridNode.collapse();}else{if(event.altKey) gridNode.expandRecursively();else gridNode.expand();}} textForDataGridNodeColumn(node,columnIdentifier) {var data=node.data[columnIdentifier];return(data instanceof Node?data.textContent:data)||"";} set copyTextDelimiter(value){this._copyTextDelimiter=value;} _copyTextForDataGridNode(node) {let fields=node.dataGrid.orderedColumns.map((identifier)=>this.textForDataGridNodeColumn(node,identifier));return fields.join(this._copyTextDelimiter);} _copyTextForDataGridHeaders() {let fields=this.orderedColumns.map((identifier)=>this.headerTableHeader(identifier).textContent);return fields.join(this._copyTextDelimiter);} handleBeforeCopyEvent(event) {if(this.selectedNode&&window.getSelection().isCollapsed) event.preventDefault();} handleCopyEvent(event) {if(!this.selectedNode||!window.getSelection().isCollapsed) return;var copyText=this._copyTextForDataGridNode(this.selectedNode);event.clipboardData.setData("text/plain",copyText);event.stopPropagation();event.preventDefault();} _copyRow(target) {var gridNode=this.dataGridNodeFromNode(target);if(!gridNode) return;var copyText=this._copyTextForDataGridNode(gridNode);InspectorFrontendHost.copyText(copyText);} _copyTable() {let copyData=[];copyData.push(this._copyTextForDataGridHeaders());for(let gridNode of this.children){if(!gridNode.copyable) continue;copyData.push(this._copyTextForDataGridNode(gridNode));} InspectorFrontendHost.copyText(copyData.join("\n"));} _hasCopyableData() {let gridNode=this.children[0];return gridNode&&gridNode.selectable&&gridNode.copyable;} get resizeMethod() {if(!this._resizeMethod) return WebInspector.DataGrid.ResizeMethod.Nearest;return this._resizeMethod;} set resizeMethod(method) {this._resizeMethod=method;} resizerDragStarted(resizer) {if(!resizer[WebInspector.DataGrid.NextColumnOrdinalSymbol]) return true;this._currentResizer=resizer;} resizerDragging(resizer,positionDelta) {if(resizer!==this._currentResizer) return;let isRTL=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL;if(isRTL) positionDelta*=-1;let dragPoint=0;if(isRTL) dragPoint+=this.element.totalOffsetRight-resizer.initialPosition-positionDelta;else dragPoint+=resizer.initialPosition-this.element.totalOffsetLeft-positionDelta; var leftColumnIndex=resizer[WebInspector.DataGrid.PreviousColumnOrdinalSymbol];var rightColumnIndex=resizer[WebInspector.DataGrid.NextColumnOrdinalSymbol];var firstRowCells=this._headerTableBodyElement.rows[0].cells;let leadingEdgeOfPreviousColumn=0;for(let i=0;inode.refresh());} updateLayout() {} createCell(columnIdentifier) {var cellElement=document.createElement("td");cellElement.className=columnIdentifier+"-column";cellElement.__columnIdentifier=columnIdentifier;var div=cellElement.createChild("div","cell-content");var content=this.createCellContent(columnIdentifier,cellElement);div.append(content);let column=this.dataGrid.columns.get(columnIdentifier);if(column){if(column["aligned"]) cellElement.classList.add(column["aligned"]);if(column["group"]) cellElement.classList.add("column-group-"+column["group"]);if(column["icon"]){let iconElement=document.createElement("div");iconElement.classList.add("icon");div.insertBefore(iconElement,div.firstChild);}} if(columnIdentifier===this.dataGrid.disclosureColumnIdentifier){cellElement.classList.add("disclosure");if(this.indentPadding){if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL) cellElement.style.setProperty("padding-right",`${this.indentPadding}px`);else cellElement.style.setProperty("padding-left",`${this.indentPadding}px`);}} return cellElement;} createCellContent(columnIdentifier) {if(!(columnIdentifier in this.data)) return zeroWidthSpace;let data=this.data[columnIdentifier];return(typeof data==="number")?data.maxDecimals(2).toLocaleString():data;} elementWithColumnIdentifier(columnIdentifier) {if(!this.dataGrid) return null;let index=this.dataGrid.orderedColumns.indexOf(columnIdentifier);if(index===-1) return null;return this.element.children[index];} appendChild(){return WebInspector.DataGrid.prototype.appendChild.apply(this,arguments);} insertChild(){return WebInspector.DataGrid.prototype.insertChild.apply(this,arguments);} removeChild(){return WebInspector.DataGrid.prototype.removeChild.apply(this,arguments);} removeChildren(){return WebInspector.DataGrid.prototype.removeChildren.apply(this,arguments);} removeChildrenRecursive(){return WebInspector.DataGrid.prototype.removeChildrenRecursive.apply(this,arguments);} _recalculateSiblings(myIndex) {if(!this.parent) return;var previousChild=myIndex>0?this.parent.children[myIndex-1]:null;if(previousChild){previousChild.nextSibling=this;this.previousSibling=previousChild;}else this.previousSibling=null;var nextChild=this.parent.children[myIndex+1];if(nextChild){nextChild.previousSibling=this;this.nextSibling=nextChild;}else this.nextSibling=null;} collapse() {if(this._element) this._element.classList.remove("expanded");this._expanded=false;for(var i=0;i=start&&event.pageX<=start+this.disclosureToggleWidth;} _attach() {if(!this.dataGrid||this._attached) return;this._attached=true;let insertionIndex=-1;if(!this.isPlaceholderNode){var previousGridNode=this.traversePreviousNode(true,true);insertionIndex=this.dataGrid._rows.indexOf(previousGridNode);if(insertionIndex===-1) insertionIndex=0;else insertionIndex++;} if(insertionIndex===-1) this.dataGrid._rows.push(this);else this.dataGrid._rows.insertAtIndex(this,insertionIndex);this.dataGrid._noteRowsChanged();if(this.expanded){for(var i=0;ithis._truncatedDisplayNameLength) truncatedDisplayName=truncatedDisplayName.substring(0,this._truncatedDisplayNameLength)+ellipsis;this._element.title=this._displayName;this._titleContentElement.textContent=truncatedDisplayName;} _updateSelectElement() {this._selectElement.removeChildren();function createOption(component) {let optionElement=document.createElement("option");let maxPopupMenuLength=130; optionElement.textContent=component.displayName.length<=maxPopupMenuLength?component.displayName:component.displayName.substring(0,maxPopupMenuLength)+ellipsis;optionElement._pathComponent=component;return optionElement;} let previousSiblingCount=0;let sibling=this.previousSibling;while(sibling){this._selectElement.insertBefore(createOption(sibling),this._selectElement.firstChild);sibling=sibling.previousSibling;++previousSiblingCount;} this._selectElement.appendChild(createOption(this));sibling=this.nextSibling;while(sibling){this._selectElement.appendChild(createOption(sibling));sibling=sibling.nextSibling;} if(this._selectElement.options.length===1) this._selectElement.selectedIndex=-1;else this._selectElement.selectedIndex=previousSiblingCount;} _selectElementMouseOver(event) {if(typeof this.mouseOver==="function") this.mouseOver();} _selectElementMouseOut(event) {if(typeof this.mouseOut==="function") this.mouseOut();} _selectElementMouseDown(event) {this._updateSelectElement();} _selectElementMouseUp(event) {this.dispatchEventToListeners(WebInspector.HierarchicalPathComponent.Event.Clicked,{pathComponent:this.selectedPathComponent});} _selectElementSelectionChanged(event) {this.dispatchEventToListeners(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,{pathComponent:this.selectedPathComponent});}};WebInspector.HierarchicalPathComponent.MinimumWidth=32;WebInspector.HierarchicalPathComponent.MinimumWidthCollapsed=24;WebInspector.HierarchicalPathComponent.MinimumWidthForOneCharacterTruncatedTitle=54;WebInspector.HierarchicalPathComponent.SelectorArrowsWidth=12;WebInspector.HierarchicalPathComponent.Event={SiblingWasSelected:"hierarchical-path-component-sibling-was-selected",Clicked:"hierarchical-path-component-clicked"};WebInspector.NavigationItem=class NavigationItem extends WebInspector.Object {constructor(identifier,role,label) {super();this._identifier=identifier||null;this._element=document.createElement("div");this._hidden=false;this._parentNavigationBar=null;if(role) this._element.setAttribute("role",role);if(label) this._element.setAttribute("aria-label",label);this._element.classList.add(...this._classNames);this._element.navigationItem=this;} get identifier(){return this._identifier;} get element(){return this._element;} get minimumWidth(){return this._element.realOffsetWidth;} get parentNavigationBar(){return this._parentNavigationBar;} updateLayout(expandOnly) {} get hidden() {return this._hidden;} set hidden(flag) {if(this._hidden===flag) return;this._hidden=flag;this._element.classList.toggle("hidden",flag);if(this._parentNavigationBar) this._parentNavigationBar.needsLayout();} get _classNames() {var classNames=["item"];if(this._identifier) classNames.push(this._identifier);if(this.additionalClassNames instanceof Array) classNames=classNames.concat(this.additionalClassNames);return classNames;}};WebInspector.Popover=class Popover extends WebInspector.Object {constructor(delegate) {super();this.delegate=delegate;this._edge=null;this._frame=new WebInspector.Rect;this._content=null;this._targetFrame=new WebInspector.Rect;this._anchorPoint=new WebInspector.Point;this._preferredEdges=null;this._resizeHandler=null;this._contentNeedsUpdate=false;this._dismissing=false;this._element=document.createElement("div");this._element.className="popover";this._element.addEventListener("transitionend",this,true);this._container=this._element.appendChild(document.createElement("div"));this._container.className="container";} get element() {return this._element;} get frame() {return this._frame;} get visible() {return this._element.parentNode===document.body&&!this._element.classList.contains(WebInspector.Popover.FadeOutClassName);} set frame(frame) {this._element.style.left=frame.minX()+"px";this._element.style.top=frame.minY()+"px";this._element.style.width=frame.size.width+"px";this._element.style.height=frame.size.height+"px";this._element.style.backgroundSize=frame.size.width+"px "+frame.size.height+"px";this._frame=frame;} set content(content) {if(content===this._content) return;this._content=content;this._contentNeedsUpdate=true;if(this.visible) this._update(true);} set windowResizeHandler(resizeHandler) {this._resizeHandler=resizeHandler;} update(shouldAnimate=true) {if(!this.visible) return;var previouslyFocusedElement=document.activeElement;this._contentNeedsUpdate=true;this._update(shouldAnimate);if(previouslyFocusedElement) previouslyFocusedElement.focus();} present(targetFrame,preferredEdges) {this._targetFrame=targetFrame;this._preferredEdges=preferredEdges;if(!this._content) return;this._addListenersIfNeeded();this._update();} presentNewContentWithFrame(content,targetFrame,preferredEdges) {this._content=content;this._contentNeedsUpdate=true;this._targetFrame=targetFrame;this._preferredEdges=preferredEdges;this._addListenersIfNeeded();var shouldAnimate=this.visible;this._update(shouldAnimate);} dismiss() {if(this._dismissing||this._element.parentNode!==document.body) return;this._dismissing=true;this._isListeningForPopoverEvents=false;window.removeEventListener("mousedown",this,true);window.removeEventListener("scroll",this,true);window.removeEventListener("resize",this,true);window.removeEventListener("keypress",this,true);WebInspector.quickConsole.keyboardShortcutDisabled=false;this._element.classList.add(WebInspector.Popover.FadeOutClassName);if(this.delegate&&typeof this.delegate.willDismissPopover==="function") this.delegate.willDismissPopover(this);} handleEvent(event) {switch(event.type){case"mousedown":case"scroll":if(!this._element.contains(event.target)&&!event.target.enclosingNodeOrSelfWithClass(WebInspector.Popover.IgnoreAutoDismissClassName)&&!event[WebInspector.Popover.EventPreventDismissSymbol]){this.dismiss();} break;case"resize":if(this._resizeHandler) this._resizeHandler();break;case"keypress":if(event.keyCode===WebInspector.KeyboardShortcut.Key.Escape.keyCode) this.dismiss();break;case"transitionend":if(event.target===this._element){document.body.removeChild(this._element);this._element.classList.remove(WebInspector.Popover.FadeOutClassName);this._container.textContent="";if(this.delegate&&typeof this.delegate.didDismissPopover==="function") this.delegate.didDismissPopover(this);this._dismissing=false;break;} break;}} _update(shouldAnimate) {if(shouldAnimate) var previousEdge=this._edge;var targetFrame=this._targetFrame;var preferredEdges=this._preferredEdges; if(this._element.parentNode!==document.body) document.body.appendChild(this._element);else this._element.classList.remove(WebInspector.Popover.FadeOutClassName);this._dismissing=false;if(this._contentNeedsUpdate){this._element.style.removeProperty("left");this._element.style.removeProperty("top");this._element.style.removeProperty("width");this._element.style.removeProperty("height");if(this._edge!==null) this._element.classList.remove(this._cssClassNameForEdge());this._container.replaceWith(this._content);var popoverBounds=this._element.getBoundingClientRect();this._preferredSize=new WebInspector.Size(Math.ceil(popoverBounds.width),Math.ceil(popoverBounds.height));} var titleBarOffset=WebInspector.Platform.name==="mac"&&WebInspector.Platform.version.release>=10?22:0;var containerFrame=new WebInspector.Rect(0,titleBarOffset,window.innerWidth,window.innerHeight-titleBarOffset);containerFrame=containerFrame.inset(WebInspector.Popover.ShadowEdgeInsets);var metrics=new Array(preferredEdges.length);for(var edgeName in WebInspector.RectEdge){var edge=WebInspector.RectEdge[edgeName];var item={edge,metrics:this._bestMetricsForEdge(this._preferredSize,targetFrame,containerFrame,edge)};var preferredIndex=preferredEdges.indexOf(edge);if(preferredIndex!==-1) metrics[preferredIndex]=item;else metrics.push(item);} function area(size) {return size.width*size.height;} var bestEdge=metrics[0].edge;var bestMetrics=metrics[0].metrics;for(var i=1;iarea(bestMetrics.contentSize)){bestEdge=metrics[i].edge;bestMetrics=itemMetrics;}} var anchorPoint;var bestFrame=bestMetrics.frame.round();this._edge=bestEdge;if(bestFrame===WebInspector.Rect.ZERO_RECT){this.dismiss();}else{switch(bestEdge){case WebInspector.RectEdge.MIN_X:anchorPoint=new WebInspector.Point(bestFrame.size.width-WebInspector.Popover.ShadowPadding,targetFrame.midY()-bestFrame.minY());break;case WebInspector.RectEdge.MAX_X:anchorPoint=new WebInspector.Point(WebInspector.Popover.ShadowPadding,targetFrame.midY()-bestFrame.minY());break;case WebInspector.RectEdge.MIN_Y:anchorPoint=new WebInspector.Point(targetFrame.midX()-bestFrame.minX(),bestFrame.size.height-WebInspector.Popover.ShadowPadding);break;case WebInspector.RectEdge.MAX_Y:anchorPoint=new WebInspector.Point(targetFrame.midX()-bestFrame.minX(),WebInspector.Popover.ShadowPadding);break;} this._element.classList.add(this._cssClassNameForEdge());if(shouldAnimate&&this._edge===previousEdge) this._animateFrame(bestFrame,anchorPoint);else{this.frame=bestFrame;this._setAnchorPoint(anchorPoint);this._drawBackground();} if(this._preferredSize.widthcontainerFrame.maxY()) y=containerFrame.maxY()-height;}else{if(xcontainerFrame.maxX()) x=containerFrame.maxX()-width;} var preferredFrame=new WebInspector.Rect(x,y,width,height);var bestFrame=preferredFrame.intersectionWithRect(containerFrame);width=bestFrame.size.width-(WebInspector.Popover.ShadowPadding*2);height=bestFrame.size.height-(WebInspector.Popover.ShadowPadding*2);switch(edge){case WebInspector.RectEdge.MIN_X:case WebInspector.RectEdge.MAX_X:width-=arrowLength;break;case WebInspector.RectEdge.MIN_Y:case WebInspector.RectEdge.MAX_Y:height-=arrowLength;break;} return{frame:bestFrame,contentSize:new WebInspector.Size(width,height)};} _drawFrame(ctx,bounds,anchorEdge) {let cornerRadius=WebInspector.Popover.CornerRadius;let arrowHalfLength=WebInspector.Popover.AnchorSize.width*0.5;let anchorPoint=this._anchorPoint;let arrowPadding=cornerRadius+arrowHalfLength;if(anchorEdge===WebInspector.RectEdge.MIN_Y||anchorEdge===WebInspector.RectEdge.MAX_Y) anchorPoint.x=Number.constrain(anchorPoint.x,bounds.minX()+arrowPadding,bounds.maxX()-arrowPadding);else anchorPoint.y=Number.constrain(anchorPoint.y,bounds.minY()+arrowPadding,bounds.maxY()-arrowPadding);ctx.beginPath();switch(anchorEdge){case WebInspector.RectEdge.MIN_X:ctx.moveTo(bounds.maxX(),bounds.minY()+cornerRadius);ctx.lineTo(bounds.maxX(),anchorPoint.y-arrowHalfLength);ctx.lineTo(anchorPoint.x,anchorPoint.y);ctx.lineTo(bounds.maxX(),anchorPoint.y+arrowHalfLength);ctx.arcTo(bounds.maxX(),bounds.maxY(),bounds.minX(),bounds.maxY(),cornerRadius);ctx.arcTo(bounds.minX(),bounds.maxY(),bounds.minX(),bounds.minY(),cornerRadius);ctx.arcTo(bounds.minX(),bounds.minY(),bounds.maxX(),bounds.minY(),cornerRadius);ctx.arcTo(bounds.maxX(),bounds.minY(),bounds.maxX(),bounds.maxY(),cornerRadius);break;case WebInspector.RectEdge.MAX_X:ctx.moveTo(bounds.minX(),bounds.maxY()-cornerRadius);ctx.lineTo(bounds.minX(),anchorPoint.y+arrowHalfLength);ctx.lineTo(anchorPoint.x,anchorPoint.y);ctx.lineTo(bounds.minX(),anchorPoint.y-arrowHalfLength);ctx.arcTo(bounds.minX(),bounds.minY(),bounds.maxX(),bounds.minY(),cornerRadius);ctx.arcTo(bounds.maxX(),bounds.minY(),bounds.maxX(),bounds.maxY(),cornerRadius);ctx.arcTo(bounds.maxX(),bounds.maxY(),bounds.minX(),bounds.maxY(),cornerRadius);ctx.arcTo(bounds.minX(),bounds.maxY(),bounds.minX(),bounds.minY(),cornerRadius);break;case WebInspector.RectEdge.MIN_Y:ctx.moveTo(bounds.maxX()-cornerRadius,bounds.maxY());ctx.lineTo(anchorPoint.x+arrowHalfLength,bounds.maxY());ctx.lineTo(anchorPoint.x,anchorPoint.y);ctx.lineTo(anchorPoint.x-arrowHalfLength,bounds.maxY());ctx.arcTo(bounds.minX(),bounds.maxY(),bounds.minX(),bounds.minY(),cornerRadius);ctx.arcTo(bounds.minX(),bounds.minY(),bounds.maxX(),bounds.minY(),cornerRadius);ctx.arcTo(bounds.maxX(),bounds.minY(),bounds.maxX(),bounds.maxY(),cornerRadius);ctx.arcTo(bounds.maxX(),bounds.maxY(),bounds.minX(),bounds.maxY(),cornerRadius);break;case WebInspector.RectEdge.MAX_Y:ctx.moveTo(bounds.minX()+cornerRadius,bounds.minY());ctx.lineTo(anchorPoint.x-arrowHalfLength,bounds.minY());ctx.lineTo(anchorPoint.x,anchorPoint.y);ctx.lineTo(anchorPoint.x+arrowHalfLength,bounds.minY());ctx.arcTo(bounds.maxX(),bounds.minY(),bounds.maxX(),bounds.maxY(),cornerRadius);ctx.arcTo(bounds.maxX(),bounds.maxY(),bounds.minX(),bounds.maxY(),cornerRadius);ctx.arcTo(bounds.minX(),bounds.maxY(),bounds.minX(),bounds.minY(),cornerRadius);ctx.arcTo(bounds.minX(),bounds.minY(),bounds.maxX(),bounds.minY(),cornerRadius);break;} ctx.closePath();} _addListenersIfNeeded() {if(!this._isListeningForPopoverEvents){this._isListeningForPopoverEvents=true;window.addEventListener("mousedown",this,true);window.addEventListener("scroll",this,true);window.addEventListener("resize",this,true);window.addEventListener("keypress",this,true);WebInspector.quickConsole.keyboardShortcutDisabled=true;}}};WebInspector.Popover.FadeOutClassName="fade-out";WebInspector.Popover.CornerRadius=5;WebInspector.Popover.MinWidth=40;WebInspector.Popover.MinHeight=40;WebInspector.Popover.ShadowPadding=5;WebInspector.Popover.ContentPadding=5;WebInspector.Popover.AnchorSize=new WebInspector.Size(22,11);WebInspector.Popover.ShadowEdgeInsets=new WebInspector.EdgeInsets(WebInspector.Popover.ShadowPadding);WebInspector.Popover.IgnoreAutoDismissClassName="popover-ignore-auto-dismiss";WebInspector.Popover.EventPreventDismissSymbol=Symbol("popover-event-prevent-dismiss");WebInspector.SidebarPanel=class SidebarPanel extends WebInspector.View {constructor(identifier,displayName) {super();this._identifier=identifier;this._displayName=displayName;this._selected=false;this._savedScrollPosition=0;this.element.classList.add("panel",identifier);this.element.setAttribute("role","group");this.element.setAttribute("aria-label",displayName);this._contentView=new WebInspector.View;this._contentView.element.classList.add("content");this.addSubview(this._contentView);} get identifier() {return this._identifier;} get contentView() {return this._contentView;} get displayName() {return this._displayName;} get visible() {return this.selected&&this.parentSidebar&&!this.parentSidebar.collapsed;} get selected() {return this._selected;} set selected(flag) {if(flag===this._selected) return;this._selected=flag||false;this.element.classList.toggle("selected",this._selected);} get parentSidebar() {return this.parentView;} get minimumWidth() {return 0;} show() {if(!this.parentSidebar) return;this.parentSidebar.collapsed=false;this.parentSidebar.selectedSidebarPanel=this;} hide() {if(!this.parentSidebar) return;this.parentSidebar.collapsed=true;this.parentSidebar.selectedSidebarPanel=null;} added() {} removed() {} shown() {this._contentView.element.scrollTop=this._savedScrollPosition;this.updateLayoutIfNeeded();} hidden() {this._savedScrollPosition=this._contentView.element.scrollTop;} visibilityDidChange() {}};WebInspector.StyleDetailsPanel=class StyleDetailsPanel extends WebInspector.View {constructor(delegate,className,identifier,label) {super();this._delegate=delegate||null;this.element.classList.add(className,"offset-sections");this._navigationInfo={identifier,label};this._nodeStyles=null;this._visible=false;} get navigationInfo() {return this._navigationInfo;} get nodeStyles() {return this._nodeStyles;} shown() {if(this._visible) return;this._visible=true;this._refreshNodeStyles();this.updateLayoutIfNeeded();} hidden() {this._visible=false;this.cancelLayout();} markAsNeedsRefresh(domNode) {if(!domNode) return;if(!this._nodeStyles||this._nodeStyles.node!==domNode){if(this._nodeStyles){this._nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.Refreshed,this.nodeStylesRefreshed,this);this._nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.NeedsRefresh,this._nodeStylesNeedsRefreshed,this);} this._nodeStyles=WebInspector.cssStyleManager.stylesForNode(domNode);if(!this._nodeStyles) return;this._nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed,this.nodeStylesRefreshed,this);this._nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.NeedsRefresh,this._nodeStylesNeedsRefreshed,this);this._forceSignificantChange=true;} if(this._visible) this._refreshNodeStyles();} refresh(significantChange) {this.dispatchEventToListeners(WebInspector.StyleDetailsPanel.Event.Refreshed);} nodeStylesRefreshed(event) {if(this._visible) this._refreshPreservingScrollPosition(event.data.significantChange);} get _initialScrollOffset() {if(!WebInspector.cssStyleManager.canForcePseudoClasses()) return 0;return this.nodeStyles.node.enabledPseudoClasses.length?0:WebInspector.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset;} _refreshNodeStyles() {if(!this._nodeStyles) return;this._nodeStyles.refresh();} _refreshPreservingScrollPosition(significantChange) {significantChange=this._forceSignificantChange||significantChange||false;var previousScrollTop=this._initialScrollOffset;if(this.element.parentNode&&this._previousRefreshNodeIdentifier===this._nodeStyles.node.id) previousScrollTop=this.element.parentNode.scrollTop;this.refresh(significantChange);this._previousRefreshNodeIdentifier=this._nodeStyles.node.id;if(this.element.parentNode) this.element.parentNode.scrollTop=previousScrollTop;this._forceSignificantChange=false;} _nodeStylesNeedsRefreshed(event) {if(this._visible) this._refreshNodeStyles();}};WebInspector.StyleDetailsPanel.Event={Refreshed:"style-details-panel-refreshed"};WebInspector.TabBar=class TabBar extends WebInspector.View {constructor(element,tabBarItems) {super(element);this.element.classList.add("tab-bar");this.element.setAttribute("role","tablist");this.element.addEventListener("mousedown",this._handleMouseDown.bind(this));this.element.addEventListener("click",this._handleClick.bind(this));this.element.addEventListener("mouseleave",this._handleMouseLeave.bind(this));this.element.createChild("div","top-border");this._tabBarItems=[];if(tabBarItems){for(let tabBarItem in tabBarItems) this.addTabBarItem(tabBarItem);} this.addTabBarItem(WebInspector.settingsTabContentView.tabBarItem,{suppressAnimations:true});this._newTabTabBarItem=new WebInspector.PinnedTabBarItem("Images/NewTabPlus.svg",WebInspector.UIString("Create a new tab"));this._newTabTabBarItem.element.addEventListener("mouseenter",this._handleNewTabMouseEnter.bind(this));this._newTabTabBarItem.element.addEventListener("click",this._handleNewTabClick.bind(this));this.addTabBarItem(this._newTabTabBarItem,{suppressAnimations:true});} get newTabTabBarItem(){return this._newTabTabBarItem;} updateNewTabTabBarItemState() {let newTabExists=!WebInspector.isNewTabWithTypeAllowed(WebInspector.NewTabContentView.Type);this._newTabTabBarItem.disabled=newTabExists;} addTabBarItem(tabBarItem,options={}) {return this.insertTabBarItem(tabBarItem,this._tabBarItems.length,options);} insertTabBarItem(tabBarItem,index,options={}) {if(!(tabBarItem instanceof WebInspector.TabBarItem)) return null;if(tabBarItem.parentTabBar===this) return null;if(this._tabAnimatedClosedSinceMouseEnter){this._finishExpandingTabsAfterClose().then(()=>{this.insertTabBarItem(tabBarItem,index,options);});return null;} if(tabBarItem.parentTabBar) tabBarItem.parentTabBar.removeTabBarItem(tabBarItem);tabBarItem.parentTabBar=this;index=Number.constrain(index,0,this.normalTabCount);if(this.element.classList.contains("animating")){requestAnimationFrame(removeStyles.bind(this));options.suppressAnimations=true;} var beforeTabSizesAndPositions;if(!options.suppressAnimations) beforeTabSizesAndPositions=this._recordTabBarItemSizesAndPositions();this._tabBarItems.splice(index,0,tabBarItem);var nextSibling=this._tabBarItems[index+1];let nextSiblingElement=nextSibling?nextSibling.element:this._tabBarItems.lastValue.element;if(this.element.isAncestor(nextSiblingElement)) this.element.insertBefore(tabBarItem.element,nextSiblingElement);else this.element.appendChild(tabBarItem.element);this.element.classList.toggle("single-tab",!this._hasMoreThanOneNormalTab());tabBarItem.element.style.left=null;tabBarItem.element.style.width=null;function animateTabs() {this.element.classList.add("animating");this.element.classList.add("inserting-tab");this._applyTabBarItemSizesAndPositions(afterTabSizesAndPositions);this.element.addEventListener("webkitTransitionEnd",removeStylesListener);} function removeStyles() {this.element.classList.remove("static-layout");this.element.classList.remove("animating");this.element.classList.remove("inserting-tab");tabBarItem.element.classList.remove("being-inserted");this._clearTabBarItemSizesAndPositions();this.element.removeEventListener("webkitTransitionEnd",removeStylesListener);} if(!options.suppressAnimations){var afterTabSizesAndPositions=this._recordTabBarItemSizesAndPositions();this.updateLayout();let tabBarItems=this._tabBarItemsFromLeftToRight();let previousTabBarItem=tabBarItems[tabBarItems.indexOf(tabBarItem)-1]||null;let previousTabBarItemSizeAndPosition=previousTabBarItem?beforeTabSizesAndPositions.get(previousTabBarItem):null;if(previousTabBarItemSizeAndPosition) beforeTabSizesAndPositions.set(tabBarItem,{left:previousTabBarItemSizeAndPosition.left+previousTabBarItemSizeAndPosition.width,width:0});else beforeTabSizesAndPositions.set(tabBarItem,{left:0,width:0});this.element.classList.add("static-layout");tabBarItem.element.classList.add("being-inserted");this._applyTabBarItemSizesAndPositions(beforeTabSizesAndPositions);var removeStylesListener=removeStyles.bind(this);requestAnimationFrame(animateTabs.bind(this));}else this.needsLayout();if(!(tabBarItem instanceof WebInspector.PinnedTabBarItem)) this.updateNewTabTabBarItemState();this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemAdded,{tabBarItem});return tabBarItem;} removeTabBarItem(tabBarItemOrIndex,options={}) {let tabBarItem=this._findTabBarItem(tabBarItemOrIndex);if(!tabBarItem||tabBarItem instanceof WebInspector.PinnedTabBarItem) return null;tabBarItem.parentTabBar=null;if(this._selectedTabBarItem===tabBarItem){var index=this._tabBarItems.indexOf(tabBarItem);var nextTabBarItem=this._tabBarItems[index+1];if(!nextTabBarItem||nextTabBarItem instanceof WebInspector.PinnedTabBarItem) nextTabBarItem=this._tabBarItems[index-1];this.selectedTabBarItem=nextTabBarItem;} if(this.element.classList.contains("animating")){requestAnimationFrame(removeStyles.bind(this));options.suppressAnimations=true;} var beforeTabSizesAndPositions;if(!options.suppressAnimations) beforeTabSizesAndPositions=this._recordTabBarItemSizesAndPositions();let wasLastNormalTab=this._tabBarItems.indexOf(tabBarItem)===this.normalTabCount-1;this._tabBarItems.remove(tabBarItem);tabBarItem.element.remove();var hasMoreThanOneNormalTab=this._hasMoreThanOneNormalTab();this.element.classList.toggle("single-tab",!hasMoreThanOneNormalTab);const shouldOpenDefaultTab=!tabBarItem.isDefaultTab&&!this.normalTabCount;if(shouldOpenDefaultTab) options.suppressAnimations=true;if(!hasMoreThanOneNormalTab||wasLastNormalTab||!options.suppressExpansion){if(!options.suppressAnimations){this._tabAnimatedClosedSinceMouseEnter=true;this._finishExpandingTabsAfterClose(beforeTabSizesAndPositions);}else this.needsLayout();this.updateNewTabTabBarItemState();this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemRemoved,{tabBarItem});if(shouldOpenDefaultTab) this._openDefaultTab();return tabBarItem;} var lastNormalTabBarItem;function animateTabs() {this.element.classList.add("animating");this.element.classList.add("closing-tab"); let extraSpaceBetweenNormalAndPinnedTabs=0;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL){extraSpaceBetweenNormalAndPinnedTabs=this.element.getBoundingClientRect().width;for(let currentTabBarItem of this._tabBarItemsFromLeftToRight()) extraSpaceBetweenNormalAndPinnedTabs-=currentTabBarItem.element.getBoundingClientRect().width;} let left=0;for(let currentTabBarItem of this._tabBarItemsFromLeftToRight()){let sizeAndPosition=beforeTabSizesAndPositions.get(currentTabBarItem);if(!(currentTabBarItem instanceof WebInspector.PinnedTabBarItem)){currentTabBarItem.element.style.left=extraSpaceBetweenNormalAndPinnedTabs+left+"px";left+=sizeAndPosition.width;lastNormalTabBarItem=currentTabBarItem;}else left=sizeAndPosition.left+sizeAndPosition.width;} if(this._selectedTabBarItem) this._selectedTabBarItem.element.style.width=(parseFloat(this._selectedTabBarItem.element.style.width)+1)+"px";if(lastNormalTabBarItem!==this._selectedTabBarItem) lastNormalTabBarItem.element.style.width=(parseFloat(lastNormalTabBarItem.element.style.width)+1)+"px";this.element.addEventListener("webkitTransitionEnd",removeStylesListener);} function removeStyles() {if(this._selectedTabBarItem&&this._selectedTabBarItem!==lastNormalTabBarItem) this._selectedTabBarItem.element.style.width=(parseFloat(this._selectedTabBarItem.element.style.width)-1)+"px";this.element.classList.remove("animating");this.element.classList.remove("closing-tab");this.updateLayout();this.element.removeEventListener("webkitTransitionEnd",removeStylesListener);} if(!options.suppressAnimations){this.element.classList.add("static-layout");this._tabAnimatedClosedSinceMouseEnter=true;this._applyTabBarItemSizesAndPositions(beforeTabSizesAndPositions);var removeStylesListener=removeStyles.bind(this);requestAnimationFrame(animateTabs.bind(this));}else this.needsLayout();this.updateNewTabTabBarItemState();this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemRemoved,{tabBarItem});if(shouldOpenDefaultTab) this._openDefaultTab();return tabBarItem;} selectPreviousTab() {if(this._tabBarItems.length<=1) return;var startIndex=this._tabBarItems.indexOf(this._selectedTabBarItem);var newIndex=startIndex;do{if(newIndex===0) newIndex=this._tabBarItems.length-1;else newIndex--;if(!(this._tabBarItems[newIndex]instanceof WebInspector.PinnedTabBarItem)) break;}while(newIndex!==startIndex);if(newIndex===startIndex) return;this.selectedTabBarItem=this._tabBarItems[newIndex];} selectNextTab() {if(this._tabBarItems.length<=1) return;var startIndex=this._tabBarItems.indexOf(this._selectedTabBarItem);var newIndex=startIndex;do{if(newIndex===this._tabBarItems.length-1) newIndex=0;else newIndex++;if(!(this._tabBarItems[newIndex]instanceof WebInspector.PinnedTabBarItem)) break;}while(newIndex!==startIndex);if(newIndex===startIndex) return;this.selectedTabBarItem=this._tabBarItems[newIndex];} get selectedTabBarItem() {return this._selectedTabBarItem;} set selectedTabBarItem(tabBarItemOrIndex) {let tabBarItem=this._findTabBarItem(tabBarItemOrIndex);if(tabBarItem===this._newTabTabBarItem){tabBarItem=this._tabBarItems[this.normalTabCount-1];} if(this._selectedTabBarItem===tabBarItem) return;if(this._selectedTabBarItem) this._selectedTabBarItem.selected=false;this._selectedTabBarItem=tabBarItem||null;if(this._selectedTabBarItem) this._selectedTabBarItem.selected=true;this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemSelected);} get tabBarItems() {return this._tabBarItems;} get normalTabCount() {return this._tabBarItems.filter((item)=>!(item instanceof WebInspector.PinnedTabBarItem)).length;} layout() {if(this.element.classList.contains("static-layout")) return;this.element.classList.remove("hide-titles");this.element.classList.remove("collapsed");let firstNormalTabItem=null;for(let tabItem of this._tabBarItems){if(tabItem instanceof WebInspector.PinnedTabBarItem) continue;firstNormalTabItem=tabItem;break;} if(!firstNormalTabItem) return;if(firstNormalTabItem.element.offsetWidth>=120) return;this.element.classList.add("collapsed");if(firstNormalTabItem.element.offsetWidth>=75) return;this.element.classList.add("hide-titles");} _tabBarItemsFromLeftToRight() {return WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.LTR?this._tabBarItems:this._tabBarItems.slice().reverse();} _findTabBarItem(tabBarItemOrIndex) {if(typeof tabBarItemOrIndex==="number") return this._tabBarItems[tabBarItemOrIndex]||null;if(tabBarItemOrIndex instanceof WebInspector.TabBarItem){if(this._tabBarItems.includes(tabBarItemOrIndex)) return tabBarItemOrIndex;} return null;} _hasMoreThanOneNormalTab() {let normalTabCount=0;for(let tabBarItem of this._tabBarItems){if(tabBarItem instanceof WebInspector.PinnedTabBarItem) continue;++normalTabCount;if(normalTabCount>=2) return true;} return false;} _openDefaultTab() {this.dispatchEventToListeners(WebInspector.TabBar.Event.OpenDefaultTab);} _recordTabBarItemSizesAndPositions() {var tabBarItemSizesAndPositions=new Map;const barRect=this.element.getBoundingClientRect();for(var tabBarItem of this._tabBarItems){var boundingRect=tabBarItem.element.getBoundingClientRect();tabBarItemSizesAndPositions.set(tabBarItem,{left:boundingRect.left-barRect.left,width:boundingRect.width});} return tabBarItemSizesAndPositions;} _applyTabBarItemSizesAndPositions(tabBarItemSizesAndPositions,skipTabBarItem) {for(var[tabBarItem,sizeAndPosition]of tabBarItemSizesAndPositions){if(skipTabBarItem&&tabBarItem===skipTabBarItem) continue;tabBarItem.element.style.left=sizeAndPosition.left+"px";tabBarItem.element.style.width=sizeAndPosition.width+"px";}} _clearTabBarItemSizesAndPositions(skipTabBarItem) {for(var tabBarItem of this._tabBarItems){if(skipTabBarItem&&tabBarItem===skipTabBarItem) continue;tabBarItem.element.style.left=null;tabBarItem.element.style.width=null;}} _finishExpandingTabsAfterClose(beforeTabSizesAndPositions) {return new Promise(function(resolve,reject){this._tabAnimatedClosedSinceMouseEnter=false;if(!beforeTabSizesAndPositions) beforeTabSizesAndPositions=this._recordTabBarItemSizesAndPositions();this.element.classList.remove("static-layout");this._clearTabBarItemSizesAndPositions();var afterTabSizesAndPositions=this._recordTabBarItemSizesAndPositions();this._applyTabBarItemSizesAndPositions(beforeTabSizesAndPositions);this.element.classList.add("static-layout");function animateTabs() {this.element.classList.add("static-layout");this.element.classList.add("animating");this.element.classList.add("expanding-tabs");this._applyTabBarItemSizesAndPositions(afterTabSizesAndPositions);this.element.addEventListener("webkitTransitionEnd",removeStylesListener);} function removeStyles() {this.element.classList.remove("static-layout");this.element.classList.remove("animating");this.element.classList.remove("expanding-tabs");this._clearTabBarItemSizesAndPositions();this.updateLayout();this.element.removeEventListener("webkitTransitionEnd",removeStylesListener);resolve();} var removeStylesListener=removeStyles.bind(this);requestAnimationFrame(animateTabs.bind(this));}.bind(this));} _handleMouseDown(event) {if(event.button!==0||event.ctrlKey) return;let itemElement=event.target.enclosingNodeOrSelfWithClass(WebInspector.TabBarItem.StyleClassName);if(!itemElement) return;let tabBarItem=itemElement[WebInspector.TabBarItem.ElementReferenceSymbol];if(!tabBarItem) return;if(tabBarItem.disabled) return;if(tabBarItem===this._newTabTabBarItem) return;let closeButtonElement=event.target.enclosingNodeOrSelfWithClass(WebInspector.TabBarItem.CloseButtonStyleClassName);if(closeButtonElement) return;this.selectedTabBarItem=tabBarItem;if(tabBarItem instanceof WebInspector.PinnedTabBarItem||!this._hasMoreThanOneNormalTab()) return;this._firstNormalTabItemIndex=0;for(let i=0;i=0;--i){let item=this._tabBarItems[i];if(item===tabBarItem||item instanceof WebInspector.PinnedTabBarItem) continue;this.removeTabBarItem(item);}}} _handleMouseMoved(event) {if(!this._mouseIsDown) return;if(!this._selectedTabBarItem) return;event.preventDefault();event.stopPropagation();if(!this.element.classList.contains("static-layout")){this._applyTabBarItemSizesAndPositions(this._recordTabBarItemSizesAndPositions());this.element.classList.add("static-layout");this.element.classList.add("dragging-tab");} if(this._mouseOffset===undefined) this._mouseOffset=event.pageX-this._selectedTabBarItem.element.totalOffsetLeft;var tabBarMouseOffset=event.pageX-this.element.totalOffsetLeft;var newLeft=tabBarMouseOffset-this._mouseOffset;this._selectedTabBarItem.element.style.left=newLeft+"px";var selectedTabMidX=newLeft+(this._selectedTabBarItem.element.realOffsetWidth/2);var currentIndex=this._tabBarItems.indexOf(this._selectedTabBarItem);var newIndex=currentIndex;for(let tabBarItem of this._tabBarItems){if(tabBarItem===this._selectedTabBarItem) continue;var tabBarItemRect=tabBarItem.element.getBoundingClientRect();if(selectedTabMidXtabBarItemRect.right) continue;newIndex=this._tabBarItems.indexOf(tabBarItem);break;} newIndex=Number.constrain(newIndex,this._firstNormalTabItemIndex,this.normalTabCount-1);if(currentIndex===newIndex) return;this._tabBarItems.splice(currentIndex,1);this._tabBarItems.splice(newIndex,0,this._selectedTabBarItem);let nextSibling=this._tabBarItems[newIndex+1];let nextSiblingElement=nextSibling?nextSibling.element:this._newTabTabBarItem.element;this.element.insertBefore(this._selectedTabBarItem.element,nextSiblingElement);let left=0;for(let tabBarItem of this._tabBarItemsFromLeftToRight()){if(tabBarItem!==this._selectedTabBarItem&&tabBarItem!==this._newTabTabBarItem&&parseFloat(tabBarItem.element.style.left)!==left) tabBarItem.element.style.left=left+"px";left+=parseFloat(tabBarItem.element.style.width);}} _handleMouseUp(event) {if(!this._mouseIsDown) return;this.element.classList.remove("dragging-tab");if(!this._tabAnimatedClosedSinceMouseEnter){this.element.classList.remove("static-layout");this._clearTabBarItemSizesAndPositions();}else{let left=0;for(let tabBarItem of this._tabBarItemsFromLeftToRight()){if(tabBarItem===this._selectedTabBarItem) tabBarItem.element.style.left=left+"px";left+=parseFloat(tabBarItem.element.style.width);}} this._mouseIsDown=false;this._mouseOffset=undefined;document.removeEventListener("mousemove",this._mouseMovedEventListener,true);document.removeEventListener("mouseup",this._mouseUpEventListener,true);this._mouseMovedEventListener=null;this._mouseUpEventListener=null;event.preventDefault();event.stopPropagation();this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemsReordered);} _handleMouseLeave(event) {if(this._mouseIsDown||!this._tabAnimatedClosedSinceMouseEnter||!this.element.classList.contains("static-layout")||this.element.classList.contains("animating")) return;const barRect=this.element.getBoundingClientRect();const newTabItemRect=this._newTabTabBarItem.element.getBoundingClientRect();if(event.pageY>barRect.top&&event.pageYbarRect.left&&event.pageX<(newTabItemRect?newTabItemRect.right:barRect.right)) return;this._finishExpandingTabsAfterClose();} _handleNewTabClick(event) {WebInspector.showNewTabTab();} _handleNewTabMouseEnter(event) {if(!this._tabAnimatedClosedSinceMouseEnter||!this.element.classList.contains("static-layout")||this.element.classList.contains("animating")) return;this._finishExpandingTabsAfterClose();}};WebInspector.TabBar.Event={TabBarItemSelected:"tab-bar-tab-bar-item-selected",TabBarItemAdded:"tab-bar-tab-bar-item-added",TabBarItemRemoved:"tab-bar-tab-bar-item-removed",TabBarItemsReordered:"tab-bar-tab-bar-items-reordered",OpenDefaultTab:"tab-bar-open-default-tab"};WebInspector.TabBarItem=class TabBarItem extends WebInspector.Object {constructor(image,title,representedObject) {super();this._parentTabBar=null;this._element=document.createElement("div");this._element.classList.add(WebInspector.TabBarItem.StyleClassName);this._element.setAttribute("role","tab");this._element.tabIndex=0;this._element[WebInspector.TabBarItem.ElementReferenceSymbol]=this;this._element.createChild("div","flex-space");this._iconElement=document.createElement("img");this._iconElement.classList.add("icon");this._element.appendChild(this._iconElement);this._element.createChild("div","flex-space");this.title=title;this.image=image;this.representedObject=representedObject;} get element(){return this._element;} get representedObject(){return this._representedObject;} set representedObject(representedObject){this._representedObject=representedObject||null;} get parentTabBar(){return this._parentTabBar;} set parentTabBar(tabBar){this._parentTabBar=tabBar||null;} get selected() {return this._element.classList.contains("selected");} set selected(selected) {this._element.classList.toggle("selected",selected);if(selected) this._element.setAttribute("aria-selected","true");else this._element.removeAttribute("aria-selected");} get disabled() {return this._element.classList.contains("disabled");} set disabled(disabled) {this._element.classList.toggle("disabled",disabled);} get isDefaultTab() {return this._element.classList.contains("default-tab");} set isDefaultTab(isDefaultTab) {this._element.classList.toggle("default-tab",isDefaultTab);} get image(){return this._iconElement.src;} set image(url){this._iconElement.src=url||"";} get title(){return this._element.title||"";} set title(title){this._element.title=title||"";}};WebInspector.TabBarItem.StyleClassName="item";WebInspector.TabBarItem.CloseButtonStyleClassName="close";WebInspector.TabBarItem.ElementReferenceSymbol=Symbol("tab-bar-item");WebInspector.TabBrowser=class TabBrowser extends WebInspector.View {constructor(element,tabBar,navigationSidebar,detailsSidebar) {super(element);this.element.classList.add("tab-browser");this._tabBar=tabBar;this._navigationSidebar=navigationSidebar||null;this._detailsSidebar=detailsSidebar||null;if(this._navigationSidebar){this._navigationSidebar.addEventListener(WebInspector.Sidebar.Event.CollapsedStateDidChange,this._sidebarCollapsedStateDidChange,this);this._navigationSidebar.addEventListener(WebInspector.Sidebar.Event.WidthDidChange,this._sidebarWidthDidChange,this);} if(this._detailsSidebar){this._detailsSidebar.addEventListener(WebInspector.Sidebar.Event.CollapsedStateDidChange,this._sidebarCollapsedStateDidChange,this);this._detailsSidebar.addEventListener(WebInspector.Sidebar.Event.SidebarPanelSelected,this._sidebarPanelSelected,this);this._detailsSidebar.addEventListener(WebInspector.Sidebar.Event.WidthDidChange,this._sidebarWidthDidChange,this);} this._contentViewContainer=new WebInspector.ContentViewContainer;this.addSubview(this._contentViewContainer);let showNextTab=()=>{this._showNextTab();};let showPreviousTab=()=>{this._showPreviousTab();};let isRTL=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL;let nextKey1=isRTL?WebInspector.KeyboardShortcut.Key.LeftCurlyBrace:WebInspector.KeyboardShortcut.Key.RightCurlyBrace;let previousKey1=isRTL?WebInspector.KeyboardShortcut.Key.RightCurlyBrace:WebInspector.KeyboardShortcut.Key.LeftCurlyBrace;this._showNextTabKeyboardShortcut1=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,nextKey1,showNextTab);this._showPreviousTabKeyboardShortcut1=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,previousKey1,showPreviousTab);let nextModifier2=isRTL?WebInspector.KeyboardShortcut.Modifier.Shift:0;let previousModifier2=isRTL?0:WebInspector.KeyboardShortcut.Modifier.Shift;this._showNextTabKeyboardShortcut2=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control|nextModifier2,WebInspector.KeyboardShortcut.Key.Tab,showNextTab);this._showPreviousTabKeyboardShortcut2=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control|previousModifier2,WebInspector.KeyboardShortcut.Key.Tab,showPreviousTab);let previousTabKey=isRTL?WebInspector.KeyboardShortcut.Key.Right:WebInspector.KeyboardShortcut.Key.Left;let nextTabKey=isRTL?WebInspector.KeyboardShortcut.Key.Left:WebInspector.KeyboardShortcut.Key.Right;this._previousTabKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,previousTabKey,this._showPreviousTabCheckingForEditableField.bind(this));this._previousTabKeyboardShortcut.implicitlyPreventsDefault=false;this._nextTabKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,nextTabKey,this._showNextTabCheckingForEditableField.bind(this));this._nextTabKeyboardShortcut.implicitlyPreventsDefault=false;this._tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemSelected,this._tabBarItemSelected,this);this._tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemAdded,this._tabBarItemAdded,this);this._tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemRemoved,this._tabBarItemRemoved,this);this._tabBar.newTabTabBarItem.addEventListener(WebInspector.PinnedTabBarItem.Event.ContextMenu,this._handleNewTabContextMenu,this);this._recentTabContentViews=[];this._closedTabClasses=new Set;} get tabBar() {return this._tabBar;} get navigationSidebar() {return this._navigationSidebar;} get detailsSidebar() {return this._detailsSidebar;} get selectedTabContentView() {return this._contentViewContainer.currentContentView;} bestTabContentViewForClass(constructor) {for(var tabContentView of this._recentTabContentViews){if(tabContentView instanceof constructor) return tabContentView;} return null;} bestTabContentViewForRepresentedObject(representedObject,options={}) {for(var tabContentView of this._recentTabContentViews){if(options.ignoreSearchTab&&tabContentView instanceof WebInspector.SearchTabContentView) continue;if(options.ignoreNetworkTab&&tabContentView instanceof WebInspector.NetworkTabContentView) continue;if(tabContentView.canShowRepresentedObject(representedObject)) return tabContentView;} return null;} addTabForContentView(tabContentView,options={}) {if(!(tabContentView instanceof WebInspector.TabContentView)) return false;let tabBarItem=tabContentView.tabBarItem;if(!(tabBarItem instanceof WebInspector.TabBarItem)) return false;if(tabBarItem.representedObject!==tabContentView) tabBarItem.representedObject=tabContentView;tabContentView.parentTabBrowser=this;if(tabBarItem.parentTabBar===this._tabBar) return true; if(this._recentTabContentViews.length&&this.selectedTabContentView) this._recentTabContentViews.splice(1,0,tabContentView);else this._recentTabContentViews.push(tabContentView);if(typeof options.insertionIndex==="number") this._tabBar.insertTabBarItem(tabBarItem,options.insertionIndex,options);else this._tabBar.addTabBarItem(tabBarItem,options);return true;} showTabForContentView(tabContentView,options={}) {if(!this.addTabForContentView(tabContentView,options)) return false;if(!options.suppressSelection) this._tabBar.selectedTabBarItem=tabContentView.tabBarItem; this.needsLayout();return true;} closeTabForContentView(tabContentView,options={}) {if(!(tabContentView instanceof WebInspector.TabContentView)) return false;if(!(tabContentView.tabBarItem instanceof WebInspector.TabBarItem)) return false;if(tabContentView.tabBarItem.parentTabBar!==this._tabBar) return false;this._tabBar.removeTabBarItem(tabContentView.tabBarItem,options);return true;} layout() {if(this.layoutReason!==WebInspector.View.LayoutReason.Resize) return;for(let tabContentView of this._recentTabContentViews) tabContentView[WebInspector.TabBrowser.NeedsResizeLayoutSymbol]=tabContentView!==this.selectedTabContentView;} _tabBarItemSelected(event) {let tabContentView=this._tabBar.selectedTabBarItem?this._tabBar.selectedTabBarItem.representedObject:null;if(tabContentView){let isSettingsTab=tabContentView instanceof WebInspector.SettingsTabContentView;if(!isSettingsTab){this._recentTabContentViews.remove(tabContentView);this._recentTabContentViews.unshift(tabContentView);} this._contentViewContainer.showContentView(tabContentView);}else{this._contentViewContainer.closeAllContentViews();} this._showNavigationSidebarPanelForTabContentView(tabContentView);this._showDetailsSidebarPanelsForTabContentView(tabContentView);if(tabContentView&&tabContentView[WebInspector.TabBrowser.NeedsResizeLayoutSymbol]){tabContentView[WebInspector.TabBrowser.NeedsResizeLayoutSymbol]=false;tabContentView.updateLayout(WebInspector.View.LayoutReason.Resize);} this.dispatchEventToListeners(WebInspector.TabBrowser.Event.SelectedTabContentViewDidChange);} _tabBarItemAdded(event) {let tabContentView=event.data.tabBarItem.representedObject;if(!tabContentView) return;this._closedTabClasses.delete(tabContentView.constructor);} _tabBarItemRemoved(event) {let tabContentView=event.data.tabBarItem.representedObject;if(!tabContentView) return;this._recentTabContentViews.remove(tabContentView);if(!tabContentView.constructor.isEphemeral()) this._closedTabClasses.add(tabContentView.constructor);this._contentViewContainer.closeContentView(tabContentView);tabContentView.parentTabBrowser=null;} _handleNewTabContextMenu(event) { let closedTabClasses=Array.from(this._closedTabClasses).reverse();let allTabClasses=Array.from(WebInspector.knownTabClasses());let tabClassesToDisplay=closedTabClasses.concat(allTabClasses.filter((tabClass)=>{if(closedTabClasses.includes(tabClass)) return false;if(tabClass.isEphemeral()) return false;return WebInspector.isNewTabWithTypeAllowed(tabClass.Type);}));if(!tabClassesToDisplay.length) return;let contextMenu=event.data.contextMenu;contextMenu.appendItem(WebInspector.UIString("Recently Closed Tabs"),null,true);for(let tabClass of tabClassesToDisplay){contextMenu.appendItem(tabClass.tabInfo().title,()=>{WebInspector.createNewTabWithType(tabClass.Type,{shouldShowNewTab:true});});}} _sidebarPanelSelected(event) {if(this._ignoreSidebarEvents) return;var tabContentView=this.selectedTabContentView;if(!tabContentView) return;if(tabContentView.managesDetailsSidebarPanels) return;var selectedSidebarPanel=this._detailsSidebar.selectedSidebarPanel;tabContentView.detailsSidebarSelectedPanelSetting.value=selectedSidebarPanel?selectedSidebarPanel.identifier:null;} _sidebarCollapsedStateDidChange(event) {if(this._ignoreSidebarEvents) return;var tabContentView=this.selectedTabContentView;if(!tabContentView) return;if(event.target===this._navigationSidebar) tabContentView.navigationSidebarCollapsedSetting.value=this._navigationSidebar.collapsed;else if(event.target===this._detailsSidebar&&!tabContentView.managesDetailsSidebarPanels) tabContentView.detailsSidebarCollapsedSetting.value=this._detailsSidebar.collapsed;} _sidebarWidthDidChange(event) {if(this._ignoreSidebarEvents||!event.data) return;let tabContentView=this.selectedTabContentView;if(!tabContentView) return;switch(event.target){case this._navigationSidebar:tabContentView.navigationSidebarWidthSetting.value=event.data.newWidth;break;case this._detailsSidebar:tabContentView.detailsSidebarWidthSetting.value=event.data.newWidth;break;}} _showNavigationSidebarPanelForTabContentView(tabContentView) {if(!this._navigationSidebar) return;this._ignoreSidebarEvents=true;this._navigationSidebar.removeSidebarPanel(0);if(!tabContentView){this._ignoreSidebarEvents=false;return;} if(tabContentView.navigationSidebarWidthSetting.value) this._navigationSidebar.width=tabContentView.navigationSidebarWidthSetting.value;var navigationSidebarPanel=tabContentView.navigationSidebarPanel;if(!navigationSidebarPanel){this._navigationSidebar.collapsed=true;this._ignoreSidebarEvents=false;return;} this._navigationSidebar.addSidebarPanel(navigationSidebarPanel);this._navigationSidebar.selectedSidebarPanel=navigationSidebarPanel;this._navigationSidebar.collapsed=tabContentView.navigationSidebarCollapsedSetting.value;this._ignoreSidebarEvents=false;} _showDetailsSidebarPanelsForTabContentView(tabContentView) {if(!this._detailsSidebar) return;this._ignoreSidebarEvents=true;for(var i=this._detailsSidebar.sidebarPanels.length-1;i>=0;--i) this._detailsSidebar.removeSidebarPanel(i);if(!tabContentView){this._ignoreSidebarEvents=false;return;} if(tabContentView.detailsSidebarWidthSetting.value) this._detailsSidebar.width=tabContentView.detailsSidebarWidthSetting.value;if(tabContentView.managesDetailsSidebarPanels){tabContentView.showDetailsSidebarPanels();this._ignoreSidebarEvents=false;return;} var detailsSidebarPanels=tabContentView.detailsSidebarPanels;if(!detailsSidebarPanels){this._detailsSidebar.collapsed=true;this._ignoreSidebarEvents=false;return;} for(var detailsSidebarPanel of detailsSidebarPanels) this._detailsSidebar.addSidebarPanel(detailsSidebarPanel);this._detailsSidebar.selectedSidebarPanel=tabContentView.detailsSidebarSelectedPanelSetting.value||detailsSidebarPanels[0];this._detailsSidebar.collapsed=tabContentView.detailsSidebarCollapsedSetting.value||!detailsSidebarPanels.length;this._ignoreSidebarEvents=false;} _showPreviousTab(event) {this._tabBar.selectPreviousTab();} _showNextTab(event) {this._tabBar.selectNextTab();} _showNextTabCheckingForEditableField(event) {if(WebInspector.isEventTargetAnEditableField(event)) return;this._showNextTab(event);event.preventDefault();} _showPreviousTabCheckingForEditableField(event) {if(WebInspector.isEventTargetAnEditableField(event)) return;this._showPreviousTab(event);event.preventDefault();}};WebInspector.TabBrowser.NeedsResizeLayoutSymbol=Symbol("needs-resize-layout");WebInspector.TabBrowser.Event={SelectedTabContentViewDidChange:"tab-browser-selected-tab-content-view-did-change"};WebInspector.TextEditor=class TextEditor extends WebInspector.View {constructor(element,mimeType,delegate) {super(element);this.element.classList.add("text-editor",WebInspector.SyntaxHighlightedStyleClassName);this._codeMirror=WebInspector.CodeMirrorEditor.create(this.element,{readOnly:true,indentWithTabs:WebInspector.settings.indentWithTabs.value,indentUnit:WebInspector.settings.indentUnit.value,tabSize:WebInspector.settings.tabSize.value,lineNumbers:true,lineWrapping:WebInspector.settings.enableLineWrapping.value,matchBrackets:true,autoCloseBrackets:true,showWhitespaceCharacters:WebInspector.settings.showWhitespaceCharacters.value,styleSelectedText:true,});WebInspector.settings.indentWithTabs.addEventListener(WebInspector.Setting.Event.Changed,(event)=>{this._codeMirror.setOption("indentWithTabs",WebInspector.settings.indentWithTabs.value);});WebInspector.settings.indentUnit.addEventListener(WebInspector.Setting.Event.Changed,(event)=>{this._codeMirror.setOption("indentUnit",WebInspector.settings.indentUnit.value);});WebInspector.settings.tabSize.addEventListener(WebInspector.Setting.Event.Changed,(event)=>{this._codeMirror.setOption("tabSize",WebInspector.settings.tabSize.value);});WebInspector.settings.enableLineWrapping.addEventListener(WebInspector.Setting.Event.Changed,(event)=>{this._codeMirror.setOption("lineWrapping",WebInspector.settings.enableLineWrapping.value);});WebInspector.settings.showWhitespaceCharacters.addEventListener(WebInspector.Setting.Event.Changed,(event)=>{this._codeMirror.setOption("showWhitespaceCharacters",WebInspector.settings.showWhitespaceCharacters.value);});this._codeMirror.on("change",this._contentChanged.bind(this));this._codeMirror.on("gutterClick",this._gutterMouseDown.bind(this));this._codeMirror.on("gutterContextMenu",this._gutterContextMenu.bind(this));this._codeMirror.getScrollerElement().addEventListener("click",this._openClickedLinks.bind(this),true);this._completionController=new WebInspector.CodeMirrorCompletionController(this._codeMirror,this);this._tokenTrackingController=new WebInspector.CodeMirrorTokenTrackingController(this._codeMirror,this);this._initialStringNotSet=true;this.mimeType=mimeType;this._breakpoints={};this._executionLineNumber=NaN;this._executionColumnNumber=NaN;this._executionLineHandle=null;this._executionMultilineHandles=[];this._executionRangeHighlightMarker=null;this._searchQuery=null;this._searchResults=[];this._currentSearchResultIndex=-1;this._ignoreCodeMirrorContentDidChangeEvent=0;this._formatted=false;this._formattingPromise=null;this._formatterSourceMap=null;this._deferReveal=false;this._delegate=delegate||null;} get visible() {return this._visible;} get string() {return this._codeMirror.getValue();} set string(newString) {function update() {if(this._initialStringNotSet) this._codeMirror.removeLineClass(0,"wrap");if(this._codeMirror.getValue()!==newString){this._codeMirror.setValue(newString);}else{this.layout();} if(this._initialStringNotSet){this._codeMirror.clearHistory();this._codeMirror.markClean();this._initialStringNotSet=false;} this._updateExecutionLine();this._updateExecutionRangeHighlight();for(var lineNumber in this._breakpoints) this._setBreakpointStylesOnLine(lineNumber);this._revealPendingPositionIfPossible();} this._ignoreCodeMirrorContentDidChangeEvent++;this._codeMirror.operation(update.bind(this));this._ignoreCodeMirrorContentDidChangeEvent--;} get readOnly() {return this._codeMirror.getOption("readOnly")||false;} set readOnly(readOnly) {this._codeMirror.setOption("readOnly",readOnly);} get formatted() {return this._formatted;} get hasModified() {let historySize=this._codeMirror.historySize().undo;if(this._formatted) historySize--;return historySize>0;} updateFormattedState(formatted) {return this._format(formatted).catch(handlePromiseException);} hasFormatter() {let mode=this._codeMirror.getMode().name;return mode==="javascript"||mode==="css";} canBeFormatted() {return this.hasFormatter();} canShowTypeAnnotations() {return false;} canShowCoverageHints() {return false;} get selectedTextRange() {var start=this._codeMirror.getCursor(true);var end=this._codeMirror.getCursor(false);return this._textRangeFromCodeMirrorPosition(start,end);} set selectedTextRange(textRange) {var position=this._codeMirrorPositionFromTextRange(textRange);this._codeMirror.setSelection(position.start,position.end);} get mimeType() {return this._mimeType;} set mimeType(newMIMEType) {newMIMEType=parseMIMEType(newMIMEType).type;this._mimeType=newMIMEType;this._codeMirror.setOption("mode",{name:newMIMEType,globalVars:true});} get executionLineNumber() {return this._executionLineNumber;} get executionColumnNumber() {return this._executionColumnNumber;} get formatterSourceMap() {return this._formatterSourceMap;} get tokenTrackingController() {return this._tokenTrackingController;} get delegate() {return this._delegate;} set delegate(newDelegate) {this._delegate=newDelegate||null;} get numberOfSearchResults() {return this._searchResults.length;} get currentSearchQuery() {return this._searchQuery;} set automaticallyRevealFirstSearchResult(reveal) {this._automaticallyRevealFirstSearchResult=reveal;if(this._automaticallyRevealFirstSearchResult&&this._searchResults.length>0){if(this._currentSearchResultIndex===-1) this._revealFirstSearchResultAfterCursor();}} set deferReveal(defer) {this._deferReveal=defer;} performSearch(query) {if(this._searchQuery===query) return;this.searchCleared();this._searchQuery=query;if(typeof this.customPerformSearch==="function"&&!this.formatted){if(this.customPerformSearch(query)) return;} var queryRegex=new RegExp(query.escapeForRegExp(),"gi");var searchCursor=this._codeMirror.getSearchCursor(queryRegex,{line:0,ch:0},false);var boundBatchSearch=batchSearch.bind(this);var numberOfSearchResultsDidChangeTimeout=null;function reportNumberOfSearchResultsDidChange() {if(numberOfSearchResultsDidChangeTimeout){clearTimeout(numberOfSearchResultsDidChangeTimeout);numberOfSearchResultsDidChangeTimeout=null;} this.dispatchEventToListeners(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange);} function batchSearch() {if(this._searchQuery!==query) return;var newSearchResults=[];var foundResult=false;for(var i=0;i0) --this._currentSearchResultIndex;else this._currentSearchResultIndex=this._searchResults.length-1;this._revealSearchResult(this._searchResults[this._currentSearchResultIndex],changeFocus,-1);} revealNextSearchResult(changeFocus) {if(!this._searchResults.length) return;if(this._currentSearchResultIndex===-1||this._cursorDoesNotMatchLastRevealedSearchResult()){this._revealFirstSearchResultAfterCursor(changeFocus);return;} if(this._currentSearchResultIndex+1{setTimeout(this.revealPosition.bind(this),0,position,textRangeToSelect);});return;} let line=Number.constrain(position.lineNumber,0,this._codeMirror.lineCount()-1);let lineHandle=this._codeMirror.getLineHandle(line);if(!textRangeToSelect){let column=Number.constrain(position.columnNumber,0,this._codeMirror.getLine(line).length-1);textRangeToSelect=new WebInspector.TextRange(line,column,line,column);} function removeStyleClass() {this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.HighlightedStyleClassName);} function revealAndHighlightLine() {var position=this._codeMirrorPositionFromTextRange(textRangeToSelect);if(!this._isPositionVisible(position.start)) this._scrollIntoViewCentered(position.start);this.selectedTextRange=textRangeToSelect;if(noHighlight) return;if(WebInspector.debuggerManager.paused&&line===this._executionLineNumber) return;this._codeMirror.addLineClass(lineHandle,"wrap",WebInspector.TextEditor.HighlightedStyleClassName); setTimeout(removeStyleClass.bind(this),WebInspector.TextEditor.HighlightAnimationDuration);} this._codeMirror.operation(revealAndHighlightLine.bind(this));} shown() {this._visible=true;this._codeMirror.refresh(); this._revealPendingPositionIfPossible();} hidden() {this._visible=false;} close() {WebInspector.settings.indentWithTabs.removeEventListener(null,null,this);WebInspector.settings.indentUnit.removeEventListener(null,null,this);WebInspector.settings.tabSize.removeEventListener(null,null,this);WebInspector.settings.enableLineWrapping.removeEventListener(null,null,this);WebInspector.settings.showWhitespaceCharacters.removeEventListener(null,null,this);} setBreakpointInfoForLineAndColumn(lineNumber,columnNumber,breakpointInfo) {if(this._ignoreSetBreakpointInfoCalls) return;if(breakpointInfo) this._addBreakpointToLineAndColumnWithInfo(lineNumber,columnNumber,breakpointInfo);else this._removeBreakpointFromLineAndColumn(lineNumber,columnNumber);} updateBreakpointLineAndColumn(oldLineNumber,oldColumnNumber,newLineNumber,newColumnNumber) {if(!this._breakpoints[oldLineNumber]) return;if(!this._breakpoints[oldLineNumber][oldColumnNumber]) return;var breakpointInfo=this._breakpoints[oldLineNumber][oldColumnNumber];this._removeBreakpointFromLineAndColumn(oldLineNumber,oldColumnNumber);this._addBreakpointToLineAndColumnWithInfo(newLineNumber,newColumnNumber,breakpointInfo);} addStyleClassToLine(lineNumber,styleClassName) {var lineHandle=this._codeMirror.getLineHandle(lineNumber);if(!lineHandle) return null;return this._codeMirror.addLineClass(lineHandle,"wrap",styleClassName);} removeStyleClassFromLine(lineNumber,styleClassName) {var lineHandle=this._codeMirror.getLineHandle(lineNumber);if(!lineHandle) return null;return this._codeMirror.removeLineClass(lineHandle,"wrap",styleClassName);} toggleStyleClassForLine(lineNumber,styleClassName) {var lineHandle=this._codeMirror.getLineHandle(lineNumber);if(!lineHandle) return false;return this._codeMirror.toggleLineClass(lineHandle,"wrap",styleClassName);} createWidgetForLine(lineNumber) {var lineHandle=this._codeMirror.getLineHandle(lineNumber);if(!lineHandle) return null;var widgetElement=document.createElement("div");var lineWidget=this._codeMirror.addLineWidget(lineHandle,widgetElement,{coverGutter:false,noHScroll:true});return new WebInspector.LineWidget(lineWidget,widgetElement);} get lineCount() {return this._codeMirror.lineCount();} focus() {this._codeMirror.focus();} contentDidChange(replacedRanges,newRanges) {} rectsForRange(range) {return this._codeMirror.rectsForRange(range);} get markers() {return this._codeMirror.getAllMarks().map(WebInspector.TextMarker.textMarkerForCodeMirrorTextMarker);} markersAtPosition(position) {return this._codeMirror.findMarksAt(position).map(WebInspector.TextMarker.textMarkerForCodeMirrorTextMarker);} createColorMarkers(range) {return createCodeMirrorColorTextMarkers(this._codeMirror,range);} createGradientMarkers(range) {return createCodeMirrorGradientTextMarkers(this._codeMirror,range);} createCubicBezierMarkers(range) {return createCodeMirrorCubicBezierTextMarkers(this._codeMirror,range);} createSpringMarkers(range) {return createCodeMirrorSpringTextMarkers(this._codeMirror,range);} editingControllerForMarker(editableMarker) {switch(editableMarker.type){case WebInspector.TextMarker.Type.Color:return new WebInspector.CodeMirrorColorEditingController(this._codeMirror,editableMarker);case WebInspector.TextMarker.Type.Gradient:return new WebInspector.CodeMirrorGradientEditingController(this._codeMirror,editableMarker);case WebInspector.TextMarker.Type.CubicBezier:return new WebInspector.CodeMirrorBezierEditingController(this._codeMirror,editableMarker);case WebInspector.TextMarker.Type.Spring:return new WebInspector.CodeMirrorSpringEditingController(this._codeMirror,editableMarker);default:return new WebInspector.CodeMirrorEditingController(this._codeMirror,editableMarker);}} visibleRangeOffsets() {var startOffset=null;var endOffset=null;var visibleRange=this._codeMirror.getViewport();if(this._formatterSourceMap){startOffset=this._formatterSourceMap.formattedToOriginalOffset(Math.max(visibleRange.from-1,0),0);endOffset=this._formatterSourceMap.formattedToOriginalOffset(visibleRange.to-1,0);}else{startOffset=this._codeMirror.getDoc().indexFromPos({line:visibleRange.from,ch:0});endOffset=this._codeMirror.getDoc().indexFromPos({line:visibleRange.to,ch:0});} return{startOffset,endOffset};} originalOffsetToCurrentPosition(offset) {var position=null;if(this._formatterSourceMap){var location=this._formatterSourceMap.originalPositionToFormatted(offset);position={line:location.lineNumber,ch:location.columnNumber};}else position=this._codeMirror.getDoc().posFromIndex(offset);return position;} currentOffsetToCurrentPosition(offset) {return this._codeMirror.getDoc().posFromIndex(offset);} currentPositionToOriginalOffset(position) {let offset=null;if(this._formatterSourceMap) offset=this._formatterSourceMap.formattedToOriginalOffset(position.line,position.ch);else offset=this._codeMirror.getDoc().indexFromPos(position);return offset;} currentPositionToOriginalPosition(position) {if(!this._formatterSourceMap) return position;let location=this._formatterSourceMap.formattedToOriginal(position.line,position.ch);return{line:location.lineNumber,ch:location.columnNumber};} currentPositionToCurrentOffset(position) {return this._codeMirror.getDoc().indexFromPos(position);} setInlineWidget(position,inlineElement) {return this._codeMirror.setUniqueBookmark(position,{widget:inlineElement});} addScrollHandler(handler) {this._codeMirror.on("scroll",handler);} removeScrollHandler(handler) {this._codeMirror.off("scroll",handler);} layout() { if(this._visible) this._codeMirror.refresh();} _format(formatted) {if(this._formatted===formatted) return Promise.resolve(this._formatted);if(formatted&&!this.canBeFormatted()) return Promise.resolve(this._formatted);if(this._formattingPromise) return this._formattingPromise;this._ignoreCodeMirrorContentDidChangeEvent++;this._formattingPromise=this.prettyPrint(formatted).then(()=>{this._ignoreCodeMirrorContentDidChangeEvent--;this._formattingPromise=null;let originalFormatted=this._formatted;this._formatted=!!this._formatterSourceMap;if(this._formatted!==originalFormatted) this.dispatchEventToListeners(WebInspector.TextEditor.Event.FormattingDidChange);return this._formatted;});return this._formattingPromise;} prettyPrint(pretty) {return new Promise((resolve,reject)=>{let beforePrettyPrintState={selectionAnchor:this._codeMirror.getCursor("anchor"),selectionHead:this._codeMirror.getCursor("head"),};if(!pretty) this._undoFormatting(beforePrettyPrintState,resolve);else if(this._canUseFormatterWorker()) this._startWorkerPrettyPrint(beforePrettyPrintState,resolve);else this._startCodeMirrorPrettyPrint(beforePrettyPrintState,resolve);});} _canUseFormatterWorker() {return this._codeMirror.getMode().name==="javascript";} _startWorkerPrettyPrint(beforePrettyPrintState,callback) {let sourceText=this._codeMirror.getValue();let indentString=WebInspector.indentString();const includeSourceMapData=true;let sourceType=this._delegate?this._delegate.textEditorScriptSourceType(this):WebInspector.Script.SourceType.Program;const isModule=sourceType===WebInspector.Script.SourceType.Module;let workerProxy=WebInspector.FormatterWorkerProxy.singleton();workerProxy.formatJavaScript(sourceText,isModule,indentString,includeSourceMapData,({formattedText,sourceMapData})=>{if(formattedText===null){callback();return;} this._finishPrettyPrint(beforePrettyPrintState,formattedText,sourceMapData,callback);});} _startCodeMirrorPrettyPrint(beforePrettyPrintState,callback) {let indentString=WebInspector.indentString();let start={line:0,ch:0};let end={line:this._codeMirror.lineCount()-1};let builder=new FormatterContentBuilder(indentString);let formatter=new WebInspector.Formatter(this._codeMirror,builder);formatter.format(start,end);let formattedText=builder.formattedContent;let sourceMapData=builder.sourceMapData;this._finishPrettyPrint(beforePrettyPrintState,formattedText,sourceMapData,callback);} _finishPrettyPrint(beforePrettyPrintState,formattedText,sourceMapData,callback) {this._codeMirror.operation(()=>{this._formatterSourceMap=WebInspector.FormatterSourceMap.fromSourceMapData(sourceMapData);this._codeMirror.setValue(formattedText);this._updateAfterFormatting(true,beforePrettyPrintState);});callback();} _undoFormatting(beforePrettyPrintState,callback) {this._codeMirror.operation(()=>{this._codeMirror.undo();this._updateAfterFormatting(false,beforePrettyPrintState);});callback();} _updateAfterFormatting(pretty,beforePrettyPrintState) {let oldSelectionAnchor=beforePrettyPrintState.selectionAnchor;let oldSelectionHead=beforePrettyPrintState.selectionHead;let newSelectionAnchor,newSelectionHead;let newExecutionLocation=null;if(pretty){if(this._positionToReveal){let newRevealPosition=this._formatterSourceMap.originalToFormatted(this._positionToReveal.lineNumber,this._positionToReveal.columnNumber);this._positionToReveal=new WebInspector.SourceCodePosition(newRevealPosition.lineNumber,newRevealPosition.columnNumber);} if(this._textRangeToSelect){let mappedRevealSelectionStart=this._formatterSourceMap.originalToFormatted(this._textRangeToSelect.startLine,this._textRangeToSelect.startColumn);let mappedRevealSelectionEnd=this._formatterSourceMap.originalToFormatted(this._textRangeToSelect.endLine,this._textRangeToSelect.endColumn);this._textRangeToSelect=new WebInspector.TextRange(mappedRevealSelectionStart.lineNumber,mappedRevealSelectionStart.columnNumber,mappedRevealSelectionEnd.lineNumber,mappedRevealSelectionEnd.columnNumber);} if(!isNaN(this._executionLineNumber)){newExecutionLocation=this._formatterSourceMap.originalToFormatted(this._executionLineNumber,this._executionColumnNumber);} let mappedAnchorLocation=this._formatterSourceMap.originalToFormatted(oldSelectionAnchor.line,oldSelectionAnchor.ch);let mappedHeadLocation=this._formatterSourceMap.originalToFormatted(oldSelectionHead.line,oldSelectionHead.ch);newSelectionAnchor={line:mappedAnchorLocation.lineNumber,ch:mappedAnchorLocation.columnNumber};newSelectionHead={line:mappedHeadLocation.lineNumber,ch:mappedHeadLocation.columnNumber};}else{if(this._positionToReveal){let newRevealPosition=this._formatterSourceMap.formattedToOriginal(this._positionToReveal.lineNumber,this._positionToReveal.columnNumber);this._positionToReveal=new WebInspector.SourceCodePosition(newRevealPosition.lineNumber,newRevealPosition.columnNumber);} if(this._textRangeToSelect){let mappedRevealSelectionStart=this._formatterSourceMap.formattedToOriginal(this._textRangeToSelect.startLine,this._textRangeToSelect.startColumn);let mappedRevealSelectionEnd=this._formatterSourceMap.formattedToOriginal(this._textRangeToSelect.endLine,this._textRangeToSelect.endColumn);this._textRangeToSelect=new WebInspector.TextRange(mappedRevealSelectionStart.lineNumber,mappedRevealSelectionStart.columnNumber,mappedRevealSelectionEnd.lineNumber,mappedRevealSelectionEnd.columnNumber);} if(!isNaN(this._executionLineNumber)){newExecutionLocation=this._formatterSourceMap.formattedToOriginal(this._executionLineNumber,this._executionColumnNumber);} let mappedAnchorLocation=this._formatterSourceMap.formattedToOriginal(oldSelectionAnchor.line,oldSelectionAnchor.ch);let mappedHeadLocation=this._formatterSourceMap.formattedToOriginal(oldSelectionHead.line,oldSelectionHead.ch);newSelectionAnchor={line:mappedAnchorLocation.lineNumber,ch:mappedAnchorLocation.columnNumber};newSelectionHead={line:mappedHeadLocation.lineNumber,ch:mappedHeadLocation.columnNumber};this._formatterSourceMap=null;} this._scrollIntoViewCentered(newSelectionAnchor);this._codeMirror.setSelection(newSelectionAnchor,newSelectionHead);if(newExecutionLocation){this._executionLineHandle=null;this._executionMultilineHandles=[];this.setExecutionLineAndColumn(newExecutionLocation.lineNumber,newExecutionLocation.columnNumber);} if(this.currentSearchQuery){let searchQuery=this.currentSearchQuery;this.searchCleared();setTimeout(()=>{this.performSearch(searchQuery);},0);} if(this._delegate&&typeof this._delegate.textEditorUpdatedFormatting==="function") this._delegate.textEditorUpdatedFormatting(this);} hasEdits() {return!this._codeMirror.isClean();} _contentChanged(codeMirror,change) {if(this._ignoreCodeMirrorContentDidChangeEvent>0) return;var replacedRanges=[];var newRanges=[];while(change){replacedRanges.push(new WebInspector.TextRange(change.from.line,change.from.ch,change.to.line,change.to.ch));newRanges.push(new WebInspector.TextRange(change.from.line,change.from.ch,change.from.line+change.text.length-1,change.text.length===1?change.from.ch+change.text[0].length:change.text.lastValue.length));change=change.next;} this.contentDidChange(replacedRanges,newRanges);if(this._formatted){this._formatterSourceMap=null;this._formatted=false;if(this._delegate&&typeof this._delegate.textEditorUpdatedFormatting==="function") this._delegate.textEditorUpdatedFormatting(this);this.dispatchEventToListeners(WebInspector.TextEditor.Event.FormattingDidChange);} this.dispatchEventToListeners(WebInspector.TextEditor.Event.ContentDidChange);} _textRangeFromCodeMirrorPosition(start,end) {return new WebInspector.TextRange(start.line,start.ch,end.line,end.ch);} _codeMirrorPositionFromTextRange(textRange) {var start={line:textRange.startLine,ch:textRange.startColumn};var end={line:textRange.endLine,ch:textRange.endColumn};return{start,end};} _revealPendingPositionIfPossible() {if(!this._positionToReveal) return;if(!this._visible) return;this.revealPosition(this._positionToReveal,this._textRangeToSelect,this._forceUnformatted);} _revealSearchResult(result,changeFocus,directionInCaseOfRevalidation) {var position=result.find();if(!position){this._revalidateSearchResults(directionInCaseOfRevalidation);return;} if(!this._isPositionVisible(position.from)) this._scrollIntoViewCentered(position.from);this.selectedTextRange=this._textRangeFromCodeMirrorPosition(position.from,position.to);this._automaticallyRevealFirstSearchResult=false;if(changeFocus) this._codeMirror.focus(); if(this._bouncyHighlightElement) this._bouncyHighlightElement.remove();this._bouncyHighlightElement=document.createElement("div");this._bouncyHighlightElement.className=WebInspector.TextEditor.BouncyHighlightStyleClassName;var textContent=this._codeMirror.getSelection();var coordinates=this._codeMirror.cursorCoords(true,"page");let textEditorRect=this.element.getBoundingClientRect();coordinates.top-=textEditorRect.top;coordinates.left-=textEditorRect.left;this._bouncyHighlightElement.textContent=textContent;this._bouncyHighlightElement.style.top=coordinates.top+"px";this._bouncyHighlightElement.style.left=coordinates.left+"px";this.element.appendChild(this._bouncyHighlightElement);let scrollHandler=()=>{if(this._bouncyHighlightElement) this._bouncyHighlightElement.remove();};this.addScrollHandler(scrollHandler);function animationEnded() {if(!this._bouncyHighlightElement) return;this._bouncyHighlightElement.remove();delete this._bouncyHighlightElement;this.removeScrollHandler(scrollHandler);} this._bouncyHighlightElement.addEventListener("animationend",animationEnded.bind(this));} _binarySearchInsertionIndexInSearchResults(object,comparator) { var array=this._searchResults;var first=0;var last=array.length-1;while(first<=last){var mid=(first+last)>>1;var c=comparator(object,array[mid]);if(c===null) return null;if(c>0) first=mid+1;else if(c<0) last=mid-1;else return mid;} return first-1;} _revealFirstSearchResultBeforeCursor(changeFocus) {var currentCursorPosition=this._codeMirror.getCursor("start");if(currentCursorPosition.line===0&¤tCursorPosition.ch===0){this._currentSearchResultIndex=this._searchResults.length-1;this._revealSearchResult(this._searchResults[this._currentSearchResultIndex],changeFocus,-1);return;} var index=this._binarySearchInsertionIndexInSearchResults(currentCursorPosition,function(current,searchResult){var searchResultMarker=searchResult.find();if(!searchResultMarker) return null;return WebInspector.compareCodeMirrorPositions(current,searchResultMarker.from);});if(index===null){this._revalidateSearchResults(-1);return;} this._currentSearchResultIndex=index;this._revealSearchResult(this._searchResults[this._currentSearchResultIndex],changeFocus);} _revealFirstSearchResultAfterCursor(changeFocus) {var currentCursorPosition=this._codeMirror.getCursor("start");if(currentCursorPosition.line===0&¤tCursorPosition.ch===0){this._currentSearchResultIndex=0;this._revealSearchResult(this._searchResults[this._currentSearchResultIndex],changeFocus,1);return;} var index=this._binarySearchInsertionIndexInSearchResults(currentCursorPosition,function(current,searchResult){var searchResultMarker=searchResult.find();if(!searchResultMarker) return null;return WebInspector.compareCodeMirrorPositions(current,searchResultMarker.from);});if(index===null){this._revalidateSearchResults(1);return;} if(index+10) this._revealFirstSearchResultAfterCursor();else this._revealFirstSearchResultBeforeCursor();}} _clearMultilineExecutionLineHighlights() {if(this._executionMultilineHandles.length){for(let lineHandle of this._executionMultilineHandles) this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.ExecutionLineStyleClassName);this._executionMultilineHandles=[];}} _updateExecutionLine() {this._codeMirror.operation(()=>{if(this._executionLineHandle){this._codeMirror.removeLineClass(this._executionLineHandle,"wrap",WebInspector.TextEditor.ExecutionLineStyleClassName);this._codeMirror.removeLineClass(this._executionLineHandle,"wrap","primary");} this._clearMultilineExecutionLineHighlights();this._executionLineHandle=!isNaN(this._executionLineNumber)?this._codeMirror.getLineHandle(this._executionLineNumber):null;if(this._executionLineHandle){this._codeMirror.addLineClass(this._executionLineHandle,"wrap",WebInspector.TextEditor.ExecutionLineStyleClassName);this._codeMirror.addLineClass(this._executionLineHandle,"wrap","primary");this._codeMirror.removeLineClass(this._executionLineHandle,"wrap",WebInspector.TextEditor.HighlightedStyleClassName);}});} _updateExecutionRangeHighlight() {if(this._executionRangeHighlightMarker){this._executionRangeHighlightMarker.clear();this._executionRangeHighlightMarker=null;} if(isNaN(this._executionLineNumber)) return;let currentPosition={line:this._executionLineNumber,ch:this._executionColumnNumber};let originalOffset=this.currentPositionToOriginalOffset(currentPosition);let originalCodeMirrorPosition=this.currentPositionToOriginalPosition(currentPosition);let originalPosition=new WebInspector.SourceCodePosition(originalCodeMirrorPosition.line,originalCodeMirrorPosition.ch);let characterAtOffset=this._codeMirror.getRange(currentPosition,{line:this._executionLineNumber,ch:this._executionColumnNumber+1});this._delegate.textEditorExecutionHighlightRange(originalOffset,originalPosition,characterAtOffset,(range)=>{let start,end;if(!range){start={line:this._executionLineNumber,ch:this._executionColumnNumber};end={line:this._executionLineNumber};}else{start=this.originalOffsetToCurrentPosition(range[0]);end=this.originalOffsetToCurrentPosition(range[1]);} if(this._executionRangeHighlightMarker){this._executionRangeHighlightMarker.clear();this._executionRangeHighlightMarker=null;} let text=this._codeMirror.getRange(start,end);let trailingWhitespace=text.match(/\s+$/);if(trailingWhitespace) end.ch=Math.max(0,end.ch-trailingWhitespace[0].length);this._clearMultilineExecutionLineHighlights();if(start.line!==end.line){for(let line=start.line;line1;for(var columnNumber in columnBreakpoints){var breakpointInfo=columnBreakpoints[columnNumber];if(!breakpointInfo.disabled) allDisabled=false;if(!breakpointInfo.resolved) allResolved=false;if(!breakpointInfo.autoContinue) allAutoContinue=false;} allResolved=allResolved&&WebInspector.debuggerManager.breakpointsEnabled;function updateStyles() {var lineHandle=this._codeMirror.getLineHandle(lineNumber);if(!lineHandle) return;this._codeMirror.addLineClass(lineHandle,"wrap",WebInspector.TextEditor.HasBreakpointStyleClassName);if(allResolved) this._codeMirror.addLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointResolvedStyleClassName);else this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointResolvedStyleClassName);if(allDisabled) this._codeMirror.addLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointDisabledStyleClassName);else this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointDisabledStyleClassName);if(allAutoContinue) this._codeMirror.addLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointAutoContinueStyleClassName);else this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointAutoContinueStyleClassName);if(multiple) this._codeMirror.addLineClass(lineHandle,"wrap",WebInspector.TextEditor.MultipleBreakpointsStyleClassName);else this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.MultipleBreakpointsStyleClassName);} this._codeMirror.operation(updateStyles.bind(this));} _addBreakpointToLineAndColumnWithInfo(lineNumber,columnNumber,breakpointInfo) {if(!this._breakpoints[lineNumber]) this._breakpoints[lineNumber]={};this._breakpoints[lineNumber][columnNumber]=breakpointInfo;this._setBreakpointStylesOnLine(lineNumber);} _removeBreakpointFromLineAndColumn(lineNumber,columnNumber) {delete this._breakpoints[lineNumber][columnNumber];if(!isEmptyObject(this._breakpoints[lineNumber])){this._setBreakpointStylesOnLine(lineNumber);return;} delete this._breakpoints[lineNumber];function updateStyles() {var lineHandle=this._codeMirror.getLineHandle(lineNumber);if(!lineHandle) return;this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.HasBreakpointStyleClassName);this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointResolvedStyleClassName);this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointDisabledStyleClassName);this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointAutoContinueStyleClassName);this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.MultipleBreakpointsStyleClassName);} this._codeMirror.operation(updateStyles.bind(this));} _allColumnBreakpointInfoForLine(lineNumber) {return this._breakpoints[lineNumber];} _setColumnBreakpointInfoForLine(lineNumber,columnBreakpointInfo) {this._breakpoints[lineNumber]=columnBreakpointInfo;this._setBreakpointStylesOnLine(lineNumber);} _gutterMouseDown(codeMirror,lineNumber,gutterElement,event) {if(event.button!==0||event.ctrlKey) return;if(!this._codeMirror.hasLineClass(lineNumber,"wrap",WebInspector.TextEditor.HasBreakpointStyleClassName)){if(this._delegate&&typeof this._delegate.textEditorBreakpointAdded==="function"){var data=this._delegate.textEditorBreakpointAdded(this,lineNumber,0);if(data){var breakpointInfo=data.breakpointInfo;if(breakpointInfo) this._addBreakpointToLineAndColumnWithInfo(data.lineNumber,data.columnNumber,breakpointInfo);}} return;} if(this._codeMirror.hasLineClass(lineNumber,"wrap",WebInspector.TextEditor.MultipleBreakpointsStyleClassName)){return;} var columnNumber=Object.keys(this._breakpoints[lineNumber])[0];this._draggingBreakpointInfo=this._breakpoints[lineNumber][columnNumber];this._lineNumberWithMousedDownBreakpoint=lineNumber;this._lineNumberWithDraggedBreakpoint=lineNumber;this._columnNumberWithMousedDownBreakpoint=columnNumber;this._columnNumberWithDraggedBreakpoint=columnNumber;this._documentMouseMovedEventListener=this._documentMouseMoved.bind(this);this._documentMouseUpEventListener=this._documentMouseUp.bind(this);document.addEventListener("mousemove",this._documentMouseMovedEventListener,true);document.addEventListener("mouseup",this._documentMouseUpEventListener,true);} _gutterContextMenu(codeMirror,lineNumber,gutterElement,event) {if(this._delegate&&typeof this._delegate.textEditorGutterContextMenu==="function"){var breakpoints=[];for(var columnNumber in this._breakpoints[lineNumber]) breakpoints.push({lineNumber,columnNumber});this._delegate.textEditorGutterContextMenu(this,lineNumber,0,breakpoints,event);}} _documentMouseMoved(event) {if(!("_lineNumberWithMousedDownBreakpoint"in this)) return;event.preventDefault();var lineNumber;var position=this._codeMirror.coordsChar({left:event.pageX,top:event.pageY}); var gutterBounds=this._codeMirror.getGutterElement().getBoundingClientRect();if(event.pageXgutterBounds.right||event.pageYgutterBounds.bottom) position=null;if(position&&"line"in position) lineNumber=position.line; if(lineNumber===this._lineNumberWithDraggedBreakpoint) return; this._mouseDragged=true;if("_lineNumberWithDraggedBreakpoint"in this){ if(this._previousColumnBreakpointInfo) this._setColumnBreakpointInfoForLine(this._lineNumberWithDraggedBreakpoint,this._previousColumnBreakpointInfo);else this._removeBreakpointFromLineAndColumn(this._lineNumberWithDraggedBreakpoint,this._columnNumberWithDraggedBreakpoint);delete this._previousColumnBreakpointInfo;delete this._lineNumberWithDraggedBreakpoint;delete this._columnNumberWithDraggedBreakpoint;} if(lineNumber!==undefined){var newColumnBreakpoints={};var columnNumber=(lineNumber===this._lineNumberWithMousedDownBreakpoint?this._columnNumberWithDraggedBreakpoint:0);newColumnBreakpoints[columnNumber]=this._draggingBreakpointInfo;this._previousColumnBreakpointInfo=this._allColumnBreakpointInfoForLine(lineNumber);this._setColumnBreakpointInfoForLine(lineNumber,newColumnBreakpoints);this._lineNumberWithDraggedBreakpoint=lineNumber;this._columnNumberWithDraggedBreakpoint=columnNumber;}} _documentMouseUp(event) {if(!("_lineNumberWithMousedDownBreakpoint"in this)) return;event.preventDefault();document.removeEventListener("mousemove",this._documentMouseMovedEventListener,true);document.removeEventListener("mouseup",this._documentMouseUpEventListener,true);var delegateImplementsBreakpointClicked=this._delegate&&typeof this._delegate.textEditorBreakpointClicked==="function";var delegateImplementsBreakpointRemoved=this._delegate&&typeof this._delegate.textEditorBreakpointRemoved==="function";var delegateImplementsBreakpointMoved=this._delegate&&typeof this._delegate.textEditorBreakpointMoved==="function";if(this._mouseDragged){if(!("_lineNumberWithDraggedBreakpoint"in this)){if(delegateImplementsBreakpointRemoved){this._ignoreSetBreakpointInfoCalls=true;this._delegate.textEditorBreakpointRemoved(this,this._lineNumberWithMousedDownBreakpoint,this._columnNumberWithMousedDownBreakpoint);delete this._ignoreSetBreakpointInfoCalls;}}else if(this._lineNumberWithMousedDownBreakpoint!==this._lineNumberWithDraggedBreakpoint){ if(this._previousColumnBreakpointInfo&&delegateImplementsBreakpointRemoved){this._ignoreSetBreakpointInfoCalls=true;for(var columnNumber in this._previousColumnBreakpointInfo) this._delegate.textEditorBreakpointRemoved(this,this._lineNumberWithDraggedBreakpoint,columnNumber);delete this._ignoreSetBreakpointInfoCalls;} if(delegateImplementsBreakpointMoved){this._ignoreSetBreakpointInfoCalls=true;this._delegate.textEditorBreakpointMoved(this,this._lineNumberWithMousedDownBreakpoint,this._columnNumberWithMousedDownBreakpoint,this._lineNumberWithDraggedBreakpoint,this._columnNumberWithDraggedBreakpoint);delete this._ignoreSetBreakpointInfoCalls;}}}else{if(this._lineNumberWithMousedDownBreakpoint in this._breakpoints&&this._columnNumberWithMousedDownBreakpoint in this._breakpoints[this._lineNumberWithMousedDownBreakpoint]&&delegateImplementsBreakpointClicked) this._delegate.textEditorBreakpointClicked(this,this._lineNumberWithMousedDownBreakpoint,this._columnNumberWithMousedDownBreakpoint);} delete this._documentMouseMovedEventListener;delete this._documentMouseUpEventListener;delete this._lineNumberWithMousedDownBreakpoint;delete this._lineNumberWithDraggedBreakpoint;delete this._columnNumberWithMousedDownBreakpoint;delete this._columnNumberWithDraggedBreakpoint;delete this._previousColumnBreakpointInfo;delete this._mouseDragged;} _openClickedLinks(event) {var position=this._codeMirror.coordsChar({left:event.pageX,top:event.pageY});var tokenInfo=this._codeMirror.getTokenAt(position);if(!tokenInfo||!tokenInfo.type||!tokenInfo.string) return;if(!/\blink\b/.test(tokenInfo.type)) return;var url=tokenInfo.string;var baseURL="";if(this._delegate&&typeof this._delegate.textEditorBaseURL==="function") baseURL=this._delegate.textEditorBaseURL(this);WebInspector.openURL(absoluteURL(url,baseURL));event.preventDefault();event.stopPropagation();} _isPositionVisible(position) {var scrollInfo=this._codeMirror.getScrollInfo();var visibleRangeStart=scrollInfo.top;var visibleRangeEnd=visibleRangeStart+scrollInfo.clientHeight;var coords=this._codeMirror.charCoords(position,"local");return coords.top>=visibleRangeStart&&coords.bottom<=visibleRangeEnd;} _scrollIntoViewCentered(position) {var scrollInfo=this._codeMirror.getScrollInfo();var lineHeight=Math.ceil(this._codeMirror.defaultTextHeight());var margin=Math.floor((scrollInfo.clientHeight-lineHeight)/2);this._codeMirror.scrollIntoView(position,margin);}};WebInspector.TextEditor.HighlightedStyleClassName="highlighted";WebInspector.TextEditor.SearchResultStyleClassName="search-result";WebInspector.TextEditor.HasBreakpointStyleClassName="has-breakpoint";WebInspector.TextEditor.BreakpointResolvedStyleClassName="breakpoint-resolved";WebInspector.TextEditor.BreakpointAutoContinueStyleClassName="breakpoint-auto-continue";WebInspector.TextEditor.BreakpointDisabledStyleClassName="breakpoint-disabled";WebInspector.TextEditor.MultipleBreakpointsStyleClassName="multiple-breakpoints";WebInspector.TextEditor.ExecutionLineStyleClassName="execution-line";WebInspector.TextEditor.BouncyHighlightStyleClassName="bouncy-highlight";WebInspector.TextEditor.NumberOfFindsPerSearchBatch=10;WebInspector.TextEditor.HighlightAnimationDuration=2000;WebInspector.TextEditor.Event={ExecutionLineNumberDidChange:"text-editor-execution-line-number-did-change",NumberOfSearchResultsDidChange:"text-editor-number-of-search-results-did-change",ContentDidChange:"text-editor-content-did-change",FormattingDidChange:"text-editor-formatting-did-change"};WebInspector.TimelineOverviewGraph=class TimelineOverviewGraph extends WebInspector.View {constructor(timelineOverview) {super();this.element.classList.add("timeline-overview-graph");this._zeroTime=0;this._startTime=0;this._endTime=5;this._currentTime=0;this._timelineOverview=timelineOverview;this._selectedRecord=null;this._selectedRecordChanged=false;this._scheduledSelectedRecordLayoutUpdateIdentifier=undefined;this._selected=false;this._visible=true;} static createForTimeline(timeline,timelineOverview) {var timelineType=timeline.type;if(timelineType===WebInspector.TimelineRecord.Type.Network) return new WebInspector.NetworkTimelineOverviewGraph(timeline,timelineOverview);if(timelineType===WebInspector.TimelineRecord.Type.Layout) return new WebInspector.LayoutTimelineOverviewGraph(timeline,timelineOverview);if(timelineType===WebInspector.TimelineRecord.Type.Script) return new WebInspector.ScriptTimelineOverviewGraph(timeline,timelineOverview);if(timelineType===WebInspector.TimelineRecord.Type.RenderingFrame) return new WebInspector.RenderingFrameTimelineOverviewGraph(timeline,timelineOverview);if(timelineType===WebInspector.TimelineRecord.Type.Memory) return new WebInspector.MemoryTimelineOverviewGraph(timeline,timelineOverview);if(timelineType===WebInspector.TimelineRecord.Type.HeapAllocations) return new WebInspector.HeapAllocationsTimelineOverviewGraph(timeline,timelineOverview);throw new Error("Can't make a graph for an unknown timeline.");} get zeroTime() {return this._zeroTime;} set zeroTime(x) {x=x||0;if(this._zeroTime===x) return;this._zeroTime=x;this.needsLayout();} get startTime() {return this._startTime;} set startTime(x) {x=x||0;if(this._startTime===x) return;this._startTime=x;this.needsLayout();} get endTime() {return this._endTime;} set endTime(x) {x=x||0;if(this._endTime===x) return;this._endTime=x;this.needsLayout();} get currentTime() {return this._currentTime;} set currentTime(x) {x=x||0;if(this._currentTime===x) return;let oldCurrentTime=this._currentTime;this._currentTime=x;if((this._startTime<=oldCurrentTime&&oldCurrentTime<=this._endTime)||(this._startTime<=this._currentTime&&this._currentTime<=this._endTime)) this.needsLayout();} get timelineOverview() {return this._timelineOverview;} get secondsPerPixel(){return this._timelineOverview.secondsPerPixel;} get visible() {return this._visible;} get selectedRecord() {return this._selectedRecord;} set selectedRecord(x) {if(this._selectedRecord===x) return;this._selectedRecord=x;this._selectedRecordChanged=true;this._needsSelectedRecordLayout();} get height() {return 36;} get selected(){return this._selected;} set selected(x) {if(this._selected===x) return;this._selected=x;this.element.classList.toggle("selected",this._selected);} shown() {if(this._visible) return;this._visible=true;this.element.classList.toggle("hidden",!this._visible);this.updateLayout();} hidden() {if(!this._visible) return;this._visible=false;this.element.classList.toggle("hidden",!this._visible);} reset() {} recordWasFiltered(record,filtered) {} needsLayout() {if(!this._visible) return;super.needsLayout();} updateSelectedRecord() {} _needsSelectedRecordLayout() {if(this.layoutPending) return;if(this._scheduledSelectedRecordLayoutUpdateIdentifier) return;this._scheduledSelectedRecordLayoutUpdateIdentifier=requestAnimationFrame(()=>{this._scheduledSelectedRecordLayoutUpdateIdentifier=undefined;this.updateSelectedRecord();this.dispatchEventToListeners(WebInspector.TimelineOverviewGraph.Event.RecordSelected,{record:this.selectedRecord});});}};WebInspector.TimelineOverviewGraph.Event={RecordSelected:"timeline-overview-graph-record-selected"};WebInspector.TimelineView=class TimelineView extends WebInspector.ContentView {constructor(representedObject) {super(representedObject);this.element.classList.add("timeline-view");this._zeroTime=0;this._startTime=0;this._endTime=5;this._currentTime=0;} get scrollableElements() {if(!this._timelineDataGrid) return[];return[this._timelineDataGrid.scrollContainer];} get showsLiveRecordingData() {return true;} get showsFilterBar() {return true;} get navigationItems() {return this._scopeBar?[this._scopeBar]:[];} get selectionPathComponents() {return null;} get zeroTime() {return this._zeroTime;} set zeroTime(x) {x=x||0;if(this._zeroTime===x) return;this._zeroTime=x;this._timesDidChange();} get startTime() {return this._startTime;} set startTime(x) {x=x||0;if(this._startTime===x) return;this._startTime=x;this._timesDidChange();this._scheduleFilterDidChange();} get endTime() {return this._endTime;} set endTime(x) {x=x||0;if(this._endTime===x) return;this._endTime=x;this._timesDidChange();this._scheduleFilterDidChange();} get currentTime() {return this._currentTime;} set currentTime(x) {x=x||0;if(this._currentTime===x) return;let oldCurrentTime=this._currentTime;this._currentTime=x;function checkIfLayoutIsNeeded(currentTime) {const wiggleTime=0.05; return this._startTime-wiggleTime<=currentTime&¤tTime<=this._endTime+wiggleTime;} if(checkIfLayoutIsNeeded.call(this,oldCurrentTime)||checkIfLayoutIsNeeded.call(this,this._currentTime)) this._timesDidChange();} get filterStartTime() {return this.startTime;} get filterEndTime() {return this.endTime;} setupDataGrid(dataGrid) {if(this._timelineDataGrid){this._timelineDataGrid.filterDelegate=null;this._timelineDataGrid.removeEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged,this._timelineDataGridSelectedNodeChanged,this);this._timelineDataGrid.removeEventListener(WebInspector.DataGrid.Event.NodeWasFiltered,this._timelineDataGridNodeWasFiltered,this);this._timelineDataGrid.removeEventListener(WebInspector.DataGrid.Event.FilterDidChange,this.filterDidChange,this);} this._timelineDataGrid=dataGrid;this._timelineDataGrid.filterDelegate=this;this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged,this._timelineDataGridSelectedNodeChanged,this);this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.NodeWasFiltered,this._timelineDataGridNodeWasFiltered,this);this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.FilterDidChange,this.filterDidChange,this);} selectRecord(record) {if(!this._timelineDataGrid) return;let selectedDataGridNode=this._timelineDataGrid.selectedNode;if(!record){if(selectedDataGridNode) selectedDataGridNode.deselect();return;} let dataGridNode=this._timelineDataGrid.findNode((node)=>node.record===record);if(!dataGridNode||dataGridNode.selected) return;if(selectedDataGridNode&&selectedDataGridNode.hasAncestor(dataGridNode)) return;dataGridNode.revealAndSelect();} reset() {} updateFilter(filters) {if(!this._timelineDataGrid) return;this._timelineDataGrid.filterText=filters?filters.text:"";} matchDataGridNodeAgainstCustomFilters(node) {return true;} needsLayout() {if(!this.visible) return;super.needsLayout();} dataGridMatchNodeAgainstCustomFilters(node) {if(!this.matchDataGridNodeAgainstCustomFilters(node)) return false;let startTime=this.filterStartTime;let endTime=this.filterEndTime;let currentTime=this.currentTime;function checkTimeBounds(itemStartTime,itemEndTime) {itemStartTime=itemStartTime||currentTime;itemEndTime=itemEndTime||currentTime;return startTime<=itemEndTime&&itemStartTime<=endTime;} if(node instanceof WebInspector.ResourceTimelineDataGridNode){let resource=node.resource;return checkTimeBounds(resource.requestSentTimestamp,resource.finishedOrFailedTimestamp);} if(node instanceof WebInspector.SourceCodeTimelineTimelineDataGridNode){let sourceCodeTimeline=node.sourceCodeTimeline;if(!checkTimeBounds(sourceCodeTimeline.startTime,sourceCodeTimeline.endTime)) return false;for(let record of sourceCodeTimeline.records){if(checkTimeBounds(record.startTime,record.endTime)) return true;} return false;} if(node instanceof WebInspector.ProfileNodeDataGridNode){let profileNode=node.profileNode;if(checkTimeBounds(profileNode.startTime,profileNode.endTime)) return true;return false;} if(node instanceof WebInspector.TimelineDataGridNode){let record=node.record;return checkTimeBounds(record.startTime,record.endTime);} if(node instanceof WebInspector.ProfileDataGridNode) return node.callingContextTreeNode.hasStackTraceInTimeRange(startTime,endTime);console.error("Unknown DataGridNode, can't filter by time.");return true;} userSelectedRecordFromOverview(timelineRecord) {} filterDidChange() {} _timelineDataGridSelectedNodeChanged(event) {this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);} _timelineDataGridNodeWasFiltered(event) {let node=event.data.node;if(!(node instanceof WebInspector.TimelineDataGridNode)) return;this.dispatchEventToListeners(WebInspector.TimelineView.Event.RecordWasFiltered,{record:node.record,filtered:node.hidden});} _timesDidChange() {if(!WebInspector.timelineManager.isCapturing()||this.showsLiveRecordingData) this.needsLayout();} _scheduleFilterDidChange() {if(!this._timelineDataGrid||this._updateFilterTimeout) return;this._updateFilterTimeout=setTimeout(()=>{this._updateFilterTimeout=undefined;this._timelineDataGrid.filterDidChange();},0);}};WebInspector.TimelineView.Event={RecordWasFiltered:"record-was-filtered"};WebInspector.TreeElement=class TreeElement extends WebInspector.Object {constructor(title,representedObject,hasChildren) {super();this._title=title;this.representedObject=(representedObject||{});if(this.representedObject.__treeElementIdentifier) this.identifier=this.representedObject.__treeElementIdentifier;else{this.identifier=WebInspector.TreeOutline._knownTreeElementNextIdentifier++;this.representedObject.__treeElementIdentifier=this.identifier;} this._hidden=false;this._selectable=true;this.expanded=false;this.selected=false;this.hasChildren=hasChildren;this.children=[];this.treeOutline=null;this.parent=null;this.previousSibling=null;this.nextSibling=null;this._listItemNode=null;} appendChild(){return WebInspector.TreeOutline.prototype.appendChild.apply(this,arguments);} insertChild(){return WebInspector.TreeOutline.prototype.insertChild.apply(this,arguments);} removeChild(){return WebInspector.TreeOutline.prototype.removeChild.apply(this,arguments);} removeChildAtIndex(){return WebInspector.TreeOutline.prototype.removeChildAtIndex.apply(this,arguments);} removeChildren(){return WebInspector.TreeOutline.prototype.removeChildren.apply(this,arguments);} removeChildrenRecursive(){return WebInspector.TreeOutline.prototype.removeChildrenRecursive.apply(this,arguments);} selfOrDescendant(){return WebInspector.TreeOutline.prototype.selfOrDescendant.apply(this,arguments);} get arrowToggleWidth() {return 10;} get selectable() {if(this._hidden) return false;return this._selectable;} set selectable(x) {this._selectable=x;} get listItemElement() {return this._listItemNode;} get title() {return this._title;} set title(x) {this._title=x;this._setListItemNodeContent();this.didChange();} get titleHTML() {return this._titleHTML;} set titleHTML(x) {this._titleHTML=x;this._setListItemNodeContent();this.didChange();} get tooltip() {return this._tooltip;} set tooltip(x) {this._tooltip=x;if(this._listItemNode) this._listItemNode.title=x?x:"";} get hasChildren() {return this._hasChildren;} set hasChildren(x) {if(this._hasChildren===x) return;this._hasChildren=x;if(!this._listItemNode) return;if(x) this._listItemNode.classList.add("parent");else{this._listItemNode.classList.remove("parent");this.collapse();} this.didChange();} get hidden() {return this._hidden;} set hidden(x) {if(this._hidden===x) return;this._hidden=x;if(this._listItemNode) this._listItemNode.hidden=this._hidden;if(this._childrenListNode) this._childrenListNode.hidden=this._hidden;if(this.treeOutline) this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementVisibilityDidChange,{element:this});} get shouldRefreshChildren() {return this._shouldRefreshChildren;} set shouldRefreshChildren(x) {this._shouldRefreshChildren=x;if(x&&this.expanded) this.expand();} _fireDidChange() {if(this.treeOutline) this.treeOutline._treeElementDidChange(this);} didChange() {if(!this.treeOutline) return;this.onNextFrame._fireDidChange();} _setListItemNodeContent() {if(!this._listItemNode) return;if(!this._titleHTML&&!this._title) this._listItemNode.removeChildren();else if(typeof this._titleHTML==="string") this._listItemNode.innerHTML=this._titleHTML;else if(typeof this._title==="string") this._listItemNode.textContent=this._title;else{this._listItemNode.removeChildren();if(this._title.parentNode) this._title.parentNode.removeChild(this._title);this._listItemNode.appendChild(this._title);}} _attach() {if(!this._listItemNode||this.parent._shouldRefreshChildren){if(this._listItemNode&&this._listItemNode.parentNode) this._listItemNode.parentNode.removeChild(this._listItemNode);this._listItemNode=this.treeOutline._childrenListNode.ownerDocument.createElement("li");this._listItemNode.treeElement=this;this._setListItemNodeContent();this._listItemNode.title=this._tooltip?this._tooltip:"";this._listItemNode.hidden=this.hidden;if(this.hasChildren) this._listItemNode.classList.add("parent");if(this.expanded) this._listItemNode.classList.add("expanded");if(this.selected) this._listItemNode.classList.add("selected");this._listItemNode.addEventListener("mousedown",WebInspector.TreeElement.treeElementMouseDown);this._listItemNode.addEventListener("click",WebInspector.TreeElement.treeElementToggled);this._listItemNode.addEventListener("dblclick",WebInspector.TreeElement.treeElementDoubleClicked);if(this.onattach) this.onattach(this);} var nextSibling=null;if(this.nextSibling&&this.nextSibling._listItemNode&&this.nextSibling._listItemNode.parentNode===this.parent._childrenListNode) nextSibling=this.nextSibling._listItemNode;this.parent._childrenListNode.insertBefore(this._listItemNode,nextSibling);if(this._childrenListNode) this.parent._childrenListNode.insertBefore(this._childrenListNode,this._listItemNode.nextSibling);if(this.selected) this.select();if(this.expanded) this.expand();} _detach() {if(this.ondetach) this.ondetach(this);if(this._listItemNode&&this._listItemNode.parentNode) this._listItemNode.parentNode.removeChild(this._listItemNode);if(this._childrenListNode&&this._childrenListNode.parentNode) this._childrenListNode.parentNode.removeChild(this._childrenListNode);} static treeElementMouseDown(event) {var element=event.currentTarget;if(!element||!element.treeElement||!element.treeElement.selectable) return;if(element.treeElement.isEventWithinDisclosureTriangle(event)){event.preventDefault();return;} element.treeElement.selectOnMouseDown(event);} static treeElementToggled(event) {var element=event.currentTarget;if(!element||!element.treeElement) return;var toggleOnClick=element.treeElement.toggleOnClick&&!element.treeElement.selectable;var isInTriangle=element.treeElement.isEventWithinDisclosureTriangle(event);if(!toggleOnClick&&!isInTriangle) return;if(element.treeElement.expanded){if(event.altKey) element.treeElement.collapseRecursively();else element.treeElement.collapse();}else{if(event.altKey) element.treeElement.expandRecursively();else element.treeElement.expand();} event.stopPropagation();} static treeElementDoubleClicked(event) {var element=event.currentTarget;if(!element||!element.treeElement) return;if(element.treeElement.isEventWithinDisclosureTriangle(event)) return;if(element.treeElement.dispatchEventToListeners(WebInspector.TreeElement.Event.DoubleClick)) return;if(element.treeElement.ondblclick) element.treeElement.ondblclick.call(element.treeElement,event);else if(element.treeElement.hasChildren&&!element.treeElement.expanded) element.treeElement.expand();} collapse() {if(this._listItemNode) this._listItemNode.classList.remove("expanded");if(this._childrenListNode) this._childrenListNode.classList.remove("expanded");this.expanded=false;if(this.treeOutline) this.treeOutline._treeElementsExpandedState[this.identifier]=false;if(this.oncollapse) this.oncollapse(this);if(this.treeOutline) this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged,{element:this});} collapseRecursively() {var item=this;while(item){if(item.expanded) item.collapse();item=item.traverseNextTreeElement(false,this,true);}} expand() {if(this.expanded&&!this._shouldRefreshChildren&&this._childrenListNode) return; this.expanded=true;if(this.treeOutline) this.treeOutline._treeElementsExpandedState[this.identifier]=true;if(!this.hasChildren) return;if(this.treeOutline&&(!this._childrenListNode||this._shouldRefreshChildren)){if(this._childrenListNode&&this._childrenListNode.parentNode) this._childrenListNode.parentNode.removeChild(this._childrenListNode);this._childrenListNode=this.treeOutline._childrenListNode.ownerDocument.createElement("ol");this._childrenListNode.parentTreeElement=this;this._childrenListNode.classList.add("children");this._childrenListNode.hidden=this.hidden;this.onpopulate(); this.expanded=true;for(var i=0;i=maxDepth),info);depth+=info.depthChange;}} hasAncestor(ancestor) {if(!ancestor) return false;var currentNode=this.parent;while(currentNode){if(ancestor===currentNode) return true;currentNode=currentNode.parent;} return false;} reveal() {var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor.root){if(!currentAncestor.expanded) currentAncestor.expand();currentAncestor=currentAncestor.parent;} if(this.onreveal) this.onreveal(this);} revealed(ignoreHidden) {if(!ignoreHidden&&this.hidden) return false;var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor.root){if(!currentAncestor.expanded) return false;if(!ignoreHidden&¤tAncestor.hidden) return false;currentAncestor=currentAncestor.parent;} return true;} selectOnMouseDown(event) {this.select(false,true);} select(omitFocus,selectedByUser,suppressOnSelect,suppressOnDeselect) {if(!this.treeOutline||!this.selectable) return;if(this.selected&&!this.treeOutline.allowsRepeatSelection) return;if(!omitFocus) this.treeOutline._childrenListNode.focus();let treeOutline=this.treeOutline;if(!treeOutline) return;treeOutline.processingSelectionChange=true; if(!suppressOnSelect) suppressOnDeselect=true;let deselectedElement=treeOutline.selectedTreeElement;if(!this.selected){if(treeOutline.selectedTreeElement) treeOutline.selectedTreeElement.deselect(suppressOnDeselect);this.selected=true;treeOutline.selectedTreeElement=this;if(this._listItemNode) this._listItemNode.classList.add("selected");} if(!suppressOnSelect){if(this.onselect) this.onselect(this,selectedByUser);treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.SelectionDidChange,{selectedElement:this,deselectedElement,selectedByUser});} treeOutline.processingSelectionChange=false;let treeOutlineGroup=WebInspector.TreeOutlineGroup.groupForTreeOutline(treeOutline);if(!treeOutlineGroup) return;treeOutlineGroup.didSelectTreeElement(this);} revealAndSelect(omitFocus,selectedByUser,suppressOnSelect,suppressOnDeselect) {this.reveal();this.select(omitFocus,selectedByUser,suppressOnSelect,suppressOnDeselect);} deselect(suppressOnDeselect) {if(!this.treeOutline||this.treeOutline.selectedTreeElement!==this||!this.selected) return false;this.selected=false;this.treeOutline.selectedTreeElement=null;if(this._listItemNode) this._listItemNode.classList.remove("selected");if(!suppressOnDeselect){if(this.ondeselect) this.ondeselect(this);this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.SelectionDidChange,{deselectedElement:this});} return true;} onpopulate() {} traverseNextTreeElement(skipUnrevealed,stayWithin,dontPopulate,info) {function shouldSkip(element){return skipUnrevealed&&!element.revealed(true);} var depthChange=0;var element=this;if(!dontPopulate) element.onpopulate();do{if(element.hasChildren&&element.children[0]&&(!skipUnrevealed||element.expanded)){element=element.children[0];depthChange+=1;}else{while(element&&!element.nextSibling&&element.parent&&!element.parent.root&&element.parent!==stayWithin){element=element.parent;depthChange-=1;} if(element) element=element.nextSibling;}}while(element&&shouldSkip(element));if(info) info.depthChange=depthChange;return element;} traversePreviousTreeElement(skipUnrevealed,dontPopulate) {function shouldSkip(element){return skipUnrevealed&&!element.revealed(true);} var element=this;do{if(element.previousSibling){element=element.previousSibling;while(element&&element.hasChildren&&element.expanded&&!shouldSkip(element)){if(!dontPopulate) element.onpopulate();element=element.children.lastValue;}}else element=element.parent&&element.parent.root?null:element.parent;}while(element&&shouldSkip(element));return element;} isEventWithinDisclosureTriangle(event) {if(!document.contains(this._listItemNode)) return false;let computedStyle=window.getComputedStyle(this._listItemNode);let start=0;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL) start+=this._listItemNode.totalOffsetRight-computedStyle.getPropertyCSSValue("padding-right").getFloatValue(CSSPrimitiveValue.CSS_PX)-this.arrowToggleWidth;else start+=this._listItemNode.totalOffsetLeft+computedStyle.getPropertyCSSValue("padding-left").getFloatValue(CSSPrimitiveValue.CSS_PX);return event.pageX>=start&&event.pageX<=start+this.arrowToggleWidth&&this.hasChildren;} populateContextMenu(contextMenu,event) {if(this.children.some((child)=>child.hasChildren)||(this.hasChildren&&!this.children.length)){contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Expand All"),this.expandRecursively.bind(this));contextMenu.appendItem(WebInspector.UIString("Collapse All"),this.collapseRecursively.bind(this));}}};WebInspector.TreeElement.Event={DoubleClick:"tree-element-double-click",};WebInspector.TreeOutline=class TreeOutline extends WebInspector.Object {constructor(element) {super();this.element=element||document.createElement("ol");this.element.classList.add(WebInspector.TreeOutline.ElementStyleClassName);this.element.addEventListener("contextmenu",this._handleContextmenu.bind(this));this.children=[];this.selectedTreeElement=null;this._childrenListNode=this.element;this._childrenListNode.removeChildren();this._knownTreeElements=[];this._treeElementsExpandedState=[];this.allowsRepeatSelection=false;this.root=true;this.hasChildren=false;this.expanded=true;this.selected=false;this.treeOutline=this;this._hidden=false;this._compact=false;this._large=false;this._disclosureButtons=true;this._customIndent=false;this._childrenListNode.tabIndex=0;this._childrenListNode.addEventListener("keydown",this._treeKeyDown.bind(this),true);WebInspector.TreeOutline._generateStyleRulesIfNeeded();} get hidden() {return this._hidden;} set hidden(x) {if(this._hidden===x) return;this._hidden=x;this.element.hidden=this._hidden;} get compact() {return this._compact;} set compact(x) {if(this._compact===x) return;this._compact=x;if(this._compact) this.large=false;this.element.classList.toggle("compact",this._compact);} get large() {return this._large;} set large(x) {if(this._large===x) return;this._large=x;if(this._large) this.compact=false;this.element.classList.toggle("large",this._large);} get disclosureButtons() {return this._disclosureButtons;} set disclosureButtons(x) {if(this._disclosureButtons===x) return;this._disclosureButtons=x;this.element.classList.toggle("hide-disclosure-buttons",!this._disclosureButtons);} get customIndent() {return this._customIndent;} set customIndent(x) {if(this._customIndent===x) return;this._customIndent=x;this.element.classList.toggle(WebInspector.TreeOutline.CustomIndentStyleClassName,this._customIndent);} appendChild(child) {if(!child) return;var lastChild=this.children[this.children.length-1];if(lastChild){lastChild.nextSibling=child;child.previousSibling=lastChild;}else{child.previousSibling=null;child.nextSibling=null;} var isFirstChild=!this.children.length;this.children.push(child);this.hasChildren=true;child.parent=this;child.treeOutline=this.treeOutline;child.treeOutline._rememberTreeElement(child);var current=child.children[0];while(current){current.treeOutline=this.treeOutline;current.treeOutline._rememberTreeElement(current);current=current.traverseNextTreeElement(false,child,true);} if(child.hasChildren&&child.treeOutline._treeElementsExpandedState[child.identifier]!==undefined) child.expanded=child.treeOutline._treeElementsExpandedState[child.identifier];if(this._childrenListNode) child._attach();if(this.treeOutline) this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementAdded,{element:child});if(isFirstChild&&this.expanded) this.expand();} insertChild(child,index) {if(!child) return;var previousChild=(index>0?this.children[index-1]:null);if(previousChild){previousChild.nextSibling=child;child.previousSibling=previousChild;}else{child.previousSibling=null;} var nextChild=this.children[index];if(nextChild){nextChild.previousSibling=child;child.nextSibling=nextChild;}else{child.nextSibling=null;} var isFirstChild=!this.children.length;this.children.splice(index,0,child);this.hasChildren=true;child.parent=this;child.treeOutline=this.treeOutline;child.treeOutline._rememberTreeElement(child);var current=child.children[0];while(current){current.treeOutline=this.treeOutline;current.treeOutline._rememberTreeElement(current);current=current.traverseNextTreeElement(false,child,true);} if(child.hasChildren&&child.treeOutline._treeElementsExpandedState[child.identifier]!==undefined) child.expanded=child.treeOutline._treeElementsExpandedState[child.identifier];if(this._childrenListNode) child._attach();if(this.treeOutline) this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementAdded,{element:child});if(isFirstChild&&this.expanded) this.expand();} removeChildAtIndex(childIndex,suppressOnDeselect,suppressSelectSibling) {if(childIndex<0||childIndex>=this.children.length) return;let child=this.children[childIndex];this.children.splice(childIndex,1);let parent=child.parent;if(child.deselect(suppressOnDeselect)){if(child.previousSibling&&!suppressSelectSibling) child.previousSibling.select(true,false);else if(child.nextSibling&&!suppressSelectSibling) child.nextSibling.select(true,false);else if(!suppressSelectSibling) parent.select(true,false);} if(child.previousSibling) child.previousSibling.nextSibling=child.nextSibling;if(child.nextSibling) child.nextSibling.previousSibling=child.previousSibling;let treeOutline=child.treeOutline;if(treeOutline){treeOutline._forgetTreeElement(child);treeOutline._forgetChildrenRecursive(child);} child._detach();child.treeOutline=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;if(treeOutline) treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementRemoved,{element:child});} removeChild(child,suppressOnDeselect,suppressSelectSibling) {if(!child) return;var childIndex=this.children.indexOf(child);if(childIndex===-1) return;this.removeChildAtIndex(childIndex,suppressOnDeselect,suppressSelectSibling);if(!this.children.length){if(this._listItemNode) this._listItemNode.classList.remove("parent");this.hasChildren=false;}} removeChildren(suppressOnDeselect) {for(let child of this.children){child.deselect(suppressOnDeselect);let treeOutline=child.treeOutline;if(treeOutline){treeOutline._forgetTreeElement(child);treeOutline._forgetChildrenRecursive(child);} child._detach();child.treeOutline=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;if(treeOutline) treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementRemoved,{element:child});} this.children=[];} removeChildrenRecursive(suppressOnDeselect) {let childrenToRemove=this.children;let child=this.children[0];while(child){if(child.children.length) childrenToRemove=childrenToRemove.concat(child.children);child=child.traverseNextTreeElement(false,this,true);} for(let child of childrenToRemove){child.deselect(suppressOnDeselect);let treeOutline=child.treeOutline;if(treeOutline) treeOutline._forgetTreeElement(child);child._detach();child.children=[];child.treeOutline=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;if(treeOutline) treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementRemoved,{element:child});} this.children=[];} reattachIfIndexChanged(treeElement,insertionIndex) {if(this.children[insertionIndex]===treeElement) return;let wasSelected=treeElement.selected;if(treeElement.parent===this) this.removeChild(treeElement);this.insertChild(treeElement,insertionIndex);if(wasSelected) treeElement.select();} _rememberTreeElement(element) {if(!this._knownTreeElements[element.identifier]) this._knownTreeElements[element.identifier]=[]; var elements=this._knownTreeElements[element.identifier];if(elements.indexOf(element)!==-1) return; elements.push(element);} _forgetTreeElement(element) {if(this.selectedTreeElement===element){element.deselect(true);this.selectedTreeElement=null;} if(this._knownTreeElements[element.identifier]) this._knownTreeElements[element.identifier].remove(element,true);} _forgetChildrenRecursive(parentElement) {var child=parentElement.children[0];while(child){this._forgetTreeElement(child);child=child.traverseNextTreeElement(false,parentElement,true);}} getCachedTreeElement(representedObject) {if(!representedObject) return null;if(representedObject.__treeElementIdentifier){ var elements=this._knownTreeElements[representedObject.__treeElementIdentifier];if(elements){for(var i=0;i .children";styleText+=`.${WebInspector.TreeOutline.ElementStyleClassName}:not(.${WebInspector.TreeOutline.CustomIndentStyleClassName})${childrenSubstring} > .item { `;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL) styleText+="padding-right: ";else styleText+="padding-left: ";styleText+=(baseLeftPadding+(depthPadding*i))+"px; }\n";} WebInspector.TreeOutline._styleElement.textContent=styleText;document.head.appendChild(WebInspector.TreeOutline._styleElement);} _handleContextmenu(event) {let treeElement=this.treeElementFromEvent(event);if(!treeElement) return;let contextMenu=WebInspector.ContextMenu.createFromEvent(event);this.populateContextMenu(contextMenu,event,treeElement);}};WebInspector.TreeOutline._styleElement=null;WebInspector.TreeOutline.ElementStyleClassName="tree-outline";WebInspector.TreeOutline.CustomIndentStyleClassName="custom-indent";WebInspector.TreeOutline.Event={ElementAdded:Symbol("element-added"),ElementDidChange:Symbol("element-did-change"),ElementRemoved:Symbol("element-removed"),ElementDisclosureDidChanged:Symbol("element-disclosure-did-change"),ElementVisibilityDidChange:Symbol("element-visbility-did-change"),SelectionDidChange:Symbol("selection-did-change")};WebInspector.TreeOutline._knownTreeElementNextIdentifier=1;WebInspector.TreeOutlineGroup=class TreeOutlineGroup extends WebInspector.Collection {constructor() {super((object)=>object instanceof WebInspector.TreeOutline);} static groupForTreeOutline(treeOutline) {return treeOutline[WebInspector.TreeOutlineGroup.GroupForTreeOutlineSymbol]||null;} get selectedTreeElement() {for(let treeOutline of this.items){if(treeOutline.selectedTreeElement) return treeOutline.selectedTreeElement;} return null;} itemAdded(treeOutline) {treeOutline[WebInspector.TreeOutlineGroup.GroupForTreeOutlineSymbol]=this;if(treeOutline.selectedTreeElement) this._removeConflictingTreeSelections(treeOutline.selectedTreeElement);} itemRemoved(treeOutline) {treeOutline[WebInspector.TreeOutlineGroup.GroupForTreeOutlineSymbol]=null;} didSelectTreeElement(treeElement) {if(!treeElement) return;this._removeConflictingTreeSelections(treeElement);} _removeConflictingTreeSelections(treeElement) {let selectedTreeOutline=treeElement.treeOutline;for(let treeOutline of this.items){if(selectedTreeOutline===treeOutline) continue;if(treeOutline.selectedTreeElement) treeOutline.selectedTreeElement.deselect();}}};WebInspector.TreeOutlineGroup.GroupForTreeOutlineSymbol=Symbol("group-for-tree-outline");WebInspector.ButtonNavigationItem=class ButtonNavigationItem extends WebInspector.NavigationItem {constructor(identifier,toolTipOrLabel,image,imageWidth,imageHeight,role,label) {super(identifier);this.toolTip=toolTipOrLabel;this._element.addEventListener("click",this._mouseClicked.bind(this));this._element.setAttribute("role",role||"button");if(label) this._element.setAttribute("aria-label",label);this._imageWidth=imageWidth||16;this._imageHeight=imageHeight||16;if(image) this.image=image;else this.label=toolTipOrLabel;} get toolTip() {return this._element.title;} set toolTip(newToolTip) {if(!newToolTip) return;this._element.title=newToolTip;} get label() {return this._element.textContent;} set label(newLabel) {this._element.classList.add(WebInspector.ButtonNavigationItem.TextOnlyClassName);this._element.textContent=newLabel||"";if(this.parentNavigationBar) this.parentNavigationBar.needsLayout();} get image() {return this._image;} set image(newImage) {if(!newImage){this._element.removeChildren();return;} this._element.removeChildren();this._element.classList.remove(WebInspector.ButtonNavigationItem.TextOnlyClassName);this._image=newImage;this._glyphElement=useSVGSymbol(this._image,"glyph");this._glyphElement.style.width=this._imageWidth+"px";this._glyphElement.style.height=this._imageHeight+"px";this._element.appendChild(this._glyphElement);} get enabled() {return!this._element.classList.contains(WebInspector.ButtonNavigationItem.DisabledStyleClassName);} set enabled(flag) {if(flag) this._element.classList.remove(WebInspector.ButtonNavigationItem.DisabledStyleClassName);else this._element.classList.add(WebInspector.ButtonNavigationItem.DisabledStyleClassName);} get additionalClassNames() {return["button"];} _mouseClicked(event) {if(!this.enabled) return;this.dispatchEventToListeners(WebInspector.ButtonNavigationItem.Event.Clicked);}};WebInspector.ButtonNavigationItem.DisabledStyleClassName="disabled";WebInspector.ButtonNavigationItem.TextOnlyClassName="text-only";WebInspector.ButtonNavigationItem.Event={Clicked:"button-navigation-item-clicked"};WebInspector.DatabaseUserQueryViewBase=class DatabaseUserQueryViewBase extends WebInspector.View {constructor(query) {super();this.element.className="database-user-query";let commandTextElement=document.createElement("span");commandTextElement.className="database-query-text";commandTextElement.textContent=query;this.element.appendChild(commandTextElement);this._resultElement=document.createElement("div");this._resultElement.className="database-query-result";this.element.appendChild(this._resultElement);} get resultElement() {return this._resultElement;}};WebInspector.DatabaseUserQueryErrorView=class DatabaseUserQueryErrorView extends WebInspector.DatabaseUserQueryViewBase {constructor(query,message) {super(query);this.resultElement.classList.add("error");this.resultElement.textContent=message;}};WebInspector.DatabaseUserQuerySuccessView=class DatabaseUserQuerySuccessView extends WebInspector.DatabaseUserQueryViewBase {constructor(query,columnNames,values) {super(query);this._dataGrid=WebInspector.DataGrid.createSortableDataGrid(columnNames,values);if(this._dataGrid){this._dataGrid.inline=true;this.resultElement.appendChild(this._dataGrid.element);this._dataGrid.updateLayoutIfNeeded();}else{this.resultElement.classList.add("no-results");this.resultElement.textContent=WebInspector.UIString("Query returned no results.");}} get dataGrid() {return this._dataGrid;} layout() {if(this._dataGrid) this._dataGrid.updateLayout();}};WebInspector.DOMTreeContentView=class DOMTreeContentView extends WebInspector.ContentView {constructor(representedObject) {super(representedObject);this._compositingBordersButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("layer-borders",WebInspector.UIString("Show compositing borders"),WebInspector.UIString("Hide compositing borders"),"Images/LayerBorders.svg",13,13);this._compositingBordersButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._toggleCompositingBorders,this);this._compositingBordersButtonNavigationItem.enabled=!!PageAgent.getCompositingBordersVisible;WebInspector.showPaintRectsSetting.addEventListener(WebInspector.Setting.Event.Changed,this._showPaintRectsSettingChanged,this);this._paintFlashingButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("paint-flashing",WebInspector.UIString("Enable paint flashing"),WebInspector.UIString("Disable paint flashing"),"Images/PaintFlashing.svg",16,16);this._paintFlashingButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._togglePaintFlashing,this);this._paintFlashingButtonNavigationItem.enabled=!!PageAgent.setShowPaintRects;this._paintFlashingButtonNavigationItem.activated=PageAgent.setShowPaintRects&&WebInspector.showPaintRectsSetting.value;WebInspector.showShadowDOMSetting.addEventListener(WebInspector.Setting.Event.Changed,this._showShadowDOMSettingChanged,this);this._showsShadowDOMButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("shows-shadow-DOM",WebInspector.UIString("Show shadow DOM nodes"),WebInspector.UIString("Hide shadow DOM nodes"),"Images/ShadowDOM.svg",13,13);this._showsShadowDOMButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._toggleShowsShadowDOMSetting,this);this._showShadowDOMSettingChanged();WebInspector.showPrintStylesSetting.addEventListener(WebInspector.Setting.Event.Changed,this._showPrintStylesSettingChanged,this);this._showPrintStylesButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("print-styles",WebInspector.UIString("Force Print Media Styles"),WebInspector.UIString("Use Default Media Styles"),"Images/Printer.svg",16,16);this._showPrintStylesButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._togglePrintStylesSetting,this);this._showPrintStylesSettingChanged();this.element.classList.add("dom-tree");this.element.addEventListener("click",this._mouseWasClicked.bind(this),false);this._domTreeOutline=new WebInspector.DOMTreeOutline(true,true,true);this._domTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded,this._domTreeElementAdded,this);this._domTreeOutline.addEventListener(WebInspector.DOMTreeOutline.Event.SelectedNodeChanged,this._selectedNodeDidChange,this);this._domTreeOutline.wireToDomAgent();this._domTreeOutline.editable=true;this.element.appendChild(this._domTreeOutline.element);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeModified,this._domNodeChanged,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeRemoved,this._domNodeChanged,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.CharacterDataModified,this._domNodeChanged,this);this._lastSelectedNodePathSetting=new WebInspector.Setting("last-selected-node-path",null);this._numberOfSearchResults=null;this._breakpointGutterEnabled=false;this._pendingBreakpointNodeIdentifiers=new Set;if(WebInspector.domDebuggerManager.supported){WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange,this._breakpointsEnabledDidChange,this);WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.DOMBreakpointAdded,this._domBreakpointAddedOrRemoved,this);WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.DOMBreakpointRemoved,this._domBreakpointAddedOrRemoved,this);WebInspector.DOMBreakpoint.addEventListener(WebInspector.DOMBreakpoint.Event.DisabledStateDidChange,this._domBreakpointDisabledStateDidChange,this);WebInspector.DOMBreakpoint.addEventListener(WebInspector.DOMBreakpoint.Event.ResolvedStateDidChange,this._domBreakpointResolvedStateDidChange,this);this._breakpointsEnabledDidChange();}} get navigationItems() {return[this._showPrintStylesButtonNavigationItem,this._showsShadowDOMButtonNavigationItem,this._compositingBordersButtonNavigationItem,this._paintFlashingButtonNavigationItem];} get domTreeOutline() {return this._domTreeOutline;} get scrollableElements() {return[this.element];} get breakpointGutterEnabled() {return this._breakpointGutterEnabled;} set breakpointGutterEnabled(flag) {if(this._breakpointGutterEnabled===flag) return;this._breakpointGutterEnabled=flag;this.element.classList.toggle("show-gutter",this._breakpointGutterEnabled);} shown() {super.shown();this._domTreeOutline.setVisible(true,WebInspector.isConsoleFocused());this._updateCompositingBordersButtonToMatchPageSettings();if(!this._domTreeOutline.rootDOMNode) return;this._restoreBreakpointsAfterUpdate();} hidden() {super.hidden();WebInspector.domTreeManager.hideDOMNodeHighlight();this._domTreeOutline.setVisible(false);} closed() {super.closed();WebInspector.showPaintRectsSetting.removeEventListener(null,null,this);WebInspector.showShadowDOMSetting.removeEventListener(null,null,this);WebInspector.debuggerManager.removeEventListener(null,null,this);WebInspector.domTreeManager.removeEventListener(null,null,this);WebInspector.domDebuggerManager.removeEventListener(null,null,this);WebInspector.DOMBreakpoint.removeEventListener(null,null,this);this._domTreeOutline.close();this._pendingBreakpointNodeIdentifiers.clear();} get selectionPathComponents() {var treeElement=this._domTreeOutline.selectedTreeElement;var pathComponents=[];while(treeElement&&!treeElement.root){ if(treeElement.isCloseTag()){treeElement=treeElement.parent;continue;} var pathComponent=new WebInspector.DOMTreeElementPathComponent(treeElement,treeElement.representedObject);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.Clicked,this._pathComponentSelected,this);pathComponents.unshift(pathComponent);treeElement=treeElement.parent;} return pathComponents;} restoreFromCookie(cookie) {if(!cookie||!cookie.nodeToSelect) return;this.selectAndRevealDOMNode(cookie.nodeToSelect); cookie.nodeToSelect=undefined;} selectAndRevealDOMNode(domNode,preventFocusChange) {this._domTreeOutline.selectDOMNode(domNode,!preventFocusChange);} handleCopyEvent(event) {var selectedDOMNode=this._domTreeOutline.selectedDOMNode();if(!selectedDOMNode) return;event.clipboardData.clearData();event.preventDefault();selectedDOMNode.copyNode();} get supportsSave() {return WebInspector.canArchiveMainFrame();} get saveData() {function saveHandler(forceSaveAs) {WebInspector.archiveMainFrame();} return{customSaveHandler:saveHandler};} get supportsSearch() {return true;} get numberOfSearchResults() {return this._numberOfSearchResults;} get hasPerformedSearch() {return this._numberOfSearchResults!==null;} set automaticallyRevealFirstSearchResult(reveal) {this._automaticallyRevealFirstSearchResult=reveal;if(this._automaticallyRevealFirstSearchResult&&this._numberOfSearchResults>0){if(this._currentSearchResultIndex===-1) this.revealNextSearchResult();}} performSearch(query) {if(this._searchQuery===query) return;if(this._searchIdentifier){DOMAgent.discardSearchResults(this._searchIdentifier);this._hideSearchHighlights();} this._searchQuery=query;this._searchIdentifier=null;this._numberOfSearchResults=null;this._currentSearchResultIndex=-1;function searchResultsReady(error,searchIdentifier,resultsCount) {if(error) return;this._searchIdentifier=searchIdentifier;this._numberOfSearchResults=resultsCount;this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);this._showSearchHighlights();if(this._automaticallyRevealFirstSearchResult) this.revealNextSearchResult();} function contextNodesReady(nodeIds) {DOMAgent.performSearch(query,nodeIds,searchResultsReady.bind(this));} this.getSearchContextNodes(contextNodesReady.bind(this));} getSearchContextNodes(callback) {callback(undefined);} searchCleared() {if(this._searchIdentifier){DOMAgent.discardSearchResults(this._searchIdentifier);this._hideSearchHighlights();} this._searchQuery=null;this._searchIdentifier=null;this._numberOfSearchResults=null;this._currentSearchResultIndex=-1;} revealPreviousSearchResult(changeFocus) {if(!this._numberOfSearchResults) return;if(this._currentSearchResultIndex>0) --this._currentSearchResultIndex;else this._currentSearchResultIndex=this._numberOfSearchResults-1;this._revealSearchResult(this._currentSearchResultIndex,changeFocus);} revealNextSearchResult(changeFocus) {if(!this._numberOfSearchResults) return;if(this._currentSearchResultIndex+11) return;function followLink() { const options={alwaysOpenExternally:event?event.metaKey:false,lineNumber:anchorElement.lineNumber,ignoreNetworkTab:true,ignoreSearchTab:true,};WebInspector.openURL(anchorElement.href,this._frame,options);} this._followLinkTimeoutIdentifier=setTimeout(followLink.bind(this),333);} _toggleCompositingBorders(event) {var activated=!this._compositingBordersButtonNavigationItem.activated;this._compositingBordersButtonNavigationItem.activated=activated;PageAgent.setCompositingBordersVisible(activated);} _togglePaintFlashing(event) {WebInspector.showPaintRectsSetting.value=!WebInspector.showPaintRectsSetting.value;} _updateCompositingBordersButtonToMatchPageSettings() {var button=this._compositingBordersButtonNavigationItem; PageAgent.getCompositingBordersVisible(function(error,compositingBordersVisible){button.activated=error?false:compositingBordersVisible;button.enabled=error!=="unsupported";});} _showPaintRectsSettingChanged(event) {this._paintFlashingButtonNavigationItem.activated=WebInspector.showPaintRectsSetting.value;PageAgent.setShowPaintRects(this._paintFlashingButtonNavigationItem.activated);} _showShadowDOMSettingChanged(event) {this._showsShadowDOMButtonNavigationItem.activated=WebInspector.showShadowDOMSetting.value;} _toggleShowsShadowDOMSetting(event) {WebInspector.showShadowDOMSetting.value=!WebInspector.showShadowDOMSetting.value;} _showPrintStylesSettingChanged(event) {this._showPrintStylesButtonNavigationItem.activated=WebInspector.showPrintStylesSetting.value;} _togglePrintStylesSetting(event) {WebInspector.showPrintStylesSetting.value=!WebInspector.showPrintStylesSetting.value;let mediaType=WebInspector.showPrintStylesSetting.value?"print":"";PageAgent.setEmulatedMedia(mediaType);WebInspector.cssStyleManager.mediaTypeChanged();} _showSearchHighlights() {this._searchResultNodes=[];var searchIdentifier=this._searchIdentifier;DOMAgent.getSearchResults(this._searchIdentifier,0,this._numberOfSearchResults,function(error,nodeIdentifiers){if(error) return;if(this._searchIdentifier!==searchIdentifier) return;for(var i=0;iitem.disabled);treeElement.breakpointStatus=disabled?WebInspector.DOMTreeElement.BreakpointStatus.DisabledBreakpoint:WebInspector.DOMTreeElement.BreakpointStatus.Breakpoint;} _restoreBreakpointsAfterUpdate() {this._pendingBreakpointNodeIdentifiers.clear();this.breakpointGutterEnabled=false;let updatedNodes=new Set;for(let breakpoint of WebInspector.domDebuggerManager.domBreakpoints){if(updatedNodes.has(breakpoint.domNodeIdentifier)) continue;this._updateBreakpointStatus(breakpoint.domNodeIdentifier);}} _breakpointsEnabledDidChange(event) {this._domTreeOutline.element.classList.toggle("breakpoints-disabled",!WebInspector.debuggerManager.breakpointsEnabled);}};WebInspector.DetailsSidebarPanel=class DetailsSidebarPanel extends WebInspector.SidebarPanel {constructor(identifier,displayName,dontCreateNavigationItem) {super(identifier,displayName);this.element.classList.add("details");if(!dontCreateNavigationItem) this._navigationItem=new WebInspector.RadioButtonNavigationItem(identifier,displayName);} get navigationItem() {return this._navigationItem;} inspect(objects) {return false;}};WebInspector.GeneralTabBarItem=class GeneralTabBarItem extends WebInspector.TabBarItem {constructor(image,title,representedObject) {super(image,title,representedObject);let closeButtonElement=document.createElement("div");closeButtonElement.classList.add(WebInspector.TabBarItem.CloseButtonStyleClassName);closeButtonElement.title=WebInspector.UIString("Click to close this tab; Option-click to close all tabs except this one");this.element.insertBefore(closeButtonElement,this.element.firstChild);this.element.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this));} set title(title) {if(title){this._titleElement=document.createElement("span");this._titleElement.classList.add("title");let titleContentElement=document.createElement("span");titleContentElement.classList.add("content");titleContentElement.textContent=title;this._titleElement.appendChild(titleContentElement);this.element.insertBefore(this._titleElement,this.element.lastChild);}else{if(this._titleElement) this._titleElement.remove();this._titleElement=null;} super.title=title;} _handleContextMenuEvent(event) {if(!this._parentTabBar) return;let closeTab=()=>{this._parentTabBar.removeTabBarItem(this);};let closeOtherTabs=()=>{let tabBarItems=this._parentTabBar.tabBarItems;for(let i=tabBarItems.length-1;i>=0;--i){let item=tabBarItems[i];if(item===this||item instanceof WebInspector.PinnedTabBarItem) continue;this._parentTabBar.removeTabBarItem(item);}};let hasOtherNonPinnedTabs=this._parentTabBar.tabBarItems.some((item)=>item!==this&&!(item instanceof WebInspector.PinnedTabBarItem));let contextMenu=WebInspector.ContextMenu.createFromEvent(event);contextMenu.appendItem(WebInspector.UIString("Close Tab"),closeTab,this.isDefaultTab);contextMenu.appendItem(WebInspector.UIString("Close Other Tabs"),closeOtherTabs,!hasOtherNonPinnedTabs);}};WebInspector.GeneralTreeElement=class GeneralTreeElement extends WebInspector.TreeElement {constructor(classNames,title,subtitle,representedObject,hasChildren) {super("",representedObject,hasChildren);this.classNames=classNames;this._tooltipHandledSeparately=false;this._mainTitle=title||"";this._subtitle=subtitle||"";this._status="";} get element() {return this._listItemNode;} get iconElement() {this._createElementsIfNeeded();return this._iconElement;} get titlesElement() {this._createElementsIfNeeded();return this._titlesElement;} get mainTitleElement() {this._createElementsIfNeeded();return this._mainTitleElement;} get subtitleElement() {this._createElementsIfNeeded();this._createSubtitleElementIfNeeded();return this._subtitleElement;} get classNames() {return this._classNames;} set classNames(x) {x=x||[];if(typeof x==="string") x=[x];if(Array.shallowEqual(this._classNames,x)) return;if(this._listItemNode&&this._classNames) this._listItemNode.classList.remove(...this._classNames);this._classNames=x;if(this._listItemNode) this._listItemNode.classList.add(...this._classNames);} addClassName(className) {if(this._classNames.includes(className)) return;this._classNames.push(className);if(this._listItemNode) this._listItemNode.classList.add(className);} removeClassName(className) {if(!this._classNames.includes(className)) return;this._classNames.remove(className);if(this._listItemNode) this._listItemNode.classList.remove(className);} get mainTitle() {return this._mainTitle;} set mainTitle(x) {x=x||"";if(this._mainTitle===x) return;this._mainTitle=x;this._updateTitleElements();this.didChange();this.dispatchEventToListeners(WebInspector.GeneralTreeElement.Event.MainTitleDidChange);} get subtitle() {return this._subtitle;} set subtitle(x) {x=x||"";if(this._subtitle===x) return;this._subtitle=x;this._updateTitleElements();this.didChange();} get status() {return this._status;} set status(x) {x=x||"";if(this._status===x) return;if(!this._statusElement){this._statusElement=document.createElement("div");this._statusElement.className=WebInspector.GeneralTreeElement.StatusElementStyleClassName;} this._status=x;this._updateStatusElement();} get filterableData() {return{text:[this.mainTitle,this.subtitle]};} get tooltipHandledSeparately() {return this._tooltipHandledSeparately;} set tooltipHandledSeparately(x) {this._tooltipHandledSeparately=!!x;} isEventWithinDisclosureTriangle(event) {return event.target===this._disclosureButton;} onattach() {this._createElementsIfNeeded();this._updateTitleElements();this._listItemNode.classList.add("item");if(this._classNames) this._listItemNode.classList.add(...this._classNames);this._listItemNode.appendChild(this._disclosureButton);this._listItemNode.appendChild(this._iconElement);if(this._statusElement) this._listItemNode.appendChild(this._statusElement);this._listItemNode.appendChild(this._titlesElement);} ondetach() {} onreveal() {if(this._listItemNode) this._listItemNode.scrollIntoViewIfNeeded(false);} callFirstAncestorFunction(functionName,args) {var currentNode=this.parent;while(currentNode){if(typeof currentNode[functionName]==="function"){currentNode[functionName].apply(currentNode,args);break;} currentNode=currentNode.parent;}} _createElementsIfNeeded() {if(this._createdElements) return;this._disclosureButton=document.createElement("button");this._disclosureButton.className=WebInspector.GeneralTreeElement.DisclosureButtonStyleClassName; this._disclosureButton.tabIndex=-1;this._iconElement=document.createElement("img");this._iconElement.className=WebInspector.GeneralTreeElement.IconElementStyleClassName;this._titlesElement=document.createElement("div");this._titlesElement.className=WebInspector.GeneralTreeElement.TitlesElementStyleClassName;this._mainTitleElement=document.createElement("span");this._mainTitleElement.className=WebInspector.GeneralTreeElement.MainTitleElementStyleClassName;this._titlesElement.appendChild(this._mainTitleElement);this._createdElements=true;} _createSubtitleElementIfNeeded() {if(this._subtitleElement) return;this._subtitleElement=document.createElement("span");this._subtitleElement.className=WebInspector.GeneralTreeElement.SubtitleElementStyleClassName;this._titlesElement.appendChild(this._subtitleElement);} _updateTitleElements() {if(!this._createdElements) return;if(typeof this._mainTitle==="string"){if(this._mainTitleElement.textContent!==this._mainTitle) this._mainTitleElement.textContent=this._mainTitle;}else if(this._mainTitle instanceof Node){this._mainTitleElement.removeChildren();this._mainTitleElement.appendChild(this._mainTitle);} if(typeof this._subtitle==="string"&&this._subtitle){this._createSubtitleElementIfNeeded();if(this._subtitleElement.textContent!==this._subtitle) this._subtitleElement.textContent=this._subtitle;this._titlesElement.classList.remove(WebInspector.GeneralTreeElement.NoSubtitleStyleClassName);}else if(this._subtitle instanceof Node){this._createSubtitleElementIfNeeded();this._subtitleElement.removeChildren();this._subtitleElement.appendChild(this._subtitle);}else{if(this._subtitleElement) this._subtitleElement.textContent="";this._titlesElement.classList.add(WebInspector.GeneralTreeElement.NoSubtitleStyleClassName);} if(!this.tooltip&&!this._tooltipHandledSeparately) this._updateTitleTooltip();} _updateTitleTooltip() {if(!this._listItemNode) return;let mainTitleText=this._mainTitleElement.textContent;let subtitleText=this._subtitleElement?this._subtitleElement.textContent:"";let large=this.treeOutline&&this.treeOutline.large;if(mainTitleText&&subtitleText) this._listItemNode.title=mainTitleText+(large?"\n":" \u2014 ")+subtitleText;else if(mainTitleText) this._listItemNode.title=mainTitleText;else this._listItemNode.title=subtitleText;} _updateStatusElement() {if(!this._statusElement) return;if(!this._statusElement.parentNode&&this._listItemNode) this._listItemNode.insertBefore(this._statusElement,this._titlesElement);if(this._status instanceof Node){this._statusElement.removeChildren();this._statusElement.appendChild(this._status);}else this._statusElement.textContent=this._status;}};WebInspector.GeneralTreeElement.DisclosureButtonStyleClassName="disclosure-button";WebInspector.GeneralTreeElement.IconElementStyleClassName="icon";WebInspector.GeneralTreeElement.StatusElementStyleClassName="status";WebInspector.GeneralTreeElement.TitlesElementStyleClassName="titles";WebInspector.GeneralTreeElement.MainTitleElementStyleClassName="title";WebInspector.GeneralTreeElement.SubtitleElementStyleClassName="subtitle";WebInspector.GeneralTreeElement.NoSubtitleStyleClassName="no-subtitle";WebInspector.GeneralTreeElement.Event={MainTitleDidChange:"general-tree-element-main-title-did-change"};WebInspector.NavigationSidebarPanel=class NavigationSidebarPanel extends WebInspector.SidebarPanel {constructor(identifier,displayName,shouldAutoPruneStaleTopLevelResourceTreeElements) {super(identifier,displayName);this.element.classList.add("navigation");this.contentView.element.addEventListener("scroll",this.soon._updateContentOverflowShadowVisibility);this._contentTreeOutlineGroup=new WebInspector.TreeOutlineGroup;this._contentTreeOutline=this.createContentTreeOutline();this._filterBar=new WebInspector.FilterBar;this._filterBar.addEventListener(WebInspector.FilterBar.Event.FilterDidChange,this._filterDidChange,this);this.element.appendChild(this._filterBar.element);this._bottomOverflowShadowElement=document.createElement("div");this._bottomOverflowShadowElement.className=WebInspector.NavigationSidebarPanel.OverflowShadowElementStyleClassName;this.element.appendChild(this._bottomOverflowShadowElement);this._boundUpdateContentOverflowShadowVisibility=this.soon._updateContentOverflowShadowVisibility;window.addEventListener("resize",this._boundUpdateContentOverflowShadowVisibility);this._filtersSetting=new WebInspector.Setting(identifier+"-navigation-sidebar-filters",{});this._filterBar.filters=this._filtersSetting.value;this._emptyContentPlaceholderElements=new Map;this._emptyFilterResults=new Map;this._shouldAutoPruneStaleTopLevelResourceTreeElements=shouldAutoPruneStaleTopLevelResourceTreeElements||false;if(this._shouldAutoPruneStaleTopLevelResourceTreeElements){WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._checkForStaleResources,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved,this._checkForStaleResources,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasRemoved,this._checkForStaleResources,this);} this._pendingViewStateCookie=null;this._restoringState=false;} closed() {window.removeEventListener("resize",this._boundUpdateContentOverflowShadowVisibility);WebInspector.Frame.removeEventListener(null,null,this);} get contentBrowser() {return this._contentBrowser;} set contentBrowser(contentBrowser) {this._contentBrowser=contentBrowser||null;} get contentTreeOutline() {return this._contentTreeOutline;} get contentTreeOutlines() {return this._contentTreeOutlineGroup.items;} get currentRepresentedObject() {if(!this._contentBrowser) return null;return this._contentBrowser.currentRepresentedObjects[0]||null;} get filterBar() {return this._filterBar;} get restoringState() {return this._restoringState;} cancelRestoringState() {if(!this._finalAttemptToRestoreViewStateTimeout) return;clearTimeout(this._finalAttemptToRestoreViewStateTimeout);this._finalAttemptToRestoreViewStateTimeout=undefined;} createContentTreeOutline(suppressFiltering) {let contentTreeOutline=new WebInspector.TreeOutline;contentTreeOutline.allowsRepeatSelection=true;contentTreeOutline.element.classList.add(WebInspector.NavigationSidebarPanel.ContentTreeOutlineElementStyleClassName);this._contentTreeOutlineGroup.add(contentTreeOutline);this.contentView.element.appendChild(contentTreeOutline.element);if(!suppressFiltering){contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded,this._treeElementAddedOrChanged,this);contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementDidChange,this._treeElementAddedOrChanged,this);contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged,this._treeElementDisclosureDidChange,this);} contentTreeOutline[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol]=suppressFiltering;return contentTreeOutline;} suppressFilteringOnTreeElements(treeElements) {for(let treeElement of treeElements) treeElement[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol]=true;this._updateFilter();} treeElementForRepresentedObject(representedObject) {let treeElement=null;for(let treeOutline of this.contentTreeOutlines){treeElement=treeOutline.getCachedTreeElement(representedObject);if(treeElement) break;} return treeElement;} showDefaultContentView() {} showDefaultContentViewForTreeElement(treeElement) {if(!treeElement||!treeElement.representedObject) return false; if(!this.selected){let contentView=this.contentBrowser.contentViewForRepresentedObject(treeElement.representedObject);if(contentView&&contentView.parentContainer&&contentView.parentContainer!==this.contentBrowser.contentViewContainer) return false;let selectedTabContentView=WebInspector.tabBrowser.selectedTabContentView;if(selectedTabContentView&&selectedTabContentView.contentBrowser!==this.contentBrowser) return false;} let contentView=this.contentBrowser.showContentViewForRepresentedObject(treeElement.representedObject);if(!contentView) return false;treeElement.revealAndSelect(true,false,true,true);return true;} saveStateToCookie(cookie) {if(!this._contentBrowser) return;let representedObject=this.currentRepresentedObject;if(!representedObject) return;cookie[WebInspector.TypeIdentifierCookieKey]=representedObject.constructor.TypeIdentifier;if(representedObject.saveIdentityToCookie){representedObject.saveIdentityToCookie(cookie);return;} console.error("NavigationSidebarPanel representedObject is missing a saveIdentityToCookie implementation.",representedObject);} restoreStateFromCookie(cookie,relaxedMatchDelay) {this._pendingViewStateCookie=cookie;this._restoringState=true;this._checkOutlinesForPendingViewStateCookie();if(this._finalAttemptToRestoreViewStateTimeout) clearTimeout(this._finalAttemptToRestoreViewStateTimeout);if(relaxedMatchDelay===0) return;function finalAttemptToRestoreViewStateFromCookie() {this._finalAttemptToRestoreViewStateTimeout=undefined;this._checkOutlinesForPendingViewStateCookie(true);this._pendingViewStateCookie=null;this._restoringState=false;} this._finalAttemptToRestoreViewStateTimeout=setTimeout(finalAttemptToRestoreViewStateFromCookie.bind(this),relaxedMatchDelay);} showEmptyContentPlaceholder(message,treeOutline) {treeOutline=treeOutline||this._contentTreeOutline;let emptyContentPlaceholderElement=this._createEmptyContentPlaceholderIfNeeded(treeOutline);if(emptyContentPlaceholderElement.parentNode&&emptyContentPlaceholderElement.children[0].textContent===message) return;emptyContentPlaceholderElement.children[0].textContent=message;let emptyContentPlaceholderParentElement=treeOutline.element.parentNode;emptyContentPlaceholderParentElement.appendChild(emptyContentPlaceholderElement);this._updateContentOverflowShadowVisibility();} hideEmptyContentPlaceholder(treeOutline) {treeOutline=treeOutline||this._contentTreeOutline;let emptyContentPlaceholderElement=this._emptyContentPlaceholderElements.get(treeOutline);if(!emptyContentPlaceholderElement||!emptyContentPlaceholderElement.parentNode) return;emptyContentPlaceholderElement.remove();this._updateContentOverflowShadowVisibility();} updateEmptyContentPlaceholder(message,treeOutline) {treeOutline=treeOutline||this._contentTreeOutline;if(!treeOutline.children.length){this.showEmptyContentPlaceholder(message,treeOutline);}else if(!this._emptyFilterResults.get(treeOutline)){this.hideEmptyContentPlaceholder(treeOutline);}} updateFilter() {this._updateFilter();} shouldFilterPopulate() {return this.hasCustomFilters();} hasCustomFilters() {return false;} matchTreeElementAgainstCustomFilters(treeElement) {return true;} matchTreeElementAgainstFilterFunctions(treeElement) {if(!this._filterFunctions||!this._filterFunctions.length) return true;for(var filterFunction of this._filterFunctions){if(filterFunction(treeElement)) return true;} return false;} applyFiltersToTreeElement(treeElement) {if(!this._filterBar.hasActiveFilters()&&!this.hasCustomFilters()){treeElement.hidden=false;if(treeElement.expanded&&treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol]){treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol]=false;treeElement.collapse();} return;} var filterableData=treeElement.filterableData||{};var flags={expandTreeElement:false};var filterRegex=this._textFilterRegex;function matchTextFilter(inputs) {if(!inputs||!filterRegex) return true;for(var input of inputs){if(!input) continue;if(filterRegex.test(input)){flags.expandTreeElement=true;return true;}} return false;} function makeVisible() {treeElement.hidden=false;var currentAncestor=treeElement.parent;while(currentAncestor&&!currentAncestor.root){currentAncestor.hidden=false;if(flags.expandTreeElement&&!currentAncestor.expanded){currentAncestor.__wasExpandedDuringFiltering=true;currentAncestor.expand();} currentAncestor=currentAncestor.parent;}} let suppressFiltering=treeElement[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol];if(suppressFiltering||(matchTextFilter(filterableData.text)&&this.matchTreeElementAgainstFilterFunctions(treeElement,flags)&&this.matchTreeElementAgainstCustomFilters(treeElement,flags))){makeVisible();if(!flags.expandTreeElement&&treeElement.expanded&&treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol]){treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol]=false;treeElement.collapse();} return;} treeElement.hidden=true;} shown() {super.shown();this._updateContentOverflowShadowVisibility();} pruneStaleResourceTreeElements() {if(this._checkForStaleResourcesTimeoutIdentifier){clearTimeout(this._checkForStaleResourcesTimeoutIdentifier);this._checkForStaleResourcesTimeoutIdentifier=undefined;} for(let contentTreeOutline of this.contentTreeOutlines){ for(var i=contentTreeOutline.children.length-1;i>=0;--i){var treeElement=contentTreeOutline.children[i];if(!(treeElement instanceof WebInspector.ResourceTreeElement)) continue;var resource=treeElement.resource;if(!resource.parentFrame||resource.parentFrame.isDetached()) contentTreeOutline.removeChildAtIndex(i,true,true);}}} treeElementAddedOrChanged(treeElement) {} _updateContentOverflowShadowVisibility() {if(!this.visible) return;this._updateContentOverflowShadowVisibility.cancelDebounce();let scrollHeight=this.contentView.element.scrollHeight;let offsetHeight=this.contentView.element.offsetHeight;if(scrollHeightcandidateObjectCookie[key]===cookie[key]);} var matchedElement=null;treeElements.some((element)=>{if(treeElementMatchesCookie.call(this,element)){matchedElement=element;return true;} return false;});if(matchedElement){let didShowContentView=this.showDefaultContentViewForTreeElement(matchedElement);if(!didShowContentView) return;this._pendingViewStateCookie=null; setTimeout(()=>{this._restoringState=false;},0);if(this._finalAttemptToRestoreViewStateTimeout){clearTimeout(this._finalAttemptToRestoreViewStateTimeout);this._finalAttemptToRestoreViewStateTimeout=undefined;}}} _createEmptyContentPlaceholderIfNeeded(treeOutline) {let emptyContentPlaceholderElement=this._emptyContentPlaceholderElements.get(treeOutline);if(emptyContentPlaceholderElement) return emptyContentPlaceholderElement;emptyContentPlaceholderElement=document.createElement("div");emptyContentPlaceholderElement.classList.add(WebInspector.NavigationSidebarPanel.EmptyContentPlaceholderElementStyleClassName);this._emptyContentPlaceholderElements.set(treeOutline,emptyContentPlaceholderElement);let emptyContentPlaceholderMessageElement=document.createElement("div");emptyContentPlaceholderMessageElement.className=WebInspector.NavigationSidebarPanel.EmptyContentPlaceholderMessageElementStyleClassName;emptyContentPlaceholderElement.appendChild(emptyContentPlaceholderMessageElement);return emptyContentPlaceholderElement;} _treeElementWasFiltered(treeElement) {if(treeElement.selected||treeElement.hidden) return;let representedObject=this.currentRepresentedObject;if(!representedObject||treeElement.representedObject!==representedObject) return;const omitFocus=true;const selectedByUser=false;const suppressOnSelect=true;const suppressOnDeselect=true;treeElement.revealAndSelect(omitFocus,selectedByUser,suppressOnSelect,suppressOnDeselect);}};WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol=Symbol("suppress-filtering");WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol=Symbol("was-expanded-during-filtering");WebInspector.NavigationSidebarPanel.OverflowShadowElementStyleClassName="overflow-shadow";WebInspector.NavigationSidebarPanel.ContentTreeOutlineElementStyleClassName="navigation-sidebar-panel-content-tree-outline";WebInspector.NavigationSidebarPanel.EmptyContentPlaceholderElementStyleClassName="empty-content-placeholder";WebInspector.NavigationSidebarPanel.EmptyContentPlaceholderMessageElementStyleClassName="message";WebInspector.PinnedTabBarItem=class PinnedTabBarItem extends WebInspector.TabBarItem {constructor(image,title,representedObject) {super(image,title,representedObject);this.element.classList.add("pinned");this.element.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this));} _handleContextMenuEvent(event) {event.preventDefault();let contextMenu=WebInspector.ContextMenu.createFromEvent(event);this.dispatchEventToListeners(WebInspector.PinnedTabBarItem.Event.ContextMenu,{contextMenu});}};WebInspector.PinnedTabBarItem.Event={ContextMenu:"pinned-tab-bar-item-context-menu",};WebInspector.ResourceContentView=class ResourceContentView extends WebInspector.ContentView {constructor(resource,styleClassName) {super(resource);this._resource=resource;this.element.classList.add(styleClassName,"resource");this._spinnerTimeout=setTimeout(()=>{ let spinner=new WebInspector.IndeterminateProgressSpinner;this.element.appendChild(spinner.element);this._spinnerTimeout=undefined;},100);this.element.addEventListener("click",this._mouseWasClicked.bind(this),false);resource.requestContent().then(this._contentAvailable.bind(this)).catch(this.showGenericErrorMessage.bind(this));if(!this.managesOwnIssues){WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded,this._issueWasAdded,this);var issues=WebInspector.issueManager.issuesForSourceCode(resource);for(var i=0;iWebInspector.instanceForClass(constructor));return this._detailsSidebarPanels;} get detailsSidebarCollapsedSetting(){return this._detailsSidebarCollapsedSetting;} get detailsSidebarSelectedPanelSetting(){return this._detailsSidebarSelectedPanelSetting;} get detailsSidebarWidthSetting(){return this._detailsSidebarWidthSetting;}};WebInspector.TimelineDataGrid=class TimelineDataGrid extends WebInspector.DataGrid {constructor(columns,treeOutline,synchronizerDelegate,editCallback,deleteCallback) {super(columns,editCallback,deleteCallback);if(treeOutline) this._treeOutlineDataGridSynchronizer=new WebInspector.TreeOutlineDataGridSynchronizer(treeOutline,this,synchronizerDelegate);this.element.classList.add("timeline");this._sortDelegate=null;this._scopeBarColumns=[];for(var[identifier,column]of this.columns){var scopeBar=column.scopeBar;if(!scopeBar) continue;this._scopeBarColumns.push(identifier);scopeBar.columnIdentifier=identifier;scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged,this._scopeBarSelectedItemsDidChange,this);} if(this._scopeBarColumns.length>1){console.error("Creating a TimelineDataGrid with more than one filterable column is not yet supported.");return;} this.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged,this._dataGridSelectedNodeChanged,this);this.addEventListener(WebInspector.DataGrid.Event.SortChanged,this._sort,this);this.columnChooserEnabled=true;} static createColumnScopeBar(prefix,map) {prefix=prefix+"-timeline-data-grid-";var scopeBarItems=[];for(var[key,value]of map){var id=prefix+key;var item=new WebInspector.ScopeBarItem(id,value);item.value=key;scopeBarItems.push(item);} var allItem=new WebInspector.ScopeBarItem(prefix+"type-all",WebInspector.UIString("All"));scopeBarItems.unshift(allItem);return new WebInspector.ScopeBar(prefix+"scope-bar",scopeBarItems,allItem,true);} get sortDelegate() {return this._sortDelegate;} set sortDelegate(delegate) {delegate=delegate||null;if(this._sortDelegate===delegate) return;this._sortDelegate=delegate;if(this.sortOrder!==WebInspector.DataGrid.SortOrder.Indeterminate) this.dispatchEventToListeners(WebInspector.DataGrid.Event.SortChanged);} reset() {if(!this._treeOutlineDataGridSynchronizer) this.removeChildren();this._hidePopover();} shown() {if(this._treeOutlineDataGridSynchronizer) this._treeOutlineDataGridSynchronizer.synchronize();} hidden() {this._hidePopover();} treeElementForDataGridNode(dataGridNode) {if(!this._treeOutlineDataGridSynchronizer) return null;return this._treeOutlineDataGridSynchronizer.treeElementForDataGridNode(dataGridNode);} dataGridNodeForTreeElement(treeElement) {if(!this._treeOutlineDataGridSynchronizer) return null;return this._treeOutlineDataGridSynchronizer.dataGridNodeForTreeElement(treeElement);} callFramePopoverAnchorElement() {return null;} addRowInSortOrder(treeElement,dataGridNode,parentTreeElementOrDataGridNode) {let parentDataGridNode;let childElement=dataGridNode;if(treeElement){if(!this._treeOutlineDataGridSynchronizer) return;this._treeOutlineDataGridSynchronizer.associate(treeElement,dataGridNode);let parentTreeElement=parentTreeElementOrDataGridNode||this._treeOutlineDataGridSynchronizer.treeOutline;parentDataGridNode=parentTreeElement.root?this:this._treeOutlineDataGridSynchronizer.dataGridNodeForTreeElement(parentTreeElement);parentTreeElementOrDataGridNode=parentTreeElement;childElement=treeElement;}else{parentTreeElementOrDataGridNode=parentTreeElementOrDataGridNode||this;parentDataGridNode=parentTreeElementOrDataGridNode;} if(this.sortColumnIdentifier){let insertionIndex=insertionIndexForObjectInListSortedByFunction(dataGridNode,parentDataGridNode.children,this._sortComparator.bind(this));parentTreeElementOrDataGridNode.insertChild(childElement,insertionIndex);}else{parentTreeElementOrDataGridNode.appendChild(childElement);}} shouldIgnoreSelectionEvent() {return this._ignoreSelectionEvent||false;} dataGridNodeNeedsRefresh(dataGridNode) {if(!this._dirtyDataGridNodes) this._dirtyDataGridNodes=new Set;this._dirtyDataGridNodes.add(dataGridNode);if(this._scheduledDataGridNodeRefreshIdentifier) return;this._scheduledDataGridNodeRefreshIdentifier=requestAnimationFrame(this._refreshDirtyDataGridNodes.bind(this));} hasCustomFilters() {return true;} matchNodeAgainstCustomFilters(node) {if(!super.matchNodeAgainstCustomFilters(node)) return false;for(let identifier of this._scopeBarColumns){let scopeBar=this.columns.get(identifier).scopeBar;if(!scopeBar||scopeBar.defaultItem.selected) continue;let value=node.data[identifier];if(!scopeBar.selectedItems.some((scopeBarItem)=>scopeBarItem.value===value)) return false;} return true;} _refreshDirtyDataGridNodes() {if(this._scheduledDataGridNodeRefreshIdentifier){cancelAnimationFrame(this._scheduledDataGridNodeRefreshIdentifier);this._scheduledDataGridNodeRefreshIdentifier=undefined;} if(!this._dirtyDataGridNodes) return;let selectedNode=this.selectedNode;let sortComparator=this._sortComparator.bind(this);if(this._treeOutlineDataGridSynchronizer) this._treeOutlineDataGridSynchronizer.enabled=false;for(let dataGridNode of this._dirtyDataGridNodes){dataGridNode.refresh();if(!this.sortColumnIdentifier) continue;if(dataGridNode===selectedNode) this._ignoreSelectionEvent=true;if(dataGridNode.parent===this) this.removeChild(dataGridNode);let insertionIndex=insertionIndexForObjectInListSortedByFunction(dataGridNode,this.children,sortComparator);this.insertChild(dataGridNode,insertionIndex);if(dataGridNode===selectedNode){selectedNode.revealAndSelect();this._ignoreSelectionEvent=false;} if(!this._treeOutlineDataGridSynchronizer) continue;let treeOutline=this._treeOutlineDataGridSynchronizer.treeOutline;let treeElement=this._treeOutlineDataGridSynchronizer.treeElementForDataGridNode(dataGridNode);treeOutline.reattachIfIndexChanged(treeElement,insertionIndex);dataGridNode.element.classList.toggle("hidden",treeElement.hidden);} if(this._treeOutlineDataGridSynchronizer) this._treeOutlineDataGridSynchronizer.enabled=true;this._dirtyDataGridNodes=null;} _sort() {if(!this.children.length) return;let sortColumnIdentifier=this.sortColumnIdentifier;if(!sortColumnIdentifier) return;let selectedNode=this.selectedNode;this._ignoreSelectionEvent=true;let treeOutline;if(this._treeOutlineDataGridSynchronizer){this._treeOutlineDataGridSynchronizer.enabled=false;treeOutline=this._treeOutlineDataGridSynchronizer.treeOutline;if(treeOutline.selectedTreeElement) treeOutline.selectedTreeElement.deselect(true);} let parentDataGridNodes=[this];let currentDataGridNode=this.children[0];while(currentDataGridNode){if(currentDataGridNode.children.length) parentDataGridNodes.push(currentDataGridNode);currentDataGridNode=currentDataGridNode.traverseNextNode(false,null,true);} for(let parentDataGridNode of parentDataGridNodes){let childDataGridNodes=parentDataGridNode.children.slice();parentDataGridNode.removeChildren();let parentTreeElement;if(this._treeOutlineDataGridSynchronizer){parentTreeElement=parentDataGridNode===this?treeOutline:this._treeOutlineDataGridSynchronizer.treeElementForDataGridNode(parentDataGridNode);parentTreeElement.removeChildren();} childDataGridNodes.sort(this._sortComparator.bind(this));for(let dataGridNode of childDataGridNodes){if(this._treeOutlineDataGridSynchronizer){let treeElement=this._treeOutlineDataGridSynchronizer.treeElementForDataGridNode(dataGridNode);if(parentTreeElement) parentTreeElement.appendChild(treeElement);dataGridNode.element.classList.toggle("hidden",treeElement.hidden);} parentDataGridNode.appendChild(dataGridNode);}} if(this._treeOutlineDataGridSynchronizer) this._treeOutlineDataGridSynchronizer.enabled=true;if(selectedNode) selectedNode.revealAndSelect();this._ignoreSelectionEvent=false;} _sortComparator(node1,node2) {var sortColumnIdentifier=this.sortColumnIdentifier;if(!sortColumnIdentifier) return 0;var sortDirection=this.sortOrder===WebInspector.DataGrid.SortOrder.Ascending?1:-1;if(this._sortDelegate&&typeof this._sortDelegate.dataGridSortComparator==="function"){let result=this._sortDelegate.dataGridSortComparator(sortColumnIdentifier,sortDirection,node1,node2);if(typeof result==="number") return result;} var value1=node1.data[sortColumnIdentifier];var value2=node2.data[sortColumnIdentifier];if(typeof value1==="number"&&typeof value2==="number"){if(isNaN(value1)&&isNaN(value2)) return 0;if(isNaN(value1)) return-sortDirection;if(isNaN(value2)) return sortDirection;return(value1-value2)*sortDirection;} if(typeof value1==="string"&&typeof value2==="string") return value1.extendedLocaleCompare(value2)*sortDirection;if(value1 instanceof WebInspector.CallFrame||value2 instanceof WebInspector.CallFrame){value1=value1&&value1.functionName?value1.functionName:(value1&&value1.sourceCodeLocation?value1.sourceCodeLocation.sourceCode:"");value2=value2&&value2.functionName?value2.functionName:(value2&&value2.sourceCodeLocation?value2.sourceCodeLocation.sourceCode:"");} if(value1 instanceof WebInspector.SourceCode||value2 instanceof WebInspector.SourceCode){value1=value1?value1.displayName||"":"";value2=value2?value2.displayName||"":"";} if(value1 instanceof WebInspector.SourceCodeLocation||value2 instanceof WebInspector.SourceCodeLocation){value1=value1?value1.displayLocationString()||"":"";value2=value2?value2.displayLocationString()||"":"";} return(value1value2?1:0))*sortDirection;} _scopeBarSelectedItemsDidChange(event) {this.filterDidChange();} _dataGridSelectedNodeChanged(event) {if(!this.selectedNode){this._hidePopover();return;} var record=this.selectedNode.record;if(!record||!record.callFrames||!record.callFrames.length){this._hidePopover();return;} this._showPopoverForSelectedNodeSoon();} _showPopoverForSelectedNodeSoon() {if(this._showPopoverTimeout) return;this._showPopoverTimeout=setTimeout(()=>{if(!this._popover){this._popover=new WebInspector.Popover;this._popover.windowResizeHandler=()=>{this._updatePopoverForSelectedNode(false);};} this._updatePopoverForSelectedNode(true);this._showPopoverTimeout=undefined;},WebInspector.TimelineDataGrid.DelayedPopoverShowTimeout);} _hidePopover() {if(this._showPopoverTimeout){clearTimeout(this._showPopoverTimeout);this._showPopoverTimeout=undefined;} if(this._popover) this._popover.dismiss();if(this._hidePopoverContentClearTimeout) clearTimeout(this._hidePopoverContentClearTimeout);this._hidePopoverContentClearTimeout=setTimeout(()=>{if(this._popoverCallStackTreeOutline) this._popoverCallStackTreeOutline.removeChildren();},WebInspector.TimelineDataGrid.DelayedPopoverHideContentClearTimeout);} _updatePopoverForSelectedNode(updateContent) {if(!this._popover||!this.selectedNode) return;let targetPopoverElement=this.callFramePopoverAnchorElement();if(!targetPopoverElement) return;let rect=WebInspector.Rect.rectFromClientRect(targetPopoverElement.getBoundingClientRect());if(!rect.size.width&&!rect.size.height) return;if(this._hidePopoverContentClearTimeout){clearTimeout(this._hidePopoverContentClearTimeout);this._hidePopoverContentClearTimeout=undefined;} let targetFrame=rect.pad(2);let preferredEdges=[WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MIN_Y,WebInspector.RectEdge.MAX_X];if(updateContent) this._popover.presentNewContentWithFrame(this._createPopoverContent(),targetFrame,preferredEdges);else this._popover.present(targetFrame,preferredEdges);} _createPopoverContent() {if(!this._popoverCallStackTreeOutline){this._popoverCallStackTreeOutline=new WebInspector.TreeOutline;this._popoverCallStackTreeOutline.disclosureButtons=false;this._popoverCallStackTreeOutline.element.classList.add("timeline-data-grid");this._popoverCallStackTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._popoverCallStackTreeSelectionDidChange,this);}else this._popoverCallStackTreeOutline.removeChildren();var callFrames=this.selectedNode.record.callFrames;for(var i=0;ithis.graphDataSource.currentTime||record.startTime>this.graphDataSource.endTime) return false;return true;} filterableDataForColumn(columnIdentifier) {let value=this.data[columnIdentifier];if(value instanceof WebInspector.SourceCodeLocation) return value.displayLocationString();if(value instanceof WebInspector.CallFrame) return[value.functionName,value.sourceCodeLocation.displayLocationString()];return super.filterableDataForColumn(columnIdentifier);} didAddRecordBar(recordBar) {} didRemoveRecordBar(recordBar) {} didResizeColumn(columnIdentifier) {if(columnIdentifier!=="graph") return;this.needsGraphRefresh();}};WebInspector.ContentBrowserTabContentView=class ContentBrowserTabContentView extends WebInspector.TabContentView {constructor(identifier,styleClassNames,tabBarItem,navigationSidebarPanelConstructor,detailsSidebarPanelConstructors,disableBackForward) {if(typeof styleClassNames==="string") styleClassNames=[styleClassNames];styleClassNames.push("content-browser");var contentBrowser=new WebInspector.ContentBrowser(null,null,disableBackForward);super(identifier,styleClassNames,tabBarItem,navigationSidebarPanelConstructor,detailsSidebarPanelConstructors);this._contentBrowser=contentBrowser;this._contentBrowser.delegate=this;this._lastSelectedDetailsSidebarPanelSetting=new WebInspector.Setting(identifier+"-last-selected-details-sidebar-panel",null);this._contentBrowser.addEventListener(WebInspector.ContentBrowser.Event.CurrentRepresentedObjectsDidChange,this.showDetailsSidebarPanels,this);this._contentBrowser.addEventListener(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange,this._contentBrowserCurrentContentViewDidChange,this);this._contentBrowser.updateHierarchicalPathForCurrentContentView();if(navigationSidebarPanelConstructor){let showToolTip=WebInspector.UIString("Show the navigation sidebar (%s)").format(WebInspector.navigationSidebarKeyboardShortcut.displayName);let hideToolTip=WebInspector.UIString("Hide the navigation sidebar (%s)").format(WebInspector.navigationSidebarKeyboardShortcut.displayName);let image=WebInspector.resolvedLayoutDirection()==WebInspector.LayoutDirection.RTL?"Images/ToggleRightSidebar.svg":"Images/ToggleLeftSidebar.svg";this._showNavigationSidebarItem=new WebInspector.ActivateButtonNavigationItem("toggle-navigation-sidebar",showToolTip,hideToolTip,image,16,16);this._showNavigationSidebarItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,WebInspector.toggleNavigationSidebar,WebInspector);this._showNavigationSidebarItem.activated=!WebInspector.navigationSidebar.collapsed;this._contentBrowser.navigationBar.insertNavigationItem(this._showNavigationSidebarItem,0);this._contentBrowser.navigationBar.insertNavigationItem(new WebInspector.DividerNavigationItem,1);WebInspector.navigationSidebar.addEventListener(WebInspector.Sidebar.Event.CollapsedStateDidChange,this._navigationSidebarCollapsedStateDidChange,this);} if(detailsSidebarPanelConstructors&&detailsSidebarPanelConstructors.length){let showToolTip=WebInspector.UIString("Show the details sidebar (%s)").format(WebInspector.detailsSidebarKeyboardShortcut.displayName);let hideToolTip=WebInspector.UIString("Hide the details sidebar (%s)").format(WebInspector.detailsSidebarKeyboardShortcut.displayName);let image=WebInspector.resolvedLayoutDirection()==WebInspector.LayoutDirection.RTL?"Images/ToggleLeftSidebar.svg":"Images/ToggleRightSidebar.svg";this._showDetailsSidebarItem=new WebInspector.ActivateButtonNavigationItem("toggle-details-sidebar",showToolTip,hideToolTip,image,16,16);this._showDetailsSidebarItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,WebInspector.toggleDetailsSidebar,WebInspector);this._showDetailsSidebarItem.activated=!WebInspector.detailsSidebar.collapsed;this._showDetailsSidebarItem.enabled=false;this._contentBrowser.navigationBar.addNavigationItem(new WebInspector.DividerNavigationItem);this._contentBrowser.navigationBar.addNavigationItem(this._showDetailsSidebarItem);WebInspector.detailsSidebar.addEventListener(WebInspector.Sidebar.Event.CollapsedStateDidChange,this._detailsSidebarCollapsedStateDidChange,this);WebInspector.detailsSidebar.addEventListener(WebInspector.Sidebar.Event.SidebarPanelSelected,this._detailsSidebarPanelSelected,this);} this.addSubview(this._contentBrowser);} get contentBrowser() {return this._contentBrowser;} shown() {if(this.navigationSidebarPanel){if(!this.navigationSidebarPanel.contentBrowser) this.navigationSidebarPanel.contentBrowser=this._contentBrowser;} super.shown();this._contentBrowser.shown();if(this.navigationSidebarPanel){if(!this._contentBrowser.currentContentView) this.navigationSidebarPanel.showDefaultContentView();}} hidden() {super.hidden();this._contentBrowser.hidden();} closed() {super.closed();WebInspector.navigationSidebar.removeEventListener(null,null,this);WebInspector.detailsSidebar.removeEventListener(null,null,this);if(this.navigationSidebarPanel&&typeof this.navigationSidebarPanel.closed==="function") this.navigationSidebarPanel.closed();this._contentBrowser.contentViewContainer.closeAllContentViews();} get managesDetailsSidebarPanels() {return true;} showDetailsSidebarPanels() {if(!this.visible) return;var currentRepresentedObjects=this._contentBrowser.currentRepresentedObjects;var currentSidebarPanels=WebInspector.detailsSidebar.sidebarPanels;var wasSidebarEmpty=!currentSidebarPanels.length; this._ignoreDetailsSidebarPanelSelectedEvent=true;this._ignoreDetailsSidebarPanelCollapsedEvent=true;let hiddenSidebarPanels=0;for(var i=0;i=WebInspector.FolderizedTreeElement.LargeChildCountThreshold){if(numberOfSmallCategories||numberOfMediumCategories) return true;foundLargeCategory=true;return false;} if(childCount>=WebInspector.FolderizedTreeElement.MediumChildCountThreshold){return++numberOfMediumCategories>=WebInspector.FolderizedTreeElement.NumberOfMediumCategoriesThreshold;} ++numberOfSmallCategories;return false;} for(var settings of this._folderizeSettingsMap.values()){if(pushCategory(settings.representedObject.items.size)) return true;} return false;}};WebInspector.FolderizedTreeElement.MediumChildCountThreshold=5;WebInspector.FolderizedTreeElement.LargeChildCountThreshold=15;WebInspector.FolderizedTreeElement.NumberOfMediumCategoriesThreshold=2;WebInspector.FolderizedTreeElement.NewChildQueueUpdateInterval=500;WebInspector.NetworkTabContentView=class NetworkTabContentView extends WebInspector.ContentBrowserTabContentView {constructor(identifier) {let{image,title}=WebInspector.NetworkTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);let detailsSidebarPanelConstructors=[WebInspector.ResourceDetailsSidebarPanel,WebInspector.ProbeDetailsSidebarPanel];super(identifier||"network","network",tabBarItem,WebInspector.NetworkSidebarPanel,detailsSidebarPanelConstructors);} static tabInfo() {return{image:"Images/Network.svg",title:WebInspector.UIString("Network"),};} static isTabAllowed() {return!!window.NetworkAgent&&!!window.PageAgent;} get type() {return WebInspector.NetworkTabContentView.Type;} canShowRepresentedObject(representedObject) {if(!(representedObject instanceof WebInspector.Resource)) return false;return!!this.navigationSidebarPanel.contentTreeOutline.getCachedTreeElement(representedObject);} get supportsSplitContentBrowser() { return false;}};WebInspector.NetworkTabContentView.Type="network";WebInspector.NewTabContentView=class NewTabContentView extends WebInspector.TabContentView {constructor(identifier) {let{image,title}=WebInspector.NewTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);tabBarItem.isDefaultTab=true;super(identifier||"new-tab","new-tab",tabBarItem);WebInspector.notifications.addEventListener(WebInspector.Notification.TabTypesChanged,this._updateShownTabs.bind(this));this._tabElementsByTabClass=new Map;this._updateShownTabs();} static tabInfo() {return{image:"Images/NewTab.svg",title:WebInspector.UIString("New Tab"),};} static isEphemeral() {return true;} static shouldSaveTab() {return false;} get type() {return WebInspector.NewTabContentView.Type;} shown() {WebInspector.tabBrowser.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemAdded,this._updateTabItems,this);WebInspector.tabBrowser.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemRemoved,this._updateTabItems,this);this._updateTabItems();} hidden() {WebInspector.tabBrowser.tabBar.removeEventListener(null,null,this);} get supportsSplitContentBrowser() { return false;} layout() {this._tabElementsByTabClass.clear();this.element.removeChildren();for(let tabClass of this._shownTabClasses){let tabItemElement=document.createElement("div");tabItemElement.classList.add("tab-item");tabItemElement.addEventListener("click",this._createNewTabWithType.bind(this,tabClass.Type));tabItemElement[WebInspector.NewTabContentView.TypeSymbol]=tabClass.Type;let boxElement=tabItemElement.appendChild(document.createElement("div"));boxElement.classList.add("box");let info=tabClass.tabInfo();let imageElement=boxElement.appendChild(document.createElement("img"));imageElement.src=info.image;let labelElement=tabItemElement.appendChild(document.createElement("label"));labelElement.textContent=info.title;this.element.appendChild(tabItemElement);this._tabElementsByTabClass.set(tabClass,tabItemElement);} this._updateTabItems();} _createNewTabWithType(tabType,event) {if(!WebInspector.isNewTabWithTypeAllowed(tabType)) return;const canCreateAdditionalTabs=this._allowableTabTypes().length>1;const options={referencedView:this,shouldReplaceTab:!canCreateAdditionalTabs||!WebInspector.modifierKeys.metaKey,shouldShowNewTab:!WebInspector.modifierKeys.metaKey};WebInspector.createNewTabWithType(tabType,options);} _updateShownTabs() {let allTabClasses=Array.from(WebInspector.knownTabClasses());let allowedTabClasses=allTabClasses.filter((tabClass)=>tabClass.isTabAllowed()&&!tabClass.isEphemeral());allowedTabClasses.sort((a,b)=>a.tabInfo().title.extendedLocaleCompare(b.tabInfo().title));if(Array.shallowEqual(this._shownTabClasses,allowedTabClasses)) return;this._shownTabClasses=allowedTabClasses;this.needsLayout();} _allowableTabTypes() {let tabTypes=this._shownTabClasses.map((tabClass)=>tabClass.Type);return tabTypes.filter((type)=>WebInspector.isNewTabWithTypeAllowed(type));} _updateTabItems() {for(let[tabClass,tabItemElement]of this._tabElementsByTabClass.entries()){let allowed=WebInspector.isNewTabWithTypeAllowed(tabClass.Type);tabItemElement.classList.toggle(WebInspector.NewTabContentView.DisabledStyleClassName,!allowed);}}};WebInspector.NewTabContentView.Type="new-tab";WebInspector.NewTabContentView.TypeSymbol=Symbol("type");WebInspector.NewTabContentView.TabItemStyleClassName="tab-item";WebInspector.NewTabContentView.DisabledStyleClassName="disabled";WebInspector.ObjectTreeBaseTreeElement=class ObjectTreeBaseTreeElement extends WebInspector.GeneralTreeElement {constructor(representedObject,propertyPath,property) {super(null,null,null,representedObject,false);this._property=property;this._propertyPath=propertyPath;this.toggleOnClick=true;this.selectable=false;this.tooltipHandledSeparately=true;} get property() {return this._property;} get propertyPath() {return this._propertyPath;} resolvedValue() {if(this._getterValue) return this._getterValue;if(this._property.hasValue()) return this._property.value;return null;} resolvedValuePropertyPath() {if(this._getterValue) return this._propertyPath.appendPropertyDescriptor(this._getterValue,this._property,WebInspector.PropertyPath.Type.Value);if(this._property.hasValue()) return this._propertyPath.appendPropertyDescriptor(this._property.value,this._property,WebInspector.PropertyPath.Type.Value);return null;} thisPropertyPath() {return this._propertyPath.appendPropertyDescriptor(null,this._property,this.propertyPathType());} hadError() {return this._property.wasThrown||this._getterHadError;} propertyPathType() {if(this._getterValue||this._property.hasValue()) return WebInspector.PropertyPath.Type.Value;if(this._property.hasGetter()) return WebInspector.PropertyPath.Type.Getter;if(this._property.hasSetter()) return WebInspector.PropertyPath.Type.Setter;return WebInspector.PropertyPath.Type.Value;} propertyPathString(propertyPath) {if(propertyPath.isFullPathImpossible()) return WebInspector.UIString("Unable to determine path to property from root");return propertyPath.displayPath(this.propertyPathType());} createGetterElement(interactive) {var getterElement=document.createElement("img");getterElement.className="getter";if(!interactive){getterElement.classList.add("disabled");getterElement.title=WebInspector.UIString("Getter");return getterElement;} getterElement.title=WebInspector.UIString("Invoke getter");getterElement.addEventListener("click",(event)=>{event.stopPropagation();var lastNonPrototypeObject=this._propertyPath.lastNonPrototypeObject;var getterObject=this._property.get;lastNonPrototypeObject.invokeGetter(getterObject,(error,result,wasThrown)=>{this._getterHadError=!!(error||wasThrown);this._getterValue=result;if(this.invokedGetter&&typeof this.invokedGetter==="function") this.invokedGetter();});});return getterElement;} createSetterElement(interactive) {var setterElement=document.createElement("img");setterElement.className="setter";setterElement.title=WebInspector.UIString("Setter");if(!interactive) setterElement.classList.add("disabled");return setterElement;} populateContextMenu(contextMenu,event) {if(event.__addedObjectPreviewContextMenuItems) return;if(event.__addedObjectTreeContextMenuItems) return;event.__addedObjectTreeContextMenuItems=true;if(typeof this.treeOutline.objectTreeElementAddContextMenuItems==="function"){this.treeOutline.objectTreeElementAddContextMenuItems(this,contextMenu);if(!contextMenu.isEmpty()) contextMenu.appendSeparator();} let resolvedValue=this.resolvedValue();if(!resolvedValue) return;if(this._property&&this._property.symbol) contextMenu.appendItem(WebInspector.UIString("Log Symbol"),this._logSymbolProperty.bind(this));contextMenu.appendItem(WebInspector.UIString("Log Value"),this._logValue.bind(this));let propertyPath=this.resolvedValuePropertyPath();if(propertyPath&&!propertyPath.isFullPathImpossible()){contextMenu.appendItem(WebInspector.UIString("Copy Path to Property"),()=>{InspectorFrontendHost.copyText(propertyPath.displayPath(WebInspector.PropertyPath.Type.Value));});} contextMenu.appendSeparator();this._appendMenusItemsForObject(contextMenu,resolvedValue);super.populateContextMenu(contextMenu,event);} _logSymbolProperty() {var symbol=this._property.symbol;if(!symbol) return;var text=WebInspector.UIString("Selected Symbol");WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text,symbol,true);} _logValue(value) {var resolvedValue=value||this.resolvedValue();if(!resolvedValue) return;var propertyPath=this.resolvedValuePropertyPath();var isImpossible=propertyPath.isFullPathImpossible();var text=isImpossible?WebInspector.UIString("Selected Value"):propertyPath.displayPath(this.propertyPathType());if(!isImpossible) WebInspector.quickConsole.prompt.pushHistoryItem(text);WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text,resolvedValue,isImpossible);} _appendMenusItemsForObject(contextMenu,resolvedValue) {if(resolvedValue.type==="function"){if(!isFunctionStringNativeCode(resolvedValue.description)){contextMenu.appendItem(WebInspector.UIString("Jump to Definition"),function(){resolvedValue.target.DebuggerAgent.getFunctionDetails(resolvedValue.objectId,function(error,response){if(error) return;let location=response.location;let sourceCode=WebInspector.debuggerManager.scriptForIdentifier(location.scriptId,resolvedValue.target);if(!sourceCode) return;let sourceCodeLocation=sourceCode.createSourceCodeLocation(location.lineNumber,location.columnNumber||0);const options={ignoreNetworkTab:true,ignoreSearchTab:true,};WebInspector.showSourceCodeLocation(sourceCodeLocation,options);});});} return;} if(resolvedValue.subtype==="node"){contextMenu.appendItem(WebInspector.UIString("Copy as HTML"),function(){resolvedValue.pushNodeToFrontend(function(nodeId){WebInspector.domTreeManager.nodeForId(nodeId).copyNode();});});contextMenu.appendItem(WebInspector.UIString("Scroll Into View"),function(){function scrollIntoView(){this.scrollIntoViewIfNeeded(true);} resolvedValue.callFunction(scrollIntoView,undefined,false,function(){});});contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Reveal in DOM Tree"),function(){resolvedValue.pushNodeToFrontend(function(nodeId){WebInspector.domTreeManager.inspectElement(nodeId);});});return;}}};WebInspector.SourceCodeTreeElement=class SourceCodeTreeElement extends WebInspector.FolderizedTreeElement {constructor(sourceCode,classNames,title,subtitle,representedObject,hasChildren) {super(classNames,title,subtitle,representedObject||sourceCode,hasChildren);this._updateSourceCode(sourceCode);} updateSourceMapResources() {if(!this.treeOutline||!this.treeOutline.includeSourceMapResourceChildren) return;this.hasChildren=!!this._sourceCode.sourceMaps.length;this.shouldRefreshChildren=this.hasChildren;if(!this.hasChildren) this.removeChildren();} onattach() {super.onattach();this.updateSourceMapResources();} onpopulate() {if(!this.treeOutline||!this.treeOutline.includeSourceMapResourceChildren) return;if(!this.hasChildren||!this.shouldRefreshChildren) return;this.shouldRefreshChildren=false;this.removeChildren();function combineFolderChain(topFolder,bottomFolder) {var components=[];for(var currentFolder=bottomFolder;currentFolder!==topFolder;currentFolder=currentFolder.parent) components.push(currentFolder.mainTitle);components.push(topFolder.mainTitle);var folderName=components.reverse().join("/");var newFolder=new WebInspector.FolderTreeElement(folderName);var folderIndex=topFolder.parent.children.indexOf(topFolder);topFolder.parent.insertChild(newFolder,folderIndex);topFolder.parent.removeChild(topFolder);var children=bottomFolder.children;bottomFolder.removeChildren();for(var i=0;i=Math.abs(event.deltaY)*0.5){let newWheelEvent=new event.constructor(event.type,event);newWheelEvent.__cloned=true;this._scrollContainerElement.dispatchEvent(newWheelEvent);return;} let mouseOffset=event.pageX-this._graphsContainerView.element.totalOffsetLeft;let mousePositionTime=this._currentSettings.scrollStartTime+(mouseOffset*this.secondsPerPixel);let deviceDirection=event.webkitDirectionInvertedFromDevice?1:-1;let delta=event.deltaY*(this.secondsPerPixel/WebInspector.TimelineOverview.ScrollDeltaDenominator)*deviceDirection;if(this._pixelAlignDuration&&(delta<0&&this._mouseWheelDelta>=0||delta>=0&&this._mouseWheelDelta<0)) this._mouseWheelDelta=0;let previousDurationPerPixel=this.secondsPerPixel;this._mouseWheelDelta+=delta;this.secondsPerPixel+=this._mouseWheelDelta;if(this.secondsPerPixel===this._currentSettings.minimumDurationPerPixel&&delta<0||this.secondsPerPixel===this._currentSettings.maximumDurationPerPixel&&delta>=0) this._mouseWheelDelta=0;else this._mouseWheelDelta=previousDurationPerPixel+this._mouseWheelDelta-this.secondsPerPixel;this.scrollStartTime=mousePositionTime-(mouseOffset*this.secondsPerPixel);event.preventDefault();event.stopPropagation();} _handleGestureStart(event) {if(this._handlingGesture){ return;} let mouseOffset=event.pageX-this._graphsContainerView.element.totalOffsetLeft;let mousePositionTime=this._currentSettings.scrollStartTime+(mouseOffset*this.secondsPerPixel);this._handlingGesture=true;this._gestureStartStartTime=mousePositionTime;this._gestureStartDurationPerPixel=this.secondsPerPixel;event.preventDefault();event.stopPropagation();} _handleGestureChange(event) {let scale=Math.max(1/5,event.scale);let mouseOffset=event.pageX-this._graphsContainerView.element.totalOffsetLeft;let newSecondsPerPixel=this._gestureStartDurationPerPixel/scale;this.secondsPerPixel=newSecondsPerPixel;this.scrollStartTime=this._gestureStartStartTime-(mouseOffset*this.secondsPerPixel);event.preventDefault();event.stopPropagation();} _handleGestureEnd(event) {this._handlingGesture=false;this._gestureStartStartTime=NaN;this._gestureStartDurationPerPixel=NaN;} _instrumentAdded(instrumentOrEvent) {let instrument=instrumentOrEvent instanceof WebInspector.Instrument?instrumentOrEvent:instrumentOrEvent.data.instrument;let timeline=this._recording.timelineForInstrument(instrument);let treeElement=new WebInspector.TimelineTreeElement(timeline);let insertionIndex=insertionIndexForObjectInListSortedByFunction(treeElement,this._timelinesTreeOutline.children,this._compareTimelineTreeElements.bind(this));this._timelinesTreeOutline.insertChild(treeElement,insertionIndex);this._treeElementsByTypeMap.set(timeline.type,treeElement);let overviewGraph=WebInspector.TimelineOverviewGraph.createForTimeline(timeline,this);overviewGraph.addEventListener(WebInspector.TimelineOverviewGraph.Event.RecordSelected,this._recordSelected,this);this._overviewGraphsByTypeMap.set(timeline.type,overviewGraph);this._graphsContainerView.insertSubviewBefore(overviewGraph,this._graphsContainerView.subviews[insertionIndex]);treeElement.element.style.height=overviewGraph.height+"px";if(!this._canShowTimelineType(timeline.type)){overviewGraph.hidden();treeElement.hidden=true;}} _instrumentRemoved(event) {let instrument=event.data.instrument;let timeline=this._recording.timelineForInstrument(instrument);let overviewGraph=this._overviewGraphsByTypeMap.get(timeline.type);let treeElement=this._treeElementsByTypeMap.get(timeline.type);let shouldSuppressOnDeselect=false;let shouldSuppressSelectSibling=true;this._timelinesTreeOutline.removeChild(treeElement,shouldSuppressOnDeselect,shouldSuppressSelectSibling);overviewGraph.removeEventListener(WebInspector.TimelineOverviewGraph.Event.RecordSelected,this._recordSelected,this);this._graphsContainerView.removeSubview(overviewGraph);this._overviewGraphsByTypeMap.delete(timeline.type);this._treeElementsByTypeMap.delete(timeline.type);} _markerAdded(event) {this._timelineRuler.addMarker(event.data.marker);} _timelineRulerMouseDown(event) {this._timelineRulerSelectionChanged=false;} _timelineRulerMouseClicked(event) {if(this._timelineRulerSelectionChanged) return;for(let overviewGraph of this._overviewGraphsByTypeMap.values()){let graphRect=overviewGraph.element.getBoundingClientRect();if(!(event.pageX>=graphRect.left&&event.pageX<=graphRect.right&&event.pageY>=graphRect.top&&event.pageY<=graphRect.bottom)) continue;let newClickEvent=new event.constructor(event.type,event);overviewGraph.element.dispatchEvent(newClickEvent);return;}} _timeRangeSelectionChanged(event) {this._timelineRulerSelectionChanged=true;let startTime=this._viewMode===WebInspector.TimelineOverview.ViewMode.Timelines?this._startTime:0;this._currentSettings.selectionStartValueSetting.value=this.selectionStartTime-startTime;this._currentSettings.selectionDurationSetting.value=this.selectionDuration;this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.TimeRangeSelectionChanged);} _recordSelected(event) {for(let[type,overviewGraph]of this._overviewGraphsByTypeMap){if(overviewGraph!==event.target) continue;let timeline=this._recording.timelines.get(type);this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.RecordSelected,{timeline,record:event.data.record});return;}} _resetSelection() {function reset(settings) {settings.durationPerPixelSetting.reset();settings.selectionStartValueSetting.reset();settings.selectionDurationSetting.reset();} reset(this._timelinesViewModeSettings);if(this._renderingFramesViewModeSettings) reset(this._renderingFramesViewModeSettings);this.secondsPerPixel=this._currentSettings.durationPerPixelSetting.value;this.selectionStartTime=this._currentSettings.selectionStartValueSetting.value;this.selectionDuration=this._currentSettings.selectionDurationSetting.value;} _recordingReset(event) {this._timelineRuler.clearMarkers();this._timelineRuler.addMarker(this._currentTimeMarker);} _canShowTimelineType(type) {let timelineViewMode=WebInspector.TimelineOverview.ViewMode.Timelines;if(type===WebInspector.TimelineRecord.Type.RenderingFrame) timelineViewMode=WebInspector.TimelineOverview.ViewMode.RenderingFrames;return timelineViewMode===this._viewMode;} _viewModeDidChange() {let startTime=0;let isRenderingFramesMode=this._viewMode===WebInspector.TimelineOverview.ViewMode.RenderingFrames;if(isRenderingFramesMode){this._timelineRuler.minimumSelectionDuration=1;this._timelineRuler.snapInterval=1;this._timelineRuler.formatLabelCallback=(value)=>value.maxDecimals(0).toLocaleString();}else{this._timelineRuler.minimumSelectionDuration=0.01;this._timelineRuler.snapInterval=NaN;this._timelineRuler.formatLabelCallback=null;startTime=this._startTime;} this.pixelAlignDuration=isRenderingFramesMode;this.selectionStartTime=this._currentSettings.selectionStartValueSetting.value+startTime;this.selectionDuration=this._currentSettings.selectionDurationSetting.value;for(let[type,overviewGraph]of this._overviewGraphsByTypeMap){let treeElement=this._treeElementsByTypeMap.get(type);treeElement.hidden=!this._canShowTimelineType(type);if(treeElement.hidden) overviewGraph.hidden();else overviewGraph.shown();} this.element.classList.toggle("frames",isRenderingFramesMode);this.updateLayout(WebInspector.View.LayoutReason.Resize);} _createViewModeSettings(viewMode,minimumDurationPerPixel,maximumDurationPerPixel,durationPerPixel,selectionStartValue,selectionDuration) {durationPerPixel=Math.min(maximumDurationPerPixel,Math.max(minimumDurationPerPixel,durationPerPixel));let durationPerPixelSetting=new WebInspector.Setting(viewMode+"-duration-per-pixel",durationPerPixel);let selectionStartValueSetting=new WebInspector.Setting(viewMode+"-selection-start-value",selectionStartValue);let selectionDurationSetting=new WebInspector.Setting(viewMode+"-selection-duration",selectionDuration);return{scrollStartTime:0,minimumDurationPerPixel,maximumDurationPerPixel,durationPerPixelSetting,selectionStartValueSetting,selectionDurationSetting};} get _currentSettings() {return this._viewMode===WebInspector.TimelineOverview.ViewMode.Timelines?this._timelinesViewModeSettings:this._renderingFramesViewModeSettings;} _timelinesTreeSelectionDidChange(event) {function updateGraphSelectedState(timeline,selected) {let overviewGraph=this._overviewGraphsByTypeMap.get(timeline.type);overviewGraph.selected=selected;} let selectedTreeElement=event.data.selectedElement;let deselectedTreeElement=event.data.deselectedElement;let timeline=null;if(selectedTreeElement){timeline=selectedTreeElement.representedObject;updateGraphSelectedState.call(this,timeline,true);} if(deselectedTreeElement) updateGraphSelectedState.call(this,deselectedTreeElement.representedObject,false);this._selectedTimeline=timeline;this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.TimelineSelected);} _toggleEditingInstruments(event) {if(this._editingInstruments) this._stopEditingInstruments();else this._startEditingInstruments();} _editingInstrumentsDidChange() {this.element.classList.toggle(WebInspector.TimelineOverview.EditInstrumentsStyleClassName,this._editingInstruments);this._timelineRuler.enabled=!this._editingInstruments;this._updateWheelAndGestureHandlers();this._updateEditInstrumentsButton();this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.EditingInstrumentsDidChange);} _updateEditInstrumentsButton() {let newLabel=this._editingInstruments?WebInspector.UIString("Done"):WebInspector.UIString("Edit");this._editInstrumentsButton.label=newLabel;this._editInstrumentsButton.activated=this._editingInstruments;this._editInstrumentsButton.enabled=!WebInspector.timelineManager.isCapturing();} _updateWheelAndGestureHandlers() {if(this._editingInstruments){this.element.removeEventListener("wheel",this._handleWheelEventListener);this.element.removeEventListener("gesturestart",this._handleGestureStartEventListener);this.element.removeEventListener("gesturechange",this._handleGestureChangeEventListener);this.element.removeEventListener("gestureend",this._handleGestureEndEventListener);this._handleWheelEventListener=null;this._handleGestureStartEventListener=null;this._handleGestureChangeEventListener=null;this._handleGestureEndEventListener=null;}else{this._handleWheelEventListener=this._handleWheelEvent.bind(this);this._handleGestureStartEventListener=this._handleGestureStart.bind(this);this._handleGestureChangeEventListener=this._handleGestureChange.bind(this);this._handleGestureEndEventListener=this._handleGestureEnd.bind(this);this.element.addEventListener("wheel",this._handleWheelEventListener);this.element.addEventListener("gesturestart",this._handleGestureStartEventListener);this.element.addEventListener("gesturechange",this._handleGestureChangeEventListener);this.element.addEventListener("gestureend",this._handleGestureEndEventListener);}} _startEditingInstruments() {if(this._editingInstruments) return;this._editingInstruments=true;for(let type of this._instrumentTypes){let treeElement=this._treeElementsByTypeMap.get(type);if(!treeElement){let timeline=this._recording.timelines.get(type);const placeholder=true;treeElement=new WebInspector.TimelineTreeElement(timeline,placeholder);let insertionIndex=insertionIndexForObjectInListSortedByFunction(treeElement,this._timelinesTreeOutline.children,this._compareTimelineTreeElements.bind(this));this._timelinesTreeOutline.insertChild(treeElement,insertionIndex);let placeholderGraph=new WebInspector.View;placeholderGraph.element.classList.add("timeline-overview-graph");treeElement[WebInspector.TimelineOverview.PlaceholderOverviewGraph]=placeholderGraph;this._graphsContainerView.insertSubviewBefore(placeholderGraph,this._graphsContainerView.subviews[insertionIndex]);} treeElement.editing=true;treeElement.addEventListener(WebInspector.TimelineTreeElement.Event.EnabledDidChange,this._timelineTreeElementEnabledDidChange,this);} this._editingInstrumentsDidChange();} _stopEditingInstruments() {if(!this._editingInstruments) return;this._editingInstruments=false;let instruments=this._recording.instruments;for(let treeElement of this._treeElementsByTypeMap.values()){if(treeElement.status.checked){treeElement.editing=false;treeElement.removeEventListener(WebInspector.TimelineTreeElement.Event.EnabledDidChange,this._timelineTreeElementEnabledDidChange,this);continue;} let timelineInstrument=instruments.find((instrument)=>instrument.timelineRecordType===treeElement.representedObject.type);this._recording.removeInstrument(timelineInstrument);} let placeholderTreeElements=this._timelinesTreeOutline.children.filter((treeElement)=>treeElement.placeholder);for(let treeElement of placeholderTreeElements){this._timelinesTreeOutline.removeChild(treeElement);let placeholderGraph=treeElement[WebInspector.TimelineOverview.PlaceholderOverviewGraph];this._graphsContainerView.removeSubview(placeholderGraph);if(treeElement.status.checked){let instrument=WebInspector.Instrument.createForTimelineType(treeElement.representedObject.type);this._recording.addInstrument(instrument);}} let instrumentTypes=instruments.map((instrument)=>instrument.timelineRecordType);WebInspector.timelineManager.enabledTimelineTypes=instrumentTypes;this._editingInstrumentsDidChange();} _capturingStarted() {this._editInstrumentsButton.enabled=false;this._stopEditingInstruments();} _capturingStopped() {this._editInstrumentsButton.enabled=true;} _compareTimelineTreeElements(a,b) {let aTimelineType=a.representedObject.type;let bTimelineType=b.representedObject.type;if(aTimelineType===WebInspector.TimelineRecord.Type.RenderingFrame) return 1;if(bTimelineType===WebInspector.TimelineRecord.Type.RenderingFrame) return-1;if(a.placeholder!==b.placeholder) return a.placeholder?1:-1;let aTimelineIndex=this._instrumentTypes.indexOf(aTimelineType);let bTimelineIndex=this._instrumentTypes.indexOf(bTimelineType);return aTimelineIndex-bTimelineIndex;} _timelineTreeElementEnabledDidChange(event) {let enabled=this._timelinesTreeOutline.children.some((treeElement)=>{let timelineType=treeElement.representedObject.type;return this._canShowTimelineType(timelineType)&&treeElement.status.checked;});this._editInstrumentsButton.enabled=enabled;}};WebInspector.TimelineOverview.PlaceholderOverviewGraph=Symbol("placeholder-overview-graph");WebInspector.TimelineOverview.ScrollDeltaDenominator=500;WebInspector.TimelineOverview.EditInstrumentsStyleClassName="edit-instruments";WebInspector.TimelineOverview.MinimumDurationPerPixel=0.0001;WebInspector.TimelineOverview.MaximumDurationPerPixel=60;WebInspector.TimelineOverview.ViewMode={Timelines:"timeline-overview-view-mode-timelines",RenderingFrames:"timeline-overview-view-mode-rendering-frames"};WebInspector.TimelineOverview.Event={EditingInstrumentsDidChange:"editing-instruments-did-change",RecordSelected:"timeline-overview-record-selected",TimelineSelected:"timeline-overview-timeline-selected",TimeRangeSelectionChanged:"timeline-overview-time-range-selection-changed"};WebInspector.TimelineRecordTreeElement=class TimelineRecordTreeElement extends WebInspector.GeneralTreeElement {constructor(timelineRecord,subtitleNameStyle,includeDetailsInMainTitle,sourceCodeLocation,representedObject) {sourceCodeLocation=sourceCodeLocation||timelineRecord.sourceCodeLocation||null;let alternateSubtitle=null;if(includeDetailsInMainTitle&&timelineRecord.type===WebInspector.TimelineRecord.Type.Script&&timelineRecord.eventType===WebInspector.ScriptTimelineRecord.EventType.TimerInstalled){let timeoutString=Number.secondsToString(timelineRecord.details.timeout/1000);alternateSubtitle=document.createElement("span");alternateSubtitle.classList.add("alternate-subtitle");if(timelineRecord.details.repeating) alternateSubtitle.textContent=WebInspector.UIString("%s interval").format(timeoutString);else alternateSubtitle.textContent=WebInspector.UIString("%s delay").format(timeoutString);} let subtitle=null;if(sourceCodeLocation){subtitle=document.createElement("span");if(subtitleNameStyle!==WebInspector.SourceCodeLocation.NameStyle.None) sourceCodeLocation.populateLiveDisplayLocationString(subtitle,"textContent",null,subtitleNameStyle);else sourceCodeLocation.populateLiveDisplayLocationString(subtitle,"textContent",null,WebInspector.SourceCodeLocation.NameStyle.None,WebInspector.UIString("line "));} let iconStyleClass=WebInspector.TimelineTabContentView.iconClassNameForRecord(timelineRecord);let title=WebInspector.TimelineTabContentView.displayNameForRecord(timelineRecord);super([iconStyleClass],title,subtitle,representedObject||timelineRecord,false);this._record=timelineRecord;this._sourceCodeLocation=sourceCodeLocation;if(this._sourceCodeLocation) this.tooltipHandledSeparately=true;if(alternateSubtitle) this.titlesElement.appendChild(alternateSubtitle);} get record() {return this._record;} get filterableData() {var url=this._sourceCodeLocation?this._sourceCodeLocation.sourceCode.url:"";return{text:[this.mainTitle,url||"",this._record.details||""]};} get sourceCodeLocation() {return this._sourceCodeLocation;} onattach() {super.onattach();if(!this.tooltipHandledSeparately) return;var tooltipPrefix=this.mainTitle+"\n";this._sourceCodeLocation.populateLiveDisplayLocationTooltip(this.element,tooltipPrefix);}};WebInspector.TimelineRecordTreeElement.StyleRecordIconStyleClass="style-record";WebInspector.TimelineRecordTreeElement.LayoutRecordIconStyleClass="layout-record";WebInspector.TimelineRecordTreeElement.PaintRecordIconStyleClass="paint-record";WebInspector.TimelineRecordTreeElement.CompositeRecordIconStyleClass="composite-record";WebInspector.TimelineRecordTreeElement.RenderingFrameRecordIconStyleClass="rendering-frame-record";WebInspector.TimelineRecordTreeElement.APIRecordIconStyleClass="api-record";WebInspector.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass="evaluated-record";WebInspector.TimelineRecordTreeElement.EventRecordIconStyleClass="event-record";WebInspector.TimelineRecordTreeElement.TimerRecordIconStyleClass="timer-record";WebInspector.TimelineRecordTreeElement.AnimationRecordIconStyleClass="animation-record";WebInspector.TimelineRecordTreeElement.ProbeRecordIconStyleClass="probe-record";WebInspector.TimelineRecordTreeElement.ConsoleProfileIconStyleClass="console-profile-record";WebInspector.TimelineRecordTreeElement.GarbageCollectionIconStyleClass="garbage-collection-profile-record";WebInspector.TimelineTreeElement=class TimelineTreeElement extends WebInspector.GeneralTreeElement {constructor(timeline,placeholder) {let displayName=WebInspector.TimelineTabContentView.displayNameForTimelineType(timeline.type);let iconClassName=WebInspector.TimelineTabContentView.iconClassNameForTimelineType(timeline.type);let genericClassName=WebInspector.TimelineTabContentView.genericClassNameForTimelineType(timeline.type);super([iconClassName,genericClassName],displayName,"",timeline);this._placeholder=placeholder||false;this.editing=this._placeholder;} get placeholder() {return this._placeholder;} get editing() {return this._editing;} set editing(x) {if(this._editing===x) return;this._editing=x;this.selectable=!this._editing;this._updateStatusButton();} onattach() {super.onattach();this.listItemElement.addEventListener("click",this._clickHandler.bind(this));} _showCloseButton() {let tooltip=WebInspector.UIString("Close %s timeline view").format(this.mainTitle);let button=new WebInspector.TreeElementStatusButton(useSVGSymbol("Images/CloseLarge.svg","close-button",tooltip));button.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked,()=>{this.deselect();});this.status=button.element;} _showCheckbox() {let checkboxElement=document.createElement("input");checkboxElement.type="checkbox";checkboxElement.checked=!this._placeholder;let button=new WebInspector.TreeElementStatusButton(checkboxElement);checkboxElement.addEventListener("change",()=>{this._dispatchEnabledDidChangeEvent();});this.status=checkboxElement;} _updateStatusButton() {if(this._editing) this._showCheckbox();else this._showCloseButton();} _clickHandler() {if(!this._editing) return;this.status.checked=!this.status.checked;this._dispatchEnabledDidChangeEvent();} _dispatchEnabledDidChangeEvent() {this.dispatchEventToListeners(WebInspector.TimelineTreeElement.Event.EnabledDidChange);}};WebInspector.TimelineTreeElement.Event={EnabledDidChange:"timeline-tree-element-enabled-did-change"};WebInspector.ConsoleTabContentView=class ConsoleTabContentView extends WebInspector.ContentBrowserTabContentView {constructor(identifier) {let{image,title}=WebInspector.ConsoleTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);super(identifier||"console","console",tabBarItem,null,null,true);} static tabInfo() {return{image:"Images/Console.svg",title:WebInspector.UIString("Console"),};} get type() {return WebInspector.ConsoleTabContentView.Type;} shown() {super.shown();WebInspector.consoleContentView.prompt.focus();if(this.contentBrowser.currentContentView===WebInspector.consoleContentView) return; if(WebInspector.consoleContentView.parentContainer) WebInspector.consoleContentView.parentContainer.closeContentView(WebInspector.consoleContentView);this.contentBrowser.showContentView(WebInspector.consoleContentView);} showRepresentedObject(representedObject,cookie) { } canShowRepresentedObject(representedObject) {return representedObject instanceof WebInspector.LogObject;} get supportsSplitContentBrowser() {return false;}};WebInspector.ConsoleTabContentView.Type="console";WebInspector.DebuggerTabContentView=class DebuggerTabContentView extends WebInspector.ContentBrowserTabContentView {constructor(identifier) {let{image,title}=WebInspector.DebuggerTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);let detailsSidebarPanelConstructors=[WebInspector.ScopeChainDetailsSidebarPanel,WebInspector.ResourceDetailsSidebarPanel,WebInspector.ProbeDetailsSidebarPanel];super(identifier||"debugger","debugger",tabBarItem,WebInspector.DebuggerSidebarPanel,detailsSidebarPanelConstructors);} static tabInfo() {return{image:"Images/Debugger.svg",title:WebInspector.UIString("Debugger"),};} get type() {return WebInspector.DebuggerTabContentView.Type;} get supportsSplitContentBrowser() {return true;} canShowRepresentedObject(representedObject) {if(representedObject instanceof WebInspector.Script) return true;if(!(representedObject instanceof WebInspector.Resource)) return false;return representedObject.type===WebInspector.Resource.Type.Document||representedObject.type===WebInspector.Resource.Type.Script;} showDetailsSidebarPanels() {super.showDetailsSidebarPanels();if(!this._showScopeChainDetailsSidebarPanel) return;let scopeChainDetailsSidebarPanel=WebInspector.instanceForClass(WebInspector.ScopeChainDetailsSidebarPanel);if(!scopeChainDetailsSidebarPanel.parentSidebar) return;scopeChainDetailsSidebarPanel.show();this._showScopeChainDetailsSidebarPanel=false;} showScopeChainDetailsSidebarPanel() {this._showScopeChainDetailsSidebarPanel=true;} revealAndSelectBreakpoint(breakpoint) {var treeElement=this.navigationSidebarPanel.treeElementForRepresentedObject(breakpoint);if(treeElement) treeElement.revealAndSelect();}};WebInspector.DebuggerTabContentView.Type="debugger";WebInspector.ElementsTabContentView=class ElementsTabContentView extends WebInspector.ContentBrowserTabContentView {constructor(identifier) {let{image,title}=WebInspector.ElementsTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);let detailsSidebarPanelConstructors=[WebInspector.DOMNodeDetailsSidebarPanel,WebInspector.CSSStyleDetailsSidebarPanel];if(window.LayerTreeAgent) detailsSidebarPanelConstructors.push(WebInspector.LayerTreeDetailsSidebarPanel);super(identifier||"elements","elements",tabBarItem,null,detailsSidebarPanelConstructors,true);WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange,this._mainFrameDidChange,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);} static tabInfo() {return{image:"Images/Elements.svg",title:WebInspector.UIString("Elements"),};} static isTabAllowed() {return!!window.DOMAgent;} get type() {return WebInspector.ElementsTabContentView.Type;} get supportsSplitContentBrowser() {return true;} canShowRepresentedObject(representedObject) {return representedObject instanceof WebInspector.DOMTree;} showRepresentedObject(representedObject,cookie) {if(!this.contentBrowser.currentContentView) this._showDOMTreeContentView();if(!cookie||!cookie.nodeToSelect) return;let domTreeContentView=this.contentBrowser.currentContentView;domTreeContentView.selectAndRevealDOMNode(cookie.nodeToSelect); cookie.nodeToSelect=undefined;} shown() {super.shown();if(!this.contentBrowser.currentContentView) this._showDOMTreeContentView();} closed() {super.closed();WebInspector.frameResourceManager.removeEventListener(null,null,this);WebInspector.Frame.removeEventListener(null,null,this);} _showDOMTreeContentView() {this.contentBrowser.contentViewContainer.closeAllContentViews();var mainFrame=WebInspector.frameResourceManager.mainFrame;if(mainFrame) this.contentBrowser.showContentViewForRepresentedObject(mainFrame.domTree);} _mainFrameDidChange(event) {this._showDOMTreeContentView();} _mainResourceDidChange(event) {if(!event.target.isMainFrame()) return;this._showDOMTreeContentView();}};WebInspector.ElementsTabContentView.Type="elements";WebInspector.ResourceTreeElement=class ResourceTreeElement extends WebInspector.SourceCodeTreeElement {constructor(resource,representedObject) {super(resource,["resource",WebInspector.ResourceTreeElement.ResourceIconStyleClassName,resource.type],"","",representedObject||resource,false);this._updateResource(resource);} static compareResourceTreeElements(a,b) {var comparisonResult=a.resource.type.extendedLocaleCompare(b.resource.type);if(comparisonResult!==0) return comparisonResult;if(a.resource.type===WebInspector.Resource.Type.XHR||a.resource.type===WebInspector.Resource.Type.Fetch||a.resource.type===WebInspector.Resource.Type.WebSocket) return a.resource.firstTimestamp-b.resource.firstTimestamp||0; comparisonResult=a.subtitle.extendedLocaleCompare(b.subtitle);if(comparisonResult!==0) return comparisonResult;return a.mainTitle.extendedLocaleCompare(b.mainTitle);} static compareFolderAndResourceTreeElements(a,b) {var aIsFolder=a instanceof WebInspector.FolderTreeElement;var bIsFolder=b instanceof WebInspector.FolderTreeElement;if(aIsFolder&&!bIsFolder) return-1;if(!aIsFolder&&bIsFolder) return 1;if(aIsFolder&&bIsFolder) return a.mainTitle.extendedLocaleCompare(b.mainTitle);return WebInspector.ResourceTreeElement.compareResourceTreeElements(a,b);} get resource() {return this._resource;} get filterableData() {let urlComponents=this._resource.urlComponents;return{text:[urlComponents.lastPathComponent,urlComponents.path,this._resource.url]};} ondblclick() {if(this._resource.type===WebInspector.Resource.Type.WebSocket) return;InspectorFrontendHost.openInNewTab(this._resource.url);} _updateResource(resource) { if(this._resource){this._resource.removeEventListener(WebInspector.Resource.Event.URLDidChange,this._urlDidChange,this);this._resource.removeEventListener(WebInspector.Resource.Event.TypeDidChange,this._typeDidChange,this);this._resource.removeEventListener(WebInspector.Resource.Event.LoadingDidFinish,this._updateStatus,this);this._resource.removeEventListener(WebInspector.Resource.Event.LoadingDidFail,this._updateStatus,this);} this._updateSourceCode(resource);this._resource=resource;resource.addEventListener(WebInspector.Resource.Event.URLDidChange,this._urlDidChange,this);resource.addEventListener(WebInspector.Resource.Event.TypeDidChange,this._typeDidChange,this);resource.addEventListener(WebInspector.Resource.Event.LoadingDidFinish,this._updateStatus,this);resource.addEventListener(WebInspector.Resource.Event.LoadingDidFail,this._updateStatus,this);this._updateTitles();this._updateStatus();this._updateToolTip();} _updateTitles() {var frame=this._resource.parentFrame;var target=this._resource.target;var isMainResource=this._resource.isMainResource();var parentResourceHost=target.mainResource?target.mainResource.urlComponents.host:null;if(isMainResource&&frame){parentResourceHost=frame.parentFrame?frame.parentFrame.mainResource.urlComponents.host:null;}else if(frame){parentResourceHost=frame.mainResource.urlComponents.host;} var urlComponents=this._resource.urlComponents;var oldMainTitle=this.mainTitle;this.mainTitle=WebInspector.displayNameForURL(this._resource.url,urlComponents);var subtitle=parentResourceHost!==urlComponents.host||frame&&frame.isMainFrame()&&isMainResource?WebInspector.displayNameForHost(urlComponents.host):null;this.subtitle=this.mainTitle!==subtitle?subtitle:null;if(oldMainTitle!==this.mainTitle) this.callFirstAncestorFunction("descendantResourceTreeElementMainTitleDidChange",[this,oldMainTitle]);} populateContextMenu(contextMenu,event) {WebInspector.appendContextMenuItemsForSourceCode(contextMenu,this._resource);super.populateContextMenu(contextMenu,event);} _updateStatus() {if(this._resource.hadLoadingError()) this.addClassName(WebInspector.ResourceTreeElement.FailedStyleClassName);else this.removeClassName(WebInspector.ResourceTreeElement.FailedStyleClassName);if(this._resource.finished||this._resource.failed){if(this.status&&this.status[WebInspector.ResourceTreeElement.SpinnerSymbol]) this.status="";}else{let spinner=new WebInspector.IndeterminateProgressSpinner;this.status=spinner.element;this.status[WebInspector.ResourceTreeElement.SpinnerSymbol]=true;}} _updateToolTip() {this.tooltip=this._resource.displayURL;} _urlDidChange(event) {this._updateTitles();this._updateToolTip();} _typeDidChange(event) {this.removeClassName(event.data.oldType);this.addClassName(this._resource.type);this.callFirstAncestorFunction("descendantResourceTreeElementTypeDidChange",[this,event.data.oldType]);}};WebInspector.ResourceTreeElement.ResourceIconStyleClassName="resource-icon";WebInspector.ResourceTreeElement.FailedStyleClassName="failed";WebInspector.ResourceTreeElement.SpinnerSymbol=Symbol("spinner");WebInspector.ResourcesTabContentView=class ResourcesTabContentView extends WebInspector.ContentBrowserTabContentView {constructor(identifier) {let{image,title}=WebInspector.ResourcesTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);let detailsSidebarPanelConstructors=[WebInspector.ResourceDetailsSidebarPanel,WebInspector.ProbeDetailsSidebarPanel];if(window.CanvasAgent&&WebInspector.settings.experimentalShowCanvasContextsInResources.value) detailsSidebarPanelConstructors.push(WebInspector.CanvasDetailsSidebarPanel);detailsSidebarPanelConstructors=detailsSidebarPanelConstructors.concat([WebInspector.DOMNodeDetailsSidebarPanel,WebInspector.CSSStyleDetailsSidebarPanel]);if(window.LayerTreeAgent) detailsSidebarPanelConstructors.push(WebInspector.LayerTreeDetailsSidebarPanel);super(identifier||"resources","resources",tabBarItem,WebInspector.ResourceSidebarPanel,detailsSidebarPanelConstructors);} static tabInfo() {return{image:"Images/Resources.svg",title:WebInspector.UIString("Resources"),};} get type() {return WebInspector.ResourcesTabContentView.Type;} get supportsSplitContentBrowser() {return true;} canShowRepresentedObject(representedObject) {return representedObject instanceof WebInspector.Frame||representedObject instanceof WebInspector.Resource||representedObject instanceof WebInspector.Script||representedObject instanceof WebInspector.CSSStyleSheet||representedObject instanceof WebInspector.ContentFlow||representedObject instanceof WebInspector.Canvas||representedObject instanceof WebInspector.Collection;}};WebInspector.ResourcesTabContentView.Type="resources";WebInspector.SearchTabContentView=class SearchTabContentView extends WebInspector.ContentBrowserTabContentView {constructor(identifier) {let{image,title}=WebInspector.SearchTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);let detailsSidebarPanelConstructors=[WebInspector.ResourceDetailsSidebarPanel,WebInspector.ProbeDetailsSidebarPanel,WebInspector.DOMNodeDetailsSidebarPanel,WebInspector.CSSStyleDetailsSidebarPanel];if(window.LayerTreeAgent) detailsSidebarPanelConstructors.push(WebInspector.LayerTreeDetailsSidebarPanel);super(identifier||"search","search",tabBarItem,WebInspector.SearchSidebarPanel,detailsSidebarPanelConstructors);this._forcePerformSearch=false;} static tabInfo() {return{image:"Images/SearchResults.svg",title:WebInspector.UIString("Search"),};} static isEphemeral() {return true;} get type() {return WebInspector.SearchTabContentView.Type;} shown() {super.shown();setTimeout(this.focusSearchField.bind(this));} canShowRepresentedObject(representedObject) {if(!(representedObject instanceof WebInspector.Resource)&&!(representedObject instanceof WebInspector.Script)&&!(representedObject instanceof WebInspector.DOMTree)) return false;return!!this.navigationSidebarPanel.contentTreeOutline.getCachedTreeElement(representedObject);} focusSearchField() {this.navigationSidebarPanel.focusSearchField(this._forcePerformSearch);this._forcePerformSearch=false;} performSearch(searchQuery) {this.navigationSidebarPanel.performSearch(searchQuery);this._forcePerformSearch=false;} handleCopyEvent(event) {let selectedTreeElement=this.navigationSidebarPanel.contentTreeOutline.selectedTreeElement;if(!selectedTreeElement) return;event.clipboardData.setData("text/plain",selectedTreeElement.synthesizedTextValue);event.stopPropagation();event.preventDefault();} initialLayout() {super.initialLayout();this._forcePerformSearch=true;}};WebInspector.SearchTabContentView.Type="search";WebInspector.SettingsTabContentView=class SettingsTabContentView extends WebInspector.TabContentView {constructor(identifier) {let tabBarItem=new WebInspector.PinnedTabBarItem("Images/Gear.svg",WebInspector.UIString("Open Settings"));super(identifier||"settings","settings",tabBarItem);tabBarItem.representedObject=this;this._selectedSettingsView=null;this._settingsViews=[];} static tabInfo() {return{image:"Images/Gear.svg",title:WebInspector.UIString("Settings"),};} static isEphemeral() {return true;} static shouldSaveTab() {return false;} get type(){return WebInspector.SettingsTabContentView.Type;} get selectedSettingsView() {return this._selectedSettingsView;} set selectedSettingsView(settingsView) {if(this._selectedSettingsView===settingsView) return;if(this._selectedSettingsView) this.replaceSubview(this._selectedSettingsView,settingsView);else this.addSubview(settingsView);this._selectedSettingsView=settingsView;this._selectedSettingsView.updateLayout();let navigationItem=this._navigationBar.findNavigationItem(settingsView.identifier);console.assert(navigationItem,"Missing navigation item for settings view.",settingsView) if(!navigationItem) return;this._navigationBar.selectedNavigationItem=navigationItem;} addSettingsView(settingsView) {if(this._settingsViews.includes(settingsView)){return;} this._settingsViews.push(settingsView);this._navigationBar.addNavigationItem(new WebInspector.RadioButtonNavigationItem(settingsView.identifier,settingsView.displayName));this._updateNavigationBarVisibility();} setSettingsViewVisible(settingsView,visible) {let navigationItem=this._navigationBar.findNavigationItem(settingsView.identifier);if(!navigationItem) return;if(navigationItem.hidden===!visible) return;navigationItem.hidden=!visible;settingsView.element.classList.toggle("hidden",!visible);this._updateNavigationBarVisibility();if(!this.selectedSettingsView){if(visible) this.selectedSettingsView=settingsView;return;} if(this.selectedSettingsView!==settingsView) return;let index=this._settingsViews.indexOf(settingsView);console.assert(index!==-1,"SettingsView not found.",settingsView) if(index===-1) return;let previousIndex=index;while(--previousIndex>=0){let previousNavigationItem=this._navigationBar.navigationItems[previousIndex];if(!previousNavigationItem||previousNavigationItem.hidden) continue;this.selectedSettingsView=this._settingsViews[previousIndex];return;} let nextIndex=index;while(++nextIndex{WebInspector.settings.indentWithTabs.value=indentEditor.value===indentValues[0];});const widthLabel=WebInspector.UIString("spaces");const widthOptions={min:1};generalSettingsView.addSetting(WebInspector.UIString("Tab width:"),WebInspector.settings.tabSize,widthLabel,widthOptions);generalSettingsView.addSetting(WebInspector.UIString("Indent width:"),WebInspector.settings.indentUnit,widthLabel,widthOptions);generalSettingsView.addSetting(WebInspector.UIString("Line wrapping:"),WebInspector.settings.enableLineWrapping,WebInspector.UIString("Wrap lines to editor width"));let showGroup=generalSettingsView.addGroup(WebInspector.UIString("Show:"));showGroup.addSetting(WebInspector.settings.showWhitespaceCharacters,WebInspector.UIString("Whitespace characters"));showGroup.addSetting(WebInspector.settings.showInvalidCharacters,WebInspector.UIString("Invalid characters"));generalSettingsView.addSeparator();let stylesEditingGroup=generalSettingsView.addGroup(WebInspector.UIString("Styles Editing:"));stylesEditingGroup.addSetting(WebInspector.settings.stylesShowInlineWarnings,WebInspector.UIString("Show inline warnings"));stylesEditingGroup.addSetting(WebInspector.settings.stylesInsertNewline,WebInspector.UIString("Automatically insert newline"));stylesEditingGroup.addSetting(WebInspector.settings.stylesSelectOnFirstClick,WebInspector.UIString("Select text on first click"));generalSettingsView.addSeparator();generalSettingsView.addSetting(WebInspector.UIString("Network:"),WebInspector.settings.clearNetworkOnNavigate,WebInspector.UIString("Clear when page navigates"));generalSettingsView.addSeparator();generalSettingsView.addSetting(WebInspector.UIString("Console:"),WebInspector.settings.clearLogOnNavigate,WebInspector.UIString("Clear when page navigates"));generalSettingsView.addSeparator();generalSettingsView.addSetting(WebInspector.UIString("Debugger:"),WebInspector.settings.showScopeChainOnPause,WebInspector.UIString("Show Scope Chain on pause"));generalSettingsView.addSeparator();const zoomLevels=[0.6,0.8,1,1.2,1.4,1.6,1.8,2,2.2,2.4];const zoomValues=zoomLevels.map((level)=>[level,Number.percentageString(level,0)]);let zoomEditor=generalSettingsView.addGroupWithCustomSetting(WebInspector.UIString("Zoom:"),WebInspector.SettingEditor.Type.Select,{values:zoomValues});zoomEditor.value=WebInspector.getZoomFactor();zoomEditor.addEventListener(WebInspector.SettingEditor.Event.ValueDidChange,()=>{WebInspector.setZoomFactor(zoomEditor.value);});WebInspector.settings.zoomFactor.addEventListener(WebInspector.Setting.Event.Changed,()=>{zoomEditor.value=WebInspector.getZoomFactor().maxDecimals(2);});this.addSettingsView(generalSettingsView);} _createDebugSettingsView() {if(this._debugSettingsView) return;this._debugSettingsView=new WebInspector.SettingsView("debug",WebInspector.unlocalizedString("Debug"));let protocolMessagesGroup=this._debugSettingsView.addGroup(WebInspector.unlocalizedString("Protocol Logging:"));let autoLogProtocolMessagesEditor=protocolMessagesGroup.addSetting(WebInspector.settings.autoLogProtocolMessages,WebInspector.unlocalizedString("Messages"));WebInspector.settings.autoLogProtocolMessages.addEventListener(WebInspector.Setting.Event.Changed,()=>{autoLogProtocolMessagesEditor.value=InspectorBackend.dumpInspectorProtocolMessages;});protocolMessagesGroup.addSetting(WebInspector.settings.autoLogTimeStats,WebInspector.unlocalizedString("Time Stats"));this._debugSettingsView.addSeparator();this._debugSettingsView.addSetting(WebInspector.unlocalizedString("Uncaught Exception Reporter:"),WebInspector.settings.enableUncaughtExceptionReporter,WebInspector.unlocalizedString("Enabled"));this._debugSettingsView.addSeparator();const layoutDirectionValues=[[WebInspector.LayoutDirection.System,WebInspector.unlocalizedString("System Default")],[WebInspector.LayoutDirection.LTR,WebInspector.unlocalizedString("Left to Right (LTR)")],[WebInspector.LayoutDirection.RTL,WebInspector.unlocalizedString("Right to Left (RTL)")],];let layoutDirectionEditor=this._debugSettingsView.addGroupWithCustomSetting(WebInspector.unlocalizedString("Layout Direction:"),WebInspector.SettingEditor.Type.Select,{values:layoutDirectionValues});layoutDirectionEditor.value=WebInspector.settings.layoutDirection.value;layoutDirectionEditor.addEventListener(WebInspector.SettingEditor.Event.ValueDidChange,()=>{WebInspector.setLayoutDirection(layoutDirectionEditor.value);});if(window.CanvasAgent){this._debugSettingsView.addSeparator();this._debugSettingsView.addSetting(WebInspector.UIString("Canvas:"),WebInspector.settings.experimentalShowCanvasContextsInResources,WebInspector.UIString("Show Contexts in Resources Tab"));} this.addSettingsView(this._debugSettingsView);} _updateNavigationBarVisibility() {let visibleItems=0;for(let item of this._navigationBar.navigationItems){if(!item.hidden&&++visibleItems>1){this._navigationBar.element.classList.remove("invisible");return;}} this._navigationBar.element.classList.add("invisible");} _navigationItemSelected(event) {let navigationItem=event.target.selectedNavigationItem;if(!navigationItem) return;let settingsView=this._settingsViews.find((view)=>view.identifier===navigationItem.identifier);if(!settingsView) return;this.selectedSettingsView=settingsView;} _updateDebugSettingsViewVisibility() {if(WebInspector.isDebugUIEnabled()) this._createDebugSettingsView();if(!this._debugSettingsView) return;this.setSettingsViewVisible(this._debugSettingsView,WebInspector.isDebugUIEnabled());this.needsLayout();}};WebInspector.SettingsTabContentView.Type="settings";WebInspector.StorageTabContentView=class StorageTabContentView extends WebInspector.ContentBrowserTabContentView {constructor(identifier) {let{image,title}=WebInspector.StorageTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);let detailsSidebarPanelConstructors=[WebInspector.ApplicationCacheDetailsSidebarPanel,WebInspector.IndexedDatabaseDetailsSidebarPanel];super(identifier||"storage","storage",tabBarItem,WebInspector.StorageSidebarPanel,detailsSidebarPanelConstructors);} static tabInfo() {return{image:"Images/Storage.svg",title:WebInspector.UIString("Storage"),};} static isTabAllowed() {return!!window.DOMStorageAgent||!!window.DatabaseAgent||!!window.IndexedDBAgent;} get type() {return WebInspector.StorageTabContentView.Type;} get supportsSplitContentBrowser() {return true;} canShowRepresentedObject(representedObject) {return representedObject instanceof WebInspector.DOMStorageObject||representedObject instanceof WebInspector.CookieStorageObject||representedObject instanceof WebInspector.DatabaseTableObject||representedObject instanceof WebInspector.DatabaseObject||representedObject instanceof WebInspector.ApplicationCacheFrame||representedObject instanceof WebInspector.IndexedDatabaseObjectStore||representedObject instanceof WebInspector.IndexedDatabase||representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex;}};WebInspector.StorageTabContentView.Type="storage";WebInspector.TimelineTabContentView=class TimelineTabContentView extends WebInspector.ContentBrowserTabContentView {constructor(identifier) {let{image,title}=WebInspector.TimelineTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);let detailsSidebarPanelConstructors=[WebInspector.ResourceDetailsSidebarPanel,WebInspector.ProbeDetailsSidebarPanel];super(identifier||"timeline","timeline",tabBarItem,null,detailsSidebarPanelConstructors);this._recordingTreeElementMap=new Map;this._recordingsTreeOutline=new WebInspector.TreeOutline;this._recordingsTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._recordingsTreeSelectionDidChange,this);this._toggleRecordingShortcut=new WebInspector.KeyboardShortcut(null,WebInspector.KeyboardShortcut.Key.Space,this._toggleRecordingOnSpacebar.bind(this));this._toggleRecordingShortcut.implicitlyPreventsDefault=false;this._toggleRecordingShortcut.disabled=true;this._toggleNewRecordingShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Shift,WebInspector.KeyboardShortcut.Key.Space,this._toggleNewRecordingOnSpacebar.bind(this));this._toggleNewRecordingShortcut.implicitlyPreventsDefault=false;this._toggleNewRecordingShortcut.disabled=true;let toolTip=WebInspector.UIString("Start recording (%s)\nCreate new recording (%s)").format(this._toggleRecordingShortcut.displayName,this._toggleNewRecordingShortcut.displayName);let altToolTip=WebInspector.UIString("Stop recording (%s)").format(this._toggleRecordingShortcut.displayName);this._recordButton=new WebInspector.ToggleButtonNavigationItem("record-start-stop",toolTip,altToolTip,"Images/Record.svg","Images/Stop.svg",13,13);this._recordButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._recordButtonClicked,this);this.contentBrowser.navigationBar.insertNavigationItem(this._recordButton,0);if(WebInspector.FPSInstrument.supported()){let timelinesNavigationItem=new WebInspector.RadioButtonNavigationItem(WebInspector.TimelineOverview.ViewMode.Timelines,WebInspector.UIString("Events"));let renderingFramesNavigationItem=new WebInspector.RadioButtonNavigationItem(WebInspector.TimelineOverview.ViewMode.RenderingFrames,WebInspector.UIString("Frames"));this.contentBrowser.navigationBar.insertNavigationItem(timelinesNavigationItem,1);this.contentBrowser.navigationBar.insertNavigationItem(renderingFramesNavigationItem,2);this.contentBrowser.navigationBar.addEventListener(WebInspector.NavigationBar.Event.NavigationItemSelected,this._viewModeSelected,this);} WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.RecordingCreated,this._recordingCreated,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.RecordingLoaded,this._recordingLoaded,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStarted,this._capturingStartedOrStopped,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped,this._capturingStartedOrStopped,this);WebInspector.notifications.addEventListener(WebInspector.Notification.VisibilityStateDidChange,this._inspectorVisibilityChanged,this);this._displayedRecording=null;this._displayedContentView=null;this._viewMode=null;this._previousSelectedTimelineType=null;const selectedByUser=false;this._changeViewMode(WebInspector.TimelineOverview.ViewMode.Timelines,selectedByUser);for(let recording of WebInspector.timelineManager.recordings) this._addRecording(recording);this._recordingCountChanged();this.contentBrowser.updateHierarchicalPathForCurrentContentView();} static tabInfo() {return{image:"Images/Timeline.svg",title:WebInspector.UIString("Timelines"),};} static isTabAllowed() {return!!window.TimelineAgent||!!window.ScriptProfilerAgent;} static displayNameForTimelineType(timelineType) {switch(timelineType){case WebInspector.TimelineRecord.Type.Network:return WebInspector.UIString("Network Requests");case WebInspector.TimelineRecord.Type.Layout:return WebInspector.UIString("Layout & Rendering");case WebInspector.TimelineRecord.Type.Script:return WebInspector.UIString("JavaScript & Events");case WebInspector.TimelineRecord.Type.RenderingFrame:return WebInspector.UIString("Rendering Frames");case WebInspector.TimelineRecord.Type.Memory:return WebInspector.UIString("Memory");case WebInspector.TimelineRecord.Type.HeapAllocations:return WebInspector.UIString("JavaScript Allocations");default:console.error("Unknown Timeline type:",timelineType);} return null;} static iconClassNameForTimelineType(timelineType) {switch(timelineType){case WebInspector.TimelineRecord.Type.Network:return"network-icon";case WebInspector.TimelineRecord.Type.Layout:return"layout-icon";case WebInspector.TimelineRecord.Type.Memory:return"memory-icon";case WebInspector.TimelineRecord.Type.HeapAllocations:return"heap-allocations-icon";case WebInspector.TimelineRecord.Type.Script:return"script-icon";case WebInspector.TimelineRecord.Type.RenderingFrame:return"rendering-frame-icon";default:console.error("Unknown Timeline type:",timelineType);} return null;} static genericClassNameForTimelineType(timelineType) {switch(timelineType){case WebInspector.TimelineRecord.Type.Network:return"network";case WebInspector.TimelineRecord.Type.Layout:return"colors";case WebInspector.TimelineRecord.Type.Memory:return"memory";case WebInspector.TimelineRecord.Type.HeapAllocations:return"heap-allocations";case WebInspector.TimelineRecord.Type.Script:return"script";case WebInspector.TimelineRecord.Type.RenderingFrame:return"rendering-frame";default:console.error("Unknown Timeline type:",timelineType);} return null;} static iconClassNameForRecord(timelineRecord) {switch(timelineRecord.type){case WebInspector.TimelineRecord.Type.Layout:switch(timelineRecord.eventType){case WebInspector.LayoutTimelineRecord.EventType.InvalidateStyles:case WebInspector.LayoutTimelineRecord.EventType.RecalculateStyles:return WebInspector.TimelineRecordTreeElement.StyleRecordIconStyleClass;case WebInspector.LayoutTimelineRecord.EventType.InvalidateLayout:case WebInspector.LayoutTimelineRecord.EventType.ForcedLayout:case WebInspector.LayoutTimelineRecord.EventType.Layout:return WebInspector.TimelineRecordTreeElement.LayoutRecordIconStyleClass;case WebInspector.LayoutTimelineRecord.EventType.Paint:return WebInspector.TimelineRecordTreeElement.PaintRecordIconStyleClass;case WebInspector.LayoutTimelineRecord.EventType.Composite:return WebInspector.TimelineRecordTreeElement.CompositeRecordIconStyleClass;default:console.error("Unknown LayoutTimelineRecord eventType: "+timelineRecord.eventType,timelineRecord);} break;case WebInspector.TimelineRecord.Type.Script:switch(timelineRecord.eventType){case WebInspector.ScriptTimelineRecord.EventType.APIScriptEvaluated:return WebInspector.TimelineRecordTreeElement.APIRecordIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated:return WebInspector.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.MicrotaskDispatched:case WebInspector.ScriptTimelineRecord.EventType.EventDispatched:return WebInspector.TimelineRecordTreeElement.EventRecordIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.ProbeSampleRecorded:return WebInspector.TimelineRecordTreeElement.ProbeRecordIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.ConsoleProfileRecorded:return WebInspector.TimelineRecordTreeElement.ConsoleProfileIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.GarbageCollected:return WebInspector.TimelineRecordTreeElement.GarbageCollectionIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.TimerInstalled:return WebInspector.TimelineRecordTreeElement.TimerRecordIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.TimerFired:case WebInspector.ScriptTimelineRecord.EventType.TimerRemoved:return WebInspector.TimelineRecordTreeElement.TimerRecordIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameFired:case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameRequested:case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameCanceled:return WebInspector.TimelineRecordTreeElement.AnimationRecordIconStyleClass;default:console.error("Unknown ScriptTimelineRecord eventType: "+timelineRecord.eventType,timelineRecord);} break;case WebInspector.TimelineRecord.Type.RenderingFrame:return WebInspector.TimelineRecordTreeElement.RenderingFrameRecordIconStyleClass;case WebInspector.TimelineRecord.Type.HeapAllocations:return"heap-snapshot-record";case WebInspector.TimelineRecord.Type.Memory:default:console.error("Unknown TimelineRecord type: "+timelineRecord.type,timelineRecord);} return null;} static displayNameForRecord(timelineRecord,includeDetailsInMainTitle) {switch(timelineRecord.type){case WebInspector.TimelineRecord.Type.Network:return WebInspector.displayNameForURL(timelineRecord.resource.url,timelineRecord.resource.urlComponents);case WebInspector.TimelineRecord.Type.Layout:return WebInspector.LayoutTimelineRecord.displayNameForEventType(timelineRecord.eventType);case WebInspector.TimelineRecord.Type.Script:return WebInspector.ScriptTimelineRecord.EventType.displayName(timelineRecord.eventType,timelineRecord.details,includeDetailsInMainTitle);case WebInspector.TimelineRecord.Type.RenderingFrame:return WebInspector.UIString("Frame %d").format(timelineRecord.frameNumber);case WebInspector.TimelineRecord.Type.HeapAllocations:if(timelineRecord.heapSnapshot.title) return WebInspector.UIString("Snapshot %d \u2014 %s").format(timelineRecord.heapSnapshot.identifier,timelineRecord.heapSnapshot.title);return WebInspector.UIString("Snapshot %d").format(timelineRecord.heapSnapshot.identifier);case WebInspector.TimelineRecord.Type.Memory:default:console.error("Unknown TimelineRecord type: "+timelineRecord.type,timelineRecord);} return null;} get type() {return WebInspector.TimelineTabContentView.Type;} shown() {super.shown();this._toggleRecordingShortcut.disabled=false;this._toggleNewRecordingShortcut.disabled=false;if(WebInspector.visible) WebInspector.timelineManager.autoCaptureOnPageLoad=true;} hidden() {super.hidden();this._toggleRecordingShortcut.disabled=true;this._toggleNewRecordingShortcut.disabled=true;WebInspector.timelineManager.autoCaptureOnPageLoad=false;} closed() {super.closed();if(WebInspector.FPSInstrument.supported()) this.contentBrowser.navigationBar.removeEventListener(null,null,this);WebInspector.timelineManager.removeEventListener(null,null,this);WebInspector.notifications.removeEventListener(null,null,this);} canShowRepresentedObject(representedObject) {return representedObject instanceof WebInspector.TimelineRecording;} restoreFromCookie(cookie) {this._restoredShowingTimelineRecordingContentView=cookie[WebInspector.TimelineTabContentView.ShowingTimelineRecordingContentViewCookieKey];if(!this._restoredShowingTimelineRecordingContentView){if(!this.contentBrowser.currentContentView){if(!this._displayedRecording&&WebInspector.timelineManager.activeRecording) this._recordingLoaded();this._showTimelineViewForType(WebInspector.TimelineTabContentView.OverviewTimelineIdentifierCookieValue);} return;} let selectedTimelineViewIdentifier=cookie[WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey];if(selectedTimelineViewIdentifier===WebInspector.TimelineRecord.Type.RenderingFrame&&!WebInspector.FPSInstrument.supported()) selectedTimelineViewIdentifier=null;this._showTimelineViewForType(selectedTimelineViewIdentifier);super.restoreFromCookie(cookie);} saveToCookie(cookie) {cookie[WebInspector.TimelineTabContentView.ShowingTimelineRecordingContentViewCookieKey]=this.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView;if(this._viewMode===WebInspector.TimelineOverview.ViewMode.RenderingFrames) cookie[WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey]=WebInspector.TimelineRecord.Type.RenderingFrame;else{let selectedTimeline=this._getTimelineForCurrentContentView();if(selectedTimeline) cookie[WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey]=selectedTimeline.type;else cookie[WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey]=WebInspector.TimelineTabContentView.OverviewTimelineIdentifierCookieValue;} super.saveToCookie(cookie);} treeElementForRepresentedObject(representedObject) {if(!this._recordingTreeElementMap) return null;if(representedObject instanceof WebInspector.TimelineRecording) return this._recordingTreeElementMap.get(representedObject);return null;} _capturingStartedOrStopped(event) {let isCapturing=WebInspector.timelineManager.isCapturing();this._recordButton.toggled=isCapturing;} _inspectorVisibilityChanged(event) {WebInspector.timelineManager.autoCaptureOnPageLoad=!!this.visible&&!!WebInspector.visible;} _toggleRecordingOnSpacebar(event) {if(WebInspector.isEventTargetAnEditableField(event)) return;this._toggleRecording();event.preventDefault();} _toggleNewRecordingOnSpacebar(event) {if(WebInspector.isEventTargetAnEditableField(event)) return;this._toggleRecording(true);event.preventDefault();} _toggleRecording(shouldCreateRecording) {let isCapturing=WebInspector.timelineManager.isCapturing();this._recordButton.toggled=isCapturing;if(isCapturing) WebInspector.timelineManager.stopCapturing();else{WebInspector.timelineManager.startCapturing(shouldCreateRecording);this._recordingLoaded();}} _recordButtonClicked(event) {let shouldCreateNewRecording=window.event?window.event.shiftKey:false;this._recordButton.toggled=!WebInspector.timelineManager.isCapturing();this._toggleRecording(shouldCreateNewRecording);} _recordingsTreeSelectionDidChange(event) {let treeElement=event.data.selectedElement;if(!treeElement) return;this._recordingSelected(treeElement.representedObject);} _recordingCreated(event) {this._addRecording(event.data.recording);this._recordingCountChanged();} _addRecording(recording) {let recordingTreeElement=new WebInspector.GeneralTreeElement(WebInspector.TimelineTabContentView.StopwatchIconStyleClass,recording.displayName,null,recording);this._recordingTreeElementMap.set(recording,recordingTreeElement);this._recordingsTreeOutline.appendChild(recordingTreeElement);} _recordingCountChanged() {let previousTreeElement=null;for(let treeElement of this._recordingTreeElementMap.values()){if(previousTreeElement){previousTreeElement.nextSibling=treeElement;treeElement.previousSibling=previousTreeElement;} previousTreeElement=treeElement;}} _recordingSelected(recording) {this._displayedRecording=recording;let cookie={};this.saveToCookie(cookie);if(this._displayedContentView) this._displayedContentView.removeEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange,this._displayedContentViewNavigationItemsDidChange,this);let onlyExisting=true;this._displayedContentView=this.contentBrowser.contentViewForRepresentedObject(this._displayedRecording,onlyExisting);if(this._displayedContentView){this._displayedContentView.addEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange,this._displayedContentViewNavigationItemsDidChange,this);let currentTimelineView=this._displayedContentView.currentTimelineView;let timelineType=currentTimelineView&¤tTimelineView.representedObject instanceof WebInspector.Timeline?currentTimelineView.representedObject.type:null;this._showTimelineViewForType(timelineType);return;} onlyExisting=false;this._displayedContentView=this.contentBrowser.contentViewForRepresentedObject(this._displayedRecording,onlyExisting);if(this._displayedContentView) this._displayedContentView.addEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange,this._displayedContentViewNavigationItemsDidChange,this);this.restoreFromCookie(cookie);} _recordingLoaded(event) {this._recordingSelected(WebInspector.timelineManager.activeRecording);} _viewModeSelected(event) {let selectedNavigationItem=event.target.selectedNavigationItem;if(!selectedNavigationItem) return;const selectedByUser=true;this._changeViewMode(selectedNavigationItem.identifier,selectedByUser);} _changeViewMode(mode,selectedByUser) {if(this._viewMode===mode) return;let navigationItemForViewMode=this.contentBrowser.navigationBar.findNavigationItem(mode);if(!navigationItemForViewMode) return;this._viewMode=mode;this.contentBrowser.navigationBar.selectedNavigationItem=navigationItemForViewMode;if(!selectedByUser) return;let timelineType=this._previousSelectedTimelineType;if(this._viewMode===WebInspector.TimelineOverview.ViewMode.RenderingFrames){let timeline=this._getTimelineForCurrentContentView();this._previousSelectedTimelineType=timeline?timeline.type:null;timelineType=WebInspector.TimelineRecord.Type.RenderingFrame;} this._showTimelineViewForType(timelineType);} _showTimelineViewForType(timelineType) {let timeline=timelineType?this._displayedRecording.timelines.get(timelineType):null;if(timeline) this._displayedContentView.showTimelineViewForTimeline(timeline);else this._displayedContentView.showOverviewTimelineView();if(this.contentBrowser.currentContentView!==this._displayedContentView) this.contentBrowser.showContentView(this._displayedContentView);} _displayedContentViewNavigationItemsDidChange(event) {let timeline=this._getTimelineForCurrentContentView();let newViewMode=WebInspector.TimelineOverview.ViewMode.Timelines;if(timeline&&timeline.type===WebInspector.TimelineRecord.Type.RenderingFrame) newViewMode=WebInspector.TimelineOverview.ViewMode.RenderingFrames;const selectedByUser=false;this._changeViewMode(newViewMode,selectedByUser);} _getTimelineForCurrentContentView() {let currentContentView=this.contentBrowser.currentContentView;if(!(currentContentView instanceof WebInspector.TimelineRecordingContentView)) return null;let timelineView=currentContentView.currentTimelineView;return(timelineView&&timelineView.representedObject instanceof WebInspector.Timeline)?timelineView.representedObject:null;}};WebInspector.TimelineTabContentView.Type="timeline";WebInspector.TimelineTabContentView.ShowingTimelineRecordingContentViewCookieKey="timeline-sidebar-panel-showing-timeline-recording-content-view";WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey="timeline-sidebar-panel-selected-timeline-view-identifier";WebInspector.TimelineTabContentView.OverviewTimelineIdentifierCookieValue="overview";WebInspector.TimelineTabContentView.StopwatchIconStyleClass="stopwatch-icon";WebInspector.DetailsSection=class DetailsSection extends WebInspector.Object {constructor(identifier,title,groups,optionsElement,defaultCollapsedSettingValue) {super();this._element=document.createElement("div");this._element.classList.add(identifier,"details-section");this._headerElement=document.createElement("div");this._headerElement.addEventListener("click",this._headerElementClicked.bind(this));this._headerElement.className="header";this._element.appendChild(this._headerElement);if(optionsElement instanceof HTMLElement){this._optionsElement=optionsElement;this._optionsElement.classList.add("options");this._optionsElement.addEventListener("mousedown",this._optionsElementMouseDown.bind(this));this._optionsElement.addEventListener("mouseup",this._optionsElementMouseUp.bind(this));this._headerElement.appendChild(this._optionsElement);} this._titleElement=document.createElement("span");this._headerElement.appendChild(this._titleElement);this._contentElement=document.createElement("div");this._contentElement.className="content";this._element.appendChild(this._contentElement);this._identifier=identifier;this.title=title;this.groups=groups||[new WebInspector.DetailsSectionGroup];this._collapsedSetting=new WebInspector.Setting(identifier+"-details-section-collapsed",!!defaultCollapsedSettingValue);this.collapsed=this._collapsedSetting.value;this._expandedByUser=false;} get element() {return this._element;} get identifier() {return this._identifier;} get title() {return this._titleElement.textContent;} set title(title) {this._titleElement.textContent=title;} get titleElement() {return this._titleElement;} set titleElement(element) {this._headerElement.replaceChild(element,this._titleElement);this._titleElement=element;} get collapsed() {return this._element.classList.contains(WebInspector.DetailsSection.CollapsedStyleClassName);} set collapsed(flag) {if(flag) this._element.classList.add(WebInspector.DetailsSection.CollapsedStyleClassName);else this._element.classList.remove(WebInspector.DetailsSection.CollapsedStyleClassName);this._collapsedSetting.value=flag||false;this.dispatchEventToListeners(WebInspector.DetailsSection.Event.CollapsedStateChanged,{collapsed:this._collapsedSetting.value});} get groups() {return this._groups;} set groups(groups) {this._contentElement.removeChildren();this._groups=groups||[];for(var i=0;i{setting.value=editor.value;});return editor;} get element(){return this._element;} get type(){return this._type;} get label(){return this._label;} get value() {return this._value;} set value(value) {if(this._value===value) return;let oldValue=this._value;this._value=value;if(this._type==WebInspector.SettingEditor.Type.Checkbox) this._editorElement.checked=!!this._value;else this._editorElement.value=this._value;this.dispatchEventToListeners(WebInspector.SettingEditor.Event.ValueDidChange,{oldValue});} _createEditorElement(options) {let editorElement;switch(this._type){case WebInspector.SettingEditor.Type.Checkbox:editorElement=document.createElement("input");editorElement.type="checkbox";editorElement.addEventListener("change",(event)=>{this.value=event.target.checked;});break;case WebInspector.SettingEditor.Type.Numeric:editorElement=document.createElement("input");editorElement.type="number";if(options.min!==undefined) editorElement.min=options.min;if(options.max!==undefined) editorElement.max=options.max;editorElement.addEventListener("change",(event)=>{let currentValue=this._value;let newValue=parseInt(event.target.value);this.value=isNaN(newValue)?currentValue:newValue;});break;case WebInspector.SettingEditor.Type.Select:editorElement=document.createElement("select");var keyValuePairs=[];if(Array.isArray(options.values[0])) keyValuePairs=options.values;else keyValuePairs=options.values.map((value)=>[value,value]);for(let[key,value]of keyValuePairs){let optionElement=editorElement.appendChild(document.createElement("option"));optionElement.value=key;optionElement.textContent=value;} editorElement.addEventListener("change",(event)=>{this.value=event.target.value;});break;default:console.error("Unknown editor type: "+this._type);} return editorElement;}};WebInspector.SettingEditor._nextEditorIdentifier=1;WebInspector.SettingEditor.Type={Checkbox:"setting-editor-type-checkbox",Numeric:"setting-editor-type-numeric",Select:"setting-editor-type-select",};WebInspector.SettingEditor.Event={ValueDidChange:"value-did-change",};WebInspector.SettingsGroup=class SettingsGroup extends WebInspector.Object {constructor(title) {super();this._element=document.createElement("div");this._element.classList.add("container");let titleElement=this._element.appendChild(document.createElement("div"));titleElement.classList.add("title");titleElement.textContent=title;this._editorGroupElement=this._element.appendChild(document.createElement("div"));this._editorGroupElement.classList.add("editor-group");} get element(){return this._element;} addSetting(setting,label,options) {let editor=WebInspector.SettingEditor.createForSetting(setting,label,options);if(!editor) return null;this._editorGroupElement.append(editor.element);return editor;} addCustomSetting(editorType,options) {let editor=new WebInspector.SettingEditor(editorType,options.label,options);if(!editor) return null;this._editorGroupElement.append(editor.element);return editor;}};WebInspector.SettingsView=class SettingsView extends WebInspector.View {constructor(identifier,displayName) {super();this._identifier=identifier;this._displayName=displayName;this.element.classList.add("settings-view",identifier);} get identifier(){return this._identifier;} get displayName(){return this._displayName;} addSetting(title,setting,label,options) {let settingsGroup=this.addGroup(title);return settingsGroup.addSetting(setting,label,options);} addGroupWithCustomSetting(title,editorType,options) {let settingsGroup=this.addGroup(title);return settingsGroup.addCustomSetting(editorType,options);} addGroup(title) {let settingsGroup=new WebInspector.SettingsGroup(title);this.element.append(settingsGroup.element);return settingsGroup;} addSeparator() {if(this.element.lastChild&&this.element.lastChild.classList.contains("separator")) return;let separatorElement=this.element.appendChild(document.createElement("div"));separatorElement.classList.add("separator");}};WebInspector.SettingsView.EditorType={Checkbox:"settings-view-editor-type-checkbox",Numeric:"settings-view-editor-type-numeric",Select:"settings-view-editor-type-select",};WebInspector.ActivateButtonNavigationItem=class ActivateButtonNavigationItem extends WebInspector.ButtonNavigationItem {constructor(identifier,defaultToolTip,activatedToolTip,image,imageWidth,imageHeight,role) {super(identifier,defaultToolTip,image,imageWidth,imageHeight,role);this._defaultToolTip=defaultToolTip;this._activatedToolTip=activatedToolTip||defaultToolTip;this._role=role;} get defaultToolTip() {return this._defaultToolTip;} get activatedToolTip() {return this._activatedToolTip;} get activated() {return this.element.classList.contains(WebInspector.ActivateButtonNavigationItem.ActivatedStyleClassName);} set activated(flag) {this.element.classList.toggle(WebInspector.ActivateButtonNavigationItem.ActivatedStyleClassName,flag);if(flag){this.toolTip=this._activatedToolTip;if(this._role==="tab") this.element.setAttribute("aria-selected","true");}else{this.toolTip=this._defaultToolTip;if(this._role==="tab") this.element.removeAttribute("aria-selected");}} get additionalClassNames() {return["activate","button"];}};WebInspector.ActivateButtonNavigationItem.ActivatedStyleClassName="activated";WebInspector.ActivateButtonToolbarItem=class ActivateButtonToolbarItem extends WebInspector.ActivateButtonNavigationItem {constructor(identifier,defaultToolTip,activatedToolTip,label,image,role) {super(identifier,defaultToolTip,activatedToolTip,image,16,16,role);if(typeof label==="string"){this._labelElement=document.createElement("div");this._labelElement.className=WebInspector.ButtonToolbarItem.LabelStyleClassName;this._element.appendChild(this._labelElement);this.label=label;}} get label() {return this._labelElement.textContent;} set label(newLabel) {if(!newLabel||!this._labelElement) return;this._labelElement.textContent=newLabel;}};WebInspector.ApplicationCacheDetailsSidebarPanel=class ApplicationCacheDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel {constructor() {super("application-cache-details",WebInspector.UIString("Storage"));this.element.classList.add("application-cache");this._applicationCacheFrame=null;} inspect(objects) {if(!(objects instanceof Array)) objects=[objects];var applicationCacheFrameToInspect=null;for(var i=0;iMath.abs(this._mouseDownPosition.y-point.y)) point.y=this._mouseDownPosition.y;else point.x=this._mouseDownPosition.x;} this._selectedControl.point=point;this._selectedControl.handle.classList.add("selected");this._updateValue();} _updateValue() {function round(num) {return Math.round(num*100)/100;} var inValueX=round(this._inControl.point.x/this._bezierWidth);var inValueY=round(1-(this._inControl.point.y/this._bezierHeight));var outValueX=round(this._outControl.point.x/this._bezierWidth);var outValueY=round(1-(this._outControl.point.y/this._bezierHeight));this._bezier=new WebInspector.CubicBezier(inValueX,inValueY,outValueX,outValueY);this._updateBezier();this.dispatchEventToListeners(WebInspector.BezierEditor.Event.BezierChanged,{bezier:this._bezier});} _updateBezier() {var r=this._controlHandleRadius;var inControlX=this._inControl.point.x+r;var inControlY=this._inControl.point.y+r;var outControlX=this._outControl.point.x+r;var outControlY=this._outControl.point.y+r;var path=`M ${r} ${this._bezierHeight + r} C ${inControlX} ${inControlY} ${outControlX} ${outControlY} ${this._bezierWidth + r} ${r}`;this._bezierCurve.setAttribute("d",path);this._updateControl(this._inControl);this._updateControl(this._outControl);this._bezierInXInput.value=this._bezier.inPoint.x;this._bezierInYInput.value=this._bezier.inPoint.y;this._bezierOutXInput.value=this._bezier.outPoint.x;this._bezierOutYInput.value=this._bezier.outPoint.y;} _updateControl(control) {control.handle.setAttribute("cx",control.point.x+this._controlHandleRadius);control.handle.setAttribute("cy",control.point.y+this._controlHandleRadius);control.line.setAttribute("x2",control.point.x+this._controlHandleRadius);control.line.setAttribute("y2",control.point.y+this._controlHandleRadius);} _updateBezierPreview() {this._inControl.point=new WebInspector.Point(this._bezier.inPoint.x*this._bezierWidth,(1-this._bezier.inPoint.y)*this._bezierHeight);this._outControl.point=new WebInspector.Point(this._bezier.outPoint.x*this._bezierWidth,(1-this._bezier.outPoint.y)*this._bezierHeight);this._updateBezier();this._triggerPreviewAnimation();} _triggerPreviewAnimation() {this._bezierPreview.style.animationTimingFunction=this._bezier.toString();this._bezierPreviewContainer.classList.add("animate");this._bezierPreviewTiming.classList.add("animate");} _resetPreviewAnimation() {var parent=this._bezierPreview.parentNode;parent.removeChild(this._bezierPreview);parent.appendChild(this._bezierPreview);this._element.removeChild(this._bezierPreviewTiming);this._element.appendChild(this._bezierPreviewTiming);} _handleNumberInputInput(event) {this._changeBezierForInput(event.target,event.target.value);} _handleNumberInputKeydown(event) {let shift=0;if(event.keyIdentifier==="Up") shift=0.01;else if(event.keyIdentifier==="Down") shift=-0.01;if(!shift) return;if(event.shiftKey) shift*=10;event.preventDefault();this._changeBezierForInput(event.target,parseFloat(event.target.value)+shift);} _changeBezierForInput(target,value) {value=Math.round(value*100)/100;switch(target){case this._bezierInXInput:this._bezier.inPoint.x=Number.constrain(value,0,1);break;case this._bezierInYInput:this._bezier.inPoint.y=value;break;case this._bezierOutXInput:this._bezier.outPoint.x=Number.constrain(value,0,1);break;case this._bezierOutYInput:this._bezier.outPoint.y=value;break;default:return;} this._updateBezierPreview();this.dispatchEventToListeners(WebInspector.BezierEditor.Event.BezierChanged,{bezier:this._bezier});}};WebInspector.BezierEditor.Event={BezierChanged:"bezier-editor-bezier-changed"};WebInspector.BoxModelDetailsSectionRow=class BoxModelDetailsSectionRow extends WebInspector.DetailsSectionRow {constructor() {super(WebInspector.UIString("No Box Model Information"));this.element.classList.add("box-model");this._nodeStyles=null;} get nodeStyles() {return this._nodeStyles;} set nodeStyles(nodeStyles) {if(this._nodeStyles&&this._nodeStyles.computedStyle) this._nodeStyles.computedStyle.removeEventListener(WebInspector.CSSStyleDeclaration.Event.PropertiesChanged,this._refresh,this);this._nodeStyles=nodeStyles;if(this._nodeStyles&&this._nodeStyles.computedStyle) this._nodeStyles.computedStyle.addEventListener(WebInspector.CSSStyleDeclaration.Event.PropertiesChanged,this._refresh,this);this._refresh();} _refresh() {if(this._ignoreNextRefresh){this._ignoreNextRefresh=false;return;} this._updateMetrics();} _getPropertyValueAsPx(style,propertyName) {return Number(style.propertyForName(propertyName).value.replace(/px$/,"")||0);} _getBox(computedStyle,componentName) {var suffix=this._getComponentSuffix(componentName);var left=this._getPropertyValueAsPx(computedStyle,componentName+"-left"+suffix);var top=this._getPropertyValueAsPx(computedStyle,componentName+"-top"+suffix);var right=this._getPropertyValueAsPx(computedStyle,componentName+"-right"+suffix);var bottom=this._getPropertyValueAsPx(computedStyle,componentName+"-bottom"+suffix);return{left,top,right,bottom};} _getComponentSuffix(componentName) {return componentName==="border"?"-width":"";} _highlightDOMNode(showHighlight,mode,event) {event.stopPropagation();var nodeId=showHighlight?this.nodeStyles.node.id:0;if(nodeId){if(this._highlightMode===mode) return;this._highlightMode=mode;WebInspector.domTreeManager.highlightDOMNode(nodeId,mode);}else{this._highlightMode=null;WebInspector.domTreeManager.hideDOMNodeHighlight();} for(var i=0;this._boxElements&&i{this._codeMirror.refresh();if(!omitFocus) this._codeMirror.focus();},0);break;case WebInspector.BreakpointAction.Type.Sound:this._bodyElement.hidden=true;break;default:this._bodyElement.hidden=true;break;}} _logInputChanged(event) {this._action.data=event.target.value;} _codeMirrorBlurred(event) {this._action.data=(this._codeMirror.getValue()||"").trim();} _codeMirrorViewportChanged(event,from,to) {if(this._codeMirrorViewport.from===from&&this._codeMirrorViewport.to===to) return;this._codeMirrorViewport.from=from;this._codeMirrorViewport.to=to;this._delegate.breakpointActionViewResized(this);}};WebInspector.BreakpointTreeElement=class BreakpointTreeElement extends WebInspector.GeneralTreeElement {constructor(breakpoint,className,title) {if(!className) className=WebInspector.BreakpointTreeElement.GenericLineIconStyleClassName;super(["breakpoint",className],title,null,breakpoint,false);this._breakpoint=breakpoint;this._probeSet=null;this._listenerSet=new WebInspector.EventListenerSet(this,"BreakpointTreeElement listeners");if(!title) this._listenerSet.register(breakpoint,WebInspector.Breakpoint.Event.LocationDidChange,this._breakpointLocationDidChange);this._listenerSet.register(breakpoint,WebInspector.Breakpoint.Event.DisabledStateDidChange,this._updateStatus);this._listenerSet.register(breakpoint,WebInspector.Breakpoint.Event.AutoContinueDidChange,this._updateStatus);this._listenerSet.register(breakpoint,WebInspector.Breakpoint.Event.ResolvedStateDidChange,this._updateStatus);this._listenerSet.register(WebInspector.debuggerManager,WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange,this._updateStatus);this._listenerSet.register(WebInspector.probeManager,WebInspector.ProbeManager.Event.ProbeSetAdded,this._probeSetAdded);this._listenerSet.register(WebInspector.probeManager,WebInspector.ProbeManager.Event.ProbeSetRemoved,this._probeSetRemoved);this._statusImageElement=document.createElement("img");this._statusImageElement.className=WebInspector.BreakpointTreeElement.StatusImageElementStyleClassName;this._listenerSet.register(this._statusImageElement,"mousedown",this._statusImageElementMouseDown);this._listenerSet.register(this._statusImageElement,"click",this._statusImageElementClicked);if(!title) this._updateTitles();this._updateStatus();this.status=this._statusImageElement;this._iconAnimationLayerElement=document.createElement("span");this.iconElement.appendChild(this._iconAnimationLayerElement);} get breakpoint() {return this._breakpoint;} get filterableData() {return{text:[this.breakpoint.contentIdentifier]};} ondelete() {if(!WebInspector.debuggerManager.isBreakpointRemovable(this._breakpoint)) return false; this.__deletedViaDeleteKeyboardShortcut=true;WebInspector.debuggerManager.removeBreakpoint(this._breakpoint);return true;} onenter() {this._breakpoint.cycleToNextMode();return true;} onspace() {this._breakpoint.cycleToNextMode();return true;} onattach() {super.onattach();this._listenerSet.install();for(var probeSet of WebInspector.probeManager.probeSets) if(probeSet.breakpoint===this._breakpoint) this._addProbeSet(probeSet);} ondetach() {super.ondetach();this._listenerSet.uninstall();if(this._probeSet) this._removeProbeSet(this._probeSet);} populateContextMenu(contextMenu,event) {WebInspector.breakpointPopoverController.appendContextMenuItems(contextMenu,this._breakpoint,this._statusImageElement);super.populateContextMenu(contextMenu,event);} removeStatusImage() {this._statusImageElement.remove();this._statusImageElement=null;} _updateTitles() {var sourceCodeLocation=this._breakpoint.sourceCodeLocation;var displayLineNumber=sourceCodeLocation.displayLineNumber;var displayColumnNumber=sourceCodeLocation.displayColumnNumber;if(displayColumnNumber>0) this.mainTitle=WebInspector.UIString("Line %d:%d").format(displayLineNumber+1,displayColumnNumber+1);else this.mainTitle=WebInspector.UIString("Line %d").format(displayLineNumber+1);if(sourceCodeLocation.hasMappedLocation()){this.subtitle=sourceCodeLocation.formattedLocationString();if(sourceCodeLocation.hasFormattedLocation()) this.subtitleElement.classList.add(WebInspector.BreakpointTreeElement.FormattedLocationStyleClassName);else this.subtitleElement.classList.remove(WebInspector.BreakpointTreeElement.FormattedLocationStyleClassName);this.tooltip=this.mainTitle+" \u2014 "+WebInspector.UIString("originally %s").format(sourceCodeLocation.originalLocationString());}} _updateStatus() {if(!this._statusImageElement) return;if(this._breakpoint.disabled) this._statusImageElement.classList.add(WebInspector.BreakpointTreeElement.StatusImageDisabledStyleClassName);else this._statusImageElement.classList.remove(WebInspector.BreakpointTreeElement.StatusImageDisabledStyleClassName);if(this._breakpoint.autoContinue) this._statusImageElement.classList.add(WebInspector.BreakpointTreeElement.StatusImageAutoContinueStyleClassName);else this._statusImageElement.classList.remove(WebInspector.BreakpointTreeElement.StatusImageAutoContinueStyleClassName);if(this._breakpoint.resolved&&WebInspector.debuggerManager.breakpointsEnabled) this._statusImageElement.classList.add(WebInspector.BreakpointTreeElement.StatusImageResolvedStyleClassName);else this._statusImageElement.classList.remove(WebInspector.BreakpointTreeElement.StatusImageResolvedStyleClassName);} _addProbeSet(probeSet) {this._probeSet=probeSet;probeSet.addEventListener(WebInspector.ProbeSet.Event.SamplesCleared,this._samplesCleared,this);probeSet.dataTable.addEventListener(WebInspector.ProbeSetDataTable.Event.FrameInserted,this._dataUpdated,this);} _removeProbeSet(probeSet) {probeSet.removeEventListener(WebInspector.ProbeSet.Event.SamplesCleared,this._samplesCleared,this);probeSet.dataTable.removeEventListener(WebInspector.ProbeSetDataTable.Event.FrameInserted,this._dataUpdated,this);this._probeSet=null;} _probeSetAdded(event) {var probeSet=event.data.probeSet;if(probeSet.breakpoint===this._breakpoint) this._addProbeSet(probeSet);} _probeSetRemoved(event) {var probeSet=event.data.probeSet;if(probeSet.breakpoint===this._breakpoint) this._removeProbeSet(probeSet);} _samplesCleared(event) {var oldTable=event.data.oldTable;oldTable.removeEventListener(WebInspector.ProbeSetDataTable.Event.FrameInserted,this._dataUpdated,this);this._probeSet.dataTable.addEventListener(WebInspector.ProbeSetDataTable.Event.FrameInserted,this._dataUpdated,this);} _dataUpdated() {if(this.element.classList.contains(WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName)){clearTimeout(this._removeIconAnimationTimeoutIdentifier);this.element.classList.remove(WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName);window.requestAnimationFrame(this._dataUpdated.bind(this));return;} this.element.classList.add(WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName);this._removeIconAnimationTimeoutIdentifier=setTimeout(()=>{this.element.classList.remove(WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName);},WebInspector.BreakpointTreeElement.ProbeDataUpdatedAnimationDuration);} _breakpointLocationDidChange(event) {if(event.data.oldDisplaySourceCode===this._breakpoint.displaySourceCode) return;this._updateTitles();} _statusImageElementMouseDown(event) {event.stopPropagation();} _statusImageElementClicked(event) {this._breakpoint.cycleToNextMode();}};WebInspector.BreakpointTreeElement.GenericLineIconStyleClassName="breakpoint-generic-line-icon";WebInspector.BreakpointTreeElement.StatusImageElementStyleClassName="status-image";WebInspector.BreakpointTreeElement.StatusImageResolvedStyleClassName="resolved";WebInspector.BreakpointTreeElement.StatusImageAutoContinueStyleClassName="auto-continue";WebInspector.BreakpointTreeElement.StatusImageDisabledStyleClassName="disabled";WebInspector.BreakpointTreeElement.FormattedLocationStyleClassName="formatted-location";WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName="data-updated";WebInspector.BreakpointTreeElement.ProbeDataUpdatedAnimationDuration=400;WebInspector.ButtonToolbarItem=class ButtonToolbarItem extends WebInspector.ButtonNavigationItem {constructor(identifier,toolTip,label,image,role) {super(identifier,toolTip,image,16,16,role);if(typeof label==="string"){this._labelElement=document.createElement("div");this._labelElement.className=WebInspector.ButtonToolbarItem.LabelStyleClassName;this._element.appendChild(this._labelElement);this.label=label;}} get label() {return this._labelElement.textContent;} set label(newLabel) {if(!newLabel||!this._labelElement) return;this._labelElement.textContent=newLabel;}};WebInspector.ButtonToolbarItem.LabelStyleClassName="label";WebInspector.CSSStyleDeclarationSection=class CSSStyleDeclarationSection extends WebInspector.Object {constructor(delegate,style) {super();this._delegate=delegate||null;this._style=style||null;this._selectorElements=[];this._ruleDisabled=false;this._hasInvalidSelector=false;this._element=document.createElement("div");this._element.classList.add("style-declaration-section");new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"S",this._save.bind(this),this._element);new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,"S",this._save.bind(this),this._element);this._headerElement=document.createElement("div");this._headerElement.classList.add("header");if(!style.editable){let lockedIconElement=this._headerElement.createChild("img","locked-icon");let styleLabel;if(style.ownerRule&&style.ownerRule.type===WebInspector.CSSStyleSheet.Type.UserAgent) styleLabel=WebInspector.UIString("User Agent Stylesheet");else styleLabel=WebInspector.UIString("Style rule");lockedIconElement.title=WebInspector.UIString("%s cannot be modified").format(styleLabel);} this._iconElement=this._headerElement.createChild("img","icon");if(this.selectorEditable){this._selectorInput=this._headerElement.createChild("textarea");this._selectorInput.spellcheck=false;this._selectorInput.dir="ltr";this._selectorInput.tabIndex=-1;this._selectorInput.addEventListener("mouseover",this._handleMouseOver.bind(this));this._selectorInput.addEventListener("mousemove",this._handleMouseMove.bind(this));this._selectorInput.addEventListener("mouseout",this._handleMouseOut.bind(this));this._selectorInput.addEventListener("keydown",this._handleKeyDown.bind(this));this._selectorInput.addEventListener("keypress",this._handleKeyPress.bind(this));this._selectorInput.addEventListener("input",this._handleInput.bind(this));this._selectorInput.addEventListener("paste",this._handleSelectorPaste.bind(this));this._selectorInput.addEventListener("blur",this._handleBlur.bind(this));} this._selectorElement=this._headerElement.createChild("span","selector");if(!this.selectorEditable){this._selectorElement.addEventListener("mouseover",this._handleMouseOver.bind(this));this._selectorElement.addEventListener("mouseout",this._handleMouseOut.bind(this));} this._originElement=this._headerElement.createChild("span","origin");this._propertiesElement=document.createElement("div");this._propertiesElement.classList.add("properties");this._editorActive=false;this._propertiesTextEditor=new WebInspector.CSSStyleDeclarationTextEditor(this,style);this._propertiesTextEditor.addEventListener(WebInspector.CSSStyleDeclarationTextEditor.Event.ContentChanged,this._editorContentChanged.bind(this));this._propertiesTextEditor.addEventListener(WebInspector.CSSStyleDeclarationTextEditor.Event.Blurred,this._editorBlurred.bind(this));this._propertiesElement.appendChild(this._propertiesTextEditor.element);this._element.appendChild(this._headerElement);this._element.appendChild(this._propertiesElement);let iconClassName=null;switch(style.type){case WebInspector.CSSStyleDeclaration.Type.Rule:if(style.inherited) iconClassName=WebInspector.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName;else if(style.ownerRule.type===WebInspector.CSSStyleSheet.Type.Author) iconClassName=WebInspector.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName;else if(style.ownerRule.type===WebInspector.CSSStyleSheet.Type.User) iconClassName=WebInspector.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName;else if(style.ownerRule.type===WebInspector.CSSStyleSheet.Type.UserAgent) iconClassName=WebInspector.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName;else if(style.ownerRule.type===WebInspector.CSSStyleSheet.Type.Inspector) iconClassName=WebInspector.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName;break;case WebInspector.CSSStyleDeclaration.Type.Inline:case WebInspector.CSSStyleDeclaration.Type.Attribute:if(style.inherited) iconClassName=WebInspector.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName;else iconClassName=WebInspector.DOMTreeElementPathComponent.DOMElementIconStyleClassName;break;} if(style.editable){this._iconElement.classList.add("toggle-able");this._iconElement.title=WebInspector.UIString("Comment All Properties");this._iconElement.addEventListener("click",this._handleIconElementClicked.bind(this));} this._element.classList.add(iconClassName);if(!style.editable) this._element.classList.add(WebInspector.CSSStyleDeclarationSection.LockedStyleClassName);else if(style.ownerRule) this._style.ownerRule.addEventListener(WebInspector.CSSRule.Event.SelectorChanged,this._updateSelectorIcon.bind(this));else this._element.classList.add(WebInspector.CSSStyleDeclarationSection.SelectorLockedStyleClassName);this.refresh();this._headerElement.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this));} get element() {return this._element;} get style() {return this._style;} get lastInGroup() {return this._element.classList.contains(WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName);} set lastInGroup(last) {if(last) this._element.classList.add(WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName);else this._element.classList.remove(WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName);} get focused() {return this._propertiesTextEditor.focused;} focus() {this._propertiesTextEditor.focus();} refresh() {this._selectorElement.removeChildren();this._originElement.removeChildren();this._selectorElements=[];this._originElement.append(` ${emDash} `);function appendSelector(selector,matched) {let selectorElement=document.createElement("span");selectorElement.textContent=selector.text;if(matched) selectorElement.classList.add(WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName);let specificity=selector.specificity;if(specificity){let tooltip=WebInspector.UIString("Specificity: (%d, %d, %d)").format(specificity[0],specificity[1],specificity[2]);if(selector.dynamic){tooltip+="\n";if(this._style.inherited) tooltip+=WebInspector.UIString("Dynamically calculated for the parent element");else tooltip+=WebInspector.UIString("Dynamically calculated for the selected element");} selectorElement.title=tooltip;}else if(selector.dynamic){let tooltip=WebInspector.UIString("Specificity: No value for selected element");tooltip+="\n";tooltip+=WebInspector.UIString("Dynamically calculated for the selected element and did not match");selectorElement.title=tooltip;} this._selectorElement.appendChild(selectorElement);this._selectorElements.push(selectorElement);} function appendSelectorTextKnownToMatch(selectorText) {let selectorElement=document.createElement("span");selectorElement.textContent=selectorText;selectorElement.classList.add(WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName);this._selectorElement.appendChild(selectorElement);} switch(this._style.type){case WebInspector.CSSStyleDeclaration.Type.Rule:let selectors=this._style.ownerRule.selectors;let matchedSelectorIndices=this._style.ownerRule.matchedSelectorIndices;let alwaysMatch=!matchedSelectorIndices.length;if(selectors.length){let hasMatchingPseudoElementSelector=false;for(let i=0;i{InspectorFrontendHost.copyText(this._style.generateCSSRuleString());});if(this._style.inherited) return;contextMenu.appendItem(WebInspector.UIString("Duplicate Selector"),()=>{if(this._delegate&&typeof this._delegate.focusEmptySectionWithStyle==="function"){let existingRules=this._style.nodeStyles.rulesForSelector(this._currentSelectorText);for(let rule of existingRules){if(this._delegate.focusEmptySectionWithStyle(rule.style)) return;}} this._style.nodeStyles.addRule(this._currentSelectorText);});if(WebInspector.CSSStyleManager.PseudoElementNames.some((className)=>this._style.selectorText.includes(":"+className))) return;if(WebInspector.CSSStyleManager.ForceablePseudoClasses.every((className)=>!this._style.selectorText.includes(":"+className))){contextMenu.appendSeparator();for(let pseudoClass of WebInspector.CSSStyleManager.ForceablePseudoClasses){if(pseudoClass==="visited"&&this._style.node.nodeName()!=="A") continue;let pseudoClassSelector=":"+pseudoClass;contextMenu.appendItem(WebInspector.UIString("Add %s Rule").format(pseudoClassSelector),()=>{this._style.node.setPseudoClassEnabled(pseudoClass,true);let selector;if(this._style.ownerRule) selector=this._style.ownerRule.selectors.map((selector)=>selector.text+pseudoClassSelector).join(", ");else selector=this._currentSelectorText+pseudoClassSelector;this._style.nodeStyles.addRule(selector);});}} contextMenu.appendSeparator();for(let pseudoElement of WebInspector.CSSStyleManager.PseudoElementNames){let pseudoElementSelector="::"+pseudoElement;const styleText="content: \"\";";let existingSection=null;if(this._delegate&&typeof this._delegate.sectionForStyle==="function"){let existingRules=this._style.nodeStyles.rulesForSelector(this._currentSelectorText+pseudoElementSelector);if(existingRules.length){ existingSection=this._delegate.sectionForStyle(existingRules[0].style);}} let title=existingSection?WebInspector.UIString("Focus %s Rule"):WebInspector.UIString("Create %s Rule");contextMenu.appendItem(title.format(pseudoElementSelector),()=>{if(existingSection){existingSection.focus();return;} let selector;if(this._style.ownerRule) selector=this._style.ownerRule.selectors.map((selector)=>selector.text+pseudoElementSelector).join(", ");else selector=this._currentSelectorText+pseudoElementSelector;this._style.nodeStyles.addRule(selector,styleText);});}} _handleIconElementClicked() {if(this._hasInvalidSelector){this.refresh();return;} this._ruleDisabled=this._ruleDisabled?!this._propertiesTextEditor.uncommentAllProperties():this._propertiesTextEditor.commentAllProperties();this._iconElement.title=this._ruleDisabled?WebInspector.UIString("Uncomment All Properties"):WebInspector.UIString("Comment All Properties");this._element.classList.toggle("rule-disabled",this._ruleDisabled);} _highlightNodesWithSelector() {if(!this._style.ownerRule){WebInspector.domTreeManager.highlightDOMNode(this._style.node.id);return;} WebInspector.domTreeManager.highlightSelector(this._currentSelectorText,this._style.node.ownerDocument.frameIdentifier);} _hideDOMNodeHighlight() {WebInspector.domTreeManager.hideDOMNodeHighlight();} _handleMouseOver(event) {this._highlightNodesWithSelector();} _handleMouseMove(event) {if(this._hasInvalidSelector) return; for(let element of this._selectorElements){let{top,right,bottom,left}=element.getBoundingClientRect();if(event.clientX>=left&&event.clientX<=right&&event.clientY>=top&&event.clientY<=bottom){this._selectorInput.title=element.title;return;}} this._selectorInput.title="";} _handleMouseOut(event) {this._hideDOMNodeHighlight();} _save(event) {event.preventDefault();event.stopPropagation();if(this._style.type!==WebInspector.CSSStyleDeclaration.Type.Rule){InspectorFrontendHost.beep();return;} let sourceCode=this._style.ownerRule.sourceCodeLocation.sourceCode;if(sourceCode.type!==WebInspector.Resource.Type.Stylesheet){InspectorFrontendHost.beep();return;} var url;if(sourceCode.urlComponents.scheme==="data"){let mainResource=WebInspector.frameResourceManager.mainFrame.mainResource;let pathDirectory=mainResource.url.slice(0,-mainResource.urlComponents.lastPathComponent.length);url=pathDirectory+"base64.css";}else url=sourceCode.url;const saveAs=event.shiftKey;WebInspector.saveDataToFile({url:url,content:sourceCode.content},saveAs);} _handleKeyDown(event) {if(event.keyCode===WebInspector.KeyboardShortcut.Key.Enter.keyCode){event.preventDefault();this.focus();return;} if(event.keyCode!==WebInspector.KeyboardShortcut.Key.Tab.keyCode){this._highlightNodesWithSelector();return;} if(event.shiftKey&&this._delegate&&typeof this._delegate.cssStyleDeclarationSectionEditorPreviousRule==="function"){event.preventDefault();this._delegate.cssStyleDeclarationSectionEditorPreviousRule(this,true);return;} if(!event.metaKey){event.preventDefault();this.focus();this._propertiesTextEditor.selectFirstProperty();return;}} _handleKeyPress(event) {if(!event.altGraphKey&&!event.altKey&&!event.ctrlKey&&!event.metaKey){ this._selectorElement.append(String.fromCharCode(event.keyCode));}} _handleInput(event) {this._selectorElement.textContent=this._selectorInput.value;this._highlightNodesWithSelector();} _handleBlur(event) {this._hideDOMNodeHighlight();let newSelectorText=this._currentSelectorText.trim();if(!newSelectorText){this.refresh();return;} if(event.relatedTarget&&event.relatedTarget.isDescendant(this.element)){this._editorActive=true;this.focus();} this._style.ownerRule.selectorText=newSelectorText;} _updateSelectorIcon(event) {if(!this._style.ownerRule||!this._style.editable) return;this._hasInvalidSelector=event&&event.data&&!event.data.valid;this._element.classList.toggle("invalid-selector",!!this._hasInvalidSelector);if(this._hasInvalidSelector){this._iconElement.title=WebInspector.UIString("The selector “%s” is invalid.\nClick to revert to the previous selector.").format(this._selectorElement.textContent.trim());this._selectorInput.title=WebInspector.UIString("Using previous selector “%s”").format(this._style.ownerRule.selectorText);return;} this._iconElement.title=this._ruleDisabled?WebInspector.UIString("Uncomment All Properties"):WebInspector.UIString("Comment All Properties");this._selectorInput.title="";} _editorContentChanged(event) {this._editorActive=true;} _editorBlurred(event) {this._editorActive=false;this.dispatchEventToListeners(WebInspector.CSSStyleDeclarationSection.Event.Blurred);}};WebInspector.CSSStyleDeclarationSection.Event={Blurred:"css-style-declaration-sections-blurred"};WebInspector.CSSStyleDeclarationSection.LockedStyleClassName="locked";WebInspector.CSSStyleDeclarationSection.SelectorLockedStyleClassName="selector-locked";WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName="last-in-group";WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName="matched";WebInspector.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName="pseudo-element-selector";WebInspector.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName="author-style-rule-icon";WebInspector.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName="user-style-rule-icon";WebInspector.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName="user-agent-style-rule-icon";WebInspector.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName="inspector-style-rule-icon";WebInspector.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName="inherited-style-rule-icon";WebInspector.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName="inherited-element-style-rule-icon";WebInspector.CSSStyleDeclarationTextEditor=class CSSStyleDeclarationTextEditor extends WebInspector.View {constructor(delegate,style) {super();this.element.classList.add(WebInspector.CSSStyleDeclarationTextEditor.StyleClassName);this.element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);this.element.addEventListener("mousedown",this._handleMouseDown.bind(this),true);this.element.addEventListener("mouseup",this._handleMouseUp.bind(this));this._mouseDownCursorPosition=null;this._propertyVisibilityMode=WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.ShowAll;this._showsImplicitProperties=true;this._alwaysShowPropertyNames={};this._filterResultPropertyNames=null;this._sortProperties=false;this._hasActiveInlineSwatchEditor=false;this._linePrefixWhitespace="";this._delegate=delegate||null;this._codeMirror=WebInspector.CodeMirrorEditor.create(this.element,{readOnly:true,lineWrapping:true,mode:"css-rule",electricChars:false,indentWithTabs:false,indentUnit:4,smartIndent:false,matchBrackets:true,autoCloseBrackets:true});this._codeMirror.addKeyMap({"Enter":this._handleEnterKey.bind(this),"Shift-Enter":this._insertNewlineAfterCurrentLine.bind(this),"Shift-Tab":this._handleShiftTabKey.bind(this),"Tab":this._handleTabKey.bind(this)});this._completionController=new WebInspector.CodeMirrorCompletionController(this._codeMirror,this);this._tokenTrackingController=new WebInspector.CodeMirrorTokenTrackingController(this._codeMirror,this);this._completionController.noEndingSemicolon=true;this._jumpToSymbolTrackingModeEnabled=false;this._tokenTrackingController.classNameForHighlightedRange=WebInspector.CodeMirrorTokenTrackingController.JumpToSymbolHighlightStyleClassName;this._tokenTrackingController.mouseOverDelayDuration=0;this._tokenTrackingController.mouseOutReleaseDelayDuration=0;this._tokenTrackingController.mode=WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens;this._codeMirror.on("change",this._contentChanged.bind(this));this._codeMirror.on("blur",this._editorBlured.bind(this));this._codeMirror.on("beforeChange",this._handleBeforeChange.bind(this));if(typeof this._delegate.cssStyleDeclarationTextEditorFocused==="function") this._codeMirror.on("focus",this._editorFocused.bind(this));this.style=style;this._shownProperties=[];WebInspector.settings.stylesShowInlineWarnings.addEventListener(WebInspector.Setting.Event.Changed,this.refresh,this);} get delegate(){return this._delegate;} set delegate(delegate) {this._delegate=delegate||null;} get style(){return this._style;} set style(style) {if(this._style===style) return;if(this._style){this._style.removeEventListener(WebInspector.CSSStyleDeclaration.Event.PropertiesChanged,this._propertiesChanged,this);WebInspector.notifications.removeEventListener(WebInspector.Notification.GlobalModifierKeysDidChange,this._updateJumpToSymbolTrackingMode,this);} this._style=style||null;if(this._style){this._style.addEventListener(WebInspector.CSSStyleDeclaration.Event.PropertiesChanged,this._propertiesChanged,this);WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange,this._updateJumpToSymbolTrackingMode,this);} this._updateJumpToSymbolTrackingMode();this._resetContent();} get shownProperties(){return this._shownProperties;} get focused() {return this._codeMirror.getWrapperElement().classList.contains("CodeMirror-focused");} get alwaysShowPropertyNames(){return Object.keys(this._alwaysShowPropertyNames);} set alwaysShowPropertyNames(alwaysShowPropertyNames) {this._alwaysShowPropertyNames=(alwaysShowPropertyNames||[]).keySet();this._resetContent();} get propertyVisibilityMode(){return this._propertyVisibilityMode;} set propertyVisibilityMode(propertyVisibilityMode) {if(this._propertyVisibilityMode===propertyVisibilityMode) return;this._propertyVisibilityMode=propertyVisibilityMode;this._resetContent();} get showsImplicitProperties(){return this._showsImplicitProperties;} set showsImplicitProperties(showsImplicitProperties) {if(this._showsImplicitProperties===showsImplicitProperties) return;this._showsImplicitProperties=showsImplicitProperties;this._resetContent();} get sortProperties(){return this._sortProperties;} set sortProperties(sortProperties) {if(this._sortProperties===sortProperties) return;this._sortProperties=sortProperties;this._resetContent();} focus() {this._codeMirror.focus();} refresh() {this._resetContent();} highlightProperty(property) {function propertiesMatch(cssProperty) {if(cssProperty.enabled&&!cssProperty.overridden){if(cssProperty.canonicalName===property.canonicalName||hasMatchingLonghandProperty(cssProperty)) return true;} return false;} function hasMatchingLonghandProperty(cssProperty) {var cssProperties=cssProperty.relatedLonghandProperties;if(!cssProperties.length) return false;for(var property of cssProperties){if(propertiesMatch(property)) return true;} return false;} for(var cssProperty of this.style.properties){if(propertiesMatch(cssProperty)){var selection=cssProperty.__propertyTextMarker.find();this._codeMirror.setSelection(selection.from,selection.to);this.focus();return true;}} return false;} clearSelection() {this._codeMirror.setCursor({line:0,ch:0});} findMatchingProperties(needle) {if(!needle){this.resetFilteredProperties();return false;} var propertiesList=this._style.visibleProperties.length?this._style.visibleProperties:this._style.properties;var matchingProperties=[];for(var property of propertiesList) matchingProperties.push(property.text.includes(needle));if(!matchingProperties.includes(true)){this.resetFilteredProperties();return false;} for(var i=0;i0;} uncommentAllProperties() {function uncommentProperties(properties) {if(!properties.length) return false;for(var property of properties){if(property._commentRange){this._uncommentRange(property._commentRange);property._commentRange=null;}} return true;} return uncommentProperties.call(this,this._style.pendingProperties)||uncommentProperties.call(this,this._style.properties);} commentAllProperties() {if(!this._style.hasProperties()) return false;for(var property of this._style.properties){if(property.__propertyTextMarker) this._commentProperty(property);} return true;} selectFirstProperty() {var line=this._codeMirror.getLine(0);var trimmedLine=line.trimRight();if(!line||!trimmedLine.trimLeft().length) this.clearSelection();var index=line.indexOf(":");var cursor={line:0,ch:0};this._codeMirror.setSelection(cursor,{line:0,ch:index<0||this._textAtCursorIsComment(this._codeMirror,cursor)?trimmedLine.length:index});} selectLastProperty() {var line=this._codeMirror.lineCount()-1;var lineText=this._codeMirror.getLine(line);var trimmedLine=lineText.trimRight();var lastAnchor;var lastHead;if(this._textAtCursorIsComment(this._codeMirror,{line,ch:line.length})){lastAnchor=0;lastHead=line.length;}else{var colon=/(?::\s*)/.exec(lineText);lastAnchor=colon?colon.index+colon[0].length:0;lastHead=trimmedLine.length-trimmedLine.endsWith(";");} this._codeMirror.setSelection({line,ch:lastAnchor},{line,ch:lastHead});} completionControllerCompletionsHidden(completionController) {var styleText=this._style.text;var currentText=this._formattedContent(); if(styleText!==currentText) this._commitChanges();else this._propertiesChanged();} completionControllerCompletionsNeeded(completionController,prefix,defaultCompletions,base,suffix,forced) {let properties=this._style.nodeStyles.computedStyle.properties;let variables=properties.filter((property)=>property.variable&&property.name.startsWith(prefix));let variableNames=variables.map((property)=>property.name);completionController.updateCompletions(defaultCompletions.concat(variableNames));} layout() {this._codeMirror.refresh();} _textAtCursorIsComment(codeMirror,cursor) {var token=codeMirror.getTokenTypeAt(cursor);return token&&token.includes("comment");} _highlightNextNameOrValue(codeMirror,cursor,text) {let range=this._rangeForNextNameOrValue(codeMirror,cursor,text);codeMirror.setSelection(range.from,range.to);} _rangeForNextNameOrValue(codeMirror,cursor,text) {let nextAnchor=0;let nextHead=0;if(this._textAtCursorIsComment(codeMirror,cursor)) nextHead=text.length;else{let range=WebInspector.rangeForNextCSSNameOrValue(text,cursor.ch);nextAnchor=range.from;nextHead=range.to;} return{from:{line:cursor.line,ch:nextAnchor},to:{line:cursor.line,ch:nextHead},};} _handleMouseDown(event) {if(this._codeMirror.options.readOnly) return;let cursor=this._codeMirror.coordsChar({left:event.x,top:event.y});let line=this._codeMirror.getLine(cursor.line);if(!line.trim().length) return;this._mouseDownCursorPosition=cursor;this._mouseDownCursorPosition.previousRange={from:this._codeMirror.getCursor("from"),to:this._codeMirror.getCursor("to")};} _handleMouseUp(event) {if(this._codeMirror.options.readOnly||!this._mouseDownCursorPosition) return;let cursor=this._codeMirror.coordsChar({left:event.x,top:event.y});let clickedBookmark=false;for(let marker of this._codeMirror.findMarksAt(cursor)){if(marker.type!=="bookmark"||marker.replacedWith!==event.target) continue;let pos=marker.find();if(pos.line===cursor.line&&Math.abs(pos.ch-cursor.ch)<=1){clickedBookmark=true;break;}} if(!clickedBookmark&&this._mouseDownCursorPosition.line===cursor.line&&this._mouseDownCursorPosition.ch===cursor.ch){let line=this._codeMirror.getLine(cursor.line);if(cursor.ch===line.trimRight().length){let nextLine=this._codeMirror.getLine(cursor.line+1);if(WebInspector.settings.stylesInsertNewline.value&&cursor.line=this._mouseDownCursorPosition.previousRange.from.ch&&cursor.ch<=this._mouseDownCursorPosition.previousRange.to.ch;let previousInNewRange=this._mouseDownCursorPosition.previousRange.from.ch>=range.from.ch&&this._mouseDownCursorPosition.previousRange.to.ch<=range.to.ch; if(!this._codeMirror.hasFocus()||clickedDifferentLine||(!cursorInPreviousRange&&!previousInNewRange)) this._codeMirror.setSelection(range.from,range.to);}} this._mouseDownCursorPosition=null;} _handleBeforeChange(codeMirror,change) {if(change.origin!=="+delete"||this._completionController.isShowingCompletions()) return CodeMirror.Pass;if(!change.to.line&&!change.to.ch){if(codeMirror.lineCount()===1) return CodeMirror.Pass;var line=codeMirror.getLine(change.to.line);if(line&&line.trim().length) return CodeMirror.Pass;codeMirror.execCommand("deleteLine");return;} var marks=codeMirror.findMarksAt(change.to);if(!marks.length) return CodeMirror.Pass;for(var mark of marks) mark.clear();} _handleEnterKey(codeMirror) {var cursor=codeMirror.getCursor();var line=codeMirror.getLine(cursor.line);var trimmedLine=line.trimRight();var hasEndingSemicolon=trimmedLine.endsWith(";");if(!trimmedLine.trimLeft().length) return CodeMirror.Pass;if(hasEndingSemicolon&&cursor.ch===trimmedLine.length-1) ++cursor.ch;if(cursor.ch===trimmedLine.length){var replacement="\n";if(!hasEndingSemicolon&&!this._textAtCursorIsComment(this._codeMirror,cursor)) replacement=";"+replacement;this._codeMirror.replaceRange(replacement,cursor);return;} return CodeMirror.Pass;} _insertNewlineAfterCurrentLine(codeMirror) {var cursor=codeMirror.getCursor();var line=codeMirror.getLine(cursor.line);var trimmedLine=line.trimRight();cursor.ch=trimmedLine.length;if(cursor.ch){var replacement="\n";if(!trimmedLine.endsWith(";")&&!this._textAtCursorIsComment(this._codeMirror,cursor)) replacement=";"+replacement;this._codeMirror.replaceRange(replacement,cursor);return;} return CodeMirror.Pass;} _handleShiftTabKey(codeMirror) {function switchRule() {if(this._delegate&&typeof this._delegate.cssStyleDeclarationTextEditorSwitchRule==="function"){this._delegate.cssStyleDeclarationTextEditorSwitchRule(true);return;} return CodeMirror.Pass;} let cursor=codeMirror.getCursor();let line=codeMirror.getLine(cursor.line);let previousLine=codeMirror.getLine(cursor.line-1);if(!line&&!previousLine&&!cursor.line) return switchRule.call(this);let trimmedPreviousLine=previousLine?previousLine.trimRight():"";let previousAnchor=0;let previousHead=line.length;let isComment=this._textAtCursorIsComment(codeMirror,cursor);if(cursor.ch===line.indexOf(":")||line.indexOf(":")<0||isComment){if(previousLine){--cursor.line;previousHead=trimmedPreviousLine.length;if(!this._textAtCursorIsComment(codeMirror,cursor)){let colon=/(?::\s*)/.exec(previousLine);previousAnchor=colon?colon.index+colon[0].length:0;if(trimmedPreviousLine.includes(";")) previousHead=trimmedPreviousLine.lastIndexOf(";");} codeMirror.setSelection({line:cursor.line,ch:previousAnchor},{line:cursor.line,ch:previousHead});return;} if(cursor.line){codeMirror.setCursor(cursor.line-1,0);return;} return switchRule.call(this);} if(!isComment){let match=/(?:[^:;\s]\s*)+/.exec(line);previousAnchor=match.index;previousHead=previousAnchor+match[0].length;} codeMirror.setSelection({line:cursor.line,ch:previousAnchor},{line:cursor.line,ch:previousHead});} _handleTabKey(codeMirror) {function switchRule(){if(this._delegate&&typeof this._delegate.cssStyleDeclarationTextEditorSwitchRule==="function"){this._delegate.cssStyleDeclarationTextEditorSwitchRule();return;} return CodeMirror.Pass;} let cursor=codeMirror.getCursor();let line=codeMirror.getLine(cursor.line);let trimmedLine=line.trimRight();let lastLine=cursor.line===codeMirror.lineCount()-1;let nextLine=codeMirror.getLine(cursor.line+1);let trimmedNextLine=nextLine?nextLine.trimRight():"";if(!trimmedLine.trimLeft().length){if(lastLine) return switchRule.call(this);if(!trimmedNextLine.trimLeft().length){codeMirror.setCursor(cursor.line+1,0);return;} ++cursor.line;this._highlightNextNameOrValue(codeMirror,cursor,nextLine);return;} if(trimmedLine.endsWith(":")){codeMirror.setCursor(cursor.line,line.length);this._completionController._completeAtCurrentPosition(true);return;} let hasEndingSemicolon=trimmedLine.endsWith(";");let pastLastSemicolon=line.includes(";")&&cursor.ch>=line.lastIndexOf(";");if(cursor.ch>=line.trimRight().length-hasEndingSemicolon||pastLastSemicolon){this._completionController.completeAtCurrentPositionIfNeeded().then(function(result){if(result!==WebInspector.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound) return;let replacement="";if(!hasEndingSemicolon&&!pastLastSemicolon&&!this._textAtCursorIsComment(codeMirror,cursor)) replacement+=";";if(lastLine) replacement+="\n";if(replacement.length) codeMirror.replaceRange(replacement,{line:cursor.line,ch:trimmedLine.length});if(!nextLine){codeMirror.setCursor(cursor.line+1,0);return;} this._highlightNextNameOrValue(codeMirror,{line:cursor.line+1,ch:0},nextLine);}.bind(this));return;} this._highlightNextNameOrValue(codeMirror,cursor,line);} _clearRemoveEditingLineClassesTimeout() {if(!this._removeEditingLineClassesTimeout) return;clearTimeout(this._removeEditingLineClassesTimeout);delete this._removeEditingLineClassesTimeout;} _removeEditingLineClasses() {this._clearRemoveEditingLineClassesTimeout();function removeEditingLineClasses() {var lineCount=this._codeMirror.lineCount();for(var i=0;i{this._createCommentedCheckboxMarker(lineHandler);});} this._createInlineSwatches(true);this._markLinesWithCheckboxPlaceholder();} if(nonatomic) update.call(this);else this._codeMirror.operation(update.bind(this));} _createCommentedCheckboxMarker(lineHandle) {var lineNumber=lineHandle.lineNo();if(!lineNumber&&isNaN(lineNumber)) return;let commentedPropertyRegex=/\/\*\s*[-\w]+\s*\:\s*(?:(?:\".*\"|url\(.+\)|[^;])\s*)+;?\s*\*\//g;var match=commentedPropertyRegex.exec(lineHandle.text);if(!match) return;while(match){var checkboxElement=document.createElement("input");checkboxElement.type="checkbox";checkboxElement.checked=false;checkboxElement.addEventListener("change",this._propertyCommentCheckboxChanged.bind(this));var from={line:lineNumber,ch:match.index};var to={line:lineNumber,ch:match.index+match[0].length};var checkboxMarker=this._codeMirror.setUniqueBookmark(from,checkboxElement);checkboxMarker.__propertyCheckbox=true;var commentTextMarker=this._codeMirror.markText(from,to);checkboxElement.__commentTextMarker=commentTextMarker;match=commentedPropertyRegex.exec(lineHandle.text);}} _createInlineSwatches(nonatomic,lineNumber) {function createSwatch(swatch,marker,valueObject,valueString) {swatch.addEventListener(WebInspector.InlineSwatch.Event.ValueChanged,this._inlineSwatchValueChanged,this);swatch.addEventListener(WebInspector.InlineSwatch.Event.Activated,this._inlineSwatchActivated,this);swatch.addEventListener(WebInspector.InlineSwatch.Event.Deactivated,this._inlineSwatchDeactivated,this);let codeMirrorTextMarker=marker.codeMirrorTextMarker;let codeMirrorTextMarkerRange=codeMirrorTextMarker.find();this._codeMirror.setUniqueBookmark(codeMirrorTextMarkerRange.from,swatch.element);swatch.__textMarker=codeMirrorTextMarker;swatch.__textMarkerRange=codeMirrorTextMarkerRange;} function update() {let range=typeof lineNumber==="number"?new WebInspector.TextRange(lineNumber,0,lineNumber+1,0):null;createCodeMirrorColorTextMarkers(this._codeMirror,range,(marker,color,colorString)=>{let swatch=new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Color,color,this._codeMirror.getOption("readOnly"));createSwatch.call(this,swatch,marker,color,colorString);});createCodeMirrorGradientTextMarkers(this._codeMirror,range,(marker,gradient,gradientString)=>{let swatch=new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Gradient,gradient,this._codeMirror.getOption("readOnly"));createSwatch.call(this,swatch,marker,gradient,gradientString);});createCodeMirrorCubicBezierTextMarkers(this._codeMirror,range,(marker,bezier,bezierString)=>{let swatch=new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Bezier,bezier,this._codeMirror.getOption("readOnly"));createSwatch.call(this,swatch,marker,bezier,bezierString);});createCodeMirrorSpringTextMarkers(this._codeMirror,range,(marker,spring,springString)=>{let swatch=new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Spring,spring,this._codeMirror.getOption("readOnly"));createSwatch.call(this,swatch,marker,spring,springString);});createCodeMirrorVariableTextMarkers(this._codeMirror,range,(marker,variable,variableString)=>{const dontCreateIfMissing=true;let variableProperty=this._style.nodeStyles.computedStyle.propertyForName(variableString,dontCreateIfMissing);if(!variableProperty){let from={line:marker.range.startLine,ch:marker.range.startColumn};let to={line:marker.range.endLine,ch:marker.range.endColumn};this._codeMirror.markText(from,to,{className:"invalid"});if(WebInspector.settings.stylesShowInlineWarnings.value){let invalidMarker=document.createElement("button");invalidMarker.classList.add("invalid-warning-marker","clickable");invalidMarker.title=WebInspector.UIString("The variable “%s” does not exist.\nClick to delete and open autocomplete.").format(variableString);invalidMarker.addEventListener("click",(event)=>{this._codeMirror.replaceRange("",from,to);this._codeMirror.setCursor(from);this._completionController.completeAtCurrentPositionIfNeeded(true);});this._codeMirror.setBookmark(from,invalidMarker);} return;} let trimmedValue=variableProperty.value.trim();let swatch=new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Variable,trimmedValue,this._codeMirror.getOption("readOnly"));createSwatch.call(this,swatch,marker,variableProperty,trimmedValue);});} if(nonatomic) update.call(this);else this._codeMirror.operation(update.bind(this));} _updateTextMarkerForPropertyIfNeeded(property) {var textMarker=property.__propertyTextMarker;if(!textMarker) return;var range=textMarker.find();if(!range) return;this._createTextMarkerForPropertyIfNeeded(range.from,range.to,property);} _createTextMarkerForPropertyIfNeeded(from,to,property) {if(!this._codeMirror.getOption("readOnly")){var checkboxElement=document.createElement("input");checkboxElement.type="checkbox";checkboxElement.checked=true;checkboxElement.addEventListener("change",this._propertyCheckboxChanged.bind(this));checkboxElement.__cssProperty=property;var checkboxMarker=this._codeMirror.setUniqueBookmark(from,checkboxElement);checkboxMarker.__propertyCheckbox=true;}else if(this._delegate.cssStyleDeclarationTextEditorShouldAddPropertyGoToArrows&&!property.implicit&&typeof this._delegate.cssStyleDeclarationTextEditorShowProperty==="function"){let arrowElement=WebInspector.createGoToArrowButton();arrowElement.title=WebInspector.UIString("Option-click to show source");let delegate=this._delegate;arrowElement.addEventListener("click",function(event){delegate.cssStyleDeclarationTextEditorShowProperty(property,event.altKey);});this._codeMirror.setUniqueBookmark(to,arrowElement);} function duplicatePropertyExistsBelow(cssProperty) {var propertyFound=false;for(var property of this._style.properties){if(property===cssProperty) propertyFound=true;else if(property.name===cssProperty.name&&propertyFound) return true;} return false;} var propertyNameIsValid=false;if(WebInspector.CSSCompletions.cssNameCompletions) propertyNameIsValid=WebInspector.CSSCompletions.cssNameCompletions.isValidPropertyName(property.name);var classNames=["css-style-declaration-property"];if(property.overridden) classNames.push("overridden");if(property.implicit) classNames.push("implicit");if(this._style.inherited&&!property.inherited) classNames.push("not-inherited");if(!property.valid&&property.hasOtherVendorNameOrKeyword()) classNames.push("other-vendor");else if(!property.valid&&(!propertyNameIsValid||duplicatePropertyExistsBelow.call(this,property))) classNames.push("invalid");if(!property.enabled) classNames.push("disabled");if(property.__filterResultClassName&&!property.__filterResultNeedlePosition) classNames.push(property.__filterResultClassName);var classNamesString=classNames.join(" "); if(property.__propertyTextMarker&&property.__propertyTextMarker.doc.cm===this._codeMirror&&property.__propertyTextMarker.find()){if(property.__propertyTextMarker.className===classNamesString) return;property.__propertyTextMarker.clear();} var propertyTextMarker=this._codeMirror.markText(from,to,{className:classNamesString});propertyTextMarker.__cssProperty=property;property.__propertyTextMarker=propertyTextMarker;property.addEventListener(WebInspector.CSSProperty.Event.OverriddenStatusChanged,this._propertyOverriddenStatusChanged,this);this._removeCheckboxPlaceholder(from.line);if(property.__filterResultClassName&&property.__filterResultNeedlePosition){for(var needlePosition of property.__filterResultNeedlePosition.start){var start={line:from.line,ch:needlePosition};var end={line:to.line,ch:start.ch+property.__filterResultNeedlePosition.length};this._codeMirror.markText(start,end,{className:property.__filterResultClassName});}} if(this._codeMirror.getOption("readOnly")||property.hasOtherVendorNameOrKeyword()||property.text.trim().endsWith(":")||!WebInspector.settings.stylesShowInlineWarnings.value) return;var propertyHasUnnecessaryPrefix=property.name.startsWith("-webkit-")&&WebInspector.CSSCompletions.cssNameCompletions.isValidPropertyName(property.canonicalName);function generateInvalidMarker(options) {var invalidMarker=document.createElement("button");invalidMarker.className="invalid-warning-marker";invalidMarker.title=options.title;if(typeof options.correction==="string"){ invalidMarker.classList.add("clickable");invalidMarker.addEventListener("click",function(){this._codeMirror.replaceRange(options.correction,from,to);if(options.autocomplete){this._codeMirror.setCursor(to);this.focus();this._completionController._completeAtCurrentPosition(true);}}.bind(this));} this._codeMirror.setBookmark(options.position,invalidMarker);} function instancesOfProperty(propertyName) {var count=0;for(var property of this._style.properties){if(property.name===propertyName) ++count;} return count;} var instances=instancesOfProperty.call(this,property.name);var invalidMarkerInfo;if(propertyHasUnnecessaryPrefix&&!instancesOfProperty.call(this,property.canonicalName)){generateInvalidMarker.call(this,{position:from,title:WebInspector.UIString("The “webkit” prefix is not necessary.\nClick to insert a duplicate without the prefix."),correction:property.text+"\n"+property.text.replace("-webkit-",""),autocomplete:false});}else if(instances>1){invalidMarkerInfo={position:from,title:WebInspector.UIString("Duplicate property “%s”.\nClick to delete this property.").format(property.name),correction:"",autocomplete:false};} if(property.valid){if(invalidMarkerInfo) generateInvalidMarker.call(this,invalidMarkerInfo);return;} if(propertyNameIsValid){let start={line:from.line,ch:from.ch+property.name.length+2};let end={line:to.line,ch:start.ch+property.value.length};this._codeMirror.markText(start,end,{className:"invalid"});if(/^(?:\d+)$/.test(property.value)){invalidMarkerInfo={position:from,title:WebInspector.UIString("The value “%s” needs units.\nClick to add “px” to the value.").format(property.value),correction:property.name+": "+property.value+"px;",autocomplete:false};}else{var valueReplacement=property.value.length?WebInspector.UIString("The value “%s” is not supported for this property.\nClick to delete and open autocomplete.").format(property.value):WebInspector.UIString("This property needs a value.\nClick to open autocomplete.");invalidMarkerInfo={position:from,title:valueReplacement,correction:property.name+": ",autocomplete:true};}}else if(!instancesOfProperty.call(this,"-webkit-"+property.name)&&WebInspector.CSSCompletions.cssNameCompletions.propertyRequiresWebkitPrefix(property.name)){invalidMarkerInfo={position:from,title:WebInspector.UIString("The “webkit” prefix is needed for this property.\nClick to insert a duplicate with the prefix."),correction:"-webkit-"+property.text+"\n"+property.text,autocomplete:false};}else if(!propertyHasUnnecessaryPrefix&&!WebInspector.CSSCompletions.cssNameCompletions.isValidPropertyName("-webkit-"+property.name)){var closestPropertyName=WebInspector.CSSCompletions.cssNameCompletions.getClosestPropertyName(property.name);if(closestPropertyName){invalidMarkerInfo={position:from,title:WebInspector.UIString("Did you mean “%s”?\nClick to replace.").format(closestPropertyName),correction:property.text.replace(property.name,closestPropertyName),autocomplete:true};}else if(property.name.startsWith("-webkit-")&&(closestPropertyName=WebInspector.CSSCompletions.cssNameCompletions.getClosestPropertyName(property.canonicalName))){invalidMarkerInfo={position:from,title:WebInspector.UIString("Did you mean “%s”?\nClick to replace.").format("-webkit-"+closestPropertyName),correction:property.text.replace(property.canonicalName,closestPropertyName),autocomplete:true};}else{invalidMarkerInfo={position:from,title:WebInspector.UIString("Unsupported property “%s”").format(property.name),correction:false,autocomplete:false};}} if(!invalidMarkerInfo) return;generateInvalidMarker.call(this,invalidMarkerInfo);} _clearTextMarkers(nonatomic,all) {function clear() {var markers=this._codeMirror.getAllMarks();for(var i=0;iproperty;if(this._filterResultPropertyNames){filterFunction=(property)=>{if(!property.variable&&this._propertyVisibilityMode===WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideNonVariables) return false;if(property.variable&&this._propertyVisibilityMode===WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideVariables) return false;if(property.implicit&&!this._showsImplicitProperties) return false;if(!(property.name in this._filterResultPropertyNames)) return false;return true;};}else if(!onlyVisibleProperties){filterFunction=(property)=>{switch(this._propertyVisibilityMode){case WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideNonVariables:if(!property.variable) return false;break;case WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideVariables:if(property.variable) return false;break;case WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.ShowAll:break;default:console.error("Invalid property visibility mode");break;} return!property.implicit||this._showsImplicitProperties||property.canonicalName in this._alwaysShowPropertyNames;};} properties=properties.filter(filterFunction);if(this._sortProperties) properties.sort((a,b)=>a.name.extendedLocaleCompare(b.name));this._shownProperties=properties;for(var i=0;i1) this._classListContainer.children[1].remove();let classes=this.domNode.getAttribute("class");let classToggledMap=this.domNode[WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol];if(!classToggledMap) classToggledMap=this.domNode[WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol]=new Map;if(classes&&classes.length){for(let className of classes.split(/\s+/)) classToggledMap.set(className,true);} for(let[className,toggled]of classToggledMap){if((toggled&&!classes.includes(className))||(!toggled&&classes.includes(className))){toggled=!toggled;classToggledMap.set(className,toggled);} this._createToggleForClassName(className);}} _createToggleForClassName(className) {if(!className||!className.length) return;let classToggledMap=this.domNode[WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol];if(!classToggledMap) return;if(!classToggledMap.has(className)) classToggledMap.set(className,true);let toggled=classToggledMap.get(className);let classNameContainer=document.createElement("div");classNameContainer.classList.add("class-toggle");let classNameToggle=classNameContainer.createChild("input");classNameToggle.type="checkbox";classNameToggle.checked=toggled;let classNameTitle=classNameContainer.createChild("span");classNameTitle.textContent=className;classNameTitle.draggable=true;classNameTitle.addEventListener("dragstart",(event)=>{event.dataTransfer.setData(WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType,className);event.dataTransfer.effectAllowed="copy";});let classNameToggleChanged=(event)=>{this.domNode.toggleClass(className,classNameToggle.checked);classToggledMap.set(className,classNameToggle.checked);};classNameToggle.addEventListener("click",classNameToggleChanged);classNameTitle.addEventListener("click",(event)=>{classNameToggle.checked=!classNameToggle.checked;classNameToggleChanged();});this._classListContainer.appendChild(classNameContainer);} _filterDidChange() {this.contentView.element.classList.toggle(WebInspector.CSSStyleDetailsSidebarPanel.FilterInProgressClassName,this._filterBar.hasActiveFilters());this._selectedPanel.filterDidChange(this._filterBar);} _styleSheetAddedOrRemoved() {this.needsLayout();}};WebInspector.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset=30;WebInspector.CSSStyleDetailsSidebarPanel.FilterInProgressClassName="filter-in-progress";WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchingSectionHasLabelClassName="filter-section-has-label";WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName="filter-matching";WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName="filter-section-non-matching";WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInPropertyClassName="filter-property-non-matching";WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol=Symbol("css-style-details-sidebar-panel-toggled-classes-symbol");WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType="text/classname";WebInspector.CSSStyleSheetTreeElement=class CSSStyleSheetTreeElement extends WebInspector.SourceCodeTreeElement {constructor(styleSheet) {const classNames=["stylesheet","stylesheet-icon"];const title=WebInspector.UIString("Inspector Style Sheet");const subtitle=null;const hasChildren=false;super(styleSheet,classNames,title,subtitle,styleSheet,hasChildren);}};WebInspector.CallFrameTreeElement=class CallFrameTreeElement extends WebInspector.GeneralTreeElement {constructor(callFrame,isAsyncBoundaryCallFrame) {let className=WebInspector.CallFrameView.iconClassNameForCallFrame(callFrame);let title=callFrame.functionName||WebInspector.UIString("(anonymous function)");super(["call-frame",className],title,null,callFrame,false);this._callFrame=callFrame;this._isActiveCallFrame=false;if(isAsyncBoundaryCallFrame){this.addClassName("async-boundary");this.selectable=false;} if(this._callFrame.nativeCode||!this._callFrame.sourceCodeLocation){this.subtitle="";return;} let displayScriptURL=this._callFrame.sourceCodeLocation.displaySourceCode.url;if(displayScriptURL){this.subtitle=document.createElement("span");this._callFrame.sourceCodeLocation.populateLiveDisplayLocationString(this.subtitle,"textContent");this.tooltipHandledSeparately=true;}} get callFrame(){return this._callFrame;} get isActiveCallFrame(){return this._isActiveCallFrame;} set isActiveCallFrame(x) {if(this._isActiveCallFrame===x) return;this._isActiveCallFrame=x;this._updateStatus();} onattach() {super.onattach();if(this.tooltipHandledSeparately){let tailCallSuffix="";if(this._callFrame.isTailDeleted) tailCallSuffix=" "+WebInspector.UIString("(Tail Call)");let tooltipPrefix=this.mainTitle+tailCallSuffix+"\n";this._callFrame.sourceCodeLocation.populateLiveDisplayLocationTooltip(this.element,tooltipPrefix);} this._updateStatus();} _updateStatus() {if(!this.element) return;if(!this._isActiveCallFrame){this.status=null;return;} if(!this._statusImageElement) this._statusImageElement=useSVGSymbol("Images/ActiveCallFrame.svg","status-image");this.status=this._statusImageElement;}};WebInspector.CallFrameView=class CallFrameView extends WebInspector.Object {constructor(callFrame,showFunctionName) {var callFrameElement=document.createElement("div");callFrameElement.classList.add("call-frame",WebInspector.CallFrameView.iconClassNameForCallFrame(callFrame));var subtitleElement=document.createElement("span");subtitleElement.classList.add("subtitle");var sourceCodeLocation=callFrame.sourceCodeLocation;if(sourceCodeLocation){WebInspector.linkifyElement(callFrameElement,sourceCodeLocation);var linkElement=document.createElement("a");linkElement.classList.add("source-link");linkElement.href=sourceCodeLocation.sourceCode.url;if(showFunctionName){var separatorElement=document.createElement("span");separatorElement.classList.add("separator");separatorElement.textContent=" — ";subtitleElement.append(separatorElement);} subtitleElement.append(linkElement);sourceCodeLocation.populateLiveDisplayLocationTooltip(linkElement);sourceCodeLocation.populateLiveDisplayLocationString(linkElement,"textContent");} var titleElement=document.createElement("span");titleElement.classList.add("title");if(showFunctionName){var imgElement=document.createElement("img");imgElement.classList.add("icon");titleElement.append(imgElement,callFrame.functionName||WebInspector.UIString("(anonymous function)"));} callFrameElement.append(titleElement,subtitleElement);return callFrameElement;} static iconClassNameForCallFrame(callFrame) {if(callFrame.isTailDeleted) return WebInspector.CallFrameView.TailDeletedIcon;if(callFrame.programCode) return WebInspector.CallFrameView.ProgramIconStyleClassName; if(callFrame.functionName&&callFrame.functionName.startsWith("on")&&callFrame.functionName.length>=5) return WebInspector.CallFrameView.EventListenerIconStyleClassName;if(callFrame.nativeCode) return WebInspector.CallFrameView.NativeIconStyleClassName;return WebInspector.CallFrameView.FunctionIconStyleClassName;}};WebInspector.CallFrameView.ProgramIconStyleClassName="program-icon";WebInspector.CallFrameView.FunctionIconStyleClassName="function-icon";WebInspector.CallFrameView.EventListenerIconStyleClassName="event-listener-icon";WebInspector.CallFrameView.NativeIconStyleClassName="native-icon";WebInspector.CallFrameView.TailDeletedIcon="tail-deleted";WebInspector.CanvasContentView=class CanvasContentView extends WebInspector.ContentView {constructor(representedObject) {super(representedObject);this.element.classList.add("canvas");this._previewContainerElement=null;this._previewImageElement=null;this._errorElement=null;this._refreshButtonNavigationItem=new WebInspector.ButtonNavigationItem("canvas-refresh",WebInspector.UIString("Refresh"),"Images/ReloadFull.svg",13,13);this._refreshButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._showPreview,this);this._showGridButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("show-grid",WebInspector.UIString("Show Grid"),WebInspector.UIString("Hide Grid"),"Images/NavigationItemCheckers.svg",13,13);this._showGridButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._showGridButtonClicked,this);this._showGridButtonNavigationItem.activated=!!WebInspector.settings.showImageGrid.value;} get navigationItems() {return[this._refreshButtonNavigationItem,this._showGridButtonNavigationItem];} shown() {super.shown();this._showPreview();WebInspector.settings.showImageGrid.addEventListener(WebInspector.Setting.Event.Changed,this._updateImageGrid,this);} hidden() {WebInspector.settings.showImageGrid.removeEventListener(WebInspector.Setting.Event.Changed,this._updateImageGrid,this);super.hidden();} _showPreview() {let showError=()=>{if(this._previewContainerElement) this._previewContainerElement.remove();if(!this._errorElement){const isError=true;this._errorElement=WebInspector.createMessageTextView(WebInspector.UIString("No Preview Available"),isError);} this.element.appendChild(this._errorElement);};if(!this._previewContainerElement){this._previewContainerElement=this.element.appendChild(document.createElement("div"));this._previewContainerElement.classList.add("preview");} this.representedObject.requestContent((content)=>{if(!content){showError();return;} if(this._errorElement) this._errorElement.remove();if(!this._previewImageElement){this._previewImageElement=document.createElement("img");this._previewImageElement.addEventListener("error",showError);} this._previewImageElement.src=content;this._previewContainerElement.appendChild(this._previewImageElement);this._updateImageGrid();});} _updateImageGrid() {if(!this._previewImageElement) return;let activated=WebInspector.settings.showImageGrid.value;this._showGridButtonNavigationItem.activated=activated;this._previewImageElement.classList.toggle("show-grid",activated);} _showGridButtonClicked(event) {WebInspector.settings.showImageGrid.value=!this._showGridButtonNavigationItem.activated;this._updateImageGrid();}};WebInspector.CanvasDetailsSidebarPanel=class CanvasDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel {constructor() {super("canvas",WebInspector.UIString("Canvas"));this.element.classList.add("canvas");this._canvas=null;this._node=null;} inspect(objects) {if(!(objects instanceof Array)) objects=[objects];this.canvas=objects.find((object)=>object instanceof WebInspector.Canvas);return!!this._canvas;} get canvas() {return this._canvas;} set canvas(canvas) {if(canvas===this._canvas) return;if(this._node){this._node.removeEventListener(WebInspector.DOMNode.Event.AttributeModified,this._refreshSourceSection,this);this._node.removeEventListener(WebInspector.DOMNode.Event.AttributeRemoved,this._refreshSourceSection,this);this._node=null;} if(this._canvas){this._canvas.removeEventListener(WebInspector.Canvas.Event.MemoryChanged,this._canvasMemoryChanged,this);this._canvas.removeEventListener(WebInspector.Canvas.Event.CSSCanvasClientNodesChanged,this._refreshCSSCanvasSection,this);} this._canvas=canvas||null;if(this._canvas){this._canvas.addEventListener(WebInspector.Canvas.Event.MemoryChanged,this._canvasMemoryChanged,this);this._canvas.addEventListener(WebInspector.Canvas.Event.CSSCanvasClientNodesChanged,this._refreshCSSCanvasSection,this);} this.needsLayout();} initialLayout() {super.initialLayout();this._nameRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));this._typeRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Type"));this._memoryRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Memory"));this._memoryRow.tooltip=WebInspector.UIString("Memory usage of this canvas");let identitySection=new WebInspector.DetailsSection("canvas-details",WebInspector.UIString("Identity"));identitySection.groups=[new WebInspector.DetailsSectionGroup([this._nameRow,this._typeRow,this._memoryRow])];this.contentView.element.appendChild(identitySection.element);this._nodeRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Node"));this._cssCanvasRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("CSS Canvas"));this._widthRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Width"));this._heightRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Height"));this._datachedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Detached"));let sourceSection=new WebInspector.DetailsSection("canvas-source",WebInspector.UIString("Source"));sourceSection.groups=[new WebInspector.DetailsSectionGroup([this._nodeRow,this._cssCanvasRow,this._widthRow,this._heightRow,this._datachedRow])];this.contentView.element.appendChild(sourceSection.element);this._attributesDataGridRow=new WebInspector.DetailsSectionDataGridRow(null,WebInspector.UIString("No Attributes"));let attributesSection=new WebInspector.DetailsSection("canvas-attributes",WebInspector.UIString("Attributes"));attributesSection.groups=[new WebInspector.DetailsSectionGroup([this._attributesDataGridRow])];this.contentView.element.appendChild(attributesSection.element);this._cssCanvasClientsRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Nodes"));this._cssCanvasSection=new WebInspector.DetailsSection("canvas-css",WebInspector.UIString("CSS"));this._cssCanvasSection.groups=[new WebInspector.DetailsSectionGroup([this._cssCanvasClientsRow])];this._cssCanvasSection.element.hidden=true;this.contentView.element.appendChild(this._cssCanvasSection.element);} layout() {super.layout();if(!this._canvas) return;this._refreshIdentitySection();this._refreshSourceSection();this._refreshAttributesSection();this._refreshCSSCanvasSection();} sizeDidChange() {super.sizeDidChange(); this._attributesDataGridRow.sizeDidChange();} _refreshIdentitySection() {if(!this._canvas) return;this._nameRow.value=this._canvas.displayName;this._typeRow.value=WebInspector.Canvas.displayNameForContextType(this._canvas.contextType);this._formatMemoryRow();} _refreshSourceSection() {if(!this._canvas) return;this._nodeRow.value=this._canvas.cssCanvasName?null:emDash;this._cssCanvasRow.value=this._canvas.cssCanvasName||null;this._widthRow.value=emDash;this._heightRow.value=emDash;this._datachedRow.value=null;this._canvas.requestNode((node)=>{if(!node) return;if(node!==this._node){if(this._node){this._node.removeEventListener(WebInspector.DOMNode.Event.AttributeModified,this._refreshSourceSection,this);this._node.removeEventListener(WebInspector.DOMNode.Event.AttributeRemoved,this._refreshSourceSection,this);this._node=null;} this._node=node;this._node.addEventListener(WebInspector.DOMNode.Event.AttributeModified,this._refreshSourceSection,this);this._node.addEventListener(WebInspector.DOMNode.Event.AttributeRemoved,this._refreshSourceSection,this);} if(!this._canvas.cssCanvasName) this._nodeRow.value=WebInspector.linkifyNodeReference(this._node);let setRowValueIfValidAttributeValue=(row,attribute)=>{let value=Number(this._node.getAttribute(attribute));if(!Number.isInteger(value)||value<0) return false;row.value=value;return true;};let validWidth=setRowValueIfValidAttributeValue(this._widthRow,"width");let validHeight=setRowValueIfValidAttributeValue(this._heightRow,"height");if(!validWidth||!validHeight){ WebInspector.RemoteObject.resolveNode(node,"",(remoteObject)=>{if(!remoteObject) return;function setRowValueToPropertyValue(row,property){remoteObject.getProperty(property,(error,result,wasThrown)=>{if(!error&&result.type==="number") row.value=`${result.value}px`;});} setRowValueToPropertyValue(this._widthRow,"width");setRowValueToPropertyValue(this._heightRow,"height");remoteObject.release();});} if(!this._canvas.cssCanvasName&&!this._node.parentNode) this._datachedRow.value=WebInspector.UIString("Yes");});} _refreshAttributesSection() {if(!this._canvas) return;if(isEmptyObject(this._canvas.contextAttributes)){this._attributesDataGridRow.dataGrid=null;return;} let dataGrid=this._attributesDataGridRow.dataGrid;if(!dataGrid){dataGrid=this._attributesDataGridRow.dataGrid=new WebInspector.DataGrid({name:{title:WebInspector.UIString("Name")},value:{title:WebInspector.UIString("Value"),width:"30%"},});} dataGrid.removeChildren();for(let attribute in this._canvas.contextAttributes){let data={name:attribute,value:this._canvas.contextAttributes[attribute]};let dataGridNode=new WebInspector.DataGridNode(data);dataGrid.appendChild(dataGridNode);} dataGrid.updateLayoutIfNeeded();} _refreshCSSCanvasSection() {if(!this._canvas) return;if(!this._canvas.cssCanvasName){this._cssCanvasSection.element.hidden=true;return;} this._cssCanvasClientsRow.value=emDash;this._cssCanvasSection.element.hidden=false;this._canvas.requestCSSCanvasClientNodes((cssCanvasClientNodes)=>{if(!cssCanvasClientNodes.length) return;let fragment=document.createDocumentFragment();for(let clientNode of cssCanvasClientNodes) fragment.appendChild(WebInspector.linkifyNodeReference(clientNode));this._cssCanvasClientsRow.value=fragment;});} _formatMemoryRow() {if(!this._canvas.memoryCost||isNaN(this._canvas.memoryCost)){this._memoryRow.value=emDash;return;} this._memoryRow.value=Number.bytesToString(this._canvas.memoryCost);} _canvasMemoryChanged(event) {this._formatMemoryRow();}};WebInspector.CanvasTreeElement=class CanvasTreeElement extends WebInspector.GeneralTreeElement {constructor(representedObject) {const subtitle=null;super(["canvas",representedObject.contextType],representedObject.displayName,subtitle,representedObject);} onattach() {super.onattach();this.element.addEventListener("mouseover",this._handleMouseOver.bind(this));this.element.addEventListener("mouseout",this._handleMouseOut.bind(this));} populateContextMenu(contextMenu,event) {super.populateContextMenu(contextMenu,event);contextMenu.appendItem(WebInspector.UIString("Log Canvas Context"),()=>{WebInspector.RemoteObject.resolveCanvasContext(this.representedObject,WebInspector.RuntimeManager.ConsoleObjectGroup,(remoteObject)=>{if(!remoteObject) return;const text=WebInspector.UIString("Selected Canvas Context");const addSpecialUserLogClass=true;WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text,remoteObject,addSpecialUserLogClass);});});contextMenu.appendSeparator();} _handleMouseOver(event) {if(this.representedObject.cssCanvasName){this.representedObject.requestCSSCanvasClientNodes((cssCanvasClientNodes)=>{WebInspector.domTreeManager.highlightDOMNodeList(cssCanvasClientNodes.map((node)=>node.id),"all");});}else{this.representedObject.requestNode((node)=>{if(!node||!node.ownerDocument) return;WebInspector.domTreeManager.highlightDOMNode(node.id,"all");});}} _handleMouseOut(event) {WebInspector.domTreeManager.hideDOMNodeHighlight();}};WebInspector.ChartDetailsSectionRow=class ChartDetailsSectionRow extends WebInspector.DetailsSectionRow {constructor(delegate,chartSize,innerRadiusRatio) {super(WebInspector.UIString("No Chart Available"));innerRadiusRatio=innerRadiusRatio||0;this.element.classList.add("chart");this._titleElement=document.createElement("div");this._titleElement.className="title";this.element.appendChild(this._titleElement);let chartContentElement=document.createElement("div");chartContentElement.className="chart-content";this.element.appendChild(chartContentElement);this._chartElement=createSVGElement("svg");chartContentElement.appendChild(this._chartElement);this._legendElement=document.createElement("div");this._legendElement.className="legend";chartContentElement.appendChild(this._legendElement);this._delegate=delegate;this._items=new Map;this._title="";this._chartSize=chartSize;this._radius=(this._chartSize/2)-1;this._innerRadius=innerRadiusRatio?Math.floor(this._radius*innerRadiusRatio):0;this._total=0;this._svgFiltersElement=document.createElement("svg");this._svgFiltersElement.classList.add("defs-only");this.element.append(this._svgFiltersElement);this._checkboxStyleElement=document.createElement("style");this._checkboxStyleElement.id="checkbox-styles";document.getElementsByTagName("head")[0].append(this._checkboxStyleElement);function createEmptyChartPathData(c,r1,r2) {const a1=0;const a2=Math.PI*1.9999;let x1=c+Math.cos(a1)*r1,y1=c+Math.sin(a1)*r1,x2=c+Math.cos(a2)*r1,y2=c+Math.sin(a2)*r1,x3=c+Math.cos(a2)*r2,y3=c+Math.sin(a2)*r2,x4=c+Math.cos(a1)*r2,y4=c+Math.sin(a1)*r2;return["M",x1,y1,"A",r1,r1,0,1,1,x2,y2,"Z","M",x3,y3,"A",r2,r2,0,1,0,x4,y4,"Z"].join(" ");} this._emptyChartPath=createSVGElement("path");this._emptyChartPath.setAttribute("d",createEmptyChartPathData(this._chartSize/2,this._radius,this._innerRadius));this._emptyChartPath.classList.add("empty-chart");this._chartElement.appendChild(this._emptyChartPath);} get chartSize() {return this._chartSize;} set title(title) {if(this._title===title) return;this._title=title;this._titleElement.textContent=title;} get total() {return this._total;} addItem(id,label,value,color,checkbox,checked) {if(this._items.has(id)) return;if(value<0) return;this._items.set(id,{label,value,color,checkbox,checked});this._total+=value;this._needsLayout();} setItemValue(id,value) {let item=this._items.get(id);if(!item) return;if(value<0) return;if(item.value===value) return;this._total+=value-item.value;item.value=value;this._needsLayout();} clearItems() {for(let item of this._items.values()){let path=item[WebInspector.ChartDetailsSectionRow.ChartSegmentPathSymbol];if(path) path.remove();} this._total=0;this._items.clear();this._needsLayout();} _addCheckboxColorFilter(id,r,g,b) {for(let i=0;i .content > .group > .row.chart > .chart-content > .legend > .legend-item > label > input[type=checkbox]."+id+" { filter: grayscale(1) url(#"+id+") }",0);} _updateLegend() {if(!this._items.size){this._legendElement.removeChildren();return;} function formatItemValue(item) {if(this._delegate&&typeof this._delegate.formatChartValue==="function") return this._delegate.formatChartValue(item.value);return item.value;} for(let[id,item]of this._items){if(item[WebInspector.ChartDetailsSectionRow.LegendItemValueElementSymbol]){let valueElement=item[WebInspector.ChartDetailsSectionRow.LegendItemValueElementSymbol];valueElement.textContent=formatItemValue.call(this,item);continue;} let labelElement=document.createElement("label");let keyElement;if(item.checkbox){let className=id.toLowerCase();let rgb=item.color.substring(4,item.color.length-1).replace(/ /g,"").split(",");if(rgb[0]===rgb[1]&&rgb[1]===rgb[2]) rgb[0]=rgb[1]=rgb[2]=Math.min(160,rgb[0]);keyElement=document.createElement("input");keyElement.type="checkbox";keyElement.classList.add(className);keyElement.checked=item.checked;keyElement[WebInspector.ChartDetailsSectionRow.DataItemIdSymbol]=id;keyElement.addEventListener("change",this._legendItemCheckboxValueChanged.bind(this));this._addCheckboxColorFilter(className,rgb[0],rgb[1],rgb[2]);}else{keyElement=document.createElement("div");keyElement.classList.add("color-key");keyElement.style.backgroundColor=item.color;} labelElement.append(keyElement,item.label);let valueElement=document.createElement("div");valueElement.classList.add("value");valueElement.textContent=formatItemValue.call(this,item);item[WebInspector.ChartDetailsSectionRow.LegendItemValueElementSymbol]=valueElement;let legendItemElement=document.createElement("div");legendItemElement.classList.add("legend-item");legendItemElement.append(labelElement,valueElement);this._legendElement.append(legendItemElement);}} _legendItemCheckboxValueChanged(event) {let checkbox=event.target;let id=checkbox[WebInspector.ChartDetailsSectionRow.DataItemIdSymbol];this.dispatchEventToListeners(WebInspector.ChartDetailsSectionRow.Event.LegendItemChecked,{id,checked:checkbox.checked});} _needsLayout() {if(this._scheduledLayoutUpdateIdentifier) return;this._scheduledLayoutUpdateIdentifier=requestAnimationFrame(this._updateLayout.bind(this));} _updateLayout() {if(this._scheduledLayoutUpdateIdentifier){cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);this._scheduledLayoutUpdateIdentifier=undefined;} this._updateLegend();this._chartElement.setAttribute("width",this._chartSize);this._chartElement.setAttribute("height",this._chartSize);this._chartElement.setAttribute("viewbox","0 0 "+this._chartSize+" "+this._chartSize);function createSegmentPathData(c,a1,a2,r1,r2) {const largeArcFlag=((a2-a1)%(Math.PI*2))>Math.PI?1:0;let x1=c+Math.cos(a1)*r1,y1=c+Math.sin(a1)*r1,x2=c+Math.cos(a2)*r1,y2=c+Math.sin(a2)*r1,x3=c+Math.cos(a2)*r2,y3=c+Math.sin(a2)*r2,x4=c+Math.cos(a1)*r2,y4=c+Math.sin(a1)*r2;return["M",x1,y1,"A",r1,r1,0,largeArcFlag,1,x2,y2,"L",x3,y3,"A",r2,r2,0,largeArcFlag,0,x4,y4,"Z"].join(" ");} const minimumDisplayValue=this._total*0.015;let items=[];for(let item of this._items.values()){item.displayValue=item.value?Math.max(minimumDisplayValue,item.value):0;if(item.displayValue) items.push(item);} if(items.length>1){items.sort(function(a,b){return a.value-b.value;});let largeItemCount=items.length;let totalAdjustedValue=0;for(let item of items){if(item.value=minimumDisplayValue){item.displayValue-=donatedValue;totalAdjustedValue-=donatedValue;} largeItemCount--;}} const center=this._chartSize/2;let startAngle=-Math.PI/2;let endAngle=0;for(let[id,item]of this._items){let path=item[WebInspector.ChartDetailsSectionRow.ChartSegmentPathSymbol];if(!path){path=createSVGElement("path");path.classList.add("chart-segment");path.setAttribute("fill",item.color);this._chartElement.appendChild(path);item[WebInspector.ChartDetailsSectionRow.ChartSegmentPathSymbol]=path;} if(!item.value){path.classList.add("hidden");continue;} const angle=(item.displayValue/this._total)*Math.PI*2;endAngle=startAngle+angle;path.setAttribute("d",createSegmentPathData(center,startAngle,endAngle,this._radius,this._innerRadius));path.classList.remove("hidden");startAngle=endAngle;}}};WebInspector.ChartDetailsSectionRow.DataItemIdSymbol=Symbol("chart-details-section-row-data-item-id");WebInspector.ChartDetailsSectionRow.ChartSegmentPathSymbol=Symbol("chart-details-section-row-chart-segment-path");WebInspector.ChartDetailsSectionRow.LegendItemValueElementSymbol=Symbol("chart-details-section-row-legend-item-value-element");WebInspector.ChartDetailsSectionRow.Event={LegendItemChecked:"chart-details-section-row-legend-item-checked"}; WebInspector.CircleChart=class CircleChart {constructor({size,innerRadiusRatio}) {this._data=[];this._size=size;this._radius=(size/2)-1;this._innerRadius=innerRadiusRatio?Math.floor(this._radius*innerRadiusRatio):0;this._element=document.createElement("div");this._element.classList.add("circle-chart");this._chartElement=this._element.appendChild(createSVGElement("svg"));this._chartElement.setAttribute("width",size);this._chartElement.setAttribute("height",size);this._chartElement.setAttribute("viewbox",`0 0 ${size} ${size}`);this._pathElements=[];this._values=[];this._total=0;let backgroundPath=this._chartElement.appendChild(createSVGElement("path"));backgroundPath.setAttribute("d",this._createCompleteCirclePathData(this.size/2,this._radius,this._innerRadius));backgroundPath.classList.add("background");} get element(){return this._element;} get points(){return this._points;} get size(){return this._size;} get centerElement() {if(!this._centerElement){this._centerElement=this._element.appendChild(document.createElement("div"));this._centerElement.classList.add("center");this._centerElement.style.width=this._centerElement.style.height=this._radius+"px";this._centerElement.style.top=this._centerElement.style.left=(this._radius-this._innerRadius)+"px";} return this._centerElement;} get segments() {return this._segments;} set segments(segmentClassNames) {for(let pathElement of this._pathElements) pathElement.remove();this._pathElements=[];for(let className of segmentClassNames){let pathElement=this._chartElement.appendChild(createSVGElement("path"));pathElement.classList.add("segment",className);this._pathElements.push(pathElement);}} get values() {return this._values;} set values(values) {this._values=values;this._total=0;for(let value of values) this._total+=value;} clear() {this.values=new Array(this._values.length).fill(0);} needsLayout() {if(this._scheduledLayoutUpdateIdentifier) return;this._scheduledLayoutUpdateIdentifier=requestAnimationFrame(this.updateLayout.bind(this));} updateLayout() {if(this._scheduledLayoutUpdateIdentifier){cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);this._scheduledLayoutUpdateIdentifier=undefined;} if(!this._values.length) return;const center=this._size/2;let startAngle=-Math.PI/2;let endAngle=0;for(let i=0;iMath.PI?1:0;let x1=c+Math.cos(a1)*r1,y1=c+Math.sin(a1)*r1,x2=c+Math.cos(a2)*r1,y2=c+Math.sin(a2)*r1,x3=c+Math.cos(a2)*r2,y3=c+Math.sin(a2)*r2,x4=c+Math.cos(a1)*r2,y4=c+Math.sin(a1)*r2;return["M",x1,y1,"A",r1,r1,0,largeArcFlag,1,x2,y2,"L",x3,y3,"A",r2,r2,0,largeArcFlag,0,x4,y4,"Z"].join(" ");}};WebInspector.ClusterContentView=class ClusterContentView extends WebInspector.ContentView {constructor(representedObject) {super(representedObject);this.element.classList.add("cluster");this._contentViewContainer=new WebInspector.ContentViewContainer;this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange,this._currentContentViewDidChange,this);this.addSubview(this._contentViewContainer);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange,this._contentViewSelectionPathComponentDidChange,this);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange,this._contentViewSupplementalRepresentedObjectsDidChange,this);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange,this._contentViewNumberOfSearchResultsDidChange,this);} get navigationItems() {var currentContentView=this._contentViewContainer.currentContentView;return currentContentView?currentContentView.navigationItems:[];} get contentViewContainer() {return this._contentViewContainer;} get supportsSplitContentBrowser() {if(this._contentViewContainer.currentContentView) return this._contentViewContainer.currentContentView.supportsSplitContentBrowser;return super.supportsSplitContentBrowser;} shown() {super.shown();this._contentViewContainer.shown();} hidden() {super.hidden();this._contentViewContainer.hidden();} closed() {super.closed();this._contentViewContainer.closeAllContentViews();WebInspector.ContentView.removeEventListener(null,null,this);} canGoBack() {return this._contentViewContainer.canGoBack();} canGoForward() {return this._contentViewContainer.canGoForward();} goBack() {this._contentViewContainer.goBack();} goForward() {this._contentViewContainer.goForward();} get scrollableElements() {if(!this._contentViewContainer.currentContentView) return[];return this._contentViewContainer.currentContentView.scrollableElements;} get selectionPathComponents() {if(!this._contentViewContainer.currentContentView) return[];return this._contentViewContainer.currentContentView.selectionPathComponents;} get supplementalRepresentedObjects() {if(!this._contentViewContainer.currentContentView) return[];return this._contentViewContainer.currentContentView.supplementalRepresentedObjects;} get handleCopyEvent() {var currentContentView=this._contentViewContainer.currentContentView;return currentContentView&&typeof currentContentView.handleCopyEvent==="function"?currentContentView.handleCopyEvent.bind(currentContentView):null;} get supportsSave() {var currentContentView=this._contentViewContainer.currentContentView;return currentContentView&¤tContentView.supportsSave;} get saveData() {var currentContentView=this._contentViewContainer.currentContentView;return currentContentView&¤tContentView.saveData||null;} get supportsSearch() {return true;} get numberOfSearchResults() {var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return null;return currentContentView.numberOfSearchResults;} get hasPerformedSearch() {var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return false;return currentContentView.hasPerformedSearch;} set automaticallyRevealFirstSearchResult(reveal) {var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return;currentContentView.automaticallyRevealFirstSearchResult=reveal;} performSearch(query) {this._searchQuery=query;var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return;currentContentView.performSearch(query);} searchCleared() {this._searchQuery=null;var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return;currentContentView.searchCleared();} searchQueryWithSelection() {var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return null;return currentContentView.searchQueryWithSelection();} revealPreviousSearchResult(changeFocus) {var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return;currentContentView.revealPreviousSearchResult(changeFocus);} revealNextSearchResult(changeFocus) {var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch) return;currentContentView.revealNextSearchResult(changeFocus);} _currentContentViewDidChange(event) {var currentContentView=this._contentViewContainer.currentContentView;if(currentContentView&¤tContentView.supportsSearch){if(this._searchQuery) currentContentView.performSearch(this._searchQuery);else currentContentView.searchCleared();} this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);} _contentViewSelectionPathComponentDidChange(event) {if(event.target!==this._contentViewContainer.currentContentView) return;this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);} _contentViewSupplementalRepresentedObjectsDidChange(event) {if(event.target!==this._contentViewContainer.currentContentView) return;this.dispatchEventToListeners(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange);} _contentViewNumberOfSearchResultsDidChange(event) {if(event.target!==this._contentViewContainer.currentContentView) return;this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);}};(function(){ function tokenizeLinkString(stream,state) {if(state._linkQuoteCharacter) stream.eatWhile(new RegExp("[^"+state._linkQuoteCharacter+"]"));else stream.eatWhile(/[^\s\u00a0=<>\"\']/);if(!stream.eol()) state._linkTokenize=tokenizeEndOfLinkString;return"link";} function tokenizeEndOfLinkString(stream,state) {if(state._linkQuoteCharacter) stream.eat(state._linkQuoteCharacter);var style=state._linkBaseStyle;delete state._linkTokenize;delete state._linkQuoteCharacter;delete state._linkBaseStyle;delete state._srcSetTokenizeState;return style;} function tokenizeSrcSetString(stream,state) {if(state._srcSetTokenizeState==="link"){if(state._linkQuoteCharacter) stream.eatWhile(new RegExp("[^\\s,"+state._linkQuoteCharacter+"]"));else stream.eatWhile(/[^\s,\u00a0=<>\"\']/);}else{stream.eatSpace();if(state._linkQuoteCharacter) stream.eatWhile(new RegExp("[^,"+state._linkQuoteCharacter+"]"));else stream.eatWhile(/[^\s\u00a0=<>\"\']/);stream.eatWhile(/[\s,]/);} if(stream.eol()||(!state._linkQuoteCharacter||stream.peek()===state._linkQuoteCharacter)) state._linkTokenize=tokenizeEndOfLinkString;if(state._srcSetTokenizeState==="link"){state._srcSetTokenizeState="descriptor";return"link";} state._srcSetTokenizeState="link";return state._linkBaseStyle;} function extendedXMLToken(stream,state) {if(state._linkTokenize){var style=state._linkTokenize(stream,state);return style&&(style+" m-"+this.name);} var startPosition=stream.pos;var style=this._token(stream,state);if(style==="attribute"){ var text=stream.current().toLowerCase();if(text==="src"||/\bhref\b/.test(text)) state._expectLink=true;else if(text==="srcset") state._expectSrcSet=true;else{delete state._expectLink;delete state._expectSrcSet;}}else if(state._expectLink&&style==="string"){var current=stream.current(); if(current!=="\"\""&¤t!=="''"){delete state._expectLink;state._linkTokenize=tokenizeLinkString;state._linkBaseStyle=style;var quote=current[0];state._linkQuoteCharacter=quote==="'"||quote==="\""?quote:null;stream.pos=startPosition; if(state._linkQuoteCharacter) stream.eat(state._linkQuoteCharacter);}}else if(state._expectSrcSet&&style==="string"){var current=stream.current(); if(current!=="\"\""&¤t!=="''"){delete state._expectSrcSet;state._srcSetTokenizeState="link";state._linkTokenize=tokenizeSrcSetString;state._linkBaseStyle=style;var quote=current[0];state._linkQuoteCharacter=quote==="'"||quote==="\""?quote:null;stream.pos=startPosition; if(state._linkQuoteCharacter) stream.eat(state._linkQuoteCharacter);}}else if(style){ delete state._expectLink;delete state._expectSrcSet;} return style&&(style+" m-"+this.name);} function tokenizeCSSURLString(stream,state) {if(state._unquotedURLString&&stream.eatSpace()) return null;var ch=null;var escaped=false;var reachedEndOfURL=false;var lastNonWhitespace=stream.pos;var quote=state._urlQuoteCharacter;while((ch=stream.next())!=null){if(ch===quote&&!escaped){reachedEndOfURL=true;break;} escaped=!escaped&&ch==="\\";if(!/[\s\u00a0]/.test(ch)) lastNonWhitespace=stream.pos;} if(state._unquotedURLString) stream.pos=lastNonWhitespace;if(reachedEndOfURL){if(!state._unquotedURLString) stream.backUp(1);this._urlTokenize=tokenizeEndOfCSSURLString;} return"link";} function tokenizeEndOfCSSURLString(stream,state) {if(!state._unquotedURLString) stream.eat(state._urlQuoteCharacter);var style=state._urlBaseStyle;delete state._urlTokenize;delete state._urlQuoteCharacter;delete state._urlBaseStyle;return style;} function extendedCSSToken(stream,state) {var hexColorRegex=/#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{3,4})\b/g;if(state._urlTokenize){var style=state._urlTokenize(stream,state);return style&&(style+" m-"+(this.alternateName||this.name));} var startPosition=stream.pos;var style=this._token(stream,state);if(style){if(style==="atom"){if(stream.current()==="url"){state._expectLink=true;}else if(hexColorRegex.test(stream.current())) style=style+" hex-color";}else if(state._expectLink){delete state._expectLink;if(style==="string"){state._urlTokenize=tokenizeCSSURLString;state._urlBaseStyle=style;var quote=stream.current()[0];state._urlQuoteCharacter=quote==="'"||quote==="\""?quote:")";state._unquotedURLString=state._urlQuoteCharacter===")";stream.pos=startPosition; if(!state._unquotedURLString) stream.eat(state._urlQuoteCharacter);}}} return style&&(style+" m-"+(this.alternateName||this.name));} function extendedToken(stream,state) {var style=this._token(stream,state);return style&&(style+" m-"+(this.alternateName||this.name));} function extendedCSSRuleStartState(base) {var state=this._startState(base); state.state="block";state.context.type="block";return state;} function scrollCursorIntoView(codeMirror,event) { event.preventDefault();function delayedWork() {if(!codeMirror.getWrapperElement().classList.contains("CodeMirror-focused")) return;var cursorElement=codeMirror.getScrollerElement().getElementsByClassName("CodeMirror-cursor")[0];if(cursorElement) cursorElement.scrollIntoViewIfNeeded(false);} setTimeout(delayedWork,0);} CodeMirror.extendMode("css",{token:extendedCSSToken});CodeMirror.extendMode("xml",{token:extendedXMLToken});CodeMirror.extendMode("javascript",{token:extendedToken});CodeMirror.defineMode("css-rule",CodeMirror.modes.css);CodeMirror.extendMode("css-rule",{token:extendedCSSToken,startState:extendedCSSRuleStartState,alternateName:"css"});CodeMirror.defineInitHook(function(codeMirror){codeMirror.on("scrollCursorIntoView",scrollCursorIntoView);});const maximumNeighboringWhitespaceCharacters=16;CodeMirror.defineOption("showWhitespaceCharacters",false,function(cm,value,old){if(!value||(old&&old!==CodeMirror.Init)){cm.removeOverlay("whitespace");return;} cm.addOverlay({name:"whitespace",token(stream){if(stream.peek()===" "){let count=0;while(count=0;--i){var character=line.charAt(i);if(character==="."){if(foundPeriod) break;foundPeriod=true;}else if(character!=="-"&&character!=="+"&&isNaN(parseInt(character))){if(i===startPosition.ch){end=i;continue;} break;} start=i;} if(isNaN(end)){for(var i=startPosition.ch+1;ifrom.ch) selectionStart.ch+=diff;if(selectionEnd.ch>from.ch) selectionEnd.ch+=diff;} this.setSelection(selectionStart,selectionEnd);} return true;});function alterNumber(amount,codeMirror) {function findNumberToken(position) { var token=codeMirror.getTokenAt(position);if(token&&token.type&&/\bnumber\b/.test(token.type)) return token;return null;} var position=codeMirror.getCursor("head");var token=findNumberToken(position);if(!token){ position.ch+=1;token=findNumberToken(position);} if(!token) return CodeMirror.Pass;var foundNumber=codeMirror.alterNumberInRange(amount,{ch:token.start,line:position.line},{ch:token.end,line:position.line},true);if(!foundNumber) return CodeMirror.Pass;} CodeMirror.defineExtension("rectsForRange",function(range){var lineRects=[];for(var line=range.start.line;line<=range.end.line;++line){var lineContent=this.getLine(line);var startChar=line===range.start.line?range.start.ch:(lineContent.length-lineContent.trimLeft().length);var endChar=line===range.end.line?range.end.ch:lineContent.length;var firstCharCoords=this.cursorCoords({ch:startChar,line});var endCharCoords=this.cursorCoords({ch:endChar,line});if(firstCharCoords.bottom!==endCharCoords.bottom){var maxY=-Number.MAX_VALUE;for(var ch=startChar;ch<=endChar;++ch){var coords=this.cursorCoords({ch,line});if(coords.bottom>maxY){if(ch>startChar){var maxX=Math.ceil(this.cursorCoords({ch:ch-1,line}).right);lineRects.push(new WebInspector.Rect(minX,minY,maxX-minX,maxY-minY));} var minX=Math.floor(coords.left);var minY=Math.floor(coords.top);maxY=Math.ceil(coords.bottom);}} maxX=Math.ceil(coords.right);lineRects.push(new WebInspector.Rect(minX,minY,maxX-minX,maxY-minY));}else{var minX=Math.floor(firstCharCoords.left);var minY=Math.floor(firstCharCoords.top);var maxX=Math.ceil(endCharCoords.right);var maxY=Math.ceil(endCharCoords.bottom);lineRects.push(new WebInspector.Rect(minX,minY,maxX-minX,maxY-minY));}} return lineRects;});let mac=WebInspector.Platform.name==="mac";CodeMirror.keyMap["default"]={"Alt-Up":alterNumber.bind(null,1),"Ctrl-Alt-Up":alterNumber.bind(null,0.1),"Shift-Alt-Up":alterNumber.bind(null,10),"Alt-PageUp":alterNumber.bind(null,10),"Shift-Alt-PageUp":alterNumber.bind(null,100),"Alt-Down":alterNumber.bind(null,-1),"Ctrl-Alt-Down":alterNumber.bind(null,-0.1),"Shift-Alt-Down":alterNumber.bind(null,-10),"Alt-PageDown":alterNumber.bind(null,-10),"Shift-Alt-PageDown":alterNumber.bind(null,-100),"Cmd-/":"toggleComment","Cmd-D":"selectNextOccurrence","Shift-Tab":"indentLess",fallthrough:mac?"macDefault":"pcDefault"}; var extraXMLTypes=["text/xml","text/xsl"];extraXMLTypes.forEach(function(type){CodeMirror.defineMIME(type,"xml");});var extraHTMLTypes=["application/xhtml+xml","image/svg+xml"];extraHTMLTypes.forEach(function(type){CodeMirror.defineMIME(type,"htmlmixed");});var extraJavaScriptTypes=["text/ecmascript","application/javascript","application/ecmascript","application/x-javascript","text/x-javascript","text/javascript1.1","text/javascript1.2","text/javascript1.3","text/jscript","text/livescript"];extraJavaScriptTypes.forEach(function(type){CodeMirror.defineMIME(type,"javascript");});var extraJSONTypes=["application/x-json","text/x-json","application/vnd.api+json"];extraJSONTypes.forEach(function(type){CodeMirror.defineMIME(type,{name:"javascript",json:true});});})();WebInspector.compareCodeMirrorPositions=function(a,b) {var lineCompare=a.line-b.line;if(lineCompare!==0) return lineCompare;var aColumn="ch"in a?a.ch:Number.MAX_VALUE;var bColumn="ch"in b?b.ch:Number.MAX_VALUE;return aColumn-bColumn;};WebInspector.walkTokens=function(cm,mode,initialPosition,callback) {let state=CodeMirror.copyState(mode,cm.getTokenAt(initialPosition).state);if(state.localState) state=state.localState;let lineCount=cm.lineCount();let abort=false;for(let lineNumber=initialPosition.line;!abort&&lineNumber{codeMirror.scrollIntoView({line:0,ch:0});},"End":()=>{codeMirror.scrollIntoView({line:codeMirror.lineCount()-1,ch:null});},});} new WebInspector.CodeMirrorTextKillController(codeMirror);return codeMirror;}}; CodeMirror.extendMode("javascript",{shouldHaveSpaceBeforeToken:function(lastToken,lastContent,token,state,content,isComment) {if(!token){if(content==="(") return lastToken&&/\bkeyword\b/.test(lastToken)&&(lastContent!=="function"&&lastContent!=="typeof"&&lastContent!=="instanceof");if(content===":") return state.lexical.type==="stat"||state.lexical.type===")"||state.lexical.type==="]";return false;} if(isComment) return true;if(/\boperator\b/.test(token)){if(!lastToken&&(content==="+"||content==="-"||content==="~")&&(lastContent!==")"&&lastContent!=="]")) return false;if(content==="!") return false;return"+-/*%&&||!===+=-=>=<=?".indexOf(content)>=0;} if(/\bkeyword\b/.test(token)){if(content==="else"||content==="catch"||content==="finally") return lastContent==="}";if(content==="while"&&lastContent==="}") return state._jsPrettyPrint.lastContentBeforeBlock==="do";return false;} return false;},shouldHaveSpaceAfterLastToken:function(lastToken,lastContent,token,state,content,isComment) {if(lastToken&&/\bkeyword\b/.test(lastToken)){if(lastContent==="else") return true;if(lastContent==="catch") return true;if(lastContent==="return") return content!==";";if(lastContent==="throw") return true;if(lastContent==="try") return true;if(lastContent==="finally") return true;if(lastContent==="do") return true;return false;} if(lastToken&&/\bcomment\b/.test(lastToken)) return true;if(lastContent===")") return content==="{";if(lastContent===";") return state.lexical.type===")";if(lastContent==="!") return false;if((lastContent==="+"||lastContent==="-"||lastContent==="~")&&!state._jsPrettyPrint.unaryOperatorHadLeadingExpr) return false;return",+-/*%&&||:!===+=-=>=<=?".indexOf(lastContent)>=0;},newlinesAfterToken:function(lastToken,lastContent,token,state,content,isComment) {if(!token){if(content===",") return state.lexical.type==="}"?1:0;if(content===";") return state.lexical.type!==")"?1:0;if(content===":"&&state.lexical.type==="}"&&state.lexical.prev&&state.lexical.prev.type==="form") return 1;return content.length===1&&"{}".indexOf(content)>=0?1:0;} if(isComment) return 1;return 0;},removeLastWhitespace:function(lastToken,lastContent,token,state,content,isComment) {return false;},removeLastNewline:function(lastToken,lastContent,token,state,content,isComment,firstTokenOnLine) {if(!token){if(content==="}") return lastContent==="{";if(content===";") return"};".indexOf(lastContent)>=0;if(content===":") return lastContent==="}"&&(state.lexical.type==="stat"||state.lexical.type===")"||state.lexical.type==="]");if(",().".indexOf(content)>=0) return lastContent==="}";return false;} if(isComment){if(!firstTokenOnLine&&lastContent===";") return true;return false;} if(/\bkeyword\b/.test(token)){if(content==="else"||content==="catch"||content==="finally") return lastContent==="}";if(content==="while"&&lastContent==="}") return state._jsPrettyPrint.lastContentBeforeBlock==="do";return false;} return false;},indentAfterToken:function(lastToken,lastContent,token,state,content,isComment) {if(content==="{") return true;if(content==="case"||content==="default") return state.lexical.type==="}"&&state.lexical.prev&&state.lexical.prev.type==="form";return false;},newlineBeforeToken:function(lastToken,lastContent,token,state,content,isComment) {if(state._jsPrettyPrint.shouldIndent) return true;return content==="}"&&lastContent!=="{";},indentBeforeToken:function(lastToken,lastContent,token,state,content,isComment) {if(state._jsPrettyPrint.shouldIndent) return true;return false;},dedentsBeforeToken:function(lastToken,lastContent,token,state,content,isComment) {var dedent=0;if(state._jsPrettyPrint.shouldDedent) dedent+=state._jsPrettyPrint.dedentSize;if(!token&&content==="}") dedent+=1;else if(token&&/\bkeyword\b/.test(token)&&(content==="case"||content==="default")) dedent+=1;return dedent;},modifyStateForTokenPre:function(lastToken,lastContent,token,state,content,isComment) {if(!state._jsPrettyPrint){state._jsPrettyPrint={indentCount:0,shouldIndent:false,shouldDedent:false,dedentSize:0,lastIfIndentCount:0,openBraceStartMarkers:[],openBraceTrackingCount:-1,unaryOperatorHadLeadingExpr:false,lastContentBeforeBlock:undefined,};} if(!isComment&&state.lexical.prev&&state.lexical.prev.type==="form"&&!state.lexical.prev._jsPrettyPrintMarker&&(lastContent===")"||lastContent==="else"||lastContent==="do")&&(state.lexical.type!==")")){if(content==="{"){var savedState={indentCount:state._jsPrettyPrint.indentCount,openBraceTrackingCount:state._jsPrettyPrint.openBraceTrackingCount,lastContentBeforeBlock:lastContent};state._jsPrettyPrint.openBraceStartMarkers.push(savedState);state._jsPrettyPrint.openBraceTrackingCount=1;}else if(state.lexical.type!=="}"){if(!(lastContent==="else"&&content==="if")){state._jsPrettyPrint.indentCount++;state._jsPrettyPrint.shouldIndent=true;} state.lexical.prev._jsPrettyPrintMarker=true;if(state._jsPrettyPrint.enteringIf) state._jsPrettyPrint.lastIfIndentCount=state._jsPrettyPrint.indentCount-1;}} else{if(!isComment){if(content==="{") state._jsPrettyPrint.openBraceTrackingCount++;else if(content==="}") state._jsPrettyPrint.openBraceTrackingCount--;} if(content===";"){}else if(content==="else"){if(lastContent!=="}"){state._jsPrettyPrint.shouldDedent=true;state._jsPrettyPrint.dedentSize=state._jsPrettyPrint.indentCount-state._jsPrettyPrint.lastIfIndentCount;state._jsPrettyPrint.lastIfIndentCount=0;}}else if(content==="}"&&!state._jsPrettyPrint.openBraceTrackingCount&&state._jsPrettyPrint.openBraceStartMarkers.length){var savedState=state._jsPrettyPrint.openBraceStartMarkers.pop();state._jsPrettyPrint.shouldDedent=true;state._jsPrettyPrint.dedentSize=state._jsPrettyPrint.indentCount-savedState.indentCount;state._jsPrettyPrint.openBraceTrackingCount=savedState.openBraceTrackingCount;state._jsPrettyPrint.lastContentBeforeBlock=savedState.lastContentBeforeBlock;}else{var shouldDedent=true;var lexical=state.lexical.prev;while(lexical){if(lexical._jsPrettyPrintMarker){shouldDedent=false;break;} lexical=lexical.prev;} if(shouldDedent){state._jsPrettyPrint.shouldDedent=true;state._jsPrettyPrint.dedentSize=state._jsPrettyPrint.indentCount;}}} if(token&&state.lexical.type==="form"&&state.lexical.prev&&state.lexical.prev!=="form"&&/\bkeyword\b/.test(token)) state._jsPrettyPrint.enteringIf=(content==="if");},modifyStateForTokenPost:function(lastToken,lastContent,token,state,content,isComment) {if(state._jsPrettyPrint.shouldIndent) state._jsPrettyPrint.shouldIndent=false;if(state._jsPrettyPrint.shouldDedent){state._jsPrettyPrint.indentCount-=state._jsPrettyPrint.dedentSize;state._jsPrettyPrint.dedentSize=0;state._jsPrettyPrint.shouldDedent=false;} if((content==="+"||content==="-"||content==="~")&&(lastContent===")"||lastContent==="]"||/\b(?:variable|number)\b/.test(lastToken))) state._jsPrettyPrint.unaryOperatorHadLeadingExpr=true;else state._jsPrettyPrint.unaryOperatorHadLeadingExpr=false;}});CodeMirror.extendMode("css",{shouldHaveSpaceBeforeToken:function(lastToken,lastContent,token,state,content,isComment) {if(!token){if(content==="{") return true;return">+~-*/".indexOf(content)>=0;} if(isComment) return true;if(/\bkeyword\b/.test(token)){if(content.charAt(0)==="!") return true;return false;} return false;},shouldHaveSpaceAfterLastToken:function(lastToken,lastContent,token,state,content,isComment) {if(!lastToken){if(lastContent===",") return true;if(lastContent===":") return state.state==="prop";if(lastContent===")"&&(content!==")"&&content!==",")){if(/\bnumber\b/.test(token)) return true;if(state.state==="prop") return true;if(state.state==="media"||state.state==="atBlock_parens") return true;return false;} return">+~-*/".indexOf(lastContent)>=0;} if(/\bcomment\b/.test(lastToken)) return true;if(/\bkeyword\b/.test(lastToken)) return state.state==="media"||(state.state==="atBlock_parens"&&content!==")");return false;},newlinesAfterToken:function(lastToken,lastContent,token,state,content,isComment) {if(!token){if(content===";") return 1;if(content===","){if((state.state==="top"||state.state==="media")&&state._cssPrettyPrint.lineLength>60){state._cssPrettyPrint.lineLength=0;return 1;} return 0;} if(content==="{") return 1;if(content==="}") return 2;return 0;} if(isComment) return 1;return 0;},removeLastWhitespace:function(lastToken,lastContent,token,state,content,isComment) {return false;},removeLastNewline:function(lastToken,lastContent,token,state,content,isComment,firstTokenOnLine) {if(isComment){if(!firstTokenOnLine&&lastContent===";") return true;return false;} return content==="}"&&(lastContent==="{"||lastContent==="}");},indentAfterToken:function(lastToken,lastContent,token,state,content,isComment) {return content==="{";},newlineBeforeToken:function(lastToken,lastContent,token,state,content,isComment) {return content==="}"&&(lastContent!=="{"&&lastContent!=="}");},indentBeforeToken:function(lastToken,lastContent,token,state,content,isComment) {return false;},dedentsBeforeToken:function(lastToken,lastContent,token,state,content,isComment) {return content==="}"?1:0;},modifyStateForTokenPost:function(lastToken,lastContent,token,state,content,isComment) {if(!state._cssPrettyPrint) state._cssPrettyPrint={lineLength:0};if(!isComment&&(state.state==="top"||state.state==="media"||state.state==="pseudo")) state._cssPrettyPrint.lineLength+=content.length;else state._cssPrettyPrint.lineLength=0;}});CodeMirror.extendMode("css-rule",{shouldHaveSpaceBeforeToken:function(lastToken,lastContent,token,state,content,isComment) {if(lastContent===":"&&!lastToken) return true;var tokenRegExp=/\b(?:keyword|atom|number)\b/;if(tokenRegExp.test(lastToken)&&tokenRegExp.test(token)) return true;return false;},shouldHaveSpaceAfterLastToken:function(lastToken,lastContent,token,state,content,isComment) {return lastContent===","&&!lastToken;},newlinesAfterToken:function(lastToken,lastContent,token,state,content,isComment) {return 0;},removeLastWhitespace:function(lastToken,lastContent,token,state,content,isComment) {if(isComment) return true;if(!lastToken) return lastContent===";";if(!token) return content===";"||content===":";if(/\bcomment\b/.test(lastToken)) return true;return false;},removeLastNewline:function(lastToken,lastContent,token,state,content,isComment,firstTokenOnLine) {return true;},indentAfterToken:function(lastToken,lastContent,token,state,content,isComment) {return false;},newlineBeforeToken:function(lastToken,lastContent,token,state,content,isComment) {if(isComment) return true;if(state.state==="block") return/\bmeta\b/.test(token); if(/\bcomment\b/.test(lastToken)) return true;if(/\bproperty\b/.test(token)) return!(/\bmeta\b/.test(lastToken));if(state.state==="maybeprop"&&/\bvariable-2\b/.test(token)) return true;return false;},indentBeforeToken:function(lastToken,lastContent,token,state,content,isComment) {return false;},dedentsBeforeToken:function(lastToken,lastContent,token,state,content,isComment) {return 0;}});CodeMirror.defineMode("regex",function(){function characterSetTokenizer(stream,state){let context=state.currentContext();if(context.negatedCharacterSet===undefined){context.negatedCharacterSet=stream.eat("^");if(context.negatedCharacterSet) return"regex-character-set-negate";} while(stream.peek()){if(stream.eat("\\")) return consumeEscapeSequence(stream);if(stream.eat("]")){state.tokenize=tokenBase;return state.popContext();} stream.next();} return"error";} function consumeEscapeSequence(stream){if(stream.match(/[bBdDwWsStrnvf0]/)) return"regex-special";if(stream.eat("x")){if(stream.match(/[0-9a-fA-F]{2}/)) return"regex-escape";return"error";} if(stream.eat("u")){if(stream.match(/[0-9a-fA-F]{4}/)) return"regex-escape-2";return"error";} if(stream.eat("c")){if(stream.match(/[A-Z]/)) return"regex-escape-3";return"error";} if(stream.match(/[1-9]/)) return"regex-backreference";if(stream.next()) return"regex-literal";return"error";} function tokenBase(stream,state){let ch=stream.next();if(ch==="\\") return consumeEscapeSequence(stream);if(ch==="("){let style;if(stream.match(/\?[=!]/)) style="regex-lookahead";else{stream.match(/\?:/);style="regex-group";} return state.pushContext(stream,style,")");} let context=state.currentContext();if(context&&context.type===ch) return state.popContext();if(/[*+?]/.test(ch)) return"regex-quantifier";if(ch==="{"){if(stream.match(/\d+}/)) return"regex-quantifier";let matches=stream.match(/(\d+),(\d+)?}/);if(!matches) return"error";let minimum=parseInt(matches[1]);let maximum=parseInt(matches[2]);if(minimum>maximum) return"error";return"regex-quantifier";} if(ch==="["){state.tokenize=characterSetTokenizer;return state.pushContext(stream,"regex-character-set");} if(/[.^$|]/.test(ch)) return"regex-special";return null;} return{startState:function(){let contextStack=[];return{currentContext:function(){return contextStack.length?contextStack[contextStack.length-1]:null;},pushContext:function(stream,data,type){let context={data,type};contextStack.push(context);return data;},popContext:function(){return contextStack.pop().data;},tokenize:tokenBase,};},token:function(stream,state){return state.tokenize(stream,state);}};});CodeMirror.defineMIME("text/x-regex","regex");function createCodeMirrorTextMarkers(type,pattern,matchFunction,codeMirror,range,callback) {var createdMarkers=[];var start=range instanceof WebInspector.TextRange?range.startLine:0;var end=range instanceof WebInspector.TextRange?range.endLine+1:codeMirror.lineCount();for(var lineNumber=start;lineNumber0) break;--index;if(index<0) break;} if(/(repeating-)?(linear|radial)-gradient$/.test(lineContent.substring(0,index))) return false;return!(match.index>0&&/[-.\"\']/.test(lineContent[match.index-1]));} return createCodeMirrorTextMarkers("Color",colorRegex,matchFunction,codeMirror,range,callback);} function createCodeMirrorGradientTextMarkers(codeMirror,range,callback) {var createdMarkers=[];var start=range instanceof WebInspector.TextRange?range.startLine:0;var end=range instanceof WebInspector.TextRange?range.endLine+1:codeMirror.lineCount();var gradientRegex=/(repeating-)?(linear|radial)-gradient\s*\(\s*/g;for(var lineNumber=start;lineNumber=lineContent.length){lineNumber++;endChar=0;lineContent=codeMirror.getLine(lineNumber);if(!lineContent) break;}} if(openParentheses!==-1){match=gradientRegex.exec(lineContent);continue;} var from={line:startLine,ch:startChar};var to={line:lineNumber,ch:endChar};var gradientString=codeMirror.getRange(from,to);var gradient=WebInspector.Gradient.fromString(gradientString);if(!gradient){match=gradientRegex.exec(lineContent);continue;} var marker=new WebInspector.TextMarker(codeMirror.markText(from,to),WebInspector.TextMarker.Type.Gradient);createdMarkers.push(marker);if(typeof callback==="function") callback(marker,gradient,gradientString);match=gradientRegex.exec(lineContent);}} return createdMarkers;} function createCodeMirrorCubicBezierTextMarkers(codeMirror,range,callback) {var cubicBezierRegex=/(cubic-bezier\([^)]+\)|\b\w+\b(?:-\b\w+\b){0,2})/g;return createCodeMirrorTextMarkers("CubicBezier",cubicBezierRegex,null,codeMirror,range,callback);} function createCodeMirrorSpringTextMarkers(codeMirror,range,callback) {const springRegex=/(spring\([^)]+\))/g;return createCodeMirrorTextMarkers("Spring",springRegex,null,codeMirror,range,callback);} function createCodeMirrorVariableTextMarkers(codeMirror,range,callback) {const variableRegex=/var\((--[\w-]+)\)/g;return createCodeMirrorTextMarkers("Variable",variableRegex,null,codeMirror,range,callback);} WebInspector.CollectionContentView=class CollectionContentView extends WebInspector.ContentView {constructor(collection) {super(collection);this.representedObject.addEventListener(WebInspector.Collection.Event.ItemAdded,this._handleItemAdded,this);this.representedObject.addEventListener(WebInspector.Collection.Event.ItemRemoved,this._handleItemRemoved,this);this._contentViewMap=new WeakMap;this._handleClickMap=new WeakMap;this._contentViewConstructor=null;let title="";switch(this.representedObject.typeVerifier){case WebInspector.Collection.TypeVerifier.Frame:title=WebInspector.UIString("Frames");break;case WebInspector.Collection.TypeVerifier.ContentFlow:title=WebInspector.UIString("Flows");break;case WebInspector.Collection.TypeVerifier.Script:title=WebInspector.UIString("Extra Scripts");break;case WebInspector.Collection.TypeVerifier.Resource:title=WebInspector.UIString("Resource");break;case WebInspector.ResourceCollection.TypeVerifier.Document:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Document,true);break;case WebInspector.ResourceCollection.TypeVerifier.Stylesheet:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Stylesheet,true);break;case WebInspector.ResourceCollection.TypeVerifier.Image:this._contentViewConstructor=WebInspector.ImageResourceContentView;title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Image,true);break;case WebInspector.ResourceCollection.TypeVerifier.Font:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Font,true);break;case WebInspector.ResourceCollection.TypeVerifier.Script:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Script,true);break;case WebInspector.ResourceCollection.TypeVerifier.XHR:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.XHR,true);break;case WebInspector.ResourceCollection.TypeVerifier.Fetch:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Fetch,true);break;case WebInspector.ResourceCollection.TypeVerifier.WebSocket:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.WebSocket,true);break;case WebInspector.ResourceCollection.TypeVerifier.Other:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Other,true);break;} this._contentPlaceholder=new WebInspector.TitleView(title);this.element.classList.add("collection");} initialLayout() {let items=this.representedObject.items;if(this._contentViewConstructor&&items.size){for(let item of items) this._addContentViewForItem(item);}else this.addSubview(this._contentPlaceholder);} _addContentViewForItem(item) {if(!this._contentViewConstructor) return;if(this._contentPlaceholder.parentView) this.removeSubview(this._contentPlaceholder);let contentView=new this._contentViewConstructor(item);contentView.addEventListener(WebInspector.ResourceContentView.Event.ContentError,this._handleContentError,this);let handleClick=(event)=>{if(event.button!==0||event.ctrlKey) return;WebInspector.showRepresentedObject(item);};this._handleClickMap.set(item,handleClick);contentView.element.addEventListener("click",handleClick);contentView.element.title=WebInspector.displayNameForURL(item.url,item.urlComponents);this.addSubview(contentView);this._contentViewMap.set(item,contentView);} _removeContentViewForItem(item) {if(!this._contentViewConstructor) return;let contentView=this._contentViewMap.get(item);if(!contentView) return;this.removeSubview(contentView);this._contentViewMap.delete(item);contentView.removeEventListener(null,null,this);let handleClick=this._handleClickMap.get(item);if(handleClick){contentView.element.removeEventListener("click",handleClick);this._handleClickMap.delete(item);} if(!this.representedObject.resources.length) this.addSubview(this._contentPlaceholder);} _handleItemAdded(event) {let item=event.data.item;if(!item) return;this._addContentViewForItem(item);} _handleItemRemoved(event) {let item=event.data.item;if(!item) return;this._removeContentViewForItem(item);} _handleContentError(event) {if(event&&event.target) this._removeContentViewForItem(event.target.representedObject);}};WebInspector.ColorPicker=class ColorPicker extends WebInspector.Object {constructor() {super();this._colorWheel=new WebInspector.ColorWheel;this._colorWheel.delegate=this;this._colorWheel.dimension=200;this._brightnessSlider=new WebInspector.Slider;this._brightnessSlider.delegate=this;this._brightnessSlider.element.classList.add("brightness");this._opacitySlider=new WebInspector.Slider;this._opacitySlider.delegate=this;this._opacitySlider.element.classList.add("opacity");let colorInputsContainerElement=document.createElement("div");colorInputsContainerElement.classList.add("color-inputs");function createColorInput(label,{min:min=0,max:max=100,step:step=1,units}={}){let containerElement=colorInputsContainerElement.createChild("div");containerElement.append(label);let numberInputElement=containerElement.createChild("input");numberInputElement.type="number";numberInputElement.min=min;numberInputElement.max=max;numberInputElement.step=step;numberInputElement.addEventListener("input",this._handleColorInputInput.bind(this));if(units&&units.length) containerElement.append(units);return{containerElement,numberInputElement};} this._colorInputs=new Map([["R",createColorInput.call(this,"R",{max:255})],["G",createColorInput.call(this,"G",{max:255})],["B",createColorInput.call(this,"B",{max:255})],["H",createColorInput.call(this,"H",{max:360})],["S",createColorInput.call(this,"S",{units:"%"})],["L",createColorInput.call(this,"L",{units:"%"})],["A",createColorInput.call(this,"A"),{max:1,step:0.01}]]);this._element=document.createElement("div");this._element.classList.add("color-picker");this._element.appendChild(this._colorWheel.element);this._element.appendChild(this._brightnessSlider.element);this._element.appendChild(this._opacitySlider.element);this._element.appendChild(colorInputsContainerElement);this._opacity=0;this._opacityPattern="url(Images/Checkers.svg)";this._color=WebInspector.Color.fromString("white");this._dontUpdateColor=false;this._enableColorComponentInputs=true;} get element() {return this._element;} set brightness(brightness) {if(brightness===this._brightness) return;this._colorWheel.brightness=brightness;this._updateColor();this._updateSliders(this._colorWheel.rawColor,this._colorWheel.tintedColor);} set opacity(opacity) {if(opacity===this._opacity) return;this._opacity=opacity;this._updateColor();} get colorWheel() {return this._colorWheel;} get color() {return this._color;} set color(color) {this._dontUpdateColor=true;let formatChanged=!this._color||this._color.format!==color.format;this._color=color;this._colorWheel.tintedColor=this._color;this._brightnessSlider.value=this._colorWheel.brightness;this._opacitySlider.value=this._color.alpha;this._updateSliders(this._colorWheel.rawColor,this._color);this._showColorComponentInputs();if(formatChanged) this._handleFormatChange();this._dontUpdateColor=false;} set enableColorComponentInputs(value) {this._enableColorComponentInputs=value;this._showColorComponentInputs();} colorWheelColorDidChange(colorWheel) {this._updateColor();this._updateSliders(this._colorWheel.rawColor,this._colorWheel.tintedColor);} sliderValueDidChange(slider,value) {if(slider===this._opacitySlider) this.opacity=value;else if(slider===this._brightnessSlider) this.brightness=value;} _updateColor() {if(this._dontUpdateColor) return;let opacity=Math.round(this._opacity*100)/100;let format=this._color.format;let components=null;if(format===WebInspector.Color.Format.HSL||format===WebInspector.Color.Format.HSLA){components=this._colorWheel.tintedColor.hsl.concat(opacity);if(opacity!==1) format=WebInspector.Color.Format.HSLA;}else{components=this._colorWheel.tintedColor.rgb.concat(opacity);if(opacity!==1&&format===WebInspector.Color.Format.RGB) format=WebInspector.Color.Format.RGBA;} let formatChanged=this._color.format===format;this._color=new WebInspector.Color(format,components);this._showColorComponentInputs();this.dispatchEventToListeners(WebInspector.ColorPicker.Event.ColorChanged,{color:this._color});if(formatChanged) this._handleFormatChange();} _updateSliders(rawColor,tintedColor) {var rgb=this._colorWheel.tintedColor.rgb;var opaque=new WebInspector.Color(WebInspector.Color.Format.RGBA,rgb.concat(1)).toString();var transparent=new WebInspector.Color(WebInspector.Color.Format.RGBA,rgb.concat(0)).toString();this._opacitySlider.element.style.backgroundImage="linear-gradient(90deg, "+transparent+", "+opaque+"), "+this._opacityPattern;this._brightnessSlider.element.style.backgroundImage="linear-gradient(90deg, black, "+rawColor+")";} _handleFormatChange() {this._element.classList.toggle("hide-inputs",this._color.format!==WebInspector.Color.Format.Keyword&&this._color.format!==WebInspector.Color.Format.RGB&&this._color.format!==WebInspector.Color.Format.RGBA&&this._color.format!==WebInspector.Color.Format.HEX&&this._color.format!==WebInspector.Color.Format.ShortHEX&&this._color.format!==WebInspector.Color.Format.HEXAlpha&&this._color.format!==WebInspector.Color.Format.ShortHEXAlpha&&this._color.format!==WebInspector.Color.Format.HSL&&this._color.format!==WebInspector.Color.Format.HSLA);this.dispatchEventToListeners(WebInspector.ColorPicker.Event.FormatChanged);} _showColorComponentInputs() {for(let{containerElement}of this._colorInputs.values()) containerElement.hidden=true;if(!this._enableColorComponentInputs) return;function updateColorInput(key,value){let{containerElement,numberInputElement}=this._colorInputs.get(key);numberInputElement.value=value;containerElement.hidden=false;} switch(this._color.format){case WebInspector.Color.Format.RGB:case WebInspector.Color.Format.RGBA:case WebInspector.Color.Format.HEX:case WebInspector.Color.Format.ShortHEX:case WebInspector.Color.Format.HEXAlpha:case WebInspector.Color.Format.ShortHEXAlpha:case WebInspector.Color.Format.Keyword:var[r,g,b]=this._color.rgb;updateColorInput.call(this,"R",r);updateColorInput.call(this,"G",g);updateColorInput.call(this,"B",b);break;case WebInspector.Color.Format.HSL:case WebInspector.Color.Format.HSLA:var[h,s,l]=this._color.hsl;updateColorInput.call(this,"H",h);updateColorInput.call(this,"S",s);updateColorInput.call(this,"L",l);break;default:return;} if((this._color.format===WebInspector.Color.Format.Keyword&&this._color.alpha!==1)||this._color.format===WebInspector.Color.Format.RGBA||this._color.format===WebInspector.Color.Format.HSLA||this._color.format===WebInspector.Color.Format.HEXAlpha||this._color.format===WebInspector.Color.Format.ShortHEXAlpha){updateColorInput.call(this,"A",this._color.alpha);}} _handleColorInputInput(event) {if(!this._enableColorComponentInputs){WebInspector.reportInternalError("Input event fired for disabled color component input");return;} let r=this._colorInputs.get("R").numberInputElement.value;let g=this._colorInputs.get("G").numberInputElement.value;let b=this._colorInputs.get("B").numberInputElement.value;let h=this._colorInputs.get("H").numberInputElement.value;let s=this._colorInputs.get("S").numberInputElement.value;let l=this._colorInputs.get("L").numberInputElement.value;let a=this._colorInputs.get("A").numberInputElement.value;let colorString="";let oldFormat=this._color.format;switch(oldFormat){case WebInspector.Color.Format.RGB:case WebInspector.Color.Format.HEX:case WebInspector.Color.Format.ShortHEX:case WebInspector.Color.Format.Keyword:colorString=`rgb(${r}, ${g}, ${b})`;break;case WebInspector.Color.Format.RGBA:case WebInspector.Color.Format.HEXAlpha:case WebInspector.Color.Format.ShortHEXAlpha:colorString=`rgba(${r}, ${g}, ${b}, ${a})`;break;case WebInspector.Color.Format.HSL:colorString=`hsl(${h}, ${s}%, ${l}%)`;break;case WebInspector.Color.Format.HSLA:colorString=`hsla(${h}, ${s}%, ${l}%, ${a})`;break;default:WebInspector.reportInternalError(`Input event fired for invalid color format "${this._color.format}"`);return;} this.color=WebInspector.Color.fromString(colorString);this._color.format=oldFormat;this.dispatchEventToListeners(WebInspector.ColorPicker.Event.ColorChanged,{color:this._color});}};WebInspector.ColorPicker.Event={ColorChanged:"css-color-picker-color-changed",FormatChanged:"css-color-picker-format-changed",};WebInspector.ColorWheel=class ColorWheel extends WebInspector.Object {constructor() {super();this._rawCanvas=document.createElement("canvas");this._tintedCanvas=document.createElement("canvas");this._finalCanvas=document.createElement("canvas");this._crosshair=document.createElement("div");this._crosshair.className="crosshair";this._element=document.createElement("div");this._element.className="color-wheel";this._element.appendChild(this._finalCanvas);this._element.appendChild(this._crosshair);this._finalCanvas.addEventListener("mousedown",this);} set dimension(dimension) {this._element.style.width=this.element.style.height=`${dimension}px`;this._finalCanvas.width=this._tintedCanvas.width=this._rawCanvas.width=dimension*window.devicePixelRatio;this._finalCanvas.height=this._tintedCanvas.height=this._rawCanvas.height=dimension*window.devicePixelRatio;this._finalCanvas.style.width=this._finalCanvas.style.height=dimension+"px";this._dimension=dimension;this._radius=dimension/2-2;this._setCrosshairPosition(new WebInspector.Point(dimension/2,dimension/2));this._drawRawCanvas();this._draw();} get element() {return this._element;} get brightness() {return this._brightness;} set brightness(brightness) {this._brightness=brightness;this._draw();} get tintedColor() {if(this._crosshairPosition) return this._colorAtPointWithBrightness(this._crosshairPosition.x*window.devicePixelRatio,this._crosshairPosition.y*window.devicePixelRatio,this._brightness);return new WebInspector.Color(WebInspector.Color.Format.RGBA,[0,0,0,0]);} set tintedColor(tintedColor) {var data=this._tintedColorToPointAndBrightness(tintedColor);this._setCrosshairPosition(data.point);this.brightness=data.brightness;} get rawColor() {if(this._crosshairPosition) return this._colorAtPointWithBrightness(this._crosshairPosition.x*window.devicePixelRatio,this._crosshairPosition.y*window.devicePixelRatio,1);return new WebInspector.Color(WebInspector.Color.Format.RGBA,[0,0,0,0]);} handleEvent(event) {switch(event.type){case"mousedown":this._handleMousedown(event);break;case"mousemove":this._handleMousemove(event);break;case"mouseup":this._handleMouseup(event);break;}} _handleMousedown(event) {window.addEventListener("mousemove",this,true);window.addEventListener("mouseup",this,true);this._updateColorForMouseEvent(event);} _handleMousemove(event) {this._updateColorForMouseEvent(event);} _handleMouseup(event) {window.removeEventListener("mousemove",this,true);window.removeEventListener("mouseup",this,true);} _pointInCircleForEvent(event) {function distance(a,b) {return Math.sqrt(Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2));} function angleFromCenterToPoint(center,point) {return Math.atan2(point.y-center.y,point.x-center.x);} function pointOnCircumference(c,r,a) {return new WebInspector.Point(c.x+r*Math.cos(a),c.y+r*Math.sin(a));} var dimension=this._dimension;var point=window.webkitConvertPointFromPageToNode(this._finalCanvas,new WebKitPoint(event.pageX,event.pageY));var center=new WebInspector.Point(dimension/2,dimension/2);if(distance(point,center)>this._radius){var angle=angleFromCenterToPoint(center,point);point=pointOnCircumference(center,this._radius,angle);} return point;} _updateColorForMouseEvent(event) {var point=this._pointInCircleForEvent(event);this._setCrosshairPosition(point);if(this.delegate&&typeof this.delegate.colorWheelColorDidChange==="function") this.delegate.colorWheelColorDidChange(this);} _setCrosshairPosition(point) {this._crosshairPosition=point;this._crosshair.style.webkitTransform="translate("+Math.round(point.x)+"px, "+Math.round(point.y)+"px)";} _tintedColorToPointAndBrightness(color) {var rgb=color.rgb;var hsv=WebInspector.Color.rgb2hsv(rgb[0],rgb[1],rgb[2]);var cosHue=Math.cos(hsv[0]*Math.PI/180);var sinHue=Math.sin(hsv[0]*Math.PI/180);var center=this._dimension/2;var x=center+(center*cosHue*hsv[1]);var y=center-(center*sinHue*hsv[1]);return{point:new WebInspector.Point(x,y),brightness:hsv[2]};} _drawRawCanvas(){var ctx=this._rawCanvas.getContext("2d");var dimension=this._dimension*window.devicePixelRatio;ctx.fillStyle="white";ctx.fillRect(0,0,dimension,dimension);var imageData=ctx.getImageData(0,0,dimension,dimension);var data=imageData.data;for(var j=0;j0.001) return new WebInspector.Color(WebInspector.Color.Format.RGBA,[0,0,0,0]);var h=Math.atan2(y-center,center-x)*180/Math.PI;h=(h+180)%360;var v=brightness;var s=Math.max(0,distance)/center;var rgb=WebInspector.Color.hsv2rgb(h,s,v);return new WebInspector.Color(WebInspector.Color.Format.RGBA,[Math.round(rgb[0]*255),Math.round(rgb[1]*255),Math.round(rgb[2]*255),1]);} _drawTintedCanvas() {var ctx=this._tintedCanvas.getContext("2d");var dimension=this._dimension*window.devicePixelRatio;ctx.save();ctx.drawImage(this._rawCanvas,0,0,dimension,dimension);if(this._brightness!==1){ctx.globalAlpha=1-this._brightness;ctx.fillStyle="black";ctx.fillRect(0,0,dimension,dimension);} ctx.restore();} _draw() {this._drawTintedCanvas();var ctx=this._finalCanvas.getContext("2d");var dimension=this._dimension*window.devicePixelRatio;var radius=this._radius*window.devicePixelRatio;ctx.save();ctx.clearRect(0,0,dimension,dimension);ctx.beginPath();ctx.arc(dimension/2,dimension/2,radius+1,0,Math.PI*2,true);ctx.closePath();ctx.clip();ctx.drawImage(this._tintedCanvas,0,0,dimension,dimension);ctx.restore();}};WebInspector.CompletionSuggestionsView=class CompletionSuggestionsView extends WebInspector.Object {constructor(delegate) {super();this._delegate=delegate||null;this._selectedIndex=NaN;this._element=document.createElement("div");this._element.classList.add("completion-suggestions",WebInspector.Popover.IgnoreAutoDismissClassName);this._containerElement=document.createElement("div");this._containerElement.classList.add("completion-suggestions-container");this._containerElement.addEventListener("mousedown",this._mouseDown.bind(this));this._containerElement.addEventListener("mouseup",this._mouseUp.bind(this));this._containerElement.addEventListener("click",this._itemClicked.bind(this));this._element.appendChild(this._containerElement);} get delegate() {return this._delegate;} get visible() {return!!this._element.parentNode;} get selectedIndex() {return this._selectedIndex;} set selectedIndex(index) {var selectedItemElement=this._selectedItemElement;if(selectedItemElement) selectedItemElement.classList.remove(WebInspector.CompletionSuggestionsView.SelectedItemStyleClassName);this._selectedIndex=index;selectedItemElement=this._selectedItemElement;if(!selectedItemElement) return;selectedItemElement.classList.add(WebInspector.CompletionSuggestionsView.SelectedItemStyleClassName);selectedItemElement.scrollIntoViewIfNeeded(false);} selectNext() {var count=this._containerElement.children.length;if(isNaN(this._selectedIndex)||this._selectedIndex===count-1) this.selectedIndex=0;else ++this.selectedIndex;var selectedItemElement=this._selectedItemElement;if(selectedItemElement&&this._delegate&&typeof this._delegate.completionSuggestionsSelectedCompletion==="function") this._delegate.completionSuggestionsSelectedCompletion(this,selectedItemElement.textContent);} selectPrevious() {if(isNaN(this._selectedIndex)||this._selectedIndex===0) this.selectedIndex=this._containerElement.children.length-1;else --this.selectedIndex;var selectedItemElement=this._selectedItemElement;if(selectedItemElement&&this._delegate&&typeof this._delegate.completionSuggestionsSelectedCompletion==="function") this._delegate.completionSuggestionsSelectedCompletion(this,selectedItemElement.textContent);} isHandlingClickEvent() {return this._mouseIsDown;} show(anchorBounds) {this._containerElement.style.position="absolute";document.body.appendChild(this._containerElement);var containerWidth=this._containerElement.offsetWidth;var containerHeight=this._containerElement.offsetHeight;this._containerElement.removeAttribute("style");this._element.appendChild(this._containerElement);var margin=10;var horizontalPadding=22;var absoluteMaximumHeight=160;var x=anchorBounds.origin.x;var y=anchorBounds.origin.y+anchorBounds.size.height;var maximumWidth=window.innerWidth-anchorBounds.origin.x-margin;var width=Math.min(containerWidth,maximumWidth-horizontalPadding)+horizontalPadding;var paddedWidth=containerWidth+horizontalPadding;if(width{WebInspector.toggleSplitConsole();});this.navigationBar.insertNavigationItem(this._toggleDrawerButton,0);this.collapsed=true;WebInspector.TabBrowser.addEventListener(WebInspector.TabBrowser.Event.SelectedTabContentViewDidChange,this._selectedTabContentViewDidChange,this);} get collapsed() {return this._collapsed;} set collapsed(flag) {if(flag===this._collapsed) return;this._collapsed=flag||false;this._toggleDrawerButton.toggled=this._collapsed;this.element.classList.toggle("hidden",this._collapsed);if(this._collapsed) this.hidden();else this.shown();this.dispatchEventToListeners(WebInspector.ConsoleDrawer.Event.CollapsedStateChanged);} get height() {return this.element.offsetHeight;} shown() {super.shown();this._restoreDrawerHeight();} layout() {if(this._collapsed) return;if(this.layoutReason!==WebInspector.View.LayoutReason.Resize) return;super.layout();let height=this.height;this._restoreDrawerHeight();if(height!==this.height) this.dispatchEventToListeners(WebInspector.ConsoleDrawer.Event.Resized);} _consoleResizerMouseDown(event) {if(event.button!==0||event.ctrlKey) return;if(event.target!==this.navigationBar.element&&!event.target.classList.contains("flexible-space")) return;let resizerElement=event.target;let mouseOffset=resizerElement.offsetHeight-(event.pageY-resizerElement.totalOffsetTop);function dockedResizerDrag(event) {let height=window.innerHeight-event.pageY-mouseOffset;this._drawerHeightSetting.value=height;this._updateDrawerHeight(height);this.collapsed=false;} function dockedResizerDragEnd(event) {if(event.button!==0) return;WebInspector.elementDragEnd(event);} WebInspector.elementDragStart(resizerElement,dockedResizerDrag.bind(this),dockedResizerDragEnd.bind(this),event,"row-resize");} _restoreDrawerHeight() {this._updateDrawerHeight(this._drawerHeightSetting.value);} _updateDrawerHeight(height) {const minimumHeight=64;const maximumHeight=this.element.parentNode.offsetHeight-100;height=Number.constrain(height,minimumHeight,maximumHeight);if(height===this.element.style.height) return;this.element.style.height=height+"px";this.dispatchEventToListeners(WebInspector.ConsoleDrawer.Event.Resized);} _selectedTabContentViewDidChange() {if(WebInspector.doesCurrentTabSupportSplitContentBrowser()) return;this.element.classList.add("hidden");}};WebInspector.ConsoleDrawer.Event={CollapsedStateChanged:"console-drawer-collapsed-state-changed",Resized:"console-drawer-resized",};WebInspector.ConsoleGroup=class ConsoleGroup extends WebInspector.Object {constructor(parentGroup) {super();this._parentGroup=parentGroup;} get parentGroup() {return this._parentGroup;} render(messageView) {var groupElement=document.createElement("div");groupElement.className="console-group";groupElement.group=this;this.element=groupElement;var titleElement=messageView.element;titleElement.classList.add(WebInspector.LogContentView.ItemWrapperStyleClassName);titleElement.addEventListener("click",this._titleClicked.bind(this));titleElement.addEventListener("mousedown",this._titleMouseDown.bind(this));if(groupElement&&messageView.message.type===WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed) groupElement.classList.add("collapsed");groupElement.appendChild(titleElement);var messagesElement=document.createElement("div");this._messagesElement=messagesElement;messagesElement.className="console-group-messages";groupElement.appendChild(messagesElement);return groupElement;} addMessageView(messageView) {var element=messageView.element;element.classList.add(WebInspector.LogContentView.ItemWrapperStyleClassName);this.append(element);} append(messageOrGroupElement) {this._messagesElement.appendChild(messageOrGroupElement);} _titleMouseDown(event) {event.preventDefault();} _titleClicked(event) {var groupTitleElement=event.target.enclosingNodeOrSelfWithClass("console-group-title");if(groupTitleElement){var groupElement=groupTitleElement.enclosingNodeOrSelfWithClass("console-group");if(groupElement) if(groupElement.classList.contains("collapsed")) groupElement.classList.remove("collapsed");else groupElement.classList.add("collapsed");groupTitleElement.scrollIntoViewIfNeeded(true);}}};WebInspector.ConsolePrompt=class ConsolePrompt extends WebInspector.View {constructor(delegate,mimeType) {super();mimeType=parseMIMEType(mimeType).type;this.element.classList.add("console-prompt",WebInspector.SyntaxHighlightedStyleClassName);this._delegate=delegate||null;this._codeMirror=WebInspector.CodeMirrorEditor.create(this.element,{lineWrapping:true,mode:{name:mimeType,globalVars:true},indentWithTabs:true,indentUnit:4,matchBrackets:true});var keyMap={"Up":this._handlePreviousKey.bind(this),"Down":this._handleNextKey.bind(this),"Ctrl-P":this._handlePreviousKey.bind(this),"Ctrl-N":this._handleNextKey.bind(this),"Enter":this._handleEnterKey.bind(this),"Cmd-Enter":this._handleCommandEnterKey.bind(this),"Tab":this._handleTabKey.bind(this),"Esc":this._handleEscapeKey.bind(this)};this._codeMirror.addKeyMap(keyMap);this._completionController=new WebInspector.CodeMirrorCompletionController(this._codeMirror,this);this._completionController.addExtendedCompletionProvider("javascript",WebInspector.javaScriptRuntimeCompletionProvider);this._history=[{}];this._historyIndex=0;} get delegate() {return this._delegate;} set delegate(delegate) {this._delegate=delegate||null;} set escapeKeyHandlerWhenEmpty(handler) {this._escapeKeyHandlerWhenEmpty=handler;} get text() {return this._codeMirror.getValue();} set text(text) {this._codeMirror.setValue(text||"");this._codeMirror.clearHistory();this._codeMirror.markClean();} get history() {this._history[this._historyIndex]=this._historyEntryForCurrentText();return this._history;} set history(history) {this._history=history instanceof Array?history.slice(0,WebInspector.ConsolePrompt.MaximumHistorySize):[{}];this._historyIndex=0;this._restoreHistoryEntry(0);} get focused() {return this._codeMirror.getWrapperElement().classList.contains("CodeMirror-focused");} focus() {this._codeMirror.focus();} updateCompletions(completions,implicitSuffix) {this._completionController.updateCompletions(completions,implicitSuffix);} pushHistoryItem(text) {this._commitHistoryEntry({text});} completionControllerCompletionsNeeded(completionController,prefix,defaultCompletions,base,suffix,forced) {if(this.delegate&&typeof this.delegate.consolePromptCompletionsNeeded==="function") this.delegate.consolePromptCompletionsNeeded(this,defaultCompletions,base,prefix,suffix,forced);else this._completionController.updateCompletions(defaultCompletions);} completionControllerShouldAllowEscapeCompletion(completionController) { return!!this.text;} layout() {this._codeMirror.refresh();} _handleTabKey(codeMirror) {var cursor=codeMirror.getCursor();var line=codeMirror.getLine(cursor.line);if(!line.trim().length) return CodeMirror.Pass;var firstNonSpace=line.search(/[^\s]/);if(cursor.ch<=firstNonSpace) return CodeMirror.Pass;this._completionController.completeAtCurrentPositionIfNeeded().then(function(result){if(result===WebInspector.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound) InspectorFrontendHost.beep();});} _handleEscapeKey(codeMirror) {if(this.text) return CodeMirror.Pass;if(!this._escapeKeyHandlerWhenEmpty) return CodeMirror.Pass;this._escapeKeyHandlerWhenEmpty();} _handlePreviousKey(codeMirror) {if(this._codeMirror.somethingSelected()) return CodeMirror.Pass;if(this._codeMirror.getCursor().line) return CodeMirror.Pass;var historyEntry=this._history[this._historyIndex+1];if(!historyEntry) return CodeMirror.Pass;this._rememberCurrentTextInHistory();++this._historyIndex;this._restoreHistoryEntry(this._historyIndex);} _handleNextKey(codeMirror) {if(this._codeMirror.somethingSelected()) return CodeMirror.Pass;if(this._codeMirror.getCursor().line!==this._codeMirror.lastLine()) return CodeMirror.Pass;var historyEntry=this._history[this._historyIndex-1];if(!historyEntry) return CodeMirror.Pass;this._rememberCurrentTextInHistory();--this._historyIndex;this._restoreHistoryEntry(this._historyIndex);} _handleEnterKey(codeMirror,forceCommit,keepCurrentText) {var currentText=this.text;if(!currentText.trim()) return;var cursor=this._codeMirror.getCursor();var lastLine=this._codeMirror.lastLine();var lastLineLength=this._codeMirror.getLine(lastLine).length;var cursorIsAtLastPosition=positionsEqual(cursor,{line:lastLine,ch:lastLineLength});function positionsEqual(a,b) {return a.line===b.line&&a.ch===b.ch;} function commitTextOrInsertNewLine(commit) {if(!commit){if(positionsEqual(cursor,this._codeMirror.getCursor())) CodeMirror.commands.newlineAndIndent(this._codeMirror);return;} this._commitHistoryEntry(this._historyEntryForCurrentText());if(!keepCurrentText){this._codeMirror.setValue("");this._codeMirror.clearHistory();} if(this.delegate&&typeof this.delegate.consolePromptHistoryDidChange==="function") this.delegate.consolePromptHistoryDidChange(this);if(this.delegate&&typeof this.delegate.consolePromptTextCommitted==="function") this.delegate.consolePromptTextCommitted(this,currentText);} if(!forceCommit&&this.delegate&&typeof this.delegate.consolePromptShouldCommitText==="function"){this.delegate.consolePromptShouldCommitText(this,currentText,cursorIsAtLastPosition,commitTextOrInsertNewLine.bind(this));return;} commitTextOrInsertNewLine.call(this,true);} _commitHistoryEntry(historyEntry) {if(this._history[1]&&(!this._history[1].text||this._history[1].text===historyEntry.text)){this._history[1]=historyEntry;this._history[0]={};}else{this._history[0]=historyEntry;this._history.unshift({});if(this._history.length>WebInspector.ConsolePrompt.MaximumHistorySize) this._history=this._history.slice(0,WebInspector.ConsolePrompt.MaximumHistorySize);} this._historyIndex=0;} _handleCommandEnterKey(codeMirror) {this._handleEnterKey(codeMirror,true,true);} _restoreHistoryEntry(index) {var historyEntry=this._history[index];this._codeMirror.setValue(historyEntry.text||"");if(historyEntry.undoHistory) this._codeMirror.setHistory(historyEntry.undoHistory);else this._codeMirror.clearHistory();this._codeMirror.setCursor(historyEntry.cursor||{line:0});} _historyEntryForCurrentText() {return{text:this.text,undoHistory:this._codeMirror.getHistory(),cursor:this._codeMirror.getCursor()};} _rememberCurrentTextInHistory() {this._history[this._historyIndex]=this._historyEntryForCurrentText();if(this.delegate&&typeof this.delegate.consolePromptHistoryDidChange==="function") this.delegate.consolePromptHistoryDidChange(this);}};WebInspector.ConsolePrompt.MaximumHistorySize=30;WebInspector.ConsoleSession=class ConsoleSession extends WebInspector.Object {constructor(data) {super();this._hasMessages=false;let element=document.createElement("div");element.className="console-session";let header=document.createElement("div");header.classList.add("console-session-header");let headerText="";switch(data.newSessionReason){case WebInspector.ConsoleSession.NewSessionReason.PageReloaded:headerText=WebInspector.UIString("Page reloaded at %s");break;case WebInspector.ConsoleSession.NewSessionReason.PageNavigated:headerText=WebInspector.UIString("Page navigated at %s");break;case WebInspector.ConsoleSession.NewSessionReason.ConsoleCleared:headerText=WebInspector.UIString("Console cleared at %s");break;default:headerText=WebInspector.UIString("Console opened at %s");break;} let timestamp=data.timestamp||Date.now();header.textContent=headerText.format(new Date(timestamp).toLocaleTimeString());element.append(header);this.element=element;this._messagesElement=element;} addMessageView(messageView) {var messageElement=messageView.element;messageElement.classList.add(WebInspector.LogContentView.ItemWrapperStyleClassName);this.append(messageElement);} append(messageOrGroupElement) {this._hasMessages=true;this._messagesElement.append(messageOrGroupElement);} hasMessages() {return this._hasMessages;}};WebInspector.ConsoleSession.NewSessionReason={PageReloaded:Symbol("Page reloaded"),PageNavigated:Symbol("Page navigated"),ConsoleCleared:Symbol("Console cleared"),};WebInspector.ContentFlowDOMTreeContentView=class ContentFlowDOMTreeContentView extends WebInspector.DOMTreeContentView {constructor(contentFlow) {super(contentFlow);contentFlow.addEventListener(WebInspector.ContentFlow.Event.ContentNodeWasAdded,this._contentNodeWasAdded,this);contentFlow.addEventListener(WebInspector.ContentFlow.Event.ContentNodeWasRemoved,this._contentNodeWasRemoved,this);this._createContentTrees();} closed() {this.representedObject.removeEventListener(null,null,this);super.closed();} getSearchContextNodes(callback) {callback(this.domTreeOutline.children.map(function(treeOutline){return treeOutline.representedObject.id;}));} _createContentTrees() {var contentNodes=this.representedObject.contentNodes;for(var contentNode of contentNodes) this.domTreeOutline.appendChild(new WebInspector.DOMTreeElement(contentNode));var documentURL=contentNodes.length?contentNodes[0].ownerDocument.documentURL:null;this._restoreSelectedNodeAfterUpdate(documentURL,contentNodes[0]);} _contentNodeWasAdded(event) {var treeElement=new WebInspector.DOMTreeElement(event.data.node);if(!event.data.before){this.domTreeOutline.appendChild(treeElement);return;} var beforeElement=this.domTreeOutline.findTreeElement(event.data.before);var index=this.domTreeOutline.children.indexOf(beforeElement);this.domTreeOutline.insertChild(treeElement,index);} _contentNodeWasRemoved(event) {var treeElement=this.domTreeOutline.findTreeElement(event.data.node);this.domTreeOutline.removeChild(treeElement);}};WebInspector.ContentFlowTreeElement=class ContentFlowTreeElement extends WebInspector.GeneralTreeElement {constructor(representedObject) {super("content-flow-icon",representedObject.name,null,representedObject,false);}};WebInspector.ContentViewContainer=class ContentViewContainer extends WebInspector.View {constructor() {super();this.element.classList.add("content-view-container");this._backForwardList=[];this._currentIndex=-1;} get currentIndex() {return this._currentIndex;} get backForwardList() {return this._backForwardList;} get currentContentView() {if(this._currentIndex<0||this._currentIndex>this._backForwardList.length-1) return null;return this._backForwardList[this._currentIndex].contentView;} get currentBackForwardEntry() {if(this._currentIndex<0||this._currentIndex>this._backForwardList.length-1) return null;return this._backForwardList[this._currentIndex];} contentViewForRepresentedObject(representedObject,onlyExisting,extraArguments) {return WebInspector.ContentView.contentViewForRepresentedObject(representedObject,onlyExisting,extraArguments);} showContentViewForRepresentedObject(representedObject,extraArguments) {var contentView=this.contentViewForRepresentedObject(representedObject,false,extraArguments);if(!contentView) return null;this.showContentView(contentView);return contentView;} showContentView(contentView,cookie) {if(!(contentView instanceof WebInspector.ContentView)) return null; if(contentView.parentContainer!==this) this._takeOwnershipOfContentView(contentView);let currentEntry=this.currentBackForwardEntry; let provisionalEntry=null;for(let i=this._backForwardList.length-1;i>=0;--i){if(this._backForwardList[i].contentView===contentView){provisionalEntry=this._backForwardList[i].makeCopy(cookie);break;}} if(!provisionalEntry) provisionalEntry=new WebInspector.BackForwardEntry(contentView,cookie);if(provisionalEntry.isEqual(currentEntry)){const shouldCallShown=false;currentEntry.prepareToShow(shouldCallShown);return currentEntry.contentView;} let newIndex=this._currentIndex+1;let removedEntries=this._backForwardList.splice(newIndex,this._backForwardList.length-newIndex,provisionalEntry);for(let i=0;iexistingEntry.contentView===removedEntries[i].contentView);if(shouldDissociateContentView) this._disassociateFromContentView(removedEntries[i].contentView,removedEntries[i].tombstone);} contentView._parentContainer=this;this.showBackForwardEntryForIndex(newIndex);return contentView;} showBackForwardEntryForIndex(index) {if(index<0||index>this._backForwardList.length-1) return;if(this._currentIndex===index) return;var previousEntry=this.currentBackForwardEntry;this._currentIndex=index;var currentEntry=this.currentBackForwardEntry;var isNewContentView=!previousEntry||!currentEntry.contentView.visible;if(isNewContentView){if(previousEntry) this._hideEntry(previousEntry);this._showEntry(currentEntry,true);}else this._showEntry(currentEntry,false);this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);} replaceContentView(oldContentView,newContentView) {if(!(oldContentView instanceof WebInspector.ContentView)) return;if(!(newContentView instanceof WebInspector.ContentView)) return;if(oldContentView.parentContainer!==this) return;if(newContentView.parentContainer&&newContentView.parentContainer!==this) return;var currentlyShowing=this.currentContentView===oldContentView;if(currentlyShowing) this._hideEntry(this.currentBackForwardEntry);this._disassociateFromContentView(oldContentView,false);newContentView._parentContainer=this;for(var i=0;i=0;--i){if(this._backForwardList[i].contentView!==contentViewToClose){allSameContentView=false;break;}} if(allSameContentView){this.closeAllContentViews();return;} var visibleContentView=this.currentContentView;var backForwardListDidChange=false;for(var i=this._backForwardList.length-1;i>=0;--i){var entry=this._backForwardList[i];if(entry.contentView!==contentViewToClose) continue;if(entry.contentView===visibleContentView) this._hideEntry(entry);if(this._currentIndex>=i){ --this._currentIndex;} this._disassociateFromContentView(entry.contentView,entry.tombstone);this._backForwardList.splice(i,1);backForwardListDidChange=true;} if(backForwardListDidChange) this._removeIdenticalAdjacentBackForwardEntries();var currentEntry=this.currentBackForwardEntry;if(currentEntry&¤tEntry.contentView!==visibleContentView||backForwardListDidChange){this._showEntry(currentEntry,true);this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);}} closeAllContentViews() {if(!this._backForwardList.length){return;} var visibleContentView=this.currentContentView;for(var i=0;i0;} canGoForward() {return this._currentIndex=0;--i){let entry=this._backForwardList[i];if(!entry.isEqual(previousEntry)){previousEntry=entry;continue;} if(this._currentIndex>=i){ --this._currentIndex;} this._backForwardList.splice(i,1);}}};WebInspector.ContentViewContainer.Event={CurrentContentViewDidChange:"content-view-container-current-content-view-did-change"};WebInspector.ContentViewContainer.TombstoneContentViewContainersSymbol=Symbol("content-view-container-tombstone-content-view-containers");WebInspector.ContextMenuItem=class ContextMenuItem extends WebInspector.Object {constructor(topLevelMenu,type,label,disabled,checked) {super();this._type=type;this._label=label;this._disabled=disabled;this._checked=checked;this._contextMenu=topLevelMenu||this;if(type==="item"||type==="checkbox") this._id=topLevelMenu.nextId();} id() {return this._id;} type() {return this._type;} isEnabled() {return!this._disabled;} setEnabled(enabled) {this._disabled=!enabled;} _buildDescriptor() {switch(this._type){case"item":return{type:"item",id:this._id,label:this._label,enabled:!this._disabled};case"separator":return{type:"separator"};case"checkbox":return{type:"checkbox",id:this._id,label:this._label,checked:!!this._checked,enabled:!this._disabled};}}};WebInspector.ContextSubMenuItem=class ContextSubMenuItem extends WebInspector.ContextMenuItem {constructor(topLevelMenu,label,disabled) {super(topLevelMenu,"subMenu",label,disabled);this._items=[];} appendItem(label,handler,disabled) {let item=new WebInspector.ContextMenuItem(this._contextMenu,"item",label,disabled);this._pushItem(item);this._contextMenu._setHandler(item.id(),handler);return item;} appendSubMenuItem(label,disabled) {let item=new WebInspector.ContextSubMenuItem(this._contextMenu,label,disabled);this._pushItem(item);return item;} appendCheckboxItem(label,handler,checked,disabled) {let item=new WebInspector.ContextMenuItem(this._contextMenu,"checkbox",label,disabled,checked);this._pushItem(item);this._contextMenu._setHandler(item.id(),handler);return item;} appendSeparator() {if(this._items.length) this._pendingSeparator=true;} _pushItem(item) {if(this._pendingSeparator){this._items.push(new WebInspector.ContextMenuItem(this._contextMenu,"separator"));this._pendingSeparator=null;} this._items.push(item);} isEmpty() {return!this._items.length;} _buildDescriptor() {let subItems=this._items.map((item)=>item._buildDescriptor());return{type:"subMenu",label:this._label,enabled:!this._disabled,subItems};}};WebInspector.ContextMenu=class ContextMenu extends WebInspector.ContextSubMenuItem {constructor(event) {super(null,"");this._event=event;this._handlers={};this._id=0;} static createFromEvent(event,onlyExisting=false) {if(!event[WebInspector.ContextMenu.ProposedMenuSymbol]&&!onlyExisting) event[WebInspector.ContextMenu.ProposedMenuSymbol]=new WebInspector.ContextMenu(event);return event[WebInspector.ContextMenu.ProposedMenuSymbol]||null;} static contextMenuItemSelected(id) {if(WebInspector.ContextMenu._lastContextMenu) WebInspector.ContextMenu._lastContextMenu._itemSelected(id);} static contextMenuCleared() { } nextId() {return this._id++;} show() {let menuObject=this._buildDescriptor();if(menuObject.length){WebInspector.ContextMenu._lastContextMenu=this;if(this._event.type!=="contextmenu"&&typeof InspectorFrontendHost.dispatchEventAsContextMenuEvent==="function"){this._menuObject=menuObject;this._event.target.addEventListener("contextmenu",this,true);InspectorFrontendHost.dispatchEventAsContextMenuEvent(this._event);}else InspectorFrontendHost.showContextMenu(this._event,menuObject);} if(this._event) this._event.stopImmediatePropagation();} handleEvent(event) {this._event.target.removeEventListener("contextmenu",this,true);InspectorFrontendHost.showContextMenu(event,this._menuObject);this._menuObject=null;event.stopImmediatePropagation();} _setHandler(id,handler) {if(handler) this._handlers[id]=handler;} _buildDescriptor() {return this._items.map((item)=>item._buildDescriptor());} _itemSelected(id) {if(this._handlers[id]) this._handlers[id].call(this);}};WebInspector.ContextMenu.ProposedMenuSymbol=Symbol("context-menu-proposed-menu");WebInspector.appendContextMenuItemsForSourceCode=function(contextMenu,sourceCodeOrLocation) {if(!(contextMenu instanceof WebInspector.ContextMenu)) return;let sourceCode=sourceCodeOrLocation;let location=null;if(sourceCodeOrLocation instanceof WebInspector.SourceCodeLocation){sourceCode=sourceCodeOrLocation.sourceCode;location=sourceCodeOrLocation;} if(!(sourceCode instanceof WebInspector.SourceCode)) return;contextMenu.appendSeparator();if(sourceCode.url){contextMenu.appendItem(WebInspector.UIString("Open in New Tab"),()=>{const frame=null;WebInspector.openURL(sourceCode.url,frame,{alwaysOpenExternally:true});});if(WebInspector.frameResourceManager.resourceForURL(sourceCode.url)&&!WebInspector.isShowingResourcesTab()){contextMenu.appendItem(WebInspector.UIString("Reveal in Resources Tab"),()=>{const options={ignoreNetworkTab:true};if(location) WebInspector.showSourceCodeLocation(location,options);else WebInspector.showSourceCode(sourceCode,options);});} contextMenu.appendItem(WebInspector.UIString("Copy Link Address"),()=>{InspectorFrontendHost.copyText(sourceCode.url);});} if(sourceCode instanceof WebInspector.Resource){if(sourceCode.urlComponents.scheme!=="data"){contextMenu.appendItem(WebInspector.UIString("Copy as cURL"),()=>{sourceCode.generateCURLCommand();});}} contextMenu.appendItem(WebInspector.UIString("Save File"),()=>{sourceCode.requestContent().then(()=>{const forceSaveAs=true;WebInspector.saveDataToFile({url:sourceCode.url||"",content:sourceCode.content},forceSaveAs);});});contextMenu.appendSeparator();if(location&&(sourceCode instanceof WebInspector.Script||(sourceCode instanceof WebInspector.Resource&&sourceCode.type===WebInspector.Resource.Type.Script))){let existingBreakpoint=WebInspector.debuggerManager.breakpointForSourceCodeLocation(location);if(existingBreakpoint){contextMenu.appendItem(WebInspector.UIString("Delete Breakpoint"),()=>{WebInspector.debuggerManager.removeBreakpoint(existingBreakpoint);});}else{contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"),()=>{WebInspector.debuggerManager.addBreakpoint(new WebInspector.Breakpoint(location));});} contextMenu.appendSeparator();}};WebInspector.appendContextMenuItemsForDOMNode=function(contextMenu,domNode,options={}) {if(!(contextMenu instanceof WebInspector.ContextMenu)) return;if(!(domNode instanceof WebInspector.DOMNode)) return;let isElement=domNode.nodeType()===Node.ELEMENT_NODE;contextMenu.appendSeparator();if(domNode.ownerDocument&&isElement){contextMenu.appendItem(WebInspector.UIString("Copy Selector Path"),()=>{let cssPath=WebInspector.cssPath(domNode);InspectorFrontendHost.copyText(cssPath);});} if(domNode.ownerDocument&&!domNode.isPseudoElement()){contextMenu.appendItem(WebInspector.UIString("Copy XPath"),()=>{let xpath=WebInspector.xpath(domNode);InspectorFrontendHost.copyText(xpath);});} if(domNode.isCustomElement()){contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Jump to Definition"),()=>{function didGetFunctionDetails(error,response){if(error) return;let location=response.location;let sourceCode=WebInspector.debuggerManager.scriptForIdentifier(location.scriptId,WebInspector.mainTarget);if(!sourceCode) return;let sourceCodeLocation=sourceCode.createSourceCodeLocation(location.lineNumber,location.columnNumber||0);WebInspector.showSourceCodeLocation(sourceCodeLocation,{ignoreNetworkTab:true,ignoreSearchTab:true,});} function didGetProperty(error,result,wasThrown){if(error||result.type!=="function") return;DebuggerAgent.getFunctionDetails(result.objectId,didGetFunctionDetails);result.release();} function didResolveNode(remoteObject){if(!remoteObject) return;remoteObject.getProperty("constructor",didGetProperty);remoteObject.release();} WebInspector.RemoteObject.resolveNode(domNode,"",didResolveNode);});} if(WebInspector.domDebuggerManager.supported&&isElement&&!domNode.isPseudoElement()&&domNode.ownerDocument){contextMenu.appendSeparator();const allowEditing=false;WebInspector.DOMBreakpointTreeController.appendBreakpointContextMenuItems(contextMenu,domNode,allowEditing);} contextMenu.appendSeparator();if(!options.excludeRevealElement&&domNode.ownerDocument){contextMenu.appendItem(WebInspector.UIString("Reveal in DOM Tree"),()=>{WebInspector.domTreeManager.inspectElement(domNode.id);});} if(!options.excludeLogElement&&!domNode.isInUserAgentShadowTree()&&!domNode.isPseudoElement()){let label=isElement?WebInspector.UIString("Log Element"):WebInspector.UIString("Log Node");contextMenu.appendItem(label,()=>{WebInspector.RemoteObject.resolveNode(domNode,WebInspector.RuntimeManager.ConsoleObjectGroup,(remoteObject)=>{if(!remoteObject) return;let text=isElement?WebInspector.UIString("Selected Element"):WebInspector.UIString("Selected Node");const addSpecialUserLogClass=true;WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text,remoteObject,addSpecialUserLogClass);});});}};WebInspector.ControlToolbarItem=class ControlToolbarItem extends WebInspector.ButtonNavigationItem {constructor(identifier,toolTip,image,imageWidth,imageHeight) {super(identifier,toolTip,image,imageWidth,imageHeight,false);} get additionalClassNames() {return["control"];}};WebInspector.CookieStorageContentView=class CookieStorageContentView extends WebInspector.ContentView {constructor(representedObject) {super(representedObject);this.element.classList.add("cookie-storage");this._refreshButtonNavigationItem=new WebInspector.ButtonNavigationItem("cookie-storage-refresh",WebInspector.UIString("Refresh"),"Images/ReloadFull.svg",13,13);this._refreshButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._refreshButtonClicked,this);this.update();} get navigationItems() {return[this._refreshButtonNavigationItem];} update() {PageAgent.getCookies().then((payload)=>{this._cookies=this._filterCookies(payload.cookies);this._rebuildTable();}).catch((error)=>{console.error("Could not fetch cookies: ",error);});} saveToCookie(cookie) {cookie.type=WebInspector.ContentViewCookieType.CookieStorage;cookie.host=this.representedObject.host;} get scrollableElements() {if(!this._dataGrid) return[];return[this._dataGrid.scrollContainer];} _rebuildTable() {if(!this._dataGrid){var columns={name:{},value:{},domain:{},path:{},expires:{},size:{},http:{},secure:{}};columns.name.title=WebInspector.UIString("Name");columns.name.sortable=true;columns.name.width="24%";columns.name.locked=true;columns.value.title=WebInspector.UIString("Value");columns.value.sortable=true;columns.value.width="34%";columns.value.locked=true;columns.domain.title=WebInspector.UIString("Domain");columns.domain.sortable=true;columns.domain.width="7%";columns.path.title=WebInspector.UIString("Path");columns.path.sortable=true;columns.path.width="7%";columns.expires.title=WebInspector.UIString("Expires");columns.expires.sortable=true;columns.expires.width="7%";columns.size.title=WebInspector.UIString("Size");columns.size.aligned="right";columns.size.sortable=true;columns.size.width="7%";columns.http.title=WebInspector.UIString("HTTP");columns.http.aligned="centered";columns.http.sortable=true;columns.http.width="7%";columns.secure.title=WebInspector.UIString("Secure");columns.secure.aligned="centered";columns.secure.sortable=true;columns.secure.width="7%";this._dataGrid=new WebInspector.DataGrid(columns,null,this._deleteCallback.bind(this));this._dataGrid.columnChooserEnabled=true;this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged,this._sortDataGrid,this);this.addSubview(this._dataGrid);this._dataGrid.updateLayout();} this._dataGrid.removeChildren();for(var cookie of this._cookies){const checkmark="\u2713";var data={"name":cookie.name,"value":cookie.value,"domain":cookie.domain||"","path":cookie.path||"","expires":"","size":Number.bytesToString(cookie.size),"http":cookie.httpOnly?checkmark:"","secure":cookie.secure?checkmark:"",};if(cookie.type!==WebInspector.CookieType.Request) data["expires"]=cookie.session?WebInspector.UIString("Session"):new Date(cookie.expires).toLocaleString();var node=new WebInspector.DataGridNode(data);node.cookie=cookie;this._dataGrid.appendChild(node);} this._dataGrid.sortColumnIdentifier="name";this._dataGrid.createSettings("cookie-storage-content-view");} _filterCookies(cookies) {let resourceMatchesStorageDomain=(resource)=>{let urlComponents=resource.urlComponents;return urlComponents&&urlComponents.host&&urlComponents.host===this.representedObject.host;};let allResources=[];for(let frame of WebInspector.frameResourceManager.frames){allResources.push(frame.mainResource);allResources=allResources.concat(frame.resourceCollection.toArray());} let resourcesForDomain=allResources.filter(resourceMatchesStorageDomain);let cookiesForDomain=cookies.filter((cookie)=>{return resourcesForDomain.some((resource)=>{return WebInspector.CookieStorageObject.cookieMatchesResourceURL(cookie,resource.url);});});return cookiesForDomain;} _sortDataGrid() {function localeCompare(field,nodeA,nodeB) {return(nodeA.data[field]+"").extendedLocaleCompare(nodeB.data[field]+"");} function numberCompare(field,nodeA,nodeB) {return nodeA.cookie[field]-nodeB.cookie[field];} function expiresCompare(nodeA,nodeB) {if(nodeA.cookie.session!==nodeB.cookie.session) return nodeA.cookie.session?-1:1;if(nodeA.cookie.session) return 0;return nodeA.cookie.expires-nodeB.cookie.expires;} var comparator;switch(this._dataGrid.sortColumnIdentifier){case"value":comparator=localeCompare.bind(this,"value");break;case"domain":comparator=localeCompare.bind(this,"domain");break;case"path":comparator=localeCompare.bind(this,"path");break;case"expires":comparator=expiresCompare;break;case"size":comparator=numberCompare.bind(this,"size");break;case"http":comparator=localeCompare.bind(this,"http");break;case"secure":comparator=localeCompare.bind(this,"secure");break;case"name":default:comparator=localeCompare.bind(this,"name");break;} this._dataGrid.sortNodes(comparator);} _deleteCallback(node) {if(!node||!node.cookie) return;var cookie=node.cookie;var cookieURL=(cookie.secure?"https://":"http://")+cookie.domain+cookie.path;PageAgent.deleteCookie(cookie.name,cookieURL);this.update();} _refreshButtonClicked(event) {this.update();}};WebInspector.CookieType={Request:0,Response:1};WebInspector.CookieStorageTreeElement=class CookieStorageTreeElement extends WebInspector.StorageTreeElement {constructor(representedObject) {super("cookie-icon",WebInspector.displayNameForHost(representedObject.host),representedObject);} get name() {return this.representedObject.host;} get categoryName() {return WebInspector.UIString("Cookies");}};WebInspector.DOMBreakpointTreeElement=class DOMBreakpointTreeElement extends WebInspector.GeneralTreeElement {constructor(breakpoint,className,title) {if(!className) className=WebInspector.BreakpointTreeElement.GenericLineIconStyleClassName;if(!title) title=WebInspector.DOMBreakpointTreeElement.displayNameForType(breakpoint.type);super(["breakpoint",className],title,null,breakpoint);this._statusImageElement=document.createElement("img");this._statusImageElement.classList.add("status-image","resolved");this.status=this._statusImageElement;breakpoint.addEventListener(WebInspector.DOMBreakpoint.Event.DisabledStateDidChange,this._updateStatus,this);this._updateStatus();} static displayNameForType(type) {switch(type){case WebInspector.DOMBreakpoint.Type.SubtreeModified:return WebInspector.UIString("Subtree Modified");case WebInspector.DOMBreakpoint.Type.AttributeModified:return WebInspector.UIString("Attribute Modified");case WebInspector.DOMBreakpoint.Type.NodeRemoved:return WebInspector.UIString("Node Removed");default:console.error("Unexpected DOM breakpoint type: "+type);return null;}} onattach() {super.onattach();this._boundStatusImageElementClicked=this._statusImageElementClicked.bind(this);this._boundStatusImageElementFocused=this._statusImageElementFocused.bind(this);this._boundStatusImageElementMouseDown=this._statusImageElementMouseDown.bind(this);this._statusImageElement.addEventListener("click",this._boundStatusImageElementClicked);this._statusImageElement.addEventListener("focus",this._boundStatusImageElementFocused);this._statusImageElement.addEventListener("mousedown",this._boundStatusImageElementMouseDown);} ondetach() {super.ondetach();this._statusImageElement.removeEventListener("click",this._boundStatusImageElementClicked);this._statusImageElement.removeEventListener("focus",this._boundStatusImageElementFocused);this._statusImageElement.removeEventListener("mousedown",this._boundStatusImageElementMouseDown);this._boundStatusImageElementClicked=null;this._boundStatusImageElementFocused=null;this._boundStatusImageElementMouseDown=null;} ondelete() {WebInspector.domDebuggerManager.removeDOMBreakpoint(this.representedObject);return true;} onenter() {this._toggleBreakpoint();return true;} onspace() {this._toggleBreakpoint();return true;} populateContextMenu(contextMenu,event) {let breakpoint=this.representedObject;let label=breakpoint.disabled?WebInspector.UIString("Enable Breakpoint"):WebInspector.UIString("Disable Breakpoint");contextMenu.appendItem(label,this._toggleBreakpoint.bind(this));contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Delete Breakpoint"),function(){WebInspector.domDebuggerManager.removeDOMBreakpoint(breakpoint);});} _statusImageElementClicked(event) {this._toggleBreakpoint();} _statusImageElementFocused(event) {event.stopPropagation();} _statusImageElementMouseDown(event) {event.stopPropagation();} _toggleBreakpoint() {this.representedObject.disabled=!this.representedObject.disabled;} _updateStatus() {this._statusImageElement.classList.toggle("disabled",this.representedObject.disabled);}};WebInspector.DOMNodeDetailsSidebarPanel=class DOMNodeDetailsSidebarPanel extends WebInspector.DOMDetailsSidebarPanel {constructor() {super("dom-node-details",WebInspector.UIString("Node"));this._eventListenerGroupingMethodSetting=new WebInspector.Setting("dom-node-event-listener-grouping-method",WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Event);this.element.classList.add("dom-node");this._nodeRemoteObject=null;} initialLayout() {super.initialLayout();WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeModified,this._attributesChanged,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeRemoved,this._attributesChanged,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.CharacterDataModified,this._characterDataModified,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.CustomElementStateChanged,this._customElementStateChanged,this);this._identityNodeTypeRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Type"));this._identityNodeNameRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));this._identityNodeValueRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Value"));this._identityNodeContentSecurityPolicyHashRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("CSP Hash"));var identityGroup=new WebInspector.DetailsSectionGroup([this._identityNodeTypeRow,this._identityNodeNameRow,this._identityNodeValueRow,this._identityNodeContentSecurityPolicyHashRow]);var identitySection=new WebInspector.DetailsSection("dom-node-identity",WebInspector.UIString("Identity"),[identityGroup]);this._attributesDataGridRow=new WebInspector.DetailsSectionDataGridRow(null,WebInspector.UIString("No Attributes"));var attributesGroup=new WebInspector.DetailsSectionGroup([this._attributesDataGridRow]);var attributesSection=new WebInspector.DetailsSection("dom-node-attributes",WebInspector.UIString("Attributes"),[attributesGroup]);this._propertiesRow=new WebInspector.DetailsSectionRow;var propertiesGroup=new WebInspector.DetailsSectionGroup([this._propertiesRow]);var propertiesSection=new WebInspector.DetailsSection("dom-node-properties",WebInspector.UIString("Properties"),[propertiesGroup]);let eventListenersFilterElement=useSVGSymbol("Images/FilterFieldGlyph.svg","filter",WebInspector.UIString("Grouping Method"));let eventListenersGroupMethodSelectElement=eventListenersFilterElement.appendChild(document.createElement("select"));eventListenersGroupMethodSelectElement.addEventListener("change",(event)=>{this._eventListenerGroupingMethodSetting.value=eventListenersGroupMethodSelectElement.value;this._refreshEventListeners();});function createOption(text,value){let optionElement=eventListenersGroupMethodSelectElement.appendChild(document.createElement("option"));optionElement.value=value;optionElement.textContent=text;} createOption(WebInspector.UIString("Group by Event"),WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Event);createOption(WebInspector.UIString("Group by Node"),WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Node);eventListenersGroupMethodSelectElement.value=this._eventListenerGroupingMethodSetting.value;this._eventListenersSectionGroup=new WebInspector.DetailsSectionGroup;let eventListenersSection=new WebInspector.DetailsSection("dom-node-event-listeners",WebInspector.UIString("Event Listeners"),[this._eventListenersSectionGroup],eventListenersFilterElement);this.contentView.element.appendChild(identitySection.element);this.contentView.element.appendChild(attributesSection.element);this.contentView.element.appendChild(propertiesSection.element);this.contentView.element.appendChild(eventListenersSection.element);if(this._accessibilitySupported()){this._accessibilityEmptyRow=new WebInspector.DetailsSectionRow(WebInspector.UIString("No Accessibility Information"));this._accessibilityNodeActiveDescendantRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Shared Focus"));this._accessibilityNodeBusyRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Busy"));this._accessibilityNodeCheckedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Checked"));this._accessibilityNodeChildrenRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Children"));this._accessibilityNodeControlsRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Controls"));this._accessibilityNodeCurrentRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Current"));this._accessibilityNodeDisabledRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Disabled"));this._accessibilityNodeExpandedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Expanded"));this._accessibilityNodeFlowsRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Flows"));this._accessibilityNodeFocusedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Focused"));this._accessibilityNodeHeadingLevelRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Heading Level"));this._accessibilityNodehierarchyLevelRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Hierarchy Level"));this._accessibilityNodeIgnoredRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Ignored"));this._accessibilityNodeInvalidRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Invalid"));this._accessibilityNodeLiveRegionStatusRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Live"));this._accessibilityNodeMouseEventRow=new WebInspector.DetailsSectionSimpleRow("");this._accessibilityNodeLabelRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Label"));this._accessibilityNodeOwnsRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Owns"));this._accessibilityNodeParentRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Parent"));this._accessibilityNodePressedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Pressed"));this._accessibilityNodeReadonlyRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Readonly"));this._accessibilityNodeRequiredRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Required"));this._accessibilityNodeRoleRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Role"));this._accessibilityNodeSelectedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Selected"));this._accessibilityNodeSelectedChildrenRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Selected Items"));this._accessibilityGroup=new WebInspector.DetailsSectionGroup([this._accessibilityEmptyRow]);var accessibilitySection=new WebInspector.DetailsSection("dom-node-accessibility",WebInspector.UIString("Accessibility"),[this._accessibilityGroup]);this.contentView.element.appendChild(accessibilitySection.element);}} layout() {super.layout();if(!this.domNode) return;this._refreshIdentity();this._refreshAttributes();this._refreshProperties();this._refreshEventListeners();this._refreshAccessibility();} sizeDidChange() {super.sizeDidChange(); this._attributesDataGridRow.sizeDidChange();} _accessibilitySupported() {return window.DOMAgent&&DOMAgent.getAccessibilityPropertiesForNode;} _refreshIdentity() {const domNode=this.domNode;this._identityNodeTypeRow.value=this._nodeTypeDisplayName();this._identityNodeNameRow.value=domNode.nodeNameInCorrectCase();this._identityNodeValueRow.value=domNode.nodeValue();this._identityNodeContentSecurityPolicyHashRow.value=domNode.contentSecurityPolicyHash();} _refreshAttributes() {let domNode=this.domNode;if(!domNode||!domNode.hasAttributes()){this._attributesDataGridRow.dataGrid=null;return;} let dataGrid=this._attributesDataGridRow.dataGrid;if(!dataGrid){const columns={name:{title:WebInspector.UIString("Name"),width:"30%"},value:{title:WebInspector.UIString("Value")},};dataGrid=this._attributesDataGridRow.dataGrid=new WebInspector.DataGrid(columns);} dataGrid.removeChildren();let attributes=domNode.attributes();attributes.sort((a,b)=>a.name.extendedLocaleCompare(b.name));for(let attribute of attributes){let dataGridNode=new WebInspector.EditableDataGridNode(attribute);dataGridNode.addEventListener(WebInspector.EditableDataGridNode.Event.ValueChanged,this._attributeNodeValueChanged,this);dataGrid.appendChild(dataGridNode);} dataGrid.updateLayoutIfNeeded();} _refreshProperties() {if(this._nodeRemoteObject){this._nodeRemoteObject.release();this._nodeRemoteObject=null;} let domNode=this.domNode;RuntimeAgent.releaseObjectGroup(WebInspector.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName);WebInspector.RemoteObject.resolveNode(domNode,WebInspector.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName,nodeResolved.bind(this));function nodeResolved(object) {if(!object) return;if(this.domNode!==domNode) return;this._nodeRemoteObject=object;function inspectedPage_node_collectPrototypes() { var prototype=this;var result=[];var counter=1;while(prototype){result[counter++]=prototype;prototype=prototype.__proto__;} return result;} const args=undefined;const generatePreview=false;object.callFunction(inspectedPage_node_collectPrototypes,args,generatePreview,nodePrototypesReady.bind(this));} function nodePrototypesReady(error,object,wasThrown) {if(error||wasThrown||!object) return;if(this.domNode!==domNode) return;object.deprecatedGetOwnProperties(fillSection.bind(this));} function fillSection(prototypes) {if(!prototypes) return;if(this.domNode!==domNode) return;let element=this._propertiesRow.element;element.removeChildren();let propertyPath=new WebInspector.PropertyPath(this._nodeRemoteObject,"node");let initialSection=true;for(let i=0;inew WebInspector.EventListenerSectionGroup(eventListener,options));const optionsElement=null;const defaultCollapsedSettingValue=true;let section=new WebInspector.DetailsSection(`${title}-event-listener-section`,title,groups,optionsElement,defaultCollapsedSettingValue);section.element.classList.add("event-listener-section");return section;} function generateGroupsByEvent(eventListeners){let eventListenerTypes=new Map;for(let eventListener of eventListeners){eventListener.node=WebInspector.domTreeManager.nodeForId(eventListener.nodeId);let eventListenersForType=eventListenerTypes.get(eventListener.type);if(!eventListenersForType) eventListenerTypes.set(eventListener.type,eventListenersForType=[]);eventListenersForType.push(eventListener);} let rows=[];let types=Array.from(eventListenerTypes.keys());types.sort();for(let type of types) rows.push(createEventListenerSection(type,eventListenerTypes.get(type),{hideType:true}));return rows;} function generateGroupsByNode(eventListeners){let eventListenerNodes=new Map;for(let eventListener of eventListeners){eventListener.node=WebInspector.domTreeManager.nodeForId(eventListener.nodeId);let eventListenersForNode=eventListenerNodes.get(eventListener.node);if(!eventListenersForNode) eventListenerNodes.set(eventListener.node,eventListenersForNode=[]);eventListenersForNode.push(eventListener);} let rows=[];let currentNode=domNode;do{let eventListenersForNode=eventListenerNodes.get(currentNode);if(!eventListenersForNode) continue;eventListenersForNode.sort((a,b)=>a.type.toLowerCase().extendedLocaleCompare(b.type.toLowerCase()));rows.push(createEventListenerSection(currentNode.displayName,eventListenersForNode,{hideNode:true}));}while(currentNode=currentNode.parentNode);return rows;} function eventListenersCallback(error,eventListeners) {if(error) return;if(this.domNode!==domNode) return;if(!eventListeners.length){var emptyRow=new WebInspector.DetailsSectionRow(WebInspector.UIString("No Event Listeners"));emptyRow.showEmptyMessage();this._eventListenersSectionGroup.rows=[emptyRow];return;} switch(this._eventListenerGroupingMethodSetting.value){case WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Event:this._eventListenersSectionGroup.rows=generateGroupsByEvent.call(this,eventListeners);break;case WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Node:this._eventListenersSectionGroup.rows=generateGroupsByNode.call(this,eventListeners);break;}} domNode.getEventListeners(eventListenersCallback.bind(this));} _refreshAccessibility() {if(!this._accessibilitySupported()) return;var domNode=this.domNode;if(!domNode) return;var properties={};function booleanValueToLocalizedStringIfTrue(property){if(properties[property]) return WebInspector.UIString("Yes");return"";} function booleanValueToLocalizedStringIfPropertyDefined(property){if(properties[property]!==undefined){if(properties[property]) return WebInspector.UIString("Yes");else return WebInspector.UIString("No");} return"";} function linkForNodeId(nodeId){var link=null;if(nodeId!==undefined&&typeof nodeId==="number"){var node=WebInspector.domTreeManager.nodeForId(nodeId);if(node) link=WebInspector.linkifyAccessibilityNodeReference(node);} return link;} function linkListForNodeIds(nodeIds){if(!nodeIds) return null;const itemsToShow=5;let hasLinks=false;let listItemCount=0;let container=document.createElement("div");container.classList.add("list-container");let linkList=container.createChild("ul","node-link-list");let initiallyHiddenItems=[];for(let nodeId of nodeIds){let node=WebInspector.domTreeManager.nodeForId(nodeId);if(!node) continue;let link=WebInspector.linkifyAccessibilityNodeReference(node);hasLinks=true;let li=linkList.createChild("li");li.appendChild(link);if(listItemCount>=itemsToShow){li.hidden=true;initiallyHiddenItems.push(li);} listItemCount++;} container.appendChild(linkList);if(listItemCount>itemsToShow){let moreNodesButton=container.createChild("button","expand-list-button");moreNodesButton.textContent=WebInspector.UIString("%d More\u2026").format(listItemCount-itemsToShow);moreNodesButton.addEventListener("click",()=>{initiallyHiddenItems.forEach((element)=>{element.hidden=false;});moreNodesButton.remove();});} if(hasLinks) return container;return null;} function accessibilityPropertiesCallback(accessibilityProperties){if(this.domNode!==domNode) return;properties=accessibilityProperties;if(accessibilityProperties&&accessibilityProperties.exists){var activeDescendantLink=linkForNodeId(accessibilityProperties.activeDescendantNodeId);var busy=booleanValueToLocalizedStringIfPropertyDefined("busy");var checked="";if(accessibilityProperties.checked!==undefined){if(accessibilityProperties.checked===DOMAgent.AccessibilityPropertiesChecked.True) checked=WebInspector.UIString("Yes");else if(accessibilityProperties.checked===DOMAgent.AccessibilityPropertiesChecked.Mixed) checked=WebInspector.UIString("Mixed");else checked=WebInspector.UIString("No");} var childNodeLinkList=linkListForNodeIds(accessibilityProperties.childNodeIds);var controlledNodeLinkList=linkListForNodeIds(accessibilityProperties.controlledNodeIds);var current="";switch(accessibilityProperties.current){case DOMAgent.AccessibilityPropertiesCurrent.True:current=WebInspector.UIString("True");break;case DOMAgent.AccessibilityPropertiesCurrent.Page:current=WebInspector.UIString("Page");break;case DOMAgent.AccessibilityPropertiesCurrent.Location:current=WebInspector.UIString("Location");break;case DOMAgent.AccessibilityPropertiesCurrent.Step:current=WebInspector.UIString("Step");break;case DOMAgent.AccessibilityPropertiesCurrent.Date:current=WebInspector.UIString("Date");break;case DOMAgent.AccessibilityPropertiesCurrent.Time:current=WebInspector.UIString("Time");break;default:current="";} var disabled=booleanValueToLocalizedStringIfTrue("disabled");var expanded=booleanValueToLocalizedStringIfPropertyDefined("expanded");var flowedNodeLinkList=linkListForNodeIds(accessibilityProperties.flowedNodeIds);var focused=booleanValueToLocalizedStringIfPropertyDefined("focused");var ignored="";if(accessibilityProperties.ignored){ignored=WebInspector.UIString("Yes");if(accessibilityProperties.hidden) ignored=WebInspector.UIString("%s (hidden)").format(ignored);else if(accessibilityProperties.ignoredByDefault) ignored=WebInspector.UIString("%s (default)").format(ignored);} var invalid="";if(accessibilityProperties.invalid===DOMAgent.AccessibilityPropertiesInvalid.True) invalid=WebInspector.UIString("Yes");else if(accessibilityProperties.invalid===DOMAgent.AccessibilityPropertiesInvalid.Grammar) invalid=WebInspector.UIString("Grammar");else if(accessibilityProperties.invalid===DOMAgent.AccessibilityPropertiesInvalid.Spelling) invalid=WebInspector.UIString("Spelling");var label=accessibilityProperties.label;var liveRegionStatus="";var liveRegionStatusNode=null;var liveRegionStatusToken=accessibilityProperties.liveRegionStatus;switch(liveRegionStatusToken){case DOMAgent.AccessibilityPropertiesLiveRegionStatus.Assertive:liveRegionStatus=WebInspector.UIString("Assertive");break;case DOMAgent.AccessibilityPropertiesLiveRegionStatus.Polite:liveRegionStatus=WebInspector.UIString("Polite");break;default:liveRegionStatus="";} if(liveRegionStatus){var liveRegionRelevant=accessibilityProperties.liveRegionRelevant;if(liveRegionRelevant&&liveRegionRelevant.length){if(liveRegionRelevant.length===3&&liveRegionRelevant[0]===DOMAgent.LiveRegionRelevant.Additions&&liveRegionRelevant[1]===DOMAgent.LiveRegionRelevant.Removals&&liveRegionRelevant[2]===DOMAgent.LiveRegionRelevant.Text) liveRegionRelevant=[WebInspector.UIString("All Changes")];else{liveRegionRelevant=liveRegionRelevant.map(function(value){switch(value){case DOMAgent.LiveRegionRelevant.Additions:return WebInspector.UIString("Additions");case DOMAgent.LiveRegionRelevant.Removals:return WebInspector.UIString("Removals");case DOMAgent.LiveRegionRelevant.Text:return WebInspector.UIString("Text");default:return"\""+value+"\"";}});} liveRegionStatus+=" ("+liveRegionRelevant.join(", ")+")";} if(accessibilityProperties.liveRegionAtomic){liveRegionStatusNode=document.createElement("div");liveRegionStatusNode.className="value-with-clarification";liveRegionStatusNode.setAttribute("role","text");liveRegionStatusNode.append(liveRegionStatus);var clarificationNode=document.createElement("div");clarificationNode.className="clarification";clarificationNode.append(WebInspector.UIString("Region announced in its entirety."));liveRegionStatusNode.appendChild(clarificationNode);}} var mouseEventNodeId=accessibilityProperties.mouseEventNodeId;var mouseEventTextValue="";var mouseEventNodeLink=null;if(mouseEventNodeId){if(mouseEventNodeId===accessibilityProperties.nodeId) mouseEventTextValue=WebInspector.UIString("Yes");else mouseEventNodeLink=linkForNodeId(mouseEventNodeId);} var ownedNodeLinkList=linkListForNodeIds(accessibilityProperties.ownedNodeIds);var parentNodeLink=linkForNodeId(accessibilityProperties.parentNodeId);var pressed=booleanValueToLocalizedStringIfPropertyDefined("pressed");var readonly=booleanValueToLocalizedStringIfTrue("readonly");var required=booleanValueToLocalizedStringIfPropertyDefined("required");var role=accessibilityProperties.role;let hasPopup=accessibilityProperties.isPopupButton;let roleType=null;let buttonType=null;let buttonTypePopupString=WebInspector.UIString("popup");let buttonTypeToggleString=WebInspector.UIString("toggle");let buttonTypePopupToggleString=WebInspector.UIString("popup, toggle");if(role===""||role==="unknown") role=WebInspector.UIString("No matching ARIA role");else if(role){if(role==="button"){if(pressed) buttonType=buttonTypeToggleString; if(hasPopup) buttonType=buttonType?buttonTypePopupToggleString:buttonTypePopupString;} if(!domNode.getAttribute("role")) roleType=WebInspector.UIString("default");else if(buttonType||domNode.getAttribute("role")!==role) roleType=WebInspector.UIString("computed");if(buttonType&&roleType) role=WebInspector.UIString("%s (%s, %s)").format(role,buttonType,roleType);else if(roleType||buttonType){let extraInfo=roleType||buttonType;role=WebInspector.UIString("%s (%s)").format(role,extraInfo);}} var selected=booleanValueToLocalizedStringIfTrue("selected");var selectedChildNodeLinkList=linkListForNodeIds(accessibilityProperties.selectedChildNodeIds);var headingLevel=accessibilityProperties.headingLevel;var hierarchyLevel=accessibilityProperties.hierarchyLevel;this._accessibilityNodeActiveDescendantRow.value=activeDescendantLink||"";this._accessibilityNodeBusyRow.value=busy;this._accessibilityNodeCheckedRow.value=checked;this._accessibilityNodeChildrenRow.value=childNodeLinkList||"";this._accessibilityNodeControlsRow.value=controlledNodeLinkList||"";this._accessibilityNodeCurrentRow.value=current;this._accessibilityNodeDisabledRow.value=disabled;this._accessibilityNodeExpandedRow.value=expanded;this._accessibilityNodeFlowsRow.value=flowedNodeLinkList||"";this._accessibilityNodeFocusedRow.value=focused;this._accessibilityNodeHeadingLevelRow.value=headingLevel||"";this._accessibilityNodehierarchyLevelRow.value=hierarchyLevel||"";this._accessibilityNodeIgnoredRow.value=ignored;this._accessibilityNodeInvalidRow.value=invalid;this._accessibilityNodeLabelRow.value=label;this._accessibilityNodeLiveRegionStatusRow.value=liveRegionStatusNode||liveRegionStatus;this._accessibilityNodeMouseEventRow.label=mouseEventNodeLink?WebInspector.UIString("Click Listener"):WebInspector.UIString("Clickable");this._accessibilityNodeMouseEventRow.value=mouseEventNodeLink||mouseEventTextValue;this._accessibilityNodeOwnsRow.value=ownedNodeLinkList||"";this._accessibilityNodeParentRow.value=parentNodeLink||"";this._accessibilityNodePressedRow.value=pressed;this._accessibilityNodeReadonlyRow.value=readonly;this._accessibilityNodeRequiredRow.value=required;this._accessibilityNodeRoleRow.value=role;this._accessibilityNodeSelectedRow.value=selected;this._accessibilityNodeSelectedChildrenRow.label=WebInspector.UIString("Selected Items");this._accessibilityNodeSelectedChildrenRow.value=selectedChildNodeLinkList||"";if(selectedChildNodeLinkList&&accessibilityProperties.selectedChildNodeIds.length===1) this._accessibilityNodeSelectedChildrenRow.label=WebInspector.UIString("Selected Item");this._accessibilityGroup.rows=[this._accessibilityNodeIgnoredRow,this._accessibilityNodeRoleRow,this._accessibilityNodeLabelRow,this._accessibilityNodeParentRow,this._accessibilityNodeActiveDescendantRow,this._accessibilityNodeSelectedChildrenRow,this._accessibilityNodeChildrenRow,this._accessibilityNodeOwnsRow,this._accessibilityNodeControlsRow,this._accessibilityNodeFlowsRow,this._accessibilityNodeMouseEventRow,this._accessibilityNodeFocusedRow,this._accessibilityNodeHeadingLevelRow,this._accessibilityNodehierarchyLevelRow,this._accessibilityNodeBusyRow,this._accessibilityNodeLiveRegionStatusRow,this._accessibilityNodeCurrentRow,this._accessibilityNodeDisabledRow,this._accessibilityNodeInvalidRow,this._accessibilityNodeRequiredRow,this._accessibilityNodeCheckedRow,this._accessibilityNodeExpandedRow,this._accessibilityNodePressedRow,this._accessibilityNodeReadonlyRow,this._accessibilityNodeSelectedRow];this._accessibilityEmptyRow.hideEmptyMessage();}else{this._accessibilityGroup.rows=[this._accessibilityEmptyRow];this._accessibilityEmptyRow.showEmptyMessage();}} domNode.accessibilityProperties(accessibilityPropertiesCallback.bind(this));} _attributesChanged(event) {if(event.data.node!==this.domNode) return;this._refreshAttributes();this._refreshAccessibility();} _attributeNodeValueChanged(event) {let change=event.data;let data=event.target.data;if(change.columnIdentifier==="name"){this.domNode.removeAttribute(data[change.columnIdentifier],(error)=>{this.domNode.setAttribute(change.value,`${change.value}="${data.value}"`);});}else if(change.columnIdentifier==="value") this.domNode.setAttributeValue(data.name,change.value);} _characterDataModified(event) {if(event.data.node!==this.domNode) return;this._identityNodeValueRow.value=this.domNode.nodeValue();} _customElementStateChanged(event) {if(event.data.node!==this.domNode) return;this._refreshIdentity();} _nodeTypeDisplayName() {switch(this.domNode.nodeType()){case Node.ELEMENT_NODE:{const nodeName=WebInspector.UIString("Element");const state=this._customElementState();return state===null?nodeName:`${nodeName} (${state})`;} case Node.TEXT_NODE:return WebInspector.UIString("Text Node");case Node.COMMENT_NODE:return WebInspector.UIString("Comment");case Node.DOCUMENT_NODE:return WebInspector.UIString("Document");case Node.DOCUMENT_TYPE_NODE:return WebInspector.UIString("Document Type");case Node.DOCUMENT_FRAGMENT_NODE:return WebInspector.UIString("Document Fragment");case Node.CDATA_SECTION_NODE:return WebInspector.UIString("Character Data");case Node.PROCESSING_INSTRUCTION_NODE:return WebInspector.UIString("Processing Instruction");default:console.error("Unknown DOM node type: ",this.domNode.nodeType());return this.domNode.nodeType();}} _customElementState() {const state=this.domNode.customElementState();switch(state){case WebInspector.DOMNode.CustomElementState.Builtin:return null;case WebInspector.DOMNode.CustomElementState.Custom:return WebInspector.UIString("Custom");case WebInspector.DOMNode.CustomElementState.Waiting:return WebInspector.UIString("Undefined custom element");case WebInspector.DOMNode.CustomElementState.Failed:return WebInspector.UIString("Failed to upgrade");} console.error("Unknown DOM custom element state: ",state);return null;}};WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod={Event:"event",Node:"node",};WebInspector.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName="dom-node-details-sidebar-properties-object-group";WebInspector.DOMNodeTreeElement=class DOMNodeTreeElement extends WebInspector.GeneralTreeElement {constructor(domNode) {super("dom-node",domNode.displayName,null,domNode,true);this.status=WebInspector.linkifyNodeReferenceElement(domNode,WebInspector.createGoToArrowButton());} ondelete() {WebInspector.domDebuggerManager.removeDOMBreakpointsForNode(this.representedObject);return true;} populateContextMenu(contextMenu,event) {contextMenu.appendSeparator();const allowEditing=true;WebInspector.DOMBreakpointTreeController.appendBreakpointContextMenuItems(contextMenu,this.representedObject,allowEditing);contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Reveal in DOM Tree"),()=>{WebInspector.domTreeManager.inspectElement(this.representedObject.id);});}};WebInspector.DOMStorageContentView=class DOMStorageContentView extends WebInspector.ContentView {constructor(representedObject) {super(representedObject);this.element.classList.add("dom-storage");representedObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemsCleared,this.itemsCleared,this);representedObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemAdded,this.itemAdded,this);representedObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemRemoved,this.itemRemoved,this);representedObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemUpdated,this.itemUpdated,this);let columns={};columns.key={title:WebInspector.UIString("Key"),sortable:true};columns.value={title:WebInspector.UIString("Value"),sortable:true};this._dataGrid=new WebInspector.DataGrid(columns,this._editingCallback.bind(this),this._deleteCallback.bind(this));this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Ascending;this._dataGrid.sortColumnIdentifier="key";this._dataGrid.createSettings("dom-storage-content-view");this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged,this._sortDataGrid,this);this.addSubview(this._dataGrid);this._populate();} saveToCookie(cookie) {cookie.type=WebInspector.ContentViewCookieType.DOMStorage;cookie.isLocalStorage=this.representedObject.isLocalStorage();cookie.host=this.representedObject.host;} get scrollableElements() {return[this._dataGrid.scrollContainer];} itemsCleared(event) {this._dataGrid.removeChildren();this._dataGrid.addPlaceholderNode();} itemRemoved(event) {for(let node of this._dataGrid.children){if(node.data.key===event.data.key) return this._dataGrid.removeChild(node);} return null;} itemAdded(event) {let{key,value}=event.data;value=this._truncateValue(value);for(let node of this._dataGrid.children){if(node.data.key===key) return;} this._dataGrid.appendChild(new WebInspector.DataGridNode({key,value},false));this._sortDataGrid();} itemUpdated(event) {let{key,value}=event.data;value=this._truncateValue(value);let keyFound=false;for(let childNode of this._dataGrid.children){if(childNode.data.key===key){if(keyFound){this._dataGrid.removeChild(childNode);continue;} keyFound=true;childNode.data.value=value;childNode.refresh();}} this._sortDataGrid();} _truncateValue(value) {return value.truncate(200);} _populate() {this.representedObject.getEntries(function(error,entries){if(error) return;for(let[key,value]of entries){if(!key||!value) continue;value=this._truncateValue(value);let node=new WebInspector.DataGridNode({key,value},false);this._dataGrid.appendChild(node);} this._sortDataGrid();this._dataGrid.addPlaceholderNode();this._dataGrid.updateLayout();}.bind(this));} _sortDataGrid() {let sortColumnIdentifier=this._dataGrid.sortColumnIdentifier||"key";function comparator(a,b) {return a.data[sortColumnIdentifier].extendedLocaleCompare(b.data[sortColumnIdentifier]);} this._dataGrid.sortNodesImmediately(comparator);} _deleteCallback(node) {if(!node||node.isPlaceholderNode) return;this._dataGrid.removeChild(node);this.representedObject.removeItem(node.data["key"]);} _editingCallback(editingNode,columnIdentifier,oldText,newText,moveDirection) {var key=editingNode.data["key"].trim().removeWordBreakCharacters();var value=editingNode.data["value"].trim().removeWordBreakCharacters();var previousValue=oldText.trim().removeWordBreakCharacters();var enteredValue=newText.trim().removeWordBreakCharacters();var hasUncommittedEdits=editingNode.__hasUncommittedEdits;var hasChange=previousValue!==enteredValue;var isEditingKey=columnIdentifier==="key";var isEditingValue=!isEditingKey;var domStorage=this.representedObject;if(!hasChange&&!hasUncommittedEdits) return;if(hasChange&&!editingNode.__hasUncommittedEdits){editingNode.__hasUncommittedEdits=true;editingNode.__originalKey=isEditingKey?previousValue:key;editingNode.__originalValue=isEditingValue?previousValue:value;} function cleanup() {editingNode.element.classList.remove(WebInspector.DOMStorageContentView.MissingKeyStyleClassName);editingNode.element.classList.remove(WebInspector.DOMStorageContentView.MissingValueStyleClassName);editingNode.element.classList.remove(WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName);editingNode.__hasUncommittedEdits=undefined;editingNode.__originalKey=undefined;editingNode.__originalValue=undefined;} if(isEditingKey){if(key.length) editingNode.element.classList.remove(WebInspector.DOMStorageContentView.MissingKeyStyleClassName);else editingNode.element.classList.add(WebInspector.DOMStorageContentView.MissingKeyStyleClassName);}else if(isEditingValue){if(value.length) editingNode.element.classList.remove(WebInspector.DOMStorageContentView.MissingValueStyleClassName);else editingNode.element.classList.add(WebInspector.DOMStorageContentView.MissingValueStyleClassName);} var keyChanged=key!==editingNode.__originalKey;if(keyChanged){if(domStorage.entries.has(key)) editingNode.element.classList.add(WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName);else editingNode.element.classList.remove(WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName);} var columnIndex=this._dataGrid.orderedColumns.indexOf(columnIdentifier);var mayMoveToNextRow=moveDirection==="forward"&&columnIndex===this._dataGrid.orderedColumns.length-1;var mayMoveToPreviousRow=moveDirection==="backward"&&columnIndex===0;var doneEditing=mayMoveToNextRow||mayMoveToPreviousRow||!moveDirection;if(!doneEditing) return;if(!key.length&&!value.length&&!editingNode.isPlaceholderNode){this._dataGrid.removeChild(editingNode);domStorage.removeItem(editingNode.__originalKey);return;} var isDuplicate=editingNode.element.classList.contains(WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName);if(!key.length||!value.length||isDuplicate) return;if(keyChanged&&!editingNode.isPlaceholderNode) domStorage.removeItem(editingNode.__originalKey);if(editingNode.isPlaceholderNode) this._dataGrid.addPlaceholderNode();cleanup();domStorage.setItem(key,value);}};WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName="duplicate-key";WebInspector.DOMStorageContentView.MissingKeyStyleClassName="missing-key";WebInspector.DOMStorageContentView.MissingValueStyleClassName="missing-value";WebInspector.DOMStorageTreeElement=class DOMStorageTreeElement extends WebInspector.StorageTreeElement {constructor(representedObject) {if(representedObject.isLocalStorage()) var className=WebInspector.DOMStorageTreeElement.LocalStorageIconStyleClassName;else var className=WebInspector.DOMStorageTreeElement.SessionStorageIconStyleClassName;super(className,WebInspector.displayNameForHost(representedObject.host),representedObject);} get name() {return WebInspector.displayNameForHost(this.representedObject.host);} get categoryName() {if(this.representedObject.isLocalStorage()) return WebInspector.UIString("Local Storage");return WebInspector.UIString("Session Storage");}};WebInspector.DOMStorageTreeElement.LocalStorageIconStyleClassName="local-storage-icon";WebInspector.DOMStorageTreeElement.SessionStorageIconStyleClassName="session-storage-icon";WebInspector.DOMTreeDataGrid=class DOMTreeDataGrid extends WebInspector.DataGrid {constructor() {super({name:{title:WebInspector.UIString("Node"),sortable:false,icon:true}});this._previousHoveredElement=null;this.inline=true;this.element.classList.add("dom-tree-data-grid");this.element.addEventListener("mousemove",this._onmousemove.bind(this),false);this.element.addEventListener("mouseout",this._onmouseout.bind(this),false);} _onmousemove(event) {var gridNode=this.dataGridNodeFromNode(event.target);if(!gridNode||this._previousHoveredElement===gridNode.domNode) return;this._previousHoveredElement=gridNode.domNode;WebInspector.domTreeManager.highlightDOMNode(gridNode.domNode.id);} _onmouseout(event){if(!this._previousHoveredElement) return;WebInspector.domTreeManager.hideDOMNodeHighlight();this._previousHoveredElement=null;}};WebInspector.DOMTreeDataGridNode=class DOMTreeDataGridNode extends WebInspector.DataGridNode {constructor(domNode) {super();this._domNode=domNode;} get domNode() {return this._domNode;} createCellContent(columnIdentifier,cell) {if(columnIdentifier!=="name") return super.createCellContent(columnIdentifier,cell);return this._createNameCellDocumentFragment();} _createNameCellDocumentFragment() {let fragment=document.createDocumentFragment();let mainTitle=this._domNode.displayName;fragment.append(mainTitle);let goToButton=fragment.appendChild(WebInspector.createGoToArrowButton());goToButton.addEventListener("click",this._goToArrowWasClicked.bind(this),false);return fragment;} _goToArrowWasClicked() {WebInspector.showMainFrameDOMTree(this._domNode);}};WebInspector.DOMTreeElement=class DOMTreeElement extends WebInspector.TreeElement {constructor(node,elementCloseTag) {super("",node);this._elementCloseTag=elementCloseTag;this.hasChildren=!elementCloseTag&&this._hasVisibleChildren();if(this.representedObject.nodeType()===Node.ELEMENT_NODE&&!elementCloseTag) this._canAddAttributes=true;this._searchQuery=null;this._expandedChildrenLimit=WebInspector.DOMTreeElement.InitialChildrenLimit;this._breakpointStatus=WebInspector.DOMTreeElement.BreakpointStatus.None;this._animatingHighlight=false;this._shouldHighlightAfterReveal=false;this._boundHighlightAnimationEnd=this._highlightAnimationEnd.bind(this);this._subtreeBreakpointCount=0;this._recentlyModifiedAttributes=[];this._boundNodeChangedAnimationEnd=this._nodeChangedAnimationEnd.bind(this);node.addEventListener(WebInspector.DOMNode.Event.EnabledPseudoClassesChanged,this._nodePseudoClassesDidChange,this);} static shadowRootTypeDisplayName(type) {switch(type){case WebInspector.DOMNode.ShadowRootType.UserAgent:return WebInspector.UIString("User Agent");case WebInspector.DOMNode.ShadowRootType.Open:return WebInspector.UIString("Open");case WebInspector.DOMNode.ShadowRootType.Closed:return WebInspector.UIString("Closed");}} get breakpointStatus() {return this._breakpointStatus;} set breakpointStatus(status) {if(this._breakpointStatus===status) return;let increment;if(this._breakpointStatus===WebInspector.DOMTreeElement.BreakpointStatus.None) increment=1;else if(status===WebInspector.DOMTreeElement.BreakpointStatus.None) increment=-1;this._breakpointStatus=status;this._updateBreakpointStatus();if(!increment) return;let parentElement=this.parent;while(parentElement&&!parentElement.root){parentElement.subtreeBreakpointCountDidChange(increment);parentElement=parentElement.parent;}} revealAndHighlight() {if(this._animatingHighlight) return;this._shouldHighlightAfterReveal=true;this.reveal();} subtreeBreakpointCountDidChange(increment) {this._subtreeBreakpointCount+=increment;this._updateBreakpointStatus();} isCloseTag() {return this._elementCloseTag;} highlightSearchResults(searchQuery) {if(this._searchQuery!==searchQuery){this._updateSearchHighlight(false);this._highlightResult=undefined;} this._searchQuery=searchQuery;this._searchHighlightsVisible=true;this.updateTitle(true);} hideSearchHighlights() {this._searchHighlightsVisible=false;this._updateSearchHighlight(false);} emphasizeSearchHighlight() {var highlightElement=this.title.querySelector("."+WebInspector.DOMTreeElement.SearchHighlightStyleClassName);if(!highlightElement) return;if(this._bouncyHighlightElement) this._bouncyHighlightElement.remove();this._bouncyHighlightElement=document.createElement("div");this._bouncyHighlightElement.className=WebInspector.DOMTreeElement.BouncyHighlightStyleClassName;this._bouncyHighlightElement.textContent=highlightElement.textContent;var highlightElementRect=highlightElement.getBoundingClientRect();var treeOutlineRect=this.treeOutline.element.getBoundingClientRect();this._bouncyHighlightElement.style.top=(highlightElementRect.top-treeOutlineRect.top)+"px";this._bouncyHighlightElement.style.left=(highlightElementRect.left-treeOutlineRect.left)+"px";this.title.appendChild(this._bouncyHighlightElement);function animationEnded() {if(!this._bouncyHighlightElement) return;this._bouncyHighlightElement.remove();this._bouncyHighlightElement=null;} this._bouncyHighlightElement.addEventListener("animationend",animationEnded.bind(this));} _updateSearchHighlight(show) {if(!this._highlightResult) return;function updateEntryShow(entry) {switch(entry.type){case"added":entry.parent.insertBefore(entry.node,entry.nextSibling);break;case"changed":entry.node.textContent=entry.newText;break;}} function updateEntryHide(entry) {switch(entry.type){case"added":entry.node.remove();break;case"changed":entry.node.textContent=entry.oldText;break;}} var updater=show?updateEntryShow:updateEntryHide;for(var i=0,size=this._highlightResult.length;i=this.expandedChildrenLimit){this._expandedChildrenLimit=index+1;this._updateChildren(true);} return this.children[index];} _createTooltipForNode() {var node=this.representedObject;if(!node.nodeName()||node.nodeName().toLowerCase()!=="img") return;function setTooltip(error,result,wasThrown) {if(error||wasThrown||!result||result.type!=="string") return;try{var properties=JSON.parse(result.description);var offsetWidth=properties[0];var offsetHeight=properties[1];var naturalWidth=properties[2];var naturalHeight=properties[3];if(offsetHeight===naturalHeight&&offsetWidth===naturalWidth) this.tooltip=WebInspector.UIString("%d \xd7 %d pixels").format(offsetWidth,offsetHeight);else this.tooltip=WebInspector.UIString("%d \xd7 %d pixels (Natural: %d \xd7 %d pixels)").format(offsetWidth,offsetHeight,naturalWidth,naturalHeight);}catch(e){console.error(e);}} function resolvedNode(object) {if(!object) return;function dimensions() {return"["+this.offsetWidth+","+this.offsetHeight+","+this.naturalWidth+","+this.naturalHeight+"]";} object.callFunction(dimensions,undefined,false,setTooltip.bind(this));object.release();} WebInspector.RemoteObject.resolveNode(node,"",resolvedNode.bind(this));} updateSelectionArea() {let listItemElement=this.listItemElement;if(!listItemElement) return;let indicatesTreeOutlineState=this.treeOutline&&(this.treeOutline.dragOverTreeElement===this||this.treeOutline.selectedTreeElement===this||this._animatingHighlight);if(!this.hovered&&!this.pseudoClassesEnabled&&!indicatesTreeOutlineState){if(this._selectionElement){this._selectionElement.remove();this._selectionElement=null;} return;} if(!this._selectionElement){this._selectionElement=document.createElement("div");this._selectionElement.className="selection-area";listItemElement.insertBefore(this._selectionElement,listItemElement.firstChild);} this._selectionElement.style.height=listItemElement.offsetHeight+"px";} onattach() {if(this.hovered) this.listItemElement.classList.add("hovered");this.updateTitle();if(this.editable){this.listItemElement.draggable=true;this.listItemElement.addEventListener("dragstart",this);}} onpopulate() {if(this.children.length||!this._hasVisibleChildren()||this._elementCloseTag) return;this.updateChildren();} expandRecursively() {this.representedObject.getSubtree(-1,super.expandRecursively.bind(this,Number.MAX_VALUE));} updateChildren(fullRefresh) {if(this._elementCloseTag) return;this.representedObject.getChildNodes(this._updateChildren.bind(this,fullRefresh));} insertChildElement(child,index,closingTag) {var newElement=new WebInspector.DOMTreeElement(child,closingTag);newElement.selectable=this.treeOutline._selectEnabled;this.insertChild(newElement,index);return newElement;} moveChild(child,targetIndex) {if(this.children[targetIndex]===child) return;var originalSelectedChild=this.treeOutline.selectedTreeElement;this.removeChild(child);this.insertChild(child,targetIndex);if(originalSelectedChild!==this.treeOutline.selectedTreeElement) originalSelectedChild.select();} _updateChildren(fullRefresh) {if(this._updateChildrenInProgress||!this.treeOutline._visible) return;this._updateChildrenInProgress=true;var node=this.representedObject;var selectedNode=this.treeOutline.selectedDOMNode();var originalScrollTop=0;var hasVisibleChildren=this._hasVisibleChildren();if(fullRefresh||!hasVisibleChildren){var treeOutlineContainerElement=this.treeOutline.element.parentNode;originalScrollTop=treeOutlineContainerElement.scrollTop;var selectedTreeElement=this.treeOutline.selectedTreeElement;if(selectedTreeElement&&selectedTreeElement.hasAncestor(this)) this.select();this.removeChildren();if(!hasVisibleChildren){this.hasChildren=false;this.updateTitle();this._updateChildrenInProgress=false;return;}} if(!this.hasChildren){this.hasChildren=true;this.updateTitle();} var existingChildTreeElements=new Map;for(var i=this.children.length-1;i>=0;--i){var currentChildTreeElement=this.children[i];var currentNode=currentChildTreeElement.representedObject;var currentParentNode=currentNode.parentNode;if(currentParentNode===node){existingChildTreeElements.set(currentNode,currentChildTreeElement);continue;} this.removeChildAtIndex(i);} var elementToSelect=null;var visibleChildren=this._visibleChildren();for(var i=0;ithis.expandedChildrenLimit) this.expandedChildrenLimit++;} this.adjustCollapsedRange();var lastChild=this.children.lastValue;if(node.nodeType()===Node.ELEMENT_NODE&&(!lastChild||!lastChild._elementCloseTag)) this.insertChildElement(this.representedObject,this.children.length,true);if(fullRefresh&&elementToSelect){elementToSelect.select();if(treeOutlineContainerElement&&originalScrollTop<=treeOutlineContainerElement.scrollHeight) treeOutlineContainerElement.scrollTop=originalScrollTop;} this._updateChildrenInProgress=false;} adjustCollapsedRange() { if(this.expandAllButtonElement&&this.expandAllButtonElement.__treeElement.parent) this.removeChild(this.expandAllButtonElement.__treeElement);if(!this._hasVisibleChildren()) return;var visibleChildren=this._visibleChildren();var totalChildrenCount=visibleChildren.length;for(var i=this.expandedChildCount,limit=Math.min(this.expandedChildrenLimit,totalChildrenCount);ithis.expandedChildCount){var targetButtonIndex=expandedChildCount;if(!this.expandAllButtonElement){var button=document.createElement("button");button.className="show-all-nodes";button.value="";var item=new WebInspector.TreeElement(button,null,false);item.selectable=false;item.expandAllButton=true;this.insertChild(item,targetButtonIndex);this.expandAllButtonElement=button;this.expandAllButtonElement.__treeElement=item;this.expandAllButtonElement.addEventListener("click",this.handleLoadAllChildren.bind(this),false);}else if(!this.expandAllButtonElement.__treeElement.parent) this.insertChild(this.expandAllButtonElement.__treeElement,targetButtonIndex);this.expandAllButtonElement.textContent=WebInspector.UIString("Show All Nodes (%d More)").format(totalChildrenCount-expandedChildCount);}else if(this.expandAllButtonElement) this.expandAllButtonElement=null;} handleLoadAllChildren() {var visibleChildren=this._visibleChildren();this.expandedChildrenLimit=Math.max(visibleChildren.length,this.expandedChildrenLimit+WebInspector.DOMTreeElement.InitialChildrenLimit);} onexpand() {if(this._elementCloseTag) return;if(!this.listItemElement) return;this.updateTitle();} oncollapse() {if(this._elementCloseTag) return;this.updateTitle();} onreveal() {let listItemElement=this.listItemElement;if(!listItemElement) return;let tagSpans=listItemElement.getElementsByClassName("html-tag-name");if(tagSpans.length) tagSpans[0].scrollIntoViewIfNeeded(false);else listItemElement.scrollIntoViewIfNeeded(false);if(!this._shouldHighlightAfterReveal) return;this._shouldHighlightAfterReveal=false;this._animatingHighlight=true;this.updateSelectionArea();listItemElement.addEventListener("animationend",this._boundHighlightAnimationEnd);listItemElement.classList.add(WebInspector.DOMTreeElement.HighlightStyleClassName);} onselect(treeElement,selectedByUser) {this.treeOutline.suppressRevealAndSelect=true;this.treeOutline.selectDOMNode(this.representedObject,selectedByUser);if(selectedByUser) WebInspector.domTreeManager.highlightDOMNode(this.representedObject.id);this.treeOutline.updateSelection();this.treeOutline.suppressRevealAndSelect=false;} ondeselect(treeElement) {this.treeOutline.selectDOMNode(null);} ondelete() {if(!this.editable) return false;var startTagTreeElement=this.treeOutline.findTreeElement(this.representedObject);if(startTagTreeElement) startTagTreeElement.remove();else this.remove();return true;} onenter() {if(!this.editable) return false; if(this.treeOutline.editing) return false;this._startEditing(); return true;} selectOnMouseDown(event) {super.selectOnMouseDown(event);if(this._editing) return;if(event.detail>=2) event.preventDefault();} ondblclick(event) {if(!this.editable) return false;if(this._editing||this._elementCloseTag) return;if(this._startEditingTarget(event.target)) return;if(this.hasChildren&&!this.expanded) this.expand();} _insertInLastAttributePosition(tag,node) {if(tag.getElementsByClassName("html-attribute").length>0) tag.insertBefore(node,tag.lastChild);else{var nodeName=tag.textContent.match(/^<(.*?)>$/)[1];tag.textContent="";tag.append("<"+nodeName,node,">");} this.updateSelectionArea();} _startEditingTarget(eventTarget) {if(this.treeOutline.selectedDOMNode()!==this.representedObject) return false;if(this.representedObject.isShadowRoot()||this.representedObject.isInUserAgentShadowTree()) return false;if(this.representedObject.isPseudoElement()) return false;if(this.representedObject.nodeType()!==Node.ELEMENT_NODE&&this.representedObject.nodeType()!==Node.TEXT_NODE) return false;var textNode=eventTarget.enclosingNodeOrSelfWithClass("html-text-node");if(textNode) return this._startEditingTextNode(textNode);var attribute=eventTarget.enclosingNodeOrSelfWithClass("html-attribute");if(attribute) return this._startEditingAttribute(attribute,eventTarget);var tagName=eventTarget.enclosingNodeOrSelfWithClass("html-tag-name");if(tagName) return this._startEditingTagName(tagName);return false;} _populateTagContextMenu(contextMenu,event) {let node=this.representedObject;if(!node.isInUserAgentShadowTree()){let attribute=event.target.enclosingNodeOrSelfWithClass("html-attribute");if(event.target&&event.target.tagName==="A"){let url=event.target.href;contextMenu.appendItem(WebInspector.UIString("Open in New Tab"),()=>{const frame=null;WebInspector.openURL(url,frame,{alwaysOpenExternally:true});});if(WebInspector.frameResourceManager.resourceForURL(url)){contextMenu.appendItem(WebInspector.UIString("Reveal in Resources Tab"),()=>{let frame=WebInspector.frameResourceManager.frameForIdentifier(node.frameIdentifier);const options={ignoreNetworkTab:true,ignoreSearchTab:true,};WebInspector.openURL(url,frame,options);});} contextMenu.appendItem(WebInspector.UIString("Copy Link Address"),()=>{InspectorFrontendHost.copyText(url);});contextMenu.appendSeparator();} if(this.editable){contextMenu.appendItem(WebInspector.UIString("Add Attribute"),this._addNewAttribute.bind(this));if(attribute) contextMenu.appendItem(WebInspector.UIString("Edit Attribute"),this._startEditingAttribute.bind(this,attribute,event.target));contextMenu.appendSeparator();} if(WebInspector.cssStyleManager.canForcePseudoClasses()){let pseudoSubMenu=contextMenu.appendSubMenuItem(WebInspector.UIString("Forced Pseudo-Classes"));this._populateForcedPseudoStateItems(pseudoSubMenu);contextMenu.appendSeparator();}} this._populateNodeContextMenu(contextMenu);} _populateForcedPseudoStateItems(subMenu) {var node=this.representedObject;var enabledPseudoClasses=node.enabledPseudoClasses;WebInspector.CSSStyleManager.ForceablePseudoClasses.forEach(function(pseudoClass){var label=pseudoClass.capitalize();var enabled=enabledPseudoClasses.includes(pseudoClass);subMenu.appendCheckboxItem(label,function(){node.setPseudoClassEnabled(pseudoClass,!enabled);},enabled,false);});} _populateTextContextMenu(contextMenu,textNode) {if(this.editable) contextMenu.appendItem(WebInspector.UIString("Edit Text"),this._startEditingTextNode.bind(this,textNode));this._populateNodeContextMenu(contextMenu);} _populateNodeContextMenu(contextMenu) {let node=this.representedObject;if(this.editable) contextMenu.appendItem(WebInspector.UIString("Edit as HTML"),this._editAsHTML.bind(this));if(!node.isPseudoElement()) contextMenu.appendItem(WebInspector.UIString("Copy as HTML"),this._copyHTML.bind(this));if(this.editable) contextMenu.appendItem(WebInspector.UIString("Delete Node"),this.remove.bind(this));if(node.nodeType()===Node.ELEMENT_NODE) contextMenu.appendItem(WebInspector.UIString("Scroll Into View"),this._scrollIntoView.bind(this));} _startEditing() {if(this.treeOutline.selectedDOMNode()!==this.representedObject) return false;if(!this.editable) return false;var listItem=this.listItemElement;if(this._canAddAttributes){var attribute=listItem.getElementsByClassName("html-attribute")[0];if(attribute) return this._startEditingAttribute(attribute,attribute.getElementsByClassName("html-attribute-value")[0]);return this._addNewAttribute();} if(this.representedObject.nodeType()===Node.TEXT_NODE){var textNode=listItem.getElementsByClassName("html-text-node")[0];if(textNode) return this._startEditingTextNode(textNode);return false;}} _addNewAttribute() { var container=document.createElement("span");this._buildAttributeDOM(container," ","");var attr=container.firstChild;attr.style.marginLeft="2px"; attr.style.marginRight="2px"; var tag=this.listItemElement.getElementsByClassName("html-tag")[0];this._insertInLastAttributePosition(tag,attr);return this._startEditingAttribute(attr,attr);} _triggerEditAttribute(attributeName) {var attributeElements=this.listItemElement.getElementsByClassName("html-attribute-name");for(var i=0,len=attributeElements.length;i";} function editingComitted(element,newTagName) {tagNameElement.removeEventListener("keyup",keyupListener,false);this._tagNameEditingCommitted.apply(this,arguments);} function editingCancelled() {if(closingTagElement) closingTagElement.textContent=originalClosingTagTextContent;tagNameElement.removeEventListener("keyup",keyupListener,false);this._editingCancelled.apply(this,arguments);} tagNameElement.addEventListener("keyup",keyupListener,false);var config=new WebInspector.EditingConfig(editingComitted.bind(this),editingCancelled.bind(this),tagName);this._editing=WebInspector.startEditing(tagNameElement,config);window.getSelection().setBaseAndExtent(tagNameElement,0,tagNameElement,1);return true;} _startEditingAsHTML(commitCallback,error,initialValue) {if(error) return;if(this._htmlEditElement&&WebInspector.isBeingEdited(this._htmlEditElement)) return;this._htmlEditElement=document.createElement("div");this._htmlEditElement.textContent=initialValue;var child=this.listItemElement.firstChild;while(child){child.style.display="none";child=child.nextSibling;} if(this._childrenListNode) this._childrenListNode.style.display="none";this.listItemElement.appendChild(this._htmlEditElement);this.updateSelectionArea();function commit() {commitCallback(this._htmlEditElement.textContent);dispose.call(this);} function dispose() {this._editing=false;this.listItemElement.removeChild(this._htmlEditElement);this._htmlEditElement=null;if(this._childrenListNode) this._childrenListNode.style.removeProperty("display");var child=this.listItemElement.firstChild;while(child){child.style.removeProperty("display");child=child.nextSibling;} this.updateSelectionArea();} var config=new WebInspector.EditingConfig(commit.bind(this),dispose.bind(this));config.setMultiline(true);this._editing=WebInspector.startEditing(this._htmlEditElement,config);} _attributeEditingCommitted(element,newText,oldText,attributeName,moveDirection) {this._editing=false;if(!newText.trim()) element.remove();if(!moveDirection&&newText===oldText) return;var treeOutline=this.treeOutline;function moveToNextAttributeIfNeeded(error) {if(error) this._editingCancelled(element,attributeName);if(!moveDirection) return;treeOutline._updateModifiedNodes();var attributes=this.representedObject.attributes();for(var i=0;i1) this._triggerEditAttribute(attributes[attributes.length-2].name);}}else if(moveDirection==="forward"){if(!/^\s*$/.test(newText)) this._addNewAttribute();else this._startEditingTagName();}} this.representedObject.setAttribute(attributeName,newText,moveToNextAttributeIfNeeded.bind(this));} _attributeNumberEditingCommitted(element,newText,oldText,attributeName,moveDirection) {if(newText===oldText) return;this.representedObject.setAttribute(attributeName,newText);} _tagNameEditingCommitted(element,newText,oldText,tagName,moveDirection) {this._editing=false;var self=this;function cancel() {var closingTagElement=self._distinctClosingTagElement();if(closingTagElement) closingTagElement.textContent="";self._editingCancelled(element,tagName);moveToNextAttributeIfNeeded.call(self);} function moveToNextAttributeIfNeeded() {if(moveDirection!=="forward"){this._addNewAttribute();return;} var attributes=this.representedObject.attributes();if(attributes.length>0) this._triggerEditAttribute(attributes[0].name);else this._addNewAttribute();} newText=newText.trim();if(newText===oldText){cancel();return;} var treeOutline=this.treeOutline;var wasExpanded=this.expanded;function changeTagNameCallback(error,nodeId) {if(error||!nodeId){cancel();return;} var node=WebInspector.domTreeManager.nodeForId(nodeId);treeOutline._updateModifiedNodes();treeOutline.selectDOMNode(node,true);var newTreeItem=treeOutline.findTreeElement(node);if(wasExpanded) newTreeItem.expand();moveToNextAttributeIfNeeded.call(newTreeItem);} this.representedObject.setNodeName(newText,changeTagNameCallback);} _textNodeEditingCommitted(element,newText) {this._editing=false;var textNode;if(this.representedObject.nodeType()===Node.ELEMENT_NODE){ textNode=this.representedObject.firstChild;}else if(this.representedObject.nodeType()===Node.TEXT_NODE) textNode=this.representedObject;textNode.setNodeValue(newText,this.updateTitle.bind(this));} _editingCancelled(element,context) {this._editing=false;this.updateTitle();} _distinctClosingTagElement() { if(this.expanded){var closers=this._childrenListNode.querySelectorAll(".close");return closers[closers.length-1];} var tags=this.listItemElement.getElementsByClassName("html-tag");return tags.length===1?null:tags[tags.length-1];} updateTitle(onlySearchQueryChanged) {if(this._editing) return;if(onlySearchQueryChanged){if(this._highlightResult) this._updateSearchHighlight(false);}else{this.title=document.createElement("span");this.title.appendChild(this._nodeTitleInfo().titleDOM);this._highlightResult=undefined;} this._selectionElement=null;this.updateSelectionArea();this._highlightSearchResults();this._updateBreakpointStatus();} _buildAttributeDOM(parentElement,name,value,node) {let hasText=value.length>0;let attrSpanElement=parentElement.createChild("span","html-attribute");let attrNameElement=attrSpanElement.createChild("span","html-attribute-name");attrNameElement.textContent=name;let attrValueElement=null;if(hasText) attrSpanElement.append("=\u200B\"");if(name==="src"||/\bhref\b/.test(name)){let baseURL=node.ownerDocument?node.ownerDocument.documentURL:null;let rewrittenURL=absoluteURL(value,baseURL);value=value.insertWordBreakCharacters();if(!rewrittenURL){attrValueElement=attrSpanElement.createChild("span","html-attribute-value");attrValueElement.textContent=value;}else{if(value.startsWith("data:")) value=value.trimMiddle(60);attrValueElement=document.createElement("a");attrValueElement.href=rewrittenURL;attrValueElement.textContent=value;attrSpanElement.appendChild(attrValueElement);}}else if(name==="srcset"){let baseURL=node.ownerDocument?node.ownerDocument.documentURL:null;attrValueElement=attrSpanElement.createChild("span","html-attribute-value");let groups=value.split(/\s*,\s*/);for(let i=0;i");parentElement.append("\u200B");} _nodeTitleInfo() {var node=this.representedObject;var info={titleDOM:document.createDocumentFragment(),hasChildren:this.hasChildren};function trimedNodeValue() { return node.nodeValue().replace(/^[\n\r]*/,"").replace(/\s*$/,"");} switch(node.nodeType()){case Node.DOCUMENT_FRAGMENT_NODE:var fragmentElement=info.titleDOM.createChild("span","html-fragment");if(node.shadowRootType()){fragmentElement.textContent=WebInspector.UIString("Shadow Content (%s)").format(WebInspector.DOMTreeElement.shadowRootTypeDisplayName(node.shadowRootType()));this.listItemElement.classList.add("shadow");}else if(node.parentNode&&node.parentNode.templateContent()===node){fragmentElement.textContent=WebInspector.UIString("Template Content");this.listItemElement.classList.add("template");}else{fragmentElement.textContent=WebInspector.UIString("Document Fragment");this.listItemElement.classList.add("fragment");} break;case Node.ATTRIBUTE_NODE:var value=node.value||"\u200B";this._buildAttributeDOM(info.titleDOM,node.name,value);break;case Node.ELEMENT_NODE:if(node.isPseudoElement()){var pseudoElement=info.titleDOM.createChild("span","html-pseudo-element");pseudoElement.textContent="::"+node.pseudoType();info.titleDOM.appendChild(document.createTextNode("\u200B"));info.hasChildren=false;break;} var tagName=node.nodeNameInCorrectCase();if(this._elementCloseTag){this._buildTagDOM(info.titleDOM,tagName,true,true);info.hasChildren=false;break;} this._buildTagDOM(info.titleDOM,tagName,false,false);var textChild=this._singleTextChild(node);var showInlineText=textChild&&textChild.nodeValue().length");break;case Node.DOCUMENT_TYPE_NODE:var docTypeElement=info.titleDOM.createChild("span","html-doctype");docTypeElement.append("");break;case Node.CDATA_SECTION_NODE:var cdataElement=info.titleDOM.createChild("span","html-text-node");cdataElement.append("");break;case Node.PROCESSING_INSTRUCTION_NODE:var processingInstructionElement=info.titleDOM.createChild("span","html-processing-instruction");var data=node.nodeValue();var dataString=data.length?" "+data:"";var title="";processingInstructionElement.append(title);break;default:info.titleDOM.append(node.nodeNameInCorrectCase().collapseWhitespace());} return info;} _singleTextChild(node) {if(!node) return null;var firstChild=node.firstChild;if(!firstChild||firstChild.nodeType()!==Node.TEXT_NODE) return null;if(node.hasShadowRoots()) return null;if(node.templateContent()) return null;if(node.hasPseudoElements()) return null;var sibling=firstChild.nextSibling;return sibling?null:firstChild;} _showInlineText(node) {if(node.nodeType()===Node.ELEMENT_NODE){var textChild=this._singleTextChild(node);if(textChild&&textChild.nodeValue().length=0;--i){if(this._recentlyModifiedAttributes[i].element===element) this._recentlyModifiedAttributes.splice(i,1);}} get pseudoClassesEnabled() {return!!this.representedObject.enabledPseudoClasses.length;} _nodePseudoClassesDidChange(event) {if(this._elementCloseTag) return;this.updateSelectionArea();this.listItemElement.classList.toggle("pseudo-class-enabled",!!this.representedObject.enabledPseudoClasses.length);} _fireDidChange() {super._fireDidChange();this._markNodeChanged();} handleEvent(event) {if(event.type==="dragstart"&&this._editing) event.preventDefault();} _updateBreakpointStatus() {let listItemElement=this.listItemElement;if(!listItemElement) return;let hasBreakpoint=this._breakpointStatus!==WebInspector.DOMTreeElement.BreakpointStatus.None;let hasSubtreeBreakpoints=!!this._subtreeBreakpointCount;if(!hasBreakpoint&&!hasSubtreeBreakpoints){if(this._statusImageElement) this._statusImageElement.remove();return;} if(!this._statusImageElement){this._statusImageElement=useSVGSymbol("Images/DOMBreakpoint.svg","status-image");this._statusImageElement.classList.add("breakpoint");this._statusImageElement.addEventListener("click",this._statusImageClicked.bind(this));this._statusImageElement.addEventListener("contextmenu",this._statusImageContextmenu.bind(this));this._statusImageElement.addEventListener("mousedown",(event)=>{event.stopPropagation();});} this._statusImageElement.classList.toggle("subtree",!hasBreakpoint&&hasSubtreeBreakpoints);this.listItemElement.insertBefore(this._statusImageElement,this.listItemElement.firstChild);let disabled=this._breakpointStatus===WebInspector.DOMTreeElement.BreakpointStatus.DisabledBreakpoint;this._statusImageElement.classList.toggle("disabled",disabled);} _statusImageClicked(event) {if(this._breakpointStatus===WebInspector.DOMTreeElement.BreakpointStatus.None) return;if(event.button!==0||event.ctrlKey) return;let breakpoints=WebInspector.domDebuggerManager.domBreakpointsForNode(this.representedObject);if(!breakpoints||!breakpoints.length) return;let shouldEnable=breakpoints.some((breakpoint)=>breakpoint.disabled);breakpoints.forEach((breakpoint)=>breakpoint.disabled=!shouldEnable);} _statusImageContextmenu(event) {let hasBreakpoint=this._breakpointStatus!==WebInspector.DOMTreeElement.BreakpointStatus.None;let hasSubtreeBreakpoints=!!this._subtreeBreakpointCount;if(!hasBreakpoint&&!hasSubtreeBreakpoints) return;let contextMenu=WebInspector.ContextMenu.createFromEvent(event);if(hasBreakpoint){const allowEditing=true;WebInspector.DOMBreakpointTreeController.appendBreakpointContextMenuItems(contextMenu,this.representedObject,allowEditing);return;} contextMenu.appendItem(WebInspector.UIString("Reveal Breakpoint"),()=>{let breakpointTreeElement=this.selfOrDescendant((treeElement)=>treeElement.breakpointStatus&&treeElement.breakpointStatus!==WebInspector.DOMTreeElement.BreakpointStatus.None);if(!breakpointTreeElement) return;breakpointTreeElement.revealAndHighlight();});} _highlightAnimationEnd() {let listItemElement=this.listItemElement;if(!listItemElement) return;listItemElement.removeEventListener("animationend",this._boundHighlightAnimationEnd);listItemElement.classList.remove(WebInspector.DOMTreeElement.HighlightStyleClassName);this._animatingHighlight=false;}};WebInspector.DOMTreeElement.InitialChildrenLimit=500;WebInspector.DOMTreeElement.MaximumInlineTextChildLength=80; WebInspector.DOMTreeElement.ForbiddenClosingTagElements=["area","base","basefont","br","canvas","col","command","embed","frame","hr","img","input","keygen","link","meta","param","source","wbr","track","menuitem"].keySet();WebInspector.DOMTreeElement.EditTagBlacklist=["html","head","body"].keySet();WebInspector.DOMTreeElement.ChangeType={Attribute:"dom-tree-element-change-type-attribute"};WebInspector.DOMTreeElement.BreakpointStatus={None:Symbol("none"),Breakpoint:Symbol("breakpoint"),DisabledBreakpoint:Symbol("disabled-breakpoint"),};WebInspector.DOMTreeElement.HighlightStyleClassName="highlight";WebInspector.DOMTreeElement.SearchHighlightStyleClassName="search-highlight";WebInspector.DOMTreeElement.BouncyHighlightStyleClassName="bouncy-highlight";WebInspector.DOMTreeElementPathComponent=class DOMTreeElementPathComponent extends WebInspector.HierarchicalPathComponent {constructor(domTreeElement,representedObject) {var node=domTreeElement.representedObject;var title=null;var className=null;switch(node.nodeType()){case Node.ELEMENT_NODE:if(node.isPseudoElement()){className=WebInspector.DOMTreeElementPathComponent.DOMPseudoElementIconStyleClassName;title="::"+node.pseudoType();}else{className=WebInspector.DOMTreeElementPathComponent.DOMElementIconStyleClassName;title=node.displayName;} break;case Node.TEXT_NODE:className=WebInspector.DOMTreeElementPathComponent.DOMTextNodeIconStyleClassName;title="\""+node.nodeValue().trimEnd(32)+"\"";break;case Node.COMMENT_NODE:className=WebInspector.DOMTreeElementPathComponent.DOMCommentIconStyleClassName;title="";break;case Node.DOCUMENT_TYPE_NODE:className=WebInspector.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName;title="";break;case Node.DOCUMENT_NODE:className=WebInspector.DOMTreeElementPathComponent.DOMDocumentIconStyleClassName;title=node.nodeNameInCorrectCase();break;case Node.CDATA_SECTION_NODE:className=WebInspector.DOMTreeElementPathComponent.DOMCharacterDataIconStyleClassName;title="";break;case Node.DOCUMENT_FRAGMENT_NODE: className=WebInspector.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName;if(node.shadowRootType()) title=WebInspector.UIString("Shadow Content");else title=node.displayName;break;case Node.PROCESSING_INSTRUCTION_NODE:className=WebInspector.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName;title=node.nodeNameInCorrectCase();break;default:console.error("Unknown DOM node type: ",node.nodeType());className=WebInspector.DOMTreeElementPathComponent.DOMNodeIconStyleClassName;title=node.nodeNameInCorrectCase();} super(title,className,representedObject||domTreeElement.representedObject);this._domTreeElement=domTreeElement;} get domTreeElement() {return this._domTreeElement;} get previousSibling() {if(!this._domTreeElement.previousSibling) return null;return new WebInspector.DOMTreeElementPathComponent(this._domTreeElement.previousSibling);} get nextSibling() {if(!this._domTreeElement.nextSibling) return null;if(this._domTreeElement.nextSibling.isCloseTag()) return null;return new WebInspector.DOMTreeElementPathComponent(this._domTreeElement.nextSibling);} mouseOver() {var nodeId=this._domTreeElement.representedObject.id;WebInspector.domTreeManager.highlightDOMNode(nodeId);} mouseOut() {WebInspector.domTreeManager.hideDOMNodeHighlight();}};WebInspector.DOMTreeElementPathComponent.DOMElementIconStyleClassName="dom-element-icon";WebInspector.DOMTreeElementPathComponent.DOMPseudoElementIconStyleClassName="dom-pseudo-element-icon";WebInspector.DOMTreeElementPathComponent.DOMTextNodeIconStyleClassName="dom-text-node-icon";WebInspector.DOMTreeElementPathComponent.DOMCommentIconStyleClassName="dom-comment-icon";WebInspector.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName="dom-document-type-icon";WebInspector.DOMTreeElementPathComponent.DOMDocumentIconStyleClassName="dom-document-icon";WebInspector.DOMTreeElementPathComponent.DOMCharacterDataIconStyleClassName="dom-character-data-icon";WebInspector.DOMTreeElementPathComponent.DOMNodeIconStyleClassName="dom-node-icon";WebInspector.DOMTreeOutline=class DOMTreeOutline extends WebInspector.TreeOutline {constructor(omitRootDOMNode,selectEnabled,excludeRevealElementContextMenu) {super();this.element.addEventListener("mousedown",this._onmousedown.bind(this),false);this.element.addEventListener("mousemove",this._onmousemove.bind(this),false);this.element.addEventListener("mouseout",this._onmouseout.bind(this),false);this.element.addEventListener("dragstart",this._ondragstart.bind(this),false);this.element.addEventListener("dragover",this._ondragover.bind(this),false);this.element.addEventListener("dragleave",this._ondragleave.bind(this),false);this.element.addEventListener("drop",this._ondrop.bind(this),false);this.element.addEventListener("dragend",this._ondragend.bind(this),false);this.element.classList.add("dom",WebInspector.SyntaxHighlightedStyleClassName);this._includeRootDOMNode=!omitRootDOMNode;this._selectEnabled=selectEnabled;this._excludeRevealElementContextMenu=excludeRevealElementContextMenu;this._rootDOMNode=null;this._selectedDOMNode=null;this._editable=false;this._editing=false;this._visible=false;this._hideElementKeyboardShortcut=new WebInspector.KeyboardShortcut(null,"H",this._hideElement.bind(this),this.element);this._hideElementKeyboardShortcut.implicitlyPreventsDefault=false;WebInspector.showShadowDOMSetting.addEventListener(WebInspector.Setting.Event.Changed,this._showShadowDOMSettingChanged,this);} wireToDomAgent() {this._elementsTreeUpdater=new WebInspector.DOMTreeUpdater(this);} close() {WebInspector.showShadowDOMSetting.removeEventListener(null,null,this);if(this._elementsTreeUpdater){this._elementsTreeUpdater.close();this._elementsTreeUpdater=null;}} setVisible(visible,omitFocus) {this._visible=visible;if(!this._visible) return;this._updateModifiedNodes();if(this._selectedDOMNode) this._revealAndSelectNode(this._selectedDOMNode,omitFocus);this.update();} get rootDOMNode() {return this._rootDOMNode;} set rootDOMNode(x) {if(this._rootDOMNode===x) return;this._rootDOMNode=x;this._isXMLMimeType=x&&x.isXMLNode();this.update();} get isXMLMimeType() {return this._isXMLMimeType;} selectedDOMNode() {return this._selectedDOMNode;} selectDOMNode(node,focus) {if(this._selectedDOMNode===node){this._revealAndSelectNode(node,!focus);return;} this._selectedDOMNode=node;this._revealAndSelectNode(node,!focus); if(!node||this._selectedDOMNode===node) this._selectedNodeChanged();} get editable() {return this._editable;} set editable(x) {this._editable=x;} get editing() {return this._editing;} update() {if(!this.rootDOMNode) return;let selectedNode=this.selectedTreeElement?this.selectedTreeElement.representedObject:null;this.removeChildren();var treeElement;if(this._includeRootDOMNode){treeElement=new WebInspector.DOMTreeElement(this.rootDOMNode);treeElement.selectable=this._selectEnabled;this.appendChild(treeElement);}else{ var node=this.rootDOMNode.firstChild;while(node){treeElement=new WebInspector.DOMTreeElement(node);treeElement.selectable=this._selectEnabled;this.appendChild(treeElement);node=node.nextSibling;if(treeElement.hasChildren&&!treeElement.expanded) treeElement.expand();}} if(selectedNode) this._revealAndSelectNode(selectedNode,true);} updateSelection() { if(this.selectedTreeElement) this.selectedTreeElement.updateSelectionArea();} _selectedNodeChanged() {this.dispatchEventToListeners(WebInspector.DOMTreeOutline.Event.SelectedNodeChanged);} findTreeElement(node) {let isAncestorNode=(ancestor,node)=>ancestor.isAncestor(node);let parentNode=(node)=>node.parentNode;let treeElement=super.findTreeElement(node,isAncestorNode,parentNode);if(!treeElement&&node.nodeType()===Node.TEXT_NODE){treeElement=super.findTreeElement(node.parentNode,isAncestorNode,parentNode);} return treeElement;} createTreeElementFor(node) {var treeElement=this.findTreeElement(node);if(treeElement) return treeElement;if(!node.parentNode) return null;treeElement=this.createTreeElementFor(node.parentNode);if(!treeElement) return null;return treeElement.showChildNode(node);} set suppressRevealAndSelect(x) {if(this._suppressRevealAndSelect===x) return;this._suppressRevealAndSelect=x;} populateContextMenu(contextMenu,event,treeElement) {let tag=event.target.enclosingNodeOrSelfWithClass("html-tag");let textNode=event.target.enclosingNodeOrSelfWithClass("html-text-node");let commentNode=event.target.enclosingNodeOrSelfWithClass("html-comment");let pseudoElement=event.target.enclosingNodeOrSelfWithClass("html-pseudo-element");if(tag&&treeElement._populateTagContextMenu){contextMenu.appendSeparator();treeElement._populateTagContextMenu(contextMenu,event);}else if(textNode&&treeElement._populateTextContextMenu){contextMenu.appendSeparator();treeElement._populateTextContextMenu(contextMenu,textNode);}else if((commentNode||pseudoElement)&&treeElement._populateNodeContextMenu){contextMenu.appendSeparator();treeElement._populateNodeContextMenu(contextMenu);} const options={excludeRevealElement:this._excludeRevealElementContextMenu};WebInspector.appendContextMenuItemsForDOMNode(contextMenu,treeElement.representedObject,options);super.populateContextMenu(contextMenu,event,treeElement);} adjustCollapsedRange() {} _revealAndSelectNode(node,omitFocus) {if(!node||this._suppressRevealAndSelect) return;if(!WebInspector.showShadowDOMSetting.value){while(node&&node.isInShadowTree()) node=node.parentNode;if(!node) return;} var treeElement=this.createTreeElementFor(node);if(!treeElement) return;treeElement.revealAndSelect(omitFocus);} _onmousedown(event) {let element=this.treeElementFromEvent(event);if(!element||element.isEventWithinDisclosureTriangle(event)){event.preventDefault();return;} element.select();} _onmousemove(event) {let element=this.treeElementFromEvent(event);if(element&&this._previousHoveredElement===element) return;if(this._previousHoveredElement){this._previousHoveredElement.hovered=false;this._previousHoveredElement=null;} if(element){element.hovered=true;this._previousHoveredElement=element;if(element.representedObject&&!element.tooltip&&element._createTooltipForNode) element._createTooltipForNode();} WebInspector.domTreeManager.highlightDOMNode(element?element.representedObject.id:0);} _onmouseout(event) {var nodeUnderMouse=document.elementFromPoint(event.pageX,event.pageY);if(nodeUnderMouse&&nodeUnderMouse.isDescendant(this.element)) return;if(this._previousHoveredElement){this._previousHoveredElement.hovered=false;this._previousHoveredElement=null;} WebInspector.domTreeManager.hideDOMNodeHighlight();} _ondragstart(event) {let treeElement=this.treeElementFromEvent(event);if(!treeElement) return false;if(!this._isValidDragSourceOrTarget(treeElement)) return false;if(treeElement.representedObject.nodeName()==="BODY"||treeElement.representedObject.nodeName()==="HEAD") return false;event.dataTransfer.setData("text/plain",treeElement.listItemElement.textContent);event.dataTransfer.effectAllowed="copyMove";this._nodeBeingDragged=treeElement.representedObject;WebInspector.domTreeManager.hideDOMNodeHighlight();return true;} _ondragover(event) {if(event.dataTransfer.types.includes(WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType)){event.preventDefault();event.dataTransfer.dropEffect="copy";return false;} if(!this._nodeBeingDragged) return false;let treeElement=this.treeElementFromEvent(event);if(!this._isValidDragSourceOrTarget(treeElement)) return false;let node=treeElement.representedObject;while(node){if(node===this._nodeBeingDragged) return false;node=node.parentNode;} this.dragOverTreeElement=treeElement;treeElement.listItemElement.classList.add("elements-drag-over");treeElement.updateSelectionArea();event.preventDefault();event.dataTransfer.dropEffect="move";return false;} _ondragleave(event) {this._clearDragOverTreeElementMarker();event.preventDefault();return false;} _isValidDragSourceOrTarget(treeElement) {if(!treeElement) return false;var node=treeElement.representedObject;if(!(node instanceof WebInspector.DOMNode)) return false;if(!node.parentNode||node.parentNode.nodeType()!==Node.ELEMENT_NODE) return false;return true;} _ondrop(event) {event.preventDefault();function callback(error,newNodeId) {if(error) return;this._updateModifiedNodes();var newNode=WebInspector.domTreeManager.nodeForId(newNodeId);if(newNode) this.selectDOMNode(newNode,true);} let treeElement=this.treeElementFromEvent(event);if(this._nodeBeingDragged&&treeElement){let parentNode=null;let anchorNode=null;if(treeElement._elementCloseTag){parentNode=treeElement.representedObject;}else{let dragTargetNode=treeElement.representedObject;parentNode=dragTargetNode.parentNode;anchorNode=dragTargetNode;} this._nodeBeingDragged.moveTo(parentNode,anchorNode,callback.bind(this));}else{let className=event.dataTransfer.getData(WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType);if(className&&treeElement) treeElement.representedObject.toggleClass(className,true);} delete this._nodeBeingDragged;} _ondragend(event) {event.preventDefault();this._clearDragOverTreeElementMarker();delete this._nodeBeingDragged;} _clearDragOverTreeElementMarker() {if(this.dragOverTreeElement){let element=this.dragOverTreeElement;this.dragOverTreeElement=null;element.listItemElement.classList.remove("elements-drag-over");element.updateSelectionArea();}} _updateModifiedNodes() {if(this._elementsTreeUpdater) this._elementsTreeUpdater._updateModifiedNodes();} _showShadowDOMSettingChanged(event) {var nodeToSelect=this.selectedTreeElement?this.selectedTreeElement.representedObject:null;while(nodeToSelect){if(!nodeToSelect.isInShadowTree()) break;nodeToSelect=nodeToSelect.parentNode;} this.children.forEach(function(child){child.updateChildren(true);});if(nodeToSelect) this.selectDOMNode(nodeToSelect);} _hideElement(event,keyboardShortcut) {if(!this.selectedTreeElement||WebInspector.isEditingAnyField()) return;event.preventDefault();var effectiveNode=this.selectedTreeElement.representedObject;if(!effectiveNode) return;if(effectiveNode.isPseudoElement()){effectiveNode=effectiveNode.parentNode;if(!effectiveNode) return;} if(effectiveNode.nodeType()!==Node.ELEMENT_NODE) return;function resolvedNode(object) {if(!object) return;function injectStyleAndToggleClass() {var hideElementStyleSheetIdOrClassName="__WebInspectorHideElement__";var styleElement=document.getElementById(hideElementStyleSheetIdOrClassName);if(!styleElement){styleElement=document.createElement("style");styleElement.id=hideElementStyleSheetIdOrClassName;styleElement.textContent="."+hideElementStyleSheetIdOrClassName+" { visibility: hidden !important; }";document.head.appendChild(styleElement);} this.classList.toggle(hideElementStyleSheetIdOrClassName);} object.callFunction(injectStyleAndToggleClass,undefined,false,function(){});object.release();} WebInspector.RemoteObject.resolveNode(effectiveNode,"",resolvedNode);}};WebInspector.DOMTreeOutline.Event={SelectedNodeChanged:"dom-tree-outline-selected-node-changed"};WebInspector.DOMTreeUpdater=function(treeOutline) {WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeInserted,this._nodeInserted,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeRemoved,this._nodeRemoved,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeModified,this._attributesUpdated,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeRemoved,this._attributesUpdated,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.CharacterDataModified,this._characterDataModified,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.DocumentUpdated,this._documentUpdated,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ChildNodeCountUpdated,this._childNodeCountUpdated,this);this._treeOutline=treeOutline;this._recentlyInsertedNodes=new Map;this._recentlyDeletedNodes=new Map;this._recentlyModifiedNodes=new Set;this._recentlyModifiedAttributes=new Map;this._textContentAttributeSymbol=Symbol("text-content-attribute");};WebInspector.DOMTreeUpdater.prototype={close:function() {WebInspector.domTreeManager.removeEventListener(null,null,this);},_documentUpdated:function(event) {this._reset();},_attributesUpdated:function(event) {let{node,name}=event.data;this._nodeAttributeModified(node,name);},_characterDataModified:function(event) {let{node}=event.data;this._nodeAttributeModified(node,this._textContentAttributeSymbol);},_nodeAttributeModified:function(node,attribute) {if(!this._recentlyModifiedAttributes.has(attribute)) this._recentlyModifiedAttributes.set(attribute,new Set);this._recentlyModifiedAttributes.get(attribute).add(node);this._recentlyModifiedNodes.add(node);if(this._treeOutline._visible) this.onNextFrame._updateModifiedNodes();},_nodeInserted:function(event) {this._recentlyInsertedNodes.set(event.data.node,{parent:event.data.parent});if(this._treeOutline._visible) this.onNextFrame._updateModifiedNodes();},_nodeRemoved:function(event) {this._recentlyDeletedNodes.set(event.data.node,{parent:event.data.parent});if(this._treeOutline._visible) this.onNextFrame._updateModifiedNodes();},_childNodeCountUpdated:function(event) {var treeElement=this._treeOutline.findTreeElement(event.data);if(treeElement) treeElement.hasChildren=event.data.hasChildNodes();},_updateModifiedNodes:function() { let parentElementsToUpdate=new Set;let markNodeParentForUpdate=(value,key,map)=>{let parentNode=value.parent;let parentTreeElement=this._treeOutline.findTreeElement(parentNode);if(parentTreeElement) parentElementsToUpdate.add(parentTreeElement);};this._recentlyInsertedNodes.forEach(markNodeParentForUpdate);this._recentlyDeletedNodes.forEach(markNodeParentForUpdate);for(let parentTreeElement of parentElementsToUpdate){parentTreeElement.updateTitle();parentTreeElement.updateChildren();} for(let node of this._recentlyModifiedNodes.values()){let nodeTreeElement=this._treeOutline.findTreeElement(node);if(!nodeTreeElement) return;for(let[attribute,nodes]of this._recentlyModifiedAttributes.entries()){if(attribute===this._textContentAttributeSymbol) continue;if(nodes.has(node)) nodeTreeElement.attributeDidChange(attribute);} nodeTreeElement.updateTitle();} this._recentlyInsertedNodes.clear();this._recentlyDeletedNodes.clear();this._recentlyModifiedNodes.clear();this._recentlyModifiedAttributes.clear();},_reset:function() {WebInspector.domTreeManager.hideDOMNodeHighlight();this._recentlyInsertedNodes.clear();this._recentlyDeletedNodes.clear();this._recentlyModifiedNodes.clear();this._recentlyModifiedAttributes.clear();}};WebInspector.DashboardContainerView=class DashboardContainerView extends WebInspector.Object {constructor() {super();this._toolbarItem=new WebInspector.NavigationItem("dashboard-container","group",WebInspector.UIString("Activity Viewer"));this._advanceForwardArrowElement=this._toolbarItem.element.appendChild(document.createElement("div"));this._advanceForwardArrowElement.className="advance-arrow advance-forward";this._advanceBackwardArrowElement=this._toolbarItem.element.appendChild(document.createElement("div"));this._advanceBackwardArrowElement.className="advance-arrow advance-backward";this._advanceForwardArrowElement.addEventListener("click",this._advanceForwardArrowClicked.bind(this));this._advanceBackwardArrowElement.addEventListener("click",this._advanceBackwardArrowClicked.bind(this));this._dashboardStack=[];this._currentIndex=-1;this._updateAdvanceArrowVisibility();} get toolbarItem() {return this._toolbarItem;} get currentDashboardView() {if(this._currentIndex===-1) return null;return this._dashboardStack[this._currentIndex];} showDashboardViewForRepresentedObject(representedObject) {var dashboardView=this._dashboardViewForRepresentedObject(representedObject);if(!dashboardView) return null;if(this.currentDashboardView===dashboardView) return dashboardView;var index=this._dashboardStack.indexOf(dashboardView);this._showDashboardAtIndex(index);return dashboardView;} hideDashboardViewForRepresentedObject(representedObject) {var onlyReturnExistingViews=true;var dashboardView=this._dashboardViewForRepresentedObject(representedObject,onlyReturnExistingViews);if(this.currentDashboardView!==dashboardView) return;this._showDashboardAtIndex(this._currentIndex-1);} closeDashboardViewForRepresentedObject(representedObject) {var onlyReturnExistingViews=true;var dashboardView=this._dashboardViewForRepresentedObject(representedObject,onlyReturnExistingViews);if(!dashboardView) return;this._closeDashboardView(dashboardView);} _advanceForwardArrowClicked() {this._showDashboardAtIndex(this._currentIndex+1);} _advanceBackwardArrowClicked() {this._showDashboardAtIndex(this._currentIndex-1);} _dismissAdvanceArrows() {this._advanceForwardArrowElement.classList.add(WebInspector.DashboardContainerView.InactiveStyleClassName);this._advanceBackwardArrowElement.classList.add(WebInspector.DashboardContainerView.InactiveStyleClassName);} _updateAdvanceArrowVisibility() {var canAdvanceForward=this._currentIndex0;this._advanceForwardArrowElement.classList.toggle(WebInspector.DashboardContainerView.InactiveStyleClassName,!canAdvanceForward);this._advanceBackwardArrowElement.classList.toggle(WebInspector.DashboardContainerView.InactiveStyleClassName,!canAdvanceBackward);} _dashboardViewForRepresentedObject(representedObject,onlyReturnExistingViews) {for(var dashboardView of this._dashboardStack){if(dashboardView.representedObject===representedObject) return dashboardView;} if(onlyReturnExistingViews) return null;dashboardView=WebInspector.DashboardView.create(representedObject);if(!dashboardView) return null;this._dashboardStack.push(dashboardView);this._toolbarItem.element.appendChild(dashboardView.element);return dashboardView;} _showDashboardAtIndex(index) {if(this._currentIndex===index) return;var advanceDirection=null;if(this._currentIndexindex) --this._currentIndex;dissociateDashboardView.call(this);this._updateAdvanceArrowVisibility();}};WebInspector.DashboardContainerView.VisibleDashboardStyleClassName="visible";WebInspector.DashboardContainerView.InactiveStyleClassName="inactive";WebInspector.DashboardContainerView.AdvanceDirection={Forward:Symbol("dashboard-container-view-advance-direction-forward"),Backward:Symbol("dashboard-container-view-advance-direction-backward"),None:Symbol("dashboard-container-view-advance-direction-none")};WebInspector.DashboardContainerView.ForwardIncomingDashboardStyleClassName="slide-in-down";WebInspector.DashboardContainerView.BackwardIncomingDashboardStyleClassName="slide-in-up";WebInspector.DashboardContainerView.ForwardOutgoingDashboardStyleClassName="slide-out-down";WebInspector.DashboardContainerView.BackwardOutgoingDashboardStyleClassName="slide-out-up";WebInspector.DashboardView=class DashboardView extends WebInspector.Object {constructor(representedObject,identifier) {super();this._representedObject=representedObject;this._element=document.createElement("div");this._element.classList.add("dashboard");this._element.classList.add(identifier);} static create(representedObject) {if(representedObject instanceof WebInspector.DefaultDashboard) return new WebInspector.DefaultDashboardView(representedObject);if(representedObject instanceof WebInspector.DebuggerDashboard) return new WebInspector.DebuggerDashboardView(representedObject);throw"Can't make a DashboardView for an unknown representedObject.";} get element() {return this._element;} get representedObject() {return this._representedObject;} shown() {} hidden() {} closed() {}};WebInspector.DatabaseContentView=class DatabaseContentView extends WebInspector.ContentView {constructor(representedObject) {super(representedObject);this.database=representedObject;this.element.classList.add("storage-view","query","monospace");this._prompt=new WebInspector.ConsolePrompt(this,"text/x-sql");this.addSubview(this._prompt);this.element.addEventListener("click",this._messagesClicked.bind(this),true);} saveToCookie(cookie) {cookie.type=WebInspector.ContentViewCookieType.Database;cookie.host=this.representedObject.host;cookie.name=this.representedObject.name;} consolePromptCompletionsNeeded(prompt,defaultCompletions,base,prefix,suffix) {let results=[];prefix=prefix.toLowerCase();function accumulateMatches(textArray) {for(let text of textArray){if(text.toLowerCase().startsWith(prefix)) results.push(text);}} function tableNamesCallback(tableNames) {accumulateMatches(tableNames);accumulateMatches(["SELECT","FROM","WHERE","LIMIT","DELETE FROM","CREATE","DROP","TABLE","INDEX","UPDATE","INSERT INTO","VALUES"]);this._prompt.updateCompletions(results," ");} this.database.getTableNames(tableNamesCallback.bind(this));} consolePromptTextCommitted(prompt,query) {this.database.executeSQL(query,this._queryFinished.bind(this,query),this._queryError.bind(this,query));} _messagesClicked() {this._prompt.focus();} _queryFinished(query,columnNames,values) {let trimmedQuery=query.trim();let queryView=new WebInspector.DatabaseUserQuerySuccessView(trimmedQuery,columnNames,values);this.insertSubviewBefore(queryView,this._prompt);if(queryView.dataGrid) queryView.dataGrid.autoSizeColumns(5);this._prompt.element.scrollIntoView(false);if(trimmedQuery.match(/^create /i)||trimmedQuery.match(/^drop table /i)) this.dispatchEventToListeners(WebInspector.DatabaseContentView.Event.SchemaUpdated,this.database);} _queryError(query,error) {let message;if(error.message) message=error.message;else if(error.code===2) message=WebInspector.UIString("Database no longer has expected version.");else message=WebInspector.UIString("An unexpected error %s occurred.").format(error.code);let queryView=new WebInspector.DatabaseUserQueryErrorView(query,message);this.insertSubviewBefore(queryView,this._prompt);this._prompt.element.scrollIntoView(false);}};WebInspector.DatabaseContentView.Event={SchemaUpdated:"SchemaUpdated"};WebInspector.DatabaseHostTreeElement=class DatabaseHostTreeElement extends WebInspector.StorageTreeElement {constructor(host) {super(WebInspector.FolderTreeElement.FolderIconStyleClassName,WebInspector.displayNameForHost(host),null);this._host=host;this.hasChildren=true;this.expanded=true;} get name() {return WebInspector.displayNameForHost(this._host);} get categoryName() {return WebInspector.UIString("Databases");}};WebInspector.DatabaseTableContentView=class DatabaseTableContentView extends WebInspector.ContentView {constructor(representedObject) {super(representedObject);this.element.classList.add("database-table");this._refreshButtonNavigationItem=new WebInspector.ButtonNavigationItem("database-table-refresh",WebInspector.UIString("Refresh"),"Images/ReloadFull.svg",13,13);this._refreshButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._refreshButtonClicked,this);this._messageTextViewElement=null;this.update();} get navigationItems() {return[this._refreshButtonNavigationItem];} update() {this.representedObject.database.executeSQL("SELECT * FROM \""+this._escapeTableName(this.representedObject.name)+"\"",this._queryFinished.bind(this),this._queryError.bind(this));} saveToCookie(cookie) {cookie.type=WebInspector.ContentViewCookieType.DatabaseTable;cookie.host=this.representedObject.host;cookie.name=this.representedObject.name;cookie.database=this.representedObject.database.name;} get scrollableElements() {if(!this._dataGrid) return[];return[this._dataGrid.scrollContainer];} _escapeTableName(name) {return name.replace(/\"/g,"\"\"");} _queryFinished(columnNames,values) { if(this._dataGrid){this.removeSubview(this._dataGrid);this._dataGrid=null;} if(this._messageTextViewElement) this._messageTextViewElement.remove();if(columnNames.length){this._dataGrid=WebInspector.DataGrid.createSortableDataGrid(columnNames,values);this.addSubview(this._dataGrid);this._dataGrid.updateLayout();return;} this._messageTextViewElement=WebInspector.createMessageTextView(WebInspector.UIString("The “%s”\ntable is empty.").format(this.representedObject.name),false);this.element.appendChild(this._messageTextViewElement);} _queryError(error) {if(this._dataGrid){this.removeSubview(this._dataGrid);this._dataGrid=null;} if(this._messageTextViewElement) this._messageTextViewElement.remove();this._messageTextViewElement=WebInspector.createMessageTextView(WebInspector.UIString("An error occurred trying to read the “%s” table.").format(this.representedObject.name),true);this.element.appendChild(this._messageTextViewElement);} _refreshButtonClicked() {this.update();}};WebInspector.DatabaseTableTreeElement=class DatabaseTableTreeElement extends WebInspector.GeneralTreeElement {constructor(representedObject) {super("database-table-icon",representedObject.name,null,representedObject,false);}};WebInspector.DatabaseTreeElement=class DatabaseTreeElement extends WebInspector.GeneralTreeElement {constructor(representedObject) {super("database-icon",representedObject.name,null,representedObject,true);this.hasChildren=false; this.onpopulate();} oncollapse() {this.shouldRefreshChildren=true;} onpopulate() {if(this.children.length&&!this.shouldRefreshChildren) return;this.shouldRefreshChildren=false;this.removeChildren();function tableNamesCallback(tableNames) {for(var i=0;i=5) iconClassName=WebInspector.DebuggerDashboardView.EventListenerIconStyleClassName;var iconElement=document.createElement("div");iconElement.classList.add(iconClassName);this._locationElement.appendChild(iconElement);var iconImageElement=document.createElement("img");iconImageElement.className="icon";iconElement.appendChild(iconImageElement);var nameElement=document.createElement("div");nameElement.append(functionName);nameElement.classList.add("function-name");this._locationElement.appendChild(nameElement);const options={dontFloat:true,ignoreNetworkTab:true,ignoreSearchTab:true,};let linkElement=WebInspector.createSourceCodeLocationLink(WebInspector.debuggerManager.activeCallFrame.sourceCodeLocation,options);this._locationElement.appendChild(linkElement);} _resumeButtonClicked() {WebInspector.debuggerManager.resume();}};WebInspector.DebuggerDashboardView.FunctionIconStyleClassName=WebInspector.CallFrameView.FunctionIconStyleClassName;WebInspector.DebuggerDashboardView.EventListenerIconStyleClassName=WebInspector.CallFrameView.EventListenerIconStyleClassName;WebInspector.DebuggerSidebarPanel=class DebuggerSidebarPanel extends WebInspector.NavigationSidebarPanel {constructor(contentBrowser) {super("debugger",WebInspector.UIString("Debugger"),true);this.contentBrowser=contentBrowser;WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded,this._resourceAdded,this);WebInspector.Target.addEventListener(WebInspector.Target.Event.ResourceAdded,this._resourceAdded,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange,this._breakpointsEnabledDidChange,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded,this._breakpointAdded,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved,this._breakpointRemoved,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded,this._scriptAdded,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptRemoved,this._scriptRemoved,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptsCleared,this._scriptsCleared,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused,this._debuggerDidPause,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed,this._debuggerDidResume,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange,this._debuggerCallFramesDidChange,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange,this._debuggerActiveCallFrameDidChange,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.WaitingToPause,this._debuggerWaitingToPause,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingWillStart,this._timelineCapturingWillStart,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped,this._timelineCapturingStopped,this);WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetAdded,this._targetAdded,this);WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetRemoved,this._targetRemoved,this);this._timelineRecordingWarningElement=document.createElement("div");this._timelineRecordingWarningElement.classList.add("warning-banner");this._timelineRecordingWarningElement.append(WebInspector.UIString("Debugger disabled during Timeline recording")," ");let stopRecordingLink=this._timelineRecordingWarningElement.appendChild(document.createElement("a"));stopRecordingLink.textContent=WebInspector.UIString("Stop recording");stopRecordingLink.addEventListener("click",()=>{WebInspector.timelineManager.stopCapturing();});this._breakpointsDisabledWarningElement=document.createElement("div");this._breakpointsDisabledWarningElement.classList.add("warning-banner");this._breakpointsDisabledWarningElement.append(WebInspector.UIString("Breakpoints disabled"),document.createElement("br"));let enableBreakpointsLink=this._breakpointsDisabledWarningElement.appendChild(document.createElement("a"));enableBreakpointsLink.textContent=WebInspector.UIString("Enable breakpoints");enableBreakpointsLink.addEventListener("click",()=>{WebInspector.debuggerToggleBreakpoints();});this._navigationBar=new WebInspector.NavigationBar;this.addSubview(this._navigationBar);var breakpointsImage={src:"Images/Breakpoints.svg",width:15,height:15};var pauseImage={src:"Images/Pause.svg",width:15,height:15};var resumeImage={src:"Images/Resume.svg",width:15,height:15};var stepOverImage={src:"Images/StepOver.svg",width:15,height:15};var stepIntoImage={src:"Images/StepInto.svg",width:15,height:15};var stepOutImage={src:"Images/StepOut.svg",width:15,height:15};var toolTip=WebInspector.UIString("Enable all breakpoints (%s)").format(WebInspector.toggleBreakpointsKeyboardShortcut.displayName);var altToolTip=WebInspector.UIString("Disable all breakpoints (%s)").format(WebInspector.toggleBreakpointsKeyboardShortcut.displayName);this._debuggerBreakpointsButtonItem=new WebInspector.ActivateButtonNavigationItem("debugger-breakpoints",toolTip,altToolTip,breakpointsImage.src,breakpointsImage.width,breakpointsImage.height);this._debuggerBreakpointsButtonItem.activated=WebInspector.debuggerManager.breakpointsEnabled;this._debuggerBreakpointsButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,WebInspector.debuggerToggleBreakpoints,this);this._navigationBar.addNavigationItem(this._debuggerBreakpointsButtonItem);toolTip=WebInspector.UIString("Pause script execution (%s or %s)").format(WebInspector.pauseOrResumeKeyboardShortcut.displayName,WebInspector.pauseOrResumeAlternateKeyboardShortcut.displayName);altToolTip=WebInspector.UIString("Continue script execution (%s or %s)").format(WebInspector.pauseOrResumeKeyboardShortcut.displayName,WebInspector.pauseOrResumeAlternateKeyboardShortcut.displayName);this._debuggerPauseResumeButtonItem=new WebInspector.ToggleButtonNavigationItem("debugger-pause-resume",toolTip,altToolTip,pauseImage.src,resumeImage.src,pauseImage.width,pauseImage.height);this._debuggerPauseResumeButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,WebInspector.debuggerPauseResumeToggle,this);this._navigationBar.addNavigationItem(this._debuggerPauseResumeButtonItem);this._debuggerStepOverButtonItem=new WebInspector.ButtonNavigationItem("debugger-step-over",WebInspector.UIString("Step over (%s or %s)").format(WebInspector.stepOverKeyboardShortcut.displayName,WebInspector.stepOverAlternateKeyboardShortcut.displayName),stepOverImage.src,stepOverImage.width,stepOverImage.height);this._debuggerStepOverButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,WebInspector.debuggerStepOver,this);this._debuggerStepOverButtonItem.enabled=false;this._navigationBar.addNavigationItem(this._debuggerStepOverButtonItem);this._debuggerStepIntoButtonItem=new WebInspector.ButtonNavigationItem("debugger-step-into",WebInspector.UIString("Step into (%s or %s)").format(WebInspector.stepIntoKeyboardShortcut.displayName,WebInspector.stepIntoAlternateKeyboardShortcut.displayName),stepIntoImage.src,stepIntoImage.width,stepIntoImage.height);this._debuggerStepIntoButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,WebInspector.debuggerStepInto,this);this._debuggerStepIntoButtonItem.enabled=false;this._navigationBar.addNavigationItem(this._debuggerStepIntoButtonItem);this._debuggerStepOutButtonItem=new WebInspector.ButtonNavigationItem("debugger-step-out",WebInspector.UIString("Step out (%s or %s)").format(WebInspector.stepOutKeyboardShortcut.displayName,WebInspector.stepOutAlternateKeyboardShortcut.displayName),stepOutImage.src,stepOutImage.width,stepOutImage.height);this._debuggerStepOutButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,WebInspector.debuggerStepOut,this);this._debuggerStepOutButtonItem.enabled=false;this._navigationBar.addNavigationItem(this._debuggerStepOutButtonItem);this.element.classList.add(WebInspector.DebuggerSidebarPanel.OffsetSectionsStyleClassName);this._allExceptionsBreakpointTreeElement=new WebInspector.BreakpointTreeElement(WebInspector.debuggerManager.allExceptionsBreakpoint,WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName,WebInspector.UIString("All Exceptions"));this._allUncaughtExceptionsBreakpointTreeElement=new WebInspector.BreakpointTreeElement(WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint,WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName,WebInspector.UIString("Uncaught Exceptions"));this._assertionsBreakpointTreeElement=new WebInspector.BreakpointTreeElement(WebInspector.debuggerManager.assertionsBreakpoint,WebInspector.DebuggerSidebarPanel.AssertionIconStyleClassName,WebInspector.UIString("Assertion Failures"));this.suppressFilteringOnTreeElements([this._allExceptionsBreakpointTreeElement,this._allUncaughtExceptionsBreakpointTreeElement,this._assertionsBreakpointTreeElement]);this.filterBar.placeholder=WebInspector.UIString("Filter List");function showResourcesWithIssuesOnlyFilterFunction(treeElement) {if(treeElement.treeOutline!==this._scriptsContentTreeOutline) return true;if(treeElement instanceof WebInspector.IssueTreeElement) return true;if(treeElement.hasChildren){for(let child of treeElement.children){if(child instanceof WebInspector.IssueTreeElement) return true;}} return false;} this.filterBar.addFilterBarButton("debugger-show-resources-with-issues-only",showResourcesWithIssuesOnlyFilterFunction.bind(this),false,WebInspector.UIString("Only show resources with issues"),WebInspector.UIString("Show all resources"),"Images/Errors.svg",15,15);this._breakpointsContentTreeOutline=this.contentTreeOutline;let breakpointsRow=new WebInspector.DetailsSectionRow;breakpointsRow.element.appendChild(this._breakpointsContentTreeOutline.element);let breakpointsGroup=new WebInspector.DetailsSectionGroup([breakpointsRow]);let breakpointsSection=new WebInspector.DetailsSection("breakpoints",WebInspector.UIString("Breakpoints"),[breakpointsGroup]);this.contentView.element.appendChild(breakpointsSection.element);this._breakpointSectionElement=breakpointsSection.element;this._breakpointsContentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);this._breakpointsContentTreeOutline.ondelete=this._breakpointTreeOutlineDeleteTreeElement.bind(this);this._breakpointsContentTreeOutline.populateContextMenu=function(contextMenu,event,treeElement){this._breakpointTreeOutlineContextMenuTreeElement(contextMenu,event,treeElement);WebInspector.TreeOutline.prototype.populateContextMenu(contextMenu,event,treeElement);}.bind(this);this._breakpointsContentTreeOutline.appendChild(this._allExceptionsBreakpointTreeElement);this._breakpointsContentTreeOutline.appendChild(this._allUncaughtExceptionsBreakpointTreeElement);if(DebuggerAgent.setPauseOnAssertions) this._breakpointsContentTreeOutline.appendChild(this._assertionsBreakpointTreeElement);if(WebInspector.domDebuggerManager.supported){this._domBreakpointsContentTreeOutline=this.createContentTreeOutline(true);this._domBreakpointsContentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded,this._domBreakpointAddedOrRemoved,this);this._domBreakpointsContentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementRemoved,this._domBreakpointAddedOrRemoved,this);this._domBreakpointTreeController=new WebInspector.DOMBreakpointTreeController(this._domBreakpointsContentTreeOutline);this._domBreakpointsRow=new WebInspector.DetailsSectionRow(WebInspector.UIString("No Breakpoints"));this._domBreakpointsRow.element.appendChild(this._domBreakpointsContentTreeOutline.element);this._domBreakpointsRow.showEmptyMessage();const defaultCollapsed=true;let domBreakpointsGroup=new WebInspector.DetailsSectionGroup([this._domBreakpointsRow]);this._domBreakpointsSection=new WebInspector.DetailsSection("dom-breakpoints",WebInspector.UIString("DOM Breakpoints"),[domBreakpointsGroup],null,defaultCollapsed);this.contentView.element.appendChild(this._domBreakpointsSection.element);this._xhrBreakpointsContentTreeOutline=this.createContentTreeOutline(true);this._xhrBreakpointTreeController=new WebInspector.XHRBreakpointTreeController(this._xhrBreakpointsContentTreeOutline);this._xhrBreakpointsRow=new WebInspector.DetailsSectionRow;this._xhrBreakpointsRow.element.appendChild(this._xhrBreakpointsContentTreeOutline.element);let navigationBar=new WebInspector.NavigationBar;let navigationBarWrapper=document.createElement("div");navigationBarWrapper.appendChild(navigationBar.element);let addXHRBreakpointButton=new WebInspector.ButtonNavigationItem("add-xhr-breakpoint",WebInspector.UIString("Add XHR Breakpoint"),"Images/Plus13.svg",13,13);addXHRBreakpointButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._addXHRBreakpointButtonClicked,this);navigationBar.addNavigationItem(addXHRBreakpointButton);let xhrBreakpointsGroup=new WebInspector.DetailsSectionGroup([this._xhrBreakpointsRow]);let xhrBreakpointsSection=new WebInspector.DetailsSection("xhr-breakpoints",WebInspector.UIString("XHR Breakpoints"),[xhrBreakpointsGroup],navigationBarWrapper,defaultCollapsed);this.contentView.element.appendChild(xhrBreakpointsSection.element);} this._scriptsContentTreeOutline=this.createContentTreeOutline();this._scriptsContentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);this._scriptsContentTreeOutline.includeSourceMapResourceChildren=true;let scriptsRow=new WebInspector.DetailsSectionRow;scriptsRow.element.appendChild(this._scriptsContentTreeOutline.element);let scriptsGroup=new WebInspector.DetailsSectionGroup([scriptsRow]);this._scriptsSection=new WebInspector.DetailsSection("scripts",WebInspector.UIString("Sources"),[scriptsGroup]);this.contentView.element.appendChild(this._scriptsSection.element);const suppressFiltering=true;this._callStackTreeOutline=this.createContentTreeOutline(suppressFiltering);this._callStackTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);this._mainTargetTreeElement=new WebInspector.ThreadTreeElement(WebInspector.mainTarget);this._callStackTreeOutline.appendChild(this._mainTargetTreeElement);this._updateCallStackTreeOutline();this._callStackRow=new WebInspector.DetailsSectionRow;this._callStackRow.element.appendChild(this._callStackTreeOutline.element);this._callStackGroup=new WebInspector.DetailsSectionGroup([this._callStackRow]);this._callStackSection=new WebInspector.DetailsSection("call-stack",WebInspector.UIString("Call Stack"),[this._callStackGroup]);this._showingSingleThreadCallStack=true;this._activeCallFrameTreeElement=null;this._pauseReasonTreeOutline=null;this._pauseReasonLinkContainerElement=document.createElement("span");this._pauseReasonTextRow=new WebInspector.DetailsSectionTextRow;this._pauseReasonGroup=new WebInspector.DetailsSectionGroup([this._pauseReasonTextRow]);this._pauseReasonSection=new WebInspector.DetailsSection("paused-reason",WebInspector.UIString("Pause Reason"),[this._pauseReasonGroup],this._pauseReasonLinkContainerElement);WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisplayLocationDidChange,this._handleDebuggerObjectDisplayLocationDidChange,this);WebInspector.IssueMessage.addEventListener(WebInspector.IssueMessage.Event.DisplayLocationDidChange,this._handleDebuggerObjectDisplayLocationDidChange,this);WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded,this._handleIssueAdded,this);WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.Cleared,this._handleIssuesCleared,this);if(WebInspector.frameResourceManager.mainFrame) this._addResourcesRecursivelyForFrame(WebInspector.frameResourceManager.mainFrame);for(var script of WebInspector.debuggerManager.knownNonResourceScripts) this._addScript(script);if(WebInspector.debuggerManager.paused) this._debuggerDidPause(null);if(WebInspector.timelineManager.isCapturing()&&WebInspector.debuggerManager.breakpointsDisabledTemporarily) this._timelineCapturingWillStart(null);this._updateBreakpointsDisabledBanner();} get minimumWidth() {return this._navigationBar.minimumWidth;} closed() {super.closed();this._domBreakpointTreeController.disconnect();this._domBreakpointTreeController=null;WebInspector.Frame.removeEventListener(null,null,this);WebInspector.debuggerManager.removeEventListener(null,null,this);WebInspector.Breakpoint.removeEventListener(null,null,this);WebInspector.IssueMessage.removeEventListener(null,null,this);} showDefaultContentView() {if(WebInspector.frameResourceManager.mainFrame){let mainTreeElement=this._scriptsContentTreeOutline.findTreeElement(WebInspector.frameResourceManager.mainFrame.mainResource);if(mainTreeElement&&this.showDefaultContentViewForTreeElement(mainTreeElement)) return;} let currentTreeElement=this._scriptsContentTreeOutline.children[0];while(currentTreeElement&&!currentTreeElement.root){if(currentTreeElement instanceof WebInspector.ResourceTreeElement||currentTreeElement instanceof WebInspector.ScriptTreeElement){if(this.showDefaultContentViewForTreeElement(currentTreeElement)) return;} currentTreeElement=currentTreeElement.traverseNextTreeElement(false,null,true);}} treeElementForRepresentedObject(representedObject) {if(representedObject instanceof WebInspector.Frame) representedObject=representedObject.mainResource;let treeElement=this._breakpointsContentTreeOutline.findTreeElement(representedObject);if(!treeElement) treeElement=this._scriptsContentTreeOutline.findTreeElement(representedObject);if(treeElement) return treeElement;if(!(representedObject instanceof WebInspector.Script)){console.error("Didn't find a TreeElement for representedObject",representedObject);return null;} if(representedObject.url){console.error("Didn't find a ScriptTreeElement for a Script with a URL.");return null;} return this._addScript(representedObject);} saveStateToCookie(cookie) {var selectedTreeElement=this._breakpointsContentTreeOutline.selectedTreeElement;if(!selectedTreeElement){super.saveStateToCookie(cookie);return;} var representedObject=selectedTreeElement.representedObject;if(representedObject===WebInspector.debuggerManager.allExceptionsBreakpoint){cookie[WebInspector.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey]=true;return;} if(representedObject===WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint){cookie[WebInspector.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey]=true;return;} if(representedObject===WebInspector.debuggerManager.assertionsBreakpoint){cookie[WebInspector.DebuggerSidebarPanel.SelectedAssertionsCookieKey]=true;return;} if(representedObject===WebInspector.domDebuggerManager.allRequestsBreakpoint){cookie[WebInspector.DebuggerSidebarPanel.SelectedAllRequestsCookieKey]=true;return;} super.saveStateToCookie(cookie);} restoreStateFromCookie(cookie,relaxedMatchDelay) {if(cookie[WebInspector.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey]) this._allExceptionsBreakpointTreeElement.revealAndSelect();else if(cookie[WebInspector.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey]) this._allUncaughtExceptionsBreakpointTreeElement.revealAndSelect();else if(cookie[WebInspector.DebuggerSidebarPanel.SelectedAssertionsCookieKey]) this._assertionsBreakpointTreeElement.revealAndSelect();else if(cookie[WebInspector.DebuggerSidebarPanel.SelectedAllRequestsCookieKey]) this._xhrBreakpointTreeController.revealAndSelect(WebInspector.domDebuggerManager.allRequestsBreakpoint);else super.restoreStateFromCookie(cookie,relaxedMatchDelay);} _debuggerWaitingToPause(event) {this._debuggerPauseResumeButtonItem.enabled=false;} _debuggerDidPause(event) {this.contentView.element.insertBefore(this._callStackSection.element,this.contentView.element.firstChild);if(this._updatePauseReason()) this.contentView.element.insertBefore(this._pauseReasonSection.element,this.contentView.element.firstChild);this._debuggerPauseResumeButtonItem.enabled=true;this._debuggerPauseResumeButtonItem.toggled=true;this._debuggerStepOverButtonItem.enabled=true;this._debuggerStepIntoButtonItem.enabled=true;this._debuggerStepOutButtonItem.enabled=true;this.element.classList.add(WebInspector.DebuggerSidebarPanel.DebuggerPausedStyleClassName);} _debuggerDidResume(event) {this._callStackSection.element.remove();this._pauseReasonSection.element.remove();this._debuggerPauseResumeButtonItem.enabled=true;this._debuggerPauseResumeButtonItem.toggled=false;this._debuggerStepOverButtonItem.enabled=false;this._debuggerStepIntoButtonItem.enabled=false;this._debuggerStepOutButtonItem.enabled=false;this.element.classList.remove(WebInspector.DebuggerSidebarPanel.DebuggerPausedStyleClassName);} _breakpointsEnabledDidChange(event) {this._debuggerBreakpointsButtonItem.activated=WebInspector.debuggerManager.breakpointsEnabled;this._updateBreakpointsDisabledBanner();} _addBreakpoint(breakpoint) {let sourceCode=breakpoint.sourceCodeLocation.displaySourceCode;if(!sourceCode) return null;if(this._breakpointsContentTreeOutline.findTreeElement(breakpoint)) return;let parentTreeElement=this._addTreeElementForSourceCodeToTreeOutline(sourceCode,this._breakpointsContentTreeOutline); if(breakpoint.disabled) breakpoint.resolved=true;let breakpointTreeElement=new WebInspector.BreakpointTreeElement(breakpoint);parentTreeElement.insertChild(breakpointTreeElement,insertionIndexForObjectInListSortedByFunction(breakpointTreeElement,parentTreeElement.children,this._compareTreeElements));if(parentTreeElement.children.length===1) parentTreeElement.expand();return breakpointTreeElement;} _addBreakpointsForSourceCode(sourceCode) {var breakpoints=WebInspector.debuggerManager.breakpointsForSourceCode(sourceCode);for(var i=0;i=0;--i){var treeElement=this._breakpointsContentTreeOutline.children[i];if(!(treeElement instanceof WebInspector.ScriptTreeElement)) continue;this._breakpointsContentTreeOutline.removeChildAtIndex(i,true,true);} this._scriptsContentTreeOutline.removeChildren();this._addResourcesRecursivelyForFrame(WebInspector.frameResourceManager.mainFrame);} _breakpointAdded(event) {var breakpoint=event.data.breakpoint;this._addBreakpoint(breakpoint);} _breakpointRemoved(event) {var breakpoint=event.data.breakpoint;if(this._pauseReasonTreeOutline){var pauseReasonBreakpointTreeElement=this._pauseReasonTreeOutline.getCachedTreeElement(breakpoint);if(pauseReasonBreakpointTreeElement) pauseReasonBreakpointTreeElement.removeStatusImage();} var breakpointTreeElement=this._breakpointsContentTreeOutline.getCachedTreeElement(breakpoint);if(!breakpointTreeElement) return;this._removeDebuggerTreeElement(breakpointTreeElement);} _findThreadTreeElementForTarget(target) {for(let child of this._callStackTreeOutline.children){if(child.target===target) return child;} return null;} _targetAdded(event) {let target=event.data.target;let treeElement=new WebInspector.ThreadTreeElement(target);this._callStackTreeOutline.appendChild(treeElement);this._updateCallStackTreeOutline();} _targetRemoved(event) {let target=event.data.target;let treeElement=this._findThreadTreeElementForTarget(target);this._callStackTreeOutline.removeChild(treeElement);this._updateCallStackTreeOutline();} _updateCallStackTreeOutline() {let singleThreadShowing=WebInspector.targets.size===1;this._callStackTreeOutline.element.classList.toggle("single-thread",singleThreadShowing);this._mainTargetTreeElement.selectable=!singleThreadShowing;} _handleDebuggerObjectDisplayLocationDidChange(event) {var debuggerObject=event.target;if(event.data.oldDisplaySourceCode===debuggerObject.sourceCodeLocation.displaySourceCode) return;var debuggerTreeElement=this._breakpointsContentTreeOutline.getCachedTreeElement(debuggerObject);if(!debuggerTreeElement) return; var wasSelected=debuggerTreeElement.selected;this._removeDebuggerTreeElement(debuggerTreeElement);var newDebuggerTreeElement=this._addDebuggerObject(debuggerObject);if(newDebuggerTreeElement&&wasSelected) newDebuggerTreeElement.revealAndSelect(true,false,true,true);} _removeDebuggerTreeElement(debuggerTreeElement) { if(!debuggerTreeElement.__deletedViaDeleteKeyboardShortcut) debuggerTreeElement.deselect();let parentTreeElement=debuggerTreeElement.parent;parentTreeElement.removeChild(debuggerTreeElement);if(parentTreeElement.children.length) return;parentTreeElement.treeOutline.removeChild(parentTreeElement);} _debuggerCallFramesDidChange(event) {let target=event.data.target;let treeElement=this._findThreadTreeElementForTarget(target);treeElement.refresh();} _debuggerActiveCallFrameDidChange() {if(this._activeCallFrameTreeElement){this._activeCallFrameTreeElement.isActiveCallFrame=false;this._activeCallFrameTreeElement=null;} if(!WebInspector.debuggerManager.activeCallFrame) return;this._activeCallFrameTreeElement=this._callStackTreeOutline.findTreeElement(WebInspector.debuggerManager.activeCallFrame);if(this._activeCallFrameTreeElement) this._activeCallFrameTreeElement.isActiveCallFrame=true;} _breakpointsBeneathTreeElement(treeElement) {if(!(treeElement instanceof WebInspector.ResourceTreeElement)&&!(treeElement instanceof WebInspector.ScriptTreeElement)) return[];var breakpoints=[];var breakpointTreeElements=treeElement.children;for(var i=0;i!breakpoint.disabled);let removeAllResourceBreakpoints=()=>{this._removeAllBreakpoints(breakpoints);};let toggleAllResourceBreakpoints=()=>{this._toggleAllBreakpoints(breakpoints,shouldDisable);};if(shouldDisable) contextMenu.appendItem(WebInspector.UIString("Disable Breakpoints"),toggleAllResourceBreakpoints);else contextMenu.appendItem(WebInspector.UIString("Enable Breakpoints"),toggleAllResourceBreakpoints);contextMenu.appendItem(WebInspector.UIString("Delete Breakpoints"),removeAllResourceBreakpoints);} _treeSelectionDidChange(event) {if(!this.visible) return;let treeElement=event.data.selectedElement;if(!treeElement) return;const options={ignoreNetworkTab:true,ignoreSearchTab:true,};if(treeElement instanceof WebInspector.ResourceTreeElement||treeElement instanceof WebInspector.ScriptTreeElement){WebInspector.showSourceCode(treeElement.representedObject,options);return;} if(treeElement instanceof WebInspector.CallFrameTreeElement){let callFrame=treeElement.callFrame;if(callFrame.id) WebInspector.debuggerManager.activeCallFrame=callFrame;if(callFrame.sourceCodeLocation) WebInspector.showSourceCodeLocation(callFrame.sourceCodeLocation,options);return;} if(treeElement instanceof WebInspector.IssueTreeElement){WebInspector.showSourceCodeLocation(treeElement.issueMessage.sourceCodeLocation,options);return;} if(!(treeElement instanceof WebInspector.BreakpointTreeElement)) return;let breakpoint=treeElement.breakpoint;if(treeElement.treeOutline===this._pauseReasonTreeOutline){WebInspector.showSourceCodeLocation(breakpoint.sourceCodeLocation,options);return;} if(!treeElement.parent.representedObject) return;if(!(treeElement.parent.representedObject instanceof WebInspector.SourceCode)) return;WebInspector.showSourceCodeLocation(breakpoint.sourceCodeLocation,options);} _compareTopLevelTreeElements(a,b) {function isSpecialBreakpoint(treeElement) {return treeElement.representedObject===WebInspector.debuggerManager.allExceptionsBreakpoint||treeElement.representedObject===WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint||treeElement.representedObject===WebInspector.debuggerManager.assertionsBreakpoint;} if(isSpecialBreakpoint(a)) return-1;if(isSpecialBreakpoint(b)) return 1;return a.mainTitle.extendedLocaleCompare(b.mainTitle);} _compareTreeElements(a,b) {if(!a.representedObject||!b.representedObject) return 0;let aLocation=a.representedObject.sourceCodeLocation;let bLocation=b.representedObject.sourceCodeLocation;if(!aLocation||!bLocation) return 0;var comparisonResult=aLocation.displayLineNumber-bLocation.displayLineNumber;if(comparisonResult!==0) return comparisonResult;return aLocation.displayColumnNumber-bLocation.displayColumnNumber;} _updatePauseReason() {this._pauseReasonTreeOutline=null;this._updatePauseReasonGotoArrow();return this._updatePauseReasonSection();} _updatePauseReasonSection() {let target=WebInspector.debuggerManager.activeCallFrame.target;let targetData=WebInspector.debuggerManager.dataForTarget(target);let{pauseReason,pauseData}=targetData;switch(pauseReason){case WebInspector.DebuggerManager.PauseReason.Assertion:if(pauseData&&pauseData.message){this._pauseReasonTextRow.text=WebInspector.UIString("Assertion with message: %s").format(pauseData.message);return true;} this._pauseReasonTextRow.text=WebInspector.UIString("Assertion Failed");this._pauseReasonGroup.rows=[this._pauseReasonTextRow];return true;case WebInspector.DebuggerManager.PauseReason.Breakpoint:if(pauseData&&pauseData.breakpointId){const suppressFiltering=true;this._pauseReasonTreeOutline=this.createContentTreeOutline(suppressFiltering);this._pauseReasonTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);let breakpoint=WebInspector.debuggerManager.breakpointForIdentifier(pauseData.breakpointId);let breakpointTreeElement=new WebInspector.BreakpointTreeElement(breakpoint,WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName,WebInspector.UIString("Triggered Breakpoint"));let breakpointDetailsSection=new WebInspector.DetailsSectionRow;this._pauseReasonTreeOutline.appendChild(breakpointTreeElement);breakpointDetailsSection.element.appendChild(this._pauseReasonTreeOutline.element);this._pauseReasonGroup.rows=[breakpointDetailsSection];return true;} break;case WebInspector.DebuggerManager.PauseReason.CSPViolation:if(pauseData){this._pauseReasonTextRow.text=WebInspector.UIString("Content Security Policy violation of directive: %s").format(pauseData.directive||pauseData.directiveText);this._pauseReasonGroup.rows=[this._pauseReasonTextRow];return true;} break;case WebInspector.DebuggerManager.PauseReason.DebuggerStatement:this._pauseReasonTextRow.text=WebInspector.UIString("Debugger Statement");this._pauseReasonGroup.rows=[this._pauseReasonTextRow];return true;case WebInspector.DebuggerManager.PauseReason.DOM:if(pauseData&&pauseData.nodeId){let domNode=WebInspector.domTreeManager.nodeForId(pauseData.nodeId);let domBreakpoints=WebInspector.domDebuggerManager.domBreakpointsForNode(domNode);let domBreakpoint;for(let breakpoint of domBreakpoints){if(breakpoint.type===pauseData.type){domBreakpoint=breakpoint;break;}} if(!domBreakpoint) return;const suppressFiltering=true;this._pauseReasonTreeOutline=this.createContentTreeOutline(suppressFiltering);let type=WebInspector.DOMBreakpointTreeElement.displayNameForType(domBreakpoint.type);let domBreakpointTreeElement=new WebInspector.DOMBreakpointTreeElement(domBreakpoint,WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName,type);let domBreakpointRow=new WebInspector.DetailsSectionRow;this._pauseReasonTreeOutline.appendChild(domBreakpointTreeElement);domBreakpointRow.element.appendChild(this._pauseReasonTreeOutline.element);let ownerElementRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Element"),WebInspector.linkifyNodeReference(domNode));this._pauseReasonGroup.rows=[domBreakpointRow,ownerElementRow];if(domBreakpoint.type!==WebInspector.DOMBreakpoint.Type.SubtreeModified) return true;let remoteObject=WebInspector.RemoteObject.fromPayload(pauseData.targetNode,target);remoteObject.pushNodeToFrontend((nodeId)=>{if(!nodeId) return;let node=WebInspector.domTreeManager.nodeForId(nodeId);if(!node) return;let fragment=document.createDocumentFragment();let description=pauseData.insertion?WebInspector.UIString("Child added to "):WebInspector.UIString("Removed descendant ");fragment.append(description,WebInspector.linkifyNodeReference(node));let targetDescriptionRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Details"),fragment);targetDescriptionRow.element.classList.add("target-description");this._pauseReasonGroup.rows=this._pauseReasonGroup.rows.concat(targetDescriptionRow);});return true;} break;case WebInspector.DebuggerManager.PauseReason.Exception:if(pauseData){var data=WebInspector.RemoteObject.fromPayload(pauseData,target);this._pauseReasonTextRow.text=WebInspector.UIString("Exception with thrown value: %s").format(data.description);this._pauseReasonGroup.rows=[this._pauseReasonTextRow];return true;} break;case WebInspector.DebuggerManager.PauseReason.PauseOnNextStatement:this._pauseReasonTextRow.text=WebInspector.UIString("Immediate Pause Requested");this._pauseReasonGroup.rows=[this._pauseReasonTextRow];return true;case WebInspector.DebuggerManager.PauseReason.XHR:if(pauseData){if(pauseData.breakpointURL){let xhrBreakpoint=WebInspector.domDebuggerManager.xhrBreakpointForURL(pauseData.breakpointURL);this._pauseReasonTreeOutline=this.createContentTreeOutline(true);let xhrBreakpointTreeElement=new WebInspector.XHRBreakpointTreeElement(xhrBreakpoint,WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName,WebInspector.UIString("Triggered XHR Breakpoint"));let xhrBreakpointRow=new WebInspector.DetailsSectionRow;this._pauseReasonTreeOutline.appendChild(xhrBreakpointTreeElement);xhrBreakpointRow.element.appendChild(this._pauseReasonTreeOutline.element);this._pauseReasonTextRow.text=pauseData.url;this._pauseReasonGroup.rows=[xhrBreakpointRow,this._pauseReasonTextRow];}else{this._pauseReasonTextRow.text=WebInspector.UIString("Requesting: %s").format(pauseData.url);this._pauseReasonGroup.rows=[this._pauseReasonTextRow];} this._pauseReasonTextRow.element.title=pauseData.url;return true;} break;case WebInspector.DebuggerManager.PauseReason.Other:console.error("Paused for unknown reason. We should always have a reason.");break;} return false;} _updatePauseReasonGotoArrow() {this._pauseReasonLinkContainerElement.removeChildren();var activeCallFrame=WebInspector.debuggerManager.activeCallFrame;if(!activeCallFrame) return;var sourceCodeLocation=activeCallFrame.sourceCodeLocation;if(!sourceCodeLocation) return;const options={useGoToArrowButton:true,ignoreNetworkTab:true,ignoreSearchTab:true,};let linkElement=WebInspector.createSourceCodeLocationLink(sourceCodeLocation,options);this._pauseReasonLinkContainerElement.appendChild(linkElement);} _addDebuggerObject(debuggerObject) {if(debuggerObject instanceof WebInspector.Breakpoint) return this._addBreakpoint(debuggerObject);if(debuggerObject instanceof WebInspector.IssueMessage) return this._addIssue(debuggerObject);return null;} _addIssue(issueMessage) {let issueTreeElement=this._scriptsContentTreeOutline.findTreeElement(issueMessage);if(issueTreeElement) return issueTreeElement;let parentTreeElement=this._addTreeElementForSourceCodeToTreeOutline(issueMessage.sourceCodeLocation.sourceCode,this._scriptsContentTreeOutline);if(!parentTreeElement) return null;issueTreeElement=new WebInspector.IssueTreeElement(issueMessage);parentTreeElement.insertChild(issueTreeElement,insertionIndexForObjectInListSortedByFunction(issueTreeElement,parentTreeElement.children,this._compareTreeElements));if(parentTreeElement.children.length===1) parentTreeElement.expand();return issueTreeElement;} _handleIssueAdded(event) {var issue=event.data.issue;if(!issue.sourceCodeLocation||!issue.sourceCodeLocation.sourceCode||(issue.source!=="javascript"&&issue.source!=="console-api")) return;this._addIssue(issue);} _handleIssuesCleared(event) {let currentTreeElement=this._scriptsContentTreeOutline.children[0];let issueTreeElements=[];while(currentTreeElement&&!currentTreeElement.root){if(currentTreeElement instanceof WebInspector.IssueTreeElement) issueTreeElements.push(currentTreeElement);currentTreeElement=currentTreeElement.traverseNextTreeElement(false,null,true);} issueTreeElements.forEach((treeElement)=>treeElement.parent.removeChild(treeElement));} _domBreakpointAddedOrRemoved(event) {if(!this._domBreakpointsContentTreeOutline.children.length){this._domBreakpointsRow.showEmptyMessage();return;} if(this._domBreakpointsContentTreeOutline.element.parent) return;this._domBreakpointsRow.hideEmptyMessage();this._domBreakpointsRow.element.append(this._domBreakpointsContentTreeOutline.element);this._domBreakpointsSection.collapsed=false;} _addXHRBreakpointButtonClicked(event) {let popover=new WebInspector.XHRBreakpointPopover(this);popover.show(event.target.element,[WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MIN_Y,WebInspector.RectEdge.MAX_X]);} willDismissPopover(popover) {if(popover.result!==WebInspector.InputPopover.Result.Committed) return;let url=popover.value;if(!url) return;WebInspector.domDebuggerManager.addXHRBreakpoint(new WebInspector.XHRBreakpoint(popover.type,url));}};WebInspector.DebuggerSidebarPanel.DebuggerPausedStyleClassName="paused";WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName="breakpoint-exception-icon";WebInspector.DebuggerSidebarPanel.AssertionIconStyleClassName="breakpoint-assertion-icon";WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName="breakpoint-paused-icon";WebInspector.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey="debugger-sidebar-panel-all-exceptions-breakpoint";WebInspector.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey="debugger-sidebar-panel-all-uncaught-exceptions-breakpoint";WebInspector.DebuggerSidebarPanel.SelectedAssertionsCookieKey="debugger-sidebar-panel-assertions-breakpoint";WebInspector.DebuggerSidebarPanel.SelectedAllRequestsCookieKey="debugger-sidebar-panel-all-requests-breakpoint";WebInspector.DefaultDashboardView=class DefaultDashboardView extends WebInspector.DashboardView {constructor(representedObject) {super(representedObject,"default");representedObject.addEventListener(WebInspector.DefaultDashboard.Event.DataDidChange,()=>{this._updateDisplaySoon();});this._scheduledUpdateIdentifier=undefined;this._items={resourcesCount:{tooltip:WebInspector.UIString("Show page resources"),handler:this._resourcesItemWasClicked},resourcesSize:{tooltip:WebInspector.UIString("Show network information"),handler:this._networkItemWasClicked},time:{tooltip:WebInspector.UIString("Show page load timing"),handler:this._timelineItemWasClicked},logs:{tooltip:WebInspector.UIString("Show messages logged to the Console"),handler:this._consoleItemWasClicked.bind(this,WebInspector.LogContentView.Scopes.Logs)},errors:{tooltip:WebInspector.UIString("Show errors logged to the Console"),handler:this._consoleItemWasClicked.bind(this,WebInspector.LogContentView.Scopes.Errors)},issues:{tooltip:WebInspector.UIString("Show warnings logged to the Console"),handler:this._consoleItemWasClicked.bind(this,WebInspector.LogContentView.Scopes.Warnings)}};for(var name in this._items) this._appendElementForNamedItem(name);} _updateDisplaySoon() {if(this._scheduledUpdateIdentifier) return;this._scheduledUpdateIdentifier=requestAnimationFrame(this._updateDisplay.bind(this));} _updateDisplay() {this._scheduledUpdateIdentifier=undefined;var dashboard=this.representedObject;for(var category of["logs","issues","errors"]) this._setConsoleItemValue(category,dashboard[category]);var timeItem=this._items.time;timeItem.text=dashboard.time?Number.secondsToString(dashboard.time):emDash;this._setItemEnabled(timeItem,dashboard.time>0);var countItem=this._items.resourcesCount;countItem.text=Number.abbreviate(dashboard.resourcesCount);this._setItemEnabled(countItem,dashboard.resourcesCount>0);var sizeItem=this._items.resourcesSize;sizeItem.text=dashboard.resourcesSize?Number.bytesToString(dashboard.resourcesSize,false):emDash;this._setItemEnabled(sizeItem,dashboard.resourcesSize>0);} _appendElementForNamedItem(name) {var item=this._items[name];item.container=this._element.appendChild(document.createElement("div"));item.container.className="item "+name;item.container.appendChild(document.createElement("img"));item.outlet=item.container.appendChild(document.createElement("div"));Object.defineProperty(item,"text",{set:function(newText) {newText=newText.toString();if(newText===item.outlet.textContent) return;item.outlet.textContent=newText;}});item.container.addEventListener("click",(event)=>{this._itemWasClicked(name);});} _itemWasClicked(name) {var item=this._items[name];if(!item.container.classList.contains(WebInspector.DefaultDashboardView.EnabledItemStyleClassName)) return;if(item.handler) item.handler.call(this);} _resourcesItemWasClicked() {WebInspector.showResourcesTab();} _networkItemWasClicked() {WebInspector.showNetworkTab();} _timelineItemWasClicked() {WebInspector.showTimelineTab();} _consoleItemWasClicked(scope) {WebInspector.showConsoleTab(scope);} _setConsoleItemValue(itemName,newValue) {var iVarName="_"+itemName;var previousValue=this[iVarName];this[iVarName]=newValue;var item=this._items[itemName];item.text=Number.abbreviate(newValue);this._setItemEnabled(item,newValue>0);if(newValue<=previousValue) return;var container=item.container;function animationEnded(event) {if(event.target===container){container.classList.remove("pulsing");container.removeEventListener("animationend",animationEnded);}} if(container.classList.contains("pulsing")){container.classList.remove("pulsing");container.recalculateStyles();}else container.addEventListener("animationend",animationEnded);container.classList.add("pulsing");} _setItemEnabled(item,enabled) {if(enabled){item.container.title=item.tooltip;item.container.classList.add(WebInspector.DefaultDashboardView.EnabledItemStyleClassName);}else{item.container.title="";item.container.classList.remove(WebInspector.DefaultDashboardView.EnabledItemStyleClassName);}}};WebInspector.DefaultDashboardView.EnabledItemStyleClassName="enabled";WebInspector.DividerNavigationItem=class DividerNavigationItem extends WebInspector.NavigationItem { get additionalClassNames() {return["divider"];}};WebInspector.EditableDataGridNode=class EditableDataGridNode extends WebInspector.DataGridNode {constructor(data) {const hasChildren=false;super(data,hasChildren);} get element() {let element=super.element;if(element) element.classList.add("editable");return element;} createCellContent(columnIdentifier,cell) {let content=super.createCellContent(columnIdentifier,cell);if(typeof content!=="string") return content;let inputElement=document.createElement("input");inputElement.value=content;inputElement.addEventListener("keypress",this._handleKeyPress.bind(this,columnIdentifier));inputElement.addEventListener("blur",this._handleBlur.bind(this,columnIdentifier));return inputElement;} _handleKeyPress(columnIdentifier,event) {if(event.keyCode===WebInspector.KeyboardShortcut.Key.Escape.keyCode) this.dataGrid.element.focus();if(event.keyCode===WebInspector.KeyboardShortcut.Key.Enter.keyCode) this._notifyInputElementValueChanged(columnIdentifier,event.target.value);} _handleBlur(columnIdentifier,event) {this._notifyInputElementValueChanged(columnIdentifier,event.target.value);} _notifyInputElementValueChanged(columnIdentifier,value) {if(value!==this.data[columnIdentifier]) this.dispatchEventToListeners(WebInspector.EditableDataGridNode.Event.ValueChanged,{value,columnIdentifier});}};WebInspector.EditableDataGridNode.Event={ValueChanged:"editable-data-grid-node-value-changed",};WebInspector.isBeingEdited=function(element) {while(element){if(element.__editing) return true;element=element.parentNode;} return false;};WebInspector.markBeingEdited=function(element,value) {if(value){if(element.__editing) return false;element.__editing=true;WebInspector.__editingCount=(WebInspector.__editingCount||0)+1;}else{if(!element.__editing) return false;delete element.__editing;--WebInspector.__editingCount;} return true;};WebInspector.isEditingAnyField=function() {return!!WebInspector.__editingCount;};WebInspector.isEventTargetAnEditableField=function(event) {var textInputTypes={"text":true,"search":true,"tel":true,"url":true,"email":true,"password":true};if(event.target instanceof HTMLInputElement) return event.target.type in textInputTypes;var codeMirrorEditorElement=event.target.enclosingNodeOrSelfWithClass("CodeMirror");if(codeMirrorEditorElement&&codeMirrorEditorElement.CodeMirror) return!codeMirrorEditorElement.CodeMirror.getOption("readOnly");if(event.target instanceof HTMLTextAreaElement) return true;if(event.target.enclosingNodeOrSelfWithClass("text-prompt")) return true;if(WebInspector.isBeingEdited(event.target)) return true;return false;};WebInspector.EditingConfig=class EditingConfig {constructor(commitHandler,cancelHandler,context) {this.commitHandler=commitHandler;this.cancelHandler=cancelHandler;this.context=context;this.spellcheck=false;} setPasteHandler(pasteHandler) {this.pasteHandler=pasteHandler;} setMultiline(multiline) {this.multiline=multiline;} setCustomFinishHandler(customFinishHandler) {this.customFinishHandler=customFinishHandler;} setNumberCommitHandler(numberCommitHandler) {this.numberCommitHandler=numberCommitHandler;}};WebInspector.startEditing=function(element,config) {if(!WebInspector.markBeingEdited(element,true)) return null;config=config||new WebInspector.EditingConfig(function(){},function(){});var committedCallback=config.commitHandler;var cancelledCallback=config.cancelHandler;var pasteCallback=config.pasteHandler;var context=config.context;var oldText=getContent(element);var moveDirection="";element.classList.add("editing");element.contentEditable="plaintext-only";var oldSpellCheck=element.hasAttribute("spellcheck")?element.spellcheck:undefined;element.spellcheck=config.spellcheck;if(config.multiline) element.classList.add("multiline");var oldTabIndex=element.tabIndex;if(element.tabIndex<0) element.tabIndex=0;function blurEventListener(){editingCommitted.call(element);} function getContent(element){if(element.tagName==="INPUT"&&element.type==="text") return element.value;else return element.textContent;} function cleanUpAfterEditing() {WebInspector.markBeingEdited(element,false);this.classList.remove("editing");this.contentEditable=false;this.scrollTop=0;this.scrollLeft=0;if(oldSpellCheck===undefined) element.removeAttribute("spellcheck");else element.spellcheck=oldSpellCheck;if(oldTabIndex===-1) this.removeAttribute("tabindex");else this.tabIndex=oldTabIndex;element.removeEventListener("blur",blurEventListener,false);element.removeEventListener("keydown",keyDownEventListener,true);if(pasteCallback) element.removeEventListener("paste",pasteEventListener,true);WebInspector.restoreFocusFromElement(element);} function editingCancelled() {if(this.tagName==="INPUT"&&this.type==="text") this.value=oldText;else this.textContent=oldText;cleanUpAfterEditing.call(this);cancelledCallback(this,context);} function editingCommitted() {cleanUpAfterEditing.call(this);committedCallback(this,getContent(this),oldText,context,moveDirection);} function defaultFinishHandler(event) {var hasOnlyMetaModifierKey=event.metaKey&&!event.shiftKey&&!event.ctrlKey&&!event.altKey;if(isEnterKey(event)&&(!config.multiline||hasOnlyMetaModifierKey)) return"commit";else if(event.keyCode===WebInspector.KeyboardShortcut.Key.Escape.keyCode||event.keyIdentifier==="U+001B") return"cancel";else if(event.keyIdentifier==="U+0009") return"move-"+(event.shiftKey?"backward":"forward");else if(event.altKey){if(event.keyIdentifier==="Up"||event.keyIdentifier==="Down") return"modify-"+(event.keyIdentifier==="Up"?"up":"down");if(event.keyIdentifier==="PageUp"||event.keyIdentifier==="PageDown") return"modify-"+(event.keyIdentifier==="PageUp"?"up-big":"down-big");}} function handleEditingResult(result,event) {if(result==="commit"){editingCommitted.call(element);event.preventDefault();event.stopPropagation();}else if(result==="cancel"){editingCancelled.call(element);event.preventDefault();event.stopPropagation();}else if(result&&result.startsWith("move-")){moveDirection=result.substring(5);if(event.keyIdentifier!=="U+0009") blurEventListener();}else if(result&&result.startsWith("modify-")){let direction=result.substring(7);let modifyValue=direction.startsWith("up")?1:-1;if(direction.endsWith("big")) modifyValue*=10;if(event.shiftKey) modifyValue*=10;else if(event.ctrlKey) modifyValue/=10;let selection=element.ownerDocument.defaultView.getSelection();if(!selection.rangeCount) return;let range=selection.getRangeAt(0);if(!range.commonAncestorContainer.isSelfOrDescendant(element)) return false;let wordRange=range.startContainer.rangeOfWord(range.startOffset,WebInspector.EditingSupport.StyleValueDelimiters,element);let word=wordRange.toString();let wordPrefix="";let wordSuffix="";let nonNumberInWord=/[^\d-\.]+/.exec(word);if(nonNumberInWord){let nonNumberEndOffset=nonNumberInWord.index+nonNumberInWord[0].length;if(range.startOffset>wordRange.startOffset+nonNumberInWord.index&&nonNumberEndOffset{if(!this._hasStackTrace) this._buildStackTrace(properties.stack.value.value);this._hasStackTrace=true;});} expand() {if(this._expanded) return;this._expanded=true;this._element.classList.add("expanded");this.update();} collapse() {if(!this._expanded) return;this._expanded=false;this._element.classList.remove("expanded");} appendTitleSuffix(suffixElement) {this._element.insertBefore(suffixElement,this._outlineElement);} _handlePreviewOrTitleElementClick(event) {if(!this._expanded) this.expand();else this.collapse();event.stopPropagation();} _buildStackTrace(stackString) {let stackTrace=WebInspector.StackTrace.fromString(this._object.target,stackString);let stackTraceElement=new WebInspector.StackTraceView(stackTrace).element;this._outlineElement.appendChild(stackTraceElement);}};WebInspector.EventListenerSectionGroup=class EventListenerSectionGroup extends WebInspector.DetailsSectionGroup {constructor(eventListener,options={}) {super();this._eventListener=eventListener;var rows=[];if(!options.hideType) rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Event"),this._eventListener.type));if(!options.hideNode) rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Node"),this._nodeTextOrLink()));rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Function"),this._functionTextOrLink()));if(this._eventListener.useCapture) rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Capturing"),WebInspector.UIString("Yes")));else rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Bubbling"),WebInspector.UIString("Yes")));if(this._eventListener.isAttribute) rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Attribute"),WebInspector.UIString("Yes")));if(this._eventListener.passive) rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Passive"),WebInspector.UIString("Yes")));if(this._eventListener.once) rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Once"),WebInspector.UIString("Yes")));this.rows=rows;} _nodeTextOrLink() {var node=this._eventListener.node;if(!node) return"";if(node.nodeType()===Node.DOCUMENT_NODE) return"document";return WebInspector.linkifyNodeReference(node);} _functionTextOrLink() {var match=this._eventListener.handlerBody.match(/function ([^\(]+?)\(/);if(match){var anonymous=false;var functionName=match[1];}else{var anonymous=true;var functionName=WebInspector.UIString("(anonymous function)");} if(!this._eventListener.location) return functionName;var sourceCode=WebInspector.debuggerManager.scriptForIdentifier(this._eventListener.location.scriptId,WebInspector.mainTarget);if(!sourceCode) return functionName;var sourceCodeLocation=sourceCode.createSourceCodeLocation(this._eventListener.location.lineNumber,this._eventListener.location.columnNumber||0);const options={dontFloat:anonymous,ignoreNetworkTab:true,ignoreSearchTab:true,};let linkElement=WebInspector.createSourceCodeLocationLink(sourceCodeLocation,options);if(anonymous) return linkElement;var fragment=document.createDocumentFragment();fragment.append(linkElement,functionName);return fragment;}};WebInspector.FilterBar=class FilterBar extends WebInspector.Object {constructor(element) {super();this._element=element||document.createElement("div");this._element.classList.add("filter-bar");this._filtersNavigationBar=new WebInspector.NavigationBar;this._element.appendChild(this._filtersNavigationBar.element);this._filterFunctionsMap=new Map;this._inputField=document.createElement("input");this._inputField.type="search";this._inputField.spellcheck=false;this._inputField.incremental=true;this._inputField.addEventListener("search",this._handleFilterChanged.bind(this),false);this._element.appendChild(this._inputField);this._lastFilterValue=this.filters;} get element() {return this._element;} get placeholder() {return this._inputField.getAttribute("placeholder");} set placeholder(text) {this._inputField.setAttribute("placeholder",text);} get inputField() {return this._inputField;} get filters() {return{text:this._inputField.value,functions:[...this._filterFunctionsMap.values()]};} set filters(filters) {filters=filters||{};var oldTextValue=this._inputField.value;this._inputField.value=filters.text||"";if(oldTextValue!==this._inputField.value) this._handleFilterChanged();} addFilterBarButton(identifier,filterFunction,activatedByDefault,defaultToolTip,activatedToolTip,image,imageWidth,imageHeight) {var filterBarButton=new WebInspector.FilterBarButton(identifier,filterFunction,activatedByDefault,defaultToolTip,activatedToolTip,image,imageWidth,imageHeight);filterBarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._handleFilterBarButtonClicked,this);filterBarButton.addEventListener(WebInspector.FilterBarButton.Event.ActivatedStateToggled,this._handleFilterButtonToggled,this);this._filtersNavigationBar.addNavigationItem(filterBarButton);if(filterBarButton.activated){this._filterFunctionsMap.set(filterBarButton.identifier,filterBarButton.filterFunction);this._handleFilterChanged();}} hasActiveFilters() {return!!this._inputField.value||!!this._filterFunctionsMap.size;} hasFilterChanged() {var currentFunctions=this.filters.functions;if(this._lastFilterValue.text!==this._inputField.value||this._lastFilterValue.functions.length!==currentFunctions.length) return true;for(var i=0;i1) this._resultCountLabel.textContent=WebInspector.UIString("%d matches").format(numberOfResults);} get targetElement() {return this._targetElement;} set targetElement(element) {function delayedWork() {oldTargetElement.classList.remove(WebInspector.FindBanner.NoTransitionStyleClassName);this.element.classList.remove(WebInspector.FindBanner.NoTransitionStyleClassName);} if(this._targetElement){var oldTargetElement=this._targetElement;this._targetElement.classList.add(WebInspector.FindBanner.NoTransitionStyleClassName);this._targetElement.classList.remove(WebInspector.FindBanner.SupportsFindBannerStyleClassName);this._targetElement.classList.remove(WebInspector.FindBanner.ShowingFindBannerStyleClassName);this.element.classList.add(WebInspector.FindBanner.NoTransitionStyleClassName);this.element.classList.remove(WebInspector.FindBanner.ShowingStyleClassName);setTimeout(delayedWork.bind(this),0);} this._targetElement=element||null;if(this._targetElement) this._targetElement.classList.add(WebInspector.FindBanner.SupportsFindBannerStyleClassName);} get showing() {return this.element.classList.contains(WebInspector.FindBanner.ShowingStyleClassName);} focus() {if(!this._inputField.value.length) this._inputField.focus();else this._inputField.select();} _clearAndBlur() {this.numberOfResults=null;this._inputField.value="";this._previousSearchValue="";if(this._delegate.findBannerSearchCleared) this._delegate.findBannerSearchCleared();if(this._delegate.findBannerWantsToClearAndBlur) this._delegate.findBannerWantsToClearAndBlur();} show() {if(!this._targetElement) return;if(!this._targetElement.parentNode) return;if(this.element.parentNode!==this._targetElement.parentNode) this._targetElement.parentNode.insertBefore(this.element,this._targetElement);function delayedWork() {this._targetElement.classList.add(WebInspector.FindBanner.ShowingFindBannerStyleClassName);this.element.classList.add(WebInspector.FindBanner.ShowingStyleClassName);this._inputField.select();} setTimeout(delayedWork.bind(this),0);this.dispatchEventToListeners(WebInspector.FindBanner.Event.DidShow);} hide() {if(!this._targetElement) return;this._inputField.blur();this._targetElement.classList.remove(WebInspector.FindBanner.ShowingFindBannerStyleClassName);this.element.classList.remove(WebInspector.FindBanner.ShowingStyleClassName);this.dispatchEventToListeners(WebInspector.FindBanner.Event.DidHide);} enableKeyboardShortcuts() {this._populateFindKeyboardShortcut.disabled=false;this._findNextKeyboardShortcut.disabled=false;this._findPreviousKeyboardShortcut.disabled=false;} disableKeyboardShortcuts() {this._populateFindKeyboardShortcut.disabled=true;this._findNextKeyboardShortcut.disabled=true;this._findPreviousKeyboardShortcut.disabled=true;} _inputFieldKeyDown(event) {if(event.keyIdentifier==="Shift") this._searchBackwards=true;else if(event.keyIdentifier==="Enter") this._searchKeyPressed=true;} _inputFieldKeyUp(event) {if(event.keyIdentifier==="Shift") this._searchBackwards=false;else if(event.keyIdentifier==="Enter") this._searchKeyPressed=false;} _inputFieldSearch(event) {if(this._inputField.value){if(this._previousSearchValue!==this.searchQuery){if(this._delegate&&typeof this._delegate.findBannerPerformSearch==="function") this._delegate.findBannerPerformSearch(this,this.searchQuery);}else if(this._searchKeyPressed&&this._numberOfResults>0){if(this._searchBackwards){if(this._delegate&&typeof this._delegate.findBannerRevealPreviousResult==="function") this._delegate.findBannerRevealPreviousResult(this);}else{if(this._delegate&&typeof this._delegate.findBannerRevealNextResult==="function") this._delegate.findBannerRevealNextResult(this);}}}else{this.numberOfResults=null;if(this._delegate&&typeof this._delegate.findBannerSearchCleared==="function") this._delegate.findBannerSearchCleared(this);} this._previousSearchValue=this.searchQuery;} _populateSearchQueryFromSelection(event) {if(this._delegate&&typeof this._delegate.findBannerSearchQueryForSelection==="function"){var query=this._delegate.findBannerSearchQueryForSelection(this);if(query){this.searchQuery=query;if(this._delegate&&typeof this._delegate.findBannerPerformSearch==="function") this._delegate.findBannerPerformSearch(this,this.searchQuery);}}} _previousResultButtonClicked(event) {if(this._delegate&&typeof this._delegate.findBannerRevealPreviousResult==="function") this._delegate.findBannerRevealPreviousResult(this);} _nextResultButtonClicked(event) {if(this._delegate&&typeof this._delegate.findBannerRevealNextResult==="function") this._delegate.findBannerRevealNextResult(this);} _doneButtonClicked(event) {this.hide();}};WebInspector.FindBanner.SupportsFindBannerStyleClassName="supports-find-banner";WebInspector.FindBanner.ShowingFindBannerStyleClassName="showing-find-banner";WebInspector.FindBanner.NoTransitionStyleClassName="no-find-banner-transition";WebInspector.FindBanner.ShowingStyleClassName="showing";WebInspector.FindBanner.SegmentGlyphStyleClassName="glyph";WebInspector.FindBanner.Event={DidShow:"find-banner-did-show",DidHide:"find-banner-did-hide"};WebInspector.FlexibleSpaceNavigationItem=class FlexibleSpaceNavigationItem extends WebInspector.NavigationItem { get additionalClassNames() {return["flexible-space"];}};WebInspector.FontResourceContentView=class FontResourceContentView extends WebInspector.ResourceContentView {constructor(resource) {super(resource,"font");this._styleElement=null;this._previewElement=null;} get previewElement() {return this._previewElement;} sizeToFit() {if(!this._previewElement) return;for(var fontSize=WebInspector.FontResourceContentView.MaximumFontSize;fontSize>=WebInspector.FontResourceContentView.MinimumFontSize;fontSize-=5){this._previewElement.style.fontSize=fontSize+"px";if(this._previewElement.offsetWidth<=this.element.offsetWidth) break;}} contentAvailable(content,base64Encoded) {this._fontObjectURL=this.resource.createObjectURL();if(!this._fontObjectURL){this.showGenericErrorMessage();return;} const uniqueFontName="WebInspectorFontPreview"+(++WebInspector.FontResourceContentView._uniqueFontIdentifier);var format="";if(this.resource.mimeTypeComponents.type==="image/svg+xml") format=" format(\"svg\")";if(this._styleElement&&this._styleElement.parentNode) this._styleElement.parentNode.removeChild(this._styleElement);this.removeLoadingIndicator();this._styleElement=document.createElement("style");this._styleElement.textContent="@font-face { font-family: \""+uniqueFontName+"\"; src: url("+this._fontObjectURL+")"+format+"; }";if(this.visible) document.head.appendChild(this._styleElement);this._previewElement=document.createElement("div");this._previewElement.className="preview";this._previewElement.style.fontFamily=uniqueFontName;function createMetricElement(className) {var metricElement=document.createElement("div");metricElement.className="metric "+className;return metricElement;} var lines=WebInspector.FontResourceContentView.PreviewLines;for(var i=0;i$/);if(!matches){span.textContent=value;return span;} var tag=document.createElement("span");tag.className="html-tag";tag.append("<");var tagName=tag.appendChild(document.createElement("span"));tagName.className="html-tag-name";tagName.textContent=matches[1];if(matches[2]){tag.append(" ");var attribute=tag.appendChild(document.createElement("span"));attribute.className="html-attribute";var attributeName=attribute.appendChild(document.createElement("span"));attributeName.className="html-attribute-name";attributeName.textContent=matches[2];attribute.append("=\"");var attributeValue=attribute.appendChild(document.createElement("span"));attributeValue.className="html-attribute-value";attributeValue.textContent=matches[3];attribute.append("\"");} tag.append(">");span.appendChild(tag);return span;};WebInspector.FormattedValue.createElementForFunctionWithName=function(description) {var span=document.createElement("span");span.classList.add("formatted-function");span.textContent=description.substring(0,description.indexOf("("));return span;};WebInspector.FormattedValue.createElementForTypesAndValue=function(type,subtype,displayString,size,isPreview,hadException) {var span=document.createElement("span");span.classList.add(WebInspector.FormattedValue.classNameForTypes(type,subtype));if(hadException){span.textContent="[Exception: "+displayString+"]";return span;} if(type==="string"){displayString=displayString.truncate(WebInspector.FormattedValue.MAX_PREVIEW_STRING_LENGTH);span.textContent=doubleQuotedString(displayString.replace(/\n/g,"\u21B5"));return span;} if(type==="function"){if(subtype==="class") span.textContent=displayString;else span.textContent=isPreview?"function":displayString;return span;} span.textContent=displayString;if(size!==undefined&&(subtype==="array"||subtype==="set"||subtype==="map"||subtype==="weakmap"||subtype==="weakset")){var sizeElement=span.appendChild(document.createElement("span"));sizeElement.className="size";sizeElement.textContent=" ("+size+")";} return span;};WebInspector.FormattedValue.createElementForRemoteObject=function(object,hadException) {return WebInspector.FormattedValue.createElementForTypesAndValue(object.type,object.subtype,object.description,object.size,false,hadException);};WebInspector.FormattedValue.createElementForObjectPreview=function(objectPreview) {return WebInspector.FormattedValue.createElementForTypesAndValue(objectPreview.type,objectPreview.subtype,objectPreview.description,objectPreview.size,true,false);};WebInspector.FormattedValue.createElementForPropertyPreview=function(propertyPreview) {return WebInspector.FormattedValue.createElementForTypesAndValue(propertyPreview.type,propertyPreview.subtype,propertyPreview.value,undefined,true,false);};WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForObjectPreview=function(objectPreview,previewViewMode) {if(objectPreview.subtype==="node") return WebInspector.FormattedValue.createElementForNodePreview(objectPreview);if(objectPreview.type==="function") return WebInspector.FormattedValue.createElementForFunctionWithName(objectPreview.description);return new WebInspector.ObjectPreviewView(objectPreview,previewViewMode).element;};WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForRemoteObject=function(object,previewViewMode) {if(object.subtype==="node") return WebInspector.FormattedValue.createElementForNode(object);if(object.subtype==="error") return WebInspector.FormattedValue.createElementForError(object);if(object.preview) return new WebInspector.ObjectPreviewView(object.preview,previewViewMode);return WebInspector.FormattedValue.createElementForRemoteObject(object);};WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject=function(object,propertyPath,forceExpanding) {if(object.subtype==="node") return WebInspector.FormattedValue.createElementForNode(object);if(object.subtype==="null") return WebInspector.FormattedValue.createElementForRemoteObject(object);if(object.type==="object"||object.subtype==="class"){var objectTree=new WebInspector.ObjectTreeView(object,null,propertyPath,forceExpanding);return objectTree.element;} return WebInspector.FormattedValue.createElementForRemoteObject(object);};WebInspector.FormattedValue.MAX_PREVIEW_STRING_LENGTH=140;WebInspector.FrameDOMTreeContentView=class FrameDOMTreeContentView extends WebInspector.DOMTreeContentView {constructor(domTree) {super(domTree);this._domTree=domTree;this._domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated,this._rootDOMNodeInvalidated,this);this._requestRootDOMNode();} get domTree() {return this._domTree;} closed() {this._domTree.removeEventListener(null,null,this);super.closed();} getSearchContextNodes(callback) {this._domTree.requestRootDOMNode(function(rootDOMNode){callback([rootDOMNode.id]);});} _rootDOMNodeAvailable(rootDOMNode) {this.domTreeOutline.rootDOMNode=rootDOMNode;if(!rootDOMNode){this.domTreeOutline.selectDOMNode(null,false);return;} this._restoreBreakpointsAfterUpdate();this._restoreSelectedNodeAfterUpdate(this._domTree.frame.url,rootDOMNode.body||rootDOMNode.documentElement||rootDOMNode.firstChild);} _rootDOMNodeInvalidated(event) {this._requestRootDOMNode();} _requestRootDOMNode() {this._domTree.requestRootDOMNode(this._rootDOMNodeAvailable.bind(this));}};WebInspector.FrameTreeElement=class FrameTreeElement extends WebInspector.ResourceTreeElement {constructor(frame,representedObject) {super(frame.mainResource,representedObject||frame);this._frame=frame;this._updateExpandedSetting();frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded,this._resourceWasAdded,this);frame.addEventListener(WebInspector.Frame.Event.ResourceWasRemoved,this._resourceWasRemoved,this);frame.addEventListener(WebInspector.Frame.Event.ExtraScriptAdded,this._extraScriptAdded,this);frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasAdded,this._childFrameWasAdded,this);frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved,this._childFrameWasRemoved,this);frame.domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasAdded,this._childContentFlowWasAdded,this);frame.domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasRemoved,this._childContentFlowWasRemoved,this);frame.domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated,this._rootDOMNodeInvalidated,this);this.shouldRefreshChildren=true;this.folderSettingsKey=this._frame.url.hash;this.registerFolderizeSettings("frames",WebInspector.UIString("Frames"),this._frame.childFrameCollection,WebInspector.FrameTreeElement);this.registerFolderizeSettings("flows",WebInspector.UIString("Flows"),this._frame.domTree.contentFlowCollection,WebInspector.ContentFlowTreeElement);this.registerFolderizeSettings("extra-scripts",WebInspector.UIString("Extra Scripts"),this._frame.extraScriptCollection,WebInspector.ScriptTreeElement);if(window.CanvasAgent&&WebInspector.settings.experimentalShowCanvasContextsInResources.value) this.registerFolderizeSettings("canvases",WebInspector.UIString("Canvases"),this._frame.canvasCollection,WebInspector.CanvasTreeElement);function forwardingConstructor(representedObject,...extraArguments){if(representedObject instanceof WebInspector.CSSStyleSheet) return new WebInspector.CSSStyleSheetTreeElement(representedObject,...extraArguments);return new WebInspector.ResourceTreeElement(representedObject,...extraArguments);} for(let[key,value]of Object.entries(WebInspector.Resource.Type)){let folderName=WebInspector.Resource.displayNameForType(value,true);let treeElementConstructor=forwardingConstructor;if(value===WebInspector.Resource.Type.WebSocket) treeElementConstructor=WebInspector.WebSocketResourceTreeElement;this.registerFolderizeSettings(key,folderName,this._frame.resourceCollectionForType(value),treeElementConstructor);} this.updateParentStatus();} get frame() {return this._frame;} descendantResourceTreeElementTypeDidChange(resourceTreeElement,oldType) { this._addTreeElement(resourceTreeElement);} descendantResourceTreeElementMainTitleDidChange(resourceTreeElement,oldMainTitle) { this._addTreeElement(resourceTreeElement);} updateSourceMapResources() {if(!this.treeOutline||!this.treeOutline.includeSourceMapResourceChildren) return;if(!this._frame) return;this.updateParentStatus();if(this.resource&&this.resource.sourceMaps.length) this.shouldRefreshChildren=true;} onattach() {WebInspector.GeneralTreeElement.prototype.onattach.call(this);WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded,this._styleSheetAdded,this);if(window.CanvasAgent&&WebInspector.settings.experimentalShowCanvasContextsInResources.value){this._frame.canvasCollection.addEventListener(WebInspector.Collection.Event.ItemAdded,this._canvasWasAdded,this);this._frame.canvasCollection.addEventListener(WebInspector.Collection.Event.ItemRemoved,this._canvasWasRemoved,this);}} ondetach() {WebInspector.cssStyleManager.removeEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded,this._styleSheetAdded,this);if(window.CanvasAgent&&WebInspector.settings.experimentalShowCanvasContextsInResources.value){this._frame.canvasCollection.removeEventListener(WebInspector.Collection.Event.ItemAdded,this._canvasWasAdded,this);this._frame.canvasCollection.removeEventListener(WebInspector.Collection.Event.ItemRemoved,this._canvasWasRemoved,this);} super.ondetach();} compareChildTreeElements(a,b) {if(a===b) return 0;var aIsResource=a instanceof WebInspector.ResourceTreeElement;var bIsResource=b instanceof WebInspector.ResourceTreeElement;if(aIsResource&&bIsResource) return WebInspector.ResourceTreeElement.compareResourceTreeElements(a,b);if(!aIsResource&&!bIsResource){return super.compareChildTreeElements(a,b);} return aIsResource?1:-1;} onpopulate() {if(this.children.length&&!this.shouldRefreshChildren) return;this.shouldRefreshChildren=false;this.removeChildren();this.updateParentStatus();this.prepareToPopulate();for(let frame of this._frame.childFrameCollection.items) this.addChildForRepresentedObject(frame);for(let resource of this._frame.resourceCollection.items) this.addChildForRepresentedObject(resource);var sourceMaps=this.resource&&this.resource.sourceMaps;for(var i=0;i{let optionElement=this._angleUnitsSelectElement.appendChild(document.createElement("option"));optionElement.value=optionElement.textContent=name;return[name,{element:optionElement,min,max,step}];}));} get element() {return this._element;} set gradient(gradient) {if(!gradient) return;const isLinear=gradient instanceof WebInspector.LinearGradient;const isRadial=gradient instanceof WebInspector.RadialGradient;if(!isLinear&&!isRadial) return;this._gradient=gradient;this._gradientSlider.stops=this._gradient.stops;if(isLinear){this._gradientTypePicker.value=this._gradient.repeats?"repeating-linear-gradient":"linear-gradient";this._angleUnitsChanged();}else this._gradientTypePicker.value=this._gradient.repeats?"repeating-radial-gradient":"radial-gradient";this._updateCSSClassForGradientType();} get gradient() {return this._gradient;} gradientSliderStopsDidChange(gradientSlider) {this._gradient.stops=gradientSlider.stops;this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged,{gradient:this._gradient});} gradientSliderStopWasSelected(gradientSlider,stop) {const selectedStop=gradientSlider.selectedStop;if(selectedStop&&!this._editingColor){this._element.appendChild(this._colorPicker.element);this._element.classList.add("editing-color");this._colorPicker.color=selectedStop.color;this._editingColor=true;}else if(!selectedStop){this._colorPicker.element.remove();this._element.classList.remove("editing-color");this._editingColor=false;} this._angleInputElement.blur();this.dispatchEventToListeners(WebInspector.GradientEditor.Event.ColorPickerToggled);this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged,{gradient:this._gradient});} _updateCSSClassForGradientType() {const isRadial=this._gradient instanceof WebInspector.RadialGradient;this._element.classList.toggle("radial-gradient",isRadial);this.dispatchEventToListeners(WebInspector.GradientEditor.Event.ColorPickerToggled);} _gradientTypeChanged(event) {const descriptor=this._gradientTypes[this._gradientTypePicker.value];if(!(this._gradient instanceof descriptor.type)){if(descriptor.type===WebInspector.LinearGradient){this._gradient=new WebInspector.LinearGradient({value:180,units:WebInspector.LinearGradient.AngleUnits.DEG},this._gradient.stops);this._angleUnitsChanged();}else this._gradient=new WebInspector.RadialGradient("",this._gradient.stops);this._updateCSSClassForGradientType();} this._gradient.repeats=descriptor.repeats;this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged,{gradient:this._gradient});} _colorPickerColorChanged(event) {this._gradientSlider.selectedStop.color=event.target.color;this._gradientSlider.stops=this._gradient.stops;this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged,{gradient:this._gradient});} _angleValueChanged(event) {switch(event.target){case this._angleInputElement:this._gradient.angleValue=this._angleSliderElement.value=parseFloat(this._angleInputElement.value)||0;break;case this._angleSliderElement:this._gradient.angleValue=this._angleInputElement.value=parseFloat(this._angleSliderElement.value)||0;break;default:WebInspector.reportInternalError("Input event fired for disabled color component input");return;} this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged,{gradient:this._gradient});} _angleUnitsChanged(event) {let units=this._angleUnitsSelectElement.value;let configuration=this._angleUnitsConfiguration.get(units);if(!configuration){WebInspector.reportInternalError(`Missing configuration data for selected angle units "${units}"`);return;} this._gradient.angleUnits=units;this._angleInputElement.min=this._angleSliderElement.min=configuration.min;this._angleInputElement.max=this._angleSliderElement.max=configuration.max;this._angleInputElement.step=this._angleSliderElement.step=configuration.step;this._angleInputElement.value=this._angleSliderElement.value=this._gradient.angleValue;this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged,{gradient:this._gradient});}};WebInspector.GradientEditor.Event={GradientChanged:"gradient-editor-gradient-changed",ColorPickerToggled:"gradient-editor-color-picker-toggled"};WebInspector.GradientSlider=class GradientSlider extends WebInspector.Object {constructor(delegate) {super();this.delegate=delegate;this._element=null;this._stops=[];this._knobs=[];this._selectedKnob=null;this._canvas=document.createElement("canvas");this._keyboardShortcutEsc=new WebInspector.KeyboardShortcut(null,WebInspector.KeyboardShortcut.Key.Escape);} get element() {if(!this._element){this._element=document.createElement("div");this._element.className="gradient-slider";this._element.appendChild(this._canvas);this._addArea=this._element.appendChild(document.createElement("div"));this._addArea.addEventListener("mouseover",this);this._addArea.addEventListener("mousemove",this);this._addArea.addEventListener("mouseout",this);this._addArea.addEventListener("click",this);this._addArea.className=WebInspector.GradientSlider.AddAreaClassName;} return this._element;} get stops() {return this._stops;} set stops(stops) {this._stops=stops;this._updateStops();} get selectedStop() {return this._selectedKnob?this._selectedKnob.stop:null;} handleEvent(event) {switch(event.type){case"mouseover":this._handleMouseover(event);break;case"mousemove":this._handleMousemove(event);break;case"mouseout":this._handleMouseout(event);break;case"click":this._handleClick(event);break;}} handleKeydownEvent(event) {if(!this._keyboardShortcutEsc.matchesEvent(event)||!this._selectedKnob||!this._selectedKnob.selected) return false;this._selectedKnob.selected=false;return true;} knobXDidChange(knob) {knob.stop.offset=knob.x/WebInspector.GradientSlider.Width;this._sortStops();this._updateCanvas();} knobCanDetach(knob) {return this._knobs.length>2;} knobWillDetach(knob) {knob.element.classList.add(WebInspector.GradientSlider.DetachingClassName);this._stops.remove(knob.stop);this._knobs.remove(knob);this._sortStops();this._updateCanvas();} knobSelectionChanged(knob) {if(this._selectedKnob&&this._selectedKnob!==knob&&knob.selected) this._selectedKnob.selected=false;this._selectedKnob=knob.selected?knob:null;if(this.delegate&&typeof this.delegate.gradientSliderStopWasSelected==="function") this.delegate.gradientSliderStopWasSelected(this,knob.stop);if(this._selectedKnob) WebInspector.addWindowKeydownListener(this);else WebInspector.removeWindowKeydownListener(this);} _handleMouseover(event) {this._updateShadowKnob(event);} _handleMousemove(event) {this._updateShadowKnob(event);} _handleMouseout(event) {if(!this._shadowKnob) return;this._shadowKnob.element.remove();delete this._shadowKnob;} _handleClick(event) {this._updateShadowKnob(event);this._knobs.push(this._shadowKnob);this._shadowKnob.element.classList.remove(WebInspector.GradientSlider.ShadowClassName);var stop={offset:this._shadowKnob.x/WebInspector.GradientSlider.Width,color:this._shadowKnob.wellColor};this._stops.push(stop);this._sortStops();this._updateStops();this._knobs[this._stops.indexOf(stop)].selected=true;delete this._shadowKnob;} _updateShadowKnob(event) {if(!this._shadowKnob){this._shadowKnob=new WebInspector.GradientSliderKnob(this);this._shadowKnob.element.classList.add(WebInspector.GradientSlider.ShadowClassName);this.element.appendChild(this._shadowKnob.element);} this._shadowKnob.x=window.webkitConvertPointFromPageToNode(this.element,new WebKitPoint(event.pageX,event.pageY)).x;var colorData=this._canvas.getContext("2d").getImageData(this._shadowKnob.x-1,0,1,1).data;this._shadowKnob.wellColor=new WebInspector.Color(WebInspector.Color.Format.RGB,[colorData[0],colorData[1],colorData[2],colorData[3]/255]);} _sortStops() {this._stops.sort(function(a,b){return a.offset-b.offset;});} _updateStops() {this._updateCanvas();this._updateKnobs();} _updateCanvas() {var w=WebInspector.GradientSlider.Width;var h=WebInspector.GradientSlider.Height;this._canvas.width=w;this._canvas.height=h;var ctx=this._canvas.getContext("2d");var gradient=ctx.createLinearGradient(0,0,w,0);for(var stop of this._stops) gradient.addColorStop(stop.offset,stop.color);ctx.clearRect(0,0,w,h);ctx.fillStyle=gradient;ctx.fillRect(0,0,w,h);if(this.delegate&&typeof this.delegate.gradientSliderStopsDidChange==="function") this.delegate.gradientSliderStopsDidChange(this);} _updateKnobs() {var selectedStop=this._selectedKnob?this._selectedKnob.stop:null;while(this._knobs.length>this._stops.length) this._knobs.pop().element.remove();while(this._knobs.length50){this._detaching=this.delegate&&typeof this.delegate.knobCanDetach==="function"&&this.delegate.knobCanDetach(this);if(this._detaching&&this.delegate&&typeof this.delegate.knobWillDetach==="function"){var translationFromParentToBody=window.webkitConvertPointFromNodeToPage(this.element.parentNode,new WebKitPoint(0,0));this._startMouseX-=translationFromParentToBody.x;this._startMouseY-=translationFromParentToBody.y;document.body.appendChild(this.element);this.delegate.knobWillDetach(this);}} var x=this._startX+event.pageX-this._startMouseX;if(!this._detaching) x=Math.min(Math.max(0,x),w);this.x=x;if(this._detaching) this.y=event.pageY-this._startMouseY;else if(this.delegate&&typeof this.delegate.knobXDidChange==="function") this.delegate.knobXDidChange(this);} _handleMouseup(event) {window.removeEventListener("mousemove",this,true);window.removeEventListener("mouseup",this,true);if(this._detaching){this.element.addEventListener("transitionend",this);this.element.classList.add(WebInspector.GradientSliderKnob.FadeOutClassName);this.selected=false;}else if(!this._moved) this.selected=!this.selected;} _handleTransitionEnd(event) {this.element.removeEventListener("transitionend",this);this.element.classList.remove(WebInspector.GradientSliderKnob.FadeOutClassName);this.element.remove();} _updateTransform() {this.element.style.webkitTransform="translate3d("+this._x+"px, "+this._y+"px, 0)";}};WebInspector.GradientSliderKnob.SelectedClassName="selected";WebInspector.GradientSliderKnob.FadeOutClassName="fade-out";WebInspector.HeapAllocationsTimelineDataGridNode=class HeapAllocationsTimelineDataGridNode extends WebInspector.TimelineDataGridNode {constructor(heapAllocationsTimelineRecord,zeroTime,heapAllocationsView) {super(false,null);this._record=heapAllocationsTimelineRecord;this._heapAllocationsView=heapAllocationsView;this._data={name:this.displayName(),timestamp:zeroTime?this._record.timestamp-zeroTime:NaN,size:this._record.heapSnapshot.totalSize,liveSize:this._record.heapSnapshot.liveSize,};this._record.heapSnapshot.addEventListener(WebInspector.HeapSnapshotProxy.Event.CollectedNodes,this._heapSnapshotCollectedNodes,this);this._record.heapSnapshot.addEventListener(WebInspector.HeapSnapshotProxy.Event.Invalidated,this._heapSnapshotInvalidated,this);} get record(){return this._record;} get data(){return this._data;} createCellContent(columnIdentifier,cell) {switch(columnIdentifier){case"name":cell.classList.add(...this.iconClassNames());var fragment=document.createDocumentFragment();var titleElement=fragment.appendChild(document.createElement("span"));titleElement.textContent=this._data.name;if(!this._record.heapSnapshot.invalid){var goToButton=fragment.appendChild(WebInspector.createGoToArrowButton());goToButton.addEventListener("click",(event)=>{this._heapAllocationsView.showHeapSnapshotTimelineRecord(this._record);});} return fragment;case"timestamp":return isNaN(this._data.timestamp)?emDash:Number.secondsToString(this._data.timestamp,true);case"size":return Number.bytesToString(this._data.size);case"liveSize":return Number.bytesToString(this._data.liveSize);} return super.createCellContent(columnIdentifier,cell);} markAsBaseline() {this.element.classList.add("baseline");} clearBaseline() {this.element.classList.remove("baseline");} updateTimestamp(zeroTime) {this._data.timestamp=this._record.timestamp-zeroTime;this.needsRefresh();} createCells() {super.createCells();if(this._record.heapSnapshot.invalid) this.element.classList.add("invalid");} _heapSnapshotCollectedNodes() {let oldSize=this._data.liveSize;let newSize=this._record.heapSnapshot.liveSize;if(oldSize===newSize) return;this._data.liveSize=newSize;this.needsRefresh();} _heapSnapshotInvalidated() {this._data.liveSize=0;this.needsRefresh();}};WebInspector.HeapAllocationsTimelineDataGridNodePathComponent=class HeapAllocationsTimelineDataGridNodePathComponent extends WebInspector.TimelineDataGridNodePathComponent { get previousSibling() {let previousSibling=this.timelineDataGridNode.previousSibling;while(previousSibling&&(previousSibling.hidden||previousSibling.record.heapSnapshot.invalid)) previousSibling=previousSibling.previousSibling;if(!previousSibling) return null;return new WebInspector.HeapAllocationsTimelineDataGridNodePathComponent(previousSibling);} get nextSibling() {let nextSibling=this.timelineDataGridNode.nextSibling;while(nextSibling&&(nextSibling.hidden||nextSibling.record.heapSnapshot.invalid)) nextSibling=nextSibling.nextSibling;if(!nextSibling) return null;return new WebInspector.HeapAllocationsTimelineDataGridNodePathComponent(nextSibling);}};WebInspector.HeapAllocationsTimelineOverviewGraph=class HeapAllocationsTimelineOverviewGraph extends WebInspector.TimelineOverviewGraph {constructor(timeline,timelineOverview) {super(timelineOverview);this.element.classList.add("heap-allocations");this._heapAllocationsTimeline=timeline;this._heapAllocationsTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._heapAllocationTimelineRecordAdded,this);this._selectedImageElement=null;this.reset();} reset() {super.reset();this.element.removeChildren();} layout() {if(!this.visible) return;this.element.removeChildren();if(this._selectedImageElement){this._selectedImageElement.classList.remove("selected");this._selectedImageElement=null;} let visibleRecords=this._heapAllocationsTimeline.recordsInTimeRange(this.startTime,this.endTime);if(!visibleRecords.length) return;let graphStartTime=this.startTime;let secondsPerPixel=this.timelineOverview.secondsPerPixel;function xScale(time){return(time-graphStartTime)/secondsPerPixel;} for(let record of visibleRecords){const halfImageWidth=8;let x=xScale(record.timestamp)-halfImageWidth;if(x<=1) x=1;let imageElement=record[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol];if(!imageElement){imageElement=record[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol]=document.createElement("img");imageElement.classList.add("snapshot");imageElement.addEventListener("click",()=>{if(record.heapSnapshot.invalid) return;this.selectedRecord=record;});} imageElement.style.setProperty(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"right":"left",`${x}px`);if(record.heapSnapshot.invalid) imageElement.classList.add("invalid");this.element.appendChild(imageElement);} this._updateSnapshotMarkers();} updateSelectedRecord() {this._updateSnapshotMarkers();} _updateSnapshotMarkers() {if(this._selectedImageElement) this._selectedImageElement.classList.remove("selected");if(!this.selectedRecord){this._selectedImageElement=null;return;} let imageElement=this.selectedRecord[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol];if(!imageElement) return;imageElement.classList.add("selected");this._selectedImageElement=imageElement;} _heapAllocationTimelineRecordAdded(event) {this.needsLayout();}};WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol=Symbol("record-element-association");WebInspector.HeapAllocationsTimelineView=class HeapAllocationsTimelineView extends WebInspector.TimelineView {constructor(timeline,extraArguments) {super(timeline,extraArguments);this.element.classList.add("heap-allocations");let columns={name:{title:WebInspector.UIString("Name"),width:"150px",icon:true,},timestamp:{title:WebInspector.UIString("Time"),width:"80px",sortable:true,aligned:"right",},size:{title:WebInspector.UIString("Size"),width:"80px",sortable:true,aligned:"right",},liveSize:{title:WebInspector.UIString("Live Size"),width:"80px",sortable:true,aligned:"right",},};let snapshotTooltip=WebInspector.UIString("Take snapshot");this._takeHeapSnapshotButtonItem=new WebInspector.ButtonNavigationItem("take-snapshot",snapshotTooltip,"Images/Camera.svg",16,16);this._takeHeapSnapshotButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._takeHeapSnapshotClicked,this);let defaultToolTip=WebInspector.UIString("Compare snapshots");let activatedToolTip=WebInspector.UIString("Cancel comparison");this._compareHeapSnapshotsButtonItem=new WebInspector.ActivateButtonNavigationItem("compare-heap-snapshots",defaultToolTip,activatedToolTip,"Images/Compare.svg",16,16);this._compareHeapSnapshotsButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._compareHeapSnapshotsClicked,this);this._compareHeapSnapshotsButtonItem.enabled=false;this._compareHeapSnapshotsButtonItem.activated=false;this._compareHeapSnapshotHelpTextItem=new WebInspector.TextNavigationItem("compare-heap-snapshot-help-text","");this._selectingComparisonHeapSnapshots=false;this._baselineDataGridNode=null;this._baselineHeapSnapshotTimelineRecord=null;this._heapSnapshotDiff=null;this._snapshotListScrollTop=0;this._showingSnapshotList=true;this._snapshotListPathComponent=new WebInspector.HierarchicalPathComponent(WebInspector.UIString("Snapshot List"),"snapshot-list-icon","snapshot-list",false,false);this._snapshotListPathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.Clicked,this._snapshotListPathComponentClicked,this);this._dataGrid=new WebInspector.TimelineDataGrid(columns);this._dataGrid.sortColumnIdentifier="timestamp";this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Ascending;this._dataGrid.createSettings("heap-allocations-timeline-view");this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged,this._dataGridNodeSelected,this);this.addSubview(this._dataGrid);this._contentViewContainer=new WebInspector.ContentViewContainer;this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange,this._currentContentViewDidChange,this);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange,this._contentViewSelectionPathComponentDidChange,this);this._pendingRecords=[];this._pendingZeroTimeDataGridNodes=[];timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._heapAllocationsTimelineRecordAdded,this);WebInspector.HeapSnapshotProxy.addEventListener(WebInspector.HeapSnapshotProxy.Event.Invalidated,this._heapSnapshotInvalidated,this);WebInspector.HeapSnapshotWorkerProxy.singleton().addEventListener("HeapSnapshot.CollectionEvent",this._heapSnapshotCollectionEvent,this);} get scrollableElements() {if(this._showingSnapshotList) return[this._dataGrid.scrollContainer];if(this._contentViewContainer.currentContentView) return this._contentViewContainer.currentContentView.scrollableElements;return[];} showHeapSnapshotList() {if(this._showingSnapshotList) return;this._showingSnapshotList=true;this._heapSnapshotDiff=null;this._cancelSelectComparisonHeapSnapshots();this._contentViewContainer.hidden();this.removeSubview(this._contentViewContainer);this.addSubview(this._dataGrid);this._dataGrid.scrollContainer.scrollTop=this._snapshotListScrollTop;this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);} showHeapSnapshotTimelineRecord(heapSnapshotTimelineRecord) {if(this._showingSnapshotList){this._snapshotListScrollTop=this._dataGrid.scrollContainer.scrollTop;this.removeSubview(this._dataGrid);this.addSubview(this._contentViewContainer);this._contentViewContainer.shown();} this._showingSnapshotList=false;this._heapSnapshotDiff=null;this._cancelSelectComparisonHeapSnapshots();for(let dataGridNode of this._dataGrid.children){if(dataGridNode.record===heapSnapshotTimelineRecord){dataGridNode.select();break;}} let shouldTriggerContentViewUpdate=this._contentViewContainer.currentContentView&&this._contentViewContainer.currentContentView.representedObject===heapSnapshotTimelineRecord.heapSnapshot;this._contentViewContainer.showContentViewForRepresentedObject(heapSnapshotTimelineRecord.heapSnapshot);if(shouldTriggerContentViewUpdate) this._currentContentViewDidChange();} showHeapSnapshotDiff(heapSnapshotDiff) {if(this._showingSnapshotList){this.removeSubview(this._dataGrid);this.addSubview(this._contentViewContainer);this._contentViewContainer.shown();} this._showingSnapshotList=false;this._heapSnapshotDiff=heapSnapshotDiff;this._contentViewContainer.showContentViewForRepresentedObject(heapSnapshotDiff);} get showsFilterBar(){return this._showingSnapshotList;} get navigationItems() {if(this._showingSnapshotList){let items=[this._takeHeapSnapshotButtonItem,this._compareHeapSnapshotsButtonItem];if(this._selectingComparisonHeapSnapshots) items.push(this._compareHeapSnapshotHelpTextItem);return items;} return this._contentViewContainer.currentContentView.navigationItems;} get selectionPathComponents() {let components=[this._snapshotListPathComponent];if(this._showingSnapshotList) return components;if(this._heapSnapshotDiff){let firstSnapshotIdentifier=this._heapSnapshotDiff.snapshot1.identifier;let secondSnapshotIdentifier=this._heapSnapshotDiff.snapshot2.identifier;let diffComponent=new WebInspector.HierarchicalPathComponent(WebInspector.UIString("Snapshot Comparison (%d and %d)").format(firstSnapshotIdentifier,secondSnapshotIdentifier),"snapshot-diff-icon","snapshot-diff");components.push(diffComponent);}else if(this._dataGrid.selectedNode){let heapSnapshotPathComponent=new WebInspector.HeapAllocationsTimelineDataGridNodePathComponent(this._dataGrid.selectedNode);heapSnapshotPathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this._snapshotPathComponentSelected,this);components.push(heapSnapshotPathComponent);} return components.concat(this._contentViewContainer.currentContentView.selectionPathComponents);} selectRecord(record) {if(record) this.showHeapSnapshotTimelineRecord(record);else this.showHeapSnapshotList();} shown() {super.shown();this._dataGrid.shown();if(!this._showingSnapshotList) this._contentViewContainer.shown();} hidden() {super.hidden();this._dataGrid.hidden();if(!this._showingSnapshotList) this._contentViewContainer.hidden();} closed() {this.representedObject.removeEventListener(null,null,this);this._dataGrid.closed();this._contentViewContainer.closeAllContentViews();WebInspector.ContentView.removeEventListener(null,null,this);WebInspector.HeapSnapshotProxy.removeEventListener(null,null,this);WebInspector.HeapSnapshotWorkerProxy.singleton().removeEventListener("HeapSnapshot.CollectionEvent",this._heapSnapshotCollectionEvent,this);} layout() {if(this._pendingZeroTimeDataGridNodes.length&&this.zeroTime){for(let dataGridNode of this._pendingZeroTimeDataGridNodes) dataGridNode.updateTimestamp(this.zeroTime);this._pendingZeroTimeDataGridNodes=[];this._dataGrid._sort();} if(this._pendingRecords.length){for(let heapAllocationsTimelineRecord of this._pendingRecords){let dataGridNode=new WebInspector.HeapAllocationsTimelineDataGridNode(heapAllocationsTimelineRecord,this.zeroTime,this);this._dataGrid.addRowInSortOrder(null,dataGridNode);if(!this.zeroTime) this._pendingZeroTimeDataGridNodes.push(dataGridNode);} this._pendingRecords=[];this._updateCompareHeapSnapshotButton();}} reset() {super.reset();this._dataGrid.reset();this.showHeapSnapshotList();this._pendingRecords=[];this._pendingZeroTimeDataGridNodes=[];this._updateCompareHeapSnapshotButton();} updateFilter(filters) {this._dataGrid.filterText=filters?filters.text:"";} _heapAllocationsTimelineRecordAdded(event) {this._pendingRecords.push(event.data.record);this.needsLayout();} _heapSnapshotCollectionEvent(event) {function updateHeapSnapshotForEvent(heapSnapshot){if(heapSnapshot.invalid) return;heapSnapshot.updateForCollectionEvent(event);} for(let node of this._dataGrid.children) updateHeapSnapshotForEvent(node.record.heapSnapshot);for(let record of this._pendingRecords) updateHeapSnapshotForEvent(record.heapSnapshot);if(this._heapSnapshotDiff) updateHeapSnapshotForEvent(this._heapSnapshotDiff);} _snapshotListPathComponentClicked(event) {this.showHeapSnapshotList();} _snapshotPathComponentSelected(event) {this.showHeapSnapshotTimelineRecord(event.data.pathComponent.representedObject);} _currentContentViewDidChange(event) {this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);} _contentViewSelectionPathComponentDidChange(event) {if(event.target!==this._contentViewContainer.currentContentView) return;this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);} _heapSnapshotInvalidated(event) {let heapSnapshot=event.target;if(this._baselineHeapSnapshotTimelineRecord){if(heapSnapshot===this._baselineHeapSnapshotTimelineRecord.heapSnapshot) this._cancelSelectComparisonHeapSnapshots();} if(this._heapSnapshotDiff){if(heapSnapshot===this._heapSnapshotDiff.snapshot1||heapSnapshot===this._heapSnapshotDiff.snapshot2) this.showHeapSnapshotList();}else if(this._dataGrid.selectedNode){if(heapSnapshot===this._dataGrid.selectedNode.record.heapSnapshot) this.showHeapSnapshotList();} this._updateCompareHeapSnapshotButton();} _updateCompareHeapSnapshotButton() {let hasAtLeastTwoValidSnapshots=false;let count=0;for(let node of this._dataGrid.children){if(node.revealed&&!node.hidden&&!node.record.heapSnapshot.invalid){count++;if(count===2){hasAtLeastTwoValidSnapshots=true;break;}}} this._compareHeapSnapshotsButtonItem.enabled=hasAtLeastTwoValidSnapshots;} _takeHeapSnapshotClicked() {HeapAgent.snapshot(function(error,timestamp,snapshotStringData){let workerProxy=WebInspector.HeapSnapshotWorkerProxy.singleton();workerProxy.createSnapshot(snapshotStringData,({objectId,snapshot:serializedSnapshot})=>{let snapshot=WebInspector.HeapSnapshotProxy.deserialize(objectId,serializedSnapshot);WebInspector.timelineManager.heapSnapshotAdded(timestamp,snapshot);});});} _cancelSelectComparisonHeapSnapshots() {if(!this._selectingComparisonHeapSnapshots) return;if(this._baselineDataGridNode) this._baselineDataGridNode.clearBaseline();this._selectingComparisonHeapSnapshots=false;this._baselineDataGridNode=null;this._baselineHeapSnapshotTimelineRecord=null;this._compareHeapSnapshotsButtonItem.activated=false;this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);} _compareHeapSnapshotsClicked(event) {let newActivated=!this._compareHeapSnapshotsButtonItem.activated;this._compareHeapSnapshotsButtonItem.activated=newActivated;if(!newActivated){this._cancelSelectComparisonHeapSnapshots();return;} if(this._dataGrid.selectedNode) this._dataGrid.selectedNode.deselect();this._selectingComparisonHeapSnapshots=true;this._baselineHeapSnapshotTimelineRecord=null;this._compareHeapSnapshotHelpTextItem.text=WebInspector.UIString("Select baseline snapshot");this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);} _dataGridNodeSelected(event) {if(!this._selectingComparisonHeapSnapshots) return;let dataGridNode=this._dataGrid.selectedNode;if(!dataGridNode) return;let heapAllocationsTimelineRecord=dataGridNode.record;if(heapAllocationsTimelineRecord.heapSnapshot.invalid||this._baselineHeapSnapshotTimelineRecord===heapAllocationsTimelineRecord){this._dataGrid.selectedNode.deselect();return;} if(!this._baselineHeapSnapshotTimelineRecord){this._baselineDataGridNode=dataGridNode;this._baselineDataGridNode.markAsBaseline();this._baselineHeapSnapshotTimelineRecord=heapAllocationsTimelineRecord;this._dataGrid.selectedNode.deselect();this._compareHeapSnapshotHelpTextItem.text=WebInspector.UIString("Select comparison snapshot");this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);return;} let snapshot1=this._baselineHeapSnapshotTimelineRecord.heapSnapshot;let snapshot2=heapAllocationsTimelineRecord.heapSnapshot;if(snapshot1.identifier>snapshot2.identifier) [snapshot1,snapshot2]=[snapshot2,snapshot1];let workerProxy=WebInspector.HeapSnapshotWorkerProxy.singleton();workerProxy.createSnapshotDiff(snapshot1.proxyObjectId,snapshot2.proxyObjectId,({objectId,snapshotDiff:serializedSnapshotDiff})=>{let diff=WebInspector.HeapSnapshotDiffProxy.deserialize(objectId,serializedSnapshotDiff);this.showHeapSnapshotDiff(diff);});this._baselineDataGridNode.clearBaseline();this._baselineDataGridNode=null;this._selectingComparisonHeapSnapshots=false;this._compareHeapSnapshotsButtonItem.activated=false;}};WebInspector.HeapSnapshotClassDataGridNode=class HeapSnapshotClassDataGridNode extends WebInspector.DataGridNode {constructor(data,tree) {super(data,true);this._data=data;this._tree=tree;this._batched=false;this._instances=null;this.addEventListener("populate",this._populate,this);} get data(){return this._data;} createCellContent(columnIdentifier) {if(columnIdentifier==="retainedSize"){let size=this._data.retainedSize;let fragment=document.createDocumentFragment();let sizeElement=fragment.appendChild(document.createElement("span"));sizeElement.classList.add("size");sizeElement.textContent=Number.bytesToString(size);let percentElement=fragment.appendChild(document.createElement("span"));percentElement.classList.add("percentage");percentElement.textContent=emDash;return fragment;} if(columnIdentifier==="size") return Number.bytesToString(this._data.size);if(columnIdentifier==="className"){let{className}=this._data;let fragment=document.createDocumentFragment();let iconElement=fragment.appendChild(document.createElement("img"));iconElement.classList.add("icon",WebInspector.HeapSnapshotClusterContentView.iconStyleClassNameForClassName(className));let nameElement=fragment.appendChild(document.createElement("span"));nameElement.classList.add("class-name");nameElement.textContent=className;return fragment;} return super.createCellContent(columnIdentifier);} sort() {if(this._batched){this._removeFetchMoreDataGridNode();this._sortInstances();this._updateBatchedChildren();this._appendFetchMoreDataGridNode();return;} let children=this.children;children.sort(this._tree._sortComparator);for(let i=0;i{if(dataGridNode instanceof WebInspector.HeapSnapshotInstanceDataGridNode){let heapSnapshotNode=dataGridNode.node;if(heapSnapshotNode.id in collectedNodes) nodesToRemove.push(dataGridNode);}});if(nodesToRemove.length){for(let dataGridNode of nodesToRemove) this.removeChild(dataGridNode);} if(this._instances){this._instances=this._instances.filter((instance)=>!(instance.id in collectedNodes));this._fetchBatch(nodesToRemove.length);}} updateCount(count) {if(count===this._data.count) return;if(!count){this._tree.removeChild(this);return;} this._data.count=count;this.needsRefresh();} _populate() {this.removeEventListener("populate",this._populate,this);this._tree.heapSnapshot.instancesWithClassName(this._data.className,(instances)=>{ this._instances=instances.filter((instance)=>!instance.dead);this._sortInstances();if(instances.length>WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit){this._batched=true;this._fetchBatch(WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit);return;} for(let instance of this._instances) this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance,this._tree));});} _fetchBatch(batchSize) {if(this._batched&&this.children.length) this._removeFetchMoreDataGridNode();let oldCount=this.children.length;let newCount=oldCount+batchSize;if(newCount>=this._instances.length){newCount=this._instances.length-1;this._batched=false;} let count=newCount-oldCount;if(count){for(let i=0;i<=count;++i){let instance=this._instances[oldCount+i];this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance,this._tree));}} if(this._batched) this._appendFetchMoreDataGridNode();} _sortInstances() {this._instances.sort((a,b)=>{let fakeDataGridNodeA={data:a};let fakeDataGridNodeB={data:b};return this._tree._sortComparator(fakeDataGridNodeA,fakeDataGridNodeB);});} _updateBatchedChildren() {let count=this.children.length;this.removeChildren();for(let i=0;i=WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit?WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit:0;this.appendChild(new WebInspector.HeapSnapshotInstanceFetchMoreDataGridNode(this._tree,batchSize,remainingCount,this._fetchBatch.bind(this)));}};WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit=100;WebInspector.HeapSnapshotClusterContentView=class HeapSnapshotClusterContentView extends WebInspector.ClusterContentView {constructor(heapSnapshot) {super(heapSnapshot);this._heapSnapshot=heapSnapshot;function createPathComponent(displayName,className,identifier) {let pathComponent=new WebInspector.HierarchicalPathComponent(displayName,className,identifier,false,true);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this._pathComponentSelected,this);pathComponent.comparisonData=heapSnapshot;return pathComponent;} this._shownInitialContent=false;this._instancesContentView=null;this._objectGraphContentView=null;this._instancesPathComponent=createPathComponent.call(this,WebInspector.UIString("Instances"),"heap-snapshot-instances-icon",WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier);this._objectGraphPathComponent=createPathComponent.call(this,WebInspector.UIString("Object Graph"),"heap-snapshot-object-graph-icon",WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier);if(this._supportsObjectGraph()){this._instancesPathComponent.nextSibling=this._objectGraphPathComponent;this._objectGraphPathComponent.previousSibling=this._instancesPathComponent;} this._currentContentViewSetting=new WebInspector.Setting("heap-snapshot-cluster-current-view",WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier);} static iconStyleClassNameForClassName(className,internal) {if(internal) return"native";switch(className){case"Object":case"Array":case"Map":case"Set":case"WeakMap":case"WeakSet":case"Promise":case"Error":case"Window":case"Map Iterator":case"Set Iterator":case"Math":case"JSON":case"GlobalObject":return"object";case"Function":return"function";case"RegExp":return"regex";case"Number":return"number";case"Boolean":return"boolean";case"String":case"string":return"string";case"Symbol":case"symbol":return"symbol";} if(className.endsWith("Prototype")) return"object";if(className.endsWith("Element")||className==="Node"||className==="Text") return"node";return"native";} get heapSnapshot(){return this._heapSnapshot;} get instancesContentView() {if(!this._instancesContentView) this._instancesContentView=new WebInspector.HeapSnapshotInstancesContentView(this._heapSnapshot);return this._instancesContentView;} get objectGraphContentView() {if(!this._supportsObjectGraph()) return null;if(!this._objectGraphContentView) this._objectGraphContentView=new WebInspector.HeapSnapshotObjectGraphContentView(this._heapSnapshot);return this._objectGraphContentView;} get selectionPathComponents() {let currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView) return[];let components=[this._pathComponentForContentView(currentContentView)];return components.concat(currentContentView.selectionPathComponents);} shown() {super.shown();if(this._shownInitialContent) return;this._showContentViewForIdentifier(this._currentContentViewSetting.value);} closed() {super.closed();this._shownInitialContent=false;} saveToCookie(cookie) {cookie[WebInspector.HeapSnapshotClusterContentView.ContentViewIdentifierCookieKey]=this._currentContentViewSetting.value;} restoreFromCookie(cookie) {this._showContentViewForIdentifier(cookie[WebInspector.HeapSnapshotClusterContentView.ContentViewIdentifierCookieKey]);} showInstances() {this._shownInitialContent=true;return this._showContentViewForIdentifier(WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier);} showObjectGraph() {this._shownInitialContent=true;return this._showContentViewForIdentifier(WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier);} _supportsObjectGraph() {return this._heapSnapshot instanceof WebInspector.HeapSnapshotProxy;} _pathComponentForContentView(contentView) {if(!contentView) return null;if(contentView===this._instancesContentView) return this._instancesPathComponent;if(contentView===this._objectGraphContentView) return this._objectGraphPathComponent;console.error("Unknown contentView.");return null;} _identifierForContentView(contentView) {if(!contentView) return null;if(contentView===this._instancesContentView) return WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier;if(contentView===this._objectGraphContentView) return WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier;console.error("Unknown contentView.");return null;} _showContentViewForIdentifier(identifier) {let contentViewToShow=null;switch(identifier){case WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier:contentViewToShow=this.instancesContentView;break;case WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier:contentViewToShow=this.objectGraphContentView;break;} if(!contentViewToShow) contentViewToShow=this.instancesContentView;this._shownInitialContent=true;this._currentContentViewSetting.value=this._identifierForContentView(contentViewToShow);return this.contentViewContainer.showContentView(contentViewToShow);} _pathComponentSelected(event) {this._showContentViewForIdentifier(event.data.pathComponent.representedObject);}};WebInspector.HeapSnapshotClusterContentView.ContentViewIdentifierCookieKey="heap-snapshot-cluster-content-view-identifier";WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier="instances";WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier="object-graph";WebInspector.HeapSnapshotContentView=class HeapSnapshotContentView extends WebInspector.ContentView {constructor(representedObject,identifier,columns,heapSnapshotDataGridTreeConstructor) {super(representedObject);this.element.classList.add("heap-snapshot");this._dataGrid=new WebInspector.DataGrid(columns);this._dataGrid.sortColumnIdentifier="retainedSize";this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Descending;this._dataGrid.createSettings(identifier);this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged,this._sortDataGrid,this);let sortComparator=WebInspector.HeapSnapshotDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier,this._dataGrid.sortOrder);this._heapSnapshotDataGridTree=new heapSnapshotDataGridTreeConstructor(this.representedObject,sortComparator);this._heapSnapshotDataGridTree.addEventListener(WebInspector.HeapSnapshotDataGridTree.Event.DidPopulate,this._heapSnapshotDataGridTreeDidPopulate,this);for(let child of this._heapSnapshotDataGridTree.children) this._dataGrid.appendChild(child);this.addSubview(this._dataGrid);this._dataGrid.updateLayout();} shown() {super.shown();this._heapSnapshotDataGridTree.shown();} hidden() {super.hidden();this._heapSnapshotDataGridTree.hidden();} get scrollableElements() {return[this._dataGrid.scrollContainer];} _sortDataGrid() {if(!this._heapSnapshotDataGridTree) return;this._heapSnapshotDataGridTree.sortComparator=WebInspector.HeapSnapshotDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier,this._dataGrid.sortOrder);this._dataGrid.removeChildren();for(let child of this._heapSnapshotDataGridTree.children) this._dataGrid.appendChild(child);} _heapSnapshotDataGridTreeDidPopulate() {this._dataGrid.removeChildren();for(let child of this._heapSnapshotDataGridTree.children) this._dataGrid.appendChild(child);}};WebInspector.HeapSnapshotInstancesContentView=class HeapSnapshotInstancesContentView extends WebInspector.HeapSnapshotContentView {constructor(representedObject) {let columns={retainedSize:{title:WebInspector.UIString("Retained Size"),tooltip:WebInspector.UIString("Size of current object plus all objects it keeps alive"),width:"140px",aligned:"right",sortable:true,},size:{title:WebInspector.UIString("Self Size"),width:"90px",aligned:"right",sortable:true,},count:{title:WebInspector.UIString("Count"),width:"75px",aligned:"right",sortable:true,},className:{title:WebInspector.UIString("Name"),sortable:true,disclosure:true,}};super(representedObject,"heap-snapshot-instances-content-view",columns,WebInspector.HeapSnapshotInstancesDataGridTree);}};WebInspector.HeapSnapshotObjectGraphContentView=class HeapSnapshotObjectGraphContentView extends WebInspector.HeapSnapshotContentView {constructor(representedObject) {let columns={retainedSize:{title:WebInspector.UIString("Retained Size"),tooltip:WebInspector.UIString("Size of current object plus all objects it keeps alive"),width:"140px",aligned:"right",sortable:true,},size:{title:WebInspector.UIString("Self Size"),width:"90px",aligned:"right",sortable:true,},className:{title:WebInspector.UIString("Name"),sortable:true,disclosure:true,}};super(representedObject,"heap-snapshot-object-graph-content-view",columns,WebInspector.HeapSnapshotObjectGraphDataGridTree);}};WebInspector.HeapSnapshotDataGridTree=class HeapSnapshotDataGridTree extends WebInspector.Object {constructor(heapSnapshot,sortComparator) {super();this._heapSnapshot=heapSnapshot;this._heapSnapshot.addEventListener(WebInspector.HeapSnapshotProxy.Event.CollectedNodes,this._heapSnapshotCollectedNodes,this);this._children=[];this._sortComparator=sortComparator;this._visible=false;this._popover=null;this._popoverGridNode=null;this._popoverTargetElement=null;this.populateTopLevel();} static buildSortComparator(columnIdentifier,sortOrder) {let multiplier=sortOrder===WebInspector.DataGrid.SortOrder.Ascending?1:-1;let numberCompare=(columnIdentifier,a,b)=>multiplier*(a.data[columnIdentifier]-b.data[columnIdentifier]);let nameCompare=(a,b)=>{if(a.propertyName||b.propertyName){if(a.propertyName&&!b.propertyName) return multiplier*-1;if(!a.propertyName&&b.propertyName) return multiplier*1;let propertyNameCompare=a.propertyName.extendedLocaleCompare(b.propertyName);return multiplier*propertyNameCompare;} let classNameCompare=a.data.className.extendedLocaleCompare(b.data.className);if(classNameCompare) return multiplier*classNameCompare;if(a.data.id||b.data.id) return multiplier*(a.data.id-b.data.id);return 0;};switch(columnIdentifier){case"retainedSize":return numberCompare.bind(this,"retainedSize");case"size":return numberCompare.bind(this,"size");case"count":return numberCompare.bind(this,"count");case"className":return nameCompare;}} get heapSnapshot(){return this._heapSnapshot;} get visible(){return this._visible;} get popoverGridNode(){return this._popoverGridNode;} set popoverGridNode(x){this._popoverGridNode=x;} get popoverTargetElement(){return this._popoverTargetElement;} set popoverTargetElement(x){this._popoverTargetElement=x;} get popover() {if(!this._popover){this._popover=new WebInspector.Popover(this);this._popover.windowResizeHandler=()=>{let bounds=WebInspector.Rect.rectFromClientRect(this._popoverTargetElement.getBoundingClientRect());this._popover.present(bounds.pad(2),[WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MIN_Y,WebInspector.RectEdge.MAX_X]);};} return this._popover;} get children() {return this._children;} appendChild(node) {this._children.push(node);} insertChild(node,index) {this._children.splice(index,0,node);} removeChild(node) {this._children.remove(node,true);} removeChildren() {this._children=[];} set sortComparator(comparator) {this._sortComparator=comparator;this.sort();} sort() {let children=this._children;children.sort(this._sortComparator);for(let i=0;i{for(let instance of instances) this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance,this));});this.heapSnapshot.instancesWithClassName("Window",(instances)=>{for(let instance of instances){ if(instance.dominatorNodeIdentifier===0) this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance,this));} this.didPopulate();});}};WebInspector.HeapSnapshotInstanceDataGridNode=class HeapSnapshotInstanceDataGridNode extends WebInspector.DataGridNode {constructor(node,tree,edge,base) {let hasChildren=node.hasChildren&&node.className!=="string";super(node,hasChildren);this._node=node;this._tree=tree;this._edge=edge||null;this._base=base||null;this.copyable=false;if(hasChildren) this.addEventListener("populate",this._populate,this);} static logHeapSnapshotNode(node) {let heapObjectIdentifier=node.id;let shouldRevealConsole=true;let text=WebInspector.UIString("Heap Snapshot Object (%s)").format("@"+heapObjectIdentifier);node.shortestGCRootPath((gcRootPath)=>{if(gcRootPath.length){gcRootPath=gcRootPath.slice().reverse();let windowIndex=gcRootPath.findIndex((x)=>{return x instanceof WebInspector.HeapSnapshotNodeProxy&&x.className==="Window";});let heapSnapshotRootPath=WebInspector.HeapSnapshotRootPath.emptyPath();for(let i=windowIndex===-1?0:windowIndex;i{for(let i=0;i{let fakeDataGridNodeA={data:a,propertyName:propertyName(a.__edge)};let fakeDataGridNodeB={data:b,propertyName:propertyName(b.__edge)};return this._tree._sortComparator(fakeDataGridNodeA,fakeDataGridNodeB);});for(let instance of instances){if(instance.__edge&&instance.__edge.isPrivateSymbol()) continue;this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance,this._tree,instance.__edge,this._base||this));}});} _contextMenuHandler(event) {let contextMenu=WebInspector.ContextMenu.createFromEvent(event);contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Log Value"),WebInspector.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null,this._node));} _populateError(containerElement) {if(this._node.internal) return;let previewErrorElement=containerElement.appendChild(document.createElement("span"));previewErrorElement.classList.add("preview-error");previewErrorElement.textContent=WebInspector.UIString("No preview available");} _populateWindowPreview(containerElement) {HeapAgent.getRemoteObject(this._node.id,(error,remoteObjectPayload)=>{if(error){this._populateError(containerElement);return;} function inspectedPage_window_getLocationHref(){return this.location.href;} let remoteObject=WebInspector.RemoteObject.fromPayload(remoteObjectPayload,WebInspector.assumingMainTarget());remoteObject.callFunctionJSON(inspectedPage_window_getLocationHref,undefined,(href)=>{remoteObject.release();if(!href) this._populateError(containerElement);else{let primitiveRemoteObject=WebInspector.RemoteObject.fromPrimitiveValue(href);containerElement.appendChild(WebInspector.FormattedValue.createElementForRemoteObject(primitiveRemoteObject));}});});} _populatePreview(containerElement) {HeapAgent.getPreview(this._node.id,(error,string,functionDetails,objectPreviewPayload)=>{if(error){this._populateError(containerElement);return;} if(string){let primitiveRemoteObject=WebInspector.RemoteObject.fromPrimitiveValue(string);containerElement.appendChild(WebInspector.FormattedValue.createElementForRemoteObject(primitiveRemoteObject));return;} if(functionDetails){let{location,name,displayName}=functionDetails;let functionNameElement=containerElement.appendChild(document.createElement("span"));functionNameElement.classList.add("function-name");functionNameElement.textContent=name||displayName||WebInspector.UIString("(anonymous function)");let sourceCode=WebInspector.debuggerManager.scriptForIdentifier(location.scriptId,WebInspector.assumingMainTarget());if(sourceCode){let locationElement=containerElement.appendChild(document.createElement("span"));locationElement.classList.add("location");let sourceCodeLocation=sourceCode.createSourceCodeLocation(location.lineNumber,location.columnNumber);sourceCodeLocation.populateLiveDisplayLocationString(locationElement,"textContent",WebInspector.SourceCodeLocation.ColumnStyle.Hidden,WebInspector.SourceCodeLocation.NameStyle.Short);const options={dontFloat:true,useGoToArrowButton:true,ignoreNetworkTab:true,ignoreSearchTab:true,};let goToArrowButtonLink=WebInspector.createSourceCodeLocationLink(sourceCodeLocation,options);containerElement.appendChild(goToArrowButtonLink);} return;} if(objectPreviewPayload){let objectPreview=WebInspector.ObjectPreview.fromPayload(objectPreviewPayload);let previewElement=WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForObjectPreview(objectPreview);containerElement.appendChild(previewElement);return;}});} _mouseoverHandler(event) {let targetFrame=WebInspector.Rect.rectFromClientRect(event.target.getBoundingClientRect());if(!targetFrame.size.width&&!targetFrame.size.height) return;if(this._tree.popoverGridNode===this._node) return;this._tree.popoverGridNode=this._node;this._tree.popoverTargetElement=event.target;let popoverContentElement=document.createElement("div");popoverContentElement.classList.add("heap-snapshot","heap-snapshot-instance-popover-content");function appendTitle(node){let idElement=document.createElement("span");idElement.classList.add("object-id");idElement.textContent="@"+node.id;idElement.addEventListener("click",WebInspector.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null,node));let title=popoverContentElement.appendChild(document.createElement("div"));title.classList.add("title");let localizedString=WebInspector.UIString("Shortest property path to %s").format("@@@");let[before,after]=localizedString.split(/\s*@@@\s*/);title.append(before+" ",idElement," "+after);} function appendPath(path){let tableContainer=popoverContentElement.appendChild(document.createElement("div"));tableContainer.classList.add("table-container");let tableElement=tableContainer.appendChild(document.createElement("table"));path=path.slice().reverse();let windowIndex=path.findIndex((x)=>{return x instanceof WebInspector.HeapSnapshotNodeProxy&&x.className==="Window";});let edge=null;for(let i=windowIndex===-1?0:windowIndex;i10) pathDataElement.title=pathDataElement.textContent;let objectDataElement=tableRow.appendChild(document.createElement("td"));objectDataElement.classList.add("object-data");let containerElement=objectDataElement.appendChild(document.createElement("div"));containerElement.classList.add("node");let iconElement=containerElement.appendChild(document.createElement("img"));iconElement.classList.add("icon",WebInspector.HeapSnapshotClusterContentView.iconStyleClassNameForClassName(node.className,node.internal));let classNameElement=containerElement.appendChild(document.createElement("span"));classNameElement.textContent=sanitizeClassName(node.className)+" ";let idElement=containerElement.appendChild(document.createElement("span"));idElement.classList.add("object-id");idElement.textContent="@"+node.id;idElement.addEventListener("click",WebInspector.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null,node));if(node.className==="Function"){let goToArrowPlaceHolderElement=containerElement.appendChild(document.createElement("span"));goToArrowPlaceHolderElement.style.display="inline-block";goToArrowPlaceHolderElement.style.width="10px";HeapAgent.getPreview(node.id,function(error,string,functionDetails,objectPreviewPayload){if(functionDetails){let location=functionDetails.location;let sourceCode=WebInspector.debuggerManager.scriptForIdentifier(location.scriptId,WebInspector.assumingMainTarget());if(sourceCode){let sourceCodeLocation=sourceCode.createSourceCodeLocation(location.lineNumber,location.columnNumber);const options={dontFloat:true,useGoToArrowButton:true,ignoreNetworkTab:true,ignoreSearchTab:true,};let goToArrowButtonLink=WebInspector.createSourceCodeLocationLink(sourceCodeLocation,options);containerElement.replaceChild(goToArrowButtonLink,goToArrowPlaceHolderElement);}}});}} function sanitizeClassName(className){if(className.endsWith("LexicalEnvironment")) return WebInspector.UIString("Scope");return className;} function stringifyEdge(edge){switch(edge.type){case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Property:case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Variable:if(/^(?![0-9])\w+$/.test(edge.data)) return edge.data;return"["+doubleQuotedString(edge.data)+"]";case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Index:return"["+edge.data+"]";case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Internal:default:return null;}} this._node.shortestGCRootPath((path)=>{if(!this._tree.visible) return;if(path.length){appendTitle(this._node);appendPath(path);}else if(this._node.gcRoot){let textElement=popoverContentElement.appendChild(document.createElement("div"));textElement.textContent=WebInspector.UIString("This object is a root");}else{let emptyElement=popoverContentElement.appendChild(document.createElement("div"));emptyElement.textContent=WebInspector.UIString("This object is referenced by internal objects");} this._tree.popover.presentNewContentWithFrame(popoverContentElement,targetFrame.pad(2),[WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MIN_Y,WebInspector.RectEdge.MAX_X]);});}};WebInspector.HeapSnapshotInstanceFetchMoreDataGridNode=class HeapSnapshotInstanceFetchMoreDataGridNode extends WebInspector.DataGridNode {constructor(tree,batchCount,remainingCount,fetchCallback) {super({},false);this._tree=tree;this._batchCount=batchCount;this._remainingCount=remainingCount;this._fetchCallback=fetchCallback;} createCellContent(columnIdentifier) {if(columnIdentifier!=="className") return"";let fragment=document.createDocumentFragment();if(this._batchCount){let buttonElement=fragment.appendChild(document.createElement("span"));buttonElement.classList.add("more");buttonElement.textContent=WebInspector.UIString("Show %d More").format(this._batchCount);buttonElement.addEventListener("click",(event)=>{this._fetchCallback(this._batchCount);});} let buttonElement=fragment.appendChild(document.createElement("span"));buttonElement.classList.add("more");buttonElement.textContent=WebInspector.UIString("Show Remaining (%d)").format(this._remainingCount);buttonElement.addEventListener("click",(event)=>{this._fetchCallback(this._remainingCount);});return fragment;} sort() {}};WebInspector.HierarchicalPathNavigationItem=class HierarchicalPathNavigationItem extends WebInspector.NavigationItem {constructor(identifier,components) {super(identifier);this.components=components;} get components() {return this._components;} set components(newComponents) {if(!newComponents) newComponents=[];let componentsEqual=function(a,b){let getRepresentedObjects=(component)=>component.representedObject;let representedObjectsA=a.map(getRepresentedObjects);let representedObjectsB=b.map(getRepresentedObjects);if(!Array.shallowEqual(representedObjectsA,representedObjectsB)) return false;let getExtraComparisonData=(component)=>component.comparisonData;let extraComparisonDataA=a.map(getExtraComparisonData);let extraComparisonDataB=b.map(getExtraComparisonData);return Array.shallowEqual(extraComparisonDataA,extraComparisonDataB);};if(this._components&&componentsEqual(this._components,newComponents)) return;for(var i=0;this._components&&i>1;var distance=-1;var i=middle;this._collapsedComponent=new WebInspector.HierarchicalPathComponent(ellipsis,[]);this._collapsedComponent.collapsed=true;this.element.insertBefore(this._collapsedComponent.element,this._components[middle].element);widthToRemove+=this._collapsedComponent.minimumWidth;var hiddenDisplayNames=[];while(i>=0&&i<=this._components.length-1){if(i>0&&i0) hiddenDisplayNames.unshift(component.displayName);else hiddenDisplayNames.push(component.displayName);widthToRemove-=componentWidths[i];if(widthToRemove<=0) break;} i=middle+distance;if(distance>0) ++distance;distance*=-1;} this._collapsedComponent.element.title=hiddenDisplayNames.join("\n");} get additionalClassNames() {return["hierarchical-path"];} _siblingPathComponentWasSelected(event) {this.dispatchEventToListeners(WebInspector.HierarchicalPathNavigationItem.Event.PathComponentWasSelected,event.data);}};WebInspector.HierarchicalPathNavigationItem.AlwaysShowLastPathComponentSeparatorStyleClassName="always-show-last-path-component-separator";WebInspector.HierarchicalPathNavigationItem.Event={PathComponentWasSelected:"hierarchical-path-navigation-item-path-component-was-selected"};WebInspector.HoverMenu=class HoverMenu extends WebInspector.Object {constructor(delegate) {super();this.delegate=delegate;this._element=document.createElement("div");this._element.className="hover-menu";this._element.addEventListener("transitionend",this,true);this._outlineElement=this._element.appendChild(document.createElementNS("http://www.w3.org/2000/svg","svg"));this._button=this._element.appendChild(document.createElement("img"));this._button.addEventListener("click",this);} get element() {return this._element;} present(rects) {this._outlineElement.textContent="";document.body.appendChild(this._element);this._drawOutline(rects);this._element.classList.add(WebInspector.HoverMenu.VisibleClassName);window.addEventListener("scroll",this,true);} dismiss(discrete) {if(this._element.parentNode!==document.body) return;if(discrete) this._element.remove();this._element.classList.remove(WebInspector.HoverMenu.VisibleClassName);window.removeEventListener("scroll",this,true);} handleEvent(event) {switch(event.type){case"scroll":if(!this._element.contains(event.target)) this.dismiss(true);break;case"click":this._handleClickEvent(event);break;case"transitionend":if(!this._element.classList.contains(WebInspector.HoverMenu.VisibleClassName)) this._element.remove();break;}} _handleClickEvent(event) {if(this.delegate&&typeof this.delegate.hoverMenuButtonWasPressed==="function") this.delegate.hoverMenuButtonWasPressed(this);} _drawOutline(rects) {var buttonWidth=this._button.width;var buttonHeight=this._button.height;var lastRect=rects.pop();lastRect.size.width+=buttonWidth;rects.push(lastRect);if(rects.length===1) this._drawSingleLine(rects[0]);else if(rects.length===2&&rects[0].minX()>=rects[1].maxX()) this._drawTwoNonOverlappingLines(rects);else this._drawOverlappingLines(rects);var bounds=WebInspector.Rect.unionOfRects(rects).pad(3); var style=this._element.style;style.left=bounds.minX()+"px";style.top=bounds.minY()+"px";style.width=bounds.size.width+"px";style.height=bounds.size.height+"px";this._outlineElement.style.width=bounds.size.width+"px";this._outlineElement.style.height=bounds.size.height+"px";this._button.style.left=(lastRect.maxX()-bounds.minX()-buttonWidth)+"px";this._button.style.top=(lastRect.maxY()-bounds.minY()-buttonHeight)+"px";} _addRect(rect) {var r=4;var svgRect=document.createElementNS("http://www.w3.org/2000/svg","rect");svgRect.setAttribute("x",1);svgRect.setAttribute("y",1);svgRect.setAttribute("width",rect.size.width);svgRect.setAttribute("height",rect.size.height);svgRect.setAttribute("rx",r);svgRect.setAttribute("ry",r);return this._outlineElement.appendChild(svgRect);} _addPath(commands,tx,ty) {var path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("d",commands.join(" "));path.setAttribute("transform","translate("+(tx+1)+","+(ty+1)+")");return this._outlineElement.appendChild(path);} _drawSingleLine(rect) {this._addRect(rect.pad(2));} _drawTwoNonOverlappingLines(rects) {var r=4;var firstRect=rects[0].pad(2);var secondRect=rects[1].pad(2);var tx=-secondRect.minX();var ty=-firstRect.minY();var rect=firstRect;this._addPath(["M",rect.maxX(),rect.minY(),"H",rect.minX()+r,"q",-r,0,-r,r,"V",rect.maxY()-r,"q",0,r,r,r,"H",rect.maxX()],tx,ty);rect=secondRect;this._addPath(["M",rect.minX(),rect.minY(),"H",rect.maxX()-r,"q",r,0,r,r,"V",rect.maxY()-r,"q",0,r,-r,r,"H",rect.minX()],tx,ty);} _drawOverlappingLines(rects) {var PADDING=2;var r=4;var minX=Number.MAX_VALUE;var maxX=-Number.MAX_VALUE;for(var rect of rects){var minX=Math.min(rect.minX(),minX);var maxX=Math.max(rect.maxX(),maxX);} minX-=PADDING;maxX+=PADDING;var minY=rects[0].minY()-PADDING;var maxY=rects.lastValue.maxY()+PADDING;var firstLineMinX=rects[0].minX()-PADDING;var lastLineMaxX=rects.lastValue.maxX()+PADDING;if(firstLineMinX===minX&&lastLineMaxX===maxX) return this._addRect(new WebInspector.Rect(minX,minY,maxX-minX,maxY-minY));var lastLineMinY=rects.lastValue.minY()+PADDING;if(rects[0].minX()===minX+PADDING){return this._addPath(["M",minX+r,minY,"H",maxX-r,"q",r,0,r,r,"V",lastLineMinY-r,"q",0,r,-r,r,"H",lastLineMaxX+r,"q",-r,0,-r,r,"V",maxY-r,"q",0,r,-r,r,"H",minX+r,"q",-r,0,-r,-r,"V",minY+r,"q",0,-r,r,-r],-minX,-minY);} var firstLineMaxY=rects[0].maxY()-PADDING;if(rects.lastValue.maxX()===maxX-PADDING){return this._addPath(["M",firstLineMinX+r,minY,"H",maxX-r,"q",r,0,r,r,"V",maxY-r,"q",0,r,-r,r,"H",minX+r,"q",-r,0,-r,-r,"V",firstLineMaxY+r,"q",0,-r,r,-r,"H",firstLineMinX-r,"q",r,0,r,-r,"V",minY+r,"q",0,-r,r,-r],-minX,-minY);} return this._addPath(["M",firstLineMinX+r,minY,"H",maxX-r,"q",r,0,r,r,"V",lastLineMinY-r,"q",0,r,-r,r,"H",lastLineMaxX+r,"q",-r,0,-r,r,"V",maxY-r,"q",0,r,-r,r,"H",minX+r,"q",-r,0,-r,-r,"V",firstLineMaxY+r,"q",0,-r,r,-r,"H",firstLineMinX-r,"q",r,0,r,-r,"V",minY+r,"q",0,-r,r,-r],-minX,-minY);}};WebInspector.HoverMenu.VisibleClassName="visible";WebInspector.IdleTreeElement=class IdleTreeElement extends WebInspector.GeneralTreeElement {constructor() {super("idle",WebInspector.UIString("Idle"));}};WebInspector.ImageResourceContentView=class ImageResourceContentView extends WebInspector.ResourceContentView {constructor(resource) {super(resource,"image");this._imageElement=null;const toolTip=WebInspector.UIString("Show Grid");const activatedToolTip=WebInspector.UIString("Hide Grid");this._showGridButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("show-grid",toolTip,activatedToolTip,"Images/NavigationItemCheckers.svg",13,13);this._showGridButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._showGridButtonClicked,this);this._showGridButtonNavigationItem.activated=!!WebInspector.settings.showImageGrid.value;} get navigationItems() {return[this._showGridButtonNavigationItem];} contentAvailable(content,base64Encoded) {let objectURL=this.resource.createObjectURL();if(!objectURL){this.showGenericErrorMessage();return;} this.removeLoadingIndicator();this._imageElement=document.createElement("img");this._imageElement.addEventListener("load",function(){URL.revokeObjectURL(objectURL);});this._imageElement.src=objectURL;this._imageElement.setAttribute("filename",this.resource.urlComponents.lastPathComponent||"");this._updateImageGrid();this.element.appendChild(this._imageElement);} shown() {super.shown();this._updateImageGrid();WebInspector.settings.showImageGrid.addEventListener(WebInspector.Setting.Event.Changed,this._updateImageGrid,this);} hidden() {WebInspector.settings.showImageGrid.removeEventListener(WebInspector.Setting.Event.Changed,this._updateImageGrid,this);super.hidden();} _updateImageGrid() {if(!this._imageElement) return;let activated=WebInspector.settings.showImageGrid.value;this._showGridButtonNavigationItem.activated=activated;this._imageElement.classList.toggle("show-grid",activated);} _showGridButtonClicked(event) {WebInspector.settings.showImageGrid.value=!this._showGridButtonNavigationItem.activated;this._updateImageGrid();}};WebInspector.IndeterminateProgressSpinner=class IndeterminateProgressSpinner extends WebInspector.Object {constructor() {super();this._element=document.createElement("div");this._element.classList.add("indeterminate-progress-spinner");} get element() {return this._element;}};WebInspector.IndexedDatabaseContentView=class IndexedDatabaseContentView extends WebInspector.ContentView {constructor(database) {super(database);this._element.classList.add("indexed-database");this._databaseHostRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Host"));this._databaseSecurityOriginRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Security Origin"));this._databaseVersionRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Version"));this._databaseGroup=new WebInspector.DetailsSectionGroup([this._databaseHostRow,this._databaseSecurityOriginRow,this._databaseVersionRow]);this._databaseSection=new WebInspector.DetailsSection("indexed-database-details",WebInspector.UIString("Database"),[this._databaseGroup]);this.element.append(this._databaseSection.element);this._databaseHostRow.value=database.host;this._databaseSecurityOriginRow.value=database.securityOrigin;this._databaseVersionRow.value=database.version.toLocaleString();}};WebInspector.IndexedDatabaseDetailsSidebarPanel=class IndexedDatabaseDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel {constructor() {super("indexed-database-details",WebInspector.UIString("Storage"));this.element.classList.add("indexed-database");this._database=null;this._objectStore=null;this._index=null;} inspect(objects) {if(!(objects instanceof Array)) objects=[objects];this._database=null;this._objectStore=null;this._index=null;for(let object of objects){if(object instanceof WebInspector.IndexedDatabaseObjectStore){this._objectStore=object;this._database=this._objectStore.parentDatabase;}else if(object instanceof WebInspector.IndexedDatabaseObjectStoreIndex){this._index=object;this._objectStore=this._index.parentObjectStore;this._database=this._objectStore.parentDatabase;}} let hasObject=this._database||this._objectStore||this._index;if(hasObject) this.needsLayout();return hasObject;} initialLayout() {super.initialLayout();this._databaseNameRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));this._databaseVersionRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Version"));this._databaseSecurityOriginRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Security Origin"));let databaseGroup=new WebInspector.DetailsSectionGroup([this._databaseNameRow,this._databaseVersionRow,this._databaseSecurityOriginRow]);this._databaseSection=new WebInspector.DetailsSection("indexed-database-database",WebInspector.UIString("Database"),[databaseGroup]);this._objectStoreNameRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));this._objectStoreKeyPathRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Key Path"));this._objectStoreAutoIncrementRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Auto Increment"));let objectStoreGroup=new WebInspector.DetailsSectionGroup([this._objectStoreNameRow,this._objectStoreKeyPathRow,this._objectStoreAutoIncrementRow]);this._objectStoreSection=new WebInspector.DetailsSection("indexed-database-object-store",WebInspector.UIString("Object Store"),[objectStoreGroup]);this._indexNameRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));this._indexKeyPathRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Key Path"));this._indexUniqueRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Unique"));this._indexMultiEntryRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Multi-Entry"));let indexGroup=new WebInspector.DetailsSectionGroup([this._indexNameRow,this._indexKeyPathRow,this._indexUniqueRow,this._indexMultiEntryRow]);this._indexSection=new WebInspector.DetailsSection("indexed-database-index",WebInspector.UIString("Index"),[indexGroup]);this.contentView.element.appendChild(this._databaseSection.element);this.contentView.element.appendChild(this._objectStoreSection.element);this.contentView.element.appendChild(this._indexSection.element);} layout() {super.layout();if(!this._database) this._databaseSection.element.hidden=true;else{this._databaseSection.element.hidden=false;this._databaseSecurityOriginRow.value=this._database.securityOrigin;this._databaseNameRow.value=this._database.name;this._databaseVersionRow.value=this._database.version.toLocaleString();} if(!this._objectStore) this._objectStoreSection.element.hidden=true;else{this._objectStoreSection.element.hidden=false;this._objectStoreNameRow.value=this._objectStore.name;this._objectStoreKeyPathRow.value=this._keyPathString(this._objectStore.keyPath);this._objectStoreAutoIncrementRow.value=this._objectStore.autoIncrement?WebInspector.UIString("Yes"):WebInspector.UIString("No");} if(!this._index) this._indexSection.element.hidden=true;else{this._indexSection.element.hidden=false;this._indexNameRow.value=this._index.name;this._indexKeyPathRow.value=this._keyPathString(this._index.keyPath);this._indexUniqueRow.value=this._index.unique?WebInspector.UIString("Yes"):WebInspector.UIString("No");if(this._index.keyPath.type!==IndexedDBAgent.KeyPathType.Array) this._indexMultiEntryRow.value=null;else this._indexMultiEntryRow.value=this._index.multiEntry?WebInspector.UIString("Yes"):WebInspector.UIString("No");}} _keyPathString(keyPath) {return keyPath?JSON.stringify(keyPath):emDash;}};WebInspector.IndexedDatabaseEntryDataGridNode=class IndexedDatabaseEntryDataGridNode extends WebInspector.DataGridNode {constructor(entry) {super(entry);this._entry=entry;} get entry() {return this._entry;} createCellContent(columnIdentifier,cell) {var value=this._entry[columnIdentifier];if(value instanceof WebInspector.RemoteObject) return WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(value,null,true);return super.createCellContent(columnIdentifier,cell);}};WebInspector.IndexedDatabaseHostTreeElement=class IndexedDatabaseHostTreeElement extends WebInspector.StorageTreeElement {constructor(host) {super(WebInspector.FolderTreeElement.FolderIconStyleClassName,WebInspector.displayNameForHost(host),null);this._host=host;this.hasChildren=true;this.expanded=true;} get name() {return WebInspector.displayNameForHost(this._host);} get categoryName() {return WebInspector.UIString("Indexed Databases");}};WebInspector.IndexedDatabaseObjectStoreContentView=class IndexedDatabaseObjectStoreContentView extends WebInspector.ContentView {constructor(objectStoreOrIndex) {super(objectStoreOrIndex);this.element.classList.add("indexed-database-object-store");if(objectStoreOrIndex instanceof WebInspector.IndexedDatabaseObjectStore){this._objectStore=objectStoreOrIndex;this._objectStoreIndex=null;}else if(objectStoreOrIndex instanceof WebInspector.IndexedDatabaseObjectStoreIndex){this._objectStore=objectStoreOrIndex.parentObjectStore;this._objectStoreIndex=objectStoreOrIndex;} function displayKeyPath(keyPath) {if(!keyPath) return"";if(keyPath instanceof Array) return keyPath.join(WebInspector.UIString(", "));return keyPath;} var displayPrimaryKeyPath=displayKeyPath(this._objectStore.keyPath);var columnInfo={primaryKey:{title:displayPrimaryKeyPath?WebInspector.UIString("Primary Key \u2014 %s").format(displayPrimaryKeyPath):WebInspector.UIString("Primary Key")},key:{},value:{title:WebInspector.UIString("Value")}};if(this._objectStoreIndex){var displayIndexKeyPath=displayKeyPath(this._objectStoreIndex.keyPath);columnInfo.key.title=WebInspector.UIString("Index Key \u2014 %s").format(displayIndexKeyPath);}else{ delete columnInfo.key;} this._dataGrid=new WebInspector.DataGrid(columnInfo);this._dataGrid.variableHeightRows=true;this._dataGrid.scrollContainer.addEventListener("scroll",this._dataGridScrolled.bind(this));this.addSubview(this._dataGrid);this._entries=[];this._fetchingMoreData=false;this._fetchMoreData();this._refreshButtonNavigationItem=new WebInspector.ButtonNavigationItem("indexed-database-object-store-refresh",WebInspector.UIString("Refresh"),"Images/ReloadFull.svg",13,13);this._refreshButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._refreshButtonClicked,this);this._clearButtonNavigationItem=new WebInspector.ButtonNavigationItem("indexed-database-object-store-clear",WebInspector.UIString("Clear object store"),"Images/NavigationItemTrash.svg",15,15);this._clearButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._clearButtonClicked,this);} get navigationItems() {return[this._refreshButtonNavigationItem,this._clearButtonNavigationItem];} closed() {super.closed();this._reset();} saveToCookie(cookie) {cookie.type=WebInspector.ContentViewCookieType.IndexedDatabaseObjectStore;cookie.securityOrigin=this._objectStore.parentDatabase.securityOrigin;cookie.databaseName=this._objectStore.parentDatabase.name;cookie.objectStoreName=this._objectStore.name;cookie.objectStoreIndexName=this._objectStoreIndex&&this._objectStoreIndex.name;} get scrollableElements() {return[this._dataGrid.scrollContainer];} _reset() {for(var entry of this._entries){entry.primaryKey.release();entry.key.release();entry.value.release();} this._entries=[];this._dataGrid.removeChildren();} _dataGridScrolled() {if(!this._moreEntriesAvailable||!this._dataGrid.isScrolledToLastRow()) return;this._fetchMoreData();} _fetchMoreData() {if(this._fetchingMoreData) return;function processEntries(entries,moreAvailable) {this._entries=this._entries.concat(entries);this._moreEntriesAvailable=moreAvailable;for(var entry of entries){var dataGridNode=new WebInspector.IndexedDatabaseEntryDataGridNode(entry);this._dataGrid.appendChild(dataGridNode);} this._fetchingMoreData=false;if(moreAvailable&&this._dataGrid.isScrolledToLastRow()) this._fetchMoreData();} this._fetchingMoreData=true;WebInspector.storageManager.requestIndexedDatabaseData(this._objectStore,this._objectStoreIndex,this._entries.length,25,processEntries.bind(this));} _refreshButtonClicked() {this._reset();this._fetchMoreData();} _clearButtonClicked() {WebInspector.storageManager.clearObjectStore(this._objectStore);this._reset();}};WebInspector.IndexedDatabaseObjectStoreIndexTreeElement=class IndexedDatabaseObjectStoreIndexTreeElement extends WebInspector.GeneralTreeElement {constructor(objectStoreIndex) {super("database-table-icon",objectStoreIndex.name,null,objectStoreIndex,false);this._objectStoreIndex=objectStoreIndex;} get objectStoreIndex() {return this._objectStoreIndex;}};WebInspector.IndexedDatabaseObjectStoreTreeElement=class IndexedDatabaseObjectStoreTreeElement extends WebInspector.GeneralTreeElement {constructor(objectStore) {super("database-table-icon",objectStore.name,null,objectStore,!!objectStore.indexes.length);this._objectStore=objectStore;} get objectStore() {return this._objectStore;} oncollapse() {this.shouldRefreshChildren=true;} onpopulate() {if(this.children.length&&!this.shouldRefreshChildren) return;this.shouldRefreshChildren=false;this.removeChildren();for(var objectStoreIndex of this._objectStore.indexes) this.appendChild(new WebInspector.IndexedDatabaseObjectStoreIndexTreeElement(objectStoreIndex));}};WebInspector.IndexedDatabaseTreeElement=class IndexedDatabaseTreeElement extends WebInspector.GeneralTreeElement {constructor(indexedDatabase) {super("database-icon",indexedDatabase.name,null,indexedDatabase,!!indexedDatabase.objectStores.length);this._indexedDatabase=indexedDatabase;} get indexedDatabase() {return this._indexedDatabase;} oncollapse() {this.shouldRefreshChildren=true;} onpopulate() {if(this.children.length&&!this.shouldRefreshChildren) return;this.shouldRefreshChildren=false;this.removeChildren();for(var objectStore of this._indexedDatabase.objectStores) this.appendChild(new WebInspector.IndexedDatabaseObjectStoreTreeElement(objectStore));}};WebInspector.InlineSwatch=class InlineSwatch extends WebInspector.Object {constructor(type,value,readOnly) {super();this._type=type;this._swatchElement=document.createElement("span");this._swatchElement.classList.add("inline-swatch",this._type.split("-").lastValue);switch(this._type){case WebInspector.InlineSwatch.Type.Color:this._swatchElement.title=WebInspector.UIString("Click to select a color. Shift-click to switch color formats.");break;case WebInspector.InlineSwatch.Type.Gradient:this._swatchElement.title=WebInspector.UIString("Edit custom gradient");break;case WebInspector.InlineSwatch.Type.Bezier:this._swatchElement.title=WebInspector.UIString("Edit “cubic-bezier“ function");break;case WebInspector.InlineSwatch.Type.Spring:this._swatchElement.title=WebInspector.UIString("Edit “spring“ function");break;case WebInspector.InlineSwatch.Type.Variable:this._swatchElement.title=WebInspector.UIString("View variable value");break;default:WebInspector.reportInternalError(`Unknown InlineSwatch type "${type}"`);break;} this._boundSwatchElementClicked=null;if(!readOnly){this._boundSwatchElementClicked=this._swatchElementClicked.bind(this);this._swatchElement.addEventListener("click",this._boundSwatchElementClicked);if(this._type===WebInspector.InlineSwatch.Type.Color) this._swatchElement.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this));} this._swatchInnerElement=this._swatchElement.createChild("span");this._value=value||this._fallbackValue();this._valueEditor=null;this._updateSwatch();} get element() {return this._swatchElement;} get value() {return this._value;} set value(value) {this._value=value;this._updateSwatch(true);} didDismissPopover(popover) {if(!this._valueEditor) return;if(typeof this._valueEditor.removeListeners==="function") this._valueEditor.removeListeners();if(this._boundSwatchElementClicked) this._swatchElement.addEventListener("click",this._boundSwatchElementClicked);this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.Deactivated);} _fallbackValue() {switch(this._type){case WebInspector.InlineSwatch.Type.Bezier:return WebInspector.CubicBezier.fromString("linear");case WebInspector.InlineSwatch.Type.Gradient:return WebInspector.Gradient.fromString("linear-gradient(transparent, transparent)");case WebInspector.InlineSwatch.Type.Spring:return WebInspector.Spring.fromString("1 100 10 0");case WebInspector.InlineSwatch.Type.Color:return WebInspector.Color.fromString("white");default:return null;}} _updateSwatch(dontFireEvents) {if(this._type===WebInspector.InlineSwatch.Type.Color||this._type===WebInspector.InlineSwatch.Type.Gradient) this._swatchInnerElement.style.background=this._value?this._value.toString():null;if(!dontFireEvents) this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.ValueChanged,{value:this._value});} _swatchElementClicked(event) {this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.BeforeClicked);if(this._type===WebInspector.InlineSwatch.Type.Color&&event.shiftKey&&this._value){let nextFormat=this._value.nextFormat();if(!nextFormat) return;this._value.format=nextFormat;this._updateSwatch();return;} let bounds=WebInspector.Rect.rectFromClientRect(this._swatchElement.getBoundingClientRect());let popover=new WebInspector.Popover(this);popover.windowResizeHandler=()=>{let bounds=WebInspector.Rect.rectFromClientRect(this._swatchElement.getBoundingClientRect());popover.present(bounds.pad(2),[WebInspector.RectEdge.MIN_X]);};this._valueEditor=null;if(this._type===WebInspector.InlineSwatch.Type.Color){this._valueEditor=new WebInspector.ColorPicker;this._valueEditor.addEventListener(WebInspector.ColorPicker.Event.ColorChanged,this._valueEditorValueDidChange,this);this._valueEditor.addEventListener(WebInspector.ColorPicker.Event.FormatChanged,(event)=>popover.update());}else if(this._type===WebInspector.InlineSwatch.Type.Gradient){this._valueEditor=new WebInspector.GradientEditor;this._valueEditor.addEventListener(WebInspector.GradientEditor.Event.GradientChanged,this._valueEditorValueDidChange,this);this._valueEditor.addEventListener(WebInspector.GradientEditor.Event.ColorPickerToggled,(event)=>popover.update());}else if(this._type===WebInspector.InlineSwatch.Type.Bezier){this._valueEditor=new WebInspector.BezierEditor;this._valueEditor.addEventListener(WebInspector.BezierEditor.Event.BezierChanged,this._valueEditorValueDidChange,this);}else if(this._type===WebInspector.InlineSwatch.Type.Spring){this._valueEditor=new WebInspector.SpringEditor;this._valueEditor.addEventListener(WebInspector.SpringEditor.Event.SpringChanged,this._valueEditorValueDidChange,this);}else if(this._type===WebInspector.InlineSwatch.Type.Variable){this._valueEditor={};this._valueEditor.element=document.createElement("div");this._valueEditor.element.classList.add("inline-swatch-variable-popover");this._valueEditor.codeMirror=WebInspector.CodeMirrorEditor.create(this._valueEditor.element,{mode:"css",readOnly:"nocursor",});this._valueEditor.codeMirror.on("update",()=>{popover.update();});} if(!this._valueEditor) return;popover.content=this._valueEditor.element;popover.present(bounds.pad(2),[WebInspector.RectEdge.MIN_X]);if(this._boundSwatchElementClicked) this._swatchElement.removeEventListener("click",this._boundSwatchElementClicked);this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.Activated);let value=this._value||this._fallbackValue();if(this._type===WebInspector.InlineSwatch.Type.Color) this._valueEditor.color=value;else if(this._type===WebInspector.InlineSwatch.Type.Gradient) this._valueEditor.gradient=value;else if(this._type===WebInspector.InlineSwatch.Type.Bezier) this._valueEditor.bezier=value;else if(this._type===WebInspector.InlineSwatch.Type.Spring) this._valueEditor.spring=value;else if(this._type===WebInspector.InlineSwatch.Type.Variable) this._valueEditor.codeMirror.setValue(value);} _valueEditorValueDidChange(event) {if(this._type===WebInspector.InlineSwatch.Type.Color) this._value=event.data.color;else if(this._type===WebInspector.InlineSwatch.Type.Gradient) this._value=event.data.gradient;else if(this._type===WebInspector.InlineSwatch.Type.Bezier) this._value=event.data.bezier;else if(this._type===WebInspector.InlineSwatch.Type.Spring) this._value=event.data.spring;this._updateSwatch();} _handleContextMenuEvent(event) {if(!this._value) return;let contextMenu=WebInspector.ContextMenu.createFromEvent(event);if(this._value.isKeyword()&&this._value.format!==WebInspector.Color.Format.Keyword){contextMenu.appendItem(WebInspector.UIString("Format: Keyword"),()=>{this._value.format=WebInspector.Color.Format.Keyword;this._updateSwatch();});} let hexInfo=this._getNextValidHEXFormat();if(hexInfo){contextMenu.appendItem(hexInfo.title,()=>{this._value.format=hexInfo.format;this._updateSwatch();});} if(this._value.simple&&this._value.format!==WebInspector.Color.Format.HSL){contextMenu.appendItem(WebInspector.UIString("Format: HSL"),()=>{this._value.format=WebInspector.Color.Format.HSL;this._updateSwatch();});}else if(this._value.format!==WebInspector.Color.Format.HSLA){contextMenu.appendItem(WebInspector.UIString("Format: HSLA"),()=>{this._value.format=WebInspector.Color.Format.HSLA;this._updateSwatch();});} if(this._value.simple&&this._value.format!==WebInspector.Color.Format.RGB){contextMenu.appendItem(WebInspector.UIString("Format: RGB"),()=>{this._value.format=WebInspector.Color.Format.RGB;this._updateSwatch();});}else if(this._value.format!==WebInspector.Color.Format.RGBA){contextMenu.appendItem(WebInspector.UIString("Format: RGBA"),()=>{this._value.format=WebInspector.Color.Format.RGBA;this._updateSwatch();});}} _getNextValidHEXFormat() {if(this._type!==WebInspector.InlineSwatch.Type.Color) return false;function hexMatchesCurrentColor(hexInfo){let nextIsSimple=hexInfo.format===WebInspector.Color.Format.ShortHEX||hexInfo.format===WebInspector.Color.Format.HEX;if(nextIsSimple&&!this._value.simple) return false;let nextIsShort=hexInfo.format===WebInspector.Color.Format.ShortHEX||hexInfo.format===WebInspector.Color.Format.ShortHEXAlpha;if(nextIsShort&&!this._value.canBeSerializedAsShortHEX()) return false;return true;} const hexFormats=[{format:WebInspector.Color.Format.ShortHEX,title:WebInspector.UIString("Format: Short Hex")},{format:WebInspector.Color.Format.ShortHEXAlpha,title:WebInspector.UIString("Format: Short Hex with Alpha")},{format:WebInspector.Color.Format.HEX,title:WebInspector.UIString("Format: Hex")},{format:WebInspector.Color.Format.HEXAlpha,title:WebInspector.UIString("Format: Hex with Alpha")}];let currentColorIsHEX=hexFormats.some((info)=>info.format===this._value.format);for(let i=0;i{if(!isEnterKey(event)) return;this._result=WebInspector.InputPopover.Result.Committed;this._value=event.target.value;this.dismiss();});contentElement.appendChild(this._inputElement);this.content=contentElement;this._presentOverTargetElement();} _presentOverTargetElement() {if(!this._targetElement) return;let targetFrame=WebInspector.Rect.rectFromClientRect(this._targetElement.getBoundingClientRect());this.present(targetFrame,this._preferredEdges);this._inputElement.select();}};WebInspector.InputPopover.Result={None:Symbol("result-none"),Cancelled:Symbol("result-cancelled"),Committed:Symbol("result-committed"),};WebInspector.IssueTreeElement=class IssueTreeElement extends WebInspector.GeneralTreeElement {constructor(issueMessage) {var levelStyleClassName;switch(issueMessage.level){case"error":levelStyleClassName=WebInspector.IssueTreeElement.ErrorStyleClassName;break;case"warning":levelStyleClassName=WebInspector.IssueTreeElement.WarningStyleClassName;break;} super([WebInspector.IssueTreeElement.StyleClassName,levelStyleClassName],null,null,issueMessage,false);this._issueMessage=issueMessage;this._updateTitles();this._issueMessage.addEventListener(WebInspector.IssueMessage.Event.DisplayLocationDidChange,this._updateTitles,this);} get issueMessage() {return this._issueMessage;} _updateTitles() {var displayLineNumber=this._issueMessage.sourceCodeLocation.displayLineNumber;var displayColumnNumber=this._issueMessage.sourceCodeLocation.displayColumnNumber;var title;if(displayColumnNumber>0) title=WebInspector.UIString("Line %d:%d").format(displayLineNumber+1,displayColumnNumber+1);else title=WebInspector.UIString("Line %d").format(displayLineNumber+1);this.mainTitle=title+" "+this._issueMessage.text;}};WebInspector.IssueTreeElement.StyleClassName="issue";WebInspector.IssueTreeElement.ErrorStyleClassName="error";WebInspector.IssueTreeElement.WarningStyleClassName="warning";WebInspector.LayerTreeDataGridNode=class LayerTreeDataGridNode extends WebInspector.DataGridNode {constructor(layer) {super();this._outlets={};this.layer=layer;} createCells() {super.createCells();this._cellsWereCreated=true;} createCellContent(columnIdentifier,cell) {cell=columnIdentifier==="name"?this._makeNameCell():this._makeOutlet(columnIdentifier,document.createTextNode("–"));this._updateCell(columnIdentifier);return cell;} get layer() {return this._layer;} set layer(layer) {this._layer=layer;var domNode=WebInspector.domTreeManager.nodeForId(layer.nodeId);this.data={name:domNode?domNode.displayName:WebInspector.UIString("Unknown node"),paintCount:layer.paintCount||emDash,memory:Number.bytesToString(layer.memory||0)};} get data() {return this._data;} set data(data) {Object.keys(data).forEach(function(columnIdentifier){if(this._data[columnIdentifier]===data[columnIdentifier]) return;this._data[columnIdentifier]=data[columnIdentifier];if(this._cellsWereCreated) this._updateCell(columnIdentifier);},this);} _makeOutlet(name,element) {this._outlets[name]=element;return element;} _makeNameCell() {var fragment=document.createDocumentFragment();fragment.appendChild(document.createElement("img")).className="icon";var goToButton=this._makeOutlet("goToButton",fragment.appendChild(WebInspector.createGoToArrowButton()));goToButton.addEventListener("click",this._goToArrowWasClicked.bind(this),false);var label=this._makeOutlet("label",fragment.appendChild(document.createElement("span")));label.className="label";var nameLabel=this._makeOutlet("nameLabel",label.appendChild(document.createElement("span")));nameLabel.className="name";var pseudoLabel=this._makeOutlet("pseudoLabel",document.createElement("span"));pseudoLabel.className="pseudo-element";var reflectionLabel=this._makeOutlet("reflectionLabel",document.createElement("span"));reflectionLabel.className="reflection";reflectionLabel.textContent=" \u2014 "+WebInspector.UIString("Reflection");return fragment;} _updateCell(columnIdentifier) {var data=this._data[columnIdentifier];if(columnIdentifier==="name") this._updateNameCellData(data);else this._outlets[columnIdentifier].textContent=data;} _updateNameCellData(data) {var layer=this._layer;var label=this._outlets.label;this._outlets.nameLabel.textContent=data;if(WebInspector.domTreeManager.nodeForId(layer.nodeId)) label.parentNode.insertBefore(this._outlets.goToButton,label.parentNode.firstChild);else if(this._outlets.goToButton.parentNode) label.parentNode.removeChild(this._outlets.goToButton);if(layer.pseudoElement) label.appendChild(this._outlets.pseudoLabel).textContent="::"+layer.pseudoElement;else if(this._outlets.pseudoLabel.parentNode) label.removeChild(this._outlets.pseudoLabel);if(layer.isReflection) label.appendChild(this._outlets.reflectionLabel);else if(this._outlets.reflectionLabel.parentNode) label.removeChild(this._outlets.reflectionLabel);var element=this.element;if(layer.isReflection) element.classList.add("reflection");else if(layer.pseudoElement) element.classList.add("pseudo-element");} _goToArrowWasClicked() {var domNode=WebInspector.domTreeManager.nodeForId(this._layer.nodeId);WebInspector.showMainFrameDOMTree(domNode);}};WebInspector.LayerTreeDetailsSidebarPanel=class LayerTreeDetailsSidebarPanel extends WebInspector.DOMDetailsSidebarPanel {constructor() {super("layer-tree",WebInspector.UIString("Layers"));this._dataGridNodesByLayerId=new Map;this.element.classList.add("layer-tree");} shown() {WebInspector.layerTreeManager.addEventListener(WebInspector.LayerTreeManager.Event.LayerTreeDidChange,this._layerTreeDidChange,this);super.shown();} hidden() {WebInspector.layerTreeManager.removeEventListener(WebInspector.LayerTreeManager.Event.LayerTreeDidChange,this._layerTreeDidChange,this);super.hidden();} supportsDOMNode(nodeToInspect) {return WebInspector.layerTreeManager.supported&&nodeToInspect.nodeType()===Node.ELEMENT_NODE;} initialLayout() {super.initialLayout();WebInspector.showShadowDOMSetting.addEventListener(WebInspector.Setting.Event.Changed,this._showShadowDOMSettingChanged,this);this._buildLayerInfoSection();this._buildDataGridSection();this._buildBottomBar();} layout() {super.layout();if(!this.domNode) return;WebInspector.layerTreeManager.layersForNode(this.domNode,(layerForNode,childLayers)=>{this._unfilteredChildLayers=childLayers;this._updateDisplayWithLayers(layerForNode,childLayers);});} sizeDidChange() {super.sizeDidChange(); this._childLayersRow.sizeDidChange();} _layerTreeDidChange(event) {this.needsLayout();} _showShadowDOMSettingChanged(event) {if(this.selected) this._updateDisplayWithLayers(this._layerForNode,this._unfilteredChildLayers);} _buildLayerInfoSection() {var rows=this._layerInfoRows={};var rowsArray=[];rowsArray.push(rows["Width"]=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Width")));rowsArray.push(rows["Height"]=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Height")));rowsArray.push(rows["Paints"]=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Paints")));rowsArray.push(rows["Memory"]=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Memory")));this._layerInfoGroup=new WebInspector.DetailsSectionGroup(rowsArray);var emptyRow=new WebInspector.DetailsSectionRow(WebInspector.UIString("No Layer Available"));emptyRow.showEmptyMessage();this._noLayerInformationGroup=new WebInspector.DetailsSectionGroup([emptyRow]);this._layerInfoSection=new WebInspector.DetailsSection("layer-info",WebInspector.UIString("Layer Info"),[this._noLayerInformationGroup]);this.contentView.element.appendChild(this._layerInfoSection.element);} _buildDataGridSection() {var columns={name:{},paintCount:{},memory:{}};columns.name.title=WebInspector.UIString("Node");columns.name.sortable=false;columns.paintCount.title=WebInspector.UIString("Paints");columns.paintCount.sortable=true;columns.paintCount.aligned="right";columns.paintCount.width="50px";columns.memory.title=WebInspector.UIString("Memory");columns.memory.sortable=true;columns.memory.aligned="right";columns.memory.width="70px";this._dataGrid=new WebInspector.DataGrid(columns);this._dataGrid.inline=true;this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged,this._sortDataGrid,this);this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged,this._selectedDataGridNodeChanged,this);this._dataGrid.sortColumnIdentifier="memory";this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Descending;this._dataGrid.createSettings("layer-tree-details-sidebar-panel");var element=this._dataGrid.element;element.addEventListener("focus",this._dataGridGainedFocus.bind(this),false);element.addEventListener("blur",this._dataGridLostFocus.bind(this),false);element.addEventListener("click",this._dataGridWasClicked.bind(this),false);this._childLayersRow=new WebInspector.DetailsSectionDataGridRow(null,WebInspector.UIString("No Child Layers"));var group=new WebInspector.DetailsSectionGroup([this._childLayersRow]);var section=new WebInspector.DetailsSection("layer-children",WebInspector.UIString("Child Layers"),[group],null,true);this.contentView.element.appendChild(section.element);} _buildBottomBar() {var bottomBar=this.element.appendChild(document.createElement("div"));bottomBar.className="bottom-bar";this._layersCountLabel=bottomBar.appendChild(document.createElement("div"));this._layersCountLabel.className="layers-count-label";this._layersMemoryLabel=bottomBar.appendChild(document.createElement("div"));this._layersMemoryLabel.className="layers-memory-label";} _sortDataGrid() {var sortColumnIdentifier=this._dataGrid.sortColumnIdentifier;function comparator(a,b) {var item1=a.layer[sortColumnIdentifier]||0;var item2=b.layer[sortColumnIdentifier]||0;return item1-item2;} this._dataGrid.sortNodes(comparator);this._updatePopoverForSelectedNode();} _selectedDataGridNodeChanged() {if(this._dataGrid.selectedNode){this._highlightSelectedNode();this._showPopoverForSelectedNode();}else{WebInspector.domTreeManager.hideDOMNodeHighlight();this._hidePopover();}} _dataGridGainedFocus(event) {this._highlightSelectedNode();this._showPopoverForSelectedNode();} _dataGridLostFocus(event) {WebInspector.domTreeManager.hideDOMNodeHighlight();this._hidePopover();} _dataGridWasClicked(event) {if(this._dataGrid.selectedNode&&event.target.parentNode.classList.contains("filler")) this._dataGrid.selectedNode.deselect();} _highlightSelectedNode() {var dataGridNode=this._dataGrid.selectedNode;if(!dataGridNode) return;var layer=dataGridNode.layer;if(layer.isGeneratedContent||layer.isReflection||layer.isAnonymous) WebInspector.domTreeManager.highlightRect(layer.bounds,true);else WebInspector.domTreeManager.highlightDOMNode(layer.nodeId);} _updateDisplayWithLayers(layerForNode,childLayers) {if(!WebInspector.showShadowDOMSetting.value){childLayers=childLayers.filter(function(layer){return!layer.isInShadowTree;});} this._updateLayerInfoSection(layerForNode);this._updateDataGrid(layerForNode,childLayers);this._updateMetrics(layerForNode,childLayers);this._layerForNode=layerForNode;this._childLayers=childLayers;} _updateLayerInfoSection(layer) {this._layerInfoSection.groups=layer?[this._layerInfoGroup]:[this._noLayerInformationGroup];if(!layer) return;this._layerInfoRows["Memory"].value=Number.bytesToString(layer.memory);this._layerInfoRows["Width"].value=layer.compositedBounds.width+"px";this._layerInfoRows["Height"].value=layer.compositedBounds.height+"px";this._layerInfoRows["Paints"].value=layer.paintCount+"";} _updateDataGrid(layerForNode,childLayers) {let dataGrid=this._dataGrid;let mutations=WebInspector.layerTreeManager.layerTreeMutations(this._childLayers,childLayers);mutations.removals.forEach(function(layer){let node=this._dataGridNodesByLayerId.get(layer.layerId);if(node){dataGrid.removeChild(node);this._dataGridNodesByLayerId.delete(layer.layerId);}},this);mutations.additions.forEach(function(layer){let node=this._dataGridNodeForLayer(layer);if(node) dataGrid.appendChild(node);},this);mutations.preserved.forEach(function(layer){let node=this._dataGridNodesByLayerId.get(layer.layerId);if(node) node.layer=layer;},this);this._sortDataGrid();this._childLayersRow.dataGrid=!isEmptyObject(childLayers)?this._dataGrid:null;} _dataGridNodeForLayer(layer) {let node=new WebInspector.LayerTreeDataGridNode(layer);this._dataGridNodesByLayerId.set(layer.layerId,node);return node;} _updateMetrics(layerForNode,childLayers) {var layerCount=0;var totalMemory=0;if(layerForNode){layerCount++;totalMemory+=layerForNode.memory||0;} childLayers.forEach(function(layer){layerCount++;totalMemory+=layer.memory||0;});this._layersCountLabel.textContent=WebInspector.UIString("Layer Count: %d").format(layerCount);this._layersMemoryLabel.textContent=WebInspector.UIString("Memory: %s").format(Number.bytesToString(totalMemory));} _showPopoverForSelectedNode() {var dataGridNode=this._dataGrid.selectedNode;if(!dataGridNode) return;this._contentForPopover(dataGridNode.layer,(content)=>{if(dataGridNode===this._dataGrid.selectedNode) this._updatePopoverForSelectedNode(content);});} _updatePopoverForSelectedNode(content) {var dataGridNode=this._dataGrid.selectedNode;if(!dataGridNode) return;var popover=this._popover;if(!popover){popover=this._popover=new WebInspector.Popover;popover.windowResizeHandler=()=>{this._updatePopoverForSelectedNode();};} var targetFrame=WebInspector.Rect.rectFromClientRect(dataGridNode.element.getBoundingClientRect());if(content) popover.content=content;popover.present(targetFrame.pad(2),[WebInspector.RectEdge.MIN_X]);} _hidePopover() {if(this._popover) this._popover.dismiss();} _contentForPopover(layer,callback) {var content=document.createElement("div");content.className="layer-tree-popover";content.appendChild(document.createElement("p")).textContent=WebInspector.UIString("Reasons for compositing:");var list=content.appendChild(document.createElement("ul"));WebInspector.layerTreeManager.reasonsForCompositingLayer(layer,(compositingReasons)=>{if(isEmptyObject(compositingReasons)){callback(content);return;} this._populateListOfCompositingReasons(list,compositingReasons);callback(content);});return content;} _populateListOfCompositingReasons(list,compositingReasons) {function addReason(reason) {list.appendChild(document.createElement("li")).textContent=reason;} if(compositingReasons.transform3D) addReason(WebInspector.UIString("Element has a 3D transform"));if(compositingReasons.video) addReason(WebInspector.UIString("Element is