@per-diem-calculator/vanilla 1.0.34 → 1.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7069,7 +7069,7 @@ E0 = function(t = null) {
|
|
|
7069
7069
|
));
|
|
7070
7070
|
}, /* VALIDATION
|
|
7071
7071
|
*/
|
|
7072
|
-
S0 = function(t, r = "Select
|
|
7072
|
+
S0 = function(t, r = "Select an area.") {
|
|
7073
7073
|
if (t) {
|
|
7074
7074
|
d(this, Te) && (d(this, pt, mn).forEach((i, a) => {
|
|
7075
7075
|
a > 0 && i.classList.add("error");
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1048,7 +1048,7 @@
|
|
|
1048
1048
|
/>
|
|
1049
1049
|
</svg>
|
|
1050
1050
|
</fieldset>
|
|
1051
|
-
`,f0=document.createElement("template");class zi extends HTMLElement{constructor(){super();ot(this,pt);ot(this,er,!1);ot(this,Le,!1);ot(this,yr,!1);this.attachShadow({mode:"open"}),ht(this,Le,this.getAttribute("styled")==="true"),M(this,pt,Ma).call(this)}attributeChangedCallback(t,r,n){d(this,Le)&&M(this,pt,M0).call(this,`bg-${n==="white"?"white":"neutral-50"}`)}focusEl(){[...d(this,pt,Bn)][1].focus()}enable(t){this.removeAttribute("category"),d(this,pt,Pa).forEach(r=>{r.checked=!1,t?(r.removeAttribute("disabled"),d(this,pt,xe).removeAttribute("inert")):(r.setAttribute("disabled","true"),d(this,pt,xe).setAttribute("inert",""))}),this.enableTabIndex(t),ht(this,yr,t)}enableTabIndex(t){d(this,pt,xe).querySelectorAll("[tabindex]").forEach(n=>n.setAttribute("tabindex",t?"0":"-1"))}validate(){return ht(this,er,!1),this.hasAttribute("category")?(ht(this,er,!0),d(this,er)):(M(this,pt,N0).call(this,!0),d(this,er))}get isEnabled(){return d(this,yr)}get pdcValue(){const t=this.getAttribute("category");return t&&(t==="domestic"||t==="intl")?t:null}}er=new WeakMap,Le=new WeakMap,yr=new WeakMap,pt=new WeakSet,Ma=function(){d(this,Le)?(f0.innerHTML=Ii,Ke(d(this,pt,Tr))):f0.innerHTML=$e(Ii),d(this,pt,Tr).appendChild(f0.content.cloneNode(!0)),this.enableTabIndex(!1),M(this,pt,M0).call(this),M(this,pt,Na).call(this)},Na=function(){let t=0,r=0;d(this,pt,xe).addEventListener("pointerdown",n=>{if(!(n instanceof PointerEvent))return;const a=$r(n);t=a.pointerStartX,r=a.pointerStartY}),d(this,pt,xe).addEventListener("pointerup",n=>{if(n instanceof PointerEvent){const a=Br(n,M(this,pt,R0).bind(this),t,r);t=a.pointerStartX,r=a.pointerStartY}}),d(this,pt,xe).addEventListener("keydown",n=>{n instanceof KeyboardEvent&&(n.key==="Enter"||n.key===" ")&&M(this,pt,R0).call(this,n)})},R0=function(t){if(!d(this,yr))return;const r=t.composedPath()[0];if(!(r instanceof HTMLElement||r instanceof SVGElement))return;const n=r.closest("label"),a=n==null?void 0:n.getAttribute("for"),s=d(this,pt,xe).querySelector(`#${a}`),o=d(this,pt,xe).querySelector(`#${a==="domestic"?"intl":"domestic"}`);s&&o&&(o.checked=!1,s.checked=!0,a&&this.setAttribute("category",a),d(this,Le)&&(n==null||n.classList.add("success"),M(this,pt,N0).call(this,!1)))},xe=function(){const t=d(this,pt,Tr).querySelector("#pdc-container");if(!t)throw new Error("Failed to render container for Category custom element");return t},Pa=function(){const t=d(this,pt,Tr).querySelectorAll("input");if(!t)throw new Error("Failed to render inputs in Category custom element");return t},Bn=function(){const t=d(this,pt,Tr).querySelectorAll("label");if(!t)throw new Error("Failed to render labels in Category custom element");return t},Tr=function(){if(!this.shadowRoot)throw new Error("Failed to render shadowRoot in Category custom element");return this.shadowRoot},Hn=function(){var r;const t=(r=this.closest("#locations-container"))==null?void 0:r.querySelector("#error");if(!t)throw new Error("Failed to get View's error element from Category custom element");return t},M0=function(t=null){d(this,Le)&&(d(this,pt,xe).classList.remove("bg-white","bg-neutral-50"),d(this,pt,xe).classList.add(t||`bg-${this.getAttribute("bg")}`))},N0=function(t,r="Select a category."){if(t){d(this,Le)&&(d(this,pt,Bn).forEach((n,a)=>{a>0&&n.classList.add("error")}),d(this,pt,Hn).classList.add("active")),d(this,pt,Hn).textContent=r;return}d(this,Le)&&(d(this,pt,Bn).forEach((n,a)=>{a>0&&n.classList.remove("error")}),d(this,pt,Hn).classList.remove("active"))},he(zi,"observedAttributes",["bg"]);function m0(i,e){i.split(/\s+/).forEach(t=>{e(t)})}class Qo{constructor(){this._events={}}on(e,t){m0(e,r=>{const n=this._events[r]||[];n.push(t),this._events[r]=n})}off(e,t){var r=arguments.length;if(r===0){this._events={};return}m0(e,n=>{if(r===1){delete this._events[n];return}const a=this._events[n];a!==void 0&&(a.splice(a.indexOf(t),1),this._events[n]=a)})}trigger(e,...t){var r=this;m0(e,n=>{const a=r._events[n];a!==void 0&&a.forEach(s=>{s.apply(r,t)})})}}function tl(i){return i.plugins={},class extends i{constructor(){super(...arguments),this.plugins={names:[],settings:{},requested:{},loaded:{}}}static define(e,t){i.plugins[e]={name:e,fn:t}}initializePlugins(e){var t,r;const n=this,a=[];if(Array.isArray(e))e.forEach(s=>{typeof s=="string"?a.push(s):(n.plugins.settings[s.name]=s.options,a.push(s.name))});else if(e)for(t in e)e.hasOwnProperty(t)&&(n.plugins.settings[t]=e[t],a.push(t));for(;r=a.shift();)n.require(r)}loadPlugin(e){var t=this,r=t.plugins,n=i.plugins[e];if(!i.plugins.hasOwnProperty(e))throw new Error('Unable to find "'+e+'" plugin');r.requested[e]=!0,r.loaded[e]=n.fn.apply(t,[t.plugins.settings[e]||{}]),r.names.push(e)}require(e){var t=this,r=t.plugins;if(!t.plugins.loaded.hasOwnProperty(e)){if(r.requested[e])throw new Error('Plugin has circular dependency ("'+e+'")');t.loadPlugin(e)}return r.loaded[e]}}}const gn=i=>(i=i.filter(Boolean),i.length<2?i[0]||"":rl(i)==1?"["+i.join("")+"]":"(?:"+i.join("|")+")"),Ri=i=>{if(!el(i))return i.join("");let e="",t=0;const r=()=>{t>1&&(e+="{"+t+"}")};return i.forEach((n,a)=>{if(n===i[a-1]){t++;return}r(),e+=n,t=1}),r(),e},Mi=i=>{let e=Array.from(i);return gn(e)},el=i=>new Set(i).size!==i.length,Yr=i=>(i+"").replace(/([\$\(\)\*\+\.\?\[\]\^\{\|\}\\])/gu,"\\$1"),rl=i=>i.reduce((e,t)=>Math.max(e,nl(t)),0),nl=i=>Array.from(i).length,Ni=i=>{if(i.length===1)return[[i]];let e=[];const t=i.substring(1);return Ni(t).forEach(function(n){let a=n.slice(0);a[0]=i.charAt(0)+a[0],e.push(a),a=n.slice(0),a.unshift(i.charAt(0)),e.push(a)}),e},il=[[0,65535]],al="[̀-ͯ·ʾʼ]";let bn,Pi;const sl=3,g0={},$i={"/":"⁄∕",0:"߀",a:"ⱥɐɑ",aa:"ꜳ",ae:"æǽǣ",ao:"ꜵ",au:"ꜷ",av:"ꜹꜻ",ay:"ꜽ",b:"ƀɓƃ",c:"ꜿƈȼↄ",d:"đɗɖᴅƌꮷԁɦ",e:"ɛǝᴇɇ",f:"ꝼƒ",g:"ǥɠꞡᵹꝿɢ",h:"ħⱨⱶɥ",i:"ɨı",j:"ɉȷ",k:"ƙⱪꝁꝃꝅꞣ",l:"łƚɫⱡꝉꝇꞁɭ",m:"ɱɯϻ",n:"ꞥƞɲꞑᴎлԉ",o:"øǿɔɵꝋꝍᴑ",oe:"œ",oi:"ƣ",oo:"ꝏ",ou:"ȣ",p:"ƥᵽꝑꝓꝕρ",q:"ꝗꝙɋ",r:"ɍɽꝛꞧꞃ",s:"ßȿꞩꞅʂ",t:"ŧƭʈⱦꞇ",th:"þ",tz:"ꜩ",u:"ʉ",v:"ʋꝟʌ",vy:"ꝡ",w:"ⱳ",y:"ƴɏỿ",z:"ƶȥɀⱬꝣ",hv:"ƕ"};for(let i in $i){let e=$i[i]||"";for(let t=0;t<e.length;t++){let r=e.substring(t,t+1);g0[r]=i}}const ol=new RegExp(Object.keys(g0).join("|")+"|"+al,"gu"),ll=i=>{bn===void 0&&(bn=hl(il))},Bi=(i,e="NFKD")=>i.normalize(e),vn=i=>Array.from(i).reduce((e,t)=>e+cl(t),""),cl=i=>(i=Bi(i).toLowerCase().replace(ol,e=>g0[e]||""),Bi(i,"NFC"));function*dl(i){for(const[e,t]of i)for(let r=e;r<=t;r++){let n=String.fromCharCode(r),a=vn(n);a!=n.toLowerCase()&&(a.length>sl||a.length!=0&&(yield{folded:a,composed:n,code_point:r}))}}const ul=i=>{const e={},t=(r,n)=>{const a=e[r]||new Set,s=new RegExp("^"+Mi(a)+"$","iu");n.match(s)||(a.add(Yr(n)),e[r]=a)};for(let r of dl(i))t(r.folded,r.folded),t(r.folded,r.composed);return e},hl=i=>{const e=ul(i),t={};let r=[];for(let a in e){let s=e[a];s&&(t[a]=Mi(s)),a.length>1&&r.push(Yr(a))}r.sort((a,s)=>s.length-a.length);const n=gn(r);return Pi=new RegExp("^"+n,"u"),t},pl=(i,e=1)=>{let t=0;return i=i.map(r=>(bn[r]&&(t+=r.length),bn[r]||r)),t>=e?Ri(i):""},fl=(i,e=1)=>(e=Math.max(e,i.length-1),gn(Ni(i).map(t=>pl(t,e)))),Hi=(i,e=!0)=>{let t=i.length>1?1:0;return gn(i.map(r=>{let n=[];const a=e?r.length():r.length()-1;for(let s=0;s<a;s++)n.push(fl(r.substrs[s]||"",t));return Ri(n)}))},ml=(i,e)=>{for(const t of e){if(t.start!=i.start||t.end!=i.end||t.substrs.join("")!==i.substrs.join(""))continue;let r=i.parts;const n=s=>{for(const o of r){if(o.start===s.start&&o.substr===s.substr)return!1;if(!(s.length==1||o.length==1)&&(s.start<o.start&&s.end>o.start||o.start<s.start&&o.end>s.start))return!0}return!1};if(!(t.parts.filter(n).length>0))return!0}return!1};class wn{constructor(){he(this,"parts");he(this,"substrs");he(this,"start");he(this,"end");this.parts=[],this.substrs=[],this.start=0,this.end=0}add(e){e&&(this.parts.push(e),this.substrs.push(e.substr),this.start=Math.min(e.start,this.start),this.end=Math.max(e.end,this.end))}last(){return this.parts[this.parts.length-1]}length(){return this.parts.length}clone(e,t){let r=new wn,n=JSON.parse(JSON.stringify(this.parts)),a=n.pop();for(const c of n)r.add(c);let s=t.substr.substring(0,e-a.start),o=s.length;return r.add({start:a.start,end:a.start+o,length:o,substr:s}),r}}const gl=i=>{ll(),i=vn(i);let e="",t=[new wn];for(let r=0;r<i.length;r++){let a=i.substring(r).match(Pi);const s=i.substring(r,r+1),o=a?a[0]:null;let c=[],h=new Set;for(const v of t){const b=v.last();if(!b||b.length==1||b.end<=r)if(o){const _=o.length;v.add({start:r,end:r+_,length:_,substr:o}),h.add("1")}else v.add({start:r,end:r+1,length:1,substr:s}),h.add("2");else if(o){let _=v.clone(r,b);const f=o.length;_.add({start:r,end:r+f,length:f,substr:o}),c.push(_)}else h.add("3")}if(c.length>0){c=c.sort((v,b)=>v.length()-b.length());for(let v of c)ml(v,t)||t.push(v);continue}if(r>0&&h.size==1&&!h.has("3")){e+=Hi(t,!1);let v=new wn;const b=t[0];b&&v.add(b.last()),t=[v]}}return e+=Hi(t,!0),e},bl=(i,e)=>{if(i)return i[e]},vl=(i,e)=>{if(i){for(var t,r=e.split(".");(t=r.shift())&&(i=i[t]););return i}},b0=(i,e,t)=>{var r,n;return!i||(i=i+"",e.regex==null)||(n=i.search(e.regex),n===-1)?0:(r=e.string.length/i.length,n===0&&(r+=.5),r*t)},v0=(i,e)=>{var t=i[e];if(typeof t=="function")return t;t&&!Array.isArray(t)&&(i[e]=[t])},yn=(i,e)=>{if(Array.isArray(i))i.forEach(e);else for(var t in i)i.hasOwnProperty(t)&&e(i[t],t)},wl=(i,e)=>typeof i=="number"&&typeof e=="number"?i>e?1:i<e?-1:0:(i=vn(i+"").toLowerCase(),e=vn(e+"").toLowerCase(),i>e?1:e>i?-1:0);class yl{constructor(e,t){he(this,"items");he(this,"settings");this.items=e,this.settings=t||{diacritics:!0}}tokenize(e,t,r){if(!e||!e.length)return[];const n=[],a=e.split(/\s+/);var s;return r&&(s=new RegExp("^("+Object.keys(r).map(Yr).join("|")+"):(.*)$")),a.forEach(o=>{let c,h=null,v=null;s&&(c=o.match(s))&&(h=c[1],o=c[2]),o.length>0&&(this.settings.diacritics?v=gl(o)||null:v=Yr(o),v&&t&&(v="\\b"+v)),n.push({string:o,regex:v?new RegExp(v,"iu"):null,field:h})}),n}getScoreFunction(e,t){var r=this.prepareSearch(e,t);return this._getScoreFunction(r)}_getScoreFunction(e){const t=e.tokens,r=t.length;if(!r)return function(){return 0};const n=e.options.fields,a=e.weights,s=n.length,o=e.getAttrFn;if(!s)return function(){return 1};const c=function(){return s===1?function(h,v){const b=n[0].field;return b0(o(v,b),h,a[b]||1)}:function(h,v){var b=0;if(h.field){const _=o(v,h.field);!h.regex&&_?b+=1/s:b+=b0(_,h,1)}else yn(a,(_,f)=>{b+=b0(o(v,f),h,_)});return b/s}}();return r===1?function(h){return c(t[0],h)}:e.options.conjunction==="and"?function(h){var v,b=0;for(let _ of t){if(v=c(_,h),v<=0)return 0;b+=v}return b/r}:function(h){var v=0;return yn(t,b=>{v+=c(b,h)}),v/r}}getSortFunction(e,t){var r=this.prepareSearch(e,t);return this._getSortFunction(r)}_getSortFunction(e){var t,r=[];const n=this,a=e.options,s=!e.query&&a.sort_empty?a.sort_empty:a.sort;if(typeof s=="function")return s.bind(this);const o=function(h,v){return h==="$score"?v.score:e.getAttrFn(n.items[v.id],h)};if(s)for(let h of s)(e.query||h.field!=="$score")&&r.push(h);if(e.query){t=!0;for(let h of r)if(h.field==="$score"){t=!1;break}t&&r.unshift({field:"$score",direction:"desc"})}else r=r.filter(h=>h.field!=="$score");return r.length?function(h,v){var b,_;for(let f of r)if(_=f.field,b=(f.direction==="desc"?-1:1)*wl(o(_,h),o(_,v)),b)return b;return 0}:null}prepareSearch(e,t){const r={};var n=Object.assign({},t);if(v0(n,"sort"),v0(n,"sort_empty"),n.fields){v0(n,"fields");const a=[];n.fields.forEach(s=>{typeof s=="string"&&(s={field:s,weight:1}),a.push(s),r[s.field]="weight"in s?s.weight:1}),n.fields=a}return{options:n,query:e.toLowerCase().trim(),tokens:this.tokenize(e,n.respect_word_boundaries,r),total:0,items:[],weights:r,getAttrFn:n.nesting?vl:bl}}search(e,t){var r=this,n,a;a=this.prepareSearch(e,t),t=a.options,e=a.query;const s=t.score||r._getScoreFunction(a);e.length?yn(r.items,(c,h)=>{n=s(c),(t.filter===!1||n>0)&&a.items.push({score:n,id:h})}):yn(r.items,(c,h)=>{a.items.push({score:1,id:h})});const o=r._getSortFunction(a);return o&&a.items.sort(o),a.total=a.items.length,typeof t.limit=="number"&&(a.items=a.items.slice(0,t.limit)),a}}const ve=i=>typeof i>"u"||i===null?null:_n(i),_n=i=>typeof i=="boolean"?i?"1":"0":i+"",w0=i=>(i+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),_l=(i,e)=>e>0?window.setTimeout(i,e):(i.call(null),null),xl=(i,e)=>{var t;return function(r,n){var a=this;t&&(a.loading=Math.max(a.loading-1,0),clearTimeout(t)),t=setTimeout(function(){t=null,a.loadedSearches[r]=!0,i.call(a,r,n)},e)}},Ui=(i,e,t)=>{var r,n=i.trigger,a={};i.trigger=function(){var s=arguments[0];if(e.indexOf(s)!==-1)a[s]=arguments;else return n.apply(i,arguments)},t.apply(i,[]),i.trigger=n;for(r of e)r in a&&n.apply(i,a[r])},kl=i=>({start:i.selectionStart||0,length:(i.selectionEnd||0)-(i.selectionStart||0)}),Ft=(i,e=!1)=>{i&&(i.preventDefault(),e&&i.stopPropagation())},Zt=(i,e,t,r)=>{i.addEventListener(e,t,r)},Je=(i,e)=>{if(!e||!e[i])return!1;var t=(e.altKey?1:0)+(e.ctrlKey?1:0)+(e.shiftKey?1:0)+(e.metaKey?1:0);return t===1},y0=(i,e)=>{const t=i.getAttribute("id");return t||(i.setAttribute("id",e),e)},ji=i=>i.replace(/[\\"']/g,"\\$&"),Qe=(i,e)=>{e&&i.append(e)},$t=(i,e)=>{if(Array.isArray(i))i.forEach(e);else for(var t in i)i.hasOwnProperty(t)&&e(i[t],t)},Se=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(Yi(i)){var e=document.createElement("template");return e.innerHTML=i.trim(),e.content.firstChild}return document.querySelector(i)},Yi=i=>typeof i=="string"&&i.indexOf("<")>-1,Sl=i=>i.replace(/['"\\]/g,"\\$&"),_0=(i,e)=>{var t=document.createEvent("HTMLEvents");t.initEvent(e,!0,!1),i.dispatchEvent(t)},xn=(i,e)=>{Object.assign(i.style,e)},le=(i,...e)=>{var t=Vi(e);i=qi(i),i.map(r=>{t.map(n=>{r.classList.add(n)})})},Be=(i,...e)=>{var t=Vi(e);i=qi(i),i.map(r=>{t.map(n=>{r.classList.remove(n)})})},Vi=i=>{var e=[];return $t(i,t=>{typeof t=="string"&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},qi=i=>(Array.isArray(i)||(i=[i]),i),x0=(i,e,t)=>{if(!(t&&!t.contains(i)))for(;i&&i.matches;){if(i.matches(e))return i;i=i.parentNode}},Wi=(i,e=0)=>e>0?i[i.length-1]:i[0],El=i=>Object.keys(i).length===0,Gi=(i,e)=>{if(!i)return-1;e=e||i.nodeName;for(var t=0;i=i.previousElementSibling;)i.matches(e)&&t++;return t},St=(i,e)=>{$t(e,(t,r)=>{t==null?i.removeAttribute(r):i.setAttribute(r,""+t)})},k0=(i,e)=>{i.parentNode&&i.parentNode.replaceChild(e,i)},Ll=(i,e)=>{if(e===null)return;if(typeof e=="string"){if(!e.length)return;e=new RegExp(e,"i")}const t=a=>{var s=a.data.match(e);if(s&&a.data.length>0){var o=document.createElement("span");o.className="highlight";var c=a.splitText(s.index);c.splitText(s[0].length);var h=c.cloneNode(!0);return o.appendChild(h),k0(c,o),1}return 0},r=a=>{a.nodeType===1&&a.childNodes&&!/(script|style)/i.test(a.tagName)&&(a.className!=="highlight"||a.tagName!=="SPAN")&&Array.from(a.childNodes).forEach(s=>{n(s)})},n=a=>a.nodeType===3?t(a):(r(a),0);n(i)},Al=i=>{var e=i.querySelectorAll("span.highlight");Array.prototype.forEach.call(e,function(t){var r=t.parentNode;r.replaceChild(t.firstChild,t),r.normalize()})},Dl=65,Tl=13,Fl=27,Ol=37,Cl=38,Il=39,zl=40,Xi=8,Rl=46,Zi=9,kn=(typeof navigator>"u"?!1:/Mac/.test(navigator.userAgent))?"metaKey":"ctrlKey",Ki={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,shouldOpen:null,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,refreshThrottle:300,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-wrapper",controlClass:"ts-control",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:'<input type="text" autocomplete="off" size="1" />',copyClassesToDropdown:!1,placeholder:null,hidePlaceholder:null,shouldLoad:function(i){return i.length>0},render:{}};function Ji(i,e){var t=Object.assign({},Ki,e),r=t.dataAttr,n=t.labelField,a=t.valueField,s=t.disabledField,o=t.optgroupField,c=t.optgroupLabelField,h=t.optgroupValueField,v=i.tagName.toLowerCase(),b=i.getAttribute("placeholder")||i.getAttribute("data-placeholder");if(!b&&!t.allowEmptyOption){let p=i.querySelector('option[value=""]');p&&(b=p.textContent)}var _={placeholder:b,options:[],optgroups:[],items:[],maxItems:null},f=()=>{var p,w=_.options,g={},y=1;let E=0;var A=O=>{var P=Object.assign({},O.dataset),F=r&&P[r];return typeof F=="string"&&F.length&&(P=Object.assign(P,JSON.parse(F))),P},T=(O,P)=>{var F=ve(O.value);if(F!=null&&!(!F&&!t.allowEmptyOption)){if(g.hasOwnProperty(F)){if(P){var V=g[F][o];V?Array.isArray(V)?V.push(P):g[F][o]=[V,P]:g[F][o]=P}}else{var G=A(O);G[n]=G[n]||O.textContent,G[a]=G[a]||F,G[s]=G[s]||O.disabled,G[o]=G[o]||P,G.$option=O,G.$order=G.$order||++E,g[F]=G,w.push(G)}O.selected&&_.items.push(F)}},U=O=>{var P,F;F=A(O),F[c]=F[c]||O.getAttribute("label")||"",F[h]=F[h]||y++,F[s]=F[s]||O.disabled,F.$order=F.$order||++E,_.optgroups.push(F),P=F[h],$t(O.children,V=>{T(V,P)})};_.maxItems=i.hasAttribute("multiple")?null:1,$t(i.children,O=>{p=O.tagName.toLowerCase(),p==="optgroup"?U(O):p==="option"&&T(O)})},m=()=>{const p=i.getAttribute(r);if(p)_.options=JSON.parse(p),$t(_.options,g=>{_.items.push(g[a])});else{var w=i.value.trim()||"";if(!t.allowEmptyOption&&!w.length)return;const g=w.split(t.delimiter);$t(g,y=>{const E={};E[n]=y,E[a]=y,_.options.push(E)}),_.items=g}};return v==="select"?f():m(),Object.assign({},Ki,_,e)}var Qi=0;class Kt extends tl(Qo){constructor(e,t){super(),this.order=0,this.isOpen=!1,this.isDisabled=!1,this.isReadOnly=!1,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.ignoreHover=!1,this.hasOptions=!1,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],this.refreshTimeout=null,Qi++;var r,n=Se(e);if(n.tomselect)throw new Error("Tom Select already initialized on this element");n.tomselect=this;var a=window.getComputedStyle&&window.getComputedStyle(n,null);r=a.getPropertyValue("direction");const s=Ji(n,t);this.settings=s,this.input=n,this.tabIndex=n.tabIndex||0,this.is_select_tag=n.tagName.toLowerCase()==="select",this.rtl=/rtl/i.test(r),this.inputId=y0(n,"tomselect-"+Qi),this.isRequired=n.required,this.sifter=new yl(this.options,{diacritics:s.diacritics}),s.mode=s.mode||(s.maxItems===1?"single":"multi"),typeof s.hideSelected!="boolean"&&(s.hideSelected=s.mode==="multi"),typeof s.hidePlaceholder!="boolean"&&(s.hidePlaceholder=s.mode!=="multi");var o=s.createFilter;typeof o!="function"&&(typeof o=="string"&&(o=new RegExp(o)),o instanceof RegExp?s.createFilter=w=>o.test(w):s.createFilter=w=>this.settings.duplicates||!this.options[w]),this.initializePlugins(s.plugins),this.setupCallbacks(),this.setupTemplates();const c=Se("<div>"),h=Se("<div>"),v=this._render("dropdown"),b=Se('<div role="listbox" tabindex="-1">'),_=this.input.getAttribute("class")||"",f=s.mode;var m;if(le(c,s.wrapperClass,_,f),le(h,s.controlClass),Qe(c,h),le(v,s.dropdownClass,f),s.copyClassesToDropdown&&le(v,_),le(b,s.dropdownContentClass),Qe(v,b),Se(s.dropdownParent||c).appendChild(v),Yi(s.controlInput)){m=Se(s.controlInput);var p=["autocorrect","autocapitalize","autocomplete","spellcheck"];$t(p,w=>{n.getAttribute(w)&&St(m,{[w]:n.getAttribute(w)})}),m.tabIndex=-1,h.appendChild(m),this.focus_node=m}else s.controlInput?(m=Se(s.controlInput),this.focus_node=m):(m=Se("<input/>"),this.focus_node=h);this.wrapper=c,this.dropdown=v,this.dropdown_content=b,this.control=h,this.control_input=m,this.setup()}setup(){const e=this,t=e.settings,r=e.control_input,n=e.dropdown,a=e.dropdown_content,s=e.wrapper,o=e.control,c=e.input,h=e.focus_node,v={passive:!0},b=e.inputId+"-ts-dropdown";St(a,{id:b}),St(h,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":b});const _=y0(h,e.inputId+"-ts-control"),f="label[for='"+Sl(e.inputId)+"']",m=document.querySelector(f),p=e.focus.bind(e);if(m){Zt(m,"click",p),St(m,{for:_});const y=y0(m,e.inputId+"-ts-label");St(h,{"aria-labelledby":y}),St(a,{"aria-labelledby":y})}if(s.style.width=c.style.width,e.plugins.names.length){const y="plugin-"+e.plugins.names.join(" plugin-");le([s,n],y)}(t.maxItems===null||t.maxItems>1)&&e.is_select_tag&&St(c,{multiple:"multiple"}),t.placeholder&&St(r,{placeholder:t.placeholder}),!t.splitOn&&t.delimiter&&(t.splitOn=new RegExp("\\s*"+Yr(t.delimiter)+"+\\s*")),t.load&&t.loadThrottle&&(t.load=xl(t.load,t.loadThrottle)),Zt(n,"mousemove",()=>{e.ignoreHover=!1}),Zt(n,"mouseenter",y=>{var E=x0(y.target,"[data-selectable]",n);E&&e.onOptionHover(y,E)},{capture:!0}),Zt(n,"click",y=>{const E=x0(y.target,"[data-selectable]");E&&(e.onOptionSelect(y,E),Ft(y,!0))}),Zt(o,"click",y=>{var E=x0(y.target,"[data-ts-item]",o);if(E&&e.onItemSelect(y,E)){Ft(y,!0);return}r.value==""&&(e.onClick(),Ft(y,!0))}),Zt(h,"keydown",y=>e.onKeyDown(y)),Zt(r,"keypress",y=>e.onKeyPress(y)),Zt(r,"input",y=>e.onInput(y)),Zt(h,"blur",y=>e.onBlur(y)),Zt(h,"focus",y=>e.onFocus(y)),Zt(r,"paste",y=>e.onPaste(y));const w=y=>{const E=y.composedPath()[0];if(!s.contains(E)&&!n.contains(E)){e.isFocused&&e.blur(),e.inputState();return}E==r&&e.isOpen?y.stopPropagation():Ft(y,!0)},g=()=>{e.isOpen&&e.positionDropdown()};Zt(document,"mousedown",w),Zt(window,"scroll",g,v),Zt(window,"resize",g,v),this._destroy=()=>{document.removeEventListener("mousedown",w),window.removeEventListener("scroll",g),window.removeEventListener("resize",g),m&&m.removeEventListener("click",p)},this.revertSettings={innerHTML:c.innerHTML,tabIndex:c.tabIndex},c.tabIndex=-1,c.insertAdjacentElement("afterend",e.wrapper),e.sync(!1),t.items=[],delete t.optgroups,delete t.options,Zt(c,"invalid",()=>{e.isValid&&(e.isValid=!1,e.isInvalid=!0,e.refreshState())}),e.updateOriginalInput(),e.refreshItems(),e.close(!1),e.inputState(),e.isSetup=!0,c.disabled?e.disable():c.readOnly?e.setReadOnly(!0):e.enable(),e.on("change",this.onChange),le(c,"tomselected","ts-hidden-accessible"),e.trigger("initialize"),t.preload===!0&&e.preload()}setupOptions(e=[],t=[]){this.addOptions(e),$t(t,r=>{this.registerOptionGroup(r)})}setupTemplates(){var e=this,t=e.settings.labelField,r=e.settings.optgroupLabelField,n={optgroup:a=>{let s=document.createElement("div");return s.className="optgroup",s.appendChild(a.options),s},optgroup_header:(a,s)=>'<div class="optgroup-header">'+s(a[r])+"</div>",option:(a,s)=>"<div>"+s(a[t])+"</div>",item:(a,s)=>"<div>"+s(a[t])+"</div>",option_create:(a,s)=>'<div class="create">Add <strong>'+s(a.input)+"</strong>…</div>",no_results:()=>'<div class="no-results">No results found</div>',loading:()=>'<div class="spinner"></div>',not_loading:()=>{},dropdown:()=>"<div></div>"};e.settings.render=Object.assign({},n,e.settings.render)}setupCallbacks(){var e,t,r={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",item_select:"onItemSelect",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(e in r)t=this.settings[r[e]],t&&this.on(e,t)}sync(e=!0){const t=this,r=e?Ji(t.input,{delimiter:t.settings.delimiter}):t.settings;t.setupOptions(r.options,r.optgroups),t.setValue(r.items||[],!0),t.lastQuery=null}onClick(){var e=this;if(e.activeItems.length>0){e.clearActiveItems(),e.focus();return}e.isFocused&&e.isOpen?e.blur():e.focus()}onMouseDown(){}onChange(){_0(this.input,"input"),_0(this.input,"change")}onPaste(e){var t=this;if(t.isInputHidden||t.isLocked){Ft(e);return}t.settings.splitOn&&setTimeout(()=>{var r=t.inputValue();if(r.match(t.settings.splitOn)){var n=r.trim().split(t.settings.splitOn);$t(n,a=>{ve(a)&&(this.options[a]?t.addItem(a):t.createItem(a))})}},0)}onKeyPress(e){var t=this;if(t.isLocked){Ft(e);return}var r=String.fromCharCode(e.keyCode||e.which);if(t.settings.create&&t.settings.mode==="multi"&&r===t.settings.delimiter){t.createItem(),Ft(e);return}}onKeyDown(e){var t=this;if(t.ignoreHover=!0,t.isLocked){e.keyCode!==Zi&&Ft(e);return}switch(e.keyCode){case Dl:if(Je(kn,e)&&t.control_input.value==""){Ft(e),t.selectAll();return}break;case Fl:t.isOpen&&(Ft(e,!0),t.close()),t.clearActiveItems();return;case zl:if(!t.isOpen&&t.hasOptions)t.open();else if(t.activeOption){let r=t.getAdjacent(t.activeOption,1);r&&t.setActiveOption(r)}Ft(e);return;case Cl:if(t.activeOption){let r=t.getAdjacent(t.activeOption,-1);r&&t.setActiveOption(r)}Ft(e);return;case Tl:t.canSelect(t.activeOption)?(t.onOptionSelect(e,t.activeOption),Ft(e)):(t.settings.create&&t.createItem()||document.activeElement==t.control_input&&t.isOpen)&&Ft(e);return;case Ol:t.advanceSelection(-1,e);return;case Il:t.advanceSelection(1,e);return;case Zi:t.settings.selectOnTab&&(t.canSelect(t.activeOption)&&(t.onOptionSelect(e,t.activeOption),Ft(e)),t.settings.create&&t.createItem()&&Ft(e));return;case Xi:case Rl:t.deleteSelection(e);return}t.isInputHidden&&!Je(kn,e)&&Ft(e)}onInput(e){if(this.isLocked)return;const t=this.inputValue();if(this.lastValue!==t){if(this.lastValue=t,t==""){this._onInput();return}this.refreshTimeout&&window.clearTimeout(this.refreshTimeout),this.refreshTimeout=_l(()=>{this.refreshTimeout=null,this._onInput()},this.settings.refreshThrottle)}}_onInput(){const e=this.lastValue;this.settings.shouldLoad.call(this,e)&&this.load(e),this.refreshOptions(),this.trigger("type",e)}onOptionHover(e,t){this.ignoreHover||this.setActiveOption(t,!1)}onFocus(e){var t=this,r=t.isFocused;if(t.isDisabled||t.isReadOnly){t.blur(),Ft(e);return}t.ignoreFocus||(t.isFocused=!0,t.settings.preload==="focus"&&t.preload(),r||t.trigger("focus"),t.activeItems.length||(t.inputState(),t.refreshOptions(!!t.settings.openOnFocus)),t.refreshState())}onBlur(e){if(document.hasFocus()!==!1){var t=this;if(t.isFocused){t.isFocused=!1,t.ignoreFocus=!1;var r=()=>{t.close(),t.setActiveItem(),t.setCaret(t.items.length),t.trigger("blur")};t.settings.create&&t.settings.createOnBlur?t.createItem(null,r):r()}}}onOptionSelect(e,t){var r,n=this;t.parentElement&&t.parentElement.matches("[data-disabled]")||(t.classList.contains("create")?n.createItem(null,()=>{n.settings.closeAfterSelect&&n.close()}):(r=t.dataset.value,typeof r<"u"&&(n.lastQuery=null,n.addItem(r),n.settings.closeAfterSelect&&n.close(),!n.settings.hideSelected&&e.type&&/click/.test(e.type)&&n.setActiveOption(t))))}canSelect(e){return!!(this.isOpen&&e&&this.dropdown_content.contains(e))}onItemSelect(e,t){var r=this;return!r.isLocked&&r.settings.mode==="multi"?(Ft(e),r.setActiveItem(t,e),!0):!1}canLoad(e){return!(!this.settings.load||this.loadedSearches.hasOwnProperty(e))}load(e){const t=this;if(!t.canLoad(e))return;le(t.wrapper,t.settings.loadingClass),t.loading++;const r=t.loadCallback.bind(t);t.settings.load.call(t,e,r)}loadCallback(e,t){const r=this;r.loading=Math.max(r.loading-1,0),r.lastQuery=null,r.clearActiveOption(),r.setupOptions(e,t),r.refreshOptions(r.isFocused&&!r.isInputHidden),r.loading||Be(r.wrapper,r.settings.loadingClass),r.trigger("load",e,t)}preload(){var e=this.wrapper.classList;e.contains("preloaded")||(e.add("preloaded"),this.load(""))}setTextboxValue(e=""){var t=this.control_input,r=t.value!==e;r&&(t.value=e,_0(t,"update"),this.lastValue=e)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(e,t){var r=t?[]:["change"];Ui(this,r,()=>{this.clear(t),this.addItems(e,t)})}setMaxItems(e){e===0&&(e=null),this.settings.maxItems=e,this.refreshState()}setActiveItem(e,t){var r=this,n,a,s,o,c,h;if(r.settings.mode!=="single"){if(!e){r.clearActiveItems(),r.isFocused&&r.inputState();return}if(n=t&&t.type.toLowerCase(),n==="click"&&Je("shiftKey",t)&&r.activeItems.length){for(h=r.getLastActive(),s=Array.prototype.indexOf.call(r.control.children,h),o=Array.prototype.indexOf.call(r.control.children,e),s>o&&(c=s,s=o,o=c),a=s;a<=o;a++)e=r.control.children[a],r.activeItems.indexOf(e)===-1&&r.setActiveItemClass(e);Ft(t)}else n==="click"&&Je(kn,t)||n==="keydown"&&Je("shiftKey",t)?e.classList.contains("active")?r.removeActiveItem(e):r.setActiveItemClass(e):(r.clearActiveItems(),r.setActiveItemClass(e));r.inputState(),r.isFocused||r.focus()}}setActiveItemClass(e){const t=this,r=t.control.querySelector(".last-active");r&&Be(r,"last-active"),le(e,"active last-active"),t.trigger("item_select",e),t.activeItems.indexOf(e)==-1&&t.activeItems.push(e)}removeActiveItem(e){var t=this.activeItems.indexOf(e);this.activeItems.splice(t,1),Be(e,"active")}clearActiveItems(){Be(this.activeItems,"active"),this.activeItems=[]}setActiveOption(e,t=!0){e!==this.activeOption&&(this.clearActiveOption(),e&&(this.activeOption=e,St(this.focus_node,{"aria-activedescendant":e.getAttribute("id")}),St(e,{"aria-selected":"true"}),le(e,"active"),t&&this.scrollToOption(e)))}scrollToOption(e,t){if(!e)return;const r=this.dropdown_content,n=r.clientHeight,a=r.scrollTop||0,s=e.offsetHeight,o=e.getBoundingClientRect().top-r.getBoundingClientRect().top+a;o+s>n+a?this.scroll(o-n+s,t):o<a&&this.scroll(o,t)}scroll(e,t){const r=this.dropdown_content;t&&(r.style.scrollBehavior=t),r.scrollTop=e,r.style.scrollBehavior=""}clearActiveOption(){this.activeOption&&(Be(this.activeOption,"active"),St(this.activeOption,{"aria-selected":null})),this.activeOption=null,St(this.focus_node,{"aria-activedescendant":null})}selectAll(){const e=this;if(e.settings.mode==="single")return;const t=e.controlChildren();t.length&&(e.inputState(),e.close(),e.activeItems=t,$t(t,r=>{e.setActiveItemClass(r)}))}inputState(){var e=this;e.control.contains(e.control_input)&&(St(e.control_input,{placeholder:e.settings.placeholder}),e.activeItems.length>0||!e.isFocused&&e.settings.hidePlaceholder&&e.items.length>0?(e.setTextboxValue(),e.isInputHidden=!0):(e.settings.hidePlaceholder&&e.items.length>0&&St(e.control_input,{placeholder:""}),e.isInputHidden=!1),e.wrapper.classList.toggle("input-hidden",e.isInputHidden))}inputValue(){return this.control_input.value.trim()}focus(){var e=this;e.isDisabled||e.isReadOnly||(e.ignoreFocus=!0,e.control_input.offsetWidth?e.control_input.focus():e.focus_node.focus(),setTimeout(()=>{e.ignoreFocus=!1,e.onFocus()},0))}blur(){this.focus_node.blur(),this.onBlur()}getScoreFunction(e){return this.sifter.getScoreFunction(e,this.getSearchOptions())}getSearchOptions(){var e=this.settings,t=e.sortField;return typeof e.sortField=="string"&&(t=[{field:e.sortField}]),{fields:e.searchField,conjunction:e.searchConjunction,sort:t,nesting:e.nesting}}search(e){var t,r,n=this,a=this.getSearchOptions();if(n.settings.score&&(r=n.settings.score.call(n,e),typeof r!="function"))throw new Error('Tom Select "score" setting must be a function that returns a function');return e!==n.lastQuery?(n.lastQuery=e,t=n.sifter.search(e,Object.assign(a,{score:r})),n.currentResults=t):t=Object.assign({},n.currentResults),n.settings.hideSelected&&(t.items=t.items.filter(s=>{let o=ve(s.id);return!(o&&n.items.indexOf(o)!==-1)})),t}refreshOptions(e=!0){var t,r,n,a,s,o,c,h,v,b;const _={},f=[];var m=this,p=m.inputValue();const w=p===m.lastQuery||p==""&&m.lastQuery==null;var g=m.search(p),y=null,E=m.settings.shouldOpen||!1,A=m.dropdown_content;w&&(y=m.activeOption,y&&(v=y.closest("[data-group]"))),a=g.items.length,typeof m.settings.maxOptions=="number"&&(a=Math.min(a,m.settings.maxOptions)),a>0&&(E=!0);const T=(O,P)=>{let F=_[O];if(F!==void 0){let G=f[F];if(G!==void 0)return[F,G.fragment]}let V=document.createDocumentFragment();return F=f.length,f.push({fragment:V,order:P,optgroup:O}),[F,V]};for(t=0;t<a;t++){let O=g.items[t];if(!O)continue;let P=O.id,F=m.options[P];if(F===void 0)continue;let V=_n(P),G=m.getOption(V,!0);for(m.settings.hideSelected||G.classList.toggle("selected",m.items.includes(V)),s=F[m.settings.optgroupField]||"",o=Array.isArray(s)?s:[s],r=0,n=o&&o.length;r<n;r++){s=o[r];let S=F.$order,N=m.optgroups[s];N===void 0?s="":S=N.$order;const[u,j]=T(s,S);r>0&&(G=G.cloneNode(!0),St(G,{id:F.$id+"-clone-"+r,"aria-selected":null}),G.classList.add("ts-cloned"),Be(G,"active"),m.activeOption&&m.activeOption.dataset.value==P&&v&&v.dataset.group===s.toString()&&(y=G)),j.appendChild(G),s!=""&&(_[s]=u)}}m.settings.lockOptgroupOrder&&f.sort((O,P)=>O.order-P.order),c=document.createDocumentFragment(),$t(f,O=>{let P=O.fragment,F=O.optgroup;if(!P||!P.children.length)return;let V=m.optgroups[F];if(V!==void 0){let G=document.createDocumentFragment(),S=m.render("optgroup_header",V);Qe(G,S),Qe(G,P);let N=m.render("optgroup",{group:V,options:G});Qe(c,N)}else Qe(c,P)}),A.innerHTML="",Qe(A,c),m.settings.highlight&&(Al(A),g.query.length&&g.tokens.length&&$t(g.tokens,O=>{Ll(A,O.regex)}));var U=O=>{let P=m.render(O,{input:p});return P&&(E=!0,A.insertBefore(P,A.firstChild)),P};if(m.loading?U("loading"):m.settings.shouldLoad.call(m,p)?g.items.length===0&&U("no_results"):U("not_loading"),h=m.canCreate(p),h&&(b=U("option_create")),m.hasOptions=g.items.length>0||h,E){if(g.items.length>0){if(!y&&m.settings.mode==="single"&&m.items[0]!=null&&(y=m.getOption(m.items[0])),!A.contains(y)){let O=0;b&&!m.settings.addPrecedence&&(O=1),y=m.selectable()[O]}}else b&&(y=b);e&&!m.isOpen&&(m.open(),m.scrollToOption(y,"auto")),m.setActiveOption(y)}else m.clearActiveOption(),e&&m.isOpen&&m.close(!1)}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(e,t=!1){const r=this;if(Array.isArray(e))return r.addOptions(e,t),!1;const n=ve(e[r.settings.valueField]);return n===null||r.options.hasOwnProperty(n)?!1:(e.$order=e.$order||++r.order,e.$id=r.inputId+"-opt-"+e.$order,r.options[n]=e,r.lastQuery=null,t&&(r.userOptions[n]=t,r.trigger("option_add",n,e)),n)}addOptions(e,t=!1){$t(e,r=>{this.addOption(r,t)})}registerOption(e){return this.addOption(e)}registerOptionGroup(e){var t=ve(e[this.settings.optgroupValueField]);return t===null?!1:(e.$order=e.$order||++this.order,this.optgroups[t]=e,t)}addOptionGroup(e,t){var r;t[this.settings.optgroupValueField]=e,(r=this.registerOptionGroup(t))&&this.trigger("optgroup_add",r,t)}removeOptionGroup(e){this.optgroups.hasOwnProperty(e)&&(delete this.optgroups[e],this.clearCache(),this.trigger("optgroup_remove",e))}clearOptionGroups(){this.optgroups={},this.clearCache(),this.trigger("optgroup_clear")}updateOption(e,t){const r=this;var n,a;const s=ve(e),o=ve(t[r.settings.valueField]);if(s===null)return;const c=r.options[s];if(c==null)return;if(typeof o!="string")throw new Error("Value must be set in option data");const h=r.getOption(s),v=r.getItem(s);if(t.$order=t.$order||c.$order,delete r.options[s],r.uncacheValue(o),r.options[o]=t,h){if(r.dropdown_content.contains(h)){const b=r._render("option",t);k0(h,b),r.activeOption===h&&r.setActiveOption(b)}h.remove()}v&&(a=r.items.indexOf(s),a!==-1&&r.items.splice(a,1,o),n=r._render("item",t),v.classList.contains("active")&&le(n,"active"),k0(v,n)),r.lastQuery=null}removeOption(e,t){const r=this;e=_n(e),r.uncacheValue(e),delete r.userOptions[e],delete r.options[e],r.lastQuery=null,r.trigger("option_remove",e),r.removeItem(e,t)}clearOptions(e){const t=(e||this.clearFilter).bind(this);this.loadedSearches={},this.userOptions={},this.clearCache();const r={};$t(this.options,(n,a)=>{t(n,a)&&(r[a]=n)}),this.options=this.sifter.items=r,this.lastQuery=null,this.trigger("option_clear")}clearFilter(e,t){return this.items.indexOf(t)>=0}getOption(e,t=!1){const r=ve(e);if(r===null)return null;const n=this.options[r];if(n!=null){if(n.$div)return n.$div;if(t)return this._render("option",n)}return null}getAdjacent(e,t,r="option"){var n=this,a;if(!e)return null;r=="item"?a=n.controlChildren():a=n.dropdown_content.querySelectorAll("[data-selectable]");for(let s=0;s<a.length;s++)if(a[s]==e)return t>0?a[s+1]:a[s-1];return null}getItem(e){if(typeof e=="object")return e;var t=ve(e);return t!==null?this.control.querySelector(`[data-value="${ji(t)}"]`):null}addItems(e,t){var r=this,n=Array.isArray(e)?e:[e];n=n.filter(s=>r.items.indexOf(s)===-1);const a=n[n.length-1];n.forEach(s=>{r.isPending=s!==a,r.addItem(s,t)})}addItem(e,t){var r=t?[]:["change","dropdown_close"];Ui(this,r,()=>{var n,a;const s=this,o=s.settings.mode,c=ve(e);if(!(c&&s.items.indexOf(c)!==-1&&(o==="single"&&s.close(),o==="single"||!s.settings.duplicates))&&!(c===null||!s.options.hasOwnProperty(c))&&(o==="single"&&s.clear(t),!(o==="multi"&&s.isFull()))){if(n=s._render("item",s.options[c]),s.control.contains(n)&&(n=n.cloneNode(!0)),a=s.isFull(),s.items.splice(s.caretPos,0,c),s.insertAtCaret(n),s.isSetup){if(!s.isPending&&s.settings.hideSelected){let h=s.getOption(c),v=s.getAdjacent(h,1);v&&s.setActiveOption(v)}!s.isPending&&!s.settings.closeAfterSelect&&s.refreshOptions(s.isFocused&&o!=="single"),s.settings.closeAfterSelect!=!1&&s.isFull()?s.close():s.isPending||s.positionDropdown(),s.trigger("item_add",c,n),s.isPending||s.updateOriginalInput({silent:t})}(!s.isPending||!a&&s.isFull())&&(s.inputState(),s.refreshState())}})}removeItem(e=null,t){const r=this;if(e=r.getItem(e),!e)return;var n,a;const s=e.dataset.value;n=Gi(e),e.remove(),e.classList.contains("active")&&(a=r.activeItems.indexOf(e),r.activeItems.splice(a,1),Be(e,"active")),r.items.splice(n,1),r.lastQuery=null,!r.settings.persist&&r.userOptions.hasOwnProperty(s)&&r.removeOption(s,t),n<r.caretPos&&r.setCaret(r.caretPos-1),r.updateOriginalInput({silent:t}),r.refreshState(),r.positionDropdown(),r.trigger("item_remove",s,e)}createItem(e=null,t=()=>{}){arguments.length===3&&(t=arguments[2]),typeof t!="function"&&(t=()=>{});var r=this,n=r.caretPos,a;if(e=e||r.inputValue(),!r.canCreate(e))return t(),!1;r.lock();var s=!1,o=c=>{if(r.unlock(),!c||typeof c!="object")return t();var h=ve(c[r.settings.valueField]);if(typeof h!="string")return t();r.setTextboxValue(),r.addOption(c,!0),r.setCaret(n),r.addItem(h),t(c),s=!0};return typeof r.settings.create=="function"?a=r.settings.create.call(this,e,o):a={[r.settings.labelField]:e,[r.settings.valueField]:e},s||o(a),!0}refreshItems(){var e=this;e.lastQuery=null,e.isSetup&&e.addItems(e.items),e.updateOriginalInput(),e.refreshState()}refreshState(){const e=this;e.refreshValidityState();const t=e.isFull(),r=e.isLocked;e.wrapper.classList.toggle("rtl",e.rtl);const n=e.wrapper.classList;n.toggle("focus",e.isFocused),n.toggle("disabled",e.isDisabled),n.toggle("readonly",e.isReadOnly),n.toggle("required",e.isRequired),n.toggle("invalid",!e.isValid),n.toggle("locked",r),n.toggle("full",t),n.toggle("input-active",e.isFocused&&!e.isInputHidden),n.toggle("dropdown-active",e.isOpen),n.toggle("has-options",El(e.options)),n.toggle("has-items",e.items.length>0)}refreshValidityState(){var e=this;e.input.validity&&(e.isValid=e.input.validity.valid,e.isInvalid=!e.isValid)}isFull(){return this.settings.maxItems!==null&&this.items.length>=this.settings.maxItems}updateOriginalInput(e={}){const t=this;var r,n;const a=t.input.querySelector('option[value=""]');if(t.is_select_tag){let c=function(h,v,b){return h||(h=Se('<option value="'+w0(v)+'">'+w0(b)+"</option>")),h!=a&&t.input.append(h),s.push(h),(h!=a||o>0)&&(h.selected=!0),h};const s=[],o=t.input.querySelectorAll("option:checked").length;t.input.querySelectorAll("option:checked").forEach(h=>{h.selected=!1}),t.items.length==0&&t.settings.mode=="single"?c(a,"",""):t.items.forEach(h=>{if(r=t.options[h],n=r[t.settings.labelField]||"",s.includes(r.$option)){const v=t.input.querySelector(`option[value="${ji(h)}"]:not(:checked)`);c(v,h,n)}else r.$option=c(r.$option,h,n)})}else t.input.value=t.getValue();t.isSetup&&(e.silent||t.trigger("change",t.getValue()))}open(){var e=this;e.isLocked||e.isOpen||e.settings.mode==="multi"&&e.isFull()||(e.isOpen=!0,St(e.focus_node,{"aria-expanded":"true"}),e.refreshState(),xn(e.dropdown,{visibility:"hidden",display:"block"}),e.positionDropdown(),xn(e.dropdown,{visibility:"visible",display:"block"}),e.focus(),e.trigger("dropdown_open",e.dropdown))}close(e=!0){var t=this,r=t.isOpen;e&&(t.setTextboxValue(),t.settings.mode==="single"&&t.items.length&&t.inputState()),t.isOpen=!1,St(t.focus_node,{"aria-expanded":"false"}),xn(t.dropdown,{display:"none"}),t.settings.hideSelected&&t.clearActiveOption(),t.refreshState(),r&&t.trigger("dropdown_close",t.dropdown)}positionDropdown(){if(this.settings.dropdownParent==="body"){var e=this.control,t=e.getBoundingClientRect(),r=e.offsetHeight+t.top+window.scrollY,n=t.left+window.scrollX;xn(this.dropdown,{width:t.width+"px",top:r+"px",left:n+"px"})}}clear(e){var t=this;if(t.items.length){var r=t.controlChildren();$t(r,n=>{t.removeItem(n,!0)}),t.inputState(),e||t.updateOriginalInput(),t.trigger("clear")}}insertAtCaret(e){const t=this,r=t.caretPos,n=t.control;n.insertBefore(e,n.children[r]||null),t.setCaret(r+1)}deleteSelection(e){var t,r,n,a,s=this;t=e&&e.keyCode===Xi?-1:1,r=kl(s.control_input);const o=[];if(s.activeItems.length)a=Wi(s.activeItems,t),n=Gi(a),t>0&&n++,$t(s.activeItems,c=>o.push(c));else if((s.isFocused||s.settings.mode==="single")&&s.items.length){const c=s.controlChildren();let h;t<0&&r.start===0&&r.length===0?h=c[s.caretPos-1]:t>0&&r.start===s.inputValue().length&&(h=c[s.caretPos]),h!==void 0&&o.push(h)}if(!s.shouldDelete(o,e))return!1;for(Ft(e,!0),typeof n<"u"&&s.setCaret(n);o.length;)s.removeItem(o.pop());return s.inputState(),s.positionDropdown(),s.refreshOptions(!1),!0}shouldDelete(e,t){const r=e.map(n=>n.dataset.value);return!(!r.length||typeof this.settings.onDelete=="function"&&this.settings.onDelete(r,t)===!1)}advanceSelection(e,t){var r,n,a=this;a.rtl&&(e*=-1),!a.inputValue().length&&(Je(kn,t)||Je("shiftKey",t)?(r=a.getLastActive(e),r?r.classList.contains("active")?n=a.getAdjacent(r,e,"item"):n=r:e>0?n=a.control_input.nextElementSibling:n=a.control_input.previousElementSibling,n&&(n.classList.contains("active")&&a.removeActiveItem(r),a.setActiveItemClass(n))):a.moveCaret(e))}moveCaret(e){}getLastActive(e){let t=this.control.querySelector(".last-active");if(t)return t;var r=this.control.querySelectorAll(".active");if(r)return Wi(r,e)}setCaret(e){this.caretPos=this.items.length}controlChildren(){return Array.from(this.control.querySelectorAll("[data-ts-item]"))}lock(){this.setLocked(!0)}unlock(){this.setLocked(!1)}setLocked(e=this.isReadOnly||this.isDisabled){this.isLocked=e,this.refreshState()}disable(){this.setDisabled(!0),this.close()}enable(){this.setDisabled(!1)}setDisabled(e){this.focus_node.tabIndex=e?-1:this.tabIndex,this.isDisabled=e,this.input.disabled=e,this.control_input.disabled=e,this.setLocked()}setReadOnly(e){this.isReadOnly=e,this.input.readOnly=e,this.control_input.readOnly=e,this.setLocked()}destroy(){var e=this,t=e.revertSettings;e.trigger("destroy"),e.off(),e.wrapper.remove(),e.dropdown.remove(),e.input.innerHTML=t.innerHTML,e.input.tabIndex=t.tabIndex,Be(e.input,"tomselected","ts-hidden-accessible"),e._destroy(),delete e.input.tomselect}render(e,t){var r,n;const a=this;if(typeof this.settings.render[e]!="function"||(n=a.settings.render[e].call(this,t,w0),!n))return null;if(n=Se(n),e==="option"||e==="option_create"?t[a.settings.disabledField]?St(n,{"aria-disabled":"true"}):St(n,{"data-selectable":""}):e==="optgroup"&&(r=t.group[a.settings.optgroupValueField],St(n,{"data-group":r}),t.group[a.settings.disabledField]&&St(n,{"data-disabled":""})),e==="option"||e==="item"){const s=_n(t[a.settings.valueField]);St(n,{"data-value":s}),e==="item"?(le(n,a.settings.itemClass),St(n,{"data-ts-item":""})):(le(n,a.settings.optionClass),St(n,{role:"option",id:t.$id}),t.$div=n,a.options[s]=t)}return n}_render(e,t){const r=this.render(e,t);if(r==null)throw"HTMLElement expected";return r}clearCache(){$t(this.options,e=>{e.$div&&(e.$div.remove(),delete e.$div)})}uncacheValue(e){const t=this.getOption(e);t&&t.remove()}canCreate(e){return this.settings.create&&e.length>0&&this.settings.createFilter.call(this,e)}hook(e,t,r){var n=this,a=n[t];n[t]=function(){var s,o;return e==="after"&&(s=a.apply(n,arguments)),o=r.apply(n,arguments),e==="instead"?o:(e==="before"&&(s=a.apply(n,arguments)),s)}}}const Ml=(i,e,t,r)=>{i.addEventListener(e,t,r)};function Nl(){Ml(this.input,"change",()=>{this.sync()})}const Pl=i=>typeof i>"u"||i===null?null:$l(i),$l=i=>typeof i=="boolean"?i?"1":"0":i+"",ta=(i,e=!1)=>{i&&(i.preventDefault(),e&&i.stopPropagation())},Bl=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(Hl(i)){var e=document.createElement("template");return e.innerHTML=i.trim(),e.content.firstChild}return document.querySelector(i)},Hl=i=>typeof i=="string"&&i.indexOf("<")>-1;function Ul(i){var e=this,t=e.onOptionSelect;e.settings.hideSelected=!1;const r=Object.assign({className:"tomselect-checkbox",checkedClassNames:void 0,uncheckedClassNames:void 0},i);var n=function(o,c){c?(o.checked=!0,r.uncheckedClassNames&&o.classList.remove(...r.uncheckedClassNames),r.checkedClassNames&&o.classList.add(...r.checkedClassNames)):(o.checked=!1,r.checkedClassNames&&o.classList.remove(...r.checkedClassNames),r.uncheckedClassNames&&o.classList.add(...r.uncheckedClassNames))},a=function(o){setTimeout(()=>{var c=o.querySelector("input."+r.className);c instanceof HTMLInputElement&&n(c,o.classList.contains("selected"))},1)};e.hook("after","setupTemplates",()=>{var s=e.settings.render.option;e.settings.render.option=(o,c)=>{var h=Bl(s.call(e,o,c)),v=document.createElement("input");r.className&&v.classList.add(r.className),v.addEventListener("click",function(_){ta(_)}),v.type="checkbox";const b=Pl(o[e.settings.valueField]);return n(v,!!(b&&e.items.indexOf(b)>-1)),h.prepend(v),h}}),e.on("item_remove",s=>{var o=e.getOption(s);o&&(o.classList.remove("selected"),a(o))}),e.on("item_add",s=>{var o=e.getOption(s);o&&a(o)}),e.hook("instead","onOptionSelect",(s,o)=>{if(o.classList.contains("selected")){o.classList.remove("selected"),e.removeItem(o.dataset.value),e.refreshOptions(),ta(s,!0);return}t.call(e,s,o),a(o)})}const jl=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(Yl(i)){var e=document.createElement("template");return e.innerHTML=i.trim(),e.content.firstChild}return document.querySelector(i)},Yl=i=>typeof i=="string"&&i.indexOf("<")>-1;function Vl(i){const e=this,t=Object.assign({className:"clear-button",title:"Clear All",html:r=>`<div class="${r.className}" title="${r.title}">⨯</div>`},i);e.on("initialize",()=>{var r=jl(t.html(t));r.addEventListener("click",n=>{e.isLocked||(e.clear(),e.settings.mode==="single"&&e.settings.allowEmptyOption&&e.addItem(""),n.preventDefault(),n.stopPropagation())}),e.control.appendChild(r)})}const ql=(i,e=!1)=>{i&&(i.preventDefault(),e&&i.stopPropagation())},vr=(i,e,t,r)=>{i.addEventListener(e,t,r)},Wl=(i,e)=>{if(Array.isArray(i))i.forEach(e);else for(var t in i)i.hasOwnProperty(t)&&e(i[t],t)},Gl=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(Xl(i)){var e=document.createElement("template");return e.innerHTML=i.trim(),e.content.firstChild}return document.querySelector(i)},Xl=i=>typeof i=="string"&&i.indexOf("<")>-1,Zl=(i,e)=>{Wl(e,(t,r)=>{t==null?i.removeAttribute(r):i.setAttribute(r,""+t)})},Kl=(i,e)=>{var t;(t=i.parentNode)==null||t.insertBefore(e,i.nextSibling)},Jl=(i,e)=>{var t;(t=i.parentNode)==null||t.insertBefore(e,i)},Ql=(i,e)=>{do{var t;if(e=(t=e)==null?void 0:t.previousElementSibling,i==e)return!0}while(e&&e.previousElementSibling);return!1};function t1(){var i=this;if(i.settings.mode!=="multi")return;var e=i.lock,t=i.unlock;let r=!0,n;i.hook("after","setupTemplates",()=>{var a=i.settings.render.item;i.settings.render.item=(s,o)=>{const c=Gl(a.call(i,s,o));Zl(c,{draggable:"true"});const h=p=>{r||ql(p),p.stopPropagation()},v=p=>{n=c,setTimeout(()=>{c.classList.add("ts-dragging")},0)},b=p=>{p.preventDefault(),c.classList.add("ts-drag-over"),f(c,n)},_=()=>{c.classList.remove("ts-drag-over")},f=(p,w)=>{w!==void 0&&(Ql(w,c)?Kl(p,w):Jl(p,w))},m=()=>{var p;document.querySelectorAll(".ts-drag-over").forEach(g=>g.classList.remove("ts-drag-over")),(p=n)==null||p.classList.remove("ts-dragging"),n=void 0;var w=[];i.control.querySelectorAll("[data-value]").forEach(g=>{if(g.dataset.value){let y=g.dataset.value;y&&w.push(y)}}),i.setValue(w)};return vr(c,"mousedown",h),vr(c,"dragstart",v),vr(c,"dragenter",b),vr(c,"dragover",b),vr(c,"dragleave",_),vr(c,"dragend",m),c}}),i.hook("instead","lock",()=>(r=!1,e.call(i))),i.hook("instead","unlock",()=>(r=!0,t.call(i)))}const e1=(i,e=!1)=>{i&&(i.preventDefault(),e&&i.stopPropagation())},r1=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(n1(i)){var e=document.createElement("template");return e.innerHTML=i.trim(),e.content.firstChild}return document.querySelector(i)},n1=i=>typeof i=="string"&&i.indexOf("<")>-1;function i1(i){const e=this,t=Object.assign({title:"Untitled",headerClass:"dropdown-header",titleRowClass:"dropdown-header-title",labelClass:"dropdown-header-label",closeClass:"dropdown-header-close",html:r=>'<div class="'+r.headerClass+'"><div class="'+r.titleRowClass+'"><span class="'+r.labelClass+'">'+r.title+'</span><a class="'+r.closeClass+'">×</a></div></div>'},i);e.on("initialize",()=>{var r=r1(t.html(t)),n=r.querySelector("."+t.closeClass);n&&n.addEventListener("click",a=>{e1(a,!0),e.close()}),e.dropdown.insertBefore(r,e.dropdown.firstChild)})}const a1=(i,e)=>{if(Array.isArray(i))i.forEach(e);else for(var t in i)i.hasOwnProperty(t)&&e(i[t],t)},s1=(i,...e)=>{var t=o1(e);i=l1(i),i.map(r=>{t.map(n=>{r.classList.remove(n)})})},o1=i=>{var e=[];return a1(i,t=>{typeof t=="string"&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},l1=i=>(Array.isArray(i)||(i=[i]),i),c1=(i,e)=>{if(!i)return-1;e=e||i.nodeName;for(var t=0;i=i.previousElementSibling;)i.matches(e)&&t++;return t};function d1(){var i=this;i.hook("instead","setCaret",e=>{i.settings.mode==="single"||!i.control.contains(i.control_input)?e=i.items.length:(e=Math.max(0,Math.min(i.items.length,e)),e!=i.caretPos&&!i.isPending&&i.controlChildren().forEach((t,r)=>{r<e?i.control_input.insertAdjacentElement("beforebegin",t):i.control.appendChild(t)})),i.caretPos=e}),i.hook("instead","moveCaret",e=>{if(!i.isFocused)return;const t=i.getLastActive(e);if(t){const r=c1(t);i.setCaret(e>0?r+1:r),i.setActiveItem(),s1(t,"last-active")}else i.setCaret(i.caretPos+e)})}const u1=27,h1=9,p1=(i,e=!1)=>{i&&(i.preventDefault(),e&&i.stopPropagation())},f1=(i,e,t,r)=>{i.addEventListener(e,t,r)},m1=(i,e)=>{if(Array.isArray(i))i.forEach(e);else for(var t in i)i.hasOwnProperty(t)&&e(i[t],t)},ea=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(g1(i)){var e=document.createElement("template");return e.innerHTML=i.trim(),e.content.firstChild}return document.querySelector(i)},g1=i=>typeof i=="string"&&i.indexOf("<")>-1,b1=(i,...e)=>{var t=v1(e);i=w1(i),i.map(r=>{t.map(n=>{r.classList.add(n)})})},v1=i=>{var e=[];return m1(i,t=>{typeof t=="string"&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},w1=i=>(Array.isArray(i)||(i=[i]),i);function y1(){const i=this;i.settings.shouldOpen=!0,i.hook("before","setup",()=>{i.focus_node=i.control,b1(i.control_input,"dropdown-input");const e=ea('<div class="dropdown-input-wrap">');e.append(i.control_input),i.dropdown.insertBefore(e,i.dropdown.firstChild);const t=ea('<input class="items-placeholder" tabindex="-1" />');t.placeholder=i.settings.placeholder||"",i.control.append(t)}),i.on("initialize",()=>{i.control_input.addEventListener("keydown",t=>{switch(t.keyCode){case u1:i.isOpen&&(p1(t,!0),i.close()),i.clearActiveItems();return;case h1:i.focus_node.tabIndex=-1;break}return i.onKeyDown.call(i,t)}),i.on("blur",()=>{i.focus_node.tabIndex=i.isDisabled?-1:i.tabIndex}),i.on("dropdown_open",()=>{i.control_input.focus()});const e=i.onBlur;i.hook("instead","onBlur",t=>{if(!(t&&t.relatedTarget==i.control_input))return e.call(i)}),f1(i.control_input,"blur",()=>i.onBlur()),i.hook("before","close",()=>{i.isOpen&&i.focus_node.focus({preventScroll:!0})})})}const Sn=(i,e,t,r)=>{i.addEventListener(e,t,r)};function _1(){var i=this;i.on("initialize",()=>{var e=document.createElement("span"),t=i.control_input;e.style.cssText="position:absolute; top:-99999px; left:-99999px; width:auto; padding:0; white-space:pre; ",i.wrapper.appendChild(e);var r=["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"];for(const a of r)e.style[a]=t.style[a];var n=()=>{e.textContent=t.value,t.style.width=e.clientWidth+"px"};n(),i.on("update item_add item_remove",n),Sn(t,"input",n),Sn(t,"keyup",n),Sn(t,"blur",n),Sn(t,"update",n)})}function x1(){var i=this,e=i.deleteSelection;this.hook("instead","deleteSelection",t=>i.activeItems.length?e.call(i,t):!1)}function k1(){this.hook("instead","setActiveItem",()=>{}),this.hook("instead","selectAll",()=>{})}const ra=37,S1=39,E1=(i,e,t)=>{for(;i&&i.matches;){if(i.matches(e))return i;i=i.parentNode}},L1=(i,e)=>{if(!i)return-1;e=e||i.nodeName;for(var t=0;i=i.previousElementSibling;)i.matches(e)&&t++;return t};function A1(){var i=this,e=i.onKeyDown;i.hook("instead","onKeyDown",t=>{var r,n,a,s;if(!i.isOpen||!(t.keyCode===ra||t.keyCode===S1))return e.call(i,t);i.ignoreHover=!0,s=E1(i.activeOption,"[data-group]"),r=L1(i.activeOption,"[data-selectable]"),s&&(t.keyCode===ra?s=s.previousSibling:s=s.nextSibling,s&&(a=s.querySelectorAll("[data-selectable]"),n=a[Math.min(a.length-1,r)],n&&i.setActiveOption(n)))})}const D1=i=>(i+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),na=(i,e=!1)=>{i&&(i.preventDefault(),e&&i.stopPropagation())},ia=(i,e,t,r)=>{i.addEventListener(e,t,r)},aa=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(T1(i)){var e=document.createElement("template");return e.innerHTML=i.trim(),e.content.firstChild}return document.querySelector(i)},T1=i=>typeof i=="string"&&i.indexOf("<")>-1;function F1(i){const e=Object.assign({label:"×",title:"Remove",className:"remove",append:!0},i);var t=this;if(e.append){var r='<a href="javascript:void(0)" class="'+e.className+'" tabindex="-1" title="'+D1(e.title)+'">'+e.label+"</a>";t.hook("after","setupTemplates",()=>{var n=t.settings.render.item;t.settings.render.item=(a,s)=>{var o=aa(n.call(t,a,s)),c=aa(r);return o.appendChild(c),ia(c,"mousedown",h=>{na(h,!0)}),ia(c,"click",h=>{t.isLocked||(na(h,!0),!t.isLocked&&t.shouldDelete([o],h)&&(t.removeItem(o),t.refreshOptions(!1),t.inputState()))}),o}})}}function O1(i){const e=this,t=Object.assign({text:r=>r[e.settings.labelField]},i);e.on("item_remove",function(r){if(e.isFocused&&e.control_input.value.trim()===""){var n=e.options[r];n&&e.setTextboxValue(t.text.call(e,n))}})}const C1=(i,e)=>{if(Array.isArray(i))i.forEach(e);else for(var t in i)i.hasOwnProperty(t)&&e(i[t],t)},I1=(i,...e)=>{var t=z1(e);i=R1(i),i.map(r=>{t.map(n=>{r.classList.add(n)})})},z1=i=>{var e=[];return C1(i,t=>{typeof t=="string"&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},R1=i=>(Array.isArray(i)||(i=[i]),i);function M1(){const i=this,e=i.canLoad,t=i.clearActiveOption,r=i.loadCallback;var n={},a,s=!1,o,c=[];if(i.settings.shouldLoadMore||(i.settings.shouldLoadMore=()=>{if(a.clientHeight/(a.scrollHeight-a.scrollTop)>.9)return!0;if(i.activeOption){var _=i.selectable(),f=Array.from(_).indexOf(i.activeOption);if(f>=_.length-2)return!0}return!1}),!i.settings.firstUrl)throw"virtual_scroll plugin requires a firstUrl() method";i.settings.sortField=[{field:"$order"},{field:"$score"}];const h=b=>typeof i.settings.maxOptions=="number"&&a.children.length>=i.settings.maxOptions?!1:!!(b in n&&n[b]),v=(b,_)=>i.items.indexOf(_)>=0||c.indexOf(_)>=0;i.setNextUrl=(b,_)=>{n[b]=_},i.getUrl=b=>{if(b in n){const _=n[b];return n[b]=!1,_}return i.clearPagination(),i.settings.firstUrl.call(i,b)},i.clearPagination=()=>{n={}},i.hook("instead","clearActiveOption",()=>{if(!s)return t.call(i)}),i.hook("instead","canLoad",b=>b in n?h(b):e.call(i,b)),i.hook("instead","loadCallback",(b,_)=>{if(!s)i.clearOptions(v);else if(o){const f=b[0];f!==void 0&&(o.dataset.value=f[i.settings.valueField])}r.call(i,b,_),s=!1}),i.hook("after","refreshOptions",()=>{const b=i.lastValue;var _;h(b)?(_=i.render("loading_more",{query:b}),_&&(_.setAttribute("data-selectable",""),o=_)):b in n&&!a.querySelector(".no-results")&&(_=i.render("no_more_results",{query:b})),_&&(I1(_,i.settings.optionClass),a.append(_))}),i.on("initialize",()=>{c=Object.keys(i.options),a=i.dropdown_content,i.settings.render=Object.assign({},{loading_more:()=>'<div class="loading-more-results">Loading more results ... </div>',no_more_results:()=>'<div class="no-more-results">No more results</div>'},i.settings.render),a.addEventListener("scroll",()=>{i.settings.shouldLoadMore.call(i)&&h(i.lastValue)&&(s||(s=!0,i.load.call(i,i.lastValue)))})})}Kt.define("change_listener",Nl),Kt.define("checkbox_options",Ul),Kt.define("clear_button",Vl),Kt.define("drag_drop",t1),Kt.define("dropdown_header",i1),Kt.define("caret_position",d1),Kt.define("dropdown_input",y1),Kt.define("input_autogrow",_1),Kt.define("no_backspace_delete",x1),Kt.define("no_active_items",k1),Kt.define("optgroup_columns",A1),Kt.define("remove_button",F1),Kt.define("restore_on_backspace",O1),Kt.define("virtual_scroll",M1);const sa=`<div
|
|
1051
|
+
`,f0=document.createElement("template");class zi extends HTMLElement{constructor(){super();ot(this,pt);ot(this,er,!1);ot(this,Le,!1);ot(this,yr,!1);this.attachShadow({mode:"open"}),ht(this,Le,this.getAttribute("styled")==="true"),M(this,pt,Ma).call(this)}attributeChangedCallback(t,r,n){d(this,Le)&&M(this,pt,M0).call(this,`bg-${n==="white"?"white":"neutral-50"}`)}focusEl(){[...d(this,pt,Bn)][1].focus()}enable(t){this.removeAttribute("category"),d(this,pt,Pa).forEach(r=>{r.checked=!1,t?(r.removeAttribute("disabled"),d(this,pt,xe).removeAttribute("inert")):(r.setAttribute("disabled","true"),d(this,pt,xe).setAttribute("inert",""))}),this.enableTabIndex(t),ht(this,yr,t)}enableTabIndex(t){d(this,pt,xe).querySelectorAll("[tabindex]").forEach(n=>n.setAttribute("tabindex",t?"0":"-1"))}validate(){return ht(this,er,!1),this.hasAttribute("category")?(ht(this,er,!0),d(this,er)):(M(this,pt,N0).call(this,!0),d(this,er))}get isEnabled(){return d(this,yr)}get pdcValue(){const t=this.getAttribute("category");return t&&(t==="domestic"||t==="intl")?t:null}}er=new WeakMap,Le=new WeakMap,yr=new WeakMap,pt=new WeakSet,Ma=function(){d(this,Le)?(f0.innerHTML=Ii,Ke(d(this,pt,Tr))):f0.innerHTML=$e(Ii),d(this,pt,Tr).appendChild(f0.content.cloneNode(!0)),this.enableTabIndex(!1),M(this,pt,M0).call(this),M(this,pt,Na).call(this)},Na=function(){let t=0,r=0;d(this,pt,xe).addEventListener("pointerdown",n=>{if(!(n instanceof PointerEvent))return;const a=$r(n);t=a.pointerStartX,r=a.pointerStartY}),d(this,pt,xe).addEventListener("pointerup",n=>{if(n instanceof PointerEvent){const a=Br(n,M(this,pt,R0).bind(this),t,r);t=a.pointerStartX,r=a.pointerStartY}}),d(this,pt,xe).addEventListener("keydown",n=>{n instanceof KeyboardEvent&&(n.key==="Enter"||n.key===" ")&&M(this,pt,R0).call(this,n)})},R0=function(t){if(!d(this,yr))return;const r=t.composedPath()[0];if(!(r instanceof HTMLElement||r instanceof SVGElement))return;const n=r.closest("label"),a=n==null?void 0:n.getAttribute("for"),s=d(this,pt,xe).querySelector(`#${a}`),o=d(this,pt,xe).querySelector(`#${a==="domestic"?"intl":"domestic"}`);s&&o&&(o.checked=!1,s.checked=!0,a&&this.setAttribute("category",a),d(this,Le)&&(n==null||n.classList.add("success"),M(this,pt,N0).call(this,!1)))},xe=function(){const t=d(this,pt,Tr).querySelector("#pdc-container");if(!t)throw new Error("Failed to render container for Category custom element");return t},Pa=function(){const t=d(this,pt,Tr).querySelectorAll("input");if(!t)throw new Error("Failed to render inputs in Category custom element");return t},Bn=function(){const t=d(this,pt,Tr).querySelectorAll("label");if(!t)throw new Error("Failed to render labels in Category custom element");return t},Tr=function(){if(!this.shadowRoot)throw new Error("Failed to render shadowRoot in Category custom element");return this.shadowRoot},Hn=function(){var r;const t=(r=this.closest("#locations-container"))==null?void 0:r.querySelector("#error");if(!t)throw new Error("Failed to get View's error element from Category custom element");return t},M0=function(t=null){d(this,Le)&&(d(this,pt,xe).classList.remove("bg-white","bg-neutral-50"),d(this,pt,xe).classList.add(t||`bg-${this.getAttribute("bg")}`))},N0=function(t,r="Select an area."){if(t){d(this,Le)&&(d(this,pt,Bn).forEach((n,a)=>{a>0&&n.classList.add("error")}),d(this,pt,Hn).classList.add("active")),d(this,pt,Hn).textContent=r;return}d(this,Le)&&(d(this,pt,Bn).forEach((n,a)=>{a>0&&n.classList.remove("error")}),d(this,pt,Hn).classList.remove("active"))},he(zi,"observedAttributes",["bg"]);function m0(i,e){i.split(/\s+/).forEach(t=>{e(t)})}class Qo{constructor(){this._events={}}on(e,t){m0(e,r=>{const n=this._events[r]||[];n.push(t),this._events[r]=n})}off(e,t){var r=arguments.length;if(r===0){this._events={};return}m0(e,n=>{if(r===1){delete this._events[n];return}const a=this._events[n];a!==void 0&&(a.splice(a.indexOf(t),1),this._events[n]=a)})}trigger(e,...t){var r=this;m0(e,n=>{const a=r._events[n];a!==void 0&&a.forEach(s=>{s.apply(r,t)})})}}function tl(i){return i.plugins={},class extends i{constructor(){super(...arguments),this.plugins={names:[],settings:{},requested:{},loaded:{}}}static define(e,t){i.plugins[e]={name:e,fn:t}}initializePlugins(e){var t,r;const n=this,a=[];if(Array.isArray(e))e.forEach(s=>{typeof s=="string"?a.push(s):(n.plugins.settings[s.name]=s.options,a.push(s.name))});else if(e)for(t in e)e.hasOwnProperty(t)&&(n.plugins.settings[t]=e[t],a.push(t));for(;r=a.shift();)n.require(r)}loadPlugin(e){var t=this,r=t.plugins,n=i.plugins[e];if(!i.plugins.hasOwnProperty(e))throw new Error('Unable to find "'+e+'" plugin');r.requested[e]=!0,r.loaded[e]=n.fn.apply(t,[t.plugins.settings[e]||{}]),r.names.push(e)}require(e){var t=this,r=t.plugins;if(!t.plugins.loaded.hasOwnProperty(e)){if(r.requested[e])throw new Error('Plugin has circular dependency ("'+e+'")');t.loadPlugin(e)}return r.loaded[e]}}}const gn=i=>(i=i.filter(Boolean),i.length<2?i[0]||"":rl(i)==1?"["+i.join("")+"]":"(?:"+i.join("|")+")"),Ri=i=>{if(!el(i))return i.join("");let e="",t=0;const r=()=>{t>1&&(e+="{"+t+"}")};return i.forEach((n,a)=>{if(n===i[a-1]){t++;return}r(),e+=n,t=1}),r(),e},Mi=i=>{let e=Array.from(i);return gn(e)},el=i=>new Set(i).size!==i.length,Yr=i=>(i+"").replace(/([\$\(\)\*\+\.\?\[\]\^\{\|\}\\])/gu,"\\$1"),rl=i=>i.reduce((e,t)=>Math.max(e,nl(t)),0),nl=i=>Array.from(i).length,Ni=i=>{if(i.length===1)return[[i]];let e=[];const t=i.substring(1);return Ni(t).forEach(function(n){let a=n.slice(0);a[0]=i.charAt(0)+a[0],e.push(a),a=n.slice(0),a.unshift(i.charAt(0)),e.push(a)}),e},il=[[0,65535]],al="[̀-ͯ·ʾʼ]";let bn,Pi;const sl=3,g0={},$i={"/":"⁄∕",0:"߀",a:"ⱥɐɑ",aa:"ꜳ",ae:"æǽǣ",ao:"ꜵ",au:"ꜷ",av:"ꜹꜻ",ay:"ꜽ",b:"ƀɓƃ",c:"ꜿƈȼↄ",d:"đɗɖᴅƌꮷԁɦ",e:"ɛǝᴇɇ",f:"ꝼƒ",g:"ǥɠꞡᵹꝿɢ",h:"ħⱨⱶɥ",i:"ɨı",j:"ɉȷ",k:"ƙⱪꝁꝃꝅꞣ",l:"łƚɫⱡꝉꝇꞁɭ",m:"ɱɯϻ",n:"ꞥƞɲꞑᴎлԉ",o:"øǿɔɵꝋꝍᴑ",oe:"œ",oi:"ƣ",oo:"ꝏ",ou:"ȣ",p:"ƥᵽꝑꝓꝕρ",q:"ꝗꝙɋ",r:"ɍɽꝛꞧꞃ",s:"ßȿꞩꞅʂ",t:"ŧƭʈⱦꞇ",th:"þ",tz:"ꜩ",u:"ʉ",v:"ʋꝟʌ",vy:"ꝡ",w:"ⱳ",y:"ƴɏỿ",z:"ƶȥɀⱬꝣ",hv:"ƕ"};for(let i in $i){let e=$i[i]||"";for(let t=0;t<e.length;t++){let r=e.substring(t,t+1);g0[r]=i}}const ol=new RegExp(Object.keys(g0).join("|")+"|"+al,"gu"),ll=i=>{bn===void 0&&(bn=hl(il))},Bi=(i,e="NFKD")=>i.normalize(e),vn=i=>Array.from(i).reduce((e,t)=>e+cl(t),""),cl=i=>(i=Bi(i).toLowerCase().replace(ol,e=>g0[e]||""),Bi(i,"NFC"));function*dl(i){for(const[e,t]of i)for(let r=e;r<=t;r++){let n=String.fromCharCode(r),a=vn(n);a!=n.toLowerCase()&&(a.length>sl||a.length!=0&&(yield{folded:a,composed:n,code_point:r}))}}const ul=i=>{const e={},t=(r,n)=>{const a=e[r]||new Set,s=new RegExp("^"+Mi(a)+"$","iu");n.match(s)||(a.add(Yr(n)),e[r]=a)};for(let r of dl(i))t(r.folded,r.folded),t(r.folded,r.composed);return e},hl=i=>{const e=ul(i),t={};let r=[];for(let a in e){let s=e[a];s&&(t[a]=Mi(s)),a.length>1&&r.push(Yr(a))}r.sort((a,s)=>s.length-a.length);const n=gn(r);return Pi=new RegExp("^"+n,"u"),t},pl=(i,e=1)=>{let t=0;return i=i.map(r=>(bn[r]&&(t+=r.length),bn[r]||r)),t>=e?Ri(i):""},fl=(i,e=1)=>(e=Math.max(e,i.length-1),gn(Ni(i).map(t=>pl(t,e)))),Hi=(i,e=!0)=>{let t=i.length>1?1:0;return gn(i.map(r=>{let n=[];const a=e?r.length():r.length()-1;for(let s=0;s<a;s++)n.push(fl(r.substrs[s]||"",t));return Ri(n)}))},ml=(i,e)=>{for(const t of e){if(t.start!=i.start||t.end!=i.end||t.substrs.join("")!==i.substrs.join(""))continue;let r=i.parts;const n=s=>{for(const o of r){if(o.start===s.start&&o.substr===s.substr)return!1;if(!(s.length==1||o.length==1)&&(s.start<o.start&&s.end>o.start||o.start<s.start&&o.end>s.start))return!0}return!1};if(!(t.parts.filter(n).length>0))return!0}return!1};class wn{constructor(){he(this,"parts");he(this,"substrs");he(this,"start");he(this,"end");this.parts=[],this.substrs=[],this.start=0,this.end=0}add(e){e&&(this.parts.push(e),this.substrs.push(e.substr),this.start=Math.min(e.start,this.start),this.end=Math.max(e.end,this.end))}last(){return this.parts[this.parts.length-1]}length(){return this.parts.length}clone(e,t){let r=new wn,n=JSON.parse(JSON.stringify(this.parts)),a=n.pop();for(const c of n)r.add(c);let s=t.substr.substring(0,e-a.start),o=s.length;return r.add({start:a.start,end:a.start+o,length:o,substr:s}),r}}const gl=i=>{ll(),i=vn(i);let e="",t=[new wn];for(let r=0;r<i.length;r++){let a=i.substring(r).match(Pi);const s=i.substring(r,r+1),o=a?a[0]:null;let c=[],h=new Set;for(const v of t){const b=v.last();if(!b||b.length==1||b.end<=r)if(o){const _=o.length;v.add({start:r,end:r+_,length:_,substr:o}),h.add("1")}else v.add({start:r,end:r+1,length:1,substr:s}),h.add("2");else if(o){let _=v.clone(r,b);const f=o.length;_.add({start:r,end:r+f,length:f,substr:o}),c.push(_)}else h.add("3")}if(c.length>0){c=c.sort((v,b)=>v.length()-b.length());for(let v of c)ml(v,t)||t.push(v);continue}if(r>0&&h.size==1&&!h.has("3")){e+=Hi(t,!1);let v=new wn;const b=t[0];b&&v.add(b.last()),t=[v]}}return e+=Hi(t,!0),e},bl=(i,e)=>{if(i)return i[e]},vl=(i,e)=>{if(i){for(var t,r=e.split(".");(t=r.shift())&&(i=i[t]););return i}},b0=(i,e,t)=>{var r,n;return!i||(i=i+"",e.regex==null)||(n=i.search(e.regex),n===-1)?0:(r=e.string.length/i.length,n===0&&(r+=.5),r*t)},v0=(i,e)=>{var t=i[e];if(typeof t=="function")return t;t&&!Array.isArray(t)&&(i[e]=[t])},yn=(i,e)=>{if(Array.isArray(i))i.forEach(e);else for(var t in i)i.hasOwnProperty(t)&&e(i[t],t)},wl=(i,e)=>typeof i=="number"&&typeof e=="number"?i>e?1:i<e?-1:0:(i=vn(i+"").toLowerCase(),e=vn(e+"").toLowerCase(),i>e?1:e>i?-1:0);class yl{constructor(e,t){he(this,"items");he(this,"settings");this.items=e,this.settings=t||{diacritics:!0}}tokenize(e,t,r){if(!e||!e.length)return[];const n=[],a=e.split(/\s+/);var s;return r&&(s=new RegExp("^("+Object.keys(r).map(Yr).join("|")+"):(.*)$")),a.forEach(o=>{let c,h=null,v=null;s&&(c=o.match(s))&&(h=c[1],o=c[2]),o.length>0&&(this.settings.diacritics?v=gl(o)||null:v=Yr(o),v&&t&&(v="\\b"+v)),n.push({string:o,regex:v?new RegExp(v,"iu"):null,field:h})}),n}getScoreFunction(e,t){var r=this.prepareSearch(e,t);return this._getScoreFunction(r)}_getScoreFunction(e){const t=e.tokens,r=t.length;if(!r)return function(){return 0};const n=e.options.fields,a=e.weights,s=n.length,o=e.getAttrFn;if(!s)return function(){return 1};const c=function(){return s===1?function(h,v){const b=n[0].field;return b0(o(v,b),h,a[b]||1)}:function(h,v){var b=0;if(h.field){const _=o(v,h.field);!h.regex&&_?b+=1/s:b+=b0(_,h,1)}else yn(a,(_,f)=>{b+=b0(o(v,f),h,_)});return b/s}}();return r===1?function(h){return c(t[0],h)}:e.options.conjunction==="and"?function(h){var v,b=0;for(let _ of t){if(v=c(_,h),v<=0)return 0;b+=v}return b/r}:function(h){var v=0;return yn(t,b=>{v+=c(b,h)}),v/r}}getSortFunction(e,t){var r=this.prepareSearch(e,t);return this._getSortFunction(r)}_getSortFunction(e){var t,r=[];const n=this,a=e.options,s=!e.query&&a.sort_empty?a.sort_empty:a.sort;if(typeof s=="function")return s.bind(this);const o=function(h,v){return h==="$score"?v.score:e.getAttrFn(n.items[v.id],h)};if(s)for(let h of s)(e.query||h.field!=="$score")&&r.push(h);if(e.query){t=!0;for(let h of r)if(h.field==="$score"){t=!1;break}t&&r.unshift({field:"$score",direction:"desc"})}else r=r.filter(h=>h.field!=="$score");return r.length?function(h,v){var b,_;for(let f of r)if(_=f.field,b=(f.direction==="desc"?-1:1)*wl(o(_,h),o(_,v)),b)return b;return 0}:null}prepareSearch(e,t){const r={};var n=Object.assign({},t);if(v0(n,"sort"),v0(n,"sort_empty"),n.fields){v0(n,"fields");const a=[];n.fields.forEach(s=>{typeof s=="string"&&(s={field:s,weight:1}),a.push(s),r[s.field]="weight"in s?s.weight:1}),n.fields=a}return{options:n,query:e.toLowerCase().trim(),tokens:this.tokenize(e,n.respect_word_boundaries,r),total:0,items:[],weights:r,getAttrFn:n.nesting?vl:bl}}search(e,t){var r=this,n,a;a=this.prepareSearch(e,t),t=a.options,e=a.query;const s=t.score||r._getScoreFunction(a);e.length?yn(r.items,(c,h)=>{n=s(c),(t.filter===!1||n>0)&&a.items.push({score:n,id:h})}):yn(r.items,(c,h)=>{a.items.push({score:1,id:h})});const o=r._getSortFunction(a);return o&&a.items.sort(o),a.total=a.items.length,typeof t.limit=="number"&&(a.items=a.items.slice(0,t.limit)),a}}const ve=i=>typeof i>"u"||i===null?null:_n(i),_n=i=>typeof i=="boolean"?i?"1":"0":i+"",w0=i=>(i+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),_l=(i,e)=>e>0?window.setTimeout(i,e):(i.call(null),null),xl=(i,e)=>{var t;return function(r,n){var a=this;t&&(a.loading=Math.max(a.loading-1,0),clearTimeout(t)),t=setTimeout(function(){t=null,a.loadedSearches[r]=!0,i.call(a,r,n)},e)}},Ui=(i,e,t)=>{var r,n=i.trigger,a={};i.trigger=function(){var s=arguments[0];if(e.indexOf(s)!==-1)a[s]=arguments;else return n.apply(i,arguments)},t.apply(i,[]),i.trigger=n;for(r of e)r in a&&n.apply(i,a[r])},kl=i=>({start:i.selectionStart||0,length:(i.selectionEnd||0)-(i.selectionStart||0)}),Ft=(i,e=!1)=>{i&&(i.preventDefault(),e&&i.stopPropagation())},Zt=(i,e,t,r)=>{i.addEventListener(e,t,r)},Je=(i,e)=>{if(!e||!e[i])return!1;var t=(e.altKey?1:0)+(e.ctrlKey?1:0)+(e.shiftKey?1:0)+(e.metaKey?1:0);return t===1},y0=(i,e)=>{const t=i.getAttribute("id");return t||(i.setAttribute("id",e),e)},ji=i=>i.replace(/[\\"']/g,"\\$&"),Qe=(i,e)=>{e&&i.append(e)},$t=(i,e)=>{if(Array.isArray(i))i.forEach(e);else for(var t in i)i.hasOwnProperty(t)&&e(i[t],t)},Se=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(Yi(i)){var e=document.createElement("template");return e.innerHTML=i.trim(),e.content.firstChild}return document.querySelector(i)},Yi=i=>typeof i=="string"&&i.indexOf("<")>-1,Sl=i=>i.replace(/['"\\]/g,"\\$&"),_0=(i,e)=>{var t=document.createEvent("HTMLEvents");t.initEvent(e,!0,!1),i.dispatchEvent(t)},xn=(i,e)=>{Object.assign(i.style,e)},le=(i,...e)=>{var t=Vi(e);i=qi(i),i.map(r=>{t.map(n=>{r.classList.add(n)})})},Be=(i,...e)=>{var t=Vi(e);i=qi(i),i.map(r=>{t.map(n=>{r.classList.remove(n)})})},Vi=i=>{var e=[];return $t(i,t=>{typeof t=="string"&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},qi=i=>(Array.isArray(i)||(i=[i]),i),x0=(i,e,t)=>{if(!(t&&!t.contains(i)))for(;i&&i.matches;){if(i.matches(e))return i;i=i.parentNode}},Wi=(i,e=0)=>e>0?i[i.length-1]:i[0],El=i=>Object.keys(i).length===0,Gi=(i,e)=>{if(!i)return-1;e=e||i.nodeName;for(var t=0;i=i.previousElementSibling;)i.matches(e)&&t++;return t},St=(i,e)=>{$t(e,(t,r)=>{t==null?i.removeAttribute(r):i.setAttribute(r,""+t)})},k0=(i,e)=>{i.parentNode&&i.parentNode.replaceChild(e,i)},Ll=(i,e)=>{if(e===null)return;if(typeof e=="string"){if(!e.length)return;e=new RegExp(e,"i")}const t=a=>{var s=a.data.match(e);if(s&&a.data.length>0){var o=document.createElement("span");o.className="highlight";var c=a.splitText(s.index);c.splitText(s[0].length);var h=c.cloneNode(!0);return o.appendChild(h),k0(c,o),1}return 0},r=a=>{a.nodeType===1&&a.childNodes&&!/(script|style)/i.test(a.tagName)&&(a.className!=="highlight"||a.tagName!=="SPAN")&&Array.from(a.childNodes).forEach(s=>{n(s)})},n=a=>a.nodeType===3?t(a):(r(a),0);n(i)},Al=i=>{var e=i.querySelectorAll("span.highlight");Array.prototype.forEach.call(e,function(t){var r=t.parentNode;r.replaceChild(t.firstChild,t),r.normalize()})},Dl=65,Tl=13,Fl=27,Ol=37,Cl=38,Il=39,zl=40,Xi=8,Rl=46,Zi=9,kn=(typeof navigator>"u"?!1:/Mac/.test(navigator.userAgent))?"metaKey":"ctrlKey",Ki={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,shouldOpen:null,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,refreshThrottle:300,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-wrapper",controlClass:"ts-control",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:'<input type="text" autocomplete="off" size="1" />',copyClassesToDropdown:!1,placeholder:null,hidePlaceholder:null,shouldLoad:function(i){return i.length>0},render:{}};function Ji(i,e){var t=Object.assign({},Ki,e),r=t.dataAttr,n=t.labelField,a=t.valueField,s=t.disabledField,o=t.optgroupField,c=t.optgroupLabelField,h=t.optgroupValueField,v=i.tagName.toLowerCase(),b=i.getAttribute("placeholder")||i.getAttribute("data-placeholder");if(!b&&!t.allowEmptyOption){let p=i.querySelector('option[value=""]');p&&(b=p.textContent)}var _={placeholder:b,options:[],optgroups:[],items:[],maxItems:null},f=()=>{var p,w=_.options,g={},y=1;let E=0;var A=O=>{var P=Object.assign({},O.dataset),F=r&&P[r];return typeof F=="string"&&F.length&&(P=Object.assign(P,JSON.parse(F))),P},T=(O,P)=>{var F=ve(O.value);if(F!=null&&!(!F&&!t.allowEmptyOption)){if(g.hasOwnProperty(F)){if(P){var V=g[F][o];V?Array.isArray(V)?V.push(P):g[F][o]=[V,P]:g[F][o]=P}}else{var G=A(O);G[n]=G[n]||O.textContent,G[a]=G[a]||F,G[s]=G[s]||O.disabled,G[o]=G[o]||P,G.$option=O,G.$order=G.$order||++E,g[F]=G,w.push(G)}O.selected&&_.items.push(F)}},U=O=>{var P,F;F=A(O),F[c]=F[c]||O.getAttribute("label")||"",F[h]=F[h]||y++,F[s]=F[s]||O.disabled,F.$order=F.$order||++E,_.optgroups.push(F),P=F[h],$t(O.children,V=>{T(V,P)})};_.maxItems=i.hasAttribute("multiple")?null:1,$t(i.children,O=>{p=O.tagName.toLowerCase(),p==="optgroup"?U(O):p==="option"&&T(O)})},m=()=>{const p=i.getAttribute(r);if(p)_.options=JSON.parse(p),$t(_.options,g=>{_.items.push(g[a])});else{var w=i.value.trim()||"";if(!t.allowEmptyOption&&!w.length)return;const g=w.split(t.delimiter);$t(g,y=>{const E={};E[n]=y,E[a]=y,_.options.push(E)}),_.items=g}};return v==="select"?f():m(),Object.assign({},Ki,_,e)}var Qi=0;class Kt extends tl(Qo){constructor(e,t){super(),this.order=0,this.isOpen=!1,this.isDisabled=!1,this.isReadOnly=!1,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.ignoreHover=!1,this.hasOptions=!1,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],this.refreshTimeout=null,Qi++;var r,n=Se(e);if(n.tomselect)throw new Error("Tom Select already initialized on this element");n.tomselect=this;var a=window.getComputedStyle&&window.getComputedStyle(n,null);r=a.getPropertyValue("direction");const s=Ji(n,t);this.settings=s,this.input=n,this.tabIndex=n.tabIndex||0,this.is_select_tag=n.tagName.toLowerCase()==="select",this.rtl=/rtl/i.test(r),this.inputId=y0(n,"tomselect-"+Qi),this.isRequired=n.required,this.sifter=new yl(this.options,{diacritics:s.diacritics}),s.mode=s.mode||(s.maxItems===1?"single":"multi"),typeof s.hideSelected!="boolean"&&(s.hideSelected=s.mode==="multi"),typeof s.hidePlaceholder!="boolean"&&(s.hidePlaceholder=s.mode!=="multi");var o=s.createFilter;typeof o!="function"&&(typeof o=="string"&&(o=new RegExp(o)),o instanceof RegExp?s.createFilter=w=>o.test(w):s.createFilter=w=>this.settings.duplicates||!this.options[w]),this.initializePlugins(s.plugins),this.setupCallbacks(),this.setupTemplates();const c=Se("<div>"),h=Se("<div>"),v=this._render("dropdown"),b=Se('<div role="listbox" tabindex="-1">'),_=this.input.getAttribute("class")||"",f=s.mode;var m;if(le(c,s.wrapperClass,_,f),le(h,s.controlClass),Qe(c,h),le(v,s.dropdownClass,f),s.copyClassesToDropdown&&le(v,_),le(b,s.dropdownContentClass),Qe(v,b),Se(s.dropdownParent||c).appendChild(v),Yi(s.controlInput)){m=Se(s.controlInput);var p=["autocorrect","autocapitalize","autocomplete","spellcheck"];$t(p,w=>{n.getAttribute(w)&&St(m,{[w]:n.getAttribute(w)})}),m.tabIndex=-1,h.appendChild(m),this.focus_node=m}else s.controlInput?(m=Se(s.controlInput),this.focus_node=m):(m=Se("<input/>"),this.focus_node=h);this.wrapper=c,this.dropdown=v,this.dropdown_content=b,this.control=h,this.control_input=m,this.setup()}setup(){const e=this,t=e.settings,r=e.control_input,n=e.dropdown,a=e.dropdown_content,s=e.wrapper,o=e.control,c=e.input,h=e.focus_node,v={passive:!0},b=e.inputId+"-ts-dropdown";St(a,{id:b}),St(h,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":b});const _=y0(h,e.inputId+"-ts-control"),f="label[for='"+Sl(e.inputId)+"']",m=document.querySelector(f),p=e.focus.bind(e);if(m){Zt(m,"click",p),St(m,{for:_});const y=y0(m,e.inputId+"-ts-label");St(h,{"aria-labelledby":y}),St(a,{"aria-labelledby":y})}if(s.style.width=c.style.width,e.plugins.names.length){const y="plugin-"+e.plugins.names.join(" plugin-");le([s,n],y)}(t.maxItems===null||t.maxItems>1)&&e.is_select_tag&&St(c,{multiple:"multiple"}),t.placeholder&&St(r,{placeholder:t.placeholder}),!t.splitOn&&t.delimiter&&(t.splitOn=new RegExp("\\s*"+Yr(t.delimiter)+"+\\s*")),t.load&&t.loadThrottle&&(t.load=xl(t.load,t.loadThrottle)),Zt(n,"mousemove",()=>{e.ignoreHover=!1}),Zt(n,"mouseenter",y=>{var E=x0(y.target,"[data-selectable]",n);E&&e.onOptionHover(y,E)},{capture:!0}),Zt(n,"click",y=>{const E=x0(y.target,"[data-selectable]");E&&(e.onOptionSelect(y,E),Ft(y,!0))}),Zt(o,"click",y=>{var E=x0(y.target,"[data-ts-item]",o);if(E&&e.onItemSelect(y,E)){Ft(y,!0);return}r.value==""&&(e.onClick(),Ft(y,!0))}),Zt(h,"keydown",y=>e.onKeyDown(y)),Zt(r,"keypress",y=>e.onKeyPress(y)),Zt(r,"input",y=>e.onInput(y)),Zt(h,"blur",y=>e.onBlur(y)),Zt(h,"focus",y=>e.onFocus(y)),Zt(r,"paste",y=>e.onPaste(y));const w=y=>{const E=y.composedPath()[0];if(!s.contains(E)&&!n.contains(E)){e.isFocused&&e.blur(),e.inputState();return}E==r&&e.isOpen?y.stopPropagation():Ft(y,!0)},g=()=>{e.isOpen&&e.positionDropdown()};Zt(document,"mousedown",w),Zt(window,"scroll",g,v),Zt(window,"resize",g,v),this._destroy=()=>{document.removeEventListener("mousedown",w),window.removeEventListener("scroll",g),window.removeEventListener("resize",g),m&&m.removeEventListener("click",p)},this.revertSettings={innerHTML:c.innerHTML,tabIndex:c.tabIndex},c.tabIndex=-1,c.insertAdjacentElement("afterend",e.wrapper),e.sync(!1),t.items=[],delete t.optgroups,delete t.options,Zt(c,"invalid",()=>{e.isValid&&(e.isValid=!1,e.isInvalid=!0,e.refreshState())}),e.updateOriginalInput(),e.refreshItems(),e.close(!1),e.inputState(),e.isSetup=!0,c.disabled?e.disable():c.readOnly?e.setReadOnly(!0):e.enable(),e.on("change",this.onChange),le(c,"tomselected","ts-hidden-accessible"),e.trigger("initialize"),t.preload===!0&&e.preload()}setupOptions(e=[],t=[]){this.addOptions(e),$t(t,r=>{this.registerOptionGroup(r)})}setupTemplates(){var e=this,t=e.settings.labelField,r=e.settings.optgroupLabelField,n={optgroup:a=>{let s=document.createElement("div");return s.className="optgroup",s.appendChild(a.options),s},optgroup_header:(a,s)=>'<div class="optgroup-header">'+s(a[r])+"</div>",option:(a,s)=>"<div>"+s(a[t])+"</div>",item:(a,s)=>"<div>"+s(a[t])+"</div>",option_create:(a,s)=>'<div class="create">Add <strong>'+s(a.input)+"</strong>…</div>",no_results:()=>'<div class="no-results">No results found</div>',loading:()=>'<div class="spinner"></div>',not_loading:()=>{},dropdown:()=>"<div></div>"};e.settings.render=Object.assign({},n,e.settings.render)}setupCallbacks(){var e,t,r={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",item_select:"onItemSelect",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(e in r)t=this.settings[r[e]],t&&this.on(e,t)}sync(e=!0){const t=this,r=e?Ji(t.input,{delimiter:t.settings.delimiter}):t.settings;t.setupOptions(r.options,r.optgroups),t.setValue(r.items||[],!0),t.lastQuery=null}onClick(){var e=this;if(e.activeItems.length>0){e.clearActiveItems(),e.focus();return}e.isFocused&&e.isOpen?e.blur():e.focus()}onMouseDown(){}onChange(){_0(this.input,"input"),_0(this.input,"change")}onPaste(e){var t=this;if(t.isInputHidden||t.isLocked){Ft(e);return}t.settings.splitOn&&setTimeout(()=>{var r=t.inputValue();if(r.match(t.settings.splitOn)){var n=r.trim().split(t.settings.splitOn);$t(n,a=>{ve(a)&&(this.options[a]?t.addItem(a):t.createItem(a))})}},0)}onKeyPress(e){var t=this;if(t.isLocked){Ft(e);return}var r=String.fromCharCode(e.keyCode||e.which);if(t.settings.create&&t.settings.mode==="multi"&&r===t.settings.delimiter){t.createItem(),Ft(e);return}}onKeyDown(e){var t=this;if(t.ignoreHover=!0,t.isLocked){e.keyCode!==Zi&&Ft(e);return}switch(e.keyCode){case Dl:if(Je(kn,e)&&t.control_input.value==""){Ft(e),t.selectAll();return}break;case Fl:t.isOpen&&(Ft(e,!0),t.close()),t.clearActiveItems();return;case zl:if(!t.isOpen&&t.hasOptions)t.open();else if(t.activeOption){let r=t.getAdjacent(t.activeOption,1);r&&t.setActiveOption(r)}Ft(e);return;case Cl:if(t.activeOption){let r=t.getAdjacent(t.activeOption,-1);r&&t.setActiveOption(r)}Ft(e);return;case Tl:t.canSelect(t.activeOption)?(t.onOptionSelect(e,t.activeOption),Ft(e)):(t.settings.create&&t.createItem()||document.activeElement==t.control_input&&t.isOpen)&&Ft(e);return;case Ol:t.advanceSelection(-1,e);return;case Il:t.advanceSelection(1,e);return;case Zi:t.settings.selectOnTab&&(t.canSelect(t.activeOption)&&(t.onOptionSelect(e,t.activeOption),Ft(e)),t.settings.create&&t.createItem()&&Ft(e));return;case Xi:case Rl:t.deleteSelection(e);return}t.isInputHidden&&!Je(kn,e)&&Ft(e)}onInput(e){if(this.isLocked)return;const t=this.inputValue();if(this.lastValue!==t){if(this.lastValue=t,t==""){this._onInput();return}this.refreshTimeout&&window.clearTimeout(this.refreshTimeout),this.refreshTimeout=_l(()=>{this.refreshTimeout=null,this._onInput()},this.settings.refreshThrottle)}}_onInput(){const e=this.lastValue;this.settings.shouldLoad.call(this,e)&&this.load(e),this.refreshOptions(),this.trigger("type",e)}onOptionHover(e,t){this.ignoreHover||this.setActiveOption(t,!1)}onFocus(e){var t=this,r=t.isFocused;if(t.isDisabled||t.isReadOnly){t.blur(),Ft(e);return}t.ignoreFocus||(t.isFocused=!0,t.settings.preload==="focus"&&t.preload(),r||t.trigger("focus"),t.activeItems.length||(t.inputState(),t.refreshOptions(!!t.settings.openOnFocus)),t.refreshState())}onBlur(e){if(document.hasFocus()!==!1){var t=this;if(t.isFocused){t.isFocused=!1,t.ignoreFocus=!1;var r=()=>{t.close(),t.setActiveItem(),t.setCaret(t.items.length),t.trigger("blur")};t.settings.create&&t.settings.createOnBlur?t.createItem(null,r):r()}}}onOptionSelect(e,t){var r,n=this;t.parentElement&&t.parentElement.matches("[data-disabled]")||(t.classList.contains("create")?n.createItem(null,()=>{n.settings.closeAfterSelect&&n.close()}):(r=t.dataset.value,typeof r<"u"&&(n.lastQuery=null,n.addItem(r),n.settings.closeAfterSelect&&n.close(),!n.settings.hideSelected&&e.type&&/click/.test(e.type)&&n.setActiveOption(t))))}canSelect(e){return!!(this.isOpen&&e&&this.dropdown_content.contains(e))}onItemSelect(e,t){var r=this;return!r.isLocked&&r.settings.mode==="multi"?(Ft(e),r.setActiveItem(t,e),!0):!1}canLoad(e){return!(!this.settings.load||this.loadedSearches.hasOwnProperty(e))}load(e){const t=this;if(!t.canLoad(e))return;le(t.wrapper,t.settings.loadingClass),t.loading++;const r=t.loadCallback.bind(t);t.settings.load.call(t,e,r)}loadCallback(e,t){const r=this;r.loading=Math.max(r.loading-1,0),r.lastQuery=null,r.clearActiveOption(),r.setupOptions(e,t),r.refreshOptions(r.isFocused&&!r.isInputHidden),r.loading||Be(r.wrapper,r.settings.loadingClass),r.trigger("load",e,t)}preload(){var e=this.wrapper.classList;e.contains("preloaded")||(e.add("preloaded"),this.load(""))}setTextboxValue(e=""){var t=this.control_input,r=t.value!==e;r&&(t.value=e,_0(t,"update"),this.lastValue=e)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(e,t){var r=t?[]:["change"];Ui(this,r,()=>{this.clear(t),this.addItems(e,t)})}setMaxItems(e){e===0&&(e=null),this.settings.maxItems=e,this.refreshState()}setActiveItem(e,t){var r=this,n,a,s,o,c,h;if(r.settings.mode!=="single"){if(!e){r.clearActiveItems(),r.isFocused&&r.inputState();return}if(n=t&&t.type.toLowerCase(),n==="click"&&Je("shiftKey",t)&&r.activeItems.length){for(h=r.getLastActive(),s=Array.prototype.indexOf.call(r.control.children,h),o=Array.prototype.indexOf.call(r.control.children,e),s>o&&(c=s,s=o,o=c),a=s;a<=o;a++)e=r.control.children[a],r.activeItems.indexOf(e)===-1&&r.setActiveItemClass(e);Ft(t)}else n==="click"&&Je(kn,t)||n==="keydown"&&Je("shiftKey",t)?e.classList.contains("active")?r.removeActiveItem(e):r.setActiveItemClass(e):(r.clearActiveItems(),r.setActiveItemClass(e));r.inputState(),r.isFocused||r.focus()}}setActiveItemClass(e){const t=this,r=t.control.querySelector(".last-active");r&&Be(r,"last-active"),le(e,"active last-active"),t.trigger("item_select",e),t.activeItems.indexOf(e)==-1&&t.activeItems.push(e)}removeActiveItem(e){var t=this.activeItems.indexOf(e);this.activeItems.splice(t,1),Be(e,"active")}clearActiveItems(){Be(this.activeItems,"active"),this.activeItems=[]}setActiveOption(e,t=!0){e!==this.activeOption&&(this.clearActiveOption(),e&&(this.activeOption=e,St(this.focus_node,{"aria-activedescendant":e.getAttribute("id")}),St(e,{"aria-selected":"true"}),le(e,"active"),t&&this.scrollToOption(e)))}scrollToOption(e,t){if(!e)return;const r=this.dropdown_content,n=r.clientHeight,a=r.scrollTop||0,s=e.offsetHeight,o=e.getBoundingClientRect().top-r.getBoundingClientRect().top+a;o+s>n+a?this.scroll(o-n+s,t):o<a&&this.scroll(o,t)}scroll(e,t){const r=this.dropdown_content;t&&(r.style.scrollBehavior=t),r.scrollTop=e,r.style.scrollBehavior=""}clearActiveOption(){this.activeOption&&(Be(this.activeOption,"active"),St(this.activeOption,{"aria-selected":null})),this.activeOption=null,St(this.focus_node,{"aria-activedescendant":null})}selectAll(){const e=this;if(e.settings.mode==="single")return;const t=e.controlChildren();t.length&&(e.inputState(),e.close(),e.activeItems=t,$t(t,r=>{e.setActiveItemClass(r)}))}inputState(){var e=this;e.control.contains(e.control_input)&&(St(e.control_input,{placeholder:e.settings.placeholder}),e.activeItems.length>0||!e.isFocused&&e.settings.hidePlaceholder&&e.items.length>0?(e.setTextboxValue(),e.isInputHidden=!0):(e.settings.hidePlaceholder&&e.items.length>0&&St(e.control_input,{placeholder:""}),e.isInputHidden=!1),e.wrapper.classList.toggle("input-hidden",e.isInputHidden))}inputValue(){return this.control_input.value.trim()}focus(){var e=this;e.isDisabled||e.isReadOnly||(e.ignoreFocus=!0,e.control_input.offsetWidth?e.control_input.focus():e.focus_node.focus(),setTimeout(()=>{e.ignoreFocus=!1,e.onFocus()},0))}blur(){this.focus_node.blur(),this.onBlur()}getScoreFunction(e){return this.sifter.getScoreFunction(e,this.getSearchOptions())}getSearchOptions(){var e=this.settings,t=e.sortField;return typeof e.sortField=="string"&&(t=[{field:e.sortField}]),{fields:e.searchField,conjunction:e.searchConjunction,sort:t,nesting:e.nesting}}search(e){var t,r,n=this,a=this.getSearchOptions();if(n.settings.score&&(r=n.settings.score.call(n,e),typeof r!="function"))throw new Error('Tom Select "score" setting must be a function that returns a function');return e!==n.lastQuery?(n.lastQuery=e,t=n.sifter.search(e,Object.assign(a,{score:r})),n.currentResults=t):t=Object.assign({},n.currentResults),n.settings.hideSelected&&(t.items=t.items.filter(s=>{let o=ve(s.id);return!(o&&n.items.indexOf(o)!==-1)})),t}refreshOptions(e=!0){var t,r,n,a,s,o,c,h,v,b;const _={},f=[];var m=this,p=m.inputValue();const w=p===m.lastQuery||p==""&&m.lastQuery==null;var g=m.search(p),y=null,E=m.settings.shouldOpen||!1,A=m.dropdown_content;w&&(y=m.activeOption,y&&(v=y.closest("[data-group]"))),a=g.items.length,typeof m.settings.maxOptions=="number"&&(a=Math.min(a,m.settings.maxOptions)),a>0&&(E=!0);const T=(O,P)=>{let F=_[O];if(F!==void 0){let G=f[F];if(G!==void 0)return[F,G.fragment]}let V=document.createDocumentFragment();return F=f.length,f.push({fragment:V,order:P,optgroup:O}),[F,V]};for(t=0;t<a;t++){let O=g.items[t];if(!O)continue;let P=O.id,F=m.options[P];if(F===void 0)continue;let V=_n(P),G=m.getOption(V,!0);for(m.settings.hideSelected||G.classList.toggle("selected",m.items.includes(V)),s=F[m.settings.optgroupField]||"",o=Array.isArray(s)?s:[s],r=0,n=o&&o.length;r<n;r++){s=o[r];let S=F.$order,N=m.optgroups[s];N===void 0?s="":S=N.$order;const[u,j]=T(s,S);r>0&&(G=G.cloneNode(!0),St(G,{id:F.$id+"-clone-"+r,"aria-selected":null}),G.classList.add("ts-cloned"),Be(G,"active"),m.activeOption&&m.activeOption.dataset.value==P&&v&&v.dataset.group===s.toString()&&(y=G)),j.appendChild(G),s!=""&&(_[s]=u)}}m.settings.lockOptgroupOrder&&f.sort((O,P)=>O.order-P.order),c=document.createDocumentFragment(),$t(f,O=>{let P=O.fragment,F=O.optgroup;if(!P||!P.children.length)return;let V=m.optgroups[F];if(V!==void 0){let G=document.createDocumentFragment(),S=m.render("optgroup_header",V);Qe(G,S),Qe(G,P);let N=m.render("optgroup",{group:V,options:G});Qe(c,N)}else Qe(c,P)}),A.innerHTML="",Qe(A,c),m.settings.highlight&&(Al(A),g.query.length&&g.tokens.length&&$t(g.tokens,O=>{Ll(A,O.regex)}));var U=O=>{let P=m.render(O,{input:p});return P&&(E=!0,A.insertBefore(P,A.firstChild)),P};if(m.loading?U("loading"):m.settings.shouldLoad.call(m,p)?g.items.length===0&&U("no_results"):U("not_loading"),h=m.canCreate(p),h&&(b=U("option_create")),m.hasOptions=g.items.length>0||h,E){if(g.items.length>0){if(!y&&m.settings.mode==="single"&&m.items[0]!=null&&(y=m.getOption(m.items[0])),!A.contains(y)){let O=0;b&&!m.settings.addPrecedence&&(O=1),y=m.selectable()[O]}}else b&&(y=b);e&&!m.isOpen&&(m.open(),m.scrollToOption(y,"auto")),m.setActiveOption(y)}else m.clearActiveOption(),e&&m.isOpen&&m.close(!1)}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(e,t=!1){const r=this;if(Array.isArray(e))return r.addOptions(e,t),!1;const n=ve(e[r.settings.valueField]);return n===null||r.options.hasOwnProperty(n)?!1:(e.$order=e.$order||++r.order,e.$id=r.inputId+"-opt-"+e.$order,r.options[n]=e,r.lastQuery=null,t&&(r.userOptions[n]=t,r.trigger("option_add",n,e)),n)}addOptions(e,t=!1){$t(e,r=>{this.addOption(r,t)})}registerOption(e){return this.addOption(e)}registerOptionGroup(e){var t=ve(e[this.settings.optgroupValueField]);return t===null?!1:(e.$order=e.$order||++this.order,this.optgroups[t]=e,t)}addOptionGroup(e,t){var r;t[this.settings.optgroupValueField]=e,(r=this.registerOptionGroup(t))&&this.trigger("optgroup_add",r,t)}removeOptionGroup(e){this.optgroups.hasOwnProperty(e)&&(delete this.optgroups[e],this.clearCache(),this.trigger("optgroup_remove",e))}clearOptionGroups(){this.optgroups={},this.clearCache(),this.trigger("optgroup_clear")}updateOption(e,t){const r=this;var n,a;const s=ve(e),o=ve(t[r.settings.valueField]);if(s===null)return;const c=r.options[s];if(c==null)return;if(typeof o!="string")throw new Error("Value must be set in option data");const h=r.getOption(s),v=r.getItem(s);if(t.$order=t.$order||c.$order,delete r.options[s],r.uncacheValue(o),r.options[o]=t,h){if(r.dropdown_content.contains(h)){const b=r._render("option",t);k0(h,b),r.activeOption===h&&r.setActiveOption(b)}h.remove()}v&&(a=r.items.indexOf(s),a!==-1&&r.items.splice(a,1,o),n=r._render("item",t),v.classList.contains("active")&&le(n,"active"),k0(v,n)),r.lastQuery=null}removeOption(e,t){const r=this;e=_n(e),r.uncacheValue(e),delete r.userOptions[e],delete r.options[e],r.lastQuery=null,r.trigger("option_remove",e),r.removeItem(e,t)}clearOptions(e){const t=(e||this.clearFilter).bind(this);this.loadedSearches={},this.userOptions={},this.clearCache();const r={};$t(this.options,(n,a)=>{t(n,a)&&(r[a]=n)}),this.options=this.sifter.items=r,this.lastQuery=null,this.trigger("option_clear")}clearFilter(e,t){return this.items.indexOf(t)>=0}getOption(e,t=!1){const r=ve(e);if(r===null)return null;const n=this.options[r];if(n!=null){if(n.$div)return n.$div;if(t)return this._render("option",n)}return null}getAdjacent(e,t,r="option"){var n=this,a;if(!e)return null;r=="item"?a=n.controlChildren():a=n.dropdown_content.querySelectorAll("[data-selectable]");for(let s=0;s<a.length;s++)if(a[s]==e)return t>0?a[s+1]:a[s-1];return null}getItem(e){if(typeof e=="object")return e;var t=ve(e);return t!==null?this.control.querySelector(`[data-value="${ji(t)}"]`):null}addItems(e,t){var r=this,n=Array.isArray(e)?e:[e];n=n.filter(s=>r.items.indexOf(s)===-1);const a=n[n.length-1];n.forEach(s=>{r.isPending=s!==a,r.addItem(s,t)})}addItem(e,t){var r=t?[]:["change","dropdown_close"];Ui(this,r,()=>{var n,a;const s=this,o=s.settings.mode,c=ve(e);if(!(c&&s.items.indexOf(c)!==-1&&(o==="single"&&s.close(),o==="single"||!s.settings.duplicates))&&!(c===null||!s.options.hasOwnProperty(c))&&(o==="single"&&s.clear(t),!(o==="multi"&&s.isFull()))){if(n=s._render("item",s.options[c]),s.control.contains(n)&&(n=n.cloneNode(!0)),a=s.isFull(),s.items.splice(s.caretPos,0,c),s.insertAtCaret(n),s.isSetup){if(!s.isPending&&s.settings.hideSelected){let h=s.getOption(c),v=s.getAdjacent(h,1);v&&s.setActiveOption(v)}!s.isPending&&!s.settings.closeAfterSelect&&s.refreshOptions(s.isFocused&&o!=="single"),s.settings.closeAfterSelect!=!1&&s.isFull()?s.close():s.isPending||s.positionDropdown(),s.trigger("item_add",c,n),s.isPending||s.updateOriginalInput({silent:t})}(!s.isPending||!a&&s.isFull())&&(s.inputState(),s.refreshState())}})}removeItem(e=null,t){const r=this;if(e=r.getItem(e),!e)return;var n,a;const s=e.dataset.value;n=Gi(e),e.remove(),e.classList.contains("active")&&(a=r.activeItems.indexOf(e),r.activeItems.splice(a,1),Be(e,"active")),r.items.splice(n,1),r.lastQuery=null,!r.settings.persist&&r.userOptions.hasOwnProperty(s)&&r.removeOption(s,t),n<r.caretPos&&r.setCaret(r.caretPos-1),r.updateOriginalInput({silent:t}),r.refreshState(),r.positionDropdown(),r.trigger("item_remove",s,e)}createItem(e=null,t=()=>{}){arguments.length===3&&(t=arguments[2]),typeof t!="function"&&(t=()=>{});var r=this,n=r.caretPos,a;if(e=e||r.inputValue(),!r.canCreate(e))return t(),!1;r.lock();var s=!1,o=c=>{if(r.unlock(),!c||typeof c!="object")return t();var h=ve(c[r.settings.valueField]);if(typeof h!="string")return t();r.setTextboxValue(),r.addOption(c,!0),r.setCaret(n),r.addItem(h),t(c),s=!0};return typeof r.settings.create=="function"?a=r.settings.create.call(this,e,o):a={[r.settings.labelField]:e,[r.settings.valueField]:e},s||o(a),!0}refreshItems(){var e=this;e.lastQuery=null,e.isSetup&&e.addItems(e.items),e.updateOriginalInput(),e.refreshState()}refreshState(){const e=this;e.refreshValidityState();const t=e.isFull(),r=e.isLocked;e.wrapper.classList.toggle("rtl",e.rtl);const n=e.wrapper.classList;n.toggle("focus",e.isFocused),n.toggle("disabled",e.isDisabled),n.toggle("readonly",e.isReadOnly),n.toggle("required",e.isRequired),n.toggle("invalid",!e.isValid),n.toggle("locked",r),n.toggle("full",t),n.toggle("input-active",e.isFocused&&!e.isInputHidden),n.toggle("dropdown-active",e.isOpen),n.toggle("has-options",El(e.options)),n.toggle("has-items",e.items.length>0)}refreshValidityState(){var e=this;e.input.validity&&(e.isValid=e.input.validity.valid,e.isInvalid=!e.isValid)}isFull(){return this.settings.maxItems!==null&&this.items.length>=this.settings.maxItems}updateOriginalInput(e={}){const t=this;var r,n;const a=t.input.querySelector('option[value=""]');if(t.is_select_tag){let c=function(h,v,b){return h||(h=Se('<option value="'+w0(v)+'">'+w0(b)+"</option>")),h!=a&&t.input.append(h),s.push(h),(h!=a||o>0)&&(h.selected=!0),h};const s=[],o=t.input.querySelectorAll("option:checked").length;t.input.querySelectorAll("option:checked").forEach(h=>{h.selected=!1}),t.items.length==0&&t.settings.mode=="single"?c(a,"",""):t.items.forEach(h=>{if(r=t.options[h],n=r[t.settings.labelField]||"",s.includes(r.$option)){const v=t.input.querySelector(`option[value="${ji(h)}"]:not(:checked)`);c(v,h,n)}else r.$option=c(r.$option,h,n)})}else t.input.value=t.getValue();t.isSetup&&(e.silent||t.trigger("change",t.getValue()))}open(){var e=this;e.isLocked||e.isOpen||e.settings.mode==="multi"&&e.isFull()||(e.isOpen=!0,St(e.focus_node,{"aria-expanded":"true"}),e.refreshState(),xn(e.dropdown,{visibility:"hidden",display:"block"}),e.positionDropdown(),xn(e.dropdown,{visibility:"visible",display:"block"}),e.focus(),e.trigger("dropdown_open",e.dropdown))}close(e=!0){var t=this,r=t.isOpen;e&&(t.setTextboxValue(),t.settings.mode==="single"&&t.items.length&&t.inputState()),t.isOpen=!1,St(t.focus_node,{"aria-expanded":"false"}),xn(t.dropdown,{display:"none"}),t.settings.hideSelected&&t.clearActiveOption(),t.refreshState(),r&&t.trigger("dropdown_close",t.dropdown)}positionDropdown(){if(this.settings.dropdownParent==="body"){var e=this.control,t=e.getBoundingClientRect(),r=e.offsetHeight+t.top+window.scrollY,n=t.left+window.scrollX;xn(this.dropdown,{width:t.width+"px",top:r+"px",left:n+"px"})}}clear(e){var t=this;if(t.items.length){var r=t.controlChildren();$t(r,n=>{t.removeItem(n,!0)}),t.inputState(),e||t.updateOriginalInput(),t.trigger("clear")}}insertAtCaret(e){const t=this,r=t.caretPos,n=t.control;n.insertBefore(e,n.children[r]||null),t.setCaret(r+1)}deleteSelection(e){var t,r,n,a,s=this;t=e&&e.keyCode===Xi?-1:1,r=kl(s.control_input);const o=[];if(s.activeItems.length)a=Wi(s.activeItems,t),n=Gi(a),t>0&&n++,$t(s.activeItems,c=>o.push(c));else if((s.isFocused||s.settings.mode==="single")&&s.items.length){const c=s.controlChildren();let h;t<0&&r.start===0&&r.length===0?h=c[s.caretPos-1]:t>0&&r.start===s.inputValue().length&&(h=c[s.caretPos]),h!==void 0&&o.push(h)}if(!s.shouldDelete(o,e))return!1;for(Ft(e,!0),typeof n<"u"&&s.setCaret(n);o.length;)s.removeItem(o.pop());return s.inputState(),s.positionDropdown(),s.refreshOptions(!1),!0}shouldDelete(e,t){const r=e.map(n=>n.dataset.value);return!(!r.length||typeof this.settings.onDelete=="function"&&this.settings.onDelete(r,t)===!1)}advanceSelection(e,t){var r,n,a=this;a.rtl&&(e*=-1),!a.inputValue().length&&(Je(kn,t)||Je("shiftKey",t)?(r=a.getLastActive(e),r?r.classList.contains("active")?n=a.getAdjacent(r,e,"item"):n=r:e>0?n=a.control_input.nextElementSibling:n=a.control_input.previousElementSibling,n&&(n.classList.contains("active")&&a.removeActiveItem(r),a.setActiveItemClass(n))):a.moveCaret(e))}moveCaret(e){}getLastActive(e){let t=this.control.querySelector(".last-active");if(t)return t;var r=this.control.querySelectorAll(".active");if(r)return Wi(r,e)}setCaret(e){this.caretPos=this.items.length}controlChildren(){return Array.from(this.control.querySelectorAll("[data-ts-item]"))}lock(){this.setLocked(!0)}unlock(){this.setLocked(!1)}setLocked(e=this.isReadOnly||this.isDisabled){this.isLocked=e,this.refreshState()}disable(){this.setDisabled(!0),this.close()}enable(){this.setDisabled(!1)}setDisabled(e){this.focus_node.tabIndex=e?-1:this.tabIndex,this.isDisabled=e,this.input.disabled=e,this.control_input.disabled=e,this.setLocked()}setReadOnly(e){this.isReadOnly=e,this.input.readOnly=e,this.control_input.readOnly=e,this.setLocked()}destroy(){var e=this,t=e.revertSettings;e.trigger("destroy"),e.off(),e.wrapper.remove(),e.dropdown.remove(),e.input.innerHTML=t.innerHTML,e.input.tabIndex=t.tabIndex,Be(e.input,"tomselected","ts-hidden-accessible"),e._destroy(),delete e.input.tomselect}render(e,t){var r,n;const a=this;if(typeof this.settings.render[e]!="function"||(n=a.settings.render[e].call(this,t,w0),!n))return null;if(n=Se(n),e==="option"||e==="option_create"?t[a.settings.disabledField]?St(n,{"aria-disabled":"true"}):St(n,{"data-selectable":""}):e==="optgroup"&&(r=t.group[a.settings.optgroupValueField],St(n,{"data-group":r}),t.group[a.settings.disabledField]&&St(n,{"data-disabled":""})),e==="option"||e==="item"){const s=_n(t[a.settings.valueField]);St(n,{"data-value":s}),e==="item"?(le(n,a.settings.itemClass),St(n,{"data-ts-item":""})):(le(n,a.settings.optionClass),St(n,{role:"option",id:t.$id}),t.$div=n,a.options[s]=t)}return n}_render(e,t){const r=this.render(e,t);if(r==null)throw"HTMLElement expected";return r}clearCache(){$t(this.options,e=>{e.$div&&(e.$div.remove(),delete e.$div)})}uncacheValue(e){const t=this.getOption(e);t&&t.remove()}canCreate(e){return this.settings.create&&e.length>0&&this.settings.createFilter.call(this,e)}hook(e,t,r){var n=this,a=n[t];n[t]=function(){var s,o;return e==="after"&&(s=a.apply(n,arguments)),o=r.apply(n,arguments),e==="instead"?o:(e==="before"&&(s=a.apply(n,arguments)),s)}}}const Ml=(i,e,t,r)=>{i.addEventListener(e,t,r)};function Nl(){Ml(this.input,"change",()=>{this.sync()})}const Pl=i=>typeof i>"u"||i===null?null:$l(i),$l=i=>typeof i=="boolean"?i?"1":"0":i+"",ta=(i,e=!1)=>{i&&(i.preventDefault(),e&&i.stopPropagation())},Bl=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(Hl(i)){var e=document.createElement("template");return e.innerHTML=i.trim(),e.content.firstChild}return document.querySelector(i)},Hl=i=>typeof i=="string"&&i.indexOf("<")>-1;function Ul(i){var e=this,t=e.onOptionSelect;e.settings.hideSelected=!1;const r=Object.assign({className:"tomselect-checkbox",checkedClassNames:void 0,uncheckedClassNames:void 0},i);var n=function(o,c){c?(o.checked=!0,r.uncheckedClassNames&&o.classList.remove(...r.uncheckedClassNames),r.checkedClassNames&&o.classList.add(...r.checkedClassNames)):(o.checked=!1,r.checkedClassNames&&o.classList.remove(...r.checkedClassNames),r.uncheckedClassNames&&o.classList.add(...r.uncheckedClassNames))},a=function(o){setTimeout(()=>{var c=o.querySelector("input."+r.className);c instanceof HTMLInputElement&&n(c,o.classList.contains("selected"))},1)};e.hook("after","setupTemplates",()=>{var s=e.settings.render.option;e.settings.render.option=(o,c)=>{var h=Bl(s.call(e,o,c)),v=document.createElement("input");r.className&&v.classList.add(r.className),v.addEventListener("click",function(_){ta(_)}),v.type="checkbox";const b=Pl(o[e.settings.valueField]);return n(v,!!(b&&e.items.indexOf(b)>-1)),h.prepend(v),h}}),e.on("item_remove",s=>{var o=e.getOption(s);o&&(o.classList.remove("selected"),a(o))}),e.on("item_add",s=>{var o=e.getOption(s);o&&a(o)}),e.hook("instead","onOptionSelect",(s,o)=>{if(o.classList.contains("selected")){o.classList.remove("selected"),e.removeItem(o.dataset.value),e.refreshOptions(),ta(s,!0);return}t.call(e,s,o),a(o)})}const jl=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(Yl(i)){var e=document.createElement("template");return e.innerHTML=i.trim(),e.content.firstChild}return document.querySelector(i)},Yl=i=>typeof i=="string"&&i.indexOf("<")>-1;function Vl(i){const e=this,t=Object.assign({className:"clear-button",title:"Clear All",html:r=>`<div class="${r.className}" title="${r.title}">⨯</div>`},i);e.on("initialize",()=>{var r=jl(t.html(t));r.addEventListener("click",n=>{e.isLocked||(e.clear(),e.settings.mode==="single"&&e.settings.allowEmptyOption&&e.addItem(""),n.preventDefault(),n.stopPropagation())}),e.control.appendChild(r)})}const ql=(i,e=!1)=>{i&&(i.preventDefault(),e&&i.stopPropagation())},vr=(i,e,t,r)=>{i.addEventListener(e,t,r)},Wl=(i,e)=>{if(Array.isArray(i))i.forEach(e);else for(var t in i)i.hasOwnProperty(t)&&e(i[t],t)},Gl=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(Xl(i)){var e=document.createElement("template");return e.innerHTML=i.trim(),e.content.firstChild}return document.querySelector(i)},Xl=i=>typeof i=="string"&&i.indexOf("<")>-1,Zl=(i,e)=>{Wl(e,(t,r)=>{t==null?i.removeAttribute(r):i.setAttribute(r,""+t)})},Kl=(i,e)=>{var t;(t=i.parentNode)==null||t.insertBefore(e,i.nextSibling)},Jl=(i,e)=>{var t;(t=i.parentNode)==null||t.insertBefore(e,i)},Ql=(i,e)=>{do{var t;if(e=(t=e)==null?void 0:t.previousElementSibling,i==e)return!0}while(e&&e.previousElementSibling);return!1};function t1(){var i=this;if(i.settings.mode!=="multi")return;var e=i.lock,t=i.unlock;let r=!0,n;i.hook("after","setupTemplates",()=>{var a=i.settings.render.item;i.settings.render.item=(s,o)=>{const c=Gl(a.call(i,s,o));Zl(c,{draggable:"true"});const h=p=>{r||ql(p),p.stopPropagation()},v=p=>{n=c,setTimeout(()=>{c.classList.add("ts-dragging")},0)},b=p=>{p.preventDefault(),c.classList.add("ts-drag-over"),f(c,n)},_=()=>{c.classList.remove("ts-drag-over")},f=(p,w)=>{w!==void 0&&(Ql(w,c)?Kl(p,w):Jl(p,w))},m=()=>{var p;document.querySelectorAll(".ts-drag-over").forEach(g=>g.classList.remove("ts-drag-over")),(p=n)==null||p.classList.remove("ts-dragging"),n=void 0;var w=[];i.control.querySelectorAll("[data-value]").forEach(g=>{if(g.dataset.value){let y=g.dataset.value;y&&w.push(y)}}),i.setValue(w)};return vr(c,"mousedown",h),vr(c,"dragstart",v),vr(c,"dragenter",b),vr(c,"dragover",b),vr(c,"dragleave",_),vr(c,"dragend",m),c}}),i.hook("instead","lock",()=>(r=!1,e.call(i))),i.hook("instead","unlock",()=>(r=!0,t.call(i)))}const e1=(i,e=!1)=>{i&&(i.preventDefault(),e&&i.stopPropagation())},r1=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(n1(i)){var e=document.createElement("template");return e.innerHTML=i.trim(),e.content.firstChild}return document.querySelector(i)},n1=i=>typeof i=="string"&&i.indexOf("<")>-1;function i1(i){const e=this,t=Object.assign({title:"Untitled",headerClass:"dropdown-header",titleRowClass:"dropdown-header-title",labelClass:"dropdown-header-label",closeClass:"dropdown-header-close",html:r=>'<div class="'+r.headerClass+'"><div class="'+r.titleRowClass+'"><span class="'+r.labelClass+'">'+r.title+'</span><a class="'+r.closeClass+'">×</a></div></div>'},i);e.on("initialize",()=>{var r=r1(t.html(t)),n=r.querySelector("."+t.closeClass);n&&n.addEventListener("click",a=>{e1(a,!0),e.close()}),e.dropdown.insertBefore(r,e.dropdown.firstChild)})}const a1=(i,e)=>{if(Array.isArray(i))i.forEach(e);else for(var t in i)i.hasOwnProperty(t)&&e(i[t],t)},s1=(i,...e)=>{var t=o1(e);i=l1(i),i.map(r=>{t.map(n=>{r.classList.remove(n)})})},o1=i=>{var e=[];return a1(i,t=>{typeof t=="string"&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},l1=i=>(Array.isArray(i)||(i=[i]),i),c1=(i,e)=>{if(!i)return-1;e=e||i.nodeName;for(var t=0;i=i.previousElementSibling;)i.matches(e)&&t++;return t};function d1(){var i=this;i.hook("instead","setCaret",e=>{i.settings.mode==="single"||!i.control.contains(i.control_input)?e=i.items.length:(e=Math.max(0,Math.min(i.items.length,e)),e!=i.caretPos&&!i.isPending&&i.controlChildren().forEach((t,r)=>{r<e?i.control_input.insertAdjacentElement("beforebegin",t):i.control.appendChild(t)})),i.caretPos=e}),i.hook("instead","moveCaret",e=>{if(!i.isFocused)return;const t=i.getLastActive(e);if(t){const r=c1(t);i.setCaret(e>0?r+1:r),i.setActiveItem(),s1(t,"last-active")}else i.setCaret(i.caretPos+e)})}const u1=27,h1=9,p1=(i,e=!1)=>{i&&(i.preventDefault(),e&&i.stopPropagation())},f1=(i,e,t,r)=>{i.addEventListener(e,t,r)},m1=(i,e)=>{if(Array.isArray(i))i.forEach(e);else for(var t in i)i.hasOwnProperty(t)&&e(i[t],t)},ea=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(g1(i)){var e=document.createElement("template");return e.innerHTML=i.trim(),e.content.firstChild}return document.querySelector(i)},g1=i=>typeof i=="string"&&i.indexOf("<")>-1,b1=(i,...e)=>{var t=v1(e);i=w1(i),i.map(r=>{t.map(n=>{r.classList.add(n)})})},v1=i=>{var e=[];return m1(i,t=>{typeof t=="string"&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},w1=i=>(Array.isArray(i)||(i=[i]),i);function y1(){const i=this;i.settings.shouldOpen=!0,i.hook("before","setup",()=>{i.focus_node=i.control,b1(i.control_input,"dropdown-input");const e=ea('<div class="dropdown-input-wrap">');e.append(i.control_input),i.dropdown.insertBefore(e,i.dropdown.firstChild);const t=ea('<input class="items-placeholder" tabindex="-1" />');t.placeholder=i.settings.placeholder||"",i.control.append(t)}),i.on("initialize",()=>{i.control_input.addEventListener("keydown",t=>{switch(t.keyCode){case u1:i.isOpen&&(p1(t,!0),i.close()),i.clearActiveItems();return;case h1:i.focus_node.tabIndex=-1;break}return i.onKeyDown.call(i,t)}),i.on("blur",()=>{i.focus_node.tabIndex=i.isDisabled?-1:i.tabIndex}),i.on("dropdown_open",()=>{i.control_input.focus()});const e=i.onBlur;i.hook("instead","onBlur",t=>{if(!(t&&t.relatedTarget==i.control_input))return e.call(i)}),f1(i.control_input,"blur",()=>i.onBlur()),i.hook("before","close",()=>{i.isOpen&&i.focus_node.focus({preventScroll:!0})})})}const Sn=(i,e,t,r)=>{i.addEventListener(e,t,r)};function _1(){var i=this;i.on("initialize",()=>{var e=document.createElement("span"),t=i.control_input;e.style.cssText="position:absolute; top:-99999px; left:-99999px; width:auto; padding:0; white-space:pre; ",i.wrapper.appendChild(e);var r=["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"];for(const a of r)e.style[a]=t.style[a];var n=()=>{e.textContent=t.value,t.style.width=e.clientWidth+"px"};n(),i.on("update item_add item_remove",n),Sn(t,"input",n),Sn(t,"keyup",n),Sn(t,"blur",n),Sn(t,"update",n)})}function x1(){var i=this,e=i.deleteSelection;this.hook("instead","deleteSelection",t=>i.activeItems.length?e.call(i,t):!1)}function k1(){this.hook("instead","setActiveItem",()=>{}),this.hook("instead","selectAll",()=>{})}const ra=37,S1=39,E1=(i,e,t)=>{for(;i&&i.matches;){if(i.matches(e))return i;i=i.parentNode}},L1=(i,e)=>{if(!i)return-1;e=e||i.nodeName;for(var t=0;i=i.previousElementSibling;)i.matches(e)&&t++;return t};function A1(){var i=this,e=i.onKeyDown;i.hook("instead","onKeyDown",t=>{var r,n,a,s;if(!i.isOpen||!(t.keyCode===ra||t.keyCode===S1))return e.call(i,t);i.ignoreHover=!0,s=E1(i.activeOption,"[data-group]"),r=L1(i.activeOption,"[data-selectable]"),s&&(t.keyCode===ra?s=s.previousSibling:s=s.nextSibling,s&&(a=s.querySelectorAll("[data-selectable]"),n=a[Math.min(a.length-1,r)],n&&i.setActiveOption(n)))})}const D1=i=>(i+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),na=(i,e=!1)=>{i&&(i.preventDefault(),e&&i.stopPropagation())},ia=(i,e,t,r)=>{i.addEventListener(e,t,r)},aa=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(T1(i)){var e=document.createElement("template");return e.innerHTML=i.trim(),e.content.firstChild}return document.querySelector(i)},T1=i=>typeof i=="string"&&i.indexOf("<")>-1;function F1(i){const e=Object.assign({label:"×",title:"Remove",className:"remove",append:!0},i);var t=this;if(e.append){var r='<a href="javascript:void(0)" class="'+e.className+'" tabindex="-1" title="'+D1(e.title)+'">'+e.label+"</a>";t.hook("after","setupTemplates",()=>{var n=t.settings.render.item;t.settings.render.item=(a,s)=>{var o=aa(n.call(t,a,s)),c=aa(r);return o.appendChild(c),ia(c,"mousedown",h=>{na(h,!0)}),ia(c,"click",h=>{t.isLocked||(na(h,!0),!t.isLocked&&t.shouldDelete([o],h)&&(t.removeItem(o),t.refreshOptions(!1),t.inputState()))}),o}})}}function O1(i){const e=this,t=Object.assign({text:r=>r[e.settings.labelField]},i);e.on("item_remove",function(r){if(e.isFocused&&e.control_input.value.trim()===""){var n=e.options[r];n&&e.setTextboxValue(t.text.call(e,n))}})}const C1=(i,e)=>{if(Array.isArray(i))i.forEach(e);else for(var t in i)i.hasOwnProperty(t)&&e(i[t],t)},I1=(i,...e)=>{var t=z1(e);i=R1(i),i.map(r=>{t.map(n=>{r.classList.add(n)})})},z1=i=>{var e=[];return C1(i,t=>{typeof t=="string"&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},R1=i=>(Array.isArray(i)||(i=[i]),i);function M1(){const i=this,e=i.canLoad,t=i.clearActiveOption,r=i.loadCallback;var n={},a,s=!1,o,c=[];if(i.settings.shouldLoadMore||(i.settings.shouldLoadMore=()=>{if(a.clientHeight/(a.scrollHeight-a.scrollTop)>.9)return!0;if(i.activeOption){var _=i.selectable(),f=Array.from(_).indexOf(i.activeOption);if(f>=_.length-2)return!0}return!1}),!i.settings.firstUrl)throw"virtual_scroll plugin requires a firstUrl() method";i.settings.sortField=[{field:"$order"},{field:"$score"}];const h=b=>typeof i.settings.maxOptions=="number"&&a.children.length>=i.settings.maxOptions?!1:!!(b in n&&n[b]),v=(b,_)=>i.items.indexOf(_)>=0||c.indexOf(_)>=0;i.setNextUrl=(b,_)=>{n[b]=_},i.getUrl=b=>{if(b in n){const _=n[b];return n[b]=!1,_}return i.clearPagination(),i.settings.firstUrl.call(i,b)},i.clearPagination=()=>{n={}},i.hook("instead","clearActiveOption",()=>{if(!s)return t.call(i)}),i.hook("instead","canLoad",b=>b in n?h(b):e.call(i,b)),i.hook("instead","loadCallback",(b,_)=>{if(!s)i.clearOptions(v);else if(o){const f=b[0];f!==void 0&&(o.dataset.value=f[i.settings.valueField])}r.call(i,b,_),s=!1}),i.hook("after","refreshOptions",()=>{const b=i.lastValue;var _;h(b)?(_=i.render("loading_more",{query:b}),_&&(_.setAttribute("data-selectable",""),o=_)):b in n&&!a.querySelector(".no-results")&&(_=i.render("no_more_results",{query:b})),_&&(I1(_,i.settings.optionClass),a.append(_))}),i.on("initialize",()=>{c=Object.keys(i.options),a=i.dropdown_content,i.settings.render=Object.assign({},{loading_more:()=>'<div class="loading-more-results">Loading more results ... </div>',no_more_results:()=>'<div class="no-more-results">No more results</div>'},i.settings.render),a.addEventListener("scroll",()=>{i.settings.shouldLoadMore.call(i)&&h(i.lastValue)&&(s||(s=!0,i.load.call(i,i.lastValue)))})})}Kt.define("change_listener",Nl),Kt.define("checkbox_options",Ul),Kt.define("clear_button",Vl),Kt.define("drag_drop",t1),Kt.define("dropdown_header",i1),Kt.define("caret_position",d1),Kt.define("dropdown_input",y1),Kt.define("input_autogrow",_1),Kt.define("no_backspace_delete",x1),Kt.define("no_active_items",k1),Kt.define("optgroup_columns",A1),Kt.define("remove_button",F1),Kt.define("restore_on_backspace",O1),Kt.define("virtual_scroll",M1);const sa=`<div
|
|
1052
1052
|
inert
|
|
1053
1053
|
id="pdc-container"
|
|
1054
1054
|
class="group flex items-center justify-between px-3 transition-colors
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@per-diem-calculator/vanilla",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.35",
|
|
4
4
|
"author": "Ahmad Dowla <ahmad.dowla@gmail.com>",
|
|
5
5
|
"description": "Open source per diem calculator for both domestic and international trips. Built in TypeScript with Tailwind. Rates sourced from GSA, State Dept., and DOD.",
|
|
6
6
|
"license": "MIT",
|