@eox/itemfilter 0.1.0 → 0.2.1
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/eox-itemfilter.js +1597 -860
- package/dist/eox-itemfilter.umd.cjs +168 -68
- package/package.json +3 -2
- package/test/general.cy.ts +9 -5
- package/test/reducedWidth.cy.ts +1 -0
- package/test/testItems.json +40 -0
|
@@ -1,16 +1,64 @@
|
|
|
1
|
-
(function(M,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(M=typeof globalThis<"u"?globalThis:M||self,m(M["eox-itemfilter"]={}))})(this,function(M){"use strict";var et=Object.defineProperty;var tt=(M,m,v)=>m in M?et(M,m,{enumerable:!0,configurable:!0,writable:!0,value:v}):M[m]=v;var R=(M,m,v)=>(tt(M,typeof m!="symbol"?m+"":m,v),v);function m(s){return Array.isArray?Array.isArray(s):X(s)==="[object Array]"}const v=1/0;function fe(s){if(typeof s=="string")return s;let e=s+"";return e=="0"&&1/s==-v?"-0":e}function de(s){return s==null?"":fe(s)}function S(s){return typeof s=="string"}function G(s){return typeof s=="number"}function ge(s){return s===!0||s===!1||pe(s)&&X(s)=="[object Boolean]"}function Q(s){return typeof s=="object"}function pe(s){return Q(s)&&s!==null}function x(s){return s!=null}function P(s){return!s.trim().length}function X(s){return s==null?s===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(s)}const st="Extended search is not available",me="Incorrect 'index' type",ye=s=>`Invalid value for key ${s}`,xe=s=>`Pattern length exceeds max of ${s}.`,Me=s=>`Missing ${s} property in key`,Ee=s=>`Property 'weight' in key '${s}' must be a positive integer`,J=Object.prototype.hasOwnProperty;class we{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(n=>{let i=Z(n);t+=i.weight,this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight}),this._keys.forEach(n=>{n.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Z(s){let e=null,t=null,n=null,i=1,c=null;if(S(s)||m(s))n=s,e=ee(s),t=B(s);else{if(!J.call(s,"name"))throw new Error(Me("name"));const r=s.name;if(n=r,J.call(s,"weight")&&(i=s.weight,i<=0))throw new Error(Ee(r));e=ee(r),t=B(r),c=s.getFn}return{path:e,id:t,weight:i,src:n,getFn:c}}function ee(s){return m(s)?s:s.split(".")}function B(s){return m(s)?s.join("."):s}function Se(s,e){let t=[],n=!1;const i=(c,r,o)=>{if(x(c))if(!r[o])t.push(c);else{let l=r[o];const a=c[l];if(!x(a))return;if(o===r.length-1&&(S(a)||G(a)||ge(a)))t.push(de(a));else if(m(a)){n=!0;for(let h=0,u=a.length;h<u;h+=1)i(a[h],r,o+1)}else r.length&&i(a,r,o+1)}};return i(s,S(e)?e.split("."):e,0),n?t:t[0]}var d={...{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(s,e)=>s.score===e.score?s.idx<e.idx?-1:1:s.score<e.score?-1:1},...{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},...{location:0,threshold:.6,distance:100},...{useExtendedSearch:!1,getFn:Se,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const Le=/[^ ]+/g;function Ae(s=1,e=3){const t=new Map,n=Math.pow(10,e);return{get(i){const c=i.match(Le).length;if(t.has(c))return t.get(c);const r=1/Math.pow(c,.5*s),o=parseFloat(Math.round(r*n)/n);return t.set(c,o),o},clear(){t.clear()}}}class z{constructor({getFn:e=d.getFn,fieldNormWeight:t=d.fieldNormWeight}={}){this.norm=Ae(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((t,n)=>{this._keysMap[t.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,S(this.docs[0])?this.docs.forEach((e,t)=>{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){const t=this.size();S(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!x(e)||P(e))return;let n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}_addObject(e,t){let n={i:t,$:{}};this.keys.forEach((i,c)=>{let r=i.getFn?i.getFn(e):this.getFn(e,i.path);if(x(r)){if(m(r)){let o=[];const l=[{nestedArrIndex:-1,value:r}];for(;l.length;){const{nestedArrIndex:a,value:h}=l.pop();if(x(h))if(S(h)&&!P(h)){let u={v:h,i:a,n:this.norm.get(h)};o.push(u)}else m(h)&&h.forEach((u,f)=>{l.push({nestedArrIndex:f,value:u})})}n.$[c]=o}else if(S(r)&&!P(r)){let o={v:r,n:this.norm.get(r)};n.$[c]=o}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function te(s,e,{getFn:t=d.getFn,fieldNormWeight:n=d.fieldNormWeight}={}){const i=new z({getFn:t,fieldNormWeight:n});return i.setKeys(s.map(Z)),i.setSources(e),i.create(),i}function Ie(s,{getFn:e=d.getFn,fieldNormWeight:t=d.fieldNormWeight}={}){const{keys:n,records:i}=s,c=new z({getFn:e,fieldNormWeight:t});return c.setKeys(n),c.setIndexRecords(i),c}function F(s,{errors:e=0,currentLocation:t=0,expectedLocation:n=0,distance:i=d.distance,ignoreLocation:c=d.ignoreLocation}={}){const r=e/s.length;if(c)return r;const o=Math.abs(n-t);return i?r+o/i:o?1:r}function be(s=[],e=d.minMatchCharLength){let t=[],n=-1,i=-1,c=0;for(let r=s.length;c<r;c+=1){let o=s[c];o&&n===-1?n=c:!o&&n!==-1&&(i=c-1,i-n+1>=e&&t.push([n,i]),n=-1)}return s[c-1]&&c-n>=e&&t.push([n,c-1]),t}const T=32;function _e(s,e,t,{location:n=d.location,distance:i=d.distance,threshold:c=d.threshold,findAllMatches:r=d.findAllMatches,minMatchCharLength:o=d.minMatchCharLength,includeMatches:l=d.includeMatches,ignoreLocation:a=d.ignoreLocation}={}){if(e.length>T)throw new Error(xe(T));const h=e.length,u=s.length,f=Math.max(0,Math.min(n,u));let g=c,p=f;const y=o>1||l,L=y?Array(u):[];let A;for(;(A=s.indexOf(e,p))>-1;){let E=F(e,{currentLocation:A,expectedLocation:f,distance:i,ignoreLocation:a});if(g=Math.min(E,g),p=A+h,y){let b=0;for(;b<h;)L[A+b]=1,b+=1}}p=-1;let $=[],k=1,j=h+u;const Ze=1<<h-1;for(let E=0;E<h;E+=1){let b=0,_=j;for(;b<_;)F(e,{errors:E,currentLocation:f+_,expectedLocation:f,distance:i,ignoreLocation:a})<=g?b=_:j=_,_=Math.floor((j-b)/2+b);j=_;let he=Math.max(1,f-_+1),Y=r?u:Math.min(f+_,u)+h,N=Array(Y+2);N[Y+1]=(1<<E)-1;for(let w=Y;w>=he;w-=1){let H=w-1,ue=t[s.charAt(H)];if(y&&(L[H]=+!!ue),N[w]=(N[w+1]<<1|1)&ue,E&&(N[w]|=($[w+1]|$[w])<<1|1|$[w+1]),N[w]&Ze&&(k=F(e,{errors:E,currentLocation:H,expectedLocation:f,distance:i,ignoreLocation:a}),k<=g)){if(g=k,p=H,p<=f)break;he=Math.max(1,2*f-p)}}if(F(e,{errors:E+1,currentLocation:f,expectedLocation:f,distance:i,ignoreLocation:a})>g)break;$=N}const U={isMatch:p>=0,score:Math.max(.001,k)};if(y){const E=be(L,o);E.length?l&&(U.indices=E):U.isMatch=!1}return U}function Re(s){let e={};for(let t=0,n=s.length;t<n;t+=1){const i=s.charAt(t);e[i]=(e[i]||0)|1<<n-t-1}return e}class se{constructor(e,{location:t=d.location,threshold:n=d.threshold,distance:i=d.distance,includeMatches:c=d.includeMatches,findAllMatches:r=d.findAllMatches,minMatchCharLength:o=d.minMatchCharLength,isCaseSensitive:l=d.isCaseSensitive,ignoreLocation:a=d.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:i,includeMatches:c,findAllMatches:r,minMatchCharLength:o,isCaseSensitive:l,ignoreLocation:a},this.pattern=l?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const h=(f,g)=>{this.chunks.push({pattern:f,alphabet:Re(f),startIndex:g})},u=this.pattern.length;if(u>T){let f=0;const g=u%T,p=u-g;for(;f<p;)h(this.pattern.substr(f,T),f),f+=T;if(g){const y=u-T;h(this.pattern.substr(y),y)}}else h(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,includeMatches:n}=this.options;if(t||(e=e.toLowerCase()),this.pattern===e){let p={isMatch:!0,score:0};return n&&(p.indices=[[0,e.length-1]]),p}const{location:i,distance:c,threshold:r,findAllMatches:o,minMatchCharLength:l,ignoreLocation:a}=this.options;let h=[],u=0,f=!1;this.chunks.forEach(({pattern:p,alphabet:y,startIndex:L})=>{const{isMatch:A,score:$,indices:k}=_e(e,p,y,{location:i+L,distance:c,threshold:r,findAllMatches:o,minMatchCharLength:l,includeMatches:n,ignoreLocation:a});A&&(f=!0),u+=$,A&&k&&(h=[...h,...k])});let g={isMatch:f,score:f?u/this.chunks.length:1};return f&&n&&(g.indices=h),g}}class I{constructor(e){this.pattern=e}static isMultiMatch(e){return ie(e,this.multiRegex)}static isSingleMatch(e){return ie(e,this.singleRegex)}search(){}}function ie(s,e){const t=s.match(e);return t?t[1]:null}class ve extends I{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class Te extends I{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class ke extends I{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class Oe extends I{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class $e extends I{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class Ne extends I{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class ne extends I{constructor(e,{location:t=d.location,threshold:n=d.threshold,distance:i=d.distance,includeMatches:c=d.includeMatches,findAllMatches:r=d.findAllMatches,minMatchCharLength:o=d.minMatchCharLength,isCaseSensitive:l=d.isCaseSensitive,ignoreLocation:a=d.ignoreLocation}={}){super(e),this._bitapSearch=new se(e,{location:t,threshold:n,distance:i,includeMatches:c,findAllMatches:r,minMatchCharLength:o,isCaseSensitive:l,ignoreLocation:a})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class re extends I{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t=0,n;const i=[],c=this.pattern.length;for(;(n=e.indexOf(this.pattern,t))>-1;)t=n+c,i.push([n,t-1]);const r=!!i.length;return{isMatch:r,score:r?0:1,indices:i}}}const K=[ve,re,ke,Oe,Ne,$e,Te,ne],ce=K.length,Fe=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Ce="|";function je(s,e={}){return s.split(Ce).map(t=>{let n=t.trim().split(Fe).filter(c=>c&&!!c.trim()),i=[];for(let c=0,r=n.length;c<r;c+=1){const o=n[c];let l=!1,a=-1;for(;!l&&++a<ce;){const h=K[a];let u=h.isMultiMatch(o);u&&(i.push(new h(u,e)),l=!0)}if(!l)for(a=-1;++a<ce;){const h=K[a];let u=h.isSingleMatch(o);if(u){i.push(new h(u,e));break}}}return i})}const He=new Set([ne.type,re.type]);class Pe{constructor(e,{isCaseSensitive:t=d.isCaseSensitive,includeMatches:n=d.includeMatches,minMatchCharLength:i=d.minMatchCharLength,ignoreLocation:c=d.ignoreLocation,findAllMatches:r=d.findAllMatches,location:o=d.location,threshold:l=d.threshold,distance:a=d.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:n,minMatchCharLength:i,findAllMatches:r,ignoreLocation:c,location:o,threshold:l,distance:a},this.pattern=t?e:e.toLowerCase(),this.query=je(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i}=this.options;e=i?e:e.toLowerCase();let c=0,r=[],o=0;for(let l=0,a=t.length;l<a;l+=1){const h=t[l];r.length=0,c=0;for(let u=0,f=h.length;u<f;u+=1){const g=h[u],{isMatch:p,indices:y,score:L}=g.search(e);if(p){if(c+=1,o+=L,n){const A=g.constructor.type;He.has(A)?r=[...r,...y]:r.push(y)}}else{o=0,c=0,r.length=0;break}}if(c){let u={isMatch:!0,score:o/c};return n&&(u.indices=r),u}}return{isMatch:!1,score:1}}}const W=[];function Be(...s){W.push(...s)}function D(s,e){for(let t=0,n=W.length;t<n;t+=1){let i=W[t];if(i.condition(s,e))return new i(s,e)}return new se(s,e)}const C={AND:"$and",OR:"$or"},q={PATH:"$path",PATTERN:"$val"},V=s=>!!(s[C.AND]||s[C.OR]),ze=s=>!!s[q.PATH],Ke=s=>!m(s)&&Q(s)&&!V(s),oe=s=>({[C.AND]:Object.keys(s).map(e=>({[e]:s[e]}))});function le(s,e,{auto:t=!0}={}){const n=i=>{let c=Object.keys(i);const r=ze(i);if(!r&&c.length>1&&!V(i))return n(oe(i));if(Ke(i)){const l=r?i[q.PATH]:c[0],a=r?i[q.PATTERN]:i[l];if(!S(a))throw new Error(ye(l));const h={keyId:B(l),pattern:a};return t&&(h.searcher=D(a,e)),h}let o={children:[],operator:c[0]};return c.forEach(l=>{const a=i[l];m(a)&&a.forEach(h=>{o.children.push(n(h))})}),o};return V(s)||(s=oe(s)),n(s)}function We(s,{ignoreFieldNorm:e=d.ignoreFieldNorm}){s.forEach(t=>{let n=1;t.matches.forEach(({key:i,norm:c,score:r})=>{const o=i?i.weight:null;n*=Math.pow(r===0&&o?Number.EPSILON:r,(o||1)*(e?1:c))}),t.score=n})}function De(s,e){const t=s.matches;e.matches=[],x(t)&&t.forEach(n=>{if(!x(n.indices)||!n.indices.length)return;const{indices:i,value:c}=n;let r={indices:i,value:c};n.key&&(r.key=n.key.src),n.idx>-1&&(r.refIndex=n.idx),e.matches.push(r)})}function qe(s,e){e.score=s.score}function Ve(s,e,{includeMatches:t=d.includeMatches,includeScore:n=d.includeScore}={}){const i=[];return t&&i.push(De),n&&i.push(qe),s.map(c=>{const{idx:r}=c,o={item:e[r],refIndex:r};return i.length&&i.forEach(l=>{l(c,o)}),o})}class O{constructor(e,t={},n){this.options={...d,...t},this.options.useExtendedSearch,this._keyStore=new we(this.options.keys),this.setCollection(e,n)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof z))throw new Error(me);this._myIndex=t||te(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){x(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let n=0,i=this._docs.length;n<i;n+=1){const c=this._docs[n];e(c,n)&&(this.removeAt(n),n-=1,i-=1,t.push(c))}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:n,includeScore:i,shouldSort:c,sortFn:r,ignoreFieldNorm:o}=this.options;let l=S(e)?S(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return We(l,{ignoreFieldNorm:o}),c&&l.sort(r),G(t)&&t>-1&&(l=l.slice(0,t)),Ve(l,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(e){const t=D(e,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:c,i:r,n:o})=>{if(!x(c))return;const{isMatch:l,score:a,indices:h}=t.searchIn(c);l&&i.push({item:c,idx:r,matches:[{score:a,value:c,norm:o,indices:h}]})}),i}_searchLogical(e){const t=le(e,this.options),n=(o,l,a)=>{if(!o.children){const{keyId:u,searcher:f}=o,g=this._findMatches({key:this._keyStore.get(u),value:this._myIndex.getValueForItemAtKeyId(l,u),searcher:f});return g&&g.length?[{idx:a,item:l,matches:g}]:[]}const h=[];for(let u=0,f=o.children.length;u<f;u+=1){const g=o.children[u],p=n(g,l,a);if(p.length)h.push(...p);else if(o.operator===C.AND)return[]}return h},i=this._myIndex.records,c={},r=[];return i.forEach(({$:o,i:l})=>{if(x(o)){let a=n(t,o,l);a.length&&(c[l]||(c[l]={idx:l,item:o,matches:[]},r.push(c[l])),a.forEach(({matches:h})=>{c[l].matches.push(...h)}))}}),r}_searchObjectList(e){const t=D(e,this.options),{keys:n,records:i}=this._myIndex,c=[];return i.forEach(({$:r,i:o})=>{if(!x(r))return;let l=[];n.forEach((a,h)=>{l.push(...this._findMatches({key:a,value:r[h],searcher:t}))}),l.length&&c.push({idx:o,item:r,matches:l})}),c}_findMatches({key:e,value:t,searcher:n}){if(!x(t))return[];let i=[];if(m(t))t.forEach(({v:c,i:r,n:o})=>{if(!x(c))return;const{isMatch:l,score:a,indices:h}=n.searchIn(c);l&&i.push({score:a,key:e,value:c,idx:r,norm:o,indices:h})});else{const{v:c,n:r}=t,{isMatch:o,score:l,indices:a}=n.searchIn(c);o&&i.push({score:l,key:e,value:c,norm:r,indices:a})}return i}}O.version="6.6.2",O.createIndex=te,O.parseIndex=Ie,O.config=d,O.parseQuery=le,Be(Pe);const Ue=`
|
|
2
|
-
|
|
1
|
+
(function(_,v){typeof exports=="object"&&typeof module<"u"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(_=typeof globalThis<"u"?globalThis:_||self,v(_["eox-itemfilter"]={}))})(this,function(_){"use strict";var ms=Object.defineProperty;var _s=(_,v,S)=>v in _?ms(_,v,{enumerable:!0,configurable:!0,writable:!0,value:S}):_[v]=S;var M=(_,v,S)=>(_s(_,typeof v!="symbol"?v+"":v,S),S);/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/const v=window,S=v.ShadowRoot&&(v.ShadyCSS===void 0||v.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,It=Symbol(),Rt=new WeakMap;let he=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==It)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(S&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=Rt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Rt.set(e,t))}return t}toString(){return this.cssText}};const ae=r=>new he(typeof r=="string"?r:r+"",void 0,It),ue=(r,t)=>{S?r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const s=document.createElement("style"),i=v.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)})},Ot=S?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return ae(e)})(r):r;/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*/var ct;const tt=window,Lt=tt.trustedTypes,de=Lt?Lt.emptyScript:"",Nt=tt.reactiveElementPolyfillSupport,ht={toAttribute(r,t){switch(t){case Boolean:r=r?de:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},Tt=(r,t)=>t!==r&&(t==t||r==r),at={attribute:!0,type:String,converter:ht,reflect:!1,hasChanged:Tt};let z=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),((e=this.h)!==null&&e!==void 0?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,s)=>{const i=this._$Ep(s,e);i!==void 0&&(this._$Ev.set(i,s),t.push(i))}),t}static createProperty(t,e=at){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const s=typeof t=="symbol"?Symbol():"__"+t,i=this.getPropertyDescriptor(t,s,e);i!==void 0&&Object.defineProperty(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){return{get(){return this[e]},set(i){const n=this[t];this[e]=i,this.requestUpdate(t,n,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||at}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,s=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const i of s)this.createProperty(i,e[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)e.unshift(Ot(i))}else t!==void 0&&e.push(Ot(t));return e}static _$Ep(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,s;((e=this._$ES)!==null&&e!==void 0?e:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((s=t.hostConnected)===null||s===void 0||s.call(t))}removeController(t){var e;(e=this._$ES)===null||e===void 0||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return ue(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(e=>{var s;return(s=e.hostConnected)===null||s===void 0?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(e=>{var s;return(s=e.hostDisconnected)===null||s===void 0?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e,s=at){var i;const n=this.constructor._$Ep(t,s);if(n!==void 0&&s.reflect===!0){const o=(((i=s.converter)===null||i===void 0?void 0:i.toAttribute)!==void 0?s.converter:ht).toAttribute(e,s.type);this._$El=t,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$El=null}}_$AK(t,e){var s;const i=this.constructor,n=i._$Ev.get(t);if(n!==void 0&&this._$El!==n){const o=i.getPropertyOptions(n),c=typeof o.converter=="function"?{fromAttribute:o.converter}:((s=o.converter)===null||s===void 0?void 0:s.fromAttribute)!==void 0?o.converter:ht;this._$El=n,this[n]=c.fromAttribute(e,o.type),this._$El=null}}requestUpdate(t,e,s){let i=!0;t!==void 0&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||Tt)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,s))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((i,n)=>this[n]=i),this._$Ei=void 0);let e=!1;const s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),(t=this._$ES)===null||t===void 0||t.forEach(i=>{var n;return(n=i.hostUpdate)===null||n===void 0?void 0:n.call(i)}),this.update(s)):this._$Ek()}catch(i){throw e=!1,this._$Ek(),i}e&&this._$AE(s)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach(s=>{var i;return(i=s.hostUpdated)===null||i===void 0?void 0:i.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((e,s)=>this._$EO(s,this[s],e)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};z.finalized=!0,z.elementProperties=new Map,z.elementStyles=[],z.shadowRootOptions={mode:"open"},Nt==null||Nt({ReactiveElement:z}),((ct=tt.reactiveElementVersions)!==null&&ct!==void 0?ct:tt.reactiveElementVersions=[]).push("1.6.1");/**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2017 Google LLC
|
|
12
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
+
*/var ut;const et=window,B=et.trustedTypes,kt=B?B.createPolicy("lit-html",{createHTML:r=>r}):void 0,dt="$lit$",C=`lit$${(Math.random()+"").slice(9)}$`,Pt="?"+C,fe=`<${Pt}>`,L=document,Y=()=>L.createComment(""),G=r=>r===null||typeof r!="object"&&typeof r!="function",Ut=Array.isArray,pe=r=>Ut(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",ft=`[
|
|
14
|
+
\f\r]`,J=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ht=/-->/g,jt=/>/g,N=RegExp(`>|${ft}(?:([^\\s"'>=/]+)(${ft}*=${ft}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ft=/'/g,zt=/"/g,Bt=/^(?:script|style|textarea|title)$/i,ge=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),T=ge(1),k=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Dt=new WeakMap,P=L.createTreeWalker(L,129,null,!1),me=(r,t)=>{const e=r.length-1,s=[];let i,n=t===2?"<svg>":"",o=J;for(let l=0;l<e;l++){const h=r[l];let u,a,d=-1,p=0;for(;p<h.length&&(o.lastIndex=p,a=o.exec(h),a!==null);)p=o.lastIndex,o===J?a[1]==="!--"?o=Ht:a[1]!==void 0?o=jt:a[2]!==void 0?(Bt.test(a[2])&&(i=RegExp("</"+a[2],"g")),o=N):a[3]!==void 0&&(o=N):o===N?a[0]===">"?(o=i??J,d=-1):a[1]===void 0?d=-2:(d=o.lastIndex-a[2].length,u=a[1],o=a[3]===void 0?N:a[3]==='"'?zt:Ft):o===zt||o===Ft?o=N:o===Ht||o===jt?o=J:(o=N,i=void 0);const g=o===N&&r[l+1].startsWith("/>")?" ":"";n+=o===J?h+fe:d>=0?(s.push(u),h.slice(0,d)+dt+h.slice(d)+C+g):h+C+(d===-2?(s.push(void 0),l):g)}const c=n+(r[e]||"<?>")+(t===2?"</svg>":"");if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return[kt!==void 0?kt.createHTML(c):c,s]};class Q{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let n=0,o=0;const c=t.length-1,l=this.parts,[h,u]=me(t,e);if(this.el=Q.createElement(h,s),P.currentNode=this.el.content,e===2){const a=this.el.content,d=a.firstChild;d.remove(),a.append(...d.childNodes)}for(;(i=P.nextNode())!==null&&l.length<c;){if(i.nodeType===1){if(i.hasAttributes()){const a=[];for(const d of i.getAttributeNames())if(d.endsWith(dt)||d.startsWith(C)){const p=u[o++];if(a.push(d),p!==void 0){const g=i.getAttribute(p.toLowerCase()+dt).split(C),$=/([.?@])?(.*)/.exec(p);l.push({type:1,index:n,name:$[2],strings:g,ctor:$[1]==="."?$e:$[1]==="?"?ye:$[1]==="@"?Ae:st})}else l.push({type:6,index:n})}for(const d of a)i.removeAttribute(d)}if(Bt.test(i.tagName)){const a=i.textContent.split(C),d=a.length-1;if(d>0){i.textContent=B?B.emptyScript:"";for(let p=0;p<d;p++)i.append(a[p],Y()),P.nextNode(),l.push({type:2,index:++n});i.append(a[d],Y())}}}else if(i.nodeType===8)if(i.data===Pt)l.push({type:2,index:n});else{let a=-1;for(;(a=i.data.indexOf(C,a+1))!==-1;)l.push({type:7,index:n}),a+=C.length-1}n++}}static createElement(t,e){const s=L.createElement("template");return s.innerHTML=t,s}}function D(r,t,e=r,s){var i,n,o,c;if(t===k)return t;let l=s!==void 0?(i=e._$Co)===null||i===void 0?void 0:i[s]:e._$Cl;const h=G(t)?void 0:t._$litDirective$;return(l==null?void 0:l.constructor)!==h&&((n=l==null?void 0:l._$AO)===null||n===void 0||n.call(l,!1),h===void 0?l=void 0:(l=new h(r),l._$AT(r,e,s)),s!==void 0?((o=(c=e)._$Co)!==null&&o!==void 0?o:c._$Co=[])[s]=l:e._$Cl=l),l!==void 0&&(t=D(r,l._$AS(r,t.values),l,s)),t}class _e{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:s},parts:i}=this._$AD,n=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:L).importNode(s,!0);P.currentNode=n;let o=P.nextNode(),c=0,l=0,h=i[0];for(;h!==void 0;){if(c===h.index){let u;h.type===2?u=new X(o,o.nextSibling,this,t):h.type===1?u=new h.ctor(o,h.name,h.strings,this,t):h.type===6&&(u=new Ee(o,this,t)),this._$AV.push(u),h=i[++l]}c!==(h==null?void 0:h.index)&&(o=P.nextNode(),c++)}return P.currentNode=L,n}v(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class X{constructor(t,e,s,i){var n;this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cp=(n=i==null?void 0:i.isConnected)===null||n===void 0||n}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=D(this,t,e),G(t)?t===m||t==null||t===""?(this._$AH!==m&&this._$AR(),this._$AH=m):t!==this._$AH&&t!==k&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):pe(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==m&&G(this._$AH)?this._$AA.nextSibling.data=t:this.$(L.createTextNode(t)),this._$AH=t}g(t){var e;const{values:s,_$litType$:i}=t,n=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=Q.createElement(i.h,this.options)),i);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===n)this._$AH.v(s);else{const o=new _e(n,this),c=o.u(this.options);o.v(s),this.$(c),this._$AH=o}}_$AC(t){let e=Dt.get(t.strings);return e===void 0&&Dt.set(t.strings,e=new Q(t)),e}T(t){Ut(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const n of t)i===e.length?e.push(s=new X(this.k(Y()),this.k(Y()),this,this.options)):s=e[i],s._$AI(n),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)===null||s===void 0||s.call(this,!1,!0,e);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cp=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class st{constructor(t,e,s,i,n){this.type=1,this._$AH=m,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,s,i){const n=this.strings;let o=!1;if(n===void 0)t=D(this,t,e,0),o=!G(t)||t!==this._$AH&&t!==k,o&&(this._$AH=t);else{const c=t;let l,h;for(t=n[0],l=0;l<n.length-1;l++)h=D(this,c[s+l],e,l),h===k&&(h=this._$AH[l]),o||(o=!G(h)||h!==this._$AH[l]),h===m?t=m:t!==m&&(t+=(h??"")+n[l+1]),this._$AH[l]=h}o&&!i&&this.j(t)}j(t){t===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class $e extends st{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===m?void 0:t}}const ve=B?B.emptyScript:"";class ye extends st{constructor(){super(...arguments),this.type=4}j(t){t&&t!==m?this.element.setAttribute(this.name,ve):this.element.removeAttribute(this.name)}}class Ae extends st{constructor(t,e,s,i,n){super(t,e,s,i,n),this.type=5}_$AI(t,e=this){var s;if((t=(s=D(this,t,e,0))!==null&&s!==void 0?s:m)===k)return;const i=this._$AH,n=t===m&&i!==m||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==m&&(i===m||n);n&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,s;typeof this._$AH=="function"?this._$AH.call((s=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&s!==void 0?s:this.element,t):this._$AH.handleEvent(t)}}class Ee{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){D(this,t)}}const Wt=et.litHtmlPolyfillSupport;Wt==null||Wt(Q,X),((ut=et.litHtmlVersions)!==null&&ut!==void 0?ut:et.litHtmlVersions=[]).push("2.7.4");const xe=(r,t,e)=>{var s,i;const n=(s=e==null?void 0:e.renderBefore)!==null&&s!==void 0?s:t;let o=n._$litPart$;if(o===void 0){const c=(i=e==null?void 0:e.renderBefore)!==null&&i!==void 0?i:null;n._$litPart$=o=new X(t.insertBefore(Y(),c),c,void 0,e??{})}return o._$AI(r),o};/**
|
|
16
|
+
* @license
|
|
17
|
+
* Copyright 2017 Google LLC
|
|
18
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
+
*/var pt,gt;class Z extends z{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const s=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=s.firstChild),s}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=xe(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return k}}Z.finalized=!0,Z._$litElement$=!0,(pt=globalThis.litElementHydrateSupport)===null||pt===void 0||pt.call(globalThis,{LitElement:Z});const Kt=globalThis.litElementPolyfillSupport;Kt==null||Kt({LitElement:Z}),((gt=globalThis.litElementVersions)!==null&>!==void 0?gt:globalThis.litElementVersions=[]).push("3.3.2");/**
|
|
20
|
+
* @license
|
|
21
|
+
* Copyright 2017 Google LLC
|
|
22
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
+
*/const Se=r=>t=>typeof t=="function"?((e,s)=>(customElements.define(e,s),s))(r,t):((e,s)=>{const{kind:i,elements:n}=s;return{kind:i,elements:n,finisher(o){customElements.define(e,o)}}})(r,t);/**
|
|
24
|
+
* @license
|
|
25
|
+
* Copyright 2017 Google LLC
|
|
26
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
+
*/const be=(r,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(e){e.createProperty(t.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,r)}};function mt(r){return(t,e)=>e!==void 0?((s,i,n)=>{i.constructor.createProperty(n,s)})(r,t,e):be(r,t)}/**
|
|
28
|
+
* @license
|
|
29
|
+
* Copyright 2017 Google LLC
|
|
30
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
+
*/function it(r){return mt({...r,state:!0})}/**
|
|
32
|
+
* @license
|
|
33
|
+
* Copyright 2021 Google LLC
|
|
34
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
35
|
+
*/var _t;((_t=window.HTMLSlotElement)===null||_t===void 0?void 0:_t.prototype.assignedElements)!=null;/**
|
|
36
|
+
* @license
|
|
37
|
+
* Copyright 2021 Google LLC
|
|
38
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
39
|
+
*/function*q(r,t){if(r!==void 0){let e=0;for(const s of r)yield t(s,e++)}}/**
|
|
40
|
+
* @license
|
|
41
|
+
* Copyright 2017 Google LLC
|
|
42
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
43
|
+
*/const we={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Me=r=>(...t)=>({_$litDirective$:r,values:t});class Ce{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}/**
|
|
44
|
+
* @license
|
|
45
|
+
* Copyright 2017 Google LLC
|
|
46
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
|
+
*/class $t extends Ce{constructor(t){if(super(t),this.et=m,t.type!==we.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===m||t==null)return this.ft=void 0,this.et=t;if(t===k)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.ft;this.et=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}$t.directiveName="unsafeHTML",$t.resultType=1;const Vt=Me($t);function b(r){return Array.isArray?Array.isArray(r):Jt(r)==="[object Array]"}const Ie=1/0;function Re(r){if(typeof r=="string")return r;let t=r+"";return t=="0"&&1/r==-Ie?"-0":t}function Oe(r){return r==null?"":Re(r)}function x(r){return typeof r=="string"}function Yt(r){return typeof r=="number"}function Le(r){return r===!0||r===!1||Ne(r)&&Jt(r)=="[object Boolean]"}function Gt(r){return typeof r=="object"}function Ne(r){return Gt(r)&&r!==null}function y(r){return r!=null}function vt(r){return!r.trim().length}function Jt(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}const $s="Extended search is not available",Te="Incorrect 'index' type",ke=r=>`Invalid value for key ${r}`,Pe=r=>`Pattern length exceeds max of ${r}.`,Ue=r=>`Missing ${r} property in key`,He=r=>`Property 'weight' in key '${r}' must be a positive integer`,Qt=Object.prototype.hasOwnProperty;class je{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach(s=>{let i=Xt(s);e+=i.weight,this._keys.push(i),this._keyMap[i.id]=i,e+=i.weight}),this._keys.forEach(s=>{s.weight/=e})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Xt(r){let t=null,e=null,s=null,i=1,n=null;if(x(r)||b(r))s=r,t=Zt(r),e=yt(r);else{if(!Qt.call(r,"name"))throw new Error(Ue("name"));const o=r.name;if(s=o,Qt.call(r,"weight")&&(i=r.weight,i<=0))throw new Error(He(o));t=Zt(o),e=yt(o),n=r.getFn}return{path:t,id:e,weight:i,src:s,getFn:n}}function Zt(r){return b(r)?r:r.split(".")}function yt(r){return b(r)?r.join("."):r}function Fe(r,t){let e=[],s=!1;const i=(n,o,c)=>{if(y(n))if(!o[c])e.push(n);else{let l=o[c];const h=n[l];if(!y(h))return;if(c===o.length-1&&(x(h)||Yt(h)||Le(h)))e.push(Oe(h));else if(b(h)){s=!0;for(let u=0,a=h.length;u<a;u+=1)i(h[u],o,c+1)}else o.length&&i(h,o,c+1)}};return i(r,x(t)?t.split("."):t,0),s?e:e[0]}var f={...{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(r,t)=>r.score===t.score?r.idx<t.idx?-1:1:r.score<t.score?-1:1},...{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},...{location:0,threshold:.6,distance:100},...{useExtendedSearch:!1,getFn:Fe,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const ze=/[^ ]+/g;function Be(r=1,t=3){const e=new Map,s=Math.pow(10,t);return{get(i){const n=i.match(ze).length;if(e.has(n))return e.get(n);const o=1/Math.pow(n,.5*r),c=parseFloat(Math.round(o*s)/s);return e.set(n,c),c},clear(){e.clear()}}}class At{constructor({getFn:t=f.getFn,fieldNormWeight:e=f.fieldNormWeight}={}){this.norm=Be(e,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((e,s)=>{this._keysMap[e.id]=s})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,x(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();x(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}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_addString(t,e){if(!y(t)||vt(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((i,n)=>{let o=i.getFn?i.getFn(t):this.getFn(t,i.path);if(y(o)){if(b(o)){let c=[];const l=[{nestedArrIndex:-1,value:o}];for(;l.length;){const{nestedArrIndex:h,value:u}=l.pop();if(y(u))if(x(u)&&!vt(u)){let a={v:u,i:h,n:this.norm.get(u)};c.push(a)}else b(u)&&u.forEach((a,d)=>{l.push({nestedArrIndex:d,value:a})})}s.$[n]=c}else if(x(o)&&!vt(o)){let c={v:o,n:this.norm.get(o)};s.$[n]=c}}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function qt(r,t,{getFn:e=f.getFn,fieldNormWeight:s=f.fieldNormWeight}={}){const i=new At({getFn:e,fieldNormWeight:s});return i.setKeys(r.map(Xt)),i.setSources(t),i.create(),i}function De(r,{getFn:t=f.getFn,fieldNormWeight:e=f.fieldNormWeight}={}){const{keys:s,records:i}=r,n=new At({getFn:t,fieldNormWeight:e});return n.setKeys(s),n.setIndexRecords(i),n}function rt(r,{errors:t=0,currentLocation:e=0,expectedLocation:s=0,distance:i=f.distance,ignoreLocation:n=f.ignoreLocation}={}){const o=t/r.length;if(n)return o;const c=Math.abs(s-e);return i?o+c/i:c?1:o}function We(r=[],t=f.minMatchCharLength){let e=[],s=-1,i=-1,n=0;for(let o=r.length;n<o;n+=1){let c=r[n];c&&s===-1?s=n:!c&&s!==-1&&(i=n-1,i-s+1>=t&&e.push([s,i]),s=-1)}return r[n-1]&&n-s>=t&&e.push([s,n-1]),e}const U=32;function Ke(r,t,e,{location:s=f.location,distance:i=f.distance,threshold:n=f.threshold,findAllMatches:o=f.findAllMatches,minMatchCharLength:c=f.minMatchCharLength,includeMatches:l=f.includeMatches,ignoreLocation:h=f.ignoreLocation}={}){if(t.length>U)throw new Error(Pe(U));const u=t.length,a=r.length,d=Math.max(0,Math.min(s,a));let p=n,g=d;const $=c>1||l,j=$?Array(a):[];let w;for(;(w=r.indexOf(t,g))>-1;){let A=rt(t,{currentLocation:w,expectedLocation:d,distance:i,ignoreLocation:h});if(p=Math.min(A,p),g=w+u,$){let R=0;for(;R<u;)j[w+R]=1,R+=1}}g=-1;let K=[],F=1,ot=u+a;const gs=1<<u-1;for(let A=0;A<u;A+=1){let R=0,O=ot;for(;R<O;)rt(t,{errors:A,currentLocation:d+O,expectedLocation:d,distance:i,ignoreLocation:h})<=p?R=O:ot=O,O=Math.floor((ot-R)/2+R);ot=O;let le=Math.max(1,d-O+1),Ct=o?a:Math.min(d+O,a)+u,V=Array(Ct+2);V[Ct+1]=(1<<A)-1;for(let E=Ct;E>=le;E-=1){let lt=E-1,ce=e[r.charAt(lt)];if($&&(j[lt]=+!!ce),V[E]=(V[E+1]<<1|1)&ce,A&&(V[E]|=(K[E+1]|K[E])<<1|1|K[E+1]),V[E]&gs&&(F=rt(t,{errors:A,currentLocation:lt,expectedLocation:d,distance:i,ignoreLocation:h}),F<=p)){if(p=F,g=lt,g<=d)break;le=Math.max(1,2*d-g)}}if(rt(t,{errors:A+1,currentLocation:d,expectedLocation:d,distance:i,ignoreLocation:h})>p)break;K=V}const Mt={isMatch:g>=0,score:Math.max(.001,F)};if($){const A=We(j,c);A.length?l&&(Mt.indices=A):Mt.isMatch=!1}return Mt}function Ve(r){let t={};for(let e=0,s=r.length;e<s;e+=1){const i=r.charAt(e);t[i]=(t[i]||0)|1<<s-e-1}return t}class te{constructor(t,{location:e=f.location,threshold:s=f.threshold,distance:i=f.distance,includeMatches:n=f.includeMatches,findAllMatches:o=f.findAllMatches,minMatchCharLength:c=f.minMatchCharLength,isCaseSensitive:l=f.isCaseSensitive,ignoreLocation:h=f.ignoreLocation}={}){if(this.options={location:e,threshold:s,distance:i,includeMatches:n,findAllMatches:o,minMatchCharLength:c,isCaseSensitive:l,ignoreLocation:h},this.pattern=l?t:t.toLowerCase(),this.chunks=[],!this.pattern.length)return;const u=(d,p)=>{this.chunks.push({pattern:d,alphabet:Ve(d),startIndex:p})},a=this.pattern.length;if(a>U){let d=0;const p=a%U,g=a-p;for(;d<g;)u(this.pattern.substr(d,U),d),d+=U;if(p){const $=a-U;u(this.pattern.substr($),$)}}else u(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,includeMatches:s}=this.options;if(e||(t=t.toLowerCase()),this.pattern===t){let g={isMatch:!0,score:0};return s&&(g.indices=[[0,t.length-1]]),g}const{location:i,distance:n,threshold:o,findAllMatches:c,minMatchCharLength:l,ignoreLocation:h}=this.options;let u=[],a=0,d=!1;this.chunks.forEach(({pattern:g,alphabet:$,startIndex:j})=>{const{isMatch:w,score:K,indices:F}=Ke(t,g,$,{location:i+j,distance:n,threshold:o,findAllMatches:c,minMatchCharLength:l,includeMatches:s,ignoreLocation:h});w&&(d=!0),a+=K,w&&F&&(u=[...u,...F])});let p={isMatch:d,score:d?a/this.chunks.length:1};return d&&s&&(p.indices=u),p}}class I{constructor(t){this.pattern=t}static isMultiMatch(t){return ee(t,this.multiRegex)}static isSingleMatch(t){return ee(t,this.singleRegex)}search(){}}function ee(r,t){const e=r.match(t);return e?e[1]:null}class Ye extends I{constructor(t){super(t)}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]}}}class Ge extends I{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const s=t.indexOf(this.pattern)===-1;return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class Je extends I{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 Qe extends I{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 Xe extends I{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 Ze extends I{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 se extends I{constructor(t,{location:e=f.location,threshold:s=f.threshold,distance:i=f.distance,includeMatches:n=f.includeMatches,findAllMatches:o=f.findAllMatches,minMatchCharLength:c=f.minMatchCharLength,isCaseSensitive:l=f.isCaseSensitive,ignoreLocation:h=f.ignoreLocation}={}){super(t),this._bitapSearch=new te(t,{location:e,threshold:s,distance:i,includeMatches:n,findAllMatches:o,minMatchCharLength:c,isCaseSensitive:l,ignoreLocation:h})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class ie extends I{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e=0,s;const i=[],n=this.pattern.length;for(;(s=t.indexOf(this.pattern,e))>-1;)e=s+n,i.push([s,e-1]);const o=!!i.length;return{isMatch:o,score:o?0:1,indices:i}}}const Et=[Ye,ie,Je,Qe,Ze,Xe,Ge,se],re=Et.length,qe=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,ts="|";function es(r,t={}){return r.split(ts).map(e=>{let s=e.trim().split(qe).filter(n=>n&&!!n.trim()),i=[];for(let n=0,o=s.length;n<o;n+=1){const c=s[n];let l=!1,h=-1;for(;!l&&++h<re;){const u=Et[h];let a=u.isMultiMatch(c);a&&(i.push(new u(a,t)),l=!0)}if(!l)for(h=-1;++h<re;){const u=Et[h];let a=u.isSingleMatch(c);if(a){i.push(new u(a,t));break}}}return i})}const ss=new Set([se.type,ie.type]);class is{constructor(t,{isCaseSensitive:e=f.isCaseSensitive,includeMatches:s=f.includeMatches,minMatchCharLength:i=f.minMatchCharLength,ignoreLocation:n=f.ignoreLocation,findAllMatches:o=f.findAllMatches,location:c=f.location,threshold:l=f.threshold,distance:h=f.distance}={}){this.query=null,this.options={isCaseSensitive:e,includeMatches:s,minMatchCharLength:i,findAllMatches:o,ignoreLocation:n,location:c,threshold:l,distance:h},this.pattern=e?t:t.toLowerCase(),this.query=es(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:i}=this.options;t=i?t:t.toLowerCase();let n=0,o=[],c=0;for(let l=0,h=e.length;l<h;l+=1){const u=e[l];o.length=0,n=0;for(let a=0,d=u.length;a<d;a+=1){const p=u[a],{isMatch:g,indices:$,score:j}=p.search(t);if(g){if(n+=1,c+=j,s){const w=p.constructor.type;ss.has(w)?o=[...o,...$]:o.push($)}}else{c=0,n=0,o.length=0;break}}if(n){let a={isMatch:!0,score:c/n};return s&&(a.indices=o),a}}return{isMatch:!1,score:1}}}const xt=[];function rs(...r){xt.push(...r)}function St(r,t){for(let e=0,s=xt.length;e<s;e+=1){let i=xt[e];if(i.condition(r,t))return new i(r,t)}return new te(r,t)}const nt={AND:"$and",OR:"$or"},bt={PATH:"$path",PATTERN:"$val"},wt=r=>!!(r[nt.AND]||r[nt.OR]),ns=r=>!!r[bt.PATH],os=r=>!b(r)&&Gt(r)&&!wt(r),ne=r=>({[nt.AND]:Object.keys(r).map(t=>({[t]:r[t]}))});function oe(r,t,{auto:e=!0}={}){const s=i=>{let n=Object.keys(i);const o=ns(i);if(!o&&n.length>1&&!wt(i))return s(ne(i));if(os(i)){const l=o?i[bt.PATH]:n[0],h=o?i[bt.PATTERN]:i[l];if(!x(h))throw new Error(ke(l));const u={keyId:yt(l),pattern:h};return e&&(u.searcher=St(h,t)),u}let c={children:[],operator:n[0]};return n.forEach(l=>{const h=i[l];b(h)&&h.forEach(u=>{c.children.push(s(u))})}),c};return wt(r)||(r=ne(r)),s(r)}function ls(r,{ignoreFieldNorm:t=f.ignoreFieldNorm}){r.forEach(e=>{let s=1;e.matches.forEach(({key:i,norm:n,score:o})=>{const c=i?i.weight:null;s*=Math.pow(o===0&&c?Number.EPSILON:o,(c||1)*(t?1:n))}),e.score=s})}function cs(r,t){const e=r.matches;t.matches=[],y(e)&&e.forEach(s=>{if(!y(s.indices)||!s.indices.length)return;const{indices:i,value:n}=s;let o={indices:i,value:n};s.key&&(o.key=s.key.src),s.idx>-1&&(o.refIndex=s.idx),t.matches.push(o)})}function hs(r,t){t.score=r.score}function as(r,t,{includeMatches:e=f.includeMatches,includeScore:s=f.includeScore}={}){const i=[];return e&&i.push(cs),s&&i.push(hs),r.map(n=>{const{idx:o}=n,c={item:t[o],refIndex:o};return i.length&&i.forEach(l=>{l(n,c)}),c})}class W{constructor(t,e={},s){this.options={...f,...e},this.options.useExtendedSearch,this._keyStore=new je(this.options.keys),this.setCollection(t,s)}setCollection(t,e){if(this._docs=t,e&&!(e instanceof At))throw new Error(Te);this._myIndex=e||qt(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){y(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const e=[];for(let s=0,i=this._docs.length;s<i;s+=1){const n=this._docs[s];t(n,s)&&(this.removeAt(s),s-=1,i-=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:i,shouldSort:n,sortFn:o,ignoreFieldNorm:c}=this.options;let l=x(t)?x(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return ls(l,{ignoreFieldNorm:c}),n&&l.sort(o),Yt(e)&&e>-1&&(l=l.slice(0,e)),as(l,this._docs,{includeMatches:s,includeScore:i})}_searchStringList(t){const e=St(t,this.options),{records:s}=this._myIndex,i=[];return s.forEach(({v:n,i:o,n:c})=>{if(!y(n))return;const{isMatch:l,score:h,indices:u}=e.searchIn(n);l&&i.push({item:n,idx:o,matches:[{score:h,value:n,norm:c,indices:u}]})}),i}_searchLogical(t){const e=oe(t,this.options),s=(c,l,h)=>{if(!c.children){const{keyId:a,searcher:d}=c,p=this._findMatches({key:this._keyStore.get(a),value:this._myIndex.getValueForItemAtKeyId(l,a),searcher:d});return p&&p.length?[{idx:h,item:l,matches:p}]:[]}const u=[];for(let a=0,d=c.children.length;a<d;a+=1){const p=c.children[a],g=s(p,l,h);if(g.length)u.push(...g);else if(c.operator===nt.AND)return[]}return u},i=this._myIndex.records,n={},o=[];return i.forEach(({$:c,i:l})=>{if(y(c)){let h=s(e,c,l);h.length&&(n[l]||(n[l]={idx:l,item:c,matches:[]},o.push(n[l])),h.forEach(({matches:u})=>{n[l].matches.push(...u)}))}}),o}_searchObjectList(t){const e=St(t,this.options),{keys:s,records:i}=this._myIndex,n=[];return i.forEach(({$:o,i:c})=>{if(!y(o))return;let l=[];s.forEach((h,u)=>{l.push(...this._findMatches({key:h,value:o[u],searcher:e}))}),l.length&&n.push({idx:c,item:o,matches:l})}),n}_findMatches({key:t,value:e,searcher:s}){if(!y(e))return[];let i=[];if(b(e))e.forEach(({v:n,i:o,n:c})=>{if(!y(n))return;const{isMatch:l,score:h,indices:u}=s.searchIn(n);l&&i.push({score:h,key:t,value:n,idx:o,norm:c,indices:u})});else{const{v:n,n:o}=e,{isMatch:c,score:l,indices:h}=s.searchIn(n);c&&i.push({score:l,key:t,value:n,norm:o,indices:h})}return i}}W.version="6.6.2",W.createIndex=qt,W.parseIndex=De,W.config=f,W.parseQuery=oe,rs(is);const us=(r,t="highlight",e="title")=>{const s=(n,o,c)=>{const l=o.split(".");let h;for(h=0;h<l.length-1;h++)n=n[l[h]];n[l[h]]=c},i=(n,o=[])=>{let c="",l=0;return o.forEach(h=>{const u=h[1]+1;c+=[n.substring(l,h[0]),`<mark class="${t}">`,n.substring(h[0],u),"</mark>"].join(""),l=u}),c+=n.substring(l),c};return r.filter(({matches:n})=>n&&n.length).map(({item:n,matches:o})=>{const c={...n};return o.forEach(l=>{l.key===e&&s(c,l.key,i(l.value,l.indices))}),c})},ds=`
|
|
3
48
|
:host {
|
|
4
49
|
display: flex;
|
|
5
50
|
box-sizing: border-box;
|
|
6
51
|
height: 100%;
|
|
7
52
|
overflow: hidden;
|
|
8
53
|
}
|
|
9
|
-
*,
|
|
54
|
+
*,
|
|
55
|
+
*:before,
|
|
56
|
+
*:after {
|
|
10
57
|
box-sizing: inherit;
|
|
11
58
|
}
|
|
12
59
|
form {
|
|
13
60
|
height: 100%;
|
|
61
|
+
width: 100%;
|
|
14
62
|
max-width: 100%;
|
|
15
63
|
display: flex;
|
|
16
64
|
flex-direction: column;
|
|
@@ -63,26 +111,26 @@ details summary {
|
|
|
63
111
|
#details-results[open] summary svg {
|
|
64
112
|
transform: rotate(0deg);
|
|
65
113
|
}
|
|
66
|
-
li span,
|
|
114
|
+
#details-filter li span,
|
|
67
115
|
details summary {
|
|
68
116
|
text-transform: capitalize;
|
|
69
117
|
}
|
|
70
118
|
li,
|
|
71
119
|
label,
|
|
72
120
|
details,
|
|
73
|
-
input[type=checkbox],
|
|
74
|
-
input[type=radio] {
|
|
121
|
+
input[type="checkbox"],
|
|
122
|
+
input[type="radio"] {
|
|
75
123
|
cursor: pointer;
|
|
76
124
|
}
|
|
77
|
-
input[type=checkbox],
|
|
78
|
-
input[type=radio] {
|
|
125
|
+
input[type="checkbox"],
|
|
126
|
+
input[type="radio"] {
|
|
79
127
|
margin: 0;
|
|
80
128
|
margin-right: 0.5rem;
|
|
81
129
|
}
|
|
82
|
-
input[type=text] {
|
|
83
|
-
display: none;
|
|
130
|
+
input[type="text"] {
|
|
84
131
|
width: 100%;
|
|
85
132
|
margin-bottom: 0.5rem;
|
|
133
|
+
padding: 5px 7px;
|
|
86
134
|
}
|
|
87
135
|
section {
|
|
88
136
|
padding-left: 1rem;
|
|
@@ -111,61 +159,113 @@ ul#results li {
|
|
|
111
159
|
overflow-x: hidden;
|
|
112
160
|
overflow-y: auto;
|
|
113
161
|
}
|
|
114
|
-
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
</
|
|
139
|
-
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
162
|
+
`;var fs=Object.defineProperty,ps=Object.getOwnPropertyDescriptor,H=(r,t,e,s)=>{for(var i=s>1?void 0:s?ps(t,e):t,n=r.length-1,o;n>=0;n--)(o=r[n])&&(i=(s?o(t,e,i):o(i))||i);return s&&i&&fs(t,e,i),i};_.EOxItemFilter=class extends Z{constructor(){super(...arguments);M(this,"_fuse");M(this,"_resultAggregation",[]);M(this,"_items",[]);M(this,"_results",[]);M(this,"_filters",{});M(this,"_selectedResult");M(this,"config",{titleProperty:"title",filterProperties:["themes"],aggregateResults:"themes",fuseConfig:{},enableSearch:!0,enableHighlighting:!1,onSelect:()=>{},matchAllWhenEmpty:!0,exclusiveFilters:!1});M(this,"apply",e=>{this._items=e.map((s,i)=>({...s,id:`item-${i}`})),this._fuse=new W(this._items,{minMatchCharLength:3,threshold:.4,distance:50,includeMatches:!0,useExtendedSearch:!0,...this.config.fuseConfig}),this.config.filterProperties.forEach(s=>{const i={};this._items.forEach(n=>{Array.isArray(n[s])?n[s].forEach(o=>{i[o]=void 0}):i[n[s]]=void 0}),this._filters[s]=i}),this.config.matchAllWhenEmpty!==!1&&(this._results=this.sortResults(this._items),this.requestUpdate()),this.config.aggregateResults&&(this._resultAggregation=[...new Set(this._items.reduce((s,i)=>s.concat(i[this.config.aggregateResults]),[]))].sort())})}search(e="",s=this._filters){const i=Object.entries(s).reduce((o,[c,l])=>{const h=u=>{const a={};a[c]=`="${u}"`,o.push(a)};return Object.entries(l).filter(([u,a])=>a).forEach(([u,a])=>h(u)),o},[]);let n;if(!(e.length>2)&&!i.length&&this.config.matchAllWhenEmpty!==!1)n=this._items;else{const o={...e.length>2&&i.length?{$and:[...this.config.fuseConfig.keys.map(l=>({[l]:e})),{$or:i}]}:{$or:[...this.config.fuseConfig.keys.map(l=>({[l]:e})),{$or:i}]}},c=this._fuse.search(o);n=this.config.enableHighlighting?us(c,"highlight",this.config.titleProperty):c.map(l=>l.item)}this._results=this.sortResults(n),this.requestUpdate()}aggregateResults(e,s){return e.filter(i=>{const n=i[this.config.aggregateResults];return Array.isArray(n)?n.includes(s):n===s})}sortResults(e){return[...e].sort((s,i)=>s[this.config.titleProperty]<i[this.config.titleProperty]?-1:1)}toggleFilter(e,s){this.config.exclusiveFilters===!0&&Object.keys(this._filters).forEach(n=>{Object.keys(this._filters[n]).forEach(o=>{this._filters[n][o]=!1})}),this._filters[e][s]=!this._filters[e][s],this.search();const i=this.renderRoot.querySelectorAll("ul#results input[type='radio']");for(let n=0;n<i.length;n++)i[n].checked=!1;setTimeout(()=>{const n=this.renderRoot.querySelector(`#${this._selectedResult.id}`);n&&(n.checked=!0,this.requestUpdate())})}render(){return T`
|
|
163
|
+
<style>
|
|
164
|
+
${ds}
|
|
165
|
+
</style>
|
|
166
|
+
<form>
|
|
167
|
+
<section>
|
|
168
|
+
<input
|
|
169
|
+
type="text"
|
|
170
|
+
placeholder="Search"
|
|
171
|
+
style="display:${this.config.enableSearch?"block":"none"}"
|
|
172
|
+
@input="${e=>this.search(e.target.value)}"
|
|
173
|
+
/>
|
|
174
|
+
</section>
|
|
175
|
+
<section>
|
|
176
|
+
<slot name="filterstitle"></slot>
|
|
177
|
+
<ul id="filters">
|
|
178
|
+
${q(this.config.filterProperties,e=>T`
|
|
179
|
+
<details
|
|
180
|
+
id="details-filter"
|
|
181
|
+
data-filter="${e}"
|
|
182
|
+
@click=${()=>this.renderRoot.querySelectorAll("details#details-filter").forEach(s=>{s.getAttribute("data-filter")!==e&&(s.removeAttribute("open"),this.requestUpdate())})}
|
|
183
|
+
>
|
|
184
|
+
<summary>
|
|
185
|
+
<small>
|
|
186
|
+
<strong class="title"> ${e} </strong>
|
|
187
|
+
</small>
|
|
188
|
+
<div>
|
|
189
|
+
<svg
|
|
190
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
191
|
+
viewBox="0 0 24 24"
|
|
192
|
+
>
|
|
193
|
+
<title>chevron-down</title>
|
|
194
|
+
<path
|
|
195
|
+
d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"
|
|
196
|
+
/>
|
|
197
|
+
</svg>
|
|
198
|
+
</div>
|
|
199
|
+
</summary>
|
|
200
|
+
<div class="scroll" style="max-height: 150px">
|
|
201
|
+
<ul>
|
|
202
|
+
${this._filters[e]?q(Object.keys(this._filters[e]).sort(),s=>T`
|
|
203
|
+
<li>
|
|
204
|
+
<label>
|
|
205
|
+
<input
|
|
206
|
+
name="selection"
|
|
207
|
+
type="${this.config.exclusiveFilters===!0?"radio":"checkbox"}"
|
|
208
|
+
checked="${this._filters[e][s]||m}"
|
|
209
|
+
@click=${()=>this.toggleFilter(e,s)}
|
|
210
|
+
/>
|
|
211
|
+
<span class="title">${s}</span>
|
|
212
|
+
</label>
|
|
213
|
+
</li>
|
|
214
|
+
`):null}
|
|
215
|
+
</ul>
|
|
216
|
+
</div>
|
|
217
|
+
</details>
|
|
218
|
+
`)}
|
|
219
|
+
</ul>
|
|
220
|
+
</section>
|
|
221
|
+
<section id="section-results">
|
|
222
|
+
<div>
|
|
223
|
+
<slot name="resultstitle"></slot>
|
|
224
|
+
</div>
|
|
225
|
+
<div id="container-results" class="scroll">
|
|
226
|
+
${this._results.length<1?T` <small class="no-results">No matching items</small> `:m}
|
|
227
|
+
<ul id="results">
|
|
228
|
+
${this.config.aggregateResults?q(this._resultAggregation.filter(e=>this.aggregateResults(this._results,e).length),e=>T`<details
|
|
229
|
+
id="details-results"
|
|
230
|
+
open
|
|
231
|
+
>
|
|
232
|
+
<summary>
|
|
233
|
+
<svg
|
|
234
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
235
|
+
viewBox="0 0 24 24"
|
|
236
|
+
>
|
|
237
|
+
<title>chevron-down</title>
|
|
238
|
+
<path
|
|
239
|
+
d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"
|
|
240
|
+
/>
|
|
241
|
+
</svg>
|
|
242
|
+
<strong class="title"> ${e} </strong>
|
|
243
|
+
<span style="margin-left: 0.25rem"
|
|
244
|
+
>(${this.aggregateResults(this._results,e).length})</span
|
|
245
|
+
>
|
|
246
|
+
</summary>
|
|
247
|
+
<ul>
|
|
248
|
+
${q(this.aggregateResults(this._results,e),s=>T`
|
|
249
|
+
<li>
|
|
250
|
+
<label>
|
|
251
|
+
<input
|
|
252
|
+
type="radio"
|
|
253
|
+
name="result"
|
|
254
|
+
id="${s.id}"
|
|
255
|
+
@click=${()=>{this._selectedResult=s,this.config.onSelect(s)}}
|
|
256
|
+
/>
|
|
257
|
+
<span class="title"
|
|
258
|
+
>${Vt(s[this.config.titleProperty])}</span
|
|
259
|
+
>
|
|
260
|
+
</label>
|
|
261
|
+
</li>
|
|
262
|
+
`)}
|
|
263
|
+
</ul>
|
|
264
|
+
</details>`):q(this._results,e=>T`<li>
|
|
265
|
+
${Vt(e[this.config.titleProperty])}
|
|
266
|
+
</li>`)}
|
|
267
|
+
</ul>
|
|
268
|
+
</div>
|
|
269
|
+
</section>
|
|
270
|
+
</form>
|
|
271
|
+
`}},H([it()],_.EOxItemFilter.prototype,"_items",2),H([it()],_.EOxItemFilter.prototype,"_results",2),H([it()],_.EOxItemFilter.prototype,"_filters",2),H([it()],_.EOxItemFilter.prototype,"_selectedResult",2),H([mt({attribute:!1})],_.EOxItemFilter.prototype,"config",2),H([mt()],_.EOxItemFilter.prototype,"apply",2),_.EOxItemFilter=H([Se("eox-itemfilter")],_.EOxItemFilter),Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/itemfilter",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@eox/eslint-config": "^1.0.0",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"watch": "tsc && vite build --watch"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"fuse.js": "^6.6.2"
|
|
28
|
+
"fuse.js": "^6.6.2",
|
|
29
|
+
"lit": "^2.7.4"
|
|
29
30
|
}
|
|
30
31
|
}
|
package/test/general.cy.ts
CHANGED
|
@@ -10,13 +10,17 @@ describe("Item Filter", () => {
|
|
|
10
10
|
cy.get("eox-itemfilter").should(($el) => {
|
|
11
11
|
const EOxItemFilter = <EOxItemFilter>$el[0];
|
|
12
12
|
EOxItemFilter.config = {
|
|
13
|
-
|
|
13
|
+
titleProperty: "title",
|
|
14
|
+
filterProperties: ["themes", "code", "description"],
|
|
14
15
|
aggregateResults: "themes",
|
|
15
16
|
enableSearch: true,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
enableHighlighting: true,
|
|
18
|
+
fuseConfig: {
|
|
19
|
+
keys: ["title", "description", "themes"],
|
|
20
|
+
},
|
|
21
|
+
onSelect: (item: any) => {
|
|
22
|
+
console.log(item);
|
|
23
|
+
},
|
|
20
24
|
// matchAllWhenEmpty: true,
|
|
21
25
|
// exclusiveFilters: true,
|
|
22
26
|
};
|
package/test/reducedWidth.cy.ts
CHANGED
|
@@ -10,6 +10,7 @@ describe("Item Filter", () => {
|
|
|
10
10
|
cy.get("eox-itemfilter").should(($el) => {
|
|
11
11
|
const EOxItemFilter = <EOxItemFilter>$el[0];
|
|
12
12
|
EOxItemFilter.config = {
|
|
13
|
+
titleProperty: "title",
|
|
13
14
|
filterProperties: ["themes"],
|
|
14
15
|
aggregateResults: "themes",
|
|
15
16
|
enableSearch: true,
|
package/test/testItems.json
CHANGED
|
@@ -2,142 +2,182 @@
|
|
|
2
2
|
{
|
|
3
3
|
"archived": false,
|
|
4
4
|
"code": "E10a2",
|
|
5
|
+
"description": "Actively managed total area from Sentinel-2 data",
|
|
5
6
|
"indicator": "Actively managed total area from Sentinel-2 data",
|
|
6
7
|
"themes": ["agriculture"],
|
|
8
|
+
"title": "White Asparagus area [%]",
|
|
7
9
|
"name": "Actively managed total area from Sentinel-2 data"
|
|
8
10
|
},
|
|
9
11
|
{
|
|
10
12
|
"archived": false,
|
|
11
13
|
"code": "E10a9",
|
|
14
|
+
"description": "Agricultural Workers",
|
|
12
15
|
"indicator": "Agricultural Workers",
|
|
13
16
|
"themes": ["agriculture"],
|
|
17
|
+
"title": "Workers availability [nr]",
|
|
14
18
|
"name": "Agricultural Workers"
|
|
15
19
|
},
|
|
16
20
|
{
|
|
17
21
|
"archived": false,
|
|
18
22
|
"code": "N1",
|
|
23
|
+
"description": "Air Quality",
|
|
19
24
|
"indicator": "Air Quality",
|
|
20
25
|
"themes": ["air"],
|
|
26
|
+
"title": "City level NO2 (S5p)",
|
|
21
27
|
"name": "Air Quality"
|
|
22
28
|
},
|
|
23
29
|
{
|
|
24
30
|
"archived": false,
|
|
25
31
|
"code": "E13o",
|
|
32
|
+
"description": "Average number of vessels in a km2 cell in a given period",
|
|
26
33
|
"indicator": "Average number of vessels in a km2 cell in a given period",
|
|
27
34
|
"themes": ["economy"],
|
|
35
|
+
"title": "Vessel density (all) [h/sqkm]",
|
|
28
36
|
"name": "Average number of vessels in a km2 cell in a given period"
|
|
29
37
|
},
|
|
30
38
|
{
|
|
31
39
|
"archived": false,
|
|
32
40
|
"code": "E13p",
|
|
41
|
+
"description": "Average number of vessels in a km2 cell in a given period",
|
|
33
42
|
"indicator": "Average number of vessels in a km2 cell in a given period",
|
|
34
43
|
"themes": ["economy"],
|
|
44
|
+
"title": "Vessel density (cargo) [h/sqkm]",
|
|
35
45
|
"name": "Average number of vessels in a km2 cell in a given period"
|
|
36
46
|
},
|
|
37
47
|
{
|
|
38
48
|
"archived": false,
|
|
39
49
|
"code": "E13q",
|
|
50
|
+
"description": "Average number of vessels in a km2 cell in a given period",
|
|
40
51
|
"indicator": "Average number of vessels in a km2 cell in a given period",
|
|
41
52
|
"themes": ["economy"],
|
|
53
|
+
"title": "Vessel density (tanker) [h/sqkm]",
|
|
42
54
|
"name": "Average number of vessels in a km2 cell in a given period"
|
|
43
55
|
},
|
|
44
56
|
{
|
|
45
57
|
"archived": false,
|
|
46
58
|
"code": "E13r",
|
|
59
|
+
"description": "Average number of vessels in a km2 cell in a given period",
|
|
47
60
|
"indicator": "Average number of vessels in a km2 cell in a given period",
|
|
48
61
|
"themes": ["economy"],
|
|
62
|
+
"title": "Vessel density (others) [h/sqkm]",
|
|
49
63
|
"name": "Average number of vessels in a km2 cell in a given period"
|
|
50
64
|
},
|
|
51
65
|
{
|
|
52
66
|
"archived": false,
|
|
53
67
|
"code": "C1",
|
|
68
|
+
"description": "Boat traffic - NO2 level",
|
|
54
69
|
"indicator": "Boat traffic - NO2 level",
|
|
55
70
|
"themes": ["economy", "air"],
|
|
71
|
+
"title": "Ships - NO2 Correlation",
|
|
56
72
|
"indicatorOverwrite": "Ports and Shipping - impact on air quality",
|
|
57
73
|
"name": "Boat traffic - NO2 level"
|
|
58
74
|
},
|
|
59
75
|
{
|
|
60
76
|
"archived": false,
|
|
61
77
|
"code": "CDS1",
|
|
78
|
+
"description": "C3S Data",
|
|
62
79
|
"indicator": "C3S Data",
|
|
63
80
|
"themes": ["air"],
|
|
81
|
+
"title": "Temperature",
|
|
64
82
|
"name": "C3S Data"
|
|
65
83
|
},
|
|
66
84
|
{
|
|
67
85
|
"archived": false,
|
|
68
86
|
"code": "N1a",
|
|
87
|
+
"description": "CAMS Air Quality",
|
|
69
88
|
"indicator": "CAMS Air Quality",
|
|
70
89
|
"themes": ["air"],
|
|
90
|
+
"title": "City level PM2.5 (model)",
|
|
71
91
|
"name": "CAMS Air Quality"
|
|
72
92
|
},
|
|
73
93
|
{
|
|
74
94
|
"archived": false,
|
|
75
95
|
"code": "N1b",
|
|
96
|
+
"description": "CAMS Air Quality",
|
|
76
97
|
"indicator": "CAMS Air Quality",
|
|
77
98
|
"themes": ["air"],
|
|
99
|
+
"title": "City level NO2 (model)",
|
|
78
100
|
"name": "CAMS Air Quality"
|
|
79
101
|
},
|
|
80
102
|
{
|
|
81
103
|
"archived": false,
|
|
82
104
|
"code": "N1c",
|
|
105
|
+
"description": "CAMS Air Quality",
|
|
83
106
|
"indicator": "CAMS Air Quality",
|
|
84
107
|
"themes": ["air"],
|
|
108
|
+
"title": "City level PM10 (model)",
|
|
85
109
|
"name": "CAMS Air Quality"
|
|
86
110
|
},
|
|
87
111
|
{
|
|
88
112
|
"archived": false,
|
|
89
113
|
"code": "N1d",
|
|
114
|
+
"description": "CAMS Air Quality",
|
|
90
115
|
"indicator": "CAMS Air Quality",
|
|
91
116
|
"themes": ["air"],
|
|
117
|
+
"title": "City level O3 (model)",
|
|
92
118
|
"name": "CAMS Air Quality"
|
|
93
119
|
},
|
|
94
120
|
{
|
|
95
121
|
"archived": false,
|
|
96
122
|
"code": "E13e",
|
|
123
|
+
"description": "Cargo ships in port based on AIS data",
|
|
97
124
|
"indicator": "Cargo ships in port based on AIS data",
|
|
98
125
|
"themes": ["economy"],
|
|
126
|
+
"title": "Cargo Ships [nr]",
|
|
99
127
|
"name": "Cargo ships in port based on AIS data"
|
|
100
128
|
},
|
|
101
129
|
{
|
|
102
130
|
"archived": false,
|
|
103
131
|
"code": "E13n",
|
|
132
|
+
"description": "Changes in traffic based on mobile data",
|
|
104
133
|
"indicator": "Changes in traffic based on mobile data",
|
|
105
134
|
"themes": ["economy"],
|
|
135
|
+
"title": "Trucks transiting ports [%]",
|
|
106
136
|
"name": "Changes in traffic based on mobile data"
|
|
107
137
|
},
|
|
108
138
|
{
|
|
109
139
|
"archived": false,
|
|
110
140
|
"code": "N3c",
|
|
141
|
+
"description": "CMEMS product",
|
|
111
142
|
"indicator": "CMEMS product",
|
|
112
143
|
"themes": ["water"],
|
|
144
|
+
"title": "CHL-a concentration (map, 1km)",
|
|
113
145
|
"name": "CMEMS product"
|
|
114
146
|
},
|
|
115
147
|
{
|
|
116
148
|
"archived": false,
|
|
117
149
|
"code": "CV",
|
|
150
|
+
"description": "Covid-19 cases",
|
|
118
151
|
"indicator": "Covid-19 cases",
|
|
119
152
|
"themes": ["health"],
|
|
153
|
+
"title": "Covid-19 cases",
|
|
120
154
|
"name": "Covid-19 cases"
|
|
121
155
|
},
|
|
122
156
|
{
|
|
123
157
|
"archived": false,
|
|
124
158
|
"code": "OW",
|
|
159
|
+
"description": "Covid-19 vaccinations",
|
|
125
160
|
"indicator": "Covid-19 vaccinations",
|
|
126
161
|
"themes": ["health"],
|
|
162
|
+
"title": "Covid-19 vaccinations",
|
|
127
163
|
"name": "Covid-19 vaccinations"
|
|
128
164
|
},
|
|
129
165
|
{
|
|
130
166
|
"archived": false,
|
|
131
167
|
"code": "E3",
|
|
168
|
+
"description": "Crude Oil and other input materials",
|
|
132
169
|
"indicator": "Crude Oil and other input materials",
|
|
133
170
|
"themes": ["economy"],
|
|
171
|
+
"title": "Raw Material Inventory",
|
|
134
172
|
"name": "Crude Oil and other input materials"
|
|
135
173
|
},
|
|
136
174
|
{
|
|
137
175
|
"archived": false,
|
|
138
176
|
"code": "E13l",
|
|
177
|
+
"description": "Cruise ships in port based on AIS data",
|
|
139
178
|
"indicator": "Cruise ships in port based on AIS data",
|
|
140
179
|
"themes": ["economy"],
|
|
180
|
+
"title": "Cruise Ships [nr]",
|
|
141
181
|
"name": "Cruise ships in port based on AIS data"
|
|
142
182
|
}
|
|
143
183
|
]
|