timered-counter 1.2.0 → 1.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +264 -64
- package/dist/custom-elements.json +264 -64
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +9 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/timered-counter-adapter.d.ts +2 -1
- package/dist/src/timered-counter-adapter.js +4 -1
- package/dist/src/timered-counter-adapter.js.map +1 -1
- package/dist/src/timered-counter-datetime-duration.js +5 -7
- package/dist/src/timered-counter-datetime-duration.js.map +1 -1
- package/dist/src/timered-counter-number.js +5 -7
- package/dist/src/timered-counter-number.js.map +1 -1
- package/dist/src/timered-counter-string.js +4 -8
- package/dist/src/timered-counter-string.js.map +1 -1
- package/dist/src/timered-counter.js +5 -7
- package/dist/src/timered-counter.js.map +1 -1
- package/dist/src/transitions/roller/roller-digit.js +5 -7
- package/dist/src/transitions/roller/roller-digit.js.map +1 -1
- package/dist/src/transitions/roller/roller.js +5 -7
- package/dist/src/transitions/roller/roller.js.map +1 -1
- package/dist/src/utils/grace-define-custom-element.d.ts +1 -0
- package/dist/src/utils/grace-define-custom-element.js +10 -0
- package/dist/src/utils/grace-define-custom-element.js.map +1 -0
- package/dist/src/wrappers/vue/format-props.d.ts +1 -0
- package/dist/src/wrappers/vue/format-props.js +22 -0
- package/dist/src/wrappers/vue/format-props.js.map +1 -0
- package/dist/src/wrappers/vue/index.d.ts +14 -0
- package/dist/src/wrappers/vue/index.js +13 -0
- package/dist/src/wrappers/vue/index.js.map +1 -0
- package/dist/src/wrappers/vue/timered-counter-datetime-duration.d.ts +14 -0
- package/dist/src/wrappers/vue/timered-counter-datetime-duration.js +39 -0
- package/dist/src/wrappers/vue/timered-counter-datetime-duration.js.map +1 -0
- package/dist/src/wrappers/vue/timered-counter-number.d.ts +14 -0
- package/dist/src/wrappers/vue/timered-counter-number.js +39 -0
- package/dist/src/wrappers/vue/timered-counter-number.js.map +1 -0
- package/dist/src/wrappers/vue/timered-counter-string.d.ts +14 -0
- package/dist/src/wrappers/vue/timered-counter-string.js +38 -0
- package/dist/src/wrappers/vue/timered-counter-string.js.map +1 -0
- package/dist/stories/timered-counter/decimaljs.stories.js +1 -1
- package/dist/stories/timered-counter/decimaljs.stories.js.map +1 -1
- package/dist/stories/timered-counter-number/decimaljs.stories.js +1 -1
- package/dist/stories/timered-counter-number/decimaljs.stories.js.map +1 -1
- package/dist/stories/timered-counter-string/decimaljs.stories.js +1 -1
- package/dist/stories/timered-counter-string/decimaljs.stories.js.map +1 -1
- package/dist/stories/timered-counter-string/grapheme-splitter.stories.js +2 -2
- package/dist/stories/timered-counter-string/grapheme-splitter.stories.js.map +1 -1
- package/dist/stories/timered-counter-string/intl-segmenter.stories.js +1 -1
- package/dist/stories/timered-counter-string/intl-segmenter.stories.js.map +1 -1
- package/dist/timered-counter.esm-browser.js +53 -58
- package/dist/timered-counter.esm-browser.js.map +1 -1
- package/dist/timered-counter.global.js +47 -52
- package/dist/timered-counter.global.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -2
@@ -1,43 +1,38 @@
|
|
1
|
-
var t,e;t=this,e=function(t){function
|
1
|
+
var t,e;t=this,e=function(t,e,i){function r(t,e,i,r){var s,n=arguments.length,o=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(n<3?s(o):n>3?s(e,i,o):s(e,i))||o);return n>3&&o&&Object.defineProperty(e,i,o),o}function s(t,e,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(t):r?r.value:e.get(t)}"function"==typeof SuppressedError&&SuppressedError;
|
2
2
|
/**
|
3
3
|
* @license
|
4
4
|
* Copyright 2019 Google LLC
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
6
6
|
*/
|
7
|
-
const
|
7
|
+
const n=globalThis,o=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),l=new WeakMap;let c=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==a)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(o&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=l.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&l.set(e,t))}return t}toString(){return this.cssText}};const u=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,r)=>e+(t=>{if(!0===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.")})(i)+t[r+1]),t[0]);return new c(i,t,a)},h=o?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new c("string"==typeof t?t:t+"",void 0,a))(e)})(t):t
|
8
8
|
/**
|
9
9
|
* @license
|
10
10
|
* Copyright 2017 Google LLC
|
11
11
|
* SPDX-License-Identifier: BSD-3-Clause
|
12
|
-
*/,{is:
|
12
|
+
*/,{is:p,defineProperty:d,getOwnPropertyDescriptor:f,getOwnPropertyNames:m,getOwnPropertySymbols:g,getPrototypeOf:_}=Object,y=globalThis,A=y.trustedTypes,b=A?A.emptyScript:"",$=y.reactiveElementPolyfillSupport,v=(t,e)=>t,S={toAttribute(t,e){switch(e){case Boolean:t=t?b:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){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}},P=(t,e)=>!p(t,e),x={attribute:!0,type:String,converter:S,reflect:!1,hasChanged:P};Symbol.metadata??=Symbol("metadata"),y.litPropertyMetadata??=new WeakMap;class w 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=x){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,e);void 0!==r&&d(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){const{get:r,set:s}=f(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return r?.call(this)},set(e){const n=r?.call(this);s.call(this,e),this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??x}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const t=_(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const t=this.properties,e=[...m(t),...g(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(h(t))}else void 0!==t&&e.push(h(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"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 i of e.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((t,e)=>{if(o)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of e){const e=document.createElement("style"),r=n.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}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,i){this._$AK(t,i)}_$EC(t,e){const i=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,i);if(void 0!==r&&!0===i.reflect){const s=(void 0!==i.converter?.toAttribute?i.converter:S).toAttribute(e,i.type);this._$Em=t,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$Em=null}}_$AK(t,e){const i=this.constructor,r=i._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=i.getPropertyOptions(r),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:S;this._$Em=r,this[r]=s.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??P)(this[t],e))return;this.P(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),!0===i.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,i]of t)!0!==i.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],i)}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){}}w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[v("elementProperties")]=new Map,w[v("finalized")]=new Map,$?.({ReactiveElement:w}),(y.reactiveElementVersions??=[]).push("2.0.4");
|
13
13
|
/**
|
14
14
|
* @license
|
15
15
|
* Copyright 2017 Google LLC
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
17
17
|
*/
|
18
|
-
const
|
18
|
+
const D=globalThis,T=D.trustedTypes,O=T?T.createPolicy("lit-html",{createHTML:t=>t}):void 0,E="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+C,M=`<${N}>`,k=document,I=()=>k.createComment(""),R=t=>null===t||"object"!=typeof t&&"function"!=typeof t,U=Array.isArray,L="[ \t\n\f\r]",j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,V=/-->/g,B=/>/g,H=RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),z=/'/g,F=/"/g,Y=/^(?:script|style|textarea|title)$/i,q=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),W=Symbol.for("lit-noChange"),Q=Symbol.for("lit-nothing"),G=new WeakMap,K=k.createTreeWalker(k,129);function J(t,e){if(!U(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==O?O.createHTML(e):e}class Z{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let s=0,n=0;const o=t.length-1,a=this.parts,[l,c]=((t,e)=>{const i=t.length-1,r=[];let s,n=2===e?"<svg>":3===e?"<math>":"",o=j;for(let e=0;e<i;e++){const i=t[e];let a,l,c=-1,u=0;for(;u<i.length&&(o.lastIndex=u,l=o.exec(i),null!==l);)u=o.lastIndex,o===j?"!--"===l[1]?o=V:void 0!==l[1]?o=B:void 0!==l[2]?(Y.test(l[2])&&(s=RegExp("</"+l[2],"g")),o=H):void 0!==l[3]&&(o=H):o===H?">"===l[0]?(o=s??j,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,a=l[1],o=void 0===l[3]?H:'"'===l[3]?F:z):o===F||o===z?o=H:o===V||o===B?o=j:(o=H,s=void 0);const h=o===H&&t[e+1].startsWith("/>")?" ":"";n+=o===j?i+M:c>=0?(r.push(a),i.slice(0,c)+E+i.slice(c)+C+h):i+C+(-2===c?e:h)}return[J(t,n+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]})(t,e);if(this.el=Z.createElement(l,i),K.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=K.nextNode())&&a.length<o;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(E)){const e=c[n++],i=r.getAttribute(t).split(C),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:s,name:o[2],strings:i,ctor:"."===o[1]?rt:"?"===o[1]?st:"@"===o[1]?nt:it}),r.removeAttribute(t)}else t.startsWith(C)&&(a.push({type:6,index:s}),r.removeAttribute(t));if(Y.test(r.tagName)){const t=r.textContent.split(C),e=t.length-1;if(e>0){r.textContent=T?T.emptyScript:"";for(let i=0;i<e;i++)r.append(t[i],I()),K.nextNode(),a.push({type:2,index:++s});r.append(t[e],I())}}}else if(8===r.nodeType)if(r.data===N)a.push({type:2,index:s});else{let t=-1;for(;-1!==(t=r.data.indexOf(C,t+1));)a.push({type:7,index:s}),t+=C.length-1}s++}}static createElement(t,e){const i=k.createElement("template");return i.innerHTML=t,i}}function X(t,e,i=t,r){if(e===W)return e;let s=void 0!==r?i._$Co?.[r]:i._$Cl;const n=R(e)?void 0:e._$litDirective$;return s?.constructor!==n&&(s?._$AO?.(!1),void 0===n?s=void 0:(s=new n(t),s._$AT(t,i,r)),void 0!==r?(i._$Co??=[])[r]=s:i._$Cl=s),void 0!==s&&(e=X(t,s._$AS(t,e.values),s,r)),e}let tt=class{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){const{el:{content:e},parts:i}=this._$AD,r=(t?.creationScope??k).importNode(e,!0);K.currentNode=r;let s=K.nextNode(),n=0,o=0,a=i[0];for(;void 0!==a;){if(n===a.index){let e;2===a.type?e=new et(s,s.nextSibling,this,t):1===a.type?e=new a.ctor(s,a.name,a.strings,this,t):6===a.type&&(e=new ot(s,this,t)),this._$AV.push(e),a=i[++o]}n!==a?.index&&(s=K.nextNode(),n++)}return K.currentNode=k,r}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}};class et{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,r){this.type=2,this._$AH=Q,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=X(this,t,e),R(t)?t===Q||null==t||""===t?(this._$AH!==Q&&this._$AR(),this._$AH=Q):t!==this._$AH&&t!==W&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>U(t)||"function"==typeof t?.[Symbol.iterator])(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!==Q&&R(this._$AH)?this._$AA.nextSibling.data=t:this.T(k.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,r="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=Z.createElement(J(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new tt(r,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new Z(t)),e}k(t){U(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,r=0;for(const s of t)r===e.length?e.push(i=new et(this.O(I()),this.O(I()),this,this.options)):i=e[r],i._$AI(s),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}let it=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,r,s){this.type=1,this._$AH=Q,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Q}_$AI(t,e=this,i,r){const s=this.strings;let n=!1;if(void 0===s)t=X(this,t,e,0),n=!R(t)||t!==this._$AH&&t!==W,n&&(this._$AH=t);else{const r=t;let o,a;for(t=s[0],o=0;o<s.length-1;o++)a=X(this,r[i+o],e,o),a===W&&(a=this._$AH[o]),n||=!R(a)||a!==this._$AH[o],a===Q?t=Q:t!==Q&&(t+=(a??"")+s[o+1]),this._$AH[o]=a}n&&!r&&this.j(t)}j(t){t===Q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}};class rt extends it{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Q?void 0:t}}class st extends it{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Q)}}class nt extends it{constructor(t,e,i,r,s){super(t,e,i,r,s),this.type=5}_$AI(t,e=this){if((t=X(this,t,e,0)??Q)===W)return;const i=this._$AH,r=t===Q&&i!==Q||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,s=t!==Q&&(i===Q||r);r&&this.element.removeEventListener(this.name,this,i),s&&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 ot{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){X(this,t)}}const at={I:et},lt=D.litHtmlPolyfillSupport;lt?.(Z,et),(D.litHtmlVersions??=[]).push("3.2.1");
|
19
19
|
/**
|
20
20
|
* @license
|
21
21
|
* Copyright 2017 Google LLC
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
23
23
|
*/
|
24
|
-
let
|
24
|
+
let ct=class extends w{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 e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const r=i?.renderBefore??e;let s=r._$litPart$;if(void 0===s){const t=i?.renderBefore??null;r._$litPart$=s=new et(e.insertBefore(I(),t),t,void 0,i??{})}return s._$AI(t),s})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return W}};ct._$litElement$=!0,ct.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ct});const ut=globalThis.litElementPolyfillSupport;ut?.({LitElement:ct}),(globalThis.litElementVersions??=[]).push("4.1.1");
|
25
25
|
/**
|
26
26
|
* @license
|
27
27
|
* Copyright 2017 Google LLC
|
28
28
|
* SPDX-License-Identifier: BSD-3-Clause
|
29
29
|
*/
|
30
|
-
const
|
30
|
+
const ht={attribute:!0,type:String,converter:S,reflect:!1,hasChanged:P},pt=(t=ht,e,i)=>{const{kind:r,metadata:s}=i;let n=globalThis.litPropertyMetadata.get(s);if(void 0===n&&globalThis.litPropertyMetadata.set(s,n=new Map),n.set(i.name,t),"accessor"===r){const{name:r}=i;return{set(i){const s=e.get.call(this);e.set.call(this,i),this.requestUpdate(r,s,t)},init(e){return void 0!==e&&this.P(r,void 0,t),e}}}if("setter"===r){const{name:r}=i;return function(i){const s=this[r];e.call(this,i),this.requestUpdate(r,s,t)}}throw Error("Unsupported decorator location: "+r)};function dt(t){return(e,i)=>"object"==typeof i?pt(t,e,i):((t,e,i)=>{const r=e.hasOwnProperty(i);return e.constructor.createProperty(i,r?{...t,wrapped:!0}:t),r?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)
|
31
31
|
/**
|
32
32
|
* @license
|
33
33
|
* Copyright 2017 Google LLC
|
34
34
|
* SPDX-License-Identifier: BSD-3-Clause
|
35
|
-
|
36
|
-
/**
|
37
|
-
* @license
|
38
|
-
* Copyright 2017 Google LLC
|
39
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
40
|
-
*/}function dt(t){return pt({...t,state:!0,attribute:!1})}
|
35
|
+
*/}function ft(t){return dt({...t,state:!0,attribute:!1})}
|
41
36
|
/**
|
42
37
|
* @license
|
43
38
|
* Copyright 2017 Google LLC
|
@@ -48,22 +43,22 @@ const ct=t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)
|
|
48
43
|
* Copyright 2017 Google LLC
|
49
44
|
* SPDX-License-Identifier: BSD-3-Clause
|
50
45
|
*/
|
51
|
-
function
|
46
|
+
function mt(t,e){return(e,i,r)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i))(e,i,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}
|
52
47
|
/**
|
53
48
|
* @license
|
54
49
|
* Copyright 2017 Google LLC
|
55
50
|
* SPDX-License-Identifier: BSD-3-Clause
|
56
|
-
*/const
|
51
|
+
*/const gt=1,_t=2,yt=t=>(...e)=>({_$litDirective$:t,values:e});let At=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
|
57
52
|
/**
|
58
53
|
* @license
|
59
54
|
* Copyright 2020 Google LLC
|
60
55
|
* SPDX-License-Identifier: BSD-3-Clause
|
61
|
-
*/const{I:
|
56
|
+
*/const{I:bt}=at,$t=()=>document.createComment(""),vt=(t,e,i)=>{const r=t._$AA.parentNode,s=void 0===e?t._$AB:e._$AA;if(void 0===i){const e=r.insertBefore($t(),s),n=r.insertBefore($t(),s);i=new bt(e,n,t,t.options)}else{const e=i._$AB.nextSibling,n=i._$AM,o=n!==t;if(o){let e;i._$AQ?.(t),i._$AM=t,void 0!==i._$AP&&(e=t._$AU)!==n._$AU&&i._$AP(e)}if(e!==s||o){let t=i._$AA;for(;t!==e;){const e=t.nextSibling;r.insertBefore(t,s),t=e}}}return i},St=(t,e,i=t)=>(t._$AI(e,i),t),Pt={},xt=t=>{t._$AP?.(!1,!0);let e=t._$AA;const i=t._$AB.nextSibling;for(;e!==i;){const t=e.nextSibling;e.remove(),e=t}},wt=(t,e,i)=>{const r=new Map;for(let s=e;s<=i;s++)r.set(t[s],s);return r},Dt=yt(class extends At{constructor(t){if(super(t),t.type!==_t)throw Error("repeat() can only be used in text expressions")}dt(t,e,i){let r;void 0===i?i=e:void 0!==e&&(r=e);const s=[],n=[];let o=0;for(const e of t)s[o]=r?r(e,o):o,n[o]=i(e,o),o++;return{values:n,keys:s}}render(t,e,i){return this.dt(t,e,i).values}update(t,[e,i,r]){const s=(t=>t._$AH)(t),{values:n,keys:o}=this.dt(e,i,r);if(!Array.isArray(s))return this.ut=o,n;const a=this.ut??=[],l=[];let c,u,h=0,p=s.length-1,d=0,f=n.length-1;for(;h<=p&&d<=f;)if(null===s[h])h++;else if(null===s[p])p--;else if(a[h]===o[d])l[d]=St(s[h],n[d]),h++,d++;else if(a[p]===o[f])l[f]=St(s[p],n[f]),p--,f--;else if(a[h]===o[f])l[f]=St(s[h],n[f]),vt(t,l[f+1],s[h]),h++,f--;else if(a[p]===o[d])l[d]=St(s[p],n[d]),vt(t,s[h],s[p]),p--,d++;else if(void 0===c&&(c=wt(o,d,f),u=wt(a,h,p)),c.has(a[h]))if(c.has(a[p])){const e=u.get(o[d]),i=void 0!==e?s[e]:null;if(null===i){const e=vt(t,s[h]);St(e,n[d]),l[d]=e}else l[d]=St(i,n[d]),vt(t,s[h],i),s[e]=null;d++}else xt(s[p]),p--;else xt(s[h]),h++;for(;d<=f;){const e=vt(t,l[f+1]);St(e,n[d]),l[d++]=e}for(;h<=p;){const t=s[h++];null!==t&&xt(t)}return this.ut=o,((t,e=Pt)=>{t._$AH=e})(t,l),W}});
|
62
57
|
/**
|
63
58
|
* @license
|
64
59
|
* Copyright 2017 Google LLC
|
65
60
|
* SPDX-License-Identifier: BSD-3-Clause
|
66
|
-
*/var xt={done:!0,hasNext:!1},Ct={done:!1,hasNext:!1},wt=()=>xt;function Ot(t,...e){let i=t,r=e.map((t=>"lazy"in t?function(t){let{lazy:e,lazyArgs:i}=t,r=e(...i);return Object.assign(r,{isSingle:e.single??!1,index:0,items:[]})}(t):void 0)),s=0;for(;s<e.length;){if(void 0===r[s]||!Mt(i)){i=(0,e[s])(i),s+=1;continue}let t=[];for(let i=s;i<e.length;i++){let e=r[i];if(void 0===e||(t.push(e),e.isSingle))break}let n=[];for(let e of i)if(Et(e,n,t))break;let{isSingle:o}=t.at(-1);i=o?n[0]:n,s+=t.length}return i}function Et(t,e,i){if(0===i.length)return e.push(t),!1;let r=t,s=Ct,n=!1;for(let[t,o]of i.entries()){let{index:a,items:l}=o;if(l.push(r),s=o(r,a,l),o.index+=1,s.hasNext){if(s.hasMany){for(let r of s.next)if(Et(r,e,i.slice(t+1)))return!0;return n}r=s.next}if(!s.hasNext)break;s.done&&(n=!0)}return s.hasNext&&e.push(r),n}function Mt(t){return"string"==typeof t||"object"==typeof t&&null!==t&&Symbol.iterator in t}function Nt(t,e,i){let r=t.length-e.length;if(0===r)return t(...e);if(1===r)return function(t,e,i){let r=i=>t(i,...e);return void 0===i?r:Object.assign(r,{lazy:i,lazyArgs:e})}(t,e,i);throw new Error("Wrong number of arguments")}function kt(...t){return Nt(It,t)}var It=(t,e)=>t.length>=e;function Rt(t,e){let i=[];for(let r=t;r<e;r++)i.push(r);return i}function Ut(t,e){if(!kt(e,1))return{...t};if(!kt(e,2)){let{[e[0]]:i,...r}=t;return r}let i={...t};for(let t of e)delete i[t];return i}function Lt(...t){return Nt(Vt,t)}var Vt=(t,e)=>({...t,...e});function jt(...t){return Nt(Bt,t,Ht)}var Bt=(t,e)=>t.map(e),Ht=t=>(e,i,r)=>({done:!1,hasNext:!0,next:t(e,i,r)});function zt(t){return"number"==typeof t&&!Number.isNaN(t)}function Ft(t){return"string"==typeof t}function Yt(t){return void 0===t||("string"==typeof t||Array.isArray(t)?0===t.length:0===Object.keys(t).length)}function Wt(t){return null==t}function Qt(t){return Array.isArray(t)}function qt(t){return"boolean"==typeof t}function Kt(t){return t instanceof Date}function Gt(...t){return Nt(Jt,t)}function Jt(t,e){if(t===e||Object.is(t,e))return!0;if("object"!=typeof t||"object"!=typeof e||null===t||null===e||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;if(Array.isArray(t))return function(t,e){if(t.length!==e.length)return!1;for(let[i,r]of t.entries())if(!Jt(r,e[i]))return!1;return!0}(t,e);if(t instanceof Map)return function(t,e){if(t.size!==e.size)return!1;for(let[i,r]of t.entries())if(!e.has(i)||!Jt(r,e.get(i)))return!1;return!0}(t,e);if(t instanceof Set)return function(t,e){if(t.size!==e.size)return!1;let i=[...e];for(let e of t){let t=!1;for(let[r,s]of i.entries())if(Jt(e,s)){t=!0,i.splice(r,1);break}if(!t)return!1}return!0}(t,e);if(t instanceof Date)return t.getTime()===e.getTime();if(t instanceof RegExp)return t.toString()===e.toString();if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let[i,r]of Object.entries(t))if(!(i in e)||!Jt(r,e[i]))return!1;return!0}function Zt(...t){return function(t,e){let i=e.length-t.length;if(1===i){let[i,...r]=e;return Ot(i,{lazy:t,lazyArgs:r})}if(0===i){let i={lazy:t,lazyArgs:e};return Object.assign((t=>Ot(t,i)),i)}throw new Error("Wrong number of arguments")}(Xt,t)}function Xt(t){if(0===t.length)return wt;let e=new Map;for(let i of t)e.set(i,(e.get(i)??0)+1);return t=>{let i=e.get(t);return void 0===i||0===i?Ct:(1===i?e.delete(t):e.set(t,i-1),{hasNext:!0,next:t,done:0===e.size})}}function te(t,e){const i=function(t,e){return function(t){return"function"==typeof t}(t)?t(e):t}(t,e),{data:r}=e,s=[];for(let t=0;t<r.length;t+=1){const e=Qt(i)?i[t]:i;s.push(e)}return s}function ee(t,e){const i=te(t,e),{data:r}=e,s=[];for(let t=0;t<r.length;t+=1){const{digits:e}=r[t],n=i[t];s.push([]);for(let i=0;i<e.length;i+=1){const e=Qt(n)?n[i]:n;s[t].push(e)}}return s}function ie(t,e){const i=ee(t,e),{data:r}=e,s=[];for(let t=0;t<r.length;t+=1){const{digits:e}=r[t],n=i[t];s.push([]);for(let i=0;i<e.length;i+=1){const{data:r}=e[i],o=n[i];s[t].push([]);for(let e=0;e<r.length;e+=1){const r=Qt(o)?o[e]:o;s[t][i].push(r)}}}return s}function re(t,e){return Lt(t??{},e??{})}function se(t=[],e=[]){const i=Array.from(new Set(Object.keys(t).concat(Object.keys(e))));for(const r of i){const i=Number.parseInt(r,10);t[i]=re(t[i],e[i])}return t}function ne(t=[],e=[]){const i=Array.from(new Set(Object.keys(t).concat(Object.keys(e))));for(const r of i){const i=Number.parseInt(r,10);t[i]=se(t[i],e[i])}return t}const oe=t=>{class i extends t{constructor(){super(...arguments),this.cellStyles={},this.cachedCellStyles=[],this.digitStyles={},this.cachedDigitStyles=[],this.partStyles={},this.cachedPartStyles=[],this.color="inherit"}extractCellStyles(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=function(t=[],e=[]){const i=Array.from(new Set(Object.keys(t).concat(Object.keys(e))));for(const r of i){const i=Number.parseInt(r,10);t[i]=ne(t[i],e[i])}return t}(ie(this.cellStyles??{},t),ie(this.cellStylesDynamic??{},t));return Gt(this.cachedCellStyles,e)||(this.cachedCellStyles=e),this.cachedCellStyles}extractDigitStyles(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=ne(ee(this.digitStyles??{},t),ee(this.digitStylesDynamic??{},t));return Gt(this.cachedDigitStyles,e)||(this.cachedDigitStyles=e),this.cachedDigitStyles}extractPartStyles(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=se(te(this.partStyles??{},t),te(this.partStylesDynamic??{},t));return Gt(this.cachedPartStyles,e)||(this.cachedPartStyles=e),this.cachedPartStyles}}return e([pt({type:Object,attribute:"cell-styles",reflect:!0})],i.prototype,"cellStyles",void 0),e([pt({type:Object,attribute:"digit-styles",reflect:!0})],i.prototype,"digitStyles",void 0),e([pt({type:Object,attribute:"part-styles",reflect:!0})],i.prototype,"partStyles",void 0),e([pt({type:String,reflect:!0})],i.prototype,"color",void 0),i};function ae(t){return t.length}function le(){return function(t){if(!(s=t.length))return[];for(var e=-1,i=function(t,e){let i;if(void 0===e)for(const e of t)null!=e&&(i>e||void 0===i&&e>=e)&&(i=e);else{let r=-1;for(let s of t)null!=(s=e(s,++r,t))&&(i>s||void 0===i&&s>=s)&&(i=s)}return i}(t,ae),r=new Array(i);++e<i;)for(var s,n=-1,o=r[e]=new Array(s);++n<s;)o[n]=t[n][e];return r}(arguments)}function ce(t,e){const[i,r]=t,[s,n]=e,o={animate:!0,cancelPrevAnimation:!1};let a="";return 1===s.data.length&&(o.animate=!1,o.cancelPrevAnimation=!0,a="only one digit"),i!==r||(s.data[0]===s.data[s.data.length-1]&&(o.animate=!1,o.cancelPrevAnimation=!0,a="same head and tail"),Gt(s,n)&&(o.animate=!1,a="same digits"),a&&(o.earlyReturn=a)),o}function ue(t){try{return JSON.parse(t)}catch(e){return t}}function he(t){const e={};return Qt(t.digitToChar)?t.digitToChar.forEach(((t,i)=>{var r;e[(r=i,String.fromCodePoint(r+48))]=t})):function(t){return"object"==typeof t&&null!==t}(t.digitToChar)&&Object.entries(t.digitToChar).forEach((([t,i])=>{e[t]=i})),{...t,digitToChar:e}}const pe=t=>{var r,s;class n extends t{constructor(){super(...arguments),s.set(this,{...r.DEFAULT_PARTS_OPTIONS}),this.parts=[],this.oldParts=[],this.partPreprocessDataList=[]}get partsOptions(){return i(this,s,"f")}set partsOptions(t){const e=i(this,s,"f");!function(t,e,i,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?s.call(t,i):s?s.value=i:e.set(t,i)}(this,s,he({...r.DEFAULT_PARTS_OPTIONS,...t}),"f"),this.requestUpdate("partsOptions",e)}sampling(t,e){return function(t,e,i,r){let s=r;const n=t.isInteger(e)&&t.isInteger(i)?function(t,e,i){return function(r){return t.round(t.add(t.mul(e,t.sub(t.create(1),r)),t.mul(i,r)))}}(t,e,i):function(t,e,i){return function(r){return t.add(t.mul(e,t.sub(t.create(1),r)),t.mul(i,r))}}(t,e,i);t.eq(e,i)&&(s=1);const o=[];for(let e=0;e<s;e++){const i=t.div(t.create(e),t.create(Math.max(s-1,1)));o.push(n(i))}return o}(this.numberAdapter,this.numberAdapter.max(t,e),this.numberAdapter.min(t,e),this.partsOptions.sampleCount)}sampleSplit(t){return[t.slice()]}sampleToString(t){return this.numberAdapter.toString(t)}shouldRebuildParts(t){return t.has("value")||t.has("partsOptions")}willUpdate(t){super.willUpdate(t),t.has("value")&&(this.oldParts=this.parts),this.shouldRebuildParts(t)&&(this.parts=this.processPartData()),t.has("value")&&(this.partPreprocessDataList=function(t,e,i,r){const s=[];let n=0;for(let o=0;o<e.length;o++){const a=e[o],l=r?.[o],c=[];for(let e=0;e<a.digits.length;e++){const r=a.digits[e],s=l?.digits.find((t=>t.place===r.place));c.push({...ce([t,i],[r,s]),index:n++,partIndex:o,digitIndex:e})}s.push(c)}return s}(this.direction,this.parts,this.oldDirection,this.oldParts))}processPartData(){const{decimalSeparator:t,digitToChar:e,minPlaces:i,fillChar:r,type:s}=this.partsOptions,n=this.value,o=this.oldValue;let a=e=>this.sampleToString(e).split(t);"string"===s&&(a=t=>[this.sampleToString(t),""]);const l=[],c=this.sampleSplit(this.sampling(n,o));{const s=this.numberAdapter.gt(n,o)?"down":"up";for(let n=0;n<c.length;n++){const o=c[n],u=o["down"===s?0:o.length-1],[h=1,p=0]=i,d=a(u),f=Math.max(this.stringAdapter.stringToChars(d[0]).length,h),m=Math.max(this.stringAdapter.stringToChars(d[1]??"").length,p),y=le(...o.map((e=>{const[i="",s=""]=a(e),n=this.stringAdapter.stringToChars(i),o=this.stringAdapter.stringToChars(s),l=Math.max(f-n.length,0),c=Math.max(m-o.length,0);let u=[].concat(new Array(l).fill(r),n);return m>0&&(u=u.concat([t],o,new Array(c).fill(r))),u}))).map(((t,i,r)=>({data:t.filter(((t,e,i)=>0===e||t!==i[e-1])).map((t=>e[t]??t)),place:r.length-i})));l.push({digits:y})}}return l}}return r=n,s=new WeakMap,n.DEFAULT_PARTS_OPTIONS={sampleCount:16,decimalSeparator:".",fillChar:"0",minPlaces:[1,0],digitToChar:{},type:"number"},e([pt({type:Object,attribute:"parts-options",converter:t=>ue(t??"")??{},noAccessor:!0})],n.prototype,"partsOptions",null),n},de=()=>({create(t){const e=Number(t);return Number.isFinite(e)?e:0},add:(t,e)=>t+e,sub:(t,e)=>t-e,mul:(t,e)=>t*e,div:(t,e)=>t/e,compare:(t,e)=>t>e?1:t<e?-1:0,eq:(t,e)=>t===e,gt:(t,e)=>t>e,gte:(t,e)=>t>=e,lt:(t,e)=>t<e,lte:(t,e)=>t<=e,isInteger:t=>Number.isInteger(t),isNegative:t=>t<0,isPositive:t=>t>0,isZero:t=>0===t,isNaN:t=>Number.isNaN(t),isFinite:t=>Number.isFinite(t),abs:t=>Math.abs(t),ceil:t=>Math.ceil(t),floor:t=>Math.floor(t),round:t=>Math.round(t),max:(t,e)=>Math.max(t,e),min:(t,e)=>Math.min(t,e),toNumber:t=>Number(t),toString:t=>String(t)}),fe=()=>({stringToChars:t=>Array.from(t)});class me{static setNumberAdapter(t){let e=de();if(Ft(t)){for(const[i,r]of me.AVAILABLE_NUMBER_ADAPTERS)if(i.includes(t)){e=r();break}}else e=t;me.NUMBER_ADAPTER=e}static setStringAdapter(t){let e=fe();if(Ft(t)){for(const[i,r]of me.AVAILABLE_STRING_ADAPTERS)if(i.includes(t)){e=r();break}}else e=t;me.STRING_ADAPTER=e}static registerNumberAdapter(t,e){me.AVAILABLE_NUMBER_ADAPTERS.set(t,e)}static registerStringAdapter(t,e){me.AVAILABLE_STRING_ADAPTERS.set(t,e)}static registryAdapter(t){t.register(this)}}me.AVAILABLE_NUMBER_ADAPTERS=new Map([[["number"],de]]),me.AVAILABLE_STRING_ADAPTERS=new Map([[["string"],fe],[["intl-segmenter"],t=>{const e=new Intl.Segmenter(t,{granularity:"grapheme"});return{stringToChars:t=>Array.from(e.segment(t)).map((t=>t.segment))}}]]),me.NUMBER_ADAPTER=de(),me.STRING_ADAPTER=fe(),me.VALUE_CONVERTER={fromAttribute:t=>t,toAttribute:t=>Wt(t)?t:me.NUMBER_ADAPTER.toString(t)};const ye=t=>{class i extends t{get value(){return this.numberAdapter.create(this.__value)}set value(t){t=me.NUMBER_ADAPTER.create(Wt(t)||Ft(t)&&""===t.trim()?0:t);const e=this.__value;this.__value=t,this.numberAdapter.eq(this.__value,e)||this.requestUpdate("value",e)}get oldValue(){return this.numberAdapter.create(this.__oldValue)}set oldValue(t){const e=this.__oldValue;this.__oldValue=t,this.requestUpdate("oldValue",e)}get initialValue(){return Wt(this.__initialValue)?this.__initialValue:this.numberAdapter.create(this.__initialValue)}set initialValue(t){const e=this.__initialValue;this.__initialValue=t,this.requestUpdate("initialValue",e)}get locale(){return this.__locale}set locale(t){const e=this.__locale;this.__locale=t,this.requestUpdate("locale",e),this.localeInstance=Ft(this.__locale)?new Intl.Locale(this.__locale):new Intl.Locale(...this.__locale)}constructor(...t){super(...t),this.__value=me.NUMBER_ADAPTER.create(0),this.__oldValue=me.NUMBER_ADAPTER.create(0),this.__initialValue=null,this.__locale="en-US",this.localeInstance=Ft(this.locale)?new Intl.Locale(this.locale):new Intl.Locale(...this.locale),this.direction="up",this.oldDirection=this.direction,this.numberAdapter=me.NUMBER_ADAPTER,this.stringAdapter=me.STRING_ADAPTER}willUpdate(t){super.willUpdate(t),t.has("value")&&!t.has("oldValue")&&(this.oldValue=t.get("value")??this.value),this.oldDirection=this.direction,this.numberAdapter.eq(this.value,this.oldValue)||(this.direction=this.numberAdapter.gt(this.value,this.oldValue)?"down":"up")}connectedCallback(){super.connectedCallback(),this.oldValue=function(t){return null!=t}(this.initialValue)?this.initialValue:this.value}}return e([pt({attribute:"value",reflect:!0,converter:{toAttribute:me.VALUE_CONVERTER.toAttribute},noAccessor:!0})],i.prototype,"value",null),e([pt({attribute:"old-value",reflect:!0,converter:me.VALUE_CONVERTER,noAccessor:!0})],i.prototype,"oldValue",null),e([pt({attribute:"initial-value",reflect:!0,converter:me.VALUE_CONVERTER,noAccessor:!0})],i.prototype,"initialValue",null),e([pt({converter:t=>{if(Wt(t))return t;try{return JSON.parse(t)}catch(e){return t}},reflect:!0,noAccessor:!0})],i.prototype,"locale",null),e([dt()],i.prototype,"direction",void 0),e([dt()],i.prototype,"oldDirection",void 0),i},_e=l`
|
61
|
+
*/var Tt={done:!0,hasNext:!1},Ot={done:!1,hasNext:!1},Et=()=>Tt;function Ct(t,...e){let i=t,r=e.map((t=>"lazy"in t?function(t){let{lazy:e,lazyArgs:i}=t,r=e(...i);return Object.assign(r,{isSingle:e.single??!1,index:0,items:[]})}(t):void 0)),s=0;for(;s<e.length;){if(void 0===r[s]||!Mt(i)){i=(0,e[s])(i),s+=1;continue}let t=[];for(let i=s;i<e.length;i++){let e=r[i];if(void 0===e||(t.push(e),e.isSingle))break}let n=[];for(let e of i)if(Nt(e,n,t))break;let{isSingle:o}=t.at(-1);i=o?n[0]:n,s+=t.length}return i}function Nt(t,e,i){if(0===i.length)return e.push(t),!1;let r=t,s=Ot,n=!1;for(let[t,o]of i.entries()){let{index:a,items:l}=o;if(l.push(r),s=o(r,a,l),o.index+=1,s.hasNext){if(s.hasMany){for(let r of s.next)if(Nt(r,e,i.slice(t+1)))return!0;return n}r=s.next}if(!s.hasNext)break;s.done&&(n=!0)}return s.hasNext&&e.push(r),n}function Mt(t){return"string"==typeof t||"object"==typeof t&&null!==t&&Symbol.iterator in t}function kt(t,e,i){let r=t.length-e.length;if(0===r)return t(...e);if(1===r)return function(t,e,i){let r=i=>t(i,...e);return void 0===i?r:Object.assign(r,{lazy:i,lazyArgs:e})}(t,e,i);throw new Error("Wrong number of arguments")}function It(...t){return kt(Rt,t)}var Rt=(t,e)=>t.length>=e;function Ut(t,e){let i=[];for(let r=t;r<e;r++)i.push(r);return i}function Lt(t,e){if(!It(e,1))return{...t};if(!It(e,2)){let{[e[0]]:i,...r}=t;return r}let i={...t};for(let t of e)delete i[t];return i}function jt(...t){return kt(Vt,t)}var Vt=(t,e)=>({...t,...e});function Bt(...t){return kt(Ht,t,zt)}var Ht=(t,e)=>t.map(e),zt=t=>(e,i,r)=>({done:!1,hasNext:!0,next:t(e,i,r)});function Ft(t){return"number"==typeof t&&!Number.isNaN(t)}function Yt(t){return"string"==typeof t}function qt(t){return void 0===t||("string"==typeof t||Array.isArray(t)?0===t.length:0===Object.keys(t).length)}function Wt(t){return null==t}function Qt(t){return Array.isArray(t)}function Gt(t){return"boolean"==typeof t}function Kt(t){return t instanceof Date}function Jt(...t){return kt(Zt,t)}function Zt(t,e){if(t===e||Object.is(t,e))return!0;if("object"!=typeof t||"object"!=typeof e||null===t||null===e||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;if(Array.isArray(t))return function(t,e){if(t.length!==e.length)return!1;for(let[i,r]of t.entries())if(!Zt(r,e[i]))return!1;return!0}(t,e);if(t instanceof Map)return function(t,e){if(t.size!==e.size)return!1;for(let[i,r]of t.entries())if(!e.has(i)||!Zt(r,e.get(i)))return!1;return!0}(t,e);if(t instanceof Set)return function(t,e){if(t.size!==e.size)return!1;let i=[...e];for(let e of t){let t=!1;for(let[r,s]of i.entries())if(Zt(e,s)){t=!0,i.splice(r,1);break}if(!t)return!1}return!0}(t,e);if(t instanceof Date)return t.getTime()===e.getTime();if(t instanceof RegExp)return t.toString()===e.toString();if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let[i,r]of Object.entries(t))if(!(i in e)||!Zt(r,e[i]))return!1;return!0}function Xt(...t){return function(t,e){let i=e.length-t.length;if(1===i){let[i,...r]=e;return Ct(i,{lazy:t,lazyArgs:r})}if(0===i){let i={lazy:t,lazyArgs:e};return Object.assign((t=>Ct(t,i)),i)}throw new Error("Wrong number of arguments")}(te,t)}function te(t){if(0===t.length)return Et;let e=new Map;for(let i of t)e.set(i,(e.get(i)??0)+1);return t=>{let i=e.get(t);return void 0===i||0===i?Ot:(1===i?e.delete(t):e.set(t,i-1),{hasNext:!0,next:t,done:0===e.size})}}function ee(t,e){const i=function(t,e){return function(t){return"function"==typeof t}(t)?t(e):t}(t,e),{data:r}=e,s=[];for(let t=0;t<r.length;t+=1){const e=Qt(i)?i[t]:i;s.push(e)}return s}function ie(t,e){const i=ee(t,e),{data:r}=e,s=[];for(let t=0;t<r.length;t+=1){const{digits:e}=r[t],n=i[t];s.push([]);for(let i=0;i<e.length;i+=1){const e=Qt(n)?n[i]:n;s[t].push(e)}}return s}function re(t,e){const i=ie(t,e),{data:r}=e,s=[];for(let t=0;t<r.length;t+=1){const{digits:e}=r[t],n=i[t];s.push([]);for(let i=0;i<e.length;i+=1){const{data:r}=e[i],o=n[i];s[t].push([]);for(let e=0;e<r.length;e+=1){const r=Qt(o)?o[e]:o;s[t][i].push(r)}}}return s}function se(t,e){return jt(t??{},e??{})}function ne(t=[],e=[]){const i=Array.from(new Set(Object.keys(t).concat(Object.keys(e))));for(const r of i){const i=Number.parseInt(r,10);t[i]=se(t[i],e[i])}return t}function oe(t=[],e=[]){const i=Array.from(new Set(Object.keys(t).concat(Object.keys(e))));for(const r of i){const i=Number.parseInt(r,10);t[i]=ne(t[i],e[i])}return t}const ae=t=>{class e extends t{constructor(){super(...arguments),this.cellStyles={},this.cachedCellStyles=[],this.digitStyles={},this.cachedDigitStyles=[],this.partStyles={},this.cachedPartStyles=[],this.color="inherit"}extractCellStyles(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=function(t=[],e=[]){const i=Array.from(new Set(Object.keys(t).concat(Object.keys(e))));for(const r of i){const i=Number.parseInt(r,10);t[i]=oe(t[i],e[i])}return t}(re(this.cellStyles??{},t),re(this.cellStylesDynamic??{},t));return Jt(this.cachedCellStyles,e)||(this.cachedCellStyles=e),this.cachedCellStyles}extractDigitStyles(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=oe(ie(this.digitStyles??{},t),ie(this.digitStylesDynamic??{},t));return Jt(this.cachedDigitStyles,e)||(this.cachedDigitStyles=e),this.cachedDigitStyles}extractPartStyles(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=ne(ee(this.partStyles??{},t),ee(this.partStylesDynamic??{},t));return Jt(this.cachedPartStyles,e)||(this.cachedPartStyles=e),this.cachedPartStyles}}return r([dt({type:Object,attribute:"cell-styles",reflect:!0})],e.prototype,"cellStyles",void 0),r([dt({type:Object,attribute:"digit-styles",reflect:!0})],e.prototype,"digitStyles",void 0),r([dt({type:Object,attribute:"part-styles",reflect:!0})],e.prototype,"partStyles",void 0),r([dt({type:String,reflect:!0})],e.prototype,"color",void 0),e};function le(t){return t.length}function ce(){return function(t){if(!(s=t.length))return[];for(var e=-1,i=function(t,e){let i;if(void 0===e)for(const e of t)null!=e&&(i>e||void 0===i&&e>=e)&&(i=e);else{let r=-1;for(let s of t)null!=(s=e(s,++r,t))&&(i>s||void 0===i&&s>=s)&&(i=s)}return i}(t,le),r=new Array(i);++e<i;)for(var s,n=-1,o=r[e]=new Array(s);++n<s;)o[n]=t[n][e];return r}(arguments)}function ue(t,e){const[i,r]=t,[s,n]=e,o={animate:!0,cancelPrevAnimation:!1};let a="";return 1===s.data.length&&(o.animate=!1,o.cancelPrevAnimation=!0,a="only one digit"),i!==r||(s.data[0]===s.data[s.data.length-1]&&(o.animate=!1,o.cancelPrevAnimation=!0,a="same head and tail"),Jt(s,n)&&(o.animate=!1,a="same digits"),a&&(o.earlyReturn=a)),o}function he(t){try{return JSON.parse(t)}catch(e){return t}}function pe(t){const e={};return Qt(t.digitToChar)?t.digitToChar.forEach(((t,i)=>{var r;e[(r=i,String.fromCodePoint(r+48))]=t})):function(t){return"object"==typeof t&&null!==t}(t.digitToChar)&&Object.entries(t.digitToChar).forEach((([t,i])=>{e[t]=i})),{...t,digitToChar:e}}const de=t=>{var e,i;class n extends t{constructor(){super(...arguments),i.set(this,{...e.DEFAULT_PARTS_OPTIONS}),this.parts=[],this.oldParts=[],this.partPreprocessDataList=[]}get partsOptions(){return s(this,i,"f")}set partsOptions(t){const r=s(this,i,"f");!function(t,e,i,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?s.call(t,i):s?s.value=i:e.set(t,i)}(this,i,pe({...e.DEFAULT_PARTS_OPTIONS,...t}),"f"),this.requestUpdate("partsOptions",r)}sampling(t,e){return function(t,e,i,r){let s=r;const n=t.isInteger(e)&&t.isInteger(i)?function(t,e,i){return function(r){return t.round(t.add(t.mul(e,t.sub(t.create(1),r)),t.mul(i,r)))}}(t,e,i):function(t,e,i){return function(r){return t.add(t.mul(e,t.sub(t.create(1),r)),t.mul(i,r))}}(t,e,i);t.eq(e,i)&&(s=1);const o=[];for(let e=0;e<s;e++){const i=t.div(t.create(e),t.create(Math.max(s-1,1)));o.push(n(i))}return o}(this.numberAdapter,this.numberAdapter.max(t,e),this.numberAdapter.min(t,e),this.partsOptions.sampleCount)}sampleSplit(t){return[t.slice()]}sampleToString(t){return this.numberAdapter.toString(t)}shouldRebuildParts(t){return t.has("value")||t.has("partsOptions")}willUpdate(t){super.willUpdate(t),t.has("value")&&(this.oldParts=this.parts),this.shouldRebuildParts(t)&&(this.parts=this.processPartData()),t.has("value")&&(this.partPreprocessDataList=function(t,e,i,r){const s=[];let n=0;for(let o=0;o<e.length;o++){const a=e[o],l=r?.[o],c=[];for(let e=0;e<a.digits.length;e++){const r=a.digits[e],s=l?.digits.find((t=>t.place===r.place));c.push({...ue([t,i],[r,s]),index:n++,partIndex:o,digitIndex:e})}s.push(c)}return s}(this.direction,this.parts,this.oldDirection,this.oldParts))}processPartData(){const{decimalSeparator:t,digitToChar:e,minPlaces:i,fillChar:r,type:s}=this.partsOptions,n=this.value,o=this.oldValue;let a=e=>this.sampleToString(e).split(t);"string"===s&&(a=t=>[this.sampleToString(t),""]);const l=[],c=this.sampleSplit(this.sampling(n,o));{const s=this.numberAdapter.gt(n,o)?"down":"up";for(let n=0;n<c.length;n++){const o=c[n],u=o["down"===s?0:o.length-1],[h=1,p=0]=i,d=a(u),f=Math.max(this.stringAdapter.stringToChars(d[0]).length,h),m=Math.max(this.stringAdapter.stringToChars(d[1]??"").length,p),g=ce(...o.map((e=>{const[i="",s=""]=a(e),n=this.stringAdapter.stringToChars(i),o=this.stringAdapter.stringToChars(s),l=Math.max(f-n.length,0),c=Math.max(m-o.length,0);let u=[].concat(new Array(l).fill(r),n);return m>0&&(u=u.concat([t],o,new Array(c).fill(r))),u}))).map(((t,i,r)=>({data:t.filter(((t,e,i)=>0===e||t!==i[e-1])).map((t=>e[t]??t)),place:r.length-i})));l.push({digits:g})}}return l}}return e=n,i=new WeakMap,n.DEFAULT_PARTS_OPTIONS={sampleCount:16,decimalSeparator:".",fillChar:"0",minPlaces:[1,0],digitToChar:{},type:"number"},r([dt({type:Object,attribute:"parts-options",converter:t=>he(t??"")??{},noAccessor:!0})],n.prototype,"partsOptions",null),n},fe=()=>({create(t){const e=Number(t);return Number.isFinite(e)?e:0},add:(t,e)=>t+e,sub:(t,e)=>t-e,mul:(t,e)=>t*e,div:(t,e)=>t/e,compare:(t,e)=>t>e?1:t<e?-1:0,eq:(t,e)=>t===e,gt:(t,e)=>t>e,gte:(t,e)=>t>=e,lt:(t,e)=>t<e,lte:(t,e)=>t<=e,isInteger:t=>Number.isInteger(t),isNegative:t=>t<0,isPositive:t=>t>0,isZero:t=>0===t,isNaN:t=>Number.isNaN(t),isFinite:t=>Number.isFinite(t),abs:t=>Math.abs(t),ceil:t=>Math.ceil(t),floor:t=>Math.floor(t),round:t=>Math.round(t),max:(t,e)=>Math.max(t,e),min:(t,e)=>Math.min(t,e),toNumber:t=>Number(t),toString:t=>String(t)}),me=()=>({stringToChars:t=>Array.from(t)});class ge{static setNumberAdapter(t){let e=fe();if(Yt(t)){for(const[i,r]of ge.AVAILABLE_NUMBER_ADAPTERS)if(i.includes(t)){e=r();break}}else e=t;ge.NUMBER_ADAPTER=e}static setStringAdapter(t){let e=me();if(Yt(t)){for(const[i,r]of ge.AVAILABLE_STRING_ADAPTERS)if(i.includes(t)){e=r();break}}else e=t;ge.STRING_ADAPTER=e}static registerNumberAdapter(t,e){ge.AVAILABLE_NUMBER_ADAPTERS.set(t,e)}static registerStringAdapter(t,e){ge.AVAILABLE_STRING_ADAPTERS.set(t,e)}static registerAdapter(t){t.register(this)}}ge.AVAILABLE_NUMBER_ADAPTERS=new Map([[["number"],fe]]),ge.AVAILABLE_STRING_ADAPTERS=new Map([[["string"],me],[["intl-segmenter"],t=>{const e=new Intl.Segmenter(t,{granularity:"grapheme"});return{stringToChars:t=>Array.from(e.segment(t)).map((t=>t.segment))}}]]),ge.NUMBER_ADAPTER=fe(),ge.STRING_ADAPTER=me(),ge.VALUE_CONVERTER={fromAttribute:t=>t,toAttribute:t=>Wt(t)?t:ge.NUMBER_ADAPTER.toString(t)};const _e=t=>{class e extends t{get value(){return this.numberAdapter.create(this.__value)}set value(t){t=ge.NUMBER_ADAPTER.create(Wt(t)||Yt(t)&&""===t.trim()?0:t);const e=this.__value;this.__value=t,this.numberAdapter.eq(this.__value,e)||this.requestUpdate("value",e)}get oldValue(){return this.numberAdapter.create(this.__oldValue)}set oldValue(t){const e=this.__oldValue;this.__oldValue=t,this.requestUpdate("oldValue",e)}get initialValue(){return Wt(this.__initialValue)?this.__initialValue:this.numberAdapter.create(this.__initialValue)}set initialValue(t){const e=this.__initialValue;this.__initialValue=t,this.requestUpdate("initialValue",e)}get locale(){return this.__locale}set locale(t){const e=this.__locale;this.__locale=t,this.requestUpdate("locale",e),this.localeInstance=Yt(this.__locale)?new Intl.Locale(this.__locale):new Intl.Locale(...this.__locale)}constructor(...t){super(...t),this.__value=ge.NUMBER_ADAPTER.create(0),this.__oldValue=ge.NUMBER_ADAPTER.create(0),this.__initialValue=null,this.__locale="en-US",this.localeInstance=Yt(this.locale)?new Intl.Locale(this.locale):new Intl.Locale(...this.locale),this.direction="up",this.oldDirection=this.direction,this.numberAdapter=ge.NUMBER_ADAPTER,this.stringAdapter=ge.STRING_ADAPTER}willUpdate(t){super.willUpdate(t),t.has("value")&&!t.has("oldValue")&&(this.oldValue=t.get("value")??this.value),this.oldDirection=this.direction,this.numberAdapter.eq(this.value,this.oldValue)||(this.direction=this.numberAdapter.gt(this.value,this.oldValue)?"down":"up")}connectedCallback(){super.connectedCallback(),this.oldValue=function(t){return null!=t}(this.initialValue)?this.initialValue:this.value}}return r([dt({attribute:"value",reflect:!0,converter:{toAttribute:ge.VALUE_CONVERTER.toAttribute},noAccessor:!0})],e.prototype,"value",null),r([dt({attribute:"old-value",reflect:!0,converter:ge.VALUE_CONVERTER,noAccessor:!0})],e.prototype,"oldValue",null),r([dt({attribute:"initial-value",reflect:!0,converter:ge.VALUE_CONVERTER,noAccessor:!0})],e.prototype,"initialValue",null),r([dt({converter:t=>{if(Wt(t))return t;try{return JSON.parse(t)}catch(e){return t}},reflect:!0,noAccessor:!0})],e.prototype,"locale",null),r([ft()],e.prototype,"direction",void 0),r([ft()],e.prototype,"oldDirection",void 0),e},ye=u`
|
67
62
|
:host {
|
68
63
|
position: relative;
|
69
64
|
white-space: nowrap;
|
@@ -92,7 +87,7 @@ function ft(t,e){return(e,i,r)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
92
87
|
// font-size: 0.4em;
|
93
88
|
// line-height: 1;
|
94
89
|
//}
|
95
|
-
`,
|
90
|
+
`,Ae=t=>{class e extends t{constructor(){super(...arguments),this.animationOptions={},this.cachedAnimationOptions=[],this.keyframes={},this.cachedKeyframes=[]}extractAnimationOptions(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=oe(ie(this.animationOptions??{},t),ie(this.animationOptionsDynamic??{},t));return Jt(this.cachedAnimationOptions,e)||(this.cachedAnimationOptions=e),this.cachedAnimationOptions}extractKeyframes(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=oe(ie(this.keyframes??{},t),ie(this.keyframesDynamic??{},t));return Jt(this.cachedKeyframes,e)||(this.cachedKeyframes=e),this.cachedKeyframes}}return r([dt({type:Object,attribute:"animation-options",reflect:!0})],e.prototype,"animationOptions",void 0),r([dt({type:Object,attribute:"keyframes",reflect:!0})],e.prototype,"keyframes",void 0),e},be="important",$e=" !"+be,ve=yt(class extends At{constructor(t){if(super(t),t.type!==gt||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,i)=>{const r=t[i];return null==r?e:e+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`}),"")}update(t,[e]){const{style:i}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?i.removeProperty(t):i[t]=null);for(const t in e){const r=e[t];if(null!=r){this.ft.add(t);const e="string"==typeof r&&r.endsWith($e);t.includes("-")||e?i.setProperty(t,e?r.slice(0,-11):r,e?be:""):i[t]=r}}return W}}),Se=yt(class extends At{constructor(t){if(super(t),t.type!==gt||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const i=t.element.classList;for(const t of this.st)t in e||(i.remove(t),this.st.delete(t));for(const t in e){const r=!!e[t];r===this.st.has(t)||this.nt?.has(t)||(r?(i.add(t),this.st.add(t)):(i.remove(t),this.st.delete(t)))}return W}}),Pe=u`
|
96
91
|
:host {
|
97
92
|
display: inline-flex;
|
98
93
|
overflow: hidden;
|
@@ -128,7 +123,7 @@ function ft(t,e){return(e,i,r)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
128
123
|
.roller-part .roller-part__suffix {
|
129
124
|
display: inline-block;
|
130
125
|
}
|
131
|
-
`,
|
126
|
+
`,xe=u`
|
132
127
|
.roller-part-digit {
|
133
128
|
position: relative;
|
134
129
|
display: inline-block;
|
@@ -181,72 +176,72 @@ function ft(t,e){return(e,i,r)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
181
176
|
position: absolute;
|
182
177
|
bottom: 100%;
|
183
178
|
}
|
184
|
-
`,
|
179
|
+
`,we=t=>t,De=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function Te(t,e,i,r){if(t===e&&i===r)return we;const s=e=>function(t,e,i,r,s){let n,o,a=0;do{o=e+(i-e)/2,n=De(o,r,s)-t,n>0?i=o:e=o}while(Math.abs(n)>1e-7&&++a<12);return o}(e,0,1,t,i);return t=>0===t||1===t?t:De(s(t),e,r)}const Oe=Te(.12,0,.39,0),Ee=Te(.61,1,.88,1),Ce=Te(.37,0,.63,1),Ne=Te(.11,0,.5,0),Me=Te(.5,1,.89,1),ke=Te(.45,0,.55,1),Ie=Te(.32,0,.67,0),Re=Te(.33,1,.68,1),Ue=Te(.65,0,.35,1),Le=Te(.5,0,.75,0),je=Te(.25,1,.5,1),Ve=Te(.76,0,.24,1),Be=Te(.64,0,.78,0),He=Te(.22,1,.36,1),ze=Te(.83,0,.17,1),Fe=Te(.7,0,.84,0),Ye=Te(.16,1,.3,1),qe=Te(.87,0,.13,1),We=Te(.55,0,1,.45),Qe=Te(0,.55,.45,1),Ge=Te(.85,0,.15,1),Ke=Te(.36,0,.66,-.56),Je=Te(.34,1.56,.64,1),Ze=Te(.68,-.6,.32,1.6);function Xe(t){const e=2*Math.PI/3;return 0===t?0:1===t?1:-(2**(10*t-10))*Math.sin((10*t-10.75)*e)}function ti(t){const e=2*Math.PI/3;return 0===t?0:1===t?1:2**(-10*t)*Math.sin((10*t-.75)*e)+1}function ei(t){const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-(2**(20*t-10))*Math.sin((20*t-11.125)*e)/2:2**(-20*t+10)*Math.sin((20*t-11.125)*e)/2+1}function ii(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375}function ri(t){return 1-ii(1-t)}function si(t){return t<.5?(1-ii(1-2*t))/2:(1+ii(2*t-1))/2}var ni=Object.freeze({__proto__:null,easeInBack:Ke,easeInBounce:ri,easeInCirc:We,easeInCubic:Ie,easeInElastic:Xe,easeInExpo:Fe,easeInOutBack:Ze,easeInOutBounce:si,easeInOutCirc:Ge,easeInOutCubic:Ue,easeInOutElastic:ei,easeInOutExpo:qe,easeInOutQuad:ke,easeInOutQuart:Ve,easeInOutQuint:ze,easeInOutSine:Ce,easeInQuad:Ne,easeInQuart:Le,easeInQuint:Be,easeInSine:Oe,easeOutBack:Je,easeOutBounce:ii,easeOutCirc:Qe,easeOutCubic:Re,easeOutElastic:ti,easeOutExpo:Ye,easeOutQuad:Me,easeOutQuart:je,easeOutQuint:He,easeOutSine:Ee});function oi(t,e){"undefined"!=typeof customElements&&(customElements.get(t)||customElements.define(t,e))}class ai extends Event{}class li extends ct{constructor(){super(),this.digit={data:[],place:0},this.preprocessData={animate:!0,cancelPrevAnimation:!1,earlyReturn:"",index:0,partIndex:0,digitIndex:0},this.direction="up",this.textStyle={},this.cellStyle=[],this.animationOptions={},this.keyframes={},this.digitWidth=0,this.resizeObserver=new ResizeObserver((()=>{this.digitWidth=this.clonedRollDigitList?this.clonedRollDigitList.offsetWidth:0}))}firstUpdated(t){super.firstUpdated(t),this.clonedRollDigitList&&this.resizeObserver.observe(this.clonedRollDigitList)}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver.disconnect()}updated(t){super.updated(t),Xt(Array.from(t.keys()),["digit","preprocessData","direction","animationOptions","keyframes"]).length>0&&this.shouldAnimate()&&this.startAnimation().then()}render(){const t=this.cellStyle.map((t=>function(...t){return kt(Lt,t)}(t,["position"])));return q`<span class="roller-part-digit">
|
185
180
|
<!-- 占位 -->
|
186
181
|
<span
|
187
182
|
class="placeholder"
|
188
|
-
style=${
|
183
|
+
style=${ve({width:`${Math.round(this.digitWidth)}px`})}
|
189
184
|
>0</span
|
190
185
|
>
|
191
186
|
<!-- 一个不可见的滚动列表的复制, 用于计算该列表的最大宽度. -->
|
192
187
|
<span class="roll-list__shadow">
|
193
|
-
${Dt(this.digit.data,((t,e)=>e),((e,i)=>
|
188
|
+
${Dt(this.digit.data,((t,e)=>e),((e,i)=>q`<span style=${ve(t[i])}
|
194
189
|
>${e}</span
|
195
190
|
>`))}
|
196
191
|
</span>
|
197
192
|
<span
|
198
|
-
class=${
|
193
|
+
class=${Se({"roll-list__up":"up"===this.direction,"roll-list__down":"down"===this.direction,"roll-list":!0})}
|
199
194
|
>
|
200
|
-
${this.digit.data.length>1?Dt(this.digit.data,((t,e)=>e),((t,e)=>"up"===this.direction&&e===this.digit.data.length-1?
|
195
|
+
${this.digit.data.length>1?Dt(this.digit.data,((t,e)=>e),((t,e)=>"up"===this.direction&&e===this.digit.data.length-1?q`<span
|
201
196
|
part="cell"
|
202
197
|
class="roll-item roll-item__head"
|
203
|
-
style=${
|
204
|
-
><span style=${
|
198
|
+
style=${ve(this.cellStyle[e])}
|
199
|
+
><span style=${ve(this.textStyle)}
|
205
200
|
>${t}</span
|
206
201
|
></span
|
207
|
-
>`:"down"===this.direction&&0===e?
|
202
|
+
>`:"down"===this.direction&&0===e?q`
|
208
203
|
<span
|
209
204
|
part="cell"
|
210
205
|
class="roll-item roll-item__tail"
|
211
|
-
style=${
|
212
|
-
><span style=${
|
206
|
+
style=${ve(this.cellStyle[e])}
|
207
|
+
><span style=${ve(this.textStyle)}
|
213
208
|
>${t}</span
|
214
209
|
></span
|
215
210
|
>
|
216
|
-
`:
|
211
|
+
`:q`<span
|
217
212
|
part="cell"
|
218
213
|
class="roll-item"
|
219
|
-
style=${
|
220
|
-
><span style=${
|
214
|
+
style=${ve(this.cellStyle[e])}
|
215
|
+
><span style=${ve(this.textStyle)}
|
221
216
|
>${t}</span
|
222
217
|
></span
|
223
|
-
>`)):
|
218
|
+
>`)):q`<span
|
224
219
|
part="cell"
|
225
220
|
class="roll-item"
|
226
|
-
style=${
|
227
|
-
><span style=${
|
221
|
+
style=${ve(this.cellStyle[0])}
|
222
|
+
><span style=${ve(this.textStyle)}
|
228
223
|
>${this.digit.data[0]}</span
|
229
224
|
></span
|
230
225
|
>`}</span
|
231
226
|
></span
|
232
|
-
> `}shouldAnimate(){const{cancelPrevAnimation:t,animate:e}=this.preprocessData;return t&&(this.animation&&this.animation.cancel(),this.rollList&&this.rollList.style&&this.rollList.style.cssText&&(this.rollList.style.cssText="")),!!e}async startAnimation(){if(Wt(this.rollList))return;this.__emitAnimationStart();const t=
|
227
|
+
> `}shouldAnimate(){const{cancelPrevAnimation:t,animate:e}=this.preprocessData;return t&&(this.animation&&this.animation.cancel(),this.rollList&&this.rollList.style&&this.rollList.style.cssText&&(this.rollList.style.cssText="")),!!e}async startAnimation(){if(Wt(this.rollList))return;this.__emitAnimationStart();const t=jt({duration:1e3,iterations:1,easing:"ease-out",fill:"forwards"},this.animationOptions),e=qt(this.keyframes)?{up:{transform:["translateY(0)","translateY(-100%)"]},down:{transform:["translateY(0)","translateY(100%)"]}}[this.direction]:this.keyframes;if(Yt(t.easing)&&ni[t.easing]){const e=ni[t.easing];t.easing=`linear(${function(...t){return kt(Ut,t)}(0,64).map(((t,i)=>e(i/63))).join(",")})`}try{this.clearAnimation(),this.animation=this.rollList.animate(e,t),this.animation.addEventListener("finish",(()=>this.__emitAnimationEnd()),{once:!0})}catch(t){console.error(t)}}clearAnimation(){this.animation?.removeEventListener("finish",this.__emitAnimationEnd),this.animation?.cancel()}__emitAnimationStart(){this.isConnected&&this.dispatchEvent(new ai("roller-digit-animation-start"))}__emitAnimationEnd(){this.isConnected&&this.dispatchEvent(new ai("roller-digit-animation-end"))}}li.styles=[xe],r([dt({type:Object})],li.prototype,"digit",void 0),r([dt({type:Object})],li.prototype,"preprocessData",void 0),r([dt({type:String})],li.prototype,"direction",void 0),r([dt({type:Object})],li.prototype,"textStyle",void 0),r([dt({type:Array})],li.prototype,"cellStyle",void 0),r([dt({type:Object})],li.prototype,"animationOptions",void 0),r([dt({type:Object})],li.prototype,"keyframes",void 0),r([mt(".roll-list__shadow")],li.prototype,"clonedRollDigitList",void 0),r([mt(".roll-list")],li.prototype,"rollList",void 0),r([ft()],li.prototype,"digitWidth",void 0),oi("timered-counter-roller-digit",li);class ci extends Event{}class ui extends ct{constructor(){super(...arguments),this.color="",this.direction="up",this.parts=[],this.partPreprocessDataList=[],this.animationOptions=[],this.keyframes=[],this.cellStyles=[],this.digitStyles=[],this.partStyles=[],this.parentContainerRect={},this.__partDigitsColorStyles=[],this.digitAnimateEndCount=0,this.digitAnimatedCount=0}render(){return q`<span
|
233
228
|
class="roller__prefix"
|
234
229
|
data-part-id="-1"
|
235
230
|
data-digit-id="0"
|
236
|
-
style=${
|
231
|
+
style=${ve(this.__partDigitsColorStyles?.[-1]?.[0]??{})}
|
237
232
|
>
|
238
233
|
<slot part="prefix" name="prefix"></slot>
|
239
234
|
</span>
|
240
235
|
<span class="counter-parts">
|
241
|
-
${Dt(this.parts,((t,e)=>e),((t,e)=>
|
236
|
+
${Dt(this.parts,((t,e)=>e),((t,e)=>q`<span
|
242
237
|
part="part"
|
243
238
|
class="roller-part"
|
244
|
-
style=${
|
245
|
-
>${Dt(t.digits,((e,i)=>""+(t.digits.length-i)),((t,i)=>
|
239
|
+
style=${ve(this.partStyles?.[e]??{})}
|
240
|
+
>${Dt(t.digits,((e,i)=>""+(t.digits.length-i)),((t,i)=>q`<timered-counter-roller-digit
|
246
241
|
exportparts="digit, cell"
|
247
242
|
part="digit"
|
248
243
|
class="roller-part__wrapper"
|
249
|
-
style=${
|
244
|
+
style=${ve(this.digitStyles?.[e]?.[i]??{})}
|
250
245
|
data-part-id="${e}"
|
251
246
|
data-digit-id="${i}"
|
252
247
|
.digit=${t}
|
@@ -257,11 +252,11 @@ function ft(t,e){return(e,i,r)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
257
252
|
.animationOptions=${this.animationOptions[e][i]}
|
258
253
|
.keyframes=${this.keyframes[e][i]}
|
259
254
|
@roller-digit-animation-end=${this.__handleDigitAnimationEnd}
|
260
|
-
></timered-counter-roller-digit>`))}${
|
255
|
+
></timered-counter-roller-digit>`))}${q`<span
|
261
256
|
class="roller-part__suffix"
|
262
257
|
data-part-id="${e}"
|
263
258
|
data-digit-id="-1"
|
264
|
-
style=${
|
259
|
+
style=${ve(this.__partDigitsColorStyles?.[e]?.[-1]??{})}
|
265
260
|
><slot
|
266
261
|
part="part-suffix"
|
267
262
|
name=${`part-suffix-${e}`}
|
@@ -272,9 +267,9 @@ function ft(t,e){return(e,i,r)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
272
267
|
class="roller__suffix"
|
273
268
|
data-part-id="-2"
|
274
269
|
data-digit-id="0"
|
275
|
-
style=${
|
270
|
+
style=${ve(this.__partDigitsColorStyles?.[-2]?.[0]??{})}
|
276
271
|
><slot part="suffix" name="suffix"></slot
|
277
|
-
></span>`}willUpdate(t){super.willUpdate(t),(t.has("direction")||t.has("parts"))&&(this.digitAnimateEndCount=0,this.digitAnimatedCount=this.partPreprocessDataList.flat().filter((({animate:t})=>t)).length,this.digitAnimatedCount>0&&this.__emitAnimationStart()),this.__partDigitsColorStyles=this.__generatePartDigitsColorStyles()}__handleDigitAnimationEnd(){this.digitAnimateEndCount++,this.digitAnimateEndCount<this.digitAnimatedCount||this.__emitAnimationEnd()}__emitAnimationStart(){this.isConnected&&this.dispatchEvent(new
|
272
|
+
></span>`}willUpdate(t){super.willUpdate(t),(t.has("direction")||t.has("parts"))&&(this.digitAnimateEndCount=0,this.digitAnimatedCount=this.partPreprocessDataList.flat().filter((({animate:t})=>t)).length,this.digitAnimatedCount>0&&this.__emitAnimationStart()),this.__partDigitsColorStyles=this.__generatePartDigitsColorStyles()}__handleDigitAnimationEnd(){this.digitAnimateEndCount++,this.digitAnimateEndCount<this.digitAnimatedCount||this.__emitAnimationEnd()}__emitAnimationStart(){this.isConnected&&this.dispatchEvent(new ci("roller-animation-start"))}__emitAnimationEnd(){this.isConnected&&this.dispatchEvent(new ci("roller-animation-end"))}__generatePartDigitsColorStyles(){const t=[],e=this.parentContainerRect,{prefixContainer:i,suffixContainer:r,color:s}=this,n=Array.from(this.shadowRoot?.querySelectorAll("[data-part-id]").values()??[]);if(!e)return t;i&&(n[-1]=i),r&&(n[-2]=r);for(const e of function(...t){return kt(Object.values,t)}(n)){const i=Number.parseInt(e.dataset.partId??"-1",10),r=Number.parseInt(e.dataset.digitId??"-1",10);if(!Ft(i)||!Ft(r))throw new Error("The data-part-id and data-digit-id attributes are required.");t[i]||(t[i]=[]),CSS.supports("color",s)?t[i][r]={color:s}:CSS.supports("background-image",s)?t[i][r]={backgroundImage:s,backgroundClip:"text",backgroundSize:`${this.offsetWidth}px ${this.offsetHeight}px`,backgroundPositionX:-e.offsetLeft+"px",backgroundPositionY:-e.offsetTop+"px",backgroundRepeat:"no-repeat",color:"transparent","-webkit-text-fill-color":"transparent"}:(t[i][r]={},console.warn(new Error("The color property is not supported.")))}return t}}ui.styles=[Pe],r([dt({type:String})],ui.prototype,"color",void 0),r([dt({type:String})],ui.prototype,"direction",void 0),r([dt({type:Array})],ui.prototype,"parts",void 0),r([dt({type:Array})],ui.prototype,"partPreprocessDataList",void 0),r([dt({type:Array})],ui.prototype,"animationOptions",void 0),r([dt({type:Array})],ui.prototype,"keyframes",void 0),r([dt({type:Array})],ui.prototype,"cellStyles",void 0),r([dt({type:Array})],ui.prototype,"digitStyles",void 0),r([dt({type:Array})],ui.prototype,"partStyles",void 0),r([dt({type:Object})],ui.prototype,"parentContainerRect",void 0),r([mt(".roller__prefix")],ui.prototype,"prefixContainer",void 0),r([mt(".roller__suffix")],ui.prototype,"suffixContainer",void 0),oi("timered-counter-roller",ui);const hi=t=>{class e extends t{constructor(){super(...arguments),this.ariaLabel="",this.ariaLive="polite"}generateAriaLabel(){let t="";const{direction:e}=this;for(const i of this.parts)for(const r of i.digits)t+=`${r.data["up"===e?r.data.length-1:0]}`;return t}willUpdate(t){super.willUpdate(t),this.ariaLabel=this.generateAriaLabel()}}return r([dt({attribute:"aria-label",reflect:!0})],e.prototype,"ariaLabel",void 0),r([dt({attribute:"aira-live",reflect:!0})],e.prototype,"ariaLive",void 0),e};class pi extends Event{}class di extends(hi(Ae(ae(de(_e(ct)))))){constructor(){super(),this.resizeObserver=new ResizeObserver((()=>{this.partsContainerRect=this.partsContainer?this.partsContainer.getBoundingClientRect():new DOMRect}))}firstUpdated(t){super.firstUpdated(t),this.partsContainer&&this.resizeObserver.observe(this.partsContainer)}render(){const t=this.extractCellStyles(),e=this.extractDigitStyles(),i=this.extractPartStyles(),r=this.extractAnimationOptions(),s=this.extractKeyframes();return q`
|
278
273
|
<timered-counter-roller
|
279
274
|
exportparts="group, part, digit, cell, prefix, suffix, part-suffix"
|
280
275
|
part="group"
|
@@ -295,12 +290,12 @@ function ft(t,e){return(e,i,r)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
295
290
|
>
|
296
291
|
<slot name="prefix" slot="prefix"></slot>
|
297
292
|
<slot name="suffix" slot="suffix"></slot>
|
298
|
-
${Dt(this.parts,((t,e)=>e),((t,e)=>
|
293
|
+
${Dt(this.parts,((t,e)=>e),((t,e)=>q`<slot
|
299
294
|
name=${`part-suffix-${e}`}
|
300
295
|
slot=${`part-suffix-${e}`}
|
301
296
|
></slot>`))}
|
302
297
|
</timered-counter-roller>
|
303
|
-
`}dispatchTimeredCounterAnimationStart(){this.dispatchEvent(new
|
298
|
+
`}dispatchTimeredCounterAnimationStart(){this.dispatchEvent(new pi("timered-counter-animation-start"))}dispatchTimeredCounterAnimationEnd(){this.dispatchEvent(new pi("timered-counter-animation-end"))}}di.styles=[ye],r([ft()],di.prototype,"partsContainerRect",void 0),r([mt("timered-counter-roller")],di.prototype,"partsContainer",void 0),oi("timered-counter",di);const fi=u``;class mi extends di{constructor(){super(...arguments),this.localeNumber=!1,this.localeNumberInstance=new Intl.NumberFormat(this.localeInstance,Gt(this.localeNumber)?{}:this.localeNumber),this.localDecimalSeparator="",this.localeGroupingSeparator=""}sampleToString(t){return this.localeNumber?this.localeNumberInstance.format(this.numberAdapter.toNumber(t)):this.numberAdapter.toString(t)}render(){const t=this.extractCellStyles(),e=this.extractDigitStyles(),i=this.extractPartStyles(),r=this.extractAnimationOptions(),s=this.extractKeyframes();return q`
|
304
299
|
<timered-counter-roller
|
305
300
|
class="timered-counter timered-counter-datetime-duration"
|
306
301
|
exportparts="group, part, digit, cell, prefix, suffix, part-suffix"
|
@@ -321,20 +316,20 @@ function ft(t,e){return(e,i,r)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
321
316
|
>
|
322
317
|
<slot name="prefix" slot="prefix"></slot>
|
323
318
|
<slot name="suffix" slot="suffix"></slot>
|
324
|
-
${Dt(this.parts,((t,e)=>e),((t,e)=>
|
319
|
+
${Dt(this.parts,((t,e)=>e),((t,e)=>q`<slot
|
325
320
|
name=${`part-suffix-${e}`}
|
326
321
|
slot=${`part-suffix-${e}`}
|
327
322
|
></slot>`))}
|
328
323
|
</timered-counter-roller>
|
329
|
-
`}willUpdate(t){if(t.has("localeNumber")||t.has("locale")){this.localeNumberInstance=new Intl.NumberFormat(this.localeInstance,
|
324
|
+
`}willUpdate(t){if(t.has("localeNumber")||t.has("locale")){this.localeNumberInstance=new Intl.NumberFormat(this.localeInstance,Gt(this.localeNumber)?{}:this.localeNumber);{const e=this.localeNumberInstance.formatToParts(123456.789),i=e.find((t=>"decimal"===t.type))?.value||".",r=e.find((t=>"group"===t.type))?.value||"";if(this.localDecimalSeparator!==i||this.localeGroupingSeparator!==r){this.localDecimalSeparator=i;const e=this.partsOptions;this.partsOptions={...e,decimalSeparator:this.localDecimalSeparator},t.set("partsOptions",e)}}}super.willUpdate(t)}}mi.styles=[...di.styles,fi],r([dt({converter:t=>{if(Wt(t))return!1;try{return JSON.parse(t)}catch(t){return!0}},reflect:!0,attribute:"locale-number"})],mi.prototype,"localeNumber",void 0),r([ft()],mi.prototype,"localDecimalSeparator",void 0),r([ft()],mi.prototype,"localeGroupingSeparator",void 0),oi("timered-counter-number",mi);const gi=u``
|
330
325
|
/**
|
331
326
|
* @license https://github.com/HarasimowiczKamil/any-base
|
332
|
-
*/;function
|
327
|
+
*/;function _i(t,e,i){return r=>function(t,e,i){let r,s,n,{length:o}=i;const a={},l=t.length,c=e.length,u=[];if(!function(t,e){for(const i of t)if(-1===e.indexOf(i))return!1;return!0}(i,t))throw new Error(`Number "${i}" contains of non-alphabetic digits (${t})`);if(Jt(t,e))return i.join("");for(r=0;r<o;r++)a[r]=t.indexOf(i[r]);do{for(s=0,n=0,r=0;r<o;r++)s=s*l+a[r],s>=c?(a[n++]=Math.floor(s/c),s%=c):n>0&&(a[n++]=0);o=n,u.push(e[s])}while(0!==n);return u.reverse().join("")}(t.stringToChars(e),t.stringToChars(i),t.stringToChars(r))}const yi=" ";class Ai extends di{constructor(){super(...arguments),this.__alphabet="",this.__initialValueString="",this.__valueString="",this.__oldValueString="",this.__partsOptions=null,this.__decimalToAnyBase=_i(this.stringAdapter,"0123456789",this.__alphabet),this.__anyBaseToDecimal=_i(this.stringAdapter,this.__alphabet,"0123456789")}get initialValue(){return super.initialValue}set initialValue(t){if(!Yt(t))try{t=t.toString()}catch(e){throw new Error(`value ${t} is not a string.`)}this.__initialValueString=t??"",qt(this.__initialValueString)?super.initialValue=this.numberAdapter.create(0):(this.__updateAlphabet(this.__valueString,this.__initialValueString),super.initialValue=this.numberAdapter.create(this.__anyBaseToDecimal(this.__initialValueString)),super.value=this.numberAdapter.create(this.__anyBaseToDecimal(this.__valueString)))}get value(){return super.value}set value(t){if(Yt(t)){if(this.__valueString===t)return}else try{t=t.toString()}catch(e){throw new Error(`value ${t} is not a string.`)}this.__oldValueString=this.__valueString,this.__valueString=t??"",qt(this.__valueString)?super.value=this.numberAdapter.create(0):(this.__updateAlphabet(this.__valueString,this.__oldValueString),super.oldValue=this.numberAdapter.create(this.__anyBaseToDecimal(this.__oldValueString)),super.value=this.numberAdapter.create(this.__anyBaseToDecimal(this.__valueString)))}get partsOptions(){return super.partsOptions}set partsOptions(t){this.__partsOptions=t,super.partsOptions={type:"string",fillChar:yi,...this.__partsOptions,digitToChar:{" ":yi,...this.__partsOptions.digitToChar}}}__updateAlphabet(t,e){const i=qt(t)&&qt(e)?"":`\0${e??""}${t??""}`,r=new Set(this.stringAdapter.stringToChars(i));this.__alphabet=Array.from(r).sort().join("");const s=this.stringAdapter,n=this.__alphabet;this.__decimalToAnyBase=_i(s,"0123456789",n),this.__anyBaseToDecimal=_i(s,n,"0123456789")}sampleToString(t){return this.__decimalToAnyBase(this.numberAdapter.toString(t))}connectedCallback(){this.__updateAlphabet(this.__valueString,this.__initialValueString),this.initialValue=this.__initialValueString,this.value=this.__valueString,this.partsOptions=this.__partsOptions??{},super.connectedCallback()}}Ai.styles=[...di.styles,gi],oi("timered-counter-string",Ai);const bi=36e5,$i=Symbol.for("constructDateFrom");function vi(t,e){return"function"==typeof t?t(e):t&&"object"==typeof t&&$i in t?t[$i](e):t instanceof Date?new t.constructor(e):new Date(e)}function Si(t,e){return vi(t,t)}function Pi(t,e,i){const r=Si(t);return isNaN(e)?vi(t,NaN):e?(r.setDate(r.getDate()+e),r):r}function xi(t,e,i){const r=Si(t);if(isNaN(e))return vi(t,NaN);if(!e)return r;const s=r.getDate(),n=vi(t,r.getTime());return n.setMonth(r.getMonth()+e+1,0),s>=n.getDate()?n:(r.setFullYear(n.getFullYear(),n.getMonth(),s),r)}function wi(t,e,i){return vi(t,+Si(t)+e)}function Di(t){const e=Si(t),i=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return i.setUTCFullYear(e.getFullYear()),+t-+i}function Ti(t,...e){const i=vi.bind(null,e.find((t=>"object"==typeof t)));return e.map(i)}function Oi(t,e){const i=Si(t);return i.setHours(0,0,0,0),i}function Ei(t,e){const i=+Si(t)-+Si(e);return i<0?-1:i>0?1:i}function Ci(t){return!(!((e=t)instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))&&"number"!=typeof t||isNaN(+Si(t)));var e}function Ni(t,e,i){const[r,s]=Ti(0,t,e),n=Mi(r,s),o=Math.abs(function(t,e){const[i,r]=Ti(0,t,e),s=Oi(i),n=Oi(r),o=+s-Di(s),a=+n-Di(n);return Math.round((o-a)/864e5)}(r,s));r.setDate(r.getDate()-n*o);const a=n*(o-Number(Mi(r,s)===-n));return 0===a?0:a}function Mi(t,e){const i=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return i<0?-1:i>0?1:i}function ki(t){return e=>{const i=(t?Math[t]:Math.trunc)(e);return 0===i?0:i}}function Ii(t,e,i){const[r,s]=Ti(0,t,e),n=(+r-+s)/bi;return ki(i?.roundingMethod)(n)}function Ri(t,e){return+Si(t)-+Si(e)}function Ui(t,e,i){const r=Ri(t,e)/6e4;return ki(i?.roundingMethod)(r)}function Li(t,e){const i=Si(t);return+function(t){const e=Si(t);return e.setHours(23,59,59,999),e}(i)==+function(t){const e=Si(t),i=e.getMonth();return e.setFullYear(e.getFullYear(),i+1,0),e.setHours(23,59,59,999),e}(i)}function ji(t,e,i){const[r,s,n]=Ti(0,t,t,e),o=Ei(s,n),a=Math.abs(function(t,e){const[i,r]=Ti(0,t,e);return 12*(i.getFullYear()-r.getFullYear())+(i.getMonth()-r.getMonth())}(s,n));if(a<1)return 0;1===s.getMonth()&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-o*a);let l=Ei(s,n)===-o;Li(r)&&1===a&&1===Ei(r,n)&&(l=!1);const c=o*(a-+l);return 0===c?0:c}function Vi(t,e,i){const r=ji(t,e)/3;return ki(i?.roundingMethod)(r)}function Bi(t,e,i){const r=Ri(t,e)/1e3;return ki(i?.roundingMethod)(r)}function Hi(t,e,i){const r=Ni(t,e)/7;return ki(i?.roundingMethod)(r)}function zi(t,e,i){const[r,s]=Ti(0,t,e),n=Ei(r,s),o=Math.abs(function(t,e){const[i,r]=Ti(0,t,e);return i.getFullYear()-r.getFullYear()}(r,s));r.setFullYear(1584),s.setFullYear(1584);const a=n*(o-+(Ei(r,s)===-n));return 0===a?0:a}function Fi(t,e){return+Si(t)<+Si(e)}function Yi(t,e,i){return Pi(t,-e)}function qi(t,e,i){return function(t,e){return wi(t,e*bi)}(t,-e)}function Wi(t,e,i){return wi(t,-e)}function Qi(t,e,i){return function(t,e){const i=Si(t);return i.setTime(i.getTime()+6e4*e),i}(t,-e)}function Gi(t,e,i){return function(t,e){return xi(t,3*e)}(t,-e)}function Ki(t,e,i){return function(t,e){return wi(t,1e3*e)}(t,-e)}function Ji(t,e,i){return function(t,e){return Pi(t,7*e)}(t,-e)}function Zi(t,e,i){return function(t,e){return xi(t,12*e)}(t,-e)}var Xi;t.DurationPartType=void 0,(Xi=t.DurationPartType||(t.DurationPartType={})).Millisecond="millisecond",Xi.Second="second",Xi.Minute="minute",Xi.Hour="hour",Xi.Day="day",Xi.Week="weekOfYear",Xi.Month="month",Xi.Quarter="quarter",Xi.Year="year";const tr={[t.DurationPartType.Millisecond]:1,[t.DurationPartType.Second]:1e3,[t.DurationPartType.Minute]:6e4,[t.DurationPartType.Hour]:36e5,[t.DurationPartType.Day]:864e5,[t.DurationPartType.Week]:6048e5,[t.DurationPartType.Month]:26298e5,[t.DurationPartType.Quarter]:78894e5,[t.DurationPartType.Year]:315576e5},er={1:t.DurationPartType.Millisecond,1e3:t.DurationPartType.Second,6e4:t.DurationPartType.Minute,36e5:t.DurationPartType.Hour,864e5:t.DurationPartType.Day,6048e5:t.DurationPartType.Week,26298e5:t.DurationPartType.Month,78894e5:t.DurationPartType.Quarter,315576e5:t.DurationPartType.Year},ir=["era","year","quarter","month","weekOfYear","weekday","day","dayPeriod","hour","minute","second","timeZoneName"];function rr(e,i,r){let s=i;const n={};for(const i of r){let r=0;switch(i){case t.DurationPartType.Year:r=zi(s,e),s=Zi(s,r);break;case t.DurationPartType.Quarter:r=Vi(s,e),s=Gi(s,r);break;case t.DurationPartType.Month:r=ji(s,e),s=xi(s,-r);break;case t.DurationPartType.Week:r=Hi(s,e),s=Ji(s,r);break;case t.DurationPartType.Day:r=Ni(s,e),s=Yi(s,r);break;case t.DurationPartType.Hour:r=Ii(s,e),s=qi(s,r);break;case t.DurationPartType.Minute:r=Ui(s,e),s=Qi(s,r);break;case t.DurationPartType.Second:r=Bi(s,e),s=Ki(s,r);break;case t.DurationPartType.Millisecond:r=Ri(s,e),s=Wi(s,r);break;default:throw new Error(`Unknown duration part: ${i}`)}n[i]=r}return n}function sr(t,e,i){const r=rr(t,e,i);return i.map((t=>r[t]))}const nr={[t.DurationPartType.Year]:"Y",[t.DurationPartType.Month]:"M",[t.DurationPartType.Week]:"W",[t.DurationPartType.Day]:"D",[t.DurationPartType.Hour]:"H",[t.DurationPartType.Minute]:"M",[t.DurationPartType.Second]:"S"},or=[t.DurationPartType.Year,t.DurationPartType.Month,t.DurationPartType.Week,t.DurationPartType.Day],ar=[t.DurationPartType.Hour,t.DurationPartType.Minute,t.DurationPartType.Second],lr=u`
|
333
328
|
::part(part-suffix) {
|
334
329
|
font-size: 0.4em;
|
335
330
|
line-height: 1;
|
336
331
|
}
|
337
|
-
`;function
|
332
|
+
`;function cr(t,e){Yt(t)&&(t=he(t)),Qt(t)||(t=[t,t]);const i=[Kt(t[0])?t[0]:Si(t[0]),Kt(t[1])?t[1]:Si(t[1])];if(!Ci(i[0])||!Ci(i[1]))throw new Error(`value ${t[0]} or ${t[1]} is not a valid date.`);const r=Math.abs(i[1].getTime()-function(t,e,i){const r=tr[i],s=t.getTime();return s-s%r+e.getTime()%r}(i[0],i[1],e));return{durationInMilliseconds:r,from:i[0],to:i[1]}}class ur extends di{constructor(){super(...arguments),this.__precision=[t.DurationPartType.Second,t.DurationPartType.Day],this.__initialValuePlain=null,this.__partsOptions=null,this.__from=new Date,this.__to=new Date,this.__minPrecision=t.DurationPartType.Second,this.__maxPrecision=t.DurationPartType.Day,this.__availableDurationParts=[],this.__dateTimeFieldLabels={}}get precision(){return this.__precision}set precision(e){Yt(e)&&(e=he(e)),this.__precision=e,this.__minPrecision=Qt(this.__precision)?this.__precision[0]:this.__precision,this.__maxPrecision=Qt(this.__precision)?this.__precision[1]:this.__precision,this.__availableDurationParts=Object.values(t.DurationPartType).reverse().map((t=>{const e=tr[this.__minPrecision],i=tr[this.__maxPrecision],r=tr[t];return{type:t,available:r>=e&&r<=i}})).filter((t=>t.available))}get value(){return super.value}set value(t){const{from:e,to:i,durationInMilliseconds:r}=cr(t,this.__minPrecision);this.__from=e,this.__to=i,super.value=r}get initialValue(){return super.initialValue}set initialValue(t){this.__initialValuePlain=t;const{durationInMilliseconds:e}=cr(t,this.__minPrecision);super.initialValue=e}get partsOptions(){return super.partsOptions}set partsOptions(t){this.__partsOptions=t,super.partsOptions={minPlaces:[2,void 0],...this.__partsOptions}}sampleSplit(t){const e=Bt(this.__availableDurationParts,(t=>t.type)),i=e.map((()=>[]));for(const r of t){const t=this.numberAdapter.toNumber(r);sr(new Date(Math.min(t,0)),new Date(Math.max(t,0)),e).forEach(((t,e)=>i[e].push(t)))}return i}generateAriaLabel(){return function(t){const e=or.map((e=>Ft(t[e])?`${t[e]}${nr[e]}`:"")),i=ar.map((e=>Ft(t[e])?`${t[e]}${nr[e]}`:""));return`P${e.join("")}T${i.join("")}`}(rr(Fi(this.__from,this.__to)?this.__from:this.__to,Fi(this.__from,this.__to)?this.__to:this.__from,Bt(this.__availableDurationParts,(t=>t.type))))}connectedCallback(){this.role="timer",this.partsOptions=this.__partsOptions??{},this.initialValue=this.__initialValuePlain,this.precision=this.__precision,super.connectedCallback()}shouldRebuildParts(t){return super.shouldRebuildParts(t)||t.has("precision")}willUpdate(t){super.willUpdate(t),t.has("locale")&&(this.__dateTimeFieldLabels=function(t){const e=new Intl.DisplayNames(t,{type:"dateTimeField"});return ir.reduce(((t,i)=>(t[i]=e.of(i)??"",t)),{})}(this.localeInstance))}render(){const t=this.extractCellStyles(),e=this.extractDigitStyles(),i=this.extractPartStyles(),r=this.extractAnimationOptions(),s=this.extractKeyframes(),n=Bt(this.__availableDurationParts,(t=>t.type));return q`
|
338
333
|
<timered-counter-roller
|
339
334
|
class="timered-counter timered-counter-datetime-duration"
|
340
335
|
exportparts="group, part, digit, cell, prefix, suffix, part-suffix"
|
@@ -353,9 +348,9 @@ function ft(t,e){return(e,i,r)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
353
348
|
@roller-animation-start=${this.dispatchTimeredCounterAnimationStart}
|
354
349
|
@roller-animation-end=${this.dispatchTimeredCounterAnimationEnd}
|
355
350
|
><slot name="prefix" slot="prefix"></slot
|
356
|
-
><slot name="suffix" slot="suffix"></slot>${Dt(this.parts,((t,e)=>e),((t,e)=>
|
351
|
+
><slot name="suffix" slot="suffix"></slot>${Dt(this.parts,((t,e)=>e),((t,e)=>q`<span slot=${`part-suffix-${e}`} class="duration-unit"
|
357
352
|
>${this.__dateTimeFieldLabels[n[e]]}</span
|
358
353
|
>`))}
|
359
354
|
</timered-counter-roller>
|
360
|
-
`}}
|
355
|
+
`}}ur.styles=[...di.styles,lr],r([dt({reflect:!0,converter:t=>Wt(t)?t:he(t)})],ur.prototype,"precision",null),oi("timered-counter-datetime-duration",ur);const hr=/^-?\d+(\.\d+)?$/,pr=(t={precision:1e3})=>{const i=e.Decimal.clone(t);return{create:t=>(Yt(t)&&!hr.test(t)&&(t=0),new i(t)),add:(t,e)=>t.plus(e),sub:(t,e)=>t.minus(e),mul:(t,e)=>t.times(e),div:(t,e)=>t.div(e),compare:(t,e)=>t.cmp(e),eq:(t,e)=>t.eq(e),gt:(t,e)=>t.gt(e),gte:(t,e)=>t.gte(e),lt:(t,e)=>t.lt(e),lte:(t,e)=>t.lte(e),isInteger:t=>t.isInteger(),isNegative:t=>t.isNegative(),isPositive:t=>t.isPositive(),isZero:t=>t.isZero(),isNaN:t=>t.isNaN(),isFinite:t=>t.isFinite(),abs:t=>t.abs(),ceil:t=>t.ceil(),floor:t=>t.floor(),round:t=>t.round(),max:(t,e)=>i.max(t,e),min:(t,e)=>i.min(t,e),toNumber:t=>t.toNumber(),toString:t=>t.toFixed()}};var dr={register:function(t,e){t.registerNumberAdapter(["decimal.js","decimal-js","decimaljs"],(()=>pr(e)))},DecimalJsAdapter:pr};const fr=()=>{const t=new i;return{stringToChars:e=>t.splitGraphemes(e)}};var mr={register:function(t){t.registerStringAdapter(["grapheme-splitter"],(()=>fr()))},GraphemeSplitterAdapter:fr};t.DurationPartMillisecond=tr,t.DurationPartMillisecondToType=er,t.TimeredCounter=di,t.TimeredCounterAdapter=ge,t.TimeredCounterDatetimeDuration=ur,t.TimeredCounterNumber=mi,t.TimeredCounterString=Ai,t.cubicBezier=Te,t.easeInBack=Ke,t.easeInBounce=ri,t.easeInCirc=We,t.easeInCubic=Ie,t.easeInElastic=Xe,t.easeInExpo=Fe,t.easeInOutBack=Ze,t.easeInOutBounce=si,t.easeInOutCirc=Ge,t.easeInOutCubic=Ue,t.easeInOutElastic=ei,t.easeInOutExpo=qe,t.easeInOutQuad=ke,t.easeInOutQuart=Ve,t.easeInOutQuint=ze,t.easeInOutSine=Ce,t.easeInQuad=Ne,t.easeInQuart=Le,t.easeInQuint=Be,t.easeInSine=Oe,t.easeOutBack=Je,t.easeOutBounce=ii,t.easeOutCirc=Qe,t.easeOutCubic=Re,t.easeOutElastic=ti,t.easeOutExpo=Ye,t.easeOutQuad=Me,t.easeOutQuart=je,t.easeOutQuint=He,t.easeOutSine=Ee,t.linear=t=>t,t.noop=we,t.registerAdapter=function(...t){ge.registerAdapter(...t)},t.registerDecimalJsNumberAdapter=function(){dr.register(ge)},t.registerGraphemeSplitterStringAdapter=function(){mr.register(ge)},t.registerNumberAdapter=function(...t){ge.registerNumberAdapter(...t)},t.registerStringAdapter=function(...t){ge.registerStringAdapter(...t)},t.setNumberAdapter=function(...t){ge.setNumberAdapter(...t)},t.setStringAdapter=function(...t){ge.setStringAdapter(...t)}},"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("decimal.js"),require("grapheme-splitter")):"function"==typeof define&&define.amd?define(["exports","decimal.js","grapheme-splitter"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).TimeredCounter={},t.decimal_js,t.GraphemeSplitter);
|
361
356
|
//# sourceMappingURL=timered-counter.global.js.map
|