@abtasty/csat 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/main.js +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(){"use strict";const t=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor"),e=()=>{const t=!!document.getElementById("ABTastyPreviewBar"),e=location.href.includes("ab_project=preview");return t||e},n=t=>new Function(`try {\n\t\t${t}\n\t} catch (error) {\n\t\treturn null;\n\t}`)(),r=()=>encodeURIComponent(DATA.spNoTrim?window.location.href.replace(window.location.origin,""):`${window.location.pathname}`),i=()=>!t()&&(e()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),o=()=>window.ABTasty&&!0===window.ABTasty.consentReady,s="remove",a="rebuild",c="update",l=()=>{const{type:t}=DATA;return`${PACKAGE.replace("@abtasty/","")}${t?`_${t}`:""}`},h=()=>{const t=l();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`.split("-").join(" ")},u=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,d=n=>{const r=(()=>{if(t()||e())return!1;const n=ABTasty.getTestsOnPage()[TEST_ID];return!!n&&Object.keys(n.targetings.qaParameters).length>0})(),i=document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(r||i){const t=h();window.console.log(`%c${t} - ${r?"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;")}},m=t=>{const e={promise:null,resolve:null,reject:null,name:t};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e},p=(t,e)=>{const n=()=>{try{return document.querySelector(t)}catch(t){return null}};let r=n();const i=[document.querySelector("body")||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],o=()=>a.disconnect(),s=()=>a.observe(...i),a=new MutationObserver(()=>(r=n(),r&&!o()&&e(r)));return r?setTimeout(()=>e(r),0):s(),{selector:t,clear:o,observe:s}};function g(t,e){return e(t)||!t.parentElement?t:g(t.parentElement,e)}const f=(t,e)=>[...document.querySelectorAll(e)].some(n=>n===t||!!t.closest(e)),v=(t,e)=>{let n=Date.now();return()=>{n+e-Date.now()<=0&&(t(),n=Date.now())}};class y{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=null,this.mouseOverEvent=this.mouseOverHandler(),this.scrollEvent=this.scrollEventHandler(),this.onTransitionEnd=this.transitionOverHandler()}transitionOverHandler(){const t=["transitionend",this.checkElements.bind(this),!0];return this.getEvents(t)}intersectionHandler(t){t.forEach(t=>{t.isIntersecting?(this.existingTargets.forEach(e=>{e.element.isSameNode(t.target)&&(this.inViewportTargets.push(e),this.mouseOverEvent.start(),this.scrollEvent.start(),this.onTransitionEnd.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(e=>!e.element.isSameNode(t.target)||(this.mouseOverEvent.clear(),this.scrollEvent.clear(),this.onTransitionEnd.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){this.mutationObserver??=new MutationObserver(this.checkElements.bind(this));const{clear:t}=p("body",e=>{t(),this.mutationObserver.observe(e,{attributes:!0,childList:!0,subtree:!0})});return this.mutationObserver}onMouseOver({target:t,path:e}){const n=this.inViewportTargets.find(({element:n,selector:r})=>{if(n.isSameNode(t))return!0;const i=[...t.querySelectorAll(r)];if(i.length&&i.includes(n))return!0;if(e.includes(n))return!0;const o=[...t.parentElement.children],s=o.findIndex(e=>e.isSameNode(t)),a=o.filter((t,e)=>e>s);if(a.length){if(a.includes(n))return!0;if(a.some(t=>[...t.querySelectorAll(r)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:t,element:e,uniqueId:r}=n,i=this.targets.find(e=>e.selector===t&&e.uniqueId===r);i&&i.resolve(e),this.clear(t,r)}}getEvents(t){return{start:()=>document.addEventListener(...t),clear:()=>document.removeEventListener(...t)}}mouseOverHandler(){const t=["ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?"touchmove":"mouseover",t=>{const e=t.composedPath(),{target:n}=t;setTimeout(()=>this.onMouseOver({target:n,path:e}),50)},!0];return this.getEvents(t)}scrollEventHandler(){const t=["scroll",v(this.checkElements.bind(this),50),{passive:!0}];return this.getEvents(t)}isElementVisible(t){return this.isElementTopmost(t)&&this.isElementOpaque(t)}isElementOpaque(t){return"HTML"===g(t,t=>"0"===window.getComputedStyle(t).opacity).nodeName}isElementTopmost(t){const e=t.getBoundingClientRect(),n=[[e.left,e.top],[e.right,e.top],[e.left,e.bottom],[e.right,e.bottom],[e.left+e.width/2,e.top],[e.left+e.width/2,e.bottom],[e.left,e.height/2],[e.right,e.height/2],[e.left+e.left/2,e.height/2]];let r=!1,i=0;for(;!r&&i<n.length;){const e=document.elementFromPoint(...n[i]);r=t===e||t.contains(e),i+=1}return r}checkElements(){this.targets.forEach(({selector:t,uniqueId:e})=>{const n=document.querySelector(t);n&&!this.existingTargets.find(n=>n.element.matches(t)&&n.uniqueId===e)&&(this.existingTargets.push({element:n,selector:t,uniqueId:e}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:t,element:e})=>!!document.querySelector(t)||(e&&this.visibilityObserver.unobserve(e),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:t,element:e,uniqueId:n})=>{if(e.matches(t)&&this.isElementVisible(e)){const r=this.targets.find(e=>e.selector===t&&e.uniqueId===n);return r&&r.resolve(e),this.clear(t,n),!1}return!0})}watch(t,e,n){this.targets.push({selector:t,resolve:e,uniqueId:n}),this.startMutationObserver(),this.checkElements()}clear(t,e){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(n=>n.filter(({selector:n,uniqueId:r})=>n!==t&&r!==e));const n=document.querySelector(t);n&&this.visibilityObserver.unobserve(n),0===this.targets.length&&this.mutationObserver?.disconnect(),0===this.inViewportTargets.length&&(this.mouseOverEvent.clear(),this.scrollEvent.clear(),this.onTransitionEnd.clear())}}class w{constructor({triggerEvent:t,triggerSelector:e,triggerDelay:n,triggerTarget:r}){this.event=t,this.selector=e&&e.length?e:"body",this.target=r,this.delay=1e3*n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.promises=[],this.visibilityObservers=[],this.socialProofStore={}}async onElementVisible({promise:t,resolve:e}){const n=m(`${this.event}DomReady`);this.promises.push(n);const r=await this.onPageLoad(n),i=new y;if(this.visibilityObservers.push(i),r){const t=u();i.watch(this.selector,e,t)}return t}onPageLoad({promise:t,resolve:e}){const n=()=>"complete"===document.readyState;if(!n()){const r=["readystatechange",()=>n()&&e(!0),{passive:!0}];return this.eventsListeners.push([document,...r]),document.addEventListener(...r),t}return e(!0),t}onClick({promise:t,resolve:e}){const n=document.createElement("style");n.type="text/css",n.id=`Click_${u()}`,n.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(n),this.elementsSelectors.push(`#${n.id}`);const r=["click",({isTrusted:t,target:n})=>{const r=n.isEqualNode(this.target)||f(n,this.selector);return t&&r&&e(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...r]),document.addEventListener(...r),t}onHover({promise:t,resolve:e}){const n=["mouseenter",({isTrusted:t,target:n})=>{const r=this.target?n.isEqualNode(this.target):f(n,this.selector);return t&&r&&e(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document.documentElement,...n]),document.documentElement.addEventListener(...n),t}onExitIntent({promise:t,resolve:e}){const n=["mouseleave",({isTrusted:t,clientY:n})=>{t&&n<=0&&e(!0)},{passive:!0}],{clear:r}=p("html",t=>{r(),this.eventsListeners.push([t,...n]),t.addEventListener(...n)});return t}onReengage({promise:t,resolve:e}){const n=this.delay;let r=n;const i=[({isTrusted:t})=>{t&&(r=n)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(t=>{this.eventsListeners.push([document,t,...i]),document.addEventListener(t,...i)});const o=setInterval(()=>{r<=0?e(!0):r-=100},100);return this.intervals.push(o),t}onCustomTrigger({promise:t,resolve:e}){const{triggerEventCustomScript:n}=DATA;return new Function(`return new Promise(async resolve => {${n}})`)().then(t=>t&&e(!0)),t}onScrollUp({promise:t,resolve:e}){let n=0;const r=["scroll",({isTrusted:t})=>{t&&(window.pageYOffset<n?e(!0):n=window.pageYOffset)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...r]),document.addEventListener(...r),t}onScrollPercentReached({promise:t,resolve:e}){const{triggerEventScrollPercent:n}=DATA,r=["scroll",({isTrusted:t})=>{if(!t)return;const r=(()=>{const{documentElement:t,body:e}=document,n=t.scrollTop||e.scrollTop,r=t.scrollHeight||e.scrollHeight;return Math.trunc(n/(r-t.clientHeight)*100,10)})();n<r&&e(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...r]),document.addEventListener(...r),t}checkSocialProofConditions(t,e,n,r){const i=(()=>{let t;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?t=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?t=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(t=window.ABTasty.accountSettings.identifier),t):t})(),{viewInterval:o,spNoTrim:s}=DATA;if(this.socialProofStore.hasOwnProperty(t))n(this.socialProofStore[t])?r(`${this.socialProofStore[t][o]}`):r(!1);else if(t&&i){const a=e=>(this.socialProofStore[t]=e,r(!!n(e)&&`${e[o]}`));fetch(`https://api-social-proof.abtasty.com/clients/${i}/metrics/${e}?key=${t}${s?"&noTrim=true":""}`).then(t=>t.ok&&t.json()).then(a).catch(()=>d("Failed to fetch datas from server."))}else r(!1)}getSocialProofDatas({promise:t,resolve:e},i,o=!1){const{productKey:s,keyType:a}=(()=>{const{socialProofContentType:t,productKeyProvider:e,pathToProductKey:i,customJSProductKey:o,productSKU:s}=DATA;if(2===t)return{productKey:r(),keyType:"url"};{let a=null,c="sku";switch(e){case"ABTastyProductKey":a=window.ABTastyProductKey;break;case"pathToProductKey":a=n(`return ${i};`);break;case"customJSProductKey":a=n(o);break;case"productSKU":a=s}return a||3!==t||(a=r(),c="url"),{productKey:a,keyType:c}}})(),{viewInterval:c,triggerSocialProofMinVisitors:l,triggerSocialProofMinPurchases:h,triggerSocialProofMinPageViews:u}=DATA,m={pv:u,i:h,"v-pv":l}[i];return[typeof c,typeof m].includes("undefined")&&e(!1),o&&!s&&(d("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"),e(!1)),this.checkSocialProofConditions(s,"v-pv"===i&&"sku"===a?"v-i":i,t=>{const e=void 0!==t[c]&&t[c]>=m;return e||d(`Widget will not be shown, Social Proof API returned ${t[c]} while ${m} are required`),e},e),t}onConsent({promise:t,resolve:e}){if(!o()){const n=["abtasty_consentValid",()=>e(!0)];return this.eventsListeners.push(n),window.addEventListener(...n),t}return e(!0),t}onTrackingSent({promise:t,resolve:e}){const{triggerEventTrackingSent:n}=DATA;let r=localStorage.getItem("ABTastyData");const i=()=>JSON.parse(r).ActionTracking.find(({name:t})=>t===n),o=["storage",()=>{r=localStorage.getItem("ABTastyData"),i()&&e(!0)},{passive:!0,capture:!0}];return r&&i()?e(!0):(()=>{this.eventsListeners.push([window,...o]),window.addEventListener(...o)})(),t}onMinPagesViewed({promise:t,resolve:e}){const{triggerEventMinPagesViewed:n}=DATA;let r=localStorage.getItem("ABTastyData");const i=()=>n<=(r?JSON.parse(r).VisitedPages.length:0),o=["storage",()=>{r=localStorage.getItem("ABTastyData"),i()&&e(!0)},{passive:!0,capture:!0}];return r&&i()?e(!0):(()=>{this.eventsListeners.push([window,...o]),window.addEventListener(...o)})(),t}onRageClick({promise:t,resolve:e}){const{triggerEventRageClickQuantity:n,triggerEventRageClickDelay:r}=DATA;let i=0,o=!1;const s=["click",({isTrusted:t})=>{if(t&&(i+=1,i>=n&&e(!0),!o)){o=!0;const t=setTimeout(()=>{i=0,o=!1},r);this.timeouts.push(t)}},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...s]),document.addEventListener(...s),t}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(t=>{document.querySelector(t)&&document.querySelector(t).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(t=>{const[e,...n]=t;e&&n.length>1&&e.removeEventListener(...n)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(t=>clearInterval(t)),this.intervals=[]),this.visibilityObservers.length){const t=u();this.visibilityObservers.forEach(e=>e.clear(this.selector,t)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(t=>t.resolve(!1)),this.promises=[]),this}async isTriggered(){this.clear();const t=m(this.event);this.promises.push(t);const e={consent:()=>this.onConsent(t),direct:()=>!0,pageLoad:()=>this.onPageLoad(t),click:()=>this.onClick(t),exitIntent:()=>this.onExitIntent(t),reengage:()=>this.onReengage(t),elementVisible:()=>this.onElementVisible(t),script:()=>this.onCustomTrigger(t),hover:()=>this.onHover(t),scrollUp:()=>this.onScrollUp(t),scrollPercent:()=>this.onScrollPercentReached(t),rageClick:()=>this.onRageClick(t),minPagesViewed:()=>this.onMinPagesViewed(t),trackingSent:()=>this.onTrackingSent(t),socialProofPurchases:()=>this.getSocialProofDatas(t,"i",!0),socialProofPageViews:()=>this.getSocialProofDatas(t,"pv"),socialProofVisitors:()=>this.getSocialProofDatas(t,"v-pv")},n=!Object.prototype.hasOwnProperty.call(e,this.event)||await e[this.event]();return n&&this.clear(),"reengage"!==this.event&&this.delay?n&&await(async()=>{const t=m(`${this.event}Delay`);this.promises.push(t);const e=setTimeout(()=>{t.resolve(!0),this.clear()},this.delay);return this.timeouts.push(e),t.promise})():n}}const b="display",E="closing",T="validation",S="ABTastyWidgets",C=`${S}Temporary`;class ${constructor({displayRecurrence:t,closingRecurrence:e,validationRecurrence:n},r){this.displayRecurrence=parseFloat(t),this.closingRecurrence=parseFloat(e),this.validationRecurrence=parseFloat(n),this.onSetCallback=r,this.widgetName=l(),this.uniqueId=u(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:t}){const e=localStorage.getItem(C),n=sessionStorage.getItem(S);"ABTastyData"===t&&!e&&n&&localStorage.setItem(C,n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(t){try{const e=t.getItem(S);return JSON.parse(e)}catch(e){return t.removeItem(S),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(t,e){const{[this.recurrenceKey]:n,...r}=e;return Object.entries(r).length?(t.setItem(S,JSON.stringify(r)),r):(t.removeItem(S),!1)}removeSessionRecurrenceStorage(){const t=this.getSessionRecurrenceStorageParsed();return!!t&&this.removeGivenStorage(window.sessionStorage,t)}removeLocalRecurrenceStorage(){const t=this.getLocalRecurrenceStorageParsed();return!!t&&this.removeGivenStorage(window.localStorage,t)}getSessionRecurrence(){const t=this.getSessionRecurrenceStorageParsed();return!!t&&t[this.recurrenceKey]}getLocalRecurrence(){const t=this.getLocalRecurrenceStorageParsed();return!!t&&t[this.recurrenceKey]}getCurrentRecurrence(){if(this.pendingRecurrence)return this.pendingRecurrenceValue;const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();return t||e||{type:!1}}isOver(){const t=localStorage.getItem(C),e=!(!t||!t.includes(this.recurrenceKey))||this.getSessionRecurrence();t&&(sessionStorage.setItem(S,t),localStorage.removeItem(C));const n=this.getLocalRecurrence(),r=(n?parseFloat(n.stamp):0)<(new Date).getTime();return r&&this.removeLocalRecurrenceStorage(),!this.pendingRecurrence&&r&&!this.getLocalRecurrence()&&!e}setRecurrence(t,n){0!==t&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const r=this.getTypeOfStorage(t);if(e()||!r&&"object"!=typeof r)return!1;const{storageString:i,storageMethod:s}=r,a=this.getStamp(t),c={type:n,stamp:a},{type:l}=this.getCurrentRecurrence(),h=async()=>{if(!o()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const t=new w({triggerEvent:"consent"});await t.isTriggered(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();let n;"session"===i?t?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===i&&(e?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const r=n?{[this.recurrenceKey]:c,...n}:{[this.recurrenceKey]:c};s.setItem(S,JSON.stringify(r)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!s)return!1;if(l&&n!==T)if(n===E&&l!==T)h();else{if(n!==b||l===T||l===E)return!1;h()}else h();return a}setDisplayRecurrence(){const t=b;this.setRecurrence(this.displayRecurrence,t)}setClosingRecurrence(){const t=E;this.setRecurrence(this.closingRecurrence,t)}setValidationRecurrence(){const t=T;this.setRecurrence(this.validationRecurrence,t)}getStamp(t){return(new Date).getTime()+864e5*t}getTypeOfStorage(t){return!(isNaN(t)||t<0||0!==t&&!t)&&(t>0?{storageString:"local",storageMethod:window.localStorage}:0===t&&{storageString:"session",storageMethod:window.sessionStorage})}}class A{constructor(t,e,n){this.isWidgetApplied=t,this.callback=e,this.shouldUpdate=n,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(){const t=this.isWidgetApplied()?this.shouldUpdate&&c:a;return t?(this.clearWatcher(),this.callback(t,!0),this.watch(),this):this}onCampaignLaunched({detail:{campaignId:t}}){t===TEST_ID&&(this.callback(a,!1),this.watch())}onTagRollback(){return this.clearWatcher(),this.callback(s,!1),window.addEventListener(...this.onCampaignLaunchedEventParams),this}observerHandler(t){return i()?t.some(t=>["removedNodes","addedNodes"].some(e=>t[e]&&t[e].length))?this.decisionHandler():this:this.callback(s,!1)}watch(){if(t())return this;this.clearWatcher(),window.removeEventListener(...this.onCampaignLaunchedEventParams),document.addEventListener(...this.tagRollbackEventParams);const{clear:e}=p("body",t=>{e(),this.observer.observe(t,{childList:!0,subtree:!0})});return this}clearWatcher(){return document.removeEventListener(...this.tagRollbackEventParams),this.observer.disconnect(),this}}const x=/.+\/([^.]+)\.(otf|ttf)$/,k=["socialProofPurchases","socialProofPageViews","socialProofVisitors"];class L{constructor(e,n){this.children=void 0,this.uniqueId=`${u()}${n?`_${n}`:""}`,this.widgetName=l(),this.prettyName=h(),this.recurrenceParams=(()=>{const{displayRecurrence:e,closingRecurrence:n,validationRecurrence:r}=DATA,i=!e&&!n&&!r;if(t()||i)return!1;const o={everytime:()=>-1,session:()=>0,once:()=>395,day:t=>DATA[`${t}_day`],week:t=>7*DATA[`${t}_week`],month:t=>30.5*DATA[`${t}_month`]},s={};return e&&(s.displayRecurrence=o[e]("displayRecurrence")),n&&(s.closingRecurrence=o[n]("closingRecurrence")),r&&(s.validationRecurrence=o[r]("validationRecurrence")),s})(),this.triggerParams=(e=>{let{triggerEvent:n}=DATA;const{triggerEventClick:r,triggerEventHover:i,triggerEventReengageDelay:o,socialProofContentType:s,triggerEventElementVisible:a,triggerEventDelay:c}=DATA;if(t()||!n&&!s)return!1;const l={click:()=>r,hover:()=>i,elementVisible:()=>a},h=Object.prototype.hasOwnProperty.call(l,n)?l[n]():"body",u="reengage"===n?o:c;return s&&(n=[,"socialProofPurchases","socialProofPageViews","socialProofVisitors"][s]),{triggerEvent:n,triggerSelector:h,triggerDelay:u,triggerTarget:e}})(e),this.recurrence=!!this.recurrenceParams&&new $(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new w(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&k.includes(this.triggerParams.triggerEvent),this.pageWatcher=new A(this.isWidgetApplied.bind(this),this.onPageChange.bind(this),this.shouldUpdate),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:t,triggerEvent:e}=DATA;return!e||!["click","hover","scrollUp","script"].includes(e)||t})(),this.basicClassName=`ab_widget_container_${this.widgetName}`,this.widgetContainerId=`${this.basicClassName}_${this.uniqueId}`,this.contentClassName=`${this.basicClassName}_content`,this.overlayClassName=`${this.basicClassName}_overlay`,this.closeButtonClassName=`${this.basicClassName}_close_button`,this.hideClassName=`ab_hide_${this.uniqueId}`,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.elementsWaiters=[]}clearGivenClearables(){this.eventsListeners.forEach(t=>document.removeEventListener(...t)),this.eventsListeners=[],this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[],this.intervals.forEach(t=>clearInterval(t)),this.intervals=[],this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]}isWidgetApplied(){return this.domElement&&this.domElement.isConnected}removeOldDomElement(){const t=document.getElementById(this.widgetContainerId);return t&&t.remove(),this}async insert(){if(this.isWidgetApplied())return!1;document.head.appendChild(this.styleElement);const t=["free"];return"drawer"===DATA.layout&&DATA.customTarget&&t.push("drawer"),new Promise(e=>{const{elementReferrer:n="body",referrerInsertType:r="beforeend"}=t.includes(DATA.layout)?DATA:{},i=p(n,t=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t.selector!==n),this.removeOldDomElement(),e(t.insertAdjacentElement(r,this.domElement))});this.elementsWaiters.push(i)}).then(()=>this)}remove(){return this.trigger&&this.trigger.clear(),this.pageWatcher.clearWatcher(),[this.domElement,this.styleElement].forEach(t=>t&&t.isConnected&&t.remove()),this.hasOncePerPageTrigger?this.pageWatcher.watch():t()||this.init().then(({response:t})=>t?this.show():this),this}show(){return t()||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}hide(e=!0){return!t()&&this.hasBeenShown&&e&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),e&&(this.pageWatcher.clearWatcher(),this.closedByUser=!0),this.domElement.classList.add(this.hideClassName),this}async init(e){const n=t(),r=i(),o=this.trigger&&this.trigger.promises.length,s=!this.recurrence||this.recurrence.isOver();if(!n&&!r||o||!s)return{container:this,response:!1};this.pageWatcher.watch();const a=n||!this.trigger||this.trigger&&await this.trigger.isTriggered(),c={container:this,response:a};return a?(await this.insert(),this.addCloseEvent(),n||e||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(a),c):c}onPageChange(t,e){const n=()=>this.init().then(({response:t})=>{t?this.show():this.hide(!1)});e||(this.hasBeenShown=!1,this.trigger&&this.trigger.clear());const r=this.isWidgetApplied(),i={[s]:()=>r?this.remove():this.pageWatcher.watch(),[a]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():r||this.insert().then(t=>t.show()).catch(this.pageWatcher.watch):n()},[c]:n};"function"==typeof i[t]&&i[t]()}addCloseEvent(...e){const{closeButton:n,overlay:r,overlayClickable:i,layout:o,animationDuration:s=1e3}=DATA,a=[];if(void 0!==r&&!0!==r||!0!==i||"popin"!==o||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=>{(e=>{t()||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())})(e),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*s)},{once:!0,capture:!0}];return e.push(...c),e.forEach(e=>{t()&&(e.dataset.abtastyActionnable="true"),e.removeEventListener(...l),e.addEventListener(...l)}),this}getDom(){const{closeButton:t,layout:e,overlay:n=!0}=DATA,r=document.createElement("div");return r.className=`${this.basicClassName} ${this.hideClassName}`,r.id=this.widgetContainerId,["popin","banner"].includes(e)&&(r.role="dialog"),r.innerHTML=`\n\t\t\t${"popin"===e&&!0===n?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${t?`<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(t,e){if(!t||"inherit"===t||!/otf|ttf/g.test(e))return;const n=document.createElement("style"),r=e.match(x)?e.match(x)[1]:"";n.innerHTML=`@font-face { font-family: '${t}_${r}'; src: url('${e}'); font-display: swap; }`,document.head.appendChild(n)}getStyleTag(e="",n=DATA){const{noStyles:r,layout:i}=n,{backgroundColor:o,isBackgroundImage:s,backgroundImage:a,backgroundSize:c,backgroundPosition:l,backgroundRepeat:h,borderColor:u,borderRadius:d,borderWidth:m,textColor:p,textAlign:g,fontName:f,fontStyle:v,fontSize:y,isTitle:w,titleTextAlign:b,titleTextColor:E,titleFontName:T,titleFontStyle:S,titleFontSize:C,overlay:$,overlayColor:A,dropShadow:k,dropShadowColor:L,dropShadowBlur:N,containerMargin:P,containerPadding:j,closeButton:_,closeButtonPosition:I,closeButtonSize:D,closeButtonBorderRadius:O,closeButtonBorderWidth:R,closeButtonBorderColor:B,closeButtonColor:q,closeButtonBackgroundColor:V,buttonsAlign:W,buttonsBorderWidth:F,buttonsBorderColor:M,buttonsBorderRadius:H,buttonsBackgroundColor:U,buttonsTextColor:G,buttonsFontName:Q,buttonsFontStyle:z,buttonsFontSize:K,secondLink:Y,secondLinkBorderWidth:J,secondLinkBorderColor:X,secondLinkBorderRadius:Z,secondLinkBackgroundColor:tt,secondLinkTextColor:et,secondLinkFontName:nt,secondLinkFontStyle:rt,secondLinkFontSize:it,animation:ot,animationDuration:st,animationBehaviour:at,animationSlideDirection:ct}=r?{}:n,lt=document.createElement("style");lt.type="text/css",t()&<.setAttribute("abtasty-script-added","true"),this.loadFont(f,v),this.loadFont(T,S),this.loadFont(Q,z),this.loadFont(nt,rt);const ht=`background: ${["string"==typeof o?o:"rgba(255, 255, 255, 1)",s&&"string"==typeof a&&a.length?`url(${a})`:"",s&&"string"==typeof l&&"100% 100%"!==c?l:"0 0",s&&"string"==typeof c?`/ ${c}`:"/ auto",s&&h&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,ut="number"==typeof m&&m>0,dt=`border: ${[ut?`${m}px`:"unset",ut?"solid":"",ut&&"string"==typeof u&&u.length?u:""].join(" ").trim()};`,mt=void 0!==d?`border-radius: ${d}px;`:"",pt=void 0!==p?`color: ${p}; fill: ${p}; -webkit-text-fill-color: ${p};`:"",gt=void 0!==g?`text-align: ${g};`:"",ft=f&&"inherit"!==f?`font-family:${f}_${v.match(x)?v.match(x)[1]:""};`:v||"",vt=y?`font-size: ${y}px;`:"",yt=void 0!==k&&k?`box-shadow: 0 5px ${N}px 0 ${L};`:"",wt=P instanceof Array&&1===P.length&&P[0],bt=wt?`margin: ${wt.top}px ${wt.right}px ${wt.bottom}px ${wt.left}px;`:"",Et=wt?`margin: calc(${wt.top}px * 0.5) calc(${wt.right}px * 0.5) calc(${wt.bottom}px * 0.5) calc(${wt.left}px * 0.5);`:"",Tt=j instanceof Array&&1===j.length&&j[0],St=Tt?`padding: ${Tt.top}px ${Tt.right}px ${Tt.bottom}px ${Tt.left}px;`:"",Ct=Tt?`padding: calc(${Tt.top}px * 0.5) calc(${Tt.right}px * 0.5) calc(${Tt.bottom}px * 0.5) calc(${Tt.left}px * 0.5);`:"",$t=void 0!==F&&F?`border-width: ${F}px; border-style: solid;`:"",At=[M,F].every(t=>void 0!==t)&&F?`border-color: ${M};`:"",xt=void 0!==H?`border-radius: ${H}px;`:"",kt=void 0!==U?`background-color: ${U};`:"",Lt=void 0!==G?`color: ${G}; fill: ${G}; -webkit-text-fill-color: ${G};`:"",Nt=Q&&"inherit"!==Q?`font-family:${Q}_${z.match(x)?z.match(x)[1]:""};`:z||"",Pt=K?`font-size: ${K}px;`:"",jt="number"==typeof J?`border-width: ${J}px; border-style: solid;`:"",_t=[X,J].every(t=>void 0!==t)&&J?`border-color: ${X};`:"",It=void 0!==Z?`border-radius: ${Z}px;`:"",Dt=void 0!==tt?`background-color: ${tt};`:"",Ot=void 0!==et?`color: ${et}; fill: ${et}; -webkit-text-fill-color: ${et};`:"",Rt=nt&&"inherit"!==nt?`font-family:${nt}_${rt.match(x)?rt.match(x)[1]:""};`:rt||"",Bt=it?`font-size: ${it}px;`:"",qt="popin"!==i||void 0!==$&&!0!==$?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==A?A:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),Vt="number"==typeof D?D:16,Wt=Vt/2,Ft=r||void 0!==_&&_?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===I?`bottom: calc(100% + ${Wt}px)`:`top: ${Wt}px`)+";",`right: ${Wt}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof O?`border-radius: ${O}px;`:"","number"==typeof R&&R>0?`border: ${R}px solid ${void 0!==B?B:"rgba(57, 57, 57, 1)"};`:"","string"==typeof V?`background-color: ${V};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${Vt}px;`,`height: ${Vt}px;`,"string"==typeof q?`fill: ${q};`:"","}"].join(""):"",Mt=w&&"string"==typeof E?[`#${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: ${E}; fill: ${E}; -webkit-text-fill-color: ${E};`,void 0!==b?`text-align: ${b};`:"",T&&"inherit"!==T?`font-family:${T}_${S.match(x)?S.match(x)[1]:""};`:S||"",C?`font-size: ${C}px;`:"","}"].join(""):"";let Ht="";if("string"==typeof ot){const e=(st/1e3).toFixed(2),n=["top","bottom"].includes(ct),r=Number(n),i=[(["top","left"].includes(ct)?"-":"")+"100vmax",this.translateValues?this.translateValues[r]:"0"];n&&i.reverse(),Ht={none:[`.${this.hideClassName} {`,"opacity: 0 !important;","}"],fade:[`.${this.hideClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} {`,`transition: opacity ${e}s ${at};`,"}"],slide:[`.${this.hideClassName} .${this.overlayClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,`transition: opacity ${e}s ${at};`,"}",`.${this.hideClassName} .${this.contentClassName} {`,`transform: translate(${i.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${e}s ${at};`,"}"]}[t()&&!ABTASTY_S.WIDGETS.animationChanged?"none":ot].join("")}const Ut=[`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,`margin-${"fill"===W?"top":"left"}: 8px;`,jt,_t,It,Dt,Ot,Rt,Bt,"}",`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,Ot,Rt,Bt,"}"];return lt.textContent=[`.${this.hideClassName} {`,"pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,ht,mt,dt,pt,gt,yt,bt,ft,vt,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,pt,gt,ft,vt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",St,ft,vt,"}",`#${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;",$t,At,xt,kt,Lt,Nt,Pt,"}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a *, `,`#${this.widgetContainerId} .${this.contentClassName} button:not(class*="close_button") * {`,Lt,Nt,Pt,"}",...Y?Ut:[],"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,Et,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,Ct,"}","}",qt,Ft,Mt,Ht,`${e}`].join(""),lt}}const N=["top: 0;","top: 50%;","bottom: 0;"],P=["left: 0;","left: 50%;","right: 0;"],j=t=>1===t?"-50%":0,_=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:t,y:e}]}=DATA,n=`translate(${j(e)}, ${j(t)});`;return`${N[t]}${P[e]}transform: ${n}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},I=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,D=()=>{if(I())return"width: auto; height: auto; min-width: fit-content;";const{popinPercentWidth:t,popinPixelsWidth:e,widthUnit:n,autoHeight:r,popinPercentHeight:i,popinPixelsHeight:o,heightUnit:s}=DATA;return`width: ${"px"===n?e:t}${n};height: ${r?"auto":`${"px"===s?o:i}${s}`};`};class O extends L{constructor(){super(),this.translateValues=Object.values(DATA.popinPosition[0]).map(t=>j(t)),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:t,zindexCustom:e,widthUnit:n}=DATA,r="string"!=typeof DATA.overlay&&DATA.overlay;return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;",`z-index: ${"custom"===t?e:t};`,"background: none;","pointer-events: "+(r?"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;",_(),D(),"pointer-events: all","}",`${I()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${!I()&&["px","em"].includes(n)?["@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join(""):""}`].join("")}}class R extends L{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:t,zindexCustom:e}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;",`${this.position}: 0;`,"left: 0;","width: 100%;","height: auto;",`z-index: ${"custom"===t?e:t};`,"background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class B extends L{constructor(t,e){super(t,e),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 q=()=>{const{layout:t}=DATA;let e;switch(t){case"popin":e=new O;break;case"bannerTop":case"bannerBottom":e=new R;break;case"free":e=new B;break;default:e=new L}return e};function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function W(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */W=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof f?e:f,s=Object.create(o.prototype),a=new L(r||[]);return i(s,"_invoke",{value:$(t,n,a)}),s}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",m="executing",p="completed",g={};function f(){}function v(){}function y(){}var w={};l(w,s,function(){return this});var b=Object.getPrototypeOf,E=b&&b(b(N([])));E&&E!==n&&r.call(E,s)&&(w=E);var T=y.prototype=f.prototype=Object.create(w);function S(t){["next","throw","return"].forEach(function(e){l(t,e,function(t){return this._invoke(e,t)})})}function C(t,e){function n(i,o,s,a){var c=u(t[i],t,o);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==V(h)&&r.call(h,"__await")?e.resolve(h.__await).then(function(t){n("next",t,s,a)},function(t){n("throw",t,s,a)}):e.resolve(h).then(function(t){l.value=t,s(l)},function(t){return n("throw",t,s,a)})}a(c.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e(function(e,i){n(t,r,e,i)})}return o=o?o.then(i,i):i()}})}function $(e,n,r){var i=d;return function(o,s){if(i===m)throw Error("Generator is already running");if(i===p){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var c=A(a,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var l=u(e,n,r);if("normal"===l.type){if(i=r.done?p:"suspendedYield",l.arg===g)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=p,r.method="throw",r.arg=l.arg)}}}function A(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,A(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function N(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(V(e)+" is not iterable")}return v.prototype=y,i(T,"constructor",{value:y,configurable:!0}),i(y,"constructor",{value:v,configurable:!0}),v.displayName=l(y,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,l(t,c,"GeneratorFunction")),t.prototype=Object.create(T),t},e.awrap=function(t){return{__await:t}},S(C.prototype),l(C.prototype,a,function(){return this}),e.AsyncIterator=C,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new C(h(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then(function(t){return t.done?t.value:s.next()})},S(T),l(T,c,"Generator"),l(T,s,function(){return this}),l(T,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=N,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(c&&l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function M(t,e,n,r,i,o,s){try{var a=t[o](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}function H(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(t){M(o,r,i,s,a,"next",t)}function a(t){M(o,r,i,s,a,"throw",t)}s(void 0)})}}function U(t){var e=function(t){if("object"!=V(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=V(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==V(e)?e:e+""}var G={angry:"rgba(234, 78, 45, 1)",sad:"rgba(227, 119, 31, 1)",neutral:"rgba(224, 185, 10, 1)",happy:"rgba(28, 191, 151, 1)",excited:"rgba(85, 174, 218, 1)"},Q=Object.keys(G),z=function(){return e=function e(n){var r=n.parentContainer;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.parentContainer=r,this.baseClassName="csat_container",this.className="".concat(this.baseClassName,"_").concat(r.uniqueId),this.voteClassName="".concat(this.baseClassName,"_vote"),this.questionClassName="".concat(this.baseClassName,"_question"),this.thanksClassName="".concat(this.baseClassName,"_thanks"),this.hideClassName="csat_".concat(r.uniqueId,"_display_none"),this.steps=["vote",!!DATA.askOpenQuestion&&"question",!!DATA.isThankYouMessage&&"thanks","complete"].filter(function(t){return"string"==typeof t}),this.currentStep=t()?DATA.stepPreview:"vote",this.emojiChoice=NaN,this.currentNote=NaN,this.currentFeedback="",this.currentOpenQuestion=DATA.openQuestionPositive,this.emojisList=this.getEmojisList(),this.CSATContainer=document.createElement("div"),this.voteElement=null,this.questionElement=this.getQuestionElement(),this.thanksElement=this.getThanksElement(),this.CSATElement=null,this.styleElement=this.getStyleElement()},n=[{key:"getABtastyEmojis",value:(o=H(W().mark(function t(){var e,n=this;return W().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=function(){var t=H(W().mark(function t(e,r){var i,o,s;return W().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=r.iconUrl,t.next=3,e;case 3:return o=t.sent,t.next=6,n.fetchTastyEmojis(i);case 6:return s=t.sent,t.abrupt("return",[].concat(function(t){if(Array.isArray(t))return F(t)}(a=o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(a)||function(t,e){if(t){if("string"==typeof t)return F(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?F(t,e):void 0}}(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[s]));case 8:case"end":return t.stop()}var a},t)}));return function(e,n){return t.apply(this,arguments)}}(),t.next=3,this.emojisList.reduce(e,[]);case 3:window.abtastyEmojis=t.sent,this.emojisList.forEach(function(t,e){t.iconUrl=window.abtastyEmojis[e]});case 5:case"end":return t.stop()}},t,this)})),function(){return o.apply(this,arguments)})},{key:"insertIn",value:(i=H(W().mark(function t(e,n){var r;return W().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("abtasty"!==DATA.emojisType||null!==(r=window.abtastyEmojis)&&void 0!==r&&r.length){t.next=4;break}return t.next=4,this.getABtastyEmojis();case 4:return document.head.insertAdjacentElement("beforeend",this.styleElement),this.CSATElement=this.getCSATElement(),e.insertAdjacentElement(n,this.CSATElement),t.abrupt("return",this.showCurrentStep());case 8:case"end":return t.stop()}},t,this)})),function(t,e){return i.apply(this,arguments)})},{key:"setQuestion",value:function(){var t=DATA,e=t.openQuestionPositive,n=t.openQuestionNeutral,r=t.openQuestionNegative,i=[r,r,n,e,e][this.emojiChoice],o=this.questionElement.querySelector("textarea");return this.currentOpenQuestion=i,o.ariaLabel=i,o.focus(),this.questionElement.querySelector("p").innerHTML=i||e,this}},{key:"getQuestionElement",value:function(){var e=this,n=DATA.openQuestionPositive,r=document.createElement("div");r.className=this.questionClassName,r.innerHTML="<p>".concat(n,'</p>\n\t\t<textarea aria-label="').concat(n,'"></textarea>\n\t\t<button>').concat(DATA.sendButtonText,"</button>");var i=r.querySelector("button");return t()&&(i.dataset.abtastyActionnable="true"),i.addEventListener("click",function(){e.currentFeedback=r.querySelector("textarea").value,e.currentStep=e.steps[e.steps.indexOf(e.currentStep)+1],e.showCurrentStep()},{passive:!0,capture:!0,once:!0}),r}},{key:"getThanksElement",value:function(){var t=document.createElement("p");return t.className=this.thanksClassName,t.innerHTML=DATA.thanksMessage,t}},{key:"sendDatas",value:function(){return window.abtasty.send("event",{ec:"csat",ea:"Customer Satisfaction",ev:this.currentNote,el:DATA.mainQuestion,caid:TEST_ID,vaid:VARIATION_ID,cv:{0:"openEndedQuestion, ".concat(this.currentOpenQuestion),1:"openEndedAnswer, ".concat(this.currentFeedback),2:"maxScore, ".concat(DATA.emojisQty)}}),d("Sending datas, note: ".concat(this.currentNote,"/").concat(DATA.emojisQty,', feedback: "').concat(this.currentFeedback,'"')),this}},{key:"complete",value:function(){var t=this;this.parentContainer.recurrence.setValidationRecurrence();var e=DATA,n=e.autoHide,r=e.timeHide;return n?(this.CSATContainer.style.pointerEvents="none",setTimeout(function(){t.parentContainer.hide(!1),t.parentContainer.pageWatcher.clearWatcher(),t.parentContainer.closedByUser=!0,setTimeout(function(){return t.parentContainer.remove()},1e3)},1e3*r),this):this}},{key:"showCurrentStep",value:function(){var e=this,n=!t();return"complete"!==this.currentStep&&([this.voteElement,this.questionElement,this.thanksElement].forEach(function(t){return t.classList.add(e.hideClassName)}),this["".concat(this.currentStep,"Element")].classList.remove(this.hideClassName)),"question"===this.currentStep?this.setQuestion():["thanks","complete"].includes(this.currentStep)&&n?this.sendDatas().complete():this}},{key:"fetchTastyEmojis",value:(r=H(W().mark(function t(e){return W().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(e,{method:"GET",mode:"cors",cache:"no-cache",referrerPolicy:"no-referrer"}).then(function(t){return t.blob()}).then(function(t){return t.text()}).then(function(t){return t}).catch(function(t){return console.error("ERROR on loading picture, message: ".concat(t))});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}},t)})),function(t){return r.apply(this,arguments)})},{key:"getEmojisList",value:function(){var t=DATA.emojisType;return Q.map(function(e,n){var r;return{index:n,iconUrl:"abtasty"===t?null!==(r=window.abtastyEmojis)&&void 0!==r&&r.length?window.abtastyEmojis[n]:"".concat("https://widgets-images.abtasty.com/","csat/").concat(e,".svg"):"<img src='".concat(DATA["".concat(e,"EmojiCustom")],"'>"),iconText:DATA["".concat(e,"EmojiText")],className:"csatEmojiButton ".concat(e,"EmojiButton")}})}},{key:"onEmojiClick",value:function(t){var e=t.currentTarget;return isNaN(this.currentNote)&&(this.emojiChoice=Number(e.dataset.index),this.currentNote=Number(e.dataset.note)),this.currentStep=this.steps[this.steps.indexOf(this.currentStep)+1],this.showCurrentStep()}},{key:"getEmojiButton",value:function(e,n){var r=DATA.emojisType,i=document.createElement("button");return i.className=e.className,i.dataset.index=e.index,i.dataset.note=n,i.ariaLabel="".concat(DATA.mainQuestion," - ").concat(n,"/").concat(DATA.emojisQty),i.innerHTML="text"===r?e.iconText:e.iconUrl,t()&&(i.dataset.abtastyActionnable="true"),i.addEventListener("click",this.onEmojiClick.bind(this),{passive:!0,capture:!0}),i}},{key:"getEmojisContainer",value:function(){var e=this,n=DATA,r=n.emojisQty,i=n.stepPreview,o=n.mainQuestion,s=document.createElement("p");s.innerHTML=o;var a=document.createElement("div");a.className=this.voteClassName,a.appendChild(s);var c=[,,[0,4],[0,2,4],[0,1,3,4],[0,1,2,3,4]];return this.emojisList.forEach(function(t,n){if(c[r].includes(n)){var i=c[r].indexOf(n)+1,o=e.getEmojiButton(t,i);a.appendChild(o)}}),(t()&&"vote"!==i||"vote"!==this.currentStep)&&a.classList.add(this.hideClassName),a}},{key:"getCSATElement",value:function(){var t=DATA,e=t.askOpenQuestion,n=t.isThankYouMessage;return this.CSATContainer.classList.add("".concat(this.baseClassName),"".concat(this.className)),this.voteElement=this.getEmojisContainer(),this.CSATContainer.appendChild(this.voteElement),(e||"question"===this.currentStep)&&this.CSATContainer.appendChild(this.questionElement),(n||"thanks"===this.currentStep)&&this.CSATContainer.appendChild(this.thanksElement),this.CSATContainer}},{key:"getStyleElement",value:function(){var e=document.createElement("style");e.type="text/css",t()&&e.setAttribute("abtasty-script-added","true");var n=DATA,r=n.emojisType,i=n.customColors,o=n.emojisMargin,s=n.borderColor,a=n.textColor,c=n.backgroundColor,l=Q.reduce(function(t,e){var n=i?DATA["".concat(e,"Color")]:G[e],r=".csat_emoji_".concat(e," .csat_emoji_shadow,\n\t\t\t.csat_emoji_").concat(e," .csat_emoji_head {\n\t\t\t\tfill: ").concat(n,";\n\t\t\t}");return"".concat(t).concat(r)},""),h=["abtasty"===r?l:"",".csatEmojiButton {","all: unset !important;","margin: 0 ".concat(o,"px !important;"),"font-size: 30px !important;","cursor: pointer !important;","}",".csatEmojiButton svg {","overflow: visible;","pointer-events: none;","}",".csatEmojiButton .csat_emoji > * {","transform-origin: center;","transition: transform .5s ease;","}",".csatEmojiButton:hover .csat_emoji_shadow {","transform: scale(1.4);","}",".csatEmojiButton:hover .csat_emoji_shadow ~ * {","transform: scale(1.2);","}",".csat_emoji_shadow {","opacity: 0.1;","}",".csat_emoji_mouth,",".csat_emoji_eyebrow,",".csat_emoji_eye {","mix-blend-mode: multiply;","fill: rgb(57, 57, 57);","}",".csat_emoji_mouth,",".csat_emoji_eyebrow {","opacity: 0.5;","}"].join("");return e.textContent=[h,".".concat(this.questionClassName," textarea {"),"width: 100%;","min-height: 60px;","margin-top: 12px;","margin-bottom: 20px;","border: 2px solid ".concat(s,";"),"color: ".concat(a,";"),"}",".".concat(this.className," textarea::selection,\n\t\t\t.").concat(this.className," p::selection {"),"-webkit-text-fill-color: ".concat(c,";"),"text-fill-color: ".concat(c,";"),"color: ".concat(c,";"),"background-color: ".concat(s,";"),"}",".".concat(this.questionClassName," button {"),"cursor: pointer;","}",".".concat(this.voteClassName," p {"),"margin-bottom: 12px;","}","#".concat(this.parentContainer.widgetContainerId," .").concat(this.parentContainer.contentClassName," .").concat(this.className," {"),"overflow: hidden;","}",".".concat(this.className," > * {"),"opacity: 1;","height: auto;","}",".".concat(this.className," > .").concat(this.hideClassName," {"),"opacity: 0;","pointer-events: none;","transition: opacity 0.5s ease;","height: 0;","}"].join(""),e}}],n&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,U(r.key),r)}}(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r,i,o}();function K(t){return K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},K(t)}function Y(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Y=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof f?e:f,s=Object.create(o.prototype),a=new L(r||[]);return i(s,"_invoke",{value:$(t,n,a)}),s}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",m="executing",p="completed",g={};function f(){}function v(){}function y(){}var w={};l(w,s,function(){return this});var b=Object.getPrototypeOf,E=b&&b(b(N([])));E&&E!==n&&r.call(E,s)&&(w=E);var T=y.prototype=f.prototype=Object.create(w);function S(t){["next","throw","return"].forEach(function(e){l(t,e,function(t){return this._invoke(e,t)})})}function C(t,e){function n(i,o,s,a){var c=u(t[i],t,o);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==K(h)&&r.call(h,"__await")?e.resolve(h.__await).then(function(t){n("next",t,s,a)},function(t){n("throw",t,s,a)}):e.resolve(h).then(function(t){l.value=t,s(l)},function(t){return n("throw",t,s,a)})}a(c.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e(function(e,i){n(t,r,e,i)})}return o=o?o.then(i,i):i()}})}function $(e,n,r){var i=d;return function(o,s){if(i===m)throw Error("Generator is already running");if(i===p){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var c=A(a,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var l=u(e,n,r);if("normal"===l.type){if(i=r.done?p:"suspendedYield",l.arg===g)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=p,r.method="throw",r.arg=l.arg)}}}function A(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,A(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function N(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(K(e)+" is not iterable")}return v.prototype=y,i(T,"constructor",{value:y,configurable:!0}),i(y,"constructor",{value:v,configurable:!0}),v.displayName=l(y,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,l(t,c,"GeneratorFunction")),t.prototype=Object.create(T),t},e.awrap=function(t){return{__await:t}},S(C.prototype),l(C.prototype,a,function(){return this}),e.AsyncIterator=C,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new C(h(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then(function(t){return t.done?t.value:s.next()})},S(T),l(T,c,"Generator"),l(T,s,function(){return this}),l(T,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=N,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(c&&l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function J(t,e,n,r,i,o,s){try{var a=t[o](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}var X=function(){var t,e=(t=Y().mark(function t(){var e,n,r;return Y().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return d("Widget launch"),e=q(),n=e.domElement.querySelector(".".concat(e.contentClassName)),r=new z({parentContainer:e}),e.children=r,t.next=8,r.insertIn(n,"beforeend");case 8:return e.init(!0).then(function(t){return t.response&&e.show()}),t.abrupt("return",{parentContainer:e,CSAT:r});case 10:case"end":return t.stop()}},t)}),function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(t){J(o,r,i,s,a,"next",t)}function a(t){J(o,r,i,s,a,"throw",t)}s(void 0)})});return function(){return e.apply(this,arguments)}}();X()}();
|
1
|
+
!function(){"use strict";const t=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor"),e=()=>{const t=!!document.getElementById("ABTastyPreviewBar"),e=location.href.includes("ab_project=preview");return t||e},n=t=>new Function(`try {\n\t\t${t}\n\t} catch (error) {\n\t\treturn null;\n\t}`)(),r=()=>encodeURIComponent(DATA.spNoTrim?window.location.href.replace(window.location.origin,""):`${window.location.pathname}`),i=()=>!t()&&(e()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),o=()=>window.ABTasty&&!0===window.ABTasty.consentReady,s="remove",a="rebuild",c="update",l=()=>{const{type:t}=DATA;return`${PACKAGE.replace("@abtasty/","")}${t?`_${t}`:""}`},h=()=>{const t=l();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`.split("-").join(" ")},u=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,d=n=>{const r=(()=>{if(t()||e())return!1;const n=ABTasty.getTestsOnPage()[TEST_ID];return!!n&&Object.keys(n.targetings.qaParameters).length>0})(),i=document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(r||i){const t=h();window.console.log(`%c${t} - ${r?"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;")}},p=t=>{const e={promise:null,resolve:null,reject:null,name:t};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e},m=(t,e)=>{const n=()=>{try{return document.querySelector(t)}catch(t){return null}};let r=n();const i=[document.querySelector("body")||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],o=()=>a.disconnect(),s=()=>a.observe(...i),a=new MutationObserver(()=>(r=n(),r&&!o()&&e(r)));return r?setTimeout(()=>e(r),0):s(),{selector:t,clear:o,observe:s}};function g(t,e){return e(t)||!t.parentElement?t:g(t.parentElement,e)}const f=(t,e)=>[...document.querySelectorAll(e)].some(n=>n===t||!!t.closest(e)),v=(t,e)=>{let n=Date.now();return()=>{n+e-Date.now()<=0&&(t(),n=Date.now())}};class y{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=null,this.mouseOverEvent=this.mouseOverHandler(),this.scrollEvent=this.scrollEventHandler(),this.onTransitionEnd=this.transitionOverHandler()}transitionOverHandler(){const t=["transitionend",this.checkElements.bind(this),!0];return this.getEvents(t)}intersectionHandler(t){t.forEach(t=>{t.isIntersecting?(this.existingTargets.forEach(e=>{e.element.isSameNode(t.target)&&(this.inViewportTargets.push(e),this.mouseOverEvent.start(),this.scrollEvent.start(),this.onTransitionEnd.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(e=>!e.element.isSameNode(t.target)||(this.mouseOverEvent.clear(),this.scrollEvent.clear(),this.onTransitionEnd.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){this.mutationObserver??=new MutationObserver(this.checkElements.bind(this));const{clear:t}=m("body",e=>{t(),this.mutationObserver.observe(e,{attributes:!0,childList:!0,subtree:!0})});return this.mutationObserver}onMouseOver({target:t,path:e}){const n=this.inViewportTargets.find(({element:n,selector:r})=>{if(n.isSameNode(t))return!0;const i=[...t.querySelectorAll(r)];if(i.length&&i.includes(n))return!0;if(e.includes(n))return!0;const o=[...t.parentElement.children],s=o.findIndex(e=>e.isSameNode(t)),a=o.filter((t,e)=>e>s);if(a.length){if(a.includes(n))return!0;if(a.some(t=>[...t.querySelectorAll(r)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:t,element:e,uniqueId:r}=n,i=this.targets.find(e=>e.selector===t&&e.uniqueId===r);i&&i.resolve(e),this.clear(t,r)}}getEvents(t){return{start:()=>document.addEventListener(...t),clear:()=>document.removeEventListener(...t)}}mouseOverHandler(){const t=["ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?"touchmove":"mouseover",t=>{const e=t.composedPath(),{target:n}=t;setTimeout(()=>this.onMouseOver({target:n,path:e}),50)},!0];return this.getEvents(t)}scrollEventHandler(){const t=["scroll",v(this.checkElements.bind(this),50),{passive:!0}];return this.getEvents(t)}isElementVisible(t){return this.isElementTopmost(t)&&this.isElementOpaque(t)}isElementOpaque(t){return"HTML"===g(t,t=>"0"===window.getComputedStyle(t).opacity).nodeName}isElementTopmost(t){const e=t.getBoundingClientRect(),n=[[e.left,e.top],[e.right,e.top],[e.left,e.bottom],[e.right,e.bottom],[e.left+e.width/2,e.top],[e.left+e.width/2,e.bottom],[e.left,e.height/2],[e.right,e.height/2],[e.left+e.left/2,e.height/2]];let r=!1,i=0;for(;!r&&i<n.length;){const e=document.elementFromPoint(...n[i]);r=t===e||t.contains(e),i+=1}return r}checkElements(){this.targets.forEach(({selector:t,uniqueId:e})=>{const n=document.querySelector(t);n&&!this.existingTargets.find(n=>n.element.matches(t)&&n.uniqueId===e)&&(this.existingTargets.push({element:n,selector:t,uniqueId:e}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:t,element:e})=>!!document.querySelector(t)||(e&&this.visibilityObserver.unobserve(e),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:t,element:e,uniqueId:n})=>{if(e.matches(t)&&this.isElementVisible(e)){const r=this.targets.find(e=>e.selector===t&&e.uniqueId===n);return r&&r.resolve(e),this.clear(t,n),!1}return!0})}watch(t,e,n){this.targets.push({selector:t,resolve:e,uniqueId:n}),this.startMutationObserver(),this.checkElements()}clear(t,e){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(n=>n.filter(({selector:n,uniqueId:r})=>n!==t&&r!==e));const n=document.querySelector(t);n&&this.visibilityObserver.unobserve(n),0===this.targets.length&&this.mutationObserver?.disconnect(),0===this.inViewportTargets.length&&(this.mouseOverEvent.clear(),this.scrollEvent.clear(),this.onTransitionEnd.clear())}}class b{constructor({triggerEvent:t,triggerSelector:e,triggerDelay:n,triggerTarget:r}){this.event=t,this.selector=e&&e.length?e:"body",this.target=r,this.delay=1e3*n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.promises=[],this.visibilityObservers=[],this.socialProofStore={}}async onElementVisible({promise:t,resolve:e}){const n=p(`${this.event}DomReady`);this.promises.push(n);const r=await this.onPageLoad(n),i=new y;if(this.visibilityObservers.push(i),r){const t=u();i.watch(this.selector,e,t)}return t}onPageLoad({promise:t,resolve:e}){const n=()=>"complete"===document.readyState;if(!n()){const r=["readystatechange",()=>n()&&e(!0),{passive:!0}];return this.eventsListeners.push([document,...r]),document.addEventListener(...r),t}return e(!0),t}onClick({promise:t,resolve:e}){const n=document.createElement("style");n.type="text/css",n.id=`Click_${u()}`,n.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(n),this.elementsSelectors.push(`#${n.id}`);const r=["click",({isTrusted:t,target:n})=>{const r=n.isEqualNode(this.target)||f(n,this.selector);return t&&r&&e(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...r]),document.addEventListener(...r),t}onHover({promise:t,resolve:e}){const n=["mouseenter",({isTrusted:t,target:n})=>{const r=this.target?n.isEqualNode(this.target):f(n,this.selector);return t&&r&&e(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document.documentElement,...n]),document.documentElement.addEventListener(...n),t}onExitIntent({promise:t,resolve:e}){const n=["mouseleave",({isTrusted:t,clientY:n})=>{t&&n<=0&&e(!0)},{passive:!0}],{clear:r}=m("html",t=>{r(),this.eventsListeners.push([t,...n]),t.addEventListener(...n)});return t}onReengage({promise:t,resolve:e}){const n=this.delay;let r=n;const i=[({isTrusted:t})=>{t&&(r=n)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(t=>{this.eventsListeners.push([document,t,...i]),document.addEventListener(t,...i)});const o=setInterval(()=>{r<=0?e(!0):r-=100},100);return this.intervals.push(o),t}onCustomTrigger({promise:t,resolve:e}){const{triggerEventCustomScript:n}=DATA;return new Function(`return new Promise(async resolve => {${n}})`)().then(t=>t&&e(!0)),t}onScrollUp({promise:t,resolve:e}){let n=0;const r=["scroll",({isTrusted:t})=>{t&&(window.pageYOffset<n?e(!0):n=window.pageYOffset)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...r]),document.addEventListener(...r),t}onScrollPercentReached({promise:t,resolve:e}){const{triggerEventScrollPercent:n}=DATA,r=["scroll",({isTrusted:t})=>{if(!t)return;const r=(()=>{const{documentElement:t,body:e}=document,n=t.scrollTop||e.scrollTop,r=t.scrollHeight||e.scrollHeight;return Math.trunc(n/(r-t.clientHeight)*100,10)})();n<r&&e(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...r]),document.addEventListener(...r),t}checkSocialProofConditions(t,e,n,r){const i=(()=>{let t;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?t=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?t=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(t=window.ABTasty.accountSettings.identifier),t):t})(),{viewInterval:o,spNoTrim:s}=DATA;if(this.socialProofStore.hasOwnProperty(t))n(this.socialProofStore[t])?r(`${this.socialProofStore[t][o]}`):r(!1);else if(t&&i){const a=e=>(this.socialProofStore[t]=e,r(!!n(e)&&`${e[o]}`));fetch(`https://api-social-proof.abtasty.com/clients/${i}/metrics/${e}?key=${t}${s?"&noTrim=true":""}`).then(t=>t.ok&&t.json()).then(a).catch(()=>d("Failed to fetch datas from server."))}else r(!1)}getSocialProofDatas({promise:t,resolve:e},i,o=!1){const{productKey:s,keyType:a}=(()=>{const{socialProofContentType:t,productKeyProvider:e,pathToProductKey:i,customJSProductKey:o,productSKU:s}=DATA;if(2===t)return{productKey:r(),keyType:"url"};{let a=null,c="sku";switch(e){case"ABTastyProductKey":a=window.ABTastyProductKey;break;case"pathToProductKey":a=n(`return ${i};`);break;case"customJSProductKey":a=n(o);break;case"productSKU":a=s}return a||3!==t||(a=r(),c="url"),{productKey:a,keyType:c}}})(),{viewInterval:c,triggerSocialProofMinVisitors:l,triggerSocialProofMinPurchases:h,triggerSocialProofMinPageViews:u}=DATA,p={pv:u,i:h,"v-pv":l}[i];return[typeof c,typeof p].includes("undefined")&&e(!1),o&&!s&&(d("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"),e(!1)),this.checkSocialProofConditions(s,"v-pv"===i&&"sku"===a?"v-i":i,t=>{const e=void 0!==t[c]&&t[c]>=p;return e||d(`Widget will not be shown, Social Proof API returned ${t[c]} while ${p} are required`),e},e),t}onConsent({promise:t,resolve:e}){if(!o()){const n=["abtasty_consentValid",()=>e(!0)];return this.eventsListeners.push(n),window.addEventListener(...n),t}return e(!0),t}onTrackingSent({promise:t,resolve:e}){const{triggerEventTrackingSent:n}=DATA;let r=localStorage.getItem("ABTastyData");const i=()=>JSON.parse(r).ActionTracking.find(({name:t})=>t===n),o=["storage",()=>{r=localStorage.getItem("ABTastyData"),i()&&e(!0)},{passive:!0,capture:!0}];return r&&i()?e(!0):(()=>{this.eventsListeners.push([window,...o]),window.addEventListener(...o)})(),t}onMinPagesViewed({promise:t,resolve:e}){const{triggerEventMinPagesViewed:n}=DATA;let r=localStorage.getItem("ABTastyData");const i=()=>n<=(r?JSON.parse(r).VisitedPages.length:0),o=["storage",()=>{r=localStorage.getItem("ABTastyData"),i()&&e(!0)},{passive:!0,capture:!0}];return r&&i()?e(!0):(()=>{this.eventsListeners.push([window,...o]),window.addEventListener(...o)})(),t}onRageClick({promise:t,resolve:e}){const{triggerEventRageClickQuantity:n,triggerEventRageClickDelay:r}=DATA;let i=0,o=!1;const s=["click",({isTrusted:t})=>{if(t&&(i+=1,i>=n&&e(!0),!o)){o=!0;const t=setTimeout(()=>{i=0,o=!1},r);this.timeouts.push(t)}},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...s]),document.addEventListener(...s),t}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(t=>{document.querySelector(t)&&document.querySelector(t).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(t=>{const[e,...n]=t;e&&n.length>1&&e.removeEventListener(...n)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(t=>clearInterval(t)),this.intervals=[]),this.visibilityObservers.length){const t=u();this.visibilityObservers.forEach(e=>e.clear(this.selector,t)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(t=>t.resolve(!1)),this.promises=[]),this}async isTriggered(){this.clear();const t=p(this.event);this.promises.push(t);const e={consent:()=>this.onConsent(t),direct:()=>!0,pageLoad:()=>this.onPageLoad(t),click:()=>this.onClick(t),exitIntent:()=>this.onExitIntent(t),reengage:()=>this.onReengage(t),elementVisible:()=>this.onElementVisible(t),script:()=>this.onCustomTrigger(t),hover:()=>this.onHover(t),scrollUp:()=>this.onScrollUp(t),scrollPercent:()=>this.onScrollPercentReached(t),rageClick:()=>this.onRageClick(t),minPagesViewed:()=>this.onMinPagesViewed(t),trackingSent:()=>this.onTrackingSent(t),socialProofPurchases:()=>this.getSocialProofDatas(t,"i",!0),socialProofPageViews:()=>this.getSocialProofDatas(t,"pv"),socialProofVisitors:()=>this.getSocialProofDatas(t,"v-pv")},n=!Object.prototype.hasOwnProperty.call(e,this.event)||await e[this.event]();return n&&this.clear(),"reengage"!==this.event&&this.delay?n&&await(async()=>{const t=p(`${this.event}Delay`);this.promises.push(t);const e=setTimeout(()=>{t.resolve(!0),this.clear()},this.delay);return this.timeouts.push(e),t.promise})():n}}const w="display",E="closing",T="validation",S="ABTastyWidgets",C=`${S}Temporary`;class ${constructor({displayRecurrence:t,closingRecurrence:e,validationRecurrence:n},r){this.displayRecurrence=parseFloat(t),this.closingRecurrence=parseFloat(e),this.validationRecurrence=parseFloat(n),this.onSetCallback=r,this.widgetName=l(),this.uniqueId=u(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:t}){const e=localStorage.getItem(C),n=sessionStorage.getItem(S);"ABTastyData"===t&&!e&&n&&localStorage.setItem(C,n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(t){try{const e=t.getItem(S);return JSON.parse(e)}catch(e){return t.removeItem(S),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(t,e){const{[this.recurrenceKey]:n,...r}=e;return Object.entries(r).length?(t.setItem(S,JSON.stringify(r)),r):(t.removeItem(S),!1)}removeSessionRecurrenceStorage(){const t=this.getSessionRecurrenceStorageParsed();return!!t&&this.removeGivenStorage(window.sessionStorage,t)}removeLocalRecurrenceStorage(){const t=this.getLocalRecurrenceStorageParsed();return!!t&&this.removeGivenStorage(window.localStorage,t)}getSessionRecurrence(){const t=this.getSessionRecurrenceStorageParsed();return!!t&&t[this.recurrenceKey]}getLocalRecurrence(){const t=this.getLocalRecurrenceStorageParsed();return!!t&&t[this.recurrenceKey]}getCurrentRecurrence(){if(this.pendingRecurrence)return this.pendingRecurrenceValue;const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();return t||e||{type:!1}}isOver(){const t=localStorage.getItem(C),e=!(!t||!t.includes(this.recurrenceKey))||this.getSessionRecurrence();t&&(sessionStorage.setItem(S,t),localStorage.removeItem(C));const n=this.getLocalRecurrence(),r=(n?parseFloat(n.stamp):0)<(new Date).getTime();return r&&this.removeLocalRecurrenceStorage(),!this.pendingRecurrence&&r&&!this.getLocalRecurrence()&&!e}setRecurrence(t,n){0!==t&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const r=this.getTypeOfStorage(t);if(e()||!r&&"object"!=typeof r)return!1;const{storageString:i,storageMethod:s}=r,a=this.getStamp(t),c={type:n,stamp:a},{type:l}=this.getCurrentRecurrence(),h=async()=>{if(!o()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const t=new b({triggerEvent:"consent"});await t.isTriggered(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();let n;"session"===i?t?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===i&&(e?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const r=n?{[this.recurrenceKey]:c,...n}:{[this.recurrenceKey]:c};s.setItem(S,JSON.stringify(r)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!s)return!1;if(l&&n!==T)if(n===E&&l!==T)h();else{if(n!==w||l===T||l===E)return!1;h()}else h();return a}setDisplayRecurrence(){const t=w;this.setRecurrence(this.displayRecurrence,t)}setClosingRecurrence(){const t=E;this.setRecurrence(this.closingRecurrence,t)}setValidationRecurrence(){const t=T;this.setRecurrence(this.validationRecurrence,t)}getStamp(t){return(new Date).getTime()+864e5*t}getTypeOfStorage(t){return!(isNaN(t)||t<0||0!==t&&!t)&&(t>0?{storageString:"local",storageMethod:window.localStorage}:0===t&&{storageString:"session",storageMethod:window.sessionStorage})}}class A{constructor(t,e,n){this.isWidgetApplied=t,this.callback=e,this.shouldUpdate=n,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(){const t=this.isWidgetApplied()?this.shouldUpdate&&c:a;return t?(this.clearWatcher(),this.callback(t,!0),this.watch(),this):this}onCampaignLaunched({detail:{campaignId:t}}){t===TEST_ID&&(this.callback(a,!1),this.watch())}onTagRollback(){return this.clearWatcher(),this.callback(s,!1),window.addEventListener(...this.onCampaignLaunchedEventParams),this}observerHandler(t){return i()?t.some(t=>["removedNodes","addedNodes"].some(e=>t[e]&&t[e].length))?this.decisionHandler():this:this.callback(s,!1)}watch(){if(t())return this;this.clearWatcher(),window.removeEventListener(...this.onCampaignLaunchedEventParams),document.addEventListener(...this.tagRollbackEventParams);const{clear:e}=m("body",t=>{e(),this.observer.observe(t,{childList:!0,subtree:!0})});return this}clearWatcher(){return document.removeEventListener(...this.tagRollbackEventParams),this.observer.disconnect(),this}}const x=/.+\/([^.]+)\.(otf|ttf)$/,k=["socialProofPurchases","socialProofPageViews","socialProofVisitors"];class L{constructor(e,n){this.children=void 0,this.uniqueId=`${u()}${n?`_${n}`:""}`,this.widgetName=l(),this.prettyName=h(),this.recurrenceParams=(()=>{const{displayRecurrence:e,closingRecurrence:n,validationRecurrence:r}=DATA,i=!e&&!n&&!r;if(t()||i)return!1;const o={everytime:()=>-1,session:()=>0,once:()=>395,day:t=>DATA[`${t}_day`],week:t=>7*DATA[`${t}_week`],month:t=>30.5*DATA[`${t}_month`]},s={};return e&&(s.displayRecurrence=o[e]("displayRecurrence")),n&&(s.closingRecurrence=o[n]("closingRecurrence")),r&&(s.validationRecurrence=o[r]("validationRecurrence")),s})(),this.triggerParams=(e=>{let{triggerEvent:n}=DATA;const{triggerEventClick:r,triggerEventHover:i,triggerEventReengageDelay:o,socialProofContentType:s,triggerEventElementVisible:a,triggerEventDelay:c}=DATA;if(t()||!n&&!s)return!1;const l={click:()=>r,hover:()=>i,elementVisible:()=>a},h=Object.prototype.hasOwnProperty.call(l,n)?l[n]():"body",u="reengage"===n?o:c;return s&&(n=[,"socialProofPurchases","socialProofPageViews","socialProofVisitors"][s]),{triggerEvent:n,triggerSelector:h,triggerDelay:u,triggerTarget:e}})(e),this.recurrence=!!this.recurrenceParams&&new $(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new b(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&k.includes(this.triggerParams.triggerEvent),this.pageWatcher=new A(this.isWidgetApplied.bind(this),this.onPageChange.bind(this),this.shouldUpdate),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:t,triggerEvent:e}=DATA;return!e||!["click","hover","scrollUp","script"].includes(e)||t})(),this.basicClassName=`ab_widget_container_${this.widgetName}`,this.widgetContainerId=`${this.basicClassName}_${this.uniqueId}`,this.contentClassName=`${this.basicClassName}_content`,this.overlayClassName=`${this.basicClassName}_overlay`,this.closeButtonClassName=`${this.basicClassName}_close_button`,this.hideClassName=`ab_hide_${this.uniqueId}`,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.elementsWaiters=[]}clearGivenClearables(){this.eventsListeners.forEach(t=>document.removeEventListener(...t)),this.eventsListeners=[],this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[],this.intervals.forEach(t=>clearInterval(t)),this.intervals=[],this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]}isWidgetApplied(){return this.domElement&&this.domElement.isConnected}removeOldDomElement(){const t=document.getElementById(this.widgetContainerId);return t&&t.remove(),this}async insert(){if(this.isWidgetApplied())return!1;document.head.appendChild(this.styleElement);const t=["free"];return"drawer"===DATA.layout&&DATA.customTarget&&t.push("drawer"),new Promise(e=>{const{elementReferrer:n="body",referrerInsertType:r="beforeend"}=t.includes(DATA.layout)?DATA:{},i=m(n,t=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t.selector!==n),this.removeOldDomElement(),e(t.insertAdjacentElement(r,this.domElement))});this.elementsWaiters.push(i)}).then(()=>this)}remove(){return this.trigger&&this.trigger.clear(),this.pageWatcher.clearWatcher(),[this.domElement,this.styleElement].forEach(t=>t&&t.isConnected&&t.remove()),this.hasOncePerPageTrigger?this.pageWatcher.watch():t()||this.init().then(({response:t})=>t?this.show():this),this}show(){return t()||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}hide(e=!0){return!t()&&this.hasBeenShown&&e&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),e&&(this.pageWatcher.clearWatcher(),this.closedByUser=!0),this.domElement.classList.add(this.hideClassName),this}async init(e){const n=t(),r=i(),o=this.trigger&&this.trigger.promises.length,s=!this.recurrence||this.recurrence.isOver();if(!n&&!r||o||!s)return{container:this,response:!1};this.pageWatcher.watch();const a=n||!this.trigger||this.trigger&&await this.trigger.isTriggered(),c={container:this,response:a};return a?(await this.insert(),this.addCloseEvent(),n||e||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(a),c):c}onPageChange(t,e){const n=()=>this.init().then(({response:t})=>{t?this.show():this.hide(!1)});e||(this.hasBeenShown=!1,this.trigger&&this.trigger.clear());const r=this.isWidgetApplied(),i={[s]:()=>r?this.remove():this.pageWatcher.watch(),[a]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():r||this.insert().then(t=>t.show()).catch(this.pageWatcher.watch):n()},[c]:n};"function"==typeof i[t]&&i[t]()}addCloseEvent(...e){const{closeButton:n,overlay:r,overlayClickable:i,layout:o,animationDuration:s=1e3}=DATA,a=[];if(void 0!==r&&!0!==r||!0!==i||"popin"!==o||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=>{(e=>{t()||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())})(e),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*s)},{once:!0,capture:!0}];return e.push(...c),e.forEach(e=>{t()&&(e.dataset.abtastyActionnable="true"),e.removeEventListener(...l),e.addEventListener(...l)}),this}getDom(){const{closeButton:t,layout:e,overlayClickable:n,overlay:r=!0}=DATA,i=document.createElement("div");return i.className=`${this.basicClassName} ${this.hideClassName}`,i.id=this.widgetContainerId,["popin","bannerTop","bannerBottom"].includes(e)&&(i.role="dialog"),i.innerHTML=`\n\t\t\t${"popin"===e&&!0===r?`<div ${n?'aria-label="Close dialog"':""} class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${t?`<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>`,i}loadFont(t,e){if(!t||"inherit"===t||!/otf|ttf/g.test(e))return;const n=document.createElement("style"),r=e.match(x)?e.match(x)[1]:"";n.innerHTML=`@font-face { font-family: '${t}_${r}'; src: url('${e}'); font-display: swap; }`,document.head.appendChild(n)}getStyleTag(e="",n=DATA){const{noStyles:r,layout:i}=n,{backgroundColor:o,isBackgroundImage:s,backgroundImage:a,backgroundSize:c,backgroundPosition:l,backgroundRepeat:h,borderColor:u,borderRadius:d,borderWidth:p,textColor:m,textAlign:g,fontName:f,fontStyle:v,fontSize:y,isTitle:b,titleTextAlign:w,titleTextColor:E,titleFontName:T,titleFontStyle:S,titleFontSize:C,overlay:$,overlayColor:A,dropShadow:k,dropShadowColor:L,dropShadowBlur:N,containerMargin:P,containerPadding:j,closeButton:_,closeButtonPosition:I,closeButtonSize:D,closeButtonBorderRadius:O,closeButtonBorderWidth:R,closeButtonBorderColor:B,closeButtonColor:q,closeButtonBackgroundColor:V,buttonsAlign:W,buttonsBorderWidth:F,buttonsBorderColor:M,buttonsBorderRadius:H,buttonsBackgroundColor:U,buttonsTextColor:G,buttonsFontName:Q,buttonsFontStyle:z,buttonsFontSize:K,secondLink:Y,secondLinkBorderWidth:J,secondLinkBorderColor:X,secondLinkBorderRadius:Z,secondLinkBackgroundColor:tt,secondLinkTextColor:et,secondLinkFontName:nt,secondLinkFontStyle:rt,secondLinkFontSize:it,animation:ot,animationDuration:st,animationBehaviour:at,animationSlideDirection:ct}=r?{}:n,lt=document.createElement("style");lt.type="text/css",t()&<.setAttribute("abtasty-script-added","true"),this.loadFont(f,v),this.loadFont(T,S),this.loadFont(Q,z),this.loadFont(nt,rt);const ht=`background: ${["string"==typeof o?o:"rgba(255, 255, 255, 1)",s&&"string"==typeof a&&a.length?`url(${a})`:"",s&&"string"==typeof l&&"100% 100%"!==c?l:"0 0",s&&"string"==typeof c?`/ ${c}`:"/ auto",s&&h&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,ut="number"==typeof p&&p>0,dt=`border: ${[ut?`${p}px`:"unset",ut?"solid":"",ut&&"string"==typeof u&&u.length?u:""].join(" ").trim()};`,pt=void 0!==d?`border-radius: ${d}px;`:"",mt=void 0!==m?`color: ${m}; fill: ${m}; -webkit-text-fill-color: ${m};`:"",gt=void 0!==g?`text-align: ${g};`:"",ft=f&&"inherit"!==f?`font-family:${f}_${v.match(x)?v.match(x)[1]:""};`:v||"",vt=y?`font-size: ${y}px;`:"",yt=void 0!==k&&k?`box-shadow: 0 5px ${N}px 0 ${L};`:"",bt=P instanceof Array&&1===P.length&&P[0],wt=bt?`margin: ${bt.top}px ${bt.right}px ${bt.bottom}px ${bt.left}px;`:"",Et=bt?`margin: calc(${bt.top}px * 0.5) calc(${bt.right}px * 0.5) calc(${bt.bottom}px * 0.5) calc(${bt.left}px * 0.5);`:"",Tt=j instanceof Array&&1===j.length&&j[0],St=Tt?`padding: ${Tt.top}px ${Tt.right}px ${Tt.bottom}px ${Tt.left}px;`:"",Ct=Tt?`padding: calc(${Tt.top}px * 0.5) calc(${Tt.right}px * 0.5) calc(${Tt.bottom}px * 0.5) calc(${Tt.left}px * 0.5);`:"",$t=void 0!==F&&F?`border-width: ${F}px; border-style: solid;`:"",At=[M,F].every(t=>void 0!==t)&&F?`border-color: ${M};`:"",xt=void 0!==H?`border-radius: ${H}px;`:"",kt=void 0!==U?`background-color: ${U};`:"",Lt=void 0!==G?`color: ${G}; fill: ${G}; -webkit-text-fill-color: ${G};`:"",Nt=Q&&"inherit"!==Q?`font-family:${Q}_${z.match(x)?z.match(x)[1]:""};`:z||"",Pt=K?`font-size: ${K}px;`:"",jt="number"==typeof J?`border-width: ${J}px; border-style: solid;`:"",_t=[X,J].every(t=>void 0!==t)&&J?`border-color: ${X};`:"",It=void 0!==Z?`border-radius: ${Z}px;`:"",Dt=void 0!==tt?`background-color: ${tt};`:"",Ot=void 0!==et?`color: ${et}; fill: ${et}; -webkit-text-fill-color: ${et};`:"",Rt=nt&&"inherit"!==nt?`font-family:${nt}_${rt.match(x)?rt.match(x)[1]:""};`:rt||"",Bt=it?`font-size: ${it}px;`:"",qt="popin"!==i||void 0!==$&&!0!==$?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==A?A:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),Vt="number"==typeof D?D:16,Wt=Vt/2,Ft=r||void 0!==_&&_?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===I?`bottom: calc(100% + ${Wt}px)`:`top: ${Wt}px`)+";",`right: ${Wt}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof O?`border-radius: ${O}px;`:"","number"==typeof R&&R>0?`border: ${R}px solid ${void 0!==B?B:"rgba(57, 57, 57, 1)"};`:"","string"==typeof V?`background-color: ${V};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${Vt}px;`,`height: ${Vt}px;`,"string"==typeof q?`fill: ${q};`:"","}"].join(""):"",Mt=b&&"string"==typeof E?[`#${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: ${E}; fill: ${E}; -webkit-text-fill-color: ${E};`,void 0!==w?`text-align: ${w};`:"",T&&"inherit"!==T?`font-family:${T}_${S.match(x)?S.match(x)[1]:""};`:S||"",C?`font-size: ${C}px;`:"","}"].join(""):"";let Ht="";if("string"==typeof ot){const e=(st/1e3).toFixed(2),n=["top","bottom"].includes(ct),r=Number(n),i=[(["top","left"].includes(ct)?"-":"")+"100vmax",this.translateValues?this.translateValues[r]:"0"];n&&i.reverse(),Ht={none:[`.${this.hideClassName} {`,"opacity: 0 !important;","}"],fade:[`.${this.hideClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} {`,`transition: opacity ${e}s ${at};`,"}"],slide:[`.${this.hideClassName} .${this.overlayClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,`transition: opacity ${e}s ${at};`,"}",`.${this.hideClassName} .${this.contentClassName} {`,`transform: translate(${i.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${e}s ${at};`,"}"]}[t()&&!ABTASTY_S.WIDGETS.animationChanged?"none":ot].join("")}const Ut=[`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,`margin-${"fill"===W?"top":"left"}: 8px;`,jt,_t,It,Dt,Ot,Rt,Bt,"}",`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,Ot,Rt,Bt,"}"];return lt.textContent=[`.${this.hideClassName} {`,"pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,ht,pt,dt,mt,gt,yt,wt,ft,vt,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,mt,gt,ft,vt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",St,ft,vt,"}",`#${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;",$t,At,xt,kt,Lt,Nt,Pt,"}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a *, `,`#${this.widgetContainerId} .${this.contentClassName} button:not(class*="close_button") * {`,Lt,Nt,Pt,"}",...Y?Ut:[],"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,Et,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,Ct,"}","}",qt,Ft,Mt,Ht,`${e}`].join(""),lt}}const N=["top: 0;","top: 50%;","bottom: 0;"],P=["left: 0;","left: 50%;","right: 0;"],j=t=>1===t?"-50%":0,_=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:t,y:e}]}=DATA,n=`translate(${j(e)}, ${j(t)});`;return`${N[t]}${P[e]}transform: ${n}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},I=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,D=()=>{if(I())return"width: auto; height: auto; min-width: fit-content;";const{popinPercentWidth:t,popinPixelsWidth:e,widthUnit:n,autoHeight:r,popinPercentHeight:i,popinPixelsHeight:o,heightUnit:s}=DATA;return`width: ${"px"===n?e:t}${n};height: ${r?"auto":`${"px"===s?o:i}${s}`};`};class O extends L{constructor(){super(),this.translateValues=Object.values(DATA.popinPosition[0]).map(t=>j(t)),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:t,zindexCustom:e,widthUnit:n}=DATA,r="string"!=typeof DATA.overlay&&DATA.overlay;return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;",`z-index: ${"custom"===t?e:t};`,"background: none;","pointer-events: "+(r?"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;",_(),D(),"pointer-events: all","}",`${I()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${!I()&&["px","em"].includes(n)?["@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join(""):""}`].join("")}}class R extends L{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:t,zindexCustom:e}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;",`${this.position}: 0;`,"left: 0;","width: 100%;","height: auto;",`z-index: ${"custom"===t?e:t};`,"background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class B extends L{constructor(t,e){super(t,e),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 q=()=>{const{layout:t}=DATA;let e;switch(t){case"popin":e=new O;break;case"bannerTop":case"bannerBottom":e=new R;break;case"free":e=new B;break;default:e=new L}return e};function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function W(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */W=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof f?e:f,s=Object.create(o.prototype),a=new L(r||[]);return i(s,"_invoke",{value:$(t,n,a)}),s}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",p="executing",m="completed",g={};function f(){}function v(){}function y(){}var b={};l(b,s,function(){return this});var w=Object.getPrototypeOf,E=w&&w(w(N([])));E&&E!==n&&r.call(E,s)&&(b=E);var T=y.prototype=f.prototype=Object.create(b);function S(t){["next","throw","return"].forEach(function(e){l(t,e,function(t){return this._invoke(e,t)})})}function C(t,e){function n(i,o,s,a){var c=u(t[i],t,o);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==V(h)&&r.call(h,"__await")?e.resolve(h.__await).then(function(t){n("next",t,s,a)},function(t){n("throw",t,s,a)}):e.resolve(h).then(function(t){l.value=t,s(l)},function(t){return n("throw",t,s,a)})}a(c.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e(function(e,i){n(t,r,e,i)})}return o=o?o.then(i,i):i()}})}function $(e,n,r){var i=d;return function(o,s){if(i===p)throw Error("Generator is already running");if(i===m){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var c=A(a,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var l=u(e,n,r);if("normal"===l.type){if(i=r.done?m:"suspendedYield",l.arg===g)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.arg)}}}function A(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,A(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function N(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(V(e)+" is not iterable")}return v.prototype=y,i(T,"constructor",{value:y,configurable:!0}),i(y,"constructor",{value:v,configurable:!0}),v.displayName=l(y,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,l(t,c,"GeneratorFunction")),t.prototype=Object.create(T),t},e.awrap=function(t){return{__await:t}},S(C.prototype),l(C.prototype,a,function(){return this}),e.AsyncIterator=C,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new C(h(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then(function(t){return t.done?t.value:s.next()})},S(T),l(T,c,"Generator"),l(T,s,function(){return this}),l(T,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=N,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(c&&l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function M(t,e,n,r,i,o,s){try{var a=t[o](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}function H(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(t){M(o,r,i,s,a,"next",t)}function a(t){M(o,r,i,s,a,"throw",t)}s(void 0)})}}function U(t){var e=function(t){if("object"!=V(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=V(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==V(e)?e:e+""}var G={angry:"rgba(234, 78, 45, 1)",sad:"rgba(227, 119, 31, 1)",neutral:"rgba(224, 185, 10, 1)",happy:"rgba(28, 191, 151, 1)",excited:"rgba(85, 174, 218, 1)"},Q=Object.keys(G),z=function(){return e=function e(n){var r=n.parentContainer;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.parentContainer=r,this.baseClassName="csat_container",this.className="".concat(this.baseClassName,"_").concat(r.uniqueId),this.voteClassName="".concat(this.baseClassName,"_vote"),this.questionClassName="".concat(this.baseClassName,"_question"),this.thanksClassName="".concat(this.baseClassName,"_thanks"),this.hideClassName="csat_".concat(r.uniqueId,"_display_none"),this.steps=["vote",!!DATA.askOpenQuestion&&"question",!!DATA.isThankYouMessage&&"thanks","complete"].filter(function(t){return"string"==typeof t}),this.currentStep=t()?DATA.stepPreview:"vote",this.emojiChoice=NaN,this.currentNote=NaN,this.currentFeedback="",this.currentOpenQuestion=DATA.openQuestionPositive,this.emojisList=this.getEmojisList(),this.CSATContainer=document.createElement("div"),this.voteElement=null,this.questionElement=this.getQuestionElement(),this.thanksElement=this.getThanksElement(),this.CSATElement=null,this.styleElement=this.getStyleElement()},n=[{key:"getABtastyEmojis",value:(o=H(W().mark(function t(){var e,n=this;return W().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=function(){var t=H(W().mark(function t(e,r){var i,o,s;return W().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=r.iconUrl,t.next=3,e;case 3:return o=t.sent,t.next=6,n.fetchTastyEmojis(i);case 6:return s=t.sent,t.abrupt("return",[].concat(function(t){if(Array.isArray(t))return F(t)}(a=o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(a)||function(t,e){if(t){if("string"==typeof t)return F(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?F(t,e):void 0}}(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[s]));case 8:case"end":return t.stop()}var a},t)}));return function(e,n){return t.apply(this,arguments)}}(),t.next=3,this.emojisList.reduce(e,[]);case 3:window.abtastyEmojis=t.sent,this.emojisList.forEach(function(t,e){t.iconUrl=window.abtastyEmojis[e]});case 5:case"end":return t.stop()}},t,this)})),function(){return o.apply(this,arguments)})},{key:"insertIn",value:(i=H(W().mark(function t(e,n){var r;return W().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("abtasty"!==DATA.emojisType||null!==(r=window.abtastyEmojis)&&void 0!==r&&r.length){t.next=4;break}return t.next=4,this.getABtastyEmojis();case 4:return document.head.insertAdjacentElement("beforeend",this.styleElement),this.CSATElement=this.getCSATElement(),e.insertAdjacentElement(n,this.CSATElement),t.abrupt("return",this.showCurrentStep());case 8:case"end":return t.stop()}},t,this)})),function(t,e){return i.apply(this,arguments)})},{key:"setQuestion",value:function(){var t=DATA,e=t.layout,n=t.openQuestionPositive,r=t.openQuestionNeutral,i=t.openQuestionNegative,o=[i,i,r,n,n][this.emojiChoice]||n,s=this.questionElement.querySelector("textarea");return this.currentOpenQuestion=o,s.ariaLabel=o,["popin","bannerTop","bannerBottom"].includes(e)&&(this.parentContainer.domElement.ariaLabel=o),s.focus(),this.questionElement.querySelector("p").innerHTML=o,this}},{key:"getQuestionElement",value:function(){var e=this,n=DATA,r=n.openQuestionPositive,i=n.sendButtonText,o=document.createElement("div");o.className=this.questionClassName,o.innerHTML="<p>".concat(r,"</p>\n\t\t<textarea></textarea>\n\t\t<button>").concat(i,"</button>");var s=o.querySelector("button");return t()&&(s.dataset.abtastyActionnable="true"),s.addEventListener("click",function(){e.currentFeedback=o.querySelector("textarea").value,e.currentStep=e.steps[e.steps.indexOf(e.currentStep)+1],e.showCurrentStep()},{passive:!0,capture:!0,once:!0}),o}},{key:"getThanksElement",value:function(){var t=DATA,e=t.thanksMessage,n=t.layout,r=document.createElement("p");return r.className=this.thanksClassName,r.innerHTML=e,["popin","bannerTop","bannerBottom"].includes(n)&&(this.parentContainer.domElement.ariaLabel=e),r}},{key:"sendDatas",value:function(){return window.abtasty.send("event",{ec:"csat",ea:"Customer Satisfaction",ev:this.currentNote,el:DATA.mainQuestion,caid:TEST_ID,vaid:VARIATION_ID,cv:{0:"openEndedQuestion, ".concat(this.currentOpenQuestion),1:"openEndedAnswer, ".concat(this.currentFeedback),2:"maxScore, ".concat(DATA.emojisQty)}}),d("Sending datas, note: ".concat(this.currentNote,"/").concat(DATA.emojisQty,', feedback: "').concat(this.currentFeedback,'"')),this}},{key:"complete",value:function(){var t=this;this.parentContainer.recurrence.setValidationRecurrence();var e=DATA,n=e.autoHide,r=e.timeHide;return n?(this.CSATContainer.style.pointerEvents="none",setTimeout(function(){t.parentContainer.hide(!1),t.parentContainer.pageWatcher.clearWatcher(),t.parentContainer.closedByUser=!0,setTimeout(function(){return t.parentContainer.remove()},1e3)},1e3*r),this):this}},{key:"showCurrentStep",value:function(){var e=this,n=!t();return"complete"!==this.currentStep&&([this.voteElement,this.questionElement,this.thanksElement].forEach(function(t){return t.classList.add(e.hideClassName)}),this["".concat(this.currentStep,"Element")].classList.remove(this.hideClassName)),"question"===this.currentStep?this.setQuestion():["thanks","complete"].includes(this.currentStep)&&n?this.sendDatas().complete():this}},{key:"fetchTastyEmojis",value:(r=H(W().mark(function t(e){return W().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(e,{method:"GET",mode:"cors",cache:"no-cache",referrerPolicy:"no-referrer"}).then(function(t){return t.blob()}).then(function(t){return t.text()}).then(function(t){return t}).catch(function(t){return console.error("ERROR on loading picture, message: ".concat(t))});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}},t)})),function(t){return r.apply(this,arguments)})},{key:"getEmojisList",value:function(){var t=DATA.emojisType;return Q.map(function(e,n){var r;return{index:n,iconUrl:"abtasty"===t?null!==(r=window.abtastyEmojis)&&void 0!==r&&r.length?window.abtastyEmojis[n]:"".concat("https://widgets-images.abtasty.com/","csat/").concat(e,".svg"):"<img src='".concat(DATA["".concat(e,"EmojiCustom")],"'>"),iconText:DATA["".concat(e,"EmojiText")],className:"csatEmojiButton ".concat(e,"EmojiButton")}})}},{key:"onEmojiClick",value:function(t){var e=t.currentTarget;return isNaN(this.currentNote)&&(this.emojiChoice=Number(e.dataset.index),this.currentNote=Number(e.dataset.note)),this.currentStep=this.steps[this.steps.indexOf(this.currentStep)+1],this.showCurrentStep()}},{key:"getEmojiButton",value:function(e,n){var r=DATA,i=r.emojisType,o=r.mainQuestion,s=r.emojisQty,a=document.createElement("button");return a.className=e.className,a.dataset.index=e.index,a.dataset.note=n,a.ariaLabel="".concat(o," - ").concat(n,"/").concat(s),a.innerHTML="text"===i?e.iconText:e.iconUrl,t()&&(a.dataset.abtastyActionnable="true"),a.addEventListener("click",this.onEmojiClick.bind(this),{passive:!0,capture:!0}),a}},{key:"getEmojisContainer",value:function(){var e=this,n=DATA,r=n.emojisQty,i=n.stepPreview,o=n.mainQuestion,s=n.layout,a=document.createElement("p");a.innerHTML=o,["popin","bannerTop","bannerBottom"].includes(s)&&(this.parentContainer.domElement.ariaLabel=o);var c=document.createElement("div");c.className=this.voteClassName,c.appendChild(a);var l=[,,[0,4],[0,2,4],[0,1,3,4],[0,1,2,3,4]];return this.emojisList.forEach(function(t,n){if(l[r].includes(n)){var i=l[r].indexOf(n)+1,o=e.getEmojiButton(t,i);c.appendChild(o)}}),(t()&&"vote"!==i||"vote"!==this.currentStep)&&c.classList.add(this.hideClassName),c}},{key:"getCSATElement",value:function(){var t=DATA,e=t.askOpenQuestion,n=t.isThankYouMessage;return this.CSATContainer.classList.add("".concat(this.baseClassName),"".concat(this.className)),this.voteElement=this.getEmojisContainer(),this.CSATContainer.appendChild(this.voteElement),(e||"question"===this.currentStep)&&this.CSATContainer.appendChild(this.questionElement),(n||"thanks"===this.currentStep)&&this.CSATContainer.appendChild(this.thanksElement),this.CSATContainer}},{key:"getStyleElement",value:function(){var e=document.createElement("style");e.type="text/css",t()&&e.setAttribute("abtasty-script-added","true");var n=DATA,r=n.emojisType,i=n.customColors,o=n.emojisMargin,s=n.borderColor,a=n.textColor,c=n.backgroundColor,l=Q.reduce(function(t,e){var n=i?DATA["".concat(e,"Color")]:G[e],r=".csat_emoji_".concat(e," .csat_emoji_shadow,\n\t\t\t.csat_emoji_").concat(e," .csat_emoji_head {\n\t\t\t\tfill: ").concat(n,";\n\t\t\t}");return"".concat(t).concat(r)},""),h=["abtasty"===r?l:"",".csatEmojiButton {","all: unset !important;","margin: 0 ".concat(o,"px !important;"),"font-size: 30px !important;","cursor: pointer !important;","}",".csatEmojiButton svg {","overflow: visible;","pointer-events: none;","}",".csatEmojiButton .csat_emoji > * {","transform-origin: center;","transition: transform .5s ease;","}",".csatEmojiButton:hover .csat_emoji_shadow {","transform: scale(1.4);","}",".csatEmojiButton:hover .csat_emoji_shadow ~ * {","transform: scale(1.2);","}",".csat_emoji_shadow {","opacity: 0.1;","}",".csat_emoji_mouth,",".csat_emoji_eyebrow,",".csat_emoji_eye {","mix-blend-mode: multiply;","fill: rgb(57, 57, 57);","}",".csat_emoji_mouth,",".csat_emoji_eyebrow {","opacity: 0.5;","}"].join("");return e.textContent=[h,".".concat(this.questionClassName," textarea {"),"width: 100%;","min-height: 60px;","margin-top: 12px;","margin-bottom: 20px;","border: 2px solid ".concat(s,";"),"color: ".concat(a,";"),"}",".".concat(this.className," textarea::selection,\n\t\t\t.").concat(this.className," p::selection {"),"-webkit-text-fill-color: ".concat(c,";"),"text-fill-color: ".concat(c,";"),"color: ".concat(c,";"),"background-color: ".concat(s,";"),"}",".".concat(this.questionClassName," button {"),"cursor: pointer;","}",".".concat(this.voteClassName," p {"),"margin-bottom: 12px;","}","#".concat(this.parentContainer.widgetContainerId," .").concat(this.parentContainer.contentClassName," .").concat(this.className," {"),"overflow: hidden;","}",".".concat(this.className," > * {"),"opacity: 1;","height: auto;","}",".".concat(this.className," > .").concat(this.hideClassName," {"),"opacity: 0;","pointer-events: none;","transition: opacity 0.5s ease;","height: 0;","}"].join(""),e}}],n&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,U(r.key),r)}}(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r,i,o}();function K(t){return K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},K(t)}function Y(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Y=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof f?e:f,s=Object.create(o.prototype),a=new L(r||[]);return i(s,"_invoke",{value:$(t,n,a)}),s}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",p="executing",m="completed",g={};function f(){}function v(){}function y(){}var b={};l(b,s,function(){return this});var w=Object.getPrototypeOf,E=w&&w(w(N([])));E&&E!==n&&r.call(E,s)&&(b=E);var T=y.prototype=f.prototype=Object.create(b);function S(t){["next","throw","return"].forEach(function(e){l(t,e,function(t){return this._invoke(e,t)})})}function C(t,e){function n(i,o,s,a){var c=u(t[i],t,o);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==K(h)&&r.call(h,"__await")?e.resolve(h.__await).then(function(t){n("next",t,s,a)},function(t){n("throw",t,s,a)}):e.resolve(h).then(function(t){l.value=t,s(l)},function(t){return n("throw",t,s,a)})}a(c.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e(function(e,i){n(t,r,e,i)})}return o=o?o.then(i,i):i()}})}function $(e,n,r){var i=d;return function(o,s){if(i===p)throw Error("Generator is already running");if(i===m){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var c=A(a,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var l=u(e,n,r);if("normal"===l.type){if(i=r.done?m:"suspendedYield",l.arg===g)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.arg)}}}function A(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,A(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function N(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(K(e)+" is not iterable")}return v.prototype=y,i(T,"constructor",{value:y,configurable:!0}),i(y,"constructor",{value:v,configurable:!0}),v.displayName=l(y,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,l(t,c,"GeneratorFunction")),t.prototype=Object.create(T),t},e.awrap=function(t){return{__await:t}},S(C.prototype),l(C.prototype,a,function(){return this}),e.AsyncIterator=C,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new C(h(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then(function(t){return t.done?t.value:s.next()})},S(T),l(T,c,"Generator"),l(T,s,function(){return this}),l(T,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=N,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(c&&l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function J(t,e,n,r,i,o,s){try{var a=t[o](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}var X=function(){var t,e=(t=Y().mark(function t(){var e,n,r;return Y().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return d("Widget launch"),e=q(),n=e.domElement.querySelector(".".concat(e.contentClassName)),r=new z({parentContainer:e}),e.children=r,t.next=8,r.insertIn(n,"beforeend");case 8:return e.init(!0).then(function(t){return t.response&&e.show()}),t.abrupt("return",{parentContainer:e,CSAT:r});case 10:case"end":return t.stop()}},t)}),function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(t){J(o,r,i,s,a,"next",t)}function a(t){J(o,r,i,s,a,"throw",t)}s(void 0)})});return function(){return e.apply(this,arguments)}}();X()}();
|