@eox/itemfilter 0.2.2 → 0.3.0
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 +872 -623
- package/dist/eox-itemfilter.umd.cjs +175 -124
- package/package.json +7 -3
- package/test/config.cy.ts +161 -0
- package/test/general.cy.ts +23 -4
- package/test/inlineMode.cy.ts +24 -0
- package/test/styledResults.cy.ts +21 -0
- package/test/styledResults.html +45 -0
|
@@ -1,55 +1,58 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(v,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(v=typeof globalThis<"u"?globalThis:v||self,E(v["eox-itemfilter"]={}))})(this,function(v){"use strict";var Bs=Object.defineProperty;var Ws=(v,E,C)=>E in v?Bs(v,E,{enumerable:!0,configurable:!0,writable:!0,value:C}):v[E]=C;var _=(v,E,C)=>(Ws(v,typeof E!="symbol"?E+"":E,C),C);/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const
|
|
5
|
+
*/const E=window,C=E.ShadowRoot&&(E.ShadyCSS===void 0||E.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Lt=Symbol(),Nt=new WeakMap;let _e=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==Lt)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(C&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=Nt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Nt.set(e,t))}return t}toString(){return this.cssText}};const $e=i=>new _e(typeof i=="string"?i:i+"",void 0,Lt),ye=(i,t)=>{C?i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const s=document.createElement("style"),n=E.litNonce;n!==void 0&&s.setAttribute("nonce",n),s.textContent=e.cssText,i.appendChild(s)})},Pt=C?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return $e(e)})(i):i;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/var
|
|
9
|
+
*/var dt;const nt=window,jt=nt.trustedTypes,ve=jt?jt.emptyScript:"",Ht=nt.reactiveElementPolyfillSupport,ft={toAttribute(i,t){switch(t){case Boolean:i=i?ve:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},Ut=(i,t)=>t!==i&&(t==t||i==i),pt={attribute:!0,type:String,converter:ft,reflect:!1,hasChanged:Ut};let B=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 n=this._$Ep(s,e);n!==void 0&&(this._$Ev.set(n,s),t.push(n))}),t}static createProperty(t,e=pt){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,n=this.getPropertyDescriptor(t,s,e);n!==void 0&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,s){return{get(){return this[e]},set(n){const r=this[t];this[e]=n,this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||pt}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 n of s)this.createProperty(n,e[n])}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 n of s)e.unshift(Pt(n))}else t!==void 0&&e.push(Pt(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 ye(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=pt){var n;const r=this.constructor._$Ep(t,s);if(r!==void 0&&s.reflect===!0){const o=(((n=s.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?s.converter:ft).toAttribute(e,s.type);this._$El=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$El=null}}_$AK(t,e){var s;const n=this.constructor,r=n._$Ev.get(t);if(r!==void 0&&this._$El!==r){const o=n.getPropertyOptions(r),c=typeof o.converter=="function"?{fromAttribute:o.converter}:((s=o.converter)===null||s===void 0?void 0:s.fromAttribute)!==void 0?o.converter:ft;this._$El=r,this[r]=c.fromAttribute(e,o.type),this._$El=null}}requestUpdate(t,e,s){let n=!0;t!==void 0&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||Ut)(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))):n=!1),!this.isUpdatePending&&n&&(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((n,r)=>this[r]=n),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(n=>{var r;return(r=n.hostUpdate)===null||r===void 0?void 0:r.call(n)}),this.update(s)):this._$Ek()}catch(n){throw e=!1,this._$Ek(),n}e&&this._$AE(s)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach(s=>{var n;return(n=s.hostUpdated)===null||n===void 0?void 0:n.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){}};B.finalized=!0,B.elementProperties=new Map,B.elementStyles=[],B.shadowRootOptions={mode:"open"},Ht==null||Ht({ReactiveElement:B}),((dt=nt.reactiveElementVersions)!==null&&dt!==void 0?dt:nt.reactiveElementVersions=[]).push("1.6.1");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/var
|
|
14
|
-
\f\r]`,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
13
|
+
*/var gt;const rt=window,W=rt.trustedTypes,Ft=W?W.createPolicy("lit-html",{createHTML:i=>i}):void 0,mt="$lit$",N=`lit$${(Math.random()+"").slice(9)}$`,Dt="?"+N,Ae=`<${Dt}>`,j=document,q=()=>j.createComment(""),J=i=>i===null||typeof i!="object"&&typeof i!="function",zt=Array.isArray,Ee=i=>zt(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",_t=`[
|
|
14
|
+
\f\r]`,X=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Bt=/-->/g,Wt=/>/g,H=RegExp(`>|${_t}(?:([^\\s"'>=/]+)(${_t}*=${_t}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Vt=/'/g,Kt=/"/g,Gt=/^(?:script|style|textarea|title)$/i,be=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),w=be(1),U=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Yt=new WeakMap,F=j.createTreeWalker(j,129,null,!1),xe=(i,t)=>{const e=i.length-1,s=[];let n,r=t===2?"<svg>":"",o=X;for(let l=0;l<e;l++){const a=i[l];let u,h,d=-1,p=0;for(;p<a.length&&(o.lastIndex=p,h=o.exec(a),h!==null);)p=o.lastIndex,o===X?h[1]==="!--"?o=Bt:h[1]!==void 0?o=Wt:h[2]!==void 0?(Gt.test(h[2])&&(n=RegExp("</"+h[2],"g")),o=H):h[3]!==void 0&&(o=H):o===H?h[0]===">"?(o=n??X,d=-1):h[1]===void 0?d=-2:(d=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?H:h[3]==='"'?Kt:Vt):o===Kt||o===Vt?o=H:o===Bt||o===Wt?o=X:(o=H,n=void 0);const g=o===H&&i[l+1].startsWith("/>")?" ":"";r+=o===X?a+Ae:d>=0?(s.push(u),a.slice(0,d)+mt+a.slice(d)+N+g):a+N+(d===-2?(s.push(void 0),l):g)}const c=r+(i[e]||"<?>")+(t===2?"</svg>":"");if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return[Ft!==void 0?Ft.createHTML(c):c,s]};class Q{constructor({strings:t,_$litType$:e},s){let n;this.parts=[];let r=0,o=0;const c=t.length-1,l=this.parts,[a,u]=xe(t,e);if(this.el=Q.createElement(a,s),F.currentNode=this.el.content,e===2){const h=this.el.content,d=h.firstChild;d.remove(),h.append(...d.childNodes)}for(;(n=F.nextNode())!==null&&l.length<c;){if(n.nodeType===1){if(n.hasAttributes()){const h=[];for(const d of n.getAttributeNames())if(d.endsWith(mt)||d.startsWith(N)){const p=u[o++];if(h.push(d),p!==void 0){const g=n.getAttribute(p.toLowerCase()+mt).split(N),A=/([.?@])?(.*)/.exec(p);l.push({type:1,index:r,name:A[2],strings:g,ctor:A[1]==="."?we:A[1]==="?"?Ie:A[1]==="@"?Oe:ot})}else l.push({type:6,index:r})}for(const d of h)n.removeAttribute(d)}if(Gt.test(n.tagName)){const h=n.textContent.split(N),d=h.length-1;if(d>0){n.textContent=W?W.emptyScript:"";for(let p=0;p<d;p++)n.append(h[p],q()),F.nextNode(),l.push({type:2,index:++r});n.append(h[d],q())}}}else if(n.nodeType===8)if(n.data===Dt)l.push({type:2,index:r});else{let h=-1;for(;(h=n.data.indexOf(N,h+1))!==-1;)l.push({type:7,index:r}),h+=N.length-1}r++}}static createElement(t,e){const s=j.createElement("template");return s.innerHTML=t,s}}function V(i,t,e=i,s){var n,r,o,c;if(t===U)return t;let l=s!==void 0?(n=e._$Co)===null||n===void 0?void 0:n[s]:e._$Cl;const a=J(t)?void 0:t._$litDirective$;return(l==null?void 0:l.constructor)!==a&&((r=l==null?void 0:l._$AO)===null||r===void 0||r.call(l,!1),a===void 0?l=void 0:(l=new a(i),l._$AT(i,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=V(i,l._$AS(i,t.values),l,s)),t}class Se{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:n}=this._$AD,r=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:j).importNode(s,!0);F.currentNode=r;let o=F.nextNode(),c=0,l=0,a=n[0];for(;a!==void 0;){if(c===a.index){let u;a.type===2?u=new Z(o,o.nextSibling,this,t):a.type===1?u=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(u=new Re(o,this,t)),this._$AV.push(u),a=n[++l]}c!==(a==null?void 0:a.index)&&(o=F.nextNode(),c++)}return F.currentNode=j,r}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 Z{constructor(t,e,s,n){var r;this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cp=(r=n==null?void 0:n.isConnected)===null||r===void 0||r}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=V(this,t,e),J(t)?t===m||t==null||t===""?(this._$AH!==m&&this._$AR(),this._$AH=m):t!==this._$AH&&t!==U&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Ee(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&&J(this._$AH)?this._$AA.nextSibling.data=t:this.$(j.createTextNode(t)),this._$AH=t}g(t){var e;const{values:s,_$litType$:n}=t,r=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=Q.createElement(n.h,this.options)),n);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===r)this._$AH.v(s);else{const o=new Se(r,this),c=o.u(this.options);o.v(s),this.$(c),this._$AH=o}}_$AC(t){let e=Yt.get(t.strings);return e===void 0&&Yt.set(t.strings,e=new Q(t)),e}T(t){zt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const r of t)n===e.length?e.push(s=new Z(this.k(q()),this.k(q()),this,this.options)):s=e[n],s._$AI(r),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$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 n=t.nextSibling;t.remove(),t=n}}setConnected(t){var e;this._$AM===void 0&&(this._$Cp=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class ot{constructor(t,e,s,n,r){this.type=1,this._$AH=m,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=r,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,n){const r=this.strings;let o=!1;if(r===void 0)t=V(this,t,e,0),o=!J(t)||t!==this._$AH&&t!==U,o&&(this._$AH=t);else{const c=t;let l,a;for(t=r[0],l=0;l<r.length-1;l++)a=V(this,c[s+l],e,l),a===U&&(a=this._$AH[l]),o||(o=!J(a)||a!==this._$AH[l]),a===m?t=m:t!==m&&(t+=(a??"")+r[l+1]),this._$AH[l]=a}o&&!n&&this.j(t)}j(t){t===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class we extends ot{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===m?void 0:t}}const Me=W?W.emptyScript:"";class Ie extends ot{constructor(){super(...arguments),this.type=4}j(t){t&&t!==m?this.element.setAttribute(this.name,Me):this.element.removeAttribute(this.name)}}class Oe extends ot{constructor(t,e,s,n,r){super(t,e,s,n,r),this.type=5}_$AI(t,e=this){var s;if((t=(s=V(this,t,e,0))!==null&&s!==void 0?s:m)===U)return;const n=this._$AH,r=t===m&&n!==m||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,o=t!==m&&(n===m||r);r&&this.element.removeEventListener(this.name,this,n),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 Re{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){V(this,t)}}const qt=rt.litHtmlPolyfillSupport;qt==null||qt(Q,Z),((gt=rt.litHtmlVersions)!==null&>!==void 0?gt:rt.litHtmlVersions=[]).push("2.7.4");const Ce=(i,t,e)=>{var s,n;const r=(s=e==null?void 0:e.renderBefore)!==null&&s!==void 0?s:t;let o=r._$litPart$;if(o===void 0){const c=(n=e==null?void 0:e.renderBefore)!==null&&n!==void 0?n:null;r._$litPart$=o=new Z(t.insertBefore(q(),c),c,void 0,e??{})}return o._$AI(i),o};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/var
|
|
19
|
+
*/var $t,yt;class tt extends B{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=Ce(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 U}}tt.finalized=!0,tt._$litElement$=!0,($t=globalThis.litElementHydrateSupport)===null||$t===void 0||$t.call(globalThis,{LitElement:tt});const Jt=globalThis.litElementPolyfillSupport;Jt==null||Jt({LitElement:tt}),((yt=globalThis.litElementVersions)!==null&&yt!==void 0?yt:globalThis.litElementVersions=[]).push("3.3.2");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/const
|
|
23
|
+
*/const Te=i=>t=>typeof t=="function"?((e,s)=>(customElements.define(e,s),s))(i,t):((e,s)=>{const{kind:n,elements:r}=s;return{kind:n,elements:r,finisher(o){customElements.define(e,o)}}})(i,t);/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const
|
|
27
|
+
*/const ke=(i,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(e){e.createProperty(t.key,i)}}:{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,i)}};function vt(i){return(t,e)=>e!==void 0?((s,n,r)=>{n.constructor.createProperty(r,s)})(i,t,e):ke(i,t)}/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2017 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/function
|
|
31
|
+
*/function lt(i){return vt({...i,state:!0})}/**
|
|
32
32
|
* @license
|
|
33
33
|
* Copyright 2021 Google LLC
|
|
34
34
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
35
|
-
*/var
|
|
35
|
+
*/var At;((At=window.HTMLSlotElement)===null||At===void 0?void 0:At.prototype.assignedElements)!=null;/**
|
|
36
36
|
* @license
|
|
37
37
|
* Copyright 2021 Google LLC
|
|
38
38
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
39
|
-
*/function
|
|
39
|
+
*/function et(i,t,e){return i?t():e==null?void 0:e()}/**
|
|
40
|
+
* @license
|
|
41
|
+
* Copyright 2021 Google LLC
|
|
42
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
43
|
+
*/function*st(i,t){if(i!==void 0){let e=0;for(const s of i)yield t(s,e++)}}/**
|
|
40
44
|
* @license
|
|
41
45
|
* Copyright 2017 Google LLC
|
|
42
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
43
|
-
*/const
|
|
47
|
+
*/const Le={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ne=i=>(...t)=>({_$litDirective$:i,values:t});class Pe{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
48
|
* @license
|
|
45
49
|
* Copyright 2017 Google LLC
|
|
46
50
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
|
-
*/class $t extends Re{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===T)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 Ce=1/0;function Ie(r){if(typeof r=="string")return r;let t=r+"";return t=="0"&&1/r==-Ce?"-0":t}function Oe(r){return r==null?"":Ie(r)}function x(r){return typeof r=="string"}function Yt(r){return typeof r=="number"}function Le(r){return r===!0||r===!1||ke(r)&&Jt(r)=="[object Boolean]"}function Gt(r){return typeof r=="object"}function ke(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",Ne="Incorrect 'index' type",Te=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 Fe{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 je(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:je,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,F=$?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 I=0;for(;I<u;)F[w+I]=1,I+=1}}g=-1;let K=[],j=1,ot=u+a;const gs=1<<u-1;for(let A=0;A<u;A+=1){let I=0,O=ot;for(;I<O;)rt(t,{errors:A,currentLocation:d+O,expectedLocation:d,distance:i,ignoreLocation:h})<=p?I=O:ot=O,O=Math.floor((ot-I)/2+I);ot=O;let le=Math.max(1,d-O+1),Rt=o?a:Math.min(d+O,a)+u,V=Array(Rt+2);V[Rt+1]=(1<<A)-1;for(let E=Rt;E>=le;E-=1){let lt=E-1,ce=e[r.charAt(lt)];if($&&(F[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&&(j=rt(t,{errors:A,currentLocation:lt,expectedLocation:d,distance:i,ignoreLocation:h}),j<=p)){if(p=j,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,j)};if($){const A=We(F,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:F})=>{const{isMatch:w,score:K,indices:j}=Ke(t,g,$,{location:i+F,distance:n,threshold:o,findAllMatches:c,minMatchCharLength:l,includeMatches:s,ignoreLocation:h});w&&(d=!0),a+=K,w&&j&&(u=[...u,...j])});let p={isMatch:d,score:d?a/this.chunks.length:1};return d&&s&&(p.indices=u),p}}class C{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 C{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 C{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 C{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 C{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 C{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 C{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 C{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 C{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:F}=p.search(t);if(g){if(n+=1,c+=F,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(Te(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 Fe(this.options.keys),this.setCollection(t,s)}setCollection(t,e){if(this._docs=t,e&&!(e instanceof At))throw new Error(Ne);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=`
|
|
51
|
+
*/class Et extends Pe{constructor(t){if(super(t),this.et=m,t.type!==Le.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===U)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:[]}}}Et.directiveName="unsafeHTML",Et.resultType=1;const Xt=Ne(Et);function T(i){return Array.isArray?Array.isArray(i):te(i)==="[object Array]"}const je=1/0;function He(i){if(typeof i=="string")return i;let t=i+"";return t=="0"&&1/i==-je?"-0":t}function Ue(i){return i==null?"":He(i)}function O(i){return typeof i=="string"}function Qt(i){return typeof i=="number"}function Fe(i){return i===!0||i===!1||De(i)&&te(i)=="[object Boolean]"}function Zt(i){return typeof i=="object"}function De(i){return Zt(i)&&i!==null}function S(i){return i!=null}function bt(i){return!i.trim().length}function te(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const Vs="Extended search is not available",ze="Incorrect 'index' type",Be=i=>`Invalid value for key ${i}`,We=i=>`Pattern length exceeds max of ${i}.`,Ve=i=>`Missing ${i} property in key`,Ke=i=>`Property 'weight' in key '${i}' must be a positive integer`,ee=Object.prototype.hasOwnProperty;class Ge{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach(s=>{let n=se(s);e+=n.weight,this._keys.push(n),this._keyMap[n.id]=n,e+=n.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 se(i){let t=null,e=null,s=null,n=1,r=null;if(O(i)||T(i))s=i,t=ie(i),e=xt(i);else{if(!ee.call(i,"name"))throw new Error(Ve("name"));const o=i.name;if(s=o,ee.call(i,"weight")&&(n=i.weight,n<=0))throw new Error(Ke(o));t=ie(o),e=xt(o),r=i.getFn}return{path:t,id:e,weight:n,src:s,getFn:r}}function ie(i){return T(i)?i:i.split(".")}function xt(i){return T(i)?i.join("."):i}function Ye(i,t){let e=[],s=!1;const n=(r,o,c)=>{if(S(r))if(!o[c])e.push(r);else{let l=o[c];const a=r[l];if(!S(a))return;if(c===o.length-1&&(O(a)||Qt(a)||Fe(a)))e.push(Ue(a));else if(T(a)){s=!0;for(let u=0,h=a.length;u<h;u+=1)n(a[u],o,c+1)}else o.length&&n(a,o,c+1)}};return n(i,O(t)?t.split("."):t,0),s?e:e[0]}var f={...{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(i,t)=>i.score===t.score?i.idx<t.idx?-1:1:i.score<t.score?-1:1},...{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},...{location:0,threshold:.6,distance:100},...{useExtendedSearch:!1,getFn:Ye,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const qe=/[^ ]+/g;function Je(i=1,t=3){const e=new Map,s=Math.pow(10,t);return{get(n){const r=n.match(qe).length;if(e.has(r))return e.get(r);const o=1/Math.pow(r,.5*i),c=parseFloat(Math.round(o*s)/s);return e.set(r,c),c},clear(){e.clear()}}}class St{constructor({getFn:t=f.getFn,fieldNormWeight:e=f.fieldNormWeight}={}){this.norm=Je(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,O(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();O(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(!S(t)||bt(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((n,r)=>{let o=n.getFn?n.getFn(t):this.getFn(t,n.path);if(S(o)){if(T(o)){let c=[];const l=[{nestedArrIndex:-1,value:o}];for(;l.length;){const{nestedArrIndex:a,value:u}=l.pop();if(S(u))if(O(u)&&!bt(u)){let h={v:u,i:a,n:this.norm.get(u)};c.push(h)}else T(u)&&u.forEach((h,d)=>{l.push({nestedArrIndex:d,value:h})})}s.$[r]=c}else if(O(o)&&!bt(o)){let c={v:o,n:this.norm.get(o)};s.$[r]=c}}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function ne(i,t,{getFn:e=f.getFn,fieldNormWeight:s=f.fieldNormWeight}={}){const n=new St({getFn:e,fieldNormWeight:s});return n.setKeys(i.map(se)),n.setSources(t),n.create(),n}function Xe(i,{getFn:t=f.getFn,fieldNormWeight:e=f.fieldNormWeight}={}){const{keys:s,records:n}=i,r=new St({getFn:t,fieldNormWeight:e});return r.setKeys(s),r.setIndexRecords(n),r}function ct(i,{errors:t=0,currentLocation:e=0,expectedLocation:s=0,distance:n=f.distance,ignoreLocation:r=f.ignoreLocation}={}){const o=t/i.length;if(r)return o;const c=Math.abs(s-e);return n?o+c/n:c?1:o}function Qe(i=[],t=f.minMatchCharLength){let e=[],s=-1,n=-1,r=0;for(let o=i.length;r<o;r+=1){let c=i[r];c&&s===-1?s=r:!c&&s!==-1&&(n=r-1,n-s+1>=t&&e.push([s,n]),s=-1)}return i[r-1]&&r-s>=t&&e.push([s,r-1]),e}const D=32;function Ze(i,t,e,{location:s=f.location,distance:n=f.distance,threshold:r=f.threshold,findAllMatches:o=f.findAllMatches,minMatchCharLength:c=f.minMatchCharLength,includeMatches:l=f.includeMatches,ignoreLocation:a=f.ignoreLocation}={}){if(t.length>D)throw new Error(We(D));const u=t.length,h=i.length,d=Math.max(0,Math.min(s,h));let p=r,g=d;const A=c>1||l,R=A?Array(h):[];let b;for(;(b=i.indexOf(t,g))>-1;){let y=ct(t,{currentLocation:b,expectedLocation:d,distance:n,ignoreLocation:a});if(p=Math.min(y,p),g=b+u,A){let x=0;for(;x<u;)R[b+x]=1,x+=1}}g=-1;let k=[],L=1,G=u+h;const it=1<<u-1;for(let y=0;y<u;y+=1){let x=0,M=G;for(;x<M;)ct(t,{errors:y,currentLocation:d+M,expectedLocation:d,distance:n,ignoreLocation:a})<=p?x=M:G=M,M=Math.floor((G-x)/2+x);G=M;let ge=Math.max(1,d-M+1),kt=o?h:Math.min(d+M,h)+u,Y=Array(kt+2);Y[kt+1]=(1<<y)-1;for(let I=kt;I>=ge;I-=1){let ut=I-1,me=e[i.charAt(ut)];if(A&&(R[ut]=+!!me),Y[I]=(Y[I+1]<<1|1)&me,y&&(Y[I]|=(k[I+1]|k[I])<<1|1|k[I+1]),Y[I]&it&&(L=ct(t,{errors:y,currentLocation:ut,expectedLocation:d,distance:n,ignoreLocation:a}),L<=p)){if(p=L,g=ut,g<=d)break;ge=Math.max(1,2*d-g)}}if(ct(t,{errors:y+1,currentLocation:d,expectedLocation:d,distance:n,ignoreLocation:a})>p)break;k=Y}const $={isMatch:g>=0,score:Math.max(.001,L)};if(A){const y=Qe(R,c);y.length?l&&($.indices=y):$.isMatch=!1}return $}function ts(i){let t={};for(let e=0,s=i.length;e<s;e+=1){const n=i.charAt(e);t[n]=(t[n]||0)|1<<s-e-1}return t}class re{constructor(t,{location:e=f.location,threshold:s=f.threshold,distance:n=f.distance,includeMatches:r=f.includeMatches,findAllMatches:o=f.findAllMatches,minMatchCharLength:c=f.minMatchCharLength,isCaseSensitive:l=f.isCaseSensitive,ignoreLocation:a=f.ignoreLocation}={}){if(this.options={location:e,threshold:s,distance:n,includeMatches:r,findAllMatches:o,minMatchCharLength:c,isCaseSensitive:l,ignoreLocation:a},this.pattern=l?t:t.toLowerCase(),this.chunks=[],!this.pattern.length)return;const u=(d,p)=>{this.chunks.push({pattern:d,alphabet:ts(d),startIndex:p})},h=this.pattern.length;if(h>D){let d=0;const p=h%D,g=h-p;for(;d<g;)u(this.pattern.substr(d,D),d),d+=D;if(p){const A=h-D;u(this.pattern.substr(A),A)}}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:n,distance:r,threshold:o,findAllMatches:c,minMatchCharLength:l,ignoreLocation:a}=this.options;let u=[],h=0,d=!1;this.chunks.forEach(({pattern:g,alphabet:A,startIndex:R})=>{const{isMatch:b,score:k,indices:L}=Ze(t,g,A,{location:n+R,distance:r,threshold:o,findAllMatches:c,minMatchCharLength:l,includeMatches:s,ignoreLocation:a});b&&(d=!0),h+=k,b&&L&&(u=[...u,...L])});let p={isMatch:d,score:d?h/this.chunks.length:1};return d&&s&&(p.indices=u),p}}class P{constructor(t){this.pattern=t}static isMultiMatch(t){return oe(t,this.multiRegex)}static isSingleMatch(t){return oe(t,this.singleRegex)}search(){}}function oe(i,t){const e=i.match(t);return e?e[1]:null}class es extends P{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 ss extends P{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 is extends P{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 ns extends P{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 rs extends P{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 os extends P{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 le extends P{constructor(t,{location:e=f.location,threshold:s=f.threshold,distance:n=f.distance,includeMatches:r=f.includeMatches,findAllMatches:o=f.findAllMatches,minMatchCharLength:c=f.minMatchCharLength,isCaseSensitive:l=f.isCaseSensitive,ignoreLocation:a=f.ignoreLocation}={}){super(t),this._bitapSearch=new re(t,{location:e,threshold:s,distance:n,includeMatches:r,findAllMatches:o,minMatchCharLength:c,isCaseSensitive:l,ignoreLocation:a})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class ce extends P{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e=0,s;const n=[],r=this.pattern.length;for(;(s=t.indexOf(this.pattern,e))>-1;)e=s+r,n.push([s,e-1]);const o=!!n.length;return{isMatch:o,score:o?0:1,indices:n}}}const wt=[es,ce,is,ns,os,rs,ss,le],ae=wt.length,ls=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,cs="|";function as(i,t={}){return i.split(cs).map(e=>{let s=e.trim().split(ls).filter(r=>r&&!!r.trim()),n=[];for(let r=0,o=s.length;r<o;r+=1){const c=s[r];let l=!1,a=-1;for(;!l&&++a<ae;){const u=wt[a];let h=u.isMultiMatch(c);h&&(n.push(new u(h,t)),l=!0)}if(!l)for(a=-1;++a<ae;){const u=wt[a];let h=u.isSingleMatch(c);if(h){n.push(new u(h,t));break}}}return n})}const hs=new Set([le.type,ce.type]);class us{constructor(t,{isCaseSensitive:e=f.isCaseSensitive,includeMatches:s=f.includeMatches,minMatchCharLength:n=f.minMatchCharLength,ignoreLocation:r=f.ignoreLocation,findAllMatches:o=f.findAllMatches,location:c=f.location,threshold:l=f.threshold,distance:a=f.distance}={}){this.query=null,this.options={isCaseSensitive:e,includeMatches:s,minMatchCharLength:n,findAllMatches:o,ignoreLocation:r,location:c,threshold:l,distance:a},this.pattern=e?t:t.toLowerCase(),this.query=as(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 r=0,o=[],c=0;for(let l=0,a=e.length;l<a;l+=1){const u=e[l];o.length=0,r=0;for(let h=0,d=u.length;h<d;h+=1){const p=u[h],{isMatch:g,indices:A,score:R}=p.search(t);if(g){if(r+=1,c+=R,s){const b=p.constructor.type;hs.has(b)?o=[...o,...A]:o.push(A)}}else{c=0,r=0,o.length=0;break}}if(r){let h={isMatch:!0,score:c/r};return s&&(h.indices=o),h}}return{isMatch:!1,score:1}}}const Mt=[];function ds(...i){Mt.push(...i)}function It(i,t){for(let e=0,s=Mt.length;e<s;e+=1){let n=Mt[e];if(n.condition(i,t))return new n(i,t)}return new re(i,t)}const at={AND:"$and",OR:"$or"},Ot={PATH:"$path",PATTERN:"$val"},Rt=i=>!!(i[at.AND]||i[at.OR]),fs=i=>!!i[Ot.PATH],ps=i=>!T(i)&&Zt(i)&&!Rt(i),he=i=>({[at.AND]:Object.keys(i).map(t=>({[t]:i[t]}))});function ue(i,t,{auto:e=!0}={}){const s=n=>{let r=Object.keys(n);const o=fs(n);if(!o&&r.length>1&&!Rt(n))return s(he(n));if(ps(n)){const l=o?n[Ot.PATH]:r[0],a=o?n[Ot.PATTERN]:n[l];if(!O(a))throw new Error(Be(l));const u={keyId:xt(l),pattern:a};return e&&(u.searcher=It(a,t)),u}let c={children:[],operator:r[0]};return r.forEach(l=>{const a=n[l];T(a)&&a.forEach(u=>{c.children.push(s(u))})}),c};return Rt(i)||(i=he(i)),s(i)}function gs(i,{ignoreFieldNorm:t=f.ignoreFieldNorm}){i.forEach(e=>{let s=1;e.matches.forEach(({key:n,norm:r,score:o})=>{const c=n?n.weight:null;s*=Math.pow(o===0&&c?Number.EPSILON:o,(c||1)*(t?1:r))}),e.score=s})}function ms(i,t){const e=i.matches;t.matches=[],S(e)&&e.forEach(s=>{if(!S(s.indices)||!s.indices.length)return;const{indices:n,value:r}=s;let o={indices:n,value:r};s.key&&(o.key=s.key.src),s.idx>-1&&(o.refIndex=s.idx),t.matches.push(o)})}function _s(i,t){t.score=i.score}function $s(i,t,{includeMatches:e=f.includeMatches,includeScore:s=f.includeScore}={}){const n=[];return e&&n.push(ms),s&&n.push(_s),i.map(r=>{const{idx:o}=r,c={item:t[o],refIndex:o};return n.length&&n.forEach(l=>{l(r,c)}),c})}class K{constructor(t,e={},s){this.options={...f,...e},this.options.useExtendedSearch,this._keyStore=new Ge(this.options.keys),this.setCollection(t,s)}setCollection(t,e){if(this._docs=t,e&&!(e instanceof St))throw new Error(ze);this._myIndex=e||ne(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){S(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 r=this._docs[s];t(r,s)&&(this.removeAt(s),s-=1,n-=1,e.push(r))}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:r,sortFn:o,ignoreFieldNorm:c}=this.options;let l=O(t)?O(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return gs(l,{ignoreFieldNorm:c}),r&&l.sort(o),Qt(e)&&e>-1&&(l=l.slice(0,e)),$s(l,this._docs,{includeMatches:s,includeScore:n})}_searchStringList(t){const e=It(t,this.options),{records:s}=this._myIndex,n=[];return s.forEach(({v:r,i:o,n:c})=>{if(!S(r))return;const{isMatch:l,score:a,indices:u}=e.searchIn(r);l&&n.push({item:r,idx:o,matches:[{score:a,value:r,norm:c,indices:u}]})}),n}_searchLogical(t){const e=ue(t,this.options),s=(c,l,a)=>{if(!c.children){const{keyId:h,searcher:d}=c,p=this._findMatches({key:this._keyStore.get(h),value:this._myIndex.getValueForItemAtKeyId(l,h),searcher:d});return p&&p.length?[{idx:a,item:l,matches:p}]:[]}const u=[];for(let h=0,d=c.children.length;h<d;h+=1){const p=c.children[h],g=s(p,l,a);if(g.length)u.push(...g);else if(c.operator===at.AND)return[]}return u},n=this._myIndex.records,r={},o=[];return n.forEach(({$:c,i:l})=>{if(S(c)){let a=s(e,c,l);a.length&&(r[l]||(r[l]={idx:l,item:c,matches:[]},o.push(r[l])),a.forEach(({matches:u})=>{r[l].matches.push(...u)}))}}),o}_searchObjectList(t){const e=It(t,this.options),{keys:s,records:n}=this._myIndex,r=[];return n.forEach(({$:o,i:c})=>{if(!S(o))return;let l=[];s.forEach((a,u)=>{l.push(...this._findMatches({key:a,value:o[u],searcher:e}))}),l.length&&r.push({idx:c,item:o,matches:l})}),r}_findMatches({key:t,value:e,searcher:s}){if(!S(e))return[];let n=[];if(T(e))e.forEach(({v:r,i:o,n:c})=>{if(!S(r))return;const{isMatch:l,score:a,indices:u}=s.searchIn(r);l&&n.push({score:a,key:t,value:r,idx:o,norm:c,indices:u})});else{const{v:r,n:o}=e,{isMatch:c,score:l,indices:a}=s.searchIn(r);c&&n.push({score:l,key:t,value:r,norm:o,indices:a})}return n}}K.version="6.6.2",K.createIndex=ne,K.parseIndex=Xe,K.config=f,K.parseQuery=ue,ds(us);var ht=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ys(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var vs="Expected a function",de=0/0,As="[object Symbol]",Es=/^\s+|\s+$/g,bs=/^[-+]0x[0-9a-f]+$/i,xs=/^0b[01]+$/i,Ss=/^0o[0-7]+$/i,ws=parseInt,Ms=typeof ht=="object"&&ht&&ht.Object===Object&&ht,Is=typeof self=="object"&&self&&self.Object===Object&&self,Os=Ms||Is||Function("return this")(),Rs=Object.prototype,Cs=Rs.toString,Ts=Math.max,ks=Math.min,Ct=function(){return Os.Date.now()};function Ls(i,t,e){var s,n,r,o,c,l,a=0,u=!1,h=!1,d=!0;if(typeof i!="function")throw new TypeError(vs);t=fe(t)||0,Tt(e)&&(u=!!e.leading,h="maxWait"in e,r=h?Ts(fe(e.maxWait)||0,t):r,d="trailing"in e?!!e.trailing:d);function p($){var y=s,x=n;return s=n=void 0,a=$,o=i.apply(x,y),o}function g($){return a=$,c=setTimeout(b,t),u?p($):o}function A($){var y=$-l,x=$-a,M=t-y;return h?ks(M,r-x):M}function R($){var y=$-l,x=$-a;return l===void 0||y>=t||y<0||h&&x>=r}function b(){var $=Ct();if(R($))return k($);c=setTimeout(b,A($))}function k($){return c=void 0,d&&s?p($):(s=n=void 0,o)}function L(){c!==void 0&&clearTimeout(c),a=0,s=l=n=c=void 0}function G(){return c===void 0?o:k(Ct())}function it(){var $=Ct(),y=R($);if(s=arguments,n=this,l=$,y){if(c===void 0)return g(l);if(h)return c=setTimeout(b,t),p(l)}return c===void 0&&(c=setTimeout(b,t)),o}return it.cancel=L,it.flush=G,it}function Tt(i){var t=typeof i;return!!i&&(t=="object"||t=="function")}function Ns(i){return!!i&&typeof i=="object"}function Ps(i){return typeof i=="symbol"||Ns(i)&&Cs.call(i)==As}function fe(i){if(typeof i=="number")return i;if(Ps(i))return de;if(Tt(i)){var t=typeof i.valueOf=="function"?i.valueOf():i;i=Tt(t)?t+"":t}if(typeof i!="string")return i===0?i:+i;i=i.replace(Es,"");var e=xs.test(i);return e||Ss.test(i)?ws(i.slice(2),e?2:8):bs.test(i)?de:+i}var js=Ls;const Hs=ys(js),Us=(i,t="highlight",e="title")=>{const s=(r,o,c)=>{const l=o.split(".");let a;for(a=0;a<l.length-1;a++)r=r[l[a]];r[l[a]]=c},n=(r,o=[])=>{let c="",l=0;return o.forEach(a=>{const u=a[1]+1;c+=[r.substring(l,a[0]),`<mark class="${t}">`,r.substring(a[0],u),"</mark>"].join(""),l=u}),c+=r.substring(l),c};return i.filter(({matches:r})=>r&&r.length).map(({item:r,matches:o})=>{const c={...r};return o.forEach(l=>{l.key===e&&s(c,l.key,n(l.value,l.indices))}),c})},Fs=`
|
|
48
52
|
:host {
|
|
49
53
|
display: flex;
|
|
50
54
|
box-sizing: border-box;
|
|
51
55
|
height: 100%;
|
|
52
|
-
overflow: hidden;
|
|
53
56
|
}
|
|
54
57
|
*,
|
|
55
58
|
*:before,
|
|
@@ -83,6 +86,14 @@ label {
|
|
|
83
86
|
details {
|
|
84
87
|
margin-bottom: 0.5rem;
|
|
85
88
|
}
|
|
89
|
+
details[open] {
|
|
90
|
+
position: absolute;
|
|
91
|
+
left: 16px;
|
|
92
|
+
right: 12px;
|
|
93
|
+
}
|
|
94
|
+
details[open] summary {
|
|
95
|
+
height: 30px;
|
|
96
|
+
}
|
|
86
97
|
details summary > * {
|
|
87
98
|
display: inline;
|
|
88
99
|
}
|
|
@@ -90,28 +101,28 @@ details summary {
|
|
|
90
101
|
display: flex;
|
|
91
102
|
align-items: center;
|
|
92
103
|
}
|
|
93
|
-
|
|
104
|
+
.details-filter summary {
|
|
94
105
|
justify-content: space-between;
|
|
95
106
|
}
|
|
96
107
|
#details-results summary {
|
|
97
108
|
list-style: none;
|
|
98
109
|
}
|
|
99
|
-
|
|
110
|
+
.details-filter summary svg,
|
|
100
111
|
#details-results summary svg {
|
|
101
|
-
width:
|
|
102
|
-
height:
|
|
112
|
+
width: 14px;
|
|
113
|
+
height: 14px;
|
|
103
114
|
transition: all ease-in-out 0.3s;
|
|
104
115
|
}
|
|
105
116
|
#details-results summary svg {
|
|
106
117
|
transform: rotate(-90deg);
|
|
107
118
|
}
|
|
108
|
-
|
|
119
|
+
.details-filter[open] summary svg {
|
|
109
120
|
transform: rotate(180deg);
|
|
110
121
|
}
|
|
111
122
|
#details-results[open] summary svg {
|
|
112
123
|
transform: rotate(0deg);
|
|
113
124
|
}
|
|
114
|
-
|
|
125
|
+
.details-filter li span,
|
|
115
126
|
details summary {
|
|
116
127
|
text-transform: capitalize;
|
|
117
128
|
}
|
|
@@ -157,121 +168,161 @@ ul#results li {
|
|
|
157
168
|
#filter-reset {
|
|
158
169
|
cursor: pointer;
|
|
159
170
|
}
|
|
171
|
+
section.inline,
|
|
172
|
+
section.inline > ul {
|
|
173
|
+
display: flex;
|
|
174
|
+
align-items: flex-start;
|
|
175
|
+
flex-wrap: wrap;
|
|
176
|
+
justify-content: space-between;
|
|
177
|
+
margin: 0;
|
|
178
|
+
}
|
|
179
|
+
section.inline details.details-filter {
|
|
180
|
+
background: lightgrey;
|
|
181
|
+
border-radius: 13px;
|
|
182
|
+
margin: 0;
|
|
183
|
+
margin-right: 4px;
|
|
184
|
+
padding: 4px 7px;
|
|
185
|
+
}
|
|
186
|
+
section.inline details.details-filter summary {
|
|
187
|
+
display: flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
}
|
|
160
190
|
.scroll {
|
|
161
191
|
height: 100%;
|
|
162
192
|
overflow-x: hidden;
|
|
163
193
|
overflow-y: auto;
|
|
164
194
|
}
|
|
165
|
-
`;var
|
|
195
|
+
`;var Ds=Object.defineProperty,zs=Object.getOwnPropertyDescriptor,z=(i,t,e,s)=>{for(var n=s>1?void 0:s?zs(t,e):t,r=i.length-1,o;r>=0;r--)(o=i[r])&&(n=(s?o(t,e,n):o(n))||n);return s&&n&&Ds(t,e,n),n};class pe{constructor(){_(this,"aggregateResults");_(this,"enableHighlighting",!1);_(this,"enableSearch",!1);_(this,"exclusiveFilters",!1);_(this,"externalSearch");_(this,"filterProperties",[]);_(this,"fuseConfig",{keys:["title"]});_(this,"inlineMode",!1);_(this,"matchAllWhenEmpty",!0);_(this,"onSearch",()=>{});_(this,"onSelect",()=>{});_(this,"showResults",!0);_(this,"titleProperty","title")}}v.EOxItemFilter=class extends tt{constructor(){super(...arguments);_(this,"_fuse");_(this,"_resultAggregation",[]);_(this,"_items",[]);_(this,"_results");_(this,"_filters",{});_(this,"_selectedResult");_(this,"_config",new pe);_(this,"apply",e=>{this._items=e.map((s,n)=>({...s,id:`item-${n}`})),this._fuse=new K(this._items,{minMatchCharLength:3,threshold:.4,distance:50,includeMatches:!0,useExtendedSearch:!0,...this._config.fuseConfig}),this._config.filterProperties.length&&this._config.filterProperties.forEach(s=>{const n={};this._items.forEach(r=>{Array.isArray(r[s])?r[s].forEach(o=>{n[o]=void 0}):n[r[s]]=void 0}),this._filters[s]=n}),this._config.matchAllWhenEmpty!==!1&&(this._results=this.sortResults(this._items),this.requestUpdate()),this._config.aggregateResults&&(this._resultAggregation=[...new Set(this._items.reduce((s,n)=>s.concat(n[this._config.aggregateResults]),[]))].sort())});_(this,"inputHandler",()=>{this.search(this.renderRoot.querySelector("input[type='text']").value)});_(this,"debouncedInputHandler",Hs(this.inputHandler,500,{leading:!0}))}set config(e){const s=this._config;this._config={...new pe,...e},this.requestUpdate("config",s)}get config(){return this._config}async search(e="",s=this._filters){const n=Object.entries(s).reduce((o,[c,l])=>{const a=u=>{const h={};h[c]=`="${u}"`,o.push(h)};return Object.entries(l).filter(([u,h])=>h).forEach(([u,h])=>a(u)),o},[]);let r;if(!(e.length>2)&&!n.length&&this._config.matchAllWhenEmpty!==!1)r=this._items;else if(this.config.externalSearch)r=(await(await fetch(`${this.config.externalSearch(e,s)}`)).json()).features;else{const o={...e.length>2&&n.length?{$and:[{$or:[...this._config.fuseConfig.keys.map(l=>({[l]:e}))]},{$or:n}]}:{$or:[...this._config.fuseConfig.keys.map(l=>({[l]:e})),{$or:n}]}},c=this._fuse.search(o);r=this._config.enableHighlighting?Us(c,"highlight",this._config.titleProperty):c.map(l=>l.item)}this._results=this.sortResults(r),this._config.onSearch(r),this.requestUpdate()}aggregateResults(e,s){return e.filter(n=>{const r=n[this._config.aggregateResults],o=Object.keys(this._filters[this._config.aggregateResults]).filter(l=>this._filters[this._config.aggregateResults][l]);return(o.length?o.includes(s):!0)&&Array.isArray(r)?r.includes(s):r===s})}sortResults(e){return[...e].sort((s,n)=>s[this._config.titleProperty]<n[this._config.titleProperty]?-1:1)}toggleFilter(e,s){this._config.exclusiveFilters===!0&&Object.keys(this._filters).forEach(o=>{Object.keys(this._filters[o]).forEach(c=>{this._filters[o][c]=!1})}),this._filters[e][s]=!this._filters[e][s];const n=this.renderRoot.querySelector('input[type="text"]');n?this.search(n.value):this.search();const r=this.renderRoot.querySelectorAll("ul#results input[type='radio']");for(let o=0;o<r.length;o++)r[o].checked=!1;this._selectedResult&&setTimeout(()=>{const o=this.renderRoot.querySelector(`#${this._selectedResult.id}`);o&&(o.checked=!0,this.requestUpdate())})}resetFilters(){this.renderRoot.querySelectorAll(".details-filter input").forEach(s=>{s.checked=!1});const e=this.renderRoot.querySelector('input[type="text"]');e&&(e.value=""),Object.keys(this._filters).forEach(s=>{Object.keys(this._filters[s]).forEach(n=>{this._filters[s][n]=!1})}),this.search(),this.requestUpdate()}render(){return w`
|
|
166
196
|
<style>
|
|
167
|
-
${
|
|
197
|
+
${Fs}
|
|
168
198
|
</style>
|
|
169
199
|
<form>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
<
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
200
|
+
${et(this._config.enableSearch,()=>w`
|
|
201
|
+
<section>
|
|
202
|
+
<input
|
|
203
|
+
type="text"
|
|
204
|
+
placeholder="Type something..."
|
|
205
|
+
data-cy="search"
|
|
206
|
+
part="input-search"
|
|
207
|
+
@input="${this.debouncedInputHandler}"
|
|
208
|
+
/>
|
|
209
|
+
</section>
|
|
210
|
+
`)}
|
|
211
|
+
${et(this._config.filterProperties.length,()=>w`
|
|
212
|
+
<section class="${this.config.inlineMode?"inline":m}">
|
|
213
|
+
${et(!this.config.inlineMode,()=>w` <slot name="filterstitle"></slot> `)}
|
|
214
|
+
<ul id="filters">
|
|
215
|
+
${st(this._config.filterProperties,e=>w`
|
|
216
|
+
<details
|
|
217
|
+
class="details-filter"
|
|
218
|
+
part="details-filter"
|
|
219
|
+
data-filter="${e}"
|
|
220
|
+
@click=${()=>this.renderRoot.querySelectorAll("details.details-filter").forEach(s=>{s.getAttribute("data-filter")!==e&&(s.removeAttribute("open"),this.requestUpdate())})}
|
|
221
|
+
>
|
|
222
|
+
<summary>
|
|
223
|
+
<small>
|
|
224
|
+
<strong class="title">
|
|
225
|
+
${e}
|
|
226
|
+
${Object.values(this._filters[e]).filter(s=>s).length?`(${Object.values(this._filters[e]).filter(s=>s).length})`:m}
|
|
227
|
+
</strong>
|
|
228
|
+
</small>
|
|
229
|
+
<div
|
|
230
|
+
style="display: flex; align-items: center; justify-content: center; margin-left: 4px;"
|
|
231
|
+
>
|
|
232
|
+
<svg
|
|
233
|
+
data-cy="expand-button"
|
|
234
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
235
|
+
viewBox="6 6 12 12"
|
|
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
|
+
</div>
|
|
243
|
+
</summary>
|
|
244
|
+
<div class="scroll" style="max-height: 150px">
|
|
245
|
+
<ul>
|
|
246
|
+
${this._filters[e]?st(Object.keys(this._filters[e]).sort(),s=>w`
|
|
247
|
+
<li>
|
|
248
|
+
<label>
|
|
249
|
+
<input
|
|
250
|
+
name="selection"
|
|
251
|
+
type="${this._config.exclusiveFilters===!0?"radio":"checkbox"}"
|
|
252
|
+
checked="${this._filters[e][s]||m}"
|
|
253
|
+
@click=${()=>this.toggleFilter(e,s)}
|
|
254
|
+
/>
|
|
255
|
+
<span class="title">${s}</span>
|
|
256
|
+
</label>
|
|
257
|
+
</li>
|
|
258
|
+
`):null}
|
|
259
|
+
</ul>
|
|
260
|
+
</div>
|
|
261
|
+
</details>
|
|
262
|
+
`)}
|
|
263
|
+
</ul>
|
|
264
|
+
${et(this._config.filterProperties,()=>w`
|
|
265
|
+
<a
|
|
266
|
+
id="filter-reset"
|
|
267
|
+
data-cy="filter-reset"
|
|
268
|
+
@click=${()=>this.resetFilters()}
|
|
269
|
+
><small>Reset filters</small></a
|
|
270
|
+
>
|
|
271
|
+
`)}
|
|
272
|
+
</section>
|
|
273
|
+
`)}
|
|
274
|
+
${et(this.config.showResults&&this._results,()=>w`
|
|
275
|
+
<section id="section-results">
|
|
276
|
+
<div>
|
|
277
|
+
<slot name="resultstitle"></slot>
|
|
278
|
+
</div>
|
|
279
|
+
<div id="container-results" class="scroll">
|
|
280
|
+
${this._results.length<1?w` <small class="no-results">No matching items</small> `:m}
|
|
281
|
+
<ul id="results" part="results">
|
|
282
|
+
${this._config.aggregateResults?st(this._resultAggregation.filter(e=>this.aggregateResults(this._results,e).length),e=>w`<details
|
|
283
|
+
id="details-results"
|
|
284
|
+
open
|
|
285
|
+
>
|
|
286
|
+
<summary>
|
|
287
|
+
<svg
|
|
288
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
289
|
+
viewBox="0 0 24 24"
|
|
290
|
+
>
|
|
291
|
+
<title>chevron-down</title>
|
|
292
|
+
<path
|
|
293
|
+
d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"
|
|
294
|
+
/>
|
|
295
|
+
</svg>
|
|
296
|
+
<strong class="title">
|
|
297
|
+
${e}
|
|
298
|
+
</strong>
|
|
299
|
+
<span style="margin-left: 0.25rem"
|
|
300
|
+
>(${this.aggregateResults(this._results,e).length})</span
|
|
301
|
+
>
|
|
302
|
+
</summary>
|
|
303
|
+
<ul>
|
|
304
|
+
${st(this.aggregateResults(this._results,e),s=>w`
|
|
206
305
|
<li>
|
|
207
306
|
<label>
|
|
208
307
|
<input
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
@click=${()=>this.
|
|
308
|
+
type="radio"
|
|
309
|
+
name="result"
|
|
310
|
+
id="${s.id}"
|
|
311
|
+
@click=${()=>{this._selectedResult=s,this._config.onSelect(s)}}
|
|
213
312
|
/>
|
|
214
|
-
<span class="title"
|
|
313
|
+
<span class="title"
|
|
314
|
+
>${Xt(s[this._config.titleProperty])}</span
|
|
315
|
+
>
|
|
215
316
|
</label>
|
|
216
317
|
</li>
|
|
217
|
-
`)
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
</section>
|
|
227
|
-
<section id="section-results">
|
|
228
|
-
<div>
|
|
229
|
-
<slot name="resultstitle"></slot>
|
|
230
|
-
</div>
|
|
231
|
-
<div id="container-results" class="scroll">
|
|
232
|
-
${this._results.length<1?N` <small class="no-results">No matching items</small> `:m}
|
|
233
|
-
<ul id="results">
|
|
234
|
-
${this.config.aggregateResults?q(this._resultAggregation.filter(e=>this.aggregateResults(this._results,e).length),e=>N`<details
|
|
235
|
-
id="details-results"
|
|
236
|
-
open
|
|
237
|
-
>
|
|
238
|
-
<summary>
|
|
239
|
-
<svg
|
|
240
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
241
|
-
viewBox="0 0 24 24"
|
|
242
|
-
>
|
|
243
|
-
<title>chevron-down</title>
|
|
244
|
-
<path
|
|
245
|
-
d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"
|
|
246
|
-
/>
|
|
247
|
-
</svg>
|
|
248
|
-
<strong class="title"> ${e} </strong>
|
|
249
|
-
<span style="margin-left: 0.25rem"
|
|
250
|
-
>(${this.aggregateResults(this._results,e).length})</span
|
|
251
|
-
>
|
|
252
|
-
</summary>
|
|
253
|
-
<ul>
|
|
254
|
-
${q(this.aggregateResults(this._results,e),s=>N`
|
|
255
|
-
<li>
|
|
256
|
-
<label>
|
|
257
|
-
<input
|
|
258
|
-
type="radio"
|
|
259
|
-
name="result"
|
|
260
|
-
id="${s.id}"
|
|
261
|
-
@click=${()=>{this._selectedResult=s,this.config.onSelect(s)}}
|
|
262
|
-
/>
|
|
263
|
-
<span class="title"
|
|
264
|
-
>${Vt(s[this.config.titleProperty])}</span
|
|
265
|
-
>
|
|
266
|
-
</label>
|
|
267
|
-
</li>
|
|
268
|
-
`)}
|
|
269
|
-
</ul>
|
|
270
|
-
</details>`):q(this._results,e=>N`<li>
|
|
271
|
-
${Vt(e[this.config.titleProperty])}
|
|
272
|
-
</li>`)}
|
|
273
|
-
</ul>
|
|
274
|
-
</div>
|
|
275
|
-
</section>
|
|
318
|
+
`)}
|
|
319
|
+
</ul>
|
|
320
|
+
</details>`):st(this._results,e=>w`<li part="result">
|
|
321
|
+
${Xt(e[this._config.titleProperty])}
|
|
322
|
+
</li>`)}
|
|
323
|
+
</ul>
|
|
324
|
+
</div>
|
|
325
|
+
</section>
|
|
326
|
+
`)}
|
|
276
327
|
</form>
|
|
277
|
-
`}},
|
|
328
|
+
`}},z([lt()],v.EOxItemFilter.prototype,"_items",2),z([lt()],v.EOxItemFilter.prototype,"_results",2),z([lt()],v.EOxItemFilter.prototype,"_filters",2),z([lt()],v.EOxItemFilter.prototype,"_selectedResult",2),z([vt({attribute:!1})],v.EOxItemFilter.prototype,"config",1),z([vt()],v.EOxItemFilter.prototype,"apply",2),v.EOxItemFilter=z([Te("eox-itemfilter")],v.EOxItemFilter),Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/itemfilter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@eox/eslint-config": "^1.0.0",
|
|
@@ -22,10 +22,14 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"start": "vite",
|
|
24
24
|
"build": "tsc && vite build",
|
|
25
|
-
"watch": "tsc && vite build --watch"
|
|
25
|
+
"watch": "tsc && vite build --watch",
|
|
26
|
+
"format": "prettier --write .",
|
|
27
|
+
"lint": "eslint --ext .js,.ts .",
|
|
28
|
+
"lint:fix": "eslint --ext .js,.ts . --fix"
|
|
26
29
|
},
|
|
27
30
|
"dependencies": {
|
|
28
31
|
"fuse.js": "^6.6.2",
|
|
29
|
-
"lit": "^2.7.4"
|
|
32
|
+
"lit": "^2.7.4",
|
|
33
|
+
"lodash.debounce": "^4.0.8"
|
|
30
34
|
}
|
|
31
35
|
}
|