PageSourceSearch

https://www.medidata.com/wp-content/themes/md-hello-child/legacy/v2/src/js/vendors/jquery-chosen.js?ver=414

js medidata.com collected 2026-10-02 02:24:30 UTC 46,100 bytes, 1,103 lines download raw bytes

1/* Chosen v1.8.7 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
3;(function () {
4  var t,
5    e,
6    s,
7    i,
8    n = function (t, e) {
9      return function () {
10        return t.apply(e, arguments)
11      }
12    },
13    r = function (t, e) {
14      function s() {
15        this.constructor = t
16      }
17      for (var i in e) o.call(e, i) && (t[i] = e[i])
18      return (s.prototype = e.prototype), (t.prototype = new s()), (t.__super__ = e.prototype), t
19    },
20    o = {}.hasOwnProperty
21  ;((i = (function () {
22    function t() {
23      ;(this.options_index = 0), (this.parsed = [])
24    }
25    return (
26      (t.prototype.add_node = function (t) {
27        return 'OPTGROUP' === t.nodeName.toUpperCase() ? this.add_group(t) : this.add_option(t)
28      }),
29      (t.prototype.add_group = function (t) {
30        var e, s, i, n, r, o
31        for (
32          e = this.parsed.length,
33            this.parsed.push({
34              array_index: e,
35              group: !0,
36              label: t.label,
37              title: t.title ? t.title : void 0,
38              children: 0,
39              disabled: t.disabled,
40              classes: t.className,
41            }),
42            o = [],
43            s = 0,
44            i = (r = t.childNodes).length;
45          s < i;
46          s++
47        )
48          (n = r[s]), o.push(this.add_option(n, e, t.disabled))
49        return o
50      }),
51      (t.prototype.add_option = function (t, e, s) {
52        if ('OPTION' === t.nodeName.toUpperCase())
53          return (
54            '' !== t.text
55              ? (null != e && (this.parsed[e].children += 1),
56                this.parsed.push({
57                  array_index: this.parsed.length,
58                  options_index: this.options_index,
59                  value: t.value,
60                  text: t.text,
61                  html: t.innerHTML,
62                  title: t.title ? t.title : void 0,
63                  selected: t.selected,
64                  disabled: !0 === s ? s : t.disabled,
65                  group_array_index: e,
66                  group_label: null != e ? this.parsed[e].label : null,
67                  classes: t.className,
68                  style: t.style.cssText,
69                }))
70              : this.parsed.push({ array_index: this.parsed.length, options_index: this.options_index, empty: !0 }),
71            (this.options_index += 1)
72          )
73      }),
74      t
75    )
76  })()).select_to_array = function (t) {
77    var e, s, n, r, o
78    for (r = new i(), s = 0, n = (o = t.childNodes).length; s < n; s++) (e = o[s]), r.add_node(e)
79    return r.parsed
80  }),
81    (e = (function () {
82      function t(e, s) {
83        ;(this.form_field = e),
84          (this.options = null != s ? s : {}),
85          (this.label_click_handler = n(this.label_click_handler, this)),
86          t.browser_is_supported() &&
87            ((this.is_multiple = this.form_field.multiple),
88            this.set_default_text(),
89            this.set_default_values(),
90            this.setup(),
91            this.set_up_html(),
92            this.register_observers(),
93            this.on_ready())
94      }
95      return (
96        (t.prototype.set_default_values = function () {
97          return (
98            (this.click_test_action = (function (t) {
99              return function (e) {
100                return t.test_active_click(e)
101              }
102            })(this)),
103            (this.activate_action = (function (t) {
104              return function (e) {
105                return t.activate_field(e)
106              }
107            })(this)),
108            (this.active_field = !1),
109            (this.mouse_on_container = !1),
110            (this.results_showing = !1),
111            (this.result_highlighted = null),
112            (this.is_rtl = this.options.rtl || /\bchosen-rtl\b/.test(this.form_field.className)),
113            (this.allow_single_deselect =
114              null != this.options.allow_single_deselect &&
115              null != this.form_field.options[0] &&
116              '' === this.form_field.options[0].text &&
117              this.options.allow_single_deselect),
118            (this.disable_search_threshold = this.options.disable_search_threshold || 0),
119            (this.disable_search = this.options.disable_search || !1),
120            (this.enable_split_word_search =
121              null == this.options.enable_split_word_search || this.options.enable_split_word_search),
122            (this.group_search = null == this.options.group_search || this.options.group_search),
123            (this.search_contains = this.options.search_contains || !1),
124            (this.single_backstroke_delete =
125              null == this.options.single_backstroke_delete || this.options.single_backstroke_delete),
126            (this.max_selected_options = this.options.max_selected_options || Infinity),
127            (this.inherit_select_classes = this.options.inherit_select_classes || !1),
128            (this.display_selected_options =
129              null == this.options.display_selected_options || this.options.display_selected_options),
130            (this.display_disabled_options =
131              null == this.options.display_disabled_options || this.options.display_disabled_options),
132            (this.include_group_label_in_selected = this.options.include_group_label_in_selected || !1),
133            (this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY),
134            (this.case_sensitive_search = this.options.case_sensitive_search || !1),
135            (this.hide_results_on_select =
136              null == this.options.hide_results_on_select || this.options.hide_results_on_select)
137          )
138        }),
139        (t.prototype.set_default_text = function () {
140          return (
141            this.form_field.getAttribute('data-placeholder')
142              ? (this.default_text = this.form_field.getAttribute('data-placeholder'))
143              : this.is_multiple
144              ? (this.default_text =
145                  this.options.placeholder_text_multiple || this.options.placeholder_text || t.default_multiple_text)
146              : (this.default_text =
147                  this.options.placeholder_text_single || this.options.placeholder_text || t.default_single_text),
148            (this.default_text = this.escape_html(this.default_text)),
149            (this.results_none_found =
150              this.form_field.getAttribute('data-no_results_text') ||
151              this.options.no_results_text ||
152              t.default_no_result_text)
153          )
154        }),
155        (t.prototype.choice_label = function (t) {
156          return this.include_group_label_in_selected && null != t.group_label
157            ? "<b class='group-name'>" + this.escape_html(t.group_label) + '</b>' + t.html
158            : t.html
159        }),
160        (t.prototype.mouse_enter = function () {
161          return (this.mouse_on_container = !0)
162        }),
163        (t.prototype.mouse_leave = function () {
164          return (this.mouse_on_container = !1)
165        }),
166        (t.prototype.input_focus = function (t) {
167          if (this.is_multiple) {
168            if (!this.active_field)
169              return setTimeout(
170                (function (t) {
171                  return function () {
172                    return t.container_mousedown()
173                  }
174                })(this),
175                50
176              )
177          } else if (!this.active_field) return this.activate_field()
178        }),
179        (t.prototype.input_blur = function (t) {
180          if (!this.mouse_on_container)
181            return (
182              (this.active_field = !1),
183              setTimeout(
184                (function (t) {
185                  return function () {
186                    return t.blur_test()
187                  }
188                })(this),
189                100
190              )
191            )
192        }),
193        (t.prototype.label_click_handler = function (t) {
194          return this.is_multiple ? this.container_mousedown(t) : this.activate_field()
195        }),
196        (t.prototype.results_option_build = function (t) {
197          var e, s, i, n, r, o, h
198          for (
199            e = '', h = 0, n = 0, r = (o = this.results_data).length;
200            n < r &&
201            ((s = o[n]),
202            (i = ''),
203            '' !== (i = s.group ? this.result_add_group(s) : this.result_add_option(s)) && (h++, (e += i)),
204            (null != t ? t.first : void 0) &&
205              (s.selected && this.is_multiple
206                ? this.choice_build(s)
207                : s.selected && !this.is_multiple && this.single_set_selected_text(this.choice_label(s))),
208            !(h >= this.max_shown_results));
209            n++
210          );
211          return e
212        }),
213        (t.prototype.result_add_option = function (t) {
214          var e, s
215          return t.search_match && this.include_option_in_results(t)
216            ? ((e = []),
217              t.disabled || (t.selected && this.is_multiple) || e.push('active-result'),
218              !t.disabled || (t.selected && this.is_multiple) || e.push('disabled-result'),
219              t.selected && e.push('result-selected'),
220              null != t.group_array_index && e.push('group-option'),
221              '' !== t.classes && e.push(t.classes),
222              (s = document.createElement('li')),
223              (s.className = e.join(' ')),
224              t.style && (s.style.cssText = t.style),
225              s.setAttribute('data-option-array-index', t.array_index),
226              (s.innerHTML = t.highlighted_html || t.html),
227              t.title && (s.title = t.title),
228              this.outerHTML(s))
229            : ''
230        }),
231        (t.prototype.result_add_group = function (t) {
232          var e, s
233          return (t.search_match || t.group_match) && t.active_options > 0
234            ? ((e = []).push('group-result'),
235              t.classes && e.push(t.classes),
236              (s = document.createElement('li')),
237              (s.className = e.join(' ')),
238              (s.innerHTML = t.highlighted_html || this.escape_html(t.label)),
239              t.title && (s.title = t.title),
240              this.outerHTML(s))
241            : ''
242        }),
243        (t.prototype.results_update_field = function () {
244          if (
245            (this.set_default_text(),
246            this.is_multiple || this.results_reset_cleanup(),
247            this.result_clear_highlight(),
248            this.results_build(),
249            this.results_showing)
250          )
251            return this.winnow_results()
252        }),
253        (t.prototype.reset_single_select_options = function () {
254          var t, e, s, i, n
255          for (n = [], t = 0, e = (s = this.results_data).length; t < e; t++)
256            (i = s[t]).selected ? n.push((i.selected = !1)) : n.push(void 0)
257          return n
258        }),
259        (t.prototype.results_toggle = function () {
260          return this.results_showing ? this.results_hide() : this.results_show()
261        }),
262        (t.prototype.results_search = function (t) {
263          return this.results_showing ? this.winnow_results() : this.results_show()
264        }),
265        (t.prototype.winnow_results = function (t) {
266          var e, s, i, n, r, o, h, l, c, _, a, u, d, p, f
267          for (
268            this.no_results_clear(),
269              _ = 0,
270              e = (h = this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'),
271              c = this.get_search_regex(e),
272              i = 0,
273              n = (l = this.results_data).length;
274            i < n;
275            i++
276          )
277            ((r = l[i]).search_match = !1),
278              (a = null),
279              (u = null),
280              (r.highlighted_html = ''),
281              this.include_option_in_results(r) &&
282                (r.group && ((r.group_match = !1), (r.active_options = 0)),
283                null != r.group_array_index &&
284                  this.results_data[r.group_array_index] &&
285                  (0 === (a = this.results_data[r.group_array_index]).active_options && a.search_match && (_ += 1),
286                  (a.active_options += 1)),
287                (f = r.group ? r.label : r.text),
288                (r.group && !this.group_search) ||
289                  ((u = this.search_string_match(f, c)),
290                  (r.search_match = null != u),
291                  r.search_match && !r.group && (_ += 1),
292                  r.search_match
293                    ? (h.length &&
294                        ((d = u.index),
295                        (o = f.slice(0, d)),
296                        (s = f.slice(d, d + h.length)),
297                        (p = f.slice(d + h.length)),
298                        (r.highlighted_html =
299                          this.escape_html(o) + '<em>' + this.escape_html(s) + '</em>' + this.escape_html(p))),
300                      null != a && (a.group_match = !0))
301                    : null != r.group_array_index &&
302                      this.results_data[r.group_array_index].search_match &&
303                      (r.search_match = !0)))
304          return (
305            this.result_clear_highlight(),
306            _ < 1 && h.length
307              ? (this.update_results_content(''), this.no_results(h))
308              : (this.update_results_content(this.results_option_build()),
309                (null != t ? t.skip_highlight : void 0) ? void 0 : this.winnow_results_set_highlight())
310          )
311        }),
312        (t.prototype.get_search_regex = function (t) {
313          var e, s
314          return (
315            (s = this.search_contains ? t : '(^|\\s|\\b)' + t + '[^\\s]*'),
316            this.enable_split_word_search || this.search_contains || (s = '^' + s),
317            (e = this.case_sensitive_search ? '' : 'i'),
318            new RegExp(s, e)
319          )
320        }),
321        (t.prototype.search_string_match = function (t, e) {
322          var s
323          return (s = e.exec(t)), !this.search_contains && (null != s ? s[1] : void 0) && (s.index += 1), s
324        }),
325        (t.prototype.choices_count = function () {
326          var t, e, s
327          if (null != this.selected_option_count) return this.selected_option_count
328          for (this.selected_option_count = 0, t = 0, e = (s = this.form_field.options).length; t < e; t++)
329            s[t].selected && (this.selected_option_count += 1)
330          return this.selected_option_count
331        }),
332        (t.prototype.choices_click = function (t) {
333          if ((t.preventDefault(), this.activate_field(), !this.results_showing && !this.is_disabled))
334            return this.results_show()
335        }),
336        (t.prototype.keydown_checker = function (t) {
337          var e, s
338          switch (
339            ((s = null != (e = t.which) ? e : t.keyCode),
340            this.search_field_scale(),
341            8 !== s && this.pending_backstroke && this.clear_backstroke(),
342            s)
343          ) {
344            case 8:
345              this.backstroke_length = this.get_search_field_value().length
346              break
347            case 9:
348              this.results_showing && !this.is_multiple && this.result_select(t), (this.mouse_on_container = !1)
349              break
350            case 13:
351            case 27:
352              this.results_showing && t.preventDefault()
353              break
354            case 32:
355              this.disable_search && t.preventDefault()
356              break
357            case 38:
358              t.preventDefault(), this.keyup_arrow()
359              break
360            case 40:
361              t.preventDefault(), this.keydown_arrow()
362          }
363        }),
364        (t.prototype.keyup_checker = function (t) {
365          var e, s
366          switch (((s = null != (e = t.which) ? e : t.keyCode), this.search_field_scale(), s)) {
367            case 8:
368              this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0
369                ? this.keydown_backstroke()
370                : this.pending_backstroke || (this.result_clear_highlight(), this.results_search())
371              break
372            case 13:
373              t.preventDefault(), this.results_showing && this.result_select(t)
374              break
375            case 27:
376              this.results_showing && this.results_hide()
377              break
378            case 9:
379            case 16:
380            case 17:
381            case 18:
382            case 38:
383            case 40:
384            case 91:
385              break
386            default:
387              this.results_search()
388          }
389        }),
390        (t.prototype.clipboard_event_checker = function (t) {
391          if (!this.is_disabled)
392            return setTimeout(
393              (function (t) {
394                return function () {
395                  return t.results_search()
396                }
397              })(this),
398              50
399            )
400        }),
401        (t.prototype.container_width = function () {
402          return null != this.options.width ? this.options.width : this.form_field.offsetWidth + 'px'
403        }),
404        (t.prototype.include_option_in_results = function (t) {
405          return (
406            !(this.is_multiple && !this.display_selected_options && t.selected) &&
407            !(!this.display_disabled_options && t.disabled) &&
408            !t.empty
409          )
410        }),
411        (t.prototype.search_results_touchstart = function (t) {
412          return (this.touch_started = !0), this.search_results_mouseover(t)
413        }),
414        (t.prototype.search_results_touchmove = function (t) {
415          return (this.touch_started = !1), this.search_results_mouseout(t)
416        }),
417        (t.prototype.search_results_touchend = function (t) {
418          if (this.touch_started) return this.search_results_mouseup(t)
419        }),
420        (t.prototype.outerHTML = function (t) {
421          var e
422          return t.outerHTML ? t.outerHTML : ((e = document.createElement('div')).appendChild(t), e.innerHTML)
423        }),
424        (t.prototype.get_single_html = function () {
425          return (
426            '<a class="chosen-single chosen-default">\n  <span>' +
427            this.default_text +
428            '</span>\n  <div><b></b></div>\n</a>\n<div class="chosen-drop">\n  <div class="chosen-search">\n    <input class="chosen-search-input" type="text" autocomplete="off" />\n  </div>\n  <ul class="chosen-results"></ul>\n</div>'
429          )
430        }),
431        (t.prototype.get_multi_html = function () {
432          return (
433            '<ul class="chosen-choices">\n  <li class="search-field">\n    <input class="chosen-search-input" type="text" autocomplete="off" value="' +
434            this.default_text +
435            '" />\n  </li>\n</ul>\n<div class="chosen-drop">\n  <ul class="chosen-results"></ul>\n</div>'
436          )
437        }),
438        (t.prototype.get_no_results_html = function (t) {
439          return (
440            '<li class="no-results">\n  ' + this.results_none_found + ' <span>' + this.escape_html(t) + '</span>\n</li>'
441          )
442        }),
443        (t.browser_is_supported = function () {
444          return 'Microsoft Internet Explorer' === window.navigator.appName
445            ? document.documentMode >= 8
446            : !(
447                /iP(od|hone)/i.test(window.navigator.userAgent) ||
448                /IEMobile/i.test(window.navigator.userAgent) ||
449                /Windows Phone/i.test(window.navigator.userAgent) ||
450                /BlackBerry/i.test(window.navigator.userAgent) ||
451                /BB10/i.test(window.navigator.userAgent) ||
452                /Android.*Mobile/i.test(window.navigator.userAgent)
453              )
454        }),
455        (t.default_multiple_text = 'Select Some Options'),
456        (t.default_single_text = 'Select an Option'),
457        (t.default_no_result_text = 'No results match'),
458        t
459      )
460    })()),
461    (t = jQuery).fn.extend({
462      chosen: function (i) {
463        return e.browser_is_supported()
464          ? this.each(function (e) {
465              var n, r
466              ;(r = (n = t(this)).data('chosen')),
467                'destroy' !== i ? r instanceof s || n.data('chosen', new s(this, i)) : r instanceof s && r.destroy()
468            })
469          : this
470      },
471    }),
472    (s = (function (s) {
473      function n() {
474        return n.__super__.constructor.apply(this, arguments)
475      }
476      return (
477        r(n, e),
478        (n.prototype.setup = function () {
479          return (this.form_field_jq = t(this.form_field)), (this.current_selectedIndex = this.form_field.selectedIndex)
480        }),
481        (n.prototype.set_up_html = function () {
482          var e, s
483          return (
484            (e = ['chosen-container']).push('chosen-container-' + (this.is_multiple ? 'multi' : 'single')),
485            this.inherit_select_classes && this.form_field.className && e.push(this.form_field.className),
486            this.is_rtl && e.push('chosen-rtl'),
487            (s = { class: e.join(' '), title: this.form_field.title }),
488            this.form_field.id.length && (s.id = this.form_field.id.replace(/[^\w]/g, '_') + '_chosen'),
489            (this.container = t('<div />', s)),
490            this.container.width(this.container_width()),
491            this.is_multiple ? this.container.html(this.get_multi_html()) : this.container.html(this.get_single_html()),
492            this.form_field_jq.hide().after(this.container),
493            (this.dropdown = this.container.find('div.chosen-drop').first()),
494            (this.search_field = this.container.find('input').first()),
495            (this.search_results = this.container.find('ul.chosen-results').first()),
496            this.search_field_scale(),
497            (this.search_no_results = this.container.find('li.no-results').first()),
498            this.is_multiple
499              ? ((this.search_choices = this.container.find('ul.chosen-choices').first()),
500                (this.search_container = this.container.find('li.search-field').first()))
501              : ((this.search_container = this.container.find('div.chosen-search').first()),
502                (this.selected_item = this.container.find('.chosen-single').first())),
503            this.results_build(),
504            this.set_tab_index(),
505            this.set_label_behavior()
506          )
507        }),
508        (n.prototype.on_ready = function () {
509          return this.form_field_jq.trigger('chosen:ready', { chosen: this })
510        }),
511        (n.prototype.register_observers = function () {
512          return (
513            this.container.on(
514              'touchstart.chosen',
515              (function (t) {
516                return function (e) {
517                  t.container_mousedown(e)
518                }
519              })(this)
520            ),
521            this.container.on(
522              'touchend.chosen',
523              (function (t) {
524                return function (e) {
525                  t.container_mouseup(e)
526                }
527              })(this)
528            ),
529            this.container.on(
530              'mousedown.chosen',
531              (function (t) {
532                return function (e) {
533                  t.container_mousedown(e)
534                }
535              })(this)
536            ),
537            this.container.on(
538              'mouseup.chosen',
539              (function (t) {
540                return function (e) {
541                  t.container_mouseup(e)
542                }
543              })(this)
544            ),
545            this.container.on(
546              'mouseenter.chosen',
547              (function (t) {
548                return function (e) {
549                  t.mouse_enter(e)
550                }
551              })(this)
552            ),
553            this.container.on(
554              'mouseleave.chosen',
555              (function (t) {
556                return function (e) {
557                  t.mouse_leave(e)
558                }
559              })(this)
560            ),
561            this.search_results.on(
562              'mouseup.chosen',
563              (function (t) {
564                return function (e) {
565                  t.search_results_mouseup(e)
566                }
567              })(this)
568            ),
569            this.search_results.on(
570              'mouseover.chosen',
571              (function (t) {
572                return function (e) {
573                  t.search_results_mouseover(e)
574                }
575              })(this)
576            ),
577            this.search_results.on(
578              'mouseout.chosen',
579              (function (t) {
580                return function (e) {
581                  t.search_results_mouseout(e)
582                }
583              })(this)
584            ),
585            this.search_results.on(
586              'mousewheel.chosen DOMMouseScroll.chosen',
587              (function (t) {
588                return function (e) {
589                  t.search_results_mousewheel(e)
590                }
591              })(this)
592            ),
593            this.search_results.on(
594              'touchstart.chosen',
595              (function (t) {
596                return function (e) {
597                  t.search_results_touchstart(e)
598                }
599              })(this)
600            ),
601            this.search_results.on(
602              'touchmove.chosen',
603              (function (t) {
604                return function (e) {
605                  t.search_results_touchmove(e)
606                }
607              })(this)
608            ),
609            this.search_results.on(
610              'touchend.chosen',
611              (function (t) {
612                return function (e) {
613                  t.search_results_touchend(e)
614                }
615              })(this)
616            ),
617            this.form_field_jq.on(
618              'chosen:updated.chosen',
619              (function (t) {
620                return function (e) {
621                  t.results_update_field(e)
622                }
623              })(this)
624            ),
625            this.form_field_jq.on(
626              'chosen:activate.chosen',
627              (function (t) {
628                return function (e) {
629                  t.activate_field(e)
630                }
631              })(this)
632            ),
633            this.form_field_jq.on(
634              'chosen:open.chosen',
635              (function (t) {
636                return function (e) {
637                  t.container_mousedown(e)
638                }
639              })(this)
640            ),
641            this.form_field_jq.on(
642              'chosen:close.chosen',
643              (function (t) {
644                return function (e) {
645                  t.close_field(e)
646                }
647              })(this)
648            ),
649            this.search_field.on(
650              'blur.chosen',
651              (function (t) {
652                return function (e) {
653                  t.input_blur(e)
654                }
655              })(this)
656            ),
657            this.search_field.on(
658              'keyup.chosen',
659              (function (t) {
660                return function (e) {
661                  t.keyup_checker(e)
662                }
663              })(this)
664            ),
665            this.search_field.on(
666              'keydown.chosen',
667              (function (t) {
668                return function (e) {
669                  t.keydown_checker(e)
670                }
671              })(this)
672            ),
673            this.search_field.on(
674              'focus.chosen',
675              (function (t) {
676                return function (e) {
677                  t.input_focus(e)
678                }
679              })(this)
680            ),
681            this.search_field.on(
682              'cut.chosen',
683              (function (t) {
684                return function (e) {
685                  t.clipboard_event_checker(e)
686                }
687              })(this)
688            ),
689            this.search_field.on(
690              'paste.chosen',
691              (function (t) {
692                return function (e) {
693                  t.clipboard_event_checker(e)
694                }
695              })(this)
696            ),
697            this.is_multiple
698              ? this.search_choices.on(
699                  'click.chosen',
700                  (function (t) {
701                    return function (e) {
702                      t.choices_click(e)
703                    }
704                  })(this)
705                )
706              : this.container.on('click.chosen', function (t) {
707                  t.preventDefault()
708                })
709          )
710        }),
711        (n.prototype.destroy = function () {
712          return (
713            t(this.container[0].ownerDocument).off('click.chosen', this.click_test_action),
714            this.form_field_label.length > 0 && this.form_field_label.off('click.chosen'),
715            this.search_field[0].tabIndex && (this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex),
716            this.container.remove(),
717            this.form_field_jq.removeData('chosen'),
718            this.form_field_jq.show()
719          )
720        }),
721        (n.prototype.search_field_disabled = function () {
722          return (
723            (this.is_disabled = this.form_field.disabled || this.form_field_jq.parents('fieldset').is(':disabled')),
724            this.container.toggleClass('chosen-disabled', this.is_disabled),
725            (this.search_field[0].disabled = this.is_disabled),
726            this.is_multiple || this.selected_item.off('focus.chosen', this.activate_field),
727            this.is_disabled
728              ? this.close_field()
729              : this.is_multiple
730              ? void 0
731              : this.selected_item.on('focus.chosen', this.activate_field)
732          )
733        }),
734        (n.prototype.container_mousedown = function (e) {
735          var s
736          if (!this.is_disabled)
737            return (
738              !e || ('mousedown' !== (s = e.type) && 'touchstart' !== s) || this.results_showing || e.preventDefault(),
739              null != e && t(e.target).hasClass('search-choice-close')
740                ? void 0
741                : (this.active_field
742                    ? this.is_multiple ||
743                      !e ||
744                      (t(e.target)[0] !== this.selected_item[0] && !t(e.target).parents('a.chosen-single').length) ||
745                      (e.preventDefault(), this.results_toggle())
746                    : (this.is_multiple && this.search_field.val(''),
747                      t(this.container[0].ownerDocument).on('click.chosen', this.click_test_action),
748                      this.results_show()),
749                  this.activate_field())
750            )
751        }),
752        (n.prototype.container_mouseup = function (t) {
753          if ('ABBR' === t.target.nodeName && !this.is_disabled) return this.results_reset(t)
754        }),
755        (n.prototype.search_results_mousewheel = function (t) {
756          var e
757          if (
758            (t.originalEvent && (e = t.originalEvent.deltaY || -t.originalEvent.wheelDelta || t.originalEvent.detail),
759            null != e)
760          )
761            return (
762              t.preventDefault(),
763              'DOMMouseScroll' === t.type && (e *= 40),
764              this.search_results.scrollTop(e + this.search_results.scrollTop())
765            )
766        }),
767        (n.prototype.blur_test = function (t) {
768          if (!this.active_field && this.container.hasClass('chosen-container-active')) return this.close_field()
769        }),
770        (n.prototype.close_field = function () {
771          return (
772            t(this.container[0].ownerDocument).off('click.chosen', this.click_test_action),
773            (this.active_field = !1),
774            this.results_hide(),
775            this.container.removeClass('chosen-container-active'),
776            this.clear_backstroke(),
777            this.show_search_field_default(),
778            this.search_field_scale(),
779            this.search_field.blur()
780          )
781        }),
782        (n.prototype.activate_field = function () {
783          if (!this.is_disabled)
784            return (
785              this.container.addClass('chosen-container-active'),
786              (this.active_field = !0),
787              this.search_field.val(this.search_field.val()),
788              this.search_field.focus()
789            )
790        }),
791        (n.prototype.test_active_click = function (e) {
792          var s
793          return (s = t(e.target).closest('.chosen-container')).length && this.container[0] === s[0]
794            ? (this.active_field = !0)
795            : this.close_field()
796        }),
797        (n.prototype.results_build = function () {
798          return (
799            (this.parsing = !0),
800            (this.selected_option_count = null),
801            (this.results_data = i.select_to_array(this.form_field)),
802            this.is_multiple
803              ? this.search_choices.find('li.search-choice').remove()
804              : (this.single_set_selected_text(),
805                this.disable_search || this.form_field.options.length <= this.disable_search_threshold
806                  ? ((this.search_field[0].readOnly = !0), this.container.addClass('chosen-container-single-nosearch'))
807                  : ((this.search_field[0].readOnly = !1),
808                    this.container.removeClass('chosen-container-single-nosearch'))),
809            this.update_results_content(this.results_option_build({ first: !0 })),
810            this.search_field_disabled(),
811            this.show_search_field_default(),
812            this.search_field_scale(),
813            (this.parsing = !1)
814          )
815        }),
816        (n.prototype.result_do_highlight = function (t) {
817          var e, s, i, n, r
818          if (t.length) {
819            if (
820              (this.result_clear_highlight(),
821              (this.result_highlight = t),
822              this.result_highlight.addClass('highlighted'),
823              (i = parseInt(this.search_results.css('maxHeight'), 10)),
824              (r = this.search_results.scrollTop()),
825              (n = i + r),
826              (s = this.result_highlight.position().top + this.search_results.scrollTop()),
827              (e = s + this.result_highlight.outerHeight()) >= n)
828            )
829              return this.search_results.scrollTop(e - i > 0 ? e - i : 0)
830            if (s < r) return this.search_results.scrollTop(s)
831          }
832        }),
833        (n.prototype.result_clear_highlight = function () {
834          return (
835            this.result_highlight && this.result_highlight.removeClass('highlighted'), (this.result_highlight = null)
836          )
837        }),
838        (n.prototype.results_show = function () {
839          return this.is_multiple && this.max_selected_options <= this.choices_count()
840            ? (this.form_field_jq.trigger('chosen:maxselected', { chosen: this }), !1)
841            : (this.container.addClass('chosen-with-drop'),
842              (this.results_showing = !0),
843              this.search_field.focus(),
844              this.search_field.val(this.get_search_field_value()),
845              this.winnow_results(),
846              this.form_field_jq.trigger('chosen:showing_dropdown', { chosen: this }))
847        }),
848        (n.prototype.update_results_content = function (t) {
849          return this.search_results.html(t)
850        }),
851        (n.prototype.results_hide = function () {
852          return (
853            this.results_showing &&
854              (this.result_clear_highlight(),
855              this.container.removeClass('chosen-with-drop'),
856              this.form_field_jq.trigger('chosen:hiding_dropdown', { chosen: this })),
857            (this.results_showing = !1)
858          )
859        }),
860        (n.prototype.set_tab_index = function (t) {
861          var e
862          if (this.form_field.tabIndex)
863            return (e = this.form_field.tabIndex), (this.form_field.tabIndex = -1), (this.search_field[0].tabIndex = e)
864        }),
865        (n.prototype.set_label_behavior = function () {
866          if (
867            ((this.form_field_label = this.form_field_jq.parents('label')),
868            !this.form_field_label.length &&
869              this.form_field.id.length &&
870              (this.form_field_label = t("label[for='" + this.form_field.id + "']")),
871            this.form_field_label.length > 0)
872          )
873            return this.form_field_label.on('click.chosen', this.label_click_handler)
874        }),
875        (n.prototype.show_search_field_default = function () {
876          return this.is_multiple && this.choices_count() < 1 && !this.active_field
877            ? (this.search_field.val(this.default_text), this.search_field.addClass('default'))
878            : (this.search_field.val(''), this.search_field.removeClass('default'))
879        }),
880        (n.prototype.search_results_mouseup = function (e) {
881          var s
882          if (
883            (s = t(e.target).hasClass('active-result') ? t(e.target) : t(e.target).parents('.active-result').first())
884              .length
885          )
886            return (this.result_highlight = s), this.result_select(e), this.search_field.focus()
887        }),
888        (n.prototype.search_results_mouseover = function (e) {
889          var s
890          if ((s = t(e.target).hasClass('active-result') ? t(e.target) : t(e.target).parents('.active-result').first()))
891            return this.result_do_highlight(s)
892        }),
893        (n.prototype.search_results_mouseout = function (e) {
894          if (t(e.target).hasClass('active-result') || t(e.target).parents('.active-result').first())
895            return this.result_clear_highlight()
896        }),
897        (n.prototype.choice_build = function (e) {
898          var s, i
899          return (
900            (s = t('<li />', { class: 'search-choice' }).html('<span>' + this.choice_label(e) + '</span>')),
901            e.disabled
902              ? s.addClass('search-choice-disabled')
903              : ((i = t('<a />', { class: 'search-choice-close', 'data-option-array-index': e.array_index })).on(
904                  'click.chosen',
905                  (function (t) {
906                    return function (e) {
907                      return t.choice_destroy_link_click(e)
908                    }
909                  })(this)
910                ),
911                s.append(i)),
912            this.search_container.before(s)
913          )
914        }),
915        (n.prototype.choice_destroy_link_click = function (e) {
916          if ((e.preventDefault(), e.stopPropagation(), !this.is_disabled)) return this.choice_destroy(t(e.target))
917        }),
918        (n.prototype.choice_destroy = function (t) {
919          if (this.result_deselect(t[0].getAttribute('data-option-array-index')))
920            return (
921              this.active_field ? this.search_field.focus() : this.show_search_field_default(),
922              this.is_multiple &&
923                this.choices_count() > 0 &&
924                this.get_search_field_value().length < 1 &&
925                this.results_hide(),
926              t.parents('li').first().remove(),
927              this.search_field_scale()
928            )
929        }),
930        (n.prototype.results_reset = function () {
931          if (
932            (this.reset_single_select_options(),
933            (this.form_field.options[0].selected = !0),
934            this.single_set_selected_text(),
935            this.show_search_field_default(),
936            this.results_reset_cleanup(),
937            this.trigger_form_field_change(),
938            this.active_field)
939          )
940            return this.results_hide()
941        }),
942        (n.prototype.results_reset_cleanup = function () {
943          return (this.current_selectedIndex = this.form_field.selectedIndex), this.selected_item.find('abbr').remove()
944        }),
945        (n.prototype.result_select = function (t) {
946          var e, s
947          if (this.result_highlight)
948            return (
949              (e = this.result_highlight),
950              this.result_clear_highlight(),
951              this.is_multiple && this.max_selected_options <= this.choices_count()
952                ? (this.form_field_jq.trigger('chosen:maxselected', { chosen: this }), !1)
953                : (this.is_multiple ? e.removeClass('active-result') : this.reset_single_select_options(),
954                  e.addClass('result-selected'),
955                  (s = this.results_data[e[0].getAttribute('data-option-array-index')]),
956                  (s.selected = !0),
957                  (this.form_field.options[s.options_index].selected = !0),
958                  (this.selected_option_count = null),
959                  this.is_multiple ? this.choice_build(s) : this.single_set_selected_text(this.choice_label(s)),
960                  this.is_multiple && (!this.hide_results_on_select || t.metaKey || t.ctrlKey)
961                    ? t.metaKey || t.ctrlKey
962                      ? this.winnow_results({ skip_highlight: !0 })
963                      : (this.search_field.val(''), this.winnow_results())
964                    : (this.results_hide(), this.show_search_field_default()),
965                  (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) &&
966                    this.trigger_form_field_change({ selected: this.form_field.options[s.options_index].value }),
967                  (this.current_selectedIndex = this.form_field.selectedIndex),
968                  t.preventDefault(),
969                  this.search_field_scale())
970            )
971        }),
972        (n.prototype.single_set_selected_text = function (t) {
973          return (
974            null == t && (t = this.default_text),
975            t === this.default_text
976              ? this.selected_item.addClass('chosen-default')
977              : (this.single_deselect_control_build(), this.selected_item.removeClass('chosen-default')),
978            this.selected_item.find('span').html(t)
979          )
980        }),
981        (n.prototype.result_deselect = function (t) {
982          var e
983          return (
984            (e = this.results_data[t]),
985            !this.form_field.options[e.options_index].disabled &&
986              ((e.selected = !1),
987              (this.form_field.options[e.options_index].selected = !1),
988              (this.selected_option_count = null),
989              this.result_clear_highlight(),
990              this.results_showing && this.winnow_results(),
991              this.trigger_form_field_change({ deselected: this.form_field.options[e.options_index].value }),
992              this.search_field_scale(),
993              !0)
994          )
995        }),
996        (n.prototype.single_deselect_control_build = function () {
997          if (this.allow_single_deselect)
998            return (
999              this.selected_item.find('abbr').length ||
1000                this.selected_item.find('span').first().after('<abbr class="search-choice-close"></abbr>'),
1001              this.selected_item.addClass('chosen-single-with-deselect')
1002            )
1003        }),
1004        (n.prototype.get_search_field_value = function () {
1005          return this.search_field.val()
1006        }),
1007        (n.prototype.get_search_text = function () {
1008          return t.trim(this.get_search_field_value())
1009        }),
1010        (n.prototype.escape_html = function (e) {
1011          return t('<div/>').text(e).html()
1012        }),
1013        (n.prototype.winnow_results_set_highlight = function () {
1014          var t, e
1015          if (
1016            ((e = this.is_multiple ? [] : this.search_results.find('.result-selected.active-result')),
1017            null != (t = e.length ? e.first() : this.search_results.find('.active-result').first()))
1018          )
1019            return this.result_do_highlight(t)
1020        }),
1021        (n.prototype.no_results = function (t) {
1022          var e
1023          return (
1024            (e = this.get_no_results_html(t)),
1025            this.search_results.append(e),
1026            this.form_field_jq.trigger('chosen:no_results', { chosen: this })
1027          )
1028        }),
1029        (n.prototype.no_results_clear = function () {
1030          return this.search_results.find('.no-results').remove()
1031        }),
1032        (n.prototype.keydown_arrow = function () {
1033          var t
1034          return this.results_showing && this.result_highlight
1035            ? (t = this.result_highlight.nextAll('li.active-result').first())
1036              ? this.result_do_highlight(t)
1037              : void 0
1038            : this.results_show()
1039        }),
1040        (n.prototype.keyup_arrow = function () {
1041          var t
1042          return this.results_showing || this.is_multiple
1043            ? this.result_highlight
1044              ? (t = this.result_highlight.prevAll('li.active-result')).length
1045                ? this.result_do_highlight(t.first())
1046                : (this.choices_count() > 0 && this.results_hide(), this.result_clear_highlight())
1047              : void 0
1048            : this.results_show()
1049        }),
1050        (n.prototype.keydown_backstroke = function () {
1051          var t
1052          return this.pending_backstroke
1053            ? (this.choice_destroy(this.pending_backstroke.find('a').first()), this.clear_backstroke())
1054            : (t = this.search_container.siblings('li.search-choice').last()).length &&
1055              !t.hasClass('search-choice-disabled')
1056            ? ((this.pending_backstroke = t),
1057              this.single_backstroke_delete
1058                ? this.keydown_backstroke()
1059                : this.pending_backstroke.addClass('search-choice-focus'))
1060            : void 0
1061        }),
1062        (n.prototype.clear_backstroke = function () {
1063          return (
1064            this.pending_backstroke && this.pending_backstroke.removeClass('search-choice-focus'),
1065            (this.pending_backstroke = null)
1066          )
1067        }),
1068        (n.prototype.search_field_scale = function () {
1069          var e, s, i, n, r, o, h
1070          if (this.is_multiple) {
1071            for (
1072              r = { position: 'absolute', left: '-1000px', top: '-1000px', display: 'none', whiteSpace: 'pre' },
1073                s = 0,
1074                i = (o = [
1075                  'fontSize',
1076                  'fontStyle',
1077                  'fontWeight',
1078                  'fontFamily',
1079                  'lineHeight',
1080                  'textTransform',
1081                  'letterSpacing',
1082                ]).length;
1083              s < i;
1084              s++
1085            )
1086              r[(n = o[s])] = this.search_field.css(n)
1087            return (
1088              (e = t('<div />').css(r)).text(this.get_search_field_value()),
1089              t('body').append(e),
1090              (h = e.width() + 25),
1091              e.remove(),
1092              this.container.is(':visible') && (h = Math.min(this.container.outerWidth() - 10, h)),
1093              this.search_field.width(h)
1094            )
1095          }
1096        }),
1097        (n.prototype.trigger_form_field_change = function (t) {
1098          return this.form_field_jq.trigger('input', t), this.form_field_jq.trigger('change', t)
1099        }),
1100        n
1101      )
1102    })())
1103}.call(this))

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.