@rokt/dcui-orchestrator 0.2.1-rc.32 → 0.2.1-rc.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("react-dom/client"),a=require("react-redux"),i=require("ramda"),o=require("@emotion/css"),r=require("redux-saga/effects"),s=require("@reduxjs/toolkit"),l=require("redux-saga"),c=require("@redux-saga/core/effects"),d=require("embla-carousel-react"),u=require("insane"),p=require("@emotion/css/create-instance"),f=require("embla-carousel-autoplay"),m=require("embla-carousel-fade");function y(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var h=y(t);function v(e){const t=["elements","own"],n=["default","dimension","width","type"],a=["default","dimension","width","value"],o=["default","dimension","minWidth"],r=i.path(t,e);return r&&Array.isArray(r)&&r.length?i.assocPath(t,r.map(i.when(i.allPass([i.hasPath(n),i.complement(i.hasPath(o)),i.pathEq("fixed",n)]),(e=>i.assocPath(o,i.path(a,e),e)))),e):e}function g(e){const t="DISABLED"===e;return{tabIndex:t?-1:void 0,styles:t?{pointerEvents:"none",userSelect:"none"}:void 0,isDisabled:t}}function b(e,t){if("EscapeHatch"===t.type)try{return JSON.parse(t.node.data).type===e}catch(e){return!1}return!1}function I(){return"ontouchstart"in document.documentElement}function E(e){return null!=e&&"object"==typeof e&&("url"in e||"name"in e)&&"config"in e}function x(e){return null!=e&&"object"==typeof e&&"id"in e&&"action"in e&&"instanceGuid"in e&&"signalType"in e}function S(e){return x(e)&&"Fulfillment"===e.action}function C(e){return x(e)&&"Url"===e.action}function w(e){return x(e)&&"ExternalPaymentTrigger"===e.action}function O(e){return(S(e)||C(e))&&"RealTime"===e.conversionType&&"rclid"in e}function T(e){return(S(e)||C(e))&&"RealTimeReferral"===e.conversionType&&"rclid"in e}const A={pluginId:"shared",pageInstanceGuid:"N/A"};var j;!function(e){e.DCUI="DCUI",e.Partner="partner"}(j||(j={}));const R=["SignalCartItemQuantitySelected","SignalProductItemResponse"],N="ERROR",k="WARNING";class L extends Error{constructor(e,t){super(t),this.code=null!=e?e:"UNHANDLED_EXCEPTION"}toString(){return`CodedError (${this.code}): ${this.message}`}}const D=["V2_CART_ITEM_UPDATED","CART_ITEM_INSTANT_PURCHASE","OFFER_ENGAGEMENT","POSITIVE_ENGAGEMENT","UPSELL_CREATIVE_SENT","REALTIME_OFFER_FULFILLMENT_REFERRAL","REALTIME_OFFER_FULFILLMENT_CONVERSION","REALTIME_OFFER_FULFILLMENT_SUCCESS","INITIATE_INSTANT_PURCHASE_EVENT","PLACEMENT_CLOSED","PLACEMENT_COMPLETED","PLACEMENT_INTERACTIVE","PLACEMENT_FAILURE"];const _=(e,t)=>i.concat(e,i.slice(e.length,t.length,t)),P=(e,t)=>{if(Array.isArray(e)&&Array.isArray(t)){const n=e.length>t.length?_(t,e):t,a=t.length>e.length?_(e,t):e;return i.zipWith(B,a,n)}return t},$=e=>null==e,F=e=>!$(e),G=(e,t)=>$(t)?e:t,M=(e,t)=>{throw new L("MERGE_TYPE_INCONSISTENCY",`Unable to merge values for inconsistent types, left = ${e}, right = ${t}`)};function B(e,t){return i.cond([[(e,t)=>F(e)&&F(t)&&i.type(e)!==i.type(t)&&("Object"===i.type(e)||"Object"===i.type(t)),M],[(e,t)=>$(e)||$(t),G],[(e,t)=>"Object"===i.type(e),i.mergeDeepWith(B)],[(e,t)=>"Array"===i.type(e),P],[i.T,i.flip(i.unary(i.identity))]])(e,t)}function U(e,t){return B(e,t)}function V(e=0){return`breakpoint-${e}px`}function z(e,t){return t?`${t}-child${e}`:void 0}const q="GLOBAL/RAISE_METRIC",H="GLOBAL/OFFER_ENGAGEMENT";function W(e){return null!=e&&"object"==typeof e&&"responseOption"in e&&S(e.responseOption)&&"fulfillment"in e&&E(e.fulfillment)}function K(e){return w(e)}function Y(e){return C(e)}function J(e){return function(e){return x(e)&&"CaptureOnly"===e.action}(e)}function Z(e){return!!(O(e)||"responseOption"in e&&O(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}function Q(e){return!!(T(e)||"responseOption"in e&&T(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}const X="GLOBAL/RAISE_SIGNAL",ee="GLOBAL/OFFER_LIFECYCLE",te="GLOBAL/SET_CUSTOM_STATE",ne="GLOBAL/SEND_PARTNER",ae="GLOBAL/SET_DOMAIN_STATE",ie="GLOBAL/PREPARE_SIGNAL",oe="GLOBAL/OPEN_LINK",re="GLOBAL/SET_PARTNER_VALIDATION_STATUS",se="GLOBAL/SET_GLOBAL_OFFER_DATA_CART",le="GLOBAL/LAUNCH_CHILD_LAYOUT",ce={RAISE_METRIC:q,PREPARE_SIGNAL:ie,OFFER_ENGAGEMENT:H,RAISE_SIGNAL:X,OFFER_LIFECYCLE:ee,SEND_PARTNER:ne,SET_CUSTOM_STATE:te,SET_DOMAIN_STATE:ae,OPEN_LINK:oe,SET_PARTNER_VALIDATION_STATUS:re,SET_GLOBAL_OFFER_DATA_CART:se,LAUNCH_CHILD_LAYOUT:le},de="data-open-in-app",ue="data-click-signal-context";function pe(e,n){function a(e){var t;if(!(e.target&&e.target instanceof HTMLElement))return;const a=null===(t=e.target)||void 0===t?void 0:t.closest("a");if(a){const t=a.getAttribute("href"),i=a.getAttribute(ue);if(i&&n({type:X,payload:{name:"SignalUserInteraction",action:"Click",context:i}}),t){e.preventDefault();let i="newTab";a.hasAttribute(de)&&(i="inApp"),n({type:oe,payload:{url:t,urlBehaviour:i}})}}}t.useEffect((()=>null!==e?(e.addEventListener("click",a),()=>{e.removeEventListener("click",a)}):()=>{}),[e])}function fe(){const e=t.useRef(null);return t.useEffect((()=>{const t=t=>{"Tab"===t.key&&me(t,e)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)}),[e]),e}const me=(e,t)=>{var n;const a=null===(n=t.current)||void 0===n?void 0:n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!a)return;const i=a[0],o=a[a.length-1],{activeElement:r}=window.document;if(1!==a.length)return r===i&&e.shiftKey?(o&&o.focus(),void e.preventDefault()):r!==o||e.shiftKey?void 0:(i&&i.focus(),void e.preventDefault());e.preventDefault()},ye=i.sortBy(i.prop(1)),he=i.map(i.prop(0)),ve="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DISPLAY_ERRORS:"true",REPORT_RENDER_ERRORS:"true",USE_MEDIA_QUERY_NESTING:"true"};function ge(e,t){return t?"false"!==ve.USE_MEDIA_QUERY_NESTING?`${n=e,`@media (min-width: ${n}px)`} {${t}}`:t.includes(" & ")?`#app-container.${V(e)} ${t.trim()}`:`#app-container.${V(e)} & {${t}}`:"";var n}const be={hovered:":hover",pressed:":active",focussed:":focus",disabled:":disabled"};function Ie(e){return function(e){return Object.keys(be).indexOf(e)>-1}(e)?be[e]:""}const Ee={container:{justifyContent:"justify-content",alignItems:"align-items",shadow:"box-shadow",gap:"gap",overflow:"overflow",blur:"filter",opacity:"opacity"},text:{textColor:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",lineHeight:"line-height",lineLimit:"",letterSpacing:"letter-spacing",baselineTextAlign:"vertical-align",horizontalTextAlign:"text-align",textDecoration:"text-decoration",textTransform:"text-transform"},background:{backgroundColor:"background-color",backgroundImage:""},dimension:{width:"width",maxWidth:"max-width",minWidth:"min-width",height:"height",maxHeight:"max-height",minHeight:"min-height",rotateZ:"transform"},flexChild:{alignSelf:"align-self",weight:"flex",order:"order"},spacing:{margin:"margin",padding:"padding",offset:""},border:{borderColor:"border-color",borderRadius:"border-radius",borderWidth:"border-width",borderStyle:"border-style"}};function xe(e,t){if(!Ee[e]||!Ee[e][t])throw new Error(`No CSS property mapping exists for styling property: ${e}.${t.toString()}`);return Ee[e][t]}function Se(e,t){return n=>t(...Object.keys(e).map((t=>e[t](n[t]))))}function Ce(...e){let t="";const n=(...e)=>e.reduce(((e,n)=>(e&&n?e=e+t+n:n&&(e=n),e)),"");return 1===e.length?(t=e[0],n):n(...e)}function we(e,t){return`${e}:${t};`}function Oe(e){return function(e,t){return`@media (${e}) {${t}}\n`}("prefers-color-scheme: dark",e)}class Te extends Error{constructor(e,t){super(`Invalid styling value '${t}': ${e}.`),this.name=this.constructor.name}}function Ae(e,t){if(null===t)return!1;const n=("function"==typeof e?[e]:e).map((e=>e(t))).reduce(((e,t)=>t?e?e+=`, ${t}`:t:e),void 0);if(n)throw new Te(n,JSON.stringify(t));return!0}function je(e){if(isNaN(e)||"number"!=typeof e&&"string"!=typeof e)return"value must be a number"}function Re(e){return t=>{const n=t&&"symbol"!=typeof t?t.toString():t;if(!(e.indexOf(n)>=0))return`value must be one of [${e.join(",")}]`}}function Ne(e){if(null==e||""===e)return"value must not be omitted"}function ke(e){const t=new RegExp(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/);if("string"!=typeof e||!t.test(e))return"value must be a valid hex color"}function Le(e){const t=new RegExp(/^(?:(?:data:image\/[^;]+;base64[^"]+)|(?:(?:https?:)?\/\/[a-zA-Z\d-]+(?:\.[a-zA-Z\d-]+)*(?::\d{1,10})?)?(?:\.\.?\/?)*\/(?:[a-zA-Z\d\-_]+\/)*[a-zA-Z\d\-_]+\.[a-zA-Z\d]{2,6}(?:\?(?:.+=.+&?)*)?)(?:#.+)?$/);if("string"!=typeof e||!t.test(e))return"value must be a valid CSS URL string"}function De(e){if(null!=e&&""!==e)return"value must not be specified"}function _e(e){return t=>{if(t&&"object"==typeof t&&"value"in t&&"type"in t&&"string"==typeof t.type&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t.type)&&"function"==typeof e[t.type]){const n=e[t.type](t.value);if(!n)return;return`object must have valid "value" for type: ${t.type}: ${n}`}return`value must be an object that has a "type" property that matches one of: [${Object.keys(e).join(", ")}] and a "value" property`}}function Pe(...e){return t=>{if("string"==typeof t){const n=t.split(" ");if(n.length>1&&e.indexOf(n.length)>-1){if(!n.reduce(((e,t)=>e||je(t)),void 0))return}}return`value must be a space separated list of numbers, of one of the following lengths: ${e.join(" ,")}`}}function $e(e,t){return n=>{const a=e(n),i=t(n);if(a&&i)return`one of these must be true: ${a} -OR- ${i}`}}function Fe(e){if("string"!=typeof e)return"value must be a string"}const Ge=i.is(Object);function Me(e){const t=Object.entries(e);return n=>Ge(n)&&!Array.isArray(n)?t.reduce(((e,[t,a])=>e||a(n[t])),void 0):`Input value (${e}) must be an object`}function Be(e){if("number"!=typeof e&&"string"!=typeof e||isNaN(e)||!(e>=0))return"value must be a positive number"}function Ue(e,t,n){return Ae(je,n)?we(xe(e,t),`${n}`):""}function Ve(e){return(t,n,a)=>Ae(Re(Object.keys(e)),a)?we(xe(t,n),`${e[a]}`):""}function ze(e){return Ae(Ne,e)?Se({light:t(Le,!1),dark:t($e(De,Le),!0)},Ce("\n "))(e):"";function t(e,t){return n=>{if(Ae(e,n)&&n){const e=we("background-image",`url("${n}")`);return t?Oe(e):e}return""}}}function qe(e){const t={crop:"auto",fit:"contain",fill:"cover"};return"string"==typeof e&&(e=e.toLowerCase()),Ae($e(De,Re(Object.keys(t))),e)&&e?we("background-size",t[e]):""}const He=i.cond([[i.equals("top-left"),i.always("top left")],[i.equals("top-right"),i.always("top right")],[i.equals("bottom-left"),i.always("bottom left")],[i.equals("bottom-right"),i.always("bottom right")],[i.T,i.identity]]);function We(e){const t="string"==typeof e?e.toLowerCase():e;return Ae($e(De,Re(["top","right","bottom","left","center","top-left","top-right","bottom-left","bottom-right"])),t)&&t?we("background-position",He(t)):""}function Ke(e,t,n){return Ae($e(je,Pe(2,3,4)),n)?we(xe(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function Ye(e){return(t,n,a)=>Ae(_e({fit:Re(e),percentage:je,fixed:je}),a)?we(xe(t,n),Je(a)):""}function Je(e){const t={"wrap-content":"fit-content","fit-width":"100%","fit-height":"100%"};switch(e.type){case"fixed":return`${e.value}px`;case"percentage":return`${e.value}%`;case"fit":return t[e.value]}}const Ze=Me({light:ke,dark:$e(De,ke)});function Qe(e,t,n){return a=>{if(a){const i=we(xe(e,t),et(String(a)));return n?Oe(i):i}return""}}function Xe(e,t,n){return Ae(Ze,n)?Se({light:Qe(e,t,!1),dark:Qe(e,t,!0)},Ce("\n "))(n):""}function et(e){const t=e.toUpperCase();switch(t.length){case 5:return`#${t.substring(2,5)}${t[1]}`;case 9:return`#${t.substring(3,9)}${t[1]}${t[2]}`;default:return t.toUpperCase()}}const tt=Me({offsetX:$e(De,je),offsetY:$e(De,je),blurRadius:$e(De,je),spreadRadius:$e(De,je),color:Ze}),nt=e=>t=>null!=t?String(t):e,at=i.compose(i.concat(i.__,"px"),nt("0")),it=e=>t=>"string"==typeof t?e(t):t,ot=i.compose(it(i.concat(i.__,"px")),nt(void 0)),rt=i.compose(it(et),i.prop("dark"));function st(e,t,n){return we(e,Se({offsetX:at,offsetY:at,blurRadius:t.spreadRadius?at:ot,spreadRadius:ot,color:n},Ce(" "))(t))}const lt={center:"center","flex-end":"flex-end","flex-start":"flex-start",stretch:"stretch"},ct={container:{justifyContent:Ve(lt),alignItems:Ve(lt),shadow:function(e,t,n){var a,o,r;if(Ae(tt,n)){const s=xe(e,t);return Ce("\n")(st(s,n,(o="light",r="#80000000",i.compose(et,i.propOr(r,o)))),(null===(a=n.color)||void 0===a?void 0:a.dark)?Oe(st(s,n,rt)):"")}return""},gap:Ke,overflow:Ve({hidden:"hidden",visible:"visible"}),blur:function(e,t,n){return Ae(Be,n)?we(xe(e,t),`blur(${n.toString()}px)`):""},opacity:Ue},text:{textColor:Xe,fontSize:Ke,fontFamily:function(e,t,n){return Ae(Fe,n)?we(xe(e,t),(a=`${n}`,a.replace(/['();{}@:[\]!/=]/g,"")).split(",").map(((e,t)=>{const n=0===t?e:e.trim();if(n.includes(" ")){const e=n.startsWith('"')?"":'"',t=n.endsWith('"')?"":'"';return`${e}${n}${t}`}return n})).join(",")):"";var a},fontWeight:Ve({100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900}),fontStyle:Ve({normal:"normal",italic:"italic"}),lineHeight:Ke,lineLimit:function(e,t,n){return Ae(je,n)?`\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: ${n};\n line-clamp: ${n}; \n -webkit-box-orient: vertical;\n `:""},letterSpacing:Ke,baselineTextAlign:Ve({super:"super",sub:"sub",baseline:"baseline"}),horizontalTextAlign:Ve({left:"left",right:"right",center:"center",start:"start",end:"end",justify:"justify"}),textDecoration:Ve({underline:"underline","strike-through":"line-through",none:"none"}),textTransform:Ve({capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",none:"none"})},background:{backgroundColor:Xe,backgroundImage:function(e,t,n){return Ae(Ne,n)?Se({url:ze,position:We,scale:qe},Ce)(n):""}},dimension:{width:Ye(["wrap-content","fit-width"]),maxWidth:Ke,minWidth:Ke,height:Ye(["wrap-content","fit-height"]),maxHeight:Ke,minHeight:Ke,rotateZ:(dt="Z",(e,t,n)=>{const a=`rotate${dt}`;return Ae(je,n)?we(xe(e,t),`${a}(${n.toString()}deg)`):""})},flexChild:{alignSelf:Ve(lt),weight:Ue,order:Ue},spacing:{margin:Ke,padding:Ke,offset:function(e,t,n){return Ae(Pe(2),n)?`transform:translate(${n.split(" ").join("px, ")}px);`:""}},border:{borderColor:Xe,borderRadius:Ke,borderWidth:Ke,borderStyle:Ve({solid:"solid",dashed:"dashed"})}};var dt;function ut(e){return Object.keys(e).reduce(((t,n)=>(n&&e[n]&&Object.keys(e[n]).forEach((a=>{if(!ct[n])throw new Error(`No styling transformers exist for styling category key: ${n}`);const i=ct[n][a];if(!i)throw new Error(`No styling transformer exists for property: ${n}.${a.toString()}`);try{t+=i(n,a,e[n][a])}catch(e){throw e&&"object"==typeof e&&"message"in e&&(e.message=`Error parsing styling key ${n}.${a.toString()}: ${e.message}`),e}})),t)),"")}const pt="FAILED_TEMPLATING_DATA",ft=new Map;function mt(e){return String.fromCharCode(97+e)}function yt(e,t,n){const a=`${e||A.pluginId}-${void 0!==t?String(t):"outer"}`,i=ft.get(a);if(i&&i.sheet.container.isConnected)return i.css;const o=function(e,t){const n={key:void 0!==e?`inner-css-${mt(e)}`:"outer-css",container:t};return t&&t.parentElement&&(n.container=t.parentElement),p(n)}(t,n);return ft.set(a,o),o.css}const ht="%%%OWN_CLASS_REF%%%",vt=i.memoizeWith(((e,t,n,a)=>`${String(e)}-${t}-${n}`),gt);function gt(e,t,n,a){const i=yt(t,n,a);let o=1;return function t(n,a=!1){var r;if("string"==typeof n){const e={scopeClass:n};return t.bind(e)}const s=n,l=this.scopeClass,c=Object.entries(null!==(r=s.elements)&&void 0!==r?r:{});try{const t=c.reduce(((t,[n,i])=>Object.assign(Object.assign({},t),{[n]:bt(i,l,a,String(n),e)})),{}),n=Object.entries(t),r=a?"parent-"+o++:"",s=function(e){return"own"in e&&"string"==typeof e.own&&e.own.length>0}(t)?i(t.own):"";return n.reduce(((e,[t,n=""])=>{if("own"===t)return e;const a=n.replace(ht,r);return Object.assign(Object.assign({},e),{[t]:a?i(a):""})}),{own:`${s}${s&&r?" ":""}${r}`})}catch(e){const t=e;throw t.code="FAILED_PARSING_STYLES",t}}.bind({})}function bt(e,t,n,a,i){return e.map(function(e,t,n){return a=>Object.entries(a).map((([a,i])=>{const o=i?ut(i):"";switch(!0){case"default"===a:return o?`\n${o}\n`:"";case Boolean(e):return`\n .${e}${Ie(a)} & {\n${o}\n}\n`;case t&&"own"!==n:return`\n .${ht}${Ie(a)} & {\n${o}\n}\n`;default:return`\n &${Ie(a)} {\n${o}\n}\n`}})).join("")}(t,n,a)).reduce(((e,t,n)=>{const a=i[n];return void 0!==a?e+(0===n?t:`${ge(a,t)}\n`):e}),"")}const It=t.createContext(i.always(void 0)),Et=()=>t.useContext(It),xt=t.createContext(null);function St(e,n){var a;const i=t.useContext(xt);return i&&null!==(a=n(i))&&void 0!==a?a:e}const Ct=t.createContext((()=>{throw Error("Node Mapper Context does not have a mapper. Use the NodeMapperProvider with the default nodeMapper as a value before you consume this mapper")})),wt=Ct.Consumer,Ot=()=>t.useContext(Ct),Tt=e=>t.createElement(Ct.Provider,{value:(t,n,a)=>e.value(t,null!=n?n:e.overrides,a)},e.children),At=t.createContext(null),jt=()=>t.useContext(At),Rt=t.createContext({get(){throw Error("Offer context has not been set")}}),Nt=e=>t.createElement(Rt.Provider,{value:{get:()=>e.context}},e.children),kt=()=>t.useContext(Rt).get(),Lt=()=>{try{return t.useContext(Rt).get().creative.copy}catch(e){return}},Dt=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),_t=i.compose(i.not,i.isEmpty),Pt=i.where({url:_t,title:_t});function $t(e,t,n){return t.reduce(((t,n)=>{const[a,i]=n.slice(0,-1).split("["),o=i?i.split(","):[];if(!a)throw new Error(Gt(e,"This Meta Attribute could not be parsed."));return function(e,t,n,a){switch(t){case"openLinks":return function(e,t,n){Ft(t,e,"openLinks",1,2);const a=Mt(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),i=Bt(t,1,(e=>"string"==typeof e&&e.length?e:null));if("InApp"===a)return n.replace(Dt,((e,t)=>`<a ${de} ${i?`${ue}="${i}" `:""}${t}`));return n}(e,n,a);case"sliceText":return function(e,t,n){Ft(t,e,"sliceText",2,2);const a=Mt(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),i=Mt(t,e,1,(e=>{const t=Number(e);return!Number.isNaN(t)&&t>=0?t:null}),"sliceText meta attribute second argument must be a positive number");if("Chars"===a)return function(e,t){const n=new RegExp("(?<=<a.*>).*(?=</a>)");return e.startsWith("<a")?e.replace(n,(e=>e.slice(0,t))):e.slice(0,t)}(n,i);throw Error(Gt(e,`Unknown "SliceBy" value. ${a}`))}(e,n,a);default:throw new Error(Gt(e,`Unknown Meta Attribute '${t}'.`))}}(e,a,o,t)}),n)}function Ft(e,t,n,a,i){const o=new Error(Gt(t,`${n} meta attribute takes ${a!=i?`between ${a} and ${i}`:a} arguments; received ${e.length}.`));if(e.length<a||e.length>i)throw o}function Gt(e,t){return`Malformed Meta Attribute: '${e}' - ${t}`}function Mt(e,t,n,a,i){const o=Bt(e,n,a);if(null!==o)return o;throw Error(Gt(t,i||`Could not parse meta attribute argument at index ${n} from arguments ${JSON.stringify(e)}`))}function Bt(e,t,n){return n(e[t])}const Ut="DATA",Vt="STATE",zt=new RegExp(`^(${Ut}|${Vt})`),qt=new RegExp(`^${Vt}`),Ht=new RegExp(`%\\^(?:${Ut}|${Vt})\\.[a-zA-Z0-9]+[a-zA-Z0-9\\.]*(?:\\:[a-zA-Z0-9]+\\[[a-zA-Z0-9\\.,]*\\])*(?:\\|.*?)?\\^%`,"g"),Wt=Symbol("invalid");function Kt(e,t="creativeCopy"){const n=Yt({data:e},t);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Yt(t,n,this.dataMap)});let a=!1;const o=t,r=i.pipe(i.slice(2,-2),i.split("|"),(e=>{const t=i.reduce(((e,t)=>{let n;if(zt.test(t)){if(!this.dataMap.has(t)&&qt.test(t))throw new L(pt,`Invalid use of STATE template key in a context it does not exist: ${t}`);const a=i.split(":",t);if(a[0]){if(n=this.dataMap.get(a[0]),n&&n===Wt)throw new L(pt,`Invalid template key referenced: "${t}" is an object but expected a string, boolean, number or empty. \nDid you mean to reference a child property of ${t}?`);if(a.length>1&&n)try{n=$t(a[0],a.slice(1),n)}catch(e){throw new L(pt,`Failed to apply meta attributes. ${function(e){return null!=e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:String(e)}(e)}`)}}return n?i.reduced({provided:!0,value:n}):e}return i.reduced({provided:!0,value:t})}),{provided:!1,value:""},e);return t.provided||(a=!0),t.value})),s=i.replace(Ht,r,o);return!1===a?s:""}.bind({dataMap:n})}function Yt(e,t,n){const a=new Map(n);return"data"in e&&o(e.data,`${Ut}${t?"."+t:""}`),"state"in e&&o(e.state,`${Vt}${t?"."+t:""}`),a;function o(e,t){"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e?a.set(t,(null==e?void 0:e.toString())||""):a.set(t,Wt),e&&"object"==typeof e&&i.forEachObjIndexed(((e,n)=>o(e,`${t}.${n}`)),e)}}const Jt=t.createContext(Kt({})),Zt=Jt.Consumer,Qt=Jt.Provider,Xt=()=>t.useContext(Jt),en=t.createContext(null),tn=en.Provider,nn=t.createContext("OUTER"),an=()=>"VARIANT"===t.useContext(nn),on=t.createContext(void 0),rn=()=>t.useContext(on);var sn,ln,cn,dn,un,pn,fn=function(e,t,n,a){return new(n||(n=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((a=a.apply(e,t||[])).next())}))},mn=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n},yn=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};class hn{constructor(e,t,n,a,o){sn.set(this,void 0),ln.set(this,void 0),cn.set(this,new Set),dn.set(this,void 0),un.set(this,void 0),pn.set(this,void 0),mn(this,sn,i.partial(e.subscribe.bind(e),[n]),"f"),mn(this,ln,i.partial(e.dispatch.bind(e),[n]),"f"),mn(this,dn,t,"f"),mn(this,un,a,"f"),mn(this,pn,o,"f"),this.onGlobalStateChange=this.onGlobalStateChange.bind(this),this.onInteractivityChange=this.onInteractivityChange.bind(this),this.onEvent=this.onEvent.bind(this),this.globalDispatch=this.globalDispatch.bind(this),this.createChildPlugin=this.createChildPlugin.bind(this)}onGlobalStateChange(e){const t=yn(this,sn,"f").call(this,e),n=()=>{t(),yn(this,cn,"f").delete(n)};return yn(this,cn,"f").add(n),n}onInteractivityChange(e){return yn(this,un,"f").subscribe(e)}onEvent(...e){const t=e.reduce(((e,t)=>{if("partner"===t.source||"*"===t.source){const n=yn(this,pn,"f").call(this,t.name).subscribe(t.callback);return[...e,()=>n.unsubscribe()]}return e}),[]),n=()=>{t.forEach((e=>{e()})),yn(this,cn,"f").delete(n)};return yn(this,cn,"f").add(n),n}globalDispatch(e){yn(this,ln,"f").call(this,e)}dispose(){yn(this,cn,"f").forEach((e=>e())),mn(this,cn,new Set,"f"),yn(this,un,"f").clear()}createChildPlugin(e){return yn(this,dn,"f").call(this,e)}}sn=new WeakMap,ln=new WeakMap,cn=new WeakMap,dn=new WeakMap,un=new WeakMap,pn=new WeakMap;class vn{onGlobalStateChange(){return()=>{}}onInteractivityChange(){return()=>{}}onEvent(){return()=>{}}globalDispatch(){}dispose(){}createChildPlugin(){return{close:()=>fn(this,void 0,void 0,(function*(){})),onClose:()=>fn(this,void 0,void 0,(function*(){})),putConfig:()=>fn(this,void 0,void 0,(function*(){})),send:()=>fn(this,void 0,void 0,(function*(){})),onEvent:()=>({subscribe:()=>({unsubscribe:()=>{}})})}}}var gn,bn,In=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n},En=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};class xn{constructor(e){gn.set(this,void 0),bn.set(this,new Set),In(this,gn,e,"f")}subscribe(e){return En(this,bn,"f").add(e),!0===e(En(this,gn,"f"))&&En(this,bn,"f").delete(e),()=>{En(this,bn,"f").delete(e)}}publish(e){In(this,gn,e,"f"),En(this,bn,"f").forEach((e=>{!0===e(En(this,gn,"f"))&&En(this,bn,"f").delete(e)}))}clear(){En(this,bn,"f").clear()}}gn=new WeakMap,bn=new WeakMap;var Sn=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)},Cn=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n};const wn="breakpoint-0px";class On{constructor(){this.logger=()=>{}}withAppFactory(e){return this.appFactory=e,this}withLogger(e){return this.logger=e,this}withGatewayFactory(e){return this.gatewayFactory=e,this}build(){var e,t,n,a,i,o,r,s,l,c,d,u,p,f;const m=this.appFactory,y=this.logger,h=null!==(e=this.gatewayFactory)&&void 0!==e?e:()=>new vn;return f=class extends HTMLElement{static get observedAttributes(){return["visible","interactivity","active-breakpoint"]}constructor(){super(),t.add(this),n.set(this,(()=>null)),a.set(this,(()=>null)),i.set(this,void 0),o.set(this,!1),r.set(this,null),s.set(this,null),l.set(this,null);const e=this.attachShadow({mode:"open"});Cn(this,i,document.createElement("div"),"f"),Sn(this,i,"f").id="app-container",Sn(this,i,"f").classList.add("default"),e.appendChild(Sn(this,i,"f"))}attributeChangedCallback(e,i,o){if(o!==i)switch(e){case"visible":Sn(this,n,"f").call(this,"true"===o);break;case"interactivity":"ENABLED"!==o&&"DISABLED"!==o||Sn(this,a,"f").call(this,o);break;case"active-breakpoint":Sn(this,t,"m",c).call(this,o,i)}}makeInteractivityUpdateHandler(e){Cn(this,a,(t=>{e.publish(t)}),"f")}makeVisbilityUpdateHandler(e,a,i){const o="true"===this.getAttribute("visible"),r=this.getAttribute("slotInstanceGuid");Cn(this,n,(o=>{o?(Cn(this,n,(()=>null),"f"),0===e&&i.globalDispatch({type:ee,payload:{event:"Interactive"}}),a&&(i.globalDispatch({type:X,payload:{name:"SignalImpression",parentGuid:a}}),this.trackViewability(a,i)),r&&i.globalDispatch({type:X,payload:{name:"SignalImpression",parentGuid:r}})):Sn(this,t,"m",p).call(this)}),"f"),Sn(this,n,"f").call(this,o)}trackViewability(e,n){if(!Sn(this,o,"f"))if("IntersectionObserver"in window&&!Sn(this,r,"f")){const a=()=>{Sn(this,o,"f")||(n.globalDispatch({type:X,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!0}}),Cn(this,o,!0,"f"),Sn(this,t,"m",p).call(this),Sn(this,i,"f").removeEventListener("click",a))};Sn(this,i,"f").addEventListener("click",a),Cn(this,r,new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=.5?Sn(this,t,"m",u).call(this,(()=>{Sn(this,o,"f")||(n.globalDispatch({type:X,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!1}}),Cn(this,o,!0,"f"),Sn(this,t,"m",p).call(this),Sn(this,i,"f").removeEventListener("click",a))})):Sn(this,t,"m",d).call(this)}))}),{threshold:.5}),"f"),Cn(this,l,(()=>{var e,n;"visible"===document.visibilityState?null===(e=Sn(this,r,"f"))||void 0===e||e.observe(Sn(this,i,"f")):(Sn(this,t,"m",d).call(this),null===(n=Sn(this,r,"f"))||void 0===n||n.disconnect())}),"f"),document.addEventListener("visibilitychange",Sn(this,l,"f")),Sn(this,l,"f").call(this)}else n.globalDispatch({type:X,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!1,inferred:!1}}),Cn(this,o,!0,"f")}getOfferPositionAttr(){const e=this.getAttribute("offerPositionIndex"),t=Number(e);return(null==e||isNaN(t)||t<0)&&v(`Offer position attribute (${e}) is invalid`),t}getJSONAttr(e,t="{}"){const n=this.getAttribute(e);try{return JSON.parse(null!=n?n:t)}catch(t){v(`Invalid JSON attribute ${e}: ${n}`)}}disconnectedCallback(){Sn(this,t,"m",p).call(this)}connectedCallback(){var e,t,n;const a=this.getAttribute("container"),o=this.getAttribute("plugin-id");Sn(this,i,"f").setAttribute("style","width:100%;display:flex;flex-direction:"+("column"===a?"column":"row"));const r=this.getOfferPositionAttr(),s=this.getJSONAttr("layoutSchema"),l=this.getJSONAttr("childLayouts","[]"),c=this.getJSONAttr("offerData"),d=new xn("DISABLED"===this.getAttribute("interactivity")?"DISABLED":"ENABLED"),u=null!==(e=this.getAttribute("schemaVersion"))&&void 0!==e?e:"",p=this.getJSONAttr("offerState","{}");m||v("Cannot create app without factory. Please build the connector withAppFactory.");const f=h({offerPositionIndex:r,creativeInstanceGuid:null===(t=null==c?void 0:c.creative)||void 0===t?void 0:t.instanceGuid},d);this.makeInteractivityUpdateHandler(d),m({rootElement:Sn(this,i,"f"),gateway:f,logger:y,offerPositionIndex:r,offerData:c,layoutSchema:s,childLayouts:l,schemaVersion:u,pluginId:o||A.pluginId,offerState:p}),this.makeVisbilityUpdateHandler(r,null===(n=null==c?void 0:c.creative)||void 0===n?void 0:n.instanceGuid,f)}},n=new WeakMap,a=new WeakMap,i=new WeakMap,o=new WeakMap,r=new WeakMap,s=new WeakMap,l=new WeakMap,t=new WeakSet,c=function(e,t){Sn(this,i,"f").classList.remove(t||wn),Sn(this,i,"f").classList.add(e||wn)},d=function(){Sn(this,s,"f")&&(clearTimeout(Sn(this,s,"f")),Cn(this,s,null,"f"))},u=function(e){Sn(this,t,"m",d).call(this),Cn(this,s,window.setTimeout(e,1e3),"f")},p=function(){Sn(this,t,"m",d).call(this),Sn(this,r,"f")&&(Sn(this,r,"f").disconnect(),Cn(this,r,null,"f")),Sn(this,l,"f")&&(document.removeEventListener("visibilitychange",Sn(this,l,"f")),Cn(this,l,null,"f"))},f;function v(e){throw y({level:N,code:"MODULE_BUILDER/FAILED_TO_BUILD_MODULE",message:e}),Error(e)}}}const Tn=t.createContext({get:()=>new vn}),An=e=>t.createElement(Tn.Provider,{value:{get:()=>e.context}},e.children);const jn=t.createContext({get(){throw Error("Layout Schema context has not been set")}}),Rn=e=>t.createElement(jn.Provider,{value:{get:()=>e.context}},e.children),Nn=()=>t.useContext(jn).get(),kn=t.createContext("ENABLED"),Ln=()=>t.useContext(kn);function Dn(e){const t=Pn(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Pn(t,this.dataMap)});if(!n)throw new L("FAILED_TO_MAP_STATIC_DATA","No namespace submitted to StaticData Mapper");const a=t;return i.path([n,a],this.dataMap)}.bind({dataMap:t})}const _n={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function Pn(e,t=_n){return["images","links","icons","copy","responseOptionsMap"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Object.assign(Object.assign({},t[n]),e[n])})),t)}const $n=t.createContext(Dn({}));$n.Consumer;const Fn=$n.Provider,Gn=e=>{const n=t.useContext($n),a=e.split("|");for(const e of a){const t=n(e.trim(),"images");if(t)return t}},Mn=()=>t.useContext($n),Bn=t.createContext({});function Un({info:e,children:n}){const a=t.useContext(Bn);return t.createElement(Bn.Provider,{value:Object.assign(Object.assign({},a),e)},n)}const Vn=t.createContext({get(){throw Error("Catalog Item context has not been set")}}),zn=e=>t.createElement(Vn.Provider,{value:{get:()=>e.context}},e.children),qn=()=>t.useContext(Vn).get(),Hn=t.createContext(""),Wn=()=>t.useContext(Hn),Kn=t.createContext(""),Yn=t.createContext(void 0);function Jn({children:e}){const n=t.useMemo((()=>{const e=document.createElement("div");return e.inert=!0,{inert:!0===e.inert}}),[]);return t.createElement(Yn.Provider,{value:n},e)}const Zn=i.compose(i.anyPass([i.isEmpty,i.all(i.isEmpty)]),i.flatten,i.map(i.values),i.map(i.ifElse(i.isNil,i.always({}),i.identity)),i.values,i.propOr({},"value")),Qn=i.compose(i.isEmpty,i.prop("predicates"));function Xn(e,t){return`transition: ${t.map((t=>`${t} ${e}ms`)).join(", ")};`}const ea=i.curry(((e,{duration:t,predicates:n,styles:a})=>{return{predicates:n,classname:e(ut(a)),transitionBaseClassname:e(Xn(t,(o=a,i.toPairs(o).flatMap((e=>{const[t,n]=null!=e?e:[];return n&&t?i.keys(n).map((e=>xe(t,e))):[]})))))};var o})),ta=i.anyPass([Zn,Qn]);const na={is:i.equals,"is-not":i.compose(i.not,i.equals),"is-below":i.lt,"is-above":i.gt};function aa(e,t){return e.includes(t)}const ia={is:i.equals,"is-not":i.compose(i.not,i.equals),exists:aa,"not-exists":i.compose(i.not,aa)},oa={exists:i.compose(i.not,i.either(i.isNil,i.isEmpty)),"not-exists":i.either(i.isNil,i.isEmpty)},ra={"is-true":i.equals(!0),"is-false":i.equals(!1)},sa={is:i.equals,"is-not":i.compose(i.not,i.equals)};function la(e){return(t,n)=>n[e]}const ca=i.cond([[(e,t)=>i.equals("Breakpoint",e),la("activeBreakpoint")],[(e,t)=>i.equals("Progression",e),la("progressionIndex")],[(e,t)=>i.equals("Position",e),la("positionIndex")]]);function da(e,t){return e.creativeCopy&&"string"==typeof e.creativeCopy[t]?e.creativeCopy[t]:void 0}const ua=i.cond([[i.equals("Breakpoint"),(e,t,n)=>{const a=i.lensPath(["breakpoints",t]);return i.pipe(i.over(a,Number),i.view(a))(n)}],[i.equals("Progression"),(e,t,n)=>i.cond([[i.gt(0),i.add(n.totalGroups)],[i.lte(0),i.identity]])(Number(t))],[i.equals("Position"),(e,t,n)=>i.cond([[i.gt(0),i.add(n.totalOffers)],[i.lte(0),i.identity]])(Number(t))]]),pa=i.compose(i.not,isNaN);function fa(e,t){return e.map((e=>{var n,a,i;switch(e.type){case"StaticString":return(0,sa[e.predicate.condition])(e.predicate.input,e.predicate.value);case"CreativeCopy":return(0,oa[e.predicate.condition])(da(t,e.predicate.value));case"StaticBoolean":return(0,ra[e.predicate.condition])(e.predicate.value);case"CustomState":return(0,na[e.predicate.condition])(null!==(n=t.customStates[e.predicate.key])&&void 0!==n?n:0,e.predicate.value);case"DomainState":return(0,na[e.predicate.condition])(null!==(a=t.domainStates[e.predicate.key])&&void 0!==a?a:0,e.predicate.value);case"DarkMode":throw new Error("DarkMode has not yet been implemented.");case"Placeholder":return function(e){switch(e.predicate.type){case"TextValue":return(0,ia[e.predicate.content.condition])(e.predicate.content.input,e.predicate.content.value);case"TextLength":return(0,na[e.predicate.content.condition])(e.predicate.content.input.length,e.predicate.content.value);case"Numeric":return(0,na[e.predicate.content.condition])(Number(e.predicate.content.input),e.predicate.content.value);default:return!1}}(e);default:{const n=na[e.predicate.condition],a=null!==(i=ca(e.type,t))&&void 0!==i?i:NaN,o=ua(e.type,e.predicate.value,t);return!!pa(a)&&n(a,o)}}}))}function ma(e){return i.pathOr(0,["breakpoint","breakpoints",e.breakpoint.activeBreakpoint],e)}const ya={breakpoints:{},activeBreakpoint:NaN,progressionIndex:NaN,positionIndex:NaN,totalOffers:NaN,totalGroups:NaN,creativeCopy:{},customStates:{},domainStates:{}};function ha(e,t,n,a){const o=t.map((e=>"Progression"===e.type?Object.assign(Object.assign({},e),{type:a?"Position":e.type}):e)),{cached:r,uncached:s}=o.reduce(((t,a)=>function(e,t,n,a){const o=function(e,t){switch(e.type){case"Position":case"StaticBoolean":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"StaticString":return`${e.type}:${e.predicate.input}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"CreativeCopy":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${da(t,e.predicate.value)}:${t.totalGroups}`;case"CustomState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.customStates[e.predicate.key]}`;case"DomainState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.domainStates[e.predicate.key]}`;case"Placeholder":return`${e.type}:${e.predicate.type}:${e.predicate.content.condition}:data:${e.predicate.content.input}:${e.predicate.content.value}`;default:return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${ca(e.type,t)}:${t.totalGroups}`}}(e,t),r=n.current.get(o);return i.evolve(va(r)?{cached:i.append(r)}:{uncached:i.append({key:o,predicate:e})},a)}(a,n,e,t)),{cached:[],uncached:[]}),l=fa(s.map((({predicate:e})=>e)),n);return i.zip(s,l).forEach((([{key:t},n])=>{e.current.set(t,n)})),r.concat(l)}const va=i.is(Boolean);const ga=i.curry(((e,t,n)=>{var a,i,o,r,s,l;return{breakpoints:n.breakpoint.breakpoints,activeBreakpoint:ma(n),progressionIndex:null!==(i=null===(a=n.progression)||void 0===a?void 0:a.activeGroupIndex)&&void 0!==i?i:0,totalOffers:null!==(r=null===(o=n.progression)||void 0===o?void 0:o.totalOffers)&&void 0!==r?r:0,totalGroups:null!==(l=null===(s=n.progression)||void 0===s?void 0:s.totalGroups)&&void 0!==l?l:0,customStates:n.customStates,domainStates:n.domainStates,positionIndex:e,creativeCopy:t}})),ba=i.lensPath(["predicate","content","input"]),Ia=i.lensPath(["predicate","content","value"]),Ea=i.lensPath(["predicate","key"]);function xa(e,t){const n=i.over(ba,(t=>t?e(t):"")),a=i.over(Ia,(t=>"string"==typeof t?e(t):t)),o=i.compose(n,a),r=i.over(Ea,(t=>t?e(t):""));return t.map((e=>{switch(e.type){case"Placeholder":return"TextValue"===e.predicate.type?o(e):n(e);case"CustomState":return r(e);default:return e}}))}const Sa=i.all(i.equals(!0));function Ca(e){const n=an(),a=rn(),o=t.useRef(new Map),r=Lt(),s=St(ya,ga(a,r)),l=Xt();return t.useMemo((()=>i.mapObjIndexed((e=>{const t=xa(l,e);return Sa(ha(o,t,s,n))}),e)),[o,e,s,n,l])}function wa(e){e&&(e.style.display="")}function Oa(e){e&&(e.style.display="none")}function Ta(e){return e.settings.duration}const Aa=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],ja=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function Ra(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const a=t?Aa:ja,i=e.animate(a,{duration:n,iterations:1});return i.onfinish=()=>{t?wa(e):Oa(e)},i.oncancel=()=>{t?wa(e):Oa(e)},()=>{i.finish()}}return t?wa(e):Oa(e),()=>{}}function Na({inTransitions:e,outTransitions:n,visible:a,children:i,containerClassName:o}){const r=t.useRef(null);return t.useEffect((()=>a&&e?e.forEach((e=>{r.current&&function(e,t,n,a){if("FadeIn"===a)Ra(e,t,n)}(r.current,a,Ta(e),e.type)})):!a&&n?n.forEach((e=>{r.current&&function(e,t,n,a){if("FadeOut"===a)Ra(e,t,n)}(r.current,a,Ta(e),e.type)})):()=>{}),[a]),t.createElement("div",{ref:r,style:{display:"none"},className:o},i)}function ka(e){const n=Ot(),a=function(e){const n=an(),a=rn(),i=t.useRef(new Map),o=Lt(),r=St(ya,ga(a,o)),s=xa(Xt(),e);return t.useMemo((()=>Sa(ha(i,s,r,n))),[i,s,r,n])}(e.schema.predicates),i=t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0))));return e.schema.transition?t.createElement(Na,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:a},i):"functionally"===e.schema.hide?t.createElement(kn.Provider,{value:a?"ENABLED":"DISABLED"},i):a?t.createElement(t.Fragment,null,i):null}const La=i.mergeWith(((e,t)=>`${e||""} ${t||""}`.trim())),Da=e=>{var n;const a=t.useContext(en),o=rn(),r=jt()||document.head,s=Wn(),l=yt(s,o,r),c=t.useCallback(vt,[]),d=St([],(e=>Object.values(e.breakpoint.breakpoints))),u=a||c(d,s,o,r),p=e.styles?u(e.styles):{},f=e.styles&&e.styles.conditionalTransitions?function(e,t){const n=ea(e);return i.mapObjIndexed((e=>ta(t)||!e?null:n({predicates:t.predicates,duration:t.duration,styles:e})),t.value)}(l,null===(n=e.styles)||void 0===n?void 0:n.conditionalTransitions):void 0,m=Ca(f?i.mapObjIndexed(i.propOr([],"predicates"),f):{}),y=i.mapObjIndexed(((e,t)=>e?function(e,t){var n;if(e&&t in e)return null===(n=e[t])||void 0===n?void 0:n.classname}(f,t):void 0),m),h=f?i.mapObjIndexed(i.prop("transitionBaseClassname"),f):{},v=e.styles?(g=h,La(La(p,y),g)):void 0;var g;return e.children({classnames:v,mapperRef:u})};function _a(e){const n=Ot();return t.createElement(Da,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"column"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,z(a,e.testId))))))}))}function Pa(e){const n=Ot();return t.createElement(Da,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"row"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,z(a,e.testId))))))}))}const $a={allowedTags:["em","strong","a","br","u","p","li","ul","ol","s"],allowedAttributes:{a:["href","target",de,ue],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],s:[]},allowedSchemes:["http","https"]},Fa=new Map([["&","_;^;_"]]),Ga=new RegExp(`<a *(?=${$a.allowedAttributes.a.join("|")}|>)`,"g"),Ma=new RegExp('<a [^>]*href="([^"]+)"',"g"),Ba=new RegExp("(<br *?>)|(<br *?/>)","g"),Ua="<br/>";function Va(e){const n=Xt(),a=Ln(),i=t.useMemo((()=>{const t=n(e.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Ma,((e,t)=>{const n=t.replaceAll("&",Fa.get("&"));return e.replace(t,n)})).replaceAll(Ba,Ua)}(e);return t===u(t,$a)}(t))throw new L("FAILED_SANITISING_HTML","Invalid HTML tags");return t.trim()?t:""}),[e.schema.value,n]),{tabIndex:o,styles:r,isDisabled:s}=g(a);return i?t.createElement(Da,{styles:e.schema.styles},(({classnames:n})=>{const a=[(null==n?void 0:n.link)?`class = "${null==n?void 0:n.link}"`:"",s?'tabindex="-1"':"",s?"style=\"pointer-events: 'none'; user-select: none;\"":"",s?'aria-disabled="true"':""].filter((e=>e.length>0));return l=i,new RegExp("</(p|ul|ol)>").test(l)?t.createElement("div",{tabIndex:o,style:r,"aria-hidden":s,className:null==n?void 0:n.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:i.replace(Ga,`<a ${a.join(" ")}`)}}):t.createElement("p",{tabIndex:o,style:r,"aria-hidden":s,className:null==n?void 0:n.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:i.replace(Ga,`<a ${a.join(" ")}`)}});var l})):null}function za(e){const n=Xt()(e.schema.value),a=Ln(),{tabIndex:i,styles:o,isDisabled:r}=g(a);return n?t.createElement(Da,{styles:e.schema.styles},(({classnames:a})=>{const s={tabIndex:i,"aria-hidden":r,className:null==a?void 0:a.own,"data-testid":e.testId,"data-e2e":"BasicText"};return e.isInline?t.createElement("span",Object.assign({style:o},s),n):t.createElement("p",Object.assign({style:o},s),n)})):null}function qa(e,n,a){if("BasicText"===e.type)return t.createElement(za,{schema:e.node,testId:n,isInline:null!=a&&a})}function Ha(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,z(t,a)))))}function Wa(e){const n=Et(),a=Ot(),i=kt(),o=Xt(),r=rn(),s=Ln(),l=i.creative.responseOptionsMap[e.schema.responseKey],c=w(l);t.useEffect((()=>{c&&n(function(e){if(e.paymentTriggerConfig)return{type:ie,payload:{criteria:{key:"PAYMENT_OFFER_SELECTED"},signal:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:e.action,externalKey:"PAYMENT_OFFER_SELECTED"}}}};throw new Error(`Invalid External Response: No 'paymentTriggerConfig' found for external response option with instanceGuid: ${e.instanceGuid}`)}(l))}),[l,n,c]);const d=l?o({data:l},"creativeResponse"):o,{tabIndex:u,styles:p,isDisabled:f}=g(s);return x(l)&&!c&&void 0!==r?t.createElement(Da,{styles:e.schema.styles},(({classnames:o,mapperRef:r})=>{var s;return t.createElement("button",{type:"button",tabIndex:u,"aria-disabled":f,"aria-label":null!==(s=e.schema.a11yLabel)&&void 0!==s?s:void 0,style:Object.assign({cursor:"pointer"},p),"data-testid":e.testId,"data-e2e":"CreativeResponse","data-e2e-response-type":e.schema.responseKey,onClick:e=>{e.preventDefault();const t=function(e,t){switch(t.action){case"Fulfillment":{const n=e.creative.fulfillment;if(E(n))return{fulfillment:n,responseOption:t,creativeInstanceGuid:e.creative.instanceGuid,accountID:e.accountId,referralCreativeID:e.creative.referralCreativeId};throw new Error(`Invalid Fulfillment: ${n} with referralCreativeID: ${e.creative.referralCreativeId}`)}case"Url":return Object.assign(Object.assign({},t),{accountID:e.accountId,creativeInstanceGuid:e.creative.instanceGuid,referralCreativeID:e.creative.referralCreativeId});default:return Object.assign(Object.assign({},t),{creativeInstanceGuid:e.creative.instanceGuid})}}(i,l);n({type:H,payload:t})},className:null==o?void 0:o.own,disabled:f},t.createElement(Qt,{value:d},(null==o?void 0:o.own)?function(e,n,a,i,o){return t.createElement(tn,{value:a(n)},Ha(e,i,o))}(e.schema.children,o.own,r,a,e.testId):Ha(e.schema.children,a,e.testId)))})):null}function Ka(e){const n=Ln(),{styles:a,isDisabled:i}=g(n);return e.schema.url.light?t.createElement(Da,{styles:v(e.schema.styles)},(({classnames:n})=>t.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},a),{display:"inline-block"}),alt:i?void 0:e.schema.alt||void 0,title:e.schema.title||void 0,className:n?n.own:void 0,"data-testid":e.testId,"data-e2e":"StaticImage",src:e.schema.url.light}))):null}function Ya(e){const n=Ln(),{styles:a,isDisabled:i}=g(n),o=Gn(e.schema.imageKey);return null!=(r=o)&&"object"==typeof r&&"light"in r&&"string"==typeof r.light?t.createElement(Da,{styles:v(e.schema.styles)},(({classnames:n})=>t.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},a),{display:"inline-block"}),alt:o.alt,title:o.title,className:n?n.own:void 0,"data-testid":e.testId,"data-e2e":"DataImage",src:o.light}))):null;var r}const Ja={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function Za(e){const n=e.schema.name,a=e.schema.description,i=e.schema.styles?U(Ja,e.schema.styles):Ja,o=Ln(),{styles:r,isDisabled:s}=g(o);return n?t.createElement(Da,{styles:i},(({classnames:i})=>t.createElement("span",Object.assign({style:Object.assign(Object.assign({},r),{display:"inline-block"}),className:"rokt-icon"+((null==i?void 0:i.own)?" "+i.own:""),"data-testid":e.testId,"data-e2e":`StaticIcon-${n}`},!s&&a?{title:a}:{"aria-hidden":"true"}),n))):null}const Qa={backgroundColor:"#FFEEEE",color:"#FF0000",fontSize:"10px",padding:"4px",border:"1px solid #FF0000",margin:0,whiteSpace:"normal"};class Xa extends t.Component{constructor(e){super(e),this.state={errorMessage:""}}static getDerivedStateFromError(e){return{errorMessage:e.message}}componentDidUpdate(e){this.state.errorMessage&&JSON.stringify(e.schema)!==JSON.stringify(this.props.schema)&&this.setState({errorMessage:""})}componentDidCatch(e,t){var n;this.props.reporter&&"true"===ve.REPORT_RENDER_ERRORS&&this.props.reporter({level:N,code:null!==(n=e.code)&&void 0!==n?n:"UNHANDLED_RENDERING_EXCEPTION",message:e.message,additionalInformation:Object.assign({componentStack:t.componentStack,stack:e.stack},this.context||{})})}render(){return this.state.errorMessage?"true"===ve.DISPLAY_ERRORS?t.createElement("pre",{style:Qa},t.createElement("strong",null,"Error:")," [",t.createElement("em",null,this.props.schema.type),"]"," ",this.state.errorMessage):void 0:this.props.children}}Xa.contextType=Bn;const ei={internally:"_top",externally:"_blank"};function ti(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function ni(e){var n;const a=ei[e.schema.open],i=Ot(),o=Ln(),{tabIndex:r,styles:s,isDisabled:l}=g(o);return(null===(n=e.schema.children)||void 0===n?void 0:n.length)>0?t.createElement(Da,{styles:e.schema.styles},(({classnames:n,mapperRef:o})=>{var c;return t.createElement("a",{href:e.schema.src,"data-testid":e.testId,"data-e2e":"StaticLink",target:null!=a?a:"_blank",tabIndex:r,"aria-disabled":l,"aria-label":null!==(c=e.schema.a11yLabel)&&void 0!==c?c:void 0,style:Object.assign({cursor:"pointer",textDecoration:"none",display:e.isInline?"inline":"block"},s),className:null==n?void 0:n.own},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(tn,{value:a(n)},ti(e,i,o))}(e.schema.children,null==n?void 0:n.own,o,i,e.testId):ti(e.schema.children,i,e.testId))})):null}function ai(e,n,a){if("StaticLink"===e.type)return t.createElement(ni,{schema:e.node,testId:n,isInline:null!=a&&a})}const ii={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function oi(e){const n=(a=e.schema.iconKey,t.useContext($n)(a,"icons"));var a;const i=null==n?void 0:n.name,o=e.schema.styles?U(ii,e.schema.styles):ii,r=Ln(),{styles:s}=g(r);return i?t.createElement(Da,{styles:o},(({classnames:n})=>t.createElement("span",{style:Object.assign(Object.assign({},s),{display:"inline-block"}),"aria-hidden":"true",className:"rokt-icon"+((null==n?void 0:n.own)?" "+n.own:""),"data-testid":e.testId,"data-e2e":`DataIcon-${i}`},i))):null}const ri=o.css`
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("react-dom/client"),a=require("react-redux"),i=require("ramda"),o=require("@emotion/css"),r=require("redux-saga/effects"),s=require("@reduxjs/toolkit"),l=require("redux-saga"),c=require("@redux-saga/core/effects"),d=require("embla-carousel-react"),u=require("insane"),p=require("@emotion/css/create-instance"),f=require("embla-carousel-autoplay"),m=require("embla-carousel-fade");function y(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var h=y(t);function v(e){const t=["elements","own"],n=["default","dimension","width","type"],a=["default","dimension","width","value"],o=["default","dimension","minWidth"],r=i.path(t,e);return r&&Array.isArray(r)&&r.length?i.assocPath(t,r.map(i.when(i.allPass([i.hasPath(n),i.complement(i.hasPath(o)),i.pathEq("fixed",n)]),(e=>i.assocPath(o,i.path(a,e),e)))),e):e}function g(e){const t="DISABLED"===e;return{tabIndex:t?-1:void 0,styles:t?{pointerEvents:"none",userSelect:"none"}:void 0,isDisabled:t}}function b(e,t){if("EscapeHatch"===t.type)try{return JSON.parse(t.node.data).type===e}catch(e){return!1}return!1}function I(){return"ontouchstart"in document.documentElement}function E(e){return null!=e&&"object"==typeof e&&("url"in e||"name"in e)&&"config"in e}function x(e){return null!=e&&"object"==typeof e&&"id"in e&&"action"in e&&"instanceGuid"in e&&"signalType"in e}function S(e){return x(e)&&"Fulfillment"===e.action}function C(e){return x(e)&&"Url"===e.action}function w(e){return x(e)&&"ExternalPaymentTrigger"===e.action}function O(e){return(S(e)||C(e))&&"RealTime"===e.conversionType&&"rclid"in e}function T(e){return(S(e)||C(e))&&"RealTimeReferral"===e.conversionType&&"rclid"in e}const A={pluginId:"shared",pageInstanceGuid:"N/A"};var j;!function(e){e.DCUI="DCUI",e.Partner="partner"}(j||(j={}));const R=["SignalCartItemQuantitySelected","SignalProductItemResponse","SignalUserInteraction"],N="ERROR",k="WARNING";class L extends Error{constructor(e,t){super(t),this.code=null!=e?e:"UNHANDLED_EXCEPTION"}toString(){return`CodedError (${this.code}): ${this.message}`}}const D=["V2_CART_ITEM_UPDATED","CART_ITEM_INSTANT_PURCHASE","OFFER_ENGAGEMENT","POSITIVE_ENGAGEMENT","UPSELL_CREATIVE_SENT","REALTIME_OFFER_FULFILLMENT_REFERRAL","REALTIME_OFFER_FULFILLMENT_CONVERSION","REALTIME_OFFER_FULFILLMENT_SUCCESS","INITIATE_INSTANT_PURCHASE_EVENT","PLACEMENT_CLOSED","PLACEMENT_COMPLETED","PLACEMENT_INTERACTIVE","PLACEMENT_FAILURE"];const _=(e,t)=>i.concat(e,i.slice(e.length,t.length,t)),P=(e,t)=>{if(Array.isArray(e)&&Array.isArray(t)){const n=e.length>t.length?_(t,e):t,a=t.length>e.length?_(e,t):e;return i.zipWith(B,a,n)}return t},$=e=>null==e,F=e=>!$(e),G=(e,t)=>$(t)?e:t,M=(e,t)=>{throw new L("MERGE_TYPE_INCONSISTENCY",`Unable to merge values for inconsistent types, left = ${e}, right = ${t}`)};function B(e,t){return i.cond([[(e,t)=>F(e)&&F(t)&&i.type(e)!==i.type(t)&&("Object"===i.type(e)||"Object"===i.type(t)),M],[(e,t)=>$(e)||$(t),G],[(e,t)=>"Object"===i.type(e),i.mergeDeepWith(B)],[(e,t)=>"Array"===i.type(e),P],[i.T,i.flip(i.unary(i.identity))]])(e,t)}function U(e,t){return B(e,t)}function V(e=0){return`breakpoint-${e}px`}function z(e,t){return t?`${t}-child${e}`:void 0}const q="GLOBAL/RAISE_METRIC",H="GLOBAL/OFFER_ENGAGEMENT";function W(e){return null!=e&&"object"==typeof e&&"responseOption"in e&&S(e.responseOption)&&"fulfillment"in e&&E(e.fulfillment)}function K(e){return w(e)}function Y(e){return C(e)}function J(e){return function(e){return x(e)&&"CaptureOnly"===e.action}(e)}function Z(e){return!!(O(e)||"responseOption"in e&&O(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}function Q(e){return!!(T(e)||"responseOption"in e&&T(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}const X="GLOBAL/RAISE_SIGNAL",ee="GLOBAL/OFFER_LIFECYCLE",te="GLOBAL/SET_CUSTOM_STATE",ne="GLOBAL/SEND_PARTNER",ae="GLOBAL/SET_DOMAIN_STATE",ie="GLOBAL/PREPARE_SIGNAL",oe="GLOBAL/OPEN_LINK",re="GLOBAL/SET_PARTNER_VALIDATION_STATUS",se="GLOBAL/SET_GLOBAL_OFFER_DATA_CART",le="GLOBAL/LAUNCH_CHILD_LAYOUT",ce={RAISE_METRIC:q,PREPARE_SIGNAL:ie,OFFER_ENGAGEMENT:H,RAISE_SIGNAL:X,OFFER_LIFECYCLE:ee,SEND_PARTNER:ne,SET_CUSTOM_STATE:te,SET_DOMAIN_STATE:ae,OPEN_LINK:oe,SET_PARTNER_VALIDATION_STATUS:re,SET_GLOBAL_OFFER_DATA_CART:se,LAUNCH_CHILD_LAYOUT:le},de="data-open-in-app",ue="data-click-signal-context";function pe(e,n){function a(e){var t;if(!(e.target&&e.target instanceof HTMLElement))return;const a=null===(t=e.target)||void 0===t?void 0:t.closest("a");if(a){const t=a.getAttribute("href"),i=a.getAttribute(ue);if(i&&n({type:X,payload:{name:"SignalUserInteraction",action:"Click",context:i}}),t){e.preventDefault();let i="newTab";a.hasAttribute(de)&&(i="inApp"),n({type:oe,payload:{url:t,urlBehaviour:i}})}}}t.useEffect((()=>null!==e?(e.addEventListener("click",a),()=>{e.removeEventListener("click",a)}):()=>{}),[e])}function fe(){const e=t.useRef(null);return t.useEffect((()=>{const t=t=>{"Tab"===t.key&&me(t,e)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)}),[e]),e}const me=(e,t)=>{var n;const a=null===(n=t.current)||void 0===n?void 0:n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!a)return;const i=a[0],o=a[a.length-1],{activeElement:r}=window.document;if(1!==a.length)return r===i&&e.shiftKey?(o&&o.focus(),void e.preventDefault()):r!==o||e.shiftKey?void 0:(i&&i.focus(),void e.preventDefault());e.preventDefault()},ye=i.sortBy(i.prop(1)),he=i.map(i.prop(0)),ve="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DISPLAY_ERRORS:"true",REPORT_RENDER_ERRORS:"true",USE_MEDIA_QUERY_NESTING:"true"};function ge(e,t){return t?"false"!==ve.USE_MEDIA_QUERY_NESTING?`${n=e,`@media (min-width: ${n}px)`} {${t}}`:t.includes(" & ")?`#app-container.${V(e)} ${t.trim()}`:`#app-container.${V(e)} & {${t}}`:"";var n}const be={hovered:":hover",pressed:":active",focussed:":focus",disabled:":disabled"};function Ie(e){return function(e){return Object.keys(be).indexOf(e)>-1}(e)?be[e]:""}const Ee={container:{justifyContent:"justify-content",alignItems:"align-items",shadow:"box-shadow",gap:"gap",overflow:"overflow",blur:"filter",opacity:"opacity"},text:{textColor:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",lineHeight:"line-height",lineLimit:"",letterSpacing:"letter-spacing",baselineTextAlign:"vertical-align",horizontalTextAlign:"text-align",textDecoration:"text-decoration",textTransform:"text-transform"},background:{backgroundColor:"background-color",backgroundImage:""},dimension:{width:"width",maxWidth:"max-width",minWidth:"min-width",height:"height",maxHeight:"max-height",minHeight:"min-height",rotateZ:"transform"},flexChild:{alignSelf:"align-self",weight:"flex",order:"order"},spacing:{margin:"margin",padding:"padding",offset:""},border:{borderColor:"border-color",borderRadius:"border-radius",borderWidth:"border-width",borderStyle:"border-style"}};function xe(e,t){if(!Ee[e]||!Ee[e][t])throw new Error(`No CSS property mapping exists for styling property: ${e}.${t.toString()}`);return Ee[e][t]}function Se(e,t){return n=>t(...Object.keys(e).map((t=>e[t](n[t]))))}function Ce(...e){let t="";const n=(...e)=>e.reduce(((e,n)=>(e&&n?e=e+t+n:n&&(e=n),e)),"");return 1===e.length?(t=e[0],n):n(...e)}function we(e,t){return`${e}:${t};`}function Oe(e){return function(e,t){return`@media (${e}) {${t}}\n`}("prefers-color-scheme: dark",e)}class Te extends Error{constructor(e,t){super(`Invalid styling value '${t}': ${e}.`),this.name=this.constructor.name}}function Ae(e,t){if(null===t)return!1;const n=("function"==typeof e?[e]:e).map((e=>e(t))).reduce(((e,t)=>t?e?e+=`, ${t}`:t:e),void 0);if(n)throw new Te(n,JSON.stringify(t));return!0}function je(e){if(isNaN(e)||"number"!=typeof e&&"string"!=typeof e)return"value must be a number"}function Re(e){return t=>{const n=t&&"symbol"!=typeof t?t.toString():t;if(!(e.indexOf(n)>=0))return`value must be one of [${e.join(",")}]`}}function Ne(e){if(null==e||""===e)return"value must not be omitted"}function ke(e){const t=new RegExp(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/);if("string"!=typeof e||!t.test(e))return"value must be a valid hex color"}function Le(e){const t=new RegExp(/^(?:(?:data:image\/[^;]+;base64[^"]+)|(?:(?:https?:)?\/\/[a-zA-Z\d-]+(?:\.[a-zA-Z\d-]+)*(?::\d{1,10})?)?(?:\.\.?\/?)*\/(?:[a-zA-Z\d\-_]+\/)*[a-zA-Z\d\-_]+\.[a-zA-Z\d]{2,6}(?:\?(?:.+=.+&?)*)?)(?:#.+)?$/);if("string"!=typeof e||!t.test(e))return"value must be a valid CSS URL string"}function De(e){if(null!=e&&""!==e)return"value must not be specified"}function _e(e){return t=>{if(t&&"object"==typeof t&&"value"in t&&"type"in t&&"string"==typeof t.type&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t.type)&&"function"==typeof e[t.type]){const n=e[t.type](t.value);if(!n)return;return`object must have valid "value" for type: ${t.type}: ${n}`}return`value must be an object that has a "type" property that matches one of: [${Object.keys(e).join(", ")}] and a "value" property`}}function Pe(...e){return t=>{if("string"==typeof t){const n=t.split(" ");if(n.length>1&&e.indexOf(n.length)>-1){if(!n.reduce(((e,t)=>e||je(t)),void 0))return}}return`value must be a space separated list of numbers, of one of the following lengths: ${e.join(" ,")}`}}function $e(e,t){return n=>{const a=e(n),i=t(n);if(a&&i)return`one of these must be true: ${a} -OR- ${i}`}}function Fe(e){if("string"!=typeof e)return"value must be a string"}const Ge=i.is(Object);function Me(e){const t=Object.entries(e);return n=>Ge(n)&&!Array.isArray(n)?t.reduce(((e,[t,a])=>e||a(n[t])),void 0):`Input value (${e}) must be an object`}function Be(e){if("number"!=typeof e&&"string"!=typeof e||isNaN(e)||!(e>=0))return"value must be a positive number"}function Ue(e,t,n){return Ae(je,n)?we(xe(e,t),`${n}`):""}function Ve(e){return(t,n,a)=>Ae(Re(Object.keys(e)),a)?we(xe(t,n),`${e[a]}`):""}function ze(e){return Ae(Ne,e)?Se({light:t(Le,!1),dark:t($e(De,Le),!0)},Ce("\n "))(e):"";function t(e,t){return n=>{if(Ae(e,n)&&n){const e=we("background-image",`url("${n}")`);return t?Oe(e):e}return""}}}function qe(e){const t={crop:"auto",fit:"contain",fill:"cover"};return"string"==typeof e&&(e=e.toLowerCase()),Ae($e(De,Re(Object.keys(t))),e)&&e?we("background-size",t[e]):""}const He=i.cond([[i.equals("top-left"),i.always("top left")],[i.equals("top-right"),i.always("top right")],[i.equals("bottom-left"),i.always("bottom left")],[i.equals("bottom-right"),i.always("bottom right")],[i.T,i.identity]]);function We(e){const t="string"==typeof e?e.toLowerCase():e;return Ae($e(De,Re(["top","right","bottom","left","center","top-left","top-right","bottom-left","bottom-right"])),t)&&t?we("background-position",He(t)):""}function Ke(e,t,n){return Ae($e(je,Pe(2,3,4)),n)?we(xe(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function Ye(e){return(t,n,a)=>Ae(_e({fit:Re(e),percentage:je,fixed:je}),a)?we(xe(t,n),Je(a)):""}function Je(e){const t={"wrap-content":"fit-content","fit-width":"100%","fit-height":"100%"};switch(e.type){case"fixed":return`${e.value}px`;case"percentage":return`${e.value}%`;case"fit":return t[e.value]}}const Ze=Me({light:ke,dark:$e(De,ke)});function Qe(e,t,n){return a=>{if(a){const i=we(xe(e,t),et(String(a)));return n?Oe(i):i}return""}}function Xe(e,t,n){return Ae(Ze,n)?Se({light:Qe(e,t,!1),dark:Qe(e,t,!0)},Ce("\n "))(n):""}function et(e){const t=e.toUpperCase();switch(t.length){case 5:return`#${t.substring(2,5)}${t[1]}`;case 9:return`#${t.substring(3,9)}${t[1]}${t[2]}`;default:return t.toUpperCase()}}const tt=Me({offsetX:$e(De,je),offsetY:$e(De,je),blurRadius:$e(De,je),spreadRadius:$e(De,je),color:Ze}),nt=e=>t=>null!=t?String(t):e,at=i.compose(i.concat(i.__,"px"),nt("0")),it=e=>t=>"string"==typeof t?e(t):t,ot=i.compose(it(i.concat(i.__,"px")),nt(void 0)),rt=i.compose(it(et),i.prop("dark"));function st(e,t,n){return we(e,Se({offsetX:at,offsetY:at,blurRadius:t.spreadRadius?at:ot,spreadRadius:ot,color:n},Ce(" "))(t))}const lt={center:"center","flex-end":"flex-end","flex-start":"flex-start",stretch:"stretch"},ct={container:{justifyContent:Ve(lt),alignItems:Ve(lt),shadow:function(e,t,n){var a,o,r;if(Ae(tt,n)){const s=xe(e,t);return Ce("\n")(st(s,n,(o="light",r="#80000000",i.compose(et,i.propOr(r,o)))),(null===(a=n.color)||void 0===a?void 0:a.dark)?Oe(st(s,n,rt)):"")}return""},gap:Ke,overflow:Ve({hidden:"hidden",visible:"visible"}),blur:function(e,t,n){return Ae(Be,n)?we(xe(e,t),`blur(${n.toString()}px)`):""},opacity:Ue},text:{textColor:Xe,fontSize:Ke,fontFamily:function(e,t,n){return Ae(Fe,n)?we(xe(e,t),(a=`${n}`,a.replace(/['();{}@:[\]!/=]/g,"")).split(",").map(((e,t)=>{const n=0===t?e:e.trim();if(n.includes(" ")){const e=n.startsWith('"')?"":'"',t=n.endsWith('"')?"":'"';return`${e}${n}${t}`}return n})).join(",")):"";var a},fontWeight:Ve({100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900}),fontStyle:Ve({normal:"normal",italic:"italic"}),lineHeight:Ke,lineLimit:function(e,t,n){return Ae(je,n)?`\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: ${n};\n line-clamp: ${n}; \n -webkit-box-orient: vertical;\n `:""},letterSpacing:Ke,baselineTextAlign:Ve({super:"super",sub:"sub",baseline:"baseline"}),horizontalTextAlign:Ve({left:"left",right:"right",center:"center",start:"start",end:"end",justify:"justify"}),textDecoration:Ve({underline:"underline","strike-through":"line-through",none:"none"}),textTransform:Ve({capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",none:"none"})},background:{backgroundColor:Xe,backgroundImage:function(e,t,n){return Ae(Ne,n)?Se({url:ze,position:We,scale:qe},Ce)(n):""}},dimension:{width:Ye(["wrap-content","fit-width"]),maxWidth:Ke,minWidth:Ke,height:Ye(["wrap-content","fit-height"]),maxHeight:Ke,minHeight:Ke,rotateZ:(dt="Z",(e,t,n)=>{const a=`rotate${dt}`;return Ae(je,n)?we(xe(e,t),`${a}(${n.toString()}deg)`):""})},flexChild:{alignSelf:Ve(lt),weight:Ue,order:Ue},spacing:{margin:Ke,padding:Ke,offset:function(e,t,n){return Ae(Pe(2),n)?`transform:translate(${n.split(" ").join("px, ")}px);`:""}},border:{borderColor:Xe,borderRadius:Ke,borderWidth:Ke,borderStyle:Ve({solid:"solid",dashed:"dashed"})}};var dt;function ut(e){return Object.keys(e).reduce(((t,n)=>(n&&e[n]&&Object.keys(e[n]).forEach((a=>{if(!ct[n])throw new Error(`No styling transformers exist for styling category key: ${n}`);const i=ct[n][a];if(!i)throw new Error(`No styling transformer exists for property: ${n}.${a.toString()}`);try{t+=i(n,a,e[n][a])}catch(e){throw e&&"object"==typeof e&&"message"in e&&(e.message=`Error parsing styling key ${n}.${a.toString()}: ${e.message}`),e}})),t)),"")}const pt="FAILED_TEMPLATING_DATA",ft=new Map;function mt(e){return String.fromCharCode(97+e)}function yt(e,t,n){const a=`${e||A.pluginId}-${void 0!==t?String(t):"outer"}`,i=ft.get(a);if(i&&i.sheet.container.isConnected)return i.css;const o=function(e,t){const n={key:void 0!==e?`inner-css-${mt(e)}`:"outer-css",container:t};return t&&t.parentElement&&(n.container=t.parentElement),p(n)}(t,n);return ft.set(a,o),o.css}const ht="%%%OWN_CLASS_REF%%%",vt=i.memoizeWith(((e,t,n,a)=>`${String(e)}-${t}-${n}`),gt);function gt(e,t,n,a){const i=yt(t,n,a);let o=1;return function t(n,a=!1){var r;if("string"==typeof n){const e={scopeClass:n};return t.bind(e)}const s=n,l=this.scopeClass,c=Object.entries(null!==(r=s.elements)&&void 0!==r?r:{});try{const t=c.reduce(((t,[n,i])=>Object.assign(Object.assign({},t),{[n]:bt(i,l,a,String(n),e)})),{}),n=Object.entries(t),r=a?"parent-"+o++:"",s=function(e){return"own"in e&&"string"==typeof e.own&&e.own.length>0}(t)?i(t.own):"";return n.reduce(((e,[t,n=""])=>{if("own"===t)return e;const a=n.replace(ht,r);return Object.assign(Object.assign({},e),{[t]:a?i(a):""})}),{own:`${s}${s&&r?" ":""}${r}`})}catch(e){const t=e;throw t.code="FAILED_PARSING_STYLES",t}}.bind({})}function bt(e,t,n,a,i){return e.map(function(e,t,n){return a=>Object.entries(a).map((([a,i])=>{const o=i?ut(i):"";switch(!0){case"default"===a:return o?`\n${o}\n`:"";case Boolean(e):return`\n .${e}${Ie(a)} & {\n${o}\n}\n`;case t&&"own"!==n:return`\n .${ht}${Ie(a)} & {\n${o}\n}\n`;default:return`\n &${Ie(a)} {\n${o}\n}\n`}})).join("")}(t,n,a)).reduce(((e,t,n)=>{const a=i[n];return void 0!==a?e+(0===n?t:`${ge(a,t)}\n`):e}),"")}const It=t.createContext(i.always(void 0)),Et=()=>t.useContext(It),xt=t.createContext(null);function St(e,n){var a;const i=t.useContext(xt);return i&&null!==(a=n(i))&&void 0!==a?a:e}const Ct=t.createContext((()=>{throw Error("Node Mapper Context does not have a mapper. Use the NodeMapperProvider with the default nodeMapper as a value before you consume this mapper")})),wt=Ct.Consumer,Ot=()=>t.useContext(Ct),Tt=e=>t.createElement(Ct.Provider,{value:(t,n,a)=>e.value(t,null!=n?n:e.overrides,a)},e.children),At=t.createContext(null),jt=()=>t.useContext(At),Rt=t.createContext({get(){throw Error("Offer context has not been set")}}),Nt=e=>t.createElement(Rt.Provider,{value:{get:()=>e.context}},e.children),kt=()=>t.useContext(Rt).get(),Lt=()=>{try{return t.useContext(Rt).get().creative.copy}catch(e){return}},Dt=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),_t=i.compose(i.not,i.isEmpty),Pt=i.where({url:_t,title:_t});function $t(e,t,n){return t.reduce(((t,n)=>{const[a,i]=n.slice(0,-1).split("["),o=i?i.split(","):[];if(!a)throw new Error(Gt(e,"This Meta Attribute could not be parsed."));return function(e,t,n,a){switch(t){case"openLinks":return function(e,t,n){Ft(t,e,"openLinks",1,2);const a=Mt(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),i=Bt(t,1,(e=>"string"==typeof e&&e.length?e:null));if("InApp"===a)return n.replace(Dt,((e,t)=>`<a ${de} ${i?`${ue}="${i}" `:""}${t}`));return n}(e,n,a);case"sliceText":return function(e,t,n){Ft(t,e,"sliceText",2,2);const a=Mt(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),i=Mt(t,e,1,(e=>{const t=Number(e);return!Number.isNaN(t)&&t>=0?t:null}),"sliceText meta attribute second argument must be a positive number");if("Chars"===a)return function(e,t){const n=new RegExp("(?<=<a.*>).*(?=</a>)");return e.startsWith("<a")?e.replace(n,(e=>e.slice(0,t))):e.slice(0,t)}(n,i);throw Error(Gt(e,`Unknown "SliceBy" value. ${a}`))}(e,n,a);default:throw new Error(Gt(e,`Unknown Meta Attribute '${t}'.`))}}(e,a,o,t)}),n)}function Ft(e,t,n,a,i){const o=new Error(Gt(t,`${n} meta attribute takes ${a!=i?`between ${a} and ${i}`:a} arguments; received ${e.length}.`));if(e.length<a||e.length>i)throw o}function Gt(e,t){return`Malformed Meta Attribute: '${e}' - ${t}`}function Mt(e,t,n,a,i){const o=Bt(e,n,a);if(null!==o)return o;throw Error(Gt(t,i||`Could not parse meta attribute argument at index ${n} from arguments ${JSON.stringify(e)}`))}function Bt(e,t,n){return n(e[t])}const Ut="DATA",Vt="STATE",zt=new RegExp(`^(${Ut}|${Vt})`),qt=new RegExp(`^${Vt}`),Ht=new RegExp(`%\\^(?:${Ut}|${Vt})\\.[a-zA-Z0-9]+[a-zA-Z0-9\\.]*(?:\\:[a-zA-Z0-9]+\\[[a-zA-Z0-9\\.,]*\\])*(?:\\|.*?)?\\^%`,"g"),Wt=Symbol("invalid");function Kt(e,t="creativeCopy"){const n=Yt({data:e},t);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Yt(t,n,this.dataMap)});let a=!1;const o=t,r=i.pipe(i.slice(2,-2),i.split("|"),(e=>{const t=i.reduce(((e,t)=>{let n;if(zt.test(t)){if(!this.dataMap.has(t)&&qt.test(t))throw new L(pt,`Invalid use of STATE template key in a context it does not exist: ${t}`);const a=i.split(":",t);if(a[0]){if(n=this.dataMap.get(a[0]),n&&n===Wt)throw new L(pt,`Invalid template key referenced: "${t}" is an object but expected a string, boolean, number or empty. \nDid you mean to reference a child property of ${t}?`);if(a.length>1&&n)try{n=$t(a[0],a.slice(1),n)}catch(e){throw new L(pt,`Failed to apply meta attributes. ${function(e){return null!=e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:String(e)}(e)}`)}}return n?i.reduced({provided:!0,value:n}):e}return i.reduced({provided:!0,value:t})}),{provided:!1,value:""},e);return t.provided||(a=!0),t.value})),s=i.replace(Ht,r,o);return!1===a?s:""}.bind({dataMap:n})}function Yt(e,t,n){const a=new Map(n);return"data"in e&&o(e.data,`${Ut}${t?"."+t:""}`),"state"in e&&o(e.state,`${Vt}${t?"."+t:""}`),a;function o(e,t){"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e?a.set(t,(null==e?void 0:e.toString())||""):a.set(t,Wt),e&&"object"==typeof e&&i.forEachObjIndexed(((e,n)=>o(e,`${t}.${n}`)),e)}}const Jt=t.createContext(Kt({})),Zt=Jt.Consumer,Qt=Jt.Provider,Xt=()=>t.useContext(Jt),en=t.createContext(null),tn=en.Provider,nn=t.createContext("OUTER"),an=()=>"VARIANT"===t.useContext(nn),on=t.createContext(void 0),rn=()=>t.useContext(on);var sn,ln,cn,dn,un,pn,fn=function(e,t,n,a){return new(n||(n=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((a=a.apply(e,t||[])).next())}))},mn=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n},yn=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};class hn{constructor(e,t,n,a,o){sn.set(this,void 0),ln.set(this,void 0),cn.set(this,new Set),dn.set(this,void 0),un.set(this,void 0),pn.set(this,void 0),mn(this,sn,i.partial(e.subscribe.bind(e),[n]),"f"),mn(this,ln,i.partial(e.dispatch.bind(e),[n]),"f"),mn(this,dn,t,"f"),mn(this,un,a,"f"),mn(this,pn,o,"f"),this.onGlobalStateChange=this.onGlobalStateChange.bind(this),this.onInteractivityChange=this.onInteractivityChange.bind(this),this.onEvent=this.onEvent.bind(this),this.globalDispatch=this.globalDispatch.bind(this),this.createChildPlugin=this.createChildPlugin.bind(this)}onGlobalStateChange(e){const t=yn(this,sn,"f").call(this,e),n=()=>{t(),yn(this,cn,"f").delete(n)};return yn(this,cn,"f").add(n),n}onInteractivityChange(e){return yn(this,un,"f").subscribe(e)}onEvent(...e){const t=e.reduce(((e,t)=>{if("partner"===t.source||"*"===t.source){const n=yn(this,pn,"f").call(this,t.name).subscribe(t.callback);return[...e,()=>n.unsubscribe()]}return e}),[]),n=()=>{t.forEach((e=>{e()})),yn(this,cn,"f").delete(n)};return yn(this,cn,"f").add(n),n}globalDispatch(e){yn(this,ln,"f").call(this,e)}dispose(){yn(this,cn,"f").forEach((e=>e())),mn(this,cn,new Set,"f"),yn(this,un,"f").clear()}createChildPlugin(e){return yn(this,dn,"f").call(this,e)}}sn=new WeakMap,ln=new WeakMap,cn=new WeakMap,dn=new WeakMap,un=new WeakMap,pn=new WeakMap;class vn{onGlobalStateChange(){return()=>{}}onInteractivityChange(){return()=>{}}onEvent(){return()=>{}}globalDispatch(){}dispose(){}createChildPlugin(){return{close:()=>fn(this,void 0,void 0,(function*(){})),onClose:()=>fn(this,void 0,void 0,(function*(){})),putConfig:()=>fn(this,void 0,void 0,(function*(){})),send:()=>fn(this,void 0,void 0,(function*(){})),onEvent:()=>({subscribe:()=>({unsubscribe:()=>{}})})}}}var gn,bn,In=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n},En=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};class xn{constructor(e){gn.set(this,void 0),bn.set(this,new Set),In(this,gn,e,"f")}subscribe(e){return En(this,bn,"f").add(e),!0===e(En(this,gn,"f"))&&En(this,bn,"f").delete(e),()=>{En(this,bn,"f").delete(e)}}publish(e){In(this,gn,e,"f"),En(this,bn,"f").forEach((e=>{!0===e(En(this,gn,"f"))&&En(this,bn,"f").delete(e)}))}clear(){En(this,bn,"f").clear()}}gn=new WeakMap,bn=new WeakMap;var Sn=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)},Cn=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n};const wn="breakpoint-0px";class On{constructor(){this.logger=()=>{}}withAppFactory(e){return this.appFactory=e,this}withLogger(e){return this.logger=e,this}withGatewayFactory(e){return this.gatewayFactory=e,this}build(){var e,t,n,a,i,o,r,s,l,c,d,u,p,f;const m=this.appFactory,y=this.logger,h=null!==(e=this.gatewayFactory)&&void 0!==e?e:()=>new vn;return f=class extends HTMLElement{static get observedAttributes(){return["visible","interactivity","active-breakpoint"]}constructor(){super(),t.add(this),n.set(this,(()=>null)),a.set(this,(()=>null)),i.set(this,void 0),o.set(this,!1),r.set(this,null),s.set(this,null),l.set(this,null);const e=this.attachShadow({mode:"open"});Cn(this,i,document.createElement("div"),"f"),Sn(this,i,"f").id="app-container",Sn(this,i,"f").classList.add("default"),e.appendChild(Sn(this,i,"f"))}attributeChangedCallback(e,i,o){if(o!==i)switch(e){case"visible":Sn(this,n,"f").call(this,"true"===o);break;case"interactivity":"ENABLED"!==o&&"DISABLED"!==o||Sn(this,a,"f").call(this,o);break;case"active-breakpoint":Sn(this,t,"m",c).call(this,o,i)}}makeInteractivityUpdateHandler(e){Cn(this,a,(t=>{e.publish(t)}),"f")}makeVisbilityUpdateHandler(e,a,i){const o="true"===this.getAttribute("visible"),r=this.getAttribute("slotInstanceGuid");Cn(this,n,(o=>{o?(Cn(this,n,(()=>null),"f"),0===e&&i.globalDispatch({type:ee,payload:{event:"Interactive"}}),a&&(i.globalDispatch({type:X,payload:{name:"SignalImpression",parentGuid:a}}),this.trackViewability(a,i)),r&&i.globalDispatch({type:X,payload:{name:"SignalImpression",parentGuid:r}})):Sn(this,t,"m",p).call(this)}),"f"),Sn(this,n,"f").call(this,o)}trackViewability(e,n){if(!Sn(this,o,"f"))if("IntersectionObserver"in window&&!Sn(this,r,"f")){const a=()=>{Sn(this,o,"f")||(n.globalDispatch({type:X,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!0}}),Cn(this,o,!0,"f"),Sn(this,t,"m",p).call(this),Sn(this,i,"f").removeEventListener("click",a))};Sn(this,i,"f").addEventListener("click",a),Cn(this,r,new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=.5?Sn(this,t,"m",u).call(this,(()=>{Sn(this,o,"f")||(n.globalDispatch({type:X,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!1}}),Cn(this,o,!0,"f"),Sn(this,t,"m",p).call(this),Sn(this,i,"f").removeEventListener("click",a))})):Sn(this,t,"m",d).call(this)}))}),{threshold:.5}),"f"),Cn(this,l,(()=>{var e,n;"visible"===document.visibilityState?null===(e=Sn(this,r,"f"))||void 0===e||e.observe(Sn(this,i,"f")):(Sn(this,t,"m",d).call(this),null===(n=Sn(this,r,"f"))||void 0===n||n.disconnect())}),"f"),document.addEventListener("visibilitychange",Sn(this,l,"f")),Sn(this,l,"f").call(this)}else n.globalDispatch({type:X,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!1,inferred:!1}}),Cn(this,o,!0,"f")}getOfferPositionAttr(){const e=this.getAttribute("offerPositionIndex"),t=Number(e);return(null==e||isNaN(t)||t<0)&&v(`Offer position attribute (${e}) is invalid`),t}getJSONAttr(e,t="{}"){const n=this.getAttribute(e);try{return JSON.parse(null!=n?n:t)}catch(t){v(`Invalid JSON attribute ${e}: ${n}`)}}disconnectedCallback(){Sn(this,t,"m",p).call(this)}connectedCallback(){var e,t,n;const a=this.getAttribute("container"),o=this.getAttribute("plugin-id");Sn(this,i,"f").setAttribute("style","width:100%;display:flex;flex-direction:"+("column"===a?"column":"row"));const r=this.getOfferPositionAttr(),s=this.getJSONAttr("layoutSchema"),l=this.getJSONAttr("childLayouts","[]"),c=this.getJSONAttr("offerData"),d=new xn("DISABLED"===this.getAttribute("interactivity")?"DISABLED":"ENABLED"),u=null!==(e=this.getAttribute("schemaVersion"))&&void 0!==e?e:"",p=this.getJSONAttr("offerState","{}");m||v("Cannot create app without factory. Please build the connector withAppFactory.");const f=h({offerPositionIndex:r,creativeInstanceGuid:null===(t=null==c?void 0:c.creative)||void 0===t?void 0:t.instanceGuid},d);this.makeInteractivityUpdateHandler(d),m({rootElement:Sn(this,i,"f"),gateway:f,logger:y,offerPositionIndex:r,offerData:c,layoutSchema:s,childLayouts:l,schemaVersion:u,pluginId:o||A.pluginId,offerState:p}),this.makeVisbilityUpdateHandler(r,null===(n=null==c?void 0:c.creative)||void 0===n?void 0:n.instanceGuid,f)}},n=new WeakMap,a=new WeakMap,i=new WeakMap,o=new WeakMap,r=new WeakMap,s=new WeakMap,l=new WeakMap,t=new WeakSet,c=function(e,t){Sn(this,i,"f").classList.remove(t||wn),Sn(this,i,"f").classList.add(e||wn)},d=function(){Sn(this,s,"f")&&(clearTimeout(Sn(this,s,"f")),Cn(this,s,null,"f"))},u=function(e){Sn(this,t,"m",d).call(this),Cn(this,s,window.setTimeout(e,1e3),"f")},p=function(){Sn(this,t,"m",d).call(this),Sn(this,r,"f")&&(Sn(this,r,"f").disconnect(),Cn(this,r,null,"f")),Sn(this,l,"f")&&(document.removeEventListener("visibilitychange",Sn(this,l,"f")),Cn(this,l,null,"f"))},f;function v(e){throw y({level:N,code:"MODULE_BUILDER/FAILED_TO_BUILD_MODULE",message:e}),Error(e)}}}const Tn=t.createContext({get:()=>new vn}),An=e=>t.createElement(Tn.Provider,{value:{get:()=>e.context}},e.children);const jn=t.createContext({get(){throw Error("Layout Schema context has not been set")}}),Rn=e=>t.createElement(jn.Provider,{value:{get:()=>e.context}},e.children),Nn=()=>t.useContext(jn).get(),kn=t.createContext("ENABLED"),Ln=()=>t.useContext(kn);function Dn(e){const t=Pn(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Pn(t,this.dataMap)});if(!n)throw new L("FAILED_TO_MAP_STATIC_DATA","No namespace submitted to StaticData Mapper");const a=t;return i.path([n,a],this.dataMap)}.bind({dataMap:t})}const _n={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function Pn(e,t=_n){return["images","links","icons","copy","responseOptionsMap"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Object.assign(Object.assign({},t[n]),e[n])})),t)}const $n=t.createContext(Dn({}));$n.Consumer;const Fn=$n.Provider,Gn=e=>{const n=t.useContext($n),a=e.split("|");for(const e of a){const t=n(e.trim(),"images");if(t)return t}},Mn=()=>t.useContext($n),Bn=t.createContext({});function Un({info:e,children:n}){const a=t.useContext(Bn);return t.createElement(Bn.Provider,{value:Object.assign(Object.assign({},a),e)},n)}const Vn=t.createContext({get(){throw Error("Catalog Item context has not been set")}}),zn=e=>t.createElement(Vn.Provider,{value:{get:()=>e.context}},e.children),qn=()=>t.useContext(Vn).get(),Hn=t.createContext(""),Wn=()=>t.useContext(Hn),Kn=t.createContext(""),Yn=t.createContext(void 0);function Jn({children:e}){const n=t.useMemo((()=>{const e=document.createElement("div");return e.inert=!0,{inert:!0===e.inert}}),[]);return t.createElement(Yn.Provider,{value:n},e)}const Zn=i.compose(i.anyPass([i.isEmpty,i.all(i.isEmpty)]),i.flatten,i.map(i.values),i.map(i.ifElse(i.isNil,i.always({}),i.identity)),i.values,i.propOr({},"value")),Qn=i.compose(i.isEmpty,i.prop("predicates"));function Xn(e,t){return`transition: ${t.map((t=>`${t} ${e}ms`)).join(", ")};`}const ea=i.curry(((e,{duration:t,predicates:n,styles:a})=>{return{predicates:n,classname:e(ut(a)),transitionBaseClassname:e(Xn(t,(o=a,i.toPairs(o).flatMap((e=>{const[t,n]=null!=e?e:[];return n&&t?i.keys(n).map((e=>xe(t,e))):[]})))))};var o})),ta=i.anyPass([Zn,Qn]);const na={is:i.equals,"is-not":i.compose(i.not,i.equals),"is-below":i.lt,"is-above":i.gt};function aa(e,t){return e.includes(t)}const ia={is:i.equals,"is-not":i.compose(i.not,i.equals),exists:aa,"not-exists":i.compose(i.not,aa)},oa={exists:i.compose(i.not,i.either(i.isNil,i.isEmpty)),"not-exists":i.either(i.isNil,i.isEmpty)},ra={"is-true":i.equals(!0),"is-false":i.equals(!1)},sa={is:i.equals,"is-not":i.compose(i.not,i.equals)};function la(e){return(t,n)=>n[e]}const ca=i.cond([[(e,t)=>i.equals("Breakpoint",e),la("activeBreakpoint")],[(e,t)=>i.equals("Progression",e),la("progressionIndex")],[(e,t)=>i.equals("Position",e),la("positionIndex")]]);function da(e,t){return e.creativeCopy&&"string"==typeof e.creativeCopy[t]?e.creativeCopy[t]:void 0}const ua=i.cond([[i.equals("Breakpoint"),(e,t,n)=>{const a=i.lensPath(["breakpoints",t]);return i.pipe(i.over(a,Number),i.view(a))(n)}],[i.equals("Progression"),(e,t,n)=>i.cond([[i.gt(0),i.add(n.totalGroups)],[i.lte(0),i.identity]])(Number(t))],[i.equals("Position"),(e,t,n)=>i.cond([[i.gt(0),i.add(n.totalOffers)],[i.lte(0),i.identity]])(Number(t))]]),pa=i.compose(i.not,isNaN);function fa(e,t){return e.map((e=>{var n,a,i;switch(e.type){case"StaticString":return(0,sa[e.predicate.condition])(e.predicate.input,e.predicate.value);case"CreativeCopy":return(0,oa[e.predicate.condition])(da(t,e.predicate.value));case"StaticBoolean":return(0,ra[e.predicate.condition])(e.predicate.value);case"CustomState":return(0,na[e.predicate.condition])(null!==(n=t.customStates[e.predicate.key])&&void 0!==n?n:0,e.predicate.value);case"DomainState":return(0,na[e.predicate.condition])(null!==(a=t.domainStates[e.predicate.key])&&void 0!==a?a:0,e.predicate.value);case"DarkMode":throw new Error("DarkMode has not yet been implemented.");case"Placeholder":return function(e){switch(e.predicate.type){case"TextValue":return(0,ia[e.predicate.content.condition])(e.predicate.content.input,e.predicate.content.value);case"TextLength":return(0,na[e.predicate.content.condition])(e.predicate.content.input.length,e.predicate.content.value);case"Numeric":return(0,na[e.predicate.content.condition])(Number(e.predicate.content.input),e.predicate.content.value);default:return!1}}(e);default:{const n=na[e.predicate.condition],a=null!==(i=ca(e.type,t))&&void 0!==i?i:NaN,o=ua(e.type,e.predicate.value,t);return!!pa(a)&&n(a,o)}}}))}function ma(e){return i.pathOr(0,["breakpoint","breakpoints",e.breakpoint.activeBreakpoint],e)}const ya={breakpoints:{},activeBreakpoint:NaN,progressionIndex:NaN,positionIndex:NaN,totalOffers:NaN,totalGroups:NaN,creativeCopy:{},customStates:{},domainStates:{}};function ha(e,t,n,a){const o=t.map((e=>"Progression"===e.type?Object.assign(Object.assign({},e),{type:a?"Position":e.type}):e)),{cached:r,uncached:s}=o.reduce(((t,a)=>function(e,t,n,a){const o=function(e,t){switch(e.type){case"Position":case"StaticBoolean":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"StaticString":return`${e.type}:${e.predicate.input}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"CreativeCopy":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${da(t,e.predicate.value)}:${t.totalGroups}`;case"CustomState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.customStates[e.predicate.key]}`;case"DomainState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.domainStates[e.predicate.key]}`;case"Placeholder":return`${e.type}:${e.predicate.type}:${e.predicate.content.condition}:data:${e.predicate.content.input}:${e.predicate.content.value}`;default:return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${ca(e.type,t)}:${t.totalGroups}`}}(e,t),r=n.current.get(o);return i.evolve(va(r)?{cached:i.append(r)}:{uncached:i.append({key:o,predicate:e})},a)}(a,n,e,t)),{cached:[],uncached:[]}),l=fa(s.map((({predicate:e})=>e)),n);return i.zip(s,l).forEach((([{key:t},n])=>{e.current.set(t,n)})),r.concat(l)}const va=i.is(Boolean);const ga=i.curry(((e,t,n)=>{var a,i,o,r,s,l;return{breakpoints:n.breakpoint.breakpoints,activeBreakpoint:ma(n),progressionIndex:null!==(i=null===(a=n.progression)||void 0===a?void 0:a.activeGroupIndex)&&void 0!==i?i:0,totalOffers:null!==(r=null===(o=n.progression)||void 0===o?void 0:o.totalOffers)&&void 0!==r?r:0,totalGroups:null!==(l=null===(s=n.progression)||void 0===s?void 0:s.totalGroups)&&void 0!==l?l:0,customStates:n.customStates,domainStates:n.domainStates,positionIndex:e,creativeCopy:t}})),ba=i.lensPath(["predicate","content","input"]),Ia=i.lensPath(["predicate","content","value"]),Ea=i.lensPath(["predicate","key"]);function xa(e,t){const n=i.over(ba,(t=>t?e(t):"")),a=i.over(Ia,(t=>"string"==typeof t?e(t):t)),o=i.compose(n,a),r=i.over(Ea,(t=>t?e(t):""));return t.map((e=>{switch(e.type){case"Placeholder":return"TextValue"===e.predicate.type?o(e):n(e);case"CustomState":return r(e);default:return e}}))}const Sa=i.all(i.equals(!0));function Ca(e){const n=an(),a=rn(),o=t.useRef(new Map),r=Lt(),s=St(ya,ga(a,r)),l=Xt();return t.useMemo((()=>i.mapObjIndexed((e=>{const t=xa(l,e);return Sa(ha(o,t,s,n))}),e)),[o,e,s,n,l])}function wa(e){e&&(e.style.display="")}function Oa(e){e&&(e.style.display="none")}function Ta(e){return e.settings.duration}const Aa=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],ja=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function Ra(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const a=t?Aa:ja,i=e.animate(a,{duration:n,iterations:1});return i.onfinish=()=>{t?wa(e):Oa(e)},i.oncancel=()=>{t?wa(e):Oa(e)},()=>{i.finish()}}return t?wa(e):Oa(e),()=>{}}function Na({inTransitions:e,outTransitions:n,visible:a,children:i,containerClassName:o}){const r=t.useRef(null);return t.useEffect((()=>a&&e?e.forEach((e=>{r.current&&function(e,t,n,a){if("FadeIn"===a)Ra(e,t,n)}(r.current,a,Ta(e),e.type)})):!a&&n?n.forEach((e=>{r.current&&function(e,t,n,a){if("FadeOut"===a)Ra(e,t,n)}(r.current,a,Ta(e),e.type)})):()=>{}),[a]),t.createElement("div",{ref:r,style:{display:"none"},className:o},i)}function ka(e){const n=Ot(),a=function(e){const n=an(),a=rn(),i=t.useRef(new Map),o=Lt(),r=St(ya,ga(a,o)),s=xa(Xt(),e);return t.useMemo((()=>Sa(ha(i,s,r,n))),[i,s,r,n])}(e.schema.predicates),i=t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0))));return e.schema.transition?t.createElement(Na,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:a},i):"functionally"===e.schema.hide?t.createElement(kn.Provider,{value:a?"ENABLED":"DISABLED"},i):a?t.createElement(t.Fragment,null,i):null}const La=i.mergeWith(((e,t)=>`${e||""} ${t||""}`.trim())),Da=e=>{var n;const a=t.useContext(en),o=rn(),r=jt()||document.head,s=Wn(),l=yt(s,o,r),c=t.useCallback(vt,[]),d=St([],(e=>Object.values(e.breakpoint.breakpoints))),u=a||c(d,s,o,r),p=e.styles?u(e.styles):{},f=e.styles&&e.styles.conditionalTransitions?function(e,t){const n=ea(e);return i.mapObjIndexed((e=>ta(t)||!e?null:n({predicates:t.predicates,duration:t.duration,styles:e})),t.value)}(l,null===(n=e.styles)||void 0===n?void 0:n.conditionalTransitions):void 0,m=Ca(f?i.mapObjIndexed(i.propOr([],"predicates"),f):{}),y=i.mapObjIndexed(((e,t)=>e?function(e,t){var n;if(e&&t in e)return null===(n=e[t])||void 0===n?void 0:n.classname}(f,t):void 0),m),h=f?i.mapObjIndexed(i.prop("transitionBaseClassname"),f):{},v=e.styles?(g=h,La(La(p,y),g)):void 0;var g;return e.children({classnames:v,mapperRef:u})};function _a(e){const n=Ot();return t.createElement(Da,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"column"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,z(a,e.testId))))))}))}function Pa(e){const n=Ot();return t.createElement(Da,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"row"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,z(a,e.testId))))))}))}const $a={allowedTags:["em","strong","a","br","u","p","li","ul","ol","s"],allowedAttributes:{a:["href","target",de,ue],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],s:[]},allowedSchemes:["http","https"]},Fa=new Map([["&","_;^;_"]]),Ga=new RegExp(`<a *(?=${$a.allowedAttributes.a.join("|")}|>)`,"g"),Ma=new RegExp('<a [^>]*href="([^"]+)"',"g"),Ba=new RegExp("(<br *?>)|(<br *?/>)","g"),Ua="<br/>";function Va(e){const n=Xt(),a=Ln(),i=t.useMemo((()=>{const t=n(e.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Ma,((e,t)=>{const n=t.replaceAll("&",Fa.get("&"));return e.replace(t,n)})).replaceAll(Ba,Ua)}(e);return t===u(t,$a)}(t))throw new L("FAILED_SANITISING_HTML","Invalid HTML tags");return t.trim()?t:""}),[e.schema.value,n]),{tabIndex:o,styles:r,isDisabled:s}=g(a);return i?t.createElement(Da,{styles:e.schema.styles},(({classnames:n})=>{const a=[(null==n?void 0:n.link)?`class = "${null==n?void 0:n.link}"`:"",s?'tabindex="-1"':"",s?"style=\"pointer-events: 'none'; user-select: none;\"":"",s?'aria-disabled="true"':""].filter((e=>e.length>0));return l=i,new RegExp("</(p|ul|ol)>").test(l)?t.createElement("div",{tabIndex:o,style:r,"aria-hidden":s,className:null==n?void 0:n.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:i.replace(Ga,`<a ${a.join(" ")}`)}}):t.createElement("p",{tabIndex:o,style:r,"aria-hidden":s,className:null==n?void 0:n.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:i.replace(Ga,`<a ${a.join(" ")}`)}});var l})):null}function za(e){const n=Xt()(e.schema.value),a=Ln(),{tabIndex:i,styles:o,isDisabled:r}=g(a);return n?t.createElement(Da,{styles:e.schema.styles},(({classnames:a})=>{const s={tabIndex:i,"aria-hidden":r,className:null==a?void 0:a.own,"data-testid":e.testId,"data-e2e":"BasicText"};return e.isInline?t.createElement("span",Object.assign({style:o},s),n):t.createElement("p",Object.assign({style:o},s),n)})):null}function qa(e,n,a){if("BasicText"===e.type)return t.createElement(za,{schema:e.node,testId:n,isInline:null!=a&&a})}function Ha(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,z(t,a)))))}function Wa(e){const n=Et(),a=Ot(),i=kt(),o=Xt(),r=rn(),s=Ln(),l=i.creative.responseOptionsMap[e.schema.responseKey],c=w(l);t.useEffect((()=>{c&&n(function(e){if(e.paymentTriggerConfig)return{type:ie,payload:{criteria:{key:"PAYMENT_OFFER_SELECTED"},signal:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:e.action,externalKey:"PAYMENT_OFFER_SELECTED"}}}};throw new Error(`Invalid External Response: No 'paymentTriggerConfig' found for external response option with instanceGuid: ${e.instanceGuid}`)}(l))}),[l,n,c]);const d=l?o({data:l},"creativeResponse"):o,{tabIndex:u,styles:p,isDisabled:f}=g(s);return x(l)&&!c&&void 0!==r?t.createElement(Da,{styles:e.schema.styles},(({classnames:o,mapperRef:r})=>{var s;return t.createElement("button",{type:"button",tabIndex:u,"aria-disabled":f,"aria-label":null!==(s=e.schema.a11yLabel)&&void 0!==s?s:void 0,style:Object.assign({cursor:"pointer"},p),"data-testid":e.testId,"data-e2e":"CreativeResponse","data-e2e-response-type":e.schema.responseKey,onClick:t=>{t.preventDefault();const a=function(e,t,n){switch(t.action){case"Fulfillment":{const n=e.creative.fulfillment;if(E(n))return{fulfillment:n,responseOption:t,creativeInstanceGuid:e.creative.instanceGuid,accountID:e.accountId,referralCreativeID:e.creative.referralCreativeId};throw new Error(`Invalid Fulfillment: ${n} with referralCreativeID: ${e.creative.referralCreativeId}`)}case"Url":return Object.assign(Object.assign({},t),{accountID:e.accountId,creativeInstanceGuid:e.creative.instanceGuid,referralCreativeID:e.creative.referralCreativeId,urlBehavior:n&&"internally"===n.toLowerCase()?"self":t.urlBehavior});default:return Object.assign(Object.assign({},t),{creativeInstanceGuid:e.creative.instanceGuid})}}(i,l,e.schema.openLinks);n({type:H,payload:a})},className:null==o?void 0:o.own,disabled:f},t.createElement(Qt,{value:d},(null==o?void 0:o.own)?function(e,n,a,i,o){return t.createElement(tn,{value:a(n)},Ha(e,i,o))}(e.schema.children,o.own,r,a,e.testId):Ha(e.schema.children,a,e.testId)))})):null}function Ka(e){const n=Ln(),{styles:a,isDisabled:i}=g(n);return e.schema.url.light?t.createElement(Da,{styles:v(e.schema.styles)},(({classnames:n})=>t.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},a),{display:"inline-block"}),alt:i?void 0:e.schema.alt||void 0,title:e.schema.title||void 0,className:n?n.own:void 0,"data-testid":e.testId,"data-e2e":"StaticImage",src:e.schema.url.light}))):null}function Ya(e){const n=Ln(),{styles:a,isDisabled:i}=g(n),o=Gn(e.schema.imageKey);return null!=(r=o)&&"object"==typeof r&&"light"in r&&"string"==typeof r.light?t.createElement(Da,{styles:v(e.schema.styles)},(({classnames:n})=>t.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},a),{display:"inline-block"}),alt:o.alt,title:o.title,className:n?n.own:void 0,"data-testid":e.testId,"data-e2e":"DataImage",src:o.light}))):null;var r}const Ja={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function Za(e){const n=e.schema.name,a=e.schema.description,i=e.schema.styles?U(Ja,e.schema.styles):Ja,o=Ln(),{styles:r,isDisabled:s}=g(o);return n?t.createElement(Da,{styles:i},(({classnames:i})=>t.createElement("span",Object.assign({style:Object.assign(Object.assign({},r),{display:"inline-block"}),className:"rokt-icon"+((null==i?void 0:i.own)?" "+i.own:""),"data-testid":e.testId,"data-e2e":`StaticIcon-${n}`},!s&&a?{title:a}:{"aria-hidden":"true"}),n))):null}const Qa={backgroundColor:"#FFEEEE",color:"#FF0000",fontSize:"10px",padding:"4px",border:"1px solid #FF0000",margin:0,whiteSpace:"normal"};class Xa extends t.Component{constructor(e){super(e),this.state={errorMessage:""}}static getDerivedStateFromError(e){return{errorMessage:e.message}}componentDidUpdate(e){this.state.errorMessage&&JSON.stringify(e.schema)!==JSON.stringify(this.props.schema)&&this.setState({errorMessage:""})}componentDidCatch(e,t){var n;this.props.reporter&&"true"===ve.REPORT_RENDER_ERRORS&&this.props.reporter({level:N,code:null!==(n=e.code)&&void 0!==n?n:"UNHANDLED_RENDERING_EXCEPTION",message:e.message,additionalInformation:Object.assign({componentStack:t.componentStack,stack:e.stack},this.context||{})})}render(){return this.state.errorMessage?"true"===ve.DISPLAY_ERRORS?t.createElement("pre",{style:Qa},t.createElement("strong",null,"Error:")," [",t.createElement("em",null,this.props.schema.type),"]"," ",this.state.errorMessage):void 0:this.props.children}}Xa.contextType=Bn;const ei={internally:"_top",externally:"_blank"};function ti(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function ni(e){var n;const a=ei[e.schema.open],i=Ot(),o=Ln(),{tabIndex:r,styles:s,isDisabled:l}=g(o);return(null===(n=e.schema.children)||void 0===n?void 0:n.length)>0?t.createElement(Da,{styles:e.schema.styles},(({classnames:n,mapperRef:o})=>{var c;return t.createElement("a",{href:e.schema.src,"data-testid":e.testId,"data-e2e":"StaticLink",target:null!=a?a:"_blank",tabIndex:r,"aria-disabled":l,"aria-label":null!==(c=e.schema.a11yLabel)&&void 0!==c?c:void 0,style:Object.assign({cursor:"pointer",textDecoration:"none",display:e.isInline?"inline":"block"},s),className:null==n?void 0:n.own},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(tn,{value:a(n)},ti(e,i,o))}(e.schema.children,null==n?void 0:n.own,o,i,e.testId):ti(e.schema.children,i,e.testId))})):null}function ai(e,n,a){if("StaticLink"===e.type)return t.createElement(ni,{schema:e.node,testId:n,isInline:null!=a&&a})}const ii={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function oi(e){const n=(a=e.schema.iconKey,t.useContext($n)(a,"icons"));var a;const i=null==n?void 0:n.name,o=e.schema.styles?U(ii,e.schema.styles):ii,r=Ln(),{styles:s}=g(r);return i?t.createElement(Da,{styles:o},(({classnames:n})=>t.createElement("span",{style:Object.assign(Object.assign({},s),{display:"inline-block"}),"aria-hidden":"true",className:"rokt-icon"+((null==n?void 0:n.own)?" "+n.own:""),"data-testid":e.testId,"data-e2e":`DataIcon-${i}`},i))):null}const ri=o.css`
2
2
  display: flex;
3
3
  position: relative;
4
4
  overflow: hidden;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as i from"react";import a,{useEffect as o,useRef as r,createContext as s,useContext as l,useState as c,useMemo as d,useCallback as u,forwardRef as p}from"react";import{createRoot as f}from"react-dom/client";import{useDispatch as m,useSelector as y,connect as h,Provider as v}from"react-redux";import{path as g,assocPath as b,when as I,allPass as E,hasPath as S,complement as C,pathEq as w,cond as O,mergeDeepWith as T,T as x,flip as A,type as N,unary as L,identity as R,concat as _,zipWith as D,slice as k,compose as $,findIndex as P,equals as j,map as F,sortBy as G,toPairs as M,pathOr as B,prop as U,is as V,always as z,propOr as H,__ as W,memoizeWith as q,mapObjIndexed as K,where as Y,not as J,isEmpty as Z,forEachObjIndexed as Q,pipe as X,split as ee,replace as te,reduce as ne,reduced as ie,partial as ae,curry as oe,anyPass as re,keys as se,all as le,flatten as ce,values as de,ifElse as ue,isNil as pe,over as fe,lensPath as me,zip as ye,evolve as he,append as ve,gt as ge,lt as be,either as Ie,view as Ee,add as Se,lte as Ce,mergeWith as we,omit as Oe,indexBy as Te,mergeRight as xe,lensProp as Ae,defaultTo as Ne,reject as Le,whereEq as Re,uniqBy as _e,find as De,has as ke,assoc as $e,gte as Pe,clone as je,mergeDeepRight as Fe,isNotEmpty as Ge,F as Me}from"ramda";import{css as Be,cx as Ue,keyframes as Ve}from"@emotion/css";import{call as ze,actionChannel as He,take as We,put as qe,cancelled as Ke,select as Ye,all as Je,takeEvery as Ze,fork as Qe,takeLatest as Xe,spawn as et,race as tt,delay as nt}from"redux-saga/effects";import{configureStore as it,combineReducers as at}from"@reduxjs/toolkit";import ot,{buffers as rt,eventChannel as st,END as lt}from"redux-saga";import{all as ct,spawn as dt,takeEvery as ut,call as pt,put as ft,take as mt,delay as yt}from"@redux-saga/core/effects";import ht from"embla-carousel-react";import vt from"insane";import gt from"@emotion/css/create-instance";import bt from"embla-carousel-autoplay";import It from"embla-carousel-fade";function Et(e){const t=["elements","own"],n=["default","dimension","width","type"],i=["default","dimension","width","value"],a=["default","dimension","minWidth"],o=g(t,e);return o&&Array.isArray(o)&&o.length?b(t,o.map(I(E([S(n),C(S(a)),w("fixed",n)]),(e=>b(a,g(i,e),e)))),e):e}function St(e){const t="DISABLED"===e;return{tabIndex:t?-1:void 0,styles:t?{pointerEvents:"none",userSelect:"none"}:void 0,isDisabled:t}}function Ct(e,t){if("EscapeHatch"===t.type)try{return JSON.parse(t.node.data).type===e}catch(e){return!1}return!1}function wt(){return"ontouchstart"in document.documentElement}function Ot(e){return null!=e&&"object"==typeof e&&("url"in e||"name"in e)&&"config"in e}function Tt(e){return null!=e&&"object"==typeof e&&"id"in e&&"action"in e&&"instanceGuid"in e&&"signalType"in e}function xt(e){return Tt(e)&&"Fulfillment"===e.action}function At(e){return Tt(e)&&"Url"===e.action}function Nt(e){return Tt(e)&&"ExternalPaymentTrigger"===e.action}function Lt(e){return(xt(e)||At(e))&&"RealTime"===e.conversionType&&"rclid"in e}function Rt(e){return(xt(e)||At(e))&&"RealTimeReferral"===e.conversionType&&"rclid"in e}const _t={pluginId:"shared",pageInstanceGuid:"N/A"};var Dt;!function(e){e.DCUI="DCUI",e.Partner="partner"}(Dt||(Dt={}));const kt=["SignalCartItemQuantitySelected","SignalProductItemResponse"],$t="ERROR",Pt="WARNING";class jt extends Error{constructor(e,t){super(t),this.code=null!=e?e:"UNHANDLED_EXCEPTION"}toString(){return`CodedError (${this.code}): ${this.message}`}}const Ft=["V2_CART_ITEM_UPDATED","CART_ITEM_INSTANT_PURCHASE","OFFER_ENGAGEMENT","POSITIVE_ENGAGEMENT","UPSELL_CREATIVE_SENT","REALTIME_OFFER_FULFILLMENT_REFERRAL","REALTIME_OFFER_FULFILLMENT_CONVERSION","REALTIME_OFFER_FULFILLMENT_SUCCESS","INITIATE_INSTANT_PURCHASE_EVENT","PLACEMENT_CLOSED","PLACEMENT_COMPLETED","PLACEMENT_INTERACTIVE","PLACEMENT_FAILURE"];const Gt=(e,t)=>_(e,k(e.length,t.length,t)),Mt=(e,t)=>{if(Array.isArray(e)&&Array.isArray(t)){const n=e.length>t.length?Gt(t,e):t,i=t.length>e.length?Gt(e,t):e;return D(Ht,i,n)}return t},Bt=e=>null==e,Ut=e=>!Bt(e),Vt=(e,t)=>Bt(t)?e:t,zt=(e,t)=>{throw new jt("MERGE_TYPE_INCONSISTENCY",`Unable to merge values for inconsistent types, left = ${e}, right = ${t}`)};function Ht(e,t){return O([[(e,t)=>Ut(e)&&Ut(t)&&N(e)!==N(t)&&("Object"===N(e)||"Object"===N(t)),zt],[(e,t)=>Bt(e)||Bt(t),Vt],[(e,t)=>"Object"===N(e),T(Ht)],[(e,t)=>"Array"===N(e),Mt],[x,A(L(R))]])(e,t)}function Wt(e,t){return Ht(e,t)}function qt(e=0){return`breakpoint-${e}px`}function Kt(e,t){return t?`${t}-child${e}`:void 0}const Yt="GLOBAL/RAISE_METRIC",Jt="GLOBAL/OFFER_ENGAGEMENT";function Zt(e){return null!=e&&"object"==typeof e&&"responseOption"in e&&xt(e.responseOption)&&"fulfillment"in e&&Ot(e.fulfillment)}function Qt(e){return Nt(e)}function Xt(e){return At(e)}function en(e){return function(e){return Tt(e)&&"CaptureOnly"===e.action}(e)}function tn(e){return!!(Lt(e)||"responseOption"in e&&Lt(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}function nn(e){return!!(Rt(e)||"responseOption"in e&&Rt(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}const an="GLOBAL/RAISE_SIGNAL",on="GLOBAL/OFFER_LIFECYCLE",rn="GLOBAL/SET_CUSTOM_STATE",sn="GLOBAL/SEND_PARTNER",ln="GLOBAL/SET_DOMAIN_STATE",cn="GLOBAL/PREPARE_SIGNAL",dn="GLOBAL/OPEN_LINK",un="GLOBAL/SET_PARTNER_VALIDATION_STATUS",pn="GLOBAL/SET_GLOBAL_OFFER_DATA_CART",fn="GLOBAL/LAUNCH_CHILD_LAYOUT",mn={RAISE_METRIC:Yt,PREPARE_SIGNAL:cn,OFFER_ENGAGEMENT:Jt,RAISE_SIGNAL:an,OFFER_LIFECYCLE:on,SEND_PARTNER:sn,SET_CUSTOM_STATE:rn,SET_DOMAIN_STATE:ln,OPEN_LINK:dn,SET_PARTNER_VALIDATION_STATUS:un,SET_GLOBAL_OFFER_DATA_CART:pn,LAUNCH_CHILD_LAYOUT:fn},yn="data-open-in-app",hn="data-click-signal-context";function vn(e,t){function n(e){var n;if(!(e.target&&e.target instanceof HTMLElement))return;const i=null===(n=e.target)||void 0===n?void 0:n.closest("a");if(i){const n=i.getAttribute("href"),a=i.getAttribute(hn);if(a&&t({type:an,payload:{name:"SignalUserInteraction",action:"Click",context:a}}),n){e.preventDefault();let a="newTab";i.hasAttribute(yn)&&(a="inApp"),t({type:dn,payload:{url:n,urlBehaviour:a}})}}}o((()=>null!==e?(e.addEventListener("click",n),()=>{e.removeEventListener("click",n)}):()=>{}),[e])}function gn(){const e=r(null);return o((()=>{const t=t=>{"Tab"===t.key&&bn(t,e)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)}),[e]),e}const bn=(e,t)=>{var n;const i=null===(n=t.current)||void 0===n?void 0:n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!i)return;const a=i[0],o=i[i.length-1],{activeElement:r}=window.document;if(1!==i.length)return r===a&&e.shiftKey?(o&&o.focus(),void e.preventDefault()):r!==o||e.shiftKey?void 0:(a&&a.focus(),void e.preventDefault());e.preventDefault()},In=G(U(1)),En=F(U(0)),Sn="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DISPLAY_ERRORS:"true",REPORT_RENDER_ERRORS:"true",USE_MEDIA_QUERY_NESTING:"true"};function Cn(e,t){return t?"false"!==Sn.USE_MEDIA_QUERY_NESTING?`${n=e,`@media (min-width: ${n}px)`} {${t}}`:t.includes(" & ")?`#app-container.${qt(e)} ${t.trim()}`:`#app-container.${qt(e)} & {${t}}`:"";var n}const wn={hovered:":hover",pressed:":active",focussed:":focus",disabled:":disabled"};function On(e){return function(e){return Object.keys(wn).indexOf(e)>-1}(e)?wn[e]:""}const Tn={container:{justifyContent:"justify-content",alignItems:"align-items",shadow:"box-shadow",gap:"gap",overflow:"overflow",blur:"filter",opacity:"opacity"},text:{textColor:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",lineHeight:"line-height",lineLimit:"",letterSpacing:"letter-spacing",baselineTextAlign:"vertical-align",horizontalTextAlign:"text-align",textDecoration:"text-decoration",textTransform:"text-transform"},background:{backgroundColor:"background-color",backgroundImage:""},dimension:{width:"width",maxWidth:"max-width",minWidth:"min-width",height:"height",maxHeight:"max-height",minHeight:"min-height",rotateZ:"transform"},flexChild:{alignSelf:"align-self",weight:"flex",order:"order"},spacing:{margin:"margin",padding:"padding",offset:""},border:{borderColor:"border-color",borderRadius:"border-radius",borderWidth:"border-width",borderStyle:"border-style"}};function xn(e,t){if(!Tn[e]||!Tn[e][t])throw new Error(`No CSS property mapping exists for styling property: ${e}.${t.toString()}`);return Tn[e][t]}function An(e,t){return n=>t(...Object.keys(e).map((t=>e[t](n[t]))))}function Nn(...e){let t="";const n=(...e)=>e.reduce(((e,n)=>(e&&n?e=e+t+n:n&&(e=n),e)),"");return 1===e.length?(t=e[0],n):n(...e)}function Ln(e,t){return`${e}:${t};`}function Rn(e){return function(e,t){return`@media (${e}) {${t}}\n`}("prefers-color-scheme: dark",e)}class _n extends Error{constructor(e,t){super(`Invalid styling value '${t}': ${e}.`),this.name=this.constructor.name}}function Dn(e,t){if(null===t)return!1;const n=("function"==typeof e?[e]:e).map((e=>e(t))).reduce(((e,t)=>t?e?e+=`, ${t}`:t:e),void 0);if(n)throw new _n(n,JSON.stringify(t));return!0}function kn(e){if(isNaN(e)||"number"!=typeof e&&"string"!=typeof e)return"value must be a number"}function $n(e){return t=>{const n=t&&"symbol"!=typeof t?t.toString():t;if(!(e.indexOf(n)>=0))return`value must be one of [${e.join(",")}]`}}function Pn(e){if(null==e||""===e)return"value must not be omitted"}function jn(e){const t=new RegExp(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/);if("string"!=typeof e||!t.test(e))return"value must be a valid hex color"}function Fn(e){const t=new RegExp(/^(?:(?:data:image\/[^;]+;base64[^"]+)|(?:(?:https?:)?\/\/[a-zA-Z\d-]+(?:\.[a-zA-Z\d-]+)*(?::\d{1,10})?)?(?:\.\.?\/?)*\/(?:[a-zA-Z\d\-_]+\/)*[a-zA-Z\d\-_]+\.[a-zA-Z\d]{2,6}(?:\?(?:.+=.+&?)*)?)(?:#.+)?$/);if("string"!=typeof e||!t.test(e))return"value must be a valid CSS URL string"}function Gn(e){if(null!=e&&""!==e)return"value must not be specified"}function Mn(e){return t=>{if(t&&"object"==typeof t&&"value"in t&&"type"in t&&"string"==typeof t.type&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t.type)&&"function"==typeof e[t.type]){const n=e[t.type](t.value);if(!n)return;return`object must have valid "value" for type: ${t.type}: ${n}`}return`value must be an object that has a "type" property that matches one of: [${Object.keys(e).join(", ")}] and a "value" property`}}function Bn(...e){return t=>{if("string"==typeof t){const n=t.split(" ");if(n.length>1&&e.indexOf(n.length)>-1){if(!n.reduce(((e,t)=>e||kn(t)),void 0))return}}return`value must be a space separated list of numbers, of one of the following lengths: ${e.join(" ,")}`}}function Un(e,t){return n=>{const i=e(n),a=t(n);if(i&&a)return`one of these must be true: ${i} -OR- ${a}`}}function Vn(e){if("string"!=typeof e)return"value must be a string"}const zn=V(Object);function Hn(e){const t=Object.entries(e);return n=>zn(n)&&!Array.isArray(n)?t.reduce(((e,[t,i])=>e||i(n[t])),void 0):`Input value (${e}) must be an object`}function Wn(e){if("number"!=typeof e&&"string"!=typeof e||isNaN(e)||!(e>=0))return"value must be a positive number"}function qn(e,t,n){return Dn(kn,n)?Ln(xn(e,t),`${n}`):""}function Kn(e){return(t,n,i)=>Dn($n(Object.keys(e)),i)?Ln(xn(t,n),`${e[i]}`):""}function Yn(e){return Dn(Pn,e)?An({light:t(Fn,!1),dark:t(Un(Gn,Fn),!0)},Nn("\n "))(e):"";function t(e,t){return n=>{if(Dn(e,n)&&n){const e=Ln("background-image",`url("${n}")`);return t?Rn(e):e}return""}}}function Jn(e){const t={crop:"auto",fit:"contain",fill:"cover"};return"string"==typeof e&&(e=e.toLowerCase()),Dn(Un(Gn,$n(Object.keys(t))),e)&&e?Ln("background-size",t[e]):""}const Zn=O([[j("top-left"),z("top left")],[j("top-right"),z("top right")],[j("bottom-left"),z("bottom left")],[j("bottom-right"),z("bottom right")],[x,R]]);function Qn(e){const t="string"==typeof e?e.toLowerCase():e;return Dn(Un(Gn,$n(["top","right","bottom","left","center","top-left","top-right","bottom-left","bottom-right"])),t)&&t?Ln("background-position",Zn(t)):""}function Xn(e,t,n){return Dn(Un(kn,Bn(2,3,4)),n)?Ln(xn(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function ei(e){return(t,n,i)=>Dn(Mn({fit:$n(e),percentage:kn,fixed:kn}),i)?Ln(xn(t,n),ti(i)):""}function ti(e){const t={"wrap-content":"fit-content","fit-width":"100%","fit-height":"100%"};switch(e.type){case"fixed":return`${e.value}px`;case"percentage":return`${e.value}%`;case"fit":return t[e.value]}}const ni=Hn({light:jn,dark:Un(Gn,jn)});function ii(e,t,n){return i=>{if(i){const a=Ln(xn(e,t),oi(String(i)));return n?Rn(a):a}return""}}function ai(e,t,n){return Dn(ni,n)?An({light:ii(e,t,!1),dark:ii(e,t,!0)},Nn("\n "))(n):""}function oi(e){const t=e.toUpperCase();switch(t.length){case 5:return`#${t.substring(2,5)}${t[1]}`;case 9:return`#${t.substring(3,9)}${t[1]}${t[2]}`;default:return t.toUpperCase()}}const ri=Hn({offsetX:Un(Gn,kn),offsetY:Un(Gn,kn),blurRadius:Un(Gn,kn),spreadRadius:Un(Gn,kn),color:ni}),si=e=>t=>null!=t?String(t):e,li=$(_(W,"px"),si("0")),ci=e=>t=>"string"==typeof t?e(t):t,di=$(ci(_(W,"px")),si(void 0)),ui=$(ci(oi),U("dark"));function pi(e,t,n){return Ln(e,An({offsetX:li,offsetY:li,blurRadius:t.spreadRadius?li:di,spreadRadius:di,color:n},Nn(" "))(t))}const fi={center:"center","flex-end":"flex-end","flex-start":"flex-start",stretch:"stretch"},mi={container:{justifyContent:Kn(fi),alignItems:Kn(fi),shadow:function(e,t,n){var i;if(Dn(ri,n)){const a=xn(e,t);return Nn("\n")(pi(a,n,$(oi,H("#80000000","light"))),(null===(i=n.color)||void 0===i?void 0:i.dark)?Rn(pi(a,n,ui)):"")}return""},gap:Xn,overflow:Kn({hidden:"hidden",visible:"visible"}),blur:function(e,t,n){return Dn(Wn,n)?Ln(xn(e,t),`blur(${n.toString()}px)`):""},opacity:qn},text:{textColor:ai,fontSize:Xn,fontFamily:function(e,t,n){return Dn(Vn,n)?Ln(xn(e,t),(i=`${n}`,i.replace(/['();{}@:[\]!/=]/g,"")).split(",").map(((e,t)=>{const n=0===t?e:e.trim();if(n.includes(" ")){const e=n.startsWith('"')?"":'"',t=n.endsWith('"')?"":'"';return`${e}${n}${t}`}return n})).join(",")):"";var i},fontWeight:Kn({100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900}),fontStyle:Kn({normal:"normal",italic:"italic"}),lineHeight:Xn,lineLimit:function(e,t,n){return Dn(kn,n)?`\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: ${n};\n line-clamp: ${n}; \n -webkit-box-orient: vertical;\n `:""},letterSpacing:Xn,baselineTextAlign:Kn({super:"super",sub:"sub",baseline:"baseline"}),horizontalTextAlign:Kn({left:"left",right:"right",center:"center",start:"start",end:"end",justify:"justify"}),textDecoration:Kn({underline:"underline","strike-through":"line-through",none:"none"}),textTransform:Kn({capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",none:"none"})},background:{backgroundColor:ai,backgroundImage:function(e,t,n){return Dn(Pn,n)?An({url:Yn,position:Qn,scale:Jn},Nn)(n):""}},dimension:{width:ei(["wrap-content","fit-width"]),maxWidth:Xn,minWidth:Xn,height:ei(["wrap-content","fit-height"]),maxHeight:Xn,minHeight:Xn,rotateZ:(yi="Z",(e,t,n)=>{const i=`rotate${yi}`;return Dn(kn,n)?Ln(xn(e,t),`${i}(${n.toString()}deg)`):""})},flexChild:{alignSelf:Kn(fi),weight:qn,order:qn},spacing:{margin:Xn,padding:Xn,offset:function(e,t,n){return Dn(Bn(2),n)?`transform:translate(${n.split(" ").join("px, ")}px);`:""}},border:{borderColor:ai,borderRadius:Xn,borderWidth:Xn,borderStyle:Kn({solid:"solid",dashed:"dashed"})}};var yi;function hi(e){return Object.keys(e).reduce(((t,n)=>(n&&e[n]&&Object.keys(e[n]).forEach((i=>{if(!mi[n])throw new Error(`No styling transformers exist for styling category key: ${n}`);const a=mi[n][i];if(!a)throw new Error(`No styling transformer exists for property: ${n}.${i.toString()}`);try{t+=a(n,i,e[n][i])}catch(e){throw e&&"object"==typeof e&&"message"in e&&(e.message=`Error parsing styling key ${n}.${i.toString()}: ${e.message}`),e}})),t)),"")}const vi="FAILED_TEMPLATING_DATA",gi=new Map;function bi(e){return String.fromCharCode(97+e)}function Ii(e,t,n){const i=`${e||_t.pluginId}-${void 0!==t?String(t):"outer"}`,a=gi.get(i);if(a&&a.sheet.container.isConnected)return a.css;const o=function(e,t){const n={key:void 0!==e?`inner-css-${bi(e)}`:"outer-css",container:t};return t&&t.parentElement&&(n.container=t.parentElement),gt(n)}(t,n);return gi.set(i,o),o.css}const Ei="%%%OWN_CLASS_REF%%%",Si=q(((e,t,n,i)=>`${String(e)}-${t}-${n}`),Ci);function Ci(e,t,n,i){const a=Ii(t,n,i);let o=1;return function t(n,i=!1){var r;if("string"==typeof n){const e={scopeClass:n};return t.bind(e)}const s=n,l=this.scopeClass,c=Object.entries(null!==(r=s.elements)&&void 0!==r?r:{});try{const t=c.reduce(((t,[n,a])=>Object.assign(Object.assign({},t),{[n]:wi(a,l,i,String(n),e)})),{}),n=Object.entries(t),r=i?"parent-"+o++:"",s=function(e){return"own"in e&&"string"==typeof e.own&&e.own.length>0}(t)?a(t.own):"";return n.reduce(((e,[t,n=""])=>{if("own"===t)return e;const i=n.replace(Ei,r);return Object.assign(Object.assign({},e),{[t]:i?a(i):""})}),{own:`${s}${s&&r?" ":""}${r}`})}catch(e){const t=e;throw t.code="FAILED_PARSING_STYLES",t}}.bind({})}function wi(e,t,n,i,a){return e.map(function(e,t,n){return i=>Object.entries(i).map((([i,a])=>{const o=a?hi(a):"";switch(!0){case"default"===i:return o?`\n${o}\n`:"";case Boolean(e):return`\n .${e}${On(i)} & {\n${o}\n}\n`;case t&&"own"!==n:return`\n .${Ei}${On(i)} & {\n${o}\n}\n`;default:return`\n &${On(i)} {\n${o}\n}\n`}})).join("")}(t,n,i)).reduce(((e,t,n)=>{const i=a[n];return void 0!==i?e+(0===n?t:`${Cn(i,t)}\n`):e}),"")}const Oi=s(z(void 0)),Ti=()=>l(Oi),xi=s(null);function Ai(e,t){var n;const i=l(xi);return i&&null!==(n=t(i))&&void 0!==n?n:e}const Ni=s((()=>{throw Error("Node Mapper Context does not have a mapper. Use the NodeMapperProvider with the default nodeMapper as a value before you consume this mapper")})),Li=Ni.Consumer,Ri=()=>l(Ni),_i=e=>a.createElement(Ni.Provider,{value:(t,n,i)=>e.value(t,null!=n?n:e.overrides,i)},e.children),Di=s(null),ki=()=>l(Di),$i=s({get(){throw Error("Offer context has not been set")}}),Pi=e=>a.createElement($i.Provider,{value:{get:()=>e.context}},e.children),ji=()=>l($i).get(),Fi=()=>{try{return l($i).get().creative.copy}catch(e){return}},Gi=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),Mi=$(J,Z),Bi=Y({url:Mi,title:Mi});function Ui(e,t,n){return t.reduce(((t,n)=>{const[i,a]=n.slice(0,-1).split("["),o=a?a.split(","):[];if(!i)throw new Error(zi(e,"This Meta Attribute could not be parsed."));return function(e,t,n,i){switch(t){case"openLinks":return function(e,t,n){Vi(t,e,"openLinks",1,2);const i=Hi(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),a=Wi(t,1,(e=>"string"==typeof e&&e.length?e:null));if("InApp"===i)return n.replace(Gi,((e,t)=>`<a ${yn} ${a?`${hn}="${a}" `:""}${t}`));return n}(e,n,i);case"sliceText":return function(e,t,n){Vi(t,e,"sliceText",2,2);const i=Hi(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),a=Hi(t,e,1,(e=>{const t=Number(e);return!Number.isNaN(t)&&t>=0?t:null}),"sliceText meta attribute second argument must be a positive number");if("Chars"===i)return function(e,t){const n=new RegExp("(?<=<a.*>).*(?=</a>)");return e.startsWith("<a")?e.replace(n,(e=>e.slice(0,t))):e.slice(0,t)}(n,a);throw Error(zi(e,`Unknown "SliceBy" value. ${i}`))}(e,n,i);default:throw new Error(zi(e,`Unknown Meta Attribute '${t}'.`))}}(e,i,o,t)}),n)}function Vi(e,t,n,i,a){const o=new Error(zi(t,`${n} meta attribute takes ${i!=a?`between ${i} and ${a}`:i} arguments; received ${e.length}.`));if(e.length<i||e.length>a)throw o}function zi(e,t){return`Malformed Meta Attribute: '${e}' - ${t}`}function Hi(e,t,n,i,a){const o=Wi(e,n,i);if(null!==o)return o;throw Error(zi(t,a||`Could not parse meta attribute argument at index ${n} from arguments ${JSON.stringify(e)}`))}function Wi(e,t,n){return n(e[t])}const qi="DATA",Ki="STATE",Yi=new RegExp(`^(${qi}|${Ki})`),Ji=new RegExp(`^${Ki}`),Zi=new RegExp(`%\\^(?:${qi}|${Ki})\\.[a-zA-Z0-9]+[a-zA-Z0-9\\.]*(?:\\:[a-zA-Z0-9]+\\[[a-zA-Z0-9\\.,]*\\])*(?:\\|.*?)?\\^%`,"g"),Qi=Symbol("invalid");function Xi(e,t="creativeCopy"){const n=ea({data:e},t);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:ea(t,n,this.dataMap)});let i=!1;const a=t,o=X(k(2,-2),ee("|"),(e=>{const t=ne(((e,t)=>{let n;if(Yi.test(t)){if(!this.dataMap.has(t)&&Ji.test(t))throw new jt(vi,`Invalid use of STATE template key in a context it does not exist: ${t}`);const i=ee(":",t);if(i[0]){if(n=this.dataMap.get(i[0]),n&&n===Qi)throw new jt(vi,`Invalid template key referenced: "${t}" is an object but expected a string, boolean, number or empty. \nDid you mean to reference a child property of ${t}?`);if(i.length>1&&n)try{n=Ui(i[0],i.slice(1),n)}catch(e){throw new jt(vi,`Failed to apply meta attributes. ${function(e){return null!=e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:String(e)}(e)}`)}}return n?ie({provided:!0,value:n}):e}return ie({provided:!0,value:t})}),{provided:!1,value:""},e);return t.provided||(i=!0),t.value})),r=te(Zi,o,a);return!1===i?r:""}.bind({dataMap:n})}function ea(e,t,n){const i=new Map(n);return"data"in e&&a(e.data,`${qi}${t?"."+t:""}`),"state"in e&&a(e.state,`${Ki}${t?"."+t:""}`),i;function a(e,t){"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e?i.set(t,(null==e?void 0:e.toString())||""):i.set(t,Qi),e&&"object"==typeof e&&Q(((e,n)=>a(e,`${t}.${n}`)),e)}}const ta=s(Xi({})),na=ta.Consumer,ia=ta.Provider,aa=()=>l(ta),oa=s(null),ra=oa.Provider,sa=s("OUTER"),la=()=>"VARIANT"===l(sa),ca=s(void 0),da=()=>l(ca);var ua,pa,fa,ma,ya,ha,va=function(e,t,n,i){return new(n||(n=Promise))((function(a,o){function r(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((i=i.apply(e,t||[])).next())}))},ga=function(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,n):a?a.value=n:t.set(e,n),n},ba=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class Ia{constructor(e,t,n,i,a){ua.set(this,void 0),pa.set(this,void 0),fa.set(this,new Set),ma.set(this,void 0),ya.set(this,void 0),ha.set(this,void 0),ga(this,ua,ae(e.subscribe.bind(e),[n]),"f"),ga(this,pa,ae(e.dispatch.bind(e),[n]),"f"),ga(this,ma,t,"f"),ga(this,ya,i,"f"),ga(this,ha,a,"f"),this.onGlobalStateChange=this.onGlobalStateChange.bind(this),this.onInteractivityChange=this.onInteractivityChange.bind(this),this.onEvent=this.onEvent.bind(this),this.globalDispatch=this.globalDispatch.bind(this),this.createChildPlugin=this.createChildPlugin.bind(this)}onGlobalStateChange(e){const t=ba(this,ua,"f").call(this,e),n=()=>{t(),ba(this,fa,"f").delete(n)};return ba(this,fa,"f").add(n),n}onInteractivityChange(e){return ba(this,ya,"f").subscribe(e)}onEvent(...e){const t=e.reduce(((e,t)=>{if("partner"===t.source||"*"===t.source){const n=ba(this,ha,"f").call(this,t.name).subscribe(t.callback);return[...e,()=>n.unsubscribe()]}return e}),[]),n=()=>{t.forEach((e=>{e()})),ba(this,fa,"f").delete(n)};return ba(this,fa,"f").add(n),n}globalDispatch(e){ba(this,pa,"f").call(this,e)}dispose(){ba(this,fa,"f").forEach((e=>e())),ga(this,fa,new Set,"f"),ba(this,ya,"f").clear()}createChildPlugin(e){return ba(this,ma,"f").call(this,e)}}ua=new WeakMap,pa=new WeakMap,fa=new WeakMap,ma=new WeakMap,ya=new WeakMap,ha=new WeakMap;class Ea{onGlobalStateChange(){return()=>{}}onInteractivityChange(){return()=>{}}onEvent(){return()=>{}}globalDispatch(){}dispose(){}createChildPlugin(){return{close:()=>va(this,void 0,void 0,(function*(){})),onClose:()=>va(this,void 0,void 0,(function*(){})),putConfig:()=>va(this,void 0,void 0,(function*(){})),send:()=>va(this,void 0,void 0,(function*(){})),onEvent:()=>({subscribe:()=>({unsubscribe:()=>{}})})}}}var Sa,Ca,wa=function(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,n):a?a.value=n:t.set(e,n),n},Oa=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class Ta{constructor(e){Sa.set(this,void 0),Ca.set(this,new Set),wa(this,Sa,e,"f")}subscribe(e){return Oa(this,Ca,"f").add(e),!0===e(Oa(this,Sa,"f"))&&Oa(this,Ca,"f").delete(e),()=>{Oa(this,Ca,"f").delete(e)}}publish(e){wa(this,Sa,e,"f"),Oa(this,Ca,"f").forEach((e=>{!0===e(Oa(this,Sa,"f"))&&Oa(this,Ca,"f").delete(e)}))}clear(){Oa(this,Ca,"f").clear()}}Sa=new WeakMap,Ca=new WeakMap;var xa=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},Aa=function(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,n):a?a.value=n:t.set(e,n),n};const Na="breakpoint-0px";class La{constructor(){this.logger=()=>{}}withAppFactory(e){return this.appFactory=e,this}withLogger(e){return this.logger=e,this}withGatewayFactory(e){return this.gatewayFactory=e,this}build(){var e,t,n,i,a,o,r,s,l,c,d,u,p,f;const m=this.appFactory,y=this.logger,h=null!==(e=this.gatewayFactory)&&void 0!==e?e:()=>new Ea;return f=class extends HTMLElement{static get observedAttributes(){return["visible","interactivity","active-breakpoint"]}constructor(){super(),t.add(this),n.set(this,(()=>null)),i.set(this,(()=>null)),a.set(this,void 0),o.set(this,!1),r.set(this,null),s.set(this,null),l.set(this,null);const e=this.attachShadow({mode:"open"});Aa(this,a,document.createElement("div"),"f"),xa(this,a,"f").id="app-container",xa(this,a,"f").classList.add("default"),e.appendChild(xa(this,a,"f"))}attributeChangedCallback(e,a,o){if(o!==a)switch(e){case"visible":xa(this,n,"f").call(this,"true"===o);break;case"interactivity":"ENABLED"!==o&&"DISABLED"!==o||xa(this,i,"f").call(this,o);break;case"active-breakpoint":xa(this,t,"m",c).call(this,o,a)}}makeInteractivityUpdateHandler(e){Aa(this,i,(t=>{e.publish(t)}),"f")}makeVisbilityUpdateHandler(e,i,a){const o="true"===this.getAttribute("visible"),r=this.getAttribute("slotInstanceGuid");Aa(this,n,(o=>{o?(Aa(this,n,(()=>null),"f"),0===e&&a.globalDispatch({type:on,payload:{event:"Interactive"}}),i&&(a.globalDispatch({type:an,payload:{name:"SignalImpression",parentGuid:i}}),this.trackViewability(i,a)),r&&a.globalDispatch({type:an,payload:{name:"SignalImpression",parentGuid:r}})):xa(this,t,"m",p).call(this)}),"f"),xa(this,n,"f").call(this,o)}trackViewability(e,n){if(!xa(this,o,"f"))if("IntersectionObserver"in window&&!xa(this,r,"f")){const i=()=>{xa(this,o,"f")||(n.globalDispatch({type:an,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!0}}),Aa(this,o,!0,"f"),xa(this,t,"m",p).call(this),xa(this,a,"f").removeEventListener("click",i))};xa(this,a,"f").addEventListener("click",i),Aa(this,r,new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=.5?xa(this,t,"m",u).call(this,(()=>{xa(this,o,"f")||(n.globalDispatch({type:an,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!1}}),Aa(this,o,!0,"f"),xa(this,t,"m",p).call(this),xa(this,a,"f").removeEventListener("click",i))})):xa(this,t,"m",d).call(this)}))}),{threshold:.5}),"f"),Aa(this,l,(()=>{var e,n;"visible"===document.visibilityState?null===(e=xa(this,r,"f"))||void 0===e||e.observe(xa(this,a,"f")):(xa(this,t,"m",d).call(this),null===(n=xa(this,r,"f"))||void 0===n||n.disconnect())}),"f"),document.addEventListener("visibilitychange",xa(this,l,"f")),xa(this,l,"f").call(this)}else n.globalDispatch({type:an,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!1,inferred:!1}}),Aa(this,o,!0,"f")}getOfferPositionAttr(){const e=this.getAttribute("offerPositionIndex"),t=Number(e);return(null==e||isNaN(t)||t<0)&&v(`Offer position attribute (${e}) is invalid`),t}getJSONAttr(e,t="{}"){const n=this.getAttribute(e);try{return JSON.parse(null!=n?n:t)}catch(t){v(`Invalid JSON attribute ${e}: ${n}`)}}disconnectedCallback(){xa(this,t,"m",p).call(this)}connectedCallback(){var e,t,n;const i=this.getAttribute("container"),o=this.getAttribute("plugin-id");xa(this,a,"f").setAttribute("style","width:100%;display:flex;flex-direction:"+("column"===i?"column":"row"));const r=this.getOfferPositionAttr(),s=this.getJSONAttr("layoutSchema"),l=this.getJSONAttr("childLayouts","[]"),c=this.getJSONAttr("offerData"),d=new Ta("DISABLED"===this.getAttribute("interactivity")?"DISABLED":"ENABLED"),u=null!==(e=this.getAttribute("schemaVersion"))&&void 0!==e?e:"",p=this.getJSONAttr("offerState","{}");m||v("Cannot create app without factory. Please build the connector withAppFactory.");const f=h({offerPositionIndex:r,creativeInstanceGuid:null===(t=null==c?void 0:c.creative)||void 0===t?void 0:t.instanceGuid},d);this.makeInteractivityUpdateHandler(d),m({rootElement:xa(this,a,"f"),gateway:f,logger:y,offerPositionIndex:r,offerData:c,layoutSchema:s,childLayouts:l,schemaVersion:u,pluginId:o||_t.pluginId,offerState:p}),this.makeVisbilityUpdateHandler(r,null===(n=null==c?void 0:c.creative)||void 0===n?void 0:n.instanceGuid,f)}},n=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,r=new WeakMap,s=new WeakMap,l=new WeakMap,t=new WeakSet,c=function(e,t){xa(this,a,"f").classList.remove(t||Na),xa(this,a,"f").classList.add(e||Na)},d=function(){xa(this,s,"f")&&(clearTimeout(xa(this,s,"f")),Aa(this,s,null,"f"))},u=function(e){xa(this,t,"m",d).call(this),Aa(this,s,window.setTimeout(e,1e3),"f")},p=function(){xa(this,t,"m",d).call(this),xa(this,r,"f")&&(xa(this,r,"f").disconnect(),Aa(this,r,null,"f")),xa(this,l,"f")&&(document.removeEventListener("visibilitychange",xa(this,l,"f")),Aa(this,l,null,"f"))},f;function v(e){throw y({level:$t,code:"MODULE_BUILDER/FAILED_TO_BUILD_MODULE",message:e}),Error(e)}}}const Ra=s({get:()=>new Ea}),_a=e=>a.createElement(Ra.Provider,{value:{get:()=>e.context}},e.children);const Da=s({get(){throw Error("Layout Schema context has not been set")}}),ka=e=>a.createElement(Da.Provider,{value:{get:()=>e.context}},e.children),$a=()=>l(Da).get(),Pa=s("ENABLED"),ja=()=>l(Pa);function Fa(e){const t=Ma(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Ma(t,this.dataMap)});if(!n)throw new jt("FAILED_TO_MAP_STATIC_DATA","No namespace submitted to StaticData Mapper");return g([n,t],this.dataMap)}.bind({dataMap:t})}const Ga={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function Ma(e,t=Ga){return["images","links","icons","copy","responseOptionsMap"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Object.assign(Object.assign({},t[n]),e[n])})),t)}const Ba=s(Fa({}));Ba.Consumer;const Ua=Ba.Provider,Va=e=>{const t=l(Ba),n=e.split("|");for(const e of n){const n=t(e.trim(),"images");if(n)return n}},za=()=>l(Ba),Ha=s({});function Wa({info:e,children:t}){const n=l(Ha);return a.createElement(Ha.Provider,{value:Object.assign(Object.assign({},n),e)},t)}const qa=s({get(){throw Error("Catalog Item context has not been set")}}),Ka=e=>a.createElement(qa.Provider,{value:{get:()=>e.context}},e.children),Ya=()=>l(qa).get(),Ja=s(""),Za=()=>l(Ja),Qa=s(""),Xa=s(void 0);function eo({children:e}){const t=d((()=>{const e=document.createElement("div");return e.inert=!0,{inert:!0===e.inert}}),[]);return a.createElement(Xa.Provider,{value:t},e)}const to=$(re([Z,le(Z)]),ce,F(de),F(ue(pe,z({}),R)),de,H({},"value")),no=$(Z,U("predicates"));function io(e,t){return`transition: ${t.map((t=>`${t} ${e}ms`)).join(", ")};`}const ao=oe(((e,{duration:t,predicates:n,styles:i})=>{return{predicates:n,classname:e(hi(i)),transitionBaseClassname:e(io(t,(a=i,M(a).flatMap((e=>{const[t,n]=null!=e?e:[];return n&&t?se(n).map((e=>xn(t,e))):[]})))))};var a})),oo=re([to,no]);const ro={is:j,"is-not":$(J,j),"is-below":be,"is-above":ge};function so(e,t){return e.includes(t)}const lo={is:j,"is-not":$(J,j),exists:so,"not-exists":$(J,so)},co={exists:$(J,Ie(pe,Z)),"not-exists":Ie(pe,Z)},uo={"is-true":j(!0),"is-false":j(!1)},po={is:j,"is-not":$(J,j)};function fo(e){return(t,n)=>n[e]}const mo=O([[(e,t)=>j("Breakpoint",e),fo("activeBreakpoint")],[(e,t)=>j("Progression",e),fo("progressionIndex")],[(e,t)=>j("Position",e),fo("positionIndex")]]);function yo(e,t){return e.creativeCopy&&"string"==typeof e.creativeCopy[t]?e.creativeCopy[t]:void 0}const ho=O([[j("Breakpoint"),(e,t,n)=>{const i=me(["breakpoints",t]);return X(fe(i,Number),Ee(i))(n)}],[j("Progression"),(e,t,n)=>O([[ge(0),Se(n.totalGroups)],[Ce(0),R]])(Number(t))],[j("Position"),(e,t,n)=>O([[ge(0),Se(n.totalOffers)],[Ce(0),R]])(Number(t))]]),vo=$(J,isNaN);function go(e,t){return e.map((e=>{var n,i,a;switch(e.type){case"StaticString":return(0,po[e.predicate.condition])(e.predicate.input,e.predicate.value);case"CreativeCopy":return(0,co[e.predicate.condition])(yo(t,e.predicate.value));case"StaticBoolean":return(0,uo[e.predicate.condition])(e.predicate.value);case"CustomState":return(0,ro[e.predicate.condition])(null!==(n=t.customStates[e.predicate.key])&&void 0!==n?n:0,e.predicate.value);case"DomainState":return(0,ro[e.predicate.condition])(null!==(i=t.domainStates[e.predicate.key])&&void 0!==i?i:0,e.predicate.value);case"DarkMode":throw new Error("DarkMode has not yet been implemented.");case"Placeholder":return function(e){switch(e.predicate.type){case"TextValue":return(0,lo[e.predicate.content.condition])(e.predicate.content.input,e.predicate.content.value);case"TextLength":return(0,ro[e.predicate.content.condition])(e.predicate.content.input.length,e.predicate.content.value);case"Numeric":return(0,ro[e.predicate.content.condition])(Number(e.predicate.content.input),e.predicate.content.value);default:return!1}}(e);default:{const n=ro[e.predicate.condition],i=null!==(a=mo(e.type,t))&&void 0!==a?a:NaN,o=ho(e.type,e.predicate.value,t);return!!vo(i)&&n(i,o)}}}))}function bo(e){return B(0,["breakpoint","breakpoints",e.breakpoint.activeBreakpoint],e)}const Io={breakpoints:{},activeBreakpoint:NaN,progressionIndex:NaN,positionIndex:NaN,totalOffers:NaN,totalGroups:NaN,creativeCopy:{},customStates:{},domainStates:{}};function Eo(e,t,n,i){const a=t.map((e=>"Progression"===e.type?Object.assign(Object.assign({},e),{type:i?"Position":e.type}):e)),{cached:o,uncached:r}=a.reduce(((t,i)=>function(e,t,n,i){const a=function(e,t){switch(e.type){case"Position":case"StaticBoolean":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"StaticString":return`${e.type}:${e.predicate.input}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"CreativeCopy":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${yo(t,e.predicate.value)}:${t.totalGroups}`;case"CustomState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.customStates[e.predicate.key]}`;case"DomainState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.domainStates[e.predicate.key]}`;case"Placeholder":return`${e.type}:${e.predicate.type}:${e.predicate.content.condition}:data:${e.predicate.content.input}:${e.predicate.content.value}`;default:return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${mo(e.type,t)}:${t.totalGroups}`}}(e,t),o=n.current.get(a);return he(So(o)?{cached:ve(o)}:{uncached:ve({key:a,predicate:e})},i)}(i,n,e,t)),{cached:[],uncached:[]}),s=go(r.map((({predicate:e})=>e)),n);return ye(r,s).forEach((([{key:t},n])=>{e.current.set(t,n)})),o.concat(s)}const So=V(Boolean);const Co=oe(((e,t,n)=>{var i,a,o,r,s,l;return{breakpoints:n.breakpoint.breakpoints,activeBreakpoint:bo(n),progressionIndex:null!==(a=null===(i=n.progression)||void 0===i?void 0:i.activeGroupIndex)&&void 0!==a?a:0,totalOffers:null!==(r=null===(o=n.progression)||void 0===o?void 0:o.totalOffers)&&void 0!==r?r:0,totalGroups:null!==(l=null===(s=n.progression)||void 0===s?void 0:s.totalGroups)&&void 0!==l?l:0,customStates:n.customStates,domainStates:n.domainStates,positionIndex:e,creativeCopy:t}})),wo=me(["predicate","content","input"]),Oo=me(["predicate","content","value"]),To=me(["predicate","key"]);function xo(e,t){const n=fe(wo,(t=>t?e(t):"")),i=fe(Oo,(t=>"string"==typeof t?e(t):t)),a=$(n,i),o=fe(To,(t=>t?e(t):""));return t.map((e=>{switch(e.type){case"Placeholder":return"TextValue"===e.predicate.type?a(e):n(e);case"CustomState":return o(e);default:return e}}))}const Ao=le(j(!0));function No(e){const t=la(),n=da(),i=r(new Map),a=Fi(),o=Ai(Io,Co(n,a)),s=aa();return d((()=>K((e=>{const n=xo(s,e);return Ao(Eo(i,n,o,t))}),e)),[i,e,o,t,s])}function Lo(e){e&&(e.style.display="")}function Ro(e){e&&(e.style.display="none")}function _o(e){return e.settings.duration}const Do=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],ko=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function $o(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const i=t?Do:ko,a=e.animate(i,{duration:n,iterations:1});return a.onfinish=()=>{t?Lo(e):Ro(e)},a.oncancel=()=>{t?Lo(e):Ro(e)},()=>{a.finish()}}return t?Lo(e):Ro(e),()=>{}}function Po({inTransitions:e,outTransitions:t,visible:n,children:i,containerClassName:s}){const l=r(null);return o((()=>n&&e?e.forEach((e=>{l.current&&function(e,t,n,i){if("FadeIn"===i)$o(e,t,n)}(l.current,n,_o(e),e.type)})):!n&&t?t.forEach((e=>{l.current&&function(e,t,n,i){if("FadeOut"===i)$o(e,t,n)}(l.current,n,_o(e),e.type)})):()=>{}),[n]),a.createElement("div",{ref:l,style:{display:"none"},className:s},i)}function jo(e){const t=Ri(),n=function(e){const t=la(),n=da(),i=r(new Map),a=Fi(),o=Ai(Io,Co(n,a)),s=xo(aa(),e);return d((()=>Ao(Eo(i,s,o,t))),[i,s,o,t])}(e.schema.predicates),i=a.Children.toArray(e.schema.children.map(((n,i)=>t(n,void 0,e.testId?`${e.testId}-child${i}`:void 0))));return e.schema.transition?a.createElement(Po,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:n},i):"functionally"===e.schema.hide?a.createElement(Pa.Provider,{value:n?"ENABLED":"DISABLED"},i):n?a.createElement(a.Fragment,null,i):null}const Fo=we(((e,t)=>`${e||""} ${t||""}`.trim())),Go=e=>{var t;const n=l(oa),i=da(),a=ki()||document.head,o=Za(),r=Ii(o,i,a),s=u(Si,[]),c=Ai([],(e=>Object.values(e.breakpoint.breakpoints))),d=n||s(c,o,i,a),p=e.styles?d(e.styles):{},f=e.styles&&e.styles.conditionalTransitions?function(e,t){const n=ao(e);return K((e=>oo(t)||!e?null:n({predicates:t.predicates,duration:t.duration,styles:e})),t.value)}(r,null===(t=e.styles)||void 0===t?void 0:t.conditionalTransitions):void 0,m=No(f?K(H([],"predicates"),f):{}),y=K(((e,t)=>e?function(e,t){var n;if(e&&t in e)return null===(n=e[t])||void 0===n?void 0:n.classname}(f,t):void 0),m),h=f?K(U("transitionBaseClassname"),f):{},v=e.styles?(g=h,Fo(Fo(p,y),g)):void 0;var g;return e.children({classnames:v,mapperRef:d})};function Mo(e){const t=Ri();return a.createElement(Go,{styles:e.schema.styles},(({classnames:n})=>{var i;return a.createElement("div",{className:n?n.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"column"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},a.Children.toArray(e.schema.children.map(((n,i)=>t(n,void 0,Kt(i,e.testId))))))}))}function Bo(e){const t=Ri();return a.createElement(Go,{styles:e.schema.styles},(({classnames:n})=>{var i;return a.createElement("div",{className:n?n.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"row"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},a.Children.toArray(e.schema.children.map(((n,i)=>t(n,void 0,Kt(i,e.testId))))))}))}const Uo={allowedTags:["em","strong","a","br","u","p","li","ul","ol","s"],allowedAttributes:{a:["href","target",yn,hn],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],s:[]},allowedSchemes:["http","https"]},Vo=new Map([["&","_;^;_"]]),zo=new RegExp(`<a *(?=${Uo.allowedAttributes.a.join("|")}|>)`,"g"),Ho=new RegExp('<a [^>]*href="([^"]+)"',"g"),Wo=new RegExp("(<br *?>)|(<br *?/>)","g"),qo="<br/>";function Ko(e){const t=aa(),n=ja(),i=d((()=>{const n=t(e.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Ho,((e,t)=>{const n=t.replaceAll("&",Vo.get("&"));return e.replace(t,n)})).replaceAll(Wo,qo)}(e);return t===vt(t,Uo)}(n))throw new jt("FAILED_SANITISING_HTML","Invalid HTML tags");return n.trim()?n:""}),[e.schema.value,t]),{tabIndex:o,styles:r,isDisabled:s}=St(n);return i?a.createElement(Go,{styles:e.schema.styles},(({classnames:t})=>{const n=[(null==t?void 0:t.link)?`class = "${null==t?void 0:t.link}"`:"",s?'tabindex="-1"':"",s?"style=\"pointer-events: 'none'; user-select: none;\"":"",s?'aria-disabled="true"':""].filter((e=>e.length>0));return l=i,new RegExp("</(p|ul|ol)>").test(l)?a.createElement("div",{tabIndex:o,style:r,"aria-hidden":s,className:null==t?void 0:t.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:i.replace(zo,`<a ${n.join(" ")}`)}}):a.createElement("p",{tabIndex:o,style:r,"aria-hidden":s,className:null==t?void 0:t.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:i.replace(zo,`<a ${n.join(" ")}`)}});var l})):null}function Yo(e){const t=aa()(e.schema.value),n=ja(),{tabIndex:i,styles:o,isDisabled:r}=St(n);return t?a.createElement(Go,{styles:e.schema.styles},(({classnames:n})=>{const s={tabIndex:i,"aria-hidden":r,className:null==n?void 0:n.own,"data-testid":e.testId,"data-e2e":"BasicText"};return e.isInline?a.createElement("span",Object.assign({style:o},s),t):a.createElement("p",Object.assign({style:o},s),t)})):null}function Jo(e,t,n){if("BasicText"===e.type)return a.createElement(Yo,{schema:e.node,testId:t,isInline:null!=n&&n})}function Zo(e,t,n){return a.Children.toArray(e.map(((e,i)=>t(e,void 0,Kt(i,n)))))}function Qo(e){const t=Ti(),n=Ri(),i=ji(),r=aa(),s=da(),l=ja(),c=i.creative.responseOptionsMap[e.schema.responseKey],d=Nt(c);o((()=>{d&&t(function(e){if(e.paymentTriggerConfig)return{type:cn,payload:{criteria:{key:"PAYMENT_OFFER_SELECTED"},signal:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:e.action,externalKey:"PAYMENT_OFFER_SELECTED"}}}};throw new Error(`Invalid External Response: No 'paymentTriggerConfig' found for external response option with instanceGuid: ${e.instanceGuid}`)}(c))}),[c,t,d]);const u=c?r({data:c},"creativeResponse"):r,{tabIndex:p,styles:f,isDisabled:m}=St(l);return Tt(c)&&!d&&void 0!==s?a.createElement(Go,{styles:e.schema.styles},(({classnames:o,mapperRef:r})=>{var s;return a.createElement("button",{type:"button",tabIndex:p,"aria-disabled":m,"aria-label":null!==(s=e.schema.a11yLabel)&&void 0!==s?s:void 0,style:Object.assign({cursor:"pointer"},f),"data-testid":e.testId,"data-e2e":"CreativeResponse","data-e2e-response-type":e.schema.responseKey,onClick:e=>{e.preventDefault();const n=function(e,t){switch(t.action){case"Fulfillment":{const n=e.creative.fulfillment;if(Ot(n))return{fulfillment:n,responseOption:t,creativeInstanceGuid:e.creative.instanceGuid,accountID:e.accountId,referralCreativeID:e.creative.referralCreativeId};throw new Error(`Invalid Fulfillment: ${n} with referralCreativeID: ${e.creative.referralCreativeId}`)}case"Url":return Object.assign(Object.assign({},t),{accountID:e.accountId,creativeInstanceGuid:e.creative.instanceGuid,referralCreativeID:e.creative.referralCreativeId});default:return Object.assign(Object.assign({},t),{creativeInstanceGuid:e.creative.instanceGuid})}}(i,c);t({type:Jt,payload:n})},className:null==o?void 0:o.own,disabled:m},a.createElement(ia,{value:u},(null==o?void 0:o.own)?function(e,t,n,i,o){return a.createElement(ra,{value:n(t)},Zo(e,i,o))}(e.schema.children,o.own,r,n,e.testId):Zo(e.schema.children,n,e.testId)))})):null}function Xo(e){const t=ja(),{styles:n,isDisabled:i}=St(t);return e.schema.url.light?a.createElement(Go,{styles:Et(e.schema.styles)},(({classnames:t})=>a.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},n),{display:"inline-block"}),alt:i?void 0:e.schema.alt||void 0,title:e.schema.title||void 0,className:t?t.own:void 0,"data-testid":e.testId,"data-e2e":"StaticImage",src:e.schema.url.light}))):null}function er(e){const t=ja(),{styles:n,isDisabled:i}=St(t),o=Va(e.schema.imageKey);return null!=(r=o)&&"object"==typeof r&&"light"in r&&"string"==typeof r.light?a.createElement(Go,{styles:Et(e.schema.styles)},(({classnames:t})=>a.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},n),{display:"inline-block"}),alt:o.alt,title:o.title,className:t?t.own:void 0,"data-testid":e.testId,"data-e2e":"DataImage",src:o.light}))):null;var r}const tr={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function nr(e){const t=e.schema.name,n=e.schema.description,i=e.schema.styles?Wt(tr,e.schema.styles):tr,o=ja(),{styles:r,isDisabled:s}=St(o);return t?a.createElement(Go,{styles:i},(({classnames:i})=>a.createElement("span",Object.assign({style:Object.assign(Object.assign({},r),{display:"inline-block"}),className:"rokt-icon"+((null==i?void 0:i.own)?" "+i.own:""),"data-testid":e.testId,"data-e2e":`StaticIcon-${t}`},!s&&n?{title:n}:{"aria-hidden":"true"}),t))):null}const ir={backgroundColor:"#FFEEEE",color:"#FF0000",fontSize:"10px",padding:"4px",border:"1px solid #FF0000",margin:0,whiteSpace:"normal"};class ar extends a.Component{constructor(e){super(e),this.state={errorMessage:""}}static getDerivedStateFromError(e){return{errorMessage:e.message}}componentDidUpdate(e){this.state.errorMessage&&JSON.stringify(e.schema)!==JSON.stringify(this.props.schema)&&this.setState({errorMessage:""})}componentDidCatch(e,t){var n;this.props.reporter&&"true"===Sn.REPORT_RENDER_ERRORS&&this.props.reporter({level:$t,code:null!==(n=e.code)&&void 0!==n?n:"UNHANDLED_RENDERING_EXCEPTION",message:e.message,additionalInformation:Object.assign({componentStack:t.componentStack,stack:e.stack},this.context||{})})}render(){return this.state.errorMessage?"true"===Sn.DISPLAY_ERRORS?a.createElement("pre",{style:ir},a.createElement("strong",null,"Error:")," [",a.createElement("em",null,this.props.schema.type),"]"," ",this.state.errorMessage):void 0:this.props.children}}ar.contextType=Ha;const or={internally:"_top",externally:"_blank"};function rr(e,t,n){return a.Children.toArray(e.map(((e,i)=>t(e,void 0,n?`${n}-child${i}`:void 0))))}function sr(e){var t;const n=or[e.schema.open],i=Ri(),o=ja(),{tabIndex:r,styles:s,isDisabled:l}=St(o);return(null===(t=e.schema.children)||void 0===t?void 0:t.length)>0?a.createElement(Go,{styles:e.schema.styles},(({classnames:t,mapperRef:o})=>{var c;return a.createElement("a",{href:e.schema.src,"data-testid":e.testId,"data-e2e":"StaticLink",target:null!=n?n:"_blank",tabIndex:r,"aria-disabled":l,"aria-label":null!==(c=e.schema.a11yLabel)&&void 0!==c?c:void 0,style:Object.assign({cursor:"pointer",textDecoration:"none",display:e.isInline?"inline":"block"},s),className:null==t?void 0:t.own},(null==t?void 0:t.own)?function(e,t,n,i,o){return a.createElement(ra,{value:n(t)},rr(e,i,o))}(e.schema.children,null==t?void 0:t.own,o,i,e.testId):rr(e.schema.children,i,e.testId))})):null}function lr(e,t,n){if("StaticLink"===e.type)return a.createElement(sr,{schema:e.node,testId:t,isInline:null!=n&&n})}const cr={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function dr(e){const t=(n=e.schema.iconKey,l(Ba)(n,"icons"));var n;const i=null==t?void 0:t.name,o=e.schema.styles?Wt(cr,e.schema.styles):cr,r=ja(),{styles:s}=St(r);return i?a.createElement(Go,{styles:o},(({classnames:t})=>a.createElement("span",{style:Object.assign(Object.assign({},s),{display:"inline-block"}),"aria-hidden":"true",className:"rokt-icon"+((null==t?void 0:t.own)?" "+t.own:""),"data-testid":e.testId,"data-e2e":`DataIcon-${i}`},i))):null}const ur=Be`
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as i from"react";import a,{useEffect as o,useRef as r,createContext as s,useContext as l,useState as c,useMemo as d,useCallback as u,forwardRef as p}from"react";import{createRoot as f}from"react-dom/client";import{useDispatch as m,useSelector as y,connect as h,Provider as v}from"react-redux";import{path as g,assocPath as b,when as I,allPass as E,hasPath as S,complement as C,pathEq as w,cond as O,mergeDeepWith as T,T as x,flip as A,type as N,unary as L,identity as R,concat as _,zipWith as D,slice as k,compose as $,findIndex as P,equals as j,map as F,sortBy as G,toPairs as M,pathOr as B,prop as U,is as V,always as z,propOr as H,__ as W,memoizeWith as q,mapObjIndexed as K,where as Y,not as J,isEmpty as Z,forEachObjIndexed as Q,pipe as X,split as ee,replace as te,reduce as ne,reduced as ie,partial as ae,curry as oe,anyPass as re,keys as se,all as le,flatten as ce,values as de,ifElse as ue,isNil as pe,over as fe,lensPath as me,zip as ye,evolve as he,append as ve,gt as ge,lt as be,either as Ie,view as Ee,add as Se,lte as Ce,mergeWith as we,omit as Oe,indexBy as Te,mergeRight as xe,lensProp as Ae,defaultTo as Ne,reject as Le,whereEq as Re,uniqBy as _e,find as De,has as ke,assoc as $e,gte as Pe,clone as je,mergeDeepRight as Fe,isNotEmpty as Ge,F as Me}from"ramda";import{css as Be,cx as Ue,keyframes as Ve}from"@emotion/css";import{call as ze,actionChannel as He,take as We,put as qe,cancelled as Ke,select as Ye,all as Je,takeEvery as Ze,fork as Qe,takeLatest as Xe,spawn as et,race as tt,delay as nt}from"redux-saga/effects";import{configureStore as it,combineReducers as at}from"@reduxjs/toolkit";import ot,{buffers as rt,eventChannel as st,END as lt}from"redux-saga";import{all as ct,spawn as dt,takeEvery as ut,call as pt,put as ft,take as mt,delay as yt}from"@redux-saga/core/effects";import ht from"embla-carousel-react";import vt from"insane";import gt from"@emotion/css/create-instance";import bt from"embla-carousel-autoplay";import It from"embla-carousel-fade";function Et(e){const t=["elements","own"],n=["default","dimension","width","type"],i=["default","dimension","width","value"],a=["default","dimension","minWidth"],o=g(t,e);return o&&Array.isArray(o)&&o.length?b(t,o.map(I(E([S(n),C(S(a)),w("fixed",n)]),(e=>b(a,g(i,e),e)))),e):e}function St(e){const t="DISABLED"===e;return{tabIndex:t?-1:void 0,styles:t?{pointerEvents:"none",userSelect:"none"}:void 0,isDisabled:t}}function Ct(e,t){if("EscapeHatch"===t.type)try{return JSON.parse(t.node.data).type===e}catch(e){return!1}return!1}function wt(){return"ontouchstart"in document.documentElement}function Ot(e){return null!=e&&"object"==typeof e&&("url"in e||"name"in e)&&"config"in e}function Tt(e){return null!=e&&"object"==typeof e&&"id"in e&&"action"in e&&"instanceGuid"in e&&"signalType"in e}function xt(e){return Tt(e)&&"Fulfillment"===e.action}function At(e){return Tt(e)&&"Url"===e.action}function Nt(e){return Tt(e)&&"ExternalPaymentTrigger"===e.action}function Lt(e){return(xt(e)||At(e))&&"RealTime"===e.conversionType&&"rclid"in e}function Rt(e){return(xt(e)||At(e))&&"RealTimeReferral"===e.conversionType&&"rclid"in e}const _t={pluginId:"shared",pageInstanceGuid:"N/A"};var Dt;!function(e){e.DCUI="DCUI",e.Partner="partner"}(Dt||(Dt={}));const kt=["SignalCartItemQuantitySelected","SignalProductItemResponse","SignalUserInteraction"],$t="ERROR",Pt="WARNING";class jt extends Error{constructor(e,t){super(t),this.code=null!=e?e:"UNHANDLED_EXCEPTION"}toString(){return`CodedError (${this.code}): ${this.message}`}}const Ft=["V2_CART_ITEM_UPDATED","CART_ITEM_INSTANT_PURCHASE","OFFER_ENGAGEMENT","POSITIVE_ENGAGEMENT","UPSELL_CREATIVE_SENT","REALTIME_OFFER_FULFILLMENT_REFERRAL","REALTIME_OFFER_FULFILLMENT_CONVERSION","REALTIME_OFFER_FULFILLMENT_SUCCESS","INITIATE_INSTANT_PURCHASE_EVENT","PLACEMENT_CLOSED","PLACEMENT_COMPLETED","PLACEMENT_INTERACTIVE","PLACEMENT_FAILURE"];const Gt=(e,t)=>_(e,k(e.length,t.length,t)),Mt=(e,t)=>{if(Array.isArray(e)&&Array.isArray(t)){const n=e.length>t.length?Gt(t,e):t,i=t.length>e.length?Gt(e,t):e;return D(Ht,i,n)}return t},Bt=e=>null==e,Ut=e=>!Bt(e),Vt=(e,t)=>Bt(t)?e:t,zt=(e,t)=>{throw new jt("MERGE_TYPE_INCONSISTENCY",`Unable to merge values for inconsistent types, left = ${e}, right = ${t}`)};function Ht(e,t){return O([[(e,t)=>Ut(e)&&Ut(t)&&N(e)!==N(t)&&("Object"===N(e)||"Object"===N(t)),zt],[(e,t)=>Bt(e)||Bt(t),Vt],[(e,t)=>"Object"===N(e),T(Ht)],[(e,t)=>"Array"===N(e),Mt],[x,A(L(R))]])(e,t)}function Wt(e,t){return Ht(e,t)}function qt(e=0){return`breakpoint-${e}px`}function Kt(e,t){return t?`${t}-child${e}`:void 0}const Yt="GLOBAL/RAISE_METRIC",Jt="GLOBAL/OFFER_ENGAGEMENT";function Zt(e){return null!=e&&"object"==typeof e&&"responseOption"in e&&xt(e.responseOption)&&"fulfillment"in e&&Ot(e.fulfillment)}function Qt(e){return Nt(e)}function Xt(e){return At(e)}function en(e){return function(e){return Tt(e)&&"CaptureOnly"===e.action}(e)}function tn(e){return!!(Lt(e)||"responseOption"in e&&Lt(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}function nn(e){return!!(Rt(e)||"responseOption"in e&&Rt(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}const an="GLOBAL/RAISE_SIGNAL",on="GLOBAL/OFFER_LIFECYCLE",rn="GLOBAL/SET_CUSTOM_STATE",sn="GLOBAL/SEND_PARTNER",ln="GLOBAL/SET_DOMAIN_STATE",cn="GLOBAL/PREPARE_SIGNAL",dn="GLOBAL/OPEN_LINK",un="GLOBAL/SET_PARTNER_VALIDATION_STATUS",pn="GLOBAL/SET_GLOBAL_OFFER_DATA_CART",fn="GLOBAL/LAUNCH_CHILD_LAYOUT",mn={RAISE_METRIC:Yt,PREPARE_SIGNAL:cn,OFFER_ENGAGEMENT:Jt,RAISE_SIGNAL:an,OFFER_LIFECYCLE:on,SEND_PARTNER:sn,SET_CUSTOM_STATE:rn,SET_DOMAIN_STATE:ln,OPEN_LINK:dn,SET_PARTNER_VALIDATION_STATUS:un,SET_GLOBAL_OFFER_DATA_CART:pn,LAUNCH_CHILD_LAYOUT:fn},yn="data-open-in-app",hn="data-click-signal-context";function vn(e,t){function n(e){var n;if(!(e.target&&e.target instanceof HTMLElement))return;const i=null===(n=e.target)||void 0===n?void 0:n.closest("a");if(i){const n=i.getAttribute("href"),a=i.getAttribute(hn);if(a&&t({type:an,payload:{name:"SignalUserInteraction",action:"Click",context:a}}),n){e.preventDefault();let a="newTab";i.hasAttribute(yn)&&(a="inApp"),t({type:dn,payload:{url:n,urlBehaviour:a}})}}}o((()=>null!==e?(e.addEventListener("click",n),()=>{e.removeEventListener("click",n)}):()=>{}),[e])}function gn(){const e=r(null);return o((()=>{const t=t=>{"Tab"===t.key&&bn(t,e)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)}),[e]),e}const bn=(e,t)=>{var n;const i=null===(n=t.current)||void 0===n?void 0:n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!i)return;const a=i[0],o=i[i.length-1],{activeElement:r}=window.document;if(1!==i.length)return r===a&&e.shiftKey?(o&&o.focus(),void e.preventDefault()):r!==o||e.shiftKey?void 0:(a&&a.focus(),void e.preventDefault());e.preventDefault()},In=G(U(1)),En=F(U(0)),Sn="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DISPLAY_ERRORS:"true",REPORT_RENDER_ERRORS:"true",USE_MEDIA_QUERY_NESTING:"true"};function Cn(e,t){return t?"false"!==Sn.USE_MEDIA_QUERY_NESTING?`${n=e,`@media (min-width: ${n}px)`} {${t}}`:t.includes(" & ")?`#app-container.${qt(e)} ${t.trim()}`:`#app-container.${qt(e)} & {${t}}`:"";var n}const wn={hovered:":hover",pressed:":active",focussed:":focus",disabled:":disabled"};function On(e){return function(e){return Object.keys(wn).indexOf(e)>-1}(e)?wn[e]:""}const Tn={container:{justifyContent:"justify-content",alignItems:"align-items",shadow:"box-shadow",gap:"gap",overflow:"overflow",blur:"filter",opacity:"opacity"},text:{textColor:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",lineHeight:"line-height",lineLimit:"",letterSpacing:"letter-spacing",baselineTextAlign:"vertical-align",horizontalTextAlign:"text-align",textDecoration:"text-decoration",textTransform:"text-transform"},background:{backgroundColor:"background-color",backgroundImage:""},dimension:{width:"width",maxWidth:"max-width",minWidth:"min-width",height:"height",maxHeight:"max-height",minHeight:"min-height",rotateZ:"transform"},flexChild:{alignSelf:"align-self",weight:"flex",order:"order"},spacing:{margin:"margin",padding:"padding",offset:""},border:{borderColor:"border-color",borderRadius:"border-radius",borderWidth:"border-width",borderStyle:"border-style"}};function xn(e,t){if(!Tn[e]||!Tn[e][t])throw new Error(`No CSS property mapping exists for styling property: ${e}.${t.toString()}`);return Tn[e][t]}function An(e,t){return n=>t(...Object.keys(e).map((t=>e[t](n[t]))))}function Nn(...e){let t="";const n=(...e)=>e.reduce(((e,n)=>(e&&n?e=e+t+n:n&&(e=n),e)),"");return 1===e.length?(t=e[0],n):n(...e)}function Ln(e,t){return`${e}:${t};`}function Rn(e){return function(e,t){return`@media (${e}) {${t}}\n`}("prefers-color-scheme: dark",e)}class _n extends Error{constructor(e,t){super(`Invalid styling value '${t}': ${e}.`),this.name=this.constructor.name}}function Dn(e,t){if(null===t)return!1;const n=("function"==typeof e?[e]:e).map((e=>e(t))).reduce(((e,t)=>t?e?e+=`, ${t}`:t:e),void 0);if(n)throw new _n(n,JSON.stringify(t));return!0}function kn(e){if(isNaN(e)||"number"!=typeof e&&"string"!=typeof e)return"value must be a number"}function $n(e){return t=>{const n=t&&"symbol"!=typeof t?t.toString():t;if(!(e.indexOf(n)>=0))return`value must be one of [${e.join(",")}]`}}function Pn(e){if(null==e||""===e)return"value must not be omitted"}function jn(e){const t=new RegExp(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/);if("string"!=typeof e||!t.test(e))return"value must be a valid hex color"}function Fn(e){const t=new RegExp(/^(?:(?:data:image\/[^;]+;base64[^"]+)|(?:(?:https?:)?\/\/[a-zA-Z\d-]+(?:\.[a-zA-Z\d-]+)*(?::\d{1,10})?)?(?:\.\.?\/?)*\/(?:[a-zA-Z\d\-_]+\/)*[a-zA-Z\d\-_]+\.[a-zA-Z\d]{2,6}(?:\?(?:.+=.+&?)*)?)(?:#.+)?$/);if("string"!=typeof e||!t.test(e))return"value must be a valid CSS URL string"}function Gn(e){if(null!=e&&""!==e)return"value must not be specified"}function Mn(e){return t=>{if(t&&"object"==typeof t&&"value"in t&&"type"in t&&"string"==typeof t.type&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t.type)&&"function"==typeof e[t.type]){const n=e[t.type](t.value);if(!n)return;return`object must have valid "value" for type: ${t.type}: ${n}`}return`value must be an object that has a "type" property that matches one of: [${Object.keys(e).join(", ")}] and a "value" property`}}function Bn(...e){return t=>{if("string"==typeof t){const n=t.split(" ");if(n.length>1&&e.indexOf(n.length)>-1){if(!n.reduce(((e,t)=>e||kn(t)),void 0))return}}return`value must be a space separated list of numbers, of one of the following lengths: ${e.join(" ,")}`}}function Un(e,t){return n=>{const i=e(n),a=t(n);if(i&&a)return`one of these must be true: ${i} -OR- ${a}`}}function Vn(e){if("string"!=typeof e)return"value must be a string"}const zn=V(Object);function Hn(e){const t=Object.entries(e);return n=>zn(n)&&!Array.isArray(n)?t.reduce(((e,[t,i])=>e||i(n[t])),void 0):`Input value (${e}) must be an object`}function Wn(e){if("number"!=typeof e&&"string"!=typeof e||isNaN(e)||!(e>=0))return"value must be a positive number"}function qn(e,t,n){return Dn(kn,n)?Ln(xn(e,t),`${n}`):""}function Kn(e){return(t,n,i)=>Dn($n(Object.keys(e)),i)?Ln(xn(t,n),`${e[i]}`):""}function Yn(e){return Dn(Pn,e)?An({light:t(Fn,!1),dark:t(Un(Gn,Fn),!0)},Nn("\n "))(e):"";function t(e,t){return n=>{if(Dn(e,n)&&n){const e=Ln("background-image",`url("${n}")`);return t?Rn(e):e}return""}}}function Jn(e){const t={crop:"auto",fit:"contain",fill:"cover"};return"string"==typeof e&&(e=e.toLowerCase()),Dn(Un(Gn,$n(Object.keys(t))),e)&&e?Ln("background-size",t[e]):""}const Zn=O([[j("top-left"),z("top left")],[j("top-right"),z("top right")],[j("bottom-left"),z("bottom left")],[j("bottom-right"),z("bottom right")],[x,R]]);function Qn(e){const t="string"==typeof e?e.toLowerCase():e;return Dn(Un(Gn,$n(["top","right","bottom","left","center","top-left","top-right","bottom-left","bottom-right"])),t)&&t?Ln("background-position",Zn(t)):""}function Xn(e,t,n){return Dn(Un(kn,Bn(2,3,4)),n)?Ln(xn(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function ei(e){return(t,n,i)=>Dn(Mn({fit:$n(e),percentage:kn,fixed:kn}),i)?Ln(xn(t,n),ti(i)):""}function ti(e){const t={"wrap-content":"fit-content","fit-width":"100%","fit-height":"100%"};switch(e.type){case"fixed":return`${e.value}px`;case"percentage":return`${e.value}%`;case"fit":return t[e.value]}}const ni=Hn({light:jn,dark:Un(Gn,jn)});function ii(e,t,n){return i=>{if(i){const a=Ln(xn(e,t),oi(String(i)));return n?Rn(a):a}return""}}function ai(e,t,n){return Dn(ni,n)?An({light:ii(e,t,!1),dark:ii(e,t,!0)},Nn("\n "))(n):""}function oi(e){const t=e.toUpperCase();switch(t.length){case 5:return`#${t.substring(2,5)}${t[1]}`;case 9:return`#${t.substring(3,9)}${t[1]}${t[2]}`;default:return t.toUpperCase()}}const ri=Hn({offsetX:Un(Gn,kn),offsetY:Un(Gn,kn),blurRadius:Un(Gn,kn),spreadRadius:Un(Gn,kn),color:ni}),si=e=>t=>null!=t?String(t):e,li=$(_(W,"px"),si("0")),ci=e=>t=>"string"==typeof t?e(t):t,di=$(ci(_(W,"px")),si(void 0)),ui=$(ci(oi),U("dark"));function pi(e,t,n){return Ln(e,An({offsetX:li,offsetY:li,blurRadius:t.spreadRadius?li:di,spreadRadius:di,color:n},Nn(" "))(t))}const fi={center:"center","flex-end":"flex-end","flex-start":"flex-start",stretch:"stretch"},mi={container:{justifyContent:Kn(fi),alignItems:Kn(fi),shadow:function(e,t,n){var i;if(Dn(ri,n)){const a=xn(e,t);return Nn("\n")(pi(a,n,$(oi,H("#80000000","light"))),(null===(i=n.color)||void 0===i?void 0:i.dark)?Rn(pi(a,n,ui)):"")}return""},gap:Xn,overflow:Kn({hidden:"hidden",visible:"visible"}),blur:function(e,t,n){return Dn(Wn,n)?Ln(xn(e,t),`blur(${n.toString()}px)`):""},opacity:qn},text:{textColor:ai,fontSize:Xn,fontFamily:function(e,t,n){return Dn(Vn,n)?Ln(xn(e,t),(i=`${n}`,i.replace(/['();{}@:[\]!/=]/g,"")).split(",").map(((e,t)=>{const n=0===t?e:e.trim();if(n.includes(" ")){const e=n.startsWith('"')?"":'"',t=n.endsWith('"')?"":'"';return`${e}${n}${t}`}return n})).join(",")):"";var i},fontWeight:Kn({100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900}),fontStyle:Kn({normal:"normal",italic:"italic"}),lineHeight:Xn,lineLimit:function(e,t,n){return Dn(kn,n)?`\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: ${n};\n line-clamp: ${n}; \n -webkit-box-orient: vertical;\n `:""},letterSpacing:Xn,baselineTextAlign:Kn({super:"super",sub:"sub",baseline:"baseline"}),horizontalTextAlign:Kn({left:"left",right:"right",center:"center",start:"start",end:"end",justify:"justify"}),textDecoration:Kn({underline:"underline","strike-through":"line-through",none:"none"}),textTransform:Kn({capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",none:"none"})},background:{backgroundColor:ai,backgroundImage:function(e,t,n){return Dn(Pn,n)?An({url:Yn,position:Qn,scale:Jn},Nn)(n):""}},dimension:{width:ei(["wrap-content","fit-width"]),maxWidth:Xn,minWidth:Xn,height:ei(["wrap-content","fit-height"]),maxHeight:Xn,minHeight:Xn,rotateZ:(yi="Z",(e,t,n)=>{const i=`rotate${yi}`;return Dn(kn,n)?Ln(xn(e,t),`${i}(${n.toString()}deg)`):""})},flexChild:{alignSelf:Kn(fi),weight:qn,order:qn},spacing:{margin:Xn,padding:Xn,offset:function(e,t,n){return Dn(Bn(2),n)?`transform:translate(${n.split(" ").join("px, ")}px);`:""}},border:{borderColor:ai,borderRadius:Xn,borderWidth:Xn,borderStyle:Kn({solid:"solid",dashed:"dashed"})}};var yi;function hi(e){return Object.keys(e).reduce(((t,n)=>(n&&e[n]&&Object.keys(e[n]).forEach((i=>{if(!mi[n])throw new Error(`No styling transformers exist for styling category key: ${n}`);const a=mi[n][i];if(!a)throw new Error(`No styling transformer exists for property: ${n}.${i.toString()}`);try{t+=a(n,i,e[n][i])}catch(e){throw e&&"object"==typeof e&&"message"in e&&(e.message=`Error parsing styling key ${n}.${i.toString()}: ${e.message}`),e}})),t)),"")}const vi="FAILED_TEMPLATING_DATA",gi=new Map;function bi(e){return String.fromCharCode(97+e)}function Ii(e,t,n){const i=`${e||_t.pluginId}-${void 0!==t?String(t):"outer"}`,a=gi.get(i);if(a&&a.sheet.container.isConnected)return a.css;const o=function(e,t){const n={key:void 0!==e?`inner-css-${bi(e)}`:"outer-css",container:t};return t&&t.parentElement&&(n.container=t.parentElement),gt(n)}(t,n);return gi.set(i,o),o.css}const Ei="%%%OWN_CLASS_REF%%%",Si=q(((e,t,n,i)=>`${String(e)}-${t}-${n}`),Ci);function Ci(e,t,n,i){const a=Ii(t,n,i);let o=1;return function t(n,i=!1){var r;if("string"==typeof n){const e={scopeClass:n};return t.bind(e)}const s=n,l=this.scopeClass,c=Object.entries(null!==(r=s.elements)&&void 0!==r?r:{});try{const t=c.reduce(((t,[n,a])=>Object.assign(Object.assign({},t),{[n]:wi(a,l,i,String(n),e)})),{}),n=Object.entries(t),r=i?"parent-"+o++:"",s=function(e){return"own"in e&&"string"==typeof e.own&&e.own.length>0}(t)?a(t.own):"";return n.reduce(((e,[t,n=""])=>{if("own"===t)return e;const i=n.replace(Ei,r);return Object.assign(Object.assign({},e),{[t]:i?a(i):""})}),{own:`${s}${s&&r?" ":""}${r}`})}catch(e){const t=e;throw t.code="FAILED_PARSING_STYLES",t}}.bind({})}function wi(e,t,n,i,a){return e.map(function(e,t,n){return i=>Object.entries(i).map((([i,a])=>{const o=a?hi(a):"";switch(!0){case"default"===i:return o?`\n${o}\n`:"";case Boolean(e):return`\n .${e}${On(i)} & {\n${o}\n}\n`;case t&&"own"!==n:return`\n .${Ei}${On(i)} & {\n${o}\n}\n`;default:return`\n &${On(i)} {\n${o}\n}\n`}})).join("")}(t,n,i)).reduce(((e,t,n)=>{const i=a[n];return void 0!==i?e+(0===n?t:`${Cn(i,t)}\n`):e}),"")}const Oi=s(z(void 0)),Ti=()=>l(Oi),xi=s(null);function Ai(e,t){var n;const i=l(xi);return i&&null!==(n=t(i))&&void 0!==n?n:e}const Ni=s((()=>{throw Error("Node Mapper Context does not have a mapper. Use the NodeMapperProvider with the default nodeMapper as a value before you consume this mapper")})),Li=Ni.Consumer,Ri=()=>l(Ni),_i=e=>a.createElement(Ni.Provider,{value:(t,n,i)=>e.value(t,null!=n?n:e.overrides,i)},e.children),Di=s(null),ki=()=>l(Di),$i=s({get(){throw Error("Offer context has not been set")}}),Pi=e=>a.createElement($i.Provider,{value:{get:()=>e.context}},e.children),ji=()=>l($i).get(),Fi=()=>{try{return l($i).get().creative.copy}catch(e){return}},Gi=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),Mi=$(J,Z),Bi=Y({url:Mi,title:Mi});function Ui(e,t,n){return t.reduce(((t,n)=>{const[i,a]=n.slice(0,-1).split("["),o=a?a.split(","):[];if(!i)throw new Error(zi(e,"This Meta Attribute could not be parsed."));return function(e,t,n,i){switch(t){case"openLinks":return function(e,t,n){Vi(t,e,"openLinks",1,2);const i=Hi(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),a=Wi(t,1,(e=>"string"==typeof e&&e.length?e:null));if("InApp"===i)return n.replace(Gi,((e,t)=>`<a ${yn} ${a?`${hn}="${a}" `:""}${t}`));return n}(e,n,i);case"sliceText":return function(e,t,n){Vi(t,e,"sliceText",2,2);const i=Hi(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),a=Hi(t,e,1,(e=>{const t=Number(e);return!Number.isNaN(t)&&t>=0?t:null}),"sliceText meta attribute second argument must be a positive number");if("Chars"===i)return function(e,t){const n=new RegExp("(?<=<a.*>).*(?=</a>)");return e.startsWith("<a")?e.replace(n,(e=>e.slice(0,t))):e.slice(0,t)}(n,a);throw Error(zi(e,`Unknown "SliceBy" value. ${i}`))}(e,n,i);default:throw new Error(zi(e,`Unknown Meta Attribute '${t}'.`))}}(e,i,o,t)}),n)}function Vi(e,t,n,i,a){const o=new Error(zi(t,`${n} meta attribute takes ${i!=a?`between ${i} and ${a}`:i} arguments; received ${e.length}.`));if(e.length<i||e.length>a)throw o}function zi(e,t){return`Malformed Meta Attribute: '${e}' - ${t}`}function Hi(e,t,n,i,a){const o=Wi(e,n,i);if(null!==o)return o;throw Error(zi(t,a||`Could not parse meta attribute argument at index ${n} from arguments ${JSON.stringify(e)}`))}function Wi(e,t,n){return n(e[t])}const qi="DATA",Ki="STATE",Yi=new RegExp(`^(${qi}|${Ki})`),Ji=new RegExp(`^${Ki}`),Zi=new RegExp(`%\\^(?:${qi}|${Ki})\\.[a-zA-Z0-9]+[a-zA-Z0-9\\.]*(?:\\:[a-zA-Z0-9]+\\[[a-zA-Z0-9\\.,]*\\])*(?:\\|.*?)?\\^%`,"g"),Qi=Symbol("invalid");function Xi(e,t="creativeCopy"){const n=ea({data:e},t);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:ea(t,n,this.dataMap)});let i=!1;const a=t,o=X(k(2,-2),ee("|"),(e=>{const t=ne(((e,t)=>{let n;if(Yi.test(t)){if(!this.dataMap.has(t)&&Ji.test(t))throw new jt(vi,`Invalid use of STATE template key in a context it does not exist: ${t}`);const i=ee(":",t);if(i[0]){if(n=this.dataMap.get(i[0]),n&&n===Qi)throw new jt(vi,`Invalid template key referenced: "${t}" is an object but expected a string, boolean, number or empty. \nDid you mean to reference a child property of ${t}?`);if(i.length>1&&n)try{n=Ui(i[0],i.slice(1),n)}catch(e){throw new jt(vi,`Failed to apply meta attributes. ${function(e){return null!=e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:String(e)}(e)}`)}}return n?ie({provided:!0,value:n}):e}return ie({provided:!0,value:t})}),{provided:!1,value:""},e);return t.provided||(i=!0),t.value})),r=te(Zi,o,a);return!1===i?r:""}.bind({dataMap:n})}function ea(e,t,n){const i=new Map(n);return"data"in e&&a(e.data,`${qi}${t?"."+t:""}`),"state"in e&&a(e.state,`${Ki}${t?"."+t:""}`),i;function a(e,t){"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e?i.set(t,(null==e?void 0:e.toString())||""):i.set(t,Qi),e&&"object"==typeof e&&Q(((e,n)=>a(e,`${t}.${n}`)),e)}}const ta=s(Xi({})),na=ta.Consumer,ia=ta.Provider,aa=()=>l(ta),oa=s(null),ra=oa.Provider,sa=s("OUTER"),la=()=>"VARIANT"===l(sa),ca=s(void 0),da=()=>l(ca);var ua,pa,fa,ma,ya,ha,va=function(e,t,n,i){return new(n||(n=Promise))((function(a,o){function r(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((i=i.apply(e,t||[])).next())}))},ga=function(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,n):a?a.value=n:t.set(e,n),n},ba=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class Ia{constructor(e,t,n,i,a){ua.set(this,void 0),pa.set(this,void 0),fa.set(this,new Set),ma.set(this,void 0),ya.set(this,void 0),ha.set(this,void 0),ga(this,ua,ae(e.subscribe.bind(e),[n]),"f"),ga(this,pa,ae(e.dispatch.bind(e),[n]),"f"),ga(this,ma,t,"f"),ga(this,ya,i,"f"),ga(this,ha,a,"f"),this.onGlobalStateChange=this.onGlobalStateChange.bind(this),this.onInteractivityChange=this.onInteractivityChange.bind(this),this.onEvent=this.onEvent.bind(this),this.globalDispatch=this.globalDispatch.bind(this),this.createChildPlugin=this.createChildPlugin.bind(this)}onGlobalStateChange(e){const t=ba(this,ua,"f").call(this,e),n=()=>{t(),ba(this,fa,"f").delete(n)};return ba(this,fa,"f").add(n),n}onInteractivityChange(e){return ba(this,ya,"f").subscribe(e)}onEvent(...e){const t=e.reduce(((e,t)=>{if("partner"===t.source||"*"===t.source){const n=ba(this,ha,"f").call(this,t.name).subscribe(t.callback);return[...e,()=>n.unsubscribe()]}return e}),[]),n=()=>{t.forEach((e=>{e()})),ba(this,fa,"f").delete(n)};return ba(this,fa,"f").add(n),n}globalDispatch(e){ba(this,pa,"f").call(this,e)}dispose(){ba(this,fa,"f").forEach((e=>e())),ga(this,fa,new Set,"f"),ba(this,ya,"f").clear()}createChildPlugin(e){return ba(this,ma,"f").call(this,e)}}ua=new WeakMap,pa=new WeakMap,fa=new WeakMap,ma=new WeakMap,ya=new WeakMap,ha=new WeakMap;class Ea{onGlobalStateChange(){return()=>{}}onInteractivityChange(){return()=>{}}onEvent(){return()=>{}}globalDispatch(){}dispose(){}createChildPlugin(){return{close:()=>va(this,void 0,void 0,(function*(){})),onClose:()=>va(this,void 0,void 0,(function*(){})),putConfig:()=>va(this,void 0,void 0,(function*(){})),send:()=>va(this,void 0,void 0,(function*(){})),onEvent:()=>({subscribe:()=>({unsubscribe:()=>{}})})}}}var Sa,Ca,wa=function(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,n):a?a.value=n:t.set(e,n),n},Oa=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};class Ta{constructor(e){Sa.set(this,void 0),Ca.set(this,new Set),wa(this,Sa,e,"f")}subscribe(e){return Oa(this,Ca,"f").add(e),!0===e(Oa(this,Sa,"f"))&&Oa(this,Ca,"f").delete(e),()=>{Oa(this,Ca,"f").delete(e)}}publish(e){wa(this,Sa,e,"f"),Oa(this,Ca,"f").forEach((e=>{!0===e(Oa(this,Sa,"f"))&&Oa(this,Ca,"f").delete(e)}))}clear(){Oa(this,Ca,"f").clear()}}Sa=new WeakMap,Ca=new WeakMap;var xa=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},Aa=function(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,n):a?a.value=n:t.set(e,n),n};const Na="breakpoint-0px";class La{constructor(){this.logger=()=>{}}withAppFactory(e){return this.appFactory=e,this}withLogger(e){return this.logger=e,this}withGatewayFactory(e){return this.gatewayFactory=e,this}build(){var e,t,n,i,a,o,r,s,l,c,d,u,p,f;const m=this.appFactory,y=this.logger,h=null!==(e=this.gatewayFactory)&&void 0!==e?e:()=>new Ea;return f=class extends HTMLElement{static get observedAttributes(){return["visible","interactivity","active-breakpoint"]}constructor(){super(),t.add(this),n.set(this,(()=>null)),i.set(this,(()=>null)),a.set(this,void 0),o.set(this,!1),r.set(this,null),s.set(this,null),l.set(this,null);const e=this.attachShadow({mode:"open"});Aa(this,a,document.createElement("div"),"f"),xa(this,a,"f").id="app-container",xa(this,a,"f").classList.add("default"),e.appendChild(xa(this,a,"f"))}attributeChangedCallback(e,a,o){if(o!==a)switch(e){case"visible":xa(this,n,"f").call(this,"true"===o);break;case"interactivity":"ENABLED"!==o&&"DISABLED"!==o||xa(this,i,"f").call(this,o);break;case"active-breakpoint":xa(this,t,"m",c).call(this,o,a)}}makeInteractivityUpdateHandler(e){Aa(this,i,(t=>{e.publish(t)}),"f")}makeVisbilityUpdateHandler(e,i,a){const o="true"===this.getAttribute("visible"),r=this.getAttribute("slotInstanceGuid");Aa(this,n,(o=>{o?(Aa(this,n,(()=>null),"f"),0===e&&a.globalDispatch({type:on,payload:{event:"Interactive"}}),i&&(a.globalDispatch({type:an,payload:{name:"SignalImpression",parentGuid:i}}),this.trackViewability(i,a)),r&&a.globalDispatch({type:an,payload:{name:"SignalImpression",parentGuid:r}})):xa(this,t,"m",p).call(this)}),"f"),xa(this,n,"f").call(this,o)}trackViewability(e,n){if(!xa(this,o,"f"))if("IntersectionObserver"in window&&!xa(this,r,"f")){const i=()=>{xa(this,o,"f")||(n.globalDispatch({type:an,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!0}}),Aa(this,o,!0,"f"),xa(this,t,"m",p).call(this),xa(this,a,"f").removeEventListener("click",i))};xa(this,a,"f").addEventListener("click",i),Aa(this,r,new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=.5?xa(this,t,"m",u).call(this,(()=>{xa(this,o,"f")||(n.globalDispatch({type:an,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!1}}),Aa(this,o,!0,"f"),xa(this,t,"m",p).call(this),xa(this,a,"f").removeEventListener("click",i))})):xa(this,t,"m",d).call(this)}))}),{threshold:.5}),"f"),Aa(this,l,(()=>{var e,n;"visible"===document.visibilityState?null===(e=xa(this,r,"f"))||void 0===e||e.observe(xa(this,a,"f")):(xa(this,t,"m",d).call(this),null===(n=xa(this,r,"f"))||void 0===n||n.disconnect())}),"f"),document.addEventListener("visibilitychange",xa(this,l,"f")),xa(this,l,"f").call(this)}else n.globalDispatch({type:an,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!1,inferred:!1}}),Aa(this,o,!0,"f")}getOfferPositionAttr(){const e=this.getAttribute("offerPositionIndex"),t=Number(e);return(null==e||isNaN(t)||t<0)&&v(`Offer position attribute (${e}) is invalid`),t}getJSONAttr(e,t="{}"){const n=this.getAttribute(e);try{return JSON.parse(null!=n?n:t)}catch(t){v(`Invalid JSON attribute ${e}: ${n}`)}}disconnectedCallback(){xa(this,t,"m",p).call(this)}connectedCallback(){var e,t,n;const i=this.getAttribute("container"),o=this.getAttribute("plugin-id");xa(this,a,"f").setAttribute("style","width:100%;display:flex;flex-direction:"+("column"===i?"column":"row"));const r=this.getOfferPositionAttr(),s=this.getJSONAttr("layoutSchema"),l=this.getJSONAttr("childLayouts","[]"),c=this.getJSONAttr("offerData"),d=new Ta("DISABLED"===this.getAttribute("interactivity")?"DISABLED":"ENABLED"),u=null!==(e=this.getAttribute("schemaVersion"))&&void 0!==e?e:"",p=this.getJSONAttr("offerState","{}");m||v("Cannot create app without factory. Please build the connector withAppFactory.");const f=h({offerPositionIndex:r,creativeInstanceGuid:null===(t=null==c?void 0:c.creative)||void 0===t?void 0:t.instanceGuid},d);this.makeInteractivityUpdateHandler(d),m({rootElement:xa(this,a,"f"),gateway:f,logger:y,offerPositionIndex:r,offerData:c,layoutSchema:s,childLayouts:l,schemaVersion:u,pluginId:o||_t.pluginId,offerState:p}),this.makeVisbilityUpdateHandler(r,null===(n=null==c?void 0:c.creative)||void 0===n?void 0:n.instanceGuid,f)}},n=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,r=new WeakMap,s=new WeakMap,l=new WeakMap,t=new WeakSet,c=function(e,t){xa(this,a,"f").classList.remove(t||Na),xa(this,a,"f").classList.add(e||Na)},d=function(){xa(this,s,"f")&&(clearTimeout(xa(this,s,"f")),Aa(this,s,null,"f"))},u=function(e){xa(this,t,"m",d).call(this),Aa(this,s,window.setTimeout(e,1e3),"f")},p=function(){xa(this,t,"m",d).call(this),xa(this,r,"f")&&(xa(this,r,"f").disconnect(),Aa(this,r,null,"f")),xa(this,l,"f")&&(document.removeEventListener("visibilitychange",xa(this,l,"f")),Aa(this,l,null,"f"))},f;function v(e){throw y({level:$t,code:"MODULE_BUILDER/FAILED_TO_BUILD_MODULE",message:e}),Error(e)}}}const Ra=s({get:()=>new Ea}),_a=e=>a.createElement(Ra.Provider,{value:{get:()=>e.context}},e.children);const Da=s({get(){throw Error("Layout Schema context has not been set")}}),ka=e=>a.createElement(Da.Provider,{value:{get:()=>e.context}},e.children),$a=()=>l(Da).get(),Pa=s("ENABLED"),ja=()=>l(Pa);function Fa(e){const t=Ma(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Ma(t,this.dataMap)});if(!n)throw new jt("FAILED_TO_MAP_STATIC_DATA","No namespace submitted to StaticData Mapper");return g([n,t],this.dataMap)}.bind({dataMap:t})}const Ga={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function Ma(e,t=Ga){return["images","links","icons","copy","responseOptionsMap"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Object.assign(Object.assign({},t[n]),e[n])})),t)}const Ba=s(Fa({}));Ba.Consumer;const Ua=Ba.Provider,Va=e=>{const t=l(Ba),n=e.split("|");for(const e of n){const n=t(e.trim(),"images");if(n)return n}},za=()=>l(Ba),Ha=s({});function Wa({info:e,children:t}){const n=l(Ha);return a.createElement(Ha.Provider,{value:Object.assign(Object.assign({},n),e)},t)}const qa=s({get(){throw Error("Catalog Item context has not been set")}}),Ka=e=>a.createElement(qa.Provider,{value:{get:()=>e.context}},e.children),Ya=()=>l(qa).get(),Ja=s(""),Za=()=>l(Ja),Qa=s(""),Xa=s(void 0);function eo({children:e}){const t=d((()=>{const e=document.createElement("div");return e.inert=!0,{inert:!0===e.inert}}),[]);return a.createElement(Xa.Provider,{value:t},e)}const to=$(re([Z,le(Z)]),ce,F(de),F(ue(pe,z({}),R)),de,H({},"value")),no=$(Z,U("predicates"));function io(e,t){return`transition: ${t.map((t=>`${t} ${e}ms`)).join(", ")};`}const ao=oe(((e,{duration:t,predicates:n,styles:i})=>{return{predicates:n,classname:e(hi(i)),transitionBaseClassname:e(io(t,(a=i,M(a).flatMap((e=>{const[t,n]=null!=e?e:[];return n&&t?se(n).map((e=>xn(t,e))):[]})))))};var a})),oo=re([to,no]);const ro={is:j,"is-not":$(J,j),"is-below":be,"is-above":ge};function so(e,t){return e.includes(t)}const lo={is:j,"is-not":$(J,j),exists:so,"not-exists":$(J,so)},co={exists:$(J,Ie(pe,Z)),"not-exists":Ie(pe,Z)},uo={"is-true":j(!0),"is-false":j(!1)},po={is:j,"is-not":$(J,j)};function fo(e){return(t,n)=>n[e]}const mo=O([[(e,t)=>j("Breakpoint",e),fo("activeBreakpoint")],[(e,t)=>j("Progression",e),fo("progressionIndex")],[(e,t)=>j("Position",e),fo("positionIndex")]]);function yo(e,t){return e.creativeCopy&&"string"==typeof e.creativeCopy[t]?e.creativeCopy[t]:void 0}const ho=O([[j("Breakpoint"),(e,t,n)=>{const i=me(["breakpoints",t]);return X(fe(i,Number),Ee(i))(n)}],[j("Progression"),(e,t,n)=>O([[ge(0),Se(n.totalGroups)],[Ce(0),R]])(Number(t))],[j("Position"),(e,t,n)=>O([[ge(0),Se(n.totalOffers)],[Ce(0),R]])(Number(t))]]),vo=$(J,isNaN);function go(e,t){return e.map((e=>{var n,i,a;switch(e.type){case"StaticString":return(0,po[e.predicate.condition])(e.predicate.input,e.predicate.value);case"CreativeCopy":return(0,co[e.predicate.condition])(yo(t,e.predicate.value));case"StaticBoolean":return(0,uo[e.predicate.condition])(e.predicate.value);case"CustomState":return(0,ro[e.predicate.condition])(null!==(n=t.customStates[e.predicate.key])&&void 0!==n?n:0,e.predicate.value);case"DomainState":return(0,ro[e.predicate.condition])(null!==(i=t.domainStates[e.predicate.key])&&void 0!==i?i:0,e.predicate.value);case"DarkMode":throw new Error("DarkMode has not yet been implemented.");case"Placeholder":return function(e){switch(e.predicate.type){case"TextValue":return(0,lo[e.predicate.content.condition])(e.predicate.content.input,e.predicate.content.value);case"TextLength":return(0,ro[e.predicate.content.condition])(e.predicate.content.input.length,e.predicate.content.value);case"Numeric":return(0,ro[e.predicate.content.condition])(Number(e.predicate.content.input),e.predicate.content.value);default:return!1}}(e);default:{const n=ro[e.predicate.condition],i=null!==(a=mo(e.type,t))&&void 0!==a?a:NaN,o=ho(e.type,e.predicate.value,t);return!!vo(i)&&n(i,o)}}}))}function bo(e){return B(0,["breakpoint","breakpoints",e.breakpoint.activeBreakpoint],e)}const Io={breakpoints:{},activeBreakpoint:NaN,progressionIndex:NaN,positionIndex:NaN,totalOffers:NaN,totalGroups:NaN,creativeCopy:{},customStates:{},domainStates:{}};function Eo(e,t,n,i){const a=t.map((e=>"Progression"===e.type?Object.assign(Object.assign({},e),{type:i?"Position":e.type}):e)),{cached:o,uncached:r}=a.reduce(((t,i)=>function(e,t,n,i){const a=function(e,t){switch(e.type){case"Position":case"StaticBoolean":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"StaticString":return`${e.type}:${e.predicate.input}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"CreativeCopy":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${yo(t,e.predicate.value)}:${t.totalGroups}`;case"CustomState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.customStates[e.predicate.key]}`;case"DomainState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.domainStates[e.predicate.key]}`;case"Placeholder":return`${e.type}:${e.predicate.type}:${e.predicate.content.condition}:data:${e.predicate.content.input}:${e.predicate.content.value}`;default:return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${mo(e.type,t)}:${t.totalGroups}`}}(e,t),o=n.current.get(a);return he(So(o)?{cached:ve(o)}:{uncached:ve({key:a,predicate:e})},i)}(i,n,e,t)),{cached:[],uncached:[]}),s=go(r.map((({predicate:e})=>e)),n);return ye(r,s).forEach((([{key:t},n])=>{e.current.set(t,n)})),o.concat(s)}const So=V(Boolean);const Co=oe(((e,t,n)=>{var i,a,o,r,s,l;return{breakpoints:n.breakpoint.breakpoints,activeBreakpoint:bo(n),progressionIndex:null!==(a=null===(i=n.progression)||void 0===i?void 0:i.activeGroupIndex)&&void 0!==a?a:0,totalOffers:null!==(r=null===(o=n.progression)||void 0===o?void 0:o.totalOffers)&&void 0!==r?r:0,totalGroups:null!==(l=null===(s=n.progression)||void 0===s?void 0:s.totalGroups)&&void 0!==l?l:0,customStates:n.customStates,domainStates:n.domainStates,positionIndex:e,creativeCopy:t}})),wo=me(["predicate","content","input"]),Oo=me(["predicate","content","value"]),To=me(["predicate","key"]);function xo(e,t){const n=fe(wo,(t=>t?e(t):"")),i=fe(Oo,(t=>"string"==typeof t?e(t):t)),a=$(n,i),o=fe(To,(t=>t?e(t):""));return t.map((e=>{switch(e.type){case"Placeholder":return"TextValue"===e.predicate.type?a(e):n(e);case"CustomState":return o(e);default:return e}}))}const Ao=le(j(!0));function No(e){const t=la(),n=da(),i=r(new Map),a=Fi(),o=Ai(Io,Co(n,a)),s=aa();return d((()=>K((e=>{const n=xo(s,e);return Ao(Eo(i,n,o,t))}),e)),[i,e,o,t,s])}function Lo(e){e&&(e.style.display="")}function Ro(e){e&&(e.style.display="none")}function _o(e){return e.settings.duration}const Do=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],ko=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function $o(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const i=t?Do:ko,a=e.animate(i,{duration:n,iterations:1});return a.onfinish=()=>{t?Lo(e):Ro(e)},a.oncancel=()=>{t?Lo(e):Ro(e)},()=>{a.finish()}}return t?Lo(e):Ro(e),()=>{}}function Po({inTransitions:e,outTransitions:t,visible:n,children:i,containerClassName:s}){const l=r(null);return o((()=>n&&e?e.forEach((e=>{l.current&&function(e,t,n,i){if("FadeIn"===i)$o(e,t,n)}(l.current,n,_o(e),e.type)})):!n&&t?t.forEach((e=>{l.current&&function(e,t,n,i){if("FadeOut"===i)$o(e,t,n)}(l.current,n,_o(e),e.type)})):()=>{}),[n]),a.createElement("div",{ref:l,style:{display:"none"},className:s},i)}function jo(e){const t=Ri(),n=function(e){const t=la(),n=da(),i=r(new Map),a=Fi(),o=Ai(Io,Co(n,a)),s=xo(aa(),e);return d((()=>Ao(Eo(i,s,o,t))),[i,s,o,t])}(e.schema.predicates),i=a.Children.toArray(e.schema.children.map(((n,i)=>t(n,void 0,e.testId?`${e.testId}-child${i}`:void 0))));return e.schema.transition?a.createElement(Po,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:n},i):"functionally"===e.schema.hide?a.createElement(Pa.Provider,{value:n?"ENABLED":"DISABLED"},i):n?a.createElement(a.Fragment,null,i):null}const Fo=we(((e,t)=>`${e||""} ${t||""}`.trim())),Go=e=>{var t;const n=l(oa),i=da(),a=ki()||document.head,o=Za(),r=Ii(o,i,a),s=u(Si,[]),c=Ai([],(e=>Object.values(e.breakpoint.breakpoints))),d=n||s(c,o,i,a),p=e.styles?d(e.styles):{},f=e.styles&&e.styles.conditionalTransitions?function(e,t){const n=ao(e);return K((e=>oo(t)||!e?null:n({predicates:t.predicates,duration:t.duration,styles:e})),t.value)}(r,null===(t=e.styles)||void 0===t?void 0:t.conditionalTransitions):void 0,m=No(f?K(H([],"predicates"),f):{}),y=K(((e,t)=>e?function(e,t){var n;if(e&&t in e)return null===(n=e[t])||void 0===n?void 0:n.classname}(f,t):void 0),m),h=f?K(U("transitionBaseClassname"),f):{},v=e.styles?(g=h,Fo(Fo(p,y),g)):void 0;var g;return e.children({classnames:v,mapperRef:d})};function Mo(e){const t=Ri();return a.createElement(Go,{styles:e.schema.styles},(({classnames:n})=>{var i;return a.createElement("div",{className:n?n.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"column"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},a.Children.toArray(e.schema.children.map(((n,i)=>t(n,void 0,Kt(i,e.testId))))))}))}function Bo(e){const t=Ri();return a.createElement(Go,{styles:e.schema.styles},(({classnames:n})=>{var i;return a.createElement("div",{className:n?n.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"row"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},a.Children.toArray(e.schema.children.map(((n,i)=>t(n,void 0,Kt(i,e.testId))))))}))}const Uo={allowedTags:["em","strong","a","br","u","p","li","ul","ol","s"],allowedAttributes:{a:["href","target",yn,hn],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],s:[]},allowedSchemes:["http","https"]},Vo=new Map([["&","_;^;_"]]),zo=new RegExp(`<a *(?=${Uo.allowedAttributes.a.join("|")}|>)`,"g"),Ho=new RegExp('<a [^>]*href="([^"]+)"',"g"),Wo=new RegExp("(<br *?>)|(<br *?/>)","g"),qo="<br/>";function Ko(e){const t=aa(),n=ja(),i=d((()=>{const n=t(e.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Ho,((e,t)=>{const n=t.replaceAll("&",Vo.get("&"));return e.replace(t,n)})).replaceAll(Wo,qo)}(e);return t===vt(t,Uo)}(n))throw new jt("FAILED_SANITISING_HTML","Invalid HTML tags");return n.trim()?n:""}),[e.schema.value,t]),{tabIndex:o,styles:r,isDisabled:s}=St(n);return i?a.createElement(Go,{styles:e.schema.styles},(({classnames:t})=>{const n=[(null==t?void 0:t.link)?`class = "${null==t?void 0:t.link}"`:"",s?'tabindex="-1"':"",s?"style=\"pointer-events: 'none'; user-select: none;\"":"",s?'aria-disabled="true"':""].filter((e=>e.length>0));return l=i,new RegExp("</(p|ul|ol)>").test(l)?a.createElement("div",{tabIndex:o,style:r,"aria-hidden":s,className:null==t?void 0:t.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:i.replace(zo,`<a ${n.join(" ")}`)}}):a.createElement("p",{tabIndex:o,style:r,"aria-hidden":s,className:null==t?void 0:t.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:i.replace(zo,`<a ${n.join(" ")}`)}});var l})):null}function Yo(e){const t=aa()(e.schema.value),n=ja(),{tabIndex:i,styles:o,isDisabled:r}=St(n);return t?a.createElement(Go,{styles:e.schema.styles},(({classnames:n})=>{const s={tabIndex:i,"aria-hidden":r,className:null==n?void 0:n.own,"data-testid":e.testId,"data-e2e":"BasicText"};return e.isInline?a.createElement("span",Object.assign({style:o},s),t):a.createElement("p",Object.assign({style:o},s),t)})):null}function Jo(e,t,n){if("BasicText"===e.type)return a.createElement(Yo,{schema:e.node,testId:t,isInline:null!=n&&n})}function Zo(e,t,n){return a.Children.toArray(e.map(((e,i)=>t(e,void 0,Kt(i,n)))))}function Qo(e){const t=Ti(),n=Ri(),i=ji(),r=aa(),s=da(),l=ja(),c=i.creative.responseOptionsMap[e.schema.responseKey],d=Nt(c);o((()=>{d&&t(function(e){if(e.paymentTriggerConfig)return{type:cn,payload:{criteria:{key:"PAYMENT_OFFER_SELECTED"},signal:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:e.action,externalKey:"PAYMENT_OFFER_SELECTED"}}}};throw new Error(`Invalid External Response: No 'paymentTriggerConfig' found for external response option with instanceGuid: ${e.instanceGuid}`)}(c))}),[c,t,d]);const u=c?r({data:c},"creativeResponse"):r,{tabIndex:p,styles:f,isDisabled:m}=St(l);return Tt(c)&&!d&&void 0!==s?a.createElement(Go,{styles:e.schema.styles},(({classnames:o,mapperRef:r})=>{var s;return a.createElement("button",{type:"button",tabIndex:p,"aria-disabled":m,"aria-label":null!==(s=e.schema.a11yLabel)&&void 0!==s?s:void 0,style:Object.assign({cursor:"pointer"},f),"data-testid":e.testId,"data-e2e":"CreativeResponse","data-e2e-response-type":e.schema.responseKey,onClick:n=>{n.preventDefault();const a=function(e,t,n){switch(t.action){case"Fulfillment":{const n=e.creative.fulfillment;if(Ot(n))return{fulfillment:n,responseOption:t,creativeInstanceGuid:e.creative.instanceGuid,accountID:e.accountId,referralCreativeID:e.creative.referralCreativeId};throw new Error(`Invalid Fulfillment: ${n} with referralCreativeID: ${e.creative.referralCreativeId}`)}case"Url":return Object.assign(Object.assign({},t),{accountID:e.accountId,creativeInstanceGuid:e.creative.instanceGuid,referralCreativeID:e.creative.referralCreativeId,urlBehavior:n&&"internally"===n.toLowerCase()?"self":t.urlBehavior});default:return Object.assign(Object.assign({},t),{creativeInstanceGuid:e.creative.instanceGuid})}}(i,c,e.schema.openLinks);t({type:Jt,payload:a})},className:null==o?void 0:o.own,disabled:m},a.createElement(ia,{value:u},(null==o?void 0:o.own)?function(e,t,n,i,o){return a.createElement(ra,{value:n(t)},Zo(e,i,o))}(e.schema.children,o.own,r,n,e.testId):Zo(e.schema.children,n,e.testId)))})):null}function Xo(e){const t=ja(),{styles:n,isDisabled:i}=St(t);return e.schema.url.light?a.createElement(Go,{styles:Et(e.schema.styles)},(({classnames:t})=>a.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},n),{display:"inline-block"}),alt:i?void 0:e.schema.alt||void 0,title:e.schema.title||void 0,className:t?t.own:void 0,"data-testid":e.testId,"data-e2e":"StaticImage",src:e.schema.url.light}))):null}function er(e){const t=ja(),{styles:n,isDisabled:i}=St(t),o=Va(e.schema.imageKey);return null!=(r=o)&&"object"==typeof r&&"light"in r&&"string"==typeof r.light?a.createElement(Go,{styles:Et(e.schema.styles)},(({classnames:t})=>a.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},n),{display:"inline-block"}),alt:o.alt,title:o.title,className:t?t.own:void 0,"data-testid":e.testId,"data-e2e":"DataImage",src:o.light}))):null;var r}const tr={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function nr(e){const t=e.schema.name,n=e.schema.description,i=e.schema.styles?Wt(tr,e.schema.styles):tr,o=ja(),{styles:r,isDisabled:s}=St(o);return t?a.createElement(Go,{styles:i},(({classnames:i})=>a.createElement("span",Object.assign({style:Object.assign(Object.assign({},r),{display:"inline-block"}),className:"rokt-icon"+((null==i?void 0:i.own)?" "+i.own:""),"data-testid":e.testId,"data-e2e":`StaticIcon-${t}`},!s&&n?{title:n}:{"aria-hidden":"true"}),t))):null}const ir={backgroundColor:"#FFEEEE",color:"#FF0000",fontSize:"10px",padding:"4px",border:"1px solid #FF0000",margin:0,whiteSpace:"normal"};class ar extends a.Component{constructor(e){super(e),this.state={errorMessage:""}}static getDerivedStateFromError(e){return{errorMessage:e.message}}componentDidUpdate(e){this.state.errorMessage&&JSON.stringify(e.schema)!==JSON.stringify(this.props.schema)&&this.setState({errorMessage:""})}componentDidCatch(e,t){var n;this.props.reporter&&"true"===Sn.REPORT_RENDER_ERRORS&&this.props.reporter({level:$t,code:null!==(n=e.code)&&void 0!==n?n:"UNHANDLED_RENDERING_EXCEPTION",message:e.message,additionalInformation:Object.assign({componentStack:t.componentStack,stack:e.stack},this.context||{})})}render(){return this.state.errorMessage?"true"===Sn.DISPLAY_ERRORS?a.createElement("pre",{style:ir},a.createElement("strong",null,"Error:")," [",a.createElement("em",null,this.props.schema.type),"]"," ",this.state.errorMessage):void 0:this.props.children}}ar.contextType=Ha;const or={internally:"_top",externally:"_blank"};function rr(e,t,n){return a.Children.toArray(e.map(((e,i)=>t(e,void 0,n?`${n}-child${i}`:void 0))))}function sr(e){var t;const n=or[e.schema.open],i=Ri(),o=ja(),{tabIndex:r,styles:s,isDisabled:l}=St(o);return(null===(t=e.schema.children)||void 0===t?void 0:t.length)>0?a.createElement(Go,{styles:e.schema.styles},(({classnames:t,mapperRef:o})=>{var c;return a.createElement("a",{href:e.schema.src,"data-testid":e.testId,"data-e2e":"StaticLink",target:null!=n?n:"_blank",tabIndex:r,"aria-disabled":l,"aria-label":null!==(c=e.schema.a11yLabel)&&void 0!==c?c:void 0,style:Object.assign({cursor:"pointer",textDecoration:"none",display:e.isInline?"inline":"block"},s),className:null==t?void 0:t.own},(null==t?void 0:t.own)?function(e,t,n,i,o){return a.createElement(ra,{value:n(t)},rr(e,i,o))}(e.schema.children,null==t?void 0:t.own,o,i,e.testId):rr(e.schema.children,i,e.testId))})):null}function lr(e,t,n){if("StaticLink"===e.type)return a.createElement(sr,{schema:e.node,testId:t,isInline:null!=n&&n})}const cr={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function dr(e){const t=(n=e.schema.iconKey,l(Ba)(n,"icons"));var n;const i=null==t?void 0:t.name,o=e.schema.styles?Wt(cr,e.schema.styles):cr,r=ja(),{styles:s}=St(r);return i?a.createElement(Go,{styles:o},(({classnames:t})=>a.createElement("span",{style:Object.assign(Object.assign({},s),{display:"inline-block"}),"aria-hidden":"true",className:"rokt-icon"+((null==t?void 0:t.own)?" "+t.own:""),"data-testid":e.testId,"data-e2e":`DataIcon-${i}`},i))):null}const ur=Be`
2
2
  display: flex;
3
3
  position: relative;
4
4
  overflow: hidden;
@@ -5,12 +5,12 @@ export type Signals = (CoreSignals | CartSignals) & {
5
5
  export type CoreSignals = LoadStart | LoadComplete | Activation | Impression | Viewed | Response | Dismissal | UserInteraction | InstantPurchaseDismissal | ProductItemResponse;
6
6
  export type ResponseActionPayload = CaptureOnlyAction | UrlAction | ExternalAction | FulfillmentAction;
7
7
  export type CartSignals = CartItemInstantPurchaseInitiated | CartItemInstantPurchase | CartItemInstantPurchaseFailure | CartItemQuantitySelected;
8
- export type UniqueSignal = LoadStart | LoadComplete | Activation | Impression | Viewed | Response | Dismissal | UserInteraction | InstantPurchaseDismissal | CartItemInstantPurchaseInitiated | CartItemInstantPurchase | CartItemInstantPurchaseFailure;
8
+ export type UniqueSignal = LoadStart | LoadComplete | Activation | Impression | Viewed | Response | Dismissal | InstantPurchaseDismissal | CartItemInstantPurchaseInitiated | CartItemInstantPurchase | CartItemInstantPurchaseFailure;
9
9
  export declare enum InitiatedBy {
10
10
  DCUI = "DCUI",
11
11
  Partner = "partner"
12
12
  }
13
- export type RepeatableSignal = CartItemQuantitySelected | ProductItemResponse;
13
+ export type RepeatableSignal = CartItemQuantitySelected | ProductItemResponse | UserInteraction;
14
14
  export interface LoadComplete {
15
15
  name: 'SignalLoadComplete';
16
16
  parentGuid: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokt/dcui-orchestrator",
3
- "version": "0.2.1-rc.32",
3
+ "version": "0.2.1-rc.33",
4
4
  "description": "Rokt's DCUI rendering process",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",