@rokt/dcui-orchestrator 0.2.1-rc.49 → 0.2.1-rc.50

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"),y=require("embla-carousel-fade");function m(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=m(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 T(e){return(S(e)||C(e))&&"RealTime"===e.conversionType&&"rclid"in e}function O(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",L="WARNING";class k extends Error{constructor(e,t){super(t),this.code=null!=e?e:"UNHANDLED_EXCEPTION"}toString(){return`CodedError (${this.code}): ${this.message}`}}const _=["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","INITIATE_CART_ITEM_EVENT","PLACEMENT_CLOSED","PLACEMENT_COMPLETED","PLACEMENT_INTERACTIVE","PLACEMENT_FAILURE"];const D=(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?D(t,e):t,a=t.length>e.length?D(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 k("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!!(T(e)||"responseOption"in e&&T(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}function Q(e){return!!(O(e)||"responseOption"in e&&O(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="GLOBAL/CART_ITEM_EVENT/INITIATE",de="GLOBAL/CART_ITEM_EVENT/RESPONSE",ue="GLOBAL/CART_SERVICE/INITIALIZE",pe={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,INITIATE_CART_ITEM_EVENT:ce,CART_ITEM_RESPONSE:de},fe="data-open-in-app",ye="data-click-signal-context";function me(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(ye);if(i&&n({type:X,payload:{name:"SignalUserInteraction",action:"Click",context:i}}),t){e.preventDefault();let i="newTab";a.hasAttribute(fe)&&(i="inApp"),n({type:oe,payload:{url:t,urlBehaviour:i}})}}}t.useEffect((()=>null!==e?(e.addEventListener("click",a),()=>{e.removeEventListener("click",a)}):()=>{}),[e])}function he(){const e=t.useRef(null);return t.useEffect((()=>{const t=t=>{"Tab"===t.key&&ve(t,e)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)}),[e]),e}const ve=(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()},ge=i.sortBy(i.prop(1)),be=i.map(i.prop(0)),Ie="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DISPLAY_ERRORS:"true",REPORT_RENDER_ERRORS:"true",USE_MEDIA_QUERY_NESTING:"true"};function Ee(e,t){return t?"false"!==Ie.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 xe={hovered:":hover",pressed:":active",focussed:":focus",disabled:":disabled"};function Se(e){return function(e){return Object.keys(xe).indexOf(e)>-1}(e)?xe[e]:""}const Ce={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 we(e,t){if(!Ce[e]||!Ce[e][t])throw new Error(`No CSS property mapping exists for styling property: ${e}.${t.toString()}`);return Ce[e][t]}function Te(e,t){return n=>t(...Object.keys(e).map((t=>e[t](n[t]))))}function Oe(...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 Ae(e,t){return`${e}:${t};`}function je(e){return function(e,t){return`@media (${e}) {${t}}\n`}("prefers-color-scheme: dark",e)}class Re extends Error{constructor(e,t){super(`Invalid styling value '${t}': ${e}.`),this.name=this.constructor.name}}function Ne(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 Re(n,JSON.stringify(t));return!0}function Le(e){if(isNaN(e)||"number"!=typeof e&&"string"!=typeof e)return"value must be a number"}function ke(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 _e(e){if(null==e||""===e)return"value must not be omitted"}function De(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 Pe(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 $e(e){if(null!=e&&""!==e)return"value must not be specified"}function Fe(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 Ge(...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||Le(t)),void 0))return}}return`value must be a space separated list of numbers, of one of the following lengths: ${e.join(" ,")}`}}function Me(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 Be(e){if("string"!=typeof e)return"value must be a string"}const Ue=i.is(Object);function Ve(e){const t=Object.entries(e);return n=>Ue(n)&&!Array.isArray(n)?t.reduce(((e,[t,a])=>e||a(n[t])),void 0):`Input value (${e}) must be an object`}function ze(e){if("number"!=typeof e&&"string"!=typeof e||isNaN(e)||!(e>=0))return"value must be a positive number"}function qe(e,t,n){return Ne(Le,n)?Ae(we(e,t),`${n}`):""}function He(e){return(t,n,a)=>Ne(ke(Object.keys(e)),a)?Ae(we(t,n),`${e[a]}`):""}function We(e){return Ne(_e,e)?Te({light:t(Pe,!1),dark:t(Me($e,Pe),!0)},Oe("\n "))(e):"";function t(e,t){return n=>{if(Ne(e,n)&&n){const e=Ae("background-image",`url("${n}")`);return t?je(e):e}return""}}}function Ke(e){const t={crop:"auto",fit:"contain",fill:"cover"};return"string"==typeof e&&(e=e.toLowerCase()),Ne(Me($e,ke(Object.keys(t))),e)&&e?Ae("background-size",t[e]):""}const Ye=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 Je(e){const t="string"==typeof e?e.toLowerCase():e;return Ne(Me($e,ke(["top","right","bottom","left","center","top-left","top-right","bottom-left","bottom-right"])),t)&&t?Ae("background-position",Ye(t)):""}function Ze(e,t,n){return Ne(Me(Le,Ge(2,3,4)),n)?Ae(we(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function Qe(e){return(t,n,a)=>Ne(Fe({fit:ke(e),percentage:Le,fixed:Le}),a)?Ae(we(t,n),Xe(a)):""}function Xe(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 et=Ve({light:De,dark:Me($e,De)});function tt(e,t,n){return a=>{if(a){const i=Ae(we(e,t),at(String(a)));return n?je(i):i}return""}}function nt(e,t,n){return Ne(et,n)?Te({light:tt(e,t,!1),dark:tt(e,t,!0)},Oe("\n "))(n):""}function at(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 it=Ve({offsetX:Me($e,Le),offsetY:Me($e,Le),blurRadius:Me($e,Le),spreadRadius:Me($e,Le),color:et}),ot=e=>t=>null!=t?String(t):e,rt=i.compose(i.concat(i.__,"px"),ot("0")),st=e=>t=>"string"==typeof t?e(t):t,lt=i.compose(st(i.concat(i.__,"px")),ot(void 0)),ct=i.compose(st(at),i.prop("dark"));function dt(e,t,n){return Ae(e,Te({offsetX:rt,offsetY:rt,blurRadius:t.spreadRadius?rt:lt,spreadRadius:lt,color:n},Oe(" "))(t))}const ut={center:"center","flex-end":"flex-end","flex-start":"flex-start",stretch:"stretch"},pt={container:{justifyContent:He(ut),alignItems:He(ut),shadow:function(e,t,n){var a,o,r;if(Ne(it,n)){const s=we(e,t);return Oe("\n")(dt(s,n,(o="light",r="#80000000",i.compose(at,i.propOr(r,o)))),(null===(a=n.color)||void 0===a?void 0:a.dark)?je(dt(s,n,ct)):"")}return""},gap:Ze,overflow:He({hidden:"hidden",visible:"visible"}),blur:function(e,t,n){return Ne(ze,n)?Ae(we(e,t),`blur(${n.toString()}px)`):""},opacity:qe},text:{textColor:nt,fontSize:Ze,fontFamily:function(e,t,n){return Ne(Be,n)?Ae(we(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:He({100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900}),fontStyle:He({normal:"normal",italic:"italic"}),lineHeight:Ze,lineLimit:function(e,t,n){return Ne(Le,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:Ze,baselineTextAlign:He({super:"super",sub:"sub",baseline:"baseline"}),horizontalTextAlign:He({left:"left",right:"right",center:"center",start:"start",end:"end",justify:"justify"}),textDecoration:He({underline:"underline","strike-through":"line-through",none:"none"}),textTransform:He({capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",none:"none"})},background:{backgroundColor:nt,backgroundImage:function(e,t,n){return Ne(_e,n)?Te({url:We,position:Je,scale:Ke},Oe)(n):""}},dimension:{width:Qe(["wrap-content","fit-width"]),maxWidth:Ze,minWidth:Ze,height:Qe(["wrap-content","fit-height"]),maxHeight:Ze,minHeight:Ze,rotateZ:(ft="Z",(e,t,n)=>{const a=`rotate${ft}`;return Ne(Le,n)?Ae(we(e,t),`${a}(${n.toString()}deg)`):""})},flexChild:{alignSelf:He(ut),weight:qe,order:qe},spacing:{margin:Ze,padding:Ze,offset:function(e,t,n){return Ne(Ge(2),n)?`transform:translate(${n.split(" ").join("px, ")}px);`:""}},border:{borderColor:nt,borderRadius:Ze,borderWidth:Ze,borderStyle:He({solid:"solid",dashed:"dashed"})}};var ft;function yt(e){return Object.keys(e).reduce(((t,n)=>(n&&e[n]&&Object.keys(e[n]).forEach((a=>{if(!pt[n])throw new Error(`No styling transformers exist for styling category key: ${n}`);const i=pt[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 mt="FAILED_TEMPLATING_DATA",ht=new Map;function vt(e){return String.fromCharCode(97+e)}function gt(e,t,n){const a=`${e||A.pluginId}-${void 0!==t?String(t):"outer"}`,i=ht.get(a);if(i&&i.sheet.container.isConnected)return i.css;const o=function(e,t){const n={key:void 0!==e?`inner-css-${vt(e)}`:"outer-css",container:t};return t&&t.parentElement&&(n.container=t.parentElement),p(n)}(t,n);return ht.set(a,o),o.css}const bt="%%%OWN_CLASS_REF%%%",It=i.memoizeWith(((e,t,n,a)=>`${String(e)}-${t}-${n}`),Et);function Et(e,t,n,a){const i=gt(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]:xt(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(bt,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 xt(e,t,n,a,i){return e.map(function(e,t,n){return a=>Object.entries(a).map((([a,i])=>{const o=i?yt(i):"";switch(!0){case"default"===a:return o?`\n${o}\n`:"";case Boolean(e):return`\n .${e}${Se(a)} & {\n${o}\n}\n`;case t&&"own"!==n:return`\n .${bt}${Se(a)} & {\n${o}\n}\n`;default:return`\n &${Se(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:`${Ee(a,t)}\n`):e}),"")}const St=t.createContext(i.always(void 0)),Ct=()=>t.useContext(St),wt=t.createContext(null);function Tt(e,n){var a;const i=t.useContext(wt);return i&&null!==(a=n(i))&&void 0!==a?a:e}const Ot=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")})),At=Ot.Consumer,jt=()=>t.useContext(Ot),Rt=e=>t.createElement(Ot.Provider,{value:(t,n,a)=>e.value(t,null!=n?n:e.overrides,a)},e.children),Nt=t.createContext(null),Lt=()=>t.useContext(Nt),kt=t.createContext({get(){throw Error("Offer context has not been set")}}),_t=e=>t.createElement(kt.Provider,{value:{get:()=>e.context}},e.children),Dt=()=>t.useContext(kt).get(),Pt=()=>{try{return t.useContext(kt).get().creative.copy}catch(e){return}},$t=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),Ft=i.compose(i.not,i.isEmpty),Gt=i.where({url:Ft,title:Ft});function Mt(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(Ut(e,"This Meta Attribute could not be parsed."));return function(e,t,n,a){switch(t){case"openLinks":return function(e,t,n){Bt(t,e,"openLinks",1,2);const a=Vt(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),i=zt(t,1,(e=>"string"==typeof e&&e.length?e:null));if("InApp"===a)return n.replace($t,((e,t)=>`<a ${fe} ${i?`${ye}="${i}" `:""}${t}`));return n}(e,n,a);case"sliceText":return function(e,t,n){Bt(t,e,"sliceText",2,2);const a=Vt(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),i=Vt(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(Ut(e,`Unknown "SliceBy" value. ${a}`))}(e,n,a);default:throw new Error(Ut(e,`Unknown Meta Attribute '${t}'.`))}}(e,a,o,t)}),n)}function Bt(e,t,n,a,i){const o=new Error(Ut(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 Ut(e,t){return`Malformed Meta Attribute: '${e}' - ${t}`}function Vt(e,t,n,a,i){const o=zt(e,n,a);if(null!==o)return o;throw Error(Ut(t,i||`Could not parse meta attribute argument at index ${n} from arguments ${JSON.stringify(e)}`))}function zt(e,t,n){return n(e[t])}const qt="DATA",Ht="STATE",Wt=new RegExp(`^(${qt}|${Ht})`),Kt=new RegExp(`^${Ht}`),Yt=new RegExp(`%\\^(?:${qt}|${Ht})\\.[a-zA-Z0-9]+[a-zA-Z0-9\\.]*(?:\\:[a-zA-Z0-9]+\\[[a-zA-Z0-9\\.,]*\\])*(?:\\|.*?)?\\^%`,"g"),Jt=Symbol("invalid");function Zt(e,t="creativeCopy"){const n=Qt({data:e},t);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Qt(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(Wt.test(t)){if(!this.dataMap.has(t)&&Kt.test(t))throw new k(mt,`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===Jt)throw new k(mt,`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=Mt(a[0],a.slice(1),n)}catch(e){throw new k(mt,`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(Yt,r,o);return!1===a?s:""}.bind({dataMap:n})}function Qt(e,t,n){const a=new Map(n);return"data"in e&&o(e.data,`${qt}${t?"."+t:""}`),"state"in e&&o(e.state,`${Ht}${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,Jt),e&&"object"==typeof e&&i.forEachObjIndexed(((e,n)=>o(e,`${t}.${n}`)),e)}}const Xt=t.createContext(Zt({})),en=Xt.Consumer,tn=Xt.Provider,nn=()=>t.useContext(Xt),an=t.createContext(null),on=an.Provider,rn=t.createContext("OUTER"),sn=()=>"VARIANT"===t.useContext(rn),ln=t.createContext(void 0),cn=()=>t.useContext(ln);var dn,un,pn,fn,yn,mn,hn=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())}))},vn=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},gn=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 bn{constructor(e,t,n,a,o){dn.set(this,void 0),un.set(this,void 0),pn.set(this,new Set),fn.set(this,void 0),yn.set(this,void 0),mn.set(this,void 0),vn(this,dn,i.partial(e.subscribe.bind(e),[n]),"f"),vn(this,un,i.partial(e.dispatch.bind(e),[n]),"f"),vn(this,fn,t,"f"),vn(this,yn,a,"f"),vn(this,mn,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=gn(this,dn,"f").call(this,e),n=()=>{t(),gn(this,pn,"f").delete(n)};return gn(this,pn,"f").add(n),n}onInteractivityChange(e){return gn(this,yn,"f").subscribe(e)}onEvent(...e){const t=e.reduce(((e,t)=>{if("partner"===t.source||"*"===t.source){const n=gn(this,mn,"f").call(this,t.name).subscribe(t.callback);return[...e,()=>n.unsubscribe()]}return e}),[]),n=()=>{t.forEach((e=>{e()})),gn(this,pn,"f").delete(n)};return gn(this,pn,"f").add(n),n}globalDispatch(e){gn(this,un,"f").call(this,e)}dispose(){gn(this,pn,"f").forEach((e=>e())),vn(this,pn,new Set,"f"),gn(this,yn,"f").clear()}createChildPlugin(e){return gn(this,fn,"f").call(this,e)}}dn=new WeakMap,un=new WeakMap,pn=new WeakMap,fn=new WeakMap,yn=new WeakMap,mn=new WeakMap;class In{onGlobalStateChange(){return()=>{}}onInteractivityChange(){return()=>{}}onEvent(){return()=>{}}globalDispatch(){}dispose(){}createChildPlugin(){return{close:()=>hn(this,void 0,void 0,(function*(){})),onClose:()=>hn(this,void 0,void 0,(function*(){})),putConfig:()=>hn(this,void 0,void 0,(function*(){})),send:()=>hn(this,void 0,void 0,(function*(){})),onEvent:()=>({subscribe:()=>({unsubscribe:()=>{}})})}}}var En,xn,Sn=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},Cn=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 wn{constructor(e){En.set(this,void 0),xn.set(this,new Set),Sn(this,En,e,"f")}subscribe(e){return Cn(this,xn,"f").add(e),!0===e(Cn(this,En,"f"))&&Cn(this,xn,"f").delete(e),()=>{Cn(this,xn,"f").delete(e)}}publish(e){Sn(this,En,e,"f"),Cn(this,xn,"f").forEach((e=>{!0===e(Cn(this,En,"f"))&&Cn(this,xn,"f").delete(e)}))}clear(){Cn(this,xn,"f").clear()}}En=new WeakMap,xn=new WeakMap;var Tn=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)},On=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 An="breakpoint-0px";class jn{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 y=this.appFactory,m=this.logger,h=null!==(e=this.gatewayFactory)&&void 0!==e?e:()=>new In;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"});On(this,i,document.createElement("div"),"f"),Tn(this,i,"f").id="app-container",Tn(this,i,"f").classList.add("default"),e.appendChild(Tn(this,i,"f"))}attributeChangedCallback(e,i,o){if(o!==i)switch(e){case"visible":Tn(this,n,"f").call(this,"true"===o);break;case"interactivity":"ENABLED"!==o&&"DISABLED"!==o||Tn(this,a,"f").call(this,o);break;case"active-breakpoint":Tn(this,t,"m",c).call(this,o,i)}}makeInteractivityUpdateHandler(e){On(this,a,(t=>{e.publish(t)}),"f")}makeVisbilityUpdateHandler(e,a,i){const o="true"===this.getAttribute("visible"),r=this.getAttribute("slotInstanceGuid");On(this,n,(o=>{o?(On(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}})):Tn(this,t,"m",p).call(this)}),"f"),Tn(this,n,"f").call(this,o)}trackViewability(e,n){if(!Tn(this,o,"f"))if("IntersectionObserver"in window&&!Tn(this,r,"f")){const a=()=>{Tn(this,o,"f")||(n.globalDispatch({type:X,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!0}}),On(this,o,!0,"f"),Tn(this,t,"m",p).call(this),Tn(this,i,"f").removeEventListener("click",a))};Tn(this,i,"f").addEventListener("click",a),On(this,r,new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=.5?Tn(this,t,"m",u).call(this,(()=>{Tn(this,o,"f")||(n.globalDispatch({type:X,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!1}}),On(this,o,!0,"f"),Tn(this,t,"m",p).call(this),Tn(this,i,"f").removeEventListener("click",a))})):Tn(this,t,"m",d).call(this)}))}),{threshold:.5}),"f"),On(this,l,(()=>{var e,n;"visible"===document.visibilityState?null===(e=Tn(this,r,"f"))||void 0===e||e.observe(Tn(this,i,"f")):(Tn(this,t,"m",d).call(this),null===(n=Tn(this,r,"f"))||void 0===n||n.disconnect())}),"f"),document.addEventListener("visibilitychange",Tn(this,l,"f")),Tn(this,l,"f").call(this)}else n.globalDispatch({type:X,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!1,inferred:!1}}),On(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(){Tn(this,t,"m",p).call(this)}connectedCallback(){var e,t,n;const a=this.getAttribute("container"),o=this.getAttribute("plugin-id");Tn(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 wn("DISABLED"===this.getAttribute("interactivity")?"DISABLED":"ENABLED"),u=null!==(e=this.getAttribute("schemaVersion"))&&void 0!==e?e:"",p=this.getJSONAttr("offerState","{}");y||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),y({rootElement:Tn(this,i,"f"),gateway:f,logger:m,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){Tn(this,i,"f").classList.remove(t||An),Tn(this,i,"f").classList.add(e||An)},d=function(){Tn(this,s,"f")&&(clearTimeout(Tn(this,s,"f")),On(this,s,null,"f"))},u=function(e){Tn(this,t,"m",d).call(this),On(this,s,window.setTimeout(e,1e3),"f")},p=function(){Tn(this,t,"m",d).call(this),Tn(this,r,"f")&&(Tn(this,r,"f").disconnect(),On(this,r,null,"f")),Tn(this,l,"f")&&(document.removeEventListener("visibilitychange",Tn(this,l,"f")),On(this,l,null,"f"))},f;function v(e){throw m({level:N,code:"MODULE_BUILDER/FAILED_TO_BUILD_MODULE",message:e}),Error(e)}}}const Rn=t.createContext({get:()=>new In}),Nn=e=>t.createElement(Rn.Provider,{value:{get:()=>e.context}},e.children);const Ln=t.createContext({get(){throw Error("Layout Schema context has not been set")}}),kn=e=>t.createElement(Ln.Provider,{value:{get:()=>e.context}},e.children),_n=()=>t.useContext(Ln).get(),Dn=t.createContext("ENABLED"),Pn=()=>t.useContext(Dn);function $n(e){const t=Gn(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Gn(t,this.dataMap)});if(!n)throw new k("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 Fn={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function Gn(e,t=Fn){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 Mn=t.createContext($n({}));Mn.Consumer;const Bn=Mn.Provider,Un=e=>{const n=t.useContext(Mn),a=e.split("|");for(const e of a){const t=n(e.trim(),"images");if(t)return t}},Vn=()=>t.useContext(Mn),zn=t.createContext({});function qn({info:e,children:n}){const a=t.useContext(zn);return t.createElement(zn.Provider,{value:Object.assign(Object.assign({},a),e)},n)}const Hn=t.createContext({get(){throw Error("Catalog Item context has not been set")}}),Wn=e=>t.createElement(Hn.Provider,{value:{get:()=>e.context}},e.children),Kn=()=>t.useContext(Hn).get(),Yn=t.createContext(""),Jn=()=>t.useContext(Yn),Zn=t.createContext(""),Qn=t.createContext(void 0);function Xn({children:e}){const n=t.useMemo((()=>{const e=document.createElement("div");return e.inert=!0,{inert:!0===e.inert}}),[]);return t.createElement(Qn.Provider,{value:n},e)}const ea=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")),ta=i.compose(i.isEmpty,i.prop("predicates"));function na(e,t){return`transition: ${t.map((t=>`${t} ${e}ms`)).join(", ")};`}const aa=i.curry(((e,{duration:t,predicates:n,styles:a})=>{return{predicates:n,classname:e(yt(a)),transitionBaseClassname:e(na(t,(o=a,i.toPairs(o).flatMap((e=>{const[t,n]=null!=e?e:[];return n&&t?i.keys(n).map((e=>we(t,e))):[]})))))};var o})),ia=i.anyPass([ea,ta]);const oa={is:i.equals,"is-not":i.compose(i.not,i.equals),"is-below":i.lt,"is-above":i.gt};function ra(e,t){return e.includes(t)}const sa={is:i.equals,"is-not":i.compose(i.not,i.equals),exists:ra,"not-exists":i.compose(i.not,ra)},la={exists:i.compose(i.not,i.either(i.isNil,i.isEmpty)),"not-exists":i.either(i.isNil,i.isEmpty)},ca={"is-true":i.equals(!0),"is-false":i.equals(!1)},da={is:i.equals,"is-not":i.compose(i.not,i.equals)};function ua(e){return(t,n)=>n[e]}const pa=i.cond([[(e,t)=>i.equals("Breakpoint",e),ua("activeBreakpoint")],[(e,t)=>i.equals("Progression",e),ua("progressionIndex")],[(e,t)=>i.equals("Position",e),ua("positionIndex")]]);function fa(e,t){return e.creativeCopy&&"string"==typeof e.creativeCopy[t]?e.creativeCopy[t]:void 0}const ya=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))]]),ma=i.compose(i.not,isNaN);function ha(e,t){return e.map((e=>{var n,a,i;switch(e.type){case"StaticString":return(0,da[e.predicate.condition])(e.predicate.input,e.predicate.value);case"CreativeCopy":return(0,la[e.predicate.condition])(fa(t,e.predicate.value));case"StaticBoolean":return(0,ca[e.predicate.condition])(e.predicate.value);case"CustomState":return(0,oa[e.predicate.condition])(null!==(n=t.customStates[e.predicate.key])&&void 0!==n?n:0,e.predicate.value);case"DomainState":return(0,oa[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,sa[e.predicate.content.condition])(e.predicate.content.input,e.predicate.content.value);case"TextLength":return(0,oa[e.predicate.content.condition])(e.predicate.content.input.length,e.predicate.content.value);case"Numeric":return(0,oa[e.predicate.content.condition])(Number(e.predicate.content.input),e.predicate.content.value);default:return!1}}(e);default:{const n=oa[e.predicate.condition],a=null!==(i=pa(e.type,t))&&void 0!==i?i:NaN,o=ya(e.type,e.predicate.value,t);return!!ma(a)&&n(a,o)}}}))}function va(e){return i.pathOr(0,["breakpoint","breakpoints",e.breakpoint.activeBreakpoint],e)}const ga={breakpoints:{},activeBreakpoint:NaN,progressionIndex:NaN,positionIndex:NaN,totalOffers:NaN,totalGroups:NaN,creativeCopy:{},customStates:{},domainStates:{}};function ba(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:${fa(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:${pa(e.type,t)}:${t.totalGroups}`}}(e,t),r=n.current.get(o);return i.evolve(Ia(r)?{cached:i.append(r)}:{uncached:i.append({key:o,predicate:e})},a)}(a,n,e,t)),{cached:[],uncached:[]}),l=ha(s.map((({predicate:e})=>e)),n);return i.zip(s,l).forEach((([{key:t},n])=>{e.current.set(t,n)})),r.concat(l)}const Ia=i.is(Boolean);const Ea=i.curry(((e,t,n)=>{var a,i,o,r,s,l;return{breakpoints:n.breakpoint.breakpoints,activeBreakpoint:va(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}})),xa=i.lensPath(["predicate","content","input"]),Sa=i.lensPath(["predicate","content","value"]),Ca=i.lensPath(["predicate","key"]);function wa(e,t){const n=i.over(xa,(t=>t?e(t):"")),a=i.over(Sa,(t=>"string"==typeof t?e(t):t)),o=i.compose(n,a),r=i.over(Ca,(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 Ta=i.all(i.equals(!0));function Oa(e){const n=sn(),a=cn(),o=t.useRef(new Map),r=Pt(),s=Tt(ga,Ea(a,r)),l=nn();return t.useMemo((()=>i.mapObjIndexed((e=>{const t=wa(l,e);return Ta(ba(o,t,s,n))}),e)),[o,e,s,n,l])}function Aa(e){e&&(e.style.display="")}function ja(e){e&&(e.style.display="none")}function Ra(e){return e.settings.duration}const Na=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],La=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function ka(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const a=t?Na:La,i=e.animate(a,{duration:n,iterations:1});return i.onfinish=()=>{t?Aa(e):ja(e)},i.oncancel=()=>{t?Aa(e):ja(e)},()=>{i.finish()}}return t?Aa(e):ja(e),()=>{}}function _a({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)ka(e,t,n)}(r.current,a,Ra(e),e.type)})):!a&&n?n.forEach((e=>{r.current&&function(e,t,n,a){if("FadeOut"===a)ka(e,t,n)}(r.current,a,Ra(e),e.type)})):()=>{}),[a]),t.createElement("div",{ref:r,style:{display:"none"},className:o},i)}function Da(e){const n=jt(),a=function(e){const n=sn(),a=cn(),i=t.useRef(new Map),o=Pt(),r=Tt(ga,Ea(a,o)),s=wa(nn(),e);return t.useMemo((()=>Ta(ba(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(_a,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:a},i):"functionally"===e.schema.hide?t.createElement(Dn.Provider,{value:a?"ENABLED":"DISABLED"},i):a?t.createElement(t.Fragment,null,i):null}const Pa=i.mergeWith(((e,t)=>`${e||""} ${t||""}`.trim())),$a=e=>{var n;const a=t.useContext(an),o=cn(),r=Lt()||document.head,s=Jn(),l=gt(s,o,r),c=t.useCallback(It,[]),d=Tt([],(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=aa(e);return i.mapObjIndexed((e=>ia(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,y=Oa(f?i.mapObjIndexed(i.propOr([],"predicates"),f):{}),m=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),y),h=f?i.mapObjIndexed(i.prop("transitionBaseClassname"),f):{},v=e.styles?(g=h,Pa(Pa(p,m),g)):void 0;var g;return e.children({classnames:v,mapperRef:u})};function Fa(e){const n=jt();return t.createElement($a,{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 Ga(e){const n=jt();return t.createElement($a,{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 Ma={allowedTags:["em","strong","a","br","u","p","li","ul","ol","s"],allowedAttributes:{a:["href","target",fe,ye],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],s:[]},allowedSchemes:["http","https"]},Ba=new Map([["&","_;^;_"]]),Ua=new RegExp(`<a *(?=${Ma.allowedAttributes.a.join("|")}|>)`,"g"),Va=new RegExp('<a [^>]*href="([^"]+)"',"g"),za=new RegExp("(<br *?>)|(<br *?/>)","g"),qa="<br/>";function Ha(e){const n=nn(),a=Pn(),i=t.useMemo((()=>{const t=n(e.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Va,((e,t)=>{const n=t.replaceAll("&",Ba.get("&"));return e.replace(t,n)})).replaceAll(za,qa)}(e);return t===u(t,Ma)}(t))throw new k("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($a,{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(Ua,`<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(Ua,`<a ${a.join(" ")}`)}});var l})):null}function Wa(e){const n=nn()(e.schema.value),a=Pn(),{tabIndex:i,styles:o,isDisabled:r}=g(a);return n?t.createElement($a,{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 Ka(e,n,a){if("BasicText"===e.type)return t.createElement(Wa,{schema:e.node,testId:n,isInline:null!=a&&a})}function Ya(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,z(t,a)))))}function Ja(e){const n=Ct(),a=jt(),i=Dt(),o=nn(),r=cn(),s=Pn(),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($a,{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(tn,{value:d},(null==o?void 0:o.own)?function(e,n,a,i,o){return t.createElement(on,{value:a(n)},Ya(e,i,o))}(e.schema.children,o.own,r,a,e.testId):Ya(e.schema.children,a,e.testId)))})):null}function Za(e){const n=Pn(),{styles:a,isDisabled:i}=g(n);return e.schema.url.light?t.createElement($a,{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 Qa(e){const n=Pn(),{styles:a,isDisabled:i}=g(n),o=Un(e.schema.imageKey);return null!=(r=o)&&"object"==typeof r&&"light"in r&&"string"==typeof r.light?t.createElement($a,{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 Xa={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function ei(e){const n=e.schema.name,a=e.schema.description,i=e.schema.styles?U(Xa,e.schema.styles):Xa,o=Pn(),{styles:r,isDisabled:s}=g(o);return n?t.createElement($a,{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 ti={backgroundColor:"#FFEEEE",color:"#FF0000",fontSize:"10px",padding:"4px",border:"1px solid #FF0000",margin:0,whiteSpace:"normal"};class ni 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"===Ie.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"===Ie.DISPLAY_ERRORS?t.createElement("pre",{style:ti},t.createElement("strong",null,"Error:")," [",t.createElement("em",null,this.props.schema.type),"]"," ",this.state.errorMessage):void 0:this.props.children}}ni.contextType=zn;const ai={internally:"_top",externally:"_blank"};function ii(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function oi(e){var n;const a=ai[e.schema.open],i=jt(),o=Pn(),{tabIndex:r,styles:s,isDisabled:l}=g(o);return(null===(n=e.schema.children)||void 0===n?void 0:n.length)>0?t.createElement($a,{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(on,{value:a(n)},ii(e,i,o))}(e.schema.children,null==n?void 0:n.own,o,i,e.testId):ii(e.schema.children,i,e.testId))})):null}function ri(e,n,a){if("StaticLink"===e.type)return t.createElement(oi,{schema:e.node,testId:n,isInline:null!=a&&a})}const si={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function li(e){const n=(a=e.schema.iconKey,t.useContext(Mn)(a,"icons"));var a;const i=null==n?void 0:n.name,o=e.schema.styles?U(si,e.schema.styles):si,r=Pn(),{styles:s}=g(r);return i?t.createElement($a,{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 ci=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"),y=require("embla-carousel-fade");function m(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=m(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 T(e){return(S(e)||C(e))&&"RealTime"===e.conversionType&&"rclid"in e}function O(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",L="WARNING";class k extends Error{constructor(e,t){super(t),this.code=null!=e?e:"UNHANDLED_EXCEPTION"}toString(){return`CodedError (${this.code}): ${this.message}`}}const _=["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","INITIATE_CART_ITEM_EVENT","PLACEMENT_CLOSED","PLACEMENT_COMPLETED","PLACEMENT_INTERACTIVE","PLACEMENT_FAILURE"];const D=(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?D(t,e):t,a=t.length>e.length?D(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 k("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!!(T(e)||"responseOption"in e&&T(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}function Q(e){return!!(O(e)||"responseOption"in e&&O(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="GLOBAL/CART_ITEM_EVENT/INITIATE",de="GLOBAL/CART_ITEM_EVENT/RESPONSE",ue="GLOBAL/CART_SERVICE/INITIALIZE",pe={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,INITIATE_CART_ITEM_EVENT:ce,CART_ITEM_RESPONSE:de},fe="data-open-in-app",ye="data-click-signal-context";function me(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(ye);if(i&&n({type:X,payload:{name:"SignalUserInteraction",action:"Click",context:i}}),t){e.preventDefault();let i="newTab";a.hasAttribute(fe)&&(i="inApp"),n({type:oe,payload:{url:t,urlBehaviour:i}})}}}t.useEffect((()=>null!==e?(e.addEventListener("click",a),()=>{e.removeEventListener("click",a)}):()=>{}),[e])}function he(){const e=t.useRef(null);return t.useEffect((()=>{const t=t=>{"Tab"===t.key&&ve(t,e)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)}),[e]),e}const ve=(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()},ge=i.sortBy(i.prop(1)),be=i.map(i.prop(0)),Ie="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DISPLAY_ERRORS:"true",REPORT_RENDER_ERRORS:"true",USE_MEDIA_QUERY_NESTING:"true"};function Ee(e,t){return t?"false"!==Ie.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 xe={hovered:":hover",pressed:":active",focussed:":focus",disabled:":disabled"};function Se(e){return function(e){return Object.keys(xe).indexOf(e)>-1}(e)?xe[e]:""}const Ce={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 we(e,t){if(!Ce[e]||!Ce[e][t])throw new Error(`No CSS property mapping exists for styling property: ${e}.${t.toString()}`);return Ce[e][t]}function Te(e,t){return n=>t(...Object.keys(e).map((t=>e[t](n[t]))))}function Oe(...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 Ae(e,t){return`${e}:${t};`}function je(e){return function(e,t){return`@media (${e}) {${t}}\n`}("prefers-color-scheme: dark",e)}class Re extends Error{constructor(e,t){super(`Invalid styling value '${t}': ${e}.`),this.name=this.constructor.name}}function Ne(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 Re(n,JSON.stringify(t));return!0}function Le(e){if(isNaN(e)||"number"!=typeof e&&"string"!=typeof e)return"value must be a number"}function ke(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 _e(e){if(null==e||""===e)return"value must not be omitted"}function De(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 Pe(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 $e(e){if(null!=e&&""!==e)return"value must not be specified"}function Fe(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 Ge(...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||Le(t)),void 0))return}}return`value must be a space separated list of numbers, of one of the following lengths: ${e.join(" ,")}`}}function Me(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 Be(e){if("string"!=typeof e)return"value must be a string"}const Ue=i.is(Object);function Ve(e){const t=Object.entries(e);return n=>Ue(n)&&!Array.isArray(n)?t.reduce(((e,[t,a])=>e||a(n[t])),void 0):`Input value (${e}) must be an object`}function ze(e){if("number"!=typeof e&&"string"!=typeof e||isNaN(e)||!(e>=0))return"value must be a positive number"}function qe(e,t,n){return Ne(Le,n)?Ae(we(e,t),`${n}`):""}function He(e){return(t,n,a)=>Ne(ke(Object.keys(e)),a)?Ae(we(t,n),`${e[a]}`):""}function We(e){return Ne(_e,e)?Te({light:t(Pe,!1),dark:t(Me($e,Pe),!0)},Oe("\n "))(e):"";function t(e,t){return n=>{if(Ne(e,n)&&n){const e=Ae("background-image",`url("${n}")`);return t?je(e):e}return""}}}function Ke(e){const t={crop:"auto",fit:"contain",fill:"cover"};return"string"==typeof e&&(e=e.toLowerCase()),Ne(Me($e,ke(Object.keys(t))),e)&&e?Ae("background-size",t[e]):""}const Ye=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 Je(e){const t="string"==typeof e?e.toLowerCase():e;return Ne(Me($e,ke(["top","right","bottom","left","center","top-left","top-right","bottom-left","bottom-right"])),t)&&t?Ae("background-position",Ye(t)):""}function Ze(e,t,n){return Ne(Me(Le,Ge(2,3,4)),n)?Ae(we(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function Qe(e){return(t,n,a)=>Ne(Fe({fit:ke(e),percentage:Le,fixed:Le}),a)?Ae(we(t,n),Xe(a)):""}function Xe(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 et=Ve({light:De,dark:Me($e,De)});function tt(e,t,n){return a=>{if(a){const i=Ae(we(e,t),at(String(a)));return n?je(i):i}return""}}function nt(e,t,n){return Ne(et,n)?Te({light:tt(e,t,!1),dark:tt(e,t,!0)},Oe("\n "))(n):""}function at(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 it=Ve({offsetX:Me($e,Le),offsetY:Me($e,Le),blurRadius:Me($e,Le),spreadRadius:Me($e,Le),color:et}),ot=e=>t=>null!=t?String(t):e,rt=i.compose(i.concat(i.__,"px"),ot("0")),st=e=>t=>"string"==typeof t?e(t):t,lt=i.compose(st(i.concat(i.__,"px")),ot(void 0)),ct=i.compose(st(at),i.prop("dark"));function dt(e,t,n){return Ae(e,Te({offsetX:rt,offsetY:rt,blurRadius:t.spreadRadius?rt:lt,spreadRadius:lt,color:n},Oe(" "))(t))}const ut={center:"center","flex-end":"flex-end","flex-start":"flex-start",stretch:"stretch"},pt={container:{justifyContent:He(ut),alignItems:He(ut),shadow:function(e,t,n){var a,o,r;if(Ne(it,n)){const s=we(e,t);return Oe("\n")(dt(s,n,(o="light",r="#80000000",i.compose(at,i.propOr(r,o)))),(null===(a=n.color)||void 0===a?void 0:a.dark)?je(dt(s,n,ct)):"")}return""},gap:Ze,overflow:He({hidden:"hidden",visible:"visible"}),blur:function(e,t,n){return Ne(ze,n)?Ae(we(e,t),`blur(${n.toString()}px)`):""},opacity:qe},text:{textColor:nt,fontSize:Ze,fontFamily:function(e,t,n){return Ne(Be,n)?Ae(we(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:He({100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900}),fontStyle:He({normal:"normal",italic:"italic"}),lineHeight:Ze,lineLimit:function(e,t,n){return Ne(Le,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:Ze,baselineTextAlign:He({super:"super",sub:"sub",baseline:"baseline"}),horizontalTextAlign:He({left:"left",right:"right",center:"center",start:"start",end:"end",justify:"justify"}),textDecoration:He({underline:"underline","strike-through":"line-through",none:"none"}),textTransform:He({capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",none:"none"})},background:{backgroundColor:nt,backgroundImage:function(e,t,n){return Ne(_e,n)?Te({url:We,position:Je,scale:Ke},Oe)(n):""}},dimension:{width:Qe(["wrap-content","fit-width"]),maxWidth:Ze,minWidth:Ze,height:Qe(["wrap-content","fit-height"]),maxHeight:Ze,minHeight:Ze,rotateZ:(ft="Z",(e,t,n)=>{const a=`rotate${ft}`;return Ne(Le,n)?Ae(we(e,t),`${a}(${n.toString()}deg)`):""})},flexChild:{alignSelf:He(ut),weight:qe,order:qe},spacing:{margin:Ze,padding:Ze,offset:function(e,t,n){return Ne(Ge(2),n)?`transform:translate(${n.split(" ").join("px, ")}px);`:""}},border:{borderColor:nt,borderRadius:Ze,borderWidth:Ze,borderStyle:He({solid:"solid",dashed:"dashed"})}};var ft;function yt(e){return Object.keys(e).reduce(((t,n)=>(n&&e[n]&&Object.keys(e[n]).forEach((a=>{if(!pt[n])throw new Error(`No styling transformers exist for styling category key: ${n}`);const i=pt[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 mt="FAILED_TEMPLATING_DATA",ht=new Map;function vt(e){return String.fromCharCode(97+e)}function gt(e,t,n){const a=`${e||A.pluginId}-${void 0!==t?String(t):"outer"}`,i=ht.get(a);if(i&&i.sheet.container.isConnected)return i.css;const o=function(e,t){const n={key:void 0!==e?`inner-css-${vt(e)}`:"outer-css",container:t};return t&&t.parentElement&&(n.container=t.parentElement),p(n)}(t,n);return ht.set(a,o),o.css}const bt="%%%OWN_CLASS_REF%%%",It=i.memoizeWith(((e,t,n,a)=>`${String(e)}-${t}-${n}`),Et);function Et(e,t,n,a){const i=gt(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]:xt(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(bt,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 xt(e,t,n,a,i){return e.map(function(e,t,n){return a=>Object.entries(a).map((([a,i])=>{const o=i?yt(i):"";switch(!0){case"default"===a:return o?`\n${o}\n`:"";case Boolean(e):return`\n .${e}${Se(a)} & {\n${o}\n}\n`;case t&&"own"!==n:return`\n .${bt}${Se(a)} & {\n${o}\n}\n`;default:return`\n &${Se(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:`${Ee(a,t)}\n`):e}),"")}const St=t.createContext(i.always(void 0)),Ct=()=>t.useContext(St),wt=t.createContext(null);function Tt(e,n){var a;const i=t.useContext(wt);return i&&null!==(a=n(i))&&void 0!==a?a:e}const Ot=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")})),At=Ot.Consumer,jt=()=>t.useContext(Ot),Rt=e=>t.createElement(Ot.Provider,{value:(t,n,a)=>e.value(t,null!=n?n:e.overrides,a)},e.children),Nt=t.createContext(null),Lt=()=>t.useContext(Nt),kt=t.createContext({get(){throw Error("Offer context has not been set")}}),_t=e=>t.createElement(kt.Provider,{value:{get:()=>e.context}},e.children),Dt=()=>t.useContext(kt).get(),Pt=()=>{try{return t.useContext(kt).get().creative.copy}catch(e){return}},$t=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),Ft=i.compose(i.not,i.isEmpty),Gt=i.where({url:Ft,title:Ft});function Mt(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(Ut(e,"This Meta Attribute could not be parsed."));return function(e,t,n,a){switch(t){case"openLinks":return function(e,t,n){Bt(t,e,"openLinks",1,2);const a=Vt(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),i=zt(t,1,(e=>"string"==typeof e&&e.length?e:null));if("InApp"===a)return n.replace($t,((e,t)=>`<a ${fe} ${i?`${ye}="${i}" `:""}${t}`));return n}(e,n,a);case"sliceText":return function(e,t,n){Bt(t,e,"sliceText",2,2);const a=Vt(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),i=Vt(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>)");return e.startsWith("<a")?e.replace(n,(e=>e.slice(0,-4).slice(0,t+1)+"</a>")):e.slice(0,t)}(n,i);throw Error(Ut(e,`Unknown "SliceBy" value. ${a}`))}(e,n,a);default:throw new Error(Ut(e,`Unknown Meta Attribute '${t}'.`))}}(e,a,o,t)}),n)}function Bt(e,t,n,a,i){const o=new Error(Ut(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 Ut(e,t){return`Malformed Meta Attribute: '${e}' - ${t}`}function Vt(e,t,n,a,i){const o=zt(e,n,a);if(null!==o)return o;throw Error(Ut(t,i||`Could not parse meta attribute argument at index ${n} from arguments ${JSON.stringify(e)}`))}function zt(e,t,n){return n(e[t])}const qt="DATA",Ht="STATE",Wt=new RegExp(`^(${qt}|${Ht})`),Kt=new RegExp(`^${Ht}`),Yt=new RegExp(`%\\^(?:${qt}|${Ht})\\.[a-zA-Z0-9]+[a-zA-Z0-9\\.]*(?:\\:[a-zA-Z0-9]+\\[[a-zA-Z0-9\\.,]*\\])*(?:\\|.*?)?\\^%`,"g"),Jt=Symbol("invalid");function Zt(e,t="creativeCopy"){const n=Qt({data:e},t);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Qt(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(Wt.test(t)){if(!this.dataMap.has(t)&&Kt.test(t))throw new k(mt,`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===Jt)throw new k(mt,`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=Mt(a[0],a.slice(1),n)}catch(e){throw new k(mt,`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(Yt,r,o);return!1===a?s:""}.bind({dataMap:n})}function Qt(e,t,n){const a=new Map(n);return"data"in e&&o(e.data,`${qt}${t?"."+t:""}`),"state"in e&&o(e.state,`${Ht}${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,Jt),e&&"object"==typeof e&&i.forEachObjIndexed(((e,n)=>o(e,`${t}.${n}`)),e)}}const Xt=t.createContext(Zt({})),en=Xt.Consumer,tn=Xt.Provider,nn=()=>t.useContext(Xt),an=t.createContext(null),on=an.Provider,rn=t.createContext("OUTER"),sn=()=>"VARIANT"===t.useContext(rn),ln=t.createContext(void 0),cn=()=>t.useContext(ln);var dn,un,pn,fn,yn,mn,hn=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())}))},vn=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},gn=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 bn{constructor(e,t,n,a,o){dn.set(this,void 0),un.set(this,void 0),pn.set(this,new Set),fn.set(this,void 0),yn.set(this,void 0),mn.set(this,void 0),vn(this,dn,i.partial(e.subscribe.bind(e),[n]),"f"),vn(this,un,i.partial(e.dispatch.bind(e),[n]),"f"),vn(this,fn,t,"f"),vn(this,yn,a,"f"),vn(this,mn,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=gn(this,dn,"f").call(this,e),n=()=>{t(),gn(this,pn,"f").delete(n)};return gn(this,pn,"f").add(n),n}onInteractivityChange(e){return gn(this,yn,"f").subscribe(e)}onEvent(...e){const t=e.reduce(((e,t)=>{if("partner"===t.source||"*"===t.source){const n=gn(this,mn,"f").call(this,t.name).subscribe(t.callback);return[...e,()=>n.unsubscribe()]}return e}),[]),n=()=>{t.forEach((e=>{e()})),gn(this,pn,"f").delete(n)};return gn(this,pn,"f").add(n),n}globalDispatch(e){gn(this,un,"f").call(this,e)}dispose(){gn(this,pn,"f").forEach((e=>e())),vn(this,pn,new Set,"f"),gn(this,yn,"f").clear()}createChildPlugin(e){return gn(this,fn,"f").call(this,e)}}dn=new WeakMap,un=new WeakMap,pn=new WeakMap,fn=new WeakMap,yn=new WeakMap,mn=new WeakMap;class In{onGlobalStateChange(){return()=>{}}onInteractivityChange(){return()=>{}}onEvent(){return()=>{}}globalDispatch(){}dispose(){}createChildPlugin(){return{close:()=>hn(this,void 0,void 0,(function*(){})),onClose:()=>hn(this,void 0,void 0,(function*(){})),putConfig:()=>hn(this,void 0,void 0,(function*(){})),send:()=>hn(this,void 0,void 0,(function*(){})),onEvent:()=>({subscribe:()=>({unsubscribe:()=>{}})})}}}var En,xn,Sn=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},Cn=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 wn{constructor(e){En.set(this,void 0),xn.set(this,new Set),Sn(this,En,e,"f")}subscribe(e){return Cn(this,xn,"f").add(e),!0===e(Cn(this,En,"f"))&&Cn(this,xn,"f").delete(e),()=>{Cn(this,xn,"f").delete(e)}}publish(e){Sn(this,En,e,"f"),Cn(this,xn,"f").forEach((e=>{!0===e(Cn(this,En,"f"))&&Cn(this,xn,"f").delete(e)}))}clear(){Cn(this,xn,"f").clear()}}En=new WeakMap,xn=new WeakMap;var Tn=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)},On=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 An="breakpoint-0px";class jn{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 y=this.appFactory,m=this.logger,h=null!==(e=this.gatewayFactory)&&void 0!==e?e:()=>new In;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"});On(this,i,document.createElement("div"),"f"),Tn(this,i,"f").id="app-container",Tn(this,i,"f").classList.add("default"),e.appendChild(Tn(this,i,"f"))}attributeChangedCallback(e,i,o){if(o!==i)switch(e){case"visible":Tn(this,n,"f").call(this,"true"===o);break;case"interactivity":"ENABLED"!==o&&"DISABLED"!==o||Tn(this,a,"f").call(this,o);break;case"active-breakpoint":Tn(this,t,"m",c).call(this,o,i)}}makeInteractivityUpdateHandler(e){On(this,a,(t=>{e.publish(t)}),"f")}makeVisbilityUpdateHandler(e,a,i){const o="true"===this.getAttribute("visible"),r=this.getAttribute("slotInstanceGuid");On(this,n,(o=>{o?(On(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}})):Tn(this,t,"m",p).call(this)}),"f"),Tn(this,n,"f").call(this,o)}trackViewability(e,n){if(!Tn(this,o,"f"))if("IntersectionObserver"in window&&!Tn(this,r,"f")){const a=()=>{Tn(this,o,"f")||(n.globalDispatch({type:X,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!0}}),On(this,o,!0,"f"),Tn(this,t,"m",p).call(this),Tn(this,i,"f").removeEventListener("click",a))};Tn(this,i,"f").addEventListener("click",a),On(this,r,new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=.5?Tn(this,t,"m",u).call(this,(()=>{Tn(this,o,"f")||(n.globalDispatch({type:X,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!1}}),On(this,o,!0,"f"),Tn(this,t,"m",p).call(this),Tn(this,i,"f").removeEventListener("click",a))})):Tn(this,t,"m",d).call(this)}))}),{threshold:.5}),"f"),On(this,l,(()=>{var e,n;"visible"===document.visibilityState?null===(e=Tn(this,r,"f"))||void 0===e||e.observe(Tn(this,i,"f")):(Tn(this,t,"m",d).call(this),null===(n=Tn(this,r,"f"))||void 0===n||n.disconnect())}),"f"),document.addEventListener("visibilitychange",Tn(this,l,"f")),Tn(this,l,"f").call(this)}else n.globalDispatch({type:X,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!1,inferred:!1}}),On(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(){Tn(this,t,"m",p).call(this)}connectedCallback(){var e,t,n;const a=this.getAttribute("container"),o=this.getAttribute("plugin-id");Tn(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 wn("DISABLED"===this.getAttribute("interactivity")?"DISABLED":"ENABLED"),u=null!==(e=this.getAttribute("schemaVersion"))&&void 0!==e?e:"",p=this.getJSONAttr("offerState","{}");y||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),y({rootElement:Tn(this,i,"f"),gateway:f,logger:m,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){Tn(this,i,"f").classList.remove(t||An),Tn(this,i,"f").classList.add(e||An)},d=function(){Tn(this,s,"f")&&(clearTimeout(Tn(this,s,"f")),On(this,s,null,"f"))},u=function(e){Tn(this,t,"m",d).call(this),On(this,s,window.setTimeout(e,1e3),"f")},p=function(){Tn(this,t,"m",d).call(this),Tn(this,r,"f")&&(Tn(this,r,"f").disconnect(),On(this,r,null,"f")),Tn(this,l,"f")&&(document.removeEventListener("visibilitychange",Tn(this,l,"f")),On(this,l,null,"f"))},f;function v(e){throw m({level:N,code:"MODULE_BUILDER/FAILED_TO_BUILD_MODULE",message:e}),Error(e)}}}const Rn=t.createContext({get:()=>new In}),Nn=e=>t.createElement(Rn.Provider,{value:{get:()=>e.context}},e.children);const Ln=t.createContext({get(){throw Error("Layout Schema context has not been set")}}),kn=e=>t.createElement(Ln.Provider,{value:{get:()=>e.context}},e.children),_n=()=>t.useContext(Ln).get(),Dn=t.createContext("ENABLED"),Pn=()=>t.useContext(Dn);function $n(e){const t=Gn(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Gn(t,this.dataMap)});if(!n)throw new k("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 Fn={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function Gn(e,t=Fn){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 Mn=t.createContext($n({}));Mn.Consumer;const Bn=Mn.Provider,Un=e=>{const n=t.useContext(Mn),a=e.split("|");for(const e of a){const t=n(e.trim(),"images");if(t)return t}},Vn=()=>t.useContext(Mn),zn=t.createContext({});function qn({info:e,children:n}){const a=t.useContext(zn);return t.createElement(zn.Provider,{value:Object.assign(Object.assign({},a),e)},n)}const Hn=t.createContext({get(){throw Error("Catalog Item context has not been set")}}),Wn=e=>t.createElement(Hn.Provider,{value:{get:()=>e.context}},e.children),Kn=()=>t.useContext(Hn).get(),Yn=t.createContext(""),Jn=()=>t.useContext(Yn),Zn=t.createContext(""),Qn=t.createContext(void 0);function Xn({children:e}){const n=t.useMemo((()=>{const e=document.createElement("div");return e.inert=!0,{inert:!0===e.inert}}),[]);return t.createElement(Qn.Provider,{value:n},e)}const ea=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")),ta=i.compose(i.isEmpty,i.prop("predicates"));function na(e,t){return`transition: ${t.map((t=>`${t} ${e}ms`)).join(", ")};`}const aa=i.curry(((e,{duration:t,predicates:n,styles:a})=>{return{predicates:n,classname:e(yt(a)),transitionBaseClassname:e(na(t,(o=a,i.toPairs(o).flatMap((e=>{const[t,n]=null!=e?e:[];return n&&t?i.keys(n).map((e=>we(t,e))):[]})))))};var o})),ia=i.anyPass([ea,ta]);const oa={is:i.equals,"is-not":i.compose(i.not,i.equals),"is-below":i.lt,"is-above":i.gt};function ra(e,t){return e.includes(t)}const sa={is:i.equals,"is-not":i.compose(i.not,i.equals),exists:ra,"not-exists":i.compose(i.not,ra)},la={exists:i.compose(i.not,i.either(i.isNil,i.isEmpty)),"not-exists":i.either(i.isNil,i.isEmpty)},ca={"is-true":i.equals(!0),"is-false":i.equals(!1)},da={is:i.equals,"is-not":i.compose(i.not,i.equals)};function ua(e){return(t,n)=>n[e]}const pa=i.cond([[(e,t)=>i.equals("Breakpoint",e),ua("activeBreakpoint")],[(e,t)=>i.equals("Progression",e),ua("progressionIndex")],[(e,t)=>i.equals("Position",e),ua("positionIndex")]]);function fa(e,t){return e.creativeCopy&&"string"==typeof e.creativeCopy[t]?e.creativeCopy[t]:void 0}const ya=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))]]),ma=i.compose(i.not,isNaN);function ha(e,t){return e.map((e=>{var n,a,i;switch(e.type){case"StaticString":return(0,da[e.predicate.condition])(e.predicate.input,e.predicate.value);case"CreativeCopy":return(0,la[e.predicate.condition])(fa(t,e.predicate.value));case"StaticBoolean":return(0,ca[e.predicate.condition])(e.predicate.value);case"CustomState":return(0,oa[e.predicate.condition])(null!==(n=t.customStates[e.predicate.key])&&void 0!==n?n:0,e.predicate.value);case"DomainState":return(0,oa[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,sa[e.predicate.content.condition])(e.predicate.content.input,e.predicate.content.value);case"TextLength":return(0,oa[e.predicate.content.condition])(e.predicate.content.input.length,e.predicate.content.value);case"Numeric":return(0,oa[e.predicate.content.condition])(Number(e.predicate.content.input),e.predicate.content.value);default:return!1}}(e);default:{const n=oa[e.predicate.condition],a=null!==(i=pa(e.type,t))&&void 0!==i?i:NaN,o=ya(e.type,e.predicate.value,t);return!!ma(a)&&n(a,o)}}}))}function va(e){return i.pathOr(0,["breakpoint","breakpoints",e.breakpoint.activeBreakpoint],e)}const ga={breakpoints:{},activeBreakpoint:NaN,progressionIndex:NaN,positionIndex:NaN,totalOffers:NaN,totalGroups:NaN,creativeCopy:{},customStates:{},domainStates:{}};function ba(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:${fa(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:${pa(e.type,t)}:${t.totalGroups}`}}(e,t),r=n.current.get(o);return i.evolve(Ia(r)?{cached:i.append(r)}:{uncached:i.append({key:o,predicate:e})},a)}(a,n,e,t)),{cached:[],uncached:[]}),l=ha(s.map((({predicate:e})=>e)),n);return i.zip(s,l).forEach((([{key:t},n])=>{e.current.set(t,n)})),r.concat(l)}const Ia=i.is(Boolean);const Ea=i.curry(((e,t,n)=>{var a,i,o,r,s,l;return{breakpoints:n.breakpoint.breakpoints,activeBreakpoint:va(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}})),xa=i.lensPath(["predicate","content","input"]),Sa=i.lensPath(["predicate","content","value"]),Ca=i.lensPath(["predicate","key"]);function wa(e,t){const n=i.over(xa,(t=>t?e(t):"")),a=i.over(Sa,(t=>"string"==typeof t?e(t):t)),o=i.compose(n,a),r=i.over(Ca,(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 Ta=i.all(i.equals(!0));function Oa(e){const n=sn(),a=cn(),o=t.useRef(new Map),r=Pt(),s=Tt(ga,Ea(a,r)),l=nn();return t.useMemo((()=>i.mapObjIndexed((e=>{const t=wa(l,e);return Ta(ba(o,t,s,n))}),e)),[o,e,s,n,l])}function Aa(e){e&&(e.style.display="")}function ja(e){e&&(e.style.display="none")}function Ra(e){return e.settings.duration}const Na=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],La=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function ka(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const a=t?Na:La,i=e.animate(a,{duration:n,iterations:1});return i.onfinish=()=>{t?Aa(e):ja(e)},i.oncancel=()=>{t?Aa(e):ja(e)},()=>{i.finish()}}return t?Aa(e):ja(e),()=>{}}function _a({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)ka(e,t,n)}(r.current,a,Ra(e),e.type)})):!a&&n?n.forEach((e=>{r.current&&function(e,t,n,a){if("FadeOut"===a)ka(e,t,n)}(r.current,a,Ra(e),e.type)})):()=>{}),[a]),t.createElement("div",{ref:r,style:{display:"none"},className:o},i)}function Da(e){const n=jt(),a=function(e){const n=sn(),a=cn(),i=t.useRef(new Map),o=Pt(),r=Tt(ga,Ea(a,o)),s=wa(nn(),e);return t.useMemo((()=>Ta(ba(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(_a,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:a},i):"functionally"===e.schema.hide?t.createElement(Dn.Provider,{value:a?"ENABLED":"DISABLED"},i):a?t.createElement(t.Fragment,null,i):null}const Pa=i.mergeWith(((e,t)=>`${e||""} ${t||""}`.trim())),$a=e=>{var n;const a=t.useContext(an),o=cn(),r=Lt()||document.head,s=Jn(),l=gt(s,o,r),c=t.useCallback(It,[]),d=Tt([],(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=aa(e);return i.mapObjIndexed((e=>ia(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,y=Oa(f?i.mapObjIndexed(i.propOr([],"predicates"),f):{}),m=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),y),h=f?i.mapObjIndexed(i.prop("transitionBaseClassname"),f):{},v=e.styles?(g=h,Pa(Pa(p,m),g)):void 0;var g;return e.children({classnames:v,mapperRef:u})};function Fa(e){const n=jt();return t.createElement($a,{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 Ga(e){const n=jt();return t.createElement($a,{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 Ma={allowedTags:["em","strong","a","br","u","p","li","ul","ol","s"],allowedAttributes:{a:["href","target",fe,ye],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],s:[]},allowedSchemes:["http","https"]},Ba=new Map([["&","_;^;_"]]),Ua=new RegExp(`<a *(?=${Ma.allowedAttributes.a.join("|")}|>)`,"g"),Va=new RegExp('<a [^>]*href="([^"]+)"',"g"),za=new RegExp("(<br *?>)|(<br *?/>)","g"),qa="<br/>";function Ha(e){const n=nn(),a=Pn(),i=t.useMemo((()=>{const t=n(e.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Va,((e,t)=>{const n=t.replaceAll("&",Ba.get("&"));return e.replace(t,n)})).replaceAll(za,qa)}(e);return t===u(t,Ma)}(t))throw new k("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($a,{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(Ua,`<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(Ua,`<a ${a.join(" ")}`)}});var l})):null}function Wa(e){const n=nn()(e.schema.value),a=Pn(),{tabIndex:i,styles:o,isDisabled:r}=g(a);return n?t.createElement($a,{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 Ka(e,n,a){if("BasicText"===e.type)return t.createElement(Wa,{schema:e.node,testId:n,isInline:null!=a&&a})}function Ya(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,z(t,a)))))}function Ja(e){const n=Ct(),a=jt(),i=Dt(),o=nn(),r=cn(),s=Pn(),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($a,{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(tn,{value:d},(null==o?void 0:o.own)?function(e,n,a,i,o){return t.createElement(on,{value:a(n)},Ya(e,i,o))}(e.schema.children,o.own,r,a,e.testId):Ya(e.schema.children,a,e.testId)))})):null}function Za(e){const n=Pn(),{styles:a,isDisabled:i}=g(n);return e.schema.url.light?t.createElement($a,{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 Qa(e){const n=Pn(),{styles:a,isDisabled:i}=g(n),o=Un(e.schema.imageKey);return null!=(r=o)&&"object"==typeof r&&"light"in r&&"string"==typeof r.light?t.createElement($a,{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 Xa={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function ei(e){const n=e.schema.name,a=e.schema.description,i=e.schema.styles?U(Xa,e.schema.styles):Xa,o=Pn(),{styles:r,isDisabled:s}=g(o);return n?t.createElement($a,{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 ti={backgroundColor:"#FFEEEE",color:"#FF0000",fontSize:"10px",padding:"4px",border:"1px solid #FF0000",margin:0,whiteSpace:"normal"};class ni 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"===Ie.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"===Ie.DISPLAY_ERRORS?t.createElement("pre",{style:ti},t.createElement("strong",null,"Error:")," [",t.createElement("em",null,this.props.schema.type),"]"," ",this.state.errorMessage):void 0:this.props.children}}ni.contextType=zn;const ai={internally:"_top",externally:"_blank"};function ii(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function oi(e){var n;const a=ai[e.schema.open],i=jt(),o=Pn(),{tabIndex:r,styles:s,isDisabled:l}=g(o);return(null===(n=e.schema.children)||void 0===n?void 0:n.length)>0?t.createElement($a,{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(on,{value:a(n)},ii(e,i,o))}(e.schema.children,null==n?void 0:n.own,o,i,e.testId):ii(e.schema.children,i,e.testId))})):null}function ri(e,n,a){if("StaticLink"===e.type)return t.createElement(oi,{schema:e.node,testId:n,isInline:null!=a&&a})}const si={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function li(e){const n=(a=e.schema.iconKey,t.useContext(Mn)(a,"icons"));var a;const i=null==n?void 0:n.name,o=e.schema.styles?U(si,e.schema.styles):si,r=Pn(),{styles:s}=g(r);return i?t.createElement($a,{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 ci=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 y}from"react-dom/client";import{useDispatch as f,useSelector as m,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 T,mergeDeepWith as O,T as x,flip as A,type as N,unary as L,identity as _,concat as R,zipWith as D,slice as k,compose as P,findIndex as $,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 ye,lensPath as fe,zip as me,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 Te,indexBy as Oe,mergeRight as xe,lensProp as Ae,defaultTo as Ne,reject as Le,whereEq as _e,uniqBy as Re,find as De,has as ke,assoc as Pe,gte as $e,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,spawn as Xe,takeLatest 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 yt,take as ft,delay as mt}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 Tt(e){return null!=e&&"object"==typeof e&&("url"in e||"name"in e)&&"config"in e}function Ot(e){return null!=e&&"object"==typeof e&&"id"in e&&"action"in e&&"instanceGuid"in e&&"signalType"in e}function xt(e){return Ot(e)&&"Fulfillment"===e.action}function At(e){return Ot(e)&&"Url"===e.action}function Nt(e){return Ot(e)&&"ExternalPaymentTrigger"===e.action}function Lt(e){return(xt(e)||At(e))&&"RealTime"===e.conversionType&&"rclid"in e}function _t(e){return(xt(e)||At(e))&&"RealTimeReferral"===e.conversionType&&"rclid"in e}const Rt={pluginId:"shared",pageInstanceGuid:"N/A"};var Dt;!function(e){e.DCUI="DCUI",e.Partner="partner"}(Dt||(Dt={}));const kt=["SignalCartItemQuantitySelected","SignalProductItemResponse","SignalUserInteraction"],Pt="ERROR",$t="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","INITIATE_CART_ITEM_EVENT","PLACEMENT_CLOSED","PLACEMENT_COMPLETED","PLACEMENT_INTERACTIVE","PLACEMENT_FAILURE"];const Gt=(e,t)=>R(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 T([[(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),O(Ht)],[(e,t)=>"Array"===N(e),Mt],[x,A(L(_))]])(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&&Tt(e.fulfillment)}function Qt(e){return Nt(e)}function Xt(e){return At(e)}function en(e){return function(e){return Ot(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!!(_t(e)||"responseOption"in e&&_t(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",yn="GLOBAL/LAUNCH_CHILD_LAYOUT",fn="GLOBAL/CART_ITEM_EVENT/INITIATE",mn="GLOBAL/CART_ITEM_EVENT/RESPONSE",hn="GLOBAL/CART_SERVICE/INITIALIZE",vn={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:yn,INITIATE_CART_ITEM_EVENT:fn,CART_ITEM_RESPONSE:mn},gn="data-open-in-app",bn="data-click-signal-context";function In(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(bn);if(a&&t({type:an,payload:{name:"SignalUserInteraction",action:"Click",context:a}}),n){e.preventDefault();let a="newTab";i.hasAttribute(gn)&&(a="inApp"),t({type:dn,payload:{url:n,urlBehaviour:a}})}}}o((()=>null!==e?(e.addEventListener("click",n),()=>{e.removeEventListener("click",n)}):()=>{}),[e])}function En(){const e=r(null);return o((()=>{const t=t=>{"Tab"===t.key&&Sn(t,e)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)}),[e]),e}const Sn=(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()},Cn=G(U(1)),wn=F(U(0)),Tn="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DISPLAY_ERRORS:"true",REPORT_RENDER_ERRORS:"true",USE_MEDIA_QUERY_NESTING:"true"};function On(e,t){return t?"false"!==Tn.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 xn={hovered:":hover",pressed:":active",focussed:":focus",disabled:":disabled"};function An(e){return function(e){return Object.keys(xn).indexOf(e)>-1}(e)?xn[e]:""}const Nn={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 Ln(e,t){if(!Nn[e]||!Nn[e][t])throw new Error(`No CSS property mapping exists for styling property: ${e}.${t.toString()}`);return Nn[e][t]}function _n(e,t){return n=>t(...Object.keys(e).map((t=>e[t](n[t]))))}function Rn(...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 Dn(e,t){return`${e}:${t};`}function kn(e){return function(e,t){return`@media (${e}) {${t}}\n`}("prefers-color-scheme: dark",e)}class Pn extends Error{constructor(e,t){super(`Invalid styling value '${t}': ${e}.`),this.name=this.constructor.name}}function $n(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 Pn(n,JSON.stringify(t));return!0}function jn(e){if(isNaN(e)||"number"!=typeof e&&"string"!=typeof e)return"value must be a number"}function Fn(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 Gn(e){if(null==e||""===e)return"value must not be omitted"}function Mn(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 Bn(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 Un(e){if(null!=e&&""!==e)return"value must not be specified"}function Vn(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 zn(...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||jn(t)),void 0))return}}return`value must be a space separated list of numbers, of one of the following lengths: ${e.join(" ,")}`}}function Hn(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 Wn(e){if("string"!=typeof e)return"value must be a string"}const qn=V(Object);function Kn(e){const t=Object.entries(e);return n=>qn(n)&&!Array.isArray(n)?t.reduce(((e,[t,i])=>e||i(n[t])),void 0):`Input value (${e}) must be an object`}function Yn(e){if("number"!=typeof e&&"string"!=typeof e||isNaN(e)||!(e>=0))return"value must be a positive number"}function Jn(e,t,n){return $n(jn,n)?Dn(Ln(e,t),`${n}`):""}function Zn(e){return(t,n,i)=>$n(Fn(Object.keys(e)),i)?Dn(Ln(t,n),`${e[i]}`):""}function Qn(e){return $n(Gn,e)?_n({light:t(Bn,!1),dark:t(Hn(Un,Bn),!0)},Rn("\n "))(e):"";function t(e,t){return n=>{if($n(e,n)&&n){const e=Dn("background-image",`url("${n}")`);return t?kn(e):e}return""}}}function Xn(e){const t={crop:"auto",fit:"contain",fill:"cover"};return"string"==typeof e&&(e=e.toLowerCase()),$n(Hn(Un,Fn(Object.keys(t))),e)&&e?Dn("background-size",t[e]):""}const ei=T([[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,_]]);function ti(e){const t="string"==typeof e?e.toLowerCase():e;return $n(Hn(Un,Fn(["top","right","bottom","left","center","top-left","top-right","bottom-left","bottom-right"])),t)&&t?Dn("background-position",ei(t)):""}function ni(e,t,n){return $n(Hn(jn,zn(2,3,4)),n)?Dn(Ln(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function ii(e){return(t,n,i)=>$n(Vn({fit:Fn(e),percentage:jn,fixed:jn}),i)?Dn(Ln(t,n),ai(i)):""}function ai(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 oi=Kn({light:Mn,dark:Hn(Un,Mn)});function ri(e,t,n){return i=>{if(i){const a=Dn(Ln(e,t),li(String(i)));return n?kn(a):a}return""}}function si(e,t,n){return $n(oi,n)?_n({light:ri(e,t,!1),dark:ri(e,t,!0)},Rn("\n "))(n):""}function li(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 ci=Kn({offsetX:Hn(Un,jn),offsetY:Hn(Un,jn),blurRadius:Hn(Un,jn),spreadRadius:Hn(Un,jn),color:oi}),di=e=>t=>null!=t?String(t):e,ui=P(R(W,"px"),di("0")),pi=e=>t=>"string"==typeof t?e(t):t,yi=P(pi(R(W,"px")),di(void 0)),fi=P(pi(li),U("dark"));function mi(e,t,n){return Dn(e,_n({offsetX:ui,offsetY:ui,blurRadius:t.spreadRadius?ui:yi,spreadRadius:yi,color:n},Rn(" "))(t))}const hi={center:"center","flex-end":"flex-end","flex-start":"flex-start",stretch:"stretch"},vi={container:{justifyContent:Zn(hi),alignItems:Zn(hi),shadow:function(e,t,n){var i;if($n(ci,n)){const a=Ln(e,t);return Rn("\n")(mi(a,n,P(li,H("#80000000","light"))),(null===(i=n.color)||void 0===i?void 0:i.dark)?kn(mi(a,n,fi)):"")}return""},gap:ni,overflow:Zn({hidden:"hidden",visible:"visible"}),blur:function(e,t,n){return $n(Yn,n)?Dn(Ln(e,t),`blur(${n.toString()}px)`):""},opacity:Jn},text:{textColor:si,fontSize:ni,fontFamily:function(e,t,n){return $n(Wn,n)?Dn(Ln(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:Zn({100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900}),fontStyle:Zn({normal:"normal",italic:"italic"}),lineHeight:ni,lineLimit:function(e,t,n){return $n(jn,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:ni,baselineTextAlign:Zn({super:"super",sub:"sub",baseline:"baseline"}),horizontalTextAlign:Zn({left:"left",right:"right",center:"center",start:"start",end:"end",justify:"justify"}),textDecoration:Zn({underline:"underline","strike-through":"line-through",none:"none"}),textTransform:Zn({capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",none:"none"})},background:{backgroundColor:si,backgroundImage:function(e,t,n){return $n(Gn,n)?_n({url:Qn,position:ti,scale:Xn},Rn)(n):""}},dimension:{width:ii(["wrap-content","fit-width"]),maxWidth:ni,minWidth:ni,height:ii(["wrap-content","fit-height"]),maxHeight:ni,minHeight:ni,rotateZ:(gi="Z",(e,t,n)=>{const i=`rotate${gi}`;return $n(jn,n)?Dn(Ln(e,t),`${i}(${n.toString()}deg)`):""})},flexChild:{alignSelf:Zn(hi),weight:Jn,order:Jn},spacing:{margin:ni,padding:ni,offset:function(e,t,n){return $n(zn(2),n)?`transform:translate(${n.split(" ").join("px, ")}px);`:""}},border:{borderColor:si,borderRadius:ni,borderWidth:ni,borderStyle:Zn({solid:"solid",dashed:"dashed"})}};var gi;function bi(e){return Object.keys(e).reduce(((t,n)=>(n&&e[n]&&Object.keys(e[n]).forEach((i=>{if(!vi[n])throw new Error(`No styling transformers exist for styling category key: ${n}`);const a=vi[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 Ii="FAILED_TEMPLATING_DATA",Ei=new Map;function Si(e){return String.fromCharCode(97+e)}function Ci(e,t,n){const i=`${e||Rt.pluginId}-${void 0!==t?String(t):"outer"}`,a=Ei.get(i);if(a&&a.sheet.container.isConnected)return a.css;const o=function(e,t){const n={key:void 0!==e?`inner-css-${Si(e)}`:"outer-css",container:t};return t&&t.parentElement&&(n.container=t.parentElement),gt(n)}(t,n);return Ei.set(i,o),o.css}const wi="%%%OWN_CLASS_REF%%%",Ti=q(((e,t,n,i)=>`${String(e)}-${t}-${n}`),Oi);function Oi(e,t,n,i){const a=Ci(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]:xi(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(wi,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 xi(e,t,n,i,a){return e.map(function(e,t,n){return i=>Object.entries(i).map((([i,a])=>{const o=a?bi(a):"";switch(!0){case"default"===i:return o?`\n${o}\n`:"";case Boolean(e):return`\n .${e}${An(i)} & {\n${o}\n}\n`;case t&&"own"!==n:return`\n .${wi}${An(i)} & {\n${o}\n}\n`;default:return`\n &${An(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:`${On(i,t)}\n`):e}),"")}const Ai=s(z(void 0)),Ni=()=>l(Ai),Li=s(null);function _i(e,t){var n;const i=l(Li);return i&&null!==(n=t(i))&&void 0!==n?n:e}const Ri=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")})),Di=Ri.Consumer,ki=()=>l(Ri),Pi=e=>a.createElement(Ri.Provider,{value:(t,n,i)=>e.value(t,null!=n?n:e.overrides,i)},e.children),$i=s(null),ji=()=>l($i),Fi=s({get(){throw Error("Offer context has not been set")}}),Gi=e=>a.createElement(Fi.Provider,{value:{get:()=>e.context}},e.children),Mi=()=>l(Fi).get(),Bi=()=>{try{return l(Fi).get().creative.copy}catch(e){return}},Ui=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),Vi=P(J,Z),zi=Y({url:Vi,title:Vi});function Hi(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(qi(e,"This Meta Attribute could not be parsed."));return function(e,t,n,i){switch(t){case"openLinks":return function(e,t,n){Wi(t,e,"openLinks",1,2);const i=Ki(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),a=Yi(t,1,(e=>"string"==typeof e&&e.length?e:null));if("InApp"===i)return n.replace(Ui,((e,t)=>`<a ${gn} ${a?`${bn}="${a}" `:""}${t}`));return n}(e,n,i);case"sliceText":return function(e,t,n){Wi(t,e,"sliceText",2,2);const i=Ki(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),a=Ki(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(qi(e,`Unknown "SliceBy" value. ${i}`))}(e,n,i);default:throw new Error(qi(e,`Unknown Meta Attribute '${t}'.`))}}(e,i,o,t)}),n)}function Wi(e,t,n,i,a){const o=new Error(qi(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 qi(e,t){return`Malformed Meta Attribute: '${e}' - ${t}`}function Ki(e,t,n,i,a){const o=Yi(e,n,i);if(null!==o)return o;throw Error(qi(t,a||`Could not parse meta attribute argument at index ${n} from arguments ${JSON.stringify(e)}`))}function Yi(e,t,n){return n(e[t])}const Ji="DATA",Zi="STATE",Qi=new RegExp(`^(${Ji}|${Zi})`),Xi=new RegExp(`^${Zi}`),ea=new RegExp(`%\\^(?:${Ji}|${Zi})\\.[a-zA-Z0-9]+[a-zA-Z0-9\\.]*(?:\\:[a-zA-Z0-9]+\\[[a-zA-Z0-9\\.,]*\\])*(?:\\|.*?)?\\^%`,"g"),ta=Symbol("invalid");function na(e,t="creativeCopy"){const n=ia({data:e},t);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:ia(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(Qi.test(t)){if(!this.dataMap.has(t)&&Xi.test(t))throw new jt(Ii,`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===ta)throw new jt(Ii,`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=Hi(i[0],i.slice(1),n)}catch(e){throw new jt(Ii,`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(ea,o,a);return!1===i?r:""}.bind({dataMap:n})}function ia(e,t,n){const i=new Map(n);return"data"in e&&a(e.data,`${Ji}${t?"."+t:""}`),"state"in e&&a(e.state,`${Zi}${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,ta),e&&"object"==typeof e&&Q(((e,n)=>a(e,`${t}.${n}`)),e)}}const aa=s(na({})),oa=aa.Consumer,ra=aa.Provider,sa=()=>l(aa),la=s(null),ca=la.Provider,da=s("OUTER"),ua=()=>"VARIANT"===l(da),pa=s(void 0),ya=()=>l(pa);var fa,ma,ha,va,ga,ba,Ia=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())}))},Ea=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},Sa=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 Ca{constructor(e,t,n,i,a){fa.set(this,void 0),ma.set(this,void 0),ha.set(this,new Set),va.set(this,void 0),ga.set(this,void 0),ba.set(this,void 0),Ea(this,fa,ae(e.subscribe.bind(e),[n]),"f"),Ea(this,ma,ae(e.dispatch.bind(e),[n]),"f"),Ea(this,va,t,"f"),Ea(this,ga,i,"f"),Ea(this,ba,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=Sa(this,fa,"f").call(this,e),n=()=>{t(),Sa(this,ha,"f").delete(n)};return Sa(this,ha,"f").add(n),n}onInteractivityChange(e){return Sa(this,ga,"f").subscribe(e)}onEvent(...e){const t=e.reduce(((e,t)=>{if("partner"===t.source||"*"===t.source){const n=Sa(this,ba,"f").call(this,t.name).subscribe(t.callback);return[...e,()=>n.unsubscribe()]}return e}),[]),n=()=>{t.forEach((e=>{e()})),Sa(this,ha,"f").delete(n)};return Sa(this,ha,"f").add(n),n}globalDispatch(e){Sa(this,ma,"f").call(this,e)}dispose(){Sa(this,ha,"f").forEach((e=>e())),Ea(this,ha,new Set,"f"),Sa(this,ga,"f").clear()}createChildPlugin(e){return Sa(this,va,"f").call(this,e)}}fa=new WeakMap,ma=new WeakMap,ha=new WeakMap,va=new WeakMap,ga=new WeakMap,ba=new WeakMap;class wa{onGlobalStateChange(){return()=>{}}onInteractivityChange(){return()=>{}}onEvent(){return()=>{}}globalDispatch(){}dispose(){}createChildPlugin(){return{close:()=>Ia(this,void 0,void 0,(function*(){})),onClose:()=>Ia(this,void 0,void 0,(function*(){})),putConfig:()=>Ia(this,void 0,void 0,(function*(){})),send:()=>Ia(this,void 0,void 0,(function*(){})),onEvent:()=>({subscribe:()=>({unsubscribe:()=>{}})})}}}var Ta,Oa,xa=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},Aa=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 Na{constructor(e){Ta.set(this,void 0),Oa.set(this,new Set),xa(this,Ta,e,"f")}subscribe(e){return Aa(this,Oa,"f").add(e),!0===e(Aa(this,Ta,"f"))&&Aa(this,Oa,"f").delete(e),()=>{Aa(this,Oa,"f").delete(e)}}publish(e){xa(this,Ta,e,"f"),Aa(this,Oa,"f").forEach((e=>{!0===e(Aa(this,Ta,"f"))&&Aa(this,Oa,"f").delete(e)}))}clear(){Aa(this,Oa,"f").clear()}}Ta=new WeakMap,Oa=new WeakMap;var La=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)},_a=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 Ra="breakpoint-0px";class Da{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,y;const f=this.appFactory,m=this.logger,h=null!==(e=this.gatewayFactory)&&void 0!==e?e:()=>new wa;return y=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"});_a(this,a,document.createElement("div"),"f"),La(this,a,"f").id="app-container",La(this,a,"f").classList.add("default"),e.appendChild(La(this,a,"f"))}attributeChangedCallback(e,a,o){if(o!==a)switch(e){case"visible":La(this,n,"f").call(this,"true"===o);break;case"interactivity":"ENABLED"!==o&&"DISABLED"!==o||La(this,i,"f").call(this,o);break;case"active-breakpoint":La(this,t,"m",c).call(this,o,a)}}makeInteractivityUpdateHandler(e){_a(this,i,(t=>{e.publish(t)}),"f")}makeVisbilityUpdateHandler(e,i,a){const o="true"===this.getAttribute("visible"),r=this.getAttribute("slotInstanceGuid");_a(this,n,(o=>{o?(_a(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}})):La(this,t,"m",p).call(this)}),"f"),La(this,n,"f").call(this,o)}trackViewability(e,n){if(!La(this,o,"f"))if("IntersectionObserver"in window&&!La(this,r,"f")){const i=()=>{La(this,o,"f")||(n.globalDispatch({type:an,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!0}}),_a(this,o,!0,"f"),La(this,t,"m",p).call(this),La(this,a,"f").removeEventListener("click",i))};La(this,a,"f").addEventListener("click",i),_a(this,r,new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=.5?La(this,t,"m",u).call(this,(()=>{La(this,o,"f")||(n.globalDispatch({type:an,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!1}}),_a(this,o,!0,"f"),La(this,t,"m",p).call(this),La(this,a,"f").removeEventListener("click",i))})):La(this,t,"m",d).call(this)}))}),{threshold:.5}),"f"),_a(this,l,(()=>{var e,n;"visible"===document.visibilityState?null===(e=La(this,r,"f"))||void 0===e||e.observe(La(this,a,"f")):(La(this,t,"m",d).call(this),null===(n=La(this,r,"f"))||void 0===n||n.disconnect())}),"f"),document.addEventListener("visibilitychange",La(this,l,"f")),La(this,l,"f").call(this)}else n.globalDispatch({type:an,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!1,inferred:!1}}),_a(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(){La(this,t,"m",p).call(this)}connectedCallback(){var e,t,n;const i=this.getAttribute("container"),o=this.getAttribute("plugin-id");La(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 Na("DISABLED"===this.getAttribute("interactivity")?"DISABLED":"ENABLED"),u=null!==(e=this.getAttribute("schemaVersion"))&&void 0!==e?e:"",p=this.getJSONAttr("offerState","{}");f||v("Cannot create app without factory. Please build the connector withAppFactory.");const y=h({offerPositionIndex:r,creativeInstanceGuid:null===(t=null==c?void 0:c.creative)||void 0===t?void 0:t.instanceGuid},d);this.makeInteractivityUpdateHandler(d),f({rootElement:La(this,a,"f"),gateway:y,logger:m,offerPositionIndex:r,offerData:c,layoutSchema:s,childLayouts:l,schemaVersion:u,pluginId:o||Rt.pluginId,offerState:p}),this.makeVisbilityUpdateHandler(r,null===(n=null==c?void 0:c.creative)||void 0===n?void 0:n.instanceGuid,y)}},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){La(this,a,"f").classList.remove(t||Ra),La(this,a,"f").classList.add(e||Ra)},d=function(){La(this,s,"f")&&(clearTimeout(La(this,s,"f")),_a(this,s,null,"f"))},u=function(e){La(this,t,"m",d).call(this),_a(this,s,window.setTimeout(e,1e3),"f")},p=function(){La(this,t,"m",d).call(this),La(this,r,"f")&&(La(this,r,"f").disconnect(),_a(this,r,null,"f")),La(this,l,"f")&&(document.removeEventListener("visibilitychange",La(this,l,"f")),_a(this,l,null,"f"))},y;function v(e){throw m({level:Pt,code:"MODULE_BUILDER/FAILED_TO_BUILD_MODULE",message:e}),Error(e)}}}const ka=s({get:()=>new wa}),Pa=e=>a.createElement(ka.Provider,{value:{get:()=>e.context}},e.children);const $a=s({get(){throw Error("Layout Schema context has not been set")}}),ja=e=>a.createElement($a.Provider,{value:{get:()=>e.context}},e.children),Fa=()=>l($a).get(),Ga=s("ENABLED"),Ma=()=>l(Ga);function Ba(e){const t=Va(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Va(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 Ua={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function Va(e,t=Ua){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 za=s(Ba({}));za.Consumer;const Ha=za.Provider,Wa=e=>{const t=l(za),n=e.split("|");for(const e of n){const n=t(e.trim(),"images");if(n)return n}},qa=()=>l(za),Ka=s({});function Ya({info:e,children:t}){const n=l(Ka);return a.createElement(Ka.Provider,{value:Object.assign(Object.assign({},n),e)},t)}const Ja=s({get(){throw Error("Catalog Item context has not been set")}}),Za=e=>a.createElement(Ja.Provider,{value:{get:()=>e.context}},e.children),Qa=()=>l(Ja).get(),Xa=s(""),eo=()=>l(Xa),to=s(""),no=s(void 0);function io({children:e}){const t=d((()=>{const e=document.createElement("div");return e.inert=!0,{inert:!0===e.inert}}),[]);return a.createElement(no.Provider,{value:t},e)}const ao=P(re([Z,le(Z)]),ce,F(de),F(ue(pe,z({}),_)),de,H({},"value")),oo=P(Z,U("predicates"));function ro(e,t){return`transition: ${t.map((t=>`${t} ${e}ms`)).join(", ")};`}const so=oe(((e,{duration:t,predicates:n,styles:i})=>{return{predicates:n,classname:e(bi(i)),transitionBaseClassname:e(ro(t,(a=i,M(a).flatMap((e=>{const[t,n]=null!=e?e:[];return n&&t?se(n).map((e=>Ln(t,e))):[]})))))};var a})),lo=re([ao,oo]);const co={is:j,"is-not":P(J,j),"is-below":be,"is-above":ge};function uo(e,t){return e.includes(t)}const po={is:j,"is-not":P(J,j),exists:uo,"not-exists":P(J,uo)},yo={exists:P(J,Ie(pe,Z)),"not-exists":Ie(pe,Z)},fo={"is-true":j(!0),"is-false":j(!1)},mo={is:j,"is-not":P(J,j)};function ho(e){return(t,n)=>n[e]}const vo=T([[(e,t)=>j("Breakpoint",e),ho("activeBreakpoint")],[(e,t)=>j("Progression",e),ho("progressionIndex")],[(e,t)=>j("Position",e),ho("positionIndex")]]);function go(e,t){return e.creativeCopy&&"string"==typeof e.creativeCopy[t]?e.creativeCopy[t]:void 0}const bo=T([[j("Breakpoint"),(e,t,n)=>{const i=fe(["breakpoints",t]);return X(ye(i,Number),Ee(i))(n)}],[j("Progression"),(e,t,n)=>T([[ge(0),Se(n.totalGroups)],[Ce(0),_]])(Number(t))],[j("Position"),(e,t,n)=>T([[ge(0),Se(n.totalOffers)],[Ce(0),_]])(Number(t))]]),Io=P(J,isNaN);function Eo(e,t){return e.map((e=>{var n,i,a;switch(e.type){case"StaticString":return(0,mo[e.predicate.condition])(e.predicate.input,e.predicate.value);case"CreativeCopy":return(0,yo[e.predicate.condition])(go(t,e.predicate.value));case"StaticBoolean":return(0,fo[e.predicate.condition])(e.predicate.value);case"CustomState":return(0,co[e.predicate.condition])(null!==(n=t.customStates[e.predicate.key])&&void 0!==n?n:0,e.predicate.value);case"DomainState":return(0,co[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,po[e.predicate.content.condition])(e.predicate.content.input,e.predicate.content.value);case"TextLength":return(0,co[e.predicate.content.condition])(e.predicate.content.input.length,e.predicate.content.value);case"Numeric":return(0,co[e.predicate.content.condition])(Number(e.predicate.content.input),e.predicate.content.value);default:return!1}}(e);default:{const n=co[e.predicate.condition],i=null!==(a=vo(e.type,t))&&void 0!==a?a:NaN,o=bo(e.type,e.predicate.value,t);return!!Io(i)&&n(i,o)}}}))}function So(e){return B(0,["breakpoint","breakpoints",e.breakpoint.activeBreakpoint],e)}const Co={breakpoints:{},activeBreakpoint:NaN,progressionIndex:NaN,positionIndex:NaN,totalOffers:NaN,totalGroups:NaN,creativeCopy:{},customStates:{},domainStates:{}};function wo(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:${go(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:${vo(e.type,t)}:${t.totalGroups}`}}(e,t),o=n.current.get(a);return he(To(o)?{cached:ve(o)}:{uncached:ve({key:a,predicate:e})},i)}(i,n,e,t)),{cached:[],uncached:[]}),s=Eo(r.map((({predicate:e})=>e)),n);return me(r,s).forEach((([{key:t},n])=>{e.current.set(t,n)})),o.concat(s)}const To=V(Boolean);const Oo=oe(((e,t,n)=>{var i,a,o,r,s,l;return{breakpoints:n.breakpoint.breakpoints,activeBreakpoint:So(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}})),xo=fe(["predicate","content","input"]),Ao=fe(["predicate","content","value"]),No=fe(["predicate","key"]);function Lo(e,t){const n=ye(xo,(t=>t?e(t):"")),i=ye(Ao,(t=>"string"==typeof t?e(t):t)),a=P(n,i),o=ye(No,(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 _o=le(j(!0));function Ro(e){const t=ua(),n=ya(),i=r(new Map),a=Bi(),o=_i(Co,Oo(n,a)),s=sa();return d((()=>K((e=>{const n=Lo(s,e);return _o(wo(i,n,o,t))}),e)),[i,e,o,t,s])}function Do(e){e&&(e.style.display="")}function ko(e){e&&(e.style.display="none")}function Po(e){return e.settings.duration}const $o=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],jo=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function Fo(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const i=t?$o:jo,a=e.animate(i,{duration:n,iterations:1});return a.onfinish=()=>{t?Do(e):ko(e)},a.oncancel=()=>{t?Do(e):ko(e)},()=>{a.finish()}}return t?Do(e):ko(e),()=>{}}function Go({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)Fo(e,t,n)}(l.current,n,Po(e),e.type)})):!n&&t?t.forEach((e=>{l.current&&function(e,t,n,i){if("FadeOut"===i)Fo(e,t,n)}(l.current,n,Po(e),e.type)})):()=>{}),[n]),a.createElement("div",{ref:l,style:{display:"none"},className:s},i)}function Mo(e){const t=ki(),n=function(e){const t=ua(),n=ya(),i=r(new Map),a=Bi(),o=_i(Co,Oo(n,a)),s=Lo(sa(),e);return d((()=>_o(wo(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(Go,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:n},i):"functionally"===e.schema.hide?a.createElement(Ga.Provider,{value:n?"ENABLED":"DISABLED"},i):n?a.createElement(a.Fragment,null,i):null}const Bo=we(((e,t)=>`${e||""} ${t||""}`.trim())),Uo=e=>{var t;const n=l(la),i=ya(),a=ji()||document.head,o=eo(),r=Ci(o,i,a),s=u(Ti,[]),c=_i([],(e=>Object.values(e.breakpoint.breakpoints))),d=n||s(c,o,i,a),p=e.styles?d(e.styles):{},y=e.styles&&e.styles.conditionalTransitions?function(e,t){const n=so(e);return K((e=>lo(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,f=Ro(y?K(H([],"predicates"),y):{}),m=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}(y,t):void 0),f),h=y?K(U("transitionBaseClassname"),y):{},v=e.styles?(g=h,Bo(Bo(p,m),g)):void 0;var g;return e.children({classnames:v,mapperRef:d})};function Vo(e){const t=ki();return a.createElement(Uo,{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 zo(e){const t=ki();return a.createElement(Uo,{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 Ho={allowedTags:["em","strong","a","br","u","p","li","ul","ol","s"],allowedAttributes:{a:["href","target",gn,bn],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],s:[]},allowedSchemes:["http","https"]},Wo=new Map([["&","_;^;_"]]),qo=new RegExp(`<a *(?=${Ho.allowedAttributes.a.join("|")}|>)`,"g"),Ko=new RegExp('<a [^>]*href="([^"]+)"',"g"),Yo=new RegExp("(<br *?>)|(<br *?/>)","g"),Jo="<br/>";function Zo(e){const t=sa(),n=Ma(),i=d((()=>{const n=t(e.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Ko,((e,t)=>{const n=t.replaceAll("&",Wo.get("&"));return e.replace(t,n)})).replaceAll(Yo,Jo)}(e);return t===vt(t,Ho)}(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(Uo,{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(qo,`<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(qo,`<a ${n.join(" ")}`)}});var l})):null}function Qo(e){const t=sa()(e.schema.value),n=Ma(),{tabIndex:i,styles:o,isDisabled:r}=St(n);return t?a.createElement(Uo,{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 Xo(e,t,n){if("BasicText"===e.type)return a.createElement(Qo,{schema:e.node,testId:t,isInline:null!=n&&n})}function er(e,t,n){return a.Children.toArray(e.map(((e,i)=>t(e,void 0,Kt(i,n)))))}function tr(e){const t=Ni(),n=ki(),i=Mi(),r=sa(),s=ya(),l=Ma(),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:y,isDisabled:f}=St(l);return Ot(c)&&!d&&void 0!==s?a.createElement(Uo,{styles:e.schema.styles},(({classnames:o,mapperRef:r})=>{var s;return a.createElement("button",{type:"button",tabIndex:p,"aria-disabled":f,"aria-label":null!==(s=e.schema.a11yLabel)&&void 0!==s?s:void 0,style:Object.assign({cursor:"pointer"},y),"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(Tt(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:f},a.createElement(ra,{value:u},(null==o?void 0:o.own)?function(e,t,n,i,o){return a.createElement(ca,{value:n(t)},er(e,i,o))}(e.schema.children,o.own,r,n,e.testId):er(e.schema.children,n,e.testId)))})):null}function nr(e){const t=Ma(),{styles:n,isDisabled:i}=St(t);return e.schema.url.light?a.createElement(Uo,{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 ir(e){const t=Ma(),{styles:n,isDisabled:i}=St(t),o=Wa(e.schema.imageKey);return null!=(r=o)&&"object"==typeof r&&"light"in r&&"string"==typeof r.light?a.createElement(Uo,{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 ar={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function or(e){const t=e.schema.name,n=e.schema.description,i=e.schema.styles?Wt(ar,e.schema.styles):ar,o=Ma(),{styles:r,isDisabled:s}=St(o);return t?a.createElement(Uo,{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 rr={backgroundColor:"#FFEEEE",color:"#FF0000",fontSize:"10px",padding:"4px",border:"1px solid #FF0000",margin:0,whiteSpace:"normal"};class sr 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"===Tn.REPORT_RENDER_ERRORS&&this.props.reporter({level:Pt,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"===Tn.DISPLAY_ERRORS?a.createElement("pre",{style:rr},a.createElement("strong",null,"Error:")," [",a.createElement("em",null,this.props.schema.type),"]"," ",this.state.errorMessage):void 0:this.props.children}}sr.contextType=Ka;const lr={internally:"_top",externally:"_blank"};function cr(e,t,n){return a.Children.toArray(e.map(((e,i)=>t(e,void 0,n?`${n}-child${i}`:void 0))))}function dr(e){var t;const n=lr[e.schema.open],i=ki(),o=Ma(),{tabIndex:r,styles:s,isDisabled:l}=St(o);return(null===(t=e.schema.children)||void 0===t?void 0:t.length)>0?a.createElement(Uo,{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(ca,{value:n(t)},cr(e,i,o))}(e.schema.children,null==t?void 0:t.own,o,i,e.testId):cr(e.schema.children,i,e.testId))})):null}function ur(e,t,n){if("StaticLink"===e.type)return a.createElement(dr,{schema:e.node,testId:t,isInline:null!=n&&n})}const pr={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function yr(e){const t=(n=e.schema.iconKey,l(za)(n,"icons"));var n;const i=null==t?void 0:t.name,o=e.schema.styles?Wt(pr,e.schema.styles):pr,r=Ma(),{styles:s}=St(r);return i?a.createElement(Uo,{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 fr=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 y}from"react-dom/client";import{useDispatch as f,useSelector as m,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 T,mergeDeepWith as O,T as x,flip as A,type as N,unary as L,identity as _,concat as R,zipWith as D,slice as k,compose as P,findIndex as $,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 ye,lensPath as fe,zip as me,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 Te,indexBy as Oe,mergeRight as xe,lensProp as Ae,defaultTo as Ne,reject as Le,whereEq as _e,uniqBy as Re,find as De,has as ke,assoc as Pe,gte as $e,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,spawn as Xe,takeLatest 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 yt,take as ft,delay as mt}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 Tt(e){return null!=e&&"object"==typeof e&&("url"in e||"name"in e)&&"config"in e}function Ot(e){return null!=e&&"object"==typeof e&&"id"in e&&"action"in e&&"instanceGuid"in e&&"signalType"in e}function xt(e){return Ot(e)&&"Fulfillment"===e.action}function At(e){return Ot(e)&&"Url"===e.action}function Nt(e){return Ot(e)&&"ExternalPaymentTrigger"===e.action}function Lt(e){return(xt(e)||At(e))&&"RealTime"===e.conversionType&&"rclid"in e}function _t(e){return(xt(e)||At(e))&&"RealTimeReferral"===e.conversionType&&"rclid"in e}const Rt={pluginId:"shared",pageInstanceGuid:"N/A"};var Dt;!function(e){e.DCUI="DCUI",e.Partner="partner"}(Dt||(Dt={}));const kt=["SignalCartItemQuantitySelected","SignalProductItemResponse","SignalUserInteraction"],Pt="ERROR",$t="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","INITIATE_CART_ITEM_EVENT","PLACEMENT_CLOSED","PLACEMENT_COMPLETED","PLACEMENT_INTERACTIVE","PLACEMENT_FAILURE"];const Gt=(e,t)=>R(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 T([[(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),O(Ht)],[(e,t)=>"Array"===N(e),Mt],[x,A(L(_))]])(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&&Tt(e.fulfillment)}function Qt(e){return Nt(e)}function Xt(e){return At(e)}function en(e){return function(e){return Ot(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!!(_t(e)||"responseOption"in e&&_t(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",yn="GLOBAL/LAUNCH_CHILD_LAYOUT",fn="GLOBAL/CART_ITEM_EVENT/INITIATE",mn="GLOBAL/CART_ITEM_EVENT/RESPONSE",hn="GLOBAL/CART_SERVICE/INITIALIZE",vn={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:yn,INITIATE_CART_ITEM_EVENT:fn,CART_ITEM_RESPONSE:mn},gn="data-open-in-app",bn="data-click-signal-context";function In(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(bn);if(a&&t({type:an,payload:{name:"SignalUserInteraction",action:"Click",context:a}}),n){e.preventDefault();let a="newTab";i.hasAttribute(gn)&&(a="inApp"),t({type:dn,payload:{url:n,urlBehaviour:a}})}}}o((()=>null!==e?(e.addEventListener("click",n),()=>{e.removeEventListener("click",n)}):()=>{}),[e])}function En(){const e=r(null);return o((()=>{const t=t=>{"Tab"===t.key&&Sn(t,e)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)}),[e]),e}const Sn=(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()},Cn=G(U(1)),wn=F(U(0)),Tn="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DISPLAY_ERRORS:"true",REPORT_RENDER_ERRORS:"true",USE_MEDIA_QUERY_NESTING:"true"};function On(e,t){return t?"false"!==Tn.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 xn={hovered:":hover",pressed:":active",focussed:":focus",disabled:":disabled"};function An(e){return function(e){return Object.keys(xn).indexOf(e)>-1}(e)?xn[e]:""}const Nn={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 Ln(e,t){if(!Nn[e]||!Nn[e][t])throw new Error(`No CSS property mapping exists for styling property: ${e}.${t.toString()}`);return Nn[e][t]}function _n(e,t){return n=>t(...Object.keys(e).map((t=>e[t](n[t]))))}function Rn(...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 Dn(e,t){return`${e}:${t};`}function kn(e){return function(e,t){return`@media (${e}) {${t}}\n`}("prefers-color-scheme: dark",e)}class Pn extends Error{constructor(e,t){super(`Invalid styling value '${t}': ${e}.`),this.name=this.constructor.name}}function $n(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 Pn(n,JSON.stringify(t));return!0}function jn(e){if(isNaN(e)||"number"!=typeof e&&"string"!=typeof e)return"value must be a number"}function Fn(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 Gn(e){if(null==e||""===e)return"value must not be omitted"}function Mn(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 Bn(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 Un(e){if(null!=e&&""!==e)return"value must not be specified"}function Vn(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 zn(...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||jn(t)),void 0))return}}return`value must be a space separated list of numbers, of one of the following lengths: ${e.join(" ,")}`}}function Hn(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 Wn(e){if("string"!=typeof e)return"value must be a string"}const qn=V(Object);function Kn(e){const t=Object.entries(e);return n=>qn(n)&&!Array.isArray(n)?t.reduce(((e,[t,i])=>e||i(n[t])),void 0):`Input value (${e}) must be an object`}function Yn(e){if("number"!=typeof e&&"string"!=typeof e||isNaN(e)||!(e>=0))return"value must be a positive number"}function Jn(e,t,n){return $n(jn,n)?Dn(Ln(e,t),`${n}`):""}function Zn(e){return(t,n,i)=>$n(Fn(Object.keys(e)),i)?Dn(Ln(t,n),`${e[i]}`):""}function Qn(e){return $n(Gn,e)?_n({light:t(Bn,!1),dark:t(Hn(Un,Bn),!0)},Rn("\n "))(e):"";function t(e,t){return n=>{if($n(e,n)&&n){const e=Dn("background-image",`url("${n}")`);return t?kn(e):e}return""}}}function Xn(e){const t={crop:"auto",fit:"contain",fill:"cover"};return"string"==typeof e&&(e=e.toLowerCase()),$n(Hn(Un,Fn(Object.keys(t))),e)&&e?Dn("background-size",t[e]):""}const ei=T([[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,_]]);function ti(e){const t="string"==typeof e?e.toLowerCase():e;return $n(Hn(Un,Fn(["top","right","bottom","left","center","top-left","top-right","bottom-left","bottom-right"])),t)&&t?Dn("background-position",ei(t)):""}function ni(e,t,n){return $n(Hn(jn,zn(2,3,4)),n)?Dn(Ln(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function ii(e){return(t,n,i)=>$n(Vn({fit:Fn(e),percentage:jn,fixed:jn}),i)?Dn(Ln(t,n),ai(i)):""}function ai(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 oi=Kn({light:Mn,dark:Hn(Un,Mn)});function ri(e,t,n){return i=>{if(i){const a=Dn(Ln(e,t),li(String(i)));return n?kn(a):a}return""}}function si(e,t,n){return $n(oi,n)?_n({light:ri(e,t,!1),dark:ri(e,t,!0)},Rn("\n "))(n):""}function li(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 ci=Kn({offsetX:Hn(Un,jn),offsetY:Hn(Un,jn),blurRadius:Hn(Un,jn),spreadRadius:Hn(Un,jn),color:oi}),di=e=>t=>null!=t?String(t):e,ui=P(R(W,"px"),di("0")),pi=e=>t=>"string"==typeof t?e(t):t,yi=P(pi(R(W,"px")),di(void 0)),fi=P(pi(li),U("dark"));function mi(e,t,n){return Dn(e,_n({offsetX:ui,offsetY:ui,blurRadius:t.spreadRadius?ui:yi,spreadRadius:yi,color:n},Rn(" "))(t))}const hi={center:"center","flex-end":"flex-end","flex-start":"flex-start",stretch:"stretch"},vi={container:{justifyContent:Zn(hi),alignItems:Zn(hi),shadow:function(e,t,n){var i;if($n(ci,n)){const a=Ln(e,t);return Rn("\n")(mi(a,n,P(li,H("#80000000","light"))),(null===(i=n.color)||void 0===i?void 0:i.dark)?kn(mi(a,n,fi)):"")}return""},gap:ni,overflow:Zn({hidden:"hidden",visible:"visible"}),blur:function(e,t,n){return $n(Yn,n)?Dn(Ln(e,t),`blur(${n.toString()}px)`):""},opacity:Jn},text:{textColor:si,fontSize:ni,fontFamily:function(e,t,n){return $n(Wn,n)?Dn(Ln(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:Zn({100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900}),fontStyle:Zn({normal:"normal",italic:"italic"}),lineHeight:ni,lineLimit:function(e,t,n){return $n(jn,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:ni,baselineTextAlign:Zn({super:"super",sub:"sub",baseline:"baseline"}),horizontalTextAlign:Zn({left:"left",right:"right",center:"center",start:"start",end:"end",justify:"justify"}),textDecoration:Zn({underline:"underline","strike-through":"line-through",none:"none"}),textTransform:Zn({capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",none:"none"})},background:{backgroundColor:si,backgroundImage:function(e,t,n){return $n(Gn,n)?_n({url:Qn,position:ti,scale:Xn},Rn)(n):""}},dimension:{width:ii(["wrap-content","fit-width"]),maxWidth:ni,minWidth:ni,height:ii(["wrap-content","fit-height"]),maxHeight:ni,minHeight:ni,rotateZ:(gi="Z",(e,t,n)=>{const i=`rotate${gi}`;return $n(jn,n)?Dn(Ln(e,t),`${i}(${n.toString()}deg)`):""})},flexChild:{alignSelf:Zn(hi),weight:Jn,order:Jn},spacing:{margin:ni,padding:ni,offset:function(e,t,n){return $n(zn(2),n)?`transform:translate(${n.split(" ").join("px, ")}px);`:""}},border:{borderColor:si,borderRadius:ni,borderWidth:ni,borderStyle:Zn({solid:"solid",dashed:"dashed"})}};var gi;function bi(e){return Object.keys(e).reduce(((t,n)=>(n&&e[n]&&Object.keys(e[n]).forEach((i=>{if(!vi[n])throw new Error(`No styling transformers exist for styling category key: ${n}`);const a=vi[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 Ii="FAILED_TEMPLATING_DATA",Ei=new Map;function Si(e){return String.fromCharCode(97+e)}function Ci(e,t,n){const i=`${e||Rt.pluginId}-${void 0!==t?String(t):"outer"}`,a=Ei.get(i);if(a&&a.sheet.container.isConnected)return a.css;const o=function(e,t){const n={key:void 0!==e?`inner-css-${Si(e)}`:"outer-css",container:t};return t&&t.parentElement&&(n.container=t.parentElement),gt(n)}(t,n);return Ei.set(i,o),o.css}const wi="%%%OWN_CLASS_REF%%%",Ti=q(((e,t,n,i)=>`${String(e)}-${t}-${n}`),Oi);function Oi(e,t,n,i){const a=Ci(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]:xi(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(wi,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 xi(e,t,n,i,a){return e.map(function(e,t,n){return i=>Object.entries(i).map((([i,a])=>{const o=a?bi(a):"";switch(!0){case"default"===i:return o?`\n${o}\n`:"";case Boolean(e):return`\n .${e}${An(i)} & {\n${o}\n}\n`;case t&&"own"!==n:return`\n .${wi}${An(i)} & {\n${o}\n}\n`;default:return`\n &${An(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:`${On(i,t)}\n`):e}),"")}const Ai=s(z(void 0)),Ni=()=>l(Ai),Li=s(null);function _i(e,t){var n;const i=l(Li);return i&&null!==(n=t(i))&&void 0!==n?n:e}const Ri=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")})),Di=Ri.Consumer,ki=()=>l(Ri),Pi=e=>a.createElement(Ri.Provider,{value:(t,n,i)=>e.value(t,null!=n?n:e.overrides,i)},e.children),$i=s(null),ji=()=>l($i),Fi=s({get(){throw Error("Offer context has not been set")}}),Gi=e=>a.createElement(Fi.Provider,{value:{get:()=>e.context}},e.children),Mi=()=>l(Fi).get(),Bi=()=>{try{return l(Fi).get().creative.copy}catch(e){return}},Ui=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),Vi=P(J,Z),zi=Y({url:Vi,title:Vi});function Hi(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(qi(e,"This Meta Attribute could not be parsed."));return function(e,t,n,i){switch(t){case"openLinks":return function(e,t,n){Wi(t,e,"openLinks",1,2);const i=Ki(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),a=Yi(t,1,(e=>"string"==typeof e&&e.length?e:null));if("InApp"===i)return n.replace(Ui,((e,t)=>`<a ${gn} ${a?`${bn}="${a}" `:""}${t}`));return n}(e,n,i);case"sliceText":return function(e,t,n){Wi(t,e,"sliceText",2,2);const i=Ki(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),a=Ki(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>)");return e.startsWith("<a")?e.replace(n,(e=>e.slice(0,-4).slice(0,t+1)+"</a>")):e.slice(0,t)}(n,a);throw Error(qi(e,`Unknown "SliceBy" value. ${i}`))}(e,n,i);default:throw new Error(qi(e,`Unknown Meta Attribute '${t}'.`))}}(e,i,o,t)}),n)}function Wi(e,t,n,i,a){const o=new Error(qi(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 qi(e,t){return`Malformed Meta Attribute: '${e}' - ${t}`}function Ki(e,t,n,i,a){const o=Yi(e,n,i);if(null!==o)return o;throw Error(qi(t,a||`Could not parse meta attribute argument at index ${n} from arguments ${JSON.stringify(e)}`))}function Yi(e,t,n){return n(e[t])}const Ji="DATA",Zi="STATE",Qi=new RegExp(`^(${Ji}|${Zi})`),Xi=new RegExp(`^${Zi}`),ea=new RegExp(`%\\^(?:${Ji}|${Zi})\\.[a-zA-Z0-9]+[a-zA-Z0-9\\.]*(?:\\:[a-zA-Z0-9]+\\[[a-zA-Z0-9\\.,]*\\])*(?:\\|.*?)?\\^%`,"g"),ta=Symbol("invalid");function na(e,t="creativeCopy"){const n=ia({data:e},t);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:ia(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(Qi.test(t)){if(!this.dataMap.has(t)&&Xi.test(t))throw new jt(Ii,`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===ta)throw new jt(Ii,`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=Hi(i[0],i.slice(1),n)}catch(e){throw new jt(Ii,`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(ea,o,a);return!1===i?r:""}.bind({dataMap:n})}function ia(e,t,n){const i=new Map(n);return"data"in e&&a(e.data,`${Ji}${t?"."+t:""}`),"state"in e&&a(e.state,`${Zi}${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,ta),e&&"object"==typeof e&&Q(((e,n)=>a(e,`${t}.${n}`)),e)}}const aa=s(na({})),oa=aa.Consumer,ra=aa.Provider,sa=()=>l(aa),la=s(null),ca=la.Provider,da=s("OUTER"),ua=()=>"VARIANT"===l(da),pa=s(void 0),ya=()=>l(pa);var fa,ma,ha,va,ga,ba,Ia=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())}))},Ea=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},Sa=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 Ca{constructor(e,t,n,i,a){fa.set(this,void 0),ma.set(this,void 0),ha.set(this,new Set),va.set(this,void 0),ga.set(this,void 0),ba.set(this,void 0),Ea(this,fa,ae(e.subscribe.bind(e),[n]),"f"),Ea(this,ma,ae(e.dispatch.bind(e),[n]),"f"),Ea(this,va,t,"f"),Ea(this,ga,i,"f"),Ea(this,ba,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=Sa(this,fa,"f").call(this,e),n=()=>{t(),Sa(this,ha,"f").delete(n)};return Sa(this,ha,"f").add(n),n}onInteractivityChange(e){return Sa(this,ga,"f").subscribe(e)}onEvent(...e){const t=e.reduce(((e,t)=>{if("partner"===t.source||"*"===t.source){const n=Sa(this,ba,"f").call(this,t.name).subscribe(t.callback);return[...e,()=>n.unsubscribe()]}return e}),[]),n=()=>{t.forEach((e=>{e()})),Sa(this,ha,"f").delete(n)};return Sa(this,ha,"f").add(n),n}globalDispatch(e){Sa(this,ma,"f").call(this,e)}dispose(){Sa(this,ha,"f").forEach((e=>e())),Ea(this,ha,new Set,"f"),Sa(this,ga,"f").clear()}createChildPlugin(e){return Sa(this,va,"f").call(this,e)}}fa=new WeakMap,ma=new WeakMap,ha=new WeakMap,va=new WeakMap,ga=new WeakMap,ba=new WeakMap;class wa{onGlobalStateChange(){return()=>{}}onInteractivityChange(){return()=>{}}onEvent(){return()=>{}}globalDispatch(){}dispose(){}createChildPlugin(){return{close:()=>Ia(this,void 0,void 0,(function*(){})),onClose:()=>Ia(this,void 0,void 0,(function*(){})),putConfig:()=>Ia(this,void 0,void 0,(function*(){})),send:()=>Ia(this,void 0,void 0,(function*(){})),onEvent:()=>({subscribe:()=>({unsubscribe:()=>{}})})}}}var Ta,Oa,xa=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},Aa=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 Na{constructor(e){Ta.set(this,void 0),Oa.set(this,new Set),xa(this,Ta,e,"f")}subscribe(e){return Aa(this,Oa,"f").add(e),!0===e(Aa(this,Ta,"f"))&&Aa(this,Oa,"f").delete(e),()=>{Aa(this,Oa,"f").delete(e)}}publish(e){xa(this,Ta,e,"f"),Aa(this,Oa,"f").forEach((e=>{!0===e(Aa(this,Ta,"f"))&&Aa(this,Oa,"f").delete(e)}))}clear(){Aa(this,Oa,"f").clear()}}Ta=new WeakMap,Oa=new WeakMap;var La=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)},_a=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 Ra="breakpoint-0px";class Da{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,y;const f=this.appFactory,m=this.logger,h=null!==(e=this.gatewayFactory)&&void 0!==e?e:()=>new wa;return y=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"});_a(this,a,document.createElement("div"),"f"),La(this,a,"f").id="app-container",La(this,a,"f").classList.add("default"),e.appendChild(La(this,a,"f"))}attributeChangedCallback(e,a,o){if(o!==a)switch(e){case"visible":La(this,n,"f").call(this,"true"===o);break;case"interactivity":"ENABLED"!==o&&"DISABLED"!==o||La(this,i,"f").call(this,o);break;case"active-breakpoint":La(this,t,"m",c).call(this,o,a)}}makeInteractivityUpdateHandler(e){_a(this,i,(t=>{e.publish(t)}),"f")}makeVisbilityUpdateHandler(e,i,a){const o="true"===this.getAttribute("visible"),r=this.getAttribute("slotInstanceGuid");_a(this,n,(o=>{o?(_a(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}})):La(this,t,"m",p).call(this)}),"f"),La(this,n,"f").call(this,o)}trackViewability(e,n){if(!La(this,o,"f"))if("IntersectionObserver"in window&&!La(this,r,"f")){const i=()=>{La(this,o,"f")||(n.globalDispatch({type:an,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!0}}),_a(this,o,!0,"f"),La(this,t,"m",p).call(this),La(this,a,"f").removeEventListener("click",i))};La(this,a,"f").addEventListener("click",i),_a(this,r,new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=.5?La(this,t,"m",u).call(this,(()=>{La(this,o,"f")||(n.globalDispatch({type:an,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!1}}),_a(this,o,!0,"f"),La(this,t,"m",p).call(this),La(this,a,"f").removeEventListener("click",i))})):La(this,t,"m",d).call(this)}))}),{threshold:.5}),"f"),_a(this,l,(()=>{var e,n;"visible"===document.visibilityState?null===(e=La(this,r,"f"))||void 0===e||e.observe(La(this,a,"f")):(La(this,t,"m",d).call(this),null===(n=La(this,r,"f"))||void 0===n||n.disconnect())}),"f"),document.addEventListener("visibilitychange",La(this,l,"f")),La(this,l,"f").call(this)}else n.globalDispatch({type:an,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!1,inferred:!1}}),_a(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(){La(this,t,"m",p).call(this)}connectedCallback(){var e,t,n;const i=this.getAttribute("container"),o=this.getAttribute("plugin-id");La(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 Na("DISABLED"===this.getAttribute("interactivity")?"DISABLED":"ENABLED"),u=null!==(e=this.getAttribute("schemaVersion"))&&void 0!==e?e:"",p=this.getJSONAttr("offerState","{}");f||v("Cannot create app without factory. Please build the connector withAppFactory.");const y=h({offerPositionIndex:r,creativeInstanceGuid:null===(t=null==c?void 0:c.creative)||void 0===t?void 0:t.instanceGuid},d);this.makeInteractivityUpdateHandler(d),f({rootElement:La(this,a,"f"),gateway:y,logger:m,offerPositionIndex:r,offerData:c,layoutSchema:s,childLayouts:l,schemaVersion:u,pluginId:o||Rt.pluginId,offerState:p}),this.makeVisbilityUpdateHandler(r,null===(n=null==c?void 0:c.creative)||void 0===n?void 0:n.instanceGuid,y)}},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){La(this,a,"f").classList.remove(t||Ra),La(this,a,"f").classList.add(e||Ra)},d=function(){La(this,s,"f")&&(clearTimeout(La(this,s,"f")),_a(this,s,null,"f"))},u=function(e){La(this,t,"m",d).call(this),_a(this,s,window.setTimeout(e,1e3),"f")},p=function(){La(this,t,"m",d).call(this),La(this,r,"f")&&(La(this,r,"f").disconnect(),_a(this,r,null,"f")),La(this,l,"f")&&(document.removeEventListener("visibilitychange",La(this,l,"f")),_a(this,l,null,"f"))},y;function v(e){throw m({level:Pt,code:"MODULE_BUILDER/FAILED_TO_BUILD_MODULE",message:e}),Error(e)}}}const ka=s({get:()=>new wa}),Pa=e=>a.createElement(ka.Provider,{value:{get:()=>e.context}},e.children);const $a=s({get(){throw Error("Layout Schema context has not been set")}}),ja=e=>a.createElement($a.Provider,{value:{get:()=>e.context}},e.children),Fa=()=>l($a).get(),Ga=s("ENABLED"),Ma=()=>l(Ga);function Ba(e){const t=Va(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Va(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 Ua={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function Va(e,t=Ua){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 za=s(Ba({}));za.Consumer;const Ha=za.Provider,Wa=e=>{const t=l(za),n=e.split("|");for(const e of n){const n=t(e.trim(),"images");if(n)return n}},qa=()=>l(za),Ka=s({});function Ya({info:e,children:t}){const n=l(Ka);return a.createElement(Ka.Provider,{value:Object.assign(Object.assign({},n),e)},t)}const Ja=s({get(){throw Error("Catalog Item context has not been set")}}),Za=e=>a.createElement(Ja.Provider,{value:{get:()=>e.context}},e.children),Qa=()=>l(Ja).get(),Xa=s(""),eo=()=>l(Xa),to=s(""),no=s(void 0);function io({children:e}){const t=d((()=>{const e=document.createElement("div");return e.inert=!0,{inert:!0===e.inert}}),[]);return a.createElement(no.Provider,{value:t},e)}const ao=P(re([Z,le(Z)]),ce,F(de),F(ue(pe,z({}),_)),de,H({},"value")),oo=P(Z,U("predicates"));function ro(e,t){return`transition: ${t.map((t=>`${t} ${e}ms`)).join(", ")};`}const so=oe(((e,{duration:t,predicates:n,styles:i})=>{return{predicates:n,classname:e(bi(i)),transitionBaseClassname:e(ro(t,(a=i,M(a).flatMap((e=>{const[t,n]=null!=e?e:[];return n&&t?se(n).map((e=>Ln(t,e))):[]})))))};var a})),lo=re([ao,oo]);const co={is:j,"is-not":P(J,j),"is-below":be,"is-above":ge};function uo(e,t){return e.includes(t)}const po={is:j,"is-not":P(J,j),exists:uo,"not-exists":P(J,uo)},yo={exists:P(J,Ie(pe,Z)),"not-exists":Ie(pe,Z)},fo={"is-true":j(!0),"is-false":j(!1)},mo={is:j,"is-not":P(J,j)};function ho(e){return(t,n)=>n[e]}const vo=T([[(e,t)=>j("Breakpoint",e),ho("activeBreakpoint")],[(e,t)=>j("Progression",e),ho("progressionIndex")],[(e,t)=>j("Position",e),ho("positionIndex")]]);function go(e,t){return e.creativeCopy&&"string"==typeof e.creativeCopy[t]?e.creativeCopy[t]:void 0}const bo=T([[j("Breakpoint"),(e,t,n)=>{const i=fe(["breakpoints",t]);return X(ye(i,Number),Ee(i))(n)}],[j("Progression"),(e,t,n)=>T([[ge(0),Se(n.totalGroups)],[Ce(0),_]])(Number(t))],[j("Position"),(e,t,n)=>T([[ge(0),Se(n.totalOffers)],[Ce(0),_]])(Number(t))]]),Io=P(J,isNaN);function Eo(e,t){return e.map((e=>{var n,i,a;switch(e.type){case"StaticString":return(0,mo[e.predicate.condition])(e.predicate.input,e.predicate.value);case"CreativeCopy":return(0,yo[e.predicate.condition])(go(t,e.predicate.value));case"StaticBoolean":return(0,fo[e.predicate.condition])(e.predicate.value);case"CustomState":return(0,co[e.predicate.condition])(null!==(n=t.customStates[e.predicate.key])&&void 0!==n?n:0,e.predicate.value);case"DomainState":return(0,co[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,po[e.predicate.content.condition])(e.predicate.content.input,e.predicate.content.value);case"TextLength":return(0,co[e.predicate.content.condition])(e.predicate.content.input.length,e.predicate.content.value);case"Numeric":return(0,co[e.predicate.content.condition])(Number(e.predicate.content.input),e.predicate.content.value);default:return!1}}(e);default:{const n=co[e.predicate.condition],i=null!==(a=vo(e.type,t))&&void 0!==a?a:NaN,o=bo(e.type,e.predicate.value,t);return!!Io(i)&&n(i,o)}}}))}function So(e){return B(0,["breakpoint","breakpoints",e.breakpoint.activeBreakpoint],e)}const Co={breakpoints:{},activeBreakpoint:NaN,progressionIndex:NaN,positionIndex:NaN,totalOffers:NaN,totalGroups:NaN,creativeCopy:{},customStates:{},domainStates:{}};function wo(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:${go(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:${vo(e.type,t)}:${t.totalGroups}`}}(e,t),o=n.current.get(a);return he(To(o)?{cached:ve(o)}:{uncached:ve({key:a,predicate:e})},i)}(i,n,e,t)),{cached:[],uncached:[]}),s=Eo(r.map((({predicate:e})=>e)),n);return me(r,s).forEach((([{key:t},n])=>{e.current.set(t,n)})),o.concat(s)}const To=V(Boolean);const Oo=oe(((e,t,n)=>{var i,a,o,r,s,l;return{breakpoints:n.breakpoint.breakpoints,activeBreakpoint:So(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}})),xo=fe(["predicate","content","input"]),Ao=fe(["predicate","content","value"]),No=fe(["predicate","key"]);function Lo(e,t){const n=ye(xo,(t=>t?e(t):"")),i=ye(Ao,(t=>"string"==typeof t?e(t):t)),a=P(n,i),o=ye(No,(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 _o=le(j(!0));function Ro(e){const t=ua(),n=ya(),i=r(new Map),a=Bi(),o=_i(Co,Oo(n,a)),s=sa();return d((()=>K((e=>{const n=Lo(s,e);return _o(wo(i,n,o,t))}),e)),[i,e,o,t,s])}function Do(e){e&&(e.style.display="")}function ko(e){e&&(e.style.display="none")}function Po(e){return e.settings.duration}const $o=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],jo=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function Fo(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const i=t?$o:jo,a=e.animate(i,{duration:n,iterations:1});return a.onfinish=()=>{t?Do(e):ko(e)},a.oncancel=()=>{t?Do(e):ko(e)},()=>{a.finish()}}return t?Do(e):ko(e),()=>{}}function Go({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)Fo(e,t,n)}(l.current,n,Po(e),e.type)})):!n&&t?t.forEach((e=>{l.current&&function(e,t,n,i){if("FadeOut"===i)Fo(e,t,n)}(l.current,n,Po(e),e.type)})):()=>{}),[n]),a.createElement("div",{ref:l,style:{display:"none"},className:s},i)}function Mo(e){const t=ki(),n=function(e){const t=ua(),n=ya(),i=r(new Map),a=Bi(),o=_i(Co,Oo(n,a)),s=Lo(sa(),e);return d((()=>_o(wo(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(Go,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:n},i):"functionally"===e.schema.hide?a.createElement(Ga.Provider,{value:n?"ENABLED":"DISABLED"},i):n?a.createElement(a.Fragment,null,i):null}const Bo=we(((e,t)=>`${e||""} ${t||""}`.trim())),Uo=e=>{var t;const n=l(la),i=ya(),a=ji()||document.head,o=eo(),r=Ci(o,i,a),s=u(Ti,[]),c=_i([],(e=>Object.values(e.breakpoint.breakpoints))),d=n||s(c,o,i,a),p=e.styles?d(e.styles):{},y=e.styles&&e.styles.conditionalTransitions?function(e,t){const n=so(e);return K((e=>lo(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,f=Ro(y?K(H([],"predicates"),y):{}),m=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}(y,t):void 0),f),h=y?K(U("transitionBaseClassname"),y):{},v=e.styles?(g=h,Bo(Bo(p,m),g)):void 0;var g;return e.children({classnames:v,mapperRef:d})};function Vo(e){const t=ki();return a.createElement(Uo,{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 zo(e){const t=ki();return a.createElement(Uo,{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 Ho={allowedTags:["em","strong","a","br","u","p","li","ul","ol","s"],allowedAttributes:{a:["href","target",gn,bn],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],s:[]},allowedSchemes:["http","https"]},Wo=new Map([["&","_;^;_"]]),qo=new RegExp(`<a *(?=${Ho.allowedAttributes.a.join("|")}|>)`,"g"),Ko=new RegExp('<a [^>]*href="([^"]+)"',"g"),Yo=new RegExp("(<br *?>)|(<br *?/>)","g"),Jo="<br/>";function Zo(e){const t=sa(),n=Ma(),i=d((()=>{const n=t(e.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Ko,((e,t)=>{const n=t.replaceAll("&",Wo.get("&"));return e.replace(t,n)})).replaceAll(Yo,Jo)}(e);return t===vt(t,Ho)}(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(Uo,{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(qo,`<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(qo,`<a ${n.join(" ")}`)}});var l})):null}function Qo(e){const t=sa()(e.schema.value),n=Ma(),{tabIndex:i,styles:o,isDisabled:r}=St(n);return t?a.createElement(Uo,{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 Xo(e,t,n){if("BasicText"===e.type)return a.createElement(Qo,{schema:e.node,testId:t,isInline:null!=n&&n})}function er(e,t,n){return a.Children.toArray(e.map(((e,i)=>t(e,void 0,Kt(i,n)))))}function tr(e){const t=Ni(),n=ki(),i=Mi(),r=sa(),s=ya(),l=Ma(),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:y,isDisabled:f}=St(l);return Ot(c)&&!d&&void 0!==s?a.createElement(Uo,{styles:e.schema.styles},(({classnames:o,mapperRef:r})=>{var s;return a.createElement("button",{type:"button",tabIndex:p,"aria-disabled":f,"aria-label":null!==(s=e.schema.a11yLabel)&&void 0!==s?s:void 0,style:Object.assign({cursor:"pointer"},y),"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(Tt(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:f},a.createElement(ra,{value:u},(null==o?void 0:o.own)?function(e,t,n,i,o){return a.createElement(ca,{value:n(t)},er(e,i,o))}(e.schema.children,o.own,r,n,e.testId):er(e.schema.children,n,e.testId)))})):null}function nr(e){const t=Ma(),{styles:n,isDisabled:i}=St(t);return e.schema.url.light?a.createElement(Uo,{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 ir(e){const t=Ma(),{styles:n,isDisabled:i}=St(t),o=Wa(e.schema.imageKey);return null!=(r=o)&&"object"==typeof r&&"light"in r&&"string"==typeof r.light?a.createElement(Uo,{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 ar={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function or(e){const t=e.schema.name,n=e.schema.description,i=e.schema.styles?Wt(ar,e.schema.styles):ar,o=Ma(),{styles:r,isDisabled:s}=St(o);return t?a.createElement(Uo,{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 rr={backgroundColor:"#FFEEEE",color:"#FF0000",fontSize:"10px",padding:"4px",border:"1px solid #FF0000",margin:0,whiteSpace:"normal"};class sr 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"===Tn.REPORT_RENDER_ERRORS&&this.props.reporter({level:Pt,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"===Tn.DISPLAY_ERRORS?a.createElement("pre",{style:rr},a.createElement("strong",null,"Error:")," [",a.createElement("em",null,this.props.schema.type),"]"," ",this.state.errorMessage):void 0:this.props.children}}sr.contextType=Ka;const lr={internally:"_top",externally:"_blank"};function cr(e,t,n){return a.Children.toArray(e.map(((e,i)=>t(e,void 0,n?`${n}-child${i}`:void 0))))}function dr(e){var t;const n=lr[e.schema.open],i=ki(),o=Ma(),{tabIndex:r,styles:s,isDisabled:l}=St(o);return(null===(t=e.schema.children)||void 0===t?void 0:t.length)>0?a.createElement(Uo,{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(ca,{value:n(t)},cr(e,i,o))}(e.schema.children,null==t?void 0:t.own,o,i,e.testId):cr(e.schema.children,i,e.testId))})):null}function ur(e,t,n){if("StaticLink"===e.type)return a.createElement(dr,{schema:e.node,testId:t,isInline:null!=n&&n})}const pr={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function yr(e){const t=(n=e.schema.iconKey,l(za)(n,"icons"));var n;const i=null==t?void 0:t.name,o=e.schema.styles?Wt(pr,e.schema.styles):pr,r=Ma(),{styles:s}=St(r);return i?a.createElement(Uo,{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 fr=Be`
2
2
  display: flex;
3
3
  position: relative;
4
4
  overflow: hidden;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokt/dcui-orchestrator",
3
- "version": "0.2.1-rc.49",
3
+ "version": "0.2.1-rc.50",
4
4
  "description": "Rokt's DCUI rendering process",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",