UNPKG

@zanmato/vue3-treeselect

Version:

Tree select hierarchical component for Vue 3

5 lines 62.7 kB
/*! * vue3-treeselect v0.5.0 | (c) 2024 Andreas Johansson * Released under the MIT License. * https://vue3-treeselect.js.org/ */!function(){"use strict";var e={311:function(e,t){t.Z=(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={};!function(){n.r(r),n.d(r,{ASYNC_SEARCH:function(){return W},LOAD_CHILDREN_OPTIONS:function(){return H},LOAD_ROOT_OPTIONS:function(){return $},Treeselect:function(){return it},VERSION:function(){return st},default:function(){return ot},treeselectMixin:function(){return Oe}});var e=require("vue"),t=require("fuzzysearch"),i=n.n(t),o=require("lodash/noop");var s=n.n(o)();function a(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 l=require("lodash/debounce"),u=n.n(l),c=require("watch-size"),d=n.n(c);function h(e,t){var n=!0,r=d()(e,(function(){return n||t.apply(void 0,arguments)}));return n=!1,r}function f(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}(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 p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e){var t=getComputedStyle(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/(auto|scroll|overlay)/.test(n+i+r)}function m(e,t){var n=function(e){for(var t=[],n=e.parentNode;n&&"BODY"!==n.nodeName&&n.nodeType===document.ELEMENT_NODE;)v(n)&&t.push(n),n=n.parentNode;return t.push(window),t}(e);window.addEventListener("resize",t,{passive:!0});var r,i=f(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=f(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 g(e){return e!=e}var y=require("is-promise"),b=n.n(y),S=require("lodash/once"),O=n.n(S),N=require("lodash/identity"),w=n.n(N),_=require("lodash/constant"),V=n.n(_),M=function(){return Object.create(null)};function L(e){return L="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},L(e)}function x(e){return null!=e&&"object"===L(e)&&Object.getPrototypeOf(e)===Object.prototype}function C(e,t){if(x(t))for(var n=Object.keys(t),r=0,i=n.length;r<i;r++)o=e,s=n[r],x(a=t[n[r]])?(o[s]||(o[s]={}),C(o[s],a)):o[s]=a;var o,s,a;return e}var E=require("lodash/last"),I=n.n(E);function D(e,t){return e.includes(t)}function A(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)||T(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 T(e,t){if(e){if("string"==typeof e)return B(e,t);var n=Object.prototype.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)?B(e,t):void 0}}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function R(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=T(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=A(n.value,2),o=i[0];if(i[1]!==t[o])return!0}}catch(e){r.e(e)}finally{r.f()}return!1}var z=null,k="ALL_CHILDREN",j="ALL_DESCENDANTS",F="LEAF_CHILDREN",P="LEAF_DESCENDANTS",$="LOAD_ROOT_OPTIONS",H="LOAD_CHILDREN_OPTIONS",W="ASYNC_SEARCH",Q="ALL",q="BRANCH_PRIORITY",K="LEAF_PRIORITY",Y="ALL_WITH_INDETERMINATE",X="ORDER_SELECTED",U="LEVEL",Z="INDEX",J=8,G=13,ee=27,te=35,ne=36,re=37,ie=38,oe=39,se=40,ae=46;function le(e){return le="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},le(e)}function ue(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)||ve(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 ce(e){return function(e){if(Array.isArray(e))return me(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ve(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 de(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 he(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?de(Object(n),!0).forEach((function(t){fe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):de(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fe(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==le(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==le(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===le(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pe(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=ve(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 ve(e,t){if(e){if("string"==typeof e)return me(e,t);var n=Object.prototype.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)?me(e,t):void 0}}function me(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ge(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 ye(e,t,n){return e?i()(t,n):D(n,t)}function be(e){return e.message||String(e)}var Se=0,Oe={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:V()(!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(Se++,"$$")},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:V()(["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:w()},openDirection:{type:String,default:"auto",validator:function(e){return D(["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:k,validator:function(e){return D([k,j,F,P],e)}},showCountOnSearch:null,sortValueBy:{type:String,default:X,validator:function(e){return D([X,U,Z],e)}},tabIndex:{type:Number,default:0},modelValue:null,valueConsistsOf:{type:String,default:q,validator:function(e){return D([Q,q,K,Y],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:M(),checkedStateMap:M(),selectedNodeIds:this.extractCheckedNodeIdsFromValue(),selectedNodeMap:M()},rootOptionsStates:{isLoaded:!1,isLoading:!1,loadingError:""},localSearch:{active:!1,noResults:!0,countMap:M()},remoteSearch:M(),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===Q)e=this.forest.selectedNodeIds.slice();else if(this.valueConsistsOf===q)e=this.forest.selectedNodeIds.filter((function(e){var n=t.getNode(e);return!!n.isRootNode||!t.isSelected(n.parentNode)}));else if(this.valueConsistsOf===K)e=this.forest.selectedNodeIds.filter((function(e){var n=t.getNode(e);return!!n.isLeaf||0===n.children.length}));else if(this.valueConsistsOf===Y){var n,r=[];e=this.forest.selectedNodeIds.slice();var i,o=pe(this.selectedNodes);try{for(o.s();!(i=o.n()).done;){var s,a=pe(i.value.ancestors);try{for(a.s();!(s=a.n()).done;){var l=s.value;D(r,l.id)||(D(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===U?e.sort((function(e,n){return function(e,t){return e.level===t.level?ge(e,t):e.level-t.level}(t.getNode(e),t.getNode(n))})):this.sortValueBy===Z&&e.sort((function(e,n){return ge(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},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){R(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();R(e,this.internalValue)&&this.fixSelectedNodeIds(e)}},methods:{verifyProps:function(){var e=this;if(s((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||s((function(){return!1}),(function(){return'Are you meant to dynamically load options? You need to use "loadOptions" prop.'})),this.flat&&s((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];s((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=M(),this.keepDataOfSelectedNodes(t),this.forest.normalizedOptions=this.normalize(z,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 s((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:z,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===Q)n=e;else if(this.valueConsistsOf===q){var r,i=pe(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===K)for(var a=M(),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===Y)for(var d=M(),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))}R(this.forest.selectedNodeIds,n)&&(this.forest.selectedNodeIds=n),this.buildForestState()},keepDataOfSelectedNodes:function(e){var t,n=pe(this.forest.selectedNodeIds);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(e[r]){var i=he(he({},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,ce(r.children)),t(r),n.shift()}},traverseDescendantsDFS:function(e,t){if(e.isBranch){var n,r=pe(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=pe(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){!function t(n){var r,i=pe(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()}}({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:a((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){var n;t.isBranch&&(t.isExpandedOnSearch=!1,t.showAllChildrenOnSearch=!1,t.isMatched=!1,t.hasMatchedDescendants=!1,e.localSearch.countMap[t.id]=(fe(n={},k,0),fe(n,j,0),fe(n,F,0),fe(n,P,0),n))}));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 ye(!1,e,t.nestedSearchLabel)})):t.isMatched=e.matchKeys.some((function(n){return ye(!e.disableFuzzyMatching,r,t.lowerCased[n])})),t.isMatched){e.localSearch.noResults=!1;var n,o=pe(t.ancestors);try{for(o.s();!(n=o.n()).done;){var s=n.value;e.localSearch.countMap[s.id][j]++}}catch(e){o.e(e)}finally{o.f()}t.parentNode!==z&&(e.localSearch.countMap[t.parentNode.id][k]+=1,t.isLeaf&&(e.localSearch.countMap[t.parentNode.id][F]+=1))}(t.isMatched||t.isBranch&&t.isExpandedOnSearch)&&t.parentNode!==z&&(t.parentNode.isExpandedOnSearch=!0,t.parentNode.hasMatchedDescendants=!0)})),n()},handleRemoteSearch:function(){var e=this,t=this.trigger.searchQuery,n=this.getRemoteSearchEntry(),r=function(){e.initialize(),e.resetHighlightedOptionWhenNecessary(!0),e.menu.renderKey++};if((""===t||this.cacheOptions)&&n.isLoaded)return r();this.callLoadOptionsProp({action:W,args:{searchQuery:t},isPending:function(){return n.isLoading},start:function(){n.isLoading=!0,n.isLoaded=!1,n.loadingError=""},succeed:function(i){n.isLoaded=!0,n.options=i,e.trigger.searchQuery===t&&r(),r()},fail:function(e){n.loadingError=be(e)},end:function(){n.isLoading=!1}})},getRemoteSearchEntry:function(){var e=this.trigger.searchQuery,t=this.remoteSearch[e]||he(he({},{isLoaded:!1,isLoading:!1,loadingError:""}),{},{options:[]});return""===e&&Array.isArray(this.options)?(t.options=this.options,t.isLoaded=!0,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(){return this.$refs.control.$el},getMenu:function(){var e=this.appendToBody?this.$refs.portal.$refs.menu:this.$refs.menu.$refs.menu;return e&&"#comment"!==e.nodeName?e: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,r,i,o,s,a=t.getMenu(),l=a.querySelector('.vue3-treeselect__option[data-id="'.concat(e.id,'"]'));l&&(r=l,i=(n=a).getBoundingClientRect(),o=r.getBoundingClientRect(),s=r.offsetHeight/3,o.bottom+s>i.bottom?n.scrollTop=Math.min(r.offsetTop+r.clientHeight-n.offsetHeight+s,n.scrollHeight):o.top-s<i.top&&(n.scrollTop=Math.max(r.offsetTop-s,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=I()(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=M(),n=pe(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=M();if(this.multiple){this.traverseAllNodesByIndex((function(e){r[e.id]=0}));var i,o=pe(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=pe(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 he(he({},e),this.normalizer(e,this.getInstanceId()))},mapToNode:function(e,t,n,r){var i=ue(e,2),o=i[0],a=i[1];this.checkDuplication(o),this.verifyNodeShape(o);var l=o.id,u=o.label,c=o.children,d=o.isDefaultExpanded,h=n===z,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,b=this.matchKeys.reduce((function(e,t){return he(he({},e),{},fe({},t,(n=o[t],"string"==typeof n?n:"number"!=typeof n||g(n)?"":n+"").toLocaleLowerCase()));var n}),{}),S=h?b.label:n.nestedSearchLabel+" "+b.label;this.forest.nodeMap[l]=M();var O=this.forest.nodeMap[l];if(O.id=l,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=b,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=a,p){var N,w=Array.isArray(c);if(O.childrenStates=he(he({},{isLoaded:!1,isLoading:!1,loadingError:""}),{},{isLoaded:w}),O.isExpanded="boolean"==typeof d?d:f<this.defaultExpandLevel,O.hasMatchedDescendants=!1,O.hasDisabledDescendants=!1,O.isExpandedOnSearch=!1,O.showAllChildrenOnSearch=!1,O.count=(fe(N={},k,0),fe(N,j,0),fe(N,F,0),fe(N,P,0),N),O.children=w?this.normalize(O,c,r):[],!0===d){var _,V=pe(O.ancestors);try{for(V.s();!(_=V.n()).done;){_.value.isExpanded=!0}}catch(e){V.e(e)}finally{V.f()}}w||"function"==typeof this.loadOptions?!w&&O.isExpanded&&this.loadChildrenOptions(O):s((function(){return!1}),(function(){return'Unloaded branch node detected. "loadOptions" prop is required to load its children.'}))}var L,x=pe(O.ancestors);try{for(x.s();!(L=x.n()).done;){L.value.count[j]++}}catch(e){x.e(e)}finally{x.f()}if(v){var C,E=pe(O.ancestors);try{for(E.s();!(C=E.n()).done;){C.value.count[P]++}}catch(e){E.e(e)}finally{E.f()}}if(h||(n.count[k]+=1,v&&(n.count[F]+=1),m&&(n.hasDisabledDescendants=!0)),r&&r[l]){var I=r[l];O.isMatched=I.isMatched,O.showAllChildrenOnSearch=I.showAllChildrenOnSearch,O.isHighlighted=I.isHighlighted,I.isBranch&&O.isBranch&&(O.isExpanded=I.isExpanded,O.isExpandedOnSearch=I.isExpandedOnSearch,I.childrenStates.isLoaded&&!O.childrenStates.isLoaded?O.isExpanded=!1:O.childrenStates=he({},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:$,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=be(t)},end:function(){e.rootOptionsStates.isLoading=!1}})},loadChildrenOptions:function(e){var t=this,n=e.id,r=e.raw;this.callLoadOptionsProp({action:H,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=be(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=O()((function(e,t){e?s(e):o(t),a()})),u=this.loadOptions(he(he({id:this.getInstanceId(),instanceId:this.getInstanceId(),action:t},n),{},{callback:l}));b()(u)&&u.then((function(){l()}),(function(e){l(e)})).catch((function(e){console.error(e)}))}},checkDuplication:function(e){var t=this;s((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){s((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){e.isDisabled&&!t.allowSelectingDisabledDescendants||t.addValue(e)})),n)for(var r=e;(r=r.parentNode)!==z&&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)!==z&&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=I()(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 Ne(e){return"string"==typeof e?e:null==e||g(e)?"":JSON.stringify(e)}var we=(0,e.defineComponent)({name:"vue3-treeselect--hidden-fields",functional:!0,inject:["instance"],render:function(t){var n=t.instance;if(!n.name||n.disabled||!n.hasValue)return null;var r=n.internalValue.map(Ne);return n.multiple&&n.joinValues&&(r=[r.join(n.delimiter)]),r.map((function(t,r){return(0,e.createVNode)("input",{type:"hidden",name:n.name,value:t,key:"hidden-field-"+r},null)}))}}),_e=[G,te,ne,re,ie,oe,se];var Ve={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=u()(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&&D(_e,n))return e.preventDefault(),t.openMenu();switch(n){case J:t.backspaceRemoves&&!this.value.length&&t.removeLastValue();break;case G:if(e.preventDefault(),null===t.menu.current)return;var r=t.getNode(t.menu.current);if(r.isBranch&&t.disableBranchNodes||!r.isMatched)return;t.select(r);break;case ee:this.value.length?this.clear():t.menu.isOpen&&t.closeMenu();break;case te:e.preventDefault(),t.highlightLastOption();break;case ne:e.preventDefault(),t.highlightFirstOption();break;case re:var i=t.getNode(t.menu.current);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 ie:e.preventDefault(),t.highlightPrevOption();break;case oe:var o=t.getNode(t.menu.current);o.isBranch&&!t.shouldExpand(o)&&(e.preventDefault(),t.toggleExpanded(o));break;case se:e.preventDefault(),t.highlightNextOption();break;case ae:t.deleteRemoves&&!this.value.length&&t.removeLastValue();break;default:t.openMenu()}}},onMouseDown:function(e){this.value.length&&e.stopPropagation()},renderInputContainer:function(){var t=this.instance,n={},r=[];return t.searchable&&!t.disabled&&(r.push(this.renderInput()),this.needAutoSize&&r.push(this.renderSizer())),t.searchable||C(n,{on:{focus:this.onFocus,blur:this.onBlur,keydown:this.onKeyDown},ref:"input"}),t.searchable||t.disabled||C(n,{attrs:{tabIndex:t.tabIndex}}),(0,e.createVNode)("div",(0,e.mergeProps)({class:"vue3-treeselect__input-container"},n),[r])},renderInput:function(){var t=this.instance;return(0,e.createVNode)("input",{ref:"input",class:"vue3-treeselect__input",type:"text",autocomplete:"off",tabIndex:t.tabIndex,required:t.required&&!t.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,e.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 Me={name:"vue3-treeselect--placeholder",inject:["instance"],render:function(){var t=this.instance,n={"vue3-treeselect__placeholder":!0,"vue3-treeselect-helper-zoom-effect-off":!0,"vue3-treeselect__placeholder-icon":t.$slots["control-icon"],"vue3-treeselect-helper-hide":t.hasValue||t.trigger.searchQuery};return(0,e.createVNode)("div",{class:n},[t.placeholder])}};var Le={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 t=this.instance;return(0,this.$parent.renderValueContainer)([t.hasValue&&!t.trigger.searchQuery&&(0,e.createVNode)("div",{class:"vue3-treeselect__single-value"},[this.renderSingleValueLabel()]),(0,e.createVNode)(Me,null,null),(0,e.createVNode)(Ve,{ref:"input"},null)])}},xe={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 348.333 348.333"},Ce=[(0,e.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 Ee={name:"vue3-treeselect--x"},Ie=n(311);var De=(0,Ie.Z)(Ee,[["render",function(t,n,r,i,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("svg",xe,Ce)}]]);var Ae={name:"vue3-treeselect--multi-value-item",inject:["instance"],props:{node:{type:Object,required:!0}},methods:{handleMouseDown:a((function(){var e=this.instance,t=this.node;e.select(t)}))},render:function(){var t=this.instance,n=this.node,r={"vue3-treeselect__multi-value-item":!0,"vue3-treeselect__multi-value-item-disabled":n.isDisabled,"vue3-treeselect__multi-value-item-new":n.isNew},i=t.$slots["value-label"],o=i?i({node:n}):n.label;return(0,e.createVNode)("div",{class:"vue3-treeselect__multi-value-item-container"},[(0,e.createVNode)("div",{class:r},[(0,e.createVNode)("span",{class:"vue3-treeselect__multi-value-label"},[o]),(0,e.createVNode)("span",{class:"vue3-treeselect__icon vue3-treeselect__value-remove",onMousedown:this.handleMouseDown},[(0,e.createVNode)(De,null,null)])])])}};var Te={name:"vue3-treeselect--multi-value",inject:["instance"],methods:{renderMultiValueItems:function(){var t=this.instance;return t.internalValue.slice(0,t.limit).map(t.getNode).map((function(t){return(0,e.createVNode)(Ae,{key:"multi-value-item-".concat(t.id),node:t},null)}))},renderExceedLimitTip:function(){var t=this.instance,n=t.internalValue.length-t.limit;return n<=0?null:(0,e.createVNode)("div",{class:"vue3-treeselect__limit-tip vue3-treeselect-helper-zoom-effect-off",key:"exceed-limit-tip"},[(0,e.createVNode)("span",{class:"vue3-treeselect__limit-tip-text"},[t.limitText(n)])])}},render:function(){var t=this;return(0,this.$parent.renderValueContainer)((0,e.createVNode)(e.TransitionGroup,{class:"vue3-treeselect__multi-value",tag:"div",name:"vue3-treeselect__multi-value-item--transition",appear:!0},{default:function(){return[t.renderMultiValueItems(),t.renderExceedLimitTip(),(0,e.createVNode)(Me,{key:"placeholder"},null),(0,e.createVNode)(Ve,{ref:"input",key:"input"},null)]}}))}},Be={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 292.362 292.362"},Re=[(0,e.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 ze={name:"vue3-treeselect--arrow"};var ke=(0,Ie.Z)(ze,[["render",function(t,n,r,i,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("svg",Be,Re)}]]);var je={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 t=this.instance,n=t.multiple?t.clearAllText:t.clearValueText;if(!this.shouldShowX)return null;var r={"vue3-treeselect__x":!0},i=t.$slots["control-x"];return(0,e.createVNode)("div",{class:"vue3-treeselect__x-container",title:n,onMousedown:this.handleMouseDownOnX},[i?i({xClass:r}):(0,e.createVNode)(De,{class:r},null)])},renderArrow:function(){var t=this.instance,n={"vue3-treeselect__control-arrow":!0,"vue3-treeselect__control-arrow--rotated":t.menu.isOpen},r=t.$slots["control-arrow"];return r?r({showArrow:this.shouldShowArrow,menuIsOpen:t.menu.isOpen,isLoading:t.rootOptionsStates.isLoading,arrowClass:n}):this.shouldShowArrow?(0,e.createVNode)(ke,{class:n},null):null},renderArrowContainer:function(){return(0,e.createVNode)("div",{class:"vue3-treeselect__control-arrow-container",onMousedown:this.handleMouseDownOnArrow},[this.renderArrow()])},handleMouseDownOnX:a((function(e){e.stopPropagation(),e.preventDefault();var t=this.instance,n=t.beforeClearAll(),r=function(e){e&&t.clear()};b()(n)?n.then(r):setTimeout((function(){return r(n)}),0)})),handleMouseDownOnArrow:a((function(e){e.preventDefault(),e.stopPropagation();var t=this.instance;t.focusInput(),t.toggleMenu()})),renderValueContainer:function(t){return(0,e.createVNode)("div",{class:"vue3-treeselect__value-container"},[t])}},render:function(){var t=this.instance,n=t.single?Le:Te,r=t.$slots["control-icon"],i={"vue3-treeselect__control":!0,"vue3-treeselect__control--has-icon":r};return(0,e.createVNode)("div",{class:i,onMousedown:t.handleMouseDown},[(0,e.createVNode)(n,{ref:"value-container"},null),r&&(0,e.createVNode)("div",{class:"vue3-treeselect__control-icon-container"},[r()]),this.renderX(),this.renderArrowContainer()])}};var Fe,Pe,$e,He=(0,e.defineComponent)({name:"vue3-treeselect--tip",functional:!0,props:{type:{type:String,required:!0},icon:{type:String,required:!0}},render:function(){var t=this.type,n=this.icon;return(0,e.createVNode)("div",{class:"vue3-treeselect__tip vue3-treeselect__".concat(t,"-tip")},[(0,e.createVNode)("div",{class:"vue3-treeselect__icon-container"},[(0,e.createVNode)("span",{class:"vue3-treeselect__icon-".concat(n)},null)]),(0,e.createVNode)("span",{class:"vue3-treeselect__tip-text vue3-treeselect__".concat(t,"-tip-text")},[this.$slots.default()])])}});function We(e){return We="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},We(e)}function Qe(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==We(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==We(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===We(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var qe={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 t=this.instance,n=this.node,r={"vue3-treeselect__option":!0,"vue3-treeselect__option--disabled":n.isDisabled,"vue3-treeselect__option--selected":t.isSelected(n),"vue3-treeselect__option--highlight":n.isHighlighted,"vue3-treeselect__option--matched":t.localSearch.active&&n.isMatched,"vue3-treeselect__option--hide":!this.shouldShow};return(0,e.createVNode)("div",{class:r,onMouseenter:this.handleMouseEnterOption,"data-id":n.id},[this.renderArrow(),this.renderLabelContainer([this.renderCheckboxContainer([this.renderCheckbox()]),this.renderLabel()])])},renderSubOptionsList:function(){return this.shouldExpand?(0,e.createVNode)("div",{class:"vue3-treeselect__list"},[this.renderSubOptions(),this.renderNoChildrenTip(),this.renderLoadingChildrenTip(),this.renderLoadingChildrenErrorTip()]):null},renderArrow:function(){var t=this.instance,n=this.node;if(t.shouldFlattenOptions&&this.shouldShow)return null;if(n.isBranch){var r={"vue3-treeselect__option-arrow":!0,"vue3-treeselect__option-arrow--rotated":this.shouldExpand};return(0,e.createVNode)("div",{class:"vue3-treeselect__option-arrow-container",onMousedown:this.handleMouseDownOnArrow},[(0,e.createVNode)(e.Transition,{name:"vue3-treeselect__option-arrow--prepare",appear:!0},{default:function(){return[(0,e.createVNode)(ke,{class:r},null)]}})])}return t.hasBranchNodes?(Fe||(Fe=(0,e.createVNode)("div",{class:"vue3-treeselect__option-arrow-placeholder"},[(0,e.createTextVNode)(" ")])),Fe):null},renderLabelContainer:function(t){return(0,e.createVNode)("div",{class:"vue3-treeselect__label-container",onMousedown:this.handleMouseDownOnLabelContainer},[t])},renderCheckboxContainer:function(t){var n=this.instance,r=this.node;return n.single||n.disableBranchNodes&&r.isBranch?null:(0,e.createVNode)("div",{class:"vue3-treeselect__checkbox-container"},[t])},renderCheckbox:function(){var t=this.instance,n=this.node,r=t.forest.checkedStateMap[n.id],i={"vue3-treeselect__checkbox":!0,"vue3-treeselect__checkbox--checked":2===r,"vue3-treeselect__checkbox--indeterminate":1===r,"vue3-treeselect__checkbox--unchecked":0===r,"vue3-treeselect__checkbox--disabled":n.isDisabled};return Pe||(Pe=(0,e.createVNode)("span",{class:"vue3-treeselect__check-mark"},null)),$e||($e=(0,e.createVNode)("span",{class:"vue3-treeselect__minus-mark"},null)),(0,e.createVNode)("span",{class:i},[Pe,$e])},renderLabel:function(){var t=this.instance,n=this.node,r=n.isBranch&&(t.localSearch.active?t.showCountOnSearchComputed:t.showCount),i=r?t.localSearch.active?t.localSearch.countMap[n.id][t.showCountOf]:n.count[t.showCountOf]:Number.NaN,o="vue3-treeselect__label",s="vue3-treeselect__count",a=t.$slots["option-label"];return a?a({node:n,shouldShowCount:r,count:i,labelClassName:o,countClassName:s}):(0,e.createVNode)("label",{class:o},[n.label,r&&(0,e.createVNode)("span",{class:s},[(0,e.createTextVNode)("("),i,(0,e.createTextVNode)(")")])])},renderSubOptions:function(){var t=this.node;return t.childrenStates.isLoaded?t.children.map((function(t){return(0,e.createVNode)(qe,{node:t,key:t.id},null)})):null},renderNoChildrenTip:function(){var t=this.instance,n=this.node;return!n.childrenStates.isLoaded||n.children.length?null:(0,e.createVNode)(He,{type:"no-children",icon:"warning"},{default:function(){return[t.noChildrenText]}})},renderLoadingChildrenTip:function(){var t=this.instance;return this.node.childrenStates.isLoading?(0,e.createVNode)(He,{type:"loading",icon:"loader"},{default:function(){return[t.loadingText]}}):null},renderLoadingChildrenErrorTip:function(){var t=this,n=this.instance,r=this.node;return r.childrenStates.loadingError?(0,e.createVNode)(He,{type:"error"