Packages

Phoenix component that utilizes Lea Verou's autocomplete autosuggest accessible (WCAG 2) Awesomplete widget, featuring dynamic data loading

Current section

Files

Jump to
phoenix_form_awesomplete priv static awesomplete_bundle.min.js
Raw

priv/static/awesomplete_bundle.min.js

var AwesompleteBundle=(()=>{var dt=Object.create;var Q=Object.defineProperty;var mt=Object.getOwnPropertyDescriptor;var vt=Object.getOwnPropertyNames;var bt=Object.getPrototypeOf,gt=Object.prototype.hasOwnProperty;var rt=(l,u)=>()=>(u||l((u={exports:{}}).exports,u),u.exports),yt=(l,u)=>{for(var h in u)Q(l,h,{get:u[h],enumerable:!0})},st=(l,u,h,m)=>{if(u&&typeof u=="object"||typeof u=="function")for(let r of vt(u))!gt.call(l,r)&&r!==h&&Q(l,r,{get:()=>u[r],enumerable:!(m=mt(u,r))||m.enumerable});return l};var lt=(l,u,h)=>(h=l!=null?dt(bt(l)):{},st(u||!l||!l.__esModule?Q(h,"default",{value:l,enumerable:!0}):h,l)),At=l=>st(Q({},"__esModule",{value:!0}),l);var ut=rt((St,V)=>{(function(){var l=function(i,s){var p=this;l.count=(l.count||0)+1,this.count=l.count,this.isOpened=!1,this.input=r(i),this.input.setAttribute("autocomplete","off"),this.input.setAttribute("aria-autocomplete","list"),this.input.setAttribute("aria-expanded","false"),this.input.setAttribute("aria-owns","awesomplete_list_"+this.count),this.input.setAttribute("role","combobox"),this.options=s=s||{},h(this,{minChars:2,maxItems:10,autoFirst:!1,data:l.DATA,filter:l.FILTER_CONTAINS,sort:s.sort===!1?!1:l.SORT_BYLENGTH,container:l.CONTAINER,item:l.ITEM,replace:l.REPLACE,tabSelect:!1,listLabel:"Results List",statusNoResults:"No results found",statusXResults:"{0} results found",statusTypeXChar:"Type {0} or more characters for results"},s),this.index=-1,this.container=this.container(i),this.ul=r.create("ul",{hidden:"hidden",role:"listbox",id:"awesomplete_list_"+this.count,inside:this.container,"aria-label":this.listLabel}),this.status=r.create("span",{className:"visually-hidden",role:"status","aria-live":"assertive","aria-atomic":!0,inside:this.container,textContent:""}),this._events={input:{input:this.evaluate.bind(this),blur:this.close.bind(this,{reason:"blur"}),keydown:function(a){var c=a.keyCode;p.opened&&(c===13&&p.selected||c===9&&p.selected&&p.tabSelect?(a.preventDefault(),p.select(void 0,void 0,a)):c===27?p.close({reason:"esc"}):(c===38||c===40)&&(a.preventDefault(),p[c===38?"previous":"next"]()))}},form:{submit:this.close.bind(this,{reason:"submit"})},ul:{mousedown:function(a){a.preventDefault()},click:function(a){var c=a.target;if(c!==this){for(;c&&!/li/i.test(c.nodeName);)c=c.parentNode;c&&a.button===0&&(a.preventDefault(),p.select(c,a.target,a))}}}},r.bind(this.input,this._events.input),r.bind(this.input.form,this._events.form),r.bind(this.ul,this._events.ul),this.input.hasAttribute("list")?(this.list="#"+this.input.getAttribute("list"),this.input.removeAttribute("list")):this.list=this.input.getAttribute("data-list")||s.list||[],l.all.push(this)};l.prototype={set list(i){if(Array.isArray(i))this._list=i;else if(typeof i=="string"&&i.indexOf(",")>-1)this._list=i.split(/\s*,\s*/);else if(i=r(i),i&&i.children){var s=[];m.apply(i.children).forEach(function(p){if(!p.disabled){var a=p.textContent.trim(),c=p.value||a,E=p.label||a;c!==""&&s.push({label:E,value:c})}}),this._list=s}document.activeElement===this.input&&this.evaluate()},get selected(){return this.index>-1},get opened(){return this.isOpened},close:function(i){this.opened&&(this.input.setAttribute("aria-expanded","false"),this.ul.setAttribute("hidden",""),this.isOpened=!1,this.index=-1,this.status.setAttribute("hidden",""),this.input.setAttribute("aria-activedescendant",""),r.fire(this.input,"awesomplete-close",i||{}))},open:function(){this.input.setAttribute("aria-expanded","true"),this.ul.removeAttribute("hidden"),this.isOpened=!0,this.status.removeAttribute("hidden"),this.autoFirst&&this.index===-1&&this.goto(0),r.fire(this.input,"awesomplete-open")},destroy:function(){if(r.unbind(this.input,this._events.input),r.unbind(this.input.form,this._events.form),!this.options.container){var i=this.container.parentNode;i.insertBefore(this.input,this.container),i.removeChild(this.container)}this.input.removeAttribute("autocomplete"),this.input.removeAttribute("aria-autocomplete"),this.input.removeAttribute("aria-expanded"),this.input.removeAttribute("aria-owns"),this.input.removeAttribute("role");var s=l.all.indexOf(this);s!==-1&&l.all.splice(s,1)},next:function(){var i=this.ul.children.length;this.goto(this.index<i-1?this.index+1:i?0:-1)},previous:function(){var i=this.ul.children.length,s=this.index-1;this.goto(this.selected&&s!==-1?s:i-1)},goto:function(i){var s=this.ul.children;this.selected&&s[this.index].setAttribute("aria-selected","false"),this.index=i,i>-1&&s.length>0&&(s[i].setAttribute("aria-selected","true"),this.input.setAttribute("aria-activedescendant",this.ul.id+"_item_"+this.index),this.ul.scrollTop=s[i].offsetTop-this.ul.clientHeight+s[i].clientHeight,r.fire(this.input,"awesomplete-highlight",{text:this.suggestions[this.index]}))},select:function(i,s,p){if(i?this.index=r.siblingIndex(i):i=this.ul.children[this.index],i){var a=this.suggestions[this.index],c=r.fire(this.input,"awesomplete-select",{text:a,origin:s||i,originalEvent:p});c&&(this.replace(a),this.close({reason:"select"}),r.fire(this.input,"awesomplete-selectcomplete",{text:a,originalEvent:p}))}},evaluate:function(){var i=this,s=this.input.value;s.length>=this.minChars&&this._list&&this._list.length>0?(this.index=-1,this.ul.innerHTML="",this.suggestions=this._list.map(function(p){return new u(i.data(p,s))}).filter(function(p){return i.filter(p,s)}),this.sort!==!1&&(this.suggestions=this.suggestions.sort(this.sort)),this.suggestions=this.suggestions.slice(0,this.maxItems),this.suggestions.forEach(function(p,a){i.ul.appendChild(i.item(p,s,a))}),this.ul.children.length===0?(this.status.textContent=this.statusNoResults,this.close({reason:"nomatches"})):(this.input.setAttribute("aria-activedescendant",""),this.open(),this.status.textContent=this.statusXResults.replaceAll("{0}",this.ul.children.length))):(this.close({reason:"nomatches"}),this.minChar<=1||s.length>=this.minChars?this.status.textContent=this.statusNoResults:this.status.textContent=this.statusTypeXChar.replaceAll("{0}",this.minChars))}},l.all=[],l.FILTER_CONTAINS=function(i,s){return RegExp(r.regExpEscape(s.trim()),"i").test(i)},l.FILTER_STARTSWITH=function(i,s){return RegExp("^"+r.regExpEscape(s.trim()),"i").test(i)},l.SORT_BYLENGTH=function(i,s){return i.length!==s.length?i.length-s.length:i<s?-1:1},l.CONTAINER=function(i){return r.create("div",{className:"awesomplete",around:i})},l.ITEM=function(i,s,p){var a=s.trim()===""?i:i.replace(RegExp(r.regExpEscape(s.trim()),"gi"),"<mark>$&</mark>");return r.create("li",{innerHTML:a,role:"option","aria-selected":"false",tabindex:"-1",id:"awesomplete_list_"+this.count+"_item_"+p})},l.REPLACE=function(i){this.input.value=i.value},l.DATA=function(i){return i};function u(i){var s=Array.isArray(i)?{label:i[0],value:i[1]}:typeof i=="object"&&"label"in i&&"value"in i?i:{label:i,value:i};this.label=s.label||s.value,this.value=s.value}Object.defineProperty(u.prototype=Object.create(String.prototype),"length",{get:function(){return this.label.length}}),u.prototype.toString=u.prototype.valueOf=function(){return""+this.label};function h(i,s,p){for(var a in s){var c=s[a],E=i.input.getAttribute("data-"+a.toLowerCase());typeof c=="number"?i[a]=parseInt(E):c===!1?i[a]=E!==null:c instanceof Function?i[a]=null:i[a]=E,!i[a]&&i[a]!==0&&(i[a]=a in p?p[a]:c)}}var m=Array.prototype.slice;function r(i,s){return typeof i=="string"?(s||document).querySelector(i):i||null}function b(i,s){return m.call((s||document).querySelectorAll(i))}r.create=function(i,s){var p=document.createElement(i);for(var a in s){var c=s[a];if(a==="inside")r(c).appendChild(p);else if(a==="around"){var E=r(c);E.parentNode.insertBefore(p,E),p.appendChild(E),E.getAttribute("autofocus")!=null&&E.focus()}else a in p?p[a]=c:p.setAttribute(a,c)}return p},r.bind=function(i,s){if(i)for(var p in s){var a=s[p];p.split(/\s+/).forEach(function(c){i.addEventListener(c,a)})}},r.unbind=function(i,s){if(i)for(var p in s){var a=s[p];p.split(/\s+/).forEach(function(c){i.removeEventListener(c,a)})}},r.fire=function(i,s,p){var a=document.createEvent("HTMLEvents");a.initEvent(s,!0,!0);for(var c in p)a[c]=p[c];return i.dispatchEvent(a)},r.regExpEscape=function(i){return i.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&")},r.siblingIndex=function(i){for(var s=0;i=i.previousElementSibling;s++);return s};function v(){b("input.awesomplete").forEach(function(i){new l(i)})}return typeof self!="undefined"&&(self.Awesomplete=l),typeof Document!="undefined"&&(document.readyState!=="loading"?v():document.addEventListener("DOMContentLoaded",v)),l.$=r,l.$$=b,typeof V=="object"&&V.exports&&(V.exports=l),l})()});var at=rt((Ft,Y)=>{var ot=function(){var l="awesomplete-",u=l+"loadcomplete",h=l+"selectcomplete",m=l+"match",r=l+"prepop",b=l+"select",v="awe-found",i="awe-not-found",s=Awesomplete.$;function p(t){var e=Array.isArray(t)?{label:t[0],value:t[1]}:typeof t=="object"&&"label"in t&&"value"in t?t:{label:t,value:t};return{label:e.label||e.value,value:e.value}}function a(t,e,n){return s.fire(t,e,{detail:n})}function c(t,e){var n=t.input,o=n.classList,f=t.utilprops,d=f.selected,g=f.convertInput.call(t,n.value),_=t.opened,T=[],C=t._list,y,I,A,x;if(f.prepop=!1,C){for(x=0;x<C.length;x++)if(A=C[x],y=p(t.data(A,g)),t.maxItems===0&&(y.toString=function(){return""+this.label},t.filter(y,g)&&(_=!0)),I={input:{value:""}},t.replace.call(I,y),f.convertInput.call(t,I.input.value)===g){if(d&&d.value===y.value&&d.label===y.label){T=[A];break}T.push(A)}f.prevSelected!==T&&(T.length>0?e?a(n,r,T):f.changed&&(f.prevSelected=T,o.remove(i),o.add(v),a(n,m,T)):e?a(n,r,[]):f.changed&&(f.prevSelected=[],o.remove(v),!_||n!==document.activeElement?g!==""&&(o.add(i),a(n,m,[])):o.remove(i)))}}function E(t){var e=this;(t.type===h||t.type===u||t.type==="blur")&&t.target===e.input&&c(e,e.utilprops.prepop&&t.type===u)}function X(t){var e=this;t.target===e.input&&t.keyCode===9&&e.select(void 0,void 0,t)}function w(t){var e=this;clearTimeout(e.utilprops.timeoutID),e.utilprops.changed=!0,e.utilprops.selected=t.text}function U(t){return Object.keys(t).length===0&&t.constructor===Object}function P(t,e,n){var o=t.utilprops;return!o.listQuery||!o.loadall&&e.lastIndexOf(n,0)===0&&(e.lastIndexOf(o.listQuery,0)!==0||typeof o.limit=="number"&&t._list.length>=o.limit)}function q(t,e,n){t.list=e,t.utilprops.listQuery=n,a(t.input,u,n)}function N(t,e,n,o){var f;if(o||P(t,t.utilprops.val,n)){if(typeof e=="string"&&(e=JSON.parse(e)),t.utilprops.convertResponse&&(e=t.utilprops.convertResponse.call(t,e)),!Array.isArray(e)){if(t.utilprops.limit===0||t.utilprops.limit===1)e=U(e)?[]:[e];else for(f in e)if(Array.isArray(e[f])){e=e[f];break}}Array.isArray(e)&&q(t,e,n||t.utilprops.loadall)}return t}function M(){var t=this,e=t.awe,n=t.xhr,o=t.queryVal;n.status===200&&N(e,n.responseText,o,!1)}function D(t,e){var n=new XMLHttpRequest;t.utilprops.ajax.call(t,t.utilprops.url,t.utilprops.urlEnd,t.utilprops.loadall?"":e,M.bind({awe:t,xhr:n,queryVal:e}),n)}function S(t,e,n){t.utilprops.url&&P(t,e,e)?typeof n=="number"&&n>0?t.utilprops.timeoutID=setTimeout(D.bind(null,t,e),n):D(t,e):c(t,t.utilprops.prepop)}function W(t){var e=t.input,n=e.classList;n.remove(i),n.remove(v),a(e,m,[])}function H(t,e,n){return t.utilprops.prepop=n||!1,t.utilprops.val!==e&&(clearTimeout(t.utilprops.timeoutID),t.utilprops.selected=null,t.utilprops.changed=!0,t.utilprops.val=e,(e===""||e.length<t.minChars)&&W(t),e.length>=t.minChars&&S(t,e,t.utilprops.debounce)),t}function K(t){var e=this,n;t.target===e.input&&(n=e.utilprops.convertInput.call(e,e.input.value),H(e,n))}function F(t,e,n){return s.create("li",{innerHTML:t,role:"option","aria-selected":"false",tabindex:"-1",id:"awesomplete_list_"+this.count+"_item_"+n})}function k(t){return t.replace("&","&amp;").replace("<","&lt;").replace(">","&gt;")}function $(t){var e=this,n=e.sourceId,o=e.dataField,f=e.targetId,d,g;t.target===s(n)&&(typeof f=="function"?f(t,o):(d=s(f),d&&d!==document.activeElement&&(g=Array.isArray(t.detail)&&t.detail.length===1?t.detail[0]:null,g=(o&&g?g[o]:g)||"",typeof d.value!="undefined"?(d.value=g,d.classList&&d.classList.remove&&d.classList.remove(i)):typeof d.src!="undefined"?d.src=g:d.innerHTML=g)))}function B(t){var e=this,n,o;t.target===s(e.btnId)&&(t.preventDefault(),n=e.awe,n.ul.childNodes.length===0||n.ul.hasAttribute("hidden")?(o=n.minChars,n.minChars=0,n.evaluate(),n.minChars=o):n.close())}function L(t,e,n){var o=s.regExpEscape(k(e).trim()),f=o===""?null:n?RegExp("^"+o,"i"):RegExp("(?!<[^>]+?>)"+o+"(?![^<]*?>)","gi");return t.replace(f,"<mark>$&</mark>")}function j(t,e,n,o,f){var d=f.root,g=f.value,_=f.label||f.value,T=!0,C=[],y;if(o===0&&d&&n&&(n+".").lastIndexOf(d+".",0)!==0&&(d+".").lastIndexOf(n+".",0)!==0)return t;if(Object(e)!==e)n?t[n]=e:t=e;else if(Array.isArray(e)){for(y=0;y<e.length;y++)C.push(j({},e[y],"",o+1,f));n?t[n]=C:t=C}else{for(y in e)T=!1,j(t,e[y],n?n+"."+y:y,o,f);T&&n&&(t[n]={})}return o<2&&n&&(g&&(n+".").lastIndexOf(g+".",0)===0&&(t.value=t[n]),_&&(n+".").lastIndexOf(_+".",0)===0&&(t.label=t[n])),o===0&&(g&&!("value"in t)&&(t.value=null),_&&!("label"in t)&&(t.label=null)),t}function G(){var t=this,e=t.awe.input,n=t.boundMatch,o=t.boundOnInput,f=t.boundOnKeydown,d=t.boundSelect;e.removeEventListener(b,d),e.removeEventListener(u,n),e.removeEventListener(h,n),e.removeEventListener("blur",n),e.removeEventListener("input",o),e.removeEventListener("keydown",f)}return{ajax:function(t,e,n,o,f){var d=encodeURIComponent(n);return f=f||new XMLHttpRequest,f.open("GET",t+(typeof e=="function"?e(d):d+(e||""))),f.onload=o,f.send(),f},convertInput:function(t){return typeof t=="string"?t.trim().toLowerCase():""},item:F,load:q,mark:L,itemContains:function(t,e,n){var o;return e.trim()!==""&&(o=(""+t).split(/<p>/),o[0]=L(o[0],e),t=o.join("<p>")),F.call(this,t,e,n)},itemMarkAll:function(t,e,n){return F.call(this,e.trim()===""?""+t:L(""+t,e),e,n)},itemStartsWith:function(t,e,n){return F.call(this,e.trim()===""?""+t:L(""+t,e,!0),e,n)},itemWords:function(t,e,n){var o,f=e.split(/\s+/),d;if(e.trim()!==""){for(o=(""+t).split("<"),d=0;d<f.length;d++)o[0]=L(o[0],f[d]);t=o.join("<")}return F.call(this,t,e,n)},create:function(t,e,n){n.item=n.item||this.itemContains;var o=new Awesomplete(t,n);return o.utilprops=e||{},!o.utilprops.url&&typeof o.utilprops.loadall=="undefined"&&(o.utilprops.loadall=!0),o.utilprops.ajax=o.utilprops.ajax||this.ajax,o.utilprops.convertInput=o.utilprops.convertInput||this.convertInput,o},attach:function(t){var e=t.input,n=E.bind(t),o=X.bind(t),f=K.bind(t),d=w.bind(t),g=G.bind({awe:t,boundMatch:n,boundOnInput:f,boundOnKeydown:o,boundSelect:d}),_={keydown:o,input:f};return _.blur=_[h]=_[u]=n,_[b]=d,s.bind(e,_),t.utilprops.detach=g,t.utilprops.prepop&&(t.utilprops.loadall||e.value!=="")&&(t.utilprops.val=t.utilprops.convertInput.call(t,e.value),S(t,t.utilprops.val)),t},update:function(t,e,n){return t.input.value=e,H(t,e,n)},updateList:function(t,e,n,o){return N(t,e,n,o)},start:function(t,e,n){return this.attach(this.create(t,e,n))},detach:function(t){return clearTimeout(t.utilprops.timeoutID),t.utilprops.detach&&(t.utilprops.detach(),delete t.utilprops.detach),t},createCopyFun:function(t,e,n){return $.bind({sourceId:t,dataField:e,targetId:s(n)||n})},attachCopyFun:function(t,e,n){return e=typeof e=="boolean"?e:!0,n=n||document.body,n.addEventListener(m,t),e&&n.addEventListener(r,t),t},startCopy:function(t,e,n,o){var f=s(t);return this.attachCopyFun(this.createCopyFun(f||t,e,n),o,f)},detachCopyFun:function(t,e){return e=e||document.body,e.removeEventListener(r,t),e.removeEventListener(m,t),t},createClickFun:function(t,e){return B.bind({btnId:t,awe:e})},attachClickFun:function(t,e){return e=e||document.body,e.addEventListener("click",t),t},startClick:function(t,e){var n=s(t);return this.attachClickFun(this.createClickFun(n||t,e),n)},detachClickFun:function(t,e){return e=e||document.body,e.removeEventListener("click",t),t},filterContains:function(t,e){return Awesomplete.FILTER_CONTAINS(t.value,e)},filterStartsWith:function(t,e){return Awesomplete.FILTER_STARTSWITH(t.value,e)},filterOff:function(t,e){return!0},filterWords:function(t,e){var n=e.split(/\s+/),o=!0,f;for(t=" "+t,f=0;o&&f<n.length;f++)o=Awesomplete.FILTER_CONTAINS(t," "+n[f]);return o},jsonFlatten:function(t){return j({},t,"",0,this)}}}();typeof Y=="object"&&Y.exports&&(Y.exports=ot);typeof self!="undefined"&&(self.AwesompleteUtil=ot)});var Ct={};yt(Ct,{Awesomplete:()=>ct.default,AwesompleteUtil:()=>ht.default,attachAwesomplete:()=>ft,copyValueToId:()=>pt});var ct=lt(ut()),ht=lt(at());var R=AwesompleteUtil,O=(l,u,h)=>{if(u==null)return null;if(typeof l[u]!="function")throw new Error("Unknown "+h+" function "+u);return l[u]},Et=(l,u,h)=>{var m=null,r;return u&&(m=new RegExp("^.+["+u+"]\\s*|"),r=u[0],u[0]!==" "&&(r+=" ")),function(b){var v=h?b.value.substring(0,b.value.lastIndexOf("|")):b.value,i=m?this.input.value.match(m)[0]+v+r:v;l?l.call(this,i):this.input.value=i}},_t=(l,u,h,m)=>(l||(m?l=R.itemMarkAll:u?l=R.itemStartsWith:h&&(l=R.itemContains)),h?function(r,b){return l.call(this,r,b.match(h)[0])}:l),It=(l,u,h,m)=>{if(!h&&!m)return l;let r=l,b=Awesomplete;if(u){if(descrSearch)return function(v,i){var s=h?i.match(h)[0]:i;return R.filterStartsWith(v,s)||b.FILTER_STARTSWITH(v.value.substring(v.value.lastIndexOf("|")+1),s)};if(!h)return R.filterStartsWith;r=b.FILTER_STARTSWITH}else if(!l||l===R.filterContains||l===b.FILTER_CONTAINS){if(!h)return R.filterContains;r=b.FILTER_CONTAINS}return function(v,i){return r.call(this,m?v.value:v,h?i.match(h)[0]:i)}},Tt=(l,u,h,m,r)=>{let b=null;if(h||m)b=function(v,i){return{label:(v[h||u]||"").replace("<p>","<p >")+(m?"<p>"+(v[m]||""):""),value:(v[u]||"")+(r?"|"+(v[m]||"").replace("|"," "):"")}};else if(u)b=function(v,i){return v[u]||""};else return l;return l?function(v,i){return l.call(this,b(v,i),i)}:b},Lt=(l,u)=>{if(!u)return l;let h=new RegExp("["+u+"]\\s*$"),m=new RegExp("[^"+u+"]*$");return function(r){var b=r.replace(h,"").match(m)[0].trim().toLowerCase();return l?l.call(this,b):b}},xt=(l,u,h)=>{h=h||{},u=u||{};let m=l.getAttribute.bind(l),r=function(nt){return m(nt)||h[nt]},b=r("ajax"),v=r("assign"),i=r("autoFirst"),s=r("combobox"),p=r("container"),a=r("convertInput"),c=r("convertResponse"),E=r("data"),X=r("debounce"),w=r("descr"),U=r("descrSearch"),P=r("item"),q=r("filter"),N=r("forField"),M=r("label"),D=r("limit"),S=r("list"),W=r("loadall"),H=r("listLabel"),K=r("maxItems"),F=r("minChars"),k=r("multiple"),$=r("prepop"),B=r("replace"),L=r("sort"),j=r("statusNoResults"),G=r("statusTypeXChar"),t=r("statusXResults"),e=r("value"),n=r("url"),o=r("urlEnd"),f=O(u,a,"convertInput"),d=O(u,E,"data"),g=O(u,q,"filter"),_=O(u,P,"item"),T=O(u,B,"replace"),C=g===Awesomplete.FILTER_STARTSWITH||g===R.filterStartsWith,y=U==="true"||U===!0;if(N===void 0)throw new Error("Missing forField attribute.");let I={},A={},x=null,Z=null,J=null;if(n&&(I.url=n),o&&(I.urlEnd=typeof u[o]=="function"?u[o]:o),W&&(I.loadall=W==="true"||W===!0),$&&(I.prepop=$==="true"||$===!0),X&&(I.debounce=Number(X)),D&&(I.limit=Number(D)),!e&&w)throw new Error("'descr' without 'value' parameter.");if(!e&&M)throw new Error("'label' without 'value' parameter.");if(y&&!w)throw new Error("Cannot search description texts without knowing the description field. Please supply descr parameter.");c&&(I.convertResponse=O(u,c,"convertResponse")),b&&(I.ajax=O(u,b,"ajax")),k&&k!=="false"&&(x=k==="true"||k===!0?" ":k,Z=s&&s!=="false"?"":"(["+x+"]\\s*)?",J=new RegExp("[^"+x+"]*"+Z+"$"));let tt=Lt(f,x),et=It(g,C,J,M||w),it=_t(_,C,J,y);tt&&(I.convertInput=tt),et&&(A.filter=et),it&&(A.item=it),F&&(A.minChars=Number(F)),K&&(A.maxItems=Number(K)),i&&(A.autoFirst=i==="true"||i===!0),p&&(A.container=O(u,p,"container")),(B||x||y)&&(A.replace=Et(T,x,y)),(e||E)&&(A.data=Tt(d,e,M,w,y)),S&&(A.list=(typeof u[S]=="function"?u[S]():u[S])||S),H&&(A.listLabel=H),j&&(A.statusNoResults=j),t&&(A.statusXResults=t),G&&(A.statusTypeXChar=G),L==="false"||L===!1?A.sort=!1:L&&(A.sort=u[L]||L);let z=R.start("#"+N,I,A);return v&&v!=="false"&&(u[v==="true"||v===!0?"awe_"+N:v]=z),s&&s!=="false"&&R.startClick("#"+(s==="true"||s===!0?"awe_btn_"+N:s),z),z},ft=xt;copyValueToId=l=>{let u=l.getAttribute.bind(l),h=u("dataField"),m=u("field"),r=u("targetField"),b=u("target");if(m==null)throw new Error("Missing field attribute.");if(b==null&&r==null)throw new Error("Missing target or targetField attribute.");AwesompleteUtil.startCopy("#"+m,h,r?"#"+r:b)};var pt=copyValueToId;return At(Ct);})();
//# sourceMappingURL=awesomplete_bundle.min.js.map