@internetarchive/ads-table 1.2.0 → 1.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/index.js CHANGED
@@ -32,65 +32,58 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
32
32
  * Copyright 2019 Google LLC
33
33
  * SPDX-License-Identifier: BSD-3-Clause
34
34
  */
35
- const t$2=globalThis,e$5=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$4=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$2)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$5&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$4.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$4.set(s,t));}return t}toString(){return this.cssText}};const r$5=t=>new n$3("string"==typeof t?t:t+"",void 0,s$2),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1],t[0]);return new n$3(o,t,s$2)},S$1=(s,o)=>{if(e$5)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$5?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$5(e)})(t):t;
35
+ const t$2=globalThis,e$4=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$4=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$2)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$4&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$4.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$4.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$3("string"==typeof t?t:t+"",void 0,s$2),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$3(o,t,s$2)},S$1=(s,o)=>{if(e$4)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$4?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
36
36
 
37
37
  /**
38
38
  * @license
39
39
  * Copyright 2017 Google LLC
40
40
  * SPDX-License-Identifier: BSD-3-Clause
41
- */const{is:i$2,defineProperty:e$4,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$4,getOwnPropertySymbols:o$3,getPrototypeOf:n$2}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),b$1={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b$1){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$4(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$1(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$4(t),...o$3(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach(t=>t.hostConnected?.());}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.());}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i,e=false,h){if(void 0!==t){const r=this.constructor;if(false===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.2");
41
+ */const{is:i$2,defineProperty:e$3,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$3,getOwnPropertySymbols:o$3,getPrototypeOf:n$2}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),b={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$3(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$1(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$3(t),...o$3(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.1");
42
42
 
43
43
  /**
44
44
  * @license
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
47
  */
48
- const t$1=globalThis,i$1=t=>t,s$1=t$1.trustedTypes,e$3=s$1?s$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,h="$lit$",o$2=`lit$${Math.random().toFixed(9).slice(2)}$`,n$1="?"+o$2,r$3=`<${n$1}>`,l=document,c=()=>l.createComment(""),a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u=Array.isArray,d=t=>u(t)||"function"==typeof t?.[Symbol.iterator],f="[ \t\n\f\r]",v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m=/>/g,p=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,x=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b=x(1),E=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e$3?e$3.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?"<svg>":3===i?"<math>":"",c=v;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v?"!--"===u[1]?c=_:void 0!==u[1]?c=m:void 0!==u[2]?(y.test(u[2])&&(n=RegExp("</"+u[2],"g")),c=p):void 0!==u[3]&&(c=p):c===p?">"===u[0]?(c=n??v,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p:'"'===u[3]?$:g):c===$||c===g?c=p:c===_||c===m?c=v:(c=p,n=void 0);const x=c===p&&t[i+1].startsWith("/>")?" ":"";l+=c===v?s+r$3:d>=0?(e.push(a),s.slice(0,d)+h+s.slice(d)+o$2+x):s+o$2+(-2===d?i:x);}return [V(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h)){const i=v[a++],s=r.getAttribute(t).split(o$2),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:"."===e[1]?I:"?"===e[1]?L:"@"===e[1]?z:H}),r.removeAttribute(t);}else t.startsWith(o$2)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){const t=r.textContent.split(o$2),i=t.length-1;if(i>0){r.textContent=s$1?s$1.emptyScript:"";for(let s=0;s<i;s++)r.append(t[s],c()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c());}}}else if(8===r.nodeType)if(r.data===n$1)d.push({type:2,index:l});else {let t=-1;for(;-1!==(t=r.data.indexOf(o$2,t+1));)d.push({type:7,index:l}),t+=o$2.length-1;}l++;}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function M(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=M(t,h._$AS(t,i.values),h,e)),i}class R{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??l).importNode(i,true);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n];}o!==r?.index&&(h=P.nextNode(),o++);}return P.currentNode=l,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=M(this,t,i),a(t)?t===A||null==t||""===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==A&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S(t)),i}k(t){u(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new k(this.O(c()),this.O(c()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(false,true,s);t!==this._$AB;){const s=i$1(t).nextSibling;i$1(t).remove(),t=s;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=M(this,t,i,0),o=!a(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class I extends H{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===A?void 0:t;}}class L extends H{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A);}}class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=M(this,t,i,0)??A)===E)return;const s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class Z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){M(this,t);}}const B=t$1.litHtmlPolyfillSupport;B?.(S,k),(t$1.litHtmlVersions??=[]).push("3.3.2");const D=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new k(i.insertBefore(c(),t),t,void 0,s??{});}return h._$AI(t),h};
48
+ const t$1=globalThis,i$1=t$1.trustedTypes,s$1=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$2="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$2="?"+h,n$1=`<${o$2}>`,r$2=document,l=()=>r$2.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$2.createTreeWalker(r$2,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n$1:d>=0?(o.push(a),s.slice(0,d)+e$2+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$2)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$2)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r$2.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$2).importNode(i,true);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$2,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$2.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(false,true,i);t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t$1.litHtmlPolyfillSupport;j?.(N,R),(t$1.litHtmlVersions??=[]).push("3.3.1");const B=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
49
49
 
50
50
  /**
51
51
  * @license
52
52
  * Copyright 2017 Google LLC
53
53
  * SPDX-License-Identifier: BSD-3-Clause
54
- */const s=globalThis;class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=D(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}}i._$litElement$=true,i["finalized"]=true,s.litElementHydrateSupport?.({LitElement:i});const o$1=s.litElementPolyfillSupport;o$1?.({LitElement:i});(s.litElementVersions??=[]).push("4.2.2");
54
+ */const s=globalThis;class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return T}}i._$litElement$=true,i["finalized"]=true,s.litElementHydrateSupport?.({LitElement:i});const o$1=s.litElementPolyfillSupport;o$1?.({LitElement:i});(s.litElementVersions??=[]).push("4.2.1");
55
55
 
56
56
  /**
57
57
  * @license
58
58
  * Copyright 2017 Google LLC
59
59
  * SPDX-License-Identifier: BSD-3-Clause
60
60
  */
61
- const t=t=>(e,o)=>{ void 0!==o?o.addInitializer(()=>{customElements.define(t,e);}):customElements.define(t,e);};
61
+ const t=t=>(e,o)=>{ void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
62
62
 
63
63
  /**
64
64
  * @license
65
65
  * Copyright 2017 Google LLC
66
66
  * SPDX-License-Identifier: BSD-3-Clause
67
- */const o={attribute:true,type:String,converter:u$1,reflect:false,hasChanged:f$1},r$2=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t,true,r);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t,true,r);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r$2(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
67
+ */const o={attribute:true,type:String,converter:u$1,reflect:false,hasChanged:f$1},r$1=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
68
68
 
69
69
  /**
70
70
  * @license
71
71
  * Copyright 2017 Google LLC
72
72
  * SPDX-License-Identifier: BSD-3-Clause
73
- */function r$1(r){return n({...r,state:true,attribute:false})}
73
+ */function r(r){return n({...r,state:true,attribute:false})}
74
74
 
75
75
  /**
76
76
  * @license
77
77
  * Copyright 2017 Google LLC
78
78
  * SPDX-License-Identifier: BSD-3-Clause
79
79
  */
80
- const e$2=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
80
+ const e$1=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
81
81
 
82
82
  /**
83
83
  * @license
84
84
  * Copyright 2017 Google LLC
85
85
  * SPDX-License-Identifier: BSD-3-Clause
86
- */function e$1(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$2(n,s,{get(){return o(this)}})}}
87
-
88
- /**
89
- * @license
90
- * Copyright 2017 Google LLC
91
- * SPDX-License-Identifier: BSD-3-Clause
92
- */
93
- let e;function r(r){return (n,o)=>e$2(n,o,{get(){return (this.renderRoot??(e??=document.createDocumentFragment())).querySelectorAll(r)}})}
86
+ */function e(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$1(n,s,{get(){return o(this)}})}}
94
87
 
95
88
  // static class that encapsulates shorthands and utilities for emitting events.
96
89
  class EventHelpers {
@@ -109,13 +102,6 @@ EventHelpers.defaultEventOptions = {
109
102
  };
110
103
 
111
104
  class QuickLRU extends Map {
112
- #size = 0;
113
- #cache = new Map();
114
- #oldCache = new Map();
115
- #maxSize;
116
- #maxAge;
117
- #onEviction;
118
-
119
105
  constructor(options = {}) {
120
106
  super();
121
107
 
@@ -127,30 +113,30 @@ class QuickLRU extends Map {
127
113
  throw new TypeError('`maxAge` must be a number greater than 0');
128
114
  }
129
115
 
130
- this.#maxSize = options.maxSize;
131
- this.#maxAge = options.maxAge || Number.POSITIVE_INFINITY;
132
- this.#onEviction = options.onEviction;
116
+ // TODO: Use private class fields when ESLint supports them.
117
+ this.maxSize = options.maxSize;
118
+ this.maxAge = options.maxAge || Number.POSITIVE_INFINITY;
119
+ this.onEviction = options.onEviction;
120
+ this.cache = new Map();
121
+ this.oldCache = new Map();
122
+ this._size = 0;
133
123
  }
134
124
 
135
- // For tests.
136
- get __oldCache() {
137
- return this.#oldCache;
138
- }
139
-
140
- #emitEvictions(cache) {
141
- if (typeof this.#onEviction !== 'function') {
125
+ // TODO: Use private class methods when targeting Node.js 16.
126
+ _emitEvictions(cache) {
127
+ if (typeof this.onEviction !== 'function') {
142
128
  return;
143
129
  }
144
130
 
145
131
  for (const [key, item] of cache) {
146
- this.#onEviction(key, item.value);
132
+ this.onEviction(key, item.value);
147
133
  }
148
134
  }
149
135
 
150
- #deleteIfExpired(key, item) {
136
+ _deleteIfExpired(key, item) {
151
137
  if (typeof item.expiry === 'number' && item.expiry <= Date.now()) {
152
- if (typeof this.#onEviction === 'function') {
153
- this.#onEviction(key, item.value);
138
+ if (typeof this.onEviction === 'function') {
139
+ this.onEviction(key, item.value);
154
140
  }
155
141
 
156
142
  return this.delete(key);
@@ -159,53 +145,54 @@ class QuickLRU extends Map {
159
145
  return false;
160
146
  }
161
147
 
162
- #getOrDeleteIfExpired(key, item) {
163
- const deleted = this.#deleteIfExpired(key, item);
148
+ _getOrDeleteIfExpired(key, item) {
149
+ const deleted = this._deleteIfExpired(key, item);
164
150
  if (deleted === false) {
165
151
  return item.value;
166
152
  }
167
153
  }
168
154
 
169
- #getItemValue(key, item) {
170
- return item.expiry ? this.#getOrDeleteIfExpired(key, item) : item.value;
155
+ _getItemValue(key, item) {
156
+ return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;
171
157
  }
172
158
 
173
- #peek(key, cache) {
159
+ _peek(key, cache) {
174
160
  const item = cache.get(key);
175
- return this.#getItemValue(key, item);
161
+
162
+ return this._getItemValue(key, item);
176
163
  }
177
164
 
178
- #set(key, value) {
179
- this.#cache.set(key, value);
180
- this.#size++;
165
+ _set(key, value) {
166
+ this.cache.set(key, value);
167
+ this._size++;
181
168
 
182
- if (this.#size >= this.#maxSize) {
183
- this.#size = 0;
184
- this.#emitEvictions(this.#oldCache);
185
- this.#oldCache = this.#cache;
186
- this.#cache = new Map();
169
+ if (this._size >= this.maxSize) {
170
+ this._size = 0;
171
+ this._emitEvictions(this.oldCache);
172
+ this.oldCache = this.cache;
173
+ this.cache = new Map();
187
174
  }
188
175
  }
189
176
 
190
- #moveToRecent(key, item) {
191
- this.#oldCache.delete(key);
192
- this.#set(key, item);
177
+ _moveToRecent(key, item) {
178
+ this.oldCache.delete(key);
179
+ this._set(key, item);
193
180
  }
194
181
 
195
- * #entriesAscending() {
196
- for (const item of this.#oldCache) {
182
+ * _entriesAscending() {
183
+ for (const item of this.oldCache) {
197
184
  const [key, value] = item;
198
- if (!this.#cache.has(key)) {
199
- const deleted = this.#deleteIfExpired(key, value);
185
+ if (!this.cache.has(key)) {
186
+ const deleted = this._deleteIfExpired(key, value);
200
187
  if (deleted === false) {
201
188
  yield item;
202
189
  }
203
190
  }
204
191
  }
205
192
 
206
- for (const item of this.#cache) {
193
+ for (const item of this.cache) {
207
194
  const [key, value] = item;
208
- const deleted = this.#deleteIfExpired(key, value);
195
+ const deleted = this._deleteIfExpired(key, value);
209
196
  if (deleted === false) {
210
197
  yield item;
211
198
  }
@@ -213,79 +200,73 @@ class QuickLRU extends Map {
213
200
  }
214
201
 
215
202
  get(key) {
216
- if (this.#cache.has(key)) {
217
- const item = this.#cache.get(key);
218
- return this.#getItemValue(key, item);
203
+ if (this.cache.has(key)) {
204
+ const item = this.cache.get(key);
205
+
206
+ return this._getItemValue(key, item);
219
207
  }
220
208
 
221
- if (this.#oldCache.has(key)) {
222
- const item = this.#oldCache.get(key);
223
- if (this.#deleteIfExpired(key, item) === false) {
224
- this.#moveToRecent(key, item);
209
+ if (this.oldCache.has(key)) {
210
+ const item = this.oldCache.get(key);
211
+ if (this._deleteIfExpired(key, item) === false) {
212
+ this._moveToRecent(key, item);
225
213
  return item.value;
226
214
  }
227
215
  }
228
216
  }
229
217
 
230
- set(key, value, {maxAge = this.#maxAge} = {}) {
231
- const expiry = typeof maxAge === 'number' && maxAge !== Number.POSITIVE_INFINITY
232
- ? (Date.now() + maxAge)
233
- : undefined;
234
-
235
- if (this.#cache.has(key)) {
236
- this.#cache.set(key, {
218
+ set(key, value, {maxAge = this.maxAge} = {}) {
219
+ const expiry =
220
+ typeof maxAge === 'number' && maxAge !== Number.POSITIVE_INFINITY ?
221
+ Date.now() + maxAge :
222
+ undefined;
223
+ if (this.cache.has(key)) {
224
+ this.cache.set(key, {
237
225
  value,
238
- expiry,
226
+ expiry
239
227
  });
240
228
  } else {
241
- this.#set(key, {value, expiry});
229
+ this._set(key, {value, expiry});
242
230
  }
243
231
 
244
232
  return this;
245
233
  }
246
234
 
247
235
  has(key) {
248
- if (this.#cache.has(key)) {
249
- return !this.#deleteIfExpired(key, this.#cache.get(key));
236
+ if (this.cache.has(key)) {
237
+ return !this._deleteIfExpired(key, this.cache.get(key));
250
238
  }
251
239
 
252
- if (this.#oldCache.has(key)) {
253
- return !this.#deleteIfExpired(key, this.#oldCache.get(key));
240
+ if (this.oldCache.has(key)) {
241
+ return !this._deleteIfExpired(key, this.oldCache.get(key));
254
242
  }
255
243
 
256
244
  return false;
257
245
  }
258
246
 
259
247
  peek(key) {
260
- if (this.#cache.has(key)) {
261
- return this.#peek(key, this.#cache);
248
+ if (this.cache.has(key)) {
249
+ return this._peek(key, this.cache);
262
250
  }
263
251
 
264
- if (this.#oldCache.has(key)) {
265
- return this.#peek(key, this.#oldCache);
266
- }
267
- }
268
-
269
- expiresIn(key) {
270
- const item = this.#cache.get(key) ?? this.#oldCache.get(key);
271
- if (item) {
272
- return item.expiry ? item.expiry - Date.now() : Number.POSITIVE_INFINITY;
252
+ if (this.oldCache.has(key)) {
253
+ return this._peek(key, this.oldCache);
273
254
  }
274
255
  }
275
256
 
276
257
  delete(key) {
277
- const deleted = this.#cache.delete(key);
258
+ const deleted = this.cache.delete(key);
278
259
  if (deleted) {
279
- this.#size--;
260
+ this._size--;
280
261
  }
281
262
 
282
- return this.#oldCache.delete(key) || deleted;
263
+ return this.oldCache.delete(key) || deleted;
283
264
  }
284
265
 
285
266
  clear() {
286
- this.#cache.clear();
287
- this.#oldCache.clear();
288
- this.#size = 0;
267
+ this.cache.clear();
268
+ this.oldCache.clear();
269
+ this._size = 0;
289
270
  }
290
271
 
291
272
  resize(newSize) {
@@ -293,41 +274,23 @@ class QuickLRU extends Map {
293
274
  throw new TypeError('`maxSize` must be a number greater than 0');
294
275
  }
295
276
 
296
- const items = [...this.#entriesAscending()];
277
+ const items = [...this._entriesAscending()];
297
278
  const removeCount = items.length - newSize;
298
279
  if (removeCount < 0) {
299
- this.#cache = new Map(items);
300
- this.#oldCache = new Map();
301
- this.#size = items.length;
280
+ this.cache = new Map(items);
281
+ this.oldCache = new Map();
282
+ this._size = items.length;
302
283
  } else {
303
284
  if (removeCount > 0) {
304
- this.#emitEvictions(items.slice(0, removeCount));
285
+ this._emitEvictions(items.slice(0, removeCount));
305
286
  }
306
287
 
307
- this.#oldCache = new Map(items.slice(removeCount));
308
- this.#cache = new Map();
309
- this.#size = 0;
310
- }
311
-
312
- this.#maxSize = newSize;
313
- }
314
-
315
- evict(count = 1) {
316
- const requested = Number(count);
317
- if (!requested || requested <= 0) {
318
- return;
319
- }
320
-
321
- const items = [...this.#entriesAscending()];
322
- const evictCount = Math.trunc(Math.min(requested, Math.max(items.length - 1, 0)));
323
- if (evictCount <= 0) {
324
- return;
288
+ this.oldCache = new Map(items.slice(removeCount));
289
+ this.cache = new Map();
290
+ this._size = 0;
325
291
  }
326
292
 
327
- this.#emitEvictions(items.slice(0, evictCount));
328
- this.#oldCache = new Map(items.slice(evictCount));
329
- this.#cache = new Map();
330
- this.#size = 0;
293
+ this.maxSize = newSize;
331
294
  }
332
295
 
333
296
  * keys() {
@@ -343,18 +306,18 @@ class QuickLRU extends Map {
343
306
  }
344
307
 
345
308
  * [Symbol.iterator]() {
346
- for (const item of this.#cache) {
309
+ for (const item of this.cache) {
347
310
  const [key, value] = item;
348
- const deleted = this.#deleteIfExpired(key, value);
311
+ const deleted = this._deleteIfExpired(key, value);
349
312
  if (deleted === false) {
350
313
  yield [key, value.value];
351
314
  }
352
315
  }
353
316
 
354
- for (const item of this.#oldCache) {
317
+ for (const item of this.oldCache) {
355
318
  const [key, value] = item;
356
- if (!this.#cache.has(key)) {
357
- const deleted = this.#deleteIfExpired(key, value);
319
+ if (!this.cache.has(key)) {
320
+ const deleted = this._deleteIfExpired(key, value);
358
321
  if (deleted === false) {
359
322
  yield [key, value.value];
360
323
  }
@@ -363,22 +326,22 @@ class QuickLRU extends Map {
363
326
  }
364
327
 
365
328
  * entriesDescending() {
366
- let items = [...this.#cache];
329
+ let items = [...this.cache];
367
330
  for (let i = items.length - 1; i >= 0; --i) {
368
331
  const item = items[i];
369
332
  const [key, value] = item;
370
- const deleted = this.#deleteIfExpired(key, value);
333
+ const deleted = this._deleteIfExpired(key, value);
371
334
  if (deleted === false) {
372
335
  yield [key, value.value];
373
336
  }
374
337
  }
375
338
 
376
- items = [...this.#oldCache];
339
+ items = [...this.oldCache];
377
340
  for (let i = items.length - 1; i >= 0; --i) {
378
341
  const item = items[i];
379
342
  const [key, value] = item;
380
- if (!this.#cache.has(key)) {
381
- const deleted = this.#deleteIfExpired(key, value);
343
+ if (!this.cache.has(key)) {
344
+ const deleted = this._deleteIfExpired(key, value);
382
345
  if (deleted === false) {
383
346
  yield [key, value.value];
384
347
  }
@@ -387,32 +350,24 @@ class QuickLRU extends Map {
387
350
  }
388
351
 
389
352
  * entriesAscending() {
390
- for (const [key, value] of this.#entriesAscending()) {
353
+ for (const [key, value] of this._entriesAscending()) {
391
354
  yield [key, value.value];
392
355
  }
393
356
  }
394
357
 
395
358
  get size() {
396
- if (!this.#size) {
397
- return this.#oldCache.size;
359
+ if (!this._size) {
360
+ return this.oldCache.size;
398
361
  }
399
362
 
400
363
  let oldCacheSize = 0;
401
- for (const key of this.#oldCache.keys()) {
402
- if (!this.#cache.has(key)) {
364
+ for (const key of this.oldCache.keys()) {
365
+ if (!this.cache.has(key)) {
403
366
  oldCacheSize++;
404
367
  }
405
368
  }
406
369
 
407
- return Math.min(this.#size + oldCacheSize, this.#maxSize);
408
- }
409
-
410
- get maxSize() {
411
- return this.#maxSize;
412
- }
413
-
414
- get maxAge() {
415
- return this.#maxAge;
370
+ return Math.min(this._size + oldCacheSize, this.maxSize);
416
371
  }
417
372
 
418
373
  entries() {
@@ -426,15 +381,7 @@ class QuickLRU extends Map {
426
381
  }
427
382
 
428
383
  get [Symbol.toStringTag]() {
429
- return 'QuickLRU';
430
- }
431
-
432
- toString() {
433
- return `QuickLRU(${this.size}/${this.maxSize})`;
434
- }
435
-
436
- [Symbol.for('nodejs.util.inspect.custom')]() {
437
- return this.toString();
384
+ return JSON.stringify([...this.entriesAscending()]);
438
385
  }
439
386
  }
440
387
 
@@ -465,9 +412,16 @@ function getUserOS() {
465
412
  }
466
413
 
467
414
  // map from binary exponents to the corresponding binary data volume unit suffix
468
- const _EXP_UNITS = Object.fromEntries(["Bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"].map((unit, idx) => [idx * 10, unit]));
415
+ // 10x multiplier comes from SI units for each 2^10.
416
+ Object.fromEntries(["Bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"].map((unit, idx) => [idx * 10, unit]));
417
+ // map from base-10 exponents to the corresponding binary data volume unit suffix.
418
+ // 3x multiplier comes from SI units for each 10^3.
419
+ const _EXP_UNITS_BASE_10 = Object.fromEntries(["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"].map((unit, idx) => [
420
+ idx * 3,
421
+ unit,
422
+ ]));
469
423
  /**
470
- * Gets a human-friendly representation of numBytes, expressed in binary units.
424
+ * Gets a human-friendly representation of numBytes, expressed in base-10 units.
471
425
  *
472
426
  * @param numBytes whole number expressing the count of bytes to represent
473
427
  * @return the formatted friendly representation of the number of bytes
@@ -481,9 +435,10 @@ function humanBytes(numBytes) {
481
435
  case 1:
482
436
  return "1 Byte";
483
437
  }
484
- const exp = Math.floor(Math.log2(Math.abs(numBytes)) / 10) * 10.0;
485
- const precision = exp > 0 ? 1 : 0;
486
- return `${(numBytes / Math.pow(2, exp)).toFixed(precision)} ${_EXP_UNITS[exp]}`;
438
+ // log 10, exponent 3, for units that change every 10^3
439
+ const exp = Math.floor(Math.log10(Math.abs(numBytes)) / 3) * 3.0;
440
+ const precision = exp > 0 ? 2 : 0;
441
+ return `${(numBytes / Math.pow(10, exp)).toFixed(precision)} ${_EXP_UNITS_BASE_10[exp]}`;
487
442
  }
488
443
  function isoStringToDateString(timestamp, includeTime = false) {
489
444
  const dayConfig = {
@@ -521,9 +476,6 @@ class AdsTable extends i {
521
476
  this.selectedRowIds = [];
522
477
  this.isLoading = false;
523
478
  }
524
- getTableRowElementById(id) {
525
- return Array.from(this.tableRows || []).find((row) => row.id === `row-${id}`);
526
- }
527
479
  updated(changedProperties) {
528
480
  super.updated(changedProperties);
529
481
  if (changedProperties.has("selectedRowIds")) {
@@ -654,13 +606,13 @@ class AdsTable extends i {
654
606
  }
655
607
  renderArrowIcon(columnKey) {
656
608
  if (columnKey !== this.sortKey) {
657
- return b ``;
609
+ return x ``;
658
610
  }
659
611
  else if (this.sortDirection === "ascending") {
660
- return b `▲`;
612
+ return x `▲`;
661
613
  }
662
614
  else {
663
- return b `▼`;
615
+ return x `▼`;
664
616
  }
665
617
  }
666
618
  get selectedRowIdsSet() {
@@ -752,7 +704,21 @@ class AdsTable extends i {
752
704
  return this.onUpDownArrowKey(event);
753
705
  }
754
706
  }
755
- // listener applies when column has focus
707
+ // listener applies only after table has focus
708
+ onTableKeyDown(event) {
709
+ if (this.disableKeyboardNavigation) {
710
+ return;
711
+ }
712
+ // on esc or delete, emit an event
713
+ switch (event.key) {
714
+ case "Escape":
715
+ return this.emitEvent("table-navigate-back");
716
+ case "Backspace":
717
+ return this.emitEvent("table-navigate-back");
718
+ }
719
+ }
720
+ // listener applies when column has focus - does nothing since
721
+ // column header cannot get focus right now.
756
722
  onColumnKeyDown(event, column) {
757
723
  if (this.disableKeyboardNavigation) {
758
724
  return;
@@ -781,21 +747,22 @@ class AdsTable extends i {
781
747
  }
782
748
  }
783
749
  }
784
- onUpDownArrowKey(event) {
750
+ focusTableElement() {
785
751
  var _a;
752
+ (_a = this.tableElement) === null || _a === void 0 ? void 0 : _a.focus();
753
+ }
754
+ onUpDownArrowKey(event) {
786
755
  if (this.rows.length === 0) {
787
756
  // there are no rows to navigate or select with arrows. avoids array out of bounds.
788
757
  return;
789
758
  }
759
+ // focus the main table element with each arrow key press
760
+ this.focusTableElement();
790
761
  const indexOffset = event.key === "ArrowUp" ? -1 : 1;
791
762
  const newSelectedRowIndex = this.constrainIndex(this.indexOfLastSelectedRow + indexOffset);
792
763
  const newSelectedRowId = this.rows[newSelectedRowIndex].id;
793
- if (event.shiftKey) {
794
- // - focus and (maybe) select and focus the prev or next, if it exists
795
- this.groupRowSelect(newSelectedRowIndex);
796
- }
797
- else if (this.selectedRowIds.length === 0) {
798
- // select the first row if none are selected
764
+ if (this.selectedRowIds.length === 0) {
765
+ // if none are selected, select the first row
799
766
  const firstRowId = this.rows[0] ? this.rows[0].id : undefined;
800
767
  if (firstRowId) {
801
768
  this.selectedRowIds = [firstRowId];
@@ -805,8 +772,6 @@ class AdsTable extends i {
805
772
  // offset in the proper direction of the arrow
806
773
  this.selectedRowIds = [newSelectedRowId];
807
774
  }
808
- // always try to focus the next element in the direction of the arrow if you can
809
- (_a = this.getTableRowElementById(newSelectedRowId)) === null || _a === void 0 ? void 0 : _a.focus();
810
775
  }
811
776
  // ensures index values are kept to the closest in-bounds index
812
777
  constrainIndex(index) {
@@ -818,21 +783,27 @@ class AdsTable extends i {
818
783
  window.addEventListener("keydown", (e) => this.onKeyDown(e));
819
784
  }
820
785
  render() {
821
- return b `
822
- <table id="main-table">
786
+ return x `
787
+ <table
788
+ tabindex="0"
789
+ role="treegrid"
790
+ id="main-table"
791
+ @keydown=${(e) => this.onTableKeyDown(e)}
792
+ >
823
793
  <thead>
824
- <tr>
825
- ${this.visibleColumns.map((column) => b `
794
+ <tr role="row">
795
+ ${this.visibleColumns.map((column) => x `
826
796
  <th
797
+ role="gridcell"
798
+ aria-label=${column.label}
827
799
  @click=${() => this.onColumnClick(column)}
828
800
  @keydown=${(e) => this.onColumnKeyDown(e, column)}
829
801
  class=${column.dataType.compare ? "sortable" : ""}
830
802
  style=${`flex: ${column.flexRatio}`}
831
- tabindex="0"
832
803
  >
833
804
  ${column.label}
834
805
  ${column.dataType.compare
835
- ? b `<span>${this.renderArrowIcon(column.key)}</span>`
806
+ ? x `<span>${this.renderArrowIcon(column.key)}</span>`
836
807
  : ""}
837
808
  </th>
838
809
  `)}
@@ -840,33 +811,37 @@ class AdsTable extends i {
840
811
  </thead>
841
812
  <tbody>
842
813
  ${!this.isLoading
843
- ? this.sortedRows.map((row, index) => b `
814
+ ? this.sortedRows.map((row, index) => x `
844
815
  <tr
816
+ role="row"
845
817
  @click=${(e) => this.onRowClick(e, row, index)}
846
818
  @dblclick=${() => this.onRowDoubleClick(row)}
847
819
  @keydown=${(e) => this.onRowKeyDown(e, row, index)}
848
820
  class=${this.isSelected(row) ? "row-selected" : ""}
821
+ aria-selected=${this.isSelected(row)}
849
822
  data-row-selected=${this.isSelected(row)}
850
823
  data-id=${row.id}
851
824
  id=${"row-" + row.id}
852
- tabindex="0"
853
825
  >
854
- ${this.visibleColumns.map((column) => b `
855
- <td style=${`flex: ${column.flexRatio}`}>
826
+ ${this.visibleColumns.map((column) => x `
827
+ <td
828
+ role="gridcell"
829
+ style=${`flex: ${column.flexRatio}`}
830
+ >
856
831
  ${column.dataType.format(row.data)}
857
832
  </td>
858
833
  `)}
859
834
  </tr>
860
835
  `)
861
- : b `
862
- <tr>
863
- <td class="no-data">Loading...</td>
836
+ : x `
837
+ <tr role="row">
838
+ <td role="gridcell" class="no-data">Loading...</td>
864
839
  </tr>
865
840
  `}
866
841
  ${!this.isLoading && this.sortedRows.length === 0
867
- ? b `
868
- <tr>
869
- <td class="no-data">${this.noDataText}</td>
842
+ ? x `
843
+ <tr role="row">
844
+ <td role="gridcell" class="no-data">${this.noDataText}</td>
870
845
  </tr>
871
846
  `
872
847
  : null}
@@ -949,11 +924,8 @@ AdsTable.styles = i$3 `
949
924
  }
950
925
  `;
951
926
  __decorate([
952
- e$1("#main-table")
927
+ e("#main-table")
953
928
  ], AdsTable.prototype, "tableElement", void 0);
954
- __decorate([
955
- r("table tr")
956
- ], AdsTable.prototype, "tableRows", void 0);
957
929
  __decorate([
958
930
  n({ type: Array })
959
931
  ], AdsTable.prototype, "rows", void 0);
@@ -961,13 +933,13 @@ __decorate([
961
933
  n({ type: Boolean })
962
934
  ], AdsTable.prototype, "disableKeyboardNavigation", void 0);
963
935
  __decorate([
964
- r$1()
936
+ r()
965
937
  ], AdsTable.prototype, "sortDirection", void 0);
966
938
  __decorate([
967
- r$1()
939
+ r()
968
940
  ], AdsTable.prototype, "selectedRowIds", void 0);
969
941
  __decorate([
970
- r$1()
942
+ r()
971
943
  ], AdsTable.prototype, "isLoading", void 0);
972
944
  // a simple, generic, out-of-the box implementation of AdsTable
973
945
  let AdsSimpleTable = class AdsSimpleTable extends AdsTable {
@@ -995,7 +967,7 @@ __decorate([
995
967
  n({ type: String })
996
968
  ], AdsSimpleTable.prototype, "secondarySortKey", void 0);
997
969
  __decorate([
998
- r$1()
970
+ r()
999
971
  ], AdsSimpleTable.prototype, "sortKey", void 0);
1000
972
  AdsSimpleTable = __decorate([
1001
973
  t("ads-simple-table")
@@ -1013,19 +985,6 @@ const StringDataType = {
1013
985
  return value;
1014
986
  },
1015
987
  };
1016
- // for basic boolean comparison
1017
- const BooleanDataType = {
1018
- compare: (a, b) => {
1019
- if (a !== b) {
1020
- return a ? 1 : -1;
1021
- }
1022
- return 0;
1023
- },
1024
- format(value) {
1025
- return value.toString();
1026
- },
1027
- defaultSortDirection: "descending",
1028
- };
1029
988
  // for basic number comparison
1030
989
  const NumberDataType = {
1031
990
  compare: (a, b) => {
@@ -1089,5 +1048,5 @@ const NonSortable = (dataType) => ({
1089
1048
  compare: undefined,
1090
1049
  });
1091
1050
 
1092
- export { AdsSimpleTable, AdsTable, BooleanDataType, BytesDataType, DateDataType, FromKey, NonSortable, NumberDataType, StringDataType, UndefinedHelpers };
1051
+ export { AdsSimpleTable, AdsTable, BytesDataType, DateDataType, FromKey, NonSortable, NumberDataType, StringDataType, UndefinedHelpers };
1093
1052
  //# sourceMappingURL=index.js.map