@abtasty/countdown 3.0.4 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/dist/form.js +1 -1
- package/dist/main.js +1 -1
- package/package.json +4 -2
package/dist/main.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(){"use strict";function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t((function(t){var e=function(t){var e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",r=o.toStringTag||"@@toStringTag";function a(t,e,n,o){var s=e&&e.prototype instanceof d?e:d,i=Object.create(s.prototype),r=new T(o||[]);return i._invoke=function(t,e,n){var o="suspendedStart";return function(s,i){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===s)throw i;return E()}for(n.method=s,n.arg=i;;){var r=n.delegate;if(r){var a=f(r,n);if(a){if(a===l)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var d=c(t,e,n);if("normal"===d.type){if(o=n.done?"completed":"suspendedYield",d.arg===l)continue;return{value:d.arg,done:n.done}}"throw"===d.type&&(o="completed",n.method="throw",n.arg=d.arg)}}}(t,n,r),i}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=a;var l={};function d(){}function h(){}function u(){}var m={};m[s]=function(){return this};var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==e&&n.call(g,s)&&(m=g);var p=u.prototype=d.prototype=Object.create(m);function w(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function b(t,e){var o;this._invoke=function(s,i){function r(){return new e((function(o,r){!function o(s,i,r,a){var l=c(t[s],t,i);if("throw"!==l.type){var d=l.arg,h=d.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){o("next",t,r,a)}),(function(t){o("throw",t,r,a)})):e.resolve(h).then((function(t){d.value=t,r(d)}),(function(t){return o("throw",t,r,a)}))}a(l.arg)}(s,i,o,r)}))}return o=o?o.then(r,r):r()}}function f(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,f(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var o=c(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,l;var s=o.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function v(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(v,this),this.reset(!0)}function S(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return h.prototype=p.constructor=u,u.constructor=h,u[r]=h.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,r in t||(t[r]="GeneratorFunction")),t.prototype=Object.create(p),t},t.awrap=function(t){return{__await:t}},w(b.prototype),b.prototype[i]=function(){return this},t.AsyncIterator=b,t.async=function(e,n,o,s,i){void 0===i&&(i=Promise);var r=new b(a(e,n,o,s),i);return t.isGeneratorFunction(n)?r:r.next().then((function(t){return t.done?t.value:r.next()}))},w(p),p[r]="Generator",p[s]=function(){return this},p.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var o=e.pop();if(o in t)return n.value=o,n.done=!1,n}return n.done=!0,n}},t.values=S,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return r.type="throw",r.arg=t,e.next=n,o&&(e.method="next",e.arg=void 0),!!o}for(var s=this.tryEntries.length-1;s>=0;--s){var i=this.tryEntries[s],r=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var i=s;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var r=i?i.completion:{};return r.type=t,r.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(r)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),x(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var o=n.completion;if("throw"===o.type){var s=o.arg;x(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));function n(t,e,n,o,s,i,r){try{var a=t[i](r),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(o,s)}var o=function(t){return function(){var e=this,o=arguments;return new Promise((function(s,i){var r=t.apply(e,o);function a(t){n(r,s,i,a,c,"next",t)}function c(t){n(r,s,i,a,c,"throw",t)}a(void 0)}))}};const s=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor"),i=()=>{let t;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?t=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?t=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(t=window.ABTasty.accountSettings.identifier),t):t},r=()=>{const t=!!document.getElementById("ABTastyPreviewBar"),e=location.href.includes("ab_project=preview");return t||e},a=()=>r()||!!window.ABTasty.getTestsOnPage()[TEST_ID],c=()=>{const{type:t}=DATA;return`${PACKAGE.replace("@abtasty/","")}${t?"_"+t:""}`},l=()=>{const t=c();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`.split("-").join(" ")},d=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,h=t=>{if((()=>{if(s()||r())return!1;const t=ABTasty.getTestsOnPage()[TEST_ID];return!!t&&Object.keys(t.targetings.qaParameters).length>0})()){const e=l();window.console.log(`%c${e} - QA Mode for campaign ${TEST_ID}\n${t}`,"background-color: rgba(0, 127, 145, 1); color: rgba(247, 247, 247, 1)")}},u=t=>{const e={promise:null,resolve:null,reject:null,name:t};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e},m=(t,e,n)=>{let o=0,s=0;try{document.querySelector(t)}catch(e){const o=`Selector «${t}» not valid.`;return h(o),"function"==typeof n&&n(o)}function i(){clearInterval(s),clearTimeout(o)}return o=setTimeout(()=>{i();const e=`Can't find element «${t}».`;return h(e),"function"==typeof n&&n(e)},1e4),s=setInterval(()=>{const n=document.querySelector(t);return null!==n?(i(),"function"==typeof e&&e(n)):n},200),{clear:i}};function y(){return"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||(t="",new Promise((e,n)=>{const o=window.document.getElementsByTagName("script")[0],s=window.document.createElement("script");s.src=t,o.parentNode.insertBefore(s,o),s.onload=e,s.onerror=n}));var t}class g{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=this.startMutationObserver(),this.mouseOverEvent=this.mouseOverHandler()}intersectionHandler(t){t.forEach(t=>{t.isIntersecting?(this.existingTargets.forEach(e=>{e.element.isSameNode(t.target)&&(this.inViewportTargets.push(e),this.mouseOverEvent.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(e=>!e.element.isSameNode(t.target)||(this.mouseOverEvent.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const t=this.mutationObserver||new MutationObserver(this.checkElements.bind(this));return document.body&&t.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),t}onMouseOver({target:t,path:e}){const n=this.inViewportTargets.find(({element:n,selector:o})=>{if(n.isSameNode(t))return!0;const s=[...t.querySelectorAll(o)];if(s.length){if(s.includes(n))return!0}if(e.includes(n))return!0;const i=[...t.parentElement.children],r=i.findIndex(e=>e.isSameNode(t)),a=i.filter((t,e)=>e>r);if(a.length){if(a.includes(n))return!0;if(a.some(t=>[...t.querySelectorAll(o)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:t,element:e,uniqueId:o}=n,s=this.targets.find(e=>e.selector===t&&e.uniqueId===o);s&&s.resolve(e),this.clear(t,o)}}mouseOverHandler(){const t=["mouseover",t=>setTimeout(()=>this.onMouseOver(t),50),!0];return{start:()=>document.addEventListener(...t),clear:()=>document.removeEventListener(...t)}}isElementVisible(t){return this.isElementTopmost(t)&&this.isElementOpaque(t)}isElementOpaque(t){return"HTML"===function t(e,n){return n(e)||!e.parentElement?e:t(e.parentElement,n)}(t,t=>"0"===window.getComputedStyle(t).opacity).nodeName}isElementTopmost(t){const e=t.getBoundingClientRect(),n=[[e.left,e.top],[e.right,e.top],[e.left,e.bottom],[e.right,e.bottom],[e.left+e.width/2,e.top],[e.left+e.width/2,e.bottom],[e.left,e.height/2],[e.right,e.height/2],[e.left+e.left/2,e.height/2]];let o=!1,s=0;for(;!o&&s<n.length;){const e=document.elementFromPoint(...n[s]);o=t===e||t.contains(e),s+=1}return o}checkElements(){this.targets.forEach(({selector:t,uniqueId:e})=>{const n=document.querySelector(t);n&&!this.existingTargets.find(n=>n.element.matches(t)&&n.uniqueId===e)&&(this.existingTargets.push({element:n,selector:t,uniqueId:e}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:t,element:e})=>!!document.querySelector(t)||(e&&this.visibilityObserver.unobserve(e),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:t,element:e,uniqueId:n})=>{if(e.matches(t)&&this.isElementVisible(e)){const o=this.targets.find(e=>e.selector===t&&e.uniqueId===n);return o&&o.resolve(e),this.clear(t,n),!1}return!0})}watch(t,e,n){this.targets.push({selector:t,resolve:e,uniqueId:n});const o=()=>{this.startMutationObserver(),this.checkElements()};document.body?o():m("body",o)}clear(t,e){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(n=>n.filter(({selector:n,uniqueId:o})=>n!==t&&o!==e));const n=document.querySelector(t);n&&this.visibilityObserver.unobserve(n),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class p{constructor({triggerEvent:t,triggerSelector:e,triggerDelay:n}){this.event=t,this.selector=e&&e.length?e:"body",this.delay=1e3*n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[]}async onElementVisible({promise:t,resolve:e}){const n=u(this.event+"DomReady");this.promises.push(n);const o=await this.onPageLoad(n),s=await async function(t){let e;switch(t){case"IntersectionObserver":e=await y();break;default:e=!0}return e}("IntersectionObserver"),i=new g;if(this.visibilityObservers.push(i),s&&o){const t=d();i.watch(this.selector,e,t)}return t}onPageLoad({promise:t,resolve:e}){const n=()=>"complete"===document.readyState;if(!n()){const o=["readystatechange",()=>n()&&e(!0),{passive:!0}];return this.eventsListeners.push(o),document.addEventListener(...o),t}return e(!0),t}onClick({promise:t,resolve:e}){const n=document.createElement("style");n.type="text/css",n.id="Click_"+d(),n.innerHTML=this.selector+" {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}",document.head.appendChild(n),this.elementsSelectors.push("#"+n.id);const o=t=>[...document.querySelectorAll(this.selector)].some(e=>e.isSameNode(t)||!!t.closest(this.selector)),s=["click",({target:t})=>o(t)&&e(!0),{passive:!0,capture:!0}];return this.eventsListeners.push(s),document.addEventListener(...s),t}onExitIntent({promise:t,resolve:e}){const n=["mouseleave",async({clientY:t})=>{t<=0&&e(!0)},{passive:!0}],o=m("body",t=>{t.addEventListener(...n),this.eventsListeners.push([t,...n]),this.elementsWaiters=this.elementsWaiters.filter(t=>t!==o)});return this.elementsWaiters.push(o),t}onReengage({promise:t,resolve:e}){const n=this.delay;let o=n;const s=[()=>(o=n,o),{passive:!0}];["click","mousemove","scroll","keypress"].forEach(t=>{document.addEventListener(t,...s),this.eventsListeners.push([t,...s])});const i=setInterval(()=>{o<=0?e(!0):o-=100},100);return this.intervals.push(i),t}onCustomTrigger({promise:t,resolve:e}){const{triggerEventCustomScript:n}=DATA;return new Function(`return new Promise(async resolve => {${n}})`)().then(t=>t&&e(!0)),t}getSocialProofPurchases({promise:t,resolve:e}){const n=window.ABTastyProductKey,o=i(),{viewInterval:s,triggerSocialProofMinPurchases:r,spNoTrim:a}=DATA;if(n||(h("Not able to find ABTastyProductKey, impossible to call the API."),e(!1)),n&&o){fetch(`https://social-proof-api.abtasty.com/clients/${o}/metrics/i?key=${n}${a?"&noTrim=true":""}`).then(t=>t.ok&&t.json()).then(t=>(t=>{if(void 0===s||void 0===r)return!1;const e=void 0!==t[s]&&t[s]>=r;return e||h(`Widget will not be shown, product has been purchased ${t[s]} times while ${r} are required`),e})(t)&&e(""+t[s])).catch(()=>h("Failed to fetch datas from server."))}else e(!1);return t}getSocialProofPageViews({promise:t,resolve:e}){const{viewInterval:n,triggerSocialProofMinPageViews:o,spNoTrim:s}=DATA,r=encodeURIComponent(s?window.location.href.replace(window.location.origin,""):""+window.location.pathname),a=i();if(r&&a){fetch(`https://social-proof-api.abtasty.com/clients/${a}/metrics/pv?key=${r}${s?"&noTrim=true":""}`).then(t=>t.ok&&t.json()).then(t=>(t=>{if(void 0===n||void 0===o)return!1;const e=void 0!==t[n]&&t[n]>=o;return e||h(`Widget will not be shown, page has been seen ${t[n]} times while ${o} are required`),e})(t)&&e(""+t[n])).catch(()=>h("Failed to fetch datas from server."))}else e(!1);return t}onConsent({promise:t,resolve:e}){if(!window.ABTasty.cnilReady){const n=["consentValid",()=>e(!0)];return this.eventsListeners.push(n),document.addEventListener(...n),t}return e(!0),t}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(t=>{document.querySelector(t)&&document.querySelector(t).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(t=>{const[e,...n]="string"==typeof t[0]?[document,...t]:t;e&&n.length>1&&e.removeEventListener(...n)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(t=>clearInterval(t)),this.intervals=[]),this.observers.length&&(this.observers.forEach(t=>t.disconnect()),this.observers=[]),this.visibilityObservers.length){const t=d();this.visibilityObservers.forEach(e=>e.clear(this.selector,t)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(t=>t.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]),this}async isTriggered(){this.clear();const t=u(this.event);this.promises.push(t);const e={consent:()=>this.onConsent(t),direct:()=>!0,pageLoad:()=>this.onPageLoad(t),click:()=>this.onClick(t),exitIntent:()=>this.onExitIntent(t),reengage:()=>this.onReengage(t),elementVisible:()=>this.onElementVisible(t),script:()=>this.onCustomTrigger(t),socialProofPurchases:()=>this.getSocialProofPurchases(t),socialProofPageViews:()=>this.getSocialProofPageViews(t)},n=!Object.prototype.hasOwnProperty.call(e,this.event)||await e[this.event]();this.clear();return"reengage"!==this.event&&this.delay?n&&await(async()=>{const t=u(this.event+"Delay");return this.promises.push(t),setTimeout(()=>{t.resolve(!0),this.clear()},this.delay),t.promise})():n}}class w{constructor({displayRecurrence:t,closingRecurrence:e,validationRecurrence:n},o){this.displayRecurrence=parseFloat(t),this.closingRecurrence=parseFloat(e),this.validationRecurrence=parseFloat(n),this.onSetCallback=o,this.widgetName=c(),this.uniqueId=d(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1}onStorage({key:t}){const e=localStorage.getItem("ABTastyWidgetsTemporary"),n=sessionStorage.getItem("ABTastyWidgets");"ABTastyData"===t&&!e&&n&&localStorage.setItem("ABTastyWidgetsTemporary",n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(t){try{const e=t.getItem("ABTastyWidgets");return JSON.parse(e)}catch(e){return t.removeItem("ABTastyWidgets"),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(t,e){const{[this.recurrenceKey]:n,...o}=e;return Object.entries(o).length?(t.setItem("ABTastyWidgets",JSON.stringify(o)),o):(t.removeItem("ABTastyWidgets"),!1)}removeSessionRecurrenceStorage(){const t=this.getSessionRecurrenceStorageParsed();return!!t&&this.removeGivenStorage(window.sessionStorage,t)}removeLocalRecurrenceStorage(){const t=this.getLocalRecurrenceStorageParsed();return!!t&&this.removeGivenStorage(window.localStorage,t)}getSessionRecurrence(){const t=this.getSessionRecurrenceStorageParsed();return!!t&&t[this.recurrenceKey]}getLocalRecurrence(){const t=this.getLocalRecurrenceStorageParsed();return!!t&&t[this.recurrenceKey]}getCurrentRecurrence(){const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();return t||e||{type:!1}}isOver(){const t=localStorage.getItem("ABTastyWidgetsTemporary"),e=!(!t||!t.includes(this.recurrenceKey))||this.getSessionRecurrence();t&&(sessionStorage.setItem("ABTastyWidgets",t),localStorage.removeItem("ABTastyWidgetsTemporary"));const n=this.getLocalRecurrence(),o=(n?parseFloat(n.stamp):0)<(new Date).getTime();return o&&this.removeLocalRecurrenceStorage(),!this.pendingRecurrence&&o&&!this.getLocalRecurrence()&&!e}setRecurrence(t,e){0!==t&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const n=this.getTypeOfStorage(t);if(r()||!n&&"object"!=typeof n)return!1;const{storageString:o,storageMethod:s}=n,i=this.getStamp(t),a={type:e,stamp:i},{type:c}=this.getCurrentRecurrence(),l=async()=>{const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();let n;"session"===o?t?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===o&&(e?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const i=n?{[this.recurrenceKey]:a,...n}:{[this.recurrenceKey]:a};if(!window.ABTasty.cnilReady){this.pendingRecurrence=!0;const t=new p({triggerEvent:"consent"});await t.isTriggered(),this.pendingRecurrence=!1}s.setItem("ABTastyWidgets",JSON.stringify(i)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!s)return!1;if(c&&"validation"!==e)if("closing"===e&&"validation"!==c)l();else{if("display"!==e||"validation"===c||"closing"===c)return!1;l()}else l();return i}setDisplayRecurrence(){this.setRecurrence(this.displayRecurrence,"display")}setClosingRecurrence(){this.setRecurrence(this.closingRecurrence,"closing")}setValidationRecurrence(){this.setRecurrence(this.validationRecurrence,"validation")}getStamp(t){return(new Date).getTime()+864e5*t}getTypeOfStorage(t){return!(isNaN(t)||t<0||0!==t&&!t)&&(t>0?{storageString:"local",storageMethod:window.localStorage}:0===t&&{storageString:"session",storageMethod:window.sessionStorage})}}class b{constructor(t,e,n){this.recurrence=t,this.isWidgetApplied=e,this.callback=n,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.eventListenerParams=["abtasty_resetActionTracking",this.eventHandler.bind(this),{passive:!0}],this.elementsWaiters=[]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(t){const e=a(),{type:n}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1},o=()=>t&&"display"===n||this.recurrenceIsDone();return!this.isWidgetApplied()&&e&&o()?(this.clearWatcher(),this.callback("rebuild",t)):(!this.isWidgetApplied()||e&&o())&&(this.isWidgetApplied()||e)||(this.clearWatcher(),this.callback("remove",t),this.watch()),this}eventHandler(){let t=a();return[250,500].forEach(e=>setTimeout(()=>500===e&&a()===t?this:(t=a(),this.decisionHandler(!1)),e)),this}observerHandler(t){const e=t.some(({removedNodes:t})=>t&&t.length),n=t.some(({addedNodes:t})=>t&&t.length);return e||n?(this.decisionHandler(!0),this):this}watch(){if(s())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const t=m("body",e=>{const n=[e,{childList:!0,subtree:!0}];this.observer.observe(...n),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t)});return this.elementsWaiters.push(t),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}const f=/.+\/([^.]+)\.(otf|ttf)$/;class v{constructor(){this.children=void 0,this.uniqueId=d(),this.widgetName=c(),this.prettyName=l(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:e,validationRecurrence:n}=DATA;if(s()||!t&&!e&&!n)return!1;const o={everytime:()=>-1,session:()=>0,once:()=>395,day:t=>DATA[t+"_day"],week:t=>7*DATA[t+"_week"],month:t=>30.5*DATA[t+"_month"]},i={};return t&&(i.displayRecurrence=o[t]("displayRecurrence")),e&&(i.closingRecurrence=o[e]("closingRecurrence")),n&&(i.validationRecurrence=o[n]("validationRecurrence")),i})(),this.triggerParams=(()=>{let{triggerEvent:t}=DATA;const{triggerEventClick:e,triggerEventReengageDelay:n,socialProofContentType:o,triggerEventElementVisible:i,triggerEventDelay:r}=DATA;if(s()||!t&&!o)return!1;const a={click:()=>e,elementVisible:()=>i},c=Object.prototype.hasOwnProperty.call(a,t)?a[t]():"body",l="reengage"===t?n:r;o&&(t=1===o?"socialProofPurchases":"socialProofPageViews");return{triggerEvent:t,triggerSelector:c,triggerDelay:l}})(),this.recurrence=!!this.recurrenceParams&&new w(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new p(this.triggerParams),this.pageWatcher=new b(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:t,triggerEvent:e}=DATA;if(!e)return!0;return!(!t||!["click","script"].includes(e))||["pageLoad","direct","reengage","socialProofPurchases","socialProofPageViews","elementVisible"].some(t=>t===e)})(),this.basicClassName="ab_widget_container_"+this.widgetName,this.widgetContainerId=`${this.basicClassName}_${this.uniqueId}`,this.contentClassName=this.basicClassName+"_content",this.overlayClassName=this.basicClassName+"_overlay",this.closeButtonClassName=this.basicClassName+"_close_button",this.hideClassName="ab_hide_"+this.uniqueId,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.elementsWaiters=[]}clearGivenClearables(){this.eventsListeners.length&&(this.eventsListeners.forEach(t=>document.removeEventListener(...t)),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(t=>clearInterval(t)),this.intervals=[]),this.observers.length&&(this.observers.forEach(t=>t.disconnect()),this.observers=[]),this.promises.length&&(this.promises.forEach(t=>t.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[])}isWidgetApplied(){return this.domElement&&!!this.domElement.closest("html")}removeOldDomElement(){const t=document.getElementById(this.widgetContainerId);return t&&t.remove(),this}async insert(){const t=(t,e,n)=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e),h(t),n(t)},e=new Promise((e,n)=>{const o=m("head",t=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t!==o),e(t.appendChild(this.styleElement))},e=>t(e,o,n));this.elementsWaiters.push(o)}),n=new Promise((e,n)=>{const{layout:o,elementReferrer:s,referrerInsertType:i}=DATA,{selector:r,position:a}="string"==typeof o&&"free"===o&&"string"==typeof s&&"string"==typeof i?{selector:s,position:i}:{selector:"body",position:"beforeend"},c=m(r,t=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t!==c),this.removeOldDomElement(),e(t.insertAdjacentElement(a,this.domElement))},e=>t(e,c,n));this.elementsWaiters.push(c)});return Promise.all([n,e]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),this.domElement&&this.domElement.closest("html")&&this.domElement.remove(),this.styleElement&&this.styleElement.closest("html")&&this.styleElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch():s()||this.init().then(({response:t})=>t?this.show():this),this}show(){return this.hasBeenShown||s()||window.ABTastyEvent(this.prettyName+" displayed",null,TEST_ID),this.closedByUser=!1,this.domElement.classList.remove(this.hideClassName),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(){return this.hasBeenShown&&!s()&&window.ABTastyEvent(this.prettyName+" closed",null,TEST_ID),this.closedByUser=!0,this.domElement.classList.add(this.hideClassName),this}async init(t){if(!s()&&!a())return!1;if(this.trigger&&this.trigger.promises.length)return!1;const e=this.recurrence&&this.recurrence.isOver();if(this.recurrence&&!e)return this.pageWatcher.watch(),!1;this.pageWatcher.watch();const n=s()||!this.trigger||this.trigger&&await this.trigger.isTriggered();return!!n&&(await this.insert(),this.addCloseEvent(),s()||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(n),{container:this,response:n})}onPageChange(t,e){const n=()=>this.init().then(({response:t})=>t&&this.show());switch(e||(this.hasBeenShown=!1),t){case"remove":this.isWidgetApplied()?this.remove():(this.trigger&&this.trigger.clear(),this.pageWatcher.watch());break;case"rebuild":this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():this.insert().then(t=>t.show()):n()}}addCloseEvent(...t){const{closeButton:e,overlayClickable:n,layout:o}=DATA,i=[];if(void 0!==n&&n&&void 0!==o&&"popin"===o&&i.push("."+this.overlayClassName),void 0!==e&&e&&i.push("."+this.closeButtonClassName),!i.length)return this;const r=this.domElement.querySelectorAll(i.join(", "));return r.length?(t.push(...r),t.forEach(t=>{s()&&(t.dataset.abtastyActionnable="true"),t.addEventListener("click",t=>{(t=>{s()||(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())})(t),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(),setTimeout(()=>this.remove(),1e3)},{once:!0,capture:!0})}),this):this}getDom(){const{closeButton:t,layout:e}=DATA,n=document.createElement("div");return n.className=`${this.basicClassName} ${this.hideClassName}`,n.id=this.widgetContainerId,n.innerHTML=`\n\t\t\t${void 0!==e&&"popin"===e?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${t?`<button class="${this.closeButtonClassName}"><svg viewBox="0 0 16 16">\n\t<defs><path id="prefix__a" d="M12 4.991L11.009 4 8 7.009 4.991 4 4 4.991 7.009 8 4 11.009 4.991 12 8 8.991 11.009 12 12 11.009 8.991 8z"></path></defs>\n\t<g><use xlink:href="#prefix__a"></use></g>\n</svg></button>`:""}\n\t\t\t</div>`,n}loadFont(t,e){if(!t||"inherit"===t)return;const n=document.createElement("style"),o=e.match(f)?e.match(f)[1]:"";n.appendChild(document.createTextNode(`\t\t\t@font-face { \t\tfont-family: '${t}_${o}'; src: url('${e}');\t\t\t}\t\t`)),document.head.appendChild(n)}getStyleTag(t=""){const{noStyles:e,layout:n}=DATA,{backgroundColor:o,isBackgroundImage:i,backgroundImage:r,backgroundSize:a,backgroundPosition:c,backgroundRepeat:l,borderColor:d,borderRadius:h,borderWidth:u,textColor:m,textAlign:y,fontName:g,fontStyle:p,fontSize:w,isTitle:b,titleTextAlign:v,titleTextColor:x,titleFontName:T,titleFontStyle:S,titleFontSize:E,overlayColor:C,dropShadow:A,dropShadowColor:$,dropShadowBlur:k,containerMargin:B,containerPadding:L,closeButton:I,buttonsBorderWidth:N,buttonsBorderColor:_,buttonsBorderRadius:P,buttonsBackgroundColor:R,buttonsTextColor:O,buttonsFontName:W,buttonsFontStyle:D,buttonsFontSize:j}=e?{}:DATA,q=document.createElement("style");q.type="text/css",s()&&q.setAttribute("abtasty-script-added","true"),this.loadFont(g,p),this.loadFont(T,S),this.loadFont(W,D);const F=`background: ${["string"==typeof o?o:"rgba(255, 255, 255, 1)",i&&"string"==typeof r&&r.length?`url(${r})`:"",i&&"string"==typeof c&&"100% 100%"!==a?c:"0 0",i&&"string"==typeof a?"/ "+a:"/ auto",i&&l&&!["cover","100% 100%"].includes(a)?"repeat":"no-repeat"].join(" ").trim()};`,M="number"==typeof u&&u>0,V=`border: ${[M?u+"px":"unset",M?"solid":"",M&&"string"==typeof d&&d.length?d:""].join(" ").trim()};`,H=void 0!==h?`border-radius: ${h}px;`:"",z=void 0!==m?`color: ${m}; fill: ${m}; -webkit-text-fill-color: ${m};`:"",G=void 0!==y?`text-align: ${y};`:"",U=g&&"inherit"!==g?`font-family:${g}_${p.match(f)?p.match(f)[1]:""};`:p||"",Y=w?`font-size: ${w}px;`:"",K=void 0!==A&&A?`box-shadow: 0 5px ${k}px 0 ${$};`:"",J=B instanceof Array&&1===B.length&&B[0],Q=J?`margin: ${J.top}px ${J.right}px ${J.bottom}px ${J.left}px;`:"",Z=J?`margin: calc(${J.top}px * 0.5) calc(${J.right}px * 0.5) calc(${J.bottom}px * 0.5) calc(${J.left}px * 0.5);`:"",X=L instanceof Array&&1===L.length&&L[0],tt=X?`padding: ${X.top}px ${X.right}px ${X.bottom}px ${X.left}px;`:"",et=X?`padding: calc(${X.top}px * 0.5) calc(${X.right}px * 0.5) calc(${X.bottom}px * 0.5) calc(${X.left}px * 0.5);`:"",nt=void 0!==N&&N?`border-width: ${N}px; border-style: solid;`:"",ot=[_,N].every(t=>void 0!==t)&&N?`border-color: ${_};`:"",st=void 0!==P?`border-radius: ${P}px;`:"",it=void 0!==R?`background-color: ${R};`:"",rt=void 0!==O?`color: ${O}; fill: ${O}; -webkit-text-fill-color: ${O};`:"",at=W&&"inherit"!==W?`font-family:${W}_${D.match(f)?D.match(f)[1]:""};`:D||"",ct=j?`font-size: ${j}px;`:"",lt=void 0!==n&&"popin"===n?[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==C?C:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""):"",dt=e||void 0!==I&&I?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;","top: 8px;","right: 8px;","width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;","width: 16px;","height: 16px;",z,U,Y,"}"].join(""):"",ht=b&&"string"==typeof x?[`#${this.widgetContainerId} .${this.contentClassName} > * h1, `,`#${this.widgetContainerId} .${this.contentClassName} > * h2, `,`#${this.widgetContainerId} .${this.contentClassName} > * h3, `,`#${this.widgetContainerId} .${this.contentClassName} > * h4, `,`#${this.widgetContainerId} .${this.contentClassName} > * h5, `,`#${this.widgetContainerId} .${this.contentClassName} > * h6 {`,`color: ${x}; fill: ${x}; -webkit-text-fill-color: ${x};`,void 0!==v?`text-align: ${v};`:"",T&&"inherit"!==T?`font-family:${T}_${S.match(f)?S.match(f)[1]:""};`:S||"",E?`font-size: ${E}px;`:"","}"].join(""):"";return q.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,F,H,V,z,G,K,Q,U,Y,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,z,G,U,Y,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",tt,U,Y,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a, `,`#${this.widgetContainerId} .${this.contentClassName} > * button {`,nt,ot,st,it,rt,at,ct,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a *, `,`#${this.widgetContainerId} .${this.contentClassName} > * button * {`,rt,at,ct,"}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,Z,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,et,"}","}",lt,dt,ht,""+t].join(""),q}}class x extends v{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","background: none;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;","left: 50%;","top: 50%;","transform: translate(-50%, -50%);","width: auto;","height: auto;","}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join("")}}class T extends v{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;",this.position+": 0;","left: 0;","width: 100%;","height: auto;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class S extends v{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}const E=()=>{const{layout:t}=DATA;let e;switch(t){case"popin":e=new x;break;case"bannerTop":case"bannerBottom":e=new T;break;case"free":e=new S;break;default:e=new v}return e};var C=function(t){if(Array.isArray(t))return t};var A=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],o=!0,s=!1,i=void 0;try{for(var r,a=t[Symbol.iterator]();!(o=(r=a.next()).done)&&(n.push(r.value),!e||n.length!==e);o=!0);}catch(t){s=!0,i=t}finally{try{o||null==a.return||a.return()}finally{if(s)throw i}}return n}};var $=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o};var k=function(t,e){if(t){if("string"==typeof t)return $(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$(t,e):void 0}};var B=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")};var L=function(t,e){return C(t)||A(t,e)||k(t,e)||B()};var I=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function N(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var _=function(t,e,n){return e&&N(t.prototype,e),n&&N(t,n),t},P=t((function(t){function e(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=e=function(t){return typeof t}:t.exports=e=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(n)}t.exports=e})),R=["fr","en","de","es"],O=["day","hour","minute","second"],W={day:{en:"Day",fr:"Jour",es:"Dia",de:"Tag"},days:{en:"Days",fr:"Jours",es:"Dias",de:"Tage"},hour:{en:"Hour",fr:"Heure",es:"Hora",de:"Zeit"},hours:{en:"Hours",fr:"Heures",es:"Horas",de:"Stunden"},minute:"Min",second:{en:"Sec",fr:"Sec",es:"Seg",de:"Sek"}};var D=window.ABTASTY_S&&ABTASTY_S.USER&&ABTASTY_S.USER.lang?ABTASTY_S.USER.lang.split("_")[0]:navigator.language.substr(0,2)||"en",j=function(t){return R.indexOf(t)>-1}(D)?D:"en",q={day:W.day[j],days:W.days[j],hour:W.hour[j],hours:W.hours[j],minute:W.minute,minutes:W.minute,second:W.second[j],seconds:W.second[j]};function F(t){return 1e3*(60*t)}function M(t,e,n,o,i,r,a){var c=a.getTime(),l=function(t){var e=!0;if(void 0===t&&(t=new Date),!(t instanceof Date))throw new TypeError("".concat(P(t)," not supported. Expected Date or undefined."));var n=new Date(t.getFullYear(),0,1),o=new Date(t.getFullYear(),6,1),s=n.getTimezoneOffset(),i=o.getTimezoneOffset(),r=t.getTimezoneOffset();return r===s&&r===i&&(e=!1),[e,r-Math.max(s,i)]}(a),d=L(l,2),h=d[0],u=d[1],m=s()&&i?F(r):F(a.getTimezoneOffset())-F(u);return t-c-(i?F(n-o)-m:F(n-o)-F(e))+(h||i?F(u-o):o)}var V=function(){function t(e,n){var o;I(this,t),this.testId=e,this.data=n,this.targetselector=n.selector,this.container=((o=document.createElement("div")).classList.add("abtasty-countdown"),o),this.digitElements={},this.textElements={},this.timeElements={},this.timeLoop=null,this.maxWidth=0,this.previewTime=172799,this.unitsText=q,this.fonts=[],this.data.customTexts&&(this.unitsText={day:this.data.customDaysLabel,days:this.data.customDaysLabel,hour:this.data.customHoursLabel,hours:this.data.customHoursLabel,minute:this.data.customMinutesLabel,minutes:this.data.customMinutesLabel,second:this.data.customSecondsLabel,seconds:this.data.customSecondsLabel})}return _(t,[{key:"getFonts",value:function(){return[{name:this.data.messageFontName,style:this.data.messageFontStyle},{name:this.data.numbersfontName,style:this.data.numbersfontStyle},{name:this.data.legendfontName,style:this.data.legendfontStyle}]}},{key:"addRedirectionEvent",value:function(t){var e=this;!s()&&t&&t.addEventListener("click",(function(){var t=DATA,n=t.autoHide,o=t.timeHide;n&&setTimeout((function(){return e.parentContainer.hide()}),1e3*o),e.parentContainer.recurrence.setValidationRecurrence()}),{useCapture:!0,once:!0})}},{key:"insert",value:function(t,e){return t.insertAdjacentElement(e,this.container),this}},{key:"setText",value:function(t){var e=this;O.forEach((function(n){var o=t[n];String(o).length<2&&(o="0".concat(o)),e.digitElements[n].textContent=o,e.textElements[n].textContent=1===o?e.unitsText[n]:e.unitsText["".concat(n,"s")],e.maxWidth<e.digitElements[n].offsetWidth&&(e.maxWidth=e.digitElements[n].offsetWidth,e.digitElements[n].style.minWidth="".concat(e.maxWidth,"px"),window.requestAnimationFrame((function(){e.setText(t)}))),e.digitElements[n].style.minWidth="".concat(e.maxWidth,"px")}))}},{key:"onTimeEnd",value:function(){var t;if(clearInterval(this.timeLoop),"hideWidget"===this.data.endSettings)return this.parentContainer.hide(),void(this.parentContainer.domElement.style.display="none");var e={};"showText"===this.data.endSettings&&(e.endText=!0,e.endCountdown=!0,e.endButton=!1),"showTextAndButton"===this.data.endSettings&&(e.endText=!0,e.endButton=!0,e.endCountdown=!0),"hideCountdownAndShowText"===this.data.endSettings&&(e.endText=!0,e.endCountdown=!1,e.endButton=!1),"hideCountdownAndShowTextAndButton"===this.data.endSettings&&(e.endText=!0,e.endCountdown=!1,e.endButton=!0);var n=["abtasty-countdown-".concat(this.data.endSettings),"abtasty-countdown-finish"];for(var o in e)e[o]&&!n.includes("abtasty-countdown-".concat(o,"-show"))?n.push("abtasty-countdown-".concat(o,"-show")):n.includes("abtasty-countdown-".concat(o,"-hide"))||n.push("abtasty-countdown-".concat(o,"-hide"));(t=this.container.classList).add.apply(t,n)}},{key:"setCountdown",value:function(){var t=new Date,e=M(this.data.dateTimeStart,this.data.timezoneOffset,this.data.userTimezoneOffset,this.data.sourceDSTMinutes,this.data.followTheSun,this.data.timezoneOffsetPreview,t)/1e3;if(window.ABTastyEditor&&("ifEnded"===this.data.previewBlock&&(e=-1),this.previewTime-=1),e<=0)return this.setText({day:0,hour:0,minute:0,second:0}),void this.onTimeEnd();var n=Math.floor(e/86400);e-=86400*n;var o=Math.floor(e/3600);e-=3600*o;var s=Math.floor(e/60);e-=60*s;var i=Math.floor(e);this.setText({day:n,hour:o,minute:s,second:i})}},{key:"getStyle",value:function(){return this.loadFonts(),"\n .abtasty-countdown .abtasty-countdown-finish-text,\n .abtasty-countdown .abtasty-countdown-top-message {\n white-space: pre-line;\n text-align: ".concat(this.data.messageAlign," !important;\n color: ").concat(this.data.textColor,";\n font-size: ").concat(this.data.messageFontSize,"px; \n ").concat(this.data.messageFontName&&"inherit"!==this.data.messageFontName?"font-family:".concat(this.data.messageFontName,"_").concat(this.data.messageFontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],";"):this.data.messageFontStyle||"",";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-number {\n font-size: ").concat(this.data.numbersfontSize,"px; \n color: ").concat(this.data.numberstextColor,";\n -webkit-text-fill-color: ").concat(this.data.numberstextColor,";\n font-weight: initial;\n ").concat(this.data.numbersfontName&&"inherit"!==this.data.numbersfontName?"font-family:".concat(this.data.numbersfontName,"_").concat(this.data.numbersfontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],";"):this.data.numbersfontStyle||"",";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-text {\n ").concat(this.data.legendfontName&&"inherit"!==this.data.legendfontName?"font-family:".concat(this.data.legendfontName,"_").concat(this.data.legendfontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],";"):this.data.legendfontStyle||"",";\n font-size: ").concat(this.data.legendfontSize,"px; \n color: ").concat(this.data.legendtextColor,";\n -webkit-text-fill-color: ").concat(this.data.legendtextColor,";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-time {\n border-radius: ").concat(this.data.countdownBorderRadius,"px;\n border: ").concat(this.data.countdownBorderWidth,"px solid ").concat(this.data.countdownBorderColor,";\n background-color: ").concat(this.data.numbersBackgroundColor,"; \n } \n ")}},{key:"setButton",value:function(){if(this.data.button){var t=this.container.querySelector(".abtasty-countdown-bottom-button"),e=document.createElement("a");e.href=this.data.btnLink,e.innerHTML=this.data.btnLabel,this.data.btnTargetBlank&&(e.target="_blank"),t.appendChild(e),this.addRedirectionEvent(e)}var n=this.container.querySelector(".abtasty-countdown-finish-button"),o=document.createElement("a");o.href=this.data.endBtnLink,this.data.endBtnTargetBlank&&(o.target="_blank"),o.innerHTML=this.data.endBtnLabel,n.appendChild(o)}},{key:"setContent",value:function(){var t=this.container.querySelector(".abtasty-countdown-top-message"),e=document.createElement("p");e.innerHTML=this.data.message,t.appendChild(e),t=this.container.querySelector(".abtasty-countdown-finish-text"),(e=document.createElement("div")).innerHTML=this.data.endMessage,t.appendChild(e)}},{key:"init",value:function(t){var n,s,i=this;try{if(this.parentContainer=t,"bannerTop"===this.data.layout||"bannerBottom"===this.data.layout)this.container.classList.add("abtasty-countdown-layout-line"),t.domElement.querySelectorAll(".".concat(t.closeButtonClassName)).forEach((function(t){t.classList.add("abtasty-countdown-close-inline")}));else if("free"===this.data.layout)this.container.classList.add("abtasty-countdown-layout-free");else if(this.data.imageOn&&"popin"===this.data.layout){this.container.classList.add("abtasty-countdown-layout-block");var r=this.data.image,a=new Image;a.src=r,a.classList.add("abtasty-countdown-image"),a.onload=function(){var t=o(e.mark((function t(){var n,o;return e.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=document.querySelector(".countdown_popin_img_container"),o="margin-bottom:20px; width:100%;","https://widgets-images.abtasty.com/widgets-default-image.png"===r&&(o+="width:300px !important; height:220px;"),a.style=o,n.appendChild(a);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()}else this.container.classList.add("abtasty-countdown-layout-block");this.container.innerHTML='\n <div class="abtasty-countdown-layout-'.concat(this.data.layout,'">\n ').concat(this.data.imageOn&&"popin"===this.data.layout?'<div class="countdown_popin_img_container" style="width:100%;"></div>':"",'\n <div class="abtasty-countdown-clock">\n <div class="abtasty-countdown-days abtasty-countdown-elm-time">\n <div class="abtasty-countdown-days__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-days__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-hours abtasty-countdown-elm-time">\n <div class="abtasty-countdown-hours__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-hours__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-minutes abtasty-countdown-elm-time">\n <div class="abtasty-countdown-minutes__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-minutes__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-seconds abtasty-countdown-elm-time">\n <div class="abtasty-countdown-seconds__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-seconds__text abtasty-countdown-elm-text"></div>\n </div>\n </div>\n <div class="abtasty-countdown-top-message"></div>\n <div class="abtasty-countdown-finish-text"></div>\n <div class="abtasty-countdown-finish-button"></div>\n <div class="abtasty-countdown-bottom-button"></div>\n </div>'),this.container.insertAdjacentElement("afterbegin",(n="".concat(".abtasty-countdown{display:inline-block}.abtasty-countdown>div{display:inline-block;text-align:center;margin:10px}.abtasty-countdown .abtasty-countdown-finish-text,.abtasty-countdown .abtasty-countdown-top-message{margin-bottom:15px}.abtasty-countdown .abtasty-countdown-elm-time{display:inline-block;padding:6px;margin:6px 6px 15px}.abtasty-countdown .abtasty-countdown-elm-text{text-align:center}.abtasty-countdown .abtasty-countdown-elm-number,.abtasty-countdown .abtasty-countdown-elm-text{font-weight:700;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}.abtasty-countdown .abtasty-countdown-bottom-button a,.abtasty-countdown .abtasty-countdown-finish-button a{cursor:pointer;text-decoration:none;display:block;border:1px solid #57b8c7;text-align:center;display:inline-block;padding:6px 10px}.abtasty-countdown-layout-line>div{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:stretch;-ms-flex-pack:stretch;justify-content:stretch}@media (max-width:740px){.abtasty-countdown-layout-line>div{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.abtasty-countdown-layout-line div.abtasty-countdown-finish-text,.abtasty-countdown-layout-line div.abtasty-countdown-top-message{margin-bottom:20px;margin-top:20px}.abtasty-countdown-layout-line div.abtasty-countdown-bottom-button a{margin-left:0}}.abtasty-countdown-layout-line>div>div{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.abtasty-countdown-layout-free{display:block;text-align:center}.abtasty-countdown-layout-line>div{margin:0}.abtasty-countdown-layout-line .abtasty-countdown-finish-text,.abtasty-countdown-layout-line .abtasty-countdown-top-message{-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 5px 0 15px;margin-bottom:0}.abtasty-countdown-layout-line .abtasty-countdown-top-message p{margin-bottom:0}.abtasty-countdown-layout-line .abtasty-countdown-bottom-button a{margin-left:30px}.abtasty-countdown-layout-line .abtasty-countdown-elm-time{margin:0}.abtasty-countdown-layout-line{-webkit-box-sizing:border-box;box-sizing:border-box}.abtasty-countdown-layout-line .abtasty-countdown-bottom-button,.abtasty-countdown-layout-line .abtasty-countdown-clock,.abtasty-countdown-layout-line .abtasty-countdown-finish-button{-ms-flex-negative:0;flex-shrink:0}.abtasty-countdown-finish-button,.abtasty-countdown-finish-text{display:none}.abtasty-countdown-endButton-show .abtasty-countdown-finish-button,.abtasty-countdown-endCountdown-show.abtasty-countdown-clock,.abtasty-countdown-endText-show .abtasty-countdown-finish-text{display:block}.abtasty-countdown-layout-line.abtasty-countdown-endButton-show .abtasty-countdown-finish-button,.abtasty-countdown-layout-line.abtasty-countdown-endCountdown-show .abtasty-countdown-clock,.abtasty-countdown-layout-line.abtasty-countdown-endText-show .abtasty-countdown-finish-text{display:table-cell}.abtasty-countdown-endButton-hide .abtasty-countdown-finish-button,.abtasty-countdown-endCountdown-hide .abtasty-countdown-clock,.abtasty-countdown-endText-hide .abtasty-countdown-finish-text,.abtasty-countdown-finish .abtasty-countdown-bottom-button,.abtasty-countdown-finish .abtasty-countdown-top-message{display:none!important}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:55%!important}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-button,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-button{width:45%!important}.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:30%!important}.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom .abtasty-countdown-clock,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-button,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-button{width:35%!important}.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:65%}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop,.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop{width:100%}"," ").concat(this.getStyle()),(s=document.createElement("style")).type="text/css",s.styleSheet?s.styleSheet.cssText=n:s.appendChild(document.createTextNode(n)),s)),O.forEach((function(t){var e=i.container.querySelector(".abtasty-countdown-".concat(t,"s")),n=L(e.children,2),o=n[0],s=n[1];i.digitElements[t]=o,i.textElements[t]=s,i.timeElements[t]=e})),this.setContent(),this.setButton(),this.timeLoop=setInterval(this.setCountdown.bind(this),1e3),setTimeout((function(){i.setCountdown()}),100),this.setCountdown()}catch(t){console.warn("Countdown error occured during widget rendering:",t)}}},{key:"loadFonts",value:function(){this.getFonts().forEach((function(t){var e=t.name,n=t.style;if(e&&"inherit"!==e){var o=document.createElement("style");o.appendChild(document.createTextNode(" @font-face { font-family: '".concat(e,"_").concat(n.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],"'; src: url('").concat(n,"'); } "))),document.head.appendChild(o)}}))}}]),t}();function H(){return(H=o(e.mark((function t(){var n,o,s;return e.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=E(),t.next=3,n.init();case 3:if(t.sent){t.next=6;break}return t.abrupt("return",!1);case 6:return o=n.domElement.querySelector(".".concat(n.contentClassName)),(s=new V(TEST_ID,DATA)).init(n),s.insert(o,"beforeend"),n.show(),t.abrupt("return",s);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}!function(){H.apply(this,arguments)}()}();
|
1
|
+
!function(){"use strict";var t=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){var e=function(t){var e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",r=o.toStringTag||"@@toStringTag";function a(t,e,n,o){var s=e&&e.prototype instanceof d?e:d,i=Object.create(s.prototype),r=new T(o||[]);return i._invoke=function(t,e,n){var o="suspendedStart";return function(s,i){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===s)throw i;return E()}for(n.method=s,n.arg=i;;){var r=n.delegate;if(r){var a=f(r,n);if(a){if(a===l)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var d=c(t,e,n);if("normal"===d.type){if(o=n.done?"completed":"suspendedYield",d.arg===l)continue;return{value:d.arg,done:n.done}}"throw"===d.type&&(o="completed",n.method="throw",n.arg=d.arg)}}}(t,n,r),i}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=a;var l={};function d(){}function h(){}function u(){}var m={};m[s]=function(){return this};var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==e&&n.call(g,s)&&(m=g);var p=u.prototype=d.prototype=Object.create(m);function w(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function b(t,e){var o;this._invoke=function(s,i){function r(){return new e((function(o,r){!function o(s,i,r,a){var l=c(t[s],t,i);if("throw"!==l.type){var d=l.arg,h=d.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){o("next",t,r,a)}),(function(t){o("throw",t,r,a)})):e.resolve(h).then((function(t){d.value=t,r(d)}),(function(t){return o("throw",t,r,a)}))}a(l.arg)}(s,i,o,r)}))}return o=o?o.then(r,r):r()}}function f(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,f(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var o=c(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,l;var s=o.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function v(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(v,this),this.reset(!0)}function S(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return h.prototype=p.constructor=u,u.constructor=h,u[r]=h.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,r in t||(t[r]="GeneratorFunction")),t.prototype=Object.create(p),t},t.awrap=function(t){return{__await:t}},w(b.prototype),b.prototype[i]=function(){return this},t.AsyncIterator=b,t.async=function(e,n,o,s,i){void 0===i&&(i=Promise);var r=new b(a(e,n,o,s),i);return t.isGeneratorFunction(n)?r:r.next().then((function(t){return t.done?t.value:r.next()}))},w(p),p[r]="Generator",p[s]=function(){return this},p.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var o=e.pop();if(o in t)return n.value=o,n.done=!1,n}return n.done=!0,n}},t.values=S,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return r.type="throw",r.arg=t,e.next=n,o&&(e.method="next",e.arg=void 0),!!o}for(var s=this.tryEntries.length-1;s>=0;--s){var i=this.tryEntries[s],r=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var i=s;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var r=i?i.completion:{};return r.type=t,r.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(r)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),x(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var o=n.completion;if("throw"===o.type){var s=o.arg;x(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));function e(t,e,n,o,s,i,r){try{var a=t[i](r),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(o,s)}var n=function(t){return function(){var n=this,o=arguments;return new Promise((function(s,i){var r=t.apply(n,o);function a(t){e(r,s,i,a,c,"next",t)}function c(t){e(r,s,i,a,c,"throw",t)}a(void 0)}))}};const o=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor"),s=()=>{let t;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?t=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?t=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(t=window.ABTasty.accountSettings.identifier),t):t},i=()=>{const t=!!document.getElementById("ABTastyPreviewBar"),e=location.href.includes("ab_project=preview");return t||e},r=()=>i()||!!window.ABTasty.getTestsOnPage()[TEST_ID],a=()=>{const{type:t}=DATA;return`${PACKAGE.replace("@abtasty/","")}${t?"_"+t:""}`},c=()=>{const t=a();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`.split("-").join(" ")},l=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,d=t=>{if((()=>{if(o()||i())return!1;const t=ABTasty.getTestsOnPage()[TEST_ID];return!!t&&Object.keys(t.targetings.qaParameters).length>0})()){const e=c();window.console.log(`%c${e} - QA Mode for campaign ${TEST_ID}\n${t}`,"background-color: rgba(0, 127, 145, 1); color: rgba(247, 247, 247, 1)")}},h=t=>{const e={promise:null,resolve:null,reject:null,name:t};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e},u=(t,e,n)=>{let o=0,s=0;try{document.querySelector(t)}catch(e){const o=`Selector «${t}» not valid.`;return d(o),"function"==typeof n&&n(o)}function i(){clearInterval(s),clearTimeout(o)}return o=setTimeout(()=>{i();const e=`Can't find element «${t}».`;return d(e),"function"==typeof n&&n(e)},1e4),s=setInterval(()=>{const n=document.querySelector(t);return null!==n?(i(),"function"==typeof e&&e(n)):n},200),{clear:i}};function m(){return"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||(t="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver",new Promise((e,n)=>{const o=window.document.getElementsByTagName("script")[0],s=window.document.createElement("script");s.src=t,o.parentNode.insertBefore(s,o),s.onload=e,s.onerror=n}));var t}class y{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=this.startMutationObserver(),this.mouseOverEvent=this.mouseOverHandler()}intersectionHandler(t){t.forEach(t=>{t.isIntersecting?(this.existingTargets.forEach(e=>{e.element.isSameNode(t.target)&&(this.inViewportTargets.push(e),this.mouseOverEvent.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(e=>!e.element.isSameNode(t.target)||(this.mouseOverEvent.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const t=this.mutationObserver||new MutationObserver(this.checkElements.bind(this));return document.body&&t.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),t}onMouseOver({target:t,path:e}){const n=this.inViewportTargets.find(({element:n,selector:o})=>{if(n.isSameNode(t))return!0;const s=[...t.querySelectorAll(o)];if(s.length){if(s.includes(n))return!0}if(e.includes(n))return!0;const i=[...t.parentElement.children],r=i.findIndex(e=>e.isSameNode(t)),a=i.filter((t,e)=>e>r);if(a.length){if(a.includes(n))return!0;if(a.some(t=>[...t.querySelectorAll(o)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:t,element:e,uniqueId:o}=n,s=this.targets.find(e=>e.selector===t&&e.uniqueId===o);s&&s.resolve(e),this.clear(t,o)}}mouseOverHandler(){const t=["mouseover",t=>setTimeout(()=>this.onMouseOver(t),50),!0];return{start:()=>document.addEventListener(...t),clear:()=>document.removeEventListener(...t)}}isElementVisible(t){return this.isElementTopmost(t)&&this.isElementOpaque(t)}isElementOpaque(t){return"HTML"===function t(e,n){return n(e)||!e.parentElement?e:t(e.parentElement,n)}(t,t=>"0"===window.getComputedStyle(t).opacity).nodeName}isElementTopmost(t){const e=t.getBoundingClientRect(),n=[[e.left,e.top],[e.right,e.top],[e.left,e.bottom],[e.right,e.bottom],[e.left+e.width/2,e.top],[e.left+e.width/2,e.bottom],[e.left,e.height/2],[e.right,e.height/2],[e.left+e.left/2,e.height/2]];let o=!1,s=0;for(;!o&&s<n.length;){const e=document.elementFromPoint(...n[s]);o=t===e||t.contains(e),s+=1}return o}checkElements(){this.targets.forEach(({selector:t,uniqueId:e})=>{const n=document.querySelector(t);n&&!this.existingTargets.find(n=>n.element.matches(t)&&n.uniqueId===e)&&(this.existingTargets.push({element:n,selector:t,uniqueId:e}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:t,element:e})=>!!document.querySelector(t)||(e&&this.visibilityObserver.unobserve(e),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:t,element:e,uniqueId:n})=>{if(e.matches(t)&&this.isElementVisible(e)){const o=this.targets.find(e=>e.selector===t&&e.uniqueId===n);return o&&o.resolve(e),this.clear(t,n),!1}return!0})}watch(t,e,n){this.targets.push({selector:t,resolve:e,uniqueId:n});const o=()=>{this.startMutationObserver(),this.checkElements()};document.body?o():u("body",o)}clear(t,e){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(n=>n.filter(({selector:n,uniqueId:o})=>n!==t&&o!==e));const n=document.querySelector(t);n&&this.visibilityObserver.unobserve(n),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class g{constructor({triggerEvent:t,triggerSelector:e,triggerDelay:n}){this.event=t,this.selector=e&&e.length?e:"body",this.delay=1e3*n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[]}async onElementVisible({promise:t,resolve:e}){const n=h(this.event+"DomReady");this.promises.push(n);const o=await this.onPageLoad(n),s=await async function(t){let e;switch(t){case"IntersectionObserver":e=await m();break;default:e=!0}return e}("IntersectionObserver"),i=new y;if(this.visibilityObservers.push(i),s&&o){const t=l();i.watch(this.selector,e,t)}return t}onPageLoad({promise:t,resolve:e}){const n=()=>"complete"===document.readyState;if(!n()){const o=["readystatechange",()=>n()&&e(!0),{passive:!0}];return this.eventsListeners.push(o),document.addEventListener(...o),t}return e(!0),t}onClick({promise:t,resolve:e}){const n=document.createElement("style");n.type="text/css",n.id="Click_"+l(),n.innerHTML=this.selector+" {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}",document.head.appendChild(n),this.elementsSelectors.push("#"+n.id);const o=t=>[...document.querySelectorAll(this.selector)].some(e=>e.isSameNode(t)||!!t.closest(this.selector)),s=["click",({target:t})=>o(t)&&e(!0),{passive:!0,capture:!0}];return this.eventsListeners.push(s),document.addEventListener(...s),t}onExitIntent({promise:t,resolve:e}){const n=["mouseleave",async({clientY:t})=>{t<=0&&e(!0)},{passive:!0}],o=u("body",t=>{t.addEventListener(...n),this.eventsListeners.push([t,...n]),this.elementsWaiters=this.elementsWaiters.filter(t=>t!==o)});return this.elementsWaiters.push(o),t}onReengage({promise:t,resolve:e}){const n=this.delay;let o=n;const s=[()=>(o=n,o),{passive:!0}];["click","mousemove","scroll","keypress"].forEach(t=>{document.addEventListener(t,...s),this.eventsListeners.push([t,...s])});const i=setInterval(()=>{o<=0?e(!0):o-=100},100);return this.intervals.push(i),t}onCustomTrigger({promise:t,resolve:e}){const{triggerEventCustomScript:n}=DATA;return new Function(`return new Promise(async resolve => {${n}})`)().then(t=>t&&e(!0)),t}getSocialProofPurchases({promise:t,resolve:e}){const n=window.ABTastyProductKey,o=s(),{viewInterval:i,triggerSocialProofMinPurchases:r,spNoTrim:a}=DATA;if(n||(d("Not able to find ABTastyProductKey, impossible to call the API."),e(!1)),n&&o){fetch(`https://social-proof-api.abtasty.com/clients/${o}/metrics/i?key=${n}${a?"&noTrim=true":""}`).then(t=>t.ok&&t.json()).then(t=>(t=>{if(void 0===i||void 0===r)return!1;const e=void 0!==t[i]&&t[i]>=r;return e||d(`Widget will not be shown, product has been purchased ${t[i]} times while ${r} are required`),e})(t)&&e(""+t[i])).catch(()=>d("Failed to fetch datas from server."))}else e(!1);return t}getSocialProofPageViews({promise:t,resolve:e}){const{viewInterval:n,triggerSocialProofMinPageViews:o,spNoTrim:i}=DATA,r=encodeURIComponent(i?window.location.href.replace(window.location.origin,""):""+window.location.pathname),a=s();if(r&&a){fetch(`https://social-proof-api.abtasty.com/clients/${a}/metrics/pv?key=${r}${i?"&noTrim=true":""}`).then(t=>t.ok&&t.json()).then(t=>(t=>{if(void 0===n||void 0===o)return!1;const e=void 0!==t[n]&&t[n]>=o;return e||d(`Widget will not be shown, page has been seen ${t[n]} times while ${o} are required`),e})(t)&&e(""+t[n])).catch(()=>d("Failed to fetch datas from server."))}else e(!1);return t}onConsent({promise:t,resolve:e}){if(!window.ABTasty.cnilReady){const n=["consentValid",()=>e(!0)];return this.eventsListeners.push(n),document.addEventListener(...n),t}return e(!0),t}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(t=>{document.querySelector(t)&&document.querySelector(t).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(t=>{const[e,...n]="string"==typeof t[0]?[document,...t]:t;e&&n.length>1&&e.removeEventListener(...n)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(t=>clearInterval(t)),this.intervals=[]),this.observers.length&&(this.observers.forEach(t=>t.disconnect()),this.observers=[]),this.visibilityObservers.length){const t=l();this.visibilityObservers.forEach(e=>e.clear(this.selector,t)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(t=>t.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]),this}async isTriggered(){this.clear();const t=h(this.event);this.promises.push(t);const e={consent:()=>this.onConsent(t),direct:()=>!0,pageLoad:()=>this.onPageLoad(t),click:()=>this.onClick(t),exitIntent:()=>this.onExitIntent(t),reengage:()=>this.onReengage(t),elementVisible:()=>this.onElementVisible(t),script:()=>this.onCustomTrigger(t),socialProofPurchases:()=>this.getSocialProofPurchases(t),socialProofPageViews:()=>this.getSocialProofPageViews(t)},n=!Object.prototype.hasOwnProperty.call(e,this.event)||await e[this.event]();this.clear();return"reengage"!==this.event&&this.delay?n&&await(async()=>{const t=h(this.event+"Delay");return this.promises.push(t),setTimeout(()=>{t.resolve(!0),this.clear()},this.delay),t.promise})():n}}class p{constructor({displayRecurrence:t,closingRecurrence:e,validationRecurrence:n},o){this.displayRecurrence=parseFloat(t),this.closingRecurrence=parseFloat(e),this.validationRecurrence=parseFloat(n),this.onSetCallback=o,this.widgetName=a(),this.uniqueId=l(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1}onStorage({key:t}){const e=localStorage.getItem("ABTastyWidgetsTemporary"),n=sessionStorage.getItem("ABTastyWidgets");"ABTastyData"===t&&!e&&n&&localStorage.setItem("ABTastyWidgetsTemporary",n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(t){try{const e=t.getItem("ABTastyWidgets");return JSON.parse(e)}catch(e){return t.removeItem("ABTastyWidgets"),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(t,e){const{[this.recurrenceKey]:n,...o}=e;return Object.entries(o).length?(t.setItem("ABTastyWidgets",JSON.stringify(o)),o):(t.removeItem("ABTastyWidgets"),!1)}removeSessionRecurrenceStorage(){const t=this.getSessionRecurrenceStorageParsed();return!!t&&this.removeGivenStorage(window.sessionStorage,t)}removeLocalRecurrenceStorage(){const t=this.getLocalRecurrenceStorageParsed();return!!t&&this.removeGivenStorage(window.localStorage,t)}getSessionRecurrence(){const t=this.getSessionRecurrenceStorageParsed();return!!t&&t[this.recurrenceKey]}getLocalRecurrence(){const t=this.getLocalRecurrenceStorageParsed();return!!t&&t[this.recurrenceKey]}getCurrentRecurrence(){const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();return t||e||{type:!1}}isOver(){const t=localStorage.getItem("ABTastyWidgetsTemporary"),e=!(!t||!t.includes(this.recurrenceKey))||this.getSessionRecurrence();t&&(sessionStorage.setItem("ABTastyWidgets",t),localStorage.removeItem("ABTastyWidgetsTemporary"));const n=this.getLocalRecurrence(),o=(n?parseFloat(n.stamp):0)<(new Date).getTime();return o&&this.removeLocalRecurrenceStorage(),!this.pendingRecurrence&&o&&!this.getLocalRecurrence()&&!e}setRecurrence(t,e){0!==t&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const n=this.getTypeOfStorage(t);if(i()||!n&&"object"!=typeof n)return!1;const{storageString:o,storageMethod:s}=n,r=this.getStamp(t),a={type:e,stamp:r},{type:c}=this.getCurrentRecurrence(),l=async()=>{const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();let n;"session"===o?t?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===o&&(e?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const i=n?{[this.recurrenceKey]:a,...n}:{[this.recurrenceKey]:a};if(!window.ABTasty.cnilReady){this.pendingRecurrence=!0;const t=new g({triggerEvent:"consent"});await t.isTriggered(),this.pendingRecurrence=!1}s.setItem("ABTastyWidgets",JSON.stringify(i)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!s)return!1;if(c&&"validation"!==e)if("closing"===e&&"validation"!==c)l();else{if("display"!==e||"validation"===c||"closing"===c)return!1;l()}else l();return r}setDisplayRecurrence(){this.setRecurrence(this.displayRecurrence,"display")}setClosingRecurrence(){this.setRecurrence(this.closingRecurrence,"closing")}setValidationRecurrence(){this.setRecurrence(this.validationRecurrence,"validation")}getStamp(t){return(new Date).getTime()+864e5*t}getTypeOfStorage(t){return!(isNaN(t)||t<0||0!==t&&!t)&&(t>0?{storageString:"local",storageMethod:window.localStorage}:0===t&&{storageString:"session",storageMethod:window.sessionStorage})}}class w{constructor(t,e,n){this.recurrence=t,this.isWidgetApplied=e,this.callback=n,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.eventListenerParams=["abtasty_resetActionTracking",this.eventHandler.bind(this),{passive:!0}],this.elementsWaiters=[]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(t){const e=r(),{type:n}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1},o=()=>t&&"display"===n||this.recurrenceIsDone();return!this.isWidgetApplied()&&e&&o()?(this.clearWatcher(),this.callback("rebuild",t)):(!this.isWidgetApplied()||e&&o())&&(this.isWidgetApplied()||e)||(this.clearWatcher(),this.callback("remove",t),this.watch()),this}eventHandler(){let t=r();return[250,500].forEach(e=>setTimeout(()=>500===e&&r()===t?this:(t=r(),this.decisionHandler(!1)),e)),this}observerHandler(t){const e=t.some(({removedNodes:t})=>t&&t.length),n=t.some(({addedNodes:t})=>t&&t.length);return e||n?(this.decisionHandler(!0),this):this}watch(){if(o())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const t=u("body",e=>{const n=[e,{childList:!0,subtree:!0}];this.observer.observe(...n),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t)});return this.elementsWaiters.push(t),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}const b=/.+\/([^.]+)\.(otf|ttf)$/;class f{constructor(){this.children=void 0,this.uniqueId=l(),this.widgetName=a(),this.prettyName=c(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:e,validationRecurrence:n}=DATA;if(o()||!t&&!e&&!n)return!1;const s={everytime:()=>-1,session:()=>0,once:()=>395,day:t=>DATA[t+"_day"],week:t=>7*DATA[t+"_week"],month:t=>30.5*DATA[t+"_month"]},i={};return t&&(i.displayRecurrence=s[t]("displayRecurrence")),e&&(i.closingRecurrence=s[e]("closingRecurrence")),n&&(i.validationRecurrence=s[n]("validationRecurrence")),i})(),this.triggerParams=(()=>{let{triggerEvent:t}=DATA;const{triggerEventClick:e,triggerEventReengageDelay:n,socialProofContentType:s,triggerEventElementVisible:i,triggerEventDelay:r}=DATA;if(o()||!t&&!s)return!1;const a={click:()=>e,elementVisible:()=>i},c=Object.prototype.hasOwnProperty.call(a,t)?a[t]():"body",l="reengage"===t?n:r;s&&(t=1===s?"socialProofPurchases":"socialProofPageViews");return{triggerEvent:t,triggerSelector:c,triggerDelay:l}})(),this.recurrence=!!this.recurrenceParams&&new p(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new g(this.triggerParams),this.pageWatcher=new w(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:t,triggerEvent:e}=DATA;if(!e)return!0;return!(!t||!["click","script"].includes(e))||["pageLoad","direct","reengage","socialProofPurchases","socialProofPageViews","elementVisible"].some(t=>t===e)})(),this.basicClassName="ab_widget_container_"+this.widgetName,this.widgetContainerId=`${this.basicClassName}_${this.uniqueId}`,this.contentClassName=this.basicClassName+"_content",this.overlayClassName=this.basicClassName+"_overlay",this.closeButtonClassName=this.basicClassName+"_close_button",this.hideClassName="ab_hide_"+this.uniqueId,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.elementsWaiters=[]}clearGivenClearables(){this.eventsListeners.length&&(this.eventsListeners.forEach(t=>document.removeEventListener(...t)),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(t=>clearInterval(t)),this.intervals=[]),this.observers.length&&(this.observers.forEach(t=>t.disconnect()),this.observers=[]),this.promises.length&&(this.promises.forEach(t=>t.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[])}isWidgetApplied(){return this.domElement&&!!this.domElement.closest("html")}removeOldDomElement(){const t=document.getElementById(this.widgetContainerId);return t&&t.remove(),this}async insert(){const t=(t,e,n)=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e),d(t),n(t)},e=new Promise((e,n)=>{const o=u("head",t=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t!==o),e(t.appendChild(this.styleElement))},e=>t(e,o,n));this.elementsWaiters.push(o)}),n=new Promise((e,n)=>{const{layout:o,elementReferrer:s,referrerInsertType:i}=DATA,{selector:r,position:a}="string"==typeof o&&"free"===o&&"string"==typeof s&&"string"==typeof i?{selector:s,position:i}:{selector:"body",position:"beforeend"},c=u(r,t=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t!==c),this.removeOldDomElement(),e(t.insertAdjacentElement(a,this.domElement))},e=>t(e,c,n));this.elementsWaiters.push(c)});return Promise.all([n,e]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),this.domElement&&this.domElement.closest("html")&&this.domElement.remove(),this.styleElement&&this.styleElement.closest("html")&&this.styleElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch():o()||this.init().then(({response:t})=>t?this.show():this),this}show(){return this.hasBeenShown||o()||window.ABTastyEvent(this.prettyName+" displayed",null,TEST_ID),this.closedByUser=!1,this.domElement.classList.remove(this.hideClassName),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(){return this.hasBeenShown&&!o()&&window.ABTastyEvent(this.prettyName+" closed",null,TEST_ID),this.closedByUser=!0,this.domElement.classList.add(this.hideClassName),this}async init(t){if(!o()&&!r())return!1;if(this.trigger&&this.trigger.promises.length)return!1;const e=this.recurrence&&this.recurrence.isOver();if(this.recurrence&&!e)return this.pageWatcher.watch(),!1;this.pageWatcher.watch();const n=o()||!this.trigger||this.trigger&&await this.trigger.isTriggered();return!!n&&(await this.insert(),this.addCloseEvent(),o()||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(n),{container:this,response:n})}onPageChange(t,e){const n=()=>this.init().then(({response:t})=>t&&this.show());switch(e||(this.hasBeenShown=!1),t){case"remove":this.isWidgetApplied()?this.remove():(this.trigger&&this.trigger.clear(),this.pageWatcher.watch());break;case"rebuild":this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():this.insert().then(t=>t.show()):n()}}addCloseEvent(...t){const{closeButton:e,overlayClickable:n,layout:s}=DATA,i=[];if(void 0!==n&&n&&void 0!==s&&"popin"===s&&i.push("."+this.overlayClassName),void 0!==e&&e&&i.push("."+this.closeButtonClassName),!i.length)return this;const r=this.domElement.querySelectorAll(i.join(", "));return r.length?(t.push(...r),t.forEach(t=>{o()&&(t.dataset.abtastyActionnable="true"),t.addEventListener("click",t=>{(t=>{o()||(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())})(t),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(),setTimeout(()=>this.remove(),1e3)},{once:!0,capture:!0})}),this):this}getDom(){const{closeButton:t,layout:e}=DATA,n=document.createElement("div");return n.className=`${this.basicClassName} ${this.hideClassName}`,n.id=this.widgetContainerId,n.innerHTML=`\n\t\t\t${void 0!==e&&"popin"===e?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${t?`<button class="${this.closeButtonClassName}"><svg viewBox="0 0 16 16">\n\t<defs><path id="prefix__a" d="M12 4.991L11.009 4 8 7.009 4.991 4 4 4.991 7.009 8 4 11.009 4.991 12 8 8.991 11.009 12 12 11.009 8.991 8z"></path></defs>\n\t<g><use xlink:href="#prefix__a"></use></g>\n</svg></button>`:""}\n\t\t\t</div>`,n}loadFont(t,e){if(!t||"inherit"===t)return;const n=document.createElement("style"),o=e.match(b)?e.match(b)[1]:"";n.appendChild(document.createTextNode(`\t\t\t@font-face { \t\tfont-family: '${t}_${o}'; src: url('${e}');\t\t\t}\t\t`)),document.head.appendChild(n)}getStyleTag(t=""){const{noStyles:e,layout:n}=DATA,{backgroundColor:s,isBackgroundImage:i,backgroundImage:r,backgroundSize:a,backgroundPosition:c,backgroundRepeat:l,borderColor:d,borderRadius:h,borderWidth:u,textColor:m,textAlign:y,fontName:g,fontStyle:p,fontSize:w,isTitle:f,titleTextAlign:v,titleTextColor:x,titleFontName:T,titleFontStyle:S,titleFontSize:E,overlayColor:C,dropShadow:A,dropShadowColor:$,dropShadowBlur:k,containerMargin:B,containerPadding:L,closeButton:I,buttonsBorderWidth:N,buttonsBorderColor:_,buttonsBorderRadius:P,buttonsBackgroundColor:R,buttonsTextColor:O,buttonsFontName:W,buttonsFontStyle:D,buttonsFontSize:j}=e?{}:DATA,q=document.createElement("style");q.type="text/css",o()&&q.setAttribute("abtasty-script-added","true"),this.loadFont(g,p),this.loadFont(T,S),this.loadFont(W,D);const F=`background: ${["string"==typeof s?s:"rgba(255, 255, 255, 1)",i&&"string"==typeof r&&r.length?`url(${r})`:"",i&&"string"==typeof c&&"100% 100%"!==a?c:"0 0",i&&"string"==typeof a?"/ "+a:"/ auto",i&&l&&!["cover","100% 100%"].includes(a)?"repeat":"no-repeat"].join(" ").trim()};`,M="number"==typeof u&&u>0,V=`border: ${[M?u+"px":"unset",M?"solid":"",M&&"string"==typeof d&&d.length?d:""].join(" ").trim()};`,H=void 0!==h?`border-radius: ${h}px;`:"",z=void 0!==m?`color: ${m}; fill: ${m}; -webkit-text-fill-color: ${m};`:"",G=void 0!==y?`text-align: ${y};`:"",U=g&&"inherit"!==g?`font-family:${g}_${p.match(b)?p.match(b)[1]:""};`:p||"",Y=w?`font-size: ${w}px;`:"",K=void 0!==A&&A?`box-shadow: 0 5px ${k}px 0 ${$};`:"",J=B instanceof Array&&1===B.length&&B[0],Q=J?`margin: ${J.top}px ${J.right}px ${J.bottom}px ${J.left}px;`:"",Z=J?`margin: calc(${J.top}px * 0.5) calc(${J.right}px * 0.5) calc(${J.bottom}px * 0.5) calc(${J.left}px * 0.5);`:"",X=L instanceof Array&&1===L.length&&L[0],tt=X?`padding: ${X.top}px ${X.right}px ${X.bottom}px ${X.left}px;`:"",et=X?`padding: calc(${X.top}px * 0.5) calc(${X.right}px * 0.5) calc(${X.bottom}px * 0.5) calc(${X.left}px * 0.5);`:"",nt=void 0!==N&&N?`border-width: ${N}px; border-style: solid;`:"",ot=[_,N].every(t=>void 0!==t)&&N?`border-color: ${_};`:"",st=void 0!==P?`border-radius: ${P}px;`:"",it=void 0!==R?`background-color: ${R};`:"",rt=void 0!==O?`color: ${O}; fill: ${O}; -webkit-text-fill-color: ${O};`:"",at=W&&"inherit"!==W?`font-family:${W}_${D.match(b)?D.match(b)[1]:""};`:D||"",ct=j?`font-size: ${j}px;`:"",lt=void 0!==n&&"popin"===n?[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==C?C:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""):"",dt=e||void 0!==I&&I?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;","top: 8px;","right: 8px;","width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;","width: 16px;","height: 16px;",z,U,Y,"}"].join(""):"",ht=f&&"string"==typeof x?[`#${this.widgetContainerId} .${this.contentClassName} > * h1, `,`#${this.widgetContainerId} .${this.contentClassName} > * h2, `,`#${this.widgetContainerId} .${this.contentClassName} > * h3, `,`#${this.widgetContainerId} .${this.contentClassName} > * h4, `,`#${this.widgetContainerId} .${this.contentClassName} > * h5, `,`#${this.widgetContainerId} .${this.contentClassName} > * h6 {`,`color: ${x}; fill: ${x}; -webkit-text-fill-color: ${x};`,void 0!==v?`text-align: ${v};`:"",T&&"inherit"!==T?`font-family:${T}_${S.match(b)?S.match(b)[1]:""};`:S||"",E?`font-size: ${E}px;`:"","}"].join(""):"";return q.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,F,H,V,z,G,K,Q,U,Y,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,z,G,U,Y,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",tt,U,Y,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a, `,`#${this.widgetContainerId} .${this.contentClassName} > * button {`,nt,ot,st,it,rt,at,ct,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a *, `,`#${this.widgetContainerId} .${this.contentClassName} > * button * {`,rt,at,ct,"}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,Z,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,et,"}","}",lt,dt,ht,""+t].join(""),q}}class v extends f{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","background: none;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;","left: 50%;","top: 50%;","transform: translate(-50%, -50%);","width: auto;","height: auto;","}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join("")}}class x extends f{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;",this.position+": 0;","left: 0;","width: 100%;","height: auto;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class T extends f{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}const S=()=>{const{layout:t}=DATA;let e;switch(t){case"popin":e=new v;break;case"bannerTop":case"bannerBottom":e=new x;break;case"free":e=new T;break;default:e=new f}return e};var E=function(t){if(Array.isArray(t))return t};var C=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],o=!0,s=!1,i=void 0;try{for(var r,a=t[Symbol.iterator]();!(o=(r=a.next()).done)&&(n.push(r.value),!e||n.length!==e);o=!0);}catch(t){s=!0,i=t}finally{try{o||null==a.return||a.return()}finally{if(s)throw i}}return n}};var A=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o};var $=function(t,e){if(t){if("string"==typeof t)return A(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(t,e):void 0}};var k=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")};var B=function(t,e){return E(t)||C(t,e)||$(t,e)||k()};var L=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function I(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var N=function(t,e,n){return e&&I(t.prototype,e),n&&I(t,n),t},_=["fr","en","de","es"],P=["day","hour","minute","second"],R={day:{en:"Day",fr:"Jour",es:"Dia",de:"Tag"},days:{en:"Days",fr:"Jours",es:"Dias",de:"Tage"},hour:{en:"Hour",fr:"Heure",es:"Hora",de:"Zeit"},hours:{en:"Hours",fr:"Heures",es:"Horas",de:"Stunden"},minute:"Min",second:{en:"Sec",fr:"Sec",es:"Seg",de:"Sek"}},O=window.ABTASTY_S&&ABTASTY_S.USER&&ABTASTY_S.USER.lang?ABTASTY_S.USER.lang.split("_")[0]:navigator.language.substr(0,2)||"en",W=function(t){return _.indexOf(t)>-1}(O)?O:"en",D={day:R.day[W],days:R.days[W],hour:R.hour[W],hours:R.hours[W],minute:R.minute,minutes:R.minute,second:R.second[W],seconds:R.second[W]};var j=function(){function e(t,n){var o;L(this,e),this.testId=t,this.data=n,this.targetselector=n.selector,this.container=((o=document.createElement("div")).classList.add("abtasty-countdown"),o),this.digitElements={},this.textElements={},this.timeElements={},this.timeLoop=null,this.maxWidth=0,this.previewTime=172799,this.unitsText=D,this.fonts=[],this.data.customTexts&&(this.unitsText={day:this.data.customDaysLabel,days:this.data.customDaysLabel,hour:this.data.customHoursLabel,hours:this.data.customHoursLabel,minute:this.data.customMinutesLabel,minutes:this.data.customMinutesLabel,second:this.data.customSecondsLabel,seconds:this.data.customSecondsLabel})}return N(e,[{key:"getFonts",value:function(){return[{name:this.data.messageFontName,style:this.data.messageFontStyle},{name:this.data.numbersfontName,style:this.data.numbersfontStyle},{name:this.data.legendfontName,style:this.data.legendfontStyle}]}},{key:"addRedirectionEvent",value:function(t){var e=this;!o()&&t&&t.addEventListener("click",(function(){var t=DATA,n=t.autoHide,o=t.timeHide;n&&setTimeout((function(){return e.parentContainer.hide()}),1e3*o),e.parentContainer.recurrence.setValidationRecurrence()}),{useCapture:!0,once:!0})}},{key:"insert",value:function(t,e){return t.insertAdjacentElement(e,this.container),this}},{key:"setText",value:function(t){var e=this;P.forEach((function(n){var o=t[n];String(o).length<2&&(o="0".concat(o)),e.digitElements[n].textContent=o,e.textElements[n].textContent=1===o?e.unitsText[n]:e.unitsText["".concat(n,"s")],e.maxWidth<e.digitElements[n].offsetWidth&&(e.maxWidth=e.digitElements[n].offsetWidth,e.digitElements[n].style.minWidth="".concat(e.maxWidth,"px"),window.requestAnimationFrame((function(){e.setText(t)}))),e.digitElements[n].style.minWidth="".concat(e.maxWidth,"px")}))}},{key:"onTimeEnd",value:function(){var t;if(clearInterval(this.timeLoop),"hideWidget"===this.data.endSettings)return this.parentContainer.hide(),void(this.parentContainer.domElement.style.display="none");var e={};"showText"===this.data.endSettings&&(e.endText=!0,e.endCountdown=!0,e.endButton=!1),"showTextAndButton"===this.data.endSettings&&(e.endText=!0,e.endButton=!0,e.endCountdown=!0),"hideCountdownAndShowText"===this.data.endSettings&&(e.endText=!0,e.endCountdown=!1,e.endButton=!1),"hideCountdownAndShowTextAndButton"===this.data.endSettings&&(e.endText=!0,e.endCountdown=!1,e.endButton=!0);var n=["abtasty-countdown-".concat(this.data.endSettings),"abtasty-countdown-finish"];for(var o in e)e[o]&&!n.includes("abtasty-countdown-".concat(o,"-show"))?n.push("abtasty-countdown-".concat(o,"-show")):n.includes("abtasty-countdown-".concat(o,"-hide"))||n.push("abtasty-countdown-".concat(o,"-hide"));(t=this.container.classList).add.apply(t,n)}},{key:"setCountdown",value:function(){var t=new Date,e=function(t,e){switch(t.type){case"global":return t.timestamp-e.getTime();case"local":if(o())return t.previewTimestamp-e.getTime();var n=t.timecomponents,s=n.year,i=n.month,r=n.day,a=n.hour,c=n.minute;return new Date(s,i-1,r,a,c).getTime()-e.getTime();default:return 0}}(this.data.dateTime,t)/1e3;if(window.ABTastyEditor&&("ifEnded"===this.data.previewBlock&&(e=-1),this.previewTime-=1),e<=0)return this.setText({day:0,hour:0,minute:0,second:0}),void this.onTimeEnd();var n=Math.floor(e/86400);e-=86400*n;var s=Math.floor(e/3600);e-=3600*s;var i=Math.floor(e/60);e-=60*i;var r=Math.floor(e);this.setText({day:n,hour:s,minute:i,second:r})}},{key:"getStyle",value:function(){return this.loadFonts(),"\n .abtasty-countdown .abtasty-countdown-finish-text,\n .abtasty-countdown .abtasty-countdown-top-message {\n white-space: pre-line;\n text-align: ".concat(this.data.messageAlign," !important;\n color: ").concat(this.data.textColor,";\n font-size: ").concat(this.data.messageFontSize,"px; \n ").concat(this.data.messageFontName&&"inherit"!==this.data.messageFontName?"font-family:".concat(this.data.messageFontName,"_").concat(this.data.messageFontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],";"):this.data.messageFontStyle||"",";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-number {\n font-size: ").concat(this.data.numbersfontSize,"px; \n color: ").concat(this.data.numberstextColor,";\n -webkit-text-fill-color: ").concat(this.data.numberstextColor,";\n font-weight: initial;\n ").concat(this.data.numbersfontName&&"inherit"!==this.data.numbersfontName?"font-family:".concat(this.data.numbersfontName,"_").concat(this.data.numbersfontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],";"):this.data.numbersfontStyle||"",";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-text {\n ").concat(this.data.legendfontName&&"inherit"!==this.data.legendfontName?"font-family:".concat(this.data.legendfontName,"_").concat(this.data.legendfontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],";"):this.data.legendfontStyle||"",";\n font-size: ").concat(this.data.legendfontSize,"px; \n color: ").concat(this.data.legendtextColor,";\n -webkit-text-fill-color: ").concat(this.data.legendtextColor,";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-time {\n border-radius: ").concat(this.data.countdownBorderRadius,"px;\n border: ").concat(this.data.countdownBorderWidth,"px solid ").concat(this.data.countdownBorderColor,";\n background-color: ").concat(this.data.numbersBackgroundColor,"; \n } \n ")}},{key:"setButton",value:function(){if(this.data.button){var t=this.container.querySelector(".abtasty-countdown-bottom-button"),e=document.createElement("a");e.href=this.data.btnLink,e.innerHTML=this.data.btnLabel,this.data.btnTargetBlank&&(e.target="_blank"),t.appendChild(e),this.addRedirectionEvent(e)}var n=this.container.querySelector(".abtasty-countdown-finish-button"),o=document.createElement("a");o.href=this.data.endBtnLink,this.data.endBtnTargetBlank&&(o.target="_blank"),o.innerHTML=this.data.endBtnLabel,n.appendChild(o)}},{key:"setContent",value:function(){var t=this.container.querySelector(".abtasty-countdown-top-message"),e=document.createElement("p");e.innerHTML=this.data.message,t.appendChild(e),t=this.container.querySelector(".abtasty-countdown-finish-text"),(e=document.createElement("div")).innerHTML=this.data.endMessage,t.appendChild(e)}},{key:"init",value:function(e){var o,s,i=this;try{if(this.parentContainer=e,"bannerTop"===this.data.layout||"bannerBottom"===this.data.layout)this.container.classList.add("abtasty-countdown-layout-line"),e.domElement.querySelectorAll(".".concat(e.closeButtonClassName)).forEach((function(t){t.classList.add("abtasty-countdown-close-inline")}));else if("free"===this.data.layout)this.container.classList.add("abtasty-countdown-layout-free");else if(this.data.imageOn&&"popin"===this.data.layout){this.container.classList.add("abtasty-countdown-layout-block");var r=this.data.image,a=new Image;a.src=r,a.classList.add("abtasty-countdown-image"),a.onload=function(){var e=n(t.mark((function e(){var n,o;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=document.querySelector(".countdown_popin_img_container"),o="margin-bottom:20px; width:100%;","https://widgets-images.abtasty.com/widgets-default-image.png"===r&&(o+="width:300px !important; height:220px;"),a.style=o,n.appendChild(a);case 5:case"end":return t.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()}else this.container.classList.add("abtasty-countdown-layout-block");this.container.innerHTML='\n <div class="abtasty-countdown-layout-'.concat(this.data.layout,'">\n ').concat(this.data.imageOn&&"popin"===this.data.layout?'<div class="countdown_popin_img_container" style="width:100%;"></div>':"",'\n <div class="abtasty-countdown-clock">\n <div class="abtasty-countdown-days abtasty-countdown-elm-time">\n <div class="abtasty-countdown-days__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-days__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-hours abtasty-countdown-elm-time">\n <div class="abtasty-countdown-hours__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-hours__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-minutes abtasty-countdown-elm-time">\n <div class="abtasty-countdown-minutes__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-minutes__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-seconds abtasty-countdown-elm-time">\n <div class="abtasty-countdown-seconds__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-seconds__text abtasty-countdown-elm-text"></div>\n </div>\n </div>\n <div class="abtasty-countdown-top-message"></div>\n <div class="abtasty-countdown-finish-text"></div>\n <div class="abtasty-countdown-finish-button"></div>\n <div class="abtasty-countdown-bottom-button"></div>\n </div>'),this.container.insertAdjacentElement("afterbegin",(o="".concat(".abtasty-countdown{display:inline-block}.abtasty-countdown>div{display:inline-block;text-align:center;margin:10px}.abtasty-countdown .abtasty-countdown-finish-text,.abtasty-countdown .abtasty-countdown-top-message{margin-bottom:15px}.abtasty-countdown .abtasty-countdown-elm-time{display:inline-block;padding:6px;margin:6px 6px 15px}.abtasty-countdown .abtasty-countdown-elm-text{text-align:center}.abtasty-countdown .abtasty-countdown-elm-number,.abtasty-countdown .abtasty-countdown-elm-text{font-weight:700;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}.abtasty-countdown .abtasty-countdown-bottom-button a,.abtasty-countdown .abtasty-countdown-finish-button a{cursor:pointer;text-decoration:none;display:block;border:1px solid #57b8c7;text-align:center;display:inline-block;padding:6px 10px}.abtasty-countdown-layout-line>div{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:stretch;-ms-flex-pack:stretch;justify-content:stretch}@media (max-width:740px){.abtasty-countdown-layout-line>div{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.abtasty-countdown-layout-line div.abtasty-countdown-finish-text,.abtasty-countdown-layout-line div.abtasty-countdown-top-message{margin-bottom:20px;margin-top:20px}.abtasty-countdown-layout-line div.abtasty-countdown-bottom-button a{margin-left:0}}.abtasty-countdown-layout-line>div>div{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.abtasty-countdown-layout-free{display:block;text-align:center}.abtasty-countdown-layout-line>div{margin:0}.abtasty-countdown-layout-line .abtasty-countdown-finish-text,.abtasty-countdown-layout-line .abtasty-countdown-top-message{-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 5px 0 15px;margin-bottom:0}.abtasty-countdown-layout-line .abtasty-countdown-top-message p{margin-bottom:0}.abtasty-countdown-layout-line .abtasty-countdown-bottom-button a{margin-left:30px}.abtasty-countdown-layout-line .abtasty-countdown-elm-time{margin:0}.abtasty-countdown-layout-line{-webkit-box-sizing:border-box;box-sizing:border-box}.abtasty-countdown-layout-line .abtasty-countdown-bottom-button,.abtasty-countdown-layout-line .abtasty-countdown-clock,.abtasty-countdown-layout-line .abtasty-countdown-finish-button{-ms-flex-negative:0;flex-shrink:0}.abtasty-countdown-finish-button,.abtasty-countdown-finish-text{display:none}.abtasty-countdown-endButton-show .abtasty-countdown-finish-button,.abtasty-countdown-endCountdown-show.abtasty-countdown-clock,.abtasty-countdown-endText-show .abtasty-countdown-finish-text{display:block}.abtasty-countdown-layout-line.abtasty-countdown-endButton-show .abtasty-countdown-finish-button,.abtasty-countdown-layout-line.abtasty-countdown-endCountdown-show .abtasty-countdown-clock,.abtasty-countdown-layout-line.abtasty-countdown-endText-show .abtasty-countdown-finish-text{display:table-cell}.abtasty-countdown-endButton-hide .abtasty-countdown-finish-button,.abtasty-countdown-endCountdown-hide .abtasty-countdown-clock,.abtasty-countdown-endText-hide .abtasty-countdown-finish-text,.abtasty-countdown-finish .abtasty-countdown-bottom-button,.abtasty-countdown-finish .abtasty-countdown-top-message{display:none!important}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:55%!important}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-button,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-button{width:45%!important}.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:30%!important}.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom .abtasty-countdown-clock,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-button,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-button{width:35%!important}.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:65%}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop,.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop{width:100%}"," ").concat(this.getStyle()),(s=document.createElement("style")).type="text/css",s.styleSheet?s.styleSheet.cssText=o:s.appendChild(document.createTextNode(o)),s)),P.forEach((function(t){var e=i.container.querySelector(".abtasty-countdown-".concat(t,"s")),n=B(e.children,2),o=n[0],s=n[1];i.digitElements[t]=o,i.textElements[t]=s,i.timeElements[t]=e})),this.setContent(),this.setButton(),this.timeLoop=setInterval(this.setCountdown.bind(this),1e3),setTimeout((function(){i.setCountdown()}),100),this.setCountdown()}catch(t){console.warn("Countdown error occured during widget rendering:",t)}}},{key:"loadFonts",value:function(){this.getFonts().forEach((function(t){var e=t.name,n=t.style;if(e&&"inherit"!==e){var o=document.createElement("style");o.appendChild(document.createTextNode(" @font-face { font-family: '".concat(e,"_").concat(n.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],"'; src: url('").concat(n,"'); } "))),document.head.appendChild(o)}}))}}]),e}();function q(){return(q=n(t.mark((function e(){var n,o,s;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=S(),t.next=3,n.init();case 3:if(t.sent){t.next=6;break}return t.abrupt("return",!1);case 6:return o=n.domElement.querySelector(".".concat(n.contentClassName)),(s=new j(TEST_ID,DATA)).init(n),s.insert(o,"beforeend"),n.show(),t.abrupt("return",s);case 12:case"end":return t.stop()}}),e)})))).apply(this,arguments)}!function(){q.apply(this,arguments)}()}();
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@abtasty/countdown",
|
3
3
|
"description": "Widget for AB Tasty",
|
4
|
-
"version": "3.0
|
4
|
+
"version": "3.1.0",
|
5
5
|
"form": "dist/form.js",
|
6
6
|
"main": "dist/main.js",
|
7
7
|
"files": [
|
@@ -14,6 +14,8 @@
|
|
14
14
|
"watch": "rollup -c --watch --dev",
|
15
15
|
"build": "rollup -c",
|
16
16
|
"serve": "widget serve",
|
17
|
+
"prepare": "npm run build",
|
18
|
+
"postpublish": "echo 'Your widget is on NPM. You can now add your widget to AB Tasty at https://app2.abtasty.com/'",
|
17
19
|
"eslint": "eslint src/**/*.js"
|
18
20
|
},
|
19
21
|
"devDependencies": {
|
@@ -51,4 +53,4 @@
|
|
51
53
|
"@abtasty/widget-utils"
|
52
54
|
]
|
53
55
|
}
|
54
|
-
}
|
56
|
+
}
|