MOON
Server: Apache
System: Linux res.emeff.ca 3.10.0-962.3.2.lve1.5.24.10.el7.x86_64 #1 SMP Wed Mar 20 07:36:02 EDT 2019 x86_64
User: accemeff (1004)
PHP: 7.0.33
Disabled: NONE
Upload Files
File: /home/accemeff/vendor/craftcms/cms/lib/selectize/selectize.js.map
{"version":3,"sources":["selectize.js"],"names":["root","factory","define","amd","exports","module","Sifter","this","items","settings","diacritics","prototype","tokenize","query","trim","String","toLowerCase","length","i","n","regex","letter","tokens","words","split","escape_regex","DIACRITICS","hasOwnProperty","replace","RegExp","push","string","iterator","object","callback","is_array","Array","forEach","key","apply","getScoreFunction","search","options","fields","token_count","nesting","prepareSearch","field_count","scoreValue","value","token","score","pos","scoreObject","data","getattr","sum","conjunction","getSortFunction","self","field","fields_count","multiplier","multipliers","get_field","implicit_score","sort","sort_empty","name","result","id","unshift","direction","splice","a","b","cmp","option_fields","extend","option_sort","option_sort_empty","total","fn_sort","fn_score","item","filter","limit","slice","asciifold","k","arguments","obj","names","shift","str","isArray","$","Object","toString","call","c","d","e","f","g","h","j","l","o","p","q","r","s","t","u","v","w","x","y","z","chunk","foreignletters","lookup","substring","charAt","regexp","foreignletter","MicroPlugin","mixin","Interface","plugins","initializePlugins","queue","requested","loaded","utils","require","loadPlugin","plugin","Error","fn","vArg","Selectize","jQuery","highlight","$element","pattern","node","skip","nodeType","match","spannode","document","createElement","className","middlebit","splitText","middleclone","cloneNode","appendChild","parentNode","replaceChild","childNodes","test","tagName","each","removeHighlight","find","firstChild","nodeName","parent","normalize","end","MicroEvent","on","event","fct","_events","off","indexOf","trigger","destObject","props","IS_MAC","navigator","userAgent","KEY_CMD","KEY_CTRL","SUPPORTS_VALIDITY_API","window","validity","isset","hash_key","escape_html","hook","before","method","original","after","debounce_events","types","type","event_args","getSelection","input","start","selectionStart","selectionEnd","selection","focus","sel","createRange","selLen","text","moveStart","autoGrow","$input","currentWidth","update","keyCode","printable","placeholder","width","character","$parent","metaKey","altKey","force","val","shiftKey","fromCharCode","toUpperCase","attr","$testInput","css","position","top","left","padding","whiteSpace","appendTo","$from","$to","properties","styles","transferStyles","triggerHandler","dir","selectize","delay","timeout","computedStyle","getComputedStyle","getPropertyValue","currentStyle","parents","order","tabIndex","tagType","rtl","eventNS","count","highlightedValue","isBlurring","isOpen","isDisabled","isRequired","is","isInvalid","isLocked","isFocused","isInputHidden","isSetup","isShiftDown","isCmdDown","isCtrlDown","ignoreFocus","ignoreBlur","ignoreHover","hasOptions","currentResults","lastValue","caretPos","loading","loadedSearches","$activeOption","$activeItems","optgroups","userOptions","renderCache","onSearchChange","loadThrottle","args","clearTimeout","setTimeout","sifter","registerOption","registerOptionGroup","mode","maxItems","hideSelected","setupCallbacks","setupTemplates","setup","message","console","error","component","explanation","group","groupEnd","logError","$wrapper","$control","$control_input","$dropdown","$dropdown_content","$dropdown_parent","inputMode","classes","classes_plugins","inputId","selector","$window","$document","addClass","wrapperClass","inputClass","dropdownParent","dropdownClass","hide","dropdownContentClass","copyClassesToDropdown","style","join","splitOn","delimiter","delimiterEscaped","stopImmediatePropagation","onOptionHover","onOptionSelect","onItemSelect","child","target","currentTarget","mousedown","onMouseDown","click","onClick","stopPropagation","keydown","onKeyDown","keyup","onKeyUp","keypress","onKeyPress","resize","positionDropdown","blur","onBlur","onFocus","paste","onPaste","has","revertSettings","$children","children","detach","tabindex","setValue","preventDefault","refreshState","updateOriginalInput","refreshItems","updatePlaceholder","disable","onChange","preload","field_label","labelField","field_optgroup","optgroupLabelField","templates","optgroup","html","optgroup_header","escape","option","option_create","render","callbacks","initialize","change","item_add","item_remove","clear","option_add","option_remove","option_clear","optgroup_add","optgroup_remove","optgroup_clear","dropdown_open","dropdown_close","load","defaultPrevented","isDefaultPrevented","close","open","setActiveItem","isFull","pastedText","splitInput","createItem","which","create","selectAll","ctrlKey","$next","getAdjacentOption","setActiveOption","$prev","advanceSelection","selectOnTab","deleteSelection","refreshOptions","wasFocused","showInput","openOnFocus","dest","activeElement","deactivate","setTextboxValue","setCaret","createOnBlur","$target","hasClass","closeAfterSelect","lastQuery","addItem","getOption","loadingClass","results","Math","max","addOption","removeClass","getValue","silent","addItems","$item","eventName","idx","begin","swap","$last","hideInput","$option","scroll","animate","height_menu","height_item","scroll_top","scroll_bottom","height","outerHeight","scrollTop","offset","stop","scrollDuration","opacity","getSearchOptions","sortField","searchField","searchConjunction","calculateScore","triggerDropdown","groups","groups_order","option_html","html_children","has_create_option","$active","$active_before","$create","tmp","active_before","maxOptions","min","optgroupField","createDocumentFragment","lockOptgroupOrder","$order","innerHTML","dom","canCreate","prepend","addPrecedence","valueField","optgroupValueField","addOptionGroup","removeOptionGroup","clearOptionGroups","updateOption","$item_new","value_new","index_item","cache_items","cache_options","order_old","getItem","replaceWith","removeOption","removeItem","clearOptions","getElementWithValue","$options","index","eq","$els","getAttribute","values","buffer","isPending","control","insertBefore","value_next","wasFull","insertAtCaret","remove","persist","caret","lock","called","unlock","output","refreshValidityState","refreshClasses","invalid","prop","toggleClass","isEmptyObject","opts","label","removeAttr","visibility","display","getBoundingClientRect","$el","el","option_select","$option_select","$tail","onDelete","pop","tail","valueLength","advanceCaret","$adj","$child","append","enable","destroy","show","removeData","undefined","body","templateName","cache","disabledField","clearCache","createFilter","defaults","allowEmptyOption","dataAttr","settings_user","attr_data","field_value","field_disabled","field_optgroup_label","field_optgroup_value","tag_name","settings_element","optionsMap","readData","JSON","parse","arr","addGroup","$optgroup","init_select","data_raw","init_textbox","support","sortable","forcePlaceholderSize","disabled","ui","helper","overflow","active","title","headerClass","titleRowClass","labelClass","closeClass","$dropdown_header","equalizeWidth","equalizeHeight","closest","prev","next","getScrollbarWidth","div","doc","offsetWidth","clientWidth","removeChild","equalizeSizes","height_max","width_last","width_parent","$optgroups","innerWidth","round","thisRef","render_item","html_container","html_element","context","singleClose"],"mappings":"CAgBC,SAASA,EAAMC,GACO,mBAAXC,QAAyBA,OAAOC,IAC1CD,OAAO,SAAUD,GACY,iBAAZG,QACjBC,OAAOD,QAAUH,IA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,SAASpD,GAC9DA,EAAE4Q,iBACEvT,EAAKkN,UAETlN,EAAKgV,YAsDR2O,CAAY/mB,KAAMmC,KAQrBoG,EAAU5I,OAAO,uBAAwB,SAASwC,GACjD,IAOK2J,EAPD1I,EAAOpD,KAEXmC,EAAQ2K,KAAO3K,EAAQ2K,MAAQ,SAAS8K,GACvC,OAAOA,EAAO5X,KAAKE,SAASkX,aAG7BpX,KAAKwV,WACA1J,EAAW1I,EAAKoS,UACb,SAASzP,GACf,IAAI+Z,EAAOlI,EACX,OA/hGiB,IA+hGb7R,EAAEqH,SAA2D,KAA9BpN,KAAKmT,eAAetF,QAAiB7N,KAAKuR,aAAa7Q,QAE5E,IADbof,EAAQ9f,KAAKmR,SAAW,IACN2O,EAAQ9f,KAAKC,MAAMS,QACpCkX,EAAS5X,KAAKmC,QAAQnC,KAAKC,MAAM6f,IAC7B9f,KAAKia,gBAAgBlU,KACxB/F,KAAKya,gBAAgBtY,EAAQ2K,KAAK9K,MAAMhC,KAAM,CAAC4X,KAC/C5X,KAAKka,gBAAe,SAErBnU,EAAE4Q,kBAIG7K,EAAS9J,MAAMhC,KAAMmF,eAMxBoD","file":"selectize.js","sourcesContent":["/**\n * sifter.js\n * Copyright (c) 2013 Brian Reavis & 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 * @author Brian Reavis <brian@thirdroute.com>\n */\n\n(function(root, factory) {\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine('sifter', factory);\n\t} else if (typeof exports === 'object') {\n\t\tmodule.exports = factory();\n\t} else {\n\t\troot.Sifter = factory();\n\t}\n}(this, function() {\n\n\t/**\n\t * Textually searches arrays and hashes of objects\n\t * by property (or multiple properties). Designed\n\t * specifically for autocomplete.\n\t *\n\t * @constructor\n\t * @param {array|object} items\n\t * @param {object} items\n\t */\n\tvar Sifter = function(items, settings) {\n\t\tthis.items = items;\n\t\tthis.settings = settings || {diacritics: true};\n\t};\n\n\t/**\n\t * Splits a search string into an array of individual\n\t * regexps to be used to match results.\n\t *\n\t * @param {string} query\n\t * @returns {array}\n\t */\n\tSifter.prototype.tokenize = function(query) {\n\t\tquery = trim(String(query || '').toLowerCase());\n\t\tif (!query || !query.length) return [];\n\n\t\tvar i, n, regex, letter;\n\t\tvar tokens = [];\n\t\tvar words = query.split(/ +/);\n\n\t\tfor (i = 0, n = words.length; i < n; i++) {\n\t\t\tregex = escape_regex(words[i]);\n\t\t\tif (this.settings.diacritics) {\n\t\t\t\tfor (letter in DIACRITICS) {\n\t\t\t\t\tif (DIACRITICS.hasOwnProperty(letter)) {\n\t\t\t\t\t\tregex = regex.replace(new RegExp(letter, 'g'), DIACRITICS[letter]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttokens.push({\n\t\t\t\tstring : words[i],\n\t\t\t\tregex  : new RegExp(regex, 'i')\n\t\t\t});\n\t\t}\n\n\t\treturn tokens;\n\t};\n\n\t/**\n\t * Iterates over arrays and hashes.\n\t *\n\t * ```\n\t * this.iterator(this.items, function(item, id) {\n\t *    // invoked for each item\n\t * });\n\t * ```\n\t *\n\t * @param {array|object} object\n\t */\n\tSifter.prototype.iterator = function(object, callback) {\n\t\tvar iterator;\n\t\tif (is_array(object)) {\n\t\t\titerator = Array.prototype.forEach || function(callback) {\n\t\t\t\tfor (var i = 0, n = this.length; i < n; i++) {\n\t\t\t\t\tcallback(this[i], i, this);\n\t\t\t\t}\n\t\t\t};\n\t\t} else {\n\t\t\titerator = function(callback) {\n\t\t\t\tfor (var key in this) {\n\t\t\t\t\tif (this.hasOwnProperty(key)) {\n\t\t\t\t\t\tcallback(this[key], key, this);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\titerator.apply(object, [callback]);\n\t};\n\n\t/**\n\t * Returns a function to be used to score individual results.\n\t *\n\t * Good matches will have a higher score than poor matches.\n\t * If an item is not a match, 0 will be returned by the function.\n\t *\n\t * @param {object|string} search\n\t * @param {object} options (optional)\n\t * @returns {function}\n\t */\n\tSifter.prototype.getScoreFunction = function(search, options) {\n\t\tvar self, fields, tokens, token_count, nesting;\n\n\t\tself        = this;\n\t\tsearch      = self.prepareSearch(search, options);\n\t\ttokens      = search.tokens;\n\t\tfields      = search.options.fields;\n\t\ttoken_count = tokens.length;\n\t\tnesting     = search.options.nesting;\n\n\t\t/**\n\t\t * Calculates how close of a match the\n\t\t * given value is against a search token.\n\t\t *\n\t\t * @param {mixed} value\n\t\t * @param {object} token\n\t\t * @return {number}\n\t\t */\n\t\tvar scoreValue = function(value, token) {\n\t\t\tvar score, pos;\n\n\t\t\tif (!value) return 0;\n\t\t\tvalue = String(value || '');\n\t\t\tpos = value.search(token.regex);\n\t\t\tif (pos === -1) return 0;\n\t\t\tscore = token.string.length / value.length;\n\t\t\tif (pos === 0) score += 0.5;\n\t\t\treturn score;\n\t\t};\n\n\t\t/**\n\t\t * Calculates the score of an object\n\t\t * against the search query.\n\t\t *\n\t\t * @param {object} token\n\t\t * @param {object} data\n\t\t * @return {number}\n\t\t */\n\t\tvar scoreObject = (function() {\n\t\t\tvar field_count = fields.length;\n\t\t\tif (!field_count) {\n\t\t\t\treturn function() { return 0; };\n\t\t\t}\n\t\t\tif (field_count === 1) {\n\t\t\t\treturn function(token, data) {\n\t\t\t\t\treturn scoreValue(getattr(data, fields[0], nesting), token);\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn function(token, data) {\n\t\t\t\tfor (var i = 0, sum = 0; i < field_count; i++) {\n\t\t\t\t\tsum += scoreValue(getattr(data, fields[i], nesting), token);\n\t\t\t\t}\n\t\t\t\treturn sum / field_count;\n\t\t\t};\n\t\t})();\n\n\t\tif (!token_count) {\n\t\t\treturn function() { return 0; };\n\t\t}\n\t\tif (token_count === 1) {\n\t\t\treturn function(data) {\n\t\t\t\treturn scoreObject(tokens[0], data);\n\t\t\t};\n\t\t}\n\n\t\tif (search.options.conjunction === 'and') {\n\t\t\treturn function(data) {\n\t\t\t\tvar score;\n\t\t\t\tfor (var i = 0, sum = 0; i < token_count; i++) {\n\t\t\t\t\tscore = scoreObject(tokens[i], data);\n\t\t\t\t\tif (score <= 0) return 0;\n\t\t\t\t\tsum += score;\n\t\t\t\t}\n\t\t\t\treturn sum / token_count;\n\t\t\t};\n\t\t} else {\n\t\t\treturn function(data) {\n\t\t\t\tfor (var i = 0, sum = 0; i < token_count; i++) {\n\t\t\t\t\tsum += scoreObject(tokens[i], data);\n\t\t\t\t}\n\t\t\t\treturn sum / token_count;\n\t\t\t};\n\t\t}\n\t};\n\n\t/**\n\t * Returns a function that can be used to compare two\n\t * results, for sorting purposes. If no sorting should\n\t * be performed, `null` will be returned.\n\t *\n\t * @param {string|object} search\n\t * @param {object} options\n\t * @return function(a,b)\n\t */\n\tSifter.prototype.getSortFunction = function(search, options) {\n\t\tvar i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort;\n\n\t\tself   = this;\n\t\tsearch = self.prepareSearch(search, options);\n\t\tsort   = (!search.query && options.sort_empty) || options.sort;\n\n\t\t/**\n\t\t * Fetches the specified sort field value\n\t\t * from a search result item.\n\t\t *\n\t\t * @param  {string} name\n\t\t * @param  {object} result\n\t\t * @return {mixed}\n\t\t */\n\t\tget_field = function(name, result) {\n\t\t\tif (name === '$score') return result.score;\n\t\t\treturn getattr(self.items[result.id], name, options.nesting);\n\t\t};\n\n\t\t// parse options\n\t\tfields = [];\n\t\tif (sort) {\n\t\t\tfor (i = 0, n = sort.length; i < n; i++) {\n\t\t\t\tif (search.query || sort[i].field !== '$score') {\n\t\t\t\t\tfields.push(sort[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// the \"$score\" field is implied to be the primary\n\t\t// sort field, unless it's manually specified\n\t\tif (search.query) {\n\t\t\timplicit_score = true;\n\t\t\tfor (i = 0, n = fields.length; i < n; i++) {\n\t\t\t\tif (fields[i].field === '$score') {\n\t\t\t\t\timplicit_score = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (implicit_score) {\n\t\t\t\tfields.unshift({field: '$score', direction: 'desc'});\n\t\t\t}\n\t\t} else {\n\t\t\tfor (i = 0, n = fields.length; i < n; i++) {\n\t\t\t\tif (fields[i].field === '$score') {\n\t\t\t\t\tfields.splice(i, 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tmultipliers = [];\n\t\tfor (i = 0, n = fields.length; i < n; i++) {\n\t\t\tmultipliers.push(fields[i].direction === 'desc' ? -1 : 1);\n\t\t}\n\n\t\t// build function\n\t\tfields_count = fields.length;\n\t\tif (!fields_count) {\n\t\t\treturn null;\n\t\t} else if (fields_count === 1) {\n\t\t\tfield = fields[0].field;\n\t\t\tmultiplier = multipliers[0];\n\t\t\treturn function(a, b) {\n\t\t\t\treturn multiplier * cmp(\n\t\t\t\t\tget_field(field, a),\n\t\t\t\t\tget_field(field, b)\n\t\t\t\t);\n\t\t\t};\n\t\t} else {\n\t\t\treturn function(a, b) {\n\t\t\t\tvar i, result, a_value, b_value, field;\n\t\t\t\tfor (i = 0; i < fields_count; i++) {\n\t\t\t\t\tfield = fields[i].field;\n\t\t\t\t\tresult = multipliers[i] * cmp(\n\t\t\t\t\t\tget_field(field, a),\n\t\t\t\t\t\tget_field(field, b)\n\t\t\t\t\t);\n\t\t\t\t\tif (result) return result;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t};\n\t\t}\n\t};\n\n\t/**\n\t * Parses a search query and returns an object\n\t * with tokens and fields ready to be populated\n\t * with results.\n\t *\n\t * @param {string} query\n\t * @param {object} options\n\t * @returns {object}\n\t */\n\tSifter.prototype.prepareSearch = function(query, options) {\n\t\tif (typeof query === 'object') return query;\n\n\t\toptions = extend({}, options);\n\n\t\tvar option_fields     = options.fields;\n\t\tvar option_sort       = options.sort;\n\t\tvar option_sort_empty = options.sort_empty;\n\n\t\tif (option_fields && !is_array(option_fields)) options.fields = [option_fields];\n\t\tif (option_sort && !is_array(option_sort)) options.sort = [option_sort];\n\t\tif (option_sort_empty && !is_array(option_sort_empty)) options.sort_empty = [option_sort_empty];\n\n\t\treturn {\n\t\t\toptions : options,\n\t\t\tquery   : String(query || '').toLowerCase(),\n\t\t\ttokens  : this.tokenize(query),\n\t\t\ttotal   : 0,\n\t\t\titems   : []\n\t\t};\n\t};\n\n\t/**\n\t * Searches through all items and returns a sorted array of matches.\n\t *\n\t * The `options` parameter can contain:\n\t *\n\t *   - fields {string|array}\n\t *   - sort {array}\n\t *   - score {function}\n\t *   - filter {bool}\n\t *   - limit {integer}\n\t *\n\t * Returns an object containing:\n\t *\n\t *   - options {object}\n\t *   - query {string}\n\t *   - tokens {array}\n\t *   - total {int}\n\t *   - items {array}\n\t *\n\t * @param {string} query\n\t * @param {object} options\n\t * @returns {object}\n\t */\n\tSifter.prototype.search = function(query, options) {\n\t\tvar self = this, value, score, search, calculateScore;\n\t\tvar fn_sort;\n\t\tvar fn_score;\n\n\t\tsearch  = this.prepareSearch(query, options);\n\t\toptions = search.options;\n\t\tquery   = search.query;\n\n\t\t// generate result scoring function\n\t\tfn_score = options.score || self.getScoreFunction(search);\n\n\t\t// perform search and sort\n\t\tif (query.length) {\n\t\t\tself.iterator(self.items, function(item, id) {\n\t\t\t\tscore = fn_score(item);\n\t\t\t\tif (options.filter === false || score > 0) {\n\t\t\t\t\tsearch.items.push({'score': score, 'id': id});\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tself.iterator(self.items, function(item, id) {\n\t\t\t\tsearch.items.push({'score': 1, 'id': id});\n\t\t\t});\n\t\t}\n\n\t\tfn_sort = self.getSortFunction(search, options);\n\t\tif (fn_sort) search.items.sort(fn_sort);\n\n\t\t// apply limits\n\t\tsearch.total = search.items.length;\n\t\tif (typeof options.limit === 'number') {\n\t\t\tsearch.items = search.items.slice(0, options.limit);\n\t\t}\n\n\t\treturn search;\n\t};\n\n\t// utilities\n\t// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n\tvar cmp = function(a, b) {\n\t\tif (typeof a === 'number' && typeof b === 'number') {\n\t\t\treturn a > b ? 1 : (a < b ? -1 : 0);\n\t\t}\n\t\ta = asciifold(String(a || ''));\n\t\tb = asciifold(String(b || ''));\n\t\tif (a > b) return 1;\n\t\tif (b > a) return -1;\n\t\treturn 0;\n\t};\n\n\tvar extend = function(a, b) {\n\t\tvar i, n, k, object;\n\t\tfor (i = 1, n = arguments.length; i < n; i++) {\n\t\t\tobject = arguments[i];\n\t\t\tif (!object) continue;\n\t\t\tfor (k in object) {\n\t\t\t\tif (object.hasOwnProperty(k)) {\n\t\t\t\t\ta[k] = object[k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t};\n\n\t/**\n\t * A property getter resolving dot-notation\n\t * @param  {Object}  obj     The root object to fetch property on\n\t * @param  {String}  name    The optionally dotted property name to fetch\n\t * @param  {Boolean} nesting Handle nesting or not\n\t * @return {Object}          The resolved property value\n\t */\n\tvar getattr = function(obj, name, nesting) {\n\t    if (!obj || !name) return;\n\t    if (!nesting) return obj[name];\n\t    var names = name.split(\".\");\n\t    while(names.length && (obj = obj[names.shift()]));\n\t    return obj;\n\t};\n\n\tvar trim = function(str) {\n\t\treturn (str + '').replace(/^\\s+|\\s+$|/g, '');\n\t};\n\n\tvar escape_regex = function(str) {\n\t\treturn (str + '').replace(/([.?*+^$[\\]\\\\(){}|-])/g, '\\\\$1');\n\t};\n\n\tvar is_array = Array.isArray || (typeof $ !== 'undefined' && $.isArray) || function(object) {\n\t\treturn Object.prototype.toString.call(object) === '[object Array]';\n\t};\n\n\tvar DIACRITICS = {\n\t\t'a': '[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]',\n\t\t'b': '[b␢βΒB฿𐌁ᛒ]',\n\t\t'c': '[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]',\n\t\t'd': '[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]',\n\t\t'e': '[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]',\n\t\t'f': '[fƑƒḞḟ]',\n\t\t'g': '[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]',\n\t\t'h': '[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]',\n\t\t'i': '[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]',\n\t\t'j': '[jȷĴĵɈɉʝɟʲ]',\n\t\t'k': '[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]',\n\t\t'l': '[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]',\n\t\t'n': '[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]',\n\t\t'o': '[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]',\n\t\t'p': '[pṔṕṖṗⱣᵽƤƥᵱ]',\n\t\t'q': '[qꝖꝗʠɊɋꝘꝙq̃]',\n\t\t'r': '[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]',\n\t\t's': '[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]',\n\t\t't': '[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]',\n\t\t'u': '[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]',\n\t\t'v': '[vṼṽṾṿƲʋꝞꝟⱱʋ]',\n\t\t'w': '[wẂẃẀẁŴŵẄẅẆẇẈẉ]',\n\t\t'x': '[xẌẍẊẋχ]',\n\t\t'y': '[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]',\n\t\t'z': '[zŹźẐẑŽžŻżẒẓẔẕƵƶ]'\n\t};\n\n\tvar asciifold = (function() {\n\t\tvar i, n, k, chunk;\n\t\tvar foreignletters = '';\n\t\tvar lookup = {};\n\t\tfor (k in DIACRITICS) {\n\t\t\tif (DIACRITICS.hasOwnProperty(k)) {\n\t\t\t\tchunk = DIACRITICS[k].substring(2, DIACRITICS[k].length - 1);\n\t\t\t\tforeignletters += chunk;\n\t\t\t\tfor (i = 0, n = chunk.length; i < n; i++) {\n\t\t\t\t\tlookup[chunk.charAt(i)] = k;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvar regexp = new RegExp('[' +  foreignletters + ']', 'g');\n\t\treturn function(str) {\n\t\t\treturn str.replace(regexp, function(foreignletter) {\n\t\t\t\treturn lookup[foreignletter];\n\t\t\t}).toLowerCase();\n\t\t};\n\t})();\n\n\n\t// export\n\t// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n\treturn Sifter;\n}));\n\n\n\n/**\n * microplugin.js\n * Copyright (c) 2013 Brian Reavis & 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 * @author Brian Reavis <brian@thirdroute.com>\n */\n\n(function(root, factory) {\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine('microplugin', factory);\n\t} else if (typeof exports === 'object') {\n\t\tmodule.exports = factory();\n\t} else {\n\t\troot.MicroPlugin = factory();\n\t}\n}(this, function() {\n\tvar MicroPlugin = {};\n\n\tMicroPlugin.mixin = function(Interface) {\n\t\tInterface.plugins = {};\n\n\t\t/**\n\t\t * Initializes the listed plugins (with options).\n\t\t * Acceptable formats:\n\t\t *\n\t\t * List (without options):\n\t\t *   ['a', 'b', 'c']\n\t\t *\n\t\t * List (with options):\n\t\t *   [{'name': 'a', options: {}}, {'name': 'b', options: {}}]\n\t\t *\n\t\t * Hash (with options):\n\t\t *   {'a': { ... }, 'b': { ... }, 'c': { ... }}\n\t\t *\n\t\t * @param {mixed} plugins\n\t\t */\n\t\tInterface.prototype.initializePlugins = function(plugins) {\n\t\t\tvar i, n, key;\n\t\t\tvar self  = this;\n\t\t\tvar queue = [];\n\n\t\t\tself.plugins = {\n\t\t\t\tnames     : [],\n\t\t\t\tsettings  : {},\n\t\t\t\trequested : {},\n\t\t\t\tloaded    : {}\n\t\t\t};\n\n\t\t\tif (utils.isArray(plugins)) {\n\t\t\t\tfor (i = 0, n = plugins.length; i < n; i++) {\n\t\t\t\t\tif (typeof plugins[i] === 'string') {\n\t\t\t\t\t\tqueue.push(plugins[i]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.plugins.settings[plugins[i].name] = plugins[i].options;\n\t\t\t\t\t\tqueue.push(plugins[i].name);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (plugins) {\n\t\t\t\tfor (key in plugins) {\n\t\t\t\t\tif (plugins.hasOwnProperty(key)) {\n\t\t\t\t\t\tself.plugins.settings[key] = plugins[key];\n\t\t\t\t\t\tqueue.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twhile (queue.length) {\n\t\t\t\tself.require(queue.shift());\n\t\t\t}\n\t\t};\n\n\t\tInterface.prototype.loadPlugin = function(name) {\n\t\t\tvar self    = this;\n\t\t\tvar plugins = self.plugins;\n\t\t\tvar plugin  = Interface.plugins[name];\n\n\t\t\tif (!Interface.plugins.hasOwnProperty(name)) {\n\t\t\t\tthrow new Error('Unable to find \"' +  name + '\" plugin');\n\t\t\t}\n\n\t\t\tplugins.requested[name] = true;\n\t\t\tplugins.loaded[name] = plugin.fn.apply(self, [self.plugins.settings[name] || {}]);\n\t\t\tplugins.names.push(name);\n\t\t};\n\n\t\t/**\n\t\t * Initializes a plugin.\n\t\t *\n\t\t * @param {string} name\n\t\t */\n\t\tInterface.prototype.require = function(name) {\n\t\t\tvar self = this;\n\t\t\tvar plugins = self.plugins;\n\n\t\t\tif (!self.plugins.loaded.hasOwnProperty(name)) {\n\t\t\t\tif (plugins.requested[name]) {\n\t\t\t\t\tthrow new Error('Plugin has circular dependency (\"' + name + '\")');\n\t\t\t\t}\n\t\t\t\tself.loadPlugin(name);\n\t\t\t}\n\n\t\t\treturn plugins.loaded[name];\n\t\t};\n\n\t\t/**\n\t\t * Registers a plugin.\n\t\t *\n\t\t * @param {string} name\n\t\t * @param {function} fn\n\t\t */\n\t\tInterface.define = function(name, fn) {\n\t\t\tInterface.plugins[name] = {\n\t\t\t\t'name' : name,\n\t\t\t\t'fn'   : fn\n\t\t\t};\n\t\t};\n\t};\n\n\tvar utils = {\n\t\tisArray: Array.isArray || function(vArg) {\n\t\t\treturn Object.prototype.toString.call(vArg) === '[object Array]';\n\t\t}\n\t};\n\n\treturn MicroPlugin;\n}));\n\n/**\n * selectize.js (v0.12.6)\n * Copyright (c) 2013–2015 Brian Reavis & 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 * @author Brian Reavis <brian@thirdroute.com>\n */\n\n/*jshint curly:false */\n/*jshint browser:true */\n\n(function(root, factory) {\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine('selectize', ['jquery','sifter','microplugin'], factory);\n\t} else if (typeof exports === 'object') {\n\t\tmodule.exports = factory(require('jquery'), require('sifter'), require('microplugin'));\n\t} else {\n\t\troot.Selectize = factory(root.jQuery, root.Sifter, root.MicroPlugin);\n\t}\n}(this, function($, Sifter, MicroPlugin) {\n\t'use strict';\n\n\tvar highlight = function($element, pattern) {\n\t\tif (typeof pattern === 'string' && !pattern.length) return;\n\t\tvar regex = (typeof pattern === 'string') ? new RegExp(pattern, 'i') : pattern;\n\t\n\t\tvar highlight = function(node) {\n\t\t\tvar skip = 0;\n\t\t\t// Wrap matching part of text node with highlighting <span>, e.g.\n\t\t\t// Soccer  ->  <span class=\"highlight\">Soc</span>cer  for regex = /soc/i\n\t\t\tif (node.nodeType === 3) {\n\t\t\t\tvar pos = node.data.search(regex);\n\t\t\t\tif (pos >= 0 && node.data.length > 0) {\n\t\t\t\t\tvar match = node.data.match(regex);\n\t\t\t\t\tvar spannode = document.createElement('span');\n\t\t\t\t\tspannode.className = 'highlight';\n\t\t\t\t\tvar middlebit = node.splitText(pos);\n\t\t\t\t\tvar endbit = middlebit.splitText(match[0].length);\n\t\t\t\t\tvar middleclone = middlebit.cloneNode(true);\n\t\t\t\t\tspannode.appendChild(middleclone);\n\t\t\t\t\tmiddlebit.parentNode.replaceChild(spannode, middlebit);\n\t\t\t\t\tskip = 1;\n\t\t\t\t}\n\t\t\t} \n\t\t\t// Recurse element node, looking for child text nodes to highlight, unless element \n\t\t\t// is childless, <script>, <style>, or already highlighted: <span class=\"hightlight\">\n\t\t\telse if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName) && ( node.className !== 'highlight' || node.tagName !== 'SPAN' )) {\n\t\t\t\tfor (var i = 0; i < node.childNodes.length; ++i) {\n\t\t\t\t\ti += highlight(node.childNodes[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn skip;\n\t\t};\n\t\n\t\treturn $element.each(function() {\n\t\t\thighlight(this);\n\t\t});\n\t};\n\t\n\t/**\n\t * removeHighlight fn copied from highlight v5 and\n\t * edited to remove with() and pass js strict mode\n\t */\n\t$.fn.removeHighlight = function() {\n\t\treturn this.find(\"span.highlight\").each(function() {\n\t\t\tthis.parentNode.firstChild.nodeName;\n\t\t\tvar parent = this.parentNode;\n\t\t\tparent.replaceChild(this.firstChild, this);\n\t\t\tparent.normalize();\n\t\t}).end();\n\t};\n\t\n\t\n\tvar MicroEvent = function() {};\n\tMicroEvent.prototype = {\n\t\ton: function(event, fct){\n\t\t\tthis._events = this._events || {};\n\t\t\tthis._events[event] = this._events[event] || [];\n\t\t\tthis._events[event].push(fct);\n\t\t},\n\t\toff: function(event, fct){\n\t\t\tvar n = arguments.length;\n\t\t\tif (n === 0) return delete this._events;\n\t\t\tif (n === 1) return delete this._events[event];\n\t\n\t\t\tthis._events = this._events || {};\n\t\t\tif (event in this._events === false) return;\n\t\t\tthis._events[event].splice(this._events[event].indexOf(fct), 1);\n\t\t},\n\t\ttrigger: function(event /* , args... */){\n\t\t\tthis._events = this._events || {};\n\t\t\tif (event in this._events === false) return;\n\t\t\tfor (var i = 0; i < this._events[event].length; i++){\n\t\t\t\tthis._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1));\n\t\t\t}\n\t\t}\n\t};\n\t\n\t/**\n\t * Mixin will delegate all MicroEvent.js function in the destination object.\n\t *\n\t * - MicroEvent.mixin(Foobar) will make Foobar able to use MicroEvent\n\t *\n\t * @param {object} the object which will support MicroEvent\n\t */\n\tMicroEvent.mixin = function(destObject){\n\t\tvar props = ['on', 'off', 'trigger'];\n\t\tfor (var i = 0; i < props.length; i++){\n\t\t\tdestObject.prototype[props[i]] = MicroEvent.prototype[props[i]];\n\t\t}\n\t};\n\t\n\tvar IS_MAC        = /Mac/.test(navigator.userAgent);\n\t\n\tvar KEY_A         = 65;\n\tvar KEY_COMMA     = 188;\n\tvar KEY_RETURN    = 13;\n\tvar KEY_ESC       = 27;\n\tvar KEY_LEFT      = 37;\n\tvar KEY_UP        = 38;\n\tvar KEY_P         = 80;\n\tvar KEY_RIGHT     = 39;\n\tvar KEY_DOWN      = 40;\n\tvar KEY_N         = 78;\n\tvar KEY_BACKSPACE = 8;\n\tvar KEY_DELETE    = 46;\n\tvar KEY_SHIFT     = 16;\n\tvar KEY_CMD       = IS_MAC ? 91 : 17;\n\tvar KEY_CTRL      = IS_MAC ? 18 : 17;\n\tvar KEY_TAB       = 9;\n\t\n\tvar TAG_SELECT    = 1;\n\tvar TAG_INPUT     = 2;\n\t\n\t// for now, android support in general is too spotty to support validity\n\tvar SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity;\n\t\n\t\n\tvar isset = function(object) {\n\t\treturn typeof object !== 'undefined';\n\t};\n\t\n\t/**\n\t * Converts a scalar to its best string representation\n\t * for hash keys and HTML attribute values.\n\t *\n\t * Transformations:\n\t *   'str'     -> 'str'\n\t *   null      -> ''\n\t *   undefined -> ''\n\t *   true      -> '1'\n\t *   false     -> '0'\n\t *   0         -> '0'\n\t *   1         -> '1'\n\t *\n\t * @param {string} value\n\t * @returns {string|null}\n\t */\n\tvar hash_key = function(value) {\n\t\tif (typeof value === 'undefined' || value === null) return null;\n\t\tif (typeof value === 'boolean') return value ? '1' : '0';\n\t\treturn value + '';\n\t};\n\t\n\t/**\n\t * Escapes a string for use within HTML.\n\t *\n\t * @param {string} str\n\t * @returns {string}\n\t */\n\tvar escape_html = function(str) {\n\t\treturn (str + '')\n\t\t\t.replace(/&/g, '&amp;')\n\t\t\t.replace(/</g, '&lt;')\n\t\t\t.replace(/>/g, '&gt;')\n\t\t\t.replace(/\"/g, '&quot;');\n\t};\n\t\n\t/**\n\t * Escapes \"$\" characters in replacement strings.\n\t *\n\t * @param {string} str\n\t * @returns {string}\n\t */\n\tvar escape_replace = function(str) {\n\t\treturn (str + '').replace(/\\$/g, '$$$$');\n\t};\n\t\n\tvar hook = {};\n\t\n\t/**\n\t * Wraps `method` on `self` so that `fn`\n\t * is invoked before the original method.\n\t *\n\t * @param {object} self\n\t * @param {string} method\n\t * @param {function} fn\n\t */\n\thook.before = function(self, method, fn) {\n\t\tvar original = self[method];\n\t\tself[method] = function() {\n\t\t\tfn.apply(self, arguments);\n\t\t\treturn original.apply(self, arguments);\n\t\t};\n\t};\n\t\n\t/**\n\t * Wraps `method` on `self` so that `fn`\n\t * is invoked after the original method.\n\t *\n\t * @param {object} self\n\t * @param {string} method\n\t * @param {function} fn\n\t */\n\thook.after = function(self, method, fn) {\n\t\tvar original = self[method];\n\t\tself[method] = function() {\n\t\t\tvar result = original.apply(self, arguments);\n\t\t\tfn.apply(self, arguments);\n\t\t\treturn result;\n\t\t};\n\t};\n\t\n\t/**\n\t * Wraps `fn` so that it can only be invoked once.\n\t *\n\t * @param {function} fn\n\t * @returns {function}\n\t */\n\tvar once = function(fn) {\n\t\tvar called = false;\n\t\treturn function() {\n\t\t\tif (called) return;\n\t\t\tcalled = true;\n\t\t\tfn.apply(this, arguments);\n\t\t};\n\t};\n\t\n\t/**\n\t * Wraps `fn` so that it can only be called once\n\t * every `delay` milliseconds (invoked on the falling edge).\n\t *\n\t * @param {function} fn\n\t * @param {int} delay\n\t * @returns {function}\n\t */\n\tvar debounce = function(fn, delay) {\n\t\tvar timeout;\n\t\treturn function() {\n\t\t\tvar self = this;\n\t\t\tvar args = arguments;\n\t\t\twindow.clearTimeout(timeout);\n\t\t\ttimeout = window.setTimeout(function() {\n\t\t\t\tfn.apply(self, args);\n\t\t\t}, delay);\n\t\t};\n\t};\n\t\n\t/**\n\t * Debounce all fired events types listed in `types`\n\t * while executing the provided `fn`.\n\t *\n\t * @param {object} self\n\t * @param {array} types\n\t * @param {function} fn\n\t */\n\tvar debounce_events = function(self, types, fn) {\n\t\tvar type;\n\t\tvar trigger = self.trigger;\n\t\tvar event_args = {};\n\t\n\t\t// override trigger method\n\t\tself.trigger = function() {\n\t\t\tvar type = arguments[0];\n\t\t\tif (types.indexOf(type) !== -1) {\n\t\t\t\tevent_args[type] = arguments;\n\t\t\t} else {\n\t\t\t\treturn trigger.apply(self, arguments);\n\t\t\t}\n\t\t};\n\t\n\t\t// invoke provided function\n\t\tfn.apply(self, []);\n\t\tself.trigger = trigger;\n\t\n\t\t// trigger queued events\n\t\tfor (type in event_args) {\n\t\t\tif (event_args.hasOwnProperty(type)) {\n\t\t\t\ttrigger.apply(self, event_args[type]);\n\t\t\t}\n\t\t}\n\t};\n\t\n\t/**\n\t * A workaround for http://bugs.jquery.com/ticket/6696\n\t *\n\t * @param {object} $parent - Parent element to listen on.\n\t * @param {string} event - Event name.\n\t * @param {string} selector - Descendant selector to filter by.\n\t * @param {function} fn - Event handler.\n\t */\n\tvar watchChildEvent = function($parent, event, selector, fn) {\n\t\t$parent.on(event, selector, function(e) {\n\t\t\tvar child = e.target;\n\t\t\twhile (child && child.parentNode !== $parent[0]) {\n\t\t\t\tchild = child.parentNode;\n\t\t\t}\n\t\t\te.currentTarget = child;\n\t\t\treturn fn.apply(this, [e]);\n\t\t});\n\t};\n\t\n\t/**\n\t * Determines the current selection within a text input control.\n\t * Returns an object containing:\n\t *   - start\n\t *   - length\n\t *\n\t * @param {object} input\n\t * @returns {object}\n\t */\n\tvar getSelection = function(input) {\n\t\tvar result = {};\n\t\tif ('selectionStart' in input) {\n\t\t\tresult.start = input.selectionStart;\n\t\t\tresult.length = input.selectionEnd - result.start;\n\t\t} else if (document.selection) {\n\t\t\tinput.focus();\n\t\t\tvar sel = document.selection.createRange();\n\t\t\tvar selLen = document.selection.createRange().text.length;\n\t\t\tsel.moveStart('character', -input.value.length);\n\t\t\tresult.start = sel.text.length - selLen;\n\t\t\tresult.length = selLen;\n\t\t}\n\t\treturn result;\n\t};\n\t\n\t/**\n\t * Copies CSS properties from one element to another.\n\t *\n\t * @param {object} $from\n\t * @param {object} $to\n\t * @param {array} properties\n\t */\n\tvar transferStyles = function($from, $to, properties) {\n\t\tvar i, n, styles = {};\n\t\tif (properties) {\n\t\t\tfor (i = 0, n = properties.length; i < n; i++) {\n\t\t\t\tstyles[properties[i]] = $from.css(properties[i]);\n\t\t\t}\n\t\t} else {\n\t\t\tstyles = $from.css();\n\t\t}\n\t\t$to.css(styles);\n\t};\n\t\n\t/**\n\t * Measures the width of a string within a\n\t * parent element (in pixels).\n\t *\n\t * @param {string} str\n\t * @param {object} $parent\n\t * @returns {int}\n\t */\n\tvar measureString = function(str, $parent) {\n\t\tif (!str) {\n\t\t\treturn 0;\n\t\t}\n\t\n\t\tif (!Selectize.$testInput) {\n\t\t\tSelectize.$testInput = $('<span />').css({\n\t\t\t\tposition: 'absolute',\n\t\t\t\ttop: -99999,\n\t\t\t\tleft: -99999,\n\t\t\t\twidth: 'auto',\n\t\t\t\tpadding: 0,\n\t\t\t\twhiteSpace: 'pre'\n\t\t\t}).appendTo('body');\n\t\t}\n\t\n\t\tSelectize.$testInput.text(str);\n\t\n\t\ttransferStyles($parent, Selectize.$testInput, [\n\t\t\t'letterSpacing',\n\t\t\t'fontSize',\n\t\t\t'fontFamily',\n\t\t\t'fontWeight',\n\t\t\t'textTransform'\n\t\t]);\n\t\n\t\treturn Selectize.$testInput.width();\n\t};\n\t\n\t/**\n\t * Sets up an input to grow horizontally as the user\n\t * types. If the value is changed manually, you can\n\t * trigger the \"update\" handler to resize:\n\t *\n\t * $input.trigger('update');\n\t *\n\t * @param {object} $input\n\t */\n\tvar autoGrow = function($input) {\n\t\tvar currentWidth = null;\n\t\n\t\tvar update = function(e, options) {\n\t\t\tvar value, keyCode, printable, placeholder, width;\n\t\t\tvar shift, character, selection;\n\t\t\te = e || window.event || {};\n\t\t\toptions = options || {};\n\t\n\t\t\tif (e.metaKey || e.altKey) return;\n\t\t\tif (!options.force && $input.data('grow') === false) return;\n\t\n\t\t\tvalue = $input.val();\n\t\t\tif (e.type && e.type.toLowerCase() === 'keydown') {\n\t\t\t\tkeyCode = e.keyCode;\n\t\t\t\tprintable = (\n\t\t\t\t\t(keyCode >= 48 && keyCode <= 57)  || // 0-9\n\t\t\t\t\t(keyCode >= 65 && keyCode <= 90)   || // a-z\n\t\t\t\t\t(keyCode >= 96 && keyCode <= 111)  || // numpad 0-9, numeric operators\n\t\t\t\t\t(keyCode >= 186 && keyCode <= 222) || // semicolon, equal, comma, dash, etc.\n\t\t\t\t\tkeyCode === 32 // space\n\t\t\t\t);\n\t\n\t\t\t\tif (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) {\n\t\t\t\t\tselection = getSelection($input[0]);\n\t\t\t\t\tif (selection.length) {\n\t\t\t\t\t\tvalue = value.substring(0, selection.start) + value.substring(selection.start + selection.length);\n\t\t\t\t\t} else if (keyCode === KEY_BACKSPACE && selection.start) {\n\t\t\t\t\t\tvalue = value.substring(0, selection.start - 1) + value.substring(selection.start + 1);\n\t\t\t\t\t} else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') {\n\t\t\t\t\t\tvalue = value.substring(0, selection.start) + value.substring(selection.start + 1);\n\t\t\t\t\t}\n\t\t\t\t} else if (printable) {\n\t\t\t\t\tshift = e.shiftKey;\n\t\t\t\t\tcharacter = String.fromCharCode(e.keyCode);\n\t\t\t\t\tif (shift) character = character.toUpperCase();\n\t\t\t\t\telse character = character.toLowerCase();\n\t\t\t\t\tvalue += character;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tplaceholder = $input.attr('placeholder');\n\t\t\tif (!value && placeholder) {\n\t\t\t\tvalue = placeholder;\n\t\t\t}\n\t\n\t\t\twidth = measureString(value, $input) + 4;\n\t\t\tif (width !== currentWidth) {\n\t\t\t\tcurrentWidth = width;\n\t\t\t\t$input.width(width);\n\t\t\t\t$input.triggerHandler('resize');\n\t\t\t}\n\t\t};\n\t\n\t\t$input.on('keydown keyup update blur', update);\n\t\tupdate();\n\t};\n\t\n\tvar domToString = function(d) {\n\t\tvar tmp = document.createElement('div');\n\t\n\t\ttmp.appendChild(d.cloneNode(true));\n\t\n\t\treturn tmp.innerHTML;\n\t};\n\t\n\tvar logError = function(message, options){\n\t\tif(!options) options = {};\n\t\tvar component = \"Selectize\";\n\t\n\t\tconsole.error(component + \": \" + message)\n\t\n\t\tif(options.explanation){\n\t\t\t// console.group is undefined in <IE11\n\t\t\tif(console.group) console.group();\n\t\t\tconsole.error(options.explanation);\n\t\t\tif(console.group) console.groupEnd();\n\t\t}\n\t}\n\t\n\t\n\tvar Selectize = function($input, settings) {\n\t\tvar key, i, n, dir, input, self = this;\n\t\tinput = $input[0];\n\t\tinput.selectize = self;\n\t\n\t\t// detect rtl environment\n\t\tvar computedStyle = window.getComputedStyle && window.getComputedStyle(input, null);\n\t\tdir = computedStyle ? computedStyle.getPropertyValue('direction') : input.currentStyle && input.currentStyle.direction;\n\t\tdir = dir || $input.parents('[dir]:first').attr('dir') || '';\n\t\n\t\t// setup default state\n\t\t$.extend(self, {\n\t\t\torder            : 0,\n\t\t\tsettings         : settings,\n\t\t\t$input           : $input,\n\t\t\ttabIndex         : $input.attr('tabindex') || '',\n\t\t\ttagType          : input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT,\n\t\t\trtl              : /rtl/i.test(dir),\n\t\n\t\t\teventNS          : '.selectize' + (++Selectize.count),\n\t\t\thighlightedValue : null,\n\t\t\tisBlurring       : false,\n\t\t\tisOpen           : false,\n\t\t\tisDisabled       : false,\n\t\t\tisRequired       : $input.is('[required]'),\n\t\t\tisInvalid        : false,\n\t\t\tisLocked         : false,\n\t\t\tisFocused        : false,\n\t\t\tisInputHidden    : false,\n\t\t\tisSetup          : false,\n\t\t\tisShiftDown      : false,\n\t\t\tisCmdDown        : false,\n\t\t\tisCtrlDown       : false,\n\t\t\tignoreFocus      : false,\n\t\t\tignoreBlur       : false,\n\t\t\tignoreHover      : false,\n\t\t\thasOptions       : false,\n\t\t\tcurrentResults   : null,\n\t\t\tlastValue        : '',\n\t\t\tcaretPos         : 0,\n\t\t\tloading          : 0,\n\t\t\tloadedSearches   : {},\n\t\n\t\t\t$activeOption    : null,\n\t\t\t$activeItems     : [],\n\t\n\t\t\toptgroups        : {},\n\t\t\toptions          : {},\n\t\t\tuserOptions      : {},\n\t\t\titems            : [],\n\t\t\trenderCache      : {},\n\t\t\tonSearchChange   : settings.loadThrottle === null ? self.onSearchChange : debounce(self.onSearchChange, settings.loadThrottle)\n\t\t});\n\t\n\t\t// search system\n\t\tself.sifter = new Sifter(this.options, {diacritics: settings.diacritics});\n\t\n\t\t// build options table\n\t\tif (self.settings.options) {\n\t\t\tfor (i = 0, n = self.settings.options.length; i < n; i++) {\n\t\t\t\tself.registerOption(self.settings.options[i]);\n\t\t\t}\n\t\t\tdelete self.settings.options;\n\t\t}\n\t\n\t\t// build optgroup table\n\t\tif (self.settings.optgroups) {\n\t\t\tfor (i = 0, n = self.settings.optgroups.length; i < n; i++) {\n\t\t\t\tself.registerOptionGroup(self.settings.optgroups[i]);\n\t\t\t}\n\t\t\tdelete self.settings.optgroups;\n\t\t}\n\t\n\t\t// option-dependent defaults\n\t\tself.settings.mode = self.settings.mode || (self.settings.maxItems === 1 ? 'single' : 'multi');\n\t\tif (typeof self.settings.hideSelected !== 'boolean') {\n\t\t\tself.settings.hideSelected = self.settings.mode === 'multi';\n\t\t}\n\t\n\t\tself.initializePlugins(self.settings.plugins);\n\t\tself.setupCallbacks();\n\t\tself.setupTemplates();\n\t\tself.setup();\n\t};\n\t\n\t// mixins\n\t// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\t\n\tMicroEvent.mixin(Selectize);\n\t\n\tif(typeof MicroPlugin !== \"undefined\"){\n\t\tMicroPlugin.mixin(Selectize);\n\t}else{\n\t\tlogError(\"Dependency MicroPlugin is missing\",\n\t\t\t{explanation:\n\t\t\t\t\"Make sure you either: (1) are using the \\\"standalone\\\" \"+\n\t\t\t\t\"version of Selectize, or (2) require MicroPlugin before you \"+\n\t\t\t\t\"load Selectize.\"}\n\t\t);\n\t}\n\t\n\t\n\t// methods\n\t// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\t\n\t$.extend(Selectize.prototype, {\n\t\n\t\t/**\n\t\t * Creates all elements and sets up event bindings.\n\t\t */\n\t\tsetup: function() {\n\t\t\tvar self      = this;\n\t\t\tvar settings  = self.settings;\n\t\t\tvar eventNS   = self.eventNS;\n\t\t\tvar $window   = $(window);\n\t\t\tvar $document = $(document);\n\t\t\tvar $input    = self.$input;\n\t\n\t\t\tvar $wrapper;\n\t\t\tvar $control;\n\t\t\tvar $control_input;\n\t\t\tvar $dropdown;\n\t\t\tvar $dropdown_content;\n\t\t\tvar $dropdown_parent;\n\t\t\tvar inputMode;\n\t\t\tvar timeout_blur;\n\t\t\tvar timeout_focus;\n\t\t\tvar classes;\n\t\t\tvar classes_plugins;\n\t\t\tvar inputId;\n\t\n\t\t\tinputMode         = self.settings.mode;\n\t\t\tclasses           = $input.attr('class') || '';\n\t\n\t\t\t$wrapper          = $('<div>').addClass(settings.wrapperClass).addClass(classes).addClass(inputMode);\n\t\t\t$control          = $('<div>').addClass(settings.inputClass).addClass('items').appendTo($wrapper);\n\t\t\t$control_input    = $('<input type=\"text\" autocomplete=\"off\" />').appendTo($control).attr('tabindex', $input.is(':disabled') ? '-1' : self.tabIndex);\n\t\t\t$dropdown_parent  = $(settings.dropdownParent || $wrapper);\n\t\t\t$dropdown         = $('<div>').addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent);\n\t\t\t$dropdown_content = $('<div>').addClass(settings.dropdownContentClass).appendTo($dropdown);\n\t\n\t\t\tif(inputId = $input.attr('id')) {\n\t\t\t\t$control_input.attr('id', inputId + '-selectized');\n\t\t\t\t$(\"label[for='\"+inputId+\"']\").attr('for', inputId + '-selectized');\n\t\t\t}\n\t\n\t\t\tif(self.settings.copyClassesToDropdown) {\n\t\t\t\t$dropdown.addClass(classes);\n\t\t\t}\n\t\n\t\t\t$wrapper.css({\n\t\t\t\twidth: $input[0].style.width\n\t\t\t});\n\t\n\t\t\tif (self.plugins.names.length) {\n\t\t\t\tclasses_plugins = 'plugin-' + self.plugins.names.join(' plugin-');\n\t\t\t\t$wrapper.addClass(classes_plugins);\n\t\t\t\t$dropdown.addClass(classes_plugins);\n\t\t\t}\n\t\n\t\t\tif ((settings.maxItems === null || settings.maxItems > 1) && self.tagType === TAG_SELECT) {\n\t\t\t\t$input.attr('multiple', 'multiple');\n\t\t\t}\n\t\n\t\t\tif (self.settings.placeholder) {\n\t\t\t\t$control_input.attr('placeholder', settings.placeholder);\n\t\t\t}\n\t\n\t\t\t// if splitOn was not passed in, construct it from the delimiter to allow pasting universally\n\t\t\tif (!self.settings.splitOn && self.settings.delimiter) {\n\t\t\t\tvar delimiterEscaped = self.settings.delimiter.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n\t\t\t\tself.settings.splitOn = new RegExp('\\\\s*' + delimiterEscaped + '+\\\\s*');\n\t\t\t}\n\t\n\t\t\tif ($input.attr('autocorrect')) {\n\t\t\t\t$control_input.attr('autocorrect', $input.attr('autocorrect'));\n\t\t\t}\n\t\n\t\t\tif ($input.attr('autocapitalize')) {\n\t\t\t\t$control_input.attr('autocapitalize', $input.attr('autocapitalize'));\n\t\t\t}\n\t\t\t$control_input[0].type = $input[0].type;\n\t\n\t\t\tself.$wrapper          = $wrapper;\n\t\t\tself.$control          = $control;\n\t\t\tself.$control_input    = $control_input;\n\t\t\tself.$dropdown         = $dropdown;\n\t\t\tself.$dropdown_content = $dropdown_content;\n\t\n\t\t\t$dropdown.on('mouseenter mousedown click', '[data-disabled]>[data-selectable]', function(e) { e.stopImmediatePropagation(); });\n\t\t\t$dropdown.on('mouseenter', '[data-selectable]', function() { return self.onOptionHover.apply(self, arguments); });\n\t\t\t$dropdown.on('mousedown click', '[data-selectable]', function() { return self.onOptionSelect.apply(self, arguments); });\n\t\t\twatchChildEvent($control, 'mousedown', '*:not(input)', function() { return self.onItemSelect.apply(self, arguments); });\n\t\t\tautoGrow($control_input);\n\t\n\t\t\t$control.on({\n\t\t\t\tmousedown : function() { return self.onMouseDown.apply(self, arguments); },\n\t\t\t\tclick     : function() { return self.onClick.apply(self, arguments); }\n\t\t\t});\n\t\n\t\t\t$control_input.on({\n\t\t\t\tmousedown : function(e) { e.stopPropagation(); },\n\t\t\t\tkeydown   : function() { return self.onKeyDown.apply(self, arguments); },\n\t\t\t\tkeyup     : function() { return self.onKeyUp.apply(self, arguments); },\n\t\t\t\tkeypress  : function() { return self.onKeyPress.apply(self, arguments); },\n\t\t\t\tresize    : function() { self.positionDropdown.apply(self, []); },\n\t\t\t\tblur      : function() { return self.onBlur.apply(self, arguments); },\n\t\t\t\tfocus     : function() { self.ignoreBlur = false; return self.onFocus.apply(self, arguments); },\n\t\t\t\tpaste     : function() { return self.onPaste.apply(self, arguments); }\n\t\t\t});\n\t\n\t\t\t$document.on('keydown' + eventNS, function(e) {\n\t\t\t\tself.isCmdDown = e[IS_MAC ? 'metaKey' : 'ctrlKey'];\n\t\t\t\tself.isCtrlDown = e[IS_MAC ? 'altKey' : 'ctrlKey'];\n\t\t\t\tself.isShiftDown = e.shiftKey;\n\t\t\t});\n\t\n\t\t\t$document.on('keyup' + eventNS, function(e) {\n\t\t\t\tif (e.keyCode === KEY_CTRL) self.isCtrlDown = false;\n\t\t\t\tif (e.keyCode === KEY_SHIFT) self.isShiftDown = false;\n\t\t\t\tif (e.keyCode === KEY_CMD) self.isCmdDown = false;\n\t\t\t});\n\t\n\t\t\t$document.on('mousedown' + eventNS, function(e) {\n\t\t\t\tif (self.isFocused) {\n\t\t\t\t\t// prevent events on the dropdown scrollbar from causing the control to blur\n\t\t\t\t\tif (e.target === self.$dropdown[0] || e.target.parentNode === self.$dropdown[0]) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\t// blur on click outside\n\t\t\t\t\tif (!self.$control.has(e.target).length && e.target !== self.$control[0]) {\n\t\t\t\t\t\tself.blur(e.target);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\t$window.on(['scroll' + eventNS, 'resize' + eventNS].join(' '), function() {\n\t\t\t\tif (self.isOpen) {\n\t\t\t\t\tself.positionDropdown.apply(self, arguments);\n\t\t\t\t}\n\t\t\t});\n\t\t\t$window.on('mousemove' + eventNS, function() {\n\t\t\t\tself.ignoreHover = false;\n\t\t\t});\n\t\n\t\t\t// store original children and tab index so that they can be\n\t\t\t// restored when the destroy() method is called.\n\t\t\tthis.revertSettings = {\n\t\t\t\t$children : $input.children().detach(),\n\t\t\t\ttabindex  : $input.attr('tabindex')\n\t\t\t};\n\t\n\t\t\t$input.attr('tabindex', -1).hide().after(self.$wrapper);\n\t\n\t\t\tif ($.isArray(settings.items)) {\n\t\t\t\tself.setValue(settings.items);\n\t\t\t\tdelete settings.items;\n\t\t\t}\n\t\n\t\t\t// feature detect for the validation API\n\t\t\tif (SUPPORTS_VALIDITY_API) {\n\t\t\t\t$input.on('invalid' + eventNS, function(e) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tself.isInvalid = true;\n\t\t\t\t\tself.refreshState();\n\t\t\t\t});\n\t\t\t}\n\t\n\t\t\tself.updateOriginalInput();\n\t\t\tself.refreshItems();\n\t\t\tself.refreshState();\n\t\t\tself.updatePlaceholder();\n\t\t\tself.isSetup = true;\n\t\n\t\t\tif ($input.is(':disabled')) {\n\t\t\t\tself.disable();\n\t\t\t}\n\t\n\t\t\tself.on('change', this.onChange);\n\t\n\t\t\t$input.data('selectize', self);\n\t\t\t$input.addClass('selectized');\n\t\t\tself.trigger('initialize');\n\t\n\t\t\t// preload options\n\t\t\tif (settings.preload === true) {\n\t\t\t\tself.onSearchChange('');\n\t\t\t}\n\t\n\t\t},\n\t\n\t\t/**\n\t\t * Sets up default rendering functions.\n\t\t */\n\t\tsetupTemplates: function() {\n\t\t\tvar self = this;\n\t\t\tvar field_label = self.settings.labelField;\n\t\t\tvar field_optgroup = self.settings.optgroupLabelField;\n\t\n\t\t\tvar templates = {\n\t\t\t\t'optgroup': function(data) {\n\t\t\t\t\treturn '<div class=\"optgroup\">' + data.html + '</div>';\n\t\t\t\t},\n\t\t\t\t'optgroup_header': function(data, escape) {\n\t\t\t\t\treturn '<div class=\"optgroup-header\">' + escape(data[field_optgroup]) + '</div>';\n\t\t\t\t},\n\t\t\t\t'option': function(data, escape) {\n\t\t\t\t\treturn '<div class=\"option\">' + escape(data[field_label]) + '</div>';\n\t\t\t\t},\n\t\t\t\t'item': function(data, escape) {\n\t\t\t\t\treturn '<div class=\"item\">' + escape(data[field_label]) + '</div>';\n\t\t\t\t},\n\t\t\t\t'option_create': function(data, escape) {\n\t\t\t\t\treturn '<div class=\"create\">Add <strong>' + escape(data.input) + '</strong>&hellip;</div>';\n\t\t\t\t}\n\t\t\t};\n\t\n\t\t\tself.settings.render = $.extend({}, templates, self.settings.render);\n\t\t},\n\t\n\t\t/**\n\t\t * Maps fired events to callbacks provided\n\t\t * in the settings used when creating the control.\n\t\t */\n\t\tsetupCallbacks: function() {\n\t\t\tvar key, fn, callbacks = {\n\t\t\t\t'initialize'      : 'onInitialize',\n\t\t\t\t'change'          : 'onChange',\n\t\t\t\t'item_add'        : 'onItemAdd',\n\t\t\t\t'item_remove'     : 'onItemRemove',\n\t\t\t\t'clear'           : 'onClear',\n\t\t\t\t'option_add'      : 'onOptionAdd',\n\t\t\t\t'option_remove'   : 'onOptionRemove',\n\t\t\t\t'option_clear'    : 'onOptionClear',\n\t\t\t\t'optgroup_add'    : 'onOptionGroupAdd',\n\t\t\t\t'optgroup_remove' : 'onOptionGroupRemove',\n\t\t\t\t'optgroup_clear'  : 'onOptionGroupClear',\n\t\t\t\t'dropdown_open'   : 'onDropdownOpen',\n\t\t\t\t'dropdown_close'  : 'onDropdownClose',\n\t\t\t\t'type'            : 'onType',\n\t\t\t\t'load'            : 'onLoad',\n\t\t\t\t'focus'           : 'onFocus',\n\t\t\t\t'blur'            : 'onBlur'\n\t\t\t};\n\t\n\t\t\tfor (key in callbacks) {\n\t\t\t\tif (callbacks.hasOwnProperty(key)) {\n\t\t\t\t\tfn = this.settings[callbacks[key]];\n\t\t\t\t\tif (fn) this.on(key, fn);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered when the main control element\n\t\t * has a click event.\n\t\t *\n\t\t * @param {object} e\n\t\t * @return {boolean}\n\t\t */\n\t\tonClick: function(e) {\n\t\t\tvar self = this;\n\t\n\t\t\t// necessary for mobile webkit devices (manual focus triggering\n\t\t\t// is ignored unless invoked within a click event)\n\t    // also necessary to reopen a dropdown that has been closed by\n\t    // closeAfterSelect\n\t\t\tif (!self.isFocused || !self.isOpen) {\n\t\t\t\tself.focus();\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered when the main control element\n\t\t * has a mouse down event.\n\t\t *\n\t\t * @param {object} e\n\t\t * @return {boolean}\n\t\t */\n\t\tonMouseDown: function(e) {\n\t\t\tvar self = this;\n\t\t\tvar defaultPrevented = e.isDefaultPrevented();\n\t\t\tvar $target = $(e.target);\n\t\n\t\t\tif (self.isFocused) {\n\t\t\t\t// retain focus by preventing native handling. if the\n\t\t\t\t// event target is the input it should not be modified.\n\t\t\t\t// otherwise, text selection within the input won't work.\n\t\t\t\tif (e.target !== self.$control_input[0]) {\n\t\t\t\t\tif (self.settings.mode === 'single') {\n\t\t\t\t\t\t// toggle dropdown\n\t\t\t\t\t\tself.isOpen ? self.close() : self.open();\n\t\t\t\t\t} else if (!defaultPrevented) {\n\t\t\t\t\t\tself.setActiveItem(null);\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// give control focus\n\t\t\t\tif (!defaultPrevented) {\n\t\t\t\t\twindow.setTimeout(function() {\n\t\t\t\t\t\tself.focus();\n\t\t\t\t\t}, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered when the value of the control has been changed.\n\t\t * This should propagate the event to the original DOM\n\t\t * input / select element.\n\t\t */\n\t\tonChange: function() {\n\t\t\tthis.$input.trigger('change');\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered on <input> paste.\n\t\t *\n\t\t * @param {object} e\n\t\t * @returns {boolean}\n\t\t */\n\t\tonPaste: function(e) {\n\t\t\tvar self = this;\n\t\n\t\t\tif (self.isFull() || self.isInputHidden || self.isLocked) {\n\t\t\t\te.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// If a regex or string is included, this will split the pasted\n\t\t\t// input and create Items for each separate value\n\t\t\tif (self.settings.splitOn) {\n\t\n\t\t\t\t// Wait for pasted text to be recognized in value\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tvar pastedText = self.$control_input.val();\n\t\t\t\t\tif(!pastedText.match(self.settings.splitOn)){ return }\n\t\n\t\t\t\t\tvar splitInput = $.trim(pastedText).split(self.settings.splitOn);\n\t\t\t\t\tfor (var i = 0, n = splitInput.length; i < n; i++) {\n\t\t\t\t\t\tself.createItem(splitInput[i]);\n\t\t\t\t\t}\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered on <input> keypress.\n\t\t *\n\t\t * @param {object} e\n\t\t * @returns {boolean}\n\t\t */\n\t\tonKeyPress: function(e) {\n\t\t\tif (this.isLocked) return e && e.preventDefault();\n\t\t\tvar character = String.fromCharCode(e.keyCode || e.which);\n\t\t\tif (this.settings.create && this.settings.mode === 'multi' && character === this.settings.delimiter) {\n\t\t\t\tthis.createItem();\n\t\t\t\te.preventDefault();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered on <input> keydown.\n\t\t *\n\t\t * @param {object} e\n\t\t * @returns {boolean}\n\t\t */\n\t\tonKeyDown: function(e) {\n\t\t\tvar isInput = e.target === this.$control_input[0];\n\t\t\tvar self = this;\n\t\n\t\t\tif (self.isLocked) {\n\t\t\t\tif (e.keyCode !== KEY_TAB) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tswitch (e.keyCode) {\n\t\t\t\tcase KEY_A:\n\t\t\t\t\tif (self.isCmdDown) {\n\t\t\t\t\t\tself.selectAll();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase KEY_ESC:\n\t\t\t\t\tif (self.isOpen) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\tself.close();\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\tcase KEY_N:\n\t\t\t\t\tif (!e.ctrlKey || e.altKey) break;\n\t\t\t\tcase KEY_DOWN:\n\t\t\t\t\tif (!self.isOpen && self.hasOptions) {\n\t\t\t\t\t\tself.open();\n\t\t\t\t\t} else if (self.$activeOption) {\n\t\t\t\t\t\tself.ignoreHover = true;\n\t\t\t\t\t\tvar $next = self.getAdjacentOption(self.$activeOption, 1);\n\t\t\t\t\t\tif ($next.length) self.setActiveOption($next, true, true);\n\t\t\t\t\t}\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\tcase KEY_P:\n\t\t\t\t\tif (!e.ctrlKey || e.altKey) break;\n\t\t\t\tcase KEY_UP:\n\t\t\t\t\tif (self.$activeOption) {\n\t\t\t\t\t\tself.ignoreHover = true;\n\t\t\t\t\t\tvar $prev = self.getAdjacentOption(self.$activeOption, -1);\n\t\t\t\t\t\tif ($prev.length) self.setActiveOption($prev, true, true);\n\t\t\t\t\t}\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\tcase KEY_RETURN:\n\t\t\t\t\tif (self.isOpen && self.$activeOption) {\n\t\t\t\t\t\tself.onOptionSelect({currentTarget: self.$activeOption});\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\tcase KEY_LEFT:\n\t\t\t\t\tself.advanceSelection(-1, e);\n\t\t\t\t\treturn;\n\t\t\t\tcase KEY_RIGHT:\n\t\t\t\t\tself.advanceSelection(1, e);\n\t\t\t\t\treturn;\n\t\t\t\tcase KEY_TAB:\n\t\t\t\t\tif (self.settings.selectOnTab && self.isOpen && self.$activeOption) {\n\t\t\t\t\t\tself.onOptionSelect({currentTarget: self.$activeOption});\n\t\n\t\t\t\t\t\t// Default behaviour is to jump to the next field, we only want this\n\t\t\t\t\t\t// if the current field doesn't accept any more entries\n\t\t\t\t\t\tif (!self.isFull()) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (self.settings.create && self.createItem()) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\tcase KEY_BACKSPACE:\n\t\t\t\tcase KEY_DELETE:\n\t\t\t\t\tself.deleteSelection(e);\n\t\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif ((self.isFull() || self.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) {\n\t\t\t\te.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered on <input> keyup.\n\t\t *\n\t\t * @param {object} e\n\t\t * @returns {boolean}\n\t\t */\n\t\tonKeyUp: function(e) {\n\t\t\tvar self = this;\n\t\n\t\t\tif (self.isLocked) return e && e.preventDefault();\n\t\t\tvar value = self.$control_input.val() || '';\n\t\t\tif (self.lastValue !== value) {\n\t\t\t\tself.lastValue = value;\n\t\t\t\tself.onSearchChange(value);\n\t\t\t\tself.refreshOptions();\n\t\t\t\tself.trigger('type', value);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Invokes the user-provide option provider / loader.\n\t\t *\n\t\t * Note: this function is debounced in the Selectize\n\t\t * constructor (by `settings.loadThrottle` milliseconds)\n\t\t *\n\t\t * @param {string} value\n\t\t */\n\t\tonSearchChange: function(value) {\n\t\t\tvar self = this;\n\t\t\tvar fn = self.settings.load;\n\t\t\tif (!fn) return;\n\t\t\tif (self.loadedSearches.hasOwnProperty(value)) return;\n\t\t\tself.loadedSearches[value] = true;\n\t\t\tself.load(function(callback) {\n\t\t\t\tfn.apply(self, [value, callback]);\n\t\t\t});\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered on <input> focus.\n\t\t *\n\t\t * @param {object} e (optional)\n\t\t * @returns {boolean}\n\t\t */\n\t\tonFocus: function(e) {\n\t\t\tvar self = this;\n\t\t\tvar wasFocused = self.isFocused;\n\t\n\t\t\tif (self.isDisabled) {\n\t\t\t\tself.blur();\n\t\t\t\te && e.preventDefault();\n\t\t\t\treturn false;\n\t\t\t}\n\t\n\t\t\tif (self.ignoreFocus) return;\n\t\t\tself.isFocused = true;\n\t\t\tif (self.settings.preload === 'focus') self.onSearchChange('');\n\t\n\t\t\tif (!wasFocused) self.trigger('focus');\n\t\n\t\t\tif (!self.$activeItems.length) {\n\t\t\t\tself.showInput();\n\t\t\t\tself.setActiveItem(null);\n\t\t\t\tself.refreshOptions(!!self.settings.openOnFocus);\n\t\t\t}\n\t\n\t\t\tself.refreshState();\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered on <input> blur.\n\t\t *\n\t\t * @param {object} e\n\t\t * @param {Element} dest\n\t\t */\n\t\tonBlur: function(e, dest) {\n\t\t\tvar self = this;\n\t\t\tif (!self.isFocused) return;\n\t\t\tself.isFocused = false;\n\t\n\t\t\tif (self.ignoreFocus) {\n\t\t\t\treturn;\n\t\t\t} else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) {\n\t\t\t\t// necessary to prevent IE closing the dropdown when the scrollbar is clicked\n\t\t\t\tself.ignoreBlur = true;\n\t\t\t\tself.onFocus(e);\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tvar deactivate = function() {\n\t\t\t\tself.close();\n\t\t\t\tself.setTextboxValue('');\n\t\t\t\tself.setActiveItem(null);\n\t\t\t\tself.setActiveOption(null);\n\t\t\t\tself.setCaret(self.items.length);\n\t\t\t\tself.refreshState();\n\t\n\t\t\t\t// IE11 bug: element still marked as active\n\t\t\t\tdest && dest.focus && dest.focus();\n\t\n\t\t\t\tself.isBlurring = false;\n\t\t\t\tself.ignoreFocus = false;\n\t\t\t\tself.trigger('blur');\n\t\t\t};\n\t\n\t\t\tself.isBlurring = true;\n\t\t\tself.ignoreFocus = true;\n\t\t\tif (self.settings.create && self.settings.createOnBlur) {\n\t\t\t\tself.createItem(null, false, deactivate);\n\t\t\t} else {\n\t\t\t\tdeactivate();\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered when the user rolls over\n\t\t * an option in the autocomplete dropdown menu.\n\t\t *\n\t\t * @param {object} e\n\t\t * @returns {boolean}\n\t\t */\n\t\tonOptionHover: function(e) {\n\t\t\tif (this.ignoreHover) return;\n\t\t\tthis.setActiveOption(e.currentTarget, false);\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered when the user clicks on an option\n\t\t * in the autocomplete dropdown menu.\n\t\t *\n\t\t * @param {object} e\n\t\t * @returns {boolean}\n\t\t */\n\t\tonOptionSelect: function(e) {\n\t\t\tvar value, $target, $option, self = this;\n\t\n\t\t\tif (e.preventDefault) {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\n\t\t\t$target = $(e.currentTarget);\n\t\t\tif ($target.hasClass('create')) {\n\t\t\t\tself.createItem(null, function() {\n\t\t\t\t\tif (self.settings.closeAfterSelect) {\n\t\t\t\t\t\tself.close();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tvalue = $target.attr('data-value');\n\t\t\t\tif (typeof value !== 'undefined') {\n\t\t\t\t\tself.lastQuery = null;\n\t\t\t\t\tself.setTextboxValue('');\n\t\t\t\t\tself.addItem(value);\n\t\t\t\t\tif (self.settings.closeAfterSelect) {\n\t\t\t\t\t\tself.close();\n\t\t\t\t\t} else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) {\n\t\t\t\t\t\tself.setActiveOption(self.getOption(value));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered when the user clicks on an item\n\t\t * that has been selected.\n\t\t *\n\t\t * @param {object} e\n\t\t * @returns {boolean}\n\t\t */\n\t\tonItemSelect: function(e) {\n\t\t\tvar self = this;\n\t\n\t\t\tif (self.isLocked) return;\n\t\t\tif (self.settings.mode === 'multi') {\n\t\t\t\te.preventDefault();\n\t\t\t\tself.setActiveItem(e.currentTarget, e);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Invokes the provided method that provides\n\t\t * results to a callback---which are then added\n\t\t * as options to the control.\n\t\t *\n\t\t * @param {function} fn\n\t\t */\n\t\tload: function(fn) {\n\t\t\tvar self = this;\n\t\t\tvar $wrapper = self.$wrapper.addClass(self.settings.loadingClass);\n\t\n\t\t\tself.loading++;\n\t\t\tfn.apply(self, [function(results) {\n\t\t\t\tself.loading = Math.max(self.loading - 1, 0);\n\t\t\t\tif (results && results.length) {\n\t\t\t\t\tself.addOption(results);\n\t\t\t\t\tself.refreshOptions(self.isFocused && !self.isInputHidden);\n\t\t\t\t}\n\t\t\t\tif (!self.loading) {\n\t\t\t\t\t$wrapper.removeClass(self.settings.loadingClass);\n\t\t\t\t}\n\t\t\t\tself.trigger('load', results);\n\t\t\t}]);\n\t\t},\n\t\n\t\t/**\n\t\t * Sets the input field of the control to the specified value.\n\t\t *\n\t\t * @param {string} value\n\t\t */\n\t\tsetTextboxValue: function(value) {\n\t\t\tvar $input = this.$control_input;\n\t\t\tvar changed = $input.val() !== value;\n\t\t\tif (changed) {\n\t\t\t\t$input.val(value).triggerHandler('update');\n\t\t\t\tthis.lastValue = value;\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Returns the value of the control. If multiple items\n\t\t * can be selected (e.g. <select multiple>), this returns\n\t\t * an array. If only one item can be selected, this\n\t\t * returns a string.\n\t\t *\n\t\t * @returns {mixed}\n\t\t */\n\t\tgetValue: function() {\n\t\t\tif (this.tagType === TAG_SELECT && this.$input.attr('multiple')) {\n\t\t\t\treturn this.items;\n\t\t\t} else {\n\t\t\t\treturn this.items.join(this.settings.delimiter);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Resets the selected items to the given value.\n\t\t *\n\t\t * @param {mixed} value\n\t\t */\n\t\tsetValue: function(value, silent) {\n\t\t\tvar events = silent ? [] : ['change'];\n\t\n\t\t\tdebounce_events(this, events, function() {\n\t\t\t\tthis.clear(silent);\n\t\t\t\tthis.addItems(value, silent);\n\t\t\t});\n\t\t},\n\t\n\t\t/**\n\t\t * Sets the selected item.\n\t\t *\n\t\t * @param {object} $item\n\t\t * @param {object} e (optional)\n\t\t */\n\t\tsetActiveItem: function($item, e) {\n\t\t\tvar self = this;\n\t\t\tvar eventName;\n\t\t\tvar i, idx, begin, end, item, swap;\n\t\t\tvar $last;\n\t\n\t\t\tif (self.settings.mode === 'single') return;\n\t\t\t$item = $($item);\n\t\n\t\t\t// clear the active selection\n\t\t\tif (!$item.length) {\n\t\t\t\t$(self.$activeItems).removeClass('active');\n\t\t\t\tself.$activeItems = [];\n\t\t\t\tif (self.isFocused) {\n\t\t\t\t\tself.showInput();\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// modify selection\n\t\t\teventName = e && e.type.toLowerCase();\n\t\n\t\t\tif (eventName === 'mousedown' && self.isShiftDown && self.$activeItems.length) {\n\t\t\t\t$last = self.$control.children('.active:last');\n\t\t\t\tbegin = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$last[0]]);\n\t\t\t\tend   = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$item[0]]);\n\t\t\t\tif (begin > end) {\n\t\t\t\t\tswap  = begin;\n\t\t\t\t\tbegin = end;\n\t\t\t\t\tend   = swap;\n\t\t\t\t}\n\t\t\t\tfor (i = begin; i <= end; i++) {\n\t\t\t\t\titem = self.$control[0].childNodes[i];\n\t\t\t\t\tif (self.$activeItems.indexOf(item) === -1) {\n\t\t\t\t\t\t$(item).addClass('active');\n\t\t\t\t\t\tself.$activeItems.push(item);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\te.preventDefault();\n\t\t\t} else if ((eventName === 'mousedown' && self.isCtrlDown) || (eventName === 'keydown' && this.isShiftDown)) {\n\t\t\t\tif ($item.hasClass('active')) {\n\t\t\t\t\tidx = self.$activeItems.indexOf($item[0]);\n\t\t\t\t\tself.$activeItems.splice(idx, 1);\n\t\t\t\t\t$item.removeClass('active');\n\t\t\t\t} else {\n\t\t\t\t\tself.$activeItems.push($item.addClass('active')[0]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$(self.$activeItems).removeClass('active');\n\t\t\t\tself.$activeItems = [$item.addClass('active')[0]];\n\t\t\t}\n\t\n\t\t\t// ensure control has focus\n\t\t\tself.hideInput();\n\t\t\tif (!this.isFocused) {\n\t\t\t\tself.focus();\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Sets the selected item in the dropdown menu\n\t\t * of available options.\n\t\t *\n\t\t * @param {object} $object\n\t\t * @param {boolean} scroll\n\t\t * @param {boolean} animate\n\t\t */\n\t\tsetActiveOption: function($option, scroll, animate) {\n\t\t\tvar height_menu, height_item, y;\n\t\t\tvar scroll_top, scroll_bottom;\n\t\t\tvar self = this;\n\t\n\t\t\tif (self.$activeOption) self.$activeOption.removeClass('active');\n\t\t\tself.$activeOption = null;\n\t\n\t\t\t$option = $($option);\n\t\t\tif (!$option.length) return;\n\t\n\t\t\tself.$activeOption = $option.addClass('active');\n\t\n\t\t\tif (scroll || !isset(scroll)) {\n\t\n\t\t\t\theight_menu   = self.$dropdown_content.height();\n\t\t\t\theight_item   = self.$activeOption.outerHeight(true);\n\t\t\t\tscroll        = self.$dropdown_content.scrollTop() || 0;\n\t\t\t\ty             = self.$activeOption.offset().top - self.$dropdown_content.offset().top + scroll;\n\t\t\t\tscroll_top    = y;\n\t\t\t\tscroll_bottom = y - height_menu + height_item;\n\t\n\t\t\t\tif (y + height_item > height_menu + scroll) {\n\t\t\t\t\tself.$dropdown_content.stop().animate({scrollTop: scroll_bottom}, animate ? self.settings.scrollDuration : 0);\n\t\t\t\t} else if (y < scroll) {\n\t\t\t\t\tself.$dropdown_content.stop().animate({scrollTop: scroll_top}, animate ? self.settings.scrollDuration : 0);\n\t\t\t\t}\n\t\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Selects all items (CTRL + A).\n\t\t */\n\t\tselectAll: function() {\n\t\t\tvar self = this;\n\t\t\tif (self.settings.mode === 'single') return;\n\t\n\t\t\tself.$activeItems = Array.prototype.slice.apply(self.$control.children(':not(input)').addClass('active'));\n\t\t\tif (self.$activeItems.length) {\n\t\t\t\tself.hideInput();\n\t\t\t\tself.close();\n\t\t\t}\n\t\t\tself.focus();\n\t\t},\n\t\n\t\t/**\n\t\t * Hides the input element out of view, while\n\t\t * retaining its focus.\n\t\t */\n\t\thideInput: function() {\n\t\t\tvar self = this;\n\t\n\t\t\tself.setTextboxValue('');\n\t\t\tself.$control_input.css({opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000});\n\t\t\tself.isInputHidden = true;\n\t\t},\n\t\n\t\t/**\n\t\t * Restores input visibility.\n\t\t */\n\t\tshowInput: function() {\n\t\t\tthis.$control_input.css({opacity: 1, position: 'relative', left: 0});\n\t\t\tthis.isInputHidden = false;\n\t\t},\n\t\n\t\t/**\n\t\t * Gives the control focus.\n\t\t */\n\t\tfocus: function() {\n\t\t\tvar self = this;\n\t\t\tif (self.isDisabled) return;\n\t\n\t\t\tself.ignoreFocus = true;\n\t\t\tself.$control_input[0].focus();\n\t\t\twindow.setTimeout(function() {\n\t\t\t\tself.ignoreFocus = false;\n\t\t\t\tself.onFocus();\n\t\t\t}, 0);\n\t\t},\n\t\n\t\t/**\n\t\t * Forces the control out of focus.\n\t\t *\n\t\t * @param {Element} dest\n\t\t */\n\t\tblur: function(dest) {\n\t\t\tthis.$control_input[0].blur();\n\t\t\tthis.onBlur(null, dest);\n\t\t},\n\t\n\t\t/**\n\t\t * Returns a function that scores an object\n\t\t * to show how good of a match it is to the\n\t\t * provided query.\n\t\t *\n\t\t * @param {string} query\n\t\t * @param {object} options\n\t\t * @return {function}\n\t\t */\n\t\tgetScoreFunction: function(query) {\n\t\t\treturn this.sifter.getScoreFunction(query, this.getSearchOptions());\n\t\t},\n\t\n\t\t/**\n\t\t * Returns search options for sifter (the system\n\t\t * for scoring and sorting results).\n\t\t *\n\t\t * @see https://github.com/brianreavis/sifter.js\n\t\t * @return {object}\n\t\t */\n\t\tgetSearchOptions: function() {\n\t\t\tvar settings = this.settings;\n\t\t\tvar sort = settings.sortField;\n\t\t\tif (typeof sort === 'string') {\n\t\t\t\tsort = [{field: sort}];\n\t\t\t}\n\t\n\t\t\treturn {\n\t\t\t\tfields      : settings.searchField,\n\t\t\t\tconjunction : settings.searchConjunction,\n\t\t\t\tsort        : sort,\n\t\t\t\tnesting     : settings.nesting\n\t\t\t};\n\t\t},\n\t\n\t\t/**\n\t\t * Searches through available options and returns\n\t\t * a sorted array of matches.\n\t\t *\n\t\t * Returns an object containing:\n\t\t *\n\t\t *   - query {string}\n\t\t *   - tokens {array}\n\t\t *   - total {int}\n\t\t *   - items {array}\n\t\t *\n\t\t * @param {string} query\n\t\t * @returns {object}\n\t\t */\n\t\tsearch: function(query) {\n\t\t\tvar i, value, score, result, calculateScore;\n\t\t\tvar self     = this;\n\t\t\tvar settings = self.settings;\n\t\t\tvar options  = this.getSearchOptions();\n\t\n\t\t\t// validate user-provided result scoring function\n\t\t\tif (settings.score) {\n\t\t\t\tcalculateScore = self.settings.score.apply(this, [query]);\n\t\t\t\tif (typeof calculateScore !== 'function') {\n\t\t\t\t\tthrow new Error('Selectize \"score\" setting must be a function that returns a function');\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// perform search\n\t\t\tif (query !== self.lastQuery) {\n\t\t\t\tself.lastQuery = query;\n\t\t\t\tresult = self.sifter.search(query, $.extend(options, {score: calculateScore}));\n\t\t\t\tself.currentResults = result;\n\t\t\t} else {\n\t\t\t\tresult = $.extend(true, {}, self.currentResults);\n\t\t\t}\n\t\n\t\t\t// filter out selected items\n\t\t\tif (settings.hideSelected) {\n\t\t\t\tfor (i = result.items.length - 1; i >= 0; i--) {\n\t\t\t\t\tif (self.items.indexOf(hash_key(result.items[i].id)) !== -1) {\n\t\t\t\t\t\tresult.items.splice(i, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn result;\n\t\t},\n\t\n\t\t/**\n\t\t * Refreshes the list of available options shown\n\t\t * in the autocomplete dropdown menu.\n\t\t *\n\t\t * @param {boolean} triggerDropdown\n\t\t */\n\t\trefreshOptions: function(triggerDropdown) {\n\t\t\tvar i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;\n\t\t\tvar $active, $active_before, $create;\n\t\n\t\t\tif (typeof triggerDropdown === 'undefined') {\n\t\t\t\ttriggerDropdown = true;\n\t\t\t}\n\t\n\t\t\tvar self              = this;\n\t\t\tvar query             = $.trim(self.$control_input.val());\n\t\t\tvar results           = self.search(query);\n\t\t\tvar $dropdown_content = self.$dropdown_content;\n\t\t\tvar active_before     = self.$activeOption && hash_key(self.$activeOption.attr('data-value'));\n\t\n\t\t\t// build markup\n\t\t\tn = results.items.length;\n\t\t\tif (typeof self.settings.maxOptions === 'number') {\n\t\t\t\tn = Math.min(n, self.settings.maxOptions);\n\t\t\t}\n\t\n\t\t\t// render and group available options individually\n\t\t\tgroups = {};\n\t\t\tgroups_order = [];\n\t\n\t\t\tfor (i = 0; i < n; i++) {\n\t\t\t\toption      = self.options[results.items[i].id];\n\t\t\t\toption_html = self.render('option', option);\n\t\t\t\toptgroup    = option[self.settings.optgroupField] || '';\n\t\t\t\toptgroups   = $.isArray(optgroup) ? optgroup : [optgroup];\n\t\n\t\t\t\tfor (j = 0, k = optgroups && optgroups.length; j < k; j++) {\n\t\t\t\t\toptgroup = optgroups[j];\n\t\t\t\t\tif (!self.optgroups.hasOwnProperty(optgroup)) {\n\t\t\t\t\t\toptgroup = '';\n\t\t\t\t\t}\n\t\t\t\t\tif (!groups.hasOwnProperty(optgroup)) {\n\t\t\t\t\t\tgroups[optgroup] = document.createDocumentFragment();\n\t\t\t\t\t\tgroups_order.push(optgroup);\n\t\t\t\t\t}\n\t\t\t\t\tgroups[optgroup].appendChild(option_html);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// sort optgroups\n\t\t\tif (this.settings.lockOptgroupOrder) {\n\t\t\t\tgroups_order.sort(function(a, b) {\n\t\t\t\t\tvar a_order = self.optgroups[a].$order || 0;\n\t\t\t\t\tvar b_order = self.optgroups[b].$order || 0;\n\t\t\t\t\treturn a_order - b_order;\n\t\t\t\t});\n\t\t\t}\n\t\n\t\t\t// render optgroup headers & join groups\n\t\t\thtml = document.createDocumentFragment();\n\t\t\tfor (i = 0, n = groups_order.length; i < n; i++) {\n\t\t\t\toptgroup = groups_order[i];\n\t\t\t\tif (self.optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) {\n\t\t\t\t\t// render the optgroup header and options within it,\n\t\t\t\t\t// then pass it to the wrapper template\n\t\t\t\t\thtml_children = document.createDocumentFragment();\n\t\t\t\t\thtml_children.appendChild(self.render('optgroup_header', self.optgroups[optgroup]));\n\t\t\t\t\thtml_children.appendChild(groups[optgroup]);\n\t\n\t\t\t\t\thtml.appendChild(self.render('optgroup', $.extend({}, self.optgroups[optgroup], {\n\t\t\t\t\t\thtml: domToString(html_children),\n\t\t\t\t\t\tdom:  html_children\n\t\t\t\t\t})));\n\t\t\t\t} else {\n\t\t\t\t\thtml.appendChild(groups[optgroup]);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t$dropdown_content.html(html);\n\t\n\t\t\t// highlight matching terms inline\n\t\t\tif (self.settings.highlight) {\n\t\t\t\t$dropdown_content.removeHighlight();\n\t\t\t\tif (results.query.length && results.tokens.length) {\n\t\t\t\t\tfor (i = 0, n = results.tokens.length; i < n; i++) {\n\t\t\t\t\t\thighlight($dropdown_content, results.tokens[i].regex);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// add \"selected\" class to selected options\n\t\t\tif (!self.settings.hideSelected) {\n\t\t\t\tfor (i = 0, n = self.items.length; i < n; i++) {\n\t\t\t\t\tself.getOption(self.items[i]).addClass('selected');\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// add create option\n\t\t\thas_create_option = self.canCreate(query);\n\t\t\tif (has_create_option) {\n\t\t\t\t$dropdown_content.prepend(self.render('option_create', {input: query}));\n\t\t\t\t$create = $($dropdown_content[0].childNodes[0]);\n\t\t\t}\n\t\n\t\t\t// activate\n\t\t\tself.hasOptions = results.items.length > 0 || has_create_option;\n\t\t\tif (self.hasOptions) {\n\t\t\t\tif (results.items.length > 0) {\n\t\t\t\t\t$active_before = active_before && self.getOption(active_before);\n\t\t\t\t\tif ($active_before && $active_before.length) {\n\t\t\t\t\t\t$active = $active_before;\n\t\t\t\t\t} else if (self.settings.mode === 'single' && self.items.length) {\n\t\t\t\t\t\t$active = self.getOption(self.items[0]);\n\t\t\t\t\t}\n\t\t\t\t\tif (!$active || !$active.length) {\n\t\t\t\t\t\tif ($create && !self.settings.addPrecedence) {\n\t\t\t\t\t\t\t$active = self.getAdjacentOption($create, 1);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$active = $dropdown_content.find('[data-selectable]:first');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$active = $create;\n\t\t\t\t}\n\t\t\t\tself.setActiveOption($active);\n\t\t\t\tif (triggerDropdown && !self.isOpen) { self.open(); }\n\t\t\t} else {\n\t\t\t\tself.setActiveOption(null);\n\t\t\t\tif (triggerDropdown && self.isOpen) { self.close(); }\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Adds an available option. If it already exists,\n\t\t * nothing will happen. Note: this does not refresh\n\t\t * the options list dropdown (use `refreshOptions`\n\t\t * for that).\n\t\t *\n\t\t * Usage:\n\t\t *\n\t\t *   this.addOption(data)\n\t\t *\n\t\t * @param {object|array} data\n\t\t */\n\t\taddOption: function(data) {\n\t\t\tvar i, n, value, self = this;\n\t\n\t\t\tif ($.isArray(data)) {\n\t\t\t\tfor (i = 0, n = data.length; i < n; i++) {\n\t\t\t\t\tself.addOption(data[i]);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif (value = self.registerOption(data)) {\n\t\t\t\tself.userOptions[value] = true;\n\t\t\t\tself.lastQuery = null;\n\t\t\t\tself.trigger('option_add', value, data);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Registers an option to the pool of options.\n\t\t *\n\t\t * @param {object} data\n\t\t * @return {boolean|string}\n\t\t */\n\t\tregisterOption: function(data) {\n\t\t\tvar key = hash_key(data[this.settings.valueField]);\n\t\t\tif (typeof key === 'undefined' || key === null || this.options.hasOwnProperty(key)) return false;\n\t\t\tdata.$order = data.$order || ++this.order;\n\t\t\tthis.options[key] = data;\n\t\t\treturn key;\n\t\t},\n\t\n\t\t/**\n\t\t * Registers an option group to the pool of option groups.\n\t\t *\n\t\t * @param {object} data\n\t\t * @return {boolean|string}\n\t\t */\n\t\tregisterOptionGroup: function(data) {\n\t\t\tvar key = hash_key(data[this.settings.optgroupValueField]);\n\t\t\tif (!key) return false;\n\t\n\t\t\tdata.$order = data.$order || ++this.order;\n\t\t\tthis.optgroups[key] = data;\n\t\t\treturn key;\n\t\t},\n\t\n\t\t/**\n\t\t * Registers a new optgroup for options\n\t\t * to be bucketed into.\n\t\t *\n\t\t * @param {string} id\n\t\t * @param {object} data\n\t\t */\n\t\taddOptionGroup: function(id, data) {\n\t\t\tdata[this.settings.optgroupValueField] = id;\n\t\t\tif (id = this.registerOptionGroup(data)) {\n\t\t\t\tthis.trigger('optgroup_add', id, data);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Removes an existing option group.\n\t\t *\n\t\t * @param {string} id\n\t\t */\n\t\tremoveOptionGroup: function(id) {\n\t\t\tif (this.optgroups.hasOwnProperty(id)) {\n\t\t\t\tdelete this.optgroups[id];\n\t\t\t\tthis.renderCache = {};\n\t\t\t\tthis.trigger('optgroup_remove', id);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Clears all existing option groups.\n\t\t */\n\t\tclearOptionGroups: function() {\n\t\t\tthis.optgroups = {};\n\t\t\tthis.renderCache = {};\n\t\t\tthis.trigger('optgroup_clear');\n\t\t},\n\t\n\t\t/**\n\t\t * Updates an option available for selection. If\n\t\t * it is visible in the selected items or options\n\t\t * dropdown, it will be re-rendered automatically.\n\t\t *\n\t\t * @param {string} value\n\t\t * @param {object} data\n\t\t */\n\t\tupdateOption: function(value, data) {\n\t\t\tvar self = this;\n\t\t\tvar $item, $item_new;\n\t\t\tvar value_new, index_item, cache_items, cache_options, order_old;\n\t\n\t\t\tvalue     = hash_key(value);\n\t\t\tvalue_new = hash_key(data[self.settings.valueField]);\n\t\n\t\t\t// sanity checks\n\t\t\tif (value === null) return;\n\t\t\tif (!self.options.hasOwnProperty(value)) return;\n\t\t\tif (typeof value_new !== 'string') throw new Error('Value must be set in option data');\n\t\n\t\t\torder_old = self.options[value].$order;\n\t\n\t\t\t// update references\n\t\t\tif (value_new !== value) {\n\t\t\t\tdelete self.options[value];\n\t\t\t\tindex_item = self.items.indexOf(value);\n\t\t\t\tif (index_item !== -1) {\n\t\t\t\t\tself.items.splice(index_item, 1, value_new);\n\t\t\t\t}\n\t\t\t}\n\t\t\tdata.$order = data.$order || order_old;\n\t\t\tself.options[value_new] = data;\n\t\n\t\t\t// invalidate render cache\n\t\t\tcache_items = self.renderCache['item'];\n\t\t\tcache_options = self.renderCache['option'];\n\t\n\t\t\tif (cache_items) {\n\t\t\t\tdelete cache_items[value];\n\t\t\t\tdelete cache_items[value_new];\n\t\t\t}\n\t\t\tif (cache_options) {\n\t\t\t\tdelete cache_options[value];\n\t\t\t\tdelete cache_options[value_new];\n\t\t\t}\n\t\n\t\t\t// update the item if it's selected\n\t\t\tif (self.items.indexOf(value_new) !== -1) {\n\t\t\t\t$item = self.getItem(value);\n\t\t\t\t$item_new = $(self.render('item', data));\n\t\t\t\tif ($item.hasClass('active')) $item_new.addClass('active');\n\t\t\t\t$item.replaceWith($item_new);\n\t\t\t}\n\t\n\t\t\t// invalidate last query because we might have updated the sortField\n\t\t\tself.lastQuery = null;\n\t\n\t\t\t// update dropdown contents\n\t\t\tif (self.isOpen) {\n\t\t\t\tself.refreshOptions(false);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Removes a single option.\n\t\t *\n\t\t * @param {string} value\n\t\t * @param {boolean} silent\n\t\t */\n\t\tremoveOption: function(value, silent) {\n\t\t\tvar self = this;\n\t\t\tvalue = hash_key(value);\n\t\n\t\t\tvar cache_items = self.renderCache['item'];\n\t\t\tvar cache_options = self.renderCache['option'];\n\t\t\tif (cache_items) delete cache_items[value];\n\t\t\tif (cache_options) delete cache_options[value];\n\t\n\t\t\tdelete self.userOptions[value];\n\t\t\tdelete self.options[value];\n\t\t\tself.lastQuery = null;\n\t\t\tself.trigger('option_remove', value);\n\t\t\tself.removeItem(value, silent);\n\t\t},\n\t\n\t\t/**\n\t\t * Clears all options.\n\t\t */\n\t\tclearOptions: function() {\n\t\t\tvar self = this;\n\t\n\t\t\tself.loadedSearches = {};\n\t\t\tself.userOptions = {};\n\t\t\tself.renderCache = {};\n\t\t\tvar options = self.options;\n\t\t\t$.each(self.options, function(key, value) {\n\t\t\t\tif(self.items.indexOf(key) == -1) {\n\t\t\t\t\tdelete options[key];\n\t\t\t\t}\n\t\t\t});\n\t\t\tself.options = self.sifter.items = options;\n\t\t\tself.lastQuery = null;\n\t\t\tself.trigger('option_clear');\n\t\t},\n\t\n\t\t/**\n\t\t * Returns the jQuery element of the option\n\t\t * matching the given value.\n\t\t *\n\t\t * @param {string} value\n\t\t * @returns {object}\n\t\t */\n\t\tgetOption: function(value) {\n\t\t\treturn this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]'));\n\t\t},\n\t\n\t\t/**\n\t\t * Returns the jQuery element of the next or\n\t\t * previous selectable option.\n\t\t *\n\t\t * @param {object} $option\n\t\t * @param {int} direction  can be 1 for next or -1 for previous\n\t\t * @return {object}\n\t\t */\n\t\tgetAdjacentOption: function($option, direction) {\n\t\t\tvar $options = this.$dropdown.find('[data-selectable]');\n\t\t\tvar index    = $options.index($option) + direction;\n\t\n\t\t\treturn index >= 0 && index < $options.length ? $options.eq(index) : $();\n\t\t},\n\t\n\t\t/**\n\t\t * Finds the first element with a \"data-value\" attribute\n\t\t * that matches the given value.\n\t\t *\n\t\t * @param {mixed} value\n\t\t * @param {object} $els\n\t\t * @return {object}\n\t\t */\n\t\tgetElementWithValue: function(value, $els) {\n\t\t\tvalue = hash_key(value);\n\t\n\t\t\tif (typeof value !== 'undefined' && value !== null) {\n\t\t\t\tfor (var i = 0, n = $els.length; i < n; i++) {\n\t\t\t\t\tif ($els[i].getAttribute('data-value') === value) {\n\t\t\t\t\t\treturn $($els[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn $();\n\t\t},\n\t\n\t\t/**\n\t\t * Returns the jQuery element of the item\n\t\t * matching the given value.\n\t\t *\n\t\t * @param {string} value\n\t\t * @returns {object}\n\t\t */\n\t\tgetItem: function(value) {\n\t\t\treturn this.getElementWithValue(value, this.$control.children());\n\t\t},\n\t\n\t\t/**\n\t\t * \"Selects\" multiple items at once. Adds them to the list\n\t\t * at the current caret position.\n\t\t *\n\t\t * @param {string} value\n\t\t * @param {boolean} silent\n\t\t */\n\t\taddItems: function(values, silent) {\n\t\t\tthis.buffer = document.createDocumentFragment();\n\t\n\t\t\tvar childNodes = this.$control[0].childNodes;\n\t\t\tfor (var i = 0; i < childNodes.length; i++) {\n\t\t\t\tthis.buffer.appendChild(childNodes[i]);\n\t\t\t}\n\t\n\t\t\tvar items = $.isArray(values) ? values : [values];\n\t\t\tfor (var i = 0, n = items.length; i < n; i++) {\n\t\t\t\tthis.isPending = (i < n - 1);\n\t\t\t\tthis.addItem(items[i], silent);\n\t\t\t}\n\t\n\t\t\tvar control = this.$control[0];\n\t\t\tcontrol.insertBefore(this.buffer, control.firstChild);\n\t\n\t\t\tthis.buffer = null;\n\t\t},\n\t\n\t\t/**\n\t\t * \"Selects\" an item. Adds it to the list\n\t\t * at the current caret position.\n\t\t *\n\t\t * @param {string} value\n\t\t * @param {boolean} silent\n\t\t */\n\t\taddItem: function(value, silent) {\n\t\t\tvar events = silent ? [] : ['change'];\n\t\n\t\t\tdebounce_events(this, events, function() {\n\t\t\t\tvar $item, $option, $options;\n\t\t\t\tvar self = this;\n\t\t\t\tvar inputMode = self.settings.mode;\n\t\t\t\tvar i, active, value_next, wasFull;\n\t\t\t\tvalue = hash_key(value);\n\t\n\t\t\t\tif (self.items.indexOf(value) !== -1) {\n\t\t\t\t\tif (inputMode === 'single') self.close();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\tif (!self.options.hasOwnProperty(value)) return;\n\t\t\t\tif (inputMode === 'single') self.clear(silent);\n\t\t\t\tif (inputMode === 'multi' && self.isFull()) return;\n\t\n\t\t\t\t$item = $(self.render('item', self.options[value]));\n\t\t\t\twasFull = self.isFull();\n\t\t\t\tself.items.splice(self.caretPos, 0, value);\n\t\t\t\tself.insertAtCaret($item);\n\t\t\t\tif (!self.isPending || (!wasFull && self.isFull())) {\n\t\t\t\t\tself.refreshState();\n\t\t\t\t}\n\t\n\t\t\t\tif (self.isSetup) {\n\t\t\t\t\t$options = self.$dropdown_content.find('[data-selectable]');\n\t\n\t\t\t\t\t// update menu / remove the option (if this is not one item being added as part of series)\n\t\t\t\t\tif (!self.isPending) {\n\t\t\t\t\t\t$option = self.getOption(value);\n\t\t\t\t\t\tvalue_next = self.getAdjacentOption($option, 1).attr('data-value');\n\t\t\t\t\t\tself.refreshOptions(self.isFocused && inputMode !== 'single');\n\t\t\t\t\t\tif (value_next) {\n\t\t\t\t\t\t\tself.setActiveOption(self.getOption(value_next));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// hide the menu if the maximum number of items have been selected or no options are left\n\t\t\t\t\tif (!$options.length || self.isFull()) {\n\t\t\t\t\t\tself.close();\n\t\t\t\t\t} else if (!self.isPending) {\n\t\t\t\t\t\tself.positionDropdown();\n\t\t\t\t\t}\n\t\n\t\t\t\t\tself.updatePlaceholder();\n\t\t\t\t\tself.trigger('item_add', value, $item);\n\t\n\t\t\t\t\tif (!self.isPending) {\n\t\t\t\t\t\tself.updateOriginalInput({silent: silent});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\n\t\t/**\n\t\t * Removes the selected item matching\n\t\t * the provided value.\n\t\t *\n\t\t * @param {string} value\n\t\t */\n\t\tremoveItem: function(value, silent) {\n\t\t\tvar self = this;\n\t\t\tvar $item, i, idx;\n\t\n\t\t\t$item = (value instanceof $) ? value : self.getItem(value);\n\t\t\tvalue = hash_key($item.attr('data-value'));\n\t\t\ti = self.items.indexOf(value);\n\t\n\t\t\tif (i !== -1) {\n\t\t\t\t$item.remove();\n\t\t\t\tif ($item.hasClass('active')) {\n\t\t\t\t\tidx = self.$activeItems.indexOf($item[0]);\n\t\t\t\t\tself.$activeItems.splice(idx, 1);\n\t\t\t\t}\n\t\n\t\t\t\tself.items.splice(i, 1);\n\t\t\t\tself.lastQuery = null;\n\t\t\t\tif (!self.settings.persist && self.userOptions.hasOwnProperty(value)) {\n\t\t\t\t\tself.removeOption(value, silent);\n\t\t\t\t}\n\t\n\t\t\t\tif (i < self.caretPos) {\n\t\t\t\t\tself.setCaret(self.caretPos - 1);\n\t\t\t\t}\n\t\n\t\t\t\tself.refreshState();\n\t\t\t\tself.updatePlaceholder();\n\t\t\t\tself.updateOriginalInput({silent: silent});\n\t\t\t\tself.positionDropdown();\n\t\t\t\tself.trigger('item_remove', value, $item);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Invokes the `create` method provided in the\n\t\t * selectize options that should provide the data\n\t\t * for the new item, given the user input.\n\t\t *\n\t\t * Once this completes, it will be added\n\t\t * to the item list.\n\t\t *\n\t\t * @param {string} value\n\t\t * @param {boolean} [triggerDropdown]\n\t\t * @param {function} [callback]\n\t\t * @return {boolean}\n\t\t */\n\t\tcreateItem: function(input, triggerDropdown) {\n\t\t\tvar self  = this;\n\t\t\tvar caret = self.caretPos;\n\t\t\tinput = input || $.trim(self.$control_input.val() || '');\n\t\n\t\t\tvar callback = arguments[arguments.length - 1];\n\t\t\tif (typeof callback !== 'function') callback = function() {};\n\t\n\t\t\tif (typeof triggerDropdown !== 'boolean') {\n\t\t\t\ttriggerDropdown = true;\n\t\t\t}\n\t\n\t\t\tif (!self.canCreate(input)) {\n\t\t\t\tcallback();\n\t\t\t\treturn false;\n\t\t\t}\n\t\n\t\t\tself.lock();\n\t\n\t\t\tvar setup = (typeof self.settings.create === 'function') ? this.settings.create : function(input) {\n\t\t\t\tvar data = {};\n\t\t\t\tdata[self.settings.labelField] = input;\n\t\t\t\tdata[self.settings.valueField] = input;\n\t\t\t\treturn data;\n\t\t\t};\n\t\n\t\t\tvar create = once(function(data) {\n\t\t\t\tself.unlock();\n\t\n\t\t\t\tif (!data || typeof data !== 'object') return callback();\n\t\t\t\tvar value = hash_key(data[self.settings.valueField]);\n\t\t\t\tif (typeof value !== 'string') return callback();\n\t\n\t\t\t\tself.setTextboxValue('');\n\t\t\t\tself.addOption(data);\n\t\t\t\tself.setCaret(caret);\n\t\t\t\tself.addItem(value);\n\t\t\t\tself.refreshOptions(triggerDropdown && self.settings.mode !== 'single');\n\t\t\t\tcallback(data);\n\t\t\t});\n\t\n\t\t\tvar output = setup.apply(this, [input, create]);\n\t\t\tif (typeof output !== 'undefined') {\n\t\t\t\tcreate(output);\n\t\t\t}\n\t\n\t\t\treturn true;\n\t\t},\n\t\n\t\t/**\n\t\t * Re-renders the selected item lists.\n\t\t */\n\t\trefreshItems: function() {\n\t\t\tthis.lastQuery = null;\n\t\n\t\t\tif (this.isSetup) {\n\t\t\t\tthis.addItem(this.items);\n\t\t\t}\n\t\n\t\t\tthis.refreshState();\n\t\t\tthis.updateOriginalInput();\n\t\t},\n\t\n\t\t/**\n\t\t * Updates all state-dependent attributes\n\t\t * and CSS classes.\n\t\t */\n\t\trefreshState: function() {\n\t\t\tthis.refreshValidityState();\n\t\t\tthis.refreshClasses();\n\t\t},\n\t\n\t\t/**\n\t\t * Update the `required` attribute of both input and control input.\n\t\t *\n\t\t * The `required` property needs to be activated on the control input\n\t\t * for the error to be displayed at the right place. `required` also\n\t\t * needs to be temporarily deactivated on the input since the input is\n\t\t * hidden and can't show errors.\n\t\t */\n\t\trefreshValidityState: function() {\n\t\t\tif (!this.isRequired) return false;\n\t\n\t\t\tvar invalid = !this.items.length;\n\t\n\t\t\tthis.isInvalid = invalid;\n\t\t\tthis.$control_input.prop('required', invalid);\n\t\t\tthis.$input.prop('required', !invalid);\n\t\t},\n\t\n\t\t/**\n\t\t * Updates all state-dependent CSS classes.\n\t\t */\n\t\trefreshClasses: function() {\n\t\t\tvar self     = this;\n\t\t\tvar isFull   = self.isFull();\n\t\t\tvar isLocked = self.isLocked;\n\t\n\t\t\tself.$wrapper\n\t\t\t\t.toggleClass('rtl', self.rtl);\n\t\n\t\t\tself.$control\n\t\t\t\t.toggleClass('focus', self.isFocused)\n\t\t\t\t.toggleClass('disabled', self.isDisabled)\n\t\t\t\t.toggleClass('required', self.isRequired)\n\t\t\t\t.toggleClass('invalid', self.isInvalid)\n\t\t\t\t.toggleClass('locked', isLocked)\n\t\t\t\t.toggleClass('full', isFull).toggleClass('not-full', !isFull)\n\t\t\t\t.toggleClass('input-active', self.isFocused && !self.isInputHidden)\n\t\t\t\t.toggleClass('dropdown-active', self.isOpen)\n\t\t\t\t.toggleClass('has-options', !$.isEmptyObject(self.options))\n\t\t\t\t.toggleClass('has-items', self.items.length > 0);\n\t\n\t\t\tself.$control_input.data('grow', !isFull && !isLocked);\n\t\t},\n\t\n\t\t/**\n\t\t * Determines whether or not more items can be added\n\t\t * to the control without exceeding the user-defined maximum.\n\t\t *\n\t\t * @returns {boolean}\n\t\t */\n\t\tisFull: function() {\n\t\t\treturn this.settings.maxItems !== null && this.items.length >= this.settings.maxItems;\n\t\t},\n\t\n\t\t/**\n\t\t * Refreshes the original <select> or <input>\n\t\t * element to reflect the current state.\n\t\t */\n\t\tupdateOriginalInput: function(opts) {\n\t\t\tvar i, n, options, label, self = this;\n\t\t\topts = opts || {};\n\t\n\t\t\tif (self.tagType === TAG_SELECT) {\n\t\t\t\toptions = [];\n\t\t\t\tfor (i = 0, n = self.items.length; i < n; i++) {\n\t\t\t\t\tlabel = self.options[self.items[i]][self.settings.labelField] || '';\n\t\t\t\t\toptions.push('<option value=\"' + escape_html(self.items[i]) + '\" selected=\"selected\">' + escape_html(label) + '</option>');\n\t\t\t\t}\n\t\t\t\tif (!options.length && !this.$input.attr('multiple')) {\n\t\t\t\t\toptions.push('<option value=\"\" selected=\"selected\"></option>');\n\t\t\t\t}\n\t\t\t\tself.$input.html(options.join(''));\n\t\t\t} else {\n\t\t\t\tself.$input.val(self.getValue());\n\t\t\t\tself.$input.attr('value',self.$input.val());\n\t\t\t}\n\t\n\t\t\tif (self.isSetup) {\n\t\t\t\tif (!opts.silent) {\n\t\t\t\t\tself.trigger('change', self.$input.val());\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Shows/hide the input placeholder depending\n\t\t * on if there items in the list already.\n\t\t */\n\t\tupdatePlaceholder: function() {\n\t\t\tif (!this.settings.placeholder) return;\n\t\t\tvar $input = this.$control_input;\n\t\n\t\t\tif (this.items.length) {\n\t\t\t\t$input.removeAttr('placeholder');\n\t\t\t} else {\n\t\t\t\t$input.attr('placeholder', this.settings.placeholder);\n\t\t\t}\n\t\t\t$input.triggerHandler('update', {force: true});\n\t\t},\n\t\n\t\t/**\n\t\t * Shows the autocomplete dropdown containing\n\t\t * the available options.\n\t\t */\n\t\topen: function() {\n\t\t\tvar self = this;\n\t\n\t\t\tif (self.isLocked || self.isOpen || (self.settings.mode === 'multi' && self.isFull())) return;\n\t\t\tself.focus();\n\t\t\tself.isOpen = true;\n\t\t\tself.refreshState();\n\t\t\tself.$dropdown.css({visibility: 'hidden', display: 'block'});\n\t\t\tself.positionDropdown();\n\t\t\tself.$dropdown.css({visibility: 'visible'});\n\t\t\tself.trigger('dropdown_open', self.$dropdown);\n\t\t},\n\t\n\t\t/**\n\t\t * Closes the autocomplete dropdown menu.\n\t\t */\n\t\tclose: function() {\n\t\t\tvar self = this;\n\t\t\tvar trigger = self.isOpen;\n\t\n\t\t\tif (self.settings.mode === 'single' && self.items.length) {\n\t\t\t\tself.hideInput();\n\t\n\t\t\t\t// Do not trigger blur while inside a blur event,\n\t\t\t\t// this fixes some weird tabbing behavior in FF and IE.\n\t\t\t\t// See #1164\n\t\t\t\tif (!self.isBlurring) {\n\t\t\t\t\tself.$control_input.blur(); // close keyboard on iOS\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tself.isOpen = false;\n\t\t\tself.$dropdown.hide();\n\t\t\tself.setActiveOption(null);\n\t\t\tself.refreshState();\n\t\n\t\t\tif (trigger) self.trigger('dropdown_close', self.$dropdown);\n\t\t},\n\t\n\t\t/**\n\t\t * Calculates and applies the appropriate\n\t\t * position of the dropdown.\n\t\t */\n\t\tpositionDropdown: function() {\n\t\t\tvar $control = this.$control;\n\t\t\tvar offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();\n\t\t\toffset.top += $control.outerHeight(true);\n\t\n\t\t\tthis.$dropdown.css({\n\t\t\t\twidth : $control[0].getBoundingClientRect().width,\n\t\t\t\ttop   : offset.top,\n\t\t\t\tleft  : offset.left\n\t\t\t});\n\t\t},\n\t\n\t\t/**\n\t\t * Resets / clears all selected items\n\t\t * from the control.\n\t\t *\n\t\t * @param {boolean} silent\n\t\t */\n\t\tclear: function(silent) {\n\t\t\tvar self = this;\n\t\n\t\t\tif (!self.items.length) return;\n\t\t\tself.$control.children(':not(input)').remove();\n\t\t\tself.items = [];\n\t\t\tself.lastQuery = null;\n\t\t\tself.setCaret(0);\n\t\t\tself.setActiveItem(null);\n\t\t\tself.updatePlaceholder();\n\t\t\tself.updateOriginalInput({silent: silent});\n\t\t\tself.refreshState();\n\t\t\tself.showInput();\n\t\t\tself.trigger('clear');\n\t\t},\n\t\n\t\t/**\n\t\t * A helper method for inserting an element\n\t\t * at the current caret position.\n\t\t *\n\t\t * @param {object} $el\n\t\t */\n\t\tinsertAtCaret: function($el) {\n\t\t\tvar caret = Math.min(this.caretPos, this.items.length);\n\t\t\tvar el = $el[0];\n\t\t\tvar target = this.buffer || this.$control[0];\n\t\n\t\t\tif (caret === 0) {\n\t\t\t\ttarget.insertBefore(el, target.firstChild);\n\t\t\t} else {\n\t\t\t\ttarget.insertBefore(el, target.childNodes[caret]);\n\t\t\t}\n\t\n\t\t\tthis.setCaret(caret + 1);\n\t\t},\n\t\n\t\t/**\n\t\t * Removes the current selected item(s).\n\t\t *\n\t\t * @param {object} e (optional)\n\t\t * @returns {boolean}\n\t\t */\n\t\tdeleteSelection: function(e) {\n\t\t\tvar i, n, direction, selection, values, caret, option_select, $option_select, $tail;\n\t\t\tvar self = this;\n\t\n\t\t\tdirection = (e && e.keyCode === KEY_BACKSPACE) ? -1 : 1;\n\t\t\tselection = getSelection(self.$control_input[0]);\n\t\n\t\t\tif (self.$activeOption && !self.settings.hideSelected) {\n\t\t\t\toption_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value');\n\t\t\t}\n\t\n\t\t\t// determine items that will be removed\n\t\t\tvalues = [];\n\t\n\t\t\tif (self.$activeItems.length) {\n\t\t\t\t$tail = self.$control.children('.active:' + (direction > 0 ? 'last' : 'first'));\n\t\t\t\tcaret = self.$control.children(':not(input)').index($tail);\n\t\t\t\tif (direction > 0) { caret++; }\n\t\n\t\t\t\tfor (i = 0, n = self.$activeItems.length; i < n; i++) {\n\t\t\t\t\tvalues.push($(self.$activeItems[i]).attr('data-value'));\n\t\t\t\t}\n\t\t\t\tif (e) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t} else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) {\n\t\t\t\tif (direction < 0 && selection.start === 0 && selection.length === 0) {\n\t\t\t\t\tvalues.push(self.items[self.caretPos - 1]);\n\t\t\t\t} else if (direction > 0 && selection.start === self.$control_input.val().length) {\n\t\t\t\t\tvalues.push(self.items[self.caretPos]);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// allow the callback to abort\n\t\t\tif (!values.length || (typeof self.settings.onDelete === 'function' && self.settings.onDelete.apply(self, [values]) === false)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\n\t\t\t// perform removal\n\t\t\tif (typeof caret !== 'undefined') {\n\t\t\t\tself.setCaret(caret);\n\t\t\t}\n\t\t\twhile (values.length) {\n\t\t\t\tself.removeItem(values.pop());\n\t\t\t}\n\t\n\t\t\tself.showInput();\n\t\t\tself.positionDropdown();\n\t\t\tself.refreshOptions(true);\n\t\n\t\t\t// select previous option\n\t\t\tif (option_select) {\n\t\t\t\t$option_select = self.getOption(option_select);\n\t\t\t\tif ($option_select.length) {\n\t\t\t\t\tself.setActiveOption($option_select);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn true;\n\t\t},\n\t\n\t\t/**\n\t\t * Selects the previous / next item (depending\n\t\t * on the `direction` argument).\n\t\t *\n\t\t * > 0 - right\n\t\t * < 0 - left\n\t\t *\n\t\t * @param {int} direction\n\t\t * @param {object} e (optional)\n\t\t */\n\t\tadvanceSelection: function(direction, e) {\n\t\t\tvar tail, selection, idx, valueLength, cursorAtEdge, $tail;\n\t\t\tvar self = this;\n\t\n\t\t\tif (direction === 0) return;\n\t\t\tif (self.rtl) direction *= -1;\n\t\n\t\t\ttail = direction > 0 ? 'last' : 'first';\n\t\t\tselection = getSelection(self.$control_input[0]);\n\t\n\t\t\tif (self.isFocused && !self.isInputHidden) {\n\t\t\t\tvalueLength = self.$control_input.val().length;\n\t\t\t\tcursorAtEdge = direction < 0\n\t\t\t\t\t? selection.start === 0 && selection.length === 0\n\t\t\t\t\t: selection.start === valueLength;\n\t\n\t\t\t\tif (cursorAtEdge && !valueLength) {\n\t\t\t\t\tself.advanceCaret(direction, e);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$tail = self.$control.children('.active:' + tail);\n\t\t\t\tif ($tail.length) {\n\t\t\t\t\tidx = self.$control.children(':not(input)').index($tail);\n\t\t\t\t\tself.setActiveItem(null);\n\t\t\t\t\tself.setCaret(direction > 0 ? idx + 1 : idx);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Moves the caret left / right.\n\t\t *\n\t\t * @param {int} direction\n\t\t * @param {object} e (optional)\n\t\t */\n\t\tadvanceCaret: function(direction, e) {\n\t\t\tvar self = this, fn, $adj;\n\t\n\t\t\tif (direction === 0) return;\n\t\n\t\t\tfn = direction > 0 ? 'next' : 'prev';\n\t\t\tif (self.isShiftDown) {\n\t\t\t\t$adj = self.$control_input[fn]();\n\t\t\t\tif ($adj.length) {\n\t\t\t\t\tself.hideInput();\n\t\t\t\t\tself.setActiveItem($adj);\n\t\t\t\t\te && e.preventDefault();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tself.setCaret(self.caretPos + direction);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Moves the caret to the specified index.\n\t\t *\n\t\t * @param {int} i\n\t\t */\n\t\tsetCaret: function(i) {\n\t\t\tvar self = this;\n\t\n\t\t\tif (self.settings.mode === 'single') {\n\t\t\t\ti = self.items.length;\n\t\t\t} else {\n\t\t\t\ti = Math.max(0, Math.min(self.items.length, i));\n\t\t\t}\n\t\n\t\t\tif(!self.isPending) {\n\t\t\t\t// the input must be moved by leaving it in place and moving the\n\t\t\t\t// siblings, due to the fact that focus cannot be restored once lost\n\t\t\t\t// on mobile webkit devices\n\t\t\t\tvar j, n, fn, $children, $child;\n\t\t\t\t$children = self.$control.children(':not(input)');\n\t\t\t\tfor (j = 0, n = $children.length; j < n; j++) {\n\t\t\t\t\t$child = $($children[j]).detach();\n\t\t\t\t\tif (j <  i) {\n\t\t\t\t\t\tself.$control_input.before($child);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.$control.append($child);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tself.caretPos = i;\n\t\t},\n\t\n\t\t/**\n\t\t * Disables user input on the control. Used while\n\t\t * items are being asynchronously created.\n\t\t */\n\t\tlock: function() {\n\t\t\tthis.close();\n\t\t\tthis.isLocked = true;\n\t\t\tthis.refreshState();\n\t\t},\n\t\n\t\t/**\n\t\t * Re-enables user input on the control.\n\t\t */\n\t\tunlock: function() {\n\t\t\tthis.isLocked = false;\n\t\t\tthis.refreshState();\n\t\t},\n\t\n\t\t/**\n\t\t * Disables user input on the control completely.\n\t\t * While disabled, it cannot receive focus.\n\t\t */\n\t\tdisable: function() {\n\t\t\tvar self = this;\n\t\t\tself.$input.prop('disabled', true);\n\t\t\tself.$control_input.prop('disabled', true).prop('tabindex', -1);\n\t\t\tself.isDisabled = true;\n\t\t\tself.lock();\n\t\t},\n\t\n\t\t/**\n\t\t * Enables the control so that it can respond\n\t\t * to focus and user input.\n\t\t */\n\t\tenable: function() {\n\t\t\tvar self = this;\n\t\t\tself.$input.prop('disabled', false);\n\t\t\tself.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex);\n\t\t\tself.isDisabled = false;\n\t\t\tself.unlock();\n\t\t},\n\t\n\t\t/**\n\t\t * Completely destroys the control and\n\t\t * unbinds all event listeners so that it can\n\t\t * be garbage collected.\n\t\t */\n\t\tdestroy: function() {\n\t\t\tvar self = this;\n\t\t\tvar eventNS = self.eventNS;\n\t\t\tvar revertSettings = self.revertSettings;\n\t\n\t\t\tself.trigger('destroy');\n\t\t\tself.off();\n\t\t\tself.$wrapper.remove();\n\t\t\tself.$dropdown.remove();\n\t\n\t\t\tself.$input\n\t\t\t\t.html('')\n\t\t\t\t.append(revertSettings.$children)\n\t\t\t\t.removeAttr('tabindex')\n\t\t\t\t.removeClass('selectized')\n\t\t\t\t.attr({tabindex: revertSettings.tabindex})\n\t\t\t\t.show();\n\t\n\t\t\tself.$control_input.removeData('grow');\n\t\t\tself.$input.removeData('selectize');\n\t\n\t\t\tif (--Selectize.count == 0 && Selectize.$testInput) {\n\t\t\t\tSelectize.$testInput.remove();\n\t\t\t\tSelectize.$testInput = undefined;\n\t\t\t}\n\t\n\t\t\t$(window).off(eventNS);\n\t\t\t$(document).off(eventNS);\n\t\t\t$(document.body).off(eventNS);\n\t\n\t\t\tdelete self.$input[0].selectize;\n\t\t},\n\t\n\t\t/**\n\t\t * A helper method for rendering \"item\" and\n\t\t * \"option\" templates, given the data.\n\t\t *\n\t\t * @param {string} templateName\n\t\t * @param {object} data\n\t\t * @returns {string}\n\t\t */\n\t\trender: function(templateName, data) {\n\t\t\tvar value, id, label;\n\t\t\tvar html = '';\n\t\t\tvar cache = false;\n\t\t\tvar self = this;\n\t\t\tvar regex_tag = /^[\\t \\r\\n]*<([a-z][a-z0-9\\-_]*(?:\\:[a-z][a-z0-9\\-_]*)?)/i;\n\t\n\t\t\tif (templateName === 'option' || templateName === 'item') {\n\t\t\t\tvalue = hash_key(data[self.settings.valueField]);\n\t\t\t\tcache = !!value;\n\t\t\t}\n\t\n\t\t\t// pull markup from cache if it exists\n\t\t\tif (cache) {\n\t\t\t\tif (!isset(self.renderCache[templateName])) {\n\t\t\t\t\tself.renderCache[templateName] = {};\n\t\t\t\t}\n\t\t\t\tif (self.renderCache[templateName].hasOwnProperty(value)) {\n\t\t\t\t\treturn self.renderCache[templateName][value];\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// render markup\n\t\t\thtml = $(self.settings.render[templateName].apply(this, [data, escape_html]));\n\t\n\t\t\t// add mandatory attributes\n\t\t\tif (templateName === 'option' || templateName === 'option_create') {\n\t\t\t\tif (!data[self.settings.disabledField]) {\n\t\t\t\t\thtml.attr('data-selectable', '');\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (templateName === 'optgroup') {\n\t\t\t\tid = data[self.settings.optgroupValueField] || '';\n\t\t\t\thtml.attr('data-group', id);\n\t\t\t\tif(data[self.settings.disabledField]) {\n\t\t\t\t\thtml.attr('data-disabled', '');\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (templateName === 'option' || templateName === 'item') {\n\t\t\t\thtml.attr('data-value', value || '');\n\t\t\t}\n\t\n\t\t\t// update cache\n\t\t\tif (cache) {\n\t\t\t\tself.renderCache[templateName][value] = html[0];\n\t\t\t}\n\t\n\t\t\treturn html[0];\n\t\t},\n\t\n\t\t/**\n\t\t * Clears the render cache for a template. If\n\t\t * no template is given, clears all render\n\t\t * caches.\n\t\t *\n\t\t * @param {string} templateName\n\t\t */\n\t\tclearCache: function(templateName) {\n\t\t\tvar self = this;\n\t\t\tif (typeof templateName === 'undefined') {\n\t\t\t\tself.renderCache = {};\n\t\t\t} else {\n\t\t\t\tdelete self.renderCache[templateName];\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Determines whether or not to display the\n\t\t * create item prompt, given a user input.\n\t\t *\n\t\t * @param {string} input\n\t\t * @return {boolean}\n\t\t */\n\t\tcanCreate: function(input) {\n\t\t\tvar self = this;\n\t\t\tif (!self.settings.create) return false;\n\t\t\tvar filter = self.settings.createFilter;\n\t\t\treturn input.length\n\t\t\t\t&& (typeof filter !== 'function' || filter.apply(self, [input]))\n\t\t\t\t&& (typeof filter !== 'string' || new RegExp(filter).test(input))\n\t\t\t\t&& (!(filter instanceof RegExp) || filter.test(input));\n\t\t}\n\t\n\t});\n\t\n\t\n\tSelectize.count = 0;\n\tSelectize.defaults = {\n\t\toptions: [],\n\t\toptgroups: [],\n\t\n\t\tplugins: [],\n\t\tdelimiter: ',',\n\t\tsplitOn: null, // regexp or string for splitting up values from a paste command\n\t\tpersist: true,\n\t\tdiacritics: true,\n\t\tcreate: false,\n\t\tcreateOnBlur: false,\n\t\tcreateFilter: null,\n\t\thighlight: true,\n\t\topenOnFocus: true,\n\t\tmaxOptions: 1000,\n\t\tmaxItems: null,\n\t\thideSelected: null,\n\t\taddPrecedence: false,\n\t\tselectOnTab: false,\n\t\tpreload: false,\n\t\tallowEmptyOption: false,\n\t\tcloseAfterSelect: false,\n\t\n\t\tscrollDuration: 60,\n\t\tloadThrottle: 300,\n\t\tloadingClass: 'loading',\n\t\n\t\tdataAttr: 'data-data',\n\t\toptgroupField: 'optgroup',\n\t\tvalueField: 'value',\n\t\tlabelField: 'text',\n\t\tdisabledField: 'disabled',\n\t\toptgroupLabelField: 'label',\n\t\toptgroupValueField: 'value',\n\t\tlockOptgroupOrder: false,\n\t\n\t\tsortField: '$order',\n\t\tsearchField: ['text'],\n\t\tsearchConjunction: 'and',\n\t\n\t\tmode: null,\n\t\twrapperClass: 'selectize-control',\n\t\tinputClass: 'selectize-input',\n\t\tdropdownClass: 'selectize-dropdown',\n\t\tdropdownContentClass: 'selectize-dropdown-content',\n\t\n\t\tdropdownParent: null,\n\t\n\t\tcopyClassesToDropdown: true,\n\t\n\t\t/*\n\t\tload                 : null, // function(query, callback) { ... }\n\t\tscore                : null, // function(search) { ... }\n\t\tonInitialize         : null, // function() { ... }\n\t\tonChange             : null, // function(value) { ... }\n\t\tonItemAdd            : null, // function(value, $item) { ... }\n\t\tonItemRemove         : null, // function(value) { ... }\n\t\tonClear              : null, // function() { ... }\n\t\tonOptionAdd          : null, // function(value, data) { ... }\n\t\tonOptionRemove       : null, // function(value) { ... }\n\t\tonOptionClear        : null, // function() { ... }\n\t\tonOptionGroupAdd     : null, // function(id, data) { ... }\n\t\tonOptionGroupRemove  : null, // function(id) { ... }\n\t\tonOptionGroupClear   : null, // function() { ... }\n\t\tonDropdownOpen       : null, // function($dropdown) { ... }\n\t\tonDropdownClose      : null, // function($dropdown) { ... }\n\t\tonType               : null, // function(str) { ... }\n\t\tonDelete             : null, // function(values) { ... }\n\t\t*/\n\t\n\t\trender: {\n\t\t\t/*\n\t\t\titem: null,\n\t\t\toptgroup: null,\n\t\t\toptgroup_header: null,\n\t\t\toption: null,\n\t\t\toption_create: null\n\t\t\t*/\n\t\t}\n\t};\n\t\n\t\n\t$.fn.selectize = function(settings_user) {\n\t\tvar defaults             = $.fn.selectize.defaults;\n\t\tvar settings             = $.extend({}, defaults, settings_user);\n\t\tvar attr_data            = settings.dataAttr;\n\t\tvar field_label          = settings.labelField;\n\t\tvar field_value          = settings.valueField;\n\t\tvar field_disabled       = settings.disabledField;\n\t\tvar field_optgroup       = settings.optgroupField;\n\t\tvar field_optgroup_label = settings.optgroupLabelField;\n\t\tvar field_optgroup_value = settings.optgroupValueField;\n\t\n\t\t/**\n\t\t * Initializes selectize from a <input type=\"text\"> element.\n\t\t *\n\t\t * @param {object} $input\n\t\t * @param {object} settings_element\n\t\t */\n\t\tvar init_textbox = function($input, settings_element) {\n\t\t\tvar i, n, values, option;\n\t\n\t\t\tvar data_raw = $input.attr(attr_data);\n\t\n\t\t\tif (!data_raw) {\n\t\t\t\tvar value = $.trim($input.val() || '');\n\t\t\t\tif (!settings.allowEmptyOption && !value.length) return;\n\t\t\t\tvalues = value.split(settings.delimiter);\n\t\t\t\tfor (i = 0, n = values.length; i < n; i++) {\n\t\t\t\t\toption = {};\n\t\t\t\t\toption[field_label] = values[i];\n\t\t\t\t\toption[field_value] = values[i];\n\t\t\t\t\tsettings_element.options.push(option);\n\t\t\t\t}\n\t\t\t\tsettings_element.items = values;\n\t\t\t} else {\n\t\t\t\tsettings_element.options = JSON.parse(data_raw);\n\t\t\t\tfor (i = 0, n = settings_element.options.length; i < n; i++) {\n\t\t\t\t\tsettings_element.items.push(settings_element.options[i][field_value]);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\n\t\t/**\n\t\t * Initializes selectize from a <select> element.\n\t\t *\n\t\t * @param {object} $input\n\t\t * @param {object} settings_element\n\t\t */\n\t\tvar init_select = function($input, settings_element) {\n\t\t\tvar i, n, tagName, $children, order = 0;\n\t\t\tvar options = settings_element.options;\n\t\t\tvar optionsMap = {};\n\t\n\t\t\tvar readData = function($el) {\n\t\t\t\tvar data = attr_data && $el.attr(attr_data);\n\t\t\t\tif (typeof data === 'string' && data.length) {\n\t\t\t\t\treturn JSON.parse(data);\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t};\n\t\n\t\t\tvar addOption = function($option, group) {\n\t\t\t\t$option = $($option);\n\t\n\t\t\t\tvar value = hash_key($option.val());\n\t\t\t\tif (!value && !settings.allowEmptyOption) return;\n\t\n\t\t\t\t// if the option already exists, it's probably been\n\t\t\t\t// duplicated in another optgroup. in this case, push\n\t\t\t\t// the current group to the \"optgroup\" property on the\n\t\t\t\t// existing option so that it's rendered in both places.\n\t\t\t\tif (optionsMap.hasOwnProperty(value)) {\n\t\t\t\t\tif (group) {\n\t\t\t\t\t\tvar arr = optionsMap[value][field_optgroup];\n\t\t\t\t\t\tif (!arr) {\n\t\t\t\t\t\t\toptionsMap[value][field_optgroup] = group;\n\t\t\t\t\t\t} else if (!$.isArray(arr)) {\n\t\t\t\t\t\t\toptionsMap[value][field_optgroup] = [arr, group];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tarr.push(group);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\tvar option             = readData($option) || {};\n\t\t\t\toption[field_label]    = option[field_label] || $option.text();\n\t\t\t\toption[field_value]    = option[field_value] || value;\n\t\t\t\toption[field_disabled] = option[field_disabled] || $option.prop('disabled');\n\t\t\t\toption[field_optgroup] = option[field_optgroup] || group;\n\t\n\t\t\t\toptionsMap[value] = option;\n\t\t\t\toptions.push(option);\n\t\n\t\t\t\tif ($option.is(':selected')) {\n\t\t\t\t\tsettings_element.items.push(value);\n\t\t\t\t}\n\t\t\t};\n\t\n\t\t\tvar addGroup = function($optgroup) {\n\t\t\t\tvar i, n, id, optgroup, $options;\n\t\n\t\t\t\t$optgroup = $($optgroup);\n\t\t\t\tid = $optgroup.attr('label');\n\t\n\t\t\t\tif (id) {\n\t\t\t\t\toptgroup = readData($optgroup) || {};\n\t\t\t\t\toptgroup[field_optgroup_label] = id;\n\t\t\t\t\toptgroup[field_optgroup_value] = id;\n\t\t\t\t\toptgroup[field_disabled] = $optgroup.prop('disabled');\n\t\t\t\t\tsettings_element.optgroups.push(optgroup);\n\t\t\t\t}\n\t\n\t\t\t\t$options = $('option', $optgroup);\n\t\t\t\tfor (i = 0, n = $options.length; i < n; i++) {\n\t\t\t\t\taddOption($options[i], id);\n\t\t\t\t}\n\t\t\t};\n\t\n\t\t\tsettings_element.maxItems = $input.attr('multiple') ? null : 1;\n\t\n\t\t\t$children = $input.children();\n\t\t\tfor (i = 0, n = $children.length; i < n; i++) {\n\t\t\t\ttagName = $children[i].tagName.toLowerCase();\n\t\t\t\tif (tagName === 'optgroup') {\n\t\t\t\t\taddGroup($children[i]);\n\t\t\t\t} else if (tagName === 'option') {\n\t\t\t\t\taddOption($children[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\n\t\treturn this.each(function() {\n\t\t\tif (this.selectize) return;\n\t\n\t\t\tvar instance;\n\t\t\tvar $input = $(this);\n\t\t\tvar tag_name = this.tagName.toLowerCase();\n\t\t\tvar placeholder = $input.attr('placeholder') || $input.attr('data-placeholder');\n\t\t\tif (!placeholder && !settings.allowEmptyOption) {\n\t\t\t\tplaceholder = $input.children('option[value=\"\"]').text();\n\t\t\t}\n\t\n\t\t\tvar settings_element = {\n\t\t\t\t'placeholder' : placeholder,\n\t\t\t\t'options'     : [],\n\t\t\t\t'optgroups'   : [],\n\t\t\t\t'items'       : []\n\t\t\t};\n\t\n\t\t\tif (tag_name === 'select') {\n\t\t\t\tinit_select($input, settings_element);\n\t\t\t} else {\n\t\t\t\tinit_textbox($input, settings_element);\n\t\t\t}\n\t\n\t\t\tinstance = new Selectize($input, $.extend(true, {}, defaults, settings_element, settings_user));\n\t\t});\n\t};\n\t\n\t$.fn.selectize.defaults = Selectize.defaults;\n\t$.fn.selectize.support = {\n\t\tvalidity: SUPPORTS_VALIDITY_API\n\t};\n\t\n\t\n\tSelectize.define('drag_drop', function(options) {\n\t\tif (!$.fn.sortable) throw new Error('The \"drag_drop\" plugin requires jQuery UI \"sortable\".');\n\t\tif (this.settings.mode !== 'multi') return;\n\t\tvar self = this;\n\t\n\t\tself.lock = (function() {\n\t\t\tvar original = self.lock;\n\t\t\treturn function() {\n\t\t\t\tvar sortable = self.$control.data('sortable');\n\t\t\t\tif (sortable) sortable.disable();\n\t\t\t\treturn original.apply(self, arguments);\n\t\t\t};\n\t\t})();\n\t\n\t\tself.unlock = (function() {\n\t\t\tvar original = self.unlock;\n\t\t\treturn function() {\n\t\t\t\tvar sortable = self.$control.data('sortable');\n\t\t\t\tif (sortable) sortable.enable();\n\t\t\t\treturn original.apply(self, arguments);\n\t\t\t};\n\t\t})();\n\t\n\t\tself.setup = (function() {\n\t\t\tvar original = self.setup;\n\t\t\treturn function() {\n\t\t\t\toriginal.apply(this, arguments);\n\t\n\t\t\t\tvar $control = self.$control.sortable({\n\t\t\t\t\titems: '[data-value]',\n\t\t\t\t\tforcePlaceholderSize: true,\n\t\t\t\t\tdisabled: self.isLocked,\n\t\t\t\t\tstart: function(e, ui) {\n\t\t\t\t\t\tui.placeholder.css('width', ui.helper.css('width'));\n\t\t\t\t\t\t$control.css({overflow: 'visible'});\n\t\t\t\t\t},\n\t\t\t\t\tstop: function() {\n\t\t\t\t\t\t$control.css({overflow: 'hidden'});\n\t\t\t\t\t\tvar active = self.$activeItems ? self.$activeItems.slice() : null;\n\t\t\t\t\t\tvar values = [];\n\t\t\t\t\t\t$control.children('[data-value]').each(function() {\n\t\t\t\t\t\t\tvalues.push($(this).attr('data-value'));\n\t\t\t\t\t\t});\n\t\t\t\t\t\tself.setValue(values);\n\t\t\t\t\t\tself.setActiveItem(active);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t};\n\t\t})();\n\t\n\t});\n\t\n\tSelectize.define('dropdown_header', function(options) {\n\t\tvar self = this;\n\t\n\t\toptions = $.extend({\n\t\t\ttitle         : 'Untitled',\n\t\t\theaderClass   : 'selectize-dropdown-header',\n\t\t\ttitleRowClass : 'selectize-dropdown-header-title',\n\t\t\tlabelClass    : 'selectize-dropdown-header-label',\n\t\t\tcloseClass    : 'selectize-dropdown-header-close',\n\t\n\t\t\thtml: function(data) {\n\t\t\t\treturn (\n\t\t\t\t\t'<div class=\"' + data.headerClass + '\">' +\n\t\t\t\t\t\t'<div class=\"' + data.titleRowClass + '\">' +\n\t\t\t\t\t\t\t'<span class=\"' + data.labelClass + '\">' + data.title + '</span>' +\n\t\t\t\t\t\t\t'<a href=\"javascript:void(0)\" class=\"' + data.closeClass + '\">&times;</a>' +\n\t\t\t\t\t\t'</div>' +\n\t\t\t\t\t'</div>'\n\t\t\t\t);\n\t\t\t}\n\t\t}, options);\n\t\n\t\tself.setup = (function() {\n\t\t\tvar original = self.setup;\n\t\t\treturn function() {\n\t\t\t\toriginal.apply(self, arguments);\n\t\t\t\tself.$dropdown_header = $(options.html(options));\n\t\t\t\tself.$dropdown.prepend(self.$dropdown_header);\n\t\t\t};\n\t\t})();\n\t\n\t});\n\t\n\tSelectize.define('optgroup_columns', function(options) {\n\t\tvar self = this;\n\t\n\t\toptions = $.extend({\n\t\t\tequalizeWidth  : true,\n\t\t\tequalizeHeight : true\n\t\t}, options);\n\t\n\t\tthis.getAdjacentOption = function($option, direction) {\n\t\t\tvar $options = $option.closest('[data-group]').find('[data-selectable]');\n\t\t\tvar index    = $options.index($option) + direction;\n\t\n\t\t\treturn index >= 0 && index < $options.length ? $options.eq(index) : $();\n\t\t};\n\t\n\t\tthis.onKeyDown = (function() {\n\t\t\tvar original = self.onKeyDown;\n\t\t\treturn function(e) {\n\t\t\t\tvar index, $option, $options, $optgroup;\n\t\n\t\t\t\tif (this.isOpen && (e.keyCode === KEY_LEFT || e.keyCode === KEY_RIGHT)) {\n\t\t\t\t\tself.ignoreHover = true;\n\t\t\t\t\t$optgroup = this.$activeOption.closest('[data-group]');\n\t\t\t\t\tindex = $optgroup.find('[data-selectable]').index(this.$activeOption);\n\t\n\t\t\t\t\tif(e.keyCode === KEY_LEFT) {\n\t\t\t\t\t\t$optgroup = $optgroup.prev('[data-group]');\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$optgroup = $optgroup.next('[data-group]');\n\t\t\t\t\t}\n\t\n\t\t\t\t\t$options = $optgroup.find('[data-selectable]');\n\t\t\t\t\t$option  = $options.eq(Math.min($options.length - 1, index));\n\t\t\t\t\tif ($option.length) {\n\t\t\t\t\t\tthis.setActiveOption($option);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\treturn original.apply(this, arguments);\n\t\t\t};\n\t\t})();\n\t\n\t\tvar getScrollbarWidth = function() {\n\t\t\tvar div;\n\t\t\tvar width = getScrollbarWidth.width;\n\t\t\tvar doc = document;\n\t\n\t\t\tif (typeof width === 'undefined') {\n\t\t\t\tdiv = doc.createElement('div');\n\t\t\t\tdiv.innerHTML = '<div style=\"width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;\"><div style=\"width:1px;height:100px;\"></div></div>';\n\t\t\t\tdiv = div.firstChild;\n\t\t\t\tdoc.body.appendChild(div);\n\t\t\t\twidth = getScrollbarWidth.width = div.offsetWidth - div.clientWidth;\n\t\t\t\tdoc.body.removeChild(div);\n\t\t\t}\n\t\t\treturn width;\n\t\t};\n\t\n\t\tvar equalizeSizes = function() {\n\t\t\tvar i, n, height_max, width, width_last, width_parent, $optgroups;\n\t\n\t\t\t$optgroups = $('[data-group]', self.$dropdown_content);\n\t\t\tn = $optgroups.length;\n\t\t\tif (!n || !self.$dropdown_content.width()) return;\n\t\n\t\t\tif (options.equalizeHeight) {\n\t\t\t\theight_max = 0;\n\t\t\t\tfor (i = 0; i < n; i++) {\n\t\t\t\t\theight_max = Math.max(height_max, $optgroups.eq(i).height());\n\t\t\t\t}\n\t\t\t\t$optgroups.css({height: height_max});\n\t\t\t}\n\t\n\t\t\tif (options.equalizeWidth) {\n\t\t\t\twidth_parent = self.$dropdown_content.innerWidth() - getScrollbarWidth();\n\t\t\t\twidth = Math.round(width_parent / n);\n\t\t\t\t$optgroups.css({width: width});\n\t\t\t\tif (n > 1) {\n\t\t\t\t\twidth_last = width_parent - width * (n - 1);\n\t\t\t\t\t$optgroups.eq(n - 1).css({width: width_last});\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\n\t\tif (options.equalizeHeight || options.equalizeWidth) {\n\t\t\thook.after(this, 'positionDropdown', equalizeSizes);\n\t\t\thook.after(this, 'refreshOptions', equalizeSizes);\n\t\t}\n\t\n\t\n\t});\n\t\n\tSelectize.define('remove_button', function(options) {\n\t\toptions = $.extend({\n\t\t\t\tlabel     : '&times;',\n\t\t\t\ttitle     : 'Remove',\n\t\t\t\tclassName : 'remove',\n\t\t\t\tappend    : true\n\t\t\t}, options);\n\t\n\t\t\tvar singleClose = function(thisRef, options) {\n\t\n\t\t\t\toptions.className = 'remove-single';\n\t\n\t\t\t\tvar self = thisRef;\n\t\t\t\tvar html = '<a href=\"javascript:void(0)\" class=\"' + options.className + '\" tabindex=\"-1\" title=\"' + escape_html(options.title) + '\">' + options.label + '</a>';\n\t\n\t\t\t\t/**\n\t\t\t\t * Appends an element as a child (with raw HTML).\n\t\t\t\t *\n\t\t\t\t * @param {string} html_container\n\t\t\t\t * @param {string} html_element\n\t\t\t\t * @return {string}\n\t\t\t\t */\n\t\t\t\tvar append = function(html_container, html_element) {\n\t\t\t\t\treturn $('<span>').append(html_container)\n\t\t\t\t\t\t.append(html_element);\n\t\t\t\t};\n\t\n\t\t\t\tthisRef.setup = (function() {\n\t\t\t\t\tvar original = self.setup;\n\t\t\t\t\treturn function() {\n\t\t\t\t\t\t// override the item rendering method to add the button to each\n\t\t\t\t\t\tif (options.append) {\n\t\t\t\t\t\t\tvar id = $(self.$input.context).attr('id');\n\t\t\t\t\t\t\tvar selectizer = $('#'+id);\n\t\n\t\t\t\t\t\t\tvar render_item = self.settings.render.item;\n\t\t\t\t\t\t\tself.settings.render.item = function(data) {\n\t\t\t\t\t\t\t\treturn append(render_item.apply(thisRef, arguments), html);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\toriginal.apply(thisRef, arguments);\n\t\n\t\t\t\t\t\t// add event listener\n\t\t\t\t\t\tthisRef.$control.on('click', '.' + options.className, function(e) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tif (self.isLocked) return;\n\t\n\t\t\t\t\t\t\tself.clear();\n\t\t\t\t\t\t});\n\t\n\t\t\t\t\t};\n\t\t\t\t})();\n\t\t\t};\n\t\n\t\t\tvar multiClose = function(thisRef, options) {\n\t\n\t\t\t\tvar self = thisRef;\n\t\t\t\tvar html = '<a href=\"javascript:void(0)\" class=\"' + options.className + '\" tabindex=\"-1\" title=\"' + escape_html(options.title) + '\">' + options.label + '</a>';\n\t\n\t\t\t\t/**\n\t\t\t\t * Appends an element as a child (with raw HTML).\n\t\t\t\t *\n\t\t\t\t * @param {string} html_container\n\t\t\t\t * @param {string} html_element\n\t\t\t\t * @return {string}\n\t\t\t\t */\n\t\t\t\tvar append = function(html_container, html_element) {\n\t\t\t\t\tvar pos = html_container.search(/(<\\/[^>]+>\\s*)$/);\n\t\t\t\t\treturn html_container.substring(0, pos) + html_element + html_container.substring(pos);\n\t\t\t\t};\n\t\n\t\t\t\tthisRef.setup = (function() {\n\t\t\t\t\tvar original = self.setup;\n\t\t\t\t\treturn function() {\n\t\t\t\t\t\t// override the item rendering method to add the button to each\n\t\t\t\t\t\tif (options.append) {\n\t\t\t\t\t\t\tvar render_item = self.settings.render.item;\n\t\t\t\t\t\t\tself.settings.render.item = function(data) {\n\t\t\t\t\t\t\t\treturn append(render_item.apply(thisRef, arguments), html);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\toriginal.apply(thisRef, arguments);\n\t\n\t\t\t\t\t\t// add event listener\n\t\t\t\t\t\tthisRef.$control.on('click', '.' + options.className, function(e) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tif (self.isLocked) return;\n\t\n\t\t\t\t\t\t\tvar $item = $(e.currentTarget).parent();\n\t\t\t\t\t\t\tself.setActiveItem($item);\n\t\t\t\t\t\t\tif (self.deleteSelection()) {\n\t\t\t\t\t\t\t\tself.setCaret(self.items.length);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\n\t\t\t\t\t};\n\t\t\t\t})();\n\t\t\t};\n\t\n\t\t\tif (this.settings.mode === 'single') {\n\t\t\t\tsingleClose(this, options);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tmultiClose(this, options);\n\t\t\t}\n\t});\n\t\n\t\n\tSelectize.define('restore_on_backspace', function(options) {\n\t\tvar self = this;\n\t\n\t\toptions.text = options.text || function(option) {\n\t\t\treturn option[this.settings.labelField];\n\t\t};\n\t\n\t\tthis.onKeyDown = (function() {\n\t\t\tvar original = self.onKeyDown;\n\t\t\treturn function(e) {\n\t\t\t\tvar index, option;\n\t\t\t\tif (e.keyCode === KEY_BACKSPACE && this.$control_input.val() === '' && !this.$activeItems.length) {\n\t\t\t\t\tindex = this.caretPos - 1;\n\t\t\t\t\tif (index >= 0 && index < this.items.length) {\n\t\t\t\t\t\toption = this.options[this.items[index]];\n\t\t\t\t\t\tif (this.deleteSelection(e)) {\n\t\t\t\t\t\t\tthis.setTextboxValue(options.text.apply(this, [option]));\n\t\t\t\t\t\t\tthis.refreshOptions(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn original.apply(this, arguments);\n\t\t\t};\n\t\t})();\n\t});\n\t\n\n\treturn Selectize;\n}));"]}