Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@abtasty/nps

Package Overview
Dependencies
Maintainers
18
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abtasty/nps - npm Package Compare versions

Comparing version 0.4.6-7 to 0.4.6-8

2

dist/main.js

@@ -1,1 +0,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,r="function"==typeof Symbol?Symbol:{},s=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function a(t,e,n,r){var s=e&&e.prototype instanceof l?e:l,i=Object.create(s.prototype),o=new E(r||[]);return i._invoke=function(t,e,n){var r="suspendedStart";return function(s,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===s)throw i;return k()}for(n.method=s,n.arg=i;;){var o=n.delegate;if(o){var a=b(o,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=c(t,e,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(t,n,o),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 h={};function l(){}function u(){}function d(){}var m={};m[s]=function(){return this};var g=Object.getPrototypeOf,p=g&&g(g(N([])));p&&p!==e&&n.call(p,s)&&(m=p);var f=d.prototype=l.prototype=Object.create(m);function v(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function y(t){var e;this._invoke=function(r,s){function i(){return new Promise((function(e,i){!function e(r,s,i,o){var a=c(t[r],t,s);if("throw"!==a.type){var h=a.arg,l=h.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then((function(t){e("next",t,i,o)}),(function(t){e("throw",t,i,o)})):Promise.resolve(l).then((function(t){h.value=t,i(h)}),(function(t){return e("throw",t,i,o)}))}o(a.arg)}(r,s,e,i)}))}return e=e?e.then(i,i):i()}}function b(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,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,h;var s=r.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,h):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(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 C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function N(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 r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:k}}function k(){return{value:void 0,done:!0}}return u.prototype=f.constructor=d,d.constructor=u,d[o]=u.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===u||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,o in t||(t[o]="GeneratorFunction")),t.prototype=Object.create(f),t},t.awrap=function(t){return{__await:t}},v(y.prototype),y.prototype[i]=function(){return this},t.AsyncIterator=y,t.async=function(e,n,r,s){var i=new y(a(e,n,r,s));return t.isGeneratorFunction(n)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},v(f),f[o]="Generator",f[s]=function(){return this},f.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 r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=N,E.prototype={constructor:E,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(C),!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 r(n,r){return o.type="throw",o.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var s=this.tryEntries.length-1;s>=0;--s){var i=this.tryEntries[s],o=i.completion;if("root"===i.tryLoc)return r("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 r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var s=this.tryEntries[r];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 o=i?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},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),h},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),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var s=r.arg;C(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:N(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));function e(t,e,n,r,s,i,o){try{var a=t[i](o),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,s)}var n=function(t){return function(){var n=this,r=arguments;return new Promise((function(s,i){var o=t.apply(n,r);function a(t){e(o,s,i,a,c,"next",t)}function c(t){e(o,s,i,a,c,"throw",t)}a(void 0)}))}};var r=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var s=function(t){if(Array.isArray(t))return t};var i=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var n=[],r=!0,s=!1,i=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){s=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(s)throw i}}return n}};var o=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var a=function(t,e){return s(t)||i(t,e)||o()};const c=()=>!!window.ABTasty.getTestsOnPage()[TEST_ID],h=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor");const l=()=>{const{type:t}=DATA;return`${PACKAGE.replace("@abtasty/","")}${t?`_${t}`:""}`},u=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,d=(...t)=>{t.unshift(`[AB Tasty Widget] ${PACKAGE}:`),console.log(...t)},m=(t,e,n)=>{let r=0,s=0;try{document.querySelector(t)}catch(e){const r=`Selector «${t}» not valid.`;return d(r),"function"==typeof n&&n(r)}return r=setTimeout(()=>{clearInterval(s);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?(clearTimeout(r),clearInterval(s),"function"==typeof e&&e(n)):n},200),t};async function g(t){let e;switch(t){case"IntersectionObserver":e=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||function(t){return new Promise((e,n)=>{const r=window.document.getElementsByTagName("script")[0],s=window.document.createElement("script");s.src=t,r.parentNode.insertBefore(s,r),s.onload=e,s.onerror=n})}("https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver"));break;default:e=!0}return e}class p{constructor({displayRecurrence:t,closingRecurrence:e,validationRecurrence:n},r){this.displayRecurrence=parseFloat(t),this.closingRecurrence=parseFloat(e),this.validationRecurrence=parseFloat(n),this.onSetCallback=r,this.widgetName=l(),this.uniqueId=u(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`}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,...r}=e;return Object.entries(r).length?(t.setItem("ABTastyWidgets",JSON.stringify(r)),r):(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=this.getLocalRecurrence(),e=(t?parseFloat(t.stamp):0)<(new Date).getTime();return e&&this.removeLocalRecurrenceStorage(),e&&!this.getLocalRecurrence()&&!this.getSessionRecurrence()}setRecurrence(t,e){const n=this.getTypeOfStorage(t);if(!n&&"object"!=typeof n)return!1;const{storageString:r,storageMethod:s}=this.getTypeOfStorage(t),i=this.getStamp(t),o={type:e,stamp:i},{type:a}=this.getCurrentRecurrence(),c=()=>{const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();let n;"session"===r?t?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===r&&(e?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const i=n?{[this.recurrenceKey]:o,...n}:{[this.recurrenceKey]:o};s.setItem("ABTastyWidgets",JSON.stringify(i)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!s)return!1;if(a&&"validation"!==e)if("closing"===e&&"validation"!==a)c();else{if("display"!==e||"validation"===a||"closing"===a)return!1;c()}else c();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 f{constructor(){this.targets=[],this.existingTargets=[],this.inViewPortTargets=[],this.visibilityobserver=this.startVisibilityObserver(),this.mutationobserver=this.startMutationObserver()}intersectionHandler(t){t.forEach(t=>{t.isIntersecting?(this.existingTargets=this.existingTargets.filter(e=>e.element!==t.target||(this.inViewPortTargets.push(e),!1)),this.checkElements()):this.inViewPortTargets=this.inViewPortTargets.filter(e=>e.element!==t.target||(this.existingTargets.push(e),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const t=new MutationObserver(this.checkElements.bind(this));return t.observe(document,{attributes:!0,childList:!0,subtree:!0}),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 r=!1,s=0;for(;!r&&s<n.length;){const e=document.elementFromPoint(...n[s]);r=t===e||t.contains(e),s+=1}return r}checkElements(){this.targets=this.targets.filter(t=>{const e=document.querySelector(t.selector);return!e||(this.existingTargets.push(Object.assign(t,{element:e})),this.visibilityobserver.observe(e),!1)}),this.existingTargets=this.existingTargets.filter(t=>!!document.querySelector(t.selector)||(this.visibilityobserver.unobserve(t.element),this.targets.push(t),!1)),this.inViewPortTargets=this.inViewPortTargets.filter(({element:t,resolve:e})=>!this.isElementVisible(t)||(this.visibilityobserver.unobserve(t),e(t),!1))}watch(t,e){this.targets.push({selector:t,resolve:e})}clear(t){const e=this.targets.filter(e=>e.selector!==t);0===e.length&&(this.existingTargets=[],this.inViewPortTargets=[],this.mutationobserver.disconnect(),this.visibilityobserver.unobserve(t)),this.targets.length>e&&(this.targets=e,this.visibilityobserver.unobserve(t))}}class v{constructor({triggerEvent:t,triggerSelector:e,triggerDelay:n}){this.event=t,this.selector=e&&e.length?e:"body",this.delay=n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[]}static promiseDeferrer(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}async onElementVisible(){const t=v.promiseDeferrer("onElementVisible");this.promises.push(t);const e=await this.onPageLoad(),n=await g("IntersectionObserver"),r=function(t,e){return ABTasty.widgetUtils||(ABTasty.widgetUtils={}),ABTasty.widgetUtils[t]||Object.assign(ABTasty.widgetUtils,{[t]:new e}),ABTasty.widgetUtils[t]}("VisibilityObserver",f);return this.visibilityObservers.push(r),n&&e&&r.watch(this.selector,t.resolve),t.promise}onPageLoad(){const t=v.promiseDeferrer("onPageLoad");this.promises.push(t);const e=()=>"complete"===document.readyState;if(e())t.resolve(!0);else{const n=()=>e()&&!clearTimeout(r)&&!t.resolve(!0),r=setTimeout(()=>t.resolve(!1),2e4),s=["readystatechange",n,{passive:!0}];this.timeouts.push(r),this.eventsListeners.push(s),document.addEventListener(...s)}return t.promise}onClick(){const t=document.createElement("style");t.type="text/css",t.id=`Click_${u()}`,t.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(t),this.elementsSelectors.push(`#${t.id}`);const e=v.promiseDeferrer("onClick");this.promises.push(e);const n=()=>[...document.querySelectorAll(this.selector)],r=t=>n().some(e=>e.isSameNode(t)||!!t.closest(this.selector)),s=["click",({target:t})=>!!r(t)&&(e.resolve(!0),this.clear()),{passive:!0,capture:!0}];return this.eventsListeners.push(s),document.addEventListener(...s),e.promise}onExitIntent(){const t=v.promiseDeferrer("onExitIntent");this.promises.push(t);const e=["mouseleave",async()=>{if(this.delay){const e=1e3*this.delay,n=setTimeout(()=>{t.resolve(!0)},e);this.timeouts.push(n)}else t.resolve(!0)},{passive:!0,once:!0}];return m("body",t=>{t.addEventListener(...e),this.eventsListeners.push([t,...e])}),t.promise}onDelay(){const t=v.promiseDeferrer("onDelay");this.promises.push(t);const e=1e3*this.delay,n=setTimeout(()=>{t.resolve(!0)},e);return this.timeouts.push(n),t.promise}onReengage(){const t=v.promiseDeferrer("onReengage");this.promises.push(t);const e=1e3*this.delay;let n=e;const r=[()=>(n=e,n),{passive:!0}];["click","mousemove","scroll","keypress"].forEach(t=>{document.addEventListener(t,...r),this.eventsListeners.push([t,...r])});const s=setInterval(()=>{n<=0?t.resolve(!0):n-=100},100);return this.intervals.push(s),t.promise}clear(){return 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&&(this.visibilityObservers.forEach(t=>t.clear(this.selector)),this.visibilityObservers=[]),this.promises.length&&(this.promises.forEach(t=>t.resolve(!1)),this.promises=[]),this}async isTriggered(){let t;switch(this.clear(),this.event){case"pageLoad":t=await this.onPageLoad(),this.clear();break;case"click":t=await this.onClick(),this.clear();break;case"exitIntent":t=await this.onExitIntent(),this.clear();break;case"delay":t=await this.onDelay(),this.clear();break;case"reengage":t=await this.onReengage(),this.clear();break;case"elementVisible":t=await this.onElementVisible(),this.clear();break;default:t=!1}return t}}class y{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}]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(t){const e=c(),{type:n}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1},r=()=>t&&"display"===n||this.recurrenceIsDone();return!this.isWidgetApplied()&&e&&r()?(this.clearWatcher(),this.callback("rebuild",t)):(!this.isWidgetApplied()||e&&r())&&(this.isWidgetApplied()||e)||(this.clearWatcher(),this.callback("remove",t),this.watch()),this}eventHandler(){return setTimeout(()=>{this.decisionHandler(!1)},250),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(){return h()?this:(this.clearWatcher(),document.addEventListener(...this.eventListenerParams),m("body",t=>{const e=[t,{childList:!0,subtree:!0}];this.observer.observe(...e)}),this)}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.observer.disconnect(),this}}const b=["pageLoad","delay","reengage"];class w{constructor(){this.uniqueId=u(),this.widgetName=l(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:e,validationRecurrence:n}=DATA;return!(h()||!(t||e||n))&&{displayRecurrence:t,closingRecurrence:e,validationRecurrence:n}})(),this.triggerParams=(()=>{const{triggerEvent:t,triggerEventClick:e,triggerEventExitDelay:n,triggerEventDelay:r,triggerEventReengageDelay:s}=DATA;if(h()||!t)return!1;const i=e;let o;switch(t){case"exitIntent":o=n;break;case"delay":o=r;break;case"reengage":o=s;break;default:o=0}return{triggerEvent:t,triggerSelector:i,triggerDelay:o}})(),this.recurrence=!!this.recurrenceParams&&new p(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new v(this.triggerParams),this.pageWatcher=new y(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=!!this.trigger&&b.some(t=>t===this.trigger.event),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=[]}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=[])}isWidgetApplied(){return this.domElement&&!!this.domElement.closest("html")}insert(){return m("head",t=>t.appendChild(this.styleElement),t=>d(t)),m("body",t=>t.appendChild(this.domElement),t=>d(t)),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():h()||this.init().then(t=>t?this.show():this),this}show(){return this.closedByUser=!1,this.domElement.classList.remove(this.hideClassName),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(){return this.closedByUser=!0,this.domElement.classList.add(this.hideClassName),this}async init(){if(!c())return!1;if(this.trigger&&this.trigger.promises.length)return!1;const t=this.recurrence&&this.recurrence.isOver();return this.recurrence&&!t?(this.pageWatcher.watch(),!1):(this.pageWatcher.watch(),!!(h()||!this.trigger||this.trigger&&await this.trigger.isTriggered())&&(this.insert(),this.addCloseEvent(),this))}onPageChange(t,e){const n=()=>this.init().then(t=>t&&this.show());switch(e||(this.hasBeenShown=!1),t){case"remove":this.isWidgetApplied()?this.remove():(this.trigger.clear(),this.pageWatcher.watch());break;case"rebuild":this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():this.insert().show():n()}}addCloseEvent(...t){const e=this.domElement.querySelectorAll(`\n\t\t\t.${this.overlayClassName},\n\t\t\t.${this.closeButtonClassName}\n\t\t`);return t.push(...e),t.forEach(t=>{t.addEventListener("click",()=>{this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(),setTimeout(()=>this.remove(),1e3)},{passive:!0,once:!0})}),this}getDom(){const t=document.createElement("div");return t.className=`${this.basicClassName} ${this.hideClassName}`,t.id=this.widgetContainerId,t.innerHTML=`\n\t\t\t<div class="${this.overlayClassName}"></div>\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t\t<button class="${this.closeButtonClassName}" ${h()?"data-abtasty-actionnable":""}>+</button>\n\t\t\t</div>`,t}getStyleTag(t=""){const e=document.createElement("style");return e.type="text/css",h()&&e.setAttribute("abtasty-script-added","true"),e.textContent=`\n\t\t\t.${this.hideClassName} {opacity: 0 !important; pointer-events: none;}\n\t\t\t${t}`,e}}class C extends w{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return`\n\t\t#${this.widgetContainerId} {\n\t\t\tposition: fixed;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tz-index: 9999;\n\t\t\topacity: 1;\n\t\t\ttransition: opacity 0.25s ease;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.overlayClassName} {\n\t\t\tposition: absolute;\n\t\t\tz-index: -1;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tbackground-color: black;\n\t\t\topacity: 0.6;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.contentClassName} {\n\t\t\tposition: absolute;\n\t\t\tleft: 50%;\n\t\t\ttop: 50%;\n\t\t\ttransform: translate(-50%, -50%);\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.closeButtonClassName} {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}\n\t\t\n\t\t@media screen and (max-width: 550px) and (orientation: portrait) {\n\t\t\t#${this.widgetContainerId} .${this.closeButtonClassName} {\n\t\t\t\tfont-size: 6vmin;\n\t\t\t}\n\t\t}`}}class E extends w{constructor(t){super(),this.position=t,this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return`\n\t\t#${this.widgetContainerId} {\n\t\t\tposition: fixed;\n\t\t\t${this.position}: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: auto;\n\t\t\tz-index: 9999;\n\t\t\topacity: 1;\n\t\t\ttransition: opacity 0.25s ease;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.overlayClassName} {\n\t\t\tdisplay: none;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.closeButtonClassName} {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}`}}class N extends w{constructor(t,e){super(),this.position=t,this.referrerElement=e,this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}insert(){return m("head",t=>t.appendChild(this.styleElement),t=>d(t)),m(this.referrerElement,t=>t.insertAdjacentElement(this.position,this.domElement),t=>d(t)),this}getStyles(){return`\n\t\t#${this.widgetContainerId} {\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tposition: relative;\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.overlayClassName} {\n\t\t\tdisplay: none;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.closeButtonClassName} {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}`}}var k=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function S(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var x=function(t,e,n){return e&&S(t.prototype,e),n&&S(t,n),t};function L(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}var T=DATA,O=T.themeType,P=T.layout,R=T.isFeedBackQuestion,I=T.isThankYouMessage,B=T.isLegend,j=T.timeHide,A=T.stepToShow,$=T.question,_=T.feedbackQuestion,D=T.buttonText,M=T.thankYouMessage,q=T.zeroLegend,F=T.tenLegend,W=function(){function t(e){var n=e.userStyles,r=e.parentContainer;k(this,t),this.question=$,this.feedbackQuestion=_,this.userStyles=n,this.parentContainer=r,this.buttonText=D,this.thankYouMessage=M,this.legend={zeroLegend:q,tenLegend:F},this.baseClassName="nps_container",this.npsClassName="".concat(this.baseClassName,"_").concat(r.uniqueId),this.questionClassName="".concat(this.baseClassName,"_question"),this.notesClassName="".concat(this.baseClassName,"_notes"),this.feedbackQuestionClassName="".concat(this.questionClassName,"_feedback"),this.feedbackFormClassName="".concat(this.questionClassName,"_feedback_form"),this.notesButtonsClassName="".concat(this.notesClassName,"_button"),this.thankYouClassName="".concat(this.baseClassName,"_thanks"),this.hideClassName="nps_".concat(r.uniqueId,"_display_none"),this.currentNote=NaN,this.userFeedback="",this.npsContainer=this.getContainer(),this.questionElement=this.getQuestionElement(),this.notesContainer=this.getNotesElement(),this.feedbackElements=this.getFeedBackElements(),this.thankYouElement=this.getThankYouElement(),this.npsElement=this.getNPSElement(),this.styleElement=this.getStyleElement()}return x(t,[{key:"sendNote",value:function(){if(!h()&&!isNaN(this.currentNote)){try{window.abtasty.send("nps",{ns:this.currentNote,nf:this.userFeedback})}catch(t){}this.parentContainer.recurrence.setValidationRecurrence()}return this}},{key:"insertIn",value:function(t,e){return document.head.insertAdjacentElement("beforeend",this.styleElement),t.insertAdjacentElement(e,this.npsElement),this}},{key:"remove",value:function(){return this.npsElement&&this.npsElement.remove(),this.styleElement&&this.styleElement.remove(),this}},{key:"complete",value:function(){var t=this;this.sendNote(),setTimeout((function(){t.parentContainer.hide(),setTimeout((function(){t.remove(),t.parentContainer.hide().remove()}),1e3)}),1e3*j)}},{key:"onClickNote",value:function(t){this.currentNote=Number(t.target.dataset.note),R&&this.feedbackQuestion&&this.feedbackQuestion.length?this.showFeedBack():I&&this.thankYouMessage&&this.thankYouMessage.length?this.showThankYouMessage():this.complete()}},{key:"onFeedbackSend",value:function(){I&&this.thankYouMessage&&this.thankYouMessage.length?this.showThankYouMessage():this.complete()}},{key:"showFeedBack",value:function(){var t=this;return this.npsContainer.childNodes.forEach((function(e){return e.classList.add(t.hideClassName)})),Object.values(this.feedbackElements).forEach((function(e){return e.classList.remove(t.hideClassName)})),this}},{key:"showThankYouMessage",value:function(){var t=this;return this.npsContainer.childNodes.forEach((function(e){return e.classList.add(t.hideClassName)})),this.thankYouElement.classList.remove(this.hideClassName),this.complete(),this}},{key:"getThankYouElement",value:function(){var t=document.createElement("p");return t.className="".concat(this.thankYouClassName," ").concat(this.hideClassName),t.innerHTML=this.thankYouMessage,h()&&"displayThanksStep"===A&&t.classList.remove(this.hideClassName),t}},{key:"getFeedBackElements",value:function(){var t=this,e=document.createElement("p");e.className="".concat(this.feedbackQuestionClassName," ").concat(this.hideClassName),e.innerHTML=this.feedbackQuestion;var n=document.createElement("form");n.className="".concat(this.feedbackFormClassName," ").concat(this.hideClassName),n.addEventListener("submit",(function(t){return t.preventDefault()}),{passive:!1});var r=document.createElement("input");r.className="".concat(this.feedbackQuestionClassName,"_input"),r.type="text";var s=document.createElement("button");return s.className="".concat(this.feedbackQuestionClassName,"_button"),s.innerHTML=this.buttonText,s.addEventListener("click",(function(){return t.userFeedback=r.value,t.onFeedbackSend()}),{passive:!0}),h()&&"displayFeedbackStep"===A&&[e,n].forEach((function(e){return e.classList.remove(t.hideClassName)})),n.appendChild(r),n.appendChild(s),{feedbackQuestionElement:e,feedbackFormElement:n}}},{key:"getNotesElement",value:function(){var t=this,e=document.createElement("div");e.className=this.notesClassName,h()&&"displayNoteStep"!==A&&e.classList.add(this.hideClassName);for(var n=10;n>=0;){var r=document.createElement("button");r.className=this.notesButtonsClassName,r.dataset.note=n,h()&&r.setAttribute("data-abtasty-actionnable",""),r.innerHTML+="<span>".concat(n,"</span>"),r.addEventListener("click",(function(e){return t.onClickNote(e)}),{passive:!0}),e.insertAdjacentElement("afterbegin",r),5===n&&r.insertAdjacentHTML("afterend","<br>"),n-=1}return B&&(e.insertAdjacentHTML("afterbegin","<legend>".concat(this.legend.zeroLegend,"</legend>")),e.insertAdjacentHTML("beforeend","<legend>".concat(this.legend.tenLegend,"</legend>"))),e}},{key:"getQuestionElement",value:function(){var t=document.createElement("p");return t.className=this.questionClassName,t.innerHTML=this.question,h()&&"displayNoteStep"!==A&&t.classList.add(this.hideClassName),t}},{key:"getContainer",value:function(){var t=document.createElement("div");return t.className="".concat(this.baseClassName," ").concat(this.npsClassName),t}},{key:"getNPSElement",value:function(){var t=this;return this.npsContainer.appendChild(this.questionElement),this.npsContainer.appendChild(this.notesContainer),R&&Object.values(this.feedbackElements).forEach((function(e){t.npsContainer.appendChild(e)})),I&&this.npsContainer.appendChild(this.thankYouElement),this.npsContainer}},{key:"getDefaultStyles",value:function(){var t="\n\t\t\t#".concat(this.parentContainer.widgetContainerId," .").concat(this.baseClassName,",\n\t\t\t#").concat(this.parentContainer.widgetContainerId," .").concat(this.baseClassName," *");return"\n\t\t".concat(t," {\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tmin-width: inherit;\n\t\t\tmin-height: inherit;\n\t\t\tmax-width: inherit;\n\t\t\tmax-height: inherit;\n\t\t\tline-height: 1;\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t\tborder: none;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\t#").concat(this.parentContainer.widgetContainerId," .").concat(this.hideClassName," {\n\t\t\tdisplay: none !important;\n\t\t}\n\t\t#").concat(this.parentContainer.widgetContainerId," .").concat(this.baseClassName," .").concat(this.notesButtonsClassName," span {\n\t\t\tpointer-events: none;\n\t\t}\n\t\tbody #").concat(this.parentContainer.widgetContainerId," .").concat(this.parentContainer.closeButtonClassName," {\n\t\t\tpadding: 0;\n\t\t\tline-height: 1;\n\t\t}\n\t\t@media (orientation: landscape) {\n\t\t\t").concat(t," {\n\t\t\t\tfont-size: .55vmax;\n\t\t\t}\n\t\t}\n\t\t@media (orientation: landscape) and (max-width: 1280px) {\n\t\t\t").concat(t," {\n\t\t\t\tfont-size: .7vmax;\n\t\t\t}\n\t\t}\n\t\t@media (orientation: landscape) and (max-width: 800px) {\n\t\t\t").concat(t," {\n\t\t\t\tfont-size: 1vmax;\n\t\t\t}\n\t\t}\n\t\t@media (orientation: portrait) {\n\t\t\t").concat(t," {\n\t\t\t\tfont-size: 1vmin;\n\t\t\t}\n\t\t}\n\t\t@media (orientation: portrait) and (max-width: 550px) {\n\t\t\t").concat(t," {\n\t\t\t\tfont-size: 2.2vmin;\n\t\t\t\tline-height: 1.3;\n\t\t\t\tmax-width: ").concat("popin"===P?"85vw":"auto",";\n\t\t\t}\n\t\t}")}},{key:"getThemeDefaultStyles",value:function(){var t="popin"===P?"75em":"auto",e="#".concat(this.parentContainer.widgetContainerId," .").concat(this.npsClassName);return"\n\t\t".concat(e,",\n\t\t").concat(e," * {\n\t\t\tdisplay: flex;\n\t\t\tflex-wrap: nowrap;\n\t\t\tjustify-content: center;\n\t\t}\n\t\t").concat(e," {\n\t\t\twidth: ").concat(t,";\n\t\t\talign-items: center;\n\t\t}\n\t\t").concat(e," .").concat(this.questionClassName,",\n\t\t").concat(e," .").concat(this.feedbackQuestionClassName,",\n\t\t").concat(e," .").concat(this.thankYouClassName," {\n\t\t\tfont-size: 2em;\n\t\t\tmargin-right: 1em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," {\n\t\t\tflex-direction: row;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," legend {\n\t\t\talign-self: center;\n\t\t\tfont-size: 1.5em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," legend:first-of-type {\n\t\t\tmargin-right: 1em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," legend:last-of-type {\n\t\t\tmargin-left: 1em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesButtonsClassName," {\n\t\t\twidth: 3.5em;\n\t\t\theight: 3.5em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesButtonsClassName," span {\n\t\t\tfont-size: 2em;\n\t\t}\n\t\t").concat(e," .").concat(this.feedbackFormClassName," {\n\t\t\tflex-direction: row;\n\t\t}\n\t\t").concat(e," .").concat(this.feedbackFormClassName," input {\n\t\t\twidth: 45em;\n\t\t\theight: 4em;\n\t\t\tpadding: 0 0.5em;\n\t\t}\n\t\t").concat(e," .").concat(this.feedbackFormClassName," button {\n\t\t\twidth: 10em;\n\t\t\tfont-size: 1.4em;\n\t\t}\n\t\t@media screen and (max-width: 550px) and (orientation: portrait) {\n\t\t\t").concat(e," .").concat(this.questionClassName,",\n\t\t\t").concat(e," .").concat(this.feedbackQuestionClassName," ,\n\t\t\t").concat(e," .").concat(this.thankYouClassName," {\n\t\t\t\tmax-width: 90%;\n\t\t\t\t align-self: flex-start;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.notesClassName," {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\twidth: 100%;\n\t\t\t\ttext-align: center;\n\t\t\t\tline-height: 5.5;\n\t\t\t\tposition: relative;\n\t\t\t\t").concat(B?"padding-bottom: 4em;":"","\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.notesButtonsClassName," {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\twidth: 4em;\n\t\t\t\theight: 4em;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.notesClassName," legend {\n\t\t\t\tposition: absolute;\n\t\t\t\tbottom: 0;\n\t\t\t\tleft: 0;\n\t\t\t\tmargin: 0 !important;\n\t\t\t\tfont-size: 1.25em;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.notesClassName," legend:first-of-type {\n\t\t\t\tbottom: 1.2em;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.notesClassName," legend:first-of-type::before {\n\t\t\t\tcontent: '0:';\n\t\t\t\tmargin-right: 0.4em;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.notesClassName," legend:last-of-type::before {\n\t\t\t\tcontent: '10:';\n\t\t\t\tmargin-right: 0.4em;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.feedbackFormClassName," {\n\t\t\t\tflex-direction: column;\n\t\t\t\twidth: 100%;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.feedbackFormClassName," input {\n\t\t\t\tmargin: 0;\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 3em;\n\t\t\t\tfont-size: 1.8em;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.feedbackFormClassName," button {\n\t\t\t\twidth: 50%;\n\t\t\t\theight: 2.7em;\n\t\t\t\tmargin-top: 1em;\n\t\t\t\talign-self: center;\n\t\t\t\tfont-size: 1.5em;\n\t\t\t\tfont-weight: bold;\n\t\t\t}\n\t\t}")}},{key:"getUserStyles",value:function(){var t,e=this.userStyles,n=e.backgroundColor,s=e.borderColor,i=e.borderRadius,o=e.borderWidth,c=e.dropShadow,h=e.textColor,l=e.horizontalPaddingContainer,u=e.verticalPaddingContainer,d=e.horizontalMarginContainer,m=e.verticalMarginContainer,g=e.overlayColor,p=e.overlayOpacity,f=e.shadowOpacity,v=e.buttonsContrast,y=e.buttonsBorderRadius,b=e.buttonsShape,w=e.contentDirection,C=e.questionMargin,E=e.buttonsHorizontalMargin,N=e.inputBackgroundColor,k=e.inputBorderColor,S=e.inputBorderWidth,x=e.inputBorderRadius,T=e.inputTextColor,O=e.inputMarginWithButton,P=e.feedbackButtonBackgroundColor,R=e.feedbackButtonBorderColor,I=e.feedbackButtonBorderWidth,B=e.feedbackButtonBorderRadius,j=e.feedbackButtonTextColor,A=Object.entries(this.userStyles).filter((function(t){return a(t,1)[0].includes(v)})).reduce((function(t,e){var n=a(e,2),s=n[0],i=n[1],o=s.split("_".concat(v))[0],c=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?L(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},t);return c[o]=i,c}),{}),$=A.buttonsBackgroundColor,_=A.buttonsTextColor,D=A.buttonsBorderColor,M=A.buttonsBorderWidth;switch(b){case"roundsquare":t="border-radius: ".concat(y,"px;");break;case"round":t="border-radius: 50%;";break;default:t=""}var q=c?"box-shadow: 0px 5px 10px 2px rgba(0, 0, 0, ".concat(f/100,");"):"",F="#".concat(this.parentContainer.widgetContainerId," .").concat(this.npsClassName),W="\n\t\t\t".concat(F," .").concat(this.notesButtonsClassName," {\n\t\t\t\tmargin-left: ").concat(E,"px;\n\t\t\t\tmargin-right: ").concat(E,"px;\n\t\t\t\tbackground-color: ").concat($,";\n\t\t\t\tborder: ").concat(M,"px solid ").concat(D,";\n\t\t\t\t").concat(t,"\n\t\t\t}\n\t\t\t").concat(F," .").concat(this.notesButtonsClassName," span {\n\t\t\t\tcolor: ").concat(_,";\n\t\t\t}");return"\n\t\t\tbody ".concat(F," {\n\t\t\t\tflex-direction: ").concat(w,";\n\t\t\t\tbackground-color: ").concat(n,";\n\t\t\t\tborder: ").concat(o,"px solid ").concat(s,";\n\t\t\t\tborder-radius: ").concat(i,"px;\n\t\t\t\tpadding: ").concat(u,"px ").concat(l,"px;\n\t\t\t\t").concat(q,"\n\t\t\t}\n\t\t\t").concat(F," .").concat(this.questionClassName,",\n\t\t\t").concat(F," .").concat(this.feedbackQuestionClassName," ,\n\t\t\t").concat(F," .").concat(this.thankYouClassName," {\n\t\t\t\tcolor: ").concat(h,";\n\t\t\t\tmargin-").concat("row"===w?"right":"bottom"," : ").concat(C,"px;\n\t\t\t}\n\t\t\t").concat(F," .").concat(this.thankYouClassName," {\n\t\t\t\tmargin-bottom: 0;\n\t\t\t}\n\t\t\t").concat(F," .").concat(this.notesClassName," legend {\n\t\t\t\tcolor: ").concat(h,";\n\t\t\t}\n\t\t\t").concat(W,"\n\t\t\t").concat(F," .").concat(this.feedbackFormClassName," input {\n\t\t\t\tbackground-color: ").concat(N,";\n\t\t\t\tborder: ").concat(S,"px solid ").concat(k,";\n\t\t\t\tborder-radius: ").concat(x,"px;\n\t\t\t\tcolor: ").concat(T,";\n\t\t\t\tmargin-right: ").concat(O,"px;\n\t\t\t}\n\t\t\t").concat(F," .").concat(this.feedbackFormClassName," button {\n\t\t\t\tbackground-color: ").concat(P,";\n\t\t\t\tborder: ").concat(I,"px solid ").concat(R,";\n\t\t\t\tborder-radius: ").concat(B,"px;\n\t\t\t\tcolor: ").concat(j,";\n\t\t\t}\n\t\t\tbody #").concat(this.parentContainer.widgetContainerId," {\n\t\t\t\tmargin: ").concat(m,"px ").concat(d,"px;\n\t\t\t}\n\t\t\tbody #").concat(this.parentContainer.widgetContainerId," .").concat(this.parentContainer.overlayClassName," {\n\t\t\t\tbackground-color: ").concat(g,";\n\t\t\t\topacity: ").concat(p/100,";\n\t\t\t}\n\t\t\tbody #").concat(this.parentContainer.widgetContainerId," .").concat(this.parentContainer.closeButtonClassName," {\n\t\t\t\ttop: ").concat(u,"px;\n\t\t\t\tright: ").concat(l,"px;\n\t\t\t}")}},{key:"getStyleElement",value:function(){var t="theme"===O,e=this.getDefaultStyles(),n=t?this.getThemeDefaultStyles():"",r=t?this.getUserStyles():"",s=document.createElement("style");return s.type="text/css",h()&&s.setAttribute("abtasty-script-added","true"),s.textContent="".concat(e," ").concat(n," ").concat(r),s}}]),t}();function z(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Y(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?z(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var H=DATA,G=H.layout,V=H.bannerPosition,Q=H.npsElementReferrer,U=H.npsReferrerInsertType,K=H.contentDirection,J=H.themeType,X=H.theme;function Z(){if("customCss"===J)return!1;var t=Object.entries(DATA).filter((function(t){return a(t,1)[0].includes(X)})).reduce((function(t,e){var n=a(e,2),r=n[0],s=n[1],i=r.split("".concat(X,"_"))[1],o=Y({},t);return o[i]=s,o}),{});return Y({},t,{contentDirection:K})}function tt(){return(tt=n(t.mark((function e(){var n,r,s,i;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=G,t.next="popin"===t.t0?3:"banner"===t.t0?5:7;break;case 3:return n=new C,t.abrupt("break",9);case 5:return n=new E(V),t.abrupt("break",9);case 7:return n=new N(U,Q),t.abrupt("break",9);case 9:return r=Z(),s=n.domElement.querySelector(".".concat(n.contentClassName)),i=new W({userStyles:r,parentContainer:n}),n.children=i,i.insertIn(s,"beforeend"),n.init().then((function(t){return t&&n.show()})),t.abrupt("return",{parentContainer:n,NPS:i});case 17:case"end":return t.stop()}}),e)})))).apply(this,arguments)}!function(){tt.apply(this,arguments)}()}();
!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,r="function"==typeof Symbol?Symbol:{},s=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function a(t,e,n,r){var s=e&&e.prototype instanceof l?e:l,i=Object.create(s.prototype),o=new E(r||[]);return i._invoke=function(t,e,n){var r="suspendedStart";return function(s,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===s)throw i;return k()}for(n.method=s,n.arg=i;;){var o=n.delegate;if(o){var a=b(o,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=c(t,e,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(t,n,o),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 h={};function l(){}function u(){}function d(){}var m={};m[s]=function(){return this};var g=Object.getPrototypeOf,p=g&&g(g(N([])));p&&p!==e&&n.call(p,s)&&(m=p);var f=d.prototype=l.prototype=Object.create(m);function v(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function y(t){var e;this._invoke=function(r,s){function i(){return new Promise((function(e,i){!function e(r,s,i,o){var a=c(t[r],t,s);if("throw"!==a.type){var h=a.arg,l=h.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then((function(t){e("next",t,i,o)}),(function(t){e("throw",t,i,o)})):Promise.resolve(l).then((function(t){h.value=t,i(h)}),(function(t){return e("throw",t,i,o)}))}o(a.arg)}(r,s,e,i)}))}return e=e?e.then(i,i):i()}}function b(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,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,h;var s=r.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,h):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(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 C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function N(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 r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:k}}function k(){return{value:void 0,done:!0}}return u.prototype=f.constructor=d,d.constructor=u,d[o]=u.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===u||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,o in t||(t[o]="GeneratorFunction")),t.prototype=Object.create(f),t},t.awrap=function(t){return{__await:t}},v(y.prototype),y.prototype[i]=function(){return this},t.AsyncIterator=y,t.async=function(e,n,r,s){var i=new y(a(e,n,r,s));return t.isGeneratorFunction(n)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},v(f),f[o]="Generator",f[s]=function(){return this},f.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 r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=N,E.prototype={constructor:E,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(C),!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 r(n,r){return o.type="throw",o.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var s=this.tryEntries.length-1;s>=0;--s){var i=this.tryEntries[s],o=i.completion;if("root"===i.tryLoc)return r("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 r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var s=this.tryEntries[r];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 o=i?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},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),h},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),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var s=r.arg;C(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:N(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));function e(t,e,n,r,s,i,o){try{var a=t[i](o),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,s)}var n=function(t){return function(){var n=this,r=arguments;return new Promise((function(s,i){var o=t.apply(n,r);function a(t){e(o,s,i,a,c,"next",t)}function c(t){e(o,s,i,a,c,"throw",t)}a(void 0)}))}};var r=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var s=function(t){if(Array.isArray(t))return t};var i=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var n=[],r=!0,s=!1,i=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){s=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(s)throw i}}return n}};var o=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var a=function(t,e){return s(t)||i(t,e)||o()};const c=()=>!!window.ABTasty.getTestsOnPage()[TEST_ID],h=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor");const l=()=>{const{type:t}=DATA;return`${PACKAGE.replace("@abtasty/","")}${t?`_${t}`:""}`},u=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,d=(...t)=>{t.unshift(`[AB Tasty Widget] ${PACKAGE}:`),console.log(...t)},m=(t,e,n)=>{let r=0,s=0;try{document.querySelector(t)}catch(e){const r=`Selector «${t}» not valid.`;return d(r),"function"==typeof n&&n(r)}return r=setTimeout(()=>{clearInterval(s);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?(clearTimeout(r),clearInterval(s),"function"==typeof e&&e(n)):n},200),t};async function g(t){let e;switch(t){case"IntersectionObserver":e=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||function(t){return new Promise((e,n)=>{const r=window.document.getElementsByTagName("script")[0],s=window.document.createElement("script");s.src=t,r.parentNode.insertBefore(s,r),s.onload=e,s.onerror=n})}("https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver"));break;default:e=!0}return e}class p{constructor({displayRecurrence:t,closingRecurrence:e,validationRecurrence:n},r){this.displayRecurrence=parseFloat(t),this.closingRecurrence=parseFloat(e),this.validationRecurrence=parseFloat(n),this.onSetCallback=r,this.widgetName=l(),this.uniqueId=u(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`}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,...r}=e;return Object.entries(r).length?(t.setItem("ABTastyWidgets",JSON.stringify(r)),r):(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=this.getLocalRecurrence(),e=(t?parseFloat(t.stamp):0)<(new Date).getTime();return e&&this.removeLocalRecurrenceStorage(),e&&!this.getLocalRecurrence()&&!this.getSessionRecurrence()}setRecurrence(t,e){const n=this.getTypeOfStorage(t);if(!n&&"object"!=typeof n)return!1;const{storageString:r,storageMethod:s}=this.getTypeOfStorage(t),i=this.getStamp(t),o={type:e,stamp:i},{type:a}=this.getCurrentRecurrence(),c=()=>{const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();let n;"session"===r?t?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===r&&(e?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const i=n?{[this.recurrenceKey]:o,...n}:{[this.recurrenceKey]:o};s.setItem("ABTastyWidgets",JSON.stringify(i)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!s)return!1;if(a&&"validation"!==e)if("closing"===e&&"validation"!==a)c();else{if("display"!==e||"validation"===a||"closing"===a)return!1;c()}else c();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 f{constructor(){this.targets=[],this.existingTargets=[],this.inViewPortTargets=[],this.visibilityobserver=this.startVisibilityObserver(),this.mutationobserver=this.startMutationObserver()}intersectionHandler(t){t.forEach(t=>{t.isIntersecting?(this.existingTargets=this.existingTargets.filter(e=>e.element!==t.target||(this.inViewPortTargets.push(e),!1)),this.checkElements()):this.inViewPortTargets=this.inViewPortTargets.filter(e=>e.element!==t.target||(this.existingTargets.push(e),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const t=new MutationObserver(this.checkElements.bind(this));return t.observe(document,{attributes:!0,childList:!0,subtree:!0}),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 r=!1,s=0;for(;!r&&s<n.length;){const e=document.elementFromPoint(...n[s]);r=t===e||t.contains(e),s+=1}return r}checkElements(){this.targets=this.targets.filter(t=>{const e=document.querySelector(t.selector);return!e||(this.existingTargets.push(Object.assign(t,{element:e})),this.visibilityobserver.observe(e),!1)}),this.existingTargets=this.existingTargets.filter(t=>!!document.querySelector(t.selector)||(this.visibilityobserver.unobserve(t.element),this.targets.push(t),!1)),this.inViewPortTargets=this.inViewPortTargets.filter(({element:t,resolve:e})=>!this.isElementVisible(t)||(this.visibilityobserver.unobserve(t),e(t),!1))}watch(t,e){this.targets.push({selector:t,resolve:e})}clear(t){const e=this.targets.filter(e=>e.selector!==t);0===e.length&&(this.existingTargets=[],this.inViewPortTargets=[],this.mutationobserver.disconnect(),this.visibilityobserver.unobserve(t)),this.targets.length>e&&(this.targets=e,this.visibilityobserver.unobserve(t))}}class v{constructor({triggerEvent:t,triggerSelector:e,triggerDelay:n}){this.event=t,this.selector=e&&e.length?e:"body",this.delay=n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[]}static promiseDeferrer(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}async onElementVisible(){const t=v.promiseDeferrer("onElementVisible");this.promises.push(t);const e=await this.onPageLoad(),n=await g("IntersectionObserver"),r=function(t,e){return ABTasty.widgetUtils||(ABTasty.widgetUtils={}),ABTasty.widgetUtils[t]||Object.assign(ABTasty.widgetUtils,{[t]:new e}),ABTasty.widgetUtils[t]}("VisibilityObserver",f);return this.visibilityObservers.push(r),n&&e&&r.watch(this.selector,t.resolve),t.promise}onPageLoad(){const t=v.promiseDeferrer("onPageLoad");this.promises.push(t);const e=()=>"complete"===document.readyState;if(e())t.resolve(!0);else{const n=()=>e()&&!clearTimeout(r)&&!t.resolve(!0),r=setTimeout(()=>t.resolve(!1),2e4),s=["readystatechange",n,{passive:!0}];this.timeouts.push(r),this.eventsListeners.push(s),document.addEventListener(...s)}return t.promise}onClick(){const t=document.createElement("style");t.type="text/css",t.id=`Click_${u()}`,t.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(t),this.elementsSelectors.push(`#${t.id}`);const e=v.promiseDeferrer("onClick");this.promises.push(e);const n=()=>[...document.querySelectorAll(this.selector)],r=t=>n().some(e=>e.isSameNode(t)||!!t.closest(this.selector)),s=["click",({target:t})=>!!r(t)&&(e.resolve(!0),this.clear()),{passive:!0,capture:!0}];return this.eventsListeners.push(s),document.addEventListener(...s),e.promise}onExitIntent(){const t=v.promiseDeferrer("onExitIntent");this.promises.push(t);const e=["mouseleave",async()=>{if(this.delay){const e=1e3*this.delay,n=setTimeout(()=>{t.resolve(!0)},e);this.timeouts.push(n)}else t.resolve(!0)},{passive:!0,once:!0}];return m("body",t=>{t.addEventListener(...e),this.eventsListeners.push([t,...e])}),t.promise}onDelay(){const t=v.promiseDeferrer("onDelay");this.promises.push(t);const e=1e3*this.delay,n=setTimeout(()=>{t.resolve(!0)},e);return this.timeouts.push(n),t.promise}onReengage(){const t=v.promiseDeferrer("onReengage");this.promises.push(t);const e=1e3*this.delay;let n=e;const r=[()=>(n=e,n),{passive:!0}];["click","mousemove","scroll","keypress"].forEach(t=>{document.addEventListener(t,...r),this.eventsListeners.push([t,...r])});const s=setInterval(()=>{n<=0?t.resolve(!0):n-=100},100);return this.intervals.push(s),t.promise}clear(){return 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&&(this.visibilityObservers.forEach(t=>t.clear(this.selector)),this.visibilityObservers=[]),this.promises.length&&(this.promises.forEach(t=>t.resolve(!1)),this.promises=[]),this}async isTriggered(){let t;switch(this.clear(),this.event){case"pageLoad":t=await this.onPageLoad(),this.clear();break;case"click":t=await this.onClick(),this.clear();break;case"exitIntent":t=await this.onExitIntent(),this.clear();break;case"delay":t=await this.onDelay(),this.clear();break;case"reengage":t=await this.onReengage(),this.clear();break;case"elementVisible":t=await this.onElementVisible(),this.clear();break;default:t=!1}return t}}class y{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}]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(t){const e=c(),{type:n}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1},r=()=>t&&"display"===n||this.recurrenceIsDone();return!this.isWidgetApplied()&&e&&r()?(this.clearWatcher(),this.callback("rebuild",t)):(!this.isWidgetApplied()||e&&r())&&(this.isWidgetApplied()||e)||(this.clearWatcher(),this.callback("remove",t),this.watch()),this}eventHandler(){return setTimeout(()=>{this.decisionHandler(!1)},250),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(){return h()?this:(this.clearWatcher(),document.addEventListener(...this.eventListenerParams),m("body",t=>{const e=[t,{childList:!0,subtree:!0}];this.observer.observe(...e)}),this)}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.observer.disconnect(),this}}const b=["pageLoad","delay","reengage"];class w{constructor(){this.uniqueId=u(),this.widgetName=l(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:e,validationRecurrence:n}=DATA;return!(h()||!(t||e||n))&&{displayRecurrence:t,closingRecurrence:e,validationRecurrence:n}})(),this.triggerParams=(()=>{const{triggerEvent:t,triggerEventClick:e,triggerEventExitDelay:n,triggerEventDelay:r,triggerEventReengageDelay:s}=DATA;if(h()||!t)return!1;const i=e;let o;switch(t){case"exitIntent":o=n;break;case"delay":o=r;break;case"reengage":o=s;break;default:o=0}return{triggerEvent:t,triggerSelector:i,triggerDelay:o}})(),this.recurrence=!!this.recurrenceParams&&new p(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new v(this.triggerParams),this.pageWatcher=new y(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=!!this.trigger&&b.some(t=>t===this.trigger.event),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=[]}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=[])}isWidgetApplied(){return this.domElement&&!!this.domElement.closest("html")}insert(){return m("head",t=>t.appendChild(this.styleElement),t=>d(t)),m("body",t=>t.appendChild(this.domElement),t=>d(t)),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():h()||this.init().then(t=>t?this.show():this),this}show(){return this.closedByUser=!1,this.domElement.classList.remove(this.hideClassName),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(){return this.closedByUser=!0,this.domElement.classList.add(this.hideClassName),this}async init(){if(!h()&&!c())return!1;if(this.trigger&&this.trigger.promises.length)return!1;const t=this.recurrence&&this.recurrence.isOver();return this.recurrence&&!t?(this.pageWatcher.watch(),!1):(this.pageWatcher.watch(),!!(h()||!this.trigger||this.trigger&&await this.trigger.isTriggered())&&(this.insert(),this.addCloseEvent(),this))}onPageChange(t,e){const n=()=>this.init().then(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().show():n()}}addCloseEvent(...t){const e=this.domElement.querySelectorAll(`\n\t\t\t.${this.overlayClassName},\n\t\t\t.${this.closeButtonClassName}\n\t\t`);return t.push(...e),t.forEach(t=>{t.addEventListener("click",()=>{this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(),setTimeout(()=>this.remove(),1e3)},{passive:!0,once:!0})}),this}getDom(){const t=document.createElement("div");return t.className=`${this.basicClassName} ${this.hideClassName}`,t.id=this.widgetContainerId,t.innerHTML=`\n\t\t\t<div class="${this.overlayClassName}"></div>\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t\t<button class="${this.closeButtonClassName}" ${h()?"data-abtasty-actionnable":""}>+</button>\n\t\t\t</div>`,t}getStyleTag(t=""){const e=document.createElement("style");return e.type="text/css",h()&&e.setAttribute("abtasty-script-added","true"),e.textContent=`\n\t\t\t.${this.hideClassName} {opacity: 0 !important; pointer-events: none;}\n\t\t\t${t}`,e}}class C extends w{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return`\n\t\t#${this.widgetContainerId} {\n\t\t\tposition: fixed;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tz-index: 9999;\n\t\t\topacity: 1;\n\t\t\ttransition: opacity 0.25s ease;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.overlayClassName} {\n\t\t\tposition: absolute;\n\t\t\tz-index: -1;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tbackground-color: black;\n\t\t\topacity: 0.6;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.contentClassName} {\n\t\t\tposition: absolute;\n\t\t\tleft: 50%;\n\t\t\ttop: 50%;\n\t\t\ttransform: translate(-50%, -50%);\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.closeButtonClassName} {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}\n\t\t\n\t\t@media screen and (max-width: 550px) and (orientation: portrait) {\n\t\t\t#${this.widgetContainerId} .${this.closeButtonClassName} {\n\t\t\t\tfont-size: 6vmin;\n\t\t\t}\n\t\t}`}}class E extends w{constructor(t){super(),this.position=t,this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return`\n\t\t#${this.widgetContainerId} {\n\t\t\tposition: fixed;\n\t\t\t${this.position}: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: auto;\n\t\t\tz-index: 9999;\n\t\t\topacity: 1;\n\t\t\ttransition: opacity 0.25s ease;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.overlayClassName} {\n\t\t\tdisplay: none;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.closeButtonClassName} {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}`}}class N extends w{constructor(t,e){super(),this.position=t,this.referrerElement=e,this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}insert(){return m("head",t=>t.appendChild(this.styleElement),t=>d(t)),m(this.referrerElement,t=>t.insertAdjacentElement(this.position,this.domElement),t=>d(t)),this}getStyles(){return`\n\t\t#${this.widgetContainerId} {\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tposition: relative;\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.overlayClassName} {\n\t\t\tdisplay: none;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.closeButtonClassName} {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}`}}var k=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function S(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var x=function(t,e,n){return e&&S(t.prototype,e),n&&S(t,n),t};function L(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}var T=DATA,O=T.themeType,P=T.layout,R=T.isFeedBackQuestion,I=T.isThankYouMessage,B=T.isLegend,j=T.timeHide,A=T.stepToShow,$=T.question,_=T.feedbackQuestion,D=T.buttonText,M=T.thankYouMessage,q=T.zeroLegend,F=T.tenLegend,W=function(){function t(e){var n=e.userStyles,r=e.parentContainer;k(this,t),this.question=$,this.feedbackQuestion=_,this.userStyles=n,this.parentContainer=r,this.buttonText=D,this.thankYouMessage=M,this.legend={zeroLegend:q,tenLegend:F},this.baseClassName="nps_container",this.npsClassName="".concat(this.baseClassName,"_").concat(r.uniqueId),this.questionClassName="".concat(this.baseClassName,"_question"),this.notesClassName="".concat(this.baseClassName,"_notes"),this.feedbackQuestionClassName="".concat(this.questionClassName,"_feedback"),this.feedbackFormClassName="".concat(this.questionClassName,"_feedback_form"),this.notesButtonsClassName="".concat(this.notesClassName,"_button"),this.thankYouClassName="".concat(this.baseClassName,"_thanks"),this.hideClassName="nps_".concat(r.uniqueId,"_display_none"),this.currentNote=NaN,this.userFeedback="",this.npsContainer=this.getContainer(),this.questionElement=this.getQuestionElement(),this.notesContainer=this.getNotesElement(),this.feedbackElements=this.getFeedBackElements(),this.thankYouElement=this.getThankYouElement(),this.npsElement=this.getNPSElement(),this.styleElement=this.getStyleElement()}return x(t,[{key:"sendNote",value:function(){if(!h()&&!isNaN(this.currentNote)){try{window.abtasty.send("nps",{ns:this.currentNote,nf:this.userFeedback})}catch(t){}this.parentContainer.recurrence.setValidationRecurrence()}return this}},{key:"insertIn",value:function(t,e){return document.head.insertAdjacentElement("beforeend",this.styleElement),t.insertAdjacentElement(e,this.npsElement),this}},{key:"remove",value:function(){return this.npsElement&&this.npsElement.remove(),this.styleElement&&this.styleElement.remove(),this}},{key:"complete",value:function(){var t=this;this.sendNote(),setTimeout((function(){t.parentContainer.hide(),setTimeout((function(){t.remove(),t.parentContainer.hide().remove()}),1e3)}),1e3*j)}},{key:"onClickNote",value:function(t){this.currentNote=Number(t.target.dataset.note),R&&this.feedbackQuestion&&this.feedbackQuestion.length?this.showFeedBack():I&&this.thankYouMessage&&this.thankYouMessage.length?this.showThankYouMessage():this.complete()}},{key:"onFeedbackSend",value:function(){I&&this.thankYouMessage&&this.thankYouMessage.length?this.showThankYouMessage():this.complete()}},{key:"showFeedBack",value:function(){var t=this;return this.npsContainer.childNodes.forEach((function(e){return e.classList.add(t.hideClassName)})),Object.values(this.feedbackElements).forEach((function(e){return e.classList.remove(t.hideClassName)})),this}},{key:"showThankYouMessage",value:function(){var t=this;return this.npsContainer.childNodes.forEach((function(e){return e.classList.add(t.hideClassName)})),this.thankYouElement.classList.remove(this.hideClassName),this.complete(),this}},{key:"getThankYouElement",value:function(){var t=document.createElement("p");return t.className="".concat(this.thankYouClassName," ").concat(this.hideClassName),t.innerHTML=this.thankYouMessage,h()&&"displayThanksStep"===A&&t.classList.remove(this.hideClassName),t}},{key:"getFeedBackElements",value:function(){var t=this,e=document.createElement("p");e.className="".concat(this.feedbackQuestionClassName," ").concat(this.hideClassName),e.innerHTML=this.feedbackQuestion;var n=document.createElement("form");n.className="".concat(this.feedbackFormClassName," ").concat(this.hideClassName),n.addEventListener("submit",(function(t){return t.preventDefault()}),{passive:!1});var r=document.createElement("input");r.className="".concat(this.feedbackQuestionClassName,"_input"),r.type="text";var s=document.createElement("button");return s.className="".concat(this.feedbackQuestionClassName,"_button"),s.innerHTML=this.buttonText,s.addEventListener("click",(function(){return t.userFeedback=r.value,t.onFeedbackSend()}),{passive:!0}),h()&&"displayFeedbackStep"===A&&[e,n].forEach((function(e){return e.classList.remove(t.hideClassName)})),n.appendChild(r),n.appendChild(s),{feedbackQuestionElement:e,feedbackFormElement:n}}},{key:"getNotesElement",value:function(){var t=this,e=document.createElement("div");e.className=this.notesClassName,h()&&"displayNoteStep"!==A&&e.classList.add(this.hideClassName);for(var n=10;n>=0;){var r=document.createElement("button");r.className=this.notesButtonsClassName,r.dataset.note=n,h()&&r.setAttribute("data-abtasty-actionnable",""),r.innerHTML+="<span>".concat(n,"</span>"),r.addEventListener("click",(function(e){return t.onClickNote(e)}),{passive:!0}),e.insertAdjacentElement("afterbegin",r),5===n&&r.insertAdjacentHTML("afterend","<br>"),n-=1}return B&&(e.insertAdjacentHTML("afterbegin","<legend>".concat(this.legend.zeroLegend,"</legend>")),e.insertAdjacentHTML("beforeend","<legend>".concat(this.legend.tenLegend,"</legend>"))),e}},{key:"getQuestionElement",value:function(){var t=document.createElement("p");return t.className=this.questionClassName,t.innerHTML=this.question,h()&&"displayNoteStep"!==A&&t.classList.add(this.hideClassName),t}},{key:"getContainer",value:function(){var t=document.createElement("div");return t.className="".concat(this.baseClassName," ").concat(this.npsClassName),t}},{key:"getNPSElement",value:function(){var t=this;return this.npsContainer.appendChild(this.questionElement),this.npsContainer.appendChild(this.notesContainer),R&&Object.values(this.feedbackElements).forEach((function(e){t.npsContainer.appendChild(e)})),I&&this.npsContainer.appendChild(this.thankYouElement),this.npsContainer}},{key:"getDefaultStyles",value:function(){var t="\n\t\t\t#".concat(this.parentContainer.widgetContainerId," .").concat(this.baseClassName,",\n\t\t\t#").concat(this.parentContainer.widgetContainerId," .").concat(this.baseClassName," *");return"\n\t\t".concat(t," {\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tmin-width: inherit;\n\t\t\tmin-height: inherit;\n\t\t\tmax-width: inherit;\n\t\t\tmax-height: inherit;\n\t\t\tline-height: 1;\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t\tborder: none;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\t#").concat(this.parentContainer.widgetContainerId," .").concat(this.hideClassName," {\n\t\t\tdisplay: none !important;\n\t\t}\n\t\t#").concat(this.parentContainer.widgetContainerId," .").concat(this.baseClassName," .").concat(this.notesButtonsClassName," span {\n\t\t\tpointer-events: none;\n\t\t}\n\t\tbody #").concat(this.parentContainer.widgetContainerId," .").concat(this.parentContainer.closeButtonClassName," {\n\t\t\tpadding: 0;\n\t\t\tline-height: 1;\n\t\t}\n\t\t@media (orientation: landscape) {\n\t\t\t").concat(t," {\n\t\t\t\tfont-size: .55vmax;\n\t\t\t}\n\t\t}\n\t\t@media (orientation: landscape) and (max-width: 1280px) {\n\t\t\t").concat(t," {\n\t\t\t\tfont-size: .7vmax;\n\t\t\t}\n\t\t}\n\t\t@media (orientation: landscape) and (max-width: 800px) {\n\t\t\t").concat(t," {\n\t\t\t\tfont-size: 1vmax;\n\t\t\t}\n\t\t}\n\t\t@media (orientation: portrait) {\n\t\t\t").concat(t," {\n\t\t\t\tfont-size: 1vmin;\n\t\t\t}\n\t\t}\n\t\t@media (orientation: portrait) and (max-width: 550px) {\n\t\t\t").concat(t," {\n\t\t\t\tfont-size: 2.2vmin;\n\t\t\t\tline-height: 1.3;\n\t\t\t\tmax-width: ").concat("popin"===P?"85vw":"auto",";\n\t\t\t}\n\t\t}")}},{key:"getThemeDefaultStyles",value:function(){var t="popin"===P?"75em":"auto",e="#".concat(this.parentContainer.widgetContainerId," .").concat(this.npsClassName);return"\n\t\t".concat(e,",\n\t\t").concat(e," * {\n\t\t\tdisplay: flex;\n\t\t\tflex-wrap: nowrap;\n\t\t\tjustify-content: center;\n\t\t}\n\t\t").concat(e," {\n\t\t\twidth: ").concat(t,";\n\t\t\talign-items: center;\n\t\t}\n\t\t").concat(e," .").concat(this.questionClassName,",\n\t\t").concat(e," .").concat(this.feedbackQuestionClassName,",\n\t\t").concat(e," .").concat(this.thankYouClassName," {\n\t\t\tfont-size: 2em;\n\t\t\tmargin-right: 1em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," {\n\t\t\tflex-direction: row;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," legend {\n\t\t\talign-self: center;\n\t\t\tfont-size: 1.5em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," legend:first-of-type {\n\t\t\tmargin-right: 1em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," legend:last-of-type {\n\t\t\tmargin-left: 1em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesButtonsClassName," {\n\t\t\twidth: 3.5em;\n\t\t\theight: 3.5em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesButtonsClassName," span {\n\t\t\tfont-size: 2em;\n\t\t}\n\t\t").concat(e," .").concat(this.feedbackFormClassName," {\n\t\t\tflex-direction: row;\n\t\t}\n\t\t").concat(e," .").concat(this.feedbackFormClassName," input {\n\t\t\twidth: 45em;\n\t\t\theight: 4em;\n\t\t\tpadding: 0 0.5em;\n\t\t}\n\t\t").concat(e," .").concat(this.feedbackFormClassName," button {\n\t\t\twidth: 10em;\n\t\t\tfont-size: 1.4em;\n\t\t}\n\t\t@media screen and (max-width: 550px) and (orientation: portrait) {\n\t\t\t").concat(e," .").concat(this.questionClassName,",\n\t\t\t").concat(e," .").concat(this.feedbackQuestionClassName," ,\n\t\t\t").concat(e," .").concat(this.thankYouClassName," {\n\t\t\t\tmax-width: 90%;\n\t\t\t\t align-self: flex-start;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.notesClassName," {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\twidth: 100%;\n\t\t\t\ttext-align: center;\n\t\t\t\tline-height: 5.5;\n\t\t\t\tposition: relative;\n\t\t\t\t").concat(B?"padding-bottom: 4em;":"","\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.notesButtonsClassName," {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\twidth: 4em;\n\t\t\t\theight: 4em;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.notesClassName," legend {\n\t\t\t\tposition: absolute;\n\t\t\t\tbottom: 0;\n\t\t\t\tleft: 0;\n\t\t\t\tmargin: 0 !important;\n\t\t\t\tfont-size: 1.25em;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.notesClassName," legend:first-of-type {\n\t\t\t\tbottom: 1.2em;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.notesClassName," legend:first-of-type::before {\n\t\t\t\tcontent: '0:';\n\t\t\t\tmargin-right: 0.4em;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.notesClassName," legend:last-of-type::before {\n\t\t\t\tcontent: '10:';\n\t\t\t\tmargin-right: 0.4em;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.feedbackFormClassName," {\n\t\t\t\tflex-direction: column;\n\t\t\t\twidth: 100%;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.feedbackFormClassName," input {\n\t\t\t\tmargin: 0;\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 3em;\n\t\t\t\tfont-size: 1.8em;\n\t\t\t}\n\t\t\t").concat(e," .").concat(this.feedbackFormClassName," button {\n\t\t\t\twidth: 50%;\n\t\t\t\theight: 2.7em;\n\t\t\t\tmargin-top: 1em;\n\t\t\t\talign-self: center;\n\t\t\t\tfont-size: 1.5em;\n\t\t\t\tfont-weight: bold;\n\t\t\t}\n\t\t}")}},{key:"getUserStyles",value:function(){var t,e=this.userStyles,n=e.backgroundColor,s=e.borderColor,i=e.borderRadius,o=e.borderWidth,c=e.dropShadow,h=e.textColor,l=e.horizontalPaddingContainer,u=e.verticalPaddingContainer,d=e.horizontalMarginContainer,m=e.verticalMarginContainer,g=e.overlayColor,p=e.overlayOpacity,f=e.shadowOpacity,v=e.buttonsContrast,y=e.buttonsBorderRadius,b=e.buttonsShape,w=e.contentDirection,C=e.questionMargin,E=e.buttonsHorizontalMargin,N=e.inputBackgroundColor,k=e.inputBorderColor,S=e.inputBorderWidth,x=e.inputBorderRadius,T=e.inputTextColor,O=e.inputMarginWithButton,P=e.feedbackButtonBackgroundColor,R=e.feedbackButtonBorderColor,I=e.feedbackButtonBorderWidth,B=e.feedbackButtonBorderRadius,j=e.feedbackButtonTextColor,A=Object.entries(this.userStyles).filter((function(t){return a(t,1)[0].includes(v)})).reduce((function(t,e){var n=a(e,2),s=n[0],i=n[1],o=s.split("_".concat(v))[0],c=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?L(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},t);return c[o]=i,c}),{}),$=A.buttonsBackgroundColor,_=A.buttonsTextColor,D=A.buttonsBorderColor,M=A.buttonsBorderWidth;switch(b){case"roundsquare":t="border-radius: ".concat(y,"px;");break;case"round":t="border-radius: 50%;";break;default:t=""}var q=c?"box-shadow: 0px 5px 10px 2px rgba(0, 0, 0, ".concat(f/100,");"):"",F="#".concat(this.parentContainer.widgetContainerId," .").concat(this.npsClassName),W="\n\t\t\t".concat(F," .").concat(this.notesButtonsClassName," {\n\t\t\t\tmargin-left: ").concat(E,"px;\n\t\t\t\tmargin-right: ").concat(E,"px;\n\t\t\t\tbackground-color: ").concat($,";\n\t\t\t\tborder: ").concat(M,"px solid ").concat(D,";\n\t\t\t\t").concat(t,"\n\t\t\t}\n\t\t\t").concat(F," .").concat(this.notesButtonsClassName," span {\n\t\t\t\tcolor: ").concat(_,";\n\t\t\t}");return"\n\t\t\tbody ".concat(F," {\n\t\t\t\tflex-direction: ").concat(w,";\n\t\t\t\tbackground-color: ").concat(n,";\n\t\t\t\tborder: ").concat(o,"px solid ").concat(s,";\n\t\t\t\tborder-radius: ").concat(i,"px;\n\t\t\t\tpadding: ").concat(u,"px ").concat(l,"px;\n\t\t\t\t").concat(q,"\n\t\t\t}\n\t\t\t").concat(F," .").concat(this.questionClassName,",\n\t\t\t").concat(F," .").concat(this.feedbackQuestionClassName," ,\n\t\t\t").concat(F," .").concat(this.thankYouClassName," {\n\t\t\t\tcolor: ").concat(h,";\n\t\t\t\tmargin-").concat("row"===w?"right":"bottom"," : ").concat(C,"px;\n\t\t\t}\n\t\t\t").concat(F," .").concat(this.thankYouClassName," {\n\t\t\t\tmargin-bottom: 0;\n\t\t\t}\n\t\t\t").concat(F," .").concat(this.notesClassName," legend {\n\t\t\t\tcolor: ").concat(h,";\n\t\t\t}\n\t\t\t").concat(W,"\n\t\t\t").concat(F," .").concat(this.feedbackFormClassName," input {\n\t\t\t\tbackground-color: ").concat(N,";\n\t\t\t\tborder: ").concat(S,"px solid ").concat(k,";\n\t\t\t\tborder-radius: ").concat(x,"px;\n\t\t\t\tcolor: ").concat(T,";\n\t\t\t\tmargin-right: ").concat(O,"px;\n\t\t\t}\n\t\t\t").concat(F," .").concat(this.feedbackFormClassName," button {\n\t\t\t\tbackground-color: ").concat(P,";\n\t\t\t\tborder: ").concat(I,"px solid ").concat(R,";\n\t\t\t\tborder-radius: ").concat(B,"px;\n\t\t\t\tcolor: ").concat(j,";\n\t\t\t}\n\t\t\tbody #").concat(this.parentContainer.widgetContainerId," {\n\t\t\t\tmargin: ").concat(m,"px ").concat(d,"px;\n\t\t\t}\n\t\t\tbody #").concat(this.parentContainer.widgetContainerId," .").concat(this.parentContainer.overlayClassName," {\n\t\t\t\tbackground-color: ").concat(g,";\n\t\t\t\topacity: ").concat(p/100,";\n\t\t\t}\n\t\t\tbody #").concat(this.parentContainer.widgetContainerId," .").concat(this.parentContainer.closeButtonClassName," {\n\t\t\t\ttop: ").concat(u,"px;\n\t\t\t\tright: ").concat(l,"px;\n\t\t\t}")}},{key:"getStyleElement",value:function(){var t="theme"===O,e=this.getDefaultStyles(),n=t?this.getThemeDefaultStyles():"",r=t?this.getUserStyles():"",s=document.createElement("style");return s.type="text/css",h()&&s.setAttribute("abtasty-script-added","true"),s.textContent="".concat(e," ").concat(n," ").concat(r),s}}]),t}();function z(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Y(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?z(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var H=DATA,G=H.layout,V=H.bannerPosition,Q=H.npsElementReferrer,U=H.npsReferrerInsertType,K=H.contentDirection,J=H.themeType,X=H.theme;function Z(){if("customCss"===J)return!1;var t=Object.entries(DATA).filter((function(t){return a(t,1)[0].includes(X)})).reduce((function(t,e){var n=a(e,2),r=n[0],s=n[1],i=r.split("".concat(X,"_"))[1],o=Y({},t);return o[i]=s,o}),{});return Y({},t,{contentDirection:K})}function tt(){return(tt=n(t.mark((function e(){var n,r,s,i;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=G,t.next="popin"===t.t0?3:"banner"===t.t0?5:7;break;case 3:return n=new C,t.abrupt("break",9);case 5:return n=new E(V),t.abrupt("break",9);case 7:return n=new N(U,Q),t.abrupt("break",9);case 9:return r=Z(),s=n.domElement.querySelector(".".concat(n.contentClassName)),i=new W({userStyles:r,parentContainer:n}),n.children=i,i.insertIn(s,"beforeend"),n.init().then((function(t){return t&&n.show()})),t.abrupt("return",{parentContainer:n,NPS:i});case 17:case"end":return t.stop()}}),e)})))).apply(this,arguments)}!function(){tt.apply(this,arguments)}()}();
{
"name": "@abtasty/nps",
"description": "Allow you to add a custom NPS on your website",
"version": "0.4.6-7",
"version": "0.4.6-8",
"form": "dist/form.js",

@@ -38,3 +38,3 @@ "main": "dist/main.js",

"dependencies": {
"@abtasty/widget-utils": "1.13.7",
"@abtasty/widget-utils": "1.13.8",
"@babel/plugin-proposal-object-rest-spread": "^7.8.3",

@@ -41,0 +41,0 @@ "@rollup/plugin-commonjs": "^11.0.1",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc