Choices/assets/scripts/dist/bundle.js
2016-04-29 17:11:20 +01:00

2 lines
33 KiB
JavaScript

!function(e){function t(n){if(i[n])return i[n].exports;var o=i[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var i={};return t.m=e,t.c=i,t.p="/assets/scripts/dist/",t(0)}([function(e,t,i){e.exports=i(1)},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.Choices=void 0;var r=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}}(),s=i(2),a=i(13),c=n(a),l=i(17),u=i(18),d=i(19),h=n(d),p=t.Choices=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?"[data-choice]":arguments[0],i=arguments[1];o(this,e);var n=document.createElement("fakeel"),r="querySelector"in document&&"addEventListener"in document&&"classList"in n;r||console.error("init: Your browser doesn'nt support Choices");var a=i||{};if((0,u.isType)("String",t)){var l=document.querySelectorAll(t);if(l.length>1)for(var d=1;d<l.length;d++){var h=l[d];new e(h,i)}}var p={items:[],addItems:!0,removeItems:!0,editItems:!1,maxItems:!1,delimiter:",",allowDuplicates:!0,allowPaste:!0,allowSearch:!0,regexFilter:!1,debug:!1,placeholder:!0,placeholderValue:"",prependValue:!1,appendValue:!1,selectAll:!0,classNames:{containerOuter:"choices",containerInner:"choices__inner",input:"choices__input",inputCloned:"choices__input--cloned",list:"choices__list",listItems:"choices__list--items",listDropdown:"choices__list--dropdown",item:"choices__item",itemSelectable:"choices__item--selectable",itemDisabled:"choices__item--disabled",itemOption:"choices__item--option",group:"choices__group",groupHeading:"choices__heading",activeState:"is-active",disabledState:"is-disabled",highlightedState:"is-highlighted",hiddenState:"is-hidden",flippedState:"is-flipped",selectedState:"is-selected"},callbackOnInit:function(){},callbackOnRender:function(){},callbackOnRemoveItem:function(){},callbackOnAddItem:function(){}};this.initialised=!1,this.options=(0,u.extend)(p,a||{}),this.store=(0,s.createStore)(c.default),this.passedElement=(0,u.isType)("String",t)?document.querySelector(t):t,this.presetItems=[],this.options.items.length?this.presetItems=this.options.items:""!==this.passedElement.value&&(this.presetItems=this.passedElement.value.split(this.options.delimiter)),this.init=this.init.bind(this),this.render=this.render.bind(this),this.destroy=this.destroy.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.onPaste=this.onPaste.bind(this);var f=this.options.classNames;this.templates={option:function(e){return(0,u.strToEl)('\n <div class="'+f.item+" "+f.itemOption+" "+(e.selected?f.selectedState+" "+f.itemDisabled:f.itemSelectable)+'" data-choice-option data-choice-id="'+e.id+'" data-choice-value="'+e.value+'">\n '+e.label+"\n </div>\n ")},optgroup:function(e){return(0,u.strToEl)('\n <div class="'+f.group+" "+(e.disabled?f.itemDisabled:"")+'" data-choice-value="'+e.value+'" data-choice-group-id="'+e.id+'">\n <div class="'+f.groupHeading+'">'+e.value+"</div>\n </div>\n ")},item:function(e){return(0,u.strToEl)('\n <div class="'+f.item+" "+f.itemOption+" "+(e.selected?f.selectedState+" "+f.itemDisabled:f.itemSelectable)+'" data-choice-option data-choice-id="'+e.id+'" data-choice-value="'+e.value+'">\n '+e.label+"\n </div>\n ")},notice:function(e){return(0,u.strToEl)('\n <div class="'+f.item+" "+f.itemOption+'" data-choice-notice>\n '+e+"\n </div>\n ")}},this.init()}return r(e,[{key:"isDisabled",value:function(){return!!this.input.disabled}},{key:"isEmpty",value:function(){return 0===this.store.getState().items.length}},{key:"hasSelectedItems",value:function(){var e=this.getItems();return e.some(function(e){return e.selected===!0})}},{key:"handleSelectAll",value:function(){this.options.removeItems&&!this.input.value&&this.options.selectAll&&this.input===document.activeElement&&this.selectAll(this.list.children)}},{key:"handleEnter",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1],i=!0;if("text"===this.passedElement.type&&(this.options.addItems?this.options.maxItems&&this.options.maxItems<=this.list.children.length?i=!1:this.options.allowDuplicates===!1&&this.passedElement.value&&(i=!e.some(function(e){return e.value===t})):i=!1),i){if("text"===this.passedElement.type){var n=!0;this.options.regexFilter&&(n=this.regexFilter(t)),n&&(this.addItem(t),this.clearInput(this.passedElement))}"select-multiple"===this.passedElement.type&&console.log("hit")}}},{key:"handleBackspaceKey",value:function(e){if(this.options.removeItems&&e){var t=e[e.length-1],i=e.some(function(e){return e.selected===!0});this.options.editItems&&!i&&t?(this.input.value=t.value,this.removeItem(t)):(this.selectItem(t),this.removeAllSelectedItems())}}},{key:"handleClick",value:function(e,t,i){var n=this;this.options.removeItems&&t&&!function(){var o=t.getAttribute("data-choice-id");e.forEach(function(e){e.id!==parseInt(o)||e.selected?i||n.deselectItem(e):n.selectItem(e)})}()}},{key:"onKeyDown",value:function(e){var t=this.getItemsFilteredByActive(),i=this.getOptionsFilteredByActive(),n=this.input===document.activeElement,o=e.ctrlKey||e.metaKey,r=46,s=8,a=13,c=65,l=27,u=38,d=40,h=this.dropdown&&this.dropdown.classList.contains(this.options.classNames.activeState),p=this.list&&this.list.children;if(e.target===this.input)switch(e.keyCode){case c:o&&p&&this.handleSelectAll();break;case a:if(e.target.value&&"text"===this.passedElement.type){var f=this.input.value;this.handleEnter(t,f)}if("select-multiple"===this.passedElement.type&&h){var v=this.dropdown.querySelector("."+this.options.classNames.highlightedState);if(v){var m=v.getAttribute("data-choice-value"),y=v.innerHTML,g=v.getAttribute("data-choice-id");this.addItem(m,y,g),this.input.value=""}}break;case l:"select-multiple"===this.passedElement.type&&h&&this.toggleDropdown();break;case d:case u:if("select-multiple"===this.passedElement.type&&h){var b=i.filter(function(e){return!e.selected}),I=!0;if(e.keyCode===d?this.highlightPosition<b.length-1?this.highlightPosition++:I=!1:e.keyCode===u&&(this.highlightPosition>0?this.highlightPosition--:I=!1),I){var E=b[this.highlightPosition];if(E){var w=this.dropdown.querySelector("."+this.options.classNames.highlightedState),O=this.dropdown.querySelector('[data-choice-id="'+E.id+'"]');w&&w.classList.remove(this.options.classNames.highlightedState),O&&O.classList.add(this.options.classNames.highlightedState)}}}break;case r:case s:n&&!e.target.value&&(this.handleBackspaceKey(t),e.preventDefault())}}},{key:"onKeyUp",value:function(e){var t=this;if(e.target===this.input&&"select-multiple"===this.passedElement.type&&this.options.allowSearch){var i=String.fromCharCode(e.keyCode);if(this.input===document.activeElement&&/[a-z0-9]/i.test(i))if(this.input.value){var n=(0,u.debounce)(function(){var e=t.getOptionsFiltedBySelectable(),i=new h.default(e),n=i.search(t.input.value,{fields:["label","value"],sort:[{field:"value",direction:"asc"}],limit:10});t.store.dispatch((0,l.filterOptions)(n))},100);n()}else this.store.dispatch((0,l.activateOptions)())}}},{key:"onClick",value:function(e){var t=this,i=e.shiftKey;if(this.dropdown&&this.toggleDropdown(),this.containerOuter.contains(e.target))if(this.input!==document.activeElement&&this.input.focus(),e.target.hasAttribute("data-choice-item")){var n=this.getItemsFilteredByActive(),o=e.target;this.handleClick(n,o,i)}else e.target.hasAttribute("data-choice-option")&&!function(){var i=t.getOptionsFilteredByActive(),n=e.target.getAttribute("data-choice-id"),o=i.find(function(e){return e.id===parseInt(n)});o.selected||t.addItem(o.value,o.label,o.id)}();else this.hasSelectedItems()&&this.deselectAll(),"select-multiple"===this.passedElement.type&&this.dropdown.classList.contains(this.options.classNames.activeState)&&this.toggleDropdown()}},{key:"onPaste",value:function(e){this.options.allowPaste||e.preventDefault()}},{key:"onFocus",value:function(e){this.containerOuter.classList.add(this.options.classNames.activeState)}},{key:"onBlur",value:function(e){this.containerOuter.classList.remove(this.options.classNames.activeState)}},{key:"clearInput",value:function(){this.input.value&&(this.input.value="")}},{key:"regexFilter",value:function(e){var t=new RegExp(this.options.regexFilter,"i"),i=t.test(e);return i}},{key:"getItemById",value:function(e){if(!e||!(0,u.isType)("Number",e))return void console.error("getItemById: An id was not given or was not a number");var t=this.getItems(),i=t.find(function(t){return t.id===parseInt(e)}),n=this.list.querySelector("[data-choice-id='"+i.id+"']");return n}},{key:"selectItem",value:function(e){if(e){var t=e.id;this.store.dispatch((0,l.selectItem)(t,!0))}}},{key:"deselectItem",value:function(e){if(e){var t=e.id;this.store.dispatch((0,l.selectItem)(t,!1))}}},{key:"selectAll",value:function(){var e=this,t=this.getItems();t.forEach(function(t){e.selectItem(t)})}},{key:"deselectAll",value:function(){var e=this,t=this.getItems();t.forEach(function(t){e.deselectItem(t)})}},{key:"addItem",value:function(e,t){var i=arguments.length<=2||void 0===arguments[2]?-1:arguments[2],n=arguments.length<=3||void 0===arguments[3]?this.options.callbackOnAddItem:arguments[3];this.options.debug&&console.debug("Add item");var o=e.trim(),r=t||o,s=i||-1;this.options.prependValue&&(o=this.options.prependValue+o.toString()),this.options.appendValue&&(o+=this.options.appendValue.toString());var a=this.store.getState().items.length+1;this.store.dispatch((0,l.addItem)(o,r,a,s)),n&&((0,u.isType)("Function",n)?n(a,e):console.error("callbackOnAddItem: Callback is not a function"))}},{key:"removeItem",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?this.options.callbackOnRemoveItem:arguments[1];if(!e||!(0,u.isType)("Object",e))return void console.error("removeItem: No item object was passed to be removed");var i=e.id,n=e.value,o=e.optionId;this.store.dispatch((0,l.removeItem)(i,o)),t&&((0,u.isType)("Function",t)?t(n):console.error("callbackOnRemoveItem: Callback is not a function"))}},{key:"removeItemsByValue",value:function(e){var t=this;e&&(0,u.isType)("String",e)||console.error("removeItemsByValue: No value was passed to be removed");var i=this.getItemsFilteredByActive();i.forEach(function(i){i.value===e&&t.removeItem(i)})}},{key:"removeAllItems",value:function(){var e=this,t=this.getItemsFilteredByActive();t.forEach(function(t){t.active&&e.removeItem(t)})}},{key:"removeAllSelectedItems",value:function(){var e=this,t=this.getItemsFilteredByActive();t.forEach(function(t){t.selected&&t.active&&e.removeItem(t)})}},{key:"showDropdown",value:function(){this.dropdown.classList.add(this.options.classNames.activeState);var e=this.dropdown.getBoundingClientRect();e.top+e.height>=document.body.offsetHeight?this.dropdown.classList.add(this.options.classNames.flippedState):this.dropdown.classList.remove(this.options.classNames.flippedState)}},{key:"hideDropdown",value:function(){var e=this.dropdown.classList.contains(this.options.classNames.flippedState);this.dropdown.classList.remove(this.options.classNames.activeState),e&&this.dropdown.classList.remove(this.options.classNames.flippedState)}},{key:"toggleDropdown",value:function(){if(this.dropdown){var e=this.dropdown.classList.contains(this.options.classNames.activeState);e?this.hideDropdown():this.showDropdown()}}},{key:"addOption",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?-1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],n=this.store.getState(),o=n.options.length+1,r=e.value,s=e.innerHTML,a=e.selected;this.store.dispatch((0,l.addOption)(r,s,o,t,i)),a&&this.addItem(r,s,o)}},{key:"addGroup",value:function(e,t,i,n){this.store.dispatch((0,l.addGroup)(e,t,i,n))}},{key:"getItems",value:function(){var e=this.store.getState();return e.items}},{key:"getItemsFilteredByActive",value:function(){var e=this.getItems(),t=e.filter(function(e){return e.active===!0},[]);return t}},{key:"getItemsReducedToValues",value:function(){var e=this.getItems(),t=e.reduce(function(e,t){return e.push(t.value),e},[]);return t}},{key:"getOptions",value:function(){var e=this.store.getState();return e.options}},{key:"getOptionsFilteredByActive",value:function(){var e=this.getOptions(),t=e.filter(function(e){return e.active===!0&&e.disabled===!1&&e.selected!==!0},[]);return t}},{key:"getOptionsFiltedBySelectable",value:function(){var e=this.getOptions(),t=e.filter(function(e){return e.disabled===!1},[]);return t}},{key:"getGroups",value:function(){var e=this.store.getState();return e.groups}},{key:"getGroupsFilteredByActive",value:function(){var e=this.getGroups(),t=this.getOptions(),i=e.filter(function(e){var i=e.active===!0&&e.disabled===!1,n=t.some(function(e){return e.active===!0&&e.disabled===!1});return!(!i||!n)},[]);return i}},{key:"generateInput",value:function(){var e=this,t=(0,u.strToEl)('<div class="'+this.options.classNames.containerOuter+'"></div>'),i=(0,u.strToEl)('<div class="'+this.options.classNames.containerInner+'"></div>');this.passedElement.classList.add(this.options.classNames.input,this.options.classNames.hiddenState),this.passedElement.tabIndex="-1",this.passedElement.setAttribute("style","display:none;"),this.passedElement.setAttribute("aria-hidden","true"),(0,u.wrap)(this.passedElement,i),(0,u.wrap)(i,t);var n=(0,u.strToEl)('<ul class="'+this.options.classNames.list+" "+this.options.classNames.listItems+'"></ul>'),o=(0,u.strToEl)('<input type="text" class="'+this.options.classNames.input+" "+this.options.classNames.inputCloned+'">');if(this.options.placeholder&&this.options.placeholderValue&&(o.placeholder=this.options.placeholderValue,o.style.width=(0,u.getWidthOfInput)(o)),this.options.addItems||(o.disabled=!0,t.classList.add(this.options.classNames.disabledState)),t.appendChild(i),i.appendChild(n),i.appendChild(o),"select-multiple"===this.passedElement.type){this.highlightPosition=0;var r=(0,u.strToEl)('<div class="'+this.options.classNames.list+" "+this.options.classNames.listDropdown+'"></div>'),s=Array.from(this.passedElement.getElementsByTagName("OPTGROUP"));if(t.appendChild(r),this.dropdown=r,s.length)s.forEach(function(t,i){var n=Array.from(t.getElementsByTagName("OPTION")),o=i;n?(e.addGroup(t.label,o,!0,t.disabled),n.forEach(function(i,n){t.disabled?e.addOption(i,o,!0):e.addOption(i,o)})):e.addGroup(t.label,o,!1,t.disabled)});else{var a=Array.from(this.passedElement.options);a.forEach(function(t){e.addOption(t)})}}else"text"===this.passedElement.type&&this.presetItems.forEach(function(t){e.addItem(t)});this.containerOuter=t,this.containerInner=i,this.input=o,this.list=n}},{key:"render",value:function(){var e=this,t=arguments.length<=0||void 0===arguments[0]?this.options.callbackOnRender:arguments[0],i=(this.options.classNames,this.getItemsFilteredByActive());"select-multiple"===this.passedElement.type&&!function(){var t=e.getOptionsFilteredByActive(),i=e.getGroupsFilteredByActive();e.dropdown.innerHTML="";var n=document.createDocumentFragment();if(i.length>=1?i.forEach(function(i,o){var r=t.filter(function(e){return e.groupId===i.id});r.length>=1&&!function(){var t=e.templates.optgroup(i);r.forEach(function(i,n){var o=e.templates.option(i);t.appendChild(o)}),n.appendChild(t)}()}):t.length>=1&&t.forEach(function(t,i){var o=e.templates.option(t);n.appendChild(o)}),e.dropdown.appendChild(n),""===e.dropdown.innerHTML){var o=e.templates.notice("No options to select");n.appendChild(o),e.dropdown.appendChild(n)}}(),i&&!function(){var t=e.getItemsReducedToValues();e.passedElement.value=t.join(e.options.delimiter),e.list.innerHTML="";var n=document.createDocumentFragment();i.forEach(function(t){var i=e.templates.item(t);n.appendChild(i)}),e.list.appendChild(n)}(),t&&((0,u.isType)("Function",t)?t(i):console.error("callbackOnRender: Callback is not a function"))}},{key:"addEventListeners",value:function(){document.addEventListener("keyup",this.onKeyUp),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("click",this.onClick),document.addEventListener("paste",this.onPaste),this.input.addEventListener("focus",this.onFocus),this.input.addEventListener("blur",this.onBlur)}},{key:"removeEventListeners",value:function(){document.removeEventListener("keyup",this.onKeyUp),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("click",this.onClick),document.removeEventListener("paste",this.onPaste),this.input.removeEventListener("focus",this.onFocus),this.input.removeEventListener("blur",this.onBlur)}},{key:"init",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this.options.callbackOnInit:arguments[0];this.initialised=!0,this.generateInput(),this.store.subscribe(this.render),this.render(),this.addEventListeners(),e&&((0,u.isType)("Function",e)?e():console.error("callbackOnInit: Callback is not a function"))}},{key:"destroy",value:function(){this.passedElement=null,this.userOptions=null,this.options=null,this.initialised=null,this.store=null}}]),e}();window.Choices=e.exports=p},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0,t.compose=t.applyMiddleware=t.bindActionCreators=t.combineReducers=t.createStore=void 0;var o=i(3),r=n(o),s=i(8),a=n(s),c=i(10),l=n(c),u=i(11),d=n(u),h=i(12),p=n(h),f=i(9);n(f);t.createStore=r.default,t.combineReducers=a.default,t.bindActionCreators=l.default,t.applyMiddleware=d.default,t.compose=p.default},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,i){function n(){f===p&&(f=p.slice())}function r(){return h}function c(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return n(),f.push(e),function(){if(t){t=!1,n();var i=f.indexOf(e);f.splice(i,1)}}}function l(e){if(!(0,s.default)(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if("undefined"==typeof e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(v)throw new Error("Reducers may not dispatch actions.");try{v=!0,h=d(h,e)}finally{v=!1}for(var t=p=f,i=0;i<t.length;i++)t[i]();return e}function u(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");d=e,l({type:a.INIT})}if("function"==typeof t&&"undefined"==typeof i&&(i=t,t=void 0),"undefined"!=typeof i){if("function"!=typeof i)throw new Error("Expected the enhancer to be a function.");return i(o)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var d=e,h=t,p=[],f=p,v=!1;return l({type:a.INIT}),{dispatch:l,subscribe:c,getState:r,replaceReducer:u}}t.__esModule=!0,t.ActionTypes=void 0,t.default=o;var r=i(4),s=n(r),a=t.ActionTypes={INIT:"@@redux/INIT"}},function(e,t,i){function n(e){if(!s(e)||h.call(e)!=a||r(e))return!1;var t=o(e);if(null===t)return!0;var i=u.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&l.call(i)==d}var o=i(5),r=i(6),s=i(7),a="[object Object]",c=Object.prototype,l=Function.prototype.toString,u=c.hasOwnProperty,d=l.call(Object),h=c.toString;e.exports=n},function(e,t){function i(e){return n(Object(e))}var n=Object.getPrototypeOf;e.exports=i},function(e,t){function i(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(i){}return t}e.exports=i},function(e,t){function i(e){return!!e&&"object"==typeof e}e.exports=i},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var i=t&&t.type,n=i&&'"'+i.toString()+'"'||"an action";return'Reducer "'+e+'" returned undefined handling '+n+". To ignore an action, you must explicitly return the previous state."}function r(e){Object.keys(e).forEach(function(t){var i=e[t],n=i(void 0,{type:a.ActionTypes.INIT});if("undefined"==typeof n)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.');var o="@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".");if("undefined"==typeof i(void 0,{type:o}))throw new Error('Reducer "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle "+a.ActionTypes.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.")})}function s(e){for(var t=Object.keys(e),i={},n=0;n<t.length;n++){var s=t[n];"function"==typeof e[s]&&(i[s]=e[s])}var a,c=Object.keys(i);try{r(i)}catch(l){a=l}return function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];if(a)throw a;for(var n=!1,r={},s=0;s<c.length;s++){var l=c[s],u=i[l],d=e[l],h=u(d,t);if("undefined"==typeof h){var p=o(l,t);throw new Error(p)}r[l]=h,n=n||h!==d}return n?r:e}}t.__esModule=!0,t.default=s;var a=i(3),c=i(4),l=(n(c),i(9));n(l)},function(e,t){"use strict";function i(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(t){}}t.__esModule=!0,t.default=i},function(e,t){"use strict";function i(e,t){return function(){return t(e.apply(void 0,arguments))}}function n(e,t){if("function"==typeof e)return i(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var n=Object.keys(e),o={},r=0;r<n.length;r++){var s=n[r],a=e[s];"function"==typeof a&&(o[s]=i(a,t))}return o}t.__esModule=!0,t.default=n},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];return function(e){return function(i,n,o){var s=e(i,n,o),c=s.dispatch,l=[],u={getState:s.getState,dispatch:function(e){return c(e)}};return l=t.map(function(e){return e(u)}),c=a.default.apply(void 0,l)(s.dispatch),r({},s,{dispatch:c})}}}var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e};t.__esModule=!0,t.default=o;var s=i(12),a=n(s)},function(e,t){"use strict";function i(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];return function(){if(0===t.length)return arguments.length<=0?void 0:arguments[0];var e=t[t.length-1],i=t.slice(0,-1);return i.reduceRight(function(e,t){return t(e)},e.apply(void 0,arguments))}}t.__esModule=!0,t.default=i},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),r=i(14),s=n(r),a=i(15),c=n(a),l=i(16),u=n(l),d=(0,o.combineReducers)({items:s.default,groups:c.default,options:u.default});t.default=d},function(e,t){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1];switch(t.type){case"ADD_ITEM":var n=[].concat(i(e),[{id:t.id,optionId:t.optionId,value:t.value,label:t.label,active:!0,selected:!1}]);return n.map(function(e){return e.selected&&(e.selected=!1),e});case"REMOVE_ITEM":return e.map(function(e){return e.id===t.id&&(e.active=!1),e});case"SELECT_ITEM":return e.map(function(e){return e.id===t.id&&(e.selected=t.selected),e});default:return e}};t.default=n},function(e,t){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1];switch(t.type){case"ADD_GROUP":return[].concat(i(e),[{id:t.id,value:t.value,active:t.active,disabled:t.disabled}]);default:return e}};t.default=n},function(e,t){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1];switch(t.type){case"ADD_OPTION":return[].concat(i(e),[{id:t.id,groupId:t.groupId,value:t.value,label:t.label,disabled:t.disabled,selected:!1,active:!0}]);case"ADD_ITEM":return t.optionId>-1?e.map(function(e){return e.id===parseInt(t.optionId)&&(e.selected=!0),e}):e;case"REMOVE_ITEM":return t.optionId>-1?e.map(function(e){return e.id===parseInt(t.optionId)&&(e.selected=!1),e}):e;case"FILTER_OPTIONS":var n=t.results.items,o=e.map(function(e,t){return e.active=n.some(function(e){return e.id===t}),e});return o;case"ACTIVATE_OPTIONS":return e.map(function(e){return e.active=t.active,e});default:return e}};t.default=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.addItem=function(e,t,i,n){return{type:"ADD_ITEM",value:e,label:t,id:i,optionId:n}},t.removeItem=function(e,t){return{type:"REMOVE_ITEM",id:e,optionId:t}},t.selectItem=function(e,t){return{type:"SELECT_ITEM",id:e,selected:t}},t.addOption=function(e,t,i,n,o){return{type:"ADD_OPTION",value:e,label:t,id:i,groupId:n,disabled:o}},t.filterOptions=function(e){return{type:"FILTER_OPTIONS",results:e}},t.activateOptions=function(){var e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0];return{type:"ACTIVATE_OPTIONS",active:e}},t.addGroup=function(e,t,i,n){return{type:"ADD_GROUP",value:e,id:t,active:i,disabled:n}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=(t.hasClass=function(e,t){return new RegExp(" "+t+" ").test(" "+e.className+" ")},t.capitalise=function(e){return e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})},t.isType=function(e,t){var i=Object.prototype.toString.call(t).slice(8,-1);return void 0!==t&&null!==t&&i===e}),n=(t.extend=function r(){for(var e={},t=!1,n=arguments.length,o=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&i("Object",n[o])?e[o]=r(!0,e[o],n[o]):e[o]=n[o])},s=0;n>s;s++){var a=arguments[s];i("Object",a)?o(a):console.error("Custom options must be an object")}return e},t.whichTransitionEvent=function(){var e,t=document.createElement("fakeelement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in i)if(void 0!==t.style[e])return i[e]},t.whichAnimationEvent=function(){var e,t=document.createElement("fakeelement"),i={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(e in i)if(void 0!==t.style[e])return i[e]}),o=(t.getParentsUntil=function(e,t,i){for(var n=[];e&&e!==document;e=e.parentNode){if(t){var o=t.charAt(0);if("."===o&&e.classList.contains(t.substr(1)))break;if("#"===o&&e.id===t.substr(1))break;if("["===o&&e.hasAttribute(t.substr(1,t.length-1)))break;if(e.tagName.toLowerCase()===t)break}if(i){var r=i.charAt(0);"."===r&&e.classList.contains(i.substr(1))&&n.push(e),"#"===r&&e.id===i.substr(1)&&n.push(e),"["===r&&e.hasAttribute(i.substr(1,i.length-1))&&n.push(e),e.tagName.toLowerCase()===i&&n.push(e)}else n.push(e)}return 0===n.length?null:n},t.wrap=function(e,t){return t=t||document.createElement("div"),e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),t.appendChild(e)},t.getSiblings=function(e){for(var t=[],i=e.parentNode.firstChild;i;i=i.nextSibling)1===i.nodeType&&i!==e&&t.push(i);return t},t.findAncestor=function(e,t){for(;(e=e.parentElement)&&!e.classList.contains(t););return e},t.debounce=function(e,t,i){var n;return function(){var o=this,r=arguments,s=function(){n=null,i||e.apply(o,r)},a=i&&!n;clearTimeout(n),n=setTimeout(s,t),a&&e.apply(o,r)}},t.getElemDistance=function(e){var t=0;if(e.offsetParent)do t+=e.offsetTop,e=e.offsetParent;while(e);return t>=0?t:0},t.getElementOffset=function(e,t){var i=t;return i>1&&(i=1),i>0&&(i=0),Math.max(e.offsetHeight*i)},t.getScrollPosition=function(e){return"bottom"===e?Math.max((window.scrollY||window.pageYOffset)+(window.innerHeight||document.documentElement.clientHeight)):window.scrollY||window.pageYOffset},t.isInView=function(e,t,i){return this.getScrollPosition(t)>this.getElemDistance(e)+this.getElementOffset(e,i)},t.stripHTML=function(e){var t=document.createElement("DIV");return t.innerHTML=e,t.textContent||t.innerText||""},t.addAnimation=function(e,t){var i=n(),o=function r(){e.classList.remove(t),e.removeEventListener(i,r,!1)};e.classList.add(t),e.addEventListener(i,o,!1)},t.getRandomNumber=function(e,t){return Math.floor(Math.random()*(t-e)+e)},t.strToEl=function(){var e=document.createElement("div");return function(t){var i;for(e.innerHTML=t,i=e.children[0];e.firstChild;)e.removeChild(e.firstChild);return i}}());t.getWidthOfInput=function(e){var t=arguments.length<=1||void 0===arguments[1]?20:arguments[1],i=e.value||e.placeholder,n=e.offsetWidth;if(i){var r=o('<span class="offscreen">'+i+"</span>");r.style.position="absolute",r.style.top="-9999px",r.style.left="-9999px",r.style.padding="0",r.style.width="auto",document.body.appendChild(r),r.offsetWidth>t&&r.offsetWidth!=e.offsetWidth&&(n=r.offsetWidth+t/4),document.body.removeChild(r)}return n+"px"}},function(e,t,i){var n,o;!function(r,s){n=s,o="function"==typeof n?n.call(t,i,t,e):n,!(void 0!==o&&(e.exports=o))}(this,function(){var e=function(e,t){this.items=e,this.settings=t||{diacritics:!0}};e.prototype.tokenize=function(e){if(e=n(String(e||"").toLowerCase()),!e||!e.length)return[];var t,i,r,a,c=[],l=e.split(/ +/);for(t=0,i=l.length;i>t;t++){if(r=o(l[t]),this.settings.diacritics)for(a in s)s.hasOwnProperty(a)&&(r=r.replace(new RegExp(a,"g"),s[a]));c.push({string:l[t],regex:new RegExp(r,"i")})}return c},e.prototype.iterator=function(e,t){var i;i=r(e)?Array.prototype.forEach||function(e){for(var t=0,i=this.length;i>t;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,n,o,r;i=this,e=i.prepareSearch(e,t),o=e.tokens,n=e.options.fields,r=o.length;var s=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},a=function(){var e=n.length;return e?1===e?function(e,t){return s(t[n[0]],e)}:function(t,i){for(var o=0,r=0;e>o;o++)r+=s(i[n[o]],t);return r/e}:function(){return 0}}();return r?1===r?function(e){return a(o[0],e)}:"and"===e.options.conjunction?function(e){for(var t,i=0,n=0;r>i;i++){if(t=a(o[i],e),0>=t)return 0;n+=t}return n/r}:function(e){for(var t=0,i=0;r>t;t++)i+=a(o[t],e);return i/r}:function(){return 0}},e.prototype.getSortFunction=function(e,i){var n,o,r,s,a,c,l,u,d,h,p;if(r=this,e=r.prepareSearch(e,i),p=!e.query&&i.sort_empty||i.sort,d=function(e,t){return"$score"===e?t.score:r.items[t.id][e]},a=[],p)for(n=0,o=p.length;o>n;n++)(e.query||"$score"!==p[n].field)&&a.push(p[n]);if(e.query){for(h=!0,n=0,o=a.length;o>n;n++)if("$score"===a[n].field){h=!1;break}h&&a.unshift({field:"$score",
direction:"desc"})}else for(n=0,o=a.length;o>n;n++)if("$score"===a[n].field){a.splice(n,1);break}for(u=[],n=0,o=a.length;o>n;n++)u.push("desc"===a[n].direction?-1:1);return c=a.length,c?1===c?(s=a[0].field,l=u[0],function(e,i){return l*t(d(s,e),d(s,i))}):function(e,i){var n,o,r;for(n=0;c>n;n++)if(r=a[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,s=t.sort_empty;return n&&!r(n)&&(t.fields=[n]),o&&!r(o)&&(t.sort=[o]),s&&!r(s)&&(t.sort_empty=[s]),{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),(t.filter===!1||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:t>e?-1:0:(e=a(String(e||"")),t=a(String(t||"")),e>t?1:t>e?-1:0)},i=function(e,t){var i,n,o,r;for(i=1,n=arguments.length;n>i;i++)if(r=arguments[i])for(o in r)r.hasOwnProperty(o)&&(e[o]=r[o]);return e},n=function(e){return(e+"").replace(/^\s+|\s+$|/g,"")},o=function(e){return(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},r=Array.isArray||"undefined"!=typeof $&&$.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s={a:"[aÀÁÂÃÄÅàáâãäåĀāąĄ]",c:"[cÇçćĆčČ]",d:"[dđĐďĎð]",e:"[eÈÉÊËèéêëěĚĒēęĘ]",i:"[iÌÍÎÏìíîïĪī]",l:"[lłŁ]",n:"[nÑñňŇńŃ]",o:"[oÒÓÔÕÕÖØòóôõöøŌō]",r:"[rřŘ]",s:"[sŠšśŚ]",t:"[tťŤ]",u:"[uÙÚÛÜùúûüůŮŪū]",y:"[yŸÿýÝ]",z:"[zŽžżŻźŹ]"},a=function(){var e,t,i,n,o="",r={};for(i in s)if(s.hasOwnProperty(i))for(n=s[i].substring(2,s[i].length-1),o+=n,e=0,t=n.length;t>e;e++)r[n.charAt(e)]=i;var a=new RegExp("["+o+"]","g");return function(e){return e.replace(a,function(e){return r[e]}).toLowerCase()}}();return e})}]);