Socket
Socket
Sign inDemoInstall

@dotburo/select-input

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.1 to 1.3.2

3

dist/select-input-min.js

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

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,valueKey:"value",textKey:"value"};const i=document;export default class extends e{constructor(t,e={}){super(t,e,s);let i=e.current?this._convertItem(e.current):null;this.options.items=this._convertItems(e.items),this.current=i?this.findItem(this._getItemProp(i)):null,this.__found=null,this.options.sort&&this._sortItems(),this._renderInit(),this._bindEvents(),i&&this._setInputValue(i)}_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_value,delete t._lc_text,t}clearCurrent(){this.current=null,this.dom.input.value="",this._clearSelected()}findItem(t){return t=t.nodeName?t.dataset.value:t,this.options.items.find(e=>this._getItemProp(e)==t)}setCurrent(t){return this._setCurrent(t?this.findItem(t):null),this}_setCurrent(t,e=null){return this._setInputValue(t),t?(this.current=t,this._setSelected(t,e)):(this.current=null,this._clearSelected()),this}_setInputValue(t){this.dom.input.value=t?this._getItemProp(t,"text").toString():""}_setSelected(t,e=null){this._clearSelected(),(e=e||this.dom.list.querySelector(`li[data-value="${this._getItemProp(t)}"]`))&&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){let e=this.options;return(t="object"!=typeof t?{[e.valueKey]:t,[e.textKey]:t}:t)._lc_value=this._makeSearchString(this._getItemProp(t)),t._lc_text=this._makeSearchString(this._getItemProp(t,"text")),t}_makeSearchString(t){return t.toString().toLowerCase().replace(/\s+/g,"-")}_getItemProp(t,e="value"){return t?t[this.options[`${e}Key`]]:null}_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.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.options,i=this._getItemProp(this.current),r="",n=s.allowRemove?this._createRemovalButton():"",l="",o="";return t.forEach(t=>{l=this._getItemProp(t),o=this._getItemProp(t,"text"),e+=`<li class="si-item${r=i&&l==i?" si-current":""}" data-value="${l}">${o+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=this.options,s=t.target.value,i=this._makeSearchString(s),r=this._searchItem(i),n=r||e.allowAdd?this._createListItems(r):"",l=r[0],o=r.length;1===o&&(this.__found=l),1===o&&s||(this.__found=null),e.allowAdd&&s&&(!l||i!==l._lc_text&&i!==l._lc_value)?n+=this._proposeItem(s):e.allowAdd||(n+=this._notFoundItem(s)),this._renderListItems(n)}_searchItem(t){return this.options.items.filter(e=>-1!==e._lc_value.indexOf(t)||-1!==e._lc_text.indexOf(t))}_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_text<s._lc_text?-t:e._lc_text>s._lc_text?t:0)}_sliceItem(t){let e,s=this.options.items,i=t.dataset.value.toLowerCase(),r=this.current;return this.dom.list.removeChild(t),e=s.splice(s.findIndex(t=>t._lc_value===i),1).shift(),r&&e._lc_value===r._lc_value&&this.clearCurrent(),e}}
/*! @dotburo/select-input 1.3.1 | dotburo <code@dotburo.org> (https://dotburo.org) !*/
const t=document;var e={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,valueKey:"value",textKey:"value"};const s=document;export default class extends class{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"),i.initEvent(e,!0,!0)),this.dom.el.dispatchEvent(i)}}{constructor(t,s={}){super(t,s,e);let i=s.current?this._convertItem(s.current):null;this.options.items=this._convertItems(s.items),this.current=i?this.findItem(this._getItemProp(i)):null,this.__found=null,this.options.sort&&this._sortItems(),this._renderInit(),this._bindEvents(),i&&this._setInputValue(i)}_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,s),this.on("click",t,s)}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_value,delete t._lc_text,t}clearCurrent(){this.current=null,this.dom.input.value="",this._clearSelected()}findItem(t){return t=t.nodeName?t.dataset.value:t,this.options.items.find(e=>this._getItemProp(e)==t)}setCurrent(t){return this._setCurrent(t?this.findItem(t):null),this}_setCurrent(t,e=null){return this._setInputValue(t),t?(this.current=t,this._setSelected(t,e)):(this.current=null,this._clearSelected()),this}_setInputValue(t){this.dom.input.value=t?this._getItemProp(t,"text").toString():""}_setSelected(t,e=null){this._clearSelected(),(e=e||this.dom.list.querySelector(`li[data-value="${this._getItemProp(t)}"]`))&&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){let e=this.options;return(t="object"!=typeof t?{[e.valueKey]:t,[e.textKey]:t}:t)._lc_value=this._makeSearchString(this._getItemProp(t)),t._lc_text=this._makeSearchString(this._getItemProp(t,"text")),t}_makeSearchString(t){return t.toString().toLowerCase().replace(/\s+/g,"-")}_getItemProp(t,e="value"){return t?t[this.options[`${e}Key`]]:null}_renderInit(){let t=s.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.dom.el.appendChild(t)}_renderInput(){let t=s.createElement("div"),e=s.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=s.createElement("div"),e=s.createElement("ul"),i=this.options.maxHeight;return t.className="si-list",i&&(t.style.maxHeight=i+"px"),t.appendChild(e),t}_createListItems(t=[]){let e="",s=this.options,i=this._getItemProp(this.current),r="",n=s.allowRemove?this._createRemovalButton():"",l="",o="";return t.forEach(t=>{l=this._getItemProp(t),o=this._getItemProp(t,"text"),r=i&&l==i?" si-current":"",e+=`<li class="si-item${r}" data-value="${l}">${o+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=this.options,s=t.target.value,i=this._makeSearchString(s),r=this._searchItem(i),n=r||e.allowAdd?this._createListItems(r):"",l=r[0],o=r.length;1===o&&(this.__found=l),1===o&&s||(this.__found=null),e.allowAdd&&s&&(!l||i!==l._lc_text&&i!==l._lc_value)?n+=this._proposeItem(s):e.allowAdd||(n+=this._notFoundItem(s)),this._renderListItems(n)}_searchItem(t){return this.options.items.filter(e=>-1!==e._lc_value.indexOf(t)||-1!==e._lc_text.indexOf(t))}_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_text<s._lc_text?-t:e._lc_text>s._lc_text?t:0)}_sliceItem(t){let e,s=this.options.items,i=t.dataset.value.toLowerCase(),r=this.current;return this.dom.list.removeChild(t),e=s.splice(s.findIndex(t=>t._lc_value===i),1).shift(),r&&e._lc_value===r._lc_value&&this.clearCurrent(),e}}
//# sourceMappingURL=select-input-min.js.map

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

!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))},j=Math.ceil,L=Math.floor,P=function(t){return isNaN(t=+t)?0:(t>0?L:j)(t)},A=Math.min,T=function(t){return t>0?A(P(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=T(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}},V=F("unscopables"),G=Array.prototype;null==G[V]&&v(G,V,{});var $=function(t){G[V][t]=!0},K=H(6),q="findIndex",B=!0;q in[]&&Array(1)[q](function(){B=!1}),x(x.P+x.F*B,"Array",{findIndex:function(t){return K(this,t,arguments.length>1?arguments[1]:void 0)}}),$(q);var X=p.f,U=Function.prototype,W=/^\s*function ([^ (]*)/;"name"in U||u&&X(U,"name",{configurable:!0,get:function(){try{return(""+this).match(W)[1]}catch(t){return""}}});var z,J=function(t,e){return{value:e,done:!!t}},Q={},Y=function(t){return E(O(t))},Z=Math.max,tt=Math.min,et=M("keys"),nt=function(t){return et[t]||(et[t]=_(t))},rt=(z=!1,function(t,e,n){var r,i=Y(t),o=T(i.length),u=function(t,e){return(t=P(t))<0?Z(t+e,0):tt(t,e)}(n,o);if(z&&e!=e){for(;o>u;)if((r=i[u++])!=r)return!0}else for(;o>u;u++)if((z||u in i)&&i[u]===e)return z||u||0;return!z&&-1}),it=nt("IE_PROTO"),ot="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),ut=Object.keys||function(t){return function(t,e){var n,r=Y(t),i=0,o=[];for(n in r)n!=it&&y(r,n)&&o.push(n);for(;e.length>i;)y(r,n=e[i++])&&(~rt(o,n)||o.push(n));return o}(t,ot)},ct=u?Object.defineProperties:function(t,e){i(t);for(var n,r=ut(e),o=r.length,u=0;o>u;)p.f(t,n=r[u++],e[n]);return t},st=e.document,at=st&&st.documentElement,lt=nt("IE_PROTO"),ft=function(){},pt=function(){var t,e=a("iframe"),n=ot.length;for(e.style.display="none",at.appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),pt=t.F;n--;)delete pt.prototype[ot[n]];return pt()},ht=Object.create||function(t,e){var n;return null!==t?(ft.prototype=i(t),n=new ft,ft.prototype=null,n[lt]=t):n=pt(),void 0===e?n:ct(n,e)},vt=p.f,dt=F("toStringTag"),yt=function(t,e,n){t&&!y(t=n?t:t.prototype,dt)&&vt(t,dt,{configurable:!0,value:e})},mt={};v(mt,F("iterator"),function(){return this});var gt=function(t,e,n){t.prototype=ht(mt,{next:h(1,n)}),yt(t,e+" Iterator")},_t=nt("IE_PROTO"),bt=Object.prototype,St=Object.getPrototypeOf||function(t){return t=C(t),y(t,_t)?t[_t]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?bt:null},kt=F("iterator"),xt=!([].keys&&"next"in[].keys()),It=function(){return this},wt=function(t,e,n,r,i,o,u){gt(n,e,r);var c,s,a,l=function(t){if(!xt&&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[kt]||d["@@iterator"]||i&&d[i],m=y||l(i),g=i?p?l("entries"):m:void 0,_="Array"==e&&d.entries||y;if(_&&(a=St(_.call(new t)))!==Object.prototype&&a.next&&(yt(a,f,!0),"function"!=typeof a[kt]&&v(a,kt,It)),p&&y&&"values"!==y.name&&(h=!0,m=function(){return y.call(this)}),(xt||h||!d[kt])&&v(d,kt,m),Q[e]=m,Q[f]=It,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*(xt||h),e,c);return c}(Array,"Array",function(t,e){this._t=Y(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,J(1)):J(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values");Q.Arguments=Q.Array,$("keys"),$("values"),$("entries");for(var Et=F("iterator"),Ot=F("toStringTag"),Ct=Q.Array,jt={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},Lt=ut(jt),Pt=0;Pt<Lt.length;Pt++){var At,Tt=Lt[Pt],Rt=jt[Tt],Mt=e[Tt],Ft=Mt&&Mt.prototype;if(Ft&&(Ft[Et]||v(Ft,Et,Ct),Ft[Ot]||v(Ft,Ot,Tt),Q[Tt]=Ct,Rt))for(At in wt)Ft[At]||b(Ft,At,wt[At],!0)}var Nt,Dt,Ht=function(t){return function(e,n){var r,i,o=String(O(e)),u=P(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),Vt=function(t,e,n){return e+(n?Ht(t,e).length:1)},Gt=F("toStringTag"),$t="Arguments"==w(function(){return arguments}()),Kt=RegExp.prototype.exec,qt=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),Gt))?i:$t?w(r):"Object"==(o=w(r))&&"function"==typeof r.callee?"Arguments":o))throw new TypeError("RegExp#exec called on incompatible receiver");return Kt.call(t,e)},Bt=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},Xt=RegExp.prototype.exec,Ut=String.prototype.replace,Wt=Xt,zt=(Nt=/a/,Dt=/b*/g,Xt.call(Nt,"a"),Xt.call(Dt,"a"),0!==Nt.lastIndex||0!==Dt.lastIndex),Jt=void 0!==/()??/.exec("")[1];(zt||Jt)&&(Wt=function(t){var e,n,r,i,o=this;return Jt&&(n=new RegExp("^"+o.source+"$(?!\\s)",Bt.call(o))),zt&&(e=o.lastIndex),r=Xt.call(o,t),zt&&r&&(o.lastIndex=o.global?r.index+r[0].length:e),Jt&&r&&r.length>1&&Ut.call(r[0],n,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)}),r});var Qt=Wt;x({target:"RegExp",proto:!0,forced:Qt!==/./.exec},{exec:Qt});var Yt=F("species"),Zt=!o(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),te=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]}(),ee=Math.max,ne=Math.min,re=Math.floor,ie=/\$([$&`']|\d\d?|<[^>]*>)/g,oe=/\$([$&`']|\d\d?)/g;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,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function fe(t){return(fe=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function pe(t,e){return(pe=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function he(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}!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[Yt]=function(){return n}),n[r](""),!e}):void 0;if(!i||!u||"replace"===t&&!Zt||"split"===t&&!te){var c=/./[r],s=n(O,r,""[t],function(t,e,n,r,o){return e.exec===Qt?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=qt(c,s);if(null===h)break;if(p.push(h),!l)break;""===String(h[0])&&(c.lastIndex=Vt(s,T(c.lastIndex),f))}for(var v,d="",y=0,m=0;m<p.length;m++){h=p[m];for(var g=String(h[0]),_=ee(ne(P(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=oe;return void 0!==o&&(o=C(o),a=ie),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=re(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})}}),u&&"g"!=/./g.flags&&p.f(RegExp.prototype,"flags",{configurable:!0,get:Bt});var ve=/./.toString,de=function(t){b(RegExp.prototype,"toString",t,!0)};o(function(){return"/a/b"!=ve.call({source:"a",flags:"b"})})?de(function(){var t=i(this);return"/".concat(t.source,"/","flags"in t?t.flags:!u&&t instanceof RegExp?Bt.call(t):void 0)}):"toString"!=ve.name&&de(function(){return ve.call(this)});var ye=H(5),me=!0;"find"in[]&&Array(1).find(function(){me=!1}),x(x.P+x.F*me,"Array",{find:function(t){return ye(this,t,arguments.length>1?arguments[1]:void 0)}}),$("find");var ge={f:Object.getOwnPropertySymbols},_e={f:{}.propertyIsEnumerable},be=Object.assign,Se=!be||o(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=be({},t)[n]||Object.keys(be({},e)).join("")!=r})?function(t,e){for(var n=C(t),r=arguments.length,i=1,o=ge.f,u=_e.f;r>i;)for(var c,s=E(arguments[i++]),a=o?ut(s).concat(o(s)):ut(s),l=a.length,f=0;l>f;)u.call(s,c=a[f++])&&(n[c]=s[c]);return n}:be;x(x.S+x.F,"Object",{assign:Se});var ke=document,xe=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||ke).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=ke.createEvent("Event")).initEvent(t,!0,!0),this.dom.el.dispatchEvent(e)}}]),t}(),Ie={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,valueKey:"value",textKey:"value"},we=document;return function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ce(this,e),n=he(this,fe(e).call(this,t,r,Ie));var i=r.current?n._convertItem(r.current):null;return n.options.items=n._convertItems(r.items),n.current=i?n.findItem(n._getItemProp(i)):null,n.__found=null,n.options.sort&&n._sortItems(),n._renderInit(),n._bindEvents(),i&&n._setInputValue(i),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&&pe(t,e)}(e,xe),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,we),this.on("click",e,we)}},{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_value,delete t._lc_text,t}},{key:"clearCurrent",value:function(){this.current=null,this.dom.input.value="",this._clearSelected()}},{key:"findItem",value:function(t){var e=this;return t=t.nodeName?t.dataset.value:t,this.options.items.find(function(n){return e._getItemProp(n)==t})}},{key:"setCurrent",value:function(t){return this._setCurrent(t?this.findItem(t):null),this}},{key:"_setCurrent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._setInputValue(t),t?(this.current=t,this._setSelected(t,e)):(this.current=null,this._clearSelected()),this}},{key:"_setInputValue",value:function(t){this.dom.input.value=t?this._getItemProp(t,"text").toString():""}},{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(this._getItemProp(t),'"]')))&&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){var e,n=this.options;return(t="object"!==ue(t)?(le(e={},n.valueKey,t),le(e,n.textKey,t),e):t)._lc_value=this._makeSearchString(this._getItemProp(t)),t._lc_text=this._makeSearchString(this._getItemProp(t,"text")),t}},{key:"_makeSearchString",value:function(t){return t.toString().toLowerCase().replace(/\s+/g,"-")}},{key:"_getItemProp",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return t?t[this.options["".concat(e,"Key")]]:null}},{key:"_renderInit",value:function(){var t=we.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.dom.el.appendChild(t)}},{key:"_renderInput",value:function(){var t=we.createElement("div"),e=we.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=we.createElement("div"),e=we.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=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n="",r=this.options,i=this._getItemProp(this.current),o=r.allowRemove?this._createRemovalButton():"",u="",c="";return e.forEach(function(e){u=t._getItemProp(e),c=t._getItemProp(e,"text"),n+='<li class="si-item'.concat(i&&u==i?" si-current":"",'" data-value="').concat(u,'">').concat(c+o,"</li>")}),n}},{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=this.options,n=t.target.value,r=this._makeSearchString(n),i=this._searchItem(r),o=i||e.allowAdd?this._createListItems(i):"",u=i[0],c=i.length;1===c&&(this.__found=u),1===c&&n||(this.__found=null),e.allowAdd&&n&&(!u||r!==u._lc_text&&r!==u._lc_value)?o+=this._proposeItem(n):e.allowAdd||(o+=this._notFoundItem(n)),this._renderListItems(o)}},{key:"_searchItem",value:function(t){return this.options.items.filter(function(e){return-1!==e._lc_value.indexOf(t)||-1!==e._lc_text.indexOf(t)})}},{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_text<n._lc_text?-t:e._lc_text>n._lc_text?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_value===r}),1).shift(),i&&e._lc_value===i._lc_value&&this.clearCurrent(),e}}]),e}()});
/*! @dotburo/select-input 1.3.1 | dotburo <code@dotburo.org> (https://dotburo.org) !*/
!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.11"};"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,a=r(c)&&r(c.createElement),l=!u&&!o((function(){return 7!=Object.defineProperty((t="div",a?c.createElement(t):{}),"a",{get:function(){return 7}}).a;var t})),s=Object.defineProperty,f={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 s(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=u?function(t,e,n){return f.f(t,e,function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}(1,n))}:function(t,e,n){return t[e]=n,t},p={}.hasOwnProperty,v=function(t,e){return p.call(t,e)},d=0,m=Math.random(),y=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++d+m).toString(36))},g=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)"})})),_=g("native-function-to-string",Function.toString),b=t((function(t){var r=y("src"),i=(""+_).split("toString");n.inspectSource=function(t){return _.call(t)},(t.exports=function(t,n,o,u){var c="function"==typeof o;c&&(v(o,"name")||h(o,"name",n)),t[n]!==o&&(c&&(v(o,r)||h(o,r,t[n]?""+t[n]:i.join(String(n)))),t===e?t[n]=o:u?t[n]?t[n]=o:h(t,n,o):(delete t[n],h(t,n,o)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[r]||_.call(this)}))})),k=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)}},x=function(t,r,i){var o,u,c,a,l=t&x.F,s=t&x.G,f=t&x.S,p=t&x.P,v=t&x.B,d=s?e:f?e[r]||(e[r]={}):(e[r]||{}).prototype,m=s?n:n[r]||(n[r]={}),y=m.prototype||(m.prototype={});for(o in s&&(i=r),i)c=((u=!l&&d&&void 0!==d[o])?d:i)[o],a=v&&u?k(c,e):p&&"function"==typeof c?k(Function.call,c):c,d&&b(d,o,c,t&x.U),m[o]!=c&&h(m,o,a),p&&y[o]!=c&&(y[o]=c)};e.core=n,x.F=1,x.G=2,x.S=4,x.P=8,x.B=16,x.W=32,x.U=64,x.R=128;var I=x,S={}.toString,E=function(t){return S.call(t).slice(8,-1)},w=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==E(t)?t.split(""):Object(t)},C=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},j=function(t){return Object(C(t))},O=Math.ceil,P=Math.floor,A=function(t){return isNaN(t=+t)?0:(t>0?P:O)(t)},R=Math.min,L=function(t){return t>0?R(A(t),9007199254740991):0},T=Array.isArray||function(t){return"Array"==E(t)},F=t((function(t){var n=g("wks"),r=e.Symbol,i="function"==typeof r;(t.exports=function(t){return n[t]||(n[t]=i&&r[t]||(i?r:y)("Symbol."+t))}).store=n})),M=F("species"),N=function(t,e){return new(function(t){var e;return T(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!T(e.prototype)||(e=void 0),r(e)&&null===(e=e[M])&&(e=void 0)),void 0===e?Array:e}(t))(e)},$=function(t,e){var n=1==t,r=2==t,i=3==t,o=4==t,u=6==t,c=5==t||u,a=e||N;return function(e,l,s){for(var f,h,p=j(e),v=w(p),d=k(l,s,3),m=L(v.length),y=0,g=n?a(e,m):r?a(e,0):void 0;m>y;y++)if((c||y in v)&&(h=d(f=v[y],y,p),t))if(n)g[y]=h;else if(h)switch(t){case 3:return!0;case 5:return f;case 6:return y;case 2:g.push(f)}else if(o)return!1;return u?-1:i||o?o:g}},K=F("unscopables"),H=Array.prototype;null==H[K]&&h(H,K,{});var D=function(t){H[K][t]=!0},q=$(6),z="findIndex",B=!0;z in[]&&Array(1)[z]((function(){B=!1})),I(I.P+I.F*B,"Array",{findIndex:function(t){return q(this,t,arguments.length>1?arguments[1]:void 0)}}),D(z);var X,U,V=function(t){return function(e,n){var r,i,o=String(C(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),G=function(t,e,n){return e+(n?V(t,e).length:1)},W=F("toStringTag"),J="Arguments"==E(function(){return arguments}()),Q=function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),W))?n:J?E(e):"Object"==(r=E(e))&&"function"==typeof e.callee?"Arguments":r},Y=RegExp.prototype.exec,Z=function(t,e){var n=t.exec;if("function"==typeof n){var r=n.call(t,e);if("object"!=typeof r)throw new TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==Q(t))throw new TypeError("RegExp#exec called on incompatible receiver");return Y.call(t,e)},tt=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},et=RegExp.prototype.exec,nt=String.prototype.replace,rt=et,it=(X=/a/,U=/b*/g,et.call(X,"a"),et.call(U,"a"),0!==X.lastIndex||0!==U.lastIndex),ot=void 0!==/()??/.exec("")[1];(it||ot)&&(rt=function(t){var e,n,r,i,o=this;return ot&&(n=new RegExp("^"+o.source+"$(?!\\s)",tt.call(o))),it&&(e=o.lastIndex),r=et.call(o,t),it&&r&&(o.lastIndex=o.global?r.index+r[0].length:e),ot&&r&&r.length>1&&nt.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r});var ut=rt;I({target:"RegExp",proto:!0,forced:ut!==/./.exec},{exec:ut});var ct=F("species"),at=!o((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),lt=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]}(),st=Math.max,ft=Math.min,ht=Math.floor,pt=/\$([$&`']|\d\d?|<[^>]*>)/g,vt=/\$([$&`']|\d\d?)/g;function dt(t){return(dt="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 mt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yt(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 gt(t,e,n){return e&&yt(t.prototype,e),n&&yt(t,n),t}function _t(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function bt(t){return(bt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function kt(t,e){return(kt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function xt(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}!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[ct]=function(){return n}),n[r](""),!e})):void 0;if(!i||!u||"replace"===t&&!at||"split"===t&&!lt){var c=/./[r],a=n(C,r,""[t],(function(t,e,n,r,o){return e.exec===ut?i&&!o?{done:!0,value:c.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}})),l=a[0],s=a[1];b(String.prototype,t,l),h(RegExp.prototype,r,2==e?function(t,e){return s.call(t,this,e)}:function(t){return s.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),a=String(this),l="function"==typeof e;l||(e=String(e));var s=c.global;if(s){var f=c.unicode;c.lastIndex=0}for(var h=[];;){var p=Z(c,a);if(null===p)break;if(h.push(p),!s)break;""===String(p[0])&&(c.lastIndex=G(a,L(c.lastIndex),f))}for(var v,d="",m=0,y=0;y<h.length;y++){p=h[y];for(var g=String(p[0]),_=st(ft(A(p.index),a.length),0),b=[],k=1;k<p.length;k++)b.push(void 0===(v=p[k])?v:String(v));var x=p.groups;if(l){var I=[g].concat(b,_,a);void 0!==x&&I.push(x);var S=String(e.apply(void 0,I))}else S=o(g,a,_,b,x,e);_>=m&&(d+=a.slice(m,_)+S,m=_+g.length)}return d+a.slice(m)}];function o(t,e,r,i,o,u){var c=r+t.length,a=i.length,l=vt;return void 0!==o&&(o=j(o),l=pt),n.call(u,l,(function(n,u){var l;switch(u.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,r);case"'":return e.slice(c);case"<":l=o[u.slice(1,-1)];break;default:var s=+u;if(0===s)return n;if(s>a){var f=ht(s/10);return 0===f?n:f<=a?void 0===i[f-1]?u.charAt(1):i[f-1]+u.charAt(1):n}l=i[s-1]}return void 0===l?"":l}))}})),u&&"g"!=/./g.flags&&f.f(RegExp.prototype,"flags",{configurable:!0,get:tt});var It=/./.toString,St=function(t){b(RegExp.prototype,"toString",t,!0)};o((function(){return"/a/b"!=It.call({source:"a",flags:"b"})}))?St((function(){var t=i(this);return"/".concat(t.source,"/","flags"in t?t.flags:!u&&t instanceof RegExp?tt.call(t):void 0)})):"toString"!=It.name&&St((function(){return It.call(this)}));var Et={};Et[F("toStringTag")]="z",Et+""!="[object z]"&&b(Object.prototype,"toString",(function(){return"[object "+Q(this)+"]"}),!0);var wt=$(5),Ct=!0;"find"in[]&&Array(1).find((function(){Ct=!1})),I(I.P+I.F*Ct,"Array",{find:function(t){return wt(this,t,arguments.length>1?arguments[1]:void 0)}}),D("find");var jt,Ot,Pt=function(t){return w(C(t))},At=Math.max,Rt=Math.min,Lt=g("keys"),Tt=(jt=!1,function(t,e,n){var r,i=Pt(t),o=L(i.length),u=function(t,e){return(t=A(t))<0?At(t+e,0):Rt(t,e)}(n,o);if(jt&&e!=e){for(;o>u;)if((r=i[u++])!=r)return!0}else for(;o>u;u++)if((jt||u in i)&&i[u]===e)return jt||u||0;return!jt&&-1}),Ft=Lt[Ot="IE_PROTO"]||(Lt[Ot]=y(Ot)),Mt="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Nt=Object.keys||function(t){return function(t,e){var n,r=Pt(t),i=0,o=[];for(n in r)n!=Ft&&v(r,n)&&o.push(n);for(;e.length>i;)v(r,n=e[i++])&&(~Tt(o,n)||o.push(n));return o}(t,Mt)},$t={f:Object.getOwnPropertySymbols},Kt={f:{}.propertyIsEnumerable},Ht=Object.assign,Dt=!Ht||o((function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!=Ht({},t)[n]||Object.keys(Ht({},e)).join("")!=r}))?function(t,e){for(var n=j(t),r=arguments.length,i=1,o=$t.f,c=Kt.f;r>i;)for(var a,l=w(arguments[i++]),s=o?Nt(l).concat(o(l)):Nt(l),f=s.length,h=0;f>h;)a=s[h++],u&&!c.call(l,a)||(n[a]=l[a]);return n}:Ht;I(I.S+I.F,"Object",{assign:Dt});var qt=f.f,zt=Function.prototype,Bt=/^\s*function ([^ (]*)/;"name"in zt||u&&qt(zt,"name",{configurable:!0,get:function(){try{return(""+this).match(Bt)[1]}catch(t){return""}}});var Xt=document,Ut=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]:{};mt(this,t),this.options=Object.assign({},r,n),this._events=[],this.dom={el:this._setElement(e)}}return gt(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||Xt).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=Xt.createEvent("Event")).initEvent(t,!0,!0),this.dom.el.dispatchEvent(e)}}]),t}(),Vt={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,valueKey:"value",textKey:"value"},Gt=document;return function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};mt(this,e),n=xt(this,bt(e).call(this,t,r,Vt));var i=r.current?n._convertItem(r.current):null;return n.options.items=n._convertItems(r.items),n.current=i?n.findItem(n._getItemProp(i)):null,n.__found=null,n.options.sort&&n._sortItems(),n._renderInit(),n._bindEvents(),i&&n._setInputValue(i),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&&kt(t,e)}(e,t),gt(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,Gt),this.on("click",e,Gt)}},{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_value,delete t._lc_text,t}},{key:"clearCurrent",value:function(){this.current=null,this.dom.input.value="",this._clearSelected()}},{key:"findItem",value:function(t){var e=this;return t=t.nodeName?t.dataset.value:t,this.options.items.find((function(n){return e._getItemProp(n)==t}))}},{key:"setCurrent",value:function(t){return this._setCurrent(t?this.findItem(t):null),this}},{key:"_setCurrent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._setInputValue(t),t?(this.current=t,this._setSelected(t,e)):(this.current=null,this._clearSelected()),this}},{key:"_setInputValue",value:function(t){this.dom.input.value=t?this._getItemProp(t,"text").toString():""}},{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(this._getItemProp(t),'"]')))&&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,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map((function(e){return t._convertItem(e)}))}},{key:"_convertItem",value:function(t){var e,n=this.options;return(t="object"!==dt(t)?(_t(e={},n.valueKey,t),_t(e,n.textKey,t),e):t)._lc_value=this._makeSearchString(this._getItemProp(t)),t._lc_text=this._makeSearchString(this._getItemProp(t,"text")),t}},{key:"_makeSearchString",value:function(t){return t.toString().toLowerCase().replace(/\s+/g,"-")}},{key:"_getItemProp",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return t?t[this.options["".concat(e,"Key")]]:null}},{key:"_renderInit",value:function(){var t=Gt.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.dom.el.appendChild(t)}},{key:"_renderInput",value:function(){var t=Gt.createElement("div"),e=Gt.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=Gt.createElement("div"),e=Gt.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=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n="",r=this.options,i=this._getItemProp(this.current),o=r.allowRemove?this._createRemovalButton():"",u="",c="";return e.forEach((function(e){u=t._getItemProp(e),c=t._getItemProp(e,"text"),n+='<li class="si-item'.concat(i&&u==i?" si-current":"",'" data-value="').concat(u,'">').concat(c+o,"</li>")})),n}},{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=this.options,n=t.target.value,r=this._makeSearchString(n),i=this._searchItem(r),o=i||e.allowAdd?this._createListItems(i):"",u=i[0],c=i.length;1===c&&(this.__found=u),1===c&&n||(this.__found=null),e.allowAdd&&n&&(!u||r!==u._lc_text&&r!==u._lc_value)?o+=this._proposeItem(n):e.allowAdd||(o+=this._notFoundItem(n)),this._renderListItems(o)}},{key:"_searchItem",value:function(t){return this.options.items.filter((function(e){return-1!==e._lc_value.indexOf(t)||-1!==e._lc_text.indexOf(t)}))}},{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_text<n._lc_text?-t:e._lc_text>n._lc_text?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_value===r})),1).shift(),i&&e._lc_value===i._lc_value&&this.clearCurrent(),e}}]),e}(Ut)}));
//# sourceMappingURL=select-input-umd.js.map
{
"name": "@dotburo/select-input",
"version": "1.3.1",
"version": "1.3.2",
"description": "Lightweight & dynamic select dropdown with an input field, without dependencies",

@@ -33,13 +33,13 @@ "main": "dist/select-input-min.js",

"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.3.1",
"clean-css-cli": "^4.2.1",
"rollup": "^1.1.2",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-terser": "^4.0.4"
"@babel/core": "^7.8.4",
"@babel/polyfill": "^7.8.3",
"@babel/preset-env": "^7.8.4",
"clean-css-cli": "^4.3.0",
"rollup": "^1.31.1",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-node-resolve": "^4.2.4",
"rollup-plugin-terser": "^5.2.0"
},
"dependencies": {}
}

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc