UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

1 lines 24.3 kB
export const __rspack_esm_id=92769;export const __rspack_esm_ids=[92769];export const __webpack_modules__={78648(t,e,s){s.d(e,{A:()=>et});s(44114),s(18111),s(22489),s(7588),s(61701),s(33110),s(45367),s(92731),s(17642),s(58004),s(33853),s(45876),s(32475),s(15024),s(31698);function i(t){return Array.isArray?Array.isArray(t):"[object Array]"===l(t)}function n(t){return null==t?"":function(t){if("string"==typeof t)return t;if("bigint"==typeof t)return t.toString();const e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}function r(t){return"string"==typeof t}function c(t){return"number"==typeof t}function o(t){return!0===t||!1===t||function(t){return u(t)&&null!==t}(t)&&"[object Boolean]"==l(t)}function u(t){return"object"==typeof t}function h(t){return null!=t}function a(t){return!t.trim().length}function l(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const d=Object.prototype.hasOwnProperty;class g{get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach(t=>{const s=f(t);this._keys.push(s),this._keyMap[s.id]=s,e+=s.weight}),this._keys.forEach(t=>{t.weight/=e})}}function f(t){let e=null,s=null,n=null,c=1,o=null;if(r(t)||i(t))n=t,e=p(t),s=A(t);else{if(!d.call(t,"name"))throw new Error((t=>`Missing ${t} property in key`)("name"));const i=t.name;if(n=i,d.call(t,"weight")&&(c=t.weight,c<=0))throw new Error((t=>`Property 'weight' in key '${t}' must be a positive integer`)(i));e=p(i),s=A(i),o=t.getFn}return{path:e,id:s,weight:c,src:n,getFn:o}}function p(t){return i(t)?t:t.split(".")}function A(t){return i(t)?t.join("."):t}const m={useExtendedSearch:!1,useTokenSearch:!1,getFn:function(t,e){const s=[];let u=!1;const a=(t,e,l,d)=>{if(h(t))if(e[l]){const g=t[e[l]];if(!h(g))return;if(l===e.length-1&&(r(g)||c(g)||o(g)||"bigint"==typeof g))s.push(void 0!==d?{v:n(g),i:d}:n(g));else if(i(g)){u=!0;for(let t=0,s=g.length;t<s;t+=1)a(g[t],e,l+1,t)}else e.length&&a(g,e,l+1,d)}else s.push(void 0!==d?{v:t,i:d}:t)};return a(t,r(e)?e.split("."):e,0),u?s:s[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},C=Object.freeze({isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,...m}),M=/[^ ]+/g;class y{setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((t,e)=>{this._keysMap[t.id]=e})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,r(this.docs[0])?this.docs.forEach((t,e)=>{this._addString(t,e)}):this.docs.forEach((t,e)=>{this._addObject(t,e)}),this.norm.clear())}add(t){const e=this.size();r(t)?this._addString(t,e):this._addObject(t,e)}removeAt(t){this.records.splice(t,1);for(let e=t,s=this.size();e<s;e+=1)this.records[e].i-=1}removeAll(t){for(let e=t.length-1;e>=0;e-=1)this.records.splice(t[e],1);for(let t=0,e=this.records.length;t<e;t+=1)this.records[t].i=t}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_addString(t,e){if(!h(t)||a(t))return;const s={v:t,i:e,n:this.norm.get(t)};this.records.push(s)}_addObject(t,e){const s={i:e,$:{}};this.keys.forEach((e,c)=>{const o=e.getFn?e.getFn(t):this.getFn(t,e.path);if(h(o))if(i(o)){const t=[];for(let e=0,s=o.length;e<s;e+=1){const s=o[e];if(h(s))if(r(s)){if(!a(s)){const i={v:s,i:e,n:this.norm.get(s)};t.push(i)}}else if(h(s.v)){const e=r(s.v)?s.v:n(s.v);if(!a(e)){const i={v:e,i:s.i,n:this.norm.get(e)};t.push(i)}}}s.$[c]=t}else if(r(o)&&!a(o)){const t={v:o,n:this.norm.get(o)};s.$[c]=t}}),this.records.push(s)}toJSON(){return{keys:this.keys.map(({getFn:t,...e})=>e),records:this.records}}constructor({getFn:t=C.getFn,fieldNormWeight:e=C.fieldNormWeight}={}){this.norm=function(t=1,e=3){const s=new Map,i=Math.pow(10,e);return{get(e){const n=e.match(M).length;if(s.has(n))return s.get(n);const r=1/Math.pow(n,.5*t),c=parseFloat(Math.round(r*i)/i);return s.set(n,c),c},clear(){s.clear()}}}(e,3),this.getFn=t,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}}function x(t,e,{getFn:s=C.getFn,fieldNormWeight:i=C.fieldNormWeight}={}){const n=new y({getFn:s,fieldNormWeight:i});return n.setKeys(t.map(f)),n.setSources(e),n.create(),n}const F=32;function _(t,e,s,{location:i=C.location,distance:n=C.distance,threshold:r=C.threshold,findAllMatches:c=C.findAllMatches,minMatchCharLength:o=C.minMatchCharLength,includeMatches:u=C.includeMatches,ignoreLocation:h=C.ignoreLocation}={}){if(e.length>F)throw new Error(`Pattern length exceeds max of ${F}.`);const a=e.length,l=t.length,d=Math.max(0,Math.min(i,l));let g=r,f=d;const p=(t,e)=>{const s=t/a;if(h)return s;const i=Math.abs(d-e);return n?s+i/n:i?1:s},A=o>1||u,m=A?Array(l):[];let M;for(;(M=t.indexOf(e,f))>-1;){const t=p(0,M);if(g=Math.min(t,g),f=M+a,A){let t=0;for(;t<a;)m[M+t]=1,t+=1}}f=-1;let y=[],x=1,_=a+l;const D=1<<a-1;for(let e=0;e<a;e+=1){let i=0,n=_;for(;i<n;){p(e,d+n)<=g?i=n:_=n,n=Math.floor((_-i)/2+i)}_=n;let r=Math.max(1,d-n+1);const o=c?l:Math.min(d+n,l)+a,u=Array(o+2);u[o+1]=(1<<e)-1;for(let i=o;i>=r;i-=1){const n=i-1,c=s[t[n]];if(A&&(m[n]=+!!c),u[i]=(u[i+1]<<1|1)&c,e&&(u[i]|=(y[i+1]|y[i])<<1|1|y[i+1]),u[i]&D&&(x=p(e,n),x<=g)){if(g=x,f=n,f<=d)break;r=Math.max(1,2*d-f)}}if(p(e+1,d)>g)break;y=u}const E={isMatch:f>=0,score:Math.max(.001,x)};if(A){const t=function(t=[],e=C.minMatchCharLength){const s=[];let i=-1,n=-1,r=0;for(let c=t.length;r<c;r+=1){const c=t[r];c&&-1===i?i=r:c||-1===i||(n=r-1,n-i+1>=e&&s.push([i,n]),i=-1)}return t[r-1]&&r-i>=e&&s.push([i,r-1]),s}(m,o);t.length?u&&(E.indices=t):E.isMatch=!1}return E}function D(t){const e={};for(let s=0,i=t.length;s<i;s+=1){const n=t.charAt(s);e[n]=(e[n]||0)|1<<i-s-1}return e}function E(t){if(t.length<=1)return t;t.sort((t,e)=>t[0]-e[0]||t[1]-e[1]);const e=[t[0]];for(let s=1,i=t.length;s<i;s+=1){const i=e[e.length-1],n=t[s];n[0]<=i[1]+1?i[1]=Math.max(i[1],n[1]):e.push(n)}return e}const v={ł:"l",Ł:"L",đ:"d",Đ:"D",ø:"o",Ø:"O",ħ:"h",Ħ:"H",ŧ:"t",Ŧ:"T",ı:"i",ß:"ss"},B=new RegExp("["+Object.keys(v).join("")+"]","g"),k=String.prototype.normalize?t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"").replace(B,t=>v[t]):t=>t;class I{searchIn(t){const{isCaseSensitive:e,ignoreDiacritics:s,includeMatches:i}=this.options;if(t=e?t:t.toLowerCase(),t=s?k(t):t,this.pattern===t){const e={isMatch:!0,score:0};return i&&(e.indices=[[0,t.length-1]]),e}const{location:n,distance:r,threshold:c,findAllMatches:o,minMatchCharLength:u,ignoreLocation:h}=this.options,a=[];let l=0,d=!1;this.chunks.forEach(({pattern:e,alphabet:s,startIndex:g})=>{const{isMatch:f,score:p,indices:A}=_(t,e,s,{location:n+g,distance:r,threshold:c,findAllMatches:o,minMatchCharLength:u,includeMatches:i,ignoreLocation:h});f&&(d=!0),l+=p,f&&A&&a.push(...A)});const g={isMatch:d,score:d?l/this.chunks.length:1};return d&&i&&(g.indices=E(a)),g}constructor(t,{location:e=C.location,threshold:s=C.threshold,distance:i=C.distance,includeMatches:n=C.includeMatches,findAllMatches:r=C.findAllMatches,minMatchCharLength:c=C.minMatchCharLength,isCaseSensitive:o=C.isCaseSensitive,ignoreDiacritics:u=C.ignoreDiacritics,ignoreLocation:h=C.ignoreLocation}={}){if(this.options={location:e,threshold:s,distance:i,includeMatches:n,findAllMatches:r,minMatchCharLength:c,isCaseSensitive:o,ignoreDiacritics:u,ignoreLocation:h},t=o?t:t.toLowerCase(),t=u?k(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const a=(t,e)=>{this.chunks.push({pattern:t,alphabet:D(t),startIndex:e})},l=this.pattern.length;if(l>F){let t=0;const e=l%F,s=l-e;for(;t<s;)a(this.pattern.substr(t,F),t),t+=F;if(e){const t=l-F;a(this.pattern.substr(t),t)}}else a(this.pattern,0)}}class S{static isMultiMatch(t){return b(t,this.multiRegex)}static isSingleMatch(t){return b(t,this.singleRegex)}search(t){return{isMatch:!1,score:1}}constructor(t){this.pattern=t}}function b(t,e){const s=t.match(e);return s?s[1]:null}class w extends S{static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}constructor(t,{location:e=C.location,threshold:s=C.threshold,distance:i=C.distance,includeMatches:n=C.includeMatches,findAllMatches:r=C.findAllMatches,minMatchCharLength:c=C.minMatchCharLength,isCaseSensitive:o=C.isCaseSensitive,ignoreDiacritics:u=C.ignoreDiacritics,ignoreLocation:h=C.ignoreLocation}={}){super(t),this._bitapSearch=new I(t,{location:e,threshold:s,distance:i,includeMatches:n,findAllMatches:r,minMatchCharLength:c,isCaseSensitive:o,ignoreDiacritics:u,ignoreLocation:h})}}class L extends S{static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e,s=0;const i=[],n=this.pattern.length;for(;(e=t.indexOf(this.pattern,s))>-1;)s=e+n,i.push([e,s-1]);const r=!!i.length;return{isMatch:r,score:r?0:1,indices:i}}constructor(t){super(t)}}const $=[class extends S{static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const e=t===this.pattern;return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}constructor(t){super(t)}},L,class extends S{static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const e=t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}constructor(t){super(t)}},class extends S{static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const e=!t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}constructor(t){super(t)}},class extends S{static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const e=!t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}constructor(t){super(t)}},class extends S{static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const e=t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[t.length-this.pattern.length,t.length-1]}}constructor(t){super(t)}},class extends S{static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const e=-1===t.indexOf(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}constructor(t){super(t)}},w],N=$.length;const R=new Set([w.type,L.type]);class O{static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:i,ignoreDiacritics:n}=this.options;t=i?t:t.toLowerCase(),t=n?k(t):t;let r=0;const c=[];let o=0,u=!1;for(let i=0,n=e.length;i<n;i+=1){const n=e[i];c.length=0,r=0,u=!1;for(let e=0,i=n.length;e<i;e+=1){const i=n[e],{isMatch:h,indices:a,score:l}=i.search(t);if(!h){o=0,r=0,c.length=0,u=!1;break}{r+=1,o+=l;const t=i.constructor.type;t.startsWith("inverse")&&(u=!0),s&&(R.has(t)?c.push(...a):c.push(a))}}if(r){const t={isMatch:!0,score:o/r};return u&&(t.hasInverse=!0),s&&(t.indices=E(c)),t}}return{isMatch:!1,score:1}}constructor(t,{isCaseSensitive:e=C.isCaseSensitive,ignoreDiacritics:s=C.ignoreDiacritics,includeMatches:i=C.includeMatches,minMatchCharLength:n=C.minMatchCharLength,ignoreLocation:r=C.ignoreLocation,findAllMatches:c=C.findAllMatches,location:o=C.location,threshold:u=C.threshold,distance:h=C.distance}={}){this.query=null,this.options={isCaseSensitive:e,ignoreDiacritics:s,includeMatches:i,minMatchCharLength:n,findAllMatches:c,ignoreLocation:r,location:o,threshold:u,distance:h},t=e?t:t.toLowerCase(),t=s?k(t):t,this.pattern=t,this.query=function(t,e={}){return t.replace(/\\\|/g,"\0").split("|").map(t=>{const s=function(t){const e=[],s=t.length;let i=0;for(;i<s;){for(;i<s&&" "===t[i];)i++;if(i>=s)break;let n=i;for(;n<s&&" "!==t[n]&&'"'!==t[n];)n++;if(n<s&&'"'===t[n]){for(n++;n<s;){if('"'===t[n]){const e=n+1;if(e>=s||" "===t[e]){n++;break}if("$"===t[e]&&(e+1>=s||" "===t[e+1])){n+=2;break}}n++}e.push(t.substring(i,n)),i=n}else{for(;n<s&&" "!==t[n];)n++;e.push(t.substring(i,n)),i=n}}return e}(t.replace(/\u0000/g,"|").trim()).filter(t=>t&&!!t.trim()),i=[];for(let t=0,n=s.length;t<n;t+=1){const n=s[t];let r=!1,c=-1;for(;!r&&++c<N;){const t=$[c],s=t.isMultiMatch(n);s&&(i.push(new t(s,e)),r=!0)}if(!r)for(c=-1;++c<N;){const t=$[c],s=t.isSingleMatch(n);if(s){i.push(new t(s,e));break}}}return i})}(this.pattern,this.options)}}const j=[];function W(...t){j.push(...t)}function z(t,e){for(let s=0,i=j.length;s<i;s+=1){const i=j[s];if(i.condition(t,e))return new i(t,e)}return new I(t,e)}const K="$and",T="$or",P="$path",Q="$val",q=t=>!(!t[K]&&!t[T]),J=t=>({[K]:Object.keys(t).map(e=>({[e]:t[e]}))});function U(t,e,{auto:s=!0}={}){const n=t=>{if(r(t)){const i={keyId:null,pattern:t};return s&&(i.searcher=z(t,e)),i}const c=Object.keys(t),o=(t=>!!t[P])(t);if(!o&&c.length>1&&!q(t))return n(J(t));if((t=>!i(t)&&u(t)&&!q(t))(t)){const i=o?t[P]:c[0],n=o?t[Q]:t[i];if(!r(n))throw new Error((t=>`Invalid value for key ${t}`)(i));const u={keyId:A(i),pattern:n};return s&&(u.searcher=z(n,e)),u}const h={children:[],operator:c[0]};return c.forEach(e=>{const s=t[e];i(s)&&s.forEach(t=>{h.children.push(n(t))})}),h};return q(t)||(t=J(t)),n(t)}function V(t,{ignoreFieldNorm:e=C.ignoreFieldNorm}){let s=1;return t.forEach(({key:t,norm:i,score:n})=>{const r=t?t.weight:null;s*=Math.pow(0===n&&r?Number.EPSILON:n,(r||1)*(e?1:i))}),s}class H{get size(){return this.heap.length}shouldInsert(t){return this.size<this.limit||t<this.heap[0].score}insert(t){this.size<this.limit?(this.heap.push(t),this._bubbleUp(this.size-1)):t.score<this.heap[0].score&&(this.heap[0]=t,this._sinkDown(0))}extractSorted(t){return this.heap.sort(t)}_bubbleUp(t){const e=this.heap;for(;t>0;){const s=t-1>>1;if(e[t].score<=e[s].score)break;const i=e[t];e[t]=e[s],e[s]=i,t=s}}_sinkDown(t){const e=this.heap,s=e.length;let i=t;do{const n=2*(t=i)+1,r=2*t+2;if(n<s&&e[n].score>e[i].score&&(i=n),r<s&&e[r].score>e[i].score&&(i=r),i!==t){const s=e[t];e[t]=e[i],e[i]=s}}while(i!==t)}constructor(t){this.limit=t,this.heap=[]}}function G(t,e){const s=t.matches;e.matches=[],h(s)&&s.forEach(t=>{if(!h(t.indices)||!t.indices.length)return;const{indices:s,value:i}=t,n={indices:s,value:i};t.key&&(n.key=t.key.src),t.idx>-1&&(n.refIndex=t.idx),e.matches.push(n)})}function X(t,e){e.score=t.score}const Y=/\b\w+\b/g;function Z({isCaseSensitive:t=!1,ignoreDiacritics:e=!1}={}){return{tokenize:s=>(t||(s=s.toLowerCase()),e&&(s=k(s)),s.match(Y)||[])}}function tt(t,e){for(const[s,i]of t.terms){const n=i.filter(t=>t.docIdx!==e),r=i.length-n.length;r>0&&(t.fieldCount-=r,t.df.set(s,(t.df.get(s)||0)-r),0===n.length?(t.terms.delete(s),t.df.delete(s)):t.terms.set(s,n))}}class et{_getSearcher(t){if(this._lastQuery===t)return this._lastSearcher;const e=z(t,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=t,this._lastSearcher=e,e}setCollection(t,e){if(this._docs=t,e&&!(e instanceof y))throw new Error("Incorrect 'index' type");if(this._myIndex=e||x(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){const t=Z({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics});this._invertedIndex=function(t,e,s){const i=new Map,n=new Map;let r=0;function c(t,e,c,o){const u=s.tokenize(t);if(!u.length)return;r++;const h=new Map;for(const t of u)h.set(t,(h.get(t)||0)+1);for(const[t,s]of h){const r={docIdx:e,keyIdx:c,subIdx:o,tf:s};let u=i.get(t);u||(u=[],i.set(t,u)),u.push(r),n.set(t,(n.get(t)||0)+1)}}for(const s of t){const{i:t,v:i,$:n}=s;if(void 0===i){if(n)for(let s=0;s<e;s++){const e=n[s];if(e)if(Array.isArray(e))for(const i of e)c(i.v,t,s,i.i??-1);else c(e.v,t,s,-1)}}else c(i,t,-1,-1)}return{terms:i,fieldCount:r,df:n}}(this._myIndex.records,this._myIndex.keys.length,t)}}add(t){if(h(t)&&(this._docs.push(t),this._myIndex.add(t),this._invertedIndex)){const t=this._myIndex.records[this._myIndex.records.length-1],e=Z({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics});!function(t,e,s,i){const{i:n,v:r,$:c}=e;function o(e,s,r){const c=i.tokenize(e);if(!c.length)return;t.fieldCount++;const o=new Map;for(const t of c)o.set(t,(o.get(t)||0)+1);for(const[e,i]of o){const c={docIdx:n,keyIdx:s,subIdx:r,tf:i};let o=t.terms.get(e);o||(o=[],t.terms.set(e,o)),o.push(c),t.df.set(e,(t.df.get(e)||0)+1)}}if(void 0===r){if(c)for(let t=0;t<s;t++){const e=c[t];if(e)if(Array.isArray(e))for(const s of e)o(s.v,t,s.i??-1);else o(e.v,t,-1)}}else o(r,-1,-1)}(this._invertedIndex,t,this._myIndex.keys.length,e)}}remove(t=()=>!1){const e=[],s=[];for(let i=0,n=this._docs.length;i<n;i+=1)t(this._docs[i],i)&&(e.push(this._docs[i]),s.push(i));if(s.length){if(this._invertedIndex)for(const t of s)tt(this._invertedIndex,t);for(let t=s.length-1;t>=0;t-=1)this._docs.splice(s[t],1);this._myIndex.removeAll(s)}return e}removeAt(t){this._invertedIndex&&tt(this._invertedIndex,t);const e=this._docs.splice(t,1)[0];return this._myIndex.removeAt(t),e}getIndex(){return this._myIndex}search(t,e){const{limit:s=-1}=e||{},{includeMatches:i,includeScore:n,shouldSort:o,sortFn:u,ignoreFieldNorm:h}=this.options;if(r(t)&&!t.trim()){let t=this._docs.map((t,e)=>({item:t,refIndex:e}));return c(s)&&s>-1&&(t=t.slice(0,s)),t}let a;if(c(s)&&s>0&&r(t)){const e=new H(s);r(this._docs[0])?this._searchStringList(t,{heap:e,ignoreFieldNorm:h}):this._searchObjectList(t,{heap:e,ignoreFieldNorm:h}),a=e.extractSorted(u)}else a=r(t)?r(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t),function(t,{ignoreFieldNorm:e=C.ignoreFieldNorm}){t.forEach(t=>{t.score=V(t.matches,{ignoreFieldNorm:e})})}(a,{ignoreFieldNorm:h}),o&&a.sort(u),c(s)&&s>-1&&(a=a.slice(0,s));return function(t,e,{includeMatches:s=C.includeMatches,includeScore:i=C.includeScore}={}){const n=[];return s&&n.push(G),i&&n.push(X),t.map(t=>{const{idx:s}=t,i={item:e[s],refIndex:s};return n.length&&n.forEach(e=>{e(t,i)}),i})}(a,this._docs,{includeMatches:i,includeScore:n})}_searchStringList(t,{heap:e,ignoreFieldNorm:s}={}){const i=this._getSearcher(t),{records:n}=this._myIndex,r=e?null:[];return n.forEach(({v:t,i:n,n:c})=>{if(!h(t))return;const{isMatch:o,score:u,indices:a}=i.searchIn(t);if(o){const i={item:t,idx:n,matches:[{score:u,value:t,norm:c,indices:a}]};e?(i.score=V(i.matches,{ignoreFieldNorm:s}),e.shouldInsert(i.score)&&e.insert(i)):r.push(i)}}),r}_searchLogical(t){const e=U(t,this.options),s=(t,e,i)=>{if(!("children"in t)){const{keyId:s,searcher:n}=t;let r;return null===s?(r=[],this._myIndex.keys.forEach((t,s)=>{r.push(...this._findMatches({key:t,value:e[s],searcher:n}))})):r=this._findMatches({key:this._keyStore.get(s),value:this._myIndex.getValueForItemAtKeyId(e,s),searcher:n}),r&&r.length?[{idx:i,item:e,matches:r}]:[]}const{children:n,operator:r}=t,c=[];for(let t=0,o=n.length;t<o;t+=1){const o=n[t],u=s(o,e,i);if(u.length)c.push(...u);else if(r===K)return[]}return c},i=this._myIndex.records,n=new Map,r=[];return i.forEach(({$:t,i})=>{if(h(t)){const c=s(e,t,i);c.length&&(n.has(i)||(n.set(i,{idx:i,item:t,matches:[]}),r.push(n.get(i))),c.forEach(({matches:t})=>{n.get(i).matches.push(...t)}))}}),r}_searchObjectList(t,{heap:e,ignoreFieldNorm:s}={}){const i=this._getSearcher(t),{keys:n,records:r}=this._myIndex,c=e?null:[];return r.forEach(({$:t,i:r})=>{if(!h(t))return;const o=[];let u=!1,a=!1;if(n.forEach((e,s)=>{const n=this._findMatches({key:e,value:t[s],searcher:i});n.length?(o.push(...n),n[0].hasInverse&&(a=!0)):u=!0}),(!a||!u)&&o.length){const i={idx:r,item:t,matches:o};e?(i.score=V(i.matches,{ignoreFieldNorm:s}),e.shouldInsert(i.score)&&e.insert(i)):c.push(i)}}),c}_findMatches({key:t,value:e,searcher:s}){if(!h(e))return[];const n=[];if(i(e))e.forEach(({v:e,i,n:r})=>{if(!h(e))return;const{isMatch:c,score:o,indices:u,hasInverse:a}=s.searchIn(e);c&&n.push({score:o,key:t,value:e,idx:i,norm:r,indices:u,hasInverse:a})});else{const{v:i,n:r}=e,{isMatch:c,score:o,indices:u,hasInverse:h}=s.searchIn(i);c&&n.push({score:o,key:t,value:i,norm:r,indices:u,hasInverse:h})}return n}constructor(t,e,s){this.options={...C,...e},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new g(this.options.keys),this._docs=t,this._myIndex=null,this._invertedIndex=null,this.setCollection(t,s),this._lastQuery=null,this._lastSearcher=null}}class st{static condition(t,e){return e.useTokenSearch}searchIn(t){if(!this.termSearchers.length)return{isMatch:!1,score:1};const e=[];let s=0,i=0,n=0;for(let r=0;r<this.termSearchers.length;r++){const c=this.termSearchers[r].searchIn(t),o=this.idfWeights[r];i+=o,c.isMatch&&(n++,s+=o*(1-c.score),c.indices&&e.push(...c.indices))}if(0===n)return{isMatch:!1,score:1};const r=i>0?1-s/i:0,c={isMatch:!0,score:Math.max(.001,r)};return this.options.includeMatches&&e.length&&(c.indices=E(e)),c}constructor(t,e){this.options=e,this.analyzer=Z({isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics});const s=this.analyzer.tokenize(t),i=e._invertedIndex,{df:n,fieldCount:r}=i;this.termSearchers=[],this.idfWeights=[];for(const t of s){this.termSearchers.push(new I(t,{location:e.location,threshold:e.threshold,distance:e.distance,includeMatches:e.includeMatches,findAllMatches:e.findAllMatches,minMatchCharLength:e.minMatchCharLength,isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,ignoreLocation:!0}));const s=n.get(t)||0,i=Math.log(1+(r-s+.5)/(s+.5));this.idfWeights.push(i)}}}et.version="7.3.0",et.createIndex=x,et.parseIndex=function(t,{getFn:e=C.getFn,fieldNormWeight:s=C.fieldNormWeight}={}){const{keys:i,records:n}=t,r=new y({getFn:e,fieldNormWeight:s});return r.setKeys(i),r.setIndexRecords(n),r},et.config=C,et.match=function(t,e,s){return z(t,{...C,...s}).searchIn(e)},et.parseQuery=U,W(O),W(st),et.use=function(...t){t.forEach(t=>W(t))}}};