stockbot-buyvm/tests/data/stock_files/core.min.js
2023-12-02 14:49:13 -05:00

3 lines
67 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.enquire=e()}}(function(){return function e(t,i,n){function o(s,a){if(!i[s]){if(!t[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(r)return r(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var p=i[s]={exports:{}};t[s][0].call(p.exports,function(e){var i=t[s][1][e];return o(i||e)},p,p.exports,e,t,i,n)}return i[s].exports}for(var r="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(e,t,i){function n(e,t){this.query=e,this.isUnconditional=t,this.handlers=[],this.mql=window.matchMedia(e);var i=this;this.listener=function(e){i.mql=e.currentTarget||e,i.assess()},this.mql.addListener(this.listener)}var o=e(3),r=e(4).each;n.prototype={constuctor:n,addHandler:function(e){var t=new o(e);this.handlers.push(t),this.matches()&&t.on()},removeHandler:function(e){var t=this.handlers;r(t,function(i,n){if(i.equals(e))return i.destroy(),!t.splice(n,1)})},matches:function(){return this.mql.matches||this.isUnconditional},clear:function(){r(this.handlers,function(e){e.destroy()}),this.mql.removeListener(this.listener),this.handlers.length=0},assess:function(){var e=this.matches()?"on":"off";r(this.handlers,function(t){t[e]()})}},t.exports=n},{3:3,4:4}],2:[function(e,t,i){function n(){if(!window.matchMedia)throw new Error("matchMedia not present, legacy browsers require a polyfill");this.queries={},this.browserIsIncapable=!window.matchMedia("only all").matches}var o=e(1),r=e(4),s=r.each,a=r.isFunction,l=r.isArray;n.prototype={constructor:n,register:function(e,t,i){var n=this.queries,r=i&&this.browserIsIncapable;return n[e]||(n[e]=new o(e,r)),a(t)&&(t={match:t}),l(t)||(t=[t]),s(t,function(t){a(t)&&(t={match:t}),n[e].addHandler(t)}),this},unregister:function(e,t){var i=this.queries[e];return i&&(t?i.removeHandler(t):(i.clear(),delete this.queries[e])),this}},t.exports=n},{1:1,4:4}],3:[function(e,t,i){function n(e){this.options=e,!e.deferSetup&&this.setup()}n.prototype={constructor:n,setup:function(){this.options.setup&&this.options.setup(),this.initialised=!0},on:function(){!this.initialised&&this.setup(),this.options.match&&this.options.match()},off:function(){this.options.unmatch&&this.options.unmatch()},destroy:function(){this.options.destroy?this.options.destroy():this.off()},equals:function(e){return this.options===e||this.options.match===e}},t.exports=n},{}],4:[function(e,t,i){function n(e,t){for(var i=0,n=e.length;i<n&&!1!==t(e[i],i);i++);}function o(e){return"[object Array]"===Object.prototype.toString.apply(e)}function r(e){return"function"==typeof e}t.exports={isFunction:r,isArray:o,each:n}},{}],5:[function(e,t,i){var n=e(2);t.exports=new n},{2:2}]},{},[5])(5)}),function(e){function t(e,t,o){var r=e[0],s=/er/.test(o)?_indeterminate:/bl/.test(o)?h:u,a=o==_update?{checked:r[u],disabled:r[h],indeterminate:"true"==e.attr(_indeterminate)||"false"==e.attr(_determinate)}:r[s];if(/^(ch|di|in)/.test(o)&&!a)i(e,s);else if(/^(un|en|de)/.test(o)&&a)n(e,s);else if(o==_update)for(var l in a)a[l]?i(e,l,!0):n(e,l,!0);else t&&"toggle"!=o||(t||e[_callback]("ifClicked"),a?r[_type]!==p&&n(e,s):i(e,s))}function i(t,i,o){var f=t[0],g=t.parent(),v=i==u,m=i==_indeterminate,y=i==h,w=m?_determinate:v?d:"enabled",b=r(t,w+s(f[_type])),C=r(t,i+s(f[_type]));if(!0!==f[i]){if(!o&&i==u&&f[_type]==p&&f.name){var O=t.closest("form"),_='input[name="'+f.name+'"]';_=O.length?O.find(_):e(_);_.each(function(){this!==f&&e(this).data(l)&&n(e(this),i)})}m?(f[i]=!0,f[u]&&n(t,u,"force")):(o||(f[i]=!0),v&&f[_indeterminate]&&n(t,_indeterminate,!1)),a(t,v,i,o)}f[h]&&r(t,_cursor,!0)&&g.find("."+c).css(_cursor,"default"),g[_add](C||r(t,i)||""),g.attr("role")&&!m&&g.attr("aria-"+(y?h:u),"true"),g[_remove](b||r(t,w)||"")}function n(e,t,i){var n=e[0],o=e.parent(),l=t==u,p=t==_indeterminate,f=t==h,g=p?_determinate:l?d:"enabled",v=r(e,g+s(n[_type])),m=r(e,t+s(n[_type]));!1!==n[t]&&(!p&&i&&"force"!=i||(n[t]=!1),a(e,l,g,i)),!n[h]&&r(e,_cursor,!0)&&o.find("."+c).css(_cursor,"pointer"),o[_remove](m||r(e,t)||""),o.attr("role")&&!p&&o.attr("aria-"+(f?h:u),"false"),o[_add](v||r(e,g)||"")}function o(t,i){t.data(l)&&(t.parent().html(t.attr("style",t.data(l).s||"")),i&&t[_callback](i),t.off(".i").unwrap(),e(_label+'[for="'+t[0].id+'"]').add(t.closest(_label)).off(".i"))}function r(e,t,i){if(e.data(l))return e.data(l).o[t+(i?"":"Class")]}function s(e){return e.charAt(0).toUpperCase()+e.slice(1)}function a(e,t,i,n){n||(t&&e[_callback]("ifToggled"),e[_callback]("ifChanged")[_callback]("if"+s(i)))}var l="iCheck",c=l+"-helper",p="radio",u="checked",d="un"+u,h="disabled";_determinate="determinate",_indeterminate="in"+_determinate,_update="update",_type="type",_click="click",_touch="touchbegin.i touchend.i",_add="addClass",_remove="removeClass",_callback="trigger",_label="label",_cursor="cursor",_mobile=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent),e.fn[l]=function(r,s){var a='input[type="checkbox"], input[type="'+p+'"]',d=e(),f=function(t){t.each(function(){var t=e(this);d=t.is(a)?d.add(t):d.add(t.find(a))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(r))return r=r.toLowerCase(),f(this),d.each(function(){var i=e(this);"destroy"==r?o(i,"ifDestroyed"):t(i,!0,r),e.isFunction(s)&&s()});if("object"!=typeof r&&r)return this;var g=e.extend({checkedClass:u,disabledClass:h,indeterminateClass:_indeterminate,labelHover:!0},r),v=g.handle,m=g.hoverClass||"hover",y=g.focusClass||"focus",w=g.activeClass||"active",b=!!g.labelHover,C=g.labelHoverClass||"hover",O=0|(""+g.increaseArea).replace("%","");return"checkbox"!=v&&v!=p||(a='input[type="'+v+'"]'),-50>O&&(O=-50),f(this),d.each(function(){var r=e(this);o(r);var s=this,a=s.id,d=-O+"%",f=100+2*O+"%",v=(f={position:"absolute",top:d,left:d,display:"block",width:f,height:f,margin:0,padding:0,background:"#fff",border:0,opacity:0},d=_mobile?{position:"absolute",visibility:"hidden"}:O?f:{position:"absolute",opacity:0},"checkbox"==s[_type]?g.checkboxClass||"icheckbox":g.radioClass||"i"+p),_=e(_label+'[for="'+a+'"]').add(r.closest(_label)),S=!!g.aria,$=l+"-"+Math.random().toString(36).substr(2,6),T='<div class="'+v+'" '+(S?'role="'+s[_type]+'" ':"");S&&_.each(function(){T+='aria-labelledby="',this.id?T+=this.id:(this.id=$,T+=$),T+='"'}),T=r.wrap(T+"/>")[_callback]("ifCreated").parent().append(g.insert),f=e('<ins class="'+c+'"/>').css(f).appendTo(T),r.data(l,{o:g,s:r.attr("style")}).css(d),g.inheritClass&&T[_add](s.className||""),g.inheritID&&a&&T.attr("id",l+"-"+a),"static"==T.css("position")&&T.css("position","relative"),t(r,!0,_update),_.length&&_.on(_click+".i mouseover.i mouseout.i "+_touch,function(i){var n=i[_type],o=e(this);if(!s[h]){if(n==_click){if(e(i.target).is("a"))return;t(r,!1,!0)}else b&&(/ut|nd/.test(n)?(T[_remove](m),o[_remove](C)):(T[_add](m),o[_add](C)));if(!_mobile)return!1;i.stopPropagation()}}),r.on(_click+".i focus.i blur.i keyup.i keydown.i keypress.i",function(e){var t=e[_type];return e=e.keyCode,t!=_click&&("keydown"==t&&32==e?(s[_type]==p&&s[u]||(s[u]?n(r,u):i(r,u)),!1):void("keyup"==t&&s[_type]==p?!s[u]&&i(r,u):/us|ur/.test(t)&&T["blur"==t?_remove:_add](y)))}),f.on(_click+" mousedown mouseup mouseover mouseout "+_touch,function(e){var i=e[_type],n=/wn|up/.test(i)?w:m;if(!s[h]){if(i==_click?t(r,!1,!0):(/wn|er|in/.test(i)?T[_add](n):T[_remove](n+" "+w),_.length&&b&&n==m&&_[/ut|nd/.test(i)?_remove:_add](C)),!_mobile)return!1;e.stopPropagation()}})})}}(window.jQuery||window.Zepto),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";var e=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),t=function(){var t=".stickySidebar",i={topSpacing:0,bottomSpacing:0,containerSelector:!1,innerWrapperSelector:".inner-wrapper-sticky",stickyClass:"is-affixed",resizeSensor:!0,minWidth:!1};return function(){function n(e){var t=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.options=n.extend(i,o),this.sidebar="string"==typeof e?document.querySelector(e):e,void 0===this.sidebar)throw new Error("There is no specific sidebar element.");this.sidebarInner=!1,this.container=this.sidebar.parentElement,this.affixedType="STATIC",this.direction="down",this.support={transform:!1,transform3d:!1},this._initialized=!1,this._reStyle=!1,this._breakpoint=!1,this._resizeListeners=[],this.dimensions={translateY:0,topSpacing:0,lastTopSpacing:0,bottomSpacing:0,lastBottomSpacing:0,sidebarHeight:0,sidebarWidth:0,containerTop:0,containerHeight:0,viewportHeight:0,viewportTop:0,lastViewportTop:0},["handleEvent"].forEach(function(e){t[e]=t[e].bind(t)}),this.initialize()}return e(n,[{key:"initialize",value:function(){var e=this;if(this._setSupportFeatures(),this.options.innerWrapperSelector&&(this.sidebarInner=this.sidebar.querySelector(this.options.innerWrapperSelector),null===this.sidebarInner&&(this.sidebarInner=!1)),!this.sidebarInner){var t=document.createElement("div");for(t.setAttribute("class","inner-wrapper-sticky"),this.sidebar.appendChild(t);this.sidebar.firstChild!=t;)t.appendChild(this.sidebar.firstChild);this.sidebarInner=this.sidebar.querySelector(".inner-wrapper-sticky")}if(this.options.containerSelector){var i=document.querySelectorAll(this.options.containerSelector);if((i=Array.prototype.slice.call(i)).forEach(function(t,i){t.contains(e.sidebar)&&(e.container=t)}),!i.length)throw new Error("The container does not contains on the sidebar.")}"function"!=typeof this.options.topSpacing&&(this.options.topSpacing=parseInt(this.options.topSpacing)||0),"function"!=typeof this.options.bottomSpacing&&(this.options.bottomSpacing=parseInt(this.options.bottomSpacing)||0),this._widthBreakpoint(),this.calcDimensions(),this.stickyPosition(),this.bindEvents(),this._initialized=!0}},{key:"bindEvents",value:function(){window.addEventListener("resize",this,{passive:!0,capture:!1}),window.addEventListener("scroll",this,{passive:!0,capture:!1}),this.sidebar.addEventListener("update"+t,this),this.options.resizeSensor&&"undefined"!=typeof ResizeSensor&&(new ResizeSensor(this.sidebarInner,this.handleEvent),new ResizeSensor(this.container,this.handleEvent))}},{key:"handleEvent",value:function(e){this.updateSticky(e)}},{key:"calcDimensions",value:function(){if(!this._breakpoint){var e=this.dimensions;e.containerTop=n.offsetRelative(this.container).top,e.containerHeight=this.container.clientHeight,e.containerBottom=e.containerTop+e.containerHeight,e.sidebarHeight=this.sidebarInner.offsetHeight,e.sidebarWidth=this.sidebarInner.offsetWidth,e.viewportHeight=window.innerHeight,this._calcDimensionsWithScroll()}}},{key:"_calcDimensionsWithScroll",value:function(){var e=this.dimensions;e.sidebarLeft=n.offsetRelative(this.sidebar).left,e.viewportTop=document.documentElement.scrollTop||document.body.scrollTop,e.viewportBottom=e.viewportTop+e.viewportHeight,e.viewportLeft=document.documentElement.scrollLeft||document.body.scrollLeft,e.topSpacing=this.options.topSpacing,e.bottomSpacing=this.options.bottomSpacing,"function"==typeof e.topSpacing&&(e.topSpacing=parseInt(e.topSpacing(this.sidebar))||0),"function"==typeof e.bottomSpacing&&(e.bottomSpacing=parseInt(e.bottomSpacing(this.sidebar))||0),"VIEWPORT-TOP"===this.affixedType?e.topSpacing<e.lastTopSpacing&&(e.translateY+=e.lastTopSpacing-e.topSpacing,this._reStyle=!0):"VIEWPORT-BOTTOM"===this.affixedType&&e.bottomSpacing<e.lastBottomSpacing&&(e.translateY+=e.lastBottomSpacing-e.bottomSpacing,this._reStyle=!0),e.lastTopSpacing=e.topSpacing,e.lastBottomSpacing=e.bottomSpacing}},{key:"isSidebarFitsViewport",value:function(){return this.dimensions.sidebarHeight<this.dimensions.viewportHeight}},{key:"observeScrollDir",value:function(){var e=this.dimensions;if(e.lastViewportTop!==e.viewportTop){var t="down"===this.direction?Math.min:Math.max;e.viewportTop===t(e.viewportTop,e.lastViewportTop)&&(this.direction="down"===this.direction?"up":"down")}}},{key:"getAffixType",value:function(){var e=this.dimensions,t=!1;this._calcDimensionsWithScroll();var i=e.sidebarHeight+e.containerTop,n=e.viewportTop+e.topSpacing,o=e.viewportBottom-e.bottomSpacing;return"up"===this.direction?n<=e.containerTop?(e.translateY=0,t="STATIC"):n<=e.translateY+e.containerTop?(e.translateY=n-e.containerTop,t="VIEWPORT-TOP"):!this.isSidebarFitsViewport()&&e.containerTop<=n&&(t="VIEWPORT-UNBOTTOM"):this.isSidebarFitsViewport()?e.sidebarHeight+n>=e.containerBottom?(e.translateY=e.containerBottom-i,t="CONTAINER-BOTTOM"):n>=e.containerTop&&(e.translateY=n-e.containerTop,t="VIEWPORT-TOP"):e.containerBottom<=o?(e.translateY=e.containerBottom-i,t="CONTAINER-BOTTOM"):i+e.translateY<=o?(e.translateY=o-i,t="VIEWPORT-BOTTOM"):e.containerTop+e.translateY<=n&&(t="VIEWPORT-UNBOTTOM"),e.translateY=Math.max(0,e.translateY),e.translateY=Math.min(e.containerHeight,e.translateY),e.lastViewportTop=e.viewportTop,t}},{key:"_getStyle",value:function(e){if(void 0!==e){var t={inner:{},outer:{}},i=this.dimensions;switch(e){case"VIEWPORT-TOP":t.inner={position:"fixed",top:i.topSpacing,left:i.sidebarLeft-i.viewportLeft,width:i.sidebarWidth};break;case"VIEWPORT-BOTTOM":t.inner={position:"fixed",top:"auto",left:i.sidebarLeft,bottom:i.bottomSpacing,width:i.sidebarWidth};break;case"CONTAINER-BOTTOM":case"VIEWPORT-UNBOTTOM":var o=this._getTranslate(0,i.translateY+"px");t.inner=o?{transform:o}:{position:"absolute",top:i.translateY,width:i.sidebarWidth}}switch(e){case"VIEWPORT-TOP":case"VIEWPORT-BOTTOM":case"VIEWPORT-UNBOTTOM":case"CONTAINER-BOTTOM":t.outer={height:i.sidebarHeight,position:"relative"}}return t.outer=n.extend({height:"",position:""},t.outer),t.inner=n.extend({position:"relative",top:"",left:"",bottom:"",width:"",transform:this._getTranslate()},t.inner),t}}},{key:"stickyPosition",value:function(e){if(!this._breakpoint){e=this._reStyle||e||!1;var i=this.getAffixType(),o=this._getStyle(i);if((this.affixedType!=i||e)&&i){var r="affix."+i.toLowerCase().replace("viewport-","")+t;for(var s in n.eventTrigger(this.sidebar,r),"STATIC"===i?n.removeClass(this.sidebar,this.options.stickyClass):n.addClass(this.sidebar,this.options.stickyClass),o.outer)this.sidebar.style[s]=o.outer[s];for(var a in o.inner){var l="number"==typeof o.inner[a]?"px":"";this.sidebarInner.style[a]=o.inner[a]+l}var c="affixed."+i.toLowerCase().replace("viewport-","")+t;n.eventTrigger(this.sidebar,c)}else this._initialized&&(this.sidebarInner.style.left=o.inner.left);this.affixedType=i}}},{key:"_widthBreakpoint",value:function(){window.innerWidth<=this.options.minWidth?(this._breakpoint=!0,this.affixedType="STATIC",this.sidebar.removeAttribute("style"),n.removeClass(this.sidebar,this.options.stickyClass),this.sidebarInner.removeAttribute("style")):this._breakpoint=!1}},{key:"updateSticky",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._running||(this._running=!0,function(t){requestAnimationFrame(function(){switch(t){case"scroll":e._calcDimensionsWithScroll(),e.observeScrollDir(),e.stickyPosition();break;case"resize":default:e._widthBreakpoint(),e.calcDimensions(),e.stickyPosition(!0)}e._running=!1})}(t.type))}},{key:"_setSupportFeatures",value:function(){var e=this.support;e.transform=n.supportTransform(),e.transform3d=n.supportTransform(!0)}},{key:"_getTranslate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.support.transform3d?"translate3d("+e+", "+t+", "+i+")":!!this.support.translate&&"translate("+e+", "+t+")"}},{key:"destroy",value:function(){window.removeEventListener("resize",this,{caption:!1}),window.removeEventListener("scroll",this,{caption:!1}),this.sidebar.classList.remove(this.options.stickyClass),this.sidebar.style.minHeight="",this.sidebar.removeEventListener("update"+t,this);var e={inner:{},outer:{}};for(var i in e.inner={position:"",top:"",left:"",bottom:"",width:"",transform:""},e.outer={height:"",position:""},e.outer)this.sidebar.style[i]=e.outer[i];for(var n in e.inner)this.sidebarInner.style[n]=e.inner[n];this.options.resizeSensor&&"undefined"!=typeof ResizeSensor&&(ResizeSensor.detach(this.sidebarInner,this.handleEvent),ResizeSensor.detach(this.container,this.handleEvent))}}],[{key:"supportTransform",value:function(e){var t=!1,i=e?"perspective":"transform",n=i.charAt(0).toUpperCase()+i.slice(1),o=document.createElement("support").style;return(i+" "+["Webkit","Moz","O","ms"].join(n+" ")+n).split(" ").forEach(function(e,i){if(void 0!==o[e])return t=e,!1}),t}},{key:"eventTrigger",value:function(e,t,i){try{n=new CustomEvent(t,{detail:i})}catch(e){var n;(n=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,i)}e.dispatchEvent(n)}},{key:"extend",value:function(e,t){var i={};for(var n in e)void 0!==t[n]?i[n]=t[n]:i[n]=e[n];return i}},{key:"offsetRelative",value:function(e){var t={left:0,top:0};do{var i=e.offsetTop,n=e.offsetLeft;isNaN(i)||(t.top+=i),isNaN(n)||(t.left+=n),e="BODY"===e.tagName?e.parentElement:e.offsetParent}while(e);return t}},{key:"addClass",value:function(e,t){n.hasClass(e,t)||(e.classList?e.classList.add(t):e.className+=" "+t)}},{key:"removeClass",value:function(e,t){n.hasClass(e,t)&&(e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," "))}},{key:"hasClass",value:function(e,t){return e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className)}}]),n}()}();window.StickySidebar=t,function(){if("undefined"!=typeof window){var e=window.$||window.jQuery||window.Zepto,i="stickySidebar";if(e){e.fn.stickySidebar=function(n){return this.each(function(){var o=e(this),r=e(this).data(i);if(r||(r=new t(this,"object"==typeof n&&n),o.data(i,r)),"string"==typeof n){if(void 0===r[n]&&-1===["destroy","updateSticky"].indexOf(n))throw new Error('No method named "'+n+'"');r[n]()}})},e.fn.stickySidebar.Constructor=t;var n=e.fn.stickySidebar;e.fn.stickySidebar.noConflict=function(){return e.fn.stickySidebar=n,this}}}}()}),function(e,t){"function"==typeof define&&define.amd?define("sifter",t):"object"==typeof exports?module.exports=t():e.Sifter=t()}(this,function(){var e=function(e,t){this.items=e,this.settings=t||{diacritics:!0}};e.prototype.tokenize=function(e){if(e=o(String(e||"").toLowerCase()),!e||!e.length)return[];var t,i,n,s,l=[],c=e.split(/ +/);for(t=0,i=c.length;t<i;t++){if(n=r(c[t]),this.settings.diacritics)for(s in a)a.hasOwnProperty(s)&&(n=n.replace(new RegExp(s,"g"),a[s]));l.push({string:c[t],regex:new RegExp(n,"i")})}return l},e.prototype.iterator=function(e,t){var i;i=s(e)?Array.prototype.forEach||function(e){for(var t=0,i=this.length;t<i;t++)e(this[t],t,this)}:function(e){for(var t in this)this.hasOwnProperty(t)&&e(this[t],t,this)},i.apply(e,[t])},e.prototype.getScoreFunction=function(e,t){var i,o,r,s,a;i=this,e=i.prepareSearch(e,t),r=e.tokens,o=e.options.fields,s=r.length,a=e.options.nesting;var l=function(e,t){var i,n;return e?(e=String(e||""),n=e.search(t.regex),-1===n?0:(i=t.string.length/e.length,0===n&&(i+=.5),i)):0},c=function(){var e=o.length;return e?1===e?function(e,t){return l(n(t,o[0],a),e)}:function(t,i){for(var r=0,s=0;r<e;r++)s+=l(n(i,o[r],a),t);return s/e}:function(){return 0}}();return s?1===s?function(e){return c(r[0],e)}:"and"===e.options.conjunction?function(e){for(var t,i=0,n=0;i<s;i++){if(t=c(r[i],e),t<=0)return 0;n+=t}return n/s}:function(e){for(var t=0,i=0;t<s;t++)i+=c(r[t],e);return i/s}:function(){return 0}},e.prototype.getSortFunction=function(e,i){var o,r,s,a,l,c,p,u,d,h,f;if(s=this,e=s.prepareSearch(e,i),f=!e.query&&i.sort_empty||i.sort,d=function(e,t){return"$score"===e?t.score:n(s.items[t.id],e,i.nesting)},l=[],f)for(o=0,r=f.length;o<r;o++)(e.query||"$score"!==f[o].field)&&l.push(f[o]);if(e.query){for(h=!0,o=0,r=l.length;o<r;o++)if("$score"===l[o].field){h=!1;break}h&&l.unshift({field:"$score",direction:"desc"})}else for(o=0,r=l.length;o<r;o++)if("$score"===l[o].field){l.splice(o,1);break}for(u=[],o=0,r=l.length;o<r;o++)u.push("desc"===l[o].direction?-1:1);return c=l.length,c?1===c?(a=l[0].field,p=u[0],function(e,i){return p*t(d(a,e),d(a,i))}):function(e,i){var n,o,r;for(n=0;n<c;n++)if(r=l[n].field,o=u[n]*t(d(r,e),d(r,i)))return o;return 0}:null},e.prototype.prepareSearch=function(e,t){if("object"==typeof e)return e;t=i({},t);var n=t.fields,o=t.sort,r=t.sort_empty;return n&&!s(n)&&(t.fields=[n]),o&&!s(o)&&(t.sort=[o]),r&&!s(r)&&(t.sort_empty=[r]),{options:t,query:String(e||"").toLowerCase(),tokens:this.tokenize(e),total:0,items:[]}},e.prototype.search=function(e,t){var i,n,o,r,s=this;return n=this.prepareSearch(e,t),t=n.options,e=n.query,r=t.score||s.getScoreFunction(n),e.length?s.iterator(s.items,function(e,o){i=r(e),(!1===t.filter||i>0)&&n.items.push({score:i,id:o})}):s.iterator(s.items,function(e,t){n.items.push({score:1,id:t})}),o=s.getSortFunction(n,t),o&&n.items.sort(o),n.total=n.items.length,"number"==typeof t.limit&&(n.items=n.items.slice(0,t.limit)),n};var t=function(e,t){return"number"==typeof e&&"number"==typeof t?e>t?1:e<t?-1:0:(e=l(String(e||"")),t=l(String(t||"")),e>t?1:t>e?-1:0)},i=function(e,t){var i,n,o,r;for(i=1,n=arguments.length;i<n;i++)if(r=arguments[i])for(o in r)r.hasOwnProperty(o)&&(e[o]=r[o]);return e},n=function(e,t,i){if(e&&t){if(!i)return e[t];for(var n=t.split(".");n.length&&(e=e[n.shift()]););return e}},o=function(e){return(e+"").replace(/^\s+|\s+$|/g,"")},r=function(e){return(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},s=Array.isArray||"undefined"!=typeof $&&$.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a={a:"[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]",b:"[b␢βΒB฿𐌁ᛒ]",c:"[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕ]",d:"[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅð]",e:"[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇɘǝƏƐε]",f:"[fƑƒḞḟ]",g:"[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]",h:"[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]",i:"[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪ]",j:"[jȷĴĵɈɉʝɟʲ]",k:"[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]",l:"[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟ]",n:"[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴŊŋ]",o:"[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]",p:"[pṔṕṖṗⱣᵽƤƥᵱ]",q:"[qꝖꝗʠɊɋꝘꝙq̃]",r:"[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]",s:"[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]",t:"[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]",u:"[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ]",v:"[vṼṽṾṿƲʋꝞꝟⱱʋ]",w:"[wẂẃẀẁŴŵẄẅẆẇẈẉ]",x:"[xẌẍẊẋχ]",y:"[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]",z:"[zŹźẐẑŽžŻżẒẓẔẕƵƶ]"},l=function(){var e,t,i,n,o="",r={};for(i in a)if(a.hasOwnProperty(i))for(n=a[i].substring(2,a[i].length-1),o+=n,e=0,t=n.length;e<t;e++)r[n.charAt(e)]=i;var s=new RegExp("["+o+"]","g");return function(e){return e.replace(s,function(e){return r[e]}).toLowerCase()}}();return e}),function(e,t){"function"==typeof define&&define.amd?define("microplugin",t):"object"==typeof exports?module.exports=t():e.MicroPlugin=t()}(this,function(){var e={mixin:function(e){e.plugins={},e.prototype.initializePlugins=function(e){var i,n,o,r=this,s=[];if(r.plugins={names:[],settings:{},requested:{},loaded:{}},t.isArray(e))for(i=0,n=e.length;i<n;i++)"string"==typeof e[i]?s.push(e[i]):(r.plugins.settings[e[i].name]=e[i].options,s.push(e[i].name));else if(e)for(o in e)e.hasOwnProperty(o)&&(r.plugins.settings[o]=e[o],s.push(o));for(;s.length;)r.require(s.shift())},e.prototype.loadPlugin=function(t){var i=this,n=i.plugins,o=e.plugins[t];if(!e.plugins.hasOwnProperty(t))throw new Error('Unable to find "'+t+'" plugin');n.requested[t]=!0,n.loaded[t]=o.fn.apply(i,[i.plugins.settings[t]||{}]),n.names.push(t)},e.prototype.require=function(e){var t=this,i=t.plugins;if(!t.plugins.loaded.hasOwnProperty(e)){if(i.requested[e])throw new Error('Plugin has circular dependency ("'+e+'")');t.loadPlugin(e)}return i.loaded[e]},e.define=function(t,i){e.plugins[t]={name:t,fn:i}}}},t={isArray:Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}};return e}),function(e,t){"function"==typeof define&&define.amd?define("selectize",["jquery","sifter","microplugin"],t):"object"==typeof exports?module.exports=t(require("jquery"),require("sifter"),require("microplugin")):e.Selectize=t(e.jQuery,e.Sifter,e.MicroPlugin)}(this,function(e,t,i){"use strict";var n=function(e,t){if("string"!=typeof t||t.length){var i="string"==typeof t?new RegExp(t,"i"):t,n=function(e){var t=0;if(3===e.nodeType){var o=e.data.search(i);if(o>=0&&e.data.length>0){var r=e.data.match(i),s=document.createElement("span");s.className="highlight";var a=e.splitText(o),l=(a.splitText(r[0].length),a.cloneNode(!0));s.appendChild(l),a.parentNode.replaceChild(s,a),t=1}}else if(1===e.nodeType&&e.childNodes&&!/(script|style)/i.test(e.tagName))for(var c=0;c<e.childNodes.length;++c)c+=n(e.childNodes[c]);return t};return e.each(function(){n(this)})}};e.fn.removeHighlight=function(){return this.find("span.highlight").each(function(){this.parentNode.firstChild.nodeName;var e=this.parentNode;e.replaceChild(this.firstChild,this),e.normalize()}).end()};var o=function(){};o.prototype={on:function(e,t){this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(t)},off:function(e,t){var i=arguments.length;return 0===i?delete this._events:1===i?delete this._events[e]:(this._events=this._events||{},void(e in this._events!=0&&this._events[e].splice(this._events[e].indexOf(t),1)))},trigger:function(e){if(this._events=this._events||{},e in this._events!=0)for(var t=0;t<this._events[e].length;t++)this._events[e][t].apply(this,Array.prototype.slice.call(arguments,1))}},o.mixin=function(e){for(var t=["on","off","trigger"],i=0;i<t.length;i++)e.prototype[t[i]]=o.prototype[t[i]]};var r=/Mac/.test(navigator.userAgent),s=65,a=13,l=27,c=37,p=38,u=80,d=39,h=40,f=78,g=8,v=46,m=16,y=r?91:17,w=r?18:17,b=9,C=1,O=2,_=!/android/i.test(window.navigator.userAgent)&&!!document.createElement("input").validity,S=function(e){return void 0!==e},$=function(e){return null==e?null:"boolean"==typeof e?e?"1":"0":e+""},T=function(e){return(e+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},I={before:function(e,t,i){var n=e[t];e[t]=function(){return i.apply(e,arguments),n.apply(e,arguments)}},after:function(e,t,i){var n=e[t];e[t]=function(){var t=n.apply(e,arguments);return i.apply(e,arguments),t}}},k=function(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}},x=function(e,t){var i;return function(){var n=this,o=arguments;window.clearTimeout(i),i=window.setTimeout(function(){e.apply(n,o)},t)}},P=function(e,t,i){var n,o=e.trigger,r={};for(n in e.trigger=function(){var i=arguments[0];return-1===t.indexOf(i)?o.apply(e,arguments):void(r[i]=arguments)},i.apply(e,[]),e.trigger=o,r)r.hasOwnProperty(n)&&o.apply(e,r[n])},A=function(e,t,i,n){e.on(t,i,function(t){for(var i=t.target;i&&i.parentNode!==e[0];)i=i.parentNode;return t.currentTarget=i,n.apply(this,[t])})},D=function(e){var t={};if("selectionStart"in e)t.start=e.selectionStart,t.length=e.selectionEnd-t.start;else if(document.selection){e.focus();var i=document.selection.createRange(),n=document.selection.createRange().text.length;i.moveStart("character",-e.value.length),t.start=i.text.length-n,t.length=n}return t},F=function(e,t,i){var n,o,r={};if(i)for(n=0,o=i.length;n<o;n++)r[i[n]]=e.css(i[n]);else r=e.css();t.css(r)},E=function(t,i){if(!t)return 0;var n=e("<test>").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).text(t).appendTo("body");F(i,n,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]);var o=n.width();return n.remove(),o},z=function(e){var t=null,i=function(i,n){var o,r,s,a,l,c,p,u;i=i||window.event||{},n=n||{},i.metaKey||i.altKey||(n.force||!1!==e.data("grow"))&&(o=e.val(),i.type&&"keydown"===i.type.toLowerCase()&&(r=i.keyCode,s=r>=97&&r<=122||r>=65&&r<=90||r>=48&&r<=57||32===r,r===v||r===g?(u=D(e[0]),u.length?o=o.substring(0,u.start)+o.substring(u.start+u.length):r===g&&u.start?o=o.substring(0,u.start-1)+o.substring(u.start+1):r===v&&void 0!==u.start&&(o=o.substring(0,u.start)+o.substring(u.start+1))):s&&(c=i.shiftKey,p=String.fromCharCode(i.keyCode),p=c?p.toUpperCase():p.toLowerCase(),o+=p)),a=e.attr("placeholder"),!o&&a&&(o=a),l=E(o,e)+4,l!==t&&(t=l,e.width(l),e.triggerHandler("resize")))};e.on("keydown keyup update blur",i),i()},q=function(e){var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML},H=function(e,t){t||(t={});var i="Selectize";console.error(i+": "+e),t.explanation&&(console.group&&console.group(),console.error(t.explanation),console.group&&console.groupEnd())},N=function(i,n){var o,r,s,a,l=this;a=i[0],a.selectize=l;var c=window.getComputedStyle&&window.getComputedStyle(a,null);if(s=c?c.getPropertyValue("direction"):a.currentStyle&&a.currentStyle.direction,s=s||i.parents("[dir]:first").attr("dir")||"",e.extend(l,{order:0,settings:n,$input:i,tabIndex:i.attr("tabindex")||"",tagType:"select"===a.tagName.toLowerCase()?C:O,rtl:/rtl/i.test(s),eventNS:".selectize"+ ++N.count,highlightedValue:null,isOpen:!1,isDisabled:!1,isRequired:i.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===n.loadThrottle?l.onSearchChange:x(l.onSearchChange,n.loadThrottle)}),l.sifter=new t(this.options,{diacritics:n.diacritics}),l.settings.options){for(o=0,r=l.settings.options.length;o<r;o++)l.registerOption(l.settings.options[o]);delete l.settings.options}if(l.settings.optgroups){for(o=0,r=l.settings.optgroups.length;o<r;o++)l.registerOptionGroup(l.settings.optgroups[o]);delete l.settings.optgroups}l.settings.mode=l.settings.mode||(1===l.settings.maxItems?"single":"multi"),"boolean"!=typeof l.settings.hideSelected&&(l.settings.hideSelected="multi"===l.settings.mode),l.initializePlugins(l.settings.plugins),l.setupCallbacks(),l.setupTemplates(),l.setup()};return o.mixin(N),void 0!==i?i.mixin(N):H("Dependency MicroPlugin is missing",{explanation:'Make sure you either: (1) are using the "standalone" version of Selectize, or (2) require MicroPlugin before you load Selectize.'}),e.extend(N.prototype,{setup:function(){var t,i,n,o,s,a,l,c,p,u,d=this,h=d.settings,f=d.eventNS,g=e(window),v=e(document),b=d.$input;if(l=d.settings.mode,c=b.attr("class")||"",t=e("<div>").addClass(h.wrapperClass).addClass(c).addClass(l),i=e("<div>").addClass(h.inputClass).addClass("items").appendTo(t),n=e('<input type="text" autocomplete="off" />').appendTo(i).attr("tabindex",b.is(":disabled")?"-1":d.tabIndex),a=e(h.dropdownParent||t),o=e("<div>").addClass(h.dropdownClass).addClass(l).hide().appendTo(a),s=e("<div>").addClass(h.dropdownContentClass).appendTo(o),(u=b.attr("id"))&&(n.attr("id",u+"-selectized"),e("label[for='"+u+"']").attr("for",u+"-selectized")),d.settings.copyClassesToDropdown&&o.addClass(c),t.css({width:b[0].style.width}),d.plugins.names.length&&(p="plugin-"+d.plugins.names.join(" plugin-"),t.addClass(p),o.addClass(p)),(null===h.maxItems||h.maxItems>1)&&d.tagType===C&&b.attr("multiple","multiple"),d.settings.placeholder&&n.attr("placeholder",h.placeholder),!d.settings.splitOn&&d.settings.delimiter){var O=d.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");d.settings.splitOn=new RegExp("\\s*"+O+"+\\s*")}b.attr("autocorrect")&&n.attr("autocorrect",b.attr("autocorrect")),
b.attr("autocapitalize")&&n.attr("autocapitalize",b.attr("autocapitalize")),d.$wrapper=t,d.$control=i,d.$control_input=n,d.$dropdown=o,d.$dropdown_content=s,o.on("mouseenter","[data-selectable]",function(){return d.onOptionHover.apply(d,arguments)}),o.on("mousedown click","[data-selectable]",function(){return d.onOptionSelect.apply(d,arguments)}),A(i,"mousedown","*:not(input)",function(){return d.onItemSelect.apply(d,arguments)}),z(n),i.on({mousedown:function(){return d.onMouseDown.apply(d,arguments)},click:function(){return d.onClick.apply(d,arguments)}}),n.on({mousedown:function(e){e.stopPropagation()},keydown:function(){return d.onKeyDown.apply(d,arguments)},keyup:function(){return d.onKeyUp.apply(d,arguments)},keypress:function(){return d.onKeyPress.apply(d,arguments)},resize:function(){d.positionDropdown.apply(d,[])},blur:function(){return d.onBlur.apply(d,arguments)},focus:function(){return d.ignoreBlur=!1,d.onFocus.apply(d,arguments)},paste:function(){return d.onPaste.apply(d,arguments)}}),v.on("keydown"+f,function(e){d.isCmdDown=e[r?"metaKey":"ctrlKey"],d.isCtrlDown=e[r?"altKey":"ctrlKey"],d.isShiftDown=e.shiftKey}),v.on("keyup"+f,function(e){e.keyCode===w&&(d.isCtrlDown=!1),e.keyCode===m&&(d.isShiftDown=!1),e.keyCode===y&&(d.isCmdDown=!1)}),v.on("mousedown"+f,function(e){if(d.isFocused){if(e.target===d.$dropdown[0]||e.target.parentNode===d.$dropdown[0])return!1;d.$control.has(e.target).length||e.target===d.$control[0]||d.blur(e.target)}}),g.on(["scroll"+f,"resize"+f].join(" "),function(){d.isOpen&&d.positionDropdown.apply(d,arguments)}),g.on("mousemove"+f,function(){d.ignoreHover=!1}),this.revertSettings={$children:b.children().detach(),tabindex:b.attr("tabindex")},b.attr("tabindex",-1).hide().after(d.$wrapper),e.isArray(h.items)&&(d.setValue(h.items),delete h.items),_&&b.on("invalid"+f,function(e){e.preventDefault(),d.isInvalid=!0,d.refreshState()}),d.updateOriginalInput(),d.refreshItems(),d.refreshState(),d.updatePlaceholder(),d.isSetup=!0,b.is(":disabled")&&d.disable(),d.on("change",this.onChange),b.data("selectize",d),b.addClass("selectized"),d.trigger("initialize"),!0===h.preload&&d.onSearchChange("")},setupTemplates:function(){var t=this,i=t.settings.labelField,n=t.settings.optgroupLabelField,o={optgroup:function(e){return'<div class="optgroup">'+e.html+"</div>"},optgroup_header:function(e,t){return'<div class="optgroup-header">'+t(e[n])+"</div>"},option:function(e,t){return'<div class="option">'+t(e[i])+"</div>"},item:function(e,t){return'<div class="item">'+t(e[i])+"</div>"},option_create:function(e,t){return'<div class="create">Add <strong>'+t(e.input)+"</strong>&hellip;</div>"}};t.settings.render=e.extend({},o,t.settings.render)},setupCallbacks:function(){var e,t,i={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(e in i)i.hasOwnProperty(e)&&(t=this.settings[i[e]],t&&this.on(e,t))},onClick:function(e){var t=this;t.isFocused||(t.focus(),e.preventDefault())},onMouseDown:function(t){var i=this,n=t.isDefaultPrevented();if(e(t.target),i.isFocused){if(t.target!==i.$control_input[0])return"single"===i.settings.mode?i.isOpen?i.close():i.open():n||i.setActiveItem(null),!1}else n||window.setTimeout(function(){i.focus()},0)},onChange:function(){this.$input.trigger("change")},onPaste:function(t){var i=this;return i.isFull()||i.isInputHidden||i.isLocked?void t.preventDefault():void(i.settings.splitOn&&setTimeout(function(){var t=i.$control_input.val();if(t.match(i.settings.splitOn))for(var n=e.trim(t).split(i.settings.splitOn),o=0,r=n.length;o<r;o++)i.createItem(n[o])},0))},onKeyPress:function(e){if(this.isLocked)return e&&e.preventDefault();var t=String.fromCharCode(e.keyCode||e.which);return this.settings.create&&"multi"===this.settings.mode&&t===this.settings.delimiter?(this.createItem(),e.preventDefault(),!1):void 0},onKeyDown:function(e){var t=(e.target,this.$control_input[0],this);if(!t.isLocked){switch(e.keyCode){case s:if(t.isCmdDown)return void t.selectAll();break;case l:return void(t.isOpen&&(e.preventDefault(),e.stopPropagation(),t.close()));case f:if(!e.ctrlKey||e.altKey)break;case h:if(!t.isOpen&&t.hasOptions)t.open();else if(t.$activeOption){t.ignoreHover=!0;var i=t.getAdjacentOption(t.$activeOption,1);i.length&&t.setActiveOption(i,!0,!0)}return void e.preventDefault();case u:if(!e.ctrlKey||e.altKey)break;case p:if(t.$activeOption){t.ignoreHover=!0;var n=t.getAdjacentOption(t.$activeOption,-1);n.length&&t.setActiveOption(n,!0,!0)}return void e.preventDefault();case a:return void(t.isOpen&&t.$activeOption&&(t.onOptionSelect({currentTarget:t.$activeOption}),e.preventDefault()));case c:return void t.advanceSelection(-1,e);case d:return void t.advanceSelection(1,e);case b:return t.settings.selectOnTab&&t.isOpen&&t.$activeOption&&(t.onOptionSelect({currentTarget:t.$activeOption}),t.isFull()||e.preventDefault()),void(t.settings.create&&t.createItem()&&e.preventDefault());case g:case v:return void t.deleteSelection(e)}return!t.isFull()&&!t.isInputHidden||(r?e.metaKey:e.ctrlKey)?void 0:void e.preventDefault()}e.keyCode!==b&&e.preventDefault()},onKeyUp:function(e){var t=this;if(t.isLocked)return e&&e.preventDefault();var i=t.$control_input.val()||"";t.lastValue!==i&&(t.lastValue=i,t.onSearchChange(i),t.refreshOptions(),t.trigger("type",i))},onSearchChange:function(e){var t=this,i=t.settings.load;i&&(t.loadedSearches.hasOwnProperty(e)||(t.loadedSearches[e]=!0,t.load(function(n){i.apply(t,[e,n])})))},onFocus:function(e){var t=this,i=t.isFocused;return t.isDisabled?(t.blur(),e&&e.preventDefault(),!1):void(t.ignoreFocus||(t.isFocused=!0,"focus"===t.settings.preload&&t.onSearchChange(""),i||t.trigger("focus"),t.$activeItems.length||(t.showInput(),t.setActiveItem(null),t.refreshOptions(!!t.settings.openOnFocus)),t.refreshState()))},onBlur:function(e,t){var i=this;if(i.isFocused&&(i.isFocused=!1,!i.ignoreFocus)){if(!i.ignoreBlur&&document.activeElement===i.$dropdown_content[0])return i.ignoreBlur=!0,void i.onFocus(e);var n=function(){i.close(),i.setTextboxValue(""),i.setActiveItem(null),i.setActiveOption(null),i.setCaret(i.items.length),i.refreshState(),t&&t.focus&&t.focus(),i.ignoreFocus=!1,i.trigger("blur")};i.ignoreFocus=!0,i.settings.create&&i.settings.createOnBlur?i.createItem(null,!1,n):n()}},onOptionHover:function(e){this.ignoreHover||this.setActiveOption(e.currentTarget,!1)},onOptionSelect:function(t){var i,n,o=this;t.preventDefault&&(t.preventDefault(),t.stopPropagation()),n=e(t.currentTarget),n.hasClass("create")?o.createItem(null,function(){o.settings.closeAfterSelect&&o.close()}):(i=n.attr("data-value"),void 0!==i&&(o.lastQuery=null,o.setTextboxValue(""),o.addItem(i),o.settings.closeAfterSelect?o.close():!o.settings.hideSelected&&t.type&&/mouse/.test(t.type)&&o.setActiveOption(o.getOption(i))))},onItemSelect:function(e){var t=this;t.isLocked||"multi"===t.settings.mode&&(e.preventDefault(),t.setActiveItem(e.currentTarget,e))},load:function(e){var t=this,i=t.$wrapper.addClass(t.settings.loadingClass);t.loading++,e.apply(t,[function(e){t.loading=Math.max(t.loading-1,0),e&&e.length&&(t.addOption(e),t.refreshOptions(t.isFocused&&!t.isInputHidden)),t.loading||i.removeClass(t.settings.loadingClass),t.trigger("load",e)}])},setTextboxValue:function(e){var t=this.$control_input,i=t.val()!==e;i&&(t.val(e).triggerHandler("update"),this.lastValue=e)},getValue:function(){return this.tagType===C&&this.$input.attr("multiple")?this.items:this.items.join(this.settings.delimiter)},setValue:function(e,t){var i=t?[]:["change"];P(this,i,function(){this.clear(t),this.addItems(e,t)})},setActiveItem:function(t,i){var n,o,r,s,a,l,c,p,u=this;if("single"!==u.settings.mode){if(t=e(t),!t.length)return e(u.$activeItems).removeClass("active"),u.$activeItems=[],void(u.isFocused&&u.showInput());if(n=i&&i.type.toLowerCase(),"mousedown"===n&&u.isShiftDown&&u.$activeItems.length){for(p=u.$control.children(".active:last"),s=Array.prototype.indexOf.apply(u.$control[0].childNodes,[p[0]]),a=Array.prototype.indexOf.apply(u.$control[0].childNodes,[t[0]]),s>a&&(c=s,s=a,a=c),o=s;o<=a;o++)l=u.$control[0].childNodes[o],-1===u.$activeItems.indexOf(l)&&(e(l).addClass("active"),u.$activeItems.push(l));i.preventDefault()}else"mousedown"===n&&u.isCtrlDown||"keydown"===n&&this.isShiftDown?t.hasClass("active")?(r=u.$activeItems.indexOf(t[0]),u.$activeItems.splice(r,1),t.removeClass("active")):u.$activeItems.push(t.addClass("active")[0]):(e(u.$activeItems).removeClass("active"),u.$activeItems=[t.addClass("active")[0]]);u.hideInput(),this.isFocused||u.focus()}},setActiveOption:function(t,i,n){var o,r,s,a,l,c=this;c.$activeOption&&c.$activeOption.removeClass("active"),c.$activeOption=null,t=e(t),t.length&&(c.$activeOption=t.addClass("active"),!i&&S(i)||(o=c.$dropdown_content.height(),r=c.$activeOption.outerHeight(!0),i=c.$dropdown_content.scrollTop()||0,s=c.$activeOption.offset().top-c.$dropdown_content.offset().top+i,a=s,l=s-o+r,s+r>o+i?c.$dropdown_content.stop().animate({scrollTop:l},n?c.settings.scrollDuration:0):s<i&&c.$dropdown_content.stop().animate({scrollTop:a},n?c.settings.scrollDuration:0)))},selectAll:function(){var e=this;"single"!==e.settings.mode&&(e.$activeItems=Array.prototype.slice.apply(e.$control.children(":not(input)").addClass("active")),e.$activeItems.length&&(e.hideInput(),e.close()),e.focus())},hideInput:function(){var e=this;e.setTextboxValue(""),e.$control_input.css({opacity:0,position:"absolute",left:e.rtl?1e4:-1e4}),e.isInputHidden=!0},showInput:function(){this.$control_input.css({opacity:1,position:"relative",left:0}),this.isInputHidden=!1},focus:function(){var e=this;e.isDisabled||(e.ignoreFocus=!0,e.$control_input[0].focus(),window.setTimeout(function(){e.ignoreFocus=!1,e.onFocus()},0))},blur:function(e){this.$control_input[0].blur(),this.onBlur(null,e)},getScoreFunction:function(e){return this.sifter.getScoreFunction(e,this.getSearchOptions())},getSearchOptions:function(){var e=this.settings,t=e.sortField;return"string"==typeof t&&(t=[{field:t}]),{fields:e.searchField,conjunction:e.searchConjunction,sort:t}},search:function(t){var i,n,o,r=this,s=r.settings,a=this.getSearchOptions();if(s.score&&(o=r.settings.score.apply(this,[t]),"function"!=typeof o))throw new Error('Selectize "score" setting must be a function that returns a function');if(t!==r.lastQuery?(r.lastQuery=t,n=r.sifter.search(t,e.extend(a,{score:o})),r.currentResults=n):n=e.extend(!0,{},r.currentResults),s.hideSelected)for(i=n.items.length-1;i>=0;i--)-1!==r.items.indexOf($(n.items[i].id))&&n.items.splice(i,1);return n},refreshOptions:function(t){var i,o,r,s,a,l,c,p,u,d,h,f,g,v,m,y;void 0===t&&(t=!0);var w=this,b=e.trim(w.$control_input.val()),C=w.search(b),O=w.$dropdown_content,_=w.$activeOption&&$(w.$activeOption.attr("data-value"));for(s=C.items.length,"number"==typeof w.settings.maxOptions&&(s=Math.min(s,w.settings.maxOptions)),a={},l=[],i=0;i<s;i++)for(c=w.options[C.items[i].id],p=w.render("option",c),u=c[w.settings.optgroupField]||"",d=e.isArray(u)?u:[u],o=0,r=d&&d.length;o<r;o++)u=d[o],w.optgroups.hasOwnProperty(u)||(u=""),a.hasOwnProperty(u)||(a[u]=document.createDocumentFragment(),l.push(u)),a[u].appendChild(p);for(this.settings.lockOptgroupOrder&&l.sort(function(e,t){var i=w.optgroups[e].$order||0,n=w.optgroups[t].$order||0;return i-n}),h=document.createDocumentFragment(),i=0,s=l.length;i<s;i++)u=l[i],w.optgroups.hasOwnProperty(u)&&a[u].childNodes.length?(f=document.createDocumentFragment(),f.appendChild(w.render("optgroup_header",w.optgroups[u])),f.appendChild(a[u]),h.appendChild(w.render("optgroup",e.extend({},w.optgroups[u],{html:q(f),dom:f})))):h.appendChild(a[u]);if(O.html(h),w.settings.highlight&&C.query.length&&C.tokens.length)for(O.removeHighlight(),i=0,s=C.tokens.length;i<s;i++)n(O,C.tokens[i].regex);if(!w.settings.hideSelected)for(i=0,s=w.items.length;i<s;i++)w.getOption(w.items[i]).addClass("selected");g=w.canCreate(b),g&&(O.prepend(w.render("option_create",{input:b})),y=e(O[0].childNodes[0])),w.hasOptions=C.items.length>0||g,w.hasOptions?(C.items.length>0?(m=_&&w.getOption(_),m&&m.length?v=m:"single"===w.settings.mode&&w.items.length&&(v=w.getOption(w.items[0])),v&&v.length||(v=y&&!w.settings.addPrecedence?w.getAdjacentOption(y,1):O.find("[data-selectable]:first"))):v=y,w.setActiveOption(v),t&&!w.isOpen&&w.open()):(w.setActiveOption(null),t&&w.isOpen&&w.close())},addOption:function(t){var i,n,o,r=this;if(e.isArray(t))for(i=0,n=t.length;i<n;i++)r.addOption(t[i]);else(o=r.registerOption(t))&&(r.userOptions[o]=!0,r.lastQuery=null,r.trigger("option_add",o,t))},registerOption:function(e){var t=$(e[this.settings.valueField]);return null!=t&&!this.options.hasOwnProperty(t)&&(e.$order=e.$order||++this.order,this.options[t]=e,t)},registerOptionGroup:function(e){var t=$(e[this.settings.optgroupValueField]);return!!t&&(e.$order=e.$order||++this.order,this.optgroups[t]=e,t)},addOptionGroup:function(e,t){t[this.settings.optgroupValueField]=e,(e=this.registerOptionGroup(t))&&this.trigger("optgroup_add",e,t)},removeOptionGroup:function(e){this.optgroups.hasOwnProperty(e)&&(delete this.optgroups[e],this.renderCache={},this.trigger("optgroup_remove",e))},clearOptionGroups:function(){this.optgroups={},this.renderCache={},this.trigger("optgroup_clear")},updateOption:function(t,i){var n,o,r,s,a,l,c,p=this;if(t=$(t),r=$(i[p.settings.valueField]),null!==t&&p.options.hasOwnProperty(t)){if("string"!=typeof r)throw new Error("Value must be set in option data");c=p.options[t].$order,r!==t&&(delete p.options[t],s=p.items.indexOf(t),-1!==s&&p.items.splice(s,1,r)),i.$order=i.$order||c,p.options[r]=i,a=p.renderCache.item,l=p.renderCache.option,a&&(delete a[t],delete a[r]),l&&(delete l[t],delete l[r]),-1!==p.items.indexOf(r)&&(n=p.getItem(t),o=e(p.render("item",i)),n.hasClass("active")&&o.addClass("active"),n.replaceWith(o)),p.lastQuery=null,p.isOpen&&p.refreshOptions(!1)}},removeOption:function(e,t){var i=this;e=$(e);var n=i.renderCache.item,o=i.renderCache.option;n&&delete n[e],o&&delete o[e],delete i.userOptions[e],delete i.options[e],i.lastQuery=null,i.trigger("option_remove",e),i.removeItem(e,t)},clearOptions:function(){var e=this;e.loadedSearches={},e.userOptions={},e.renderCache={},e.options=e.sifter.items={},e.lastQuery=null,e.trigger("option_clear"),e.clear()},getOption:function(e){return this.getElementWithValue(e,this.$dropdown_content.find("[data-selectable]"))},getAdjacentOption:function(t,i){var n=this.$dropdown.find("[data-selectable]"),o=n.index(t)+i;return o>=0&&o<n.length?n.eq(o):e()},getElementWithValue:function(t,i){if(t=$(t),null!=t)for(var n=0,o=i.length;n<o;n++)if(i[n].getAttribute("data-value")===t)return e(i[n]);return e()},getItem:function(e){return this.getElementWithValue(e,this.$control.children())},addItems:function(t,i){for(var n=e.isArray(t)?t:[t],o=0,r=n.length;o<r;o++)this.isPending=o<r-1,this.addItem(n[o],i)},addItem:function(t,i){var n=i?[]:["change"];P(this,n,function(){var n,o,r,s,a,l=this,c=l.settings.mode;return t=$(t),-1!==l.items.indexOf(t)?void("single"===c&&l.close()):void(l.options.hasOwnProperty(t)&&("single"===c&&l.clear(i),"multi"===c&&l.isFull()||(n=e(l.render("item",l.options[t])),a=l.isFull(),l.items.splice(l.caretPos,0,t),l.insertAtCaret(n),(!l.isPending||!a&&l.isFull())&&l.refreshState(),l.isSetup&&(r=l.$dropdown_content.find("[data-selectable]"),l.isPending||(o=l.getOption(t),s=l.getAdjacentOption(o,1).attr("data-value"),l.refreshOptions(l.isFocused&&"single"!==c),s&&l.setActiveOption(l.getOption(s))),!r.length||l.isFull()?l.close():l.positionDropdown(),l.updatePlaceholder(),l.trigger("item_add",t,n),l.updateOriginalInput({silent:i})))))})},removeItem:function(t,i){var n,o,r,s=this;n=t instanceof e?t:s.getItem(t),t=$(n.attr("data-value")),o=s.items.indexOf(t),-1!==o&&(n.remove(),n.hasClass("active")&&(r=s.$activeItems.indexOf(n[0]),s.$activeItems.splice(r,1)),s.items.splice(o,1),s.lastQuery=null,!s.settings.persist&&s.userOptions.hasOwnProperty(t)&&s.removeOption(t,i),o<s.caretPos&&s.setCaret(s.caretPos-1),s.refreshState(),s.updatePlaceholder(),s.updateOriginalInput({silent:i}),s.positionDropdown(),s.trigger("item_remove",t,n))},createItem:function(t,i){var n=this,o=n.caretPos;t=t||e.trim(n.$control_input.val()||"");var r=arguments[arguments.length-1];if("function"!=typeof r&&(r=function(){}),"boolean"!=typeof i&&(i=!0),!n.canCreate(t))return r(),!1;n.lock();var s="function"==typeof n.settings.create?this.settings.create:function(e){var t={};return t[n.settings.labelField]=e,t[n.settings.valueField]=e,t},a=k(function(e){if(n.unlock(),!e||"object"!=typeof e)return r();var t=$(e[n.settings.valueField]);return"string"!=typeof t?r():(n.setTextboxValue(""),n.addOption(e),n.setCaret(o),n.addItem(t),n.refreshOptions(i&&"single"!==n.settings.mode),void r(e))}),l=s.apply(this,[t,a]);return void 0!==l&&a(l),!0},refreshItems:function(){this.lastQuery=null,this.isSetup&&this.addItem(this.items),this.refreshState(),this.updateOriginalInput()},refreshState:function(){this.refreshValidityState(),this.refreshClasses()},refreshValidityState:function(){if(!this.isRequired)return!1;var e=!this.items.length;this.isInvalid=e,this.$control_input.prop("required",e),this.$input.prop("required",!e)},refreshClasses:function(){var t=this,i=t.isFull(),n=t.isLocked;t.$wrapper.toggleClass("rtl",t.rtl),t.$control.toggleClass("focus",t.isFocused).toggleClass("disabled",t.isDisabled).toggleClass("required",t.isRequired).toggleClass("invalid",t.isInvalid).toggleClass("locked",n).toggleClass("full",i).toggleClass("not-full",!i).toggleClass("input-active",t.isFocused&&!t.isInputHidden).toggleClass("dropdown-active",t.isOpen).toggleClass("has-options",!e.isEmptyObject(t.options)).toggleClass("has-items",t.items.length>0),t.$control_input.data("grow",!i&&!n)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(e){var t,i,n,o,r=this;if(e=e||{},r.tagType===C){for(n=[],t=0,i=r.items.length;t<i;t++)o=r.options[r.items[t]][r.settings.labelField]||"",n.push('<option value="'+T(r.items[t])+'" selected="selected">'+T(o)+"</option>");n.length||this.$input.attr("multiple")||n.push('<option value="" selected="selected"></option>'),r.$input.html(n.join(""))}else r.$input.val(r.getValue()),r.$input.attr("value",r.$input.val());r.isSetup&&(e.silent||r.trigger("change",r.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var e=this.$control_input;this.items.length?e.removeAttr("placeholder"):e.attr("placeholder",this.settings.placeholder),e.triggerHandler("update",{force:!0})}},open:function(){var e=this;e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.focus(),e.isOpen=!0,e.refreshState(),e.$dropdown.css({visibility:"hidden",display:"block"}),e.positionDropdown(),e.$dropdown.css({visibility:"visible"}),e.trigger("dropdown_open",e.$dropdown))},close:function(){var e=this,t=e.isOpen;"single"===e.settings.mode&&e.items.length&&(e.hideInput(),e.$control_input.blur()),e.isOpen=!1,e.$dropdown.hide(),e.setActiveOption(null),e.refreshState(),t&&e.trigger("dropdown_close",e.$dropdown)},positionDropdown:function(){var e=this.$control,t="body"===this.settings.dropdownParent?e.offset():e.position();t.top+=e.outerHeight(!0),this.$dropdown.css({width:e.outerWidth(),top:t.top,left:t.left})},clear:function(e){var t=this;t.items.length&&(t.$control.children(":not(input)").remove(),t.items=[],t.lastQuery=null,t.setCaret(0),t.setActiveItem(null),t.updatePlaceholder(),t.updateOriginalInput({silent:e}),t.refreshState(),t.showInput(),t.trigger("clear"))},insertAtCaret:function(t){var i=Math.min(this.caretPos,this.items.length);0===i?this.$control.prepend(t):e(this.$control[0].childNodes[i]).before(t),this.setCaret(i+1)},deleteSelection:function(t){var i,n,o,r,s,a,l,c,p,u=this;if(o=t&&t.keyCode===g?-1:1,r=D(u.$control_input[0]),u.$activeOption&&!u.settings.hideSelected&&(l=u.getAdjacentOption(u.$activeOption,-1).attr("data-value")),s=[],u.$activeItems.length){for(p=u.$control.children(".active:"+(o>0?"last":"first")),a=u.$control.children(":not(input)").index(p),o>0&&a++,i=0,n=u.$activeItems.length;i<n;i++)s.push(e(u.$activeItems[i]).attr("data-value"));t&&(t.preventDefault(),t.stopPropagation())}else(u.isFocused||"single"===u.settings.mode)&&u.items.length&&(o<0&&0===r.start&&0===r.length?s.push(u.items[u.caretPos-1]):o>0&&r.start===u.$control_input.val().length&&s.push(u.items[u.caretPos]));if(!s.length||"function"==typeof u.settings.onDelete&&!1===u.settings.onDelete.apply(u,[s]))return!1;for(void 0!==a&&u.setCaret(a);s.length;)u.removeItem(s.pop());return u.showInput(),u.positionDropdown(),u.refreshOptions(!0),l&&(c=u.getOption(l),c.length&&u.setActiveOption(c)),!0},advanceSelection:function(e,t){var i,n,o,r,s,a,l=this;0!==e&&(l.rtl&&(e*=-1),i=e>0?"last":"first",n=D(l.$control_input[0]),l.isFocused&&!l.isInputHidden?(r=l.$control_input.val().length,s=e<0?0===n.start&&0===n.length:n.start===r,s&&!r&&l.advanceCaret(e,t)):(a=l.$control.children(".active:"+i),a.length&&(o=l.$control.children(":not(input)").index(a),l.setActiveItem(null),l.setCaret(e>0?o+1:o))))},advanceCaret:function(e,t){var i,n,o=this;0!==e&&(i=e>0?"next":"prev",o.isShiftDown?(n=o.$control_input[i](),n.length&&(o.hideInput(),o.setActiveItem(n),t&&t.preventDefault())):o.setCaret(o.caretPos+e))},setCaret:function(t){var i,n,o,r,s=this;if(t="single"===s.settings.mode?s.items.length:Math.max(0,Math.min(s.items.length,t)),!s.isPending)for(o=s.$control.children(":not(input)"),i=0,n=o.length;i<n;i++)r=e(o[i]).detach(),i<t?s.$control_input.before(r):s.$control.append(r);s.caretPos=t},lock:function(){this.close(),this.isLocked=!0,this.refreshState()},unlock:function(){this.isLocked=!1,this.refreshState()},disable:function(){var e=this;e.$input.prop("disabled",!0),e.$control_input.prop("disabled",!0).prop("tabindex",-1),e.isDisabled=!0,e.lock()},enable:function(){var e=this;e.$input.prop("disabled",!1),e.$control_input.prop("disabled",!1).prop("tabindex",e.tabIndex),e.isDisabled=!1,e.unlock()},destroy:function(){var t=this,i=t.eventNS,n=t.revertSettings;t.trigger("destroy"),t.off(),t.$wrapper.remove(),t.$dropdown.remove(),t.$input.html("").append(n.$children).removeAttr("tabindex").removeClass("selectized").attr({tabindex:n.tabindex}).show(),t.$control_input.removeData("grow"),t.$input.removeData("selectize"),e(window).off(i),e(document).off(i),e(document.body).off(i),delete t.$input[0].selectize},render:function(t,i){var n,o,r="",s=!1,a=this;return"option"!==t&&"item"!==t||(n=$(i[a.settings.valueField]),s=!!n),s&&(S(a.renderCache[t])||(a.renderCache[t]={}),a.renderCache[t].hasOwnProperty(n))?a.renderCache[t][n]:(r=e(a.settings.render[t].apply(this,[i,T])),"option"===t||"option_create"===t?r.attr("data-selectable",""):"optgroup"===t&&(o=i[a.settings.optgroupValueField]||"",r.attr("data-group",o)),"option"!==t&&"item"!==t||r.attr("data-value",n||""),s&&(a.renderCache[t][n]=r[0]),r[0])},clearCache:function(e){var t=this;void 0===e?t.renderCache={}:delete t.renderCache[e]},canCreate:function(e){var t=this;if(!t.settings.create)return!1;var i=t.settings.createFilter;return e.length&&("function"!=typeof i||i.apply(t,[e]))&&("string"!=typeof i||new RegExp(i).test(e))&&(!(i instanceof RegExp)||i.test(e))}}),N.count=0,N.defaults={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:!1,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:1e3,maxItems:null,hideSelected:null,addPrecedence:!1,selectOnTab:!1,preload:!1,allowEmptyOption:!1,closeAfterSelect:!1,scrollDuration:60,loadThrottle:300,loadingClass:"loading",dataAttr:"data-data",optgroupField:"optgroup",valueField:"value",labelField:"text",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"selectize-control",inputClass:"selectize-input",dropdownClass:"selectize-dropdown",dropdownContentClass:"selectize-dropdown-content",dropdownParent:null,copyClassesToDropdown:!0,render:{}},e.fn.selectize=function(t){var i=e.fn.selectize.defaults,n=e.extend({},i,t),o=n.dataAttr,r=n.labelField,s=n.valueField,a=n.optgroupField,l=n.optgroupLabelField,c=n.optgroupValueField,p=function(t,i){var a,l,c,p,u=t.attr(o);if(u)for(i.options=JSON.parse(u),a=0,l=i.options.length;a<l;a++)i.items.push(i.options[a][s]);else{var d=e.trim(t.val()||"");if(!n.allowEmptyOption&&!d.length)return;for(c=d.split(n.delimiter),a=0,l=c.length;a<l;a++)p={},p[r]=c[a],p[s]=c[a],i.options.push(p);i.items=c}},u=function(t,i){var p,u,d,h,f=i.options,g={},v=function(e){var t=o&&e.attr(o);return"string"==typeof t&&t.length?JSON.parse(t):null},m=function(t,o){t=e(t);var l=$(t.val());if(l||n.allowEmptyOption)if(g.hasOwnProperty(l)){if(o){var c=g[l][a];c?e.isArray(c)?c.push(o):g[l][a]=[c,o]:g[l][a]=o}}else{var p=v(t)||{};p[r]=p[r]||t.text(),p[s]=p[s]||l,p[a]=p[a]||o,g[l]=p,f.push(p),t.is(":selected")&&i.items.push(l)}},y=function(t){var n,o,r,s,a;for(t=e(t),r=t.attr("label"),r&&(s=v(t)||{},s[l]=r,s[c]=r,i.optgroups.push(s)),a=e("option",t),n=0,o=a.length;n<o;n++)m(a[n],r)};for(i.maxItems=t.attr("multiple")?null:1,h=t.children(),p=0,u=h.length;p<u;p++)d=h[p].tagName.toLowerCase(),"optgroup"===d?y(h[p]):"option"===d&&m(h[p])};return this.each(function(){if(!this.selectize){var o=e(this),r=this.tagName.toLowerCase(),s=o.attr("placeholder")||o.attr("data-placeholder");s||n.allowEmptyOption||(s=o.children('option[value=""]').text());var a={placeholder:s,options:[],optgroups:[],items:[]};"select"===r?u(o,a):p(o,a),new N(o,e.extend(!0,{},i,a,t))}})},e.fn.selectize.defaults=N.defaults,e.fn.selectize.support={validity:_},N.define("drag_drop",function(t){if(!e.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if("multi"===this.settings.mode){var i=this;i.lock=function(){var e=i.lock;return function(){var t=i.$control.data("sortable");return t&&t.disable(),e.apply(i,arguments)}}(),i.unlock=function(){var e=i.unlock;return function(){var t=i.$control.data("sortable");return t&&t.enable(),e.apply(i,arguments)}}(),i.setup=function(){var t=i.setup;return function(){t.apply(this,arguments);var n=i.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:i.isLocked,start:function(e,t){t.placeholder.css("width",t.helper.css("width")),n.css({overflow:"visible"})},stop:function(){n.css({overflow:"hidden"});var t=i.$activeItems?i.$activeItems.slice():null,o=[];n.children("[data-value]").each(function(){o.push(e(this).attr("data-value"))}),i.setValue(o),i.setActiveItem(t)}})}}()}}),N.define("dropdown_header",function(t){var i,n=this;t=e.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(e){return'<div class="'+e.headerClass+'"><div class="'+e.titleRowClass+'"><span class="'+e.labelClass+'">'+e.title+'</span><a href="javascript:void(0)" class="'+e.closeClass+'">&times;</a></div></div>'}},t),n.setup=(i=n.setup,function(){i.apply(n,arguments),n.$dropdown_header=e(t.html(t)),n.$dropdown.prepend(n.$dropdown_header)})}),N.define("optgroup_columns",function(t){var i=this;t=e.extend({equalizeWidth:!0,equalizeHeight:!0},t),this.getAdjacentOption=function(t,i){var n=t.closest("[data-group]").find("[data-selectable]"),o=n.index(t)+i;return o>=0&&o<n.length?n.eq(o):e()},this.onKeyDown=function(){var e=i.onKeyDown;return function(t){var n,o,r,s;return!this.isOpen||t.keyCode!==c&&t.keyCode!==d?e.apply(this,arguments):(i.ignoreHover=!0,s=this.$activeOption.closest("[data-group]"),n=s.find("[data-selectable]").index(this.$activeOption),s=t.keyCode===c?s.prev("[data-group]"):s.next("[data-group]"),r=s.find("[data-selectable]"),o=r.eq(Math.min(r.length-1,n)),void(o.length&&this.setActiveOption(o)))}}();var n=function(){var e,t=n.width,i=document;return void 0===t&&(e=i.createElement("div"),e.innerHTML='<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>',e=e.firstChild,i.body.appendChild(e),t=n.width=e.offsetWidth-e.clientWidth,i.body.removeChild(e)),t},o=function(){var o,r,s,a,l,c,p;if(p=e("[data-group]",i.$dropdown_content),r=p.length,r&&i.$dropdown_content.width()){if(t.equalizeHeight){for(s=0,o=0;o<r;o++)s=Math.max(s,p.eq(o).height());p.css({height:s})}t.equalizeWidth&&(c=i.$dropdown_content.innerWidth()-n(),a=Math.round(c/r),p.css({width:a}),r>1&&(l=c-a*(r-1),p.eq(r-1).css({width:l})))}};(t.equalizeHeight||t.equalizeWidth)&&(I.after(this,"positionDropdown",o),I.after(this,"refreshOptions",o))}),N.define("remove_button",function(t){t=e.extend({label:"&times;",title:"Remove",className:"remove",append:!0},t);var i=function(t,i){i.className="remove-single";var n,o=t,r='<a href="javascript:void(0)" class="'+i.className+'" tabindex="-1" title="'+T(i.title)+'">'+i.label+"</a>",s=function(e,t){return e+t};t.setup=(n=o.setup,function(){if(i.append){var a=e(o.$input.context).attr("id"),l=(e("#"+a),o.settings.render.item);o.settings.render.item=function(e){return s(l.apply(t,arguments),r)}}n.apply(t,arguments),t.$control.on("click","."+i.className,function(e){e.preventDefault(),o.isLocked||o.clear()})})},n=function(t,i){var n,o=t,r='<a href="javascript:void(0)" class="'+i.className+'" tabindex="-1" title="'+T(i.title)+'">'+i.label+"</a>",s=function(e,t){var i=e.search(/(<\/[^>]+>\s*)$/);return e.substring(0,i)+t+e.substring(i)};t.setup=(n=o.setup,function(){if(i.append){var a=o.settings.render.item;o.settings.render.item=function(e){return s(a.apply(t,arguments),r)}}n.apply(t,arguments),t.$control.on("click","."+i.className,function(t){if(t.preventDefault(),!o.isLocked){var i=e(t.currentTarget).parent();o.setActiveItem(i),o.deleteSelection()&&o.setCaret(o.items.length)}})})};return"single"===this.settings.mode?void i(this,t):void n(this,t)}),N.define("restore_on_backspace",function(e){var t,i=this;e.text=e.text||function(e){return e[this.settings.labelField]},this.onKeyDown=(t=i.onKeyDown,function(i){var n,o;return i.keyCode===g&&""===this.$control_input.val()&&!this.$activeItems.length&&(n=this.caretPos-1,n>=0&&n<this.items.length)?(o=this.options[this.items[n]],this.deleteSelection(i)&&(this.setTextboxValue(e.text.apply(this,[o])),this.refreshOptions(!0)),void i.preventDefault()):t.apply(this,arguments)})}),N}),function(e){e.fn.hoverIntent=function(t,i,n){var o,r,s,a,l={interval:100,sensitivity:7,timeout:0};l="object"==typeof t?e.extend(l,t):e.isFunction(i)?e.extend(l,{over:t,out:i,selector:n}):e.extend(l,{over:t,out:t,selector:i});var c=function(e){o=e.pageX,r=e.pageY},p=function(t,i){if(i.hoverIntent_t=clearTimeout(i.hoverIntent_t),Math.abs(s-o)+Math.abs(a-r)<l.sensitivity)return e(i).off("mousemove.hoverIntent",c),i.hoverIntent_s=1,l.over.apply(i,[t]);s=o,a=r,i.hoverIntent_t=setTimeout(function(){p(t,i)},l.interval)},u=function(e,t){return t.hoverIntent_t=clearTimeout(t.hoverIntent_t),t.hoverIntent_s=0,l.out.apply(t,[e])},d=function(t){var i=jQuery.extend({},t),n=this;n.hoverIntent_t&&(n.hoverIntent_t=clearTimeout(n.hoverIntent_t)),"mouseenter"==t.type?(s=i.pageX,a=i.pageY,e(n).on("mousemove.hoverIntent",c),1!=n.hoverIntent_s&&(n.hoverIntent_t=setTimeout(function(){p(i,n)},l.interval))):(e(n).off("mousemove.hoverIntent",c),1==n.hoverIntent_s&&(n.hoverIntent_t=setTimeout(function(){u(i,n)},l.timeout)))};return this.on({"mouseenter.hoverIntent":d,"mouseleave.hoverIntent":d},l.selector)}}(jQuery),function(e,t){"use strict";var i,n,o,r,s,a,l,c,p,u,d,h,f,g,v,m,y=(n={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",menuArrowClass:"sf-arrows"},o=function(){
var t=/^(?![\w\W]*Windows Phone)[\w\W]*(iPhone|iPad|iPod)/i.test(navigator.userAgent);return t&&e("html").css("cursor","pointer").on("click",e.noop),t}(),i=document.documentElement.style,r="behavior"in i&&"fill"in i&&/iemobile/i.test(navigator.userAgent),s=!!t.PointerEvent,a=function(e,t,i){var o,r=n.menuClass;t.cssArrows&&(r+=" "+n.menuArrowClass),o=i?"addClass":"removeClass",e[o](r)},l=function(t,i){return t.find("li."+i.pathClass).slice(0,i.pathLevels).addClass(i.hoverClass+" "+n.bcClass).filter(function(){return e(this).children(i.popUpSelector).hide().show().length}).removeClass(i.pathClass)},c=function(e,t){var i=t?"addClass":"removeClass";e.children("a")[i](n.anchorClass)},p=function(e){var t=e.css("ms-touch-action"),i=e.css("touch-action");i=i||t,i="pan-y"===i?"auto":"pan-y",e.css({"ms-touch-action":i,"touch-action":i})},u=function(e){return e.closest("."+n.menuClass)},d=function(e){return u(e).data("sfOptions")},h=function(){var t=e(this),i=d(t);clearTimeout(i.sfTimer),t.siblings().superfish("hide").end().superfish("show")},f=function(t){t.retainPath=e.inArray(this[0],t.$path)>-1,this.superfish("hide"),this.parents("."+t.hoverClass).length||(t.onIdle.call(u(this)),t.$path.length&&e.proxy(h,t.$path)())},g=function(){var t=e(this),i=d(t);o?e.proxy(f,t,i)():(clearTimeout(i.sfTimer),i.sfTimer=setTimeout(e.proxy(f,t,i),i.delay))},v=function(t){var i=e(this),n=d(i),o=i.siblings(t.data.popUpSelector);if(!1===n.onHandleTouch.call(o))return this;o.length>0&&o.is(":hidden")&&(i.one("click.superfish",!1),"MSPointerDown"===t.type||"pointerdown"===t.type?i.trigger("focus"):e.proxy(h,i.parent("li"))())},m=function(t,i){var n="li:has("+i.popUpSelector+")";e.fn.hoverIntent&&!i.disableHI?t.hoverIntent(h,g,n):t.on("mouseenter.superfish",n,h).on("mouseleave.superfish",n,g);var a="MSPointerDown.superfish";s&&(a="pointerdown.superfish"),o||(a+=" touchend.superfish"),r&&(a+=" mousedown.superfish"),t.on("focusin.superfish","li",h).on("focusout.superfish","li",g).on(a,"a",i,v)},{hide:function(t){if(this.length){var i=this,n=d(i);if(!n)return this;var o=!0===n.retainPath?n.$path:"",r=i.find("li."+n.hoverClass).add(this).not(o).removeClass(n.hoverClass).children(n.popUpSelector),s=n.speedOut;if(t&&(r.show(),s=0),n.retainPath=!1,!1===n.onBeforeHide.call(r))return this;r.stop(!0,!0).animate(n.animationOut,s,function(){var t=e(this);n.onHide.call(t)})}return this},show:function(){var e=d(this);if(!e)return this;var t=this.addClass(e.hoverClass),i=t.children(e.popUpSelector);return!1===e.onBeforeShow.call(i)?this:(i.stop(!0,!0).animate(e.animation,e.speed,function(){e.onShow.call(i)}),this)},destroy:function(){return this.each(function(){var t,i=e(this),o=i.data("sfOptions");if(!o)return!1;t=i.find(o.popUpSelector).parent("li"),clearTimeout(o.sfTimer),a(i,o),c(t),p(i),i.off(".superfish").off(".hoverIntent"),t.children(o.popUpSelector).attr("style",function(e,t){if(void 0!==t)return t.replace(/display[^;]+;?/g,"")}),o.$path.removeClass(o.hoverClass+" "+n.bcClass).addClass(o.pathClass),i.find("."+o.hoverClass).removeClass(o.hoverClass),o.onDestroy.call(i),i.removeData("sfOptions")})},init:function(t){return this.each(function(){var i=e(this);if(i.data("sfOptions"))return!1;var o=e.extend({},e.fn.superfish.defaults,t),r=i.find(o.popUpSelector).parent("li");o.$path=l(i,o),i.data("sfOptions",o),a(i,o,!0),c(r,!0),p(i),m(i,o),r.not("."+n.bcClass).superfish("hide",!0),o.onInit.call(this)})}});e.fn.superfish=function(t,i){return y[t]?y[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?e.error("Method "+t+" does not exist on jQuery.fn.superfish"):y.init.apply(this,arguments)},e.fn.superfish.defaults={popUpSelector:"ul,.sf-mega",hoverClass:"sfHover",pathClass:"overrideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},animationOut:{opacity:"hide"},speed:"normal",speedOut:"fast",cssArrows:!0,disableHI:!1,onInit:e.noop,onBeforeShow:e.noop,onShow:e.noop,onBeforeHide:e.noop,onHide:e.noop,onIdle:e.noop,onDestroy:e.noop,onHandleTouch:e.noop}}(jQuery,window);