From 07a918d573a017374d933720dc29f3ab39954a84 Mon Sep 17 00:00:00 2001 From: Bramus Date: Wed, 4 Dec 2024 17:32:11 +0100 Subject: [PATCH] Update Baseline widget to latest version (+ local edge logo fix) --- public/baseline-status.min.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/baseline-status.min.js b/public/baseline-status.min.js index 96f0879..b0233aa 100644 --- a/public/baseline-status.min.js +++ b/public/baseline-status.min.js @@ -8,7 +8,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */,{is:n,defineProperty:l,getOwnPropertyDescriptor:c,getOwnPropertyNames:p,getOwnPropertySymbols:h,getPrototypeOf:d}=Object,f=globalThis,C=f.trustedTypes,u=C?C.emptyScript:"",g=f.reactiveElementPolyfillSupport,y=(t,e)=>t,m={toAttribute(t,e){switch(e){case Boolean:t=t?u:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},L=(t,e)=>!n(t,e),v={attribute:!0,type:String,converter:m,reflect:!1,hasChanged:L};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class $ 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,e=v){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&l(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:o}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return i?.call(this)},set(e){const r=i?.call(this);o.call(this,e),this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??v}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const t=d(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const t=this.properties,e=[...p(t),...h(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,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,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const s=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((s,i)=>{if(e)s.adoptedStyleSheets=i.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of i){const i=document.createElement("style"),o=t.litNonce;void 0!==o&&i.setAttribute("nonce",o),i.textContent=e.cssText,s.appendChild(i)}})(s,this.constructor.elementStyles),s}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(void 0!==i&&!0===s.reflect){const o=(void 0!==s.converter?.toAttribute?s.converter:m).toAttribute(e,s.type);this._$Em=t,null==o?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=s.getPropertyOptions(i),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:m;this._$Em=i,this[i]=o.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){if(s??=this.constructor.getPropertyOptions(t),!(s.hasChanged??L)(this[t],e))return;this.P(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),!0===s.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;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,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t)!0!==s.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],s)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}}$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[y("elementProperties")]=new Map,$[y("finalized")]=new Map,g?.({ReactiveElement:$}),(f.reactiveElementVersions??=[]).push("2.0.4"); + */,{is:n,defineProperty:l,getOwnPropertyDescriptor:c,getOwnPropertyNames:p,getOwnPropertySymbols:h,getPrototypeOf:d}=Object,f=globalThis,C=f.trustedTypes,u=C?C.emptyScript:"",g=f.reactiveElementPolyfillSupport,m=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?u:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},L=(t,e)=>!n(t,e),v={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:L};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class $ 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,e=v){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&l(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:o}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return i?.call(this)},set(e){const r=i?.call(this);o.call(this,e),this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??v}static _$Ei(){if(this.hasOwnProperty(m("elementProperties")))return;const t=d(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(m("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(m("properties"))){const t=this.properties,e=[...p(t),...h(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,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,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const s=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((s,i)=>{if(e)s.adoptedStyleSheets=i.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of i){const i=document.createElement("style"),o=t.litNonce;void 0!==o&&i.setAttribute("nonce",o),i.textContent=e.cssText,s.appendChild(i)}})(s,this.constructor.elementStyles),s}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(void 0!==i&&!0===s.reflect){const o=(void 0!==s.converter?.toAttribute?s.converter:y).toAttribute(e,s.type);this._$Em=t,null==o?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=s.getPropertyOptions(i),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:y;this._$Em=i,this[i]=o.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){if(s??=this.constructor.getPropertyOptions(t),!(s.hasChanged??L)(this[t],e))return;this.P(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),!0===s.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;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,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t)!0!==s.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],s)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}}$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[m("elementProperties")]=new Map,$[m("finalized")]=new Map,g?.({ReactiveElement:$}),(f.reactiveElementVersions??=[]).push("2.0.4"); /** * @license * Copyright 2017 Google LLC @@ -26,4 +26,4 @@ class ot extends ${constructor(){super(...arguments),this.renderOptions={host:th * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const at=Symbol();class nt{get taskComplete(){return this.t||(1===this.status?this.t=new Promise(((t,e)=>{this.i=t,this.o=e})):3===this.status?this.t=Promise.reject(this.h):this.t=Promise.resolve(this.l)),this.t}constructor(t,e,s){this.u=0,this.status=0,(this.p=t).addController(this);const i="object"==typeof e?e:{task:e,args:s};this._=i.task,this.v=i.args,this.j=i.argsEqual??lt,this.m=i.onComplete,this.g=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.l=i.initialValue,this.status=2,this.k=this.A?.())}hostUpdate(){!0===this.autoRun&&this.O()}hostUpdated(){"afterUpdate"===this.autoRun&&this.O()}A(){if(void 0===this.v)return;const t=this.v();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async O(){const t=this.A(),e=this.k;this.k=t,t===e||void 0===t||void 0!==e&&this.j(e,t)||await this.run(t)}async run(t){let e,s;t??=this.A(),this.k=t,1===this.status?this.T?.abort():(this.t=void 0,this.i=void 0,this.o=void 0),this.status=1,"afterUpdate"===this.autoRun?queueMicrotask((()=>this.p.requestUpdate())):this.p.requestUpdate();const i=++this.u;this.T=new AbortController;let o=!1;try{e=await this._(t,{signal:this.T.signal})}catch(t){o=!0,s=t}if(this.u===i){if(e===at)this.status=0;else{if(!1===o){try{this.m?.(e)}catch{}this.status=2,this.i?.(e)}else{try{this.g?.(s)}catch{}this.status=3,this.o?.(s)}this.l=e,this.h=s}this.p.requestUpdate()}}abort(t){1===this.status&&this.T?.abort(t)}get value(){return this.l}get error(){return this.h}render(t){switch(this.status){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.status)}}}const lt=(t,e)=>t===e||t.length===e.length&&t.every(((t,s)=>!L(t,e[s]))),ct={limited:N``,widely:N``,newly:N``,no_data:N``};window.customElements.define("baseline-icon",class extends ot{static get styles(){return r`:host{--baseline-icon-limited-front:light-dark(#f09409, #f09409);--baseline-icon-limited-back:light-dark(#c6c6c6, #565656);--baseline-icon-widely-front:light-dark(#1ea446, #1ea446);--baseline-icon-widely-back:light-dark(#c4eed0, #125225);--baseline-icon-newly-front:light-dark(#1b6ef3, #4185ff);--baseline-icon-newly-back:light-dark(#a8c7fa, #2d509e);--baseline-icon-no_data:light-dark(#909090, #666666)}:host{height:20px}svg{width:36px;height:20px;display:inline-block}`}static get properties(){return{support:{type:String}}}render(){return ct[this.support]}});const pt=N``,ht=N``,dt=N``,ft=N``,Ct={limited:{title:"Limited availability",defaultDescription:"This feature is not Baseline because it does not work in some of the most widely-used browsers."},newly:{title:"",defaultDescription:"This feature works across the latest devices and browser versions. This feature might not work in older devices or browsers."},widely:{title:"Widely available",defaultDescription:"This feature is well established and works across many devices and browser versions."},loading:{title:"Loading",defaultDescription:""},no_data:{title:"Unknown availability",defaultDescription:"We currently don’t have browser support information about this feature."}},ut={available:N``,unavailable:N``,no_data:N``};class gt extends ot{static get styles(){return r`:host{--baseline-status-color-limited:light-dark(#ea8600, #f09418);--baseline-status-color-newly:light-dark(#1a73e8, #4185ff);--baseline-status-color-widely:light-dark(#1e8e3e, #24a446);--baseline-status-color-no_data:light-dark(#707070, #868686);--baseline-status-color-outline:light-dark(#d9d9d9, #d9d9d9);--baseline-status-color-link:light-dark(#1a73e8, #5aa1ff);color:inherit;display:block;border:solid 1px var(--baseline-status-color-outline);border-radius:8px;padding:16px 24px 0 24px;max-width:800px;font-family:Roboto,sans-serif;font-size:14px;font-style:normal}h1{font-weight:400;font-size:20px;margin:0}a,a:active,a:visited{color:var(--baseline-status-color-link)}::slotted(*){color:grey;font-style:italic;font-size:80%}.baseline-status-title{gap:1rem;display:flex;flex-wrap:wrap;justify-content:space-between;flex:1}.baseline-status-title{flex:1}.baseline-status-title div:first-child{display:flex;align-items:center;gap:.2rem}.baseline-badge{background:#3367d6;color:#fff;font-size:11px;padding:0 4px;border-radius:2px;text-transform:uppercase;line-height:20px;margin-inline:.5rem;white-space:nowrap}.baseline-status-browsers{font-size:0;max-width:200px;display:flex;gap:16px}.baseline-status-browsers span{white-space:nowrap}.support-no_data{color:var(--baseline-status-color-no_data)}.support-unavailable{color:var(--baseline-status-color-limited)}.support-newly{color:var(--baseline-status-color-newly)}.support-available,.support-widely{color:var(--baseline-status-color-widely)}details>summary .open-icon{width:10px;height:20px;margin-left:auto;color:inherit}@media (min-width:420px){details>summary .open-icon{margin-left:48px}}details>summary .open-icon svg{transition:transform .3s}details[open] summary .open-icon svg{transform:rotate(180deg)}summary{display:flex;cursor:pointer;font-size:16px;display:flex;flex-wrap:wrap;gap:16px;justify-content:space-between;padding:16px 0}summary::-webkit-details-marker{display:none}`}static get properties(){return{featureId:{type:String}}}fetchData=new nt(this,{task:async([t],{signal:e})=>{const s="https://api.webstatus.dev/v1/features/"+t,i=await fetch(s,{signal:e,cache:"force-cache"});if(!i.ok)throw new Error(i.status);return i.json()},args:()=>[this.featureId]});renderSupportIcon(t,e){const s="limited"===t?e?.status||"unavailable":t;return N`${ut["newly"===s||"widely"===s?"available":s]}`}getBaselineDate(t){return t.baseline.low_date?new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long"}).format(new Date(t.baseline.low_date)):""}getDescriptionDate(t,e){return"newly"===t&&e?`Since ${e} this feature works across the latest\n devices and browser versions. This feature might not work in older\n devices or browsers.`:"widely"===t&&e?`This feature is well established and works across many\n devices and browser versions. It’s been available across browsers\n since ${e}`:Ct[t].defaultDescription}renderTemplate(t,e){const s=t.baseline.status||"no_data",i="limited"===s||"no_data"===s?"":N`Baseline`,o=e?"Loading...":Ct[s].title,r="newly"===s?N`newly available`:"",a=this.getBaselineDate(t),n=this.getDescriptionDate(s,a),l="newly"===s&&a?a.split(" ")[1]:"",{chrome:c,edge:p,firefox:h,safari:d}=t.browser_implementations||{};return N`

${t.name}

("Unknown availability"===t&&(i=o=r=a="unknown"),`Baseline: ${t}${e?` ${e}`:""}${s?" (newly available)":""}. Supported in Chrome: ${"available"===i?"yes":i}. Supported in Edge: ${"available"===o?"yes":o}. Supported in Firefox: ${"available"===r?"yes":r}. Supported in Safari: ${"available"===a?"yes":a}.`))(o,l,r,c?.status,p?.status,h?.status,d?.status)}">

${n}

${"no_data"===s?"":N`Learn more`}

`}render(){const t={baseline:{status:"no_data"},name:this.featureId||"Unknown feature"};return this.featureId?this.fetchData.render({pending:()=>this.renderTemplate(t,!0),complete:e=>e&&e.baseline?this.renderTemplate(e):this.renderTemplate(t),error:()=>this.renderTemplate(t)}):this.renderTemplate(t)}}window.customElements.define("baseline-status",gt);export{gt as BaselineStatus}; +const at=Symbol();class nt{get taskComplete(){return this.t||(1===this.status?this.t=new Promise(((t,e)=>{this.i=t,this.o=e})):3===this.status?this.t=Promise.reject(this.h):this.t=Promise.resolve(this.l)),this.t}constructor(t,e,s){this.u=0,this.status=0,(this.p=t).addController(this);const i="object"==typeof e?e:{task:e,args:s};this._=i.task,this.v=i.args,this.j=i.argsEqual??lt,this.m=i.onComplete,this.g=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.l=i.initialValue,this.status=2,this.k=this.A?.())}hostUpdate(){!0===this.autoRun&&this.O()}hostUpdated(){"afterUpdate"===this.autoRun&&this.O()}A(){if(void 0===this.v)return;const t=this.v();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async O(){const t=this.A(),e=this.k;this.k=t,t===e||void 0===t||void 0!==e&&this.j(e,t)||await this.run(t)}async run(t){let e,s;t??=this.A(),this.k=t,1===this.status?this.T?.abort():(this.t=void 0,this.i=void 0,this.o=void 0),this.status=1,"afterUpdate"===this.autoRun?queueMicrotask((()=>this.p.requestUpdate())):this.p.requestUpdate();const i=++this.u;this.T=new AbortController;let o=!1;try{e=await this._(t,{signal:this.T.signal})}catch(t){o=!0,s=t}if(this.u===i){if(e===at)this.status=0;else{if(!1===o){try{this.m?.(e)}catch{}this.status=2,this.i?.(e)}else{try{this.g?.(s)}catch{}this.status=3,this.o?.(s)}this.l=e,this.h=s}this.p.requestUpdate()}}abort(t){1===this.status&&this.T?.abort(t)}get value(){return this.l}get error(){return this.h}render(t){switch(this.status){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.status)}}}const lt=(t,e)=>t===e||t.length===e.length&&t.every(((t,s)=>!L(t,e[s]))),ct={limited:N``,widely:N``,newly:N``,no_data:N``};window.customElements.define("baseline-icon",class extends ot{static get styles(){return r`:host{--baseline-icon-limited-front:light-dark(#f09409, #f09409);--baseline-icon-limited-back:light-dark(#c6c6c6, #565656);--baseline-icon-widely-front:light-dark(#1ea446, #1ea446);--baseline-icon-widely-back:light-dark(#c4eed0, #125225);--baseline-icon-newly-front:light-dark(#1b6ef3, #4185ff);--baseline-icon-newly-back:light-dark(#a8c7fa, #2d509e);--baseline-icon-no_data:light-dark(#909090, #666666)}:host{height:20px}svg{width:36px;height:20px;display:inline-block}`}static get properties(){return{support:{type:String}}}render(){return ct[this.support]}});const pt=N``,ht=N``,dt=N``,ft=N``,Ct={limited:{title:"Limited availability",defaultDescription:"This feature is not Baseline because it does not work in some of the most widely-used browsers."},newly:{title:"",defaultDescription:"This feature works across the latest devices and browser versions. This feature might not work in older devices or browsers."},widely:{title:"Widely available",defaultDescription:"This feature is well established and works across many devices and browser versions."},loading:{title:"Loading",defaultDescription:""},no_data:{title:"Unknown availability",defaultDescription:"We currently don’t have browser support information about this feature."}},ut={available:N``,unavailable:N``,no_data:N``};class gt extends ot{static get styles(){return r`:host{--baseline-status-color-limited:light-dark(#ea8600, #f09418);--baseline-status-color-newly:light-dark(#1a73e8, #4185ff);--baseline-status-color-widely:light-dark(#1e8e3e, #24a446);--baseline-status-color-no_data:light-dark(#707070, #868686);--baseline-status-color-outline:light-dark(#d9d9d9, #d9d9d9);--baseline-status-color-link:light-dark(#1a73e8, #5aa1ff);color:inherit;display:block;border:solid 1px var(--baseline-status-color-outline);border-radius:8px;padding:16px 24px 0 24px;max-width:800px;font-family:Roboto,sans-serif;font-size:14px;font-style:normal}.name{font-weight:400;font-size:20px;margin:0}a,a:active,a:visited{color:var(--baseline-status-color-link)}::slotted(*){color:grey;font-style:italic;font-size:80%}.baseline-status-title{gap:1rem;display:flex;flex-wrap:wrap;justify-content:space-between;flex:1}.baseline-status-title{flex:1}.baseline-status-title div:first-child{display:flex;align-items:center;gap:.2rem}.baseline-badge{background:#3367d6;color:#fff;font-size:11px;padding:0 4px;border-radius:2px;text-transform:uppercase;line-height:20px;margin-inline:.5rem;white-space:nowrap}.baseline-status-browsers{font-size:0;max-width:200px;display:flex;gap:16px}.baseline-status-browsers span{white-space:nowrap}.support-no_data{color:var(--baseline-status-color-no_data)}.support-unavailable{color:var(--baseline-status-color-limited)}.support-newly{color:var(--baseline-status-color-newly)}.support-available,.support-widely{color:var(--baseline-status-color-widely)}details>summary .open-icon{width:10px;height:20px;margin-left:auto;color:inherit}@media (min-width:420px){details>summary .open-icon{margin-left:48px}}details>summary .open-icon svg{transition:transform .3s}details[open] summary .open-icon svg{transform:rotate(180deg)}summary{display:flex;cursor:pointer;font-size:16px;display:flex;flex-wrap:wrap;gap:16px;justify-content:space-between;padding:16px 0}summary::-webkit-details-marker{display:none}`}static get properties(){return{featureId:{type:String}}}fetchData=new nt(this,{task:async([t],{signal:e})=>{const s="https://api.webstatus.dev/v1/features/"+t,i=await fetch(s,{signal:e,cache:"force-cache"});if(!i.ok)throw new Error(i.status);return i.json()},args:()=>[this.featureId]});renderSupportIcon(t,e){const s="limited"===t?e?.status||"unavailable":t;return N`${ut["newly"===s||"widely"===s?"available":s]}`}getBaselineDate(t){return t.baseline.low_date?new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long"}).format(new Date(t.baseline.low_date)):""}getDescriptionDate(t,e){return"newly"===t&&e?`Since ${e} this feature works across the latest\n devices and browser versions. This feature might not work in older\n devices or browsers.`:"widely"===t&&e?`This feature is well established and works across many\n devices and browser versions. It’s been available across browsers\n since ${e}`:Ct[t].defaultDescription}renderTemplate(t,e){const s=t.baseline.status||"no_data",i="limited"===s||"no_data"===s?"":N`Baseline`,o=e?"Loading...":Ct[s].title,r="newly"===s?N`newly available`:"",a=this.getBaselineDate(t),n=this.getDescriptionDate(s,a),l="newly"===s&&a?a.split(" ")[1]:"",{chrome:c,edge:p,firefox:h,safari:d}=t.browser_implementations||{};return N`
${t.name}
("Unknown availability"===t&&(i=o=r=a="unknown"),`Baseline: ${t}${e?` ${e}`:""}${s?" (newly available)":""}. Supported in Chrome: ${"available"===i?"yes":i}. Supported in Edge: ${"available"===o?"yes":o}. Supported in Firefox: ${"available"===r?"yes":r}. Supported in Safari: ${"available"===a?"yes":a}.`))(o,l,r,c?.status,p?.status,h?.status,d?.status)}">

${n}

${"no_data"===s?"":N`Learn more`}

`}render(){const t={baseline:{status:"no_data"},name:this.featureId||"Unknown feature"};return this.featureId?this.fetchData.render({pending:()=>this.renderTemplate(t,!0),complete:e=>e&&e.baseline?this.renderTemplate(e):this.renderTemplate(t),error:()=>this.renderTemplate(t)}):this.renderTemplate(t)}}window.customElements.define("baseline-status",gt);export{gt as BaselineStatus};