Choices/public/assets/scripts/choices.min.js
Konstantin Vyatkin bef6743c3b set window target for minified build (#685)
* set `globalObject` option

* commit builded assets

* set window target for minified build
2019-10-24 18:21:40 +01:00

16 lines
73 KiB
JavaScript

/*! choices.js v7.1.5 | © 2019 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
window.Choices=function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/public/assets/scripts/",i(i.s=5)}([function(e,t,i){var n;
/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var i={}.hasOwnProperty;function s(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n)&&n.length){var r=s.apply(null,n);r&&e.push(r)}else if("object"===o)for(var a in n)i.call(n,a)&&n[a]&&e.push(a)}}return e.join(" ")}e.exports?(s.default=s,e.exports=s):void 0===(n=function(){return s}.apply(t,[]))||(e.exports=n)}()},function(e,t,i){"use strict";var n=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===s}(e)}(e)};var s="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?c((i=e,Array.isArray(i)?[]:{}),e,t):e;var i}function r(e,t,i){return e.concat(t).map((function(e){return o(e,i)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function l(e,t,i){var n={};return i.isMergeableObject(e)&&a(e).forEach((function(t){n[t]=o(e[t],i)})),a(t).forEach((function(s){(function(e,t){try{return t in e&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}catch(e){return!1}})(e,s)||(i.isMergeableObject(t[s])&&e[s]?n[s]=function(e,t){if(!t.customMerge)return c;var i=t.customMerge(e);return"function"==typeof i?i:c}(s,i)(e[s],t[s],i):n[s]=o(t[s],i))})),n}function c(e,t,i){(i=i||{}).arrayMerge=i.arrayMerge||r,i.isMergeableObject=i.isMergeableObject||n,i.cloneUnlessOtherwiseSpecified=o;var s=Array.isArray(t);return s===Array.isArray(e)?s?i.arrayMerge(e,t,i):l(e,t,i):o(t,i)}c.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,i){return c(e,i,t)}),{})};var h=c;e.exports=h},function(e,t,i){"use strict";(function(e,n){var s,o=i(4);s="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:n;var r=Object(o.a)(s);t.a=r}).call(this,i(7),i(8)(e))},function(e,t,i){
/*!
* Fuse.js v3.4.5 - Lightweight fuzzy-search (http://fusejs.io)
*
* Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)
* All Rights Reserved. Apache Software License 2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
e.exports=function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=1)}([function(e,t){e.exports=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,i){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(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)}}var o=i(2),r=i(8),a=i(0),l=function(){function e(t,i){var n=i.location,s=void 0===n?0:n,o=i.distance,a=void 0===o?100:o,l=i.threshold,c=void 0===l?.6:l,h=i.maxPatternLength,u=void 0===h?32:h,d=i.caseSensitive,p=void 0!==d&&d,f=i.tokenSeparator,m=void 0===f?/ +/g:f,v=i.findAllMatches,g=void 0!==v&&v,_=i.minMatchCharLength,b=void 0===_?1:_,y=i.id,E=void 0===y?null:y,S=i.keys,I=void 0===S?[]:S,w=i.shouldSort,O=void 0===w||w,C=i.getFn,A=void 0===C?r:C,x=i.sortFn,T=void 0===x?function(e,t){return e.score-t.score}:x,L=i.tokenize,k=void 0!==L&&L,D=i.matchAllTokens,P=void 0!==D&&D,F=i.includeMatches,M=void 0!==F&&F,N=i.includeScore,j=void 0!==N&&N,K=i.verbose,R=void 0!==K&&K;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options={location:s,distance:a,threshold:c,maxPatternLength:u,isCaseSensitive:p,tokenSeparator:m,findAllMatches:g,minMatchCharLength:b,id:E,keys:I,includeMatches:M,includeScore:j,shouldSort:O,getFn:A,sortFn:T,verbose:R,tokenize:k,matchAllTokens:P},this.setCollection(t)}var t,i;return t=e,(i=[{key:"setCollection",value:function(e){return this.list=e,e}},{key:"search",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:!1};this._log('---------\nSearch pattern: "'.concat(e,'"'));var i=this._prepareSearchers(e),n=i.tokenSearchers,s=i.fullSearcher,o=this._search(n,s),r=o.weights,a=o.results;return this._computeScore(r,a),this.options.shouldSort&&this._sort(a),t.limit&&"number"==typeof t.limit&&(a=a.slice(0,t.limit)),this._format(a)}},{key:"_prepareSearchers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var i=e.split(this.options.tokenSeparator),n=0,s=i.length;n<s;n+=1)t.push(new o(i[n],this.options));return{tokenSearchers:t,fullSearcher:new o(e,this.options)}}},{key:"_search",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,i=this.list,n={},s=[];if("string"==typeof i[0]){for(var o=0,r=i.length;o<r;o+=1)this._analyze({key:"",value:i[o],record:o,index:o},{resultMap:n,results:s,tokenSearchers:e,fullSearcher:t});return{weights:null,results:s}}for(var a={},l=0,c=i.length;l<c;l+=1)for(var h=i[l],u=0,d=this.options.keys.length;u<d;u+=1){var p=this.options.keys[u];if("string"!=typeof p){if(a[p.name]={weight:1-p.weight||1},p.weight<=0||p.weight>1)throw new Error("Key weight has to be > 0 and <= 1");p=p.name}else a[p]={weight:1};this._analyze({key:p,value:this.options.getFn(h,p),record:h,index:l},{resultMap:n,results:s,tokenSearchers:e,fullSearcher:t})}return{weights:a,results:s}}},{key:"_analyze",value:function(e,t){var i=e.key,n=e.arrayIndex,s=void 0===n?-1:n,o=e.value,r=e.record,l=e.index,c=t.tokenSearchers,h=void 0===c?[]:c,u=t.fullSearcher,d=void 0===u?[]:u,p=t.resultMap,f=void 0===p?{}:p,m=t.results,v=void 0===m?[]:m;if(null!=o){var g=!1,_=-1,b=0;if("string"==typeof o){this._log("\nKey: ".concat(""===i?"-":i));var y=d.search(o);if(this._log('Full text: "'.concat(o,'", score: ').concat(y.score)),this.options.tokenize){for(var E=o.split(this.options.tokenSeparator),S=[],I=0;I<h.length;I+=1){var w=h[I];this._log('\nPattern: "'.concat(w.pattern,'"'));for(var O=!1,C=0;C<E.length;C+=1){var A=E[C],x=w.search(A),T={};x.isMatch?(T[A]=x.score,g=!0,O=!0,S.push(x.score)):(T[A]=1,this.options.matchAllTokens||S.push(1)),this._log('Token: "'.concat(A,'", score: ').concat(T[A]))}O&&(b+=1)}_=S[0];for(var L=S.length,k=1;k<L;k+=1)_+=S[k];_/=L,this._log("Token score average:",_)}var D=y.score;_>-1&&(D=(D+_)/2),this._log("Score average:",D);var P=!this.options.tokenize||!this.options.matchAllTokens||b>=h.length;if(this._log("\nCheck Matches: ".concat(P)),(g||y.isMatch)&&P){var F=f[l];F?F.output.push({key:i,arrayIndex:s,value:o,score:D,matchedIndices:y.matchedIndices}):(f[l]={item:r,output:[{key:i,arrayIndex:s,value:o,score:D,matchedIndices:y.matchedIndices}]},v.push(f[l]))}}else if(a(o))for(var M=0,N=o.length;M<N;M+=1)this._analyze({key:i,arrayIndex:M,value:o[M],record:r,index:l},{resultMap:f,results:v,tokenSearchers:h,fullSearcher:d})}}},{key:"_computeScore",value:function(e,t){this._log("\n\nComputing score:\n");for(var i=0,n=t.length;i<n;i+=1){for(var s=t[i].output,o=s.length,r=1,a=1,l=0;l<o;l+=1){var c=e?e[s[l].key].weight:1,h=(1===c?s[l].score:s[l].score||.001)*c;1!==c?a=Math.min(a,h):(s[l].nScore=h,r*=h)}t[i].score=1===a?r:a,this._log(t[i])}}},{key:"_sort",value:function(e){this._log("\n\nSorting...."),e.sort(this.options.sortFn)}},{key:"_format",value:function(e){var t=[];if(this.options.verbose){var i=[];this._log("\n\nOutput:\n\n",JSON.stringify(e,(function(e,t){if("object"===n(t)&&null!==t){if(-1!==i.indexOf(t))return;i.push(t)}return t}))),i=null}var s=[];this.options.includeMatches&&s.push((function(e,t){var i=e.output;t.matches=[];for(var n=0,s=i.length;n<s;n+=1){var o=i[n];if(0!==o.matchedIndices.length){var r={indices:o.matchedIndices,value:o.value};o.key&&(r.key=o.key),o.hasOwnProperty("arrayIndex")&&o.arrayIndex>-1&&(r.arrayIndex=o.arrayIndex),t.matches.push(r)}}})),this.options.includeScore&&s.push((function(e,t){t.score=e.score}));for(var o=0,r=e.length;o<r;o+=1){var a=e[o];if(this.options.id&&(a.item=this.options.getFn(a.item,this.options.id)[0]),s.length){for(var l={item:a.item},c=0,h=s.length;c<h;c+=1)s[c](a,l);t.push(l)}else t.push(a.item)}return t}},{key:"_log",value:function(){var e;this.options.verbose&&(e=console).log.apply(e,arguments)}}])&&s(t.prototype,i),e}();e.exports=l},function(e,t,i){function n(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)}}var s=i(3),o=i(4),r=i(7),a=function(){function e(t,i){var n=i.location,s=void 0===n?0:n,o=i.distance,a=void 0===o?100:o,l=i.threshold,c=void 0===l?.6:l,h=i.maxPatternLength,u=void 0===h?32:h,d=i.isCaseSensitive,p=void 0!==d&&d,f=i.tokenSeparator,m=void 0===f?/ +/g:f,v=i.findAllMatches,g=void 0!==v&&v,_=i.minMatchCharLength,b=void 0===_?1:_;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options={location:s,distance:a,threshold:c,maxPatternLength:u,isCaseSensitive:p,tokenSeparator:m,findAllMatches:g,minMatchCharLength:b},this.pattern=this.options.isCaseSensitive?t:t.toLowerCase(),this.pattern.length<=u&&(this.patternAlphabet=r(this.pattern))}var t,i;return t=e,(i=[{key:"search",value:function(e){if(this.options.isCaseSensitive||(e=e.toLowerCase()),this.pattern===e)return{isMatch:!0,score:0,matchedIndices:[[0,e.length-1]]};var t=this.options,i=t.maxPatternLength,n=t.tokenSeparator;if(this.pattern.length>i)return s(e,this.pattern,n);var r=this.options,a=r.location,l=r.distance,c=r.threshold,h=r.findAllMatches,u=r.minMatchCharLength;return o(e,this.pattern,this.patternAlphabet,{location:a,distance:l,threshold:c,findAllMatches:h,minMatchCharLength:u})}}])&&n(t.prototype,i),e}();e.exports=a},function(e,t){var i=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/ +/g,s=new RegExp(t.replace(i,"\\$&").replace(n,"|")),o=e.match(s),r=!!o,a=[];if(r)for(var l=0,c=o.length;l<c;l+=1){var h=o[l];a.push([e.indexOf(h),h.length-1])}return{score:r?.5:1,isMatch:r,matchedIndices:a}}},function(e,t,i){var n=i(5),s=i(6);e.exports=function(e,t,i,o){for(var r=o.location,a=void 0===r?0:r,l=o.distance,c=void 0===l?100:l,h=o.threshold,u=void 0===h?.6:h,d=o.findAllMatches,p=void 0!==d&&d,f=o.minMatchCharLength,m=void 0===f?1:f,v=a,g=e.length,_=u,b=e.indexOf(t,v),y=t.length,E=[],S=0;S<g;S+=1)E[S]=0;if(-1!==b){var I=n(t,{errors:0,currentLocation:b,expectedLocation:v,distance:c});if(_=Math.min(I,_),-1!==(b=e.lastIndexOf(t,v+y))){var w=n(t,{errors:0,currentLocation:b,expectedLocation:v,distance:c});_=Math.min(w,_)}}b=-1;for(var O=[],C=1,A=y+g,x=1<<y-1,T=0;T<y;T+=1){for(var L=0,k=A;L<k;)n(t,{errors:T,currentLocation:v+k,expectedLocation:v,distance:c})<=_?L=k:A=k,k=Math.floor((A-L)/2+L);A=k;var D=Math.max(1,v-k+1),P=p?g:Math.min(v+k,g)+y,F=Array(P+2);F[P+1]=(1<<T)-1;for(var M=P;M>=D;M-=1){var N=M-1,j=i[e.charAt(N)];if(j&&(E[N]=1),F[M]=(F[M+1]<<1|1)&j,0!==T&&(F[M]|=(O[M+1]|O[M])<<1|1|O[M+1]),F[M]&x&&(C=n(t,{errors:T,currentLocation:N,expectedLocation:v,distance:c}))<=_){if(_=C,(b=N)<=v)break;D=Math.max(1,2*v-b)}}if(n(t,{errors:T+1,currentLocation:v,expectedLocation:v,distance:c})>_)break;O=F}return{isMatch:b>=0,score:0===C?.001:C,matchedIndices:s(E,m)}}},function(e,t){e.exports=function(e,t){var i=t.errors,n=void 0===i?0:i,s=t.currentLocation,o=void 0===s?0:s,r=t.expectedLocation,a=void 0===r?0:r,l=t.distance,c=void 0===l?100:l,h=n/e.length,u=Math.abs(a-o);return c?h+u/c:u?1:h}},function(e,t){e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=[],n=-1,s=-1,o=0,r=e.length;o<r;o+=1){var a=e[o];a&&-1===n?n=o:a||-1===n||((s=o-1)-n+1>=t&&i.push([n,s]),n=-1)}return e[o-1]&&o-n>=t&&i.push([n,o-1]),i}},function(e,t){e.exports=function(e){for(var t={},i=e.length,n=0;n<i;n+=1)t[e.charAt(n)]=0;for(var s=0;s<i;s+=1)t[e.charAt(s)]|=1<<i-s-1;return t}},function(e,t,i){var n=i(0);e.exports=function(e,t){return function e(t,i,s){if(i){var o=i.indexOf("."),r=i,a=null;-1!==o&&(r=i.slice(0,o),a=i.slice(o+1));var l=t[r];if(null!=l)if(a||"string"!=typeof l&&"number"!=typeof l)if(n(l))for(var c=0,h=l.length;c<h;c+=1)e(l[c],a,s);else a&&e(l,a,s);else s.push(l.toString())}else s.push(t);return s}(e,t,[])}}])},function(e,t,i){"use strict";function n(e){var t,i=e.Symbol;return"function"==typeof i?i.observable?t=i.observable:(t=i("observable"),i.observable=t):t="@@observable",t}i.d(t,"a",(function(){return n}))},function(e,t,i){e.exports=i(9)},function(e,t){window.delegateEvent=function(){var e,t;function i(t){var i=e.get(t.type);i&&i.forEach((function(e){return e(t)}))}return void 0===e&&(e=new Map),void 0===t&&(t=[]),{add:function(n,s){e.has(n)?e.get(n).push(s):e.set(n,[s]),-1===t.indexOf(n)&&(document.documentElement.addEventListener(n,i,!0),t.push(n))},remove:function(i,n){e.get(i)&&(e.set(i,e.get(i).filter((function(e){return e!==n}))),e.get(i).length||t.splice(t.indexOf(i),1))}}}()},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,i){"use strict";i.r(t);var n=i(3),s=i.n(n),o=i(1),r=i.n(o),a=(i(6),i(2)),l=function(){return Math.random().toString(36).substring(7).split("").join(".")},c={INIT:"@@redux/INIT"+l(),REPLACE:"@@redux/REPLACE"+l(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+l()}};function h(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function u(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error("Expected the enhancer to be a function.");return i(u)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var s=e,o=t,r=[],l=r,d=!1;function p(){l===r&&(l=r.slice())}function f(){if(d)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return o}function m(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(d)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var t=!0;return p(),l.push(e),function(){if(t){if(d)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");t=!1,p();var i=l.indexOf(e);l.splice(i,1)}}}function v(e){if(!h(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(d)throw new Error("Reducers may not dispatch actions.");try{d=!0,o=s(o,e)}finally{d=!1}for(var t=r=l,i=0;i<t.length;i++){(0,t[i])()}return e}return v({type:c.INIT}),(n={dispatch:v,subscribe:m,getState:f,replaceReducer:function(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");s=e,v({type:c.REPLACE})}})[a.a]=function(){var e,t=m;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function i(){e.next&&e.next(f())}return i(),{unsubscribe:t(i)}}})[a.a]=function(){return this},e},n}function d(e,t){var i=t&&t.type;return"Given "+(i&&'action "'+String(i)+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}var p=[];var f=[];var m=[];var v,g={loading:!1},_=function(e,t){switch(void 0===e&&(e=g),t.type){case"SET_IS_LOADING":return{loading:t.isLoading};default:return e}},b=function(e){for(var t,i,n="",s=0;s<e;s++){n+=(t=0,i=36,Math.floor(Math.random()*(i-t)+t)).toString(36)}return n},y=function(e,t){var i=e.id||e.name&&e.name+"-"+b(2)||b(4);return i=t+"-"+(i=i.replace(/(:|\.|\[|\]|,)/g,""))},E=function(e){return Object.prototype.toString.call(e).slice(8,-1)},S=function(e,t){return null!=t&&E(t)===e},I=function(e){return e instanceof Element},w=function(e,t){for(var i=e;i;){if(i.hasAttribute(t))return i;i=i.parentElement}return null},O=function(e){return S("String",e)?e.replace(/&/g,"&amp;").replace(/>/g,"&rt;").replace(/</g,"&lt;").replace(/"/g,"&quot;"):e},C=(v=document.createElement("div"),function(e){var t=e.trim();v.innerHTML=t;for(var i=v.children[0];v.firstChild;)v.removeChild(v.firstChild);return i}),A=function(e,t){return e.score-t.score},x=function e(t,i){var n=i.indexOf(".");return n>-1?e(t[i.substring(0,n)],i.substr(n+1)):t[i]},T=function(e){return JSON.parse(JSON.stringify(e))},L=function(e,t){var i=Object.keys(e).sort(),n=Object.keys(t).sort();return i.filter((function(e){return n.indexOf(e)<0}))},k=function(e){for(var t=Object.keys(e),i={},n=0;n<t.length;n++){var s=t[n];0,"function"==typeof e[s]&&(i[s]=e[s])}var o,r=Object.keys(i);try{!function(e){Object.keys(e).forEach((function(t){var i=e[t];if(void 0===i(void 0,{type:c.INIT}))throw new Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===i(void 0,{type:c.PROBE_UNKNOWN_ACTION()}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+c.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')}))}(i)}catch(e){o=e}return function(e,t){if(void 0===e&&(e={}),o)throw o;for(var n=!1,s={},a=0;a<r.length;a++){var l=r[a],c=i[l],h=e[l],u=c(h,t);if(void 0===u){var p=d(l,t);throw new Error(p)}s[l]=u,n=n||u!==h}return n?s:e}}({items:function(e,t){switch(void 0===e&&(e=p),t.type){case"ADD_ITEM":return[].concat(e,[{id:t.id,choiceId:t.choiceId,groupId:t.groupId,value:t.value,label:t.label,active:!0,highlighted:!1,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]).map((function(e){var t=e;return t.highlighted=!1,t}));case"REMOVE_ITEM":return e.map((function(e){var i=e;return i.id===t.id&&(i.active=!1),i}));case"HIGHLIGHT_ITEM":return e.map((function(e){var i=e;return i.id===t.id&&(i.highlighted=t.highlighted),i}));default:return e}},groups:function(e,t){switch(void 0===e&&(e=f),t.type){case"ADD_GROUP":return[].concat(e,[{id:t.id,value:t.value,active:t.active,disabled:t.disabled}]);case"CLEAR_CHOICES":return[];default:return e}},choices:function(e,t){switch(void 0===e&&(e=m),t.type){case"ADD_CHOICE":return[].concat(e,[{id:t.id,elementId:t.elementId,groupId:t.groupId,value:t.value,label:t.label||t.value,disabled:t.disabled||!1,selected:!1,active:!0,score:9999,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);case"ADD_ITEM":return t.activateOptions?e.map((function(e){var i=e;return i.active=t.active,i})):t.choiceId>-1?e.map((function(e){var i=e;return i.id===parseInt(t.choiceId,10)&&(i.selected=!0),i})):e;case"REMOVE_ITEM":return t.choiceId>-1?e.map((function(e){var i=e;return i.id===parseInt(t.choiceId,10)&&(i.selected=!1),i})):e;case"FILTER_CHOICES":return e.map((function(e){var i=e;return i.active=t.results.some((function(e){var t=e.item,n=e.score;return t.id===i.id&&(i.score=n,!0)})),i}));case"ACTIVATE_CHOICES":return e.map((function(e){var i=e;return i.active=t.active,i}));case"CLEAR_CHOICES":return m;default:return e}},general:_}),D=function(e,t){var i=e;if("CLEAR_ALL"===t.type)i=void 0;else if("RESET_TO"===t.type)return T(t.state);return k(i,t)};function P(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)}}var F=function(){function e(){this._store=u(D,window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__())}var t,i,n,s=e.prototype;return s.subscribe=function(e){this._store.subscribe(e)},s.dispatch=function(e){this._store.dispatch(e)},s.isLoading=function(){return this.state.general.loading},s.getChoiceById=function(e){return!!e&&this.activeChoices.find((function(t){return t.id===parseInt(e,10)}))},s.getGroupById=function(e){return this.groups.find((function(t){return t.id===parseInt(e,10)}))},t=e,(i=[{key:"state",get:function(){return this._store.getState()}},{key:"items",get:function(){return this.state.items}},{key:"activeItems",get:function(){return this.items.filter((function(e){return!0===e.active}))}},{key:"highlightedActiveItems",get:function(){return this.items.filter((function(e){return e.active&&e.highlighted}))}},{key:"choices",get:function(){return this.state.choices}},{key:"activeChoices",get:function(){return this.choices.filter((function(e){return!0===e.active}))}},{key:"selectableChoices",get:function(){return this.choices.filter((function(e){return!0!==e.disabled}))}},{key:"searchableChoices",get:function(){return this.selectableChoices.filter((function(e){return!0!==e.placeholder}))}},{key:"placeholderChoice",get:function(){return[].concat(this.choices).reverse().find((function(e){return!0===e.placeholder}))}},{key:"groups",get:function(){return this.state.groups}},{key:"activeGroups",get:function(){var e=this.groups,t=this.choices;return e.filter((function(e){var i=!0===e.active&&!1===e.disabled,n=t.some((function(e){return!0===e.active&&!1===e.disabled}));return i&&n}),[])}}])&&P(t.prototype,i),n&&P(t,n),e}(),M=function(){function e(e){var t=e.element,i=e.type,n=e.classNames;Object.assign(this,{element:t,type:i,classNames:n}),this.isActive=!1}var t=e.prototype;return t.distanceFromTopWindow=function(){return this.dimensions=this.element.getBoundingClientRect(),this.position=Math.ceil(this.dimensions.top+window.pageYOffset+this.element.offsetHeight),this.position},t.getChild=function(e){return this.element.querySelector(e)},t.show=function(){return this.element.classList.add(this.classNames.activeState),this.element.setAttribute("aria-expanded","true"),this.isActive=!0,this},t.hide=function(){return this.element.classList.remove(this.classNames.activeState),this.element.setAttribute("aria-expanded","false"),this.isActive=!1,this},e}(),N=function(){function e(e){var t=e.element,i=e.type,n=e.classNames,s=e.position;Object.assign(this,{element:t,classNames:n,type:i,position:s}),this.isOpen=!1,this.isFlipped=!1,this.isFocussed=!1,this.isDisabled=!1,this.isLoading=!1,this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this)}var t=e.prototype;return t.addEventListeners=function(){this.element.addEventListener("focus",this._onFocus),this.element.addEventListener("blur",this._onBlur)},t.removeEventListeners=function(){this.element.removeEventListener("focus",this._onFocus),this.element.removeEventListener("blur",this._onBlur)},t.shouldFlip=function(e,t){var i,n;if(void 0===t&&(i=document.body,n=document.documentElement,t=Math.max(i.scrollHeight,i.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)),void 0===e)return!1;var s=!1;return"auto"===this.position?s=e>=t:"top"===this.position&&(s=!0),s},t.setActiveDescendant=function(e){this.element.setAttribute("aria-activedescendant",e)},t.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},t.open=function(e){this.element.classList.add(this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(e)&&(this.element.classList.add(this.classNames.flippedState),this.isFlipped=!0)},t.close=function(){this.element.classList.remove(this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(this.element.classList.remove(this.classNames.flippedState),this.isFlipped=!1)},t.focus=function(){this.isFocussed||this.element.focus()},t.addFocusState=function(){this.element.classList.add(this.classNames.focusState)},t.removeFocusState=function(){this.element.classList.remove(this.classNames.focusState)},t.enable=function(){this.element.classList.remove(this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),"select-one"===this.type&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1},t.disable=function(){this.element.classList.add(this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),"select-one"===this.type&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0},t.wrap=function(e){!function(e,t){void 0===t&&(t=document.createElement("div")),e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),t.appendChild(e)}(e,this.element)},t.unwrap=function(e){this.element.parentNode.insertBefore(e,this.element),this.element.parentNode.removeChild(this.element)},t.addLoadingState=function(){this.element.classList.add(this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0},t.removeLoadingState=function(){this.element.classList.remove(this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1},t._onFocus=function(){this.isFocussed=!0},t._onBlur=function(){this.isFocussed=!1},e}();function j(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)}}var K=function(){function e(e){var t=e.element,i=e.type,n=e.classNames,s=e.placeholderValue;Object.assign(this,{element:t,type:i,classNames:n,placeholderValue:s}),this.element=t,this.classNames=n,this.isFocussed=this.element===document.activeElement,this.isDisabled=!1,this._onPaste=this._onPaste.bind(this),this._onInput=this._onInput.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this)}var t,i,n,s=e.prototype;return s.addEventListeners=function(){this.element.addEventListener("input",this._onInput),this.element.addEventListener("paste",this._onPaste),this.element.addEventListener("focus",this._onFocus),this.element.addEventListener("blur",this._onBlur),this.element.form&&this.element.form.addEventListener("reset",this._onFormReset)},s.removeEventListeners=function(){this.element.removeEventListener("input",this._onInput),this.element.removeEventListener("paste",this._onPaste),this.element.removeEventListener("focus",this._onFocus),this.element.removeEventListener("blur",this._onBlur),this.element.form&&this.element.form.removeEventListener("reset",this._onFormReset)},s.enable=function(){this.element.removeAttribute("disabled"),this.isDisabled=!1},s.disable=function(){this.element.setAttribute("disabled",""),this.isDisabled=!0},s.focus=function(){this.isFocussed||this.element.focus()},s.blur=function(){this.isFocussed&&this.element.blur()},s.clear=function(e){return void 0===e&&(e=!0),this.element.value&&(this.element.value=""),e&&this.setWidth(),this},s.setWidth=function(e){var t=this,i=function(e){t.element.style.width=e};if(this._placeholderValue){var n=this.element.value.length>=this._placeholderValue.length/1.25;(this.element.value&&n||e)&&this.calcWidth(i)}else this.calcWidth(i)},s.calcWidth=function(e){return function(e,t){var i=e.value||e.placeholder,n=e.offsetWidth;if(i){var s=C("<span>"+O(i)+"</span>");if(s.style.position="absolute",s.style.padding="0",s.style.top="-9999px",s.style.left="-9999px",s.style.width="auto",s.style.whiteSpace="pre",document.body.contains(e)&&window.getComputedStyle){var o=window.getComputedStyle(e);o&&(s.style.fontSize=o.fontSize,s.style.fontFamily=o.fontFamily,s.style.fontWeight=o.fontWeight,s.style.fontStyle=o.fontStyle,s.style.letterSpacing=o.letterSpacing,s.style.textTransform=o.textTransform,s.style.paddingLeft=o.paddingLeft,s.style.paddingRight=o.paddingRight)}document.body.appendChild(s),requestAnimationFrame((function(){i&&s.offsetWidth!==e.offsetWidth&&(n=s.offsetWidth+4),document.body.removeChild(s),t.call(void 0,n+"px")}))}else t.call(void 0,n+"px")}(this.element,e)},s.setActiveDescendant=function(e){this.element.setAttribute("aria-activedescendant",e)},s.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},s._onInput=function(){"select-one"!==this.type&&this.setWidth()},s._onPaste=function(e){e.target===this.element&&this.preventPaste&&e.preventDefault()},s._onFocus=function(){this.isFocussed=!0},s._onBlur=function(){this.isFocussed=!1},t=e,(i=[{key:"placeholder",set:function(e){this.element.placeholder=e}},{key:"value",set:function(e){this.element.value=e},get:function(){return O(this.element.value)}}])&&j(t.prototype,i),n&&j(t,n),e}(),R={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,addItems:!0,addItemFilterFn:null,removeItems:!0,removeItemButton:!1,editItems:!1,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,shouldSort:!0,shouldSortItems:!1,sortFn:function(e,t){var i=(""+(e.label||e.value)).toLowerCase(),n=(""+(t.label||t.value)).toLowerCase();return i<n?-1:i>n?1:0},placeholder:!0,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",uniqueItemText:"Only unique values can be added",customAddItemText:"Only values matching specific conditions can be added",addItemText:function(e){return'Press Enter to add <b>"'+O(e)+'"</b>'},maxItemText:function(e){return"Only "+e+" values can be added"},itemComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:"choices",containerInner:"choices__inner",input:"choices__input",inputCloned:"choices__input--cloned",list:"choices__list",listItems:"choices__list--multiple",listSingle:"choices__list--single",listDropdown:"choices__list--dropdown",item:"choices__item",itemSelectable:"choices__item--selectable",itemDisabled:"choices__item--disabled",itemChoice:"choices__item--choice",placeholder:"choices__placeholder",group:"choices__group",groupHeading:"choices__heading",button:"choices__button",activeState:"is-active",focusState:"is-focused",openState:"is-open",disabledState:"is-disabled",highlightedState:"is-highlighted",hiddenState:"is-hidden",flippedState:"is-flipped",loadingState:"is-loading",noResults:"has-no-results",noChoices:"has-no-choices"}},B="showDropdown",V="hideDropdown",H="change",G="choice",q="search",W="addItem",U="removeItem",z="highlightItem",X="highlightChoice",Y="ADD_CHOICE",$="FILTER_CHOICES",J="ACTIVATE_CHOICES",Z="CLEAR_CHOICES",Q="ADD_GROUP",ee="ADD_ITEM",te="REMOVE_ITEM",ie="HIGHLIGHT_ITEM",ne=46,se=8,oe=13,re=65,ae=27,le=38,ce=40,he=33,ue=34,de=function(){function e(e){var t=e.element;Object.assign(this,{element:t}),this.scrollPos=this.element.scrollTop,this.height=this.element.offsetHeight,this.hasChildren=!!this.element.children}var t=e.prototype;return t.clear=function(){this.element.innerHTML=""},t.append=function(e){this.element.appendChild(e)},t.getChild=function(e){return this.element.querySelector(e)},t.scrollToTop=function(){this.element.scrollTop=0},t.scrollToChoice=function(e,t){var i=this;if(e){var n=this.element.offsetHeight,s=e.offsetHeight,o=e.offsetTop+s,r=this.element.scrollTop+n,a=t>0?this.element.scrollTop+o-r:e.offsetTop;requestAnimationFrame((function(e){i._animateScroll(e,a,t)}))}},t._scrollDown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrollTop=e+s},t._scrollUp=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrollTop=e-s},t._animateScroll=function(e,t,i){var n=this,s=this.element.scrollTop,o=!1;i>0?(this._scrollDown(s,4,t),s<t&&(o=!0)):(this._scrollUp(s,4,t),s>t&&(o=!0)),o&&requestAnimationFrame((function(){n._animateScroll(e,t,i)}))},e}();function pe(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)}}var fe=function(){function e(e){var t=e.element,i=e.classNames;if(Object.assign(this,{element:t,classNames:i}),!I(t))throw new TypeError("Invalid element passed");this.isDisabled=!1}var t,i,n,s=e.prototype;return s.conceal=function(){this.element.classList.add(this.classNames.input),this.element.classList.add(this.classNames.hiddenState),this.element.tabIndex="-1";var e=this.element.getAttribute("style");e&&this.element.setAttribute("data-choice-orig-style",e),this.element.setAttribute("aria-hidden","true"),this.element.setAttribute("data-choice","active")},s.reveal=function(){this.element.classList.remove(this.classNames.input),this.element.classList.remove(this.classNames.hiddenState),this.element.removeAttribute("tabindex");var e=this.element.getAttribute("data-choice-orig-style");e?(this.element.removeAttribute("data-choice-orig-style"),this.element.setAttribute("style",e)):this.element.removeAttribute("style"),this.element.removeAttribute("aria-hidden"),this.element.removeAttribute("data-choice"),this.element.value=this.element.value},s.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},s.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},s.triggerEvent=function(e,t){!function(e,t,i){void 0===i&&(i=null);var n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});e.dispatchEvent(n)}(this.element,e,t)},t=e,(i=[{key:"value",get:function(){return this.element.value},set:function(e){this.element.value=e}}])&&pe(t.prototype,i),n&&pe(t,n),e}();function me(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)}}var ve=function(e){var t,i,n,s,o;function r(t){var i,n=t.element,s=t.classNames,o=t.delimiter;return(i=e.call(this,{element:n,classNames:s})||this).delimiter=o,i}return i=e,(t=r).prototype=Object.create(i.prototype),t.prototype.constructor=t,t.__proto__=i,n=r,(s=[{key:"value",set:function(e){var t=e.map((function(e){return e.value})).join(this.delimiter);this.element.setAttribute("value",t),this.element.value=t},get:function(){return this.element.value}}])&&me(n.prototype,s),o&&me(n,o),r}(fe);function ge(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)}}var _e=function(e){var t,i,n,s,o;function r(t){var i,n=t.element,s=t.classNames,o=t.template;return(i=e.call(this,{element:n,classNames:s})||this).template=o,i}return i=e,(t=r).prototype=Object.create(i.prototype),t.prototype.constructor=t,t.__proto__=i,r.prototype.appendDocFragment=function(e){this.element.innerHTML="",this.element.appendChild(e)},n=r,(s=[{key:"placeholderOption",get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")}},{key:"optionGroups",get:function(){return Array.from(this.element.getElementsByTagName("OPTGROUP"))}},{key:"options",get:function(){return Array.from(this.element.options)},set:function(e){var t=this,i=document.createDocumentFragment();e.forEach((function(e){return n=e,s=t.template(n),void i.appendChild(s);var n,s})),this.appendDocFragment(i)}}])&&ge(n.prototype,s),o&&ge(n,o),r}(fe),be=i(0),ye=i.n(be),Ee={containerOuter:function(e,t,i,n,s,o){var r=n?'tabindex="0"':"",a=i?'role="listbox"':"",l="";return i&&s&&(a='role="combobox"',l='aria-autocomplete="list"'),C('\n <div\n class="'+e.containerOuter+'"\n data-type="'+o+'"\n '+a+"\n "+r+"\n "+l+'\n aria-haspopup="true"\n aria-expanded="false"\n dir="'+t+'"\n >\n </div>\n ')},containerInner:function(e){return C('\n <div class="'+e.containerInner+'"></div>\n ')},itemList:function(e,t){var i,n=ye()(e.list,((i={})[e.listSingle]=t,i[e.listItems]=!t,i));return C('\n <div class="'+n+'"></div>\n ')},placeholder:function(e,t){return C('\n <div class="'+e.placeholder+'">\n '+t+"\n </div>\n ")},item:function(e,t,i){var n,s,o=t.active?'aria-selected="true"':"",r=t.disabled?'aria-disabled="true"':"",a=ye()(e.item,((n={})[e.highlightedState]=t.highlighted,n[e.itemSelectable]=!t.highlighted,n[e.placeholder]=t.placeholder,n));return i?(a=ye()(e.item,((s={})[e.highlightedState]=t.highlighted,s[e.itemSelectable]=!t.disabled,s[e.placeholder]=t.placeholder,s)),C('\n <div\n class="'+a+'"\n data-item\n data-id="'+t.id+'"\n data-value="'+t.value+"\"\n data-custom-properties='"+t.customProperties+"'\n data-deletable\n "+o+"\n "+r+"\n >\n "+t.label+'\x3c!--\n --\x3e<button\n type="button"\n class="'+e.button+'"\n data-button\n aria-label="Remove item: \''+t.value+"'\"\n >\n Remove item\n </button>\n </div>\n ")):C('\n <div\n class="'+a+'"\n data-item\n data-id="'+t.id+'"\n data-value="'+t.value+'"\n '+o+"\n "+r+"\n >\n "+t.label+"\n </div>\n ")},choiceList:function(e,t){var i=t?"":'aria-multiselectable="true"';return C('\n <div\n class="'+e.list+'"\n dir="ltr"\n role="listbox"\n '+i+"\n >\n </div>\n ")},choiceGroup:function(e,t){var i,n=t.disabled?'aria-disabled="true"':"",s=ye()(e.group,((i={})[e.itemDisabled]=t.disabled,i));return C('\n <div\n class="'+s+'"\n data-group\n data-id="'+t.id+'"\n data-value="'+t.value+'"\n role="group"\n '+n+'\n >\n <div class="'+e.groupHeading+'">'+t.value+"</div>\n </div>\n ")},choice:function(e,t,i){var n,s=t.groupId>0?'role="treeitem"':'role="option"',o=ye()(e.item,e.itemChoice,((n={})[e.itemDisabled]=t.disabled,n[e.itemSelectable]=!t.disabled,n[e.placeholder]=t.placeholder,n));return C('\n <div\n class="'+o+'"\n data-select-text="'+i+'"\n data-choice\n data-id="'+t.id+'"\n data-value="'+t.value+'"\n '+(t.disabled?'data-choice-disabled aria-disabled="true"':"data-choice-selectable")+'\n id="'+t.elementId+'"\n '+s+"\n >\n "+t.label+"\n </div>\n ")},input:function(e,t){var i=ye()(e.input,e.inputCloned);return C('\n <input\n type="text"\n class="'+i+'"\n autocomplete="off"\n autocapitalize="off"\n spellcheck="false"\n role="textbox"\n aria-autocomplete="list"\n aria-label="'+t+'"\n >\n ')},dropdown:function(e){var t=ye()(e.list,e.listDropdown);return C('\n <div\n class="'+t+'"\n aria-expanded="false"\n >\n </div>\n ')},notice:function(e,t,i){var n;void 0===i&&(i="");var s=ye()(e.item,e.itemChoice,((n={})[e.noResults]="no-results"===i,n[e.noChoices]="no-choices"===i,n));return C('\n <div class="'+s+'">\n '+t+"\n </div>\n ")},option:function(e){return C('\n <option value="'+e.value+'" '+(e.active?"selected":"")+" "+(e.disabled?"disabled":"")+" "+(e.customProperties?"data-custom-properties="+e.customProperties:"")+">"+e.label+"</option>\n ")}},Se=function(e){return void 0===e&&(e=!0),{type:J,active:e}},Ie=function(e,t){return{type:ie,id:e,highlighted:t}},we=function(e,t,i,n){return{type:Q,value:e,id:t,active:i,disabled:n}},Oe=function(){function e(t,i){var n=this;if(void 0===t&&(t="[data-choice]"),void 0===i&&(i={}),S("String",t)){var s=Array.from(document.querySelectorAll(t));if(s.length>1)return this._generateInstances(s,i)}this.config=r.a.all([R,e.userDefaults,i],{arrayMerge:function(e,t){return[].concat(t)}});var o=L(this.config,R);o.length&&console.warn("Unknown config option(s) passed",o.join(", ")),["auto","always"].includes(this.config.renderSelectedChoices)||(this.config.renderSelectedChoices="auto");var a=S("String",t)?document.querySelector(t):t;if(a){if(this._isTextElement="text"===a.type,this._isSelectOneElement="select-one"===a.type,this._isSelectMultipleElement="select-multiple"===a.type,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._isTextElement?this.passedElement=new ve({element:a,classNames:this.config.classNames,delimiter:this.config.delimiter}):this._isSelectElement&&(this.passedElement=new _e({element:a,classNames:this.config.classNames,template:function(e){return n.config.templates.option(e)}})),!this.passedElement)return console.error("Passed element was of an invalid type");this.initialised=!1,this._store=new F(this.render),this._initialState={},this._currentState={},this._prevState={},this._currentValue="",this._canSearch=this.config.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=y(this.passedElement.element,"choices-"),this._direction=this.passedElement.element.getAttribute("dir")||"ltr",this._idNames={itemChoice:"item-choice"},this._presetChoices=this.config.choices,this._presetItems=this.config.items,this.passedElement.value&&(this._presetItems=this._presetItems.concat(this.passedElement.value.split(this.config.delimiter))),this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onClick=this._onClick.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseOver=this._onMouseOver.bind(this),this._onFormReset=this._onFormReset.bind(this),this._onAKey=this._onAKey.bind(this),this._onEnterKey=this._onEnterKey.bind(this),this._onEscapeKey=this._onEscapeKey.bind(this),this._onDirectionKey=this._onDirectionKey.bind(this),this._onDeleteKey=this._onDeleteKey.bind(this),this.config.silent||(!0===this.config.shouldSortItems&&this._isSelectOneElement&&console.warn("shouldSortElements: Type of passed element is 'select-one', falling back to false."),"active"===this.passedElement.element.getAttribute("data-choice")&&console.warn("Trying to initialise Choices on element already initialised")),this.init()}else this.config.silent||console.error("Could not find passed element or passed element was of an invalid type")}var t=e.prototype;return t.init=function(){if(!this.initialised){this._createTemplates(),this._createElements(),this._createStructure(),this._initialState=T(this._store.state),this._store.subscribe(this._render),this._render(),this._addEventListeners(),(!this.config.addItems||this.passedElement.element.hasAttribute("disabled"))&&this.disable(),this.initialised=!0;var e=this.config.callbackOnInit;e&&S("Function",e)&&e.call(this)}},t.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this._isSelectElement&&(this.passedElement.options=this._presetChoices),this.clearStore(),this.config.templates=null,this.initialised=!1)},t.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},t.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},t.highlightItem=function(e,t){if(void 0===t&&(t=!0),!e)return this;var i=e.id,n=e.groupId,s=void 0===n?-1:n,o=e.value,r=void 0===o?"":o,a=e.label,l=void 0===a?"":a,c=s>=0?this._store.getGroupById(s):null;return this._store.dispatch(Ie(i,!0)),t&&this.passedElement.triggerEvent(z,{id:i,value:r,label:l,groupValue:c&&c.value?c.value:null}),this},t.unhighlightItem=function(e){if(!e)return this;var t=e.id,i=e.groupId,n=void 0===i?-1:i,s=e.value,o=void 0===s?"":s,r=e.label,a=void 0===r?"":r,l=n>=0?this._store.getGroupById(n):null;return this._store.dispatch(Ie(t,!1)),this.passedElement.triggerEvent(z,{id:t,value:o,label:a,groupValue:l&&l.value?l.value:null}),this},t.highlightAll=function(){var e=this;return this._store.items.forEach((function(t){return e.highlightItem(t)})),this},t.unhighlightAll=function(){var e=this;return this._store.items.forEach((function(t){return e.unhighlightItem(t)})),this},t.removeActiveItemsByValue=function(e){var t=this;return this._store.activeItems.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)})),this},t.removeActiveItems=function(e){var t=this;return this._store.activeItems.filter((function(t){return t.id!==e})).forEach((function(e){return t._removeItem(e)})),this},t.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.highlightedActiveItems.forEach((function(i){t._removeItem(i),e&&t._triggerChange(i.value)})),this},t.showDropdown=function(e){var t=this;return this.dropdown.isActive?this:(requestAnimationFrame((function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow()),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent(B,{})})),this)},t.hideDropdown=function(e){var t=this;return this.dropdown.isActive?(requestAnimationFrame((function(){t.dropdown.hide(),t.containerOuter.close(),!e&&t._canSearch&&(t.input.removeActiveDescendant(),t.input.blur()),t.passedElement.triggerEvent(V,{})})),this):this},t.getValue=function(e){void 0===e&&(e=!1);var t=this._store.activeItems.reduce((function(t,i){var n=e?i.value:i;return t.push(n),t}),[]);return this._isSelectOneElement?t[0]:t},t.setValue=function(e){var t=this;return this.initialised?([].concat(e).forEach((function(e){return t._setChoiceOrItem(e)})),this):this},t.setChoiceByValue=function(e){var t=this;return!this.initialised||this._isTextElement?this:((S("Array",e)?e:[e]).forEach((function(e){return t._findAndSelectChoiceByValue(e)})),this)},t.setChoices=function(e,t,i,n){var s=this;if(void 0===e&&(e=[]),void 0===t&&(t=""),void 0===i&&(i=""),void 0===n&&(n=!1),!this._isSelectElement||!t)return this;n&&this.clearChoices(),this.containerOuter.removeLoadingState();return this._setLoading(!0),e.forEach((function(e){e.choices?s._addGroup({group:e,id:e.id||null,valueKey:t,labelKey:i}):s._addChoice({value:e[t],label:e[i],isSelected:e.selected,isDisabled:e.disabled,customProperties:e.customProperties,placeholder:e.placeholder})})),this._setLoading(!1),this},t.clearChoices=function(){this._store.dispatch({type:Z})},t.clearStore=function(){return this._store.dispatch({type:"CLEAR_ALL"}),this},t.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),!this._isTextElement&&this._canSearch&&(this._isSearching=!1,this._store.dispatch(Se(!0))),this},t.ajax=function(e){var t=this;return this.initialised&&this._isSelectElement&&e?(requestAnimationFrame((function(){return t._handleLoadingState(!0)})),e(this._ajaxCallback()),this):this},t._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||this._currentState.items!==this._prevState.items,t=this._isSelectElement,i=this._currentState.items!==this._prevState.items;e&&(t&&this._renderChoices(),i&&this._renderItems(),this._prevState=this._currentState)}},t._renderChoices=function(){var e=this,t=this._store,i=t.activeGroups,n=t.activeChoices,s=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame((function(){return e.choiceList.scrollToTop()})),i.length>=1&&!this._isSearching){var o=n.filter((function(e){return!0===e.placeholder&&-1===e.groupId}));o.length>=1&&(s=this._createChoicesFragment(o,s)),s=this._createGroupsFragment(i,n,s)}else n.length>=1&&(s=this._createChoicesFragment(n,s));if(s.childNodes&&s.childNodes.length>0){var r=this._store.activeItems,a=this._canAddItem(r,this.input.value);a.response?(this.choiceList.append(s),this._highlightChoice()):this.choiceList.append(this._getTemplate("notice",a.notice))}else{var l,c;this._isSearching?(c=S("Function",this.config.noResultsText)?this.config.noResultsText():this.config.noResultsText,l=this._getTemplate("notice",c,"no-results")):(c=S("Function",this.config.noChoicesText)?this.config.noChoicesText():this.config.noChoicesText,l=this._getTemplate("notice",c,"no-choices")),this.choiceList.append(l)}},t._renderItems=function(){var e=this._store.activeItems||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)},t._createGroupsFragment=function(e,t,i){var n=this,s=i||document.createDocumentFragment();return this.config.shouldSort&&e.sort(this.config.sortFn),e.forEach((function(e){var i=function(e){return t.filter((function(t){return n._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===n.config.renderSelectedChoices||!t.selected)}))}(e);if(i.length>=1){var o=n._getTemplate("choiceGroup",e);s.appendChild(o),n._createChoicesFragment(i,s,!0)}})),s},t._createChoicesFragment=function(e,t,i){var n=this;void 0===i&&(i=!1);var s=t||document.createDocumentFragment(),o=this.config,r=o.renderSelectedChoices,a=o.searchResultLimit,l=o.renderChoiceLimit,c=this._isSearching?A:this.config.sortFn,h=function(e){if("auto"!==r||(n._isSelectOneElement||!e.selected)){var t=n._getTemplate("choice",e,n.config.itemSelectText);s.appendChild(t)}},u=e;"auto"!==r||this._isSelectOneElement||(u=e.filter((function(e){return!e.selected})));var d=u.reduce((function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e}),{placeholderChoices:[],normalChoices:[]}),p=d.placeholderChoices,f=d.normalChoices;(this.config.shouldSort||this._isSearching)&&f.sort(c);var m=u.length,v=[].concat(p,f);this._isSearching?m=a:l>0&&!i&&(m=l);for(var g=0;g<m;g+=1)v[g]&&h(v[g]);return s},t._createItemsFragment=function(e,t){var i=this;void 0===t&&(t=null);var n=this.config,s=n.shouldSortItems,o=n.sortFn,r=n.removeItemButton,a=t||document.createDocumentFragment();s&&!this._isSelectOneElement&&e.sort(o),this._isTextElement?this.passedElement.value=e:this.passedElement.options=e;return e.forEach((function(e){return function(e){var t=i._getTemplate("item",e,r);a.appendChild(t)}(e)})),a},t._triggerChange=function(e){null!=e&&this.passedElement.triggerEvent(H,{value:e})},t._selectPlaceholderChoice=function(){var e=this._store.placeholderChoice;e&&(this._addItem({value:e.value,label:e.label,choiceId:e.id,groupId:e.groupId,placeholder:e.placeholder}),this._triggerChange(e.value))},t._handleButtonAction=function(e,t){if(e&&t&&this.config.removeItems&&this.config.removeItemButton){var i=t.parentNode.getAttribute("data-id"),n=e.find((function(e){return e.id===parseInt(i,10)}));this._removeItem(n),this._triggerChange(n.value),this._isSelectOneElement&&this._selectPlaceholderChoice()}},t._handleItemAction=function(e,t,i){var n=this;if(void 0===i&&(i=!1),e&&t&&this.config.removeItems&&!this._isSelectOneElement){var s=t.getAttribute("data-id");e.forEach((function(e){e.id!==parseInt(s,10)||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)})),this.input.focus()}},t._handleChoiceAction=function(e,t){if(e&&t){var i=t.getAttribute("data-id"),n=this._store.getChoiceById(i),s=e[0]&&e[0].keyCode?e[0].keyCode:null,o=this.dropdown.isActive;if(n.keyCode=s,this.passedElement.triggerEvent(G,{choice:n}),n&&!n.selected&&!n.disabled)this._canAddItem(e,n.value).response&&(this._addItem({value:n.value,label:n.label,choiceId:n.id,groupId:n.groupId,customProperties:n.customProperties,placeholder:n.placeholder,keyCode:n.keyCode}),this._triggerChange(n.value));this.clearInput(),o&&this._isSelectOneElement&&(this.hideDropdown(!0),this.containerOuter.focus())}},t._handleBackspace=function(e){if(this.config.removeItems&&e){var t=e[e.length-1],i=e.some((function(e){return e.highlighted}));this.config.editItems&&!i&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(i||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}},t._setLoading=function(e){this._store.dispatch(function(e){return{type:"SET_IS_LOADING",isLoading:e}}(e))},t._handleLoadingState=function(e){void 0===e&&(e=!0);var t=this.itemList.getChild("."+this.config.classNames.placeholder);e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._getTemplate("placeholder",this.config.loadingText),this.itemList.append(t)):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t.innerHTML=this._placeholderValue||"":this.input.placeholder=this._placeholderValue||"")},t._handleSearch=function(e){if(e&&this.input.isFocussed){var t=this._store.choices,i=this.config,n=i.searchFloor,s=i.searchChoices,o=t.some((function(e){return!e.active}));if(e&&e.length>=n){var r=s?this._searchChoices(e):0;this.passedElement.triggerEvent(q,{value:e,resultCount:r})}else o&&(this._isSearching=!1,this._store.dispatch(Se(!0)))}},t._canAddItem=function(e,t){var i=!0,n=S("Function",this.config.addItemText)?this.config.addItemText(t):this.config.addItemText;if(!this._isSelectOneElement){var s=function(e,t,i){return void 0===i&&(i="value"),e.some((function(e){return S("String",t)?e[i]===t.trim():e[i]===t}))}(e,t);this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(i=!1,n=S("Function",this.config.maxItemText)?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),!this.config.duplicateItemsAllowed&&s&&i&&(i=!1,n=S("Function",this.config.uniqueItemText)?this.config.uniqueItemText(t):this.config.uniqueItemText),this._isTextElement&&this.config.addItems&&i&&S("Function",this.config.addItemFilterFn)&&!this.config.addItemFilterFn(t)&&(i=!1,n=S("Function",this.config.customAddItemText)?this.config.customAddItemText(t):this.config.customAddItemText)}return{response:i,notice:n}},t._ajaxCallback=function(){var e=this;return function(t,i,n){if(t&&i){var s=S("Object",t)?[t]:t;s&&S("Array",s)&&s.length?(e._handleLoadingState(!1),e._setLoading(!0),s.forEach((function(t){t.choices?e._addGroup({group:t,id:t.id||null,valueKey:i,labelKey:n}):e._addChoice({value:x(t,i),label:x(t,n),isSelected:t.selected,isDisabled:t.disabled,customProperties:t.customProperties,placeholder:t.placeholder})})),e._setLoading(!1),e._isSelectOneElement&&e._selectPlaceholderChoice()):e._handleLoadingState(!1)}}},t._searchChoices=function(e){var t=S("String",e)?e.trim():e,i=S("String",this._currentValue)?this._currentValue.trim():this._currentValue;if(t.length<1&&t===i+" ")return 0;var n=this._store.searchableChoices,o=t,r=[].concat(this.config.searchFields),a=Object.assign(this.config.fuseOptions,{keys:r}),l=new s.a(n,a).search(o);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch(function(e){return{type:$,results:e}}(l)),l.length},t._addEventListeners=function(){window.delegateEvent.add("keyup",this._onKeyUp),window.delegateEvent.add("keydown",this._onKeyDown),window.delegateEvent.add("click",this._onClick),window.delegateEvent.add("touchmove",this._onTouchMove),window.delegateEvent.add("touchend",this._onTouchEnd),window.delegateEvent.add("mousedown",this._onMouseDown),window.delegateEvent.add("mouseover",this._onMouseOver),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus),this.containerOuter.element.addEventListener("blur",this._onBlur)),this.input.element.addEventListener("focus",this._onFocus),this.input.element.addEventListener("blur",this._onBlur),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset),this.input.addEventListeners()},t._removeEventListeners=function(){window.delegateEvent.remove("keyup",this._onKeyUp),window.delegateEvent.remove("keydown",this._onKeyDown),window.delegateEvent.remove("click",this._onClick),window.delegateEvent.remove("touchmove",this._onTouchMove),window.delegateEvent.remove("touchend",this._onTouchEnd),window.delegateEvent.remove("mousedown",this._onMouseDown),window.delegateEvent.remove("mouseover",this._onMouseOver),this._isSelectOneElement&&(this.containerOuter.element.removeEventListener("focus",this._onFocus),this.containerOuter.element.removeEventListener("blur",this._onBlur)),this.input.element.removeEventListener("focus",this._onFocus),this.input.element.removeEventListener("blur",this._onBlur),this.input.element.form&&this.input.element.form.removeEventListener("reset",this._onFormReset),this.input.removeEventListeners()},t._onKeyDown=function(e){var t,i=e.target,n=e.keyCode,s=e.ctrlKey,o=e.metaKey;if(i===this.input.element||this.containerOuter.element.contains(i)){var r=this._store.activeItems,a=this.input.isFocussed,l=this.dropdown.isActive,c=this.itemList.hasChildren,h=String.fromCharCode(n),u=ne,d=se,p=oe,f=re,m=ae,v=le,g=ce,_=he,b=ue,y=s||o;!this._isTextElement&&/[a-zA-Z0-9-_ ]/.test(h)&&this.showDropdown();var E=((t={})[f]=this._onAKey,t[p]=this._onEnterKey,t[m]=this._onEscapeKey,t[v]=this._onDirectionKey,t[_]=this._onDirectionKey,t[g]=this._onDirectionKey,t[b]=this._onDirectionKey,t[d]=this._onDeleteKey,t[u]=this._onDeleteKey,t);E[n]&&E[n]({event:e,target:i,keyCode:n,metaKey:o,activeItems:r,hasFocusedInput:a,hasActiveDropdown:l,hasItems:c,hasCtrlDownKeyPressed:y})}},t._onKeyUp=function(e){var t=e.target,i=e.keyCode;if(t===this.input.element){var n=this.input.value,s=this._store.activeItems,o=this._canAddItem(s,n),r=ne,a=se;if(this._isTextElement){if(o.notice&&n){var l=this._getTemplate("notice",o.notice);this.dropdown.element.innerHTML=l.outerHTML,this.showDropdown(!0)}else this.hideDropdown(!0)}else{var c=(i===r||i===a)&&!t.value,h=!this._isTextElement&&this._isSearching,u=this._canSearch&&o.response;c&&h?(this._isSearching=!1,this._store.dispatch(Se(!0))):u&&this._handleSearch(this.input.value)}this._canSearch=this.config.searchEnabled}},t._onAKey=function(e){var t=e.hasItems;e.hasCtrlDownKeyPressed&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},t._onEnterKey=function(e){var t=e.event,i=e.target,n=e.activeItems,s=e.hasActiveDropdown,o=oe,r=i.hasAttribute("data-button");if(this._isTextElement&&i.value){var a=this.input.value;this._canAddItem(n,a).response&&(this.hideDropdown(!0),this._addItem({value:a}),this._triggerChange(a),this.clearInput())}if(r&&(this._handleButtonAction(n,i),t.preventDefault()),s){var l=this.dropdown.getChild("."+this.config.classNames.highlightedState);l&&(n[0]&&(n[0].keyCode=o),this._handleChoiceAction(n,l)),t.preventDefault()}else this._isSelectOneElement&&(this.showDropdown(),t.preventDefault())},t._onEscapeKey=function(e){e.hasActiveDropdown&&(this.hideDropdown(!0),this.containerOuter.focus())},t._onDirectionKey=function(e){var t=e.event,i=e.hasActiveDropdown,n=e.keyCode,s=e.metaKey,o=ce,r=he,a=ue;if(i||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var l,c=n===o||n===a?1:-1;if(s||n===a||n===r)l=c>0?Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]")).pop():this.dropdown.element.querySelector("[data-choice-selectable]");else{var h=this.dropdown.element.querySelector("."+this.config.classNames.highlightedState);l=h?function(e,t,i){if(void 0===i&&(i=1),e&&t){var n=e.parentNode.parentNode,s=Array.from(n.querySelectorAll(t)),o=s.indexOf(e);return s[o+(i>0?1:-1)]}}(h,"[data-choice-selectable]",c):this.dropdown.element.querySelector("[data-choice-selectable]")}l&&(function(e,t,i){if(void 0===i&&(i=1),e)return i>0?t.scrollTop+t.offsetHeight>=e.offsetTop+e.offsetHeight:e.offsetTop>=t.scrollTop}(l,this.choiceList.element,c)||this.choiceList.scrollToChoice(l,c),this._highlightChoice(l)),t.preventDefault()}},t._onDeleteKey=function(e){var t=e.event,i=e.target,n=e.hasFocusedInput,s=e.activeItems;!n||i.value||this._isSelectOneElement||(this._handleBackspace(s),t.preventDefault())},t._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},t._onTouchEnd=function(e){var t=(e||e.touches[0]).target;this._wasTap&&this.containerOuter.element.contains(t)&&((t===this.containerOuter.element||t===this.containerInner.element)&&(this._isTextElement?this.input.focus():this._isSelectMultipleElement&&this.showDropdown()),e.stopPropagation());this._wasTap=!0},t._onMouseDown=function(e){var t=e.target,i=e.shiftKey;if(this.choiceList.element.contains(t)&&navigator.userAgent.match(/Trident/)&&navigator.userAgent.match(/rv[ :]11/)&&(this._isScrollingOnIe=!0),this.containerOuter.element.contains(t)&&t!==this.input.element){var n=this._store.activeItems,s=i,o=w(t,"data-button"),r=w(t,"data-item"),a=w(t,"data-choice");o?this._handleButtonAction(n,o):r?this._handleItemAction(n,r,s):a&&this._handleChoiceAction(n,a),e.preventDefault()}},t._onMouseOver=function(e){var t=e.target;(t===this.dropdown||this.dropdown.element.contains(t))&&t.hasAttribute("data-choice")&&this._highlightChoice(t)},t._onClick=function(e){var t=e.target;this.containerOuter.element.contains(t)?this.dropdown.isActive||this.containerOuter.isDisabled?this._isSelectOneElement&&t!==this.input.element&&!this.dropdown.element.contains(t)&&this.hideDropdown():this._isTextElement?document.activeElement!==this.input.element&&this.input.focus():(this.showDropdown(),this.containerOuter.focus()):(this._store.highlightedActiveItems.length>0&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))},t._onFocus=function(e){var t=this,i=e.target;this.containerOuter.element.contains(i)&&{text:function(){i===t.input.element&&t.containerOuter.addFocusState()},"select-one":function(){t.containerOuter.addFocusState(),i===t.input.element&&t.showDropdown(!0)},"select-multiple":function(){i===t.input.element&&(t.showDropdown(!0),t.containerOuter.addFocusState())}}[this.passedElement.element.type]()},t._onBlur=function(e){var t=this,i=e.target;if(this.containerOuter.element.contains(i)&&!this._isScrollingOnIe){var n=this._store.activeItems.some((function(e){return e.highlighted}));({text:function(){i===t.input.element&&(t.containerOuter.removeFocusState(),n&&t.unhighlightAll(),t.hideDropdown(!0))},"select-one":function(){t.containerOuter.removeFocusState(),(i===t.input.element||i===t.containerOuter.element&&!t._canSearch)&&t.hideDropdown(!0)},"select-multiple":function(){i===t.input.element&&(t.containerOuter.removeFocusState(),t.hideDropdown(!0),n&&t.unhighlightAll())}})[this.passedElement.element.type]()}else this._isScrollingOnIe=!1,this.input.element.focus()},t._onFormReset=function(){this._store.dispatch({type:"RESET_TO",state:this._initialState})},t._highlightChoice=function(e){var t=this;void 0===e&&(e=null);var i=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(i.length){var n=e;Array.from(this.dropdown.element.querySelectorAll("."+this.config.classNames.highlightedState)).forEach((function(e){e.classList.remove(t.config.classNames.highlightedState),e.setAttribute("aria-selected","false")})),n?this._highlightPosition=i.indexOf(n):(n=i.length>this._highlightPosition?i[this._highlightPosition]:i[i.length-1])||(n=i[0]),n.classList.add(this.config.classNames.highlightedState),n.setAttribute("aria-selected","true"),this.passedElement.triggerEvent(X,{el:n}),this.dropdown.isActive&&(this.input.setActiveDescendant(n.id),this.containerOuter.setActiveDescendant(n.id))}},t._addItem=function(e){var t=e.value,i=e.label,n=void 0===i?null:i,s=e.choiceId,o=void 0===s?-1:s,r=e.groupId,a=void 0===r?-1:r,l=e.customProperties,c=void 0===l?null:l,h=e.placeholder,u=void 0!==h&&h,d=e.keyCode,p=void 0===d?null:d,f=S("String",t)?t.trim():t,m=p,v=c,g=this._store.items,_=n||f,b=parseInt(o,10)||-1,y=a>=0?this._store.getGroupById(a):null,E=g?g.length+1:1;return this.config.prependValue&&(f=this.config.prependValue+f.toString()),this.config.appendValue&&(f+=this.config.appendValue.toString()),this._store.dispatch(function(e){var t=e.value,i=e.label,n=e.id,s=e.choiceId,o=e.groupId,r=e.customProperties,a=e.placeholder,l=e.keyCode;return{type:ee,value:t,label:i,id:n,choiceId:s,groupId:o,customProperties:r,placeholder:a,keyCode:l}}({value:f,label:_,id:E,choiceId:b,groupId:a,customProperties:c,placeholder:u,keyCode:m})),this._isSelectOneElement&&this.removeActiveItems(E),this.passedElement.triggerEvent(W,{id:E,value:f,label:_,customProperties:v,groupValue:y&&y.value?y.value:void 0,keyCode:m}),this},t._removeItem=function(e){if(!e||!S("Object",e))return this;var t=e.id,i=e.value,n=e.label,s=e.choiceId,o=e.groupId,r=o>=0?this._store.getGroupById(o):null;return this._store.dispatch(function(e,t){return{type:te,id:e,choiceId:t}}(t,s)),r&&r.value?this.passedElement.triggerEvent(U,{id:t,value:i,label:n,groupValue:r.value}):this.passedElement.triggerEvent(U,{id:t,value:i,label:n}),this},t._addChoice=function(e){var t=e.value,i=e.label,n=void 0===i?null:i,s=e.isSelected,o=void 0!==s&&s,r=e.isDisabled,a=void 0!==r&&r,l=e.groupId,c=void 0===l?-1:l,h=e.customProperties,u=void 0===h?null:h,d=e.placeholder,p=void 0!==d&&d,f=e.keyCode,m=void 0===f?null:f;if(null!=t){var v=this._store.choices,g=n||t,_=v?v.length+1:1,b=this._baseId+"-"+this._idNames.itemChoice+"-"+_;this._store.dispatch(function(e){var t=e.value,i=e.label,n=e.id,s=e.groupId,o=e.disabled,r=e.elementId,a=e.customProperties,l=e.placeholder,c=e.keyCode;return{type:Y,value:t,label:i,id:n,groupId:s,disabled:o,elementId:r,customProperties:a,placeholder:l,keyCode:c}}({value:t,label:g,id:_,groupId:c,disabled:a,elementId:b,customProperties:u,placeholder:p,keyCode:m})),o&&this._addItem({value:t,label:g,choiceId:_,customProperties:u,placeholder:p,keyCode:m})}},t._addGroup=function(e){var t=this,i=e.group,n=e.id,s=e.valueKey,o=void 0===s?"value":s,r=e.labelKey,a=void 0===r?"label":r,l=S("Object",i)?i.choices:Array.from(i.getElementsByTagName("OPTION")),c=n||Math.floor((new Date).valueOf()*Math.random()),h=!!i.disabled&&i.disabled;if(l){this._store.dispatch(we(i.label,c,!0,h));l.forEach((function(e){var i=e.disabled||e.parentNode&&e.parentNode.disabled;t._addChoice({value:e[o],label:S("Object",e)?e[a]:e.innerHTML,isSelected:e.selected,isDisabled:i,groupId:c,customProperties:e.customProperties,placeholder:e.placeholder})}))}else this._store.dispatch(we(i.label,i.id,!1,i.disabled))},t._getTemplate=function(e){var t;if(!e)return null;for(var i=this.config,n=i.templates,s=i.classNames,o=arguments.length,r=new Array(o>1?o-1:0),a=1;a<o;a++)r[a-1]=arguments[a];return(t=n[e]).call.apply(t,[this,s].concat(r))},t._createTemplates=function(){var e=this.config.callbackOnCreateTemplates,t={};e&&S("Function",e)&&(t=e.call(this,C)),this.config.templates=r()(Ee,t)},t._createElements=function(){this.containerOuter=new N({element:this._getTemplate("containerOuter",this._direction,this._isSelectElement,this._isSelectOneElement,this.config.searchEnabled,this.passedElement.element.type),classNames:this.config.classNames,type:this.passedElement.element.type,position:this.config.position}),this.containerInner=new N({element:this._getTemplate("containerInner"),classNames:this.config.classNames,type:this.passedElement.element.type,position:this.config.position}),this.input=new K({element:this._getTemplate("input",this._placeholderValue),classNames:this.config.classNames,type:this.passedElement.element.type}),this.choiceList=new de({element:this._getTemplate("choiceList",this._isSelectOneElement)}),this.itemList=new de({element:this._getTemplate("itemList",this._isSelectOneElement)}),this.dropdown=new M({element:this._getTemplate("dropdown"),classNames:this.config.classNames,type:this.passedElement.element.type})},t._createStructure=function(){this.passedElement.conceal(),this.containerInner.wrap(this.passedElement.element),this.containerOuter.wrap(this.containerInner.element),this._isSelectOneElement?this.input.placeholder=this.config.searchPlaceholderValue||"":this._placeholderValue&&(this.input.placeholder=this._placeholderValue,this.input.setWidth(!0)),this.containerOuter.element.appendChild(this.containerInner.element),this.containerOuter.element.appendChild(this.dropdown.element),this.containerInner.element.appendChild(this.itemList.element),this._isTextElement||this.dropdown.element.appendChild(this.choiceList.element),this._isSelectOneElement?this.config.searchEnabled&&this.dropdown.element.insertBefore(this.input.element,this.dropdown.element.firstChild):this.containerInner.element.appendChild(this.input.element),this._isSelectElement?this._addPredefinedChoices():this._isTextElement&&this._addPredefinedItems()},t._addPredefinedChoices=function(){var e=this,t=this.passedElement.optionGroups;if(this._highlightPosition=0,this._isSearching=!1,this._setLoading(!0),t&&t.length){var i=this.passedElement.placeholderOption;i&&"SELECT"===i.parentNode.tagName&&this._addChoice({value:i.value,label:i.innerHTML,isSelected:i.selected,isDisabled:i.disabled,placeholder:!0}),t.forEach((function(t){return e._addGroup({group:t,id:t.id||null})}))}else{var n=this.passedElement.options,s=this.config.sortFn,o=this._presetChoices;n.forEach((function(e){o.push({value:e.value,label:e.innerHTML,selected:e.selected,disabled:e.disabled||e.parentNode.disabled,placeholder:e.hasAttribute("placeholder"),customProperties:e.getAttribute("data-custom-properties")})})),this.config.shouldSort&&o.sort(s);var r=o.some((function(e){return e.selected}));o.forEach((function(t,i){return function(t,i){var n=t.value,s=t.label,o=t.customProperties,a=t.placeholder;if(e._isSelectElement)if(t.choices)e._addGroup({group:t,id:t.id||null});else{var l=e._isSelectOneElement&&!r&&0===i,c=!!l||t.selected,h=!l&&t.disabled;e._addChoice({value:n,label:s,isSelected:c,isDisabled:h,customProperties:o,placeholder:a})}else e._addChoice({value:n,label:s,isSelected:t.selected,isDisabled:t.disabled,customProperties:o,placeholder:a})}(t,i)}))}this._setLoading(!1)},t._addPredefinedItems=function(){var e=this;this._presetItems.forEach((function(t){return function(t){var i=E(t);"Object"===i&&t.value?e._addItem({value:t.value,label:t.label,choiceId:t.id,customProperties:t.customProperties,placeholder:t.placeholder}):"String"===i&&e._addItem({value:t})}(t)}))},t._setChoiceOrItem=function(e){var t=this;({object:function(){e.value&&(t._isTextElement?t._addItem({value:e.value,label:e.label,choiceId:e.id,customProperties:e.customProperties,placeholder:e.placeholder}):t._addChoice({value:e.value,label:e.label,isSelected:!0,isDisabled:!1,customProperties:e.customProperties,placeholder:e.placeholder}))},string:function(){t._isTextElement?t._addItem({value:e}):t._addChoice({value:e,label:e,isSelected:!0,isDisabled:!1})}})[E(e).toLowerCase()]()},t._findAndSelectChoiceByValue=function(e){var t=this,i=this._store.choices.find((function(i){return t.config.itemComparer(i.value,e)}));i&&!i.selected&&this._addItem({value:i.value,label:i.label,choiceId:i.id,groupId:i.groupId,customProperties:i.customProperties,placeholder:i.placeholder,keyCode:i.keyCode})},t._generateInstances=function(t,i){return t.reduce((function(t,n){return t.push(new e(n,i)),t}),[this])},t._generatePlaceholderValue=function(){return!this._isSelectOneElement&&(!!this.config.placeholder&&(this.config.placeholderValue||this.passedElement.element.getAttribute("placeholder")))},e}();Oe.userDefaults={};t.default=Oe}]).default;