UNPKG

iobroker.lovelace

Version:

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

2 lines 14.5 kB
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[1480],{81480:(t,e,s)=>{"use strict";function n(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}s.d(e,{Z:()=>q});function i(t){return"string"==typeof t}function r(t){return"number"==typeof t}function c(t){return null!=t}function o(t){return!t.trim().length}const h=Object.prototype.hasOwnProperty;class a{constructor(t){this._keys={},this._keyNames=[];let e=0;t.forEach((t=>{let s,n=1;if(i(t))s=t;else{if(!h.call(t,"name"))throw new Error(`Missing ${"name"} property in key`);if(s=t.name,h.call(t,"weight")&&(n=t.weight,n<=0))throw new Error((t=>`Property 'weight' in key '${t}' must be a positive integer`)(s))}this._keyNames.push(s),this._keys[s]={weight:n},e+=n})),this._keyNames.forEach((t=>{this._keys[t].weight/=e}))}get(t,e){return this._keys[t]&&this._keys[t][e]}keys(){return this._keyNames}toJSON(){return JSON.stringify(this._keys)}}var l={isCaseSensitive:!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,...{useExtendedSearch:!1,getFn:function(t,e){let s=[],o=!1;const h=(t,e)=>{if(e){const a=e.indexOf(".");let l=e,u=null;-1!==a&&(l=e.slice(0,a),u=e.slice(a+1));const d=t[l];if(!c(d))return;if(u||!i(d)&&!r(d))if(n(d)){o=!0;for(let t=0,e=d.length;t<e;t+=1)h(d[t],u)}else u&&h(d,u);else s.push(function(t){return null==t?"":function(t){if("string"==typeof t)return t;let e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}(d))}else s.push(t)};return h(t,e),o?s:s[0]},ignoreLocation:!1,ignoreFieldNorm:!1}};const u=/[^ ]+/g;class d{constructor({getFn:t=l.getFn}={}){this.norm=function(t=3){const e=new Map;return{get(s){const n=s.match(u).length;if(e.has(n))return e.get(n);const i=parseFloat((1/Math.sqrt(n)).toFixed(t));return e.set(n,i),i},clear(){e.clear()}}}(3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,i(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();i(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}size(){return this.records.length}_addString(t,e){if(!c(t)||o(t))return;let s={v:t,i:e,n:this.norm.get(t)};this.records.push(s)}_addObject(t,e){let s={i:e,$:{}};this.keys.forEach(((e,r)=>{let h=this.getFn(t,e);if(c(h))if(n(h)){let t=[];const e=[{nestedArrIndex:-1,value:h}];for(;e.length;){const{nestedArrIndex:s,value:r}=e.pop();if(c(r))if(i(r)&&!o(r)){let e={v:r,i:s,n:this.norm.get(r)};t.push(e)}else n(r)&&r.forEach(((t,s)=>{e.push({nestedArrIndex:s,value:t})}))}s.$[r]=t}else if(!o(h)){let t={v:h,n:this.norm.get(h)};s.$[r]=t}})),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function g(t,e,{getFn:s=l.getFn}={}){const n=new d({getFn:s}),i=new a(t);return n.setKeys(i.keys()),n.setSources(e),n.create(),n}function f(t,e){const s=t.matches;e.matches=[],c(s)&&s.forEach((t=>{if(!c(t.indices)||!t.indices.length)return;const{indices:s,value:n}=t;let i={indices:s,value:n};t.key&&(i.key=t.key),t.idx>-1&&(i.refIndex=t.idx),e.matches.push(i)}))}function p(t,e){e.score=t.score}function m(t,{errors:e=0,currentLocation:s=0,expectedLocation:n=0,distance:i=l.distance,ignoreLocation:r=l.ignoreLocation}={}){const c=e/t.length;if(r)return c;const o=Math.abs(n-s);return i?c+o/i:o?1:c}const M=32;function x(t,e,s,{location:n=l.location,distance:i=l.distance,threshold:r=l.threshold,findAllMatches:c=l.findAllMatches,minMatchCharLength:o=l.minMatchCharLength,includeMatches:h=l.includeMatches,ignoreLocation:a=l.ignoreLocation}={}){if(e.length>M)throw new Error(`Pattern length exceeds max of ${M}.`);const u=e.length,d=t.length,g=Math.max(0,Math.min(n,d));let f=r,p=g;const x=o>1||h,y=x?Array(d):[];let k;for(;(k=t.indexOf(e,p))>-1;){let t=m(e,{currentLocation:k,expectedLocation:g,distance:i,ignoreLocation:a});if(f=Math.min(t,f),p=k+u,x){let t=0;for(;t<u;)y[k+t]=1,t+=1}}p=-1;let L=[],_=1,v=u+d;const S=1<<u-1;for(let l=0;l<u;l+=1){let n=0,r=v;for(;n<r;){m(e,{errors:l,currentLocation:g+r,expectedLocation:g,distance:i,ignoreLocation:a})<=f?n=r:v=r,r=Math.floor((v-n)/2+n)}v=r;let o=Math.max(1,g-r+1),h=c?d:Math.min(g+r,d)+u,M=Array(h+2);M[h+1]=(1<<l)-1;for(let c=h;c>=o;c-=1){let n=c-1,r=s[t.charAt(n)];if(x&&(y[n]=+!!r),M[c]=(M[c+1]<<1|1)&r,l&&(M[c]|=(L[c+1]|L[c])<<1|1|L[c+1]),M[c]&S&&(_=m(e,{errors:l,currentLocation:n,expectedLocation:g,distance:i,ignoreLocation:a}),_<=f)){if(f=_,p=n,p<=g)break;o=Math.max(1,2*g-p)}}if(m(e,{errors:l+1,currentLocation:g,expectedLocation:g,distance:i,ignoreLocation:a})>f)break;L=M}const C={isMatch:p>=0,score:Math.max(.001,_)};if(x){const t=function(t=[],e=l.minMatchCharLength){let s=[],n=-1,i=-1,r=0;for(let c=t.length;r<c;r+=1){let c=t[r];c&&-1===n?n=r:c||-1===n||(i=r-1,i-n+1>=e&&s.push([n,i]),n=-1)}return t[r-1]&&r-n>=e&&s.push([n,r-1]),s}(y,o);t.length?h&&(C.indices=t):C.isMatch=!1}return C}function y(t){let e={};for(let s=0,n=t.length;s<n;s+=1){const i=t.charAt(s);e[i]=(e[i]||0)|1<<n-s-1}return e}class k{constructor(t,{location:e=l.location,threshold:s=l.threshold,distance:n=l.distance,includeMatches:i=l.includeMatches,findAllMatches:r=l.findAllMatches,minMatchCharLength:c=l.minMatchCharLength,isCaseSensitive:o=l.isCaseSensitive,ignoreLocation:h=l.ignoreLocation}={}){if(this.options={location:e,threshold:s,distance:n,includeMatches:i,findAllMatches:r,minMatchCharLength:c,isCaseSensitive:o,ignoreLocation:h},this.pattern=o?t:t.toLowerCase(),this.chunks=[],!this.pattern.length)return;const a=(t,e)=>{this.chunks.push({pattern:t,alphabet:y(t),startIndex:e})},u=this.pattern.length;if(u>M){let t=0;const e=u%M,s=u-e;for(;t<s;)a(this.pattern.substr(t,M),t),t+=M;if(e){const t=u-M;a(this.pattern.substr(t),t)}}else a(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,includeMatches:s}=this.options;if(e||(t=t.toLowerCase()),this.pattern===t){let e={isMatch:!0,score:0};return s&&(e.indices=[[0,t.length-1]]),e}const{location:n,distance:i,threshold:r,findAllMatches:c,minMatchCharLength:o,ignoreLocation:h}=this.options;let a=[],l=0,u=!1;this.chunks.forEach((({pattern:e,alphabet:d,startIndex:g})=>{const{isMatch:f,score:p,indices:m}=x(t,e,d,{location:n+g,distance:i,threshold:r,findAllMatches:c,minMatchCharLength:o,includeMatches:s,ignoreLocation:h});f&&(u=!0),l+=p,f&&m&&(a=[...a,...m])}));let d={isMatch:u,score:u?l/this.chunks.length:1};return u&&s&&(d.indices=a),d}}class L{constructor(t){this.pattern=t}static isMultiMatch(t){return _(t,this.multiRegex)}static isSingleMatch(t){return _(t,this.singleRegex)}search(){}}function _(t,e){const s=t.match(e);return s?s[1]:null}class v extends L{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e,s=0;const n=[],i=this.pattern.length;for(;(e=t.indexOf(this.pattern,s))>-1;)s=e+i,n.push([e,s-1]);const r=!!n.length;return{isMatch:r,score:r?1:0,indices:n}}}class S extends L{constructor(t,{location:e=l.location,threshold:s=l.threshold,distance:n=l.distance,includeMatches:i=l.includeMatches,findAllMatches:r=l.findAllMatches,minMatchCharLength:c=l.minMatchCharLength,isCaseSensitive:o=l.isCaseSensitive}={}){super(t),this._bitapSearch=new k(t,{location:e,threshold:s,distance:n,includeMatches:i,findAllMatches:r,minMatchCharLength:c,isCaseSensitive:o})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}const C=[v,class extends L{constructor(t){super(t)}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]}}},class extends L{constructor(t){super(t)}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]}}},class extends L{constructor(t){super(t)}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]}}},class extends L{constructor(t){super(t)}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]}}},class extends L{constructor(t){super(t)}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]}}},S],w=C.length,A=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;const b=new Set([S.type,v.type]);class I{constructor(t,{isCaseSensitive:e=l.isCaseSensitive,includeMatches:s=l.includeMatches,minMatchCharLength:n=l.minMatchCharLength,findAllMatches:i=l.findAllMatches,location:r=l.location,threshold:c=l.threshold,distance:o=l.distance}={}){this.query=null,this.options={isCaseSensitive:e,includeMatches:s,minMatchCharLength:n,findAllMatches:i,location:r,threshold:c,distance:o},this.pattern=e?t:t.toLowerCase(),this.query=function(t,e={}){return t.split("|").map((t=>{let s=t.trim().split(A).filter((t=>t&&!!t.trim())),n=[];for(let i=0,r=s.length;i<r;i+=1){const t=s[i];let r=!1,c=-1;for(;!r&&++c<w;){const s=C[c];let i=s.isMultiMatch(t);i&&(n.push(new s(i,e)),r=!0)}if(!r)for(c=-1;++c<w;){const s=C[c];let i=s.isSingleMatch(t);if(i){n.push(new s(i,e));break}}}return n}))}(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:n}=this.options;t=n?t:t.toLowerCase();let i=0,r=[],c=0;for(let o=0,h=e.length;o<h;o+=1){const n=e[o];r.length=0,i=0;for(let e=0,o=n.length;e<o;e+=1){const o=n[e],{isMatch:h,indices:a,score:l}=o.search(t);if(!h){c=0,i=0,r.length=0;break}if(i+=1,c+=l,s){const t=o.constructor.type;b.has(t)?r=[...r,...a]:r.push(a)}}if(i){let t={isMatch:!0,score:c/i};return s&&(t.indices=r),t}}return{isMatch:!1,score:1}}}const $=[];function E(t,e){for(let s=0,n=$.length;s<n;s+=1){let n=$[s];if(n.condition(t,e))return new n(t,e)}return new k(t,e)}const F="$and",O="$or",R=t=>!(!t[F]&&!t[O]),N=t=>({[F]:Object.keys(t).map((e=>({[e]:t[e]})))});function j(t,e,{auto:s=!0}={}){const r=t=>{let c=Object.keys(t);if(c.length>1&&!R(t))return r(N(t));let o=c[0];if((t=>!n(t)&&"object"==typeof t&&!R(t))(t)){const n=t[o];if(!i(n))throw new Error((t=>"Invalid value for key "+t)(o));const r={key:o,pattern:n};return s&&(r.searcher=E(n,e)),r}let h={children:[],operator:o};return c.forEach((e=>{const s=t[e];n(s)&&s.forEach((t=>{h.children.push(r(t))}))})),h};return R(t)||(t=N(t)),r(t)}class z{constructor(t,e={},s){this.options={...l,...e},this.options.useExtendedSearch,this._keyStore=new a(this.options.keys),this.setCollection(t,s)}setCollection(t,e){if(this._docs=t,e&&!(e instanceof d))throw new Error("Incorrect 'index' type");this._myIndex=e||g(this._keyStore.keys(),this._docs,{getFn:this.options.getFn})}add(t){c(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=(()=>!1)){const e=[];for(let s=0,n=this._docs.length;s<n;s+=1){const n=this._docs[s];t(n,s)&&(this.removeAt(s),s-=1,e.push(n))}return e}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:e=-1}={}){const{includeMatches:s,includeScore:n,shouldSort:c,sortFn:o,ignoreFieldNorm:h}=this.options;let a=i(t)?i(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return function(t,e,{ignoreFieldNorm:s=l.ignoreFieldNorm}){t.forEach((t=>{let n=1;t.matches.forEach((({key:t,norm:i,score:r})=>{const c=e.get(t,"weight");n*=Math.pow(0===r&&c?Number.EPSILON:r,(c||1)*(s?1:i))})),t.score=n}))}(a,this._keyStore,{ignoreFieldNorm:h}),c&&a.sort(o),r(e)&&e>-1&&(a=a.slice(0,e)),function(t,e,{includeMatches:s=l.includeMatches,includeScore:n=l.includeScore}={}){const i=[];s&&i.push(f);n&&i.push(p);return t.map((t=>{const{idx:s}=t,n={item:e[s],refIndex:s};return i.length&&i.forEach((e=>{e(t,n)})),n}))}(a,this._docs,{includeMatches:s,includeScore:n})}_searchStringList(t){const e=E(t,this.options),{records:s}=this._myIndex,n=[];return s.forEach((({v:t,i:s,n:i})=>{if(!c(t))return;const{isMatch:r,score:o,indices:h}=e.searchIn(t);r&&n.push({item:t,idx:s,matches:[{score:o,value:t,norm:i,indices:h}]})})),n}_searchLogical(t){const e=j(t,this.options),{keys:s,records:n}=this._myIndex,i={},r=[],o=(t,e,n)=>{if(t.children){const s=t.operator;let i=[];for(let r=0;r<t.children.length;r+=1){let c=t.children[r],h=o(c,e,n);if(h&&h.length){if(i.push({idx:n,item:e,matches:h}),s===O)break}else if(s===F){i.length=0;break}}return i}{const{key:n,searcher:i}=t,r=e[s.indexOf(n)];return this._findMatches({key:n,value:r,searcher:i})}};return n.forEach((({$:t,i:s})=>{if(c(t)){let n=o(e,t,s);n.length&&(i[s]||(i[s]={idx:s,item:t,matches:[]},r.push(i[s])),n.forEach((({matches:t})=>{i[s].matches.push(...t)})))}})),r}_searchObjectList(t){const e=E(t,this.options),{keys:s,records:n}=this._myIndex,i=[];return n.forEach((({$:t,i:n})=>{if(!c(t))return;let r=[];s.forEach(((s,n)=>{r.push(...this._findMatches({key:s,value:t[n],searcher:e}))})),r.length&&i.push({idx:n,item:t,matches:r})})),i}_findMatches({key:t,value:e,searcher:s}){if(!c(e))return[];let i=[];if(n(e))e.forEach((({v:e,i:n,n:r})=>{if(!c(e))return;const{isMatch:o,score:h,indices:a}=s.searchIn(e);o&&i.push({score:h,key:t,value:e,idx:n,norm:r,indices:a})}));else{const{v:n,n:r}=e,{isMatch:c,score:o,indices:h}=s.searchIn(n);c&&i.push({score:o,key:t,value:n,norm:r,indices:h})}return i}}z.version="6.2.1",z.createIndex=g,z.parseIndex=function(t,{getFn:e=l.getFn}={}){const{keys:s,records:n}=t,i=new d({getFn:e});return i.setKeys(s),i.setIndexRecords(n),i},z.config=l,z.parseQuery=j,function(...t){$.push(...t)}(I);const q=z}}]); //# sourceMappingURL=chunk.732db4407756c74a0800.js.map