@react-native/debugger-frontend
Version:
Debugger frontend for React Native based on Chrome DevTools
1 lines • 285 kB
JavaScript
import*as e from"../../core/common/common.js";import*as t from"../../core/host/host.js";import*as i from"../../core/i18n/i18n.js";import*as r from"../../ui/legacy/components/source_frame/source_frame.js";import*as o from"../../ui/legacy/legacy.js";import*as s from"../../core/platform/platform.js";import*as n from"../../core/sdk/sdk.js";import*as a from"../../models/logs/logs.js";import"../../ui/components/buttons/buttons.js";import*as l from"../../ui/visual_logging/visual_logging.js";import*as d from"../../ui/legacy/components/data_grid/data_grid.js";import*as c from"../mobile_throttling/mobile_throttling.js";import*as h from"../settings/emulation/components/components.js";import*as u from"../../models/bindings/bindings.js";import*as p from"../../models/workspace/workspace.js";import*as g from"./forward/forward.js";import*as m from"../../ui/components/icon_button/icon_button.js";import*as w from"../../ui/legacy/components/perf_ui/perf_ui.js";import*as k from"../../ui/legacy/components/utils/utils.js";import{PanelUtils as b}from"../utils/utils.js";import*as v from"../../ui/components/legacy_wrapper/legacy_wrapper.js";import*as f from"./components/components.js";import*as C from"../../ui/legacy/components/cookie_table/cookie_table.js";import*as S from"../../ui/legacy/components/object_ui/object_ui.js";import*as y from"../../models/text_utils/text_utils.js";import*as T from"../../core/root/root.js";import*as x from"../../models/har/har.js";import*as R from"../../models/persistence/persistence.js";import*as I from"../sources/sources.js";import*as q from"../../ui/components/adorners/adorners.js";import*as L from"../../ui/components/render_coordinator/render_coordinator.js";import*as F from"../../ui/legacy/theme_support/theme_support.js";import*as P from"../../models/trace/trace.js";import*as H from"../search/search.js";import*as M from"../timeline/utils/utils.js";const E=new CSSStyleSheet;E.replaceSync(".panel.network .toolbar.binary-view-toolbar{border-top:1px solid var(--sys-color-divider);border-bottom:0;padding-left:5px}.binary-view-copied-text{opacity:100%}.binary-view-copied-text.fadeout{opacity:0%;transition:opacity 1s}\n/*# sourceURL=binaryResourceView.css */\n");const A={copiedAsBase:"Copied as `Base64`",hexViewer:"`Hex` Viewer",copiedAsHex:"Copied as `Hex`",copiedAsUtf:"Copied as `UTF-8`",binaryViewType:"Binary view type",copyToClipboard:"Copy to clipboard",copyAsBase:"Copy as `Base64`",copyAsHex:"Copy as `Hex`",copyAsUtf:"Copy as `UTF-8`"},B=i.i18n.registerUIStrings("panels/network/BinaryResourceView.ts",A),U=i.i18n.getLocalizedString.bind(void 0,B);class N extends o.Widget.VBox{binaryResourceViewFactory;toolbar;binaryViewObjects;binaryViewTypeSetting;binaryViewTypeCombobox;copiedText;addFadeoutSettimeoutId;lastView;constructor(t,s,n){super(),this.binaryResourceViewFactory=new r.BinaryResourceViewFactory.BinaryResourceViewFactory(t,s,n),this.toolbar=new o.Toolbar.Toolbar("binary-view-toolbar",this.element),this.binaryViewObjects=[new V("base64",i.i18n.lockedString("Base64"),U(A.copiedAsBase),this.binaryResourceViewFactory.createBase64View.bind(this.binaryResourceViewFactory),(()=>Promise.resolve(this.binaryResourceViewFactory.base64()))),new V("hex",U(A.hexViewer),U(A.copiedAsHex),this.binaryResourceViewFactory.createHexView.bind(this.binaryResourceViewFactory),this.binaryResourceViewFactory.hex.bind(this.binaryResourceViewFactory)),new V("utf8",i.i18n.lockedString("UTF-8"),U(A.copiedAsUtf),this.binaryResourceViewFactory.createUtf8View.bind(this.binaryResourceViewFactory),this.binaryResourceViewFactory.utf8.bind(this.binaryResourceViewFactory))],this.binaryViewTypeSetting=e.Settings.Settings.instance().createSetting("binary-view-type","hex"),this.binaryViewTypeCombobox=new o.Toolbar.ToolbarComboBox(this.binaryViewTypeChanged.bind(this),U(A.binaryViewType));for(const e of this.binaryViewObjects)this.binaryViewTypeCombobox.addOption(this.binaryViewTypeCombobox.createOption(e.label,e.type));this.toolbar.appendToolbarItem(this.binaryViewTypeCombobox);const a=new o.Toolbar.ToolbarButton(U(A.copyToClipboard),"copy");a.addEventListener("Click",(e=>{this.copySelectedViewToClipboard()}),this),this.toolbar.appendToolbarItem(a),this.copiedText=new o.Toolbar.ToolbarText,this.copiedText.element.classList.add("binary-view-copied-text"),this.toolbar.element.appendChild(this.copiedText.element),this.addFadeoutSettimeoutId=null,this.lastView=null,this.updateView()}getCurrentViewObject(){const e=this.binaryViewObjects.find((e=>e.type===this.binaryViewTypeSetting.get()));return console.assert(Boolean(e),`No binary view found for binary view type found in setting 'binary-view-type': ${this.binaryViewTypeSetting.get()}`),e||null}async copySelectedViewToClipboard(){const e=this.getCurrentViewObject();e&&(t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(await e.content()),this.copiedText.setText(e.copiedMessage),this.copiedText.element.classList.remove("fadeout"),this.addFadeoutSettimeoutId&&(clearTimeout(this.addFadeoutSettimeoutId),this.addFadeoutSettimeoutId=null),this.addFadeoutSettimeoutId=window.setTimeout(function(){this.copiedText.element.classList.add("fadeout")}.bind(this),2e3))}wasShown(){this.updateView(),this.registerCSSFiles([E])}updateView(){const e=this.getCurrentViewObject();if(!e)return;const t=e.getView();t!==this.lastView&&(this.lastView&&this.lastView.detach(),this.lastView=t,t.show(this.element,this.toolbar.element),this.binaryViewTypeCombobox.selectElement().value=this.binaryViewTypeSetting.get())}binaryViewTypeChanged(){const e=this.binaryViewTypeCombobox.selectedOption();if(!e)return;const t=e.value;this.binaryViewTypeSetting.get()!==t&&(this.binaryViewTypeSetting.set(t),this.updateView())}addCopyToContextMenu(e,i){const r=e.clipboardSection().appendSubMenuItem(i,!1,"copy").footerSection();r.appendItem(U(A.copyAsBase),(async()=>{const e=this.binaryResourceViewFactory.base64();t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(e)}),{jslogContext:"copy-as-base"}),r.appendItem(U(A.copyAsHex),(async()=>{const e=await this.binaryResourceViewFactory.hex();t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(e)}),{jslogContext:"copy-as-hex"}),r.appendItem(U(A.copyAsUtf),(async()=>{const e=await this.binaryResourceViewFactory.utf8();t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(e)}),{jslogContext:"copy-as-utf"})}}class V{type;label;copiedMessage;content;createViewFn;view;constructor(e,t,i,r,o){this.type=e,this.label=t,this.copiedMessage=i,this.content=o,this.createViewFn=r,this.view=null}getView(){return this.view||(this.view=this.createViewFn()),this.view}}var O=Object.freeze({__proto__:null,BinaryResourceView:N,BinaryViewObject:V});const W=new CSSStyleSheet;W.replaceSync(".list{border:none!important;border-top:1px solid var(--sys-color-divider)!important}.blocking-disabled{opacity:80%}.editor-container{padding:0 4px}.no-blocked-urls,\n.blocked-urls{overflow-x:hidden;overflow-y:auto}.no-blocked-urls{display:flex;justify-content:center;padding:10px;& devtools-button{display:flex;justify-content:center;margin-top:var(--sys-size-8)}}.no-blocked-urls > span{white-space:pre}.blocked-url{display:flex;flex-direction:row;align-items:center;flex:auto}.blocked-url-count{flex:none;padding-right:9px}.blocked-url-checkbox{margin-left:8px;flex:none}.blocked-url-checkbox:focus{outline:auto 5px -webkit-focus-ring-color}.blocked-url-label{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex:auto;padding:0 3px}.blocked-url-edit-row{flex:none;display:flex;flex-direction:row;margin:7px 5px 0;align-items:center}.blocked-url-edit-value{user-select:none;flex:1 1 0}.blocked-url-edit-row input{width:100%;text-align:inherit;height:22px}\n/*# sourceURL=blockedURLsPane.css */\n");const D={enableNetworkRequestBlocking:"Enable network request blocking",addPattern:"Add pattern",addNetworkRequestBlockingPattern:"Add network request blocking pattern",networkRequestsAreNotBlockedS:"Network requests are not blocked. {PH1}",dBlocked:"{PH1} blocked",textPatternToBlockMatching:"Text pattern to block matching requests; use * for wildcard",patternInputCannotBeEmpty:"Pattern input cannot be empty.",patternAlreadyExists:"Pattern already exists.",itemDeleted:"Item successfully deleted"},j=i.i18n.registerUIStrings("panels/network/BlockedURLsPane.ts",D),G=i.i18n.getLocalizedString.bind(void 0,j);class z extends o.Widget.VBox{manager;toolbar;enabledCheckbox;list;editor;blockedCountForUrl;constructor(){super(!0),this.element.setAttribute("jslog",`${l.panel("network.blocked-urls").track({resize:!0})}`),this.manager=n.NetworkManager.MultitargetNetworkManager.instance(),this.manager.addEventListener("BlockedPatternsChanged",this.update,this),this.toolbar=new o.Toolbar.Toolbar("",this.contentElement),this.enabledCheckbox=new o.Toolbar.ToolbarCheckbox(G(D.enableNetworkRequestBlocking),void 0,this.toggleEnabled.bind(this),"network.enable-request-blocking"),this.toolbar.appendToolbarItem(this.enabledCheckbox),this.toolbar.appendSeparator(),this.toolbar.appendToolbarItem(o.Toolbar.Toolbar.createActionButtonForId("network.add-network-request-blocking-pattern")),this.toolbar.appendToolbarItem(o.Toolbar.Toolbar.createActionButtonForId("network.remove-all-network-request-blocking-patterns")),this.toolbar.element.setAttribute("jslog",`${l.toolbar()}`),this.list=new o.ListWidget.ListWidget(this),this.list.element.classList.add("blocked-urls"),this.list.setEmptyPlaceholder(this.createEmptyPlaceholder()),this.list.show(this.contentElement),this.editor=null,this.blockedCountForUrl=new Map,n.TargetManager.TargetManager.instance().addModelListener(n.NetworkManager.NetworkManager,n.NetworkManager.Events.RequestFinished,this.onRequestFinished,this,{scoped:!0}),this.update(),a.NetworkLog.NetworkLog.instance().addEventListener(a.NetworkLog.Events.Reset,this.onNetworkLogReset,this)}createEmptyPlaceholder(){const e=this.contentElement.createChild("div","no-blocked-urls"),t=o.UIUtils.createTextButton(G(D.addPattern),this.addPattern.bind(this),{className:"add-button",jslogContext:"network.add-network-request-blocking-pattern",variant:"primary"});return o.ARIAUtils.setLabel(t,G(D.addNetworkRequestBlockingPattern)),e.appendChild(i.i18n.getFormatLocalizedString(j,D.networkRequestsAreNotBlockedS,{PH1:t})),e}addPattern(){this.manager.setBlockingEnabled(!0),this.list.addNewItem(0,{url:s.DevToolsPath.EmptyUrlString,enabled:!0})}removeAllPatterns(){this.manager.setBlockedPatterns([])}renderItem(e,t){const i=this.blockedRequestsCount(e.url),r=document.createElement("div");r.classList.add("blocked-url");const o=r.createChild("input","blocked-url-checkbox");return o.type="checkbox",o.checked=e.enabled,o.disabled=!t,o.setAttribute("jslog",`${l.toggle().track({change:!0})}`),r.createChild("div","blocked-url-label").textContent=e.url,r.createChild("div","blocked-url-count").textContent=G(D.dBlocked,{PH1:i}),t&&(r.addEventListener("click",(t=>this.togglePattern(e,t))),o.addEventListener("click",(t=>this.togglePattern(e,t)))),r}togglePattern(e,t){t.consume(!0);const i=this.manager.blockedPatterns();i.splice(i.indexOf(e),1,{enabled:!e.enabled,url:e.url}),this.manager.setBlockedPatterns(i)}toggleEnabled(){this.manager.setBlockingEnabled(!this.manager.blockingEnabled()),this.update()}removeItemRequested(e,t){const i=this.manager.blockedPatterns();i.splice(t,1),this.manager.setBlockedPatterns(i),o.ARIAUtils.alert(D.itemDeleted)}beginEdit(e){return this.editor=this.createEditor(),this.editor.control("url").value=e.url,this.editor}commitEdit(e,t,i){const r=t.control("url").value,o=this.manager.blockedPatterns();i?o.push({enabled:!0,url:r}):o.splice(o.indexOf(e),1,{enabled:!0,url:r}),this.manager.setBlockedPatterns(o)}createEditor(){if(this.editor)return this.editor;const e=new o.ListWidget.Editor,t=e.contentElement();t.createChild("div","blocked-url-edit-row").createChild("div").textContent=G(D.textPatternToBlockMatching);const i=t.createChild("div","blocked-url-edit-row"),r=e.createInput("url","text","",((e,t,i)=>{let r,o=!0;return i.value?this.manager.blockedPatterns().find((e=>e.url===i.value))&&(r=G(D.patternAlreadyExists),o=!1):(r=G(D.patternInputCannotBeEmpty),o=!1),{valid:o,errorMessage:r}}));return i.createChild("div","blocked-url-edit-value").appendChild(r),e}update(){const e=this.manager.blockingEnabled();this.list.element.classList.toggle("blocking-disabled",!e&&Boolean(this.manager.blockedPatterns().length)),this.enabledCheckbox.setChecked(e),this.list.clear();for(const t of this.manager.blockedPatterns())this.list.appendItem(t,e)}blockedRequestsCount(e){if(!e)return 0;let t=0;for(const i of this.blockedCountForUrl.keys())this.matches(e,i)&&(t+=this.blockedCountForUrl.get(i));return t}matches(e,t){let i=0;const r=e.split("*");for(let e=0;e<r.length;e++){const o=r[e];if(o.length){if(i=t.indexOf(o,i),-1===i)return!1;i+=o.length}}return!0}onNetworkLogReset(e){this.blockedCountForUrl.clear(),this.update()}onRequestFinished(e){const t=e.data;if(t.wasBlocked()){const e=this.blockedCountForUrl.get(t.url())||0;this.blockedCountForUrl.set(t.url(),e+1),this.update()}}wasShown(){o.Context.Context.instance().setFlavor(z,this),super.wasShown(),this.list.registerCSSFiles([W]),this.registerCSSFiles([W])}willHide(){super.willHide(),o.Context.Context.instance().setFlavor(z,null)}}var _=Object.freeze({__proto__:null,BlockedURLsPane:z,ActionDelegate:class{handleAction(e,t){const i=e.flavor(z);if(null===i)return!1;switch(t){case"network.add-network-request-blocking-pattern":return i.addPattern(),!0;case"network.remove-all-network-request-blocking-patterns":return i.removeAllPatterns(),!0}return!1}}});const K=new CSSStyleSheet;K.replaceSync(".event-source-messages-view .data-grid{flex:auto;border:none}\n/*# sourceURL=eventSourceMessagesView.css */\n");const $={id:"Id",type:"Type",data:"Data",time:"Time",eventSource:"Event Source",copyMessage:"Copy message",clearAll:"Clear all",filterByRegex:"Filter using regex (example: https?)"},X=i.i18n.registerUIStrings("panels/network/EventSourceMessagesView.ts",$),Y=i.i18n.getLocalizedString.bind(void 0,X);class J extends o.Widget.VBox{request;dataGrid;mainToolbar;clearAllButton;filterTextInput;filterRegex;messageFilterSetting=e.Settings.Settings.instance().createSetting("network-event-source-message-filter","");constructor(e){super(),this.element.classList.add("event-source-messages-view"),this.element.setAttribute("jslog",`${l.pane("event-stream").track({resize:!0})}`),this.request=e,this.mainToolbar=new o.Toolbar.Toolbar(""),this.clearAllButton=new o.Toolbar.ToolbarButton(Y($.clearAll),"clear"),this.clearAllButton.addEventListener("Click",this.clearMessages,this),this.mainToolbar.appendToolbarItem(this.clearAllButton);const t=Y($.filterByRegex);this.filterTextInput=new o.Toolbar.ToolbarFilter(t,.4),this.filterTextInput.addEventListener("TextChanged",this.updateFilterSetting,this);const i=this.messageFilterSetting.get();this.filterRegex=null,this.setFilter(i),i&&this.filterTextInput.setValue(i),this.mainToolbar.appendToolbarItem(this.filterTextInput),this.element.appendChild(this.mainToolbar.element);const r=[{id:"id",title:Y($.id),sortable:!0,weight:8},{id:"type",title:Y($.type),sortable:!0,weight:8},{id:"data",title:Y($.data),sortable:!1,weight:88},{id:"time",title:Y($.time),sortable:!0,weight:8}];this.dataGrid=new d.SortableDataGrid.SortableDataGrid({displayName:Y($.eventSource),columns:r,editCallback:void 0,deleteCallback:void 0,refreshCallback:void 0}),this.dataGrid.setStriped(!0),this.dataGrid.setStickToBottom(!0),this.dataGrid.setRowContextMenuCallback(this.onRowContextMenu.bind(this)),this.dataGrid.markColumnAsSortedBy("time",d.DataGrid.Order.Ascending),this.sortItems(),this.dataGrid.addEventListener("SortingChanged",this.sortItems,this),this.dataGrid.setName("event-source-messages-view"),this.dataGrid.asWidget().show(this.element)}wasShown(){this.refresh(),this.registerCSSFiles([K]),this.request.addEventListener(n.NetworkRequest.Events.EventSourceMessageAdded,this.messageAdded,this)}willHide(){this.request.removeEventListener(n.NetworkRequest.Events.EventSourceMessageAdded,this.messageAdded,this)}messageAdded(e){const t=e.data;this.messageFilter(t)&&this.dataGrid.insertChild(new Z(t))}messageFilter(e){return!this.filterRegex||this.filterRegex.test(e.eventName)||this.filterRegex.test(e.eventId)||this.filterRegex.test(e.data)}clearMessages(){te.set(this.request,this.request.eventSourceMessages().length),this.refresh()}updateFilterSetting(){const e=this.filterTextInput.value();this.messageFilterSetting.set(e),this.setFilter(e),this.refresh()}setFilter(e){if(this.filterRegex=null,e)try{this.filterRegex=new RegExp(e,"i")}catch(e){this.filterRegex=new RegExp("(?!)","i")}}sortItems(){const e=this.dataGrid.sortColumnId();if(!e)return;const t=ee[e];t&&this.dataGrid.sortNodes(t,!this.dataGrid.isSortOrderAscending())}onRowContextMenu(e,i){e.clipboardSection().appendItem(Y($.copyMessage),t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText.bind(t.InspectorFrontendHost.InspectorFrontendHostInstance,i.data.data),{jslogContext:"copy"})}refresh(){this.dataGrid.rootNode().removeChildren();let e=this.request.eventSourceMessages();const t=te.get(this.request)||0;e=e.slice(t),e=e.filter(this.messageFilter.bind(this)),e.forEach((e=>this.dataGrid.insertChild(new Z(e))))}}class Z extends d.SortableDataGrid.SortableDataGridNode{message;constructor(e){const t=new Date(1e3*e.time),i=("0"+t.getHours()).substr(-2)+":"+("0"+t.getMinutes()).substr(-2)+":"+("0"+t.getSeconds()).substr(-2)+"."+("00"+t.getMilliseconds()).substr(-3),r=document.createElement("div");o.UIUtils.createTextChild(r,i),o.Tooltip.Tooltip.install(r,t.toLocaleString()),super({id:e.eventId,type:e.eventName,data:e.data,time:r}),this.message=e}}function Q(e,t,i){const r=e(t.message),o=e(i.message);return r<o?-1:r>o?1:0}const ee={id:Q.bind(null,(e=>e.eventId)),type:Q.bind(null,(e=>e.eventName)),time:Q.bind(null,(e=>e.time))},te=new WeakMap;var ie=Object.freeze({__proto__:null,EventSourceMessagesView:J,EventSourceMessageNode:Z,Comparators:ee});const re=new CSSStyleSheet;re.replaceSync('.network-config{padding:12px;display:block}.network-config-group{display:flex;padding-bottom:10px;flex-wrap:wrap;flex:0 0 auto;min-height:30px}.network-config-title{margin-right:16px;width:130px}.network-config-fields{flex:2 0 200px}.network-config-fields span:first-of-type,\n.network-config-fields .network-config-accepted-encoding-custom{padding:3px 0}.panel-section-separator{height:1px;margin-bottom:10px;background:var(--sys-color-divider)}.network-config-disable-cache{line-height:28px;border-top:none;padding-top:0}.network-config-input-validation-error{color:var(--sys-color-error);margin:5px 0}.network-config-input-validation-error:empty{display:none}.network-config-throttling .chrome-select{width:100%;max-width:250px}.network-config-throttling > .network-config-title{line-height:24px}.network-config-ua > .network-config-title{line-height:20px}.network-config-ua span[is="dt-radio"].checked > *{display:none}.network-config-ua input{display:block;width:calc(100% - 20px)}.network-config-ua input[type="text"],\n.network-config-ua .chrome-select{margin-top:8px}.network-config-ua .chrome-select{width:calc(100% - 20px);max-width:250px}.network-config-ua span[is="dt-radio"]{display:block}.network-config-ua-custom{opacity:50%;padding-bottom:8px}.network-config-ua-custom.checked{opacity:100%}.client-hints-form{margin-top:14px;width:min(100%,400px)}.status-text{padding:10px;color:var(--sys-color-tertiary)}\n/*# sourceURL=networkConfigView.css */\n');const oe={custom:"Custom...",enterACustomUserAgent:"Enter a custom user agent",customUserAgentFieldIsRequired:"Custom user agent field is required",caching:"Caching",disableCache:"Disable cache",networkThrottling:"Network throttling",userAgent:"User agent",selectAutomatically:"Use browser default",acceptedEncoding:"Accepted `Content-Encoding`s",clientHintsStatusText:"User agent updated.",networkConditionsPanelShown:"Network conditions shown"},se=i.i18n.registerUIStrings("panels/network/NetworkConfigView.ts",oe),ne=i.i18n.getLocalizedString.bind(void 0,se);let ae;class le extends o.Widget.VBox{constructor(){super(!0),this.element.setAttribute("jslog",`${l.panel("network-conditions").track({resize:!0})}`),this.contentElement.classList.add("network-config"),this.createCacheSection(),this.contentElement.createChild("div").classList.add("panel-section-separator"),this.createNetworkThrottlingSection(),this.contentElement.createChild("div").classList.add("panel-section-separator"),this.createUserAgentSection(),this.contentElement.createChild("div").classList.add("panel-section-separator"),this.createAcceptedEncodingSection()}static instance(e={forceNew:null}){const{forceNew:t}=e;return ae&&!t||(ae=new le),ae}static createUserAgentSelectAndInput(t){const i=e.Settings.Settings.instance().createSetting("custom-user-agent",""),r=e.Settings.Settings.instance().createSetting("custom-user-agent-metadata",null),a=document.createElement("select");a.setAttribute("jslog",`${l.dropDown().track({change:!0}).context(i.name)}`),o.ARIAUtils.setLabel(a,t);const d={title:ne(oe.custom),value:"custom"};a.appendChild(o.UIUtils.createOption(d.title,d.value,"custom"));for(const e of ce){const t=a.createChild("optgroup");t.label=e.title;for(const i of e.values){const e=n.NetworkManager.MultitargetNetworkManager.patchUserAgentWithChromeVersion(i.value);t.appendChild(o.UIUtils.createOption(i.title,e,s.StringUtilities.toKebabCase(i.title)))}}a.selectedIndex=0;const c=o.UIUtils.createInput("","text");c.setAttribute("jslog",`${l.textField().track({change:!0}).context(i.name)}`),c.value=i.get(),o.Tooltip.Tooltip.install(c,i.get()),c.placeholder=ne(oe.enterACustomUserAgent),c.required=!0,o.ARIAUtils.setLabel(c,c.placeholder);const h=document.createElement("div");function u(){const e=i.get(),t=a.options;let r=!1;for(let i=0;i<t.length;++i)if(t[i].value===e){a.selectedIndex=i,r=!0;break}r||(a.selectedIndex=0)}return h.classList.add("network-config-input-validation-error"),o.ARIAUtils.markAsAlert(h),c.value||(h.textContent=ne(oe.customUserAgentFieldIsRequired)),u(),a.addEventListener("change",(function(){const e=a.options[a.selectedIndex].value;if(e!==d.value){i.set(e),c.value=e,o.Tooltip.Tooltip.install(c,e);const t=de(e);r.set(t),n.NetworkManager.MultitargetNetworkManager.instance().setCustomUserAgentOverride(e,t)}else r.set(null),c.select();h.textContent="";const t=new CustomEvent("user-agent-change",{detail:{value:e}});a.dispatchEvent(t)}),!1),c.addEventListener("input",(function(){i.get()!==c.value&&(c.value?h.textContent="":h.textContent=ne(oe.customUserAgentFieldIsRequired),i.set(c.value),o.Tooltip.Tooltip.install(c,c.value),u())}),!1),{select:a,input:c,error:h}}createSection(e,t){const i=this.contentElement.createChild("section","network-config-group");return t&&i.classList.add(t),i.createChild("div","network-config-title").textContent=e,i.createChild("div","network-config-fields")}createCacheSection(){this.createSection(ne(oe.caching),"network-config-disable-cache").appendChild(o.SettingsUI.createSettingCheckbox(ne(oe.disableCache),e.Settings.Settings.instance().moduleSetting("cache-disabled"),!0))}createNetworkThrottlingSection(){const e=ne(oe.networkThrottling),t=this.createSection(e,"network-config-throttling").createChild("select","chrome-select");c.ThrottlingManager.throttlingManager().decorateSelectWithNetworkThrottling(t),o.ARIAUtils.setLabel(t,e)}createUserAgentSection(){const t=e.Settings.Settings.instance().createSetting("custom-user-agent-metadata",null),i=e.Settings.Settings.instance().createSetting("custom-user-agent",""),r=ne(oe.userAgent),s=this.createSection(r,"network-config-ua"),a=o.UIUtils.CheckboxLabel.create(ne(oe.selectAutomatically),!0,void 0,i.name);s.appendChild(a);const l=a.checkboxElement;i.addChangeListener((()=>{if(l.checked)return;const e=i.get(),t=de(e);n.NetworkManager.MultitargetNetworkManager.instance().setCustomUserAgentOverride(e,t)}));const d=s.createChild("div","network-config-ua-custom");l.addEventListener("change",k);const c=le.createUserAgentSelectAndInput(r);c.select.classList.add("chrome-select"),d.appendChild(c.select),d.appendChild(c.input),d.appendChild(c.error);const u=d.createChild("div","client-hints-form"),p=new h.UserAgentClientHintsForm.UserAgentClientHintsForm,g=t.get(),m=de(c.select.value);p.value={showMobileCheckbox:!0,showSubmitButton:!0,metaData:g||m||void 0},u.appendChild(p),c.select.addEventListener("user-agent-change",(e=>{const t=e.detail.value,i=t?de(t):null;p.value={metaData:i||void 0,showMobileCheckbox:!0,showSubmitButton:!0},w.textContent=""})),p.addEventListener("clienthintschange",(()=>{c.select.value="custom",w.textContent=""})),p.addEventListener("clienthintssubmit",(e=>{const r=e.detail.value,o=i.get();t.set(r),n.NetworkManager.MultitargetNetworkManager.instance().setCustomUserAgentOverride(o,r),w.textContent=ne(oe.clientHintsStatusText)}));const w=s.createChild("span","status-text");function k(){const e=!l.checked;d.classList.toggle("checked",e),c.select.disabled=!e,c.input.disabled=!e,c.error.hidden=!e,p.disabled=!e;const t=e?i.get():"",r=e?de(t):null;n.NetworkManager.MultitargetNetworkManager.instance().setCustomUserAgentOverride(t,r)}w.textContent="",k()}createAcceptedEncodingSection(){const t=e.Settings.Settings.instance().createSetting("use-custom-accepted-encodings",!1),i=e.Settings.Settings.instance().createSetting("custom-accepted-encodings","gzip,br,deflate"),r=ne(oe.acceptedEncoding),s=this.createSection(r,"network-config-accepted-encoding"),a=o.UIUtils.CheckboxLabel.create(ne(oe.selectAutomatically),!0,void 0,t.name);s.appendChild(a);const d=a.checkboxElement;function c(){t.get()?n.NetworkManager.MultitargetNetworkManager.instance().setCustomAcceptedEncodingsOverride(""===i.get()?[]:i.get().split(",")):n.NetworkManager.MultitargetNetworkManager.instance().clearCustomAcceptedEncodingsOverride()}i.addChangeListener(c),t.addChangeListener(c);const h=s.createChild("div","network-config-accepted-encoding-custom");h.setAttribute("jslog",`${l.section().context(i.name)}`),d.checked=!t.get(),d.addEventListener("change",g);const u=new Map,p={Deflate:"deflate",Gzip:"gzip",Br:"br",Zstd:"zstd"};for(const e of Object.values(p)){const t=o.UIUtils.CheckboxLabel.create(e,!0,void 0,e);h.appendChild(t),u.set(e,t.checkboxElement)}for(const[e,t]of u)t.checked=i.get().includes(e),t.addEventListener("change",g);function g(){t.set(!d.checked);const e=[];for(const[t,i]of u)i.disabled=d.checked,i.checked&&e.push(t);i.set(e.join(","))}g()}wasShown(){super.wasShown(),this.registerCSSFiles([re]),o.ARIAUtils.alert(ne(oe.networkConditionsPanelShown))}}function de(e){for(const t of ce)for(const i of t.values)if(e===n.NetworkManager.MultitargetNetworkManager.patchUserAgentWithChromeVersion(i.value))return i.metadata?(n.NetworkManager.MultitargetNetworkManager.patchUserAgentMetadataWithChromeVersion(i.metadata),i.metadata):null;return null}const ce=[{title:"Android",values:[{title:"Android (4.0.2) Browser — Galaxy Nexus",value:"Mozilla/5.0 (Linux; U; Android 4.0.2; en-us; Galaxy Nexus Build/ICL53F) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",metadata:{brands:[{brand:"Not A;Brand",version:"99"},{brand:"Chromium",version:"%s"},{brand:"Google Chrome",version:"%s"}],fullVersion:"%s",platform:"Android",platformVersion:"4.0.2",architecture:"",model:"Galaxy Nexus",mobile:!0}},{title:"Android (2.3) Browser — Nexus S",value:"Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; Nexus S Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",metadata:{brands:[{brand:"Not A;Brand",version:"99"},{brand:"Chromium",version:"%s"},{brand:"Google Chrome",version:"%s"}],fullVersion:"%s",platform:"Android",platformVersion:"2.3.6",architecture:"",model:"Nexus S",mobile:!0}}]},{title:"BlackBerry",values:[{title:"BlackBerry — BB10",value:"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.1+ (KHTML, like Gecko) Version/10.0.0.1337 Mobile Safari/537.1+",metadata:null},{title:"BlackBerry — PlayBook 2.1",value:"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML, like Gecko) Version/7.2.1.0 Safari/536.2+",metadata:null},{title:"BlackBerry — 9900",value:"Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.187 Mobile Safari/534.11+",metadata:null}]},{title:"Chrome",values:[{title:"Chrome — Android Mobile",value:"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36",metadata:{brands:[{brand:"Not A;Brand",version:"99"},{brand:"Chromium",version:"%s"},{brand:"Google Chrome",version:"%s"}],fullVersion:"%s",platform:"Android",platformVersion:"6.0",architecture:"",model:"Nexus 5",mobile:!0}},{title:"Chrome — Android Mobile (high-end)",value:"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36",metadata:{brands:[{brand:"Not A;Brand",version:"99"},{brand:"Chromium",version:"%s"},{brand:"Google Chrome",version:"%s"}],fullVersion:"%s",platform:"Android",platformVersion:"10",architecture:"",model:"Pixel 4",mobile:!0}},{title:"Chrome — Android Tablet",value:"Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JSS15Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36",metadata:{brands:[{brand:"Not A;Brand",version:"99"},{brand:"Chromium",version:"%s"},{brand:"Google Chrome",version:"%s"}],fullVersion:"%s",platform:"Android",platformVersion:"4.3",architecture:"",model:"Nexus 7",mobile:!0}},{title:"Chrome — iPhone",value:"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/%s Mobile/15E148 Safari/604.1",metadata:null},{title:"Chrome — iPad",value:"Mozilla/5.0 (iPad; CPU OS 13_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/%s Mobile/15E148 Safari/604.1",metadata:null},{title:"Chrome — Chrome OS",value:"Mozilla/5.0 (X11; CrOS x86_64 10066.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36",metadata:{brands:[{brand:"Not A;Brand",version:"99"},{brand:"Chromium",version:"%s"},{brand:"Google Chrome",version:"%s"}],fullVersion:"%s",platform:"Chrome OS",platformVersion:"10066.0.0",architecture:"x86",model:"",mobile:!1}},{title:"Chrome — Mac",value:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36",metadata:{brands:[{brand:"Not A;Brand",version:"99"},{brand:"Chromium",version:"%s"},{brand:"Google Chrome",version:"%s"}],fullVersion:"%s",platform:"macOS",platformVersion:"10_14_6",architecture:"x86",model:"",mobile:!1}},{title:"Chrome — Windows",value:"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36",metadata:{brands:[{brand:"Not A;Brand",version:"99"},{brand:"Chromium",version:"%s"},{brand:"Google Chrome",version:"%s"}],fullVersion:"%s",platform:"Windows",platformVersion:"10.0",architecture:"x86",model:"",mobile:!1}}]},{title:"Firefox",values:[{title:"Firefox — Android Mobile",value:"Mozilla/5.0 (Android 4.4; Mobile; rv:70.0) Gecko/70.0 Firefox/70.0",metadata:null},{title:"Firefox — Android Tablet",value:"Mozilla/5.0 (Android 4.4; Tablet; rv:70.0) Gecko/70.0 Firefox/70.0",metadata:null},{title:"Firefox — iPhone",value:"Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4",metadata:null},{title:"Firefox — iPad",value:"Mozilla/5.0 (iPad; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4",metadata:null},{title:"Firefox — Mac",value:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:70.0) Gecko/20100101 Firefox/70.0",metadata:null},{title:"Firefox — Windows",value:"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:70.0) Gecko/20100101 Firefox/70.0",metadata:null}]},{title:"Googlebot",values:[{title:"Googlebot",value:"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",metadata:null},{title:"Googlebot Desktop",value:"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Chrome/%s Safari/537.36",metadata:null},{title:"Googlebot Smartphone",value:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",metadata:null}]},{title:"Internet Explorer",values:[{title:"Internet Explorer 11",value:"Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko",metadata:null},{title:"Internet Explorer 10",value:"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",metadata:null},{title:"Internet Explorer 9",value:"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",metadata:null},{title:"Internet Explorer 8",value:"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)",metadata:null},{title:"Internet Explorer 7",value:"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)",metadata:null}]},{title:"Microsoft Edge",values:[{title:"Microsoft Edge (Chromium) — Windows",value:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36 Edg/%s",metadata:{brands:[{brand:"Not A;Brand",version:"99"},{brand:"Chromium",version:"%s"},{brand:"Microsoft Edge",version:"%s"}],fullVersion:"%s",platform:"Windows",platformVersion:"10.0",architecture:"x86",model:"",mobile:!1}},{title:"Microsoft Edge (Chromium) — Mac",value:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Chrome/%s Safari/604.1 Edg/%s",metadata:{brands:[{brand:"Not A;Brand",version:"99"},{brand:"Chromium",version:"%s"},{brand:"Microsoft Edge",version:"%s"}],fullVersion:"%s",platform:"macOS",platformVersion:"10_14_6",architecture:"x86",model:"",mobile:!1}},{title:"Microsoft Edge — iPhone",value:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 EdgiOS/44.5.0.10 Mobile/15E148 Safari/604.1",metadata:null},{title:"Microsoft Edge — iPad",value:"Mozilla/5.0 (iPad; CPU OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 EdgiOS/44.5.2 Mobile/15E148 Safari/605.1.15",metadata:null},{title:"Microsoft Edge — Android Mobile",value:"Mozilla/5.0 (Linux; Android 8.1.0; Pixel Build/OPM4.171019.021.D1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.109 Mobile Safari/537.36 EdgA/42.0.0.2057",metadata:{brands:[{brand:"Not A;Brand",version:"99"},{brand:"Chromium",version:"%s"},{brand:"Microsoft Edge",version:"%s"}],fullVersion:"%s",platform:"Android",platformVersion:"8.1.0",architecture:"",model:"Pixel",mobile:!0}},{title:"Microsoft Edge — Android Tablet",value:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.109 Safari/537.36 EdgA/42.0.0.2057",metadata:{brands:[{brand:"Not A;Brand",version:"99"},{brand:"Chromium",version:"%s"},{brand:"Microsoft Edge",version:"%s"}],fullVersion:"%s",platform:"Android",platformVersion:"6.0.1",architecture:"",model:"Nexus 7",mobile:!0}},{title:"Microsoft Edge (EdgeHTML) — Windows",value:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19042",metadata:null},{title:"Microsoft Edge (EdgeHTML) — XBox",value:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; Xbox; Xbox One) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19041",metadata:null}]},{title:"Opera",values:[{title:"Opera — Mac",value:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36 OPR/65.0.3467.48",metadata:null},{title:"Opera — Windows",value:"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36 OPR/65.0.3467.48",metadata:null},{title:"Opera (Presto) — Mac",value:"Opera/9.80 (Macintosh; Intel Mac OS X 10.9.1) Presto/2.12.388 Version/12.16",metadata:null},{title:"Opera (Presto) — Windows",value:"Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.16",metadata:null},{title:"Opera Mobile — Android Mobile",value:"Opera/12.02 (Android 4.1; Linux; Opera Mobi/ADR-1111101157; U; en-US) Presto/2.9.201 Version/12.02",metadata:null},{title:"Opera Mini — iOS",value:"Opera/9.80 (iPhone; Opera Mini/8.0.0/34.2336; U; en) Presto/2.8.119 Version/11.10",metadata:null}]},{title:"Safari",values:[{title:"Safari — iPad iOS 13.2",value:"Mozilla/5.0 (iPad; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",metadata:null},{title:"Safari — iPhone iOS 13.2",value:"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",metadata:null},{title:"Safari — Mac",value:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Safari/605.1.15",metadata:null}]},{title:"UC Browser",values:[{title:"UC Browser — Android Mobile",value:"Mozilla/5.0 (Linux; U; Android 8.1.0; en-US; Nexus 6P Build/OPM7.181205.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.11.1.1197 Mobile Safari/537.36",metadata:null},{title:"UC Browser — iOS",value:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X; zh-CN) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/16B92 UCBrowser/12.1.7.1109 Mobile AliApp(TUnionSDK/0.1.20.3)",metadata:null},{title:"UC Browser — Windows Phone",value:"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920) UCBrowser/10.1.0.563 Mobile",metadata:null}]}];var he=Object.freeze({__proto__:null,NetworkConfigView:le,userAgentGroups:ce});const ue={redirect:"Redirect",sPreflight:"{PH1} + Preflight",preflight:"Preflight",selectPreflightRequest:"Select preflight request",failed:"(failed)",data:"(data)",canceled:"(canceled)",other:"other",csp:"csp",origin:"origin",devtools:"devtools",blockeds:"(blocked:{PH1})",blockedTooltip:"This request was blocked due to misconfigured response headers, click to view the headers",corsError:"CORS error",crossoriginResourceSharingErrorS:"Cross-Origin Resource Sharing error: {PH1}",finished:"Finished",pendingq:"(pending)",unknown:"(unknown)",unknownExplanation:"The request status cannot be shown here because the page that issued it unloaded while the request was in flight. You can use chrome://net-export to capture a network log and see all request details.",push:"Push / ",parser:"Parser",script:"Script",preload:"Preload",earlyHints:"early-hints",signedexchange:"signed-exchange",selectTheRequestThatTriggered:"Select the request that triggered this preflight",otherC:"Other",memoryCache:"(memory cache)",servedFromMemoryCacheResource:"Served from memory cache, resource size: {PH1}",serviceWorker:"(`ServiceWorker`)",servedFromServiceWorkerResource:"Served from `ServiceWorker`, resource size: {PH1}",servedFromSignedHttpExchange:"Served from Signed HTTP Exchange, resource size: {PH1}",servedFromWebBundle:"Served from Web Bundle, resource size: {PH1}",prefetchCache:"(prefetch cache)",servedFromPrefetchCacheResource:"Served from prefetch cache, resource size: {PH1}",diskCache:"(disk cache)",servedFromDiskCacheResourceSizeS:"Served from disk cache, resource size: {PH1}",matchedToServiceWorkerRouter:"Matched to `ServiceWorker router`#{PH1}, resource size: {PH2}",matchedToServiceWorkerRouterWithNetworkSource:"Matched to `ServiceWorker router`#{PH1}, {PH2} transferred over network, resource size: {PH3}",pending:"Pending",level:"level 1",webBundleError:"Web Bundle error",webBundleInnerRequest:"Served from Web Bundle",webBundle:"(Web Bundle)",timeSubtitleTooltipText:"Latency (response received time - start time)",alternativeJobWonWithoutRace:"`Chrome` used a `HTTP/3` connection induced by an '`Alt-Svc`' header without racing against establishing a connection using a different `HTTP` version.",alternativeJobWonRace:"`Chrome` used a `HTTP/3` connection induced by an '`Alt-Svc`' header because it won a race against establishing a connection using a different `HTTP` version.",mainJobWonRace:"`Chrome` used this protocol because it won a race against establishing a `HTTP/3` connection.",mappingMissing:"`Chrome` did not use an alternative `HTTP` version because no alternative protocol information was available when the request was issued, but an '`Alt-Svc`' header was present in the response.",broken:"`Chrome` did not try to establish a `HTTP/3` connection because it was marked as broken.",dnsAlpnH3JobWonWithoutRace:"`Chrome` used a `HTTP/3` connection due to the `DNS record` indicating `HTTP/3` support. There was no race against establishing a connection using a different `HTTP` version.",dnsAlpnH3JobWonRace:"`Chrome` used a `HTTP/3` connection due to the `DNS record` indicating `HTTP/3` support, which won a race against establishing a connection using a different `HTTP` version.",requestContentHeadersOverridden:"Both request content and headers are overridden",requestContentOverridden:"Request content is overridden",requestHeadersOverridden:"Request headers are overridden",initialPriorityToolTip:"{PH1}, Initial priority: {PH2}",thirdPartyPhaseout:"Cookies for this request are blocked due to third-party cookie phaseout. Learn more in the Issues tab."},pe=i.i18n.registerUIStrings("panels/network/NetworkDataGridNode.ts",ue),ge=i.i18n.getLocalizedString.bind(void 0,pe);class me extends d.SortableDataGrid.SortableDataGridNode{parentViewInternal;isHovered;showingInitiatorChainInternal;requestOrFirstKnownChildRequestInternal;constructor(e){super({}),this.parentViewInternal=e,this.isHovered=!1,this.showingInitiatorChainInternal=!1,this.requestOrFirstKnownChildRequestInternal=null}displayName(){return""}displayType(){return""}createCell(e){const t=this.createTD(e);return this.renderCell(t,e),t}renderCell(e,t){}isFailed(){return!1}backgroundColor(){const e=we,t=document.hasFocus(),i=this.dataGrid&&this.dataGrid.element===document.activeElement,r=this.isFailed();return this.selected&&t&&i&&r?e.FocusSelectedHasError:this.selected&&t&&i?e.FocusSelected:this.selected?e.Selected:this.hovered()?e.Hovered:this.isOnInitiatorPath()?e.InitiatorPath:this.isOnInitiatedPath()?e.InitiatedPath:this.isStriped()?e.Stripe:e.Default}updateBackgroundColor(){const e=this.existingElement();e&&(e.style.backgroundColor=`var(${this.backgroundColor()})`,this.parentViewInternal.stylesChanged())}setStriped(e){super.setStriped(e),this.updateBackgroundColor()}select(e){super.select(e),this.updateBackgroundColor(),this.parentViewInternal.updateNodeSelectedClass(!0)}deselect(e){super.deselect(e),this.updateBackgroundColor(),this.parentViewInternal.updateNodeSelectedClass(!1)}parentView(){return this.parentViewInternal}hovered(){return this.isHovered}showingInitiatorChain(){return this.showingInitiatorChainInternal}nodeSelfHeight(){return this.parentViewInternal.rowHeight()}setHovered(e,t){this.isHovered===e&&this.showingInitiatorChainInternal===t||(this.isHovered!==e&&(this.isHovered=e,this.attached()&&this.element().classList.toggle("hover",e)),this.showingInitiatorChainInternal!==t&&(this.showingInitiatorChainInternal=t,this.showingInitiatorChainChanged()),this.parentViewInternal.stylesChanged(),this.updateBackgroundColor())}showingInitiatorChainChanged(){}isOnInitiatorPath(){return!1}isOnInitiatedPath(){return!1}request(){return null}isNavigationRequest(){return!1}clearFlatNodes(){super.clearFlatNodes(),this.requestOrFirstKnownChildRequestInternal=null}requestOrFirstKnownChildRequest(){if(this.requestOrFirstKnownChildRequestInternal)return this.requestOrFirstKnownChildRequestInternal;let e=this.request();if(e||!this.hasChildren())return this.requestOrFirstKnownChildRequestInternal=e,this.requestOrFirstKnownChildRequestInternal;let t=null;const i=this.flatChildren();for(let r=0;r<i.length;r++)e=i[r].request(),(!t||e&&e.issueTime()<t.issueTime())&&(t=e);return this.requestOrFirstKnownChildRequestInternal=t,this.requestOrFirstKnownChildRequestInternal}}const we={Default:"--color-grid-default",Stripe:"--color-grid-stripe",Navigation:"--network-grid-navigation-color",Hovered:"--color-grid-hovered",InitiatorPath:"--network-grid-initiator-path-color",InitiatedPath:"--network-grid-initiated-path-color",Selected:"--color-grid-selected",FocusSelected:"--color-grid-focus-selected",FocusSelectedHasError:"--network-grid-focus-selected-color-has-error",FromFrame:"--network-grid-from-frame-color"};class ke extends me{nameCell;initiatorCell;requestInternal;isNavigationRequestInternal;selectable;isOnInitiatorPathInternal;isOnInitiatedPathInternal;linkifiedInitiatorAnchor;constructor(e,t){super(e),this.nameCell=null,this.initiatorCell=null,this.requestInternal=t,this.isNavigationRequestInternal=!1,this.selectable=!0,this.isOnInitiatorPathInternal=!1,this.isOnInitiatedPathInternal=!1}static NameComparator(e,t){const i=e.displayName().toLowerCase(),r=t.displayName().toLowerCase();if(i===r){const i=e.requestOrFirstKnownChildRequest(),r=t.requestOrFirstKnownChildRequest();return i&&r?i.identityCompare(r):i?-1:1}return i<r?-1:1}static RemoteAddressComparator(e,t){const i=e.requestOrFirstKnownChildRequest(),r=t.requestOrFirstKnownChildRequest();if(!i||!r)return i?1:-1;const o=i.remoteAddress(),s=r.remoteAddress();return o>s?1:s>o?-1:i.identityCompare(r)}static SizeComparator(e,t){const i=e.requestOrFirstKnownChildRequest(),r=t.requestOrFirstKnownChildRequest();return i&&r?r.cached()&&!i.cached()?1:i.cached()&&!r.cached()?-1:i.transferSize-r.transferSize||i.resourceSize-r.resourceSize||i.identityCompare(r):i?1:-1}static TypeComparator(e,t){const i=e.requestOrFirstKnownChildRequest(),r=t.requestOrFirstKnownChildRequest();if(!i||!r)return i?1:-1;const o=e.displayType(),s=t.displayType();return o>s?1:s>o?-1:i.identityCompare(r)}static InitiatorComparator(e,t){const i=e.requestOrFirstKnownChildRequest(),r=t.requestOrFirstKnownChildRequest();if(!i||!r)return i?1:-1;const o=e instanceof ke&&e.initiatorCell,s=t instanceof ke&&t.initiatorCell;if(!o||!s)return o?1:-1;const n=e,a=t,l=n.linkifiedInitiatorAnchor?n.linkifiedInitiatorAnchor.textContent||"":n.initiatorCell.title,d=a.linkifiedInitiatorAnchor?a.linkifiedInitiatorAnchor.textContent||"":a.initiatorCell.title;return l.localeCompare(d)}static InitiatorAddressSpaceComparator(e,t){const i=e.requestOrFirstKnownChildRequest(),r=t.requestOrFirstKnownChildRequest();if(!i||!r)return i?1:-1;const o=i.clientSecurityState(),s=r.clientSecurityState();return o&&s?o.initiatorIPAddressSpace.localeCompare(s.initiatorIPAddressSpace):o?1:-1}static RemoteAddressSpaceComparator(e,t){const i=e.requestOrFirstKnownChildRequest(),r=t.requestOrFirstKnownChildRequest();return i&&r?i.remoteAddressSpace().localeCompare(r.remoteAddressSpace()):i?1:-1}static RequestCookiesCountComparator(e,t){const i=e.requestOrFirstKnownChildRequest(),r=t.requestOrFirstKnownChildRequest();if(!i||!r)return i?1:-1;return i.includedRequestCookies().length-r.includedRequestCookies().length||i.identityCompare(r)}static ResponseCookiesCountComparator(e,t){const i=e.requestOrFirstKnownChildRequest(),r=t.requestOrFirstKnownChildRequest();if(!i||!r)return i?1:-1;return(i.responseCookies?i.responseCookies.length:0)-(r.responseCookies?r.responseCookies.length:0)||i.identityCompare(r)}static PriorityComparator(e,t){const i=e.requestOrFirstKnownChildRequest(),r=t.requestOrFirstKnownChildRequest();if(!i||!r)return i?1:-1;const o=i.priority();let s=o?w.NetworkPriorities.networkPriorityWeight(o):0;s=s||0;const n=r.priority();let a=n?w.NetworkPriorities.networkPriorityWeight(n):0;return a=a||0,s-a||i.identityCompare(r)}static RequestPropertyComparator(e,t,i){const r=t.requestOrFirstKnownChildRequest(),o=i.requestOrFirstKnownChildRequest();if(!r||!o)return r?1:-1;const s=r[e],n=o[e];return s===n?r.identityCompare(o):s>n?1:-1}static RequestURLComparator(e,t){const i=e.requestOrFirstKnownChildRequest(),r=t.requestOrFirstKnownChildRequest();if(!i||!r)return i?1:-1;const o=i.url(),s=r.url();return o===s?i.identityCompare(r):o>s?1:-1}static ResponseHeaderStringComparator(e,t,i){const r=t.requestOrFirstKnownChildRequest(),o=i.requestOrFirstKnownChildRequest();if(!r||!o)return r?1:-1;const s=String(r.responseHeaderValue(e)||""),n=String(o.responseHeaderValue(e)||"");return s.localeCompare(n)||r.identityCompare(o)}static ResponseHeaderNumberComparator(e,t,i){const r=t.requestOrFirstKnownChildRequest(),o=i.requestOrFirstKnownChildRequest();if(!r||!o)return r?1:-1;const s=r.responseHeaderValue(e),n=void 0!==s?parseFloat(s):-1/0,a=o.responseHeaderValue(e),l=void 0!==a?parseFloat(a):-1/0;return n===l?r.identityCompare(o):n>l?1:-1}static ResponseHeaderDateComparator(e,t,i){const r=t.requestOrFirstKnownChildRequest(),o=i.requestOrFirstKnownChildRequest();if(!r||!o)return r?1:-1;const s=r.responseHeaderValue(e),n=o.responseHeaderValue(e),a=s?new Date(s).getTime():-1/0,l=n?new Date(n).getTime():-1/0;return a===l?r.identityCompare(o):a>l?1:-1}showingInitiatorChainChanged(){const e=this.showingInitiatorChain(),t=a.NetworkLog.NetworkLog.instance().initiatorGraphForRequest(this.requestInternal);for(const i of t.initiators){if(i===this.requestInternal)continue;const t=this.parentView().nodeForRequest(i);t&&t.setIsOnInitiatorPath(e)}for(const i of t.initiated.keys()){if(i===this.requestInternal)continue;const t=this.parentView().nodeForRequest(i);t&&t.setIsOnInitiatedPath(e)}}setIsOnInitiatorPath(e){this.isOnInitiatorPathInternal!==e&&this.attached()&&(this.isOnInitiatorPathInternal=e,this.updateBackgroundColor())}isOnInitiatorPath(){return this.isOnInitiatorPathInternal}setIsOnInitiatedPath(e){this.isOnInitiatedPathInternal!==e&&this.attached()&&(this.isOnInitiatedPathInternal=e,this.updateBackgroundColor())}isOnInitiatedPath(){return this.isOnInitiatedPathInternal}displayType(){const t=this.requestInternal.mimeType||this