tom-select-rails 2.2.1 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tom-select-rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.complete.js +691 -859
  4. data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.complete.js.map +1 -1
  5. data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.js +487 -723
  6. data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.js.map +1 -1
  7. data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.popular.js +512 -743
  8. data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.popular.js.map +1 -1
  9. data/vendor/assets/javascripts/tom-select-rails/cjs/utils.js +32 -28
  10. data/vendor/assets/javascripts/tom-select-rails/cjs/utils.js.map +1 -1
  11. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/caret_position/plugin.js +67 -23
  12. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/caret_position/plugin.js.map +1 -1
  13. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/change_listener/plugin.js +4 -3
  14. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/change_listener/plugin.js.map +1 -1
  15. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/checkbox_options/plugin.js +103 -41
  16. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/checkbox_options/plugin.js.map +1 -1
  17. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/clear_button/plugin.js +59 -20
  18. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/clear_button/plugin.js.map +1 -1
  19. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/drag_drop/plugin.js +249 -29
  20. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/drag_drop/plugin.js.map +1 -1
  21. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/dropdown_header/plugin.js +59 -18
  22. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/dropdown_header/plugin.js.map +1 -1
  23. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/dropdown_input/plugin.js +72 -32
  24. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/dropdown_input/plugin.js.map +1 -1
  25. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/input_autogrow/plugin.js +5 -7
  26. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/input_autogrow/plugin.js.map +1 -1
  27. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/no_active_items/plugin.js +2 -1
  28. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/no_active_items/plugin.js.map +1 -1
  29. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/no_backspace_delete/plugin.js +2 -2
  30. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/no_backspace_delete/plugin.js.map +1 -1
  31. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/optgroup_columns/plugin.js +59 -22
  32. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/optgroup_columns/plugin.js.map +1 -1
  33. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/remove_button/plugin.js +68 -23
  34. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/remove_button/plugin.js.map +1 -1
  35. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/restore_on_backspace/plugin.js +2 -3
  36. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/restore_on_backspace/plugin.js.map +1 -1
  37. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/virtual_scroll/plugin.js +97 -57
  38. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/virtual_scroll/plugin.js.map +1 -1
  39. data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.complete.js +691 -859
  40. data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.complete.js.map +1 -1
  41. data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.js +487 -723
  42. data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.js.map +1 -1
  43. data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.popular.js +512 -743
  44. data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.popular.js.map +1 -1
  45. data/vendor/assets/javascripts/tom-select-rails/esm/utils.js +32 -27
  46. data/vendor/assets/javascripts/tom-select-rails/esm/utils.js.map +1 -1
  47. data/vendor/assets/javascripts/tom-select-rails/js/plugins/caret_position.js +67 -23
  48. data/vendor/assets/javascripts/tom-select-rails/js/plugins/caret_position.js.map +1 -1
  49. data/vendor/assets/javascripts/tom-select-rails/js/plugins/change_listener.js +4 -3
  50. data/vendor/assets/javascripts/tom-select-rails/js/plugins/change_listener.js.map +1 -1
  51. data/vendor/assets/javascripts/tom-select-rails/js/plugins/checkbox_options.js +103 -41
  52. data/vendor/assets/javascripts/tom-select-rails/js/plugins/checkbox_options.js.map +1 -1
  53. data/vendor/assets/javascripts/tom-select-rails/js/plugins/clear_button.js +59 -20
  54. data/vendor/assets/javascripts/tom-select-rails/js/plugins/clear_button.js.map +1 -1
  55. data/vendor/assets/javascripts/tom-select-rails/js/plugins/drag_drop.js +249 -29
  56. data/vendor/assets/javascripts/tom-select-rails/js/plugins/drag_drop.js.map +1 -1
  57. data/vendor/assets/javascripts/tom-select-rails/js/plugins/dropdown_header.js +59 -18
  58. data/vendor/assets/javascripts/tom-select-rails/js/plugins/dropdown_header.js.map +1 -1
  59. data/vendor/assets/javascripts/tom-select-rails/js/plugins/dropdown_input.js +72 -32
  60. data/vendor/assets/javascripts/tom-select-rails/js/plugins/dropdown_input.js.map +1 -1
  61. data/vendor/assets/javascripts/tom-select-rails/js/plugins/input_autogrow.js +5 -7
  62. data/vendor/assets/javascripts/tom-select-rails/js/plugins/input_autogrow.js.map +1 -1
  63. data/vendor/assets/javascripts/tom-select-rails/js/plugins/no_active_items.js +2 -1
  64. data/vendor/assets/javascripts/tom-select-rails/js/plugins/no_active_items.js.map +1 -1
  65. data/vendor/assets/javascripts/tom-select-rails/js/plugins/no_backspace_delete.js +2 -2
  66. data/vendor/assets/javascripts/tom-select-rails/js/plugins/no_backspace_delete.js.map +1 -1
  67. data/vendor/assets/javascripts/tom-select-rails/js/plugins/optgroup_columns.js +59 -22
  68. data/vendor/assets/javascripts/tom-select-rails/js/plugins/optgroup_columns.js.map +1 -1
  69. data/vendor/assets/javascripts/tom-select-rails/js/plugins/remove_button.js +68 -23
  70. data/vendor/assets/javascripts/tom-select-rails/js/plugins/remove_button.js.map +1 -1
  71. data/vendor/assets/javascripts/tom-select-rails/js/plugins/restore_on_backspace.js +2 -3
  72. data/vendor/assets/javascripts/tom-select-rails/js/plugins/restore_on_backspace.js.map +1 -1
  73. data/vendor/assets/javascripts/tom-select-rails/js/plugins/virtual_scroll.js +97 -57
  74. data/vendor/assets/javascripts/tom-select-rails/js/plugins/virtual_scroll.js.map +1 -1
  75. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.base.js +487 -723
  76. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.base.js.map +1 -1
  77. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.base.min.js +168 -160
  78. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.base.min.js.map +1 -1
  79. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.complete.js +691 -859
  80. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.complete.js.map +1 -1
  81. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.complete.min.js +208 -190
  82. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.complete.min.js.map +1 -1
  83. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.popular.js +512 -743
  84. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.popular.js.map +1 -1
  85. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.popular.min.js +180 -172
  86. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.popular.min.js.map +1 -1
  87. data/vendor/assets/javascripts/tom-select-rails/types/contrib/microevent.d.ts +1 -1
  88. data/vendor/assets/javascripts/tom-select-rails/types/contrib/microplugin.d.ts +4 -4
  89. data/vendor/assets/javascripts/tom-select-rails/types/defaults.d.ts +1 -0
  90. data/vendor/assets/javascripts/tom-select-rails/types/getSettings.d.ts +2 -2
  91. data/vendor/assets/javascripts/tom-select-rails/types/plugins/checkbox_options/plugin.d.ts +3 -2
  92. data/vendor/assets/javascripts/tom-select-rails/types/plugins/checkbox_options/types.d.ts +14 -0
  93. data/vendor/assets/javascripts/tom-select-rails/types/plugins/clear_button/types.d.ts +1 -1
  94. data/vendor/assets/javascripts/tom-select-rails/types/plugins/dropdown_header/types.d.ts +1 -1
  95. data/vendor/assets/javascripts/tom-select-rails/types/plugins/remove_button/types.d.ts +1 -1
  96. data/vendor/assets/javascripts/tom-select-rails/types/plugins/restore_on_backspace/plugin.d.ts +1 -1
  97. data/vendor/assets/javascripts/tom-select-rails/types/tom-select.d.ts +12 -14
  98. data/vendor/assets/javascripts/tom-select-rails/types/types/core.d.ts +16 -12
  99. data/vendor/assets/javascripts/tom-select-rails/types/types/settings.d.ts +3 -2
  100. data/vendor/assets/javascripts/tom-select-rails/types/utils.d.ts +8 -1
  101. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap4.css +224 -216
  102. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap4.css.map +1 -1
  103. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap4.min.css +1 -1
  104. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap4.min.css.map +1 -1
  105. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap5.css +245 -252
  106. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap5.css.map +1 -1
  107. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap5.min.css +1 -1
  108. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap5.min.css.map +1 -1
  109. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.css +213 -210
  110. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.css.map +1 -1
  111. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.default.css +223 -215
  112. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.default.css.map +1 -1
  113. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.default.min.css +1 -1
  114. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.default.min.css.map +1 -1
  115. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.min.css +1 -1
  116. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.min.css.map +1 -1
  117. data/vendor/assets/stylesheets/tom-select-rails/scss/_dropdown.scss +7 -10
  118. data/vendor/assets/stylesheets/tom-select-rails/scss/_items.scss +2 -5
  119. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/checkbox_options.scss +8 -2
  120. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/clear_button.scss +16 -14
  121. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/drag_drop.scss +6 -12
  122. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/dropdown_header.scss +3 -2
  123. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/dropdown_input.scss +7 -11
  124. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/input_autogrow.scss +0 -3
  125. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/optgroup_columns.scss +7 -5
  126. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/remove_button.scss +20 -20
  127. data/vendor/assets/stylesheets/tom-select-rails/scss/tom-select.bootstrap4.scss +33 -39
  128. data/vendor/assets/stylesheets/tom-select-rails/scss/tom-select.bootstrap5.scss +54 -80
  129. data/vendor/assets/stylesheets/tom-select-rails/scss/tom-select.default.scss +16 -14
  130. data/vendor/assets/stylesheets/tom-select-rails/scss/tom-select.scss +52 -57
  131. metadata +8 -7
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["../../../../node_modules/@orchidjs/unicode-variants/dist/esm/index.js","../../../../src/vanilla.ts","../../../../src/plugins/clear_button/plugin.ts"],"sourcesContent":["/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */\nimport { toArray, setToPattern, escape_regex, arrayToPattern, sequencePattern } from './regex.js';\nexport { escape_regex } from './regex.js';\nimport { allSubstrings } from './strings.js';\n\n/**\n * @typedef {{[key:string]:string}} TUnicodeMap\n * @typedef {{[key:string]:Set<string>}} TUnicodeSets\n * @typedef {[[number,number]]} TCodePoints\n * @typedef {{folded:string,composed:string,code_point:number}} TCodePointObj\n * @typedef {{start:number,end:number,length:number,substr:string}} TSequencePart\n */\n/** @type {TCodePoints} */\n\nconst code_points = [[0, 65535]];\nconst accent_pat = '[\\u0300-\\u036F\\u{b7}\\u{2be}]'; // \\u{2bc}\n\n/** @type {TUnicodeMap} */\n\nlet unicode_map;\n/** @type {RegExp} */\n\nlet multi_char_reg;\nconst max_char_length = 3;\n/** @type {TUnicodeMap} */\n\nconst latin_convert = {\n 'æ': 'ae',\n 'ⱥ': 'a',\n 'ø': 'o',\n '⁄': '/',\n '∕': '/'\n};\nconst convert_pat = new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');\n/**\n * Initialize the unicode_map from the give code point ranges\n *\n * @param {TCodePoints=} _code_points\n */\n\nconst initialize = _code_points => {\n if (unicode_map !== undefined) return;\n unicode_map = generateMap(_code_points || code_points);\n};\n/**\n * Helper method for normalize a string\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize\n * @param {string} str\n * @param {string} form\n */\n\nconst normalize = (str, form = 'NFKD') => str.normalize(form);\n/**\n * Compatibility Decomposition without reordering string\n * calling str.normalize('NFKD') on \\u{594}\\u{595}\\u{596} becomes \\u{596}\\u{594}\\u{595}\n * @param {string} str\n */\n\nconst decompose = str => {\n if (str.match(/[\\u0f71-\\u0f81]/)) {\n return toArray(str).reduce(\n /**\n * @param {string} result\n * @param {string} char\n */\n (result, char) => {\n return result + normalize(char);\n }, '');\n }\n\n return normalize(str);\n};\n/**\n * Remove accents\n * via https://github.com/krisk/Fuse/issues/133#issuecomment-318692703\n * @param {string} str\n * @return {string}\n */\n\nconst asciifold = str => {\n return decompose(str).toLowerCase().replace(convert_pat, (\n /** @type {string} */\n char) => {\n return latin_convert[char] || '';\n });\n};\n/**\n * Generate a list of unicode variants from the list of code points\n * @param {TCodePoints} code_points\n * @yield {TCodePointObj}\n */\n\nfunction* generator(code_points) {\n for (const [code_point_min, code_point_max] of code_points) {\n for (let i = code_point_min; i <= code_point_max; i++) {\n let composed = String.fromCharCode(i);\n let folded = asciifold(composed);\n\n if (folded == composed.toLowerCase()) {\n continue;\n } // skip when folded is a string longer than 3 characters long\n // bc the resulting regex patterns will be long\n // eg:\n // folded صلى الله عليه وسلم length 18 code point 65018\n // folded جل جلاله length 8 code point 65019\n\n\n if (folded.length > max_char_length) {\n continue;\n }\n\n if (folded.length == 0) {\n continue;\n }\n\n let decomposed = normalize(composed);\n let recomposed = normalize(decomposed, 'NFC');\n\n if (recomposed === composed && folded === decomposed) {\n continue;\n }\n\n yield {\n folded: folded,\n composed: composed,\n code_point: i\n };\n }\n }\n}\n/**\n * Generate a unicode map from the list of code points\n * @param {TCodePoints} code_points\n * @return {TUnicodeSets}\n */\n\nconst generateSets = code_points => {\n /** @type {{[key:string]:Set<string>}} */\n const unicode_sets = {};\n /**\n * @param {string} folded\n * @param {string} to_add\n */\n\n const addMatching = (folded, to_add) => {\n /** @type {Set<string>} */\n const folded_set = unicode_sets[folded] || new Set();\n const patt = new RegExp('^' + setToPattern(folded_set) + '$', 'iu');\n\n if (to_add.match(patt)) {\n return;\n }\n\n folded_set.add(escape_regex(to_add));\n unicode_sets[folded] = folded_set;\n };\n\n for (let value of generator(code_points)) {\n addMatching(value.folded, value.folded);\n addMatching(value.folded, value.composed);\n }\n\n return unicode_sets;\n};\n/**\n * Generate a unicode map from the list of code points\n * ae => (?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...))\n *\n * @param {TCodePoints} code_points\n * @return {TUnicodeMap}\n */\n\nconst generateMap = code_points => {\n /** @type {TUnicodeSets} */\n const unicode_sets = generateSets(code_points);\n /** @type {TUnicodeMap} */\n\n const unicode_map = {};\n /** @type {string[]} */\n\n let multi_char = [];\n\n for (let folded in unicode_sets) {\n let set = unicode_sets[folded];\n\n if (set) {\n unicode_map[folded] = setToPattern(set);\n }\n\n if (folded.length > 1) {\n multi_char.push(escape_regex(folded));\n }\n }\n\n multi_char.sort((a, b) => b.length - a.length);\n const multi_char_patt = arrayToPattern(multi_char);\n multi_char_reg = new RegExp('^' + multi_char_patt, 'u');\n return unicode_map;\n};\n/**\n * Map each element of an array from it's folded value to all possible unicode matches\n * @param {string[]} strings\n * @param {number} min_replacement\n * @return {string}\n */\n\nconst mapSequence = (strings, min_replacement = 1) => {\n let chars_replaced = 0;\n strings = strings.map(str => {\n if (unicode_map[str]) {\n chars_replaced += str.length;\n }\n\n return unicode_map[str] || str;\n });\n\n if (chars_replaced >= min_replacement) {\n return sequencePattern(strings);\n }\n\n return '';\n};\n/**\n * Convert a short string and split it into all possible patterns\n * Keep a pattern only if min_replacement is met\n *\n * 'abc'\n * \t\t=> [['abc'],['ab','c'],['a','bc'],['a','b','c']]\n *\t\t=> ['abc-pattern','ab-c-pattern'...]\n *\n *\n * @param {string} str\n * @param {number} min_replacement\n * @return {string}\n */\n\nconst substringsToPattern = (str, min_replacement = 1) => {\n min_replacement = Math.max(min_replacement, str.length - 1);\n return arrayToPattern(allSubstrings(str).map(sub_pat => {\n return mapSequence(sub_pat, min_replacement);\n }));\n};\n/**\n * Convert an array of sequences into a pattern\n * [{start:0,end:3,length:3,substr:'iii'}...] => (?:iii...)\n *\n * @param {Sequence[]} sequences\n * @param {boolean} all\n */\n\nconst sequencesToPattern = (sequences, all = true) => {\n let min_replacement = sequences.length > 1 ? 1 : 0;\n return arrayToPattern(sequences.map(sequence => {\n let seq = [];\n const len = all ? sequence.length() : sequence.length() - 1;\n\n for (let j = 0; j < len; j++) {\n seq.push(substringsToPattern(sequence.substrs[j] || '', min_replacement));\n }\n\n return sequencePattern(seq);\n }));\n};\n/**\n * Return true if the sequence is already in the sequences\n * @param {Sequence} needle_seq\n * @param {Sequence[]} sequences\n */\n\n\nconst inSequences = (needle_seq, sequences) => {\n for (const seq of sequences) {\n if (seq.start != needle_seq.start || seq.end != needle_seq.end) {\n continue;\n }\n\n if (seq.substrs.join('') !== needle_seq.substrs.join('')) {\n continue;\n }\n\n let needle_parts = needle_seq.parts;\n /**\n * @param {TSequencePart} part\n */\n\n const filter = part => {\n for (const needle_part of needle_parts) {\n if (needle_part.start === part.start && needle_part.substr === part.substr) {\n return false;\n }\n\n if (part.length == 1 || needle_part.length == 1) {\n continue;\n } // check for overlapping parts\n // a = ['::=','==']\n // b = ['::','===']\n // a = ['r','sm']\n // b = ['rs','m']\n\n\n if (part.start < needle_part.start && part.end > needle_part.start) {\n return true;\n }\n\n if (needle_part.start < part.start && needle_part.end > part.start) {\n return true;\n }\n }\n\n return false;\n };\n\n let filtered = seq.parts.filter(filter);\n\n if (filtered.length > 0) {\n continue;\n }\n\n return true;\n }\n\n return false;\n};\n\nclass Sequence {\n constructor() {\n /** @type {TSequencePart[]} */\n this.parts = [];\n /** @type {string[]} */\n\n this.substrs = [];\n this.start = 0;\n this.end = 0;\n }\n /**\n * @param {TSequencePart|undefined} part\n */\n\n\n add(part) {\n if (part) {\n this.parts.push(part);\n this.substrs.push(part.substr);\n this.start = Math.min(part.start, this.start);\n this.end = Math.max(part.end, this.end);\n }\n }\n\n last() {\n return this.parts[this.parts.length - 1];\n }\n\n length() {\n return this.parts.length;\n }\n /**\n * @param {number} position\n * @param {TSequencePart} last_piece\n */\n\n\n clone(position, last_piece) {\n let clone = new Sequence();\n let parts = JSON.parse(JSON.stringify(this.parts));\n let last_part = parts.pop();\n\n for (const part of parts) {\n clone.add(part);\n }\n\n let last_substr = last_piece.substr.substring(0, position - last_part.start);\n let clone_last_len = last_substr.length;\n clone.add({\n start: last_part.start,\n end: last_part.start + clone_last_len,\n length: clone_last_len,\n substr: last_substr\n });\n return clone;\n }\n\n}\n/**\n * Expand a regular expression pattern to include unicode variants\n * \teg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/\n *\n * Issue:\n * ﺊﺋ [ 'ﺊ = \\\\u{fe8a}', 'ﺋ = \\\\u{fe8b}' ]\n *\tbecomes:\tئئ [ 'ي = \\\\u{64a}', 'ٔ = \\\\u{654}', 'ي = \\\\u{64a}', 'ٔ = \\\\u{654}' ]\n *\n *\tİIJ = IIJ = ⅡJ\n *\n * \t1/2/4\n *\n * @param {string} str\n * @return {string|undefined}\n */\n\n\nconst getPattern = str => {\n initialize();\n str = asciifold(str);\n let pattern = '';\n let sequences = [new Sequence()];\n\n for (let i = 0; i < str.length; i++) {\n let substr = str.substring(i);\n let match = substr.match(multi_char_reg);\n const char = str.substring(i, i + 1);\n const match_str = match ? match[0] : null; // loop through sequences\n // add either the char or multi_match\n\n let overlapping = [];\n let added_types = new Set();\n\n for (const sequence of sequences) {\n const last_piece = sequence.last();\n\n if (!last_piece || last_piece.length == 1 || last_piece.end <= i) {\n // if we have a multi match\n if (match_str) {\n const len = match_str.length;\n sequence.add({\n start: i,\n end: i + len,\n length: len,\n substr: match_str\n });\n added_types.add('1');\n } else {\n sequence.add({\n start: i,\n end: i + 1,\n length: 1,\n substr: char\n });\n added_types.add('2');\n }\n } else if (match_str) {\n let clone = sequence.clone(i, last_piece);\n const len = match_str.length;\n clone.add({\n start: i,\n end: i + len,\n length: len,\n substr: match_str\n });\n overlapping.push(clone);\n } else {\n // don't add char\n // adding would create invalid patterns: 234 => [2,34,4]\n added_types.add('3');\n }\n } // if we have overlapping\n\n\n if (overlapping.length > 0) {\n // ['ii','iii'] before ['i','i','iii']\n overlapping = overlapping.sort((a, b) => {\n return a.length() - b.length();\n });\n\n for (let clone of overlapping) {\n // don't add if we already have an equivalent sequence\n if (inSequences(clone, sequences)) {\n continue;\n }\n\n sequences.push(clone);\n }\n\n continue;\n } // if we haven't done anything unique\n // clean up the patterns\n // helps keep patterns smaller\n // if str = 'r₨㎧aarss', pattern will be 446 instead of 655\n\n\n if (i > 0 && added_types.size == 1 && !added_types.has('3')) {\n pattern += sequencesToPattern(sequences, false);\n let new_seq = new Sequence();\n const old_seq = sequences[0];\n\n if (old_seq) {\n new_seq.add(old_seq.last());\n }\n\n sequences = [new_seq];\n }\n }\n\n pattern += sequencesToPattern(sequences, true);\n return pattern;\n};\n\nexport { asciifold, code_points, decompose, generateMap, generateSets, generator, getPattern, initialize, mapSequence, normalize, substringsToPattern, unicode_map };\n//# sourceMappingURL=index.js.map\n","\nimport { iterate } from '@orchidjs/sifter/lib/utils';\n\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * param query should be {}\n */\nexport const getDom = ( query:any ):HTMLElement => {\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( isHtmlString(query) ){\n\t\tvar tpl = document.createElement('template');\n\t\ttpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn tpl.content.firstChild as HTMLElement;\n\t}\n\n\treturn document.querySelector(query);\n};\n\nexport const isHtmlString = (arg:any): boolean => {\n\tif( typeof arg === 'string' && arg.indexOf('<') > -1 ){\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport const escapeQuery = (query:string):string => {\n\treturn query.replace(/['\"\\\\]/g, '\\\\$&');\n}\n\n/**\n * Dispatch an event\n *\n */\nexport const triggerEvent = ( dom_el:HTMLElement, event_name:string ):void => {\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n */\nexport const applyCSS = ( dom_el:HTMLElement, css:{ [key: string]: string|number }):void => {\n\tObject.assign(dom_el.style, css);\n}\n\n\n/**\n * Add css classes\n *\n */\nexport const addClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n\tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export const removeClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n \tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n */\nexport const classesArray = (args:string[]|string[][]):string[] => {\n\tvar classes:string[] = [];\n\titerate( args, (_classes) =>{\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t});\n\n\treturn classes.filter(Boolean);\n}\n\n\n/**\n * Create an array from arg if it's not already an array\n *\n */\nexport const castAsArray = (arg:any):Array<any> => {\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n */\nexport const parentMatch = ( target:null|HTMLElement, selector:string, wrapper?:HTMLElement ):HTMLElement|void => {\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode as HTMLElement;\n\t}\n}\n\n\n/**\n * Get the first or last item from an array\n *\n * > 0 - right (last)\n * <= 0 - left (first)\n *\n */\nexport const getTail = ( list:Array<any>|NodeList, direction:number=0 ):any => {\n\n\tif( direction > 0 ){\n\t\treturn list[list.length-1];\n\t}\n\n\treturn list[0];\n}\n\n/**\n * Return true if an object is empty\n *\n */\nexport const isEmptyObject = (obj:object):boolean => {\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n */\nexport const nodeIndex = ( el:null|Element, amongst?:string ):number => {\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n\n\n/**\n * Set attributes of an element\n *\n */\nexport const setAttr = (el:Element,attrs:{ [key: string]: null|string|number }) => {\n\titerate( attrs,(val,attr) => {\n\t\tif( val == null ){\n\t\t\tel.removeAttribute(attr as string);\n\t\t}else{\n\t\t\tel.setAttribute(attr as string, ''+val);\n\t\t}\n\t});\n}\n\n\n/**\n * Replace a node\n */\nexport const replaceNode = ( existing:Node, replacement:Node ) => {\n\tif( existing.parentNode ) existing.parentNode.replaceChild(replacement, existing);\n}\n","/**\n * Plugin: \"dropdown_header\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select';\nimport { getDom } from '../../vanilla';\nimport { CBOptions } from './types';\n\nexport default function(this:TomSelect, userOptions:CBOptions) {\n\tconst self = this;\n\n\tconst options = Object.assign({\n\t\tclassName: 'clear-button',\n\t\ttitle: 'Clear All',\n\t\thtml: (data:CBOptions) => {\n\t\t\treturn `<div class=\"${data.className}\" title=\"${data.title}\">&#10799;</div>`;\n\t\t}\n\t}, userOptions);\n\n\tself.on('initialize',()=>{\n\t\tvar button = getDom(options.html(options));\n\t\tbutton.addEventListener('click',(evt)=>{\n\n\t\t\tif( self.isDisabled ){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tself.clear();\n\n\t\t\tif( self.settings.mode === 'single' && self.settings.allowEmptyOption ){\n\t\t\t\tself.addItem('');\n\t\t\t}\n\n\t\t\tevt.preventDefault();\n\t\t\tevt.stopPropagation();\n\t\t});\n\t\tself.control.appendChild(button);\n\t});\n\n};\n"],"names":["getDom","query","jquery","HTMLElement","isHtmlString","tpl","document","createElement","innerHTML","trim","content","firstChild","querySelector","arg","indexOf","userOptions","self","options","Object","assign","className","title","html","data","on","button","addEventListener","evt","isDisabled","clear","settings","mode","allowEmptyOption","addItem","preventDefault","stopPropagation","control","appendChild"],"mappings":";;;;;AAAA;AAeA,MAAM,UAAU,GAAG,8BAA8B,CAAC;AASlD;AACA;AACA,MAAM,aAAa,GAAG;AACtB,EAAE,GAAG,EAAE,IAAI;AACX,EAAE,GAAG,EAAE,GAAG;AACV,EAAE,GAAG,EAAE,GAAG;AACV,EAAE,GAAG,EAAE,GAAG;AACV,EAAE,GAAG,EAAE,GAAG;AACV,CAAC,CAAC;AACkB,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,UAAU,EAAE,IAAI;;AC9B5F;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMA,MAAM,GAAKC,KAAF,IAA6B;AAElD,EAAIA,IAAAA,KAAK,CAACC,MAAV,EAAkB;AACjB,IAAOD,OAAAA,KAAK,CAAC,CAAD,CAAZ,CAAA;AACA,GAAA;;AA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IC,IAAAA,MAAM,GAAGzB,MAAM,CAACiB,OAAO,CAACK,IAAR,CAAaL,OAAb,CAAD,CAAnB,CAAA;AACAQ,IAAAA,MAAM,CAACC,gBAAP,CAAwB,OAAxB,EAAiCC,GAAD,IAAO;AAEtC,MAAIX,IAAAA,IAAI,CAACY,UAAT,EAAqB;AACpB,QAAA,OAAA;AACA,OAAA;;AAEDZ,MAAAA,IAAI,CAACa,KAAL,EAAA,CAAA;;AAEA,MAAA,IAAIb,IAAI,CAACc,QAAL,CAAcC,IAAd,KAAuB,QAAvB,IAAmCf,IAAI,CAACc,QAAL,CAAcE,gBAArD,EAAuE;AACtEhB,QAAAA,IAAI,CAACiB,OAAL,CAAa,EAAb,CAAA,CAAA;AACA,OAAA;;AAEDN,MAAAA,GAAG,CAACO,cAAJ,EAAA,CAAA;AACAP,MAAAA,GAAG,CAACQ,eAAJ,EAAA,CAAA;AACA,KAdD,CAAA,CAAA;AAeAnB,IAAAA,IAAI,CAACoB,OAAL,CAAaC,WAAb,CAAyBZ,MAAzB,CAAA,CAAA;AACA,GAlBD,CAAA,CAAA;AAoBA;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["../../../../node_modules/@orchidjs/unicode-variants/dist/esm/index.js","../../../../src/vanilla.ts","../../../../src/plugins/clear_button/plugin.ts"],"sourcesContent":["/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */\nimport { toArray, setToPattern, escape_regex, arrayToPattern, sequencePattern } from './regex.js';\nexport { escape_regex } from './regex.js';\nimport { allSubstrings } from './strings.js';\n\n/**\n * @typedef {{[key:string]:string}} TUnicodeMap\n * @typedef {{[key:string]:Set<string>}} TUnicodeSets\n * @typedef {[[number,number]]} TCodePoints\n * @typedef {{folded:string,composed:string,code_point:number}} TCodePointObj\n * @typedef {{start:number,end:number,length:number,substr:string}} TSequencePart\n */\n/** @type {TCodePoints} */\n\nconst code_points = [[0, 65535]];\nconst accent_pat = '[\\u0300-\\u036F\\u{b7}\\u{2be}\\u{2bc}]';\n/** @type {TUnicodeMap} */\n\nlet unicode_map;\n/** @type {RegExp} */\n\nlet multi_char_reg;\nconst max_char_length = 3;\n/** @type {TUnicodeMap} */\n\nconst latin_convert = {};\n/** @type {TUnicodeMap} */\n\nconst latin_condensed = {\n '/': '⁄∕',\n '0': '߀',\n \"a\": \"ⱥɐɑ\",\n \"aa\": \"ꜳ\",\n \"ae\": \"æǽǣ\",\n \"ao\": \"ꜵ\",\n \"au\": \"ꜷ\",\n \"av\": \"ꜹꜻ\",\n \"ay\": \"ꜽ\",\n \"b\": \"ƀɓƃ\",\n \"c\": \"ꜿƈȼↄ\",\n \"d\": \"đɗɖᴅƌꮷԁɦ\",\n \"e\": \"ɛǝᴇɇ\",\n \"f\": \"ꝼƒ\",\n \"g\": \"ǥɠꞡᵹꝿɢ\",\n \"h\": \"ħⱨⱶɥ\",\n \"i\": \"ɨı\",\n \"j\": \"ɉȷ\",\n \"k\": \"ƙⱪꝁꝃꝅꞣ\",\n \"l\": \"łƚɫⱡꝉꝇꞁɭ\",\n \"m\": \"ɱɯϻ\",\n \"n\": \"ꞥƞɲꞑᴎлԉ\",\n \"o\": \"øǿɔɵꝋꝍᴑ\",\n \"oe\": \"œ\",\n \"oi\": \"ƣ\",\n \"oo\": \"ꝏ\",\n \"ou\": \"ȣ\",\n \"p\": \"ƥᵽꝑꝓꝕρ\",\n \"q\": \"ꝗꝙɋ\",\n \"r\": \"ɍɽꝛꞧꞃ\",\n \"s\": \"ßȿꞩꞅʂ\",\n \"t\": \"ŧƭʈⱦꞇ\",\n \"th\": \"þ\",\n \"tz\": \"ꜩ\",\n \"u\": \"ʉ\",\n \"v\": \"ʋꝟʌ\",\n \"vy\": \"ꝡ\",\n \"w\": \"ⱳ\",\n \"y\": \"ƴɏỿ\",\n \"z\": \"ƶȥɀⱬꝣ\",\n \"hv\": \"ƕ\"\n};\n\nfor (let latin in latin_condensed) {\n let unicode = latin_condensed[latin] || '';\n\n for (let i = 0; i < unicode.length; i++) {\n let char = unicode.substring(i, i + 1);\n latin_convert[char] = latin;\n }\n}\n\nconst convert_pat = new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');\n/**\n * Initialize the unicode_map from the give code point ranges\n *\n * @param {TCodePoints=} _code_points\n */\n\nconst initialize = _code_points => {\n if (unicode_map !== undefined) return;\n unicode_map = generateMap(_code_points || code_points);\n};\n/**\n * Helper method for normalize a string\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize\n * @param {string} str\n * @param {string} form\n */\n\nconst normalize = (str, form = 'NFKD') => str.normalize(form);\n/**\n * Remove accents without reordering string\n * calling str.normalize('NFKD') on \\u{594}\\u{595}\\u{596} becomes \\u{596}\\u{594}\\u{595}\n * via https://github.com/krisk/Fuse/issues/133#issuecomment-318692703\n * @param {string} str\n * @return {string}\n */\n\nconst asciifold = str => {\n return toArray(str).reduce(\n /**\n * @param {string} result\n * @param {string} char\n */\n (result, char) => {\n return result + _asciifold(char);\n }, '');\n};\n/**\n * @param {string} str\n * @return {string}\n */\n\nconst _asciifold = str => {\n str = normalize(str).toLowerCase().replace(convert_pat, (\n /** @type {string} */\n char) => {\n return latin_convert[char] || '';\n }); //return str;\n\n return normalize(str, 'NFC');\n};\n/**\n * Generate a list of unicode variants from the list of code points\n * @param {TCodePoints} code_points\n * @yield {TCodePointObj}\n */\n\nfunction* generator(code_points) {\n for (const [code_point_min, code_point_max] of code_points) {\n for (let i = code_point_min; i <= code_point_max; i++) {\n let composed = String.fromCharCode(i);\n let folded = asciifold(composed);\n\n if (folded == composed.toLowerCase()) {\n continue;\n } // skip when folded is a string longer than 3 characters long\n // bc the resulting regex patterns will be long\n // eg:\n // folded صلى الله عليه وسلم length 18 code point 65018\n // folded جل جلاله length 8 code point 65019\n\n\n if (folded.length > max_char_length) {\n continue;\n }\n\n if (folded.length == 0) {\n continue;\n }\n\n yield {\n folded: folded,\n composed: composed,\n code_point: i\n };\n }\n }\n}\n/**\n * Generate a unicode map from the list of code points\n * @param {TCodePoints} code_points\n * @return {TUnicodeSets}\n */\n\nconst generateSets = code_points => {\n /** @type {{[key:string]:Set<string>}} */\n const unicode_sets = {};\n /**\n * @param {string} folded\n * @param {string} to_add\n */\n\n const addMatching = (folded, to_add) => {\n /** @type {Set<string>} */\n const folded_set = unicode_sets[folded] || new Set();\n const patt = new RegExp('^' + setToPattern(folded_set) + '$', 'iu');\n\n if (to_add.match(patt)) {\n return;\n }\n\n folded_set.add(escape_regex(to_add));\n unicode_sets[folded] = folded_set;\n };\n\n for (let value of generator(code_points)) {\n addMatching(value.folded, value.folded);\n addMatching(value.folded, value.composed);\n }\n\n return unicode_sets;\n};\n/**\n * Generate a unicode map from the list of code points\n * ae => (?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...))\n *\n * @param {TCodePoints} code_points\n * @return {TUnicodeMap}\n */\n\nconst generateMap = code_points => {\n /** @type {TUnicodeSets} */\n const unicode_sets = generateSets(code_points);\n /** @type {TUnicodeMap} */\n\n const unicode_map = {};\n /** @type {string[]} */\n\n let multi_char = [];\n\n for (let folded in unicode_sets) {\n let set = unicode_sets[folded];\n\n if (set) {\n unicode_map[folded] = setToPattern(set);\n }\n\n if (folded.length > 1) {\n multi_char.push(escape_regex(folded));\n }\n }\n\n multi_char.sort((a, b) => b.length - a.length);\n const multi_char_patt = arrayToPattern(multi_char);\n multi_char_reg = new RegExp('^' + multi_char_patt, 'u');\n return unicode_map;\n};\n/**\n * Map each element of an array from it's folded value to all possible unicode matches\n * @param {string[]} strings\n * @param {number} min_replacement\n * @return {string}\n */\n\nconst mapSequence = (strings, min_replacement = 1) => {\n let chars_replaced = 0;\n strings = strings.map(str => {\n if (unicode_map[str]) {\n chars_replaced += str.length;\n }\n\n return unicode_map[str] || str;\n });\n\n if (chars_replaced >= min_replacement) {\n return sequencePattern(strings);\n }\n\n return '';\n};\n/**\n * Convert a short string and split it into all possible patterns\n * Keep a pattern only if min_replacement is met\n *\n * 'abc'\n * \t\t=> [['abc'],['ab','c'],['a','bc'],['a','b','c']]\n *\t\t=> ['abc-pattern','ab-c-pattern'...]\n *\n *\n * @param {string} str\n * @param {number} min_replacement\n * @return {string}\n */\n\nconst substringsToPattern = (str, min_replacement = 1) => {\n min_replacement = Math.max(min_replacement, str.length - 1);\n return arrayToPattern(allSubstrings(str).map(sub_pat => {\n return mapSequence(sub_pat, min_replacement);\n }));\n};\n/**\n * Convert an array of sequences into a pattern\n * [{start:0,end:3,length:3,substr:'iii'}...] => (?:iii...)\n *\n * @param {Sequence[]} sequences\n * @param {boolean} all\n */\n\nconst sequencesToPattern = (sequences, all = true) => {\n let min_replacement = sequences.length > 1 ? 1 : 0;\n return arrayToPattern(sequences.map(sequence => {\n let seq = [];\n const len = all ? sequence.length() : sequence.length() - 1;\n\n for (let j = 0; j < len; j++) {\n seq.push(substringsToPattern(sequence.substrs[j] || '', min_replacement));\n }\n\n return sequencePattern(seq);\n }));\n};\n/**\n * Return true if the sequence is already in the sequences\n * @param {Sequence} needle_seq\n * @param {Sequence[]} sequences\n */\n\n\nconst inSequences = (needle_seq, sequences) => {\n for (const seq of sequences) {\n if (seq.start != needle_seq.start || seq.end != needle_seq.end) {\n continue;\n }\n\n if (seq.substrs.join('') !== needle_seq.substrs.join('')) {\n continue;\n }\n\n let needle_parts = needle_seq.parts;\n /**\n * @param {TSequencePart} part\n */\n\n const filter = part => {\n for (const needle_part of needle_parts) {\n if (needle_part.start === part.start && needle_part.substr === part.substr) {\n return false;\n }\n\n if (part.length == 1 || needle_part.length == 1) {\n continue;\n } // check for overlapping parts\n // a = ['::=','==']\n // b = ['::','===']\n // a = ['r','sm']\n // b = ['rs','m']\n\n\n if (part.start < needle_part.start && part.end > needle_part.start) {\n return true;\n }\n\n if (needle_part.start < part.start && needle_part.end > part.start) {\n return true;\n }\n }\n\n return false;\n };\n\n let filtered = seq.parts.filter(filter);\n\n if (filtered.length > 0) {\n continue;\n }\n\n return true;\n }\n\n return false;\n};\n\nclass Sequence {\n constructor() {\n /** @type {TSequencePart[]} */\n this.parts = [];\n /** @type {string[]} */\n\n this.substrs = [];\n this.start = 0;\n this.end = 0;\n }\n /**\n * @param {TSequencePart|undefined} part\n */\n\n\n add(part) {\n if (part) {\n this.parts.push(part);\n this.substrs.push(part.substr);\n this.start = Math.min(part.start, this.start);\n this.end = Math.max(part.end, this.end);\n }\n }\n\n last() {\n return this.parts[this.parts.length - 1];\n }\n\n length() {\n return this.parts.length;\n }\n /**\n * @param {number} position\n * @param {TSequencePart} last_piece\n */\n\n\n clone(position, last_piece) {\n let clone = new Sequence();\n let parts = JSON.parse(JSON.stringify(this.parts));\n let last_part = parts.pop();\n\n for (const part of parts) {\n clone.add(part);\n }\n\n let last_substr = last_piece.substr.substring(0, position - last_part.start);\n let clone_last_len = last_substr.length;\n clone.add({\n start: last_part.start,\n end: last_part.start + clone_last_len,\n length: clone_last_len,\n substr: last_substr\n });\n return clone;\n }\n\n}\n/**\n * Expand a regular expression pattern to include unicode variants\n * \teg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/\n *\n * Issue:\n * ﺊﺋ [ 'ﺊ = \\\\u{fe8a}', 'ﺋ = \\\\u{fe8b}' ]\n *\tbecomes:\tئئ [ 'ي = \\\\u{64a}', 'ٔ = \\\\u{654}', 'ي = \\\\u{64a}', 'ٔ = \\\\u{654}' ]\n *\n *\tİIJ = IIJ = ⅡJ\n *\n * \t1/2/4\n *\n * @param {string} str\n * @return {string|undefined}\n */\n\n\nconst getPattern = str => {\n initialize();\n str = asciifold(str);\n let pattern = '';\n let sequences = [new Sequence()];\n\n for (let i = 0; i < str.length; i++) {\n let substr = str.substring(i);\n let match = substr.match(multi_char_reg);\n const char = str.substring(i, i + 1);\n const match_str = match ? match[0] : null; // loop through sequences\n // add either the char or multi_match\n\n let overlapping = [];\n let added_types = new Set();\n\n for (const sequence of sequences) {\n const last_piece = sequence.last();\n\n if (!last_piece || last_piece.length == 1 || last_piece.end <= i) {\n // if we have a multi match\n if (match_str) {\n const len = match_str.length;\n sequence.add({\n start: i,\n end: i + len,\n length: len,\n substr: match_str\n });\n added_types.add('1');\n } else {\n sequence.add({\n start: i,\n end: i + 1,\n length: 1,\n substr: char\n });\n added_types.add('2');\n }\n } else if (match_str) {\n let clone = sequence.clone(i, last_piece);\n const len = match_str.length;\n clone.add({\n start: i,\n end: i + len,\n length: len,\n substr: match_str\n });\n overlapping.push(clone);\n } else {\n // don't add char\n // adding would create invalid patterns: 234 => [2,34,4]\n added_types.add('3');\n }\n } // if we have overlapping\n\n\n if (overlapping.length > 0) {\n // ['ii','iii'] before ['i','i','iii']\n overlapping = overlapping.sort((a, b) => {\n return a.length() - b.length();\n });\n\n for (let clone of overlapping) {\n // don't add if we already have an equivalent sequence\n if (inSequences(clone, sequences)) {\n continue;\n }\n\n sequences.push(clone);\n }\n\n continue;\n } // if we haven't done anything unique\n // clean up the patterns\n // helps keep patterns smaller\n // if str = 'r₨㎧aarss', pattern will be 446 instead of 655\n\n\n if (i > 0 && added_types.size == 1 && !added_types.has('3')) {\n pattern += sequencesToPattern(sequences, false);\n let new_seq = new Sequence();\n const old_seq = sequences[0];\n\n if (old_seq) {\n new_seq.add(old_seq.last());\n }\n\n sequences = [new_seq];\n }\n }\n\n pattern += sequencesToPattern(sequences, true);\n return pattern;\n};\n\nexport { _asciifold, asciifold, code_points, generateMap, generateSets, generator, getPattern, initialize, mapSequence, normalize, substringsToPattern, unicode_map };\n//# sourceMappingURL=index.js.map\n","\nimport { iterate } from '@orchidjs/sifter/lib/utils';\n\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * param query should be {}\n */\nexport const getDom = ( query:any ):HTMLElement => {\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( isHtmlString(query) ){\n\t\tvar tpl = document.createElement('template');\n\t\ttpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn tpl.content.firstChild as HTMLElement;\n\t}\n\n\treturn document.querySelector(query);\n};\n\nexport const isHtmlString = (arg:any): boolean => {\n\tif( typeof arg === 'string' && arg.indexOf('<') > -1 ){\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport const escapeQuery = (query:string):string => {\n\treturn query.replace(/['\"\\\\]/g, '\\\\$&');\n}\n\n/**\n * Dispatch an event\n *\n */\nexport const triggerEvent = ( dom_el:HTMLElement, event_name:string ):void => {\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n */\nexport const applyCSS = ( dom_el:HTMLElement, css:{ [key: string]: string|number }):void => {\n\tObject.assign(dom_el.style, css);\n}\n\n\n/**\n * Add css classes\n *\n */\nexport const addClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n\tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export const removeClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n \tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n */\nexport const classesArray = (args:string[]|string[][]):string[] => {\n\tvar classes:string[] = [];\n\titerate( args, (_classes) =>{\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t});\n\n\treturn classes.filter(Boolean);\n}\n\n\n/**\n * Create an array from arg if it's not already an array\n *\n */\nexport const castAsArray = (arg:any):Array<any> => {\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n */\nexport const parentMatch = ( target:null|HTMLElement, selector:string, wrapper?:HTMLElement ):HTMLElement|void => {\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode as HTMLElement;\n\t}\n}\n\n\n/**\n * Get the first or last item from an array\n *\n * > 0 - right (last)\n * <= 0 - left (first)\n *\n */\nexport const getTail = ( list:Array<any>|NodeList, direction:number=0 ):any => {\n\n\tif( direction > 0 ){\n\t\treturn list[list.length-1];\n\t}\n\n\treturn list[0];\n}\n\n/**\n * Return true if an object is empty\n *\n */\nexport const isEmptyObject = (obj:object):boolean => {\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n */\nexport const nodeIndex = ( el:null|Element, amongst?:string ):number => {\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n\n\n/**\n * Set attributes of an element\n *\n */\nexport const setAttr = (el:Element,attrs:{ [key: string]: null|string|number }) => {\n\titerate( attrs,(val,attr) => {\n\t\tif( val == null ){\n\t\t\tel.removeAttribute(attr as string);\n\t\t}else{\n\t\t\tel.setAttribute(attr as string, ''+val);\n\t\t}\n\t});\n}\n\n\n/**\n * Replace a node\n */\nexport const replaceNode = ( existing:Node, replacement:Node ) => {\n\tif( existing.parentNode ) existing.parentNode.replaceChild(replacement, existing);\n}\n","/**\n * Plugin: \"dropdown_header\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select';\nimport { getDom } from '../../vanilla';\nimport { CBOptions } from './types';\n\nexport default function(this:TomSelect, userOptions:CBOptions) {\n\tconst self = this;\n\n\tconst options = Object.assign({\n\t\tclassName: 'clear-button',\n\t\ttitle: 'Clear All',\n\t\thtml: (data:CBOptions) => {\n\t\t\treturn `<div class=\"${data.className}\" title=\"${data.title}\">&#10799;</div>`;\n\t\t}\n\t}, userOptions);\n\n\tself.on('initialize',()=>{\n\t\tvar button = getDom(options.html(options));\n\t\tbutton.addEventListener('click',(evt)=>{\n\n\t\t\tif( self.isLocked ) return;\n\n\t\t\tself.clear();\n\n\t\t\tif( self.settings.mode === 'single' && self.settings.allowEmptyOption ){\n\t\t\t\tself.addItem('');\n\t\t\t}\n\n\t\t\tevt.preventDefault();\n\t\t\tevt.stopPropagation();\n\t\t});\n\t\tself.control.appendChild(button);\n\t});\n\n};\n"],"names":["getDom","query","jquery","HTMLElement","isHtmlString","tpl","document","createElement","innerHTML","trim","content","firstChild","querySelector","arg","indexOf","userOptions","self","options","Object","assign","className","title","html","data","on","button","addEventListener","evt","isLocked","clear","settings","mode","allowEmptyOption","addItem","preventDefault","stopPropagation","control","appendChild"],"mappings":";;;;;AAAA;AAeA,MAAM,UAAU,GAAG,q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FnB,IAAAA,IAAI,CAACoB,OAAO,CAACC,WAAW,CAACZ,MAAM,CAAC,CAAA;AACjC,GAAC,CAAC,CAAA;AAEH;;;;","x_google_ignoreList":[0]}
@@ -1,8 +1,169 @@
1
1
  /**
2
- * Tom Select v2.2.1
2
+ * Tom Select v2.3.1
3
3
  * Licensed under the Apache License, Version 2.0 (the "License");
4
4
  */
5
5
 
6
+ /**
7
+ * Converts a scalar to its best string representation
8
+ * for hash keys and HTML attribute values.
9
+ *
10
+ * Transformations:
11
+ * 'str' -> 'str'
12
+ * null -> ''
13
+ * undefined -> ''
14
+ * true -> '1'
15
+ * false -> '0'
16
+ * 0 -> '0'
17
+ * 1 -> '1'
18
+ *
19
+ */
20
+
21
+ /**
22
+ * Prevent default
23
+ *
24
+ */
25
+ const preventDefault = (evt, stop = false) => {
26
+ if (evt) {
27
+ evt.preventDefault();
28
+ if (stop) {
29
+ evt.stopPropagation();
30
+ }
31
+ }
32
+ };
33
+
34
+ /**
35
+ * Add event helper
36
+ *
37
+ */
38
+ const addEvent = (target, type, callback, options) => {
39
+ target.addEventListener(type, callback, options);
40
+ };
41
+
42
+ /*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */
43
+ const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]';
44
+ /** @type {TUnicodeMap} */
45
+
46
+ const latin_convert = {};
47
+ /** @type {TUnicodeMap} */
48
+
49
+ const latin_condensed = {
50
+ '/': '⁄∕',
51
+ '0': '߀',
52
+ "a": "ⱥɐɑ",
53
+ "aa": "ꜳ",
54
+ "ae": "æǽǣ",
55
+ "ao": "ꜵ",
56
+ "au": "ꜷ",
57
+ "av": "ꜹꜻ",
58
+ "ay": "ꜽ",
59
+ "b": "ƀɓƃ",
60
+ "c": "ꜿƈȼↄ",
61
+ "d": "đɗɖᴅƌꮷԁɦ",
62
+ "e": "ɛǝᴇɇ",
63
+ "f": "ꝼƒ",
64
+ "g": "ǥɠꞡᵹꝿɢ",
65
+ "h": "ħⱨⱶɥ",
66
+ "i": "ɨı",
67
+ "j": "ɉȷ",
68
+ "k": "ƙⱪꝁꝃꝅꞣ",
69
+ "l": "łƚɫⱡꝉꝇꞁɭ",
70
+ "m": "ɱɯϻ",
71
+ "n": "ꞥƞɲꞑᴎлԉ",
72
+ "o": "øǿɔɵꝋꝍᴑ",
73
+ "oe": "œ",
74
+ "oi": "ƣ",
75
+ "oo": "ꝏ",
76
+ "ou": "ȣ",
77
+ "p": "ƥᵽꝑꝓꝕρ",
78
+ "q": "ꝗꝙɋ",
79
+ "r": "ɍɽꝛꞧꞃ",
80
+ "s": "ßȿꞩꞅʂ",
81
+ "t": "ŧƭʈⱦꞇ",
82
+ "th": "þ",
83
+ "tz": "ꜩ",
84
+ "u": "ʉ",
85
+ "v": "ʋꝟʌ",
86
+ "vy": "ꝡ",
87
+ "w": "ⱳ",
88
+ "y": "ƴɏỿ",
89
+ "z": "ƶȥɀⱬꝣ",
90
+ "hv": "ƕ"
91
+ };
92
+
93
+ for (let latin in latin_condensed) {
94
+ let unicode = latin_condensed[latin] || '';
95
+
96
+ for (let i = 0; i < unicode.length; i++) {
97
+ let char = unicode.substring(i, i + 1);
98
+ latin_convert[char] = latin;
99
+ }
100
+ }
101
+
102
+ new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');
103
+
104
+ /**
105
+ * Iterates over arrays and hashes.
106
+ *
107
+ * ```
108
+ * iterate(this.items, function(item, id) {
109
+ * // invoked for each item
110
+ * });
111
+ * ```
112
+ *
113
+ */
114
+ const iterate = (object, callback) => {
115
+ if (Array.isArray(object)) {
116
+ object.forEach(callback);
117
+ } else {
118
+ for (var key in object) {
119
+ if (object.hasOwnProperty(key)) {
120
+ callback(object[key], key);
121
+ }
122
+ }
123
+ }
124
+ };
125
+
126
+ /**
127
+ * Return a dom element from either a dom query string, jQuery object, a dom element or html string
128
+ * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
129
+ *
130
+ * param query should be {}
131
+ */
132
+ const getDom = query => {
133
+ if (query.jquery) {
134
+ return query[0];
135
+ }
136
+ if (query instanceof HTMLElement) {
137
+ return query;
138
+ }
139
+ if (isHtmlString(query)) {
140
+ var tpl = document.createElement('template');
141
+ tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result
142
+ return tpl.content.firstChild;
143
+ }
144
+ return document.querySelector(query);
145
+ };
146
+ const isHtmlString = arg => {
147
+ if (typeof arg === 'string' && arg.indexOf('<') > -1) {
148
+ return true;
149
+ }
150
+ return false;
151
+ };
152
+
153
+ /**
154
+ * Set attributes of an element
155
+ *
156
+ */
157
+ const setAttr = (el, attrs) => {
158
+ iterate(attrs, (val, attr) => {
159
+ if (val == null) {
160
+ el.removeAttribute(attr);
161
+ } else {
162
+ el.setAttribute(attr, '' + val);
163
+ }
164
+ });
165
+ };
166
+
6
167
  /**
7
168
  * Plugin: "drag_drop" (Tom Select)
8
169
  * Copyright (c) contributors
@@ -17,45 +178,104 @@
17
178
  * governing permissions and limitations under the License.
18
179
  *
19
180
  */
181
+
182
+ const insertAfter = (referenceNode, newNode) => {
183
+ var _referenceNode$parent;
184
+ (_referenceNode$parent = referenceNode.parentNode) == null || _referenceNode$parent.insertBefore(newNode, referenceNode.nextSibling);
185
+ };
186
+ const insertBefore = (referenceNode, newNode) => {
187
+ var _referenceNode$parent2;
188
+ (_referenceNode$parent2 = referenceNode.parentNode) == null || _referenceNode$parent2.insertBefore(newNode, referenceNode);
189
+ };
190
+ const isBefore = (referenceNode, newNode) => {
191
+ do {
192
+ var _newNode;
193
+ newNode = (_newNode = newNode) == null ? void 0 : _newNode.previousElementSibling;
194
+ if (referenceNode == newNode) {
195
+ return true;
196
+ }
197
+ } while (newNode && newNode.previousElementSibling);
198
+ return false;
199
+ };
20
200
  function plugin () {
21
201
  var self = this;
22
- if (!$.fn.sortable) throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');
23
202
  if (self.settings.mode !== 'multi') return;
24
203
  var orig_lock = self.lock;
25
204
  var orig_unlock = self.unlock;
205
+ let sortable = true;
206
+ let drag_item;
207
+
208
+ /**
209
+ * Add draggable attribute to item
210
+ */
211
+ self.hook('after', 'setupTemplates', () => {
212
+ var orig_render_item = self.settings.render.item;
213
+ self.settings.render.item = (data, escape) => {
214
+ const item = getDom(orig_render_item.call(self, data, escape));
215
+ setAttr(item, {
216
+ 'draggable': 'true'
217
+ });
218
+
219
+ // prevent doc_mousedown (see tom-select.ts)
220
+ const mousedown = evt => {
221
+ if (!sortable) preventDefault(evt);
222
+ evt.stopPropagation();
223
+ };
224
+ const dragStart = evt => {
225
+ drag_item = item;
226
+ setTimeout(() => {
227
+ item.classList.add('ts-dragging');
228
+ }, 0);
229
+ };
230
+ const dragOver = evt => {
231
+ evt.preventDefault();
232
+ item.classList.add('ts-drag-over');
233
+ moveitem(item, drag_item);
234
+ };
235
+ const dragLeave = () => {
236
+ item.classList.remove('ts-drag-over');
237
+ };
238
+ const moveitem = (targetitem, dragitem) => {
239
+ if (dragitem === undefined) return;
240
+ if (isBefore(dragitem, item)) {
241
+ insertAfter(targetitem, dragitem);
242
+ } else {
243
+ insertBefore(targetitem, dragitem);
244
+ }
245
+ };
246
+ const dragend = () => {
247
+ var _drag_item;
248
+ document.querySelectorAll('.ts-drag-over').forEach(el => el.classList.remove('ts-drag-over'));
249
+ (_drag_item = drag_item) == null || _drag_item.classList.remove('ts-dragging');
250
+ drag_item = undefined;
251
+ var values = [];
252
+ self.control.querySelectorAll(`[data-value]`).forEach(el => {
253
+ if (el.dataset.value) {
254
+ let value = el.dataset.value;
255
+ if (value) {
256
+ values.push(value);
257
+ }
258
+ }
259
+ });
260
+ self.setValue(values);
261
+ };
262
+ addEvent(item, 'mousedown', mousedown);
263
+ addEvent(item, 'dragstart', dragStart);
264
+ addEvent(item, 'dragenter', dragOver);
265
+ addEvent(item, 'dragover', dragOver);
266
+ addEvent(item, 'dragleave', dragLeave);
267
+ addEvent(item, 'dragend', dragend);
268
+ return item;
269
+ };
270
+ });
26
271
  self.hook('instead', 'lock', () => {
27
- var sortable = $(self.control).data('sortable');
28
- if (sortable) sortable.disable();
272
+ sortable = false;
29
273
  return orig_lock.call(self);
30
274
  });
31
275
  self.hook('instead', 'unlock', () => {
32
- var sortable = $(self.control).data('sortable');
33
- if (sortable) sortable.enable();
276
+ sortable = true;
34
277
  return orig_unlock.call(self);
35
278
  });
36
- self.on('initialize', () => {
37
- var $control = $(self.control).sortable({
38
- items: '[data-value]',
39
- forcePlaceholderSize: true,
40
- disabled: self.isLocked,
41
- start: (e, ui) => {
42
- ui.placeholder.css('width', ui.helper.css('width'));
43
- $control.css({
44
- overflow: 'visible'
45
- });
46
- },
47
- stop: () => {
48
- $control.css({
49
- overflow: 'hidden'
50
- });
51
- var values = [];
52
- $control.children('[data-value]').each(function () {
53
- if (this.dataset.value) values.push(this.dataset.value);
54
- });
55
- self.setValue(values);
56
- }
57
- });
58
- });
59
279
  }
60
280
 
61
281
  export { plugin as default };
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["../../../../src/plugins/drag_drop/plugin.ts"],"sourcesContent":["/**\n * Plugin: \"drag_drop\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select';\n\nexport default function(this:TomSelect) {\n\tvar self = this;\n\tif (!$.fn.sortable) throw new Error('The \"drag_drop\" plugin requires jQuery UI \"sortable\".');\n\tif (self.settings.mode !== 'multi') return;\n\n\tvar orig_lock\t\t= self.lock;\n\tvar orig_unlock\t\t= self.unlock;\n\n\tself.hook('instead','lock',()=>{\n\t\tvar sortable = $(self.control).data('sortable');\n\t\tif (sortable) sortable.disable();\n\t\treturn orig_lock.call(self);\n\t});\n\n\tself.hook('instead','unlock',()=>{\n\t\tvar sortable = $(self.control).data('sortable');\n\t\tif (sortable) sortable.enable();\n\t\treturn orig_unlock.call(self);\n\t});\n\n\tself.on('initialize',()=>{\n\t\tvar $control = $(self.control).sortable({\n\t\t\titems: '[data-value]',\n\t\t\tforcePlaceholderSize: true,\n\t\t\tdisabled: self.isLocked,\n\t\t\tstart: (e, ui) => {\n\t\t\t\tui.placeholder.css('width', ui.helper.css('width'));\n\t\t\t\t$control.css({overflow: 'visible'});\n\t\t\t},\n\t\t\tstop: ()=>{\n\t\t\t\t$control.css({overflow: 'hidden'});\n\n\t\t\t\tvar values:string[] = [];\n\t\t\t\t$control.children('[data-value]').each(function(this:HTMLElement){\n\t\t\t\t\tif( this.dataset.value ) values.push(this.dataset.value);\n\t\t\t\t});\n\n\t\t\t\tself.setValue(values);\n\t\t\t}\n\t\t});\n\n\t});\n\n};\n"],"names":["self","$","fn","sortable","Error","settings","mode","orig_lock","lock","orig_unlock","unlock","hook","control","data","disable","call","enable","on","$control","items","forcePlaceholderSize","disabled","isLocked","start","e","ui","placeholder","css","helper","overflow","stop","values","children","each","dataset","value","push","setValue"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIe,eAAyB,IAAA;AACvC,EAAIA,IAAAA,IAAI,GAAG,IAAX,CAAA;AACA,EAAA,IAAI,CAACC,CAAC,CAACC,EAAF,CAAKC,QAAV,EAAoB,MAAM,IAAIC,KAAJ,CAAU,uDAAV,CAAN,CAAA;AACpB,EAAA,IAAIJ,IAAI,CAACK,QAAL,CAAcC,IAAd,KAAuB,OAA3B,EAAoC,OAAA;AAEpC,EAAA,IAAIC,SAAS,GAAIP,IAAI,CAACQ,IAAtB,CAAA;AACA,EAAA,IAAIC,WAAW,GAAIT,I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,SAAb,CAAA,CAAA;AACA,OAPsC;AAQvCC,MAAAA,IAAI,EAAE,MAAI;AACTZ,QAAAA,QAAQ,CAACS,GAAT,CAAa;AAACE,UAAAA,QAAQ,EAAE,QAAA;AAAX,SAAb,CAAA,CAAA;AAEA,QAAIE,IAAAA,MAAe,GAAG,EAAtB,CAAA;AACAb,QAAAA,QAAQ,CAACc,QAAT,CAAkB,cAAlB,CAAkCC,CAAAA,IAAlC,CAAuC,YAA0B;AAChE,UAAA,IAAI,IAAKC,CAAAA,OAAL,CAAaC,KAAjB,EAAyBJ,MAAM,CAACK,IAAP,CAAY,IAAA,CAAKF,OAAL,CAAaC,KAAzB,CAAA,CAAA;AACzB,SAFD,CAAA,CAAA;AAIAnC,QAAAA,IAAI,CAACqC,QAAL,CAAcN,MAAd,CAAA,CAAA;AACA,OAAA;AAjBsC,KAAzB,CAAf,CAAA;AAoBA,GArBD,CAAA,CAAA;AAuBA;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["../../../../src/utils.ts","../../../../node_modules/@orchidjs/unicode-variants/dist/esm/index.js","../../../../node_modules/@orchidjs/sifter/lib/utils.ts","../../../../src/vanilla.ts","../../../../src/plugins/drag_drop/plugin.ts"],"sourcesContent":["\nimport TomSelect from './tom-select';\nimport { TomLoadCallback } from './types/index';\n\n\n/**\n * Converts a scalar to its best string representation\n * for hash keys and HTML attribute values.\n *\n * Transformations:\n * 'str' -> 'str'\n * null -> ''\n * undefined -> ''\n * true -> '1'\n * false -> '0'\n * 0 -> '0'\n * 1 -> '1'\n *\n */\nexport const hash_key = (value:undefined|null|boolean|string|number):string|null => {\n\tif (typeof value === 'undefined' || value === null) return null;\n\treturn get_hash(value);\n};\n\nexport const get_hash = (value:boolean|string|number):string => {\n\tif (typeof value === 'boolean') return value ? '1' : '0';\n\treturn value + '';\n};\n\n/**\n * Escapes a string for use within HTML.\n *\n */\nexport const escape_html = (str:string):string => {\n\treturn (str + '')\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;')\n\t\t.replace(/\"/g, '&quot;');\n};\n\n\n/**\n * use setTimeout if timeout > 0 \n */\nexport const timeout = (fn:()=>void,timeout:number) => {\n\tif( timeout > 0 ){\n\t\treturn setTimeout(fn,timeout);\n\t}\n\n\tfn.call(null);\n\treturn null;\n}\n\n/**\n * Debounce the user provided load function\n *\n */\nexport const loadDebounce = (fn:(value:string,callback:TomLoadCallback) => void,delay:number) => {\n\tvar timeout: null|ReturnType<typeof setTimeout>;\n\treturn function(this:TomSelect, value:string,callback:TomLoadCallback) {\n\t\tvar self = this;\n\n\t\tif( timeout ){\n\t\t\tself.loading = Math.max(self.loading - 1, 0);\n\t\t\tclearTimeout(timeout);\n\t\t}\n\t\ttimeout = setTimeout(function() {\n\t\t\ttimeout = null;\n\t\t\tself.loadedSearches[value] = true;\n\t\t\tfn.call(self, value, callback);\n\n\t\t}, delay);\n\t};\n};\n\n\n/**\n * Debounce all fired events types listed in `types`\n * while executing the provided `fn`.\n *\n */\nexport const debounce_events = ( self:TomSelect, types:string[], fn:() => void ) => {\n\tvar type:string;\n\tvar trigger = self.trigger;\n\tvar event_args:{ [key: string]: any } = {};\n\n\t// override trigger method\n\tself.trigger = function(){\n\t\tvar type = arguments[0];\n\t\tif (types.indexOf(type) !== -1) {\n\t\t\tevent_args[type] = arguments;\n\t\t} else {\n\t\t\treturn trigger.apply(self, arguments);\n\t\t}\n\t};\n\n\t// invoke provided function\n\tfn.apply(self, []);\n\tself.trigger = trigger;\n\n\t// trigger queued events\n\tfor( type of types ){\n\t\tif( type in event_args ){\n\t\t\ttrigger.apply(self, event_args[type]);\n\t\t}\n\t}\n};\n\n\n/**\n * Determines the current selection within a text input control.\n * Returns an object containing:\n * - start\n * - length\n *\n * Note: \"selectionStart, selectionEnd ... apply only to inputs of types text, search, URL, tel and password\"\n * \t- https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange\n */\nexport const getSelection = (input:HTMLInputElement):{ start: number; length: number } => {\n\treturn {\n\t\tstart\t: input.selectionStart || 0,\n\t\tlength\t: (input.selectionEnd||0) - (input.selectionStart||0),\n\t};\n};\n\n\n/**\n * Prevent default\n *\n */\nexport const preventDefault = (evt?:Event, stop:boolean=false):void => {\n\tif( evt ){\n\t\tevt.preventDefault();\n\t\tif( stop ){\n\t\t\tevt.stopPropagation();\n\t\t}\n\t}\n}\n\n\n/**\n * Add event helper\n *\n */\nexport const addEvent = (target:EventTarget, type:string, callback:EventListenerOrEventListenerObject, options?:object):void => {\n\ttarget.addEventListener(type,callback,options);\n};\n\n\n/**\n * Return true if the requested key is down\n * Will return false if more than one control character is pressed ( when [ctrl+shift+a] != [ctrl+a] )\n * The current evt may not always set ( eg calling advanceSelection() )\n *\n */\nexport const isKeyDown = ( key_name:keyof (KeyboardEvent|MouseEvent), evt?:KeyboardEvent|MouseEvent ) => {\n\n\tif( !evt ){\n\t\treturn false;\n\t}\n\n\tif( !evt[key_name] ){\n\t\treturn false;\n\t}\n\n\tvar count = (evt.altKey?1:0) + (evt.ctrlKey?1:0) + (evt.shiftKey?1:0) + (evt.metaKey?1:0);\n\n\tif( count === 1 ){\n\t\treturn true;\n\t}\n\n\treturn false;\n};\n\n\n/**\n * Get the id of an element\n * If the id attribute is not set, set the attribute with the given id\n *\n */\nexport const getId = (el:Element,id:string) => {\n\tconst existing_id = el.getAttribute('id');\n\tif( existing_id ){\n\t\treturn existing_id;\n\t}\n\n\tel.setAttribute('id',id);\n\treturn id;\n};\n\n\n/**\n * Returns a string with backslashes added before characters that need to be escaped.\n */\nexport const addSlashes = (str:string):string => {\n\treturn str.replace(/[\\\\\"']/g, '\\\\$&');\n};\n\n/**\n *\n */\nexport const append = ( parent:Element|DocumentFragment, node: string|Node|null|undefined ):void =>{\n\tif( node ) parent.append(node);\n};\n","/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */\nimport { toArray, setToPattern, escape_regex, arrayToPattern, sequencePattern } from './regex.js';\nexport { escape_regex } from './regex.js';\nimport { allSubstrings } from './strings.js';\n\n/**\n * @typedef {{[key:string]:string}} TUnicodeMap\n * @typedef {{[key:string]:Set<string>}} TUnicodeSets\n * @typedef {[[number,number]]} TCodePoints\n * @typedef {{folded:string,composed:string,code_point:number}} TCodePointObj\n * @typedef {{start:number,end:number,length:number,substr:string}} TSequencePart\n */\n/** @type {TCodePoints} */\n\nconst code_points = [[0, 65535]];\nconst accent_pat = '[\\u0300-\\u036F\\u{b7}\\u{2be}\\u{2bc}]';\n/** @type {TUnicodeMap} */\n\nlet unicode_map;\n/** @type {RegExp} */\n\nlet multi_char_reg;\nconst max_char_length = 3;\n/** @type {TUnicodeMap} */\n\nconst latin_convert = {};\n/** @type {TUnicodeMap} */\n\nconst latin_condensed = {\n '/': '⁄∕',\n '0': '߀',\n \"a\": \"ⱥɐɑ\",\n \"aa\": \"ꜳ\",\n \"ae\": \"æǽǣ\",\n \"ao\": \"ꜵ\",\n \"au\": \"ꜷ\",\n \"av\": \"ꜹꜻ\",\n \"ay\": \"ꜽ\",\n \"b\": \"ƀɓƃ\",\n \"c\": \"ꜿƈȼↄ\",\n \"d\": \"đɗɖᴅƌꮷԁɦ\",\n \"e\": \"ɛǝᴇɇ\",\n \"f\": \"ꝼƒ\",\n \"g\": \"ǥɠꞡᵹꝿɢ\",\n \"h\": \"ħⱨⱶɥ\",\n \"i\": \"ɨı\",\n \"j\": \"ɉȷ\",\n \"k\": \"ƙⱪꝁꝃꝅꞣ\",\n \"l\": \"łƚɫⱡꝉꝇꞁɭ\",\n \"m\": \"ɱɯϻ\",\n \"n\": \"ꞥƞɲꞑᴎлԉ\",\n \"o\": \"øǿɔɵꝋꝍᴑ\",\n \"oe\": \"œ\",\n \"oi\": \"ƣ\",\n \"oo\": \"ꝏ\",\n \"ou\": \"ȣ\",\n \"p\": \"ƥᵽꝑꝓꝕρ\",\n \"q\": \"ꝗꝙɋ\",\n \"r\": \"ɍɽꝛꞧꞃ\",\n \"s\": \"ßȿꞩꞅʂ\",\n \"t\": \"ŧƭʈⱦꞇ\",\n \"th\": \"þ\",\n \"tz\": \"ꜩ\",\n \"u\": \"ʉ\",\n \"v\": \"ʋꝟʌ\",\n \"vy\": \"ꝡ\",\n \"w\": \"ⱳ\",\n \"y\": \"ƴɏỿ\",\n \"z\": \"ƶȥɀⱬꝣ\",\n \"hv\": \"ƕ\"\n};\n\nfor (let latin in latin_condensed) {\n let unicode = latin_condensed[latin] || '';\n\n for (let i = 0; i < unicode.length; i++) {\n let char = unicode.substring(i, i + 1);\n latin_convert[char] = latin;\n }\n}\n\nconst convert_pat = new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');\n/**\n * Initialize the unicode_map from the give code point ranges\n *\n * @param {TCodePoints=} _code_points\n */\n\nconst initialize = _code_points => {\n if (unicode_map !== undefined) return;\n unicode_map = generateMap(_code_points || code_points);\n};\n/**\n * Helper method for normalize a string\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize\n * @param {string} str\n * @param {string} form\n */\n\nconst normalize = (str, form = 'NFKD') => str.normalize(form);\n/**\n * Remove accents without reordering string\n * calling str.normalize('NFKD') on \\u{594}\\u{595}\\u{596} becomes \\u{596}\\u{594}\\u{595}\n * via https://github.com/krisk/Fuse/issues/133#issuecomment-318692703\n * @param {string} str\n * @return {string}\n */\n\nconst asciifold = str => {\n return toArray(str).reduce(\n /**\n * @param {string} result\n * @param {string} char\n */\n (result, char) => {\n return result + _asciifold(char);\n }, '');\n};\n/**\n * @param {string} str\n * @return {string}\n */\n\nconst _asciifold = str => {\n str = normalize(str).toLowerCase().replace(convert_pat, (\n /** @type {string} */\n char) => {\n return latin_convert[char] || '';\n }); //return str;\n\n return normalize(str, 'NFC');\n};\n/**\n * Generate a list of unicode variants from the list of code points\n * @param {TCodePoints} code_points\n * @yield {TCodePointObj}\n */\n\nfunction* generator(code_points) {\n for (const [code_point_min, code_point_max] of code_points) {\n for (let i = code_point_min; i <= code_point_max; i++) {\n let composed = String.fromCharCode(i);\n let folded = asciifold(composed);\n\n if (folded == composed.toLowerCase()) {\n continue;\n } // skip when folded is a string longer than 3 characters long\n // bc the resulting regex patterns will be long\n // eg:\n // folded صلى الله عليه وسلم length 18 code point 65018\n // folded جل جلاله length 8 code point 65019\n\n\n if (folded.length > max_char_length) {\n continue;\n }\n\n if (folded.length == 0) {\n continue;\n }\n\n yield {\n folded: folded,\n composed: composed,\n code_point: i\n };\n }\n }\n}\n/**\n * Generate a unicode map from the list of code points\n * @param {TCodePoints} code_points\n * @return {TUnicodeSets}\n */\n\nconst generateSets = code_points => {\n /** @type {{[key:string]:Set<string>}} */\n const unicode_sets = {};\n /**\n * @param {string} folded\n * @param {string} to_add\n */\n\n const addMatching = (folded, to_add) => {\n /** @type {Set<string>} */\n const folded_set = unicode_sets[folded] || new Set();\n const patt = new RegExp('^' + setToPattern(folded_set) + '$', 'iu');\n\n if (to_add.match(patt)) {\n return;\n }\n\n folded_set.add(escape_regex(to_add));\n unicode_sets[folded] = folded_set;\n };\n\n for (let value of generator(code_points)) {\n addMatching(value.folded, value.folded);\n addMatching(value.folded, value.composed);\n }\n\n return unicode_sets;\n};\n/**\n * Generate a unicode map from the list of code points\n * ae => (?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...))\n *\n * @param {TCodePoints} code_points\n * @return {TUnicodeMap}\n */\n\nconst generateMap = code_points => {\n /** @type {TUnicodeSets} */\n const unicode_sets = generateSets(code_points);\n /** @type {TUnicodeMap} */\n\n const unicode_map = {};\n /** @type {string[]} */\n\n let multi_char = [];\n\n for (let folded in unicode_sets) {\n let set = unicode_sets[folded];\n\n if (set) {\n unicode_map[folded] = setToPattern(set);\n }\n\n if (folded.length > 1) {\n multi_char.push(escape_regex(folded));\n }\n }\n\n multi_char.sort((a, b) => b.length - a.length);\n const multi_char_patt = arrayToPattern(multi_char);\n multi_char_reg = new RegExp('^' + multi_char_patt, 'u');\n return unicode_map;\n};\n/**\n * Map each element of an array from it's folded value to all possible unicode matches\n * @param {string[]} strings\n * @param {number} min_replacement\n * @return {string}\n */\n\nconst mapSequence = (strings, min_replacement = 1) => {\n let chars_replaced = 0;\n strings = strings.map(str => {\n if (unicode_map[str]) {\n chars_replaced += str.length;\n }\n\n return unicode_map[str] || str;\n });\n\n if (chars_replaced >= min_replacement) {\n return sequencePattern(strings);\n }\n\n return '';\n};\n/**\n * Convert a short string and split it into all possible patterns\n * Keep a pattern only if min_replacement is met\n *\n * 'abc'\n * \t\t=> [['abc'],['ab','c'],['a','bc'],['a','b','c']]\n *\t\t=> ['abc-pattern','ab-c-pattern'...]\n *\n *\n * @param {string} str\n * @param {number} min_replacement\n * @return {string}\n */\n\nconst substringsToPattern = (str, min_replacement = 1) => {\n min_replacement = Math.max(min_replacement, str.length - 1);\n return arrayToPattern(allSubstrings(str).map(sub_pat => {\n return mapSequence(sub_pat, min_replacement);\n }));\n};\n/**\n * Convert an array of sequences into a pattern\n * [{start:0,end:3,length:3,substr:'iii'}...] => (?:iii...)\n *\n * @param {Sequence[]} sequences\n * @param {boolean} all\n */\n\nconst sequencesToPattern = (sequences, all = true) => {\n let min_replacement = sequences.length > 1 ? 1 : 0;\n return arrayToPattern(sequences.map(sequence => {\n let seq = [];\n const len = all ? sequence.length() : sequence.length() - 1;\n\n for (let j = 0; j < len; j++) {\n seq.push(substringsToPattern(sequence.substrs[j] || '', min_replacement));\n }\n\n return sequencePattern(seq);\n }));\n};\n/**\n * Return true if the sequence is already in the sequences\n * @param {Sequence} needle_seq\n * @param {Sequence[]} sequences\n */\n\n\nconst inSequences = (needle_seq, sequences) => {\n for (const seq of sequences) {\n if (seq.start != needle_seq.start || seq.end != needle_seq.end) {\n continue;\n }\n\n if (seq.substrs.join('') !== needle_seq.substrs.join('')) {\n continue;\n }\n\n let needle_parts = needle_seq.parts;\n /**\n * @param {TSequencePart} part\n */\n\n const filter = part => {\n for (const needle_part of needle_parts) {\n if (needle_part.start === part.start && needle_part.substr === part.substr) {\n return false;\n }\n\n if (part.length == 1 || needle_part.length == 1) {\n continue;\n } // check for overlapping parts\n // a = ['::=','==']\n // b = ['::','===']\n // a = ['r','sm']\n // b = ['rs','m']\n\n\n if (part.start < needle_part.start && part.end > needle_part.start) {\n return true;\n }\n\n if (needle_part.start < part.start && needle_part.end > part.start) {\n return true;\n }\n }\n\n return false;\n };\n\n let filtered = seq.parts.filter(filter);\n\n if (filtered.length > 0) {\n continue;\n }\n\n return true;\n }\n\n return false;\n};\n\nclass Sequence {\n constructor() {\n /** @type {TSequencePart[]} */\n this.parts = [];\n /** @type {string[]} */\n\n this.substrs = [];\n this.start = 0;\n this.end = 0;\n }\n /**\n * @param {TSequencePart|undefined} part\n */\n\n\n add(part) {\n if (part) {\n this.parts.push(part);\n this.substrs.push(part.substr);\n this.start = Math.min(part.start, this.start);\n this.end = Math.max(part.end, this.end);\n }\n }\n\n last() {\n return this.parts[this.parts.length - 1];\n }\n\n length() {\n return this.parts.length;\n }\n /**\n * @param {number} position\n * @param {TSequencePart} last_piece\n */\n\n\n clone(position, last_piece) {\n let clone = new Sequence();\n let parts = JSON.parse(JSON.stringify(this.parts));\n let last_part = parts.pop();\n\n for (const part of parts) {\n clone.add(part);\n }\n\n let last_substr = last_piece.substr.substring(0, position - last_part.start);\n let clone_last_len = last_substr.length;\n clone.add({\n start: last_part.start,\n end: last_part.start + clone_last_len,\n length: clone_last_len,\n substr: last_substr\n });\n return clone;\n }\n\n}\n/**\n * Expand a regular expression pattern to include unicode variants\n * \teg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/\n *\n * Issue:\n * ﺊﺋ [ 'ﺊ = \\\\u{fe8a}', 'ﺋ = \\\\u{fe8b}' ]\n *\tbecomes:\tئئ [ 'ي = \\\\u{64a}', 'ٔ = \\\\u{654}', 'ي = \\\\u{64a}', 'ٔ = \\\\u{654}' ]\n *\n *\tİIJ = IIJ = ⅡJ\n *\n * \t1/2/4\n *\n * @param {string} str\n * @return {string|undefined}\n */\n\n\nconst getPattern = str => {\n initialize();\n str = asciifold(str);\n let pattern = '';\n let sequences = [new Sequence()];\n\n for (let i = 0; i < str.length; i++) {\n let substr = str.substring(i);\n let match = substr.match(multi_char_reg);\n const char = str.substring(i, i + 1);\n const match_str = match ? match[0] : null; // loop through sequences\n // add either the char or multi_match\n\n let overlapping = [];\n let added_types = new Set();\n\n for (const sequence of sequences) {\n const last_piece = sequence.last();\n\n if (!last_piece || last_piece.length == 1 || last_piece.end <= i) {\n // if we have a multi match\n if (match_str) {\n const len = match_str.length;\n sequence.add({\n start: i,\n end: i + len,\n length: len,\n substr: match_str\n });\n added_types.add('1');\n } else {\n sequence.add({\n start: i,\n end: i + 1,\n length: 1,\n substr: char\n });\n added_types.add('2');\n }\n } else if (match_str) {\n let clone = sequence.clone(i, last_piece);\n const len = match_str.length;\n clone.add({\n start: i,\n end: i + len,\n length: len,\n substr: match_str\n });\n overlapping.push(clone);\n } else {\n // don't add char\n // adding would create invalid patterns: 234 => [2,34,4]\n added_types.add('3');\n }\n } // if we have overlapping\n\n\n if (overlapping.length > 0) {\n // ['ii','iii'] before ['i','i','iii']\n overlapping = overlapping.sort((a, b) => {\n return a.length() - b.length();\n });\n\n for (let clone of overlapping) {\n // don't add if we already have an equivalent sequence\n if (inSequences(clone, sequences)) {\n continue;\n }\n\n sequences.push(clone);\n }\n\n continue;\n } // if we haven't done anything unique\n // clean up the patterns\n // helps keep patterns smaller\n // if str = 'r₨㎧aarss', pattern will be 446 instead of 655\n\n\n if (i > 0 && added_types.size == 1 && !added_types.has('3')) {\n pattern += sequencesToPattern(sequences, false);\n let new_seq = new Sequence();\n const old_seq = sequences[0];\n\n if (old_seq) {\n new_seq.add(old_seq.last());\n }\n\n sequences = [new_seq];\n }\n }\n\n pattern += sequencesToPattern(sequences, true);\n return pattern;\n};\n\nexport { _asciifold, asciifold, code_points, generateMap, generateSets, generator, getPattern, initialize, mapSequence, normalize, substringsToPattern, unicode_map };\n//# sourceMappingURL=index.js.map\n","\nimport { asciifold } from '@orchidjs/unicode-variants';\nimport * as T from './types';\n\n\n/**\n * A property getter resolving dot-notation\n * @param {Object} obj The root object to fetch property on\n * @param {String} name The optionally dotted property name to fetch\n * @return {Object} The resolved property value\n */\nexport const getAttr = (obj:{[key:string]:any}, name:string ) => {\n if (!obj ) return;\n return obj[name];\n};\n\n/**\n * A property getter resolving dot-notation\n * @param {Object} obj The root object to fetch property on\n * @param {String} name The optionally dotted property name to fetch\n * @return {Object} The resolved property value\n */\nexport const getAttrNesting = (obj:{[key:string]:any}, name:string ) => {\n if (!obj ) return;\n var part, names = name.split(\".\");\n\twhile( (part = names.shift()) && (obj = obj[part]));\n return obj;\n};\n\n/**\n * Calculates how close of a match the\n * given value is against a search token.\n *\n */\nexport const scoreValue = (value:string, token:T.Token, weight:number ):number => {\n\tvar score, pos;\n\n\tif (!value) return 0;\n\n\tvalue = value + '';\n\tif( token.regex == null ) return 0;\n\tpos = value.search(token.regex);\n\tif (pos === -1) return 0;\n\n\tscore = token.string.length / value.length;\n\tif (pos === 0) score += 0.5;\n\n\treturn score * weight;\n};\n\n\n/**\n * Cast object property to an array if it exists and has a value\n *\n */\nexport const propToArray = (obj:{[key:string]:any}, key:string) => {\n\tvar value = obj[key];\n\n\tif( typeof value == 'function' ) return value;\n\n\tif( value && !Array.isArray(value) ){\n\t\tobj[key] = [value];\n\t}\n}\n\n\n/**\n * Iterates over arrays and hashes.\n *\n * ```\n * iterate(this.items, function(item, id) {\n * // invoked for each item\n * });\n * ```\n *\n */\nexport const iterate = (object:[]|{[key:string]:any}, callback:(value:any,key:any)=>any) => {\n\n\tif ( Array.isArray(object)) {\n\t\tobject.forEach(callback);\n\n\t}else{\n\n\t\tfor (var key in object) {\n\t\t\tif (object.hasOwnProperty(key)) {\n\t\t\t\tcallback(object[key], key);\n\t\t\t}\n\t\t}\n\t}\n};\n\n\n\nexport const cmp = (a:number|string, b:number|string) => {\n\tif (typeof a === 'number' && typeof b === 'number') {\n\t\treturn a > b ? 1 : (a < b ? -1 : 0);\n\t}\n\ta = asciifold(a + '').toLowerCase();\n\tb = asciifold(b + '').toLowerCase();\n\tif (a > b) return 1;\n\tif (b > a) return -1;\n\treturn 0;\n};\n","\nimport { iterate } from '@orchidjs/sifter/lib/utils';\n\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * param query should be {}\n */\nexport const getDom = ( query:any ):HTMLElement => {\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( isHtmlString(query) ){\n\t\tvar tpl = document.createElement('template');\n\t\ttpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn tpl.content.firstChild as HTMLElement;\n\t}\n\n\treturn document.querySelector(query);\n};\n\nexport const isHtmlString = (arg:any): boolean => {\n\tif( typeof arg === 'string' && arg.indexOf('<') > -1 ){\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport const escapeQuery = (query:string):string => {\n\treturn query.replace(/['\"\\\\]/g, '\\\\$&');\n}\n\n/**\n * Dispatch an event\n *\n */\nexport const triggerEvent = ( dom_el:HTMLElement, event_name:string ):void => {\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n */\nexport const applyCSS = ( dom_el:HTMLElement, css:{ [key: string]: string|number }):void => {\n\tObject.assign(dom_el.style, css);\n}\n\n\n/**\n * Add css classes\n *\n */\nexport const addClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n\tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export const removeClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n \tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n */\nexport const classesArray = (args:string[]|string[][]):string[] => {\n\tvar classes:string[] = [];\n\titerate( args, (_classes) =>{\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t});\n\n\treturn classes.filter(Boolean);\n}\n\n\n/**\n * Create an array from arg if it's not already an array\n *\n */\nexport const castAsArray = (arg:any):Array<any> => {\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n */\nexport const parentMatch = ( target:null|HTMLElement, selector:string, wrapper?:HTMLElement ):HTMLElement|void => {\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode as HTMLElement;\n\t}\n}\n\n\n/**\n * Get the first or last item from an array\n *\n * > 0 - right (last)\n * <= 0 - left (first)\n *\n */\nexport const getTail = ( list:Array<any>|NodeList, direction:number=0 ):any => {\n\n\tif( direction > 0 ){\n\t\treturn list[list.length-1];\n\t}\n\n\treturn list[0];\n}\n\n/**\n * Return true if an object is empty\n *\n */\nexport const isEmptyObject = (obj:object):boolean => {\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n */\nexport const nodeIndex = ( el:null|Element, amongst?:string ):number => {\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n\n\n/**\n * Set attributes of an element\n *\n */\nexport const setAttr = (el:Element,attrs:{ [key: string]: null|string|number }) => {\n\titerate( attrs,(val,attr) => {\n\t\tif( val == null ){\n\t\t\tel.removeAttribute(attr as string);\n\t\t}else{\n\t\t\tel.setAttribute(attr as string, ''+val);\n\t\t}\n\t});\n}\n\n\n/**\n * Replace a node\n */\nexport const replaceNode = ( existing:Node, replacement:Node ) => {\n\tif( existing.parentNode ) existing.parentNode.replaceChild(replacement, existing);\n}\n","/**\n * Plugin: \"drag_drop\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select';\nimport { TomOption, TomItem } from '../../types/index';\nimport { escape_html, preventDefault, addEvent } from '../../utils';\nimport { getDom, setAttr } from '../../vanilla';\n\n\nconst insertAfter = (referenceNode:Element, newNode:Element) => {\n\treferenceNode.parentNode?.insertBefore(newNode, referenceNode.nextSibling);\n}\n\nconst insertBefore = (referenceNode:Element, newNode:Element) => {\n\treferenceNode.parentNode?.insertBefore(newNode, referenceNode);\n}\n\nconst isBefore = (referenceNode:Element|undefined|null, newNode:Element|undefined|null) =>{\n\t\n\tdo{\n\t\tnewNode = newNode?.previousElementSibling;\n\n\t\tif( referenceNode == newNode ){\n\t\t\treturn true;\n\t\t}\n\n\t}while( newNode && newNode.previousElementSibling );\n\n\treturn false;\n}\n\nexport default function(this:TomSelect) {\n\tvar self = this;\n\tif (self.settings.mode !== 'multi') return;\n\n\tvar orig_lock\t\t= self.lock;\n\tvar orig_unlock\t\t= self.unlock;\n\tlet sortable = true;\n\t\tlet drag_item:TomItem|undefined;\n\n\n\t/**\n\t * Add draggable attribute to item\n\t */\n\tself.hook('after','setupTemplates',() => {\n\n\t\tvar orig_render_item = self.settings.render.item;\n\n\t\tself.settings.render.item = (data:TomOption, escape:typeof escape_html) => {\n\t\t\tconst item = getDom(orig_render_item.call(self, data, escape)) as TomItem;\n\t\t\tsetAttr(item,{'draggable':'true'});\n\n\n\t\t\t// prevent doc_mousedown (see tom-select.ts)\n\t\t\tconst mousedown = (evt:Event) => {\n\t\t\t\tif( !sortable ) preventDefault(evt);\n\t\t\t\tevt.stopPropagation();\n\t\t\t}\n\n\t\t\tconst dragStart = (evt:Event) => {\n\t\t\t\tdrag_item = item;\n\t\t\t\t\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\titem.classList.add('ts-dragging');\n\t\t\t\t}, 0);\n\t\t\t\t\n\t\t\t}\n\n\t\t\tconst dragOver = (evt:Event) =>{\n\t\t\t\tevt.preventDefault();\n\t\t\t\titem.classList.add('ts-drag-over');\n\t\t\t\tmoveitem(item,drag_item);\n\t\t\t}\n\n\t\t\tconst dragLeave = () => {\n\t\t\t\titem.classList.remove('ts-drag-over');\n\t\t\t}\n\n\t\t\tconst moveitem = (targetitem:TomItem, dragitem:TomItem|undefined) => {\n\t\t\t\tif( dragitem === undefined ) return;\n\t\t\t\t\n\t\t\t\tif( isBefore(dragitem,item) ){\n\t\t\t\t\tinsertAfter(targetitem,dragitem);\n\t\t\t\t}else{\n\t\t\t\t\tinsertBefore(targetitem,dragitem);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst dragend = () => {\n\t\t\t\tdocument.querySelectorAll('.ts-drag-over').forEach(el=> el.classList.remove('ts-drag-over'));\n\t\t\t\tdrag_item?.classList.remove('ts-dragging');\n\t\t\t\tdrag_item = undefined;\n\n\t\t\t\tvar values:string[] = [];\n\t\t\t\tself.control.querySelectorAll(`[data-value]`).forEach((el:Element)=> {\n\t\t\t\t\tif( (<HTMLOptionElement>el).dataset.value ){\n\t\t\t\t\t\tlet value = (<HTMLOptionElement>el).dataset.value;\n\t\t\t\t\t\tif( value ){\n\t\t\t\t\t\t\tvalues.push(value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tself.setValue(values);\n\t\t\t}\t\n\n\n\t\t\taddEvent(item,'mousedown', mousedown);\n\t\t\taddEvent(item,'dragstart', dragStart);\n\t\t\taddEvent(item,'dragenter', dragOver)\n\t\t\taddEvent(item,'dragover', dragOver);\n\t\t\taddEvent(item,'dragleave', dragLeave);\n\t\t\taddEvent(item,'dragend', dragend);\n\t\t\t\t\n\t\t\treturn item;\n\t\t}\t\n\t});\n\n\n\n\tself.hook('instead','lock',()=>{\n\t\tsortable = false;\n\t\treturn orig_lock.call(self);\n\t});\n\n\tself.hook('instead','unlock',()=>{\n\t\tsortable = true;\n\t\treturn orig_unlock.call(self);\n\t});\n\n};\n"],"names":["preventDefault","evt","stop","stopPropagation","addEvent","target","type","callback","options","addEventListener","iterate","object","Array","isArray","forEach","key","hasOwnProperty","getDom","query","jquery","HTMLElement","isHtmlString","tpl","document","createElement","innerHTML","trim","content","firstChild","querySelector","arg","indexOf","setAttr","el","attrs","val","attr","removeAttribute","setAttribute","insertAfter","referenceNode","newNode","_referenceNode$parent","parentNode","insertBefore","nextSibling","_referenceNode$parent2","isBefore","_newNode","previousElementSibling","self","settings","mode","orig_lock","lock","orig_unlock","unlock","sortable","drag_item","hook","orig_render_item","render","item","data","escape","call","mousedown","dragStart","setTimeout","classList","add","dragOver","moveitem","dragLeave","remove","targetitem","dragitem","undefined","dragend","_drag_item","querySelectorAll","values","control","dataset","value","push","setValue"],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA6GA;AACA;AACA;AACA;AACO,MAAMA,cAAc,GAAGA,CAACC,GAAU,EAAEC,IAAY,GAAC,KAAK,KAAU;AACtE,EAAA,IAAID,GAAG,EAAE;IACRA,GAAG,CAACD,cAAc,EAAE,CAAA;AACpB,IAAA,IAAIE,IAAI,EAAE;MACTD,GAAG,CAACE,eAAe,EAAE,CAAA;AACtB,KAAA;AACD,GAAA;AACD,CAAC,CAAA;;AAGD;AACA;AACA;AACA;AACO,MAAMC,QAAQ,GAAGA,CAACC,MAAkB,EAAEC,IAAW,EAAEC,QAA2C,EAAEC,OAAe,KAAU;EAC/HH,MAAM,CAACI,gBAAgB,CAACH,IAAI,EAACC,QAAQ,EAACC,OAAO,CAAC,CAAA;AAC/C,CAAC;;ACnJD;AAeA,MAAM,UAAU,GAAG,qCAAqC,CAAC;AAQzD;AACA;AACA,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB;AACA;AACA,MAAM,eAAe,GAAG;AACxB,EAAE,GAAG,EAAE,IAAI;AACX,EAAE,GAAG,EAAE,GAAG;AACV,EAAE,GAAG,EAAE,KAAK;AACZ,EAAE,IAAI,EAAE,GAAG;AACX,EAAE,IAAI,EAAE,KAAK;AACb,EAAE,IAAI,EAAE,GAAG;AACX,EAAE,IAAI,EAAE,GAAG;AACX,EAAE,IAAI,EAAE,IAAI;AACZ,EAAE,IAAI,EAAE,GAAG;AACX,EAAE,GAAG,EAAE,KAAK;AACZ,EAAE,GAAG,EAAE,MAAM;AACb,EAAE,GAAG,EAAE,UAAU;AACjB,EAAE,GAAG,EAAE,MAAM;AACb,EAAE,GAAG,EAAE,IAAI;AACX,EAAE,GAAG,EAAE,QAAQ;AACf,EAAE,GAAG,EAAE,MAAM;AACb,EAAE,GAAG,EAAE,IAAI;AACX,EAA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