UNPKG

p3x-redis-ui-material

Version:

💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity

27 lines (23 loc) • 30.9 kB
import{a as de}from"./chunk-KLZILXP3.js";import{b as Re,c as Ve}from"./chunk-HFDIHHHN.js";import{$b as I,$c as Ke,A as ne,Aa as Ce,Ab as we,B as ie,Bb as g,Cb as E,D as v,Db as Ie,F as ve,Fa as z,Ia as k,Ja as H,Ka as _,Kb as b,Ld as Oe,Ma as C,N as se,Na as Ee,O as P,P as D,Pd as Le,Q as K,Tc as q,Ub as Ae,Uc as Pe,V as R,Wa as Q,X as De,Xa as Te,Ya as Me,Z as c,Zb as oe,_b as Se,_c as ae,ac as T,ad as je,bb as B,bd as Be,cb as u,d as S,db as p,e as y,h as xe,ib as U,j as h,ja as re,kb as $,l as ye,lb as w,n as f,nb as W,o as F,oc as Fe,pa as be,qa as j,qb as Ne,r as te,ra as V,rb as J,sb as O,tb as L,w as me,xa as x,zb as ke}from"./chunk-KQUCMSSK.js";import{a as _e,b as ge}from"./chunk-O7S4L63H.js";var le=class{dataNodes;expansionModel=new de(!0);trackBy;getLevel;isExpandable;getChildren;toggle(r){this.expansionModel.toggle(this._trackByValue(r))}expand(r){this.expansionModel.select(this._trackByValue(r))}collapse(r){this.expansionModel.deselect(this._trackByValue(r))}isExpanded(r){return this.expansionModel.isSelected(this._trackByValue(r))}toggleDescendants(r){this.expansionModel.isSelected(this._trackByValue(r))?this.collapseDescendants(r):this.expandDescendants(r)}collapseAll(){this.expansionModel.clear()}expandDescendants(r){let e=[r];e.push(...this.getDescendants(r)),this.expansionModel.select(...e.map(t=>this._trackByValue(t)))}collapseDescendants(r){let e=[r];e.push(...this.getDescendants(r)),this.expansionModel.deselect(...e.map(t=>this._trackByValue(t)))}_trackByValue(r){return this.trackBy?this.trackBy(r):r}},X=class extends le{getLevel;isExpandable;options;constructor(r,e,t){super(),this.getLevel=r,this.isExpandable=e,this.options=t,this.options&&(this.trackBy=this.options.trackBy)}getDescendants(r){let e=this.dataNodes.indexOf(r),t=[];for(let n=e+1;n<this.dataNodes.length&&this.getLevel(r)<this.getLevel(this.dataNodes[n]);n++)t.push(this.dataNodes[n]);return t}expandAll(){this.expansionModel.select(...this.dataNodes.map(r=>this._trackByValue(r)))}};var he=new De("CDK_TREE_NODE_OUTLET_NODE"),Y=(()=>{class i{viewContainer=c(z);_node=c(he,{optional:!0});constructor(){}static \u0275fac=function(t){return new(t||i)};static \u0275dir=_({type:i,selectors:[["","cdkTreeNodeOutlet",""]]})}return i})(),ce=class{$implicit;level;index;count;constructor(r){this.$implicit=r}},G=(()=>{class i{template=c(Ce);when;constructor(){}static \u0275fac=function(t){return new(t||i)};static \u0275dir=_({type:i,selectors:[["","cdkTreeNodeDef",""]],inputs:{when:[0,"cdkTreeNodeDefWhen","when"]}})}return i})();function ze(){return Error("Could not find a tree control, levelAccessor, or childrenAccessor for the tree.")}var A=(()=>{class i{_differs=c(Se);_changeDetectorRef=c(oe);_elementRef=c(V);_dir=c(ae);_onDestroy=new S;_dataDiffer;_defaultNodeDef=null;_dataSubscription;_levels=new Map;_parents=new Map;_ariaSets=new Map;get dataSource(){return this._dataSource}set dataSource(e){this._dataSource!==e&&this._switchDataSource(e)}_dataSource;treeControl;levelAccessor;childrenAccessor;trackBy;expansionKey;_nodeOutlet;_nodeDefs;viewChange=new y({start:0,end:Number.MAX_VALUE});_expansionModel;_flattenedNodes=new y([]);_nodeType=new y(null);_nodes=new y(new Map);_keyManagerNodes=new y([]);_keyManagerFactory=c(Pe);_keyManager;_viewInit=!1;constructor(){}ngAfterContentInit(){this._initializeKeyManager()}ngAfterContentChecked(){this._updateDefaultNodeDefinition(),this._subscribeToDataChanges()}ngOnDestroy(){this._nodeOutlet.viewContainer.clear(),this._nodes.complete(),this._keyManagerNodes.complete(),this._nodeType.complete(),this._flattenedNodes.complete(),this.viewChange.complete(),this._onDestroy.next(),this._onDestroy.complete(),this._dataSource&&typeof this._dataSource.disconnect=="function"&&this.dataSource.disconnect(this),this._dataSubscription?.unsubscribe(),this._dataSubscription=void 0,this._keyManager?.destroy()}ngOnInit(){this._checkTreeControlUsage(),this._initializeDataDiffer()}ngAfterViewInit(){this._viewInit=!0}_updateDefaultNodeDefinition(){let e=this._nodeDefs.filter(t=>!t.when);e.length>1,this._defaultNodeDef=e[0]}_setNodeTypeIfUnset(e){this._nodeType.value===null&&this._nodeType.next(e)}_switchDataSource(e){this._dataSource&&typeof this._dataSource.disconnect=="function"&&this.dataSource.disconnect(this),this._dataSubscription?.unsubscribe(),this._dataSubscription=void 0,e||this._nodeOutlet.viewContainer.clear(),this._dataSource=e,this._nodeDefs&&this._subscribeToDataChanges()}_getExpansionModel(){return this.treeControl?this.treeControl.expansionModel:(this._expansionModel??=new de(!0),this._expansionModel)}_subscribeToDataChanges(){if(this._dataSubscription)return;let e;je(this._dataSource)?e=this._dataSource.connect(this):ye(this._dataSource)?e=this._dataSource:Array.isArray(this._dataSource)&&(e=h(this._dataSource)),e&&(this._dataSubscription=this._getRenderData(e).pipe(D(this._onDestroy)).subscribe(t=>{this._renderDataChanges(t)}))}_getRenderData(e){let t=this._getExpansionModel();return F([e,this._nodeType,t.changed.pipe(se(null),K(n=>{this._emitExpansionChanges(n)}))]).pipe(P(([n,s])=>s===null?h({renderNodes:n,flattenedNodes:null,nodeType:s}):this._computeRenderingData(n,s).pipe(f(o=>ge(_e({},o),{nodeType:s})))))}_renderDataChanges(e){if(e.nodeType===null){this.renderNodeChanges(e.renderNodes);return}this._updateCachedData(e.flattenedNodes),this.renderNodeChanges(e.renderNodes),this._updateKeyManagerItems(e.flattenedNodes)}_emitExpansionChanges(e){if(!e)return;let t=this._nodes.value;for(let n of e.added)t.get(n)?._emitExpansionState(!0);for(let n of e.removed)t.get(n)?._emitExpansionState(!1)}_initializeKeyManager(){let e=F([this._keyManagerNodes,this._nodes]).pipe(f(([n,s])=>n.reduce((o,a)=>{let d=s.get(this._getExpansionKey(a));return d&&o.push(d),o},[]))),t={trackBy:n=>this._getExpansionKey(n.data),skipPredicate:n=>!!n.isDisabled,typeAheadDebounceInterval:!0,horizontalOrientation:this._dir.value};this._keyManager=this._keyManagerFactory(e,t)}_initializeDataDiffer(){let e=this.trackBy??((t,n)=>this._getExpansionKey(n));this._dataDiffer=this._differs.find([]).create(e)}_checkTreeControlUsage(){}renderNodeChanges(e,t=this._dataDiffer,n=this._nodeOutlet.viewContainer,s){let o=t.diff(e);!o&&!this._viewInit||(o?.forEachOperation((a,d,l)=>{if(a.previousIndex==null)this.insertNode(e[l],l,n,s);else if(l==null)n.remove(d);else{let m=n.get(d);n.move(m,l)}}),o?.forEachIdentityChange(a=>{let d=a.item;if(a.currentIndex!=null){let l=n.get(a.currentIndex);l.context.$implicit=d}}),s?this._changeDetectorRef.markForCheck():this._changeDetectorRef.detectChanges())}_getNodeDef(e,t){if(this._nodeDefs.length===1)return this._nodeDefs.first;let n=this._nodeDefs.find(s=>s.when&&s.when(t,e))||this._defaultNodeDef;return n}insertNode(e,t,n,s){let o=this._getLevelAccessor(),a=this._getNodeDef(e,t),d=this._getExpansionKey(e),l=new ce(e);l.index=t,s??=this._parents.get(d)??void 0,o?l.level=o(e):s!==void 0&&this._levels.has(this._getExpansionKey(s))?l.level=this._levels.get(this._getExpansionKey(s))+1:l.level=0,this._levels.set(d,l.level),(n||this._nodeOutlet.viewContainer).createEmbeddedView(a.template,l,t),M.mostRecentTreeNode&&(M.mostRecentTreeNode.data=e)}isExpanded(e){return!!(this.treeControl?.isExpanded(e)||this._expansionModel?.isSelected(this._getExpansionKey(e)))}toggle(e){this.treeControl?this.treeControl.toggle(e):this._expansionModel&&this._expansionModel.toggle(this._getExpansionKey(e))}expand(e){this.treeControl?this.treeControl.expand(e):this._expansionModel&&this._expansionModel.select(this._getExpansionKey(e))}collapse(e){this.treeControl?this.treeControl.collapse(e):this._expansionModel&&this._expansionModel.deselect(this._getExpansionKey(e))}toggleDescendants(e){this.treeControl?this.treeControl.toggleDescendants(e):this._expansionModel&&(this.isExpanded(e)?this.collapseDescendants(e):this.expandDescendants(e))}expandDescendants(e){if(this.treeControl)this.treeControl.expandDescendants(e);else if(this._expansionModel){let t=this._expansionModel;t.select(this._getExpansionKey(e)),this._getDescendants(e).pipe(v(1),D(this._onDestroy)).subscribe(n=>{t.select(...n.map(s=>this._getExpansionKey(s)))})}}collapseDescendants(e){if(this.treeControl)this.treeControl.collapseDescendants(e);else if(this._expansionModel){let t=this._expansionModel;t.deselect(this._getExpansionKey(e)),this._getDescendants(e).pipe(v(1),D(this._onDestroy)).subscribe(n=>{t.deselect(...n.map(s=>this._getExpansionKey(s)))})}}expandAll(){this.treeControl?this.treeControl.expandAll():this._expansionModel&&this._forEachExpansionKey(e=>this._expansionModel?.select(...e))}collapseAll(){this.treeControl?this.treeControl.collapseAll():this._expansionModel&&this._forEachExpansionKey(e=>this._expansionModel?.deselect(...e))}_getLevelAccessor(){return this.treeControl?.getLevel?.bind(this.treeControl)??this.levelAccessor}_getChildrenAccessor(){return this.treeControl?.getChildren?.bind(this.treeControl)??this.childrenAccessor}_getDirectChildren(e){let t=this._getLevelAccessor(),n=this._expansionModel??this.treeControl?.expansionModel;if(!n)return h([]);let s=this._getExpansionKey(e),o=n.changed.pipe(P(d=>d.added.includes(s)?h(!0):d.removed.includes(s)?h(!1):xe),se(this.isExpanded(e)));if(t)return F([o,this._flattenedNodes]).pipe(f(([d,l])=>d?this._findChildrenByLevel(t,l,e,1):[]));let a=this._getChildrenAccessor();if(a)return q(a(e)??[]);throw ze()}_findChildrenByLevel(e,t,n,s){let o=this._getExpansionKey(n),a=t.findIndex(N=>this._getExpansionKey(N)===o),d=e(n),l=d+s,m=[];for(let N=a+1;N<t.length;N++){let fe=e(t[N]);if(fe<=d)break;fe<=l&&m.push(t[N])}return m}_registerNode(e){this._nodes.value.set(this._getExpansionKey(e.data),e),this._nodes.next(this._nodes.value)}_unregisterNode(e){this._nodes.value.delete(this._getExpansionKey(e.data)),this._nodes.next(this._nodes.value)}_getLevel(e){return this._levels.get(this._getExpansionKey(e))}_getSetSize(e){return this._getAriaSet(e).length}_getPositionInSet(e){let t=this._getAriaSet(e),n=this._getExpansionKey(e);return t.findIndex(s=>this._getExpansionKey(s)===n)+1}_getNodeParent(e){let t=this._parents.get(this._getExpansionKey(e.data));return t&&this._nodes.value.get(this._getExpansionKey(t))}_getNodeChildren(e){return this._getDirectChildren(e.data).pipe(f(t=>t.reduce((n,s)=>{let o=this._nodes.value.get(this._getExpansionKey(s));return o&&n.push(o),n},[])))}_sendKeydownToKeyManager(e){if(e.target===this._elementRef.nativeElement)this._keyManager.onKeydown(e);else{let t=this._nodes.getValue();for(let[,n]of t)if(e.target===n._elementRef.nativeElement){this._keyManager.onKeydown(e);break}}}_getDescendants(e){if(this.treeControl)return h(this.treeControl.getDescendants(e));if(this.levelAccessor){let t=this._findChildrenByLevel(this.levelAccessor,this._flattenedNodes.value,e,1/0);return h(t)}if(this.childrenAccessor)return this._getAllChildrenRecursively(e).pipe(ne((t,n)=>(t.push(...n),t),[]));throw ze()}_getAllChildrenRecursively(e){return this.childrenAccessor?q(this.childrenAccessor(e)).pipe(v(1),P(t=>{for(let n of t)this._parents.set(this._getExpansionKey(n),e);return h(...t).pipe(ie(n=>te(h([n]),this._getAllChildrenRecursively(n))))})):h([])}_getExpansionKey(e){return this.expansionKey?.(e)??e}_getAriaSet(e){let t=this._getExpansionKey(e),n=this._parents.get(t),s=n?this._getExpansionKey(n):null;return this._ariaSets.get(s)??[e]}_findParentForNode(e,t,n){if(!n.length)return null;let s=this._levels.get(this._getExpansionKey(e))??0;for(let o=t-1;o>=0;o--){let a=n[o];if((this._levels.get(this._getExpansionKey(a))??0)<s)return a}return null}_flattenNestedNodesWithExpansion(e,t=0){let n=this._getChildrenAccessor();return n?h(...e).pipe(ie(s=>{let o=this._getExpansionKey(s);this._parents.has(o)||this._parents.set(o,null),this._levels.set(o,t);let a=q(n(s));return te(h([s]),a.pipe(v(1),K(d=>{this._ariaSets.set(o,[...d??[]]);for(let l of d??[]){let m=this._getExpansionKey(l);this._parents.set(m,s),this._levels.set(m,t+1)}}),P(d=>d?this._flattenNestedNodesWithExpansion(d,t+1).pipe(f(l=>this.isExpanded(s)?l:[])):h([]))))}),ne((s,o)=>(s.push(...o),s),[])):h([...e])}_computeRenderingData(e,t){if(this.childrenAccessor&&t==="flat")return this._clearPreviousCache(),this._ariaSets.set(null,[...e]),this._flattenNestedNodesWithExpansion(e).pipe(f(n=>({renderNodes:n,flattenedNodes:n})));if(this.levelAccessor&&t==="nested"){let n=this.levelAccessor;return h(e.filter(s=>n(s)===0)).pipe(f(s=>({renderNodes:s,flattenedNodes:e})),K(({flattenedNodes:s})=>{this._calculateParents(s)}))}else return t==="flat"?h({renderNodes:e,flattenedNodes:e}).pipe(K(({flattenedNodes:n})=>{this._calculateParents(n)})):(this._clearPreviousCache(),this._ariaSets.set(null,[...e]),this._flattenNestedNodesWithExpansion(e).pipe(f(n=>({renderNodes:e,flattenedNodes:n}))))}_updateCachedData(e){this._flattenedNodes.next(e)}_updateKeyManagerItems(e){this._keyManagerNodes.next(e)}_calculateParents(e){let t=this._getLevelAccessor();if(t){this._clearPreviousCache();for(let n=0;n<e.length;n++){let s=e[n],o=this._getExpansionKey(s);this._levels.set(o,t(s));let a=this._findParentForNode(s,n,e);this._parents.set(o,a);let d=a?this._getExpansionKey(a):null,l=this._ariaSets.get(d)??[];l.splice(n,0,s),this._ariaSets.set(d,l)}}}_forEachExpansionKey(e){let t=[],n=[];this._nodes.value.forEach(s=>{t.push(this._getExpansionKey(s.data)),n.push(this._getDescendants(s.data))}),n.length>0?F(n).pipe(v(1),D(this._onDestroy)).subscribe(s=>{s.forEach(o=>o.forEach(a=>t.push(this._getExpansionKey(a)))),e(t)}):e(t)}_clearPreviousCache(){this._parents.clear(),this._levels.clear(),this._ariaSets.clear()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=k({type:i,selectors:[["cdk-tree"]],contentQueries:function(t,n,s){if(t&1&&Ne(s,G,5),t&2){let o;O(o=L())&&(n._nodeDefs=o)}},viewQuery:function(t,n){if(t&1&&J(Y,7),t&2){let s;O(s=L())&&(n._nodeOutlet=s.first)}},hostAttrs:["role","tree",1,"cdk-tree"],hostBindings:function(t,n){t&1&&w("keydown",function(o){return n._sendKeydownToKeyManager(o)})},inputs:{dataSource:"dataSource",treeControl:"treeControl",levelAccessor:"levelAccessor",childrenAccessor:"childrenAccessor",trackBy:"trackBy",expansionKey:"expansionKey"},exportAs:["cdkTree"],decls:1,vars:0,consts:[["cdkTreeNodeOutlet",""]],template:function(t,n){t&1&&U(0,0)},dependencies:[Y],encapsulation:2})}return i})(),M=(()=>{class i{_elementRef=c(V);_tree=c(A);_tabindex=-1;_type="flat";get role(){return"treeitem"}set role(e){}get isExpandable(){return this._isExpandable()}set isExpandable(e){this._inputIsExpandable=e,!(this.data&&!this._isExpandable||!this._inputIsExpandable)&&(this._inputIsExpanded?this.expand():this._inputIsExpanded===!1&&this.collapse())}get isExpanded(){return this._tree.isExpanded(this._data)}set isExpanded(e){this._inputIsExpanded=e,e?this.expand():this.collapse()}isDisabled=!1;typeaheadLabel=null;getLabel(){return this.typeaheadLabel||this._elementRef.nativeElement.textContent?.trim()||""}activation=new re;expandedChange=new re;static mostRecentTreeNode=null;_destroyed=new S;_dataChanges=new S;_inputIsExpandable=!1;_inputIsExpanded=void 0;_shouldFocus=!0;_parentNodeAriaLevel;get data(){return this._data}set data(e){e!==this._data&&(this._data=e,this._dataChanges.next())}_data;get isLeafNode(){return this._tree.treeControl?.isExpandable!==void 0&&!this._tree.treeControl.isExpandable(this._data)?!0:this._tree.treeControl?.isExpandable===void 0&&this._tree.treeControl?.getDescendants(this._data).length===0}get level(){return this._tree._getLevel(this._data)??this._parentNodeAriaLevel}_isExpandable(){return this._tree.treeControl?!this.isLeafNode:this._inputIsExpandable}_getAriaExpanded(){return this._isExpandable()?String(this.isExpanded):null}_getSetSize(){return this._tree._getSetSize(this._data)}_getPositionInSet(){return this._tree._getPositionInSet(this._data)}_changeDetectorRef=c(oe);constructor(){i.mostRecentTreeNode=this}ngOnInit(){this._parentNodeAriaLevel=Ge(this._elementRef.nativeElement),this._tree._getExpansionModel().changed.pipe(f(()=>this.isExpanded),ve(),D(this._destroyed)).pipe(D(this._destroyed)).subscribe(()=>this._changeDetectorRef.markForCheck()),this._tree._setNodeTypeIfUnset(this._type),this._tree._registerNode(this)}ngOnDestroy(){i.mostRecentTreeNode===this&&(i.mostRecentTreeNode=null),this._dataChanges.complete(),this._destroyed.next(),this._destroyed.complete()}getParent(){return this._tree._getNodeParent(this)??null}getChildren(){return this._tree._getNodeChildren(this)}focus(){this._tabindex=0,this._shouldFocus&&this._elementRef.nativeElement.focus(),this._changeDetectorRef.markForCheck()}unfocus(){this._tabindex=-1,this._changeDetectorRef.markForCheck()}activate(){this.isDisabled||this.activation.next(this._data)}collapse(){this.isExpandable&&this._tree.collapse(this._data)}expand(){this.isExpandable&&this._tree.expand(this._data)}makeFocusable(){this._tabindex=0,this._changeDetectorRef.markForCheck()}_focusItem(){this.isDisabled||this._tree._keyManager.focusItem(this)}_setActiveItem(){this.isDisabled||(this._shouldFocus=!1,this._tree._keyManager.focusItem(this),this._shouldFocus=!0)}_emitExpansionState(e){this.expandedChange.emit(e)}static \u0275fac=function(t){return new(t||i)};static \u0275dir=_({type:i,selectors:[["cdk-tree-node"]],hostAttrs:["role","treeitem",1,"cdk-tree-node"],hostVars:5,hostBindings:function(t,n){t&1&&w("click",function(){return n._setActiveItem()})("focus",function(){return n._focusItem()}),t&2&&($("tabIndex",n._tabindex),Q("aria-expanded",n._getAriaExpanded())("aria-level",n.level+1)("aria-posinset",n._getPositionInSet())("aria-setsize",n._getSetSize()))},inputs:{role:"role",isExpandable:[2,"isExpandable","isExpandable",I],isExpanded:"isExpanded",isDisabled:[2,"isDisabled","isDisabled",I],typeaheadLabel:[0,"cdkTreeNodeTypeaheadLabel","typeaheadLabel"]},outputs:{activation:"activation",expandedChange:"expandedChange"},exportAs:["cdkTreeNode"]})}return i})();function Ge(i){let r=i.parentElement;for(;r&&!Ze(r);)r=r.parentElement;return r?r.classList.contains("cdk-nested-tree-node")?T(r.getAttribute("aria-level")):0:-1}function Ze(i){let r=i.classList;return!!(r?.contains("cdk-nested-tree-node")||r?.contains("cdk-tree"))}var et=/([A-Za-z%]+)$/,pe=(()=>{class i{_treeNode=c(M);_tree=c(A);_element=c(V);_dir=c(ae,{optional:!0});_currentPadding=null;_destroyed=new S;indentUnits="px";get level(){return this._level}set level(e){this._setLevelInput(e)}_level;get indent(){return this._indent}set indent(e){this._setIndentInput(e)}_indent=40;constructor(){this._setPadding(),this._dir?.change.pipe(D(this._destroyed)).subscribe(()=>this._setPadding(!0)),this._treeNode._dataChanges.subscribe(()=>this._setPadding())}ngOnDestroy(){this._destroyed.next(),this._destroyed.complete()}_paddingIndent(){let e=(this._treeNode.data&&this._tree._getLevel(this._treeNode.data))??null,t=this._level==null?e:this._level;return typeof t=="number"?`${t*this._indent}${this.indentUnits}`:null}_setPadding(e=!1){let t=this._paddingIndent();if(t!==this._currentPadding||e){let n=this._element.nativeElement,s=this._dir&&this._dir.value==="rtl"?"paddingRight":"paddingLeft",o=s==="paddingLeft"?"paddingRight":"paddingLeft";n.style[s]=t||"",n.style[o]="",this._currentPadding=t}}_setLevelInput(e){this._level=isNaN(e)?null:e,this._setPadding()}_setIndentInput(e){let t=e,n="px";if(typeof e=="string"){let s=e.split(et);t=s[0],n=s[1]||n}this.indentUnits=n,this._indent=T(t),this._setPadding()}static \u0275fac=function(t){return new(t||i)};static \u0275dir=_({type:i,selectors:[["","cdkTreeNodePadding",""]],inputs:{level:[2,"cdkTreeNodePadding","level",T],indent:[0,"cdkTreeNodePaddingIndent","indent"]}})}return i})(),ue=(()=>{class i{_tree=c(A);_treeNode=c(M);recursive=!1;constructor(){}_toggle(){this.recursive?this._tree.toggleDescendants(this._treeNode.data):this._tree.toggle(this._treeNode.data),this._tree._keyManager.focusItem(this._treeNode)}static \u0275fac=function(t){return new(t||i)};static \u0275dir=_({type:i,selectors:[["","cdkTreeNodeToggle",""]],hostAttrs:["tabindex","-1"],hostBindings:function(t,n){t&1&&w("click",function(o){return n._toggle(),o.stopPropagation()})("keydown.Enter",function(o){return n._toggle(),o.preventDefault()})("keydown.Space",function(o){return n._toggle(),o.preventDefault()})},inputs:{recursive:[2,"cdkTreeNodeToggleRecursive","recursive",I]}})}return i})();var Qe=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=H({type:i});static \u0275inj=R({})}return i})();function tt(i){return!!i._isNoopTreeKeyManager}var $e=(()=>{class i extends M{get tabIndexInputBinding(){return this._tabIndexInputBinding}set tabIndexInputBinding(e){this._tabIndexInputBinding=e}_tabIndexInputBinding;defaultTabIndex=0;_getTabindexAttribute(){return tt(this._tree._keyManager)?this.tabIndexInputBinding:this._tabindex}get disabled(){return this.isDisabled}set disabled(e){this.isDisabled=e}constructor(){super();let e=c(new Ae("tabindex"),{optional:!0});this.tabIndexInputBinding=Number(e)||this.defaultTabIndex}ngOnInit(){super.ngOnInit()}ngOnDestroy(){super.ngOnDestroy()}static \u0275fac=function(t){return new(t||i)};static \u0275dir=_({type:i,selectors:[["mat-tree-node"]],hostAttrs:[1,"mat-tree-node"],hostVars:5,hostBindings:function(t,n){t&1&&w("click",function(){return n._focusItem()}),t&2&&($("tabIndex",n._getTabindexAttribute()),Q("aria-expanded",n._getAriaExpanded())("aria-level",n.level+1)("aria-posinset",n._getPositionInSet())("aria-setsize",n._getSetSize()))},inputs:{tabIndexInputBinding:[2,"tabIndex","tabIndexInputBinding",e=>e==null?0:T(e)],disabled:[2,"disabled","disabled",I]},outputs:{activation:"activation",expandedChange:"expandedChange"},exportAs:["matTreeNode"],features:[b([{provide:M,useExisting:i}]),C]})}return i})(),We=(()=>{class i extends G{data;static \u0275fac=(()=>{let e;return function(n){return(e||(e=j(i)))(n||i)}})();static \u0275dir=_({type:i,selectors:[["","matTreeNodeDef",""]],inputs:{when:[0,"matTreeNodeDefWhen","when"],data:[0,"matTreeNode","data"]},features:[b([{provide:G,useExisting:i}]),C]})}return i})();var Je=(()=>{class i extends pe{get level(){return this._level}set level(e){this._setLevelInput(e)}get indent(){return this._indent}set indent(e){this._setIndentInput(e)}static \u0275fac=(()=>{let e;return function(n){return(e||(e=j(i)))(n||i)}})();static \u0275dir=_({type:i,selectors:[["","matTreeNodePadding",""]],inputs:{level:[2,"matTreeNodePadding","level",T],indent:[0,"matTreeNodePaddingIndent","indent"]},features:[b([{provide:pe,useExisting:i}]),C]})}return i})(),Ue=(()=>{class i{viewContainer=c(z);_node=c(he,{optional:!0});static \u0275fac=function(t){return new(t||i)};static \u0275dir=_({type:i,selectors:[["","matTreeNodeOutlet",""]],features:[b([{provide:Y,useExisting:i}])]})}return i})(),qe=(()=>{class i extends A{_nodeOutlet=void 0;static \u0275fac=(()=>{let e;return function(n){return(e||(e=j(i)))(n||i)}})();static \u0275cmp=k({type:i,selectors:[["mat-tree"]],viewQuery:function(t,n){if(t&1&&J(Ue,7),t&2){let s;O(s=L())&&(n._nodeOutlet=s.first)}},hostAttrs:[1,"mat-tree"],exportAs:["matTree"],features:[b([{provide:A,useExisting:i}]),C],decls:1,vars:0,consts:[["matTreeNodeOutlet",""]],template:function(t,n){t&1&&U(0,0)},dependencies:[Ue],styles:[`.mat-tree { display: block; background-color: var(--mat-tree-container-background-color, var(--mat-sys-surface)); } .mat-tree-node, .mat-nested-tree-node { color: var(--mat-tree-node-text-color, var(--mat-sys-on-surface)); font-family: var(--mat-tree-node-text-font, var(--mat-sys-body-large-font)); font-size: var(--mat-tree-node-text-size, var(--mat-sys-body-large-size)); font-weight: var(--mat-tree-node-text-weight, var(--mat-sys-body-large-weight)); } .mat-tree-node { display: flex; align-items: center; flex: 1; word-wrap: break-word; min-height: var(--mat-tree-node-min-height, 48px); } .mat-nested-tree-node { border-bottom-width: 0; } `],encapsulation:2})}return i})(),Xe=(()=>{class i extends ue{static \u0275fac=(()=>{let e;return function(n){return(e||(e=j(i)))(n||i)}})();static \u0275dir=_({type:i,selectors:[["","matTreeNodeToggle",""]],inputs:{recursive:[0,"matTreeNodeToggleRecursive","recursive"]},features:[b([{provide:ue,useExisting:i}]),C]})}return i})();var Ye=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=H({type:i});static \u0275inj=R({imports:[Qe,Be]})}return i})(),Z=class{transformFunction;getLevel;isExpandable;getChildren;constructor(r,e,t,n){this.transformFunction=r,this.getLevel=e,this.isExpandable=t,this.getChildren=n}_flattenNode(r,e,t,n){let s=this.transformFunction(r,e);if(t.push(s),this.isExpandable(s)){let o=this.getChildren(r);o&&(Array.isArray(o)?this._flattenChildren(o,e,t,n):o.pipe(v(1)).subscribe(a=>{this._flattenChildren(a,e,t,n)}))}return t}_flattenChildren(r,e,t,n){r.forEach((s,o)=>{let a=n.slice();a.push(o!=r.length-1),this._flattenNode(s,e+1,t,a)})}flattenNodes(r){let e=[];return r.forEach(t=>this._flattenNode(t,0,e,[])),e}expandFlattenedNodes(r,e){let t=[],n=[];return n[0]=!0,r.forEach(s=>{let o=!0;for(let a=0;a<=this.getLevel(s);a++)o=o&&n[a];o&&t.push(s),this.isExpandable(s)&&(n[this.getLevel(s)+1]=e.isExpanded(s))}),t}},ee=class extends Ke{_treeControl;_treeFlattener;_flattenedData=new y([]);_expandedData=new y([]);get data(){return this._data.value}set data(r){this._data.next(r),this._flattenedData.next(this._treeFlattener.flattenNodes(this.data)),this._treeControl.dataNodes=this._flattenedData.value}_data=new y([]);constructor(r,e,t){super(),this._treeControl=r,this._treeFlattener=e,t&&(this.data=t)}connect(r){return me(r.viewChange,this._treeControl.expansionModel.changed,this._flattenedData).pipe(f(()=>(this._expandedData.next(this._treeFlattener.expandFlattenedNodes(this._flattenedData.value,this._treeControl)),this._expandedData.value)))}disconnect(){}};function it(i,r){if(i&1&&(u(0,"mat-tree-node",3)(1,"button",4)(2,"mat-icon"),g(3,"chevron_right"),p()(),u(4,"span",5)(5,"span",6)(6,"span",7),g(7),p(),u(8,"span",8),g(9,":"),p()(),u(10,"span"),g(11),p()()()),i&2){let e=r.$implicit,t=W();B("matTreeNodePaddingIndent",20),x(7),E(e.key),x(3),we("p3xr-json-tree-value p3xr-json-tree-value-"+e.type),x(),E(t.formatDisplay(e))}}function st(i,r){if(i&1&&(u(0,"span",10),g(1),p(),u(2,"span",11),g(3,"..."),p(),u(4,"span",10),g(5),p(),u(6,"span",12),g(7),p()),i&2){let e=W().$implicit;x(),E(e.type==="array"?"[":"{"),x(4),E(e.type==="array"?"]":"}"),x(2),Ie("(",e.childCount,")")}}function rt(i,r){if(i&1&&(u(0,"mat-tree-node",3)(1,"button",9)(2,"mat-icon"),g(3),p()(),u(4,"span",7),g(5),p(),u(6,"span",8),g(7,":\xA0"),p(),Te(8,st,8,3),p()),i&2){let e=r.$implicit,t=W();B("matTreeNodePaddingIndent",20),x(3),E(t.treeControl.isExpanded(e)?"expand_more":"chevron_right"),x(2),E(e.key),x(3),Me(t.treeControl.isExpanded(e)?-1:8)}}var Wt=(()=>{class i{data;label="";expanded=!0;depth=0;wrap=!0;transformer=(e,t)=>({key:e.key,value:e.value,type:e.type,level:t,expandable:e.type==="object"||e.type==="array",childCount:e.childCount});treeControl=new X(e=>e.level,e=>e.expandable);treeFlattener=new Z(this.transformer,e=>e.level,e=>e.expandable,e=>e.children);dataSource=new ee(this.treeControl,this.treeFlattener);hasChild=(e,t)=>t.expandable;ngOnChanges(e){this.buildTree()}buildTree(){if(this.data===void 0||this.data===null){this.dataSource.data=[];return}let e=this.jsonToNode(this.label||"root",this.data);if(this.dataSource.data=e.children?[e]:[e],this.expanded==="recursive")this.treeControl.expandAll();else if(this.expanded===!0){let t=this.treeControl.dataNodes;for(let n of t)n.level===0&&n.expandable&&this.treeControl.expand(n)}}jsonToNode(e,t){if(t===null)return{key:e,value:null,type:"null"};if(Array.isArray(t)){let n=t.map((s,o)=>this.jsonToNode(String(o),s));return{key:e,value:t,type:"array",children:n,childCount:n.length}}if(typeof t=="object"){let n=Object.keys(t).map(s=>this.jsonToNode(s,t[s]));return{key:e,value:t,type:"object",children:n,childCount:n.length}}return{key:e,value:t,type:typeof t}}formatDisplay(e){return e.type==="null"?"null":e.type==="string"?`"${e.value}"`:String(e.value)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=k({type:i,selectors:[["p3xr-json-tree"]],inputs:{data:"data",label:"label",expanded:"expanded",depth:"depth",wrap:"wrap"},features:[be],decls:3,vars:5,consts:[[1,"p3xr-json-mat-tree",3,"dataSource","treeControl"],["matTreeNodePadding","",3,"matTreeNodePaddingIndent",4,"matTreeNodeDef"],["matTreeNodePadding","",3,"matTreeNodePaddingIndent",4,"matTreeNodeDef","matTreeNodeDefWhen"],["matTreeNodePadding","",3,"matTreeNodePaddingIndent"],["mat-icon-button","","disabled","",1,"p3xr-json-tree-toggle","p3xr-json-tree-toggle-hidden"],[1,"p3xr-json-tree-leaf-content"],[1,"p3xr-json-tree-leaf-key"],[1,"p3xr-json-tree-key"],[1,"p3xr-json-tree-colon"],["mat-icon-button","","matTreeNodeToggle","",1,"p3xr-json-tree-toggle"],[1,"p3xr-json-tree-bracket"],[1,"p3xr-json-tree-ellipsis"],[1,"p3xr-json-tree-count"]],template:function(t,n){t&1&&(u(0,"mat-tree",0),Ee(1,it,12,5,"mat-tree-node",1)(2,rt,9,4,"mat-tree-node",2),p()),t&2&&(ke("p3xr-json-tree-nowrap",!n.wrap),B("dataSource",n.dataSource)("treeControl",n.treeControl),x(2),B("matTreeNodeDefWhen",n.hasChild))},dependencies:[Fe,Ye,We,Je,Xe,qe,$e,Ve,Re,Le,Oe],styles:[`.p3xr-json-mat-tree{font-family:Roboto Mono,monospace;font-size:13px;background:inherit!important}.p3xr-json-mat-tree .mat-tree-node,.p3xr-json-mat-tree .mat-nested-tree-node{background:inherit!important;color:inherit!important}.p3xr-json-mat-tree .mat-tree-node{min-height:24px;height:auto;line-height:1.6}.p3xr-json-tree-toggle-hidden{visibility:hidden!important}.p3xr-json-tree-toggle{width:24px!important;height:24px!important;padding:0!important;flex-shrink:0}.p3xr-json-tree-toggle .mat-icon{font-size:18px;width:18px;height:18px;opacity:.6}.p3xr-json-tree-leaf-content{flex:1;min-width:0;display:flex;align-items:flex-start;gap:6px}.p3xr-json-tree-leaf-key{flex-shrink:0;white-space:nowrap}.p3xr-json-tree-value{word-break:break-word;min-width:0}.p3xr-json-tree-key{font-weight:700;color:var(--p3xr-json-key-color, #881391)}.p3xr-json-tree-colon{opacity:.6}.p3xr-json-tree-bracket{opacity:.5}.p3xr-json-tree-ellipsis{opacity:.4;margin:0 2px}.p3xr-json-tree-count{opacity:.4;font-size:11px;margin-left:4px;align-self:center}:host{display:block}.p3xr-json-tree-value-string{color:var(--p3xr-json-value-string, #0b7500)}.p3xr-json-tree-value-number{color:var(--p3xr-json-value-number, #1a01cc)}.p3xr-json-tree-value-boolean{color:var(--p3xr-json-value-boolean, #c41a16)}.p3xr-json-tree-value-null{color:var(--p3xr-json-value-null, #808080);font-style:italic}.p3xr-json-mat-tree .p3xr-json-tree-value{word-break:break-all}.p3xr-json-mat-tree.p3xr-json-tree-nowrap .p3xr-json-tree-value{white-space:nowrap;word-break:normal}.p3xr-json-mat-tree.p3xr-json-tree-nowrap .mat-tree-node{flex-wrap:nowrap} `],encapsulation:2})}return i})();export{Wt as a};