e.data.key===t.key));i&&i.data.value!==t.value&&(i.data.value=t.value,i.refresh(),i.selected&&(this.previewEntry(i),this.setCanDeleteSelected(!0)))}showDOMStorageItems(e){const t=this.dataGrid.rootNode();let i=null;for(const e of t.children)if(e.selected){i=e.data.key;break}t.removeChildren();let r=null;const s=this.filter(e,(e=>`${e[0]} ${e[1]}`));for(const e of s){const s=e[0],a=e[1],n=new u.DataGrid.DataGridNode({key:s,value:a},!1);n.selectable=!0,t.appendChild(n),r&&s!==i||(r=n)}r&&(r.selected=!0),this.dataGrid.addCreationNode(!1),this.setCanDeleteSelected(Boolean(r)),o.ARIAUtils.alert(Wi(Bi.domStorageNumberEntries,{PH1:s.length}))}deleteSelectedItem(){this.dataGrid&&this.dataGrid.selectedNode&&this.deleteCallback(this.dataGrid.selectedNode)}refreshItems(){this.domStorage.getItems().then((e=>e&&this.showDOMStorageItems(e)))}deleteAllItems(){this.domStorage.clear(),this.domStorageItemsCleared()}editingCallback(e,t,i,r){const s=this.domStorage;"key"===t?("string"==typeof i&&s.removeItem(i),s.setItem(r,e.data.value||""),this.removeDupes(e)):s.setItem(e.data.key||"",r)}removeDupes(e){const t=this.dataGrid.rootNode(),i=t.children;for(let r=i.length-1;r>=0;--r){const s=i[r];s.data.key===e.data.key&&e!==s&&t.removeChild(s)}}deleteCallback(e){e&&!e.isCreationNode&&(this.domStorage&&this.domStorage.removeItem(e.data.key),o.ARIAUtils.alert(Wi(Bi.domStorageItemDeleted)))}showPreview(e,t){this.preview&&this.previewValue===t||(this.preview&&this.preview.detach(),e||(e=new o.EmptyWidget.EmptyWidget(Wi(Bi.selectAValueToPreview))),this.previewValue=t,this.preview=e,e.show(this.previewPanel.contentElement))}async previewEntry(t){const i=t&&t.data&&t.data.value;if(t&&t.data&&t.data.value){const r=`${this.domStorage.isLocalStorage?"localstorage":"sessionstorage"}://${t.key}`,s=I.StaticContentProvider.StaticContentProvider.fromString(r,e.ResourceType.resourceTypes.XHR,i),a=await n.PreviewFactory.PreviewFactory.createPreview(s,"text/plain");t.selected&&this.showPreview(a,i)}else this.showPreview(null,i)}}var Ai=Object.freeze({__proto__:null,DOMStorageItemsView:Vi});const Ui=new CSSStyleSheet;let Hi,qi,_i,ji;Ui.replaceSync(".resources-toolbar{border-top:1px solid var(--color-details-hairline);background-color:var(--color-background-elevation-1)}.top-resources-toolbar{border-bottom:1px solid var(--color-details-hairline);background-color:var(--color-background-elevation-1)}.resources.panel .status{float:right;height:16px;margin-top:1px;margin-left:4px;line-height:1em}.storage-view{display:flex;overflow:hidden}.storage-view .data-grid:not(.inline){border:none;flex:auto}.storage-view .storage-table-error{color:var(--color-accent-red);font-size:24px;font-weight:700;padding:10px;display:flex;align-items:center;justify-content:center}.storage-view.query{padding:2px 0;overflow-y:overlay;overflow-x:hidden}.storage-view .filter-bar{border-top:none;border-bottom:1px solid var(--color-details-hairline)}.database-query-group-messages{overflow-y:auto}.database-query-prompt-container{position:relative;padding:1px 22px 1px 24px;min-height:16px}.database-query-prompt{white-space:pre-wrap}.prompt-icon{position:absolute;display:block;left:7px;top:9px;margin-top:-7px;user-select:none}.database-query-prompt-container .prompt-icon{top:10px}.database-user-query{position:relative;border-bottom:1px solid var(--color-details-hairline);padding:1px 22px 1px 24px;min-height:16px;flex-shrink:0}.database-user-query:focus-visible{background-color:var(--color-background-elevation-2)}.database-query-text{color:var(--color-primary-variant);user-select:text}.database-query-result{position:relative;padding:1px 22px;min-height:16px;margin-left:-22px;padding-right:0}.database-query-result.error{color:var(--color-syntax-1);user-select:text}.resources-sidebar{padding:0;overflow-x:auto;background-color:var(--color-background)}\n/*# sourceURL=resourcesPanel.css */\n");class zi extends o.Panel.PanelWithSidebar{resourcesLastSelectedItemSetting;visibleView;pendingViewPromise;categoryView;storageViews;storageViewToolbar;domStorageView;cookieView;emptyWidget;sidebar;constructor(){super("resources"),this.resourcesLastSelectedItemSetting=e.Settings.Settings.instance().createSetting("resourcesLastSelectedElementPath",[]),this.visibleView=null,this.pendingViewPromise=null,this.categoryView=null;const t=new o.Widget.VBox;this.storageViews=t.element.createChild("div","vbox flex-auto"),this.storageViewToolbar=new o.Toolbar.Toolbar("resources-toolbar",t.element),this.splitWidget().setMainWidget(t),this.domStorageView=null,this.cookieView=null,this.emptyWidget=null,this.sidebar=new ii(this),this.sidebar.show(this.panelSidebarElement())}static instance(e={forceNew:null}){const{forceNew:t}=e;return Hi&&!t||(Hi=new zi),Hi}static shouldCloseOnReset(e){return[n.ResourceSourceFrame.ResourceSourceFrame,n.ImageView.ImageView,n.FontView.FontView,xi,Me,Ne].some((t=>e instanceof t))}static async showAndGetSidebar(){return await o.ViewManager.ViewManager.instance().showView("resources"),zi.instance().sidebar}focus(){this.sidebar.focus()}lastSelectedItemPath(){return this.resourcesLastSelectedItemSetting.get()}setLastSelectedItemPath(e){this.resourcesLastSelectedItemSetting.set(e)}resetView(){this.visibleView&&zi.shouldCloseOnReset(this.visibleView)&&this.showView(null)}showView(e){this.pendingViewPromise=null,this.visibleView!==e&&(this.visibleView&&this.visibleView.detach(),e&&e.show(this.storageViews),this.visibleView=e,this.storageViewToolbar.removeToolbarItems(),this.storageViewToolbar.element.classList.toggle("hidden",!0),e instanceof o.View.SimpleView&&e.toolbarItems().then((e=>{e.map((e=>this.storageViewToolbar.appendToolbarItem(e))),this.storageViewToolbar.element.classList.toggle("hidden",!e.length)})))}async scheduleShowView(e){this.pendingViewPromise=e;const t=await e;return this.pendingViewPromise!==e?null:(this.showView(t),t)}showCategoryView(e,t){this.categoryView||(this.categoryView=new mi),this.categoryView.setText(e),this.categoryView.setLink(t),this.showView(this.categoryView)}showDOMStorage(e){e&&(this.domStorageView?this.domStorageView.setStorage(e):this.domStorageView=new Vi(e),this.showView(this.domStorageView))}showCookies(e,t){const i=e.model(a.CookieModel.CookieModel);i&&(this.cookieView?this.cookieView.setCookiesDomain(i,t):this.cookieView=new Fi(i,t),this.showView(this.cookieView))}clearCookies(e,t){const i=e.model(a.CookieModel.CookieModel);i&&i.clear(t).then((()=>{this.cookieView&&this.cookieView.refreshItems()}))}wasShown(){super.wasShown(),this.registerCSSFiles([Ui])}}class Gi{static instance(e={forceNew:null}){const{forceNew:t}=e;return qi&&!t||(qi=new Gi),qi}async reveal(e){if(!(e instanceof a.Resource.Resource))throw new Error("Internal error: not a resource");const t=await zi.showAndGetSidebar();await t.showResource(e)}}class Ki{static instance(e={forceNew:null}){const{forceNew:t}=e;return _i&&!t||(_i=new Ki),_i}async reveal(e){if(!(e instanceof a.Cookie.CookieReference))throw new Error("Internal error: not a cookie reference");const t=await zi.showAndGetSidebar();await t.cookieListTreeElement.select();const i=e.contextUrl();i&&await this.revealByDomain(t,i)||this.revealByDomain(t,e.domain())}async revealByDomain(e,t){const i=e.cookieListTreeElement.children().find((e=>e.cookieDomain().endsWith(t)));return!!i&&(await i.revealAndSelect(),!0)}}class $i{static instance(e={forceNew:null}){const{forceNew:t}=e;return ji&&!t||(ji=new $i),ji}async reveal(e){if(!(e instanceof a.ResourceTreeModel.ResourceTreeFrame))throw new Error("Internal error: not a frame");(await zi.showAndGetSidebar()).showFrame(e)}}var Qi=Object.freeze({__proto__:null,ResourcesPanel:zi,ResourceRevealer:Gi,CookieReferenceRevealer:Ki,FrameDetailsRevealer:$i});export{se as AppManifestView,yi as ApplicationPanelSidebar,ne as BackgroundServiceModel,we as BackgroundServiceView,Oi as CookieItemsView,Ai as DOMStorageItemsView,_e as DOMStorageModel,Ie as DatabaseModel,De as DatabaseQueryView,Ve as DatabaseTableView,Xe as IndexedDBModel,st as IndexedDBViews,ut as OpenedWindowDetailsView,Gt as ReportingApiReportsView,Qi as ResourcesPanel,z as ServiceWorkerCacheViews,St as ServiceWorkerUpdateCycleView,Et as ServiceWorkersView,Ri as StorageItemsView,Bt as StorageView};
diff --git a/chii/panels/application/components/components.js b/chii/panels/application/components/components.js
new file mode 100644
index 00000000..6a3f9daf
--- /dev/null
+++ b/chii/panels/application/components/components.js
@@ -0,0 +1 @@
+import*as e from"../../../core/i18n/i18n.js";import*as t from"../../../ui/components/data_grid/data_grid.js";import*as i from"../../../ui/components/helpers/helpers.js";import*as r from"../../../ui/lit-html/lit-html.js";import*as a from"../../../ui/components/expandable_list/expandable_list.js";import*as o from"../../../ui/legacy/components/utils/utils.js";import*as n from"../../../core/sdk/sdk.js";import*as s from"../../network/forward/forward.js";import*as l from"../../../ui/components/icon_button/icon_button.js";import*as d from"../../../ui/components/render_coordinator/render_coordinator.js";import*as c from"../../../ui/components/report_view/report_view.js";import*as h from"../../../core/common/common.js";import*as m from"../../../models/bindings/bindings.js";import*as p from"../../../core/root/root.js";import*as u from"../../../ui/legacy/legacy.js";import*as g from"../../../models/workspace/workspace.js";import*as w from"../../../ui/components/adorners/adorners.js";import*as T from"../../../ui/components/tree_outline/tree_outline.js";const f=new CSSStyleSheet;f.replaceSync(":host{overflow:auto;height:100%}.reporting-container{height:100%;display:flex;flex-direction:column}.reporting-header{font-size:15px;background-color:var(--color-background-elevation-1);padding:1px 4px}.reporting-placeholder{flex-grow:1;display:flex;align-items:center;justify-content:center;font-size:13px;color:var(--color-text-secondary)}devtools-data-grid-controller{border:1px solid var(--color-details-hairline)}.inline-icon{vertical-align:text-bottom}\n/*# sourceURL=reportingApiGrid.css */\n");const S={noEndpointsToDisplay:"No endpoints to display"},v=e.i18n.registerUIStrings("panels/application/components/EndpointsGrid.ts",S),R=e.i18n.getLocalizedString.bind(void 0,v),{render:k,html:$}=r;class b extends HTMLElement{static litTagName=r.literal`devtools-resources-endpoints-grid`;shadow=this.attachShadow({mode:"open"});endpoints=new Map;connectedCallback(){this.shadow.adoptedStyleSheets=[f],this.render()}set data(e){this.endpoints=e.endpoints,this.render()}render(){const i={columns:[{id:"origin",title:e.i18n.lockedString("Origin"),widthWeighting:30,hideable:!1,visible:!0},{id:"name",title:e.i18n.lockedString("Name"),widthWeighting:20,hideable:!1,visible:!0},{id:"url",title:e.i18n.lockedString("URL"),widthWeighting:30,hideable:!1,visible:!0}],rows:this.buildReportRows()};k($` ${this.endpoints.size>0?$` <${t.DataGridController.DataGridController.litTagName} .data="${i}"> ${t.DataGridController.DataGridController.litTagName}> `:$`
${R(S.noEndpointsToDisplay)}
`}
`,this.shadow)}buildReportRows(){return Array.from(this.endpoints).map((([e,t])=>t.map((t=>({cells:[{columnId:"origin",value:e},{columnId:"name",value:t.groupName},{columnId:"url",value:t.url}]}))))).flat()}}i.CustomElements.defineComponent("devtools-resources-endpoints-grid",b);var y=Object.freeze({__proto__:null,i18nString:R,EndpointsGrid:b});const N=new CSSStyleSheet;N.replaceSync(".stack-trace-row{display:flex}.stack-trace-function-name{width:100px}.stack-trace-source-location{display:flex;overflow:hidden}.text-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ignore-list-link{opacity:60%}.devtools-link,.link{color:var(--color-link);text-decoration:underline;cursor:pointer;padding:2px 0}\n/*# sourceURL=stackTraceRow.css */\n");const x=new CSSStyleSheet;x.replaceSync("button.link{color:var(--color-link);text-decoration:underline;cursor:pointer;padding:2px 0;border:none;background:0 0;font-family:inherit;font-size:inherit}\n/*# sourceURL=stackTraceLinkButton.css */\n");const C={cannotRenderStackTrace:"Cannot render stack trace",showSMoreFrames:"{n, plural, =1 {Show # more frame} other {Show # more frames}}"},I=e.i18n.registerUIStrings("panels/application/components/StackTrace.ts",C),V=e.i18n.getLocalizedString.bind(void 0,I);class D extends HTMLElement{static litTagName=r.literal`devtools-stack-trace-row`;shadow=this.attachShadow({mode:"open"});stackTraceRowItem=null;set data(e){this.stackTraceRowItem=e.stackTraceRowItem,this.render()}connectedCallback(){this.shadow.adoptedStyleSheets=[N]}render(){this.stackTraceRowItem&&r.render(r.html` ${this.stackTraceRowItem.functionName}
${this.stackTraceRowItem.link?r.html`
\xA0@\xA0${this.stackTraceRowItem.link}
`:r.nothing}
`,this.shadow,{host:this})}}class E extends HTMLElement{static litTagName=r.literal`devtools-stack-trace-link-button`;shadow=this.attachShadow({mode:"open"});onShowAllClick=()=>{};hiddenCallFramesCount=null;set data(e){this.onShowAllClick=e.onShowAllClick,this.hiddenCallFramesCount=e.hiddenCallFramesCount,this.render()}connectedCallback(){this.shadow.adoptedStyleSheets=[x]}render(){this.hiddenCallFramesCount&&r.render(r.html`
`,this.shadow,{host:this})}}class A extends HTMLElement{static litTagName=r.literal`devtools-resources-stack-trace`;shadow=this.attachShadow({mode:"open"});linkifier=new o.Linkifier.Linkifier;stackTraceRows=[];showHidden=!1;set data(e){const t=e.frame,{creationStackTrace:i,creationStackTraceTarget:r}=t.getCreationStackTraceData();i&&(this.stackTraceRows=e.buildStackTraceRows(i,r,this.linkifier,!0,this.onStackTraceRowsUpdated.bind(this))),this.render()}onStackTraceRowsUpdated(e){this.stackTraceRows=e,this.render()}onShowAllClick(){this.showHidden=!0,this.render()}createRowTemplates(){const e=[];let t=0;for(const i of this.stackTraceRows)(this.showHidden||!i.ignoreListHide&&!i.rowCountHide)&&("functionName"in i&&e.push(r.html` <${D.litTagName} data-stack-trace-row .data="${{stackTraceRowItem:i}}">${D.litTagName}>`),"asyncDescription"in i&&e.push(r.html` ${i.asyncDescription}
`)),!this.showHidden&&"functionName"in i&&(i.ignoreListHide||i.rowCountHide)&&t++;return t&&e.push(r.html` <${E.litTagName} data-stack-trace-row .data="${{onShowAllClick:this.onShowAllClick.bind(this),hiddenCallFramesCount:t}}">${E.litTagName}> `),e}render(){if(!this.stackTraceRows.length)return void r.render(r.html` ${V(C.cannotRenderStackTrace)} `,this.shadow,{host:this});const e=this.createRowTemplates();r.render(r.html` <${a.ExpandableList.ExpandableList.litTagName} .data="${{rows:e}}"> ${a.ExpandableList.ExpandableList.litTagName}> `,this.shadow,{host:this})}}i.CustomElements.defineComponent("devtools-stack-trace-row",D),i.CustomElements.defineComponent("devtools-stack-trace-link-button",E),i.CustomElements.defineComponent("devtools-resources-stack-trace",A);var L=Object.freeze({__proto__:null,StackTraceRow:D,StackTraceLinkButton:E,StackTrace:A});const P=new CSSStyleSheet;P.replaceSync(":host{display:contents}.text-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.devtools-link,.link{color:var(--color-link);text-decoration:underline;cursor:pointer;padding:2px 0}button.link{border:none;background:0 0;font-family:inherit;font-size:inherit}.policies-list{padding-top:3px}.permissions-row{display:flex;line-height:22px}.permissions-row div{padding-right:5px}.feature-name{width:135px}.allowed-icon{padding:2.5px 0}.block-reason{width:215px}\n/*# sourceURL=permissionsPolicySection.css */\n");const F={showDetails:"Show details",hideDetails:"Hide details",allowedFeatures:"Allowed Features",disabledFeatures:"Disabled Features",clickToShowHeader:'Click to reveal the request whose "`Permissions-Policy`" HTTP header disables this feature.',clickToShowIframe:"Click to reveal the top-most iframe which does not allow this feature in the elements panel.",disabledByIframe:'missing in iframe "`allow`" attribute',disabledByHeader:'disabled by "`Permissions-Policy`" header'},U=e.i18n.registerUIStrings("panels/application/components/PermissionsPolicySection.ts",F),O=e.i18n.getLocalizedString.bind(void 0,U),H=d.RenderCoordinator.RenderCoordinator.instance();function M(e,t,i){return r.html` `}class _ extends HTMLElement{static litTagName=r.literal`devtools-resources-permissions-policy-section`;shadow=this.attachShadow({mode:"open"});permissionsPolicySectionData={policies:[],showDetails:!1};set data(e){this.permissionsPolicySectionData=e,this.render()}connectedCallback(){this.shadow.adoptedStyleSheets=[P]}toggleShowPermissionsDisallowedDetails(){this.permissionsPolicySectionData.showDetails=!this.permissionsPolicySectionData.showDetails,this.render()}renderAllowed(){const e=this.permissionsPolicySectionData.policies.filter((e=>e.allowed)).map((e=>e.feature)).sort();return e.length?r.html` <${c.ReportView.ReportKey.litTagName}>${O(F.allowedFeatures)}${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName}> ${e.join(", ")} ${c.ReportView.ReportValue.litTagName}> `:r.nothing}async renderDisallowed(){const e=this.permissionsPolicySectionData.policies.filter((e=>!e.allowed)).sort(((e,t)=>e.feature.localeCompare(t.feature)));if(!e.length)return r.nothing;if(!this.permissionsPolicySectionData.showDetails)return r.html` <${c.ReportView.ReportKey.litTagName}>${O(F.disabledFeatures)}${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName}> ${e.map((e=>e.feature)).join(", ")} ${c.ReportView.ReportValue.litTagName}> `;const t=n.FrameManager.FrameManager.instance(),i=await Promise.all(e.map((async e=>{const i=e.locator?t.getFrame(e.locator.frameId):null,a=e.locator?.blockReason,o=await("IframeAttribute"===a&&i&&i.getOwnerDOMNodeOrDocument()),n=i&&i.resourceForURL(i.url),d="Header"===a&&n&&n.request,c="IframeAttribute"===a?O(F.disabledByIframe):"Header"===a?O(F.disabledByHeader):"";return r.html` <${l.Icon.Icon.litTagName} class="allowed-icon" .data="${{color:"",iconName:"error_icon",width:"14px"}}"> ${l.Icon.Icon.litTagName}>
${e.feature}
${c}
${o?M("elements_panel_icon",O(F.clickToShowIframe),(()=>h.Revealer.reveal(o))):r.nothing} ${d?M("network_panel_icon",O(F.clickToShowHeader),(async()=>{if(!d)return;const e=d.responseHeaderValue("permissions-policy")?"permissions-policy":"feature-policy",t=s.UIRequestLocation.UIRequestLocation.responseHeaderMatch(d,{name:e,value:""});await h.Revealer.reveal(t)})):r.nothing}
`})));return r.html` <${c.ReportView.ReportKey.litTagName}>${O(F.disabledFeatures)}${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName} class="policies-list"> ${i}
${c.ReportView.ReportValue.litTagName}> `}async render(){await H.write("PermissionsPolicySection render",(()=>{r.render(r.html` <${c.ReportView.ReportSectionHeader.litTagName}>${e.i18n.lockedString("Permissions Policy")}${c.ReportView.ReportSectionHeader.litTagName}> ${this.renderAllowed()} ${r.Directives.until(this.renderDisallowed(),r.nothing)} <${c.ReportView.ReportSectionDivider.litTagName}>${c.ReportView.ReportSectionDivider.litTagName}> `,this.shadow,{host:this})}))}}i.CustomElements.defineComponent("devtools-resources-permissions-policy-section",_);const W=new CSSStyleSheet;W.replaceSync(":host .badge-error{--override-adorner-text-color:var(--color-red);--override-adorner-border-color:var(--color-red)}:host .badge-success{--override-adorner-text-color:var(--color-accent-green);--override-adorner-border-color:var(--color-accent-green)}:host .badge-secondary{--override-adorner-text-color:var(--color-text-secondary);--override-adorner-border-color:var(--color-text-secondary)}:host{font-family:var(--source-code-font-family)}\n/*# sourceURL=badge.css */\n");const j=new CSSStyleSheet;j.replaceSync(".content{display:grid;grid-template-columns:min-content 1fr}.key{color:var(--color-text-secondary);padding:0 6px;text-align:right;white-space:pre}.value{color:var(--color-text-primary);margin-inline-start:0;padding:0 6px}.error-text{color:var(--color-red);font-weight:700}\n/*# sourceURL=originTrialTokenRows.css */\n");const B=new CSSStyleSheet;B.replaceSync(":host{--legacy-item-selection-bg-color:transparent}\n/*# sourceURL=originTrialTreeView.css */\n");const K={origin:"Origin",trialName:"Trial Name",expiryTime:"Expiry Time",usageRestriction:"Usage Restriction",isThirdParty:"Third Party",matchSubDomains:"Subdomain Matching",rawTokenText:"Raw Token",status:"Token Status",token:"Token",tokens:"{PH1} tokens"},G=e.i18n.registerUIStrings("panels/application/components/OriginTrialTreeView.ts",K),q=e.i18n.getLocalizedString.bind(void 0,G);class z extends HTMLElement{static litTagName=r.literal`devtools-resources-origin-trial-tree-view-badge`;shadow=this.attachShadow({mode:"open"});adorner=new w.Adorner.Adorner;set data(e){this.render(e)}connectedCallback(){this.shadow.adoptedStyleSheets=[W]}render(e){const t=document.createElement("span");t.textContent=e.badgeContent,this.adorner.data={name:"badge",content:t},this.adorner.classList.add(`badge-${e.style}`),r.render(r.html` ${this.adorner} `,this.shadow,{host:this})}}function J(e){return{treeNodeData:e,id:"OriginTrialTreeNode#"+e.trialName,children:async()=>e.tokensWithStatus.length>1?e.tokensWithStatus.map(Y):X(e.tokensWithStatus[0]),renderer:e=>{const t=e.treeNodeData,i=r.html` <${z.litTagName} .data="${{badgeContent:q(K.tokens,{PH1:t.tokensWithStatus.length}),style:"secondary"}}">${z.litTagName}> `;return r.html` ${t.trialName} <${z.litTagName} .data="${{badgeContent:t.status,style:"Enabled"===t.status?"success":"error"}}">${z.litTagName}> ${t.tokensWithStatus.length>1?i:r.nothing} `}}}function Y(e){return{treeNodeData:e.status,id:"TokenNode#"+e.rawTokenText,children:async()=>X(e),renderer:(e,t)=>{const i=e.treeNodeData,a=r.html` <${z.litTagName} .data="${{badgeContent:i,style:"Success"===i?"success":"error"}}">${z.litTagName}> `;return r.html`${q(K.token)} ${t.isExpanded?r.nothing:a}`}}}function Q(e){return r.html` <${ee.litTagName} .data="${{node:e}}"> ${ee.litTagName}> `}function X(e){return[{treeNodeData:e,id:"TokenDetailsNode#"+e.rawTokenText,renderer:Q},(t=e.rawTokenText,{treeNodeData:q(K.rawTokenText),id:"TokenRawTextContainerNode#"+t,children:async()=>[{treeNodeData:t,id:"TokenRawTextNode#"+t,renderer:e=>{const t=e.treeNodeData;return r.html` ${t}
`}}]})];var t}function Z(e){return r.html`${String(e.treeNodeData)}`}i.CustomElements.defineComponent("devtools-resources-origin-trial-tree-view-badge",z);class ee extends HTMLElement{static litTagName=r.literal`devtools-resources-origin-trial-token-rows`;shadow=this.attachShadow({mode:"open"});tokenWithStatus=null;parsedTokenDetails=[];dateFormatter=new Intl.DateTimeFormat(e.DevToolsLocale.DevToolsLocale.instance().locale,{dateStyle:"long",timeStyle:"long"});set data(e){this.tokenWithStatus=e.node.treeNodeData,this.setTokenFields()}connectedCallback(){this.shadow.adoptedStyleSheets=[j],this.render()}renderTokenField=(e,t)=>r.html` ${e}
`;setTokenFields(){this.tokenWithStatus?.parsedToken&&(this.parsedTokenDetails=[{name:q(K.origin),value:this.renderTokenField(this.tokenWithStatus.parsedToken.origin,"WrongOrigin"===this.tokenWithStatus.status)},{name:q(K.expiryTime),value:this.renderTokenField(this.dateFormatter.format(1e3*this.tokenWithStatus.parsedToken.expiryTime),"Expired"===this.tokenWithStatus.status)},{name:q(K.usageRestriction),value:this.renderTokenField(this.tokenWithStatus.parsedToken.usageRestriction)},{name:q(K.isThirdParty),value:this.renderTokenField(this.tokenWithStatus.parsedToken.isThirdParty.toString())},{name:q(K.matchSubDomains),value:this.renderTokenField(this.tokenWithStatus.parsedToken.matchSubDomains.toString())}],"UnknownTrial"===this.tokenWithStatus.status&&(this.parsedTokenDetails=[{name:q(K.trialName),value:this.renderTokenField(this.tokenWithStatus.parsedToken.trialName)},...this.parsedTokenDetails]))}render(){if(!this.tokenWithStatus)return;const e=[{name:q(K.status),value:r.html` <${z.litTagName} .data="${{badgeContent:this.tokenWithStatus.status,style:"Success"===this.tokenWithStatus.status?"success":"error"}}">${z.litTagName}>`},...this.parsedTokenDetails].map((e=>r.html` ${e.name}
${e.value}
`));r.render(r.html` ${e}
`,this.shadow,{host:this})}}i.CustomElements.defineComponent("devtools-resources-origin-trial-token-rows",ee);class te extends HTMLElement{static litTagName=r.literal`devtools-resources-origin-trial-tree-view`;shadow=this.attachShadow({mode:"open"});set data(e){this.render(e.trials)}connectedCallback(){this.shadow.adoptedStyleSheets=[B]}render(e){e.length&&r.render(r.html` <${T.TreeOutline.TreeOutline.litTagName} .data="${{tree:e.map(J),defaultRenderer:Z}}"> ${T.TreeOutline.TreeOutline.litTagName}> `,this.shadow,{host:this})}}i.CustomElements.defineComponent("devtools-resources-origin-trial-tree-view",te);var ie=Object.freeze({__proto__:null,Badge:z,OriginTrialTokenRows:ee,OriginTrialTreeView:te});const re=new CSSStyleSheet;re.replaceSync('.text-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}button~.text-ellipsis{padding-left:2px}.devtools-link,.link{color:var(--color-link);text-decoration:underline;cursor:pointer;padding:2px 0}button.link{border:none;background:0 0;font-family:inherit;font-size:inherit}.inline-button{padding-left:1ex}.inline-comment{padding-left:1ex;white-space:pre-line}.inline-comment::before{content:"("}.inline-comment::after{content:")"}.inline-name{color:var(--color-text-secondary);padding-left:2ex;user-select:none;white-space:pre-line}.inline-name::after{content:":\\u00a0"}.inline-items{display:flex}.span-cols{grid-column-start:span 2;margin:0 0 8px 30px;line-height:28px}.button-icon-with-text{vertical-align:sub}.without-min-width{min-width:auto}\n/*# sourceURL=frameDetailsReportView.css */\n');const ae={additionalInformation:"Additional Information",thisAdditionalDebugging:"This additional (debugging) information is shown because the 'Protocol Monitor' experiment is enabled.",frameId:"Frame ID",document:"Document",clickToRevealInSourcesPanel:"Click to reveal in Sources panel",clickToRevealInNetworkPanel:"Click to reveal in Network panel",unreachableUrl:"Unreachable URL",clickToRevealInNetworkPanelMight:"Click to reveal in Network panel (might require page reload)",ownerElement:"Owner Element",clickToRevealInElementsPanel:"Click to reveal in Elements panel",adStatus:"Ad Status",rootDescription:"This frame has been identified as the root frame of an ad",root:"root",childDescription:"This frame has been identified as a child frame of an ad",child:"child",securityIsolation:"Security & Isolation",secureContext:"Secure Context",yes:"Yes",no:"No",crossoriginIsolated:"`Cross-Origin` Isolated",localhostIsAlwaysASecureContext:"`Localhost` is always a secure context",aFrameAncestorIsAnInsecure:"A frame ancestor is an insecure context",theFramesSchemeIsInsecure:"The frame's scheme is insecure",reportingTo:"reporting to",apiAvailability:"API availability",availabilityOfCertainApisDepends:"Availability of certain APIs depends on the document being `cross-origin` isolated.",availableTransferable:"available, transferable",availableNotTransferable:"available, not transferable",unavailable:"unavailable",sharedarraybufferConstructorIs:"`SharedArrayBuffer` constructor is available and `SABs` can be transferred via `postMessage`",sharedarraybufferConstructorIsAvailable:"`SharedArrayBuffer` constructor is available but `SABs` cannot be transferred via `postMessage`",willRequireCrossoriginIsolated:"⚠️ will require `cross-origin` isolated context in the future",requiresCrossoriginIsolated:"requires `cross-origin` isolated context",transferRequiresCrossoriginIsolatedPermission:"`SharedArrayBuffer` transfer requires enabling the permission policy:",available:"available",thePerformanceAPI:"The `performance.measureUserAgentSpecificMemory()` API is available",thePerformancemeasureuseragentspecificmemory:"The `performance.measureUserAgentSpecificMemory()` API is not available",measureMemory:"Measure Memory",learnMore:"Learn more",creationStackTrace:"Frame Creation `Stack Trace`",creationStackTraceExplanation:"This frame was created programmatically. The `stack trace` shows where this happened.",parentIsAdExplanation:"This frame is considered an ad frame because its parent frame is an ad frame.",matchedBlockingRuleExplanation:"This frame is considered an ad frame because its current (or previous) main document is an ad resource.",createdByAdScriptExplanation:"There was an ad script in the `(async) stack` when this frame was created. Examining the creation `stack trace` of this frame might provide more insight."},oe=e.i18n.registerUIStrings("panels/application/components/FrameDetailsView.ts",ae),ne=e.i18n.getLocalizedString.bind(void 0,oe);class se extends u.ThrottledWidget.ThrottledWidget{reportView=new de;frame;constructor(e){super(),this.frame=e,this.contentElement.classList.add("overflow-auto"),this.contentElement.appendChild(this.reportView),this.update()}async doUpdate(){this.reportView.data={frame:this.frame}}}const le=d.RenderCoordinator.RenderCoordinator.instance();class de extends HTMLElement{static litTagName=r.literal`devtools-resources-frame-details-view`;shadow=this.attachShadow({mode:"open"});frame;protocolMonitorExperimentEnabled=!1;permissionsPolicies=null;permissionsPolicySectionData={policies:[],showDetails:!1};originTrialTreeView=new te;connectedCallback(){this.protocolMonitorExperimentEnabled=p.Runtime.experiments.isEnabled("protocolMonitor"),this.shadow.adoptedStyleSheets=[re]}set data(e){this.frame=e.frame,!this.permissionsPolicies&&this.frame&&(this.permissionsPolicies=this.frame.getPermissionsPolicyState()),this.render()}async render(){await le.write("FrameDetailsView render",(()=>{this.frame&&r.render(r.html` <${c.ReportView.Report.litTagName} .data="${{reportTitle:this.frame.displayName()}}"> ${this.renderDocumentSection()} ${this.renderIsolationSection()} ${this.renderApiAvailabilitySection()} ${this.renderOriginTrial()} ${r.Directives.until(this.permissionsPolicies?.then((e=>(this.permissionsPolicySectionData.policies=e||[],r.html` <${_.litTagName} .data="${this.permissionsPolicySectionData}"> ${_.litTagName}> `))),r.nothing)} ${this.protocolMonitorExperimentEnabled?this.renderAdditionalInfoSection():r.nothing} ${c.ReportView.Report.litTagName}> `,this.shadow,{host:this})}))}renderOriginTrial(){if(!this.frame)return r.nothing;this.originTrialTreeView.classList.add("span-cols");const t=this.frame,i=()=>{t.getOriginTrials().then((e=>{this.originTrialTreeView.data={trials:e}}))};return i(),r.html` <${c.ReportView.ReportSectionHeader.litTagName}> ${e.i18n.lockedString("Origin Trials")} <${l.IconButton.IconButton.litTagName} class="inline-button" .data="${{clickHandler:i,groups:[{iconName:"refresh_12x12_icon",text:"Refresh"}]}}"> ${l.IconButton.IconButton.litTagName}> ${c.ReportView.ReportSectionHeader.litTagName}> ${this.originTrialTreeView} <${c.ReportView.ReportSectionDivider.litTagName}>${c.ReportView.ReportSectionDivider.litTagName}> `}renderDocumentSection(){return this.frame?r.html` <${c.ReportView.ReportSectionHeader.litTagName}>${ne(ae.document)}${c.ReportView.ReportSectionHeader.litTagName}> <${c.ReportView.ReportKey.litTagName}>${e.i18n.lockedString("URL")}${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName}> ${this.maybeRenderSourcesLinkForURL()} ${this.maybeRenderNetworkLinkForURL()}
${this.frame.url}
${c.ReportView.ReportValue.litTagName}> ${this.maybeRenderUnreachableURL()} ${this.maybeRenderOrigin()} ${r.Directives.until(this.renderOwnerElement(),r.nothing)} ${this.maybeRenderCreationStacktrace()} ${this.maybeRenderAdStatus()} <${c.ReportView.ReportSectionDivider.litTagName}>${c.ReportView.ReportSectionDivider.litTagName}> `:r.nothing}maybeRenderSourcesLinkForURL(){if(!this.frame||this.frame.unreachableUrl())return r.nothing;const e=this.uiSourceCodeForFrame(this.frame);return M("sources_panel_icon",ne(ae.clickToRevealInSourcesPanel),(()=>h.Revealer.reveal(e)))}maybeRenderNetworkLinkForURL(){if(this.frame){const e=this.frame.resourceForURL(this.frame.url);if(e&&e.request){const t=e.request;return M("network_panel_icon",ne(ae.clickToRevealInNetworkPanel),(()=>{const e=s.UIRequestLocation.UIRequestLocation.tab(t,s.UIRequestLocation.UIRequestTabs.Headers);return h.Revealer.reveal(e)}))}}return r.nothing}uiSourceCodeForFrame(e){for(const t of g.Workspace.WorkspaceImpl.instance().projects()){const i=m.NetworkProject.NetworkProject.getTargetForProject(t);if(i&&i===e.resourceTreeModel().target()){const i=t.uiSourceCodeForURL(e.url);if(i)return i}}return null}maybeRenderUnreachableURL(){return this.frame&&this.frame.unreachableUrl()?r.html` <${c.ReportView.ReportKey.litTagName}>${ne(ae.unreachableUrl)}${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName}> ${this.renderNetworkLinkForUnreachableURL()}
${this.frame.unreachableUrl()}
${c.ReportView.ReportValue.litTagName}> `:r.nothing}renderNetworkLinkForUnreachableURL(){if(this.frame){const e=h.ParsedURL.ParsedURL.fromString(this.frame.unreachableUrl());if(e)return M("network_panel_icon",ne(ae.clickToRevealInNetworkPanelMight),(()=>{h.Revealer.reveal(s.UIFilter.UIRequestFilter.filters([{filterType:s.UIFilter.FilterType.Domain,filterValue:e.domain()},{filterType:null,filterValue:e.path}]))}))}return r.nothing}maybeRenderOrigin(){return this.frame&&this.frame.securityOrigin&&"://"!==this.frame.securityOrigin?r.html` <${c.ReportView.ReportKey.litTagName}>${e.i18n.lockedString("Origin")}${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName}> ${this.frame.securityOrigin}
${c.ReportView.ReportValue.litTagName}> `:r.nothing}async renderOwnerElement(){if(this.frame){const e=await this.frame.getOwnerDOMNodeOrDocument();if(e)return r.html` <${c.ReportView.ReportKey.litTagName}>${ne(ae.ownerElement)}${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName} class="without-min-width"> ${c.ReportView.ReportValue.litTagName}> `}return r.nothing}maybeRenderCreationStacktrace(){const e=this.frame?.getCreationStackTraceData();return e&&e.creationStackTrace?r.html` <${c.ReportView.ReportKey.litTagName} title="${ne(ae.creationStackTraceExplanation)}">${ne(ae.creationStackTrace)}${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName}> <${A.litTagName} .data="${{frame:this.frame,buildStackTraceRows:o.JSPresentationUtils.buildStackTraceRows}}"> ${A.litTagName}> ${c.ReportView.ReportValue.litTagName}> `:r.nothing}getAdFrameTypeStrings(e){switch(e){case"child":return{value:ne(ae.child),description:ne(ae.childDescription)};case"root":return{value:ne(ae.root),description:ne(ae.rootDescription)}}}getAdFrameExplanationString(e){switch(e){case"CreatedByAdScript":return ne(ae.createdByAdScriptExplanation);case"MatchedBlockingRule":return ne(ae.matchedBlockingRuleExplanation);case"ParentIsAd":return ne(ae.parentIsAdExplanation)}}maybeRenderAdStatus(){if(!this.frame)return r.nothing;const e=this.frame.adFrameType();if("none"===e)return r.nothing;const t=this.getAdFrameTypeStrings(e),i=[r.html`${t.value}
`];for(const e of this.frame.adFrameStatus()?.explanations||[])i.push(r.html`${this.getAdFrameExplanationString(e)}
`);return r.html` <${c.ReportView.ReportKey.litTagName}>${ne(ae.adStatus)}${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName}> <${a.ExpandableList.ExpandableList.litTagName} .data="${{rows:i}}">${a.ExpandableList.ExpandableList.litTagName}>${c.ReportView.ReportValue.litTagName}> `}renderIsolationSection(){return this.frame?r.html` <${c.ReportView.ReportSectionHeader.litTagName}>${ne(ae.securityIsolation)}${c.ReportView.ReportSectionHeader.litTagName}> <${c.ReportView.ReportKey.litTagName}>${ne(ae.secureContext)}${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName}> ${this.frame.isSecureContext()?ne(ae.yes):ne(ae.no)}\xA0${this.maybeRenderSecureContextExplanation()} ${c.ReportView.ReportValue.litTagName}> <${c.ReportView.ReportKey.litTagName}>${ne(ae.crossoriginIsolated)}${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName}> ${this.frame.isCrossOriginIsolated()?ne(ae.yes):ne(ae.no)} ${c.ReportView.ReportValue.litTagName}> ${r.Directives.until(this.maybeRenderCoopCoepStatus(),r.nothing)} <${c.ReportView.ReportSectionDivider.litTagName}>${c.ReportView.ReportSectionDivider.litTagName}> `:r.nothing}maybeRenderSecureContextExplanation(){const e=this.getSecureContextExplanation();return e?r.html``:r.nothing}getSecureContextExplanation(){switch(this.frame?.getSecureContextType()){case"Secure":return null;case"SecureLocalhost":return ne(ae.localhostIsAlwaysASecureContext);case"InsecureAncestor":return ne(ae.aFrameAncestorIsAnInsecure);case"InsecureScheme":return ne(ae.theFramesSchemeIsInsecure)}return null}async maybeRenderCoopCoepStatus(){if(this.frame){const t=this.frame.resourceTreeModel().target().model(n.NetworkManager.NetworkManager),i=t&&await t.getSecurityIsolationStatus(this.frame.id);if(i)return r.html` ${this.maybeRenderCrossOriginStatus(i.coep,e.i18n.lockedString("Cross-Origin Embedder Policy (COEP)"),"None")} ${this.maybeRenderCrossOriginStatus(i.coop,e.i18n.lockedString("Cross-Origin Opener Policy (COOP)"),"UnsafeNone")} `}return r.nothing}maybeRenderCrossOriginStatus(e,t,i){if(!e)return r.nothing;const a=e.value!==i,o=!a&&e.reportOnlyValue!==i,n=a?e.reportingEndpoint:e.reportOnlyReportingEndpoint;return r.html` <${c.ReportView.ReportKey.litTagName}>${t}${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName}> ${a?e.value:e.reportOnlyValue} ${o?r.html``:r.nothing} ${n?r.html`${ne(ae.reportingTo)}${n}`:r.nothing} ${c.ReportView.ReportValue.litTagName}> `}renderApiAvailabilitySection(){return this.frame?r.html` <${c.ReportView.ReportSectionHeader.litTagName}>${ne(ae.apiAvailability)}${c.ReportView.ReportSectionHeader.litTagName}> ${ne(ae.availabilityOfCertainApisDepends)} ${ne(ae.learnMore)}
${this.renderSharedArrayBufferAvailability()} ${this.renderMeasureMemoryAvailability()} <${c.ReportView.ReportSectionDivider.litTagName}>${c.ReportView.ReportSectionDivider.litTagName}> `:r.nothing}renderSharedArrayBufferAvailability(){if(this.frame){const e=this.frame.getGatedAPIFeatures();if(e){const t=e.includes("SharedArrayBuffers"),i=t&&e.includes("SharedArrayBuffersTransferAllowed"),a=ne(i?ae.availableTransferable:t?ae.availableNotTransferable:ae.unavailable),o=i?ne(ae.sharedarraybufferConstructorIs):t?ne(ae.sharedarraybufferConstructorIsAvailable):"";function n(e){switch(e.getCrossOriginIsolatedContextType()){case"Isolated":return r.nothing;case"NotIsolated":return t?r.html``:r.html``;case"NotIsolatedFeatureDisabled":if(!i)return r.html``}return r.nothing}return r.html` <${c.ReportView.ReportKey.litTagName}>SharedArrayBuffers${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName} title="${o}"> ${a}\xA0${n(this.frame)} ${c.ReportView.ReportValue.litTagName}> `}}return r.nothing}renderMeasureMemoryAvailability(){if(this.frame){const e=this.frame.isCrossOriginIsolated(),t=ne(e?ae.available:ae.unavailable),i=ne(e?ae.thePerformanceAPI:ae.thePerformancemeasureuseragentspecificmemory);return r.html` <${c.ReportView.ReportKey.litTagName}>${ne(ae.measureMemory)}${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName}> ${t}\xA0${ne(ae.learnMore)} ${c.ReportView.ReportValue.litTagName}> `}return r.nothing}renderAdditionalInfoSection(){return this.frame?r.html` <${c.ReportView.ReportSectionHeader.litTagName} title="${ne(ae.thisAdditionalDebugging)}">${ne(ae.additionalInformation)}${c.ReportView.ReportSectionHeader.litTagName}> <${c.ReportView.ReportKey.litTagName}>${ne(ae.frameId)}${c.ReportView.ReportKey.litTagName}> <${c.ReportView.ReportValue.litTagName}> ${this.frame.id}
${c.ReportView.ReportValue.litTagName}> <${c.ReportView.ReportSectionDivider.litTagName}>${c.ReportView.ReportSectionDivider.litTagName}> `:r.nothing}}i.CustomElements.defineComponent("devtools-resources-frame-details-view",de);var ce=Object.freeze({__proto__:null,FrameDetailsView:se,FrameDetailsReportView:de});const he={noReportsToDisplay:"No reports to display"},me=e.i18n.registerUIStrings("panels/application/components/ReportsGrid.ts",he),pe=e.i18n.getLocalizedString.bind(void 0,me),{render:ue,html:ge}=r;class we extends HTMLElement{static litTagName=r.literal`devtools-resources-reports-grid-status-header`;shadow=this.attachShadow({mode:"open"});connectedCallback(){this.shadow.adoptedStyleSheets=[f],this.render()}render(){ue(ge` ${e.i18n.lockedString("Status")} <${l.Icon.Icon.litTagName} class="inline-icon" .data="${{iconName:"help_outline",color:"var(--color-primary)",width:"16px",height:"16px"}}">${l.Icon.Icon.litTagName}> `,this.shadow,{host:this})}}class Te extends HTMLElement{static litTagName=r.literal`devtools-resources-reports-grid`;shadow=this.attachShadow({mode:"open"});reports=[];protocolMonitorExperimentEnabled=!1;connectedCallback(){this.shadow.adoptedStyleSheets=[f],this.protocolMonitorExperimentEnabled=p.Runtime.experiments.isEnabled("protocolMonitor"),this.render()}set data(e){this.reports=e.reports,this.render()}render(){const i={columns:[{id:"url",title:e.i18n.lockedString("URL"),widthWeighting:30,hideable:!1,visible:!0},{id:"type",title:e.i18n.lockedString("Type"),widthWeighting:20,hideable:!1,visible:!0},{id:"status",title:e.i18n.lockedString("Status"),widthWeighting:20,hideable:!1,visible:!0,titleElement:ge` <${we.litTagName}>${we.litTagName}> `},{id:"destination",title:e.i18n.lockedString("Destination"),widthWeighting:20,hideable:!1,visible:!0},{id:"timestamp",title:e.i18n.lockedString("Timestamp"),widthWeighting:20,hideable:!1,visible:!0},{id:"body",title:e.i18n.lockedString("Body"),widthWeighting:20,hideable:!1,visible:!0}],rows:this.buildReportRows()};this.protocolMonitorExperimentEnabled&&i.columns.unshift({id:"id",title:"ID",widthWeighting:30,hideable:!1,visible:!0}),ue(ge` ${this.reports.length>0?ge` <${t.DataGridController.DataGridController.litTagName} .data="${i}"> ${t.DataGridController.DataGridController.litTagName}> `:ge`
${pe(he.noReportsToDisplay)}
`}
`,this.shadow,{host:this})}buildReportRows(){return this.reports.map((e=>({cells:[{columnId:"id",value:e.id},{columnId:"url",value:e.initiatorUrl},{columnId:"type",value:e.type},{columnId:"status",value:e.status},{columnId:"destination",value:e.destination},{columnId:"timestamp",value:new Date(1e3*e.timestamp).toLocaleString()},{columnId:"body",value:JSON.stringify(e.body)}]})))}}i.CustomElements.defineComponent("devtools-resources-reports-grid-status-header",we),i.CustomElements.defineComponent("devtools-resources-reports-grid",Te);var fe=Object.freeze({__proto__:null,i18nString:pe,ReportsGridStatusHeader:we,ReportsGrid:Te});const Se=new CSSStyleSheet;Se.replaceSync(":host{padding:20px}.heading{font-size:15px}devtools-data-grid-controller{border:1px solid var(--color-details-hairline);margin-top:20px}.info-icon{vertical-align:text-bottom;height:14px}.no-tt-message{margin-top:20px}\n/*# sourceURL=trustTokensView.css */\n");const ve=new CSSStyleSheet;ve.replaceSync(".delete-button{width:16px;height:16px;background:0 0;overflow:hidden;border:none;padding:0;outline:0;cursor:pointer}.delete-button:hover devtools-icon{--icon-color:var(--color-text-primary)}.delete-button:focus devtools-icon{--icon-color:var(--color-text-secondary)}.button-container{display:block;text-align:center}\n/*# sourceURL=trustTokensViewDeleteButton.css */\n");const Re={issuer:"Issuer",storedTokenCount:"Stored token count",allStoredTrustTokensAvailableIn:"All stored Trust Tokens available in this browser instance.",noTrustTokensStored:"No Trust Tokens are currently stored.",deleteTrustTokens:"Delete all stored Trust Tokens issued by {PH1}."},ke=e.i18n.registerUIStrings("panels/application/components/TrustTokensView.ts",Re),$e=e.i18n.getLocalizedString.bind(void 0,ke);class be extends HTMLElement{static litTagName=r.literal`devtools-trust-tokens-delete-button`;shadow=this.attachShadow({mode:"open"});issuer=null;deleteClickHandler=()=>{};connectedCallback(){this.shadow.adoptedStyleSheets=[ve]}set data(e){this.issuer=e.issuer,this.deleteClickHandler=e.deleteClickHandler,this.render()}render(){this.issuer&&r.render(r.html` `,this.shadow,{host:this})}}class ye extends HTMLElement{static litTagName=r.literal`devtools-trust-tokens-storage-view`;shadow=this.attachShadow({mode:"open"});tokens=[];deleteClickHandler=()=>{};connectedCallback(){this.shadow.adoptedStyleSheets=[Se],this.render()}set data(e){this.tokens=e.tokens,this.deleteClickHandler=e.deleteClickHandler,this.render()}render(){r.render(r.html` Trust Tokens <${l.Icon.Icon.litTagName} class="info-icon" title="${$e(Re.allStoredTrustTokensAvailableIn)}" .data="${{iconName:"ic_info_black_18dp",color:"var(--color-link)",width:"14px"}}"> ${l.Icon.Icon.litTagName}> ${this.renderGridOrNoDataMessage()}
`,this.shadow,{host:this})}renderGridOrNoDataMessage(){if(0===this.tokens.length)return r.html`${$e(Re.noTrustTokensStored)}
`;const e={columns:[{id:"issuer",title:$e(Re.issuer),widthWeighting:10,hideable:!1,visible:!0,sortable:!0},{id:"count",title:$e(Re.storedTokenCount),widthWeighting:5,hideable:!1,visible:!0,sortable:!0},{id:"delete-button",title:"",widthWeighting:1,hideable:!1,visible:!0,sortable:!1}],rows:this.buildRowsFromTokens(),initialSort:{columnId:"issuer",direction:"ASC"}};return r.html` <${t.DataGridController.DataGridController.litTagName} .data="${e}">${t.DataGridController.DataGridController.litTagName}> `}buildRowsFromTokens(){return this.tokens.filter((e=>e.count>0)).map((e=>({cells:[{columnId:"delete-button",value:Ne(e.issuerOrigin),renderer:this.deleteButtonRendererForDataGridCell.bind(this)},{columnId:"issuer",value:Ne(e.issuerOrigin)},{columnId:"count",value:e.count}]})))}deleteButtonRendererForDataGridCell(e){return r.html`<${be.litTagName} .data="${{issuer:e,deleteClickHandler:this.deleteClickHandler}}">${be.litTagName}>`}}function Ne(e){return e.replace(/\/$/,"")}i.CustomElements.defineComponent("devtools-trust-tokens-delete-button",be),i.CustomElements.defineComponent("devtools-trust-tokens-storage-view",ye);var xe=Object.freeze({__proto__:null,i18nString:$e,TrustTokensView:ye});export{y as EndpointsGrid,ce as FrameDetailsView,ie as OriginTrialTreeView,fe as ReportsGrid,L as StackTrace,xe as TrustTokensView};
diff --git a/chii/panels/browser_debugger/browser_debugger-legacy.js b/chii/panels/browser_debugger/browser_debugger-legacy.js
new file mode 100644
index 00000000..e9f18182
--- /dev/null
+++ b/chii/panels/browser_debugger/browser_debugger-legacy.js
@@ -0,0 +1 @@
+import*as e from"./browser_debugger.js";self.BrowserDebugger=self.BrowserDebugger||{},BrowserDebugger=BrowserDebugger||{},BrowserDebugger.DOMBreakpointsSidebarPane=e.DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane,BrowserDebugger.DOMBreakpointsSidebarPane.BreakpointTypeLabels=e.DOMBreakpointsSidebarPane.BreakpointTypeLabels,BrowserDebugger.DOMBreakpointsSidebarPane.ContextMenuProvider=e.DOMBreakpointsSidebarPane.ContextMenuProvider,BrowserDebugger.EventListenerBreakpointsSidebarPane=e.EventListenerBreakpointsSidebarPane.EventListenerBreakpointsSidebarPane,BrowserDebugger.CSPViolationBreakpointsSidebarPane=e.CSPViolationBreakpointsSidebarPane.CSPViolationBreakpointsSidebarPane,BrowserDebugger.ObjectEventListenersSidebarPane=e.ObjectEventListenersSidebarPane.ObjectEventListenersSidebarPane,BrowserDebugger.ObjectEventListenersSidebarPane._objectGroupName=e.ObjectEventListenersSidebarPane.objectGroupName,BrowserDebugger.XHRBreakpointsSidebarPane=e.XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane;
diff --git a/chii/panels/browser_debugger/browser_debugger-meta.js b/chii/panels/browser_debugger/browser_debugger-meta.js
new file mode 100644
index 00000000..4cb4f960
--- /dev/null
+++ b/chii/panels/browser_debugger/browser_debugger-meta.js
@@ -0,0 +1 @@
+import*as e from"../../core/sdk/sdk.js";import*as t from"../../ui/legacy/legacy.js";import*as i from"../../core/i18n/i18n.js";const r={showEventListenerBreakpoints:"Show Event Listener Breakpoints",eventListenerBreakpoints:"Event Listener Breakpoints",showCspViolationBreakpoints:"Show CSP Violation Breakpoints",cspViolationBreakpoints:"CSP Violation Breakpoints",showXhrfetchBreakpoints:"Show XHR/fetch Breakpoints",xhrfetchBreakpoints:"XHR/fetch Breakpoints",showDomBreakpoints:"Show DOM Breakpoints",domBreakpoints:"DOM Breakpoints",showGlobalListeners:"Show Global Listeners",globalListeners:"Global Listeners",page:"Page",showPage:"Show Page",overrides:"Overrides",showOverrides:"Show Overrides",contentScripts:"Content scripts",showContentScripts:"Show Content scripts"},n=i.i18n.registerUIStrings("panels/browser_debugger/browser_debugger-meta.ts",r),a=i.i18n.getLazilyComputedLocalizedString.bind(void 0,n);let o,s;async function c(){return o||(o=await import("./browser_debugger.js")),o}async function p(){return s||(s=await import("../sources/sources.js")),s}t.ViewManager.registerViewExtension({loadView:async()=>(await c()).EventListenerBreakpointsSidebarPane.EventListenerBreakpointsSidebarPane.instance(),id:"sources.eventListenerBreakpoints",location:"sources.sidebar-bottom",commandPrompt:a(r.showEventListenerBreakpoints),title:a(r.eventListenerBreakpoints),order:9,persistence:"permanent"}),t.ViewManager.registerViewExtension({loadView:async()=>(await c()).CSPViolationBreakpointsSidebarPane.CSPViolationBreakpointsSidebarPane.instance(),id:"sources.cspViolationBreakpoints",location:"sources.sidebar-bottom",commandPrompt:a(r.showCspViolationBreakpoints),title:a(r.cspViolationBreakpoints),order:10,persistence:"permanent"}),t.ViewManager.registerViewExtension({loadView:async()=>(await c()).XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane.instance(),id:"sources.xhrBreakpoints",location:"sources.sidebar-bottom",commandPrompt:a(r.showXhrfetchBreakpoints),title:a(r.xhrfetchBreakpoints),order:5,persistence:"permanent",hasToolbar:!0}),t.ViewManager.registerViewExtension({loadView:async()=>(await c()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance(),id:"sources.domBreakpoints",location:"sources.sidebar-bottom",commandPrompt:a(r.showDomBreakpoints),title:a(r.domBreakpoints),order:7,persistence:"permanent"}),t.ViewManager.registerViewExtension({loadView:async()=>(await c()).ObjectEventListenersSidebarPane.ObjectEventListenersSidebarPane.instance(),id:"sources.globalListeners",location:"sources.sidebar-bottom",commandPrompt:a(r.showGlobalListeners),title:a(r.globalListeners),order:8,persistence:"permanent",hasToolbar:!0}),t.ViewManager.registerViewExtension({loadView:async()=>(await c()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance(),id:"elements.domBreakpoints",location:"elements-sidebar",commandPrompt:a(r.showDomBreakpoints),title:a(r.domBreakpoints),order:6,persistence:"permanent"}),t.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-network",title:a(r.page),commandPrompt:a(r.showPage),order:2,persistence:"permanent",loadView:async()=>(await p()).SourcesNavigator.NetworkNavigatorView.instance()}),t.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-overrides",title:a(r.overrides),commandPrompt:a(r.showOverrides),order:4,persistence:"permanent",loadView:async()=>(await p()).SourcesNavigator.OverridesNavigatorView.instance()}),t.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-contentScripts",title:a(r.contentScripts),commandPrompt:a(r.showContentScripts),order:5,persistence:"permanent",loadView:async()=>(await p()).SourcesNavigator.ContentScriptsNavigatorView.instance()}),t.ContextMenu.registerProvider({contextTypes:()=>[e.DOMModel.DOMNode],loadProvider:async()=>(await c()).DOMBreakpointsSidebarPane.ContextMenuProvider.instance(),experiment:void 0}),t.Context.registerListener({contextTypes:()=>[e.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await c()).XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane.instance()}),t.Context.registerListener({contextTypes:()=>[e.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await c()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance()});
diff --git a/chii/panels/browser_debugger/browser_debugger.js b/chii/panels/browser_debugger/browser_debugger.js
new file mode 100644
index 00000000..4dc1206b
--- /dev/null
+++ b/chii/panels/browser_debugger/browser_debugger.js
@@ -0,0 +1 @@
+import*as e from"../../core/sdk/sdk.js";import*as t from"../../core/i18n/i18n.js";import*as i from"../../ui/legacy/legacy.js";import*as n from"../../core/common/common.js";import*as o from"../sources/sources.js";import*as s from"../event_listeners/event_listeners.js";const r=new CSSStyleSheet;r.replaceSync(":host{margin:0;padding:2px 4px;min-height:18px}.tree-outline{padding:0}.tree-outline li{margin-left:14px;user-select:text;cursor:default}.tree-outline li.parent{margin-left:1px}.tree-outline li:not(.parent)::before{display:none}.breakpoint-hit{--override-breakpoint-hit-background-color:rgb(255 255 194);--override-breakpoint-hit-border-color:rgb(107 97 48);background-color:var(--override-breakpoint-hit-background-color)}:host-context(.-theme-with-dark-background) .breakpoint-hit{--override-breakpoint-hit-background-color:hsl(46deg 98% 22%);--override-breakpoint-hit-dark-mode-color:#ccc;color:var(--override-breakpoint-hit-dark-mode-color)}.breakpoint-hit .breakpoint-hit-marker{background-color:var(--override-breakpoint-hit-background-color);border-right:3px solid var(--override-breakpoint-hit-border-color);height:100%;left:0;margin-left:-30px;position:absolute;right:-4px;z-index:-1}.source-code[is=dt-checkbox]{max-width:100%}\n/*# sourceURL=categorizedBreakpointsSidebarPane.css */\n");const a={breakpointHit:"breakpoint hit"},l=t.i18n.registerUIStrings("panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts",a),d=t.i18n.getLocalizedString.bind(void 0,l);class c extends i.Widget.VBox{#e;#t;#i;#n;#o;#s;constructor(t,n,o,s){super(!0),this.#e=new i.TreeOutline.TreeOutlineInShadow,this.#e.setShowSelectionOnKeyboardFocus(!0),this.contentElement.appendChild(this.#e.element),this.#t=o,this.#i=s,this.#n=new Map;for(const e of t)this.#n.has(e)||this.createCategory(e);if(t.length>0){const e=this.#n.get(t[0]);e&&e.element.select()}this.#o=new Map;for(const e of n)this.createBreakpoint(e);e.TargetManager.TargetManager.instance().addModelListener(e.DebuggerModel.DebuggerModel,e.DebuggerModel.Events.DebuggerPaused,this.update,this),e.TargetManager.TargetManager.instance().addModelListener(e.DebuggerModel.DebuggerModel,e.DebuggerModel.Events.DebuggerResumed,this.update,this),i.Context.Context.instance().addFlavorChangeListener(e.Target.Target,this.update,this)}get categories(){return this.#n}get breakpoints(){return this.#o}focus(){this.#e.forceSelect()}createCategory(e){const t=i.UIUtils.CheckboxLabel.create(e);t.checkboxElement.addEventListener("click",this.categoryCheckboxClicked.bind(this,e),!0),t.checkboxElement.tabIndex=-1;const n=new i.TreeOutline.TreeElement(t);n.listItemElement.addEventListener("keydown",(t=>{if(" "===t.key){const i=this.#n.get(e);i&&i.checkbox.click(),t.consume(!0)}})),t.checkboxElement.addEventListener("focus",(()=>n.listItemElement.focus())),i.ARIAUtils.setChecked(n.listItemElement,!1),this.#e.appendChild(n),this.#n.set(e,{element:n,checkbox:t.checkboxElement})}createBreakpoint(e){const t=i.UIUtils.CheckboxLabel.create(e.title());t.classList.add("source-code"),t.checkboxElement.addEventListener("click",this.breakpointCheckboxClicked.bind(this,e),!0),t.checkboxElement.tabIndex=-1;const n=new i.TreeOutline.TreeElement(t);n.listItemElement.addEventListener("keydown",(t=>{if(" "===t.key){const i=this.#o.get(e);i&&i.checkbox.click(),t.consume(!0)}})),t.checkboxElement.addEventListener("focus",(()=>n.listItemElement.focus())),i.ARIAUtils.setChecked(n.listItemElement,!1),n.listItemElement.createChild("div","breakpoint-hit-marker");const o=this.#n.get(e.category());o&&o.element.appendChild(n),this.#o.set(e,{element:n,checkbox:t.checkboxElement})}getBreakpointFromPausedDetails(e){return null}update(){const t=i.Context.Context.instance().flavor(e.Target.Target),n=t?t.model(e.DebuggerModel.DebuggerModel):null,o=n?n.debuggerPausedDetails():null;if(!o||o.reason!==this.#i||!o.auxData)return void(this.#s&&(i.ARIAUtils.setDescription(this.#s,""),this.#s.classList.remove("breakpoint-hit"),this.#s=void 0));const s=this.getBreakpointFromPausedDetails(o);if(!s)return;i.ViewManager.ViewManager.instance().showView(this.#t);const r=this.#n.get(s.category());r&&r.element.expand();const l=this.#o.get(s);l&&(this.#s=l.element.listItemElement,i.ARIAUtils.setDescription(this.#s,d(a.breakpointHit)),this.#s.classList.add("breakpoint-hit"))}categoryCheckboxClicked(e){const t=this.#n.get(e);if(!t)return;const n=t.checkbox.checked;i.ARIAUtils.setChecked(t.element.listItemElement,n);for(const t of this.#o.keys())if(t.category()===e){const e=this.#o.get(t);e&&(e.checkbox.checked=n,this.toggleBreakpoint(t,n))}}toggleBreakpoint(e,t){e.setEnabled(t)}breakpointCheckboxClicked(e){const t=this.#o.get(e);if(!t)return;this.toggleBreakpoint(e,t.checkbox.checked),i.ARIAUtils.setChecked(t.element.listItemElement,t.checkbox.checked);let n=!1,o=!1;for(const t of this.#o.keys())t.category()===e.category()&&(t.enabled()?n=!0:o=!0);const s=this.#n.get(e.category());s&&(s.checkbox.checked=n,s.checkbox.indeterminate=n&&o,s.checkbox.indeterminate?i.ARIAUtils.setCheckboxAsIndeterminate(s.element.listItemElement):i.ARIAUtils.setChecked(s.element.listItemElement,n))}wasShown(){super.wasShown(),this.#e.registerCSSFiles([r])}}let h;class p extends c{constructor(){const t=e.DOMDebuggerModel.DOMDebuggerManager.instance().cspViolationBreakpoints(),i=t.map((e=>e.category()));i.sort(),super(i,t,"sources.cspViolationBreakpoints","CSPViolation")}static instance(){return h||(h=new p),h}getBreakpointFromPausedDetails(t){const i=t.auxData&&t.auxData.violationType?t.auxData.violationType:"",n=e.DOMDebuggerModel.DOMDebuggerManager.instance().cspViolationBreakpoints().find((e=>e.type()===i));return n||null}toggleBreakpoint(t,i){t.setEnabled(i),e.DOMDebuggerModel.DOMDebuggerManager.instance().updateCSPViolationBreakpoints()}}var b=Object.freeze({__proto__:null,CSPViolationBreakpointsSidebarPane:p});const k=new CSSStyleSheet;k.replaceSync(".breakpoint-list{padding-bottom:3px}.breakpoint-list .dom-breakpoint>div{overflow:hidden;text-overflow:ellipsis}.breakpoint-entry{display:flex;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;padding:2px 0}.breakpoint-entry:focus-visible{background-color:var(--legacy-focus-bg-color)}.breakpoint-list .breakpoint-entry:hover{background-color:var(--color-background-elevation-2)}.breakpoint-hit{background-color:var(--color-background-elevation-2);border-right:3px solid var(--color-details-hairline);color:var(--color-text-primary)}@media (forced-colors:active){.breakpoint-entry:focus-visible,.breakpoint-list .breakpoint-entry:hover{forced-color-adjust:none;background-color:Highlight}.breakpoint-entry:focus-visible *,.breakpoint-list .breakpoint-entry:hover *{color:HighlightText}}\n/*# sourceURL=domBreakpointsSidebarPane.css */\n");const g={noBreakpoints:"No breakpoints",domBreakpointsList:"DOM Breakpoints list",sS:"{PH1}: {PH2}",checked:"checked",unchecked:"unchecked",sBreakpointHit:"{PH1} breakpoint hit",breakpointHit:"breakpoint hit",revealDomNodeInElementsPanel:"Reveal DOM node in Elements panel",removeBreakpoint:"Remove breakpoint",removeAllDomBreakpoints:"Remove all DOM breakpoints",subtreeModified:"Subtree modified",attributeModified:"Attribute modified",nodeRemoved:"Node removed",breakOn:"Break on",breakpointRemoved:"Breakpoint removed",breakpointSet:"Breakpoint set"},u=t.i18n.registerUIStrings("panels/browser_debugger/DOMBreakpointsSidebarPane.ts",g),m=t.i18n.getLocalizedString.bind(void 0,u),v=t.i18n.getLazilyComputedLocalizedString.bind(void 0,u);let f;class M extends i.Widget.VBox{elementToCheckboxes;#r;#o;#a;#l;constructor(){super(!0),this.elementToCheckboxes=new WeakMap,this.#r=this.contentElement.createChild("div","gray-info-message"),this.#r.textContent=m(g.noBreakpoints),this.#o=new i.ListModel.ListModel,this.#a=new i.ListControl.ListControl(this.#o,this,i.ListControl.ListMode.NonViewport),this.contentElement.appendChild(this.#a.element),this.#a.element.classList.add("breakpoint-list","hidden"),i.ARIAUtils.markAsList(this.#a.element),i.ARIAUtils.setAccessibleName(this.#a.element,m(g.domBreakpointsList)),this.#r.tabIndex=-1,e.TargetManager.TargetManager.instance().addModelListener(e.DOMDebuggerModel.DOMDebuggerModel,e.DOMDebuggerModel.Events.DOMBreakpointAdded,this.breakpointAdded,this),e.TargetManager.TargetManager.instance().addModelListener(e.DOMDebuggerModel.DOMDebuggerModel,e.DOMDebuggerModel.Events.DOMBreakpointToggled,this.breakpointToggled,this),e.TargetManager.TargetManager.instance().addModelListener(e.DOMDebuggerModel.DOMDebuggerModel,e.DOMDebuggerModel.Events.DOMBreakpointsRemoved,this.breakpointsRemoved,this);for(const t of e.TargetManager.TargetManager.instance().models(e.DOMDebuggerModel.DOMDebuggerModel)){t.retrieveDOMBreakpoints();for(const e of t.domBreakpoints())this.addBreakpoint(e)}this.#l=null,this.update()}static instance(){return f||(f=new M),f}createElementForItem(e){const t=document.createElement("div");t.classList.add("breakpoint-entry"),t.addEventListener("contextmenu",this.contextMenu.bind(this,e),!0),i.ARIAUtils.markAsListitem(t),t.tabIndex=-1;const o=i.UIUtils.CheckboxLabel.create(void 0,e.enabled),s=o.checkboxElement;s.addEventListener("click",this.checkboxClicked.bind(this,e),!1),s.tabIndex=-1,this.elementToCheckboxes.set(t,s),t.appendChild(o),t.addEventListener("keydown",(e=>{" "===e.key&&(o.checkboxElement.click(),e.consume(!0))}));const r=document.createElement("div");r.classList.add("dom-breakpoint"),t.appendChild(r);const a=document.createElement("div"),l=x.get(e.type);a.textContent=l?l():null;const d=l?l():"";i.ARIAUtils.setAccessibleName(s,d);const c=document.createElement("monospace");c.style.display="block",r.appendChild(c),n.Linkifier.Linkifier.linkify(e.node,{preventKeyboardFocus:!0,tooltip:void 0}).then((e=>{c.appendChild(e),i.ARIAUtils.setAccessibleName(s,m(g.sS,{PH1:d,PH2:e.deepTextContent()}))})),r.appendChild(a);const h=e.enabled?m(g.checked):m(g.unchecked);return e===this.#l?(t.classList.add("breakpoint-hit"),i.ARIAUtils.setDescription(t,m(g.sBreakpointHit,{PH1:h})),i.ARIAUtils.setDescription(s,m(g.breakpointHit))):i.ARIAUtils.setDescription(t,h),this.#r.classList.add("hidden"),this.#a.element.classList.remove("hidden"),t}heightForItem(e){return 0}isItemSelectable(e){return!0}updateSelectedItemARIA(e,t){return!0}selectedItemChanged(e,t,i,n){i&&(i.tabIndex=-1),n&&(this.setDefaultFocusedElement(n),n.tabIndex=0,this.hasFocus()&&n.focus())}breakpointAdded(e){this.addBreakpoint(e.data)}breakpointToggled(e){const t=this.hasFocus(),i=e.data;this.#a.refreshItem(i),t&&this.focus()}breakpointsRemoved(e){const t=this.hasFocus(),i=e.data;let n=-1;for(const e of i){const t=this.#o.indexOf(e);t>=0&&(this.#o.remove(t),n=t)}if(0===this.#o.length)this.#r.classList.remove("hidden"),this.setDefaultFocusedElement(this.#r),this.#a.element.classList.add("hidden");else if(n>=0){const e=this.#o.at(n);e&&this.#a.selectItem(e)}t&&this.focus()}addBreakpoint(e){this.#o.insertWithComparator(e,((e,t)=>e.type>t.type?-1:e.typen.Revealer.reveal(e.node))),o.defaultSection().appendItem(m(g.removeBreakpoint),(()=>{e.domDebuggerModel.removeDOMBreakpoint(e.node,e.type)})),o.defaultSection().appendItem(m(g.removeAllDomBreakpoints),(()=>{e.domDebuggerModel.removeAllDOMBreakpoints()})),o.show()}checkboxClicked(e,t){e.domDebuggerModel.toggleDOMBreakpoint(e,!!t.target&&t.target.checked)}flavorChanged(e){this.update()}update(){const t=i.Context.Context.instance().flavor(e.DebuggerModel.DebuggerPausedDetails);if(this.#l){const e=this.#l;this.#l=null,this.#a.refreshItem(e)}if(!t||!t.auxData||"DOM"!==t.reason)return;const n=t.debuggerModel.target().model(e.DOMDebuggerModel.DOMDebuggerModel);if(!n)return;const o=n.resolveDOMBreakpointData(t.auxData);if(o){for(const e of this.#o)e.node===o.node&&e.type===o.type&&(this.#l=e);this.#l&&this.#a.refreshItem(this.#l),i.ViewManager.ViewManager.instance().showView("sources.domBreakpoints")}}wasShown(){super.wasShown(),this.registerCSSFiles([k])}}const x=new Map([["subtree-modified",v(g.subtreeModified)],["attribute-modified",v(g.attributeModified)],["node-removed",v(g.nodeRemoved)]]);let D;class B{static instance(e={forceNew:null}){const{forceNew:t}=e;return D&&!t||(D=new B),D}appendApplicableItems(t,n,s){const r=s;if(r.pseudoType())return;const a=r.domModel().target().model(e.DOMDebuggerModel.DOMDebuggerModel);if(!a)return;function l(e){if(!a)return;const t=o.DebuggerPausedMessage.BreakpointTypeNouns.get(e),n=t?t():"";a.hasDOMBreakpoint(r,e)?(a.removeDOMBreakpoint(r,e),i.ARIAUtils.alert(`${m(g.breakpointRemoved)}: ${n}`)):(a.setDOMBreakpoint(r,e),i.ARIAUtils.alert(`${m(g.breakpointSet)}: ${n}`))}const d=n.debugSection().appendSubMenuItem(m(g.breakOn)),c={SubtreeModified:"subtree-modified",AttributeModified:"attribute-modified",NodeRemoved:"node-removed"};for(const e of Object.values(c)){const t=o.DebuggerPausedMessage.BreakpointTypeNouns.get(e);t&&d.defaultSection().appendCheckboxItem(t(),l.bind(null,e),a.hasDOMBreakpoint(r,e))}}}var E=Object.freeze({__proto__:null,DOMBreakpointsSidebarPane:M,ContextMenuProvider:B});let C;class w extends c{constructor(){let t=e.DOMDebuggerModel.DOMDebuggerManager.instance().eventListenerBreakpoints();const i=e.EventBreakpointsModel.EventBreakpointsManager.instance().eventListenerBreakpoints();t=t.concat(i);const n=t.map((e=>e.category()));n.sort(),super(n,t,"sources.eventListenerBreakpoints","EventListener")}static instance(){return C||(C=new w),C}getBreakpointFromPausedDetails(t){const i=t.auxData,n=e.DOMDebuggerModel.DOMDebuggerManager.instance().resolveEventListenerBreakpoint(i);return n||e.EventBreakpointsModel.EventBreakpointsManager.instance().resolveEventListenerBreakpoint(i)}}var L=Object.freeze({__proto__:null,EventListenerBreakpointsSidebarPane:w});const I={refreshGlobalListeners:"Refresh global listeners"},y=t.i18n.registerUIStrings("panels/browser_debugger/ObjectEventListenersSidebarPane.ts",I),O=t.i18n.getLocalizedString.bind(void 0,y);let S;class A extends i.Widget.VBox{#d;#c;#h;constructor(){super(),this.#d=new i.Toolbar.ToolbarButton(O(I.refreshGlobalListeners),"largeicon-refresh"),this.#d.addEventListener(i.Toolbar.ToolbarButton.Events.Click,this.refreshClick,this),this.#d.setEnabled(!1),this.#c=new s.EventListenersView.EventListenersView(this.update.bind(this),!0),this.#c.show(this.element),this.setDefaultFocusedChild(this.#c)}static instance(){return S||(S=new A),S}get eventListenersView(){return this.#c}toolbarItems(){return[this.#d]}update(){this.#h&&(this.#h.runtimeModel.releaseObjectGroup(R),this.#h=void 0);const t=i.Context.Context.instance().flavor(e.RuntimeModel.ExecutionContext);if(!t)return this.#c.reset(),void this.#c.addEmptyHolderIfNeeded();this.#h=t,Promise.all([this.windowObjectInContext(t)]).then(this.#c.addObjects.bind(this.#c))}wasShown(){super.wasShown(),i.Context.Context.instance().addFlavorChangeListener(e.RuntimeModel.ExecutionContext,this.update,this),this.#d.setEnabled(!0),this.update()}willHide(){super.willHide(),i.Context.Context.instance().removeFlavorChangeListener(e.RuntimeModel.ExecutionContext,this.update,this),this.#d.setEnabled(!1)}windowObjectInContext(e){return e.evaluate({expression:"self",objectGroup:R,includeCommandLineAPI:!1,silent:!0,returnByValue:!1,generatePreview:!1,timeout:void 0,throwOnSideEffect:void 0,disableBreaks:void 0,replMode:void 0,allowUnsafeEvalBlockedByCSP:void 0},!1,!1).then((e=>"error"in e||e.exceptionDetails?null:e.object))}refreshClick(e){e.data.consume(),this.update()}}const R="object-event-listeners-sidebar-pane";var T=Object.freeze({__proto__:null,ObjectEventListenersSidebarPane:A,objectGroupName:R});const P=new CSSStyleSheet;P.replaceSync(".breakpoint-list{padding-bottom:3px}.breakpoint-list .editing.being-edited{overflow:hidden;white-space:nowrap}.breakpoint-condition{display:block;margin:4px 8px 4px 23px}.breakpoint-condition-input{display:block;margin-left:0;margin-right:0;outline:0!important;border:1px solid var(--color-background-elevation-2)}.breakpoint-entry{white-space:nowrap;padding:2px 0}.breakpoint-list .breakpoint-entry:hover{background-color:var(--color-background-elevation-1)}.breakpoint-list .breakpoint-entry:focus-visible{background-color:var(--legacy-focus-bg-color)}.breakpoint-entry [is=dt-checkbox]{max-width:100%}.breakpoint-hit{--override-breakpoint-hit-background-color:rgb(255 255 194);--override-breakpoint-hit-border-color:rgb(107 97 48);background-color:var(--override-breakpoint-hit-background-color);border-right:3px solid var(--override-breakpoint-hit-border-color)}.-theme-with-dark-background .breakpoint-hit,:host-context(.-theme-with-dark-background) .breakpoint-hit{--override-breakpoint-hit-background-color:hsl(46deg 98% 22%);--override-breakpoint-hit-border-color:#ccc}@media (forced-colors:active){.breakpoint-list .breakpoint-entry:focus-visible,.breakpoint-list .breakpoint-entry:hover{forced-color-adjust:none;background-color:Highlight}.breakpoint-list .breakpoint-entry:focus-visible *,.breakpoint-list .breakpoint-entry:hover *{color:HighlightText}}\n/*# sourceURL=xhrBreakpointsSidebarPane.css */\n");const U={xhrfetchBreakpoints:"XHR/fetch Breakpoints",noBreakpoints:"No breakpoints",addXhrfetchBreakpoint:"Add XHR/fetch breakpoint",addBreakpoint:"Add breakpoint",breakWhenUrlContains:"Break when URL contains:",urlBreakpoint:"URL Breakpoint",urlContainsS:'URL contains "{PH1}"',anyXhrOrFetch:"Any XHR or fetch",breakpointHit:"breakpoint hit",removeAllBreakpoints:"Remove all breakpoints",removeBreakpoint:"Remove breakpoint"},V=t.i18n.registerUIStrings("panels/browser_debugger/XHRBreakpointsSidebarPane.ts",U),H=t.i18n.getLocalizedString.bind(void 0,V),F=new WeakMap,_=new WeakMap;let j;class N extends i.Widget.VBox{#o;#a;#r;#p;#b;#k;constructor(){super(!0),this.#o=new i.ListModel.ListModel,this.#a=new i.ListControl.ListControl(this.#o,this,i.ListControl.ListMode.NonViewport),this.contentElement.appendChild(this.#a.element),this.#a.element.classList.add("breakpoint-list","hidden"),i.ARIAUtils.markAsList(this.#a.element),i.ARIAUtils.setAccessibleName(this.#a.element,H(U.xhrfetchBreakpoints)),this.#r=this.contentElement.createChild("div","gray-info-message"),this.#r.textContent=H(U.noBreakpoints),this.#p=new Map,this.#b=new i.Toolbar.ToolbarButton(H(U.addXhrfetchBreakpoint),"largeicon-add"),this.#b.addEventListener(i.Toolbar.ToolbarButton.Events.Click,(()=>{this.addButtonClicked()})),this.#r.addEventListener("contextmenu",this.emptyElementContextMenu.bind(this),!0),this.#r.tabIndex=-1,this.restoreBreakpoints(),this.update()}static instance(){return j||(j=new N),j}toolbarItems(){return[this.#b]}emptyElementContextMenu(e){const t=new i.ContextMenu.ContextMenu(e);t.defaultSection().appendItem(H(U.addBreakpoint),this.addButtonClicked.bind(this)),t.show()}async addButtonClicked(){await i.ViewManager.ViewManager.instance().showView("sources.xhrBreakpoints");const t=document.createElement("p");t.classList.add("breakpoint-condition"),t.textContent=H(U.breakWhenUrlContains);const n=t.createChild("span","breakpoint-condition-input");function o(i,n,o){this.removeListElement(t),i&&(e.DOMDebuggerModel.DOMDebuggerManager.instance().addXHRBreakpoint(o,!0),this.setBreakpoint(o)),this.update()}i.ARIAUtils.setAccessibleName(n,H(U.urlBreakpoint)),this.addListElement(t,this.#a.element.firstChild);const s=new i.InplaceEditor.Config(o.bind(this,!0),o.bind(this,!1));i.InplaceEditor.InplaceEditor.startEditing(n,s)}heightForItem(e){return 0}isItemSelectable(e){return!0}setBreakpoint(e){-1!==this.#o.indexOf(e)?this.#a.refreshItem(e):this.#o.insertWithComparator(e,((e,t)=>e>t?1:e{e.target===o&&this.checkboxClicked(t,s)}),!1),_.set(o,a.checkboxElement),a.checkboxElement.tabIndex=-1,o.tabIndex=-1,t===this.#a.selectedItem()&&(o.tabIndex=0,this.setDefaultFocusedElement(o)),o.addEventListener("keydown",(e=>{let i=!1;" "===e.key?(this.checkboxClicked(t,s),i=!0):"Enter"===e.key&&(this.labelClicked(t),i=!0),i&&e.consume(!0)})),t===this.#k&&(o.classList.add("breakpoint-hit"),i.ARIAUtils.setDescription(o,H(U.breakpointHit))),a.classList.add("cursor-auto"),a.textElement.addEventListener("dblclick",this.labelClicked.bind(this,t),!1),this.#p.set(t,n),n}selectedItemChanged(e,t,i,n){if(i){const e=F.get(i);if(!e)throw new Error("Expected breakpoint entry to be found for an element");e.tabIndex=-1}if(n){const e=F.get(n);if(!e)throw new Error("Expected breakpoint entry to be found for an element");this.setDefaultFocusedElement(e),e.tabIndex=0,this.hasFocus()&&e.focus()}}updateSelectedItemARIA(e,t){return!0}removeBreakpoint(e){const t=this.#o.indexOf(e);t>=0&&this.#o.remove(t),this.#p.delete(e),this.update()}addListElement(e,t){this.#a.element.insertBefore(e,t),this.#r.classList.add("hidden"),this.#a.element.classList.remove("hidden")}removeListElement(e){this.#a.element.removeChild(e),this.#a.element.firstElementChild||(this.#r.classList.remove("hidden"),this.#a.element.classList.add("hidden"))}contextMenu(t,n){const o=new i.ContextMenu.ContextMenu(n);const s=H(U.removeAllBreakpoints);o.defaultSection().appendItem(H(U.addBreakpoint),this.addButtonClicked.bind(this)),o.defaultSection().appendItem(H(U.removeBreakpoint),function(){e.DOMDebuggerModel.DOMDebuggerManager.instance().removeXHRBreakpoint(t),this.removeBreakpoint(t)}.bind(this)),o.defaultSection().appendItem(s,function(){for(const t of this.#p.keys())e.DOMDebuggerModel.DOMDebuggerManager.instance().removeXHRBreakpoint(t),this.removeBreakpoint(t);this.update()}.bind(this)),o.show()}checkboxClicked(t,i){const n=this.hasFocus();e.DOMDebuggerModel.DOMDebuggerManager.instance().toggleXHRBreakpoint(t,!i),this.#a.refreshItem(t),this.#a.selectItem(t),n&&this.focus()}labelClicked(t){const n=this.#p.get(t),o=document.createElement("span");function s(i,s,r){if(this.removeListElement(o),i){e.DOMDebuggerModel.DOMDebuggerManager.instance().removeXHRBreakpoint(t),this.removeBreakpoint(t);let i=!0;if(n){const e=F.get(n),t=e?_.get(e):void 0;t&&(i=t.checked)}e.DOMDebuggerModel.DOMDebuggerManager.instance().addXHRBreakpoint(r,i),this.setBreakpoint(r),this.#a.selectItem(r)}else n&&n.classList.remove("hidden");this.focus()}o.classList.add("breakpoint-condition"),o.textContent=t,n&&(this.#a.element.insertBefore(o,n),n.classList.add("hidden"));const r=new i.InplaceEditor.Config(s.bind(this,!0),s.bind(this,!1));i.InplaceEditor.InplaceEditor.startEditing(o,r)}flavorChanged(e){this.update()}update(){const t=0===this.#o.length;this.#a.element.classList.toggle("hidden",t),this.#r.classList.toggle("hidden",!t);const n=i.Context.Context.instance().flavor(e.DebuggerModel.DebuggerPausedDetails);if(!n||"XHR"!==n.reason){if(this.#k){const e=this.#k;this.#k=void 0,this.#o.indexOf(e)>=0&&this.#a.refreshItem(e)}return}const o=n.auxData&&n.auxData.breakpointURL;this.#k=o,this.#o.indexOf(o)<0||(this.#a.refreshItem(o),i.ViewManager.ViewManager.instance().showView("sources.xhrBreakpoints"))}restoreBreakpoints(){const t=e.DOMDebuggerModel.DOMDebuggerManager.instance().xhrBreakpoints();for(const e of t.keys())this.setBreakpoint(e)}wasShown(){super.wasShown(),this.registerCSSFiles([P])}}var X=Object.freeze({__proto__:null,XHRBreakpointsSidebarPane:N});export{b as CSPViolationBreakpointsSidebarPane,E as DOMBreakpointsSidebarPane,L as EventListenerBreakpointsSidebarPane,T as ObjectEventListenersSidebarPane,X as XHRBreakpointsSidebarPane};
diff --git a/chii/panels/changes/changes-legacy.js b/chii/panels/changes/changes-legacy.js
new file mode 100644
index 00000000..e9421a0f
--- /dev/null
+++ b/chii/panels/changes/changes-legacy.js
@@ -0,0 +1 @@
+import*as e from"./changes.js";self.Changes=self.Changes||{},Changes=Changes||{},Changes.ChangesSidebar=e.ChangesSidebar.ChangesSidebar,Changes.ChangesView=e.ChangesView.ChangesView,Changes.ChangesView.RowType=e.ChangesView.RowType,Changes.ChangesView.DiffUILocationRevealer=e.ChangesView.DiffUILocationRevealer;
diff --git a/chii/panels/changes/changes-meta.js b/chii/panels/changes/changes-meta.js
new file mode 100644
index 00000000..306f6bf0
--- /dev/null
+++ b/chii/panels/changes/changes-meta.js
@@ -0,0 +1 @@
+import*as e from"../../core/common/common.js";import*as a from"../../core/i18n/i18n.js";import*as i from"../../models/workspace_diff/workspace_diff.js";import*as n from"../../ui/legacy/legacy.js";let s;const o={changes:"Changes",showChanges:"Show Changes"},t=a.i18n.registerUIStrings("panels/changes/changes-meta.ts",o),r=a.i18n.getLazilyComputedLocalizedString.bind(void 0,t);async function c(){return s||(s=await import("./changes.js")),s}n.ViewManager.registerViewExtension({location:"drawer-view",id:"changes.changes",title:r(o.changes),commandPrompt:r(o.showChanges),persistence:"closeable",loadView:async()=>(await c()).ChangesView.ChangesView.instance()}),e.Revealer.registerRevealer({contextTypes:()=>[i.WorkspaceDiff.DiffUILocation],destination:e.Revealer.RevealerDestination.CHANGES_DRAWER,loadRevealer:async()=>(await c()).ChangesView.DiffUILocationRevealer.instance()});
diff --git a/chii/panels/changes/changes.js b/chii/panels/changes/changes.js
new file mode 100644
index 00000000..361610a0
--- /dev/null
+++ b/chii/panels/changes/changes.js
@@ -0,0 +1 @@
+import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as i from"../../core/root/root.js";import*as o from"../../third_party/diff/diff.js";import*as r from"../../ui/components/diff_view/diff_view.js";import*as s from"../../ui/legacy/legacy.js";import*as n from"../../models/workspace_diff/workspace_diff.js";import*as a from"../../core/platform/platform.js";import*as c from"../../models/workspace/workspace.js";import*as d from"../snippets/snippets.js";const l=new CSSStyleSheet;l.replaceSync("[slot=insertion-point-main]{flex-direction:column;display:flex}[slot=insertion-point-sidebar]{overflow:auto}.diff-container{flex:1;overflow:auto}:focus.selected{--override-selected-color:#fff;background-color:var(--legacy-selection-bg-color);color:var(--override-selected-color)}.-theme-with-dark-background :focus.selected,:host-context(.-theme-with-dark-background) :focus.selected{--override-selected-color:rgb(0 0 0)}.changes-toolbar{background-color:var(--color-background-elevation-1);border-top:var(--legacy-divider-border)}\n/*# sourceURL=changesView.css */\n");const h=new CSSStyleSheet;h.replaceSync(".tree-outline{--override-script-snippet-tree-item-color:hsl(48deg 70% 50%);--override-stylesheet-tree-item-color:hsl(256deg 50% 50%);--override-image-font-tree-item-color:hsl(109deg 33% 50%)}.-theme-with-dark-background .tree-outline,:host-context(.-theme-with-dark-background) .tree-outline{--override-script-snippet-tree-item-color:rgb(217 181 38);--override-stylesheet-tree-item-color:rgb(98 64 191);--override-image-font-tree-item-color:rgb(101 170 85)}li .icon{margin:-3px -5px;background:var(--color-background-elevation-2)}.tree-outline li{min-height:20px}.tree-outline li:hover:not(.selected) .selection{display:block;background-color:var(--item-hover-color)}.navigator-script-tree-item .icon,.navigator-sm-script-tree-item .icon,.navigator-snippet-tree-item .icon{background:var(--override-script-snippet-tree-item-color)}.navigator-sm-stylesheet-tree-item .icon,.navigator-stylesheet-tree-item .icon{background:var(--override-stylesheet-tree-item-color)}.navigator-font-tree-item .icon,.navigator-image-tree-item .icon{background:var(--override-image-font-tree-item-color)}@media (forced-colors:active){.navigator-font-tree-item .icon,.navigator-image-tree-item .icon,.navigator-script-tree-item .icon,.navigator-sm-script-tree-item .icon,.navigator-sm-stylesheet-tree-item .icon,.navigator-snippet-tree-item .icon,.navigator-stylesheet-tree-item .icon,li .icon{background-color:ButtonText;background-image:none;forced-color-adjust:none}}\n/*# sourceURL=changesSidebar.css */\n");const f={sFromSourceMap:"{PH1} (from source map)"},u=t.i18n.registerUIStrings("panels/changes/ChangesSidebar.ts",f),g=t.i18n.getLocalizedString.bind(void 0,u);class m extends(e.ObjectWrapper.eventMixin(s.Widget.Widget)){treeoutline;treeElements;workspaceDiff;constructor(e){super(),this.treeoutline=new s.TreeOutline.TreeOutlineInShadow,this.treeoutline.setFocusable(!1),this.treeoutline.setComparator(((e,t)=>a.StringUtilities.compare(e.titleAsText(),t.titleAsText()))),this.treeoutline.addEventListener(s.TreeOutline.Events.ElementSelected,this.selectionChanged,this),s.ARIAUtils.markAsTablist(this.treeoutline.contentElement),this.element.appendChild(this.treeoutline.element),this.treeElements=new Map,this.workspaceDiff=e,this.workspaceDiff.modifiedUISourceCodes().forEach(this.addUISourceCode.bind(this)),this.workspaceDiff.addEventListener("ModifiedStatusChanged",this.uiSourceCodeMofiedStatusChanged,this)}selectUISourceCode(e,t){const i=this.treeElements.get(e);i&&i.select(t)}selectedUISourceCode(){return this.treeoutline.selectedTreeElement?this.treeoutline.selectedTreeElement.uiSourceCode:null}selectionChanged(){this.dispatchEventToListeners("SelectedUISourceCodeChanged")}uiSourceCodeMofiedStatusChanged(e){e.data.isModified?this.addUISourceCode(e.data.uiSourceCode):this.removeUISourceCode(e.data.uiSourceCode)}removeUISourceCode(e){const t=this.treeElements.get(e);if(this.treeElements.delete(e),this.treeoutline.selectedTreeElement===t){const e=t.previousSibling||t.nextSibling;e?e.select(!0):(t.deselect(),this.selectionChanged())}t&&(this.treeoutline.removeChild(t),t.dispose()),0===this.treeoutline.rootElement().childCount()&&this.treeoutline.setFocusable(!1)}addUISourceCode(e){const t=new p(e);this.treeElements.set(e,t),this.treeoutline.setFocusable(!0),this.treeoutline.appendChild(t),this.treeoutline.selectedTreeElement||t.select(!0)}wasShown(){super.wasShown(),this.treeoutline.registerCSSFiles([h])}}class p extends s.TreeOutline.TreeElement{uiSourceCode;eventListeners;constructor(e){super(),this.uiSourceCode=e,this.listItemElement.classList.add("navigator-"+e.contentType().name()+"-tree-item"),s.ARIAUtils.markAsTab(this.listItemElement);let t="largeicon-navigator-file";d.ScriptSnippetFileSystem.isSnippetsUISourceCode(this.uiSourceCode)&&(t="largeicon-navigator-snippet");const i=s.Icon.Icon.create(t,"icon");this.setLeadingIcons([i]),this.eventListeners=[e.addEventListener(c.UISourceCode.Events.TitleChanged,this.updateTitle,this),e.addEventListener(c.UISourceCode.Events.WorkingCopyChanged,this.updateTitle,this),e.addEventListener(c.UISourceCode.Events.WorkingCopyCommitted,this.updateTitle,this)],this.updateTitle()}updateTitle(){let e=this.uiSourceCode.displayName();this.uiSourceCode.isDirty()&&(e="*"+e),this.title=e;let t=this.uiSourceCode.url();this.uiSourceCode.contentType().isFromSourceMap()&&(t=g(f.sFromSourceMap,{PH1:this.uiSourceCode.displayName()})),this.tooltip=t}dispose(){e.EventTarget.removeEventListeners(this.eventListeners)}}var S=Object.freeze({__proto__:null,ChangesSidebar:m,UISourceCodeTreeElement:p});const C={revertAllChangesToCurrentFile:"Revert all changes to current file",noChanges:"No changes",binaryData:"Binary data",sInsertions:"{n, plural, =1 {# insertion (+)} other {# insertions (+)}}",sDeletions:"{n, plural, =1 {# deletion (-)} other {# deletions (-)}}"},v=t.i18n.registerUIStrings("panels/changes/ChangesView.ts",C),b=t.i18n.getLocalizedString.bind(void 0,v);let w,I;class k extends s.Widget.VBox{emptyWidget;workspaceDiff;changesSidebar;selectedUISourceCode;diffContainer;toolbar;diffStats;diffView;constructor(){super(!0);const e=new s.SplitWidget.SplitWidget(!0,!1),t=new s.Widget.Widget;e.setMainWidget(t),e.show(this.contentElement),this.emptyWidget=new s.EmptyWidget.EmptyWidget(""),this.emptyWidget.show(t.element),this.workspaceDiff=n.WorkspaceDiff.workspaceDiff(),this.changesSidebar=new m(this.workspaceDiff),this.changesSidebar.addEventListener("SelectedUISourceCodeChanged",this.selectedUISourceCodeChanged,this),e.setSidebarWidget(this.changesSidebar),this.selectedUISourceCode=null,this.diffContainer=t.element.createChild("div","diff-container"),s.ARIAUtils.markAsTabpanel(this.diffContainer),this.diffContainer.addEventListener("click",(e=>this.click(e))),this.diffView=this.diffContainer.appendChild(new r.DiffView.DiffView),this.toolbar=new s.Toolbar.Toolbar("changes-toolbar",t.element);const i=new s.Toolbar.ToolbarButton(b(C.revertAllChangesToCurrentFile),"largeicon-undo");i.addEventListener(s.Toolbar.ToolbarButton.Events.Click,this.revert.bind(this)),this.toolbar.appendToolbarItem(i),this.diffStats=new s.Toolbar.ToolbarText(""),this.toolbar.appendToolbarItem(this.diffStats),this.toolbar.setEnabled(!1),this.hideDiff(b(C.noChanges)),this.selectedUISourceCodeChanged()}static instance(e={forceNew:null}){const{forceNew:t}=e;return w&&!t||(w=new k),w}selectedUISourceCodeChanged(){this.revealUISourceCode(this.changesSidebar.selectedUISourceCode())}revert(){const e=this.selectedUISourceCode;e&&this.workspaceDiff.revertToOriginal(e)}click(t){if(this.selectedUISourceCode)for(let i=t.target;i;i=i.parentElement){if(i.classList.contains("diff-line-content")){const o=i.getAttribute("data-line-number");o&&(e.Revealer.reveal(this.selectedUISourceCode.uiLocation(Number(o)-1,0),!1),t.consume(!0));break}if(i.classList.contains("diff-listing"))break}}revealUISourceCode(e){this.selectedUISourceCode!==e&&(this.selectedUISourceCode&&this.workspaceDiff.unsubscribeFromDiffChange(this.selectedUISourceCode,this.refreshDiff,this),e&&this.isShowing()&&this.workspaceDiff.subscribeToDiffChange(e,this.refreshDiff,this),this.selectedUISourceCode=e,this.refreshDiff())}wasShown(){this.refreshDiff(),this.registerCSSFiles([l])}async refreshDiff(){if(!this.isShowing())return;if(!this.selectedUISourceCode)return void this.renderDiffRows(null);const e=this.selectedUISourceCode;if(!e.contentType().isTextType())return void this.hideDiff(b(C.binaryData));const t=await this.workspaceDiff.requestDiff(e,{shouldFormatDiff:i.Runtime.experiments.isEnabled("preciseChanges")});this.selectedUISourceCode===e&&this.renderDiffRows(t)}hideDiff(e){this.diffStats.setText(""),this.toolbar.setEnabled(!1),this.diffContainer.style.display="none",this.emptyWidget.text=e,this.emptyWidget.showWidget()}renderDiffRows(e){if(!e||1===e.length&&e[0][0]===o.Diff.Operation.Equal)this.hideDiff(b(C.noChanges));else{this.diffStats.setText(function(e){const t=e.reduce(((e,t)=>e+(t[0]===o.Diff.Operation.Insert?t[1].length:0)),0),i=e.reduce(((e,t)=>e+(t[0]===o.Diff.Operation.Delete?t[1].length:0)),0),r=b(C.sDeletions,{n:i});return`${b(C.sInsertions,{n:t})}, ${r}`}(e)),this.toolbar.setEnabled(!0),this.emptyWidget.hideWidget();const t=this.selectedUISourceCode.mimeType();this.diffContainer.style.display="block",this.diffView.data={diff:e,mimeType:t}}}}class T{static instance(e={forceNew:!1}){const{forceNew:t}=e;return I&&!t||(I=new T),I}async reveal(e,t){if(!(e instanceof n.WorkspaceDiff.DiffUILocation))throw new Error("Internal error: not a diff ui location");await s.ViewManager.ViewManager.instance().showView("changes.changes"),k.instance().changesSidebar.selectUISourceCode(e.uiSourceCode,t)}}var y=Object.freeze({__proto__:null,ChangesView:k,DiffUILocationRevealer:T});export{S as ChangesSidebar,y as ChangesView};
diff --git a/chii/panels/console/console-legacy.js b/chii/panels/console/console-legacy.js
new file mode 100644
index 00000000..a5722111
--- /dev/null
+++ b/chii/panels/console/console-legacy.js
@@ -0,0 +1 @@
+import*as e from"./console.js";self.Console=self.Console||{},Console=Console||{},Console.ConsoleFilter=e.ConsoleFilter.ConsoleFilter,Console.ConsolePanel=e.ConsolePanel.ConsolePanel,Console.ConsolePanel.WrapperView=e.ConsolePanel.WrapperView,Console.ConsolePanel.ConsoleRevealer=e.ConsolePanel.ConsoleRevealer,Console.ConsolePin=e.ConsolePinPane.ConsolePin,Console.ConsolePrompt=e.ConsolePrompt.ConsolePrompt,Console.ConsoleSidebar=e.ConsoleSidebar.ConsoleSidebar,Console.ConsoleView=e.ConsoleView.ConsoleView,Console.ConsoleViewFilter=e.ConsoleView.ConsoleViewFilter,Console.ConsoleView.ActionDelegate=e.ConsoleView.ActionDelegate,Console.ConsoleGroup=e.ConsoleView.ConsoleGroup,Console.ConsoleViewMessage=e.ConsoleViewMessage.ConsoleViewMessage,Console.ConsoleViewMessage.setMaxTokenizableStringLength=e.ConsoleViewMessage.setMaxTokenizableStringLength,Console.ConsoleViewMessage.setLongStringVisibleLength=e.ConsoleViewMessage.setLongStringVisibleLength,Console.ConsoleGroupViewMessage=e.ConsoleViewMessage.ConsoleGroupViewMessage,Console.ConsoleViewport=e.ConsoleViewport.ConsoleViewport,Console.ConsoleViewportElement=e.ConsoleViewport.ConsoleViewportElement;
diff --git a/chii/panels/console/console-meta.js b/chii/panels/console/console-meta.js
new file mode 100644
index 00000000..384ac784
--- /dev/null
+++ b/chii/panels/console/console-meta.js
@@ -0,0 +1 @@
+import*as e from"../../core/common/common.js";import*as t from"../../ui/legacy/legacy.js";import*as o from"../../core/i18n/i18n.js";const s={console:"Console",showConsole:"Show Console",clearConsole:"Clear console",clearConsoleHistory:"Clear console history",createLiveExpression:"Create live expression",hideNetworkMessages:"Hide network messages",showNetworkMessages:"Show network messages",selectedContextOnly:"Selected context only",onlyShowMessagesFromTheCurrent:"Only show messages from the current context (`top`, `iframe`, `worker`, extension)",showMessagesFromAllContexts:"Show messages from all contexts",logXmlhttprequests:"Log XMLHttpRequests",showTimestamps:"Show timestamps",hideTimestamps:"Hide timestamps",autocompleteFromHistory:"Autocomplete from history",doNotAutocompleteFromHistory:"Do not autocomplete from history",groupSimilarMessagesInConsole:"Group similar messages in console",doNotGroupSimilarMessagesIn:"Do not group similar messages in console",showCorsErrorsInConsole:"Show `CORS` errors in console",doNotShowCorsErrorsIn:"Do not show `CORS` errors in console",eagerEvaluation:"Eager evaluation",eagerlyEvaluateConsolePromptText:"Eagerly evaluate console prompt text",doNotEagerlyEvaluateConsole:"Do not eagerly evaluate console prompt text",evaluateTriggersUserActivation:"Evaluate triggers user activation",treatEvaluationAsUserActivation:"Treat evaluation as user activation",doNotTreatEvaluationAsUser:"Do not treat evaluation as user activation"},i=o.i18n.registerUIStrings("panels/console/console-meta.ts",s),n=o.i18n.getLazilyComputedLocalizedString.bind(void 0,i);let a;async function r(){return a||(a=await import("./console.js")),a}t.ViewManager.registerViewExtension({location:"panel",id:"console",title:n(s.console),commandPrompt:n(s.showConsole),order:20,loadView:async()=>(await r()).ConsolePanel.ConsolePanel.instance()}),t.ViewManager.registerViewExtension({location:"drawer-view",id:"console-view",title:n(s.console),commandPrompt:n(s.showConsole),persistence:"permanent",order:0,loadView:async()=>(await r()).ConsolePanel.WrapperView.instance()}),t.ActionRegistration.registerActionExtension({actionId:"console.show",category:t.ActionRegistration.ActionCategory.CONSOLE,title:n(s.showConsole),loadActionDelegate:async()=>(await r()).ConsoleView.ActionDelegate.instance(),bindings:[{shortcut:"Ctrl+`",keybindSets:["devToolsDefault","vsCode"]}]}),t.ActionRegistration.registerActionExtension({actionId:"console.clear",category:t.ActionRegistration.ActionCategory.CONSOLE,title:n(s.clearConsole),iconClass:"largeicon-clear",loadActionDelegate:async()=>(await r()).ConsoleView.ActionDelegate.instance(),contextTypes(){return e=e=>[e.ConsoleView.ConsoleView],void 0===a?[]:e(a);var e},bindings:[{shortcut:"Ctrl+L"},{shortcut:"Meta+K",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({actionId:"console.clear.history",category:t.ActionRegistration.ActionCategory.CONSOLE,title:n(s.clearConsoleHistory),loadActionDelegate:async()=>(await r()).ConsoleView.ActionDelegate.instance()}),t.ActionRegistration.registerActionExtension({actionId:"console.create-pin",category:t.ActionRegistration.ActionCategory.CONSOLE,title:n(s.createLiveExpression),iconClass:"largeicon-visibility",loadActionDelegate:async()=>(await r()).ConsoleView.ActionDelegate.instance()}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.CONSOLE,storageType:e.Settings.SettingStorageType.Synced,title:n(s.hideNetworkMessages),settingName:"hideNetworkMessages",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!1,options:[{value:!0,title:n(s.hideNetworkMessages)},{value:!1,title:n(s.showNetworkMessages)}]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.CONSOLE,storageType:e.Settings.SettingStorageType.Synced,title:n(s.selectedContextOnly),settingName:"selectedContextFilterEnabled",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!1,options:[{value:!0,title:n(s.onlyShowMessagesFromTheCurrent)},{value:!1,title:n(s.showMessagesFromAllContexts)}]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.CONSOLE,storageType:e.Settings.SettingStorageType.Synced,title:n(s.logXmlhttprequests),settingName:"monitoringXHREnabled",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!1}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.CONSOLE,storageType:e.Settings.SettingStorageType.Synced,title:n(s.showTimestamps),settingName:"consoleTimestampsEnabled",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!1,options:[{value:!0,title:n(s.showTimestamps)},{value:!1,title:n(s.hideTimestamps)}]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.CONSOLE,title:n(s.autocompleteFromHistory),settingName:"consoleHistoryAutocomplete",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!0,options:[{value:!0,title:n(s.autocompleteFromHistory)},{value:!1,title:n(s.doNotAutocompleteFromHistory)}]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.CONSOLE,storageType:e.Settings.SettingStorageType.Synced,title:n(s.groupSimilarMessagesInConsole),settingName:"consoleGroupSimilar",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!0,options:[{value:!0,title:n(s.groupSimilarMessagesInConsole)},{value:!1,title:n(s.doNotGroupSimilarMessagesIn)}]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.CONSOLE,title:n(s.showCorsErrorsInConsole),settingName:"consoleShowsCorsErrors",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!0,options:[{value:!0,title:n(s.showCorsErrorsInConsole)},{value:!1,title:n(s.doNotShowCorsErrorsIn)}]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.CONSOLE,storageType:e.Settings.SettingStorageType.Synced,title:n(s.eagerEvaluation),settingName:"consoleEagerEval",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!0,options:[{value:!0,title:n(s.eagerlyEvaluateConsolePromptText)},{value:!1,title:n(s.doNotEagerlyEvaluateConsole)}]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.CONSOLE,storageType:e.Settings.SettingStorageType.Synced,title:n(s.evaluateTriggersUserActivation),settingName:"consoleUserActivationEval",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!0,options:[{value:!0,title:n(s.treatEvaluationAsUserActivation)},{value:!1,title:n(s.doNotTreatEvaluationAsUser)}]}),e.Revealer.registerRevealer({contextTypes:()=>[e.Console.Console],loadRevealer:async()=>(await r()).ConsolePanel.ConsoleRevealer.instance(),destination:void 0});
diff --git a/chii/panels/console/console.js b/chii/panels/console/console.js
new file mode 100644
index 00000000..1338d1dc
--- /dev/null
+++ b/chii/panels/console/console.js
@@ -0,0 +1,6 @@
+import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as s from"../../core/platform/platform.js";import*as i from"../../core/sdk/sdk.js";import*as o from"../../ui/legacy/legacy.js";import*as n from"../../models/text_utils/text_utils.js";import*as r from"../../third_party/codemirror.next/codemirror.next.js";import*as l from"../../ui/components/text_editor/text_editor.js";import*as a from"../../ui/legacy/components/object_ui/object_ui.js";import*as c from"../../ui/legacy/components/utils/utils.js";import*as h from"../../models/bindings/bindings.js";import*as d from"../../models/logs/logs.js";import*as u from"../../models/workspace/workspace.js";import*as m from"../../ui/components/code_highlighter/code_highlighter.js";import*as p from"../../ui/components/issue_counter/issue_counter.js";import*as g from"../../ui/components/request_link_icon/request_link_icon.js";import*as v from"../../ui/legacy/components/data_grid/data_grid.js";import*as f from"../../ui/legacy/theme_support/theme_support.js";import*as b from"../../core/host/host.js";import*as C from"../../models/issues_manager/issues_manager.js";const x=new CSSStyleSheet;x.replaceSync(":host{padding:2px 1px 2px 2px;white-space:nowrap;display:flex;flex-direction:column;height:36px;justify-content:center;overflow-y:auto}.title{overflow:hidden;text-overflow:ellipsis;flex-grow:0}.badge{pointer-events:none;margin-right:4px;display:inline-block;height:15px}.subtitle{color:var(--color-text-secondary);margin-right:3px;overflow:hidden;text-overflow:ellipsis;flex-grow:0}:host(.highlighted) .subtitle{color:inherit}\n/*# sourceURL=consoleContextSelector.css */\n");const w={javascriptContextNotSelected:"JavaScript context: Not selected",extension:"Extension",javascriptContextS:"JavaScript context: {PH1}"},S=t.i18n.registerUIStrings("panels/console/ConsoleContextSelector.ts",w),I=t.i18n.getLocalizedString.bind(void 0,S);class E{items;dropDown;toolbarItemInternal;constructor(){this.items=new o.ListModel.ListModel,this.dropDown=new o.SoftDropDown.SoftDropDown(this.items,this),this.dropDown.setRowHeight(36),this.toolbarItemInternal=new o.Toolbar.ToolbarItem(this.dropDown.element),this.toolbarItemInternal.setEnabled(!1),this.toolbarItemInternal.setTitle(I(w.javascriptContextNotSelected)),this.items.addEventListener(o.ListModel.Events.ItemsReplaced,(()=>this.toolbarItemInternal.setEnabled(Boolean(this.items.length)))),this.toolbarItemInternal.element.classList.add("toolbar-has-dropdown"),i.TargetManager.TargetManager.instance().addModelListener(i.RuntimeModel.RuntimeModel,i.RuntimeModel.Events.ExecutionContextCreated,this.onExecutionContextCreated,this),i.TargetManager.TargetManager.instance().addModelListener(i.RuntimeModel.RuntimeModel,i.RuntimeModel.Events.ExecutionContextChanged,this.onExecutionContextChanged,this),i.TargetManager.TargetManager.instance().addModelListener(i.RuntimeModel.RuntimeModel,i.RuntimeModel.Events.ExecutionContextDestroyed,this.onExecutionContextDestroyed,this),i.TargetManager.TargetManager.instance().addModelListener(i.ResourceTreeModel.ResourceTreeModel,i.ResourceTreeModel.Events.FrameNavigated,this.frameNavigated,this),o.Context.Context.instance().addFlavorChangeListener(i.RuntimeModel.ExecutionContext,this.executionContextChangedExternally,this),o.Context.Context.instance().addFlavorChangeListener(i.DebuggerModel.CallFrame,this.callFrameSelectedInUI,this),i.TargetManager.TargetManager.instance().observeModels(i.RuntimeModel.RuntimeModel,this),i.TargetManager.TargetManager.instance().addModelListener(i.DebuggerModel.DebuggerModel,i.DebuggerModel.Events.CallFrameSelected,this.callFrameSelectedInModel,this)}toolbarItem(){return this.toolbarItemInternal}highlightedItemChanged(e,t,s,o){if(i.OverlayModel.OverlayModel.hideDOMNodeHighlight(),t&&t.frameId){const e=i.FrameManager.FrameManager.instance().getFrame(t.frameId);e&&!e.isTopFrame()&&e.highlight()}s&&s.classList.remove("highlighted"),o&&o.classList.add("highlighted")}titleFor(e){const t=e.target(),s=e.label();let o=s?t.decorateLabel(s):"";if(e.frameId){const s=t.model(i.ResourceTreeModel.ResourceTreeModel),n=s&&s.frameForId(e.frameId);n&&(o=o||n.displayName())}return o=o||e.origin,o}depthFor(e){let t=e.target(),s=0;if(e.isDefault||s++,e.frameId){let o=i.FrameManager.FrameManager.instance().getFrame(e.frameId);for(;o;)o=o.parentFrame(),o&&(s++,t=o.resourceTreeModel().target())}let o=0,n=t.parentTarget();for(;n&&t.type()!==i.Target.Type.ServiceWorker;)o++,t=n,n=t.parentTarget();return s+=o,s}executionContextCreated(e){this.items.insertWithComparator(e,e.runtimeModel.executionContextComparator()),e===o.Context.Context.instance().flavor(i.RuntimeModel.ExecutionContext)&&this.dropDown.selectItem(e)}onExecutionContextCreated(e){const t=e.data;this.executionContextCreated(t)}onExecutionContextChanged(e){const t=e.data;-1!==this.items.indexOf(t)&&(this.executionContextDestroyed(t),this.executionContextCreated(t))}executionContextDestroyed(e){const t=this.items.indexOf(e);-1!==t&&this.items.remove(t)}onExecutionContextDestroyed(e){const t=e.data;this.executionContextDestroyed(t)}executionContextChangedExternally({data:e}){this.dropDown.selectItem(e)}isTopContext(e){if(!e||!e.isDefault)return!1;const t=e.target().model(i.ResourceTreeModel.ResourceTreeModel),s=e.frameId&&t&&t.frameForId(e.frameId);return!!s&&s.isTopFrame()}hasTopContext(){return this.items.some((e=>this.isTopContext(e)))}modelAdded(e){e.executionContexts().forEach(this.executionContextCreated,this)}modelRemoved(e){for(let t=this.items.length-1;t>=0;t--)this.items.at(t).runtimeModel===e&&this.executionContextDestroyed(this.items.at(t))}createElementForItem(e){const t=document.createElement("div"),i=o.Utils.createShadowRootWithCoreStyles(t,{cssFile:[x],delegatesFocus:void 0}),n=i.createChild("div","title");o.UIUtils.createTextChild(n,s.StringUtilities.trimEndWithMaxLength(this.titleFor(e),100));const r=i.createChild("div","subtitle");return o.UIUtils.createTextChild(r,this.subtitleFor(e)),t.style.paddingLeft=8+15*this.depthFor(e)+"px",t}subtitleFor(t){const s=t.target();let o=null;if(t.frameId){const e=s.model(i.ResourceTreeModel.ResourceTreeModel);o=e&&e.frameForId(t.frameId)}if(t.origin.startsWith("chrome-extension://"))return I(w.extension);const n=o&&o.sameTargetParentFrame();if(!o||!n||n.securityOrigin!==t.origin){const s=e.ParsedURL.ParsedURL.fromString(t.origin);if(s)return s.domain()}if(o&&o.securityOrigin){const t=new e.ParsedURL.ParsedURL(o.securityOrigin).domain();if(t)return t}return"IFrame"}isItemSelectable(e){const t=e.debuggerModel.selectedCallFrame(),s=t&&t.script.executionContext();return!s||e===s}itemSelected(e){this.toolbarItemInternal.element.classList.toggle("highlight",!this.isTopContext(e)&&this.hasTopContext());const t=e?I(w.javascriptContextS,{PH1:this.titleFor(e)}):I(w.javascriptContextNotSelected);this.toolbarItemInternal.setTitle(t),o.Context.Context.instance().setFlavor(i.RuntimeModel.ExecutionContext,e)}callFrameSelectedInUI(){const e=o.Context.Context.instance().flavor(i.DebuggerModel.CallFrame),t=e&&e.script.executionContext();t&&o.Context.Context.instance().setFlavor(i.RuntimeModel.ExecutionContext,t)}callFrameSelectedInModel(e){const t=e.data;for(const e of this.items)e.debuggerModel===t&&this.dropDown.refreshItem(e)}frameNavigated(e){const t=e.data,s=t.resourceTreeModel().target().model(i.RuntimeModel.RuntimeModel);if(s)for(const e of s.executionContexts())t.id===e.frameId&&this.dropDown.refreshItem(e)}}var M,T=Object.freeze({__proto__:null,ConsoleContextSelector:E});class y{name;parsedFilters;executionContext;levelsMask;constructor(e,t,s,i){this.name=e,this.parsedFilters=t,this.executionContext=s,this.levelsMask=i||y.defaultLevelsFilterValue()}static allLevelsFilterValue(){const e={},t={Verbose:"verbose",Info:"info",Warning:"warning",Error:"error"};for(const s of Object.values(t))e[s]=!0;return e}static defaultLevelsFilterValue(){const e=y.allLevelsFilterValue();return e.verbose=!1,e}static singleLevelMask(e){const t={};return t[e]=!0,t}clone(){const e=this.parsedFilters.map(n.TextUtils.FilterParser.cloneFilter),t=Object.assign({},this.levelsMask);return new y(this.name,e,this.executionContext,t)}shouldBeVisible(e){const t=e.consoleMessage();if(this.executionContext&&(this.executionContext.runtimeModel!==t.runtimeModel()||this.executionContext.id!==t.getExecutionContextId()))return!1;if(t.type===i.ConsoleModel.FrontendMessageType.Command||t.type===i.ConsoleModel.FrontendMessageType.Result||t.isGroupMessage())return!0;if(t.level&&!this.levelsMask[t.level])return!1;for(const o of this.parsedFilters)if(o.key)switch(o.key){case M.Context:if(!s(o,t.context,!1))return!1;break;case M.Source:if(!s(o,t.source?i.ConsoleModel.MessageSourceDisplayName.get(t.source):t.source,!0))return!1;break;case M.Url:if(!s(o,t.url,!1))return!1}else{if(o.regex&&e.matchesFilterRegex(o.regex)===o.negative)return!1;if(o.text&&e.matchesFilterText(o.text)===o.negative)return!1}return!0;function s(e,t,s){if(!e.text)return Boolean(t)===e.negative;if(!t)return!e.text==!e.negative;const i=e.text.toLowerCase(),o=t.toLowerCase();return(!s||o===i!==e.negative)&&!(!s&&o.includes(i)===e.negative)}}}!function(e){e.Context="context",e.Source="source",e.Url="url"}(M||(M={}));var k=Object.freeze({__proto__:null,ConsoleFilter:y,get FilterType(){return M}});const L=new CSSStyleSheet;L.replaceSync(".value.object-value-node:hover{background-color:var(--item-hover-color)}.object-value-boolean,.object-value-function-prefix{color:var(--color-syntax-3)}.object-value-function{font-style:italic}.object-value-function.linkified:hover{--override-linkified-hover-background:rgb(0 0 0 / 10%);background-color:var(--override-linkified-hover-background);cursor:pointer}.-theme-with-dark-background .object-value-function.linkified:hover,:host-context(.-theme-with-dark-background) .object-value-function.linkified:hover{--override-linkified-hover-background:rgb(230 230 230 / 10%)}.object-value-number{color:var(--color-syntax-3)}.object-value-bigint{color:var(--color-syntax-6)}.object-value-regexp,.object-value-string,.object-value-symbol{white-space:pre;unicode-bidi:-webkit-isolate;color:var(--color-syntax-1)}.object-value-node{position:relative;vertical-align:baseline;color:var(--color-syntax-7);display:inline-block}.object-value-with-memory-icon{display:inline-flex}.object-value-arraybuffer devtools-icon,.object-value-dataview devtools-icon,.object-value-typedarray devtools-icon,.object-value-webassemblymemory devtools-icon{cursor:pointer}.object-value-null,.object-value-undefined{color:var(--color-text-disabled)}.object-value-calculate-value-button:hover{text-decoration:underline}.object-properties-section-custom-section{display:inline-flex;flex-direction:column}.-theme-with-dark-background .object-value-boolean,.-theme-with-dark-background .object-value-number,:host-context(.-theme-with-dark-background) .object-value-boolean,:host-context(.-theme-with-dark-background) .object-value-number{--override-primitive-dark-mode-color:hsl(252deg 100% 75%);color:var(--override-primitive-dark-mode-color)}.object-properties-section .object-description{color:var(--color-text-secondary)}.value .object-properties-preview{white-space:nowrap}.name{color:var(--color-syntax-2);flex-shrink:0}.object-properties-preview .name{color:var(--color-text-secondary)}@media (forced-colors:active){.object-value-calculate-value-button:hover{forced-color-adjust:none;color:Highlight}}\n/*# sourceURL=objectValue.css */\n");const F=new CSSStyleSheet;F.replaceSync(".close-button{position:absolute;top:7px;left:5px}.console-pins{max-height:200px;overflow-y:auto;background:var(--color-background-elevation-1);--override-error-background-color:rgb(255 240 240);--override-error-border-color:rgb(225 214 214);--override-error-text-color:rgb(255 0 0)}.console-pins:not(:empty){border-bottom:1px solid var(--color-details-hairline)}.-theme-with-dark-background .console-pins,:host-context(.-theme-with-dark-background) .console-pins{--override-error-background-color:rgb(41 0 0);--override-error-border-color:rgb(92 0 0);--override-error-text-color:rgb(255 128 128)}.console-pin{position:relative;user-select:text;flex:none;padding:2px 0 6px 24px}.console-pin:not(:last-child){border-bottom:1px solid var(--color-background-elevation-2)}.console-pin.error-level:not(:focus-within){background-color:var(--override-error-background-color);color:var(--override-error-text-color)}.console-pin:not(:last-child).error-level:not(:focus-within){border-top:1px solid var(--override-error-border-color);border-bottom:1px solid var(--override-error-border-color);margin-top:-1px}.console-pin-name{margin-left:-4px;margin-bottom:1px;height:auto}.console-pin-name,.console-pin-preview{width:100%;text-overflow:ellipsis;white-space:nowrap;min-height:13px}.console-pin-preview{overflow:hidden}.console-delete-pin{position:absolute;top:8px;left:8px;opacity:70%;cursor:pointer}.console-delete-pin:focus-visible,.console-delete-pin:hover{opacity:100%}:host-context(.-theme-with-dark-background) .console-delete-pin{filter:brightness(2)}.console-pin-name:focus-within{background:var(--color-background);box-shadow:var(--legacy-focus-ring-active-shadow) inset}.console-pin-name:not(:focus-within):not(:hover),.console-pin:focus-within .console-pin-preview{opacity:60%}\n/*# sourceURL=consolePinPane.css */\n");const R={removeExpression:"Remove expression",removeAllExpressions:"Remove all expressions",removeExpressionS:"Remove expression: {PH1}",removeBlankExpression:"Remove blank expression",liveExpressionEditor:"Live expression editor",expression:"Expression",evaluateAllowingSideEffects:"Evaluate, allowing side effects",notAvailable:"not available"},P=t.i18n.registerUIStrings("panels/console/ConsolePinPane.ts",R),A=t.i18n.getLocalizedString.bind(void 0,P),B=new WeakMap;class H extends o.ThrottledWidget.ThrottledWidget{liveExpressionButton;focusOut;pins;pinsSetting;constructor(t,s){super(!0,250),this.liveExpressionButton=t,this.focusOut=s,this.contentElement.classList.add("console-pins","monospace"),this.contentElement.addEventListener("contextmenu",this.contextMenuEventFired.bind(this),!1),this.pins=new Set,this.pinsSetting=e.Settings.Settings.instance().createLocalSetting("consolePins",[]);for(const e of this.pinsSetting.get())this.addPin(e)}wasShown(){super.wasShown(),this.registerCSSFiles([F,L])}willHide(){for(const e of this.pins)e.setHovered(!1)}savePins(){const e=Array.from(this.pins).map((e=>e.expression()));this.pinsSetting.set(e)}contextMenuEventFired(e){const t=new o.ContextMenu.ContextMenu(e),s=o.UIUtils.deepElementFromEvent(e);if(s){const e=s.enclosingNodeOrSelfWithClass("console-pin");if(e){const s=B.get(e);s&&(t.editSection().appendItem(A(R.removeExpression),this.removePin.bind(this,s)),s.appendToContextMenu(t))}}t.editSection().appendItem(A(R.removeAllExpressions),this.removeAllPins.bind(this)),t.show()}removeAllPins(){for(const e of this.pins)this.removePin(e)}removePin(e){e.element().remove();const t=this.focusedPinAfterDeletion(e);this.pins.delete(e),this.savePins(),t?t.focus():this.liveExpressionButton.focus()}addPin(e,t){const s=new O(e,this,this.focusOut);this.contentElement.appendChild(s.element()),this.pins.add(s),this.savePins(),t&&s.focus(),this.update()}focusedPinAfterDeletion(e){const t=Array.from(this.pins);for(let s=0;se.updatePreview()));await Promise.all(e),this.updatedForTest()}updatedForTest(){}}class O{pinPane;focusOut;pinElement;pinPreview;lastResult;lastExecutionContext;editor;committedExpression;hovered;lastNode;deletePinIcon;constructor(t,s,i){this.pinPane=s,this.focusOut=i,this.deletePinIcon=document.createElement("div",{is:"dt-close-button"}),this.deletePinIcon.gray=!0,this.deletePinIcon.classList.add("close-button"),this.deletePinIcon.setTabbable(!0),t.length?this.deletePinIcon.setAccessibleName(A(R.removeExpressionS,{PH1:t})):this.deletePinIcon.setAccessibleName(A(R.removeBlankExpression)),self.onInvokeElement(this.deletePinIcon,(e=>{s.removePin(this),e.consume(!0)}));const n=o.Fragment.Fragment.build`
+
+ ${this.deletePinIcon}
+
+
+
`;this.pinElement=n.element(),this.pinPreview=n.$("preview");const r=n.$("name");o.Tooltip.Tooltip.install(r,t),B.set(this.pinElement,this),this.lastResult=null,this.lastExecutionContext=null,this.committedExpression=t,this.hovered=!1,this.lastNode=null,this.editor=this.createEditor(t,r),this.pinPreview.addEventListener("mouseenter",this.setHovered.bind(this,!0),!1),this.pinPreview.addEventListener("mouseleave",this.setHovered.bind(this,!1),!1),this.pinPreview.addEventListener("click",(t=>{this.lastNode&&(e.Revealer.reveal(this.lastNode),t.consume())}),!1),r.addEventListener("keydown",(e=>{"Escape"===e.key&&e.consume()}))}createEditor(e,t){const s=new l.TextEditor.TextEditor(r.EditorState.create({doc:e,extensions:[r.EditorView.contentAttributes.of({"aria-label":A(R.liveExpressionEditor)}),r.EditorView.lineWrapping,r.javascript.javascriptLanguage,l.JavaScript.completion(),l.Config.showCompletionHint,r.placeholder(A(R.expression)),r.keymap.of([{key:"Escape",run:e=>(e.dispatch({changes:{from:0,to:e.state.doc.length,insert:this.committedExpression}}),this.focusOut(),!0)},{key:"Mod-Enter",run:()=>(this.focusOut(),!0)}]),r.EditorView.domEventHandlers({blur:(e,t)=>this.onBlur(t)}),l.Config.baseConfiguration(e),l.Config.closeBrackets,l.Config.autocompletion]}));return t.appendChild(s),s}onBlur(e){const t=e.state.doc.toString(),s=t.trim();this.committedExpression=s,this.pinPane.savePins(),this.committedExpression.length?this.deletePinIcon.setAccessibleName(A(R.removeExpressionS,{PH1:this.committedExpression})):this.deletePinIcon.setAccessibleName(A(R.removeBlankExpression)),e.dispatch({selection:{anchor:s.length},changes:s!==t?{from:0,to:t.length,insert:s}:void 0})}setHovered(e){this.hovered!==e&&(this.hovered=e,!e&&this.lastNode&&i.OverlayModel.OverlayModel.hideDOMNodeHighlight())}expression(){return this.committedExpression}element(){return this.pinElement}async focus(){const e=this.editor;e.editor.focus(),e.dispatch({selection:{anchor:e.state.doc.length}})}appendToContextMenu(e){this.lastResult&&!("error"in this.lastResult)&&this.lastResult.object&&(e.appendApplicableItems(this.lastResult.object),this.lastResult=null)}async updatePreview(){if(!this.editor)return;const e=l.Config.contentIncludingHint(this.editor.editor),t=this.pinElement.hasFocus(),s=t&&e!==this.committedExpression,n=s?250:void 0,r=o.Context.Context.instance().flavor(i.RuntimeModel.ExecutionContext),c=a.JavaScriptREPL.JavaScriptREPL.preprocessExpression(e),{preview:h,result:d}=await a.JavaScriptREPL.JavaScriptREPL.evaluateAndBuildPreview(c,s,!1,n,!t,"console",!0);this.lastResult&&this.lastExecutionContext&&this.lastExecutionContext.runtimeModel.releaseEvaluationResult(this.lastResult),this.lastResult=d||null,this.lastExecutionContext=r||null;const u=h.deepTextContent();if(!u||u!==this.pinPreview.deepTextContent()){if(this.pinPreview.removeChildren(),d&&i.RuntimeModel.RuntimeModel.isSideEffectFailure(d)){const e=this.pinPreview.createChild("span","object-value-calculate-value-button");e.textContent="(…)",o.Tooltip.Tooltip.install(e,A(R.evaluateAllowingSideEffects))}else u?this.pinPreview.appendChild(h):t||o.UIUtils.createTextChild(this.pinPreview,A(R.notAvailable));o.Tooltip.Tooltip.install(this.pinPreview,u)}let m=null;d&&!("error"in d)&&"object"===d.object.type&&"node"===d.object.subtype&&(m=d.object),this.hovered&&(m?i.OverlayModel.OverlayModel.highlightObjectAsDOMNode(m):this.lastNode&&i.OverlayModel.OverlayModel.hideDOMNodeHighlight()),this.lastNode=m||null;const p=d&&!("error"in d)&&d.exceptionDetails&&!i.RuntimeModel.RuntimeModel.isSideEffectFailure(d);this.pinElement.classList.toggle("error-level",Boolean(p))}}var U=Object.freeze({__proto__:null,ConsolePinPane:H,ConsolePin:O});const V=new CSSStyleSheet;V.replaceSync(":host{overflow:auto;background-color:var(--color-background-elevation-1)}.tree-outline-disclosure{max-width:100%;padding-left:6px}.count{flex:none;margin:0 8px}[is=ui-icon]{margin:0 5px}li{height:24px}li .largeicon-navigator-file{margin:0}li .largeicon-navigator-folder{margin:-3px -3px 0 -5px}.tree-element-title{flex-shrink:100;flex-grow:1;overflow:hidden;text-overflow:ellipsis}.tree-outline li:hover:not(.selected) .selection{display:block;background-color:var(--item-hover-color)}@media (forced-colors:active){[is=ui-icon].icon-mask{background-color:ButtonText}.tree-outline li:hover:not(.selected) .selection{forced-color-adjust:none;background-color:Highlight}.tree-outline li.selected .count,.tree-outline li.selected .tree-element-title,.tree-outline li:hover .count,.tree-outline li:hover .tree-element-title{forced-color-adjust:none;color:HighlightText}.tree-outline li.selected [is=ui-icon].icon-mask,.tree-outline li.selected:focus .spritesheet-mediumicons:not(.icon-mask),.tree-outline li:hover [is=ui-icon].icon-mask{background-color:HighlightText!important}}\n/*# sourceURL=consoleSidebar.css */\n");const N={other:"",dUserMessages:"{n, plural, =0 {No user messages} =1 {# user message} other {# user messages}}",dMessages:"{n, plural, =0 {No messages} =1 {# message} other {# messages}}",dErrors:"{n, plural, =0 {No errors} =1 {# error} other {# errors}}",dWarnings:"{n, plural, =0 {No warnings} =1 {# warning} other {# warnings}}",dInfo:"{n, plural, =0 {No info} =1 {# info} other {# info}}",dVerbose:"{n, plural, =0 {No verbose} =1 {# verbose} other {# verbose}}"},j=t.i18n.registerUIStrings("panels/console/ConsoleSidebar.ts",N),G=t.i18n.getLocalizedString.bind(void 0,j);class D extends(e.ObjectWrapper.eventMixin(o.Widget.VBox)){tree;selectedTreeElement;treeElements;constructor(){super(!0),this.setMinimumSize(125,0),this.tree=new o.TreeOutline.TreeOutlineInShadow,this.tree.addEventListener(o.TreeOutline.Events.ElementSelected,this.selectionChanged.bind(this)),this.contentElement.appendChild(this.tree.element),this.selectedTreeElement=null,this.treeElements=[];const t=e.Settings.Settings.instance().createSetting("console.sidebarSelectedFilter",null),s=[{key:M.Source,text:i.ConsoleModel.FrontendMessageSource.ConsoleAPI,negative:!1,regex:void 0}];this.appendGroup("message",[],y.allLevelsFilterValue(),o.Icon.Icon.create("mediumicon-list"),t),this.appendGroup("user message",s,y.allLevelsFilterValue(),o.Icon.Icon.create("mediumicon-account-circle"),t),this.appendGroup("error",[],y.singleLevelMask("error"),o.Icon.Icon.create("mediumicon-error-circle"),t),this.appendGroup("warning",[],y.singleLevelMask("warning"),o.Icon.Icon.create("mediumicon-warning-triangle"),t),this.appendGroup("info",[],y.singleLevelMask("info"),o.Icon.Icon.create("mediumicon-info-circle"),t),this.appendGroup("verbose",[],y.singleLevelMask("verbose"),o.Icon.Icon.create("mediumicon-bug"),t);const n=t.get();(this.treeElements.find((e=>e.name()===n))||this.treeElements[0]).select()}appendGroup(e,t,s,i,o){const n=new y(e,t,null,s),r=new q(n,i,o);this.tree.appendChild(r),this.treeElements.push(r)}clear(){for(const e of this.treeElements)e.clear()}onMessageAdded(e){for(const t of this.treeElements)t.onMessageAdded(e)}shouldBeVisible(e){return!(this.selectedTreeElement instanceof W)||this.selectedTreeElement.filter().shouldBeVisible(e)}selectionChanged(e){this.selectedTreeElement=e.data,this.dispatchEventToListeners("FilterSelected")}wasShown(){super.wasShown(),this.tree.registerCSSFiles([V])}}class W extends o.TreeOutline.TreeElement{filterInternal;constructor(e,t){super(e),this.filterInternal=t}filter(){return this.filterInternal}}class z extends W{countElement;messageCount;constructor(e){super(e.name,e),this.countElement=this.listItemElement.createChild("span","count");const t=[o.Icon.Icon.create("largeicon-navigator-file")];this.setLeadingIcons(t),this.messageCount=0}incrementAndUpdateCounter(){this.messageCount++,this.countElement.textContent=`${this.messageCount}`}}const _=new Map([["user message",N.dUserMessages],["message",N.dMessages],["error",N.dErrors],["warning",N.dWarnings],["info",N.dInfo],["verbose",N.dVerbose]]);class q extends W{selectedFilterSetting;urlTreeElements;messageCount;uiStringForFilterCount;constructor(e,t,s){super(e.name,e),this.uiStringForFilterCount=_.get(e.name)||"",this.selectedFilterSetting=s,this.urlTreeElements=new Map,this.setLeadingIcons([t]),this.messageCount=0,this.updateCounter()}clear(){this.urlTreeElements.clear(),this.removeChildren(),this.messageCount=0,this.updateCounter()}name(){return this.filterInternal.name}onselect(e){return this.selectedFilterSetting.set(this.filterInternal.name),super.onselect(e)}updateCounter(){this.title=this.updateGroupTitle(this.messageCount),this.setExpandable(Boolean(this.childCount()))}updateGroupTitle(e){return this.uiStringForFilterCount?G(this.uiStringForFilterCount,{n:e}):""}onMessageAdded(e){const t=e.consoleMessage(),s=t.type!==i.ConsoleModel.FrontendMessageType.Command&&t.type!==i.ConsoleModel.FrontendMessageType.Result&&!t.isGroupMessage();if(!this.filterInternal.shouldBeVisible(e)||!s)return;this.childElement(t.url).incrementAndUpdateCounter(),this.messageCount++,this.updateCounter()}childElement(t){const s=t||null;let i=this.urlTreeElements.get(s);if(i)return i;const o=this.filterInternal.clone(),n=s?e.ParsedURL.ParsedURL.fromString(s):null;return o.name=s?n?n.displayName:s:G(N.other),o.parsedFilters.push({key:M.Url,text:s,negative:!1,regex:void 0}),i=new z(o),s&&(i.tooltip=s),this.urlTreeElements.set(s,i),this.appendChild(i),i}}var K=Object.freeze({__proto__:null,ConsoleSidebar:D,URLGroupTreeElement:z,FilterTreeElement:q});class ${element;topGapElement;topGapElementActive;contentElementInternal;bottomGapElement;bottomGapElementActive;provider;virtualSelectedIndex;firstActiveIndex;lastActiveIndex;renderedItems;anchorSelection;headSelection;itemCount;cumulativeHeights;muteCopyHandler;observer;observerConfig;stickToBottomInternal;selectionIsBackward;lastSelectedElement;cachedProviderElements;constructor(e){this.element=document.createElement("div"),this.element.style.overflow="auto",this.topGapElement=this.element.createChild("div"),this.topGapElement.style.height="0px",this.topGapElement.style.color="transparent",this.topGapElementActive=!1,this.contentElementInternal=this.element.createChild("div"),this.bottomGapElement=this.element.createChild("div"),this.bottomGapElement.style.height="0px",this.bottomGapElement.style.color="transparent",this.bottomGapElementActive=!1,this.topGapElement.textContent="\ufeff",this.bottomGapElement.textContent="\ufeff",o.ARIAUtils.markAsHidden(this.topGapElement),o.ARIAUtils.markAsHidden(this.bottomGapElement),this.provider=e,this.element.addEventListener("scroll",this.onScroll.bind(this),!1),this.element.addEventListener("copy",this.onCopy.bind(this),!1),this.element.addEventListener("dragstart",this.onDragStart.bind(this),!1),this.contentElementInternal.addEventListener("focusin",this.onFocusIn.bind(this),!1),this.contentElementInternal.addEventListener("focusout",this.onFocusOut.bind(this),!1),this.contentElementInternal.addEventListener("keydown",this.onKeyDown.bind(this),!1),this.virtualSelectedIndex=-1,this.contentElementInternal.tabIndex=-1,this.firstActiveIndex=-1,this.lastActiveIndex=-1,this.renderedItems=[],this.anchorSelection=null,this.headSelection=null,this.itemCount=0,this.cumulativeHeights=new Int32Array(0),this.muteCopyHandler=!1,this.observer=new MutationObserver(this.refresh.bind(this)),this.observerConfig={childList:!0,subtree:!0},this.stickToBottomInternal=!1,this.selectionIsBackward=!1}stickToBottom(){return this.stickToBottomInternal}setStickToBottom(e){this.stickToBottomInternal=e,this.stickToBottomInternal?this.observer.observe(this.contentElementInternal,this.observerConfig):this.observer.disconnect()}hasVirtualSelection(){return-1!==this.virtualSelectedIndex}copyWithStyles(){this.muteCopyHandler=!0,this.element.ownerDocument.execCommand("copy"),this.muteCopyHandler=!1}onCopy(e){if(this.muteCopyHandler)return;const t=this.selectedText();t&&(e.preventDefault(),this.selectionContainsTable()?this.copyWithStyles():e.clipboardData&&e.clipboardData.setData("text/plain",t))}onFocusIn(e){const t=this.renderedItems.findIndex((t=>t.element().isSelfOrAncestor(e.target)));-1!==t&&(this.virtualSelectedIndex=this.firstActiveIndex+t);let s=!1;-1===this.virtualSelectedIndex&&this.isOutsideViewport(e.relatedTarget)&&e.target===this.contentElementInternal&&this.itemCount&&(s=!0,this.virtualSelectedIndex=this.itemCount-1,this.refresh(),this.scrollItemIntoView(this.virtualSelectedIndex)),this.updateFocusedItem(s)}onFocusOut(e){this.isOutsideViewport(e.relatedTarget)&&(this.virtualSelectedIndex=-1),this.updateFocusedItem()}isOutsideViewport(e){return null!==e&&!e.isSelfOrDescendant(this.contentElementInternal)}onDragStart(e){const t=this.selectedText();return!!t&&(e.dataTransfer&&(e.dataTransfer.clearData(),e.dataTransfer.setData("text/plain",t),e.dataTransfer.effectAllowed="copy"),!0)}onKeyDown(e){if(o.UIUtils.isEditing()||!this.itemCount||e.shiftKey)return;let t=!1;switch(e.key){case"ArrowUp":if(!(this.virtualSelectedIndex>0))return;t=!0,this.virtualSelectedIndex--;break;case"ArrowDown":if(!(this.virtualSelectedIndexthis.itemCount-1&&(this.virtualSelectedIndex=this.itemCount-1),this.rebuildCumulativeHeights(),this.refresh()}providerElement(e){this.cachedProviderElements||(this.cachedProviderElements=new Array(this.itemCount));let t=this.cachedProviderElements[e];return t||(t=this.provider.itemElement(e),this.cachedProviderElements[e]=t),t}rebuildCumulativeHeights(){const e=this.firstActiveIndex,t=this.lastActiveIndex;let s=0;this.cumulativeHeights=new Int32Array(this.itemCount);for(let i=0;i1)return void this.rebuildCumulativeHeights();if(t+=o,e+=i,Math.abs(e-t)>1)return void this.rebuildCumulativeHeights()}}cachedItemHeight(e){return 0===e?this.cumulativeHeights[0]:this.cumulativeHeights[e]-this.cumulativeHeights[e-1]}isSelectionBackwards(e){if(!(e&&e.rangeCount&&e.anchorNode&&e.focusNode))return!1;const t=document.createRange();return t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),t.collapsed}createSelectionModel(e,t,s){return{item:e,node:t,offset:s}}updateSelectionModel(e){const t=e&&e.rangeCount?e.getRangeAt(0):null;if(!t||!e||e.isCollapsed||!this.element.hasSelection())return this.headSelection=null,this.anchorSelection=null,!1;let s=Number.MAX_VALUE,i=-1,o=!1;for(let e=0;ec.item?d:c):o?n?h=l?this.headSelection:this.anchorSelection:r&&(d=l?this.anchorSelection:this.headSelection):(h=a,d=c),l?(this.anchorSelection=d,this.headSelection=h):(this.anchorSelection=h,this.headSelection=d),this.selectionIsBackward=l,!0}restoreSelection(e){if(!e||!this.anchorSelection||!this.headSelection)return;const t=(e,t)=>{if(this.firstActiveIndex<=e.item&&e.item<=this.lastActiveIndex)return{element:e.node,offset:e.offset};return{element:e.item!t.has(e)));for(let e=0;e0&&(s[s.length-1]=s[s.length-1].substring(0,e))}const n=this.providerElement(e.item),r=n&&n.element();if(r&&e.node&&e.node.isSelfOrDescendant(r)){const t=this.textOffsetInNode(r,e.node,e.offset);s[0]=s[0].substring(t)}return s.join("\n")}textOffsetInNode(e,t,s){const i=t.textContent?t.textContent.length:0;t.nodeType!==Node.TEXT_NODE&&(s0&&r!==i&&(s=r),o+s}onScroll(e){this.refresh()}firstVisibleIndex(){return this.cumulativeHeights.length?(this.rebuildCumulativeHeightsIfNeeded(),s.ArrayUtilities.lowerBound(this.cumulativeHeights,this.element.scrollTop+1,s.ArrayUtilities.DEFAULT_COMPARATOR)):-1}lastVisibleIndex(){if(!this.cumulativeHeights.length)return-1;this.rebuildCumulativeHeightsIfNeeded();const e=this.element.scrollTop+this.element.clientHeight,t=this.itemCount-1;return s.ArrayUtilities.lowerBound(this.cumulativeHeights,e,s.ArrayUtilities.DEFAULT_COMPARATOR,void 0,t)}renderedElementAt(e){return-1===e||ethis.lastActiveIndex?null:this.renderedItems[e-this.firstActiveIndex].element()}scrollItemIntoView(e,t){const s=this.firstVisibleIndex(),i=this.lastVisibleIndex();e>s&&e=i&&this.forceScrollItemToBeLast(e))}forceScrollItemToBeFirst(e){console.assert(e>=0&&e0?this.cumulativeHeights[e-1]:0,o.UIUtils.isScrolledToBottom(this.element)&&this.setStickToBottom(!0),this.refresh();const t=this.renderedElementAt(e);t&&t.scrollIntoView(!0)}forceScrollItemToBeLast(e){console.assert(e>=0&&e.toolbar{background-color:var(--color-background-elevation-1);border-bottom:var(--legacy-divider-border)}.console-view-fix-select-all{height:0;overflow:hidden}.console-settings-pane{flex:none;background-color:var(--color-background-elevation-1);border-bottom:var(--legacy-divider-border)}.console-settings-pane .toolbar{flex:1 1}#console-messages{flex:1 1;overflow-y:auto;word-wrap:break-word;user-select:text;transform:translateZ(0);overflow-anchor:none;background-color:var(--color-background)}#console-prompt{clear:right;position:relative;margin:0 22px 0 20px}.console-prompt-editor-container{min-height:21px}.console-message,.console-user-command{clear:right;position:relative;padding:3px 22px 1px 0;margin-left:24px;min-height:17px;flex:auto;display:flex}.console-message>*{flex:auto}.console-timestamp{color:var(--color-text-secondary);user-select:none;flex:none;margin-right:5px}.command-result-icon,.message-level-icon{position:absolute;left:-17px;top:4px;user-select:none}.console-message-repeat-count{margin:2px 0 0 10px;flex:none}.repeated-message{margin-left:4px}.repeated-message .message-level-icon{display:none}.console-message-stack-trace-toggle{display:flex;flex-direction:row;align-items:flex-start}.repeated-message .console-message-stack-trace-toggle,.repeated-message>.console-message-text{flex:1}.console-error-level .repeated-message,.console-info-level .repeated-message,.console-verbose-level .repeated-message,.console-warning-level .repeated-message{display:flex}.console-info{color:var(--color-text-secondary);font-style:italic;padding-bottom:2px}.console-group .console-group>.console-group-messages{margin-left:16px}.console-group-title.console-from-api{font-weight:700}.console-group-title .console-message{margin-left:12px}.expand-group-icon{user-select:none;flex:none;position:relative;left:10px;top:5px;margin-right:2px}.console-group-title .message-level-icon{display:none}.console-message-repeat-count .expand-group-icon{left:2px;top:2px;background-color:var(--color-background);margin-right:4px}.console-group{position:relative}.console-message-wrapper{display:flex;border-top:1px solid var(--override-message-border-color);border-bottom:1px solid transparent}.console-message-wrapper:first-of-type{border-top-color:transparent}.console-message-wrapper.console-adjacent-user-command-result:not(.console-error-level):not(.console-warning-level){border-top-width:0}.console-message-wrapper:last-of-type{border-bottom-color:var(--override-message-border-color)}.console-message-wrapper:focus{border-top-color:var(--override-focused-message-border-color);border-bottom-color:var(--override-focused-message-border-color);background-color:var(--override-focused-message-background-color)}.console-message-wrapper:focus+.console-message-wrapper{border-top-color:transparent}.console-message-wrapper.console-error-level,.console-message-wrapper.console-error-level:not(:focus)+.console-message-wrapper:not(.console-warning-level):not(:focus){border-top-color:var(--override-error-border-color)}.console-message-wrapper.console-warning-level,.console-message-wrapper.console-warning-level:not(:focus)+.console-message-wrapper:not(.console-error-level):not(:focus){border-top-color:var(--override-warning-border-color)}.console-message-wrapper.console-error-level:last-of-type{border-bottom-color:var(--override-error-border-color)}.console-message-wrapper.console-warning-level:last-of-type{border-bottom-color:var(--override-warning-border-color)}.console-message-wrapper.console-adjacent-user-command-result:not(.console-error-level):not(.console-warning-level):focus{border-top-width:1px}.console-message-wrapper.console-adjacent-user-command-result:not(.console-error-level):not(.console-warning-level):focus .console-message{padding-top:2px;min-height:16px}.console-message-wrapper.console-adjacent-user-command-result:not(.console-error-level):not(.console-warning-level):focus .command-result-icon{top:3px}.console-message-wrapper.console-error-level:focus{--override-error-text-color:rgb(200 0 0)}.-theme-with-dark-background .console-message-wrapper.console-error-level:focus{--override-error-text-color:hsl(0deg 100% 75%)}.console-message-wrapper .nesting-level-marker{width:14px;flex:0 0 auto;border-right:1px solid var(--color-details-hairline);position:relative;margin-bottom:-1px;margin-top:-1px}.console-message-wrapper .nesting-level-marker::before{border-bottom:1px solid var(--color-details-hairline);position:absolute;top:0;left:0;margin-left:100%;width:3px;height:100%;box-sizing:border-box}.console-message-wrapper .nesting-level-marker.group-closed::before,.console-message-wrapper:last-child .nesting-level-marker::before{content:""}.console-error-level{background-color:var(--override-console-error-background-color)}.console-warning-level{background-color:var(--override-console-warning-background-color)}.console-warning-level .console-message-text{color:var(--override-console-warning-text-color)}.console-view-object-properties-section{padding:0;position:relative;vertical-align:baseline;color:inherit;display:inline-block;overflow-wrap:break-word;max-width:100%}.info-note{background-color:var(--color-primary-variant)}.info-note::before{content:"i"}.console-view-object-properties-section:not(.expanded) .info-note{display:none}.console-error-level .console-message-text,.console-error-level .console-view-object-properties-section{color:var(--override-error-text-color)!important}.console-system-type.console-info-level{color:#00f}.-theme-with-dark-background .console-system-type.console-info-level,.-theme-with-dark-background .console-verbose-level:not(.console-warning-level) .console-message-text{color:hsl(220deg 100% 65%)!important}#console-messages .link{cursor:pointer;text-decoration:underline}#console-messages .devtools-link,#console-messages .link{color:var(--color-text-secondary);word-break:break-all}#console-messages .resource-links{vertical-align:bottom}#console-messages .devtools-link:hover,#console-messages .link:hover{color:var(--color-text-primary)}.console-object-preview{white-space:normal;word-wrap:break-word;font-style:italic}.console-object-preview .name{flex-shrink:0}.console-message-text .object-value-regexp,.console-message-text .object-value-string,.console-message-text .object-value-symbol{white-space:pre-wrap;word-break:break-all}.console-message-formatted-table{clear:both}.console-message .source-code{line-height:1.2}.console-message-anchor{float:right;text-align:right;max-width:100%;margin-left:4px}.console-message-badge{float:right;margin-left:4px}.console-message-nowrap-below,.console-message-nowrap-below div,.console-message-nowrap-below span{white-space:nowrap!important}.object-state-note{display:inline-block;width:11px;height:11px;color:var(--color-background);text-align:center;border-radius:3px;line-height:13px;margin:0 6px;font-size:9px}.-theme-with-dark-background .object-state-note{background-color:hsl(230deg 100% 80%)}.console-object{white-space:pre-wrap;word-break:break-all}.console-message-stack-trace-wrapper{flex:1 1 auto;display:flex;flex-direction:column;align-items:stretch}.console-message-stack-trace-wrapper>*{flex:none}.console-message-expand-icon{margin-bottom:-2px}.console-searchable-view{max-height:100%}.console-view-pinpane{flex:none;max-height:50%}.message-count{width:0;height:0}@media (forced-colors:active){.console-message-expand-icon,.console-warning-level [is=ui-icon].icon-mask.expand-group-icon{forced-color-adjust:none;background-color:ButtonText}.console-message-wrapper:focus,.console-message-wrapper:focus:last-of-type{forced-color-adjust:none;background-color:Highlight;border-top-color:Highlight;border-bottom-color:Highlight}.console-message-wrapper:focus *,.console-message-wrapper:focus .devtools-link,.console-message-wrapper:focus:last-of-type *,.console-message-wrapper:focus:last-of-type .devtools-link{color:HighlightText!important}#console-messages .devtools-link,#console-messages .devtools-link:hover{color:linktext}#console-messages .devtools-link:focus-visible,#console-messages .link:focus-visible{background:Highlight;color:HighlightText}.console-message-wrapper:focus [is=ui-icon].icon-mask{background-color:HighlightText}.console-message-wrapper.console-error-level:focus,.console-message-wrapper.console-error-level:focus:last-of-type{--override-error-text-color:HighlightText}}\n/*# sourceURL=consoleView.css */\n');const Z={consoleclearWasPreventedDueTo:"`console.clear()` was prevented due to 'Preserve log'",consoleWasCleared:"Console was cleared",clearAllMessagesWithS:"Clear all messages with {PH1}",assertionFailed:"Assertion failed: ",violationS:"`[Violation]` {PH1}",interventionS:"`[Intervention]` {PH1}",deprecationS:"`[Deprecation]` {PH1}",thisValueWillNotBeCollectedUntil:"This value will not be collected until console is cleared.",thisValueWasEvaluatedUponFirst:"This value was evaluated upon first expanding. It may have changed since then.",functionWasResolvedFromBound:"Function was resolved from bound function.",exception:"",warning:"Warning",error:"Error",repeatS:"{n, plural, =1 {Repeated # time} other {Repeated # times}}",warningS:"{n, plural, =1 {Warning, Repeated # time} other {Warning, Repeated # times}}",errorS:"{n, plural, =1 {Error, Repeated # time} other {Error, Repeated # times}}",url:"",tookNms:"took ms",someEvent:" event",Mxx:" M",attribute:"",index:"(index)",value:"Value",console:"Console",stackMessageExpanded:"Stack table expanded",stackMessageCollapsed:"Stack table collapsed"},Q=t.i18n.registerUIStrings("panels/console/ConsoleViewMessage.ts",Z),Y=t.i18n.getLocalizedString.bind(void 0,Q),ee=new WeakMap,te=e=>ee.get(e),se=e=>t=>t instanceof i.RemoteObject.RemoteObject?t:e?"object"==typeof t?e.createRemoteObject(t):e.createRemoteObjectFromPrimitiveValue(t):i.RemoteObject.RemoteObject.fromLocalObject(t);class ie{message;linkifier;repeatCountInternal;closeGroupDecorationCount;nestingLevelInternal;selectableChildren;messageResized;elementInternal;previewFormatter;searchRegexInternal;messageLevelIcon;traceExpanded;expandTrace;anchorElement;contentElementInternal;nestingLevelMarkers;searchHighlightNodes;searchHighlightNodeChanges;isVisibleInternal;cachedHeight;messagePrefix;timestampElement;inSimilarGroup;similarGroupMarker;lastInSimilarGroup;groupKeyInternal;repeatCountElement;requestResolver;issueResolver;constructor(e,t,s,i,o,n){this.message=e,this.linkifier=t,this.requestResolver=s,this.issueResolver=i,this.repeatCountInternal=1,this.closeGroupDecorationCount=0,this.nestingLevelInternal=o,this.selectableChildren=[],this.messageResized=n,this.elementInternal=null,this.previewFormatter=new a.RemoteObjectPreviewFormatter.RemoteObjectPreviewFormatter,this.searchRegexInternal=null,this.messageLevelIcon=null,this.traceExpanded=!1,this.expandTrace=null,this.anchorElement=null,this.contentElementInternal=null,this.nestingLevelMarkers=null,this.searchHighlightNodes=[],this.searchHighlightNodeChanges=[],this.isVisibleInternal=!1,this.cachedHeight=0,this.messagePrefix="",this.timestampElement=null,this.inSimilarGroup=!1,this.similarGroupMarker=null,this.lastInSimilarGroup=!1,this.groupKeyInternal="",this.repeatCountElement=null}element(){return this.toMessageElement()}wasShown(){this.isVisibleInternal=!0}onResize(){}willHide(){this.isVisibleInternal=!1,this.cachedHeight=this.element().offsetHeight}isVisible(){return this.isVisibleInternal}fastHeight(){return this.cachedHeight?this.cachedHeight:this.approximateFastHeight()}approximateFastHeight(){return 19}consoleMessage(){return this.message}buildMessage(){let t,s=this.message.messageText;if(this.message.source===i.ConsoleModel.FrontendMessageSource.ConsoleAPI)switch(this.message.type){case"trace":t=this.format(this.message.parameters||["console.trace"]);break;case"clear":t=document.createElement("span"),t.classList.add("console-info"),e.Settings.Settings.instance().moduleSetting("preserveConsoleLog").get()?t.textContent=Y(Z.consoleclearWasPreventedDueTo):t.textContent=Y(Z.consoleWasCleared),o.Tooltip.Tooltip.install(t,Y(Z.clearAllMessagesWithS,{PH1:String(o.ShortcutRegistry.ShortcutRegistry.instance().shortcutTitleForAction("console.clear"))}));break;case"dir":{const e=["%O",this.message.parameters?this.message.parameters[0]:void 0];t=this.format(e);break}case"profile":case"profileEnd":t=this.format([s]);break;default:{if("assert"===this.message.type&&(this.messagePrefix=Y(Z.assertionFailed)),this.message.parameters&&1===this.message.parameters.length){const e=this.message.parameters[0];"string"!=typeof e&&"string"===e.type&&(t=this.tryFormatAsError(e.value))}const e=this.message.parameters||[s];t=t||this.format(e)}}else if("network"===this.message.source)t=this.formatAsNetworkRequest()||this.format([s]);else{const e=this.message.parameters&&s===this.message.parameters[0];"violation"===this.message.source?s=Y(Z.violationS,{PH1:s}):"intervention"===this.message.source?s=Y(Z.interventionS,{PH1:s}):"deprecation"===this.message.source&&(s=Y(Z.deprecationS,{PH1:s}));const i=this.message.parameters||[s];e&&(i[0]=s),t=this.format(i)}t.classList.add("console-message-text");const n=document.createElement("span");return n.classList.add("source-code"),this.anchorElement=this.buildMessageAnchor(),this.anchorElement&&n.appendChild(this.anchorElement),n.appendChild(t),n}formatAsNetworkRequest(){const e=d.NetworkLog.NetworkLog.requestForConsoleMessage(this.message);if(!e)return null;const t=document.createElement("span");if("error"===this.message.level){o.UIUtils.createTextChild(t,e.requestMethod+" ");const s=c.Linkifier.Linkifier.linkifyRevealable(e,e.url(),e.url());s.tabIndex=-1,this.selectableChildren.push({element:s,forceSelect:()=>s.focus()}),t.appendChild(s),e.failed&&o.UIUtils.createTextChildren(t," ",e.localizedFailDescription||""),0!==e.statusCode&&o.UIUtils.createTextChildren(t," ",String(e.statusCode)),e.statusText&&o.UIUtils.createTextChildren(t," (",e.statusText,")")}else{const s=this.message.messageText,i=this.linkifyWithCustomLinkifier(s,((t,s,i,o)=>{const n=s===e.url()?c.Linkifier.Linkifier.linkifyRevealable(e,s,e.url()):c.Linkifier.Linkifier.linkifyURL(s,{text:t,lineNumber:i,columnNumber:o});return n.tabIndex=-1,this.selectableChildren.push({element:n,forceSelect:()=>n.focus()}),n}));t.appendChild(i)}return t}createAffectedResourceLinks(){const e=[],t=this.message.getAffectedResources()?.requestId;if(t){const s=new g.RequestLinkIcon.RequestLinkIcon;s.classList.add("resource-links"),s.data={affectedRequest:{requestId:t},requestResolver:this.requestResolver,displayURL:!1},e.push(s)}const s=this.message.getAffectedResources()?.issueId;if(s){const t=new p.IssueLinkIcon.IssueLinkIcon;t.classList.add("resource-links"),t.data={issueId:s,issueResolver:this.issueResolver},e.push(t)}return e}buildMessageAnchor(){const e=(e=>e.scriptId?this.linkifyScriptId(e.scriptId,e.url||"",e.line,e.column):e.stackTrace&&e.stackTrace.callFrames.length?this.linkifyStackTraceTopFrame(e.stackTrace):e.url&&"undefined"!==e.url?this.linkifyLocation(e.url,e.line,e.column):null)(this.message);if(e){e.tabIndex=-1,this.selectableChildren.push({element:e,forceSelect:()=>e.focus()});const t=document.createElement("span");t.classList.add("console-message-anchor"),t.appendChild(e);for(const e of this.createAffectedResourceLinks())o.UIUtils.createTextChild(t," "),t.append(e);return o.UIUtils.createTextChild(t," "),t}return null}buildMessageWithStackTrace(e){const t=document.createElement("div");t.classList.add("console-message-stack-trace-toggle");const s=t.createChild("div","console-message-stack-trace-wrapper"),i=this.buildMessage(),n=o.Icon.Icon.create("smallicon-triangle-right","console-message-expand-icon"),r=s.createChild("div");o.ARIAUtils.setExpanded(r,!1),r.appendChild(n),r.tabIndex=-1,r.appendChild(i);const l=s.createChild("div"),a=c.JSPresentationUtils.buildStackTracePreviewContents(e.target(),this.linkifier,{stackTrace:this.message.stackTrace,tabStops:void 0});l.appendChild(a.element);for(const e of a.links)this.selectableChildren.push({element:e,forceSelect:()=>e.focus()});l.classList.add("hidden"),o.ARIAUtils.setAccessibleName(s,`${i.textContent} ${Y(Z.stackMessageCollapsed)}`),o.ARIAUtils.markAsGroup(l),this.expandTrace=e=>{n.setIconType(e?"smallicon-triangle-down":"smallicon-triangle-right"),l.classList.toggle("hidden",!e);const t=Y(e?Z.stackMessageExpanded:Z.stackMessageCollapsed);o.ARIAUtils.setAccessibleName(s,`${i.textContent} ${t}`),o.ARIAUtils.alert(t),o.ARIAUtils.setExpanded(r,e),this.traceExpanded=e};return r.addEventListener("click",(e=>{o.UIUtils.isEditing()||s.hasSelection()||(this.expandTrace&&this.expandTrace(l.classList.contains("hidden")),e.consume())}),!1),"trace"===this.message.type&&this.expandTrace(!0),t._expandStackTraceForTest=this.expandTrace.bind(this,!0),t}linkifyLocation(e,t,s){const i=this.message.runtimeModel();return i?this.linkifier.linkifyScriptLocation(i.target(),null,e,t,{columnNumber:s,className:void 0,tabStop:void 0,inlineFrameIndex:0}):null}linkifyStackTraceTopFrame(e){const t=this.message.runtimeModel();return t?this.linkifier.linkifyStackTraceTopFrame(t.target(),e):null}linkifyScriptId(e,t,s,i){const o=this.message.runtimeModel();return o?this.linkifier.linkifyScriptLocation(o.target(),e,t,s,{columnNumber:i,className:void 0,tabStop:void 0,inlineFrameIndex:0}):null}format(e){const t=document.createElement("span");if(this.messagePrefix&&(t.createChild("span").textContent=this.messagePrefix),!e.length)return t;let s=e.map(se(this.message.runtimeModel()));const n="string"===i.RemoteObject.RemoteObject.type(s[0])&&(this.message.type!==i.ConsoleModel.FrontendMessageType.Result||"error"===this.message.level);if(n){const e=this.formatWithSubstitutionString(s[0].description,s.slice(1),t);s=Array.from(e.unusedSubstitutions||[]),s.length&&o.UIUtils.createTextChild(t," ")}for(let e=0;epe()){const e=new a.ObjectPropertiesSection.ExpandableTextPropertyValue(document.createElement("span"),s,ge());t.appendChild(e.element)}else o.UIUtils.createTextChild(t,s);return t.addEventListener("contextmenu",this.contextMenuEventFired.bind(this,e),!1),t}formatParameterAsTrustedType(e){const t=document.createElement("span"),s=document.createElement("span");return s.appendChild(this.formatParameterAsString(e)),s.classList.add("object-value-string"),o.UIUtils.createTextChild(t,`${e.className} `),t.appendChild(s),t}formatParameterAsObject(e,t){const s=document.createElement("span");if(s.classList.add("console-object"),t&&e.preview)s.classList.add("console-object-preview"),this.previewFormatter.appendObjectPreview(s,e.preview,!1);else if("function"===e.type){const t=s.createChild("span");a.ObjectPropertiesSection.ObjectPropertiesSection.formatObjectAsFunction(e,t,!1),s.classList.add("object-value-function")}else"trustedtype"===e.subtype?s.appendChild(this.formatParameterAsTrustedType(e)):o.UIUtils.createTextChild(s,e.description||"");if(!e.hasChildren||e.customPreview())return s;const n=s.createChild("span","object-state-note info-note");this.message.type===i.ConsoleModel.FrontendMessageType.QueryObjectResult?o.Tooltip.Tooltip.install(n,Y(Z.thisValueWillNotBeCollectedUntil)):o.Tooltip.Tooltip.install(n,Y(Z.thisValueWasEvaluatedUponFirst));const r=new a.ObjectPropertiesSection.ObjectPropertiesSection(e,s,this.linkifier);return r.element.classList.add("console-view-object-properties-section"),r.enableContextMenu(),r.setShowSelectionOnKeyboardFocus(!0,!0),this.selectableChildren.push(r),r.addEventListener(o.TreeOutline.Events.ElementAttached,this.messageResized),r.addEventListener(o.TreeOutline.Events.ElementExpanded,this.messageResized),r.addEventListener(o.TreeOutline.Events.ElementCollapsed,this.messageResized),r.element}formatParameterAsFunction(e,t){const s=document.createElement("span");return i.RemoteObject.RemoteFunction.objectAsFunction(e).targetFunction().then(function(i){const n=document.createElement("span"),r=a.ObjectPropertiesSection.ObjectPropertiesSection.formatObjectAsFunction(i,n,!0,t);if(s.appendChild(n),i!==e){const e=s.createChild("span","object-state-note info-note");o.Tooltip.Tooltip.install(e,Y(Z.functionWasResolvedFromBound))}s.addEventListener("contextmenu",this.contextMenuEventFired.bind(this,i),!1),r.then((()=>this.formattedParameterAsFunctionForTest()))}.bind(this)),s}formattedParameterAsFunctionForTest(){}contextMenuEventFired(e,t){const s=new o.ContextMenu.ContextMenu(t);s.appendApplicableItems(e),s.show()}renderPropertyPreviewOrAccessor(e,t,s){return"accessor"===t.type?this.formatAsAccessorProperty(e,s.map((e=>e.name.toString())),!1):this.previewFormatter.renderPropertyPreview(t.type,"subtype"in t?t.subtype:void 0,null,t.value)}formatParameterAsNode(e){const t=document.createElement("span"),s=e.runtimeModel().target().model(i.DOMModel.DOMModel);return s?(s.pushObjectAsNodeToFrontend(e).then((async s=>{if(!s)return void t.appendChild(this.formatParameterAsObject(e,!1));const i=await o.UIUtils.Renderer.render(s);i?(i.tree&&(this.selectableChildren.push(i.tree),i.tree.addEventListener(o.TreeOutline.Events.ElementAttached,this.messageResized),i.tree.addEventListener(o.TreeOutline.Events.ElementExpanded,this.messageResized),i.tree.addEventListener(o.TreeOutline.Events.ElementCollapsed,this.messageResized)),t.appendChild(i.node)):t.appendChild(this.formatParameterAsObject(e,!1)),this.formattedParameterAsNodeForTest()})),t):t}formattedParameterAsNodeForTest(){}formatParameterAsString(e){const t=e.description??"",i=s.StringUtilities.formatAsJSLiteral(t),o=document.createElement("span");return o.addEventListener("contextmenu",this.contextMenuEventFired.bind(this,e),!1),o.appendChild(this.linkifyStringAsFragment(i)),o}formatParameterAsError(e){const t=document.createElement("span"),s=this.tryFormatAsError(e.description||"");return t.appendChild(s||this.linkifyStringAsFragment(e.description||"")),t}formatAsArrayEntry(e){return this.previewFormatter.renderPropertyPreview(e.type,e.subtype,e.className,e.description)}formatAsAccessorProperty(e,t,i){const n=a.ObjectPropertiesSection.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan(e,t,function(e){const t=e.wasThrown,r=e.object;if(!r)return;if(n.removeChildren(),t){const e=n.createChild("span");e.textContent=Y(Z.exception),o.Tooltip.Tooltip.install(e,r.description)}else if(i)n.appendChild(this.formatAsArrayEntry(r));else{const e=100,t=r.type,i=r.subtype;let o="";"function"!==t&&r.description&&(o="string"===t||"regexp"===i||"trustedtype"===i?s.StringUtilities.trimMiddle(r.description,e):s.StringUtilities.trimEndWithMaxLength(r.description,e)),n.appendChild(this.previewFormatter.renderPropertyPreview(t,i,r.className,o))}}.bind(this));return n}formatWithSubstitutionString(e,t,o){function n(e,t,s){return s instanceof i.RemoteObject.RemoteObject?this.formatParameter(s,e,t):r(s)}function r(e){if(void 0!==e)return"string"==typeof e?e:e.description}function l(e){if(e instanceof i.RemoteObject.RemoteObject)return"bigint"===e.type?e.description:"number"!=typeof e.value?"NaN":Math.floor(e.value)}let a=null;function c(e){const t=["background","border","color","font","line","margin","padding","text","-webkit-background","-webkit-border","-webkit-font","-webkit-margin","-webkit-padding","-webkit-text"];for(const s of t)if(e.startsWith(s))return!0;return!1}const h={};function d(e){if(a)for(const[t,{value:s,priority:i}]of a.entries())e.style.setProperty(t,s,i)}return h.o=n.bind(this,!1,!0),h.s=r,h.f=function(e){if(e instanceof i.RemoteObject.RemoteObject)return"number"!=typeof e.value?"NaN":e.value},h.i=l,h.d=l,h.c=function(e){a=new Map;const t=document.createElement("span");if(void 0!==e&&"string"!=typeof e&&e.description){t.setAttribute("style",e.description);for(const e of t.style)if(c(e)){const s={value:t.style.getPropertyValue(e),priority:t.style.getPropertyPriority(e)};a.set(e,s)}}},h.O=n.bind(this,!0,!1),h._=function(e){return e instanceof Node?e:""},s.StringUtilities.format(e,t,h,o,function(e,t){if(t instanceof Node)return e.appendChild(t),e;if(void 0===t)return e;if(!a)return e.appendChild(this.linkifyStringAsFragment(String(t))),e;const s=String(t).split("\n");for(let t=0;te.element.hasFocus())):-1}onKeyDown(e){!o.UIUtils.isEditing()&&this.elementInternal&&this.elementInternal.hasFocus()&&!this.elementInternal.hasSelection()&&this.maybeHandleOnKeyDown(e)&&e.consume(!0)}maybeHandleOnKeyDown(e){const t=this.focusedChildIndex(),s=-1===t;if(this.expandTrace&&s&&("ArrowLeft"===e.key&&this.traceExpanded||"ArrowRight"===e.key&&!this.traceExpanded))return this.expandTrace(!this.traceExpanded),!0;if(!this.selectableChildren.length)return!1;if("ArrowLeft"===e.key)return this.elementInternal&&this.elementInternal.focus(),!0;if("ArrowRight"===e.key&&s&&this.selectNearestVisibleChild(0))return!0;if("ArrowUp"===e.key){const e=this.nearestVisibleChild(0);if(this.selectableChildren[t]===e&&e)return this.elementInternal&&this.elementInternal.focus(),!0;if(this.selectNearestVisibleChild(t-1,!0))return!0}if("ArrowDown"===e.key){if(s&&this.selectNearestVisibleChild(0))return!0;if(!s&&this.selectNearestVisibleChild(t+1))return!0}return!1}selectNearestVisibleChild(e,t){const s=this.nearestVisibleChild(e,t);return!!s&&(s.forceSelect(),!0)}nearestVisibleChild(e,t){const s=this.selectableChildren.length;if(e<0||e>=s)return null;const i=t?-1:1;let o=e;for(;!this.selectableChildren[o].element.offsetParent;)if(o+=i,o<0||o>=s)return null;return this.selectableChildren[o]}focusLastChildOrSelf(){this.elementInternal&&!this.selectNearestVisibleChild(this.selectableChildren.length-1,!0)&&this.elementInternal.focus()}setContentElement(e){console.assert(!this.contentElementInternal,"Cannot set content element twice"),this.contentElementInternal=e}getContentElement(){return this.contentElementInternal}contentElement(){if(this.contentElementInternal)return this.contentElementInternal;const e=document.createElement("div");e.classList.add("console-message"),this.messageLevelIcon&&e.appendChild(this.messageLevelIcon),this.contentElementInternal=e;const t=this.message.runtimeModel();let s;const i=Boolean(this.message.stackTrace)&&("network"===this.message.source||"violation"===this.message.source||"error"===this.message.level||"warning"===this.message.level||"trace"===this.message.type);return s=t&&i?this.buildMessageWithStackTrace(t):this.buildMessage(),e.appendChild(s),this.updateTimestamp(),this.contentElementInternal}toMessageElement(){return this.elementInternal||(this.elementInternal=document.createElement("div"),this.elementInternal.tabIndex=-1,this.elementInternal.addEventListener("keydown",this.onKeyDown.bind(this)),this.updateMessageElement()),this.elementInternal}updateMessageElement(){if(this.elementInternal){this.elementInternal.className="console-message-wrapper",this.elementInternal.removeChildren(),this.message.isGroupStartMessage()&&this.elementInternal.classList.add("console-group-title"),this.message.source===i.ConsoleModel.FrontendMessageSource.ConsoleAPI&&this.elementInternal.classList.add("console-from-api"),this.inSimilarGroup&&(this.similarGroupMarker=this.elementInternal.createChild("div","nesting-level-marker"),this.similarGroupMarker.classList.toggle("group-closed",this.lastInSimilarGroup)),this.nestingLevelMarkers=[];for(let e=0;e1&&this.showRepeatCountElement()}}shouldRenderAsWarning(){return!("verbose"!==this.message.level&&"info"!==this.message.level||"violation"!==this.message.source&&"deprecation"!==this.message.source&&"intervention"!==this.message.source&&"recommendation"!==this.message.source)}updateMessageLevelIcon(){let e="",t="";if("warning"===this.message.level?(e="smallicon-warning",t=Y(Z.warning)):"error"===this.message.level&&(e="smallicon-error",t=Y(Z.error)),!this.messageLevelIcon){if(!e)return;this.messageLevelIcon=o.Icon.Icon.create("","message-level-icon"),this.contentElementInternal&&this.contentElementInternal.insertBefore(this.messageLevelIcon,this.contentElementInternal.firstChild)}this.messageLevelIcon.setIconType(e),o.ARIAUtils.setAccessibleName(this.messageLevelIcon,t)}repeatCount(){return this.repeatCountInternal||1}resetIncrementRepeatCount(){this.repeatCountInternal=1,this.repeatCountElement&&(this.repeatCountElement.remove(),this.contentElementInternal&&this.contentElementInternal.classList.remove("repeated-message"),this.repeatCountElement=null)}incrementRepeatCount(){this.repeatCountInternal++,this.showRepeatCountElement()}setRepeatCount(e){this.repeatCountInternal=e,this.showRepeatCountElement()}showRepeatCountElement(){if(!this.elementInternal)return;if(!this.repeatCountElement){switch(this.repeatCountElement=document.createElement("span",{is:"dt-small-bubble"}),this.repeatCountElement.classList.add("console-message-repeat-count"),this.message.level){case"warning":this.repeatCountElement.type="warning";break;case"error":this.repeatCountElement.type="error";break;case"verbose":this.repeatCountElement.type="verbose";break;default:this.repeatCountElement.type="info"}this.shouldRenderAsWarning()&&(this.repeatCountElement.type="warning"),this.elementInternal.insertBefore(this.repeatCountElement,this.contentElementInternal),this.contentElement().classList.add("repeated-message")}let e;this.repeatCountElement.textContent=`${this.repeatCountInternal}`,e="warning"===this.message.level?Y(Z.warningS,{n:this.repeatCountInternal}):"error"===this.message.level?Y(Z.errorS,{n:this.repeatCountInternal}):Y(Z.repeatS,{n:this.repeatCountInternal}),o.ARIAUtils.setAccessibleName(this.repeatCountElement,e)}get text(){return this.message.messageText}toExportString(){const e=[],t=this.contentElement().childTextNodes().map(c.Linkifier.Linkifier.untruncatedNodeText).join("");for(let s=0;se.uiSourceCodeForURL(t))).flat().filter((e=>Boolean(e))).map((e=>n.scriptsForUISourceCode(e))).flat();if(r.length){const t=new i.DebuggerModel.Location(e,r[0].scriptId,s||0,o);return await n.pluginManager.getFunctionInfo(r[0],t)??{frames:[]}}}return{frames:[]}}async expandInlineStackFrames(e,t,s,i,o,n,r,l){const{frames:a}=await this.getInlineFrames(e,i,o,n);if(!a.length)return!1;for(let c=0;cu.focus()}),d.appendChild(u),d.appendChild(this.linkifyStringAsFragment(s)),r.insertBefore(d,l)}return!0}tryFormatAsError(t){const s=this.message.runtimeModel();if(!s||!["AggregateError","Error","EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"].some((function(e){return t.startsWith(e)}))&&!/^[\w.]+Error\b/.test(t))return null;const i=s.debuggerModel(),o=s.target().inspectedURL(),n=t.split("\n"),r=[];for(const t of n){const s=/^\s*at\s/.test(t);if(!s&&r.length&&r[r.length-1].link)return null;if(!s){r.push({line:t});continue}let i=-1,n=-1;const l=/\([^\)\(]+:\d+:\d+\)/g,c=/\([^\)\(]+\)/g;let h,d=null;for(;h=l.exec(t);)d=h;if(!d)for(;h=c.exec(t);)d=h;d&&(i=d.index,n=d.index+d[0].length-1);const u=-1!==i;let m=u?i+1:t.indexOf("at")+3;u||t.indexOf("async ")!==m||(m+=6);const p=u?n:t.length,g=t.substring(m,p),v=e.ParsedURL.ParsedURL.splitLineAndColumn(g);if(!v)return null;if(""===v.url){r.push({line:t});continue}let f=a(v.url);if(!f&&e.ParsedURL.ParsedURL.isRelativeURL(v.url)&&(f=a(e.ParsedURL.ParsedURL.completeURL(o,v.url))),!f)return null;r.push({line:t,link:{url:f,enclosedInBraces:u,positionLeft:m,positionRight:p,lineNumber:v.lineNumber,columnNumber:v.columnNumber}})}if(!r.length)return null;const l=document.createElement("span");for(let e=0;eh.focus()}),n.appendChild(h),n.appendChild(this.linkifyStringAsFragment(c)),l.appendChild(n),!o.enclosedInBraces)continue;const d=a.substring(0,a.lastIndexOf(" ",a.length-3)),u=this.selectableChildren.length-1;this.expandInlineStackFrames(i,d,c,o.url,o.lineNumber,o.columnNumber,l,n).then((e=>{e&&(l.removeChild(n),this.selectableChildren.splice(u,1))}))}return l;function a(t){if(!t)return null;const s=e.ParsedURL.ParsedURL.fromString(t);if(s)return s.url;if(i.scriptsForSourceURL(t).length)return t;const o=new URL(t,"file://");return i.scriptsForSourceURL(o.href).length?o.href:null}}linkifyWithCustomLinkifier(t,s){if(t.length>pe()){const e=new a.ObjectPropertiesSection.ExpandableTextPropertyValue(document.createElement("span"),t,ge()),s=document.createDocumentFragment();return s.appendChild(e.element),s}const i=document.createDocumentFragment(),o=ie.tokenizeMessageText(t);let n=!1;for(const t of o)if(t.text)switch(n&&(t.text=`blob:${t.text}`,n=!n),"'blob:"===t.text&&t===o[0]&&(n=!0,t.text="'"),t.type){case"url":{const o=t.text.startsWith("www.")?"http://"+t.text:t.text,n=e.ParsedURL.ParsedURL.splitLineAndColumn(o),r=e.ParsedURL.ParsedURL.removeWasmFunctionInfoFromURL(n.url);let l;l=n?s(t.text,r,n.lineNumber,n.columnNumber):s(t.text,""),i.appendChild(l);break}default:i.appendChild(document.createTextNode(t.text))}return i}linkifyStringAsFragment(e){return this.linkifyWithCustomLinkifier(e,((e,t,s,i)=>{const o={text:e,lineNumber:s,columnNumber:i},n=c.Linkifier.Linkifier.linkifyURL(t,o);return n.tabIndex=-1,this.selectableChildren.push({element:n,forceSelect:()=>n.focus()}),n}))}static tokenizeMessageText(e){const{tokenizerRegexes:t,tokenizerTypes:s}=re();if(e.length>pe())return[{text:e,type:void 0}];return n.TextUtils.Utils.splitStringByRegexes(e,t).map((e=>({text:e.value,type:s[e.regexIndex]})))}groupKey(){return this.groupKeyInternal||(this.groupKeyInternal=this.message.groupCategoryKey()+":"+this.groupTitle()),this.groupKeyInternal}groupTitle(){return ie.tokenizeMessageText(this.message.messageText).reduce(((e,t)=>{let s=t.text;return"url"===t.type?s=Y(Z.url):"time"===t.type?s=Y(Z.tookNms):"event"===t.type?s=Y(Z.someEvent):"milestone"===t.type?s=Y(Z.Mxx):"autofill"===t.type&&(s=Y(Z.attribute)),e+s}),"").replace(/[%]o/g,"")}}let oe=null,ne=null;function re(){if(!oe||!ne){const e="\\u0000-\\u0020\\u007f-\\u009f",t=new RegExp("(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\\/\\/|data:|www\\.)[^\\s"+e+'"]{2,}[^\\s'+e+"\"')}\\],:;.!?]","u"),s=/(?:\/[\w\.-]*)+\:[\d]+/,i=/took [\d]+ms/,o=/'\w+' event/,n=/\sM[6-7]\d/,r=/\(suggested: \"[\w-]+\"\)/,l=new Map;return l.set(t,"url"),l.set(s,"url"),l.set(i,"time"),l.set(o,"event"),l.set(n,"milestone"),l.set(r,"autofill"),oe=Array.from(l.keys()),ne=Array.from(l.values()),{tokenizerRegexes:oe,tokenizerTypes:ne}}return{tokenizerRegexes:oe,tokenizerTypes:ne}}class le extends ie{collapsedInternal;expandGroupIcon;onToggle;constructor(e,t,s,i,o,n,r){console.assert(e.isGroupStartMessage()),super(e,t,s,i,o,r),this.collapsedInternal="startGroupCollapsed"===e.type,this.expandGroupIcon=null,this.onToggle=n}setCollapsed(e){this.collapsedInternal=e,this.expandGroupIcon&&this.expandGroupIcon.setIconType(this.collapsedInternal?"smallicon-triangle-right":"smallicon-triangle-down"),this.onToggle.call(null)}collapsed(){return this.collapsedInternal}maybeHandleOnKeyDown(e){return-1===this.focusedChildIndex()&&("ArrowLeft"===e.key&&!this.collapsedInternal||"ArrowRight"===e.key&&this.collapsedInternal)?(this.setCollapsed(!this.collapsedInternal),!0):super.maybeHandleOnKeyDown(e)}toMessageElement(){let e=this.elementInternal||null;if(!e){e=super.toMessageElement();const t=this.collapsedInternal?"smallicon-triangle-right":"smallicon-triangle-down";this.expandGroupIcon=o.Icon.Icon.create(t,"expand-group-icon"),this.contentElement().tabIndex=-1,this.repeatCountElement?this.repeatCountElement.insertBefore(this.expandGroupIcon,this.repeatCountElement.firstChild):e.insertBefore(this.expandGroupIcon,this.contentElementInternal),e.addEventListener("click",(()=>this.setCollapsed(!this.collapsedInternal)))}return e}showRepeatCountElement(){super.showRepeatCountElement(),this.repeatCountElement&&this.expandGroupIcon&&this.repeatCountElement.insertBefore(this.expandGroupIcon,this.repeatCountElement.firstChild)}}class ae extends ie{formattedCommand;constructor(e,t,s,i,o,n){super(e,t,s,i,o,n),this.formattedCommand=null}contentElement(){const e=this.getContentElement();if(e)return e;const t=document.createElement("div");this.setContentElement(t),t.classList.add("console-user-command");const i=o.Icon.Icon.create("smallicon-user-command","command-result-icon");return t.appendChild(i),ee.set(t,this),this.formattedCommand=document.createElement("span"),this.formattedCommand.classList.add("source-code"),this.formattedCommand.textContent=s.StringUtilities.replaceControlCharacters(this.text),t.appendChild(this.formattedCommand),this.formattedCommand.textContent.lengthe===i?Y(Z.value):e.toString()));if(l.length&&(this.dataGrid=v.SortableDataGrid.SortableDataGrid.create(a,l,Y(Z.console)),this.dataGrid)){this.dataGrid.setStriped(!0),this.dataGrid.setFocusable(!1);const t=document.createElement("span");t.classList.add("console-message-text");const i=t.createChild("div","console-message-formatted-table"),o=i.createChild("span");i.appendChild(this.formatParameter(s,!0,!1));const n=o.attachShadow({mode:"open"}),r=this.dataGrid.asWidget();r.markAsRoot(),r.show(n),r.registerCSSFiles([X,L]),e.appendChild(t),this.dataGrid.renderInline()}return e}approximateFastHeight(){const e=this.message.parameters&&this.message.parameters[0];return e&&"string"!=typeof e&&e.preview?19*e.preview.properties.length:19}}const de=1e4;let ue=1e4,me=5e3;const pe=()=>ue,ge=()=>me;var ve=Object.freeze({__proto__:null,getMessageForElement:te,ConsoleViewMessage:ie,ConsoleGroupViewMessage:le,ConsoleCommand:ae,ConsoleCommandResult:ce,ConsoleTableMessageView:he,MaxLengthForLinks:40,getMaxTokenizableStringLength:pe,setMaxTokenizableStringLength:e=>{ue=e},getLongStringVisibleLength:ge,setLongStringVisibleLength:e=>{me=e}});const fe={issuesWithColon:"{n, plural, =0 {No Issues} =1 {# Issue:} other {# Issues:}}",issueToolbarTooltipGeneral:"Some problems no longer generate console messages, but are surfaced in the issues tab.",issueToolbarClickToView:"Click to view {issueEnumeration}",issueToolbarClickToGoToTheIssuesTab:"Click to go to the issues tab",findStringInLogs:"Find string in logs",consoleSettings:"Console settings",groupSimilarMessagesInConsole:"Group similar messages in console",showCorsErrorsInConsole:"Show `CORS` errors in console",showConsoleSidebar:"Show console sidebar",hideConsoleSidebar:"Hide console sidebar",doNotClearLogOnPageReload:"Do not clear log on page reload / navigation",preserveLog:"Preserve log",hideNetwork:"Hide network",onlyShowMessagesFromTheCurrentContext:"Only show messages from the current context (`top`, `iframe`, `worker`, extension)",selectedContextOnly:"Selected context only",eagerlyEvaluateTextInThePrompt:"Eagerly evaluate text in the prompt",sHidden:"{n, plural, =1 {# hidden} other {# hidden}}",consoleCleared:"Console cleared",hideMessagesFromS:"Hide messages from {PH1}",saveAs:"Save as...",copyVisibleStyledSelection:"Copy visible styled selection",replayXhr:"Replay XHR",writingFile:"Writing file…",searching:"Searching…",filter:"Filter",egEventdCdnUrlacom:"e.g. `/eventd/ -cdn url:a.com`",verbose:"Verbose",info:"Info",warnings:"Warnings",errors:"Errors",logLevels:"Log levels",overriddenByFilterSidebar:"Overridden by filter sidebar",customLevels:"Custom levels",sOnly:"{PH1} only",allLevels:"All levels",defaultLevels:"Default levels",hideAll:"Hide all",logLevelS:"Log level: {PH1}",default:"Default",filteredMessagesInConsole:"{PH1} messages in console"},be=t.i18n.registerUIStrings("panels/console/ConsoleView.ts",fe),Ce=t.i18n.getLocalizedString.bind(void 0,be);let xe;class we extends o.Widget.VBox{searchableViewInternal;sidebar;isSidebarOpen;filter;consoleToolbarContainer;splitWidget;contentsElement;visibleViewMessages;hiddenByFilterCount;shouldBeHiddenCache;lastShownHiddenByFilterCount;currentMatchRangeIndex;searchRegex;groupableMessages;groupableMessageTitle;shortcuts;regexMatchRanges;consoleContextSelector;filterStatusText;showSettingsPaneSetting;showSettingsPaneButton;progressToolbarItem;groupSimilarSetting;showCorsErrorsSetting;preserveLogCheckbox;hideNetworkMessagesCheckbox;timestampsSetting;consoleHistoryAutocompleteSetting;pinPane;viewport;messagesElement;messagesCountElement;viewportThrottler;pendingBatchResize;onMessageResizedBound;topGroup;currentGroup;promptElement;linkifier;consoleMessages;viewMessageSymbol;consoleHistorySetting;prompt;immediatelyFilterMessagesForTest;maybeDirtyWhileMuted;scheduledRefreshPromiseForTest;needsFullUpdate;buildHiddenCacheTimeout;searchShouldJumpBackwards;searchProgressIndicator;innerSearchTimeoutId;muteViewportUpdates;waitForScrollTimeout;issueCounter;pendingSidebarMessages=[];userHasOpenedSidebarAtLeastOnce=!1;issueToolbarThrottle;requestResolver=new d.RequestResolver.RequestResolver;issueResolver=new C.IssueResolver.IssueResolver;constructor(){super(),this.setMinimumSize(0,35),this.searchableViewInternal=new o.SearchableView.SearchableView(this,null),this.searchableViewInternal.element.classList.add("console-searchable-view"),this.searchableViewInternal.setPlaceholder(Ce(fe.findStringInLogs)),this.searchableViewInternal.setMinimalSearchQuerySize(0),this.sidebar=new D,this.sidebar.addEventListener("FilterSelected",this.onFilterChanged.bind(this)),this.isSidebarOpen=!1,this.filter=new Ie(this.onFilterChanged.bind(this)),this.consoleToolbarContainer=this.element.createChild("div","console-toolbar-container"),this.splitWidget=new o.SplitWidget.SplitWidget(!0,!1,"console.sidebar.width",100),this.splitWidget.setMainWidget(this.searchableViewInternal),this.splitWidget.setSidebarWidget(this.sidebar),this.splitWidget.show(this.element),this.splitWidget.hideSidebar(),this.splitWidget.enableShowModeSaving(),this.isSidebarOpen=this.splitWidget.showMode()===o.SplitWidget.ShowMode.Both,this.filter.setLevelMenuOverridden(this.isSidebarOpen),this.splitWidget.addEventListener(o.SplitWidget.Events.ShowModeChanged,(e=>{this.isSidebarOpen=e.data===o.SplitWidget.ShowMode.Both,this.isSidebarOpen&&(this.userHasOpenedSidebarAtLeastOnce||(b.userMetrics.actionTaken(b.UserMetrics.Action.ConsoleSidebarOpened),this.userHasOpenedSidebarAtLeastOnce=!0),this.pendingSidebarMessages.forEach((e=>{this.sidebar.onMessageAdded(e)})),this.pendingSidebarMessages=[]),this.filter.setLevelMenuOverridden(this.isSidebarOpen),this.onFilterChanged()})),this.contentsElement=this.searchableViewInternal.element,this.element.classList.add("console-view"),this.visibleViewMessages=[],this.hiddenByFilterCount=0,this.shouldBeHiddenCache=new Set,this.groupableMessages=new Map,this.groupableMessageTitle=new Map,this.shortcuts=new Map,this.regexMatchRanges=[],this.consoleContextSelector=new E,this.filterStatusText=new o.Toolbar.ToolbarText,this.filterStatusText.element.classList.add("dimmed"),this.showSettingsPaneSetting=e.Settings.Settings.instance().createSetting("consoleShowSettingsToolbar",!1),this.showSettingsPaneButton=new o.Toolbar.ToolbarSettingToggle(this.showSettingsPaneSetting,"largeicon-settings-gear",Ce(fe.consoleSettings)),this.progressToolbarItem=new o.Toolbar.ToolbarItem(document.createElement("div")),this.groupSimilarSetting=e.Settings.Settings.instance().moduleSetting("consoleGroupSimilar"),this.groupSimilarSetting.addChangeListener((()=>this.updateMessageList()));const t=new o.Toolbar.ToolbarSettingCheckbox(this.groupSimilarSetting,Ce(fe.groupSimilarMessagesInConsole));this.showCorsErrorsSetting=e.Settings.Settings.instance().moduleSetting("consoleShowsCorsErrors"),this.showCorsErrorsSetting.addChangeListener((()=>{b.userMetrics.showCorsErrorsSettingChanged(this.showCorsErrorsSetting.get()),this.updateMessageList()}));const s=new o.Toolbar.ToolbarSettingCheckbox(this.showCorsErrorsSetting,Ce(fe.showCorsErrorsInConsole)),n=new o.Toolbar.Toolbar("console-main-toolbar",this.consoleToolbarContainer);n.makeWrappable(!0);const r=new o.Toolbar.Toolbar("",this.consoleToolbarContainer);n.appendToolbarItem(this.splitWidget.createShowHideSidebarButton(Ce(fe.showConsoleSidebar),Ce(fe.hideConsoleSidebar))),n.appendToolbarItem(o.Toolbar.Toolbar.createActionButton(o.ActionRegistry.ActionRegistry.instance().action("console.clear"))),n.appendSeparator(),n.appendToolbarItem(this.consoleContextSelector.toolbarItem()),n.appendSeparator();const l=o.Toolbar.Toolbar.createActionButton(o.ActionRegistry.ActionRegistry.instance().action("console.create-pin"));n.appendToolbarItem(l),n.appendSeparator(),n.appendToolbarItem(this.filter.textFilterUI),n.appendToolbarItem(this.filter.levelMenuButton),n.appendToolbarItem(this.progressToolbarItem),n.appendSeparator(),this.issueCounter=new p.IssueCounter.IssueCounter,this.issueCounter.id="console-issues-counter";const a=new o.Toolbar.ToolbarItem(this.issueCounter);this.issueCounter.data={clickHandler:()=>{b.userMetrics.issuesPanelOpenedFrom(b.UserMetrics.IssueOpener.StatusBarIssuesCounter),o.ViewManager.ViewManager.instance().showView("issues-pane")},issuesManager:C.IssuesManager.IssuesManager.instance(),accessibleName:Ce(fe.issueToolbarTooltipGeneral),displayMode:"OmitEmpty"},n.appendToolbarItem(a),r.appendSeparator(),r.appendToolbarItem(this.filterStatusText),r.appendToolbarItem(this.showSettingsPaneButton),this.preserveLogCheckbox=new o.Toolbar.ToolbarSettingCheckbox(e.Settings.Settings.instance().moduleSetting("preserveConsoleLog"),Ce(fe.doNotClearLogOnPageReload),Ce(fe.preserveLog)),this.hideNetworkMessagesCheckbox=new o.Toolbar.ToolbarSettingCheckbox(this.filter.hideNetworkMessagesSetting,this.filter.hideNetworkMessagesSetting.title(),Ce(fe.hideNetwork));const h=new o.Toolbar.ToolbarSettingCheckbox(this.filter.filterByExecutionContextSetting,Ce(fe.onlyShowMessagesFromTheCurrentContext),Ce(fe.selectedContextOnly)),d=e.Settings.Settings.instance().moduleSetting("monitoringXHREnabled");this.timestampsSetting=e.Settings.Settings.instance().moduleSetting("consoleTimestampsEnabled"),this.consoleHistoryAutocompleteSetting=e.Settings.Settings.instance().moduleSetting("consoleHistoryAutocomplete");const u=new o.Widget.HBox;u.show(this.contentsElement),u.element.classList.add("console-settings-pane"),o.ARIAUtils.setAccessibleName(u.element,Ce(fe.consoleSettings)),o.ARIAUtils.markAsGroup(u.element);const m=new o.Toolbar.Toolbar("",u.element);m.makeVertical(),m.appendToolbarItem(this.hideNetworkMessagesCheckbox),m.appendToolbarItem(this.preserveLogCheckbox),m.appendToolbarItem(h),m.appendToolbarItem(t),m.appendToolbarItem(s);const g=new o.Toolbar.Toolbar("",u.element);g.makeVertical(),g.appendToolbarItem(new o.Toolbar.ToolbarSettingCheckbox(d));const v=new o.Toolbar.ToolbarSettingCheckbox(e.Settings.Settings.instance().moduleSetting("consoleEagerEval"),Ce(fe.eagerlyEvaluateTextInThePrompt));g.appendToolbarItem(v),g.appendToolbarItem(new o.Toolbar.ToolbarSettingCheckbox(this.consoleHistoryAutocompleteSetting));const f=new o.Toolbar.ToolbarSettingCheckbox(e.Settings.Settings.instance().moduleSetting("consoleUserActivationEval"));g.appendToolbarItem(f),this.showSettingsPaneSetting.get()||u.element.classList.add("hidden"),this.showSettingsPaneSetting.addChangeListener((()=>u.element.classList.toggle("hidden",!this.showSettingsPaneSetting.get()))),this.pinPane=new H(l,(()=>this.prompt.focus())),this.pinPane.element.classList.add("console-view-pinpane"),this.pinPane.show(this.contentsElement),this.viewport=new $(this),this.viewport.setStickToBottom(!0),this.viewport.contentElement().classList.add("console-group","console-group-messages"),this.contentsElement.appendChild(this.viewport.element),this.messagesElement=this.viewport.element,this.messagesElement.id="console-messages",this.messagesElement.classList.add("monospace"),this.messagesElement.addEventListener("click",this.messagesClicked.bind(this),!1),this.messagesElement.addEventListener("paste",this.messagesPasted.bind(this),!0),this.messagesElement.addEventListener("clipboard-paste",this.messagesPasted.bind(this),!0),this.messagesCountElement=this.consoleToolbarContainer.createChild("div","message-count"),o.ARIAUtils.markAsPoliteLiveRegion(this.messagesCountElement,!1),this.viewportThrottler=new e.Throttler.Throttler(50),this.pendingBatchResize=!1,this.onMessageResizedBound=e=>{this.onMessageResized(e)},this.topGroup=Ee.createTopGroup(),this.currentGroup=this.topGroup,this.promptElement=this.messagesElement.createChild("div","source-code"),this.promptElement.id="console-prompt";const x=this.messagesElement.createChild("div","console-view-fix-select-all");x.textContent=".",o.ARIAUtils.markAsHidden(x),this.registerShortcuts(),this.messagesElement.addEventListener("contextmenu",this.handleContextMenuEvent.bind(this),!1);const w=new e.Throttler.Throttler(100);this.linkifier=new c.Linkifier.Linkifier(40,void 0,(()=>w.schedule((async()=>this.onFilterChanged())))),this.consoleMessages=[],this.viewMessageSymbol=Symbol("viewMessage"),this.consoleHistorySetting=e.Settings.Settings.instance().createLocalSetting("consoleHistory",[]),this.prompt=new Ge,this.prompt.show(this.promptElement),this.prompt.element.addEventListener("keydown",this.promptKeyDown.bind(this),!0),this.prompt.addEventListener("TextChanged",this.promptTextChanged,this),this.messagesElement.addEventListener("keydown",this.messagesKeyDown.bind(this),!1),this.prompt.element.addEventListener("focusin",(()=>{this.isScrolledToBottom()&&this.viewport.setStickToBottom(!0)})),this.consoleHistoryAutocompleteSetting.addChangeListener(this.consoleHistoryAutocompleteChanged,this);const S=this.consoleHistorySetting.get();this.prompt.history().setHistoryData(S),this.consoleHistoryAutocompleteChanged(),this.updateFilterStatus(),this.timestampsSetting.addChangeListener(this.consoleTimestampsSettingChanged,this),this.registerWithMessageSink(),o.Context.Context.instance().addFlavorChangeListener(i.RuntimeModel.ExecutionContext,this.executionContextChanged,this),this.messagesElement.addEventListener("mousedown",(e=>this.updateStickToBottomOnPointerDown(2===e.button)),!1),this.messagesElement.addEventListener("mouseup",this.updateStickToBottomOnPointerUp.bind(this),!1),this.messagesElement.addEventListener("mouseleave",this.updateStickToBottomOnPointerUp.bind(this),!1),this.messagesElement.addEventListener("wheel",this.updateStickToBottomOnWheel.bind(this),!1),this.messagesElement.addEventListener("touchstart",this.updateStickToBottomOnPointerDown.bind(this,!1),!1),this.messagesElement.addEventListener("touchend",this.updateStickToBottomOnPointerUp.bind(this),!1),this.messagesElement.addEventListener("touchcancel",this.updateStickToBottomOnPointerUp.bind(this),!1),i.ConsoleModel.ConsoleModel.instance().addEventListener(i.ConsoleModel.Events.ConsoleCleared,this.consoleCleared,this),i.ConsoleModel.ConsoleModel.instance().addEventListener(i.ConsoleModel.Events.MessageAdded,this.onConsoleMessageAdded,this),i.ConsoleModel.ConsoleModel.instance().addEventListener(i.ConsoleModel.Events.MessageUpdated,this.onConsoleMessageUpdated,this),i.ConsoleModel.ConsoleModel.instance().addEventListener(i.ConsoleModel.Events.CommandEvaluated,this.commandEvaluated,this),i.ConsoleModel.ConsoleModel.instance().messages().forEach(this.addConsoleMessage,this);const I=C.IssuesManager.IssuesManager.instance();this.issueToolbarThrottle=new e.Throttler.Throttler(100),I.addEventListener("IssuesCountUpdated",(()=>this.issueToolbarThrottle.schedule((async()=>this.updateIssuesToolbarItem()))),this)}static instance(){return xe||(xe=new we),xe}static clearConsole(){i.ConsoleModel.ConsoleModel.instance().requestClearMessages()}onFilterChanged(){if(this.filter.currentFilter.levelsMask=this.isSidebarOpen?y.allLevelsFilterValue():this.filter.messageLevelFiltersSetting.get(),this.cancelBuildHiddenCache(),this.immediatelyFilterMessagesForTest){for(const e of this.consoleMessages)this.computeShouldMessageBeVisible(e);this.updateMessageList()}else this.buildHiddenCache(0,this.consoleMessages.slice())}setImmediatelyFilterMessagesForTest(){this.immediatelyFilterMessagesForTest=!0}searchableView(){return this.searchableViewInternal}clearHistory(){this.consoleHistorySetting.set([]),this.prompt.history().setHistoryData([])}consoleHistoryAutocompleteChanged(){this.prompt.setAddCompletionsFromHistory(this.consoleHistoryAutocompleteSetting.get())}itemCount(){return this.visibleViewMessages.length}itemElement(e){return this.visibleViewMessages[e]}fastHeight(e){return this.visibleViewMessages[e].fastHeight()}minimumRowHeight(){return 16}registerWithMessageSink(){e.Console.Console.instance().messages().forEach(this.addSinkMessage,this),e.Console.Console.instance().addEventListener(e.Console.Events.MessageAdded,(({data:e})=>{this.addSinkMessage(e)}),this)}addSinkMessage(t){let s="verbose";switch(t.level){case e.Console.MessageLevel.Info:s="info";break;case e.Console.MessageLevel.Error:s="error";break;case e.Console.MessageLevel.Warning:s="warning"}const o=new i.ConsoleModel.ConsoleMessage(null,"other",s,t.text,{type:i.ConsoleModel.FrontendMessageType.System,timestamp:t.timestamp});this.addConsoleMessage(o)}consoleTimestampsSettingChanged(){this.updateMessageList(),this.consoleMessages.forEach((e=>e.updateTimestamp())),this.groupableMessageTitle.forEach((e=>e.updateTimestamp()))}executionContextChanged(){this.prompt.clearAutocomplete()}willHide(){this.hidePromptSuggestBox()}wasShown(){super.wasShown(),this.updateIssuesToolbarItem(),this.viewport.refresh(),this.registerCSSFiles([X,L,m.Style.default])}focus(){this.viewport.hasVirtualSelection()?this.viewport.contentElement().focus():this.focusPrompt()}focusPrompt(){if(!this.prompt.hasFocus()){const e=this.viewport.stickToBottom(),t=this.viewport.element.scrollTop;this.prompt.focus(),this.viewport.setStickToBottom(e),this.viewport.element.scrollTop=t}}restoreScrollPositions(){this.viewport.stickToBottom()?this.immediatelyScrollToBottom():super.restoreScrollPositions()}onResize(){this.scheduleViewportRefresh(),this.hidePromptSuggestBox(),this.viewport.stickToBottom()&&this.immediatelyScrollToBottom();for(let e=0;e0?this.consoleMessages.length:s.ArrayUtilities.upperBound(this.consoleMessages,t,a);const n=o12));++i);i!==t.length?this.buildHiddenCacheTimeout=this.element.window().requestAnimationFrame(this.buildHiddenCache.bind(this,i,t)):this.updateMessageList()}cancelBuildHiddenCache(){this.shouldBeHiddenCache.clear(),this.buildHiddenCacheTimeout&&(this.element.window().cancelAnimationFrame(this.buildHiddenCacheTimeout),delete this.buildHiddenCacheTimeout)}updateMessageList(){this.topGroup=Ee.createTopGroup(),this.currentGroup=this.topGroup,this.regexMatchRanges=[],this.hiddenByFilterCount=0;for(const e of this.visibleViewMessages)e.resetCloseGroupDecorationCount(),e.resetIncrementRepeatCount();if(this.visibleViewMessages=[],this.groupSimilarSetting.get())this.addGroupableMessagesToEnd();else for(const e of this.consoleMessages)e.setInSimilarGroup(!1),this.appendMessageToEnd(e,!0);this.updateFilterStatus(),this.searchableViewInternal.updateSearchMatchesCount(this.regexMatchRanges.length),this.viewport.invalidate(),this.messagesCountElement.setAttribute("aria-label",Ce(fe.filteredMessagesInConsole,{PH1:this.visibleViewMessages.length}))}addGroupableMessagesToEnd(){const e=new Set,t=new Set;for(const o of this.consoleMessages){const n=o.consoleMessage();if(e.has(n))continue;if(!n.isGroupable()){this.appendMessageToEnd(o),e.add(n);continue}const r=o.groupKey(),l=this.groupableMessages.get(r);if(!l||l.length<5){o.setInSimilarGroup(!1),this.appendMessageToEnd(o),e.add(n);continue}if(t.has(r))continue;if(!l.find((e=>this.shouldMessageBeVisible(e)))){s.SetUtilities.addAll(e,l),t.add(r);continue}let a=this.groupableMessageTitle.get(r);if(!a){const e=new i.ConsoleModel.ConsoleMessage(null,n.source,n.level,o.groupTitle(),{type:"startGroupCollapsed"});a=this.createViewMessage(e),this.groupableMessageTitle.set(r,a)}a.setRepeatCount(l.length),this.appendMessageToEnd(a);for(const t of l)t.setInSimilarGroup(!0,l[l.length-1]===t),this.appendMessageToEnd(t,!0),e.add(t.consoleMessage());const c=new i.ConsoleModel.ConsoleMessage(null,n.source,n.level,n.messageText,{type:"endGroup"});this.appendMessageToEnd(this.createViewMessage(c))}}messagesClicked(e){const t=e.target;if(!this.messagesElement.hasSelection()){(t===this.messagesElement||this.prompt.belowEditorElement().isSelfOrAncestor(t))&&(this.prompt.moveCaretToEndOfPrompt(),this.focusPrompt())}}messagesKeyDown(e){const t=e;t.ctrlKey||t.altKey||t.metaKey||1!==t.key.length||o.UIUtils.isEditing()||this.messagesElement.hasSelection()||(this.prompt.moveCaretToEndOfPrompt(),this.focusPrompt())}messagesPasted(e){o.UIUtils.isEditing()||this.prompt.focus()}registerShortcuts(){this.shortcuts.set(o.KeyboardShortcut.KeyboardShortcut.makeKey("u",o.KeyboardShortcut.Modifiers.Ctrl),this.clearPromptBackwards.bind(this))}clearPromptBackwards(){this.prompt.clear()}promptKeyDown(e){const t=e;if("PageUp"===t.key)return void this.updateStickToBottomOnWheel();const s=o.KeyboardShortcut.KeyboardShortcut.makeKeyFromEvent(t),i=this.shortcuts.get(s);i&&(i(),t.preventDefault())}printResult(e,t,s){if(!e)return;const o=Boolean(s)?"error":"info";let n;n=s?i.ConsoleModel.ConsoleMessage.fromException(e.runtimeModel(),s,i.ConsoleModel.FrontendMessageType.Result,void 0,void 0):new i.ConsoleModel.ConsoleMessage(e.runtimeModel(),"javascript",o,"",{type:i.ConsoleModel.FrontendMessageType.Result,parameters:[e]}),n.setOriginatingMessage(t),i.ConsoleModel.ConsoleModel.instance().addMessage(n)}commandEvaluated(e){const{data:t}=e;this.prompt.history().pushHistoryItem(t.commandMessage.messageText),this.consoleHistorySetting.set(this.prompt.history().historyData().slice(-Se)),this.printResult(t.result,t.commandMessage,t.exceptionDetails)}elementsToRestoreScrollPositionsFor(){return[this.messagesElement]}searchCanceled(){this.cleanupAfterSearch();for(const e of this.visibleViewMessages)e.setSearchRegex(null);this.currentMatchRangeIndex=-1,this.regexMatchRanges=[],this.searchRegex=null,this.viewport.refresh()}performSearch(e,t,s){this.searchCanceled(),this.searchableViewInternal.updateSearchMatchesCount(0),this.searchRegex=e.toSearchRegex(!0),this.regexMatchRanges=[],this.currentMatchRangeIndex=-1,t&&(this.searchShouldJumpBackwards=Boolean(s)),this.searchProgressIndicator=new o.ProgressIndicator.ProgressIndicator,this.searchProgressIndicator.setTitle(Ce(fe.searching)),this.searchProgressIndicator.setTotalWork(this.visibleViewMessages.length),this.progressToolbarItem.element.appendChild(this.searchProgressIndicator.element),this.innerSearch(0)}cleanupAfterSearch(){delete this.searchShouldJumpBackwards,this.innerSearchTimeoutId&&(clearTimeout(this.innerSearchTimeoutId),delete this.innerSearchTimeoutId),this.searchProgressIndicator&&(this.searchProgressIndicator.done(),delete this.searchProgressIndicator)}searchFinishedForTests(){}innerSearch(e){if(delete this.innerSearchTimeoutId,this.searchProgressIndicator&&this.searchProgressIndicator.isCanceled())return void this.cleanupAfterSearch();const t=Date.now();for(;e=0){t=this.regexMatchRanges[this.currentMatchRangeIndex];this.visibleViewMessages[t.messageIndex].searchHighlightNode(t.matchIndex).classList.remove(o.UIUtils.highlightedCurrentSearchResultClassName)}e=s.NumberUtilities.mod(e,this.regexMatchRanges.length),this.currentMatchRangeIndex=e,this.searchableViewInternal.updateCurrentMatchIndex(e),t=this.regexMatchRanges[e];const i=this.visibleViewMessages[t.messageIndex].searchHighlightNode(t.matchIndex);i.classList.add(o.UIUtils.highlightedCurrentSearchResultClassName),this.viewport.scrollItemIntoView(t.messageIndex),i.scrollIntoViewIfNeeded()}updateStickToBottomOnPointerDown(e){this.muteViewportUpdates=!e,this.viewport.setStickToBottom(!1),this.waitForScrollTimeout&&(clearTimeout(this.waitForScrollTimeout),delete this.waitForScrollTimeout)}updateStickToBottomOnPointerUp(){this.muteViewportUpdates&&(this.waitForScrollTimeout=window.setTimeout(function(){this.muteViewportUpdates=!1,this.isShowing()&&this.viewport.setStickToBottom(this.isScrolledToBottom());this.maybeDirtyWhileMuted&&(this.scheduleViewportRefresh(),delete this.maybeDirtyWhileMuted);delete this.waitForScrollTimeout,this.updateViewportStickinessForTest()}.bind(this),200))}updateViewportStickinessForTest(){}updateStickToBottomOnWheel(){this.updateStickToBottomOnPointerDown(),this.updateStickToBottomOnPointerUp()}promptTextChanged(){const e=this.viewport.stickToBottom(),t=this.isScrolledToBottom();this.viewport.setStickToBottom(t),t&&!e&&this.scheduleViewportRefresh(),this.promptTextChangedForTest()}promptTextChangedForTest(){}isScrolledToBottom(){return this.messagesElement.scrollHeight-this.messagesElement.scrollTop-this.messagesElement.clientHeight-this.prompt.belowEditorElement().offsetHeight<=2}}globalThis.Console=globalThis.Console||{},globalThis.Console.ConsoleView=we;const Se=300;class Ie{filterChanged;messageLevelFiltersSetting;hideNetworkMessagesSetting;filterByExecutionContextSetting;suggestionBuilder;textFilterUI;textFilterSetting;filterParser;currentFilter;levelLabels;levelMenuButton;constructor(t){this.filterChanged=t,this.messageLevelFiltersSetting=Ie.levelFilterSetting(),this.hideNetworkMessagesSetting=e.Settings.Settings.instance().moduleSetting("hideNetworkMessages"),this.filterByExecutionContextSetting=e.Settings.Settings.instance().moduleSetting("selectedContextFilterEnabled"),this.messageLevelFiltersSetting.addChangeListener(this.onFilterChanged.bind(this)),this.hideNetworkMessagesSetting.addChangeListener(this.onFilterChanged.bind(this)),this.filterByExecutionContextSetting.addChangeListener(this.onFilterChanged.bind(this)),o.Context.Context.instance().addFlavorChangeListener(i.RuntimeModel.ExecutionContext,this.onFilterChanged,this);const s=Object.values(M);this.suggestionBuilder=new o.FilterSuggestionBuilder.FilterSuggestionBuilder(s),this.textFilterUI=new o.Toolbar.ToolbarInput(Ce(fe.filter),"",1,1,Ce(fe.egEventdCdnUrlacom),this.suggestionBuilder.completions.bind(this.suggestionBuilder),!0),this.textFilterSetting=e.Settings.Settings.instance().createSetting("console.textFilter",""),this.textFilterSetting.get()&&this.textFilterUI.setValue(this.textFilterSetting.get()),this.textFilterUI.addEventListener(o.Toolbar.ToolbarInput.Event.TextChanged,(()=>{this.textFilterSetting.set(this.textFilterUI.value()),this.onFilterChanged()})),this.filterParser=new n.TextUtils.FilterParser(s),this.currentFilter=new y("",[],null,this.messageLevelFiltersSetting.get()),this.updateCurrentFilter(),this.levelLabels=new Map([["verbose",Ce(fe.verbose)],["info",Ce(fe.info)],["warning",Ce(fe.warnings)],["error",Ce(fe.errors)]]),this.levelMenuButton=new o.Toolbar.ToolbarButton(Ce(fe.logLevels)),this.levelMenuButton.turnIntoSelect(),this.levelMenuButton.addEventListener(o.Toolbar.ToolbarButton.Events.Click,this.showLevelContextMenu.bind(this)),o.ARIAUtils.markAsMenuButton(this.levelMenuButton.element),this.updateLevelMenuButtonText(),this.messageLevelFiltersSetting.addChangeListener(this.updateLevelMenuButtonText.bind(this))}onMessageAdded(e){e.type===i.ConsoleModel.FrontendMessageType.Command||e.type===i.ConsoleModel.FrontendMessageType.Result||e.isGroupMessage()||(e.context&&this.suggestionBuilder.addItem(M.Context,e.context),e.source&&this.suggestionBuilder.addItem(M.Source,e.source),e.url&&this.suggestionBuilder.addItem(M.Url,e.url))}setLevelMenuOverridden(e){this.levelMenuButton.setEnabled(!e),e?this.levelMenuButton.setTitle(Ce(fe.overriddenByFilterSidebar)):this.updateLevelMenuButtonText()}static levelFilterSetting(){return e.Settings.Settings.instance().createSetting("messageLevelFilters",y.defaultLevelsFilterValue())}updateCurrentFilter(){const e=this.filterParser.parse(this.textFilterUI.value());this.hideNetworkMessagesSetting.get()&&e.push({key:M.Source,text:"network",negative:!0,regex:void 0}),this.currentFilter.executionContext=this.filterByExecutionContextSetting.get()?o.Context.Context.instance().flavor(i.RuntimeModel.ExecutionContext):null,this.currentFilter.parsedFilters=e,this.currentFilter.levelsMask=this.messageLevelFiltersSetting.get()}onFilterChanged(){this.updateCurrentFilter(),this.filterChanged()}updateLevelMenuButtonText(){let e=!0,t=!0;const s=y.allLevelsFilterValue(),i=y.defaultLevelsFilterValue();let o=null;const n=this.messageLevelFiltersSetting.get(),r={Verbose:"verbose",Info:"info",Warning:"warning",Error:"error"};for(const l of Object.values(r))e=e&&n[l]===s[l],t=t&&n[l]===i[l],n[l]&&(o=o?Ce(fe.customLevels):Ce(fe.sOnly,{PH1:String(this.levelLabels.get(l))}));o=e?Ce(fe.allLevels):t?Ce(fe.defaultLevels):o||Ce(fe.hideAll),this.levelMenuButton.element.classList.toggle("warning",!e&&!t),this.levelMenuButton.setText(o),this.levelMenuButton.setTitle(Ce(fe.logLevelS,{PH1:o}))}showLevelContextMenu(e){const t=e.data,s=this.messageLevelFiltersSetting,i=s.get(),n=new o.ContextMenu.ContextMenu(t,{useSoftMenu:!0,x:this.levelMenuButton.element.totalOffsetLeft(),y:this.levelMenuButton.element.totalOffsetTop()+this.levelMenuButton.element.offsetHeight});n.headerSection().appendItem(Ce(fe.default),(()=>s.set(y.defaultLevelsFilterValue())));for(const[e,t]of this.levelLabels.entries())n.defaultSection().appendCheckboxItem(t,r.bind(null,e),i[e]);function r(e){i[e]=!i[e],s.set(i)}n.show()}addMessageURLFilter(e){if(!e)return;const t=this.textFilterUI.value()?` ${this.textFilterUI.value()}`:"";this.textFilterUI.setValue(`-url:${e}${t}`),this.textFilterSetting.set(this.textFilterUI.value()),this.onFilterChanged()}shouldBeVisible(e){return this.currentFilter.shouldBeVisible(e)}clear(){this.suggestionBuilder.clear()}reset(){this.messageLevelFiltersSetting.set(y.defaultLevelsFilterValue()),this.filterByExecutionContextSetting.set(!1),this.hideNetworkMessagesSetting.set(!1),this.textFilterUI.setValue(""),this.onFilterChanged()}}class Ee{parentGroupInternal;nestingLevelInternal;messagesHiddenInternal;constructor(e,t){this.parentGroupInternal=e,this.nestingLevelInternal=e?e.nestingLevel()+1:0,this.messagesHiddenInternal=t&&t.collapsed()||this.parentGroupInternal&&this.parentGroupInternal.messagesHidden()||!1}static createTopGroup(){return new Ee(null,null)}messagesHidden(){return this.messagesHiddenInternal}nestingLevel(){return this.nestingLevelInternal}parentGroup(){return this.parentGroupInternal}}let Me;class Te{handleAction(t,s){switch(s){case"console.show":return b.InspectorFrontendHost.InspectorFrontendHostInstance.bringToFront(),e.Console.Console.instance().show(),we.instance().focusPrompt(),!0;case"console.clear":return we.clearConsole(),!0;case"console.clear.history":return we.instance().clearHistory(),!0;case"console.create-pin":return we.instance().pinPane.addPin("",!0),!0}return!1}static instance(e={forceNew:null}){const{forceNew:t}=e;return Me&&!t||(Me=new Te),Me}}const ye=new WeakMap,ke=new WeakMap;var Le=Object.freeze({__proto__:null,ConsoleView:we,ConsoleViewFilter:Ie,ConsoleGroup:Ee,ActionDelegate:Te});let Fe;class Re extends o.Panel.Panel{view;constructor(){super("console"),this.view=we.instance()}static instance(e={forceNew:null}){const{forceNew:t}=e;return Fe&&!t||(Fe=new Re),Fe}static updateContextFlavor(){const e=Re.instance().view;o.Context.Context.instance().setFlavor(we,e.isShowing()?e:null)}wasShown(){super.wasShown();Ae&&Ae.isShowing()&&o.InspectorView.InspectorView.instance().setDrawerMinimized(!0),this.view.show(this.element),Re.updateContextFlavor()}willHide(){super.willHide(),o.InspectorView.InspectorView.instance().setDrawerMinimized(!1),Ae&&Ae.showViewInWrapper(),Re.updateContextFlavor()}searchableView(){return we.instance().searchableView()}}let Pe,Ae=null;class Be extends o.Widget.VBox{view;constructor(){super(),this.view=we.instance()}static instance(){return Ae||(Ae=new Be),Ae}wasShown(){Re.instance().isShowing()?o.InspectorView.InspectorView.instance().setDrawerMinimized(!0):this.showViewInWrapper(),Re.updateContextFlavor()}willHide(){o.InspectorView.InspectorView.instance().setDrawerMinimized(!1),Re.updateContextFlavor()}showViewInWrapper(){this.view.show(this.element)}}class He{static instance(e={forceNew:null}){const{forceNew:t}=e;return Pe&&!t||(Pe=new He),Pe}async reveal(e){const t=we.instance();t.isShowing()?t.focus():await o.ViewManager.ViewManager.instance().showView("console-view")}}var Oe=Object.freeze({__proto__:null,ConsolePanel:Re,WrapperView:Be,ConsoleRevealer:He});const Ue=new CSSStyleSheet;Ue.replaceSync("#console-prompt .CodeMirror{padding:3px 0 1px}#console-prompt .CodeMirror-line{padding-top:0}#console-prompt .CodeMirror-lines{padding-top:0}#console-prompt .console-prompt-icon{position:absolute;left:-13px;top:5px;user-select:none}.console-eager-preview{padding-bottom:2px;opacity:60%;position:relative;height:15px}.console-eager-inner-preview{text-overflow:ellipsis;overflow:hidden;margin-left:4px;height:100%;white-space:nowrap}.preview-result-icon{position:absolute;left:-13px;top:1px}.console-eager-inner-preview:empty,.console-eager-inner-preview:empty+.preview-result-icon{opacity:0%}.console-prompt-icon.console-prompt-incomplete{opacity:65%}\n/*# sourceURL=consolePrompt.css */\n");const Ve={consolePrompt:"Console prompt"},Ne=t.i18n.registerUIStrings("panels/console/ConsolePrompt.ts",Ve),je=t.i18n.getLocalizedString.bind(void 0,Ne);class Ge extends(e.ObjectWrapper.eventMixin(o.Widget.Widget)){addCompletionsFromHistory;historyInternal;initialText;editor;eagerPreviewElement;textChangeThrottler;formatter;requestPreviewBound;requestPreviewCurrent=0;innerPreviewElement;promptIcon;iconThrottler;eagerEvalSetting;previewRequestForTest;highlightingNode;constructor(){super(),this.addCompletionsFromHistory=!0,this.historyInternal=new De,this.initialText="",this.eagerPreviewElement=document.createElement("div"),this.eagerPreviewElement.classList.add("console-eager-preview"),this.textChangeThrottler=new e.Throttler.Throttler(150),this.formatter=new a.RemoteObjectPreviewFormatter.RemoteObjectPreviewFormatter,this.requestPreviewBound=this.requestPreview.bind(this),this.innerPreviewElement=this.eagerPreviewElement.createChild("div","console-eager-inner-preview"),this.eagerPreviewElement.appendChild(o.Icon.Icon.create("smallicon-command-result","preview-result-icon"));const t=this.element.createChild("div","console-prompt-editor-container");this.element.appendChild(this.eagerPreviewElement),this.promptIcon=o.Icon.Icon.create("smallicon-text-prompt","console-prompt-icon"),this.element.appendChild(this.promptIcon),this.iconThrottler=new e.Throttler.Throttler(0),this.eagerEvalSetting=e.Settings.Settings.instance().moduleSetting("consoleEagerEval"),this.eagerEvalSetting.addChangeListener(this.eagerSettingChanged.bind(this)),this.eagerPreviewElement.classList.toggle("hidden",!this.eagerEvalSetting.get()),this.element.tabIndex=0,this.previewRequestForTest=null,this.highlightingNode=!1;const s=r.EditorState.create({doc:this.initialText,extensions:[r.keymap.of(this.editorKeymap()),r.EditorView.updateListener.of((e=>this.editorUpdate(e))),l.JavaScript.argumentHints(),l.JavaScript.completion(),l.Config.showCompletionHint,r.javascript.javascript(),l.Config.baseConfiguration(this.initialText),l.Config.autocompletion,r.javascript.javascriptLanguage.data.of({autocomplete:e=>this.historyCompletions(e)}),r.EditorView.contentAttributes.of({"aria-label":je(Ve.consolePrompt)}),r.EditorView.lineWrapping,r.autocompletion({aboveCursor:!0})]});this.editor=new l.TextEditor.TextEditor(s),this.editor.addEventListener("keydown",(e=>{e.defaultPrevented&&e.stopPropagation()})),t.appendChild(this.editor),this.hasFocus()&&this.focus(),this.element.removeAttribute("tabindex"),this.editorSetForTest(),b.userMetrics.panelLoaded("console","DevTools.Launch.Console")}eagerSettingChanged(){const e=this.eagerEvalSetting.get();this.eagerPreviewElement.classList.toggle("hidden",!e),e&&this.requestPreview()}belowEditorElement(){return this.eagerPreviewElement}onTextChanged(){if(this.eagerEvalSetting.get()){const e=!l.Config.contentIncludingHint(this.editor.editor);this.previewRequestForTest=this.textChangeThrottler.schedule(this.requestPreviewBound,e)}this.updatePromptIcon(),this.dispatchEventToListeners("TextChanged")}async requestPreview(){const e=++this.requestPreviewCurrent,t=l.Config.contentIncludingHint(this.editor.editor).trim(),s=o.Context.Context.instance().flavor(i.RuntimeModel.ExecutionContext),{preview:n,result:r}=await a.JavaScriptREPL.JavaScriptREPL.evaluateAndBuildPreview(t,!0,!0,500);this.requestPreviewCurrent===e&&(this.innerPreviewElement.removeChildren(),n.deepTextContent()!==l.Config.contentIncludingHint(this.editor.editor).trim()&&this.innerPreviewElement.appendChild(n),r&&"object"in r&&r.object&&"node"===r.object.subtype?(this.highlightingNode=!0,i.OverlayModel.OverlayModel.highlightObjectAsDOMNode(r.object)):this.highlightingNode&&(this.highlightingNode=!1,i.OverlayModel.OverlayModel.hideDOMNodeHighlight()),r&&s&&s.runtimeModel.releaseEvaluationResult(r))}wasShown(){super.wasShown(),this.registerCSSFiles([Ue])}willHide(){this.highlightingNode&&(this.highlightingNode=!1,i.OverlayModel.OverlayModel.hideDOMNodeHighlight())}history(){return this.historyInternal}clearAutocomplete(){r.closeCompletion(this.editor.editor)}isCaretAtEndOfPrompt(){return this.editor.state.selection.main.head===this.editor.state.doc.length}moveCaretToEndOfPrompt(){this.editor.dispatch({selection:r.EditorSelection.cursor(this.editor.state.doc.length)})}clear(){this.editor.dispatch({changes:{from:0,to:this.editor.state.doc.length}})}text(){return this.editor.state.doc.toString()}setAddCompletionsFromHistory(e){this.addCompletionsFromHistory=e}editorKeymap(){return[{key:"ArrowUp",run:()=>this.moveHistory(-1)},{key:"ArrowDown",run:()=>this.moveHistory(1)},{mac:"Ctrl-p",run:()=>this.moveHistory(-1,!0)},{mac:"Ctrl-n",run:()=>this.moveHistory(1,!0)},{key:"Enter",run:()=>this.evaluate(),shift:r.insertNewlineAndIndent}]}moveHistory(e,t=!1){const{editor:s}=this.editor,{main:i}=s.state.selection;if(!t){if(!i.empty)return!1;const t=s.coordsAtPos(i.head),o=s.coordsAtPos(e<0?0:s.state.doc.length);if(t&&o&&(e<0?t.top>o.top+5:t.bottom0&&l.JavaScript.isExpressionComplete(e)}evaluate(){if(this.enterWillEvaluate())this.appendCommand(this.text(),!0),this.editor.dispatch({changes:{from:0,to:this.editor.state.doc.length},scrollIntoView:!0});else{if(this.editor.state.doc.length)return r.insertNewlineAndIndent(this.editor.editor);this.editor.dispatch({scrollIntoView:!0})}return this.enterProcessedForTest(),!0}updatePromptIcon(){this.iconThrottler.schedule((async()=>{this.promptIcon.classList.toggle("console-prompt-incomplete",!this.enterWillEvaluate())}))}appendCommand(e,t){const s=o.Context.Context.instance().flavor(i.RuntimeModel.ExecutionContext);if(s){const o=s,n=i.ConsoleModel.ConsoleModel.instance().addCommandMessage(o,e),r=a.JavaScriptREPL.JavaScriptREPL.preprocessExpression(e);i.ConsoleModel.ConsoleModel.instance().evaluateCommandInConsole(o,n,r,t),Re.instance().isShowing()&&b.userMetrics.actionTaken(b.UserMetrics.Action.CommandEvaluatedInConsolePanel)}}enterProcessedForTest(){}editorUpdate(e){e.docChanged||r.selectedCompletion(e.state)!==r.selectedCompletion(e.startState)?this.onTextChanged():e.selectionSet&&this.updatePromptIcon()}historyCompletions(e){const t=this.text();if(!this.addCompletionsFromHistory||!this.isCaretAtEndOfPrompt()||!t.length&&!e.explicit)return null;const s=[],i=new Set,o=this.historyInternal.historyData();for(let e=o.length-1;e>=0&&s.length<50;--e){const n=o[e];n.startsWith(t)&&(i.has(n)||(i.add(n),s.push({label:n,type:"secondary",boost:-1e5})))}return s.length?{from:0,to:t.length,options:s}:null}focus(){this.editor.focus()}editorSetForTest(){}}class De{data;historyOffset;uncommittedIsTop;constructor(){this.data=[],this.historyOffset=1}historyData(){return this.data}setHistoryData(e){this.data=e.slice(),this.historyOffset=1}pushHistoryItem(e){this.uncommittedIsTop&&(this.data.pop(),delete this.uncommittedIsTop),this.historyOffset=1,e!==this.currentHistoryItem()&&this.data.push(e)}pushCurrentText(e){this.uncommittedIsTop&&this.data.pop(),this.uncommittedIsTop=!0,this.data.push(e)}previous(e){if(!(this.historyOffset>this.data.length))return 1===this.historyOffset&&this.pushCurrentText(e),++this.historyOffset,this.currentHistoryItem()}next(){if(1!==this.historyOffset)return--this.historyOffset,this.currentHistoryItem()}currentHistoryItem(){return this.data[this.data.length-this.historyOffset]}}var We=Object.freeze({__proto__:null,ConsolePrompt:Ge,ConsoleHistoryManager:De});export{T as ConsoleContextSelector,k as ConsoleFilter,Oe as ConsolePanel,U as ConsolePinPane,We as ConsolePrompt,K as ConsoleSidebar,Le as ConsoleView,ve as ConsoleViewMessage,J as ConsoleViewport};
diff --git a/chii/panels/console_counters/console_counters-meta.js b/chii/panels/console_counters/console_counters-meta.js
new file mode 100644
index 00000000..c5e70ea8
--- /dev/null
+++ b/chii/panels/console_counters/console_counters-meta.js
@@ -0,0 +1 @@
+import*as o from"../../ui/legacy/legacy.js";let r;o.Toolbar.registerToolbarItem({loadItem:async()=>(await async function(){return r||(r=await import("./console_counters.js")),r}()).WarningErrorCounter.WarningErrorCounter.instance(),order:1,location:o.Toolbar.ToolbarItemLocation.MAIN_TOOLBAR_RIGHT,showLabel:void 0,condition:void 0,separator:void 0,actionId:void 0});
diff --git a/chii/panels/console_counters/console_counters.js b/chii/panels/console_counters/console_counters.js
new file mode 100644
index 00000000..c5f8ad59
--- /dev/null
+++ b/chii/panels/console_counters/console_counters.js
@@ -0,0 +1 @@
+import*as e from"../../core/common/common.js";import*as s from"../../core/host/host.js";import*as t from"../../core/i18n/i18n.js";import*as o from"../../core/sdk/sdk.js";import*as n from"../../models/issues_manager/issues_manager.js";import*as r from"../../ui/components/icon_button/icon_button.js";import*as i from"../../ui/components/issue_counter/issue_counter.js";import*as a from"../../ui/legacy/legacy.js";const l={sErrors:"{n, plural, =1 {# error} other {# errors}}",sWarnings:"{n, plural, =1 {# warning} other {# warnings}}",openConsoleToViewS:"Open Console to view {PH1}",openIssuesToView:"{n, plural, =1 {Open Issues to view # issue:} other {Open Issues to view # issues:}}"},u=t.i18n.registerUIStrings("panels/console_counters/WarningErrorCounter.ts",l),c=t.i18n.getLocalizedString.bind(void 0,u);let d;class p{toolbarItem;consoleCounter;issueCounter;throttler;updatingForTest;constructor(){p.instanceForTest=this;const t=document.createElement("div");this.toolbarItem=new a.Toolbar.ToolbarItemWithCompactLayout(t),this.toolbarItem.setVisible(!1),this.toolbarItem.addEventListener("CompactLayoutUpdated",this.onSetCompactLayout,this),this.consoleCounter=new r.IconButton.IconButton,t.appendChild(this.consoleCounter),this.consoleCounter.data={clickHandler:e.Console.Console.instance().show.bind(e.Console.Console.instance()),groups:[{iconName:"error_icon"},{iconName:"warning_icon"}]};const l=n.IssuesManager.IssuesManager.instance();this.issueCounter=new i.IssueCounter.IssueCounter,t.appendChild(this.issueCounter),this.issueCounter.data={clickHandler:()=>{s.userMetrics.issuesPanelOpenedFrom(s.UserMetrics.IssueOpener.StatusBarIssuesCounter),a.ViewManager.ViewManager.instance().showView("issues-pane")},issuesManager:l,displayMode:"OnlyMostImportant"},this.throttler=new e.Throttler.Throttler(100),o.ConsoleModel.ConsoleModel.instance().addEventListener(o.ConsoleModel.Events.ConsoleCleared,this.update,this),o.ConsoleModel.ConsoleModel.instance().addEventListener(o.ConsoleModel.Events.MessageAdded,this.update,this),o.ConsoleModel.ConsoleModel.instance().addEventListener(o.ConsoleModel.Events.MessageUpdated,this.update,this),l.addEventListener("IssuesCountUpdated",this.update,this),this.update()}onSetCompactLayout(e){this.setCompactLayout(e.data)}setCompactLayout(e){this.consoleCounter.data={...this.consoleCounter.data,compact:e},this.issueCounter.data={...this.issueCounter.data,compact:e}}static instance(e={forceNew:null}){const{forceNew:s}=e;return d&&!s||(d=new p),d}updatedForTest(){}update(){this.updatingForTest=!0,this.throttler.schedule(this.updateThrottled.bind(this))}get titlesForTesting(){const e=this.consoleCounter.shadowRoot?.querySelector("button");return e?e.getAttribute("aria-label"):null}async updateThrottled(){const e=o.ConsoleModel.ConsoleModel.instance().errors(),s=o.ConsoleModel.ConsoleModel.instance().warnings(),t=n.IssuesManager.IssuesManager.instance(),r=t.numberOfIssues(),u=e=>0===e?void 0:`${e}`,d=c(l.sErrors,{n:e}),p=c(l.sWarnings,{n:s}),h=[u(e),u(s)];let C="";e&&s?C=`${d}, ${p}`:e?C=d:s&&(C=p);const m=c(l.openConsoleToViewS,{PH1:C}),g=this.consoleCounter.data;this.consoleCounter.data={...g,groups:g.groups.map(((e,s)=>({...e,text:h[s]}))),accessibleName:m},a.Tooltip.Tooltip.install(this.consoleCounter,m),this.consoleCounter.classList.toggle("hidden",!(e||s));const I=i.IssueCounter.getIssueCountsEnumeration(t),w=`${c(l.openIssuesToView,{n:r})} ${I}`;a.Tooltip.Tooltip.install(this.issueCounter,w),this.issueCounter.data={...this.issueCounter.data,accessibleName:w},this.issueCounter.classList.toggle("hidden",!r),this.toolbarItem.setVisible(Boolean(e||s||r)),a.InspectorView.InspectorView.instance().toolbarItemResized(),this.updatingForTest=!1,this.updatedForTest()}item(){return this.toolbarItem}static instanceForTest=null}var h=Object.freeze({__proto__:null,WarningErrorCounter:p});export{h as WarningErrorCounter};
diff --git a/chii/panels/coverage/coverage-legacy.js b/chii/panels/coverage/coverage-legacy.js
new file mode 100644
index 00000000..2da6598b
--- /dev/null
+++ b/chii/panels/coverage/coverage-legacy.js
@@ -0,0 +1 @@
+import*as e from"./coverage.js";self.Coverage=self.Coverage||{},Coverage=Coverage||{},Coverage.CoverageDecorationManager=e.CoverageDecorationManager.CoverageDecorationManager,Coverage.CoverageListView=e.CoverageListView.CoverageListView,Coverage.CoverageModel=e.CoverageModel.CoverageModel,Coverage.CoverageModel.Events=e.CoverageModel.Events,Coverage.CoverageType=e.CoverageModel.CoverageType,Coverage.coverageTypeToString=e.CoverageListView.coverageTypeToString,Coverage.URLCoverageInfo=e.CoverageModel.URLCoverageInfo,Coverage.URLCoverageInfo.Events=e.CoverageModel.URLCoverageInfo.Events,Coverage.CoverageInfo=e.CoverageModel.CoverageInfo,Coverage.CoverageView=e.CoverageView.CoverageView,Coverage.CoverageView.LineDecorator=e.CoverageView.LineDecorator,Coverage.CoverageView.ActionDelegate=e.CoverageView.ActionDelegate;
diff --git a/chii/panels/coverage/coverage-meta.js b/chii/panels/coverage/coverage-meta.js
new file mode 100644
index 00000000..1b0c8f1f
--- /dev/null
+++ b/chii/panels/coverage/coverage-meta.js
@@ -0,0 +1 @@
+import*as e from"../../core/i18n/i18n.js";import*as t from"../../ui/legacy/legacy.js";const o={coverage:"Coverage",showCoverage:"Show Coverage",instrumentCoverage:"Instrument coverage",stopInstrumentingCoverageAndShow:"Stop instrumenting coverage and show results",startInstrumentingCoverageAnd:"Start instrumenting coverage and reload page"},a=e.i18n.registerUIStrings("panels/coverage/coverage-meta.ts",o),n=e.i18n.getLazilyComputedLocalizedString.bind(void 0,a);let i;async function r(){return i||(i=await import("./coverage.js")),i}t.ViewManager.registerViewExtension({location:"drawer-view",id:"coverage",title:n(o.coverage),commandPrompt:n(o.showCoverage),persistence:"closeable",order:100,loadView:async()=>(await r()).CoverageView.CoverageView.instance()}),t.ActionRegistration.registerActionExtension({actionId:"coverage.toggle-recording",iconClass:"largeicon-start-recording",toggleable:!0,toggledIconClass:"largeicon-stop-recording",toggleWithRedColor:!0,loadActionDelegate:async()=>(await r()).CoverageView.ActionDelegate.instance(),category:t.ActionRegistration.ActionCategory.PERFORMANCE,options:[{value:!0,title:n(o.instrumentCoverage)},{value:!1,title:n(o.stopInstrumentingCoverageAndShow)}]}),t.ActionRegistration.registerActionExtension({actionId:"coverage.start-with-reload",iconClass:"largeicon-refresh",loadActionDelegate:async()=>(await r()).CoverageView.ActionDelegate.instance(),category:t.ActionRegistration.ActionCategory.PERFORMANCE,title:n(o.startInstrumentingCoverageAnd)});
diff --git a/chii/panels/coverage/coverage.js b/chii/panels/coverage/coverage.js
new file mode 100644
index 00000000..7cef7ee2
--- /dev/null
+++ b/chii/panels/coverage/coverage.js
@@ -0,0 +1 @@
+import*as e from"../../core/common/common.js";import*as t from"../../core/platform/platform.js";import*as o from"../../core/sdk/sdk.js";import*as s from"../../models/text_utils/text_utils.js";import*as i from"../../core/i18n/i18n.js";import*as r from"../../models/formatter/formatter.js";import*as n from"../../models/workspace/workspace.js";import*as a from"../../ui/legacy/components/data_grid/data_grid.js";import*as l from"../../ui/legacy/legacy.js";import*as c from"../../core/host/host.js";import*as d from"../../models/bindings/bindings.js";var h;!function(e){e.CoverageUpdated="CoverageUpdated",e.CoverageReset="CoverageReset"}(h||(h={}));class g extends o.SDKModel.SDKModel{cpuProfilerModel;cssModel;debuggerModel;coverageByURL;coverageByContentProvider;coverageUpdateTimes;suspensionState;pollTimer;currentPollPromise;shouldResumePollingOnResume;jsBacklog;cssBacklog;performanceTraceRecording;constructor(e){super(e),this.cpuProfilerModel=e.model(o.CPUProfilerModel.CPUProfilerModel),this.cssModel=e.model(o.CSSModel.CSSModel),this.debuggerModel=e.model(o.DebuggerModel.DebuggerModel),this.coverageByURL=new Map,this.coverageByContentProvider=new Map,this.coverageUpdateTimes=new Set,this.suspensionState="Active",this.pollTimer=null,this.currentPollPromise=null,this.shouldResumePollingOnResume=!1,this.jsBacklog=[],this.cssBacklog=[],this.performanceTraceRecording=!1}async start(e){if("Active"!==this.suspensionState)throw Error("Cannot start CoverageModel while it is not active.");const t=[];return this.cssModel&&(this.clearCSS(),this.cssModel.addEventListener(o.CSSModel.Events.StyleSheetAdded,this.handleStyleSheetAdded,this),t.push(this.cssModel.startCoverage())),this.cpuProfilerModel&&t.push(this.cpuProfilerModel.startPreciseCoverage(e,this.preciseCoverageDeltaUpdate.bind(this))),await Promise.all(t),Boolean(this.cssModel||this.cpuProfilerModel)}preciseCoverageDeltaUpdate(e,t,o){this.coverageUpdateTimes.add(e),this.backlogOrProcessJSCoverage(o,e)}async stop(){await this.stopPolling();const e=[];this.cpuProfilerModel&&e.push(this.cpuProfilerModel.stopPreciseCoverage()),this.cssModel&&(e.push(this.cssModel.stopCoverage()),this.cssModel.removeEventListener(o.CSSModel.Events.StyleSheetAdded,this.handleStyleSheetAdded,this)),await Promise.all(e)}reset(){this.coverageByURL=new Map,this.coverageByContentProvider=new Map,this.coverageUpdateTimes=new Set,this.dispatchEventToListeners(h.CoverageReset)}async startPolling(){this.currentPollPromise||"Active"!==this.suspensionState||await this.pollLoop()}async pollLoop(){this.clearTimer(),this.currentPollPromise=this.pollAndCallback(),await this.currentPollPromise,("Active"===this.suspensionState||this.performanceTraceRecording)&&(this.pollTimer=window.setTimeout((()=>this.pollLoop()),200))}async stopPolling(){this.clearTimer(),await this.currentPollPromise,this.currentPollPromise=null,await this.pollAndCallback()}async pollAndCallback(){if("Suspended"===this.suspensionState&&!this.performanceTraceRecording)return;const e=await this.takeAllCoverage();console.assert("Suspended"!==this.suspensionState||Boolean(this.performanceTraceRecording),"CoverageModel was suspended while polling."),e.length&&this.dispatchEventToListeners(h.CoverageUpdated,e)}clearTimer(){this.pollTimer&&(clearTimeout(this.pollTimer),this.pollTimer=null)}async preSuspendModel(e){"Active"===this.suspensionState&&(this.suspensionState="Suspending","performance-timeline"!==e?this.currentPollPromise&&(await this.stopPolling(),this.shouldResumePollingOnResume=!0):this.performanceTraceRecording=!0)}async suspendModel(e){this.suspensionState="Suspended"}async resumeModel(){}async postResumeModel(){this.suspensionState="Active",this.performanceTraceRecording=!1,this.shouldResumePollingOnResume&&(this.shouldResumePollingOnResume=!1,await this.startPolling())}entries(){return Array.from(this.coverageByURL.values())}getCoverageForUrl(e){return this.coverageByURL.get(e)||null}usageForRange(e,t,o){const s=this.coverageByContentProvider.get(e);return s&&s.usageForRange(t,o)}clearCSS(){for(const e of this.coverageByContentProvider.values()){if(1!==e.type())continue;const t=e.getContentProvider();this.coverageByContentProvider.delete(t);const o=this.coverageByURL.get(e.url());if(!o)continue;const s=`${t.startLine}:${t.startColumn}`;o.removeCoverageEntry(s,e),0===o.numberOfEntries()&&this.coverageByURL.delete(e.url())}if(this.cssModel)for(const e of this.cssModel.getAllStyleSheetHeaders())this.addStyleSheetToCSSCoverage(e)}async takeAllCoverage(){const[e,t]=await Promise.all([this.takeCSSCoverage(),this.takeJSCoverage()]);return[...e,...t]}async takeJSCoverage(){if(!this.cpuProfilerModel)return[];const{coverage:e,timestamp:t}=await this.cpuProfilerModel.takePreciseCoverage();return this.coverageUpdateTimes.add(t),this.backlogOrProcessJSCoverage(e,t)}getCoverageUpdateTimes(){return this.coverageUpdateTimes}async backlogOrProcessJSCoverage(e,t){if(e.length>0&&this.jsBacklog.push({rawCoverageData:e,stamp:t}),"Active"!==this.suspensionState)return[];const o=(e,t)=>e.stamp-t.stamp,s=[];for(const{rawCoverageData:e,stamp:t}of this.jsBacklog.sort(o))s.push(this.processJSCoverage(e,t));return this.jsBacklog=[],s.flat()}async processJSBacklog(){this.backlogOrProcessJSCoverage([],0)}processJSCoverage(e,t){if(!this.debuggerModel)return[];const o=[];for(const s of e){const e=this.debuggerModel.scriptForId(s.scriptId);if(!e)continue;const i=[];let r=2;for(const e of s.functions){!1!==e.isBlockCoverage||1===e.ranges.length&&!e.ranges[0].count||(r|=4);for(const t of e.ranges)i.push(t)}const n=this.addCoverage(e,e.contentLength,e.lineOffset,e.columnOffset,i,r,t);n&&o.push(n)}return o}handleStyleSheetAdded(e){this.addStyleSheetToCSSCoverage(e.data)}async takeCSSCoverage(){if(!this.cssModel||"Active"!==this.suspensionState)return[];const{coverage:e,timestamp:t}=await this.cssModel.takeCoverageDelta();return this.coverageUpdateTimes.add(t),this.backlogOrProcessCSSCoverage(e,t)}async backlogOrProcessCSSCoverage(e,t){if(e.length>0&&this.cssBacklog.push({rawCoverageData:e,stamp:t}),"Active"!==this.suspensionState)return[];const o=(e,t)=>e.stamp-t.stamp,s=[];for(const{rawCoverageData:e,stamp:t}of this.cssBacklog.sort(o))s.push(this.processCSSCoverage(e,t));return this.cssBacklog=[],s.flat()}processCSSCoverage(e,t){if(!this.cssModel)return[];const o=[],s=new Map;for(const t of e){const e=this.cssModel.styleSheetHeaderForId(t.styleSheetId);if(!e)continue;let o=s.get(e);o||(o=[],s.set(e,o)),o.push({startOffset:t.startOffset,endOffset:t.endOffset,count:Number(t.used)})}for(const e of s){const s=e[0],i=e[1],r=this.addCoverage(s,s.contentLength,s.startLine,s.startColumn,i,1,t);r&&o.push(r)}return o}static convertToDisjointSegments(e,t){e.sort(((e,t)=>e.startOffset-t.startOffset));const o=[],s=[];for(const t of e){let e=s[s.length-1];for(;e&&e.endOffset<=t.startOffset;)i(e.endOffset,e.count),s.pop(),e=s[s.length-1];i(t.startOffset,e?e.count:0),s.push(t)}for(let e=s.pop();e;e=s.pop())i(e.endOffset,e.count);function i(e,s){const i=o[o.length-1];if(i){if(i.end===e)return;if(i.count===s)return void(i.end=e)}o.push({end:e,count:s,stamp:t})}return o}addStyleSheetToCSSCoverage(e){this.addCoverage(e,e.contentLength,e.startLine,e.startColumn,[],1,Date.now())}addCoverage(e,t,o,s,i,r,n){const a=e.contentURL();if(!a)return null;let l=this.coverageByURL.get(a),c=!1;l||(c=!0,l=new p(a),this.coverageByURL.set(a,l));const d=l.ensureEntry(e,t,o,s,r);this.coverageByContentProvider.set(e,d);const h=g.convertToDisjointSegments(i,n),u=h[h.length-1];u&&u.end{const o=[];let s=0,i=0;for(;s=n.end&&i++}for(;se-t.end));for(;s0?t[t.length-1]:null;i&&i.end===o+e?i.end=s.end+e:t.push({start:o+e,end:s.end+e})}o=s.end}return t}}var m=Object.freeze({__proto__:null,get Events(){return h},CoverageModel:g,get URLCoverageInfo(){return p},mergeSegments:v,CoverageInfo:f});const S=new CSSStyleSheet;S.replaceSync(".data-grid{border:none}.data-grid td .url-outer{width:100%;display:inline-flex;justify-content:flex-start}.data-grid td .url-outer .filter-highlight{font-weight:700}.data-grid td .url-prefix{overflow-x:hidden;text-overflow:ellipsis}.data-grid td .url-suffix{flex:none}.data-grid td .bar{display:inline-block;height:8px;border:1px solid transparent}.data-grid .selected td .bar{border-top:1px var(--color-background) solid;border-bottom:1px var(--color-background) solid}.data-grid .selected td .bar:last-child{border-right:1px var(--color-background) solid}.data-grid .selected td .bar:first-child{border-left:1px var(--color-background) solid}.data-grid td .bar-unused-size{background-color:var(--color-red)}.data-grid td .bar-used-size{background-color:var(--color-green)}.data-grid td .percent-value{width:6ex;display:inline-block}.data-grid tr:not(.selected) td .percent-value{color:var(--color-text-secondary)}@media (forced-colors:active){.data-grid td .bar-container{forced-color-adjust:none}.data-grid td .bar-unused-size{background-color:ButtonText}.data-grid td .bar-used-size{background-color:ButtonFace}.data-grid td .bar{border-color:ButtonText}.data-grid .selected td .bar{border-top-color:HighlightText;border-bottom-color:HighlightText}.data-grid .selected td .bar:last-child{border-right-color:HighlightText}.data-grid .selected td .bar:first-child{border-left-color:HighlightText}.data-grid:focus tr.selected span.percent-value{color:HighlightText}}\n/*# sourceURL=coverageListView.css */\n");const C={css:"CSS",jsPerFunction:"JS (per function)",jsPerBlock:"JS (per block)",url:"URL",type:"Type",totalBytes:"Total Bytes",unusedBytes:"Unused Bytes",usageVisualization:"Usage Visualization",codeCoverage:"Code Coverage",jsCoverageWithPerFunction:"JS coverage with per function granularity: Once a function was executed, the whole function is marked as covered.",jsCoverageWithPerBlock:"JS coverage with per block granularity: Once a block of JavaScript was executed, that block is marked as covered.",sBytes:"{n, plural, =1 {# byte} other {# bytes}}",sBytesS:"{n, plural, =1 {# byte, {percentage}} other {# bytes, {percentage}}}",sBytesSBelongToFunctionsThatHave:"{PH1} bytes ({PH2}) belong to functions that have not (yet) been executed.",sBytesSBelongToBlocksOf:"{PH1} bytes ({PH2}) belong to blocks of JavaScript that have not (yet) been executed.",sBytesSBelongToFunctionsThatHaveExecuted:"{PH1} bytes ({PH2}) belong to functions that have executed at least once.",sBytesSBelongToBlocksOfJavascript:"{PH1} bytes ({PH2}) belong to blocks of JavaScript that have executed at least once.",sOfFileUnusedSOfFileUsed:"{PH1} % of file unused, {PH2} % of file used"},b=i.i18n.registerUIStrings("panels/coverage/CoverageListView.ts",C),y=i.i18n.getLocalizedString.bind(void 0,b);function B(e){const t=[];return 1&e&&t.push(y(C.css)),4&e?t.push(y(C.jsPerFunction)):2&e&&t.push(y(C.jsPerBlock)),t.join("+")}class T extends l.Widget.VBox{nodeForCoverageInfo;isVisibleFilter;highlightRegExp;dataGrid;constructor(e){super(!0),this.nodeForCoverageInfo=new Map,this.isVisibleFilter=e,this.highlightRegExp=null;const t=[{id:"url",title:y(C.url),width:"250px",weight:3,fixedWidth:!1,sortable:!0},{id:"type",title:y(C.type),width:"45px",weight:1,fixedWidth:!0,sortable:!0},{id:"size",title:y(C.totalBytes),width:"60px",fixedWidth:!0,sortable:!0,align:a.DataGrid.Align.Right,weight:1},{id:"unusedSize",title:y(C.unusedBytes),width:"100px",fixedWidth:!0,sortable:!0,align:a.DataGrid.Align.Right,sort:a.DataGrid.Order.Descending,weight:1},{id:"bars",title:y(C.usageVisualization),width:"250px",fixedWidth:!1,sortable:!0,weight:1}];this.dataGrid=new a.SortableDataGrid.SortableDataGrid({displayName:y(C.codeCoverage),columns:t,editCallback:void 0,refreshCallback:void 0,deleteCallback:void 0}),this.dataGrid.setResizeMethod(a.DataGrid.ResizeMethod.Last),this.dataGrid.element.classList.add("flex-auto"),this.dataGrid.element.addEventListener("keydown",this.onKeyDown.bind(this),!1),this.dataGrid.addEventListener(a.DataGrid.Events.OpenedNode,this.onOpenedNode,this),this.dataGrid.addEventListener(a.DataGrid.Events.SortingChanged,this.sortingChanged,this);const o=this.dataGrid.asWidget();o.show(this.contentElement),this.setDefaultFocusedChild(o)}update(e){let t=!1;const o=e.reduce(((e,t)=>Math.max(e,t.size())),0),s=this.dataGrid.rootNode();for(const i of e){let e=this.nodeForCoverageInfo.get(i);e?this.isVisibleFilter(e.coverageInfo)&&(t=e.refreshIfNeeded(o)||t):(e=new P(i,o),this.nodeForCoverageInfo.set(i,e),this.isVisibleFilter(e.coverageInfo)&&(s.appendChild(e),t=!0))}t&&this.sortingChanged()}reset(){this.nodeForCoverageInfo.clear(),this.dataGrid.rootNode().removeChildren()}updateFilterAndHighlight(e){this.highlightRegExp=e;let t=!1;for(const e of this.nodeForCoverageInfo.values()){const o=this.isVisibleFilter(e.coverageInfo),s=Boolean(e.parent);o&&e.setHighlight(this.highlightRegExp),o!==s&&(t=!0,o?this.dataGrid.rootNode().appendChild(e):e.remove())}t&&this.sortingChanged()}selectByUrl(e){for(const[t,o]of this.nodeForCoverageInfo.entries())if(t.url()===e){o.revealAndSelect();break}}onOpenedNode(){this.revealSourceForSelectedNode()}onKeyDown(e){"Enter"===e.key&&(e.consume(!0),this.revealSourceForSelectedNode())}async revealSourceForSelectedNode(){const t=this.dataGrid.selectedNode;if(!t)return;const o=t.coverageInfo;let s=n.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(o.url());if(!s)return;s=(await r.SourceFormatter.SourceFormatter.instance().format(s)).formattedSourceCode,this.dataGrid.selectedNode===t&&e.Revealer.reveal(s)}sortingChanged(){const e=this.dataGrid.sortColumnId();if(!e)return;const t=P.sortFunctionForColumn(e);t&&this.dataGrid.sortNodes(t,!this.dataGrid.isSortOrderAscending())}wasShown(){super.wasShown(),this.registerCSSFiles([S])}}let x=null;function w(){return x||(x=new Intl.NumberFormat(i.DevToolsLocale.DevToolsLocale.instance().locale,{style:"percent",maximumFractionDigits:1})),x}class P extends a.SortableDataGrid.SortableDataGridNode{coverageInfo;lastUsedSize;url;maxSize;highlightRegExp;constructor(e,t){super(),this.coverageInfo=e,this.url=e.url(),this.maxSize=t,this.highlightRegExp=null}setHighlight(e){this.highlightRegExp!==e&&(this.highlightRegExp=e,this.refresh())}refreshIfNeeded(e){return(this.lastUsedSize!==this.coverageInfo.usedSize()||e!==this.maxSize)&&(this.lastUsedSize=this.coverageInfo.usedSize(),this.maxSize=e,this.refresh(),!0)}createCell(e){const o=this.createTD(e);switch(e){case"url":{l.Tooltip.Tooltip.install(o,this.url);const t=o.createChild("div","url-outer"),s=t.createChild("div","url-prefix"),i=t.createChild("div","url-suffix"),r=/^(.*)(\/[^/]*)$/.exec(this.url);s.textContent=r?r[1]:this.url,i.textContent=r?r[2]:"",this.highlightRegExp&&this.highlight(t,this.url),this.setCellAccessibleName(this.url,o,e);break}case"type":o.textContent=B(this.coverageInfo.type()),4&this.coverageInfo.type()?l.Tooltip.Tooltip.install(o,y(C.jsCoverageWithPerFunction)):2&this.coverageInfo.type()&&l.Tooltip.Tooltip.install(o,y(C.jsCoverageWithPerBlock));break;case"size":{o.createChild("span").textContent=t.NumberUtilities.withThousandsSeparator(this.coverageInfo.size()||0);const s=y(C.sBytes,{n:this.coverageInfo.size()||0});this.setCellAccessibleName(s,o,e);break}case"unusedSize":{const s=this.coverageInfo.unusedSize()||0,i=o.createChild("span"),r=o.createChild("span","percent-value");i.textContent=t.NumberUtilities.withThousandsSeparator(s);const n=w().format(this.coverageInfo.unusedPercentage());r.textContent=n;const a=y(C.sBytesS,{n:s,percentage:n});this.setCellAccessibleName(a,o,e);break}case"bars":{const t=o.createChild("div","bar-container"),s=w().format(this.coverageInfo.unusedPercentage()),i=w().format(this.coverageInfo.usedPercentage());if(this.coverageInfo.unusedSize()>0){const e=t.createChild("div","bar bar-unused-size");e.style.width=(this.coverageInfo.unusedSize()/this.maxSize*100||0)+"%",4&this.coverageInfo.type()?l.Tooltip.Tooltip.install(e,y(C.sBytesSBelongToFunctionsThatHave,{PH1:this.coverageInfo.unusedSize(),PH2:s})):2&this.coverageInfo.type()&&l.Tooltip.Tooltip.install(e,y(C.sBytesSBelongToBlocksOf,{PH1:this.coverageInfo.unusedSize(),PH2:s}))}if(this.coverageInfo.usedSize()>0){const e=t.createChild("div","bar bar-used-size");e.style.width=(this.coverageInfo.usedSize()/this.maxSize*100||0)+"%",4&this.coverageInfo.type()?l.Tooltip.Tooltip.install(e,y(C.sBytesSBelongToFunctionsThatHaveExecuted,{PH1:this.coverageInfo.usedSize(),PH2:i})):2&this.coverageInfo.type()&&l.Tooltip.Tooltip.install(e,y(C.sBytesSBelongToBlocksOfJavascript,{PH1:this.coverageInfo.usedSize(),PH2:i}))}this.setCellAccessibleName(y(C.sOfFileUnusedSOfFileUsed,{PH1:s,PH2:i}),o,e)}}return o}highlight(e,t){if(!this.highlightRegExp)return;const o=this.highlightRegExp.exec(t);if(!o||!o.length)return;const i=new s.TextRange.SourceRange(o.index,o[0].length);l.UIUtils.highlightRangesWithStyleClass(e,[i],"filter-highlight")}static sortFunctionForColumn(e){const t=(e,t)=>e.url.localeCompare(t.url);switch(e){case"url":return t;case"type":return(e,o)=>{const s=B(e.coverageInfo.type()),i=B(o.coverageInfo.type());return s.localeCompare(i)||t(e,o)};case"size":return(e,o)=>e.coverageInfo.size()-o.coverageInfo.size()||t(e,o);case"bars":case"unusedSize":return(e,o)=>e.coverageInfo.unusedSize()-o.coverageInfo.unusedSize()||t(e,o);default:return console.assert(!1,"Unknown sort field: "+e),null}}}var R=Object.freeze({__proto__:null,coverageTypeToString:B,CoverageListView:T,GridNode:P});class I{coverageModel;textByProvider;uiSourceCodeByContentProvider;constructor(e){this.coverageModel=e,this.textByProvider=new Map,this.uiSourceCodeByContentProvider=new t.MapUtilities.Multimap;for(const e of n.Workspace.WorkspaceImpl.instance().uiSourceCodes())e.setDecorationData("coverage",this);n.Workspace.WorkspaceImpl.instance().addEventListener(n.Workspace.Events.UISourceCodeAdded,this.onUISourceCodeAdded,this)}reset(){for(const e of n.Workspace.WorkspaceImpl.instance().uiSourceCodes())e.setDecorationData("coverage",void 0)}dispose(){this.reset(),n.Workspace.WorkspaceImpl.instance().removeEventListener(n.Workspace.Events.UISourceCodeAdded,this.onUISourceCodeAdded,this)}update(e){for(const t of e)for(const e of this.uiSourceCodeByContentProvider.get(t.getContentProvider()))e.setDecorationData("coverage",this)}async usageByLine(e){const t=[],{content:o}=await e.requestContent();if(!o)return[];const i=new s.Text.Text(o);await this.updateTexts(e,i);const r=i.lineEndings();for(let o=0;o=0;)++t;if(t>=l.length||l[t].id!==o.id)continue;const s=l[t++],i=this.textByProvider.get(s.contentProvider);if(!i)continue;const r=i.value();let n=Math.min(i.offsetFromPosition(o.line,o.column),r.length-1),d=Math.min(i.offsetFromPosition(s.line,s.column),r.length-1);for(;n<=d&&/\s/.test(r[n]);)++n;for(;n<=d&&/\s/.test(r[d]);)--d;if(n<=d&&(c=this.coverageModel.usageForRange(s.contentProvider,n,d)),c)break}t.push(c)}return t}async updateTexts(e,t){const o=[];for(let s=0;sBoolean(e.script())));for(const e of r){const t=e.script();t&&(t.isInlineScript()&&i.isDocument()&&(e.lineNumber-=t.lineOffset,e.lineNumber||(e.columnNumber-=t.columnOffset)),s.push({id:`js:${e.scriptId}`,contentProvider:t,line:e.lineNumber,column:e.columnNumber}))}}if(i.isStyleSheet()||i.isDocument()){const r=d.CSSWorkspaceBinding.CSSWorkspaceBinding.instance().uiLocationToRawLocations(new n.UISourceCode.UILocation(e,t,o));for(const e of r){const t=e.header();t&&(t.isInline&&i.isDocument()&&(e.lineNumber-=t.startLine,e.lineNumber||(e.columnNumber-=t.startColumn)),s.push({id:`css:${e.styleSheetId}`,contentProvider:t,line:e.lineNumber,column:e.columnNumber}))}}return s.sort(I.compareLocations)}static compareLocations(e,t){return e.id.localeCompare(t.id)||e.line-t.line||e.column-t.column}onUISourceCodeAdded(e){e.data.setDecorationData("coverage",this)}}var k=Object.freeze({__proto__:null,decoratorType:"coverage",CoverageDecorationManager:I});const M=new CSSStyleSheet;M.replaceSync(":host{overflow:hidden}.coverage-toolbar-container{display:flex;border-bottom:1px solid var(--color-details-hairline);flex:0 0 auto}.coverage-toolbar{display:inline-block;width:100%}.coverage-toolbar-summary{background-color:var(--color-background-elevation-2);border-top:1px solid var(--color-details-hairline);padding-left:5px;flex:0 0 19px;display:flex;padding-right:5px}.coverage-toolbar-summary .coverage-message{padding-top:2px;padding-left:1ex;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.coverage-results{overflow-y:auto;display:flex;flex:auto}.landing-page{justify-content:center;align-items:center;padding:20px}.landing-page .message{white-space:pre-line}\n/*# sourceURL=coverageView.css */\n");const E={chooseCoverageGranularityPer:"Choose coverage granularity: Per function has low overhead, per block has significant overhead.",perFunction:"Per function",perBlock:"Per block",clearAll:"Clear all",export:"Export...",urlFilter:"URL filter",filterCoverageByType:"Filter coverage by type",all:"All",css:"CSS",javascript:"JavaScript",includeExtensionContentScripts:"Include extension content scripts",contentScripts:"Content scripts",clickTheReloadButtonSToReloadAnd:"Click the reload button {PH1} to reload and start capturing coverage.",clickTheRecordButtonSToStart:"Click the record button {PH1} to start capturing coverage.",filteredSTotalS:"Filtered: {PH1} Total: {PH2}",sOfSSUsedSoFarSUnused:"{PH1} of {PH2} ({PH3}%) used so far, {PH4} unused."},F=i.i18n.registerUIStrings("panels/coverage/CoverageView.ts",E),z=i.i18n.getLocalizedString.bind(void 0,F);let L,U;class O extends l.Widget.VBox{model;decorationManager;resourceTreeModel;coverageTypeComboBox;coverageTypeComboBoxSetting;toggleRecordAction;toggleRecordButton;inlineReloadButton;startWithReloadButton;clearButton;saveButton;textFilterRegExp;filterInput;typeFilterValue;filterByTypeComboBox;showContentScriptsSetting;contentScriptsCheckbox;coverageResultsElement;landingPage;listView;statusToolbarElement;statusMessageElement;constructor(){super(!0),this.model=null,this.decorationManager=null,this.resourceTreeModel=null;const t=this.contentElement.createChild("div","coverage-toolbar-container"),s=new l.Toolbar.Toolbar("coverage-toolbar",t);s.makeWrappable(!0),this.coverageTypeComboBox=new l.Toolbar.ToolbarComboBox(this.onCoverageTypeComboBoxSelectionChanged.bind(this),z(E.chooseCoverageGranularityPer));const i=[{label:z(E.perFunction),value:6},{label:z(E.perBlock),value:2}];for(const e of i)this.coverageTypeComboBox.addOption(this.coverageTypeComboBox.createOption(e.label,`${e.value}`));this.coverageTypeComboBoxSetting=e.Settings.Settings.instance().createSetting("coverageViewCoverageType",0),this.coverageTypeComboBox.setSelectedIndex(this.coverageTypeComboBoxSetting.get()),this.coverageTypeComboBox.setEnabled(!0),s.appendToolbarItem(this.coverageTypeComboBox),this.toggleRecordAction=l.ActionRegistry.ActionRegistry.instance().action("coverage.toggle-recording"),this.toggleRecordButton=l.Toolbar.Toolbar.createActionButton(this.toggleRecordAction),s.appendToolbarItem(this.toggleRecordButton);const r=o.TargetManager.TargetManager.instance().mainTarget(),n=r&&r.model(o.ResourceTreeModel.ResourceTreeModel);if(this.inlineReloadButton=null,n){const e=l.ActionRegistry.ActionRegistry.instance().action("coverage.start-with-reload");this.startWithReloadButton=l.Toolbar.Toolbar.createActionButton(e),s.appendToolbarItem(this.startWithReloadButton),this.toggleRecordButton.setEnabled(!1),this.toggleRecordButton.setVisible(!1)}this.clearButton=new l.Toolbar.ToolbarButton(z(E.clearAll),"largeicon-clear"),this.clearButton.addEventListener(l.Toolbar.ToolbarButton.Events.Click,this.clear.bind(this)),s.appendToolbarItem(this.clearButton),s.appendSeparator(),this.saveButton=new l.Toolbar.ToolbarButton(z(E.export),"largeicon-download"),this.saveButton.addEventListener(l.Toolbar.ToolbarButton.Events.Click,(e=>{this.exportReport()})),s.appendToolbarItem(this.saveButton),this.saveButton.setEnabled(!1),this.textFilterRegExp=null,s.appendSeparator(),this.filterInput=new l.Toolbar.ToolbarInput(z(E.urlFilter),"",.4,1),this.filterInput.setEnabled(!1),this.filterInput.addEventListener(l.Toolbar.ToolbarInput.Event.TextChanged,this.onFilterChanged,this),s.appendToolbarItem(this.filterInput),s.appendSeparator(),this.typeFilterValue=null,this.filterByTypeComboBox=new l.Toolbar.ToolbarComboBox(this.onFilterByTypeChanged.bind(this),z(E.filterCoverageByType));const a=[{label:z(E.all),value:""},{label:z(E.css),value:1},{label:z(E.javascript),value:6}];for(const e of a)this.filterByTypeComboBox.addOption(this.filterByTypeComboBox.createOption(e.label,`${e.value}`));this.filterByTypeComboBox.setSelectedIndex(0),this.filterByTypeComboBox.setEnabled(!1),s.appendToolbarItem(this.filterByTypeComboBox),s.appendSeparator(),this.showContentScriptsSetting=e.Settings.Settings.instance().createSetting("showContentScripts",!1),this.showContentScriptsSetting.addChangeListener(this.onFilterChanged,this),this.contentScriptsCheckbox=new l.Toolbar.ToolbarSettingCheckbox(this.showContentScriptsSetting,z(E.includeExtensionContentScripts),z(E.contentScripts)),this.contentScriptsCheckbox.setEnabled(!1),s.appendToolbarItem(this.contentScriptsCheckbox),this.coverageResultsElement=this.contentElement.createChild("div","coverage-results"),this.landingPage=this.buildLandingPage(),this.listView=new T(this.isVisible.bind(this,!1)),this.statusToolbarElement=this.contentElement.createChild("div","coverage-toolbar-summary"),this.statusMessageElement=this.statusToolbarElement.createChild("div","coverage-message"),this.landingPage.show(this.coverageResultsElement)}static instance(){return L||(L=new O),L}buildLandingPage(){const e=new l.Widget.VBox;let t;if(this.startWithReloadButton)this.inlineReloadButton=l.UIUtils.createInlineButton(l.Toolbar.Toolbar.createActionButtonForId("coverage.start-with-reload")),t=i.i18n.getFormatLocalizedString(F,E.clickTheReloadButtonSToReloadAnd,{PH1:this.inlineReloadButton});else{const e=l.UIUtils.createInlineButton(l.Toolbar.Toolbar.createActionButton(this.toggleRecordAction));t=i.i18n.getFormatLocalizedString(F,E.clickTheRecordButtonSToStart,{PH1:e})}return t.classList.add("message"),e.contentElement.appendChild(t),e.element.classList.add("landing-page"),e}clear(){this.model&&this.model.reset(),this.reset()}reset(){this.decorationManager&&(this.decorationManager.dispose(),this.decorationManager=null),this.listView.reset(),this.listView.detach(),this.landingPage.show(this.coverageResultsElement),this.statusMessageElement.textContent="",this.filterInput.setEnabled(!1),this.filterByTypeComboBox.setEnabled(!1),this.contentScriptsCheckbox.setEnabled(!1),this.saveButton.setEnabled(!1)}toggleRecording(){!this.toggleRecordAction.toggled()?this.startRecording({reload:!1,jsCoveragePerBlock:this.isBlockCoverageSelected()}):this.stopRecording()}isBlockCoverageSelected(){const e=this.coverageTypeComboBox.selectedOption();return 2===Number(e?e.value:Number.NaN)}selectCoverageType(e){const t=e?1:0;this.coverageTypeComboBox.setSelectedIndex(t)}onCoverageTypeComboBoxSelectionChanged(){this.coverageTypeComboBoxSetting.set(this.coverageTypeComboBox.selectedIndex())}async ensureRecordingStarted(){this.toggleRecordAction.toggled()&&await this.stopRecording(),await this.startRecording({reload:!1,jsCoveragePerBlock:!1})}async startRecording(e){let t,s;this.startWithReloadButton&&this.startWithReloadButton.element.hasFocus()||this.inlineReloadButton&&this.inlineReloadButton.hasFocus()?s=!0:this.hasFocus()&&(t=!0),this.reset();const i=o.TargetManager.TargetManager.instance().mainTarget();if(!i)return;const{reload:r,jsCoveragePerBlock:n}={reload:!1,jsCoveragePerBlock:!1,...e};if(this.model&&!r||(this.model=i.model(g)),!this.model)return;c.userMetrics.actionTaken(c.UserMetrics.Action.CoverageStarted),n&&c.userMetrics.actionTaken(c.UserMetrics.Action.CoverageStartedPerBlock);await this.model.start(Boolean(n))&&(this.selectCoverageType(Boolean(n)),this.model.addEventListener(h.CoverageUpdated,this.onCoverageDataReceived,this),this.resourceTreeModel=i.model(o.ResourceTreeModel.ResourceTreeModel),this.resourceTreeModel&&this.resourceTreeModel.addEventListener(o.ResourceTreeModel.Events.MainFrameNavigated,this.onMainFrameNavigated,this),this.decorationManager=new I(this.model),this.toggleRecordAction.setToggled(!0),this.clearButton.setEnabled(!1),this.startWithReloadButton&&(this.startWithReloadButton.setEnabled(!1),this.startWithReloadButton.setVisible(!1),this.toggleRecordButton.setEnabled(!0),this.toggleRecordButton.setVisible(!0),s&&this.toggleRecordButton.focus()),this.coverageTypeComboBox.setEnabled(!1),this.filterInput.setEnabled(!0),this.filterByTypeComboBox.setEnabled(!0),this.contentScriptsCheckbox.setEnabled(!0),this.landingPage.isShowing()&&this.landingPage.detach(),this.listView.show(this.coverageResultsElement),t&&!s&&this.listView.focus(),r&&this.resourceTreeModel?this.resourceTreeModel.reloadPage():this.model.startPolling())}onCoverageDataReceived(e){const t=e.data;this.updateViews(t)}async stopRecording(){this.resourceTreeModel&&(this.resourceTreeModel.removeEventListener(o.ResourceTreeModel.Events.MainFrameNavigated,this.onMainFrameNavigated,this),this.resourceTreeModel=null),this.hasFocus()&&this.listView.focus(),this.model&&(await this.model.stop(),this.model.removeEventListener(h.CoverageUpdated,this.onCoverageDataReceived,this)),this.toggleRecordAction.setToggled(!1),this.coverageTypeComboBox.setEnabled(!0),this.startWithReloadButton&&(this.startWithReloadButton.setEnabled(!0),this.startWithReloadButton.setVisible(!0),this.toggleRecordButton.setEnabled(!1),this.toggleRecordButton.setVisible(!1)),this.clearButton.setEnabled(!0)}processBacklog(){this.model&&this.model.processJSBacklog()}onMainFrameNavigated(){this.model&&this.model.reset(),this.decorationManager&&this.decorationManager.reset(),this.listView.reset(),this.model&&this.model.startPolling()}updateViews(e){this.updateStats(),this.listView.update(this.model&&this.model.entries()||[]),this.saveButton.setEnabled(null!==this.model&&this.model.entries().length>0),this.decorationManager&&this.decorationManager.update(e)}updateStats(){const e={total:0,unused:0},o={total:0,unused:0};let s=!1;if(this.model)for(const t of this.model.entries())e.total+=t.size(),e.unused+=t.unusedSize(),this.isVisible(!1,t)?(o.total+=t.size(),o.unused+=t.unusedSize()):s=!0;function i({total:e,unused:o}){const s=e-o,i=e?Math.round(100*s/e):0;return z(E.sOfSSUsedSoFarSUnused,{PH1:t.NumberUtilities.bytesToString(s),PH2:t.NumberUtilities.bytesToString(e),PH3:i,PH4:t.NumberUtilities.bytesToString(o)})}this.statusMessageElement.textContent=s?z(E.filteredSTotalS,{PH1:i(o),PH2:i(e)}):i(e)}onFilterChanged(){if(!this.listView)return;const e=this.filterInput.value();this.textFilterRegExp=e?createPlainTextSearchRegex(e,"i"):null,this.listView.updateFilterAndHighlight(this.textFilterRegExp),this.updateStats()}onFilterByTypeChanged(){if(!this.listView)return;c.userMetrics.actionTaken(c.UserMetrics.Action.CoverageReportFiltered);const e=this.filterByTypeComboBox.selectedOption(),t=e&&e.value;this.typeFilterValue=parseInt(t||"",10)||null,this.listView.updateFilterAndHighlight(this.textFilterRegExp),this.updateStats()}isVisible(e,t){const o=t.url();return!o.startsWith(O.EXTENSION_BINDINGS_URL_PREFIX)&&(!(t.isContentScript()&&!this.showContentScriptsSetting.get())&&(!(this.typeFilterValue&&!(t.type()&this.typeFilterValue))&&(e||!this.textFilterRegExp||this.textFilterRegExp.test(o))))}async exportReport(){const e=new d.FileUtils.FileOutputStream,o=`Coverage-${t.DateUtilities.toISO8601Compact(new Date)}.json`;await e.open(o)&&this.model&&this.model.exportReport(e)}selectCoverageItemByUrl(e){this.listView.selectByUrl(e)}static EXTENSION_BINDINGS_URL_PREFIX="extensions::";wasShown(){super.wasShown(),this.registerCSSFiles([M])}}class A{handleAction(e,t){const o="coverage";return l.ViewManager.ViewManager.instance().showView(o,!1,!0).then((()=>{const e=l.ViewManager.ViewManager.instance().view(o);return e&&e.widget()})).then((e=>this.innerHandleAction(e,t))),!0}static instance(e={forceNew:null}){const{forceNew:t}=e;return U&&!t||(U=new A),U}innerHandleAction(e,t){switch(t){case"coverage.toggle-recording":e.toggleRecording();break;case"coverage.start-with-reload":e.startRecording({reload:!0,jsCoveragePerBlock:e.isBlockCoverageSelected()});break;default:console.assert(!1,`Unknown action: ${t}`)}}}var N=Object.freeze({__proto__:null,CoverageView:O,ActionDelegate:A});export{k as CoverageDecorationManager,R as CoverageListView,m as CoverageModel,N as CoverageView};
diff --git a/chii/panels/css_overview/components/components.js b/chii/panels/css_overview/components/components.js
new file mode 100644
index 00000000..c5c701b7
--- /dev/null
+++ b/chii/panels/css_overview/components/components.js
@@ -0,0 +1 @@
+import*as e from"../../../core/i18n/i18n.js";import*as t from"../../../ui/components/buttons/buttons.js";import*as r from"../../../ui/components/helpers/helpers.js";import*as i from"../../../ui/components/panel_feedback/panel_feedback.js";import*as o from"../../../ui/lit-html/lit-html.js";const a=new CSSStyleSheet;a.replaceSync("h1{font-weight:400}.css-overview-start-view{padding:24px;height:100%;display:flex;flex-direction:column;background-color:var(--color-background)}.summary-header{color:var(--color-text-primary);font-size:18px;font-weight:400;letter-spacing:.02em;line-height:1.33;margin:0;padding:0}.summary-list{counter-reset:custom-counter;list-style:none;margin:16px 0 30px 30px;padding:0}.summary-list li{color:var(--color-text-primary);counter-increment:custom-counter;font-size:13px;letter-spacing:.03em;line-height:1.54;margin-bottom:9px;position:relative}.summary-list li::before{--override-color-counter-background:rgba(26 115 232 / 25%);box-sizing:border-box;background:var(--override-color-counter-background);border-radius:50%;color:var(--color-primary);content:counter(custom-counter);font-size:12px;height:18px;left:-30px;line-height:20px;position:absolute;text-align:center;top:0;width:18px;display:flex;align-items:center;justify-content:center}.start-capture-wrapper{width:fit-content}.preview-feature{padding:12px 16px;border:1px solid var(--color-details-hairline);color:var(--color-text-primary);font-size:13px;line-height:20px;border-radius:12px;margin:42px 0;letter-spacing:.01em}.preview-header{color:var(--color-primary);font-size:13px;line-height:20px;letter-spacing:.01em;margin:9px 0 14px}.preview-icon{vertical-align:middle}.feedback-prompt{margin-bottom:24px}.feedback-prompt .devtools-link{color:-webkit-link;cursor:pointer;text-decoration:underline}.resources{display:flex;flex-direction:row}.thumbnail-wrapper{width:144px;height:92px;margin-right:20px}.video-doc-header{font-size:13px;line-height:20px;letter-spacing:.04em;color:var(--color-text-primary);margin-bottom:2px}devtools-feedback-button{align-self:flex-end}.resources .devtools-link{font-size:14px;line-height:22px;letter-spacing:.04em;text-decoration-line:underline;color:var(--color-primary)}\n/*# sourceURL=cssOverviewStartView.css */\n");const s={captureOverview:"Capture overview",identifyCSSImprovements:"Identify potential CSS improvements",capturePageCSSOverview:"Capture an overview of your page’s CSS",identifyCSSImprovementsWithExampleIssues:"Identify potential CSS improvements (e.g. low contrast issues, unused declarations, color or font mismatches)",locateAffectedElements:"Locate the affected elements in the Elements panel",quickStartWithCSSOverview:"Quick start: get started with the new CSS Overview panel"},n=e.i18n.registerUIStrings("panels/css_overview/components/CSSOverviewStartView.ts",s),l=e.i18n.getLocalizedString.bind(void 0,n),{render:c,html:p}=o;class d extends Event{static eventName="overviewstartrequested";constructor(){super(d.eventName)}}class m extends HTMLElement{static litTagName=o.literal`devtools-css-overview-start-view`;#e=this.attachShadow({mode:"open"});connectedCallback(){this.#e.adoptedStyleSheets=[a],this.render()}show(){this.classList.remove("hidden")}hide(){this.classList.add("hidden")}onStartCaptureClick(){this.dispatchEvent(new d)}render(){c(p` - ${l(s.capturePageCSSOverview)}
- ${l(s.identifyCSSImprovementsWithExampleIssues)}
- ${l(s.locateAffectedElements)}
<${t.Button.Button.litTagName} class="start-capture" .variant="${"primary"}" @click="${this.onStartCaptureClick}"> ${l(s.captureOverview)} ${t.Button.Button.litTagName}>
<${i.PanelFeedback.PanelFeedback.litTagName} .data="${{feedbackUrl:"https://goo.gle/css-overview-feedback",quickStartUrl:"https://developer.chrome.com/docs/devtools/css-overview",quickStartLinkText:l(s.quickStartWithCSSOverview)}}"> ${i.PanelFeedback.PanelFeedback.litTagName}> <${i.FeedbackButton.FeedbackButton.litTagName} .data="${{feedbackUrl:"https://goo.gle/css-overview-feedback"}}"> ${i.FeedbackButton.FeedbackButton.litTagName}>
`,this.#e,{host:this});const e=this.#e.querySelector(".start-capture");e&&e.focus()}}r.CustomElements.defineComponent("devtools-css-overview-start-view",m);var v=Object.freeze({__proto__:null,OverviewStartRequestedEvent:d,CSSOverviewStartView:m});export{v as CSSOverviewStartView};
diff --git a/chii/panels/css_overview/css_overview-meta.js b/chii/panels/css_overview/css_overview-meta.js
new file mode 100644
index 00000000..428f21d2
--- /dev/null
+++ b/chii/panels/css_overview/css_overview-meta.js
@@ -0,0 +1 @@
+import*as e from"../../core/i18n/i18n.js";import*as i from"../../ui/legacy/legacy.js";const s={cssOverview:"CSS Overview",showCssOverview:"Show CSS Overview"},r=e.i18n.registerUIStrings("panels/css_overview/css_overview-meta.ts",s),o=e.i18n.getLazilyComputedLocalizedString.bind(void 0,r);let v;i.ViewManager.registerViewExtension({location:"panel",id:"cssoverview",commandPrompt:o(s.showCssOverview),title:o(s.cssOverview),order:95,persistence:"closeable",loadView:async()=>(await async function(){return v||(v=await import("./css_overview.js")),v}()).CSSOverviewPanel.CSSOverviewPanel.instance(),isPreviewFeature:!0});
diff --git a/chii/panels/css_overview/css_overview.js b/chii/panels/css_overview/css_overview.js
new file mode 100644
index 00000000..b0eded36
--- /dev/null
+++ b/chii/panels/css_overview/css_overview.js
@@ -0,0 +1,143 @@
+import*as e from"../../core/common/common.js";import*as t from"../../core/sdk/sdk.js";import*as i from"../../core/i18n/i18n.js";import*as o from"../../core/root/root.js";import*as s from"../../ui/legacy/components/color_picker/color_picker.js";import*as n from"../../ui/legacy/legacy.js";import*as r from"../../core/platform/platform.js";import*as a from"../../models/text_utils/text_utils.js";import*as l from"../../ui/legacy/components/data_grid/data_grid.js";import*as d from"../../ui/legacy/components/utils/utils.js";import*as c from"./components/components.js";import*as h from"../../core/host/host.js";class u extends e.ObjectWrapper.ObjectWrapper{currentUrl;constructor(){super(),this.currentUrl=t.TargetManager.TargetManager.instance().inspectedURL(),t.TargetManager.TargetManager.instance().addEventListener(t.TargetManager.Events.InspectedURLChanged,this.checkUrlAndResetIfChanged,this)}checkUrlAndResetIfChanged(){this.currentUrl!==t.TargetManager.TargetManager.instance().inspectedURL()&&(this.currentUrl=t.TargetManager.TargetManager.instance().inspectedURL(),this.dispatchEventToListeners("Reset"))}}var v=Object.freeze({__proto__:null,OverviewController:u});const p={topAppliedToAStatically:"`Top` applied to a statically positioned element",leftAppliedToAStatically:"`Left` applied to a statically positioned element",rightAppliedToAStatically:"`Right` applied to a statically positioned element",bottomAppliedToAStatically:"`Bottom` applied to a statically positioned element",widthAppliedToAnInlineElement:"`Width` applied to an inline element",heightAppliedToAnInlineElement:"`Height` applied to an inline element",verticalAlignmentAppliedTo:"Vertical alignment applied to element which is neither `inline` nor `table-cell`"},m=i.i18n.registerUIStrings("panels/css_overview/CSSOverviewUnusedDeclarations.ts",p),g=i.i18n.getLocalizedString.bind(void 0,m);class w{static add(e,t,i){const o=e.get(t)||[];o.push(i),e.set(t,o)}static checkForUnusedPositionValues(e,t,i,o,s,n,r,a){if("static"===i[o]){if("auto"!==i[s]){const o=g(p.topAppliedToAStatically);this.add(e,o,{declaration:`top: ${i[s]}`,nodeId:t})}if("auto"!==i[n]){const o=g(p.leftAppliedToAStatically);this.add(e,o,{declaration:`left: ${i[n]}`,nodeId:t})}if("auto"!==i[r]){const o=g(p.rightAppliedToAStatically);this.add(e,o,{declaration:`right: ${i[r]}`,nodeId:t})}if("auto"!==i[a]){const o=g(p.bottomAppliedToAStatically);this.add(e,o,{declaration:`bottom: ${i[a]}`,nodeId:t})}}}static checkForUnusedWidthAndHeightValues(e,t,i,o,s,n){if("inline"===i[o]){if("auto"!==i[s]){const o=g(p.widthAppliedToAnInlineElement);this.add(e,o,{declaration:`width: ${i[s]}`,nodeId:t})}if("auto"!==i[n]){const o=g(p.heightAppliedToAnInlineElement);this.add(e,o,{declaration:`height: ${i[n]}`,nodeId:t})}}}static checkForInvalidVerticalAlignment(e,t,i,o,s){if(i[o]&&"inline"!==i[o]&&!i[o].startsWith("table")&&"baseline"!==i[s]){const o=g(p.verticalAlignmentAppliedTo);this.add(e,o,{declaration:`vertical-align: ${i[s]}`,nodeId:t})}}}var f=Object.freeze({__proto__:null,CSSOverviewUnusedDeclarations:w});class b extends t.SDKModel.SDKModel{#e;#t;#i;#o;#s;constructor(e){super(e),this.#e=e.runtimeAgent(),this.#t=e.cssAgent(),this.#i=e.domAgent(),this.#o=e.domsnapshotAgent(),this.#s=e.overlayAgent()}highlightNode(t){const i={contentColor:e.Color.PageHighlight.Content.toProtocolRGBA(),showInfo:!0,contrastAlgorithm:o.Runtime.experiments.isEnabled("APCA")?"apca":"aa"};this.#s.invoke_hideHighlight(),this.#s.invoke_highlightNode({backendNodeId:t,highlightConfig:i})}async getNodeStyleStats(){const t=new Map,i=new Map,n=new Map,r=new Map,a=new Map,l=new Map,d=new Map,c=t=>t.hasAlpha()?t.asString(e.Color.Format.HEXA):t.asString(e.Color.Format.HEX),h=(t,i,o)=>{if(-1===t)return;const s=f[t];if(!s)return;const n=e.Color.Color.parse(s);if(!n||0===n.rgba()[3])return;const r=c(n);if(!r)return;const a=o.get(r)||new Set;return a.add(i),o.set(r,a),n},u=e=>new Set(["altglyph","circle","ellipse","path","polygon","polyline","rect","svg","text","textpath","tref","tspan"]).has(e.toLowerCase()),v=e=>new Set(["iframe","video","embed","img"]).has(e.toLowerCase()),p=(e,t)=>new Set(["tr","td","thead","tbody"]).has(e.toLowerCase())&&t.startsWith("table");let m=0;const{documents:g,strings:f}=await this.#o.invoke_captureSnapshot({computedStyles:["background-color","color","fill","border-top-width","border-top-color","border-bottom-width","border-bottom-color","border-left-width","border-left-color","border-right-width","border-right-color","font-family","font-size","font-weight","line-height","position","top","right","bottom","left","display","width","height","vertical-align"],includeTextColorOpacities:!0,includeBlendedBackgroundColors:!0});for(const{nodes:b,layout:S}of g){m+=S.nodeIndex.length;for(let m=0;m=o)){const t={nodeId:y,contrastRatio:e,textColor:i,backgroundColor:X,thresholdsViolated:{aa:!1,aaa:!1,apca:!0}};n.has(r)?n.get(r).push(t):n.set(r,[t])}}else{const e=t.contrastRatioThreshold("aa")||0,o=t.contrastRatioThreshold("aaa")||0,s=t.contrastRatio()||0;if(e>s||o>s){const t={nodeId:y,contrastRatio:s,textColor:i,backgroundColor:X,thresholdsViolated:{aa:e>s,aaa:o>s,apca:!1}};n.has(r)?n.get(r).push(t):n.set(r,[t])}}}w.checkForUnusedPositionValues(d,y,f,D,z,U,W,B),u(f[x])||v(f[x])||w.checkForUnusedWidthAndHeightValues(d,y,f,q,H,G),-1===j||p(f[x],f[q])||w.checkForInvalidVerticalAlignment(d,y,f,q,j)}}return{backgroundColors:t,textColors:i,textColorContrastIssues:n,fillColors:r,borderColors:a,fontInfo:l,unusedDeclarations:d,elementCount:m}}getComputedStyleForNode(e){return this.#t.invoke_getComputedStyleForNode({nodeId:e})}async getMediaQueries(){const e=await this.#t.invoke_getMediaQueries(),t=new Map;if(!e)return t;for(const i of e.medias){if("linkedSheet"===i.source)continue;const e=t.get(i.text)||[];e.push(i),t.set(i.text,e)}return t}async getGlobalStylesheetStats(){const{result:e}=await this.#e.invoke_evaluate({expression:"(function() {\n let styleRules = 0;\n let inlineStyles = 0;\n let externalSheets = 0;\n const stats = {\n // Simple.\n type: new Set(),\n class: new Set(),\n id: new Set(),\n universal: new Set(),\n attribute: new Set(),\n\n // Non-simple.\n nonSimple: new Set()\n };\n\n for (const styleSheet of document.styleSheets) {\n if (styleSheet.href) {\n externalSheets++;\n } else {\n inlineStyles++;\n }\n\n // Attempting to grab rules can trigger a DOMException.\n // Try it and if it fails skip to the next stylesheet.\n let rules;\n try {\n rules = styleSheet.rules;\n } catch (err) {\n continue;\n }\n\n for (const rule of rules) {\n if ('selectorText' in rule) {\n styleRules++;\n\n // Each group that was used.\n for (const selectorGroup of rule.selectorText.split(',')) {\n // Each selector in the group.\n for (const selector of selectorGroup.split(/[\\t\\n\\f\\r ]+/g)) {\n if (selector.startsWith('.')) {\n // Class.\n stats.class.add(selector);\n } else if (selector.startsWith('#')) {\n // Id.\n stats.id.add(selector);\n } else if (selector.startsWith('*')) {\n // Universal.\n stats.universal.add(selector);\n } else if (selector.startsWith('[')) {\n // Attribute.\n stats.attribute.add(selector);\n } else {\n // Type or non-simple selector.\n const specialChars = /[#.:\\[\\]|\\+>~]/;\n if (specialChars.test(selector)) {\n stats.nonSimple.add(selector);\n } else {\n stats.type.add(selector);\n }\n }\n }\n }\n }\n }\n }\n\n return {\n styleRules,\n inlineStyles,\n externalSheets,\n stats: {\n // Simple.\n type: stats.type.size,\n class: stats.class.size,\n id: stats.id.size,\n universal: stats.universal.size,\n attribute: stats.attribute.size,\n\n // Non-simple.\n nonSimple: stats.nonSimple.size\n }\n }\n })()",returnByValue:!0});if("object"===e.type)return e.value}}t.SDKModel.SDKModel.register(b,{capabilities:t.Target.Capability.DOM,autostart:!1});var S=Object.freeze({__proto__:null,CSSOverviewModel:b});const C=new CSSStyleSheet;C.replaceSync(".overview-processing-view{overflow:hidden;padding:16px;justify-content:center;align-items:center;height:100%}.overview-processing-view h1{font-size:16px;text-align:center;font-weight:400;margin:0;padding:8px}.overview-processing-view h2{font-size:12px;text-align:center;font-weight:400;margin:0;padding-top:32px}\n/*# sourceURL=cssOverviewProcessingView.css */\n");const y={cancel:"Cancel"},x=i.i18n.registerUIStrings("panels/css_overview/CSSOverviewProcessingView.ts",y),k=i.i18n.getLocalizedString.bind(void 0,x);class I extends n.Widget.Widget{#n;#r;fragment;constructor(e){super(),this.#n=new Intl.NumberFormat("en-US"),this.#r=e,this.render()}render(){const e=n.UIUtils.createTextButton(k(y.cancel),(()=>this.#r.dispatchEventToListeners("RequestOverviewCancel")),"",!0);this.setDefaultFocusedElement(e),this.fragment=n.Fragment.Fragment.build`
+
+
Processing page
+
${e}
+
+ `,this.contentElement.appendChild(this.fragment.element()),this.contentElement.style.overflow="auto"}wasShown(){super.wasShown(),this.registerCSSFiles([C])}}var $=Object.freeze({__proto__:null,CSSOverviewProcessingView:I});const T=new CSSStyleSheet;T.replaceSync('.overview-completed-view{overflow:auto;--overview-default-padding:28px;--overview-icon-padding:32px}.overview-completed-view .colors ul,.overview-completed-view .summary ul{display:flex;flex-wrap:wrap;list-style:none;margin:0;padding:0}.overview-completed-view .summary ul{display:grid;grid-template-columns:repeat(auto-fill,140px);grid-gap:16px}.overview-completed-view .colors ul li{display:inline-block;margin:0 0 16px;padding:0 8px 0 0}.overview-completed-view .summary ul li{display:flex;flex-direction:column;grid-column-start:auto}.overview-completed-view li .label{font-size:12px;padding-bottom:2px}.overview-completed-view li .value{font-size:17px}.overview-completed-view ul li span{font-weight:700}.unused-rules-grid .data-container,.unused-rules-grid .header-container,.unused-rules-grid table.data{position:relative}.unused-rules-grid .data-container{top:0;max-height:350px}.unused-rules-grid{border-left:none;border-right:none}.unused-rules-grid .monospace{display:block;height:18px}.element-grid{flex:1;border-left:none;border-right:none;overflow:auto}.block{width:65px;height:25px;border-radius:3px;margin-right:16px;cursor:pointer}.block-title{padding-top:4px;font-size:12px;color:var(--color-text-primary);text-transform:uppercase;letter-spacing:0}.results-section{flex-shrink:0;border-bottom:1px solid var(--color-details-hairline);padding:var(--overview-default-padding) 0 var(--overview-default-padding) 0}.horizontally-padded{padding-left:var(--overview-default-padding);padding-right:var(--overview-default-padding)}.results-section h1{font-size:15px;font-weight:400;padding:0;margin:0 0 20px;padding-left:calc(var(--overview-default-padding) + var(--overview-icon-padding));position:relative;height:26px;line-height:26px}.results-section h1::before{content:"";display:block;position:absolute;left:var(--overview-default-padding);top:0;width:26px;height:26px;background-image:var(--image-file-cssoverview_icons_2x);background-size:104px 26px}.results-section.horizontally-padded h1{padding-left:var(--overview-icon-padding)}.results-section.horizontally-padded h1::before{left:0}.results-section.summary h1{padding-left:0}.results-section.summary h1::before{display:none}.results-section.colors h1::before{background-position:0 0}.results-section.font-info h1::before{background-position:-26px 0}.results-section.unused-declarations h1::before{background-position:-52px 0}.results-section.media-queries h1::before{background-position:-78px 0}.results-section.colors h2{margin-top:20px;font-size:13px;font-weight:400}.overview-completed-view .font-info ul,.overview-completed-view .media-queries ul,.overview-completed-view .unused-declarations ul{width:100%;list-style:none;margin:0;padding:0 var(--overview-default-padding)}.overview-completed-view .font-info ul li,.overview-completed-view .media-queries ul li,.overview-completed-view .unused-declarations ul li{display:grid;grid-template-columns:2fr 3fr;grid-gap:12px;margin-bottom:4px;align-items:center}.overview-completed-view .font-info button,.overview-completed-view .media-queries button,.overview-completed-view .unused-declarations button{border:none;padding:0;margin:0;display:flex;align-items:center;border-radius:2px;cursor:pointer;height:28px;background:0 0}.overview-completed-view .font-info button .details,.overview-completed-view .media-queries button .details,.overview-completed-view .unused-declarations button .details{min-width:100px;text-align:right;margin-right:8px;color:var(--color-primary);pointer-events:none}.overview-completed-view .font-info button .bar-container,.overview-completed-view .media-queries button .bar-container,.overview-completed-view .unused-declarations button .bar-container{flex:1;pointer-events:none}.overview-completed-view .font-info button .bar,.overview-completed-view .media-queries button .bar,.overview-completed-view .unused-declarations button .bar{height:8px;background:var(--color-primary);border-radius:2px;min-width:2px}.overview-completed-view .font-info button:focus .details,.overview-completed-view .font-info button:hover .details,.overview-completed-view .media-queries button:focus .details,.overview-completed-view .media-queries button:hover .details,.overview-completed-view .unused-declarations button:focus .details,.overview-completed-view .unused-declarations button:hover .details{color:var(--color-primary-variant)}.overview-completed-view .font-info button:focus .bar,.overview-completed-view .font-info button:hover .bar,.overview-completed-view .media-queries button:focus .bar,.overview-completed-view .media-queries button:hover .bar,.overview-completed-view .unused-declarations button:focus .bar,.overview-completed-view .unused-declarations button:hover .bar{background-color:var(--color-primary-variant);box-shadow:0 1px 2px var(--divider-line),0 0 0 2px var(--color-primary-variant);color:var(--color-background)}.overview-completed-view .font-info .font-metric{display:grid;grid-template-columns:1fr 1fr 1fr;grid-gap:12px}.overview-completed-view .font-info ul{padding:0}.overview-completed-view .font-info ul li{grid-template-columns:1fr 4fr}.overview-completed-view .font-info h2{font-size:14px;font-weight:700;margin:0 0 1em}.overview-completed-view .font-info h3{font-size:13px;font-weight:400;font-style:italic;margin:0 0 .5em}.overview-completed-view .font-info{padding-bottom:0}.overview-completed-view .font-family{padding:var(--overview-default-padding)}.overview-completed-view .font-family:nth-child(2n+1){background:var(--color-background)}.overview-completed-view .font-family:first-of-type{padding-top:0}.contrast-warning{display:flex;align-items:baseline}.contrast-warning .threshold-label{font-weight:400;width:30px}.contrast-warning [is=ui-icon]{margin-left:5px}.contrast-preview{padding:0 5px}.contrast-container-in-grid{display:flex;align-items:baseline}.contrast-container-in-grid>*{margin-right:5px;min-width:initial}[is=ui-icon].smallicon-checkmark-square{background-color:var(--color-green)}[is=ui-icon].smallicon-no{background-color:var(--color-red)}.data .nodeId-column{align-items:center;display:flex;height:20px}.show-element{margin:0 0 0 8px;padding:0;background:0 0;border:none;-webkit-mask-image:var(--image-file-ic_show_node_16x16);background-color:var(--color-text-secondary);width:16px;height:16px;display:none;cursor:pointer;flex:none}.show-element:focus,.show-element:hover{background-color:var(--color-primary)}.nodeId-column:focus-within .show-element,.nodeId-column:hover .show-element{display:inline-block}\n/*# sourceURL=cssOverviewCompletedView.css */\n');const M=new CSSStyleSheet;M.replaceSync(".overview-sidebar-panel{overflow:auto;display:flex;background:var(--color-background-elevation-1)}.overview-sidebar-panel-item{height:30px;padding-left:30px;display:flex;align-items:center;cursor:pointer;color:var(--color-text-primary)}.overview-sidebar-panel-item:focus,.overview-sidebar-panel-item:hover{background:var(--color-background-highlight)}.overview-sidebar-panel-item.selected{background:var(--color-primary);color:var(--color-background)}.overview-toolbar{border-bottom:1px solid var(--color-details-hairline)}\n/*# sourceURL=cssOverviewSidebarPanel.css */\n");const A={clearOverview:"Clear overview"},E=i.i18n.registerUIStrings("panels/css_overview/CSSOverviewSidebarPanel.ts",A),F=i.i18n.getLocalizedString.bind(void 0,E);class L extends(e.ObjectWrapper.eventMixin(n.Widget.VBox)){static get ITEM_CLASS_NAME(){return"overview-sidebar-panel-item"}static get SELECTED(){return"selected"}constructor(){super(!0),this.contentElement.classList.add("overview-sidebar-panel"),this.contentElement.addEventListener("click",this.onItemClick.bind(this));const e=new n.Toolbar.ToolbarButton(F(A.clearOverview),"largeicon-clear");e.addEventListener(n.Toolbar.ToolbarButton.Events.Click,this.reset,this);const t=this.contentElement.createChild("div","overview-toolbar");new n.Toolbar.Toolbar("",t).appendToolbarItem(e)}addItem(e,t){const i=this.contentElement.createChild("div",L.ITEM_CLASS_NAME);i.textContent=e,i.dataset.id=t}reset(){this.dispatchEventToListeners("Reset")}deselectAllItems(){this.contentElement.querySelectorAll(`.${L.ITEM_CLASS_NAME}`).forEach((e=>{e.classList.remove(L.SELECTED)}))}onItemClick(e){const t=e.composedPath()[0];if(!t.classList.contains(L.ITEM_CLASS_NAME))return;const{id:i}=t.dataset;i&&(this.select(i),this.dispatchEventToListeners("ItemSelected",i))}select(e){const t=this.contentElement.querySelector(`[data-id=${CSS.escape(e)}]`);t&&(t.classList.contains(L.SELECTED)||(this.deselectAllItems(),t.classList.add(L.SELECTED)))}wasShown(){super.wasShown(),this.registerCSSFiles([M])}}var O=Object.freeze({__proto__:null,CSSOverviewSidebarPanel:L});const R={overviewSummary:"Overview summary",colors:"Colors",fontInfo:"Font info",unusedDeclarations:"Unused declarations",mediaQueries:"Media queries",elements:"Elements",externalStylesheets:"External stylesheets",inlineStyleElements:"Inline style elements",styleRules:"Style rules",typeSelectors:"Type selectors",idSelectors:"ID selectors",classSelectors:"Class selectors",universalSelectors:"Universal selectors",attributeSelectors:"Attribute selectors",nonsimpleSelectors:"Non-simple selectors",backgroundColorsS:"Background colors: {PH1}",textColorsS:"Text colors: {PH1}",fillColorsS:"Fill colors: {PH1}",borderColorsS:"Border colors: {PH1}",thereAreNoFonts:"There are no fonts.",thereAreNoUnusedDeclarations:"There are no unused declarations.",thereAreNoMediaQueries:"There are no media queries.",contrastIssues:"Contrast issues",nOccurrences:"{n, plural, =1 {# occurrence} other {# occurrences}}",contrastIssuesS:"Contrast issues: {PH1}",textColorSOverSBackgroundResults:"Text color {PH1} over {PH2} background results in low contrast for {PH3} elements",aa:"AA",aaa:"AAA",apca:"APCA",element:"Element",declaration:"Declaration",source:"Source",contrastRatio:"Contrast ratio",cssOverviewElements:"CSS Overview Elements",showElement:"Show element"},V=i.i18n.registerUIStrings("panels/css_overview/CSSOverviewCompletedView.ts",R),_=i.i18n.getLocalizedString.bind(void 0,V);function N(e){let[t,i,o]=e.hsla();return t=Math.round(360*t),i=Math.round(100*i),o=Math.round(100*o),o=Math.max(0,o-15),`1px solid hsl(${t}deg ${i}% ${o}%)`}class P extends n.Panel.PanelWithSidebar{#r;#n;#a;#l;#d;#c;#h;#u;#v;#p;#m;#g;constructor(e){super("css_overview_completed_view"),this.#r=e,this.#n=new Intl.NumberFormat("en-US"),this.#a=new n.SplitWidget.SplitWidget(!0,!0),this.#l=new n.Widget.VBox,this.#d=new D,this.#d.addEventListener("TabClosed",(e=>{0===e.data&&this.#a.setSidebarMinimized(!0)})),this.#a.setMainWidget(this.#l),this.#a.setSidebarWidget(this.#d),this.#a.setVertical(!1),this.#a.setSecondIsSidebar(!0),this.#a.setSidebarMinimized(!0),this.#c=new L,this.splitWidget().setSidebarWidget(this.#c),this.splitWidget().setMainWidget(this.#a),this.#v=new d.Linkifier.Linkifier(20,!0),this.#p=new Map,this.#c.addItem(_(R.overviewSummary),"summary"),this.#c.addItem(_(R.colors),"colors"),this.#c.addItem(_(R.fontInfo),"font-info"),this.#c.addItem(_(R.unusedDeclarations),"unused-declarations"),this.#c.addItem(_(R.mediaQueries),"media-queries"),this.#c.select("summary"),this.#c.addEventListener("ItemSelected",this.sideBarItemSelected,this),this.#c.addEventListener("Reset",this.sideBarReset,this),this.#r.addEventListener("Reset",this.reset,this),this.#r.addEventListener("PopulateNodes",this.createElementsView,this),this.#l.element.addEventListener("click",this.onClick.bind(this)),this.#m=null}wasShown(){super.wasShown(),this.#a.registerCSSFiles([T]),this.registerCSSFiles([T])}initializeModels(e){const i=e.model(t.CSSModel.CSSModel),o=e.model(t.DOMModel.DOMModel);if(!i||!o)throw new Error("Target must provide CSS and DOM models");this.#h=i,this.#u=o}sideBarItemSelected(e){const{data:t}=e,i=this.#g.$(t);i&&i.scrollIntoView()}sideBarReset(){this.#r.dispatchEventToListeners("Reset")}reset(){this.#l.element.removeChildren(),this.#a.setSidebarMinimized(!0),this.#d.closeTabs(),this.#p=new Map,P.pushedNodes.clear(),this.#c.select("summary")}onClick(e){if(!e.target)return;const t=e.target.dataset,i=t.type;if(!i||!this.#m)return;let o;switch(i){case"contrast":{const e=t.section,s=t.key;if(!s)return;o={type:i,key:s,nodes:this.#m.textColorContrastIssues.get(s)||[],section:e};break}case"color":{const e=t.color,s=t.section;if(!e)return;let n;switch(s){case"text":n=this.#m.textColors.get(e);break;case"background":n=this.#m.backgroundColors.get(e);break;case"fill":n=this.#m.fillColors.get(e);break;case"border":n=this.#m.borderColors.get(e)}if(!n)return;n=Array.from(n).map((e=>({nodeId:e}))),o={type:i,color:e,nodes:n,section:s};break}case"unused-declarations":{const e=t.declaration;if(!e)return;const s=this.#m.unusedDeclarations.get(e);if(!s)return;o={type:i,declaration:e,nodes:s};break}case"media-queries":{const e=t.text;if(!e)return;const s=this.#m.mediaQueries.get(e);if(!s)return;o={type:i,text:e,nodes:s};break}case"font-info":{const e=t.value;if(!t.path)return;const[s,n]=t.path.split("/");if(!e)return;const r=this.#m.fontInfo.get(s);if(!r)return;const a=r.get(n);if(!a)return;const l=a.get(e);if(!l)return;o={type:i,name:`${e} (${s}, ${n})`,nodes:l.map((e=>({nodeId:e})))};break}default:return}e.consume(),this.#r.dispatchEventToListeners("PopulateNodes",{payload:o}),this.#a.setSidebarMinimized(!1)}onMouseOver(e){const t=e.composedPath().find((e=>e.dataset&&e.dataset.backendNodeId));if(!t)return;const i=Number(t.dataset.backendNodeId);this.#r.dispatchEventToListeners("RequestNodeHighlight",i)}async render(e){if(!e||!("backgroundColors"in e)||!("textColors"in e))return;this.#m=e;const{elementCount:t,backgroundColors:i,textColors:o,textColorContrastIssues:s,fillColors:r,borderColors:a,globalStyleStats:l,mediaQueries:d,unusedDeclarations:c,fontInfo:h}=this.#m,u=this.sortColorsByLuminance(i),v=this.sortColorsByLuminance(o),p=this.sortColorsByLuminance(r),m=this.sortColorsByLuminance(a);this.#g=n.Fragment.Fragment.build`
+
+
+
${_(R.overviewSummary)}
+
+
+ -
+
${_(R.elements)}
+ ${this.#n.format(t)}
+
+ -
+
${_(R.externalStylesheets)}
+ ${this.#n.format(l.externalSheets)}
+
+ -
+
${_(R.inlineStyleElements)}
+ ${this.#n.format(l.inlineStyles)}
+
+ -
+
${_(R.styleRules)}
+ ${this.#n.format(l.styleRules)}
+
+ -
+
${_(R.mediaQueries)}
+ ${this.#n.format(d.size)}
+
+ -
+
${_(R.typeSelectors)}
+ ${this.#n.format(l.stats.type)}
+
+ -
+
${_(R.idSelectors)}
+ ${this.#n.format(l.stats.id)}
+
+ -
+
${_(R.classSelectors)}
+ ${this.#n.format(l.stats.class)}
+
+ -
+
${_(R.universalSelectors)}
+ ${this.#n.format(l.stats.universal)}
+
+ -
+
${_(R.attributeSelectors)}
+ ${this.#n.format(l.stats.attribute)}
+
+ -
+
${_(R.nonsimpleSelectors)}
+ ${this.#n.format(l.stats.nonSimple)}
+
+
+
+
+
+
${_(R.colors)}
+
${_(R.backgroundColorsS,{PH1:u.length})}
+
+ ${u.map(this.colorsToFragment.bind(this,"background"))}
+
+
+
${_(R.textColorsS,{PH1:v.length})}
+
+ ${v.map(this.colorsToFragment.bind(this,"text"))}
+
+
+ ${s.size>0?this.contrastIssuesToFragment(s):""}
+
+
${_(R.fillColorsS,{PH1:p.length})}
+
+ ${p.map(this.colorsToFragment.bind(this,"fill"))}
+
+
+
${_(R.borderColorsS,{PH1:m.length})}
+
+ ${m.map(this.colorsToFragment.bind(this,"border"))}
+
+
+
+
+
${_(R.fontInfo)}
+ ${h.size>0?this.fontInfoToFragment(h):n.Fragment.Fragment.build`
${_(R.thereAreNoFonts)}
`}
+
+
+
+
${_(R.unusedDeclarations)}
+ ${c.size>0?this.groupToFragment(c,"unused-declarations","declaration"):n.Fragment.Fragment.build`
${_(R.thereAreNoUnusedDeclarations)}
`}
+
+
+
+
`,this.#l.element.appendChild(this.#g.element())}createElementsView(e){const{payload:t}=e.data;let i="",o="";switch(t.type){case"contrast":{const{section:e,key:s}=t;i=`${e}-${s}`,o=_(R.contrastIssues);break}case"color":{const{section:e,color:s}=t;i=`${e}-${s}`,o=`${s.toUpperCase()} (${e})`;break}case"unused-declarations":{const{declaration:e}=t;i=`${e}`,o=`${e}`;break}case"media-queries":{const{text:e}=t;i=`${e}`,o=`${e}`;break}case"font-info":{const{name:e}=t;i=`${e}`,o=`${e}`;break}}let s=this.#p.get(i);if(!s){if(!this.#u||!this.#h)throw new Error("Unable to initialize CSS Overview, missing models");s=new z(this.#r,this.#u,this.#h,this.#v),s.populateNodes(t.nodes),this.#p.set(i,s)}this.#d.appendTab(i,o,s,!0)}fontInfoToFragment(e){const t=Array.from(e.entries());return n.Fragment.Fragment.build`
+ ${t.map((([e,t])=>n.Fragment.Fragment.build`${e}
${this.fontMetricsToFragment(e,t)}`))}
+ `}fontMetricsToFragment(e,t){const i=Array.from(t.entries());return n.Fragment.Fragment.build`
+
+ ${i.map((([t,i])=>{const o=`${e}/${t}`;return n.Fragment.Fragment.build`
+
+
${t}
+ ${this.groupToFragment(i,"font-info","value",o)}
+ `}))}
+
`}groupToFragment(e,t,i,o=""){const s=Array.from(e.entries()).sort(((e,t)=>{const i=e[1];return t[1].length-i.length})),r=s.reduce(((e,t)=>e+t[1].length),0);return n.Fragment.Fragment.build`
+ ${s.map((([e,s])=>{const a=100*s.length/r,l=_(R.nOccurrences,{n:s.length});return n.Fragment.Fragment.build`-
+
${e}
+
+ `}))}
+
`}contrastIssuesToFragment(e){return n.Fragment.Fragment.build`
+ ${_(R.contrastIssuesS,{PH1:e.size})}
+
+ ${[...e.entries()].map((([e,t])=>this.contrastIssueToFragment(e,t)))}
+
+ `}contrastIssueToFragment(t,i){console.assert(i.length>0);let s=i[0];for(const e of i)Math.abs(e.contrastRatio)
+
+
+
${_(R.aa)}
+
${_(R.aaa)}
+
${_(R.apca)}
+
+ `;if(l){const e=d.$("apca");s.thresholdsViolated.apca?e.appendChild(n.Icon.Icon.create("smallicon-no")):e.appendChild(n.Icon.Icon.create("smallicon-checkmark-square")),e.classList.remove("hidden")}else{const e=d.$("aa");s.thresholdsViolated.aa?e.appendChild(n.Icon.Icon.create("smallicon-no")):e.appendChild(n.Icon.Icon.create("smallicon-checkmark-square"));const t=d.$("aaa");s.thresholdsViolated.aaa?t.appendChild(n.Icon.Icon.create("smallicon-no")):t.appendChild(n.Icon.Icon.create("smallicon-checkmark-square")),e.classList.remove("hidden"),t.classList.remove("hidden")}const c=d.$("color");return c.style.backgroundColor=a,c.style.color=r,c.style.border=N(s.backgroundColor),d}colorsToFragment(t,i){const o=n.Fragment.Fragment.build`
+
+ ${i}
+ `,s=o.$("color");s.style.backgroundColor=i;const r=e.Color.Color.parse(i);if(r)return s.style.border=N(r),o}sortColorsByLuminance(t){return Array.from(t.keys()).sort(((t,i)=>{const o=e.Color.Color.parse(t),s=e.Color.Color.parse(i);return o&&s?e.ColorUtils.luminance(s.rgba())-e.ColorUtils.luminance(o.rgba()):0}))}setOverviewData(e){this.render(e)}static pushedNodes=new Set}class D extends(e.ObjectWrapper.eventMixin(n.Widget.VBox)){#w;constructor(){super(),this.#w=new n.TabbedPane.TabbedPane,this.#w.show(this.element),this.#w.addEventListener(n.TabbedPane.Events.TabClosed,(()=>{this.dispatchEventToListeners("TabClosed",this.#w.tabIds().length)}))}appendTab(e,t,i,o){this.#w.hasTab(e)||this.#w.appendTab(e,t,i,void 0,void 0,o),this.#w.selectTab(e)}closeTabs(){this.#w.closeTabs(this.#w.tabIds())}}class z extends n.Widget.Widget{#r;#u;#h;#v;#f;#b;constructor(e,t,i,o){super(),this.#r=e,this.#u=t,this.#h=i,this.#v=o,this.#f=[{id:"nodeId",title:_(R.element),sortable:!0,weight:50,titleDOMFragment:void 0,sort:void 0,align:void 0,width:void 0,fixedWidth:void 0,editable:void 0,nonSelectable:void 0,longText:void 0,disclosure:void 0,allowInSortByEvenWhenHidden:void 0,dataType:void 0,defaultWeight:void 0},{id:"declaration",title:_(R.declaration),sortable:!0,weight:50,titleDOMFragment:void 0,sort:void 0,align:void 0,width:void 0,fixedWidth:void 0,editable:void 0,nonSelectable:void 0,longText:void 0,disclosure:void 0,allowInSortByEvenWhenHidden:void 0,dataType:void 0,defaultWeight:void 0},{id:"sourceURL",title:_(R.source),sortable:!1,weight:100,titleDOMFragment:void 0,sort:void 0,align:void 0,width:void 0,fixedWidth:void 0,editable:void 0,nonSelectable:void 0,longText:void 0,disclosure:void 0,allowInSortByEvenWhenHidden:void 0,dataType:void 0,defaultWeight:void 0},{id:"contrastRatio",title:_(R.contrastRatio),sortable:!0,weight:25,titleDOMFragment:void 0,sort:void 0,align:void 0,width:"150px",fixedWidth:!0,editable:void 0,nonSelectable:void 0,longText:void 0,disclosure:void 0,allowInSortByEvenWhenHidden:void 0,dataType:void 0,defaultWeight:void 0}],this.#b=new l.SortableDataGrid.SortableDataGrid({displayName:_(R.cssOverviewElements),columns:this.#f,editCallback:void 0,deleteCallback:void 0,refreshCallback:void 0}),this.#b.element.classList.add("element-grid"),this.#b.element.addEventListener("mouseover",this.onMouseOver.bind(this)),this.#b.setStriped(!0),this.#b.addEventListener(l.DataGrid.Events.SortingChanged,this.sortMediaQueryDataGrid.bind(this)),this.#b.asWidget().show(this.element)}sortMediaQueryDataGrid(){const e=this.#b.sortColumnId();if(!e)return;const t=l.SortableDataGrid.SortableDataGrid.StringComparator.bind(null,e);this.#b.sortNodes(t,!this.#b.isSortOrderAscending())}onMouseOver(e){const t=e.composedPath().find((e=>e.dataset&&e.dataset.backendNodeId));if(!t)return;const i=Number(t.dataset.backendNodeId);this.#r.dispatchEventToListeners("RequestNodeHighlight",i)}async populateNodes(e){if(this.#b.rootNode().removeChildren(),!e.length)return;const[t]=e,i=new Set;let o;if("nodeId"in t&&t.nodeId&&i.add("nodeId"),"declaration"in t&&t.declaration&&i.add("declaration"),"sourceURL"in t&&t.sourceURL&&i.add("sourceURL"),"contrastRatio"in t&&t.contrastRatio&&i.add("contrastRatio"),"nodeId"in t&&i.has("nodeId")){const t=e.reduce(((e,t)=>{const i=t.nodeId;return P.pushedNodes.has(i)?e:(P.pushedNodes.add(i),e.add(i))}),new Set);o=await this.#u.pushNodesByBackendIdsToFrontend(t)}for(const t of e){let e;if("nodeId"in t&&i.has("nodeId")){if(!o)continue;if(e=o.get(t.nodeId),!e)continue}const s=new W(t,e,this.#v,this.#h);s.selectable=!1,this.#b.insertChild(s)}this.#b.setColumnsVisiblity(i),this.#b.renderInline(),this.#b.wasShown()}}class W extends l.SortableDataGrid.SortableDataGridNode{#v;#h;#S;constructor(e,t,i,o){super(e),this.#S=t,this.#v=i,this.#h=o}createCell(t){const i=this.#S;if("nodeId"===t){const o=this.createTD(t);if(o.textContent="...",!i)throw new Error("Node entry is missing a related frontend node.");return e.Linkifier.Linkifier.linkify(i).then((e=>{o.textContent="",e.dataset.backendNodeId=i.backendNodeId().toString(),o.appendChild(e);const t=document.createElement("button");t.classList.add("show-element"),n.Tooltip.Tooltip.install(t,_(R.showElement)),t.tabIndex=0,t.onclick=()=>this.data.node.scrollIntoView(),o.appendChild(t)})),o}if("sourceURL"===t){const e=this.createTD(t);if(this.data.range){const t=this.linkifyRuleLocation(this.#h,this.#v,this.data.styleSheetId,a.TextRange.TextRange.fromObject(this.data.range));t&&""!==t.textContent?e.appendChild(t):e.textContent="(unable to link)"}else e.textContent="(unable to link to inlined styles)";return e}if("contrastRatio"===t){const e=this.createTD(t),i=o.Runtime.experiments.isEnabled("APCA"),s=r.NumberUtilities.floor(this.data.contrastRatio,2),a=i?s+"%":s,l=N(this.data.backgroundColor),d=this.data.textColor.asString(),c=this.data.backgroundColor.asString(),h=n.Fragment.Fragment.build`
+
+ Aa
+ ${a}
+
+ `,u=h.$("container");return i?(u.append(n.Fragment.Fragment.build`${_(R.apca)}`.element()),this.data.thresholdsViolated.apca?u.appendChild(n.Icon.Icon.create("smallicon-no")):u.appendChild(n.Icon.Icon.create("smallicon-checkmark-square"))):(u.append(n.Fragment.Fragment.build`${_(R.aa)}`.element()),this.data.thresholdsViolated.aa?u.appendChild(n.Icon.Icon.create("smallicon-no")):u.appendChild(n.Icon.Icon.create("smallicon-checkmark-square")),u.append(n.Fragment.Fragment.build`${_(R.aaa)}`.element()),this.data.thresholdsViolated.aaa?u.appendChild(n.Icon.Icon.create("smallicon-no")):u.appendChild(n.Icon.Icon.create("smallicon-checkmark-square"))),e.appendChild(h.element()),e}return super.createCell(t)}linkifyRuleLocation(e,i,o,s){const n=e.styleSheetHeaderForId(o);if(!n)return;const r=n.lineNumberInSource(s.startLine),a=n.columnNumberInSource(s.startLine,s.startColumn),l=new t.CSSModel.CSSLocation(n,r,a);return i.linkifyCSSLocation(l)}}var B=Object.freeze({__proto__:null,CSSOverviewCompletedView:P,DetailsView:D,ElementDetailsView:z,ElementNode:W});const U=new CSSStyleSheet;let q;U.replaceSync(".css-overview-panel{overflow:hidden}\n/*# sourceURL=cssOverview.css */\n");class H extends n.Panel.Panel{#r;#C;#y;#x;#k;#I;#$;#T;#M;#A;#E;#F;#L;#O;#R;#V;#_;constructor(){super("css_overview"),this.element.classList.add("css-overview-panel"),this.#r=new u,this.#C=new c.CSSOverviewStartView.CSSOverviewStartView,this.#C.addEventListener("overviewstartrequested",(()=>this.#r.dispatchEventToListeners("RequestOverviewStart"))),this.#y=new I(this.#r),this.#x=new P(this.#r),t.TargetManager.TargetManager.instance().observeTargets(this),this.#r.addEventListener("RequestOverviewStart",(e=>{h.userMetrics.actionTaken(h.UserMetrics.Action.CaptureCssOverviewClicked),this.startOverview()}),this),this.#r.addEventListener("RequestOverviewCancel",this.cancelOverview,this),this.#r.addEventListener("OverviewCompleted",this.overviewCompleted,this),this.#r.addEventListener("Reset",this.reset,this),this.#r.addEventListener("RequestNodeHighlight",this.requestNodeHighlight,this),this.reset()}static instance(){return q||(q=new H),q}targetAdded(e){if(this.#I)return;this.#I=e,this.#x.initializeModels(e);const[i]=t.TargetManager.TargetManager.instance().models(b);this.#k=i}targetRemoved(){}getModel(){if(!this.#k)throw new Error("Did not retrieve model information yet.");return this.#k}reset(){this.#$=new Map,this.#T=new Map,this.#M=new Map,this.#A=new Map,this.#E=new Map,this.#F=new Map,this.#L=new Map,this.#O=0,this.#R=!1,this.#V={styleRules:0,inlineStyles:0,externalSheets:0,stats:{type:0,class:0,id:0,universal:0,attribute:0,nonSimple:0}},this.#_=new Map,this.renderInitialView()}requestNodeHighlight(e){this.getModel().highlightNode(e.data)}renderInitialView(){this.#y.hideWidget(),this.#x.hideWidget(),this.contentElement.append(this.#C),this.#C.show()}renderOverviewStartedView(){this.#C.hide(),this.#x.hideWidget(),this.#y.show(this.contentElement)}renderOverviewCompletedView(){this.#C.hide(),this.#y.hideWidget(),this.#x.show(this.contentElement),this.#x.setOverviewData({backgroundColors:this.#$,textColors:this.#T,textColorContrastIssues:this.#_,fillColors:this.#M,borderColors:this.#A,globalStyleStats:this.#V,fontInfo:this.#E,elementCount:this.#O,mediaQueries:this.#F,unusedDeclarations:this.#L})}async startOverview(){this.renderOverviewStartedView();const e=this.getModel(),[t,{elementCount:i,backgroundColors:o,textColors:s,textColorContrastIssues:n,fillColors:r,borderColors:a,fontInfo:l,unusedDeclarations:d},c]=await Promise.all([e.getGlobalStylesheetStats(),e.getNodeStyleStats(),e.getMediaQueries()]);i&&(this.#O=i),t&&(this.#V=t),c&&(this.#F=c),o&&(this.#$=o),s&&(this.#T=s),n&&(this.#_=n),r&&(this.#M=r),a&&(this.#A=a),l&&(this.#E=l),d&&(this.#L=d),this.#r.dispatchEventToListeners("OverviewCompleted")}getStyleValue(e,t){const i=e.filter((e=>e.name===t));if(i.length)return i[0].value}cancelOverview(){this.#R=!0}overviewCompleted(){this.renderOverviewCompletedView()}wasShown(){super.wasShown(),this.registerCSSFiles([U])}}var G=Object.freeze({__proto__:null,CSSOverviewPanel:H});export{B as CSSOverviewCompletedView,v as CSSOverviewController,S as CSSOverviewModel,G as CSSOverviewPanel,$ as CSSOverviewProcessingView,O as CSSOverviewSidebarPanel,f as CSSOverviewUnusedDeclarations};
diff --git a/chii/panels/developer_resources/developer_resources-meta.js b/chii/panels/developer_resources/developer_resources-meta.js
new file mode 100644
index 00000000..8a458afb
--- /dev/null
+++ b/chii/panels/developer_resources/developer_resources-meta.js
@@ -0,0 +1 @@
+import*as e from"../../core/i18n/i18n.js";import*as r from"../../core/root/root.js";import*as o from"../../ui/legacy/legacy.js";const s={developerResources:"Developer Resources",showDeveloperResources:"Show Developer Resources"},i=e.i18n.registerUIStrings("panels/developer_resources/developer_resources-meta.ts",s),t=e.i18n.getLazilyComputedLocalizedString.bind(void 0,i);let n;o.ViewManager.registerViewExtension({location:"drawer-view",id:"resource-loading-pane",title:t(s.developerResources),commandPrompt:t(s.showDeveloperResources),order:100,persistence:"closeable",experiment:r.Runtime.ExperimentName.DEVELOPER_RESOURCES_VIEW,loadView:async()=>(await async function(){return n||(n=await import("./developer_resources.js")),n}()).DeveloperResourcesView.DeveloperResourcesView.instance()});
diff --git a/chii/panels/developer_resources/developer_resources.js b/chii/panels/developer_resources/developer_resources.js
new file mode 100644
index 00000000..e6dbbc50
--- /dev/null
+++ b/chii/panels/developer_resources/developer_resources.js
@@ -0,0 +1 @@
+import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as i from"../../core/sdk/sdk.js";import*as r from"../../ui/legacy/legacy.js";import*as s from"../../core/host/host.js";import*as o from"../../core/platform/platform.js";import*as l from"../../models/text_utils/text_utils.js";import*as a from"../../ui/legacy/components/data_grid/data_grid.js";const n=new CSSStyleSheet;n.replaceSync(".data-grid{border:none}.data-grid td .url-outer{width:100%;display:inline-flex;justify-content:flex-start}.data-grid td .url-outer .filter-highlight{font-weight:700}.data-grid td .url-prefix{overflow-x:hidden;text-overflow:ellipsis}.data-grid td .url-suffix{flex:none}.data-grid td.error-message .filter-highlight{font-weight:700}\n/*# sourceURL=developerResourcesListView.css */\n");const d={status:"Status",url:"URL",initiator:"Initiator",totalBytes:"Total Bytes",error:"Error",developerResources:"Developer Resources",copyUrl:"Copy URL",copyInitiatorUrl:"Copy initiator URL",pending:"pending",success:"success",failure:"failure",sBytes:"{n, plural, =1 {# byte} other {# bytes}}"},h=t.i18n.registerUIStrings("panels/developer_resources/DeveloperResourcesListView.ts",d),c=t.i18n.getLocalizedString.bind(void 0,h);class u extends r.Widget.VBox{nodeForItem;isVisibleFilter;highlightRegExp;dataGrid;constructor(e){super(!0),this.nodeForItem=new Map,this.isVisibleFilter=e,this.highlightRegExp=null;const t=[{id:"status",title:c(d.status),width:"60px",fixedWidth:!0,sortable:!0},{id:"url",title:c(d.url),width:"250px",fixedWidth:!1,sortable:!0},{id:"initiator",title:c(d.initiator),width:"80px",fixedWidth:!1,sortable:!0},{id:"size",title:c(d.totalBytes),width:"80px",fixedWidth:!0,sortable:!0,align:a.DataGrid.Align.Right},{id:"errorMessage",title:c(d.error),width:"200px",fixedWidth:!1,sortable:!0}];this.dataGrid=new a.SortableDataGrid.SortableDataGrid({displayName:c(d.developerResources),columns:t,editCallback:void 0,refreshCallback:void 0,deleteCallback:void 0}),this.dataGrid.setResizeMethod(a.DataGrid.ResizeMethod.Last),this.dataGrid.element.classList.add("flex-auto"),this.dataGrid.addEventListener(a.DataGrid.Events.SortingChanged,this.sortingChanged,this),this.dataGrid.setRowContextMenuCallback(this.populateContextMenu.bind(this));const i=this.dataGrid.asWidget();i.show(this.contentElement),this.setDefaultFocusedChild(i)}populateContextMenu(e,t){const i=t.item;e.clipboardSection().appendItem(c(d.copyUrl),(()=>{s.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(i.url)})),i.initiator.initiatorUrl&&e.clipboardSection().appendItem(c(d.copyInitiatorUrl),(()=>{s.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(i.initiator.initiatorUrl)}))}update(e){let t=!1;const i=this.dataGrid.rootNode();for(const r of e){let e=this.nodeForItem.get(r);e?this.isVisibleFilter(e.item)&&(t=e.refreshIfNeeded()||t):(e=new g(r),this.nodeForItem.set(r,e),this.isVisibleFilter(e.item)&&(i.appendChild(e),t=!0))}t&&this.sortingChanged()}reset(){this.nodeForItem.clear(),this.dataGrid.rootNode().removeChildren()}updateFilterAndHighlight(e){this.highlightRegExp=e;let t=!1;for(const e of this.nodeForItem.values()){const i=this.isVisibleFilter(e.item),r=Boolean(e.parent);i&&e.setHighlight(this.highlightRegExp),i!==r&&(t=!0,i?this.dataGrid.rootNode().appendChild(e):e.remove())}t&&this.sortingChanged()}sortingChanged(){const e=this.dataGrid.sortColumnId();if(!e)return;const t=g.sortFunctionForColumn(e);t&&this.dataGrid.sortNodes(t,!this.dataGrid.isSortOrderAscending())}wasShown(){super.wasShown(),this.registerCSSFiles([n])}}class g extends a.SortableDataGrid.SortableDataGridNode{item;highlightRegExp;constructor(e){super(),this.item=e,this.highlightRegExp=null}setHighlight(e){this.highlightRegExp!==e&&(this.highlightRegExp=e,this.refresh())}refreshIfNeeded(){return this.refresh(),!0}createCell(e){const t=this.createTD(e);switch(e){case"url":{r.Tooltip.Tooltip.install(t,this.item.url);const i=t.createChild("div","url-outer"),s=i.createChild("div","url-prefix"),o=i.createChild("div","url-suffix"),l=/^(.*)(\/[^/]*)$/.exec(this.item.url);s.textContent=l?l[1]:this.item.url,o.textContent=l?l[2]:"",this.highlightRegExp&&this.highlight(i,this.item.url),this.setCellAccessibleName(this.item.url,t,e);break}case"initiator":{const s=this.item.initiator.initiatorUrl||"";t.textContent=s,r.Tooltip.Tooltip.install(t,s),this.setCellAccessibleName(s,t,e),t.onmouseenter=()=>{const e=this.item.initiator.frameId,t=e?i.FrameManager.FrameManager.instance().getFrame(e):null;t&&t.highlight()},t.onmouseleave=()=>i.OverlayModel.OverlayModel.hideDOMNodeHighlight();break}case"status":null===this.item.success?t.textContent=c(d.pending):t.textContent=this.item.success?c(d.success):c(d.failure);break;case"size":{const i=this.item.size;if(null!==i){t.createChild("span").textContent=o.NumberUtilities.withThousandsSeparator(i);const r=c(d.sBytes,{n:i});this.setCellAccessibleName(r,t,e)}break}case"errorMessage":t.classList.add("error-message"),this.item.errorMessage&&(t.textContent=this.item.errorMessage,this.highlightRegExp&&this.highlight(t,this.item.errorMessage))}return t}highlight(e,t){if(!this.highlightRegExp)return;const i=this.highlightRegExp.exec(t);if(!i||!i.length)return;const s=new l.TextRange.SourceRange(i.index,i[0].length);r.UIUtils.highlightRangesWithStyleClass(e,[s],"filter-highlight")}static sortFunctionForColumn(e){const t=e=>null===e?-1:Number(e);switch(e){case"url":return(e,t)=>e.item.url.localeCompare(t.item.url);case"status":return(e,i)=>t(e.item.success)-t(i.item.success);case"size":return(e,i)=>t(e.item.size)-t(i.item.size);case"initiator":return(e,t)=>(e.item.initiator.initiatorUrl||"").localeCompare(t.item.initiator.initiatorUrl||"");case"errorMessage":return(e,t)=>(e.item.errorMessage||"").localeCompare(t.item.errorMessage||"");default:return console.assert(!1,"Unknown sort field: "+e),null}}}const p=new CSSStyleSheet;p.replaceSync(":host{overflow:hidden}.developer-resource-view-toolbar-container{display:flex;border-bottom:1px solid var(--color-details-hairline);flex:0 0 auto}.developer-resource-view-toolbar{display:inline-block;width:100%}.developer-resource-view-toolbar-summary{background-color:var(--color-background-elevation-2);border-top:1px solid var(--color-details-hairline);padding-left:5px;flex:0 0 19px;display:flex;padding-right:5px}.developer-resource-view-toolbar-summary .developer-resource-view-message{padding-top:2px;padding-left:1ex;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.developer-resource-view-results{overflow-y:auto;display:flex;flex:auto}\n/*# sourceURL=developerResourcesView.css */\n");const m={enterTextToSearchTheUrlAndError:"Enter text to search the URL and Error columns",loadHttpsDeveloperResources:"Load `HTTP(S)` developer resources through the inspected target",enableLoadingThroughTarget:"Enable loading through target",resourcesCurrentlyLoading:"{PH1} resources, {PH2} currently loading",resources:"{n, plural, =1 {# resource} other {# resources}}"},x=t.i18n.registerUIStrings("panels/developer_resources/DeveloperResourcesView.ts",m),v=t.i18n.getLocalizedString.bind(void 0,x);let f;class b extends r.Widget.VBox{textFilterRegExp;filterInput;coverageResultsElement;listView;statusToolbarElement;statusMessageElement;throttler;loader;constructor(){super(!0);const t=this.contentElement.createChild("div","developer-resource-view-toolbar-container"),s=new r.Toolbar.Toolbar("developer-resource-view-toolbar",t);this.textFilterRegExp=null;this.filterInput=new r.Toolbar.ToolbarInput(v(m.enterTextToSearchTheUrlAndError),"",1),this.filterInput.addEventListener(r.Toolbar.ToolbarInput.Event.TextChanged,this.onFilterChanged,this),s.appendToolbarItem(this.filterInput);const o=i.PageResourceLoader.getLoadThroughTargetSetting(),l=new r.Toolbar.ToolbarSettingCheckbox(o,v(m.loadHttpsDeveloperResources),v(m.enableLoadingThroughTarget));s.appendToolbarItem(l),this.coverageResultsElement=this.contentElement.createChild("div","developer-resource-view-results"),this.listView=new u(this.isVisible.bind(this)),this.listView.show(this.coverageResultsElement),this.statusToolbarElement=this.contentElement.createChild("div","developer-resource-view-toolbar-summary"),this.statusMessageElement=this.statusToolbarElement.createChild("div","developer-resource-view-message"),this.throttler=new e.Throttler.Throttler(100),this.loader=i.PageResourceLoader.PageResourceLoader.instance(),this.loader.addEventListener(i.PageResourceLoader.Events.Update,this.onUpdate,this),this.onUpdate()}static instance(){return f||(f=new b),f}onUpdate(){this.throttler.schedule(this.update.bind(this))}async update(){this.listView.reset(),this.listView.update(this.loader.getResourcesLoaded().values()),this.updateStats()}updateStats(){const{loading:e,resources:t}=this.loader.getNumberOfResources();this.statusMessageElement.textContent=e>0?v(m.resourcesCurrentlyLoading,{PH1:t,PH2:e}):v(m.resources,{n:t})}isVisible(e){return!this.textFilterRegExp||this.textFilterRegExp.test(e.url)||this.textFilterRegExp.test(e.errorMessage||"")}onFilterChanged(){if(!this.listView)return;const e=this.filterInput.value();this.textFilterRegExp=e?createPlainTextSearchRegex(e,"i"):null,this.listView.updateFilterAndHighlight(this.textFilterRegExp),this.updateStats()}wasShown(){super.wasShown(),this.registerCSSFiles([p])}}var w=Object.freeze({__proto__:null,DeveloperResourcesView:b});export{w as DeveloperResourcesView};
diff --git a/chii/panels/elements/components/components.js b/chii/panels/elements/components/components.js
new file mode 100644
index 00000000..c3376d57
--- /dev/null
+++ b/chii/panels/elements/components/components.js
@@ -0,0 +1 @@
+import*as e from"../../../core/i18n/i18n.js";import*as t from"../../../core/platform/platform.js";import*as o from"../../../ui/components/helpers/helpers.js";import*as n from"../../../ui/components/render_coordinator/render_coordinator.js";import*as r from"../../../ui/lit-html/lit-html.js";import*as i from"../../../core/sdk/sdk.js";import*as a from"../../../core/common/common.js";import*as s from"../../../ui/legacy/legacy.js";import*as c from"../../../ui/components/icon_button/icon_button.js";const l=new CSSStyleSheet;l.replaceSync("span{color:var(--color-syntax-8);font-family:var(--monospace-font-family);font-size:var(--monospace-font-size)}.role-value{color:var(--color-syntax-2)}.attribute-name{color:var(--color-syntax-4)}.attribute-value{color:var(--color-syntax-3)}\n/*# sourceURL=accessibilityTreeNode.css */\n");const d={ignored:"Ignored"},u=e.i18n.registerUIStrings("panels/elements/components/AccessibilityTreeNode.ts",d),h=e.i18n.getLocalizedString.bind(void 0,u);class p extends HTMLElement{static litTagName=r.literal`devtools-accessibility-tree-node`;shadow=this.attachShadow({mode:"open"});ignored=!0;name="";role="";properties=[];set data(e){this.ignored=e.ignored,this.name=e.name,this.role=e.role,this.properties=e.properties,this.render()}connectedCallback(){this.shadow.adoptedStyleSheets=[l]}async render(){const e=r.html`${o=this.role,o.length>1e4?t.StringUtilities.trimMiddle(o,1e4):o}`;var o;const i=r.html`"${this.name}"`,a=this.properties.map((({name:e,value:t})=>function(e){switch(e){case"boolean":case"booleanOrUndefined":case"string":case"number":return!0;default:return!1}}(t.type)?r.html` ${e}: ${t.value}`:r.nothing));await n.RenderCoordinator.RenderCoordinator.instance().write("Accessibility node render",(()=>{r.render(this.ignored?r.html`${h(d.ignored)}`:r.html`${e} ${i}${a}`,this.shadow,{host:this})}))}}o.CustomElements.defineComponent("devtools-accessibility-tree-node",p);var m,g=Object.freeze({__proto__:null,AccessibilityTreeNode:p});function b(e){switch(e){case m.GRID:return{name:"grid",category:"Layout",enabledByDefault:!0};case m.FLEX:return{name:"flex",category:"Layout",enabledByDefault:!0};case m.AD:return{name:"ad",category:"Security",enabledByDefault:!0};case m.SCROLL_SNAP:return{name:"scroll-snap",category:"Layout",enabledByDefault:!0};case m.CONTAINER:return{name:"container",category:"Layout",enabledByDefault:!0}}}let v;function f(e){if(!v){v=new Map;for(const{name:e,category:t}of Object.values(m).map(b))v.set(e,t)}return v.get(e)||"Default"}!function(e){e.GRID="grid",e.FLEX="flex",e.AD="ad",e.SCROLL_SNAP="scroll-snap",e.CONTAINER="container"}(m||(m={}));const y=Object.values(m).map(b).map((({name:e,enabledByDefault:t})=>({adorner:e,isEnabled:t})));const x=new Map(["Security","Layout","Default"].map(((e,t)=>[e,t+1])));var w=Object.freeze({__proto__:null,get RegisteredAdorners(){return m},getRegisteredAdorner:b,DefaultAdornerSettings:y,AdornerManager:class{adornerSettings=new Map;settingStore;constructor(e){this.settingStore=e,this.syncSettings()}updateSettings(e){this.adornerSettings=e,this.persistCurrentSettings()}getSettings(){return this.adornerSettings}isAdornerEnabled(e){return this.adornerSettings.get(e)||!1}persistCurrentSettings(){const e=[];for(const[t,o]of this.adornerSettings)e.push({adorner:t,isEnabled:o});this.settingStore.set(e)}loadSettings(){const e=this.settingStore.get();for(const t of e)this.adornerSettings.set(t.adorner,t.isEnabled)}syncSettings(){this.loadSettings();const e=new Set(this.adornerSettings.keys());for(const{adorner:t,isEnabled:o}of y)e.delete(t),this.adornerSettings.has(t)||this.adornerSettings.set(t,o);for(const t of e)this.adornerSettings.delete(t);this.persistCurrentSettings()}},AdornerCategoryOrder:x,compareAdornerNamesByCategory:function(e,t){return(x.get(f(e))||Number.POSITIVE_INFINITY)-(x.get(f(t))||Number.POSITIVE_INFINITY)}});const k=new CSSStyleSheet;k.replaceSync('.adorner-settings-pane{display:flex;height:2.67em;padding:0 12px;color:var(--color-text-primary);font-size:12px;align-items:center}.settings-title{font-weight:500}.setting{margin-left:1em}.adorner-status{margin:auto .4em auto 0}.adorner-name,.adorner-status{vertical-align:middle}.close{position:relative;margin-left:auto;font-size:1em;width:1.5em;height:1.5em;border:none;border-radius:50%;background-color:var(--color-background-elevation-1);cursor:pointer}.close::after,.close::before{content:"";display:inline-block;position:absolute;left:0;right:0;top:0;bottom:0;margin:auto;width:1em;height:.2em;background-color:var(--color-text-secondary);border-radius:2px}.close::before{transform:rotate(45deg)}.close::after{transform:rotate(-45deg)}\n/*# sourceURL=adornerSettingsPane.css */\n');const S={settingsTitle:"Show badges",closeButton:"Close"},T=e.i18n.registerUIStrings("panels/elements/components/AdornerSettingsPane.ts",S),C=e.i18n.getLocalizedString.bind(void 0,T),{render:E,html:O}=r;class N extends Event{static eventName="adornersettingupdated";data;constructor(e,t,o){super(N.eventName,{}),this.data={adornerName:e,isEnabledNow:t,newSettings:o}}}class _ extends HTMLElement{static litTagName=r.literal`devtools-adorner-settings-pane`;shadow=this.attachShadow({mode:"open"});settings=new Map;connectedCallback(){this.shadow.adoptedStyleSheets=[k]}set data(e){this.settings=new Map(e.settings.entries()),this.render()}show(){this.classList.remove("hidden");const e=this.shadow.querySelector(".adorner-settings-pane");e&&e.focus()}hide(){this.classList.add("hidden")}onChange(e){const t=e.target,o=t.dataset.adorner;if(void 0===o)return;const n=t.checked;this.settings.set(o,n),this.dispatchEvent(new N(o,n,this.settings)),this.render()}render(){const e=[];for(const[t,o]of this.settings)e.push(O` `);E(O` ${C(S.settingsTitle)}
${e}
`,this.shadow,{host:this})}}o.CustomElements.defineComponent("devtools-adorner-settings-pane",_);var $=Object.freeze({__proto__:null,AdornerSettingUpdatedEvent:N,AdornerSettingsPane:_});const I=new CSSStyleSheet;I.replaceSync(":host{position:relative;overflow:hidden;flex:auto;text-overflow:ellipsis}.computed-style-property{--goto-size:16px;min-height:16px;box-sizing:border-box;padding-top:2px;white-space:nowrap}.computed-style-property.inherited{opacity:50%}slot[name=property-name],slot[name=property-value]{overflow:hidden;text-overflow:ellipsis}slot[name=property-name]{width:16em;max-width:52%;margin-right:calc(var(--goto-size)/ 2);display:inline-block;vertical-align:text-top}slot[name=property-value]{margin-left:2em}.goto{display:none;position:absolute;width:var(--goto-size);height:var(--goto-size);margin:-1px 0 0 calc(-1 * var(--goto-size));-webkit-mask-image:var(--image-file-mediumIcons);-webkit-mask-position:-32px 48px;background-color:var(--legacy-active-control-bg-color)}.computed-style-property:hover .goto{display:inline-block}.hidden{display:none}:host-context(.computed-narrow) .computed-style-property{white-space:normal}:host-context(.computed-narrow) slot[name=property-name],:host-context(.computed-narrow) slot[name=property-value]{display:inline-block;width:100%;max-width:100%;margin-left:0;white-space:nowrap}:host-context(.computed-narrow) .goto{display:none}@media (forced-colors:active){.computed-style-property.inherited{opacity:100%}:host-context(.monospace.computed-properties) .computed-style-property:hover{forced-color-adjust:none;background-color:Highlight}:host-context(.monospace.computed-properties) .computed-style-property:hover *{color:HighlightText}:host-context(.monospace.computed-properties) .goto{background-color:HighlightText}}\n/*# sourceURL=computedStyleProperty.css */\n");const{render:M,html:L}=r;class z extends HTMLElement{static litTagName=r.literal`devtools-computed-style-property`;shadow=this.attachShadow({mode:"open"});inherited=!1;traceable=!1;onNavigateToSource=()=>{};connectedCallback(){this.shadow.adoptedStyleSheets=[I]}set data(e){this.inherited=e.inherited,this.traceable=e.traceable,this.onNavigateToSource=e.onNavigateToSource,this.render()}render(){M(L` : ${this.traceable?L``:null} ;
`,this.shadow,{host:this})}}o.CustomElements.defineComponent("devtools-computed-style-property",z);var P=Object.freeze({__proto__:null,ComputedStyleProperty:z});const D=new CSSStyleSheet;D.replaceSync(":host{text-overflow:ellipsis;overflow:hidden;flex-grow:1}.computed-style-trace{margin-left:16px}.computed-style-trace:hover{background-color:var(--legacy-focus-bg-color);cursor:pointer}.goto{--size:16px;display:none;position:absolute;width:var(--size);height:var(--size);margin:-1px 0 0 calc(-1 * var(--size));-webkit-mask-image:var(--image-file-mediumIcons);-webkit-mask-position:-32px 48px;background-color:var(--legacy-active-control-bg-color)}.computed-style-trace:hover .goto{display:inline-block}.trace-value{margin-left:16px}.computed-style-trace.inactive slot[name=trace-value]{text-decoration:line-through}.trace-selector{--override-trace-selector-color:rgb(128 128 128);color:var(--override-trace-selector-color);padding-left:2em}::slotted([slot=trace-link]){user-select:none;float:right;padding-left:1em;position:relative;z-index:1}@media (forced-colors:active){:host-context(.monospace.computed-properties) .computed-style-trace:hover{forced-color-adjust:none;background-color:Highlight}:host-context(.monospace.computed-properties) .goto{background-color:HighlightText}:host-context(.monospace.computed-properties) .computed-style-trace:hover *{color:HighlightText}}\n/*# sourceURL=computedStyleTrace.css */\n");const{render:R,html:j}=r;class B extends HTMLElement{static litTagName=r.literal`devtools-computed-style-trace`;shadow=this.attachShadow({mode:"open"});selector="";active=!1;onNavigateToSource=()=>{};connectedCallback(){this.shadow.adoptedStyleSheets=[D]}set data(e){this.selector=e.selector,this.active=e.active,this.onNavigateToSource=e.onNavigateToSource,this.render()}render(){R(j` ${this.selector}
`,this.shadow,{host:this})}}o.CustomElements.defineComponent("devtools-computed-style-trace",B);var q=Object.freeze({__proto__:null,ComputedStyleTrace:B});const H=new Set(["tb","tb-rl","vertical-lr","vertical-rl"]);var A;function F(e){if(e===A.LEFT_TO_RIGHT)return A.RIGHT_TO_LEFT;if(e===A.RIGHT_TO_LEFT)return A.LEFT_TO_RIGHT;if(e===A.TOP_TO_BOTTOM)return A.BOTTOM_TO_TOP;if(e===A.BOTTOM_TO_TOP)return A.TOP_TO_BOTTOM;throw new Error("Unknown PhysicalFlexDirection")}function U(e){return{...e,"row-reverse":F(e.row),"column-reverse":F(e.column)}}function G(e){const t="rtl"===e.get("direction"),o=e.get("writing-mode");return U(o&&H.has(o)?{row:t?A.BOTTOM_TO_TOP:A.TOP_TO_BOTTOM,column:"vertical-lr"===o?A.LEFT_TO_RIGHT:A.RIGHT_TO_LEFT}:{row:t?A.RIGHT_TO_LEFT:A.LEFT_TO_RIGHT,column:A.TOP_TO_BOTTOM})}function V(e){let t=!0,o=!1,n=-90;return e===A.RIGHT_TO_LEFT?(n=90,o=!1,t=!1):e===A.TOP_TO_BOTTOM?(n=0,t=!1,o=!1):e===A.BOTTOM_TO_TOP&&(n=0,t=!1,o=!0),{iconName:"flex-direction-icon",rotate:n,scaleX:t?-1:1,scaleY:o?-1:1}}function Q(e,t){return{iconName:e,rotate:t===A.RIGHT_TO_LEFT?90:t===A.LEFT_TO_RIGHT?-90:0,scaleX:1,scaleY:1}}function X(e,t){return{iconName:e,rotate:t===A.TOP_TO_BOTTOM?90:t===A.BOTTOM_TO_TOP?-90:0,scaleX:t===A.RIGHT_TO_LEFT?-1:1,scaleY:1}}function Y(e,t){return{iconName:e,rotate:t===A.TOP_TO_BOTTOM?90:t===A.BOTTOM_TO_TOP?-90:0,scaleX:t===A.RIGHT_TO_LEFT?-1:1,scaleY:1}}function W(e,t){return{iconName:e,rotate:t===A.RIGHT_TO_LEFT?90:t===A.LEFT_TO_RIGHT?-90:0,scaleX:1,scaleY:1}}function K(e){return function(t){return V(G(t)[e])}}function J(e){return function(t){const o=G(t),n=new Map([["column",o.row],["row",o.column],["column-reverse",o.row],["row-reverse",o.column]]),r=t.get("flex-direction")||"row",i=n.get(r);if(!i)throw new Error("Unknown direction for flex-align icon");return Q(e,i)}}function Z(e){return function(t){const o=G(t);return Q(e,o.column)}}function ee(e){return function(t){const o=G(t);return X(e,o[t.get("flex-direction")||"row"])}}function te(e){return function(t){const o=G(t);return X(e,o.row)}}function oe(e){return function(t){const o=G(t);return Y(e,o.row)}}function ne(e){return function(t){const o=G(t),n=new Map([["column",o.row],["row",o.column],["column-reverse",o.row],["row-reverse",o.column]]),r=t.get("flex-direction")||"row",i=n.get(r);if(!i)throw new Error("Unknown direction for flex-align icon");return W(e,i)}}function re(e){return function(t){const o=G(t);return W(e,o.column)}}function ie(){return{iconName:"baseline-icon",rotate:0,scaleX:1,scaleY:1}}function ae(e){return function(t,o){return ne(e)(o)}}function se(e){return function(t,o){return re(e)(o)}}function ce(e,t){return{iconName:e,rotate:t===A.BOTTOM_TO_TOP||t===A.TOP_TO_BOTTOM?90:0,scaleX:1,scaleY:1}}function le(e){return function(t){const o=G(t),n=t.get("flex-direction")||"row";return ce(e,o[n])}}!function(e){e.LEFT_TO_RIGHT="left-to-right",e.RIGHT_TO_LEFT="right-to-left",e.BOTTOM_TO_TOP="bottom-to-top",e.TOP_TO_BOTTOM="top-to-bottom"}(A||(A={}));const de=new Map([["flex-direction: row",K("row")],["flex-direction: column",K("column")],["flex-direction: column-reverse",K("column-reverse")],["flex-direction: row-reverse",K("row-reverse")],["flex-direction: initial",K("row")],["flex-direction: unset",K("row")],["flex-direction: revert",K("row")],["align-content: center",J("align-content-center-icon")],["align-content: space-around",J("align-content-space-around-icon")],["align-content: space-between",J("align-content-space-between-icon")],["align-content: stretch",J("align-content-stretch-icon")],["align-content: space-evenly",J("align-content-space-evenly-icon")],["align-content: flex-end",J("align-content-end-icon")],["align-content: flex-start",J("align-content-start-icon")],["align-content: normal",J("align-content-stretch-icon")],["align-content: revert",J("align-content-stretch-icon")],["align-content: unset",J("align-content-stretch-icon")],["align-content: initial",J("align-content-stretch-icon")],["justify-content: center",ee("justify-content-center-icon")],["justify-content: space-around",ee("justify-content-space-around-icon")],["justify-content: space-between",ee("justify-content-space-between-icon")],["justify-content: space-evenly",ee("justify-content-space-evenly-icon")],["justify-content: flex-end",ee("justify-content-flex-end-icon")],["justify-content: flex-start",ee("justify-content-flex-start-icon")],["align-items: stretch",ne("align-items-stretch-icon")],["align-items: flex-end",ne("align-items-flex-end-icon")],["align-items: flex-start",ne("align-items-flex-start-icon")],["align-items: center",ne("align-items-center-icon")],["align-items: baseline",ie],["align-content: baseline",ie],["flex-wrap: wrap",le("flex-wrap-icon")],["flex-wrap: nowrap",le("flex-nowrap-icon")]]),ue=new Map([["align-self: baseline",ie],["align-self: center",ae("align-self-center-icon")],["align-self: flex-start",ae("align-self-flex-start-icon")],["align-self: flex-end",ae("align-self-flex-end-icon")],["align-self: stretch",ae("align-self-stretch-icon")]]),he=new Map([["align-content: center",Z("align-content-center-icon")],["align-content: space-around",Z("align-content-space-around-icon")],["align-content: space-between",Z("align-content-space-between-icon")],["align-content: stretch",Z("align-content-stretch-icon")],["align-content: space-evenly",Z("align-content-space-evenly-icon")],["align-content: end",Z("align-content-end-icon")],["align-content: start",Z("align-content-start-icon")],["align-content: baseline",ie],["justify-content: center",te("justify-content-center-icon")],["justify-content: space-around",te("justify-content-space-around-icon")],["justify-content: space-between",te("justify-content-space-between-icon")],["justify-content: space-evenly",te("justify-content-space-evenly-icon")],["justify-content: end",te("justify-content-flex-end-icon")],["justify-content: start",te("justify-content-flex-start-icon")],["align-items: stretch",re("align-items-stretch-icon")],["align-items: end",re("align-items-flex-end-icon")],["align-items: start",re("align-items-flex-start-icon")],["align-items: center",re("align-items-center-icon")],["align-items: baseline",ie],["justify-items: center",oe("justify-items-center-icon")],["justify-items: stretch",oe("justify-items-stretch-icon")],["justify-items: end",oe("justify-items-end-icon")],["justify-items: start",oe("justify-items-start-icon")],["justify-items: baseline",ie]]),pe=new Map([["align-self: baseline",ie],["align-self: center",se("align-self-center-icon")],["align-self: start",se("align-self-flex-start-icon")],["align-self: end",se("align-self-flex-end-icon")],["align-self: stretch",se("align-self-stretch-icon")]]),me=e=>{const t=e?.get("display");return"flex"===t||"inline-flex"===t},ge=e=>{const t=e?.get("display");return"grid"===t||"inline-grid"===t};function be(e,t){const o=de.get(e);return o?o(t||new Map):null}function ve(e,t,o){const n=ue.get(e);return n?n(t||new Map,o||new Map):null}function fe(e,t){const o=he.get(e);return o?o(t||new Map):null}function ye(e,t,o){const n=pe.get(e);return n?n(t||new Map,o||new Map):null}var xe=Object.freeze({__proto__:null,get PhysicalDirection(){return A},reverseDirection:F,getPhysicalDirections:G,rotateFlexDirectionIcon:V,rotateAlignContentIcon:Q,rotateJustifyContentIcon:X,rotateJustifyItemsIcon:Y,rotateAlignItemsIcon:W,roateFlexWrapIcon:ce,findIcon:function(e,t,o){if(me(t)){const o=be(e,t);if(o)return o}if(me(o)){const n=ve(e,t,o);if(n)return n}if(ge(t)){const o=fe(e,t);if(o)return o}if(ge(o)){const n=ye(e,t,o);if(n)return n}return null},findFlexContainerIcon:be,findFlexItemIcon:ve,findGridContainerIcon:fe,findGridItemIcon:ye});const we=new CSSStyleSheet;we.replaceSync('*{box-sizing:border-box;min-width:0;min-height:0}:root{height:100%;overflow:hidden;--legacy-accent-color:#1a73e8;--legacy-accent-fg-color:#1a73e8;--legacy-accent-color-hover:#3b86e8;--legacy-accent-fg-color-hover:#1567d3;--legacy-active-control-bg-color:#5a5a5a;--legacy-focus-bg-color:hsl(214deg 40% 92%);--legacy-focus-ring-inactive-shadow-color:#e0e0e0;--legacy-input-validation-error:#db1600;--legacy-toolbar-hover-bg-color:#eaeaea;--legacy-selection-fg-color:#fff;--legacy-selection-bg-color:var(--legacy-accent-color);--legacy-selection-inactive-fg-color:#5a5a5a;--legacy-selection-inactive-bg-color:#dadada;--legacy-tab-selected-fg-color:#333;--legacy-divider-border:1px solid var(--color-details-hairline);--legacy-focus-ring-inactive-shadow:0 0 0 1px var(--legacy-focus-ring-inactive-shadow-color);--legacy-focus-ring-active-shadow:0 0 0 1px var(--legacy-accent-color);--legacy-item-selection-bg-color:#cfe8fc;--legacy-item-selection-inactive-bg-color:#e0e0e0;--item-hover-color:rgb(56 121 217 / 10%);--monospace-font-size:10px;--monospace-font-family:monospace;--source-code-font-size:11px;--source-code-font-family:monospace;--override-force-white-icons-background:#fafafa}.-theme-with-dark-background{color-scheme:dark;--legacy-accent-color:#0e639c;--legacy-accent-fg-color:#ccc;--legacy-accent-fg-color-hover:#fff;--legacy-accent-color-hover:rgb(17 119 187);--legacy-active-control-bg-color:#cdcdcd;--legacy-focus-bg-color:hsl(214deg 19% 27%);--legacy-focus-ring-inactive-shadow-color:#5a5a5a;--legacy-toolbar-hover-bg-color:#202020;--legacy-selection-fg-color:#cdcdcd;--legacy-selection-inactive-fg-color:#cdcdcd;--legacy-selection-inactive-bg-color:hsl(0deg 0% 28%);--legacy-tab-selected-fg-color:#eaeaea;--legacy-focus-ring-inactive-shadow:0 0 0 1px var(--legacy-focus-ring-inactive-shadow-color);--legacy-item-selection-bg-color:hsl(207deg 88% 22%);--legacy-item-selection-inactive-bg-color:#454545}body{height:100%;width:100%;position:relative;overflow:hidden;margin:0;cursor:default;font-family:".SFNSDisplay-Regular","Helvetica Neue","Lucida Grande",sans-serif;font-size:12px;tab-size:4;user-select:none;color:var(--color-text-primary);background:var(--color-background)}.platform-linux{font-family:Roboto,Ubuntu,Arial,sans-serif}.platform-mac{font-family:".SFNSDisplay-Regular","Helvetica Neue","Lucida Grande",sans-serif}.platform-linux,.platform-mac{--override-text-color:rgb(48 57 66);color:var(--override-text-color)}.platform-windows{font-family:"Segoe UI",Tahoma,sans-serif}:focus{outline-width:0}.platform-mac,:host-context(.platform-mac){--monospace-font-size:11px;--monospace-font-family:menlo,monospace;--source-code-font-size:11px;--source-code-font-family:menlo,monospace}.platform-windows,:host-context(.platform-windows){--monospace-font-size:12px;--monospace-font-family:consolas,lucida console,courier new,monospace;--source-code-font-size:12px;--source-code-font-family:consolas,lucida console,courier new,monospace}.platform-linux,:host-context(.platform-linux){--monospace-font-size:11px;--monospace-font-family:dejavu sans mono,monospace;--source-code-font-size:11px;--source-code-font-family:dejavu sans mono,monospace}.-theme-with-dark-background .platform-linux,.-theme-with-dark-background .platform-mac,:host-context(.-theme-with-dark-background) .platform-linux,:host-context(.-theme-with-dark-background) .platform-mac{--override-text-color:rgb(189 198 207)}.monospace{font-family:var(--monospace-font-family);font-size:var(--monospace-font-size)!important}.source-code{font-family:var(--source-code-font-family);font-size:var(--source-code-font-size)!important;white-space:pre-wrap}img{-webkit-user-drag:none}a img,iframe{border:none}.fill{position:absolute;top:0;left:0;right:0;bottom:0}iframe.fill{width:100%;height:100%}.widget{position:relative;flex:auto;contain:style}.hbox{display:flex;flex-direction:row!important;position:relative}.vbox{display:flex;flex-direction:column!important;position:relative}.view-container>.toolbar{border-bottom:1px solid var(--color-details-hairline)}.flex-auto{flex:auto}.flex-none{flex:none}.flex-centered{display:flex;align-items:center;justify-content:center}.overflow-auto{overflow:auto;background-color:var(--color-background)}iframe.widget{position:absolute;width:100%;height:100%;left:0;right:0;top:0;bottom:0}.hidden{display:none!important}.highlighted-search-result{--override-highlighted-search-result-background-color:rgb(255 255 0 / 80%);border-radius:1px;background-color:var(--override-highlighted-search-result-background-color);outline:1px solid var(--override-highlighted-search-result-background-color)}.-theme-with-dark-background .highlighted-search-result,:host-context(.-theme-with-dark-background) .highlighted-search-result{--override-highlighted-search-result-background-color:hsl(133deg 100% 30%);color:#333}.link{cursor:pointer;text-decoration:underline;color:var(--color-link)}button,input,select{font-family:inherit;font-size:inherit}input,select optgroup,select option{background-color:var(--color-background)}input{color:inherit}input::placeholder{--override-input-placeholder-color:rgb(0 0 0 / 54%);color:var(--override-input-placeholder-color)}.-theme-with-dark-background input::placeholder,:host-context(.-theme-with-dark-background) input::placeholder{--override-input-placeholder-color:rgb(230 230 230 / 54%)}:host-context(.-theme-with-dark-background) input[type=checkbox]:not(.-theme-preserve){accent-color:var(--color-checkbox-accent-color)}.harmony-input:not([type]),.harmony-input[type=number],.harmony-input[type=text]{padding:3px 6px;height:24px;border:none;box-shadow:var(--legacy-focus-ring-inactive-shadow)}.harmony-input:not([type]).error-input,.harmony-input:not([type]):invalid,.harmony-input[type=number].error-input,.harmony-input[type=number]:invalid,.harmony-input[type=text].error-input,.harmony-input[type=text]:invalid{box-shadow:0 0 0 1px var(--color-red)}.harmony-input:not([type]):not(.error-input):not(:invalid):hover,.harmony-input[type=number]:not(.error-input):not(:invalid):hover,.harmony-input[type=text]:not(.error-input):not(:invalid):hover{box-shadow:var(--legacy-focus-ring-inactive-shadow)}.harmony-input:not([type]):not(.error-input):not(:invalid):focus,.harmony-input[type=number]:not(.error-input):not(:invalid):focus,.harmony-input[type=text]:not(.error-input):not(:invalid):focus{box-shadow:var(--legacy-focus-ring-active-shadow)}.highlighted-search-result.current-search-result{--override-current-search-result-background-color:rgb(255 127 0 / 80%);border-radius:1px;padding:1px;margin:-1px;background-color:var(--override-current-search-result-background-color)}.dimmed{opacity:60%}.editing{box-shadow:var(--drop-shadow);background-color:var(--color-background);text-overflow:clip!important;padding-left:2px;margin-left:-2px;padding-right:2px;margin-right:-2px;margin-bottom:-1px;padding-bottom:1px;opacity:100%!important}.editing,.editing *{color:var(--color-text-primary)!important;text-decoration:none!important}.chrome-select{--override-chrome-select-border-color:rgb(0 0 0 / 20%);appearance:none;user-select:none;border:1px solid var(--override-chrome-select-border-color);border-radius:2px;color:var(--color-text-primary);font:inherit;margin:0;outline:0;padding-right:20px;padding-left:6px;background-image:var(--image-file-chromeSelect);background-color:var(--color-background-elevation-0);background-position:right center;background-repeat:no-repeat;min-height:24px;min-width:80px;background-size:15px}.chrome-select:disabled{opacity:38%}.-theme-with-dark-background .chrome-select,:host-context(.-theme-with-dark-background) .chrome-select{--override-chrome-select-border-color:rgb(230 230 230 / 20%);background-image:var(--image-file-chromeSelectDark)}.chrome-select:enabled:active,.chrome-select:enabled:focus,.chrome-select:enabled:hover{--override-select-box-shadow:0 0 0 2px var(--color-button-outline-focus);background-color:var(--color-background-elevation-1);box-shadow:var(--override-select-box-shadow)}.chrome-select:enabled:active{background-color:var(--color-background-elevation-2)}.chrome-select:enabled:focus{border-color:transparent}.-theme-with-dark-background .chrome-select:enabled:active,.-theme-with-dark-background .chrome-select:enabled:focus,.-theme-with-dark-background .chrome-select:enabled:hover,:host-context(.-theme-with-dark-background) .chrome-select:enabled:active,:host-context(.-theme-with-dark-background) .chrome-select:enabled:focus,:host-context(.-theme-with-dark-background) .chrome-select:enabled:hover{--override-select-box-shadow:0 0 0 2px var(--color-button-outline-focus)}.chrome-select-label{margin:0 22px;flex:none}.chrome-select-label p p{margin-top:0;color:var(--color-text-secondary)}.settings-select{margin:0}.chrome-select optgroup,.chrome-select option{background-color:var(--color-background-elevation-1);color:var(--color-text-primary)}.gray-info-message{text-align:center;font-style:italic;padding:6px;color:var(--color-text-secondary);white-space:nowrap}span[is=dt-icon-label]{flex:none}.full-widget-dimmed-banner a{color:inherit}.full-widget-dimmed-banner{color:var(--color-text-secondary);background-color:var(--color-background);display:flex;justify-content:center;align-items:center;text-align:center;padding:20px;position:absolute;top:0;right:0;bottom:0;left:0;font-size:13px;overflow:auto;z-index:500}[is=ui-icon]{display:inline-block;flex-shrink:0}.-theme-with-dark-background [is=ui-icon].icon-invert,:host-context(.-theme-with-dark-background) [is=ui-icon].icon-invert{filter:invert(80%) hue-rotate(180deg)}[is=ui-icon].icon-mask{--override-icon-mask-background-color:rgb(110 110 110);background-color:var(--override-icon-mask-background-color);-webkit-mask-position:var(--spritesheet-position)}.-theme-with-dark-background [is=ui-icon].icon-mask,:host-context(.-theme-with-dark-background) [is=ui-icon].icon-mask{--override-icon-mask-background-color:rgb(145 145 145)}[is=ui-icon]:not(.icon-mask){background-position:var(--spritesheet-position)}.spritesheet-smallicons:not(.icon-mask){background-image:var(--image-file-smallIcons)}.spritesheet-smallicons.icon-mask{-webkit-mask-image:var(--image-file-smallIcons)}.spritesheet-largeicons:not(.icon-mask){background-image:var(--image-file-largeIcons)}.spritesheet-largeicons.icon-mask{-webkit-mask-image:var(--image-file-largeIcons)}.spritesheet-mediumicons:not(.icon-mask){background-image:var(--image-file-mediumIcons)}.spritesheet-mediumicons.icon-mask{-webkit-mask-image:var(--image-file-mediumIcons)}.spritesheet-arrowicons{background-image:var(--image-file-popoverArrows)}.-theme-preserve,.force-white-icons [is=ui-icon].spritesheet-smallicons,:host-context(.force-white-icons) [is=ui-icon].spritesheet-smallicons,[is=ui-icon].force-white-icons.spritesheet-smallicons{-webkit-mask-image:var(--image-file-smallIcons);-webkit-mask-position:var(--spritesheet-position);background:var(--override-force-white-icons-background)!important}.-theme-preserve,.force-white-icons [is=ui-icon].spritesheet-largeicons,:host-context(.force-white-icons) [is=ui-icon].spritesheet-largeicons,[is=ui-icon].force-white-icons.spritesheet-largeicons{-webkit-mask-image:var(--image-file-largeIcons);-webkit-mask-position:var(--spritesheet-position);background:var(--override-force-white-icons-background)!important}.-theme-preserve,.force-white-icons [is=ui-icon].spritesheet-mediumicons,:host-context(.force-white-icons) [is=ui-icon].spritesheet-mediumicons,[is=ui-icon].force-white-icons.spritesheet-mediumicons{-webkit-mask-image:var(--image-file-mediumIcons);-webkit-mask-position:var(--spritesheet-position);background:var(--override-force-white-icons-background)!important}.expandable-inline-button{background-color:var(--color-background-elevation-2);color:var(--color-text-primary);cursor:pointer;border-radius:3px}.expandable-inline-button,.undisplayable-text{padding:1px 3px;margin:0 2px;font-size:11px;font-family:sans-serif;white-space:nowrap;display:inline-block}.expandable-inline-button::after,.undisplayable-text::after{content:attr(data-text)}.undisplayable-text{color:var(--color-text-disabled);font-style:italic}.expandable-inline-button:focus-visible,.expandable-inline-button:hover{background-color:var(--color-background-elevation-1)}.expandable-inline-button:focus-visible{background-color:var(--color-background-elevation-1)}::selection{--override-selection-background-color:rgb(141 199 248 / 60%);background-color:var(--override-selection-background-color)}.-theme-with-dark-background ::selection,:host-context(.-theme-with-dark-background) ::selection{background-color:rgb(93 93 93 / 60%)}.reload-warning{align-self:center;margin-left:10px}button.link{border:none;background:0 0;padding:3px}button.link:focus-visible{--override-link-focus-background-color:rgb(0 0 0 / 8%);background-color:var(--override-link-focus-background-color);border-radius:2px}.-theme-with-dark-background button.link:focus-visible,:host-context(.-theme-with-dark-background) button.link:focus-visible{--override-link-focus-background-color:rgb(230 230 230 / 8%)}[data-aria-utils-animation-hack]{animation:ANIMATION-HACK 0s}@media (forced-colors:active){.chrome-select:disabled,.dimmed{opacity:100%}.-theme-preserve,.force-white-icons [is=ui-icon].spritesheet-largeicons,.force-white-icons [is=ui-icon].spritesheet-mediumicons,.force-white-icons [is=ui-icon].spritesheet-smallicons,:host-context(.force-white-icons) [is=ui-icon].spritesheet-largeicons,:host-context(.force-white-icons) [is=ui-icon].spritesheet-mediumicons,:host-context(.force-white-icons) [is=ui-icon].spritesheet-smallicons,[is=ui-icon].force-white-icons.spritesheet-largeicons,[is=ui-icon].force-white-icons.spritesheet-mediumicons,[is=ui-icon].force-white-icons.spritesheet-smallicons,[is=ui-icon].icon-mask{forced-color-adjust:none;background-color:ButtonText}.harmony-input:not([type]),.harmony-input[type=number],.harmony-input[type=text]{border:1px solid ButtonText}.harmony-input:not([type]):focus,.harmony-input[type=number]:focus,.harmony-input[type=text]:focus{border:1px solid Highlight}}input.custom-search-input::-webkit-search-cancel-button{appearance:none;cursor:pointer;width:16px;height:15px;margin-right:0;background-position:-32px 32px;background-image:var(--image-file-mediumIcons)}.spinner::before{display:block;width:var(--dimension,24px);height:var(--dimension,24px);border:var(--override-spinner-size,3px) solid var(--override-spinner-color,var(--color-text-secondary));border-radius:12px;clip:rect(0,var(--clip-size,15px),var(--clip-size,15px),0);content:"";position:absolute;animation:spinner-animation 1s linear infinite;box-sizing:border-box}@keyframes spinner-animation{from{transform:rotate(0)}to{transform:rotate(360deg)}}.adorner-container{display:inline-block}.adorner-container.hidden{display:none}.adorner-container devtools-adorner{margin-left:3px}:host-context(.-theme-with-dark-background) devtools-adorner{--override-adorner-background-color:rgb(var(--color-syntax-2-rgb) / 15%);--override-adorner-border-color:rgb(var(--color-syntax-2-rgb) / 50%);--override-adorner-focus-border-color:var(--color-syntax-2);--override-adorner-active-background-color:var(--color-syntax-8)}.panel{display:flex;overflow:hidden;position:absolute;top:0;left:0;right:0;bottom:0;z-index:0;background-color:var(--color-background)}.panel-sidebar{overflow-x:hidden;background-color:var(--color-background-elevation-1)}iframe.extension{flex:auto;width:100%;height:100%}iframe.panel.extension{display:block;height:100%}@media (forced-colors:active){:root{--legacy-accent-color:Highlight;--legacy-focus-ring-inactive-shadow-color:ButtonText}}\n/*# sourceURL=inspectorCommon.css */\n');const ke=new CSSStyleSheet;ke.replaceSync(".query:not(.editing-query){overflow:hidden}.editable .query-text{color:var(--color-text-primary)}.editable .query-text:hover{text-decoration:var(--override-styles-section-text-hover-text-decoration);cursor:var(--override-styles-section-text-hover-cursor)}\n/*# sourceURL=cssQuery.css */\n");const{render:Se,html:Te}=r;class Ce extends HTMLElement{static litTagName=r.literal`devtools-css-query`;shadow=this.attachShadow({mode:"open"});queryPrefix="";queryName;queryText="";onQueryTextClick;set data(e){this.queryPrefix=e.queryPrefix,this.queryName=e.queryName,this.queryText=e.queryText,this.onQueryTextClick=e.onQueryTextClick,this.render()}connectedCallback(){this.shadow.adoptedStyleSheets=[ke,we]}render(){const e=r.Directives.classMap({query:!0,editable:Boolean(this.onQueryTextClick)}),t=Te` ${this.queryText} `;Se(Te` ${this.queryPrefix?Te`${this.queryPrefix+" "}`:r.nothing}${this.queryName?Te`${this.queryName+" "}`:r.nothing}${t}
`,this.shadow,{host:this})}}o.CustomElements.defineComponent("devtools-css-query",Ce);var Ee=Object.freeze({__proto__:null,CSSQuery:Ce});const Oe=new CSSStyleSheet;Oe.replaceSync(":host{--override-node-text-label-color:var(--color-syntax-2);--override-node-text-class-color:var(--color-syntax-4);--override-node-text-id-color:var(--color-syntax-4);--override-node-text-multiple-descriptors-id:var(--color-syntax-7);--override-node-text-multiple-descriptors-class:var(--color-syntax-4)}.crumbs{display:inline-flex;align-items:stretch;width:100%;overflow:hidden;pointer-events:auto;cursor:default;white-space:nowrap;position:relative;background:var(--color-background)}.crumbs-window{flex-grow:2;overflow:hidden}.crumbs-scroll-container{display:inline-flex;margin:0;padding:0}.crumb{display:block;padding:0 7px;line-height:23px;white-space:nowrap}.overflow{padding:0 7px;font-weight:700;display:block;border:none;flex-grow:0;flex-shrink:0;text-align:center;background-color:var(--color-background-elevation-1);color:var(--color-text-secondary);margin:1px;outline:var(--color-background-elevation-1) solid 1px}.overflow.hidden{display:none}.overflow:disabled{opacity:50%}.overflow:focus{outline-color:var(--color-primary)}.overflow:not(:disabled):hover{background-color:var(--color-background-elevation-2);color:var(--color-text-primary);cursor:pointer}.crumb-link{text-decoration:none;color:inherit}.crumb:hover{background:var(--color-background-elevation-2)}.crumb.selected{background:var(--color-background-elevation-1)}.crumb:focus{outline:var(--color-primary) auto 1px}\n/*# sourceURL=elementsBreadcrumbs.css */\n");const Ne={text:"(text)"},_e=e.i18n.registerUIStrings("panels/elements/components/ElementsBreadcrumbsUtils.ts",Ne),$e=e.i18n.getLocalizedString.bind(void 0,_e),Ie=(e,t)=>t?e.filter((e=>e.nodeType!==Node.DOCUMENT_NODE)).map((e=>({title:Le(e),selected:e.id===t.id,node:e,originalNode:e.legacyDomNode}))).reverse():[],Me=(e,t={})=>({main:e,extras:t}),Le=e=>{switch(e.nodeType){case Node.ELEMENT_NODE:{if(e.pseudoType)return Me("::"+e.pseudoType);const t=Me(e.nodeNameNicelyCased),o=e.getAttribute("id");o&&(t.extras.id=o);const n=e.getAttribute("class");if(n){const e=new Set(n.split(/\s+/));t.extras.classes=Array.from(e)}return t}case Node.TEXT_NODE:return Me($e(Ne.text));case Node.COMMENT_NODE:return Me("\x3c!--\x3e");case Node.DOCUMENT_TYPE_NODE:return Me("");case Node.DOCUMENT_FRAGMENT_NODE:return Me(e.shadowRootType?"#shadow-root":e.nodeNameNicelyCased);default:return Me(e.nodeNameNicelyCased)}};var ze=Object.freeze({__proto__:null,crumbsToRender:Ie,determineElementTitle:Le});const Pe=new CSSStyleSheet;Pe.replaceSync(".node-label-name{color:var(--override-node-text-label-color,--color-token-tag)}.node-label-class{color:var(--override-node-text-class-color,--color-token-attribute)}.node-label-id{color:var(--override-node-text-id-color)}.node-label-class.node-multiple-descriptors{color:var(--override-node-text-multiple-descriptors-class,var(--override-node-text-class-color,--color-token-attribute))}.node-label-id.node-multiple-descriptors{color:var(--override-node-text-multiple-descriptors-id,var(--override-node-text-id-color,--color-token-attribute))}\n/*# sourceURL=nodeText.css */\n");const{render:De,html:Re}=r;class je extends HTMLElement{static litTagName=r.literal`devtools-node-text`;shadow=this.attachShadow({mode:"open"});nodeTitle="";nodeId="";nodeClasses=[];connectedCallback(){this.shadow.adoptedStyleSheets=[Pe]}set data(e){this.nodeTitle=e.nodeTitle,this.nodeId=e.nodeId,this.nodeClasses=e.nodeClasses,this.render()}render(){const e=Boolean(this.nodeId),t=Boolean(this.nodeClasses&&this.nodeClasses.length>0),o=[Re`${this.nodeTitle}`];if(this.nodeId){const e=r.Directives.classMap({"node-label-id":!0,"node-multiple-descriptors":t});o.push(Re`#${CSS.escape(this.nodeId)}`)}if(this.nodeClasses&&this.nodeClasses.length>0){const t=this.nodeClasses.map((e=>`.${CSS.escape(e)}`)).join(""),n=r.Directives.classMap({"node-label-class":!0,"node-multiple-descriptors":e});o.push(Re`${t}`)}De(Re` ${o} `,this.shadow,{host:this})}}o.CustomElements.defineComponent("devtools-node-text",je);var Be=Object.freeze({__proto__:null,NodeText:je});const qe={breadcrumbs:"DOM tree breadcrumbs"},He=e.i18n.registerUIStrings("panels/elements/components/ElementsBreadcrumbs.ts",qe),Ae=e.i18n.getLocalizedString.bind(void 0,He);class Fe extends Event{static eventName="breadcrumbsnodeselected";legacyDomNode;constructor(e){super(Fe.eventName,{}),this.legacyDomNode=e.legacyDomNode}}const Ue=n.RenderCoordinator.RenderCoordinator.instance();class Ge extends HTMLElement{static litTagName=r.literal`devtools-elements-breadcrumbs`;shadow=this.attachShadow({mode:"open"});resizeObserver=new ResizeObserver((()=>this.checkForOverflowOnResize()));crumbsData=[];selectedDOMNode=null;overflowing=!1;userScrollPosition="start";isObservingResize=!1;userHasManuallyScrolled=!1;connectedCallback(){this.shadow.adoptedStyleSheets=[Oe]}set data(e){this.selectedDOMNode=e.selectedNode,this.crumbsData=e.crumbs,this.userHasManuallyScrolled=!1,this.update()}disconnectedCallback(){this.isObservingResize=!1,this.resizeObserver.disconnect()}onCrumbClick(e){return t=>{t.preventDefault(),this.dispatchEvent(new Fe(e))}}async checkForOverflowOnResize(){const e=this.shadow.querySelector(".crumbs"),t=this.shadow.querySelector(".crumbs-scroll-container");if(!e||!t)return;const o=await Ue.read((()=>e.clientWidth)),n=await Ue.read((()=>t.clientWidth));n>=o&&!1===this.overflowing?(this.overflowing=!0,this.userScrollPosition="start",this.render()):ne.highlightNode()}onCrumbMouseLeave(e){return()=>e.clearHighlight()}onCrumbFocus(e){return()=>e.highlightNode()}onCrumbBlur(e){return()=>e.clearHighlight()}engageResizeObserver(){if(!this.resizeObserver||!0===this.isObservingResize)return;const e=this.shadow.querySelector(".crumbs");e&&(this.resizeObserver.observe(e),this.isObservingResize=!0)}async checkForOverflow(){const e=this.shadow.querySelector(".crumbs-scroll-container"),t=this.shadow.querySelector(".crumbs-window");if(!e||!t)return;const o=await Ue.read((()=>t.clientWidth));await Ue.read((()=>e.clientWidth))=t-10?"end":"middle",this.render()}onOverflowClick(e){return()=>{this.userHasManuallyScrolled=!0;const t=this.shadow.querySelector(".crumbs-window");if(!t)return;const o=t.clientWidth/2,n="left"===e?Math.max(Math.floor(t.scrollLeft-o),0):t.scrollLeft+o;t.scrollTo({behavior:"smooth",left:n})}}renderOverflowButton(e,t){const o=r.Directives.classMap({overflow:!0,[e]:!0,hidden:!1===this.overflowing});return r.html` `}async render(){const e=Ie(this.crumbsData,this.selectedDOMNode);await Ue.write("Breadcrumbs render",(()=>{r.render(r.html` `,this.shadow,{host:this})})),this.checkForOverflow()}async ensureSelectedNodeIsVisible(){if(!this.selectedDOMNode||!this.shadow||!this.overflowing||this.userHasManuallyScrolled)return;const e=this.selectedDOMNode.id,t=this.shadow.querySelector(`.crumb[data-node-id="${e}"]`);t&&await Ue.scroll((()=>{t.scrollIntoView({behavior:"smooth"})}))}}o.CustomElements.defineComponent("devtools-elements-breadcrumbs",Ge);var Ve=Object.freeze({__proto__:null,NodeSelectedEvent:Fe,ElementsBreadcrumbs:Ge});const Qe=new CSSStyleSheet;Qe.replaceSync(".element-reveal-icon{--override-element-reveal-icon-background:rgb(110 110 110);display:inline-block;width:28px;height:24px;-webkit-mask-position:-140px 96px;-webkit-mask-image:var(--image-file-largeIcons);background-color:var(--override-element-reveal-icon-background)}\n/*# sourceURL=elementsPanelLink.css */\n");class Xe extends HTMLElement{static litTagName=r.literal`devtools-elements-panel-link`;shadow=this.attachShadow({mode:"open"});onElementRevealIconClick=()=>{};onElementRevealIconMouseEnter=()=>{};onElementRevealIconMouseLeave=()=>{};set data(e){this.onElementRevealIconClick=e.onElementRevealIconClick,this.onElementRevealIconMouseEnter=e.onElementRevealIconMouseEnter,this.onElementRevealIconMouseLeave=e.onElementRevealIconMouseLeave,this.update()}update(){this.render()}connectedCallback(){this.shadow.adoptedStyleSheets=[Qe]}render(){r.render(r.html` `,this.shadow,{host:this})}}o.CustomElements.defineComponent("devtools-elements-panel-link",Xe);var Ye=Object.freeze({__proto__:null,ElementsPanelLink:Xe});const We=e=>({parentNode:e.parentNode?We(e.parentNode):null,id:e.id,nodeType:e.nodeType(),pseudoType:e.pseudoType(),shadowRootType:e.shadowRootType(),nodeName:e.nodeName(),nodeNameNicelyCased:e.nodeNameInCorrectCase(),legacyDomNode:e,highlightNode:t=>e.highlight(t),clearHighlight:()=>i.OverlayModel.OverlayModel.hideDOMNodeHighlight(),getAttribute:e.getAttribute.bind(e)});var Ke=Object.freeze({__proto__:null,legacyNodeToElementsComponentsNode:We});const Je=new CSSStyleSheet;Je.replaceSync("*{box-sizing:border-box;font-size:12px}.header{background-color:var(--color-background-elevation-1);border-bottom:var(--legacy-divider-border);line-height:1.6;overflow:hidden;padding:0 5px;white-space:nowrap}.header::marker{color:rgb(110 110 110);font-size:11px;line-height:1}.header:focus{background-color:var(--legacy-focus-bg-color)}.content-section{padding:16px;border-bottom:var(--legacy-divider-border);overflow-x:hidden}.content-section-title{font-size:12px;font-weight:500;line-height:1.1;margin:0;padding:0}.checkbox-settings{margin-top:8px;display:grid;grid-template-columns:1fr;gap:5px}.checkbox-label{display:flex;flex-direction:row;align-items:center;min-width:40px}.checkbox-settings .checkbox-label{margin-bottom:8px}.checkbox-settings .checkbox-label:last-child{margin-bottom:0}.checkbox-label input{margin:0 6px 0 0;padding:0;flex:none}.checkbox-label input:focus{outline:auto 5px -webkit-focus-ring-color}.checkbox-label>span{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.select-settings{margin-top:16px}.select-label{display:flex;flex-direction:column}.select-label span{margin-bottom:4px}.elements{margin-top:12px;color:var(--color-token-tag);display:grid;grid-template-columns:repeat(auto-fill,minmax(min(250px,100%),1fr));gap:8px}.element{display:flex;flex-direction:row;align-items:center}.show-element{margin:0 0 0 8px;padding:0;background:0 0;border:none;-webkit-mask-image:var(--image-file-ic_show_node_16x16);background-color:#333;width:16px;height:16px;display:block;cursor:pointer;flex:none}.show-element:focus,.show-element:hover{background-color:#6e6e6e}.chrome-select{min-width:0;max-width:150px}:host-context(.-theme-with-dark-background) .show-element{background-color:rgb(204 204 204)}:host-context(.-theme-with-dark-background) .show-element:focus,:host-context(.-theme-with-dark-background) .show-element:hover{background-color:#6e6e6e}.color-picker{opacity:0%}.color-picker-label{border:1px solid rgb(128 128 128 / 60%);cursor:default;display:inline-block;flex:none;height:10px;margin:0 0 0 8px;width:10px;position:relative}.color-picker-label input[type=color]{width:100%;height:100%;position:absolute}.color-picker-label:focus,.color-picker-label:hover{border:1px solid var(--legacy-accent-color-hover);transform:scale(1.2)}.node-text-container{line-height:16px;padding:0 .5ex;border-radius:5px}.node-text-container:hover{background-color:var(--item-hover-color)}:host-context(.-theme-with-dark-background) input[type=checkbox]{filter:invert(80%)}\n/*# sourceURL=layoutPane.css */\n");const Ze={chooseElementOverlayColor:"Choose the overlay color for this element",showElementInTheElementsPanel:"Show element in the Elements panel",grid:"Grid",overlayDisplaySettings:"Overlay display settings",gridOverlays:"Grid overlays",noGridLayoutsFoundOnThisPage:"No grid layouts found on this page",flexbox:"Flexbox",flexboxOverlays:"Flexbox overlays",noFlexboxLayoutsFoundOnThisPage:"No flexbox layouts found on this page",colorPickerOpened:"Color picker opened."},et=e.i18n.registerUIStrings("panels/elements/components/LayoutPane.ts",Ze),tt=e.i18n.getLocalizedString.bind(void 0,et),{render:ot,html:nt}=r;class rt extends Event{static eventName="settingchanged";data;constructor(e,t){super(rt.eventName,{}),this.data={setting:e,value:t}}}function it(e){return e.type===a.Settings.SettingType.ENUM}function at(e){return e.type===a.Settings.SettingType.BOOLEAN}class st extends HTMLElement{static litTagName=r.literal`devtools-layout-pane`;shadow=this.attachShadow({mode:"open"});settings=[];gridElements=[];flexContainerElements=[];constructor(){super(),this.shadow.adoptedStyleSheets=[Je,we]}set data(e){this.settings=e.settings,this.gridElements=e.gridElements,this.flexContainerElements=e.flexContainerElements,this.render()}onSummaryKeyDown(e){if(!e.target)return;const t=e.target.parentElement;if(!t)throw new Error(" element is not found for a element");switch(e.key){case"ArrowLeft":t.open=!1;break;case"ArrowRight":t.open=!0}}render(){ot(nt` ${tt(Ze.overlayDisplaySettings)}
${this.getEnumSettings().map((e=>this.renderEnumSetting(e)))}
${this.getBooleanSettings().map((e=>this.renderBooleanSetting(e)))}
${this.gridElements?nt` ${this.gridElements.length?tt(Ze.gridOverlays):tt(Ze.noGridLayoutsFoundOnThisPage)}
${this.gridElements.length?nt`
${this.gridElements.map((e=>this.renderElement(e)))}
`:""}
`:""} ${void 0!==this.flexContainerElements?nt` ${this.flexContainerElements?nt` ${this.flexContainerElements.length?tt(Ze.flexboxOverlays):tt(Ze.noFlexboxLayoutsFoundOnThisPage)}
${this.flexContainerElements.length?nt`
${this.flexContainerElements.map((e=>this.renderElement(e)))}
`:""}
`:""} `:""} `,this.shadow,{host:this})}getEnumSettings(){return this.settings.filter(it)}getBooleanSettings(){return this.settings.filter(at)}onBooleanSettingChange(e,t){t.preventDefault(),this.dispatchEvent(new rt(e.name,t.target.checked))}onEnumSettingChange(e,t){t.preventDefault(),this.dispatchEvent(new rt(e.name,t.target.value))}onElementToggle(e,t){t.preventDefault(),e.toggle(t.target.checked)}onElementClick(e,t){t.preventDefault(),e.reveal()}onColorChange(e,t){t.preventDefault(),e.setColor(t.target.value),this.render()}onElementMouseEnter(e,t){t.preventDefault(),e.highlight()}onElementMouseLeave(e,t){t.preventDefault(),e.hideHighlight()}renderElement(e){const t=this.onElementToggle.bind(this,e),o=this.onElementClick.bind(this,e),n=this.onColorChange.bind(this,e),r=this.onElementMouseEnter.bind(this,e),i=this.onElementMouseLeave.bind(this,e);return nt`
`}renderBooleanSetting(e){const t=this.onBooleanSettingChange.bind(this,e);return nt``}renderEnumSetting(e){const t=this.onEnumSettingChange.bind(this,e);return nt``}}o.CustomElements.defineComponent("devtools-layout-pane",st);var ct=Object.freeze({__proto__:null,SettingChangedEvent:rt,LayoutPane:st}),lt=Object.freeze({__proto__:null});const dt=new CSSStyleSheet;dt.replaceSync(".container-link{display:inline-block;color:var(--color-text-disabled)}.container-link:hover{color:var(--color-link)}.queried-size-details{color:var(--color-text-primary)}.axis-icon{margin-left:.4em;width:1em;height:1em;vertical-align:text-top}.axis-icon.hidden{display:none}.axis-icon.vertical{transform:rotate(90deg)}\n/*# sourceURL=queryContainer.css */\n");const{render:ut,html:ht}=r,{PhysicalAxis:pt,QueryAxis:mt}=i.CSSContainerQuery;class gt extends Event{static eventName="queriedsizerequested";constructor(){super(gt.eventName,{})}}class bt extends HTMLElement{static litTagName=r.literal`devtools-query-container`;shadow=this.attachShadow({mode:"open"});queryName;container;onContainerLinkClick;isContainerLinkHovered=!1;queriedSizeDetails;set data(e){this.queryName=e.queryName,this.container=e.container,this.onContainerLinkClick=e.onContainerLinkClick,this.render()}connectedCallback(){this.shadow.adoptedStyleSheets=[dt]}updateContainerQueriedSizeDetails(e){this.queriedSizeDetails=e,this.render()}async onContainerLinkMouseEnter(){this.container?.highlightNode("container-outline"),this.isContainerLinkHovered=!0,this.dispatchEvent(new gt)}onContainerLinkMouseLeave(){this.container?.clearHighlight(),this.isContainerLinkHovered=!1,this.render()}render(){if(!this.container)return;let e,t;this.queryName||(e=this.container.getAttribute("id"),t=this.container.getAttribute("class")?.split(/\s+/).filter(Boolean));const o=this.queryName||this.container.nodeNameNicelyCased;ut(ht` → <${je.litTagName} data-node-title="${o}" .data="${{nodeTitle:o,nodeId:e,nodeClasses:t}}">${je.litTagName}> ${this.isContainerLinkHovered?this.renderQueriedSizeDetails():r.nothing} `,this.shadow,{host:this})}renderQueriedSizeDetails(){if(!this.queriedSizeDetails||""===this.queriedSizeDetails.queryAxis)return r.nothing;const e="size"===this.queriedSizeDetails.queryAxis,t=r.Directives.classMap({"axis-icon":!0,hidden:e,vertical:"Vertical"===this.queriedSizeDetails.physicalAxis});return ht` (${this.queriedSizeDetails.queryAxis}<${c.Icon.Icon.litTagName} class="${t}" .data="${{iconName:"ic_dimension_single",color:"var(--color-text-primary)"}}">${c.Icon.Icon.litTagName}>) ${e&&this.queriedSizeDetails.width?"width:":r.nothing} ${this.queriedSizeDetails.width||r.nothing} ${e&&this.queriedSizeDetails.height?"height:":r.nothing} ${this.queriedSizeDetails.height||r.nothing} `}}o.CustomElements.defineComponent("devtools-query-container",bt);var vt=Object.freeze({__proto__:null,QueriedSizeRequestedEvent:gt,QueryContainer:bt});const ft=new CSSStyleSheet;ft.replaceSync(".container{padding:12px;min-width:170px}.row{padding:0;color:var(--color-text-primary);padding-bottom:16px}.row:last-child{padding-bottom:0}.property{padding-bottom:4px;white-space:nowrap}.property-name{color:var(--color-syntax-1)}.property-value{color:var(--color-text-primary)}.property-value.not-authored{color:var(--color-text-disabled)}.buttons{display:flex;flex-direction:row}.buttons>:first-child{border-radius:3px 0 0 3px}.buttons>:last-child{border-radius:0 3px 3px 0}.button{border:1px solid var(--color-background-elevation-2);background-color:var(--color-background);width:24px;height:24px;min-width:24px;min-height:24px;padding:0;margin:0;display:flex;justify-content:center;align-items:center;cursor:pointer}.button:focus-visible{outline:auto 5px -webkit-focus-ring-color}.button devtools-icon{--icon-color:var(--color-text-secondary)}.button.selected{background-color:var(--color-background-elevation-1)}.button.selected devtools-icon{--icon-color:var(--color-primary)}\n/*# sourceURL=stylePropertyEditor.css */\n");const yt={selectButton:"Add {propertyName}: {propertyValue}",deselectButton:"Remove {propertyName}: {propertyValue}"},xt=e.i18n.registerUIStrings("panels/elements/components/StylePropertyEditor.ts",yt),wt=e.i18n.getLocalizedString.bind(void 0,xt),{render:kt,html:St,Directives:Tt}=r;class Ct extends Event{static eventName="propertyselected";data;constructor(e,t){super(Ct.eventName,{}),this.data={name:e,value:t}}}class Et extends Event{static eventName="propertydeselected";data;constructor(e,t){super(Et.eventName,{}),this.data={name:e,value:t}}}class Ot extends HTMLElement{shadow=this.attachShadow({mode:"open"});authoredProperties=new Map;computedProperties=new Map;editableProperties=[];constructor(){super()}connectedCallback(){this.shadow.adoptedStyleSheets=[ft]}getEditableProperties(){return this.editableProperties}set data(e){this.authoredProperties=e.authoredProperties,this.computedProperties=e.computedProperties,this.render()}render(){kt(St` ${this.editableProperties.map((e=>this.renderProperty(e)))}
`,this.shadow,{host:this})}renderProperty(e){const t=this.authoredProperties.get(e.propertyName),o=!t,n=t||this.computedProperties.get(e.propertyName),r=Tt.classMap({"property-value":!0,"not-authored":o});return St` ${e.propertyName}: ${n}
${e.propertyValues.map((o=>this.renderButton(o,e.propertyName,o===t)))}
`}renderButton(e,t,o=!1){const n=`${t}: ${e}`,r=this.findIcon(n,this.computedProperties);if(!r)throw new Error(`Icon for ${n} is not found`);const i=`transform: rotate(${r.rotate}deg) scale(${r.scaleX}, ${r.scaleY})`,a=Tt.classMap({button:!0,selected:o}),s={propertyName:t,propertyValue:e},l=wt(o?yt.deselectButton:yt.selectButton,s);return St``}onButtonClick(e,t,o){o?this.dispatchEvent(new Et(e,t)):this.dispatchEvent(new Ct(e,t))}findIcon(e,t){throw new Error("Not implemented")}}class Nt extends Ot{editableProperties=$t;findIcon(e,t){return be(e,t)}}o.CustomElements.defineComponent("devtools-flexbox-editor",Nt);class _t extends Ot{editableProperties=It;findIcon(e,t){return fe(e,t)}}o.CustomElements.defineComponent("devtools-grid-editor",_t);const $t=[{propertyName:"flex-direction",propertyValues:["row","column","row-reverse","column-reverse"]},{propertyName:"flex-wrap",propertyValues:["nowrap","wrap"]},{propertyName:"align-content",propertyValues:["center","flex-start","flex-end","space-around","space-between","stretch"]},{propertyName:"justify-content",propertyValues:["center","flex-start","flex-end","space-between","space-around","space-evenly"]},{propertyName:"align-items",propertyValues:["center","flex-start","flex-end","stretch","baseline"]}],It=[{propertyName:"align-content",propertyValues:["center","space-between","space-around","space-evenly","stretch"]},{propertyName:"justify-content",propertyValues:["center","start","end","space-between","space-around","space-evenly"]},{propertyName:"align-items",propertyValues:["center","start","end","stretch","baseline"]},{propertyName:"justify-items",propertyValues:["center","start","end","stretch"]}];var Mt=Object.freeze({__proto__:null,PropertySelectedEvent:Ct,PropertyDeselectedEvent:Et,StylePropertyEditor:Ot,FlexboxEditor:Nt,GridEditor:_t,FlexboxEditableProperties:$t,GridEditableProperties:It});export{g as AccessibilityTreeNode,w as AdornerManager,$ as AdornerSettingsPane,xe as CSSPropertyIconResolver,Ee as CSSQuery,P as ComputedStyleProperty,q as ComputedStyleTrace,Ve as ElementsBreadcrumbs,ze as ElementsBreadcrumbsUtils,Ye as ElementsPanelLink,Ke as Helper,ct as LayoutPane,lt as LayoutPaneUtils,Be as NodeText,vt as QueryContainer,Mt as StylePropertyEditor};
diff --git a/chii/panels/elements/elements-legacy.js b/chii/panels/elements/elements-legacy.js
new file mode 100644
index 00000000..ac17ecf8
--- /dev/null
+++ b/chii/panels/elements/elements-legacy.js
@@ -0,0 +1 @@
+import*as e from"./elements.js";self.Elements=self.Elements||{},Elements=Elements||{},Elements.ClassesPaneWidget=e.ClassesPaneWidget.ClassesPaneWidget,Elements.ClassesPaneWidget.ButtonProvider=e.ClassesPaneWidget.ButtonProvider,Elements.ComputedStyleModel=e.ComputedStyleModel.ComputedStyleModel,Elements.ComputedStyleWidget=e.ComputedStyleWidget.ComputedStyleWidget,Elements.DOMLinkifier={},Elements.DOMLinkifier.Linkifier=e.DOMLinkifier.Linkifier,Elements.DOMPath={},Elements.DOMPath.fullQualifiedSelector=e.DOMPath.fullQualifiedSelector,Elements.DOMPath.cssPath=e.DOMPath.cssPath,Elements.DOMPath.jsPath=e.DOMPath.jsPath,Elements.DOMPath.xPath=e.DOMPath.xPath,Elements.ElementStatePaneWidget=e.ElementStatePaneWidget.ElementStatePaneWidget,Elements.ElementStatePaneWidget.ButtonProvider=e.ElementStatePaneWidget.ButtonProvider,Elements.ElementsPanel=e.ElementsPanel.ElementsPanel,Elements.ElementsPanel.ContextMenuProvider=e.ElementsPanel.ContextMenuProvider,Elements.ElementsPanel.DOMNodeRevealer=e.ElementsPanel.DOMNodeRevealer,Elements.ElementsPanel.CSSPropertyRevealer=e.ElementsPanel.CSSPropertyRevealer,Elements.ElementsActionDelegate=e.ElementsPanel.ElementsActionDelegate,Elements.ElementsPanel.PseudoStateMarkerDecorator=e.ElementsPanel.PseudoStateMarkerDecorator,Elements.ElementsTreeElement=e.ElementsTreeElement.ElementsTreeElement,Elements.ElementsTreeOutline=e.ElementsTreeOutline.ElementsTreeOutline,Elements.ElementsTreeOutline.Renderer=e.ElementsTreeOutline.Renderer,Elements.EventListenersWidget=e.EventListenersWidget.EventListenersWidget,Elements.InspectElementModeController=e.InspectElementModeController.InspectElementModeController,Elements.InspectElementModeController.ToggleSearchActionDelegate=e.InspectElementModeController.ToggleSearchActionDelegate,Elements.MarkerDecorator=e.MarkerDecorator.MarkerDecorator,Elements.GenericDecorator=e.MarkerDecorator.GenericDecorator,Elements.LayoutSidebarPane=e.LayoutSidebarPane.LayoutSidebarPane,Elements.MetricsSidebarPane=e.MetricsSidebarPane.MetricsSidebarPane,Elements.NodeStackTraceWidget=e.NodeStackTraceWidget.NodeStackTraceWidget,Elements.PropertiesWidget=e.PropertiesWidget.PropertiesWidget,Elements.StylePropertyTreeElement=e.StylePropertyTreeElement.StylePropertyTreeElement,Elements.StylesSidebarPane=e.StylesSidebarPane.StylesSidebarPane,Elements.StylesSidebarPane.CSSPropertyPrompt=e.StylesSidebarPane.CSSPropertyPrompt,Elements.StylesSidebarPane.ButtonProvider=e.StylesSidebarPane.ButtonProvider,Elements.StylePropertiesSection=e.StylesSidebarPane.StylePropertiesSection;
diff --git a/chii/panels/elements/elements-meta.js b/chii/panels/elements/elements-meta.js
new file mode 100644
index 00000000..dd982f5b
--- /dev/null
+++ b/chii/panels/elements/elements-meta.js
@@ -0,0 +1 @@
+import*as e from"../../core/common/common.js";import*as t from"../../core/root/root.js";import*as n from"../../core/sdk/sdk.js";import*as o from"../../ui/legacy/legacy.js";import*as i from"../../core/i18n/i18n.js";const a={showElements:"Show Elements",elements:"Elements",showEventListeners:"Show Event Listeners",eventListeners:"Event Listeners",showProperties:"Show Properties",properties:"Properties",showStackTrace:"Show Stack Trace",stackTrace:"Stack Trace",showLayout:"Show Layout",layout:"Layout",hideElement:"Hide element",editAsHtml:"Edit as HTML",duplicateElement:"Duplicate element",undo:"Undo",redo:"Redo",captureAreaScreenshot:"Capture area screenshot",selectAnElementInThePageTo:"Select an element in the page to inspect it",wordWrap:"Word wrap",enableDomWordWrap:"Enable `DOM` word wrap",disableDomWordWrap:"Disable `DOM` word wrap",showHtmlComments:"Show `HTML` comments",hideHtmlComments:"Hide `HTML` comments",revealDomNodeOnHover:"Reveal `DOM` node on hover",showDetailedInspectTooltip:"Show detailed inspect tooltip",copyStyles:"Copy styles",showUserAgentShadowDOM:"Show user agent shadow `DOM`"},s=i.i18n.registerUIStrings("panels/elements/elements-meta.ts",a),r=i.i18n.getLazilyComputedLocalizedString.bind(void 0,s);let l;async function c(){return l||(l=await import("./elements.js")),l}function g(e){return void 0===l?[]:e(l)}o.ViewManager.registerViewExtension({location:"panel",id:"elements",commandPrompt:r(a.showElements),title:r(a.elements),order:10,persistence:"permanent",hasToolbar:!1,loadView:async()=>(await c()).ElementsPanel.ElementsPanel.instance()}),o.ViewManager.registerViewExtension({location:"elements-sidebar",id:"elements.eventListeners",commandPrompt:r(a.showEventListeners),title:r(a.eventListeners),order:5,hasToolbar:!0,persistence:"permanent",loadView:async()=>(await c()).EventListenersWidget.EventListenersWidget.instance()}),o.ViewManager.registerViewExtension({location:"elements-sidebar",id:"elements.domProperties",commandPrompt:r(a.showProperties),title:r(a.properties),order:7,persistence:"permanent",loadView:async()=>(await c()).PropertiesWidget.PropertiesWidget.instance()}),o.ViewManager.registerViewExtension({experiment:t.Runtime.ExperimentName.CAPTURE_NODE_CREATION_STACKS,location:"elements-sidebar",id:"elements.domCreation",commandPrompt:r(a.showStackTrace),title:r(a.stackTrace),order:10,persistence:"permanent",loadView:async()=>(await c()).NodeStackTraceWidget.NodeStackTraceWidget.instance()}),o.ViewManager.registerViewExtension({location:"elements-sidebar",id:"elements.layout",commandPrompt:r(a.showLayout),title:r(a.layout),order:4,persistence:"permanent",loadView:async()=>(await c()).LayoutSidebarPane.LayoutSidebarPane.instance()}),o.ActionRegistration.registerActionExtension({actionId:"elements.hide-element",category:o.ActionRegistration.ActionCategory.ELEMENTS,title:r(a.hideElement),loadActionDelegate:async()=>(await c()).ElementsPanel.ElementsActionDelegate.instance(),contextTypes:()=>g((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"H"}]}),o.ActionRegistration.registerActionExtension({actionId:"elements.edit-as-html",category:o.ActionRegistration.ActionCategory.ELEMENTS,title:r(a.editAsHtml),loadActionDelegate:async()=>(await c()).ElementsPanel.ElementsActionDelegate.instance(),contextTypes:()=>g((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"F2"}]}),o.ActionRegistration.registerActionExtension({actionId:"elements.duplicate-element",category:o.ActionRegistration.ActionCategory.ELEMENTS,title:r(a.duplicateElement),loadActionDelegate:async()=>(await c()).ElementsPanel.ElementsActionDelegate.instance(),contextTypes:()=>g((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"Shift+Alt+Down"}]}),o.ActionRegistration.registerActionExtension({actionId:"elements.copy-styles",category:o.ActionRegistration.ActionCategory.ELEMENTS,title:r(a.copyStyles),loadActionDelegate:async()=>(await c()).ElementsPanel.ElementsActionDelegate.instance(),contextTypes:()=>g((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"Ctrl+Alt+C",platform:"windows,linux"},{shortcut:"Meta+Alt+C",platform:"mac"}]}),o.ActionRegistration.registerActionExtension({actionId:"elements.undo",category:o.ActionRegistration.ActionCategory.ELEMENTS,title:r(a.undo),loadActionDelegate:async()=>(await c()).ElementsPanel.ElementsActionDelegate.instance(),contextTypes:()=>g((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"Ctrl+Z",platform:"windows,linux"},{shortcut:"Meta+Z",platform:"mac"}]}),o.ActionRegistration.registerActionExtension({actionId:"elements.redo",category:o.ActionRegistration.ActionCategory.ELEMENTS,title:r(a.redo),loadActionDelegate:async()=>(await c()).ElementsPanel.ElementsActionDelegate.instance(),contextTypes:()=>g((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"Ctrl+Y",platform:"windows,linux"},{shortcut:"Meta+Shift+Z",platform:"mac"}]}),o.ActionRegistration.registerActionExtension({actionId:"elements.capture-area-screenshot",loadActionDelegate:async()=>(await c()).InspectElementModeController.ToggleSearchActionDelegate.instance(),condition:t.Runtime.ConditionName.CAN_DOCK,title:r(a.captureAreaScreenshot),category:o.ActionRegistration.ActionCategory.SCREENSHOT}),o.ActionRegistration.registerActionExtension({category:o.ActionRegistration.ActionCategory.ELEMENTS,actionId:"elements.toggle-element-search",toggleable:!0,loadActionDelegate:async()=>(await c()).InspectElementModeController.ToggleSearchActionDelegate.instance(),title:r(a.selectAnElementInThePageTo),iconClass:"largeicon-node-search",bindings:[{shortcut:"Ctrl+Shift+C",platform:"windows,linux"},{shortcut:"Meta+Shift+C",platform:"mac"}]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.ELEMENTS,storageType:e.Settings.SettingStorageType.Synced,order:1,title:r(a.showUserAgentShadowDOM),settingName:"showUAShadowDOM",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!1}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.ELEMENTS,storageType:e.Settings.SettingStorageType.Synced,order:2,title:r(a.wordWrap),settingName:"domWordWrap",settingType:e.Settings.SettingType.BOOLEAN,options:[{value:!0,title:r(a.enableDomWordWrap)},{value:!1,title:r(a.disableDomWordWrap)}],defaultValue:!0}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.ELEMENTS,storageType:e.Settings.SettingStorageType.Synced,order:3,title:r(a.showHtmlComments),settingName:"showHTMLComments",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!0,options:[{value:!0,title:r(a.showHtmlComments)},{value:!1,title:r(a.hideHtmlComments)}]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.ELEMENTS,storageType:e.Settings.SettingStorageType.Synced,order:4,title:r(a.revealDomNodeOnHover),settingName:"highlightNodeOnHoverInOverlay",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!0}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.ELEMENTS,storageType:e.Settings.SettingStorageType.Synced,order:5,title:r(a.showDetailedInspectTooltip),settingName:"showDetailedInspectTooltip",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!0}),e.Settings.registerSettingExtension({settingName:"showEventListenersForAncestors",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!0}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.ADORNER,storageType:e.Settings.SettingStorageType.Synced,settingName:"adornerSettings",settingType:e.Settings.SettingType.ARRAY,defaultValue:[]}),o.ContextMenu.registerProvider({contextTypes:()=>[n.RemoteObject.RemoteObject,n.DOMModel.DOMNode,n.DOMModel.DeferredDOMNode],loadProvider:async()=>(await c()).ElementsPanel.ContextMenuProvider.instance(),experiment:void 0}),o.ViewManager.registerLocationResolver({name:"elements-sidebar",category:o.ViewManager.ViewLocationCategoryValues.ELEMENTS,loadResolver:async()=>(await c()).ElementsPanel.ElementsPanel.instance()}),e.Revealer.registerRevealer({contextTypes:()=>[n.DOMModel.DOMNode,n.DOMModel.DeferredDOMNode,n.RemoteObject.RemoteObject],destination:e.Revealer.RevealerDestination.ELEMENTS_PANEL,loadRevealer:async()=>(await c()).ElementsPanel.DOMNodeRevealer.instance()}),e.Revealer.registerRevealer({contextTypes:()=>[n.CSSProperty.CSSProperty],destination:e.Revealer.RevealerDestination.STYLES_SIDEBAR,loadRevealer:async()=>(await c()).ElementsPanel.CSSPropertyRevealer.instance()}),o.Toolbar.registerToolbarItem({loadItem:async()=>(await c()).ElementStatePaneWidget.ButtonProvider.instance(),order:1,location:o.Toolbar.ToolbarItemLocation.STYLES_SIDEBARPANE_TOOLBAR,showLabel:void 0,condition:void 0,separator:void 0,actionId:void 0}),o.Toolbar.registerToolbarItem({loadItem:async()=>(await c()).ClassesPaneWidget.ButtonProvider.instance(),order:2,location:o.Toolbar.ToolbarItemLocation.STYLES_SIDEBARPANE_TOOLBAR,showLabel:void 0,condition:void 0,separator:void 0,actionId:void 0}),o.Toolbar.registerToolbarItem({loadItem:async()=>(await c()).StylesSidebarPane.ButtonProvider.instance(),order:100,location:o.Toolbar.ToolbarItemLocation.STYLES_SIDEBARPANE_TOOLBAR,showLabel:void 0,condition:void 0,separator:void 0,actionId:void 0}),o.Toolbar.registerToolbarItem({actionId:"elements.toggle-element-search",location:o.Toolbar.ToolbarItemLocation.MAIN_TOOLBAR_LEFT,order:0,showLabel:void 0,condition:void 0,separator:void 0,loadItem:void 0}),o.UIUtils.registerRenderer({contextTypes:()=>[n.DOMModel.DOMNode,n.DOMModel.DeferredDOMNode],loadRenderer:async()=>(await c()).ElementsTreeOutline.Renderer.instance()}),e.Linkifier.registerLinkifier({contextTypes:()=>[n.DOMModel.DOMNode,n.DOMModel.DeferredDOMNode],loadLinkifier:async()=>(await c()).DOMLinkifier.Linkifier.instance()});
diff --git a/chii/panels/elements/elements.js b/chii/panels/elements/elements.js
new file mode 100644
index 00000000..efacd1be
--- /dev/null
+++ b/chii/panels/elements/elements.js
@@ -0,0 +1 @@
+import*as e from"../../core/common/common.js";import*as t from"../../core/root/root.js";import*as n from"../../core/sdk/sdk.js";import*as i from"../../ui/legacy/legacy.js";import*as s from"../../core/host/host.js";import*as o from"../../core/i18n/i18n.js";import*as r from"../../models/extensions/extensions.js";import*as l from"../../ui/components/icon_button/icon_button.js";import*as a from"../../ui/legacy/components/utils/utils.js";import*as d from"../../ui/components/tree_outline/tree_outline.js";import*as h from"./components/components.js";import*as c from"../../ui/lit-html/lit-html.js";import*as p from"../../core/platform/platform.js";import*as u from"../../ui/legacy/components/inline_editor/inline_editor.js";import*as m from"../../models/bindings/bindings.js";import*as g from"../../models/text_utils/text_utils.js";import*as y from"../../ui/legacy/components/color_picker/color_picker.js";import*as f from"../../third_party/codemirror.next/codemirror.next.js";import*as S from"../../ui/components/adorners/adorners.js";import*as b from"../../ui/components/code_highlighter/code_highlighter.js";import*as v from"../../ui/components/text_editor/text_editor.js";import*as E from"../emulation/emulation.js";import*as C from"../event_listeners/event_listeners.js";import*as w from"../../ui/legacy/components/object_ui/object_ui.js";const x=new CSSStyleSheet;function M(e){const t=n.FrameManager.FrameManager.instance().getFrame(e)?.resourceTreeModel().target().model(n.AccessibilityModel.AccessibilityModel);if(!t)throw Error("Could not instantiate model for frameId");return t}async function T(e){const t=M(e),n=await t.requestRootNode(e);if(!n)throw Error("No accessibility root for frame");return n}function I(e){let t;if(t=e instanceof n.DOMModel.DOMDocument?e.body?.frameId():e.frameId(),!t)throw Error("No frameId for DOM node");return t}async function N(e){const t=e;return 0===(n=e).numChildren()&&"Iframe"!==n.role()?.value?[{treeNodeData:t,id:O(e)}]:[{treeNodeData:t,children:async()=>{const t=await async function(e){if("Iframe"===e.role()?.value){const t=await(e.deferredDOMNode()?.resolvePromise());if(!t)throw new Error("Could not find corresponding DOMNode");const n=t.frameOwnerFrameId();if(!n)throw Error("No owner frameId on iframe node");return[await T(n)]}if(e.hasUnloadedChildren()&&(await e.accessibilityModel().requestAXChildren(e.id(),e.getFrameId()||void 0),e.numChildren()!==e.children().length))throw new Error("Once loaded, number of children and length of children must match.");return e.children()}(e);return(await Promise.all(t.map((e=>N(e))))).flat(1)},id:O(e)}];var n}function P(e){const t=h.AccessibilityTreeNode.AccessibilityTreeNode.litTagName,n=e.treeNodeData,i=n.name()?.value||"",s=n.role()?.value||"",o=n.properties()||[],r=n.ignored();return c.html`<${t} .data="${{name:i,role:s,ignored:r,properties:o}}">${t}>`}function O(e){return e.getFrameId()+"#"+e.id()}x.replaceSync("#elements-content{flex:1 1;overflow:auto;padding:2px 0 0}.style-panes-wrapper{overflow:hidden scroll;background-color:var(--color-background)}.style-panes-wrapper>div:not(:last-child){border-bottom:1px solid var(--color-details-hairline)}#elements-content:not(.elements-wrap)>div{display:inline-block;min-width:100%}#elements-crumbs{background-color:var(--color-background);border-top:1px solid var(--color-details-hairline);overflow:hidden;width:100%}.elements-tree-header{height:24px;border-top:1px solid var(--color-details-hairline);border-bottom:1px solid var(--color-details-hairline);display:flex;flex-direction:row;align-items:center}.elements-tree-header-frame{margin-left:6px;margin-right:6px;flex:none}devtools-adorner-settings-pane{margin-bottom:10px;border-bottom:1px solid var(--color-details-hairline);overflow:auto}devtools-tree-outline{overflow:auto}.axtree-button{position:absolute;padding:4px;top:16px;right:16px;display:flex;justify-content:center;align-items:center;z-index:1}\n/*# sourceURL=elementsPanel.css */\n");class k extends i.Widget.VBox{accessibilityTreeComponent=new d.TreeOutline.TreeOutline;toggleButton;inspectedDOMNode=null;root=null;constructor(e){super(),this.toggleButton=e,this.contentElement.appendChild(this.toggleButton),this.contentElement.appendChild(this.accessibilityTreeComponent),n.TargetManager.TargetManager.instance().observeModels(n.AccessibilityModel.AccessibilityModel,this),this.accessibilityTreeComponent.addEventListener("itemselected",(e=>{const t=e.data.node.treeNodeData;if(!t.isDOMNode())return;const n=t.deferredDOMNode();n&&n.resolve((e=>{e&&(this.inspectedDOMNode=e,an.instance().revealAndSelectNode(e,!0,!1))}))})),this.accessibilityTreeComponent.addEventListener("itemmouseover",(e=>{e.data.node.treeNodeData.highlightDOMNode()})),this.accessibilityTreeComponent.addEventListener("itemmouseout",(()=>{n.OverlayModel.OverlayModel.hideDOMNodeHighlight()}))}async wasShown(){await this.refreshAccessibilityTree(),this.inspectedDOMNode&&await this.loadSubTreeIntoAccessibilityModel(this.inspectedDOMNode)}async refreshAccessibilityTree(){if(!this.root){const e=n.FrameManager.FrameManager.instance().getTopFrame()?.id;if(!e)throw Error("No top frame");if(this.root=await T(e),!this.root)throw Error("No root")}await this.renderTree(),await this.accessibilityTreeComponent.expandRecursively(1)}async renderTree(){if(!this.root)return;const e=await N(this.root);this.accessibilityTreeComponent.data={defaultRenderer:P,tree:e,filter:e=>e.ignored()||"generic"===e.role()?.value&&!e.name()?.value?"FLATTEN":"SHOW"}}async loadSubTreeIntoAccessibilityModel(e){const t=await async function(e){let t=I(e);const i=M(t),s=await i.requestAndLoadSubTreeToNode(e);if(!s)throw Error("Could not retrieve accessibility node for inspected DOM node");const o=n.FrameManager.FrameManager.instance().getTopFrame()?.id;if(!o)return s;for(;t!==o;){const e=await(n.FrameManager.FrameManager.instance().getFrame(t)?.getOwnerDOMNodeOrDocument());if(!e)break;t=I(e);const i=M(t),o=await i.requestAndLoadSubTreeToNode(e);s.push(...o||[])}return s}(e),i=t.find((t=>t.backendDOMNodeId()===e.backendNodeId()));i&&(await this.accessibilityTreeComponent.expandNodeIds(t.map((e=>e.getFrameId()+"#"+e.id()))),await this.accessibilityTreeComponent.focusNodeId(O(i)))}async revealAndSelectNode(e){e!==this.inspectedDOMNode&&(this.inspectedDOMNode=e,this.isShowing()&&await this.loadSubTreeIntoAccessibilityModel(e))}async selectedNodeChanged(e){this.isShowing()||(!e.ownerDocument||"HTML"!==e.nodeName()&&"BODY"!==e.nodeName()||(e=e.ownerDocument),e!==this.inspectedDOMNode&&(this.inspectedDOMNode=e))}treeUpdated({data:e}){if(!e.root)return void this.renderTree();const t=n.FrameManager.FrameManager.instance().getTopFrame()?.id;e.root?.getFrameId()===t?(this.root=e.root,this.accessibilityTreeComponent.collapseAllNodes(),this.refreshAccessibilityTree()):this.renderTree()}modelAdded(e){e.addEventListener(n.AccessibilityModel.Events.TreeUpdated,this.treeUpdated,this)}modelRemoved(e){e.removeEventListener(n.AccessibilityModel.Events.TreeUpdated,this.treeUpdated,this)}}const L=new CSSStyleSheet;L.replaceSync(".computed-properties{user-select:text;flex-shrink:0}.styles-sidebar-pane-toolbar{border-bottom:1px solid var(--color-details-hairline-light);flex-shrink:0}.styles-sidebar-pane-filter-box{flex:auto;display:flex}.styles-sidebar-pane-filter-box>input{outline:0!important;border:none;width:100%;background:var(--color-background);padding-left:4px;margin:3px}.styles-sidebar-pane-filter-box>input:focus,.styles-sidebar-pane-filter-box>input:not(:placeholder-shown){box-shadow:var(--legacy-focus-ring-active-shadow)}.styles-sidebar-pane-filter-box>input::placeholder{color:var(--color-text-disabled)}@media (forced-colors:active){.styles-sidebar-pane-filter-box>input{border:1px solid ButtonText}}\n/*# sourceURL=computedStyleSidebarPane.css */\n");const D=new CSSStyleSheet;D.replaceSync(".alphabetical-list.render-flash{min-height:100vh}.tree-outline,.tree-outline ol{padding-left:0}.tree-outline li:hover{background-color:var(--legacy-focus-bg-color);cursor:pointer}.tree-outline li::before{margin:0 -1px 0 4px}.group-title{padding-right:16px}.tree-outline li.group-title:hover{background-color:transparent}.group-title>h1{margin:1px 0 0;padding:1em 0;width:100%;cursor:pointer;color:var(--color-text-secondary);font-size:11px;font-weight:400}.group-title:not(.first-group)>h1{border-top:1px solid var(--color-details-hairline)}.group-title+ol.children{margin-bottom:1em}@media (forced-colors:active){:host-context(.monospace.computed-properties) .tree-outline li:hover{forced-color-adjust:none;background-color:Highlight}:host-context(.monospace.computed-properties) .tree-outline-disclosure li.parent:hover::before,:host-context(.monospace.computed-properties) .tree-outline:not(.hide-selection-when-blurred) li.parent:hover.selected::before{background-color:HighlightText}:host-context(.monospace.computed-properties) .tree-outline li:hover *{color:HighlightText}}\n/*# sourceURL=computedStyleWidgetTree.css */\n");class A extends e.ObjectWrapper.ObjectWrapper{nodeInternal;cssModelInternal;eventListeners;frameResizedTimer;computedStylePromise;constructor(){super(),this.nodeInternal=i.Context.Context.instance().flavor(n.DOMModel.DOMNode),this.cssModelInternal=null,this.eventListeners=[],i.Context.Context.instance().addFlavorChangeListener(n.DOMModel.DOMNode,this.onNodeChanged,this)}node(){return this.nodeInternal}cssModel(){return this.cssModelInternal&&this.cssModelInternal.isEnabled()?this.cssModelInternal:null}onNodeChanged(e){this.nodeInternal=e.data,this.updateModel(this.nodeInternal?this.nodeInternal.domModel().cssModel():null),this.onComputedStyleChanged(null)}updateModel(t){if(this.cssModelInternal===t)return;e.EventTarget.removeEventListeners(this.eventListeners),this.cssModelInternal=t;const i=t?t.domModel():null,s=t?t.target().model(n.ResourceTreeModel.ResourceTreeModel):null;t&&i&&s&&(this.eventListeners=[t.addEventListener(n.CSSModel.Events.StyleSheetAdded,this.onComputedStyleChanged,this),t.addEventListener(n.CSSModel.Events.StyleSheetRemoved,this.onComputedStyleChanged,this),t.addEventListener(n.CSSModel.Events.StyleSheetChanged,this.onComputedStyleChanged,this),t.addEventListener(n.CSSModel.Events.FontsUpdated,this.onComputedStyleChanged,this),t.addEventListener(n.CSSModel.Events.MediaQueryResultChanged,this.onComputedStyleChanged,this),t.addEventListener(n.CSSModel.Events.PseudoStateForced,this.onComputedStyleChanged,this),t.addEventListener(n.CSSModel.Events.ModelWasEnabled,this.onComputedStyleChanged,this),i.addEventListener(n.DOMModel.Events.DOMMutated,this.onDOMModelChanged,this),s.addEventListener(n.ResourceTreeModel.Events.FrameResized,this.onFrameResized,this)])}onComputedStyleChanged(e){delete this.computedStylePromise,this.dispatchEventToListeners("ComputedStyleChanged",e?.data??null)}onDOMModelChanged(e){const t=e.data;this.nodeInternal&&(this.nodeInternal===t||t.parentNode===this.nodeInternal.parentNode||t.isAncestor(this.nodeInternal))&&this.onComputedStyleChanged(null)}onFrameResized(){this.frameResizedTimer&&clearTimeout(this.frameResizedTimer),this.frameResizedTimer=setTimeout(function(){this.onComputedStyleChanged(null),delete this.frameResizedTimer}.bind(this),100)}elementNode(){const e=this.node();return e?e.enclosingElementOrSelf():null}async fetchComputedStyle(){const e=this.elementNode(),t=this.cssModel();if(!e||!t)return null;const n=e.id;return n?(this.computedStylePromise||(this.computedStylePromise=t.computedStylePromise(n).then(function(e,t){return e===this.elementNode()&&t?new R(e,t):null}.bind(this,e))),this.computedStylePromise):null}}class R{node;computedStyle;constructor(e,t){this.node=e,this.computedStyle=t}}var F=Object.freeze({__proto__:null,ComputedStyleModel:A,ComputedStyle:R});class U{getLinkElement;getDOMNode;popover;constructor(e,t,n){this.getLinkElement=t,this.getDOMNode=n,this.popover=new i.PopoverHelper.PopoverHelper(e,this.handleRequest.bind(this)),this.popover.setHasPadding(!0),this.popover.setTimeout(0,100)}handleRequest(e){const t=this.getLinkElement(e);if(!t)return null;const n=H.get(t);return n?{box:t.boxInWindow(),hide:void 0,show:async e=>{const i=this.getDOMNode(t);if(!i)return!1;const s=await a.ImagePreview.ImagePreview.loadDimensionsForNode(i),o=await a.ImagePreview.ImagePreview.build(i.domModel().target(),n,!0,{imageAltText:void 0,precomputedFeatures:s});return o&&e.contentElement.appendChild(o),Boolean(o)}}:null}hide(){this.popover.hidePopover()}static setImageUrl(e,t){return H.set(e,t),e}static getImageURL(e){return H.get(e)}}const H=new WeakMap,B=new CSSStyleSheet;B.replaceSync(":host{user-select:text}.platform-fonts{flex-shrink:0}.font-name{font-weight:700}.font-usage{color:var(--color-text-secondary);padding-left:3px}.title{padding:0 5px;border-top:1px solid;border-bottom:1px solid;border-color:var(--color-background-elevation-2);white-space:nowrap;text-overflow:ellipsis;overflow:hidden;height:24px;background-color:var(--color-background-elevation-0);display:flex;align-items:center}.stats-section{margin:5px 0}.font-stats-item{padding-left:1em}.font-stats-item .font-delimeter{margin:0 1ex}\n/*# sourceURL=platformFontsWidget.css */\n");const V={renderedFonts:"Rendered Fonts",networkResource:"Network resource",localFile:"Local file",dGlyphs:"{n, plural, =1 {(# glyph)} other {(# glyphs)}}"},W=o.i18n.registerUIStrings("panels/elements/PlatformFontsWidget.ts",V),_=o.i18n.getLocalizedString.bind(void 0,W);class z extends i.ThrottledWidget.ThrottledWidget{sharedModel;sectionTitle;fontStatsSection;constructor(e){super(!0),this.sharedModel=e,this.sharedModel.addEventListener("ComputedStyleChanged",this.update,this),this.sectionTitle=document.createElement("div"),this.sectionTitle.classList.add("title"),this.contentElement.classList.add("platform-fonts"),this.contentElement.appendChild(this.sectionTitle),this.sectionTitle.textContent=_(V.renderedFonts),this.fontStatsSection=this.contentElement.createChild("div","stats-section")}doUpdate(){const e=this.sharedModel.cssModel(),t=this.sharedModel.node();return t&&e?e.platformFontsPromise(t.id).then(this.refreshUI.bind(this,t)):Promise.resolve()}refreshUI(e,t){if(this.sharedModel.node()!==e)return;this.fontStatsSection.removeChildren();const n=!t||!t.length;if(this.sectionTitle.classList.toggle("hidden",n),!n&&t){t.sort((function(e,t){return t.glyphCount-e.glyphCount}));for(let e=0;eq.has(e)?q.get(e):e.startsWith("--")?["CSS Variables"]:[],Q=e=>{const t=n.CSSMetadata.cssMetadata(),i=t.canonicalPropertyName(e),s=$(i);if(s.length>0)return s;const o=t.getShorthands(i);if(o)for(const e of o){const t=$(e);if(t.length>0)return t}return["Other"]},X={openCubicBezierEditor:"Open cubic bezier editor",openShadowEditor:"Open shadow editor"},J=o.i18n.registerUIStrings("panels/elements/ColorSwatchPopoverIcon.ts",X),Y=o.i18n.getLocalizedString.bind(void 0,J);class Z{treeElement;swatchPopoverHelper;swatch;boundBezierChanged;boundOnScroll;bezierEditor;scrollerElement;originalPropertyText;constructor(e,t,n){this.treeElement=e,this.swatchPopoverHelper=t,this.swatch=n,i.Tooltip.Tooltip.install(this.swatch.iconElement(),Y(X.openCubicBezierEditor)),this.swatch.iconElement().addEventListener("click",this.iconClick.bind(this),!1),this.swatch.iconElement().addEventListener("mousedown",(e=>e.consume()),!1),this.boundBezierChanged=this.bezierChanged.bind(this),this.boundOnScroll=this.onScroll.bind(this)}iconClick(t){if(t.consume(!0),this.swatchPopoverHelper.isShowing())return void this.swatchPopoverHelper.hide(!0);const n=i.Geometry.CubicBezier.parse(this.swatch.bezierText())||i.Geometry.CubicBezier.parse("linear");this.bezierEditor=new u.BezierEditor.BezierEditor(n),this.bezierEditor.setBezier(n),this.bezierEditor.addEventListener(u.BezierEditor.Events.BezierChanged,this.boundBezierChanged),this.swatchPopoverHelper.show(this.bezierEditor,this.swatch.iconElement(),this.onPopoverHidden.bind(this)),this.scrollerElement=this.swatch.enclosingNodeOrSelfWithClass("style-panes-wrapper"),this.scrollerElement&&this.scrollerElement.addEventListener("scroll",this.boundOnScroll,!1),this.originalPropertyText=this.treeElement.property.propertyText,this.treeElement.parentPane().setEditingStyle(!0);const s=m.CSSWorkspaceBinding.CSSWorkspaceBinding.instance().propertyUILocation(this.treeElement.property,!1);s&&e.Revealer.reveal(s,!0)}bezierChanged(e){this.swatch.setBezierText(e.data),this.treeElement.applyStyleText(this.treeElement.renderedPropertyText(),!1)}onScroll(e){this.swatchPopoverHelper.hide(!0)}onPopoverHidden(e){this.scrollerElement&&this.scrollerElement.removeEventListener("scroll",this.boundOnScroll,!1),this.bezierEditor&&this.bezierEditor.removeEventListener(u.BezierEditor.Events.BezierChanged,this.boundBezierChanged),this.bezierEditor=void 0;const t=e?this.treeElement.renderedPropertyText():this.originalPropertyText||"";this.treeElement.applyStyleText(t,!0),this.treeElement.parentPane().setEditingStyle(!1),delete this.originalPropertyText}}class ee{treeElement;swatchPopoverHelper;swatch;contrastInfo;boundSpectrumChanged;boundOnScroll;spectrum;scrollerElement;originalPropertyText;constructor(e,t,n){this.treeElement=e,this.swatchPopoverHelper=t,this.swatch=n,this.swatch.addEventListener(u.ColorSwatch.ClickEvent.eventName,this.iconClick.bind(this)),this.contrastInfo=null,this.boundSpectrumChanged=this.spectrumChanged.bind(this),this.boundOnScroll=this.onScroll.bind(this)}generateCSSVariablesPalette(){const t=this.treeElement.matchedStyles(),n=this.treeElement.property.ownerStyle,i=t.availableCSSVariables(n),s=[],o=[];for(const r of i){if(r===this.treeElement.property.name)continue;const i=t.computeCSSVariable(n,r);if(!i)continue;e.Color.Color.parse(i)&&(s.push(i),o.push(r))}return{title:"CSS Variables",mutable:!1,matchUserFormat:!0,colors:s,colorNames:o}}setContrastInfo(e){this.contrastInfo=e}iconClick(e){e.consume(!0),this.showPopover()}showPopover(){if(this.swatchPopoverHelper.isShowing())return void this.swatchPopoverHelper.hide(!0);const t=this.swatch.getColor();let n=this.swatch.getFormat();if(!t||!n)return;n===e.Color.Format.Original&&(n=t.format()),this.spectrum=new y.Spectrum.Spectrum(this.contrastInfo),this.spectrum.setColor(t,n),this.spectrum.addPalette(this.generateCSSVariablesPalette()),this.spectrum.addEventListener(y.Spectrum.Events.SizeChanged,this.spectrumResized,this),this.spectrum.addEventListener(y.Spectrum.Events.ColorChanged,this.boundSpectrumChanged),this.swatchPopoverHelper.show(this.spectrum,this.swatch,this.onPopoverHidden.bind(this)),this.scrollerElement=this.swatch.enclosingNodeOrSelfWithClass("style-panes-wrapper"),this.scrollerElement&&this.scrollerElement.addEventListener("scroll",this.boundOnScroll,!1),this.originalPropertyText=this.treeElement.property.propertyText,this.treeElement.parentPane().setEditingStyle(!0);const i=m.CSSWorkspaceBinding.CSSWorkspaceBinding.instance().propertyUILocation(this.treeElement.property,!1);i&&e.Revealer.reveal(i,!0)}spectrumResized(){this.swatchPopoverHelper.reposition()}spectrumChanged(t){const n=e.Color.Color.parse(t.data);if(!n)return;const i=this.spectrum?this.spectrum.colorName():void 0,s=i&&i.startsWith("--")?`var(${i})`:n.asString();this.swatch.renderColor(n);const o=this.swatch.firstElementChild;o&&(o.remove(),this.swatch.createChild("span").textContent=s),this.treeElement.applyStyleText(this.treeElement.renderedPropertyText(),!1)}onScroll(e){this.swatchPopoverHelper.hide(!0)}onPopoverHidden(e){this.scrollerElement&&this.scrollerElement.removeEventListener("scroll",this.boundOnScroll,!1),this.spectrum&&this.spectrum.removeEventListener(y.Spectrum.Events.ColorChanged,this.boundSpectrumChanged),this.spectrum=void 0;const t=e?this.treeElement.renderedPropertyText():this.originalPropertyText||"";this.treeElement.applyStyleText(t,!0),this.treeElement.parentPane().setEditingStyle(!1),delete this.originalPropertyText}}class te{treeElement;swatchPopoverHelper;shadowSwatch;iconElement;boundShadowChanged;boundOnScroll;cssShadowEditor;scrollerElement;originalPropertyText;constructor(e,t,n){this.treeElement=e,this.swatchPopoverHelper=t,this.shadowSwatch=n,this.iconElement=n.iconElement(),i.Tooltip.Tooltip.install(this.iconElement,Y(X.openShadowEditor)),this.iconElement.addEventListener("click",this.iconClick.bind(this),!1),this.iconElement.addEventListener("mousedown",(e=>e.consume()),!1),this.boundShadowChanged=this.shadowChanged.bind(this),this.boundOnScroll=this.onScroll.bind(this)}iconClick(e){e.consume(!0),this.showPopover()}showPopover(){if(this.swatchPopoverHelper.isShowing())return void this.swatchPopoverHelper.hide(!0);this.cssShadowEditor=new u.CSSShadowEditor.CSSShadowEditor,this.cssShadowEditor.setModel(this.shadowSwatch.model()),this.cssShadowEditor.addEventListener(u.CSSShadowEditor.Events.ShadowChanged,this.boundShadowChanged),this.swatchPopoverHelper.show(this.cssShadowEditor,this.iconElement,this.onPopoverHidden.bind(this)),this.scrollerElement=this.iconElement.enclosingNodeOrSelfWithClass("style-panes-wrapper"),this.scrollerElement&&this.scrollerElement.addEventListener("scroll",this.boundOnScroll,!1),this.originalPropertyText=this.treeElement.property.propertyText,this.treeElement.parentPane().setEditingStyle(!0);const t=m.CSSWorkspaceBinding.CSSWorkspaceBinding.instance().propertyUILocation(this.treeElement.property,!1);t&&e.Revealer.reveal(t,!0)}shadowChanged(e){this.shadowSwatch.setCSSShadow(e.data),this.treeElement.applyStyleText(this.treeElement.renderedPropertyText(),!1)}onScroll(e){this.swatchPopoverHelper.hide(!0)}onPopoverHidden(e){this.scrollerElement&&this.scrollerElement.removeEventListener("scroll",this.boundOnScroll,!1),this.cssShadowEditor&&this.cssShadowEditor.removeEventListener(u.CSSShadowEditor.Events.ShadowChanged,this.boundShadowChanged),this.cssShadowEditor=void 0;const t=e?this.treeElement.renderedPropertyText():this.originalPropertyText||"";this.treeElement.applyStyleText(t,!0),this.treeElement.parentPane().setEditingStyle(!1),delete this.originalPropertyText}}class ne{treeElementMap;swatchPopoverHelper;section;parentPane;fontEditor;scrollerElement;boundFontChanged;boundOnScroll;boundResized;constructor(e,t){this.treeElementMap=new Map,this.swatchPopoverHelper=e,this.section=t,this.parentPane=null,this.fontEditor=null,this.scrollerElement=null,this.boundFontChanged=this.fontChanged.bind(this),this.boundOnScroll=this.onScroll.bind(this),this.boundResized=this.fontEditorResized.bind(this)}fontChanged(e){const{propertyName:t,value:n}=e.data,i=this.treeElementMap.get(t);this.updateFontProperty(t,n,i)}async updateFontProperty(e,t,n){if(n&&n.treeOutline&&n.valueElement&&n.property.parsedOk&&n.property.range){let e,i=!1;n.valueElement.textContent=t,n.property.value=t;const s=n.property.name;t.length?e=n.renderedPropertyText():(e="",i=!0,this.fixIndex(n.property.index)),this.treeElementMap.set(s,n),await n.applyStyleText(e,!0),i&&this.treeElementMap.delete(s)}else if(t.length){const n=this.section.addNewBlankProperty();n&&(n.property.name=e,n.property.value=t,n.updateTitle(),await n.applyStyleText(n.renderedPropertyText(),!0),this.treeElementMap.set(n.property.name,n))}this.section.onpopulate(),this.swatchPopoverHelper.reposition()}fontEditorResized(){this.swatchPopoverHelper.reposition()}fixIndex(e){for(const t of this.treeElementMap.values())t.property.index>e&&(t.property.index-=1)}createPropertyValueMap(){const e=new Map;for(const t of this.treeElementMap){const n=t[0],i=t[1];i.property.value.length?e.set(n,i.property.value):this.treeElementMap.delete(n)}return e}registerFontProperty(e){const t=e.property.name;if(this.treeElementMap.has(t)){const n=this.treeElementMap.get(t);(!e.overloaded()||n&&n.overloaded())&&this.treeElementMap.set(t,e)}else this.treeElementMap.set(t,e)}async showPopover(e,t){if(this.swatchPopoverHelper.isShowing())return void this.swatchPopoverHelper.hide(!0);this.parentPane=t;const n=this.createPropertyValueMap();this.fontEditor=new u.FontEditor.FontEditor(n),this.fontEditor.addEventListener(u.FontEditor.Events.FontChanged,this.boundFontChanged),this.fontEditor.addEventListener(u.FontEditor.Events.FontEditorResized,this.boundResized),this.swatchPopoverHelper.show(this.fontEditor,e,this.onPopoverHidden.bind(this)),this.scrollerElement=e.enclosingNodeOrSelfWithClass("style-panes-wrapper"),this.scrollerElement&&this.scrollerElement.addEventListener("scroll",this.boundOnScroll,!1),this.parentPane.setEditingStyle(!0)}onScroll(){this.swatchPopoverHelper.hide(!0)}onPopoverHidden(){this.scrollerElement&&this.scrollerElement.removeEventListener("scroll",this.boundOnScroll,!1),this.section.onpopulate(),this.fontEditor&&this.fontEditor.removeEventListener(u.FontEditor.Events.FontChanged,this.boundFontChanged),this.fontEditor=null,this.parentPane&&this.parentPane.setEditingStyle(!1),this.section.resetToolbars(),this.section.onpopulate()}static treeElementSymbol=Symbol("FontEditorSectionManager._treeElementSymbol")}var ie=Object.freeze({__proto__:null,BezierPopoverIcon:Z,ColorSwatchPopoverIcon:ee,ShadowSwatchPopoverHelper:te,FontEditorSectionManager:ne});const se=new CSSStyleSheet;se.replaceSync(":host{display:inline}.node-link{cursor:pointer;display:inline;pointer-events:auto}.node-link:focus-visible{outline-width:unset}.node-label-name{color:var(--color-syntax-1)}.node-label-class,.node-label-pseudo{color:var(--color-syntax-4)}\n/*# sourceURL=domLinkifier.css */\n");const oe={node:""},re=o.i18n.registerUIStrings("panels/elements/DOMLinkifier.ts",oe),le=o.i18n.getLocalizedString.bind(void 0,re),ae=function(e,t,n){const s=e,o=e.nodeType()===Node.ELEMENT_NODE&&e.pseudoType();o&&e.parentNode&&(e=e.parentNode);let r=e.nodeNameInCorrectCase();const l=t.createChild("span","node-label-name");l.textContent=r;const a=e.getAttribute("id");if(a){const e=t.createChild("span","node-label-id"),n="#"+a;r+=n,i.UIUtils.createTextChild(e,n),l.classList.add("extra")}const d=e.getAttribute("class");if(d){const e=d.split(/\s+/);if(e.length){const n=new Set,s=t.createChild("span","extra node-label-class");for(let t=0;t(e.Revealer.reveal(t,!1),!1)),!1),r.addEventListener("mouseover",t.highlight.bind(t,void 0),!1),r.addEventListener("mouseleave",(()=>n.OverlayModel.OverlayModel.hideDOMNodeHighlight()),!1),s.preventKeyboardFocus||(r.addEventListener("keydown",(n=>"Enter"===n.key&&e.Revealer.reveal(t,!1)&&!1)),r.tabIndex=0,i.ARIAUtils.markAsLink(r)),o},he=function(t,n={tooltip:void 0,preventKeyboardFocus:void 0}){const s=document.createElement("div"),o=i.Utils.createShadowRootWithCoreStyles(s,{cssFile:[se],delegatesFocus:void 0}).createChild("div","node-link");function r(t){e.Revealer.reveal(t)}return o.createChild("slot"),o.addEventListener("click",t.resolve.bind(t,r),!1),o.addEventListener("mousedown",(e=>e.consume()),!1),n.preventKeyboardFocus||(o.addEventListener("keydown",(e=>"Enter"===e.key&&t.resolve(r))),o.tabIndex=0,i.ARIAUtils.markAsLink(o)),s};let ce;class pe{static instance(e={forceNew:null}){const{forceNew:t}=e;return ce&&!t||(ce=new pe),ce}linkify(e,t){if(e instanceof n.DOMModel.DOMNode)return de(e,t);if(e instanceof n.DOMModel.DeferredDOMNode)return he(e,t);throw new Error("Can't linkify non-node")}}var ue=Object.freeze({__proto__:null,decorateNodeLabel:ae,linkifyNodeReference:de,linkifyDeferredNodeReference:he,Linkifier:pe});class me extends i.Widget.VBox{computedStyleModelInternal;updateThrottler;updateWhenVisible;constructor(t){super(!0,t),this.element.classList.add("flex-none"),this.computedStyleModelInternal=new A,this.computedStyleModelInternal.addEventListener("ComputedStyleChanged",this.onCSSModelChanged,this),this.updateThrottler=new e.Throttler.Throttler(100),this.updateWhenVisible=!1}node(){return this.computedStyleModelInternal.node()}cssModel(){return this.computedStyleModelInternal.cssModel()}computedStyleModel(){return this.computedStyleModelInternal}async doUpdate(){}update(){this.updateWhenVisible=!this.isShowing(),this.updateWhenVisible||this.updateThrottler.schedule(function(){return this.isShowing()?this.doUpdate():Promise.resolve()}.bind(this))}wasShown(){super.wasShown(),this.updateWhenVisible&&this.update()}onCSSModelChanged(e){}}var ge=Object.freeze({__proto__:null,ElementsSidebarPane:me});function ye(e){const{name:t,value:n}=e;return`${t.startsWith("--")?`'${t}'`:t.replace(/-([a-z])/gi,((e,t)=>t.toUpperCase()))}: ${`'${n.replaceAll("'","\\'")}'`}`}var fe=Object.freeze({__proto__:null,getCssDeclarationAsJavascriptProperty:ye});const Se=h.StylePropertyEditor.FlexboxEditor,be=h.StylePropertyEditor.GridEditor,ve={shiftClickToChangeColorFormat:"Shift + Click to change color format.",openColorPickerS:"Open color picker. {PH1}",valueForSettingSSIsOutsideThe:"Value for setting “{PH1}” {PH2} is outside the supported range [{PH3}, {PH4}] for font-family “{PH5}”.",togglePropertyAndContinueEditing:"Toggle property and continue editing",revealInSourcesPanel:"Reveal in Sources panel",copyDeclaration:"Copy declaration",copyProperty:"Copy property",copyValue:"Copy value",copyRule:"Copy rule",copyAllDeclarations:"Copy all declarations",viewComputedValue:"View computed value",flexboxEditorButton:"Open `flexbox` editor",gridEditorButton:"Open `grid` editor",copyCssDeclarationAsJs:"Copy declaration as JS",copyAllCssDeclarationsAsJs:"Copy all declarations as JS"},Ee=o.i18n.registerUIStrings("panels/elements/StylePropertyTreeElement.ts",ve),Ce=o.i18n.getLocalizedString.bind(void 0,Ee),we=new WeakMap;class xe extends i.TreeOutline.TreeElement{style;matchedStylesInternal;property;inheritedInternal;overloadedInternal;parentPaneInternal;isShorthand;applyStyleThrottler;newProperty;expandedDueToFilter;valueElement;nameElement;expandElement;originalPropertyText;hasBeenEditedIncrementally;prompt;lastComputedValue;contextForTest;constructor(t,n,i,s,o,r,l){super("",s),this.style=i.ownerStyle,this.matchedStylesInternal=n,this.property=i,this.inheritedInternal=o,this.overloadedInternal=r,this.selectable=!1,this.parentPaneInternal=t,this.isShorthand=s,this.applyStyleThrottler=new e.Throttler.Throttler(0),this.newProperty=l,this.newProperty&&(this.listItemElement.textContent=""),this.expandedDueToFilter=!1,this.valueElement=null,this.nameElement=null,this.expandElement=null,this.originalPropertyText="",this.hasBeenEditedIncrementally=!1,this.prompt=null,this.lastComputedValue=null}matchedStyles(){return this.matchedStylesInternal}editable(){return Boolean(this.style.styleSheetId&&this.style.range)}inherited(){return this.inheritedInternal}overloaded(){return this.overloadedInternal}setOverloaded(e){e!==this.overloadedInternal&&(this.overloadedInternal=e,this.updateState())}get name(){return this.property.name}get value(){return this.property.value}updateFilter(){const e=this.parentPaneInternal.filterRegex(),t=null!==e&&(e.test(this.property.name)||e.test(this.property.value));this.listItemElement.classList.toggle("filter-match",t),this.onpopulate();let n=!1;for(let e=0;e{const{data:t}=e;o.firstElementChild&&o.firstElementChild.remove(),o.createChild("span").textContent=t.text})),this.editable()&&this.addColorContrastInfo(o),o}processVar(t){const n=this.matchedStylesInternal.computeSingleVariableValue(this.style,t);if(!n)return document.createTextNode(t);const{computedValue:s,fromFallback:o}=n,r=new u.CSSVarSwatch.CSSVarSwatch;return i.UIUtils.createTextChild(r,t),r.data={text:t,computedValue:s,fromFallback:o,onLinkActivate:this.handleVarDefinitionActivate.bind(this)},s&&e.Color.Color.parse(s)?this.processColor(s,r):r}handleVarDefinitionActivate(e){s.userMetrics.actionTaken(s.UserMetrics.Action.CustomPropertyLinkClicked),this.parentPaneInternal.jumpToProperty(e)}async addColorContrastInfo(e){const t=this.parentPaneInternal.swatchPopoverHelper(),n=new ee(this,t,e);if("color"!==this.property.name||!this.parentPaneInternal.cssModel()||!this.node())return;const i=this.parentPaneInternal.cssModel(),s=this.node();if(i&&s&&void 0!==s.id){const e=new y.ContrastInfo.ContrastInfo(await i.backgroundColorsPromise(s.id));n.setContrastInfo(e)}}renderedPropertyText(){return this.nameElement&&this.valueElement?this.nameElement.textContent+": "+this.valueElement.textContent:""}processBezier(e){if(!this.editable()||!i.Geometry.CubicBezier.parse(e))return document.createTextNode(e);const t=this.parentPaneInternal.swatchPopoverHelper(),n=u.Swatches.BezierSwatch.create();return n.setBezierText(e),new Z(this,t,n),n}processFont(e){const t=this.section();return t&&t.registerFontProperty(this),document.createTextNode(e)}processShadow(e,t){if(!this.editable())return document.createTextNode(e);let n;if(n="text-shadow"===t?u.CSSShadowModel.CSSShadowModel.parseTextShadow(e):u.CSSShadowModel.CSSShadowModel.parseBoxShadow(e),!n.length)return document.createTextNode(e);const i=document.createDocumentFragment(),s=this.parentPaneInternal.swatchPopoverHelper();for(let e=0;e${r.repeat(2)}${t}`;l.appendChild(n)}return l}processAngle(e){if(!this.editable())return document.createTextNode(e);const t=new u.CSSAngle.CSSAngle,n=document.createElement("span");n.textContent=e;const i=this.matchedStylesInternal.computeValue(this.property.ownerStyle,this.property.value)||"";t.data={propertyName:this.property.name,propertyValue:i,angleText:e,containingPane:this.parentPaneInternal.element.enclosingNodeOrSelfWithClass("style-panes-wrapper")},t.append(n);return t.addEventListener("popovertoggled",(e=>{const n=this.section();if(!n)return;const{data:i}=e;i.open&&(this.parentPaneInternal.hideAllPopovers(),this.parentPaneInternal.activeCSSAngle=t),n.element.classList.toggle("has-open-popover",i.open),this.parentPaneInternal.setEditingStyle(i.open)})),t.addEventListener("valuechanged",(async e=>{const{data:i}=e;n.textContent=i.value,await this.applyStyleText(this.renderedPropertyText(),!1);const s=this.matchedStylesInternal.computeValue(this.property.ownerStyle,this.property.value)||"";t.updateProperty(this.property.name,s)})),t.addEventListener("unitchanged",(async e=>{const{data:t}=e;n.textContent=t.value})),t}processLength(e){if(!this.editable())return document.createTextNode(e);const t=new u.CSSLength.CSSLength,n=document.createElement("span");n.textContent=e,t.data={lengthText:e},t.append(n);return t.addEventListener("valuechanged",(e=>{const{data:t}=e;n.textContent=t.value,this.parentPaneInternal.setEditingStyle(!0),this.applyStyleText(this.renderedPropertyText(),!1)})),t.addEventListener("draggingfinished",(()=>{this.parentPaneInternal.setEditingStyle(!1)})),t}updateState(){if(!this.listItemElement)return;this.style.isPropertyImplicit(this.name)?this.listItemElement.classList.add("implicit"):this.listItemElement.classList.remove("implicit");!this.property.parsedOk&&We.ignoreErrorsForProperty(this.property)?this.listItemElement.classList.add("has-ignorable-error"):this.listItemElement.classList.remove("has-ignorable-error"),this.inherited()?this.listItemElement.classList.add("inherited"):this.listItemElement.classList.remove("inherited"),this.overloaded()?this.listItemElement.classList.add("overloaded"):this.listItemElement.classList.remove("overloaded"),this.property.disabled?this.listItemElement.classList.add("disabled"):this.listItemElement.classList.remove("disabled")}node(){return this.parentPaneInternal.node()}parentPane(){return this.parentPaneInternal}section(){return this.treeOutline?this.treeOutline.section:null}updatePane(){const e=this.section();e&&e.refreshUpdate(this)}async toggleDisabled(e){if(!this.style.range)return;this.parentPaneInternal.setUserOperation(!0);const t=await this.property.setDisabled(e);this.parentPaneInternal.setUserOperation(!1),t&&(this.matchedStylesInternal.resetActiveProperties(),this.updatePane(),this.styleTextAppliedForTest())}async onpopulate(){if(this.childCount()||!this.isShorthand)return;const e=this.style.longhandProperties(this.name),t=this.style.leadingProperties();for(let i=0;ie.name===s&&e.activeInStyle()))&&(r=!0);const a=new xe(this.parentPaneInternal,this.matchedStylesInternal,e[i],!1,o,r,!1);this.appendChild(a)}}onattach(){this.updateTitle(),this.listItemElement.addEventListener("mousedown",(e=>{0===e.button&&we.set(this.parentPaneInternal,this)}),!1),this.listItemElement.addEventListener("mouseup",this.mouseUp.bind(this)),this.listItemElement.addEventListener("click",(e=>{if(!e.target)return;e.target.hasSelection()||e.target===this.listItemElement||e.consume(!0)})),this.listItemElement.addEventListener("contextmenu",this.handleCopyContextMenuEvent.bind(this))}onexpand(){this.updateExpandElement()}oncollapse(){this.updateExpandElement()}updateExpandElement(){this.expandElement&&(this.expanded?this.expandElement.setIconType("smallicon-triangle-down"):this.expandElement.setIconType("smallicon-triangle-right"))}updateTitleIfComputedValueChanged(){const e=this.matchedStylesInternal.computeValue(this.property.ownerStyle,this.property.value);e!==this.lastComputedValue&&(this.lastComputedValue=e,this.innerUpdateTitle())}updateTitle(){this.lastComputedValue=this.matchedStylesInternal.computeValue(this.property.ownerStyle,this.property.value),this.innerUpdateTitle()}innerUpdateTitle(){this.updateState(),this.isExpandable()?this.expandElement=i.Icon.Icon.create("smallicon-triangle-right","expand-icon"):this.expandElement=null;const t=new Je(this.style.parentRule,this.node(),this.name,this.value);if(this.property.parsedOk&&(t.setVarHandler(this.processVar.bind(this)),t.setColorHandler(this.processColor.bind(this)),t.setBezierHandler(this.processBezier.bind(this)),t.setFontHandler(this.processFont.bind(this)),t.setShadowHandler(this.processShadow.bind(this)),t.setGridHandler(this.processGrid.bind(this)),t.setAngleHandler(this.processAngle.bind(this)),t.setLengthHandler(this.processLength.bind(this))),this.listItemElement.removeChildren(),this.nameElement=t.renderName(),this.property.name.startsWith("--")&&this.nameElement&&i.Tooltip.Tooltip.install(this.nameElement,this.matchedStylesInternal.computeCSSVariable(this.style,this.property.name)||""),this.valueElement=t.renderValue(),!this.treeOutline)return;const n=e.Settings.Settings.instance().moduleSetting("textEditorIndent").get();if(i.UIUtils.createTextChild(this.listItemElement.createChild("span","styles-clipboard-only"),n+(this.property.disabled?"/* ":"")),this.nameElement&&this.listItemElement.appendChild(this.nameElement),this.valueElement){const e=this.valueElement.firstElementChild&&"BR"===this.valueElement.firstElementChild.tagName?":":": ";this.listItemElement.createChild("span","styles-name-value-separator").textContent=e,this.expandElement&&this.listItemElement.appendChild(this.expandElement),this.listItemElement.appendChild(this.valueElement),i.UIUtils.createTextChild(this.listItemElement,";"),this.property.disabled&&i.UIUtils.createTextChild(this.listItemElement.createChild("span","styles-clipboard-only")," */")}const s=this.section();if(this.valueElement&&s&&s.editable&&"display"===this.property.name){const e=this.property.trimmedValueWithoutImportant(),t="flex"===e||"inline-flex"===e,n="grid"===e||"inline-grid"===e;if(t||n){const e=`${s.getSectionIdx()}_${s.nextEditorTriggerButtonIdx}`,n=Ie.createTriggerButton(this.parentPaneInternal,s,t?Se:be,Ce(t?ve.flexboxEditorButton:ve.gridEditorButton),e);s.nextEditorTriggerButtonIdx++,this.listItemElement.appendChild(n);const i=this.parentPaneInternal.swatchPopoverHelper();i.isShowing(Ie.instance())&&Ie.instance().getTriggerKey()===e&&i.setAnchorElement(n)}}if(this.property.parsedOk?this.updateFontVariationSettingsWarning():(this.listItemElement.classList.add("not-parsed-ok"),this.listItemElement.insertBefore(We.createExclamationMark(this.property,null),this.listItemElement.firstChild)),this.property.activeInStyle()||this.listItemElement.classList.add("inactive"),this.updateFilter(),this.property.parsedOk&&this.section()&&this.parent&&this.parent.root){const e=document.createElement("input");e.className="enabled-button",e.type="checkbox",e.checked=!this.property.disabled,e.addEventListener("mousedown",(e=>e.consume()),!1),e.addEventListener("click",(e=>{this.toggleDisabled(!this.property.disabled),e.consume()}),!1),this.nameElement&&this.valueElement&&i.ARIAUtils.setAccessibleName(e,`${this.nameElement.textContent} ${this.valueElement.textContent}`),this.listItemElement.insertBefore(e,this.listItemElement.firstChild)}}async updateFontVariationSettingsWarning(){if("font-variation-settings"!==this.property.name)return;const e=this.property.value,t=this.parentPaneInternal.cssModel();if(!t)return;const i=this.parentPaneInternal.computedStyleModel(),s=await i.fetchComputedStyle();if(!s)return;const o=s.computedStyle.get("font-family");if(!o)return;const r=new Set(n.CSSPropertyParser.parseFontFamily(o)),l=t.fontFaces().filter((e=>r.has(e.getFontFamily()))),a=n.CSSPropertyParser.parseFontVariationSettings(e),d=[];for(const e of a)for(const t of l){const n=t.getVariationAxisByTag(e.tag);n&&((e.valuen.maxValue)&&d.push(Ce(ve.valueForSettingSSIsOutsideThe,{PH1:e.tag,PH2:e.value,PH3:n.minValue,PH4:n.maxValue,PH5:t.getFontFamily()})))}d.length&&(this.listItemElement.classList.add("has-warning"),this.listItemElement.insertBefore(We.createExclamationMark(this.property,d.join(" ")),this.listItemElement.firstChild))}mouseUp(e){const t=we.get(this.parentPaneInternal);if(we.delete(this.parentPaneInternal),!t)return;if(this.listItemElement.hasSelection())return;if(i.UIUtils.isBeingEdited(e.target))return;if(e.consume(!0),e.target===this.listItemElement)return;const n=this.section();i.KeyboardShortcut.KeyboardShortcut.eventHasCtrlEquivalentKey(e)&&n&&n.navigable?this.navigateToSource(e.target):this.startEditing(e.target)}handleContextMenuEvent(e,t){const n=new i.ContextMenu.ContextMenu(t);if(this.property.parsedOk&&this.section()&&this.parent&&this.parent.root){const i=this.parentPaneInternal.focusedSectionIndex();n.defaultSection().appendCheckboxItem(Ce(ve.togglePropertyAndContinueEditing),(async()=>{if(this.treeOutline){const n=this.treeOutline.rootElement().indexOfChild(this);this.editingCancelled(null,e),await this.toggleDisabled(!this.property.disabled),t.consume(),this.parentPaneInternal.continueEditingElement(i,n)}}),!this.property.disabled)}const s=this.navigateToSource.bind(this);n.defaultSection().appendItem(Ce(ve.revealInSourcesPanel),s),n.show()}handleCopyContextMenuEvent(e){if(!e.target)return;const t=new i.ContextMenu.ContextMenu(e);t.clipboardSection().appendItem(Ce(ve.copyDeclaration),(()=>{const e=`${this.property.name}: ${this.property.value};`;s.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(e)})),t.clipboardSection().appendItem(Ce(ve.copyProperty),(()=>{s.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(this.property.name)})),t.clipboardSection().appendItem(Ce(ve.copyValue),(()=>{s.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(this.property.value)})),t.defaultSection().appendItem(Ce(ve.copyRule),(()=>{const e=this.section(),t=We.formatLeadingProperties(e).ruleText;s.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(t)})),t.defaultSection().appendItem(Ce(ve.copyAllDeclarations),(()=>{const e=this.section(),t=We.formatLeadingProperties(e).allDeclarationText;s.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(t)})),t.defaultSection().appendItem(Ce(ve.viewComputedValue),(()=>{this.viewComputedValue()})),t.clipboardSection().appendItem(Ce(ve.copyCssDeclarationAsJs),this.copyCssDeclarationAsJs.bind(this)),t.defaultSection().appendItem(Ce(ve.copyAllCssDeclarationsAsJs),this.copyAllCssDeclarationAsJs.bind(this)),t.show()}async viewComputedValue(){const e=an.instance().getComputedStyleWidget();e.isShowing()||await i.ViewManager.ViewManager.instance().showView("Computed");let t="";t=this.isShorthand?"^"+this.property.name+"-":"^"+this.property.name+"$";const n=new RegExp(t,"i");e.filterComputedStyles(n);const s=e.input;s.value=this.property.name,s.focus()}copyCssDeclarationAsJs(){const e=ye(this.property);s.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(e)}copyAllCssDeclarationAsJs(){const e=this.section().style().leadingProperties().filter((e=>!e.disabled)).map(ye);s.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(e.join(",\n"))}navigateToSource(t,n){const i=this.section();if(!i||!i.navigable)return;const s=t===this.nameElement,o=m.CSSWorkspaceBinding.CSSWorkspaceBinding.instance().propertyUILocation(this.property,s);o&&e.Revealer.reveal(o,n)}startEditing(e){if(this.parent instanceof xe&&this.parent.isShorthand)return;if(this.expandElement&&e===this.expandElement)return;const t=this.section();if(t&&!t.editable)return;if(e&&(e=e.enclosingNodeOrSelfWithClass("webkit-css-property")||e.enclosingNodeOrSelfWithClass("value")),e||(e=this.nameElement),i.UIUtils.isBeingEdited(e))return;const s=e===this.nameElement;var o;!s&&this.valueElement&&(n.CSSMetadata.cssMetadata().isGridAreaDefiningProperty(this.name)&&(this.valueElement.textContent=(o=this.value,g.TextUtils.Utils.splitStringByRegexes(o,[n.CSSMetadata.GridAreaRowRegex]).map((e=>e.value.trim())).join("\n"))),this.valueElement.textContent=function(e,t){const i=e.split(n.CSSMetadata.URLRegex);if(1===i.length)return e;const s=new RegExp(n.CSSMetadata.URLRegex);for(let e=1;e{this.applyFreeFlowStyleTextEdit(l)}));const a=this.property.getInvalidStringForInvalidProperty();if(a&&e&&i.ARIAUtils.alert(a),e){const t=this.prompt.attachAndStartEditing(e,function(e,t){let n=t.target.textContent;e.isEditingName||(n=this.value||n),this.editingCommitted(n||"",e,"")}.bind(this,l));this.navigateToSource(e,!0),t.addEventListener("keydown",this.editingNameValueKeyDown.bind(this,l),!1),t.addEventListener("keypress",this.editingNameValueKeyPress.bind(this,l),!1),s&&(t.addEventListener("paste",function(e,t){const n=t.clipboardData;if(!n)return;const i=n.getData("Text");if(!i)return;const s=i.indexOf(":");if(s<0)return;const o=i.substring(0,s).trim(),r=i.substring(s+1).trim();t.preventDefault(),void 0===e.originalName&&(this.nameElement&&(e.originalName=this.nameElement.textContent||""),this.valueElement&&(e.originalValue=this.valueElement.textContent||"")),this.property.name=o,this.property.value=r,this.nameElement&&(this.nameElement.textContent=o,this.nameElement.normalize()),this.valueElement&&(this.valueElement.textContent=r,this.valueElement.normalize());const l=t.target;this.editingCommitted(l.textContent||"",e,"forward")}.bind(this,l),!1),t.addEventListener("contextmenu",this.handleContextMenuEvent.bind(this,l),!1));const n=e.getComponentSelection();n&&n.selectAllChildren(e)}}editingNameValueKeyDown(e,t){if(t.handled)return;const n=t,s=n.target;let o;if("Enter"!==n.key||n.shiftKey)if(n.keyCode===i.KeyboardShortcut.Keys.Esc.code||n.key===p.KeyboardUtilities.ESCAPE_KEY)o="cancel";else if(!e.isEditingName&&this.newProperty&&n.keyCode===i.KeyboardShortcut.Keys.Backspace.code){const e=s.getComponentSelection();e&&e.isCollapsed&&!e.focusOffset&&(t.preventDefault(),o="backward")}else"Tab"===n.key&&(o=n.shiftKey?"backward":"forward",t.preventDefault());else o="forward";if(o){switch(o){case"cancel":this.editingCancelled(null,e);break;case"forward":case"backward":this.editingCommitted(s.textContent||"",e,o)}t.consume()}else;}editingNameValueKeyPress(e,t){const n=t,i=n.target,s=String.fromCharCode(n.charCode),o=i.selectionLeftOffset();if(e.isEditingName?":"===s:";"===s&&null!==o&&function(e,t){let n="";for(let i=0;i=t.childCount()&&!this.newProperty)r=!0;else{const s=g>=0?t.childAt(g):null;if(s){let t=!i||h?s.nameElement:s.valueElement;return e&&y&&(t="forward"===n?s.nameElement:s.valueElement),void s.startEditing(t)}e||(l=!0)}}if(r){if(e&&!t&&i!==("backward"===n))return;s.addNewBlankProperty().startEditing()}else if(m){c=this.findSibling(n);const e=c||"backward"===n?s:s.nextEditableSibling();e&&(e.style().parentRule?e.startEditingSelector():e.moveEditorFromSelector(n))}else l&&(s.style().parentRule?s.startEditingSelector():s.moveEditorFromSelector(n))}else this.parentPaneInternal.resetFocus()}}removePrompt(){this.prompt&&(this.prompt.detach(),this.prompt=null)}styleTextAppliedForTest(){}applyStyleText(e,t,n){return this.applyStyleThrottler.schedule(this.innerApplyStyleText.bind(this,e,t,n))}async innerApplyStyleText(e,t,n){if(!this.treeOutline||!this.property)return;if(!this.style.range)return;const i=this.hasBeenEditedIncrementally;if(!(e=e.replace(/[\xA0\t]/g," ").trim()).length&&t&&this.newProperty&&!i)return void(this.parent&&this.parent.removeChild(this));const s=this.parentPaneInternal.node();this.parentPaneInternal.setUserOperation(!0),(e+=p.StringUtilities.findUnclosedCssQuote(e)).length&&!/;\s*$/.test(e)&&(e+=";");const o=!this.newProperty||i;let r=await this.property.setText(e,t,o);i&&t&&!r&&(t=!1,r=await this.property.setText(this.originalPropertyText,t,o)),this.parentPaneInternal.setUserOperation(!1);const l=n||this.style.propertyAt(this.property.index),a=this.property.index{e.stopPropagation()};const n=new l.Icon.Icon;return n.data={iconName:"flex-wrap-icon",color:"var(--color-text-secondary)",width:"12px",height:"12px"},t.appendChild(n),t}(i);return o.onclick=async i=>{i.stopPropagation();const r=e.swatchPopoverHelper(),l=Ie.instance();l.setEditor(n),l.bindContext(e,t),l.setTriggerKey(s),await l.render();const a=o.enclosingNodeOrSelfWithClass("style-panes-wrapper"),d=()=>{r.hide(!0)};r.show(l,o,(()=>{l.unbindContext(),a&&a.removeEventListener("scroll",d)})),a&&a.addEventListener("scroll",d)},o}}function Ne(e,t){const n=e.propertiesTreeOutline.rootElement().children().find((e=>e instanceof xe&&e.property.name===t));if(n)return n;const i=e.addNewBlankProperty();return i.property.name=t,i}async function Pe(e){const t=e.computedStyleModel(),n=await t.fetchComputedStyle();return n?n.computedStyle:new Map}function Oe(e,t){const n=new Map,i=new Set(t.map((e=>e.propertyName)));for(const t of e.style().leadingProperties())i.has(t.name)&&n.set(t.name,t.value);return n}var ke=Object.freeze({__proto__:null,StyleEditorWidget:Ie});class Le{styleSidebarPane;constructor(e){this.styleSidebarPane=e}highlightProperty(e){for(const e of this.styleSidebarPane.allSections())for(let t=e.propertiesTreeOutline.firstChild();t;t=t.nextSibling)t.onpopulate();const{treeElement:t,section:n}=this.findTreeElementAndSection((t=>t.property===e));t&&(t.parent&&t.parent.expand(),this.scrollAndHighlightTreeElement(t),n&&n.element.focus())}findAndHighlightPropertyName(e){for(const t of this.styleSidebarPane.allSections()){if(!t.style().hasActiveProperty(e))continue;t.showAllItems();const n=this.findTreeElementFromSection((t=>t.property.name===e&&!t.overloaded()),t);if(n)return this.scrollAndHighlightTreeElement(n),void(t&&t.element.focus())}}findTreeElementAndSection(e){for(const t of this.styleSidebarPane.allSections()){const n=this.findTreeElementFromSection(e,t);if(n)return{treeElement:n,section:t}}return{treeElement:null,section:null}}findTreeElementFromSection(e,t){let n=t.propertiesTreeOutline.firstChild();for(;n&&n instanceof xe;){if(e(n))return n;n=n.traverseNextTreeElement(!1,null,!0)}return null}scrollAndHighlightTreeElement(e){e.listItemElement.scrollIntoViewIfNeeded(),e.listItemElement.animate([{offset:0,backgroundColor:"rgba(255, 255, 0, 0.2)"},{offset:.1,backgroundColor:"rgba(255, 255, 0, 0.7)"},{offset:1,backgroundColor:"transparent"}],{duration:2e3,easing:"cubic-bezier(0, 0, 0.2, 1)"})}}var De=Object.freeze({__proto__:null,StylePropertyHighlighter:Le});const Ae=new CSSStyleSheet;Ae.replaceSync(".tree-outline{padding:0}.tree-outline li.has-warning,.tree-outline li.not-parsed-ok{margin-left:0}.tree-outline li.filter-match{background-color:var(--color-match-highlight)}.tree-outline li.has-warning .exclamation-mark,.tree-outline li.not-parsed-ok .exclamation-mark{display:inline-block;position:relative;width:11px;height:10px;margin:0 7px 0 0;top:1px;left:-36px;user-select:none;cursor:default;z-index:1}.tree-outline li{margin-left:12px;padding-left:22px;white-space:normal;text-overflow:ellipsis;cursor:auto;display:block}.tree-outline li::before{display:none}.has-ignorable-error .webkit-css-property{color:inherit}.tree-outline li .webkit-css-property{margin-left:-22px}.tree-outline>li{padding-left:38px;clear:both;min-height:14px}.tree-outline>li .webkit-css-property{margin-left:-38px}.tree-outline>li.child-editing{padding-left:8px}.tree-outline>li.child-editing .text-prompt{white-space:pre-wrap}.tree-outline>li.child-editing .webkit-css-property{margin-left:0}.tree-outline li.child-editing{word-wrap:break-word!important;white-space:normal!important;padding-left:0}ol:not(.tree-outline){display:none;margin:0;padding-inline-start:12px;list-style:none}ol.expanded{display:block}.tree-outline li .info{padding-top:4px;padding-bottom:3px}.enabled-button{visibility:hidden;float:left;font-size:10px;margin:0;vertical-align:top;position:relative;z-index:1;width:18px;left:-40px;top:1px;height:13px}.tree-outline li.editing .enabled-button{display:none!important}.disabled,.inactive,.not-parsed-ok:not(.has-ignorable-error),.overloaded:not(.has-ignorable-error){text-decoration:line-through}.implicit,.inherited{opacity:50%}.has-ignorable-error{color:var(--color-text-disabled)}.tree-outline li.editing{margin-left:10px;text-overflow:clip}.tree-outline li.editing-sub-part{padding:3px 6px 8px 18px;margin:-1px -6px -8px;text-overflow:clip}:host-context(.no-affect) .tree-outline li{opacity:50%}:host-context(.no-affect) .tree-outline li.editing{opacity:100%}:host-context(.styles-panel-hovered:not(.read-only)) .value:hover,:host-context(.styles-panel-hovered:not(.read-only)) .webkit-css-property:hover{text-decoration:underline;cursor:default}.styles-name-value-separator{display:inline-block;width:14px;text-decoration:inherit;white-space:pre}.styles-clipboard-only{display:inline-block;width:0;opacity:0%;pointer-events:none;white-space:pre}.styles-pane-button{width:15px;height:15px;padding:0;border:0;margin:0 0 0 6px;position:absolute;top:-1px;background-color:var(--color-background-elevation-2);border-radius:3px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.tree-outline li.child-editing .styles-clipboard-only{display:none}:host-context(.matched-styles) .tree-outline li{margin-left:0!important}.expand-icon{user-select:none;margin-left:-6px;margin-right:2px;margin-bottom:-2px}.tree-outline li:not(.parent) .expand-icon{display:none}:host-context(.matched-styles:not(.read-only):hover) .enabled-button{visibility:visible}:host-context(.matched-styles:not(.read-only)) .tree-outline li.disabled .enabled-button{visibility:visible}:host-context(.matched-styles) ol.expanded{margin-left:16px}.devtools-link-styled-trim{display:inline-block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;max-width:80%;vertical-align:bottom}devtools-css-angle,devtools-css-length{display:inline-block}\n/*# sourceURL=stylesSectionTree.css */\n");const Re=new CSSStyleSheet;Re.replaceSync(".styles-section{min-height:18px;white-space:nowrap;user-select:text;border-bottom:1px solid var(--color-details-hairline);position:relative;overflow:hidden}.styles-section>div{padding:2px 2px 4px 4px}.styles-section:last-child{border-bottom:none}.styles-section.read-only{background-color:var(--color-background-opacity-50);font-style:italic}.styles-section.has-open-popover{z-index:1}.styles-section:focus-visible{background-color:var(--color-background-elevation-2)}.styles-section.read-only:focus-visible{background-color:var(--color-background-elevation-2)}.styles-section .simple-selector.filter-match{background-color:var(--color-match-highlight);color:var(--color-text-primary)}.sidebar-pane-closing-brace{clear:both}.styles-section-title{background-origin:padding;background-clip:padding;word-wrap:break-word;white-space:normal}.styles-section-title .query-list{color:var(--color-text-disabled)}.styles-section-subtitle{color:var(--color-text-secondary);float:right;padding-left:15px;max-width:100%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;height:15px;margin-bottom:-1px}.sidebar-pane-closing-brace,.sidebar-pane-open-brace{color:var(--color-text-primary)}.styles-section .devtools-link{user-select:none}.styles-section .styles-section-subtitle .devtools-link{color:var(--color-text-primary);text-decoration-color:hsl(0deg 0% 60%)}.styles-section .selector{color:var(--color-text-disabled)}.styles-section .simple-selector.selector-matches,.styles-section.keyframe-key{color:var(--color-text-primary)}.styles-section .style-properties{margin:0;padding:2px 4px 0 0;list-style:none;clear:both;display:flex}.styles-section.matched-styles .style-properties{padding-left:0}@keyframes styles-element-state-pane-slidein{from{margin-top:-60px}to{margin-top:0}}@keyframes styles-element-state-pane-slideout{from{margin-top:0}to{margin-top:-60px}}.styles-sidebar-toolbar-pane{position:relative;animation-duration:.1s;animation-direction:normal}.styles-sidebar-toolbar-pane-container{position:relative;overflow:hidden;flex-shrink:0}.styles-selector{cursor:text}.styles-sidebar-pane-toolbar-container{flex-shrink:0;overflow:hidden;position:sticky;top:0;background-color:var(--color-background-elevation-1);z-index:2}.styles-sidebar-pane-toolbar{border-bottom:1px solid var(--color-details-hairline);flex-shrink:0}.font-toolbar-hidden{visibility:hidden}.styles-sidebar-pane-filter-box{flex:auto;display:flex}.styles-sidebar-pane-filter-box>input{outline:0!important;border:none;width:100%;background:var(--color-background);padding-left:4px;margin:3px}.styles-sidebar-pane-filter-box>input:hover{box-shadow:var(--legacy-focus-ring-inactive-shadow)}.styles-sidebar-pane-filter-box>input:focus,.styles-sidebar-pane-filter-box>input:not(:placeholder-shown){box-shadow:var(--legacy-focus-ring-active-shadow)}.styles-sidebar-pane-filter-box>input::placeholder{color:var(--color-text-secondary)}.styles-section.styles-panel-hovered:not(.read-only),.styles-section.styles-panel-hovered:not(.read-only) devtools-css-query{--override-styles-section-text-hover-text-decoration:underline;--override-styles-section-text-hover-cursor:default}.styles-section span.simple-selector:hover{text-decoration:var(--override-styles-section-text-hover-text-decoration);cursor:var(--override-styles-section-text-hover-cursor)}.sidebar-separator{background-color:var(--color-background-elevation-1);padding:0 5px;border-bottom:1px solid var(--color-details-hairline);color:var(--color-text-secondary);white-space:nowrap;text-overflow:ellipsis;overflow:hidden;line-height:22px}.sidebar-separator>span.monospace{max-width:180px;display:inline-block;overflow:hidden;text-overflow:ellipsis;vertical-align:middle;margin-left:2px}.sidebar-pane-section-toolbar{position:absolute;right:0;bottom:0;z-index:0}.sidebar-pane-section-toolbar.new-rule-toolbar{visibility:hidden}.styles-pane:not(.is-editing-style) .styles-section.matched-styles:not(.read-only):hover .sidebar-pane-section-toolbar.new-rule-toolbar{visibility:visible}.sidebar-pane-section-toolbar.shifted-toolbar{padding-right:32px}.styles-show-all{margin-left:16px;text-overflow:ellipsis;overflow:hidden;max-width:-webkit-fill-available}@media (forced-colors:active){.styles-sidebar-pane-filter-box>input{border:1px solid ButtonText;background:ButtonFace}.styles-section.read-only:focus-visible,.styles-section:focus-visible{forced-color-adjust:none;background-color:Highlight}.styles-section .styles-section-subtitle .devtools-link{color:linktext;text-decoration-color:linktext}.styles-section .styles-section-subtitle .devtools-link:focus-visible{color:HighlightText}.styles-section.read-only:focus-visible *,.styles-section:focus-visible *,.styles-section:focus-visible .styles-section-subtitle .devtools-link{color:HighlightText;text-decoration-color:HighlightText}.sidebar-pane-section-toolbar{forced-color-adjust:none;border-color:1px solid ButtonText;background-color:ButtonFace}.styles-section:focus-visible .sidebar-pane-section-toolbar{background-color:ButtonFace}.styles-section:focus-visible{--webkit-css-property-color:HighlightText}}.spinner::before{--dimension:24px;margin-top:2em;left:calc(50% - var(--dimension)/ 2)}\n/*# sourceURL=stylesSidebarPane.css */\n");const Fe={noMatchingSelectorOrStyle:"No matching selector or style",invalidPropertyValue:"Invalid property value",unknownPropertyName:"Unknown property name",filter:"Filter",filterStyles:"Filter Styles",pseudoSElement:"Pseudo ::{PH1} element",inheritedFroms:"Inherited from ",insertStyleRuleBelow:"Insert Style Rule Below",constructedStylesheet:"constructed stylesheet",userAgentStylesheet:"user agent stylesheet",injectedStylesheet:"injected stylesheet",viaInspector:"via inspector",styleAttribute:"`style` attribute",sattributesStyle:"{PH1}[Attributes Style]",showAllPropertiesSMore:"Show All Properties ({PH1} more)",copySelector:"Copy `selector`",copyRule:"Copy rule",copyAllDeclarations:"Copy all declarations",incrementdecrementWithMousewheelOne:"Increment/decrement with mousewheel or up/down keys. {PH1}: R ±1, Shift: G ±1, Alt: B ±1",incrementdecrementWithMousewheelHundred:"Increment/decrement with mousewheel or up/down keys. {PH1}: ±100, Shift: ±10, Alt: ±0.1",invalidString:"{PH1}, property name: {PH2}, property value: {PH3}",newStyleRule:"New Style Rule",cssPropertyName:"`CSS` property name",cssPropertyValue:"`CSS` property value",cssSelector:"`CSS` selector"},Ue=o.i18n.registerUIStrings("panels/elements/StylesSidebarPane.ts",Fe),He=o.i18n.getLocalizedString.bind(void 0,Ue),Be=[{mode:"padding",properties:["padding"]},{mode:"border",properties:["border"]},{mode:"margin",properties:["margin"]},{mode:"gap",properties:["gap","grid-gap"]},{mode:"column-gap",properties:["column-gap","grid-column-gap"]},{mode:"row-gap",properties:["row-gap","grid-row-gap"]},{mode:"grid-template-columns",properties:["grid-template-columns"]},{mode:"grid-template-rows",properties:["grid-template-rows"]},{mode:"grid-template-areas",properties:["grid-areas"]},{mode:"justify-content",properties:["justify-content"]},{mode:"align-content",properties:["align-content"]},{mode:"align-items",properties:["align-items"]},{mode:"flexibility",properties:["flex","flex-basis","flex-grow","flex-shrink"]}];let Ve;class We extends(e.ObjectWrapper.eventMixin(me)){currentToolbarPane;animatedToolbarPane;pendingWidget;pendingWidgetToggle;toolbar;toolbarPaneElement;noMatchesElement;sectionsContainer;sectionByElement;swatchPopoverHelperInternal;linkifier;decorator;lastRevealedProperty;userOperation;isEditingStyle;filterRegexInternal;isActivePropertyHighlighted;initialUpdateCompleted;hasMatchedStyles;sectionBlocks;idleCallbackManager;needsForceUpdate;resizeThrottler;imagePreviewPopover;activeCSSAngle;static instance(){return Ve||(Ve=new We),Ve}constructor(){super(!0),this.setMinimumSize(96,26),this.registerCSSFiles([Re]),e.Settings.Settings.instance().moduleSetting("colorFormat").addChangeListener(this.update.bind(this)),e.Settings.Settings.instance().moduleSetting("textEditorIndent").addChangeListener(this.update.bind(this)),this.currentToolbarPane=null,this.animatedToolbarPane=null,this.pendingWidget=null,this.pendingWidgetToggle=null,this.toolbar=null,this.toolbarPaneElement=this.createStylesSidebarToolbar(),this.computedStyleModelInternal=new A,this.noMatchesElement=this.contentElement.createChild("div","gray-info-message hidden"),this.noMatchesElement.textContent=He(Fe.noMatchingSelectorOrStyle),this.sectionsContainer=this.contentElement.createChild("div"),i.ARIAUtils.markAsList(this.sectionsContainer),this.sectionsContainer.addEventListener("keydown",this.sectionsContainerKeyDown.bind(this),!1),this.sectionsContainer.addEventListener("focusin",this.sectionsContainerFocusChanged.bind(this),!1),this.sectionsContainer.addEventListener("focusout",this.sectionsContainerFocusChanged.bind(this),!1),this.sectionByElement=new WeakMap,this.swatchPopoverHelperInternal=new u.SwatchPopoverHelper.SwatchPopoverHelper,this.swatchPopoverHelperInternal.addEventListener(u.SwatchPopoverHelper.Events.WillShowPopover,this.hideAllPopovers,this),this.linkifier=new a.Linkifier.Linkifier(_e,!0),this.decorator=new Le(this),this.lastRevealedProperty=null,this.userOperation=!1,this.isEditingStyle=!1,this.filterRegexInternal=null,this.isActivePropertyHighlighted=!1,this.initialUpdateCompleted=!1,this.hasMatchedStyles=!1,this.contentElement.classList.add("styles-pane"),this.sectionBlocks=[],this.idleCallbackManager=null,this.needsForceUpdate=!1,Ve=this,i.Context.Context.instance().addFlavorChangeListener(n.DOMModel.DOMNode,this.forceUpdate,this),this.contentElement.addEventListener("copy",this.clipboardCopy.bind(this)),this.resizeThrottler=new e.Throttler.Throttler(100),this.imagePreviewPopover=new U(this.contentElement,(e=>{const t=e.composedPath()[0];return t instanceof Element?t:null}),(()=>this.node())),this.activeCSSAngle=null}swatchPopoverHelper(){return this.swatchPopoverHelperInternal}setUserOperation(e){this.userOperation=e}static createExclamationMark(e,t){const s=document.createElement("span",{is:"dt-icon-label"});let o;s.className="exclamation-mark",We.ignoreErrorsForProperty(e)||(s.type="smallicon-warning"),t?(i.Tooltip.Tooltip.install(s,t),o=t):(o=n.CSSMetadata.cssMetadata().isCSSPropertyName(e.name)?He(Fe.invalidPropertyValue):He(Fe.unknownPropertyName),i.Tooltip.Tooltip.install(s,o));const r=He(Fe.invalidString,{PH1:o,PH2:e.name,PH3:e.value});return e.setDisplayedStringForInvalidProperty(r),s}static ignoreErrorsForProperty(e){function t(e){return!e.startsWith("-webkit-")&&/^[-_][\w\d]+-\w/.test(e)}const n=e.name.toLowerCase();if("_"===n.charAt(0))return!0;if("filter"===n)return!0;if(n.startsWith("scrollbar-"))return!0;if(t(n))return!0;const i=e.value.toLowerCase();return!!i.endsWith("\\9")||!!t(i)}static createPropertyFilterElement(e,t,n){const i=document.createElement("input");function s(){const e=i.value?new RegExp(p.StringUtilities.escapeForRegExp(i.value),"i"):null;n(e)}return i.type="search",i.classList.add("custom-search-input"),i.placeholder=e,i.addEventListener("input",s,!1),i.addEventListener("keydown",(function(e){const t=e;t.key===p.KeyboardUtilities.ESCAPE_KEY&&i.value&&(t.consume(!0),i.value="",s())}),!1),i}static formatLeadingProperties(t){const n=t.headerText(),i=e.Settings.Settings.instance().moduleSetting("textEditorIndent").get(),s=t.style(),o=[];for(const e of s.leadingProperties())e.disabled?o.push(`${i}/* ${e.name}: ${e.value}; */`):o.push(`${i}${e.name}: ${e.value};`);const r=o.join("\n");return{allDeclarationText:r,ruleText:`${n} {\n${r}\n}`}}revealProperty(e){this.decorator.highlightProperty(e),this.lastRevealedProperty=e,this.update()}jumpToProperty(e){this.decorator.findAndHighlightPropertyName(e)}forceUpdate(){this.needsForceUpdate=!0,this.swatchPopoverHelperInternal.hide(),this.resetCache(),this.update()}sectionsContainerKeyDown(e){const t=this.sectionsContainer.ownerDocument.deepActiveElement();if(!t)return;const n=this.sectionByElement.get(t);if(!n)return;let i=null,s=!1;switch(e.key){case"ArrowUp":case"ArrowLeft":i=n.previousSibling()||n.lastSibling(),s=!1;break;case"ArrowDown":case"ArrowRight":i=n.nextSibling()||n.firstSibling(),s=!0;break;case"Home":i=n.firstSibling(),s=!0;break;case"End":i=n.lastSibling(),s=!1}i&&this.filterRegexInternal&&(i=i.findCurrentOrNextVisible(s)),i&&(i.element.focus(),e.consume(!0))}sectionsContainerFocusChanged(){this.resetFocus()}resetFocus(){if(this.noMatchesElement.classList.contains("hidden")&&this.sectionBlocks[0]&&this.sectionBlocks[0].sections[0]){const e=this.sectionBlocks[0].sections[0].findCurrentOrNextVisible(!0);e&&(e.element.tabIndex=this.sectionsContainer.hasFocus()?-1:0)}}onAddButtonLongClick(e){const t=this.cssModel();if(!t)return;const n=t.styleSheetHeaders().filter((function(e){return!e.isViaInspector()&&!e.isInline&&Boolean(e.resourceURL())})),s=[];for(let e=0;e{this.initialUpdateCompleted||this.sectionsContainer.createChild("span","spinner")}),200);const e=await this.fetchMatchedCascade();await this.innerRebuildUpdate(e),this.initialUpdateCompleted||(this.initialUpdateCompleted=!0,this.dispatchEventToListeners("InitialUpdateCompleted")),this.dispatchEventToListeners("StylesUpdateCompleted",{hasMatchedStyles:this.hasMatchedStyles})}onResize(){this.resizeThrottler.schedule(this.innerResize.bind(this))}innerResize(){const e=this.contentElement.getBoundingClientRect().width+"px";return this.allSections().forEach((t=>{t.propertiesTreeOutline.element.style.width=e})),Promise.resolve()}resetCache(){const e=this.cssModel();e&&e.discardCachedMatchedCascade()}fetchMatchedCascade(){const e=this.node();if(!e||!this.cssModel())return Promise.resolve(null);const t=this.cssModel();return t?t.cachedMatchedCascadeForNode(e).then(function(e){return e&&e.node()===this.node()?e:null}.bind(this)):Promise.resolve(null)}setEditingStyle(e,t){this.isEditingStyle!==e&&(this.contentElement.classList.toggle("is-editing-style",e),this.isEditingStyle=e,this.setActiveProperty(null))}setActiveProperty(e){if(this.isActivePropertyHighlighted&&n.OverlayModel.OverlayModel.hideDOMNodeHighlight(),this.isActivePropertyHighlighted=!1,!this.node())return;if(!e||e.overloaded()||e.inherited())return;const t=e.property.ownerStyle.parentRule,i=t instanceof n.CSSRule.CSSStyleRule?t.selectorText():void 0;for(const{properties:t,mode:n}of Be){if(!t.includes(e.name))continue;const s=this.node();if(s){s.domModel().overlayModel().highlightInOverlay({node:this.node(),selectorList:i},n),this.isActivePropertyHighlighted=!0;break}}}onCSSModelChanged(e){const t=e?.data&&"edit"in e.data?e.data.edit:null;if(t)for(const e of this.allSections())e.styleSheetEdited(t);else this.userOperation||this.isEditingStyle||(this.resetCache(),this.update())}focusedSectionIndex(){let e=0;for(const t of this.sectionBlocks)for(const n of t.sections){if(n.element.hasFocus())return e;e++}return-1}continueEditingElement(e,t){const n=this.allSections()[e];if(n){const e=n.closestPropertyForEditing(t);if(!e)return void n.element.focus();e.startEditing()}}async innerRebuildUpdate(e){if(this.needsForceUpdate)this.needsForceUpdate=!1;else if(this.isEditingStyle||this.userOperation)return;const t=this.focusedSectionIndex();this.linkifier.reset();const n=this.sectionBlocks.map((e=>e.sections)).flat();this.sectionBlocks=[];const i=this.node();if(this.hasMatchedStyles=null!==e&&null!==i,!this.hasMatchedStyles)return this.sectionsContainer.removeChildren(),void this.noMatchesElement.classList.remove("hidden");this.sectionBlocks=await this.rebuildSectionsForMatchedStyleRules(e);const o=this.sectionBlocks.map((e=>e.sections)).flat(),r=Ie.instance(),l=r.getSection();if(l){r.unbindContext();for(const[e,t]of n.entries())l===t&&e=d&&this.sectionBlocks[0].sections[0].element.focus(),this.sectionsContainerFocusChanged(),this.filterRegexInternal?this.updateFilter():this.noMatchesElement.classList.toggle("hidden",this.sectionBlocks.length>0),this.nodeStylesUpdatedForTest(i,!0),this.lastRevealedProperty&&(this.decorator.highlightProperty(this.lastRevealedProperty),this.lastRevealedProperty=null),this.swatchPopoverHelper().reposition(),s.userMetrics.panelLoaded("elements","DevTools.Launch.Elements"),this.dispatchEventToListeners("StylesUpdateCompleted",{hasMatchedStyles:!1})}nodeStylesUpdatedForTest(e,t){}async rebuildSectionsForMatchedStyleRules(e){this.idleCallbackManager&&this.idleCallbackManager.discard(),this.idleCallbackManager=new je;const t=[new ze(null)];let n=0,i=null;for(const s of e.nodeStyles()){const o=e.isInherited(s)?e.nodeForStyle(s):null;if(o&&o!==i){i=o;const e=await ze.createInheritedNodeBlock(i);t.push(e)}const r=t[t.length-1];r&&this.idleCallbackManager.schedule((()=>{const t=new Ke(this,e,s,n);n++,r.sections.push(t)}))}let s=[];const o=e.pseudoTypes();o.delete("before")&&s.push("before"),s=s.concat([...o].sort());for(const i of s){const s=ze.createPseudoTypeBlock(i);for(const t of e.pseudoStyles(i))this.idleCallbackManager.schedule((()=>{const i=new Ke(this,e,t,n);n++,s.sections.push(i)}));t.push(s)}for(const i of e.keyframes()){const s=ze.createKeyframesBlock(i.name().text);for(const t of i.keyframes())this.idleCallbackManager.schedule((()=>{s.sections.push(new qe(this,e,t.style,n)),n++}));t.push(s)}return await this.idleCallbackManager.awaitDone(),t}async createNewRuleInViaInspectorStyleSheet(){const e=this.cssModel(),t=this.node();if(!e||!t)return;this.setUserOperation(!0);const n=await e.requestViaInspectorStylesheet(t);this.setUserOperation(!1),await this.createNewRuleInStyleSheet(n)}async createNewRuleInStyleSheet(e){if(!e)return;const t=((await e.requestContent()).content||"").split("\n"),n=g.TextRange.TextRange.createFromLocation(t.length-1,t[t.length-1].length);this.sectionBlocks&&this.sectionBlocks.length>0&&this.addBlankSection(this.sectionBlocks[0].sections[0],e.id,n)}addBlankSection(e,t,n){const i=this.node(),s=new Ge(this,e.matchedStyles,i?i.simpleSelector():"",t,n,e.style(),0);this.sectionsContainer.insertBefore(s.element,e.element.nextSibling);for(const t of this.sectionBlocks){const n=t.sections.indexOf(e);-1!==n&&(t.sections.splice(n+1,0,s),s.startEditingSelector())}let o=0;for(const e of this.sectionBlocks)for(const t of e.sections)t.setSectionIdx(o),o++}removeSection(e){for(const t of this.sectionBlocks){const n=t.sections.indexOf(e);-1!==n&&(t.sections.splice(n,1),e.element.remove())}}filterRegex(){return this.filterRegexInternal}updateFilter(){let e=!1;for(const t of this.sectionBlocks)e=t.updateFilter()||e;this.noMatchesElement.classList.toggle("hidden",Boolean(e))}willHide(){this.hideAllPopovers(),super.willHide()}hideAllPopovers(){this.swatchPopoverHelperInternal.hide(),this.imagePreviewPopover.hide(),this.activeCSSAngle&&(this.activeCSSAngle.minify(),this.activeCSSAngle=null)}allSections(){let e=[];for(const t of this.sectionBlocks)e=e.concat(t.sections);return e}clipboardCopy(e){s.userMetrics.actionTaken(s.UserMetrics.Action.StyleRuleCopied)}createStylesSidebarToolbar(){const e=this.contentElement.createChild("div","styles-sidebar-pane-toolbar-container"),t=e.createChild("div","hbox styles-sidebar-pane-toolbar"),n=t.createChild("div","styles-sidebar-pane-filter-box"),s=We.createPropertyFilterElement(He(Fe.filter),t,this.onFilterChanged.bind(this));i.ARIAUtils.setAccessibleName(s,He(Fe.filterStyles)),n.appendChild(s);const o=new i.Toolbar.Toolbar("styles-pane-toolbar",t);o.makeToggledGray(),o.appendItemsAtLocation("styles-sidebarpane-toolbar"),this.toolbar=o;return e.createChild("div","styles-sidebar-toolbar-pane-container").createChild("div","styles-sidebar-toolbar-pane")}showToolbarPane(e,t){this.pendingWidgetToggle&&this.pendingWidgetToggle.setToggled(!1),this.pendingWidgetToggle=t,this.animatedToolbarPane?this.pendingWidget=e:this.startToolbarPaneAnimation(e),e&&t&&t.setToggled(!0)}appendToolbarItem(e){this.toolbar&&this.toolbar.appendToolbarItem(e)}startToolbarPaneAnimation(e){if(e===this.currentToolbarPane)return;if(e&&this.currentToolbarPane)return this.currentToolbarPane.detach(),e.show(this.toolbarPaneElement),this.currentToolbarPane=e,void this.currentToolbarPane.focus();this.animatedToolbarPane=e,this.currentToolbarPane?this.toolbarPaneElement.style.animationName="styles-element-state-pane-slideout":e&&(this.toolbarPaneElement.style.animationName="styles-element-state-pane-slidein"),e&&e.show(this.toolbarPaneElement);const t=function(){this.toolbarPaneElement.style.removeProperty("animation-name"),this.toolbarPaneElement.removeEventListener("animationend",t,!1),this.currentToolbarPane&&this.currentToolbarPane.detach();this.currentToolbarPane=this.animatedToolbarPane,this.currentToolbarPane&&this.currentToolbarPane.focus();this.animatedToolbarPane=null,this.pendingWidget&&(this.startToolbarPaneAnimation(this.pendingWidget),this.pendingWidget=null)}.bind(this);this.toolbarPaneElement.addEventListener("animationend",t,!1)}}const _e=23;class ze{titleElementInternal;sections;constructor(e){this.titleElementInternal=e,this.sections=[]}static createPseudoTypeBlock(e){const t=document.createElement("div");return t.className="sidebar-separator",t.textContent=He(Fe.pseudoSElement,{PH1:e}),new ze(t)}static createKeyframesBlock(e){const t=document.createElement("div");return t.className="sidebar-separator",t.textContent=`@keyframes ${e}`,new ze(t)}static async createInheritedNodeBlock(t){const n=document.createElement("div");n.className="sidebar-separator",i.UIUtils.createTextChild(n,He(Fe.inheritedFroms));const s=await e.Linkifier.Linkifier.linkify(t,{preventKeyboardFocus:!0,tooltip:void 0});return n.appendChild(s),new ze(n)}updateFilter(){let e=!1;for(const t of this.sections)e=t.updateFilter()||e;return this.titleElementInternal&&this.titleElementInternal.classList.toggle("hidden",!e),Boolean(e)}titleElement(){return this.titleElementInternal}}class je{discarded;promises;constructor(){this.discarded=!1,this.promises=[]}discard(){this.discarded=!0}schedule(e,t=100){this.discarded||this.promises.push(new Promise(((n,i)=>{window.requestIdleCallback((()=>{if(this.discarded)return n();(()=>{try{e(),n()}catch(e){i(e)}})()}),{timeout:t})})))}awaitDone(){return Promise.all(this.promises)}}class Ke{parentPane;styleInternal;matchedStyles;editable;hoverTimer;willCauseCancelEditing;forceShowAll;originalPropertiesCount;element;innerElement;titleElement;propertiesTreeOutline;showAllButton;selectorElement;newStyleRuleToolbar;fontEditorToolbar;fontEditorSectionManager;fontEditorButton;selectedSinceMouseDown;elementToSelectorIndex;navigable;selectorRefElement;selectorContainer;fontPopoverIcon;hoverableSelectorsMode;isHiddenInternal;queryListElement;nextEditorTriggerButtonIdx=1;sectionIdx=0;constructor(e,s,o,r){this.parentPane=e,this.sectionIdx=r,this.styleInternal=o,this.matchedStyles=s,this.editable=Boolean(o.styleSheetId&&o.range),this.hoverTimer=null,this.willCauseCancelEditing=!1,this.forceShowAll=!1,this.originalPropertiesCount=o.leadingProperties().length;const l=o.parentRule;this.element=document.createElement("div"),this.element.classList.add("styles-section"),this.element.classList.add("matched-styles"),this.element.classList.add("monospace"),i.ARIAUtils.setAccessibleName(this.element,`${this.headerText()}, css selector`),this.element.tabIndex=-1,i.ARIAUtils.markAsListitem(this.element),this.element.addEventListener("keydown",this.onKeyDown.bind(this),!1),e.sectionByElement.set(this.element,this),this.innerElement=this.element.createChild("div"),this.titleElement=this.innerElement.createChild("div","styles-section-title "+(l?"styles-selector":"")),this.propertiesTreeOutline=new i.TreeOutline.TreeOutlineInShadow,this.propertiesTreeOutline.setFocusable(!1),this.propertiesTreeOutline.registerCSSFiles([Ae]),this.propertiesTreeOutline.element.classList.add("style-properties","matched-styles","monospace"),this.propertiesTreeOutline.section=this,this.innerElement.appendChild(this.propertiesTreeOutline.element),this.showAllButton=i.UIUtils.createTextButton("",this.showAllItems.bind(this),"styles-show-all"),this.innerElement.appendChild(this.showAllButton);const a=document.createElement("div");this.selectorElement=document.createElement("span"),i.ARIAUtils.setAccessibleName(this.selectorElement,He(Fe.cssSelector)),this.selectorElement.classList.add("selector"),this.selectorElement.textContent=this.headerText(),a.appendChild(this.selectorElement),this.selectorElement.addEventListener("mouseenter",this.onMouseEnterSelector.bind(this),!1),this.selectorElement.addEventListener("mousemove",(e=>e.consume()),!1),this.selectorElement.addEventListener("mouseleave",this.onMouseOutSelector.bind(this),!1);a.createChild("span","sidebar-pane-open-brace").textContent=" {",a.addEventListener("mousedown",this.handleEmptySpaceMouseDown.bind(this),!1),a.addEventListener("click",this.handleSelectorContainerClick.bind(this),!1);if(this.innerElement.createChild("div","sidebar-pane-closing-brace").textContent="}",this.styleInternal.parentRule){const e=new i.Toolbar.ToolbarButton(He(Fe.insertStyleRuleBelow),"largeicon-add");e.addEventListener(i.Toolbar.ToolbarButton.Events.Click,this.onNewRuleClick,this),e.element.tabIndex=-1,this.newStyleRuleToolbar||(this.newStyleRuleToolbar=new i.Toolbar.Toolbar("sidebar-pane-section-toolbar new-rule-toolbar",this.innerElement)),this.newStyleRuleToolbar.appendToolbarItem(e),i.ARIAUtils.markAsHidden(this.newStyleRuleToolbar.element)}if(t.Runtime.experiments.isEnabled("fontEditor")&&this.editable&&(this.fontEditorToolbar=new i.Toolbar.Toolbar("sidebar-pane-section-toolbar",this.innerElement),this.fontEditorSectionManager=new ne(this.parentPane.swatchPopoverHelper(),this),this.fontEditorButton=new i.Toolbar.ToolbarButton("Font Editor","largeicon-font-editor"),this.fontEditorButton.addEventListener(i.Toolbar.ToolbarButton.Events.Click,(()=>{this.onFontEditorButtonClicked()}),this),this.fontEditorButton.element.addEventListener("keydown",(e=>{isEnterOrSpaceKey(e)&&(e.consume(!0),this.onFontEditorButtonClicked())}),!1),this.fontEditorToolbar.appendToolbarItem(this.fontEditorButton),this.styleInternal.type===n.CSSStyleDeclaration.Type.Inline?this.newStyleRuleToolbar&&this.newStyleRuleToolbar.element.classList.add("shifted-toolbar"):this.fontEditorToolbar.element.classList.add("font-toolbar-hidden")),this.selectorElement.addEventListener("click",this.handleSelectorClick.bind(this),!1),this.element.addEventListener("contextmenu",this.handleContextMenuEvent.bind(this),!1),this.element.addEventListener("mousedown",this.handleEmptySpaceMouseDown.bind(this),!1),this.element.addEventListener("click",this.handleEmptySpaceClick.bind(this),!1),this.element.addEventListener("mousemove",this.onMouseMove.bind(this),!1),this.element.addEventListener("mouseleave",this.onMouseLeave.bind(this),!1),this.selectedSinceMouseDown=!1,this.elementToSelectorIndex=new WeakMap,l)if(l.isUserAgent()||l.isInjected())this.editable=!1;else if(l.styleSheetId){const e=l.cssModel().styleSheetHeaderForId(l.styleSheetId);this.navigable=e&&!e.isAnonymousInlineStyleSheet()}this.queryListElement=this.titleElement.createChild("div","query-list query-matches"),this.selectorRefElement=this.titleElement.createChild("div","styles-section-subtitle"),this.updateQueryList(),this.updateRuleOrigin(),this.titleElement.appendChild(a),this.selectorContainer=a,this.navigable&&this.element.classList.add("navigable"),this.editable||(this.element.classList.add("read-only"),this.propertiesTreeOutline.element.classList.add("read-only")),this.fontPopoverIcon=null,this.hoverableSelectorsMode=!1,this.isHiddenInternal=!1,this.markSelectorMatches(),this.onpopulate()}setSectionIdx(e){this.sectionIdx=e,this.onpopulate()}getSectionIdx(){return this.sectionIdx}registerFontProperty(e){this.fontEditorSectionManager&&this.fontEditorSectionManager.registerFontProperty(e),this.fontEditorToolbar&&(this.fontEditorToolbar.element.classList.remove("font-toolbar-hidden"),this.newStyleRuleToolbar&&this.newStyleRuleToolbar.element.classList.add("shifted-toolbar"))}resetToolbars(){this.parentPane.swatchPopoverHelper().isShowing()||this.styleInternal.type===n.CSSStyleDeclaration.Type.Inline||(this.fontEditorToolbar&&this.fontEditorToolbar.element.classList.add("font-toolbar-hidden"),this.newStyleRuleToolbar&&this.newStyleRuleToolbar.element.classList.remove("shifted-toolbar"))}static createRuleOriginNode(e,t,n){if(!n)return document.createTextNode("");const i=this.getRuleLocationFromCSSRule(n),s=n.styleSheetId?e.cssModel().styleSheetHeaderForId(n.styleSheetId):null;function o(){return n&&i&&n.styleSheetId&&s&&!s.isAnonymousInlineStyleSheet()?Ke.linkifyRuleLocation(e.cssModel(),t,n.styleSheetId,i):null}function r(e){if(s?.ownerNode){const t=he(s.ownerNode,{preventKeyboardFocus:!1,tooltip:void 0});return t.textContent=e,t}return null}if(s?.isMutable&&!s.isViaInspector()){const e=s.isConstructedByNew()?null:o();if(e)return e;const t=s.isConstructedByNew()?He(Fe.constructedStylesheet):" `,this.#e,{host:this})}fireSizeChange(e){this.dispatchEvent(new a(l(e)))}handleModifierKeys(e){const t=s.UIUtils.modifiedFloatNumber(l(e),e);null!==t&&(e.preventDefault(),e.target.value=String(t))}}t.CustomElements.defineComponent("device-mode-emulation-size-input",n);var r=Object.freeze({__proto__:null,SizeInputElement:n});export{r as DeviceSizeInputElement};
diff --git a/chii/panels/emulation/emulation-legacy.js b/chii/panels/emulation/emulation-legacy.js
new file mode 100644
index 00000000..a54a4b7b
--- /dev/null
+++ b/chii/panels/emulation/emulation-legacy.js
@@ -0,0 +1 @@
+import*as e from"../../models/emulation/emulation.js";import*as a from"./emulation.js";self.Emulation=self.Emulation||{},Emulation=Emulation||{},Emulation.AdvancedApp=a.AdvancedApp.AdvancedApp,Emulation.AdvancedAppProvider=a.AdvancedApp.AdvancedAppProvider,Emulation.DeviceModeModel=e.DeviceModeModel.DeviceModeModel,Emulation.DeviceModeModel.Type=e.DeviceModeModel.Type,Emulation.DeviceModeView=a.DeviceModeView.DeviceModeView,Emulation.DeviceModeWrapper=a.DeviceModeWrapper.DeviceModeWrapper,Emulation.DeviceModeWrapper.ActionDelegate=a.DeviceModeWrapper.ActionDelegate,Emulation.EmulatedDevice=e.EmulatedDevices.EmulatedDevice,Emulation.EmulatedDevicesList=e.EmulatedDevices.EmulatedDevicesList,Emulation.InspectedPagePlaceholder=a.InspectedPagePlaceholder.InspectedPagePlaceholder,Emulation.InspectedPagePlaceholder.instance=a.InspectedPagePlaceholder.InspectedPagePlaceholder.instance,Emulation.MediaQueryInspector=a.MediaQueryInspector.MediaQueryInspector;
diff --git a/chii/panels/emulation/emulation-meta.js b/chii/panels/emulation/emulation-meta.js
new file mode 100644
index 00000000..6fbfe026
--- /dev/null
+++ b/chii/panels/emulation/emulation-meta.js
@@ -0,0 +1 @@
+import*as e from"../../core/common/common.js";import*as t from"../../core/root/root.js";import*as i from"../../ui/legacy/legacy.js";import*as o from"../../core/i18n/i18n.js";const n={toggleDeviceToolbar:"Toggle device toolbar",captureScreenshot:"Capture screenshot",captureFullSizeScreenshot:"Capture full size screenshot",captureNodeScreenshot:"Capture node screenshot",showMediaQueries:"Show media queries",device:"device",hideMediaQueries:"Hide media queries",showRulers:"Show rulers in the Device Mode toolbar",hideRulers:"Hide rulers in the Device Mode toolbar",showDeviceFrame:"Show device frame",hideDeviceFrame:"Hide device frame"},a=o.i18n.registerUIStrings("panels/emulation/emulation-meta.ts",n),r=o.i18n.getLazilyComputedLocalizedString.bind(void 0,a);let c;async function s(){return c||(c=await import("./emulation.js")),c}i.ActionRegistration.registerActionExtension({category:i.ActionRegistration.ActionCategory.MOBILE,actionId:"emulation.toggle-device-mode",toggleable:!0,loadActionDelegate:async()=>(await s()).DeviceModeWrapper.ActionDelegate.instance(),condition:t.Runtime.ConditionName.CAN_DOCK,title:r(n.toggleDeviceToolbar),iconClass:"largeicon-phone",bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+M"},{platform:"mac",shortcut:"Shift+Meta+M"}]}),i.ActionRegistration.registerActionExtension({actionId:"emulation.capture-screenshot",category:i.ActionRegistration.ActionCategory.SCREENSHOT,loadActionDelegate:async()=>(await s()).DeviceModeWrapper.ActionDelegate.instance(),condition:t.Runtime.ConditionName.CAN_DOCK,title:r(n.captureScreenshot)}),i.ActionRegistration.registerActionExtension({actionId:"emulation.capture-full-height-screenshot",category:i.ActionRegistration.ActionCategory.SCREENSHOT,loadActionDelegate:async()=>(await s()).DeviceModeWrapper.ActionDelegate.instance(),condition:t.Runtime.ConditionName.CAN_DOCK,title:r(n.captureFullSizeScreenshot)}),i.ActionRegistration.registerActionExtension({actionId:"emulation.capture-node-screenshot",category:i.ActionRegistration.ActionCategory.SCREENSHOT,loadActionDelegate:async()=>(await s()).DeviceModeWrapper.ActionDelegate.instance(),condition:t.Runtime.ConditionName.CAN_DOCK,title:r(n.captureNodeScreenshot)}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.MOBILE,settingName:"showMediaQueryInspector",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!1,options:[{value:!0,title:r(n.showMediaQueries)},{value:!1,title:r(n.hideMediaQueries)}],tags:[r(n.device)]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.MOBILE,settingName:"emulation.showRulers",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!1,options:[{value:!0,title:r(n.showRulers)},{value:!1,title:r(n.hideRulers)}],tags:[r(n.device)]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.MOBILE,settingName:"emulation.showDeviceOutline",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!1,options:[{value:!0,title:r(n.showDeviceFrame)},{value:!1,title:r(n.hideDeviceFrame)}],tags:[r(n.device)]}),i.Toolbar.registerToolbarItem({actionId:"emulation.toggle-device-mode",condition:t.Runtime.ConditionName.CAN_DOCK,location:i.Toolbar.ToolbarItemLocation.MAIN_TOOLBAR_LEFT,order:1,showLabel:void 0,loadItem:void 0,separator:void 0}),e.AppProvider.registerAppProvider({loadAppProvider:async()=>(await s()).AdvancedApp.AdvancedAppProvider.instance(),condition:t.Runtime.ConditionName.CAN_DOCK,order:0}),i.ContextMenu.registerItem({location:i.ContextMenu.ItemLocation.DEVICE_MODE_MENU_SAVE,order:12,actionId:"emulation.capture-screenshot"}),i.ContextMenu.registerItem({location:i.ContextMenu.ItemLocation.DEVICE_MODE_MENU_SAVE,order:13,actionId:"emulation.capture-full-height-screenshot"});
diff --git a/chii/panels/emulation/emulation.js b/chii/panels/emulation/emulation.js
new file mode 100644
index 00000000..d9a3af49
--- /dev/null
+++ b/chii/panels/emulation/emulation.js
@@ -0,0 +1 @@
+import*as e from"../../core/common/common.js";import*as t from"../../core/host/host.js";import*as i from"../../ui/legacy/legacy.js";import*as o from"../../core/root/root.js";import*as s from"../../core/sdk/sdk.js";import*as r from"../../models/emulation/emulation.js";import*as n from"../../core/i18n/i18n.js";import*as a from"../../core/platform/platform.js";import*as d from"../mobile_throttling/mobile_throttling.js";import*as l from"./components/components.js";import*as c from"../../models/bindings/bindings.js";var h={cssContent:".device-mode-x{margin:0 1px;font-size:16px}.device-mode-empty-toolbar-element{width:0}"};const m={dimensions:"Dimensions",width:"Width",heightLeaveEmptyForFull:"Height (leave empty for full)",zoom:"Zoom",devicePixelRatio:"Device pixel ratio",deviceType:"Device type",experimentalWebPlatformFeature:'"`Experimental Web Platform Feature`" flag is enabled. Click to disable it.',experimentalWebPlatformFeatureFlag:'"`Experimental Web Platform Feature`" flag is disabled. Click to enable it.',moreOptions:"More options",fitToWindowF:"Fit to window ({PH1}%)",autoadjustZoom:"Auto-adjust zoom",defaultF:"Default: {PH1}",hideDeviceFrame:"Hide device frame",showDeviceFrame:"Show device frame",hideMediaQueries:"Hide media queries",showMediaQueries:"Show media queries",hideRulers:"Hide rulers",showRulers:"Show rulers",removeDevicePixelRatio:"Remove device pixel ratio",addDevicePixelRatio:"Add device pixel ratio",removeDeviceType:"Remove device type",addDeviceType:"Add device type",resetToDefaults:"Reset to defaults",closeDevtools:"Close DevTools",responsive:"Responsive",edit:"Edit…",portrait:"Portrait",landscape:"Landscape",rotate:"Rotate",none:"None",screenOrientationOptions:"Screen orientation options",toggleDualscreenMode:"Toggle dual-screen mode"},p=n.i18n.registerUIStrings("panels/emulation/DeviceModeToolbar.ts",m),u=n.i18n.getLocalizedString.bind(void 0,p);function g(e,t){e.setTitle(t),e.element.title=t}class v{model;showMediaInspectorSetting;showRulersSetting;experimentDualScreenSupport;deviceOutlineSetting;showDeviceScaleFactorSetting;showUserAgentTypeSetting;autoAdjustScaleSetting;lastMode;elementInternal;emulatedDevicesList;persistenceSetting;spanButton;modeButton;widthInput;heightInput;deviceScaleItem;deviceSelectItem;scaleItem;uaItem;experimentalButton;cachedDeviceScale;cachedUaType;xItem;throttlingConditionsItem;cachedModelType;cachedScale;cachedModelDevice;cachedModelMode;constructor(t,s,n){this.model=t,this.showMediaInspectorSetting=s,this.showRulersSetting=n,this.experimentDualScreenSupport=o.Runtime.experiments.isEnabled("dualScreenSupport"),this.deviceOutlineSetting=this.model.deviceOutlineSetting(),this.showDeviceScaleFactorSetting=e.Settings.Settings.instance().createSetting("emulation.showDeviceScaleFactor",!1),this.showDeviceScaleFactorSetting.addChangeListener(this.updateDeviceScaleFactorVisibility,this),this.showUserAgentTypeSetting=e.Settings.Settings.instance().createSetting("emulation.showUserAgentType",!1),this.showUserAgentTypeSetting.addChangeListener(this.updateUserAgentTypeVisibility,this),this.autoAdjustScaleSetting=e.Settings.Settings.instance().createSetting("emulation.autoAdjustScale",!0),this.lastMode=new Map,this.elementInternal=document.createElement("div"),this.elementInternal.classList.add("device-mode-toolbar");const a=this.elementInternal.createChild("div","device-mode-toolbar-spacer");a.createChild("div","device-mode-toolbar-spacer");const d=new i.Toolbar.Toolbar("",a);this.fillLeftToolbar(d);const c=new i.Toolbar.Toolbar("",this.elementInternal);c.makeWrappable(),this.widthInput=new l.DeviceSizeInputElement.SizeInputElement(u(m.width)),this.widthInput.addEventListener("sizechanged",(({size:e})=>{this.model.setWidthAndScaleToFit(e)})),this.heightInput=new l.DeviceSizeInputElement.SizeInputElement(u(m.heightLeaveEmptyForFull)),this.heightInput.addEventListener("sizechanged",(({size:e})=>{this.model.setHeightAndScaleToFit(e)})),this.fillMainToolbar(c);const h=this.elementInternal.createChild("div","device-mode-toolbar-spacer"),p=new i.Toolbar.Toolbar("device-mode-toolbar-fixed-size",h);p.makeWrappable(),this.fillRightToolbar(p);const g=new i.Toolbar.Toolbar("device-mode-toolbar-fixed-size",h);g.makeWrappable(),this.fillModeToolbar(g),h.createChild("div","device-mode-toolbar-spacer");const v=new i.Toolbar.Toolbar("device-mode-toolbar-options",h);function b(){const e=t.toolbarControlsEnabledSetting().get();d.setEnabled(e),c.setEnabled(e),p.setEnabled(e),g.setEnabled(e),v.setEnabled(e)}v.makeWrappable(),this.fillOptionsToolbar(v),this.emulatedDevicesList=r.EmulatedDevices.EmulatedDevicesList.instance(),this.emulatedDevicesList.addEventListener("CustomDevicesUpdated",this.deviceListChanged,this),this.emulatedDevicesList.addEventListener("StandardDevicesUpdated",this.deviceListChanged,this),this.persistenceSetting=e.Settings.Settings.instance().createSetting("emulation.deviceModeValue",{device:"",orientation:"",mode:""}),this.model.toolbarControlsEnabledSetting().addChangeListener(b),b()}createEmptyToolbarElement(){const e=document.createElement("div");return e.classList.add("device-mode-empty-toolbar-element"),e}fillLeftToolbar(e){e.appendToolbarItem(this.wrapToolbarItem(this.createEmptyToolbarElement())),this.deviceSelectItem=new i.Toolbar.ToolbarMenuButton(this.appendDeviceMenuItems.bind(this)),this.deviceSelectItem.setGlyph(""),this.deviceSelectItem.turnIntoSelect(!0),this.deviceSelectItem.setDarkText(),e.appendToolbarItem(this.deviceSelectItem)}fillMainToolbar(e){e.appendToolbarItem(new i.Toolbar.ToolbarItem(this.widthInput));const t=document.createElement("div");t.classList.add("device-mode-x"),t.textContent="×",this.xItem=this.wrapToolbarItem(t),e.appendToolbarItem(this.xItem),e.appendToolbarItem(new i.Toolbar.ToolbarItem(this.heightInput))}fillRightToolbar(e){e.appendToolbarItem(this.wrapToolbarItem(this.createEmptyToolbarElement())),this.scaleItem=new i.Toolbar.ToolbarMenuButton(this.appendScaleMenuItems.bind(this)),g(this.scaleItem,u(m.zoom)),this.scaleItem.setGlyph(""),this.scaleItem.turnIntoSelect(),this.scaleItem.setDarkText(),e.appendToolbarItem(this.scaleItem),e.appendToolbarItem(this.wrapToolbarItem(this.createEmptyToolbarElement())),this.deviceScaleItem=new i.Toolbar.ToolbarMenuButton(this.appendDeviceScaleMenuItems.bind(this)),this.deviceScaleItem.setVisible(this.showDeviceScaleFactorSetting.get()),g(this.deviceScaleItem,u(m.devicePixelRatio)),this.deviceScaleItem.setGlyph(""),this.deviceScaleItem.turnIntoSelect(),this.deviceScaleItem.setDarkText(),e.appendToolbarItem(this.deviceScaleItem),e.appendToolbarItem(this.wrapToolbarItem(this.createEmptyToolbarElement())),this.uaItem=new i.Toolbar.ToolbarMenuButton(this.appendUserAgentMenuItems.bind(this)),this.uaItem.setVisible(this.showUserAgentTypeSetting.get()),g(this.uaItem,u(m.deviceType)),this.uaItem.setGlyph(""),this.uaItem.turnIntoSelect(),this.uaItem.setDarkText(),e.appendToolbarItem(this.uaItem),this.throttlingConditionsItem=d.ThrottlingManager.throttlingManager().createMobileThrottlingButton(),e.appendToolbarItem(this.throttlingConditionsItem)}fillModeToolbar(e){e.appendToolbarItem(this.wrapToolbarItem(this.createEmptyToolbarElement())),this.modeButton=new i.Toolbar.ToolbarButton("","largeicon-rotate-screen"),this.modeButton.addEventListener(i.Toolbar.ToolbarButton.Events.Click,this.modeMenuClicked,this),e.appendToolbarItem(this.modeButton),this.experimentDualScreenSupport&&(this.spanButton=new i.Toolbar.ToolbarButton("","largeicon-dual-screen"),this.spanButton.addEventListener(i.Toolbar.ToolbarButton.Events.Click,this.spanClicked,this),e.appendToolbarItem(this.spanButton),this.createExperimentalButton(e))}createExperimentalButton(e){e.appendToolbarItem(new i.Toolbar.ToolbarSeparator(!0));const t=this.model.webPlatformExperimentalFeaturesEnabled()?u(m.experimentalWebPlatformFeature):u(m.experimentalWebPlatformFeatureFlag);this.experimentalButton=new i.Toolbar.ToolbarToggle(t,"largeicon-experimental-api"),this.experimentalButton.setToggled(this.model.webPlatformExperimentalFeaturesEnabled()),this.experimentalButton.setEnabled(!0),this.experimentalButton.addEventListener(i.Toolbar.ToolbarButton.Events.Click,this.experimentalClicked,this),e.appendToolbarItem(this.experimentalButton)}experimentalClicked(){t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab("chrome://flags/#enable-experimental-web-platform-features")}fillOptionsToolbar(e){e.appendToolbarItem(this.wrapToolbarItem(this.createEmptyToolbarElement()));const t=new i.Toolbar.ToolbarMenuButton(this.appendOptionsMenuItems.bind(this));g(t,u(m.moreOptions)),e.appendToolbarItem(t)}appendScaleMenuItems(e){this.model.type()===r.DeviceModeModel.Type.Device&&e.footerSection().appendItem(u(m.fitToWindowF,{PH1:this.getPrettyZoomPercentage()}),this.onScaleMenuChanged.bind(this,this.model.fitScale()),!1),e.footerSection().appendCheckboxItem(u(m.autoadjustZoom),this.onAutoAdjustScaleChanged.bind(this),this.autoAdjustScaleSetting.get());const t=function(t,i){e.defaultSection().appendCheckboxItem(t,this.onScaleMenuChanged.bind(this,i),this.model.scaleSetting().get()===i,!1)}.bind(this);t("50%",.5),t("75%",.75),t("100%",1),t("125%",1.25),t("150%",1.5)}onScaleMenuChanged(e){this.model.scaleSetting().set(e)}onAutoAdjustScaleChanged(){this.autoAdjustScaleSetting.set(!this.autoAdjustScaleSetting.get())}appendDeviceScaleMenuItems(e){const t=this.model.deviceScaleFactorSetting(),i=this.model.uaSetting().get()===r.DeviceModeModel.UA.Mobile||this.model.uaSetting().get()===r.DeviceModeModel.UA.MobileNoTouch?r.DeviceModeModel.defaultMobileScaleFactor:window.devicePixelRatio;function o(e,i,o){e.appendCheckboxItem(i,t.set.bind(t,o),t.get()===o)}o(e.headerSection(),u(m.defaultF,{PH1:i}),0),o(e.defaultSection(),"1",1),o(e.defaultSection(),"2",2),o(e.defaultSection(),"3",3)}appendUserAgentMenuItems(e){const t=this.model.uaSetting();function i(i,o){e.defaultSection().appendCheckboxItem(i,t.set.bind(t,o),t.get()===o)}i(r.DeviceModeModel.UA.Mobile,r.DeviceModeModel.UA.Mobile),i(r.DeviceModeModel.UA.MobileNoTouch,r.DeviceModeModel.UA.MobileNoTouch),i(r.DeviceModeModel.UA.Desktop,r.DeviceModeModel.UA.Desktop),i(r.DeviceModeModel.UA.DesktopTouch,r.DeviceModeModel.UA.DesktopTouch)}appendOptionsMenuItems(e){const i=this.model;function o(e,t,o,s,n){void 0===n&&(n=i.type()===r.DeviceModeModel.Type.None),e.appendItem(t.get()?o:s,t.set.bind(t,!t.get()),n)}o(e.headerSection(),this.deviceOutlineSetting,u(m.hideDeviceFrame),u(m.showDeviceFrame),i.type()!==r.DeviceModeModel.Type.Device),o(e.headerSection(),this.showMediaInspectorSetting,u(m.hideMediaQueries),u(m.showMediaQueries)),o(e.headerSection(),this.showRulersSetting,u(m.hideRulers),u(m.showRulers)),o(e.defaultSection(),this.showDeviceScaleFactorSetting,u(m.removeDevicePixelRatio),u(m.addDevicePixelRatio)),o(e.defaultSection(),this.showUserAgentTypeSetting,u(m.removeDeviceType),u(m.addDeviceType)),e.appendItemsAtLocation("deviceModeMenu"),e.footerSection().appendItem(u(m.resetToDefaults),this.reset.bind(this)),e.footerSection().appendItem(u(m.closeDevtools),t.InspectorFrontendHost.InspectorFrontendHostInstance.closeWindow.bind(t.InspectorFrontendHost.InspectorFrontendHostInstance))}reset(){this.deviceOutlineSetting.set(!1),this.showDeviceScaleFactorSetting.set(!1),this.showUserAgentTypeSetting.set(!1),this.showMediaInspectorSetting.set(!1),this.showRulersSetting.set(!1),this.model.reset()}wrapToolbarItem(e){const t=document.createElement("div");return i.Utils.createShadowRootWithCoreStyles(t,{cssFile:h,delegatesFocus:void 0}).appendChild(e),new i.Toolbar.ToolbarItem(t)}emulateDevice(e){const t=this.autoAdjustScaleSetting.get()?void 0:this.model.scaleSetting().get();this.model.emulate(r.DeviceModeModel.Type.Device,e,this.lastMode.get(e)||e.modes[0],t)}switchToResponsive(){this.model.emulate(r.DeviceModeModel.Type.Responsive,null,null)}filterDevices(e){return(e=e.filter((function(e){return e.show()}))).sort(r.EmulatedDevices.EmulatedDevice.deviceComparator),e}standardDevices(){return this.filterDevices(this.emulatedDevicesList.standard())}customDevices(){return this.filterDevices(this.emulatedDevicesList.custom())}allDevices(){return this.standardDevices().concat(this.customDevices())}appendDeviceMenuItems(e){function t(t){if(!t.length)return;const i=e.section();for(const e of t)i.appendCheckboxItem(e.title,this.emulateDevice.bind(this,e),this.model.device()===e,!1)}e.headerSection().appendCheckboxItem(u(m.responsive),this.switchToResponsive.bind(this),this.model.type()===r.DeviceModeModel.Type.Responsive,!1),t.call(this,this.standardDevices()),t.call(this,this.customDevices()),e.footerSection().appendItem(u(m.edit),this.emulatedDevicesList.revealCustomSetting.bind(this.emulatedDevicesList),!1)}deviceListChanged(){const e=this.model.device();if(!e)return;const t=this.allDevices();-1===t.indexOf(e)?t.length?this.emulateDevice(t[0]):this.model.emulate(r.DeviceModeModel.Type.Responsive,null,null):this.emulateDevice(e)}updateDeviceScaleFactorVisibility(){this.deviceScaleItem&&this.deviceScaleItem.setVisible(this.showDeviceScaleFactorSetting.get())}updateUserAgentTypeVisibility(){this.uaItem&&this.uaItem.setVisible(this.showUserAgentTypeSetting.get())}spanClicked(){const e=this.model.device();if(!e||!e.isDualScreen)return;const t=this.autoAdjustScaleSetting.get()?void 0:this.model.scaleSetting().get(),i=this.model.mode();if(!i)return;const o=e.getSpanPartner(i);o&&this.model.emulate(this.model.type(),e,o,t)}modeMenuClicked(e){const t=this.model.device(),o=this.model,s=this.autoAdjustScaleSetting;if(o.type()===r.DeviceModeModel.Type.Responsive){const e=o.appliedDeviceSize();return void(s.get()?o.setSizeAndScaleToFit(e.height,e.width):(o.setWidth(e.height),o.setHeight(e.width)))}if(!t)return;if((t.isDualScreen||2===t.modes.length)&&t.modes[0].orientation!==t.modes[1].orientation){const e=s.get()?void 0:o.scaleSetting().get(),i=o.mode();if(!i)return;const r=t.getRotationPartner(i);if(!r)return;return void o.emulate(o.type(),o.device(),r,e)}if(!this.modeButton)return;const n=new i.ContextMenu.ContextMenu(e.data,{useSoftMenu:!1,x:this.modeButton.element.totalOffsetLeft(),y:this.modeButton.element.totalOffsetTop()+this.modeButton.element.offsetHeight});function a(e,i){if(!t)return;const o=t.modesForOrientation(e);if(o.length)if(1===o.length)d(o[0],i);else for(let e=0;e=2),g(this.modeButton,u(2===t?m.rotate:m.screenOrientationOptions))}this.cachedModelDevice=e}if(this.experimentDualScreenSupport&&this.experimentalButton){const e=this.model.device();e&&e.isDualScreen?(this.spanButton.setVisible(!0),this.experimentalButton.setVisible(!0)):(this.spanButton.setVisible(!1),this.experimentalButton.setVisible(!1)),g(this.spanButton,u(m.toggleDualscreenMode))}if(this.model.type()===r.DeviceModeModel.Type.Device&&this.lastMode.set(this.model.device(),this.model.mode()),this.model.mode()!==this.cachedModelMode&&this.model.type()!==r.DeviceModeModel.Type.None){this.cachedModelMode=this.model.mode();const e=this.persistenceSetting.get(),t=this.model.device();if(t){e.device=t.title;const i=this.model.mode();e.orientation=i?i.orientation:"",e.mode=i?i.title:""}else e.device="",e.orientation="",e.mode="";this.persistenceSetting.set(e)}}restore(){for(const e of this.allDevices())if(e.title===this.persistenceSetting.get().device)for(const t of e.modes)if(t.orientation===this.persistenceSetting.get().orientation&&t.title===this.persistenceSetting.get().mode)return this.lastMode.set(e,t),void this.emulateDevice(e);this.model.emulate(r.DeviceModeModel.Type.Responsive,null,null)}}var b=Object.freeze({__proto__:null,DeviceModeToolbar:v}),S={cssContent:".media-inspector-view{height:50px;--override-min-width-media-query-selector-background-color:rgb(255 204 128);--override-min-width-media-query-selector-background-color-inactive:rgb(255 243 224);--override-min-width-media-query-selector-marker-color:rgb(245 122 0);--override-min-and-max-width-media-query-selector-background-color:rgb(196 224 163);--override-min-and-max-width-media-query-selector-background-color-inactive:rgb(234 246 235);--override-min-and-max-width-media-query-selector-marker-color:rgb(104 159 56);--override-max-width-media-query-selector-background-color:rgb(144 202 249);--override-max-width-media-query-selector-background-color-inactive:rgb(225 245 254);--override-max-width-media-query-selector-marker-color:rgb(66 165 245)}.-theme-with-dark-background .media-inspector-view,:host-context(.-theme-with-dark-background) .media-inspector-view{--override-min-width-media-query-selector-background-color:rgb(127 76 0);--override-min-width-media-query-selector-background-color-inactive:rgb(31 19 0);--override-min-width-media-query-selector-marker-color:rgb(255 132 10);--override-min-and-max-width-media-query-selector-background-color:rgb(64 92 31);--override-min-and-max-width-media-query-selector-background-color-inactive:rgb(9 21 10);--override-min-and-max-width-media-query-selector-marker-color:rgb(144 199 96);--override-max-width-media-query-selector-background-color:rgb(6 64 111);--override-max-width-media-query-selector-background-color-inactive:rgb(1 21 30);--override-max-width-media-query-selector-marker-color:rgb(10 109 189)}.media-inspector-marker-container{height:14px;margin:2px 0;position:relative}.media-inspector-bar{display:flex;flex-direction:row;align-items:stretch;pointer-events:none;position:absolute;left:0;right:0;top:0;bottom:0}.media-inspector-marker{flex:none;pointer-events:auto;margin:1px 0;white-space:nowrap;z-index:auto;position:relative}.media-inspector-marker-spacer{flex:auto}.media-inspector-marker:hover{margin:-1px 0;opacity:100%}.media-inspector-marker-min-width{flex:auto;background-color:var(--override-min-width-media-query-selector-background-color);border-right:2px solid var(--override-min-width-media-query-selector-marker-color);border-left:2px solid var(--override-min-width-media-query-selector-marker-color)}.media-inspector-marker-min-width-right{border-left:2px solid var(--override-min-width-media-query-selector-marker-color)}.media-inspector-marker-min-width-left{border-right:2px solid var(--override-min-width-media-query-selector-marker-color)}.media-inspector-marker-min-max-width{background-color:var(--override-min-and-max-width-media-query-selector-background-color);border-left:2px solid var(--override-min-and-max-width-media-query-selector-marker-color);border-right:2px solid var(--override-min-and-max-width-media-query-selector-marker-color)}.media-inspector-marker-min-max-width:hover{z-index:1}.media-inspector-marker-max-width{background-color:var(--override-max-width-media-query-selector-background-color);border-right:2px solid var(--override-max-width-media-query-selector-marker-color);border-left:2px solid var(--override-max-width-media-query-selector-marker-color)}.media-inspector-marker-inactive .media-inspector-marker-min-width:not(:hover){background-color:var(--override-min-width-media-query-selector-background-color-inactive)}.media-inspector-marker-inactive .media-inspector-marker-min-max-width:not(:hover){background-color:var(--override-min-and-max-width-media-query-selector-background-color-inactive)}.media-inspector-marker-inactive .media-inspector-marker-max-width:not(:hover){background-color:var(--override-max-width-media-query-selector-background-color-inactive)}.media-inspector-marker-label-container{position:absolute;z-index:1}.media-inspector-marker:not(:hover) .media-inspector-marker-label-container{display:none}.media-inspector-marker-label-container-left{left:-2px}.media-inspector-marker-label-container-right{right:-2px}.media-inspector-marker-label{color:var(--color-text-primary);position:absolute;top:1px;bottom:0;font-size:12px;pointer-events:none}.media-inspector-label-right{right:4px}.media-inspector-label-left{left:4px}"};const w={revealInSourceCode:"Reveal in source code"},M=n.i18n.registerUIStrings("panels/emulation/MediaQueryInspector.ts",w),f=n.i18n.getLocalizedString.bind(void 0,M);class x extends i.Widget.Widget{mediaThrottler;getWidthCallback;setWidthCallback;scale;elementsToMediaQueryModel;elementsToCSSLocations;cssModel;cachedQueryModels;constructor(t,o){super(!0),this.registerRequiredCSS(S),this.contentElement.classList.add("media-inspector-view"),this.contentElement.addEventListener("click",this.onMediaQueryClicked.bind(this),!1),this.contentElement.addEventListener("contextmenu",this.onContextMenu.bind(this),!1),this.mediaThrottler=new e.Throttler.Throttler(0),this.getWidthCallback=t,this.setWidthCallback=o,this.scale=1,this.elementsToMediaQueryModel=new WeakMap,this.elementsToCSSLocations=new WeakMap,s.TargetManager.TargetManager.instance().observeModels(s.CSSModel.CSSModel,this),i.ZoomManager.ZoomManager.instance().addEventListener("ZoomChanged",this.renderMediaQueries.bind(this),this)}modelAdded(e){this.cssModel||(this.cssModel=e,this.cssModel.addEventListener(s.CSSModel.Events.StyleSheetAdded,this.scheduleMediaQueriesUpdate,this),this.cssModel.addEventListener(s.CSSModel.Events.StyleSheetRemoved,this.scheduleMediaQueriesUpdate,this),this.cssModel.addEventListener(s.CSSModel.Events.StyleSheetChanged,this.scheduleMediaQueriesUpdate,this),this.cssModel.addEventListener(s.CSSModel.Events.MediaQueryResultChanged,this.scheduleMediaQueriesUpdate,this))}modelRemoved(e){e===this.cssModel&&(this.cssModel.removeEventListener(s.CSSModel.Events.StyleSheetAdded,this.scheduleMediaQueriesUpdate,this),this.cssModel.removeEventListener(s.CSSModel.Events.StyleSheetRemoved,this.scheduleMediaQueriesUpdate,this),this.cssModel.removeEventListener(s.CSSModel.Events.StyleSheetChanged,this.scheduleMediaQueriesUpdate,this),this.cssModel.removeEventListener(s.CSSModel.Events.MediaQueryResultChanged,this.scheduleMediaQueriesUpdate,this),delete this.cssModel)}setAxisTransform(e){Math.abs(this.scale-e)<1e-8||(this.scale=e,this.renderMediaQueries())}onMediaQueryClicked(e){const t=e.target.enclosingNodeOrSelfWithClass("media-inspector-bar");if(!t)return;const i=this.elementsToMediaQueryModel.get(t);if(!i)return;const o=i.maxWidthExpression(),s=i.minWidthExpression();if(0===i.section())return void this.setWidthCallback(o&&o.computedLength()||0);if(2===i.section())return void this.setWidthCallback(s&&s.computedLength()||0);const r=this.getWidthCallback();s&&r!==s.computedLength()?this.setWidthCallback(s.computedLength()||0):this.setWidthCallback(o&&o.computedLength()||0)}onContextMenu(e){if(!this.cssModel||!this.cssModel.isEnabled())return;const t=e.target.enclosingNodeOrSelfWithClass("media-inspector-bar");if(!t)return;const o=this.elementsToCSSLocations.get(t)||[],s=new Map;for(let e=0;er&&(s=t,r=d)}return r>o||!i&&!s?null:new I(e,s,i,t.active())}equals(e){return 0===this.compareTo(e)}dimensionsEqual(e){const t=this.minWidthExpression(),i=e.minWidthExpression(),o=this.maxWidthExpression(),s=e.maxWidthExpression(),r=this.section()===e.section(),n=!t||t.computedLength()===i?.computedLength(),a=!o||o.computedLength()===s?.computedLength();return r&&n&&a}compareTo(e){if(this.section()!==e.section())return this.section()-e.section();if(this.dimensionsEqual(e)){const t=this.rawLocation(),i=e.rawLocation();return t||i?t&&!i?1:!t&&i?-1:this.active()!==e.active()?this.active()?-1:1:t&&i?a.StringUtilities.compare(t.url,i.url)||t.lineNumber-i.lineNumber||t.columnNumber-i.columnNumber:0:a.StringUtilities.compare(this.mediaText(),e.mediaText())}const t=this.maxWidthExpression(),i=e.maxWidthExpression(),o=t&&t.computedLength()||0,s=i&&i.computedLength()||0,r=this.minWidthExpression(),n=e.minWidthExpression(),d=r&&r.computedLength()||0,l=n&&n.computedLength()||0;return 0===this.section()?s-o:2===this.section()?d-l:d-l||s-o}section(){return this.sectionInternal}mediaText(){return this.cssMedia.text||""}rawLocation(){return this.rawLocationInternal||(this.rawLocationInternal=this.cssMedia.rawLocation()),this.rawLocationInternal}minWidthExpression(){return this.minWidthExpressionInternal}maxWidthExpression(){return this.maxWidthExpressionInternal}active(){return this.activeInternal}}var k=Object.freeze({__proto__:null,MediaQueryInspector:x,MediaQueryUIModel:I}),y={cssContent:":host{overflow:hidden;align-items:stretch;flex:auto;background-color:var(--color-background-elevation-0)}.device-mode-toolbar{flex:none;background-color:var(--color-background-elevation-0);border-bottom:1px solid var(--color-details-hairline);display:flex;flex-direction:row;align-items:stretch}.device-mode-toolbar .toolbar{overflow:hidden;flex:0 100000 auto;padding:0 5px}.device-mode-toolbar .toolbar.device-mode-toolbar-fixed-size{flex:0 1 auto}.device-mode-toolbar-options.toolbar{position:sticky;right:0;flex:none}.device-mode-toolbar-spacer{flex:1 1 0;display:flex;flex-direction:row;overflow:hidden}.device-mode-content-clip{overflow:hidden;flex:auto}.device-mode-media-container{flex:none;overflow:hidden;box-shadow:inset 0 -1px var(--color-details-hairline)}.device-mode-content-clip:not(.device-mode-outline-visible) .device-mode-media-container{margin-bottom:20px}.device-mode-presets-container{flex:0 0 20px;display:flex}.device-mode-presets-container-inner{flex:auto;justify-content:center;position:relative;background-color:var(--color-background-elevation-2);border:2px solid var(--color-background-elevation-0);border-bottom:2px solid var(--color-background-elevation-0)}.device-mode-presets-container:hover{transition:opacity .1s;transition-delay:50ms;opacity:100%}.device-mode-preset-bar-outer{pointer-events:none;display:flex;justify-content:center}.device-mode-preset-bar{border-left:2px solid var(--color-background-elevation-0);border-right:2px solid var(--color-background-elevation-0);pointer-events:auto;text-align:center;flex:none;cursor:pointer;color:var(--color-text-primary);display:flex;align-items:center;justify-content:center;white-space:nowrap;margin-bottom:1px}.device-mode-preset-bar:hover{transition:background-color .1s;transition-delay:50ms;background-color:var(--color-background-highlight)}.device-mode-preset-bar>span{visibility:hidden}.device-mode-preset-bar:hover>span{transition:visibility .1s;transition-delay:50ms;visibility:visible}.device-mode-content-area{flex:auto;position:relative;margin:0}.device-mode-screen-area{position:absolute;left:0;right:0;width:0;height:0;background-color:var(--color-background-inverted)}.device-mode-content-clip:not(.device-mode-outline-visible) .device-mode-screen-area{--override-screen-area-box-shadow:hsl(240deg 3% 84%) 0 0 0 0.5px,hsl(0deg 0% 80% / 40%) 0 0 20px;box-shadow:var(--override-screen-area-box-shadow)}.-theme-with-dark-background .device-mode-content-clip:not(.device-mode-outline-visible) .device-mode-screen-area,:host-context(.-theme-with-dark-background) .device-mode-content-clip:not(.device-mode-outline-visible) .device-mode-screen-area{--override-screen-area-box-shadow:rgb(40 40 42) 0 0 0 0.5px,rgb(51 51 51 / 40%) 0 0 20px}.device-mode-screen-image{position:absolute;left:0;top:0;width:100%;height:100%}.device-mode-resizer{position:absolute;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:background-color .1s ease,opacity .1s ease}.device-mode-resizer:hover{background-color:var(--color-background-elevation-2);opacity:100%}.device-mode-resizer>div{pointer-events:none}.device-mode-right-resizer{top:0;bottom:-1px;right:-20px;width:20px}.device-mode-left-resizer{top:0;bottom:-1px;left:-20px;width:20px;opacity:0%}.device-mode-bottom-resizer{left:0;right:-1px;bottom:-20px;height:20px}.device-mode-bottom-right-resizer{left:0;top:0;right:-20px;bottom:-20px;background-color:var(--color-background-elevation-1)}.device-mode-bottom-left-resizer{left:-20px;top:0;right:0;bottom:-20px;opacity:0%}.device-mode-right-resizer>div{content:var(--image-file-resizeHorizontal);width:6px;height:26px}.device-mode-left-resizer>div{content:var(--image-file-resizeHorizontal);width:6px;height:26px}.device-mode-bottom-resizer>div{content:var(--image-file-resizeVertical);margin-bottom:-2px;width:26px;height:6px}.device-mode-bottom-right-resizer>div{position:absolute;bottom:3px;right:3px;width:13px;height:13px;content:var(--image-file-resizeDiagonal)}.device-mode-bottom-left-resizer>div{position:absolute;bottom:3px;left:3px;width:13px;height:13px;content:var(--image-file-resizeDiagonal);transform:rotate(90deg)}.device-mode-page-area{position:absolute;left:0;right:0;width:0;height:0;display:flex;background-color:var(--color-background-elevation-0)}.device-mode-ruler{position:absolute;overflow:visible}.device-mode-ruler-top{height:20px;right:0}.device-mode-ruler-left{width:20px;bottom:0}.device-mode-ruler-content{pointer-events:none;position:absolute;left:-20px;top:-20px;--override-device-ruler-border-color:hsl(0deg 0% 50%)}.device-mode-ruler-top .device-mode-ruler-content{border-top:1px solid transparent;right:0;bottom:20px;background-color:var(--color-background-opacity-80)}.device-mode-ruler-left .device-mode-ruler-content{border-left:1px solid transparent;border-top:1px solid transparent;right:20px;bottom:0}.-theme-with-dark-background .device-mode-ruler-content,:host-context(.-theme-with-dark-background) .device-mode-ruler-content{--override-device-ruler-border-color:rgb(127 127 127)}.device-mode-content-clip.device-mode-outline-visible .device-mode-ruler-top .device-mode-ruler-content{border-top:1px solid var(--override-device-ruler-border-color)}.device-mode-content-clip.device-mode-outline-visible .device-mode-ruler-left .device-mode-ruler-content{border-left:1px solid var(--override-device-ruler-border-color);border-top:1px solid var(--override-device-ruler-border-color)}.device-mode-ruler-inner{position:absolute}.device-mode-ruler-top .device-mode-ruler-inner{top:0;bottom:0;left:20px;right:0;border-bottom:1px solid var(--override-device-ruler-border-color)}.device-mode-ruler-left .device-mode-ruler-inner{left:0;right:0;top:19px;bottom:0;border-right:1px solid var(--override-device-ruler-border-color);background-color:var(--color-background-opacity-80)}.device-mode-ruler-marker{position:absolute}.device-mode-ruler-top .device-mode-ruler-marker{width:0;height:5px;bottom:0;border-right:1px solid var(--override-device-ruler-border-color);margin-right:-1px}.device-mode-ruler-top .device-mode-ruler-marker.device-mode-ruler-marker-medium{height:10px}.device-mode-ruler-top .device-mode-ruler-marker.device-mode-ruler-marker-large{height:15px}.device-mode-ruler-left .device-mode-ruler-marker{height:0;width:5px;right:0;border-bottom:1px solid var(--override-device-ruler-border-color);margin-bottom:-1px}.device-mode-ruler-left .device-mode-ruler-marker.device-mode-ruler-marker-medium{width:10px}.device-mode-ruler-left .device-mode-ruler-marker.device-mode-ruler-marker-large{width:15px}.device-mode-ruler-text{color:var(--color-text-secondary);position:relative;pointer-events:auto}.device-mode-ruler-text:hover{color:var(--color-text-primary)}.device-mode-ruler-top .device-mode-ruler-text{left:2px;top:-2px}.device-mode-ruler-left .device-mode-ruler-text{left:-4px;top:-15px;transform:rotate(270deg)}"};const T={doubleclickForFullHeight:"Double-click for full height",mobileS:"Mobile S",mobileM:"Mobile M",mobileL:"Mobile L",tablet:"Tablet",laptop:"Laptop",laptopL:"Laptop L"},C=n.i18n.registerUIStrings("panels/emulation/DeviceModeView.ts",T),E=n.i18n.getLocalizedString.bind(void 0,C);class D extends i.Widget.VBox{wrapperInstance;blockElementToWidth;model;mediaInspector;showMediaInspectorSetting;showRulersSetting;topRuler;leftRuler;presetBlocks;responsivePresetsContainer;screenArea;pageArea;outlineImage;contentClip;contentArea;rightResizerElement;leftResizerElement;bottomResizerElement;bottomRightResizerElement;bottomLeftResizerElement;cachedResizable;mediaInspectorContainer;screenImage;toolbar;slowPositionStart;resizeStart;cachedCssScreenRect;cachedCssVisiblePageRect;cachedOutlineRect;cachedMediaInspectorVisible;cachedShowRulers;cachedScale;handleWidth;handleHeight;constructor(){super(!0),this.blockElementToWidth=new WeakMap,this.setMinimumSize(150,150),this.element.classList.add("device-mode-view"),this.registerRequiredCSS(y),this.model=r.DeviceModeModel.DeviceModeModel.instance(),this.model.addEventListener("Updated",this.updateUI,this),this.mediaInspector=new x((()=>this.model.appliedDeviceSize().width),this.model.setWidth.bind(this.model)),this.showMediaInspectorSetting=e.Settings.Settings.instance().moduleSetting("showMediaQueryInspector"),this.showMediaInspectorSetting.addChangeListener(this.updateUI,this),this.showRulersSetting=e.Settings.Settings.instance().moduleSetting("emulation.showRulers"),this.showRulersSetting.addChangeListener(this.updateUI,this),this.topRuler=new R(!0,this.model.setWidthAndScaleToFit.bind(this.model)),this.topRuler.element.classList.add("device-mode-ruler-top"),this.leftRuler=new R(!1,this.model.setHeightAndScaleToFit.bind(this.model)),this.leftRuler.element.classList.add("device-mode-ruler-left"),this.createUI(),i.ZoomManager.ZoomManager.instance().addEventListener("ZoomChanged",this.zoomChanged,this)}createUI(){this.toolbar=new v(this.model,this.showMediaInspectorSetting,this.showRulersSetting),this.contentElement.appendChild(this.toolbar.element()),this.contentClip=this.contentElement.createChild("div","device-mode-content-clip vbox"),this.responsivePresetsContainer=this.contentClip.createChild("div","device-mode-presets-container"),this.populatePresetsContainer(),this.mediaInspectorContainer=this.contentClip.createChild("div","device-mode-media-container"),this.contentArea=this.contentClip.createChild("div","device-mode-content-area"),this.outlineImage=this.contentArea.createChild("img","device-mode-outline-image hidden fill"),this.outlineImage.addEventListener("load",this.onImageLoaded.bind(this,this.outlineImage,!0),!1),this.outlineImage.addEventListener("error",this.onImageLoaded.bind(this,this.outlineImage,!1),!1),this.screenArea=this.contentArea.createChild("div","device-mode-screen-area"),this.screenImage=this.screenArea.createChild("img","device-mode-screen-image hidden"),this.screenImage.addEventListener("load",this.onImageLoaded.bind(this,this.screenImage,!0),!1),this.screenImage.addEventListener("error",this.onImageLoaded.bind(this,this.screenImage,!1),!1),this.bottomRightResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-bottom-right-resizer"),this.bottomRightResizerElement.createChild("div",""),this.createResizer(this.bottomRightResizerElement,2,1),this.bottomLeftResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-bottom-left-resizer"),this.bottomLeftResizerElement.createChild("div",""),this.createResizer(this.bottomLeftResizerElement,-2,1),this.rightResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-right-resizer"),this.rightResizerElement.createChild("div",""),this.createResizer(this.rightResizerElement,2,0),this.leftResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-left-resizer"),this.leftResizerElement.createChild("div",""),this.createResizer(this.leftResizerElement,-2,0),this.bottomResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-bottom-resizer"),this.bottomResizerElement.createChild("div",""),this.createResizer(this.bottomResizerElement,0,1),this.bottomResizerElement.addEventListener("dblclick",this.model.setHeight.bind(this.model,0),!1),i.Tooltip.Tooltip.install(this.bottomResizerElement,E(T.doubleclickForFullHeight)),this.pageArea=this.screenArea.createChild("div","device-mode-page-area"),this.pageArea.createChild("slot")}populatePresetsContainer(){const e=[320,375,425,768,1024,1440,2560],t=[E(T.mobileS),E(T.mobileM),E(T.mobileL),E(T.tablet),E(T.laptop),E(T.laptopL),"4K"];this.presetBlocks=[];const i=this.responsivePresetsContainer.createChild("div","device-mode-presets-container-inner");for(let s=e.length-1;s>=0;--s){const r=i.createChild("div","fill device-mode-preset-bar-outer").createChild("div","device-mode-preset-bar");r.createChild("span").textContent=t[s]+" – "+e[s]+"px",r.addEventListener("click",o.bind(this,e[s]),!1),this.blockElementToWidth.set(r,e[s]),this.presetBlocks.push(r)}function o(e,t){this.model.emulate(r.DeviceModeModel.Type.Responsive,null,null),this.model.setWidthAndScaleToFit(e),t.consume()}}createResizer(e,t,o){const s=new i.ResizerWidget.ResizerWidget;s.addElement(e);let r=t?"ew-resize":"ns-resize";return t*o>0&&(r="nwse-resize"),t*o<0&&(r="nesw-resize"),s.setCursor(r),s.addEventListener(i.ResizerWidget.Events.ResizeStart,this.onResizeStart,this),s.addEventListener(i.ResizerWidget.Events.ResizeUpdateXY,this.onResizeUpdate.bind(this,t,o)),s.addEventListener(i.ResizerWidget.Events.ResizeEnd,this.onResizeEnd,this),s}onResizeStart(){this.slowPositionStart=null;const e=this.model.screenRect();this.resizeStart=new i.Geometry.Size(e.width,e.height)}onResizeUpdate(e,t,o){o.data.shiftKey!==Boolean(this.slowPositionStart)&&(this.slowPositionStart=o.data.shiftKey?{x:o.data.currentX,y:o.data.currentY}:null);let s=o.data.currentX-o.data.startX,n=o.data.currentY-o.data.startY;if(this.slowPositionStart&&(s=(o.data.currentX-this.slowPositionStart.x)/10+this.slowPositionStart.x-o.data.startX,n=(o.data.currentY-this.slowPositionStart.y)/10+this.slowPositionStart.y-o.data.startY),e&&this.resizeStart){const t=s*i.ZoomManager.ZoomManager.instance().zoomFactor();let o=this.resizeStart.width+t*e;o=Math.round(o/this.model.scale()),o>=r.DeviceModeModel.MinDeviceSize&&o<=r.DeviceModeModel.MaxDeviceSize&&this.model.setWidth(o)}if(t&&this.resizeStart){const e=n*i.ZoomManager.ZoomManager.instance().zoomFactor();let o=this.resizeStart.height+e*t;o=Math.round(o/this.model.scale()),o>=r.DeviceModeModel.MinDeviceSize&&o<=r.DeviceModeModel.MaxDeviceSize&&this.model.setHeight(o)}}exitHingeMode(){this.model&&this.model.exitHingeMode()}onResizeEnd(){delete this.resizeStart,t.userMetrics.actionTaken(t.UserMetrics.Action.ResizedViewInResponsiveMode)}updateUI(){function e(e,t){e.style.left=t.left+"px",e.style.top=t.top+"px",e.style.width=t.width+"px",e.style.height=t.height+"px"}if(!this.isShowing())return;const t=i.ZoomManager.ZoomManager.instance().zoomFactor();let o=!1;const s=this.showRulersSetting.get()&&this.model.type()!==r.DeviceModeModel.Type.None;let n=!1,a=!1;const d=this.model.screenRect().scale(1/t);this.cachedCssScreenRect&&d.isEqual(this.cachedCssScreenRect)||(e(this.screenArea,d),a=!0,o=!0,this.cachedCssScreenRect=d);const l=this.model.visiblePageRect().scale(1/t);this.cachedCssVisiblePageRect&&l.isEqual(this.cachedCssVisiblePageRect)||(e(this.pageArea,l),o=!0,this.cachedCssVisiblePageRect=l);const c=this.model.outlineRect();if(c){const i=c.scale(1/t);this.cachedOutlineRect&&i.isEqual(this.cachedOutlineRect)||(e(this.outlineImage,i),o=!0,this.cachedOutlineRect=i)}this.contentClip.classList.toggle("device-mode-outline-visible",Boolean(this.model.outlineImage()));const h=this.model.type()===r.DeviceModeModel.Type.Responsive;h!==this.cachedResizable&&(this.rightResizerElement.classList.toggle("hidden",!h),this.leftResizerElement.classList.toggle("hidden",!h),this.bottomResizerElement.classList.toggle("hidden",!h),this.bottomRightResizerElement.classList.toggle("hidden",!h),this.bottomLeftResizerElement.classList.toggle("hidden",!h),this.cachedResizable=h);const m=this.showMediaInspectorSetting.get()&&this.model.type()!==r.DeviceModeModel.Type.None;if(m!==this.cachedMediaInspectorVisible&&(m?this.mediaInspector.show(this.mediaInspectorContainer):this.mediaInspector.detach(),n=!0,o=!0,this.cachedMediaInspectorVisible=m),s!==this.cachedShowRulers&&(this.contentClip.classList.toggle("device-mode-rulers-visible",s),s?(this.topRuler.show(this.contentArea),this.leftRuler.show(this.contentArea)):(this.topRuler.detach(),this.leftRuler.detach()),n=!0,o=!0,this.cachedShowRulers=s),this.model.scale()!==this.cachedScale){a=!0,o=!0;for(const e of this.presetBlocks){const t=this.blockElementToWidth.get(e);if(!t)throw new Error("Could not get width for block.");e.style.width=t*this.model.scale()+"px"}this.cachedScale=this.model.scale()}this.toolbar.update(),this.loadImage(this.screenImage,this.model.screenImage()),this.loadImage(this.outlineImage,this.model.outlineImage()),this.mediaInspector.setAxisTransform(this.model.scale()),o&&this.doResize(),a&&(this.topRuler.render(this.model.scale()),this.leftRuler.render(this.model.scale()),this.topRuler.element.positionAt(this.cachedCssScreenRect?this.cachedCssScreenRect.left:0,this.cachedCssScreenRect?this.cachedCssScreenRect.top:0),this.leftRuler.element.positionAt(this.cachedCssScreenRect?this.cachedCssScreenRect.left:0,this.cachedCssScreenRect?this.cachedCssScreenRect.top:0)),n&&this.contentAreaResized()}loadImage(e,t){e.getAttribute("srcset")!==t&&(e.setAttribute("srcset",t),t||e.classList.toggle("hidden",!0))}onImageLoaded(e,t){e.classList.toggle("hidden",!t)}setNonEmulatedAvailableSize(e){if(this.model.type()!==r.DeviceModeModel.Type.None)return;const t=i.ZoomManager.ZoomManager.instance().zoomFactor(),o=e.getBoundingClientRect(),s=new i.Geometry.Size(Math.max(o.width*t,1),Math.max(o.height*t,1));this.model.setAvailableSize(s,s)}contentAreaResized(){const e=i.ZoomManager.ZoomManager.instance().zoomFactor(),t=this.contentArea.getBoundingClientRect(),o=new i.Geometry.Size(Math.max(t.width*e,1),Math.max(t.height*e,1)),s=new i.Geometry.Size(Math.max((t.width-2*(this.handleWidth||0))*e,1),Math.max((t.height-(this.handleHeight||0))*e,1));this.model.setAvailableSize(o,s)}measureHandles(){const e=this.rightResizerElement.classList.contains("hidden");this.rightResizerElement.classList.toggle("hidden",!1),this.bottomResizerElement.classList.toggle("hidden",!1),this.handleWidth=this.rightResizerElement.offsetWidth,this.handleHeight=this.bottomResizerElement.offsetHeight,this.rightResizerElement.classList.toggle("hidden",e),this.bottomResizerElement.classList.toggle("hidden",e)}zoomChanged(){delete this.handleWidth,delete this.handleHeight,this.isShowing()&&(this.measureHandles(),this.contentAreaResized())}onResize(){this.isShowing()&&this.contentAreaResized()}wasShown(){this.measureHandles(),this.toolbar.restore()}willHide(){this.model.emulate(r.DeviceModeModel.Type.None,null,null)}async captureScreenshot(){const e=await this.model.captureScreenshot(!1);if(null===e)return;const t=new Image;t.src="data:image/png;base64,"+e,t.onload=async()=>{const e=t.naturalWidth/this.model.screenRect().width,i=this.model.outlineRect();if(!i)throw new Error("Unable to take screenshot: no outlineRect available.");const o=i.scale(e),s=this.model.screenRect().scale(e),r=this.model.visiblePageRect().scale(e),n=s.left+r.left-o.left,a=s.top+r.top-o.top,d=document.createElement("canvas");d.width=Math.floor(o.width),d.height=Math.floor(o.height);const l=d.getContext("2d");if(!l)throw new Error("Could not get 2d context from canvas.");l.imageSmoothingEnabled=!1,this.model.outlineImage()&&await this.paintImage(l,this.model.outlineImage(),o.relativeTo(o)),this.model.screenImage()&&await this.paintImage(l,this.model.screenImage(),s.relativeTo(o)),l.drawImage(t,Math.floor(n),Math.floor(a)),this.saveScreenshot(d)}}async captureFullSizeScreenshot(){const e=await this.model.captureScreenshot(!0);if(null!==e)return this.saveScreenshotBase64(e)}async captureAreaScreenshot(e){const t=await this.model.captureScreenshot(!1,e);if(null!==t)return this.saveScreenshotBase64(t)}saveScreenshotBase64(e){const t=new Image;t.src="data:image/png;base64,"+e,t.onload=()=>{const e=document.createElement("canvas");e.width=t.naturalWidth,e.height=t.naturalHeight;const i=e.getContext("2d");if(!i)throw new Error("Could not get 2d context for base64 screenshot.");i.imageSmoothingEnabled=!1,i.drawImage(t,0,0),this.saveScreenshot(e)}}paintImage(e,t,i){return new Promise((o=>{const s=new Image;s.crossOrigin="Anonymous",s.srcset=t,s.onerror=()=>o(),s.onload=()=>{e.drawImage(s,i.left,i.top,i.width,i.height),o()}}))}saveScreenshot(e){const t=this.model.inspectedURL();let i="";if(t){const e=a.StringUtilities.removeURLFragment(t);i=a.StringUtilities.trimURL(e)}const o=this.model.device();o&&this.model.type()===r.DeviceModeModel.Type.Device&&(i+=`(${o.title})`);const s=document.createElement("a");s.download=i+".png",e.toBlob((e=>{null!==e&&(s.href=URL.createObjectURL(e),s.click())}))}}class R extends i.Widget.VBox{contentElementInternal;horizontal;scale;count;throttler;applyCallback;renderedScale;renderedZoomFactor;constructor(t,i){super(),this.element.classList.add("device-mode-ruler"),this.contentElementInternal=this.element.createChild("div","device-mode-ruler-content").createChild("div","device-mode-ruler-inner"),this.horizontal=t,this.scale=1,this.count=0,this.throttler=new e.Throttler.Throttler(0),this.applyCallback=i}render(e){this.scale=e,this.throttler.schedule(this.update.bind(this))}onResize(){this.throttler.schedule(this.update.bind(this))}update(){const e=i.ZoomManager.ZoomManager.instance().zoomFactor(),t=this.horizontal?this.contentElementInternal.offsetWidth:this.contentElementInternal.offsetHeight;this.scale===this.renderedScale&&e===this.renderedZoomFactor||(this.contentElementInternal.removeChildren(),this.count=0,this.renderedScale=this.scale,this.renderedZoomFactor=e);const o=t*e/this.scale,s=Math.ceil(o/5);let r=1;this.scale<.8&&(r=2),this.scale<.6&&(r=4),this.scale<.4&&(r=8),this.scale<.2&&(r=16),this.scale<.1&&(r=32);for(let e=s;es(e))).filter(c);t=t.concat(n)}if(e.internalHandlers&&i(e.internalHandlers)){const t=e.internalHandlers.map((e=>l(e))).filter(c);n=n.concat(t)}}catch(t){e.push("fetcher call produced error: "+a(t))}const o={eventListeners:t,internalHandlers:n.length?n:void 0,errorString:void 0};o.internalHandlers||delete o.internalHandlers;if(e.length){let t="Framework Event Listeners API Errors:\n\t"+e.join("\n\t");t=t.substr(0,t.length-1),o.errorString=t}""!==o.errorString&&void 0!==o.errorString||delete o.errorString;return o;function i(e){if(!e||"object"!=typeof e)return!1;try{if("function"==typeof e.splice){const t=e.length;return"number"==typeof t&&t>>>0===t&&(t>0||1/t>0)}}catch(e){}return!1}function s(t){try{let n="";if(t){const e=t.type;e&&"string"==typeof e||(n+="event listener's type isn't string or empty, ");const r=t.useCapture;"boolean"!=typeof r&&(n+="event listener's useCapture isn't boolean or undefined, ");const o=t.passive;"boolean"!=typeof o&&(n+="event listener's passive isn't boolean or undefined, ");const i=t.once;"boolean"!=typeof i&&(n+="event listener's once isn't boolean or undefined, ");const s=t.handler;s&&"function"==typeof s||(n+="event listener's handler isn't a function or empty, ");const l=t.remove;if(l&&"function"!=typeof l&&(n+="event listener's remove isn't a function, "),!n)return{type:e,useCapture:r,passive:o,once:i,handler:s,remove:l}}else n+="empty event listener, ";return e.push(n.substr(0,n.length-2)),null}catch(t){return e.push(a(t)),null}}function l(t){return t&&"function"==typeof t?t:(e.push("internal handler isn't a function or empty"),null)}function a(e){try{return String(e)}catch(e){return""}}function c(e){return Boolean(e)}function u(e,t,n){if(!(this&&this instanceof Node))return;const r=window.jQuery;if(!r||!r.fn)return;r(this).off(t,e,n)}}),void 0).then(c).then((function(e){return e.getOwnProperties(!1)})).then((async function(n){if(!n.properties)throw new Error("Object properties is empty");const r=[];for(const u of n.properties)"eventListeners"===u.name&&u.value&&r.push(i(u.value).then(l)),"internalHandlers"===u.name&&u.value&&r.push((c=u.value,t.RemoteObject.RemoteArray.objectAsArray(c).map(s).then(t.RemoteObject.RemoteArray.createFromRemoteObjects.bind(null))).then(a)),"errorString"===u.name&&u.value&&(o=u.value,e.Console.Console.instance().error(String(o.value)));var o;var c;await Promise.all(r)})).then((function(){return o})).catch((e=>(console.error(e),o)));function i(e){return t.RemoteObject.RemoteArray.objectAsArray(e).map((function(e){let o,i,l,a,u=null,d=null,h=null,v=null;const p=[];function f(e){h=e?e.location:null}return p.push(e.callFunctionJSON((function(){return{type:this.type,useCapture:this.useCapture,passive:this.passive,once:this.once}}),void 0).then((function(e){void 0!==e.type&&(o=e.type);void 0!==e.useCapture&&(i=e.useCapture);void 0!==e.passive&&(l=e.passive);void 0!==e.once&&(a=e.once)}))),p.push(e.callFunction((function(){return this.handler||null})).then(c).then((function(e){return d=e,d})).then(s).then((function(e){return u=e,e.debuggerModel().functionDetailsPromise(e).then(f)}))),p.push(e.callFunction((function(){return this.remove||null})).then(c).then((function(e){if("function"!==e.type)return;v=e}))),Promise.all(p).then((function(){if(!h)throw new Error("Empty event listener's location");return new t.DOMDebuggerModel.EventListener(r,n,o,i,l,a,u,d,h,v,t.DOMDebuggerModel.EventListener.Origin.FrameworkUser)})).catch((e=>(console.error(e),null)))})).then(u)}function s(e){return t.RemoteObject.RemoteFunction.objectAsFunction(e).targetFunction()}function l(e){o.eventListeners=e}function a(e){o.internalHandlers=e}function c(e){if(e.wasThrown||!e.object)throw new Error("Exception in callFunction or empty result");return e.object}function u(e){return e.filter((function(e){return Boolean(e)}))}}var l=Object.freeze({__proto__:null,frameworkEventListeners:s});const a=new CSSStyleSheet;a.replaceSync(".value.object-value-node:hover{background-color:var(--item-hover-color)}.object-value-boolean,.object-value-function-prefix{color:var(--color-syntax-3)}.object-value-function{font-style:italic}.object-value-function.linkified:hover{--override-linkified-hover-background:rgb(0 0 0 / 10%);background-color:var(--override-linkified-hover-background);cursor:pointer}.-theme-with-dark-background .object-value-function.linkified:hover,:host-context(.-theme-with-dark-background) .object-value-function.linkified:hover{--override-linkified-hover-background:rgb(230 230 230 / 10%)}.object-value-number{color:var(--color-syntax-3)}.object-value-bigint{color:var(--color-syntax-6)}.object-value-regexp,.object-value-string,.object-value-symbol{white-space:pre;unicode-bidi:-webkit-isolate;color:var(--color-syntax-1)}.object-value-node{position:relative;vertical-align:baseline;color:var(--color-syntax-7);display:inline-block}.object-value-with-memory-icon{display:inline-flex}.object-value-arraybuffer devtools-icon,.object-value-dataview devtools-icon,.object-value-typedarray devtools-icon,.object-value-webassemblymemory devtools-icon{cursor:pointer}.object-value-null,.object-value-undefined{color:var(--color-text-disabled)}.object-value-calculate-value-button:hover{text-decoration:underline}.object-properties-section-custom-section{display:inline-flex;flex-direction:column}.-theme-with-dark-background .object-value-boolean,.-theme-with-dark-background .object-value-number,:host-context(.-theme-with-dark-background) .object-value-boolean,:host-context(.-theme-with-dark-background) .object-value-number{--override-primitive-dark-mode-color:hsl(252deg 100% 75%);color:var(--override-primitive-dark-mode-color)}.object-properties-section .object-description{color:var(--color-text-secondary)}.value .object-properties-preview{white-space:nowrap}.name{color:var(--color-syntax-2);flex-shrink:0}.object-properties-preview .name{color:var(--color-text-secondary)}@media (forced-colors:active){.object-value-calculate-value-button:hover{forced-color-adjust:none;color:Highlight}}\n/*# sourceURL=objectValue.css */\n");const c=new CSSStyleSheet;c.replaceSync(".tree-outline-disclosure li{padding:2px 0 0 5px;overflow:hidden;display:flex;min-height:17px;align-items:baseline}.tree-outline-disclosure>li{border-top:1px solid var(--color-background-elevation-0)}.tree-outline-disclosure>li:first-of-type{border-top:none}.tree-outline-disclosure{padding-left:0!important;padding-right:3px}.tree-outline-disclosure li.parent::before{top:0!important}.tree-outline-disclosure .name{color:var(--color-syntax-2)}.tree-outline-disclosure .object-value-node,.tree-outline-disclosure .object-value-object{overflow:hidden;text-overflow:ellipsis}.event-listener-details{display:flex}.event-listener-tree-subtitle{float:right;margin-left:5px;flex-shrink:0}.event-listener-button{padding:0 3px;background-color:var(--color-background-elevation-1);border-radius:3px;border:1px solid var(--color-details-hairline);margin-left:5px;display:block;cursor:pointer;opacity:80%;flex-shrink:0}.event-listener-button:hover{background-color:var(--color-background-elevation-2);opacity:100%}.tree-outline-disclosure li:hover .event-listener-button{display:inline}@media (forced-colors:active){.event-listener-details .event-listener-button{forced-color-adjust:none;opacity:100%;background:ButtonFace;color:ButtonText;border-color:ButtonText}.event-listener-button:hover{background-color:Highlight!important;color:HighlightText;border-color:ButtonText}.tree-outline-disclosure li:focus-visible .gray-info-message,.tree-outline.hide-selection-when-blurred .selected:focus-visible .event-listener-button{background-color:Highlight;color:HighlightText;border-color:HighlightText}}\n/*# sourceURL=eventListenersView.css */\n");const u={noEventListeners:"No event listeners",remove:"Remove",deleteEventListener:"Delete event listener",togglePassive:"Toggle Passive",toggleWhetherEventListenerIs:"Toggle whether event listener is passive or blocking",revealInElementsPanel:"Reveal in Elements panel",passive:"Passive"},d=n.i18n.registerUIStrings("panels/event_listeners/EventListenersView.ts",u),h=n.i18n.getLocalizedString.bind(void 0,d);class v extends i.Widget.VBox{changeCallback;enableDefaultTreeFocus;treeOutline;emptyHolder;linkifier;treeItemMap;constructor(e,t=!1){super(),this.changeCallback=e,this.enableDefaultTreeFocus=t,this.treeOutline=new i.TreeOutline.TreeOutlineInShadow,this.treeOutline.hideOverflow(),this.treeOutline.setComparator(p.comparator),this.treeOutline.element.classList.add("monospace"),this.treeOutline.setShowSelectionOnKeyboardFocus(!0),this.treeOutline.setFocusable(!0),this.element.appendChild(this.treeOutline.element),this.emptyHolder=document.createElement("div"),this.emptyHolder.classList.add("gray-info-message"),this.emptyHolder.textContent=h(u.noEventListeners),this.emptyHolder.tabIndex=-1,this.linkifier=new o.Linkifier.Linkifier,this.treeItemMap=new Map}focus(){this.enableDefaultTreeFocus&&(this.emptyHolder.parentNode?this.emptyHolder.focus():this.treeOutline.forceSelect())}async addObjects(e){this.reset(),await Promise.all(e.map((e=>e?this.addObject(e):Promise.resolve()))),this.addEmptyHolderIfNeeded(),this.eventListenersArrivedForTest()}addObject(e){let n,r=null;const o=[],i=e.runtimeModel().target().model(t.DOMDebuggerModel.DOMDebuggerModel);return i&&o.push(i.eventListeners(e).then((function(e){n=e}))),o.push(s(e).then((function(e){r=e}))),Promise.all(o).then((function(){if(!r)return Promise.resolve();if(!r.internalHandlers)return Promise.resolve();return r.internalHandlers.object().callFunctionJSON((function(){const e=[],t=new Set(this);for(const n of arguments)e.push(t.has(n));return e}),n.map((function(e){return t.RemoteObject.RemoteObject.toCallArgument(e.handler())}))).then((function(e){for(let t=0;tt.title?1:-1}addObjectEventListener(e,t){const n=new f(e,t,this.linkifier,this.changeCallback);this.appendChild(n)}}class f extends i.TreeOutline.TreeElement{eventListenerInternal;editable;changeCallback;valueTitle;constructor(e,t,n,r){super("",!0),this.eventListenerInternal=e,this.editable=!1,this.setTitle(t,n),this.changeCallback=r}async onpopulate(){const e=[],n=this.eventListenerInternal,o=n.domDebuggerModel().runtimeModel();e.push(o.createRemotePropertyFromPrimitiveValue("useCapture",n.useCapture())),e.push(o.createRemotePropertyFromPrimitiveValue("passive",n.passive())),e.push(o.createRemotePropertyFromPrimitiveValue("once",n.once())),void 0!==n.handler()&&e.push(new t.RemoteObject.RemoteObjectProperty("handler",n.handler())),r.ObjectPropertiesSection.ObjectPropertyTreeElement.populateWithProperties(this,e,[],!0,!0,null)}setTitle(t,n){const o=this.listItemElement.createChild("span","event-listener-details"),s=r.ObjectPropertiesSection.ObjectPropertiesSection.createPropertyValue(t,!1,!1);if(this.valueTitle=s.element,o.appendChild(this.valueTitle),this.eventListenerInternal.canRemove()){const e=o.createChild("span","event-listener-button");e.textContent=h(u.remove),i.Tooltip.Tooltip.install(e,h(u.deleteEventListener)),e.addEventListener("click",(e=>{this.removeListener(),e.consume()}),!1),o.appendChild(e)}if(this.eventListenerInternal.isScrollBlockingType()&&this.eventListenerInternal.canTogglePassive()){const e=o.createChild("span","event-listener-button");e.textContent=h(u.togglePassive),i.Tooltip.Tooltip.install(e,h(u.toggleWhetherEventListenerIs)),e.addEventListener("click",(e=>{this.togglePassiveListener(),e.consume()}),!1),o.appendChild(e)}const l=o.createChild("span","event-listener-tree-subtitle"),a=n.linkifyRawLocation(this.eventListenerInternal.location(),this.eventListenerInternal.sourceURL());l.appendChild(a),this.listItemElement.addEventListener("contextmenu",(n=>{const r=new i.ContextMenu.ContextMenu(n);n.target!==a&&r.appendApplicableItems(a),"node"===t.subtype&&r.defaultSection().appendItem(h(u.revealInElementsPanel),(()=>e.Revealer.reveal(t))),r.defaultSection().appendItem(h(u.deleteEventListener),this.removeListener.bind(this),!this.eventListenerInternal.canRemove()),r.defaultSection().appendCheckboxItem(h(u.passive),this.togglePassiveListener.bind(this),this.eventListenerInternal.passive(),!this.eventListenerInternal.canTogglePassive()),r.show()}))}removeListener(){this.removeListenerBar(),this.eventListenerInternal.remove()}togglePassiveListener(){this.eventListenerInternal.togglePassive().then((()=>this.changeCallback()))}removeListenerBar(){const e=this.parent;if(!e)return;e.removeChild(this),e.childCount()||e.collapse();let t=!0;for(const n of e.children())n.hidden||(t=!1);e.hidden=t}eventListener(){return this.eventListenerInternal}onenter(){return!!this.valueTitle&&(this.valueTitle.click(),!0)}ondelete(){return!!this.eventListenerInternal.canRemove()&&(this.removeListener(),!0)}}var m=Object.freeze({__proto__:null,EventListenersView:v,EventListenersTreeElement:p,ObjectEventListenerBar:f});export{l as EventListenersUtils,m as EventListenersView};
diff --git a/chii/panels/help/help-meta.js b/chii/panels/help/help-meta.js
new file mode 100644
index 00000000..e157e661
--- /dev/null
+++ b/chii/panels/help/help-meta.js
@@ -0,0 +1 @@
+import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";const a={whatsNew:"What's New",showWhatsNew:"Show What's New",releaseNotes:"Release notes",reportADevtoolsIssue:"Report a DevTools issue",reportTranslationIssue:"Report a translation issue",bug:"bug",showWhatsNewAfterEachUpdate:"Show What's New after each update",doNotShowWhatsNewAfterEachUpdate:"Do not show What's New after each update"},n=t.i18n.registerUIStrings("panels/help/help-meta.ts",a),i=t.i18n.getLazilyComputedLocalizedString.bind(void 0,n);let s;async function r(){return s||(s=await import("./help.js")),s}o.ViewManager.registerViewExtension({location:"drawer-view",id:"release-note",title:i(a.whatsNew),commandPrompt:i(a.showWhatsNew),persistence:"closeable",order:1,loadView:async()=>(await r()).ReleaseNoteView.ReleaseNoteView.instance()}),o.ActionRegistration.registerActionExtension({category:o.ActionRegistration.ActionCategory.HELP,actionId:"help.release-notes",title:i(a.releaseNotes),loadActionDelegate:async()=>(await r()).Help.ReleaseNotesActionDelegate.instance()}),o.ActionRegistration.registerActionExtension({category:o.ActionRegistration.ActionCategory.HELP,actionId:"help.report-issue",title:i(a.reportADevtoolsIssue),loadActionDelegate:async()=>(await r()).Help.ReportIssueActionDelegate.instance(),tags:[i(a.bug)]}),o.ActionRegistration.registerActionExtension({category:o.ActionRegistration.ActionCategory.HELP,actionId:"help.report-translation-issue",title:i(a.reportTranslationIssue),loadActionDelegate:async()=>(await r()).Help.ReportTranslationIssueActionDelegate.instance(),tags:[i(a.bug)]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.APPEARANCE,storageType:e.Settings.SettingStorageType.Synced,title:i(a.showWhatsNewAfterEachUpdate),settingName:"help.show-release-note",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!0,options:[{value:!0,title:i(a.showWhatsNewAfterEachUpdate)},{value:!1,title:i(a.doNotShowWhatsNewAfterEachUpdate)}]}),o.ContextMenu.registerItem({location:o.ContextMenu.ItemLocation.MAIN_MENU_HELP_DEFAULT,actionId:"help.release-notes",order:10}),o.ContextMenu.registerItem({location:o.ContextMenu.ItemLocation.MAIN_MENU_HELP_DEFAULT,actionId:"help.report-issue",order:11}),o.ContextMenu.registerItem({location:o.ContextMenu.ItemLocation.MAIN_MENU_HELP_DEFAULT,actionId:"help.report-translation-issue",order:12}),e.Runnable.registerLateInitializationRunnable({id:"whats-new",loadRunnable:async()=>(await r()).Help.HelpLateInitialization.instance()});
diff --git a/chii/panels/help/help.js b/chii/panels/help/help.js
new file mode 100644
index 00000000..d6406fe6
--- /dev/null
+++ b/chii/panels/help/help.js
@@ -0,0 +1,1842 @@
+import * as e from '../../core/common/common.js'
+import * as t from '../../core/host/host.js'
+import * as o from '../../ui/legacy/legacy.js'
+import * as s from '../../core/i18n/i18n.js'
+const l = t.Platform.isMac() ? 'Command' : 'Control',
+ i = t.Platform.isMac() ? 'Command+F' : 'Control+F',
+ n = t.Platform.isMac() ? 'Command+Shift+P' : 'Control+Shift+P',
+ r = new Set(['es', 'ja', 'ko', 'pt', 'ru', 'zh'])
+function a(e) {
+ const t = new URL(e),
+ o = (function () {
+ const e = s.DevToolsLocale.DevToolsLocale.instance().locale,
+ t = new Intl.Locale(e)
+ return t.language && r.has(t.language) ? t.language : ''
+ })()
+ return o && (t.pathname = `/${o}${t.pathname}`), t.toString()
+}
+const d = [
+ {
+ version: 39,
+ header: 'Highlights from the Chrome 97 update',
+ highlights: [
+ {
+ title: 'New preview feature: Recorder panel',
+ subtitle:
+ 'Record, replay and measure user flows with options to export to Puppeteer script and more.',
+ link: a(
+ 'https://developer.chrome.com/blog/new-in-devtools-97/#recorder'
+ ),
+ },
+ {
+ title: 'Enhanced "Edit as HTML" with code completion',
+ subtitle:
+ 'Edit as HTML in the Elements panel now supports code completion, syntax highlights and more.',
+ link: a(
+ 'https://developer.chrome.com/blog/new-in-devtools-97/#code-completion'
+ ),
+ },
+ {
+ title: 'Refresh device list in Device Mode',
+ subtitle: 'New devices are added in the device list.',
+ link: a('https://developer.chrome.com/blog/new-in-devtools-97/#device'),
+ },
+ {
+ title: 'Improved code debugging experience',
+ subtitle:
+ 'Include column number in the Console stack trace, improved breakpoints display in the Sources panel and more.',
+ link: a(
+ 'https://developer.chrome.com/blog/new-in-devtools-97/#debugging'
+ ),
+ },
+ ],
+ link: a('https://developer.chrome.com/blog/new-in-devtools-97'),
+ },
+ {
+ version: 38,
+ header: 'Highlights from the Chrome 96 update',
+ highlights: [
+ {
+ title: 'New preview feature: CSS Overview panel',
+ subtitle:
+ 'Use the CSS overview panel to identify CSS improvements on your page.',
+ link: a(
+ 'https://developer.chrome.com/blog/new-in-devtools-96/#css-overview'
+ ),
+ },
+ {
+ title: 'Enable emulating prefers-contrast media and auto dark mode',
+ subtitle:
+ 'Emulate the user preference on using a different contrast mode for the page and Chrome’s auto dark mode.',
+ link: a(
+ 'https://developer.chrome.com/blog/new-in-devtools-96/#emulation'
+ ),
+ },
+ {
+ title: 'New Payload tab in the Network panel',
+ subtitle:
+ 'A new Payload tab is available when you click to inspect a network request.',
+ link: a(
+ 'https://developer.chrome.com/blog/new-in-devtools-96/#payload'
+ ),
+ },
+ {
+ title: 'Option to hide CORS errors in the Console',
+ subtitle:
+ 'Now that CORS errors are reported in the Issues tab, you can hide CORS errors in the Console to reduce clutter.',
+ link: a(
+ 'https://developer.chrome.com/blog/new-in-devtools-96/#hide-cors-errors'
+ ),
+ },
+ ],
+ link: a('https://developer.chrome.com/blog/new-in-devtools-96'),
+ },
+ {
+ version: 37,
+ header: 'Highlights from the Chrome 95 update',
+ highlights: [
+ {
+ title: 'New CSS length authoring tools',
+ subtitle:
+ 'Drag to change the unit value and select unit type from the dropdown in the Styles pane.',
+ link: a('https://developer.chrome.com/blog/new-in-devtools-95/#length'),
+ },
+ {
+ title: 'Hide issues in the Issues tab',
+ subtitle:
+ 'Hide irrelevant issues so you can focus only on those issues that matter to you.',
+ link: a(
+ 'https://developer.chrome.com/blog/new-in-devtools-95/#hide-issues'
+ ),
+ },
+ {
+ title:
+ 'Improved the display of properties in the Properties pane and Sources panel',
+ subtitle:
+ 'Always bold and sort own properties first, flatten the display of properties, and more.',
+ link: a(
+ 'https://developer.chrome.com/blog/new-in-devtools-95/#properties'
+ ),
+ },
+ {
+ title: 'Lighthouse 8.4',
+ subtitle: 'A new audit to detect when the LCP element is lazy-loaded.',
+ link: a(
+ 'https://developer.chrome.com/blog/new-in-devtools-95/#lighthouse'
+ ),
+ },
+ ],
+ link: a('https://developer.chrome.com/blog/new-in-devtools-95'),
+ },
+ {
+ version: 36,
+ header: 'Highlights from the Chrome 94 update',
+ highlights: [
+ {
+ title: 'Change the language of your DevTools',
+ subtitle:
+ 'Chrome DevTools now supports multiple languages, allowing you to work in your preferred language.',
+ link: a(
+ 'https://developer.chrome.com/blog/new-in-devtools-94/#localized'
+ ),
+ },
+ {
+ title: 'New Nest Hub devices in the Device list',
+ subtitle:
+ 'You can now simulate the dimensions of Nest Hub devices in DevTools.',
+ link: a(
+ 'https://developer.chrome.com/blog/new-in-devtools-94/#nest-hub'
+ ),
+ },
+ {
+ title: 'Invert all network filters',
+ subtitle:
+ 'Use the new `invert` checkbox to invert all filters in the Network panel.',
+ link: a(
+ 'https://developer.chrome.com/blog/new-in-devtools-94/#invert-network-filter'
+ ),
+ },
+ {
+ title: 'Upcoming deprecation of the Console sidebar',
+ subtitle:
+ 'The Console sidebar will be removed in favor of moving the filter UI to the toolbar.',
+ link: a(
+ 'https://developer.chrome.com/blog/new-in-devtools-94/#deprecated'
+ ),
+ },
+ ],
+ link: a('https://developer.chrome.com/blog/new-in-devtools-94'),
+ },
+ {
+ version: 35,
+ header: 'Highlights from the Chrome 93 update',
+ highlights: [
+ {
+ title: 'Lighthouse 8.1',
+ subtitle:
+ 'New `csp-xss` audit, performance score weighting changes, and more.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-93/#lighthouse',
+ },
+ {
+ title: 'Editable web container queries in the Styles pane',
+ subtitle: 'View and edit web container queries in the Styles pane.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-93/#container-queries',
+ },
+ {
+ title: 'Web bundle preview in the Network panel',
+ subtitle:
+ 'Click on a web bundle network request to preview the content.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-93/#web-bundle',
+ },
+ {
+ title: 'Attribution Reporting API debugging',
+ subtitle:
+ 'Attribution Reporting API errors are now reported in the Issues tab.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-93/#attribution-reporting',
+ },
+ {
+ title: 'Better string handling in the Console',
+ subtitle:
+ 'Improved readability of displayed strings and new shortcuts to copy string as JSON and JavaScript literal.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-93/#string',
+ },
+ {
+ title: 'Improved CORS debugging',
+ subtitle:
+ 'CORS-related TypeErrors in the Console are now linked to the network panel and Issues tab.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-93/#cors',
+ },
+ ],
+ link: 'https://developer.chrome.com/blog/new-in-devtools-93/',
+ },
+ {
+ version: 34,
+ header: 'Highlights from the Chrome 92 update',
+ highlights: [
+ {
+ title: 'CSS Grid editor',
+ subtitle: 'Preview and author CSS Grid with the CSS Grid editor.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-92#grid-editor',
+ },
+ {
+ title: 'Source order viewer',
+ subtitle:
+ 'Display the order of source elements on screen for better accessibility inspection.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-92#source-order',
+ },
+ {
+ title: 'Lighthouse 7.5',
+ subtitle:
+ 'Easily view all the JavaScript bundles on your page with the new Lighthouse Treemap, and more.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-92#lighthouse',
+ },
+ {
+ title: 'Improved CORS debugging',
+ subtitle: 'CORS errors are now reported in the Issues tab.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-92#cors',
+ },
+ {
+ title: 'Network panel updates',
+ subtitle:
+ 'Add Wasm and web bundle to the resource types and rename XHR label to Fetch/XHR.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-92#network',
+ },
+ ],
+ link: 'https://developer.chrome.com/blog/new-in-devtools-92/',
+ },
+ {
+ version: 33,
+ header: 'Highlights from the Chrome 91 update',
+ highlights: [
+ {
+ title: 'Web Vitals information pop up',
+ subtitle:
+ 'Hover on a Web Vitals marker in the Performance panel to understand what’s the indicator about.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-91#web-vitals',
+ },
+ {
+ title: 'Visualize CSS scroll-snap',
+ subtitle:
+ 'Toggle the "scroll-snap" badge in the Elements panel to inspect the CSS scroll-snap alignment.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-91#css-scroll-snap',
+ },
+ {
+ title: 'Network panel enhancements',
+ subtitle:
+ 'A new network conditions button with new options to configure `Content-Encoding`s.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-91#network-panel',
+ },
+ {
+ title: 'New badge settings pane',
+ subtitle:
+ 'Selectively enable or disable badges via the Elements panel context menu.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-91#badge-settings',
+ },
+ {
+ title: 'New Memory inspector tab',
+ subtitle:
+ 'Inspect the WebAssembly memory in hexadecimal and ASCII views, and more.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-91#memory-inspector',
+ },
+ {
+ title: 'Enhanced image preview with aspect ratio information',
+ subtitle:
+ 'Image previews in the Elements panel now display intrinsic/rendered file size and aspect ratio.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-91#image-preview',
+ },
+ {
+ title: 'Categorize issue types with colors and icons',
+ subtitle:
+ 'Categorize issues into errors, warnings, and possible improvements for better severity indication.',
+ link: 'https://developer.chrome.com/blog/new-in-devtools-91#issue-category',
+ },
+ ],
+ link: 'https://developer.chrome.com/blog/new-in-devtools-91/',
+ },
+ {
+ version: 32,
+ header: 'Highlights from the Chrome 90 update',
+ highlights: [
+ {
+ title: 'New CSS Flexbox debugging tools',
+ subtitle:
+ 'Debug and inspect CSS Flexbox with the new CSS Flexbox debugging tools.',
+ link: 'https://developers.google.com/web/updates/2021/02/devtools#flexbox',
+ },
+ {
+ title: 'New Core Web Vitals overlay',
+ subtitle:
+ 'Visualize page performance with the new Core Web Vitals overlay.',
+ link: 'https://developers.google.com/web/updates/2021/02/devtools#cwv',
+ },
+ {
+ title: 'Report Trusted Web Activity issues',
+ subtitle: 'Debug Trusted Web Activity issues in the Issues panel.',
+ link: 'https://developers.google.com/web/updates/2021/02/devtools#twa',
+ },
+ {
+ title: 'New Trust Token pane',
+ subtitle: 'New Trust Token pane in the Application Panel.',
+ link: 'https://developers.google.com/web/updates/2021/02/devtools#trust-token-pane',
+ },
+ {
+ title: 'Emulate the CSS color-gamut media feature',
+ subtitle: 'Emulate color-gamut to test different color standards.',
+ link: 'https://developers.google.com/web/updates/2021/02/devtools#css-gamut',
+ },
+ {
+ title:
+ 'Format strings as (valid) JavaScript string literals in the Console',
+ subtitle: 'Display string with escaped double quotes in the Console',
+ link: 'https://developers.google.com/web/updates/2021/02/devtools#double-quotes',
+ },
+ {
+ title: 'Improved PWA tooling',
+ subtitle:
+ 'Improved PWA installability warning message, new warnings for manifest screenshots, and more. ',
+ link: 'https://developers.google.com/web/updates/2021/02/devtools#pwa',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2021/02/devtools',
+ },
+ {
+ version: 31,
+ header: 'Highlights from the Chrome 89 update',
+ highlights: [
+ {
+ title: 'Debugging support for Trusted Type violations',
+ subtitle:
+ 'Breakpoint on Trusted Type violations and link to more information in the Issues tab.',
+ link: 'https://developers.google.com/web/updates/2021/01/devtools#trusted-types',
+ },
+ {
+ title: 'Capture node screenshot beyond viewport',
+ subtitle:
+ 'Capture node screenshot for a full node including content below the fold.',
+ link: 'https://developers.google.com/web/updates/2021/01/devtools#node-screenshot',
+ },
+ {
+ title: 'New Trust Token tab for network requests',
+ subtitle:
+ 'Display Trusted Token parameters and results of network requests.',
+ link: 'https://developers.google.com/web/updates/2021/01/devtools#trust-token',
+ },
+ {
+ title: 'Lighthouse 7',
+ subtitle:
+ 'New audits for PWA, accessibility, third-party embeds, and more.',
+ link: 'https://developers.google.com/web/updates/2021/01/devtools#lighthouse',
+ },
+ {
+ title: 'Elements panel updates',
+ subtitle:
+ 'Support forcing CSS :target state, color pickers for custom CSS properties, a new context menu to duplicate elements, and more.',
+ link: 'https://developers.google.com/web/updates/2021/01/devtools#elements-panel',
+ },
+ {
+ title: 'Cookies updates',
+ subtitle:
+ 'Option to show URL-decoded cookies, only clear visible cookies, and more.',
+ link: 'https://developers.google.com/web/updates/2021/01/devtools#cookies',
+ },
+ {
+ title: 'User-Agent Client Hints for custom devices',
+ subtitle: 'Edit User-Agent Client Hints for custom devices.',
+ link: 'https://developers.google.com/web/updates/2021/01/devtools#ua-ch',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2021/01/devtools',
+ },
+ {
+ version: 30,
+ header: 'Highlights from the Chrome 88 update',
+ highlights: [
+ {
+ title: 'New CSS angle visualization tools',
+ subtitle: 'Better visualize and edit CSS angle in the Styles pane.',
+ link: 'https://developers.google.com/web/updates/2020/11/devtools#css-angle',
+ },
+ {
+ title: 'Emulate unsupported image types',
+ subtitle:
+ '2 new emulations to disable AVIF and WebP image formats in the Rendering tab.',
+ link: 'https://developers.google.com/web/updates/2020/11/devtools#emulate-image',
+ },
+ {
+ title: 'Simulate storage quota size',
+ subtitle: 'Override storage quota size in the Storage pane.',
+ link: 'https://developers.google.com/web/updates/2020/11/devtools#simulate-storage',
+ },
+ {
+ title: 'New Web Vitals lane',
+ subtitle: 'New Web Vitals lane in the Performance panel recordings.',
+ link: 'https://developers.google.com/web/updates/2020/11/devtools#web-vitals',
+ },
+ {
+ title: 'Report CORS errors in the Network panel',
+ subtitle:
+ 'Show CORS errors label and error code for failed CORS requests.',
+ link: 'https://developers.google.com/web/updates/2020/11/devtools#cors',
+ },
+ {
+ title: 'Frame details view updates',
+ subtitle:
+ 'New cross-origin isolation status, API availability section, and more.',
+ link: 'https://developers.google.com/web/updates/2020/11/devtools#frame-details',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2020/11/devtools',
+ },
+ {
+ version: 29,
+ header: 'Highlights from the Chrome 87 update',
+ highlights: [
+ {
+ title: 'New CSS Grid debugging tools',
+ subtitle:
+ 'Debug and inspect CSS Grid with the new CSS Grid debugging tools.',
+ link: 'https://developers.google.com/web/updates/2020/10/devtools#css-grid',
+ },
+ {
+ title: 'New WebAuthn tab',
+ subtitle:
+ 'Emulate authenticators and debug the Web Authentication API with the new WebAuthn tab.',
+ link: 'https://developers.google.com/web/updates/2020/10/devtools#webauthn',
+ },
+ {
+ title: 'Move tools between top and bottom panel',
+ subtitle: 'Move tools in DevTools between the top and bottom panel.',
+ link: 'https://developers.google.com/web/updates/2020/10/devtools#moveable-tools',
+ },
+ {
+ title: 'Elements panel updates',
+ subtitle:
+ 'View the Computed sidebar pane in the Styles pane, and more.',
+ link: 'https://developers.google.com/web/updates/2020/10/devtools#elements-panel',
+ },
+ {
+ title: 'Lighthouse 6.4',
+ subtitle:
+ 'New audits to validate preload fonts, valid sourcemaps, and more.',
+ link: 'https://developers.google.com/web/updates/2020/10/devtools#lighthouse',
+ },
+ {
+ title: '`performance.mark()` events in the Timings section',
+ subtitle:
+ 'Performance recording now marks `performance.mark()` events.',
+ link: 'https://developers.google.com/web/updates/2020/10/devtools#perf-mark',
+ },
+ {
+ title: 'New filters in the Network panel',
+ subtitle:
+ 'New `resource-type` and `url` keywords in the **Network panel** to filter network requests.',
+ link: 'https://developers.google.com/web/updates/2020/10/devtools#network-filters',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2020/10/devtools',
+ },
+ {
+ version: 28,
+ header: 'Highlights from the Chrome 86 update',
+ highlights: [
+ {
+ title: 'New Media panel',
+ subtitle: 'View and download media information on a browser tab.',
+ link: 'https://developers.google.com/web/updates/2020/08/devtools#media-panel',
+ },
+ {
+ title: 'Issues tab updates',
+ subtitle:
+ 'The Issues warning bar is replaced with a regular message. Issues tab has a new checkbox to filter third-party cookie issues.',
+ link: 'https://developers.google.com/web/updates/2020/08/devtools#issues-tab',
+ },
+ {
+ title: 'Emulate missing local fonts',
+ subtitle: 'Emulate missing `local()` sources in @font-face rules.',
+ link: 'https://developers.google.com/web/updates/2020/08/devtools#emulate-local-fonts',
+ },
+ {
+ title: 'Emulate inactive users',
+ subtitle:
+ 'Emulate idle state changes for both the user state and the screen state.',
+ link: 'https://developers.google.com/web/updates/2020/08/devtools#emulate-inactive-users',
+ },
+ {
+ title: 'Emulate prefers-reduced-data',
+ subtitle:
+ 'Emulate the user preference on using less data for the page to be rendered.',
+ link: 'https://developers.google.com/web/updates/2020/08/devtools#emulate-prefers-reduced-data',
+ },
+ {
+ title: 'Support for new JavaScript features',
+ subtitle:
+ 'Syntax support for logical assignment operators and numeric separators.',
+ link: 'https://developers.google.com/web/updates/2020/08/devtools#javascript',
+ },
+ {
+ title: 'Lighthouse 6.2',
+ subtitle:
+ 'Enhance the unused-javascript audit if a page has publicly-accessible JavaScript source maps, and more.',
+ link: 'https://developers.google.com/web/updates/2020/08/devtools#lighthouse',
+ },
+ {
+ title: 'Deprecation of service workers “other origins” listing',
+ subtitle:
+ 'View “other origins” listing in chrome://serviceworker-internals/?devtools instead.',
+ link: 'https://developers.google.com/web/updates/2020/08/devtools#deprecate-sw-other-origins',
+ },
+ {
+ title: 'New frame detailed view',
+ subtitle:
+ 'A new detailed view for each frame and window with security information.',
+ link: 'https://developers.google.com/web/updates/2020/08/devtools#frame-detailed-view',
+ },
+ {
+ title: 'Network and Elements panel updates',
+ subtitle:
+ 'Capture node screenshots shortcut, accessible color suggestion, human-readable `X-Client-Data`, and more',
+ link: 'https://developers.google.com/web/updates/2020/08/devtools#elements-network',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2020/08/devtools',
+ },
+ {
+ version: 27,
+ header: 'Highlights from the Chrome 85 update',
+ highlights: [
+ {
+ title: 'Style editing for CSS-in-JS',
+ subtitle:
+ 'Styles created with CSS Object Model APIs and Constructible Stylesheets are now editable.',
+ link: 'https://developers.google.com/web/updates/2020/06/devtools#css-in-js',
+ },
+ {
+ title: 'Lighthouse 6',
+ subtitle:
+ 'New metrics that align with Google’s Core Web Vitals, a new weighting of the Performance score, and more.',
+ link: 'https://developers.google.com/web/updates/2020/06/devtools#lighthouse',
+ },
+ {
+ title: 'First Meaningful Paint (FMP) deprecation',
+ subtitle:
+ 'FMP has been removed from the Performance panel and deprecated in Lighthouse 6.',
+ link: 'https://developers.google.com/web/updates/2020/06/devtools#fmp-deprecation',
+ },
+ {
+ title: 'Support for new JavaScript features',
+ subtitle:
+ 'Syntax and autocompletion support for optional chaining, private fields, and the nullish coalescing operator.',
+ link: 'https://developers.google.com/web/updates/2020/06/devtools#javascript',
+ },
+ {
+ title: 'New app shortcut warnings in the Manifest pane',
+ subtitle:
+ 'Warnings for when an app icon image is too small or not the correct shape.',
+ link: 'https://developers.google.com/web/updates/2020/06/devtools#app-shortcut-warnings',
+ },
+ {
+ title: 'Service worker respondWith events in the Timing tab',
+ subtitle:
+ 'More visibility into how long a service worker takes to respond to a fetch event.',
+ link: 'https://developers.google.com/web/updates/2020/06/devtools#timing-tab',
+ },
+ {
+ title: 'Consistent display of the Computed pane',
+ subtitle:
+ 'The pane now always displays as a separate pane, rather than collapsing into the Styles pane.',
+ link: 'https://developers.google.com/web/updates/2020/06/devtools#computed-pane',
+ },
+ {
+ title: 'Bytecode offsets for WebAssembly files',
+ subtitle:
+ 'Bytecode offsets are now displayed next to Wasm disassembly rather than line numbers.',
+ link: 'https://developers.google.com/web/updates/2020/06/devtools#wasm',
+ },
+ {
+ title: 'Line-wise copy and cut in the Sources Panel',
+ subtitle: 'Cut or copy an entire line of code.',
+ link: 'https://developers.google.com/web/updates/2020/06/devtools#sources-panel',
+ },
+ {
+ title: 'Console Settings updates',
+ subtitle:
+ 'The “Group similar” option now applies to duplicate messages and the “Selected context only” option is now persisted.',
+ link: 'https://developers.google.com/web/updates/2020/06/devtools#console-settings',
+ },
+ {
+ title: 'Performance panel updates',
+ subtitle:
+ 'Display JavaScript compilation cache information and align navigation timing in the Performance panel.',
+ link: 'https://developers.google.com/web/updates/2020/06/devtools#perf-panel',
+ },
+ {
+ title:
+ 'New icons for breakpoints, conditional breakpoints, and logpoints',
+ subtitle:
+ 'Breakpoints get a refreshed flag design with brighter and friendlier colors. Icons are added to differentiate conditional breakpoints and logpoints.',
+ link: 'https://developers.google.com/web/updates/2020/06/devtools#breakpoints',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2020/06/devtools',
+ },
+ {
+ version: 26,
+ header: 'Highlights from the Chrome 84 update',
+ highlights: [
+ {
+ title: 'The new Issues tab',
+ subtitle:
+ 'The Issues tab presents warnings from the browser in a structured, aggregated, and actionable way, links to affected resources within DevTools, and provides guidance on how to fix the issues.',
+ link: 'https://developers.google.com/web/updates/2020/05/devtools#issues',
+ },
+ {
+ title: 'New accessibility information in the Inspect Mode tooltip',
+ subtitle:
+ 'The tooltip now indicates whether an element has an accessible name and role and is keyboard-focusable.',
+ link: 'https://developers.google.com/web/updates/2020/05/devtools#a11y',
+ },
+ {
+ title: 'Performance panel updates',
+ subtitle:
+ 'New features related to Total Blocking Time (TBT) and Cumulative Layout Shift (CLS).',
+ link: 'https://developers.google.com/web/updates/2020/05/devtools#performance',
+ },
+ {
+ title: 'More accurate Promise terminology',
+ subtitle:
+ 'When logging Promises in the Console, the status now matches the Promise spec.',
+ link: 'https://developers.google.com/web/updates/2020/05/devtools#performance',
+ },
+ {
+ title: 'Styles pane updates',
+ subtitle:
+ 'Support for the revert keyword, image previews, and more usage of space-separated functional color notation by default.',
+ link: 'https://developers.google.com/web/updates/2020/05/devtools#styles',
+ },
+ {
+ title: 'Deprecation of the Properties pane',
+ subtitle: 'Use console.dir($0) instead.',
+ link: 'https://developers.google.com/web/updates/2020/05/devtools#properties',
+ },
+ {
+ title: 'App shortcuts support in the Manifest pane',
+ subtitle:
+ 'Verify your app shortcuts are set up correctly for your PWA.',
+ link: 'https://developers.google.com/web/updates/2020/05/devtools#app-shortcuts',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2020/05/devtools',
+ },
+ {
+ version: 25,
+ header: 'Highlights from the Chrome 83 update',
+ highlights: [
+ {
+ title: 'Emulate vision deficiencies from the Rendering tab',
+ subtitle:
+ 'Get a visual approximation of how people with vision deficiencies might experience your site.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#vision-deficiences',
+ },
+ {
+ title: 'Emulate locales from the Sensors tab or Console',
+ subtitle:
+ 'Emulating locales enables you to change JavaScript APIs such as `Intl.*`, DOM APIs such as `navigator.locale`, and the `Accept-Language` HTTP header that’s sent with network requests.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#locales',
+ },
+ {
+ title: 'Cross-Origin Embedder Policy (COEP) debugging',
+ subtitle:
+ 'Use the Status column and Response Headers section in the Network panel to debug COEP issues.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#COEP',
+ },
+ {
+ title:
+ 'New icons for breakpoints, conditional breakpoints, and logpoints',
+ subtitle:
+ 'The new icons are more consistent with other GUI debugging tools and make it easier to distinguish between the 3 features at a glance.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#debugging-icons',
+ },
+ {
+ title: 'View network requests that set a specific cookie path',
+ subtitle:
+ 'Use the new `cookie-path` filter keyword to focus on the network requests that set a specific cookie path.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#cookie-path',
+ },
+ {
+ title: 'Dock to left from the Command Menu',
+ subtitle:
+ 'Run the “Dock to left” command to quickly move DevTools to the left of your viewport.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#dock-to-left',
+ },
+ {
+ title: 'The Settings option in the Main Menu has moved',
+ subtitle:
+ 'The option for opening Settings can now be found under “More Tools”.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#settings',
+ },
+ {
+ title: 'The Audits panel is now the Lighthouse panel',
+ subtitle: 'Same features. New name.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#lighthouse',
+ },
+ {
+ title: 'Delete all Local Overrides in a folder',
+ subtitle:
+ 'Right-click a folder from the Overrides tab and select “Delete all overrides”.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#overrides',
+ },
+ {
+ title: 'Updated Long Tasks UI',
+ subtitle:
+ 'In the Performance panel Long Tasks now have a striped red background.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#long-tasks',
+ },
+ {
+ title: 'Maskable icon support in the Manifest pane',
+ subtitle:
+ 'Enable the “Show only the minimum safe area for maskable icons” checkbox.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#maskable-icons',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2020/03/devtools',
+ },
+ {
+ version: 24,
+ header: 'Highlights from the Chrome 82 update',
+ highlights: [
+ {
+ title: 'Emulate vision deficiencies from the Rendering tab',
+ subtitle:
+ 'Get a visual approximation of how people with vision deficiencies might experience your site.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#vision-deficiences',
+ },
+ {
+ title:
+ 'Cross-Origin Opener Policy (COOP) and Cross-Origin Embedder Policy (COEP) debugging',
+ subtitle:
+ 'Use the Status column and Response Headers section in the Network panel to debug COOP and COEP issues.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#COOP-COEP',
+ },
+ {
+ title: 'Dock to left from the Command Menu',
+ subtitle:
+ 'Run the “Dock to left” command to quickly move DevTools to the left of your viewport.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#dock-to-left',
+ },
+ {
+ title: 'The Audits panel is now the Lighthouse panel',
+ subtitle: 'Same features. New name.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#lighthouse',
+ },
+ {
+ title: 'Delete all Local Overrides in a folder',
+ subtitle:
+ 'Right-click a folder from the Overrides tab and select “Delete all overrides”.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#overrides',
+ },
+ {
+ title: 'Updated Long Tasks UI',
+ subtitle:
+ 'In the Performance panel Long Tasks now have a striped red background.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#long-tasks',
+ },
+ {
+ title: 'Maskable icon support in the Manifest pane',
+ subtitle:
+ 'Enable the “Show only the minimum safe area for maskable icons” checkbox.',
+ link: 'https://developers.google.com/web/updates/2020/03/devtools#maskable-icons',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2020/03/devtools',
+ },
+ {
+ version: 23,
+ header: 'Highlights from the Chrome 81 update',
+ highlights: [
+ {
+ title: 'Moto G4 support in Device Mode',
+ subtitle:
+ 'Simulate Moto G4 viewport dimensions and display its hardware around the viewport.',
+ link: 'https://developers.google.com/web/updates/2020/01/devtools#motog4',
+ },
+ {
+ title: 'Cookie-related updates',
+ subtitle:
+ 'Blocked cookies and cookie priority in the Cookies pane, editing all cookie values, and more.',
+ link: 'https://developers.google.com/web/updates/2020/01/devtools#cookies',
+ },
+ {
+ title: 'More accurate web app manifest icons',
+ subtitle: 'DevTools now shows the exact icon that Chrome uses.',
+ link: 'https://developers.google.com/web/updates/2020/01/devtools#manifesticons',
+ },
+ {
+ title: 'Hover over CSS `content` properties to see unescaped values',
+ subtitle:
+ 'Hover over a `content` value to see the rendered version of the value in a tooltip.',
+ link: 'https://developers.google.com/web/updates/2020/01/devtools#content',
+ },
+ {
+ title: 'Source map errors in the Console',
+ subtitle:
+ 'The Console now tells you when a source map has failed to load or parse.',
+ link: 'https://developers.google.com/web/updates/2020/01/devtools#sourcemaperrors',
+ },
+ {
+ title: 'A setting for disabling scrolling past the end of a file',
+ subtitle:
+ 'Go to Settings and disable the “Allow scrolling past end of file” checkbox.',
+ link: 'https://developers.google.com/web/updates/2020/01/devtools#scrolling',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2020/01/devtools',
+ },
+ {
+ version: 22,
+ header: 'Highlights from the Chrome 80 update',
+ highlights: [
+ {
+ title: 'Support for let and class redeclarations',
+ subtitle:
+ 'When experimenting with new code in the Console, repeating `let` or `class` declarations no longer causes errors.',
+ link: 'https://developers.google.com/web/updates/2019/12/devtools#redeclarations',
+ },
+ {
+ title: 'Improved WebAssembly debugging',
+ subtitle:
+ 'The Sources panel has increased support for stepping over code, setting breakpoints, and resolving stack traces in source languages.',
+ link: 'https://developers.google.com/web/updates/2019/12/devtools#webassembly',
+ },
+ {
+ title: 'Network panel updates',
+ subtitle:
+ 'View request initiator chains, highlight requests in the Overview, and more.',
+ link: 'https://developers.google.com/web/updates/2019/12/devtools#network',
+ },
+ {
+ title: 'Audits panel updates',
+ subtitle:
+ 'The redesigned configuration UI has simplified throttling options.',
+ link: 'https://developers.google.com/web/updates/2019/12/devtools#audits',
+ },
+ {
+ title: 'Coverage tab updates',
+ subtitle: 'Choose per-function or per-block coverage, and more.',
+ link: 'https://developers.google.com/web/updates/2019/12/devtools#coverage',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2019/12/devtools',
+ },
+ {
+ version: 21,
+ header: 'Highlights from the Chrome 79 update',
+ highlights: [
+ {
+ title: 'Debug why a cookie was blocked',
+ subtitle:
+ 'Click a resource in the Network panel and go to the updated Cookies tab.',
+ link: 'https://developers.google.com/web/updates/2019/10/devtools#blockedcookies',
+ },
+ {
+ title: 'View cookie values',
+ subtitle:
+ 'Click a row in the Cookies pane in the Application panel to see the cookie’s value.',
+ link: 'https://developers.google.com/web/updates/2019/10/devtools#cookiepreviews',
+ },
+ {
+ title:
+ 'Simulate prefers-color-scheme and prefers-reduced-motion preferences',
+ subtitle:
+ 'Open the Rendering tab to force your site into dark or light mode or set motion preferences.',
+ link: 'https://developers.google.com/web/updates/2019/10/devtools#userpreferences',
+ },
+ {
+ title: 'Code coverage updates',
+ subtitle:
+ 'More accessible colors, a filter text box, and a new integration with the Sources panel.',
+ link: 'https://developers.google.com/web/updates/2019/10/devtools#coverage',
+ },
+ {
+ title: 'Debug why a network resource was requested',
+ subtitle:
+ 'Click a resource in the Network panel and go to the new Initiator tab.',
+ link: 'https://developers.google.com/web/updates/2019/10/devtools#initiator',
+ },
+ {
+ title:
+ 'Console and Sources panels respect indentation preferences again',
+ subtitle:
+ 'Set your preference in Settings > Preferences > Sources > Default Indentation.',
+ link: 'https://developers.google.com/web/updates/2019/10/devtools#indentation',
+ },
+ {
+ title: 'New shortcuts for cursor navigation',
+ subtitle:
+ 'Press Control+P or Control+N to move your cursor to the line above or below.',
+ link: 'https://developers.google.com/web/updates/2019/10/devtools#console',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2019/10/devtools',
+ },
+ {
+ version: 20,
+ header: 'Highlights from the Chrome 78 update',
+ highlights: [
+ {
+ title: 'Multi-client support in the Audits panel',
+ subtitle:
+ 'Use the Audits panel in combination with other features, like Local Overrides or Request Blocking.',
+ link: 'https://developers.google.com/web/updates/2019/09/devtools#multiclient',
+ },
+ {
+ title: 'Payment Handler debugging',
+ subtitle:
+ 'Record Payment Handler events for 3 days, even when DevTools is closed.',
+ link: 'https://developers.google.com/web/updates/2019/09/devtools#payments',
+ },
+ {
+ title: 'Lighthouse 5.2 in the Audits panel',
+ subtitle:
+ 'Measure the impact of third-party code on your load performance with the new Third-Party Usage audit.',
+ link: 'https://developers.google.com/web/updates/2019/09/devtools#audits',
+ },
+ {
+ title: 'Largest Contentful Paint (LCP) in the Performance panel',
+ subtitle:
+ 'Click the new LCP marker in the Timing section to see the DOM node associated with your LCP.',
+ link: 'https://developers.google.com/web/updates/2019/09/devtools#LCP',
+ },
+ {
+ title: 'File issues and feature requests from the Main Menu',
+ subtitle:
+ 'Found a bug? Got an idea on how to improve DevTools? Go to Main Menu > Help > Report a DevTools issue.',
+ link: 'https://developers.google.com/web/updates/2019/09/devtools#issues',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2019/09/devtools',
+ },
+ {
+ version: 19,
+ header: 'Highlights from the Chrome 77 update',
+ highlights: [
+ {
+ title: 'Copy element styles',
+ subtitle:
+ 'Right-click an element in the DOM Tree and select Copy > Copy Styles.',
+ link: 'https://developers.google.com/web/updates/2019/07/devtools#copystyles',
+ },
+ {
+ title: 'Visualize layout shifts',
+ subtitle: `Press ${n}, run Show Rendering, and enable Layout Shift Regions to visualize content shifts.`,
+ link: 'https://developers.google.com/web/updates/2019/07/devtools#layoutshifts',
+ },
+ {
+ title: 'Lighthouse 5.1 in the Audits panel',
+ subtitle:
+ 'New audits for checking for PWA installability on iOS, keeping resource counts low, and more.',
+ link: 'https://developers.google.com/web/updates/2019/07/devtools#audits',
+ },
+ {
+ title: 'OS theme syncing',
+ subtitle:
+ 'DevTools now automatically switches to its own dark theme when it detects an OS in dark mode.',
+ link: 'https://developers.google.com/web/updates/2019/07/devtools#theming',
+ },
+ {
+ title: 'Keyboard shortcut for opening the Breakpoint Editor',
+ subtitle: `Press ${
+ t.Platform.isMac() ? 'Command+Option+B' : 'Control+Alt+B'
+ } when focused in the Editor to create Logpoints and Conditional Breakpoints more quickly.`,
+ link: 'https://developers.google.com/web/updates/2019/07/devtools#breakpointeditor',
+ },
+ {
+ title: 'Prefetch cache in Network panel',
+ subtitle:
+ 'The Size column now indicates whether a resource came from the prefetch cache.',
+ link: 'https://developers.google.com/web/updates/2019/07/devtools#prefetch',
+ },
+ {
+ title: 'Private properties when viewing objects',
+ subtitle:
+ 'The Console now shows private class fields in its object previews.',
+ link: 'https://developers.google.com/web/updates/2019/07/devtools#privateclassfields',
+ },
+ {
+ title: 'Notification and push message logs',
+ subtitle:
+ 'Go to Application > Background Services > Notifications or Messages and click Record to log events for 3 days.',
+ link: 'https://developers.google.com/web/updates/2019/07/devtools#backgroundservices',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2019/07/devtools',
+ },
+ {
+ version: 18,
+ header: 'Highlights from the Chrome 76 update',
+ highlights: [
+ {
+ title: 'Autocomplete with CSS keyword values',
+ subtitle:
+ 'Typing a keyword value like `bold` in the Styles pane now autocompletes to `font-weight: bold`.',
+ link: 'https://developers.google.com/web/updates/2019/05/devtools#values',
+ },
+ {
+ title: 'A new UI for network settings',
+ subtitle:
+ 'The “Use large request rows”, “Group by frame”, “Show overview”, and “Capture screenshots” options have moved to the new Network Settings pane.',
+ link: 'https://developers.google.com/web/updates/2019/05/devtools#settings',
+ },
+ {
+ title: 'WebSocket messages in HAR exports',
+ subtitle:
+ 'Network logs downloaded from the Network panel now include WebSocket messages.',
+ link: 'https://developers.google.com/web/updates/2019/05/devtools#websocket',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2019/05/devtools',
+ },
+ {
+ version: 17,
+ header: 'Highlights from the Chrome 75 update',
+ highlights: [
+ {
+ title: 'Meaningful preset values when autocompleting CSS functions',
+ subtitle:
+ 'Properties like `filter` that take functions for values now autocomplete to previewable values in the Styles pane.',
+ link: 'https://developers.google.com/web/updates/2019/04/devtools#presets',
+ },
+ {
+ title: 'Clear site data from the Command Menu',
+ subtitle: `Press ${n} and run the “Clear Site Data” command to clear cookies, storage, and more.`,
+ link: 'https://developers.google.com/web/updates/2019/04/devtools#clear',
+ },
+ {
+ title: 'View all IndexedDB databases',
+ subtitle:
+ 'The IndexedDB pane now shows databases for all origins rather than just the main origin.',
+ link: 'https://developers.google.com/web/updates/2019/04/devtools#indexeddb',
+ },
+ {
+ title: 'View a resource’s uncompressed size on hover',
+ subtitle:
+ 'Hover over the Size column in the Network panel to view a resource’s full size.',
+ link: 'https://developers.google.com/web/updates/2019/04/devtools#uncompressed',
+ },
+ {
+ title: 'Inline breakpoints in the Breakpoints pane',
+ subtitle:
+ 'When you’ve got multiple breakpoints on a single line of code, the Breakpoints pane now lets you manage each one independently.',
+ link: 'https://developers.google.com/web/updates/2019/04/devtools#inline',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2019/04/devtools',
+ },
+ {
+ version: 16,
+ header: 'Highlights from the Chrome 74 update',
+ highlights: [
+ {
+ title: 'Highlight all nodes affected by CSS property',
+ subtitle:
+ 'Hover over a CSS property like padding or margin in the Styles pane to highlight all nodes affected by that declaration.',
+ link: 'https://developers.google.com/web/updates/2019/03/devtools#highlight',
+ },
+ {
+ title: 'Lighthouse v4 in the Audits panel',
+ subtitle:
+ 'Featuring a new “tap targets” audit for checking that mobile links and buttons are properly sized, and a new UI for PWA reports.',
+ link: 'https://developers.google.com/web/updates/2019/03/devtools#lighthouse',
+ },
+ {
+ title: 'WebSocket binary message viewer',
+ subtitle:
+ 'Click a WebSocket connection in the Network Log, go to the Messages tab, then click a binary message to view its contents.',
+ link: 'https://developers.google.com/web/updates/2019/03/devtools#binary',
+ },
+ {
+ title: 'Capture area screenshot in the Command Menu',
+ subtitle:
+ 'Press ' +
+ n +
+ ', run the “Capture area screenshot” command, and then drag your mouse to take a screenshot of part of the viewport.',
+ link: 'https://developers.google.com/web/updates/2019/03/devtools#screenshot',
+ },
+ {
+ title: 'Service worker filters in the Network panel',
+ subtitle:
+ 'Type `is:service-worker-initiated` or `is:service-worker-intercepted` to only show service worker activity.',
+ link: 'https://developers.google.com/web/updates/2019/03/devtools#swfilters',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2019/03/devtools',
+ },
+ {
+ version: 15,
+ header: 'Highlights from the Chrome 73 update',
+ highlights: [
+ {
+ title: 'Logpoints',
+ subtitle:
+ 'Log messages to the Console without cluttering up your code with `console.log()` calls.',
+ link: 'https://developers.google.com/web/updates/2019/01/devtools#logpoints',
+ },
+ {
+ title: 'Detailed tooltips in Inspect Mode',
+ subtitle:
+ 'When inspecting a node, DevTools now shows an expanded tooltip containing text, color contrast, and box model information.',
+ link: 'https://developers.google.com/web/updates/2019/01/devtools#inspect',
+ },
+ {
+ title: 'Export code coverage data',
+ subtitle:
+ 'The Coverage tab now supports exporting coverage data as JSON.',
+ link: 'https://developers.google.com/web/updates/2019/01/devtools#coverage',
+ },
+ {
+ title: 'Navigate the Console with the keyboard',
+ subtitle:
+ 'Press Shift+Tab to focus the last message and then use the arrow keys to navigate.',
+ link: 'https://developers.google.com/web/updates/2019/01/devtools#keyboard',
+ },
+ {
+ title: 'Save custom location overrides',
+ subtitle:
+ 'Click Manage in the Sensors tab or open Settings > Locations.',
+ link: 'https://developers.google.com/web/updates/2019/01/devtools#geolocation',
+ },
+ {
+ title: 'Code folding',
+ subtitle:
+ 'Go to Settings > Preferences > Sources and enable Code Folding to fold code in the Sources panel.',
+ link: 'https://developers.google.com/web/updates/2019/01/devtools#folding',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2019/01/devtools',
+ },
+ {
+ version: 14,
+ header: 'Highlights from the Chrome 72 update',
+ highlights: [
+ {
+ title: 'Visualize performance metrics',
+ subtitle:
+ 'Performance metrics like DOMContentLoaded and First Meaningful Paint are now marked in the Timings section of the Performance panel.',
+ link: 'https://developers.google.com/web/updates/2018/11/devtools#metrics',
+ },
+ {
+ title: 'Highlight text nodes',
+ subtitle:
+ 'Hover over a text node in the DOM Tree to highlight it in the viewport.',
+ link: 'https://developers.google.com/web/updates/2018/11/devtools#highlight',
+ },
+ {
+ title: 'Copy JS path',
+ subtitle:
+ 'Right-click a DOM node and select “Copy” > “Copy JS path” to quickly get a JavaScript expression that points to that node.',
+ link: 'https://developers.google.com/web/updates/2018/11/devtools#copy',
+ },
+ {
+ title: 'Audits panel updates',
+ subtitle:
+ 'A new audit that lists detected JS libraries and new keywords for accessing the Audits panel from the Command Menu.',
+ link: 'https://developers.google.com/web/updates/2018/11/devtools#audits',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2018/11/devtools',
+ },
+ {
+ version: 13,
+ header: 'Highlights from the Chrome 71 update',
+ highlights: [
+ {
+ title: 'Hover over a Live Expression to highlight a DOM node',
+ subtitle:
+ 'Hover over a result that evaluates to a node to highlight that node in the viewport.',
+ link: 'https://developers.google.com/web/updates/2018/10/devtools#hover',
+ },
+ {
+ title: 'Store DOM nodes as global variables',
+ subtitle:
+ 'Right-click a node in the Elements panel or Console and select “Store as global variable”.',
+ link: 'https://developers.google.com/web/updates/2018/10/devtools#store',
+ },
+ {
+ title:
+ 'Initiator and priority information now in HAR imports and exports',
+ subtitle:
+ 'Get more context around what caused a resource to be requested and what priority the browser assigned to each resource when sharing network logs.',
+ link: 'https://developers.google.com/web/updates/2018/10/devtools#HAR',
+ },
+ {
+ title: 'Access the Command Menu from the Main Menu',
+ subtitle: 'Open the Main Menu and select “Run command”.',
+ link: 'https://developers.google.com/web/updates/2018/10/devtools#command-menu',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2018/10/devtools',
+ },
+ {
+ version: 12,
+ header: 'Highlights from the Chrome 70 update',
+ highlights: [
+ {
+ title: 'Live Expressions in the Console',
+ subtitle:
+ 'Pin expressions to the top of the Console to monitor their values in real-time.',
+ link: 'https://developers.google.com/web/updates/2018/08/devtools#watch',
+ },
+ {
+ title: 'Highlight DOM nodes during Eager Evaluation',
+ subtitle:
+ 'Type an expression that evaluates to a node to highlight that node in the viewport.',
+ link: 'https://developers.google.com/web/updates/2018/08/devtools#nodes',
+ },
+ {
+ title: 'Autocomplete Conditional Breakpoints',
+ subtitle: 'Type expressions quickly and accurately.',
+ link: 'https://developers.google.com/web/updates/2018/08/devtools#autocomplete',
+ },
+ {
+ title: 'Performance panel optimizations',
+ subtitle: 'Faster loading and processing of Performance recordings.',
+ link: 'https://developers.google.com/web/updates/2018/08/devtools#performance',
+ },
+ {
+ title: 'More reliable debugging',
+ subtitle: 'Bug fixes for sourcemaps and blackboxing.',
+ link: 'https://developers.google.com/web/updates/2018/08/devtools#debugging',
+ },
+ {
+ title: 'Debug Node.js apps with ndb',
+ subtitle:
+ 'Detect and attach to child processes, place breakpoints before modules are required, edit files within DevTools, and more.',
+ link: 'https://developers.google.com/web/updates/2018/08/devtools#ndb',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2018/08/devtools',
+ },
+ {
+ version: 11,
+ header: 'Highlights from the Chrome 68 update',
+ highlights: [
+ {
+ title: 'Eager evaluation',
+ subtitle:
+ 'Preview return values in the Console without explicitly executing expressions.',
+ link: 'https://developers.google.com/web/updates/2018/05/devtools#eagerevaluation',
+ },
+ {
+ title: 'Argument hints',
+ subtitle: 'View a function’s expected arguments in the Console.',
+ link: 'https://developers.google.com/web/updates/2018/05/devtools#hints',
+ },
+ {
+ title: 'Function autocompletion',
+ subtitle:
+ 'View available properties and methods after calling a function in the Console.',
+ link: 'https://developers.google.com/web/updates/2018/05/devtools#autocomplete',
+ },
+ {
+ title: 'Audits panel updates',
+ subtitle:
+ 'Faster, more consisent audits, a new UI, and new audits, thanks to Lighthouse 3.0.',
+ link: 'https://developers.google.com/web/updates/2018/05/devtools#lh3',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2018/05/devtools',
+ },
+ {
+ version: 10,
+ header: 'Highlights from the Chrome 67 update',
+ highlights: [
+ {
+ title: 'Search across all network headers',
+ subtitle: `Press ${i} in the Network panel to open the Network Search pane.`,
+ link: 'https://developers.google.com/web/updates/2018/04/devtools#network-search',
+ },
+ {
+ title: 'CSS variable value previews in the Styles pane',
+ subtitle:
+ 'When a property value is a CSS variable, DevTools now shows a color preview next to the variable.',
+ link: 'https://developers.google.com/web/updates/2018/04/devtools#vars',
+ },
+ {
+ title: 'Stop infinite loops',
+ subtitle:
+ 'Pause JavaScript execution then select the new Stop Current JavaScript Call button.',
+ link: 'https://developers.google.com/web/updates/2018/04/devtools#stop',
+ },
+ {
+ title: 'Copy as fetch',
+ subtitle:
+ 'Right-click a network request then select Copy > Copy as fetch.',
+ link: 'https://developers.google.com/web/updates/2018/04/devtools#fetch',
+ },
+ {
+ title: 'More audits',
+ subtitle:
+ 'Two new audits, desktop configuration options, and viewing traces.',
+ link: 'https://developers.google.com/web/updates/2018/04/devtools#audits',
+ },
+ {
+ title: 'User Timing in the Performance tabs',
+ subtitle:
+ 'Click the User Timing section to view measures in the Summary, Bottom-Up, and Call Tree tabs.',
+ link: 'https://developers.google.com/web/updates/2018/04/devtools#tabs',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2018/04/devtools',
+ },
+ {
+ version: 9,
+ header: 'Highlights from the Chrome 66 update',
+ highlights: [
+ {
+ title: 'Pretty-printing in the Preview and Response tabs',
+ subtitle:
+ 'The Preview tab now pretty-prints by default, and you can force pretty-printing in the Response tab via the new Format button.',
+ link: 'https://developers.google.com/web/updates/2018/02/devtools#pretty-printing',
+ },
+ {
+ title: 'Previewing HTML content in the Preview tab',
+ subtitle:
+ 'The Preview tab now always does a basic rendering of HTML content.',
+ link: 'https://developers.google.com/web/updates/2018/02/devtools#previews',
+ },
+ {
+ title: 'Local Overrides with styles defined in HTML',
+ subtitle:
+ 'Local Overrides now works with styles defined in HTML, with one exception.',
+ link: 'https://developers.google.com/web/updates/2018/02/devtools#overrides',
+ },
+ {
+ title: 'Blackboxing in the Initiator column',
+ subtitle:
+ 'Hide framework scripts in order to see the app code that caused a request.',
+ link: 'https://developers.google.com/web/updates/2018/02/devtools#blackboxing',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2018/02/devtools',
+ },
+ {
+ version: 8,
+ header: 'Highlights from the Chrome 65 update',
+ highlights: [
+ {
+ title: 'Local overrides',
+ subtitle:
+ 'Override network requests and serve local resources instead.',
+ link: 'https://developers.google.com/web/updates/2018/01/devtools#overrides',
+ },
+ {
+ title: 'Changes tab',
+ subtitle:
+ 'Track changes that you make locally in DevTools via the Changes tab.',
+ link: 'https://developers.google.com/web/updates/2018/01/devtools#changes',
+ },
+ {
+ title: 'New accessibility tools',
+ subtitle:
+ 'Inspect the accessibility properties and contrast ratio of elements.',
+ link: 'https://developers.google.com/web/updates/2018/01/devtools#a11y',
+ },
+ {
+ title: 'New audits',
+ subtitle:
+ 'New performance audits, a whole new category of SEO audits, and more.',
+ link: 'https://developers.google.com/web/updates/2018/01/devtools#audits',
+ },
+ {
+ title: 'Code stepping updates',
+ subtitle: 'Reliably step into web worker and asynchronous code.',
+ link: 'https://developers.google.com/web/updates/2018/01/devtools#stepping',
+ },
+ {
+ title: 'Multiple recordings in the Performance panel',
+ subtitle: 'Temporarily save up to 5 recordings.',
+ link: 'https://developers.google.com/web/updates/2018/01/devtools#recordings',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2018/01/devtools',
+ },
+ {
+ version: 7,
+ header: 'Highlights from the Chrome 64 update',
+ highlights: [
+ {
+ title: 'Performance monitor',
+ subtitle: 'Get a real-time view of various performance metrics.',
+ link: 'https://developers.google.com/web/updates/2017/11/devtools-release-notes#perf-monitor',
+ },
+ {
+ title: 'Console sidebar',
+ subtitle:
+ 'Reduce console noise and focus on the messages that are important to you.',
+ link: 'https://developers.google.com/web/updates/2017/11/devtools-release-notes#console-sidebar',
+ },
+ {
+ title: 'Group similar console messages',
+ subtitle: 'The Console now groups similar messages by default.',
+ link: 'https://developers.google.com/web/updates/2017/11/devtools-release-notes#group-similar',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2017/11/devtools-release-notes',
+ },
+ {
+ version: 6,
+ header: 'Highlights from the Chrome 63 update',
+ highlights: [
+ {
+ title: 'Multi-client remote debugging',
+ subtitle:
+ 'Use DevTools while debugging your app from an IDE or testing framework.',
+ link: 'https://developers.google.com/web/updates/2017/10/devtools-release-notes#multi-client',
+ },
+ {
+ title: 'Workspaces 2.0',
+ subtitle:
+ 'Save changes made in DevTools to disk, now with more helpful UI and better auto-mapping.',
+ link: 'https://developers.google.com/web/updates/2017/10/devtools-release-notes#workspaces',
+ },
+ {
+ title: 'Four new audits',
+ subtitle:
+ 'Including “Appropriate aspect ratios for images”, “Avoid JS libraries with known vulnerabilities”, and more.',
+ link: 'https://developers.google.com/web/updates/2017/10/devtools-release-notes#audits',
+ },
+ {
+ title: 'Custom push notifications',
+ subtitle: 'Simulate push notifications with custom data.',
+ link: 'https://developers.google.com/web/updates/2017/10/devtools-release-notes#push',
+ },
+ {
+ title: 'Custom background sync events',
+ subtitle: 'Trigger background sync events with custom tags.',
+ link: 'https://developers.google.com/web/updates/2017/10/devtools-release-notes#sync',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2017/10/devtools-release-notes',
+ },
+ {
+ version: 5,
+ header: 'Highlights from the Chrome 62 update',
+ highlights: [
+ {
+ title: 'Top-level await operators in the Console',
+ subtitle:
+ 'Use await to conveniently experiment with asynchronous functions in the Console.',
+ link: 'https://developers.google.com/web/updates/2017/08/devtools-release-notes#await',
+ },
+ {
+ title: 'New screenshot workflows',
+ subtitle:
+ 'Take screenshots of a portion of the viewport, or of specific HTML nodes.',
+ link: 'https://developers.google.com/web/updates/2017/08/devtools-release-notes#screenshots',
+ },
+ {
+ title: 'CSS Grid highlighting',
+ subtitle:
+ 'Hover over an element to see the CSS Grid that’s affecting it.',
+ link: 'https://developers.google.com/web/updates/2017/08/devtools-release-notes#css-grid-highlighting',
+ },
+ {
+ title: 'A new Console API for querying objects',
+ subtitle:
+ 'Call `queryObjects(Constructor)` to get an array of objects instantiated with that constructor.',
+ link: 'https://developers.google.com/web/updates/2017/08/devtools-release-notes#query-objects',
+ },
+ {
+ title: 'New Console filters',
+ subtitle:
+ 'Filter out logging noise with the new negative and URL filters.',
+ link: 'https://developers.google.com/web/updates/2017/08/devtools-release-notes#console-filters',
+ },
+ {
+ title: 'HAR imports in the Network panel',
+ subtitle:
+ 'Drag-and-drop a HAR file to analyze a previous network recording.',
+ link: 'https://developers.google.com/web/updates/2017/08/devtools-release-notes#har-imports',
+ },
+ {
+ title: 'Previewable cache resources in the Application panel',
+ subtitle:
+ 'Click a row in a Cache Storage table to see a preview of that resource.',
+ link: 'https://developers.google.com/web/updates/2017/08/devtools-release-notes#cache-preview',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2017/08/devtools-release-notes',
+ },
+ {
+ version: 4,
+ header: 'Highlights from the Chrome 61 update',
+ highlights: [
+ {
+ title: 'Mobile device throttling',
+ subtitle:
+ 'Simulate a mobile device’s CPU and network throttling from Device Mode.',
+ link: 'https://developers.google.com/web/updates/2017/07/devtools-release-notes#throttling',
+ },
+ {
+ title: 'Storage usage',
+ subtitle:
+ 'See how much storage (IndexedDB, local, session, cache, etc.) an origin is using.',
+ link: 'https://developers.google.com/web/updates/2017/07/devtools-release-notes#storage',
+ },
+ {
+ title: 'Cache timestamps',
+ subtitle: 'View when a service worker cached a response.',
+ link: 'https://developers.google.com/web/updates/2017/07/devtools-release-notes#time-cached',
+ },
+ {
+ title: 'ES6 Modules support',
+ subtitle: 'Debug ES6 Modules natively from the Sources panel.',
+ link: 'https://developers.google.com/web/updates/2017/07/devtools-release-notes#modules',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2017/07/devtools-release-notes',
+ },
+ {
+ version: 3,
+ header: 'Highlights from the Chrome 60 update',
+ highlights: [
+ {
+ title: 'New Audits panel, powered by Lighthouse',
+ subtitle:
+ 'Find out whether your site qualifies as a Progressive Web App, measure the accessibility and performance of a page, and discover best practices.',
+ link: 'https://developers.google.com/web/updates/2017/05/devtools-release-notes#lighthouse',
+ },
+ {
+ title: 'Third-party badges',
+ subtitle:
+ 'See what third-party entities are logging to the Console, making network requests, and causing work during performance recordings.',
+ link: 'https://developers.google.com/web/updates/2017/05/devtools-release-notes#badges',
+ },
+ {
+ title: 'New "Continue to Here" gesture',
+ subtitle:
+ 'While paused on a line of code, hold ' +
+ l +
+ ' and then click to continue to another line of code.',
+ link: 'https://developers.google.com/web/updates/2017/05/devtools-release-notes#continue',
+ },
+ {
+ title: 'Step into async',
+ subtitle:
+ 'Predictably step into a promise resolution or other asynchronous code with a single gesture.',
+ link: 'https://developers.google.com/web/updates/2017/05/devtools-release-notes#step-into-async',
+ },
+ {
+ title: 'More informative object previews',
+ subtitle:
+ 'Get a better idea of the contents of objects when logging them to the Console.',
+ link: 'https://developers.google.com/web/updates/2017/05/devtools-release-notes#object-previews',
+ },
+ {
+ title: 'Real-time Coverage tab updates',
+ subtitle: 'See what code is being used in real-time.',
+ link: 'https://developers.google.com/web/updates/2017/05/devtools-release-notes#coverage',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2017/05/devtools-release-notes',
+ },
+ {
+ version: 2,
+ header: 'Highlights from Chrome 59 update',
+ highlights: [
+ {
+ title: 'CSS and JS code coverage',
+ subtitle: 'Find unused CSS and JS with the new Coverage drawer.',
+ link: 'https://developers.google.com/web/updates/2017/04/devtools-release-notes#coverage',
+ },
+ {
+ title: 'Full-page screenshots',
+ subtitle:
+ 'Take a screenshot of the entire page, from the top of the viewport to the bottom.',
+ link: 'https://developers.google.com/web/updates/2017/04/devtools-release-notes#screenshots',
+ },
+ {
+ title: 'Block requests',
+ subtitle: 'Manually disable individual requests in the Network panel.',
+ link: 'https://developers.google.com/web/updates/2017/04/devtools-release-notes#block-requests',
+ },
+ {
+ title: 'Step over async await',
+ subtitle: 'Step through async functions predictably.',
+ link: 'https://developers.google.com/web/updates/2017/04/devtools-release-notes#async',
+ },
+ {
+ title: 'Unified Command Menu',
+ subtitle:
+ 'Execute commands and open files from the newly-unified Command Menu (' +
+ n +
+ ').',
+ link: 'https://developers.google.com/web/updates/2017/04/devtools-release-notes#command-menu',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2017/04/devtools-release-notes',
+ },
+ {
+ version: 1,
+ header: 'Highlights from Chrome 58 update',
+ highlights: [
+ {
+ title: 'New Performance and Memory panels',
+ subtitle: 'Head to Performance for JavaScript profiling',
+ link: 'https://developers.google.com/web/updates/2017/03/devtools-release-notes#performance-panel',
+ },
+ {
+ title: 'Editable cookies',
+ subtitle:
+ 'You can edit any existing cookies and create new ones in the Application panel',
+ link: 'https://developers.google.com/web/updates/2017/03/devtools-release-notes#cookies',
+ },
+ {
+ title: 'Console filtering & settings',
+ subtitle:
+ 'Use the text filter or click the Console settings icon to touch up your preferences',
+ link: 'https://developers.google.com/web/updates/2017/03/devtools-release-notes#console',
+ },
+ {
+ title: 'Debugger catches out-of-memory errors',
+ subtitle:
+ 'See the stack or grab a heap snapshot to see why the app may crash',
+ link: 'https://developers.google.com/web/updates/2017/03/devtools-release-notes#out-of-memory-breakpoints',
+ },
+ ],
+ link: 'https://developers.google.com/web/updates/2017/03/devtools-release-notes',
+ },
+]
+var p = Object.freeze({ __proto__: null, releaseNoteText: d })
+let h, c, g, u, v, m, b
+function w() {
+ return (
+ h || (h = (c || d).reduce((e, t) => (t.version > e.version ? t : e))), h
+ )
+}
+function k() {
+ f(
+ e.Settings.Settings.instance()
+ .createSetting('releaseNoteVersionSeen', 0)
+ .get(),
+ w().version,
+ e.Settings.Settings.instance().moduleSetting('help.show-release-note').get()
+ )
+}
+function f(t, s, l) {
+ const i = e.Settings.Settings.instance().createSetting(
+ 'releaseNoteVersionSeen',
+ 0
+ )
+ return t
+ ? !!l &&
+ !(t >= s) &&
+ (i.set(s),
+ o.ViewManager.ViewManager.instance().showView('release-note', !0),
+ !0)
+ : (i.set(s), !1)
+}
+class y {
+ static instance(e = { forceNew: null }) {
+ const { forceNew: t } = e
+ return (u && !t) || (u = new y()), u
+ }
+ async run() {
+ t.InspectorFrontendHost.isUnderTest() || k()
+ }
+}
+class C {
+ handleAction(e, o) {
+ return (
+ t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(
+ w().link
+ ),
+ !0
+ )
+ }
+ static instance(e = { forceNew: null }) {
+ const { forceNew: t } = e
+ return (v && !t) || (v = new C()), v
+ }
+}
+class S {
+ handleAction(e, o) {
+ return (
+ t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(
+ 'https://bugs.chromium.org/p/chromium/issues/entry?template=DevTools+issue'
+ ),
+ !0
+ )
+ }
+ static instance(e = { forceNew: null }) {
+ const { forceNew: t } = e
+ return (m && !t) || (m = new S()), m
+ }
+}
+class x {
+ handleAction(e, o) {
+ return (
+ t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(
+ 'https://goo.gle/devtools-translate'
+ ),
+ !0
+ )
+ }
+ static instance(e = { forceNew: null }) {
+ const { forceNew: t } = e
+ return (b && !t) || (b = new x()), b
+ }
+}
+var N = Object.freeze({
+ __proto__: null,
+ releaseVersionSeen: 'releaseNoteVersionSeen',
+ releaseNoteViewId: 'release-note',
+ latestReleaseNote: w,
+ showReleaseNoteIfNeeded: k,
+ setReleaseNotesForTest: function (e) {
+ c = e
+ },
+ getReleaseNoteVersionSetting: function () {
+ return (
+ g ||
+ (g = e.Settings.Settings.instance().createSetting(
+ 'releaseNoteVersionSeen',
+ 0
+ )),
+ g
+ )
+ },
+ innerShowReleaseNoteIfNeeded: f,
+ HelpLateInitialization: y,
+ ReleaseNotesActionDelegate: C,
+ ReportIssueActionDelegate: S,
+ ReportTranslationIssueActionDelegate: x,
+})
+const T = new CSSStyleSheet()
+T.replaceSync(
+ '.hbox{overflow-y:auto;overflow-x:hidden}.release-note-top-section{height:27px;line-height:27px;padding:0 15px;flex:none;color:var(--color-text-primary);background-color:var(--color-background-elevation-1);border-bottom:var(--legacy-divider-border);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.release-note-container{display:flex;flex-direction:column}.release-note-container ul{display:flex;padding:10px 16px;flex-direction:column;flex:none;margin:4px 12px 0 2px;max-width:600px}.release-note-container li{display:flex;flex-direction:column;flex:none;line-height:24px;font-size:14px}.release-note-container .release-note-link{border:1px solid var(--color-details-hairline-light);padding-left:8px;padding-right:8px;margin-bottom:4px;text-decoration:none}.release-note-container .release-note-link:hover{border-color:var(--color-details-hairline)}.release-note-subtitle,.release-note-title{color:inherit;text-decoration:none}.release-note-subtitle{font-size:13px;line-height:13px;padding-bottom:8px}.release-note-container li:not(:hover) .release-note-subtitle{color:var(--color-text-secondary)}.release-note-action-container>button{margin:10px 0 20px 20px;color:var(--color-text-secondary)}.release-note-action-container{flex:none}.release-note-image{flex-shrink:2}img{margin:20px;width:260px;height:200px;flex:none;box-shadow:var(--drop-shadow-depth-1)}img:hover{box-shadow:var(--drop-shadow-depth-4)}@media (forced-colors:active){.release-note-container .release-note-link{border-color:ButtonText}.release-note-container .release-note-link:hover{forced-color-adjust:none;border-color:Highlight}.release-note-container li .release-note-title,.release-note-container li:not(:hover) .release-note-subtitle{forced-color-adjust:none;color:linktext}}\n/*# sourceURL=releaseNote.css */\n'
+)
+const P = { learnMore: 'Learn more', close: 'Close' },
+ I = s.i18n.registerUIStrings('panels/help/ReleaseNoteView.ts', P),
+ H = s.i18n.getLocalizedString.bind(void 0, I)
+let A
+class M extends o.Widget.VBox {
+ releaseNoteElement
+ constructor() {
+ super(!0), (this.releaseNoteElement = this.createReleaseNoteElement(w()))
+ ;(this.contentElement.createChild(
+ 'div',
+ 'release-note-top-section'
+ ).textContent = w().header),
+ this.contentElement.appendChild(this.releaseNoteElement)
+ }
+ static instance(e = { forceNew: null }) {
+ const { forceNew: t } = e
+ return (A && !t) || (A = new M()), A
+ }
+ elementsToRestoreScrollPositionsFor() {
+ return [this.releaseNoteElement]
+ }
+ createReleaseNoteElement(e) {
+ const s = document.createElement('div')
+ s.classList.add('hbox')
+ const l = s.createChild('div', 'release-note-container'),
+ i = l.createChild('ul')
+ o.ARIAUtils.setAccessibleName(i, w().header)
+ let n = 1
+ for (const t of e.highlights) {
+ const s = i.createChild('li'),
+ l = o.XLink.XLink.create(t.link, '', 'release-note-link')
+ ;(l.textContent = ''),
+ o.ARIAUtils.markAsLink(l),
+ o.ARIAUtils.setAccessibleName(
+ l,
+ `${t.title}: ${t.subtitle} ${n} of ${e.highlights.length}`
+ )
+ l.createChild('div', 'release-note-title').textContent = t.title
+ ;(l.createChild('div', 'release-note-subtitle').textContent = t.subtitle),
+ s.appendChild(l),
+ n++
+ }
+ const r = l.createChild('div', 'release-note-action-container'),
+ a = o.UIUtils.createTextButton(H(P.learnMore), (o) => {
+ o.consume(!0),
+ t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(
+ e.link
+ )
+ })
+ o.ARIAUtils.markAsLink(a),
+ r.appendChild(a),
+ r.appendChild(
+ o.UIUtils.createTextButton(
+ H(P.close),
+ (e) => {
+ e.consume(!0),
+ o.InspectorView.InspectorView.instance().closeDrawerTab(
+ 'release-note',
+ !0
+ )
+ },
+ 'close-release-note'
+ )
+ )
+ const d = o.XLink.XLink.create(e.link, ' ')
+ d.classList.add('release-note-image')
+ const p = w().header
+ o.Tooltip.Tooltip.install(d, p), s.appendChild(d)
+ const h = d.createChild('img')
+ return (
+ (h.src = new URL(
+ '../../Images/whatsnew.avif',
+ import.meta.url
+ ).toString()),
+ o.Tooltip.Tooltip.install(h, p),
+ (h.alt = p),
+ s
+ )
+ }
+ wasShown() {
+ super.wasShown(), this.registerCSSFiles([T])
+ }
+}
+var R = Object.freeze({ __proto__: null, ReleaseNoteView: M })
+export { N as Help, p as ReleaseNoteText, R as ReleaseNoteView }
diff --git a/chii/panels/input/input-meta.js b/chii/panels/input/input-meta.js
new file mode 100644
index 00000000..fddd9301
--- /dev/null
+++ b/chii/panels/input/input-meta.js
@@ -0,0 +1 @@
+import*as e from"../../core/i18n/i18n.js";import*as t from"../../core/root/root.js";import*as i from"../../ui/legacy/legacy.js";const n={inputs:"Inputs",pause:"Pause",resume:"Resume",showInputs:"Show Inputs",startRecording:"Start recording",startReplaying:"Start replaying",stopRecording:"Stop recording"},o=e.i18n.registerUIStrings("panels/input//input-meta.ts",n),a=e.i18n.getLazilyComputedLocalizedString.bind(void 0,o);let r;async function s(){return r||(r=await import("./input.js")),r}i.ViewManager.registerViewExtension({location:"drawer-view",id:"Inputs",title:a(n.inputs),commandPrompt:a(n.showInputs),persistence:"closeable",order:7,loadView:async()=>(await s()).InputTimeline.InputTimeline.instance(),experiment:t.Runtime.ExperimentName.TIMELINE_REPLAY_EVENT}),i.ActionRegistration.registerActionExtension({actionId:"input.toggle-recording",iconClass:"largeicon-start-recording",toggleable:!0,toggledIconClass:"largeicon-stop-recording",toggleWithRedColor:!0,loadActionDelegate:async()=>(await s()).InputTimeline.ActionDelegate.instance(),category:i.ActionRegistration.ActionCategory.INPUTS,experiment:t.Runtime.ExperimentName.TIMELINE_REPLAY_EVENT,options:[{value:!0,title:a(n.startRecording)},{value:!1,title:a(n.stopRecording)}]}),i.ActionRegistration.registerActionExtension({actionId:"input.start-replaying",iconClass:"largeicon-play",toggleable:!1,loadActionDelegate:async()=>(await s()).InputTimeline.ActionDelegate.instance(),category:i.ActionRegistration.ActionCategory.INPUTS,experiment:t.Runtime.ExperimentName.TIMELINE_REPLAY_EVENT,options:[{value:!0,title:a(n.startReplaying)}]}),i.ActionRegistration.registerActionExtension({actionId:"input.toggle-pause",iconClass:"largeicon-pause",toggleable:!0,toggledIconClass:"largeicon-resume",loadActionDelegate:async()=>(await s()).InputTimeline.ActionDelegate.instance(),category:i.ActionRegistration.ActionCategory.INPUTS,experiment:t.Runtime.ExperimentName.TIMELINE_REPLAY_EVENT,options:[{value:!0,title:a(n.pause)},{value:!1,title:a(n.resume)}]});
diff --git a/chii/panels/input/input.js b/chii/panels/input/input.js
new file mode 100644
index 00000000..c1214299
--- /dev/null
+++ b/chii/panels/input/input.js
@@ -0,0 +1 @@
+import*as t from"../../core/sdk/sdk.js";import*as e from"../../core/i18n/i18n.js";import*as i from"../../core/platform/platform.js";import*as a from"../../models/bindings/bindings.js";import*as s from"../../ui/legacy/legacy.js";import*as n from"../timeline/timeline.js";class o extends t.SDKModel.SDKModel{inputAgent;eventDispatchTimer;dispatchEventDataList;finishCallback;dispatchingIndex;lastEventTime;replayPaused;constructor(t){super(t),this.inputAgent=t.inputAgent(),this.eventDispatchTimer=0,this.dispatchEventDataList=[],this.finishCallback=null,this.reset()}reset(){this.lastEventTime=null,this.replayPaused=!1,this.dispatchingIndex=0,window.clearTimeout(this.eventDispatchTimer)}setEvents(t){this.dispatchEventDataList=[];for(const e of t.sortedProcesses())for(const i of e.sortedThreads())this.processThreadEvents(t,i);this.dispatchEventDataList.sort((function(t,e){return t.timestamp-e.timestamp}))}startReplay(t){this.reset(),this.finishCallback=t,this.dispatchEventDataList.length?this.dispatchNextEvent():this.replayStopped()}pause(){window.clearTimeout(this.eventDispatchTimer),this.dispatchingIndex>=this.dispatchEventDataList.length?this.replayStopped():this.replayPaused=!0}resume(){this.replayPaused=!1,this.dispatchingIndexthis.selectFileToLoad())),this.saveButton=new s.Toolbar.ToolbarButton(u(p.saveProfile),"largeicon-download"),this.saveButton.addEventListener(s.Toolbar.ToolbarButton.Events.Click,(t=>{this.saveToFile()})),this.panelToolbar.appendSeparator(),this.panelToolbar.appendToolbarItem(this.loadButton),this.panelToolbar.appendToolbarItem(this.saveButton),this.panelToolbar.appendSeparator(),this.createFileSelector(),this.updateControls()}static instance(t={forceNew:!1}){const{forceNew:e}=t;return m&&!e||(m=new v),m}reset(){this.tracingClient=null,this.tracingModel=null,this.inputModel=null,this.setState("Idle")}createFileSelector(){this.fileSelectorElement&&this.fileSelectorElement.remove(),this.fileSelectorElement=s.UIUtils.createFileSelectorElement(this.loadFromFile.bind(this)),this.element.appendChild(this.fileSelectorElement)}wasShown(){super.wasShown(),this.registerCSSFiles([d])}willHide(){}setState(t){this.state=t,this.updateControls()}isAvailableState(){return"Idle"===this.state||"ReplayPaused"===this.state}updateControls(){this.toggleRecordAction.setToggled("Recording"===this.state),this.toggleRecordAction.setEnabled(this.isAvailableState()||"Recording"===this.state),this.startReplayAction.setEnabled(this.isAvailableState()&&Boolean(this.tracingModel)),this.togglePauseAction.setEnabled("Replaying"===this.state||"ReplayPaused"===this.state),this.togglePauseAction.setToggled("ReplayPaused"===this.state),this.clearButton.setEnabled(this.isAvailableState()),this.loadButton.setEnabled(this.isAvailableState()),this.saveButton.setEnabled(this.isAvailableState()&&Boolean(this.tracingModel))}toggleRecording(){switch(this.state){case"Recording":this.stopRecording();break;case"Idle":this.startRecording()}}startReplay(){this.replayEvents()}toggleReplayPause(){switch(this.state){case"Replaying":this.pauseReplay();break;case"ReplayPaused":this.resumeReplay()}}async saveToFile(){if(console.assert("Idle"===this.state),!this.tracingModel)return;const t=`InputProfile-${i.DateUtilities.toISO8601Compact(new Date)}.json`,e=new a.FileUtils.FileOutputStream;if(!await e.open(t))return;const s=this.tracingModel.backingStorage();await s.writeToStream(e),e.close()}selectFileToLoad(){this.fileSelectorElement&&this.fileSelectorElement.click()}loadFromFile(t){console.assert(this.isAvailableState()),this.setState("Loading"),this.loader=n.TimelineLoader.TimelineLoader.loadFromFile(t,this),this.createFileSelector()}async startRecording(){this.setState("StartPending"),this.tracingClient=new T(t.TargetManager.TargetManager.instance().mainTarget(),this);const e=await this.tracingClient.startRecording();!e||e.getError()?this.recordingFailed():this.setState("Recording")}async stopRecording(){this.tracingClient&&(this.setState("StopPending"),await this.tracingClient.stopRecording(),this.tracingClient=null)}async replayEvents(){this.inputModel&&(this.setState("Replaying"),await this.inputModel.startReplay(this.replayStopped.bind(this)))}pauseReplay(){this.inputModel&&(this.inputModel.pause(),this.setState("ReplayPaused"))}resumeReplay(){this.inputModel&&(this.inputModel.resume(),this.setState("Replaying"))}loadingStarted(){}loadingProgress(t){}processingStarted(){}loadingComplete(e){e?(this.inputModel=new o(t.TargetManager.TargetManager.instance().mainTarget()),this.tracingModel=e,this.inputModel.setEvents(e),this.setState("Idle")):this.reset()}recordingFailed(){this.tracingClient=null,this.setState("Idle")}replayStopped(){this.setState("Idle")}}class y{static instance(t={forceNew:null}){const{forceNew:e}=t;return b&&!e||(b=new y),b}handleAction(t,e){const i="Inputs";return s.ViewManager.ViewManager.instance().showView(i).then((()=>s.ViewManager.ViewManager.instance().view(i).widget())).then((t=>this.innerHandleAction(t,e))),!0}innerHandleAction(t,e){switch(e){case"input.toggle-recording":t.toggleRecording();break;case"input.start-replaying":t.startReplay();break;case"input.toggle-pause":t.toggleReplayPause();break;default:console.assert(!1,`Unknown action: ${e}`)}}}class T{target;tracingManager;client;tracingModel;tracingCompleteCallback;constructor(e,i){this.target=e,this.tracingManager=e.model(t.TracingManager.TracingManager),this.client=i;const s=new a.TempFile.TempFileBackingStorage;this.tracingModel=new t.TracingModel.TracingModel(s),this.tracingCompleteCallback=null}async startRecording(){if(!this.tracingManager)return;const t=["devtools.timeline","disabled-by-default-devtools.timeline.inputs"].join(","),e=await this.tracingManager.start(this,t,"");return e.getError()&&await this.waitForTracingToStop(!1),e}async stopRecording(){this.tracingManager&&this.tracingManager.stop(),await this.waitForTracingToStop(!0),await t.TargetManager.TargetManager.instance().resumeAllTargets(),this.tracingModel.tracingComplete(),this.client.loadingComplete(this.tracingModel)}traceEventsCollected(t){this.tracingModel.addEvents(t)}tracingComplete(){this.tracingCompleteCallback&&this.tracingCompleteCallback(),this.tracingCompleteCallback=null}tracingBufferUsage(t){}eventsRetrievalProgress(t){}waitForTracingToStop(t){return new Promise((e=>{this.tracingManager&&t?this.tracingCompleteCallback=e:e()}))}}var w=Object.freeze({__proto__:null,InputTimeline:v,ActionDelegate:y,TracingClient:T});export{h as InputModel,w as InputTimeline};
diff --git a/chii/panels/issues/components/components.js b/chii/panels/issues/components/components.js
new file mode 100644
index 00000000..84d36f51
--- /dev/null
+++ b/chii/panels/issues/components/components.js
@@ -0,0 +1 @@
+import*as e from"../../../core/common/common.js";import*as t from"../../../core/i18n/i18n.js";import*as n from"../../../ui/components/helpers/helpers.js";import*as o from"../../../ui/components/icon_button/icon_button.js";import*as s from"../../../ui/legacy/legacy.js";import*as i from"../../../ui/lit-html/lit-html.js";const a=new CSSStyleSheet;a.replaceSync(".hide-issues-menu-btn{position:relative;display:flex;background-color:transparent;flex:none;align-items:center;justify-content:center;padding:1px 4px;overflow:hidden;border-radius:0;cursor:pointer;border:none;--icon-color:var(--color-text-primary);opacity:50%}.hide-issues-menu-btn:hover{opacity:100%}\n/*# sourceURL=./hideIssuesMenu.css */\n");const r={tooltipTitle:"Hide issues"},m=t.i18n.registerUIStrings("panels/issues/components/HideIssuesMenu.ts",r),c=t.i18n.getLocalizedString.bind(void 0,m);class l extends HTMLElement{static litTagName=i.literal`devtools-hide-issues-menu`;shadow=this.attachShadow({mode:"open"});menuItemLabel=e.UIString.LocalizedEmptyString;menuItemAction=()=>{};set data(e){this.menuItemLabel=e.menuItemLabel,this.menuItemAction=e.menuItemAction,this.render()}connectedCallback(){this.shadow.adoptedStyleSheets=[a]}onMenuOpen(e){e.stopPropagation();const t=new s.ContextMenu.ContextMenu(e,{useSoftMenu:!0,onSoftMenuClosed:()=>{this.classList.toggle("has-context-menu-opened",!1)}});t.headerSection().appendItem(this.menuItemLabel,(()=>this.menuItemAction())),t.show(),this.classList.toggle("has-context-menu-opened",!0)}render(){i.render(i.html` `,this.shadow,{host:this})}}n.CustomElements.defineComponent("devtools-hide-issues-menu",l);var u=Object.freeze({__proto__:null,HideIssuesMenu:l});export{u as HideIssuesMenu};
diff --git a/chii/panels/issues/issues-meta.js b/chii/panels/issues/issues-meta.js
new file mode 100644
index 00000000..35d76097
--- /dev/null
+++ b/chii/panels/issues/issues-meta.js
@@ -0,0 +1 @@
+import*as e from"../../core/common/common.js";import*as s from"../../core/root/root.js";import*as i from"../../models/issues_manager/issues_manager.js";import*as o from"../../ui/legacy/legacy.js";import*as a from"../../core/i18n/i18n.js";const n={issues:"Issues",showIssues:"Show Issues",cspViolations:"CSP Violations",showCspViolations:"Show CSP Violations"},t=a.i18n.registerUIStrings("panels/issues/issues-meta.ts",n),r=a.i18n.getLazilyComputedLocalizedString.bind(void 0,t);let l;async function m(){return l||(l=await import("./issues.js")),l}o.ViewManager.registerViewExtension({location:"drawer-view",id:"issues-pane",title:r(n.issues),commandPrompt:r(n.showIssues),order:100,persistence:"closeable",loadView:async()=>(await m()).IssuesPane.IssuesPane.instance()}),o.ViewManager.registerViewExtension({location:"drawer-view",id:"csp-violations-pane",title:r(n.cspViolations),commandPrompt:r(n.showCspViolations),order:100,persistence:"closeable",loadView:async()=>(await m()).CSPViolationsView.CSPViolationsView.instance(),experiment:s.Runtime.ExperimentName.CSP_VIOLATIONS_VIEW}),e.Revealer.registerRevealer({contextTypes:()=>[i.Issue.Issue],destination:e.Revealer.RevealerDestination.ISSUES_VIEW,loadRevealer:async()=>(await m()).IssueRevealer.IssueRevealer.instance()});
diff --git a/chii/panels/issues/issues.js b/chii/panels/issues/issues.js
new file mode 100644
index 00000000..cd36dce6
--- /dev/null
+++ b/chii/panels/issues/issues.js
@@ -0,0 +1 @@
+import*as e from"../../models/issues_manager/issues_manager.js";import*as t from"../../core/i18n/i18n.js";import*as s from"../../ui/legacy/legacy.js";import*as i from"../../ui/components/data_grid/data_grid.js";import*as n from"../../ui/components/linkifier/linkifier.js";import*as a from"../../ui/lit-html/lit-html.js";import*as r from"../../core/common/common.js";import*as o from"../../core/root/root.js";import*as d from"../../ui/components/issue_counter/issue_counter.js";import*as l from"../../ui/components/adorners/adorners.js";import*as u from"../../core/host/host.js";import*as c from"../../ui/components/icon_button/icon_button.js";import*as p from"../../ui/components/markdown_view/markdown_view.js";import*as h from"../network/forward/forward.js";import*as g from"./components/components.js";import*as f from"../../core/sdk/sdk.js";import*as m from"../elements/components/components.js";import*as C from"../../models/logs/logs.js";import*as I from"../../ui/legacy/components/utils/utils.js";import*as y from"../../ui/components/request_link_icon/request_link_icon.js";import*as w from"../../core/platform/platform.js";const b=new CSSStyleSheet;b.replaceSync(".csp-violations-pane{overflow:hidden}.csp-violations-toolbar{border-bottom:var(--color-details-hairline)}\n/*# sourceURL=cspViolationsView.css */\n");class v extends s.Toolbar.ToolbarButton{options=new Array;headers=new Array;onOptionClicked=()=>{};constructor(e){super(e),this.turnIntoSelect(),this.addEventListener(s.Toolbar.ToolbarButton.Events.Click,this.showLevelContextMenu.bind(this)),s.ARIAUtils.markAsMenuButton(this.element)}addOption(e,t,s){this.options.push({title:e,value:t,default:s,enabled:s})}setOptionEnabled(e,t){const s=this.options[e];s&&(s.enabled=t,this.onOptionClicked())}addHeader(e,t){this.headers.push({title:e,callback:t})}setOnOptionClicked(e){this.onOptionClicked=e}getOptions(){return this.options}showLevelContextMenu({data:e}){const t=new s.ContextMenu.ContextMenu(e,{useSoftMenu:!0,x:this.element.totalOffsetLeft(),y:this.element.totalOffsetTop()+this.element.offsetHeight});for(const{title:e,callback:s}of this.headers)t.headerSection().appendCheckboxItem(e,(()=>s()));for(const[e,{title:s,enabled:i}]of this.options.entries())t.defaultSection().appendCheckboxItem(s,(()=>{this.setOptionEnabled(e,!i)}),i);t.show()}}const k=new CSSStyleSheet;k.replaceSync("\n/*# sourceURL=cspViolationsListView.css */\n");class R extends s.Widget.VBox{table=new i.DataGridController.DataGridController;categoryFilter=new Set;issueRows=new Map;constructor(){super(!0),this.table.data={columns:[{id:"sourceCode",title:"Source Code",sortable:!1,widthWeighting:1,visible:!0,hideable:!1},{id:"violatedDirective",title:"Violated Directive",sortable:!1,widthWeighting:1,visible:!0,hideable:!1},{id:"category",title:"Category",sortable:!1,widthWeighting:1,visible:!0,hideable:!1},{id:"status",title:"Status",sortable:!1,widthWeighting:1,visible:!0,hideable:!1}],rows:[]},this.contentElement.appendChild(this.table)}updateTextFilter(e){0===e.length?this.table.data={...this.table.data,filters:[]}:this.table.data={...this.table.data,filters:[{text:e,key:void 0,regex:void 0,negative:!1}]}}updateCategoryFilter(e){this.categoryFilter=e;const t=[];for(const[e,s]of this.issueRows.entries())this.isIssueInFilterCategories(e)&&t.push(s);this.table.data={...this.table.data,rows:t}}isIssueInFilterCategories(e){return this.categoryFilter.has(e.code())||0===this.categoryFilter.size}addIssue(t){const s=e.Issue.toZeroBasedLocation(t.details().sourceCodeLocation);if(!s)return;const i=t.details().isReportOnly?"report-only":"blocked",r=this.issueViolationCodeToCategoryName(t.code()),o={cells:[{columnId:"sourceCode",value:s.url,renderer:()=>a.html`<${n.Linkifier.Linkifier.litTagName} .data="${s}">${n.Linkifier.Linkifier.litTagName}>`},{columnId:"violatedDirective",value:t.details().violatedDirective},{columnId:"category",value:r},{columnId:"status",value:i}]};this.issueRows.set(t,o),this.isIssueInFilterCategories(t)&&(this.table.data.rows.push(o),this.table.data={...this.table.data})}clearIssues(){this.issueRows.clear(),this.table.data={...this.table.data,rows:[]}}issueViolationCodeToCategoryName(t){return t===e.ContentSecurityPolicyIssue.inlineViolationCode?"Inline Violation":t===e.ContentSecurityPolicyIssue.urlViolationCode?"URL Violation":t===e.ContentSecurityPolicyIssue.evalViolationCode?"Eval Violation":t===e.ContentSecurityPolicyIssue.trustedTypesSinkViolationCode?"Sink Violation":t===e.ContentSecurityPolicyIssue.trustedTypesPolicyViolationCode?"Policy Violation":"unknown"}wasShown(){super.wasShown(),this.registerCSSFiles([k])}}const S={filter:"Filter"},T=t.i18n.registerUIStrings("panels/issues/CSPViolationsView.ts",S),x=t.i18n.getLocalizedString.bind(void 0,T);let A;class E extends s.Widget.VBox{listView=new R;issuesManager=e.IssuesManager.IssuesManager.instance();constructor(){super(!0),this.contentElement.classList.add("csp-violations-pane");const t=new s.Toolbar.Toolbar("csp-violations-toolbar",this.contentElement),i=new s.Toolbar.ToolbarInput(x(S.filter),"",1,.2,"");i.addEventListener(s.Toolbar.ToolbarInput.Event.TextChanged,(()=>{this.listView.updateTextFilter(i.value())})),t.appendToolbarItem(i);const n=new v("Categories");n.setText("Categories"),n.addOption("Trusted Type Policy",e.ContentSecurityPolicyIssue.trustedTypesPolicyViolationCode,!0),n.addOption("Trusted Type Sink",e.ContentSecurityPolicyIssue.trustedTypesSinkViolationCode,!0),n.addOption("CSP Inline",e.ContentSecurityPolicyIssue.inlineViolationCode,!0),n.addOption("CSP Eval",e.ContentSecurityPolicyIssue.evalViolationCode,!0),n.addOption("CSP URL",e.ContentSecurityPolicyIssue.urlViolationCode,!0),n.addHeader("Reset",(()=>{n.getOptions().forEach(((e,t)=>n.setOptionEnabled(t,e.default)))})),n.setOnOptionClicked((()=>{const e=new Set(n.getOptions().filter((e=>e.enabled)).map((e=>e.value)));this.listView.updateCategoryFilter(e)})),t.appendToolbarItem(n),this.listView.show(this.contentElement),this.issuesManager.addEventListener("IssueAdded",this.onIssueAdded,this),this.issuesManager.addEventListener("FullUpdateRequired",this.onFullUpdateRequired,this),this.addAllIssues()}static instance(e={forceNew:null}){const{forceNew:t}=e;return A&&!t||(A=new E),A}onIssueAdded(t){const{issue:s}=t.data;s instanceof e.ContentSecurityPolicyIssue.ContentSecurityPolicyIssue&&this.listView.addIssue(s)}onFullUpdateRequired(){this.listView.clearIssues(),this.addAllIssues()}addAllIssues(){for(const t of this.issuesManager.issues())t instanceof e.ContentSecurityPolicyIssue.ContentSecurityPolicyIssue&&this.listView.addIssue(t)}wasShown(){super.wasShown(),this.registerCSSFiles([b])}}var L=Object.freeze({__proto__:null,CSPViolationsView:E});class M extends e.Issue.Issue{affectedCookies=new Map;affectedRawCookieLines=new Map;affectedRequests=new Map;affectedLocations=new Map;heavyAdIssues=new Set;blockedByResponseDetails=new Map;corsIssues=new Set;cspIssues=new Set;issueKind=e.Issue.IssueKind.Improvement;lowContrastIssues=new Set;mixedContentIssues=new Set;sharedArrayBufferIssues=new Set;trustedWebActivityIssues=new Set;quirksModeIssues=new Set;attributionReportingIssues=new Set;wasmCrossOriginModuleSharingIssues=new Set;genericIssues=new Set;representative;aggregatedIssuesCount=0;key;constructor(e,t){super(e),this.key=t}primaryKey(){throw new Error("This should never be called")}aggregationKey(){return this.key}getBlockedByResponseDetails(){return this.blockedByResponseDetails.values()}cookies(){return Array.from(this.affectedCookies.values()).map((e=>e.cookie))}getRawCookieLines(){return this.affectedRawCookieLines.values()}sources(){return this.affectedLocations.values()}cookiesWithRequestIndicator(){return this.affectedCookies.values()}getHeavyAdIssues(){return this.heavyAdIssues}getMixedContentIssues(){return this.mixedContentIssues}getTrustedWebActivityIssues(){return this.trustedWebActivityIssues}getCorsIssues(){return this.corsIssues}getCspIssues(){return this.cspIssues}getLowContrastIssues(){return this.lowContrastIssues}requests(){return this.affectedRequests.values()}getSharedArrayBufferIssues(){return this.sharedArrayBufferIssues}getQuirksModeIssues(){return this.quirksModeIssues}getAttributionReportingIssues(){return this.attributionReportingIssues}getWasmCrossOriginModuleSharingIssue(){return this.wasmCrossOriginModuleSharingIssues}getGenericIssues(){return this.genericIssues}getDescription(){return this.representative?this.representative.getDescription():null}getCategory(){return this.representative?this.representative.getCategory():e.Issue.IssueCategory.Other}getAggregatedIssuesCount(){return this.aggregatedIssuesCount}keyForCookie(e){const{domain:t,path:s,name:i}=e;return`${t};${s};${i}`}addInstance(t){this.aggregatedIssuesCount++,this.representative||(this.representative=t),this.issueKind=e.Issue.unionIssueKind(this.issueKind,t.getKind());let s=!1;for(const e of t.requests())s=!0,this.affectedRequests.has(e.requestId)||this.affectedRequests.set(e.requestId,e);for(const e of t.cookies()){const t=this.keyForCookie(e);this.affectedCookies.has(t)||this.affectedCookies.set(t,{cookie:e,hasRequest:s})}for(const e of t.rawCookieLines())this.affectedRawCookieLines.has(e)||this.affectedRawCookieLines.set(e,{rawCookieLine:e,hasRequest:s});for(const e of t.sources()){const t=JSON.stringify(e);this.affectedLocations.has(t)||this.affectedLocations.set(t,e)}t instanceof e.MixedContentIssue.MixedContentIssue&&this.mixedContentIssues.add(t),t instanceof e.HeavyAdIssue.HeavyAdIssue&&this.heavyAdIssues.add(t);for(const e of t.getBlockedByResponseDetails()){const t=JSON.stringify(e,["parentFrame","blockedFrame","requestId","frameId","reason","request"]);this.blockedByResponseDetails.set(t,e)}t instanceof e.TrustedWebActivityIssue.TrustedWebActivityIssue&&this.trustedWebActivityIssues.add(t),t instanceof e.ContentSecurityPolicyIssue.ContentSecurityPolicyIssue&&this.cspIssues.add(t),t instanceof e.SharedArrayBufferIssue.SharedArrayBufferIssue&&this.sharedArrayBufferIssues.add(t),t instanceof e.LowTextContrastIssue.LowTextContrastIssue&&this.lowContrastIssues.add(t),t instanceof e.CorsIssue.CorsIssue&&this.corsIssues.add(t),t instanceof e.QuirksModeIssue.QuirksModeIssue&&this.quirksModeIssues.add(t),t instanceof e.AttributionReportingIssue.AttributionReportingIssue&&this.attributionReportingIssues.add(t),t instanceof e.WasmCrossOriginModuleSharingIssue.WasmCrossOriginModuleSharingIssue&&this.wasmCrossOriginModuleSharingIssues.add(t),t instanceof e.GenericIssue.GenericIssue&&this.genericIssues.add(t)}getKind(){return this.issueKind}isHidden(){return this.representative?.isHidden()||!1}setHidden(e){throw new Error("Should not call setHidden on aggregatedIssue")}}class D extends r.ObjectWrapper.ObjectWrapper{issuesManager;aggregatedIssuesByKey=new Map;hiddenAggregatedIssuesByKey=new Map;constructor(e){super(),this.issuesManager=e,this.issuesManager.addEventListener("IssueAdded",this.onIssueAdded,this),this.issuesManager.addEventListener("FullUpdateRequired",this.onFullUpdateRequired,this);for(const e of this.issuesManager.issues())this.aggregateIssue(e)}onIssueAdded(e){this.aggregateIssue(e.data.issue)}onFullUpdateRequired(){this.aggregatedIssuesByKey.clear(),this.hiddenAggregatedIssuesByKey.clear();for(const e of this.issuesManager.issues())this.aggregateIssue(e);this.dispatchEventToListeners("FullUpdateRequired")}aggregateIssue(e){const t=e.isHidden()?this.hiddenAggregatedIssuesByKey:this.aggregatedIssuesByKey,s=this.aggregateIssueByStatus(t,e);return this.dispatchEventToListeners("AggregatedIssueUpdated",s),s}aggregateIssueByStatus(e,t){const s=t.code();let i=e.get(s);return i||(i=new M(t.code(),s),e.set(s,i)),i.addInstance(t),i}aggregatedIssues(){return[...this.aggregatedIssuesByKey.values(),...this.hiddenAggregatedIssuesByKey.values()]}hiddenAggregatedIssues(){return this.hiddenAggregatedIssuesByKey.values()}aggregatedIssueCodes(){return new Set([...this.aggregatedIssuesByKey.keys(),...this.hiddenAggregatedIssuesByKey.keys()])}aggregatedIssueCategories(){const e=new Set;for(const t of this.aggregatedIssuesByKey.values())e.add(t.getCategory());return e}aggregatedIssueKinds(){const e=new Set;for(const t of this.aggregatedIssuesByKey.values())e.add(t.getKind());return e}numberOfAggregatedIssues(){return this.aggregatedIssuesByKey.size}numberOfHiddenAggregatedIssues(){return this.hiddenAggregatedIssuesByKey.size}keyForIssue(e){return e.code()}}var P=Object.freeze({__proto__:null,AggregatedIssue:M,IssueAggregator:D});const O={hiddenIssues:"Hidden issues",unhideAll:"Unhide all"},q=t.i18n.registerUIStrings("panels/issues/HiddenIssuesRow.ts",O),V=t.i18n.getLocalizedString.bind(void 0,q);class U extends s.TreeOutline.TreeElement{numHiddenAggregatedIssues;constructor(){super(void 0,!0),this.numHiddenAggregatedIssues=document.createElement("span"),this.toggleOnClick=!0,this.listItemElement.classList.add("issue-category","hidden-issues"),this.childrenListElement.classList.add("hidden-issues-body"),this.appendHeader()}appendHeader(){const t=s.UIUtils.createTextButton(V(O.unhideAll),(()=>e.IssuesManager.IssuesManager.instance().unhideAllIssues()),"unhide-all-issues-button"),i=new l.Adorner.Adorner;i.data={name:"countWrapper",content:this.numHiddenAggregatedIssues},i.classList.add("aggregated-issues-count"),this.numHiddenAggregatedIssues.textContent="0";const n=document.createElement("div"),a=document.createElement("div");n.classList.add("header"),a.classList.add("title"),a.textContent=V(O.hiddenIssues),n.appendChild(i),n.appendChild(a),n.appendChild(t),this.listItemElement.appendChild(n)}update(e){this.numHiddenAggregatedIssues.textContent=`${e}`}}const F=new CSSStyleSheet;F.replaceSync(".issues-pane{overflow:hidden}.issues-pane-no-issues{align-items:center;background-color:var(--color-background);display:flex;flex:1 1 auto;font-size:18px;justify-content:center;padding:30px}.issues-toolbar-container{display:flex;flex:none}.issues-toolbar-container>.toolbar{background-color:var(--color-background-elevation-1);border-bottom:1px solid var(--color-details-hairline)}.issues-toolbar-left{flex:1 1 auto}.issues-toolbar-right{padding-right:6px}\n/*# sourceURL=issuesPane.css */\n");const H=new CSSStyleSheet;H.replaceSync('.issues,:host{padding:0;overflow:auto}.issues{--issue-indent:8px}.issues li{white-space:normal}.issues .always-parent::before{display:none}.issues li.parent::before{transition:transform .2s;transform-origin:25% 50%}.issues li.parent.expanded::before{-webkit-mask-position:0 0;transform:rotate(90deg)}.issue,.issue-category,.issue-kind{padding:0 8px;padding-left:var(--issue-indent);overflow:hidden;flex:none;transition:background-color .2s;border:1px solid var(--color-details-hairline-light);border-width:0 0 1px}.issue-category.hidden-issues.parent.expanded,.issue-kind.parent.expanded{border-width:0 0 1px;background-color:var(--color-background-elevation-1)}.issue-category+.children .issue,.issue.expanded{background:var(--color-background)}.issue.expanded{border-width:0}.issue.expanded.selected,.issue.selected{background-color:var(--legacy-focus-bg-color)}.unhide-all-issues-button{line-height:normal}p{margin-block-start:2px;margin-block-end:2px}.tree-outline-disclosure:not(.tree-outline-disclosure-hide-overflow) .tree-outline.hide-selection-when-blurred .issue-category.selected:focus-visible,.tree-outline-disclosure:not(.tree-outline-disclosure-hide-overflow) .tree-outline.hide-selection-when-blurred .issue-kind.selected:focus-visible,.tree-outline-disclosure:not(.tree-outline-disclosure-hide-overflow) .tree-outline.hide-selection-when-blurred .issue.selected:focus-visible{width:auto;padding-right:8px}.header{display:flex;flex-direction:row;align-items:center;padding:6px 0;cursor:pointer;width:100%}.header devtools-hide-issues-menu{display:none}.header:hover devtools-hide-issues-menu{display:block}.header devtools-hide-issues-menu.has-context-menu-opened{display:block}.issue-category .header,.issue-kind .header{line-height:24px;padding-left:2px}.title{flex:1;font-size:14px;color:var(--color-text-primary);font-weight:400;user-select:text}.issue.expanded .title{font-weight:450}.body.children{border-bottom:1px solid var(--color-details-hairline-light);padding:6px 0;position:relative;padding-left:calc(var(--issue-indent) + 43px);padding-bottom:26px;padding-right:8px}.issue-category+.children,.issue-kind+.children{--issue-indent:24px;padding-left:0}.body::before{content:"";display:block;position:absolute;left:calc(var(--issue-indent) + 23px);top:0;bottom:20px;width:2px}.issue-kind-breaking-change.body::before{border-left:2px solid var(--issue-color-yellow)}.issue-kind-page-error.body::before{border-left:2px solid var(--issue-color-red)}.issue-kind-improvement.body::before{border-left:2px solid var(--issue-color-blue)}devtools-icon.leading-issue-icon{margin:0 7px}.message{line-height:20px;font-size:14px;color:var(--color-text-secondary);margin-bottom:4px;user-select:text}.message p{margin-bottom:16px}.message li{margin-top:8px}.message code{color:var(--color-text-primary);font-size:12px;user-select:text;cursor:text;background:var(--color-background-elevation-1)}.separator::before{content:"·";padding-left:1ex;padding-right:1ex}.link{font-size:14px;color:var(--color-link)}.link-wrapper{margin-top:15px;user-select:text}.affected-resources-label,.resolutions-label{margin-top:5px;font-size:10px;font-weight:500;letter-spacing:.06em;text-transform:uppercase;color:var(--color-text-primary);display:inline-block}.link-list{list-style-type:none;list-style-position:inside;padding-inline-start:0}.resolutions-list{list-style-type:none;list-style-position:inside;padding-inline-start:0}.link-list li::before{content:none;-webkit-mask-image:none}.resolutions-list li::before{content:"→";-webkit-mask-image:none;padding-right:5px;position:relative;top:-1px}.resolutions-list li{display:list-item}ul>li.plain-enum{display:list-item}ul>li.plain-enum::before{content:"";padding:0;margin:0;max-width:0}.affected-resources-label+.affected-resources{padding:3px 0 0;position:relative;user-select:text}.affected-resource-label{font-size:14px;line-height:20px;color:var(--color-text-primary);position:relative;cursor:pointer}.affected-resource-cookie{font-size:14px;line-height:20px;border:0;border-collapse:collapse}.affected-resource-element{font-size:14px;line-height:20px;color:var(--color-link);border:0;border-collapse:collapse}.affected-resource-row{font-size:14px;line-height:20px;border:0;border-collapse:collapse;vertical-align:top}.affected-resource-mixed-content{font-size:14px;line-height:20px;border:0;border-collapse:collapse}.affected-resource-heavy-ad{font-size:14px;line-height:20px;border:0;border-collapse:collapse}.affected-resource-request{font-size:14px;line-height:20px;border:0;border-collapse:collapse}.affected-resource-source{font-size:14px;line-height:20px;color:var(--color-link);border:0;border-collapse:collapse}.affected-resource-list{border-spacing:10px 0;margin-left:-12px}.affected-resource-header{font-size:12px;color:var(--color-text-primary);padding-left:2px}.code-example{font-family:var(--monospace-font-family);font-size:var(--monospace-font-size)}.affected-resource-blocked-status{color:var(--issue-color-red)}.affected-resource-report-only-status{color:var(--issue-color-yellow)}.affected-resource-cookie-info{color:var(--color-text-secondary);padding:2px;text-align:right}.affected-resource-cookie-info-header{text-align:right}.affected-resource-mixed-content-info{color:var(--color-text-secondary);padding:2px}.affected-resource-heavy-ad-info{color:var(--color-text-secondary);padding:2px}.affected-resource-heavy-ad-info-frame{display:flex;align-items:center;color:var(--color-text-secondary);padding:2px}.affected-resource-cell{color:var(--color-text-secondary);padding:2px}.affected-resource-cell.link{color:var(--color-link)}.affected-resource-cell span.icon{margin-right:.5ex;vertical-align:sub}.affected-resources>.parent{margin-top:0;padding:2px 5px 0}.affected-resources>.parent.expanded{background:var(--color-background-elevation-0)}.affected-resources>.children.expanded{background:var(--color-background-elevation-0);padding:6px 0 9px 5px;margin-bottom:10px}.aggregated-issues-count{padding-right:7px}.affected-resource-directive-info-header{text-align:left}.affected-resource-directive{font-size:14px;line-height:20px;border:0;border-collapse:collapse}.affected-resource-directive-info{color:var(--color-text-secondary);padding:2px;text-align:left}.devtools-link{padding-top:4px}devtools-icon.link-icon{vertical-align:sub;margin-right:.5ch}devtools-icon.elements-panel,devtools-icon.network-panel{margin-right:.5ex;vertical-align:baseline;height:14px}@media (forced-colors:active){.title{color:ButtonText}.tree-outline.hide-selection-when-blurred .selected:focus-visible .header .title,.tree-outline:not(.hide-selection-when-blurred) .selected .header .title{color:HighlightText}}\n/*# sourceURL=issuesTree.css */\n');const B={unknown:"unknown",clickToRevealTheFramesDomNodeIn:"Click to reveal the frame's DOM node in the Elements panel",unavailable:"unavailable"},N=t.i18n.registerUIStrings("panels/issues/AffectedResourcesView.ts",B),W=t.i18n.getLocalizedString.bind(void 0,N);class K extends s.TreeOutline.TreeElement{parentView;issue;affectedResourcesCountElement;affectedResources;affectedResourcesCount;frameListeners;unresolvedFrameIds;requestResolver;constructor(e,t){super(),this.parentView=e,this.issue=t,this.toggleOnClick=!0,this.affectedResourcesCountElement=this.createAffectedResourcesCounter(),this.affectedResources=this.createAffectedResources(),this.affectedResourcesCount=0,this.requestResolver=new C.RequestResolver.RequestResolver,this.frameListeners=[],this.unresolvedFrameIds=new Set}setIssue(e){this.issue=e}createAffectedResourcesCounter(){const e=document.createElement("div");return e.classList.add("affected-resource-label"),this.listItemElement.appendChild(e),e}createAffectedResources(){const e=new s.TreeOutline.TreeElement,t=document.createElement("table");return t.classList.add("affected-resource-list"),e.listItemElement.appendChild(t),this.appendChild(e),t}updateAffectedResourceCount(e){this.affectedResourcesCount=e,this.affectedResourcesCountElement.textContent=this.getResourceNameWithCount(e),this.hidden=0===this.affectedResourcesCount,this.parentView.updateAffectedResourceVisibility()}isEmpty(){return 0===this.affectedResourcesCount}clear(){this.affectedResources.textContent="",this.requestResolver.clear()}expandIfOneResource(){1===this.affectedResourcesCount&&this.expand()}resolveFrameId(e){const t=f.FrameManager.FrameManager.instance().getFrame(e);if(!(t&&t.url||(this.unresolvedFrameIds.add(e),this.frameListeners.length))){const e=f.FrameManager.FrameManager.instance().addEventListener(f.FrameManager.Events.FrameAddedToTarget,this.onFrameChanged,this),t=f.FrameManager.FrameManager.instance().addEventListener(f.FrameManager.Events.FrameNavigated,this.onFrameChanged,this);this.frameListeners=[e,t]}return t}onFrameChanged(e){const t=e.data.frame;if(!t.url)return;const s=this.unresolvedFrameIds.delete(t.id);0===this.unresolvedFrameIds.size&&this.frameListeners.length&&(r.EventTarget.removeEventListeners(this.frameListeners),this.frameListeners=[]),s&&this.update()}createFrameCell(e,t){const s=this.resolveFrameId(e),i=s&&(s.unreachableUrl()||s.url)||W(B.unknown),n=document.createElement("td");if(n.classList.add("affected-resource-cell"),s){const s=new c.Icon.Icon;s.data={iconName:"elements_panel_icon",color:"var(--color-link)",width:"16px",height:"16px"},s.classList.add("link","elements-panel"),s.onclick=async()=>{u.userMetrics.issuesPanelResourceOpened(t,"Element");const s=f.FrameManager.FrameManager.instance().getFrame(e);if(s){const e=await s.getOwnerDOMNodeOrDocument();e&&r.Revealer.reveal(e)}},s.title=W(B.clickToRevealTheFramesDomNodeIn),n.appendChild(s)}return n.appendChild(document.createTextNode(i)),n.onmouseenter=()=>{const t=f.FrameManager.FrameManager.instance().getFrame(e);t&&t.highlight()},n.onmouseleave=()=>f.OverlayModel.OverlayModel.hideDOMNodeHighlight(),n}createRequestCell(e,t={}){const s=document.createElement("td");s.classList.add("affected-resource-cell");const i=new y.RequestLinkIcon.RequestLinkIcon;return i.data={...t,affectedRequest:e,requestResolver:this.requestResolver,displayURL:!0},s.appendChild(i),s}async createElementCell({backendNodeId:e,nodeName:t,target:s},i){if(!s){const e=document.createElement("td");return e.textContent=t||W(B.unavailable),e}function n(){u.userMetrics.issuesPanelResourceOpened(i,"Element")}const a=new f.DOMModel.DeferredDOMNode(s,e),o=await r.Linkifier.Linkifier.linkify(a);o.textContent=t,o.addEventListener("click",(()=>n())),o.addEventListener("keydown",(e=>{"Enter"===e.key&&n()}));const d=document.createElement("td");return d.classList.add("affected-resource-element","devtools-link"),d.appendChild(o),d}appendSourceLocation(e,t,s){const i=document.createElement("td");if(i.classList.add("affected-source-location"),t){const e=40,n=new I.Linkifier.Linkifier(e).linkifyScriptLocation(s||null,t.scriptId||null,t.url,t.lineNumber,{columnNumber:t.columnNumber,inlineFrameIndex:0,className:void 0,tabStop:void 0});i.appendChild(n)}e.appendChild(i)}appendColumnTitle(e,t,s=null){const i=document.createElement("td");i.classList.add("affected-resource-header"),s&&i.classList.add(s),i.textContent=t,e.appendChild(i)}createIssueDetailCell(e,t=null){const s=document.createElement("td");return s.textContent=e,t&&s.classList.add(t),s}appendIssueDetailCell(e,t,s=null){const i=this.createIssueDetailCell(t,s);return e.appendChild(i),i}}const z={nDirectives:"{n, plural, =1 {# directive} other {# directives}}",reportonly:"report-only",blocked:"blocked",clickToRevealTheViolatingDomNode:"Click to reveal the violating DOM node in the Elements panel",directiveC:"Directive",element:"Element",sourceLocation:"Source Location",status:"Status",resourceC:"Resource"},_=t.i18n.registerUIStrings("panels/issues/AffectedDirectivesView.ts",z),j=t.i18n.getLocalizedString.bind(void 0,_);class G extends K{appendStatus(e,t){const s=document.createElement("td");t?(s.classList.add("affected-resource-report-only-status"),s.textContent=j(z.reportonly)):(s.classList.add("affected-resource-blocked-status"),s.textContent=j(z.blocked)),e.appendChild(s)}getResourceNameWithCount(e){return j(z.nDirectives,{n:e})}appendViolatedDirective(e,t){const s=document.createElement("td");s.textContent=t,e.appendChild(s)}appendBlockedURL(e,t){const s=document.createElement("td");s.classList.add("affected-resource-directive-info"),s.textContent=t,e.appendChild(s)}appendBlockedElement(e,t,s){const i=new m.ElementsPanelLink.ElementsPanelLink;if(t){const e=t;i.title=j(z.clickToRevealTheViolatingDomNode);const n=()=>{const t=s.getTargetIfNotDisposed();if(t){u.userMetrics.issuesPanelResourceOpened(this.issue.getCategory(),"Element");const s=new f.DOMModel.DeferredDOMNode(t,e);r.Revealer.reveal(s)}},a=()=>{const t=s.getTargetIfNotDisposed();if(t){const s=new f.DOMModel.DeferredDOMNode(t,e);s&&s.highlight()}},o=()=>{f.OverlayModel.OverlayModel.hideDOMNodeHighlight()};i.data={onElementRevealIconClick:n,onElementRevealIconMouseEnter:a,onElementRevealIconMouseLeave:o}}const n=document.createElement("td");n.classList.add("affected-resource-csp-info-node"),n.appendChild(i),e.appendChild(n)}appendAffectedContentSecurityPolicyDetails(t){const s=document.createElement("tr");if(this.issue.code()===e.ContentSecurityPolicyIssue.inlineViolationCode)this.appendColumnTitle(s,j(z.directiveC)),this.appendColumnTitle(s,j(z.element)),this.appendColumnTitle(s,j(z.sourceLocation)),this.appendColumnTitle(s,j(z.status));else if(this.issue.code()===e.ContentSecurityPolicyIssue.urlViolationCode)this.appendColumnTitle(s,j(z.resourceC),"affected-resource-directive-info-header"),this.appendColumnTitle(s,j(z.status)),this.appendColumnTitle(s,j(z.directiveC)),this.appendColumnTitle(s,j(z.sourceLocation));else if(this.issue.code()===e.ContentSecurityPolicyIssue.evalViolationCode)this.appendColumnTitle(s,j(z.sourceLocation)),this.appendColumnTitle(s,j(z.directiveC)),this.appendColumnTitle(s,j(z.status));else if(this.issue.code()===e.ContentSecurityPolicyIssue.trustedTypesSinkViolationCode)this.appendColumnTitle(s,j(z.sourceLocation)),this.appendColumnTitle(s,j(z.status));else{if(this.issue.code()!==e.ContentSecurityPolicyIssue.trustedTypesPolicyViolationCode)return void this.updateAffectedResourceCount(0);this.appendColumnTitle(s,j(z.sourceLocation)),this.appendColumnTitle(s,j(z.directiveC)),this.appendColumnTitle(s,j(z.status))}this.affectedResources.appendChild(s);let i=0;for(const e of t)i++,this.appendAffectedContentSecurityPolicyDetail(e);this.updateAffectedResourceCount(i)}appendAffectedContentSecurityPolicyDetail(t){const s=document.createElement("tr");s.classList.add("affected-resource-directive");const i=t.details(),n=e.Issue.toZeroBasedLocation(i.sourceCodeLocation),a=t.model(),r=t.model()?.getTargetIfNotDisposed();if(this.issue.code()===e.ContentSecurityPolicyIssue.inlineViolationCode&&a)this.appendViolatedDirective(s,i.violatedDirective),this.appendBlockedElement(s,i.violatingNodeId,a),this.appendSourceLocation(s,n,r),this.appendStatus(s,i.isReportOnly);else if(this.issue.code()===e.ContentSecurityPolicyIssue.urlViolationCode){const e=i.blockedURL?i.blockedURL:"";this.appendBlockedURL(s,e),this.appendStatus(s,i.isReportOnly),this.appendViolatedDirective(s,i.violatedDirective),this.appendSourceLocation(s,n,r)}else if(this.issue.code()===e.ContentSecurityPolicyIssue.evalViolationCode)this.appendSourceLocation(s,n,r),this.appendViolatedDirective(s,i.violatedDirective),this.appendStatus(s,i.isReportOnly);else if(this.issue.code()===e.ContentSecurityPolicyIssue.trustedTypesSinkViolationCode)this.appendSourceLocation(s,n,r),this.appendStatus(s,i.isReportOnly);else{if(this.issue.code()!==e.ContentSecurityPolicyIssue.trustedTypesPolicyViolationCode)return;this.appendSourceLocation(s,n,r),this.appendViolatedDirective(s,i.violatedDirective),this.appendStatus(s,i.isReportOnly)}this.affectedResources.appendChild(s)}update(){this.clear(),this.appendAffectedContentSecurityPolicyDetails(this.issue.getCspIssues())}}const $={nRequests:"{n, plural, =1 {# request} other {# requests}}",requestC:"Request",parentFrame:"Parent Frame",blockedResource:"Blocked Resource"},Q=t.i18n.registerUIStrings("panels/issues/AffectedBlockedByResponseView.ts",$),Z=t.i18n.getLocalizedString.bind(void 0,Q);class J extends K{appendDetails(e){const t=document.createElement("tr");this.appendColumnTitle(t,Z($.requestC)),this.appendColumnTitle(t,Z($.parentFrame)),this.appendColumnTitle(t,Z($.blockedResource)),this.affectedResources.appendChild(t);let s=0;for(const t of e)this.appendDetail(t),s++;this.updateAffectedResourceCount(s)}getResourceNameWithCount(e){return Z($.nRequests,{n:e})}appendDetail(t){const s=document.createElement("tr");s.classList.add("affected-resource-row");const i=this.createRequestCell(t.request,{additionalOnClickAction(){u.userMetrics.issuesPanelResourceOpened(e.Issue.IssueCategory.CrossOriginEmbedderPolicy,"Request")}});if(s.appendChild(i),t.parentFrame){const e=this.createFrameCell(t.parentFrame.frameId,this.issue.getCategory());s.appendChild(e)}else s.appendChild(document.createElement("td"));if(t.blockedFrame){const e=this.createFrameCell(t.blockedFrame.frameId,this.issue.getCategory());s.appendChild(e)}else s.appendChild(document.createElement("td"));this.affectedResources.appendChild(s)}update(){this.clear(),this.appendDetails(this.issue.getBlockedByResponseDetails())}}const X={nCookies:"{n, plural, =1 {# cookie} other {# cookies}}",name:"Name",domain:"Domain",path:"Path",nRawCookieLines:"{n, plural, =1 {1 Raw `Set-Cookie` header} other {# Raw `Set-Cookie` headers}}",filterSetCookieTitle:"Show network requests that include this `Set-Cookie` header in the network panel"},Y=t.i18n.registerUIStrings("panels/issues/AffectedCookiesView.ts",X),ee=t.i18n.getLocalizedString.bind(void 0,Y);class te extends K{getResourceNameWithCount(e){return ee(X.nCookies,{n:e})}appendAffectedCookies(e){const t=document.createElement("tr");this.appendColumnTitle(t,ee(X.name)),this.appendColumnTitle(t,ee(X.domain)+" & "+ee(X.path),"affected-resource-cookie-info-header"),this.affectedResources.appendChild(t);let s=0;for(const t of e)s++,this.appendAffectedCookie(t.cookie,t.hasRequest);this.updateAffectedResourceCount(s)}appendAffectedCookie(e,t){const i=document.createElement("tr");i.classList.add("affected-resource-cookie");const n=document.createElement("td");t?n.appendChild(s.UIUtils.createTextButton(e.name,(()=>{u.userMetrics.issuesPanelResourceOpened(this.issue.getCategory(),"Cookie"),r.Revealer.reveal(h.UIFilter.UIRequestFilter.filters([{filterType:h.UIFilter.FilterType.CookieDomain,filterValue:e.domain},{filterType:h.UIFilter.FilterType.CookieName,filterValue:e.name},{filterType:h.UIFilter.FilterType.CookiePath,filterValue:e.path}]))}),"link-style devtools-link")):n.textContent=e.name,i.appendChild(n),this.appendIssueDetailCell(i,`${e.domain}${e.path}`,"affected-resource-cookie-info"),this.affectedResources.appendChild(i)}update(){this.clear(),this.appendAffectedCookies(this.issue.cookiesWithRequestIndicator())}}class se extends K{getResourceNameWithCount(e){return ee(X.nRawCookieLines,{n:e})}update(){this.clear();const e=this.issue.getRawCookieLines();let t=0;for(const i of e){const e=document.createElement("tr");if(e.classList.add("affected-resource-directive"),i.hasRequest){const t=document.createElement("td"),n=s.UIUtils.createTextButton(i.rawCookieLine,(()=>{r.Revealer.reveal(h.UIFilter.UIRequestFilter.filters([{filterType:h.UIFilter.FilterType.ResponseHeaderValueSetCookie,filterValue:i.rawCookieLine}]))}),"link-style devtools-link");n.title=ee(X.filterSetCookieTitle),t.appendChild(n),e.appendChild(t)}else this.appendIssueDetailCell(e,i.rawCookieLine);this.affectedResources.appendChild(e),t++}this.updateAffectedResourceCount(t)}}const ie={nElements:"{n, plural, =1 {# element} other {# elements}}"},ne=t.i18n.registerUIStrings("panels/issues/AffectedElementsView.ts",ie),ae=t.i18n.getLocalizedString.bind(void 0,ne);class re extends K{async appendAffectedElements(e){let t=0;for(const s of e)await this.appendAffectedElement(s),t++;this.updateAffectedResourceCount(t)}getResourceNameWithCount(e){return ae(ie.nElements,{n:e})}async appendAffectedElement(e){const t=await this.createElementCell(e,this.issue.getCategory()),s=document.createElement("tr");s.appendChild(t),this.affectedResources.appendChild(s)}update(){this.clear(),this.appendAffectedElements(this.issue.elements())}}const oe={nDocuments:"{n, plural, =1 { document} other { documents}}",documentInTheDOMTree:"Document in the DOM tree",url:"URL",mode:"Mode"},de=t.i18n.registerUIStrings("panels/issues/AffectedDocumentsInQuirksModeView.ts",oe),le=t.i18n.getLocalizedString.bind(void 0,de);class ue extends re{runningUpdatePromise=Promise.resolve();update(){this.runningUpdatePromise=this.runningUpdatePromise.then(this.doUpdate.bind(this))}getResourceName(e){return le(oe.nDocuments,{n:e})}async doUpdate(){this.clear(),await this.appendQuirksModeDocuments(this.issue.getQuirksModeIssues())}async appendQuirksModeDocument(e){const t=document.createElement("tr");t.classList.add("affected-resource-quirks-mode");const s=e.details(),i=f.FrameManager.FrameManager.instance().getFrame(s.frameId)?.resourceTreeModel().target()||null;t.appendChild(await this.createElementCell({nodeName:"document",backendNodeId:s.documentNodeId,target:i},e.getCategory())),this.appendIssueDetailCell(t,s.isLimitedQuirksMode?"Limited Quirks Mode":"Quirks Mode"),this.appendIssueDetailCell(t,s.url),this.affectedResources.appendChild(t)}async appendQuirksModeDocuments(e){const t=document.createElement("tr");this.appendColumnTitle(t,le(oe.documentInTheDOMTree)),this.appendColumnTitle(t,le(oe.mode)),this.appendColumnTitle(t,le(oe.url)),this.affectedResources.appendChild(t);let s=0;for(const t of e)s++,await this.appendQuirksModeDocument(t);this.updateAffectedResourceCount(s)}}class ce extends re{runningUpdatePromise=Promise.resolve();update(){this.runningUpdatePromise=this.runningUpdatePromise.then(this.doUpdate.bind(this))}async doUpdate(){this.clear(),await this.appendLowContrastElements(this.issue.getLowContrastIssues())}async appendLowContrastElement(e){const t=document.createElement("tr");t.classList.add("affected-resource-low-contrast");const s=e.details(),i=e.model()?.target()||null;t.appendChild(await this.createElementCell({nodeName:s.violatingNodeSelector,backendNodeId:s.violatingNodeId,target:i},e.getCategory())),this.appendIssueDetailCell(t,String(w.NumberUtilities.floor(s.contrastRatio,2))),this.appendIssueDetailCell(t,String(s.thresholdAA)),this.appendIssueDetailCell(t,String(s.thresholdAAA)),this.appendIssueDetailCell(t,s.fontSize),this.appendIssueDetailCell(t,s.fontWeight),this.affectedResources.appendChild(t)}async appendLowContrastElements(e){const t=document.createElement("tr");this.appendColumnTitle(t,ge(pe.element)),this.appendColumnTitle(t,ge(pe.contrastRatio)),this.appendColumnTitle(t,ge(pe.minimumAA)),this.appendColumnTitle(t,ge(pe.minimumAAA)),this.appendColumnTitle(t,ge(pe.textSize)),this.appendColumnTitle(t,ge(pe.textWeight)),this.affectedResources.appendChild(t);let s=0;for(const t of e)s++,await this.appendLowContrastElement(t);this.updateAffectedResourceCount(s)}}const pe={element:"Element",contrastRatio:"Contrast ratio",minimumAA:"Minimum AA ratio",minimumAAA:"Minimum AAA ratio",textSize:"Text size",textWeight:"Text weight"},he=t.i18n.registerUIStrings("panels/issues/AffectedElementsWithLowContrastView.ts",pe),ge=t.i18n.getLocalizedString.bind(void 0,he),fe={nResources:"{n, plural, =1 {# resource} other {# resources}}",limitExceeded:"Limit exceeded",resolutionStatus:"Resolution Status",frameUrl:"Frame URL",removed:"Removed",warned:"Warned",cpuPeakLimit:"CPU peak limit",cpuTotalLimit:"CPU total limit",networkLimit:"Network limit"},me=t.i18n.registerUIStrings("panels/issues/AffectedHeavyAdView.ts",fe),Ce=t.i18n.getLocalizedString.bind(void 0,me);class Ie extends K{appendAffectedHeavyAds(e){const t=document.createElement("tr");this.appendColumnTitle(t,Ce(fe.limitExceeded)),this.appendColumnTitle(t,Ce(fe.resolutionStatus)),this.appendColumnTitle(t,Ce(fe.frameUrl)),this.affectedResources.appendChild(t);let s=0;for(const t of e)this.appendAffectedHeavyAd(t.details()),s++;this.updateAffectedResourceCount(s)}getResourceNameWithCount(e){return Ce(fe.nResources,{n:e})}statusToString(e){switch(e){case"HeavyAdBlocked":return Ce(fe.removed);case"HeavyAdWarning":return Ce(fe.warned)}return""}limitToString(e){switch(e){case"CpuPeakLimit":return Ce(fe.cpuPeakLimit);case"CpuTotalLimit":return Ce(fe.cpuTotalLimit);case"NetworkTotalLimit":return Ce(fe.networkLimit)}return""}appendAffectedHeavyAd(e){const t=document.createElement("tr");t.classList.add("affected-resource-heavy-ad");const s=document.createElement("td");s.classList.add("affected-resource-heavy-ad-info"),s.textContent=this.limitToString(e.reason),t.appendChild(s);const i=document.createElement("td");i.classList.add("affected-resource-heavy-ad-info"),i.textContent=this.statusToString(e.resolution),t.appendChild(i);const n=e.frame.frameId,a=this.createFrameCell(n,this.issue.getCategory());t.appendChild(a),this.affectedResources.appendChild(t)}update(){this.clear(),this.appendAffectedHeavyAds(this.issue.getHeavyAdIssues())}}const ye={nViolations:"{n, plural, =1 {# violation} other {# violations}}",warning:"warning",blocked:"blocked",instantiation:"Instantiation",aSharedarraybufferWas:"A `SharedArrayBuffer` was instantiated in a context that is not cross-origin isolated",transfer:"Transfer",sharedarraybufferWasTransferedTo:"`SharedArrayBuffer` was transfered to a context that is not cross-origin isolated",sourceLocation:"Source Location",trigger:"Trigger",status:"Status"},we=t.i18n.registerUIStrings("panels/issues/AffectedSharedArrayBufferIssueDetailsView.ts",ye),be=t.i18n.getLocalizedString.bind(void 0,we);class ve extends K{getResourceNameWithCount(e){return be(ye.nViolations,{n:e})}appendStatus(e,t){const s=document.createElement("td");t?(s.classList.add("affected-resource-report-only-status"),s.textContent=be(ye.warning)):(s.classList.add("affected-resource-blocked-status"),s.textContent=be(ye.blocked)),e.appendChild(s)}appendType(e,t){const s=document.createElement("td");switch(t){case"CreationIssue":s.textContent=be(ye.instantiation),s.title=be(ye.aSharedarraybufferWas);break;case"TransferIssue":s.textContent=be(ye.transfer),s.title=be(ye.sharedarraybufferWasTransferedTo)}e.appendChild(s)}appendDetails(e){const t=document.createElement("tr");this.appendColumnTitle(t,be(ye.sourceLocation)),this.appendColumnTitle(t,be(ye.trigger)),this.appendColumnTitle(t,be(ye.status)),this.affectedResources.appendChild(t);let s=0;for(const t of e)s++,this.appendDetail(t);this.updateAffectedResourceCount(s)}appendDetail(t){const s=document.createElement("tr");s.classList.add("affected-resource-directive");const i=t.details(),n=e.Issue.toZeroBasedLocation(i.sourceCodeLocation);this.appendSourceLocation(s,n,t.model()?.getTargetIfNotDisposed()),this.appendType(s,i.type),this.appendStatus(s,i.isWarning),this.affectedResources.appendChild(s)}update(){this.clear(),this.appendDetails(this.issue.getSharedArrayBufferIssues())}}const ke={nSources:"{n, plural, =1 {# source} other {# sources}}"},Re=t.i18n.registerUIStrings("panels/issues/AffectedSourcesView.ts",ke),Se=t.i18n.getLocalizedString.bind(void 0,Re);class Te extends K{appendAffectedSources(e){let t=0;for(const s of e)this.appendAffectedSource(s),t++;this.updateAffectedResourceCount(t)}getResourceNameWithCount(e){return Se(ke.nSources,{n:e})}appendAffectedSource({url:e,lineNumber:t,columnNumber:s}){const i=document.createElement("td"),n={columnNumber:s,lineNumber:t,tabStop:!0},a=I.Linkifier.Linkifier.linkifyURL(e,n);i.appendChild(a);const r=document.createElement("tr");r.classList.add("affected-resource-source"),r.appendChild(i),this.affectedResources.appendChild(r)}update(){this.clear(),this.appendAffectedSources(this.issue.sources())}}const xe={nResources:"{n, plural, =1 {# resource} other {# resources}}",statusCode:"Status code",url:"Url",packageName:"Package name",packageSignature:"Package signature"},Ae=t.i18n.registerUIStrings("panels/issues/AffectedTrustedWebActivityIssueDetailsView.ts",xe),Ee=t.i18n.getLocalizedString.bind(void 0,Ae);class Le extends K{getResourceNameWithCount(e){return Ee(xe.nResources,{n:e})}appendDetail(t){const s=document.createElement("tr");s.classList.add("affected-resource-row");const i=t.details();this.issue.code()===e.TrustedWebActivityIssue.httpViolationCode&&i.httpStatusCode?(this.appendIssueDetailCell(s,i.httpStatusCode.toString()),this.appendIssueDetailCell(s,i.url)):this.issue.code()===e.TrustedWebActivityIssue.offlineViolationCode?this.appendIssueDetailCell(s,i.url):this.issue.code()===e.TrustedWebActivityIssue.assetlinkViolationCode&&(this.appendIssueDetailCell(s,i.packageName||""),this.appendIssueDetailCell(s,i.url),this.appendIssueDetailCell(s,i.signature||"")),this.affectedResources.appendChild(s)}appendDetails(t){const s=document.createElement("tr");this.issue.code()===e.TrustedWebActivityIssue.httpViolationCode?(this.appendColumnTitle(s,Ee(xe.statusCode)),this.appendColumnTitle(s,Ee(xe.url))):this.issue.code()===e.TrustedWebActivityIssue.offlineViolationCode?this.appendColumnTitle(s,Ee(xe.url)):this.issue.code()===e.TrustedWebActivityIssue.assetlinkViolationCode&&(this.appendColumnTitle(s,Ee(xe.packageName)),this.appendColumnTitle(s,Ee(xe.url)),this.appendColumnTitle(s,Ee(xe.packageSignature))),this.affectedResources.appendChild(s);let i=0;for(const e of t)this.appendDetail(e),i++;this.updateAffectedResourceCount(i)}update(){this.clear(),this.appendDetails(this.issue.getTrustedWebActivityIssues())}}const Me={nRequests:"{n, plural, =1 {# request} other {# requests}}",warning:"warning",blocked:"blocked",status:"Status",request:"Request",resourceAddressSpace:"Resource Address",initiatorAddressSpace:"Initiator Address",secure:"secure",insecure:"insecure",initiatorContext:"Initiator Context",preflightRequestIfProblematic:"Preflight Request (if problematic)",preflightRequest:"Preflight Request",header:"Header",problem:"Problem",invalidValue:"Invalid Value (if available)",problemMissingHeader:"Missing Header",problemMultipleValues:"Multiple Values",problemInvalidValue:"Invalid Value",preflightDisallowedRedirect:"Response to preflight was a redirect",preflightInvalidStatus:"HTTP status of preflight request didn't indicate success",allowedOrigin:"Allowed Origin (from header)",allowCredentialsValueFromHeader:"`Access-Control-Allow-Credentials` Header Value",disallowedRequestMethod:"Disallowed Request Method",disallowedRequestHeader:"Disallowed Request Header",sourceLocation:"Source Location",unsupportedScheme:"Unsupported Scheme"},De=t.i18n.registerUIStrings("panels/issues/CorsIssueDetailsView.ts",Me),Pe=t.i18n.getLocalizedString.bind(void 0,De);class Oe extends K{constructor(e,t){super(e,t),this.affectedResourcesCountElement.classList.add("cors-issue-affected-resource-label")}appendStatus(e,t){const s=document.createElement("td");t?(s.classList.add("affected-resource-report-only-status"),s.textContent=Pe(Me.warning)):(s.classList.add("affected-resource-blocked-status"),s.textContent=Pe(Me.blocked)),e.appendChild(s)}getResourceNameWithCount(e){return Pe(Me.nRequests,{n:e})}appendDetails(t,s){const i=document.createElement("tr");switch(this.appendColumnTitle(i,Pe(Me.request)),this.appendColumnTitle(i,Pe(Me.status)),t){case e.CorsIssue.IssueCode.InvalidHeaderValues:this.appendColumnTitle(i,Pe(Me.preflightRequestIfProblematic)),this.appendColumnTitle(i,Pe(Me.header)),this.appendColumnTitle(i,Pe(Me.problem)),this.appendColumnTitle(i,Pe(Me.invalidValue));break;case e.CorsIssue.IssueCode.WildcardOriginNotAllowed:this.appendColumnTitle(i,Pe(Me.preflightRequestIfProblematic));break;case e.CorsIssue.IssueCode.PreflightResponseInvalid:this.appendColumnTitle(i,Pe(Me.preflightRequest)),this.appendColumnTitle(i,Pe(Me.problem));break;case e.CorsIssue.IssueCode.OriginMismatch:this.appendColumnTitle(i,Pe(Me.preflightRequestIfProblematic)),this.appendColumnTitle(i,Pe(Me.initiatorContext)),this.appendColumnTitle(i,Pe(Me.allowedOrigin));break;case e.CorsIssue.IssueCode.AllowCredentialsRequired:this.appendColumnTitle(i,Pe(Me.preflightRequestIfProblematic)),this.appendColumnTitle(i,Pe(Me.allowCredentialsValueFromHeader));break;case e.CorsIssue.IssueCode.InsecurePrivateNetwork:case e.CorsIssue.IssueCode.InsecurePrivateNetworkPreflight:this.appendColumnTitle(i,Pe(Me.resourceAddressSpace)),this.appendColumnTitle(i,Pe(Me.initiatorAddressSpace)),this.appendColumnTitle(i,Pe(Me.initiatorContext));break;case e.CorsIssue.IssueCode.MethodDisallowedByPreflightResponse:this.appendColumnTitle(i,Pe(Me.preflightRequest)),this.appendColumnTitle(i,Pe(Me.disallowedRequestMethod));break;case e.CorsIssue.IssueCode.HeaderDisallowedByPreflightResponse:this.appendColumnTitle(i,Pe(Me.preflightRequest)),this.appendColumnTitle(i,Pe(Me.disallowedRequestHeader));break;case e.CorsIssue.IssueCode.RedirectContainsCredentials:break;case e.CorsIssue.IssueCode.DisallowedByMode:this.appendColumnTitle(i,Pe(Me.initiatorContext)),this.appendColumnTitle(i,Pe(Me.sourceLocation));break;case e.CorsIssue.IssueCode.CorsDisabledScheme:this.appendColumnTitle(i,Pe(Me.initiatorContext)),this.appendColumnTitle(i,Pe(Me.sourceLocation)),this.appendColumnTitle(i,Pe(Me.unsupportedScheme));break;case e.CorsIssue.IssueCode.NoCorsRedirectModeNotFollow:this.appendColumnTitle(i,Pe(Me.sourceLocation));break;default:w.assertUnhandled(t)}this.affectedResources.appendChild(i);let n=0;for(const e of s)n++,this.appendDetail(t,e);this.updateAffectedResourceCount(n)}appendSecureContextCell(e,t){void 0!==t?this.appendIssueDetailCell(e,Pe(t?Me.secure:Me.insecure)):this.appendIssueDetailCell(e,"")}static getHeaderFromError(e){switch(e){case"InvalidAllowHeadersPreflightResponse":return"Access-Control-Allow-Headers";case"InvalidAllowMethodsPreflightResponse":case"MethodDisallowedByPreflightResponse":return"Access-Control-Allow-Methods";case"PreflightMissingAllowOriginHeader":case"PreflightMultipleAllowOriginValues":case"PreflightInvalidAllowOriginValue":case"MissingAllowOriginHeader":case"MultipleAllowOriginValues":case"InvalidAllowOriginValue":case"WildcardOriginNotAllowed":case"PreflightWildcardOriginNotAllowed":case"AllowOriginMismatch":case"PreflightAllowOriginMismatch":return"Access-Control-Allow-Origin";case"InvalidAllowCredentials":case"PreflightInvalidAllowCredentials":return"Access-Control-Allow-Credentials";case"RedirectContainsCredentials":case"PreflightDisallowedRedirect":return"Location";case"PreflightInvalidStatus":return"Status-Code"}return""}static getProblemFromError(e){switch(e.corsError){case"InvalidAllowHeadersPreflightResponse":case"InvalidAllowMethodsPreflightResponse":case"PreflightInvalidAllowOriginValue":case"InvalidAllowOriginValue":return Pe(Me.problemInvalidValue);case"PreflightMultipleAllowOriginValues":case"MultipleAllowOriginValues":return Pe(Me.problemMultipleValues);case"MissingAllowOriginHeader":case"PreflightMissingAllowOriginHeader":return Pe(Me.problemMissingHeader);case"PreflightInvalidStatus":return Pe(Me.preflightInvalidStatus);case"PreflightDisallowedRedirect":return Pe(Me.preflightDisallowedRedirect)}throw new Error("Invalid Argument")}appendDetail(t,s){const i=document.createElement("tr");i.classList.add("affected-resource-directive");const n=s.details(),a=n.corsErrorStatus,r=n.corsErrorStatus.corsError,o={section:h.UIRequestLocation.UIHeaderSection.Response,name:Oe.getHeaderFromError(r)},d={additionalOnClickAction(){u.userMetrics.issuesPanelResourceOpened(e.Issue.IssueCategory.Cors,"Request")}};switch(t){case e.CorsIssue.IssueCode.InvalidHeaderValues:i.appendChild(this.createRequestCell(n.request,d)),this.appendStatus(i,n.isWarning),r.includes("Preflight")?i.appendChild(this.createRequestCell(n.request,{...d,linkToPreflight:!0,highlightHeader:o})):this.appendIssueDetailCell(i,""),this.appendIssueDetailCell(i,Oe.getHeaderFromError(r),"code-example"),this.appendIssueDetailCell(i,Oe.getProblemFromError(n.corsErrorStatus)),this.appendIssueDetailCell(i,n.corsErrorStatus.failedParameter,"code-example");break;case e.CorsIssue.IssueCode.WildcardOriginNotAllowed:i.appendChild(this.createRequestCell(n.request,d)),this.appendStatus(i,n.isWarning),r.includes("Preflight")?i.appendChild(this.createRequestCell(n.request,{...d,linkToPreflight:!0,highlightHeader:o})):this.appendIssueDetailCell(i,"");break;case e.CorsIssue.IssueCode.PreflightResponseInvalid:{i.appendChild(this.createRequestCell(n.request,d)),this.appendStatus(i,n.isWarning);const e="PreflightInvalidStatus"===r?{section:h.UIRequestLocation.UIHeaderSection.General,name:"Status-Code"}:o;i.appendChild(this.createRequestCell(n.request,{...d,linkToPreflight:!0,highlightHeader:e})),this.appendIssueDetailCell(i,Oe.getProblemFromError(n.corsErrorStatus));break}case e.CorsIssue.IssueCode.OriginMismatch:i.appendChild(this.createRequestCell(n.request,d)),this.appendStatus(i,n.isWarning),r.includes("Preflight")?i.appendChild(this.createRequestCell(n.request,{...d,linkToPreflight:!0,highlightHeader:o})):this.appendIssueDetailCell(i,""),this.appendIssueDetailCell(i,n.initiatorOrigin??"","code-example"),this.appendIssueDetailCell(i,n.corsErrorStatus.failedParameter,"code-example");break;case e.CorsIssue.IssueCode.AllowCredentialsRequired:i.appendChild(this.createRequestCell(n.request,d)),this.appendStatus(i,n.isWarning),r.includes("Preflight")?i.appendChild(this.createRequestCell(n.request,{...d,linkToPreflight:!0,highlightHeader:o})):this.appendIssueDetailCell(i,""),this.appendIssueDetailCell(i,n.corsErrorStatus.failedParameter,"code-example");break;case e.CorsIssue.IssueCode.InsecurePrivateNetwork:case e.CorsIssue.IssueCode.InsecurePrivateNetworkPreflight:i.appendChild(this.createRequestCell(n.request,d)),this.appendStatus(i,n.isWarning),this.appendIssueDetailCell(i,n.resourceIPAddressSpace??""),this.appendIssueDetailCell(i,n.clientSecurityState?.initiatorIPAddressSpace??""),this.appendSecureContextCell(i,n.clientSecurityState?.initiatorIsSecureContext);break;case e.CorsIssue.IssueCode.MethodDisallowedByPreflightResponse:i.appendChild(this.createRequestCell(n.request,d)),this.appendStatus(i,n.isWarning),i.appendChild(this.createRequestCell(n.request,{...d,linkToPreflight:!0,highlightHeader:o})),this.appendIssueDetailCell(i,n.corsErrorStatus.failedParameter,"code-example");break;case e.CorsIssue.IssueCode.HeaderDisallowedByPreflightResponse:i.appendChild(this.createRequestCell(n.request,{...d,highlightHeader:{section:h.UIRequestLocation.UIHeaderSection.Request,name:a.failedParameter}})),this.appendStatus(i,n.isWarning),i.appendChild(this.createRequestCell(n.request,{...d,linkToPreflight:!0,highlightHeader:{section:h.UIRequestLocation.UIHeaderSection.Response,name:"Access-Control-Allow-Headers"}})),this.appendIssueDetailCell(i,n.corsErrorStatus.failedParameter,"code-example");break;case e.CorsIssue.IssueCode.RedirectContainsCredentials:i.appendChild(this.createRequestCell(n.request,{...d,highlightHeader:{section:h.UIRequestLocation.UIHeaderSection.Response,name:Oe.getHeaderFromError(r)}})),this.appendStatus(i,n.isWarning);break;case e.CorsIssue.IssueCode.DisallowedByMode:i.appendChild(this.createRequestCell(n.request,d)),this.appendStatus(i,n.isWarning),this.appendIssueDetailCell(i,n.initiatorOrigin??"","code-example"),this.appendSourceLocation(i,n.location,s.model()?.getTargetIfNotDisposed());break;case e.CorsIssue.IssueCode.CorsDisabledScheme:i.appendChild(this.createRequestCell(n.request,{...d,highlightHeader:{section:h.UIRequestLocation.UIHeaderSection.Response,name:Oe.getHeaderFromError(r)}})),this.appendStatus(i,n.isWarning),this.appendIssueDetailCell(i,n.initiatorOrigin??"","code-example"),this.appendSourceLocation(i,n.location,s.model()?.getTargetIfNotDisposed()),this.appendIssueDetailCell(i,n.corsErrorStatus.failedParameter??"","code-example");break;case e.CorsIssue.IssueCode.NoCorsRedirectModeNotFollow:i.appendChild(this.createRequestCell(n.request,d)),this.appendStatus(i,n.isWarning),this.appendSourceLocation(i,n.location,s.model()?.getTargetIfNotDisposed());break;default:i.appendChild(this.createRequestCell(n.request,d)),this.appendStatus(i,n.isWarning),w.assertUnhandled(t)}this.affectedResources.appendChild(i)}update(){this.clear();const e=this.issue.getCorsIssues();e.size>0?this.appendDetails(e.values().next().value.code(),e):this.updateAffectedResourceCount(0)}}const qe={nResources:"{n, plural, =1 {# resource} other {# resources}}",frameId:"Frame"},Ve=t.i18n.registerUIStrings("panels/issues/GenericIssueDetailsView.ts",qe),Ue=t.i18n.getLocalizedString.bind(void 0,Ve);class Fe extends K{getResourceNameWithCount(e){return Ue(qe.nResources,{n:e})}appendDetails(e){const t=document.createElement("tr");e.values().next().value.details().frameId&&this.appendColumnTitle(t,Ue(qe.frameId)),this.affectedResources.appendChild(t);let s=0;for(const t of e)s++,this.appendDetail(t);this.updateAffectedResourceCount(s)}appendDetail(e){const t=document.createElement("tr");t.classList.add("affected-resource-directive");const s=e.details();s.frameId&&t.appendChild(this.createFrameCell(s.frameId,e.getCategory())),this.affectedResources.appendChild(t)}update(){this.clear();const e=this.issue.getGenericIssues();e.size>0?this.appendDetails(e):this.updateAffectedResourceCount(0)}}const He={nModuleTransfers:"{n, plural, =1 {# module} other {# modules}}",wasmModuleUrl:"Wasm Module URL",sourceOrigin:"Source Origin",targetOrigin:"Target Origin",status:"Status",blocked:"blocked",warned:"warning"},Be=t.i18n.registerUIStrings("panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts",He),Ne=t.i18n.getLocalizedString.bind(void 0,Be);class We extends K{appendIssues(e){const t=document.createElement("tr");this.appendColumnTitle(t,Ne(He.wasmModuleUrl)),this.appendColumnTitle(t,Ne(He.sourceOrigin)),this.appendColumnTitle(t,Ne(He.targetOrigin)),this.appendColumnTitle(t,Ne(He.status)),this.affectedResources.appendChild(t);let s=0;for(const t of e)this.appendDetails(t.details()),s++;this.updateAffectedResourceCount(s)}getResourceNameWithCount(e){return Ne(He.nModuleTransfers,{n:e})}appendDetails(e){const t=document.createElement("tr");t.appendChild(this.createIssueDetailCell(e.wasmModuleUrl)),t.appendChild(this.createIssueDetailCell(e.sourceOrigin)),t.appendChild(this.createIssueDetailCell(e.targetOrigin)),t.appendChild(this.createIssueDetailCell(e.isWarning?Ne(He.warned):Ne(He.blocked))),this.affectedResources.appendChild(t)}update(){this.clear(),this.appendIssues(this.issue.getWasmCrossOriginModuleSharingIssue())}}const Ke={nViolations:"{n, plural, =1 {# violation} other {# violations}}",frame:"Frame",element:"Element",request:"Request",invalidSourceEventId:"Invalid `attributionsourceeventid`",untrustworthyOrigin:"Untrustworthy origin",invalidTriggerData:"Invalid `trigger-data`",invalidEventSourceTriggerData:"Invalid `event-source-trigger-data`"},ze=t.i18n.registerUIStrings("panels/issues/AttributionReportingIssueDetailsView.ts",Ke),_e=t.i18n.getLocalizedString.bind(void 0,ze);class je extends K{getResourceNameWithCount(e){return _e(Ke.nViolations,{n:e})}update(){this.clear();const e=this.issue.getAttributionReportingIssues();e.size>0?this.appendDetails(e.values().next().value.code(),e):this.updateAffectedResourceCount(0)}appendDetails(e,t){const s=document.createElement("tr");switch(e){case"AttributionReportingIssue::AttributionUntrustworthyFrameOrigin":this.appendColumnTitle(s,_e(Ke.frame)),this.appendColumnTitle(s,_e(Ke.request)),this.appendColumnTitle(s,_e(Ke.untrustworthyOrigin));break;case"AttributionReportingIssue::AttributionUntrustworthyOrigin":this.appendColumnTitle(s,_e(Ke.request)),this.appendColumnTitle(s,_e(Ke.untrustworthyOrigin));break;case"AttributionReportingIssue::AttributionSourceUntrustworthyFrameOrigin":this.appendColumnTitle(s,_e(Ke.frame)),this.appendColumnTitle(s,_e(Ke.element)),this.appendColumnTitle(s,_e(Ke.untrustworthyOrigin));break;case"AttributionReportingIssue::AttributionSourceUntrustworthyOrigin":this.appendColumnTitle(s,_e(Ke.element)),this.appendColumnTitle(s,_e(Ke.untrustworthyOrigin));break;case"AttributionReportingIssue::InvalidAttributionData":case"AttrubtionReportingIssue::AttributionTriggerDataTooLarge":this.appendColumnTitle(s,_e(Ke.request)),this.appendColumnTitle(s,_e(Ke.invalidTriggerData));break;case"AttrubtionReportingIssue::AttributionEventSourceTriggerDataTooLarge":this.appendColumnTitle(s,_e(Ke.request)),this.appendColumnTitle(s,_e(Ke.invalidEventSourceTriggerData));break;case"AttributionReportingIssue::InvalidAttributionSourceEventId":this.appendColumnTitle(s,_e(Ke.frame)),this.appendColumnTitle(s,_e(Ke.element)),this.appendColumnTitle(s,_e(Ke.invalidSourceEventId));break;case"AttributionReportingIssue::MissingAttributionData":this.appendColumnTitle(s,_e(Ke.request));break;case"AttributionReportingIssue::PermissionPolicyDisabled":this.appendColumnTitle(s,_e(Ke.frame)),this.appendColumnTitle(s,_e(Ke.element)),this.appendColumnTitle(s,_e(Ke.request))}this.affectedResources.appendChild(s);let i=0;for(const s of t)i++,this.appendDetail(e,s);this.updateAffectedResourceCount(i)}async appendDetail(e,t){const s=document.createElement("tr");s.classList.add("affected-resource-directive");const i=t.issueDetails;switch(e){case"AttributionReportingIssue::AttributionUntrustworthyFrameOrigin":this.appendFrameOrEmptyCell(s,t),this.appendRequestOrEmptyCell(s,i.request),this.appendIssueDetailCell(s,i.invalidParameter||"");break;case"AttributionReportingIssue::AttributionSourceUntrustworthyOrigin":await this.appendElementOrEmptyCell(s,t),this.appendIssueDetailCell(s,i.invalidParameter||"");break;case"AttrubtionReportingIssue::AttributionTriggerDataTooLarge":case"AttrubtionReportingIssue::AttributionEventSourceTriggerDataTooLarge":case"AttributionReportingIssue::AttributionUntrustworthyOrigin":case"AttributionReportingIssue::InvalidAttributionData":this.appendRequestOrEmptyCell(s,i.request),this.appendIssueDetailCell(s,i.invalidParameter||"");break;case"AttributionReportingIssue::AttributionSourceUntrustworthyFrameOrigin":case"AttributionReportingIssue::InvalidAttributionSourceEventId":this.appendFrameOrEmptyCell(s,t),await this.appendElementOrEmptyCell(s,t),this.appendIssueDetailCell(s,i.invalidParameter||"");break;case"AttributionReportingIssue::MissingAttributionData":this.appendRequestOrEmptyCell(s,i.request);break;case"AttributionReportingIssue::PermissionPolicyDisabled":this.appendFrameOrEmptyCell(s,t),await this.appendElementOrEmptyCell(s,t),this.appendRequestOrEmptyCell(s,i.request)}this.affectedResources.appendChild(s)}appendFrameOrEmptyCell(e,t){const s=t.issueDetails;s.frame?e.appendChild(this.createFrameCell(s.frame.frameId,t.getCategory())):this.appendIssueDetailCell(e,"")}async appendElementOrEmptyCell(e,t){const s=t.issueDetails;if(void 0!==s.violatingNodeId){const i=t.model()?.target()||null;e.appendChild(await this.createElementCell({backendNodeId:s.violatingNodeId,target:i,nodeName:"Attribution source element"},t.getCategory()))}else this.appendIssueDetailCell(e,"")}appendRequestOrEmptyCell(t,s){if(!s)return void this.appendIssueDetailCell(t,"");const i={additionalOnClickAction(){u.userMetrics.issuesPanelResourceOpened(e.Issue.IssueCategory.AttributionReporting,"Request")}};t.appendChild(this.createRequestCell(s,i))}}const Ge={name:"Name",blocked:"blocked",nRequests:"{n, plural, =1 {# request} other {# requests}}",nResources:"{n, plural, =1 {# resource} other {# resources}}",restrictionStatus:"Restriction Status",warned:"Warned",affectedResources:"Affected Resources",learnMoreS:"Learn more: {PH1}",automaticallyUpgraded:"automatically upgraded",hideIssuesLikeThis:"Hide issues like this",unhideIssuesLikeThis:"Unhide issues like this"},$e=t.i18n.registerUIStrings("panels/issues/IssueView.ts",Ge),Qe=t.i18n.getLocalizedString.bind(void 0,$e);class Ze extends K{appendAffectedRequests(e){let t=0;for(const s of e){const e=document.createElement("tr");e.classList.add("affected-resource-request");const i=this.issue.getCategory(),n=Je.get(i)||h.UIRequestLocation.UIRequestTabs.Headers;e.appendChild(this.createRequestCell(s,{networkTab:n,additionalOnClickAction(){u.userMetrics.issuesPanelResourceOpened(i,"Request")}})),this.affectedResources.appendChild(e),t++}this.updateAffectedResourceCount(t)}getResourceNameWithCount(e){return Qe(Ge.nRequests,{n:e})}update(){this.clear();for(const e of this.issue.getBlockedByResponseDetails())return void this.updateAffectedResourceCount(0);this.issue.getCategory()!==e.Issue.IssueCategory.MixedContent?this.appendAffectedRequests(this.issue.requests()):this.updateAffectedResourceCount(0)}}const Je=new Map([[e.Issue.IssueCategory.SameSiteCookie,h.UIRequestLocation.UIRequestTabs.Cookies],[e.Issue.IssueCategory.CrossOriginEmbedderPolicy,h.UIRequestLocation.UIRequestTabs.Headers],[e.Issue.IssueCategory.MixedContent,h.UIRequestLocation.UIRequestTabs.Headers]]);class Xe extends K{appendAffectedMixedContentDetails(e){const t=document.createElement("tr");this.appendColumnTitle(t,Qe(Ge.name)),this.appendColumnTitle(t,Qe(Ge.restrictionStatus)),this.affectedResources.appendChild(t);let s=0;for(const t of e){const e=t.getDetails();this.appendAffectedMixedContent(e),s++}this.updateAffectedResourceCount(s)}getResourceNameWithCount(e){return Qe(Ge.nResources,{n:e})}appendAffectedMixedContent(t){const s=document.createElement("tr");if(s.classList.add("affected-resource-mixed-content"),t.request){const i=Je.get(this.issue.getCategory())||h.UIRequestLocation.UIRequestTabs.Headers;s.appendChild(this.createRequestCell(t.request,{networkTab:i,additionalOnClickAction(){u.userMetrics.issuesPanelResourceOpened(e.Issue.IssueCategory.MixedContent,"Request")}}))}else{const e=(i=t.insecureURL,(/[^/]+$/.exec(i)||/[^/]+\/$/.exec(i)||[""])[0]);this.appendIssueDetailCell(s,e,"affected-resource-mixed-content-info").title=t.insecureURL}var i;this.appendIssueDetailCell(s,Xe.translateStatus(t.resolutionStatus),"affected-resource-mixed-content-info"),this.affectedResources.appendChild(s)}static translateStatus(e){switch(e){case"MixedContentBlocked":return Qe(Ge.blocked);case"MixedContentAutomaticallyUpgraded":return Qe(Ge.automaticallyUpgraded);case"MixedContentWarning":return Qe(Ge.warned)}}update(){this.clear(),this.appendAffectedMixedContentDetails(this.issue.getMixedContentIssues())}}class Ye extends s.TreeOutline.TreeElement{issue;description;toggleOnClick;affectedResources;affectedResourceViews;aggregatedIssuesCount;issueKindIcon=null;hasBeenExpandedBefore;throttle;needsUpdateOnExpand=!0;hiddenIssuesMenu;contentCreated=!1;constructor(e,t){super(),this.issue=e,this.description=t,this.throttle=new r.Throttler.Throttler(250),this.toggleOnClick=!0,this.listItemElement.classList.add("issue"),this.childrenListElement.classList.add("body"),this.childrenListElement.classList.add(Ye.getBodyCSSClass(this.issue.getKind())),this.affectedResources=this.createAffectedResources(),this.affectedResourceViews=[new te(this,this.issue),new re(this,this.issue),new Ze(this,this.issue),new Xe(this,this.issue),new Te(this,this.issue),new Ie(this,this.issue),new G(this,this.issue),new J(this,this.issue),new ve(this,this.issue),new ce(this,this.issue),new Le(this,this.issue),new Oe(this,this.issue),new Fe(this,this.issue),new ue(this,this.issue),new je(this,this.issue),new We(this,this.issue),new se(this,this.issue)],o.Runtime.experiments.isEnabled("hideIssuesFeature")&&(this.hiddenIssuesMenu=new g.HideIssuesMenu.HideIssuesMenu),this.aggregatedIssuesCount=null,this.hasBeenExpandedBefore=!1}setIssue(e){this.issue!==e&&(this.needsUpdateOnExpand=!0),this.issue=e,this.affectedResourceViews.forEach((t=>t.setIssue(e)))}static getBodyCSSClass(t){switch(t){case e.Issue.IssueKind.BreakingChange:return"issue-kind-breaking-change";case e.Issue.IssueKind.PageError:return"issue-kind-page-error";case e.Issue.IssueKind.Improvement:return"issue-kind-improvement"}}getIssueTitle(){return this.description.title}onattach(){this.contentCreated?this.update():this.createContent()}createContent(){this.appendHeader(),this.createBody(),this.appendChild(this.affectedResources);for(const e of this.affectedResourceViews)this.appendAffectedResource(e),e.update();this.createReadMoreLinks(),this.updateAffectedResourceVisibility(),this.contentCreated=!0}appendAffectedResource(e){this.affectedResources.appendChild(e)}appendHeader(){const e=document.createElement("div");e.classList.add("header"),this.issueKindIcon=new c.Icon.Icon,this.issueKindIcon.classList.add("leading-issue-icon"),this.aggregatedIssuesCount=document.createElement("span");const t=new l.Adorner.Adorner;t.data={name:"countWrapper",content:this.aggregatedIssuesCount},t.classList.add("aggregated-issues-count"),e.appendChild(this.issueKindIcon),e.appendChild(t);const s=document.createElement("div");s.classList.add("title"),s.textContent=this.description.title,e.appendChild(s),this.hiddenIssuesMenu&&e.appendChild(this.hiddenIssuesMenu),this.updateFromIssue(),this.listItemElement.appendChild(e)}onexpand(){if(u.userMetrics.issuesPanelIssueExpanded(this.issue.getCategory()),this.needsUpdateOnExpand&&this.doUpdate(),!this.hasBeenExpandedBefore){this.hasBeenExpandedBefore=!0;for(const e of this.affectedResourceViews)e.expandIfOneResource()}}updateFromIssue(){if(this.issueKindIcon){const t=this.issue.getKind();this.issueKindIcon.data=d.IssueCounter.getIssueKindIconData(t),this.issueKindIcon.title=e.Issue.getIssueKindDescription(t)}if(this.aggregatedIssuesCount&&(this.aggregatedIssuesCount.textContent=`${this.issue.getAggregatedIssuesCount()}`),this.listItemElement.classList.toggle("hidden-issue",this.issue.isHidden()),this.hiddenIssuesMenu){const t={menuItemLabel:this.issue.isHidden()?Qe(Ge.unhideIssuesLikeThis):Qe(Ge.hideIssuesLikeThis),menuItemAction:()=>{const t=e.IssuesManager.getHideIssueByCodeSetting(),s=t.get();s[this.issue.code()]=this.issue.isHidden()?"Unhidden":"Hidden",t.set(s)}};this.hiddenIssuesMenu.data=t}}updateAffectedResourceVisibility(){const e=this.affectedResourceViews.every((e=>e.isEmpty()));this.affectedResources.hidden=e}createAffectedResources(){const e=new s.TreeOutline.TreeElement;return e.setCollapsible(!1),e.setExpandable(!0),e.expand(),e.selectable=!1,e.listItemElement.classList.add("affected-resources-label"),e.listItemElement.textContent=Qe(Ge.affectedResources),e.childrenListElement.classList.add("affected-resources"),e}createBody(){const e=new s.TreeOutline.TreeElement;e.setCollapsible(!1),e.selectable=!1;const t=new p.MarkdownView.MarkdownView;t.data={tokens:this.description.markdown},e.listItemElement.appendChild(t),this.appendChild(e)}createReadMoreLinks(){if(0===this.description.links.length)return;const e=new s.TreeOutline.TreeElement;e.setCollapsible(!1),e.listItemElement.classList.add("link-wrapper");const t=e.listItemElement.createChild("ul","link-list");for(const e of this.description.links){const i=s.Fragment.html`${Qe(Ge.learnMoreS,{PH1:e.linkTitle})}`,n=new c.Icon.Icon;n.data={iconName:"link_icon",color:"var(--color-link)",width:"16px",height:"16px"},n.classList.add("link-icon"),i.prepend(n),i.addEventListener("x-link-invoke",(()=>{u.userMetrics.issuesPanelResourceOpened(this.issue.getCategory(),"LearnMore")}));t.createChild("li").appendChild(i)}this.appendChild(e)}doUpdate(){this.expanded&&(this.affectedResourceViews.forEach((e=>e.update())),this.updateAffectedResourceVisibility()),this.needsUpdateOnExpand=!this.expanded,this.updateFromIssue()}update(){this.throttle.schedule((async()=>this.doUpdate()))}getIssueKind(){return this.issue.getKind()}isForHiddenIssue(){return this.issue.isHidden()}toggle(e){e||void 0===e&&!this.expanded?this.expand():this.collapse()}}const et={hideAllCurrentPageErrors:"Hide all current Page Errors",hideAllCurrentBreakingChanges:"Hide all current Breaking Changes",hideAllCurrentImprovements:"Hide all current Improvements"},tt=t.i18n.registerUIStrings("panels/issues/IssueKindView.ts",et),st=t.i18n.getLocalizedString.bind(void 0,tt);function it(){return r.Settings.Settings.instance().createSetting("groupIssuesByKind",!1)}class nt extends s.TreeOutline.TreeElement{kind;issueCount;constructor(t){super(void 0,!0),this.kind=t,this.issueCount=document.createElement("span"),this.toggleOnClick=!0,this.listItemElement.classList.add("issue-kind"),this.listItemElement.classList.add(function(t){switch(t){case e.Issue.IssueKind.BreakingChange:return"breaking-changes";case e.Issue.IssueKind.Improvement:return"improvements";case e.Issue.IssueKind.PageError:return"page-errors"}}(t)),this.childrenListElement.classList.add("issue-kind-body")}getKind(){return this.kind}getHideAllCurrentKindString(){switch(this.kind){case e.Issue.IssueKind.PageError:return st(et.hideAllCurrentPageErrors);case e.Issue.IssueKind.Improvement:return st(et.hideAllCurrentImprovements);case e.Issue.IssueKind.BreakingChange:return st(et.hideAllCurrentBreakingChanges)}}appendHeader(){const t=document.createElement("div");t.classList.add("header");const s=new c.Icon.Icon;s.data=d.IssueCounter.getIssueKindIconData(this.kind),s.classList.add("leading-issue-icon");const i=new l.Adorner.Adorner;i.data={name:"countWrapper",content:this.issueCount},i.classList.add("aggregated-issues-count"),this.issueCount.textContent="0";const n=document.createElement("div");n.classList.add("title"),n.textContent=e.Issue.getIssueKindName(this.kind);const a=new g.HideIssuesMenu.HideIssuesMenu;a.classList.add("hide-available-issues"),a.data={menuItemLabel:this.getHideAllCurrentKindString(),menuItemAction:()=>{const t=e.IssuesManager.getHideIssueByCodeSetting(),s=t.get();for(const t of e.IssuesManager.IssuesManager.instance().issues())t.getKind()===this.kind&&(s[t.code()]="Hidden");t.set(s)}},t.appendChild(s),t.appendChild(i),t.appendChild(n),t.appendChild(a),this.listItemElement.appendChild(t)}onattach(){this.appendHeader(),this.expand()}update(e){this.issueCount.textContent=`${e}`}}const at={crossOriginEmbedderPolicy:"Cross Origin Embedder Policy",mixedContent:"Mixed Content",samesiteCookie:"SameSite Cookie",heavyAds:"Heavy Ads",contentSecurityPolicy:"Content Security Policy",trustedWebActivity:"Trusted Web Activity",other:"Other",lowTextContrast:"Low Text Contrast",cors:"Cross Origin Resource Sharing",groupDisplayedIssuesUnder:"Group displayed issues under associated categories",groupByCategory:"Group by category",groupDisplayedIssuesUnderKind:"Group displayed issues as Page errors, Breaking changes and Improvements",groupByKind:"Group by kind",includeCookieIssuesCausedBy:"Include cookie Issues caused by third-party sites",includeThirdpartyCookieIssues:"Include third-party cookie issues",onlyThirdpartyCookieIssues:"Only third-party cookie issues detected so far",noIssuesDetectedSoFar:"No issues detected so far",attributionReporting:"Attribution Reporting `API`",quirksMode:"Quirks Mode",generic:"Generic"},rt=t.i18n.registerUIStrings("panels/issues/IssuesPane.ts",at),ot=t.i18n.getLocalizedString.bind(void 0,rt);class dt extends s.TreeOutline.TreeElement{category;issues;constructor(e){super(),this.category=e,this.issues=[],this.toggleOnClick=!0,this.listItemElement.classList.add("issue-category"),this.childrenListElement.classList.add("issue-category-body")}getCategoryName(){switch(this.category){case e.Issue.IssueCategory.CrossOriginEmbedderPolicy:return ot(at.crossOriginEmbedderPolicy);case e.Issue.IssueCategory.MixedContent:return ot(at.mixedContent);case e.Issue.IssueCategory.SameSiteCookie:return ot(at.samesiteCookie);case e.Issue.IssueCategory.HeavyAd:return ot(at.heavyAds);case e.Issue.IssueCategory.ContentSecurityPolicy:return ot(at.contentSecurityPolicy);case e.Issue.IssueCategory.TrustedWebActivity:return ot(at.trustedWebActivity);case e.Issue.IssueCategory.LowTextContrast:return ot(at.lowTextContrast);case e.Issue.IssueCategory.Cors:return ot(at.cors);case e.Issue.IssueCategory.AttributionReporting:return ot(at.attributionReporting);case e.Issue.IssueCategory.QuirksMode:return ot(at.quirksMode);case e.Issue.IssueCategory.Generic:return ot(at.generic);case e.Issue.IssueCategory.Other:return ot(at.other)}}onattach(){this.appendHeader()}appendHeader(){const e=document.createElement("div");e.classList.add("header");const t=document.createElement("div");t.classList.add("title"),t.textContent=this.getCategoryName(),e.appendChild(t),this.listItemElement.appendChild(e)}}function lt(){return r.Settings.Settings.instance().createSetting("groupIssuesByCategory",!1)}let ut;class ct extends s.Widget.VBox{categoryViews;issueViews;kindViews;showThirdPartyCheckbox;issuesTree;hiddenIssuesRow;noIssuesMessageDiv;issuesManager;aggregator;issueViewUpdatePromise=Promise.resolve();constructor(){super(!0),this.contentElement.classList.add("issues-pane"),this.categoryViews=new Map,this.kindViews=new Map,this.issueViews=new Map,this.showThirdPartyCheckbox=null,this.createToolbars(),this.issuesTree=new s.TreeOutline.TreeOutlineInShadow,this.issuesTree.setShowSelectionOnKeyboardFocus(!0),this.issuesTree.contentElement.classList.add("issues"),this.contentElement.appendChild(this.issuesTree.element),this.hiddenIssuesRow=new U,this.issuesTree.appendChild(this.hiddenIssuesRow),this.noIssuesMessageDiv=document.createElement("div"),this.noIssuesMessageDiv.classList.add("issues-pane-no-issues"),this.contentElement.appendChild(this.noIssuesMessageDiv),this.issuesManager=e.IssuesManager.IssuesManager.instance(),this.aggregator=new D(this.issuesManager),this.aggregator.addEventListener("AggregatedIssueUpdated",this.issueUpdated,this),this.aggregator.addEventListener("FullUpdateRequired",this.onFullUpdate,this),this.hiddenIssuesRow.hidden=0===this.issuesManager.numberOfHiddenIssues(),this.onFullUpdate(),this.issuesManager.addEventListener("IssuesCountUpdated",this.updateCounts,this)}static instance(e={forceNew:null}){const{forceNew:t}=e;return ut&&!t||(ut=new ct),ut}elementsToRestoreScrollPositionsFor(){return[this.issuesTree.element]}createToolbars(){const t=this.contentElement.createChild("div","issues-toolbar-container");new s.Toolbar.Toolbar("issues-toolbar-left",t);const i=new s.Toolbar.Toolbar("issues-toolbar-right",t),n=lt(),a=new s.Toolbar.ToolbarSettingCheckbox(n,ot(at.groupDisplayedIssuesUnder),ot(at.groupByCategory));a.setVisible(!1),i.appendToolbarItem(a),n.addChangeListener((()=>{this.fullUpdate(!0)}));const r=it(),l=new s.Toolbar.ToolbarSettingCheckbox(r,ot(at.groupDisplayedIssuesUnderKind),ot(at.groupByKind));i.appendToolbarItem(l),r.addChangeListener((()=>{this.fullUpdate(!0)})),l.setVisible(o.Runtime.experiments.isEnabled("groupAndHideIssuesByKind"));const u=e.Issue.getShowThirdPartyIssuesSetting();this.showThirdPartyCheckbox=new s.Toolbar.ToolbarSettingCheckbox(u,ot(at.includeCookieIssuesCausedBy),ot(at.includeThirdpartyCookieIssues)),i.appendToolbarItem(this.showThirdPartyCheckbox),this.setDefaultFocusedElement(this.showThirdPartyCheckbox.inputElement),i.appendSeparator();const c=new d.IssueCounter.IssueCounter;c.data={tooltipCallback:()=>{const t=d.IssueCounter.getIssueCountsEnumeration(e.IssuesManager.IssuesManager.instance(),!1);c.title=t},displayMode:"ShowAlways",issuesManager:e.IssuesManager.IssuesManager.instance()},c.id="console-issues-counter";const p=new s.Toolbar.ToolbarItem(c);return i.appendToolbarItem(p),{toolbarContainer:t}}issueUpdated(e){this.scheduleIssueViewUpdate(e.data)}scheduleIssueViewUpdate(e){this.issueViewUpdatePromise=this.issueViewUpdatePromise.then((()=>this.updateIssueView(e)))}async updateIssueView(t){let i=this.issueViews.get(t.aggregationKey());if(i){i.setIssue(t);const e=this.getIssueViewParent(t);i.parent===e||e instanceof s.TreeOutline.TreeOutline&&i.parent===e.rootElement()||(i.parent?.removeChild(i),this.appendIssueViewToParent(i,e))}else{const s=t.getDescription();if(!s)return void console.warn("Could not find description for issue code:",t.code());const n=await e.MarkdownIssueDescription.createIssueDescriptionFromMarkdown(s);i=new Ye(t,n),this.issueViews.set(t.aggregationKey(),i);const a=this.getIssueViewParent(t);this.appendIssueViewToParent(i,a)}i.update(),this.updateCounts()}appendIssueViewToParent(e,t){t.appendChild(e,((e,t)=>e instanceof U?1:t instanceof U?-1:e instanceof Ye&&t instanceof Ye?e.getIssueTitle().localeCompare(t.getIssueTitle()):(console.error("The issues tree should only contain IssueView objects as direct children"),0)))}getIssueViewParent(t){const s=o.Runtime.experiments.isEnabled("groupAndHideIssuesByKind");if(t.isHidden())return this.hiddenIssuesRow;if(s&&it().get()){const s=t.getKind(),i=this.kindViews.get(s);if(i)return i;const n=new nt(s);return this.issuesTree.appendChild(n,((t,s)=>t instanceof nt&&s instanceof nt?function(t,s){return t.getKind()===s.getKind()?0:t.getKind()===e.Issue.IssueKind.PageError||t.getKind()===e.Issue.IssueKind.BreakingChange&&s.getKind()===e.Issue.IssueKind.Improvement?-1:1}(t,s):0)),this.kindViews.set(s,n),n}if(lt().get()){const e=t.getCategory(),s=this.categoryViews.get(e);if(s)return s;const i=new dt(e);return this.issuesTree.appendChild(i,((e,t)=>e instanceof dt&&t instanceof dt?e.getCategoryName().localeCompare(t.getCategoryName()):0)),this.categoryViews.set(e,i),i}return this.issuesTree}clearViews(e,t){for(const[s,i]of Array.from(e.entries()))t?.has(s)||(i.parent&&i.parent.removeChild(i),e.delete(s))}onFullUpdate(){this.fullUpdate(!1)}fullUpdate(e){if(this.clearViews(this.categoryViews,e?void 0:this.aggregator.aggregatedIssueCategories()),this.clearViews(this.kindViews,e?void 0:this.aggregator.aggregatedIssueKinds()),this.clearViews(this.issueViews,e?void 0:this.aggregator.aggregatedIssueCodes()),this.aggregator)for(const e of this.aggregator.aggregatedIssues())this.scheduleIssueViewUpdate(e);this.updateCounts()}updateIssueKindViewsCount(){for(const e of this.kindViews.values()){const t=this.issuesManager.numberOfIssues(e.getKind());e.update(t)}}updateCounts(){const e=o.Runtime.experiments.isEnabled("groupAndHideIssuesByKind");this.showIssuesTreeOrNoIssuesDetectedMessage(this.issuesManager.numberOfIssues(),this.issuesManager.numberOfHiddenIssues()),e&&it().get()&&this.updateIssueKindViewsCount()}showIssuesTreeOrNoIssuesDetectedMessage(e,t){if(e>0||t>0){this.hiddenIssuesRow.hidden=0===t,this.hiddenIssuesRow.update(t),this.issuesTree.element.hidden=!1,this.noIssuesMessageDiv.style.display="none";const e=this.issuesTree.firstChild();e&&(e.select(!0),this.setDefaultFocusedElement(e.listItemElement))}else{this.issuesTree.element.hidden=!0,this.showThirdPartyCheckbox&&this.setDefaultFocusedElement(this.showThirdPartyCheckbox.inputElement);const e=this.issuesManager.numberOfAllStoredIssues()>0;this.noIssuesMessageDiv.textContent=ot(e?at.onlyThirdpartyCookieIssues:at.noIssuesDetectedSoFar),this.noIssuesMessageDiv.style.display="flex"}}async reveal(e){await this.issueViewUpdatePromise;const t=this.aggregator.keyForIssue(e),s=this.issueViews.get(t),i=o.Runtime.experiments.isEnabled("groupAndHideIssuesByKind");if(s){if(s.isForHiddenIssue()&&(this.hiddenIssuesRow.expand(),this.hiddenIssuesRow.reveal()),i&&it().get()&&!s.isForHiddenIssue()){const e=this.kindViews.get(s.getIssueKind());e?.expand(),e?.reveal()}s.expand(),s.reveal(),s.select(!1,!0)}}wasShown(){super.wasShown(),this.issuesTree.registerCSSFiles([H]),this.registerCSSFiles([F])}}var pt=Object.freeze({__proto__:null,getGroupIssuesByCategorySetting:lt,IssuesPane:ct});let ht;class gt{static instance(e={forceNew:null}){const{forceNew:t}=e;return ht&&!t||(ht=new gt),ht}async reveal(t){if(!(t instanceof e.Issue.Issue))throw new Error("Internal error: not a issue");await s.ViewManager.ViewManager.instance().showView("issues-pane");const i=s.ViewManager.ViewManager.instance().view("issues-pane");if(i){const e=await i.widget();if(!(e instanceof ct))throw new Error("Expected issues pane to be an instance of IssuesPane");await e.reveal(t)}}}var ft=Object.freeze({__proto__:null,IssueRevealer:gt});export{L as CSPViolationsView,P as IssueAggregator,ft as IssueRevealer,pt as IssuesPane};
diff --git a/chii/panels/js_profiler/js_profiler-meta.js b/chii/panels/js_profiler/js_profiler-meta.js
new file mode 100644
index 00000000..cd791a97
--- /dev/null
+++ b/chii/panels/js_profiler/js_profiler-meta.js
@@ -0,0 +1 @@
+import*as r from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";const e={profiler:"Profiler",showProfiler:"Show Profiler",startStopRecording:"Start/stop recording"},i=r.i18n.registerUIStrings("panels/js_profiler/js_profiler-meta.ts",e),t=r.i18n.getLazilyComputedLocalizedString.bind(void 0,i);let n;async function a(){return n||(n=await import("../profiler/profiler.js")),n}o.ViewManager.registerViewExtension({location:"panel",id:"js_profiler",title:t(e.profiler),commandPrompt:t(e.showProfiler),order:65,loadView:async()=>(await a()).ProfilesPanel.JSProfilerPanel.instance()}),o.ActionRegistration.registerActionExtension({actionId:"profiler.js-toggle-recording",category:o.ActionRegistration.ActionCategory.JAVASCRIPT_PROFILER,title:t(e.startStopRecording),iconClass:"largeicon-start-recording",toggleable:!0,toggledIconClass:"largeicon-stop-recording",toggleWithRedColor:!0,contextTypes(){return r=r=>[r.ProfilesPanel.JSProfilerPanel],void 0===n?[]:r(n);var r},loadActionDelegate:async()=>(await a()).ProfilesPanel.JSProfilerPanel.instance(),bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]});
diff --git a/chii/panels/js_profiler/js_profiler.js b/chii/panels/js_profiler/js_profiler.js
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/chii/panels/js_profiler/js_profiler.js
@@ -0,0 +1 @@
+
diff --git a/chii/panels/layer_viewer/layer_viewer-legacy.js b/chii/panels/layer_viewer/layer_viewer-legacy.js
new file mode 100644
index 00000000..25326c05
--- /dev/null
+++ b/chii/panels/layer_viewer/layer_viewer-legacy.js
@@ -0,0 +1 @@
+import*as e from"./layer_viewer.js";self.LayerViewer=self.LayerViewer||{},LayerViewer=LayerViewer||{},LayerViewer.LayerDetailsView=e.LayerDetailsView.LayerDetailsView,LayerViewer.LayerDetailsView.Events=e.LayerDetailsView.Events,LayerViewer.LayerDetailsView._slowScrollRectNames=e.LayerDetailsView.slowScrollRectNames,LayerViewer.LayerTreeOutline=e.LayerTreeOutline.LayerTreeOutline,LayerViewer.LayerTreeOutline.Events=e.LayerTreeOutline.Events,LayerViewer.LayerTreeElement=e.LayerTreeOutline.LayerTreeElement,LayerViewer.LayerTreeElement.layerToTreeElement=e.LayerTreeOutline.layerToTreeElement,LayerViewer.LayerView=e.LayerViewHost.LayerView,LayerViewer.LayerView.Selection=e.LayerViewHost.Selection,LayerViewer.LayerView.Selection.Type=e.LayerViewHost.Type,LayerViewer.LayerView.LayerSelection=e.LayerViewHost.LayerSelection,LayerViewer.LayerView.ScrollRectSelection=e.LayerViewHost.ScrollRectSelection,LayerViewer.LayerView.SnapshotSelection=e.LayerViewHost.SnapshotSelection,LayerViewer.LayerViewHost=e.LayerViewHost.LayerViewHost,LayerViewer.Layers3DView=e.Layers3DView.Layers3DView,LayerViewer.Layers3DView.OutlineType=e.Layers3DView.OutlineType,LayerViewer.Layers3DView.Events=e.Layers3DView.Events,LayerViewer.Layers3DView.ChromeTexture=e.Layers3DView.ChromeTexture,LayerViewer.Layers3DView.FragmentShader=e.Layers3DView.FragmentShader,LayerViewer.Layers3DView.VertexShader=e.Layers3DView.VertexShader,LayerViewer.Layers3DView.HoveredBorderColor=e.Layers3DView.HoveredBorderColor,LayerViewer.Layers3DView.SelectedBorderColor=e.Layers3DView.SelectedBorderColor,LayerViewer.Layers3DView.BorderColor=e.Layers3DView.BorderColor,LayerViewer.Layers3DView.ViewportBorderColor=e.Layers3DView.ViewportBorderColor,LayerViewer.Layers3DView.ScrollRectBackgroundColor=e.Layers3DView.ScrollRectBackgroundColor,LayerViewer.Layers3DView.HoveredImageMaskColor=e.Layers3DView.HoveredImageMaskColor,LayerViewer.Layers3DView.BorderWidth=e.Layers3DView.BorderWidth,LayerViewer.Layers3DView.SelectedBorderWidth=e.Layers3DView.SelectedBorderWidth,LayerViewer.Layers3DView.ViewportBorderWidth=e.Layers3DView.ViewportBorderWidth,LayerViewer.Layers3DView.LayerSpacing=e.Layers3DView.LayerSpacing,LayerViewer.Layers3DView.ScrollRectSpacing=e.Layers3DView.ScrollRectSpacing,LayerViewer.Layers3DView.Rectangle=e.Layers3DView.Rectangle,LayerViewer.LayerTextureManager=e.Layers3DView.LayerTextureManager,LayerViewer.LayerTextureManager.Tile=e.Layers3DView.Tile,LayerViewer.PaintProfilerView=e.PaintProfilerView.PaintProfilerView,LayerViewer.PaintProfilerView.Events=e.PaintProfilerView.Events,LayerViewer.PaintProfilerCommandLogView=e.PaintProfilerView.PaintProfilerCommandLogView,LayerViewer.LogTreeElement=e.PaintProfilerView.LogTreeElement,LayerViewer.LogPropertyTreeElement=e.PaintProfilerView.LogPropertyTreeElement,LayerViewer.PaintProfilerCategory=e.PaintProfilerView.PaintProfilerCategory,LayerViewer.TransformController=e.TransformController.TransformController,LayerViewer.TransformController.Events=e.TransformController.Events,LayerViewer.TransformController.Modes=e.TransformController.Modes;
diff --git a/chii/panels/layer_viewer/layer_viewer-meta.js b/chii/panels/layer_viewer/layer_viewer-meta.js
new file mode 100644
index 00000000..34a5ef81
--- /dev/null
+++ b/chii/panels/layer_viewer/layer_viewer-meta.js
@@ -0,0 +1 @@
+import*as t from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";const i={resetView:"Reset view",switchToPanMode:"Switch to pan mode",switchToRotateMode:"Switch to rotate mode",zoomIn:"Zoom in",zoomOut:"Zoom out",panOrRotateUp:"Pan or rotate up",panOrRotateDown:"Pan or rotate down",panOrRotateLeft:"Pan or rotate left",panOrRotateRight:"Pan or rotate right"},e=t.i18n.registerUIStrings("panels/layer_viewer/layer_viewer-meta.ts",i),n=t.i18n.getLazilyComputedLocalizedString.bind(void 0,e);o.ActionRegistration.registerActionExtension({actionId:"layers.reset-view",category:o.ActionRegistration.ActionCategory.LAYERS,title:n(i.resetView),bindings:[{shortcut:"0"}]}),o.ActionRegistration.registerActionExtension({actionId:"layers.pan-mode",category:o.ActionRegistration.ActionCategory.LAYERS,title:n(i.switchToPanMode),bindings:[{shortcut:"x"}]}),o.ActionRegistration.registerActionExtension({actionId:"layers.rotate-mode",category:o.ActionRegistration.ActionCategory.LAYERS,title:n(i.switchToRotateMode),bindings:[{shortcut:"v"}]}),o.ActionRegistration.registerActionExtension({actionId:"layers.zoom-in",category:o.ActionRegistration.ActionCategory.LAYERS,title:n(i.zoomIn),bindings:[{shortcut:"Shift+Plus"},{shortcut:"NumpadPlus"}]}),o.ActionRegistration.registerActionExtension({actionId:"layers.zoom-out",category:o.ActionRegistration.ActionCategory.LAYERS,title:n(i.zoomOut),bindings:[{shortcut:"Shift+Minus"},{shortcut:"NumpadMinus"}]}),o.ActionRegistration.registerActionExtension({actionId:"layers.up",category:o.ActionRegistration.ActionCategory.LAYERS,title:n(i.panOrRotateUp),bindings:[{shortcut:"Up"},{shortcut:"w"}]}),o.ActionRegistration.registerActionExtension({actionId:"layers.down",category:o.ActionRegistration.ActionCategory.LAYERS,title:n(i.panOrRotateDown),bindings:[{shortcut:"Down"},{shortcut:"s"}]}),o.ActionRegistration.registerActionExtension({actionId:"layers.left",category:o.ActionRegistration.ActionCategory.LAYERS,title:n(i.panOrRotateLeft),bindings:[{shortcut:"Left"},{shortcut:"a"}]}),o.ActionRegistration.registerActionExtension({actionId:"layers.right",category:o.ActionRegistration.ActionCategory.LAYERS,title:n(i.panOrRotateRight),bindings:[{shortcut:"Right"},{shortcut:"d"}]});
diff --git a/chii/panels/layer_viewer/layer_viewer.js b/chii/panels/layer_viewer/layer_viewer.js
new file mode 100644
index 00000000..4b3c41f5
--- /dev/null
+++ b/chii/panels/layer_viewer/layer_viewer.js
@@ -0,0 +1 @@
+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 s from"../../core/sdk/sdk.js";import*as r from"../../ui/legacy/legacy.js";import*as n from"../../ui/legacy/components/perf_ui/perf_ui.js";const o=new CSSStyleSheet;o.replaceSync("table td{padding-left:8px}table td:first-child{font-weight:700}.scroll-rect.active{--override-active-rect-color:rgb(100 100 100 / 20%);background-color:var(--override-active-rect-color)}.-theme-with-dark-background .scroll-rect.active,:host-context(.-theme-with-dark-background) .scroll-rect.active{--override-active-rect-color:rgb(155 155 155 / 20%)}ul{list-style:none;padding-inline-start:0;margin-block-start:0;margin-block-end:0}.devtools-link.link-margin{margin:8px;display:inline-block}\n/*# sourceURL=layerDetailsView.css */\n");const a={showInternalLayers:"Show internal layers"},l=t.i18n.registerUIStrings("panels/layer_viewer/LayerViewHost.ts",a),h=t.i18n.getLocalizedString.bind(void 0,l);class c{typeInternal;layerInternal;constructor(e,t){this.typeInternal=e,this.layerInternal=t}static isEqual(e,t){return e&&t?e.isEqual(t):e===t}type(){return this.typeInternal}layer(){return this.layerInternal}isEqual(e){return!1}}class d extends c{constructor(e){console.assert(Boolean(e),"LayerSelection with empty layer"),super("Layer",e)}isEqual(e){return"Layer"===e.typeInternal&&e.layer().id()===this.layer().id()}}class u extends c{scrollRectIndex;constructor(e,t){super("ScrollRect",e),this.scrollRectIndex=t}isEqual(e){return"ScrollRect"===e.typeInternal&&this.layer().id()===e.layer().id()&&this.scrollRectIndex===e.scrollRectIndex}}class p extends c{snapshotInternal;constructor(e,t){super("Snapshot",e),this.snapshotInternal=t}isEqual(e){return"Snapshot"===e.typeInternal&&this.layer().id()===e.layer().id()&&this.snapshotInternal===e.snapshotInternal}snapshot(){return this.snapshotInternal}}var m=Object.freeze({__proto__:null,LayerView:class{},Selection:c,LayerSelection:d,ScrollRectSelection:u,SnapshotSelection:p,LayerViewHost:class{views;selectedObject;hoveredObject;showInternalLayersSettingInternal;snapshotLayers;target;constructor(){this.views=[],this.selectedObject=null,this.hoveredObject=null,this.showInternalLayersSettingInternal=e.Settings.Settings.instance().createSetting("layersShowInternalLayers",!1),this.snapshotLayers=new Map}registerView(e){this.views.push(e)}setLayerSnapshotMap(e){this.snapshotLayers=e}getLayerSnapshotMap(){return this.snapshotLayers}setLayerTree(e){if(!e)return;this.target=e.target();const t=this.selectedObject&&this.selectedObject.layer();!t||e&&e.layerById(t.id())||this.selectObject(null);const i=this.hoveredObject&&this.hoveredObject.layer();!i||e&&e.layerById(i.id())||this.hoverObject(null);for(const t of this.views)t.setLayerTree(e)}hoverObject(e){if(c.isEqual(this.hoveredObject,e))return;this.hoveredObject=e;const t=e&&e.layer();this.toggleNodeHighlight(t?t.nodeForSelfOrAncestor():null);for(const t of this.views)t.hoverObject(e)}selectObject(e){if(!c.isEqual(this.selectedObject,e)){this.selectedObject=e;for(const t of this.views)t.selectObject(e)}}selection(){return this.selectedObject}showContextMenu(e,t){e.defaultSection().appendCheckboxItem(h(a.showInternalLayers),this.toggleShowInternalLayers.bind(this),this.showInternalLayersSettingInternal.get());const i=t&&t.layer()&&t.layer().nodeForSelfOrAncestor();i&&e.appendApplicableItems(i),e.show()}showInternalLayersSetting(){return this.showInternalLayersSettingInternal}toggleShowInternalLayers(){this.showInternalLayersSettingInternal.set(!this.showInternalLayersSettingInternal.get())}toggleNodeHighlight(e){e?e.highlightForTwoSeconds():s.OverlayModel.OverlayModel.hideDOMNodeHighlight()}}});const g={selectALayerToSeeItsDetails:"Select a layer to see its details",scrollRectangleDimensions:"{PH1} {PH2} × {PH3} (at {PH4}, {PH5})",unnamed:"",stickyAncenstorLayersS:"{PH1}: {PH2} ({PH3})",stickyBoxRectangleDimensions:"Sticky Box {PH1} × {PH2} (at {PH3}, {PH4})",containingBlocRectangleDimensions:"Containing Block {PH1} × {PH2} (at {PH3}, {PH4})",nearestLayerShiftingStickyBox:"Nearest Layer Shifting Sticky Box",nearestLayerShiftingContaining:"Nearest Layer Shifting Containing Block",updateRectangleDimensions:"{PH1} × {PH2} (at {PH3}, {PH4})",size:"Size",compositingReasons:"Compositing Reasons",memoryEstimate:"Memory estimate",paintCount:"Paint count",slowScrollRegions:"Slow scroll regions",stickyPositionConstraint:"Sticky position constraint",paintProfiler:"Paint Profiler",nonFastScrollable:"Non fast scrollable",touchEventHandler:"Touch event handler",wheelEventHandler:"Wheel event handler",repaintsOnScroll:"Repaints on scroll",mainThreadScrollingReason:"Main thread scrolling reason"},y=t.i18n.registerUIStrings("panels/layer_viewer/LayerDetailsView.ts",g),f=t.i18n.getLocalizedString.bind(void 0,y),w=t.i18n.getLazilyComputedLocalizedString.bind(void 0,y);class v extends(e.ObjectWrapper.eventMixin(r.Widget.Widget)){layerViewHost;emptyWidget;layerSnapshotMap;tableElement;tbodyElement;sizeCell;compositingReasonsCell;memoryEstimateCell;paintCountCell;scrollRectsCell;stickyPositionConstraintCell;paintProfilerLink;selection;constructor(e){super(!0),this.layerViewHost=e,this.layerViewHost.registerView(this),this.emptyWidget=new r.EmptyWidget.EmptyWidget(f(g.selectALayerToSeeItsDetails)),this.layerSnapshotMap=this.layerViewHost.getLayerSnapshotMap(),this.buildContent(),this.selection=null}hoverObject(e){}selectObject(e){this.selection=e,this.isShowing()&&this.update()}setLayerTree(e){}wasShown(){super.wasShown(),this.registerCSSFiles([o]),this.update()}onScrollRectClicked(e,t){1===t.which&&this.selection&&this.layerViewHost.selectObject(new u(this.selection.layer(),e))}invokeProfilerLink(){if(!this.selection)return;const e="Snapshot"===this.selection.type()?this.selection:this.layerSnapshotMap.get(this.selection.layer());e&&this.dispatchEventToListeners(b.PaintProfilerRequested,e)}createScrollRectElement(e,t){t&&r.UIUtils.createTextChild(this.scrollRectsCell,", ");const i=this.scrollRectsCell.createChild("span","scroll-rect");this.selection&&this.selection.scrollRectIndex===t&&i.classList.add("active"),i.textContent=f(g.scrollRectangleDimensions,{PH1:String(S.get(e.type)?.()),PH2:e.rect.width,PH3:e.rect.height,PH4:e.rect.x,PH5:e.rect.y}),i.addEventListener("click",this.onScrollRectClicked.bind(this,t),!1)}formatStickyAncestorLayer(e,t){if(!t)return"";const i=t.nodeForSelfOrAncestor(),s=i?i.simpleSelector():f(g.unnamed);return f(g.stickyAncenstorLayersS,{PH1:e,PH2:s,PH3:t.id()})}createStickyAncestorChild(e,t){if(!t)return;r.UIUtils.createTextChild(this.stickyPositionConstraintCell,", ");this.stickyPositionConstraintCell.createChild("span").textContent=this.formatStickyAncestorLayer(e,t)}populateStickyPositionConstraintCell(e){if(this.stickyPositionConstraintCell.removeChildren(),!e)return;const t=e.stickyBoxRect();this.stickyPositionConstraintCell.createChild("span").textContent=f(g.stickyBoxRectangleDimensions,{PH1:t.width,PH2:t.height,PH3:t.x,PH4:t.y}),r.UIUtils.createTextChild(this.stickyPositionConstraintCell,", ");const i=e.containingBlockRect();this.stickyPositionConstraintCell.createChild("span").textContent=f(g.containingBlocRectangleDimensions,{PH1:i.width,PH2:i.height,PH3:i.x,PH4:i.y}),this.createStickyAncestorChild(f(g.nearestLayerShiftingStickyBox),e.nearestLayerShiftingStickyBox()),this.createStickyAncestorChild(f(g.nearestLayerShiftingContaining),e.nearestLayerShiftingContainingBlock())}update(){const e=this.selection&&this.selection.layer();if(!e)return this.tableElement.remove(),this.paintProfilerLink.remove(),void this.emptyWidget.show(this.contentElement);this.emptyWidget.detach(),this.contentElement.appendChild(this.tableElement),this.contentElement.appendChild(this.paintProfilerLink),this.sizeCell.textContent=f(g.updateRectangleDimensions,{PH1:e.width(),PH2:e.height(),PH3:e.offsetX(),PH4:e.offsetY()}),this.paintCountCell.parentElement&&this.paintCountCell.parentElement.classList.toggle("hidden",!e.paintCount()),this.paintCountCell.textContent=String(e.paintCount()),this.memoryEstimateCell.textContent=i.NumberUtilities.bytesToString(e.gpuMemoryUsage()),e.requestCompositingReasonIds().then(this.updateCompositingReasons.bind(this)),this.scrollRectsCell.removeChildren(),e.scrollRects().forEach(this.createScrollRectElement.bind(this)),this.populateStickyPositionConstraintCell(e.stickyPositionConstraint());const t=this.selection&&"Snapshot"===this.selection.type()?this.selection.snapshot():null;this.paintProfilerLink.classList.toggle("hidden",!(this.layerSnapshotMap.has(e)||t))}buildContent(){this.tableElement=this.contentElement.createChild("table"),this.tbodyElement=this.tableElement.createChild("tbody"),this.sizeCell=this.createRow(f(g.size)),this.compositingReasonsCell=this.createRow(f(g.compositingReasons)),this.memoryEstimateCell=this.createRow(f(g.memoryEstimate)),this.paintCountCell=this.createRow(f(g.paintCount)),this.scrollRectsCell=this.createRow(f(g.slowScrollRegions)),this.stickyPositionConstraintCell=this.createRow(f(g.stickyPositionConstraint)),this.paintProfilerLink=this.contentElement.createChild("span","hidden devtools-link link-margin"),r.ARIAUtils.markAsLink(this.paintProfilerLink),this.paintProfilerLink.textContent=f(g.paintProfiler),this.paintProfilerLink.tabIndex=0,this.paintProfilerLink.addEventListener("click",(e=>{e.consume(!0),this.invokeProfilerLink()})),this.paintProfilerLink.addEventListener("keydown",(e=>{"Enter"===e.key&&(e.consume(),this.invokeProfilerLink())}))}createRow(e){const t=this.tbodyElement.createChild("tr");return t.createChild("td").textContent=e,t.createChild("td")}updateCompositingReasons(e){if(!e||!e.length)return void(this.compositingReasonsCell.textContent="n/a");this.compositingReasonsCell.removeChildren();const t=this.compositingReasonsCell.createChild("ul"),i=v.getCompositingReasons(e);for(const e of i)t.createChild("li").textContent=e}static getCompositingReasons(e){const t=[];for(const i of e){const e=C.get(i);e?t.push(e):console.error(`Compositing reason id '${i}' is not recognized.`)}return t}}const C=new Map([["transform3D","Has a 3D transform."],["video","Is an accelerated video."],["canvas","Is an accelerated canvas, or is a display list backed canvas that was promoted to a layer based on a performance heuristic."],["plugin","Is an accelerated plugin."],["iFrame","Is an accelerated iFrame."],["backfaceVisibilityHidden","Has backface-visibility: hidden."],["activeTransformAnimation","Has an active accelerated transform animation or transition."],["activeOpacityAnimation","Has an active accelerated opacity animation or transition."],["activeFilterAnimation","Has an active accelerated filter animation or transition."],["activeBackdropFilterAnimation","Has an active accelerated backdrop filter animation or transition."],["immersiveArOverlay","Is DOM overlay for WebXR immersive-ar mode."],["scrollDependentPosition","Is fixed or sticky position."],["overflowScrolling","Is a scrollable overflow element."],["overflowScrollingParent","Scroll parent is not an ancestor."],["outOfFlowClipping","Has clipping ancestor."],["videoOverlay","Is overlay controls for video."],["willChangeTransform","Has a will-change: transform compositing hint."],["willChangeOpacity","Has a will-change: opacity compositing hint."],["willChangeOther","Has a will-change compositing hint other than transform and opacity."],["backdropFilter","Has a backdrop filter."],["rootScroller","Is the document.rootScroller."],["assumedOverlap","Might overlap other composited content."],["overlap","Overlaps other composited content."],["negativeZIndexChildren","Parent with composited negative z-index content."],["squashingDisallowed","Layer was separately composited because it could not be squashed."],["opacityWithCompositedDescendants","Has opacity that needs to be applied by the compositor because of composited descendants."],["maskWithCompositedDescendants","Has a mask that needs to be known by the compositor because of composited descendants."],["reflectionWithCompositedDescendants","Has a reflection that needs to be known by the compositor because of composited descendants."],["filterWithCompositedDescendants","Has a filter effect that needs to be known by the compositor because of composited descendants."],["blendingWithCompositedDescendants","Has a blending effect that needs to be known by the compositor because of composited descendants."],["clipsCompositingDescendants","Has a clip that needs to be known by the compositor because of composited descendants."],["perspectiveWith3DDescendants","Has a perspective transform that needs to be known by the compositor because of 3D descendants."],["preserve3DWith3DDescendants","Has a preserves-3D property that needs to be known by the compositor because of 3D descendants."],["isolateCompositedDescendants","Should isolate descendants to apply a blend effect."],["positionFixedWithCompositedDescendants","Is a position:fixed element with composited descendants."],["root","Is the root layer."],["layerForHorizontalScrollbar","Secondary layer, the horizontal scrollbar layer."],["layerForVerticalScrollbar","Secondary layer, the vertical scrollbar layer."],["layerForOverflowControlsHost","Secondary layer, the overflow controls host layer."],["layerForScrollCorner","Secondary layer, the scroll corner layer."],["layerForScrollingContents","Secondary layer, to house contents that can be scrolled."],["layerForScrollingContainer","Secondary layer, used to position the scrolling contents while scrolling."],["layerForSquashingContents","Secondary layer, home for a group of squashable content."],["layerForSquashingContainer","Secondary layer, no-op layer to place the squashing layer correctly in the composited layer tree."],["layerForForeground","Secondary layer, to contain any normal flow and positive z-index contents on top of a negative z-index layer."],["layerForMask","Secondary layer, to contain the mask contents."],["layerForDecoration","Layer painted on top of other layers as decoration."],["layerForOther","Layer for link highlight, frame overlay, etc."]]);var b;(b||(b={})).PaintProfilerRequested="PaintProfilerRequested";const S=new Map([[s.LayerTreeBase.Layer.ScrollRectType.NonFastScrollable,w(g.nonFastScrollable)],[s.LayerTreeBase.Layer.ScrollRectType.TouchEventHandler,w(g.touchEventHandler)],[s.LayerTreeBase.Layer.ScrollRectType.WheelEventHandler,w(g.wheelEventHandler)],[s.LayerTreeBase.Layer.ScrollRectType.RepaintsOnScroll,w(g.repaintsOnScroll)],[s.LayerTreeBase.Layer.ScrollRectType.MainThreadScrollingReason,w(g.mainThreadScrollingReason)]]);var T=Object.freeze({__proto__:null,LayerDetailsView:v,get Events(){return b},slowScrollRectNames:S});const x={layersTreePane:"Layers Tree Pane",showPaintProfiler:"Show Paint Profiler",updateChildDimension:" ({PH1} × {PH2})"},P=t.i18n.registerUIStrings("panels/layer_viewer/LayerTreeOutline.ts",x),L=t.i18n.getLocalizedString.bind(void 0,P);class I extends(e.ObjectWrapper.eventMixin(r.TreeOutline.TreeOutline)){layerViewHost;treeOutline;lastHoveredNode;element;layerTree;layerSnapshotMap;constructor(e){super(),this.layerViewHost=e,this.layerViewHost.registerView(this),this.treeOutline=new r.TreeOutline.TreeOutlineInShadow,this.treeOutline.element.classList.add("layer-tree","overflow-auto"),this.treeOutline.element.addEventListener("mousemove",this.onMouseMove.bind(this),!1),this.treeOutline.element.addEventListener("mouseout",this.onMouseMove.bind(this),!1),this.treeOutline.element.addEventListener("contextmenu",this.onContextMenu.bind(this),!0),r.ARIAUtils.setAccessibleName(this.treeOutline.contentElement,L(x.layersTreePane)),this.lastHoveredNode=null,this.element=this.treeOutline.element,this.layerViewHost.showInternalLayersSetting().addChangeListener(this.update,this)}focus(){this.treeOutline.focus()}selectObject(e){this.hoverObject(null);const t=e&&e.layer(),i=t&&E.get(t);i?i.revealAndSelect(!0):this.treeOutline.selectedTreeElement&&this.treeOutline.selectedTreeElement.deselect()}hoverObject(e){const t=e&&e.layer(),i=t&&E.get(t);i!==this.lastHoveredNode&&(this.lastHoveredNode&&this.lastHoveredNode.setHovered(!1),i&&i.setHovered(!0),this.lastHoveredNode=i)}setLayerTree(e){this.layerTree=e,this.update()}update(){const e=this.layerViewHost.showInternalLayersSetting().get(),t=new Map;let i=null;this.layerTree&&(e||(i=this.layerTree.contentRoot()),i||(i=this.layerTree.root())),i&&this.layerTree&&this.layerTree.forEachLayer(function(s){if(!s.drawsContent()&&!e)return;t.get(s)&&console.assert(!1,"Duplicate layer: "+s.id()),t.set(s,!0);let r=E.get(s)||null,n=s.parent();for(;n&&n!==i&&!n.drawsContent()&&!e;)n=n.parent();const o=s===i?this.treeOutline.rootElement():n&&E.get(n);if(o)if(r){if(r.parent!==o){const e=this.treeOutline.selectedTreeElement;r.parent&&r.parent.removeChild(r),o.appendChild(r),e&&e!==this.treeOutline.selectedTreeElement&&e.select()}r.update()}else r=new R(this,s),o.appendChild(r),s.drawsContent()||r.expand();else console.assert(!1,"Parent is not in the tree")}.bind(this),i);for(let e=this.treeOutline.rootElement().firstChild();e instanceof R&&!e.root;)if(t.get(e.layer))e=e.traverseNextTreeElement(!1);else{const t=e.nextSibling||e.parent;e.parent&&e.parent.removeChild(e),e===this.lastHoveredNode&&(this.lastHoveredNode=null),e=t}if(!this.treeOutline.selectedTreeElement&&this.layerTree){const e=this.layerTree.contentRoot()||this.layerTree.root();if(e){const t=E.get(e);t&&t.revealAndSelect(!0)}}}onMouseMove(e){const t=this.treeOutline.treeElementFromEvent(e);t!==this.lastHoveredNode&&this.layerViewHost.hoverObject(this.selectionForNode(t))}selectedNodeChanged(e){this.layerViewHost.selectObject(this.selectionForNode(e))}onContextMenu(e){const t=this.selectionForNode(this.treeOutline.treeElementFromEvent(e)),i=new r.ContextMenu.ContextMenu(e),s=t&&t.layer();s&&(this.layerSnapshotMap=this.layerViewHost.getLayerSnapshotMap(),this.layerSnapshotMap.has(s)&&i.defaultSection().appendItem(L(x.showPaintProfiler),(()=>this.dispatchEventToListeners("PaintProfilerRequested",t)),!1)),this.layerViewHost.showContextMenu(i,t)}selectionForNode(e){return e&&e.layer?new d(e.layer):null}}class R extends r.TreeOutline.TreeElement{treeOutlineInternal;layer;constructor(e,t){super(),this.treeOutlineInternal=e,this.layer=t,E.set(t,this),this.update()}update(){const e=this.layer.nodeForSelfOrAncestor(),t=document.createDocumentFragment();r.UIUtils.createTextChild(t,e?e.simpleSelector():"#"+this.layer.id());t.createChild("span","dimmed").textContent=L(x.updateChildDimension,{PH1:this.layer.width(),PH2:this.layer.height()}),this.title=t}onselect(){return this.treeOutlineInternal.selectedNodeChanged(this),!1}setHovered(e){this.listItemElement.classList.toggle("hovered",e)}}const E=new WeakMap;var O=Object.freeze({__proto__:null,LayerTreeOutline:I,LayerTreeElement:R,layerToTreeElement:E});const H=new CSSStyleSheet;H.replaceSync(".layers-3d-view{overflow:hidden;user-select:none}.toolbar{background-color:var(--color-background-elevation-1);border-bottom:var(--legacy-divider-border)}canvas{flex:1 1}.layers-3d-view>canvas:focus-visible{outline:auto 5px -webkit-focus-ring-color}\n/*# sourceURL=layers3DView.css */\n");const M={panModeX:"Pan mode (X)",rotateModeV:"Rotate mode (V)",resetTransform:"Reset transform (0)"},D=t.i18n.registerUIStrings("panels/layer_viewer/TransformController.ts",M),k=t.i18n.getLocalizedString.bind(void 0,D);class B extends e.ObjectWrapper.ObjectWrapper{mode;scaleInternal;offsetXInternal;offsetYInternal;rotateXInternal;rotateYInternal;oldRotateX;oldRotateY;originX;originY;element;minScale;maxScale;controlPanelToolbar;modeButtons;constructor(e,t){if(super(),this.scaleInternal=1,this.offsetXInternal=0,this.offsetYInternal=0,this.rotateXInternal=0,this.rotateYInternal=0,this.oldRotateX=0,this.oldRotateY=0,this.originX=0,this.originY=0,this.element=e,this.registerShortcuts(),r.UIUtils.installDragHandle(e,this.onDragStart.bind(this),this.onDrag.bind(this),this.onDragEnd.bind(this),"move",null),e.addEventListener("wheel",this.onMouseWheel.bind(this),!1),this.minScale=0,this.maxScale=1/0,this.controlPanelToolbar=new r.Toolbar.Toolbar("transform-control-panel"),this.modeButtons={},!t){const e=new r.Toolbar.ToolbarToggle(k(M.panModeX),"largeicon-pan");e.addEventListener(r.Toolbar.ToolbarButton.Events.Click,this.setMode.bind(this,"Pan")),this.modeButtons.Pan=e,this.controlPanelToolbar.appendToolbarItem(e);const t=new r.Toolbar.ToolbarToggle(k(M.rotateModeV),"largeicon-rotate");t.addEventListener(r.Toolbar.ToolbarButton.Events.Click,this.setMode.bind(this,"Rotate")),this.modeButtons.Rotate=t,this.controlPanelToolbar.appendToolbarItem(t)}this.setMode("Pan");const i=new r.Toolbar.ToolbarButton(k(M.resetTransform),"largeicon-center");i.addEventListener(r.Toolbar.ToolbarButton.Events.Click,this.resetAndNotify.bind(this,void 0)),this.controlPanelToolbar.appendToolbarItem(i),this.reset()}toolbar(){return this.controlPanelToolbar}registerShortcuts(){r.ShortcutRegistry.ShortcutRegistry.instance().addShortcutListener(this.element,{"layers.reset-view":async()=>(this.resetAndNotify(),!0),"layers.pan-mode":async()=>(this.setMode("Pan"),!0),"layers.rotate-mode":async()=>(this.setMode("Rotate"),!0),"layers.zoom-in":this.onKeyboardZoom.bind(this,1.1),"layers.zoom-out":this.onKeyboardZoom.bind(this,1/1.1),"layers.up":this.onKeyboardPanOrRotate.bind(this,0,-1),"layers.down":this.onKeyboardPanOrRotate.bind(this,0,1),"layers.left":this.onKeyboardPanOrRotate.bind(this,-1,0),"layers.right":this.onKeyboardPanOrRotate.bind(this,1,0)})}postChangeEvent(){this.dispatchEventToListeners(W.TransformChanged)}reset(){this.scaleInternal=1,this.offsetXInternal=0,this.offsetYInternal=0,this.rotateXInternal=0,this.rotateYInternal=0}setMode(e){this.mode!==e&&(this.mode=e,this.updateModeButtons())}updateModeButtons(){for(const e in this.modeButtons)this.modeButtons[e].setToggled(e===this.mode)}resetAndNotify(e){this.reset(),this.postChangeEvent(),e&&e.preventDefault(),this.element.focus()}setScaleConstraints(e,t){this.minScale=e,this.maxScale=t,this.scaleInternal=i.NumberUtilities.clamp(this.scaleInternal,e,t)}clampOffsets(e,t,s,r){this.offsetXInternal=i.NumberUtilities.clamp(this.offsetXInternal,e,t),this.offsetYInternal=i.NumberUtilities.clamp(this.offsetYInternal,s,r)}scale(){return this.scaleInternal}offsetX(){return this.offsetXInternal}offsetY(){return this.offsetYInternal}rotateX(){return this.rotateXInternal}rotateY(){return this.rotateYInternal}onScale(e,t,s){e=i.NumberUtilities.clamp(this.scaleInternal*e,this.minScale,this.maxScale)/this.scaleInternal,this.scaleInternal*=e,this.offsetXInternal-=(t-this.offsetXInternal)*(e-1),this.offsetYInternal-=(s-this.offsetYInternal)*(e-1),this.postChangeEvent()}onPan(e,t){this.offsetXInternal+=e,this.offsetYInternal+=t,this.postChangeEvent()}onRotate(e,t){this.rotateXInternal=e,this.rotateYInternal=t,this.postChangeEvent()}async onKeyboardZoom(e){return this.onScale(e,this.element.clientWidth/2,this.element.clientHeight/2),!0}async onKeyboardPanOrRotate(e,t){return"Rotate"===this.mode?this.onRotate(this.rotateXInternal+5*t,this.rotateYInternal+5*e):this.onPan(6*e,6*t),!0}onMouseWheel(e){const t=e,i=Math.pow(1.1,-t.deltaY*(1/53));this.onScale(i,t.clientX-this.element.totalOffsetLeft(),t.clientY-this.element.totalOffsetTop())}onDrag(e){const{clientX:t,clientY:i}=e;"Rotate"===this.mode?this.onRotate(this.oldRotateX+(this.originY-i)/this.element.clientHeight*180,this.oldRotateY-(this.originX-t)/this.element.clientWidth*180):(this.onPan(t-this.originX,i-this.originY),this.originX=t,this.originY=i)}onDragStart(e){return this.element.focus(),this.originX=e.clientX,this.originY=e.clientY,this.oldRotateX=this.rotateXInternal,this.oldRotateY=this.rotateYInternal,!0}onDragEnd(){this.originX=0,this.originY=0,this.oldRotateX=0,this.oldRotateY=0}}var W;(W||(W={})).TransformChanged="TransformChanged";var A=Object.freeze({__proto__:null,TransformController:B,get Events(){return W}});const F={layerInformationIsNotYet:"Layer information is not yet available.",dLayersView:"3D Layers View",cantDisplayLayers:"Can't display layers,",webglSupportIsDisabledInYour:"WebGL support is disabled in your browser.",checkSForPossibleReasons:"Check {PH1} for possible reasons.",slowScrollRects:"Slow scroll rects",paints:"Paints",resetView:"Reset View",showPaintProfiler:"Show Paint Profiler"},V=t.i18n.registerUIStrings("panels/layer_viewer/Layers3DView.ts",F),U=t.i18n.getLocalizedString.bind(void 0,V),_=new Map,N=new Map,X=new Map,j=new Map,Y=new Map,z=new Map;class q extends(e.ObjectWrapper.eventMixin(r.Widget.VBox)){failBanner;layerViewHost;transformController;canvasElement;lastSelection;layerTree;textureManager;chromeTextures;rects;snapshotLayers;shaderProgram;oldTextureScale;depthByLayerId;visibleLayers;maxDepth;scale;layerTexture;projectionMatrix;whiteTexture;gl;dimensionsForAutoscale;needsUpdate;panelToolbar;showSlowScrollRectsSetting;showPaintsSetting;mouseDownX;mouseDownY;constructor(e){super(!0),this.contentElement.classList.add("layers-3d-view"),this.failBanner=new r.Widget.VBox,this.failBanner.element.classList.add("full-widget-dimmed-banner"),r.UIUtils.createTextChild(this.failBanner.element,U(F.layerInformationIsNotYet)),this.layerViewHost=e,this.layerViewHost.registerView(this),this.transformController=new B(this.contentElement),this.transformController.addEventListener(W.TransformChanged,this.update,this),this.initToolbar(),this.canvasElement=this.contentElement.createChild("canvas"),this.canvasElement.tabIndex=0,this.canvasElement.addEventListener("dblclick",this.onDoubleClick.bind(this),!1),this.canvasElement.addEventListener("mousedown",this.onMouseDown.bind(this),!1),this.canvasElement.addEventListener("mouseup",this.onMouseUp.bind(this),!1),this.canvasElement.addEventListener("mouseleave",this.onMouseMove.bind(this),!1),this.canvasElement.addEventListener("mousemove",this.onMouseMove.bind(this),!1),this.canvasElement.addEventListener("contextmenu",this.onContextMenu.bind(this),!1),r.ARIAUtils.setAccessibleName(this.canvasElement,U(F.dLayersView)),this.lastSelection={},this.layerTree=null,this.textureManager=new he(this.update.bind(this)),this.chromeTextures=[],this.rects=[],this.snapshotLayers=new Map,this.layerViewHost.setLayerSnapshotMap(this.snapshotLayers),this.layerViewHost.showInternalLayersSetting().addChangeListener(this.update,this)}setLayerTree(e){this.layerTree=e,this.layerTexture=null,delete this.oldTextureScale,this.showPaints()&&this.textureManager.setLayerTree(e),this.update()}showImageForLayer(e,t){if(!t)return this.layerTexture=null,void this.update();r.UIUtils.loadImage(t).then((t=>{const i=t&&he.createTextureForImage(this.gl||null,t);this.layerTexture=i?{layer:e,texture:i}:null,this.update()}))}onResize(){this.resizeCanvas(),this.update()}willHide(){this.textureManager.suspend()}wasShown(){this.textureManager.resume(),this.registerCSSFiles([H]),this.needsUpdate&&(this.resizeCanvas(),this.update())}updateLayerSnapshot(e){this.textureManager.layerNeedsUpdate(e)}setOutline(e,t){this.lastSelection[e]=t,this.update()}hoverObject(e){this.setOutline(G.Hovered,e)}selectObject(e){this.setOutline(G.Hovered,null),this.setOutline(G.Selected,e)}snapshotForSelection(e){if("Snapshot"===e.type()){const t=e.snapshot();return t.snapshot.addReference(),Promise.resolve(t)}if(e.layer()){const t=e.layer().snapshots()[0];if(void 0!==t)return t}return Promise.resolve(null)}initGL(e){const t=e.getContext("webgl");return t?(t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.enable(t.BLEND),t.clearColor(0,0,0,0),t.enable(t.DEPTH_TEST),t):null}createShader(e,t){if(!this.gl)return;const i=this.gl.createShader(e);i&&this.shaderProgram&&(this.gl.shaderSource(i,t),this.gl.compileShader(i),this.gl.attachShader(this.shaderProgram,i))}initShaders(){if(!this.gl)return;if(this.shaderProgram=this.gl.createProgram(),!this.shaderProgram)return;this.createShader(this.gl.FRAGMENT_SHADER,Q),this.createShader(this.gl.VERTEX_SHADER,Z),this.gl.linkProgram(this.shaderProgram),this.gl.useProgram(this.shaderProgram);const e=this.gl.getAttribLocation(this.shaderProgram,"aVertexPosition");this.gl.enableVertexAttribArray(e),_.set(this.shaderProgram,e);const t=this.gl.getAttribLocation(this.shaderProgram,"aVertexColor");this.gl.enableVertexAttribArray(t),N.set(this.shaderProgram,t);const i=this.gl.getAttribLocation(this.shaderProgram,"aTextureCoord");this.gl.enableVertexAttribArray(i),X.set(this.shaderProgram,i);const s=this.gl.getUniformLocation(this.shaderProgram,"uPMatrix");j.set(this.shaderProgram,s);const r=this.gl.getUniformLocation(this.shaderProgram,"uSampler");Y.set(this.shaderProgram,r)}resizeCanvas(){this.canvasElement.width=this.canvasElement.offsetWidth*window.devicePixelRatio,this.canvasElement.height=this.canvasElement.offsetHeight*window.devicePixelRatio}updateTransformAndConstraints(){const e=this.dimensionsForAutoscale||{width:0,height:0},t=this.layerTree?this.layerTree.viewportSize():null,s=t?t.width:e.width,n=t?t.height:e.height,o=this.canvasElement.width,a=this.canvasElement.height,l=.1*o,h=.1*a,c=(o-2*l)/s,d=(a-2*h)/n,u=Math.min(c,d),p=Math.min(s/e.width,n/e.width)/2;this.transformController.setScaleConstraints(p,10/u);const m=this.transformController.scale(),g=this.transformController.rotateX(),y=this.transformController.rotateY();this.scale=m*u;const f=i.NumberUtilities.clamp(this.scale,.1,1);f!==this.oldTextureScale&&(this.oldTextureScale=f,this.textureManager.setScale(f),this.dispatchEventToListeners(K.ScaleChanged,f));const w=(new WebKitCSSMatrix).scale(m,m,m).translate(o/2,a/2,0).rotate(g,y,0).scale(u,u,u).translate(-s/2,-n/2,0);let v;for(let e=0;e{this.chromeTextures[e]=t&&he.createTextureForImage(this.gl||null,t)||void 0}))}e.call(this,0,"Images/chromeLeft.avif"),e.call(this,1,"Images/chromeMiddle.avif"),e.call(this,2,"Images/chromeRight.avif")}initGLIfNecessary(){return this.gl?this.gl:(this.gl=this.initGL(this.canvasElement),this.gl?(this.initShaders(),this.initWhiteTexture(),this.initChromeTextures(),this.textureManager.setContext(this.gl),this.gl):null)}calculateDepthsAndVisibility(){this.depthByLayerId=new Map;let e=0;const t=this.layerViewHost.showInternalLayersSetting().get();if(!this.layerTree)return;const i=t?this.layerTree.root():this.layerTree.contentRoot()||this.layerTree.root();if(!i)return;const s=[i];for(this.depthByLayerId.set(i.id(),0),this.visibleLayers=new Set;s.length>0;){const i=s.shift();if(!i)break;(t||i.drawsContent())&&this.visibleLayers.add(i);const r=i.children();for(let t=0;t=3&&this.chromeTextures.indexOf(void 0)<0,s=(this.maxDepth+1)*ae,r=Math.ceil(oe*this.scale);let n=[t.width,0,s,t.width,t.height,s,0,t.height,s,0,0,s];if(!this.gl)return;if(this.gl.lineWidth(r),this.drawRectangle(n,i?this.gl.LINE_STRIP:this.gl.LINE_LOOP,te),!i)return;const o=this.layerTree.viewportSize();if(!o)return;const a=oe/2,l=o.width+2*a;if(this.chromeTextures[0]&&this.chromeTextures[2]){const e=z.get(this.chromeTextures[0])||{naturalHeight:0,naturalWidth:0},t=e.naturalHeight,i=z.get(this.chromeTextures[2])||{naturalHeight:0,naturalWidth:0},r=l-e.naturalWidth-i.naturalWidth;let o=-a;const h=-t;for(let e=0;el)break;n=[o,h,s,o+c,h,s,o+c,h+t,s,o,h+t,s],this.drawTexture(n,this.chromeTextures[e]),o+=c}}}drawViewRect(e){if(!this.gl)return;const t=e.vertices;e.texture?this.drawTexture(t,e.texture,e.fillColor||void 0):e.fillColor&&this.drawRectangle(t,this.gl.TRIANGLE_FAN,e.fillColor),this.gl.lineWidth(e.lineWidth),e.borderColor&&this.drawRectangle(t,this.gl.LINE_LOOP,e.borderColor)}update(){if(!this.isShowing())return void(this.needsUpdate=!0);if(!this.layerTree||!this.layerTree.root())return void this.failBanner.show(this.contentElement);const e=this.initGLIfNecessary();if(!e)return this.failBanner.element.removeChildren(),this.failBanner.element.appendChild(this.webglDisabledBanner()),void this.failBanner.show(this.contentElement);this.failBanner.detach();const t=this.canvasElement.width,i=this.canvasElement.height;this.calculateDepthsAndVisibility(),this.calculateRects(),this.updateTransformAndConstraints(),e.viewport(0,0,t,i),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),this.rects.forEach(this.drawViewRect.bind(this)),this.drawViewportAndChrome()}webglDisabledBanner(){const e=this.contentElement.ownerDocument.createDocumentFragment();return e.createChild("div").textContent=U(F.cantDisplayLayers),e.createChild("div").textContent=U(F.webglSupportIsDisabledInYour),e.appendChild(t.i18n.getFormatLocalizedString(V,F.checkSForPossibleReasons,{PH1:r.XLink.XLink.create("about:gpu")})),e}selectionFromEventPoint(e){const t=e;if(!this.layerTree)return null;let i=1/0,s=null;const r=(new WebKitCSSMatrix).scale(1,-1,-1).translate(-1,-1,0).multiply(this.projectionMatrix),n=(t.clientX-this.canvasElement.totalOffsetLeft())*window.devicePixelRatio,o=-(t.clientY-this.canvasElement.totalOffsetTop())*window.devicePixelRatio;return this.rects.forEach((function(e){if(!e.relatedObject)return;const t=e.intersectWithLine(r,n,o);t&&tthis.transformController.resetAndNotify()),!1);const i=this.selectionFromEventPoint(e);i&&"Snapshot"===i.type()&&t.defaultSection().appendItem(U(F.showPaintProfiler),(()=>this.dispatchEventToListeners(K.PaintProfilerRequested,i)),!1),this.layerViewHost.showContextMenu(t,i)}onMouseMove(e){e.which||this.layerViewHost.hoverObject(this.selectionFromEventPoint(e))}onMouseDown(e){const t=e;this.mouseDownX=t.clientX,this.mouseDownY=t.clientY}onMouseUp(e){const t=e;this.mouseDownX&&Math.abs(t.clientX-this.mouseDownX)<6&&Math.abs(t.clientY-(this.mouseDownY||0))<6&&(this.canvasElement.focus(),this.layerViewHost.selectObject(this.selectionFromEventPoint(e))),delete this.mouseDownX,delete this.mouseDownY}onDoubleClick(e){const t=this.selectionFromEventPoint(e);t&&("Snapshot"===t.type()||t.layer())&&this.dispatchEventToListeners(K.PaintProfilerRequested,t),e.stopPropagation()}updatePaints(){this.showPaints()?(this.textureManager.setLayerTree(this.layerTree),this.textureManager.forceUpdate()):this.textureManager.reset(),this.update()}showPaints(){return!!this.showPaintsSetting&&this.showPaintsSetting.get()}}var G,K;!function(e){e.Hovered="hovered",e.Selected="selected"}(G||(G={})),function(e){e.PaintProfilerRequested="PaintProfilerRequested",e.ScaleChanged="ScaleChanged"}(K||(K={}));const Q="precision mediump float;\nvarying vec4 vColor;\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t)) * vColor;\n}",Z="attribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aVertexColor;\nuniform mat4 uPMatrix;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvoid main(void)\n{\ngl_Position = uPMatrix * vec4(aVertexPosition, 1.0);\nvColor = aVertexColor;\nvTextureCoord = aTextureCoord;\n}",J=[0,0,255,1],$=[0,255,0,1],ee=[0,0,0,1],te=[160,160,160,1],ie=[178,100,100,.6],se=[200,200,255,1],re=1,ne=2,oe=3,ae=20,le=4;class he{textureUpdatedCallback;throttler;scale;active;queue;tilesByLayer;gl;constructor(t){this.textureUpdatedCallback=t,this.throttler=new e.Throttler.Throttler(0),this.scale=0,this.active=!1,this.reset()}static createTextureForImage(e,t){if(!e)throw new Error("WebGLRenderingContext not provided");const i=e.createTexture();if(!i)throw new Error("Unable to create texture");return z.set(i,t),e.bindTexture(e.TEXTURE_2D,i),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),i}reset(){this.tilesByLayer&&this.setLayerTree(null),this.tilesByLayer=new Map,this.queue=[]}setContext(e){this.gl=e,this.scale&&this.updateTextures()}suspend(){this.active=!1}resume(){this.active=!0,this.queue.length&&this.update()}setLayerTree(e){const t=new Set,i=Array.from(this.tilesByLayer.keys());e&&e.forEachLayer((e=>{e.drawsContent()&&(t.add(e),this.tilesByLayer.has(e)||(this.tilesByLayer.set(e,[]),this.layerNeedsUpdate(e)))})),i.length||this.forceUpdate();for(const e of i){if(t.has(e))continue;const i=this.tilesByLayer.get(e);i&&i.forEach((e=>e.dispose())),this.tilesByLayer.delete(e)}}setSnapshotsForLayer(e,t){const i=new Map((this.tilesByLayer.get(e)||[]).map((e=>[e.snapshot,e]))),s=[],r=[];for(const e of t){const t=i.get(e.snapshot);t?(r.push(t),i.delete(e.snapshot)):s.push(new de(e))}this.tilesByLayer.set(e,r.concat(s));for(const e of i.values())e.dispose();const n=this.gl;return n&&this.scale?Promise.all(s.map((e=>e.update(n,this.scale)))).then(this.textureUpdatedCallback):Promise.resolve()}setScale(e){this.scale&&this.scale>=e||(this.scale=e,this.updateTextures())}tilesForLayer(e){return this.tilesByLayer.get(e)||[]}layerNeedsUpdate(e){this.queue.indexOf(e)<0&&this.queue.push(e),this.active&&this.throttler.schedule(this.update.bind(this))}forceUpdate(){this.queue.forEach((e=>this.updateLayer(e))),this.queue=[],this.update()}update(){const e=this.queue.shift();return e?(this.queue.length&&this.throttler.schedule(this.update.bind(this)),this.updateLayer(e)):Promise.resolve()}updateLayer(e){return Promise.all(e.snapshots()).then((t=>this.setSnapshotsForLayer(e,t.filter((e=>null!==e)))))}updateTextures(){if(this.gl&&this.scale)for(const e of this.tilesByLayer.values())for(const t of e){const e=t.updateScale(this.gl,this.scale);e&&e.then(this.textureUpdatedCallback)}}}class ce{relatedObject;lineWidth;borderColor;fillColor;texture;vertices;constructor(e){this.relatedObject=e,this.lineWidth=1,this.borderColor=null,this.fillColor=null,this.texture=null}setVertices(e,t){this.vertices=[e[0],e[1],t,e[2],e[3],t,e[4],e[5],t,e[6],e[7],t]}calculatePointOnQuad(e,t,i){const s=e[0],r=e[1],n=e[2],o=e[3],a=e[4],l=e[5],h=e[6],c=e[7],d=s+t*(n-s),u=r+t*(o-r);return[d+i*(h+t*(a-h)-d),u+i*(c+t*(l-c)-u)]}calculateVerticesFromRect(e,t,i){const s=e.quad(),r=t.x/e.width(),n=(t.x+t.width)/e.width(),o=t.y/e.height(),a=(t.y+t.height)/e.height(),l=this.calculatePointOnQuad(s,r,o).concat(this.calculatePointOnQuad(s,n,o)).concat(this.calculatePointOnQuad(s,n,a)).concat(this.calculatePointOnQuad(s,r,a));this.setVertices(l,i)}intersectWithLine(e,t,i){let s;const n=[];for(s=0;s<4;++s)n[s]=r.Geometry.multiplyVectorByMatrixAndNormalize(new r.Geometry.Vector(this.vertices[3*s],this.vertices[3*s+1],this.vertices[3*s+2]),e);const o=r.Geometry.crossProduct(r.Geometry.subtract(n[1],n[0]),r.Geometry.subtract(n[2],n[1])),a=o.x,l=o.y,h=o.z,c=-(-(a*n[0].x+l*n[0].y+h*n[0].z)+a*t+l*i)/h,d=new r.Geometry.Vector(t,i,c),u=n.map(r.Geometry.subtract.bind(null,d));for(s=0;s=t?null:this.update(e,t)}async update(e,t){this.gl=e,this.scale=t;const i=await this.snapshot.replay(t),s=i?await r.UIUtils.loadImage(i):null;this.texture=s?he.createTextureForImage(e,s):null}}var ue=Object.freeze({__proto__:null,Layers3DView:q,get OutlineType(){return G},get Events(){return K},FragmentShader:Q,VertexShader:Z,HoveredBorderColor:J,SelectedBorderColor:$,BorderColor:ee,ViewportBorderColor:te,ScrollRectBackgroundColor:ie,HoveredImageMaskColor:se,BorderWidth:re,SelectedBorderWidth:ne,ViewportBorderWidth:oe,LayerSpacing:ae,ScrollRectSpacing:le,LayerTextureManager:he,Rectangle:ce,Tile:de});const pe=new CSSStyleSheet;pe.replaceSync(".paint-profiler-overview{background-color:var(--color-background)}.paint-profiler-canvas-container{flex:auto;position:relative}.paint-profiler-pie-chart{width:60px!important;height:60px!important;padding:2px;overflow:hidden;font-size:10px}.paint-profiler-canvas-container canvas{z-index:200;background-color:var(--color-background);opacity:95%;height:100%;width:100%}.paint-profiler-canvas-container .overview-grid-window-resizer{z-index:2000}\n/*# sourceURL=paintProfiler.css */\n");const me={profiling:"Profiling…",shapes:"Shapes",bitmap:"Bitmap",text:"Text",misc:"Misc",profilingResults:"Profiling results",commandLog:"Command Log"},ge=t.i18n.registerUIStrings("panels/layer_viewer/PaintProfilerView.ts",me),ye=t.i18n.getLocalizedString.bind(void 0,ge);let fe=null,we=null;class ve extends(e.ObjectWrapper.eventMixin(r.Widget.HBox)){canvasContainer;progressBanner;pieChart;showImageCallback;canvas;context;selectionWindowInternal;innerBarWidth;minBarHeight;barPaddingWidth;outerBarWidth;pendingScale;scale;samplesPerBar;log;snapshot;logCategories;profiles;updateImageTimer;constructor(e){super(!0),this.contentElement.classList.add("paint-profiler-overview"),this.canvasContainer=this.contentElement.createChild("div","paint-profiler-canvas-container"),this.progressBanner=this.contentElement.createChild("div","full-widget-dimmed-banner hidden"),this.progressBanner.textContent=ye(me.profiling),this.pieChart=new n.PieChart.PieChart,this.populatePieChart(0,[]),this.pieChart.classList.add("paint-profiler-pie-chart"),this.contentElement.appendChild(this.pieChart),this.showImageCallback=e,this.canvas=this.canvasContainer.createChild("canvas","fill"),this.context=this.canvas.getContext("2d"),this.selectionWindowInternal=new n.OverviewGrid.Window(this.canvasContainer),this.selectionWindowInternal.addEventListener(n.OverviewGrid.Events.WindowChanged,this.onWindowChanged,this),this.innerBarWidth=4*window.devicePixelRatio,this.minBarHeight=window.devicePixelRatio,this.barPaddingWidth=2*window.devicePixelRatio,this.outerBarWidth=this.innerBarWidth+this.barPaddingWidth,this.pendingScale=1,this.scale=this.pendingScale,this.samplesPerBar=0,this.log=[],this.reset()}static categories(){return fe||(fe={shapes:new xe("shapes",ye(me.shapes),"rgb(255, 161, 129)"),bitmap:new xe("bitmap",ye(me.bitmap),"rgb(136, 196, 255)"),text:new xe("text",ye(me.text),"rgb(180, 255, 137)"),misc:new xe("misc",ye(me.misc),"rgb(206, 160, 255)")}),fe}static initLogItemCategories(){if(!we){const e=ve.categories(),t={};t.Clear=e.misc,t.DrawPaint=e.misc,t.DrawData=e.misc,t.SetMatrix=e.misc,t.PushCull=e.misc,t.PopCull=e.misc,t.Translate=e.misc,t.Scale=e.misc,t.Concat=e.misc,t.Restore=e.misc,t.SaveLayer=e.misc,t.Save=e.misc,t.BeginCommentGroup=e.misc,t.AddComment=e.misc,t.EndCommentGroup=e.misc,t.ClipRect=e.misc,t.ClipRRect=e.misc,t.ClipPath=e.misc,t.ClipRegion=e.misc,t.DrawPoints=e.shapes,t.DrawRect=e.shapes,t.DrawOval=e.shapes,t.DrawRRect=e.shapes,t.DrawPath=e.shapes,t.DrawVertices=e.shapes,t.DrawDRRect=e.shapes,t.DrawBitmap=e.bitmap,t.DrawBitmapRectToRect=e.bitmap,t.DrawBitmapMatrix=e.bitmap,t.DrawBitmapNine=e.bitmap,t.DrawSprite=e.bitmap,t.DrawPicture=e.bitmap,t.DrawText=e.text,t.DrawPosText=e.text,t.DrawPosTextH=e.text,t.DrawTextOnPath=e.text,we=t}return we}static categoryForLogItem(e){const t=i.StringUtilities.toTitleCase(e.method),s=ve.initLogItemCategories();let r=s[t];return r||(r=ve.categories().misc,s[t]=r),r}onResize(){this.update()}async setSnapshotAndLog(e,t,i){if(this.reset(),this.snapshot=e,this.snapshot&&this.snapshot.addReference(),this.log=t,this.logCategories=this.log.map(ve.categoryForLogItem),!e)return this.update(),this.populatePieChart(0,[]),void this.selectionWindowInternal.setEnabled(!1);this.selectionWindowInternal.setEnabled(!0),this.progressBanner.classList.remove("hidden"),this.updateImage();const s=await e.profile(i);this.progressBanner.classList.add("hidden"),this.profiles=s,this.update(),this.updatePieChart()}setScale(e){const t=e>this.scale;this.pendingScale=Math.min(1,2*e),t&&this.snapshot&&this.updateImage()}update(){if(this.canvas.width=this.canvasContainer.clientWidth*window.devicePixelRatio,this.canvas.height=this.canvasContainer.clientHeight*window.devicePixelRatio,this.samplesPerBar=0,!this.profiles||!this.profiles.length||!this.logCategories)return;const e=Math.floor((this.canvas.width-2*this.barPaddingWidth)/this.outerBarWidth),t=this.log.length;this.samplesPerBar=Math.ceil(t/e);let i=0;const s=[],r=[];let n={};for(let e=0,o=0,a=0;ei&&(i=a),a=0,n={},o=e}}const o=4*window.devicePixelRatio,a=(this.canvas.height-o-this.minBarHeight)/i;for(let e=0;e{e&&(this.scale=s,this.showImageCallback(e))}))}reset(){this.snapshot&&this.snapshot.release(),this.snapshot=null,this.profiles=null,this.selectionWindowInternal.reset(),this.selectionWindowInternal.setEnabled(!1)}wasShown(){super.wasShown(),this.registerCSSFiles([pe])}}var Ce;!function(e){e.WindowChanged="WindowChanged"}(Ce||(Ce={}));class be extends r.ThrottledWidget.ThrottledWidget{treeOutline;log;treeItemCache;selectionWindow;constructor(){super(),this.setMinimumSize(100,25),this.element.classList.add("overflow-auto"),this.treeOutline=new r.TreeOutline.TreeOutlineInShadow,r.ARIAUtils.setAccessibleName(this.treeOutline.contentElement,ye(me.commandLog)),this.element.appendChild(this.treeOutline.element),this.setDefaultFocusedElement(this.treeOutline.contentElement),this.log=[],this.treeItemCache=new Map}setCommandLog(e){this.log=e,this.updateWindow({left:0,right:this.log.length})}appendLogItem(e){let t=this.treeItemCache.get(e);if(t){if(t.parent)return}else t=new Se(this,e),this.treeItemCache.set(e,t);this.treeOutline.appendChild(t)}updateWindow(e){this.selectionWindow=e,this.update()}doUpdate(){if(!this.selectionWindow||!this.log.length)return this.treeOutline.removeChildren(),Promise.resolve();const e=this.treeOutline.rootElement();for(;;){const t=e.firstChild();if(!t||t.logItem.commandIndex>=this.selectionWindow.left)break;e.removeChildAtIndex(0)}for(;;){const t=e.lastChild();if(!t||t.logItem.commandIndex100?t:JSON.stringify(e);let i="",s=0;for(const r in e){if(++s>4||"object"==typeof e[r]||"string"==typeof e[r]&&e[r].length>100)return t;i&&(i+=", "),i+=e[r]}return i}paramsToString(e){let t="";for(const i in e)t&&(t+=", "),t+=this.paramToString(e[i],i);return t}update(){const e=document.createDocumentFragment();r.UIUtils.createTextChild(e,this.logItem.method+"("+this.paramsToString(this.logItem.params)+")"),this.title=e}}class Te extends r.TreeOutline.TreeElement{property;constructor(e){super(),this.property=e}static appendLogPropertyItem(e,t,i){const s=new Te({name:t,value:i});if(e.appendChild(s),i&&"object"==typeof i)for(const e in i)Te.appendLogPropertyItem(s,e,i[e])}onattach(){const e=document.createDocumentFragment();e.createChild("span","name").textContent=this.property.name;if(e.createChild("span","separator").textContent=": ",null===this.property.value||"object"!=typeof this.property.value){const t=e.createChild("span","value");t.textContent=JSON.stringify(this.property.value),t.classList.add("cm-js-"+(null===this.property.value?"null":typeof this.property.value))}this.title=e}}class xe{name;title;color;constructor(e,t,i){this.name=e,this.title=t,this.color=i}}var Pe=Object.freeze({__proto__:null,PaintProfilerView:ve,get Events(){return Ce},PaintProfilerCommandLogView:be,LogTreeElement:Se,LogPropertyTreeElement:Te,PaintProfilerCategory:xe});export{T as LayerDetailsView,O as LayerTreeOutline,m as LayerViewHost,ue as Layers3DView,Pe as PaintProfilerView,A as TransformController};
diff --git a/chii/panels/layers/layers-meta.js b/chii/panels/layers/layers-meta.js
new file mode 100644
index 00000000..c6f7f724
--- /dev/null
+++ b/chii/panels/layers/layers-meta.js
@@ -0,0 +1 @@
+import*as e from"../../core/i18n/i18n.js";import*as a from"../../ui/legacy/legacy.js";const s={layers:"Layers",showLayers:"Show Layers"},r=e.i18n.registerUIStrings("panels/layers/layers-meta.ts",s),i=e.i18n.getLazilyComputedLocalizedString.bind(void 0,r);let n;a.ViewManager.registerViewExtension({location:"panel",id:"layers",title:i(s.layers),commandPrompt:i(s.showLayers),order:100,persistence:"closeable",loadView:async()=>(await async function(){return n||(n=await import("./layers.js")),n}()).LayersPanel.LayersPanel.instance()});
diff --git a/chii/panels/layers/layers.js b/chii/panels/layers/layers.js
new file mode 100644
index 00000000..621f5ca0
--- /dev/null
+++ b/chii/panels/layers/layers.js
@@ -0,0 +1 @@
+import*as e from"../layer_viewer/layer_viewer.js";import*as t from"../../ui/legacy/legacy.js";import*as r from"../../core/common/common.js";import*as i from"../../core/i18n/i18n.js";import*as a from"../../core/sdk/sdk.js";class n extends t.SplitWidget.SplitWidget{logTreeView;paintProfilerView;constructor(t){super(!0,!1),this.logTreeView=new e.PaintProfilerView.PaintProfilerCommandLogView,this.setSidebarWidget(this.logTreeView),this.paintProfilerView=new e.PaintProfilerView.PaintProfilerView(t),this.setMainWidget(this.paintProfilerView),this.paintProfilerView.addEventListener(e.PaintProfilerView.Events.WindowChanged,this.onWindowChanged,this),this.logTreeView.focus()}reset(){this.paintProfilerView.setSnapshotAndLog(null,[],null)}profile(e){function t(e,t){this.logTreeView.setCommandLog(t||[]),this.paintProfilerView.setSnapshotAndLog(e,t||[],null),e&&e.release()}e.commandLog().then((r=>t.call(this,e,r)))}setScale(e){this.paintProfilerView.setScale(e)}onWindowChanged(){this.logTreeView.updateWindow(this.paintProfilerView.selectionWindow())}}var s,l=Object.freeze({__proto__:null,LayerPaintProfilerView:n});class o extends a.SDKModel.SDKModel{layerTreeAgent;paintProfilerModel;layerTreeInternal;throttler;enabled;lastPaintRectByLayerId;constructor(e){super(e),this.layerTreeAgent=e.layerTreeAgent(),e.registerLayerTreeDispatcher(new y(this)),this.paintProfilerModel=e.model(a.PaintProfiler.PaintProfilerModel);const t=e.model(a.ResourceTreeModel.ResourceTreeModel);t&&t.addEventListener(a.ResourceTreeModel.Events.MainFrameNavigated,this.onMainFrameNavigated,this),this.layerTreeInternal=null,this.throttler=new r.Throttler.Throttler(20)}async disable(){this.enabled&&(this.enabled=!1,await this.layerTreeAgent.invoke_disable())}enable(){this.enabled||(this.enabled=!0,this.forceEnable())}async forceEnable(){this.lastPaintRectByLayerId=new Map,this.layerTreeInternal||(this.layerTreeInternal=new d(this)),await this.layerTreeAgent.invoke_enable()}layerTree(){return this.layerTreeInternal}async layerTreeChanged(e){this.enabled&&this.throttler.schedule(this.innerSetLayers.bind(this,e))}async innerSetLayers(e){const t=this.layerTreeInternal;await t.setLayers(e),this.lastPaintRectByLayerId||(this.lastPaintRectByLayerId=new Map);for(const e of this.lastPaintRectByLayerId.keys()){const r=this.lastPaintRectByLayerId.get(e),i=t.layerById(e);i&&i.setLastPaintRect(r)}this.lastPaintRectByLayerId=new Map,this.dispatchEventToListeners(s.LayerTreeChanged)}layerPainted(e,t){if(!this.enabled)return;const r=this.layerTreeInternal.layerById(e);if(!r)return this.lastPaintRectByLayerId||(this.lastPaintRectByLayerId=new Map),void this.lastPaintRectByLayerId.set(e,t);r.didPaint(t),this.dispatchEventToListeners(s.LayerPainted,r)}onMainFrameNavigated(){this.layerTreeInternal=null,this.enabled&&this.forceEnable()}}a.SDKModel.SDKModel.register(o,{capabilities:a.Target.Capability.DOM,autostart:!1}),function(e){e.LayerTreeChanged="LayerTreeChanged",e.LayerPainted="LayerPainted"}(s||(s={}));class d extends a.LayerTreeBase.LayerTreeBase{layerTreeModel;constructor(e){super(e.target()),this.layerTreeModel=e}async setLayers(e){if(!e)return void this.innerSetLayers(e);const t=new Set;for(let r=0;re?{rect:{x:0,y:0,width:this.width(),height:this.height()},snapshot:e}:null))]}didPaint(e){this.lastPaintRectInternal=e,this.paintCountInternal=this.paintCount()+1,this.image=null}reset(e){this.nodeInternal=null,this.childrenInternal=[],this.parentInternal=null,this.paintCountInternal=0,this.layerPayload=e,this.image=null,this.scrollRectsInternal=this.layerPayload.scrollRects||[],this.stickyPositionConstraintInternal=this.layerPayload.stickyPositionConstraint?new a.LayerTreeBase.StickyPositionConstraint(this.layerTreeModel.layerTree(),this.layerPayload.stickyPositionConstraint):null}matrixFromArray(e){return new WebKitCSSMatrix("matrix3d("+e.map((function(e){return e.toFixed(9)})).join(",")+")")}calculateTransformToViewport(e){let r=(new WebKitCSSMatrix).translate(this.layerPayload.offsetX,this.layerPayload.offsetY);if(this.layerPayload.transform){const e=this.matrixFromArray(this.layerPayload.transform),i=new t.Geometry.Vector(this.layerPayload.width*this.anchorPoint()[0],this.layerPayload.height*this.anchorPoint()[1],this.anchorPoint()[2]),a=t.Geometry.multiplyVectorByMatrixAndNormalize(i,r),n=(new WebKitCSSMatrix).translate(-a.x,-a.y,-a.z);r=n.inverse().multiply(e.multiply(n.multiply(r)))}return r=e.multiply(r),r}createVertexArrayForRect(e,t){return[0,0,0,e,0,0,e,t,0,0,t,0]}calculateQuad(e){const r=this.calculateTransformToViewport(e);this.quadInternal=[];const i=this.createVertexArrayForRect(this.layerPayload.width,this.layerPayload.height);for(let e=0;e<4;++e){const a=t.Geometry.multiplyVectorByMatrixAndNormalize(new t.Geometry.Vector(i[3*e],i[3*e+1],i[3*e+2]),r);this.quadInternal.push(a.x,a.y)}this.childrenInternal.forEach((function(e){e.calculateQuad(r)}))}}class y{layerTreeModel;constructor(e){this.layerTreeModel=e}layerTreeDidChange({layers:e}){this.layerTreeModel.layerTreeChanged(e||null)}layerPainted({layerId:e,clip:t}){this.layerTreeModel.layerPainted(e,t)}}var c=Object.freeze({__proto__:null,LayerTreeModel:o,get Events(){return s},AgentLayerTree:d,AgentLayer:h});const u={details:"Details",profiler:"Profiler"},P=i.i18n.registerUIStrings("panels/layers/LayersPanel.ts",u),w=i.i18n.getLocalizedString.bind(void 0,P);let p;class f extends t.Panel.PanelWithSidebar{model;layerViewHost;layerTreeOutline;rightSplitWidget;layers3DView;tabbedPane;layerDetailsView;paintProfilerView;updateThrottler;layerBeingProfiled;constructor(){super("layers",225),this.model=null,a.TargetManager.TargetManager.instance().observeTargets(this),this.layerViewHost=new e.LayerViewHost.LayerViewHost,this.layerTreeOutline=new e.LayerTreeOutline.LayerTreeOutline(this.layerViewHost),this.layerTreeOutline.addEventListener("PaintProfilerRequested",this.onPaintProfileRequested,this),this.panelSidebarElement().appendChild(this.layerTreeOutline.element),this.setDefaultFocusedElement(this.layerTreeOutline.element),this.rightSplitWidget=new t.SplitWidget.SplitWidget(!1,!0,"layerDetailsSplitViewState"),this.splitWidget().setMainWidget(this.rightSplitWidget),this.layers3DView=new e.Layers3DView.Layers3DView(this.layerViewHost),this.rightSplitWidget.setMainWidget(this.layers3DView),this.layers3DView.addEventListener(e.Layers3DView.Events.PaintProfilerRequested,this.onPaintProfileRequested,this),this.layers3DView.addEventListener(e.Layers3DView.Events.ScaleChanged,this.onScaleChanged,this),this.tabbedPane=new t.TabbedPane.TabbedPane,this.rightSplitWidget.setSidebarWidget(this.tabbedPane),this.layerDetailsView=new e.LayerDetailsView.LayerDetailsView(this.layerViewHost),this.layerDetailsView.addEventListener(e.LayerDetailsView.Events.PaintProfilerRequested,this.onPaintProfileRequested,this),this.tabbedPane.appendTab(g.Details,w(u.details),this.layerDetailsView),this.paintProfilerView=new n(this.showImage.bind(this)),this.tabbedPane.addEventListener(t.TabbedPane.Events.TabClosed,this.onTabClosed,this),this.updateThrottler=new r.Throttler.Throttler(100)}static instance(e={forceNew:null}){const{forceNew:t}=e;return p&&!t||(p=new f),p}focus(){this.layerTreeOutline.focus()}wasShown(){super.wasShown(),this.model&&this.model.enable()}willHide(){this.model&&this.model.disable(),super.willHide()}targetAdded(e){this.model||(this.model=e.model(o),this.model&&(this.model.addEventListener(s.LayerTreeChanged,this.onLayerTreeUpdated,this),this.model.addEventListener(s.LayerPainted,this.onLayerPainted,this),this.isShowing()&&this.model.enable()))}targetRemoved(e){this.model&&this.model.target()===e&&(this.model.removeEventListener(s.LayerTreeChanged,this.onLayerTreeUpdated,this),this.model.removeEventListener(s.LayerPainted,this.onLayerPainted,this),this.model.disable(),this.model=null)}onLayerTreeUpdated(){this.updateThrottler.schedule(this.update.bind(this))}update(){if(this.model){this.layerViewHost.setLayerTree(this.model.layerTree());const e=this.model.target().model(a.ResourceTreeModel.ResourceTreeModel);if(e){const t=e.mainFrame;if(t){const e=t.url;this.element.setAttribute("test-current-url",e)}}}return Promise.resolve()}onLayerPainted({data:e}){if(!this.model)return;const t=this.layerViewHost.selection();t&&t.layer()===e&&this.layerDetailsView.update(),this.layers3DView.updateLayerSnapshot(e)}onPaintProfileRequested({data:e}){this.layers3DView.snapshotForSelection(e).then((t=>{t&&(this.layerBeingProfiled=e.layer(),this.tabbedPane.hasTab(g.Profiler)||this.tabbedPane.appendTab(g.Profiler,w(u.profiler),this.paintProfilerView,void 0,!0,!0),this.tabbedPane.selectTab(g.Profiler),this.paintProfilerView.profile(t.snapshot))}))}onTabClosed(e){e.data.tabId===g.Profiler&&this.layerBeingProfiled&&(this.paintProfilerView.reset(),this.layers3DView.showImageForLayer(this.layerBeingProfiled,void 0),this.layerBeingProfiled=null)}showImage(e){this.layerBeingProfiled&&this.layers3DView.showImageForLayer(this.layerBeingProfiled,e)}onScaleChanged(e){this.paintProfilerView.setScale(e.data)}}const g={Details:"details",Profiler:"profiler"};var T=Object.freeze({__proto__:null,LayersPanel:f,DetailsViewTabs:g});export{l as LayerPaintProfilerView,c as LayerTreeModel,T as LayersPanel};
diff --git a/chii/panels/lighthouse/lighthouse-legacy.js b/chii/panels/lighthouse/lighthouse-legacy.js
new file mode 100644
index 00000000..b21ea64f
--- /dev/null
+++ b/chii/panels/lighthouse/lighthouse-legacy.js
@@ -0,0 +1 @@
+import*as e from"./lighthouse.js";self.Lighthouse=self.Lighthouse||{},Lighthouse=Lighthouse||{},Lighthouse.ReportGenerator,Lighthouse.LighthousePanel=e.LighthousePanel.LighthousePanel,Lighthouse.ReportSelector=e.LighthouseReportSelector.ReportSelector,Lighthouse.StatusView=e.LighthouseStatusView.StatusView;
diff --git a/chii/panels/lighthouse/lighthouse-meta.js b/chii/panels/lighthouse/lighthouse-meta.js
new file mode 100644
index 00000000..49437fce
--- /dev/null
+++ b/chii/panels/lighthouse/lighthouse-meta.js
@@ -0,0 +1 @@
+import*as i from"../../core/i18n/i18n.js";import*as e from"../../ui/legacy/legacy.js";const t={showLighthouse:"Show `Lighthouse`"},o=i.i18n.registerUIStrings("panels/lighthouse/lighthouse-meta.ts",t),n=i.i18n.getLazilyComputedLocalizedString.bind(void 0,o);let s;e.ViewManager.registerViewExtension({location:"panel",id:"lighthouse",title:i.i18n.lockedLazyString("Lighthouse"),commandPrompt:n(t.showLighthouse),order:90,loadView:async()=>(await async function(){return s||(s=await import("./lighthouse.js")),s}()).LighthousePanel.LighthousePanel.instance(),tags:[i.i18n.lockedLazyString("lighthouse"),i.i18n.lockedLazyString("pwa")]});
diff --git a/chii/panels/lighthouse/lighthouse.js b/chii/panels/lighthouse/lighthouse.js
new file mode 100644
index 00000000..d49c956e
--- /dev/null
+++ b/chii/panels/lighthouse/lighthouse.js
@@ -0,0 +1,60 @@
+import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as n from"../../core/sdk/sdk.js";import*as r from"../../core/host/host.js";import*as i from"../../models/emulation/emulation.js";import*as o from"../../ui/legacy/legacy.js";import*as a from"../emulation/emulation.js";import*as s from"../../third_party/lighthouse/report/report.js";import*as l from"../../core/platform/platform.js";import*as c from"../../models/workspace/workspace.js";import*as h from"../../ui/legacy/components/utils/utils.js";import*as d from"../../ui/legacy/theme_support/theme_support.js";import*as p from"../timeline/timeline.js";var g,u;g=self,u=function(){function e(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}
+/**
+ * @license Copyright 2017 The Lighthouse Authors. All Rights Reserved.
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+ */
+const t={REPORT_TEMPLATE:'\x3c!--\n@license\nCopyright 2018 The Lighthouse Authors. All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the "License");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS-IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--\x3e\n\n\n\n \n \n \n Lighthouse Report\n \n\n\n \n\n \n\n
+
diff --git a/package.json b/package.json
index 741d064c..827251b6 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,8 @@
"main": "dist/ssr-stub.js",
"module": "dist/vue-repl.js",
"files": [
- "dist"
+ "dist",
+ "chii"
],
"types": "dist/vue-repl.d.ts",
"exports": {
@@ -26,6 +27,18 @@
"import": "./dist/codemirror-editor.js",
"require": null
},
+ "./preview-chii": {
+ "types": "./dist/preview-chii.d.ts",
+ "import": "./dist/preview-chii.js"
+ },
+ "./preview-normal": {
+ "types": "./dist/preview-normal.d.ts",
+ "import": "./dist/preview-normal.js"
+ },
+ "./plugin-vite": {
+ "types": "./dist/plugin-vite.d.ts",
+ "import": "./dist/plugin-vite.js"
+ },
"./style.css": "./dist/vue-repl.css",
"./dist/style.css": "./dist/vue-repl.css"
},
@@ -91,5 +104,8 @@
"vite-plugin-dts": "^3.6.4",
"vue": "^3.4.3",
"vue-tsc": "1.9.0-alpha.3"
+ },
+ "dependencies": {
+ "chobitsu": "^1.4.6"
}
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 052f323e..5fd33b56 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -4,6 +4,11 @@ settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
+dependencies:
+ chobitsu:
+ specifier: ^1.4.6
+ version: 1.4.6
+
devDependencies:
'@babel/types':
specifier: ^7.23.6
@@ -35,12 +40,18 @@ devDependencies:
bumpp:
specifier: ^9.2.1
version: 9.2.1
+ chii:
+ specifier: ^1.10.0
+ version: 1.10.0
codemirror:
specifier: ^5.65.16
version: 5.65.16
conventional-changelog-cli:
specifier: ^4.1.0
version: 4.1.0
+ esbuild-plugin-inline-image:
+ specifier: ^0.0.9
+ version: 0.0.9
fflate:
specifier: ^0.8.1
version: 0.8.1
@@ -874,6 +885,14 @@ packages:
through: 2.3.8
dev: true
+ /accepts@1.3.8:
+ resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==}
+ engines: {node: '>= 0.6'}
+ dependencies:
+ mime-types: 2.1.35
+ negotiator: 0.6.3
+ dev: true
+
/acorn@7.4.1:
resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==}
engines: {node: '>=0.4.0'}
@@ -954,10 +973,52 @@ packages:
resolution: {integrity: sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==}
dev: true
+ /asn1@0.2.6:
+ resolution: {integrity: sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==}
+ dependencies:
+ safer-buffer: 2.1.2
+ dev: true
+
+ /assert-plus@1.0.0:
+ resolution: {integrity: sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==}
+ engines: {node: '>=0.8'}
+ dev: true
+
+ /asynckit@0.4.0:
+ resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
+
+ /aws-sign2@0.7.0:
+ resolution: {integrity: sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==}
+ dev: true
+
+ /aws4@1.12.0:
+ resolution: {integrity: sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==}
+ dev: true
+
+ /axios@0.27.2:
+ resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==}
+ dependencies:
+ follow-redirects: 1.15.3
+ form-data: 4.0.0
+ transitivePeerDependencies:
+ - debug
+ dev: false
+
/balanced-match@1.0.2:
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
dev: true
+ /base64-arraybuffer@1.0.2:
+ resolution: {integrity: sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==}
+ engines: {node: '>= 0.6.0'}
+ dev: false
+
+ /bcrypt-pbkdf@1.0.2:
+ resolution: {integrity: sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==}
+ dependencies:
+ tweetnacl: 0.14.5
+ dev: true
+
/binary-extensions@2.2.0:
resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==}
engines: {node: '>=8'}
@@ -998,6 +1059,11 @@ packages:
- supports-color
dev: true
+ /bytes@3.1.2:
+ resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==}
+ engines: {node: '>= 0.8'}
+ dev: true
+
/c12@1.5.1:
resolution: {integrity: sha512-BWZRJgDEveT8uI+cliCwvYSSSSvb4xKoiiu5S0jaDbKBopQLQF7E+bq9xKk1pTcG+mUa3yXuFO7bD9d8Lr9Xxg==}
dependencies:
@@ -1021,6 +1087,14 @@ packages:
engines: {node: '>=8'}
dev: true
+ /cache-content-type@1.0.1:
+ resolution: {integrity: sha512-IKufZ1o4Ut42YUrZSo8+qnMTrFuKkvyoLXUywKz9GJ5BrhOFGhLdkx9sG4KAnVvbY6kEcSFjLQul+DVmBm2bgA==}
+ engines: {node: '>= 6.0.0'}
+ dependencies:
+ mime-types: 2.1.35
+ ylru: 1.3.2
+ dev: true
+
/call-bind@1.0.5:
resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==}
dependencies:
@@ -1033,6 +1107,10 @@ packages:
resolution: {integrity: sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==}
dev: true
+ /caseless@0.12.0:
+ resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==}
+ dev: true
+
/chalk@2.4.2:
resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==}
engines: {node: '>=4'}
@@ -1053,6 +1131,37 @@ packages:
is-regex: 1.1.4
dev: true
+ /chii@1.10.0:
+ resolution: {integrity: sha512-cmqQ1Y8SzWR+zZKM2KixENI3xQdgSy5Ey812iv8pbwCoUrgK+en61sqcMVinP/G6/mWx+egmo0L6FzPeufadnQ==}
+ hasBin: true
+ dependencies:
+ commander: 5.1.0
+ handlebars: 4.7.8
+ koa: 2.15.0
+ koa-compress: 4.0.1
+ koa-router: 8.0.8
+ koa-send: 5.0.1
+ licia: 1.39.2
+ request: 2.88.2
+ ws: 7.5.9
+ transitivePeerDependencies:
+ - bufferutil
+ - supports-color
+ - utf-8-validate
+ dev: true
+
+ /chobitsu@1.4.6:
+ resolution: {integrity: sha512-2UQNaY3HDWwuouQ6qj7GtYcfAR4Me5RCepIvrl6pEnTKaLDxHoytMtgXaOJOqeNBj2q8L0EYX47BCz5qKiY9nQ==}
+ dependencies:
+ axios: 0.27.2
+ core-js: 3.35.0
+ html2canvas: 1.4.1
+ licia: 1.39.2
+ luna-dom-highlighter: 1.0.2
+ transitivePeerDependencies:
+ - debug
+ dev: false
+
/chokidar@3.5.3:
resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==}
engines: {node: '>= 8.10.0'}
@@ -1088,6 +1197,11 @@ packages:
string-width: 7.0.0
dev: true
+ /co@4.6.0:
+ resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==}
+ engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'}
+ dev: true
+
/codemirror@5.65.16:
resolution: {integrity: sha512-br21LjYmSlVL0vFCPWPfhzUCT34FM/pAdK7rRIZwa0rrtrIdotvP4Oh4GUHsu2E3IrQMCfRkL/fN3ytMNxVQvg==}
dev: true
@@ -1111,6 +1225,12 @@ packages:
engines: {node: '>=0.1.90'}
dev: true
+ /combined-stream@1.0.8:
+ resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
+ engines: {node: '>= 0.8'}
+ dependencies:
+ delayed-stream: 1.0.0
+
/commander@11.1.0:
resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==}
engines: {node: '>=16'}
@@ -1121,6 +1241,11 @@ packages:
engines: {node: '>= 6'}
dev: true
+ /commander@5.1.0:
+ resolution: {integrity: sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==}
+ engines: {node: '>= 6'}
+ dev: true
+
/commander@9.5.0:
resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==}
engines: {node: ^12.20.0 || >=14}
@@ -1135,6 +1260,13 @@ packages:
dot-prop: 5.3.0
dev: true
+ /compressible@2.0.18:
+ resolution: {integrity: sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==}
+ engines: {node: '>= 0.6'}
+ dependencies:
+ mime-db: 1.52.0
+ dev: true
+
/computeds@0.0.1:
resolution: {integrity: sha512-7CEBgcMjVmitjYo5q8JTJVra6X5mQ20uTThdK+0kR7UEaDrAWEQcRiBtWJzga4eRpP6afNwwLsX2SET2JhVB1Q==}
dev: true
@@ -1143,6 +1275,18 @@ packages:
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
dev: true
+ /content-disposition@0.5.4:
+ resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==}
+ engines: {node: '>= 0.6'}
+ dependencies:
+ safe-buffer: 5.2.1
+ dev: true
+
+ /content-type@1.0.5:
+ resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==}
+ engines: {node: '>= 0.6'}
+ dev: true
+
/conventional-changelog-angular@7.0.0:
resolution: {integrity: sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ==}
engines: {node: '>=16'}
@@ -1272,6 +1416,23 @@ packages:
split2: 4.2.0
dev: true
+ /cookies@0.9.1:
+ resolution: {integrity: sha512-TG2hpqe4ELx54QER/S3HQ9SRVnQnGBtKUz5bLQWtYAQ+o6GpgMs6sYUvaiJjVxb+UXwhRhAEP3m7LbsIZ77Hmw==}
+ engines: {node: '>= 0.8'}
+ dependencies:
+ depd: 2.0.0
+ keygrip: 1.1.0
+ dev: true
+
+ /core-js@3.35.0:
+ resolution: {integrity: sha512-ntakECeqg81KqMueeGJ79Q5ZgQNR+6eaE8sxGCx62zMbAIj65q+uYvatToew3m6eAGdU4gNZwpZ34NMe4GYswg==}
+ requiresBuild: true
+ dev: false
+
+ /core-util-is@1.0.2:
+ resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==}
+ dev: true
+
/cross-spawn@7.0.3:
resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==}
engines: {node: '>= 8'}
@@ -1281,6 +1442,12 @@ packages:
which: 2.0.2
dev: true
+ /css-line-break@2.1.0:
+ resolution: {integrity: sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==}
+ dependencies:
+ utrie: 1.0.2
+ dev: false
+
/csstype@3.1.3:
resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==}
dev: true
@@ -1290,6 +1457,13 @@ packages:
engines: {node: '>=12'}
dev: true
+ /dashdash@1.14.1:
+ resolution: {integrity: sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==}
+ engines: {node: '>=0.10'}
+ dependencies:
+ assert-plus: 1.0.0
+ dev: true
+
/de-indent@1.0.2:
resolution: {integrity: sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==}
dev: true
@@ -1306,6 +1480,10 @@ packages:
ms: 2.1.2
dev: true
+ /deep-equal@1.0.1:
+ resolution: {integrity: sha512-bHtC0iYvWhyaTzvV3CZgPeZQqCOBGyGsVV7v4eevpdkLHfiSrXUdBG+qAuSz4RI70sszvjQ1QSZ98An1yNwpSw==}
+ dev: true
+
/define-data-property@1.1.1:
resolution: {integrity: sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==}
engines: {node: '>= 0.4'}
@@ -1319,10 +1497,33 @@ packages:
resolution: {integrity: sha512-Vy2wmG3NTkmHNg/kzpuvHhkqeIx3ODWqasgCRbKtbXEN0G+HpEEv9BtJLp7ZG1CZloFaC41Ah3ZFbq7aqCqMeQ==}
dev: true
+ /delayed-stream@1.0.0:
+ resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
+ engines: {node: '>=0.4.0'}
+
+ /delegates@1.0.0:
+ resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==}
+ dev: true
+
+ /depd@1.1.2:
+ resolution: {integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==}
+ engines: {node: '>= 0.6'}
+ dev: true
+
+ /depd@2.0.0:
+ resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
+ engines: {node: '>= 0.8'}
+ dev: true
+
/destr@2.0.2:
resolution: {integrity: sha512-65AlobnZMiCET00KaFFjUefxDX0khFA/E4myqZ7a6Sq1yZtR8+FVIvilVX66vF2uobSumxooYZChiRPCKNqhmg==}
dev: true
+ /destroy@1.2.0:
+ resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==}
+ engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16}
+ dev: true
+
/dot-prop@5.3.0:
resolution: {integrity: sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==}
engines: {node: '>=8'}
@@ -1335,6 +1536,17 @@ packages:
engines: {node: '>=12'}
dev: true
+ /ecc-jsbn@0.1.2:
+ resolution: {integrity: sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==}
+ dependencies:
+ jsbn: 0.1.1
+ safer-buffer: 2.1.2
+ dev: true
+
+ /ee-first@1.1.1:
+ resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}
+ dev: true
+
/emmet@2.4.6:
resolution: {integrity: sha512-dJfbdY/hfeTyf/Ef7Y7ubLYzkBvPQ912wPaeVYpAxvFxkEBf/+hJu4H6vhAvFN6HlxqedlfVn2x1S44FfQ97pg==}
dependencies:
@@ -1346,6 +1558,11 @@ packages:
resolution: {integrity: sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==}
dev: true
+ /encodeurl@1.0.2:
+ resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==}
+ engines: {node: '>= 0.8'}
+ dev: true
+
/entities@4.5.0:
resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
engines: {node: '>=0.12'}
@@ -1357,6 +1574,10 @@ packages:
is-arrayish: 0.2.1
dev: true
+ /esbuild-plugin-inline-image@0.0.9:
+ resolution: {integrity: sha512-pw3ZgN2phh32Z7BpKrhRDtmI+iVCl+Gc0BLOT9croXg1MnMjRuN7aXhIQirhLeK39erkIwfFlhy6xieroBGc1Q==}
+ dev: true
+
/esbuild@0.19.10:
resolution: {integrity: sha512-S1Y27QGt/snkNYrRcswgRFqZjaTG5a5xM3EQo97uNBnH505pdzSNe/HLBq1v0RO7iK/ngdbhJB6mDAp0OK+iUA==}
engines: {node: '>=12'}
@@ -1388,6 +1609,10 @@ packages:
'@esbuild/win32-x64': 0.19.10
dev: true
+ /escape-html@1.0.3:
+ resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==}
+ dev: true
+
/escape-string-regexp@1.0.5:
resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==}
engines: {node: '>=0.8.0'}
@@ -1416,6 +1641,15 @@ packages:
strip-final-newline: 3.0.0
dev: true
+ /extend@3.0.2:
+ resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==}
+ dev: true
+
+ /extsprintf@1.3.0:
+ resolution: {integrity: sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==}
+ engines: {'0': node >=0.6.0}
+ dev: true
+
/fast-deep-equal@3.1.3:
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
dev: true
@@ -1465,6 +1699,43 @@ packages:
hasBin: true
dev: true
+ /follow-redirects@1.15.3:
+ resolution: {integrity: sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==}
+ engines: {node: '>=4.0'}
+ peerDependencies:
+ debug: '*'
+ peerDependenciesMeta:
+ debug:
+ optional: true
+ dev: false
+
+ /forever-agent@0.6.1:
+ resolution: {integrity: sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==}
+ dev: true
+
+ /form-data@2.3.3:
+ resolution: {integrity: sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==}
+ engines: {node: '>= 0.12'}
+ dependencies:
+ asynckit: 0.4.0
+ combined-stream: 1.0.8
+ mime-types: 2.1.35
+ dev: true
+
+ /form-data@4.0.0:
+ resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}
+ engines: {node: '>= 6'}
+ dependencies:
+ asynckit: 0.4.0
+ combined-stream: 1.0.8
+ mime-types: 2.1.35
+ dev: false
+
+ /fresh@0.5.2:
+ resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==}
+ engines: {node: '>= 0.6'}
+ dev: true
+
/fs-extra@7.0.1:
resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==}
engines: {node: '>=6 <7 || >=8'}
@@ -1516,6 +1787,12 @@ packages:
engines: {node: '>=16'}
dev: true
+ /getpass@0.1.7:
+ resolution: {integrity: sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==}
+ dependencies:
+ assert-plus: 1.0.0
+ dev: true
+
/giget@1.1.3:
resolution: {integrity: sha512-zHuCeqtfgqgDwvXlR84UNgnJDuUHQcNI5OqWqFxxuk2BshuKbYhJWdxBsEo4PvKqoGh23lUAIvBNpChMLv7/9Q==}
hasBin: true
@@ -1591,6 +1868,20 @@ packages:
uglify-js: 3.17.4
dev: true
+ /har-schema@2.0.0:
+ resolution: {integrity: sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==}
+ engines: {node: '>=4'}
+ dev: true
+
+ /har-validator@5.1.5:
+ resolution: {integrity: sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==}
+ engines: {node: '>=6'}
+ deprecated: this library is no longer supported
+ dependencies:
+ ajv: 6.12.6
+ har-schema: 2.0.0
+ dev: true
+
/has-flag@3.0.0:
resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==}
engines: {node: '>=4'}
@@ -1642,6 +1933,52 @@ packages:
lru-cache: 10.1.0
dev: true
+ /html2canvas@1.4.1:
+ resolution: {integrity: sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==}
+ engines: {node: '>=8.0.0'}
+ dependencies:
+ css-line-break: 2.1.0
+ text-segmentation: 1.0.3
+ dev: false
+
+ /http-assert@1.5.0:
+ resolution: {integrity: sha512-uPpH7OKX4H25hBmU6G1jWNaqJGpTXxey+YOUizJUAgu0AjLUeC8D73hTrhvDS5D+GJN1DN1+hhc/eF/wpxtp0w==}
+ engines: {node: '>= 0.8'}
+ dependencies:
+ deep-equal: 1.0.1
+ http-errors: 1.8.1
+ dev: true
+
+ /http-errors@1.6.3:
+ resolution: {integrity: sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==}
+ engines: {node: '>= 0.6'}
+ dependencies:
+ depd: 1.1.2
+ inherits: 2.0.3
+ setprototypeof: 1.1.0
+ statuses: 1.5.0
+ dev: true
+
+ /http-errors@1.8.1:
+ resolution: {integrity: sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==}
+ engines: {node: '>= 0.6'}
+ dependencies:
+ depd: 1.1.2
+ inherits: 2.0.4
+ setprototypeof: 1.2.0
+ statuses: 1.5.0
+ toidentifier: 1.0.1
+ dev: true
+
+ /http-signature@1.2.0:
+ resolution: {integrity: sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==}
+ engines: {node: '>=0.8', npm: '>=1.3.7'}
+ dependencies:
+ assert-plus: 1.0.0
+ jsprim: 1.4.2
+ sshpk: 1.18.0
+ dev: true
+
/https-proxy-agent@7.0.2:
resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==}
engines: {node: '>= 14'}
@@ -1669,6 +2006,10 @@ packages:
wrappy: 1.0.2
dev: true
+ /inherits@2.0.3:
+ resolution: {integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==}
+ dev: true
+
/inherits@2.0.4:
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
dev: true
@@ -1714,6 +2055,13 @@ packages:
get-east-asian-width: 1.2.0
dev: true
+ /is-generator-function@1.0.10:
+ resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==}
+ engines: {node: '>= 0.4'}
+ dependencies:
+ has-tostringtag: 1.0.0
+ dev: true
+
/is-glob@4.0.3:
resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}
engines: {node: '>=0.10.0'}
@@ -1751,10 +2099,22 @@ packages:
text-extensions: 2.4.0
dev: true
+ /is-typedarray@1.0.0:
+ resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==}
+ dev: true
+
+ /isarray@0.0.1:
+ resolution: {integrity: sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==}
+ dev: true
+
/isexe@2.0.0:
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
dev: true
+ /isstream@0.1.2:
+ resolution: {integrity: sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==}
+ dev: true
+
/jiti@1.21.0:
resolution: {integrity: sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==}
hasBin: true
@@ -1768,6 +2128,10 @@ packages:
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
dev: true
+ /jsbn@0.1.1:
+ resolution: {integrity: sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==}
+ dev: true
+
/json-parse-even-better-errors@3.0.1:
resolution: {integrity: sha512-aatBvbL26wVUCLmbWdCpeu9iF5wOyWpagiKkInA+kfws3sWdBrTnsvN2CKcyCYyUrc7rebNBlK6+kteg7ksecg==}
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
@@ -1777,6 +2141,10 @@ packages:
resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}
dev: true
+ /json-schema@0.4.0:
+ resolution: {integrity: sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==}
+ dev: true
+
/json-stringify-safe@5.0.1:
resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==}
dev: true
@@ -1800,15 +2168,119 @@ packages:
engines: {'0': node >= 0.2.0}
dev: true
+ /jsprim@1.4.2:
+ resolution: {integrity: sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==}
+ engines: {node: '>=0.6.0'}
+ dependencies:
+ assert-plus: 1.0.0
+ extsprintf: 1.3.0
+ json-schema: 0.4.0
+ verror: 1.10.0
+ dev: true
+
+ /keygrip@1.1.0:
+ resolution: {integrity: sha512-iYSchDJ+liQ8iwbSI2QqsQOvqv58eJCEanyJPJi+Khyu8smkcKSFUCbPwzFcL7YVtZ6eONjqRX/38caJ7QjRAQ==}
+ engines: {node: '>= 0.6'}
+ dependencies:
+ tsscmp: 1.0.6
+ dev: true
+
/kleur@3.0.3:
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
engines: {node: '>=6'}
dev: true
+ /koa-compose@4.1.0:
+ resolution: {integrity: sha512-8ODW8TrDuMYvXRwra/Kh7/rJo9BtOfPc6qO8eAfC80CnCvSjSl0bkRM24X6/XBBEyj0v1nRUQ1LyOy3dbqOWXw==}
+ dev: true
+
+ /koa-compress@4.0.1:
+ resolution: {integrity: sha512-It4WYfsBb9HegnFgcBhiRbPeh1LDjXhRM4+xi2jMp8ujwaVAdqhFzHpbDWuTxbLxuBwStn+Bwdwn2zDZxeNChg==}
+ engines: {node: '>= 8.0.0'}
+ dependencies:
+ bytes: 3.1.2
+ compressible: 2.0.18
+ http-errors: 1.8.1
+ koa-is-json: 1.0.0
+ statuses: 2.0.1
+ dev: true
+
+ /koa-convert@2.0.0:
+ resolution: {integrity: sha512-asOvN6bFlSnxewce2e/DK3p4tltyfC4VM7ZwuTuepI7dEQVcvpyFuBcEARu1+Hxg8DIwytce2n7jrZtRlPrARA==}
+ engines: {node: '>= 10'}
+ dependencies:
+ co: 4.6.0
+ koa-compose: 4.1.0
+ dev: true
+
+ /koa-is-json@1.0.0:
+ resolution: {integrity: sha512-+97CtHAlWDx0ndt0J8y3P12EWLwTLMXIfMnYDev3wOTwH/RpBGMlfn4bDXlMEg1u73K6XRE9BbUp+5ZAYoRYWw==}
+ dev: true
+
+ /koa-router@8.0.8:
+ resolution: {integrity: sha512-2rNF2cgu/EWi/NV8GlBE5+H/QBoaof83X6Z0dULmalkbt7W610/lyP2EOLVqVrUUFfjsVWL/Ju5TVBcGJDY9XQ==}
+ engines: {node: '>= 8.0.0'}
+ deprecated: '**IMPORTANT 10x+ PERFORMANCE UPGRADE**: Please upgrade to v12.0.1+ as we have fixed an issue with debuglog causing 10x slower router benchmark performance, see https://github.com/koajs/router/pull/173'
+ dependencies:
+ debug: 4.3.4
+ http-errors: 1.8.1
+ koa-compose: 4.1.0
+ methods: 1.1.2
+ path-to-regexp: 1.8.0
+ urijs: 1.19.11
+ transitivePeerDependencies:
+ - supports-color
+ dev: true
+
+ /koa-send@5.0.1:
+ resolution: {integrity: sha512-tmcyQ/wXXuxpDxyNXv5yNNkdAMdFRqwtegBXUaowiQzUKqJehttS0x2j0eOZDQAyloAth5w6wwBImnFzkUz3pQ==}
+ engines: {node: '>= 8'}
+ dependencies:
+ debug: 4.3.4
+ http-errors: 1.8.1
+ resolve-path: 1.4.0
+ transitivePeerDependencies:
+ - supports-color
+ dev: true
+
+ /koa@2.15.0:
+ resolution: {integrity: sha512-KEL/vU1knsoUvfP4MC4/GthpQrY/p6dzwaaGI6Rt4NQuFqkw3qrvsdYF5pz3wOfi7IGTvMPHC9aZIcUKYFNxsw==}
+ engines: {node: ^4.8.4 || ^6.10.1 || ^7.10.1 || >= 8.1.4}
+ dependencies:
+ accepts: 1.3.8
+ cache-content-type: 1.0.1
+ content-disposition: 0.5.4
+ content-type: 1.0.5
+ cookies: 0.9.1
+ debug: 4.3.4
+ delegates: 1.0.0
+ depd: 2.0.0
+ destroy: 1.2.0
+ encodeurl: 1.0.2
+ escape-html: 1.0.3
+ fresh: 0.5.2
+ http-assert: 1.5.0
+ http-errors: 1.8.1
+ is-generator-function: 1.0.10
+ koa-compose: 4.1.0
+ koa-convert: 2.0.0
+ on-finished: 2.4.1
+ only: 0.0.2
+ parseurl: 1.3.3
+ statuses: 1.5.0
+ type-is: 1.6.18
+ vary: 1.1.2
+ transitivePeerDependencies:
+ - supports-color
+ dev: true
+
/kolorist@1.8.0:
resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==}
dev: true
+ /licia@1.39.2:
+ resolution: {integrity: sha512-4pte7gXufSAa3JcsR0iT+2Lj2RX5Qpj+Nc0n84xs0ynNmw7eJmeZzk2oPTEtsQqwHwtT+NiX0arGkL5HPjTs7g==}
+
/lilconfig@3.0.0:
resolution: {integrity: sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g==}
engines: {node: '>=14'}
@@ -1896,6 +2368,13 @@ packages:
yallist: 4.0.0
dev: true
+ /luna-dom-highlighter@1.0.2:
+ resolution: {integrity: sha512-yRESdOjYAW5OKq9oiEHJihhkRQBYg9zFKRVR4Yq8AJsGpoWAMhNX4mHJM0o8qIn4rR6s70/DowGsg6/RWWSRZw==}
+ dependencies:
+ licia: 1.39.2
+ path2d-polyfill: 1.2.3
+ dev: false
+
/magic-string@0.30.5:
resolution: {integrity: sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==}
engines: {node: '>=12'}
@@ -1903,6 +2382,11 @@ packages:
'@jridgewell/sourcemap-codec': 1.4.15
dev: true
+ /media-typer@0.3.0:
+ resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==}
+ engines: {node: '>= 0.6'}
+ dev: true
+
/meow@12.1.1:
resolution: {integrity: sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==}
engines: {node: '>=16.10'}
@@ -1917,6 +2401,11 @@ packages:
engines: {node: '>= 8'}
dev: true
+ /methods@1.1.2:
+ resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==}
+ engines: {node: '>= 0.6'}
+ dev: true
+
/micromatch@4.0.5:
resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==}
engines: {node: '>=8.6'}
@@ -1925,6 +2414,16 @@ packages:
picomatch: 2.3.1
dev: true
+ /mime-db@1.52.0:
+ resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
+ engines: {node: '>= 0.6'}
+
+ /mime-types@2.1.35:
+ resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
+ engines: {node: '>= 0.6'}
+ dependencies:
+ mime-db: 1.52.0
+
/mimic-fn@2.1.0:
resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==}
engines: {node: '>=6'}
@@ -2018,6 +2517,11 @@ packages:
hasBin: true
dev: true
+ /negotiator@0.6.3:
+ resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==}
+ engines: {node: '>= 0.6'}
+ dev: true
+
/neo-async@2.6.2:
resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==}
dev: true
@@ -2048,6 +2552,10 @@ packages:
path-key: 4.0.0
dev: true
+ /oauth-sign@0.9.0:
+ resolution: {integrity: sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==}
+ dev: true
+
/object-assign@4.1.1:
resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}
engines: {node: '>=0.10.0'}
@@ -2057,6 +2565,13 @@ packages:
resolution: {integrity: sha512-zuHHiGTYTA1sYJ/wZN+t5HKZaH23i4yI1HMwbuXm24Nid7Dv0KcuRlKoNKS9UNfAVSBlnGLcuQrnOKWOZoEGaw==}
dev: true
+ /on-finished@2.4.1:
+ resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==}
+ engines: {node: '>= 0.8'}
+ dependencies:
+ ee-first: 1.1.1
+ dev: true
+
/once@1.4.0:
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
dependencies:
@@ -2077,6 +2592,10 @@ packages:
mimic-fn: 4.0.0
dev: true
+ /only@0.0.2:
+ resolution: {integrity: sha512-Fvw+Jemq5fjjyWz6CpKx6w9s7xxqo3+JCyM0WXWeCSOboZ8ABkyvP8ID4CZuChA/wxSx+XSJmdOm8rGVyJ1hdQ==}
+ dev: true
+
/p-limit@4.0.0:
resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
@@ -2102,6 +2621,11 @@ packages:
type-fest: 3.13.1
dev: true
+ /parseurl@1.3.3:
+ resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
+ engines: {node: '>= 0.8'}
+ dev: true
+
/path-browserify@1.0.1:
resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==}
dev: true
@@ -2130,6 +2654,16 @@ packages:
resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
dev: true
+ /path-to-regexp@1.8.0:
+ resolution: {integrity: sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==}
+ dependencies:
+ isarray: 0.0.1
+ dev: true
+
+ /path2d-polyfill@1.2.3:
+ resolution: {integrity: sha512-ZfUll0QEl41nbTjgZ/NHx91daupW3KWO+/iou8uxD7x7r26YtL1PmEaoWTtXHFP+6Y0NqXpwqphW7igHsgsnnQ==}
+ dev: false
+
/pathe@1.1.1:
resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==}
dev: true
@@ -2138,6 +2672,10 @@ packages:
resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==}
dev: true
+ /performance-now@2.1.0:
+ resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==}
+ dev: true
+
/picocolors@1.0.0:
resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==}
dev: true
@@ -2189,6 +2727,10 @@ packages:
sisteransi: 1.0.5
dev: true
+ /psl@1.9.0:
+ resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==}
+ dev: true
+
/pug-error@2.0.0:
resolution: {integrity: sha512-sjiUsi9M4RAGHktC1drQfCr5C5eriu24Lfbt4s+7SykztEOwVZtbFk1RRq0tzLxcMxMYTBR+zMQaG07J/btayQ==}
dev: true
@@ -2213,6 +2755,11 @@ packages:
engines: {node: '>=6'}
dev: true
+ /qs@6.5.3:
+ resolution: {integrity: sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==}
+ engines: {node: '>=0.6'}
+ dev: true
+
/queue-microtask@1.2.3:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
dev: true
@@ -2251,6 +2798,41 @@ packages:
picomatch: 2.3.1
dev: true
+ /request@2.88.2:
+ resolution: {integrity: sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==}
+ engines: {node: '>= 6'}
+ deprecated: request has been deprecated, see https://github.com/request/request/issues/3142
+ dependencies:
+ aws-sign2: 0.7.0
+ aws4: 1.12.0
+ caseless: 0.12.0
+ combined-stream: 1.0.8
+ extend: 3.0.2
+ forever-agent: 0.6.1
+ form-data: 2.3.3
+ har-validator: 5.1.5
+ http-signature: 1.2.0
+ is-typedarray: 1.0.0
+ isstream: 0.1.2
+ json-stringify-safe: 5.0.1
+ mime-types: 2.1.35
+ oauth-sign: 0.9.0
+ performance-now: 2.1.0
+ qs: 6.5.3
+ safe-buffer: 5.2.1
+ tough-cookie: 2.5.0
+ tunnel-agent: 0.6.0
+ uuid: 3.4.0
+ dev: true
+
+ /resolve-path@1.4.0:
+ resolution: {integrity: sha512-i1xevIst/Qa+nA9olDxLWnLk8YZbi8R/7JPbCMcgyWaFR6bKWaexgJgEB5oc2PKMjYdrHynyz0NY+if+H98t1w==}
+ engines: {node: '>= 0.8'}
+ dependencies:
+ http-errors: 1.6.3
+ path-is-absolute: 1.0.1
+ dev: true
+
/resolve@1.19.0:
resolution: {integrity: sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==}
dependencies:
@@ -2311,6 +2893,14 @@ packages:
queue-microtask: 1.2.3
dev: true
+ /safe-buffer@5.2.1:
+ resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
+ dev: true
+
+ /safer-buffer@2.1.2:
+ resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
+ dev: true
+
/semver@7.5.4:
resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==}
engines: {node: '>=10'}
@@ -2329,6 +2919,14 @@ packages:
has-property-descriptors: 1.0.1
dev: true
+ /setprototypeof@1.1.0:
+ resolution: {integrity: sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==}
+ dev: true
+
+ /setprototypeof@1.2.0:
+ resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}
+ dev: true
+
/shebang-command@2.0.0:
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
engines: {node: '>=8'}
@@ -2433,6 +3031,32 @@ packages:
resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==}
dev: true
+ /sshpk@1.18.0:
+ resolution: {integrity: sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==}
+ engines: {node: '>=0.10.0'}
+ hasBin: true
+ dependencies:
+ asn1: 0.2.6
+ assert-plus: 1.0.0
+ bcrypt-pbkdf: 1.0.2
+ dashdash: 1.14.1
+ ecc-jsbn: 0.1.2
+ getpass: 0.1.7
+ jsbn: 0.1.1
+ safer-buffer: 2.1.2
+ tweetnacl: 0.14.5
+ dev: true
+
+ /statuses@1.5.0:
+ resolution: {integrity: sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==}
+ engines: {node: '>= 0.6'}
+ dev: true
+
+ /statuses@2.0.1:
+ resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==}
+ engines: {node: '>= 0.8'}
+ dev: true
+
/string-argv@0.3.2:
resolution: {integrity: sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==}
engines: {node: '>=0.6.19'}
@@ -2519,6 +3143,12 @@ packages:
engines: {node: '>=8'}
dev: true
+ /text-segmentation@1.0.3:
+ resolution: {integrity: sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==}
+ dependencies:
+ utrie: 1.0.2
+ dev: false
+
/thenify-all@1.6.0:
resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==}
engines: {node: '>=0.8'}
@@ -2548,14 +3178,42 @@ packages:
is-number: 7.0.0
dev: true
+ /toidentifier@1.0.1:
+ resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==}
+ engines: {node: '>=0.6'}
+ dev: true
+
/token-stream@1.0.0:
resolution: {integrity: sha512-VSsyNPPW74RpHwR8Fc21uubwHY7wMDeJLys2IX5zJNih+OnAnaifKHo+1LHT7DAdloQ7apeaaWg8l7qnf/TnEg==}
dev: true
+ /tough-cookie@2.5.0:
+ resolution: {integrity: sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==}
+ engines: {node: '>=0.8'}
+ dependencies:
+ psl: 1.9.0
+ punycode: 2.3.1
+ dev: true
+
/ts-interface-checker@0.1.13:
resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==}
dev: true
+ /tsscmp@1.0.6:
+ resolution: {integrity: sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==}
+ engines: {node: '>=0.6.x'}
+ dev: true
+
+ /tunnel-agent@0.6.0:
+ resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==}
+ dependencies:
+ safe-buffer: 5.2.1
+ dev: true
+
+ /tweetnacl@0.14.5:
+ resolution: {integrity: sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==}
+ dev: true
+
/type-detect@4.0.8:
resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==}
engines: {node: '>=4'}
@@ -2571,6 +3229,14 @@ packages:
engines: {node: '>=16'}
dev: true
+ /type-is@1.6.18:
+ resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==}
+ engines: {node: '>= 0.6'}
+ dependencies:
+ media-typer: 0.3.0
+ mime-types: 2.1.35
+ dev: true
+
/typescript-auto-import-cache@0.3.0:
resolution: {integrity: sha512-Rq6/q4O9iyqUdjvOoyas7x/Qf9nWUMeqpP3YeTaLA+uECgfy5wOhfOS+SW/+fZ/uI/ZcKaf+2/ZhFzXh8xfofQ==}
dependencies:
@@ -2610,6 +3276,22 @@ packages:
punycode: 2.3.1
dev: true
+ /urijs@1.19.11:
+ resolution: {integrity: sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==}
+ dev: true
+
+ /utrie@1.0.2:
+ resolution: {integrity: sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==}
+ dependencies:
+ base64-arraybuffer: 1.0.2
+ dev: false
+
+ /uuid@3.4.0:
+ resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==}
+ deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
+ hasBin: true
+ dev: true
+
/validate-npm-package-license@3.0.4:
resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==}
dependencies:
@@ -2622,6 +3304,20 @@ packages:
engines: {node: '>= 0.10'}
dev: true
+ /vary@1.1.2:
+ resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}
+ engines: {node: '>= 0.8'}
+ dev: true
+
+ /verror@1.10.0:
+ resolution: {integrity: sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==}
+ engines: {'0': node >=0.6.0}
+ dependencies:
+ assert-plus: 1.0.0
+ core-util-is: 1.0.2
+ extsprintf: 1.3.0
+ dev: true
+
/vite-plugin-dts@3.6.4(@types/node@20.10.5)(typescript@5.3.3)(vite@5.0.10):
resolution: {integrity: sha512-yOVhUI/kQhtS6lCXRYYLv2UUf9bftcwQK9ROxCX2ul17poLQs02ctWX7+vXB8GPRzH8VCK3jebEFtPqqijXx6w==}
engines: {node: ^14.18.0 || >=16.0.0}
@@ -2921,6 +3617,19 @@ packages:
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
dev: true
+ /ws@7.5.9:
+ resolution: {integrity: sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==}
+ engines: {node: '>=8.3.0'}
+ peerDependencies:
+ bufferutil: ^4.0.1
+ utf-8-validate: ^5.0.2
+ peerDependenciesMeta:
+ bufferutil:
+ optional: true
+ utf-8-validate:
+ optional: true
+ dev: true
+
/yallist@4.0.0:
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
dev: true
@@ -2930,6 +3639,11 @@ packages:
engines: {node: '>= 14'}
dev: true
+ /ylru@1.3.2:
+ resolution: {integrity: sha512-RXRJzMiK6U2ye0BlGGZnmpwJDPgakn6aNQ0A7gHRbD4I0uvK4TW6UqkK1V0pp9jskjJBAXd3dRrbzWkqJ+6cxA==}
+ engines: {node: '>= 4.0.0'}
+ dev: true
+
/yocto-queue@1.0.0:
resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==}
engines: {node: '>=12.20'}
diff --git a/src/Repl.vue b/src/Repl.vue
index 80b576a2..ea783691 100644
--- a/src/Repl.vue
+++ b/src/Repl.vue
@@ -6,9 +6,13 @@ import { provide, ref, toRef, computed } from 'vue'
import type { EditorComponentType } from './editor/types'
import EditorContainer from './editor/EditorContainer.vue'
+import type PreviewNormal from './output/mode-normal/Preview.vue'
+import type PreviewChii from './output/mode-chii/Preview.vue'
+
export interface Props {
theme?: 'dark' | 'light'
editor: EditorComponentType
+ preview: typeof PreviewChii | typeof PreviewNormal
store?: Store
autoResize?: boolean
showCompileOutput?: boolean
@@ -19,6 +23,7 @@ export interface Props {
layout?: 'horizontal' | 'vertical'
layoutReverse?: boolean
ssr?: boolean
+ chii?: string
previewOptions?: {
headHTML?: string
bodyHTML?: string
@@ -105,8 +110,10 @@ defineExpose({ reload })
diff --git a/src/SplitPane.vue b/src/SplitPane.vue
index 44d6ef60..8540ccde 100644
--- a/src/SplitPane.vue
+++ b/src/SplitPane.vue
@@ -2,7 +2,10 @@
import { ref, reactive, computed, inject } from 'vue'
import { Store } from './store'
-const props = defineProps<{ layout?: 'horizontal' | 'vertical' }>()
+const props = defineProps<{
+ layout?: 'horizontal' | 'vertical'
+ defaultSplit?: number
+}>()
const isVertical = computed(() => props.layout === 'vertical')
const container = ref()
@@ -13,7 +16,7 @@ const showOutput = ref(store.initialShowOutput)
const state = reactive({
dragging: false,
- split: 50,
+ split: props.defaultSplit ?? 50,
})
const boundSplit = computed(() => {
diff --git a/src/index.ts b/src/index.ts
index 172a7069..6b2bbadc 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,5 +1,4 @@
export { default as Repl } from './Repl.vue'
-export { default as Preview } from './output/Preview.vue'
export { ReplStore, File } from './store'
export { compileFile } from './transform'
export type { Props as ReplProps } from './Repl.vue'
diff --git a/src/output/Output.vue b/src/output/Output.vue
index 6ff61a10..d803efff 100644
--- a/src/output/Output.vue
+++ b/src/output/Output.vue
@@ -1,5 +1,6 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/output/mode-chii/chobitsu-embed.ts b/src/output/mode-chii/chobitsu-embed.ts
new file mode 100644
index 00000000..63032e15
--- /dev/null
+++ b/src/output/mode-chii/chobitsu-embed.ts
@@ -0,0 +1,116 @@
+import chobitsu from 'chobitsu'
+
+const scriptEls: HTMLScriptElement[] = []
+
+Object.assign(window, {
+ process: { env: {} },
+ __modules__: >{},
+ __export__(mod: any, key: string, get: () => any) {
+ Object.defineProperty(mod, key, {
+ enumerable: true,
+ configurable: true,
+ get,
+ })
+ },
+ __dynamic_import__(key: string) {
+ return Promise.resolve(this.__modules__[key])
+ },
+})
+
+const sendToDevtools = (message: { method: string; params?: any }) => {
+ window.parent.postMessage(JSON.stringify(message), '*')
+}
+let id = 0
+const sendToChobitsu = (message: {
+ method: string
+ params?: any
+ id?: string
+}) => {
+ message.id = 'tmp' + ++id
+ chobitsu.sendRawMessage(JSON.stringify(message))
+}
+chobitsu.setOnMessage((message) => {
+ if (message.includes('"id":"tmp')) return
+ window.parent.postMessage(message, '*')
+})
+let loaded = false
+window.addEventListener('message', async ({ data }) => {
+ const { event } = data
+ try {
+ if (event === 'DEV') {
+ if (loaded) chobitsu.sendRawMessage(data.data)
+
+ return
+ }
+ if (event === 'LOADED') {
+ if (loaded) return
+ loaded = true
+ sendToDevtools({
+ method: 'Page.frameNavigated',
+ params: {
+ frame: {
+ id: '1',
+ mimeType: 'text/html',
+ securityOrigin: location.origin,
+ url: location.href,
+ },
+ type: 'Navigation',
+ },
+ })
+ sendToChobitsu({ method: 'Network.enable' })
+ sendToDevtools({ method: 'Runtime.executionContextsCleared' })
+ sendToChobitsu({ method: 'Runtime.enable' })
+ sendToChobitsu({ method: 'Debugger.enable' })
+ sendToChobitsu({ method: 'DOMStorage.enable' })
+ sendToChobitsu({ method: 'DOM.enable' })
+ sendToChobitsu({ method: 'CSS.enable' })
+ sendToChobitsu({ method: 'Overlay.enable' })
+ sendToDevtools({ method: 'DOM.documentUpdated' })
+
+ return
+ }
+ } catch (e) {
+ console.error(e)
+ }
+
+ if (event === 'MYEVAL') {
+ if (scriptEls.length) {
+ scriptEls.forEach((el) => {
+ document.head.removeChild(el)
+ })
+ scriptEls.length = 0
+ }
+
+ let { script: scripts } = data.data
+ try {
+ for (const script of scripts) {
+ const scriptEl = document.createElement('script')
+ scriptEl.setAttribute('type', 'module')
+ // send ok in the module script to ensure sequential evaluation
+ // of multiple proxy.eval() calls
+ const done = new Promise((resolve) => {
+ ;(window as unknown as any).__next__ = resolve
+ })
+ scriptEl.innerHTML = script + `\nwindow.__next__()`
+ document.head.appendChild(scriptEl)
+ scriptEl.onerror = (err) => console.error(err)
+ scriptEls.push(scriptEl)
+ await done
+ }
+
+ window.parent.postMessage(
+ {
+ event: 'MYEVAL',
+ id: data.id,
+ },
+ '*'
+ )
+ } catch (error: any) {
+ window.parent.postMessage({
+ event: 'MYEVAL',
+ id: data.id,
+ error: error.message,
+ })
+ }
+ }
+})
diff --git a/src/output/mode-chii/devtools.html b/src/output/mode-chii/devtools.html
new file mode 100644
index 00000000..37e2129c
--- /dev/null
+++ b/src/output/mode-chii/devtools.html
@@ -0,0 +1,16 @@
+
+
+
+ DevTools
+
+
+ SCRIPT_CHII
+
+
+
diff --git a/src/output/mode-chii/srcdoc.html b/src/output/mode-chii/srcdoc.html
new file mode 100644
index 00000000..2ee49eb0
--- /dev/null
+++ b/src/output/mode-chii/srcdoc.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+ PREVIEW_OPTIONS_HEAD
+
+
+ PREVIEW_OPTIONS_PLACEHOLDER
+
+
diff --git a/src/output/Preview.vue b/src/output/mode-normal/Preview.vue
similarity index 92%
rename from src/output/Preview.vue
rename to src/output/mode-normal/Preview.vue
index d69f08a1..4385dea8 100644
--- a/src/output/Preview.vue
+++ b/src/output/mode-normal/Preview.vue
@@ -1,5 +1,5 @@
-
+
@@ -292,4 +297,7 @@ defineExpose({ reload })
border: none;
background-color: #fff;
}
-
+.iframe-container.dark :deep(iframe) {
+ background-color: #1e1e1e;
+}
+
\ No newline at end of file
diff --git a/src/output/PreviewProxy.ts b/src/output/mode-normal/PreviewProxy.ts
similarity index 99%
rename from src/output/PreviewProxy.ts
rename to src/output/mode-normal/PreviewProxy.ts
index 178dafda..9c01167b 100644
--- a/src/output/PreviewProxy.ts
+++ b/src/output/mode-normal/PreviewProxy.ts
@@ -93,4 +93,4 @@ export class PreviewProxy {
handle_links() {
return this.iframe_command('catch_clicks', {})
}
-}
+}
\ No newline at end of file
diff --git a/src/output/srcdoc.html b/src/output/mode-normal/srcdoc.html
similarity index 99%
rename from src/output/srcdoc.html
rename to src/output/mode-normal/srcdoc.html
index 5828afd9..9e8d0d52 100644
--- a/src/output/srcdoc.html
+++ b/src/output/mode-normal/srcdoc.html
@@ -368,4 +368,4 @@
-
+
\ No newline at end of file
diff --git a/src/shims-braw.d.ts b/src/shims-braw.d.ts
new file mode 100644
index 00000000..f82187ab
--- /dev/null
+++ b/src/shims-braw.d.ts
@@ -0,0 +1,4 @@
+declare module '*?braw' {
+ const value: string
+ export default value
+}
diff --git a/src/utils.ts b/src/utils.ts
index fd458862..4bea12db 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -9,6 +9,23 @@ export function debounce(fn: Function, n = 100) {
}, n)
}
}
+export function debounceAsync(fn: Function, n = 100) {
+ let handle: any
+ let oldResolve: (() => void) | undefined
+ return (...args: any[]) => {
+ return new Promise((resolve, reject) => {
+ oldResolve?.()
+
+ oldResolve = resolve
+ if (handle) clearTimeout(handle)
+ handle = setTimeout(() => {
+ resolve(fn(...args))
+ oldResolve?.()
+ oldResolve = undefined
+ }, n)
+ })
+ }
+}
export function utoa(data: string): string {
const buffer = strToU8(data)
diff --git a/src/vite-plugin-chii.ts b/src/vite-plugin-chii.ts
new file mode 100644
index 00000000..1025538e
--- /dev/null
+++ b/src/vite-plugin-chii.ts
@@ -0,0 +1,56 @@
+import { build, type Plugin } from 'vite'
+import { resolve } from 'node:path'
+
+export default function vitePluginChii(conf?: { baseUrl: string }): Plugin {
+ let outDir: string, isProd: boolean
+ return {
+ name: 'vite-plugin-chii',
+ configResolved(config) {
+ outDir = config.build.outDir
+ isProd = config.isProduction
+ },
+ resolveId(id) {
+ if (id === 'virtual:chii') {
+ return 'virtual:chii'
+ }
+ },
+ async load(id) {
+ if (id === 'virtual:chii') {
+ if (!isProd)
+ return `export default new URL("${resolve(
+ __dirname,
+ '../chii/entrypoints/chii_app/chii_app.js'
+ )}", import.meta.url).toString()`
+
+ await build({
+ configFile: false,
+ build: {
+ emptyOutDir: false,
+ target: 'esnext',
+ minify: false,
+ assetsInlineLimit: 0,
+ lib: {
+ entry: {
+ chii: resolve(
+ __dirname,
+ '..',
+ 'chii/entrypoints/chii_app/chii_app.js'
+ ),
+ },
+ formats: ['es'],
+ fileName: () => '[name].js',
+ },
+ outDir,
+ },
+ })
+
+ // return the path of the compiled file
+ return `export default ${
+ conf?.baseUrl
+ ? `${conf.baseUrl}/chii.js`
+ : '`${location.origin}/chii.js`'
+ }`
+ }
+ },
+ }
+}
diff --git a/test/main.ts b/test/main.ts
index e6053511..f4cd3b33 100644
--- a/test/main.ts
+++ b/test/main.ts
@@ -2,6 +2,10 @@ import { createApp, h, watchEffect } from 'vue'
import { Repl, ReplStore } from '../src'
import MonacoEditor from '../src/editor/MonacoEditor.vue'
// import CodeMirrorEditor from '../src/editor/CodeMirrorEditor.vue'
+import PreviewChii from '../src/output/mode-chii/Preview.vue'
+import chii from 'virtual:chii'
+
+// import PreviewNormal from '../src/output/mode-normal/Preview.vue'
;(window as any).process = { env: {} }
const App = {
@@ -43,6 +47,8 @@ const App = {
store,
theme: 'dark',
editor: MonacoEditor,
+ preview: PreviewChii,
+ chii,
// layout: 'vertical',
ssr: true,
sfcOptions: {
diff --git a/tsconfig.json b/tsconfig.json
index 38d5a5d6..ee55df0a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -19,5 +19,5 @@
"rootDir": ".",
"skipLibCheck": true
},
- "include": ["src", "test", "vite.config.ts"]
+ "include": ["src", "test", "vite.config.ts", "src/vite-plugin-chii.ts"]
}
diff --git a/vite.config.ts b/vite.config.ts
index 48f6d0f9..ac61b213 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -58,6 +58,7 @@ export default mergeConfig(base, {
},
base: './',
build: {
+ emptyOutDir: false,
target: 'esnext',
minify: false,
lib: {
@@ -65,6 +66,9 @@ export default mergeConfig(base, {
'vue-repl': './src/index.ts',
'monaco-editor': './src/editor/MonacoEditor.vue',
'codemirror-editor': './src/editor/CodeMirrorEditor.vue',
+ 'preview-chii': './src/output/mode-chii/Preview.vue',
+ 'preview-normal': './src/output/mode-normal/Preview.vue',
+ 'plugin-vite': './src/vite-plugin-chii.ts'
},
formats: ['es'],
fileName: () => '[name].js',
@@ -74,7 +78,7 @@ export default mergeConfig(base, {
output: {
chunkFileNames: 'chunks/[name]-[hash].js',
},
- external: ['vue', 'vue/compiler-sfc'],
+ external: ['vue', 'vue/compiler-sfc', 'node:path', 'vite'],
},
},
})
diff --git a/vite.preview.config.ts b/vite.preview.config.ts
index 4f4f8399..c55ee7aa 100644
--- a/vite.preview.config.ts
+++ b/vite.preview.config.ts
@@ -1,14 +1,58 @@
-import { defineConfig } from 'vite'
+import { defineConfig, Plugin } from 'vite'
import vue from '@vitejs/plugin-vue'
import replace from '@rollup/plugin-replace'
+import esbuild from 'esbuild'
+import Chii from './src/vite-plugin-chii'
+
+import { rmSync } from 'fs'
+
+rmSync(`${__dirname}/dist`, { recursive: true, force: true })
+
+function vitePluginBuildRaw(): Plugin {
+ return {
+ name: 'vite-plugin-build-raw',
+ transform(src, id) {
+ if (id.endsWith('?braw')) {
+ id = id.replace(/\?braw$/, '')
+ // console.log({ id })
+ const code = esbuild.buildSync({
+ entryPoints: [id],
+ format: 'iife',
+ bundle: true,
+ minify:
+ id.includes('&minify') || process.env.NODE_ENV === 'production',
+ treeShaking: true,
+ write: false,
+ // sourcemap: true
+ // sideEff,
+ define: Object.fromEntries(
+ Object.entries(process.env).map(([name, value]) => [
+ `process.env.${name.replace(/[^\w\d_$]/g, '_')}`,
+ JSON.stringify(value),
+ ])
+ ),
+ })
+ const { text } = code.outputFiles[0]
+
+ return {
+ code: `export default ${JSON.stringify(text)}`,
+
+ map: null,
+ }
+ }
+ },
+ }
+}
export default defineConfig({
plugins: [
+ vitePluginBuildRaw(),
vue({
script: {
defineModel: true,
},
}),
+ Chii(),
],
resolve: {
alias: {
@@ -17,6 +61,7 @@ export default defineConfig({
},
},
build: {
+ emptyOutDir: false,
commonjsOptions: {
ignore: ['typescript'],
},