Socket
Socket
Sign inDemoInstall

@dotburo/select-input

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotburo/select-input - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

2

dist/select-input-min.js

@@ -1,2 +0,2 @@

const t=document;class e{constructor(t,e={},s={}){this.options=Object.assign({},s,e),this._events=[],this.dom={el:this._setElement(t)}}on(t,e,s=null){return(s||this.dom.el).addEventListener(t,e=e.bind(this),!0),this._events.push({name:t,fn:e,el:s}),this}getElement(){return this.dom.el}remove(){this._events=this._events.filter(t=>(t.el||this.dom.el).removeEventListener(t.name,t.fn,!0)),this.dom.el.parentNode.removeChild(this.dom.el),this.dom=this.options=null}_setElement(e){if(!e&&!e.nodeType&&"string"!=typeof e)throw new Error("Wrong element type provided!");return e.nodeType?e:(this.options.parent||t).querySelector(e)}_trigger(e,s=null){let i;"function"==typeof CustomEvent?i=new CustomEvent(e,{detail:s}):(i=t.createEvent("Event")).initEvent(e,!0,!0),this.dom.el.dispatchEvent(i)}}var s={parent:null,items:[],current:null,allowAdd:!0,proposal:"Add {X} to the list?",notFound:"{X} not present in the list",allowRemove:!0,removalIcon:"&times;",placeHolder:"Type to search",sort:!0,order:"desc",maxHeight:0,onDelete:null,onCreate:null};const i=document;export default class extends e{constructor(t,e={}){super(t,e,s),this.options.items=this._convertItems(e.items),this.current=e.current?this._convertItem(e.current):{},this.__found=null,this.options.sort&&this._sortItems(),this._renderInit(),this._bindEvents()}_bindEvents(){let t=t=>{"Escape"!==t.key&&27!==t.keyCode&&this.dom.el.contains(t.target)||this.toggle(!1)};this.on("input",this._search),this.on("click",this._handleClick),this.on("keyup",this._handleKey),this.on("focusin",()=>this._renderListItems().toggle(!0),this.dom.input),this.on("keyup",t,i),this.on("click",t,i)}onDelete(t){return this.options.onDelete=t,this}onCreate(t){return this.options.onCreate=t,this}toggle(t=!1){return this.dom.el.firstElementChild.classList[t?"remove":"add"]("si-hide"),t||this.dom.input.blur(),this}getItems(){return this.options.items}getCurrent(){let t=Object.assign({},this.current);return delete t._lc,t}clearCurrent(){this.current={},this.dom.input.value="",this._clearSelected()}findItem(t){return t=t.nodeName?t.dataset.value:t,this.options.items.find(e=>e.value===t)}_setCurrent(t,e=null){return this.current=t,this.dom.input.value=t.value.toString(),this._setSelected(t,e),this}_setSelected(t,e=null){this._clearSelected(),(e=e||this.dom.list.querySelector(`li[data-value="${t.value}"]`))&&e.classList.add("si-current")}_clearSelected(){let t=this.dom.list.querySelector(".si-current");t&&t.classList.remove("si-current")}_convertItems(t=[]){return t.map(t=>this._convertItem(t))}_convertItem(t){return(t="object"!=typeof t?{value:t}:t)._lc=t.value.toString().toLowerCase(),t}_renderInit(){let t=i.createElement("div");return t.className="si-wrap si-hide",this.dom.input=t.appendChild(this._renderInput()).firstChild,this.dom.list=t.appendChild(this._renderList()).firstChild,this.current.value&&(this.dom.input.value=this.current.value),this.dom.el.appendChild(t)}_renderInput(){let t=i.createElement("div"),e=i.createElement("input");return t.className="si-input",e.type="text",e.autocomplete="false",e.spellcheck=!1,e.placeholder=this.options.placeHolder,t.appendChild(e),t}_renderList(){let t=i.createElement("div"),e=i.createElement("ul"),s=this.options.maxHeight;return t.className="si-list",s&&(t.style.maxHeight=s+"px"),t.appendChild(e),t}_createListItems(t=[]){let e="",s=this.current.value,i="",n=this.options.allowRemove?this._createRemovalButton():"";return t.forEach(t=>{i=s&&t.value===s?" si-current":"",e+=`<li class="si-item${i}" data-value="${t.value}">${t.value}${n}</li>`}),e}_renderListItems(t=""){return this.dom.list.innerHTML=t||this._createListItems(this.options.items),this}_createRemovalButton(){return`<button type="button" class="si-removal">${this.options.removalIcon}</button>`}_search(t){let e=null,s=this.options,i=t.target.value,n=i.toLowerCase(),r=s.items.filter(t=>-1!==t._lc.indexOf(n)),o=r||s.allowAdd?this._createListItems(r):"",l=r[0],a=r.length;1===a&&(e=l),(0===a||i&&n!==l._lc)&&s.allowAdd?(this.__found=e,o+=this._proposeItem(i)):0!==a||s.allowAdd||(o+=this._notFoundItem(i)),this._renderListItems(o)}_proposeItem(t){return`<li class="si-item si-append si-proposal" data-term="${t}">${this.options.proposal.replace("{X}",`<span>${t}</span>`)}</li>`}_notFoundItem(t){return`<li class="si-item si-append si-not-found">${this.options.notFound.replace("{X}",`<span>${t}</span>`)}</li>`}_handleClick(t){let e=t.target,s=e.classList;this.options.allowAdd&&s.contains("si-proposal")?this._tryCreateItem(e.dataset.term)&&this.toggle()._trigger("created",this.current):s.contains("si-item")?this._setCurrent(this.findItem(e),e).toggle()._trigger("selected",this.current):this.options.allowRemove&&s.contains("si-removal")&&(e=e.parentNode,this._fireCallback("onDelete",this.findItem(e))&&this._trigger("removed",this._sliceItem(e)))}_fireCallback(t,e){return"function"!=typeof this.options[t]||this.options[t](e)}_handleKey(t){let e,s=t.target.value,i=this.__found;s&&13!==t.keyCode&&"Enter"!==t.key||(!i&&s&&this.options.allowAdd?e=this._tryCreateItem(s)?"created":null:i&&(e="selected",this._setCurrent(i)),e&&this.toggle()._trigger(e,this.current))}_tryCreateItem(t){let e=this._convertItem(t.trim());return!(this.findItem(t)||!this._fireCallback("onCreate",e)||(this._setCurrent(this._insertItem(e)),0))}_insertItem(t){return this.options.items.push(t),this.options.sort&&this._sortItems(),t}_sortItems(){let t="desc"===this.options.order?1:-1;this.options.items.sort((e,s)=>e._lc<s._lc?-t:e._lc>s._lc?t:0)}_sliceItem(t){let e,s=this.options.items,i=t.dataset.value.toLowerCase(),n=this.current;return this.dom.list.removeChild(t),e=s.splice(s.findIndex(t=>t._lc===i),1).shift(),n&&e._lc===n._lc&&this.clearCurrent(),e}}
const t=document;class e{constructor(t,e={},s={}){this.options=Object.assign({},s,e),this._events=[],this.dom={el:this._setElement(t)}}on(t,e,s=null){return(s||this.dom.el).addEventListener(t,e=e.bind(this),!0),this._events.push({name:t,fn:e,el:s}),this}getElement(){return this.dom.el}remove(){this._events=this._events.filter(t=>(t.el||this.dom.el).removeEventListener(t.name,t.fn,!0)),this.dom.el.parentNode.removeChild(this.dom.el),this.dom=this.options=null}_setElement(e){if(!e&&!e.nodeType&&"string"!=typeof e)throw new Error("Wrong element type provided!");return e.nodeType?e:(this.options.parent||t).querySelector(e)}_trigger(e,s=null){let i;"function"==typeof CustomEvent?i=new CustomEvent(e,{detail:s,bubbles:!0,cancelable:!0}):(i=t.createEvent("Event")).initEvent(e,!0,!0),this.dom.el.dispatchEvent(i)}}var s={parent:null,items:[],current:null,allowAdd:!0,proposal:"Add {X} to the list?",notFound:"{X} not present in the list",allowRemove:!0,removalIcon:"&times;",placeHolder:"Type to search",sort:!0,order:"desc",maxHeight:0,onDelete:null,onCreate:null};const i=document;export default class extends e{constructor(t,e={}){super(t,e,s),this.options.items=this._convertItems(e.items),this.current=e.current?this._convertItem(e.current):{},this.__found=null,this.options.sort&&this._sortItems(),this._renderInit(),this._bindEvents()}_bindEvents(){let t=t=>{"Escape"!==t.key&&27!==t.keyCode&&this.dom.el.contains(t.target)||this.toggle(!1)};this.on("input",this._search),this.on("click",this._handleClick),this.on("keyup",this._handleKey),this.on("focusin",()=>this._renderListItems().toggle(!0),this.dom.input),this.on("keyup",t,i),this.on("click",t,i)}onDelete(t){return this.options.onDelete=t,this}onCreate(t){return this.options.onCreate=t,this}toggle(t=!1){return this.dom.el.firstElementChild.classList[t?"remove":"add"]("si-hide"),t||this.dom.input.blur(),this}getItems(){return this.options.items}getCurrent(){let t=Object.assign({},this.current);return delete t._lc,t}clearCurrent(){this.current={},this.dom.input.value="",this._clearSelected()}findItem(t){return t=t.nodeName?t.dataset.value:t,this.options.items.find(e=>e.value===t)}_setCurrent(t,e=null){return this.current=t,this.dom.input.value=t.value.toString(),this._setSelected(t,e),this}_setSelected(t,e=null){this._clearSelected(),(e=e||this.dom.list.querySelector(`li[data-value="${t.value}"]`))&&e.classList.add("si-current")}_clearSelected(){let t=this.dom.list.querySelector(".si-current");t&&t.classList.remove("si-current")}_convertItems(t=[]){return t.map(t=>this._convertItem(t))}_convertItem(t){return(t="object"!=typeof t?{value:t}:t)._lc=t.value.toString().toLowerCase(),t}_renderInit(){let t=i.createElement("div");return t.className="si-wrap si-hide",this.dom.input=t.appendChild(this._renderInput()).firstChild,this.dom.list=t.appendChild(this._renderList()).firstChild,this.current.value&&(this.dom.input.value=this.current.value),this.dom.el.appendChild(t)}_renderInput(){let t=i.createElement("div"),e=i.createElement("input");return t.className="si-input",e.type="text",e.autocomplete="false",e.spellcheck=!1,e.placeholder=this.options.placeHolder,t.appendChild(e),t}_renderList(){let t=i.createElement("div"),e=i.createElement("ul"),s=this.options.maxHeight;return t.className="si-list",s&&(t.style.maxHeight=s+"px"),t.appendChild(e),t}_createListItems(t=[]){let e="",s=this.current.value,i="",n=this.options.allowRemove?this._createRemovalButton():"";return t.forEach(t=>{i=s&&t.value===s?" si-current":"",e+=`<li class="si-item${i}" data-value="${t.value}">${t.value}${n}</li>`}),e}_renderListItems(t=""){return this.dom.list.innerHTML=t||this._createListItems(this.options.items),this}_createRemovalButton(){return`<button type="button" class="si-removal">${this.options.removalIcon}</button>`}_search(t){let e=null,s=this.options,i=t.target.value,n=i.toLowerCase(),r=s.items.filter(t=>-1!==t._lc.indexOf(n)),l=r||s.allowAdd?this._createListItems(r):"",o=r[0],a=r.length;1===a&&(e=o),(0===a||i&&n!==o._lc)&&s.allowAdd?(this.__found=e,l+=this._proposeItem(i)):0!==a||s.allowAdd||(l+=this._notFoundItem(i)),this._renderListItems(l)}_proposeItem(t){return`<li class="si-item si-append si-proposal" data-term="${t}">${this.options.proposal.replace("{X}",`<span>${t}</span>`)}</li>`}_notFoundItem(t){return`<li class="si-item si-append si-not-found">${this.options.notFound.replace("{X}",`<span>${t}</span>`)}</li>`}_handleClick(t){let e=t.target,s=e.classList;this.options.allowAdd&&s.contains("si-proposal")?this._tryCreateItem(e.dataset.term)&&this.toggle()._trigger("created",this.current):s.contains("si-item")?this._setCurrent(this.findItem(e),e).toggle()._trigger("selected",this.current):this.options.allowRemove&&s.contains("si-removal")&&(e=e.parentNode,this._fireCallback("onDelete",this.findItem(e))&&this._trigger("removed",this._sliceItem(e)))}_fireCallback(t,e){return"function"!=typeof this.options[t]||this.options[t](e)}_handleKey(t){let e,s=t.target.value,i=this.__found;s&&13!==t.keyCode&&"Enter"!==t.key||(!i&&s&&this.options.allowAdd?e=this._tryCreateItem(s)?"created":null:i&&(e="selected",this._setCurrent(i)),e&&this.toggle()._trigger(e,this.current))}_tryCreateItem(t){let e=this._convertItem(t.trim());return!(this.findItem(t)||!this._fireCallback("onCreate",e)||(this._setCurrent(this._insertItem(e)),0))}_insertItem(t){return this.options.items.push(t),this.options.sort&&this._sortItems(),t}_sortItems(){let t="desc"===this.options.order?1:-1;this.options.items.sort((e,s)=>e._lc<s._lc?-t:e._lc>s._lc?t:0)}_sliceItem(t){let e,s=this.options.items,i=t.dataset.value.toLowerCase(),n=this.current;return this.dom.list.removeChild(t),e=s.splice(s.findIndex(t=>t._lc===i),1).shift(),n&&e._lc===n._lc&&this.clearCurrent(),e}}
//# sourceMappingURL=select-input-min.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).SelectInput=e()}(this,function(){"use strict";function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),n=t(function(t){var e=t.exports={version:"2.6.3"};"number"==typeof __e&&(__e=e)}),r=(n.version,function(t){return"object"==typeof t?null!==t:"function"==typeof t}),i=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t},o=function(t){try{return!!t()}catch(t){return!0}},u=!o(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),c=e.document,s=r(c)&&r(c.createElement),a=function(t){return s?c.createElement(t):{}},l=!u&&!o(function(){return 7!=Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}),f=Object.defineProperty,p={f:u?Object.defineProperty:function(t,e,n){if(i(t),e=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}(e,!0),i(n),l)try{return f(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},h=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},v=u?function(t,e,n){return p.f(t,e,h(1,n))}:function(t,e,n){return t[e]=n,t},d={}.hasOwnProperty,y=function(t,e){return d.call(t,e)},m=0,g=Math.random(),_=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++m+g).toString(36))},b=t(function(t){var r=_("src"),i=Function.toString,o=(""+i).split("toString");n.inspectSource=function(t){return i.call(t)},(t.exports=function(t,n,i,u){var c="function"==typeof i;c&&(y(i,"name")||v(i,"name",n)),t[n]!==i&&(c&&(y(i,r)||v(i,r,t[n]?""+t[n]:o.join(String(n)))),t===e?t[n]=i:u?t[n]?t[n]=i:v(t,n,i):(delete t[n],v(t,n,i)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[r]||i.call(this)})}),S=function(t,e,n){if(function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}},k=function(t,r,i){var o,u,c,s,a=t&k.F,l=t&k.G,f=t&k.S,p=t&k.P,h=t&k.B,d=l?e:f?e[r]||(e[r]={}):(e[r]||{}).prototype,y=l?n:n[r]||(n[r]={}),m=y.prototype||(y.prototype={});for(o in l&&(i=r),i)c=((u=!a&&d&&void 0!==d[o])?d:i)[o],s=h&&u?S(c,e):p&&"function"==typeof c?S(Function.call,c):c,d&&b(d,o,c,t&k.U),y[o]!=c&&v(y,o,s),p&&m[o]!=c&&(m[o]=c)};e.core=n,k.F=1,k.G=2,k.S=4,k.P=8,k.B=16,k.W=32,k.U=64,k.R=128;var x=k,I={}.toString,w=function(t){return I.call(t).slice(8,-1)},E=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==w(t)?t.split(""):Object(t)},O=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},C=function(t){return Object(O(t))},L=Math.ceil,j=Math.floor,A=function(t){return isNaN(t=+t)?0:(t>0?j:L)(t)},T=Math.min,P=function(t){return t>0?T(A(t),9007199254740991):0},R=Array.isArray||function(t){return"Array"==w(t)},M=t(function(t){var r=e["__core-js_shared__"]||(e["__core-js_shared__"]={});(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:n.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),F=t(function(t){var n=M("wks"),r=e.Symbol,i="function"==typeof r;(t.exports=function(t){return n[t]||(n[t]=i&&r[t]||(i?r:_)("Symbol."+t))}).store=n}),N=F("species"),D=function(t,e){return new(function(t){var e;return R(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!R(e.prototype)||(e=void 0),r(e)&&null===(e=e[N])&&(e=void 0)),void 0===e?Array:e}(t))(e)},H=function(t,e){var n=1==t,r=2==t,i=3==t,o=4==t,u=6==t,c=5==t||u,s=e||D;return function(e,a,l){for(var f,p,h=C(e),v=E(h),d=S(a,l,3),y=P(v.length),m=0,g=n?s(e,y):r?s(e,0):void 0;y>m;m++)if((c||m in v)&&(p=d(f=v[m],m,h),t))if(n)g[m]=p;else if(p)switch(t){case 3:return!0;case 5:return f;case 6:return m;case 2:g.push(f)}else if(o)return!1;return u?-1:i||o?o:g}},G=F("unscopables"),$=Array.prototype;null==$[G]&&v($,G,{});var V=function(t){$[G][t]=!0},q=H(6),B="findIndex",X=!0;B in[]&&Array(1)[B](function(){X=!1}),x(x.P+x.F*X,"Array",{findIndex:function(t){return q(this,t,arguments.length>1?arguments[1]:void 0)}}),V(B);var U=p.f,W=Function.prototype,z=/^\s*function ([^ (]*)/;"name"in W||u&&U(W,"name",{configurable:!0,get:function(){try{return(""+this).match(z)[1]}catch(t){return""}}});var K,J,Q=function(t){return function(e,n){var r,i,o=String(O(e)),u=A(n),c=o.length;return u<0||u>=c?t?"":void 0:(r=o.charCodeAt(u))<55296||r>56319||u+1===c||(i=o.charCodeAt(u+1))<56320||i>57343?t?o.charAt(u):r:t?o.slice(u,u+2):i-56320+(r-55296<<10)+65536}}(!0),Y=function(t,e,n){return e+(n?Q(t,e).length:1)},Z=F("toStringTag"),tt="Arguments"==w(function(){return arguments}()),et=RegExp.prototype.exec,nt=function(t,e){var n,r,i,o,u=t.exec;if("function"==typeof u){var c=u.call(t,e);if("object"!=typeof c)throw new TypeError("RegExp exec method returned something other than an Object or null");return c}if("RegExp"!==(void 0===(n=t)?"Undefined":null===n?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(r=Object(n),Z))?i:tt?w(r):"Object"==(o=w(r))&&"function"==typeof r.callee?"Arguments":o))throw new TypeError("RegExp#exec called on incompatible receiver");return et.call(t,e)},rt=function(){var t=i(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},it=RegExp.prototype.exec,ot=String.prototype.replace,ut=it,ct=(K=/a/,J=/b*/g,it.call(K,"a"),it.call(J,"a"),0!==K.lastIndex||0!==J.lastIndex),st=void 0!==/()??/.exec("")[1];(ct||st)&&(ut=function(t){var e,n,r,i,o=this;return st&&(n=new RegExp("^"+o.source+"$(?!\\s)",rt.call(o))),ct&&(e=o.lastIndex),r=it.call(o,t),ct&&r&&(o.lastIndex=o.global?r.index+r[0].length:e),st&&r&&r.length>1&&ot.call(r[0],n,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)}),r});var at=ut;x({target:"RegExp",proto:!0,forced:at!==/./.exec},{exec:at});var lt=F("species"),ft=!o(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),pt=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2===n.length&&"a"===n[0]&&"b"===n[1]}(),ht=Math.max,vt=Math.min,dt=Math.floor,yt=/\$([$&`']|\d\d?|<[^>]*>)/g,mt=/\$([$&`']|\d\d?)/g;!function(t,e,n){var r=F(t),i=!o(function(){var e={};return e[r]=function(){return 7},7!=""[t](e)}),u=i?!o(function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[lt]=function(){return n}),n[r](""),!e}):void 0;if(!i||!u||"replace"===t&&!ft||"split"===t&&!pt){var c=/./[r],s=n(O,r,""[t],function(t,e,n,r,o){return e.exec===at?i&&!o?{done:!0,value:c.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),a=s[0],l=s[1];b(String.prototype,t,a),v(RegExp.prototype,r,2==e?function(t,e){return l.call(t,this,e)}:function(t){return l.call(t,this)})}}("replace",2,function(t,e,n,r){return[function(r,i){var o=t(this),u=null==r?void 0:r[e];return void 0!==u?u.call(r,o,i):n.call(String(o),r,i)},function(t,e){var u=r(n,t,this,e);if(u.done)return u.value;var c=i(t),s=String(this),a="function"==typeof e;a||(e=String(e));var l=c.global;if(l){var f=c.unicode;c.lastIndex=0}for(var p=[];;){var h=nt(c,s);if(null===h)break;if(p.push(h),!l)break;""===String(h[0])&&(c.lastIndex=Y(s,P(c.lastIndex),f))}for(var v,d="",y=0,m=0;m<p.length;m++){h=p[m];for(var g=String(h[0]),_=ht(vt(A(h.index),s.length),0),b=[],S=1;S<h.length;S++)b.push(void 0===(v=h[S])?v:String(v));var k=h.groups;if(a){var x=[g].concat(b,_,s);void 0!==k&&x.push(k);var I=String(e.apply(void 0,x))}else I=o(g,s,_,b,k,e);_>=y&&(d+=s.slice(y,_)+I,y=_+g.length)}return d+s.slice(y)}];function o(t,e,r,i,o,u){var c=r+t.length,s=i.length,a=mt;return void 0!==o&&(o=C(o),a=yt),n.call(u,a,function(n,u){var a;switch(u.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,r);case"'":return e.slice(c);case"<":a=o[u.slice(1,-1)];break;default:var l=+u;if(0===l)return n;if(l>s){var f=dt(l/10);return 0===f?n:f<=s?void 0===i[f-1]?u.charAt(1):i[f-1]+u.charAt(1):n}a=i[l-1]}return void 0===a?"":a})}});var gt,_t=function(t,e){return{value:e,done:!!t}},bt={},St=function(t){return E(O(t))},kt=Math.max,xt=Math.min,It=M("keys"),wt=function(t){return It[t]||(It[t]=_(t))},Et=(gt=!1,function(t,e,n){var r,i=St(t),o=P(i.length),u=function(t,e){return(t=A(t))<0?kt(t+e,0):xt(t,e)}(n,o);if(gt&&e!=e){for(;o>u;)if((r=i[u++])!=r)return!0}else for(;o>u;u++)if((gt||u in i)&&i[u]===e)return gt||u||0;return!gt&&-1}),Ot=wt("IE_PROTO"),Ct="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Lt=Object.keys||function(t){return function(t,e){var n,r=St(t),i=0,o=[];for(n in r)n!=Ot&&y(r,n)&&o.push(n);for(;e.length>i;)y(r,n=e[i++])&&(~Et(o,n)||o.push(n));return o}(t,Ct)},jt=u?Object.defineProperties:function(t,e){i(t);for(var n,r=Lt(e),o=r.length,u=0;o>u;)p.f(t,n=r[u++],e[n]);return t},At=e.document,Tt=At&&At.documentElement,Pt=wt("IE_PROTO"),Rt=function(){},Mt=function(){var t,e=a("iframe"),n=Ct.length;for(e.style.display="none",Tt.appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),Mt=t.F;n--;)delete Mt.prototype[Ct[n]];return Mt()},Ft=Object.create||function(t,e){var n;return null!==t?(Rt.prototype=i(t),n=new Rt,Rt.prototype=null,n[Pt]=t):n=Mt(),void 0===e?n:jt(n,e)},Nt=p.f,Dt=F("toStringTag"),Ht=function(t,e,n){t&&!y(t=n?t:t.prototype,Dt)&&Nt(t,Dt,{configurable:!0,value:e})},Gt={};v(Gt,F("iterator"),function(){return this});var $t=function(t,e,n){t.prototype=Ft(Gt,{next:h(1,n)}),Ht(t,e+" Iterator")},Vt=wt("IE_PROTO"),qt=Object.prototype,Bt=Object.getPrototypeOf||function(t){return t=C(t),y(t,Vt)?t[Vt]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?qt:null},Xt=F("iterator"),Ut=!([].keys&&"next"in[].keys()),Wt=function(){return this},zt=function(t,e,n,r,i,o,u){$t(n,e,r);var c,s,a,l=function(t){if(!Ut&&t in d)return d[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},f=e+" Iterator",p="values"==i,h=!1,d=t.prototype,y=d[Xt]||d["@@iterator"]||i&&d[i],m=y||l(i),g=i?p?l("entries"):m:void 0,_="Array"==e&&d.entries||y;if(_&&(a=Bt(_.call(new t)))!==Object.prototype&&a.next&&(Ht(a,f,!0),"function"!=typeof a[Xt]&&v(a,Xt,Wt)),p&&y&&"values"!==y.name&&(h=!0,m=function(){return y.call(this)}),(Ut||h||!d[Xt])&&v(d,Xt,m),bt[e]=m,bt[f]=Wt,i)if(c={values:p?m:l("values"),keys:o?m:l("keys"),entries:g},u)for(s in c)s in d||b(d,s,c[s]);else x(x.P+x.F*(Ut||h),e,c);return c}(Array,"Array",function(t,e){this._t=St(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,_t(1)):_t(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values");bt.Arguments=bt.Array,V("keys"),V("values"),V("entries");for(var Kt=F("iterator"),Jt=F("toStringTag"),Qt=bt.Array,Yt={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},Zt=Lt(Yt),te=0;te<Zt.length;te++){var ee,ne=Zt[te],re=Yt[ne],ie=e[ne],oe=ie&&ie.prototype;if(oe&&(oe[Kt]||v(oe,Kt,Qt),oe[Jt]||v(oe,Jt,ne),bt[ne]=Qt,re))for(ee in zt)oe[ee]||b(oe,ee,zt[ee],!0)}function ue(t){return(ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ce(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function se(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ae(t,e,n){return e&&se(t.prototype,e),n&&se(t,n),t}function le(t){return(le=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function fe(t,e){return(fe=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function pe(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}u&&"g"!=/./g.flags&&p.f(RegExp.prototype,"flags",{configurable:!0,get:rt});var he=/./.toString,ve=function(t){b(RegExp.prototype,"toString",t,!0)};o(function(){return"/a/b"!=he.call({source:"a",flags:"b"})})?ve(function(){var t=i(this);return"/".concat(t.source,"/","flags"in t?t.flags:!u&&t instanceof RegExp?rt.call(t):void 0)}):"toString"!=he.name&&ve(function(){return he.call(this)});var de=H(5),ye=!0;"find"in[]&&Array(1).find(function(){ye=!1}),x(x.P+x.F*ye,"Array",{find:function(t){return de(this,t,arguments.length>1?arguments[1]:void 0)}}),V("find");var me={f:Object.getOwnPropertySymbols},ge={f:{}.propertyIsEnumerable},_e=Object.assign,be=!_e||o(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=_e({},t)[n]||Object.keys(_e({},e)).join("")!=r})?function(t,e){for(var n=C(t),r=arguments.length,i=1,o=me.f,u=ge.f;r>i;)for(var c,s=E(arguments[i++]),a=o?Lt(s).concat(o(s)):Lt(s),l=a.length,f=0;l>f;)u.call(s,c=a[f++])&&(n[c]=s[c]);return n}:_e;x(x.S+x.F,"Object",{assign:be});var Se=document,ke=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};ce(this,t),this.options=Object.assign({},r,n),this._events=[],this.dom={el:this._setElement(e)}}return ae(t,[{key:"on",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return(n||this.dom.el).addEventListener(t,e=e.bind(this),!0),this._events.push({name:t,fn:e,el:n}),this}},{key:"getElement",value:function(){return this.dom.el}},{key:"remove",value:function(){var t=this;this._events=this._events.filter(function(e){return(e.el||t.dom.el).removeEventListener(e.name,e.fn,!0)}),this.dom.el.parentNode.removeChild(this.dom.el),this.dom=this.options=null}},{key:"_setElement",value:function(t){if(!t&&!t.nodeType&&"string"!=typeof t)throw new Error("Wrong element type provided!");return t.nodeType?t:(this.options.parent||Se).querySelector(t)}},{key:"_trigger",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;"function"==typeof CustomEvent?e=new CustomEvent(t,{detail:n}):(e=Se.createEvent("Event")).initEvent(t,!0,!0),this.dom.el.dispatchEvent(e)}}]),t}(),xe={parent:null,items:[],current:null,allowAdd:!0,proposal:"Add {X} to the list?",notFound:"{X} not present in the list",allowRemove:!0,removalIcon:"&times;",placeHolder:"Type to search",sort:!0,order:"desc",maxHeight:0,onDelete:null,onCreate:null},Ie=document;return function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ce(this,e),(n=pe(this,le(e).call(this,t,r,xe))).options.items=n._convertItems(r.items),n.current=r.current?n._convertItem(r.current):{},n.__found=null,n.options.sort&&n._sortItems(),n._renderInit(),n._bindEvents(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&fe(t,e)}(e,ke),ae(e,[{key:"_bindEvents",value:function(){var t=this,e=function(e){"Escape"!==e.key&&27!==e.keyCode&&t.dom.el.contains(e.target)||t.toggle(!1)};this.on("input",this._search),this.on("click",this._handleClick),this.on("keyup",this._handleKey),this.on("focusin",function(){return t._renderListItems().toggle(!0)},this.dom.input),this.on("keyup",e,Ie),this.on("click",e,Ie)}},{key:"onDelete",value:function(t){return this.options.onDelete=t,this}},{key:"onCreate",value:function(t){return this.options.onCreate=t,this}},{key:"toggle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.dom.el.firstElementChild.classList[t?"remove":"add"]("si-hide"),t||this.dom.input.blur(),this}},{key:"getItems",value:function(){return this.options.items}},{key:"getCurrent",value:function(){var t=Object.assign({},this.current);return delete t._lc,t}},{key:"clearCurrent",value:function(){this.current={},this.dom.input.value="",this._clearSelected()}},{key:"findItem",value:function(t){return t=t.nodeName?t.dataset.value:t,this.options.items.find(function(e){return e.value===t})}},{key:"_setCurrent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.current=t,this.dom.input.value=t.value.toString(),this._setSelected(t,e),this}},{key:"_setSelected",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._clearSelected(),(e=e||this.dom.list.querySelector('li[data-value="'.concat(t.value,'"]')))&&e.classList.add("si-current")}},{key:"_clearSelected",value:function(){var t=this.dom.list.querySelector(".si-current");t&&t.classList.remove("si-current")}},{key:"_convertItems",value:function(){var t=this;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(function(e){return t._convertItem(e)})}},{key:"_convertItem",value:function(t){return(t="object"!==ue(t)?{value:t}:t)._lc=t.value.toString().toLowerCase(),t}},{key:"_renderInit",value:function(){var t=Ie.createElement("div");return t.className="si-wrap si-hide",this.dom.input=t.appendChild(this._renderInput()).firstChild,this.dom.list=t.appendChild(this._renderList()).firstChild,this.current.value&&(this.dom.input.value=this.current.value),this.dom.el.appendChild(t)}},{key:"_renderInput",value:function(){var t=Ie.createElement("div"),e=Ie.createElement("input");return t.className="si-input",e.type="text",e.autocomplete="false",e.spellcheck=!1,e.placeholder=this.options.placeHolder,t.appendChild(e),t}},{key:"_renderList",value:function(){var t=Ie.createElement("div"),e=Ie.createElement("ul"),n=this.options.maxHeight;return t.className="si-list",n&&(t.style.maxHeight=n+"px"),t.appendChild(e),t}},{key:"_createListItems",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e="",n=this.current.value,r="",i=this.options.allowRemove?this._createRemovalButton():"";return t.forEach(function(t){r=n&&t.value===n?" si-current":"",e+='<li class="si-item'.concat(r,'" data-value="').concat(t.value,'">').concat(t.value).concat(i,"</li>")}),e}},{key:"_renderListItems",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.dom.list.innerHTML=t||this._createListItems(this.options.items),this}},{key:"_createRemovalButton",value:function(){return'<button type="button" class="si-removal">'.concat(this.options.removalIcon,"</button>")}},{key:"_search",value:function(t){var e=null,n=this.options,r=t.target.value,i=r.toLowerCase(),o=n.items.filter(function(t){return-1!==t._lc.indexOf(i)}),u=o||n.allowAdd?this._createListItems(o):"",c=o[0],s=o.length;1===s&&(e=c),(0===s||r&&i!==c._lc)&&n.allowAdd?(this.__found=e,u+=this._proposeItem(r)):0!==s||n.allowAdd||(u+=this._notFoundItem(r)),this._renderListItems(u)}},{key:"_proposeItem",value:function(t){var e=this.options.proposal.replace("{X}","<span>".concat(t,"</span>"));return'<li class="si-item si-append si-proposal" data-term="'.concat(t,'">').concat(e,"</li>")}},{key:"_notFoundItem",value:function(t){var e=this.options.notFound.replace("{X}","<span>".concat(t,"</span>"));return'<li class="si-item si-append si-not-found">'.concat(e,"</li>")}},{key:"_handleClick",value:function(t){var e=t.target,n=e.classList;this.options.allowAdd&&n.contains("si-proposal")?this._tryCreateItem(e.dataset.term)&&this.toggle()._trigger("created",this.current):n.contains("si-item")?this._setCurrent(this.findItem(e),e).toggle()._trigger("selected",this.current):this.options.allowRemove&&n.contains("si-removal")&&(e=e.parentNode,this._fireCallback("onDelete",this.findItem(e))&&this._trigger("removed",this._sliceItem(e)))}},{key:"_fireCallback",value:function(t,e){return"function"!=typeof this.options[t]||this.options[t](e)}},{key:"_handleKey",value:function(t){var e,n=t.target.value,r=this.__found;n&&13!==t.keyCode&&"Enter"!==t.key||(!r&&n&&this.options.allowAdd?e=this._tryCreateItem(n)?"created":null:r&&(e="selected",this._setCurrent(r)),e&&this.toggle()._trigger(e,this.current))}},{key:"_tryCreateItem",value:function(t){var e=this._convertItem(t.trim());return!(this.findItem(t)||!this._fireCallback("onCreate",e))&&(this._setCurrent(this._insertItem(e)),!0)}},{key:"_insertItem",value:function(t){return this.options.items.push(t),this.options.sort&&this._sortItems(),t}},{key:"_sortItems",value:function(){var t="desc"===this.options.order?1:-1;this.options.items.sort(function(e,n){return e._lc<n._lc?-t:e._lc>n._lc?t:0})}},{key:"_sliceItem",value:function(t){var e,n=this.options.items,r=t.dataset.value.toLowerCase(),i=this.current;return this.dom.list.removeChild(t),e=n.splice(n.findIndex(function(t){return t._lc===r}),1).shift(),i&&e._lc===i._lc&&this.clearCurrent(),e}}]),e}()});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).SelectInput=e()}(this,function(){"use strict";function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),n=t(function(t){var e=t.exports={version:"2.6.3"};"number"==typeof __e&&(__e=e)}),r=(n.version,function(t){return"object"==typeof t?null!==t:"function"==typeof t}),i=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t},o=function(t){try{return!!t()}catch(t){return!0}},u=!o(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),c=e.document,s=r(c)&&r(c.createElement),a=function(t){return s?c.createElement(t):{}},l=!u&&!o(function(){return 7!=Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}),f=Object.defineProperty,p={f:u?Object.defineProperty:function(t,e,n){if(i(t),e=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}(e,!0),i(n),l)try{return f(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},h=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},v=u?function(t,e,n){return p.f(t,e,h(1,n))}:function(t,e,n){return t[e]=n,t},d={}.hasOwnProperty,y=function(t,e){return d.call(t,e)},m=0,g=Math.random(),_=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++m+g).toString(36))},b=t(function(t){var r=_("src"),i=Function.toString,o=(""+i).split("toString");n.inspectSource=function(t){return i.call(t)},(t.exports=function(t,n,i,u){var c="function"==typeof i;c&&(y(i,"name")||v(i,"name",n)),t[n]!==i&&(c&&(y(i,r)||v(i,r,t[n]?""+t[n]:o.join(String(n)))),t===e?t[n]=i:u?t[n]?t[n]=i:v(t,n,i):(delete t[n],v(t,n,i)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[r]||i.call(this)})}),S=function(t,e,n){if(function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}},k=function(t,r,i){var o,u,c,s,a=t&k.F,l=t&k.G,f=t&k.S,p=t&k.P,h=t&k.B,d=l?e:f?e[r]||(e[r]={}):(e[r]||{}).prototype,y=l?n:n[r]||(n[r]={}),m=y.prototype||(y.prototype={});for(o in l&&(i=r),i)c=((u=!a&&d&&void 0!==d[o])?d:i)[o],s=h&&u?S(c,e):p&&"function"==typeof c?S(Function.call,c):c,d&&b(d,o,c,t&k.U),y[o]!=c&&v(y,o,s),p&&m[o]!=c&&(m[o]=c)};e.core=n,k.F=1,k.G=2,k.S=4,k.P=8,k.B=16,k.W=32,k.U=64,k.R=128;var x=k,I={}.toString,w=function(t){return I.call(t).slice(8,-1)},E=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==w(t)?t.split(""):Object(t)},O=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},C=function(t){return Object(O(t))},L=Math.ceil,j=Math.floor,A=function(t){return isNaN(t=+t)?0:(t>0?j:L)(t)},T=Math.min,P=function(t){return t>0?T(A(t),9007199254740991):0},R=Array.isArray||function(t){return"Array"==w(t)},M=t(function(t){var r=e["__core-js_shared__"]||(e["__core-js_shared__"]={});(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:n.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),F=t(function(t){var n=M("wks"),r=e.Symbol,i="function"==typeof r;(t.exports=function(t){return n[t]||(n[t]=i&&r[t]||(i?r:_)("Symbol."+t))}).store=n}),N=F("species"),D=function(t,e){return new(function(t){var e;return R(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!R(e.prototype)||(e=void 0),r(e)&&null===(e=e[N])&&(e=void 0)),void 0===e?Array:e}(t))(e)},H=function(t,e){var n=1==t,r=2==t,i=3==t,o=4==t,u=6==t,c=5==t||u,s=e||D;return function(e,a,l){for(var f,p,h=C(e),v=E(h),d=S(a,l,3),y=P(v.length),m=0,g=n?s(e,y):r?s(e,0):void 0;y>m;m++)if((c||m in v)&&(p=d(f=v[m],m,h),t))if(n)g[m]=p;else if(p)switch(t){case 3:return!0;case 5:return f;case 6:return m;case 2:g.push(f)}else if(o)return!1;return u?-1:i||o?o:g}},G=F("unscopables"),$=Array.prototype;null==$[G]&&v($,G,{});var V=function(t){$[G][t]=!0},q=H(6),B="findIndex",X=!0;B in[]&&Array(1)[B](function(){X=!1}),x(x.P+x.F*X,"Array",{findIndex:function(t){return q(this,t,arguments.length>1?arguments[1]:void 0)}}),V(B);var U=p.f,W=Function.prototype,z=/^\s*function ([^ (]*)/;"name"in W||u&&U(W,"name",{configurable:!0,get:function(){try{return(""+this).match(z)[1]}catch(t){return""}}});var K,J,Q=function(t){return function(e,n){var r,i,o=String(O(e)),u=A(n),c=o.length;return u<0||u>=c?t?"":void 0:(r=o.charCodeAt(u))<55296||r>56319||u+1===c||(i=o.charCodeAt(u+1))<56320||i>57343?t?o.charAt(u):r:t?o.slice(u,u+2):i-56320+(r-55296<<10)+65536}}(!0),Y=function(t,e,n){return e+(n?Q(t,e).length:1)},Z=F("toStringTag"),tt="Arguments"==w(function(){return arguments}()),et=RegExp.prototype.exec,nt=function(t,e){var n,r,i,o,u=t.exec;if("function"==typeof u){var c=u.call(t,e);if("object"!=typeof c)throw new TypeError("RegExp exec method returned something other than an Object or null");return c}if("RegExp"!==(void 0===(n=t)?"Undefined":null===n?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(r=Object(n),Z))?i:tt?w(r):"Object"==(o=w(r))&&"function"==typeof r.callee?"Arguments":o))throw new TypeError("RegExp#exec called on incompatible receiver");return et.call(t,e)},rt=function(){var t=i(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},it=RegExp.prototype.exec,ot=String.prototype.replace,ut=it,ct=(K=/a/,J=/b*/g,it.call(K,"a"),it.call(J,"a"),0!==K.lastIndex||0!==J.lastIndex),st=void 0!==/()??/.exec("")[1];(ct||st)&&(ut=function(t){var e,n,r,i,o=this;return st&&(n=new RegExp("^"+o.source+"$(?!\\s)",rt.call(o))),ct&&(e=o.lastIndex),r=it.call(o,t),ct&&r&&(o.lastIndex=o.global?r.index+r[0].length:e),st&&r&&r.length>1&&ot.call(r[0],n,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)}),r});var at=ut;x({target:"RegExp",proto:!0,forced:at!==/./.exec},{exec:at});var lt=F("species"),ft=!o(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),pt=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2===n.length&&"a"===n[0]&&"b"===n[1]}(),ht=Math.max,vt=Math.min,dt=Math.floor,yt=/\$([$&`']|\d\d?|<[^>]*>)/g,mt=/\$([$&`']|\d\d?)/g;!function(t,e,n){var r=F(t),i=!o(function(){var e={};return e[r]=function(){return 7},7!=""[t](e)}),u=i?!o(function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[lt]=function(){return n}),n[r](""),!e}):void 0;if(!i||!u||"replace"===t&&!ft||"split"===t&&!pt){var c=/./[r],s=n(O,r,""[t],function(t,e,n,r,o){return e.exec===at?i&&!o?{done:!0,value:c.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),a=s[0],l=s[1];b(String.prototype,t,a),v(RegExp.prototype,r,2==e?function(t,e){return l.call(t,this,e)}:function(t){return l.call(t,this)})}}("replace",2,function(t,e,n,r){return[function(r,i){var o=t(this),u=null==r?void 0:r[e];return void 0!==u?u.call(r,o,i):n.call(String(o),r,i)},function(t,e){var u=r(n,t,this,e);if(u.done)return u.value;var c=i(t),s=String(this),a="function"==typeof e;a||(e=String(e));var l=c.global;if(l){var f=c.unicode;c.lastIndex=0}for(var p=[];;){var h=nt(c,s);if(null===h)break;if(p.push(h),!l)break;""===String(h[0])&&(c.lastIndex=Y(s,P(c.lastIndex),f))}for(var v,d="",y=0,m=0;m<p.length;m++){h=p[m];for(var g=String(h[0]),_=ht(vt(A(h.index),s.length),0),b=[],S=1;S<h.length;S++)b.push(void 0===(v=h[S])?v:String(v));var k=h.groups;if(a){var x=[g].concat(b,_,s);void 0!==k&&x.push(k);var I=String(e.apply(void 0,x))}else I=o(g,s,_,b,k,e);_>=y&&(d+=s.slice(y,_)+I,y=_+g.length)}return d+s.slice(y)}];function o(t,e,r,i,o,u){var c=r+t.length,s=i.length,a=mt;return void 0!==o&&(o=C(o),a=yt),n.call(u,a,function(n,u){var a;switch(u.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,r);case"'":return e.slice(c);case"<":a=o[u.slice(1,-1)];break;default:var l=+u;if(0===l)return n;if(l>s){var f=dt(l/10);return 0===f?n:f<=s?void 0===i[f-1]?u.charAt(1):i[f-1]+u.charAt(1):n}a=i[l-1]}return void 0===a?"":a})}});var gt,_t=function(t,e){return{value:e,done:!!t}},bt={},St=function(t){return E(O(t))},kt=Math.max,xt=Math.min,It=M("keys"),wt=function(t){return It[t]||(It[t]=_(t))},Et=(gt=!1,function(t,e,n){var r,i=St(t),o=P(i.length),u=function(t,e){return(t=A(t))<0?kt(t+e,0):xt(t,e)}(n,o);if(gt&&e!=e){for(;o>u;)if((r=i[u++])!=r)return!0}else for(;o>u;u++)if((gt||u in i)&&i[u]===e)return gt||u||0;return!gt&&-1}),Ot=wt("IE_PROTO"),Ct="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Lt=Object.keys||function(t){return function(t,e){var n,r=St(t),i=0,o=[];for(n in r)n!=Ot&&y(r,n)&&o.push(n);for(;e.length>i;)y(r,n=e[i++])&&(~Et(o,n)||o.push(n));return o}(t,Ct)},jt=u?Object.defineProperties:function(t,e){i(t);for(var n,r=Lt(e),o=r.length,u=0;o>u;)p.f(t,n=r[u++],e[n]);return t},At=e.document,Tt=At&&At.documentElement,Pt=wt("IE_PROTO"),Rt=function(){},Mt=function(){var t,e=a("iframe"),n=Ct.length;for(e.style.display="none",Tt.appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),Mt=t.F;n--;)delete Mt.prototype[Ct[n]];return Mt()},Ft=Object.create||function(t,e){var n;return null!==t?(Rt.prototype=i(t),n=new Rt,Rt.prototype=null,n[Pt]=t):n=Mt(),void 0===e?n:jt(n,e)},Nt=p.f,Dt=F("toStringTag"),Ht=function(t,e,n){t&&!y(t=n?t:t.prototype,Dt)&&Nt(t,Dt,{configurable:!0,value:e})},Gt={};v(Gt,F("iterator"),function(){return this});var $t=function(t,e,n){t.prototype=Ft(Gt,{next:h(1,n)}),Ht(t,e+" Iterator")},Vt=wt("IE_PROTO"),qt=Object.prototype,Bt=Object.getPrototypeOf||function(t){return t=C(t),y(t,Vt)?t[Vt]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?qt:null},Xt=F("iterator"),Ut=!([].keys&&"next"in[].keys()),Wt=function(){return this},zt=function(t,e,n,r,i,o,u){$t(n,e,r);var c,s,a,l=function(t){if(!Ut&&t in d)return d[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},f=e+" Iterator",p="values"==i,h=!1,d=t.prototype,y=d[Xt]||d["@@iterator"]||i&&d[i],m=y||l(i),g=i?p?l("entries"):m:void 0,_="Array"==e&&d.entries||y;if(_&&(a=Bt(_.call(new t)))!==Object.prototype&&a.next&&(Ht(a,f,!0),"function"!=typeof a[Xt]&&v(a,Xt,Wt)),p&&y&&"values"!==y.name&&(h=!0,m=function(){return y.call(this)}),(Ut||h||!d[Xt])&&v(d,Xt,m),bt[e]=m,bt[f]=Wt,i)if(c={values:p?m:l("values"),keys:o?m:l("keys"),entries:g},u)for(s in c)s in d||b(d,s,c[s]);else x(x.P+x.F*(Ut||h),e,c);return c}(Array,"Array",function(t,e){this._t=St(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,_t(1)):_t(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values");bt.Arguments=bt.Array,V("keys"),V("values"),V("entries");for(var Kt=F("iterator"),Jt=F("toStringTag"),Qt=bt.Array,Yt={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},Zt=Lt(Yt),te=0;te<Zt.length;te++){var ee,ne=Zt[te],re=Yt[ne],ie=e[ne],oe=ie&&ie.prototype;if(oe&&(oe[Kt]||v(oe,Kt,Qt),oe[Jt]||v(oe,Jt,ne),bt[ne]=Qt,re))for(ee in zt)oe[ee]||b(oe,ee,zt[ee],!0)}function ue(t){return(ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ce(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function se(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ae(t,e,n){return e&&se(t.prototype,e),n&&se(t,n),t}function le(t){return(le=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function fe(t,e){return(fe=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function pe(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}u&&"g"!=/./g.flags&&p.f(RegExp.prototype,"flags",{configurable:!0,get:rt});var he=/./.toString,ve=function(t){b(RegExp.prototype,"toString",t,!0)};o(function(){return"/a/b"!=he.call({source:"a",flags:"b"})})?ve(function(){var t=i(this);return"/".concat(t.source,"/","flags"in t?t.flags:!u&&t instanceof RegExp?rt.call(t):void 0)}):"toString"!=he.name&&ve(function(){return he.call(this)});var de=H(5),ye=!0;"find"in[]&&Array(1).find(function(){ye=!1}),x(x.P+x.F*ye,"Array",{find:function(t){return de(this,t,arguments.length>1?arguments[1]:void 0)}}),V("find");var me={f:Object.getOwnPropertySymbols},ge={f:{}.propertyIsEnumerable},_e=Object.assign,be=!_e||o(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=_e({},t)[n]||Object.keys(_e({},e)).join("")!=r})?function(t,e){for(var n=C(t),r=arguments.length,i=1,o=me.f,u=ge.f;r>i;)for(var c,s=E(arguments[i++]),a=o?Lt(s).concat(o(s)):Lt(s),l=a.length,f=0;l>f;)u.call(s,c=a[f++])&&(n[c]=s[c]);return n}:_e;x(x.S+x.F,"Object",{assign:be});var Se=document,ke=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};ce(this,t),this.options=Object.assign({},r,n),this._events=[],this.dom={el:this._setElement(e)}}return ae(t,[{key:"on",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return(n||this.dom.el).addEventListener(t,e=e.bind(this),!0),this._events.push({name:t,fn:e,el:n}),this}},{key:"getElement",value:function(){return this.dom.el}},{key:"remove",value:function(){var t=this;this._events=this._events.filter(function(e){return(e.el||t.dom.el).removeEventListener(e.name,e.fn,!0)}),this.dom.el.parentNode.removeChild(this.dom.el),this.dom=this.options=null}},{key:"_setElement",value:function(t){if(!t&&!t.nodeType&&"string"!=typeof t)throw new Error("Wrong element type provided!");return t.nodeType?t:(this.options.parent||Se).querySelector(t)}},{key:"_trigger",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;"function"==typeof CustomEvent?e=new CustomEvent(t,{detail:n,bubbles:!0,cancelable:!0}):(e=Se.createEvent("Event")).initEvent(t,!0,!0),this.dom.el.dispatchEvent(e)}}]),t}(),xe={parent:null,items:[],current:null,allowAdd:!0,proposal:"Add {X} to the list?",notFound:"{X} not present in the list",allowRemove:!0,removalIcon:"&times;",placeHolder:"Type to search",sort:!0,order:"desc",maxHeight:0,onDelete:null,onCreate:null},Ie=document;return function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ce(this,e),(n=pe(this,le(e).call(this,t,r,xe))).options.items=n._convertItems(r.items),n.current=r.current?n._convertItem(r.current):{},n.__found=null,n.options.sort&&n._sortItems(),n._renderInit(),n._bindEvents(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&fe(t,e)}(e,ke),ae(e,[{key:"_bindEvents",value:function(){var t=this,e=function(e){"Escape"!==e.key&&27!==e.keyCode&&t.dom.el.contains(e.target)||t.toggle(!1)};this.on("input",this._search),this.on("click",this._handleClick),this.on("keyup",this._handleKey),this.on("focusin",function(){return t._renderListItems().toggle(!0)},this.dom.input),this.on("keyup",e,Ie),this.on("click",e,Ie)}},{key:"onDelete",value:function(t){return this.options.onDelete=t,this}},{key:"onCreate",value:function(t){return this.options.onCreate=t,this}},{key:"toggle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.dom.el.firstElementChild.classList[t?"remove":"add"]("si-hide"),t||this.dom.input.blur(),this}},{key:"getItems",value:function(){return this.options.items}},{key:"getCurrent",value:function(){var t=Object.assign({},this.current);return delete t._lc,t}},{key:"clearCurrent",value:function(){this.current={},this.dom.input.value="",this._clearSelected()}},{key:"findItem",value:function(t){return t=t.nodeName?t.dataset.value:t,this.options.items.find(function(e){return e.value===t})}},{key:"_setCurrent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.current=t,this.dom.input.value=t.value.toString(),this._setSelected(t,e),this}},{key:"_setSelected",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._clearSelected(),(e=e||this.dom.list.querySelector('li[data-value="'.concat(t.value,'"]')))&&e.classList.add("si-current")}},{key:"_clearSelected",value:function(){var t=this.dom.list.querySelector(".si-current");t&&t.classList.remove("si-current")}},{key:"_convertItems",value:function(){var t=this;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(function(e){return t._convertItem(e)})}},{key:"_convertItem",value:function(t){return(t="object"!==ue(t)?{value:t}:t)._lc=t.value.toString().toLowerCase(),t}},{key:"_renderInit",value:function(){var t=Ie.createElement("div");return t.className="si-wrap si-hide",this.dom.input=t.appendChild(this._renderInput()).firstChild,this.dom.list=t.appendChild(this._renderList()).firstChild,this.current.value&&(this.dom.input.value=this.current.value),this.dom.el.appendChild(t)}},{key:"_renderInput",value:function(){var t=Ie.createElement("div"),e=Ie.createElement("input");return t.className="si-input",e.type="text",e.autocomplete="false",e.spellcheck=!1,e.placeholder=this.options.placeHolder,t.appendChild(e),t}},{key:"_renderList",value:function(){var t=Ie.createElement("div"),e=Ie.createElement("ul"),n=this.options.maxHeight;return t.className="si-list",n&&(t.style.maxHeight=n+"px"),t.appendChild(e),t}},{key:"_createListItems",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e="",n=this.current.value,r="",i=this.options.allowRemove?this._createRemovalButton():"";return t.forEach(function(t){r=n&&t.value===n?" si-current":"",e+='<li class="si-item'.concat(r,'" data-value="').concat(t.value,'">').concat(t.value).concat(i,"</li>")}),e}},{key:"_renderListItems",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.dom.list.innerHTML=t||this._createListItems(this.options.items),this}},{key:"_createRemovalButton",value:function(){return'<button type="button" class="si-removal">'.concat(this.options.removalIcon,"</button>")}},{key:"_search",value:function(t){var e=null,n=this.options,r=t.target.value,i=r.toLowerCase(),o=n.items.filter(function(t){return-1!==t._lc.indexOf(i)}),u=o||n.allowAdd?this._createListItems(o):"",c=o[0],s=o.length;1===s&&(e=c),(0===s||r&&i!==c._lc)&&n.allowAdd?(this.__found=e,u+=this._proposeItem(r)):0!==s||n.allowAdd||(u+=this._notFoundItem(r)),this._renderListItems(u)}},{key:"_proposeItem",value:function(t){var e=this.options.proposal.replace("{X}","<span>".concat(t,"</span>"));return'<li class="si-item si-append si-proposal" data-term="'.concat(t,'">').concat(e,"</li>")}},{key:"_notFoundItem",value:function(t){var e=this.options.notFound.replace("{X}","<span>".concat(t,"</span>"));return'<li class="si-item si-append si-not-found">'.concat(e,"</li>")}},{key:"_handleClick",value:function(t){var e=t.target,n=e.classList;this.options.allowAdd&&n.contains("si-proposal")?this._tryCreateItem(e.dataset.term)&&this.toggle()._trigger("created",this.current):n.contains("si-item")?this._setCurrent(this.findItem(e),e).toggle()._trigger("selected",this.current):this.options.allowRemove&&n.contains("si-removal")&&(e=e.parentNode,this._fireCallback("onDelete",this.findItem(e))&&this._trigger("removed",this._sliceItem(e)))}},{key:"_fireCallback",value:function(t,e){return"function"!=typeof this.options[t]||this.options[t](e)}},{key:"_handleKey",value:function(t){var e,n=t.target.value,r=this.__found;n&&13!==t.keyCode&&"Enter"!==t.key||(!r&&n&&this.options.allowAdd?e=this._tryCreateItem(n)?"created":null:r&&(e="selected",this._setCurrent(r)),e&&this.toggle()._trigger(e,this.current))}},{key:"_tryCreateItem",value:function(t){var e=this._convertItem(t.trim());return!(this.findItem(t)||!this._fireCallback("onCreate",e))&&(this._setCurrent(this._insertItem(e)),!0)}},{key:"_insertItem",value:function(t){return this.options.items.push(t),this.options.sort&&this._sortItems(),t}},{key:"_sortItems",value:function(){var t="desc"===this.options.order?1:-1;this.options.items.sort(function(e,n){return e._lc<n._lc?-t:e._lc>n._lc?t:0})}},{key:"_sliceItem",value:function(t){var e,n=this.options.items,r=t.dataset.value.toLowerCase(),i=this.current;return this.dom.list.removeChild(t),e=n.splice(n.findIndex(function(t){return t._lc===r}),1).shift(),i&&e._lc===i._lc&&this.clearCurrent(),e}}]),e}()});
//# sourceMappingURL=select-input-umd.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).SelectInput=e()}(this,function(){"use strict";function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),n=t(function(t){var e=t.exports={version:"2.6.3"};"number"==typeof __e&&(__e=e)}),r=(n.version,function(t){return"object"==typeof t?null!==t:"function"==typeof t}),i=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t},o=function(t){try{return!!t()}catch(t){return!0}},u=!o(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),c=e.document,s=r(c)&&r(c.createElement),a=function(t){return s?c.createElement(t):{}},l=!u&&!o(function(){return 7!=Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}),f=Object.defineProperty,p={f:u?Object.defineProperty:function(t,e,n){if(i(t),e=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}(e,!0),i(n),l)try{return f(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},h=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},v=u?function(t,e,n){return p.f(t,e,h(1,n))}:function(t,e,n){return t[e]=n,t},d={}.hasOwnProperty,y=function(t,e){return d.call(t,e)},m=0,g=Math.random(),_=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++m+g).toString(36))},b=t(function(t){var r=_("src"),i=Function.toString,o=(""+i).split("toString");n.inspectSource=function(t){return i.call(t)},(t.exports=function(t,n,i,u){var c="function"==typeof i;c&&(y(i,"name")||v(i,"name",n)),t[n]!==i&&(c&&(y(i,r)||v(i,r,t[n]?""+t[n]:o.join(String(n)))),t===e?t[n]=i:u?t[n]?t[n]=i:v(t,n,i):(delete t[n],v(t,n,i)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[r]||i.call(this)})}),S=function(t,e,n){if(function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}},k=function(t,r,i){var o,u,c,s,a=t&k.F,l=t&k.G,f=t&k.S,p=t&k.P,h=t&k.B,d=l?e:f?e[r]||(e[r]={}):(e[r]||{}).prototype,y=l?n:n[r]||(n[r]={}),m=y.prototype||(y.prototype={});for(o in l&&(i=r),i)c=((u=!a&&d&&void 0!==d[o])?d:i)[o],s=h&&u?S(c,e):p&&"function"==typeof c?S(Function.call,c):c,d&&b(d,o,c,t&k.U),y[o]!=c&&v(y,o,s),p&&m[o]!=c&&(m[o]=c)};e.core=n,k.F=1,k.G=2,k.S=4,k.P=8,k.B=16,k.W=32,k.U=64,k.R=128;var x=k,I={}.toString,w=function(t){return I.call(t).slice(8,-1)},E=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==w(t)?t.split(""):Object(t)},O=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},C=function(t){return Object(O(t))},L=Math.ceil,j=Math.floor,A=function(t){return isNaN(t=+t)?0:(t>0?j:L)(t)},T=Math.min,P=function(t){return t>0?T(A(t),9007199254740991):0},R=Array.isArray||function(t){return"Array"==w(t)},M=t(function(t){var r=e["__core-js_shared__"]||(e["__core-js_shared__"]={});(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:n.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),F=t(function(t){var n=M("wks"),r=e.Symbol,i="function"==typeof r;(t.exports=function(t){return n[t]||(n[t]=i&&r[t]||(i?r:_)("Symbol."+t))}).store=n}),N=F("species"),D=function(t,e){return new(function(t){var e;return R(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!R(e.prototype)||(e=void 0),r(e)&&null===(e=e[N])&&(e=void 0)),void 0===e?Array:e}(t))(e)},H=function(t,e){var n=1==t,r=2==t,i=3==t,o=4==t,u=6==t,c=5==t||u,s=e||D;return function(e,a,l){for(var f,p,h=C(e),v=E(h),d=S(a,l,3),y=P(v.length),m=0,g=n?s(e,y):r?s(e,0):void 0;y>m;m++)if((c||m in v)&&(p=d(f=v[m],m,h),t))if(n)g[m]=p;else if(p)switch(t){case 3:return!0;case 5:return f;case 6:return m;case 2:g.push(f)}else if(o)return!1;return u?-1:i||o?o:g}},G=F("unscopables"),$=Array.prototype;null==$[G]&&v($,G,{});var V=function(t){$[G][t]=!0},q=H(6),B="findIndex",X=!0;B in[]&&Array(1)[B](function(){X=!1}),x(x.P+x.F*X,"Array",{findIndex:function(t){return q(this,t,arguments.length>1?arguments[1]:void 0)}}),V(B);var U=p.f,W=Function.prototype,z=/^\s*function ([^ (]*)/;"name"in W||u&&U(W,"name",{configurable:!0,get:function(){try{return(""+this).match(z)[1]}catch(t){return""}}});var K,J,Q=function(t){return function(e,n){var r,i,o=String(O(e)),u=A(n),c=o.length;return u<0||u>=c?t?"":void 0:(r=o.charCodeAt(u))<55296||r>56319||u+1===c||(i=o.charCodeAt(u+1))<56320||i>57343?t?o.charAt(u):r:t?o.slice(u,u+2):i-56320+(r-55296<<10)+65536}}(!0),Y=function(t,e,n){return e+(n?Q(t,e).length:1)},Z=F("toStringTag"),tt="Arguments"==w(function(){return arguments}()),et=RegExp.prototype.exec,nt=function(t,e){var n,r,i,o,u=t.exec;if("function"==typeof u){var c=u.call(t,e);if("object"!=typeof c)throw new TypeError("RegExp exec method returned something other than an Object or null");return c}if("RegExp"!==(void 0===(n=t)?"Undefined":null===n?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(r=Object(n),Z))?i:tt?w(r):"Object"==(o=w(r))&&"function"==typeof r.callee?"Arguments":o))throw new TypeError("RegExp#exec called on incompatible receiver");return et.call(t,e)},rt=function(){var t=i(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},it=RegExp.prototype.exec,ot=String.prototype.replace,ut=it,ct=(K=/a/,J=/b*/g,it.call(K,"a"),it.call(J,"a"),0!==K.lastIndex||0!==J.lastIndex),st=void 0!==/()??/.exec("")[1];(ct||st)&&(ut=function(t){var e,n,r,i,o=this;return st&&(n=new RegExp("^"+o.source+"$(?!\\s)",rt.call(o))),ct&&(e=o.lastIndex),r=it.call(o,t),ct&&r&&(o.lastIndex=o.global?r.index+r[0].length:e),st&&r&&r.length>1&&ot.call(r[0],n,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)}),r});var at=ut;x({target:"RegExp",proto:!0,forced:at!==/./.exec},{exec:at});var lt=F("species"),ft=!o(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),pt=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2===n.length&&"a"===n[0]&&"b"===n[1]}(),ht=Math.max,vt=Math.min,dt=Math.floor,yt=/\$([$&`']|\d\d?|<[^>]*>)/g,mt=/\$([$&`']|\d\d?)/g;!function(t,e,n){var r=F(t),i=!o(function(){var e={};return e[r]=function(){return 7},7!=""[t](e)}),u=i?!o(function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[lt]=function(){return n}),n[r](""),!e}):void 0;if(!i||!u||"replace"===t&&!ft||"split"===t&&!pt){var c=/./[r],s=n(O,r,""[t],function(t,e,n,r,o){return e.exec===at?i&&!o?{done:!0,value:c.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),a=s[0],l=s[1];b(String.prototype,t,a),v(RegExp.prototype,r,2==e?function(t,e){return l.call(t,this,e)}:function(t){return l.call(t,this)})}}("replace",2,function(t,e,n,r){return[function(r,i){var o=t(this),u=null==r?void 0:r[e];return void 0!==u?u.call(r,o,i):n.call(String(o),r,i)},function(t,e){var u=r(n,t,this,e);if(u.done)return u.value;var c=i(t),s=String(this),a="function"==typeof e;a||(e=String(e));var l=c.global;if(l){var f=c.unicode;c.lastIndex=0}for(var p=[];;){var h=nt(c,s);if(null===h)break;if(p.push(h),!l)break;""===String(h[0])&&(c.lastIndex=Y(s,P(c.lastIndex),f))}for(var v,d="",y=0,m=0;m<p.length;m++){h=p[m];for(var g=String(h[0]),_=ht(vt(A(h.index),s.length),0),b=[],S=1;S<h.length;S++)b.push(void 0===(v=h[S])?v:String(v));var k=h.groups;if(a){var x=[g].concat(b,_,s);void 0!==k&&x.push(k);var I=String(e.apply(void 0,x))}else I=o(g,s,_,b,k,e);_>=y&&(d+=s.slice(y,_)+I,y=_+g.length)}return d+s.slice(y)}];function o(t,e,r,i,o,u){var c=r+t.length,s=i.length,a=mt;return void 0!==o&&(o=C(o),a=yt),n.call(u,a,function(n,u){var a;switch(u.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,r);case"'":return e.slice(c);case"<":a=o[u.slice(1,-1)];break;default:var l=+u;if(0===l)return n;if(l>s){var f=dt(l/10);return 0===f?n:f<=s?void 0===i[f-1]?u.charAt(1):i[f-1]+u.charAt(1):n}a=i[l-1]}return void 0===a?"":a})}});var gt,_t=function(t,e){return{value:e,done:!!t}},bt={},St=function(t){return E(O(t))},kt=Math.max,xt=Math.min,It=M("keys"),wt=function(t){return It[t]||(It[t]=_(t))},Et=(gt=!1,function(t,e,n){var r,i=St(t),o=P(i.length),u=function(t,e){return(t=A(t))<0?kt(t+e,0):xt(t,e)}(n,o);if(gt&&e!=e){for(;o>u;)if((r=i[u++])!=r)return!0}else for(;o>u;u++)if((gt||u in i)&&i[u]===e)return gt||u||0;return!gt&&-1}),Ot=wt("IE_PROTO"),Ct="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Lt=Object.keys||function(t){return function(t,e){var n,r=St(t),i=0,o=[];for(n in r)n!=Ot&&y(r,n)&&o.push(n);for(;e.length>i;)y(r,n=e[i++])&&(~Et(o,n)||o.push(n));return o}(t,Ct)},jt=u?Object.defineProperties:function(t,e){i(t);for(var n,r=Lt(e),o=r.length,u=0;o>u;)p.f(t,n=r[u++],e[n]);return t},At=e.document,Tt=At&&At.documentElement,Pt=wt("IE_PROTO"),Rt=function(){},Mt=function(){var t,e=a("iframe"),n=Ct.length;for(e.style.display="none",Tt.appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),Mt=t.F;n--;)delete Mt.prototype[Ct[n]];return Mt()},Ft=Object.create||function(t,e){var n;return null!==t?(Rt.prototype=i(t),n=new Rt,Rt.prototype=null,n[Pt]=t):n=Mt(),void 0===e?n:jt(n,e)},Nt=p.f,Dt=F("toStringTag"),Ht=function(t,e,n){t&&!y(t=n?t:t.prototype,Dt)&&Nt(t,Dt,{configurable:!0,value:e})},Gt={};v(Gt,F("iterator"),function(){return this});var $t=function(t,e,n){t.prototype=Ft(Gt,{next:h(1,n)}),Ht(t,e+" Iterator")},Vt=wt("IE_PROTO"),qt=Object.prototype,Bt=Object.getPrototypeOf||function(t){return t=C(t),y(t,Vt)?t[Vt]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?qt:null},Xt=F("iterator"),Ut=!([].keys&&"next"in[].keys()),Wt=function(){return this},zt=function(t,e,n,r,i,o,u){$t(n,e,r);var c,s,a,l=function(t){if(!Ut&&t in d)return d[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},f=e+" Iterator",p="values"==i,h=!1,d=t.prototype,y=d[Xt]||d["@@iterator"]||i&&d[i],m=y||l(i),g=i?p?l("entries"):m:void 0,_="Array"==e&&d.entries||y;if(_&&(a=Bt(_.call(new t)))!==Object.prototype&&a.next&&(Ht(a,f,!0),"function"!=typeof a[Xt]&&v(a,Xt,Wt)),p&&y&&"values"!==y.name&&(h=!0,m=function(){return y.call(this)}),(Ut||h||!d[Xt])&&v(d,Xt,m),bt[e]=m,bt[f]=Wt,i)if(c={values:p?m:l("values"),keys:o?m:l("keys"),entries:g},u)for(s in c)s in d||b(d,s,c[s]);else x(x.P+x.F*(Ut||h),e,c);return c}(Array,"Array",function(t,e){this._t=St(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,_t(1)):_t(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values");bt.Arguments=bt.Array,V("keys"),V("values"),V("entries");for(var Kt=F("iterator"),Jt=F("toStringTag"),Qt=bt.Array,Yt={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},Zt=Lt(Yt),te=0;te<Zt.length;te++){var ee,ne=Zt[te],re=Yt[ne],ie=e[ne],oe=ie&&ie.prototype;if(oe&&(oe[Kt]||v(oe,Kt,Qt),oe[Jt]||v(oe,Jt,ne),bt[ne]=Qt,re))for(ee in zt)oe[ee]||b(oe,ee,zt[ee],!0)}function ue(t){return(ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ce(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function se(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ae(t,e,n){return e&&se(t.prototype,e),n&&se(t,n),t}function le(t){return(le=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function fe(t,e){return(fe=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function pe(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}u&&"g"!=/./g.flags&&p.f(RegExp.prototype,"flags",{configurable:!0,get:rt});var he=/./.toString,ve=function(t){b(RegExp.prototype,"toString",t,!0)};o(function(){return"/a/b"!=he.call({source:"a",flags:"b"})})?ve(function(){var t=i(this);return"/".concat(t.source,"/","flags"in t?t.flags:!u&&t instanceof RegExp?rt.call(t):void 0)}):"toString"!=he.name&&ve(function(){return he.call(this)});var de=H(5),ye=!0;"find"in[]&&Array(1).find(function(){ye=!1}),x(x.P+x.F*ye,"Array",{find:function(t){return de(this,t,arguments.length>1?arguments[1]:void 0)}}),V("find");var me={f:Object.getOwnPropertySymbols},ge={f:{}.propertyIsEnumerable},_e=Object.assign,be=!_e||o(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=_e({},t)[n]||Object.keys(_e({},e)).join("")!=r})?function(t,e){for(var n=C(t),r=arguments.length,i=1,o=me.f,u=ge.f;r>i;)for(var c,s=E(arguments[i++]),a=o?Lt(s).concat(o(s)):Lt(s),l=a.length,f=0;l>f;)u.call(s,c=a[f++])&&(n[c]=s[c]);return n}:_e;x(x.S+x.F,"Object",{assign:be});var Se=document,ke=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};ce(this,t),this.options=Object.assign({},r,n),this._events=[],this.dom={el:this._setElement(e)}}return ae(t,[{key:"on",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return(n||this.dom.el).addEventListener(t,e=e.bind(this),!0),this._events.push({name:t,fn:e,el:n}),this}},{key:"getElement",value:function(){return this.dom.el}},{key:"remove",value:function(){var t=this;this._events=this._events.filter(function(e){return(e.el||t.dom.el).removeEventListener(e.name,e.fn,!0)}),this.dom.el.parentNode.removeChild(this.dom.el),this.dom=this.options=null}},{key:"_setElement",value:function(t){if(!t&&!t.nodeType&&"string"!=typeof t)throw new Error("Wrong element type provided!");return t.nodeType?t:(this.options.parent||Se).querySelector(t)}},{key:"_trigger",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;"function"==typeof CustomEvent?e=new CustomEvent(t,{detail:n}):(e=Se.createEvent("Event")).initEvent(t,!0,!0),this.dom.el.dispatchEvent(e)}}]),t}(),xe={parent:null,items:[],current:null,allowAdd:!0,proposal:"Add {X} to the list?",notFound:"{X} not present in the list",allowRemove:!0,removalIcon:"&times;",placeHolder:"Type to search",sort:!0,order:"desc",maxHeight:0,onDelete:null,onCreate:null},Ie=document;return function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ce(this,e),(n=pe(this,le(e).call(this,t,r,xe))).options.items=n._convertItems(r.items),n.current=r.current?n._convertItem(r.current):{},n.__found=null,n.options.sort&&n._sortItems(),n._renderInit(),n._bindEvents(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&fe(t,e)}(e,ke),ae(e,[{key:"_bindEvents",value:function(){var t=this,e=function(e){"Escape"!==e.key&&27!==e.keyCode&&t.dom.el.contains(e.target)||t.toggle(!1)};this.on("input",this._search),this.on("click",this._handleClick),this.on("keyup",this._handleKey),this.on("focusin",function(){return t._renderListItems().toggle(!0)},this.dom.input),this.on("keyup",e,Ie),this.on("click",e,Ie)}},{key:"onDelete",value:function(t){return this.options.onDelete=t,this}},{key:"onCreate",value:function(t){return this.options.onCreate=t,this}},{key:"toggle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.dom.el.firstElementChild.classList[t?"remove":"add"]("si-hide"),t||this.dom.input.blur(),this}},{key:"getItems",value:function(){return this.options.items}},{key:"getCurrent",value:function(){var t=Object.assign({},this.current);return delete t._lc,t}},{key:"clearCurrent",value:function(){this.current={},this.dom.input.value="",this._clearSelected()}},{key:"findItem",value:function(t){return t=t.nodeName?t.dataset.value:t,this.options.items.find(function(e){return e.value===t})}},{key:"_setCurrent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.current=t,this.dom.input.value=t.value.toString(),this._setSelected(t,e),this}},{key:"_setSelected",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._clearSelected(),(e=e||this.dom.list.querySelector('li[data-value="'.concat(t.value,'"]')))&&e.classList.add("si-current")}},{key:"_clearSelected",value:function(){var t=this.dom.list.querySelector(".si-current");t&&t.classList.remove("si-current")}},{key:"_convertItems",value:function(){var t=this;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(function(e){return t._convertItem(e)})}},{key:"_convertItem",value:function(t){return(t="object"!==ue(t)?{value:t}:t)._lc=t.value.toString().toLowerCase(),t}},{key:"_renderInit",value:function(){var t=Ie.createElement("div");return t.className="si-wrap si-hide",this.dom.input=t.appendChild(this._renderInput()).firstChild,this.dom.list=t.appendChild(this._renderList()).firstChild,this.current.value&&(this.dom.input.value=this.current.value),this.dom.el.appendChild(t)}},{key:"_renderInput",value:function(){var t=Ie.createElement("div"),e=Ie.createElement("input");return t.className="si-input",e.type="text",e.autocomplete="false",e.spellcheck=!1,e.placeholder=this.options.placeHolder,t.appendChild(e),t}},{key:"_renderList",value:function(){var t=Ie.createElement("div"),e=Ie.createElement("ul"),n=this.options.maxHeight;return t.className="si-list",n&&(t.style.maxHeight=n+"px"),t.appendChild(e),t}},{key:"_createListItems",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e="",n=this.current.value,r="",i=this.options.allowRemove?this._createRemovalButton():"";return t.forEach(function(t){r=n&&t.value===n?" si-current":"",e+='<li class="si-item'.concat(r,'" data-value="').concat(t.value,'">').concat(t.value).concat(i,"</li>")}),e}},{key:"_renderListItems",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.dom.list.innerHTML=t||this._createListItems(this.options.items),this}},{key:"_createRemovalButton",value:function(){return'<button type="button" class="si-removal">'.concat(this.options.removalIcon,"</button>")}},{key:"_search",value:function(t){var e=null,n=this.options,r=t.target.value,i=r.toLowerCase(),o=n.items.filter(function(t){return-1!==t._lc.indexOf(i)}),u=o||n.allowAdd?this._createListItems(o):"",c=o[0],s=o.length;1===s&&(e=c),(0===s||r&&i!==c._lc)&&n.allowAdd?(this.__found=e,u+=this._proposeItem(r)):0!==s||n.allowAdd||(u+=this._notFoundItem(r)),this._renderListItems(u)}},{key:"_proposeItem",value:function(t){var e=this.options.proposal.replace("{X}","<span>".concat(t,"</span>"));return'<li class="si-item si-append si-proposal" data-term="'.concat(t,'">').concat(e,"</li>")}},{key:"_notFoundItem",value:function(t){var e=this.options.notFound.replace("{X}","<span>".concat(t,"</span>"));return'<li class="si-item si-append si-not-found">'.concat(e,"</li>")}},{key:"_handleClick",value:function(t){var e=t.target,n=e.classList;this.options.allowAdd&&n.contains("si-proposal")?this._tryCreateItem(e.dataset.term)&&this.toggle()._trigger("created",this.current):n.contains("si-item")?this._setCurrent(this.findItem(e),e).toggle()._trigger("selected",this.current):this.options.allowRemove&&n.contains("si-removal")&&(e=e.parentNode,this._fireCallback("onDelete",this.findItem(e))&&this._trigger("removed",this._sliceItem(e)))}},{key:"_fireCallback",value:function(t,e){return"function"!=typeof this.options[t]||this.options[t](e)}},{key:"_handleKey",value:function(t){var e,n=t.target.value,r=this.__found;n&&13!==t.keyCode&&"Enter"!==t.key||(!r&&n&&this.options.allowAdd?e=this._tryCreateItem(n)?"created":null:r&&(e="selected",this._setCurrent(r)),e&&this.toggle()._trigger(e,this.current))}},{key:"_tryCreateItem",value:function(t){var e=this._convertItem(t.trim());return!(this.findItem(t)||!this._fireCallback("onCreate",e))&&(this._setCurrent(this._insertItem(e)),!0)}},{key:"_insertItem",value:function(t){return this.options.items.push(t),this.options.sort&&this._sortItems(),t}},{key:"_sortItems",value:function(){var t="desc"===this.options.order?1:-1;this.options.items.sort(function(e,n){return e._lc<n._lc?-t:e._lc>n._lc?t:0})}},{key:"_sliceItem",value:function(t){var e,n=this.options.items,r=t.dataset.value.toLowerCase(),i=this.current;return this.dom.list.removeChild(t),e=n.splice(n.findIndex(function(t){return t._lc===r}),1).shift(),i&&e._lc===i._lc&&this.clearCurrent(),e}}]),e}()});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).SelectInput=e()}(this,function(){"use strict";function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),n=t(function(t){var e=t.exports={version:"2.6.3"};"number"==typeof __e&&(__e=e)}),r=(n.version,function(t){return"object"==typeof t?null!==t:"function"==typeof t}),i=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t},o=function(t){try{return!!t()}catch(t){return!0}},u=!o(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),c=e.document,s=r(c)&&r(c.createElement),a=function(t){return s?c.createElement(t):{}},l=!u&&!o(function(){return 7!=Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}),f=Object.defineProperty,p={f:u?Object.defineProperty:function(t,e,n){if(i(t),e=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}(e,!0),i(n),l)try{return f(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},h=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},v=u?function(t,e,n){return p.f(t,e,h(1,n))}:function(t,e,n){return t[e]=n,t},d={}.hasOwnProperty,y=function(t,e){return d.call(t,e)},m=0,g=Math.random(),_=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++m+g).toString(36))},b=t(function(t){var r=_("src"),i=Function.toString,o=(""+i).split("toString");n.inspectSource=function(t){return i.call(t)},(t.exports=function(t,n,i,u){var c="function"==typeof i;c&&(y(i,"name")||v(i,"name",n)),t[n]!==i&&(c&&(y(i,r)||v(i,r,t[n]?""+t[n]:o.join(String(n)))),t===e?t[n]=i:u?t[n]?t[n]=i:v(t,n,i):(delete t[n],v(t,n,i)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[r]||i.call(this)})}),S=function(t,e,n){if(function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}},k=function(t,r,i){var o,u,c,s,a=t&k.F,l=t&k.G,f=t&k.S,p=t&k.P,h=t&k.B,d=l?e:f?e[r]||(e[r]={}):(e[r]||{}).prototype,y=l?n:n[r]||(n[r]={}),m=y.prototype||(y.prototype={});for(o in l&&(i=r),i)c=((u=!a&&d&&void 0!==d[o])?d:i)[o],s=h&&u?S(c,e):p&&"function"==typeof c?S(Function.call,c):c,d&&b(d,o,c,t&k.U),y[o]!=c&&v(y,o,s),p&&m[o]!=c&&(m[o]=c)};e.core=n,k.F=1,k.G=2,k.S=4,k.P=8,k.B=16,k.W=32,k.U=64,k.R=128;var x=k,I={}.toString,w=function(t){return I.call(t).slice(8,-1)},E=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==w(t)?t.split(""):Object(t)},O=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},C=function(t){return Object(O(t))},L=Math.ceil,j=Math.floor,A=function(t){return isNaN(t=+t)?0:(t>0?j:L)(t)},T=Math.min,P=function(t){return t>0?T(A(t),9007199254740991):0},R=Array.isArray||function(t){return"Array"==w(t)},M=t(function(t){var r=e["__core-js_shared__"]||(e["__core-js_shared__"]={});(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:n.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),F=t(function(t){var n=M("wks"),r=e.Symbol,i="function"==typeof r;(t.exports=function(t){return n[t]||(n[t]=i&&r[t]||(i?r:_)("Symbol."+t))}).store=n}),N=F("species"),D=function(t,e){return new(function(t){var e;return R(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!R(e.prototype)||(e=void 0),r(e)&&null===(e=e[N])&&(e=void 0)),void 0===e?Array:e}(t))(e)},H=function(t,e){var n=1==t,r=2==t,i=3==t,o=4==t,u=6==t,c=5==t||u,s=e||D;return function(e,a,l){for(var f,p,h=C(e),v=E(h),d=S(a,l,3),y=P(v.length),m=0,g=n?s(e,y):r?s(e,0):void 0;y>m;m++)if((c||m in v)&&(p=d(f=v[m],m,h),t))if(n)g[m]=p;else if(p)switch(t){case 3:return!0;case 5:return f;case 6:return m;case 2:g.push(f)}else if(o)return!1;return u?-1:i||o?o:g}},G=F("unscopables"),$=Array.prototype;null==$[G]&&v($,G,{});var V=function(t){$[G][t]=!0},q=H(6),B="findIndex",X=!0;B in[]&&Array(1)[B](function(){X=!1}),x(x.P+x.F*X,"Array",{findIndex:function(t){return q(this,t,arguments.length>1?arguments[1]:void 0)}}),V(B);var U=p.f,W=Function.prototype,z=/^\s*function ([^ (]*)/;"name"in W||u&&U(W,"name",{configurable:!0,get:function(){try{return(""+this).match(z)[1]}catch(t){return""}}});var K,J,Q=function(t){return function(e,n){var r,i,o=String(O(e)),u=A(n),c=o.length;return u<0||u>=c?t?"":void 0:(r=o.charCodeAt(u))<55296||r>56319||u+1===c||(i=o.charCodeAt(u+1))<56320||i>57343?t?o.charAt(u):r:t?o.slice(u,u+2):i-56320+(r-55296<<10)+65536}}(!0),Y=function(t,e,n){return e+(n?Q(t,e).length:1)},Z=F("toStringTag"),tt="Arguments"==w(function(){return arguments}()),et=RegExp.prototype.exec,nt=function(t,e){var n,r,i,o,u=t.exec;if("function"==typeof u){var c=u.call(t,e);if("object"!=typeof c)throw new TypeError("RegExp exec method returned something other than an Object or null");return c}if("RegExp"!==(void 0===(n=t)?"Undefined":null===n?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(r=Object(n),Z))?i:tt?w(r):"Object"==(o=w(r))&&"function"==typeof r.callee?"Arguments":o))throw new TypeError("RegExp#exec called on incompatible receiver");return et.call(t,e)},rt=function(){var t=i(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},it=RegExp.prototype.exec,ot=String.prototype.replace,ut=it,ct=(K=/a/,J=/b*/g,it.call(K,"a"),it.call(J,"a"),0!==K.lastIndex||0!==J.lastIndex),st=void 0!==/()??/.exec("")[1];(ct||st)&&(ut=function(t){var e,n,r,i,o=this;return st&&(n=new RegExp("^"+o.source+"$(?!\\s)",rt.call(o))),ct&&(e=o.lastIndex),r=it.call(o,t),ct&&r&&(o.lastIndex=o.global?r.index+r[0].length:e),st&&r&&r.length>1&&ot.call(r[0],n,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)}),r});var at=ut;x({target:"RegExp",proto:!0,forced:at!==/./.exec},{exec:at});var lt=F("species"),ft=!o(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),pt=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2===n.length&&"a"===n[0]&&"b"===n[1]}(),ht=Math.max,vt=Math.min,dt=Math.floor,yt=/\$([$&`']|\d\d?|<[^>]*>)/g,mt=/\$([$&`']|\d\d?)/g;!function(t,e,n){var r=F(t),i=!o(function(){var e={};return e[r]=function(){return 7},7!=""[t](e)}),u=i?!o(function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[lt]=function(){return n}),n[r](""),!e}):void 0;if(!i||!u||"replace"===t&&!ft||"split"===t&&!pt){var c=/./[r],s=n(O,r,""[t],function(t,e,n,r,o){return e.exec===at?i&&!o?{done:!0,value:c.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),a=s[0],l=s[1];b(String.prototype,t,a),v(RegExp.prototype,r,2==e?function(t,e){return l.call(t,this,e)}:function(t){return l.call(t,this)})}}("replace",2,function(t,e,n,r){return[function(r,i){var o=t(this),u=null==r?void 0:r[e];return void 0!==u?u.call(r,o,i):n.call(String(o),r,i)},function(t,e){var u=r(n,t,this,e);if(u.done)return u.value;var c=i(t),s=String(this),a="function"==typeof e;a||(e=String(e));var l=c.global;if(l){var f=c.unicode;c.lastIndex=0}for(var p=[];;){var h=nt(c,s);if(null===h)break;if(p.push(h),!l)break;""===String(h[0])&&(c.lastIndex=Y(s,P(c.lastIndex),f))}for(var v,d="",y=0,m=0;m<p.length;m++){h=p[m];for(var g=String(h[0]),_=ht(vt(A(h.index),s.length),0),b=[],S=1;S<h.length;S++)b.push(void 0===(v=h[S])?v:String(v));var k=h.groups;if(a){var x=[g].concat(b,_,s);void 0!==k&&x.push(k);var I=String(e.apply(void 0,x))}else I=o(g,s,_,b,k,e);_>=y&&(d+=s.slice(y,_)+I,y=_+g.length)}return d+s.slice(y)}];function o(t,e,r,i,o,u){var c=r+t.length,s=i.length,a=mt;return void 0!==o&&(o=C(o),a=yt),n.call(u,a,function(n,u){var a;switch(u.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,r);case"'":return e.slice(c);case"<":a=o[u.slice(1,-1)];break;default:var l=+u;if(0===l)return n;if(l>s){var f=dt(l/10);return 0===f?n:f<=s?void 0===i[f-1]?u.charAt(1):i[f-1]+u.charAt(1):n}a=i[l-1]}return void 0===a?"":a})}});var gt,_t=function(t,e){return{value:e,done:!!t}},bt={},St=function(t){return E(O(t))},kt=Math.max,xt=Math.min,It=M("keys"),wt=function(t){return It[t]||(It[t]=_(t))},Et=(gt=!1,function(t,e,n){var r,i=St(t),o=P(i.length),u=function(t,e){return(t=A(t))<0?kt(t+e,0):xt(t,e)}(n,o);if(gt&&e!=e){for(;o>u;)if((r=i[u++])!=r)return!0}else for(;o>u;u++)if((gt||u in i)&&i[u]===e)return gt||u||0;return!gt&&-1}),Ot=wt("IE_PROTO"),Ct="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Lt=Object.keys||function(t){return function(t,e){var n,r=St(t),i=0,o=[];for(n in r)n!=Ot&&y(r,n)&&o.push(n);for(;e.length>i;)y(r,n=e[i++])&&(~Et(o,n)||o.push(n));return o}(t,Ct)},jt=u?Object.defineProperties:function(t,e){i(t);for(var n,r=Lt(e),o=r.length,u=0;o>u;)p.f(t,n=r[u++],e[n]);return t},At=e.document,Tt=At&&At.documentElement,Pt=wt("IE_PROTO"),Rt=function(){},Mt=function(){var t,e=a("iframe"),n=Ct.length;for(e.style.display="none",Tt.appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),Mt=t.F;n--;)delete Mt.prototype[Ct[n]];return Mt()},Ft=Object.create||function(t,e){var n;return null!==t?(Rt.prototype=i(t),n=new Rt,Rt.prototype=null,n[Pt]=t):n=Mt(),void 0===e?n:jt(n,e)},Nt=p.f,Dt=F("toStringTag"),Ht=function(t,e,n){t&&!y(t=n?t:t.prototype,Dt)&&Nt(t,Dt,{configurable:!0,value:e})},Gt={};v(Gt,F("iterator"),function(){return this});var $t=function(t,e,n){t.prototype=Ft(Gt,{next:h(1,n)}),Ht(t,e+" Iterator")},Vt=wt("IE_PROTO"),qt=Object.prototype,Bt=Object.getPrototypeOf||function(t){return t=C(t),y(t,Vt)?t[Vt]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?qt:null},Xt=F("iterator"),Ut=!([].keys&&"next"in[].keys()),Wt=function(){return this},zt=function(t,e,n,r,i,o,u){$t(n,e,r);var c,s,a,l=function(t){if(!Ut&&t in d)return d[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},f=e+" Iterator",p="values"==i,h=!1,d=t.prototype,y=d[Xt]||d["@@iterator"]||i&&d[i],m=y||l(i),g=i?p?l("entries"):m:void 0,_="Array"==e&&d.entries||y;if(_&&(a=Bt(_.call(new t)))!==Object.prototype&&a.next&&(Ht(a,f,!0),"function"!=typeof a[Xt]&&v(a,Xt,Wt)),p&&y&&"values"!==y.name&&(h=!0,m=function(){return y.call(this)}),(Ut||h||!d[Xt])&&v(d,Xt,m),bt[e]=m,bt[f]=Wt,i)if(c={values:p?m:l("values"),keys:o?m:l("keys"),entries:g},u)for(s in c)s in d||b(d,s,c[s]);else x(x.P+x.F*(Ut||h),e,c);return c}(Array,"Array",function(t,e){this._t=St(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,_t(1)):_t(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values");bt.Arguments=bt.Array,V("keys"),V("values"),V("entries");for(var Kt=F("iterator"),Jt=F("toStringTag"),Qt=bt.Array,Yt={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},Zt=Lt(Yt),te=0;te<Zt.length;te++){var ee,ne=Zt[te],re=Yt[ne],ie=e[ne],oe=ie&&ie.prototype;if(oe&&(oe[Kt]||v(oe,Kt,Qt),oe[Jt]||v(oe,Jt,ne),bt[ne]=Qt,re))for(ee in zt)oe[ee]||b(oe,ee,zt[ee],!0)}function ue(t){return(ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ce(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function se(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ae(t,e,n){return e&&se(t.prototype,e),n&&se(t,n),t}function le(t){return(le=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function fe(t,e){return(fe=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function pe(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}u&&"g"!=/./g.flags&&p.f(RegExp.prototype,"flags",{configurable:!0,get:rt});var he=/./.toString,ve=function(t){b(RegExp.prototype,"toString",t,!0)};o(function(){return"/a/b"!=he.call({source:"a",flags:"b"})})?ve(function(){var t=i(this);return"/".concat(t.source,"/","flags"in t?t.flags:!u&&t instanceof RegExp?rt.call(t):void 0)}):"toString"!=he.name&&ve(function(){return he.call(this)});var de=H(5),ye=!0;"find"in[]&&Array(1).find(function(){ye=!1}),x(x.P+x.F*ye,"Array",{find:function(t){return de(this,t,arguments.length>1?arguments[1]:void 0)}}),V("find");var me={f:Object.getOwnPropertySymbols},ge={f:{}.propertyIsEnumerable},_e=Object.assign,be=!_e||o(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=_e({},t)[n]||Object.keys(_e({},e)).join("")!=r})?function(t,e){for(var n=C(t),r=arguments.length,i=1,o=me.f,u=ge.f;r>i;)for(var c,s=E(arguments[i++]),a=o?Lt(s).concat(o(s)):Lt(s),l=a.length,f=0;l>f;)u.call(s,c=a[f++])&&(n[c]=s[c]);return n}:_e;x(x.S+x.F,"Object",{assign:be});var Se=document,ke=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};ce(this,t),this.options=Object.assign({},r,n),this._events=[],this.dom={el:this._setElement(e)}}return ae(t,[{key:"on",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return(n||this.dom.el).addEventListener(t,e=e.bind(this),!0),this._events.push({name:t,fn:e,el:n}),this}},{key:"getElement",value:function(){return this.dom.el}},{key:"remove",value:function(){var t=this;this._events=this._events.filter(function(e){return(e.el||t.dom.el).removeEventListener(e.name,e.fn,!0)}),this.dom.el.parentNode.removeChild(this.dom.el),this.dom=this.options=null}},{key:"_setElement",value:function(t){if(!t&&!t.nodeType&&"string"!=typeof t)throw new Error("Wrong element type provided!");return t.nodeType?t:(this.options.parent||Se).querySelector(t)}},{key:"_trigger",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;"function"==typeof CustomEvent?e=new CustomEvent(t,{detail:n,bubbles:!0,cancelable:!0}):(e=Se.createEvent("Event")).initEvent(t,!0,!0),this.dom.el.dispatchEvent(e)}}]),t}(),xe={parent:null,items:[],current:null,allowAdd:!0,proposal:"Add {X} to the list?",notFound:"{X} not present in the list",allowRemove:!0,removalIcon:"&times;",placeHolder:"Type to search",sort:!0,order:"desc",maxHeight:0,onDelete:null,onCreate:null},Ie=document;return function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ce(this,e),(n=pe(this,le(e).call(this,t,r,xe))).options.items=n._convertItems(r.items),n.current=r.current?n._convertItem(r.current):{},n.__found=null,n.options.sort&&n._sortItems(),n._renderInit(),n._bindEvents(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&fe(t,e)}(e,ke),ae(e,[{key:"_bindEvents",value:function(){var t=this,e=function(e){"Escape"!==e.key&&27!==e.keyCode&&t.dom.el.contains(e.target)||t.toggle(!1)};this.on("input",this._search),this.on("click",this._handleClick),this.on("keyup",this._handleKey),this.on("focusin",function(){return t._renderListItems().toggle(!0)},this.dom.input),this.on("keyup",e,Ie),this.on("click",e,Ie)}},{key:"onDelete",value:function(t){return this.options.onDelete=t,this}},{key:"onCreate",value:function(t){return this.options.onCreate=t,this}},{key:"toggle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.dom.el.firstElementChild.classList[t?"remove":"add"]("si-hide"),t||this.dom.input.blur(),this}},{key:"getItems",value:function(){return this.options.items}},{key:"getCurrent",value:function(){var t=Object.assign({},this.current);return delete t._lc,t}},{key:"clearCurrent",value:function(){this.current={},this.dom.input.value="",this._clearSelected()}},{key:"findItem",value:function(t){return t=t.nodeName?t.dataset.value:t,this.options.items.find(function(e){return e.value===t})}},{key:"_setCurrent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.current=t,this.dom.input.value=t.value.toString(),this._setSelected(t,e),this}},{key:"_setSelected",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._clearSelected(),(e=e||this.dom.list.querySelector('li[data-value="'.concat(t.value,'"]')))&&e.classList.add("si-current")}},{key:"_clearSelected",value:function(){var t=this.dom.list.querySelector(".si-current");t&&t.classList.remove("si-current")}},{key:"_convertItems",value:function(){var t=this;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(function(e){return t._convertItem(e)})}},{key:"_convertItem",value:function(t){return(t="object"!==ue(t)?{value:t}:t)._lc=t.value.toString().toLowerCase(),t}},{key:"_renderInit",value:function(){var t=Ie.createElement("div");return t.className="si-wrap si-hide",this.dom.input=t.appendChild(this._renderInput()).firstChild,this.dom.list=t.appendChild(this._renderList()).firstChild,this.current.value&&(this.dom.input.value=this.current.value),this.dom.el.appendChild(t)}},{key:"_renderInput",value:function(){var t=Ie.createElement("div"),e=Ie.createElement("input");return t.className="si-input",e.type="text",e.autocomplete="false",e.spellcheck=!1,e.placeholder=this.options.placeHolder,t.appendChild(e),t}},{key:"_renderList",value:function(){var t=Ie.createElement("div"),e=Ie.createElement("ul"),n=this.options.maxHeight;return t.className="si-list",n&&(t.style.maxHeight=n+"px"),t.appendChild(e),t}},{key:"_createListItems",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e="",n=this.current.value,r="",i=this.options.allowRemove?this._createRemovalButton():"";return t.forEach(function(t){r=n&&t.value===n?" si-current":"",e+='<li class="si-item'.concat(r,'" data-value="').concat(t.value,'">').concat(t.value).concat(i,"</li>")}),e}},{key:"_renderListItems",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.dom.list.innerHTML=t||this._createListItems(this.options.items),this}},{key:"_createRemovalButton",value:function(){return'<button type="button" class="si-removal">'.concat(this.options.removalIcon,"</button>")}},{key:"_search",value:function(t){var e=null,n=this.options,r=t.target.value,i=r.toLowerCase(),o=n.items.filter(function(t){return-1!==t._lc.indexOf(i)}),u=o||n.allowAdd?this._createListItems(o):"",c=o[0],s=o.length;1===s&&(e=c),(0===s||r&&i!==c._lc)&&n.allowAdd?(this.__found=e,u+=this._proposeItem(r)):0!==s||n.allowAdd||(u+=this._notFoundItem(r)),this._renderListItems(u)}},{key:"_proposeItem",value:function(t){var e=this.options.proposal.replace("{X}","<span>".concat(t,"</span>"));return'<li class="si-item si-append si-proposal" data-term="'.concat(t,'">').concat(e,"</li>")}},{key:"_notFoundItem",value:function(t){var e=this.options.notFound.replace("{X}","<span>".concat(t,"</span>"));return'<li class="si-item si-append si-not-found">'.concat(e,"</li>")}},{key:"_handleClick",value:function(t){var e=t.target,n=e.classList;this.options.allowAdd&&n.contains("si-proposal")?this._tryCreateItem(e.dataset.term)&&this.toggle()._trigger("created",this.current):n.contains("si-item")?this._setCurrent(this.findItem(e),e).toggle()._trigger("selected",this.current):this.options.allowRemove&&n.contains("si-removal")&&(e=e.parentNode,this._fireCallback("onDelete",this.findItem(e))&&this._trigger("removed",this._sliceItem(e)))}},{key:"_fireCallback",value:function(t,e){return"function"!=typeof this.options[t]||this.options[t](e)}},{key:"_handleKey",value:function(t){var e,n=t.target.value,r=this.__found;n&&13!==t.keyCode&&"Enter"!==t.key||(!r&&n&&this.options.allowAdd?e=this._tryCreateItem(n)?"created":null:r&&(e="selected",this._setCurrent(r)),e&&this.toggle()._trigger(e,this.current))}},{key:"_tryCreateItem",value:function(t){var e=this._convertItem(t.trim());return!(this.findItem(t)||!this._fireCallback("onCreate",e))&&(this._setCurrent(this._insertItem(e)),!0)}},{key:"_insertItem",value:function(t){return this.options.items.push(t),this.options.sort&&this._sortItems(),t}},{key:"_sortItems",value:function(){var t="desc"===this.options.order?1:-1;this.options.items.sort(function(e,n){return e._lc<n._lc?-t:e._lc>n._lc?t:0})}},{key:"_sliceItem",value:function(t){var e,n=this.options.items,r=t.dataset.value.toLowerCase(),i=this.current;return this.dom.list.removeChild(t),e=n.splice(n.findIndex(function(t){return t._lc===r}),1).shift(),i&&e._lc===i._lc&&this.clearCurrent(),e}}]),e}()});
//# sourceMappingURL=select-input-umd.js.map
{
"name": "@dotburo/select-input",
"version": "1.2.0",
"version": "1.2.1",
"description": "Lightweight & dynamic select dropdown with an input field, without dependencies",

@@ -5,0 +5,0 @@ "main": "dist/select-input-min.js",

@@ -79,3 +79,5 @@ const d = document;

event = new CustomEvent(name, {
detail: detail
detail: detail,
bubbles: true,
cancelable: true
});

@@ -82,0 +84,0 @@ } else {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc