import{B as Ce,bl as se,bm as Te,bn as we,bo as Pe,bp as Ie,aE as Ke,bq as Oe,br as Ae,bs as Ee,A as Me,aG as ce,m as _,bt as je,bu as Le,Q as z,bv as $,bw as ee,bx as Fe,by as He,bz as Ve,ak as S,x as Be,o as u,e as g,E as D,q as C,i as G,y as Re,p as y,F as L,P as b,U as T,g as R,C as Ue,z as ue,t as O,G as fe,f as F,a0 as E,aT as ze,d as qe,u as We,w as Ge,N as Ye,a4 as Je,O as Qe,h as M,I as Xe,r as I,b3 as Ze,L as te,k as _e,b4 as $e,_ as et}from"./index-D92x6h1h.js";import{s as tt}from"./index-7HNOjfAo.js";var nt=`
    .p-tree {
        display: block;
        background: dt('tree.background');
        color: dt('tree.color');
        padding: dt('tree.padding');
        position: relative;
    }

    .p-tree-root-children,
    .p-tree-node-children {
        display: flex;
        list-style-type: none;
        flex-direction: column;
        margin: 0;
        gap: dt('tree.gap');
    }

    .p-tree-root-children {
        padding: 0;
        padding-block-start: dt('tree.gap');
    }

    .p-tree-node-children {
        padding: 0;
        padding-block-start: dt('tree.gap');
        padding-inline-start: dt('tree.indent');
    }

    .p-tree-node {
        padding: 0;
        outline: 0 none;
    }

    .p-tree-node-content {
        border-radius: dt('tree.node.border.radius');
        padding: dt('tree.node.padding');
        display: flex;
        align-items: center;
        outline-color: transparent;
        color: dt('tree.node.color');
        gap: dt('tree.node.gap');
        transition:
            background dt('tree.transition.duration'),
            color dt('tree.transition.duration'),
            outline-color dt('tree.transition.duration'),
            box-shadow dt('tree.transition.duration');
    }

    .p-tree-node-content[data-p-dragging] {
        outline: 1px dashed dt('primary.color');
        outline-offset: -1px;
    }

    .p-tree-node-content[data-pc-section="drag-image"] {
        background: dt('tree.background');
    }

    .p-tree-node:focus-visible > .p-tree-node-content {
        box-shadow: dt('tree.node.focus.ring.shadow');
        outline: dt('tree.node.focus.ring.width') dt('tree.node.focus.ring.style') dt('tree.node.focus.ring.color');
        outline-offset: dt('tree.node.focus.ring.offset');
    }

    .p-tree-node-content.p-tree-node-selectable:not(.p-tree-node-selected):hover {
        background: dt('tree.node.hover.background');
        color: dt('tree.node.hover.color');
    }

    .p-tree-node-content.p-tree-node-selectable:not(.p-tree-node-selected):hover .p-tree-node-icon {
        color: dt('tree.node.icon.hover.color');
    }

    .p-tree-node-content.p-tree-node-selected {
        background: dt('tree.node.selected.background');
        color: dt('tree.node.selected.color');
    }

    .p-tree-node-content.p-tree-node-selected .p-tree-node-toggle-button {
        color: inherit;
    }

    .p-tree-node-content.p-tree-node-dragover {
        background: dt('tree.node.hover.background');
        color: dt('tree.node.hover.color');
    }

    .p-tree-node-content:focus-visible,
    .p-tree-node-content.p-tree-node-contextmenu-selected {
        box-shadow: dt('tree.node.focus.ring.shadow');
        outline: dt('tree.node.focus.ring.width') dt('tree.node.focus.ring.style') dt('tree.node.focus.ring.color');
        outline-offset: dt('tree.node.focus.ring.offset');
    }

    .p-tree-node-drop-point {
		outline: 1px solid dt('primary.color');
	}

    .p-tree-node-toggle-button {
        cursor: pointer;
        user-select: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        position: relative;
        flex-shrink: 0;
        width: dt('tree.node.toggle.button.size');
        height: dt('tree.node.toggle.button.size');
        color: dt('tree.node.toggle.button.color');
        border: 0 none;
        background: transparent;
        border-radius: dt('tree.node.toggle.button.border.radius');
        transition:
            background dt('tree.transition.duration'),
            color dt('tree.transition.duration'),
            border-color dt('tree.transition.duration'),
            outline-color dt('tree.transition.duration'),
            box-shadow dt('tree.transition.duration');
        outline-color: transparent;
        padding: 0;
    }

    .p-tree-node-toggle-button:enabled:hover {
        background: dt('tree.node.toggle.button.hover.background');
        color: dt('tree.node.toggle.button.hover.color');
    }

    .p-tree-node-content.p-tree-node-selected .p-tree-node-toggle-button:hover {
        background: dt('tree.node.toggle.button.selected.hover.background');
        color: dt('tree.node.toggle.button.selected.hover.color');
    }

    .p-tree-root {
        overflow: auto;
    }

    .p-tree-node-selectable {
        cursor: pointer;
        user-select: none;
    }

    .p-tree-node-leaf > .p-tree-node-content .p-tree-node-toggle-button {
        visibility: hidden;
    }

    .p-tree-node-icon {
        color: dt('tree.node.icon.color');
        transition: color dt('tree.transition.duration');
    }

    .p-tree-node-content.p-tree-node-selected .p-tree-node-icon {
        color: dt('tree.node.icon.selected.color');
    }

    .p-tree-filter {
        margin: dt('tree.filter.margin');
    }

    .p-tree-filter-input {
        width: 100%;
    }

    .p-tree-loading-icon {
        font-size: dt('tree.loading.icon.size');
        width: dt('tree.loading.icon.size');
        height: dt('tree.loading.icon.size');
    }

    .p-tree .p-tree-mask {
        position: absolute;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .p-tree-flex-scrollable {
        display: flex;
        flex: 1;
        height: 100%;
        flex-direction: column;
    }

    .p-tree-flex-scrollable .p-tree-root {
        flex: 1;
    }
`,rt={root:function(e){var n=e.props,o=e.state;return["p-tree p-component",{"p-tree-selectable":n.selectionMode!=null,"p-tree-loading":n.loading,"p-tree-flex-scrollable":n.scrollHeight==="flex","p-tree-node-dragover":o.dragHover}]},mask:"p-tree-mask p-overlay-mask",loadingIcon:"p-tree-loading-icon",pcFilterContainer:"p-tree-filter",pcFilterInput:"p-tree-filter-input",wrapper:"p-tree-root",rootChildren:"p-tree-root-children",node:function(e){var n=e.instance;return["p-tree-node",{"p-tree-node-leaf":n.leaf}]},nodeContent:function(e){var n=e.instance;return["p-tree-node-content",n.node.styleClass,{"p-tree-node-selectable":n.selectable,"p-tree-node-selected":n.checkboxMode&&n.$parentInstance.highlightOnSelect?n.checked:n.selected,"p-tree-node-dragover":n.isNodeDropActive}]},nodeToggleButton:"p-tree-node-toggle-button",nodeToggleIcon:"p-tree-node-toggle-icon",nodeCheckbox:"p-tree-node-checkbox",nodeIcon:"p-tree-node-icon",nodeLabel:"p-tree-node-label",nodeChildren:"p-tree-node-children",emptyMessage:"p-tree-empty-message",dropPoint:"p-tree-node-drop-point"},ot=Ce.extend({name:"tree",style:nt,classes:rt}),it={name:"BaseTree",extends:ce,props:{value:{type:null,default:null},expandedKeys:{type:null,default:null},selectionKeys:{type:null,default:null},selectionMode:{type:String,default:null},metaKeySelection:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:void 0},loadingMode:{type:String,default:"mask"},filter:{type:Boolean,default:!1},filterBy:{type:[String,Function],default:"label"},filterMode:{type:String,default:"lenient"},filterPlaceholder:{type:String,default:null},filterLocale:{type:String,default:void 0},highlightOnSelect:{type:Boolean,default:!1},scrollHeight:{type:String,default:null},level:{type:Number,default:0},draggableNodes:{type:Boolean,default:null},droppableNodes:{type:Boolean,default:null},draggableScope:{type:[String,Array],default:null},droppableScope:{type:[String,Array],default:null},validateDrop:{type:Boolean,default:!1},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null}},style:ot,provide:function(){return{$pcTree:this,$parentInstance:this}}},w=Ve({isDragging:!1,dragNode:null,dragScope:null}),q=new Set,W=new Set;function at(){var t=function(r){w.isDragging=!0,w.dragNode=r.node,w.dragScope=r.scope,q.forEach(function(a){return a(r)})},e=function(r){w.isDragging=!1,w.dragNode=null,w.dragScope=null,W.forEach(function(a){return a(r)})},n=function(r){return q.add(r),function(){return q.delete(r)}},o=function(r){return W.add(r),function(){return W.delete(r)}};return{dragState:w,startDrag:t,stopDrag:e,onDragStart:n,onDragStop:o}}function H(t){"@babel/helpers - typeof";return H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(t)}function ne(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=pe(t))||e){n&&(t=n);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var r,a=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var f=n.next();return a=f.done,f},e:function(f){l=!0,r=f},f:function(){try{a||n.return==null||n.return()}finally{if(l)throw r}}}}function K(t){return st(t)||dt(t)||pe(t)||lt()}function lt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pe(t,e){if(t){if(typeof t=="string")return Y(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Y(t,e):void 0}}function dt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function st(t){if(Array.isArray(t))return Y(t)}function Y(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n<e;n++)o[n]=t[n];return o}function re(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function N(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?re(Object(n),!0).forEach(function(o){ct(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function ct(t,e,n){return(e=ut(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ut(t){var e=ft(t,"string");return H(e)=="symbol"?e:e+""}function ft(t,e){if(H(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(H(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var he={name:"TreeNode",hostName:"Tree",extends:ce,emits:["node-toggle","node-click","checkbox-change","node-drop","value-change","node-dragenter","node-dragleave"],props:{node:{type:null,default:null},parentNode:{type:null,default:null},rootNodes:{type:Object,default:null},expandedKeys:{type:null,default:null},loadingMode:{type:String,default:"mask"},selectionKeys:{type:null,default:null},selectionMode:{type:String,default:null},templates:{type:null,default:null},level:{type:Number,default:null},draggableScope:{type:[String,Array],default:null},draggableNodes:{type:Boolean,default:null},droppableNodes:{type:Boolean,default:null},validateDrop:{type:Boolean,default:!1},index:null},nodeTouched:!1,toggleClicked:!1,inject:{$pcTree:{default:void 0}},data:function(){return{isPrevDropPointHovered:!1,isNextDropPointHovered:!1,isNodeDropHovered:!1}},mounted:function(){this.setAllNodesTabIndexes()},methods:{toggle:function(){this.$emit("node-toggle",this.node),this.toggleClicked=!0},label:function(e){return typeof e.label=="function"?e.label():e.label},onChildNodeToggle:function(e){this.$emit("node-toggle",e)},getPTOptions:function(e){return this.ptm(e,{context:{node:this.node,index:this.index,expanded:this.expanded,selected:this.selected,checked:this.checked,partialChecked:this.partialChecked,leaf:this.leaf}})},onClick:function(e){if(this.toggleClicked||z(e.target,'[data-pc-section="nodetogglebutton"]')||z(e.target.parentElement,'[data-pc-section="nodetogglebutton"]')){this.toggleClicked=!1;return}this.isCheckboxSelectionMode()?this.node.selectable!=!1&&this.toggleCheckbox():this.$emit("node-click",{originalEvent:e,nodeTouched:this.nodeTouched,node:this.node}),this.nodeTouched=!1},onChildNodeClick:function(e){this.$emit("node-click",e)},onTouchEnd:function(){this.nodeTouched=!0},onKeyDown:function(e){if(this.isSameNode(e))switch(e.code){case"Tab":this.onTabKey(e);break;case"ArrowDown":this.onArrowDown(e);break;case"ArrowUp":this.onArrowUp(e);break;case"ArrowRight":this.onArrowRight(e);break;case"ArrowLeft":this.onArrowLeft(e);break;case"Enter":case"NumpadEnter":case"Space":this.onEnterKey(e);break}},onArrowDown:function(e){var n=e.target.getAttribute("data-pc-section")==="nodetogglebutton"?e.target.closest('[role="treeitem"]'):e.target,o=n.children[1];if(o)this.focusRowChange(n,o.children[0]);else if(n.nextElementSibling)this.focusRowChange(n,n.nextElementSibling);else{var i=this.findNextSiblingOfAncestor(n);i&&this.focusRowChange(n,i)}e.preventDefault()},onArrowUp:function(e){var n=e.target;if(n.previousElementSibling)this.focusRowChange(n,n.previousElementSibling,this.findLastVisibleDescendant(n.previousElementSibling));else{var o=this.getParentNodeElement(n);o&&this.focusRowChange(n,o)}e.preventDefault()},onArrowRight:function(e){var n=this;this.leaf||this.expanded||(e.currentTarget.tabIndex=-1,this.$emit("node-toggle",this.node),this.$nextTick(function(){n.onArrowDown(e)}))},onArrowLeft:function(e){var n=$(e.currentTarget,'[data-pc-section="nodetogglebutton"]');if(this.level===0&&!this.expanded)return!1;if(this.expanded&&!this.leaf)return n.click(),!1;var o=this.findBeforeClickableNode(e.currentTarget);o&&this.focusRowChange(e.currentTarget,o)},onEnterKey:function(e){this.setTabIndexForSelectionMode(e,this.nodeTouched),this.onClick(e),e.preventDefault()},onTabKey:function(){this.setAllNodesTabIndexes()},removeNodeFromTree:function(e,n){var o=this;return e.reduce(function(i,r){if(r.key===n.key)return i;if(r.children&&r.children.length>0){var a=o.removeNodeFromTree(r.children,n);i.push(N(N({},r),{},{children:a}))}else i.push(r);return i},[])},insertNodeInSiblings:function(e,n,o,i){var r=this,a=e.findIndex(function(l){return l.key===n});return a!==-1?e.toSpliced(a+i,0,o):e.map(function(l){return l.children&&l.children.length>0?N(N({},l),{},{children:r.insertNodeInSiblings(l.children,n,o,i)}):l})},addNodeAsChild:function(e,n,o){var i=this;return e.map(function(r){return r.key===n?N(N({},r),{},{children:[].concat(K(r.children||[]),[o])}):r.children&&r.children.length>0?N(N({},r),{},{children:i.addNodeAsChild(r.children,n,o)}):r})},insertNodeOnDrop:function(){var e=this.$pcTree,n=e.dragNode,o=e.dragNodeIndex,i=e.dragNodeSubNodes,r=e.dragDropService;if(!this.node||o==null||!n||!i)return null;var a=this.dropPosition,l=this.removeNodeFromTree(this.rootNodes,n);return a<0?l=this.insertNodeInSiblings(l,this.node.key,n,0):a>0?l=this.insertNodeInSiblings(l,this.node.key,n,1):l=this.addNodeAsChild(l,this.node.key,n),this.$emit("value-change",{nodes:l}),r.stopDrag({node:n,subNodes:l,index:o}),l},onNodeDrop:function(e){var n=this;if(this.isDroppable){e.preventDefault(),e.stopPropagation();var o=this.$pcTree.dragNode,i=this.dropPosition,r=i!==0||i===0&&this.isNodeDroppable;if(r)if(this.validateDrop)this.$emit("node-drop",{originalEvent:e,value:this.rootNodes,dragNode:o,dropNode:this.node,dropPosition:i,index:this.index,accept:function(){var s=n.insertNodeOnDrop();n.$emit("node-drop",{originalEvent:e,value:s,dragNode:o,dropNode:n.node,dropPosition:i,index:n.index})}});else{var a=this.insertNodeOnDrop();this.$emit("node-drop",{originalEvent:e,value:a,dragNode:o,dropNode:this.node,dropPosition:i,index:this.index})}this.isPrevDropPointHovered=!1,this.isNextDropPointHovered=!1,this.isNodeDropHovered=!1}},onNodeDragStart:function(e){if(this.isNodeDraggable){e.dataTransfer.effectAllowed="all",e.dataTransfer.setData("text","data");var n=e.currentTarget,o=n.cloneNode(!0),i=o.querySelector('[data-pc-section="nodetogglebutton"]'),r=o.querySelector('[data-pc-name="pcnodecheckbox"]');n.setAttribute("data-p-dragging","true"),o.style.width=Fe(n)+"px",o.style.height=He(n)+"px",o.setAttribute("data-pc-section","drag-image"),i.style.visibility="hidden",r?.remove(),document.body.appendChild(o),e.dataTransfer.setDragImage(o,0,0),setTimeout(function(){return document.body.removeChild(o)},0),this.$pcTree.dragDropService.startDrag({node:this.node,subNodes:this.subNodes,index:this.index,scope:this.draggableScope})}else e.preventDefault()},onNodeDragOver:function(e){if(this.isDroppable){e.dataTransfer.dropEffect="copy";var n=e.currentTarget,o=n.getBoundingClientRect(),i=e.clientY-o.top;this.isPrevDropPointHovered=!1,this.isNextDropPointHovered=!1,this.isNodeDropHovered=!1,i<o.height*.25?this.isPrevDropPointHovered=!0:i>o.height*.75?this.isNextDropPointHovered=!0:this.isNodeDroppable&&(this.isNodeDropHovered=!0)}else e.dataTransfer.dropEffect="none";this.droppableNodes&&(e.preventDefault(),e.stopPropagation())},onNodeDragEnter:function(){this.$emit("node-dragenter",{node:this.node})},onNodeDragLeave:function(){this.$emit("node-dragleave",{node:this.node}),this.isPrevDropPointHovered=!1,this.isNextDropPointHovered=!1,this.isNodeDropHovered=!1},onNodeDragEnd:function(e){var n;(n=e.currentTarget)===null||n===void 0||n.removeAttribute("data-p-dragging"),this.$pcTree.dragDropService.stopDrag({node:this.node,subNodes:this.subNodes,index:this.index})},setAllNodesTabIndexes:function(){var e=ee(this.$refs.currentNode.closest('[data-pc-section="rootchildren"]'),'[role="treeitem"]'),n=K(e).some(function(i){return i.getAttribute("aria-selected")==="true"||i.getAttribute("aria-checked")==="true"});if(K(e).forEach(function(i){i.tabIndex=-1}),n){var o=K(e).filter(function(i){return i.getAttribute("aria-selected")==="true"||i.getAttribute("aria-checked")==="true"});o[0].tabIndex=0;return}K(e)[0].tabIndex=0},setTabIndexForSelectionMode:function(e,n){if(this.selectionMode!==null){var o=K(ee(this.$refs.currentNode.parentElement,'[role="treeitem"]'));e.currentTarget.tabIndex=n===!1?-1:0,o.every(function(i){return i.tabIndex===-1})&&(o[0].tabIndex=0)}},focusRowChange:function(e,n,o){e.tabIndex="-1",n.tabIndex="0",this.focusNode(o||n)},findBeforeClickableNode:function(e){var n=e.closest("ul").closest("li");if(n){var o=$(n,"button");return o&&o.style.visibility!=="hidden"?n:this.findBeforeClickableNode(e.previousElementSibling)}return null},toggleCheckbox:function(){var e=this.selectionKeys?N({},this.selectionKeys):{},n=!this.checked;this.propagateDown(this.node,n,e),this.$emit("checkbox-change",{node:this.node,check:n,selectionKeys:e})},propagateDown:function(e,n,o){if(n&&e.selectable!=!1?o[e.key]={checked:!0,partialChecked:!1}:delete o[e.key],e.children&&e.children.length){var i=ne(e.children),r;try{for(i.s();!(r=i.n()).done;){var a=r.value;this.propagateDown(a,n,o)}}catch(l){i.e(l)}finally{i.f()}}},propagateUp:function(e){var n=e.check,o=N({},e.selectionKeys),i=0,r=!1,a=ne(this.node.children),l;try{for(a.s();!(l=a.n()).done;){var s=l.value;o[s.key]&&o[s.key].checked?i++:o[s.key]&&o[s.key].partialChecked&&(r=!0)}}catch(f){a.e(f)}finally{a.f()}n&&i===this.node.children.length?o[this.node.key]={checked:!0,partialChecked:!1}:(n||delete o[this.node.key],r||i>0&&i!==this.node.children.length?o[this.node.key]={checked:!1,partialChecked:!0}:delete o[this.node.key]),this.$emit("checkbox-change",{node:e.node,check:e.check,selectionKeys:o})},onChildCheckboxChange:function(e){this.$emit("checkbox-change",e)},findNextSiblingOfAncestor:function(e){var n=this.getParentNodeElement(e);return n?n.nextElementSibling?n.nextElementSibling:this.findNextSiblingOfAncestor(n):null},findLastVisibleDescendant:function(e){var n=e.children[1];if(n){var o=n.children[n.children.length-1];return this.findLastVisibleDescendant(o)}else return e},getParentNodeElement:function(e){var n=e.parentElement.parentElement;return z(n,"role")==="treeitem"?n:null},focusNode:function(e){e.focus()},isCheckboxSelectionMode:function(){return this.selectionMode==="checkbox"},isSameNode:function(e){return e.currentTarget&&(e.currentTarget.isSameNode(e.target)||e.currentTarget.isSameNode(e.target.closest('[role="treeitem"]')))}},computed:{hasChildren:function(){return this.node.children&&this.node.children.length>0},expanded:function(){return this.expandedKeys&&this.expandedKeys[this.node.key]===!0},leaf:function(){return this.node.leaf===!1?!1:!(this.node.children&&this.node.children.length)},selectable:function(){return this.node.selectable===!1?!1:this.selectionMode!=null},selected:function(){return this.selectionMode&&this.selectionKeys?this.selectionKeys[this.node.key]===!0:!1},checkboxMode:function(){return this.selectionMode==="checkbox"&&this.node.selectable!==!1},checked:function(){return this.selectionKeys?this.selectionKeys[this.node.key]&&this.selectionKeys[this.node.key].checked:!1},partialChecked:function(){return this.selectionKeys?this.selectionKeys[this.node.key]&&this.selectionKeys[this.node.key].partialChecked:!1},ariaChecked:function(){return this.selectionMode==="single"||this.selectionMode==="multiple"?this.selected:void 0},ariaSelected:function(){return this.checkboxMode?this.checked:void 0},isPrevDropPointActive:function(){return this.isPrevDropPointHovered&&this.isDroppable},isNextDropPointActive:function(){return this.isNextDropPointHovered&&this.isDroppable},dropPosition:function(){return this.isPrevDropPointActive?-1:this.isNextDropPointActive?1:0},subNodes:function(){return this.parentNode?this.parentNode.children:this.rootNodes},isDraggable:function(){return this.draggableNodes},isDroppable:function(){return this.droppableNodes&&this.$pcTree.allowNodeDrop(this.node)},isNodeDraggable:function(){var e;return((e=this.node)===null||e===void 0?void 0:e.draggable)!==!1&&this.isDraggable},isNodeDroppable:function(){var e;return((e=this.node)===null||e===void 0?void 0:e.droppable)!==!1&&this.isDroppable},isNodeDropActive:function(){return this.isNodeDropHovered&&this.isNodeDroppable}},components:{Checkbox:Me,ChevronDownIcon:Ee,ChevronRightIcon:tt,CheckIcon:Ae,MinusIcon:Oe,SpinnerIcon:se},directives:{ripple:Ke}},pt=["aria-label","aria-selected","aria-expanded","aria-setsize","aria-posinset","aria-level","aria-checked","tabindex"],ht=["draggable","data-p-selected","data-p-selectable"],gt=["data-p-leaf"];function yt(t,e,n,o,i,r){var a=S("SpinnerIcon"),l=S("Checkbox"),s=S("TreeNode",!0),f=Be("ripple");return u(),g("li",y({ref:"currentNode",class:t.cx("node"),role:"treeitem","aria-label":r.label(n.node),"aria-selected":r.ariaSelected,"aria-expanded":r.expanded,"aria-setsize":n.node.children?n.node.children.length:0,"aria-posinset":n.index+1,"aria-level":n.level,"aria-checked":r.ariaChecked,tabindex:n.index===0?0:-1,onKeydown:e[14]||(e[14]=function(){return r.onKeyDown&&r.onKeyDown.apply(r,arguments)})},r.getPTOptions("node")),[r.isPrevDropPointActive?(u(),g("div",{key:0,class:D(t.cx("dropPoint")),"aria-hidden":"true"},null,2)):C("",!0),G("div",y({class:t.cx("nodeContent"),style:n.node.style,draggable:r.isDraggable,onClick:e[2]||(e[2]=function(){return r.onClick&&r.onClick.apply(r,arguments)}),onTouchend:e[3]||(e[3]=function(){return r.onTouchEnd&&r.onTouchEnd.apply(r,arguments)}),onDragstart:e[4]||(e[4]=function(){return r.onNodeDragStart&&r.onNodeDragStart.apply(r,arguments)}),onDragover:e[5]||(e[5]=function(){return r.onNodeDragOver&&r.onNodeDragOver.apply(r,arguments)}),onDragenter:e[6]||(e[6]=function(){return r.onNodeDragEnter&&r.onNodeDragEnter.apply(r,arguments)}),onDragleave:e[7]||(e[7]=function(){return r.onNodeDragLeave&&r.onNodeDragLeave.apply(r,arguments)}),onDragend:e[8]||(e[8]=function(){return r.onNodeDragEnd&&r.onNodeDragEnd.apply(r,arguments)}),onDrop:e[9]||(e[9]=function(){return r.onNodeDrop&&r.onNodeDrop.apply(r,arguments)})},r.getPTOptions("nodeContent"),{"data-p-selected":r.checkboxMode?r.checked:r.selected,"data-p-selectable":r.selectable}),[Re((u(),g("button",y({type:"button",class:t.cx("nodeToggleButton"),onClick:e[0]||(e[0]=function(){return r.toggle&&r.toggle.apply(r,arguments)}),tabindex:"-1","data-p-leaf":r.leaf},r.getPTOptions("nodeToggleButton")),[n.node.loading&&n.loadingMode==="icon"?(u(),g(L,{key:0},[n.templates.nodetoggleicon||n.templates.nodetogglericon?(u(),b(T(n.templates.nodetoggleicon||n.templates.nodetogglericon),{key:0,node:n.node,expanded:r.expanded,class:D(t.cx("nodeToggleIcon"))},null,8,["node","expanded","class"])):(u(),b(a,y({key:1,spin:"",class:t.cx("nodeToggleIcon")},r.getPTOptions("nodeToggleIcon")),null,16,["class"]))],64)):(u(),g(L,{key:1},[n.templates.nodetoggleicon||n.templates.togglericon?(u(),b(T(n.templates.nodetoggleicon||n.templates.togglericon),{key:0,node:n.node,expanded:r.expanded,class:D(t.cx("nodeToggleIcon"))},null,8,["node","expanded","class"])):r.expanded?(u(),b(T(n.node.expandedIcon?"span":"ChevronDownIcon"),y({key:1,class:t.cx("nodeToggleIcon")},r.getPTOptions("nodeToggleIcon")),null,16,["class"])):(u(),b(T(n.node.collapsedIcon?"span":"ChevronRightIcon"),y({key:2,class:t.cx("nodeToggleIcon")},r.getPTOptions("nodeToggleIcon")),null,16,["class"]))],64))],16,gt)),[[f]]),r.checkboxMode?(u(),b(l,{key:0,defaultValue:r.checked,binary:!0,indeterminate:r.partialChecked,class:D(t.cx("nodeCheckbox")),tabindex:-1,unstyled:t.unstyled,pt:r.getPTOptions("pcNodeCheckbox"),"data-p-partialchecked":r.partialChecked},{icon:R(function(v){return[n.templates.checkboxicon?(u(),b(T(n.templates.checkboxicon),{key:0,checked:v.checked,partialChecked:r.partialChecked,class:D(v.class)},null,8,["checked","partialChecked","class"])):C("",!0)]}),_:1},8,["defaultValue","indeterminate","class","unstyled","pt","data-p-partialchecked"])):C("",!0),n.templates.nodeicon?(u(),b(T(n.templates.nodeicon),y({key:1,node:n.node,class:[t.cx("nodeIcon")]},r.getPTOptions("nodeIcon")),null,16,["node","class"])):(u(),g("span",y({key:2,class:[t.cx("nodeIcon"),n.node.icon]},r.getPTOptions("nodeIcon")),null,16)),G("span",y({class:t.cx("nodeLabel")},r.getPTOptions("nodeLabel"),{onKeydown:e[1]||(e[1]=Ue(function(){},["stop"]))}),[n.templates[n.node.type]||n.templates.default?(u(),b(T(n.templates[n.node.type]||n.templates.default),{key:0,node:n.node,expanded:r.expanded,selected:r.checkboxMode?r.checked:r.selected},null,8,["node","expanded","selected"])):(u(),g(L,{key:1},[ue(O(r.label(n.node)),1)],64))],16)],16,ht),r.isNextDropPointActive?(u(),g("div",{key:1,class:D(t.cx("dropPoint")),"aria-hidden":"true"},null,2)):C("",!0),r.hasChildren&&r.expanded?(u(),g("ul",y({key:2,class:t.cx("nodeChildren"),role:"group"},t.ptm("nodeChildren")),[(u(!0),g(L,null,fe(n.node.children,function(v,k){return u(),b(s,{key:v.key,node:v,parentNode:n.node,rootNodes:n.rootNodes,templates:n.templates,level:n.level+1,index:k,loadingMode:n.loadingMode,expandedKeys:n.expandedKeys,onNodeToggle:r.onChildNodeToggle,onNodeClick:r.onChildNodeClick,selectionMode:n.selectionMode,selectionKeys:n.selectionKeys,onCheckboxChange:r.propagateUp,draggableScope:n.draggableScope,draggableNodes:n.draggableNodes,droppableNodes:n.droppableNodes,validateDrop:n.validateDrop,onNodeDrop:e[10]||(e[10]=function(h){return t.$emit("node-drop",h)}),onNodeDragenter:e[11]||(e[11]=function(h){return t.$emit("node-dragenter",h)}),onNodeDragleave:e[12]||(e[12]=function(h){return t.$emit("node-dragleave",h)}),onValueChange:e[13]||(e[13]=function(h){return t.$emit("value-change",h)}),unstyled:t.unstyled,pt:t.pt},null,8,["node","parentNode","rootNodes","templates","level","index","loadingMode","expandedKeys","onNodeToggle","onNodeClick","selectionMode","selectionKeys","onCheckboxChange","draggableScope","draggableNodes","droppableNodes","validateDrop","unstyled","pt"])}),128))],16)):C("",!0)],16,pt)}he.render=yt;function V(t){"@babel/helpers - typeof";return V=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},V(t)}function j(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=ge(t))||e){n&&(t=n);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var r,a=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var f=n.next();return a=f.done,f},e:function(f){l=!0,r=f},f:function(){try{a||n.return==null||n.return()}finally{if(l)throw r}}}}function oe(t){return mt(t)||vt(t)||ge(t)||bt()}function bt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ge(t,e){if(t){if(typeof t=="string")return J(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?J(t,e):void 0}}function vt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function mt(t){if(Array.isArray(t))return J(t)}function J(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n<e;n++)o[n]=t[n];return o}function ie(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function P(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ie(Object(n),!0).forEach(function(o){Nt(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ie(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function Nt(t,e,n){return(e=Dt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Dt(t){var e=kt(t,"string");return V(e)=="symbol"?e:e+""}function kt(t,e){if(V(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(V(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ye={name:"Tree",extends:it,inheritAttrs:!1,emits:["node-expand","node-collapse","update:expandedKeys","update:selectionKeys","node-select","node-unselect","filter","node-drop","node-dragenter","node-dragleave","update:value","drag-enter","drag-leave"],data:function(){return{d_expandedKeys:this.expandedKeys||{},filterValue:null,dragNode:null,dragNodeSubNodes:null,dragNodeIndex:null,dragNodeScope:null,dragHover:null}},inject:{$pcTreeSelect:{default:null}},dragDropService:null,dragStartCleanup:null,dragStopCleanup:null,watch:{expandedKeys:function(e){this.d_expandedKeys=e},droppableNodes:function(e){e?this.initDragDropService():this.cleanupDragDropService()}},mounted:function(){this.droppableNodes&&this.initDragDropService()},beforeUnmount:function(){this.cleanupDragDropService()},methods:{initDragDropService:function(){var e=this;this.dragDropService||(this.dragDropService=at(),this.dragStartCleanup=this.dragDropService.onDragStart(function(n){e.dragNode=n.node,e.dragNodeSubNodes=n.subNodes,e.dragNodeIndex=n.index,e.dragNodeScope=n.scope}),this.dragStopCleanup=this.dragDropService.onDragStop(function(){e.dragNode=null,e.dragNodeSubNodes=null,e.dragNodeIndex=null,e.dragNodeScope=null,e.dragHover=!1}))},cleanupDragDropService:function(){this.dragStartCleanup&&(this.dragStartCleanup(),this.dragStartCleanup=null),this.dragStopCleanup&&(this.dragStopCleanup(),this.dragStopCleanup=null),this.dragDropService=null},onNodeToggle:function(e){var n=e.key;this.d_expandedKeys[n]?(delete this.d_expandedKeys[n],this.$emit("node-collapse",e)):(this.d_expandedKeys[n]=!0,this.$emit("node-expand",e)),this.d_expandedKeys=P({},this.d_expandedKeys),this.$emit("update:expandedKeys",this.d_expandedKeys)},onNodeClick:function(e){if(this.selectionMode!=null&&e.node.selectable!==!1){var n=e.nodeTouched?!1:this.metaKeySelection,o=n?this.handleSelectionWithMetaKey(e):this.handleSelectionWithoutMetaKey(e);this.$emit("update:selectionKeys",o)}},onCheckboxChange:function(e){this.$emit("update:selectionKeys",e.selectionKeys),e.check?this.$emit("node-select",e.node):this.$emit("node-unselect",e.node)},handleSelectionWithMetaKey:function(e){var n=e.originalEvent,o=e.node,i=n.metaKey||n.ctrlKey,r=this.isNodeSelected(o),a;return r&&i?(this.isSingleSelectionMode()?a={}:(a=P({},this.selectionKeys),delete a[o.key]),this.$emit("node-unselect",o)):(this.isSingleSelectionMode()?a={}:this.isMultipleSelectionMode()&&(a=i?this.selectionKeys?P({},this.selectionKeys):{}:{}),a[o.key]=!0,this.$emit("node-select",o)),a},handleSelectionWithoutMetaKey:function(e){var n=e.node,o=this.isNodeSelected(n),i;return this.isSingleSelectionMode()?o?(i={},this.$emit("node-unselect",n)):(i={},i[n.key]=!0,this.$emit("node-select",n)):o?(i=P({},this.selectionKeys),delete i[n.key],this.$emit("node-unselect",n)):(i=this.selectionKeys?P({},this.selectionKeys):{},i[n.key]=!0,this.$emit("node-select",n)),i},isSingleSelectionMode:function(){return this.selectionMode==="single"},isMultipleSelectionMode:function(){return this.selectionMode==="multiple"},isNodeSelected:function(e){return this.selectionMode&&this.selectionKeys?this.selectionKeys[e.key]===!0:!1},isChecked:function(e){return this.selectionKeys?this.selectionKeys[e.key]&&this.selectionKeys[e.key].checked:!1},isNodeLeaf:function(e){return e.leaf===!1?!1:!(e.children&&e.children.length)},onFilterKeyup:function(e){(e.code==="Enter"||e.code==="NumpadEnter")&&e.preventDefault(),this.$emit("filter",{originalEvent:e,value:e.target.value,filteredNodes:this.valueToRender})},findFilteredNodes:function(e,n){if(e){var o=!1;if(e.children){var i=oe(e.children);e.children=[];var r=j(i),a;try{for(r.s();!(a=r.n()).done;){var l=a.value,s=P({},l);this.isFilterMatched(s,n)&&(o=!0,e.children.push(s))}}catch(f){r.e(f)}finally{r.f()}}if(o)return!0}},isFilterMatched:function(e,n){var o=n.searchFields,i=n.filterText,r=n.strict,a=!1,l=j(o),s;try{for(l.s();!(s=l.n()).done;){var f=s.value,v=String(Le(e,f)).toLocaleLowerCase(this.filterLocale);v.indexOf(i)>-1&&(a=!0)}}catch(k){l.e(k)}finally{l.f()}return(!a||r&&!this.isNodeLeaf(e))&&(a=this.findFilteredNodes(e,{searchFields:o,filterText:i,strict:r})||a),a},onNodeDrop:function(e){this.$emit("node-drop",e)},onNodeDragEnter:function(e){this.$emit("node-dragenter",e)},onNodeDragLeave:function(e){this.$emit("node-dragleave",e)},onValueChanged:function(e){this.dragNodeSubNodes.splice(this.dragNodeIndex,1),this.$emit("update:value",e.nodes)},isDescendantOf:function(e,n){if(!e||!e.children)return!1;var o=j(e.children),i;try{for(o.s();!(i=o.n()).done;){var r=i.value;if(r===n||this.isDescendantOf(r,n))return!0}}catch(a){o.e(a)}finally{o.f()}return!1},allowDrop:function(e,n,o){return!(!e||!this.isValidDragScope(o)||n&&(e===n||this.isDescendantOf(e,n)))},allowNodeDrop:function(e){return this.allowDrop(this.dragNode,e,this.dragNodeScope)},hasCommonScope:function(e,n){if(e===null&&n===null)return!0;if(e===null||n===null)return!1;if(typeof n=="string"){if(typeof e=="string")return e===n;if(Array.isArray(e))return e.indexOf(n)!==-1}else if(Array.isArray(n)){if(typeof e=="string")return n.indexOf(e)!==-1;if(Array.isArray(e)){var o=j(e),i;try{for(o.s();!(i=o.n()).done;){var r=i.value;if(n.indexOf(r)!==-1)return!0}}catch(a){o.e(a)}finally{o.f()}return!1}}return!1},isValidDragScope:function(e){return this.droppableScope===null?!0:this.hasCommonScope(e,this.droppableScope)},isSameTreeScope:function(e){return this.hasCommonScope(e,this.draggableScope)},onDragOver:function(e){this.droppableNodes&&this.allowDrop(this.dragNode,null,this.dragNodeScope)?e.dataTransfer.dropEffect="copy":e.dataTransfer.dropEffect="none",e.preventDefault()},onDragEnter:function(e){this.droppableNodes&&this.allowDrop(this.dragNode,null,this.dragNodeScope)&&(this.dragHover=!0,this.$emit("drag-enter",{originalEvent:e,value:this.value,dragNode:this.dragNode,dragNodeScope:this.dragNodeScope}))},onDragLeave:function(e){if(this.droppableNodes){var n=e.currentTarget.getBoundingClientRect();(e.x>=parseInt(n.right)||e.x<=parseInt(n.left)||e.y>=parseInt(n.bottom)||e.y<=parseInt(n.top))&&(this.dragHover=!1),this.$emit("drag-leave",{originalEvent:e,value:this.value,dragNode:this.dragNode,dragNodeScope:this.dragNodeScope})}},processTreeDrop:function(e,n){this.dragNodeSubNodes.splice(n,1);var o=[].concat(oe(this.value||[]),[e]);this.$emit("update:value",o),this.dragDropService.stopDrag({node:e})},onDrop:function(e){var n=this;if(this.droppableNodes){e.preventDefault();var o=this.dragNode;if(this.allowDrop(o,null,this.dragNodeScope)){var i=this.dragNodeIndex;if(this.isSameTreeScope(this.dragNodeScope)){this.dragDropService.stopDrag({node:o});return}this.validateDrop?this.$emit("node-drop",{originalEvent:e,value:this.value,dragNode:o,dropNode:null,index:i,accept:function(){n.processTreeDrop(o,i)}}):(this.$emit("node-drop",{originalEvent:e,value:this.value,dragNode:o,dropNode:null,index:i}),this.processTreeDrop(o,i))}}}},computed:{filteredValue:function(){var e=[],n=je(this.filterBy)?[this.filterBy]:this.filterBy.split(","),o=this.filterValue.trim().toLocaleLowerCase(this.filterLocale),i=this.filterMode==="strict",r=j(this.value),a;try{for(r.s();!(a=r.n()).done;){var l=a.value,s=P({},l),f={searchFields:n,filterText:o,strict:i};(i&&(this.findFilteredNodes(s,f)||this.isFilterMatched(s,f))||!i&&(this.isFilterMatched(s,f)||this.findFilteredNodes(s,f)))&&e.push(s)}}catch(v){r.e(v)}finally{r.f()}return e},valueToRender:function(){return this.filterValue&&this.filterValue.trim().length>0?this.filteredValue:this.value},empty:function(){return!this.valueToRender||this.valueToRender.length===0},emptyMessageText:function(){var e;return((e=this.$primevue.config)===null||e===void 0||(e=e.locale)===null||e===void 0?void 0:e.emptyMessage)||""},containerDataP:function(){return _({loading:this.loading,scrollable:this.scrollHeight==="flex"})},wrapperDataP:function(){return _({scrollable:this.scrollHeight==="flex"})}},components:{TreeNode:he,InputText:Ie,InputIcon:Pe,IconField:we,SearchIcon:Te,SpinnerIcon:se}};function B(t){"@babel/helpers - typeof";return B=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},B(t)}function ae(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function le(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ae(Object(n),!0).forEach(function(o){St(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ae(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function St(t,e,n){return(e=xt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xt(t){var e=Ct(t,"string");return B(e)=="symbol"?e:e+""}function Ct(t,e){if(B(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(B(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Tt=["data-p"],wt=["data-p"],Pt=["aria-labelledby","aria-label"];function It(t,e,n,o,i,r){var a=S("SpinnerIcon"),l=S("InputText"),s=S("SearchIcon"),f=S("InputIcon"),v=S("IconField"),k=S("TreeNode");return u(),g("div",y({class:t.cx("root"),onDragover:e[1]||(e[1]=function(){return r.onDragOver&&r.onDragOver.apply(r,arguments)}),onDragenter:e[2]||(e[2]=function(){return r.onDragEnter&&r.onDragEnter.apply(r,arguments)}),onDragleave:e[3]||(e[3]=function(){return r.onDragLeave&&r.onDragLeave.apply(r,arguments)}),onDrop:e[4]||(e[4]=function(){return r.onDrop&&r.onDrop.apply(r,arguments)}),"data-p":r.containerDataP},t.ptmi("root")),[F(ze,{name:"p-overlay-mask"},{default:R(function(){return[t.loading&&t.loadingMode==="mask"?(u(),g("div",y({key:0,class:t.cx("mask")},t.ptm("mask")),[E(t.$slots,"loadingicon",{class:D(t.cx("loadingIcon"))},function(){return[t.loadingIcon?(u(),g("i",y({key:0,class:[t.cx("loadingIcon"),"pi-spin",t.loadingIcon]},t.ptm("loadingIcon")),null,16)):(u(),b(a,y({key:1,spin:"",class:t.cx("loadingIcon")},t.ptm("loadingIcon")),null,16,["class"]))]})],16)):C("",!0)]}),_:3}),t.filter?(u(),b(v,{key:0,unstyled:t.unstyled,pt:le(le({},t.ptm("pcFilter")),t.ptm("pcFilterContainer")),class:D(t.cx("pcFilterContainer"))},{default:R(function(){return[F(l,{modelValue:i.filterValue,"onUpdate:modelValue":e[0]||(e[0]=function(h){return i.filterValue=h}),autocomplete:"off",class:D(t.cx("pcFilterInput")),placeholder:t.filterPlaceholder,unstyled:t.unstyled,onKeyup:r.onFilterKeyup,pt:t.ptm("pcFilterInput")},null,8,["modelValue","class","placeholder","unstyled","onKeyup","pt"]),F(f,{unstyled:t.unstyled,pt:t.ptm("pcFilterIconContainer")},{default:R(function(){return[E(t.$slots,t.$slots.filtericon?"filtericon":"searchicon",{class:D(t.cx("filterIcon"))},function(){return[F(s,y({class:t.cx("filterIcon")},t.ptm("filterIcon")),null,16,["class"])]})]}),_:3},8,["unstyled","pt"])]}),_:3},8,["unstyled","pt","class"])):C("",!0),G("div",y({class:t.cx("wrapper"),style:{maxHeight:t.scrollHeight},"data-p":r.wrapperDataP},t.ptm("wrapper")),[E(t.$slots,"header",{value:t.value,expandedKeys:t.expandedKeys,selectionKeys:t.selectionKeys}),r.empty?r.empty&&!r.$pcTreeSelect?(u(),g("div",y({key:1,class:t.cx("emptyMessage")},t.ptm("emptyMessage")),[E(t.$slots,"empty",{},function(){return[ue(O(r.emptyMessageText),1)]})],16)):C("",!0):(u(),g("ul",y({key:0,class:t.cx("rootChildren"),role:"tree","aria-labelledby":t.ariaLabelledby,"aria-label":t.ariaLabel},t.ptm("rootChildren")),[(u(!0),g(L,null,fe(r.valueToRender,function(h,A){return u(),b(k,{key:h.key,node:h,rootNodes:r.valueToRender,templates:t.$slots,level:t.level+1,index:A,expandedKeys:i.d_expandedKeys,onNodeToggle:r.onNodeToggle,onNodeClick:r.onNodeClick,selectionMode:t.selectionMode,selectionKeys:t.selectionKeys,onCheckboxChange:r.onCheckboxChange,loadingMode:t.loadingMode,draggableNodes:t.draggableNodes,droppableNodes:t.droppableNodes,draggableScope:t.draggableScope,validateDrop:t.validateDrop,onNodeDrop:r.onNodeDrop,onNodeDragenter:r.onNodeDragEnter,onNodeDragleave:r.onNodeDragLeave,onValueChange:r.onValueChanged,unstyled:t.unstyled,pt:t.pt},null,8,["node","rootNodes","templates","level","index","expandedKeys","onNodeToggle","onNodeClick","selectionMode","selectionKeys","onCheckboxChange","loadingMode","draggableNodes","droppableNodes","draggableScope","validateDrop","onNodeDrop","onNodeDragenter","onNodeDragleave","onValueChange","unstyled","pt"])}),128))],16,Pt)),E(t.$slots,"footer",{value:t.value,expandedKeys:t.expandedKeys,selectionKeys:t.selectionKeys})],16,wt)],16,Tt)}ye.render=It;const Kt={class:"adapters"},Ot={key:0,class:"adapters__status"},At={key:1,class:"adapters__status adapters__status--error"},Et={key:2,class:"adapters__status"},de="tvh-config:dvb:adapters:expand",Mt=150,jt=qe({__name:"TvAdaptersView",setup(t){const{t:e}=We();function n(d){const c=Array.isArray(d.children),p=c?d.children.map(n):void 0,m=d.leaf===!0||d.leaf===1,xe=c&&p.length===0;return{key:d.uuid,label:d.text??d.name??d.uuid,leaf:m||xe,children:p,data:{uuid:d.uuid}}}const o=I([]),i=I(!1),r=I(null),a=I({}),l=I({}),s=I(null);function f(){const d=Ze(de,c=>Array.isArray(c));return d?d.filter(c=>typeof c=="string"):[]}function v(){const d=Object.keys(a.value).filter(c=>a.value[c]);$e(de,d)}Ge(a,v);let k=null,h=null,A=!1,U=!1,x=!1;async function Q(d=!1){d||(i.value=!0,r.value=null);try{const c=await te("hardware/tree",{uuid:"root"});o.value=(c??[]).map(n),d&&(r.value=null)}catch(c){d?console.error("hardware/tree refresh failed:",c):r.value=c}finally{d||(i.value=!1)}}async function X(d){if(Array.isArray(d.children)&&d.children.length>0)return;const c=d.key;if(typeof c=="string")try{const p=await te("hardware/tree",{uuid:c});d.children=(p??[]).map(n),d.leaf=d.children.length===0}catch(p){console.error("hardware/tree load failed for",c,p)}}async function be(){if(!x){if(A){U=!0;return}A=!0;try{do{U=!1;const d=Object.keys(a.value).filter(c=>a.value[c]);if(await Q(!0),x||(await Z(d),x))return}while(U&&!x)}finally{A=!1}}}function ve(d,c){const p=typeof d.key=="string"?d.key:"";return p!==""&&!d.leaf&&c.includes(p)}async function me(d){const c=[...o.value],p=new Set;for(;c.length>0;){const m=c.shift();if(typeof m.key=="string"&&m.key!==""&&p.add(m.key),ve(m,d)&&(await X(m),x))return p;Array.isArray(m.children)&&c.push(...m.children)}return p}async function Z(d){const c=await me(d);if(x)return;const p={};for(const m of d)c.has(m)&&(p[m]=!0);a.value=p}function Ne(){h!==null&&clearTimeout(h),h=globalThis.setTimeout(()=>{h=null,be()},Mt)}function De(d){const c=d.data?.uuid;typeof c=="string"&&(s.value=c)}function ke(){s.value=null,l.value={}}const Se=_e(()=>!i.value&&!r.value&&o.value.length===0);return Ye(async()=>{k=Je.on("hardware",()=>Ne());const d=f();if(d.length>0){const c={};for(const p of d)c[p]=!0;a.value=c}if(await Q(),!(x||r.value)&&d.length>0){i.value=!0;try{await Z(d)}finally{i.value=!1}}}),Qe(()=>{x=!0,k?.(),k=null,h!==null&&(clearTimeout(h),h=null)}),(d,c)=>(u(),g("section",Kt,[i.value?(u(),g("div",Ot,O(M(e)("Loading adapters…")),1)):r.value?(u(),g("div",At,O(M(e)("Failed to load:"))+" "+O(r.value.message),1)):Se.value?(u(),g("div",Et,O(M(e)("No DVB adapters detected on this server.")),1)):(u(),b(M(ye),{key:3,"expanded-keys":a.value,"onUpdate:expandedKeys":c[0]||(c[0]=p=>a.value=p),"selection-keys":l.value,"onUpdate:selectionKeys":c[1]||(c[1]=p=>l.value=p),value:o.value,"selection-mode":"single","meta-key-selection":!1,class:"adapters__tree",onNodeExpand:X,onNodeSelect:De},null,8,["expanded-keys","selection-keys","value"])),F(Xe,{uuid:s.value,level:"expert",title:M(e)("Adapter / Frontend"),onClose:ke},null,8,["uuid","title"])]))}}),Ht=et(jt,[["__scopeId","data-v-f49b53d8"]]);export{Ht as default};
