UNPKG

@react-native/debugger-frontend

Version:
2 lines • 269 kB
import*as e from"../../core/i18n/i18n.js";import*as t from"../../ui/legacy/legacy.js";import*as i from"../../core/common/common.js";import*as o from"../../core/sdk/sdk.js";import*as n from"../../third_party/codemirror.next/codemirror.next.js";import*as r from"../../ui/components/icon_button/icon_button.js";import*as s from"../../ui/components/text_editor/text_editor.js";import*as a from"../../ui/visual_logging/visual_logging.js";import*as c from"../../core/host/host.js";import*as l from"../../core/platform/platform.js";import{assertNotNullOrUndefined as d}from"../../core/platform/platform.js";import*as u from"../../models/bindings/bindings.js";import*as h from"../../models/persistence/persistence.js";import*as p from"../../models/source_map_scopes/source_map_scopes.js";import*as g from"../../models/text_utils/text_utils.js";import*as m from"../../ui/legacy/components/source_frame/source_frame.js";import*as b from"../coverage/coverage.js";import*as f from"../../models/workspace/workspace.js";import*as S from"../../ui/legacy/components/color_picker/color_picker.js";import*as v from"../../ui/legacy/components/inline_editor/inline_editor.js";import*as C from"../../models/breakpoints/breakpoints.js";import*as w from"../../models/formatter/formatter.js";import*as I from"../../ui/components/buttons/buttons.js";import*as y from"../../ui/legacy/components/object_ui/object_ui.js";import*as x from"./components/components.js";import*as k from"../../core/root/root.js";import*as T from"../../models/extensions/extensions.js";import*as E from"../snippets/snippets.js";import*as L from"../search/search.js";import*as M from"../../ui/legacy/components/quick_open/quick_open.js";import*as P from"../../models/issues_manager/issues_manager.js";import*as F from"../../ui/components/adorners/adorners.js";import*as D from"../../ui/components/issue_counter/issue_counter.js";import*as N from"../../ui/legacy/components/utils/utils.js";import{PanelUtils as A}from"../utils/utils.js";const U=new CSSStyleSheet;U.replaceSync(':host{padding:10px}.widget{align-items:center}label{white-space:nowrap}input[type="text"].add-source-map{box-shadow:0 0 0 1px var(--box-shadow-outline-color);font-size:inherit;margin:0 8px 0 5px}\n/*# sourceURL=dialog.css */\n');const B={sourceMapUrl:"Source map URL: ",debugInfoUrl:"DWARF symbols URL: ",add:"Add"},R=e.i18n.registerUIStrings("panels/sources/AddSourceMapURLDialog.ts",B),j=e.i18n.getLocalizedString.bind(void 0,R);class V extends t.Widget.HBox{input;dialog;callback;constructor(e,i,o){super(!0),this.contentElement.createChild("label").textContent=e,this.input=t.UIUtils.createInput("add-source-map","text","url"),this.input.addEventListener("keydown",this.onKeyDown.bind(this),!1),this.contentElement.appendChild(this.input);const n=t.UIUtils.createTextButton(j(B.add),this.apply.bind(this),{jslogContext:"add"});this.contentElement.appendChild(n),this.dialog=new t.Dialog.Dialog(i),this.dialog.setSizeBehavior("MeasureContent"),this.dialog.setDefaultFocusedElement(this.input),this.callback=o}static createAddSourceMapURLDialog(e){return new V(j(B.sourceMapUrl),"add-source-map-url",e)}static createAddDWARFSymbolsURLDialog(e){return new V(j(B.debugInfoUrl),"add-debug-info-url",e)}show(){super.show(this.dialog.contentElement),this.dialog.show()}done(e){this.dialog.hide(),this.callback(e)}apply(){this.done(this.input.value)}onKeyDown(e){"Enter"===e.key&&(e.consume(!0),this.apply())}wasShown(){super.wasShown(),this.registerCSSFiles([U])}}var W=Object.freeze({__proto__:null,AddDebugInfoURLDialog:V});const O=new CSSStyleSheet;O.replaceSync(":host{z-index:30;padding:4px;background-color:var(--sys-color-surface3);border-radius:7px;border:2px solid var(--sys-color-divider);width:90%;pointer-events:auto}:host(.sources-edit-breakpoint-dialog){border-radius:0;z-index:30;background-color:var(--sys-color-surface3);width:555px;pointer-events:auto;margin-left:-1px;padding:0 10px 10px 5px;border:1px solid var(--sys-color-divider)}:host-context(.sources-edit-breakpoint-dialog) .condition-editor{background-color:var(--sys-color-cdt-base-container);margin:0 6px 20px 3px}:host-context(.sources-edit-breakpoint-dialog) .source-frame-breakpoint-toolbar{font-family:sans-serif;font-size:12px}:host-context(.sources-edit-breakpoint-dialog) .link,\n.devtools-link{font-family:sans-serif;font-size:12px;margin:0 3px}:host-context(.sources-edit-breakpoint-dialog) devtools-icon.link-icon{vertical-align:sub;margin-right:0.5ch;color:var(--icon-link);width:16px;height:16px}:host-context(.sources-edit-breakpoint-dialog) .link-wrapper{display:inline-flex}:host-context(.sources-edit-breakpoint-dialog) .dialog-header{display:flex;justify-content:space-between;align-items:center}:host-context(.sources-edit-breakpoint-dialog) .dialog-header > devtools-icon:hover{color:var(--icon-default-hover)}\n/*# sourceURL=breakpointEditDialog.css */\n");const{Direction:H}=s.TextEditorHistory,_={breakpointType:"Breakpoint type",breakpoint:"Breakpoint",closeDialog:"Close edit dialog and save changes",conditionalBreakpoint:"Conditional breakpoint",logpoint:"Logpoint",expressionToCheckBeforePausingEg:"Expression to check before pausing, e.g. x > 5",pauseOnlyWhenTheConditionIsTrue:"Pause only when the condition is true",learnMoreOnBreakpointTypes:"Learn more: Breakpoint Types",logMessageEgXIsX:"Log message, e.g. `'x is', x`",logAMessageToConsoleDoNotBreak:"Log a message to Console, do not break"},z=e.i18n.registerUIStrings("panels/sources/BreakpointEditDialog.ts",_),q=e.i18n.getLocalizedString.bind(void 0,z);class $ extends t.Widget.Widget{onFinish;finished;editor;typeSelector;placeholderCompartment;#e;#t;constructor(e,o,c,l){super(!0);const d=[n.javascript.javascriptLanguage,s.Config.baseConfiguration(o||""),s.Config.closeBrackets.instance(),s.Config.autocompletion.instance(),n.EditorView.lineWrapping,s.Config.showCompletionHint,s.Config.conservativeCompletion,n.javascript.javascriptLanguage.data.of({autocomplete:e=>this.#t.historyCompletions(e)}),n.autocompletion(),s.JavaScript.argumentHints()];this.onFinish=l,this.finished=!1,this.element.tabIndex=-1,this.element.classList.add("sources-edit-breakpoint-dialog"),this.element.setAttribute("jslog",`${a.dialog("edit-breakpoint")}`);const u=this.contentElement.createChild("div","dialog-header"),h=new t.Toolbar.Toolbar("source-frame-breakpoint-toolbar",u);h.appendText(`Line ${e+1}:`),this.typeSelector=new t.Toolbar.ToolbarComboBox(this.onTypeChanged.bind(this),q(_.breakpointType),void 0,"type"),this.typeSelector.createOption(q(_.breakpoint),"REGULAR_BREAKPOINT");const p=this.typeSelector.createOption(q(_.conditionalBreakpoint),"CONDITIONAL_BREAKPOINT"),g=this.typeSelector.createOption(q(_.logpoint),"LOGPOINT");this.typeSelector.select(c?g:p),h.appendToolbarItem(this.typeSelector);const m=o||"",b=e=>(s.JavaScript.isExpressionComplete(e.state.doc.toString()).then((t=>{t?this.finishEditing(!0,this.editor.state.doc.toString()):n.insertNewlineAndIndent(e)})),!0),f=[{key:"ArrowUp",run:()=>this.#t.moveHistory(-1)},{key:"ArrowDown",run:()=>this.#t.moveHistory(1)},{mac:"Ctrl-p",run:()=>this.#t.moveHistory(-1,!0)},{mac:"Ctrl-n",run:()=>this.#t.moveHistory(1,!0)},{key:"Mod-Enter",run:b},{key:"Enter",run:b},{key:"Shift-Enter",run:n.insertNewlineAndIndent},{key:"Escape",run:()=>(this.finishEditing(!1,""),!0)}];this.placeholderCompartment=new n.Compartment;const S=this.contentElement.appendChild(document.createElement("div"));S.classList.add("condition-editor"),S.setAttribute("jslog",`${a.textField().track({change:!0})}`),this.editor=new s.TextEditor.TextEditor(n.EditorState.create({doc:m,selection:{anchor:0,head:m.length},extensions:[this.placeholderCompartment.of(this.getPlaceholder()),n.keymap.of(f),d]})),S.appendChild(this.editor);const v=new r.Icon.Icon;v.name="cross",v.title=q(_.closeDialog),v.setAttribute("jslog",`${a.close().track({click:!0})}`),v.onclick=()=>this.finishEditing(!0,this.editor.state.doc.toString()),u.appendChild(v),this.#e=new s.AutocompleteHistory.AutocompleteHistory(i.Settings.Settings.instance().createLocalSetting("breakpoint-condition-history",[])),this.#t=new s.TextEditorHistory.TextEditorHistory(this.editor,this.#e);const C=this.contentElement.appendChild(document.createElement("div"));C.classList.add("link-wrapper");const w=t.Fragment.html`<x-link class="link devtools-link" tabindex="0" href="https://goo.gle/devtools-loc" jslog="${a.link("learn-more")}">${q(_.learnMoreOnBreakpointTypes)}</x-link>`,I=new r.Icon.Icon;I.name="open-externally",I.classList.add("link-icon"),w.prepend(I),C.appendChild(w),this.updateTooltip()}saveAndFinish(){this.finishEditing(!0,this.editor.state.doc.toString())}focusEditor(){this.editor.editor.focus()}onTypeChanged(){"REGULAR_BREAKPOINT"!==this.breakpointType?(this.focusEditor(),this.editor.dispatch({effects:this.placeholderCompartment.reconfigure(this.getPlaceholder())}),this.updateTooltip()):this.finishEditing(!0,"")}get breakpointType(){const e=this.typeSelector.selectedOption();return e?e.value:null}getPlaceholder(){const e=this.breakpointType;return"CONDITIONAL_BREAKPOINT"===e?n.placeholder(q(_.expressionToCheckBeforePausingEg)):"LOGPOINT"===e?n.placeholder(q(_.logMessageEgXIsX)):[]}updateTooltip(){const e=this.breakpointType;"CONDITIONAL_BREAKPOINT"===e?t.Tooltip.Tooltip.install(this.typeSelector.element,q(_.pauseOnlyWhenTheConditionIsTrue)):"LOGPOINT"===e&&t.Tooltip.Tooltip.install(this.typeSelector.element,q(_.logAMessageToConsoleDoNotBreak))}finishEditing(e,t){if(this.finished)return;this.finished=!0,this.editor.remove(),this.#e.pushHistoryItem(t);const i="LOGPOINT"===this.breakpointType;this.onFinish({committed:e,condition:t,isLogpoint:i})}wasShown(){super.wasShown(),this.registerCSSFiles([O])}get editorForTest(){return this.editor}}var G=Object.freeze({__proto__:null,BreakpointEditDialog:$});const K=new CSSStyleSheet;K.replaceSync('.call-frame-warnings-message{text-align:center;font-style:italic;padding:4px;color:var(--sys-color-on-surface-yellow);background-color:var(--sys-color-surface-yellow)}.ignore-listed-message{padding:1px}.ignore-listed-message-label{color:var(--sys-color-token-subtle);align-items:center;display:flex}.show-more-message > .link{margin-left:5px}.show-more-message{text-align:center;font-style:italic;padding:4px;border-top:1px solid var(--sys-color-divider)}.call-frame-item{padding:3px 8px 3px 20px;position:relative;min-height:18px;line-height:15px;display:flex;flex-wrap:wrap}.call-frame-title-text{text-overflow:ellipsis;overflow:hidden}.async-header + .call-frame-item{border-top:0}.call-frame-item:not(.async-header){border-top:1px solid var(--sys-color-divider)}.call-frame-item-title,\n.call-frame-location{display:flex;white-space:nowrap}.async-header .call-frame-item-title{font-weight:bold;color:var(--sys-color-on-surface);background-color:var(--sys-color-cdt-base-container);margin-left:-5px;padding:0 5px;z-index:1}.call-frame-item:focus-visible,\n.call-frame-item.async-header:focus-visible .call-frame-item-title{background-color:var(--sys-color-tonal-container)}.ignore-listed-checkbox:focus-visible{outline-width:unset}.call-frame-item:not(.async-header):hover{background-color:var(--sys-color-state-hover-on-subtle)}.call-frame-location{color:var(--sys-color-token-subtle);margin-left:auto;padding:0 10px}.async-header::before{content:" ";width:100%;border-top:1px solid var(--sys-color-divider);margin-top:8px;position:absolute;left:0}.ignore-listed-call-frame{opacity:60%;font-style:italic}.selected-call-frame-icon{display:none;position:absolute;top:3px;left:4px}.call-frame-item.selected .selected-call-frame-icon{display:block}.call-frame-warning-icon{display:block;position:absolute;top:3px;right:4px}@media (forced-colors: active){.call-frame-item:focus-visible,\n .call-frame-item:not(.async-header):hover{forced-color-adjust:none;background-color:Highlight}.call-frame-item:focus-visible *,\n .call-frame-item:not(.async-header):hover *{color:HighlightText}}\n/*# sourceURL=callStackSidebarPane.css */\n');const J={callStack:"Call Stack",notPaused:"Not paused",onIgnoreList:"on ignore list",showIgnorelistedFrames:"Show ignore-listed frames",showMore:"Show more",copyStackTrace:"Copy stack trace",callFrameWarnings:"Some call frames have warnings",debugFileNotFound:'Failed to load debug file "{PH1}".',restartFrame:"Restart frame"},X=e.i18n.registerUIStrings("panels/sources/CallStackSidebarPane.ts",J),Y=e.i18n.getLocalizedString.bind(void 0,X);let Q;class Z extends t.View.SimpleView{ignoreListMessageElement;ignoreListCheckboxElement;notPausedMessageElement;callFrameWarningsElement;items;list;showMoreMessageElement;showIgnoreListed;locationPool;updateThrottler;maxAsyncStackChainDepth;updateItemThrottler;scheduledForUpdateItems;muteActivateItem;lastDebuggerModel=null;constructor(){super(Y(J.callStack),!0,"sources.callstack"),this.contentElement.setAttribute("jslog",`${a.section("sources.callstack")}`),({element:this.ignoreListMessageElement,checkbox:this.ignoreListCheckboxElement}=this.createIgnoreListMessageElementAndCheckbox()),this.contentElement.appendChild(this.ignoreListMessageElement),this.notPausedMessageElement=this.contentElement.createChild("div","gray-info-message"),this.notPausedMessageElement.textContent=Y(J.notPaused),this.notPausedMessageElement.tabIndex=-1,this.callFrameWarningsElement=this.contentElement.createChild("div","call-frame-warnings-message");const e=new r.Icon.Icon;e.data={iconName:"warning-filled",color:"var(--icon-warning)",width:"14px",height:"14px"},e.classList.add("call-frame-warning-icon"),this.callFrameWarningsElement.appendChild(e),this.callFrameWarningsElement.appendChild(document.createTextNode(Y(J.callFrameWarnings))),this.callFrameWarningsElement.tabIndex=-1,this.items=new t.ListModel.ListModel,this.list=new t.ListControl.ListControl(this.items,this,t.ListControl.ListMode.NonViewport),this.contentElement.appendChild(this.list.element),this.list.element.addEventListener("contextmenu",this.onContextMenu.bind(this),!1),self.onInvokeElement(this.list.element,(e=>{const t=this.list.itemForNode(e.target);t&&(this.activateItem(t),e.consume(!0))})),this.showMoreMessageElement=this.createShowMoreMessageElement(),this.showMoreMessageElement.classList.add("hidden"),this.contentElement.appendChild(this.showMoreMessageElement),this.showIgnoreListed=!1,this.locationPool=new u.LiveLocation.LiveLocationPool,this.updateThrottler=new i.Throttler.Throttler(100),this.maxAsyncStackChainDepth=te,this.update(),this.updateItemThrottler=new i.Throttler.Throttler(100),this.scheduledForUpdateItems=new Set,o.TargetManager.TargetManager.instance().addModelListener(o.DebuggerModel.DebuggerModel,o.DebuggerModel.Events.DebugInfoAttached,this.debugInfoAttached,this)}static instance(e={forceNew:null}){const{forceNew:t}=e;return Q&&!t||(Q=new Z),Q}flavorChanged(e){this.showIgnoreListed=!1,this.ignoreListCheckboxElement.checked=!1,this.maxAsyncStackChainDepth=te,this.update()}debugInfoAttached(){this.update()}setSourceMapSubscription(e){this.lastDebuggerModel!==e&&(this.lastDebuggerModel&&this.lastDebuggerModel.sourceMapManager().removeEventListener(o.SourceMapManager.Events.SourceMapAttached,this.debugInfoAttached,this),this.lastDebuggerModel=e,this.lastDebuggerModel&&this.lastDebuggerModel.sourceMapManager().addEventListener(o.SourceMapManager.Events.SourceMapAttached,this.debugInfoAttached,this))}update(){this.updateThrottler.schedule((()=>this.doUpdate()))}async doUpdate(){this.locationPool.disposeAll(),this.callFrameWarningsElement.classList.add("hidden");const e=t.Context.Context.instance().flavor(o.DebuggerModel.DebuggerPausedDetails);if(this.setSourceMapSubscription(e?.debuggerModel??null),!e)return this.notPausedMessageElement.classList.remove("hidden"),this.ignoreListMessageElement.classList.add("hidden"),this.showMoreMessageElement.classList.add("hidden"),this.items.replaceAll([]),void t.Context.Context.instance().setFlavor(o.DebuggerModel.CallFrame,null);this.notPausedMessageElement.classList.add("hidden");const i=[],n=new Set;for(const t of e.callFrames){const e=ie.createForDebuggerCallFrame(t,this.locationPool,this.refreshItem.bind(this));i.push(e),t.missingDebugInfoDetails&&n.add(t.missingDebugInfoDetails.details)}const r=await Promise.all(i);n.size&&(this.callFrameWarningsElement.classList.remove("hidden"),t.Tooltip.Tooltip.install(this.callFrameWarningsElement,Array.from(n).join("\n")));let s=e.debuggerModel,a=e.asyncStackTraceId,c=e.asyncStackTrace,l=e.callFrames;for(let{maxAsyncStackChainDepth:e}=this;e>0;--e){if(!c){if(!a)break;if(a.debuggerId){const e=await o.DebuggerModel.DebuggerModel.modelForDebuggerId(a.debuggerId);if(!e)break;s=e}if(c=await s.fetchAsyncStackTrace(a),!c)break}const e=t.UIUtils.asyncStackTraceLabel(c.description,l);r.push(...await ie.createItemsForAsyncStack(e,s,c.callFrames,this.locationPool,this.refreshItem.bind(this))),l=c.callFrames,a=c.parentId,c=c.parent}this.showMoreMessageElement.classList.toggle("hidden",!c),this.items.replaceAll(r);for(const e of this.items)this.refreshItem(e);if(this.maxAsyncStackChainDepth===te){this.list.selectNextItem(!0,!1);const e=this.list.selectedItem();e&&this.activateItem(e)}this.updatedForTest()}updatedForTest(){}refreshItem(e){this.scheduledForUpdateItems.add(e),this.updateItemThrottler.schedule((async()=>{const e=Array.from(this.scheduledForUpdateItems);if(this.scheduledForUpdateItems.clear(),this.muteActivateItem=!0,!this.showIgnoreListed&&this.items.every((e=>e.isIgnoreListed))){this.showIgnoreListed=!0;for(let e=0;e<this.items.length;++e)this.list.refreshItemByIndex(e);this.ignoreListMessageElement.classList.toggle("hidden",!0)}else{this.showIgnoreListed=this.ignoreListCheckboxElement.checked;const t=new Set(e);let i=!1;for(let e=0;e<this.items.length;++e){const o=this.items.at(e);t.has(o)&&this.list.refreshItemByIndex(e),i=i||o.isIgnoreListed}this.ignoreListMessageElement.classList.toggle("hidden",!i)}delete this.muteActivateItem}))}createElementForItem(e){const n=document.createElement("div");n.classList.add("call-frame-item");const s=n.createChild("div","call-frame-item-title").createChild("div","call-frame-title-text");if(s.textContent=e.title,e.isAsyncHeader)n.classList.add("async-header");else{t.Tooltip.Tooltip.install(s,e.title);const i=n.createChild("div","call-frame-location");i.textContent=l.StringUtilities.trimMiddle(e.linkText,30),t.Tooltip.Tooltip.install(i,e.linkText),n.classList.toggle("ignore-listed-call-frame",e.isIgnoreListed),e.isIgnoreListed&&t.ARIAUtils.setDescription(n,Y(J.onIgnoreList)),e.frame||t.ARIAUtils.setDisabled(n,!0)}const a=e.frame,c=a===t.Context.Context.instance().flavor(o.DebuggerModel.CallFrame);n.classList.toggle("selected",c),t.ARIAUtils.setSelected(n,c),n.classList.toggle("hidden",!this.showIgnoreListed&&e.isIgnoreListed);const d=new r.Icon.Icon;if(d.data={iconName:"large-arrow-right-filled",color:"var(--icon-arrow-main-thread)",width:"14px",height:"14px"},d.classList.add("selected-call-frame-icon"),n.appendChild(d),n.tabIndex=e===this.list.selectedItem()?0:-1,a&&a.missingDebugInfoDetails){const e=new r.Icon.Icon;e.data={iconName:"warning-filled",color:"var(--icon-warning)",width:"14px",height:"14px"},e.classList.add("call-frame-warning-icon");const o=a.missingDebugInfoDetails.resources.map((e=>Y(J.debugFileNotFound,{PH1:i.ParsedURL.ParsedURL.extractName(e.resourceUrl)})));t.Tooltip.Tooltip.install(e,[a.missingDebugInfoDetails.details,...o].join("\n")),n.appendChild(e)}return n}heightForItem(e){return console.assert(!1),0}isItemSelectable(e){return!0}selectedItemChanged(e,t,i,o){i&&(i.tabIndex=-1),o&&(this.setDefaultFocusedElement(o),o.tabIndex=0,this.hasFocus()&&o.focus())}updateSelectedItemARIA(e,t){return!0}createIgnoreListMessageElementAndCheckbox(){const e=document.createElement("div");e.classList.add("ignore-listed-message");const t=e.createChild("label");t.classList.add("ignore-listed-message-label");const i=t.createChild("input");i.tabIndex=0,i.type="checkbox",i.classList.add("ignore-listed-checkbox"),t.append(Y(J.showIgnorelistedFrames));return i.addEventListener("click",(()=>{this.showIgnoreListed=i.checked;for(const e of this.items)this.refreshItem(e)})),{element:e,checkbox:i}}createShowMoreMessageElement(){const e=document.createElement("div");e.classList.add("show-more-message"),e.createChild("span");const t=e.createChild("span","link");return t.textContent=Y(J.showMore),t.addEventListener("click",(()=>{this.maxAsyncStackChainDepth+=te,this.update()}),!1),e}onContextMenu(e){const i=this.list.itemForNode(e.target);if(!i)return;const o=new t.ContextMenu.ContextMenu(e),n=i.frame;n&&o.defaultSection().appendItem(Y(J.restartFrame),(()=>{c.userMetrics.actionTaken(c.UserMetrics.Action.StackFrameRestarted),n.restart()}),{disabled:!n.canBeRestarted,jslogContext:"restart-frame"}),o.defaultSection().appendItem(Y(J.copyStackTrace),this.copyStackTrace.bind(this),{jslogContext:"copy-stack-trace"}),i.uiLocation&&this.appendIgnoreListURLContextMenuItems(o,i.uiLocation.uiSourceCode),o.show()}onClick(e){const t=this.list.itemForNode(e.target);t&&this.activateItem(t)}activateItem(e){const n=e.uiLocation;if(this.muteActivateItem||!n)return;this.list.selectItem(e);const r=e.frame,s=this.activeCallFrameItem();r&&s!==e?(r.debuggerModel.setSelectedCallFrame(r),t.Context.Context.instance().setFlavor(o.DebuggerModel.CallFrame,r),s&&this.refreshItem(s),this.refreshItem(e)):i.Revealer.reveal(n)}activeCallFrameItem(){const e=t.Context.Context.instance().flavor(o.DebuggerModel.CallFrame);return e&&this.items.find((t=>t.frame===e))||null}appendIgnoreListURLContextMenuItems(e,t){const i=h.Persistence.PersistenceImpl.instance().binding(t);i&&(t=i.network);const o=e.section("ignoreList");if(!(o.items.length>0))for(const{text:e,callback:i,jslogContext:n}of u.IgnoreListManager.IgnoreListManager.instance().getIgnoreListURLContextMenuItems(t))o.appendItem(e,i,{jslogContext:n})}selectNextCallFrameOnStack(){const e=this.activeCallFrameItem();for(let t=e?this.items.indexOf(e)+1:0;t<this.items.length;t++){const e=this.items.at(t);if(e.frame){this.activateItem(e);break}}}selectPreviousCallFrameOnStack(){const e=this.activeCallFrameItem();for(let t=e?this.items.indexOf(e)-1:this.items.length-1;t>=0;t--){const e=this.items.at(t);if(e.frame){this.activateItem(e);break}}}copyStackTrace(){const e=[];for(const t of this.items){let i=t.title;t.uiLocation&&(i+=" ("+t.uiLocation.linkText(!0)+")"),e.push(i)}c.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(e.join("\n"))}wasShown(){super.wasShown(),this.registerCSSFiles([K])}}const ee=Symbol("element"),te=32;class ie{isIgnoreListed;title;linkText;uiLocation;isAsyncHeader;updateDelegate;frame;static async createForDebuggerCallFrame(e,i,o){const n=e.functionName,r=new ie(t.UIUtils.beautifyFunctionName(n),o,e);return await u.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().createCallFrameLiveLocation(e.location(),r.update.bind(r),i),p.NamesResolver.resolveDebuggerFrameFunctionName(e).then((e=>{e&&e!==n&&(r.title=e,r.updateDelegate(r))})),r}static async createItemsForAsyncStack(e,i,o,n,r){const s=new WeakMap,a=new ie(e,r);s.set(a,new Set),a.isAsyncHeader=!0;const c=[],l=[];for(const e of o){const o=new ie(t.UIUtils.beautifyFunctionName(e.functionName),d),r=i.createRawLocationByScriptId(e.scriptId,e.lineNumber,e.columnNumber);l.push(u.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().createCallFrameLiveLocation(r,o.update.bind(o),n)),c.push(o)}return await Promise.all(l),r(a),[a,...c];function d(e){r(e);let t=!1;const i=s.get(a);i&&(e.isIgnoreListed?(i.delete(e),t=0===i.size):(t=0===i.size,i.add(e)),a.isIgnoreListed=0===i.size),t&&r(a)}}constructor(e,t,i){this.isIgnoreListed=!1,this.title=e,this.linkText="",this.uiLocation=null,this.isAsyncHeader=!1,this.updateDelegate=t,this.frame=i}async update(e){const t=await e.uiLocation();this.isIgnoreListed=await e.isIgnoreListed(),this.linkText=t?t.linkText():"",this.uiLocation=t,this.updateDelegate(this)}}var oe=Object.freeze({__proto__:null,CallStackSidebarPane:Z,elementSymbol:ee,defaultMaxAsyncStackChainDepth:te,ActionDelegate:class{handleAction(e,t){switch(t){case"debugger.next-call-frame":return Z.instance().selectNextCallFrameOnStack(),!0;case"debugger.previous-call-frame":return Z.instance().selectPreviousCallFrameOnStack(),!0}return!1}},Item:ie});const ne={beforeBidderWorkletBiddingStart:"Bidder Bidding Phase Start",beforeBidderWorkletReportingStart:"Bidder Reporting Phase Start",beforeSellerWorkletScoringStart:"Seller Scoring Phase Start",beforeSellerWorkletReportingStart:"Seller Reporting Phase Start",setTimeoutOrIntervalFired:"{PH1} fired",scriptFirstStatement:"Script First Statement",scriptBlockedByContentSecurity:"Script Blocked by Content Security Policy",requestAnimationFrame:"Request Animation Frame",cancelAnimationFrame:"Cancel Animation Frame",animationFrameFired:"Animation Frame Fired",webglErrorFired:"WebGL Error Fired",webglWarningFired:"WebGL Warning Fired",setInnerhtml:"Set `innerHTML`",createCanvasContext:"Create canvas context",createAudiocontext:"Create `AudioContext`",closeAudiocontext:"Close `AudioContext`",resumeAudiocontext:"Resume `AudioContext`",suspendAudiocontext:"Suspend `AudioContext`",sinkViolations:"Sink Violations",policyViolations:"Policy Violations"},re=e.i18n.registerUIStrings("panels/sources/CategorizedBreakpointL10n.ts",ne),se=e.i18n.getLazilyComputedLocalizedString.bind(void 0,re);function ae(t){return(de.get(t)??e.i18n.lockedLazyString(t))()}const ce={beforeBidderWorkletBiddingStart:se(ne.beforeBidderWorkletBiddingStart),beforeBidderWorkletReportingStart:se(ne.beforeBidderWorkletReportingStart),beforeSellerWorkletScoringStart:se(ne.beforeSellerWorkletScoringStart),beforeSellerWorkletReportingStart:se(ne.beforeSellerWorkletReportingStart),setTimeout:e.i18n.lockedLazyString("setTimeout"),clearTimeout:e.i18n.lockedLazyString("clearTimeout"),"setTimeout.callback":se(ne.setTimeoutOrIntervalFired,{PH1:"setTimeout"}),setInterval:e.i18n.lockedLazyString("setInterval"),clearInterval:e.i18n.lockedLazyString("clearInterval"),"setInterval.callback":se(ne.setTimeoutOrIntervalFired,{PH1:"setInterval"}),scriptFirstStatement:se(ne.scriptFirstStatement),scriptBlockedByCSP:se(ne.scriptBlockedByContentSecurity),sharedStorageWorkletScriptFirstStatement:se(ne.scriptFirstStatement),requestAnimationFrame:se(ne.requestAnimationFrame),cancelAnimationFrame:se(ne.cancelAnimationFrame),"requestAnimationFrame.callback":se(ne.animationFrameFired),webglErrorFired:se(ne.webglErrorFired),webglWarningFired:se(ne.webglWarningFired),"Element.setInnerHTML":se(ne.setInnerhtml),canvasContextCreated:se(ne.createCanvasContext),"Geolocation.getCurrentPosition":e.i18n.lockedLazyString("getCurrentPosition"),"Geolocation.watchPosition":e.i18n.lockedLazyString("watchPosition"),"Notification.requestPermission":e.i18n.lockedLazyString("requestPermission"),"DOMWindow.close":e.i18n.lockedLazyString("window.close"),"Document.write":e.i18n.lockedLazyString("document.write"),audioContextCreated:se(ne.createAudiocontext),audioContextClosed:se(ne.closeAudiocontext),audioContextResumed:se(ne.resumeAudiocontext),audioContextSuspended:se(ne.suspendAudiocontext)},le={"trustedtype-policy-violation":se(ne.policyViolations),"trustedtype-sink-violation":se(ne.sinkViolations)},de=new Map([...Object.entries(ce),...Object.entries(le)]);var ue=Object.freeze({__proto__:null,getLocalizedBreakpointName:ae});class he{uiSourceCode;constructor(e,t){this.uiSourceCode=e}static accepts(e){return!1}willHide(){}rightToolbarItems(){return[]}leftToolbarItems(){return[]}populateLineGutterContextMenu(e,t){}populateTextAreaContextMenu(e,t,i){}decorationChanged(e,t){}editorExtension(){return[]}editorInitialized(e){}dispose(){}}var pe=Object.freeze({__proto__:null,Plugin:he});const ge={clickToShowCoveragePanel:"Click to show Coverage Panel",showDetails:"Show Details",coverageS:"Coverage: {PH1}",coverageNa:"Coverage: n/a"},me=e.i18n.registerUIStrings("panels/sources/CoveragePlugin.ts",ge),be=e.i18n.getLocalizedString.bind(void 0,me);class fe extends he{originalSourceCode;infoInToolbar;model;coverage;#i;constructor(e,i){super(e),this.originalSourceCode=this.uiSourceCode,this.#i=i,this.infoInToolbar=new t.Toolbar.ToolbarButton(be(ge.clickToShowCoveragePanel),void 0,void 0,"debugger.show-coverage"),this.infoInToolbar.setSecondary(),this.infoInToolbar.addEventListener("Click",(()=>{t.ViewManager.ViewManager.instance().showView("coverage")}));const n=o.TargetManager.TargetManager.instance().primaryPageTarget();n&&(this.model=n.model(b.CoverageModel.CoverageModel),this.model&&(this.model.addEventListener(b.CoverageModel.Events.CoverageReset,this.handleReset,this),this.coverage=this.model.getCoverageForUrl(this.originalSourceCode.url()),this.coverage&&this.coverage.addEventListener(b.CoverageModel.URLCoverageInfo.Events.SizesChanged,this.handleCoverageSizesChanged,this))),this.updateStats()}dispose(){this.coverage&&this.coverage.removeEventListener(b.CoverageModel.URLCoverageInfo.Events.SizesChanged,this.handleCoverageSizesChanged,this),this.model&&this.model.removeEventListener(b.CoverageModel.Events.CoverageReset,this.handleReset,this)}static accepts(e){return e.contentType().isDocumentOrScriptOrStyleSheet()}handleReset(){this.coverage=null,this.updateStats()}handleCoverageSizesChanged(){this.updateStats()}updateStats(){if(this.coverage){this.infoInToolbar.setTitle(be(ge.showDetails));const t=new Intl.NumberFormat(e.DevToolsLocale.DevToolsLocale.instance().locale,{style:"percent",maximumFractionDigits:1});this.infoInToolbar.setText(be(ge.coverageS,{PH1:t.format(this.coverage.usedPercentage())}))}else this.infoInToolbar.setTitle(be(ge.clickToShowCoveragePanel)),this.infoInToolbar.setText(be(ge.coverageNa))}rightToolbarItems(){return[this.infoInToolbar]}editorExtension(){return ye.of([])}getCoverageManager(){return this.uiSourceCode.getDecorationData("coverage")}editorInitialized(e){this.getCoverageManager()&&this.startDecoUpdate(e)}decorationChanged(e,t){"coverage"===e&&this.startDecoUpdate(t)}startDecoUpdate(e){const i=this.getCoverageManager();(i?i.usageByLine(this.uiSourceCode,this.#o(e)):Promise.resolve([])).then((i=>{const o=Boolean(e.state.field(Ie,!1));var r;i.length?o?e.dispatch({effects:we.of(i)}):e.dispatch({effects:ye.reconfigure([Ie.init((e=>Ce(i,e))),(r=this.uiSourceCode.url(),n.gutter({markers:e=>e.state.field(Ie),domEventHandlers:{click:()=>(t.ViewManager.ViewManager.instance().showView("coverage").then((()=>{const e=t.ViewManager.ViewManager.instance().view("coverage");return e&&e.widget()})).then((e=>{const t=r.match(/(.*):formatted$/),i=t&&t[1]||r;e.selectCoverageItemByUrl(i)})),!0)},class:"cm-coverageGutter"})),xe])}):o&&e.dispatch({effects:ye.reconfigure([])})}))}#o(e){const t=[];for(let i=1;i<=e.state.doc.lines;++i){const o=e.state.doc.line(i),{lineNumber:n,columnNumber:r}=this.#i.editorLocationToUILocation(i-1,0),{lineNumber:s,columnNumber:a}=this.#i.editorLocationToUILocation(i-1,o.length);t.push(new g.TextRange.TextRange(n,r,s,a))}return t}}const Se=new class extends n.GutterMarker{elementClass="cm-coverageUsed"},ve=new class extends n.GutterMarker{elementClass="cm-coverageUnused"};function Ce(e,t){const i=new n.RangeSetBuilder;for(let o=0;o<e.length;o++){const n=e[o];if(void 0!==n&&o<t.doc.lines){const e=t.doc.line(o+1).from;i.add(e,e,n?Se:ve)}}return i.finish()}const we=n.StateEffect.define(),Ie=n.StateField.define({create:()=>n.RangeSet.empty,update:(e,t)=>t.effects.reduce(((e,i)=>i.is(we)?Ce(i.value,t.state):e),e.map(t.changes))});const ye=new n.Compartment,xe=n.EditorView.baseTheme({".cm-coverageGutter":{width:"5px",marginLeft:"3px"},".cm-coverageUnused":{backgroundColor:"var(--app-color-coverage-unused)"},".cm-coverageUsed":{backgroundColor:"var(--app-color-coverage-used)"}});var ke=Object.freeze({__proto__:null,CoveragePlugin:fe});const Te={openColorPicker:"Open color picker.",openCubicBezierEditor:"Open cubic bezier editor.",addSourceMap:"Add source map…"},Ee=e.i18n.registerUIStrings("panels/sources/CSSPlugin.ts",Te),Le=e.i18n.getLocalizedString.bind(void 0,Ee),Me=new Set(["ColorLiteral","NumberLiteral","StringLiteral","Comment","Important"]);async function Pe(e,t,i){const r=n.syntaxTree(e.state).resolveInner(e.pos,-1);if("ClassName"===r.name){d(i);const e=function(e,t){const i=t.getStyleSheetIdsForURL(e);if(0===i.length)throw new Error("Can't find style sheet ID for current URL");return i[0]}(t.url(),i),o=await i.getClassNames(e);return{from:r.from,options:o.map((e=>({type:"constant",label:e})))}}const s=function(e,t){if(Me.has(e.name))return null;for(let i=e;i&&"StyleSheet"!==i.name&&"Styles"!==i.name&&"CallExpression"!==i.name;i=i.parent)if("Declaration"===i.name){const e=i.getChild("PropertyName"),o=i.getChild(":");return e&&o&&o.to<=t?e:null}return null}(r,e.pos);if(s){const t=o.CSSMetadata.cssMetadata().getPropertyValues(e.state.sliceDoc(s.from,s.to));return{from:"ValueName"===r.name?r.from:e.pos,options:t.map((e=>({type:"constant",label:e}))),validFor:/^[\w\P{ASCII}\-]+$/u}}return null}class Fe extends n.WidgetType{#n;#r;#s;constructor(e,t,i){super(),this.#r=e,this.#n=t,this.#s=i}eq(e){return this.#r.equal(e.#r)&&this.#n===e.#n&&this.#s===e.#s}toDOM(e){const t=new v.ColorSwatch.ColorSwatch(Le(Te.openColorPicker));t.renderColor(this.#r);const i=t.createChild("span");return i.textContent=this.#n,i.setAttribute("hidden","true"),t.addEventListener(v.ColorSwatch.ColorChangedEvent.eventName,(i=>{const o=i.data.color.getAuthoredText()??i.data.color.asString();e.dispatch({changes:{from:this.#s,to:this.#s+this.#n.length,insert:o}}),this.#n=o,this.#r=t.getColor()})),t.addEventListener(v.ColorSwatch.ClickEvent.eventName,(i=>{i.consume(!0),e.dispatch({effects:Ne.of({type:0,pos:e.posAtDOM(t),text:this.#n,swatch:t,color:this.#r})})})),t}ignoreEvent(){return!0}}class De extends n.WidgetType{curve;text;constructor(e,t){super(),this.curve=e,this.text=t}eq(e){return this.curve.asCSSText()===e.curve.asCSSText()&&this.text===e.text}toDOM(e){const i=v.Swatches.BezierSwatch.create();return i.setBezierText(this.text),t.Tooltip.Tooltip.install(i.iconElement(),Le(Te.openCubicBezierEditor)),i.iconElement().addEventListener("click",(t=>{t.consume(!0),e.dispatch({effects:Ne.of({type:1,pos:e.posAtDOM(i),text:this.text,swatch:i,curve:this.curve})})}),!1),i.hideText(!0),i}ignoreEvent(){return!0}}const Ne=n.StateEffect.define(),Ae=n.Annotation.define(),Ue=n.StateField.define({create:()=>null,update(e,t){!t.docChanged&&!t.selection||t.annotation(Ae)||(e=null);for(const i of t.effects)i.is(Ne)&&(e=i.value);return e},provide:e=>n.showTooltip.from(e,(e=>e&&function(e){return{pos:e.pos,arrow:!0,create(t){let i,o,n=e.text;if(0===e.type){const n=new S.Spectrum.Spectrum;o=e=>{n.addEventListener("ColorChanged",e)},n.addEventListener("SizeChanged",(()=>t.requestMeasure())),n.setColor(e.color),i=n,c.userMetrics.colorPickerOpenedFrom(0)}else{const t=new v.BezierEditor.BezierEditor(e.curve);i=t,o=e=>{t.addEventListener("BezierChanged",e)}}const r=document.createElement("div");return r.className="cm-tooltip-swatchEdit",i.markAsRoot(),i.show(r),i.showWidget(),i.element.addEventListener("keydown",(o=>{"Escape"===o.key&&(o.consume(),t.dispatch({effects:Ne.of(null),changes:n===e.text?void 0:{from:e.pos,to:e.pos+n.length,insert:e.text}}),i.hideWidget(),t.focus())})),i.element.addEventListener("focusout",(e=>{e.relatedTarget&&!i.element.contains(e.relatedTarget)&&(t.dispatch({effects:Ne.of(null)}),i.hideWidget())}),!1),i.element.addEventListener("mousedown",(e=>e.consume())),{dom:r,resize:!1,offset:{x:-8,y:0},mount:()=>{i.focus(),i.wasShown(),o((i=>{t.dispatch({changes:{from:e.pos,to:e.pos+n.length,insert:i.data},annotations:Ae.of(!0)}),n=i.data}))}}}}}(e)))});function Be(e,o,r){const s=new n.RangeSetBuilder;return function(e,o,r,s,a){let c=e.doc.lineAt(o);function l(t,i){return t>=c.to&&(c=e.doc.lineAt(t)),c.text.slice(t-c.from,i-c.from)}const d=n.ensureSyntaxTree(e,r,100);d&&d.iterate({from:o,to:r,enter:o=>{let n;if("ValueName"===o.name||"ColorLiteral"===o.name?n=l(o.from,o.to):"Callee"===o.name&&/^(?:(?:rgba?|hsla?|hwba?|lch|oklch|lab|oklab|color)|cubic-bezier)$/.test(l(o.from,o.to))&&(n=e.sliceDoc(o.from,o.node.parent.to)),n){const e=i.Color.parse(n);if(e)s(o.from,e,n);else{const e=t.Geometry.CubicBezier.parse(n);e&&a(o.from,e,n)}}}})}(e,o,r,((e,t,i)=>{s.add(e,e,n.Decoration.widget({widget:new Fe(t,i,e)}))}),((e,t,i)=>{s.add(e,e,n.Decoration.widget({widget:new De(t,i)}))})),s.finish()}const Re=n.ViewPlugin.fromClass(class{decorations;constructor(e){this.decorations=Be(e.state,e.viewport.from,e.viewport.to)}update(e){(e.viewportChanged||e.docChanged)&&(this.decorations=Be(e.state,e.view.viewport.from,e.view.viewport.to))}},{decorations:e=>e.decorations});function je(e){if("Unit"===e.name&&(e=e.parent),"NumberLiteral"===e.name){const t=e.lastChild;return{from:e.from,to:t&&"Unit"===t.name?t.from:e.to}}return null}function Ve(e,t){const{head:i}=e.state.selection.main,o=n.syntaxTree(e.state).resolveInner(i,-1),r=je(o)||je(o.resolve(i,1));if(!r)return!1;const s=Number(e.state.sliceDoc(r.from,r.to));return!isNaN(s)&&(e.dispatch({changes:{from:r.from,to:r.to,insert:String(s+t)},scrollIntoView:!0,userEvent:"insert.modifyUnit"}),!0)}function We(){let e=null;const i=t.ShortcutRegistry.ShortcutRegistry.instance().getShortcutListener({"sources.increment-css":()=>Promise.resolve(Ve(e,1)),"sources.increment-css-by-ten":()=>Promise.resolve(Ve(e,10)),"sources.decrement-css":()=>Promise.resolve(Ve(e,-1)),"sources.decrement-css-by-ten":()=>Promise.resolve(Ve(e,-10))});return n.EditorView.domEventHandlers({keydown:(t,o)=>{const n=e;return e=o,i(t),e=n,t.defaultPrevented}})}class Oe extends he{#a;constructor(e,t){super(e,t),o.TargetManager.TargetManager.instance().observeModels(o.CSSModel.CSSModel,this)}static accepts(e){return e.contentType().hasStyleSheets()}modelAdded(e){e.target()===o.TargetManager.TargetManager.instance().primaryPageTarget()&&(this.#a=e)}modelRemoved(e){this.#a===e&&(this.#a=void 0)}editorExtension(){return[We(),this.#c(),[Re,Ue]]}#c(){const{cssCompletionSource:e}=n.css,t=this.uiSourceCode,i=this.#a;return n.autocompletion({override:[async o=>await Pe(o,t,i)||e(o)]})}populateTextAreaContextMenu(e){const t=this.#a,i=this.uiSourceCode.url();if(this.uiSourceCode.project().type()===f.Workspace.projectTypes.Network&&t&&!u.IgnoreListManager.IgnoreListManager.instance().isUserIgnoreListedURL(i)){const o=Le(Te.addSourceMap);e.debugSection().appendItem(o,(()=>function(e,t){V.createAddSourceMapURLDialog((i=>{u.CSSWorkspaceBinding.CSSWorkspaceBinding.instance().modelToInfo.get(e)?.addSourceMap(t,i)})).show()}(t,i)),{jslogContext:"add-source-map"})}}}var He=Object.freeze({__proto__:null,cssBindings:We,CSSPlugin:Oe});const _e=new CSSStyleSheet;_e.replaceSync(".paused-status{margin:6px;padding:4px 10px;border-radius:10px;background-color:var(--sys-color-yellow-container);color:var(--sys-color-on-yellow-container)}.paused-status.error-reason{background-color:var(--sys-color-surface-error);color:var(--sys-color-on-surface-error)}.status-main{padding-left:18px;position:relative}.status-sub:not(:empty){padding-left:15px;padding-top:5px;overflow:hidden;text-overflow:ellipsis}.paused-status.error-reason .status-sub{color:var(--sys-color-error);line-height:11px;max-height:27px;user-select:text}devtools-icon{position:absolute;left:-1px;top:-1px}\n/*# sourceURL=debuggerPausedMessage.css */\n");const ze={pausedOnS:"Paused on {PH1}",childSAdded:"Child {PH1} added",descendantSAdded:"Descendant {PH1} added",descendantSRemoved:"Descendant {PH1} removed",pausedOnEventListener:"Paused on event listener",pausedOnXhrOrFetch:"Paused on XHR or fetch",pausedOnException:"Paused on exception",pausedOnPromiseRejection:"Paused on `promise` rejection",pausedOnAssertion:"Paused on assertion",pausedOnDebuggedFunction:"Paused on debugged function",pausedBeforePotentialOutofmemory:"Paused before potential out-of-memory crash",pausedOnCspViolation:"Paused on CSP violation",trustedTypeSinkViolation:"`Trusted Type` Sink Violation",trustedTypePolicyViolation:"`Trusted Type` Policy Violation",pausedOnBreakpoint:"Paused on breakpoint",debuggerPaused:"Debugger paused",subtreeModifications:"subtree modifications",attributeModifications:"attribute modifications",nodeRemoval:"node removal",webglErrorFiredS:"WebGL Error Fired ({PH1})",scriptBlockedDueToContent:"Script blocked due to Content Security Policy directive: {PH1}"},qe=e.i18n.registerUIStrings("panels/sources/DebuggerPausedMessage.ts",ze),$e=e.i18n.getLocalizedString.bind(void 0,qe),Ge=e.i18n.getLazilyComputedLocalizedString.bind(void 0,qe);class Ke{elementInternal;contentElement;constructor(){this.elementInternal=document.createElement("div"),this.elementInternal.classList.add("paused-message"),this.elementInternal.classList.add("flex-none"),this.elementInternal.setAttribute("jslog",`${a.dialog("debugger-paused")}`);const e=t.UIUtils.createShadowRootWithCoreStyles(this.elementInternal,{cssFile:[_e],delegatesFocus:void 0});this.contentElement=e.createChild("div"),t.ARIAUtils.markAsPoliteLiveRegion(this.elementInternal,!1)}element(){return this.elementInternal}static descriptionWithoutStack(e){const t=/^\s+at\s/m.exec(e);return t?e.substring(0,t.index-1):e.substring(0,e.lastIndexOf("\n"))}static async createDOMBreakpointHitMessage(t){const n=document.createElement("span"),s=t.debuggerModel.target().model(o.DOMDebuggerModel.DOMDebuggerModel);if(!t.auxData||!s)return n;const a=s.resolveDOMBreakpointData(t.auxData);if(!a)return n;const c=n.createChild("div","status-main"),l=new r.Icon.Icon;l.data={iconName:"info",color:"var(--sys-color-on-yellow-container)",width:"16px",height:"16px"},c.appendChild(l);const d=Je.get(a.type);c.appendChild(document.createTextNode($e(ze.pausedOnS,{PH1:d?d():String(null)})));const u=n.createChild("div","status-sub monospace"),h=await i.Linkifier.Linkifier.linkify(a.node);if(u.appendChild(h),a.targetNode){const t=await i.Linkifier.Linkifier.linkify(a.targetNode);let o;o=a.insertion?a.targetNode===a.node?e.i18n.getFormatLocalizedString(qe,ze.childSAdded,{PH1:t}):e.i18n.getFormatLocalizedString(qe,ze.descendantSAdded,{PH1:t}):e.i18n.getFormatLocalizedString(qe,ze.descendantSRemoved,{PH1:t}),u.appendChild(document.createElement("br")),u.appendChild(o)}return n}static#l(e){if(!e)return"";const{eventName:t,webglErrorName:i,directiveText:n,targetName:r}=e;if("instrumentation:webglErrorFired"===t&&i){const e=i.replace(/^.*(0x[0-9a-f]+).*$/i,"$1");return $e(ze.webglErrorFiredS,{PH1:e})}if("instrumentation:scriptBlockedByCSP"===t&&n)return $e(ze.scriptBlockedDueToContent,{PH1:n});let s=o.EventBreakpointsModel.EventBreakpointsManager.instance().resolveEventListenerBreakpoint(e);return s?ae(s.name):(s=o.DOMDebuggerModel.DOMDebuggerManager.instance().resolveEventListenerBreakpoint(e),s&&r?r+"."+s.name:s?.name??"")}async render(e,i,o){if(this.contentElement.removeChildren(),this.contentElement.hidden=!e,!e)return;const n=this.contentElement.createChild("div","paused-status"),s="exception"===e.reason||"promiseRejection"===e.reason||"assert"===e.reason||"OOM"===e.reason;let a;if("DOM"===e.reason)a=await Ke.createDOMBreakpointHitMessage(e);else if("EventListener"===e.reason){const t=Ke.#l(e.auxData);a=c($e(ze.pausedOnEventListener),t)}else if("XHR"===e.reason){const t=e.auxData;a=c($e(ze.pausedOnXhrOrFetch),t.url||"")}else if("exception"===e.reason){const t=e.auxData,i=t.description||t.value||"",o=Ke.descriptionWithoutStack(i);a=c($e(ze.pausedOnException),o,i)}else if("promiseRejection"===e.reason){const t=e.auxData,i=t.description||t.value||"",o=Ke.descriptionWithoutStack(i);a=c($e(ze.pausedOnPromiseRejection),o,i)}else if("assert"===e.reason)a=c($e(ze.pausedOnAssertion));else if("debugCommand"===e.reason)a=c($e(ze.pausedOnDebuggedFunction));else if("OOM"===e.reason)a=c($e(ze.pausedBeforePotentialOutofmemory));else if("CSPViolation"===e.reason&&e.auxData&&e.auxData.violationType){const t=e.auxData.violationType;"trustedtype-sink-violation"===t?a=c($e(ze.pausedOnCspViolation),$e(ze.trustedTypeSinkViolation)):"trustedtype-policy-violation"===t&&(a=c($e(ze.pausedOnCspViolation),$e(ze.trustedTypePolicyViolation)))}else if(e.callFrames.length){const t=await i.rawLocationToUILocation(e.callFrames[0].location()),n=t?o.findBreakpoint(t):null;a=c($e(n?ze.pausedOnBreakpoint:ze.debuggerPaused))}else console.warn("ScriptsPanel paused, but callFrames.length is zero.");function c(e,i,o){const n=document.createElement("span"),a=n.createChild("div","status-main"),c=new r.Icon.Icon;if(c.data={iconName:s?"cross-circle-filled":"info",color:s?"var(--icon-error)":"var(--sys-color-on-yellow-container)",width:"16px",height:"16px"},a.appendChild(c),a.appendChild(document.createTextNode(e)),i){const e=n.createChild("div","status-sub monospace");e.textContent=i,t.Tooltip.Tooltip.install(e,o||i)}return n}n.classList.toggle("error-reason",s),a&&n.appendChild(a)}}const Je=new Map([["subtree-modified",Ge(ze.subtreeModifications)],["attribute-modified",Ge(ze.attributeModifications)],["node-removed",Ge(ze.nodeRemoval)]]);var Xe=Object.freeze({__proto__:null,DebuggerPausedMessage:Ke,BreakpointTypeNouns:Je});const Ye=new CSSStyleSheet;Ye.replaceSync(":host{overflow-y:auto}.icon,\n.icon-basic,\n.icon-badge{margin:-3px -5px}.navigator-fs-tree-item:not(.has-mapped-files):not(.selected) > :not(.selection),\n.navigator-fs-folder-tree-item:not(.has-mapped-files):not(.selected) > :not(.selection){filter:grayscale(50%);opacity:50%}.is-ignore-listed{opacity:50%}.tree-outline li{min-height:20px}.tree-outline li:hover:not(.selected) .selection{display:block;background-color:var(--sys-color-state-hover-on-subtle)}.navigator-fs-folder-tree-item devtools-icon{color:var(--icon-folder-workspace)}.navigator-fs-tree-item devtools-icon{color:var(--icon-file-authored)}.navigator-nw-folder-tree-item devtools-icon{color:var(--icon-folder-deployed)}.navigator-sm-script-tree-item devtools-icon,\n.navigator-script-tree-item devtools-icon,\n.navigator-snippet-tree-item devtools-icon{color:var(--icon-file-script)}.navigator-file-tree-item devtools-icon.dot::before{width:7px;height:7px;top:12px;left:11px}.navigator-file-tree-item:hover:not(.force-white-icons) devtools-icon.dot::before{outline-color:var(--icon-gap-hover)}.navigator-file-tree-item.selected:not(.force-white-icons) devtools-icon.dot::before{outline-color:var(--icon-gap-inactive)}.navigator-file-tree-item.selected.force-white-icons devtools-icon.dot::before{outline-color:var(--icon-gap-focus-selected)}.navigator-sm-stylesheet-tree-item devtools-icon,\n.navigator-stylesheet-tree-item devtools-icon{color:var(--icon-file-styles)}.navigator-image-tree-item devtools-icon,\n.navigator-font-tree-item devtools-icon{color:var(--icon-file-image)}.navigator-nw-folder-tree-item.is-from-source-map devtools-icon{color:var(--icon-folder-authored)}.tree-outline:not(:has(.navigator-deployed-tree-item)) .navigator-sm-folder-tree-item .tree-element-title,\n.tree-outline:not(:has(.navigator-deployed-tree-item)) .navigator-sm-script-tree-item .tree-element-title,\n.tree-outline:not(:has(.navigator-deployed-tree-item)) .navigator-sm-stylesheet-tree-item .tree-element-title{font-style:italic}@media (forced-colors: active){.tree-outline li .leading-icons devtools-icon{color:ButtonText}.tree-outline li:hover:not(.selected) .selection{forced-color-adjust:none;background-color:Highlight}.tree-outline:not(.hide-selection-when-blurred) li.parent:hover:not(.selected)::before{background-color:HighlightText}.tree-outline:not(.hide-selection-when-blurred) li:hover:not(.selected) devtools-icon,\n .tree-outline li:not(.selected):hover .tree-element-title{forced-color-adjust:none;color:HighlightText}.navigator-fs-tree-item:not(.has-mapped-files):not(.selected) > :not(.selection),\n .navigator-fs-folder-tree-item:not(.has-mapped-files):not(.selected) > :not(.selection),\n .is-ignore-listed{filter:none;opacity:100%}}\n/*# sourceURL=navigatorTree.css */\n");const Qe=new CSSStyleSheet;Qe.replaceSync(".navigator-toolbar{border-bottom:1px solid var(--sys-color-divider);padding-left:8px}\n/*# sourceURL=navigatorView.css */\n");class Ze{searchId;searchResultCandidates;searchResultCallback;searchFinishedCallback;searchConfig;constructor(){this.searchId=0,this.searchResultCandidates=[],this.searchResultCallback=null,this.searchFinishedCallback=null,this.searchConfig=null}static filesComparator(e,t){if(e.isDirty()&&!t.isDirty())return-1;if(!e.isDirty()&&t.isDirty())return 1;const i=e.project().type()===f.Workspace.projectTypes.FileSystem&&!h.Persistence.PersistenceImpl.instance().binding(e);if(i!==(t.project().type()===f.Workspace.projectTypes.FileSystem&&!h.Persistence.PersistenceImpl.instance().binding(t)))return i?1:-1;const o=e.url(),n=t.url();return o&&!n?-1:!o&&n?1:l.StringUtilities.naturalOrderComparator(e.fullDisplayName(),t.fullDisplayName())}static urlComparator(e,t){return l.StringUtilities.naturalOrderComparator(e.url(),t.url())}performIndexing(e){this.stopSearch();const t=this.projects(),o=new i.Progress.CompositeProgress(e);for(let e=0;e<t.length;++e){const i=t[e],n=o.createSubProgress([...i.uiSourceCodes()].length);i.indexContent(n)}}projects(){const e=i.Settings.Settings.instance().moduleSetting("search-in-anonymous-and-content-scripts").get();return f.Workspace.WorkspaceImpl.instance().projects().filter((t=>t.type()!==f.Workspace.projectTypes.Service&&(!(!e&&t.isServiceProject()&&t.type()!==f.Workspace.projectTypes.Formatter)&&!(!e&&t.type()===f.Workspace.projectTypes.ContentScripts))))}performSearch(e,t,o,n){this.stopSearch(),this.searchResultCandidates=[],this.searchResultCallback=o,this.searchFinishedCallback=n,this.searchConfig=e;const r=[],s=new i.Progress.CompositeProgress(t),a=s.createSubProgress(),c=new i.Progress.CompositeProgress(s.createSubProgress());for(const t of this.projects()){const i=[...t.uiSourceCodes()].length,o=c.createSubProgress(i),n=this.projectFilesMatchingFileQuery(t,e),s=t.findFilesMatchingSearchRequest(e,n,o).then(this.processMatchingFilesForProject.bind(this,this.searchI