import*as i18n from"../i18n/i18n.js";import*as SDK from"../sdk/sdk.js";import*as UI from"../ui/ui.js";const UIStrings={networkThrottlingIsEnabled:"Network throttling is enabled",requestsMayBeRewrittenByLocal:"Requests may be rewritten by local overrides",requestsMayBeBlocked:"Requests may be blocked"},str_=i18n.i18n.registerUIStrings("mobile_throttling/NetworkPanelIndicator.ts",UIStrings),i18nString=i18n.i18n.getLocalizedString.bind(void 0,str_);export class NetworkPanelIndicator{constructor(){if(!UI.InspectorView.InspectorView.instance().hasPanel("network"))return;const t=SDK.NetworkManager.MultitargetNetworkManager.instance();function e(){let e=null;t.isThrottling()?(e=UI.Icon.Icon.create("smallicon-warning"),UI.Tooltip.Tooltip.install(e,i18nString(UIStrings.networkThrottlingIsEnabled))):SDK.NetworkManager.MultitargetNetworkManager.instance().isIntercepting()?(e=UI.Icon.Icon.create("smallicon-warning"),UI.Tooltip.Tooltip.install(e,i18nString(UIStrings.requestsMayBeRewrittenByLocal))):t.isBlocking()&&(e=UI.Icon.Icon.create("smallicon-warning"),UI.Tooltip.Tooltip.install(e,i18nString(UIStrings.requestsMayBeBlocked))),UI.InspectorView.InspectorView.instance().setPanelIcon("network",e)}t.addEventListener(SDK.NetworkManager.MultitargetNetworkManager.Events.ConditionsChanged,e),t.addEventListener(SDK.NetworkManager.MultitargetNetworkManager.Events.BlockedPatternsChanged,e),t.addEventListener(SDK.NetworkManager.MultitargetNetworkManager.Events.InterceptorsChanged,e),e()}}