/*! For license information please see offersHelper.min.js.LICENSE.txt */ (()=>{var e={5369:e=>{e.exports='
\n \n \n
\n'}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={exports:{}};return e[i](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e;!function(e){e.Command="command",e.RegisterPlugin="registerPlugin"}(e||(e={}));var t,i,o,r,s,a=n(5369),l=n.n(a);class c{static parse(e){if(c.isDomParserSupported())return(new DOMParser).parseFromString(e,"text/html").body.firstChild;{const t=document.createElement("div");return t.innerHTML=e,t}}static isDomParserSupported(){if(!window.DOMParser)return!1;const e=new DOMParser;try{e.parseFromString("x","text/html")}catch(e){return!1}return!0}}function d(){const e=window.document.getElementsByTagName("link"),t=[];for(let n=0;n"print"!==e.media.mediaText)).map((t=>{try{return Array.from(t.cssRules).filter((e=>/^\s*@font-face/.test(e.cssText))).map((e=>function(e,t){let n;return n=t?t.substring(0,t.lastIndexOf("/")+1):window.location.href.endsWith("/")?window.location.href:window.location.href.substring(0,window.location.href.lastIndexOf("/")+1),e.replace(/url\(['"]*(.*?)['"]*\)/gm,((e,t)=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")?e:0===t.indexOf("/")?`url("${window.location.origin}${t}")`:`url("${n}${t}")`))}(e.cssText,t.href||""))).join(" ")}catch(n){return n instanceof DOMException&&t.href&&e.push(t.href),""}})).filter((e=>!!e));return{externalStyleSheets:e,fontFaceCssRules:t}}()))}))}openOffer(e){var n;return m(this,void 0,void 0,(function*(){try{const o=yield this.offers.open(e);this.setPosition(o),(null===(n=e.contentOfferProperties)||void 0===n?void 0:n.displayMode)!==t.Overlay||(i=navigator.userAgent,(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(i)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(i.substr(0,4))||/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(i))&&function(){const e=document.getElementById("small-screen-indicator");return!window.getComputedStyle||!e||"block"===window.getComputedStyle(e).display}())||this.reposition(o)}catch(e){this.log.error("error retrieving position data")}var i}))}setPosition(e){const{overlay:t={},frame:n={}}=e,i=document.getElementById(this.OFFER_IFRAME_ID);if(i&&i.parentElement){const e=i.parentElement;Object.values(y).forEach((o=>{t[o]&&Object.assign(e.style,{[o]:t[o]}),void 0!==n[o]&&Object.assign(i.style,{[o]:n[o]})}))}}detectMessengerBubble(){const e=document.getElementById(this.MESSENGER_IFRAME_ID);if(!e)return{};const{x:t,width:n,height:i}=e.getBoundingClientRect();return 0===n||0===i?{}:t<110?{left:110}:{right:110}}reposition(e){var t;const n=null===(t=document.getElementById(this.OFFER_IFRAME_ID))||void 0===t?void 0:t.parentElement,{top:i,bottom:o,left:r,right:s}=e.overlay;if((!i||"unset"===i)&&n&&o&&"unset"!==o){const e=this.detectMessengerBubble();if(s&&"unset"!==s){const t=parseInt(s,10);n.style.right=`${Math.max(t,e.right||0)}px`}else if(r&&"unset"!==r){const t=parseInt(r,10);n.style.left=`${Math.max(t,e.left||0)}px`}}}}!function(e){e.Init="Offers.init",e.Open="Offers.open"}(f||(f={})),function(e){e.Ready="Offers.ready"}(u||(u={}));class p extends class{constructor(e){this.plugin=e}}{init(e){return this.plugin.command(f.Init,e)}open(e){return this.plugin.command(f.Open,e)}ready(){return new Promise((e=>this.plugin.subscribe(u.Ready,(()=>e(!0)))))}}class g{constructor(e){this.log=e,this.cxCommandName="close"}process(){return e=this,t=void 0,i=function*(){this.log(this.cxCommandName,"process()");const e=document.getElementById("genesys-co-frame");if(e){const t=e.parentElement;t&&(Object.values(y).forEach((n=>{Object.assign(t.style,{[n]:"unset"}),Object.assign(e.style,{[n]:"unset"})})),t.style.width="0",t.style.height="0"),e.style.width="0",e.style.height="0"}},new((n=void 0)||(n=Promise))((function(o,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}));var e,t,n,i}}var y,v,w=function(e,t,n,i){return new(n||(n=Promise))((function(o,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};!function(e){e.Width="width",e.Height="height",e.Top="top",e.Bottom="bottom",e.Left="left",e.Right="right",e.Position="position",e.BackgroundColor="backgroundColor",e.ZIndex="zIndex",e.Transform="transform"}(y||(y={})),function(e){e.Qualified="qualified",e.Offered="offered",e.Accepted="accepted",e.Rejected="rejected",e.Errored="engaged",e.Ignored="ignored"}(v||(v={}));class b{constructor(e){this.cxPlugin=e,this.staticAssetsUrl="",this.logger=function(e,t){const n=(...n)=>t.log(`${e}:`,...n);return n.info=(...n)=>t.log.info(`${e}:`,...n),n.warn=(...n)=>t.log.warn(`${e}:`,...n),n.error=(...n)=>t.log.error(`${e}:`,...n),n}("offers-helper-plugin",this.cxPlugin),this.deploymentConfig=this.cxPlugin.data("GenesysJS.deploymentConfig"),this.offers=new p(e)}initialize(){return w(this,void 0,void 0,(function*(){const e=!!this.deploymentConfig.headlessMode&&this.deploymentConfig.headlessMode.enabled;yield this.setStaticAssetsUrl(),e||(this.registerOpenCommand(),this.registerCloseCommand(),this.initializeEventHandler(),this.publishReady())}))}setStaticAssetsUrl(){return w(this,void 0,void 0,(function*(){var e,t,n;yield(e="ServiceDiscovery",t=this.cxPlugin,n=()=>{this.staticAssetsUrl=`${this.cxPlugin.data("ServiceDiscovery.uris.staticAssets")}`},new Promise((i=>{t.subscribe(`${e}.ready`,(()=>{n&&n(),i(e)}))})))}))}getOpenCommand(){return this.openCommand||(this.openCommand=new h(this.logger,this.offers,this.cxPlugin.data,this.staticAssetsUrl)),this.openCommand}registerCommand(e,t){this.cxPlugin.registerCommand(e,(({data:e})=>t(e)))}registerOpenCommand(){const e=this.getOpenCommand();this.registerCommand(e.cxCommandName,e.process.bind(e))}registerCloseCommand(){const e=new g(this.logger);this.registerCommand(e.cxCommandName,e.process.bind(e))}initializeEventHandler(){this.cxPlugin.subscribe("Journey.qualifiedContentOffer",(({data:e})=>w(this,void 0,void 0,(function*(){yield this.getOpenCommand().process(e)}))))}publishReady(){this.cxPlugin.ready()}}Genesys("registerPlugin","OffersHelper",(e=>{new b(e).initialize()}))})()})();