UNPKG

@react-native/debugger-frontend

Version:
1 lines 393 kB
import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as i from"../../core/platform/platform.js";import*as n from"../../core/root/root.js";import*as s from"../visual_logging/visual_logging.js";import*as o from"../components/buttons/buttons.js";import*as r from"../components/icon_button/icon_button.js";import*as a from"../../core/host/host.js";import*as l from"../../core/sdk/sdk.js";import"../../core/dom_extension/dom_extension.js";import*as d from"../lit/lit.js";import{html as h,render as c}from"../lit/lit.js";import*as u from"./theme_support/theme_support.js";import*as m from"../components/settings/settings.js";import*as p from"../../models/text_utils/text_utils.js";let g;class b{#e=new Map;#t=new Map;constructor(){}static instance(e={forceNew:null}){const{forceNew:t}=e;return g&&!t||(g=new b),g}static removeInstance(){g=void 0}setFlavor(e,t){(this.#e.get(e)||null)!==t&&(t?this.#e.set(e,t):this.#e.delete(e),this.#i(e,t))}#i(e,t){for(const i of v)i.contextTypes().includes(e)&&i.loadListener().then((e=>e.flavorChanged(t)));const i=this.#t.get(e);i&&i.dispatchEventToListeners("FlavorChanged",t)}addFlavorChangeListener(t,i,n){let s=this.#t.get(t);s||(s=new e.ObjectWrapper.ObjectWrapper,this.#t.set(t,s)),s.addEventListener("FlavorChanged",i,n)}removeFlavorChangeListener(e,t,i){const n=this.#t.get(e);n&&(n.removeEventListener("FlavorChanged",t,i),n.hasEventListeners("FlavorChanged")||this.#t.delete(e))}flavor(e){return this.#e.get(e)||null}flavors(){return new Set(this.#e.keys())}}const v=[];var f=Object.freeze({__proto__:null,Context:b,registerListener:function(e){v.push(e)}});const w={elements:"Elements",screenshot:"Screenshot",network:"Network",memory:"Memory",javascript_profiler:"JavaScript Profiler",console:"Console",performance:"Performance",mobile:"Mobile",help:"Help",layers:"Layers",navigation:"Navigation",drawer:"Drawer",global:"Global",resources:"Resources",background_services:"Background Services",settings:"Settings",debugger:"Debugger",sources:"Sources",rendering:"Rendering",recorder:"Recorder",changes:"Changes"},x=t.i18n.registerUIStrings("ui/legacy/ActionRegistration.ts",w),y=t.i18n.getLocalizedString.bind(void 0,x);class E extends e.ObjectWrapper.ObjectWrapper{enabledInternal=!0;toggledInternal=!1;actionRegistration;constructor(e){super(),this.actionRegistration=e}id(){return this.actionRegistration.actionId}async execute(){if(!this.actionRegistration.loadActionDelegate)return!1;const e=await this.actionRegistration.loadActionDelegate(),t=this.id();return e.handleAction(b.instance(),t)}icon(){return this.actionRegistration.iconClass}toggledIcon(){return this.actionRegistration.toggledIconClass}toggleWithRedColor(){return Boolean(this.actionRegistration.toggleWithRedColor)}setEnabled(e){this.enabledInternal!==e&&(this.enabledInternal=e,this.dispatchEventToListeners("Enabled",e))}enabled(){return this.enabledInternal}category(){return this.actionRegistration.category}tags(){if(this.actionRegistration.tags)return this.actionRegistration.tags.map((e=>e())).join("\0")}toggleable(){return Boolean(this.actionRegistration.toggleable)}title(){let e=this.actionRegistration.title?this.actionRegistration.title():t.i18n.lockedString("");const i=this.actionRegistration.options;if(i)for(const t of i)t.value!==this.toggledInternal&&(e=t.title());return e}toggled(){return this.toggledInternal}setToggled(e){console.assert(this.toggleable(),"Shouldn't be toggling an untoggleable action",this.id()),this.toggledInternal!==e&&(this.toggledInternal=e,this.dispatchEventToListeners("Toggled",e))}options(){return this.actionRegistration.options}contextTypes(){if(this.actionRegistration.contextTypes)return this.actionRegistration.contextTypes()}canInstantiate(){return Boolean(this.actionRegistration.loadActionDelegate)}bindings(){return this.actionRegistration.bindings}experiment(){return this.actionRegistration.experiment}setting(){return this.actionRegistration.setting}condition(){return this.actionRegistration.condition}order(){return this.actionRegistration.order}}const I=new Map;function S(){I.clear()}function C(){return Array.from(I.values()).filter((t=>{const i=t.setting();try{if(i&&!e.Settings.moduleSetting(i).get())return!1}catch(e){if(e.message.startsWith("No setting registered"))return!1}return n.Runtime.Runtime.isDescriptorEnabled({experiment:t.experiment(),condition:t.condition()})})).sort(((e,t)=>(e.order()||0)-(t.order()||0)))}var T=Object.freeze({__proto__:null,Action:E,getLocalizedActionCategory:function(e){switch(e){case"ELEMENTS":return y(w.elements);case"SCREENSHOT":return y(w.screenshot);case"NETWORK":return y(w.network);case"MEMORY":return y(w.memory);case"JAVASCRIPT_PROFILER":return y(w.javascript_profiler);case"CONSOLE":return y(w.console);case"PERFORMANCE":return y(w.performance);case"MOBILE":return y(w.mobile);case"HELP":return y(w.help);case"LAYERS":return y(w.layers);case"NAVIGATION":return y(w.navigation);case"DRAWER":return y(w.drawer);case"GLOBAL":return y(w.global);case"RESOURCES":return y(w.resources);case"BACKGROUND_SERVICES":return y(w.background_services);case"SETTINGS":return y(w.settings);case"DEBUGGER":return y(w.debugger);case"SOURCES":return y(w.sources);case"RENDERING":return y(w.rendering);case"RECORDER":return y(w.recorder);case"CHANGES":return y(w.changes);case"":return t.i18n.lockedString("")}return t.i18n.lockedString(e)},getRegisteredActionExtensions:C,maybeRemoveActionExtension:function(e){return I.delete(e)},registerActionExtension:function(e){const t=e.actionId;if(I.has(t))throw new Error(`Duplicate action ID '${t}'`);if(!i.StringUtilities.isExtendedKebabCase(t))throw new Error(`Invalid action ID '${t}'`);I.set(t,new E(e))},reset:S});let k;class M{actionsById;constructor(){this.actionsById=new Map,this.registerActions()}static instance(e={forceNew:null}){const{forceNew:t}=e;return k&&!t||(k=new M),k}static removeInstance(){k=void 0}static reset(){M.removeInstance(),S()}registerActions(){for(const e of C())this.actionsById.set(e.id(),e),e.canInstantiate()||e.setEnabled(!1)}availableActions(){return this.applicableActions([...this.actionsById.keys()],b.instance())}actions(){return[...this.actionsById.values()]}applicableActions(e,t){const i=[];for(const s of e){const e=this.actionsById.get(s);e?.enabled()&&n(e,t.flavors())&&i.push(e)}return i;function n(e,t){const i=e.contextTypes();if(!i)return!0;for(let e=0;e<i.length;++e){const n=i[e];if(Boolean(n)&&t.has(n))return!0}return!1}}hasAction(e){return this.actionsById.has(e)}getAction(e){const t=this.actionsById.get(e);if(t)return t;throw new Error(`Cannot find registered action with ID '${e}'`)}}var L=Object.freeze({__proto__:null,ActionRegistry:M}),P={cssText:`.widget{border-radius:var(--sys-shape-corner-small);box-shadow:var(--sys-elevation-level3);background:var(--sys-color-cdt-base-container);justify-content:flex-start;align-items:stretch;display:flex;min-width:min(100vw,var(--sys-size-30))}.dialog-close-button{position:absolute;right:9px;top:9px;z-index:1}\n/*# sourceURL=${import.meta.resolve("./dialog.css")} */\n`},D={cssText:`:host{position:absolute!important;inset:0;overflow:hidden;contain:strict;background-color:transparent}:host-context(.dimmed-pane){background-color:var(--sys-color-state-scrim)}:host-context(.no-pointer-events){pointer-events:none}.widget{display:flex;background-color:transparent;pointer-events:auto;flex:none}.no-pointer-events{pointer-events:none}\n/*# sourceURL=${import.meta.resolve("./glassPane.css")} */\n`};class A{descriptors;action;type;keybindSets;constructor(e,t,i,n){this.descriptors=e,this.action=t,this.type=i,this.keybindSets=n||new Set}title(){return this.descriptors.map((e=>e.name)).join(" ")}isDefault(){return"DefaultShortcut"===this.type||"DisabledDefault"===this.type||"KeybindSetShortcut"===this.type&&this.keybindSets.has(ee)}changeType(e){return new A(this.descriptors,this.action,e)}changeKeys(e){return this.descriptors=e,this}descriptorsMatch(e){return e.length===this.descriptors.length&&e.every(((e,t)=>e.key===this.descriptors[t].key))}hasKeybindSet(e){return!this.keybindSets||this.keybindSets.has(e)}equals(e){return this.descriptorsMatch(e.descriptors)&&this.type===e.type&&this.action===e.action}static createShortcutFromSettingObject(e){return new A(e.descriptors,e.action,e.type)}static makeKey(e,t){return"string"==typeof e&&(e=e.charCodeAt(0)-(/^[a-z]/.test(e)?32:0)),t=t||z.None.value,A.makeKeyFromCodeAndModifiers(e,t)}static makeKeyFromEvent(e){let t=z.None.value;e.shiftKey&&(t|=z.Shift.value),e.ctrlKey&&(t|=z.Ctrl.value),e.altKey&&(t|=z.Alt.value),e.metaKey&&(t|=z.Meta.value);const i=e.keyCode||e.__keyCode;return A.makeKeyFromCodeAndModifiers(i,t)}static eventHasCtrlEquivalentKey(e){return a.Platform.isMac()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}static eventHasEitherCtrlOrMeta(e){return e.metaKey||e.ctrlKey}static hasNoModifiers(e){const t=e;return!(t.ctrlKey||t.shiftKey||t.altKey||t.metaKey)}static hasAtLeastOneModifier(e){return!1===A.hasNoModifiers(e)}static makeDescriptor(e,t){return{key:A.makeKey("string"==typeof e?e:e.code,t),name:A.shortcutToString(e,t)}}static makeDescriptorFromBindingShortcut(e){const[t,...i]=e.split(/\+(?!$)/).reverse();let n=0;for(const t of i){const i=z[t].value;console.assert(void 0!==i,`Only one key other than modifier is allowed in shortcut <${e}>`),n|=i}console.assert(t.length>0,`Modifiers-only shortcuts are not allowed (encountered <${e}>)`);const s=K[t]||$[t];return s&&"shiftKey"in s&&s.shiftKey&&(n|=z.Shift.value),A.makeDescriptor(s||t,n)}static shortcutToString(e,t){return"string"!=typeof e&&A.isModifier(e.code)?A.modifiersToString(t):A.modifiersToString(t)+A.keyName(e)}static keyName(e){return"string"==typeof e?e.toUpperCase():"string"==typeof e.name?e.name:e.name[a.Platform.platform()]||e.name.other||""}static makeKeyFromCodeAndModifiers(e,t){return 255&e|(t||0)<<8}static keyCodeAndModifiersFromKey(e){return{keyCode:255&e,modifiers:e>>8}}static isModifier(e){const{keyCode:t}=A.keyCodeAndModifiersFromKey(e);return t===K.Shift.code||t===K.Ctrl.code||t===K.Alt.code||t===K.Meta.code}static modifiersToString(e){const t=a.Platform.isMac(),i=z,n=new Map([[i.Ctrl,t?"Ctrl ":"Ctrl + "],[i.Alt,t?"⌥ ":"Alt + "],[i.Shift,t?"⇧ ":"Shift + "],[i.Meta,t?"⌘ ":"Win + "]]);return[i.Meta,i.Ctrl,i.Alt,i.Shift].map((function(t){return(e||0)&t.value?n.get(t):""})).join("")}}const z={None:{value:0,name:"None"},Shift:{value:1,name:"Shift"},Ctrl:{value:2,name:"Ctrl"},Alt:{value:4,name:"Alt"},Meta:{value:8,name:"Meta"},CtrlOrMeta:{value:a.Platform.isMac()?8:2,name:a.Platform.isMac()?"Meta":"Ctrl"},ShiftOrOption:{value:a.Platform.isMac()?4:1,name:a.Platform.isMac()?"Alt":"Shift"}},R={code:37,name:"←"},B={code:38,name:"↑"},O={code:39,name:"→"},F={code:40,name:"↓"},W={code:17,name:"Ctrl"},H={code:27,name:"Esc"},N={code:32,name:"Space"},j={code:187,name:"+"},V={code:192,name:"`"},U={code:222,name:"'"},_={code:91,name:"Meta"},K={Backspace:{code:8,name:"↤"},Tab:{code:9,name:{mac:"⇥",other:"Tab"}},Enter:{code:13,name:{mac:"↩",other:"Enter"}},Shift:{code:16,name:{mac:"⇧",other:"Shift"}},Ctrl:W,Control:W,Alt:{code:18,name:"Alt"},Esc:H,Escape:H,Space:N," ":N,PageUp:{code:33,name:{mac:"⇞",other:"PageUp"}},PageDown:{code:34,name:{mac:"⇟",other:"PageDown"}},End:{code:35,name:{mac:"↗",other:"End"}},Home:{code:36,name:{mac:"↖",other:"Home"}},Left:R,Up:B,Right:O,Down:F,ArrowLeft:R,ArrowUp:B,ArrowRight:O,ArrowDown:F,Delete:{code:46,name:"Del"},Zero:{code:48,name:"0"},C:{code:67,name:"C"},H:{code:72,name:"H"},N:{code:78,name:"N"},P:{code:80,name:"P"},R:{code:82,name:"R"},U:{code:85,name:"U"},V:{code:86,name:"V"},X:{code:88,name:"X"},Meta:_,F1:{code:112,name:"F1"},F2:{code:113,name:"F2"},F3:{code:114,name:"F3"},F4:{code:115,name:"F4"},F5:{code:116,name:"F5"},F6:{code:117,name:"F6"},F7:{code:118,name:"F7"},F8:{code:119,name:"F8"},F9:{code:120,name:"F9"},F10:{code:121,name:"F10"},F11:{code:122,name:"F11"},F12:{code:123,name:"F12"},Semicolon:{code:186,name:";"},NumpadPlus:{code:107,name:"Numpad +"},NumpadMinus:{code:109,name:"Numpad -"},Numpad0:{code:96,name:"Numpad 0"},Plus:j,Equal:j,Comma:{code:188,name:","},Minus:{code:189,name:"-"},Period:{code:190,name:"."},Slash:{code:191,name:"/"},QuestionMark:{code:191,name:"?"},Apostrophe:V,Tilde:{code:192,name:"Tilde"},Backquote:V,IntlBackslash:V,LeftSquareBracket:{code:219,name:"["},RightSquareBracket:{code:221,name:"]"},Backslash:{code:220,name:"\\"},SingleQuote:U,Quote:U,CtrlOrMeta:a.Platform.isMac()?_:W},$={};!function(){for(const e in K){const t=K[e];if("object"==typeof t&&t.code){const i="string"==typeof t.name?t.name:e;$[i]=t}}}();var q=Object.freeze({__proto__:null,KeyBindings:$,KeyboardShortcut:A,Keys:K,Modifiers:z});let X;class G{actionRegistry;actionToShortcut;keyMap;activePrefixKey;activePrefixTimeout;consumePrefix;devToolsDefaultShortcutActions;disabledDefaultShortcutsForAction;keybindSetSetting;userShortcutsSetting;constructor(t){this.actionRegistry=t,this.actionToShortcut=new i.MapUtilities.Multimap,this.keyMap=new Y(0,0),this.activePrefixKey=null,this.activePrefixTimeout=null,this.consumePrefix=null,this.devToolsDefaultShortcutActions=new Set,this.disabledDefaultShortcutsForAction=new i.MapUtilities.Multimap,this.keybindSetSetting=e.Settings.Settings.instance().moduleSetting("active-keybind-set"),this.keybindSetSetting.addChangeListener((e=>{a.userMetrics.keybindSetSettingChanged(e.data),this.registerBindings()})),this.userShortcutsSetting=e.Settings.Settings.instance().moduleSetting("user-shortcuts"),this.userShortcutsSetting.addChangeListener(this.registerBindings,this),this.registerBindings()}static instance(e={forceNew:null,actionRegistry:null}){const{forceNew:t,actionRegistry:i}=e;if(!X||t){if(!i)throw new Error("Missing actionRegistry for shortcutRegistry");X=new G(i)}return X}static removeInstance(){X=void 0}applicableActions(e,t={}){let i=[];const n=(this.activePrefixKey||this.keyMap).getNode(e);n&&(i=n.actions());const s=this.actionRegistry.applicableActions(i,b.instance());if(n)for(const e of Object.keys(t))if(n.actions().indexOf(e)>=0&&this.actionRegistry.hasAction(e)){const t=this.actionRegistry.getAction(e);s.push(t)}return s}shortcutsForAction(e){return[...this.actionToShortcut.get(e)]}actionsForDescriptors(e){let t=this.keyMap;for(const{key:i}of e){if(!t)return[];t=t.getNode(i)}return t?t.actions():[]}globalShortcutKeys(){const e=[];for(const t of this.keyMap.chords().values()){const i=t.actions();(this.actionRegistry.applicableActions(i,b.instance()).length||t.hasChords())&&e.push(t.key())}return e}shortcutTitleForAction(e){for(const t of this.actionToShortcut.get(e))return t.title()}handleShortcut(e,t){this.handleKey(A.makeKeyFromEvent(e),e.key,e,t)}actionHasDefaultShortcut(e){return this.devToolsDefaultShortcutActions.has(e)}getShortcutListener(e){const t=Object.keys(e).flatMap((e=>[...this.actionToShortcut.get(e)])),i=new Y(0,0);return t.forEach((e=>{i.addKeyMapping(e.descriptors.map((e=>e.key)),e.action)})),t=>{const n=A.makeKeyFromEvent(t),s=this.activePrefixKey?i.getNode(this.activePrefixKey.key()):i;s&&s.getNode(n)&&this.handleShortcut(t,e)}}addShortcutListener(e,t){const i=this.getShortcutListener(t);return e.addEventListener("keydown",i),i}async handleKey(e,t,i,n){const o=e>>8,r=Boolean(n)||Boolean(this.activePrefixKey),l=this.keyMap.getNode(e),d=this.applicableActions(e,n).length>0||l?.hasChords();if((r||!function(){if(!i||!fn()||/^F\d+|Control|Shift|Alt|Meta|Escape|Win|U\+001B$/.test(t))return!1;if(!o)return!0;const n=z;if(a.Platform.isMac()){if(A.makeKey("z",n.Meta.value)===e)return!0;if(A.makeKey("z",n.Meta.value|n.Shift.value)===e)return!0}else{if(A.makeKey("z",n.Ctrl.value)===e)return!0;if(A.makeKey("y",n.Ctrl.value)===e)return!0;if(!a.Platform.isWin()&&A.makeKey("z",n.Ctrl.value|n.Shift.value)===e)return!0}if((o&(n.Ctrl.value|n.Alt.value))==(n.Ctrl.value|n.Alt.value))return a.Platform.isWin();return!h(n.Ctrl.value)&&!h(n.Alt.value)&&!h(n.Meta.value)}())&&d&&!A.isModifier(A.keyCodeAndModifiersFromKey(e).keyCode)&&(i&&i.consume(!0),r||!bs.hasInstance())){if(this.activePrefixTimeout){clearTimeout(this.activePrefixTimeout);const e=await c.call(this,i);if(this.activePrefixKey=null,this.activePrefixTimeout=null,e)return;this.consumePrefix&&await this.consumePrefix()}l?.hasChords()?(this.activePrefixKey=l,this.consumePrefix=async()=>{this.activePrefixKey=null,this.activePrefixTimeout=null,await c.call(this,i)},this.activePrefixTimeout=window.setTimeout(this.consumePrefix,J)):await c.call(this,i)}function h(e){return Boolean(o&e)}async function c(t){const i=this.applicableActions(e,n);if(!i.length)return!1;for(const e of i){let i;if(t&&s.logKeyDown(null,t,e.id()),n?.[e.id()]&&(i=await n[e.id()]()),n||(i=await e.execute()),i)return a.userMetrics.keyboardShortcutFired(e.id()),!0}return!1}}registerUserShortcut(e){for(const t of this.disabledDefaultShortcutsForAction.get(e.action))if(t.descriptorsMatch(e.descriptors)&&t.hasKeybindSet(this.keybindSetSetting.get()))return void this.removeShortcut(t);for(const t of this.actionToShortcut.get(e.action))if(t.descriptorsMatch(e.descriptors))return;this.addShortcutToSetting(e)}removeShortcut(e){"DefaultShortcut"===e.type||"KeybindSetShortcut"===e.type?this.addShortcutToSetting(e.changeType("DisabledDefault")):this.removeShortcutFromSetting(e)}disabledDefaultsForAction(e){return this.disabledDefaultShortcutsForAction.get(e)}addShortcutToSetting(e){const t=this.userShortcutsSetting.get();t.push(e),this.userShortcutsSetting.set(t)}removeShortcutFromSetting(e){const t=this.userShortcutsSetting.get(),i=t.findIndex(e.equals,e);-1!==i&&(t.splice(i,1),this.userShortcutsSetting.set(t))}registerShortcut(e){this.actionToShortcut.set(e.action,e),this.keyMap.addKeyMapping(e.descriptors.map((e=>e.key)),e.action)}registerBindings(){this.actionToShortcut.clear(),this.keyMap.clear();const e=this.keybindSetSetting.get();this.disabledDefaultShortcutsForAction.clear(),this.devToolsDefaultShortcutActions.clear();const t=[],i=this.userShortcutsSetting.get();for(const e of i){const i=A.createShortcutFromSettingObject(e);"DisabledDefault"===i.type?this.disabledDefaultShortcutsForAction.set(i.action,i):(Z.has(i.action)&&t.push(...i.descriptors.map((e=>A.keyCodeAndModifiersFromKey(e.key)))),this.registerShortcut(i))}for(const e of C()){const i=e.id(),o=e.bindings();for(let e=0;o&&e<o.length;++e){const r=o[e].keybindSets;if(!n(o[e].platform)||!s(r))continue;const a=o[e].shortcut.split(/\s+/).map(A.makeDescriptorFromBindingShortcut);if(a.length>0){if(this.isDisabledDefault(a,i)){this.devToolsDefaultShortcutActions.add(i);continue}Z.has(i)&&t.push(...a.map((e=>A.keyCodeAndModifiersFromKey(e.key)))),r?(r.includes("devToolsDefault")&&this.devToolsDefaultShortcutActions.add(i),this.registerShortcut(new A(a,i,"KeybindSetShortcut",new Set(r)))):(this.devToolsDefaultShortcutActions.add(i),this.registerShortcut(new A(a,i,"DefaultShortcut")))}}}function n(e){if(!e)return!0;const t=e.split(",");let i=!1;const n=a.Platform.platform();for(let e=0;!i&&e<t.length;++e)i=t[e]===n;return i}function s(t){return!t||t.includes(e)}a.InspectorFrontendHost.InspectorFrontendHostInstance.setWhitelistedShortcuts(JSON.stringify(t))}isDisabledDefault(e,t){const i=this.disabledDefaultShortcutsForAction.get(t);for(const t of i)if(t.descriptorsMatch(e))return!0;return!1}}class Y{keyInternal;actionsInternal;chordsInternal;depth;constructor(e,t=0){this.keyInternal=e,this.actionsInternal=[],this.chordsInternal=new Map,this.depth=t}addAction(e){this.actionsInternal.push(e)}key(){return this.keyInternal}chords(){return this.chordsInternal}hasChords(){return this.chordsInternal.size>0}addKeyMapping(e,t){if(!(e.length<this.depth))if(e.length===this.depth)this.addAction(t);else{const i=e[this.depth];this.chordsInternal.has(i)||this.chordsInternal.set(i,new Y(i,this.depth+1)),this.chordsInternal.get(i).addKeyMapping(e,t)}}getNode(e){return this.chordsInternal.get(e)||null}actions(){return this.actionsInternal}clear(){this.actionsInternal=[],this.chordsInternal=new Map}}class Q{static instance=new Q}const Z=new Set(["main.toggle-dock","debugger.toggle-breakpoints-active","debugger.toggle-pause","quick-open.show-command-menu","console.toggle"]),J=1e3,ee="devToolsDefault";var te=Object.freeze({__proto__:null,DefaultShortcutSetting:ee,ForwardedActions:Z,ForwardedShortcut:Q,KeyTimeout:J,ShortcutRegistry:G,ShortcutTreeNode:Y});const ie={close:"Close",dockToRight:"Dock to right",dockToBottom:"Dock to bottom",dockToLeft:"Dock to left",undockIntoSeparateWindow:"Undock into separate window",devtoolsUndocked:"DevTools is undocked",devToolsDockedTo:"DevTools is docked to {PH1}"},ne=t.i18n.registerUIStrings("ui/legacy/DockController.ts",ie),se=t.i18n.getLocalizedString.bind(void 0,ne);let oe;class re extends e.ObjectWrapper.ObjectWrapper{canDockInternal;closeButton;currentDockStateSetting;lastDockStateSetting;dockSideInternal=void 0;titles;constructor(t){if(super(),this.canDockInternal=t,this.closeButton=new qi(se(ie.close),"cross"),this.closeButton.element.setAttribute("jslog",`${s.close().track({click:!0})}`),this.closeButton.element.classList.add("close-devtools"),this.closeButton.addEventListener("Click",a.InspectorFrontendHost.InspectorFrontendHostInstance.closeWindow.bind(a.InspectorFrontendHost.InspectorFrontendHostInstance)),this.currentDockStateSetting=e.Settings.Settings.instance().moduleSetting("currentDockState"),this.lastDockStateSetting=e.Settings.Settings.instance().createSetting("last-dock-state","bottom"),!t)return this.dockSideInternal="undocked",void this.closeButton.setVisible(!1);this.currentDockStateSetting.addChangeListener(this.dockSideChanged,this),-1===ae.indexOf(this.currentDockStateSetting.get())&&this.currentDockStateSetting.set("right"),-1===ae.indexOf(this.lastDockStateSetting.get())&&this.currentDockStateSetting.set("bottom")}static instance(e={forceNew:null,canDock:!1}){const{forceNew:t,canDock:i}=e;return oe&&!t||(oe=new re(i)),oe}initialize(){this.canDockInternal&&(this.titles=[se(ie.dockToRight),se(ie.dockToBottom),se(ie.dockToLeft),se(ie.undockIntoSeparateWindow)],this.dockSideChanged())}dockSideChanged(){this.setDockSide(this.currentDockStateSetting.get()),setTimeout(this.announceDockLocation.bind(this),2e3)}dockSide(){return this.dockSideInternal}canDock(){return this.canDockInternal}isVertical(){return"right"===this.dockSideInternal||"left"===this.dockSideInternal}setDockSide(e){if(-1===ae.indexOf(e)&&(e=ae[0]),this.dockSideInternal===e)return;void 0!==this.dockSideInternal&&document.body.classList.remove(this.dockSideInternal),document.body.classList.add(e),this.dockSideInternal&&this.lastDockStateSetting.set(this.dockSideInternal);const t={from:this.dockSideInternal,to:e};this.dispatchEventToListeners("BeforeDockSideChanged",t),console.timeStamp("DockController.setIsDocked"),this.dockSideInternal=e,this.currentDockStateSetting.set(e),a.InspectorFrontendHost.InspectorFrontendHostInstance.setIsDocked("undocked"!==e,this.setIsDockedResponse.bind(this,t)),this.closeButton.setVisible("undocked"!==this.dockSideInternal),this.dispatchEventToListeners("DockSideChanged",t)}setIsDockedResponse(e){this.dispatchEventToListeners("AfterDockSideChanged",e)}toggleDockSide(){if(this.lastDockStateSetting.get()===this.currentDockStateSetting.get()){const e=ae.indexOf(this.currentDockStateSetting.get())||0;this.lastDockStateSetting.set(ae[(e+1)%ae.length])}this.setDockSide(this.lastDockStateSetting.get())}announceDockLocation(){"undocked"===this.dockSideInternal?co(se(ie.devtoolsUndocked)):co(se(ie.devToolsDockedTo,{PH1:this.dockSideInternal||""}))}}const ae=["right","bottom","left","undocked"];let le;class de{static instance(e={forceNew:null}){const{forceNew:t}=e;return le&&!t||(le=new de),le}item(){return re.instance().closeButton}}var he=Object.freeze({__proto__:null,CloseButtonProvider:de,DockController:re,ToggleDockActionDelegate:class{handleAction(e,t){return re.instance().toggleDockSide(),!0}}}),ce={cssText:`:host{transition:all var(--sys-motion-duration-long2);transition-timing-function:var(--sys-motion-curve-spatial)}@starting-style{:host{height:0;opacity:0%}}.infobar{--summary-header-height:var(--sys-size-11);color:var(--sys-color-on-surface);background-color:var(--sys-color-cdt-base-container);display:flex;flex:auto;flex-direction:row;position:relative;padding:var(--sys-size-5) var(--sys-size-8);min-width:fit-content;min-height:calc(var(--summary-header-height) + var(--sys-size-5) * 2);.icon-container{display:flex;flex-shrink:0;align-items:center;height:var(--summary-header-height)}dt-close-button{margin-left:var(--sys-size-3)}}.infobar:focus{outline:2px solid var(--sys-color-state-focus-ring);outline-offset:-2px}.infobar-warning{background-color:var(--sys-color-surface-yellow);color:var(--sys-color-on-surface-yellow)}.infobar-error{--override-infobar-error-background:var(--sys-color-surface-error);--override-infobar-error-text:var(--sys-color-on-surface-error);background-color:var(--override-infobar-error-background);color:var(--override-infobar-error-text)}.infobar-main-row{display:inline-flex;flex-direction:row;margin-right:auto}.infobar-info-container{display:flex;row-gap:var(--sys-size-4);align-items:center;flex-grow:1;flex-wrap:wrap}.infobar-info-text{font:var(--sys-typescale-body3-regular);margin-right:var(--sys-size-8)}.infobar-details-row{display:flex;flex-direction:column;line-height:18px;+ .infobar-details-row{padding-top:var(--sys-size-3)}}.infobar-selectable{user-select:text}.infobar-button{color:var(--sys-color-token-subtle)}.info-icon{color:var(--sys-color-primary)}.warning-icon{color:var(--icon-warning)}.error-icon{color:var(--icon-error)}.issue-icon{color:var(--sys-color-primary)}.info-icon,\n.warning-icon,\n.error-icon,\n.issue-icon{margin-right:var(--sys-size-8);width:var(--sys-size-8);height:var(--sys-size-8);flex-shrink:0}.infobar-info-actions{display:flex;gap:var(--sys-size-5)}.devtools-link.text-button:hover,\n.devtools-link.text-button:focus,\n.devtools-link.text-button:active{background-color:transparent;box-shadow:none}details{margin-right:auto;summary{display:flex;min-height:var(--summary-header-height);&:focus-visible{outline:var(--sys-color-state-focus-ring) auto var(--sys-size-1);outline-offset:var(--sys-size-3)}&::marker{content:''}}devtools-icon[name="arrow-drop-down"]{align-self:center;transform:rotate(270deg)}&[open]{devtools-icon[name="arrow-drop-down"]{transform:rotate(0deg)}&::details-content{padding:var(--sys-size-4) 0 0 var(--sys-size-9)}}}\n/*# sourceURL=${import.meta.resolve("./infobar.css")} */\n`};const ue={dontShowAgain:"Don't show again",close:"Close"},me=t.i18n.registerUIStrings("ui/legacy/Infobar.ts",ue),pe=t.i18n.getLocalizedString.bind(void 0,me);class ge{element;shadowRoot;contentElement;detailsRows;infoContainer;infoMessage;infoText;actionContainer;disableSetting;closeButton;closeCallback;parentView;mainRow;constructor(e,t,i,n,o){this.element=document.createElement("div"),o&&this.element.setAttribute("jslog",`${s.dialog(o).track({resize:!0,keydown:"Enter|Escape"})}`),this.element.classList.add("flex-none"),this.shadowRoot=rs(this.element,{cssFile:ce}),this.contentElement=this.shadowRoot.createChild("div","infobar infobar-"+e);const a=r.Icon.create(be[e],e+"-icon");this.contentElement.createChild("div","icon-container").appendChild(a),this.mainRow=this.contentElement.createChild("div","infobar-main-row"),this.infoContainer=this.mainRow.createChild("div","infobar-info-container"),this.infoMessage=this.infoContainer.createChild("div","infobar-info-message"),this.infoText=this.infoMessage.createChild("div","infobar-info-text"),this.infoText.textContent=t,ys(this.infoText),this.actionContainer=this.infoContainer.createChild("div","infobar-info-actions");let l="outlined";if(this.disableSetting=n||null,n){const e=Vn(pe(ue.dontShowAgain),this.onDisable.bind(this),{className:"infobar-button"});this.actionContainer.appendChild(e),l="tonal"}if(i){this.contentElement.setAttribute("role","group");for(const e of i){const t=this.actionCallbackFactory(e),i=e.buttonVariant??l,n=Vn(e.text,t,{className:"infobar-button",jslogContext:e.jslogContext,variant:i});this.actionContainer.appendChild(n)}}this.closeButton=this.contentElement.createChild("dt-close-button","icon-container"),this.closeButton.setTabbable(!0),this.closeButton.setSize("SMALL"),io(this.closeButton,pe(ue.close)),self.onInvokeElement(this.closeButton,this.dispose.bind(this)),"issue"!==e&&(this.contentElement.tabIndex=0),to(this.contentElement,t),this.contentElement.addEventListener("keydown",(e=>{if(e.keyCode===K.Esc.code)return this.dispose(),void e.consume()})),this.closeCallback=null}static create(e,t,i,n,s){return n?.get()?null:new ge(e,t,i,n,s)}dispose(){this.element.remove(),this.onResize(),this.closeCallback&&this.closeCallback.call(null)}setText(e){this.infoText.textContent=e,this.onResize()}setCloseCallback(e){this.closeCallback=e}setParentView(e){this.parentView=e}actionCallbackFactory(e){return e.delegate?e.dismiss?(()=>{e.delegate&&e.delegate(),this.dispose()}).bind(this):e.delegate:e.dismiss?this.dispose.bind(this):()=>{}}onResize(){this.parentView&&this.parentView.doResize()}onDisable(){this.disableSetting&&this.disableSetting.set(!0),this.dispose()}createDetailsRowMessage(e){if(!this.detailsRows){const e=document.createElement("details"),t=e.createChild("summary"),i=r.Icon.create("arrow-drop-down");t.createChild("div","icon-container").appendChild(i),this.contentElement.insertBefore(e,this.mainRow),t.appendChild(this.mainRow),this.detailsRows=e.createChild("div","infobar-details-rows")}const t=this.detailsRows.createChild("div","infobar-details-row").createChild("span","infobar-row-message");return"string"==typeof e?t.textContent=e:t.appendChild(e),t}}const be={warning:"warning",info:"info",issue:"issue-text-filled",error:"cross-circle"};var ve=Object.freeze({__proto__:null,Infobar:ge}),fe={cssText:`.tabbed-pane-header-tab{& > .tabbed-pane-header-tab-suffix-element devtools-icon.warning{width:14px;height:14px;color:var(--icon-warning)}}\n/*# sourceURL=${import.meta.resolve("./inspectorViewTabbedPane.css")} */\n`};const we=1e-5;class xe{x;y;z;constructor(e,t,i){this.x=e,this.y=t,this.z=i}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}normalize(){const e=this.length();e<=we||(this.x/=e,this.y/=e,this.z/=e)}}class ye{x;y;constructor(e,t){this.x=e,this.y=t}distanceTo(e){return Math.sqrt(Math.pow(e.x-this.x,2)+Math.pow(e.y-this.y,2))}projectOn(e){return 0===e.x&&0===e.y?new ye(0,0):e.scale((this.x*e.x+this.y*e.y)/(Math.pow(e.x,2)+Math.pow(e.y,2)))}scale(e){return new ye(this.x*e,this.y*e)}toString(){return Math.round(100*this.x)/100+", "+Math.round(100*this.y)/100}}class Ee{controlPoints;constructor(e,t){this.controlPoints=[e,t]}static parse(e){const t=l.CSSMetadata.CubicBezierKeywordValues,i=e.toLowerCase().replace(/\s+/g,"");if(t.has(i))return Ee.parse(t.get(i));const n=i.match(/^cubic-bezier\(([^,]+),([^,]+),([^,]+),([^,]+)\)$/);if(n){const e=new ye(parseFloat(n[1]),parseFloat(n[2])),t=new ye(parseFloat(n[3]),parseFloat(n[4]));return new Ee(e,t)}return null}evaluateAt(e){function t(e,t,i){return 3*(1-i)*(1-i)*i*e+3*(1-i)*i*i*t+Math.pow(i,3)}const i=t(this.controlPoints[0].x,this.controlPoints[1].x,e),n=t(this.controlPoints[0].y,this.controlPoints[1].y,e);return new ye(i,n)}asCSSText(){const e="cubic-bezier("+this.controlPoints.join(", ")+")",t=l.CSSMetadata.CubicBezierKeywordValues;for(const[i,n]of t)if(e===n&&"linear"!==i)return i;return e}static Regex=/((cubic-bezier\([^)]+\))|\b(linear(?![-\(])|ease-in-out|ease-in|ease-out|ease)\b)|(linear\([^)]+\))/g}const Ie=new Ee(new ye(0,0),new ye(1,1));class Se{alpha;beta;gamma;constructor(e,t,i){this.alpha=e,this.beta=t,this.gamma=i}static fromDeviceOrientationRotationMatrix(e){let t,i,n;return Math.abs(e.m33)<we?Math.abs(e.m13)<we?(t=Math.atan2(e.m12,e.m11),i=e.m23>0?Math.PI/2:-Math.PI/2,n=0):e.m13>0?(t=Math.atan2(-e.m21,e.m22),i=Math.asin(e.m23),n=-Math.PI/2):(t=Math.atan2(e.m21,-e.m22),i=-Math.asin(e.m23),i+=i>0||Math.abs(i)<we?-Math.PI:Math.PI,n=-Math.PI/2):e.m33>0?(t=Math.atan2(-e.m21,e.m22),i=Math.asin(e.m23),n=Math.atan2(-e.m13,e.m33)):(t=Math.atan2(e.m21,-e.m22),i=-Math.asin(e.m23),i+=i>0||Math.abs(i)<we?-Math.PI:Math.PI,n=Math.atan2(e.m13,-e.m33)),t<-we&&(t+=2*Math.PI),t=Number(ke(t).toFixed(6)),i=Number(ke(i).toFixed(6)),n=Number(ke(n).toFixed(6)),new Se(t,i,n)}}const Ce=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},Te=function(e,t){const i=e.x*t.m14+e.y*t.m24+e.z*t.m34+t.m44,n=(e.x*t.m11+e.y*t.m21+e.z*t.m31+t.m41)/i,s=(e.x*t.m12+e.y*t.m22+e.z*t.m32+t.m42)/i,o=(e.x*t.m13+e.y*t.m23+e.z*t.m33+t.m43)/i;return new xe(n,s,o)},ke=function(e){return 180*e/Math.PI};class Me{width;height;constructor(e,t){this.width=e,this.height=t}clipTo(e){return e?new Me(Math.min(this.width,e.width),Math.min(this.height,e.height)):this}scale(e){return new Me(this.width*e,this.height*e)}isEqual(e){return null!==e&&this.width===e.width&&this.height===e.height}widthToMax(e){return new Me(Math.max(this.width,"number"==typeof e?e:e.width),this.height)}addWidth(e){return new Me(this.width+("number"==typeof e?e:e.width),this.height)}heightToMax(e){return new Me(this.width,Math.max(this.height,"number"==typeof e?e:e.height))}addHeight(e){return new Me(this.width,this.height+("number"==typeof e?e:e.height))}}class Le{minimum;preferred;constructor(e,t){if(this.minimum=e||new Me(0,0),this.preferred=t||this.minimum,this.minimum.width>this.preferred.width||this.minimum.height>this.preferred.height)throw new Error("Minimum size is greater than preferred.")}isEqual(e){return null!==e&&this.minimum.isEqual(e.minimum)&&this.preferred.isEqual(e.preferred)}widthToMax(e){return"number"==typeof e?new Le(this.minimum.widthToMax(e),this.preferred.widthToMax(e)):new Le(this.minimum.widthToMax(e.minimum),this.preferred.widthToMax(e.preferred))}addWidth(e){return"number"==typeof e?new Le(this.minimum.addWidth(e),this.preferred.addWidth(e)):new Le(this.minimum.addWidth(e.minimum),this.preferred.addWidth(e.preferred))}heightToMax(e){return"number"==typeof e?new Le(this.minimum.heightToMax(e),this.preferred.heightToMax(e)):new Le(this.minimum.heightToMax(e.minimum),this.preferred.heightToMax(e.preferred))}addHeight(e){return"number"==typeof e?new Le(this.minimum.addHeight(e),this.preferred.addHeight(e)):new Le(this.minimum.addHeight(e.minimum),this.preferred.addHeight(e.preferred))}}var Pe=Object.freeze({__proto__:null,Constraints:Le,CubicBezier:Ee,EulerAngles:Se,LINEAR_BEZIER:Ie,Point:ye,Size:Me,Vector:xe,boundsForTransformedPoints:function(e,t,i){i||(i={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0}),t.length%3&&console.warn("Invalid size of points array");for(let n=0;n<t.length;n+=3){let s=new xe(t[n],t[n+1],t[n+2]);s=Te(s,e),i.minX=Math.min(i.minX,s.x),i.maxX=Math.max(i.maxX,s.x),i.minY=Math.min(i.minY,s.y),i.maxY=Math.max(i.maxY,s.y)}return i},calculateAngle:function(e,t){const i=e.length(),n=t.length();if(i<=we||n<=we)return 0;const s=Ce(e,t)/i/n;return Math.abs(s)>1?0:ke(Math.acos(s))},crossProduct:function(e,t){const i=e.y*t.z-e.z*t.y,n=e.z*t.x-e.x*t.z,s=e.x*t.y-e.y*t.x;return new xe(i,n,s)},degreesToGradians:function(e){return e/9*10},degreesToRadians:function(e){return e*Math.PI/180},degreesToTurns:function(e){return e/360},gradiansToRadians:function(e){return e*Math.PI/200},multiplyVectorByMatrixAndNormalize:Te,radiansToDegrees:ke,radiansToGradians:function(e){return 200*e/Math.PI},radiansToTurns:function(e){return e/(2*Math.PI)},scalarProduct:Ce,subtract:function(e,t){const i=e.x-t.x,n=e.y-t.y,s=e.z-t.z;return new xe(i,n,s)},turnsToRadians:function(e){return 2*e*Math.PI}});class De extends e.ObjectWrapper.ObjectWrapper{isEnabledInternal=!0;elementsInternal=new Set;installDragOnMouseDownBound;cursorInternal;startX;startY;constructor(){super(),this.installDragOnMouseDownBound=this.installDragOnMouseDown.bind(this),this.cursorInternal="nwse-resize"}isEnabled(){return this.isEnabledInternal}setEnabled(e){this.isEnabledInternal=e,this.updateElementCursors()}elements(){return[...this.elementsInternal]}addElement(e){this.elementsInternal.has(e)||(this.elementsInternal.add(e),e.addEventListener("pointerdown",this.installDragOnMouseDownBound,!1),this.updateElementCursor(e))}removeElement(e){this.elementsInternal.has(e)&&(this.elementsInternal.delete(e),e.removeEventListener("pointerdown",this.installDragOnMouseDownBound,!1),e.style.removeProperty("cursor"))}updateElementCursors(){this.elementsInternal.forEach(this.updateElementCursor.bind(this))}updateElementCursor(e){this.isEnabledInternal?(e.style.setProperty("cursor",this.cursor()),e.style.setProperty("touch-action","none")):(e.style.removeProperty("cursor"),e.style.removeProperty("touch-action"))}cursor(){return this.cursorInternal}setCursor(e){this.cursorInternal=e,this.updateElementCursors()}installDragOnMouseDown(e){const t=e.target;if(!this.elementsInternal.has(t))return!1;bn(t,this.dragStart.bind(this),(e=>{this.drag(e)}),this.dragEnd.bind(this),this.cursor(),e)}dragStart(e){return!!this.isEnabledInternal&&(this.startX=e.pageX,this.startY=e.pageY,this.sendDragStart(this.startX,this.startY),!0)}sendDragStart(e,t){this.dispatchEventToListeners("ResizeStart",{startX:e,currentX:e,startY:t,currentY:t})}drag(e){return this.isEnabledInternal?(this.sendDragMove(this.startX,e.pageX,this.startY,e.pageY,e.shiftKey),e.preventDefault(),!1):(this.dragEnd(e),!0)}sendDragMove(e,t,i,n,s){this.dispatchEventToListeners("ResizeUpdateXY",{startX:e,currentX:t,startY:i,currentY:n,shiftKey:s})}dragEnd(e){this.dispatchEventToListeners("ResizeEnd"),delete this.startX,delete this.startY}}class Ae extends De{isVerticalInternal;constructor(){super(),this.isVerticalInternal=!0}isVertical(){return this.isVerticalInternal}setVertical(e){this.isVerticalInternal=e,this.updateElementCursors()}cursor(){return this.isVerticalInternal?"ns-resize":"ew-resize"}sendDragStart(e,t){const i=this.isVerticalInternal?t:e;this.dispatchEventToListeners("ResizeStart",{startPosition:i,currentPosition:i})}sendDragMove(e,t,i,n,s){this.isVerticalInternal?this.dispatchEventToListeners("ResizeUpdatePosition",{startPosition:i,currentPosition:n,shiftKey:s}):this.dispatchEventToListeners("ResizeUpdatePosition",{startPosition:e,currentPosition:t,shiftKey:s})}}var ze=Object.freeze({__proto__:null,ResizerWidget:De,SimpleResizerWidget:Ae}),Re={cssText:`.shadow-split-widget{display:flex;overflow:hidden}.shadow-split-widget-contents{display:flex;position:relative;flex-direction:column;contain:layout size style}.shadow-split-widget-sidebar{flex:none}.shadow-split-widget-main,\n.shadow-split-widget-sidebar.maximized{flex:auto}.shadow-split-widget.hbox > .shadow-split-widget-resizer{position:absolute;top:0;bottom:0;width:6px;z-index:4000}.shadow-split-widget.vbox > .shadow-split-widget-resizer{position:absolute;left:0;right:0;height:6px;z-index:4000}.shadow-split-widget.vbox > .shadow-split-widget-sidebar.no-default-splitter{border:0!important}.shadow-split-widget.vbox > .shadow-split-widget-sidebar:not(.maximized){border:0;border-top:1px solid var(--sys-color-divider)}.shadow-split-widget.hbox > .shadow-split-widget-sidebar:not(.maximized){border:0;border-left:1px solid var(--sys-color-divider)}.shadow-split-widget.vbox > .shadow-split-widget-sidebar:first-child:not(.maximized){border:0;border-bottom:1px solid var(--sys-color-divider)}.shadow-split-widget.hbox > .shadow-split-widget-sidebar:first-child:not(.maximized){border:0;border-right:1px solid var(--sys-color-divider)}:host-context(.disable-resizer-for-elements-hack) .shadow-split-widget-resizer{pointer-events:none}:host{display:flex}\n/*# sourceURL=${import.meta.resolve("./splitWidget.css")} */\n`};class Be extends HTMLElement{static get observedAttributes(){return["flex","padding","padding-top","padding-bottom","padding-left","padding-right","margin","margin-top","margin-bottom","margin-left","margin-right","overflow","overflow-x","overflow-y","font-size","color","background","background-color","border","border-top","border-bottom","border-left","border-right","max-width","max-height"]}attributeChangedCallback(e,t,i){if("flex"!==e)if(null===i){if(this.style.removeProperty(e),e.startsWith("padding-")||e.startsWith("margin-")||e.startsWith("border-")||e.startsWith("background-")||e.startsWith("overflow-")){const t=e.substring(0,e.indexOf("-")),i=this.getAttribute(t);null!==i&&this.style.setProperty(t,i)}}else this.style.setProperty(e,i);else null===i?this.style.removeProperty("flex"):"initial"===i||"auto"===i||"none"===i||-1!==i.indexOf(" ")?this.style.setProperty("flex",i):this.style.setProperty("flex","0 0 "+i)}}class Oe extends Be{constructor(e){super(),this.style.setProperty("display","flex"),this.style.setProperty("flex-direction",e),this.style.setProperty("justify-content","flex-start")}static get observedAttributes(){return super.observedAttributes.concat(["x-start","x-center","x-stretch","x-baseline","justify-content"])}attributeChangedCallback(e,t,i){"x-start"!==e&&"x-center"!==e&&"x-stretch"!==e&&"x-baseline"!==e?super.attributeChangedCallback(e,t,i):null===i?this.style.removeProperty("align-items"):this.style.setProperty("align-items","x-start"===e?"flex-start":e.substr(2))}}customElements.define("x-vbox",class extends Oe{constructor(){super("column")}}),customElements.define("x-hbox",class extends Oe{constructor(){super("row")}}),customElements.define("x-cbox",class extends Be{constructor(){super(),this.style.setProperty("display","flex"),this.style.setProperty("flex-direction","column"),this.style.setProperty("justify-content","center"),this.style.setProperty("align-items","center")}}),customElements.define("x-div",class extends Be{constructor(){super(),this.style.setProperty("display","block")}}),customElements.define("x-span",class extends Be{constructor(){super(),this.style.setProperty("display","inline")}}),customElements.define("x-text",class extends Be{constructor(){super(),this.style.setProperty("display","inline"),this.style.setProperty("white-space","pre")}});var Fe=Object.freeze({__proto__:null,XElement:Be});let We=null;const He=new WeakMap;class Ne extends Be{visible;shadowRootInternal;defaultFocusedElement;elementsToRestoreScrollPositionsFor;onShownCallback;onHiddenCallback;onResizedCallback;constructor(){super(),this.style.setProperty("display","flex"),this.style.setProperty("flex-direction","column"),this.style.setProperty("align-items","stretch"),this.style.setProperty("justify-content","flex-start"),this.style.setProperty("contain","layout style"),this.visible=!1,this.defaultFocusedElement=null,this.elementsToRestoreScrollPositionsFor=[],We||(We=new ResizeObserver((e=>{for(const t of e){const e=t.target;e.visible&&e.onResizedCallback&&e.onResizedCallback.call(null)}}))),We.observe(this),this.setElementsToRestoreScrollPositionsFor([this])}isShowing(){return this.visible}setElementsToRestoreScrollPositionsFor(e){for(const e of this.elementsToRestoreScrollPositionsFor)e.removeEventListener("scroll",Ne.storeScrollPosition,{capture:!1});this.elementsToRestoreScrollPositionsFor=e;for(const e of this.elementsToRestoreScrollPositionsFor)e.addEventListener("scroll",Ne.storeScrollPosition,{passive:!0,capture:!1})}restoreScrollPositions(){for(const e of this.elementsToRestoreScrollPositionsFor){const t=He.get(e);t&&(e.scrollTop=t.scrollTop,e.scrollLeft=t.scrollLeft)}}static storeScrollPosition(e){const t=e.currentTarget;He.set(t,{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop})}setDefaultFocusedElement(e){if(e&&!this.isSelfOrAncestor(e))throw new Error("Default focus must be descendant");this.defaultFocusedElement=e}focus(){if(!this.visible)return;let e;if(this.defaultFocusedElement&&this.isSelfOrAncestor(this.defaultFocusedElement))e=this.defaultFocusedElement;else if(-1!==this.tabIndex)e=this;else{let t=this.traverseNextNode(this);for(;t;){if(t instanceof Ne&&t.visible){e=t;break}t=t.traverseNextNode(this)}}e&&!e.hasFocus()&&(e===this?HTMLElement.prototype.focus.call(this):e.focus())}connectedCallback(){this.visible=!0,this.restoreScrollPositions(),this.onShownCallback&&this.onShownCallback.call(null)}disconnectedCallback(){this.visible=!1,this.onHiddenCallback&&this.onHiddenCallback.call(null)}}customElements.define("x-widget",Ne);var je=Object.freeze({__proto__:null,XWidget:Ne});const Ve=Element.prototype.appendChild,Ue=Element.prototype.insertBefore,_e=Element.prototype.removeChild,Ke=Element.prototype.removeChildren;function $e(e,t){if(!e)throw new Error(t)}class qe{widgetClass;widgetParams;constructor(e,t){this.widgetClass=e,this.widgetParams=t}}class Xe extends HTMLElement{#n;#s;createWidget(){if(!this.#n)throw new Error("No widgetClass defined");const e=new this.#n(this);return this.#s&&Object.assign(e,this.#s),e.requestUpdate(),e}set widgetConfig(e){const t=et.get(this);if(t){let i=!1;for(const t in e.widgetParams)e.widgetParams.hasOwnProperty(t)&&e.widgetParams[t]!==this.#s?.[t]&&(i=!0);i&&(Object.assign(t,e.widgetParams),t.requestUpdate())}this.#n=e.widgetClass,this.#s=e.widgetParams}getWidget(){return et.get(this)}connectedCallback(){const e=et.getOrCreateWidget(this);e.element.parentElement||e.markAsRoot(),e.show(this.parentElement,void 0,!0)}appendChild(e){return e instanceof HTMLElement&&"STYLE"!==e.tagName?(et.getOrCreateWidget(e).show(this),e):super.appendChild(e)}insertBefore(e,t){return e instanceof HTMLElement&&"STYLE"!==e.tagName?(et.getOrCreateWidget(e).show(this,t),e):super.insertBefore(e,t)}removeChild(e){const t=et.get(e);return t?(t.detach(),e):super.removeChild(e)}removeChildren(){for(const e of this.children){const t=et.get(e);t&&t.detach()}super.removeChildren()}}customElements.define("devtools-widget",Xe);const Ge=new WeakMap,Ye=new WeakMap;function Qe(e,t){const i=(Ge.get(t)||0)+(Ye.get(t)?1:0);for(let t=e;t;t=t.parentElementOrShadowHost()){const e=Ge.get(t);e&&Ge.set(t,e-i)}}const Ze=Promise.resolve(!0),Je=e=>{};class et{element;contentElement;shadowRoot;visibleInternal;isRoot;isShowingInternal;childrenInternal;hideOnDetach;notificationDepth;invalidationsSuspended;defaultFocusedChild;parentWidgetInternal;defaultFocusedElement;cachedConstraints;constraintsInternal;invalidationsRequested;externallyManaged;#o=Ze;#r=Je;#a=0;constructor(e,t,i){this.element=i||document.createElement("div"),this.shadowRoot=this.element.shadowRoot,e&&!this.shadowRoot?(this.element.classList.add("vbox"),this.element.classList.add("flex-auto"),this.shadowRoot=rs(this.element,{delegatesFocus:t}),this.contentElement=document.createElement("div"),this.shadowRoot.appendChild(this.contentElement)):this.contentElement=this.element,this.contentElement.classList.add("widget"),Ye.set(this.element,this),this.visibleInternal=!1,this.isRoot=!1,this.isShowingInternal=!1,this.childrenInternal=[],this.hideOnDetach=!1,this.notificationDepth=0,this.invalidationsSuspended=0,this.defaultFocusedChild=null,this.parentWidgetInternal=null}static get(e){return Ye.get(e)}static getOrCreateWidget(e){const t=et.get(e);return t||(e instanceof Xe?e.createWidget():new et(void 0,void 0,e))}markAsRoot(){$e(!this.element.parentElement,"Attempt to mark as root attached node"),this.isRoot=!0}parentWidget(){return this.parentWidgetInternal}children(){return this.childrenInternal}childWasDetached(e){}isShowing(){return this.isShowingInternal}shouldHideOnDetach(){if(!this.element.parentElement)return!1;if(this.hideOnDetach)return!0;for(const e of this.childrenInternal)if(e.shouldHideOnDetach())return!0;return!1}setHideOnDetach(){this.hideOnDetach=!0}inNotification(){return Boolean(this.notificationDepth)||Boolean(this.parentWidgetInternal?.inNotification())}parentIsShowing(){return!!this.isRoot||(this.parentWidgetInternal?.isShowing()??!1)}callOnVisibleChildren(e){const t=this.childrenInternal.slice();for(let i=0;i<t.length;++i)t[i].parentWidgetInternal===this&&t[i].visibleInternal&&e.call(t[i])}processWillShow(){this.callOnVisibleChildren(this.processWillShow),this.isShowingInternal=!0}processWasShown(){this.inNotification()||(this.restoreScrollPositions(),this.notify(this.wasShown),this.callOnVisibleChildren(this.processWasShown))}processWillHide(){this.inNotification()||(this.storeScrollPositions(),this.callOnVisibleChildren(this.processWillHide),this.notify(this.willHide),this.isShowingInternal=!1)}processWasHidden(){this.callOnVisibleChildren(this.processWasHidden)}processOnResize(){this.inNotification()||this.isShowing()&&(this.notify(this.onResize),this.callOnVisibleChildren(this.processOnResize))}notify(e){++this.notificationDepth;try{e.call(this)}finally{--this.notificationDepth}}wasShown(){}willHide(){}onResize(){}onLayout(){}onDetach(){}async ownerViewDisposed(){}show(e,t,i=!1){if($e(e,"Attempt to attach widget with no parent element"),!this.isRoot){let n,s=e;for(;!n;){if(!s){if(i)return this.isRoot=!0,console.warn("A Widget has silently been marked as a root widget"),void this.show(e,t);throw new Error("Attempt to attach widget to orphan node")}n=Ye.get(s),s=s.parentElementOrShadowHost()}this.attach(n)}this.showWidgetInternal(e,t)}attach(e){e!==this.parentWidgetInternal&&(this.parentWidgetInternal&&this.detach(),this.parentWidgetInternal=e,this.parentWidgetInternal.childrenInternal.push(this),this.isRoot=!1)}showWidget(){if(!this.visibleInternal){if(!this.element.parentElement)throw new Error("Attempt to show widget that is not hidden using hideWidget().");this.showWidgetInternal(this.element.parentElement,this.element.nextSibling)}}showWidgetInternal(e,t){let i=e;for(;i&&!Ye.get(i);)i=i.parentElementOrShadowHost();this.isRoot?$e(!i,"Attempt to show root widget under another widget"):$e(i&&Ye.get(i)===this.parentWidgetInternal,"Attempt to show under node belonging to alien widget");const n=this.visibleInternal;n&&this.element.parentElement===e||(this.visibleInternal=!0,!n&&this.parentIsShowing()&&this.processWillShow(),this.element.classList.remove("hidden"),this.element.parentElement!==e&&(this.externallyManaged||function(e,t){const i=(Ge.get(t)||0)+(Ye.get(t)?1:0);for(let t=e;t;t=t.parentElementOrShadowHost())Ge.set(t,(Ge.get(t)||0)+i)}(e,this.element),t?Ue.call(e,this.element,t):Ve.call(e,this.element)),!n&&this