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