New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@netless/app-countdown

Package Overview
Dependencies
Maintainers
10
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netless/app-countdown - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

dist/App.d.ts

9

dist/index.d.ts
import type { NetlessApp } from "@netless/window-manager";
export interface Attributes {
state: {
start: number;
pause: number;
total: number;
};
}
declare const Countdown: NetlessApp<Attributes>;
declare const Countdown: NetlessApp;
export default Countdown;

@@ -1,3 +0,7 @@

"use strict";var Tt=Object.defineProperty;var G=Object.getOwnPropertySymbols;var Mt=Object.prototype.hasOwnProperty,Ht=Object.prototype.propertyIsEnumerable;var X=(t,e,o)=>e in t?Tt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Z=(t,e)=>{for(var o in e||(e={}))Mt.call(e,o)&&X(t,o,e[o]);if(G)for(var o of G(e))Ht.call(e,o)&&X(t,o,e[o]);return t};Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var D,a,J,E,K,Q,T={},Y=[],Nt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function S(t,e){for(var o in e)t[o]=e[o];return t}function tt(t){var e=t.parentNode;e&&e.removeChild(t)}function h(t,e,o){var n,_,r,l={};for(r in e)r=="key"?n=e[r]:r=="ref"?_=e[r]:l[r]=e[r];if(arguments.length>2&&(l.children=arguments.length>3?D.call(arguments,2):o),typeof t=="function"&&t.defaultProps!=null)for(r in t.defaultProps)l[r]===void 0&&(l[r]=t.defaultProps[r]);return M(t,l,n,_,null)}function M(t,e,o,n,_){var r={type:t,props:e,key:o,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:_==null?++J:_};return _==null&&a.vnode!=null&&a.vnode(r),r}function C(t){return t.children}function x(t,e){this.props=t,this.context=e}function A(t,e){if(e==null)return t.__?A(t.__,t.__.__k.indexOf(t)+1):null;for(var o;e<t.__k.length;e++)if((o=t.__k[e])!=null&&o.__e!=null)return o.__e;return typeof t.type=="function"?A(t):null}function et(t){var e,o;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((o=t.__k[e])!=null&&o.__e!=null){t.__e=t.__c.base=o.__e;break}return et(t)}}function ot(t){(!t.__d&&(t.__d=!0)&&E.push(t)&&!H.__r++||Q!==a.debounceRendering)&&((Q=a.debounceRendering)||K)(H)}function H(){for(var t;H.__r=E.length;)t=E.sort(function(e,o){return e.__v.__b-o.__v.__b}),E=[],t.some(function(e){var o,n,_,r,l,s;e.__d&&(l=(r=(o=e).__v).__e,(s=o.__P)&&(n=[],(_=S({},r)).__v=r.__v+1,I(s,r,_,o.__n,s.ownerSVGElement!==void 0,r.__h!=null?[l]:null,n,l==null?A(r):l,r.__h),at(n,r),r.__e!=l&&et(r)))})}function nt(t,e,o,n,_,r,l,s,d,p){var i,m,f,c,u,k,v,b=n&&n.__k||Y,y=b.length;for(o.__k=[],i=0;i<e.length;i++)if((c=o.__k[i]=(c=e[i])==null||typeof c=="boolean"?null:typeof c=="string"||typeof c=="number"||typeof c=="bigint"?M(null,c,null,null,c):Array.isArray(c)?M(C,{children:c},null,null,null):c.__b>0?M(c.type,c.props,c.key,null,c.__v):c)!=null){if(c.__=o,c.__b=o.__b+1,(f=b[i])===null||f&&c.key==f.key&&c.type===f.type)b[i]=void 0;else for(m=0;m<y;m++){if((f=b[m])&&c.key==f.key&&c.type===f.type){b[m]=void 0;break}f=null}I(t,c,f=f||T,_,r,l,s,d,p),u=c.__e,(m=c.ref)&&f.ref!=m&&(v||(v=[]),f.ref&&v.push(f.ref,null,c),v.push(m,c.__c||u,c)),u!=null?(k==null&&(k=u),typeof c.type=="function"&&c.__k===f.__k?c.__d=d=rt(c,d,t):d=it(t,c,f,b,u,d),typeof o.type=="function"&&(o.__d=d)):d&&f.__e==d&&d.parentNode!=t&&(d=A(f))}for(o.__e=k,i=y;i--;)b[i]!=null&&(typeof o.type=="function"&&b[i].__e!=null&&b[i].__e==o.__d&&(o.__d=A(n,i+1)),ft(b[i],b[i]));if(v)for(i=0;i<v.length;i++)ct(v[i],v[++i],v[++i])}function rt(t,e,o){for(var n,_=t.__k,r=0;_&&r<_.length;r++)(n=_[r])&&(n.__=t,e=typeof n.type=="function"?rt(n,e,o):it(o,n,n,_,n.__e,e));return e}function N(t,e){return e=e||[],t==null||typeof t=="boolean"||(Array.isArray(t)?t.some(function(o){N(o,e)}):e.push(t)),e}function it(t,e,o,n,_,r){var l,s,d;if(e.__d!==void 0)l=e.__d,e.__d=void 0;else if(o==null||_!=r||_.parentNode==null)t:if(r==null||r.parentNode!==t)t.appendChild(_),l=null;else{for(s=r,d=0;(s=s.nextSibling)&&d<n.length;d+=2)if(s==_)break t;t.insertBefore(_,r),l=r}return l!==void 0?l:_.nextSibling}function Rt(t,e,o,n,_){var r;for(r in o)r==="children"||r==="key"||r in e||R(t,r,null,o[r],n);for(r in e)_&&typeof e[r]!="function"||r==="children"||r==="key"||r==="value"||r==="checked"||o[r]===e[r]||R(t,r,e[r],o[r],n)}function _t(t,e,o){e[0]==="-"?t.setProperty(e,o):t[e]=o==null?"":typeof o!="number"||Nt.test(e)?o:o+"px"}function R(t,e,o,n,_){var r;t:if(e==="style")if(typeof o=="string")t.style.cssText=o;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)o&&e in o||_t(t.style,e,"");if(o)for(e in o)n&&o[e]===n[e]||_t(t.style,e,o[e])}else if(e[0]==="o"&&e[1]==="n")r=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=o,o?n||t.addEventListener(e,r?st:lt,r):t.removeEventListener(e,r?st:lt,r);else if(e!=="dangerouslySetInnerHTML"){if(_)e=e.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if(e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e in t)try{t[e]=o==null?"":o;break t}catch(l){}typeof o=="function"||(o!=null&&(o!==!1||e[0]==="a"&&e[1]==="r")?t.setAttribute(e,o):t.removeAttribute(e))}}function lt(t){this.l[t.type+!1](a.event?a.event(t):t)}function st(t){this.l[t.type+!0](a.event?a.event(t):t)}function I(t,e,o,n,_,r,l,s,d){var p,i,m,f,c,u,k,v,b,y,$,w=e.type;if(e.constructor!==void 0)return null;o.__h!=null&&(d=o.__h,s=e.__e=o.__e,e.__h=null,r=[s]),(p=a.__b)&&p(e);try{t:if(typeof w=="function"){if(v=e.props,b=(p=w.contextType)&&n[p.__c],y=p?b?b.props.value:p.__:n,o.__c?k=(i=e.__c=o.__c).__=i.__E:("prototype"in w&&w.prototype.render?e.__c=i=new w(v,y):(e.__c=i=new x(v,y),i.constructor=w,i.render=Lt),b&&b.sub(i),i.props=v,i.state||(i.state={}),i.context=y,i.__n=n,m=i.__d=!0,i.__h=[]),i.__s==null&&(i.__s=i.state),w.getDerivedStateFromProps!=null&&(i.__s==i.state&&(i.__s=S({},i.__s)),S(i.__s,w.getDerivedStateFromProps(v,i.__s))),f=i.props,c=i.state,m)w.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else{if(w.getDerivedStateFromProps==null&&v!==f&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(v,y),!i.__e&&i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(v,i.__s,y)===!1||e.__v===o.__v){i.props=v,i.state=i.__s,e.__v!==o.__v&&(i.__d=!1),i.__v=e,e.__e=o.__e,e.__k=o.__k,e.__k.forEach(function(P){P&&(P.__=e)}),i.__h.length&&l.push(i);break t}i.componentWillUpdate!=null&&i.componentWillUpdate(v,i.__s,y),i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(f,c,u)})}i.context=y,i.props=v,i.state=i.__s,(p=a.__r)&&p(e),i.__d=!1,i.__v=e,i.__P=t,p=i.render(i.props,i.state,i.context),i.state=i.__s,i.getChildContext!=null&&(n=S(S({},n),i.getChildContext())),m||i.getSnapshotBeforeUpdate==null||(u=i.getSnapshotBeforeUpdate(f,c)),$=p!=null&&p.type===C&&p.key==null?p.props.children:p,nt(t,Array.isArray($)?$:[$],e,o,n,_,r,l,s,d),i.base=e.__e,e.__h=null,i.__h.length&&l.push(i),k&&(i.__E=i.__=null),i.__e=!1}else r==null&&e.__v===o.__v?(e.__k=o.__k,e.__e=o.__e):e.__e=Ut(o.__e,e,o,n,_,r,l,d);(p=a.diffed)&&p(e)}catch(P){e.__v=null,(d||r!=null)&&(e.__e=s,e.__h=!!d,r[r.indexOf(s)]=null),a.__e(P,e,o)}}function at(t,e){a.__c&&a.__c(e,t),t.some(function(o){try{t=o.__h,o.__h=[],t.some(function(n){n.call(o)})}catch(n){a.__e(n,o.__v)}})}function Ut(t,e,o,n,_,r,l,s){var d,p,i,m=o.props,f=e.props,c=e.type,u=0;if(c==="svg"&&(_=!0),r!=null){for(;u<r.length;u++)if((d=r[u])&&(d===t||(c?d.localName==c:d.nodeType==3))){t=d,r[u]=null;break}}if(t==null){if(c===null)return document.createTextNode(f);t=_?document.createElementNS("http://www.w3.org/2000/svg",c):document.createElement(c,f.is&&f),r=null,s=!1}if(c===null)m===f||s&&t.data===f||(t.data=f);else{if(r=r&&D.call(t.childNodes),p=(m=o.props||T).dangerouslySetInnerHTML,i=f.dangerouslySetInnerHTML,!s){if(r!=null)for(m={},u=0;u<t.attributes.length;u++)m[t.attributes[u].name]=t.attributes[u].value;(i||p)&&(i&&(p&&i.__html==p.__html||i.__html===t.innerHTML)||(t.innerHTML=i&&i.__html||""))}if(Rt(t,f,m,_,s),i)e.__k=[];else if(u=e.props.children,nt(t,Array.isArray(u)?u:[u],e,o,n,_&&c!=="foreignObject",r,l,r?r[0]:o.__k&&A(o,0),s),r!=null)for(u=r.length;u--;)r[u]!=null&&tt(r[u]);s||("value"in f&&(u=f.value)!==void 0&&(u!==t.value||c==="progress"&&!u)&&R(t,"value",u,m.value,!1),"checked"in f&&(u=f.checked)!==void 0&&u!==t.checked&&R(t,"checked",u,m.checked,!1))}return t}function ct(t,e,o){try{typeof t=="function"?t(e):t.current=e}catch(n){a.__e(n,o)}}function ft(t,e,o){var n,_;if(a.unmount&&a.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||ct(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(r){a.__e(r,e)}n.base=n.__P=null}if(n=t.__k)for(_=0;_<n.length;_++)n[_]&&ft(n[_],e,typeof t.type!="function");o||t.__e==null||tt(t.__e),t.__e=t.__d=void 0}function Lt(t,e,o){return this.constructor(t,o)}function pt(t,e,o){var n,_,r;a.__&&a.__(t,e),_=(n=typeof o=="function")?null:o&&o.__k||e.__k,r=[],I(e,t=(!n&&o||e).__k=h(C,null,[t]),_||T,T,e.ownerSVGElement!==void 0,!n&&o?[o]:_?null:e.firstChild?D.call(e.childNodes):null,r,!n&&o?o:_?_.__e:e.firstChild,n),at(r,t)}D=Y.slice,a={__e:function(t,e){for(var o,n,_;e=e.__;)if((o=e.__c)&&!o.__)try{if((n=o.constructor)&&n.getDerivedStateFromError!=null&&(o.setState(n.getDerivedStateFromError(t)),_=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(t),_=o.__d),_)return o.__E=o}catch(r){t=r}throw t}},J=0,x.prototype.setState=function(t,e){var o;o=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=S({},this.state),typeof t=="function"&&(t=t(S({},o),this.props)),t&&S(o,t),t!=null&&this.__v&&(e&&this.__h.push(e),ot(this))},x.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ot(this))},x.prototype.render=C,E=[],K=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,H.__r=0;var O,g,dt,j=0,W=[],ut=a.__b,ht=a.__r,mt=a.diffed,vt=a.__c,bt=a.unmount;function gt(t,e){a.__h&&a.__h(g,t,j||e),j=0;var o=g.__H||(g.__H={__:[],__h:[]});return t>=o.__.length&&o.__.push({}),o.__[t]}function V(t){return j=1,Ft(wt,t)}function Ft(t,e,o){var n=gt(O++,2);return n.t=t,n.__c||(n.__=[o?o(e):wt(void 0,e),function(_){var r=n.t(n.__[0],_);n.__[0]!==r&&(n.__=[r,n.__[1]],n.__c.setState({}))}],n.__c=g),n.__}function It(t,e){var o=gt(O++,3);!a.__s&&jt(o.__H,e)&&(o.__=t,o.__H=e,g.__H.__h.push(o))}function Ot(){W.forEach(function(t){if(t.__P)try{t.__H.__h.forEach(U),t.__H.__h.forEach(z),t.__H.__h=[]}catch(e){t.__H.__h=[],a.__e(e,t.__v)}}),W=[]}a.__b=function(t){g=null,ut&&ut(t)},a.__r=function(t){ht&&ht(t),O=0;var e=(g=t.__c).__H;e&&(e.__h.forEach(U),e.__h.forEach(z),e.__h=[])},a.diffed=function(t){mt&&mt(t);var e=t.__c;e&&e.__H&&e.__H.__h.length&&(W.push(e)!==1&&dt===a.requestAnimationFrame||((dt=a.requestAnimationFrame)||function(o){var n,_=function(){clearTimeout(r),yt&&cancelAnimationFrame(n),setTimeout(o)},r=setTimeout(_,100);yt&&(n=requestAnimationFrame(_))})(Ot)),g=null},a.__c=function(t,e){e.some(function(o){try{o.__h.forEach(U),o.__h=o.__h.filter(function(n){return!n.__||z(n)})}catch(n){e.some(function(_){_.__h&&(_.__h=[])}),e=[],a.__e(n,o.__v)}}),vt&&vt(t,e)},a.unmount=function(t){bt&&bt(t);var e=t.__c;if(e&&e.__H)try{e.__H.__.forEach(U)}catch(o){a.__e(o,e.__v)}};var yt=typeof requestAnimationFrame=="function";function U(t){var e=g;typeof t.__c=="function"&&t.__c(),g=e}function z(t){var e=g;t.__c=t.__(),g=e}function jt(t,e){return!t||t.length!==e.length||e.some(function(o,n){return o!==t[n]})}function wt(t,e){return typeof e=="function"?e(t):e}function Wt(t,e){for(var o in e)t[o]=e[o];return t}function xt(t,e){for(var o in t)if(o!=="__source"&&!(o in e))return!0;for(var n in e)if(n!=="__source"&&t[n]!==e[n])return!0;return!1}function B(t){this.props=t}(B.prototype=new x).isPureReactComponent=!0,B.prototype.shouldComponentUpdate=function(t,e){return xt(this.props,t)||xt(this.state,e)};var kt=a.__b;a.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),kt&&kt(t)};var Vt=a.__e;a.__e=function(t,e,o){if(t.then){for(var n,_=e;_=_.__;)if((n=_.__c)&&n.__c)return e.__e==null&&(e.__e=o.__e,e.__k=o.__k),n.__c(t,e)}Vt(t,e,o)};var St=a.unmount;function q(){this.__u=0,this.t=null,this.__b=null}function Ct(t){var e=t.__.__c;return e&&e.__e&&e.__e(t)}function L(){this.u=null,this.o=null}a.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&t.__h===!0&&(t.type=null),St&&St(t)},(q.prototype=new x).__c=function(t,e){var o=e.__c,n=this;n.t==null&&(n.t=[]),n.t.push(o);var _=Ct(n.__v),r=!1,l=function(){r||(r=!0,o.__R=null,_?_(s):s())};o.__R=l;var s=function(){if(!--n.__u){if(n.state.__e){var p=n.state.__e;n.__v.__k[0]=function m(f,c,u){return f&&(f.__v=null,f.__k=f.__k&&f.__k.map(function(k){return m(k,c,u)}),f.__c&&f.__c.__P===c&&(f.__e&&u.insertBefore(f.__e,f.__d),f.__c.__e=!0,f.__c.__P=u)),f}(p,p.__c.__P,p.__c.__O)}var i;for(n.setState({__e:n.__b=null});i=n.t.pop();)i.forceUpdate()}},d=e.__h===!0;n.__u++||d||n.setState({__e:n.__b=n.__v.__k[0]}),t.then(l,l)},q.prototype.componentWillUnmount=function(){this.t=[]},q.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var o=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=function r(l,s,d){return l&&(l.__c&&l.__c.__H&&(l.__c.__H.__.forEach(function(p){typeof p.__c=="function"&&p.__c()}),l.__c.__H=null),(l=Wt({},l)).__c!=null&&(l.__c.__P===d&&(l.__c.__P=s),l.__c=null),l.__k=l.__k&&l.__k.map(function(p){return r(p,s,d)})),l}(this.__b,o,n.__O=n.__P)}this.__b=null}var _=e.__e&&h(C,null,t.fallback);return _&&(_.__h=null),[h(C,null,e.__e?null:t.children),_]};var At=function(t,e,o){if(++o[1]===o[0]&&t.o.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.o.size))for(o=t.u;o;){for(;o.length>3;)o.pop()();if(o[1]<o[0])break;t.u=o=o[2]}};(L.prototype=new x).__e=function(t){var e=this,o=Ct(e.__v),n=e.o.get(t);return n[0]++,function(_){var r=function(){e.props.revealOrder?(n.push(_),At(e,t,n)):_()};o?o(r):r()}},L.prototype.render=function(t){this.u=null,this.o=new Map;var e=N(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var o=e.length;o--;)this.o.set(e[o],this.u=[1,0,this.u]);return t.children},L.prototype.componentDidUpdate=L.prototype.componentDidMount=function(){var t=this;this.o.forEach(function(e,o){At(t,o,e)})};var zt=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,Bt=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,qt=typeof document!="undefined",Gt=function(t){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(t)};x.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(x.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var Et=a.event;function Xt(){}function Zt(){return this.cancelBubble}function Jt(){return this.defaultPrevented}a.event=function(t){return Et&&(t=Et(t)),t.persist=Xt,t.isPropagationStopped=Zt,t.isDefaultPrevented=Jt,t.nativeEvent=t};var $t={configurable:!0,get:function(){return this.class}},Pt=a.vnode;a.vnode=function(t){var e=t.type,o=t.props,n=o;if(typeof e=="string"){var _=e.indexOf("-")===-1;for(var r in n={},o){var l=o[r];qt&&r==="children"&&e==="noscript"||r==="value"&&"defaultValue"in o&&l==null||(r==="defaultValue"&&"value"in o&&o.value==null?r="value":r==="download"&&l===!0?l="":/ondoubleclick/i.test(r)?r="ondblclick":/^onchange(textarea|input)/i.test(r+e)&&!Gt(o.type)?r="oninput":/^on(Ani|Tra|Tou|BeforeInp)/.test(r)?r=r.toLowerCase():_&&Bt.test(r)?r=r.replace(/[A-Z0-9]/,"-$&").toLowerCase():l===null&&(l=void 0),n[r]=l)}e=="select"&&n.multiple&&Array.isArray(n.value)&&(n.value=N(o.children).forEach(function(s){s.props.selected=n.value.indexOf(s.props.value)!=-1})),e=="select"&&n.defaultValue!=null&&(n.value=N(o.children).forEach(function(s){s.props.selected=n.multiple?n.defaultValue.indexOf(s.props.value)!=-1:n.defaultValue==s.props.value})),t.props=n}e&&o.class!=o.className&&($t.enumerable="className"in o,o.className!=null&&(n.class=o.className),Object.defineProperty(n,"className",$t)),t.$$typeof=zt,Pt&&Pt(t)};var Dt=a.__r;a.__r=function(t){Dt&&Dt(t)};class Kt extends x{constructor(e){super(e);this.raf=0,this.start=()=>{const{context:o,room:n}=this.props,{start:_,pause:r,total:l}=this.attributes.state,s=n.calibrationTimestamp;r?o.updateAttributes(["state"],{start:s-(r-_),pause:0,total:l}):o.updateAttributes(["state","pause"],s)},this.reset=()=>{const{context:o}=this.props;o.updateAttributes(["state"],{start:0,pause:0,total:0}),this.setState({isDone:!1})},this.init=o=>{const{context:n,room:_}=this.props;n.updateAttributes(["state"],{start:_.calibrationTimestamp,pause:0,total:o||0})},this.update=()=>{this.raf=requestAnimationFrame(this.update);const{context:o,room:n}=this.props;this.attributes=o.getAttributes();const{start:_,pause:r,total:l}=this.attributes.state,s=_===0,d=s||r!==0;let p=0;_&&(r?p=(r-_)/1e3|0:p=(n.calibrationTimestamp-_)/1e3|0),l&&(p>l&&(!r&&this.start(),this.setState({isDone:!0})),p=Math.max(l-p,0)),this.setState({isInit:s,stopped:d,seconds:p})},this.raf=requestAnimationFrame(this.update),this.attributes=e.context.getAttributes(),this.state={isInit:!0,isDone:!1,seconds:0,stopped:!0,start:this.start,reset:this.reset,init:this.init}}componentWillUnmount(){console.log("[Countdown]: unmount"),cancelAnimationFrame(this.raf)}render(){return h(Qt,Z({},this.state))}}class Qt extends B{constructor(e){super(e);this.correctValueFormat=o=>({left:Math.floor(o/10),right:o%10}),this.transformTime=()=>{if(this.props.isInit){const{total:s}=this.state;return{minutes_left:s[0],minutes_right:s[1],seconds_left:s[2],seconds_right:s[3]}}const o=this.props.seconds,n=Math.floor(o%(60*60)/60),_=Math.floor(o%60),r=this.correctValueFormat(n),l=this.correctValueFormat(_);return{minutes_left:r.left,minutes_right:r.right,seconds_left:l.left,seconds_right:l.right}},this.handleInit=()=>{const[o,n,_,r]=this.state.total;this.props.init((o*10+n)*60+(_*10+r))},this.handleReset=()=>{this.props.reset(),this.setState({total:[0,0,0,0]})},this.handleInc=o=>()=>{const n=this.state.total.map((_,r)=>r===o?(_+1)%10:_);o===2&&n[o]>5&&(n[o]=0),this.setState({total:n})},this.incMinutesLeft=this.handleInc(0),this.incMinutesRight=this.handleInc(1),this.incSecondsLeft=this.handleInc(2),this.incSecondsRight=this.handleInc(3),this.handleDec=o=>()=>{const n=this.state.total.map((_,r)=>r===o?(_+9)%10:_);o===2&&n[o]>5&&(n[o]=5),this.setState({total:n})},this.decMinutesLeft=this.handleDec(0),this.decMinutesRight=this.handleDec(1),this.decSecondsLeft=this.handleDec(2),this.decSecondsRight=this.handleDec(3),this.state={total:[0,0,0,0]}}render(){const{isInit:e,isDone:o,stopped:n,start:_}=this.props,{seconds_left:r,seconds_right:l,minutes_right:s,minutes_left:d}=this.transformTime(),p=o?"flipdown flipdown__theme-light":"flipdown flipdown__theme-dark";return h("div",{class:"flipdown-box"},!e&&h("div",{class:"flipdown-mask"},n?h("div",{class:"flipdown-mask-mid"},h("button",{onClick:this.handleReset,class:"flipdown-mask-btn"},"\u91CD\u7F6E"),!o&&h("button",{onClick:_,class:"flipdown-mask-btn"},"\u7EE7\u7EED")):h("div",{class:"flipdown-mask-mid"},h("button",{onClick:_,class:"flipdown-mask-btn"},"\u6682\u505C"))),h("div",{class:p},h("div",{class:"flipdown-mid-box"},h(F,{style:{marginRight:8},disabled:!e,time:d,onUp:this.incMinutesLeft,onDown:this.decMinutesLeft}),h(F,{time:s,disabled:!e,onUp:this.incMinutesRight,onDown:this.decMinutesRight})),h("div",{class:"flipdown-point-box"},h("div",{style:"margin-bottom: 12px"}),h("div",null)),h("div",{class:"flipdown-mid-box"},h(F,{style:{marginRight:8},disabled:!e,time:r,onUp:this.incSecondsLeft,onDown:this.decSecondsLeft}),h(F,{time:l,disabled:!e,onUp:this.incSecondsRight,onDown:this.decSecondsRight}))),e&&h("div",{class:"flipdown-buttons"},h("button",{onClick:this.handleInit,class:"flipdown-button"},"\u5F00\u59CB")))}}const F=({time:t,style:e,disabled:o,onUp:n,onDown:_})=>{const[r,l]=V("rotor-leaf"),[s,d]=V(0),[p,i]=V(0);return It(()=>{o||p?(i(1),l("rotor-leaf flipped"),setTimeout(()=>{l("rotor-leaf"),d(t)},500),!o&&i(0)):d(t)},[t,o]),h("div",{class:o?"flipdown-digit disabled":"flipdown-digit",style:e},h("div",{class:"flipdown-up",onClick:o?void 0:n}),h("div",{class:"rotor"},h("div",{class:r},h("figure",{class:"rotor-leaf-rear"},t),h("figure",{class:"rotor-leaf-front"},s)),h("div",{class:"rotor-top"},t),h("div",{class:"rotor-bottom"},s)),h("div",{class:"flipdown-down",onClick:o?void 0:_}))};var Yt=`.netless-app-flipdown-container{height:100%}.flipdown-box{height:100%;position:relative;display:flex;flex-flow:column nowrap;align-items:center;justify-content:center}.flipdown-mask{width:100%;height:100%;position:absolute;z-index:2;background-color:#0000004d;display:flex;justify-items:center;align-items:center;flex-direction:row;opacity:0}.flipdown-mask:hover{opacity:1}.flipdown-mask-btn{width:90px;height:28px;background-color:#3380ff;margin-left:auto;margin-right:auto;border:0;border-radius:4px;display:flex;align-items:center;justify-content:center;color:#fff;cursor:pointer}.flipdown-mask-mid{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.flipdown-buttons{display:flex;flex-flow:column nowrap;gap:4px;padding-bottom:20px}.flipdown-button{width:180px;height:36px;border:0;background-color:#3380ff;margin-left:auto;margin-right:auto;border-radius:4px;display:flex;align-items:center;justify-content:center;color:#fff;cursor:pointer}.flipdown{display:flex;flex-direction:row;align-items:center;justify-content:center;transform-origin:center}.flipdown-digit{display:flex;flex-flow:column nowrap;align-items:center}.flipdown-digit.disabled .flipdown-up:before,.flipdown-digit.disabled .flipdown-down:after{border-top-color:#0000000d;border-bottom-color:#0000000d}.flipdown-up:before,.flipdown-down:after{content:"";display:inline-block;width:0;height:0;border-top:0;border-left:12px solid transparent;border-right:12px solid transparent;border-bottom:12px solid #151515;cursor:pointer}.flipdown-down:after{border-top:12px solid #151515;border-bottom:0}.flipdown-mid-box{display:flex;flex-direction:row;padding-top:20px;padding-bottom:8px}.flipdown-point-box{display:flex;flex-direction:column;justify-content:center;padding:20px 6px 8px}.flipdown-point-box div{width:8px;height:8px;background-color:#000;border-radius:50%}.flipdown.flipdown__theme-dark{font-family:sans-serif;font-weight:bold}.flipdown.flipdown__theme-dark .rotor,.flipdown.flipdown__theme-dark .rotor-top,.flipdown.flipdown__theme-dark .rotor-leaf-front{color:#fff;background-color:#151515}.flipdown.flipdown__theme-dark .rotor-bottom,.flipdown.flipdown__theme-dark .rotor-leaf-rear{color:#efefef;background-color:#202020}.flipdown.flipdown__theme-dark .rotor:after{border-top:solid 1px #151515}.flipdown.flipdown__theme-light{font-family:sans-serif;font-weight:bold}.flipdown.flipdown__theme-light .rotor,.flipdown.flipdown__theme-light .rotor-top,.flipdown.flipdown__theme-light .rotor-leaf-front{color:#222;background-color:#ddd}.flipdown.flipdown__theme-light .rotor-bottom,.flipdown.flipdown__theme-light .rotor-leaf-rear{color:#333;background-color:#eee}.flipdown.flipdown__theme-light .rotor:after{border-top:solid 1px #222222}.flipdown .rotor-group{position:relative}.flipdown .rotor{position:relative;width:36px;height:64px;border-radius:4px;font-size:48px;text-align:center;perspective:200px}.flipdown .rotor-top,.flipdown .rotor-bottom{overflow:hidden;position:absolute;width:36px;height:32px}.flipdown .rotor-leaf{z-index:1;position:absolute;width:36px;height:64px;transform-style:preserve-3d;transition:transform 0s}.flipdown .rotor-leaf.flipped{transform:rotateX(-180deg);transition:all .5s ease-in-out}.flipdown .rotor-leaf-front,.flipdown .rotor-leaf-rear{overflow:hidden;position:absolute;width:36px;height:32px;margin:0;transform:rotateX(0);backface-visibility:hidden;-webkit-backface-visibility:hidden}.flipdown .rotor-leaf-front{line-height:64px;border-radius:4px 4px 0 0}.flipdown .rotor-leaf-rear{line-height:0px;border-radius:0 0 4px 4px;transform:rotateX(-180deg)}.flipdown .rotor-top{line-height:64px;border-radius:4px 4px 0 0}.flipdown .rotor-bottom{bottom:0;line-height:0px;border-radius:0 0 4px 4px}.flipdown .rotor:after{content:"";z-index:2;position:absolute;bottom:0px;left:0px;width:36px;height:32px;border-radius:0 0 4px 4px}
`;const te=()=>null,ee=208,oe=216,ne={kind:"Countdown",config:{minwidth:ee,minheight:oe},setup(t){let e=t.getAttributes();if((e==null?void 0:e.state)||(t.setAttributes({state:{start:0,pause:0,total:0}}),e=t.getAttributes()),!e)throw new Error("[Countdown]: No attributes");const o=t.getRoom();if(!o)throw new Error("[Countdown]: No room");const n=t.getBox(),_=document.createElement("div");_.classList.add("netless-app-flipdown-container"),n.mountStyles(Yt),n.mountContent(_),pt(h(Kt,{context:t,room:o}),_),t.emitter.on("destroy",()=>{console.log("[Countdown]: destroy"),pt(h(te,null),_),_.remove()})}};exports.default=ne;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var I,a,ne,A,oe,re,F={},_e=[],Te=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function C(e,t){for(var n in t)e[n]=t[n];return e}function le(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n){var o,l,r,i={};for(r in t)r=="key"?o=t[r]:r=="ref"?l=t[r]:i[r]=t[r];if(arguments.length>2&&(i.children=arguments.length>3?I.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)i[r]===void 0&&(i[r]=e.defaultProps[r]);return L(e,i,o,l,null)}function L(e,t,n,o,l){var r={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:l==null?++ne:l};return l==null&&a.vnode!=null&&a.vnode(r),r}function O(e){return e.children}function $(e,t){this.props=e,this.context=t}function N(e,t){if(t==null)return e.__?N(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?N(e):null}function ie(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return ie(e)}}function ce(e){(!e.__d&&(e.__d=!0)&&A.push(e)&&!T.__r++||re!==a.debounceRendering)&&((re=a.debounceRendering)||oe)(T)}function T(){for(var e;T.__r=A.length;)e=A.sort(function(t,n){return t.__v.__b-n.__v.__b}),A=[],e.some(function(t){var n,o,l,r,i,u;t.__d&&(i=(r=(n=t).__v).__e,(u=n.__P)&&(o=[],(l=C({},r)).__v=r.__v+1,K(u,r,l,n.__n,u.ownerSVGElement!==void 0,r.__h!=null?[i]:null,o,i==null?N(r):i,r.__h),he(o,r),r.__e!=i&&ie(r)))})}function se(e,t,n,o,l,r,i,u,f,d){var _,h,s,c,p,k,b,m=o&&o.__k||_e,y=m.length;for(n.__k=[],_=0;_<t.length;_++)if((c=n.__k[_]=(c=t[_])==null||typeof c=="boolean"?null:typeof c=="string"||typeof c=="number"||typeof c=="bigint"?L(null,c,null,null,c):Array.isArray(c)?L(O,{children:c},null,null,null):c.__b>0?L(c.type,c.props,c.key,null,c.__v):c)!=null){if(c.__=n,c.__b=n.__b+1,(s=m[_])===null||s&&c.key==s.key&&c.type===s.type)m[_]=void 0;else for(h=0;h<y;h++){if((s=m[h])&&c.key==s.key&&c.type===s.type){m[h]=void 0;break}s=null}K(e,c,s=s||F,l,r,i,u,f,d),p=c.__e,(h=c.ref)&&s.ref!=h&&(b||(b=[]),s.ref&&b.push(s.ref,null,c),b.push(h,c.__c||p,c)),p!=null?(k==null&&(k=p),typeof c.type=="function"&&c.__k===s.__k?c.__d=f=ae(c,f,e):f=ue(e,c,s,m,p,f),typeof n.type=="function"&&(n.__d=f)):f&&s.__e==f&&f.parentNode!=e&&(f=N(s))}for(n.__e=k,_=y;_--;)m[_]!=null&&(typeof n.type=="function"&&m[_].__e!=null&&m[_].__e==n.__d&&(n.__d=N(o,_+1)),be(m[_],m[_]));if(b)for(_=0;_<b.length;_++)ve(b[_],b[++_],b[++_])}function ae(e,t,n){for(var o,l=e.__k,r=0;l&&r<l.length;r++)(o=l[r])&&(o.__=e,t=typeof o.type=="function"?ae(o,t,n):ue(n,o,o,l,o.__e,t));return t}function z(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){z(n,t)}):t.push(e)),t}function ue(e,t,n,o,l,r){var i,u,f;if(t.__d!==void 0)i=t.__d,t.__d=void 0;else if(n==null||l!=r||l.parentNode==null)e:if(r==null||r.parentNode!==e)e.appendChild(l),i=null;else{for(u=r,f=0;(u=u.nextSibling)&&f<o.length;f+=2)if(u==l)break e;e.insertBefore(l,r),i=r}return i!==void 0?i:l.nextSibling}function ze(e,t,n,o,l){var r;for(r in n)r==="children"||r==="key"||r in t||V(e,r,null,n[r],o);for(r in t)l&&typeof t[r]!="function"||r==="children"||r==="key"||r==="value"||r==="checked"||n[r]===t[r]||V(e,r,t[r],n[r],o)}function fe(e,t,n){t[0]==="-"?e.setProperty(t,n):e[t]=n==null?"":typeof n!="number"||Te.test(t)?n:n+"px"}function V(e,t,n,o,l){var r;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||fe(e.style,t,"");if(n)for(t in n)o&&n[t]===o[t]||fe(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")r=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?o||e.addEventListener(t,r?pe:de,r):e.removeEventListener(t,r?pe:de,r);else if(t!=="dangerouslySetInnerHTML"){if(l)t=t.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if(t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t in e)try{e[t]=n==null?"":n;break e}catch{}typeof n=="function"||(n!=null&&(n!==!1||t[0]==="a"&&t[1]==="r")?e.setAttribute(t,n):e.removeAttribute(t))}}function de(e){this.l[e.type+!1](a.event?a.event(e):e)}function pe(e){this.l[e.type+!0](a.event?a.event(e):e)}function K(e,t,n,o,l,r,i,u,f){var d,_,h,s,c,p,k,b,m,y,w,g=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(f=n.__h,u=t.__e=n.__e,t.__h=null,r=[u]),(d=a.__b)&&d(t);try{e:if(typeof g=="function"){if(b=t.props,m=(d=g.contextType)&&o[d.__c],y=d?m?m.props.value:d.__:o,n.__c?k=(_=t.__c=n.__c).__=_.__E:("prototype"in g&&g.prototype.render?t.__c=_=new g(b,y):(t.__c=_=new $(b,y),_.constructor=g,_.render=Be),m&&m.sub(_),_.props=b,_.state||(_.state={}),_.context=y,_.__n=o,h=_.__d=!0,_.__h=[]),_.__s==null&&(_.__s=_.state),g.getDerivedStateFromProps!=null&&(_.__s==_.state&&(_.__s=C({},_.__s)),C(_.__s,g.getDerivedStateFromProps(b,_.__s))),s=_.props,c=_.state,h)g.getDerivedStateFromProps==null&&_.componentWillMount!=null&&_.componentWillMount(),_.componentDidMount!=null&&_.__h.push(_.componentDidMount);else{if(g.getDerivedStateFromProps==null&&b!==s&&_.componentWillReceiveProps!=null&&_.componentWillReceiveProps(b,y),!_.__e&&_.shouldComponentUpdate!=null&&_.shouldComponentUpdate(b,_.__s,y)===!1||t.__v===n.__v){_.props=b,_.state=_.__s,t.__v!==n.__v&&(_.__d=!1),_.__v=t,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(S){S&&(S.__=t)}),_.__h.length&&i.push(_);break e}_.componentWillUpdate!=null&&_.componentWillUpdate(b,_.__s,y),_.componentDidUpdate!=null&&_.__h.push(function(){_.componentDidUpdate(s,c,p)})}_.context=y,_.props=b,_.state=_.__s,(d=a.__r)&&d(t),_.__d=!1,_.__v=t,_.__P=e,d=_.render(_.props,_.state,_.context),_.state=_.__s,_.getChildContext!=null&&(o=C(C({},o),_.getChildContext())),h||_.getSnapshotBeforeUpdate==null||(p=_.getSnapshotBeforeUpdate(s,c)),w=d!=null&&d.type===O&&d.key==null?d.props.children:d,se(e,Array.isArray(w)?w:[w],t,n,o,l,r,i,u,f),_.base=t.__e,t.__h=null,_.__h.length&&i.push(_),k&&(_.__E=_.__=null),_.__e=!1}else r==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Ve(n.__e,t,n,o,l,r,i,f);(d=a.diffed)&&d(t)}catch(S){t.__v=null,(f||r!=null)&&(t.__e=u,t.__h=!!f,r[r.indexOf(u)]=null),a.__e(S,t,n)}}function he(e,t){a.__c&&a.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(o){o.call(n)})}catch(o){a.__e(o,n.__v)}})}function Ve(e,t,n,o,l,r,i,u){var f,d,_,h=n.props,s=t.props,c=t.type,p=0;if(c==="svg"&&(l=!0),r!=null){for(;p<r.length;p++)if((f=r[p])&&"setAttribute"in f==!!c&&(c?f.localName===c:f.nodeType===3)){e=f,r[p]=null;break}}if(e==null){if(c===null)return document.createTextNode(s);e=l?document.createElementNS("http://www.w3.org/2000/svg",c):document.createElement(c,s.is&&s),r=null,u=!1}if(c===null)h===s||u&&e.data===s||(e.data=s);else{if(r=r&&I.call(e.childNodes),d=(h=n.props||F).dangerouslySetInnerHTML,_=s.dangerouslySetInnerHTML,!u){if(r!=null)for(h={},p=0;p<e.attributes.length;p++)h[e.attributes[p].name]=e.attributes[p].value;(_||d)&&(_&&(d&&_.__html==d.__html||_.__html===e.innerHTML)||(e.innerHTML=_&&_.__html||""))}if(ze(e,s,h,l,u),_)t.__k=[];else if(p=t.props.children,se(e,Array.isArray(p)?p:[p],t,n,o,l&&c!=="foreignObject",r,i,r?r[0]:n.__k&&N(n,0),u),r!=null)for(p=r.length;p--;)r[p]!=null&&le(r[p]);u||("value"in s&&(p=s.value)!==void 0&&(p!==h.value||p!==e.value||c==="progress"&&!p)&&V(e,"value",p,h.value,!1),"checked"in s&&(p=s.checked)!==void 0&&p!==e.checked&&V(e,"checked",p,h.checked,!1))}return e}function ve(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(o){a.__e(o,n)}}function be(e,t,n){var o,l;if(a.unmount&&a.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||ve(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(r){a.__e(r,t)}o.base=o.__P=null}if(o=e.__k)for(l=0;l<o.length;l++)o[l]&&be(o[l],t,typeof e.type!="function");n||e.__e==null||le(e.__e),e.__e=e.__d=void 0}function Be(e,t,n){return this.constructor(e,n)}function me(e,t,n){var o,l,r;a.__&&a.__(e,t),l=(o=typeof n=="function")?null:n&&n.__k||t.__k,r=[],K(t,e=(!o&&n||t).__k=v(O,null,[e]),l||F,F,t.ownerSVGElement!==void 0,!o&&n?[n]:l?null:t.firstChild?I.call(t.childNodes):null,r,!o&&n?n:l?l.__e:t.firstChild,o),he(r,e)}I=_e.slice,a={__e:function(e,t){for(var n,o,l;t=t.__;)if((n=t.__c)&&!n.__)try{if((o=n.constructor)&&o.getDerivedStateFromError!=null&&(n.setState(o.getDerivedStateFromError(e)),l=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e),l=n.__d),l)return n.__E=n}catch(r){e=r}throw e}},ne=0,$.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=C({},this.state),typeof e=="function"&&(e=e(C({},n),this.props)),e&&C(n,e),e!=null&&this.__v&&(t&&this.__h.push(t),ce(this))},$.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ce(this))},$.prototype.render=O,A=[],oe=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,T.__r=0;var qe=`.time-cell{display:flex;flex-flow:column nowrap;align-items:center;font-family:sans-serif;font-weight:700}.time-cell.disabled .time-cell-up:before,.time-cell.disabled .time-cell-down:after{border-top-color:#0000000d;border-bottom-color:#0000000d}.time-cell-up:before,.time-cell-down:after{content:"";display:block;width:0;height:0;margin:0 0 4px;border-top:0;border-left:12px solid transparent;border-right:12px solid transparent;border-bottom:12px solid #151515;transition:border-color .4s;cursor:pointer}.time-cell-down:after{margin:4px 0 0;border-top:12px solid #151515;border-bottom:0}.rotor{position:relative;width:36px;height:64px;border-radius:4px;font-size:48px;text-align:center;perspective:200px}.rotor-top,.rotor-bottom{overflow:hidden;position:absolute;width:36px;height:32px}.rotor-leaf{z-index:1;position:absolute;width:36px;height:64px;transform-style:preserve-3d;transition:transform 0s}.rotor-leaf.flipped{transform:rotateX(-180deg);transition:all .5s ease-in-out}.rotor-leaf-front,.rotor-leaf-rear{overflow:hidden;position:absolute;width:36px;height:32px;margin:0;transform:rotateX(0);backface-visibility:hidden;-webkit-backface-visibility:hidden}.rotor-leaf-front{line-height:64px;border-radius:4px 4px 0 0}.rotor-leaf-rear{line-height:0px;border-radius:0 0 4px 4px;transform:rotateX(-180deg)}.rotor-top{line-height:64px;border-radius:4px 4px 0 0}.rotor-bottom{bottom:0;line-height:0px;border-radius:0 0 4px 4px}.rotor:after{content:"";z-index:2;position:absolute;bottom:0px;left:0px;width:36px;height:32px;border-radius:0 0 4px 4px}.rotor,.rotor-top,.rotor-leaf-front{color:#fff;background-color:#151515}.rotor-bottom,.rotor-leaf-rear{color:#efefef;background-color:#202020}.rotor:after{border-top:solid 1px #151515}.telebox-color-scheme-dark .time-cell.disabled .time-cell-up:before,.telebox-color-scheme-dark .time-cell.disabled .time-cell-down:after{border-top-color:#ffffff14;border-bottom-color:#ffffff14}.telebox-color-scheme-dark .time-cell-up:before,.telebox-color-scheme-dark .time-cell-down:after{border-top-color:#d9d9df;border-bottom-color:#d9d9df}.telebox-color-scheme-dark .rotor,.telebox-color-scheme-dark .rotor-top,.telebox-color-scheme-dark .rotor-leaf-front{color:#383838;background-color:#efeff5}.telebox-color-scheme-dark .rotor-bottom,.telebox-color-scheme-dark .rotor-leaf-rear{color:#333;background-color:#eeecec}.telebox-color-scheme-dark .rotor:after{border-top:solid 1px #efeff5}.countdown-clock{display:flex;padding:5px}.countdown-clock>*{padding:0 5px}.countdown-clock-divider{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:0 1px}.countdown-clock-divider:before,.countdown-clock-divider:after{content:"";display:block;width:8px;height:8px;margin:6px 0;background-color:#000;border-radius:50%}.netless-app-countdown{width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;transition:background-color .4s}.netless-app-countdown-shrink{display:inline-block;transition:background-color .4s}.netless-app-countdown-btns{width:100%;margin-top:10px;display:flex;flex-wrap:nowrap}.netless-app-countdown-btns>button{flex:1;display:block;margin:0 10px 0 0;padding:5px 10px;text-align:center;border:0;border-radius:4px;color:#fff;background-color:#3380ff;transition:background-color .4s,color .4s;cursor:pointer}.netless-app-countdown-btns>button:last-of-type{margin:0}.netless-app-countdown-btns>button:disabled{color:#00000040;background:#f5f5f5;cursor:not-allowed}.telebox-color-scheme-dark .netless-app-countdown-btns>button:disabled{color:#ffffff4d;background:rgba(255,255,255,.08)}
`,B,x,ye,q=0,Q=[],ge=a.__b,ke=a.__r,we=a.diffed,xe=a.__c,Se=a.unmount;function Y(e,t){a.__h&&a.__h(x,e,q||t),q=0;var n=x.__H||(x.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function H(e){return q=1,Ge(Pe,e)}function Ge(e,t,n){var o=Y(B++,2);return o.t=e,o.__c||(o.__=[n?n(t):Pe(void 0,t),function(l){var r=o.t(o.__[0],l);o.__[0]!==r&&(o.__=[r,o.__[1]],o.__c.setState({}))}],o.__c=x),o.__}function E(e,t){var n=Y(B++,3);!a.__s&&Ce(n.__H,t)&&(n.__=e,n.__H=t,x.__H.__h.push(n))}function Me(e,t){var n=Y(B++,7);return Ce(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function R(e,t){return q=8,Me(function(){return e},t)}function Xe(){var e;for(Q.sort(function(t,n){return t.__v.__b-n.__v.__b});e=Q.pop();)if(e.__P)try{e.__H.__h.forEach(G),e.__H.__h.forEach(j),e.__H.__h=[]}catch(t){e.__H.__h=[],a.__e(t,e.__v)}}a.__b=function(e){x=null,ge&&ge(e)},a.__r=function(e){ke&&ke(e),B=0;var t=(x=e.__c).__H;t&&(t.__h.forEach(G),t.__h.forEach(j),t.__h=[])},a.diffed=function(e){we&&we(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(Q.push(t)!==1&&ye===a.requestAnimationFrame||((ye=a.requestAnimationFrame)||function(n){var o,l=function(){clearTimeout(r),$e&&cancelAnimationFrame(o),setTimeout(n)},r=setTimeout(l,100);$e&&(o=requestAnimationFrame(l))})(Xe)),x=null},a.__c=function(e,t){t.some(function(n){try{n.__h.forEach(G),n.__h=n.__h.filter(function(o){return!o.__||j(o)})}catch(o){t.some(function(l){l.__h&&(l.__h=[])}),t=[],a.__e(o,n.__v)}}),xe&&xe(e,t)},a.unmount=function(e){Se&&Se(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(o){try{G(o)}catch(l){t=l}}),t&&a.__e(t,n.__v))};var $e=typeof requestAnimationFrame=="function";function G(e){var t=x,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),x=t}function j(e){var t=x;e.__c=e.__(),x=t}function Ce(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Pe(e,t){return typeof t=="function"?t(e):t}function Ze(e,t){for(var n in t)e[n]=t[n];return e}function ee(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var o in t)if(o!=="__source"&&e[o]!==t[o])return!0;return!1}function Oe(e){this.props=e}function X(e,t){function n(l){var r=this.props.ref,i=r==l.ref;return!i&&r&&(r.call?r(null):r.current=null),t?!t(this.props,l)||!i:ee(this.props,l)}function o(l){return this.shouldComponentUpdate=n,v(e,l)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.prototype.isReactComponent=!0,o.__f=!0,o}(Oe.prototype=new $).isPureReactComponent=!0,Oe.prototype.shouldComponentUpdate=function(e,t){return ee(this.props,e)||ee(this.state,t)};var He=a.__b;a.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),He&&He(e)};var Je=a.__e;a.__e=function(e,t,n){if(e.then){for(var o,l=t;l=l.__;)if((o=l.__c)&&o.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t)}Je(e,t,n)};var Ne=a.unmount;function te(){this.__u=0,this.t=null,this.__b=null}function Ee(e){var t=e.__.__c;return t&&t.__e&&t.__e(e)}function Z(){this.u=null,this.o=null}a.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),Ne&&Ne(e)},(te.prototype=new $).__c=function(e,t){var n=t.__c,o=this;o.t==null&&(o.t=[]),o.t.push(n);var l=Ee(o.__v),r=!1,i=function(){r||(r=!0,n.__R=null,l?l(u):u())};n.__R=i;var u=function(){if(!--o.__u){if(o.state.__e){var d=o.state.__e;o.__v.__k[0]=function h(s,c,p){return s&&(s.__v=null,s.__k=s.__k&&s.__k.map(function(k){return h(k,c,p)}),s.__c&&s.__c.__P===c&&(s.__e&&p.insertBefore(s.__e,s.__d),s.__c.__e=!0,s.__c.__P=p)),s}(d,d.__c.__P,d.__c.__O)}var _;for(o.setState({__e:o.__b=null});_=o.t.pop();)_.forceUpdate()}},f=t.__h===!0;o.__u++||f||o.setState({__e:o.__b=o.__v.__k[0]}),e.then(i,i)},te.prototype.componentWillUnmount=function(){this.t=[]},te.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=function r(i,u,f){return i&&(i.__c&&i.__c.__H&&(i.__c.__H.__.forEach(function(d){typeof d.__c=="function"&&d.__c()}),i.__c.__H=null),(i=Ze({},i)).__c!=null&&(i.__c.__P===f&&(i.__c.__P=u),i.__c=null),i.__k=i.__k&&i.__k.map(function(d){return r(d,u,f)})),i}(this.__b,n,o.__O=o.__P)}this.__b=null}var l=t.__e&&v(O,null,e.fallback);return l&&(l.__h=null),[v(O,null,t.__e?null:e.children),l]};var Re=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};(Z.prototype=new $).__e=function(e){var t=this,n=Ee(t.__v),o=t.o.get(e);return o[0]++,function(l){var r=function(){t.props.revealOrder?(o.push(l),Re(t,e,o)):l()};n?n(r):r()}},Z.prototype.render=function(e){this.u=null,this.o=new Map;var t=z(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},Z.prototype.componentDidUpdate=Z.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){Re(e,n,t)})};var Ke=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,Qe=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ye=typeof document!="undefined",je=function(e){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};$.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty($.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ae=a.event;function et(){}function tt(){return this.cancelBubble}function nt(){return this.defaultPrevented}a.event=function(e){return Ae&&(e=Ae(e)),e.persist=et,e.isPropagationStopped=tt,e.isDefaultPrevented=nt,e.nativeEvent=e};var De={configurable:!0,get:function(){return this.class}},Ue=a.vnode;a.vnode=function(e){var t=e.type,n=e.props,o=n;if(typeof t=="string"){var l=t.indexOf("-")===-1;for(var r in o={},n){var i=n[r];Ye&&r==="children"&&t==="noscript"||r==="value"&&"defaultValue"in n&&i==null||(r==="defaultValue"&&"value"in n&&n.value==null?r="value":r==="download"&&i===!0?i="":/ondoubleclick/i.test(r)?r="ondblclick":/^onchange(textarea|input)/i.test(r+t)&&!je(n.type)?r="oninput":/^onfocus$/i.test(r)?r="onfocusin":/^onblur$/i.test(r)?r="onfocusout":/^on(Ani|Tra|Tou|BeforeInp)/.test(r)?r=r.toLowerCase():l&&Qe.test(r)?r=r.replace(/[A-Z0-9]/,"-$&").toLowerCase():i===null&&(i=void 0),o[r]=i)}t=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=z(n.children).forEach(function(u){u.props.selected=o.value.indexOf(u.props.value)!=-1})),t=="select"&&o.defaultValue!=null&&(o.value=z(n.children).forEach(function(u){u.props.selected=o.multiple?o.defaultValue.indexOf(u.props.value)!=-1:o.defaultValue==u.props.value})),e.props=o,n.class!=n.className&&(De.enumerable="className"in n,n.className!=null&&(o.class=n.className),Object.defineProperty(o,"className",De))}e.$$typeof=Ke,Ue&&Ue(e)};var We=a.__r;a.__r=function(e){We&&We(e)};var Ie={exports:{}};/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o=[],l=0;l<arguments.length;l++){var r=arguments[l];if(!!r){var i=typeof r;if(i==="string"||i==="number")o.push(r);else if(Array.isArray(r)){if(r.length){var u=n.apply(null,r);u&&o.push(u)}}else if(i==="object")if(r.toString===Object.prototype.toString)for(var f in r)t.call(r,f)&&r[f]&&o.push(f);else o.push(r.toString())}}return o.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Ie);var Fe=Ie.exports;const J=X(({digit:e,disabled:t,onUp:n,onDown:o})=>{const[l,r]=H(0),[i,u]=H(!1);return E(()=>{if(t){u(!0);const f=window.setTimeout(()=>{u(!1),r(e)},500);return()=>window.clearTimeout(f)}else r(e)},[e]),v("div",{class:Fe("time-cell",{disabled:t})},v("div",{class:"time-cell-up",onClick:t?void 0:n}),v("div",{class:"rotor"},v("div",{class:Fe("rotor-leaf",{flipped:i})},v("figure",{class:"rotor-leaf-rear"},e),v("figure",{class:"rotor-leaf-front"},l)),v("div",{class:"rotor-top"},e),v("div",{class:"rotor-bottom"},l)),v("div",{class:"time-cell-down",onClick:t?void 0:o}))});var M;(function(e){e[e.AddTenMinutes=0]="AddTenMinutes",e[e.ReduceTenMinutes=1]="ReduceTenMinutes",e[e.AddOneMinute=2]="AddOneMinute",e[e.ReduceOneMinute=3]="ReduceOneMinute",e[e.AddTenSeconds=4]="AddTenSeconds",e[e.ReduceTenSeconds=5]="ReduceTenSeconds",e[e.AddOneSecond=6]="AddOneSecond",e[e.ReduceOneSecond=7]="ReduceOneSecond"})(M||(M={}));function Le(e){return Me(()=>(e=e%61,[Math.floor(e/10),e%10]),[e])}function P(e,t){return R(()=>e(t),[e])}const ot=X(({minutes:e,seconds:t,disabled:n,onAdjustTime:o})=>{const l=Le(e),r=Le(t),i=P(o,0),u=P(o,1),f=P(o,2),d=P(o,3),_=P(o,4),h=P(o,5),s=P(o,6),c=P(o,7);return v("div",{className:"countdown-clock"},v(J,{disabled:n,digit:l[0],onUp:i,onDown:u}),v(J,{digit:l[1],disabled:n,onUp:f,onDown:d}),v("div",{class:"countdown-clock-divider"}),v(J,{disabled:n,digit:r[0],onUp:_,onDown:h}),v(J,{digit:r[1],disabled:n,onUp:s,onDown:c}))}),rt=X(({readonly:e,countdownSecs:t,startTime:n,paused:o,onAdjustTime:l,onStart:r,onPause:i,onResume:u,onReset:f})=>{const[d,_]=H(0),h=n>0&&d>=n,s=t-(h?d-n:0),c=Math.floor(s/60),p=s-c*60;return E(()=>{let k=NaN;if(t>0&&n>0&&!o){const b=()=>{_(Math.floor(Date.now()/1e3)),k=window.requestAnimationFrame(b)};return b(),()=>window.cancelAnimationFrame(k)}else window.cancelAnimationFrame(k)},[n,o,t]),E(()=>{n>0&&d-n>=t&&f()},[d,n,t,f]),v("div",{class:"netless-app-countdown"},v("div",{class:"netless-app-countdown-shrink"},v(ot,{minutes:c,seconds:p,disabled:e||h,onAdjustTime:l}),v("div",{class:"netless-app-countdown-btns"},o?v(O,null,v("button",{onClick:f,disabled:e},"Reset"),v("button",{onClick:u,disabled:e},"Resume")):h?v("button",{onClick:i,disabled:e},"Pause"):v("button",{onClick:r,disabled:e||s<=0},"Start"))))}),_t=X(({context:e,storage:t})=>{const[n,o]=H(()=>e.getIsWritable()),[l,r]=H(0),[i,u]=H(0),[f,d]=H(!1),_=i>0,h=R(()=>{e.getIsWritable()&&(d(!1),u(Math.floor(Date.now()/1e3)))},[e]),s=R(()=>{e.getIsWritable()&&d(!0)},[e]),c=R(()=>{e.getIsWritable()&&d(!1)},[e]),p=R(()=>{e.getIsWritable()&&(d(!1),r(0),u(0))},[e]),k=R(b=>{_||r(m=>{if(!e.getIsWritable())return m;const y=Math.floor(m/60),w=m-y*60,g=Math.floor(y/10),S=y%10,D=Math.floor(w/10),U=w%10;switch(b){case M.AddTenMinutes:{const W=S+w===0?7:6;return((g+1)%W*10+S)*60+w}case M.ReduceTenMinutes:{const W=S+w===0?7:6;return((g+W-1)%W*10+S)*60+w}case M.AddOneMinute:return(Math.min(5,g)*10+(S+1)%10)*60+w;case M.ReduceOneMinute:return(Math.min(5,g)*10+(S+10-1)%10)*60+w;case M.AddTenSeconds:return y*60+((D+1)%6*10+U);case M.ReduceTenSeconds:return y*60+((D+6-1)%6*10+U);case M.AddOneSecond:return y*60+(Math.min(5,D)*10+(U+1)%10);case M.ReduceOneSecond:return y*60+(Math.min(5,D)*10+(U+10-1)%10);default:return m}})},[_,e]);return E(()=>(o(e.getIsWritable()),e.emitter.on("writableChange",o),()=>e.emitter.off("writableChange",o)),[e]),E(()=>{const b=m=>{m.countdownSecs&&r(t.state.countdownSecs),m.paused&&d(t.state.paused),m.startTime&&u(t.state.startTime)};return t.onStateChanged.addListener(b),()=>t.onStateChanged.removeListener(b)},[t]),E(()=>{e.getIsWritable()&&t.setState({countdownSecs:l,paused:f,startTime:i})},[l,f,i,e]),v(rt,{readonly:!n,countdownSecs:l,startTime:i,paused:f,onAdjustTime:k,onStart:h,onPause:s,onResume:c,onReset:p})}),lt=208,it=216,ct={kind:"Countdown",config:{minwidth:lt,minheight:it},setup(e){const t=e.getBox();t.mountStyles(qe);const n=e.createStorage("state",{countdownSecs:0,startTime:0,paused:!1});me(v(_t,{context:e,storage:n}),t.$content),e.emitter.on("destroy",()=>{me(null,t.$content)})}};exports.default=ct;
//# sourceMappingURL=main.cjs.js.map

@@ -1,17 +0,1 @@

var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a2, b2) => {
for (var prop in b2 || (b2 = {}))
if (__hasOwnProp.call(b2, prop))
__defNormalProp(a2, prop, b2[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b2)) {
if (__propIsEnum.call(b2, prop))
__defNormalProp(a2, prop, b2[prop]);
}
return a2;
};
var n, l$1, u$1, t$1, r$1, o$1, e$1 = {}, c$1 = [], s = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;

@@ -40,3 +24,3 @@ function a$1(n2, l2) {

}
function d(n2) {
function d$1(n2) {
return n2.children;

@@ -67,6 +51,6 @@ }

function m$1(n2) {
(!n2.__d && (n2.__d = true) && t$1.push(n2) && !g$1.__r++ || o$1 !== l$1.debounceRendering) && ((o$1 = l$1.debounceRendering) || r$1)(g$1);
(!n2.__d && (n2.__d = true) && t$1.push(n2) && !g$2.__r++ || o$1 !== l$1.debounceRendering) && ((o$1 = l$1.debounceRendering) || r$1)(g$2);
}
function g$1() {
for (var n2; g$1.__r = t$1.length; )
function g$2() {
for (var n2; g$2.__r = t$1.length; )
n2 = t$1.sort(function(n3, l2) {

@@ -82,3 +66,3 @@ return n3.__v.__b - l2.__v.__b;

for (u2.__k = [], h2 = 0; h2 < l2.length; h2++)
if ((_2 = u2.__k[h2] = (_2 = l2[h2]) == null || typeof _2 == "boolean" ? null : typeof _2 == "string" || typeof _2 == "number" || typeof _2 == "bigint" ? y$1(null, _2, null, null, _2) : Array.isArray(_2) ? y$1(d, { children: _2 }, null, null, null) : _2.__b > 0 ? y$1(_2.type, _2.props, _2.key, null, _2.__v) : _2) != null) {
if ((_2 = u2.__k[h2] = (_2 = l2[h2]) == null || typeof _2 == "boolean" ? null : typeof _2 == "string" || typeof _2 == "number" || typeof _2 == "bigint" ? y$1(null, _2, null, null, _2) : Array.isArray(_2) ? y$1(d$1, { children: _2 }, null, null, null) : _2.__b > 0 ? y$1(_2.type, _2.props, _2.key, null, _2.__v) : _2) != null) {
if (_2.__ = u2, _2.__b = u2.__b + 1, (p2 = w2[h2]) === null || p2 && _2.key == p2.key && _2.type === p2.type)

@@ -107,5 +91,5 @@ w2[h2] = void 0;

}
function A$1(n2, l2) {
function A$2(n2, l2) {
return l2 = l2 || [], n2 == null || typeof n2 == "boolean" || (Array.isArray(n2) ? n2.some(function(n3) {
A$1(n3, l2);
A$2(n3, l2);
}) : l2.push(n2)), l2;

@@ -132,10 +116,10 @@ }

for (r2 in u2)
r2 === "children" || r2 === "key" || r2 in l2 || H(n2, r2, null, u2[r2], i2);
r2 === "children" || r2 === "key" || r2 in l2 || H$1(n2, r2, null, u2[r2], i2);
for (r2 in l2)
t2 && typeof l2[r2] != "function" || r2 === "children" || r2 === "key" || r2 === "value" || r2 === "checked" || u2[r2] === l2[r2] || H(n2, r2, l2[r2], u2[r2], i2);
t2 && typeof l2[r2] != "function" || r2 === "children" || r2 === "key" || r2 === "value" || r2 === "checked" || u2[r2] === l2[r2] || H$1(n2, r2, l2[r2], u2[r2], i2);
}
function $$1(n2, l2, u2) {
function $(n2, l2, u2) {
l2[0] === "-" ? n2.setProperty(l2, u2) : n2[l2] = u2 == null ? "" : typeof u2 != "number" || s.test(l2) ? u2 : u2 + "px";
}
function H(n2, l2, u2, i2, t2) {
function H$1(n2, l2, u2, i2, t2) {
var r2;

@@ -149,6 +133,6 @@ n:

for (l2 in i2)
u2 && l2 in u2 || $$1(n2.style, l2, "");
u2 && l2 in u2 || $(n2.style, l2, "");
if (u2)
for (l2 in u2)
i2 && u2[l2] === i2[l2] || $$1(n2.style, l2, u2[l2]);
i2 && u2[l2] === i2[l2] || $(n2.style, l2, u2[l2]);
}

@@ -196,3 +180,3 @@ else if (l2[0] === "o" && l2[1] === "n")

}
h2.context = x2, h2.props = m2, h2.state = h2.__s, (s2 = l$1.__r) && s2(u2), h2.__d = false, h2.__v = u2, h2.__P = n2, s2 = h2.render(h2.props, h2.state, h2.context), h2.state = h2.__s, h2.getChildContext != null && (t2 = a$1(a$1({}, t2), h2.getChildContext())), v2 || h2.getSnapshotBeforeUpdate == null || (k2 = h2.getSnapshotBeforeUpdate(y2, p2)), A2 = s2 != null && s2.type === d && s2.key == null ? s2.props.children : s2, w$2(n2, Array.isArray(A2) ? A2 : [A2], u2, i2, t2, r2, o2, f2, e2, c2), h2.base = u2.__e, u2.__h = null, h2.__h.length && f2.push(h2), b2 && (h2.__E = h2.__ = null), h2.__e = false;
h2.context = x2, h2.props = m2, h2.state = h2.__s, (s2 = l$1.__r) && s2(u2), h2.__d = false, h2.__v = u2, h2.__P = n2, s2 = h2.render(h2.props, h2.state, h2.context), h2.state = h2.__s, h2.getChildContext != null && (t2 = a$1(a$1({}, t2), h2.getChildContext())), v2 || h2.getSnapshotBeforeUpdate == null || (k2 = h2.getSnapshotBeforeUpdate(y2, p2)), A2 = s2 != null && s2.type === d$1 && s2.key == null ? s2.props.children : s2, w$2(n2, Array.isArray(A2) ? A2 : [A2], u2, i2, t2, r2, o2, f2, e2, c2), h2.base = u2.__e, u2.__h = null, h2.__h.length && f2.push(h2), b2 && (h2.__E = h2.__ = null), h2.__e = false;
} else

@@ -220,3 +204,3 @@ o2 == null && u2.__v === i2.__v ? (u2.__k = i2.__k, u2.__e = i2.__e) : u2.__e = L$1(i2.__e, u2, i2, t2, r2, o2, f2, c2);

for (; _2 < o2.length; _2++)
if ((s2 = o2[_2]) && (s2 === l2 || (d2 ? s2.localName == d2 : s2.nodeType == 3))) {
if ((s2 = o2[_2]) && "setAttribute" in s2 == !!d2 && (d2 ? s2.localName === d2 : s2.nodeType === 3)) {
l2 = s2, o2[_2] = null;

@@ -245,3 +229,3 @@ break;

o2[_2] != null && h(o2[_2]);
c2 || ("value" in p2 && (_2 = p2.value) !== void 0 && (_2 !== l2.value || d2 === "progress" && !_2) && H(l2, "value", _2, y2.value, false), "checked" in p2 && (_2 = p2.checked) !== void 0 && _2 !== l2.checked && H(l2, "checked", _2, y2.checked, false));
c2 || ("value" in p2 && (_2 = p2.value) !== void 0 && (_2 !== y2.value || _2 !== l2.value || d2 === "progress" && !_2) && H$1(l2, "value", _2, y2.value, false), "checked" in p2 && (_2 = p2.checked) !== void 0 && _2 !== l2.checked && H$1(l2, "checked", _2, y2.checked, false));
}

@@ -278,3 +262,3 @@ return l2;

var r2, o2, f2;
l$1.__ && l$1.__(u2, i2), o2 = (r2 = typeof t2 == "function") ? null : t2 && t2.__k || i2.__k, f2 = [], j$2(i2, u2 = (!r2 && t2 || i2).__k = v$1(d, null, [u2]), o2 || e$1, e$1, i2.ownerSVGElement !== void 0, !r2 && t2 ? [t2] : o2 ? null : i2.firstChild ? n.call(i2.childNodes) : null, f2, !r2 && t2 ? t2 : o2 ? o2.__e : i2.firstChild, r2), z$1(f2, u2);
l$1.__ && l$1.__(u2, i2), o2 = (r2 = typeof t2 == "function") ? null : t2 && t2.__k || i2.__k, f2 = [], j$2(i2, u2 = (!r2 && t2 || i2).__k = v$1(d$1, null, [u2]), o2 || e$1, e$1, i2.ownerSVGElement !== void 0, !r2 && t2 ? [t2] : o2 ? null : i2.firstChild ? n.call(i2.childNodes) : null, f2, !r2 && t2 ? t2 : o2 ? o2.__e : i2.firstChild, r2), z$1(f2, u2);
}

@@ -296,3 +280,4 @@ n = c$1.slice, l$1 = { __e: function(n2, l2) {

this.__v && (this.__e = true, n2 && this.__h.push(n2), m$1(this));
}, _.prototype.render = d, t$1 = [], r$1 = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, g$1.__r = 0;
}, _.prototype.render = d$1, t$1 = [], r$1 = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, g$2.__r = 0;
var styles = '.time-cell{display:flex;flex-flow:column nowrap;align-items:center;font-family:sans-serif;font-weight:700}.time-cell.disabled .time-cell-up:before,.time-cell.disabled .time-cell-down:after{border-top-color:#0000000d;border-bottom-color:#0000000d}.time-cell-up:before,.time-cell-down:after{content:"";display:block;width:0;height:0;margin:0 0 4px;border-top:0;border-left:12px solid transparent;border-right:12px solid transparent;border-bottom:12px solid #151515;transition:border-color .4s;cursor:pointer}.time-cell-down:after{margin:4px 0 0;border-top:12px solid #151515;border-bottom:0}.rotor{position:relative;width:36px;height:64px;border-radius:4px;font-size:48px;text-align:center;perspective:200px}.rotor-top,.rotor-bottom{overflow:hidden;position:absolute;width:36px;height:32px}.rotor-leaf{z-index:1;position:absolute;width:36px;height:64px;transform-style:preserve-3d;transition:transform 0s}.rotor-leaf.flipped{transform:rotateX(-180deg);transition:all .5s ease-in-out}.rotor-leaf-front,.rotor-leaf-rear{overflow:hidden;position:absolute;width:36px;height:32px;margin:0;transform:rotateX(0);backface-visibility:hidden;-webkit-backface-visibility:hidden}.rotor-leaf-front{line-height:64px;border-radius:4px 4px 0 0}.rotor-leaf-rear{line-height:0px;border-radius:0 0 4px 4px;transform:rotateX(-180deg)}.rotor-top{line-height:64px;border-radius:4px 4px 0 0}.rotor-bottom{bottom:0;line-height:0px;border-radius:0 0 4px 4px}.rotor:after{content:"";z-index:2;position:absolute;bottom:0px;left:0px;width:36px;height:32px;border-radius:0 0 4px 4px}.rotor,.rotor-top,.rotor-leaf-front{color:#fff;background-color:#151515}.rotor-bottom,.rotor-leaf-rear{color:#efefef;background-color:#202020}.rotor:after{border-top:solid 1px #151515}.telebox-color-scheme-dark .time-cell.disabled .time-cell-up:before,.telebox-color-scheme-dark .time-cell.disabled .time-cell-down:after{border-top-color:#ffffff14;border-bottom-color:#ffffff14}.telebox-color-scheme-dark .time-cell-up:before,.telebox-color-scheme-dark .time-cell-down:after{border-top-color:#d9d9df;border-bottom-color:#d9d9df}.telebox-color-scheme-dark .rotor,.telebox-color-scheme-dark .rotor-top,.telebox-color-scheme-dark .rotor-leaf-front{color:#383838;background-color:#efeff5}.telebox-color-scheme-dark .rotor-bottom,.telebox-color-scheme-dark .rotor-leaf-rear{color:#333;background-color:#eeecec}.telebox-color-scheme-dark .rotor:after{border-top:solid 1px #efeff5}.countdown-clock{display:flex;padding:5px}.countdown-clock>*{padding:0 5px}.countdown-clock-divider{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:0 1px}.countdown-clock-divider:before,.countdown-clock-divider:after{content:"";display:block;width:8px;height:8px;margin:6px 0;background-color:#000;border-radius:50%}.netless-app-countdown{width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;transition:background-color .4s}.netless-app-countdown-shrink{display:inline-block;transition:background-color .4s}.netless-app-countdown-btns{width:100%;margin-top:10px;display:flex;flex-wrap:nowrap}.netless-app-countdown-btns>button{flex:1;display:block;margin:0 10px 0 0;padding:5px 10px;text-align:center;border:0;border-radius:4px;color:#fff;background-color:#3380ff;transition:background-color .4s,color .4s;cursor:pointer}.netless-app-countdown-btns>button:last-of-type{margin:0}.netless-app-countdown-btns>button:disabled{color:#00000040;background:#f5f5f5;cursor:not-allowed}.telebox-color-scheme-dark .netless-app-countdown-btns>button:disabled{color:#ffffff4d;background:rgba(255,255,255,.08)}\n';
var t, u, r, o = 0, i = [], c = l$1.__b, f = l$1.__r, e = l$1.diffed, a = l$1.__c, v = l$1.unmount;

@@ -318,11 +303,22 @@ function m(t2, r2) {

}
function d(n2, u2) {
var r2 = m(t++, 7);
return k(r2.__H, u2) && (r2.__ = n2(), r2.__H = u2, r2.__h = n2), r2.__;
}
function A$1(n2, t2) {
return o = 8, d(function() {
return n2;
}, t2);
}
function x() {
i.forEach(function(t2) {
var t2;
for (i.sort(function(n2, t3) {
return n2.__v.__b - t3.__v.__b;
}); t2 = i.pop(); )
if (t2.__P)
try {
t2.__H.__h.forEach(g), t2.__H.__h.forEach(j$1), t2.__H.__h = [];
t2.__H.__h.forEach(g$1), t2.__H.__h.forEach(j$1), t2.__H.__h = [];
} catch (u2) {
t2.__H.__h = [], l$1.__e(u2, t2.__v);
}
}), i = [];
}

@@ -334,3 +330,3 @@ l$1.__b = function(n2) {

var r2 = (u = n2.__c).__H;
r2 && (r2.__h.forEach(g), r2.__h.forEach(j$1), r2.__h = []);
r2 && (r2.__h.forEach(g$1), r2.__h.forEach(j$1), r2.__h = []);
}, l$1.diffed = function(t2) {

@@ -348,3 +344,3 @@ e && e(t2);

try {
t3.__h.forEach(g), t3.__h = t3.__h.filter(function(n2) {
t3.__h.forEach(g$1), t3.__h = t3.__h.filter(function(n2) {
return !n2.__ || j$1(n2);

@@ -360,14 +356,15 @@ });

v && v(t2);
var u2 = t2.__c;
if (u2 && u2.__H)
var u2, r2 = t2.__c;
r2 && r2.__H && (r2.__H.__.forEach(function(n2) {
try {
u2.__H.__.forEach(g);
} catch (t3) {
l$1.__e(t3, u2.__v);
g$1(n2);
} catch (n3) {
u2 = n3;
}
}), u2 && l$1.__e(u2, r2.__v));
};
var b = typeof requestAnimationFrame == "function";
function g(n2) {
var t2 = u;
typeof n2.__c == "function" && n2.__c(), u = t2;
function g$1(n2) {
var t2 = u, r2 = n2.__c;
typeof r2 == "function" && (n2.__c = void 0, r2()), u = t2;
}

@@ -403,2 +400,12 @@ function j$1(n2) {

}
function g(n2, t2) {
function e2(n3) {
var e3 = this.props.ref, r3 = e3 == n3.ref;
return !r3 && e3 && (e3.call ? e3(null) : e3.current = null), t2 ? !t2(this.props, n3) || !r3 : C(this.props, n3);
}
function r2(t3) {
return this.shouldComponentUpdate = e2, v$1(n2, t3);
}
return r2.displayName = "Memo(" + (n2.displayName || n2.name) + ")", r2.prototype.isReactComponent = true, r2.__f = true, r2;
}
(E.prototype = new _()).isPureReactComponent = true, E.prototype.shouldComponentUpdate = function(n2, t2) {

@@ -473,4 +480,4 @@ return C(this.props, n2) || C(this.state, t2);

}
var u2 = t2.__e && v$1(d, null, n2.fallback);
return u2 && (u2.__h = null), [v$1(d, null, t2.__e ? null : n2.children), u2];
var u2 = t2.__e && v$1(d$1, null, n2.fallback);
return u2 && (u2.__h = null), [v$1(d$1, null, t2.__e ? null : n2.children), u2];
};

@@ -497,3 +504,3 @@ var T = function(n2, t2, e2) {

this.u = null, this.o = new Map();
var t2 = A$1(n2.children);
var t2 = A$2(n2.children);
n2.revealOrder && n2.revealOrder[0] === "b" && t2.reverse();

@@ -519,6 +526,6 @@ for (var e2 = t2.length; e2--; )

});
var Z = l$1.event;
var H = l$1.event;
function Z() {
}
function Y() {
}
function $() {
return this.cancelBubble;

@@ -530,3 +537,3 @@ }

l$1.event = function(n2) {
return Z && (n2 = Z(n2)), n2.persist = Y, n2.isPropagationStopped = $, n2.isDefaultPrevented = q, n2.nativeEvent = n2;
return H && (n2 = H(n2)), n2.persist = Z, n2.isPropagationStopped = Y, n2.isDefaultPrevented = q, n2.nativeEvent = n2;
};

@@ -542,11 +549,11 @@ var J = { configurable: true, get: function() {

var i2 = e2[o2];
V && o2 === "children" && t2 === "noscript" || o2 === "value" && "defaultValue" in e2 && i2 == null || (o2 === "defaultValue" && "value" in e2 && e2.value == null ? o2 = "value" : o2 === "download" && i2 === true ? i2 = "" : /ondoubleclick/i.test(o2) ? o2 = "ondblclick" : /^onchange(textarea|input)/i.test(o2 + t2) && !z(e2.type) ? o2 = "oninput" : /^on(Ani|Tra|Tou|BeforeInp)/.test(o2) ? o2 = o2.toLowerCase() : u2 && P.test(o2) ? o2 = o2.replace(/[A-Z0-9]/, "-$&").toLowerCase() : i2 === null && (i2 = void 0), r2[o2] = i2);
V && o2 === "children" && t2 === "noscript" || o2 === "value" && "defaultValue" in e2 && i2 == null || (o2 === "defaultValue" && "value" in e2 && e2.value == null ? o2 = "value" : o2 === "download" && i2 === true ? i2 = "" : /ondoubleclick/i.test(o2) ? o2 = "ondblclick" : /^onchange(textarea|input)/i.test(o2 + t2) && !z(e2.type) ? o2 = "oninput" : /^onfocus$/i.test(o2) ? o2 = "onfocusin" : /^onblur$/i.test(o2) ? o2 = "onfocusout" : /^on(Ani|Tra|Tou|BeforeInp)/.test(o2) ? o2 = o2.toLowerCase() : u2 && P.test(o2) ? o2 = o2.replace(/[A-Z0-9]/, "-$&").toLowerCase() : i2 === null && (i2 = void 0), r2[o2] = i2);
}
t2 == "select" && r2.multiple && Array.isArray(r2.value) && (r2.value = A$1(e2.children).forEach(function(n3) {
t2 == "select" && r2.multiple && Array.isArray(r2.value) && (r2.value = A$2(e2.children).forEach(function(n3) {
n3.props.selected = r2.value.indexOf(n3.props.value) != -1;
})), t2 == "select" && r2.defaultValue != null && (r2.value = A$1(e2.children).forEach(function(n3) {
})), t2 == "select" && r2.defaultValue != null && (r2.value = A$2(e2.children).forEach(function(n3) {
n3.props.selected = r2.multiple ? r2.defaultValue.indexOf(n3.props.value) != -1 : r2.defaultValue == n3.props.value;
})), n2.props = r2;
})), n2.props = r2, e2.class != e2.className && (J.enumerable = "className" in e2, e2.className != null && (r2.class = e2.className), Object.defineProperty(r2, "className", J));
}
t2 && e2.class != e2.className && (J.enumerable = "className" in e2, e2.className != null && (r2.class = e2.className), Object.defineProperty(r2, "className", J)), n2.$$typeof = j, K && K(n2);
n2.$$typeof = j, K && K(n2);
};

@@ -557,219 +564,70 @@ var Q = l$1.__r;

};
class Controller extends _ {
constructor(props) {
super(props);
this.raf = 0;
this.start = () => {
const { context, room } = this.props;
const { start, pause, total } = this.attributes.state;
const now = room.calibrationTimestamp;
if (pause) {
context.updateAttributes(["state"], { start: now - (pause - start), pause: 0, total });
} else {
context.updateAttributes(["state", "pause"], now);
}
};
this.reset = () => {
const { context } = this.props;
context.updateAttributes(["state"], { start: 0, pause: 0, total: 0 });
this.setState({ isDone: false });
};
this.init = (total) => {
const { context, room } = this.props;
context.updateAttributes(["state"], {
start: room.calibrationTimestamp,
pause: 0,
total: total || 0
});
};
this.update = () => {
this.raf = requestAnimationFrame(this.update);
const { context, room } = this.props;
this.attributes = context.getAttributes();
const { start, pause, total } = this.attributes.state;
const isInit = start === 0;
const stopped = isInit || pause !== 0;
let seconds = 0;
if (start) {
if (pause) {
seconds = (pause - start) / 1e3 | 0;
} else {
seconds = (room.calibrationTimestamp - start) / 1e3 | 0;
var style = "";
var classnames = { exports: {} };
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
(function(module) {
(function() {
var hasOwn = {}.hasOwnProperty;
function classNames2() {
var classes = [];
for (var i2 = 0; i2 < arguments.length; i2++) {
var arg = arguments[i2];
if (!arg)
continue;
var argType = typeof arg;
if (argType === "string" || argType === "number") {
classes.push(arg);
} else if (Array.isArray(arg)) {
if (arg.length) {
var inner = classNames2.apply(null, arg);
if (inner) {
classes.push(inner);
}
}
} else if (argType === "object") {
if (arg.toString === Object.prototype.toString) {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
} else {
classes.push(arg.toString());
}
}
}
if (total) {
if (seconds > total) {
!pause && this.start();
this.setState({ isDone: true });
}
seconds = Math.max(total - seconds, 0);
}
this.setState({ isInit, stopped, seconds });
};
this.raf = requestAnimationFrame(this.update);
this.attributes = props.context.getAttributes();
this.state = {
isInit: true,
isDone: false,
seconds: 0,
stopped: true,
start: this.start,
reset: this.reset,
init: this.init
};
}
componentWillUnmount() {
console.log("[Countdown]: unmount");
cancelAnimationFrame(this.raf);
}
render() {
return /* @__PURE__ */ v$1(FlipCountDown, __spreadValues({}, this.state));
}
}
class FlipCountDown extends E {
constructor(props) {
super(props);
this.correctValueFormat = (value) => {
return { left: Math.floor(value / 10), right: value % 10 };
};
this.transformTime = () => {
if (this.props.isInit) {
const { total } = this.state;
return {
minutes_left: total[0],
minutes_right: total[1],
seconds_left: total[2],
seconds_right: total[3]
};
}
const current = this.props.seconds;
const minutes = Math.floor(current % (60 * 60) / 60);
const seconds = Math.floor(current % 60);
const m2 = this.correctValueFormat(minutes);
const s2 = this.correctValueFormat(seconds);
return {
minutes_left: m2.left,
minutes_right: m2.right,
seconds_left: s2.left,
seconds_right: s2.right
};
};
this.handleInit = () => {
const [a2, b2, c2, d2] = this.state.total;
this.props.init((a2 * 10 + b2) * 60 + (c2 * 10 + d2));
};
this.handleReset = () => {
this.props.reset();
this.setState({ total: [0, 0, 0, 0] });
};
this.handleInc = (index) => () => {
const nextTotal = this.state.total.map((e2, i2) => i2 === index ? (e2 + 1) % 10 : e2);
if (index === 2 && nextTotal[index] > 5) {
nextTotal[index] = 0;
}
this.setState({ total: nextTotal });
};
this.incMinutesLeft = this.handleInc(0);
this.incMinutesRight = this.handleInc(1);
this.incSecondsLeft = this.handleInc(2);
this.incSecondsRight = this.handleInc(3);
this.handleDec = (index) => () => {
const nextTotal = this.state.total.map((e2, i2) => i2 === index ? (e2 + 9) % 10 : e2);
if (index === 2 && nextTotal[index] > 5) {
nextTotal[index] = 5;
}
this.setState({ total: nextTotal });
};
this.decMinutesLeft = this.handleDec(0);
this.decMinutesRight = this.handleDec(1);
this.decSecondsLeft = this.handleDec(2);
this.decSecondsRight = this.handleDec(3);
this.state = {
total: [0, 0, 0, 0]
};
}
render() {
const { isInit, isDone, stopped, start } = this.props;
const { seconds_left, seconds_right, minutes_right, minutes_left } = this.transformTime();
const className = isDone ? "flipdown flipdown__theme-light" : "flipdown flipdown__theme-dark";
return /* @__PURE__ */ v$1("div", {
class: "flipdown-box"
}, !isInit && /* @__PURE__ */ v$1("div", {
class: "flipdown-mask"
}, stopped ? /* @__PURE__ */ v$1("div", {
class: "flipdown-mask-mid"
}, /* @__PURE__ */ v$1("button", {
onClick: this.handleReset,
class: "flipdown-mask-btn"
}, "\u91CD\u7F6E"), !isDone && /* @__PURE__ */ v$1("button", {
onClick: start,
class: "flipdown-mask-btn"
}, "\u7EE7\u7EED")) : /* @__PURE__ */ v$1("div", {
class: "flipdown-mask-mid"
}, /* @__PURE__ */ v$1("button", {
onClick: start,
class: "flipdown-mask-btn"
}, "\u6682\u505C"))), /* @__PURE__ */ v$1("div", {
class: className
}, /* @__PURE__ */ v$1("div", {
class: "flipdown-mid-box"
}, /* @__PURE__ */ v$1(TimeCell, {
style: { marginRight: 8 },
disabled: !isInit,
time: minutes_left,
onUp: this.incMinutesLeft,
onDown: this.decMinutesLeft
}), /* @__PURE__ */ v$1(TimeCell, {
time: minutes_right,
disabled: !isInit,
onUp: this.incMinutesRight,
onDown: this.decMinutesRight
})), /* @__PURE__ */ v$1("div", {
class: "flipdown-point-box"
}, /* @__PURE__ */ v$1("div", {
style: "margin-bottom: 12px"
}), /* @__PURE__ */ v$1("div", null)), /* @__PURE__ */ v$1("div", {
class: "flipdown-mid-box"
}, /* @__PURE__ */ v$1(TimeCell, {
style: { marginRight: 8 },
disabled: !isInit,
time: seconds_left,
onUp: this.incSecondsLeft,
onDown: this.decSecondsLeft
}), /* @__PURE__ */ v$1(TimeCell, {
time: seconds_right,
disabled: !isInit,
onUp: this.incSecondsRight,
onDown: this.decSecondsRight
}))), isInit && /* @__PURE__ */ v$1("div", {
class: "flipdown-buttons"
}, /* @__PURE__ */ v$1("button", {
onClick: this.handleInit,
class: "flipdown-button"
}, "\u5F00\u59CB")));
}
}
const TimeCell = ({ time, style, disabled, onUp, onDown }) => {
const [flipdown, setFlipDown] = l("rotor-leaf");
const [oldTime, setOldTime] = l(0);
const [shift, setShift] = l(0);
return classes.join(" ");
}
if (module.exports) {
classNames2.default = classNames2;
module.exports = classNames2;
} else {
window.classNames = classNames2;
}
})();
})(classnames);
var classNames = classnames.exports;
const TimeCell = g(({ digit, disabled, onUp, onDown }) => {
const [oldDigit, setOldDigit] = l(0);
const [flipped, setFlipped] = l(false);
y(() => {
if (disabled || shift) {
setShift(1);
setFlipDown("rotor-leaf flipped");
setTimeout(() => {
setFlipDown("rotor-leaf");
setOldTime(time);
if (disabled) {
setFlipped(true);
const timeout = window.setTimeout(() => {
setFlipped(false);
setOldDigit(digit);
}, 500);
!disabled && setShift(0);
return () => window.clearTimeout(timeout);
} else {
setOldTime(time);
setOldDigit(digit);
}
}, [time, disabled]);
const className = disabled ? "flipdown-digit disabled" : "flipdown-digit";
}, [digit]);
return /* @__PURE__ */ v$1("div", {
class: className,
style
class: classNames("time-cell", { disabled })
}, /* @__PURE__ */ v$1("div", {
class: "flipdown-up",
class: "time-cell-up",
onClick: disabled ? void 0 : onUp

@@ -779,18 +637,244 @@ }), /* @__PURE__ */ v$1("div", {

}, /* @__PURE__ */ v$1("div", {
class: flipdown
class: classNames("rotor-leaf", { flipped })
}, /* @__PURE__ */ v$1("figure", {
class: "rotor-leaf-rear"
}, time), /* @__PURE__ */ v$1("figure", {
}, digit), /* @__PURE__ */ v$1("figure", {
class: "rotor-leaf-front"
}, oldTime)), /* @__PURE__ */ v$1("div", {
}, oldDigit)), /* @__PURE__ */ v$1("div", {
class: "rotor-top"
}, time), /* @__PURE__ */ v$1("div", {
}, digit), /* @__PURE__ */ v$1("div", {
class: "rotor-bottom"
}, oldTime)), /* @__PURE__ */ v$1("div", {
class: "flipdown-down",
}, oldDigit)), /* @__PURE__ */ v$1("div", {
class: "time-cell-down",
onClick: disabled ? void 0 : onDown
}));
};
var styles = '.netless-app-flipdown-container{height:100%}.flipdown-box{height:100%;position:relative;display:flex;flex-flow:column nowrap;align-items:center;justify-content:center}.flipdown-mask{width:100%;height:100%;position:absolute;z-index:2;background-color:#0000004d;display:flex;justify-items:center;align-items:center;flex-direction:row;opacity:0}.flipdown-mask:hover{opacity:1}.flipdown-mask-btn{width:90px;height:28px;background-color:#3380ff;margin-left:auto;margin-right:auto;border:0;border-radius:4px;display:flex;align-items:center;justify-content:center;color:#fff;cursor:pointer}.flipdown-mask-mid{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.flipdown-buttons{display:flex;flex-flow:column nowrap;gap:4px;padding-bottom:20px}.flipdown-button{width:180px;height:36px;border:0;background-color:#3380ff;margin-left:auto;margin-right:auto;border-radius:4px;display:flex;align-items:center;justify-content:center;color:#fff;cursor:pointer}.flipdown{display:flex;flex-direction:row;align-items:center;justify-content:center;transform-origin:center}.flipdown-digit{display:flex;flex-flow:column nowrap;align-items:center}.flipdown-digit.disabled .flipdown-up:before,.flipdown-digit.disabled .flipdown-down:after{border-top-color:#0000000d;border-bottom-color:#0000000d}.flipdown-up:before,.flipdown-down:after{content:"";display:inline-block;width:0;height:0;border-top:0;border-left:12px solid transparent;border-right:12px solid transparent;border-bottom:12px solid #151515;cursor:pointer}.flipdown-down:after{border-top:12px solid #151515;border-bottom:0}.flipdown-mid-box{display:flex;flex-direction:row;padding-top:20px;padding-bottom:8px}.flipdown-point-box{display:flex;flex-direction:column;justify-content:center;padding:20px 6px 8px}.flipdown-point-box div{width:8px;height:8px;background-color:#000;border-radius:50%}.flipdown.flipdown__theme-dark{font-family:sans-serif;font-weight:bold}.flipdown.flipdown__theme-dark .rotor,.flipdown.flipdown__theme-dark .rotor-top,.flipdown.flipdown__theme-dark .rotor-leaf-front{color:#fff;background-color:#151515}.flipdown.flipdown__theme-dark .rotor-bottom,.flipdown.flipdown__theme-dark .rotor-leaf-rear{color:#efefef;background-color:#202020}.flipdown.flipdown__theme-dark .rotor:after{border-top:solid 1px #151515}.flipdown.flipdown__theme-light{font-family:sans-serif;font-weight:bold}.flipdown.flipdown__theme-light .rotor,.flipdown.flipdown__theme-light .rotor-top,.flipdown.flipdown__theme-light .rotor-leaf-front{color:#222;background-color:#ddd}.flipdown.flipdown__theme-light .rotor-bottom,.flipdown.flipdown__theme-light .rotor-leaf-rear{color:#333;background-color:#eee}.flipdown.flipdown__theme-light .rotor:after{border-top:solid 1px #222222}.flipdown .rotor-group{position:relative}.flipdown .rotor{position:relative;width:36px;height:64px;border-radius:4px;font-size:48px;text-align:center;perspective:200px}.flipdown .rotor-top,.flipdown .rotor-bottom{overflow:hidden;position:absolute;width:36px;height:32px}.flipdown .rotor-leaf{z-index:1;position:absolute;width:36px;height:64px;transform-style:preserve-3d;transition:transform 0s}.flipdown .rotor-leaf.flipped{transform:rotateX(-180deg);transition:all .5s ease-in-out}.flipdown .rotor-leaf-front,.flipdown .rotor-leaf-rear{overflow:hidden;position:absolute;width:36px;height:32px;margin:0;transform:rotateX(0);backface-visibility:hidden;-webkit-backface-visibility:hidden}.flipdown .rotor-leaf-front{line-height:64px;border-radius:4px 4px 0 0}.flipdown .rotor-leaf-rear{line-height:0px;border-radius:0 0 4px 4px;transform:rotateX(-180deg)}.flipdown .rotor-top{line-height:64px;border-radius:4px 4px 0 0}.flipdown .rotor-bottom{bottom:0;line-height:0px;border-radius:0 0 4px 4px}.flipdown .rotor:after{content:"";z-index:2;position:absolute;bottom:0px;left:0px;width:36px;height:32px;border-radius:0 0 4px 4px}\n';
const Noop = () => null;
});
var TimeAdjustment;
(function(TimeAdjustment2) {
TimeAdjustment2[TimeAdjustment2["AddTenMinutes"] = 0] = "AddTenMinutes";
TimeAdjustment2[TimeAdjustment2["ReduceTenMinutes"] = 1] = "ReduceTenMinutes";
TimeAdjustment2[TimeAdjustment2["AddOneMinute"] = 2] = "AddOneMinute";
TimeAdjustment2[TimeAdjustment2["ReduceOneMinute"] = 3] = "ReduceOneMinute";
TimeAdjustment2[TimeAdjustment2["AddTenSeconds"] = 4] = "AddTenSeconds";
TimeAdjustment2[TimeAdjustment2["ReduceTenSeconds"] = 5] = "ReduceTenSeconds";
TimeAdjustment2[TimeAdjustment2["AddOneSecond"] = 6] = "AddOneSecond";
TimeAdjustment2[TimeAdjustment2["ReduceOneSecond"] = 7] = "ReduceOneSecond";
})(TimeAdjustment || (TimeAdjustment = {}));
function useDigits(time) {
return d(() => {
time = time % 61;
return [Math.floor(time / 10), time % 10];
}, [time]);
}
function useAdjustTime(onAdjustTime, adjustment) {
return A$1(() => onAdjustTime(adjustment), [onAdjustTime]);
}
const Clock = g(({ minutes, seconds, disabled, onAdjustTime }) => {
const mins = useDigits(minutes);
const secs = useDigits(seconds);
const addTenMinutes = useAdjustTime(onAdjustTime, 0);
const reduceTenMinutes = useAdjustTime(onAdjustTime, 1);
const addOneMinute = useAdjustTime(onAdjustTime, 2);
const reduceOneMinute = useAdjustTime(onAdjustTime, 3);
const addTenSeconds = useAdjustTime(onAdjustTime, 4);
const reduceTenSeconds = useAdjustTime(onAdjustTime, 5);
const addOneSecond = useAdjustTime(onAdjustTime, 6);
const reduceOneSecond = useAdjustTime(onAdjustTime, 7);
return /* @__PURE__ */ v$1("div", {
className: "countdown-clock"
}, /* @__PURE__ */ v$1(TimeCell, {
disabled,
digit: mins[0],
onUp: addTenMinutes,
onDown: reduceTenMinutes
}), /* @__PURE__ */ v$1(TimeCell, {
digit: mins[1],
disabled,
onUp: addOneMinute,
onDown: reduceOneMinute
}), /* @__PURE__ */ v$1("div", {
class: "countdown-clock-divider"
}), /* @__PURE__ */ v$1(TimeCell, {
disabled,
digit: secs[0],
onUp: addTenSeconds,
onDown: reduceTenSeconds
}), /* @__PURE__ */ v$1(TimeCell, {
digit: secs[1],
disabled,
onUp: addOneSecond,
onDown: reduceOneSecond
}));
});
const Countdown$1 = g(({
readonly,
countdownSecs,
startTime,
paused,
onAdjustTime,
onStart,
onPause,
onResume,
onReset
}) => {
const [now, setNow] = l(0);
const started = startTime > 0 && now >= startTime;
const amountInSecs = countdownSecs - (started ? now - startTime : 0);
const minutes = Math.floor(amountInSecs / 60);
const seconds = amountInSecs - minutes * 60;
y(() => {
let timeout = NaN;
if (countdownSecs > 0 && startTime > 0 && !paused) {
const updateNow = () => {
setNow(Math.floor(Date.now() / 1e3));
timeout = window.requestAnimationFrame(updateNow);
};
updateNow();
return () => window.cancelAnimationFrame(timeout);
} else {
window.cancelAnimationFrame(timeout);
}
}, [startTime, paused, countdownSecs]);
y(() => {
if (startTime > 0 && now - startTime >= countdownSecs) {
onReset();
}
}, [now, startTime, countdownSecs, onReset]);
return /* @__PURE__ */ v$1("div", {
class: "netless-app-countdown"
}, /* @__PURE__ */ v$1("div", {
class: "netless-app-countdown-shrink"
}, /* @__PURE__ */ v$1(Clock, {
minutes,
seconds,
disabled: readonly || started,
onAdjustTime
}), /* @__PURE__ */ v$1("div", {
class: "netless-app-countdown-btns"
}, paused ? /* @__PURE__ */ v$1(d$1, null, /* @__PURE__ */ v$1("button", {
onClick: onReset,
disabled: readonly
}, "Reset"), /* @__PURE__ */ v$1("button", {
onClick: onResume,
disabled: readonly
}, "Resume")) : started ? /* @__PURE__ */ v$1("button", {
onClick: onPause,
disabled: readonly
}, "Pause") : /* @__PURE__ */ v$1("button", {
onClick: onStart,
disabled: readonly || amountInSecs <= 0
}, "Start"))));
});
const App = g(({ context, storage }) => {
const [isWritable, setWritable] = l(() => context.getIsWritable());
const [countdownSecs, setCountdownSecs] = l(0);
const [startTime, setStartTime] = l(0);
const [paused, setPaused] = l(false);
const started = startTime > 0;
const onStart = A$1(() => {
if (context.getIsWritable()) {
setPaused(false);
setStartTime(Math.floor(Date.now() / 1e3));
}
}, [context]);
const onPause = A$1(() => {
if (context.getIsWritable()) {
setPaused(true);
}
}, [context]);
const onResume = A$1(() => {
if (context.getIsWritable()) {
setPaused(false);
}
}, [context]);
const onReset = A$1(() => {
if (context.getIsWritable()) {
setPaused(false);
setCountdownSecs(0);
setStartTime(0);
}
}, [context]);
const onAdjustTime = A$1((adjustment) => {
if (!started) {
setCountdownSecs((countdownSecs2) => {
if (!context.getIsWritable()) {
return countdownSecs2;
}
const minutes = Math.floor(countdownSecs2 / 60);
const seconds = countdownSecs2 - minutes * 60;
const min1 = Math.floor(minutes / 10);
const min2 = minutes % 10;
const sec1 = Math.floor(seconds / 10);
const sec2 = seconds % 10;
switch (adjustment) {
case TimeAdjustment.AddTenMinutes: {
const max = min2 + seconds === 0 ? 7 : 6;
return ((min1 + 1) % max * 10 + min2) * 60 + seconds;
}
case TimeAdjustment.ReduceTenMinutes: {
const max = min2 + seconds === 0 ? 7 : 6;
return ((min1 + max - 1) % max * 10 + min2) * 60 + seconds;
}
case TimeAdjustment.AddOneMinute: {
return (Math.min(5, min1) * 10 + (min2 + 1) % 10) * 60 + seconds;
}
case TimeAdjustment.ReduceOneMinute: {
return (Math.min(5, min1) * 10 + (min2 + 10 - 1) % 10) * 60 + seconds;
}
case TimeAdjustment.AddTenSeconds: {
return minutes * 60 + ((sec1 + 1) % 6 * 10 + sec2);
}
case TimeAdjustment.ReduceTenSeconds: {
return minutes * 60 + ((sec1 + 6 - 1) % 6 * 10 + sec2);
}
case TimeAdjustment.AddOneSecond: {
return minutes * 60 + (Math.min(5, sec1) * 10 + (sec2 + 1) % 10);
}
case TimeAdjustment.ReduceOneSecond: {
return minutes * 60 + (Math.min(5, sec1) * 10 + (sec2 + 10 - 1) % 10);
}
default: {
return countdownSecs2;
}
}
});
}
}, [started, context]);
y(() => {
setWritable(context.getIsWritable());
context.emitter.on("writableChange", setWritable);
return () => context.emitter.off("writableChange", setWritable);
}, [context]);
y(() => {
const handler = (diff) => {
if (diff.countdownSecs) {
setCountdownSecs(storage.state.countdownSecs);
}
if (diff.paused) {
setPaused(storage.state.paused);
}
if (diff.startTime) {
setStartTime(storage.state.startTime);
}
};
storage.onStateChanged.addListener(handler);
return () => storage.onStateChanged.removeListener(handler);
}, [storage]);
y(() => {
if (context.getIsWritable()) {
storage.setState({ countdownSecs, paused, startTime });
}
}, [countdownSecs, paused, startTime, context]);
return /* @__PURE__ */ v$1(Countdown$1, {
readonly: !isWritable,
countdownSecs,
startTime,
paused,
onAdjustTime,
onStart,
onPause,
onResume,
onReset
});
});
const MIN_WIDTH = 208;

@@ -805,27 +889,15 @@ const MIN_HEIGHT = 216;

setup(context) {
let attrs = context.getAttributes();
if (!(attrs == null ? void 0 : attrs.state)) {
context.setAttributes({ state: { start: 0, pause: 0, total: 0 } });
attrs = context.getAttributes();
}
if (!attrs) {
throw new Error("[Countdown]: No attributes");
}
const room = context.getRoom();
if (!room) {
throw new Error("[Countdown]: No room");
}
const box = context.getBox();
const container = document.createElement("div");
container.classList.add("netless-app-flipdown-container");
box.mountStyles(styles);
box.mountContent(container);
S$1(/* @__PURE__ */ v$1(Controller, {
const storage = context.createStorage("state", {
countdownSecs: 0,
startTime: 0,
paused: false
});
S$1(/* @__PURE__ */ v$1(App, {
context,
room
}), container);
storage
}), box.$content);
context.emitter.on("destroy", () => {
console.log("[Countdown]: destroy");
S$1(/* @__PURE__ */ v$1(Noop, null), container);
container.remove();
S$1(null, box.$content);
});

@@ -832,0 +904,0 @@ }

@@ -1,3 +0,7 @@

(()=>{var te=Object.defineProperty;var Pt=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var Dt=(w,g,s)=>g in w?te(w,g,{enumerable:!0,configurable:!0,writable:!0,value:s}):w[g]=s,Tt=(w,g)=>{for(var s in g||(g={}))ee.call(g,s)&&Dt(w,s,g[s]);if(Pt)for(var s of Pt(g))oe.call(g,s)&&Dt(w,s,g[s]);return w};var _e=function(w){"use strict";var g,s,X,P,Z,J,D={},K=[],Mt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function C(t,e){for(var o in e)t[o]=e[o];return t}function Q(t){var e=t.parentNode;e&&e.removeChild(t)}function h(t,e,o){var n,_,r,l={};for(r in e)r=="key"?n=e[r]:r=="ref"?_=e[r]:l[r]=e[r];if(arguments.length>2&&(l.children=arguments.length>3?g.call(arguments,2):o),typeof t=="function"&&t.defaultProps!=null)for(r in t.defaultProps)l[r]===void 0&&(l[r]=t.defaultProps[r]);return T(t,l,n,_,null)}function T(t,e,o,n,_){var r={type:t,props:e,key:o,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:_==null?++X:_};return _==null&&s.vnode!=null&&s.vnode(r),r}function E(t){return t.children}function x(t,e){this.props=t,this.context=e}function $(t,e){if(e==null)return t.__?$(t.__,t.__.__k.indexOf(t)+1):null;for(var o;e<t.__k.length;e++)if((o=t.__k[e])!=null&&o.__e!=null)return o.__e;return typeof t.type=="function"?$(t):null}function Y(t){var e,o;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((o=t.__k[e])!=null&&o.__e!=null){t.__e=t.__c.base=o.__e;break}return Y(t)}}function tt(t){(!t.__d&&(t.__d=!0)&&P.push(t)&&!M.__r++||J!==s.debounceRendering)&&((J=s.debounceRendering)||Z)(M)}function M(){for(var t;M.__r=P.length;)t=P.sort(function(e,o){return e.__v.__b-o.__v.__b}),P=[],t.some(function(e){var o,n,_,r,l,a;e.__d&&(l=(r=(o=e).__v).__e,(a=o.__P)&&(n=[],(_=C({},r)).__v=r.__v+1,O(a,r,_,o.__n,a.ownerSVGElement!==void 0,r.__h!=null?[l]:null,n,l==null?$(r):l,r.__h),lt(n,r),r.__e!=l&&Y(r)))})}function et(t,e,o,n,_,r,l,a,d,p){var i,m,f,c,u,A,v,b=n&&n.__k||K,k=b.length;for(o.__k=[],i=0;i<e.length;i++)if((c=o.__k[i]=(c=e[i])==null||typeof c=="boolean"?null:typeof c=="string"||typeof c=="number"||typeof c=="bigint"?T(null,c,null,null,c):Array.isArray(c)?T(E,{children:c},null,null,null):c.__b>0?T(c.type,c.props,c.key,null,c.__v):c)!=null){if(c.__=o,c.__b=o.__b+1,(f=b[i])===null||f&&c.key==f.key&&c.type===f.type)b[i]=void 0;else for(m=0;m<k;m++){if((f=b[m])&&c.key==f.key&&c.type===f.type){b[m]=void 0;break}f=null}O(t,c,f=f||D,_,r,l,a,d,p),u=c.__e,(m=c.ref)&&f.ref!=m&&(v||(v=[]),f.ref&&v.push(f.ref,null,c),v.push(m,c.__c||u,c)),u!=null?(A==null&&(A=u),typeof c.type=="function"&&c.__k===f.__k?c.__d=d=ot(c,d,t):d=nt(t,c,f,b,u,d),typeof o.type=="function"&&(o.__d=d)):d&&f.__e==d&&d.parentNode!=t&&(d=$(f))}for(o.__e=A,i=k;i--;)b[i]!=null&&(typeof o.type=="function"&&b[i].__e!=null&&b[i].__e==o.__d&&(o.__d=$(n,i+1)),at(b[i],b[i]));if(v)for(i=0;i<v.length;i++)st(v[i],v[++i],v[++i])}function ot(t,e,o){for(var n,_=t.__k,r=0;_&&r<_.length;r++)(n=_[r])&&(n.__=t,e=typeof n.type=="function"?ot(n,e,o):nt(o,n,n,_,n.__e,e));return e}function H(t,e){return e=e||[],t==null||typeof t=="boolean"||(Array.isArray(t)?t.some(function(o){H(o,e)}):e.push(t)),e}function nt(t,e,o,n,_,r){var l,a,d;if(e.__d!==void 0)l=e.__d,e.__d=void 0;else if(o==null||_!=r||_.parentNode==null)t:if(r==null||r.parentNode!==t)t.appendChild(_),l=null;else{for(a=r,d=0;(a=a.nextSibling)&&d<n.length;d+=2)if(a==_)break t;t.insertBefore(_,r),l=r}return l!==void 0?l:_.nextSibling}function Ht(t,e,o,n,_){var r;for(r in o)r==="children"||r==="key"||r in e||N(t,r,null,o[r],n);for(r in e)_&&typeof e[r]!="function"||r==="children"||r==="key"||r==="value"||r==="checked"||o[r]===e[r]||N(t,r,e[r],o[r],n)}function rt(t,e,o){e[0]==="-"?t.setProperty(e,o):t[e]=o==null?"":typeof o!="number"||Mt.test(e)?o:o+"px"}function N(t,e,o,n,_){var r;t:if(e==="style")if(typeof o=="string")t.style.cssText=o;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)o&&e in o||rt(t.style,e,"");if(o)for(e in o)n&&o[e]===n[e]||rt(t.style,e,o[e])}else if(e[0]==="o"&&e[1]==="n")r=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=o,o?n||t.addEventListener(e,r?_t:it,r):t.removeEventListener(e,r?_t:it,r);else if(e!=="dangerouslySetInnerHTML"){if(_)e=e.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if(e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e in t)try{t[e]=o==null?"":o;break t}catch(l){}typeof o=="function"||(o!=null&&(o!==!1||e[0]==="a"&&e[1]==="r")?t.setAttribute(e,o):t.removeAttribute(e))}}function it(t){this.l[t.type+!1](s.event?s.event(t):t)}function _t(t){this.l[t.type+!0](s.event?s.event(t):t)}function O(t,e,o,n,_,r,l,a,d){var p,i,m,f,c,u,A,v,b,k,L,S=e.type;if(e.constructor!==void 0)return null;o.__h!=null&&(d=o.__h,a=e.__e=o.__e,e.__h=null,r=[a]),(p=s.__b)&&p(e);try{t:if(typeof S=="function"){if(v=e.props,b=(p=S.contextType)&&n[p.__c],k=p?b?b.props.value:p.__:n,o.__c?A=(i=e.__c=o.__c).__=i.__E:("prototype"in S&&S.prototype.render?e.__c=i=new S(v,k):(e.__c=i=new x(v,k),i.constructor=S,i.render=It),b&&b.sub(i),i.props=v,i.state||(i.state={}),i.context=k,i.__n=n,m=i.__d=!0,i.__h=[]),i.__s==null&&(i.__s=i.state),S.getDerivedStateFromProps!=null&&(i.__s==i.state&&(i.__s=C({},i.__s)),C(i.__s,S.getDerivedStateFromProps(v,i.__s))),f=i.props,c=i.state,m)S.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else{if(S.getDerivedStateFromProps==null&&v!==f&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(v,k),!i.__e&&i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(v,i.__s,k)===!1||e.__v===o.__v){i.props=v,i.state=i.__s,e.__v!==o.__v&&(i.__d=!1),i.__v=e,e.__e=o.__e,e.__k=o.__k,e.__k.forEach(function(F){F&&(F.__=e)}),i.__h.length&&l.push(i);break t}i.componentWillUpdate!=null&&i.componentWillUpdate(v,i.__s,k),i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(f,c,u)})}i.context=k,i.props=v,i.state=i.__s,(p=s.__r)&&p(e),i.__d=!1,i.__v=e,i.__P=t,p=i.render(i.props,i.state,i.context),i.state=i.__s,i.getChildContext!=null&&(n=C(C({},n),i.getChildContext())),m||i.getSnapshotBeforeUpdate==null||(u=i.getSnapshotBeforeUpdate(f,c)),L=p!=null&&p.type===E&&p.key==null?p.props.children:p,et(t,Array.isArray(L)?L:[L],e,o,n,_,r,l,a,d),i.base=e.__e,e.__h=null,i.__h.length&&l.push(i),A&&(i.__E=i.__=null),i.__e=!1}else r==null&&e.__v===o.__v?(e.__k=o.__k,e.__e=o.__e):e.__e=Nt(o.__e,e,o,n,_,r,l,d);(p=s.diffed)&&p(e)}catch(F){e.__v=null,(d||r!=null)&&(e.__e=a,e.__h=!!d,r[r.indexOf(a)]=null),s.__e(F,e,o)}}function lt(t,e){s.__c&&s.__c(e,t),t.some(function(o){try{t=o.__h,o.__h=[],t.some(function(n){n.call(o)})}catch(n){s.__e(n,o.__v)}})}function Nt(t,e,o,n,_,r,l,a){var d,p,i,m=o.props,f=e.props,c=e.type,u=0;if(c==="svg"&&(_=!0),r!=null){for(;u<r.length;u++)if((d=r[u])&&(d===t||(c?d.localName==c:d.nodeType==3))){t=d,r[u]=null;break}}if(t==null){if(c===null)return document.createTextNode(f);t=_?document.createElementNS("http://www.w3.org/2000/svg",c):document.createElement(c,f.is&&f),r=null,a=!1}if(c===null)m===f||a&&t.data===f||(t.data=f);else{if(r=r&&g.call(t.childNodes),p=(m=o.props||D).dangerouslySetInnerHTML,i=f.dangerouslySetInnerHTML,!a){if(r!=null)for(m={},u=0;u<t.attributes.length;u++)m[t.attributes[u].name]=t.attributes[u].value;(i||p)&&(i&&(p&&i.__html==p.__html||i.__html===t.innerHTML)||(t.innerHTML=i&&i.__html||""))}if(Ht(t,f,m,_,a),i)e.__k=[];else if(u=e.props.children,et(t,Array.isArray(u)?u:[u],e,o,n,_&&c!=="foreignObject",r,l,r?r[0]:o.__k&&$(o,0),a),r!=null)for(u=r.length;u--;)r[u]!=null&&Q(r[u]);a||("value"in f&&(u=f.value)!==void 0&&(u!==t.value||c==="progress"&&!u)&&N(t,"value",u,m.value,!1),"checked"in f&&(u=f.checked)!==void 0&&u!==t.checked&&N(t,"checked",u,m.checked,!1))}return t}function st(t,e,o){try{typeof t=="function"?t(e):t.current=e}catch(n){s.__e(n,o)}}function at(t,e,o){var n,_;if(s.unmount&&s.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||st(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(r){s.__e(r,e)}n.base=n.__P=null}if(n=t.__k)for(_=0;_<n.length;_++)n[_]&&at(n[_],e,typeof t.type!="function");o||t.__e==null||Q(t.__e),t.__e=t.__d=void 0}function It(t,e,o){return this.constructor(t,o)}function ct(t,e,o){var n,_,r;s.__&&s.__(t,e),_=(n=typeof o=="function")?null:o&&o.__k||e.__k,r=[],O(e,t=(!n&&o||e).__k=h(E,null,[t]),_||D,D,e.ownerSVGElement!==void 0,!n&&o?[o]:_?null:e.firstChild?g.call(e.childNodes):null,r,!n&&o?o:_?_.__e:e.firstChild,n),lt(r,t)}g=K.slice,s={__e:function(t,e){for(var o,n,_;e=e.__;)if((o=e.__c)&&!o.__)try{if((n=o.constructor)&&n.getDerivedStateFromError!=null&&(o.setState(n.getDerivedStateFromError(t)),_=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(t),_=o.__d),_)return o.__E=o}catch(r){t=r}throw t}},X=0,x.prototype.setState=function(t,e){var o;o=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=C({},this.state),typeof t=="function"&&(t=t(C({},o),this.props)),t&&C(o,t),t!=null&&this.__v&&(e&&this.__h.push(e),tt(this))},x.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),tt(this))},x.prototype.render=E,P=[],Z=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,M.__r=0;var W,y,ft,j=0,V=[],pt=s.__b,dt=s.__r,ut=s.diffed,ht=s.__c,mt=s.unmount;function vt(t,e){s.__h&&s.__h(y,t,j||e),j=0;var o=y.__H||(y.__H={__:[],__h:[]});return t>=o.__.length&&o.__.push({}),o.__[t]}function z(t){return j=1,Rt(gt,t)}function Rt(t,e,o){var n=vt(W++,2);return n.t=t,n.__c||(n.__=[o?o(e):gt(void 0,e),function(_){var r=n.t(n.__[0],_);n.__[0]!==r&&(n.__=[r,n.__[1]],n.__c.setState({}))}],n.__c=y),n.__}function Ut(t,e){var o=vt(W++,3);!s.__s&&Ft(o.__H,e)&&(o.__=t,o.__H=e,y.__H.__h.push(o))}function Lt(){V.forEach(function(t){if(t.__P)try{t.__H.__h.forEach(I),t.__H.__h.forEach(B),t.__H.__h=[]}catch(e){t.__H.__h=[],s.__e(e,t.__v)}}),V=[]}s.__b=function(t){y=null,pt&&pt(t)},s.__r=function(t){dt&&dt(t),W=0;var e=(y=t.__c).__H;e&&(e.__h.forEach(I),e.__h.forEach(B),e.__h=[])},s.diffed=function(t){ut&&ut(t);var e=t.__c;e&&e.__H&&e.__H.__h.length&&(V.push(e)!==1&&ft===s.requestAnimationFrame||((ft=s.requestAnimationFrame)||function(o){var n,_=function(){clearTimeout(r),bt&&cancelAnimationFrame(n),setTimeout(o)},r=setTimeout(_,100);bt&&(n=requestAnimationFrame(_))})(Lt)),y=null},s.__c=function(t,e){e.some(function(o){try{o.__h.forEach(I),o.__h=o.__h.filter(function(n){return!n.__||B(n)})}catch(n){e.some(function(_){_.__h&&(_.__h=[])}),e=[],s.__e(n,o.__v)}}),ht&&ht(t,e)},s.unmount=function(t){mt&&mt(t);var e=t.__c;if(e&&e.__H)try{e.__H.__.forEach(I)}catch(o){s.__e(o,e.__v)}};var bt=typeof requestAnimationFrame=="function";function I(t){var e=y;typeof t.__c=="function"&&t.__c(),y=e}function B(t){var e=y;t.__c=t.__(),y=e}function Ft(t,e){return!t||t.length!==e.length||e.some(function(o,n){return o!==t[n]})}function gt(t,e){return typeof e=="function"?e(t):e}function Ot(t,e){for(var o in e)t[o]=e[o];return t}function wt(t,e){for(var o in t)if(o!=="__source"&&!(o in e))return!0;for(var n in e)if(n!=="__source"&&t[n]!==e[n])return!0;return!1}function q(t){this.props=t}(q.prototype=new x).isPureReactComponent=!0,q.prototype.shouldComponentUpdate=function(t,e){return wt(this.props,t)||wt(this.state,e)};var yt=s.__b;s.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),yt&&yt(t)};var Wt=s.__e;s.__e=function(t,e,o){if(t.then){for(var n,_=e;_=_.__;)if((n=_.__c)&&n.__c)return e.__e==null&&(e.__e=o.__e,e.__k=o.__k),n.__c(t,e)}Wt(t,e,o)};var kt=s.unmount;function G(){this.__u=0,this.t=null,this.__b=null}function xt(t){var e=t.__.__c;return e&&e.__e&&e.__e(t)}function R(){this.u=null,this.o=null}s.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&t.__h===!0&&(t.type=null),kt&&kt(t)},(G.prototype=new x).__c=function(t,e){var o=e.__c,n=this;n.t==null&&(n.t=[]),n.t.push(o);var _=xt(n.__v),r=!1,l=function(){r||(r=!0,o.__R=null,_?_(a):a())};o.__R=l;var a=function(){if(!--n.__u){if(n.state.__e){var p=n.state.__e;n.__v.__k[0]=function m(f,c,u){return f&&(f.__v=null,f.__k=f.__k&&f.__k.map(function(A){return m(A,c,u)}),f.__c&&f.__c.__P===c&&(f.__e&&u.insertBefore(f.__e,f.__d),f.__c.__e=!0,f.__c.__P=u)),f}(p,p.__c.__P,p.__c.__O)}var i;for(n.setState({__e:n.__b=null});i=n.t.pop();)i.forceUpdate()}},d=e.__h===!0;n.__u++||d||n.setState({__e:n.__b=n.__v.__k[0]}),t.then(l,l)},G.prototype.componentWillUnmount=function(){this.t=[]},G.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var o=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=function r(l,a,d){return l&&(l.__c&&l.__c.__H&&(l.__c.__H.__.forEach(function(p){typeof p.__c=="function"&&p.__c()}),l.__c.__H=null),(l=Ot({},l)).__c!=null&&(l.__c.__P===d&&(l.__c.__P=a),l.__c=null),l.__k=l.__k&&l.__k.map(function(p){return r(p,a,d)})),l}(this.__b,o,n.__O=n.__P)}this.__b=null}var _=e.__e&&h(E,null,t.fallback);return _&&(_.__h=null),[h(E,null,e.__e?null:t.children),_]};var St=function(t,e,o){if(++o[1]===o[0]&&t.o.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.o.size))for(o=t.u;o;){for(;o.length>3;)o.pop()();if(o[1]<o[0])break;t.u=o=o[2]}};(R.prototype=new x).__e=function(t){var e=this,o=xt(e.__v),n=e.o.get(t);return n[0]++,function(_){var r=function(){e.props.revealOrder?(n.push(_),St(e,t,n)):_()};o?o(r):r()}},R.prototype.render=function(t){this.u=null,this.o=new Map;var e=H(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var o=e.length;o--;)this.o.set(e[o],this.u=[1,0,this.u]);return t.children},R.prototype.componentDidUpdate=R.prototype.componentDidMount=function(){var t=this;this.o.forEach(function(e,o){St(t,o,e)})};var jt=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,Vt=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,zt=typeof document!="undefined",Bt=function(t){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(t)};x.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(x.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var Ct=s.event;function qt(){}function Gt(){return this.cancelBubble}function Xt(){return this.defaultPrevented}s.event=function(t){return Ct&&(t=Ct(t)),t.persist=qt,t.isPropagationStopped=Gt,t.isDefaultPrevented=Xt,t.nativeEvent=t};var At={configurable:!0,get:function(){return this.class}},Et=s.vnode;s.vnode=function(t){var e=t.type,o=t.props,n=o;if(typeof e=="string"){var _=e.indexOf("-")===-1;for(var r in n={},o){var l=o[r];zt&&r==="children"&&e==="noscript"||r==="value"&&"defaultValue"in o&&l==null||(r==="defaultValue"&&"value"in o&&o.value==null?r="value":r==="download"&&l===!0?l="":/ondoubleclick/i.test(r)?r="ondblclick":/^onchange(textarea|input)/i.test(r+e)&&!Bt(o.type)?r="oninput":/^on(Ani|Tra|Tou|BeforeInp)/.test(r)?r=r.toLowerCase():_&&Vt.test(r)?r=r.replace(/[A-Z0-9]/,"-$&").toLowerCase():l===null&&(l=void 0),n[r]=l)}e=="select"&&n.multiple&&Array.isArray(n.value)&&(n.value=H(o.children).forEach(function(a){a.props.selected=n.value.indexOf(a.props.value)!=-1})),e=="select"&&n.defaultValue!=null&&(n.value=H(o.children).forEach(function(a){a.props.selected=n.multiple?n.defaultValue.indexOf(a.props.value)!=-1:n.defaultValue==a.props.value})),t.props=n}e&&o.class!=o.className&&(At.enumerable="className"in o,o.className!=null&&(n.class=o.className),Object.defineProperty(n,"className",At)),t.$$typeof=jt,Et&&Et(t)};var $t=s.__r;s.__r=function(t){$t&&$t(t)};class Zt extends x{constructor(e){super(e);this.raf=0,this.start=()=>{const{context:o,room:n}=this.props,{start:_,pause:r,total:l}=this.attributes.state,a=n.calibrationTimestamp;r?o.updateAttributes(["state"],{start:a-(r-_),pause:0,total:l}):o.updateAttributes(["state","pause"],a)},this.reset=()=>{const{context:o}=this.props;o.updateAttributes(["state"],{start:0,pause:0,total:0}),this.setState({isDone:!1})},this.init=o=>{const{context:n,room:_}=this.props;n.updateAttributes(["state"],{start:_.calibrationTimestamp,pause:0,total:o||0})},this.update=()=>{this.raf=requestAnimationFrame(this.update);const{context:o,room:n}=this.props;this.attributes=o.getAttributes();const{start:_,pause:r,total:l}=this.attributes.state,a=_===0,d=a||r!==0;let p=0;_&&(r?p=(r-_)/1e3|0:p=(n.calibrationTimestamp-_)/1e3|0),l&&(p>l&&(!r&&this.start(),this.setState({isDone:!0})),p=Math.max(l-p,0)),this.setState({isInit:a,stopped:d,seconds:p})},this.raf=requestAnimationFrame(this.update),this.attributes=e.context.getAttributes(),this.state={isInit:!0,isDone:!1,seconds:0,stopped:!0,start:this.start,reset:this.reset,init:this.init}}componentWillUnmount(){console.log("[Countdown]: unmount"),cancelAnimationFrame(this.raf)}render(){return h(Jt,Tt({},this.state))}}class Jt extends q{constructor(e){super(e);this.correctValueFormat=o=>({left:Math.floor(o/10),right:o%10}),this.transformTime=()=>{if(this.props.isInit){const{total:a}=this.state;return{minutes_left:a[0],minutes_right:a[1],seconds_left:a[2],seconds_right:a[3]}}const o=this.props.seconds,n=Math.floor(o%(60*60)/60),_=Math.floor(o%60),r=this.correctValueFormat(n),l=this.correctValueFormat(_);return{minutes_left:r.left,minutes_right:r.right,seconds_left:l.left,seconds_right:l.right}},this.handleInit=()=>{const[o,n,_,r]=this.state.total;this.props.init((o*10+n)*60+(_*10+r))},this.handleReset=()=>{this.props.reset(),this.setState({total:[0,0,0,0]})},this.handleInc=o=>()=>{const n=this.state.total.map((_,r)=>r===o?(_+1)%10:_);o===2&&n[o]>5&&(n[o]=0),this.setState({total:n})},this.incMinutesLeft=this.handleInc(0),this.incMinutesRight=this.handleInc(1),this.incSecondsLeft=this.handleInc(2),this.incSecondsRight=this.handleInc(3),this.handleDec=o=>()=>{const n=this.state.total.map((_,r)=>r===o?(_+9)%10:_);o===2&&n[o]>5&&(n[o]=5),this.setState({total:n})},this.decMinutesLeft=this.handleDec(0),this.decMinutesRight=this.handleDec(1),this.decSecondsLeft=this.handleDec(2),this.decSecondsRight=this.handleDec(3),this.state={total:[0,0,0,0]}}render(){const{isInit:e,isDone:o,stopped:n,start:_}=this.props,{seconds_left:r,seconds_right:l,minutes_right:a,minutes_left:d}=this.transformTime(),p=o?"flipdown flipdown__theme-light":"flipdown flipdown__theme-dark";return h("div",{class:"flipdown-box"},!e&&h("div",{class:"flipdown-mask"},n?h("div",{class:"flipdown-mask-mid"},h("button",{onClick:this.handleReset,class:"flipdown-mask-btn"},"\u91CD\u7F6E"),!o&&h("button",{onClick:_,class:"flipdown-mask-btn"},"\u7EE7\u7EED")):h("div",{class:"flipdown-mask-mid"},h("button",{onClick:_,class:"flipdown-mask-btn"},"\u6682\u505C"))),h("div",{class:p},h("div",{class:"flipdown-mid-box"},h(U,{style:{marginRight:8},disabled:!e,time:d,onUp:this.incMinutesLeft,onDown:this.decMinutesLeft}),h(U,{time:a,disabled:!e,onUp:this.incMinutesRight,onDown:this.decMinutesRight})),h("div",{class:"flipdown-point-box"},h("div",{style:"margin-bottom: 12px"}),h("div",null)),h("div",{class:"flipdown-mid-box"},h(U,{style:{marginRight:8},disabled:!e,time:r,onUp:this.incSecondsLeft,onDown:this.decSecondsLeft}),h(U,{time:l,disabled:!e,onUp:this.incSecondsRight,onDown:this.decSecondsRight}))),e&&h("div",{class:"flipdown-buttons"},h("button",{onClick:this.handleInit,class:"flipdown-button"},"\u5F00\u59CB")))}}const U=({time:t,style:e,disabled:o,onUp:n,onDown:_})=>{const[r,l]=z("rotor-leaf"),[a,d]=z(0),[p,i]=z(0);return Ut(()=>{o||p?(i(1),l("rotor-leaf flipped"),setTimeout(()=>{l("rotor-leaf"),d(t)},500),!o&&i(0)):d(t)},[t,o]),h("div",{class:o?"flipdown-digit disabled":"flipdown-digit",style:e},h("div",{class:"flipdown-up",onClick:o?void 0:n}),h("div",{class:"rotor"},h("div",{class:r},h("figure",{class:"rotor-leaf-rear"},t),h("figure",{class:"rotor-leaf-front"},a)),h("div",{class:"rotor-top"},t),h("div",{class:"rotor-bottom"},a)),h("div",{class:"flipdown-down",onClick:o?void 0:_}))};var Kt=`.netless-app-flipdown-container{height:100%}.flipdown-box{height:100%;position:relative;display:flex;flex-flow:column nowrap;align-items:center;justify-content:center}.flipdown-mask{width:100%;height:100%;position:absolute;z-index:2;background-color:#0000004d;display:flex;justify-items:center;align-items:center;flex-direction:row;opacity:0}.flipdown-mask:hover{opacity:1}.flipdown-mask-btn{width:90px;height:28px;background-color:#3380ff;margin-left:auto;margin-right:auto;border:0;border-radius:4px;display:flex;align-items:center;justify-content:center;color:#fff;cursor:pointer}.flipdown-mask-mid{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.flipdown-buttons{display:flex;flex-flow:column nowrap;gap:4px;padding-bottom:20px}.flipdown-button{width:180px;height:36px;border:0;background-color:#3380ff;margin-left:auto;margin-right:auto;border-radius:4px;display:flex;align-items:center;justify-content:center;color:#fff;cursor:pointer}.flipdown{display:flex;flex-direction:row;align-items:center;justify-content:center;transform-origin:center}.flipdown-digit{display:flex;flex-flow:column nowrap;align-items:center}.flipdown-digit.disabled .flipdown-up:before,.flipdown-digit.disabled .flipdown-down:after{border-top-color:#0000000d;border-bottom-color:#0000000d}.flipdown-up:before,.flipdown-down:after{content:"";display:inline-block;width:0;height:0;border-top:0;border-left:12px solid transparent;border-right:12px solid transparent;border-bottom:12px solid #151515;cursor:pointer}.flipdown-down:after{border-top:12px solid #151515;border-bottom:0}.flipdown-mid-box{display:flex;flex-direction:row;padding-top:20px;padding-bottom:8px}.flipdown-point-box{display:flex;flex-direction:column;justify-content:center;padding:20px 6px 8px}.flipdown-point-box div{width:8px;height:8px;background-color:#000;border-radius:50%}.flipdown.flipdown__theme-dark{font-family:sans-serif;font-weight:bold}.flipdown.flipdown__theme-dark .rotor,.flipdown.flipdown__theme-dark .rotor-top,.flipdown.flipdown__theme-dark .rotor-leaf-front{color:#fff;background-color:#151515}.flipdown.flipdown__theme-dark .rotor-bottom,.flipdown.flipdown__theme-dark .rotor-leaf-rear{color:#efefef;background-color:#202020}.flipdown.flipdown__theme-dark .rotor:after{border-top:solid 1px #151515}.flipdown.flipdown__theme-light{font-family:sans-serif;font-weight:bold}.flipdown.flipdown__theme-light .rotor,.flipdown.flipdown__theme-light .rotor-top,.flipdown.flipdown__theme-light .rotor-leaf-front{color:#222;background-color:#ddd}.flipdown.flipdown__theme-light .rotor-bottom,.flipdown.flipdown__theme-light .rotor-leaf-rear{color:#333;background-color:#eee}.flipdown.flipdown__theme-light .rotor:after{border-top:solid 1px #222222}.flipdown .rotor-group{position:relative}.flipdown .rotor{position:relative;width:36px;height:64px;border-radius:4px;font-size:48px;text-align:center;perspective:200px}.flipdown .rotor-top,.flipdown .rotor-bottom{overflow:hidden;position:absolute;width:36px;height:32px}.flipdown .rotor-leaf{z-index:1;position:absolute;width:36px;height:64px;transform-style:preserve-3d;transition:transform 0s}.flipdown .rotor-leaf.flipped{transform:rotateX(-180deg);transition:all .5s ease-in-out}.flipdown .rotor-leaf-front,.flipdown .rotor-leaf-rear{overflow:hidden;position:absolute;width:36px;height:32px;margin:0;transform:rotateX(0);backface-visibility:hidden;-webkit-backface-visibility:hidden}.flipdown .rotor-leaf-front{line-height:64px;border-radius:4px 4px 0 0}.flipdown .rotor-leaf-rear{line-height:0px;border-radius:0 0 4px 4px;transform:rotateX(-180deg)}.flipdown .rotor-top{line-height:64px;border-radius:4px 4px 0 0}.flipdown .rotor-bottom{bottom:0;line-height:0px;border-radius:0 0 4px 4px}.flipdown .rotor:after{content:"";z-index:2;position:absolute;bottom:0px;left:0px;width:36px;height:32px;border-radius:0 0 4px 4px}
`;const Qt=()=>null,Yt={kind:"Countdown",config:{minwidth:208,minheight:216},setup(t){let e=t.getAttributes();if((e==null?void 0:e.state)||(t.setAttributes({state:{start:0,pause:0,total:0}}),e=t.getAttributes()),!e)throw new Error("[Countdown]: No attributes");const o=t.getRoom();if(!o)throw new Error("[Countdown]: No room");const n=t.getBox(),_=document.createElement("div");_.classList.add("netless-app-flipdown-container"),n.mountStyles(Kt),n.mountContent(_),ct(h(Zt,{context:t,room:o}),_),t.emitter.on("destroy",()=>{console.log("[Countdown]: destroy"),ct(h(Qt,null),_),_.remove()})}};return w.default=Yt,Object.defineProperty(w,"__esModule",{value:!0}),w[Symbol.toStringTag]="Module",w}({});})();
var NetlessAppCountdown=function(D){"use strict";var U,a,oe,A,re,_e,W={},le=[],ze=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function C(e,t){for(var n in t)e[n]=t[n];return e}function ie(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n){var o,l,r,i={};for(r in t)r=="key"?o=t[r]:r=="ref"?l=t[r]:i[r]=t[r];if(arguments.length>2&&(i.children=arguments.length>3?U.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)i[r]===void 0&&(i[r]=e.defaultProps[r]);return I(e,i,o,l,null)}function I(e,t,n,o,l){var r={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:l==null?++oe:l};return l==null&&a.vnode!=null&&a.vnode(r),r}function O(e){return e.children}function $(e,t){this.props=e,this.context=t}function N(e,t){if(t==null)return e.__?N(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?N(e):null}function ce(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return ce(e)}}function se(e){(!e.__d&&(e.__d=!0)&&A.push(e)&&!T.__r++||_e!==a.debounceRendering)&&((_e=a.debounceRendering)||re)(T)}function T(){for(var e;T.__r=A.length;)e=A.sort(function(t,n){return t.__v.__b-n.__v.__b}),A=[],e.some(function(t){var n,o,l,r,i,u;t.__d&&(i=(r=(n=t).__v).__e,(u=n.__P)&&(o=[],(l=C({},r)).__v=r.__v+1,Q(u,r,l,n.__n,u.ownerSVGElement!==void 0,r.__h!=null?[i]:null,o,i==null?N(r):i,r.__h),ve(o,r),r.__e!=i&&ce(r)))})}function ae(e,t,n,o,l,r,i,u,f,d){var _,h,s,c,p,k,b,m=o&&o.__k||le,y=m.length;for(n.__k=[],_=0;_<t.length;_++)if((c=n.__k[_]=(c=t[_])==null||typeof c=="boolean"?null:typeof c=="string"||typeof c=="number"||typeof c=="bigint"?I(null,c,null,null,c):Array.isArray(c)?I(O,{children:c},null,null,null):c.__b>0?I(c.type,c.props,c.key,null,c.__v):c)!=null){if(c.__=n,c.__b=n.__b+1,(s=m[_])===null||s&&c.key==s.key&&c.type===s.type)m[_]=void 0;else for(h=0;h<y;h++){if((s=m[h])&&c.key==s.key&&c.type===s.type){m[h]=void 0;break}s=null}Q(e,c,s=s||W,l,r,i,u,f,d),p=c.__e,(h=c.ref)&&s.ref!=h&&(b||(b=[]),s.ref&&b.push(s.ref,null,c),b.push(h,c.__c||p,c)),p!=null?(k==null&&(k=p),typeof c.type=="function"&&c.__k===s.__k?c.__d=f=ue(c,f,e):f=fe(e,c,s,m,p,f),typeof n.type=="function"&&(n.__d=f)):f&&s.__e==f&&f.parentNode!=e&&(f=N(s))}for(n.__e=k,_=y;_--;)m[_]!=null&&(typeof n.type=="function"&&m[_].__e!=null&&m[_].__e==n.__d&&(n.__d=N(o,_+1)),me(m[_],m[_]));if(b)for(_=0;_<b.length;_++)be(b[_],b[++_],b[++_])}function ue(e,t,n){for(var o,l=e.__k,r=0;l&&r<l.length;r++)(o=l[r])&&(o.__=e,t=typeof o.type=="function"?ue(o,t,n):fe(n,o,o,l,o.__e,t));return t}function F(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){F(n,t)}):t.push(e)),t}function fe(e,t,n,o,l,r){var i,u,f;if(t.__d!==void 0)i=t.__d,t.__d=void 0;else if(n==null||l!=r||l.parentNode==null)e:if(r==null||r.parentNode!==e)e.appendChild(l),i=null;else{for(u=r,f=0;(u=u.nextSibling)&&f<o.length;f+=2)if(u==l)break e;e.insertBefore(l,r),i=r}return i!==void 0?i:l.nextSibling}function Ve(e,t,n,o,l){var r;for(r in n)r==="children"||r==="key"||r in t||L(e,r,null,n[r],o);for(r in t)l&&typeof t[r]!="function"||r==="children"||r==="key"||r==="value"||r==="checked"||n[r]===t[r]||L(e,r,t[r],n[r],o)}function de(e,t,n){t[0]==="-"?e.setProperty(t,n):e[t]=n==null?"":typeof n!="number"||ze.test(t)?n:n+"px"}function L(e,t,n,o,l){var r;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||de(e.style,t,"");if(n)for(t in n)o&&n[t]===o[t]||de(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")r=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?o||e.addEventListener(t,r?he:pe,r):e.removeEventListener(t,r?he:pe,r);else if(t!=="dangerouslySetInnerHTML"){if(l)t=t.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if(t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t in e)try{e[t]=n==null?"":n;break e}catch{}typeof n=="function"||(n!=null&&(n!==!1||t[0]==="a"&&t[1]==="r")?e.setAttribute(t,n):e.removeAttribute(t))}}function pe(e){this.l[e.type+!1](a.event?a.event(e):e)}function he(e){this.l[e.type+!0](a.event?a.event(e):e)}function Q(e,t,n,o,l,r,i,u,f){var d,_,h,s,c,p,k,b,m,y,w,g=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(f=n.__h,u=t.__e=n.__e,t.__h=null,r=[u]),(d=a.__b)&&d(t);try{e:if(typeof g=="function"){if(b=t.props,m=(d=g.contextType)&&o[d.__c],y=d?m?m.props.value:d.__:o,n.__c?k=(_=t.__c=n.__c).__=_.__E:("prototype"in g&&g.prototype.render?t.__c=_=new g(b,y):(t.__c=_=new $(b,y),_.constructor=g,_.render=qe),m&&m.sub(_),_.props=b,_.state||(_.state={}),_.context=y,_.__n=o,h=_.__d=!0,_.__h=[]),_.__s==null&&(_.__s=_.state),g.getDerivedStateFromProps!=null&&(_.__s==_.state&&(_.__s=C({},_.__s)),C(_.__s,g.getDerivedStateFromProps(b,_.__s))),s=_.props,c=_.state,h)g.getDerivedStateFromProps==null&&_.componentWillMount!=null&&_.componentWillMount(),_.componentDidMount!=null&&_.__h.push(_.componentDidMount);else{if(g.getDerivedStateFromProps==null&&b!==s&&_.componentWillReceiveProps!=null&&_.componentWillReceiveProps(b,y),!_.__e&&_.shouldComponentUpdate!=null&&_.shouldComponentUpdate(b,_.__s,y)===!1||t.__v===n.__v){_.props=b,_.state=_.__s,t.__v!==n.__v&&(_.__d=!1),_.__v=t,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(S){S&&(S.__=t)}),_.__h.length&&i.push(_);break e}_.componentWillUpdate!=null&&_.componentWillUpdate(b,_.__s,y),_.componentDidUpdate!=null&&_.__h.push(function(){_.componentDidUpdate(s,c,p)})}_.context=y,_.props=b,_.state=_.__s,(d=a.__r)&&d(t),_.__d=!1,_.__v=t,_.__P=e,d=_.render(_.props,_.state,_.context),_.state=_.__s,_.getChildContext!=null&&(o=C(C({},o),_.getChildContext())),h||_.getSnapshotBeforeUpdate==null||(p=_.getSnapshotBeforeUpdate(s,c)),w=d!=null&&d.type===O&&d.key==null?d.props.children:d,ae(e,Array.isArray(w)?w:[w],t,n,o,l,r,i,u,f),_.base=t.__e,t.__h=null,_.__h.length&&i.push(_),k&&(_.__E=_.__=null),_.__e=!1}else r==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Be(n.__e,t,n,o,l,r,i,f);(d=a.diffed)&&d(t)}catch(S){t.__v=null,(f||r!=null)&&(t.__e=u,t.__h=!!f,r[r.indexOf(u)]=null),a.__e(S,t,n)}}function ve(e,t){a.__c&&a.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(o){o.call(n)})}catch(o){a.__e(o,n.__v)}})}function Be(e,t,n,o,l,r,i,u){var f,d,_,h=n.props,s=t.props,c=t.type,p=0;if(c==="svg"&&(l=!0),r!=null){for(;p<r.length;p++)if((f=r[p])&&"setAttribute"in f==!!c&&(c?f.localName===c:f.nodeType===3)){e=f,r[p]=null;break}}if(e==null){if(c===null)return document.createTextNode(s);e=l?document.createElementNS("http://www.w3.org/2000/svg",c):document.createElement(c,s.is&&s),r=null,u=!1}if(c===null)h===s||u&&e.data===s||(e.data=s);else{if(r=r&&U.call(e.childNodes),d=(h=n.props||W).dangerouslySetInnerHTML,_=s.dangerouslySetInnerHTML,!u){if(r!=null)for(h={},p=0;p<e.attributes.length;p++)h[e.attributes[p].name]=e.attributes[p].value;(_||d)&&(_&&(d&&_.__html==d.__html||_.__html===e.innerHTML)||(e.innerHTML=_&&_.__html||""))}if(Ve(e,s,h,l,u),_)t.__k=[];else if(p=t.props.children,ae(e,Array.isArray(p)?p:[p],t,n,o,l&&c!=="foreignObject",r,i,r?r[0]:n.__k&&N(n,0),u),r!=null)for(p=r.length;p--;)r[p]!=null&&ie(r[p]);u||("value"in s&&(p=s.value)!==void 0&&(p!==h.value||p!==e.value||c==="progress"&&!p)&&L(e,"value",p,h.value,!1),"checked"in s&&(p=s.checked)!==void 0&&p!==e.checked&&L(e,"checked",p,h.checked,!1))}return e}function be(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(o){a.__e(o,n)}}function me(e,t,n){var o,l;if(a.unmount&&a.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||be(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(r){a.__e(r,t)}o.base=o.__P=null}if(o=e.__k)for(l=0;l<o.length;l++)o[l]&&me(o[l],t,typeof e.type!="function");n||e.__e==null||ie(e.__e),e.__e=e.__d=void 0}function qe(e,t,n){return this.constructor(e,n)}function ye(e,t,n){var o,l,r;a.__&&a.__(e,t),l=(o=typeof n=="function")?null:n&&n.__k||t.__k,r=[],Q(t,e=(!o&&n||t).__k=v(O,null,[e]),l||W,W,t.ownerSVGElement!==void 0,!o&&n?[n]:l?null:t.firstChild?U.call(t.childNodes):null,r,!o&&n?n:l?l.__e:t.firstChild,o),ve(r,e)}U=le.slice,a={__e:function(e,t){for(var n,o,l;t=t.__;)if((n=t.__c)&&!n.__)try{if((o=n.constructor)&&o.getDerivedStateFromError!=null&&(n.setState(o.getDerivedStateFromError(e)),l=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e),l=n.__d),l)return n.__E=n}catch(r){e=r}throw e}},oe=0,$.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=C({},this.state),typeof e=="function"&&(e=e(C({},n),this.props)),e&&C(n,e),e!=null&&this.__v&&(t&&this.__h.push(t),se(this))},$.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),se(this))},$.prototype.render=O,A=[],re=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,T.__r=0;var Ge=`.time-cell{display:flex;flex-flow:column nowrap;align-items:center;font-family:sans-serif;font-weight:700}.time-cell.disabled .time-cell-up:before,.time-cell.disabled .time-cell-down:after{border-top-color:#0000000d;border-bottom-color:#0000000d}.time-cell-up:before,.time-cell-down:after{content:"";display:block;width:0;height:0;margin:0 0 4px;border-top:0;border-left:12px solid transparent;border-right:12px solid transparent;border-bottom:12px solid #151515;transition:border-color .4s;cursor:pointer}.time-cell-down:after{margin:4px 0 0;border-top:12px solid #151515;border-bottom:0}.rotor{position:relative;width:36px;height:64px;border-radius:4px;font-size:48px;text-align:center;perspective:200px}.rotor-top,.rotor-bottom{overflow:hidden;position:absolute;width:36px;height:32px}.rotor-leaf{z-index:1;position:absolute;width:36px;height:64px;transform-style:preserve-3d;transition:transform 0s}.rotor-leaf.flipped{transform:rotateX(-180deg);transition:all .5s ease-in-out}.rotor-leaf-front,.rotor-leaf-rear{overflow:hidden;position:absolute;width:36px;height:32px;margin:0;transform:rotateX(0);backface-visibility:hidden;-webkit-backface-visibility:hidden}.rotor-leaf-front{line-height:64px;border-radius:4px 4px 0 0}.rotor-leaf-rear{line-height:0px;border-radius:0 0 4px 4px;transform:rotateX(-180deg)}.rotor-top{line-height:64px;border-radius:4px 4px 0 0}.rotor-bottom{bottom:0;line-height:0px;border-radius:0 0 4px 4px}.rotor:after{content:"";z-index:2;position:absolute;bottom:0px;left:0px;width:36px;height:32px;border-radius:0 0 4px 4px}.rotor,.rotor-top,.rotor-leaf-front{color:#fff;background-color:#151515}.rotor-bottom,.rotor-leaf-rear{color:#efefef;background-color:#202020}.rotor:after{border-top:solid 1px #151515}.telebox-color-scheme-dark .time-cell.disabled .time-cell-up:before,.telebox-color-scheme-dark .time-cell.disabled .time-cell-down:after{border-top-color:#ffffff14;border-bottom-color:#ffffff14}.telebox-color-scheme-dark .time-cell-up:before,.telebox-color-scheme-dark .time-cell-down:after{border-top-color:#d9d9df;border-bottom-color:#d9d9df}.telebox-color-scheme-dark .rotor,.telebox-color-scheme-dark .rotor-top,.telebox-color-scheme-dark .rotor-leaf-front{color:#383838;background-color:#efeff5}.telebox-color-scheme-dark .rotor-bottom,.telebox-color-scheme-dark .rotor-leaf-rear{color:#333;background-color:#eeecec}.telebox-color-scheme-dark .rotor:after{border-top:solid 1px #efeff5}.countdown-clock{display:flex;padding:5px}.countdown-clock>*{padding:0 5px}.countdown-clock-divider{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:0 1px}.countdown-clock-divider:before,.countdown-clock-divider:after{content:"";display:block;width:8px;height:8px;margin:6px 0;background-color:#000;border-radius:50%}.netless-app-countdown{width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;transition:background-color .4s}.netless-app-countdown-shrink{display:inline-block;transition:background-color .4s}.netless-app-countdown-btns{width:100%;margin-top:10px;display:flex;flex-wrap:nowrap}.netless-app-countdown-btns>button{flex:1;display:block;margin:0 10px 0 0;padding:5px 10px;text-align:center;border:0;border-radius:4px;color:#fff;background-color:#3380ff;transition:background-color .4s,color .4s;cursor:pointer}.netless-app-countdown-btns>button:last-of-type{margin:0}.netless-app-countdown-btns>button:disabled{color:#00000040;background:#f5f5f5;cursor:not-allowed}.telebox-color-scheme-dark .netless-app-countdown-btns>button:disabled{color:#ffffff4d;background:rgba(255,255,255,.08)}
`,z,x,ge,V=0,Y=[],ke=a.__b,we=a.__r,xe=a.diffed,Se=a.__c,Me=a.unmount;function j(e,t){a.__h&&a.__h(x,e,V||t),V=0;var n=x.__H||(x.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function H(e){return V=1,Xe(Oe,e)}function Xe(e,t,n){var o=j(z++,2);return o.t=e,o.__c||(o.__=[n?n(t):Oe(void 0,t),function(l){var r=o.t(o.__[0],l);o.__[0]!==r&&(o.__=[r,o.__[1]],o.__c.setState({}))}],o.__c=x),o.__}function E(e,t){var n=j(z++,3);!a.__s&&Pe(n.__H,t)&&(n.__=e,n.__H=t,x.__H.__h.push(n))}function $e(e,t){var n=j(z++,7);return Pe(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function R(e,t){return V=8,$e(function(){return e},t)}function Ze(){var e;for(Y.sort(function(t,n){return t.__v.__b-n.__v.__b});e=Y.pop();)if(e.__P)try{e.__H.__h.forEach(B),e.__H.__h.forEach(ee),e.__H.__h=[]}catch(t){e.__H.__h=[],a.__e(t,e.__v)}}a.__b=function(e){x=null,ke&&ke(e)},a.__r=function(e){we&&we(e),z=0;var t=(x=e.__c).__H;t&&(t.__h.forEach(B),t.__h.forEach(ee),t.__h=[])},a.diffed=function(e){xe&&xe(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(Y.push(t)!==1&&ge===a.requestAnimationFrame||((ge=a.requestAnimationFrame)||function(n){var o,l=function(){clearTimeout(r),Ce&&cancelAnimationFrame(o),setTimeout(n)},r=setTimeout(l,100);Ce&&(o=requestAnimationFrame(l))})(Ze)),x=null},a.__c=function(e,t){t.some(function(n){try{n.__h.forEach(B),n.__h=n.__h.filter(function(o){return!o.__||ee(o)})}catch(o){t.some(function(l){l.__h&&(l.__h=[])}),t=[],a.__e(o,n.__v)}}),Se&&Se(e,t)},a.unmount=function(e){Me&&Me(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(o){try{B(o)}catch(l){t=l}}),t&&a.__e(t,n.__v))};var Ce=typeof requestAnimationFrame=="function";function B(e){var t=x,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),x=t}function ee(e){var t=x;e.__c=e.__(),x=t}function Pe(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Oe(e,t){return typeof t=="function"?t(e):t}function Je(e,t){for(var n in t)e[n]=t[n];return e}function te(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var o in t)if(o!=="__source"&&e[o]!==t[o])return!0;return!1}function He(e){this.props=e}function q(e,t){function n(l){var r=this.props.ref,i=r==l.ref;return!i&&r&&(r.call?r(null):r.current=null),t?!t(this.props,l)||!i:te(this.props,l)}function o(l){return this.shouldComponentUpdate=n,v(e,l)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.prototype.isReactComponent=!0,o.__f=!0,o}(He.prototype=new $).isPureReactComponent=!0,He.prototype.shouldComponentUpdate=function(e,t){return te(this.props,e)||te(this.state,t)};var Ne=a.__b;a.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ne&&Ne(e)};var Ke=a.__e;a.__e=function(e,t,n){if(e.then){for(var o,l=t;l=l.__;)if((o=l.__c)&&o.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t)}Ke(e,t,n)};var Ee=a.unmount;function ne(){this.__u=0,this.t=null,this.__b=null}function Re(e){var t=e.__.__c;return t&&t.__e&&t.__e(e)}function G(){this.u=null,this.o=null}a.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),Ee&&Ee(e)},(ne.prototype=new $).__c=function(e,t){var n=t.__c,o=this;o.t==null&&(o.t=[]),o.t.push(n);var l=Re(o.__v),r=!1,i=function(){r||(r=!0,n.__R=null,l?l(u):u())};n.__R=i;var u=function(){if(!--o.__u){if(o.state.__e){var d=o.state.__e;o.__v.__k[0]=function h(s,c,p){return s&&(s.__v=null,s.__k=s.__k&&s.__k.map(function(k){return h(k,c,p)}),s.__c&&s.__c.__P===c&&(s.__e&&p.insertBefore(s.__e,s.__d),s.__c.__e=!0,s.__c.__P=p)),s}(d,d.__c.__P,d.__c.__O)}var _;for(o.setState({__e:o.__b=null});_=o.t.pop();)_.forceUpdate()}},f=t.__h===!0;o.__u++||f||o.setState({__e:o.__b=o.__v.__k[0]}),e.then(i,i)},ne.prototype.componentWillUnmount=function(){this.t=[]},ne.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=function r(i,u,f){return i&&(i.__c&&i.__c.__H&&(i.__c.__H.__.forEach(function(d){typeof d.__c=="function"&&d.__c()}),i.__c.__H=null),(i=Je({},i)).__c!=null&&(i.__c.__P===f&&(i.__c.__P=u),i.__c=null),i.__k=i.__k&&i.__k.map(function(d){return r(d,u,f)})),i}(this.__b,n,o.__O=o.__P)}this.__b=null}var l=t.__e&&v(O,null,e.fallback);return l&&(l.__h=null),[v(O,null,t.__e?null:e.children),l]};var Ae=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};(G.prototype=new $).__e=function(e){var t=this,n=Re(t.__v),o=t.o.get(e);return o[0]++,function(l){var r=function(){t.props.revealOrder?(o.push(l),Ae(t,e,o)):l()};n?n(r):r()}},G.prototype.render=function(e){this.u=null,this.o=new Map;var t=F(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},G.prototype.componentDidUpdate=G.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){Ae(e,n,t)})};var Qe=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,Ye=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,je=typeof document!="undefined",et=function(e){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};$.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty($.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var De=a.event;function tt(){}function nt(){return this.cancelBubble}function ot(){return this.defaultPrevented}a.event=function(e){return De&&(e=De(e)),e.persist=tt,e.isPropagationStopped=nt,e.isDefaultPrevented=ot,e.nativeEvent=e};var Ue={configurable:!0,get:function(){return this.class}},We=a.vnode;a.vnode=function(e){var t=e.type,n=e.props,o=n;if(typeof t=="string"){var l=t.indexOf("-")===-1;for(var r in o={},n){var i=n[r];je&&r==="children"&&t==="noscript"||r==="value"&&"defaultValue"in n&&i==null||(r==="defaultValue"&&"value"in n&&n.value==null?r="value":r==="download"&&i===!0?i="":/ondoubleclick/i.test(r)?r="ondblclick":/^onchange(textarea|input)/i.test(r+t)&&!et(n.type)?r="oninput":/^onfocus$/i.test(r)?r="onfocusin":/^onblur$/i.test(r)?r="onfocusout":/^on(Ani|Tra|Tou|BeforeInp)/.test(r)?r=r.toLowerCase():l&&Ye.test(r)?r=r.replace(/[A-Z0-9]/,"-$&").toLowerCase():i===null&&(i=void 0),o[r]=i)}t=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=F(n.children).forEach(function(u){u.props.selected=o.value.indexOf(u.props.value)!=-1})),t=="select"&&o.defaultValue!=null&&(o.value=F(n.children).forEach(function(u){u.props.selected=o.multiple?o.defaultValue.indexOf(u.props.value)!=-1:o.defaultValue==u.props.value})),e.props=o,n.class!=n.className&&(Ue.enumerable="className"in n,n.className!=null&&(o.class=n.className),Object.defineProperty(o,"className",Ue))}e.$$typeof=Qe,We&&We(e)};var Ie=a.__r;a.__r=function(e){Ie&&Ie(e)};var ct="",Te={exports:{}};/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o=[],l=0;l<arguments.length;l++){var r=arguments[l];if(!!r){var i=typeof r;if(i==="string"||i==="number")o.push(r);else if(Array.isArray(r)){if(r.length){var u=n.apply(null,r);u&&o.push(u)}}else if(i==="object")if(r.toString===Object.prototype.toString)for(var f in r)t.call(r,f)&&r[f]&&o.push(f);else o.push(r.toString())}}return o.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Te);var Fe=Te.exports;const X=q(({digit:e,disabled:t,onUp:n,onDown:o})=>{const[l,r]=H(0),[i,u]=H(!1);return E(()=>{if(t){u(!0);const f=window.setTimeout(()=>{u(!1),r(e)},500);return()=>window.clearTimeout(f)}else r(e)},[e]),v("div",{class:Fe("time-cell",{disabled:t})},v("div",{class:"time-cell-up",onClick:t?void 0:n}),v("div",{class:"rotor"},v("div",{class:Fe("rotor-leaf",{flipped:i})},v("figure",{class:"rotor-leaf-rear"},e),v("figure",{class:"rotor-leaf-front"},l)),v("div",{class:"rotor-top"},e),v("div",{class:"rotor-bottom"},l)),v("div",{class:"time-cell-down",onClick:t?void 0:o}))});var M;(function(e){e[e.AddTenMinutes=0]="AddTenMinutes",e[e.ReduceTenMinutes=1]="ReduceTenMinutes",e[e.AddOneMinute=2]="AddOneMinute",e[e.ReduceOneMinute=3]="ReduceOneMinute",e[e.AddTenSeconds=4]="AddTenSeconds",e[e.ReduceTenSeconds=5]="ReduceTenSeconds",e[e.AddOneSecond=6]="AddOneSecond",e[e.ReduceOneSecond=7]="ReduceOneSecond"})(M||(M={}));function Le(e){return $e(()=>(e=e%61,[Math.floor(e/10),e%10]),[e])}function P(e,t){return R(()=>e(t),[e])}const rt=q(({minutes:e,seconds:t,disabled:n,onAdjustTime:o})=>{const l=Le(e),r=Le(t),i=P(o,0),u=P(o,1),f=P(o,2),d=P(o,3),_=P(o,4),h=P(o,5),s=P(o,6),c=P(o,7);return v("div",{className:"countdown-clock"},v(X,{disabled:n,digit:l[0],onUp:i,onDown:u}),v(X,{digit:l[1],disabled:n,onUp:f,onDown:d}),v("div",{class:"countdown-clock-divider"}),v(X,{disabled:n,digit:r[0],onUp:_,onDown:h}),v(X,{digit:r[1],disabled:n,onUp:s,onDown:c}))}),_t=q(({readonly:e,countdownSecs:t,startTime:n,paused:o,onAdjustTime:l,onStart:r,onPause:i,onResume:u,onReset:f})=>{const[d,_]=H(0),h=n>0&&d>=n,s=t-(h?d-n:0),c=Math.floor(s/60),p=s-c*60;return E(()=>{let k=NaN;if(t>0&&n>0&&!o){const b=()=>{_(Math.floor(Date.now()/1e3)),k=window.requestAnimationFrame(b)};return b(),()=>window.cancelAnimationFrame(k)}else window.cancelAnimationFrame(k)},[n,o,t]),E(()=>{n>0&&d-n>=t&&f()},[d,n,t,f]),v("div",{class:"netless-app-countdown"},v("div",{class:"netless-app-countdown-shrink"},v(rt,{minutes:c,seconds:p,disabled:e||h,onAdjustTime:l}),v("div",{class:"netless-app-countdown-btns"},o?v(O,null,v("button",{onClick:f,disabled:e},"Reset"),v("button",{onClick:u,disabled:e},"Resume")):h?v("button",{onClick:i,disabled:e},"Pause"):v("button",{onClick:r,disabled:e||s<=0},"Start"))))}),lt=q(({context:e,storage:t})=>{const[n,o]=H(()=>e.getIsWritable()),[l,r]=H(0),[i,u]=H(0),[f,d]=H(!1),_=i>0,h=R(()=>{e.getIsWritable()&&(d(!1),u(Math.floor(Date.now()/1e3)))},[e]),s=R(()=>{e.getIsWritable()&&d(!0)},[e]),c=R(()=>{e.getIsWritable()&&d(!1)},[e]),p=R(()=>{e.getIsWritable()&&(d(!1),r(0),u(0))},[e]),k=R(b=>{_||r(m=>{if(!e.getIsWritable())return m;const y=Math.floor(m/60),w=m-y*60,g=Math.floor(y/10),S=y%10,Z=Math.floor(w/10),J=w%10;switch(b){case M.AddTenMinutes:{const K=S+w===0?7:6;return((g+1)%K*10+S)*60+w}case M.ReduceTenMinutes:{const K=S+w===0?7:6;return((g+K-1)%K*10+S)*60+w}case M.AddOneMinute:return(Math.min(5,g)*10+(S+1)%10)*60+w;case M.ReduceOneMinute:return(Math.min(5,g)*10+(S+10-1)%10)*60+w;case M.AddTenSeconds:return y*60+((Z+1)%6*10+J);case M.ReduceTenSeconds:return y*60+((Z+6-1)%6*10+J);case M.AddOneSecond:return y*60+(Math.min(5,Z)*10+(J+1)%10);case M.ReduceOneSecond:return y*60+(Math.min(5,Z)*10+(J+10-1)%10);default:return m}})},[_,e]);return E(()=>(o(e.getIsWritable()),e.emitter.on("writableChange",o),()=>e.emitter.off("writableChange",o)),[e]),E(()=>{const b=m=>{m.countdownSecs&&r(t.state.countdownSecs),m.paused&&d(t.state.paused),m.startTime&&u(t.state.startTime)};return t.onStateChanged.addListener(b),()=>t.onStateChanged.removeListener(b)},[t]),E(()=>{e.getIsWritable()&&t.setState({countdownSecs:l,paused:f,startTime:i})},[l,f,i,e]),v(_t,{readonly:!n,countdownSecs:l,startTime:i,paused:f,onAdjustTime:k,onStart:h,onPause:s,onResume:c,onReset:p})}),it={kind:"Countdown",config:{minwidth:208,minheight:216},setup(e){const t=e.getBox();t.mountStyles(Ge);const n=e.createStorage("state",{countdownSecs:0,startTime:0,paused:!1});ye(v(lt,{context:e,storage:n}),t.$content),e.emitter.on("destroy",()=>{ye(null,t.$content)})}};return D.default=it,Object.defineProperty(D,"__esModule",{value:!0}),D[Symbol.toStringTag]="Module",D}({});
//# sourceMappingURL=main.iife.js.map
{
"name": "@netless/app-countdown",
"version": "0.0.1",
"version": "0.0.2",
"main": "dist/main.cjs.js",
"module": "dist/main.es.js",
"types": "./dist/index.d.ts",
"unpkg": "dist/main.iife.js",
"jsdelivr": "dist/main.iife.js",
"types": "dist/index.d.ts",
"files": [
"src",
"dist"
],
"devDependencies": {
"preact": "^10.5.15"
"classnames": "^2.3.1",
"preact": "^10.6.4"
},

@@ -10,0 +17,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc