UNPKG

@zanmato/vue3-treeselect

Version:

Tree select hierarchical component for Vue 3

5 lines 64.6 kB
/*! * vue3-treeselect v0.4.4 | (c) 2026 Andreas Johansson * Released under the MIT License. * https://zanmato.github.io/vue3-treeselect/ */!function(){"use strict";var e={510:function(e,t){t.A=(e,t)=>{const n=e.__vccOpts||e;for(const[e,r]of t)n[e]=r;return n}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};n.r(r),n.d(r,{ASYNC_SEARCH:function(){return K},LOAD_CHILDREN_OPTIONS:function(){return q},LOAD_ROOT_OPTIONS:function(){return Q},Treeselect:function(){return lt},VERSION:function(){return ct},default:function(){return ut},treeselectMixin:function(){return _e}});var i=require("vue"),o=require("fuzzysearch"),s=n.n(o),a=require("lodash/noop");var l=n.n(a)();function u(e){return function(t){if("mousedown"===t.type&&0===t.button){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.call.apply(e,[this,t].concat(r))}}}var c=require("lodash/debounce"),d=n.n(c),h=require("watch-size"),f=n.n(h);function p(e,t){var n=!0,r=f()(e,function(){return n||t.apply(void 0,arguments)});return n=!1,r}function v(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e){var t=getComputedStyle(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/(auto|scroll|overlay)/.test(n+i+r)}function g(e,t){var n=function(e){for(var t=[],n=e.parentNode;n&&"BODY"!==n.nodeName&&n.nodeType===document.ELEMENT_NODE;)y(n)&&t.push(n),n=n.parentNode;return t.push(window),t}(e);window.addEventListener("resize",t,{passive:!0});var r,i=v(n);try{for(i.s();!(r=i.n()).done;){r.value.addEventListener("scroll",t,{passive:!0})}}catch(e){i.e(e)}finally{i.f()}return function(){window.removeEventListener("resize",t,{passive:!0});var e,r=v(n);try{for(r.s();!(e=r.n()).done;){e.value.removeEventListener("scroll",t,{passive:!0})}}catch(e){r.e(e)}finally{r.f()}}}function b(e){return e!=e}var S=require("is-promise"),O=n.n(S),N=require("lodash/once"),w=n.n(N),_=require("lodash/identity"),V=n.n(_),M=require("lodash/constant"),C=n.n(M),L=function(){return Object.create(null)};function x(e){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(e)}function I(e){return null!=e&&"object"===x(e)&&Object.getPrototypeOf(e)===Object.prototype}function E(e,t,n){I(n)?(e[t]||(e[t]={}),A(e[t],n)):e[t]=n}function A(e,t){if(I(t))for(var n=Object.keys(t),r=0,i=n.length;r<i;r++)E(e,n[r],t[n[r]]);return e}var D=require("lodash/last"),T=n.n(D);function B(e,t){return e.includes(t)}function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||z(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(e,t){if(e){if("string"==typeof e)return k(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function j(e,t){if(e.length!==t.length)return!0;var n,r=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=z(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(e.entries());try{for(r.s();!(n=r.n()).done;){var i=R(n.value,2),o=i[0];if(i[1]!==t[o])return!0}}catch(e){r.e(e)}finally{r.f()}return!1}var F=null,P="ALL_CHILDREN",$="ALL_DESCENDANTS",H="LEAF_CHILDREN",W="LEAF_DESCENDANTS",Q="LOAD_ROOT_OPTIONS",q="LOAD_CHILDREN_OPTIONS",K="ASYNC_SEARCH",Y="ALL",U="BRANCH_PRIORITY",X="LEAF_PRIORITY",J="ALL_WITH_INDETERMINATE",G="ORDER_SELECTED",Z="LEVEL",ee="INDEX",te=8,ne=13,re=27,ie=35,oe=36,se=37,ae=38,le=39,ue=40,ce=46;function de(e){return de="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},de(e)}function he(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||ge(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fe(e){return function(e){if(Array.isArray(e))return be(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ge(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ve(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pe(Object(n),!0).forEach(function(t){me(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function me(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=de(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=de(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==de(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ye(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=ge(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function ge(e,t){if(e){if("string"==typeof e)return be(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?be(e,t):void 0}}function be(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Se(e,t){for(var n=0;;){if(e.level<n)return-1;if(t.level<n)return 1;if(e.index[n]!==t.index[n])return e.index[n]-t.index[n];n++}}function Oe(e,t,n){return e?s()(t,n):B(n,t)}function Ne(e){return e.message||String(e)}var we=0,_e={provide:function(){return{instance:this}},props:{allowClearingDisabled:{type:Boolean,default:!1},allowSelectingDisabledDescendants:{type:Boolean,default:!1},alwaysOpen:{type:Boolean,default:!1},appendToBody:{type:Boolean,default:!1},async:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1},autoLoadRootOptions:{type:Boolean,default:!0},autoDeselectAncestors:{type:Boolean,default:!1},autoDeselectDescendants:{type:Boolean,default:!1},autoSelectAncestors:{type:Boolean,default:!1},autoSelectDescendants:{type:Boolean,default:!1},backspaceRemoves:{type:Boolean,default:!0},beforeClearAll:{type:Function,default:C()(!0)},branchNodesFirst:{type:Boolean,default:!1},cacheOptions:{type:Boolean,default:!0},clearable:{type:Boolean,default:!0},clearAllText:{type:String,default:"Clear all"},clearOnSelect:{type:Boolean,default:!1},clearValueText:{type:String,default:"Clear value"},closeOnSelect:{type:Boolean,default:!0},defaultExpandLevel:{type:Number,default:0},deleteRemoves:{type:Boolean,default:!0},delimiter:{type:String,default:","},flattenSearchResults:{type:Boolean,default:!1},disableBranchNodes:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},disableFuzzyMatching:{type:Boolean,default:!1},flat:{type:Boolean,default:!1},instanceId:{default:function(){return"".concat(we++,"$$")},type:[String,Number]},joinValues:{type:Boolean,default:!1},limit:{type:Number,default:Number.POSITIVE_INFINITY},limitText:{type:Function,default:function(e){return"and ".concat(e," more")}},loadingText:{type:String,default:"Loading..."},loadOptions:{type:Function},matchKeys:{type:Array,default:C()(["label"])},maxHeight:{type:Number,default:300},multiple:{type:Boolean,default:!1},name:{type:String},noChildrenText:{type:String,default:"No sub-options."},noOptionsText:{type:String,default:"No options available."},noResultsText:{type:String,default:"No results found..."},normalizer:{type:Function,default:V()},openDirection:{type:String,default:"auto",validator:function(e){return B(["auto","top","bottom","above","below"],e)}},openOnClick:{type:Boolean,default:!0},openOnFocus:{type:Boolean,default:!1},options:{type:Array},placeholder:{type:String,default:"Select..."},required:{type:Boolean,default:!1},retryText:{type:String,default:"Retry?"},retryTitle:{type:String,default:"Click to retry"},searchable:{type:Boolean,default:!0},searchNested:{type:Boolean,default:!1},searchPromptText:{type:String,default:"Type to search..."},showCount:{type:Boolean,default:!1},showCountOf:{type:String,default:P,validator:function(e){return B([P,$,H,W],e)}},showCountOnSearch:null,sortValueBy:{type:String,default:G,validator:function(e){return B([G,Z,ee],e)}},tabIndex:{type:Number,default:0},modelValue:null,valueConsistsOf:{type:String,default:U,validator:function(e){return B([Y,U,X,J],e)}},valueFormat:{type:String,default:"id"},zIndex:{type:[Number,String],default:999}},data:function(){return{trigger:{isFocused:!1,searchQuery:""},menu:{isOpen:!1,current:null,lastScrollPosition:0,placement:"bottom",renderKey:0},forest:{normalizedOptions:[],nodeMap:L(),checkedStateMap:L(),selectedNodeIds:this.extractCheckedNodeIdsFromValue(),selectedNodeMap:L()},rootOptionsStates:{isLoaded:!1,isLoading:!1,loadingError:""},localSearch:{active:!1,noResults:!0,countMap:L()},remoteSearch:L(),hasBranchNodes:!1}},computed:{selectedNodes:function(){return this.forest.selectedNodeIds.map(this.getNode)},internalValue:function(){var e,t=this;if(this.single||this.flat||this.disableBranchNodes||this.valueConsistsOf===Y)e=this.forest.selectedNodeIds.slice();else if(this.valueConsistsOf===U)e=this.forest.selectedNodeIds.filter(function(e){var n=t.getNode(e);return!!n.isRootNode||!t.isSelected(n.parentNode)});else if(this.valueConsistsOf===X)e=this.forest.selectedNodeIds.filter(function(e){var n=t.getNode(e);return!!n.isLeaf||0===n.children.length});else if(this.valueConsistsOf===J){var n,r=[];e=this.forest.selectedNodeIds.slice();var i,o=ye(this.selectedNodes);try{for(o.s();!(i=o.n()).done;){var s,a=ye(i.value.ancestors);try{for(a.s();!(s=a.n()).done;){var l=s.value;B(r,l.id)||(B(e,l.id)||r.push(l.id))}}catch(e){a.e(e)}finally{a.f()}}}catch(e){o.e(e)}finally{o.f()}(n=e).push.apply(n,r)}return this.sortValueBy===Z?e.sort(function(e,n){return function(e,t){return e.level===t.level?Se(e,t):e.level-t.level}(t.getNode(e),t.getNode(n))}):this.sortValueBy===ee&&e.sort(function(e,n){return Se(t.getNode(e),t.getNode(n))}),e},hasValue:function(){return this.internalValue.length>0},single:function(){return!this.multiple},visibleOptionIds:function(){var e=this,t=[];return this.traverseAllNodesByIndex(function(n){if(e.localSearch.active&&!e.shouldOptionBeIncludedInSearchResult(n)||t.push(n.id),n.isBranch&&!e.shouldExpand(n))return!1}),t},navigableOptionIds:function(){if(this.localSearch.active)return this.visibleOptionIds;var e=[];return this.traverseAllNodesByIndex(function(t){e.push(t.id)}),e},hasVisibleOptions:function(){return 0!==this.visibleOptionIds.length},showCountOnSearchComputed:function(){return"boolean"==typeof this.showCountOnSearch?this.showCountOnSearch:this.showCount},shouldFlattenOptions:function(){return this.localSearch.active&&this.flattenSearchResults}},watch:{alwaysOpen:function(e){e?this.openMenu():this.closeMenu()},branchNodesFirst:function(){this.initialize()},disabled:function(e){e&&this.menu.isOpen?this.closeMenu():e||this.menu.isOpen||!this.alwaysOpen||this.openMenu()},flat:function(){this.initialize()},internalValue:function(e,t){j(e,t)&&this.$emit("update:modelValue",this.getValue(),this.getInstanceId())},matchKeys:function(){this.initialize()},multiple:function(e){e&&this.buildForestState()},options:{handler:function(){this.initialize(),this.rootOptionsStates.isLoaded=Array.isArray(this.options)},deep:!0,immediate:!0},"trigger.searchQuery":function(){this.async?this.handleRemoteSearch():this.handleLocalSearch(),this.$emit("search-change",this.trigger.searchQuery,this.getInstanceId())},modelValue:function(){var e=this.extractCheckedNodeIdsFromValue();j(e,this.internalValue)&&this.fixSelectedNodeIds(e)}},methods:{verifyProps:function(){var e=this;if(l(function(){return!e.async||e.searchable},function(){return'For async search mode, the value of "searchable" prop must be true.'}),null!=this.options||this.loadOptions||l(function(){return!1},function(){return'Are you meant to dynamically load options? You need to use "loadOptions" prop.'}),this.flat&&l(function(){return e.multiple},function(){return'You are using flat mode. But you forgot to add "multiple=true"?'}),!this.flat)for(var t=function(){var t=r[n];l(function(){return!e[t]},function(){return'"'.concat(t,'" only applies to flat mode.')})},n=0,r=["autoSelectAncestors","autoSelectDescendants","autoDeselectAncestors","autoDeselectDescendants"];n<r.length;n++)t()},resetFlags:function(){this._blurOnSelect=!1},initialize:function(){var e=this.async&&""!==this.trigger.searchQuery?this.getRemoteSearchEntry().options:this.options;if(Array.isArray(e)){var t=this.forest.nodeMap;this.forest.nodeMap=L(),this.keepDataOfSelectedNodes(t),this.forest.normalizedOptions=this.normalize(F,e,t),this.fixSelectedNodeIds(this.internalValue),this.hasBranchNodes=this.forest.normalizedOptions.some(function(e){return e.isBranch})}else this.forest.normalizedOptions=[]},getInstanceId:function(){return null==this.instanceId?this.id:this.instanceId},getValue:function(){var e=this;if("id"===this.valueFormat)return this.multiple?this.internalValue.slice():this.internalValue[0];var t=this.internalValue.map(function(t){return e.getNode(t).raw});return this.multiple?t:t[0]},getNode:function(e){return l(function(){return null!=e},function(){return"Invalid node id: ".concat(e)}),null==e?null:e in this.forest.nodeMap?this.forest.nodeMap[e]:this.createFallbackNode(e)},createFallbackNode:function(e){var t=this.extractNodeFromValue(e),n={id:e,label:this.enhancedNormalizer(t).label||"".concat(e," (unknown)"),ancestors:[],parentNode:F,isFallbackNode:!0,isRootNode:!0,isLeaf:!0,isBranch:!1,isDisabled:!1,isNew:!1,index:[-1],level:0,raw:t};return this.forest.nodeMap[e]=n},extractCheckedNodeIdsFromValue:function(){var e=this;return null==this.modelValue?[]:"id"===this.valueFormat?this.multiple?this.modelValue.slice():[this.modelValue]:(this.multiple?this.modelValue:[this.modelValue]).map(function(t){return e.enhancedNormalizer(t)}).map(function(e){return e.id})},extractNodeFromValue:function(e){var t=this,n={id:e};return"id"===this.valueFormat?n:function(e,t,n){for(var r=0,i=e.length;r<i;r++)if(t.call(n,e[r],r,e))return e[r]}(this.multiple?Array.isArray(this.modelValue)?this.modelValue:[]:this.modelValue?[this.modelValue]:[],function(n){return n&&t.enhancedNormalizer(n).id===e})||n},fixSelectedNodeIds:function(e){var t=this,n=[];if(this.single||this.flat||this.disableBranchNodes||this.valueConsistsOf===Y)n=e;else if(this.valueConsistsOf===U){var r,i=ye(e);try{for(i.s();!(r=i.n()).done;){var o=r.value;n.push(o);var s=this.getNode(o);s.isBranch&&this.traverseDescendantsBFS(s,function(e){n.push(e.id)})}}catch(e){i.e(e)}finally{i.f()}}else if(this.valueConsistsOf===X)for(var a=L(),l=e.slice();l.length;){var u=l.shift(),c=this.getNode(u);n.push(u),c.isRootNode||(c.parentNode.id in a||(a[c.parentNode.id]=c.parentNode.children.length),0===--a[c.parentNode.id]&&l.push(c.parentNode.id))}else if(this.valueConsistsOf===J)for(var d=L(),h=e.filter(function(e){var n=t.getNode(e);return n.isLeaf||0===n.children.length});h.length;){var f=h.shift(),p=this.getNode(f);n.push(f),p.isRootNode||(p.parentNode.id in d||(d[p.parentNode.id]=p.parentNode.children.length),0===--d[p.parentNode.id]&&h.push(p.parentNode.id))}j(this.forest.selectedNodeIds,n)&&(this.forest.selectedNodeIds=n),this.buildForestState()},keepDataOfSelectedNodes:function(e){var t,n=ye(this.forest.selectedNodeIds);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(e[r]){var i=ve(ve({},e[r]),{},{isFallbackNode:!0});this.forest.nodeMap[r]=i}}}catch(e){n.e(e)}finally{n.f()}},isSelected:function(e){return e&&!0===this.forest.selectedNodeMap[e.id]},traverseDescendantsBFS:function(e,t){if(e.isBranch)for(var n=e.children.slice();n.length;){var r=n[0];r.isBranch&&n.push.apply(n,fe(r.children)),t(r),n.shift()}},traverseDescendantsDFS:function(e,t){if(e.isBranch){var n,r=ye(e.children);try{for(r.s();!(n=r.n()).done;){var i=n.value;this.traverseDescendantsDFS(i,t),t(i)}}catch(e){r.e(e)}finally{r.f()}}},traverseAllNodesDFS:function(e){var t,n=ye(this.forest.normalizedOptions);try{for(n.s();!(t=n.n()).done;){var r=t.value;this.traverseDescendantsDFS(r,e),e(r)}}catch(e){n.e(e)}finally{n.f()}},traverseAllNodesByIndex:function(e){var t=function(n){var r,i=ye(n.children);try{for(i.s();!(r=i.n()).done;){var o=r.value;!1!==e(o)&&o.isBranch&&t(o)}}catch(e){i.e(e)}finally{i.f()}};t({children:this.forest.normalizedOptions})},toggleClickOutsideEvent:function(e){e?document.addEventListener("mousedown",this.handleClickOutside,!1):document.removeEventListener("mousedown",this.handleClickOutside,!1)},getValueContainer:function(){return this.$refs.control.$refs["value-container"]},getInput:function(){return this.getValueContainer().$refs.input},focusInput:function(){this.getInput().focus()},blurInput:function(){this.getInput().blur()},handleMouseDown:u(function(e){(e.preventDefault(),e.stopPropagation(),this.disabled)||(this.getValueContainer().$el.contains(e.target)&&!this.menu.isOpen&&(this.openOnClick||this.trigger.isFocused)&&this.openMenu(),this._blurOnSelect?this.blurInput():this.focusInput(),this.resetFlags())}),handleClickOutside:function(e){this.$refs.wrapper&&!this.$refs.wrapper.contains(e.target)&&(this.blurInput(),this.closeMenu())},handleLocalSearch:function(){var e=this,t=this.trigger.searchQuery,n=function(){return e.resetHighlightedOptionWhenNecessary(!0)};if(!t)return this.localSearch.active=!1,n();this.localSearch.active=!0,this.localSearch.noResults=!0,this.traverseAllNodesDFS(function(t){t.isBranch&&(t.isExpandedOnSearch=!1,t.showAllChildrenOnSearch=!1,t.isMatched=!1,t.hasMatchedDescendants=!1,e.localSearch.countMap[t.id]=me(me(me(me({},P,0),$,0),H,0),W,0))});var r=t.trim().toLocaleLowerCase(),i=r.replace(/\s+/g," ").split(" ");this.traverseAllNodesDFS(function(t){if(e.searchNested&&i.length>1?t.isMatched=i.every(function(e){return Oe(!1,e,t.nestedSearchLabel)}):t.isMatched=e.matchKeys.some(function(n){return Oe(!e.disableFuzzyMatching,r,t.lowerCased[n])}),t.isMatched){e.localSearch.noResults=!1;var n,o=ye(t.ancestors);try{for(o.s();!(n=o.n()).done;){var s=n.value;e.localSearch.countMap[s.id][$]++}}catch(e){o.e(e)}finally{o.f()}t.parentNode!==F&&(e.localSearch.countMap[t.parentNode.id][P]+=1,t.isLeaf&&(e.localSearch.countMap[t.parentNode.id][H]+=1))}(t.isMatched||t.isBranch&&t.isExpandedOnSearch)&&t.parentNode!==F&&(t.parentNode.isExpandedOnSearch=!0,t.parentNode.hasMatchedDescendants=!0)}),n()},handleRemoteSearch:function(){var e=this,t=this.trigger.searchQuery,n=function(){return e.getRemoteSearchEntry()},r=function(n){e.remoteSearch[t]=ve(ve({},e.remoteSearch[t]),n)},i=function(){e.initialize(),e.resetHighlightedOptionWhenNecessary(!0),e.menu.renderKey++};if((""===t||this.cacheOptions)&&n().isLoaded)return i();this.callLoadOptionsProp({action:K,args:{searchQuery:t},isPending:function(){return n().isLoading},start:function(){r({isLoading:!0,isLoaded:!1,loadingError:""})},succeed:function(n){r({isLoaded:!0,options:n}),e.trigger.searchQuery===t&&i(),i()},fail:function(e){r({loadingError:Ne(e)})},end:function(){r({isLoading:!1})}})},getRemoteSearchEntry:function(){var e=this.trigger.searchQuery,t=this.remoteSearch[e]||ve(ve({},{isLoaded:!1,isLoading:!1,loadingError:""}),{},{options:[]});return""===e?(Array.isArray(this.options)&&(t.options=this.options),t.isLoaded=!0,t.isLoading=!1,t):(this.remoteSearch[e]||(this.remoteSearch[e]=t),t)},shouldExpand:function(e){return this.localSearch.active?e.isExpandedOnSearch:e.isExpanded},shouldOptionBeIncludedInSearchResult:function(e){return!!e.isMatched||(!(!e.isBranch||!e.hasMatchedDescendants||this.flattenSearchResults)||!(e.isRootNode||!e.parentNode.showAllChildrenOnSearch))},shouldShowOptionInMenu:function(e){return!(this.localSearch.active&&!this.shouldOptionBeIncludedInSearchResult(e))},getControl:function(){var e;return null!==(e=this.$refs)&&void 0!==e&&e.control?this.$refs.control.$el:null},getMenu:function(){var e,t;if(!this.$refs)return null;var n=this.appendToBody?null===(e=this.$refs.portal)||void 0===e||null===(e=e.$refs)||void 0===e?void 0:e.menu:null===(t=this.$refs.menu)||void 0===t||null===(t=t.$refs)||void 0===t?void 0:t.menu;return n&&"#comment"!==n.nodeName?n:null},setCurrentHighlightedOption:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.menu.current;if(null!=r&&r in this.forest.nodeMap&&(this.forest.nodeMap[r].isHighlighted=!1),this.menu.current=e.id,e.isHighlighted=!0,this.menu.isOpen&&n){var i=function(){var n=t.getMenu();if(n){var r,i,o,s,a,l=n.querySelector('.vue3-treeselect__option[data-id="'.concat(e.id,'"]'));l&&(i=l,o=(r=n).getBoundingClientRect(),s=i.getBoundingClientRect(),a=i.offsetHeight/3,s.bottom+a>o.bottom?r.scrollTop=Math.min(i.offsetTop+i.clientHeight-r.offsetHeight+a,r.scrollHeight):s.top-a<o.top&&(r.scrollTop=Math.max(i.offsetTop-a,0)))}};this.getMenu()?i():this.$nextTick(i)}},resetHighlightedOptionWhenNecessary:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.menu.current;!e&&null!=t&&t in this.forest.nodeMap&&this.shouldShowOptionInMenu(this.getNode(t))||this.highlightFirstOption()},highlightFirstOption:function(){if(this.hasVisibleOptions){var e=this.visibleOptionIds[0];this.setCurrentHighlightedOption(this.getNode(e))}},highlightPrevOption:function(){if(this.hasVisibleOptions){var e=this.visibleOptionIds.indexOf(this.menu.current)-1;if(-1===e)return this.highlightLastOption();this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[e]))}},highlightNextOption:function(){if(this.hasVisibleOptions){var e=this.visibleOptionIds.indexOf(this.menu.current)+1;if(e===this.visibleOptionIds.length)return this.highlightFirstOption();this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[e]))}},highlightLastOption:function(){if(this.hasVisibleOptions){var e=T()(this.visibleOptionIds);this.setCurrentHighlightedOption(this.getNode(e))}},resetSearchQuery:function(){this.trigger.searchQuery=""},closeMenu:function(){!this.menu.isOpen||!this.disabled&&this.alwaysOpen||(this.saveMenuScrollPosition(),this.menu.isOpen=!1,this.toggleClickOutsideEvent(!1),this.resetSearchQuery(),this.$emit("close",this.getValue(),this.getInstanceId()))},openMenu:function(){this.disabled||this.menu.isOpen||(this.menu.isOpen=!0,this.$nextTick(this.resetHighlightedOptionWhenNecessary),this.$nextTick(this.restoreMenuScrollPosition),this.options||this.loadRootOptions(),this.toggleClickOutsideEvent(!0),this.$emit("open",this.getInstanceId()))},toggleMenu:function(){this.menu.isOpen?this.closeMenu():this.openMenu()},toggleExpanded:function(e){var t;this.localSearch.active?(t=e.isExpandedOnSearch=!e.isExpandedOnSearch)&&(e.showAllChildrenOnSearch=!0):t=e.isExpanded=!e.isExpanded,t&&!e.childrenStates.isLoaded&&this.loadChildrenOptions(e)},buildForestState:function(){var e,t=L(),n=ye(this.forest.selectedNodeIds);try{for(n.s();!(e=n.n()).done;){t[e.value]=!0}}catch(e){n.e(e)}finally{n.f()}this.forest.selectedNodeMap=t;var r=L();if(this.multiple){this.traverseAllNodesByIndex(function(e){r[e.id]=0});var i,o=ye(this.selectedNodes);try{for(o.s();!(i=o.n()).done;){var s=i.value;if(r[s.id]=2,!this.flat&&!this.disableBranchNodes){var a,l=ye(s.ancestors);try{for(l.s();!(a=l.n()).done;){var u=a.value;this.isSelected(u)||(r[u.id]=1)}}catch(e){l.e(e)}finally{l.f()}}}}catch(e){o.e(e)}finally{o.f()}}this.forest.checkedStateMap=r},enhancedNormalizer:function(e){return ve(ve({},e),this.normalizer(e,this.getInstanceId()))},mapToNode:function(e,t,n,r){var i=he(e,2),o=i[0],s=i[1];this.checkDuplication(o),this.verifyNodeShape(o);var a=o.id,u=o.label,c=o.children,d=o.isDefaultExpanded,h=n===F,f=h?0:n.level+1,p=Array.isArray(c)||null===c,v=!p,m=!!o.isDisabled||!this.flat&&!h&&n.isDisabled,y=!!o.isNew,g=this.matchKeys.reduce(function(e,t){return ve(ve({},e),{},me({},t,(n=o[t],"string"==typeof n?n:"number"!=typeof n||b(n)?"":n+"").toLocaleLowerCase()));var n},{}),S=h?g.label:n.nestedSearchLabel+" "+g.label;this.forest.nodeMap[a]=L();var O=this.forest.nodeMap[a];if(O.id=a,O.label=u,O.level=f,O.ancestors=h?[]:[n].concat(n.ancestors),O.index=(h?[]:n.index).concat(t),O.parentNode=n,O.lowerCased=g,O.nestedSearchLabel=S,O.isDisabled=m,O.isNew=y,O.isMatched=!1,O.isHighlighted=!1,O.isBranch=p,O.isLeaf=v,O.isRootNode=h,O.raw=s,p){var N=Array.isArray(c);if(O.childrenStates=ve(ve({},{isLoaded:!1,isLoading:!1,loadingError:""}),{},{isLoaded:N}),O.isExpanded="boolean"==typeof d?d:f<this.defaultExpandLevel,O.hasMatchedDescendants=!1,O.hasDisabledDescendants=!1,O.isExpandedOnSearch=!1,O.showAllChildrenOnSearch=!1,O.count=me(me(me(me({},P,0),$,0),H,0),W,0),O.children=N?this.normalize(O,c,r):[],!0===d){var w,_=ye(O.ancestors);try{for(_.s();!(w=_.n()).done;){w.value.isExpanded=!0}}catch(e){_.e(e)}finally{_.f()}}N||"function"==typeof this.loadOptions?!N&&O.isExpanded&&this.loadChildrenOptions(O):l(function(){return!1},function(){return'Unloaded branch node detected. "loadOptions" prop is required to load its children.'})}var V,M=ye(O.ancestors);try{for(M.s();!(V=M.n()).done;){V.value.count[$]++}}catch(e){M.e(e)}finally{M.f()}if(v){var C,x=ye(O.ancestors);try{for(x.s();!(C=x.n()).done;){C.value.count[W]++}}catch(e){x.e(e)}finally{x.f()}}if(h||(n.count[P]+=1,v&&(n.count[H]+=1),m&&(n.hasDisabledDescendants=!0)),r&&r[a]){var I=r[a];O.isMatched=I.isMatched,O.showAllChildrenOnSearch=I.showAllChildrenOnSearch,O.isHighlighted=I.isHighlighted,I.isBranch&&O.isBranch&&(O.isExpanded=I.isExpanded,O.isExpandedOnSearch=I.isExpandedOnSearch,O.hasMatchedDescendants=I.hasMatchedDescendants,I.childrenStates.isLoaded&&!O.childrenStates.isLoaded?O.isExpanded=!1:O.childrenStates=ve({},I.childrenStates))}return O},normalize:function(e,t,n){var r=this,i=t.map(function(e){return[r.enhancedNormalizer(e),e]}).map(function(t,i){return r.mapToNode(t,i,e,n)});if(this.branchNodesFirst){var o=i.filter(function(e){return e.isBranch}),s=i.filter(function(e){return e.isLeaf});i=o.concat(s)}return i},loadRootOptions:function(){var e=this;this.callLoadOptionsProp({action:Q,isPending:function(){return e.rootOptionsStates.isLoading},start:function(){e.rootOptionsStates.isLoading=!0,e.rootOptionsStates.loadingError=""},succeed:function(){e.rootOptionsStates.isLoaded=!0,e.$nextTick(function(){e.resetHighlightedOptionWhenNecessary(!0)})},fail:function(t){e.rootOptionsStates.loadingError=Ne(t)},end:function(){e.rootOptionsStates.isLoading=!1}})},loadChildrenOptions:function(e){var t=this,n=e.id,r=e.raw;this.callLoadOptionsProp({action:q,args:{parentNode:r},isPending:function(){return t.getNode(n).childrenStates.isLoading},start:function(){t.getNode(n).childrenStates.isLoading=!0,t.getNode(n).childrenStates.loadingError=""},succeed:function(){t.getNode(n).childrenStates.isLoaded=!0},fail:function(e){t.getNode(n).childrenStates.loadingError=Ne(e)},end:function(){t.getNode(n).childrenStates.isLoading=!1}})},callLoadOptionsProp:function(e){var t=e.action,n=e.args,r=e.isPending,i=e.start,o=e.succeed,s=e.fail,a=e.end;if(this.loadOptions&&!r()){i();var l=w()(function(e,t){e?s(e):o(t),a()}),u=this.loadOptions(ve(ve({id:this.getInstanceId(),instanceId:this.getInstanceId(),action:t},n),{},{callback:l}));O()(u)&&u.then(function(){l()},function(e){l(e)}).catch(function(e){console.error(e)})}},checkDuplication:function(e){var t=this;l(function(){return!(e.id in t.forest.nodeMap&&!t.forest.nodeMap[e.id].isFallbackNode)},function(){return"Detected duplicate presence of node id ".concat(JSON.stringify(e.id),". ")+'Their labels are "'.concat(t.forest.nodeMap[e.id].label,'" and "').concat(e.label,'" respectively.')})},verifyNodeShape:function(e){l(function(){return!(void 0===e.children&&!0===e.isBranch)},function(){return"Are you meant to declare an unloaded branch node? `isBranch: true` is no longer supported, please use `children: null` instead."})},select:function(e){if(!this.disabled&&!e.isDisabled){this.single&&this.clear();var t=this.multiple&&!this.flat?0===this.forest.checkedStateMap[e.id]:!this.isSelected(e);t?this._selectNode(e):this._deselectNode(e),this.buildForestState(),t?this.$emit("select",e.raw,this.getInstanceId()):this.$emit("deselect",e.raw,this.getInstanceId()),this.localSearch.active&&t&&(this.single||this.clearOnSelect)&&this.resetSearchQuery(),this.single&&this.closeOnSelect&&(this.closeMenu(),this.searchable&&(this._blurOnSelect=!0))}},clear:function(){var e=this;this.hasValue&&(this.single||this.allowClearingDisabled?this.forest.selectedNodeIds=[]:this.forest.selectedNodeIds=this.forest.selectedNodeIds.filter(function(t){return e.getNode(t).isDisabled}),this.buildForestState())},_selectNode:function(e){var t=this;if(this.single||this.disableBranchNodes)return this.addValue(e);if(this.flat)return this.addValue(e),void(this.autoSelectAncestors?e.ancestors.forEach(function(e){t.isSelected(e)||e.isDisabled||t.addValue(e)}):this.autoSelectDescendants&&this.traverseDescendantsBFS(e,function(e){t.isSelected(e)||e.isDisabled||t.addValue(e)}));var n=e.isLeaf||!e.hasDisabledDescendants||this.allowSelectingDisabledDescendants;if(n&&this.addValue(e),e.isBranch&&(this.traverseDescendantsBFS(e,function(e){if(!e.isDisabled||t.allowSelectingDisabledDescendants){if(t.localSearch.active&&!t.shouldOptionBeIncludedInSearchResult(e))return;t.addValue(e)}}),this.localSearch.active&&n&&!e.children.every(this.isSelected)&&this.removeValue(e)),n&&this.isSelected(e))for(var r=e;(r=r.parentNode)!==F&&r.children.every(this.isSelected);)this.addValue(r)},_deselectNode:function(e){var t=this;if(this.disableBranchNodes)return this.removeValue(e);if(this.flat)return this.removeValue(e),void(this.autoDeselectAncestors?e.ancestors.forEach(function(e){t.isSelected(e)&&!e.isDisabled&&t.removeValue(e)}):this.autoDeselectDescendants&&this.traverseDescendantsBFS(e,function(e){t.isSelected(e)&&!e.isDisabled&&t.removeValue(e)}));var n=!1;if(e.isBranch&&this.traverseDescendantsDFS(e,function(e){e.isDisabled&&!t.allowSelectingDisabledDescendants||(t.removeValue(e),n=!0)}),e.isLeaf||n||0===e.children.length){this.removeValue(e);for(var r=e;(r=r.parentNode)!==F&&this.isSelected(r);)this.removeValue(r)}},addValue:function(e){this.forest.selectedNodeIds.push(e.id),this.forest.selectedNodeMap[e.id]=!0},removeValue:function(e){var t,n,r;t=this.forest.selectedNodeIds,n=e.id,-1!==(r=t.indexOf(n))&&t.splice(r,1),delete this.forest.selectedNodeMap[e.id]},removeLastValue:function(){if(this.hasValue){if(this.single)return this.clear();var e=T()(this.internalValue),t=this.getNode(e);this.select(t)}},saveMenuScrollPosition:function(){var e=this.getMenu();e&&(this.menu.lastScrollPosition=e.scrollTop)},restoreMenuScrollPosition:function(){var e=this.getMenu();e&&(e.scrollTop=this.menu.lastScrollPosition)}},created:function(){this.verifyProps(),this.resetFlags()},mounted:function(){this.autoFocus&&this.focusInput(),!this.options&&this.autoLoadRootOptions&&this.loadRootOptions(),this.alwaysOpen&&this.openMenu()},unmounted:function(){this.toggleClickOutsideEvent(!1)}};function Ve(e){return"string"==typeof e?e:null==e||b(e)?"":JSON.stringify(e)}var Me=(0,i.defineComponent)({name:"vue3-treeselect--hidden-fields",setup:function(){var e=(0,i.inject)("instance");return function(){if(!e.name||e.disabled||!e.hasValue)return null;var t=e.internalValue.map(Ve);return e.multiple&&e.joinValues&&(t=[t.join(e.delimiter)]),t.map(function(t,n){return(0,i.createVNode)("input",{type:"hidden",name:e.name,value:t,key:"hidden-field-"+n},null)})}}}),Ce=[ne,ie,oe,se,ae,le,ue];var Le={name:"vue3-treeselect--input",inject:["instance"],data:function(){return{inputWidth:5,value:""}},computed:{needAutoSize:function(){var e=this.instance;return e.searchable&&!e.disabled&&e.multiple},inputStyle:function(){return{width:this.needAutoSize?"".concat(this.inputWidth,"px"):null}}},watch:{"instance.trigger.searchQuery":function(e){this.value=e},value:function(){this.needAutoSize&&this.$nextTick(this.updateInputWidth)}},created:function(){this.debouncedCallback=d()(this.updateSearchQuery,200,{leading:!0,trailing:!0})},methods:{clear:function(){this.onInput({target:{value:""}})},focus:function(){this.instance.disabled||this.$refs.input&&this.$refs.input.focus()},blur:function(){this.$refs.input&&this.$refs.input.blur()},onFocus:function(){var e=this.instance;e.trigger.isFocused=!0,e.openOnFocus&&e.openMenu()},onBlur:function(){var e=this.instance,t=e.getMenu();if(t&&document.activeElement===t)return this.focus();e.trigger.isFocused=!1,e.closeMenu()},onInput:function(e){var t=e.target.value;this.value=t,t?this.debouncedCallback():(this.debouncedCallback.cancel(),this.updateSearchQuery())},onKeyDown:function(e){var t=this.instance,n="which"in e?e.which:e.keyCode;if(!(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)){if(!t.menu.isOpen&&B(Ce,n))return e.preventDefault(),t.openMenu();switch(n){case te:t.backspaceRemoves&&!this.value.length&&t.removeLastValue();break;case ne:if(e.preventDefault(),null===t.menu.current)return;var r=t.getNode(t.menu.current);if(null==r)return;if(r.isBranch&&t.disableBranchNodes||t.localSearch.active&&!t.shouldOptionBeIncludedInSearchResult(r))return;t.select(r);break;case re:this.value.length?this.clear():t.menu.isOpen&&t.closeMenu();break;case ie:e.preventDefault(),t.highlightLastOption();break;case oe:e.preventDefault(),t.highlightFirstOption();break;case se:var i=t.getNode(t.menu.current);if(null==i)return;i.isBranch&&t.shouldExpand(i)?(e.preventDefault(),t.toggleExpanded(i)):!i.isRootNode&&(i.isLeaf||i.isBranch&&!t.shouldExpand(i))&&(e.preventDefault(),t.setCurrentHighlightedOption(i.parentNode));break;case ae:e.preventDefault(),t.highlightPrevOption();break;case le:var o=t.getNode(t.menu.current);if(null==o)return;o.isBranch&&!t.shouldExpand(o)&&(e.preventDefault(),t.toggleExpanded(o));break;case ue:e.preventDefault(),t.highlightNextOption();break;case ce:t.deleteRemoves&&!this.value.length&&t.removeLastValue();break;default:t.openMenu()}}},onMouseDown:function(e){this.value.length&&e.stopPropagation()},renderInputContainer:function(){var e=this.instance,t={},n=[];return e.searchable&&!e.disabled&&(n.push(this.renderInput()),this.needAutoSize&&n.push(this.renderSizer())),e.searchable||A(t,{on:{focus:this.onFocus,blur:this.onBlur,keydown:this.onKeyDown},ref:"input"}),e.searchable||e.disabled||(t.tabIndex=e.tabIndex),(0,i.createVNode)("div",(0,i.mergeProps)({class:"vue3-treeselect__input-container"},t),[n])},renderInput:function(){var e=this.instance;return(0,i.createVNode)("input",{ref:"input",class:"vue3-treeselect__input",type:"text",autocomplete:"off",tabIndex:e.tabIndex,required:e.required&&!e.hasValue,value:this.value,style:this.inputStyle,onFocus:this.onFocus,onInput:this.onInput,onBlur:this.onBlur,onKeydown:this.onKeyDown,onMousedown:this.onMouseDown},null)},renderSizer:function(){return(0,i.createVNode)("div",{ref:"sizer",class:"vue3-treeselect__sizer"},[this.value])},updateInputWidth:function(){this.inputWidth=Math.max(5,this.$refs.sizer.scrollWidth+15)},updateSearchQuery:function(){this.instance.trigger.searchQuery=this.value}},render:function(){return this.renderInputContainer()}};var xe={name:"vue3-treeselect--placeholder",inject:["instance"],render:function(){var e=this.instance,t={"vue3-treeselect__placeholder":!0,"vue3-treeselect-helper-zoom-effect-off":!0,"vue3-treeselect__placeholder-icon":e.$slots["control-icon"],"vue3-treeselect-helper-hide":e.hasValue||e.trigger.searchQuery};return(0,i.createVNode)("div",{class:t},[e.placeholder])}};var Ie={name:"vue3-treeselect--single-value",inject:["instance"],methods:{renderSingleValueLabel:function(){var e=this.instance,t=e.selectedNodes[0],n=e.$slots["value-label"];return n?n({node:t}):t.label}},render:function(){var e=this.instance;return(0,this.$parent.renderValueContainer)([e.hasValue&&!e.trigger.searchQuery&&(0,i.createVNode)("div",{class:"vue3-treeselect__single-value"},[this.renderSingleValueLabel()]),(0,i.createVNode)(xe,null,null),(0,i.createVNode)(Le,{ref:"input"},null)])}};function Ee(e){return function(e){if(Array.isArray(e))return Ae(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ae(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ae(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var De={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 348.333 348.333"};var Te={name:"vue3-treeselect--x"},Be=n(510);var Re=(0,Be.A)(Te,[["render",function(e,t,n,r,o,s){return(0,i.openBlock)(),(0,i.createElementBlock)("svg",De,Ee(t[0]||(t[0]=[(0,i.createElementVNode)("path",{d:"M336.559 68.611L231.016 174.165l105.543 105.549c15.699 15.705 15.699 41.145 0 56.85-7.844 7.844-18.128 11.769-28.407 11.769-10.296 0-20.581-3.919-28.419-11.769L174.167 231.003 68.609 336.563c-7.843 7.844-18.128 11.769-28.416 11.769-10.285 0-20.563-3.919-28.413-11.769-15.699-15.698-15.699-41.139 0-56.85l105.54-105.549L11.774 68.611c-15.699-15.699-15.699-41.145 0-56.844 15.696-15.687 41.127-15.687 56.829 0l105.563 105.554L279.721 11.767c15.705-15.687 41.139-15.687 56.832 0 15.705 15.699 15.705 41.145.006 56.844z"},null,-1)])))}]]);var ze={name:"vue3-treeselect--multi-value-item",inject:["instance"],props:{node:{type:Object,required:!0}},methods:{handleMouseDown:u(function(){var e=this.instance,t=this.node;e.select(t)})},render:function(){var e=this.instance,t=this.node,n={"vue3-treeselect__multi-value-item":!0,"vue3-treeselect__multi-value-item-disabled":t.isDisabled,"vue3-treeselect__multi-value-item-new":t.isNew},r=e.$slots["value-label"],o=r?r({node:t}):t.label;return(0,i.createVNode)("div",{class:"vue3-treeselect__multi-value-item-container"},[(0,i.createVNode)("div",{class:n},[(0,i.createVNode)("span",{class:"vue3-treeselect__multi-value-label"},[o]),(0,i.createVNode)("span",{class:"vue3-treeselect__icon vue3-treeselect__value-remove",onMousedown:this.handleMouseDown},[(0,i.createVNode)(Re,null,null)])])])}};var ke={name:"vue3-treeselect--multi-value",inject:["instance"],methods:{renderMultiValueItems:function(){var e=this.instance;return e.internalValue.slice(0,e.limit).map(e.getNode).map(function(e){return(0,i.createVNode)(ze,{key:"multi-value-item-".concat(e.id),node:e},null)})},renderExceedLimitTip:function(){var e=this.instance,t=e.internalValue.length-e.limit;return t<=0?null:(0,i.createVNode)("div",{class:"vue3-treeselect__limit-tip vue3-treeselect-helper-zoom-effect-off",key:"exceed-limit-tip"},[(0,i.createVNode)("span",{class:"vue3-treeselect__limit-tip-text"},[e.limitText(t)])])}},render:function(){var e=this;return(0,this.$parent.renderValueContainer)((0,i.createVNode)(i.TransitionGroup,{class:"vue3-treeselect__multi-value",tag:"div",name:"vue3-treeselect__multi-value-item--transition",appear:!0},{default:function(){return[e.renderMultiValueItems(),e.renderExceedLimitTip(),(0,i.createVNode)(xe,{key:"placeholder"},null),(0,i.createVNode)(Le,{ref:"input",key:"input"},null)]}}))}};function je(e){return function(e){if(Array.isArray(e))return Fe(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Fe(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fe(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Pe={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 292.362 292.362"};var $e={name:"vue3-treeselect--arrow"};var He=(0,Be.A)($e,[["render",function(e,t,n,r,o,s){return(0,i.openBlock)(),(0,i.createElementBlock)("svg",Pe,je(t[0]||(t[0]=[(0,i.createElementVNode)("path",{d:"M286.935 69.377c-3.614-3.617-7.898-5.424-12.848-5.424H18.274c-4.952 0-9.233 1.807-12.85 5.424C1.807 72.998 0 77.279 0 82.228c0 4.948 1.807 9.229 5.424 12.847l127.907 127.907c3.621 3.617 7.902 5.428 12.85 5.428s9.233-1.811 12.847-5.428L286.935 95.074c3.613-3.617 5.427-7.898 5.427-12.847 0-4.948-1.814-9.229-5.427-12.85z"},null,-1)])))}]]);var We={name:"vue3-treeselect--control",inject:["instance"],computed:{shouldShowX:function(){var e=this.instance;return e.clearable&&!e.disabled&&e.hasValue&&(this.hasUndisabledValue||e.allowClearingDisabled)},shouldShowArrow:function(){var e=this.instance;return!e.alwaysOpen||!e.menu.isOpen},hasUndisabledValue:function(){var e=this.instance;return e.hasValue&&e.internalValue.some(function(t){return!e.getNode(t).isDisabled})}},methods:{renderX:function(){var e=this.instance,t=e.multiple?e.clearAllText:e.clearValueText;if(!this.shouldShowX)return null;var n={"vue3-treeselect__x":!0},r=e.$slots["control-x"];return(0,i.createVNode)("div",{class:"vue3-treeselect__x-container",title:t,onMousedown:this.handleMouseDownOnX},[r?r({xClass:n}):(0,i.createVNode)(Re,{class:n},null)])},renderArrow:function(){var e=this.instance,t={"vue3-treeselect__control-arrow":!0,"vue3-treeselect__control-arrow--rotated":e.menu.isOpen},n=e.$slots["control-arrow"];return n?n({showArrow:this.shouldShowArrow,menuIsOpen:e.menu.isOpen,isLoading:e.rootOptionsStates.isLoading,arrowClass:t}):this.shouldShowArrow?(0,i.createVNode)(He,{class:t},null):null},renderArrowContainer:function(){return this.shouldShowArrow?(0,i.createVNode)("div",{class:"vue3-treeselect__control-arrow-container",onMousedown:this.handleMouseDownOnArrow},[this.renderArrow()]):null},handleMouseDownOnX:u(function(e){e.stopPropagation(),e.preventDefault();var t=this.instance,n=t.beforeClearAll(),r=function(e){e&&t.clear()};O()(n)?n.then(r):setTimeout(function(){return r(n)},0)}),handleMouseDownOnArrow:u(function(e){e.preventDefault(),e.stopPropagation();var t=this.instance;t.focusInput(),t.toggleMenu()}),renderValueContainer:function(e){return(0,i.createVNode)("div",{class:"vue3-treeselect__value-container"},[e])}},render:function(){var e=this.instance,t=e.single?Ie:ke,n=e.$slots["control-icon"],r={"vue3-treeselect__control":!0,"vue3-treeselect__control--has-icon":n};return(0,i.createVNode)("div",{class:r,onMousedown:e.handleMouseDown},[(0,i.createVNode)(t,{ref:"value-container"},null),n&&(0,i.createVNode)("div",{class:"vue3-treeselect__control-icon-container"},[n()]),this.renderX(),this.renderArrowContainer()])}};var Qe,qe,Ke,Ye=(0,i.defineComponent)({name:"vue3-treeselect--tip",props:{type:{type:String,required:!0},icon:{type:String,required:!0}},setup:function(e,t){var n=t.slots;return function(){var t=n.default?n.default():[];return(0,i.createVNode)("div",{class:"vue3-treeselect__tip vue3-treeselect__".concat(e.type,"-tip")},[(0,i.createVNode)("div",{class:"vue3-treeselect__icon-container"},[(0,i.createVNode)("span",{class:"vue3-treeselect__icon-".concat(e.icon)},null)]),(0,i.createVNode)("span",{class:"vue3-treeselect__tip-text vue3-treeselect__".concat(e.type,"-tip-text")},[t])])}}});function Ue(e){return Ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ue(e)}function Xe(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Ue(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Ue(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Ue(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Je={name:"vue3-treeselect--option",inject:["instance"],props:{node:{type:Object,required:!0}},computed:{shouldExpand:function(){var e=this.instance,t=this.node;return t.isBranch&&e.shouldExpand(t)},shouldShow:function(){var e=this.instance,t=this.node;return e.shouldShowOptionInMenu(t)}},methods:{renderOption:function(){var e=this.instance,t=this.node,n={"vue3-treeselect__option":!0,"vue3-treeselect__option--disabled":t.isDisabled,"vue3-treeselect__option--selected":e.isSelected(t),"vue3-treeselect__option--highlight":t.isHighlighted,"vue3-treeselect__option--matched":e.localSearch.active&&t.isMatched,"vue3-treeselect__option--hide":!this.shouldShow};return(0,i.createVNode)("div",{class:n,onMouseenter:this.handleMouseEnterOption,"data-id":t.id},[this.renderArrow(),this.renderLabelContainer([this.renderCheckboxContainer([this.renderCheckbox()]),this.renderLabel()])])},renderSubOptionsList:function(){return this.shouldExpand?(0,i.createVNode)("div",{class:"vue3-treeselect__list"},[this.renderSubOptions(),this.renderNoChildrenTip(),this.renderLoadingChildrenTip(),this.renderLoadingChildrenErrorTip()]):null},renderArrow:function(){var e=this.instance,t=this.node;if(e.shouldFlattenOptions&&this.shouldShow)return null;if(t.isBranch){var n={"vue3-treeselect__option-arrow":!0,"vue3-treeselect__option-arrow--rotated":this.shouldExpand};return(0,i.createVNode)("div",{class:"vue3-treeselect__option-arrow-container",onMousedown:this.handleMouseDownOnArrow},[(0,i.createVNode)(i.Transition,{name:"vue3-treeselect__option-arrow--prepare",appear:!0},{default:function(){return(0,i.createVNode)(He,{class:n},null)}})])}return e.hasBranchNodes?(Qe||(Qe=(0,i.createVNode)("div",{class:"vue3-treeselect__option-arrow-placeholder"},[(0,i.createTextVNode)(" ")])),Qe):null},renderLabelContainer:function(e){r