@ampproject/amp-date-countdown
Advanced tools
Comparing version 1.2107302322.0 to 1.2107302322.1
@@ -1,2 +0,2 @@ | ||
var xe=Object.create,D=Object.defineProperty,we=Object.getOwnPropertyDescriptor,Ee=Object.getOwnPropertyNames,Ae=Object.getPrototypeOf,Pe=Object.prototype.hasOwnProperty,oe=function(e){return D(e,"__esModule",{value:!0})},_e=function(e,t){for(var r in oe(e),t)D(e,r,{get:t[r],enumerable:!0})},Ce=function(e,t,r){if(t&&"object"==typeof t||"function"==typeof t)for(var n,o=Ee(t),u=0,a=o.length;u<a;u++)n=o[u],!Pe.call(e,n)&&"default"!==n&&D(e,n,{get:function(e){return t[e]}.bind(null,n),enumerable:!(r=we(t,n))||r.enumerable});return e},j=function(e){return Ce(oe(D(null!=e?xe(Ae(e)):{},"default",e&&e.__esModule&&"default"in e?{get:function(){return e.default},enumerable:!0}:{value:e,enumerable:!0})),e)};_e(exports,{DateCountdown:function(){return fr}});var h=j(require("preact")),ae=j(require("preact")),c=j(require("preact/hooks"));function m(e,t,r){return h.createElement.apply(void 0,arguments)}function ie(e){return h.createContext(e,void 0)}function N(e){return c.useState(e)}function G(e){return c.useRef(e)}function ue(e,t){c.useEffect(e,t)}function I(e,t){c.useLayoutEffect(e,t)}function ce(e){return c.useContext(e)}function w(e,t){return c.useMemo(e,t)}var T=j(require("preact/compat"));function L(e){return T.forwardRef(e)}var De=["as","children","className","contentAs","contentClassName","contentProps","contentRef","contentStyle","layout","paint","size","style","wrapperClassName","wrapperStyle"];function fe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fe(Object(r),!0).forEach((function(t){je(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function je(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ne(e,t){if(null==e)return{};var r,n,o=Ie(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)r=u[n],!(t.indexOf(r)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,r)||(o[r]=e[r]))}return o}function Ie(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)r=u[n],!(t.indexOf(r)>=0)&&(o[r]=e[r]);return o}var Te=[null,"paint","layout","content","size","size paint","size layout","strict"],Le={position:"relative",width:"100%",height:"100%"};function Re(e,t){var r=e.as,n=void 0===r?"div":r,o=e.children,u=e.className,a=e.contentAs,c=void 0===a?"div":a,i=e.contentClassName,l=e.contentProps,f=e.contentRef,s=e.contentStyle,y=e.layout,b=void 0!==y&&y,d=e.paint,O=void 0!==d&&d,v=e.size,h=void 0!==v&&v,g=e.style,j=e.wrapperClassName,w=e.wrapperStyle,S=(h?4:0)+(b?2:0)+(O?1:0);return m(n,p(p({},Ne(e,De)),{},{ref:t,className:"".concat(u||""," ").concat(j||"").trim()||null,style:p(p(p({},g),w),{},{contain:Te[S]})}),m(c,p(p({},l),{},{ref:f,className:i,style:p(p({},h&&Le),{},{overflow:O?"hidden":"visible"},s)}),o))}var Me=L(Re),Ue=["as","children","className","style","wrapperClassName","wrapperStyle"];function le(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?le(Object(r),!0).forEach((function(t){We(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):le(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function We(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ke(e,t){if(null==e)return{};var r,n,o=He(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)r=u[n],!(t.indexOf(r)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,r)||(o[r]=e[r]))}return o}function He(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)r=u[n],!(t.indexOf(r)>=0)&&(o[r]=e[r]);return o}function $e(e,t){var r=e.as,n=void 0===r?"div":r,o=e.children,u=e.className,a=e.style,c=e.wrapperClassName,i=e.wrapperStyle;return m(n,R(R({},ke(e,Ue)),{},{ref:t,className:"".concat(u||""," ").concat(c||"").trim()||null,style:R(R({},a),i)}),o)}var B=L($e);function Ye(e,t){return Ge(e)||Ze(e,t)||Fe(e,t)||ze()}function ze(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Fe(e,t){if(e){if("string"==typeof e)return se(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return se(e,t)}}function se(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ze(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,u=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(u.push(n.value),!t||u.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{!a&&null!=r.return&&r.return()}finally{if(c)throw o}}return u}}function Ge(e){if(Array.isArray(e))return e}function K(e,t){var r=Ye(N(null),2),n=r[0],o=r[1];return I((function(){var r=e&&e(t)||null;if(r&&"function"==typeof r.then){var n=!1;return r.then((function(e){n||o(e)})),function(){n=!0}}o(r)}),[e,t]),n}var pe=Object.prototype,Wr=pe.hasOwnProperty,kr=pe.toString;function V(e){return e||{}}function me(e){return"string"==typeof e}function Be(e){if(!e)return null;if("now"===e.toLowerCase())return Date.now();var t=Date.parse(e);return isNaN(t)?null:t}function de(e){return e?"number"==typeof e?e:me(e)?Be(e):(e=e).getTime():null}function J(e){return Ke[e]}var b,Ke={de:["Jahren","Monaten","Tagen","Stunden","Minuten","Sekunden"],en:["Years","Months","Days","Hours","Minutes","Seconds"],es:["años","meses","días","horas","minutos","segundos"],fr:["ans","mois","jours","heures","minutes","secondes"],id:["tahun","bulan","hari","jam","menit","detik"],it:["anni","mesi","giorni","ore","minuti","secondi"],ja:["年","ヶ月","日","時間","分","秒"],ko:["년","달","일","시간","분","초"],nl:["jaar","maanden","dagen","uur","minuten","seconden"],pt:["anos","meses","dias","horas","minutos","segundos"],ru:["год","месяц","день","час","минута","секунда"],th:["ปี","เดือน","วัน","ชั่วโมง","นาที","วินาที"],tr:["yıl","ay","gün","saat","dakika","saniye"],vi:["năm","tháng","ngày","giờ","phút","giây"],"zh-cn":["年","月","天","小时","分钟","秒"],"zh-tw":["年","月","天","小時","分鐘","秒"]};function M(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ye,s={AUTO:"auto",LAZY:"lazy",EAGER:"eager",UNLOAD:"unload"},Zr=[s.AUTO,s.LAZY,s.EAGER,s.UNLOAD],Gr=(M(b={},s.AUTO,0),M(b,s.LAZY,1),M(b,s.EAGER,2),M(b,s.UNLOAD,3),b);function Ve(){return ye||(ye=ie({renderable:!0,playable:!0,loading:s.AUTO}))}function U(){return ce(Ve())}function ve(){var e=U().notify;I((function(){e&&e()}))}var Je=["datetime","whenEnded","locale","biggestUnit","countUp","render"];function he(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function W(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?he(Object(r),!0).forEach((function(t){qe(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):he(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function qe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function k(e){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Qe(e,t){return tr(e)||rr(e,t)||er(e,t)||Xe()}function Xe(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function er(e,t){if(e){if("string"==typeof e)return be(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return be(e,t)}}function be(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function rr(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,u=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(u.push(n.value),!t||u.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{!a&&null!=r.return&&r.return()}finally{if(c)throw o}}return u}}function tr(e){if(Array.isArray(e))return e}function nr(e,t){if(null==e)return{};var r,n,o=or(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)r=u[n],!(t.indexOf(r)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,r)||(o[r]=e[r]))}return o}function or(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)r=u[n],!(t.indexOf(r)>=0)&&(o[r]=e[r]);return o}var ar="DateCountdown",ge=864e5,q=36e5,Q=6e4,Oe=1e3,X=1e3,l={DAYS:1,HOURS:2,MINUTES:3,SECONDS:4},ee="en",Se="stop",ir="DAYS",ur=!1,cr=function(e){return"".concat(e.days," ").concat(e.dd,", ")+"".concat(e.hours," ").concat(e.hh,", ")+"".concat(e.minutes," ").concat(e.mm,", ")+"".concat(e.seconds," ").concat(e.ss)};function fr(e){var t=e.datetime,r=e.whenEnded,n=void 0===r?Se:r,o=e.locale,u=void 0===o?ee:o,a=e.biggestUnit,c=void 0===a?ir:a,i=e.countUp,l=void 0===i?ur:i,f=e.render,s=void 0===f?cr:f,p=nr(e,Je);ve();var y=U().playable,b=w((function(){return de(t)}),[t]),d=w((function(){return sr(u)}),[u]),O=Qe(N(b-Date.now()+X),2),v=O[0],h=O[1],g=w((function(){return lr(v,c,d,l)}),[v,c,d,l]),j=G(null);ue((function(){if(y&&j.current){var e=j.current.ownerDocument.defaultView,t=e.setInterval((function(){var r=b-Date.now()+X;h(r),n===Se&&r<1e3&&e.clearInterval(t)}),X);return function(){return e.clearInterval(t)}}}),[y,b,n]);var S=K(s,g),P=S&&"object"==k(S)&&"__html"in S;return m(B,W(W({},p),{},{ref:j,dangerouslySetInnerHTML:P?S:null}),P?null:S)}function lr(e,t,r,n){return W(W({},pr(e,t,n)),r)}function sr(e){void 0===J(e)&&(mr("Invalid locale ".concat(e,", defaulting to ").concat(ee,". ").concat(ar)),e=ee);var t=J(e);return V({years:t[0],months:t[1],days:t[2],hours:t[3],minutes:t[4],seconds:t[5]})}function pr(e,t,r){r&&(e*=-1);var n=l[t]==l.DAYS?d(Math.floor(e/ge)):0,o=l[t]==l.HOURS?d(Math.floor(e/q)):l[t]<l.HOURS?d(Math.floor(e%ge/q)):0,u=l[t]==l.MINUTES?d(Math.floor(e/Q)):l[t]<l.MINUTES?d(Math.floor(e%q/Q)):0,a=l[t]==l.SECONDS?d(Math.floor(e/Oe)):d(Math.floor(e%Q/Oe));return V({d:n,dd:H(n),h:o,hh:H(o),m:u,mm:H(u),s:a,ss:H(a)})}function H(e){return e<-9||e>9?String(e):e>=-9&&e<0?"-0"+-e:"0"+e}function d(e){return e<0?e+1:e}function mr(e){console.warn(e)} | ||
//# sourceMappingURL=component-preact.js.map | ||
; | ||
var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__markAsModule=function(e){return __defProp(e,"__esModule",{value:!0})},__export=function(e,t){for(var r in __markAsModule(e),t)__defProp(e,r,{get:t[r],enumerable:!0})},__reExport=function(e,t,r){if(t&&"object"==typeof t||"function"==typeof t)for(var n,o=__getOwnPropNames(t),a=0,i=o.length;a<i;a++)n=o[a],__hasOwnProp.call(e,n)||"default"===n||__defProp(e,n,{get:function(e){return t[e]}.bind(null,n),enumerable:!(r=__getOwnPropDesc(t,n))||r.enumerable});return e},__toModule=function(e){return __reExport(__markAsModule(__defProp(null!=e?__create(__getProtoOf(e)):{},"default",e&&e.__esModule&&"default"in e?{get:function(){return e.default},enumerable:!0}:{value:e,enumerable:!0})),e)};__export(exports,{DateCountdown:function(){return DateCountdown}});var preact=__toModule(require("preact")),preactDOM=__toModule(require("preact")),hooks=__toModule(require("preact/hooks"));function createElement2(e,t,r){return preact.createElement.apply(void 0,arguments)}function createContext2(e){return preact.createContext(e,void 0)}function useState2(e){return hooks.useState(e)}function useRef2(e){return hooks.useRef(e)}function useEffect2(e,t){hooks.useEffect(e,t)}function useLayoutEffect2(e,t){hooks.useLayoutEffect(e,t)}function useContext2(e){return hooks.useContext(e)}function useMemo2(e,t){return hooks.useMemo(e,t)}var compat=__toModule(require("preact/compat"));function forwardRef2(e){return compat.forwardRef(e)}var _excluded=["as","children","className","contentAs","contentClassName","contentProps","contentRef","contentStyle","layout","paint","size","style","wrapperClassName","wrapperStyle"];function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _objectWithoutProperties(e,t){if(null==e)return{};var r,n,o=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}var CONTAIN=[null,"paint","layout","content","size","size paint","size layout","strict"],SIZE_CONTENT_STYLE={"position":"relative","width":"100%","height":"100%"};function ContainWrapperWithRef(e,t){var r=e.as,n=void 0===r?"div":r,o=e.children,a=e.className,i=e.contentAs,u=void 0===i?"div":i,c=e.contentClassName,l=e.contentProps,s=e.contentRef,p=e.contentStyle,f=e.layout,y=void 0!==f&&f,_=e.paint,d=void 0!==_&&_,b=e.size,O=void 0!==b&&b,m=e.style,S=e.wrapperClassName,g=e.wrapperStyle,h=(O?4:0)+(y?2:0)+(d?1:0);return createElement2(n,_objectSpread(_objectSpread({},_objectWithoutProperties(e,_excluded)),{},{ref:t,className:"".concat(a||""," ").concat(S||"").trim()||null,style:_objectSpread(_objectSpread(_objectSpread({},m),g),{},{contain:CONTAIN[h]})}),createElement2(u,_objectSpread(_objectSpread({},l),{},{ref:s,className:c,style:_objectSpread(_objectSpread({},O&&SIZE_CONTENT_STYLE),{},{"overflow":d?"hidden":"visible"},p)}),o))}var ContainWrapper=forwardRef2(ContainWrapperWithRef),_excluded2=["as","children","className","style","wrapperClassName","wrapperStyle"];function ownKeys2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys2(Object(r),!0).forEach((function(t){_defineProperty2(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys2(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty2(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _objectWithoutProperties2(e,t){if(null==e)return{};var r,n,o=_objectWithoutPropertiesLoose2(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function _objectWithoutPropertiesLoose2(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}function WrapperWithRef(e,t){var r=e.as,n=void 0===r?"div":r,o=e.children,a=e.className,i=e.style,u=e.wrapperClassName,c=e.wrapperStyle;return createElement2(n,_objectSpread2(_objectSpread2({},_objectWithoutProperties2(e,_excluded2)),{},{ref:t,className:"".concat(a||""," ").concat(u||"").trim()||null,style:_objectSpread2(_objectSpread2({},i),c)}),o)}var Wrapper=forwardRef2(WrapperWithRef);function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){u=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function useRenderer(e,t){var r=_slicedToArray(useState2(null),2),n=r[0],o=r[1];return useLayoutEffect2((function(){var r=e&&e(t)||null;if(r&&"function"==typeof r.then){var n=!1;return r.then((function(e){n||o(e)})),function(){n=!0}}o(r)}),[e,t]),n}var _Object$prototype=Object.prototype,hasOwn_=_Object$prototype.hasOwnProperty,toString_=_Object$prototype.toString;function dict(e){return e||{}}function isString(e){return"string"==typeof e}function parseDate(e){if(!e)return null;if("now"===e.toLowerCase())return Date.now();var t=Date.parse(e);return isNaN(t)?null:t}function getDate(e){return e?"number"==typeof e?e:isString(e)?parseDate(e):(e=e).getTime():null}function getLocaleStrings(e){return LOCALE_WORD[e]}var _MAP,LOCALE_WORD={"de":["Jahren","Monaten","Tagen","Stunden","Minuten","Sekunden"],"en":["Years","Months","Days","Hours","Minutes","Seconds"],"es":["años","meses","días","horas","minutos","segundos"],"fr":["ans","mois","jours","heures","minutes","secondes"],"id":["tahun","bulan","hari","jam","menit","detik"],"it":["anni","mesi","giorni","ore","minuti","secondi"],"ja":["年","ヶ月","日","時間","分","秒"],"ko":["년","달","일","시간","분","초"],"nl":["jaar","maanden","dagen","uur","minuten","seconden"],"pt":["anos","meses","dias","horas","minutos","segundos"],"ru":["год","месяц","день","час","минута","секунда"],"th":["ปี","เดือน","วัน","ชั่วโมง","นาที","วินาที"],"tr":["yıl","ay","gün","saat","dakika","saniye"],"vi":["năm","tháng","ngày","giờ","phút","giây"],"zh-cn":["年","月","天","小时","分钟","秒"],"zh-tw":["年","月","天","小時","分鐘","秒"]};function _defineProperty3(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var context,Loading={AUTO:"auto",LAZY:"lazy",EAGER:"eager",UNLOAD:"unload"},ORDER=[Loading.AUTO,Loading.LAZY,Loading.EAGER,Loading.UNLOAD],MAP=(_defineProperty3(_MAP={},Loading.AUTO,0),_defineProperty3(_MAP,Loading.LAZY,1),_defineProperty3(_MAP,Loading.EAGER,2),_defineProperty3(_MAP,Loading.UNLOAD,3),_MAP);function getAmpContext(){return context||(context=createContext2({renderable:!0,playable:!0,loading:Loading.AUTO}))}function useAmpContext(){return useContext2(getAmpContext())}function useResourcesNotify(){var e=useAmpContext().notify;useLayoutEffect2((function(){e&&e()}))}var _excluded3=["datetime","whenEnded","locale","biggestUnit","countUp","render"];function ownKeys3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread3(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys3(Object(r),!0).forEach((function(t){_defineProperty4(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys3(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty4(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _slicedToArray2(e,t){return _arrayWithHoles2(e)||_iterableToArrayLimit2(e,t)||_unsupportedIterableToArray2(e,t)||_nonIterableRest2()}function _nonIterableRest2(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray2(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray2(e,t):void 0}}function _arrayLikeToArray2(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit2(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){u=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}function _arrayWithHoles2(e){if(Array.isArray(e))return e}function _objectWithoutProperties3(e,t){if(null==e)return{};var r,n,o=_objectWithoutPropertiesLoose3(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function _objectWithoutPropertiesLoose3(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}var NAME="DateCountdown",MILLISECONDS_IN_DAY=864e5,MILLISECONDS_IN_HOUR=36e5,MILLISECONDS_IN_MINUTE=6e4,MILLISECONDS_IN_SECOND=1e3,DELAY=1e3,TimeUnit={DAYS:1,HOURS:2,MINUTES:3,SECONDS:4},DEFAULT_LOCALE="en",DEFAULT_WHEN_ENDED="stop",DEFAULT_BIGGEST_UNIT="DAYS",DEFAULT_COUNT_UP=!1,DEFAULT_RENDER=function(e){return"".concat(e.days," ").concat(e.dd,", ")+"".concat(e.hours," ").concat(e.hh,", ")+"".concat(e.minutes," ").concat(e.mm,", ")+"".concat(e.seconds," ").concat(e.ss)};function DateCountdown(e){var t=e.datetime,r=e.whenEnded,n=void 0===r?DEFAULT_WHEN_ENDED:r,o=e.locale,a=void 0===o?DEFAULT_LOCALE:o,i=e.biggestUnit,u=void 0===i?DEFAULT_BIGGEST_UNIT:i,c=e.countUp,l=void 0===c?DEFAULT_COUNT_UP:c,s=e.render,p=void 0===s?DEFAULT_RENDER:s,f=_objectWithoutProperties3(e,_excluded3);useResourcesNotify();var y=useAmpContext().playable,_=useMemo2((function(){return getDate(t)}),[t]),d=useMemo2((function(){return getLocaleWord(a)}),[a]),b=_slicedToArray2(useState2(_-Date.now()+DELAY),2),O=b[0],m=b[1],S=useMemo2((function(){return getDataForTemplate(O,u,d,l)}),[O,u,d,l]),g=useRef2(null);useEffect2((function(){if(y&&g.current){var e=g.current.ownerDocument.defaultView,t=e.setInterval((function(){var r=_-Date.now()+DELAY;m(r),n===DEFAULT_WHEN_ENDED&&r<1e3&&e.clearInterval(t)}),DELAY);return function(){return e.clearInterval(t)}}}),[y,_,n]);var h=useRenderer(p,S),E=h&&"object"==_typeof(h)&&"__html"in h;return createElement2(Wrapper,_objectSpread3(_objectSpread3({},f),{},{ref:g,dangerouslySetInnerHTML:E?h:null}),E?null:h)}function getDataForTemplate(e,t,r,n){return _objectSpread3(_objectSpread3({},getYDHMSFromMs(e,t,n)),r)}function getLocaleWord(e){void 0===getLocaleStrings(e)&&(displayWarning("Invalid locale ".concat(e,", defaulting to ").concat(DEFAULT_LOCALE,". ").concat(NAME)),e=DEFAULT_LOCALE);var t=getLocaleStrings(e);return dict({"years":t[0],"months":t[1],"days":t[2],"hours":t[3],"minutes":t[4],"seconds":t[5]})}function getYDHMSFromMs(e,t,r){r&&(e*=-1);var n=TimeUnit[t]==TimeUnit.DAYS?supportBackDate(Math.floor(e/MILLISECONDS_IN_DAY)):0,o=TimeUnit[t]==TimeUnit.HOURS?supportBackDate(Math.floor(e/MILLISECONDS_IN_HOUR)):TimeUnit[t]<TimeUnit.HOURS?supportBackDate(Math.floor(e%MILLISECONDS_IN_DAY/MILLISECONDS_IN_HOUR)):0,a=TimeUnit[t]==TimeUnit.MINUTES?supportBackDate(Math.floor(e/MILLISECONDS_IN_MINUTE)):TimeUnit[t]<TimeUnit.MINUTES?supportBackDate(Math.floor(e%MILLISECONDS_IN_HOUR/MILLISECONDS_IN_MINUTE)):0,i=TimeUnit[t]==TimeUnit.SECONDS?supportBackDate(Math.floor(e/MILLISECONDS_IN_SECOND)):supportBackDate(Math.floor(e%MILLISECONDS_IN_MINUTE/MILLISECONDS_IN_SECOND));return dict({"d":n,"dd":padStart(n),"h":o,"hh":padStart(o),"m":a,"mm":padStart(a),"s":i,"ss":padStart(i)})}function padStart(e){return e<-9||e>9?String(e):e>=-9&&e<0?"-0"+-e:"0"+e}function supportBackDate(e){return e<0?e+1:e}function displayWarning(e){console.warn(e)} |
@@ -1,2 +0,2 @@ | ||
import{cloneElement as Ye,createContext as re,createElement as te,createRef as Ve}from"preact";import{hydrate as Fe,render as ze}from"preact";import{useCallback as Ze,useContext as ae,useEffect as ie,useImperativeHandle as Ge,useLayoutEffect as ce,useMemo as ue,useRef as oe,useState as ne}from"preact/hooks";function f(e,t,n){return te.apply(void 0,arguments)}function Y(e){return re(e,void 0)}function P(e){return ne(e)}function _(e){return oe(e)}function z(e,t){ie(e,t)}function S(e,t){ce(e,t)}function F(e){return ae(e)}function x(e,t){return ue(e,t)}import{Children as Je,createPortal as qe,forwardRef as se}from"preact/compat";function D(e){return se(e)}var fe=["as","children","className","contentAs","contentClassName","contentProps","contentRef","contentStyle","layout","paint","size","style","wrapperClassName","wrapperStyle"];function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach((function(t){le(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function le(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pe(e,t){if(null==e)return{};var n,r,o=me(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(o[n]=e[n]))}return o}function me(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}var de=[null,"paint","layout","content","size","size paint","size layout","strict"],he={position:"relative",width:"100%",height:"100%"};function Oe(e,t){let{as:n="div",children:r,className:o,contentAs:a="div",contentClassName:u,contentProps:c,contentRef:i,contentStyle:l,layout:p=!1,paint:y=!1,size:O=!1,style:b,wrapperClassName:m,wrapperStyle:d}=e,h=(O?4:0)+(p?2:0)+(y?1:0);return f(n,s(s({},pe(e,fe)),{},{ref:t,className:`${o||""} ${m||""}`.trim()||null,style:s(s(s({},b),d),{},{contain:de[h]})}),f(a,s(s({},c),{},{ref:i,className:u,style:s(s({},O&&he),{},{overflow:y?"hidden":"visible"},l)}),r))}var ye=D(Oe),ge=["as","children","className","style","wrapperClassName","wrapperStyle"];function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function j(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(n),!0).forEach((function(t){xe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function be(e,t){if(null==e)return{};var n,r,o=we(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(o[n]=e[n]))}return o}function we(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}function Ee(e,t){let{as:n="div",children:r,className:o,style:a,wrapperClassName:u,wrapperStyle:c}=e;return f(n,j(j({},be(e,ge)),{},{ref:t,className:`${o||""} ${u||""}`.trim()||null,style:j(j({},a),c)}),r)}var L=D(Ee);function R(e,t){let{0:n,1:r}=P(null);return S((()=>{let n=e&&e(t)||null;if(n&&"function"==typeof n.then){let e=!1;return n.then((t=>{e||r(t)})),()=>{e=!0}}r(n)}),[e,t]),n}var{hasOwnProperty:xt,toString:bt}=Object.prototype;function I(e){return e||{}}function G(e){return"string"==typeof e}function Pe(e){if(!e)return null;if("now"===e.toLowerCase())return Date.now();let t=Date.parse(e);return isNaN(t)?null:t}function B(e){return e?"number"==typeof e?e:G(e)?Pe(e):(e=e).getTime():null}function M(e){return Se[e]}var K,Se={de:["Jahren","Monaten","Tagen","Stunden","Minuten","Sekunden"],en:["Years","Months","Days","Hours","Minutes","Seconds"],es:["años","meses","días","horas","minutos","segundos"],fr:["ans","mois","jours","heures","minutes","secondes"],id:["tahun","bulan","hari","jam","menit","detik"],it:["anni","mesi","giorni","ore","minuti","secondi"],ja:["年","ヶ月","日","時間","分","秒"],ko:["년","달","일","시간","분","초"],nl:["jaar","maanden","dagen","uur","minuten","seconden"],pt:["anos","meses","dias","horas","minutos","segundos"],ru:["год","месяц","день","час","минута","секунда"],th:["ปี","เดือน","วัน","ชั่วโมง","นาที","วินาที"],tr:["yıl","ay","gün","saat","dakika","saniye"],vi:["năm","tháng","ngày","giờ","phút","giây"],"zh-cn":["年","月","天","小时","分钟","秒"],"zh-tw":["年","月","天","小時","分鐘","秒"]},u={AUTO:"auto",LAZY:"lazy",EAGER:"eager",UNLOAD:"unload"},jt=[u.AUTO,u.LAZY,u.EAGER,u.UNLOAD],Ct={[u.AUTO]:0,[u.LAZY]:1,[u.EAGER]:2,[u.UNLOAD]:3};function De(){return K||(K=Y({renderable:!0,playable:!0,loading:u.AUTO}))}function C(){return F(De())}function q(){let{notify:e}=C();S((()=>{e&&e()}))}var je=["datetime","whenEnded","locale","biggestUnit","countUp","render"];function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){Ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ne(e,t){if(null==e)return{};var n,r,o=ve(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(o[n]=e[n]))}return o}function ve(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}var Ae="DateCountdown",Q=864e5,T=36e5,U=6e4,X=1e3,k=1e3,c={DAYS:1,HOURS:2,MINUTES:3,SECONDS:4},W="en",ee="stop",_e="DAYS",Le=!1,Re=e=>`${e.days} ${e.dd}, ${e.hours} ${e.hh}, ${e.minutes} ${e.mm}, ${e.seconds} ${e.ss}`;function Vt(e){let{datetime:t,whenEnded:n=ee,locale:r=W,biggestUnit:o=_e,countUp:a=Le,render:u=Re}=e,c=Ne(e,je);q();let{playable:s}=C(),i=x((()=>B(t)),[t]),l=x((()=>Me(r)),[r]),{0:p,1:y}=P(i-Date.now()+k),O=x((()=>Ie(p,o,l,a)),[p,o,l,a]),b=_(null);z((()=>{if(!s||!b.current)return;let e=b.current.ownerDocument.defaultView,t=e.setInterval((()=>{let r=i-Date.now()+k;y(r),n===ee&&r<1e3&&e.clearInterval(t)}),k);return()=>e.clearInterval(t)}),[s,i,n]);let m=R(u,O),d=m&&"object"==typeof m&&"__html"in m;return f(L,N(N({},c),{},{ref:b,dangerouslySetInnerHTML:d?m:null}),d?null:m)}function Ie(e,t,n,r){return N(N({},Te(e,t,r)),n)}function Me(e){void 0===M(e)&&(Ue(`Invalid locale ${e}, defaulting to ${W}. ${Ae}`),e=W);let t=M(e);return I({years:t[0],months:t[1],days:t[2],hours:t[3],minutes:t[4],seconds:t[5]})}function Te(e,t,n){n&&(e*=-1);let r=c[t]==c.DAYS?p(Math.floor(e/Q)):0,o=c[t]==c.HOURS?p(Math.floor(e/T)):c[t]<c.HOURS?p(Math.floor(e%Q/T)):0,a=c[t]==c.MINUTES?p(Math.floor(e/U)):c[t]<c.MINUTES?p(Math.floor(e%T/U)):0,u=c[t]==c.SECONDS?p(Math.floor(e/X)):p(Math.floor(e%U/X));return I({d:r,dd:v(r),h:o,hh:v(o),m:a,mm:v(a),s:u,ss:v(u)})}function v(e){return e<-9||e>9?String(e):e>=-9&&e<0?"-0"+-e:"0"+e}function p(e){return e<0?e+1:e}function Ue(e){console.warn(e)}export{Vt as DateCountdown}; | ||
//# sourceMappingURL=component-preact.module.js.map | ||
; | ||
import{cloneElement as e,createContext as t,createElement as n,createRef as r}from"preact";import{hydrate as o,render as a}from"preact";import{useCallback as i,useContext as c,useEffect as s,useImperativeHandle as u,useLayoutEffect as l,useMemo as f,useRef as p,useState as y}from"preact/hooks";function b(e,t,r){return n.apply(void 0,arguments)}function O(e){return y(e)}function m(e,t){l(e,t)}function d(e,t){return f(e,t)}import{Children as h,createPortal as g,forwardRef as j}from"preact/compat";function w(e){return j(e)}var v=["as","children","className","contentAs","contentClassName","contentProps","contentRef","contentStyle","layout","paint","size","style","wrapperClassName","wrapperStyle"];function S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach((function(t){D(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N=[null,"paint","layout","content","size","size paint","size layout","strict"],E={"position":"relative","width":"100%","height":"100%"};w((function(e,t){let{as:n="div",children:r,"className":o,contentAs:a="div",contentClassName:i,contentProps:c,contentRef:s,contentStyle:u,layout:l=!1,paint:f=!1,size:p=!1,"style":y,wrapperClassName:O,wrapperStyle:m}=e;const d=(p?4:0)+(l?2:0)+(f?1:0);return b(n,P(P({},function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,v)),{},{ref:t,className:`${o||""} ${O||""}`.trim()||null,style:P(P(P({},y),m),{},{contain:N[d]})}),b(a,P(P({},c),{},{ref:s,className:i,style:P(P({},p&&E),{},{"overflow":f?"hidden":"visible"},u)}),r))}));var M=["as","children","className","style","wrapperClassName","wrapperStyle"];function $(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach((function(t){I(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var C=w((function(e,t){let{as:n="div",children:r,"className":o,"style":a,wrapperClassName:i,wrapperStyle:c}=e;return b(n,k(k({},function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,M)),{},{ref:t,className:`${o||""} ${i||""}`.trim()||null,style:k(k({},a),c)}),r)})),{hasOwnProperty:U,toString:x}=Object.prototype;function z(e){return e||{}}function T(e){return H[e]}var A,H={"de":["Jahren","Monaten","Tagen","Stunden","Minuten","Sekunden"],"en":["Years","Months","Days","Hours","Minutes","Seconds"],"es":["años","meses","días","horas","minutos","segundos"],"fr":["ans","mois","jours","heures","minutes","secondes"],"id":["tahun","bulan","hari","jam","menit","detik"],"it":["anni","mesi","giorni","ore","minuti","secondi"],"ja":["年","ヶ月","日","時間","分","秒"],"ko":["년","달","일","시간","분","초"],"nl":["jaar","maanden","dagen","uur","minuten","seconden"],"pt":["anos","meses","dias","horas","minutos","segundos"],"ru":["год","месяц","день","час","минута","секунда"],"th":["ปี","เดือน","วัน","ชั่วโมง","นาที","วินาที"],"tr":["yıl","ay","gün","saat","dakika","saniye"],"vi":["năm","tháng","ngày","giờ","phút","giây"],"zh-cn":["年","月","天","小时","分钟","秒"],"zh-tw":["年","月","天","小時","分鐘","秒"]};function R(){const e=A||(A=t({renderable:!0,playable:!0,loading:"auto"},void 0));return c(e)}var Y=["datetime","whenEnded","locale","biggestUnit","countUp","render"];function L(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?L(Object(n),!0).forEach((function(t){J(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var V={DAYS:1,HOURS:2,MINUTES:3,SECONDS:4},q="en",B="stop",F="DAYS",G=!1,K=e=>`${e.days} ${e.dd}, ${e.hours} ${e.hh}, ${e.minutes} ${e.mm}, ${e.seconds} ${e.ss}`;function Q(e){let{datetime:t,whenEnded:n=B,locale:r=q,biggestUnit:o=F,countUp:a=G,render:i=K}=e,c=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Y);!function(){const{notify:e}=R();m((()=>{e&&e()}))}();const{playable:u}=R(),l=d((()=>{return(e=t)?"number"==typeof e?e:"string"==typeof e?function(e){if(!e)return null;if("now"===e.toLowerCase())return Date.now();const t=Date.parse(e);return isNaN(t)?null:t}(e):(e=e).getTime():null;var e}),[t]),f=d((()=>function(e){var t;void 0===T(e)&&(t=`Invalid locale ${e}, defaulting to ${q}. DateCountdown`,console.warn(t),e=q);const n=T(e);return z({"years":n[0],"months":n[1],"days":n[2],"hours":n[3],"minutes":n[4],"seconds":n[5]})}(r)),[r]),{0:y,1:h}=O(l-Date.now()+1e3),g=d((()=>function(e,t,n,r){return _(_({},function(e,t,n){n&&(e*=-1);const r=V[t]==V.DAYS?X(Math.floor(e/864e5)):0,o=V[t]==V.HOURS?X(Math.floor(e/36e5)):V[t]<V.HOURS?X(Math.floor(e%864e5/36e5)):0,a=V[t]==V.MINUTES?X(Math.floor(e/6e4)):V[t]<V.MINUTES?X(Math.floor(e%36e5/6e4)):0,i=X(V[t]==V.SECONDS?Math.floor(e/1e3):Math.floor(e%6e4/1e3));return z({"d":r,"dd":W(r),"h":o,"hh":W(o),"m":a,"mm":W(a),"s":i,"ss":W(i)})}(e,t,r)),n)}(y,o,f,a)),[y,o,f,a]),j=p(null);s((()=>{if(!u||!j.current)return;const e=j.current.ownerDocument.defaultView,t=e.setInterval((()=>{const r=l-Date.now()+1e3;h(r),n===B&&r<1e3&&e.clearInterval(t)}),1e3);return()=>e.clearInterval(t)}),[u,l,n]);const w=function(e,t){const{0:n,1:r}=O(null);return m((()=>{const n=e&&e(t)||null;if(n&&"function"==typeof n.then){let e=!1;return n.then((t=>{e||r(t)})),()=>{e=!0}}r(n)}),[e,t]),n}(i,g),v=w&&"object"==typeof w&&"__html"in w;return b(C,_(_({},c),{},{ref:j,dangerouslySetInnerHTML:v?w:null}),v?null:w)}function W(e){return e<-9||e>9?String(e):e>=-9&&e<0?"-0"+-e:"0"+e}function X(e){return e<0?e+1:e}export{Q as DateCountdown}; |
@@ -1,2 +0,2 @@ | ||
var xe=Object.create,D=Object.defineProperty,we=Object.getOwnPropertyDescriptor,Ee=Object.getOwnPropertyNames,Ae=Object.getPrototypeOf,Pe=Object.prototype.hasOwnProperty,oe=function(e){return D(e,"__esModule",{value:!0})},_e=function(e,t){for(var r in oe(e),t)D(e,r,{get:t[r],enumerable:!0})},Ce=function(e,t,r){if(t&&"object"==typeof t||"function"==typeof t)for(var n,o=Ee(t),u=0,a=o.length;u<a;u++)n=o[u],!Pe.call(e,n)&&"default"!==n&&D(e,n,{get:function(e){return t[e]}.bind(null,n),enumerable:!(r=we(t,n))||r.enumerable});return e},j=function(e){return Ce(oe(D(null!=e?xe(Ae(e)):{},"default",e&&e.__esModule&&"default"in e?{get:function(){return e.default},enumerable:!0}:{value:e,enumerable:!0})),e)};_e(exports,{DateCountdown:function(){return fr}});var h=j(require("react")),ae=j(require("react-dom")),c=j(require("react"));function m(e,t,r){return h.createElement.apply(void 0,arguments)}function ie(e){return h.createContext(e,void 0)}function N(e){return c.useState(e)}function G(e){return c.useRef(e)}function ue(e,t){c.useEffect(e,t)}function I(e,t){c.useLayoutEffect(e,t)}function ce(e){return c.useContext(e)}function w(e,t){return c.useMemo(e,t)}var T=j(require("react"));function L(e){return T.forwardRef(e)}var De=["as","children","className","contentAs","contentClassName","contentProps","contentRef","contentStyle","layout","paint","size","style","wrapperClassName","wrapperStyle"];function fe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fe(Object(r),!0).forEach((function(t){je(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function je(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ne(e,t){if(null==e)return{};var r,n,o=Ie(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)r=u[n],!(t.indexOf(r)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,r)||(o[r]=e[r]))}return o}function Ie(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)r=u[n],!(t.indexOf(r)>=0)&&(o[r]=e[r]);return o}var Te=[null,"paint","layout","content","size","size paint","size layout","strict"],Le={position:"relative",width:"100%",height:"100%"};function Re(e,t){var r=e.as,n=void 0===r?"div":r,o=e.children,u=e.className,a=e.contentAs,c=void 0===a?"div":a,i=e.contentClassName,l=e.contentProps,f=e.contentRef,s=e.contentStyle,y=e.layout,b=void 0!==y&&y,d=e.paint,O=void 0!==d&&d,v=e.size,h=void 0!==v&&v,g=e.style,j=e.wrapperClassName,w=e.wrapperStyle,S=(h?4:0)+(b?2:0)+(O?1:0);return m(n,p(p({},Ne(e,De)),{},{ref:t,className:"".concat(u||""," ").concat(j||"").trim()||null,style:p(p(p({},g),w),{},{contain:Te[S]})}),m(c,p(p({},l),{},{ref:f,className:i,style:p(p({},h&&Le),{},{overflow:O?"hidden":"visible"},s)}),o))}var Me=L(Re),Ue=["as","children","className","style","wrapperClassName","wrapperStyle"];function le(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?le(Object(r),!0).forEach((function(t){We(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):le(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function We(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ke(e,t){if(null==e)return{};var r,n,o=He(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)r=u[n],!(t.indexOf(r)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,r)||(o[r]=e[r]))}return o}function He(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)r=u[n],!(t.indexOf(r)>=0)&&(o[r]=e[r]);return o}function $e(e,t){var r=e.as,n=void 0===r?"div":r,o=e.children,u=e.className,a=e.style,c=e.wrapperClassName,i=e.wrapperStyle;return m(n,R(R({},ke(e,Ue)),{},{ref:t,className:"".concat(u||""," ").concat(c||"").trim()||null,style:R(R({},a),i)}),o)}var B=L($e);function Ye(e,t){return Ge(e)||Ze(e,t)||Fe(e,t)||ze()}function ze(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Fe(e,t){if(e){if("string"==typeof e)return se(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return se(e,t)}}function se(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ze(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,u=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(u.push(n.value),!t||u.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{!a&&null!=r.return&&r.return()}finally{if(c)throw o}}return u}}function Ge(e){if(Array.isArray(e))return e}function K(e,t){var r=Ye(N(null),2),n=r[0],o=r[1];return I((function(){var r=e&&e(t)||null;if(r&&"function"==typeof r.then){var n=!1;return r.then((function(e){n||o(e)})),function(){n=!0}}o(r)}),[e,t]),n}var pe=Object.prototype,Wr=pe.hasOwnProperty,kr=pe.toString;function V(e){return e||{}}function me(e){return"string"==typeof e}function Be(e){if(!e)return null;if("now"===e.toLowerCase())return Date.now();var t=Date.parse(e);return isNaN(t)?null:t}function de(e){return e?"number"==typeof e?e:me(e)?Be(e):(e=e).getTime():null}function J(e){return Ke[e]}var b,Ke={de:["Jahren","Monaten","Tagen","Stunden","Minuten","Sekunden"],en:["Years","Months","Days","Hours","Minutes","Seconds"],es:["años","meses","días","horas","minutos","segundos"],fr:["ans","mois","jours","heures","minutes","secondes"],id:["tahun","bulan","hari","jam","menit","detik"],it:["anni","mesi","giorni","ore","minuti","secondi"],ja:["年","ヶ月","日","時間","分","秒"],ko:["년","달","일","시간","분","초"],nl:["jaar","maanden","dagen","uur","minuten","seconden"],pt:["anos","meses","dias","horas","minutos","segundos"],ru:["год","месяц","день","час","минута","секунда"],th:["ปี","เดือน","วัน","ชั่วโมง","นาที","วินาที"],tr:["yıl","ay","gün","saat","dakika","saniye"],vi:["năm","tháng","ngày","giờ","phút","giây"],"zh-cn":["年","月","天","小时","分钟","秒"],"zh-tw":["年","月","天","小時","分鐘","秒"]};function M(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ye,s={AUTO:"auto",LAZY:"lazy",EAGER:"eager",UNLOAD:"unload"},Zr=[s.AUTO,s.LAZY,s.EAGER,s.UNLOAD],Gr=(M(b={},s.AUTO,0),M(b,s.LAZY,1),M(b,s.EAGER,2),M(b,s.UNLOAD,3),b);function Ve(){return ye||(ye=ie({renderable:!0,playable:!0,loading:s.AUTO}))}function U(){return ce(Ve())}function ve(){var e=U().notify;I((function(){e&&e()}))}var Je=["datetime","whenEnded","locale","biggestUnit","countUp","render"];function he(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function W(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?he(Object(r),!0).forEach((function(t){qe(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):he(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function qe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function k(e){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Qe(e,t){return tr(e)||rr(e,t)||er(e,t)||Xe()}function Xe(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function er(e,t){if(e){if("string"==typeof e)return be(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return be(e,t)}}function be(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function rr(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,u=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(u.push(n.value),!t||u.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{!a&&null!=r.return&&r.return()}finally{if(c)throw o}}return u}}function tr(e){if(Array.isArray(e))return e}function nr(e,t){if(null==e)return{};var r,n,o=or(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)r=u[n],!(t.indexOf(r)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,r)||(o[r]=e[r]))}return o}function or(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)r=u[n],!(t.indexOf(r)>=0)&&(o[r]=e[r]);return o}var ar="DateCountdown",ge=864e5,q=36e5,Q=6e4,Oe=1e3,X=1e3,l={DAYS:1,HOURS:2,MINUTES:3,SECONDS:4},ee="en",Se="stop",ir="DAYS",ur=!1,cr=function(e){return"".concat(e.days," ").concat(e.dd,", ")+"".concat(e.hours," ").concat(e.hh,", ")+"".concat(e.minutes," ").concat(e.mm,", ")+"".concat(e.seconds," ").concat(e.ss)};function fr(e){var t=e.datetime,r=e.whenEnded,n=void 0===r?Se:r,o=e.locale,u=void 0===o?ee:o,a=e.biggestUnit,c=void 0===a?ir:a,i=e.countUp,l=void 0===i?ur:i,f=e.render,s=void 0===f?cr:f,p=nr(e,Je);ve();var y=U().playable,b=w((function(){return de(t)}),[t]),d=w((function(){return sr(u)}),[u]),O=Qe(N(b-Date.now()+X),2),v=O[0],h=O[1],g=w((function(){return lr(v,c,d,l)}),[v,c,d,l]),j=G(null);ue((function(){if(y&&j.current){var e=j.current.ownerDocument.defaultView,t=e.setInterval((function(){var r=b-Date.now()+X;h(r),n===Se&&r<1e3&&e.clearInterval(t)}),X);return function(){return e.clearInterval(t)}}}),[y,b,n]);var S=K(s,g),P=S&&"object"==k(S)&&"__html"in S;return m(B,W(W({},p),{},{ref:j,dangerouslySetInnerHTML:P?S:null}),P?null:S)}function lr(e,t,r,n){return W(W({},pr(e,t,n)),r)}function sr(e){void 0===J(e)&&(mr("Invalid locale ".concat(e,", defaulting to ").concat(ee,". ").concat(ar)),e=ee);var t=J(e);return V({years:t[0],months:t[1],days:t[2],hours:t[3],minutes:t[4],seconds:t[5]})}function pr(e,t,r){r&&(e*=-1);var n=l[t]==l.DAYS?d(Math.floor(e/ge)):0,o=l[t]==l.HOURS?d(Math.floor(e/q)):l[t]<l.HOURS?d(Math.floor(e%ge/q)):0,u=l[t]==l.MINUTES?d(Math.floor(e/Q)):l[t]<l.MINUTES?d(Math.floor(e%q/Q)):0,a=l[t]==l.SECONDS?d(Math.floor(e/Oe)):d(Math.floor(e%Q/Oe));return V({d:n,dd:H(n),h:o,hh:H(o),m:u,mm:H(u),s:a,ss:H(a)})}function H(e){return e<-9||e>9?String(e):e>=-9&&e<0?"-0"+-e:"0"+e}function d(e){return e<0?e+1:e}function mr(e){console.warn(e)} | ||
//# sourceMappingURL=component-react.js.map | ||
; | ||
var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__markAsModule=function(e){return __defProp(e,"__esModule",{value:!0})},__export=function(e,t){for(var r in __markAsModule(e),t)__defProp(e,r,{get:t[r],enumerable:!0})},__reExport=function(e,t,r){if(t&&"object"==typeof t||"function"==typeof t)for(var n,o=__getOwnPropNames(t),a=0,i=o.length;a<i;a++)n=o[a],__hasOwnProp.call(e,n)||"default"===n||__defProp(e,n,{get:function(e){return t[e]}.bind(null,n),enumerable:!(r=__getOwnPropDesc(t,n))||r.enumerable});return e},__toModule=function(e){return __reExport(__markAsModule(__defProp(null!=e?__create(__getProtoOf(e)):{},"default",e&&e.__esModule&&"default"in e?{get:function(){return e.default},enumerable:!0}:{value:e,enumerable:!0})),e)};__export(exports,{DateCountdown:function(){return DateCountdown}});var preact=__toModule(require("react")),preactDOM=__toModule(require("react-dom")),hooks=__toModule(require("react"));function createElement2(e,t,r){return preact.createElement.apply(void 0,arguments)}function createContext2(e){return preact.createContext(e,void 0)}function useState2(e){return hooks.useState(e)}function useRef2(e){return hooks.useRef(e)}function useEffect2(e,t){hooks.useEffect(e,t)}function useLayoutEffect2(e,t){hooks.useLayoutEffect(e,t)}function useContext2(e){return hooks.useContext(e)}function useMemo2(e,t){return hooks.useMemo(e,t)}var compat=__toModule(require("react"));function forwardRef2(e){return compat.forwardRef(e)}var _excluded=["as","children","className","contentAs","contentClassName","contentProps","contentRef","contentStyle","layout","paint","size","style","wrapperClassName","wrapperStyle"];function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _objectWithoutProperties(e,t){if(null==e)return{};var r,n,o=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}var CONTAIN=[null,"paint","layout","content","size","size paint","size layout","strict"],SIZE_CONTENT_STYLE={"position":"relative","width":"100%","height":"100%"};function ContainWrapperWithRef(e,t){var r=e.as,n=void 0===r?"div":r,o=e.children,a=e.className,i=e.contentAs,u=void 0===i?"div":i,c=e.contentClassName,l=e.contentProps,s=e.contentRef,p=e.contentStyle,f=e.layout,y=void 0!==f&&f,d=e.paint,_=void 0!==d&&d,b=e.size,O=void 0!==b&&b,m=e.style,S=e.wrapperClassName,g=e.wrapperStyle,h=(O?4:0)+(y?2:0)+(_?1:0);return createElement2(n,_objectSpread(_objectSpread({},_objectWithoutProperties(e,_excluded)),{},{ref:t,className:"".concat(a||""," ").concat(S||"").trim()||null,style:_objectSpread(_objectSpread(_objectSpread({},m),g),{},{contain:CONTAIN[h]})}),createElement2(u,_objectSpread(_objectSpread({},l),{},{ref:s,className:c,style:_objectSpread(_objectSpread({},O&&SIZE_CONTENT_STYLE),{},{"overflow":_?"hidden":"visible"},p)}),o))}var ContainWrapper=forwardRef2(ContainWrapperWithRef),_excluded2=["as","children","className","style","wrapperClassName","wrapperStyle"];function ownKeys2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys2(Object(r),!0).forEach((function(t){_defineProperty2(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys2(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty2(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _objectWithoutProperties2(e,t){if(null==e)return{};var r,n,o=_objectWithoutPropertiesLoose2(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function _objectWithoutPropertiesLoose2(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}function WrapperWithRef(e,t){var r=e.as,n=void 0===r?"div":r,o=e.children,a=e.className,i=e.style,u=e.wrapperClassName,c=e.wrapperStyle;return createElement2(n,_objectSpread2(_objectSpread2({},_objectWithoutProperties2(e,_excluded2)),{},{ref:t,className:"".concat(a||""," ").concat(u||"").trim()||null,style:_objectSpread2(_objectSpread2({},i),c)}),o)}var Wrapper=forwardRef2(WrapperWithRef);function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){u=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function useRenderer(e,t){var r=_slicedToArray(useState2(null),2),n=r[0],o=r[1];return useLayoutEffect2((function(){var r=e&&e(t)||null;if(r&&"function"==typeof r.then){var n=!1;return r.then((function(e){n||o(e)})),function(){n=!0}}o(r)}),[e,t]),n}var _Object$prototype=Object.prototype,hasOwn_=_Object$prototype.hasOwnProperty,toString_=_Object$prototype.toString;function dict(e){return e||{}}function isString(e){return"string"==typeof e}function parseDate(e){if(!e)return null;if("now"===e.toLowerCase())return Date.now();var t=Date.parse(e);return isNaN(t)?null:t}function getDate(e){return e?"number"==typeof e?e:isString(e)?parseDate(e):(e=e).getTime():null}function getLocaleStrings(e){return LOCALE_WORD[e]}var _MAP,LOCALE_WORD={"de":["Jahren","Monaten","Tagen","Stunden","Minuten","Sekunden"],"en":["Years","Months","Days","Hours","Minutes","Seconds"],"es":["años","meses","días","horas","minutos","segundos"],"fr":["ans","mois","jours","heures","minutes","secondes"],"id":["tahun","bulan","hari","jam","menit","detik"],"it":["anni","mesi","giorni","ore","minuti","secondi"],"ja":["年","ヶ月","日","時間","分","秒"],"ko":["년","달","일","시간","분","초"],"nl":["jaar","maanden","dagen","uur","minuten","seconden"],"pt":["anos","meses","dias","horas","minutos","segundos"],"ru":["год","месяц","день","час","минута","секунда"],"th":["ปี","เดือน","วัน","ชั่วโมง","นาที","วินาที"],"tr":["yıl","ay","gün","saat","dakika","saniye"],"vi":["năm","tháng","ngày","giờ","phút","giây"],"zh-cn":["年","月","天","小时","分钟","秒"],"zh-tw":["年","月","天","小時","分鐘","秒"]};function _defineProperty3(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var context,Loading={AUTO:"auto",LAZY:"lazy",EAGER:"eager",UNLOAD:"unload"},ORDER=[Loading.AUTO,Loading.LAZY,Loading.EAGER,Loading.UNLOAD],MAP=(_defineProperty3(_MAP={},Loading.AUTO,0),_defineProperty3(_MAP,Loading.LAZY,1),_defineProperty3(_MAP,Loading.EAGER,2),_defineProperty3(_MAP,Loading.UNLOAD,3),_MAP);function getAmpContext(){return context||(context=createContext2({renderable:!0,playable:!0,loading:Loading.AUTO}))}function useAmpContext(){return useContext2(getAmpContext())}function useResourcesNotify(){var e=useAmpContext().notify;useLayoutEffect2((function(){e&&e()}))}var _excluded3=["datetime","whenEnded","locale","biggestUnit","countUp","render"];function ownKeys3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread3(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys3(Object(r),!0).forEach((function(t){_defineProperty4(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys3(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty4(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _slicedToArray2(e,t){return _arrayWithHoles2(e)||_iterableToArrayLimit2(e,t)||_unsupportedIterableToArray2(e,t)||_nonIterableRest2()}function _nonIterableRest2(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray2(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray2(e,t):void 0}}function _arrayLikeToArray2(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit2(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){u=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}function _arrayWithHoles2(e){if(Array.isArray(e))return e}function _objectWithoutProperties3(e,t){if(null==e)return{};var r,n,o=_objectWithoutPropertiesLoose3(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function _objectWithoutPropertiesLoose3(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}var NAME="DateCountdown",MILLISECONDS_IN_DAY=864e5,MILLISECONDS_IN_HOUR=36e5,MILLISECONDS_IN_MINUTE=6e4,MILLISECONDS_IN_SECOND=1e3,DELAY=1e3,TimeUnit={DAYS:1,HOURS:2,MINUTES:3,SECONDS:4},DEFAULT_LOCALE="en",DEFAULT_WHEN_ENDED="stop",DEFAULT_BIGGEST_UNIT="DAYS",DEFAULT_COUNT_UP=!1,DEFAULT_RENDER=function(e){return"".concat(e.days," ").concat(e.dd,", ")+"".concat(e.hours," ").concat(e.hh,", ")+"".concat(e.minutes," ").concat(e.mm,", ")+"".concat(e.seconds," ").concat(e.ss)};function DateCountdown(e){var t=e.datetime,r=e.whenEnded,n=void 0===r?DEFAULT_WHEN_ENDED:r,o=e.locale,a=void 0===o?DEFAULT_LOCALE:o,i=e.biggestUnit,u=void 0===i?DEFAULT_BIGGEST_UNIT:i,c=e.countUp,l=void 0===c?DEFAULT_COUNT_UP:c,s=e.render,p=void 0===s?DEFAULT_RENDER:s,f=_objectWithoutProperties3(e,_excluded3);useResourcesNotify();var y=useAmpContext().playable,d=useMemo2((function(){return getDate(t)}),[t]),_=useMemo2((function(){return getLocaleWord(a)}),[a]),b=_slicedToArray2(useState2(d-Date.now()+DELAY),2),O=b[0],m=b[1],S=useMemo2((function(){return getDataForTemplate(O,u,_,l)}),[O,u,_,l]),g=useRef2(null);useEffect2((function(){if(y&&g.current){var e=g.current.ownerDocument.defaultView,t=e.setInterval((function(){var r=d-Date.now()+DELAY;m(r),n===DEFAULT_WHEN_ENDED&&r<1e3&&e.clearInterval(t)}),DELAY);return function(){return e.clearInterval(t)}}}),[y,d,n]);var h=useRenderer(p,S),E=h&&"object"==_typeof(h)&&"__html"in h;return createElement2(Wrapper,_objectSpread3(_objectSpread3({},f),{},{ref:g,dangerouslySetInnerHTML:E?h:null}),E?null:h)}function getDataForTemplate(e,t,r,n){return _objectSpread3(_objectSpread3({},getYDHMSFromMs(e,t,n)),r)}function getLocaleWord(e){void 0===getLocaleStrings(e)&&(displayWarning("Invalid locale ".concat(e,", defaulting to ").concat(DEFAULT_LOCALE,". ").concat(NAME)),e=DEFAULT_LOCALE);var t=getLocaleStrings(e);return dict({"years":t[0],"months":t[1],"days":t[2],"hours":t[3],"minutes":t[4],"seconds":t[5]})}function getYDHMSFromMs(e,t,r){r&&(e*=-1);var n=TimeUnit[t]==TimeUnit.DAYS?supportBackDate(Math.floor(e/MILLISECONDS_IN_DAY)):0,o=TimeUnit[t]==TimeUnit.HOURS?supportBackDate(Math.floor(e/MILLISECONDS_IN_HOUR)):TimeUnit[t]<TimeUnit.HOURS?supportBackDate(Math.floor(e%MILLISECONDS_IN_DAY/MILLISECONDS_IN_HOUR)):0,a=TimeUnit[t]==TimeUnit.MINUTES?supportBackDate(Math.floor(e/MILLISECONDS_IN_MINUTE)):TimeUnit[t]<TimeUnit.MINUTES?supportBackDate(Math.floor(e%MILLISECONDS_IN_HOUR/MILLISECONDS_IN_MINUTE)):0,i=TimeUnit[t]==TimeUnit.SECONDS?supportBackDate(Math.floor(e/MILLISECONDS_IN_SECOND)):supportBackDate(Math.floor(e%MILLISECONDS_IN_MINUTE/MILLISECONDS_IN_SECOND));return dict({"d":n,"dd":padStart(n),"h":o,"hh":padStart(o),"m":a,"mm":padStart(a),"s":i,"ss":padStart(i)})}function padStart(e){return e<-9||e>9?String(e):e>=-9&&e<0?"-0"+-e:"0"+e}function supportBackDate(e){return e<0?e+1:e}function displayWarning(e){console.warn(e)} |
@@ -1,2 +0,2 @@ | ||
import{cloneElement as Ye,createContext as re,createElement as te,createRef as Ve}from"react";import{hydrate as Fe,render as ze}from"react-dom";import{useCallback as Ze,useContext as ae,useEffect as ie,useImperativeHandle as Ge,useLayoutEffect as ce,useMemo as ue,useRef as oe,useState as ne}from"react";function f(e,t,n){return te.apply(void 0,arguments)}function Y(e){return re(e,void 0)}function P(e){return ne(e)}function _(e){return oe(e)}function z(e,t){ie(e,t)}function S(e,t){ce(e,t)}function F(e){return ae(e)}function x(e,t){return ue(e,t)}import{Children as Je,createPortal as qe,forwardRef as se}from"react";function D(e){return se(e)}var fe=["as","children","className","contentAs","contentClassName","contentProps","contentRef","contentStyle","layout","paint","size","style","wrapperClassName","wrapperStyle"];function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach((function(t){le(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function le(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pe(e,t){if(null==e)return{};var n,r,o=me(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(o[n]=e[n]))}return o}function me(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}var de=[null,"paint","layout","content","size","size paint","size layout","strict"],he={position:"relative",width:"100%",height:"100%"};function Oe(e,t){let{as:n="div",children:r,className:o,contentAs:a="div",contentClassName:u,contentProps:c,contentRef:i,contentStyle:l,layout:p=!1,paint:y=!1,size:O=!1,style:b,wrapperClassName:d,wrapperStyle:m}=e,h=(O?4:0)+(p?2:0)+(y?1:0);return f(n,s(s({},pe(e,fe)),{},{ref:t,className:`${o||""} ${d||""}`.trim()||null,style:s(s(s({},b),m),{},{contain:de[h]})}),f(a,s(s({},c),{},{ref:i,className:u,style:s(s({},O&&he),{},{overflow:y?"hidden":"visible"},l)}),r))}var ye=D(Oe),ge=["as","children","className","style","wrapperClassName","wrapperStyle"];function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function j(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(n),!0).forEach((function(t){xe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function be(e,t){if(null==e)return{};var n,r,o=we(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(o[n]=e[n]))}return o}function we(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}function Ee(e,t){let{as:n="div",children:r,className:o,style:a,wrapperClassName:u,wrapperStyle:c}=e;return f(n,j(j({},be(e,ge)),{},{ref:t,className:`${o||""} ${u||""}`.trim()||null,style:j(j({},a),c)}),r)}var L=D(Ee);function R(e,t){let{0:n,1:r}=P(null);return S((()=>{let n=e&&e(t)||null;if(n&&"function"==typeof n.then){let e=!1;return n.then((t=>{e||r(t)})),()=>{e=!0}}r(n)}),[e,t]),n}var{hasOwnProperty:xt,toString:bt}=Object.prototype;function I(e){return e||{}}function G(e){return"string"==typeof e}function Pe(e){if(!e)return null;if("now"===e.toLowerCase())return Date.now();let t=Date.parse(e);return isNaN(t)?null:t}function B(e){return e?"number"==typeof e?e:G(e)?Pe(e):(e=e).getTime():null}function M(e){return Se[e]}var K,Se={de:["Jahren","Monaten","Tagen","Stunden","Minuten","Sekunden"],en:["Years","Months","Days","Hours","Minutes","Seconds"],es:["años","meses","días","horas","minutos","segundos"],fr:["ans","mois","jours","heures","minutes","secondes"],id:["tahun","bulan","hari","jam","menit","detik"],it:["anni","mesi","giorni","ore","minuti","secondi"],ja:["年","ヶ月","日","時間","分","秒"],ko:["년","달","일","시간","분","초"],nl:["jaar","maanden","dagen","uur","minuten","seconden"],pt:["anos","meses","dias","horas","minutos","segundos"],ru:["год","месяц","день","час","минута","секунда"],th:["ปี","เดือน","วัน","ชั่วโมง","นาที","วินาที"],tr:["yıl","ay","gün","saat","dakika","saniye"],vi:["năm","tháng","ngày","giờ","phút","giây"],"zh-cn":["年","月","天","小时","分钟","秒"],"zh-tw":["年","月","天","小時","分鐘","秒"]},u={AUTO:"auto",LAZY:"lazy",EAGER:"eager",UNLOAD:"unload"},jt=[u.AUTO,u.LAZY,u.EAGER,u.UNLOAD],Ct={[u.AUTO]:0,[u.LAZY]:1,[u.EAGER]:2,[u.UNLOAD]:3};function De(){return K||(K=Y({renderable:!0,playable:!0,loading:u.AUTO}))}function C(){return F(De())}function q(){let{notify:e}=C();S((()=>{e&&e()}))}var je=["datetime","whenEnded","locale","biggestUnit","countUp","render"];function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){Ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ne(e,t){if(null==e)return{};var n,r,o=ve(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(o[n]=e[n]))}return o}function ve(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}var Ae="DateCountdown",Q=864e5,T=36e5,U=6e4,X=1e3,k=1e3,c={DAYS:1,HOURS:2,MINUTES:3,SECONDS:4},W="en",ee="stop",_e="DAYS",Le=!1,Re=e=>`${e.days} ${e.dd}, ${e.hours} ${e.hh}, ${e.minutes} ${e.mm}, ${e.seconds} ${e.ss}`;function Vt(e){let{datetime:t,whenEnded:n=ee,locale:r=W,biggestUnit:o=_e,countUp:a=Le,render:u=Re}=e,c=Ne(e,je);q();let{playable:s}=C(),i=x((()=>B(t)),[t]),l=x((()=>Me(r)),[r]),{0:p,1:y}=P(i-Date.now()+k),O=x((()=>Ie(p,o,l,a)),[p,o,l,a]),b=_(null);z((()=>{if(!s||!b.current)return;let e=b.current.ownerDocument.defaultView,t=e.setInterval((()=>{let r=i-Date.now()+k;y(r),n===ee&&r<1e3&&e.clearInterval(t)}),k);return()=>e.clearInterval(t)}),[s,i,n]);let d=R(u,O),m=d&&"object"==typeof d&&"__html"in d;return f(L,N(N({},c),{},{ref:b,dangerouslySetInnerHTML:m?d:null}),m?null:d)}function Ie(e,t,n,r){return N(N({},Te(e,t,r)),n)}function Me(e){void 0===M(e)&&(Ue(`Invalid locale ${e}, defaulting to ${W}. ${Ae}`),e=W);let t=M(e);return I({years:t[0],months:t[1],days:t[2],hours:t[3],minutes:t[4],seconds:t[5]})}function Te(e,t,n){n&&(e*=-1);let r=c[t]==c.DAYS?p(Math.floor(e/Q)):0,o=c[t]==c.HOURS?p(Math.floor(e/T)):c[t]<c.HOURS?p(Math.floor(e%Q/T)):0,a=c[t]==c.MINUTES?p(Math.floor(e/U)):c[t]<c.MINUTES?p(Math.floor(e%T/U)):0,u=c[t]==c.SECONDS?p(Math.floor(e/X)):p(Math.floor(e%U/X));return I({d:r,dd:v(r),h:o,hh:v(o),m:a,mm:v(a),s:u,ss:v(u)})}function v(e){return e<-9||e>9?String(e):e>=-9&&e<0?"-0"+-e:"0"+e}function p(e){return e<0?e+1:e}function Ue(e){console.warn(e)}export{Vt as DateCountdown}; | ||
//# sourceMappingURL=component-react.module.js.map | ||
; | ||
import{cloneElement as e,createContext as t,createElement as n,createRef as r}from"react";import{hydrate as o,render as a}from"react-dom";import{useCallback as i,useContext as c,useEffect as s,useImperativeHandle as u,useLayoutEffect as l,useMemo as f,useRef as p,useState as y}from"react";function b(e,t,r){return n.apply(void 0,arguments)}function O(e){return y(e)}function m(e,t){l(e,t)}function d(e,t){return f(e,t)}import{Children as h,createPortal as g,forwardRef as j}from"react";function w(e){return j(e)}var v=["as","children","className","contentAs","contentClassName","contentProps","contentRef","contentStyle","layout","paint","size","style","wrapperClassName","wrapperStyle"];function S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach((function(t){D(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N=[null,"paint","layout","content","size","size paint","size layout","strict"],E={"position":"relative","width":"100%","height":"100%"};w((function(e,t){let{as:n="div",children:r,"className":o,contentAs:a="div",contentClassName:i,contentProps:c,contentRef:s,contentStyle:u,layout:l=!1,paint:f=!1,size:p=!1,"style":y,wrapperClassName:O,wrapperStyle:m}=e;const d=(p?4:0)+(l?2:0)+(f?1:0);return b(n,P(P({},function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,v)),{},{ref:t,className:`${o||""} ${O||""}`.trim()||null,style:P(P(P({},y),m),{},{contain:N[d]})}),b(a,P(P({},c),{},{ref:s,className:i,style:P(P({},p&&E),{},{"overflow":f?"hidden":"visible"},u)}),r))}));var M=["as","children","className","style","wrapperClassName","wrapperStyle"];function $(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach((function(t){I(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var C=w((function(e,t){let{as:n="div",children:r,"className":o,"style":a,wrapperClassName:i,wrapperStyle:c}=e;return b(n,k(k({},function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,M)),{},{ref:t,className:`${o||""} ${i||""}`.trim()||null,style:k(k({},a),c)}),r)})),{hasOwnProperty:U,toString:x}=Object.prototype;function z(e){return e||{}}function T(e){return H[e]}var A,H={"de":["Jahren","Monaten","Tagen","Stunden","Minuten","Sekunden"],"en":["Years","Months","Days","Hours","Minutes","Seconds"],"es":["años","meses","días","horas","minutos","segundos"],"fr":["ans","mois","jours","heures","minutes","secondes"],"id":["tahun","bulan","hari","jam","menit","detik"],"it":["anni","mesi","giorni","ore","minuti","secondi"],"ja":["年","ヶ月","日","時間","分","秒"],"ko":["년","달","일","시간","분","초"],"nl":["jaar","maanden","dagen","uur","minuten","seconden"],"pt":["anos","meses","dias","horas","minutos","segundos"],"ru":["год","месяц","день","час","минута","секунда"],"th":["ปี","เดือน","วัน","ชั่วโมง","นาที","วินาที"],"tr":["yıl","ay","gün","saat","dakika","saniye"],"vi":["năm","tháng","ngày","giờ","phút","giây"],"zh-cn":["年","月","天","小时","分钟","秒"],"zh-tw":["年","月","天","小時","分鐘","秒"]};function R(){const e=A||(A=t({renderable:!0,playable:!0,loading:"auto"},void 0));return c(e)}var Y=["datetime","whenEnded","locale","biggestUnit","countUp","render"];function L(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?L(Object(n),!0).forEach((function(t){J(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var V={DAYS:1,HOURS:2,MINUTES:3,SECONDS:4},q="en",B="stop",F="DAYS",G=!1,K=e=>`${e.days} ${e.dd}, ${e.hours} ${e.hh}, ${e.minutes} ${e.mm}, ${e.seconds} ${e.ss}`;function Q(e){let{datetime:t,whenEnded:n=B,locale:r=q,biggestUnit:o=F,countUp:a=G,render:i=K}=e,c=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Y);!function(){const{notify:e}=R();m((()=>{e&&e()}))}();const{playable:u}=R(),l=d((()=>{return(e=t)?"number"==typeof e?e:"string"==typeof e?function(e){if(!e)return null;if("now"===e.toLowerCase())return Date.now();const t=Date.parse(e);return isNaN(t)?null:t}(e):(e=e).getTime():null;var e}),[t]),f=d((()=>function(e){var t;void 0===T(e)&&(t=`Invalid locale ${e}, defaulting to ${q}. DateCountdown`,console.warn(t),e=q);const n=T(e);return z({"years":n[0],"months":n[1],"days":n[2],"hours":n[3],"minutes":n[4],"seconds":n[5]})}(r)),[r]),{0:y,1:h}=O(l-Date.now()+1e3),g=d((()=>function(e,t,n,r){return _(_({},function(e,t,n){n&&(e*=-1);const r=V[t]==V.DAYS?X(Math.floor(e/864e5)):0,o=V[t]==V.HOURS?X(Math.floor(e/36e5)):V[t]<V.HOURS?X(Math.floor(e%864e5/36e5)):0,a=V[t]==V.MINUTES?X(Math.floor(e/6e4)):V[t]<V.MINUTES?X(Math.floor(e%36e5/6e4)):0,i=X(V[t]==V.SECONDS?Math.floor(e/1e3):Math.floor(e%6e4/1e3));return z({"d":r,"dd":W(r),"h":o,"hh":W(o),"m":a,"mm":W(a),"s":i,"ss":W(i)})}(e,t,r)),n)}(y,o,f,a)),[y,o,f,a]),j=p(null);s((()=>{if(!u||!j.current)return;const e=j.current.ownerDocument.defaultView,t=e.setInterval((()=>{const r=l-Date.now()+1e3;h(r),n===B&&r<1e3&&e.clearInterval(t)}),1e3);return()=>e.clearInterval(t)}),[u,l,n]);const w=function(e,t){const{0:n,1:r}=O(null);return m((()=>{const n=e&&e(t)||null;if(n&&"function"==typeof n.then){let e=!1;return n.then((t=>{e||r(t)})),()=>{e=!0}}r(n)}),[e,t]),n}(i,g),v=w&&"object"==typeof w&&"__html"in w;return b(C,_(_({},c),{},{ref:j,dangerouslySetInnerHTML:v?w:null}),v?null:w)}function W(e){return e<-9||e>9?String(e):e>=-9&&e<0?"-0"+-e:"0"+e}function X(e){return e<0?e+1:e}export{Q as DateCountdown}; |
{ | ||
"name": "@ampproject/amp-date-countdown", | ||
"version": "1.2107302322.0", | ||
"version": "1.2107302322.1", | ||
"description": "AMP HTML amp-date-countdown Component", | ||
@@ -5,0 +5,0 @@ "author": "The AMP HTML Authors", |
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
576018
1736