tom-select-rails 2.2.0 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tom-select-rails/version.rb +1 -1
- data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.complete.js +77 -39
- data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.complete.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.js +77 -39
- data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.popular.js +77 -39
- data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.popular.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/cjs/utils.js +2 -2
- data/vendor/assets/javascripts/tom-select-rails/cjs/utils.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/caret_position/plugin.js +57 -8
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/caret_position/plugin.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/change_listener/plugin.js +2 -2
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/change_listener/plugin.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/checkbox_options/plugin.js +57 -8
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/checkbox_options/plugin.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/clear_button/plugin.js +57 -8
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/clear_button/plugin.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/drag_drop/plugin.js +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/dropdown_header/plugin.js +57 -8
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/dropdown_header/plugin.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/dropdown_input/plugin.js +58 -9
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/dropdown_input/plugin.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/input_autogrow/plugin.js +2 -2
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/input_autogrow/plugin.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/no_active_items/plugin.js +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/no_backspace_delete/plugin.js +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/optgroup_columns/plugin.js +57 -8
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/optgroup_columns/plugin.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/remove_button/plugin.js +58 -9
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/remove_button/plugin.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/restore_on_backspace/plugin.js +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/virtual_scroll/plugin.js +57 -8
- data/vendor/assets/javascripts/tom-select-rails/esm/plugins/virtual_scroll/plugin.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.complete.js +77 -39
- data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.complete.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.js +77 -39
- data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.popular.js +77 -39
- data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.popular.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/esm/utils.js +2 -2
- data/vendor/assets/javascripts/tom-select-rails/esm/utils.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/caret_position.js +57 -8
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/caret_position.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/change_listener.js +2 -2
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/change_listener.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/checkbox_options.js +57 -8
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/checkbox_options.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/clear_button.js +57 -8
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/clear_button.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/drag_drop.js +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/dropdown_header.js +57 -8
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/dropdown_header.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/dropdown_input.js +58 -9
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/dropdown_input.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/input_autogrow.js +2 -2
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/input_autogrow.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/no_active_items.js +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/no_backspace_delete.js +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/optgroup_columns.js +57 -8
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/optgroup_columns.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/remove_button.js +58 -9
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/remove_button.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/restore_on_backspace.js +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/virtual_scroll.js +57 -8
- data/vendor/assets/javascripts/tom-select-rails/js/plugins/virtual_scroll.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/tom-select.base.js +77 -39
- data/vendor/assets/javascripts/tom-select-rails/js/tom-select.base.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/tom-select.base.min.js +132 -133
- data/vendor/assets/javascripts/tom-select-rails/js/tom-select.base.min.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/tom-select.complete.js +77 -39
- data/vendor/assets/javascripts/tom-select-rails/js/tom-select.complete.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/tom-select.complete.min.js +157 -158
- data/vendor/assets/javascripts/tom-select-rails/js/tom-select.complete.min.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/tom-select.popular.js +77 -39
- data/vendor/assets/javascripts/tom-select-rails/js/tom-select.popular.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/js/tom-select.popular.min.js +144 -145
- data/vendor/assets/javascripts/tom-select-rails/js/tom-select.popular.min.js.map +1 -1
- data/vendor/assets/javascripts/tom-select-rails/types/getSettings.d.ts +2 -2
- data/vendor/assets/javascripts/tom-select-rails/types/tom-select.d.ts +2 -2
- data/vendor/assets/javascripts/tom-select-rails/types/types/core.d.ts +3 -0
- data/vendor/assets/javascripts/tom-select-rails/types/utils.d.ts +1 -1
- data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap4.css +1 -1
- data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap5.css +1 -1
- data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.css +1 -1
- data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.default.css +1 -1
- data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/clear_button.scss +2 -8
- data/vendor/assets/stylesheets/tom-select-rails/scss/tom-select.scss +2 -2
- metadata +1 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Tom Select v2.2.
|
2
|
+
* Tom Select v2.2.2
|
3
3
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
*/
|
5
5
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).TomSelect=e()}(this,(function(){"use strict"
|
@@ -19,38 +19,37 @@ const i=t.substring(1)
|
|
19
19
|
return d(i).forEach((function(i){let s=i.slice(0)
|
20
20
|
s[0]=t.charAt(0)+s[0],e.push(s),s=i.slice(0),s.unshift(t.charAt(0)),e.push(s)})),e},u=[[0,65535]]
|
21
21
|
let p,h
|
22
|
-
const g={"
|
23
|
-
|
22
|
+
const g={},f={"/":"⁄∕",0:"߀",a:"ⱥɐɑ",aa:"ꜳ",ae:"æǽǣ",ao:"ꜵ",au:"ꜷ",av:"ꜹꜻ",ay:"ꜽ",b:"ƀɓƃ",c:"ꜿƈȼↄ",d:"đɗɖᴅƌꮷԁɦ",e:"ɛǝᴇɇ",f:"ꝼƒ",g:"ǥɠꞡᵹꝿɢ",h:"ħⱨⱶɥ",i:"ɨı",j:"ɉȷ",k:"ƙⱪꝁꝃꝅꞣ",l:"łƚɫⱡꝉꝇꞁɭ",m:"ɱɯϻ",n:"ꞥƞɲꞑᴎлԉ",o:"øǿɔɵꝋꝍᴑ",oe:"œ",oi:"ƣ",oo:"ꝏ",ou:"ȣ",p:"ƥᵽꝑꝓꝕρ",q:"ꝗꝙɋ",r:"ɍɽꝛꞧꞃ",s:"ßȿꞩꞅʂ",t:"ŧƭʈⱦꞇ",th:"þ",tz:"ꜩ",u:"ʉ",v:"ʋꝟʌ",vy:"ꝡ",w:"ⱳ",y:"ƴɏỿ",z:"ƶȥɀⱬꝣ",hv:"ƕ"}
|
23
|
+
for(let t in f){let e=f[t]||""
|
24
|
+
for(let i=0;i<e.length;i++){let s=e.substring(i,i+1)
|
25
|
+
g[s]=t}}const v=new RegExp(Object.keys(g).join("|")+"|[̀-ͯ·ʾʼ]","gu"),m=(t,e="NFKD")=>t.normalize(e),y=t=>c(t).reduce(((t,e)=>t+O(e)),""),O=t=>(t=m(t).toLowerCase().replace(v,(t=>g[t]||"")),m(t,"NFC"))
|
26
|
+
const b=t=>{const e={},i=(t,i)=>{const s=e[t]||new Set,o=new RegExp("^"+n(s)+"$","iu")
|
24
27
|
i.match(o)||(s.add(r(i)),e[t]=s)}
|
25
|
-
for(let e of function*(t){for(const[e,i]of t)for(let t=e;t<=i;t++){let e=String.fromCharCode(t),i=
|
26
|
-
|
27
|
-
|
28
|
-
if(0==i.length)continue
|
29
|
-
let s=v(e)
|
30
|
-
v(s,"NFC")===e&&i===s||(yield{folded:i,composed:e,code_point:t})}}(t))i(e.folded,e.folded),i(e.folded,e.composed)
|
31
|
-
return e},O=t=>{const e=y(t),s={}
|
28
|
+
for(let e of function*(t){for(const[e,i]of t)for(let t=e;t<=i;t++){let e=String.fromCharCode(t),i=y(e)
|
29
|
+
i!=e.toLowerCase()&&(i.length>3||0!=i.length&&(yield{folded:i,composed:e,code_point:t}))}}(t))i(e.folded,e.folded),i(e.folded,e.composed)
|
30
|
+
return e},w=t=>{const e=b(t),s={}
|
32
31
|
let o=[]
|
33
32
|
for(let t in e){let i=e[t]
|
34
33
|
i&&(s[t]=n(i)),t.length>1&&o.push(r(t))}o.sort(((t,e)=>e.length-t.length))
|
35
34
|
const l=i(o)
|
36
|
-
return h=new RegExp("^"+l,"u"),s},
|
37
|
-
return t=t.map((t=>(p[t]&&(i+=t.length),p[t]||t))),i>=e?s(t):""})(t,e))))),
|
35
|
+
return h=new RegExp("^"+l,"u"),s},I=(t,e=1)=>(e=Math.max(e,t.length-1),i(d(t).map((t=>((t,e=1)=>{let i=0
|
36
|
+
return t=t.map((t=>(p[t]&&(i+=t.length),p[t]||t))),i>=e?s(t):""})(t,e))))),_=(t,e=!0)=>{let n=t.length>1?1:0
|
38
37
|
return i(t.map((t=>{let i=[]
|
39
38
|
const o=e?t.length():t.length()-1
|
40
|
-
for(let e=0;e<o;e++)i.push(
|
41
|
-
return s(i)})))},
|
39
|
+
for(let e=0;e<o;e++)i.push(I(t.substrs[e]||"",n))
|
40
|
+
return s(i)})))},S=(t,e)=>{for(const i of e){if(i.start!=t.start||i.end!=t.end)continue
|
42
41
|
if(i.substrs.join("")!==t.substrs.join(""))continue
|
43
42
|
let e=t.parts
|
44
43
|
const s=t=>{for(const i of e){if(i.start===t.start&&i.substr===t.substr)return!1
|
45
44
|
if(1!=t.length&&1!=i.length){if(t.start<i.start&&t.end>i.start)return!0
|
46
45
|
if(i.start<t.start&&i.end>t.start)return!0}}return!1}
|
47
46
|
if(!(i.parts.filter(s).length>0))return!0}return!1}
|
48
|
-
class
|
47
|
+
class A{constructor(){this.parts=[],this.substrs=[],this.start=0,this.end=0}add(t){t&&(this.parts.push(t),this.substrs.push(t.substr),this.start=Math.min(t.start,this.start),this.end=Math.max(t.end,this.end))}last(){return this.parts[this.parts.length-1]}length(){return this.parts.length}clone(t,e){let i=new A,s=JSON.parse(JSON.stringify(this.parts)),n=s.pop()
|
49
48
|
for(const t of s)i.add(t)
|
50
49
|
let o=e.substr.substring(0,t-n.start),r=o.length
|
51
|
-
return i.add({start:n.start,end:n.start+r,length:r,substr:o}),i}}const
|
52
|
-
void 0===p&&(p=
|
53
|
-
let i="",s=[new
|
50
|
+
return i.add({start:n.start,end:n.start+r,length:r,substr:o}),i}}const C=t=>{var e
|
51
|
+
void 0===p&&(p=w(e||u)),t=y(t)
|
52
|
+
let i="",s=[new A]
|
54
53
|
for(let e=0;e<t.length;e++){let n=t.substring(e).match(h)
|
55
54
|
const o=t.substring(e,e+1),r=n?n[0]:null
|
56
55
|
let l=[],a=new Set
|
@@ -60,32 +59,32 @@ t.add({start:e,end:e+i,length:i,substr:r}),a.add("1")}else t.add({start:e,end:e+
|
|
60
59
|
else if(r){let s=t.clone(e,i)
|
61
60
|
const n=r.length
|
62
61
|
s.add({start:e,end:e+n,length:n,substr:r}),l.push(s)}else a.add("3")}if(l.length>0){l=l.sort(((t,e)=>t.length()-e.length()))
|
63
|
-
for(let t of l)
|
64
|
-
let t=new
|
62
|
+
for(let t of l)S(t,s)||s.push(t)}else if(e>0&&1==a.size&&!a.has("3")){i+=_(s,!1)
|
63
|
+
let t=new A
|
65
64
|
const e=s[0]
|
66
|
-
e&&t.add(e.last()),s=[t]}}return i+=
|
67
|
-
return t?(t+="",null==e.regex||-1===(n=t.search(e.regex))?0:(s=e.string.length/t.length,0===n&&(s+=.5),s*i)):0},
|
65
|
+
e&&t.add(e.last()),s=[t]}}return i+=_(s,!0),i},F=(t,e)=>{if(t)return t[e]},x=(t,e)=>{if(t){for(var i,s=e.split(".");(i=s.shift())&&(t=t[i]););return t}},L=(t,e,i)=>{var s,n
|
66
|
+
return t?(t+="",null==e.regex||-1===(n=t.search(e.regex))?0:(s=e.string.length/t.length,0===n&&(s+=.5),s*i)):0},k=(t,e)=>{var i=t[e]
|
68
67
|
if("function"==typeof i)return i
|
69
|
-
i&&!Array.isArray(i)&&(t[e]=[i])},
|
70
|
-
else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)},
|
71
|
-
class
|
68
|
+
i&&!Array.isArray(i)&&(t[e]=[i])},E=(t,e)=>{if(Array.isArray(t))t.forEach(e)
|
69
|
+
else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)},P=(t,e)=>"number"==typeof t&&"number"==typeof e?t>e?1:t<e?-1:0:(t=y(t+"").toLowerCase())>(e=y(e+"").toLowerCase())?1:e>t?-1:0
|
70
|
+
class T{constructor(t,e){this.items=void 0,this.settings=void 0,this.items=t,this.settings=e||{diacritics:!0}}tokenize(t,e,i){if(!t||!t.length)return[]
|
72
71
|
const s=[],n=t.split(/\s+/)
|
73
72
|
var o
|
74
73
|
return i&&(o=new RegExp("^("+Object.keys(i).map(r).join("|")+"):(.*)$")),n.forEach((t=>{let i,n=null,l=null
|
75
|
-
o&&(i=t.match(o))&&(n=i[1],t=i[2]),t.length>0&&(l=this.settings.diacritics?
|
74
|
+
o&&(i=t.match(o))&&(n=i[1],t=i[2]),t.length>0&&(l=this.settings.diacritics?C(t)||null:r(t),l&&e&&(l="\\b"+l)),s.push({string:t,regex:l?new RegExp(l,"iu"):null,field:n})})),s}getScoreFunction(t,e){var i=this.prepareSearch(t,e)
|
76
75
|
return this._getScoreFunction(i)}_getScoreFunction(t){const e=t.tokens,i=e.length
|
77
76
|
if(!i)return function(){return 0}
|
78
77
|
const s=t.options.fields,n=t.weights,o=s.length,r=t.getAttrFn
|
79
78
|
if(!o)return function(){return 1}
|
80
79
|
const l=1===o?function(t,e){const i=s[0].field
|
81
|
-
return
|
80
|
+
return L(r(e,i),t,n[i]||1)}:function(t,e){var i=0
|
82
81
|
if(t.field){const s=r(e,t.field)
|
83
|
-
!t.regex&&s?i+=1/o:i+=
|
82
|
+
!t.regex&&s?i+=1/o:i+=L(s,t,1)}else E(n,((s,n)=>{i+=L(r(e,n),t,s)}))
|
84
83
|
return i/o}
|
85
84
|
return 1===i?function(t){return l(e[0],t)}:"and"===t.options.conjunction?function(t){var s,n=0
|
86
85
|
for(let i of e){if((s=l(i,t))<=0)return 0
|
87
86
|
n+=s}return n/i}:function(t){var s=0
|
88
|
-
return
|
87
|
+
return E(e,(e=>{s+=l(e,t)})),s/i}}getSortFunction(t,e){var i=this.prepareSearch(t,e)
|
89
88
|
return this._getSortFunction(i)}_getSortFunction(t){var e,i=[]
|
90
89
|
const s=this,n=t.options,o=!t.query&&n.sort_empty?n.sort_empty:n.sort
|
91
90
|
if("function"==typeof o)return o.bind(this)
|
@@ -95,26 +94,26 @@ if(t.query){e=!0
|
|
95
94
|
for(let t of i)if("$score"===t.field){e=!1
|
96
95
|
break}e&&i.unshift({field:"$score",direction:"desc"})}else i=i.filter((t=>"$score"!==t.field))
|
97
96
|
return i.length?function(t,e){var s,n
|
98
|
-
for(let o of i){if(n=o.field,s=("desc"===o.direction?-1:1)*
|
97
|
+
for(let o of i){if(n=o.field,s=("desc"===o.direction?-1:1)*P(r(n,t),r(n,e)))return s}return 0}:null}prepareSearch(t,e){const i={}
|
99
98
|
var s=Object.assign({},e)
|
100
|
-
if(
|
99
|
+
if(k(s,"sort"),k(s,"sort_empty"),s.fields){k(s,"fields")
|
101
100
|
const t=[]
|
102
|
-
s.fields.forEach((e=>{"string"==typeof e&&(e={field:e,weight:1}),t.push(e),i[e.field]="weight"in e?e.weight:1})),s.fields=t}return{options:s,query:t.toLowerCase().trim(),tokens:this.tokenize(t,s.respect_word_boundaries,i),total:0,items:[],weights:i,getAttrFn:s.nesting?
|
101
|
+
s.fields.forEach((e=>{"string"==typeof e&&(e={field:e,weight:1}),t.push(e),i[e.field]="weight"in e?e.weight:1})),s.fields=t}return{options:s,query:t.toLowerCase().trim(),tokens:this.tokenize(t,s.respect_word_boundaries,i),total:0,items:[],weights:i,getAttrFn:s.nesting?x:F}}search(t,e){var i,s,n=this
|
103
102
|
s=this.prepareSearch(t,e),e=s.options,t=s.query
|
104
103
|
const o=e.score||n._getScoreFunction(s)
|
105
|
-
t.length?
|
104
|
+
t.length?E(n.items,((t,n)=>{i=o(t),(!1===e.filter||i>0)&&s.items.push({score:i,id:n})})):E(n.items,((t,e)=>{s.items.push({score:1,id:e})}))
|
106
105
|
const r=n._getSortFunction(s)
|
107
|
-
return r&&s.items.sort(r),s.total=s.items.length,"number"==typeof e.limit&&(s.items=s.items.slice(0,e.limit)),s}}const
|
108
|
-
else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)}
|
106
|
+
return r&&s.items.sort(r),s.total=s.items.length,"number"==typeof e.limit&&(s.items=s.items.slice(0,e.limit)),s}}const V=(t,e)=>{if(Array.isArray(t))t.forEach(e)
|
107
|
+
else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)},$=t=>{if(t.jquery)return t[0]
|
109
108
|
if(t instanceof HTMLElement)return t
|
110
|
-
if(
|
111
|
-
return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)},
|
112
|
-
i.initEvent(e,!0,!1),t.dispatchEvent(i)},
|
113
|
-
return
|
114
|
-
t=t.parentNode}},
|
109
|
+
if(j(t)){var e=document.createElement("template")
|
110
|
+
return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)},j=t=>"string"==typeof t&&t.indexOf("<")>-1,q=(t,e)=>{var i=document.createEvent("HTMLEvents")
|
111
|
+
i.initEvent(e,!0,!1),t.dispatchEvent(i)},D=(t,e)=>{Object.assign(t.style,e)},H=(t,...e)=>{var i=R(e);(t=M(t)).map((t=>{i.map((e=>{t.classList.add(e)}))}))},N=(t,...e)=>{var i=R(e);(t=M(t)).map((t=>{i.map((e=>{t.classList.remove(e)}))}))},R=t=>{var e=[]
|
112
|
+
return V(t,(t=>{"string"==typeof t&&(t=t.trim().split(/[\11\12\14\15\40]/)),Array.isArray(t)&&(e=e.concat(t))})),e.filter(Boolean)},M=t=>(Array.isArray(t)||(t=[t]),t),z=(t,e,i)=>{if(!i||i.contains(t))for(;t&&t.matches;){if(t.matches(e))return t
|
113
|
+
t=t.parentNode}},B=(t,e=0)=>e>0?t[t.length-1]:t[0],K=(t,e)=>{if(!t)return-1
|
115
114
|
e=e||t.nodeName
|
116
115
|
for(var i=0;t=t.previousElementSibling;)t.matches(e)&&i++
|
117
|
-
return i},
|
116
|
+
return i},Q=(t,e)=>{V(e,((e,i)=>{null==e?t.removeAttribute(i):t.setAttribute(i,""+e)}))},G=(t,e)=>{t.parentNode&&t.parentNode.replaceChild(e,t)},J=(t,e)=>{if(null===e)return
|
118
117
|
if("string"==typeof e){if(!e.length)return
|
119
118
|
e=new RegExp(e,"i")}const i=t=>3===t.nodeType?(t=>{var i=t.data.match(e)
|
120
119
|
if(i&&t.data.length>0){var s=document.createElement("span")
|
@@ -122,32 +121,32 @@ s.className="highlight"
|
|
122
121
|
var n=t.splitText(i.index)
|
123
122
|
n.splitText(i[0].length)
|
124
123
|
var o=n.cloneNode(!0)
|
125
|
-
return s.appendChild(o),
|
126
|
-
i(t)},
|
127
|
-
var
|
128
|
-
const
|
124
|
+
return s.appendChild(o),G(n,s),1}return 0})(t):((t=>{1!==t.nodeType||!t.childNodes||/(script|style)/i.test(t.tagName)||"highlight"===t.className&&"SPAN"===t.tagName||Array.from(t.childNodes).forEach((t=>{i(t)}))})(t),0)
|
125
|
+
i(t)},U="undefined"!=typeof navigator&&/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey"
|
126
|
+
var W={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,shouldOpen:null,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-wrapper",controlClass:"ts-control",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:'<input type="text" autocomplete="off" size="1" />',copyClassesToDropdown:!1,placeholder:null,hidePlaceholder:null,shouldLoad:function(t){return t.length>0},render:{}}
|
127
|
+
const X=t=>null==t?null:Y(t),Y=t=>"boolean"==typeof t?t?"1":"0":t+"",Z=t=>(t+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),tt=(t,e)=>{var i
|
129
128
|
return function(s,n){var o=this
|
130
|
-
i&&(o.loading=Math.max(o.loading-1,0),clearTimeout(i)),i=setTimeout((function(){i=null,o.loadedSearches[s]=!0,t.call(o,s,n)}),e)}},
|
129
|
+
i&&(o.loading=Math.max(o.loading-1,0),clearTimeout(i)),i=setTimeout((function(){i=null,o.loadedSearches[s]=!0,t.call(o,s,n)}),e)}},et=(t,e,i)=>{var s,n=t.trigger,o={}
|
131
130
|
for(s of(t.trigger=function(){var i=arguments[0]
|
132
131
|
if(-1===e.indexOf(i))return n.apply(t,arguments)
|
133
|
-
o[i]=arguments},i.apply(t,[]),t.trigger=n,e))s in o&&n.apply(t,o[s])},
|
134
|
-
return i||(t.setAttribute("id",e),e)},
|
135
|
-
function
|
132
|
+
o[i]=arguments},i.apply(t,[]),t.trigger=n,e))s in o&&n.apply(t,o[s])},it=(t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())},st=(t,e,i,s)=>{t.addEventListener(e,i,s)},nt=(t,e)=>!!e&&(!!e[t]&&1===(e.altKey?1:0)+(e.ctrlKey?1:0)+(e.shiftKey?1:0)+(e.metaKey?1:0)),ot=(t,e)=>{const i=t.getAttribute("id")
|
133
|
+
return i||(t.setAttribute("id",e),e)},rt=t=>t.replace(/[\\"']/g,"\\$&"),lt=(t,e)=>{e&&t.append(e)}
|
134
|
+
function at(t,e){var i=Object.assign({},W,e),s=i.dataAttr,n=i.labelField,o=i.valueField,r=i.disabledField,l=i.optgroupField,a=i.optgroupLabelField,c=i.optgroupValueField,d=t.tagName.toLowerCase(),u=t.getAttribute("placeholder")||t.getAttribute("data-placeholder")
|
136
135
|
if(!u&&!i.allowEmptyOption){let e=t.querySelector('option[value=""]')
|
137
136
|
e&&(u=e.textContent)}var p,h,g,f,v,m,y={placeholder:u,options:[],optgroups:[],items:[],maxItems:null}
|
138
137
|
return"select"===d?(h=y.options,g={},f=1,v=t=>{var e=Object.assign({},t.dataset),i=s&&e[s]
|
139
|
-
return"string"==typeof i&&i.length&&(e=Object.assign(e,JSON.parse(i))),e},m=(t,e)=>{var s=
|
138
|
+
return"string"==typeof i&&i.length&&(e=Object.assign(e,JSON.parse(i))),e},m=(t,e)=>{var s=X(t.value)
|
140
139
|
if(null!=s&&(s||i.allowEmptyOption)){if(g.hasOwnProperty(s)){if(e){var a=g[s][l]
|
141
140
|
a?Array.isArray(a)?a.push(e):g[s][l]=[a,e]:g[s][l]=e}}else{var c=v(t)
|
142
|
-
c[n]=c[n]||t.textContent,c[o]=c[o]||s,c[r]=c[r]||t.disabled,c[l]=c[l]||e,c.$option=t,g[s]=c,h.push(c)}t.selected&&y.items.push(s)}},y.maxItems=t.hasAttribute("multiple")?null:1,
|
143
|
-
"optgroup"===(p=t.tagName.toLowerCase())?((s=v(e=t))[a]=s[a]||e.getAttribute("label")||"",s[c]=s[c]||f++,s[r]=s[r]||e.disabled,y.optgroups.push(s),i=s[c],
|
144
|
-
if(e)y.options=JSON.parse(e),
|
141
|
+
c[n]=c[n]||t.textContent,c[o]=c[o]||s,c[r]=c[r]||t.disabled,c[l]=c[l]||e,c.$option=t,g[s]=c,h.push(c)}t.selected&&y.items.push(s)}},y.maxItems=t.hasAttribute("multiple")?null:1,V(t.children,(t=>{var e,i,s
|
142
|
+
"optgroup"===(p=t.tagName.toLowerCase())?((s=v(e=t))[a]=s[a]||e.getAttribute("label")||"",s[c]=s[c]||f++,s[r]=s[r]||e.disabled,y.optgroups.push(s),i=s[c],V(e.children,(t=>{m(t,i)}))):"option"===p&&m(t)}))):(()=>{const e=t.getAttribute(s)
|
143
|
+
if(e)y.options=JSON.parse(e),V(y.options,(t=>{y.items.push(t[o])}))
|
145
144
|
else{var r=t.value.trim()||""
|
146
145
|
if(!i.allowEmptyOption&&!r.length)return
|
147
146
|
const e=r.split(i.delimiter)
|
148
|
-
|
149
|
-
e[n]=t,e[o]=t,y.options.push(e)})),y.items=e}})(),Object.assign({},
|
150
|
-
class
|
147
|
+
V(e,(t=>{const e={}
|
148
|
+
e[n]=t,e[o]=t,y.options.push(e)})),y.items=e}})(),Object.assign({},W,y,e)}var ct=0
|
149
|
+
class dt extends(function(t){return t.plugins={},class extends t{constructor(...t){super(...t),this.plugins={names:[],settings:{},requested:{},loaded:{}}}static define(e,i){t.plugins[e]={name:e,fn:i}}initializePlugins(t){var e,i
|
151
150
|
const s=this,n=[]
|
152
151
|
if(Array.isArray(t))t.forEach((t=>{"string"==typeof t?n.push(t):(s.plugins.settings[t.name]=t.options,n.push(t.name))}))
|
153
152
|
else if(t)for(e in t)t.hasOwnProperty(e)&&(s.plugins.settings[e]=t[e],n.push(e))
|
@@ -156,90 +155,90 @@ if(!t.plugins.hasOwnProperty(e))throw new Error('Unable to find "'+e+'" plugin')
|
|
156
155
|
s.requested[e]=!0,s.loaded[e]=n.fn.apply(i,[i.plugins.settings[e]||{}]),s.names.push(e)}require(t){var e=this,i=e.plugins
|
157
156
|
if(!e.plugins.loaded.hasOwnProperty(t)){if(i.requested[t])throw new Error('Plugin has circular dependency ("'+t+'")')
|
158
157
|
e.loadPlugin(t)}return i.loaded[t]}}}(e)){constructor(t,e){var i
|
159
|
-
super(),this.control_input=void 0,this.wrapper=void 0,this.dropdown=void 0,this.control=void 0,this.dropdown_content=void 0,this.focus_node=void 0,this.order=0,this.settings=void 0,this.input=void 0,this.tabIndex=void 0,this.is_select_tag=void 0,this.rtl=void 0,this.inputId=void 0,this._destroy=void 0,this.sifter=void 0,this.isOpen=!1,this.isDisabled=!1,this.isRequired=void 0,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.ignoreHover=!1,this.hasOptions=!1,this.currentResults=void 0,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],
|
160
|
-
var s
|
158
|
+
super(),this.control_input=void 0,this.wrapper=void 0,this.dropdown=void 0,this.control=void 0,this.dropdown_content=void 0,this.focus_node=void 0,this.order=0,this.settings=void 0,this.input=void 0,this.tabIndex=void 0,this.is_select_tag=void 0,this.rtl=void 0,this.inputId=void 0,this._destroy=void 0,this.sifter=void 0,this.isOpen=!1,this.isDisabled=!1,this.isRequired=void 0,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.ignoreHover=!1,this.hasOptions=!1,this.currentResults=void 0,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],ct++
|
159
|
+
var s=$(t)
|
161
160
|
if(s.tomselect)throw new Error("Tom Select already initialized on this element")
|
162
161
|
s.tomselect=this,i=(window.getComputedStyle&&window.getComputedStyle(s,null)).getPropertyValue("direction")
|
163
|
-
const n=
|
164
|
-
this.settings=n,this.input=s,this.tabIndex=s.tabIndex||0,this.is_select_tag="select"===s.tagName.toLowerCase(),this.rtl=/rtl/i.test(i),this.inputId=
|
162
|
+
const n=at(s,e)
|
163
|
+
this.settings=n,this.input=s,this.tabIndex=s.tabIndex||0,this.is_select_tag="select"===s.tagName.toLowerCase(),this.rtl=/rtl/i.test(i),this.inputId=ot(s,"tomselect-"+ct),this.isRequired=s.required,this.sifter=new T(this.options,{diacritics:n.diacritics}),n.mode=n.mode||(1===n.maxItems?"single":"multi"),"boolean"!=typeof n.hideSelected&&(n.hideSelected="multi"===n.mode),"boolean"!=typeof n.hidePlaceholder&&(n.hidePlaceholder="multi"!==n.mode)
|
165
164
|
var o=n.createFilter
|
166
165
|
"function"!=typeof o&&("string"==typeof o&&(o=new RegExp(o)),o instanceof RegExp?n.createFilter=t=>o.test(t):n.createFilter=t=>this.settings.duplicates||!this.options[t]),this.initializePlugins(n.plugins),this.setupCallbacks(),this.setupTemplates()
|
167
|
-
const r
|
166
|
+
const r=$("<div>"),l=$("<div>"),a=this._render("dropdown"),c=$('<div role="listbox" tabindex="-1">'),d=this.input.getAttribute("class")||"",u=n.mode
|
168
167
|
var p
|
169
|
-
if(
|
170
|
-
|
168
|
+
if(H(r,n.wrapperClass,d,u),H(l,n.controlClass),lt(r,l),H(a,n.dropdownClass,u),n.copyClassesToDropdown&&H(a,d),H(c,n.dropdownContentClass),lt(a,c),$(n.dropdownParent||r).appendChild(a),j(n.controlInput)){p=$(n.controlInput)
|
169
|
+
E(["autocorrect","autocapitalize","autocomplete"],(t=>{s.getAttribute(t)&&Q(p,{[t]:s.getAttribute(t)})})),p.tabIndex=-1,l.appendChild(p),this.focus_node=p}else n.controlInput?(p=$(n.controlInput),this.focus_node=p):(p=$("<input/>"),this.focus_node=l)
|
171
170
|
this.wrapper=r,this.dropdown=a,this.dropdown_content=c,this.control=l,this.control_input=p,this.setup()}setup(){const t=this,e=t.settings,i=t.control_input,s=t.dropdown,n=t.dropdown_content,o=t.wrapper,l=t.control,a=t.input,c=t.focus_node,d={passive:!0},u=t.inputId+"-ts-dropdown"
|
172
|
-
|
173
|
-
const p=
|
174
|
-
if(g){
|
175
|
-
const e=
|
176
|
-
|
177
|
-
|
178
|
-
i&&t.onOptionHover(e,i)}),{capture:!0}),
|
179
|
-
i&&(t.onOptionSelect(e,i),
|
180
|
-
s&&t.onItemSelect(e,s)?
|
171
|
+
Q(n,{id:u}),Q(c,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":u})
|
172
|
+
const p=ot(c,t.inputId+"-ts-control"),h="label[for='"+(t=>t.replace(/['"\\]/g,"\\$&"))(t.inputId)+"']",g=document.querySelector(h),f=t.focus.bind(t)
|
173
|
+
if(g){st(g,"click",f),Q(g,{for:p})
|
174
|
+
const e=ot(g,t.inputId+"-ts-label")
|
175
|
+
Q(c,{"aria-labelledby":e}),Q(n,{"aria-labelledby":e})}if(o.style.width=a.style.width,t.plugins.names.length){const e="plugin-"+t.plugins.names.join(" plugin-")
|
176
|
+
H([o,s],e)}(null===e.maxItems||e.maxItems>1)&&t.is_select_tag&&Q(a,{multiple:"multiple"}),e.placeholder&&Q(i,{placeholder:e.placeholder}),!e.splitOn&&e.delimiter&&(e.splitOn=new RegExp("\\s*"+r(e.delimiter)+"+\\s*")),e.load&&e.loadThrottle&&(e.load=tt(e.load,e.loadThrottle)),t.control_input.type=a.type,st(s,"mousemove",(()=>{t.ignoreHover=!1})),st(s,"mouseenter",(e=>{var i=z(e.target,"[data-selectable]",s)
|
177
|
+
i&&t.onOptionHover(e,i)}),{capture:!0}),st(s,"click",(e=>{const i=z(e.target,"[data-selectable]")
|
178
|
+
i&&(t.onOptionSelect(e,i),it(e,!0))})),st(l,"click",(e=>{var s=z(e.target,"[data-ts-item]",l)
|
179
|
+
s&&t.onItemSelect(e,s)?it(e,!0):""==i.value&&(t.onClick(),it(e,!0))})),st(c,"keydown",(e=>t.onKeyDown(e))),st(i,"keypress",(e=>t.onKeyPress(e))),st(i,"input",(e=>t.onInput(e))),st(c,"blur",(e=>t.onBlur(e))),st(c,"focus",(e=>t.onFocus(e))),st(i,"paste",(e=>t.onPaste(e)))
|
181
180
|
const v=e=>{const n=e.composedPath()[0]
|
182
181
|
if(!o.contains(n)&&!s.contains(n))return t.isFocused&&t.blur(),void t.inputState()
|
183
|
-
n==i&&t.isOpen?e.stopPropagation():
|
184
|
-
|
182
|
+
n==i&&t.isOpen?e.stopPropagation():it(e,!0)},m=()=>{t.isOpen&&t.positionDropdown()}
|
183
|
+
st(document,"mousedown",v),st(window,"scroll",m,d),st(window,"resize",m,d),this._destroy=()=>{document.removeEventListener("mousedown",v),window.removeEventListener("scroll",m),window.removeEventListener("resize",m),g&&g.removeEventListener("click",f)},this.revertSettings={innerHTML:a.innerHTML,tabIndex:a.tabIndex},a.tabIndex=-1,a.insertAdjacentElement("afterend",t.wrapper),t.sync(!1),e.items=[],delete e.optgroups,delete e.options,st(a,"invalid",(()=>{t.isValid&&(t.isValid=!1,t.isInvalid=!0,t.refreshState())})),t.updateOriginalInput(),t.refreshItems(),t.close(!1),t.inputState(),t.isSetup=!0,a.disabled?t.disable():t.enable(),t.on("change",this.onChange),H(a,"tomselected","ts-hidden-accessible"),t.trigger("initialize"),!0===e.preload&&t.preload()}setupOptions(t=[],e=[]){this.addOptions(t),E(e,(t=>{this.registerOptionGroup(t)}))}setupTemplates(){var t=this,e=t.settings.labelField,i=t.settings.optgroupLabelField,s={optgroup:t=>{let e=document.createElement("div")
|
185
184
|
return e.className="optgroup",e.appendChild(t.options),e},optgroup_header:(t,e)=>'<div class="optgroup-header">'+e(t[i])+"</div>",option:(t,i)=>"<div>"+i(t[e])+"</div>",item:(t,i)=>"<div>"+i(t[e])+"</div>",option_create:(t,e)=>'<div class="create">Add <strong>'+e(t.input)+"</strong>…</div>",no_results:()=>'<div class="no-results">No results found</div>',loading:()=>'<div class="spinner"></div>',not_loading:()=>{},dropdown:()=>"<div></div>"}
|
186
185
|
t.settings.render=Object.assign({},s,t.settings.render)}setupCallbacks(){var t,e,i={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",item_select:"onItemSelect",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"}
|
187
|
-
for(t in i)(e=this.settings[i[t]])&&this.on(t,e)}sync(t=!0){const e=this,i=t?
|
186
|
+
for(t in i)(e=this.settings[i[t]])&&this.on(t,e)}sync(t=!0){const e=this,i=t?at(e.input,{delimiter:e.settings.delimiter}):e.settings
|
188
187
|
e.setupOptions(i.options,i.optgroups),e.setValue(i.items||[],!0),e.lastQuery=null}onClick(){var t=this
|
189
188
|
if(t.activeItems.length>0)return t.clearActiveItems(),void t.focus()
|
190
|
-
t.isFocused&&t.isOpen?t.blur():t.focus()}onMouseDown(){}onChange(){
|
191
|
-
e.isInputHidden||e.isLocked?
|
189
|
+
t.isFocused&&t.isOpen?t.blur():t.focus()}onMouseDown(){}onChange(){q(this.input,"input"),q(this.input,"change")}onPaste(t){var e=this
|
190
|
+
e.isInputHidden||e.isLocked?it(t):e.settings.splitOn&&setTimeout((()=>{var t=e.inputValue()
|
192
191
|
if(t.match(e.settings.splitOn)){var i=t.trim().split(e.settings.splitOn)
|
193
|
-
|
192
|
+
E(i,(t=>{X(t)&&(this.options[t]?e.addItem(t):e.createItem(t))}))}}),0)}onKeyPress(t){var e=this
|
194
193
|
if(!e.isLocked){var i=String.fromCharCode(t.keyCode||t.which)
|
195
|
-
return e.settings.create&&"multi"===e.settings.mode&&i===e.settings.delimiter?(e.createItem(),void
|
196
|
-
if(e.ignoreHover=!0,e.isLocked)9!==t.keyCode&&
|
197
|
-
else{switch(t.keyCode){case 65:if(
|
194
|
+
return e.settings.create&&"multi"===e.settings.mode&&i===e.settings.delimiter?(e.createItem(),void it(t)):void 0}it(t)}onKeyDown(t){var e=this
|
195
|
+
if(e.ignoreHover=!0,e.isLocked)9!==t.keyCode&&it(t)
|
196
|
+
else{switch(t.keyCode){case 65:if(nt(U,t)&&""==e.control_input.value)return it(t),void e.selectAll()
|
198
197
|
break
|
199
|
-
case 27:return e.isOpen&&(
|
198
|
+
case 27:return e.isOpen&&(it(t,!0),e.close()),void e.clearActiveItems()
|
200
199
|
case 40:if(!e.isOpen&&e.hasOptions)e.open()
|
201
200
|
else if(e.activeOption){let t=e.getAdjacent(e.activeOption,1)
|
202
|
-
t&&e.setActiveOption(t)}return void
|
201
|
+
t&&e.setActiveOption(t)}return void it(t)
|
203
202
|
case 38:if(e.activeOption){let t=e.getAdjacent(e.activeOption,-1)
|
204
|
-
t&&e.setActiveOption(t)}return void
|
205
|
-
case 13:return void(e.canSelect(e.activeOption)?(e.onOptionSelect(t,e.activeOption),
|
203
|
+
t&&e.setActiveOption(t)}return void it(t)
|
204
|
+
case 13:return void(e.canSelect(e.activeOption)?(e.onOptionSelect(t,e.activeOption),it(t)):(e.settings.create&&e.createItem()||document.activeElement==e.control_input&&e.isOpen)&&it(t))
|
206
205
|
case 37:return void e.advanceSelection(-1,t)
|
207
206
|
case 39:return void e.advanceSelection(1,t)
|
208
|
-
case 9:return void(e.settings.selectOnTab&&(e.canSelect(e.activeOption)&&(e.onOptionSelect(t,e.activeOption),
|
209
|
-
case 8:case 46:return void e.deleteSelection(t)}e.isInputHidden&&!
|
207
|
+
case 9:return void(e.settings.selectOnTab&&(e.canSelect(e.activeOption)&&(e.onOptionSelect(t,e.activeOption),it(t)),e.settings.create&&e.createItem()&&it(t)))
|
208
|
+
case 8:case 46:return void e.deleteSelection(t)}e.isInputHidden&&!nt(U,t)&&it(t)}}onInput(t){var e=this
|
210
209
|
if(!e.isLocked){var i=e.inputValue()
|
211
210
|
e.lastValue!==i&&(e.lastValue=i,e.settings.shouldLoad.call(e,i)&&e.load(i),e.refreshOptions(),e.trigger("type",i))}}onOptionHover(t,e){this.ignoreHover||this.setActiveOption(e,!1)}onFocus(t){var e=this,i=e.isFocused
|
212
|
-
if(e.isDisabled)return e.blur(),void
|
211
|
+
if(e.isDisabled)return e.blur(),void it(t)
|
213
212
|
e.ignoreFocus||(e.isFocused=!0,"focus"===e.settings.preload&&e.preload(),i||e.trigger("focus"),e.activeItems.length||(e.showInput(),e.refreshOptions(!!e.settings.openOnFocus)),e.refreshState())}onBlur(t){if(!1!==document.hasFocus()){var e=this
|
214
213
|
if(e.isFocused){e.isFocused=!1,e.ignoreFocus=!1
|
215
214
|
var i=()=>{e.close(),e.setActiveItem(),e.setCaret(e.items.length),e.trigger("blur")}
|
216
215
|
e.settings.create&&e.settings.createOnBlur?e.createItem(null,i):i()}}}onOptionSelect(t,e){var i,s=this
|
217
216
|
e.parentElement&&e.parentElement.matches("[data-disabled]")||(e.classList.contains("create")?s.createItem(null,(()=>{s.settings.closeAfterSelect&&s.close()})):void 0!==(i=e.dataset.value)&&(s.lastQuery=null,s.addItem(i),s.settings.closeAfterSelect&&s.close(),!s.settings.hideSelected&&t.type&&/click/.test(t.type)&&s.setActiveOption(e)))}canSelect(t){return!!(this.isOpen&&t&&this.dropdown_content.contains(t))}onItemSelect(t,e){var i=this
|
218
|
-
return!i.isLocked&&"multi"===i.settings.mode&&(
|
217
|
+
return!i.isLocked&&"multi"===i.settings.mode&&(it(t),i.setActiveItem(e,t),!0)}canLoad(t){return!!this.settings.load&&!this.loadedSearches.hasOwnProperty(t)}load(t){const e=this
|
219
218
|
if(!e.canLoad(t))return
|
220
|
-
|
219
|
+
H(e.wrapper,e.settings.loadingClass),e.loading++
|
221
220
|
const i=e.loadCallback.bind(e)
|
222
221
|
e.settings.load.call(e,t,i)}loadCallback(t,e){const i=this
|
223
|
-
i.loading=Math.max(i.loading-1,0),i.lastQuery=null,i.clearActiveOption(),i.setupOptions(t,e),i.refreshOptions(i.isFocused&&!i.isInputHidden),i.loading||
|
222
|
+
i.loading=Math.max(i.loading-1,0),i.lastQuery=null,i.clearActiveOption(),i.setupOptions(t,e),i.refreshOptions(i.isFocused&&!i.isInputHidden),i.loading||N(i.wrapper,i.settings.loadingClass),i.trigger("load",t,e)}preload(){var t=this.wrapper.classList
|
224
223
|
t.contains("preloaded")||(t.add("preloaded"),this.load(""))}setTextboxValue(t=""){var e=this.control_input
|
225
|
-
e.value!==t&&(e.value=t
|
224
|
+
e.value!==t&&(e.value=t,q(e,"update"),this.lastValue=t)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(t,e){et(this,e?[]:["change"],(()=>{this.clear(e),this.addItems(t,e)}))}setMaxItems(t){0===t&&(t=null),this.settings.maxItems=t,this.refreshState()}setActiveItem(t,e){var i,s,n,o,r,l,a=this
|
226
225
|
if("single"!==a.settings.mode){if(!t)return a.clearActiveItems(),void(a.isFocused&&a.showInput())
|
227
|
-
if("click"===(i=e&&e.type.toLowerCase())&&
|
228
|
-
|
226
|
+
if("click"===(i=e&&e.type.toLowerCase())&&nt("shiftKey",e)&&a.activeItems.length){for(l=a.getLastActive(),(n=Array.prototype.indexOf.call(a.control.children,l))>(o=Array.prototype.indexOf.call(a.control.children,t))&&(r=n,n=o,o=r),s=n;s<=o;s++)t=a.control.children[s],-1===a.activeItems.indexOf(t)&&a.setActiveItemClass(t)
|
227
|
+
it(e)}else"click"===i&&nt(U,e)||"keydown"===i&&nt("shiftKey",e)?t.classList.contains("active")?a.removeActiveItem(t):a.setActiveItemClass(t):(a.clearActiveItems(),a.setActiveItemClass(t))
|
229
228
|
a.hideInput(),a.isFocused||a.focus()}}setActiveItemClass(t){const e=this,i=e.control.querySelector(".last-active")
|
230
|
-
i&&
|
231
|
-
this.activeItems.splice(e,1),
|
229
|
+
i&&N(i,"last-active"),H(t,"active last-active"),e.trigger("item_select",t),-1==e.activeItems.indexOf(t)&&e.activeItems.push(t)}removeActiveItem(t){var e=this.activeItems.indexOf(t)
|
230
|
+
this.activeItems.splice(e,1),N(t,"active")}clearActiveItems(){N(this.activeItems,"active"),this.activeItems=[]}setActiveOption(t,e=!0){t!==this.activeOption&&(this.clearActiveOption(),t&&(this.activeOption=t,Q(this.focus_node,{"aria-activedescendant":t.getAttribute("id")}),Q(t,{"aria-selected":"true"}),H(t,"active"),e&&this.scrollToOption(t)))}scrollToOption(t,e){if(!t)return
|
232
231
|
const i=this.dropdown_content,s=i.clientHeight,n=i.scrollTop||0,o=t.offsetHeight,r=t.getBoundingClientRect().top-i.getBoundingClientRect().top+n
|
233
232
|
r+o>s+n?this.scroll(r-s+o,e):r<n&&this.scroll(r,e)}scroll(t,e){const i=this.dropdown_content
|
234
|
-
e&&(i.style.scrollBehavior=e),i.scrollTop=t,i.style.scrollBehavior=""}clearActiveOption(){this.activeOption&&(
|
233
|
+
e&&(i.style.scrollBehavior=e),i.scrollTop=t,i.style.scrollBehavior=""}clearActiveOption(){this.activeOption&&(N(this.activeOption,"active"),Q(this.activeOption,{"aria-selected":null})),this.activeOption=null,Q(this.focus_node,{"aria-activedescendant":null})}selectAll(){const t=this
|
235
234
|
if("single"===t.settings.mode)return
|
236
235
|
const e=t.controlChildren()
|
237
|
-
e.length&&(t.hideInput(),t.close(),t.activeItems=e,
|
238
|
-
t.control.contains(t.control_input)&&(
|
236
|
+
e.length&&(t.hideInput(),t.close(),t.activeItems=e,E(e,(e=>{t.setActiveItemClass(e)})))}inputState(){var t=this
|
237
|
+
t.control.contains(t.control_input)&&(Q(t.control_input,{placeholder:t.settings.placeholder}),t.activeItems.length>0||!t.isFocused&&t.settings.hidePlaceholder&&t.items.length>0?(t.setTextboxValue(),t.isInputHidden=!0):(t.settings.hidePlaceholder&&t.items.length>0&&Q(t.control_input,{placeholder:""}),t.isInputHidden=!1),t.wrapper.classList.toggle("input-hidden",t.isInputHidden))}hideInput(){this.inputState()}showInput(){this.inputState()}inputValue(){return this.control_input.value.trim()}focus(){var t=this
|
239
238
|
t.isDisabled||(t.ignoreFocus=!0,t.control_input.offsetWidth?t.control_input.focus():t.focus_node.focus(),setTimeout((()=>{t.ignoreFocus=!1,t.onFocus()}),0))}blur(){this.focus_node.blur(),this.onBlur()}getScoreFunction(t){return this.sifter.getScoreFunction(t,this.getSearchOptions())}getSearchOptions(){var t=this.settings,e=t.sortField
|
240
239
|
return"string"==typeof t.sortField&&(e=[{field:t.sortField}]),{fields:t.searchField,conjunction:t.searchConjunction,sort:e,nesting:t.nesting}}search(t){var e,i,s=this,n=this.getSearchOptions()
|
241
240
|
if(s.settings.score&&"function"!=typeof(i=s.settings.score.call(s,t)))throw new Error('Tom Select "score" setting must be a function that returns a function')
|
242
|
-
return t!==s.lastQuery?(s.lastQuery=t,e=s.sifter.search(t,Object.assign(n,{score:i})),s.currentResults=e):e=Object.assign({},s.currentResults),s.settings.hideSelected&&(e.items=e.items.filter((t=>{let e=
|
241
|
+
return t!==s.lastQuery?(s.lastQuery=t,e=s.sifter.search(t,Object.assign(n,{score:i})),s.currentResults=e):e=Object.assign({},s.currentResults),s.settings.hideSelected&&(e.items=e.items.filter((t=>{let e=X(t.id)
|
243
242
|
return!(e&&-1!==s.items.indexOf(e))}))),e}refreshOptions(t=!0){var e,i,s,n,o,r,l,a,c,d
|
244
243
|
const u={},p=[]
|
245
244
|
var h=this,g=h.inputValue()
|
@@ -249,41 +248,41 @@ for(f&&(y=h.activeOption)&&(c=y.closest("[data-group]")),n=m.items.length,"numbe
|
|
249
248
|
if(!t)continue
|
250
249
|
let n=t.id,l=h.options[n]
|
251
250
|
if(void 0===l)continue
|
252
|
-
let a=
|
251
|
+
let a=Y(n),d=h.getOption(a,!0)
|
253
252
|
for(h.settings.hideSelected||d.classList.toggle("selected",h.items.includes(a)),o=l[h.settings.optgroupField]||"",i=0,s=(r=Array.isArray(o)?o:[o])&&r.length;i<s;i++){o=r[i],h.optgroups.hasOwnProperty(o)||(o="")
|
254
253
|
let t=u[o]
|
255
|
-
void 0===t&&(t=document.createDocumentFragment(),p.push(o)),i>0&&(d=d.cloneNode(!0),
|
256
|
-
return(i&&i.$order||0)-(s&&s.$order||0)})),l=document.createDocumentFragment(),
|
254
|
+
void 0===t&&(t=document.createDocumentFragment(),p.push(o)),i>0&&(d=d.cloneNode(!0),Q(d,{id:l.$id+"-clone-"+i,"aria-selected":null}),d.classList.add("ts-cloned"),N(d,"active"),h.activeOption&&h.activeOption.dataset.value==n&&c&&c.dataset.group===o.toString()&&(y=d)),t.appendChild(d),u[o]=t}}h.settings.lockOptgroupOrder&&p.sort(((t,e)=>{const i=h.optgroups[t],s=h.optgroups[e]
|
255
|
+
return(i&&i.$order||0)-(s&&s.$order||0)})),l=document.createDocumentFragment(),E(p,(t=>{let e=u[t]
|
257
256
|
if(!e||!e.children.length)return
|
258
257
|
let i=h.optgroups[t]
|
259
258
|
if(void 0!==i){let t=document.createDocumentFragment(),s=h.render("optgroup_header",i)
|
260
|
-
|
259
|
+
lt(t,s),lt(t,e)
|
261
260
|
let n=h.render("optgroup",{group:i,options:t})
|
262
|
-
|
263
|
-
e.replaceChild(t.firstChild,t),e.normalize()})),m.query.length&&m.tokens.length&&
|
261
|
+
lt(l,n)}else lt(l,e)})),b.innerHTML="",lt(b,l),h.settings.highlight&&(v=b.querySelectorAll("span.highlight"),Array.prototype.forEach.call(v,(function(t){var e=t.parentNode
|
262
|
+
e.replaceChild(t.firstChild,t),e.normalize()})),m.query.length&&m.tokens.length&&E(m.tokens,(t=>{J(b,t.regex)})))
|
264
263
|
var w=t=>{let e=h.render(t,{input:g})
|
265
264
|
return e&&(O=!0,b.insertBefore(e,b.firstChild)),e}
|
266
265
|
if(h.loading?w("loading"):h.settings.shouldLoad.call(h,g)?0===m.items.length&&w("no_results"):w("not_loading"),(a=h.canCreate(g))&&(d=w("option_create")),h.hasOptions=m.items.length>0||a,O){if(m.items.length>0){if(y||"single"!==h.settings.mode||null==h.items[0]||(y=h.getOption(h.items[0])),!b.contains(y)){let t=0
|
267
266
|
d&&!h.settings.addPrecedence&&(t=1),y=h.selectable()[t]}}else d&&(y=d)
|
268
267
|
t&&!h.isOpen&&(h.open(),h.scrollToOption(y,"auto")),h.setActiveOption(y)}else h.clearActiveOption(),t&&h.isOpen&&h.close(!1)}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(t,e=!1){const i=this
|
269
268
|
if(Array.isArray(t))return i.addOptions(t,e),!1
|
270
|
-
const s=
|
271
|
-
return null!==s&&!i.options.hasOwnProperty(s)&&(t.$order=t.$order||++i.order,t.$id=i.inputId+"-opt-"+t.$order,i.options[s]=t,i.lastQuery=null,e&&(i.userOptions[s]=e,i.trigger("option_add",s,t)),s)}addOptions(t,e=!1){
|
269
|
+
const s=X(t[i.settings.valueField])
|
270
|
+
return null!==s&&!i.options.hasOwnProperty(s)&&(t.$order=t.$order||++i.order,t.$id=i.inputId+"-opt-"+t.$order,i.options[s]=t,i.lastQuery=null,e&&(i.userOptions[s]=e,i.trigger("option_add",s,t)),s)}addOptions(t,e=!1){E(t,(t=>{this.addOption(t,e)}))}registerOption(t){return this.addOption(t)}registerOptionGroup(t){var e=X(t[this.settings.optgroupValueField])
|
272
271
|
return null!==e&&(t.$order=t.$order||++this.order,this.optgroups[e]=t,e)}addOptionGroup(t,e){var i
|
273
272
|
e[this.settings.optgroupValueField]=t,(i=this.registerOptionGroup(e))&&this.trigger("optgroup_add",i,e)}removeOptionGroup(t){this.optgroups.hasOwnProperty(t)&&(delete this.optgroups[t],this.clearCache(),this.trigger("optgroup_remove",t))}clearOptionGroups(){this.optgroups={},this.clearCache(),this.trigger("optgroup_clear")}updateOption(t,e){const i=this
|
274
273
|
var s,n
|
275
|
-
const o=
|
274
|
+
const o=X(t),r=X(e[i.settings.valueField])
|
276
275
|
if(null===o)return
|
277
276
|
const l=i.options[o]
|
278
277
|
if(null==l)return
|
279
278
|
if("string"!=typeof r)throw new Error("Value must be set in option data")
|
280
279
|
const a=i.getOption(o),c=i.getItem(o)
|
281
280
|
if(e.$order=e.$order||l.$order,delete i.options[o],i.uncacheValue(r),i.options[r]=e,a){if(i.dropdown_content.contains(a)){const t=i._render("option",e)
|
282
|
-
|
283
|
-
t=
|
281
|
+
G(a,t),i.activeOption===a&&i.setActiveOption(t)}a.remove()}c&&(-1!==(n=i.items.indexOf(o))&&i.items.splice(n,1,r),s=i._render("item",e),c.classList.contains("active")&&H(s,"active"),G(c,s)),i.lastQuery=null}removeOption(t,e){const i=this
|
282
|
+
t=Y(t),i.uncacheValue(t),delete i.userOptions[t],delete i.options[t],i.lastQuery=null,i.trigger("option_remove",t),i.removeItem(t,e)}clearOptions(t){const e=(t||this.clearFilter).bind(this)
|
284
283
|
this.loadedSearches={},this.userOptions={},this.clearCache()
|
285
284
|
const i={}
|
286
|
-
|
285
|
+
E(this.options,((t,s)=>{e(t,s)&&(i[s]=t)})),this.options=this.sifter.items=i,this.lastQuery=null,this.trigger("option_clear")}clearFilter(t,e){return this.items.indexOf(e)>=0}getOption(t,e=!1){const i=X(t)
|
287
286
|
if(null===i)return null
|
288
287
|
const s=this.options[i]
|
289
288
|
if(null!=s){if(s.$div)return s.$div
|
@@ -292,22 +291,22 @@ if(!t)return null
|
|
292
291
|
s="item"==i?this.controlChildren():this.dropdown_content.querySelectorAll("[data-selectable]")
|
293
292
|
for(let i=0;i<s.length;i++)if(s[i]==t)return e>0?s[i+1]:s[i-1]
|
294
293
|
return null}getItem(t){if("object"==typeof t)return t
|
295
|
-
var e=
|
296
|
-
return null!==e?this.control.querySelector(`[data-value="${
|
294
|
+
var e=X(t)
|
295
|
+
return null!==e?this.control.querySelector(`[data-value="${rt(e)}"]`):null}addItems(t,e){var i=this,s=Array.isArray(t)?t:[t]
|
297
296
|
const n=(s=s.filter((t=>-1===i.items.indexOf(t))))[s.length-1]
|
298
|
-
s.forEach((t=>{i.isPending=t!==n,i.addItem(t,e)}))}addItem(t,e){
|
299
|
-
const n=this,o=n.settings.mode,r=
|
297
|
+
s.forEach((t=>{i.isPending=t!==n,i.addItem(t,e)}))}addItem(t,e){et(this,e?[]:["change","dropdown_close"],(()=>{var i,s
|
298
|
+
const n=this,o=n.settings.mode,r=X(t)
|
300
299
|
if((!r||-1===n.items.indexOf(r)||("single"===o&&n.close(),"single"!==o&&n.settings.duplicates))&&null!==r&&n.options.hasOwnProperty(r)&&("single"===o&&n.clear(e),"multi"!==o||!n.isFull())){if(i=n._render("item",n.options[r]),n.control.contains(i)&&(i=i.cloneNode(!0)),s=n.isFull(),n.items.splice(n.caretPos,0,r),n.insertAtCaret(i),n.isSetup){if(!n.isPending&&n.settings.hideSelected){let t=n.getOption(r),e=n.getAdjacent(t,1)
|
301
300
|
e&&n.setActiveOption(e)}n.isPending||n.settings.closeAfterSelect||n.refreshOptions(n.isFocused&&"single"!==o),0!=n.settings.closeAfterSelect&&n.isFull()?n.close():n.isPending||n.positionDropdown(),n.trigger("item_add",r,i),n.isPending||n.updateOriginalInput({silent:e})}(!n.isPending||!s&&n.isFull())&&(n.inputState(),n.refreshState())}}))}removeItem(t=null,e){const i=this
|
302
301
|
if(!(t=i.getItem(t)))return
|
303
302
|
var s,n
|
304
303
|
const o=t.dataset.value
|
305
|
-
s=
|
304
|
+
s=K(t),t.remove(),t.classList.contains("active")&&(n=i.activeItems.indexOf(t),i.activeItems.splice(n,1),N(t,"active")),i.items.splice(s,1),i.lastQuery=null,!i.settings.persist&&i.userOptions.hasOwnProperty(o)&&i.removeOption(o,e),s<i.caretPos&&i.setCaret(i.caretPos-1),i.updateOriginalInput({silent:e}),i.refreshState(),i.positionDropdown(),i.trigger("item_remove",o,t)}createItem(t=null,e=(()=>{})){3===arguments.length&&(e=arguments[2]),"function"!=typeof e&&(e=()=>{})
|
306
305
|
var i,s=this,n=s.caretPos
|
307
306
|
if(t=t||s.inputValue(),!s.canCreate(t))return e(),!1
|
308
307
|
s.lock()
|
309
308
|
var o=!1,r=t=>{if(s.unlock(),!t||"object"!=typeof t)return e()
|
310
|
-
var i=
|
309
|
+
var i=X(t[s.settings.valueField])
|
311
310
|
if("string"!=typeof i)return e()
|
312
311
|
s.setTextboxValue(),s.addOption(t,!0),s.setCaret(n),s.addItem(i),e(t),o=!0}
|
313
312
|
return i="function"==typeof s.settings.create?s.settings.create.call(this,t,r):{[s.settings.labelField]:t,[s.settings.valueField]:t},o||r(i),!0}refreshItems(){var t=this
|
@@ -322,39 +321,39 @@ t.input.validity&&(t.isValid=t.input.validity.valid,t.isInvalid=!t.isValid)}isFu
|
|
322
321
|
var i,s
|
323
322
|
const n=e.input.querySelector('option[value=""]')
|
324
323
|
if(e.is_select_tag){const t=[],r=e.input.querySelectorAll("option:checked").length
|
325
|
-
function o(i,s,o){return i||(i
|
324
|
+
function o(i,s,o){return i||(i=$('<option value="'+Z(s)+'">'+Z(o)+"</option>")),i!=n&&e.input.append(i),t.push(i),(i!=n||r>0)&&(i.selected=!0),i}e.input.querySelectorAll("option:checked").forEach((t=>{t.selected=!1})),0==e.items.length&&"single"==e.settings.mode?o(n,"",""):e.items.forEach((n=>{if(i=e.options[n],s=i[e.settings.labelField]||"",t.includes(i.$option)){o(e.input.querySelector(`option[value="${rt(n)}"]:not(:checked)`),n,s)}else i.$option=o(i.$option,n,s)}))}else e.input.value=e.getValue()
|
326
325
|
e.isSetup&&(t.silent||e.trigger("change",e.getValue()))}open(){var t=this
|
327
|
-
t.isLocked||t.isOpen||"multi"===t.settings.mode&&t.isFull()||(t.isOpen=!0,
|
328
|
-
t&&(e.setTextboxValue(),"single"===e.settings.mode&&e.items.length&&e.hideInput()),e.isOpen=!1,
|
329
|
-
|
326
|
+
t.isLocked||t.isOpen||"multi"===t.settings.mode&&t.isFull()||(t.isOpen=!0,Q(t.focus_node,{"aria-expanded":"true"}),t.refreshState(),D(t.dropdown,{visibility:"hidden",display:"block"}),t.positionDropdown(),D(t.dropdown,{visibility:"visible",display:"block"}),t.focus(),t.trigger("dropdown_open",t.dropdown))}close(t=!0){var e=this,i=e.isOpen
|
327
|
+
t&&(e.setTextboxValue(),"single"===e.settings.mode&&e.items.length&&e.hideInput()),e.isOpen=!1,Q(e.focus_node,{"aria-expanded":"false"}),D(e.dropdown,{display:"none"}),e.settings.hideSelected&&e.clearActiveOption(),e.refreshState(),i&&e.trigger("dropdown_close",e.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var t=this.control,e=t.getBoundingClientRect(),i=t.offsetHeight+e.top+window.scrollY,s=e.left+window.scrollX
|
328
|
+
D(this.dropdown,{width:e.width+"px",top:i+"px",left:s+"px"})}}clear(t){var e=this
|
330
329
|
if(e.items.length){var i=e.controlChildren()
|
331
|
-
|
330
|
+
E(i,(t=>{e.removeItem(t,!0)})),e.showInput(),t||e.updateOriginalInput(),e.trigger("clear")}}insertAtCaret(t){const e=this,i=e.caretPos,s=e.control
|
332
331
|
s.insertBefore(t,s.children[i]||null),e.setCaret(i+1)}deleteSelection(t){var e,i,s,n,o,r=this
|
333
332
|
e=t&&8===t.keyCode?-1:1,i={start:(o=r.control_input).selectionStart||0,length:(o.selectionEnd||0)-(o.selectionStart||0)}
|
334
333
|
const l=[]
|
335
|
-
if(r.activeItems.length)n=
|
334
|
+
if(r.activeItems.length)n=B(r.activeItems,e),s=K(n),e>0&&s++,E(r.activeItems,(t=>l.push(t)))
|
336
335
|
else if((r.isFocused||"single"===r.settings.mode)&&r.items.length){const t=r.controlChildren()
|
337
336
|
let s
|
338
337
|
e<0&&0===i.start&&0===i.length?s=t[r.caretPos-1]:e>0&&i.start===r.inputValue().length&&(s=t[r.caretPos]),void 0!==s&&l.push(s)}if(!r.shouldDelete(l,t))return!1
|
339
|
-
for(
|
338
|
+
for(it(t,!0),void 0!==s&&r.setCaret(s);l.length;)r.removeItem(l.pop())
|
340
339
|
return r.showInput(),r.positionDropdown(),r.refreshOptions(!1),!0}shouldDelete(t,e){const i=t.map((t=>t.dataset.value))
|
341
340
|
return!(!i.length||"function"==typeof this.settings.onDelete&&!1===this.settings.onDelete(i,e))}advanceSelection(t,e){var i,s,n=this
|
342
|
-
n.rtl&&(t*=-1),n.inputValue().length||(
|
341
|
+
n.rtl&&(t*=-1),n.inputValue().length||(nt(U,e)||nt("shiftKey",e)?(s=(i=n.getLastActive(t))?i.classList.contains("active")?n.getAdjacent(i,t,"item"):i:t>0?n.control_input.nextElementSibling:n.control_input.previousElementSibling)&&(s.classList.contains("active")&&n.removeActiveItem(i),n.setActiveItemClass(s)):n.moveCaret(t))}moveCaret(t){}getLastActive(t){let e=this.control.querySelector(".last-active")
|
343
342
|
if(e)return e
|
344
343
|
var i=this.control.querySelectorAll(".active")
|
345
|
-
return i?
|
344
|
+
return i?B(i,t):void 0}setCaret(t){this.caretPos=this.items.length}controlChildren(){return Array.from(this.control.querySelectorAll("[data-ts-item]"))}lock(){this.isLocked=!0,this.refreshState()}unlock(){this.isLocked=!1,this.refreshState()}disable(){var t=this
|
346
345
|
t.input.disabled=!0,t.control_input.disabled=!0,t.focus_node.tabIndex=-1,t.isDisabled=!0,this.close(),t.lock()}enable(){var t=this
|
347
346
|
t.input.disabled=!1,t.control_input.disabled=!1,t.focus_node.tabIndex=t.tabIndex,t.isDisabled=!1,t.unlock()}destroy(){var t=this,e=t.revertSettings
|
348
|
-
t.trigger("destroy"),t.off(),t.wrapper.remove(),t.dropdown.remove(),t.input.innerHTML=e.innerHTML,t.input.tabIndex=e.tabIndex,
|
347
|
+
t.trigger("destroy"),t.off(),t.wrapper.remove(),t.dropdown.remove(),t.input.innerHTML=e.innerHTML,t.input.tabIndex=e.tabIndex,N(t.input,"tomselected","ts-hidden-accessible"),t._destroy(),delete t.input.tomselect}render(t,e){var i,s
|
349
348
|
const n=this
|
350
349
|
if("function"!=typeof this.settings.render[t])return null
|
351
|
-
if(
|
352
|
-
if(s
|
353
|
-
|
350
|
+
if(!(s=n.settings.render[t].call(this,e,Z)))return null
|
351
|
+
if(s=$(s),"option"===t||"option_create"===t?e[n.settings.disabledField]?Q(s,{"aria-disabled":"true"}):Q(s,{"data-selectable":""}):"optgroup"===t&&(i=e.group[n.settings.optgroupValueField],Q(s,{"data-group":i}),e.group[n.settings.disabledField]&&Q(s,{"data-disabled":""})),"option"===t||"item"===t){const i=Y(e[n.settings.valueField])
|
352
|
+
Q(s,{"data-value":i}),"item"===t?(H(s,n.settings.itemClass),Q(s,{"data-ts-item":""})):(H(s,n.settings.optionClass),Q(s,{role:"option",id:e.$id}),e.$div=s,n.options[i]=e)}return s}_render(t,e){const i=this.render(t,e)
|
354
353
|
if(null==i)throw"HTMLElement expected"
|
355
|
-
return i}clearCache(){
|
354
|
+
return i}clearCache(){E(this.options,(t=>{t.$div&&(t.$div.remove(),delete t.$div)}))}uncacheValue(t){const e=this.getOption(t)
|
356
355
|
e&&e.remove()}canCreate(t){return this.settings.create&&t.length>0&&this.settings.createFilter.call(this,t)}hook(t,e,i){var s=this,n=s[e]
|
357
356
|
s[e]=function(){var e,o
|
358
|
-
return"after"===t&&(e=n.apply(s,arguments)),o=i.apply(s,arguments),"instead"===t?o:("before"===t&&(e=n.apply(s,arguments)),e)}}}return
|
357
|
+
return"after"===t&&(e=n.apply(s,arguments)),o=i.apply(s,arguments),"instead"===t?o:("before"===t&&(e=n.apply(s,arguments)),e)}}}return dt}))
|
359
358
|
var tomSelect=function(t,e){return new TomSelect(t,e)}
|
360
359
|
//# sourceMappingURL=tom-select.base.min.js.map
|