import*as Common from"../common/common.js";import*as UI from"../ui/ui.js";export class ApplicationPanelTreeElement extends UI.TreeOutline.TreeElement{constructor(e,t,n){super(t,n),this.resourcesPanel=e,UI.ARIAUtils.setAccessibleName(this.listItemElement,t)}get itemURL(){throw new Error("Unimplemented Method")}onselect(e){if(!e)return!1;const t=[];for(let n=this;n;n=n.parent){const e=n instanceof ApplicationPanelTreeElement&&n.itemURL;if(!e)break;t.push(e)}return this.resourcesPanel.setLastSelectedItemPath(t),!1}showView(e){this.resourcesPanel.showView(e)}}export class ExpandableApplicationPanelTreeElement extends ApplicationPanelTreeElement{constructor(e,t,n,s=!1){super(e,t,!1),this.expandedSetting=Common.Settings.Settings.instance().createSetting("resources"+n+"Expanded",s),this.categoryName=t,this.categoryLink=null}get itemURL(){return"category://"+this.categoryName}setLink(e){this.categoryLink=e}onselect(e){return super.onselect(e),this.resourcesPanel.showCategoryView(this.categoryName,this.categoryLink),!1}onattach(){super.onattach(),this.expandedSetting.get()&&this.expand()}onexpand(){this.expandedSetting.set(!0)}oncollapse(){this.expandedSetting.set(!1)}}