@abtasty/nps
Advanced tools
Comparing version 1.5.25-0 to 1.5.25-1
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";const e=()=>Object.prototype.hasOwnProperty.call(top,"ABTastyEditor"),t=()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t},n=e=>new Function(`try {\n\t\t${e}\n\t} catch (error) {\n\t\treturn null;\n\t}`)(),i=()=>encodeURIComponent(DATA.spNoTrim?window.location.href.replace(window.location.origin,""):`${window.location.pathname}`),r=()=>!e()&&(t()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),s=()=>window.ABTasty&&!0===window.ABTasty.consentReady,o=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},a=()=>{const e=o();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},c=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,l=n=>{const i=(()=>{if(e()||t())return!1;const n=ABTasty.getTestsOnPage()[TEST_ID];return!!n&&Object.keys(n.targetings.qaParameters).length>0})(),r=window.document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(i||r){const e=a();window.console.log(`%c${e} - ${i?"QA":"Debug"} Mode for campaign ${TEST_ID} %c ${n}`,"background-color: #D6FF01; color: #3100be; padding: 3px 0 3px 10px; border-radius: 5px 0 0 5px; font-weight: bold;","background-color: #3100be; color: white; padding: 3px 10px 3px 0; border-radius: 0 5px 5px 0;")}},h=e=>{const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise((e,n)=>{t.resolve=e,t.reject=n}),t},u=(e,t)=>{const n=t?[]:null;if("string"!=typeof e||!e.trim().length)return n;const[i,r,s]=e.split("[]").map(e=>e.trim()),o=Boolean(s)?s:e,a=r?document.querySelector(i)?.[r]:document;return a?t?[...a.querySelectorAll(o)]:a.querySelector(o):n},d=e=>u(e,!1),m=e=>u(e,!0),g=(e,t)=>{const n=document.querySelector("body")||document.documentElement,i={childList:!0,subtree:!0,attributes:!0},r=()=>s.disconnect(),s=new MutationObserver(()=>{const n=d(t);return n&&!r()&&e(n)});return{clear:r,observe:(e=n)=>s.observe(e,i)}},p=()=>{},f=(t,n)=>{const i=d(t),r={selector:t,clear:p,observe:p};if(i)return setTimeout(()=>n(i),0),r;if(e())return setTimeout(()=>f(t,n),1e3),r;if(t.includes("[]"))return((e,t)=>{const[n,i]=t.split("[]").map(e=>e.trim()),r=d(n),s=r?.[i],{clear:o,observe:a}=g(e,t),c=()=>{const n=d(t);return n&&!l()&&e(n)},l=()=>{o(),r?.removeEventListener("load",c)},h=()=>{a(s),"iframe"===r?.localName&&r.addEventListener("load",c)};return h(),{selector:t,clear:l,observe:h}})(n,t);const{clear:s,observe:o}=g(n,t);return o(),{selector:t,clear:s,observe:o}};function v(e,t){const n=e.parentElement||e.getRootNode().host;return t(e)||!n?e:v(n,t)}const y=t=>{e()||(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())},b=(e,t)=>[...m(t)].some(n=>{const[i,,r]=t.split("[]"),s=r??i;return n===e||!!e.closest(s)});let w=!1;class C{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=null,this.mutationObserver=null,this.mouseOverEvent=null,this.scrollEvent=null,this.onTransitionEnd=null,this.onIframeLoad=null}transitionOverHandler(e){const t=[e,"transitionend",this.checkElements.bind(this),!0];return this.getEvents(...t)}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets.forEach(t=>{t.element.isSameNode(e.target)&&(this.inViewportTargets.push(t),this.mouseOverEvent.start(),this.scrollEvent.start(),this.onTransitionEnd.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(t=>!t.element.isSameNode(e.target)||(this.mouseOverEvent.clear(),this.scrollEvent.clear(),this.onTransitionEnd.clear(),!1))})}startVisibilityObserver(e){const t={root:e,rootMargin:"0px",threshold:0};return this.visibilityObserver??=new IntersectionObserver(this.intersectionHandler.bind(this),t),this.visibilityObserver}startMutationObserver(e){return this.mutationObserver??=new MutationObserver(this.checkElements.bind(this)),this.mutationObserver.observe(e,{attributes:!0,childList:!0,subtree:!0}),this.mutationObserver}onMouseOver({target:e,path:t}){const n=this.inViewportTargets.find(({element:n,selector:i})=>{if(n.isSameNode(e))return!0;const[r,,s]=i.split("[]"),o=s??r,a=[...e.querySelectorAll(o)];if(a.length&&a.includes(n))return!0;if(t.includes(n))return!0;if(!e.parentElement?.children?.length)return;const c=[...e.parentElement.children],l=c.findIndex(t=>t.isSameNode(e)),h=c.filter((e,t)=>t>l);if(h.length){if(h.includes(n))return!0;if(h.some(e=>[...e.querySelectorAll(o)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:e,element:t,uniqueId:i}=n,r=this.targets.find(t=>t.selector===e&&t.uniqueId===i);r&&r.resolve(t),this.clear(e,i)}}getEvents(e,...t){return{start:()=>e?.addEventListener(...t),clear:()=>e?.removeEventListener(...t)}}mouseOverHandler(e){const t=[e,"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?"touchmove":"mouseover",e=>{const t=e.composedPath(),{target:n}=e;setTimeout(()=>this.onMouseOver({target:n,path:t}),50)},!0];return this.getEvents(...t)}scrollEventHandler(e){const t=[e,"scroll",(n=this.checkElements.bind(this),()=>{w||(w=!0,setTimeout(()=>{n(),w=!1},100))}),{passive:!0}];var n;return this.getEvents(...t)}isElementVisible(e){return this.isElementOpaque(e)&&this.isElementTopmost(e)}isElementOpaque(e){return"HTML"===v(e,e=>"0"===window.getComputedStyle(e).opacity).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),n=[[t.left,t.top],[t.right,t.top],[t.left,t.bottom],[t.right,t.bottom],[t.left+t.width/2,t.top],[t.left+t.width/2,t.bottom],[t.left,t.height/2],[t.right,t.height/2],[t.left+t.left/2,t.height/2]];let i=!1,r=0;for(;!i&&r<n.length;){const t=e.getRootNode()?.elementFromPoint(...n[r]);i=e===t||t?.contains(e)||e.contains(t),r+=1}return i}checkElements(){this.targets.forEach(({selector:e,uniqueId:t})=>{const n=d(e),[i,,r]=e.split("[]"),s=r??i;n&&!this.existingTargets.find(e=>e.element.matches(s)&&e.uniqueId===t)&&(this.existingTargets.push({element:n,selector:e,uniqueId:t}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:e,element:t})=>!!d(e)||(t&&this.visibilityObserver.unobserve(t),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:e,element:t,uniqueId:n})=>{const[i,,r]=e.split("[]"),s=r??i;if(t.matches(s)&&this.isElementVisible(t)){const i=this.targets.find(t=>t.selector===e&&t.uniqueId===n);return i&&i.resolve(t),this.clear(e,n),!1}return!0})}onLoadIframe(e){const t=[e.defaultView.frameElement,"load",()=>this.watch(selector,resolve,uniqueId).bind(this),{passive:!0}];return this.getEvents(...t)}watch(e,t,n){this.targets.push({selector:e,resolve:t,uniqueId:n});const{clear:i}=f(e,e=>{i();const t=e.getRootNode(),n="body"in t?t.body:document;this.mouseOverEvent=this.mouseOverHandler(t),this.scrollEvent=this.scrollEventHandler(t),this.onTransitionEnd=this.transitionOverHandler(t),t.defaultView?.frameElement&&(this.onIframeLoad=this.onLoadIframe(t),this.onIframeLoad.start()),this.startVisibilityObserver(n),this.startMutationObserver(n),this.checkElements()})}clear(e,t){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(n=>n.filter(({selector:n,uniqueId:i})=>n!==e&&i!==t));const n=d(e);n&&this.visibilityObserver?.unobserve(n),0===this.targets.length&&(this.mutationObserver?.disconnect(),this.onIframeLoad?.clear()),0===this.inViewportTargets.length&&(this.mouseOverEvent?.clear(),this.scrollEvent?.clear(),this.onTransitionEnd?.clear())}}const E="remove",$="rebuild",T="update",S="ABTastyData";class N{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:n,triggerTarget:i}){this.event=e,this.selector=Boolean(t)?t:"body",this.target="string"==typeof i?d(t):i,this.delay=1e3*n,this.triggerElements=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.promises=[],this.visibilityObservers=[],this.socialProofStore={},this.elementWaiters=[]}async onElementVisible({promise:e,resolve:t}){const n=h(`${this.event}DomReady`);this.promises.push(n);const{clear:i}=f(this.selector,()=>{const e=new C;this.visibilityObservers.push(e),e.watch(this.selector,t,c())});return this.elementWaiters.push(i),e}onPageLoad({promise:e,resolve:t}){const n=()=>"complete"===document.readyState;if(!n()){const i=["readystatechange",()=>n()&&t(!0),{passive:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}return t(!0),e}onClick({promise:e,resolve:t}){const n=({isTrusted:e,target:n})=>{if(e)return(n.isEqualNode(this.target)||b(n,this.selector))&&t(!0)},{clear:i}=f(this.selector,e=>{i();const t=document.createElement("style");t.id=`Click_${c()}`;const[r,,s]=this.selector.split("[]"),o=s??r;t.innerHTML=`${o} {\n\t\t\t\tcursor: pointer !important;\n\t\t\t\tpointer-events: all !important;\n\t\t\t}`;const a=e.getRootNode();("head"in a?a.head:a).appendChild(t),this.triggerElements.push(t);const l=["click",n,{passive:!0,capture:!0}];this.eventsListeners.push([a,...l]),a.addEventListener(...l)});return this.elementWaiters.push(i),e}onHover({promise:e,resolve:t}){const n=({isTrusted:e,target:n})=>{if(e)return(this.target?n.isEqualNode(this.target):b(n,this.selector))&&t(!0)},{clear:i}=f(this.selector,e=>{const t=e.getRootNode(),i="body"in t?t.body:[...t.childNodes].find(t=>t.contains(e)),r=["mouseenter",n,{passive:!0,capture:!0}];this.eventsListeners.push([i,...r]),i.addEventListener(...r)});return this.elementWaiters.push(i),e}onExitIntent({promise:e,resolve:t}){const n=["mouseleave",({isTrusted:e,clientY:n})=>{e&&n<=0&&t(!0)},{passive:!0}],{clear:i}=f("html",e=>{i(),this.eventsListeners.push([e,...n]),e.addEventListener(...n)});return e}onReengage({promise:e,resolve:t}){const n=this.delay;let i=n;const r=[...document.querySelectorAll("*:empty")].map(e=>e.contentDocument||e.shadowRoot).filter(e=>e),s=[({isTrusted:e})=>{e&&(i=n)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{[document,...r].forEach(t=>{this.eventsListeners.push([t,e,...s]),t.addEventListener(e,...s)})});const o=setInterval(()=>{i<=0?t(!0):i-=100},100);return this.intervals.push(o),e}onCustomTrigger({promise:e,resolve:t}){const{triggerEventCustomScript:n}=DATA;return new Function(`return new Promise(async resolve => {${n}})`)().then(e=>e&&t(!0)),e}onScrollUp({promise:e,resolve:t}){let n=0;const i=["scroll",({isTrusted:e})=>{e&&(window.scrollY<n?t(!0):n=window.scrollY)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}onScrollPercentReached({promise:e,resolve:t}){const{triggerEventScrollPercent:n}=DATA,i=["scroll",({isTrusted:e})=>{if(!e)return;const i=(()=>{const{documentElement:e,body:t}=document,n=e.scrollTop||t.scrollTop,i=e.scrollHeight||t.scrollHeight;return Math.trunc(n/(i-e.clientHeight)*100,10)})();n<i&&t(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}checkSocialProofConditions(e,t,n,i){const r=(()=>{let e;return top.ABTasty||top.ABTASTY_S?(top.ABTASTY_S?.USER?.accountIdentifier?.length?e=top.ABTASTY_S.USER.accountIdentifier:"function"==typeof top.ABTasty?.getAccountSettings?e=top.ABTasty.getAccountSettings().identifier:top.ABTasty?.accountSettings&&(e=top.ABTasty.accountSettings.identifier),e):e})(),{viewInterval:s,spNoTrim:o}=DATA;if(this.socialProofStore.hasOwnProperty(e))n(this.socialProofStore[e])?i(`${this.socialProofStore[e][s]}`):i(!1);else if(e&&r){const a=t=>(this.socialProofStore[e]=t,i(!!n(t)&&`${t[s]}`));fetch(`https://api-social-proof.abtasty.com/clients/${r}/metrics/${t}?key=${e}${o?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(a).catch(()=>l("Failed to fetch datas from server."))}else i(!1)}getSocialProofDatas({promise:e,resolve:t},r,s=!1){const{productKey:o,keyType:a}=(()=>{const{socialProofContentType:e,productKeyProvider:t,pathToProductKey:r,customJSProductKey:s,productSKU:o}=DATA;if(2===e)return{productKey:i(),keyType:"url"};{let a=null,c="sku";switch(t){case"ABTastyProductKey":a=window.ABTastyProductKey;break;case"pathToProductKey":a=n(`return ${r};`);break;case"customJSProductKey":a=n(s);break;case"productSKU":a=o}return a||3!==e||(a=i(),c="url"),{productKey:a,keyType:c}}})(),{viewInterval:c,triggerSocialProofMinVisitors:h,triggerSocialProofMinPurchases:u,triggerSocialProofMinPageViews:d}=DATA,m={pv:d,i:u,"v-pv":h}[r];return[typeof c,typeof m].includes("undefined")&&t(!1),s&&!o&&(l("Not able to find ABTastyProductKey, impossible to call the API, read documentation for more informations:\n\t\t\t\thttps://support.abtasty.com/hc/en-us/articles/4710919241628-Widgets-List#h_84c04344-c655-4e5e-b9ab-d26a798ad9b0"),t(!1)),this.checkSocialProofConditions(o,"v-pv"===r&&"sku"===a?"v-i":r,e=>{const t=void 0!==e[c]&&e[c]>=m;return t||l(`Widget will not be shown, Social Proof API returned ${e[c]} while ${m} are required`),t},t),e}onConsent({promise:e,resolve:t}){if(!s()){const n=["abtasty_consentValid",()=>t(!0)];return this.eventsListeners.push(n),window.addEventListener(...n),e}return t(!0),e}onTrackingSent({promise:e,resolve:t}){const{triggerEventTrackingSent:n}=DATA;let i=localStorage.getItem(S);const r=()=>JSON.parse(i)?.ActionTracking?.some(({name:e})=>e===n),s=["storage",({key:e,newValue:n})=>{e===S&&(i=n,r()&&t(!0))},{passive:!0,capture:!0}];return i&&r()?t(!0):(()=>{this.eventsListeners.push([window,...s]),window.addEventListener(...s)})(),e}onMinPagesViewed({promise:e,resolve:t}){const{triggerEventMinPagesViewed:n}=DATA;let i=localStorage.getItem(S);const r=()=>n<=(i?JSON.parse(i)?.VisitedPages?.length:0),s=["storage",({key:e,newValue:n})=>{e===S&&(i=n,r()&&t(!0))},{passive:!0,capture:!0}];return i&&r()?t(!0):(()=>{this.eventsListeners.push([window,...s]),window.addEventListener(...s)})(),e}onRageClick({promise:e,resolve:t}){const{triggerEventRageClickQuantity:n,triggerEventRageClickDelay:i}=DATA;let r=0,s=!1;const o=["click",({isTrusted:e})=>{if(e&&(r+=1,r>=n&&t(!0),!s)){s=!0;const e=setTimeout(()=>{r=0,s=!1},i);this.timeouts.push(e)}},{passive:!0,capture:!0}],a=e=>{this.eventsListeners.push([e,...o]),e.addEventListener(...o)},{clear:c}=f("iframe []contentDocument[] body > *",()=>{const e=document.getElementsByTagName("iframe");for(const t of e){"contentDocument"in t&&"body"in t.contentDocument&&a(t.contentDocument);const e=()=>a(t.contentDocument);t.addEventListener("load",e),this.eventsListeners.push([t,"onIframeLoad",e])}});return this.elementWaiters.push(c),a(document),e}clear(){this.triggerElements=this.triggerElements.filter(e=>(e.remove(),!1)),this.eventsListeners=this.eventsListeners.filter(e=>{const[t,...n]=e;return t&&n.length>1&&t.removeEventListener(...n),!1}),this.timeouts=this.timeouts.filter(e=>(clearTimeout(e),!1)),this.intervals=this.intervals.filter(e=>(clearInterval(e),!1));const e=c();return this.visibilityObservers=this.visibilityObservers.filter(t=>(t.clear(this.selector,e),!1)),this.promises=this.promises.filter(e=>(e.resolve(!1),!1)),this.elementWaiters=this.elementWaiters.filter(e=>(e(),!1)),this}async isTriggered(){this.clear();const e=h(this.event);this.promises.push(e);const t={consent:()=>this.onConsent(e),direct:()=>!0,pageLoad:()=>this.onPageLoad(e),click:()=>this.onClick(e),exitIntent:()=>this.onExitIntent(e),reengage:()=>this.onReengage(e),elementVisible:()=>this.onElementVisible(e),script:()=>this.onCustomTrigger(e),hover:()=>this.onHover(e),scrollUp:()=>this.onScrollUp(e),scrollPercent:()=>this.onScrollPercentReached(e),rageClick:()=>this.onRageClick(e),minPagesViewed:()=>this.onMinPagesViewed(e),trackingSent:()=>this.onTrackingSent(e),socialProofPurchases:()=>this.getSocialProofDatas(e,"i",!0),socialProofPageViews:()=>this.getSocialProofDatas(e,"pv"),socialProofVisitors:()=>this.getSocialProofDatas(e,"v-pv")},n=!Object.prototype.hasOwnProperty.call(t,this.event)||await t[this.event]();return n&&this.clear(),"reengage"!==this.event&&this.delay?n&&await(async()=>{const e=h(`${this.event}Delay`);this.promises.push(e);const t=setTimeout(()=>{e.resolve(!0),this.clear()},this.delay);return this.timeouts.push(t),e.promise})():n}}const k="display",x="closing",A="validation",L="ABTastyWidgets",P=`${L}Temporary`;class I{constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:n},i){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(n),this.onSetCallback=i,this.widgetName=o(),this.uniqueId=c(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:e}){const t=localStorage.getItem(P),n=sessionStorage.getItem(L);"ABTastyData"===e&&!t&&n&&localStorage.setItem(P,n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem(L);return JSON.parse(t)}catch(t){return e.removeItem(L),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:n,...i}=t;return Object.entries(i).length?(e.setItem(L,JSON.stringify(i)),i):(e.removeItem(L),!1)}removeSessionRecurrenceStorage(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.sessionStorage,e)}removeLocalRecurrenceStorage(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.localStorage,e)}getSessionRecurrence(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getLocalRecurrence(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getCurrentRecurrence(){if(this.pendingRecurrence)return this.pendingRecurrenceValue;const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=localStorage.getItem(P),t=!(!e||!e.includes(this.recurrenceKey))||this.getSessionRecurrence();e&&(sessionStorage.setItem(L,e),localStorage.removeItem(P));const n=this.getLocalRecurrence(),i=(n?parseFloat(n.stamp):0)<(new Date).getTime();return i&&this.removeLocalRecurrenceStorage(),!this.pendingRecurrence&&i&&!this.getLocalRecurrence()&&!t}setRecurrence(e,n){0!==e&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const i=this.getTypeOfStorage(e);if(t()||!i&&"object"!=typeof i)return!1;const{storageString:r,storageMethod:o}=i,a=this.getStamp(e),c={type:n,stamp:a},{type:l}=this.getCurrentRecurrence(),h=async()=>{if(!s()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const e=new N({triggerEvent:"consent"});await e.isTriggered(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let n;"session"===r?e?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===r&&(t?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const i=n?{[this.recurrenceKey]:c,...n}:{[this.recurrenceKey]:c};o.setItem(L,JSON.stringify(i)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!o)return!1;if(l&&n!==A)if(n===x&&l!==A)h();else{if(n!==k||l===A||l===x)return!1;h()}else h();return a}setDisplayRecurrence(){const e=k;this.setRecurrence(this.displayRecurrence,e)}setClosingRecurrence(){const e=x;this.setRecurrence(this.closingRecurrence,e)}setValidationRecurrence(){const e=A;this.setRecurrence(this.validationRecurrence,e)}getStamp(e){return(new Date).getTime()+864e5*e}getTypeOfStorage(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?{storageString:"local",storageMethod:window.localStorage}:0===e&&{storageString:"session",storageMethod:window.sessionStorage})}}class O{constructor(e,t,n){this.isWidgetApplied=e,this.callback=t,this.shouldUpdate=n,this.triggerIframeTarget=null,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.tagRollbackEventParams=["abtasty_resetActionTracking",this.onTagRollback.bind(this)],this.onCampaignLaunchedEventParams=["abtasty_executedCampaign",this.onCampaignLaunched.bind(this)]}decisionHandler(e){const t=!e&&this.isWidgetApplied(),n=t?this.shouldUpdate&&T:$;return n?(this.clearWatcher(),this.callback(n,!e,t),this.watch(),this):this}onCampaignLaunched({detail:{campaignId:e}}){e===TEST_ID&&(this.callback($,!1),this.watch())}onTagRollback({target:e}){return this.clearWatcher(e),this.callback(E,!1),window.addEventListener(...this.onCampaignLaunchedEventParams),this}observerHandler(e){return r()?e.some(e=>["removedNodes","addedNodes"].some(t=>e[t]&&e[t].length))?this.decisionHandler():this:this.callback(E,!1)}watch(t,n){if(e())return this;if(this.clearWatcher(t),window.removeEventListener(...this.onCampaignLaunchedEventParams),document.addEventListener(...this.tagRollbackEventParams),n?.includes("[]contentDocument[]")){const e=n.split("[]")[0].trim(),{clear:t}=f(e,e=>{t(),this.triggerIframeTarget=e,e.addEventListener("load",this.decisionHandler.bind(this))})}const i=t?.defaultView?.frameElement;i&&this.triggerIframeTarget!==i&&i.addEventListener("load",this.decisionHandler.bind(this));const{clear:r}=f("body",e=>{r();const n=t?.body||t||e;this.observer.observe(n,{childList:!0,subtree:!0})});return this}clearTriggerElementWatcher(){this.triggerIframeTarget?.removeEventListener("load",this.decisionHandler.bind(this))}clearWatcher(e){return document.removeEventListener(...this.tagRollbackEventParams),this.observer.disconnect(),this.clearTriggerElementWatcher(),e?.defaultView?.frameElement?.removeEventListener("load",this.decisionHandler.bind(this)),this}}const R=/.+\/([^.]+)\.(otf|ttf)$/,D=["socialProofPurchases","socialProofPageViews","socialProofVisitors"];class B{constructor(t,n){this.children=void 0,this.uniqueId=`${c()}${n?`_${n}`:""}`,this.widgetName=o(),this.prettyName=a(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:n,validationRecurrence:i}=DATA,r=!t&&!n&&!i;if(e()||r)return!1;const s={everytime:()=>-1,session:()=>0,once:()=>395,day:e=>DATA[`${e}_day`],week:e=>7*DATA[`${e}_week`],month:e=>30.5*DATA[`${e}_month`]},o={};return t&&(o.displayRecurrence=s[t]("displayRecurrence")),n&&(o.closingRecurrence=s[n]("closingRecurrence")),i&&(o.validationRecurrence=s[i]("validationRecurrence")),o})(),this.triggerParams=(t=>{let{triggerEvent:n}=DATA;const{triggerEventClick:i,triggerEventHover:r,triggerEventReengageDelay:s,socialProofContentType:o,triggerEventElementVisible:a,triggerEventDelay:c}=DATA;if(e()||!n&&!o)return!1;const l={click:()=>i,hover:()=>r,elementVisible:()=>a},h=Object.prototype.hasOwnProperty.call(l,n)?l[n]():"body",u="reengage"===n?s:c;return o&&(n=[,"socialProofPurchases","socialProofPageViews","socialProofVisitors"][o]),{triggerEvent:n,triggerSelector:h,triggerDelay:u,triggerTarget:t}})(t),this.recurrence=!!this.recurrenceParams&&new I(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new N(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&D.includes(this.triggerParams.triggerEvent),this.pageWatcher=new O(this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!t||!["click","hover","scrollUp","script"].includes(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.rootElement=null,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.elementsWaiters=[]}clearGivenClearables(){this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]}isWidgetApplied(){return this.domElement?.isConnected&&this.domElement.ownerDocument?.defaultView}removeOldDomElement(){const e=this.rootElement?.getElementById(this.widgetContainerId);return e?.remove(),this}async insert(){if(this.isWidgetApplied())return!1;const e=["free"];"drawer"===DATA.layout&&DATA.customTarget&&e.push("drawer");const t=e.includes(DATA.layout);return new Promise(e=>{const{elementReferrer:n="body",referrerInsertType:i="beforeend"}=t?DATA:{},r=f(n,t=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e.selector!==n),this.rootElement=t.getRootNode(),this.removeOldDomElement(),this.domElement.appendChild(this.styleElement),e(t.insertAdjacentElement(i,this.domElement))});this.elementsWaiters.push(r)}).then(()=>this)}remove(){return this.trigger&&this.trigger.clear(),this.pageWatcher.clearWatcher(this.rootElement),this.domElement?.isConnected&&this.domElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch(this.rootElement):e()||this.init().then(({response:e})=>e?this.show():this),this}show(){return e()||this.hasBeenShown&&this.hasOncePerPageTrigger||window.ABTastyEvent(`${this.prettyName} displayed`,null,TEST_ID),this.closedByUser=!1,setTimeout(()=>this.domElement.classList.remove(this.hideClassName),50),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(this.rootElement),this}hide(t=!0){return!e()&&this.hasBeenShown&&t&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),t&&(this.pageWatcher.clearWatcher(this.rootElement),this.closedByUser=!0),this.domElement.classList.add(this.hideClassName),this}async init(t){const n=e(),i=r(),s=this.trigger?.promises?.length,o=!this.recurrence||this.recurrence.isOver();if(!n&&!i||s||!o)return{container:this,response:!1};this.pageWatcher.watch(this.rootElement||document,this.triggerParams.triggerSelector);const a=n||!this.trigger||this.trigger&&await this.trigger.isTriggered();this.pageWatcher.clearTriggerElementWatcher();const c={container:this,response:a};return a?(await this.insert(),this.addCloseEvent(),n||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(a),c):c}onPageChange(e,t,n){const i=()=>this.init().then(({response:e})=>{e?this.show():this.hide(!1)});t||(this.hasBeenShown=!1,this.trigger&&this.trigger.clear());const r={[E]:()=>n?this.remove():this.pageWatcher.watch(this.rootElement),[$]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch(this.rootElement):n||this.insert().then(e=>e.show()).catch(this.pageWatcher.watch):i()},[T]:()=>{this.hasBeenShown?this.pageWatcher.watch():i()}};"function"==typeof r[e]&&r[e]()}addCloseEvent(...t){const{closeButton:n,overlay:i,overlayClickable:r,layout:s,animationDuration:o=1e3}=DATA,a=[];if(void 0!==i&&!0!==i||!0!==r||"popin"!==s||a.push(`.${this.overlayClassName}`),void 0!==n&&n&&a.push(`.${this.closeButtonClassName}`),!a.length)return this;const c=this.domElement.querySelectorAll(a.join(", "));if(!c.length)return this;const l=["click",e=>{y(e),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*o)},{once:!0,capture:!0}];return t.push(...c),t.forEach(t=>{e()&&(t.dataset.abtastyActionnable="true"),t.removeEventListener(...l),t.addEventListener(...l)}),this}getDom(){const{closeButton:e,layout:t,overlayClickable:n,overlay:i=!0}=DATA,r=document.createElement("div");return r.className=`${this.basicClassName} ${this.hideClassName}`,r.id=this.widgetContainerId,["popin","bannerTop","bannerBottom"].includes(t)&&(r.role="dialog"),r.innerHTML=`\n\t\t\t${"popin"===t&&!0===i?`<div ${n?'aria-label="Close dialog"':""} class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${e?`<button class="${this.closeButtonClassName}" aria-label="Close dialog"><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>`,r}loadFont(e,t){if(!e||"inherit"===e||!/otf|ttf/g.test(t))return;const n=document.createElement("style"),i=t.match(R)?t.match(R)[1]:"";n.innerHTML=`@font-face { font-family: '${e}_${i}'; src: url('${t}'); font-display: swap; }`;const r=this.rootElement?.head||document.head;r?.appendChild(n)}getStyleTag(t="",n=DATA){const{noStyles:i,layout:r}=n,{backgroundColor:s,isBackgroundImage:o,backgroundImage:a,backgroundSize:c,backgroundPosition:l,backgroundRepeat:h,borderColor:u,borderRadius:d,borderWidth:m,textColor:g,textAlign:p,fontName:f,fontStyle:v,fontSize:y,isTitle:b,titleTextAlign:w,titleTextColor:C,titleFontName:E,titleFontStyle:$,titleFontSize:T,overlay:S,overlayColor:N,dropShadow:k,dropShadowColor:x,dropShadowBlur:A,containerMargin:L,containerPadding:P,closeButton:I,closeButtonPosition:O,closeButtonSize:D,closeButtonBorderRadius:B,closeButtonBorderWidth:_,closeButtonBorderColor:j,closeButtonColor:F,closeButtonBackgroundColor:V,buttonsAlign:W,buttonsBorderWidth:q,buttonsBorderColor:M,buttonsBorderRadius:H,buttonsBackgroundColor:z,buttonsTextColor:U,buttonsFontName:Y,buttonsFontStyle:K,buttonsFontSize:G,secondLink:Q,secondLinkBorderWidth:J,secondLinkBorderColor:X,secondLinkBorderRadius:Z,secondLinkBackgroundColor:ee,secondLinkTextColor:te,secondLinkFontName:ne,secondLinkFontStyle:ie,secondLinkFontSize:re,animation:se,animationDuration:oe,animationBehaviour:ae,animationSlideDirection:ce}=i?{}:n,le=document.createElement("style");e()&&le.setAttribute("abtasty-script-added","true"),this.loadFont(f,v),this.loadFont(E,$),this.loadFont(Y,K),this.loadFont(ne,ie);const he=`background: ${["string"==typeof s?s:"rgba(255, 255, 255, 1)",o&&"string"==typeof a&&a.length?`url(${a})`:"",o&&"string"==typeof l&&"100% 100%"!==c?l:"0 0",o&&"string"==typeof c?`/ ${c}`:"/ auto",o&&h&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,ue="number"==typeof m&&m>0,de=`border: ${[ue?`${m}px`:"unset",ue?"solid":"",ue&&"string"==typeof u&&u.length?u:""].join(" ").trim()};`,me=void 0!==d?`border-radius: ${d}px;`:"",ge=void 0!==g?`color: ${g}; fill: ${g}; -webkit-text-fill-color: ${g};`:"",pe=void 0!==p?`text-align: ${p};`:"",fe=f&&"inherit"!==f?`font-family:${f}_${v.match(R)?v.match(R)[1]:""};`:v||"",ve=y?`font-size: ${y}px;`:"",ye=void 0!==k&&k?`box-shadow: 0 5px ${A}px 0 ${x};`:"",be=L instanceof Array&&1===L.length&&L[0],we=be?`margin: ${be.top}px ${be.right}px ${be.bottom}px ${be.left}px;`:"",Ce=be?`margin: calc(${be.top}px * 0.5) calc(${be.right}px * 0.5) calc(${be.bottom}px * 0.5) calc(${be.left}px * 0.5);`:"",Ee=P instanceof Array&&1===P.length&&P[0],$e=Ee?`padding: ${Ee.top}px ${Ee.right}px ${Ee.bottom}px ${Ee.left}px;`:"",Te=Ee?`padding: calc(${Ee.top}px * 0.5) calc(${Ee.right}px * 0.5) calc(${Ee.bottom}px * 0.5) calc(${Ee.left}px * 0.5);`:"",Se=void 0!==q&&q?`border-width: ${q}px; border-style: solid;`:"",Ne=[M,q].every(e=>void 0!==e)&&q?`border-color: ${M};`:"",ke=void 0!==H?`border-radius: ${H}px;`:"",xe=void 0!==z?`background-color: ${z};`:"",Ae=void 0!==U?`color: ${U}; fill: ${U}; -webkit-text-fill-color: ${U};`:"",Le=Y&&"inherit"!==Y?`font-family:${Y}_${K.match(R)?K.match(R)[1]:""};`:K||"",Pe=G?`font-size: ${G}px;`:"",Ie="number"==typeof J?`border-width: ${J}px; border-style: solid;`:"",Oe=[X,J].every(e=>void 0!==e)&&J?`border-color: ${X};`:"",Re=void 0!==Z?`border-radius: ${Z}px;`:"",De=void 0!==ee?`background-color: ${ee};`:"",Be=void 0!==te?`color: ${te}; fill: ${te}; -webkit-text-fill-color: ${te};`:"",_e=ne&&"inherit"!==ne?`font-family:${ne}_${ie.match(R)?ie.match(R)[1]:""};`:ie||"",je=re?`font-size: ${re}px;`:"",Fe="popin"!==r||void 0!==S&&!0!==S?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==N?N:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),Ve="number"==typeof D?D:16,We=Ve/2,qe=i||void 0!==I&&I?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===O?`bottom: calc(100% + ${We}px)`:`top: ${We}px`)+";",`right: ${We}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof B?`border-radius: ${B}px;`:"","number"==typeof _&&_>0?`border: ${_}px solid ${void 0!==j?j:"rgba(57, 57, 57, 1)"};`:"","string"==typeof V?`background-color: ${V};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${Ve}px;`,`height: ${Ve}px;`,"string"==typeof F?`fill: ${F};`:"","}"].join(""):"",Me=b&&"string"==typeof C?[`#${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: ${C}; fill: ${C}; -webkit-text-fill-color: ${C};`,void 0!==w?`text-align: ${w};`:"",E&&"inherit"!==E?`font-family:${E}_${$.match(R)?$.match(R)[1]:""};`:$||"",T?`font-size: ${T}px;`:"","}"].join(""):"";let He="";if("string"==typeof se){const t=(oe/1e3).toFixed(2),n=["top","bottom"].includes(ce),i=Number(n),r=[(["top","left"].includes(ce)?"-":"")+"100vmax",this.translateValues?this.translateValues[i]:"0"];n&&r.reverse(),He={none:[`.${this.hideClassName} {`,"opacity: 0 !important;","}"],fade:[`.${this.hideClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} {`,`transition: opacity ${t}s ${ae};`,"}"],slide:[`.${this.hideClassName} .${this.overlayClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,`transition: opacity ${t}s ${ae};`,"}",`.${this.hideClassName} .${this.contentClassName} {`,`transform: translate(${r.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${t}s ${ae};`,"}"]}[e()&&!ABTASTY_S.WIDGETS.animationChanged?"none":se].join("")}const ze=[`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,`margin-${"fill"===W?"top":"left"}: 8px;`,Ie,Oe,Re,De,Be,_e,je,"}",`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,Be,_e,je,"}"];return le.textContent=[`#${this.widgetContainerId} style { display: none; }`,`.${this.hideClassName} {`,"pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,he,me,de,ge,pe,ye,we,fe,ve,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,ge,pe,fe,ve,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",$e,fe,ve,"}",`#${this.widgetContainerId} .${this.contentClassName} a {`,"text-decoration: underline;","}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a, `,`#${this.widgetContainerId} .${this.contentClassName} button {`,"text-decoration: none;","box-sizing: border-box;","display: inline-block;",Se,Ne,ke,xe,Ae,Le,Pe,"}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a *, `,`#${this.widgetContainerId} .${this.contentClassName} button:not(class*="close_button") * {`,Ae,Le,Pe,"}",...Q?ze:[],"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,Ce,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,Te,"}","}",Fe,qe,Me,He,`${t}`].join(""),le}}const _=["top: 0;","top: 50%;","bottom: 0;"],j=["left: 0;","left: 50%;","right: 0;"],F=e=>1===e?"-50%":0,V=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:e,y:t}]}=DATA,n=`translate(${F(t)}, ${F(e)});`;return`${_[e]}${j[t]}transform: ${n}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},W=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,q=()=>{if(W())return"width: auto; height: auto; min-width: fit-content;";const{popinPercentWidth:e,popinPixelsWidth:t,widthUnit:n,autoHeight:i,popinPercentHeight:r,popinPixelsHeight:s,heightUnit:o}=DATA;return`width: ${"px"===n?t:e}${n};height: ${i?"auto":`${"px"===o?s:r}${o}`};`};class M extends B{constructor(){super(),this.translateValues=Object.values(DATA.popinPosition[0]).map(e=>F(e)),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:e,zindexCustom:t,widthUnit:n}=DATA,i="string"!=typeof DATA.overlay&&DATA.overlay;return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;",`z-index: ${"custom"===e?t:e};`,"background: none;","pointer-events: "+(i?"all":"none"),"}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;",V(),q(),"pointer-events: all","}",`${W()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${!W()&&["px","em"].includes(n)?["@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join(""):""}`].join("")}}class H extends B{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:e,zindexCustom:t}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;",`${this.position}: 0;`,"left: 0;","width: 100%;","height: auto;",`z-index: ${"custom"===e?t:e};`,"background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class z extends B{constructor(e,t){super(e,t),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 U=()=>{const{layout:e}=DATA;let t;switch(e){case"popin":t=new M;break;case"bannerTop":case"bannerBottom":t=new H;break;case"free":t=new z;break;default:t=new B}return t};function Y(e){return Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Y(e)}function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?K(Object(n),!0).forEach(function(t){Q(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Q(e,t,n){return(t=X(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function J(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function X(e){var t=function(e){if("object"!=Y(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Y(t)?t:t+""}var Z=DATA,ee=Z.isFeedBackQuestion,te=Z.isThankYouMessage,ne=Z.autoHide,ie=Z.timeHide,re=Z.stepToShow,se=Z.question,oe=Z.feedbackQuestion,ae=Z.buttonText,ce=Z.thankYouMessage,le=Z.isLegend,he=Z.minLegend,ue=Z.maxLegend,de=Z.noStyles,me=Z.layout,ge={capture:!0,passive:!1},pe=function(){return t=function e(t){var n=t.parentContainer;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.parentContainer=n,this.baseClassName="nps_container",this.className="".concat(this.baseClassName,"_").concat(n.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(n.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()},n=[{key:"sendNote",value:function(){return e()||isNaN(this.currentNote)||(l("Sending datas, note: ".concat(this.currentNote,', feedback: "').concat(this.userFeedback,'"')),window.abtasty.send("nps",{caid:TEST_ID,vaid:VARIATION_ID,ns:this.currentNote,nf:this.userFeedback})),this}},{key:"insertIn",value:function(e,t){return this.setStyles(),e.insertAdjacentElement(t,this.npsElement),this}},{key:"complete",value:function(){var e=this;return this.sendNote(),this.parentContainer.recurrence.setValidationRecurrence(),ne?(setTimeout(function(){e.parentContainer.hide(),setTimeout(function(){return e.parentContainer.remove()},1e3)},1e3*ie),this):this}},{key:"onClickNote",value:function(e){this.currentNote=Number(e.target.dataset.note),ee&&oe&&oe.length?this.showFeedBack():te&&ce&&ce.length?this.showThankYouMessage():this.complete()}},{key:"onFeedbackSend",value:function(){te&&ce&&ce.length?this.showThankYouMessage():this.complete()}},{key:"hideAllChildren",value:function(){var e,t=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,t){if(e){if("string"==typeof e)return J(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?J(e,t):void 0}}(e))){t&&(e=t);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=!0,o=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return s=e.done,e},e:function(e){o=!0,r=e},f:function(){try{s||null==t.return||t.return()}finally{if(o)throw r}}}}(this.npsContainer.children);try{for(t.s();!(e=t.n()).done;)e.value.classList.add(this.hideClassName)}catch(e){t.e(e)}finally{t.f()}}},{key:"setAriaLabel",value:function(e){["popin","bannerTop","bannerBottom"].includes(me)&&this.parentContainer.domElement.setAttribute("aria-label",e)}},{key:"showFeedBack",value:function(){this.hideAllChildren();for(var e=0,t=Object.values(this.feedbackElements);e<t.length;e++)t[e].classList.remove(this.hideClassName);return this.setAriaLabel(oe),this}},{key:"showThankYouMessage",value:function(){return this.hideAllChildren(),this.thankYouElement.classList.remove(this.hideClassName),this.setAriaLabel(ce),this.complete(),this}},{key:"getThankYouElement",value:function(){var t=document.createElement("p");return t.className="".concat(this.thankYouClassName," ").concat(this.hideClassName),t.innerHTML=ce,e()&&"displayThanksStep"===re&&(t.classList.remove(this.hideClassName),this.setAriaLabel(ce)),t}},{key:"getFeedBackElements",value:function(){var t=this,n=document.createElement("p");n.className="".concat(this.feedbackQuestionClassName," ").concat(this.hideClassName),n.innerHTML=oe;var i=document.createElement("form");i.className="".concat(this.feedbackFormClassName," ").concat(this.hideClassName),i.addEventListener("submit",y,G({},ge));var r=document.createElement("textarea");r.className="".concat(this.feedbackQuestionClassName,"_textarea"),r.ariaLabel=oe;var s=document.createElement("button");return s.className="".concat(this.feedbackQuestionClassName,"_button"),s.innerHTML="<span>".concat(ae,"</span>"),s.ariaLabel=ae,s.addEventListener("click",function(e){return y(e),t.userFeedback=r.value,t.onFeedbackSend()},G(G({},ge),{},{once:!0})),e()&&"displayFeedbackStep"===re&&([n,i].forEach(function(e){return e.classList.remove(t.hideClassName)}),this.setAriaLabel(oe)),i.appendChild(r),i.appendChild(s),{feedbackQuestionElement:n,feedbackFormElement:i}}},{key:"getNotesElement",value:function(){var t=this,n=document.createElement("div");n.className=this.notesClassName,e()&&"displayNoteStep"!==re&&n.classList.add(this.hideClassName);for(var i=10;i>=0;){var r=document.createElement("button");r.className=this.notesButtonsClassName,r.dataset.note=i,r.ariaLabel="".concat(se," - ").concat(i,"/10"),e()&&r.setAttribute("data-abtasty-actionnable",""),r.innerHTML+="<span>".concat(i,"</span>"),r.addEventListener("click",function(e){y(e),t.onClickNote(e)},G({},ge)),n.insertAdjacentElement("afterbegin",r),5===i&&r.insertAdjacentHTML("afterend","<br>"),i-=1}return le&&(n.insertAdjacentHTML("afterbegin","<legend>".concat(he,"</legend>")),n.insertAdjacentHTML("beforeend","<legend>".concat(ue,"</legend>"))),n}},{key:"getQuestionElement",value:function(){var t=document.createElement("p");return t.className=this.questionClassName,t.innerHTML=se,e()&&"displayNoteStep"!==re&&t.classList.add(this.hideClassName),"displayNoteStep"===re&&this.setAriaLabel(se),t}},{key:"getContainer",value:function(){var e=document.createElement("div");return e.className="".concat(this.baseClassName," ").concat(this.className),e}},{key:"getNPSElement",value:function(){var e=this;return this.npsContainer.appendChild(this.questionElement),this.npsContainer.appendChild(this.notesContainer),ee&&Object.values(this.feedbackElements).forEach(function(t){e.npsContainer.appendChild(t)}),te&&this.npsContainer.appendChild(this.thankYouElement),this.npsContainer}},{key:"setStyles",value:function(){var e=this.parentContainer,t=e.styleElement,n=e.widgetContainerId,i="";if(de)i=["#".concat(n," .").concat(this.className," .").concat(this.hideClassName," {"),"display: none !important;","}"].join("");else{var r=DATA,s=r.containerPadding,o=r.legendTextColor,a=r.legendFontName,c=r.legendFontStyle,l=r.legendFontSize,h=r.buttonsFontSize;this.parentContainer.loadFont(a,c);var u=/.+\/([^.]+)\.(otf|ttf)$/,d=a&&"inherit"!==a?"font-family:".concat(a,"_").concat(c.match(u)?c.match(u)[1]:"",";"):c||"",m=s instanceof Array&&1===s.length&&s[0],g="#".concat(n," .").concat(this.className);i=["".concat(g," .").concat(this.hideClassName," {"),"display: none !important;","}","".concat(g,","),"".concat(g," * {"),"all: unset;","box-sizing: border-box;","font-size: 10px;","line-height: normal;","font-family: sans-serif;","}","".concat(g," > * {"),"display: block;","width: 100%;","}","".concat(g," .").concat(this.notesClassName," {"),"position: relative;","display: inline-block;","width: auto;","}","".concat(g," p {"),"margin-bottom: 15px;","font-size: 1.4em;","white-space: pre-line;","}","".concat(g," button {"),"vertical-align: middle;","cursor: pointer;","text-align: center;","}","".concat(g," button span {"),"font-size: 1em;","pointer-events: none;","}","".concat(g," .").concat(this.notesClassName," button {"),"margin: 0 5px;","width: ".concat(1.75*h,"px;"),"height: ".concat(1.75*h,"px;"),"}","".concat(g," .").concat(this.notesClassName," button * {"),"display: inline-block !important;","pointer-events: none;","}","".concat(g," .").concat(this.feedbackFormClassName," span {"),"display: block;","padding: 6px 24px;","}",le?["".concat(g," legend {"),"position: absolute;","text-decoration: none;","border: none;","color: ".concat(o,";"),"fill: ".concat(o,";"),"-webkit-text-fill-color: ".concat(o,";"),"font-size: ".concat(l,"px;"),d,"}","".concat(g," legend:nth-of-type(2) {"),"left: auto;","right: 0;","}"].join(""):"","".concat(g," textarea {"),"display: block;","width: 100%;","min-width: 310px;","min-height: 60px;","font-size: 1.4em;","border: 1px solid grey;","border-radius: 4px;","resize: vertical;","margin-bottom: 10px;","text-align: left;","padding: 5px;","}","".concat(g," .").concat(this.thankYouClassName," {"),"margin-bottom: 0;","}","@media screen and (min-width: 580px) {","".concat(g," {"),"min-width: 560px;","}",le?["".concat(g," .").concat(this.notesClassName," {"),"padding-top: ".concat(1.5*l,"px"),"}","".concat(g," legend {"),"top: 0;","left: 0;","display: inline-block;","width: auto;","}"].join(""):"","".concat(g," br {"),"display: none","}","}","@media screen and (max-width: 579px) {","".concat(g," {"),"min-width: ".concat(240+(m.left+m.right/2),"px;"),"}","".concat(g," .").concat(this.notesClassName," button {"),"margin-bottom: 5px;","}","".concat(g," br {"),"display: block","}",le?["".concat(g," .").concat(this.notesClassName," {"),"padding-bottom: 35px;","}","".concat(g," legend {"),"bottom: 0;","left: 50%;","transform: translateX(-50%)","}","".concat(g," legend:nth-of-type(1) {"),"bottom: 15px;","}","".concat(g," legend:nth-of-type(2) {"),"left: 50%;","right: unset;","}","".concat(g," legend:nth-of-type(1)::before {"),'content: "0: ";',"}","".concat(g," legend:nth-of-type(2)::before{"),'content: "10: ";',"}"].join(""):"","".concat(g," textarea {"),"min-width: auto;","}","}"].join("")}return t.insertAdjacentText("afterbegin",i),t}}],n&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,X(i.key),i)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();function fe(e){return fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fe(e)}function ve(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ve=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function h(e,t,n,i){var s=t&&t.prototype instanceof f?t:f,o=Object.create(s.prototype),a=new A(i||[]);return r(o,"_invoke",{value:S(e,n,a)}),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var d="suspendedStart",m="executing",g="completed",p={};function f(){}function v(){}function y(){}var b={};l(b,o,function(){return this});var w=Object.getPrototypeOf,C=w&&w(w(L([])));C&&C!==n&&i.call(C,o)&&(b=C);var E=y.prototype=f.prototype=Object.create(b);function $(e){["next","throw","return"].forEach(function(t){l(e,t,function(e){return this._invoke(t,e)})})}function T(e,t){function n(r,s,o,a){var c=u(e[r],e,s);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==fe(h)&&i.call(h,"__await")?t.resolve(h.__await).then(function(e){n("next",e,o,a)},function(e){n("throw",e,o,a)}):t.resolve(h).then(function(e){l.value=e,o(l)},function(e){return n("throw",e,o,a)})}a(c.arg)}var s;r(this,"_invoke",{value:function(e,i){function r(){return new t(function(t,r){n(e,i,t,r)})}return s=s?s.then(r,r):r()}})}function S(t,n,i){var r=d;return function(s,o){if(r===m)throw Error("Generator is already running");if(r===g){if("throw"===s)throw o;return{value:e,done:!0}}for(i.method=s,i.arg=o;;){var a=i.delegate;if(a){var c=N(a,i);if(c){if(c===p)continue;return c}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(r===d)throw r=g,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r=m;var l=u(t,n,i);if("normal"===l.type){if(r=i.done?g:"suspendedYield",l.arg===p)continue;return{value:l.arg,done:i.done}}"throw"===l.type&&(r=g,i.method="throw",i.arg=l.arg)}}}function N(t,n){var i=n.method,r=t.iterator[i];if(r===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),p;var s=u(r,t.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,p;var o=s.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[o];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,s=function n(){for(;++r<t.length;)if(i.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return s.next=s}}throw new TypeError(fe(t)+" is not iterable")}return v.prototype=y,r(E,"constructor",{value:y,configurable:!0}),r(y,"constructor",{value:v,configurable:!0}),v.displayName=l(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,l(e,c,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},$(T.prototype),l(T.prototype,a,function(){return this}),t.AsyncIterator=T,t.async=function(e,n,i,r,s){void 0===s&&(s=Promise);var o=new T(h(e,n,i,r),s);return t.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},$(E),l(E,c,"Generator"),l(E,o,function(){return this}),l(E,"toString",function(){return"[object Generator]"}),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=L,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(x),!t)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(i,r){return a.type="throw",a.arg=t,n.next=i,r&&(n.method="next",n.arg=e),!!r}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=i.call(o,"catchLoc"),l=i.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var s=r;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=e,o.arg=t,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;x(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:L(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),p}},t}function ye(e,t,n,i,r,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(i,r)}function be(){var e;return e=ve().mark(function e(){var t,n,i;return ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return l("Widget launch"),t=U(),n=t.domElement.querySelector(".".concat(t.contentClassName)),i=new pe({parentContainer:t}),t.children=i,i.insertIn(n,"beforeend"),t.init(!0).then(function(e){return e.response&&t.show()}),e.abrupt("return",{parentContainer:t,NPS:i});case 9:case"end":return e.stop()}},e)}),be=function(){var t=this,n=arguments;return new Promise(function(i,r){var s=e.apply(t,n);function o(e){ye(s,i,r,o,a,"next",e)}function a(e){ye(s,i,r,o,a,"throw",e)}o(void 0)})},be.apply(this,arguments)}!function(){be.apply(this,arguments)}()}(); | ||
!function(){"use strict";const e=()=>Object.prototype.hasOwnProperty.call(top,"ABTastyEditor"),t=()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t},n=e=>new Function(`try {\n\t\t${e}\n\t} catch (error) {\n\t\treturn null;\n\t}`)(),i=()=>encodeURIComponent(DATA.spNoTrim?window.location.href.replace(window.location.origin,""):`${window.location.pathname}`),r=()=>{const{socialProofContentType:e,productKeyProvider:t,pathToProductKey:r,customJSProductKey:s,productSKU:o}=DATA,{pathToProductKey:a,customJSProductKey:c}="DATA_JS"in arguments?DATA_JS:{};if(2===e)return{productKey:i(),keyType:"url"};{let l=null,h="sku";switch(t){case"ABTastyProductKey":l=window.ABTastyProductKey;break;case"pathToProductKey":l="function"==typeof a?a():n(`return ${r};`);break;case"customJSProductKey":l="function"==typeof c?c():n(s);break;case"productSKU":l=o}return l||3!==e||(l=i(),h="url"),{productKey:l,keyType:h}}},s=()=>!e()&&(t()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),o=()=>window.ABTasty&&!0===window.ABTasty.consentReady,a=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},c=()=>{const e=a();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},l=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,h=n=>{const i=(()=>{if(e()||t())return!1;const n=ABTasty.getTestsOnPage()[TEST_ID];return!!n&&Object.keys(n.targetings.qaParameters).length>0})(),r=window.document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(i||r){const e=c();window.console.log(`%c${e} - ${i?"QA":"Debug"} Mode for campaign ${TEST_ID} %c ${n}`,"background-color: #D6FF01; color: #3100be; padding: 3px 0 3px 10px; border-radius: 5px 0 0 5px; font-weight: bold;","background-color: #3100be; color: white; padding: 3px 10px 3px 0; border-radius: 0 5px 5px 0;")}},u=e=>{const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise((e,n)=>{t.resolve=e,t.reject=n}),t},d=(e,t)=>{const n=t?[]:null;if("string"!=typeof e||!e.trim().length)return n;const[i,r,s]=e.split("[]").map(e=>e.trim()),o=Boolean(s)?s:e,a=r?document.querySelector(i)?.[r]:document;return a?t?[...a.querySelectorAll(o)]:a.querySelector(o):n},m=e=>d(e,!1),g=e=>d(e,!0),p=(e,t)=>{const n=document.querySelector("body")||document.documentElement,i={childList:!0,subtree:!0,attributes:!0},r=()=>s.disconnect(),s=new MutationObserver(()=>{const n=m(t);return n&&!r()&&e(n)});return{clear:r,observe:(e=n)=>s.observe(e,i)}},f=()=>{},v=(t,n)=>{const i=m(t),r={selector:t,clear:f,observe:f};if(i)return setTimeout(()=>n(i),0),r;if(e())return setTimeout(()=>v(t,n),1e3),r;if(t.includes("[]"))return((e,t)=>{const[n,i]=t.split("[]").map(e=>e.trim()),r=m(n),s=r?.[i],{clear:o,observe:a}=p(e,t),c=()=>{const n=m(t);return n&&!l()&&e(n)},l=()=>{o(),r?.removeEventListener("load",c)},h=()=>{a(s),"iframe"===r?.localName&&r.addEventListener("load",c)};return h(),{selector:t,clear:l,observe:h}})(n,t);const{clear:s,observe:o}=p(n,t);return o(),{selector:t,clear:s,observe:o}};function y(e,t){const n=e.parentElement||e.getRootNode().host;return t(e)||!n?e:y(n,t)}const b=t=>{e()||(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())},w=(e,t)=>[...g(t)].some(n=>{const[i,,r]=t.split("[]"),s=r??i;return n===e||!!e.closest(s)});let C=!1;class E{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=null,this.mutationObserver=null,this.mouseOverEvent=null,this.scrollEvent=null,this.onTransitionEnd=null,this.onIframeLoad=null}transitionOverHandler(e){const t=[e,"transitionend",this.checkElements.bind(this),!0];return this.getEvents(...t)}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets.forEach(t=>{t.element.isSameNode(e.target)&&(this.inViewportTargets.push(t),this.mouseOverEvent.start(),this.scrollEvent.start(),this.onTransitionEnd.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(t=>!t.element.isSameNode(e.target)||(this.mouseOverEvent.clear(),this.scrollEvent.clear(),this.onTransitionEnd.clear(),!1))})}startVisibilityObserver(e){const t={root:e,rootMargin:"0px",threshold:0};return this.visibilityObserver??=new IntersectionObserver(this.intersectionHandler.bind(this),t),this.visibilityObserver}startMutationObserver(e){return this.mutationObserver??=new MutationObserver(this.checkElements.bind(this)),this.mutationObserver.observe(e,{attributes:!0,childList:!0,subtree:!0}),this.mutationObserver}onMouseOver({target:e,path:t}){const n=this.inViewportTargets.find(({element:n,selector:i})=>{if(n.isSameNode(e))return!0;const[r,,s]=i.split("[]"),o=s??r,a=[...e.querySelectorAll(o)];if(a.length&&a.includes(n))return!0;if(t.includes(n))return!0;if(!e.parentElement?.children?.length)return;const c=[...e.parentElement.children],l=c.findIndex(t=>t.isSameNode(e)),h=c.filter((e,t)=>t>l);if(h.length){if(h.includes(n))return!0;if(h.some(e=>[...e.querySelectorAll(o)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:e,element:t,uniqueId:i}=n,r=this.targets.find(t=>t.selector===e&&t.uniqueId===i);r&&r.resolve(t),this.clear(e,i)}}getEvents(e,...t){return{start:()=>e?.addEventListener(...t),clear:()=>e?.removeEventListener(...t)}}mouseOverHandler(e){const t=[e,"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?"touchmove":"mouseover",e=>{const t=e.composedPath(),{target:n}=e;setTimeout(()=>this.onMouseOver({target:n,path:t}),50)},!0];return this.getEvents(...t)}scrollEventHandler(e){const t=[e,"scroll",(n=this.checkElements.bind(this),()=>{C||(C=!0,setTimeout(()=>{n(),C=!1},100))}),{passive:!0}];var n;return this.getEvents(...t)}isElementVisible(e){return this.isElementOpaque(e)&&this.isElementTopmost(e)}isElementOpaque(e){return"HTML"===y(e,e=>"0"===window.getComputedStyle(e).opacity).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),n=[[t.left,t.top],[t.right,t.top],[t.left,t.bottom],[t.right,t.bottom],[t.left+t.width/2,t.top],[t.left+t.width/2,t.bottom],[t.left,t.height/2],[t.right,t.height/2],[t.left+t.left/2,t.height/2]];let i=!1,r=0;for(;!i&&r<n.length;){const t=e.getRootNode()?.elementFromPoint(...n[r]);i=e===t||t?.contains(e)||e.contains(t),r+=1}return i}checkElements(){this.targets.forEach(({selector:e,uniqueId:t})=>{const n=m(e),[i,,r]=e.split("[]"),s=r??i;n&&!this.existingTargets.find(e=>e.element.matches(s)&&e.uniqueId===t)&&(this.existingTargets.push({element:n,selector:e,uniqueId:t}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:e,element:t})=>!!m(e)||(t&&this.visibilityObserver.unobserve(t),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:e,element:t,uniqueId:n})=>{const[i,,r]=e.split("[]"),s=r??i;if(t.matches(s)&&this.isElementVisible(t)){const i=this.targets.find(t=>t.selector===e&&t.uniqueId===n);return i&&i.resolve(t),this.clear(e,n),!1}return!0})}onLoadIframe(e){const t=[e.defaultView.frameElement,"load",()=>this.watch(selector,resolve,uniqueId).bind(this),{passive:!0}];return this.getEvents(...t)}watch(e,t,n){this.targets.push({selector:e,resolve:t,uniqueId:n});const{clear:i}=v(e,e=>{i();const t=e.getRootNode(),n="body"in t?t.body:document;this.mouseOverEvent=this.mouseOverHandler(t),this.scrollEvent=this.scrollEventHandler(t),this.onTransitionEnd=this.transitionOverHandler(t),t.defaultView?.frameElement&&(this.onIframeLoad=this.onLoadIframe(t),this.onIframeLoad.start()),this.startVisibilityObserver(n),this.startMutationObserver(n),this.checkElements()})}clear(e,t){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(n=>n.filter(({selector:n,uniqueId:i})=>n!==e&&i!==t));const n=m(e);n&&this.visibilityObserver?.unobserve(n),0===this.targets.length&&(this.mutationObserver?.disconnect(),this.onIframeLoad?.clear()),0===this.inViewportTargets.length&&(this.mouseOverEvent?.clear(),this.scrollEvent?.clear(),this.onTransitionEnd?.clear())}}const S="remove",T="rebuild",$="update",N="ABTastyData";class k{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:n,triggerTarget:i}){this.event=e,this.selector=Boolean(t)?t:"body",this.target="string"==typeof i?m(t):i,this.delay=1e3*n,this.triggerElements=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.promises=[],this.visibilityObservers=[],this.socialProofStore={},this.elementWaiters=[]}async onElementVisible({promise:e,resolve:t}){const n=u(`${this.event}DomReady`);this.promises.push(n);const{clear:i}=v(this.selector,()=>{const e=new E;this.visibilityObservers.push(e),e.watch(this.selector,t,l())});return this.elementWaiters.push(i),e}onPageLoad({promise:e,resolve:t}){const n=()=>"complete"===document.readyState;if(!n()){const i=["readystatechange",()=>n()&&t(!0),{passive:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}return t(!0),e}onClick({promise:e,resolve:t}){const n=({isTrusted:e,target:n})=>{if(e)return(n.isEqualNode(this.target)||w(n,this.selector))&&t(!0)},{clear:i}=v(this.selector,e=>{i();const t=document.createElement("style");t.id=`Click_${l()}`;const[r,,s]=this.selector.split("[]"),o=s??r;t.innerHTML=`${o} {\n\t\t\t\tcursor: pointer !important;\n\t\t\t\tpointer-events: all !important;\n\t\t\t}`;const a=e.getRootNode();("head"in a?a.head:a).appendChild(t),this.triggerElements.push(t);const c=["click",n,{passive:!0,capture:!0}];this.eventsListeners.push([a,...c]),a.addEventListener(...c)});return this.elementWaiters.push(i),e}onHover({promise:e,resolve:t}){const n=({isTrusted:e,target:n})=>{if(e)return(this.target?n.isEqualNode(this.target):w(n,this.selector))&&t(!0)},{clear:i}=v(this.selector,e=>{const t=e.getRootNode(),i="body"in t?t.body:[...t.childNodes].find(t=>t.contains(e)),r=["mouseenter",n,{passive:!0,capture:!0}];this.eventsListeners.push([i,...r]),i.addEventListener(...r)});return this.elementWaiters.push(i),e}onExitIntent({promise:e,resolve:t}){const n=["mouseleave",({isTrusted:e,clientY:n})=>{e&&n<=0&&t(!0)},{passive:!0}],{clear:i}=v("html",e=>{i(),this.eventsListeners.push([e,...n]),e.addEventListener(...n)});return e}onReengage({promise:e,resolve:t}){const n=this.delay;let i=n;const r=[...document.querySelectorAll("*:empty")].map(e=>e.contentDocument||e.shadowRoot).filter(e=>e),s=[({isTrusted:e})=>{e&&(i=n)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{[document,...r].forEach(t=>{this.eventsListeners.push([t,e,...s]),t.addEventListener(e,...s)})});const o=setInterval(()=>{i<=0?t(!0):i-=100},100);return this.intervals.push(o),e}onCustomTrigger({promise:e,resolve:t}){const{triggerEventCustomScript:n}=DATA,i="DATA_JS"in arguments&&DATA_JS?.triggerEventCustomScript,r="function"==typeof i?new Promise(async e=>i(e)):new Function(`return new Promise(async resolve => {${n}})`);return r().then(e=>e&&t(!0)),e}onScrollUp({promise:e,resolve:t}){let n=0;const i=["scroll",({isTrusted:e})=>{e&&(window.scrollY<n?t(!0):n=window.scrollY)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}onScrollPercentReached({promise:e,resolve:t}){const{triggerEventScrollPercent:n}=DATA,i=["scroll",({isTrusted:e})=>{if(!e)return;const i=(()=>{const{documentElement:e,body:t}=document,n=e.scrollTop||t.scrollTop,i=e.scrollHeight||t.scrollHeight;return Math.trunc(n/(i-e.clientHeight)*100,10)})();n<i&&t(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}checkSocialProofConditions(e,t,n,i){const r=(()=>{let e;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S?.USER?.accountIdentifier?.length?e=window.ABTASTY_S.USER.accountIdentifier:"function"==typeof window.ABTasty?.getAccountSettings?e=window.ABTasty.getAccountSettings().identifier:window.ABTasty?.accountSettings&&(e=window.ABTasty.accountSettings.identifier),e):e})(),{viewInterval:s,spNoTrim:o}=DATA;if(this.socialProofStore.hasOwnProperty(e))n(this.socialProofStore[e])?i(`${this.socialProofStore[e][s]}`):i(!1);else if(e&&r){const a=t=>(this.socialProofStore[e]=t,i(!!n(t)&&`${t[s]}`));fetch(`https://api-social-proof.abtasty.com/clients/${r}/metrics/${t}?key=${e}${o?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(a).catch(()=>h("Failed to fetch datas from server."))}else i(!1)}getSocialProofDatas({promise:e,resolve:t},n,i=!1){const{productKey:s,keyType:o}=r(),{viewInterval:a,triggerSocialProofMinVisitors:c,triggerSocialProofMinPurchases:l,triggerSocialProofMinPageViews:u}=DATA,d={pv:u,i:l,"v-pv":c}[n];return[typeof a,typeof d].includes("undefined")&&t(!1),i&&!s&&(h("Not able to find ABTastyProductKey, impossible to call the API, read documentation for more informations:\n\t\t\t\thttps://support.abtasty.com/hc/en-us/articles/4710919241628-Widgets-List#h_84c04344-c655-4e5e-b9ab-d26a798ad9b0"),t(!1)),this.checkSocialProofConditions(s,"v-pv"===n&&"sku"===o?"v-i":n,e=>{const t=void 0!==e[a]&&e[a]>=d;return t||h(`Widget will not be shown, Social Proof API returned ${e[a]} while ${d} are required`),t},t),e}onConsent({promise:e,resolve:t}){if(!o()){const n=["abtasty_consentValid",()=>t(!0)];return this.eventsListeners.push(n),window.addEventListener(...n),e}return t(!0),e}onTrackingSent({promise:e,resolve:t}){const{triggerEventTrackingSent:n}=DATA;let i=localStorage.getItem(N);const r=()=>JSON.parse(i)?.ActionTracking?.some(({name:e})=>e===n),s=["storage",({key:e,newValue:n})=>{e===N&&(i=n,r()&&t(!0))},{passive:!0,capture:!0}];return i&&r()?t(!0):(()=>{this.eventsListeners.push([window,...s]),window.addEventListener(...s)})(),e}onMinPagesViewed({promise:e,resolve:t}){const{triggerEventMinPagesViewed:n}=DATA;let i=localStorage.getItem(N);const r=()=>n<=(i?JSON.parse(i)?.VisitedPages?.length:0),s=["storage",({key:e,newValue:n})=>{e===N&&(i=n,r()&&t(!0))},{passive:!0,capture:!0}];return i&&r()?t(!0):(()=>{this.eventsListeners.push([window,...s]),window.addEventListener(...s)})(),e}onRageClick({promise:e,resolve:t}){const{triggerEventRageClickQuantity:n,triggerEventRageClickDelay:i}=DATA;let r=0,s=!1;const o=["click",({isTrusted:e})=>{if(e&&(r+=1,r>=n&&t(!0),!s)){s=!0;const e=setTimeout(()=>{r=0,s=!1},i);this.timeouts.push(e)}},{passive:!0,capture:!0}],a=e=>{this.eventsListeners.push([e,...o]),e.addEventListener(...o)},{clear:c}=v("iframe []contentDocument[] body > *",()=>{const e=document.getElementsByTagName("iframe");for(const t of e){"contentDocument"in t&&"body"in t.contentDocument&&a(t.contentDocument);const e=()=>a(t.contentDocument);t.addEventListener("load",e),this.eventsListeners.push([t,"onIframeLoad",e])}});return this.elementWaiters.push(c),a(document),e}clear(){this.triggerElements=this.triggerElements.filter(e=>(e.remove(),!1)),this.eventsListeners=this.eventsListeners.filter(e=>{const[t,...n]=e;return t&&n.length>1&&t.removeEventListener(...n),!1}),this.timeouts=this.timeouts.filter(e=>(clearTimeout(e),!1)),this.intervals=this.intervals.filter(e=>(clearInterval(e),!1));const e=l();return this.visibilityObservers=this.visibilityObservers.filter(t=>(t.clear(this.selector,e),!1)),this.promises=this.promises.filter(e=>(e.resolve(!1),!1)),this.elementWaiters=this.elementWaiters.filter(e=>(e(),!1)),this}async isTriggered(){this.clear();const e=u(this.event);this.promises.push(e);const t={consent:()=>this.onConsent(e),direct:()=>!0,pageLoad:()=>this.onPageLoad(e),click:()=>this.onClick(e),exitIntent:()=>this.onExitIntent(e),reengage:()=>this.onReengage(e),elementVisible:()=>this.onElementVisible(e),script:()=>this.onCustomTrigger(e),hover:()=>this.onHover(e),scrollUp:()=>this.onScrollUp(e),scrollPercent:()=>this.onScrollPercentReached(e),rageClick:()=>this.onRageClick(e),minPagesViewed:()=>this.onMinPagesViewed(e),trackingSent:()=>this.onTrackingSent(e),socialProofPurchases:()=>this.getSocialProofDatas(e,"i",!0),socialProofPageViews:()=>this.getSocialProofDatas(e,"pv"),socialProofVisitors:()=>this.getSocialProofDatas(e,"v-pv")},n=!Object.prototype.hasOwnProperty.call(t,this.event)||await t[this.event]();return n&&this.clear(),"reengage"!==this.event&&this.delay?n&&await(async()=>{const e=u(`${this.event}Delay`);this.promises.push(e);const t=setTimeout(()=>{e.resolve(!0),this.clear()},this.delay);return this.timeouts.push(t),e.promise})():n}}const x="display",A="closing",L="validation",P="ABTastyWidgets",I=`${P}Temporary`;class O{constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:n},i){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(n),this.onSetCallback=i,this.widgetName=a(),this.uniqueId=l(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:e}){const t=localStorage.getItem(I),n=sessionStorage.getItem(P);"ABTastyData"===e&&!t&&n&&localStorage.setItem(I,n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem(P);return JSON.parse(t)}catch(t){return e.removeItem(P),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:n,...i}=t;return Object.entries(i).length?(e.setItem(P,JSON.stringify(i)),i):(e.removeItem(P),!1)}removeSessionRecurrenceStorage(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.sessionStorage,e)}removeLocalRecurrenceStorage(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.localStorage,e)}getSessionRecurrence(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getLocalRecurrence(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getCurrentRecurrence(){if(this.pendingRecurrence)return this.pendingRecurrenceValue;const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=localStorage.getItem(I),t=!(!e||!e.includes(this.recurrenceKey))||this.getSessionRecurrence();e&&(sessionStorage.setItem(P,e),localStorage.removeItem(I));const n=this.getLocalRecurrence(),i=(n?parseFloat(n.stamp):0)<(new Date).getTime();return i&&this.removeLocalRecurrenceStorage(),!this.pendingRecurrence&&i&&!this.getLocalRecurrence()&&!t}setRecurrence(e,n){0!==e&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const i=this.getTypeOfStorage(e);if(t()||!i&&"object"!=typeof i)return!1;const{storageString:r,storageMethod:s}=i,a=this.getStamp(e),c={type:n,stamp:a},{type:l}=this.getCurrentRecurrence(),h=async()=>{if(!o()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const e=new k({triggerEvent:"consent"});await e.isTriggered(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let n;"session"===r?e?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===r&&(t?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const i=n?{[this.recurrenceKey]:c,...n}:{[this.recurrenceKey]:c};s.setItem(P,JSON.stringify(i)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!s)return!1;if(l&&n!==L)if(n===A&&l!==L)h();else{if(n!==x||l===L||l===A)return!1;h()}else h();return a}setDisplayRecurrence(){const e=x;this.setRecurrence(this.displayRecurrence,e)}setClosingRecurrence(){const e=A;this.setRecurrence(this.closingRecurrence,e)}setValidationRecurrence(){const e=L;this.setRecurrence(this.validationRecurrence,e)}getStamp(e){return(new Date).getTime()+864e5*e}getTypeOfStorage(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?{storageString:"local",storageMethod:window.localStorage}:0===e&&{storageString:"session",storageMethod:window.sessionStorage})}}class R{constructor(e,t,n){this.isWidgetApplied=e,this.callback=t,this.shouldUpdate=n,this.triggerIframeTarget=null,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.tagRollbackEventParams=["abtasty_resetActionTracking",this.onTagRollback.bind(this)],this.onCampaignLaunchedEventParams=["abtasty_executedCampaign",this.onCampaignLaunched.bind(this)]}decisionHandler(e){const t=!e&&this.isWidgetApplied(),n=t?this.shouldUpdate&&$:T;return n?(this.clearWatcher(),this.callback(n,!e,t),this.watch(),this):this}onCampaignLaunched({detail:{campaignId:e}}){e===TEST_ID&&(this.callback(T,!1),this.watch())}onTagRollback({target:e}){return this.clearWatcher(e),this.callback(S,!1),window.addEventListener(...this.onCampaignLaunchedEventParams),this}observerHandler(e){return s()?e.some(e=>["removedNodes","addedNodes"].some(t=>e[t]&&e[t].length))?this.decisionHandler():this:this.callback(S,!1)}watch(t,n){if(e())return this;if(this.clearWatcher(t),window.removeEventListener(...this.onCampaignLaunchedEventParams),document.addEventListener(...this.tagRollbackEventParams),n?.includes("[]contentDocument[]")){const e=n.split("[]")[0].trim(),{clear:t}=v(e,e=>{t(),this.triggerIframeTarget=e,e.addEventListener("load",this.decisionHandler.bind(this))})}const i=t?.defaultView?.frameElement;i&&this.triggerIframeTarget!==i&&i.addEventListener("load",this.decisionHandler.bind(this));const{clear:r}=v("body",e=>{r();const n=t?.body||t||e;this.observer.observe(n,{childList:!0,subtree:!0})});return this}clearTriggerElementWatcher(){this.triggerIframeTarget?.removeEventListener("load",this.decisionHandler.bind(this))}clearWatcher(e){return document.removeEventListener(...this.tagRollbackEventParams),this.observer.disconnect(),this.clearTriggerElementWatcher(),e?.defaultView?.frameElement?.removeEventListener("load",this.decisionHandler.bind(this)),this}}const D=/.+\/([^.]+)\.(otf|ttf)$/,_=["socialProofPurchases","socialProofPageViews","socialProofVisitors"];class B{constructor(t,n){this.children=void 0,this.uniqueId=`${l()}${n?`_${n}`:""}`,this.widgetName=a(),this.prettyName=c(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:n,validationRecurrence:i}=DATA,r=!t&&!n&&!i;if(e()||r)return!1;const s={everytime:()=>-1,session:()=>0,once:()=>395,day:e=>DATA[`${e}_day`],week:e=>7*DATA[`${e}_week`],month:e=>30.5*DATA[`${e}_month`]},o={};return t&&(o.displayRecurrence=s[t]("displayRecurrence")),n&&(o.closingRecurrence=s[n]("closingRecurrence")),i&&(o.validationRecurrence=s[i]("validationRecurrence")),o})(),this.triggerParams=(t=>{let{triggerEvent:n}=DATA;const{triggerEventClick:i,triggerEventHover:r,triggerEventReengageDelay:s,socialProofContentType:o,triggerEventElementVisible:a,triggerEventDelay:c}=DATA;if(e()||!n&&!o)return!1;const l={click:()=>i,hover:()=>r,elementVisible:()=>a},h=Object.prototype.hasOwnProperty.call(l,n)?l[n]():"body",u="reengage"===n?s:c;return o&&(n=[,"socialProofPurchases","socialProofPageViews","socialProofVisitors"][o]),{triggerEvent:n,triggerSelector:h,triggerDelay:u,triggerTarget:t}})(t),this.recurrence=!!this.recurrenceParams&&new O(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new k(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&_.includes(this.triggerParams.triggerEvent),this.pageWatcher=new R(this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!t||!["click","hover","scrollUp","script"].includes(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.rootElement=null,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.elementsWaiters=[]}clearGivenClearables(){this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]}isWidgetApplied(){return this.domElement?.isConnected&&this.domElement.ownerDocument?.defaultView}removeOldDomElement(){const e=this.rootElement?.getElementById(this.widgetContainerId);return e?.remove(),this}async insert(){if(this.isWidgetApplied())return!1;const e=["free"];"drawer"===DATA.layout&&DATA.customTarget&&e.push("drawer");const t=e.includes(DATA.layout);return new Promise(e=>{const{elementReferrer:n="body",referrerInsertType:i="beforeend"}=t?DATA:{},r=v(n,t=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e.selector!==n),this.rootElement=t.getRootNode(),this.removeOldDomElement(),this.domElement.appendChild(this.styleElement),e(t.insertAdjacentElement(i,this.domElement))});this.elementsWaiters.push(r)}).then(()=>this)}remove(){return this.trigger&&this.trigger.clear(),this.pageWatcher.clearWatcher(this.rootElement),this.domElement?.isConnected&&this.domElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch(this.rootElement):e()||this.init().then(({response:e})=>e?this.show():this),this}show(){return e()||this.hasBeenShown&&this.hasOncePerPageTrigger||window.ABTastyEvent(`${this.prettyName} displayed`,null,TEST_ID),this.closedByUser=!1,setTimeout(()=>this.domElement.classList.remove(this.hideClassName),50),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(this.rootElement),this}hide(t=!0){return!e()&&this.hasBeenShown&&t&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),t&&(this.pageWatcher.clearWatcher(this.rootElement),this.closedByUser=!0),this.domElement.classList.add(this.hideClassName),this}async init(t){const n=e(),i=s(),r=this.trigger?.promises?.length,o=!this.recurrence||this.recurrence.isOver();if(!n&&!i||r||!o)return{container:this,response:!1};this.pageWatcher.watch(this.rootElement||document,this.triggerParams.triggerSelector);const a=n||!this.trigger||this.trigger&&await this.trigger.isTriggered();this.pageWatcher.clearTriggerElementWatcher();const c={container:this,response:a};return a?(await this.insert(),this.addCloseEvent(),n||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(a),c):c}onPageChange(e,t,n){const i=()=>this.init().then(({response:e})=>{e?this.show():this.hide(!1)});t||(this.hasBeenShown=!1,this.trigger&&this.trigger.clear());const r={[S]:()=>n?this.remove():this.pageWatcher.watch(this.rootElement),[T]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch(this.rootElement):n||this.insert().then(e=>e.show()).catch(this.pageWatcher.watch):i()},[$]:()=>{this.hasBeenShown?this.pageWatcher.watch():i()}};"function"==typeof r[e]&&r[e]()}addCloseEvent(...t){const{closeButton:n,overlay:i,overlayClickable:r,layout:s,animationDuration:o=1e3}=DATA,a=[];if(void 0!==i&&!0!==i||!0!==r||"popin"!==s||a.push(`.${this.overlayClassName}`),void 0!==n&&n&&a.push(`.${this.closeButtonClassName}`),!a.length)return this;const c=this.domElement.querySelectorAll(a.join(", "));if(!c.length)return this;const l=["click",e=>{b(e),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*o)},{once:!0,capture:!0}];return t.push(...c),t.forEach(t=>{e()&&(t.dataset.abtastyActionnable="true"),t.removeEventListener(...l),t.addEventListener(...l)}),this}getDom(){const{closeButton:e,layout:t,overlayClickable:n,overlay:i=!0}=DATA,r=document.createElement("div");return r.className=`${this.basicClassName} ${this.hideClassName}`,r.id=this.widgetContainerId,["popin","bannerTop","bannerBottom"].includes(t)&&(r.role="dialog"),r.innerHTML=`\n\t\t\t${"popin"===t&&!0===i?`<div ${n?'aria-label="Close dialog"':""} class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${e?`<button class="${this.closeButtonClassName}" aria-label="Close dialog"><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>`,r}loadFont(e,t){if(!e||"inherit"===e||!/otf|ttf/g.test(t))return;const n=document.createElement("style"),i=t.match(D)?t.match(D)[1]:"";n.innerHTML=`@font-face { font-family: '${e}_${i}'; src: url('${t}'); font-display: swap; }`;const r=this.rootElement?.head||document.head;r?.appendChild(n)}getStyleTag(t="",n=DATA){const{noStyles:i,layout:r}=n,{backgroundColor:s,isBackgroundImage:o,backgroundImage:a,backgroundSize:c,backgroundPosition:l,backgroundRepeat:h,borderColor:u,borderRadius:d,borderWidth:m,textColor:g,textAlign:p,fontName:f,fontStyle:v,fontSize:y,isTitle:b,titleTextAlign:w,titleTextColor:C,titleFontName:E,titleFontStyle:S,titleFontSize:T,overlay:$,overlayColor:N,dropShadow:k,dropShadowColor:x,dropShadowBlur:A,containerMargin:L,containerPadding:P,closeButton:I,closeButtonPosition:O,closeButtonSize:R,closeButtonBorderRadius:_,closeButtonBorderWidth:B,closeButtonBorderColor:j,closeButtonColor:F,closeButtonBackgroundColor:V,buttonsAlign:W,buttonsBorderWidth:q,buttonsBorderColor:M,buttonsBorderRadius:H,buttonsBackgroundColor:z,buttonsTextColor:K,buttonsFontName:U,buttonsFontStyle:Y,buttonsFontSize:G,secondLink:J,secondLinkBorderWidth:Q,secondLinkBorderColor:X,secondLinkBorderRadius:Z,secondLinkBackgroundColor:ee,secondLinkTextColor:te,secondLinkFontName:ne,secondLinkFontStyle:ie,secondLinkFontSize:re,animation:se,animationDuration:oe,animationBehaviour:ae,animationSlideDirection:ce}=i?{}:n,le=document.createElement("style");e()&&le.setAttribute("abtasty-script-added","true"),this.loadFont(f,v),this.loadFont(E,S),this.loadFont(U,Y),this.loadFont(ne,ie);const he=`background: ${["string"==typeof s?s:"rgba(255, 255, 255, 1)",o&&"string"==typeof a&&a.length?`url(${a})`:"",o&&"string"==typeof l&&"100% 100%"!==c?l:"0 0",o&&"string"==typeof c?`/ ${c}`:"/ auto",o&&h&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,ue="number"==typeof m&&m>0,de=`border: ${[ue?`${m}px`:"unset",ue?"solid":"",ue&&"string"==typeof u&&u.length?u:""].join(" ").trim()};`,me=void 0!==d?`border-radius: ${d}px;`:"",ge=void 0!==g?`color: ${g}; fill: ${g}; -webkit-text-fill-color: ${g};`:"",pe=void 0!==p?`text-align: ${p};`:"",fe=f&&"inherit"!==f?`font-family:${f}_${v.match(D)?v.match(D)[1]:""};`:v||"",ve=y?`font-size: ${y}px;`:"",ye=void 0!==k&&k?`box-shadow: 0 5px ${A}px 0 ${x};`:"",be=L instanceof Array&&1===L.length&&L[0],we=be?`margin: ${be.top}px ${be.right}px ${be.bottom}px ${be.left}px;`:"",Ce=be?`margin: calc(${be.top}px * 0.5) calc(${be.right}px * 0.5) calc(${be.bottom}px * 0.5) calc(${be.left}px * 0.5);`:"",Ee=P instanceof Array&&1===P.length&&P[0],Se=Ee?`padding: ${Ee.top}px ${Ee.right}px ${Ee.bottom}px ${Ee.left}px;`:"",Te=Ee?`padding: calc(${Ee.top}px * 0.5) calc(${Ee.right}px * 0.5) calc(${Ee.bottom}px * 0.5) calc(${Ee.left}px * 0.5);`:"",$e=void 0!==q&&q?`border-width: ${q}px; border-style: solid;`:"",Ne=[M,q].every(e=>void 0!==e)&&q?`border-color: ${M};`:"",ke=void 0!==H?`border-radius: ${H}px;`:"",xe=void 0!==z?`background-color: ${z};`:"",Ae=void 0!==K?`color: ${K}; fill: ${K}; -webkit-text-fill-color: ${K};`:"",Le=U&&"inherit"!==U?`font-family:${U}_${Y.match(D)?Y.match(D)[1]:""};`:Y||"",Pe=G?`font-size: ${G}px;`:"",Ie="number"==typeof Q?`border-width: ${Q}px; border-style: solid;`:"",Oe=[X,Q].every(e=>void 0!==e)&&Q?`border-color: ${X};`:"",Re=void 0!==Z?`border-radius: ${Z}px;`:"",De=void 0!==ee?`background-color: ${ee};`:"",_e=void 0!==te?`color: ${te}; fill: ${te}; -webkit-text-fill-color: ${te};`:"",Be=ne&&"inherit"!==ne?`font-family:${ne}_${ie.match(D)?ie.match(D)[1]:""};`:ie||"",je=re?`font-size: ${re}px;`:"",Fe="popin"!==r||void 0!==$&&!0!==$?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==N?N:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),Ve="number"==typeof R?R:16,We=Ve/2,qe=i||void 0!==I&&I?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===O?`bottom: calc(100% + ${We}px)`:`top: ${We}px`)+";",`right: ${We}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof _?`border-radius: ${_}px;`:"","number"==typeof B&&B>0?`border: ${B}px solid ${void 0!==j?j:"rgba(57, 57, 57, 1)"};`:"","string"==typeof V?`background-color: ${V};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${Ve}px;`,`height: ${Ve}px;`,"string"==typeof F?`fill: ${F};`:"","}"].join(""):"",Me=b&&"string"==typeof C?[`#${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: ${C}; fill: ${C}; -webkit-text-fill-color: ${C};`,void 0!==w?`text-align: ${w};`:"",E&&"inherit"!==E?`font-family:${E}_${S.match(D)?S.match(D)[1]:""};`:S||"",T?`font-size: ${T}px;`:"","}"].join(""):"";let He="";if("string"==typeof se){const t=(oe/1e3).toFixed(2),n=["top","bottom"].includes(ce),i=Number(n),r=[(["top","left"].includes(ce)?"-":"")+"100vmax",this.translateValues?this.translateValues[i]:"0"];n&&r.reverse(),He={none:[`.${this.hideClassName} {`,"opacity: 0 !important;","}"],fade:[`.${this.hideClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} {`,`transition: opacity ${t}s ${ae};`,"}"],slide:[`.${this.hideClassName} .${this.overlayClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,`transition: opacity ${t}s ${ae};`,"}",`.${this.hideClassName} .${this.contentClassName} {`,`transform: translate(${r.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${t}s ${ae};`,"}"]}[e()&&!ABTASTY_S.WIDGETS.animationChanged?"none":se].join("")}const ze=[`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,`margin-${"fill"===W?"top":"left"}: 8px;`,Ie,Oe,Re,De,_e,Be,je,"}",`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,_e,Be,je,"}"];return le.textContent=[`#${this.widgetContainerId} style { display: none; }`,`.${this.hideClassName} {`,"pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,he,me,de,ge,pe,ye,we,fe,ve,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,ge,pe,fe,ve,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",Se,fe,ve,"}",`#${this.widgetContainerId} .${this.contentClassName} a {`,"text-decoration: underline;","}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a, `,`#${this.widgetContainerId} .${this.contentClassName} button {`,"text-decoration: none;","box-sizing: border-box;","display: inline-block;",$e,Ne,ke,xe,Ae,Le,Pe,"}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a *, `,`#${this.widgetContainerId} .${this.contentClassName} button:not(class*="close_button") * {`,Ae,Le,Pe,"}",...J?ze:[],"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,Ce,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,Te,"}","}",Fe,qe,Me,He,`${t}`].join(""),le}}const j=["top: 0;","top: 50%;","bottom: 0;"],F=["left: 0;","left: 50%;","right: 0;"],V=e=>1===e?"-50%":0,W=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:e,y:t}]}=DATA,n=`translate(${V(t)}, ${V(e)});`;return`${j[e]}${F[t]}transform: ${n}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},q=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,M=()=>{if(q())return"width: auto; height: auto; min-width: fit-content;";const{popinPercentWidth:e,popinPixelsWidth:t,widthUnit:n,autoHeight:i,popinPercentHeight:r,popinPixelsHeight:s,heightUnit:o}=DATA;return`width: ${"px"===n?t:e}${n};height: ${i?"auto":`${"px"===o?s:r}${o}`};`};class H extends B{constructor(){super(),this.translateValues=Object.values(DATA.popinPosition[0]).map(e=>V(e)),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:e,zindexCustom:t,widthUnit:n}=DATA,i="string"!=typeof DATA.overlay&&DATA.overlay;return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;",`z-index: ${"custom"===e?t:e};`,"background: none;","pointer-events: "+(i?"all":"none"),"}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;",W(),M(),"pointer-events: all","}",`${q()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${!q()&&["px","em"].includes(n)?["@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join(""):""}`].join("")}}class z extends B{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:e,zindexCustom:t}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;",`${this.position}: 0;`,"left: 0;","width: 100%;","height: auto;",`z-index: ${"custom"===e?t:e};`,"background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class K extends B{constructor(e,t){super(e,t),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 U=()=>{const{layout:e}=DATA;let t;switch(e){case"popin":t=new H;break;case"bannerTop":case"bannerBottom":t=new z;break;case"free":t=new K;break;default:t=new B}return t};function Y(e){return Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Y(e)}function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?G(Object(n),!0).forEach(function(t){Q(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Q(e,t,n){return(t=Z(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Z(e){var t=function(e){if("object"!=Y(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Y(t)?t:t+""}var ee=DATA,te=ee.isFeedBackQuestion,ne=ee.isThankYouMessage,ie=ee.autoHide,re=ee.timeHide,se=ee.stepToShow,oe=ee.question,ae=ee.feedbackQuestion,ce=ee.buttonText,le=ee.thankYouMessage,he=ee.isLegend,ue=ee.minLegend,de=ee.maxLegend,me=ee.noStyles,ge=ee.layout,pe={capture:!0,passive:!1},fe=function(){return t=function e(t){var n=t.parentContainer;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.parentContainer=n,this.baseClassName="nps_container",this.className="".concat(this.baseClassName,"_").concat(n.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(n.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()},n=[{key:"sendNote",value:function(){return e()||isNaN(this.currentNote)||(h("Sending datas, note: ".concat(this.currentNote,', feedback: "').concat(this.userFeedback,'"')),window.abtasty.send("nps",{caid:TEST_ID,vaid:VARIATION_ID,ns:this.currentNote,nf:this.userFeedback})),this}},{key:"insertIn",value:function(e,t){return this.setStyles(),e.insertAdjacentElement(t,this.npsElement),this}},{key:"complete",value:function(){var e=this;return this.sendNote(),this.parentContainer.recurrence.setValidationRecurrence(),ie?(setTimeout(function(){e.parentContainer.hide(),setTimeout(function(){return e.parentContainer.remove()},1e3)},1e3*re),this):this}},{key:"onClickNote",value:function(e){this.currentNote=Number(e.target.dataset.note),te&&ae&&ae.length?this.showFeedBack():ne&&le&&le.length?this.showThankYouMessage():this.complete()}},{key:"onFeedbackSend",value:function(){ne&&le&&le.length?this.showThankYouMessage():this.complete()}},{key:"hideAllChildren",value:function(){var e,t=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,t){if(e){if("string"==typeof e)return X(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?X(e,t):void 0}}(e))){t&&(e=t);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=!0,o=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return s=e.done,e},e:function(e){o=!0,r=e},f:function(){try{s||null==t.return||t.return()}finally{if(o)throw r}}}}(this.npsContainer.children);try{for(t.s();!(e=t.n()).done;)e.value.classList.add(this.hideClassName)}catch(e){t.e(e)}finally{t.f()}}},{key:"setAriaLabel",value:function(e){["popin","bannerTop","bannerBottom"].includes(ge)&&this.parentContainer.domElement.setAttribute("aria-label",e)}},{key:"showFeedBack",value:function(){this.hideAllChildren();for(var e=0,t=Object.values(this.feedbackElements);e<t.length;e++)t[e].classList.remove(this.hideClassName);return this.setAriaLabel(ae),this}},{key:"showThankYouMessage",value:function(){return this.hideAllChildren(),this.thankYouElement.classList.remove(this.hideClassName),this.setAriaLabel(le),this.complete(),this}},{key:"getThankYouElement",value:function(){var t=document.createElement("p");return t.className="".concat(this.thankYouClassName," ").concat(this.hideClassName),t.innerHTML=le,e()&&"displayThanksStep"===se&&(t.classList.remove(this.hideClassName),this.setAriaLabel(le)),t}},{key:"getFeedBackElements",value:function(){var t=this,n=document.createElement("p");n.className="".concat(this.feedbackQuestionClassName," ").concat(this.hideClassName),n.innerHTML=ae;var i=document.createElement("form");i.className="".concat(this.feedbackFormClassName," ").concat(this.hideClassName),i.addEventListener("submit",b,J({},pe));var r=document.createElement("textarea");r.className="".concat(this.feedbackQuestionClassName,"_textarea"),r.ariaLabel=ae;var s=document.createElement("button");return s.className="".concat(this.feedbackQuestionClassName,"_button"),s.innerHTML="<span>".concat(ce,"</span>"),s.ariaLabel=ce,s.addEventListener("click",function(e){return b(e),t.userFeedback=r.value,t.onFeedbackSend()},J(J({},pe),{},{once:!0})),e()&&"displayFeedbackStep"===se&&([n,i].forEach(function(e){return e.classList.remove(t.hideClassName)}),this.setAriaLabel(ae)),i.appendChild(r),i.appendChild(s),{feedbackQuestionElement:n,feedbackFormElement:i}}},{key:"getNotesElement",value:function(){var t=this,n=document.createElement("div");n.className=this.notesClassName,e()&&"displayNoteStep"!==se&&n.classList.add(this.hideClassName);for(var i=10;i>=0;){var r=document.createElement("button");r.className=this.notesButtonsClassName,r.dataset.note=i,r.ariaLabel="".concat(oe," - ").concat(i,"/10"),e()&&r.setAttribute("data-abtasty-actionnable",""),r.innerHTML+="<span>".concat(i,"</span>"),r.addEventListener("click",function(e){b(e),t.onClickNote(e)},J({},pe)),n.insertAdjacentElement("afterbegin",r),5===i&&r.insertAdjacentHTML("afterend","<br>"),i-=1}return he&&(n.insertAdjacentHTML("afterbegin","<legend>".concat(ue,"</legend>")),n.insertAdjacentHTML("beforeend","<legend>".concat(de,"</legend>"))),n}},{key:"getQuestionElement",value:function(){var t=document.createElement("p");return t.className=this.questionClassName,t.innerHTML=oe,e()&&"displayNoteStep"!==se&&t.classList.add(this.hideClassName),"displayNoteStep"===se&&this.setAriaLabel(oe),t}},{key:"getContainer",value:function(){var e=document.createElement("div");return e.className="".concat(this.baseClassName," ").concat(this.className),e}},{key:"getNPSElement",value:function(){var e=this;return this.npsContainer.appendChild(this.questionElement),this.npsContainer.appendChild(this.notesContainer),te&&Object.values(this.feedbackElements).forEach(function(t){e.npsContainer.appendChild(t)}),ne&&this.npsContainer.appendChild(this.thankYouElement),this.npsContainer}},{key:"setStyles",value:function(){var e=this.parentContainer,t=e.styleElement,n=e.widgetContainerId,i="";if(me)i=["#".concat(n," .").concat(this.className," .").concat(this.hideClassName," {"),"display: none !important;","}"].join("");else{var r=DATA,s=r.containerPadding,o=r.legendTextColor,a=r.legendFontName,c=r.legendFontStyle,l=r.legendFontSize,h=r.buttonsFontSize;this.parentContainer.loadFont(a,c);var u=/.+\/([^.]+)\.(otf|ttf)$/,d=a&&"inherit"!==a?"font-family:".concat(a,"_").concat(c.match(u)?c.match(u)[1]:"",";"):c||"",m=s instanceof Array&&1===s.length&&s[0],g="#".concat(n," .").concat(this.className);i=["".concat(g," .").concat(this.hideClassName," {"),"display: none !important;","}","".concat(g,","),"".concat(g," * {"),"all: unset;","box-sizing: border-box;","font-size: 10px;","line-height: normal;","font-family: sans-serif;","}","".concat(g," > * {"),"display: block;","width: 100%;","}","".concat(g," .").concat(this.notesClassName," {"),"position: relative;","display: inline-block;","width: auto;","}","".concat(g," p {"),"margin-bottom: 15px;","font-size: 1.4em;","white-space: pre-line;","}","".concat(g," button {"),"vertical-align: middle;","cursor: pointer;","text-align: center;","}","".concat(g," button span {"),"font-size: 1em;","pointer-events: none;","}","".concat(g," .").concat(this.notesClassName," button {"),"margin: 0 5px;","width: ".concat(1.75*h,"px;"),"height: ".concat(1.75*h,"px;"),"}","".concat(g," .").concat(this.notesClassName," button * {"),"display: inline-block !important;","pointer-events: none;","}","".concat(g," .").concat(this.feedbackFormClassName," span {"),"display: block;","padding: 6px 24px;","}",he?["".concat(g," legend {"),"position: absolute;","text-decoration: none;","border: none;","color: ".concat(o,";"),"fill: ".concat(o,";"),"-webkit-text-fill-color: ".concat(o,";"),"font-size: ".concat(l,"px;"),d,"}","".concat(g," legend:nth-of-type(2) {"),"left: auto;","right: 0;","}"].join(""):"","".concat(g," textarea {"),"display: block;","width: 100%;","min-width: 310px;","min-height: 60px;","font-size: 1.4em;","border: 1px solid grey;","border-radius: 4px;","resize: vertical;","margin-bottom: 10px;","text-align: left;","padding: 5px;","}","".concat(g," .").concat(this.thankYouClassName," {"),"margin-bottom: 0;","}","@media screen and (min-width: 580px) {","".concat(g," {"),"min-width: 560px;","}",he?["".concat(g," .").concat(this.notesClassName," {"),"padding-top: ".concat(1.5*l,"px"),"}","".concat(g," legend {"),"top: 0;","left: 0;","display: inline-block;","width: auto;","}"].join(""):"","".concat(g," br {"),"display: none","}","}","@media screen and (max-width: 579px) {","".concat(g," {"),"min-width: ".concat(240+(m.left+m.right/2),"px;"),"}","".concat(g," .").concat(this.notesClassName," button {"),"margin-bottom: 5px;","}","".concat(g," br {"),"display: block","}",he?["".concat(g," .").concat(this.notesClassName," {"),"padding-bottom: 35px;","}","".concat(g," legend {"),"bottom: 0;","left: 50%;","transform: translateX(-50%)","}","".concat(g," legend:nth-of-type(1) {"),"bottom: 15px;","}","".concat(g," legend:nth-of-type(2) {"),"left: 50%;","right: unset;","}","".concat(g," legend:nth-of-type(1)::before {"),'content: "0: ";',"}","".concat(g," legend:nth-of-type(2)::before{"),'content: "10: ";',"}"].join(""):"","".concat(g," textarea {"),"min-width: auto;","}","}"].join("")}return t.insertAdjacentText("afterbegin",i),t}}],n&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Z(i.key),i)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();function ve(e){return ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ve(e)}function ye(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ye=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function h(e,t,n,i){var s=t&&t.prototype instanceof f?t:f,o=Object.create(s.prototype),a=new A(i||[]);return r(o,"_invoke",{value:$(e,n,a)}),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var d="suspendedStart",m="executing",g="completed",p={};function f(){}function v(){}function y(){}var b={};l(b,o,function(){return this});var w=Object.getPrototypeOf,C=w&&w(w(L([])));C&&C!==n&&i.call(C,o)&&(b=C);var E=y.prototype=f.prototype=Object.create(b);function S(e){["next","throw","return"].forEach(function(t){l(e,t,function(e){return this._invoke(t,e)})})}function T(e,t){function n(r,s,o,a){var c=u(e[r],e,s);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==ve(h)&&i.call(h,"__await")?t.resolve(h.__await).then(function(e){n("next",e,o,a)},function(e){n("throw",e,o,a)}):t.resolve(h).then(function(e){l.value=e,o(l)},function(e){return n("throw",e,o,a)})}a(c.arg)}var s;r(this,"_invoke",{value:function(e,i){function r(){return new t(function(t,r){n(e,i,t,r)})}return s=s?s.then(r,r):r()}})}function $(t,n,i){var r=d;return function(s,o){if(r===m)throw Error("Generator is already running");if(r===g){if("throw"===s)throw o;return{value:e,done:!0}}for(i.method=s,i.arg=o;;){var a=i.delegate;if(a){var c=N(a,i);if(c){if(c===p)continue;return c}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(r===d)throw r=g,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r=m;var l=u(t,n,i);if("normal"===l.type){if(r=i.done?g:"suspendedYield",l.arg===p)continue;return{value:l.arg,done:i.done}}"throw"===l.type&&(r=g,i.method="throw",i.arg=l.arg)}}}function N(t,n){var i=n.method,r=t.iterator[i];if(r===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),p;var s=u(r,t.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,p;var o=s.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[o];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,s=function n(){for(;++r<t.length;)if(i.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return s.next=s}}throw new TypeError(ve(t)+" is not iterable")}return v.prototype=y,r(E,"constructor",{value:y,configurable:!0}),r(y,"constructor",{value:v,configurable:!0}),v.displayName=l(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,l(e,c,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},S(T.prototype),l(T.prototype,a,function(){return this}),t.AsyncIterator=T,t.async=function(e,n,i,r,s){void 0===s&&(s=Promise);var o=new T(h(e,n,i,r),s);return t.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},S(E),l(E,c,"Generator"),l(E,o,function(){return this}),l(E,"toString",function(){return"[object Generator]"}),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=L,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(x),!t)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(i,r){return a.type="throw",a.arg=t,n.next=i,r&&(n.method="next",n.arg=e),!!r}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=i.call(o,"catchLoc"),l=i.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var s=r;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=e,o.arg=t,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;x(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:L(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),p}},t}function be(e,t,n,i,r,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(i,r)}function we(){var e;return e=ye().mark(function e(){var t,n,i;return ye().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return h("Widget launch"),t=U(),n=t.domElement.querySelector(".".concat(t.contentClassName)),i=new fe({parentContainer:t}),t.children=i,i.insertIn(n,"beforeend"),t.init(!0).then(function(e){return e.response&&t.show()}),e.abrupt("return",{parentContainer:t,NPS:i});case 9:case"end":return e.stop()}},e)}),we=function(){var t=this,n=arguments;return new Promise(function(i,r){var s=e.apply(t,n);function o(e){be(s,i,r,o,a,"next",e)}function a(e){be(s,i,r,o,a,"throw",e)}o(void 0)})},we.apply(this,arguments)}!function(){we.apply(this,arguments)}()}(); |
{ | ||
"name": "@abtasty/nps", | ||
"description": "Allow you to add a custom NPS on your website", | ||
"version": "1.5.25-0", | ||
"version": "1.5.25-1", | ||
"form": "dist/form.js", | ||
@@ -6,0 +6,0 @@ "main": "dist/main.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
986054
3801