@rokt/dcui-orchestrator 0.2.1-rc.12 → 0.2.1-rc.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("react-dom/client"),a=require("react-redux"),i=require("ramda"),o=require("@emotion/css"),r=require("redux-saga/effects"),s=require("@reduxjs/toolkit"),l=require("redux-saga"),c=require("@redux-saga/core/effects"),d=require("embla-carousel-react"),u=require("insane"),p=require("@emotion/css/create-instance");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 S(e){return I(e)&&"Url"===e.action}function x(e){return I(e)&&"ExternalPaymentTrigger"===e.action}function C(e){return(E(e)||S(e))&&"RealTime"===e.conversionType&&"rclid"in e}function w(e){return(E(e)||S(e))&&"RealTimeReferral"===e.conversionType&&"rclid"in e}const O={pluginId:"shared",pageInstanceGuid:"N/A"};var T;!function(e){e.DCUI="DCUI",e.Partner="partner"}(T||(T={}));const A=["SignalCartItemQuantitySelected","SignalProductItemResponse"],j="ERROR",R="WARNING";class N extends Error{constructor(e,t){super(t),this.code=null!=e?e:"UNHANDLED_EXCEPTION"}toString(){return`CodedError (${this.code}): ${this.message}`}}const L=["V2_CART_ITEM_UPDATED","CART_ITEM_INSTANT_PURCHASE","OFFER_ENGAGEMENT","POSITIVE_ENGAGEMENT","UPSELL_CREATIVE_SENT","REALTIME_OFFER_FULFILLMENT_REFERRAL","REALTIME_OFFER_FULFILLMENT_CONVERSION","REALTIME_OFFER_FULFILLMENT_SUCCESS","INITIATE_INSTANT_PURCHASE_EVENT","PLACEMENT_CLOSED","PLACEMENT_COMPLETED","PLACEMENT_INTERACTIVE","PLACEMENT_FAILURE"];const D=(e,t)=>i.concat(e,i.slice(e.length,t.length,t)),_=(e,t)=>{if(Array.isArray(e)&&Array.isArray(t)){const n=e.length>t.length?D(t,e):t,a=t.length>e.length?D(e,t):e;return i.zipWith(G,a,n)}return t},k=e=>null==e,P=e=>!k(e),$=(e,t)=>k(t)?e:t,F=(e,t)=>{throw new N("MERGE_TYPE_INCONSISTENCY",`Unable to merge values for inconsistent types, left = ${e}, right = ${t}`)};function G(e,t){return i.cond([[(e,t)=>i.type(e)!==i.type(t)&&P(e)&&P(t),F],[(e,t)=>k(e)||k(t),$],[(e,t)=>"Object"===i.type(e),i.mergeDeepWith(G)],[(e,t)=>"Array"===i.type(e),_],[i.T,i.flip(i.unary(i.identity))]])(e,t)}function M(e,t){return G(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 x(e)}function W(e){return S(e)}function K(e){return function(e){return I(e)&&"CaptureOnly"===e.action}(e)}function Y(e){return!!(C(e)||"responseOption"in e&&C(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}function J(e){return!!(w(e)||"responseOption"in e&&w(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}const Z="GLOBAL/RAISE_SIGNAL",Q="GLOBAL/OFFER_LIFECYCLE",X="GLOBAL/SET_CUSTOM_STATE",ee="GLOBAL/SEND_PARTNER",te="GLOBAL/SET_DOMAIN_STATE",ne="GLOBAL/PREPARE_SIGNAL",ae="GLOBAL/OPEN_LINK",ie="GLOBAL/SET_PARTNER_VALIDATION_STATUS",oe="GLOBAL/SET_GLOBAL_OFFER_DATA_CART",re="GLOBAL/LAUNCH_CHILD_LAYOUT",se={RAISE_METRIC:V,PREPARE_SIGNAL:ne,OFFER_ENGAGEMENT:z,RAISE_SIGNAL:Z,OFFER_LIFECYCLE:Q,SEND_PARTNER:ee,SET_CUSTOM_STATE:X,SET_DOMAIN_STATE:te,OPEN_LINK:ae,SET_PARTNER_VALIDATION_STATUS:ie,SET_GLOBAL_OFFER_DATA_CART:oe,LAUNCH_CHILD_LAYOUT:re},le="data-open-in-app",ce="data-click-signal-context";function de(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(ce);if(i&&n({type:Z,payload:{name:"SignalUserInteraction",action:"Click",context:i}}),t){e.preventDefault();let i="newTab";a.hasAttribute(le)&&(i="inApp"),n({type:ae,payload:{url:t,urlBehaviour:i}})}}}t.useEffect((()=>null!==e?(e.addEventListener("click",a),()=>{e.removeEventListener("click",a)}):()=>{}),[e])}function ue(){const e=t.useRef(null);return t.useEffect((()=>{const t=t=>{"Tab"===t.key&&pe(t,e)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)}),[e]),e}const pe=(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()},fe=i.sortBy(i.prop(1)),ye=i.map(i.prop(0)),he="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DISPLAY_ERRORS:"true",REPORT_RENDER_ERRORS:"true",USE_MEDIA_QUERY_NESTING:"true"};function me(e,t){return t?"false"!==he.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 ve={hovered:":hover",pressed:":active",focussed:":focus",disabled:":disabled"};function ge(e){return function(e){return Object.keys(ve).indexOf(e)>-1}(e)?ve[e]:""}const be={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 Ie(e,t){if(!be[e]||!be[e][t])throw new Error(`No CSS property mapping exists for styling property: ${e}.${t.toString()}`);return be[e][t]}function Ee(e,t){return n=>t(...Object.keys(e).map((t=>e[t](n[t]))))}function Se(...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 xe(e,t){return`${e}:${t};`}function Ce(e){return function(e,t){return`@media (${e}) {${t}}\n`}("prefers-color-scheme: dark",e)}class we extends Error{constructor(e,t){super(`Invalid styling value '${t}': ${e}.`),this.name=this.constructor.name}}function Oe(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 we(n,JSON.stringify(t));return!0}function Te(e){if(isNaN(e)||"number"!=typeof e&&"string"!=typeof e)return"value must be a number"}function Ae(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 je(e){if(null==e||""===e)return"value must not be omitted"}function Re(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 Ne(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 Le(e){if(null!=e&&""!==e)return"value must not be specified"}function De(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 _e(...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||Te(t)),void 0))return}}return`value must be a space separated list of numbers, of one of the following lengths: ${e.join(" ,")}`}}function ke(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 Pe(e){if("string"!=typeof e)return"value must be a string"}const $e=i.is(Object);function Fe(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 Ge(e){if("number"!=typeof e&&"string"!=typeof e||isNaN(e)||!(e>=0))return"value must be a positive number"}function Me(e,t,n){return Oe(Te,n)?xe(Ie(e,t),`${n}`):""}function Be(e){return(t,n,a)=>Oe(Ae(Object.keys(e)),a)?xe(Ie(t,n),`${e[a]}`):""}function Ue(e){return Oe(je,e)?Ee({light:t(Ne,!1),dark:t(ke(Le,Ne),!0)},Se("\n "))(e):"";function t(e,t){return n=>{if(Oe(e,n)&&n){const e=xe("background-image",`url("${n}")`);return t?Ce(e):e}return""}}}function Ve(e){const t={crop:"auto",fit:"contain",fill:"cover"};return"string"==typeof e&&(e=e.toLowerCase()),Oe(ke(Le,Ae(Object.keys(t))),e)&&e?xe("background-size",t[e]):""}const ze=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 qe(e){const t="string"==typeof e?e.toLowerCase():e;return Oe(ke(Le,Ae(["top","right","bottom","left","center","top-left","top-right","bottom-left","bottom-right"])),t)&&t?xe("background-position",ze(t)):""}function He(e,t,n){return Oe(ke(Te,_e(2,3,4)),n)?xe(Ie(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function We(e){return(t,n,a)=>Oe(De({fit:Ae(e),percentage:Te,fixed:Te}),a)?xe(Ie(t,n),Ke(a)):""}function Ke(e){const t={"wrap-content":"fit-content","fit-width":"100%","fit-height":"100%"};switch(e.type){case"fixed":return`${e.value}px`;case"percentage":return`${e.value}%`;case"fit":return t[e.value]}}const Ye=Fe({light:Re,dark:ke(Le,Re)});function Je(e,t,n){return a=>{if(a){const i=xe(Ie(e,t),Qe(String(a)));return n?Ce(i):i}return""}}function Ze(e,t,n){return Oe(Ye,n)?Ee({light:Je(e,t,!1),dark:Je(e,t,!0)},Se("\n "))(n):""}function Qe(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 Xe=Fe({offsetX:ke(Le,Te),offsetY:ke(Le,Te),blurRadius:ke(Le,Te),spreadRadius:ke(Le,Te),color:Ye}),et=e=>t=>null!=t?String(t):e,tt=i.compose(i.concat(i.__,"px"),et("0")),nt=e=>t=>"string"==typeof t?e(t):t,at=i.compose(nt(i.concat(i.__,"px")),et(void 0)),it=i.compose(nt(Qe),i.prop("dark"));function ot(e,t,n){return xe(e,Ee({offsetX:tt,offsetY:tt,blurRadius:t.spreadRadius?tt:at,spreadRadius:at,color:n},Se(" "))(t))}const rt={center:"center","flex-end":"flex-end","flex-start":"flex-start",stretch:"stretch"},st={container:{justifyContent:Be(rt),alignItems:Be(rt),shadow:function(e,t,n){var a,o,r;if(Oe(Xe,n)){const s=Ie(e,t);return Se("\n")(ot(s,n,(o="light",r="#80000000",i.compose(Qe,i.propOr(r,o)))),(null===(a=n.color)||void 0===a?void 0:a.dark)?Ce(ot(s,n,it)):"")}return""},gap:He,overflow:Be({hidden:"hidden",visible:"visible"}),blur:function(e,t,n){return Oe(Ge,n)?xe(Ie(e,t),`blur(${n.toString()}px)`):""},opacity:Me},text:{textColor:Ze,fontSize:He,fontFamily:function(e,t,n){return Oe(Pe,n)?xe(Ie(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:Be({100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900}),fontStyle:Be({normal:"normal",italic:"italic"}),lineHeight:He,lineLimit:function(e,t,n){return Oe(Te,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:He,baselineTextAlign:Be({super:"super",sub:"sub",baseline:"baseline"}),horizontalTextAlign:Be({left:"left",right:"right",center:"center",start:"start",end:"end",justify:"justify"}),textDecoration:Be({underline:"underline","strike-through":"line-through",none:"none"}),textTransform:Be({capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",none:"none"})},background:{backgroundColor:Ze,backgroundImage:function(e,t,n){return Oe(je,n)?Ee({url:Ue,position:qe,scale:Ve},Se)(n):""}},dimension:{width:We(["wrap-content","fit-width"]),maxWidth:He,minWidth:He,height:We(["wrap-content","fit-height"]),maxHeight:He,minHeight:He,rotateZ:(lt="Z",(e,t,n)=>{const a=`rotate${lt}`;return Oe(Te,n)?xe(Ie(e,t),`${a}(${n.toString()}deg)`):""})},flexChild:{alignSelf:Be(rt),weight:Me,order:Me},spacing:{margin:He,padding:He,offset:function(e,t,n){return Oe(_e(2),n)?`transform:translate(${n.split(" ").join("px, ")}px)`:""}},border:{borderColor:Ze,borderRadius:He,borderWidth:He,borderStyle:Be({solid:"solid",dashed:"dashed"})}};var lt;function ct(e){return Object.keys(e).reduce(((t,n)=>(n&&e[n]&&Object.keys(e[n]).forEach((a=>{if(!st[n])throw new Error(`No styling transformers exist for styling category key: ${n}`);const i=st[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 dt="FAILED_TEMPLATING_DATA",ut=new Map;function pt(e){return String.fromCharCode(97+e)}function ft(e,t,n){const a=`${e||O.pluginId}-${void 0!==t?String(t):"outer"}`,i=ut.get(a);if(i&&i.sheet.container.isConnected)return i.css;const o=function(e,t){const n={key:void 0!==e?`inner-css-${pt(e)}`:"outer-css",container:t};return t&&t.parentElement&&(n.container=t.parentElement),p(n)}(t,n);return ut.set(a,o),o.css}const yt="%%%OWN_CLASS_REF%%%",ht=i.memoizeWith(((e,t,n,a)=>`${String(e)}-${t}-${n}`),mt);function mt(e,t,n,a){const i=ft(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]:vt(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(yt,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 vt(e,t,n,a,i){return e.map(function(e,t,n){return a=>Object.entries(a).map((([a,i])=>{const o=i?ct(i):"";switch(!0){case"default"===a:return o?`\n${o}\n`:"";case Boolean(e):return`\n .${e}${ge(a)} & {\n${o}\n}\n`;case t&&"own"!==n:return`\n .${yt}${ge(a)} & {\n${o}\n}\n`;default:return`\n &${ge(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:`${me(a,t)}\n`):e}),"")}const gt=t.createContext(i.always(void 0)),bt=()=>t.useContext(gt),It=t.createContext(null);function Et(e,n){var a;const i=t.useContext(It);return i&&null!==(a=n(i))&&void 0!==a?a:e}const St=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")})),xt=St.Consumer,Ct=()=>t.useContext(St),wt=e=>t.createElement(St.Provider,{value:(t,n,a)=>e.value(t,null!=n?n:e.overrides,a)},e.children),Ot=t.createContext(null),Tt=()=>t.useContext(Ot),At=t.createContext({get(){throw Error("Offer context has not been set")}}),jt=e=>t.createElement(At.Provider,{value:{get:()=>e.context}},e.children),Rt=()=>t.useContext(At).get(),Nt=()=>{try{return t.useContext(At).get().creative.copy}catch(e){return}},Lt=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),Dt=i.compose(i.not,i.isEmpty),_t=i.where({url:Dt,title:Dt});function kt(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($t(e,"This Meta Attribute could not be parsed."));return function(e,t,n,a){switch(t){case"openLinks":return function(e,t,n){Pt(t,e,"openLinks",1,2);const a=Ft(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),i=Gt(t,1,(e=>"string"==typeof e&&e.length?e:null));if("InApp"===a)return n.replace(Lt,((e,t)=>`<a ${le} ${i?`${ce}="${i}" `:""}${t}`));return n}(e,n,a);case"sliceText":return function(e,t,n){Pt(t,e,"sliceText",2,2);const a=Ft(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),i=Ft(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($t(e,`Unknown "SliceBy" value. ${a}`))}(e,n,a);default:throw new Error($t(e,`Unknown Meta Attribute '${t}'.`))}}(e,a,o,t)}),n)}function Pt(e,t,n,a,i){const o=new Error($t(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 $t(e,t){return`Malformed Meta Attribute: '${e}' - ${t}`}function Ft(e,t,n,a,i){const o=Gt(e,n,a);if(null!==o)return o;throw Error($t(t,i||`Could not parse meta attribute argument at index ${n} from arguments ${JSON.stringify(e)}`))}function Gt(e,t,n){return n(e[t])}const Mt="DATA",Bt="STATE",Ut=new RegExp(`^(${Mt}|${Bt})`),Vt=new RegExp(`^${Bt}`),zt=new RegExp(`%\\^(?:${Mt}|${Bt})\\.[a-zA-Z0-9]+[a-zA-Z0-9\\.]*(?:\\:[a-zA-Z0-9]+\\[[a-zA-Z0-9\\.,]*\\])*(?:\\|.*?)?\\^%`,"g"),qt=Symbol("invalid");function Ht(e,t="creativeCopy"){const n=Wt({data:e},t);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Wt(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(Ut.test(t)){if(!this.dataMap.has(t)&&Vt.test(t))throw new N(dt,`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===qt)throw new N(dt,`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=kt(a[0],a.slice(1),n)}catch(e){throw new N(dt,`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(zt,r,o);return!1===a?s:""}.bind({dataMap:n})}function Wt(e,t,n){const a=new Map(n);return"data"in e&&o(e.data,`${Mt}${t?"."+t:""}`),"state"in e&&o(e.state,`${Bt}${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,qt),e&&"object"==typeof e&&i.forEachObjIndexed(((e,n)=>o(e,`${t}.${n}`)),e)}}const Kt=t.createContext(Ht({})),Yt=Kt.Consumer,Jt=Kt.Provider,Zt=()=>t.useContext(Kt),Qt=t.createContext(null),Xt=Qt.Provider,en=t.createContext("OUTER"),tn=()=>"VARIANT"===t.useContext(en),nn=t.createContext(void 0),an=()=>t.useContext(nn);var on,rn,sn,ln,cn,dn,un=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())}))},pn=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},fn=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 yn{constructor(e,t,n,a,o){on.set(this,void 0),rn.set(this,void 0),sn.set(this,new Set),ln.set(this,void 0),cn.set(this,void 0),dn.set(this,void 0),pn(this,on,i.partial(e.subscribe.bind(e),[n]),"f"),pn(this,rn,i.partial(e.dispatch.bind(e),[n]),"f"),pn(this,ln,t,"f"),pn(this,cn,a,"f"),pn(this,dn,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=fn(this,on,"f").call(this,e),n=()=>{t(),fn(this,sn,"f").delete(n)};return fn(this,sn,"f").add(n),n}onInteractivityChange(e){return fn(this,cn,"f").subscribe(e)}onEvent(...e){const t=e.reduce(((e,t)=>{if("partner"===t.source||"*"===t.source){const n=fn(this,dn,"f").call(this,t.name).subscribe(t.callback);return[...e,()=>n.unsubscribe()]}return e}),[]),n=()=>{t.forEach((e=>{e()})),fn(this,sn,"f").delete(n)};return fn(this,sn,"f").add(n),n}globalDispatch(e){fn(this,rn,"f").call(this,e)}dispose(){fn(this,sn,"f").forEach((e=>e())),pn(this,sn,new Set,"f"),fn(this,cn,"f").clear()}createChildPlugin(e){return fn(this,ln,"f").call(this,e)}}on=new WeakMap,rn=new WeakMap,sn=new WeakMap,ln=new WeakMap,cn=new WeakMap,dn=new WeakMap;class hn{onGlobalStateChange(){return()=>{}}onInteractivityChange(){return()=>{}}onEvent(){return()=>{}}globalDispatch(){}dispose(){}createChildPlugin(){return{close:()=>un(this,void 0,void 0,(function*(){})),onClose:()=>un(this,void 0,void 0,(function*(){})),putConfig:()=>un(this,void 0,void 0,(function*(){})),send:()=>un(this,void 0,void 0,(function*(){})),onEvent:()=>({subscribe:()=>({unsubscribe:()=>{}})})}}}var mn,vn,gn=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},bn=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 In{constructor(e){mn.set(this,void 0),vn.set(this,new Set),gn(this,mn,e,"f")}subscribe(e){return bn(this,vn,"f").add(e),!0===e(bn(this,mn,"f"))&&bn(this,vn,"f").delete(e),()=>{bn(this,vn,"f").delete(e)}}publish(e){gn(this,mn,e,"f"),bn(this,vn,"f").forEach((e=>{!0===e(bn(this,mn,"f"))&&bn(this,vn,"f").delete(e)}))}clear(){bn(this,vn,"f").clear()}}mn=new WeakMap,vn=new WeakMap;var En=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)},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};const xn="breakpoint-0px";class Cn{constructor(){this.logger=()=>{}}withAppFactory(e){return this.appFactory=e,this}withLogger(e){return this.logger=e,this}withGatewayFactory(e){return this.gatewayFactory=e,this}build(){var e,t,n,a,i,o,r,s,l,c,d,u,p,f;const y=this.appFactory,h=this.logger,m=null!==(e=this.gatewayFactory)&&void 0!==e?e:()=>new hn;return f=class extends HTMLElement{static get observedAttributes(){return["visible","interactivity","active-breakpoint"]}constructor(){super(),t.add(this),n.set(this,(()=>null)),a.set(this,(()=>null)),i.set(this,void 0),o.set(this,!1),r.set(this,null),s.set(this,null),l.set(this,null);const e=this.attachShadow({mode:"open"});Sn(this,i,document.createElement("div"),"f"),En(this,i,"f").id="app-container",En(this,i,"f").classList.add("default"),e.appendChild(En(this,i,"f"))}attributeChangedCallback(e,i,o){if(o!==i)switch(e){case"visible":En(this,n,"f").call(this,"true"===o);break;case"interactivity":"ENABLED"!==o&&"DISABLED"!==o||En(this,a,"f").call(this,o);break;case"active-breakpoint":En(this,t,"m",c).call(this,o,i)}}makeInteractivityUpdateHandler(e){Sn(this,a,(t=>{e.publish(t)}),"f")}makeVisbilityUpdateHandler(e,a,i){const o="true"===this.getAttribute("visible"),r=this.getAttribute("slotInstanceGuid");Sn(this,n,(o=>{o?(Sn(this,n,(()=>null),"f"),0===e&&i.globalDispatch({type:Q,payload:{event:"Interactive"}}),a&&(i.globalDispatch({type:Z,payload:{name:"SignalImpression",parentGuid:a}}),this.trackViewability(a,i)),r&&i.globalDispatch({type:Z,payload:{name:"SignalImpression",parentGuid:r}})):En(this,t,"m",p).call(this)}),"f"),En(this,n,"f").call(this,o)}trackViewability(e,n){if(!En(this,o,"f"))if("IntersectionObserver"in window&&!En(this,r,"f")){const a=()=>{En(this,o,"f")||(n.globalDispatch({type:Z,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!0}}),Sn(this,o,!0,"f"),En(this,t,"m",p).call(this),En(this,i,"f").removeEventListener("click",a))};En(this,i,"f").addEventListener("click",a),Sn(this,r,new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=.5?En(this,t,"m",u).call(this,(()=>{En(this,o,"f")||(n.globalDispatch({type:Z,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!1}}),Sn(this,o,!0,"f"),En(this,t,"m",p).call(this),En(this,i,"f").removeEventListener("click",a))})):En(this,t,"m",d).call(this)}))}),{threshold:.5}),"f"),Sn(this,l,(()=>{var e,n;"visible"===document.visibilityState?null===(e=En(this,r,"f"))||void 0===e||e.observe(En(this,i,"f")):(En(this,t,"m",d).call(this),null===(n=En(this,r,"f"))||void 0===n||n.disconnect())}),"f"),document.addEventListener("visibilitychange",En(this,l,"f")),En(this,l,"f").call(this)}else n.globalDispatch({type:Z,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!1,inferred:!1}}),Sn(this,o,!0,"f")}getOfferPositionAttr(){const e=this.getAttribute("offerPositionIndex"),t=Number(e);return(null==e||isNaN(t)||t<0)&&v(`Offer position attribute (${e}) is invalid`),t}getJSONAttr(e,t="{}"){const n=this.getAttribute(e);try{return JSON.parse(null!=n?n:t)}catch(t){v(`Invalid JSON attribute ${e}: ${n}`)}}disconnectedCallback(){En(this,t,"m",p).call(this)}connectedCallback(){var e,t,n;const a=this.getAttribute("container"),o=this.getAttribute("plugin-id");En(this,i,"f").setAttribute("style","width:100%;display:flex;flex-direction:"+("column"===a?"column":"row"));const r=this.getOfferPositionAttr(),s=this.getJSONAttr("layoutSchema"),l=this.getJSONAttr("childLayouts","[]"),c=this.getJSONAttr("offerData"),d=new In("DISABLED"===this.getAttribute("interactivity")?"DISABLED":"ENABLED"),u=null!==(e=this.getAttribute("schemaVersion"))&&void 0!==e?e:"",p=this.getJSONAttr("offerState","{}");y||v("Cannot create app without factory. Please build the connector withAppFactory.");const f=m({offerPositionIndex:r,creativeInstanceGuid:null===(t=null==c?void 0:c.creative)||void 0===t?void 0:t.instanceGuid},d);this.makeInteractivityUpdateHandler(d),y({rootElement:En(this,i,"f"),gateway:f,logger:h,offerPositionIndex:r,offerData:c,layoutSchema:s,childLayouts:l,schemaVersion:u,pluginId:o||O.pluginId,offerState:p}),this.makeVisbilityUpdateHandler(r,null===(n=null==c?void 0:c.creative)||void 0===n?void 0:n.instanceGuid,f)}},n=new WeakMap,a=new WeakMap,i=new WeakMap,o=new WeakMap,r=new WeakMap,s=new WeakMap,l=new WeakMap,t=new WeakSet,c=function(e,t){En(this,i,"f").classList.remove(t||xn),En(this,i,"f").classList.add(e||xn)},d=function(){En(this,s,"f")&&(clearTimeout(En(this,s,"f")),Sn(this,s,null,"f"))},u=function(e){En(this,t,"m",d).call(this),Sn(this,s,window.setTimeout(e,1e3),"f")},p=function(){En(this,t,"m",d).call(this),En(this,r,"f")&&(En(this,r,"f").disconnect(),Sn(this,r,null,"f")),En(this,l,"f")&&(document.removeEventListener("visibilitychange",En(this,l,"f")),Sn(this,l,null,"f"))},f;function v(e){throw h({level:j,code:"MODULE_BUILDER/FAILED_TO_BUILD_MODULE",message:e}),Error(e)}}}const wn=t.createContext({get:()=>new hn}),On=e=>t.createElement(wn.Provider,{value:{get:()=>e.context}},e.children);const Tn=t.createContext({get(){throw Error("Layout Schema context has not been set")}}),An=e=>t.createElement(Tn.Provider,{value:{get:()=>e.context}},e.children),jn=()=>t.useContext(Tn).get(),Rn=t.createContext("ENABLED"),Nn=()=>t.useContext(Rn);function Ln(e){const t=_n(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:_n(t,this.dataMap)});if(!n)throw new N("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 Dn={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function _n(e,t=Dn){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 kn=t.createContext(Ln({}));kn.Consumer;const Pn=kn.Provider,$n=()=>t.useContext(kn),Fn=t.createContext({});function Gn({info:e,children:n}){const a=t.useContext(Fn);return t.createElement(Fn.Provider,{value:Object.assign(Object.assign({},a),e)},n)}const Mn=t.createContext({get(){throw Error("Catalog Item context has not been set")}}),Bn=e=>t.createElement(Mn.Provider,{value:{get:()=>e.context}},e.children),Un=()=>t.useContext(Mn).get(),Vn=t.createContext(""),zn=()=>t.useContext(Vn),qn=t.createContext(""),Hn=t.createContext(void 0);function Wn({children:e}){const n=t.useMemo((()=>{const e=document.createElement("div");return e.inert=!0,{inert:!0===e.inert}}),[]);return t.createElement(Hn.Provider,{value:n},e)}const Kn=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")),Yn=i.compose(i.isEmpty,i.prop("predicates"));function Jn(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(ct(a)),transitionBaseClassname:e(Jn(t,(o=a,i.toPairs(o).flatMap((e=>{const[t,n]=null!=e?e:[];return n&&t?i.keys(n).map((e=>Ie(t,e))):[]})))))};var o})),Qn=i.anyPass([Kn,Yn]);const Xn={is:i.equals,"is-not":i.compose(i.not,i.equals),"is-below":i.lt,"is-above":i.gt};function ea(e,t){return e.includes(t)}const ta={is:i.equals,"is-not":i.compose(i.not,i.equals),exists:ea,"not-exists":i.compose(i.not,ea)},na={exists:i.compose(i.not,i.either(i.isNil,i.isEmpty)),"not-exists":i.either(i.isNil,i.isEmpty)},aa={"is-true":i.equals(!0),"is-false":i.equals(!1)},ia={is:i.equals,"is-not":i.compose(i.not,i.equals)};function oa(e){return(t,n)=>n[e]}const ra=i.cond([[(e,t)=>i.equals("Breakpoint",e),oa("activeBreakpoint")],[(e,t)=>i.equals("Progression",e),oa("progressionIndex")],[(e,t)=>i.equals("Position",e),oa("positionIndex")]]);function sa(e,t){return e.creativeCopy&&"string"==typeof e.creativeCopy[t]?e.creativeCopy[t]:void 0}const la=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))]]),ca=i.compose(i.not,isNaN);function da(e,t){return e.map((e=>{var n,a,i;switch(e.type){case"StaticString":return(0,ia[e.predicate.condition])(e.predicate.input,e.predicate.value);case"CreativeCopy":return(0,na[e.predicate.condition])(sa(t,e.predicate.value));case"StaticBoolean":return(0,aa[e.predicate.condition])(e.predicate.value);case"CustomState":return(0,Xn[e.predicate.condition])(null!==(n=t.customStates[e.predicate.key])&&void 0!==n?n:0,e.predicate.value);case"DomainState":return(0,Xn[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,ta[e.predicate.content.condition])(e.predicate.content.input,e.predicate.content.value);case"TextLength":return(0,Xn[e.predicate.content.condition])(e.predicate.content.input.length,e.predicate.content.value);case"Numeric":return(0,Xn[e.predicate.content.condition])(Number(e.predicate.content.input),e.predicate.content.value);default:return!1}}(e);default:{const n=Xn[e.predicate.condition],a=null!==(i=ra(e.type,t))&&void 0!==i?i:NaN,o=la(e.type,e.predicate.value,t);return!!ca(a)&&n(a,o)}}}))}function ua(e){return i.pathOr(0,["breakpoint","breakpoints",e.breakpoint.activeBreakpoint],e)}const pa={breakpoints:{},activeBreakpoint:NaN,progressionIndex:NaN,positionIndex:NaN,totalOffers:NaN,totalGroups:NaN,creativeCopy:{},customStates:{},domainStates:{}};function fa(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:${sa(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:${ra(e.type,t)}:${t.totalGroups}`}}(e,t),r=n.current.get(o);return i.evolve(ya(r)?{cached:i.append(r)}:{uncached:i.append({key:o,predicate:e})},a)}(a,n,e,t)),{cached:[],uncached:[]}),l=da(s.map((({predicate:e})=>e)),n);return i.zip(s,l).forEach((([{key:t},n])=>{e.current.set(t,n)})),r.concat(l)}const ya=i.is(Boolean);const ha=i.curry(((e,t,n)=>{var a,i,o,r,s,l;return{breakpoints:n.breakpoint.breakpoints,activeBreakpoint:ua(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}})),ma=i.lensPath(["predicate","content","input"]),va=i.lensPath(["predicate","content","value"]),ga=i.lensPath(["predicate","key"]);function ba(e,t){const n=i.over(ma,(t=>t?e(t):"")),a=i.over(va,(t=>"string"==typeof t?e(t):t)),o=i.compose(n,a),r=i.over(ga,(t=>t?e(t):""));return t.map((e=>{switch(e.type){case"Placeholder":return"TextValue"===e.predicate.type?o(e):n(e);case"CustomState":return r(e);default:return e}}))}const Ia=i.all(i.equals(!0));function Ea(e){const n=tn(),a=an(),o=t.useRef(new Map),r=Nt(),s=Et(pa,ha(a,r)),l=Zt();return t.useMemo((()=>i.mapObjIndexed((e=>{const t=ba(l,e);return Ia(fa(o,t,s,n))}),e)),[o,e,s,n,l])}function Sa(e){e&&(e.style.display="")}function xa(e){e&&(e.style.display="none")}function Ca(e){return e.settings.duration}const wa=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],Oa=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function Ta(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const a=t?wa:Oa,i=e.animate(a,{duration:n,iterations:1});return i.onfinish=()=>{t?Sa(e):xa(e)},i.oncancel=()=>{t?Sa(e):xa(e)},()=>{i.finish()}}return t?Sa(e):xa(e),()=>{}}function Aa({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)Ta(e,t,n)}(r.current,a,Ca(e),e.type)})):!a&&n?n.forEach((e=>{r.current&&function(e,t,n,a){if("FadeOut"===a)Ta(e,t,n)}(r.current,a,Ca(e),e.type)})):()=>{}),[a]),t.createElement("div",{ref:r,style:{display:"none"},className:o},i)}function ja(e){const n=Ct(),a=function(e){const n=tn(),a=an(),i=t.useRef(new Map),o=Nt(),r=Et(pa,ha(a,o)),s=ba(Zt(),e);return t.useMemo((()=>Ia(fa(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(Aa,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:a},i):"functionally"===e.schema.hide?t.createElement(Rn.Provider,{value:a?"ENABLED":"DISABLED"},i):a?t.createElement(t.Fragment,null,i):null}const Ra=i.mergeWith(((e,t)=>`${e||""} ${t||""}`.trim())),Na=e=>{var n;const a=t.useContext(Qt),o=an(),r=Tt()||document.head,s=zn(),l=ft(s,o,r),c=t.useCallback(ht,[]),d=Et([],(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=Ea(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,Ra(Ra(p,h),g)):void 0;var g;return e.children({classnames:v,mapperRef:u})};function La(e){const n=Ct();return t.createElement(Na,{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 Da(e){const n=Ct();return t.createElement(Na,{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 _a={allowedTags:["em","strong","a","br","u","p","li","ul","ol","s"],allowedAttributes:{a:["href","target",le,ce],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],s:[]},allowedSchemes:["http","https"]},ka=new Map([["&","_;^;_"]]),Pa=new RegExp(`<a *(?=${_a.allowedAttributes.a.join("|")}|>)`,"g"),$a=new RegExp('<a [^>]*href="([^"]+)"',"g"),Fa=new RegExp("(<br *?>)|(<br *?/>)","g"),Ga="<br/>";function Ma(e){const n=Zt(),a=Nn(),i=t.useMemo((()=>{const t=n(e.schema.value);if(!function(e){const t=function(e){return e.replaceAll($a,((e,t)=>{const n=t.replaceAll("&",ka.get("&"));return e.replace(t,n)})).replaceAll(Fa,Ga)}(e);return t===u(t,_a)}(t))throw new N("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(Na,{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(Pa,`<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(Pa,`<a ${a.join(" ")}`)}});var l})):null}function Ba(e){const n=Zt()(e.schema.value),a=Nn(),{tabIndex:i,styles:o,isDisabled:r}=m(a);return n?t.createElement(Na,{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 Ua(e,n,a){if("BasicText"===e.type)return t.createElement(Ba,{schema:e.node,testId:n,isInline:null!=a&&a})}function Va(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,U(t,a)))))}function za(e){const n=bt(),a=Ct(),i=Rt(),o=Zt(),r=an(),s=Nn(),l=i.creative.responseOptionsMap[e.schema.responseKey],c=x(l);t.useEffect((()=>{c&&n(function(e){if(e.paymentTriggerConfig)return{type:ne,payload:{criteria:{key:"PAYMENT_OFFER_SELECTED"},signal:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:e.action,externalKey:"PAYMENT_OFFER_SELECTED"}}}};throw new Error(`Invalid External Response: No 'paymentTriggerConfig' found for external response option with instanceGuid: ${e.instanceGuid}`)}(l))}),[l,n,c]);const d=l?o({data:l},"creativeResponse"):o,{tabIndex:u,styles:p,isDisabled:f}=m(s);return I(l)&&!c&&void 0!==r?t.createElement(Na,{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(Jt,{value:d},(null==o?void 0:o.own)?function(e,n,a,i,o){return t.createElement(Xt,{value:a(n)},Va(e,i,o))}(e.schema.children,o.own,r,a,e.testId):Va(e.schema.children,a,e.testId)))})):null}function qa(e){const n=Nn(),{styles:a,isDisabled:i}=m(n);return e.schema.url.light?t.createElement(Na,{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 Ha(e){const n=Nn(),{styles:a,isDisabled:i}=m(n),o=(e=>{const n=t.useContext(kn),a=e.split("|");for(const e of a){const t=n(e.trim(),"images");if(t)return t}})(e.schema.imageKey);return null!=(r=o)&&"object"==typeof r&&"light"in r&&"string"==typeof r.light?t.createElement(Na,{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;var r}const Wa={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function Ka(e){const n=e.schema.name,a=e.schema.description,i=e.schema.styles?M(Wa,e.schema.styles):Wa,o=Nn(),{styles:r,isDisabled:s}=m(o);return n?t.createElement(Na,{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 Ya={backgroundColor:"#FFEEEE",color:"#FF0000",fontSize:"10px",padding:"4px",border:"1px solid #FF0000",margin:0,whiteSpace:"normal"};class Ja 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"===he.REPORT_RENDER_ERRORS&&this.props.reporter({level:j,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"===he.DISPLAY_ERRORS?t.createElement("pre",{style:Ya},t.createElement("strong",null,"Error:")," [",t.createElement("em",null,this.props.schema.type),"]"," ",this.state.errorMessage):void 0:this.props.children}}Ja.contextType=Fn;const Za={internally:"_top",externally:"_blank"};function Qa(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Xa(e){var n;const a=Za[e.schema.open],i=Ct(),o=Nn(),{tabIndex:r,styles:s,isDisabled:l}=m(o);return(null===(n=e.schema.children)||void 0===n?void 0:n.length)>0?t.createElement(Na,{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(Xt,{value:a(n)},Qa(e,i,o))}(e.schema.children,null==n?void 0:n.own,o,i,e.testId):Qa(e.schema.children,i,e.testId))})):null}function ei(e,n,a){if("StaticLink"===e.type)return t.createElement(Xa,{schema:e.node,testId:n,isInline:null!=a&&a})}const ti={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function ni(e){const n=(a=e.schema.iconKey,t.useContext(kn)(a,"icons"));var a;const i=null==n?void 0:n.name,o=e.schema.styles?M(ti,e.schema.styles):ti,r=Nn(),{styles:s}=m(r);return i?t.createElement(Na,{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 ai=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 m(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 h(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)&&"ExternalPaymentTrigger"===e.action}function C(e){return(E(e)||x(e))&&"RealTime"===e.conversionType&&"rclid"in e}function w(e){return(E(e)||x(e))&&"RealTimeReferral"===e.conversionType&&"rclid"in e}const O={pluginId:"shared",pageInstanceGuid:"N/A"};var T;!function(e){e.DCUI="DCUI",e.Partner="partner"}(T||(T={}));const A=["SignalCartItemQuantitySelected","SignalProductItemResponse"],j="ERROR",R="WARNING";class N extends Error{constructor(e,t){super(t),this.code=null!=e?e:"UNHANDLED_EXCEPTION"}toString(){return`CodedError (${this.code}): ${this.message}`}}const L=["V2_CART_ITEM_UPDATED","CART_ITEM_INSTANT_PURCHASE","OFFER_ENGAGEMENT","POSITIVE_ENGAGEMENT","UPSELL_CREATIVE_SENT","REALTIME_OFFER_FULFILLMENT_REFERRAL","REALTIME_OFFER_FULFILLMENT_CONVERSION","REALTIME_OFFER_FULFILLMENT_SUCCESS","INITIATE_INSTANT_PURCHASE_EVENT","PLACEMENT_CLOSED","PLACEMENT_COMPLETED","PLACEMENT_INTERACTIVE","PLACEMENT_FAILURE"];const D=(e,t)=>i.concat(e,i.slice(e.length,t.length,t)),k=(e,t)=>{if(Array.isArray(e)&&Array.isArray(t)){const n=e.length>t.length?D(t,e):t,a=t.length>e.length?D(e,t):e;return i.zipWith(G,a,n)}return t},_=e=>null==e,P=e=>!_(e),$=(e,t)=>_(t)?e:t,F=(e,t)=>{throw new N("MERGE_TYPE_INCONSISTENCY",`Unable to merge values for inconsistent types, left = ${e}, right = ${t}`)};function G(e,t){return i.cond([[(e,t)=>i.type(e)!==i.type(t)&&P(e)&&P(t),F],[(e,t)=>_(e)||_(t),$],[(e,t)=>"Object"===i.type(e),i.mergeDeepWith(G)],[(e,t)=>"Array"===i.type(e),k],[i.T,i.flip(i.unary(i.identity))]])(e,t)}function M(e,t){return G(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 K(e){return function(e){return I(e)&&"CaptureOnly"===e.action}(e)}function Y(e){return!!(C(e)||"responseOption"in e&&C(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}function J(e){return!!(w(e)||"responseOption"in e&&w(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}const Z="GLOBAL/RAISE_SIGNAL",Q="GLOBAL/OFFER_LIFECYCLE",X="GLOBAL/SET_CUSTOM_STATE",ee="GLOBAL/SEND_PARTNER",te="GLOBAL/SET_DOMAIN_STATE",ne="GLOBAL/PREPARE_SIGNAL",ae="GLOBAL/OPEN_LINK",ie="GLOBAL/SET_PARTNER_VALIDATION_STATUS",oe="GLOBAL/SET_GLOBAL_OFFER_DATA_CART",re="GLOBAL/LAUNCH_CHILD_LAYOUT",se={RAISE_METRIC:V,PREPARE_SIGNAL:ne,OFFER_ENGAGEMENT:z,RAISE_SIGNAL:Z,OFFER_LIFECYCLE:Q,SEND_PARTNER:ee,SET_CUSTOM_STATE:X,SET_DOMAIN_STATE:te,OPEN_LINK:ae,SET_PARTNER_VALIDATION_STATUS:ie,SET_GLOBAL_OFFER_DATA_CART:oe,LAUNCH_CHILD_LAYOUT:re},le="data-open-in-app",ce="data-click-signal-context";function de(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(ce);if(i&&n({type:Z,payload:{name:"SignalUserInteraction",action:"Click",context:i}}),t){e.preventDefault();let i="newTab";a.hasAttribute(le)&&(i="inApp"),n({type:ae,payload:{url:t,urlBehaviour:i}})}}}t.useEffect((()=>null!==e?(e.addEventListener("click",a),()=>{e.removeEventListener("click",a)}):()=>{}),[e])}function ue(){const e=t.useRef(null);return t.useEffect((()=>{const t=t=>{"Tab"===t.key&&pe(t,e)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)}),[e]),e}const pe=(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()},fe=i.sortBy(i.prop(1)),ye=i.map(i.prop(0)),me="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DISPLAY_ERRORS:"true",REPORT_RENDER_ERRORS:"true",USE_MEDIA_QUERY_NESTING:"true"};function he(e,t){return t?"false"!==me.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 ve={hovered:":hover",pressed:":active",focussed:":focus",disabled:":disabled"};function ge(e){return function(e){return Object.keys(ve).indexOf(e)>-1}(e)?ve[e]:""}const be={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 Ie(e,t){if(!be[e]||!be[e][t])throw new Error(`No CSS property mapping exists for styling property: ${e}.${t.toString()}`);return be[e][t]}function Ee(e,t){return n=>t(...Object.keys(e).map((t=>e[t](n[t]))))}function xe(...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 Se(e,t){return`${e}:${t};`}function Ce(e){return function(e,t){return`@media (${e}) {${t}}\n`}("prefers-color-scheme: dark",e)}class we extends Error{constructor(e,t){super(`Invalid styling value '${t}': ${e}.`),this.name=this.constructor.name}}function Oe(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 we(n,JSON.stringify(t));return!0}function Te(e){if(isNaN(e)||"number"!=typeof e&&"string"!=typeof e)return"value must be a number"}function Ae(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 je(e){if(null==e||""===e)return"value must not be omitted"}function Re(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 Ne(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 Le(e){if(null!=e&&""!==e)return"value must not be specified"}function De(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 ke(...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||Te(t)),void 0))return}}return`value must be a space separated list of numbers, of one of the following lengths: ${e.join(" ,")}`}}function _e(e,t){return n=>{const a=e(n),i=t(n);if(a&&i)return`one of these must be true: ${a} -OR- ${i}`}}function Pe(e){if("string"!=typeof e)return"value must be a string"}const $e=i.is(Object);function Fe(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 Ge(e){if("number"!=typeof e&&"string"!=typeof e||isNaN(e)||!(e>=0))return"value must be a positive number"}function Me(e,t,n){return Oe(Te,n)?Se(Ie(e,t),`${n}`):""}function Be(e){return(t,n,a)=>Oe(Ae(Object.keys(e)),a)?Se(Ie(t,n),`${e[a]}`):""}function Ue(e){return Oe(je,e)?Ee({light:t(Ne,!1),dark:t(_e(Le,Ne),!0)},xe("\n "))(e):"";function t(e,t){return n=>{if(Oe(e,n)&&n){const e=Se("background-image",`url("${n}")`);return t?Ce(e):e}return""}}}function Ve(e){const t={crop:"auto",fit:"contain",fill:"cover"};return"string"==typeof e&&(e=e.toLowerCase()),Oe(_e(Le,Ae(Object.keys(t))),e)&&e?Se("background-size",t[e]):""}const ze=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 qe(e){const t="string"==typeof e?e.toLowerCase():e;return Oe(_e(Le,Ae(["top","right","bottom","left","center","top-left","top-right","bottom-left","bottom-right"])),t)&&t?Se("background-position",ze(t)):""}function He(e,t,n){return Oe(_e(Te,ke(2,3,4)),n)?Se(Ie(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function We(e){return(t,n,a)=>Oe(De({fit:Ae(e),percentage:Te,fixed:Te}),a)?Se(Ie(t,n),Ke(a)):""}function Ke(e){const t={"wrap-content":"fit-content","fit-width":"100%","fit-height":"100%"};switch(e.type){case"fixed":return`${e.value}px`;case"percentage":return`${e.value}%`;case"fit":return t[e.value]}}const Ye=Fe({light:Re,dark:_e(Le,Re)});function Je(e,t,n){return a=>{if(a){const i=Se(Ie(e,t),Qe(String(a)));return n?Ce(i):i}return""}}function Ze(e,t,n){return Oe(Ye,n)?Ee({light:Je(e,t,!1),dark:Je(e,t,!0)},xe("\n "))(n):""}function Qe(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 Xe=Fe({offsetX:_e(Le,Te),offsetY:_e(Le,Te),blurRadius:_e(Le,Te),spreadRadius:_e(Le,Te),color:Ye}),et=e=>t=>null!=t?String(t):e,tt=i.compose(i.concat(i.__,"px"),et("0")),nt=e=>t=>"string"==typeof t?e(t):t,at=i.compose(nt(i.concat(i.__,"px")),et(void 0)),it=i.compose(nt(Qe),i.prop("dark"));function ot(e,t,n){return Se(e,Ee({offsetX:tt,offsetY:tt,blurRadius:t.spreadRadius?tt:at,spreadRadius:at,color:n},xe(" "))(t))}const rt={center:"center","flex-end":"flex-end","flex-start":"flex-start",stretch:"stretch"},st={container:{justifyContent:Be(rt),alignItems:Be(rt),shadow:function(e,t,n){var a,o,r;if(Oe(Xe,n)){const s=Ie(e,t);return xe("\n")(ot(s,n,(o="light",r="#80000000",i.compose(Qe,i.propOr(r,o)))),(null===(a=n.color)||void 0===a?void 0:a.dark)?Ce(ot(s,n,it)):"")}return""},gap:He,overflow:Be({hidden:"hidden",visible:"visible"}),blur:function(e,t,n){return Oe(Ge,n)?Se(Ie(e,t),`blur(${n.toString()}px)`):""},opacity:Me},text:{textColor:Ze,fontSize:He,fontFamily:function(e,t,n){return Oe(Pe,n)?Se(Ie(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:Be({100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900}),fontStyle:Be({normal:"normal",italic:"italic"}),lineHeight:He,lineLimit:function(e,t,n){return Oe(Te,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:He,baselineTextAlign:Be({super:"super",sub:"sub",baseline:"baseline"}),horizontalTextAlign:Be({left:"left",right:"right",center:"center",start:"start",end:"end",justify:"justify"}),textDecoration:Be({underline:"underline","strike-through":"line-through",none:"none"}),textTransform:Be({capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",none:"none"})},background:{backgroundColor:Ze,backgroundImage:function(e,t,n){return Oe(je,n)?Ee({url:Ue,position:qe,scale:Ve},xe)(n):""}},dimension:{width:We(["wrap-content","fit-width"]),maxWidth:He,minWidth:He,height:We(["wrap-content","fit-height"]),maxHeight:He,minHeight:He,rotateZ:(lt="Z",(e,t,n)=>{const a=`rotate${lt}`;return Oe(Te,n)?Se(Ie(e,t),`${a}(${n.toString()}deg)`):""})},flexChild:{alignSelf:Be(rt),weight:Me,order:Me},spacing:{margin:He,padding:He,offset:function(e,t,n){return Oe(ke(2),n)?`transform:translate(${n.split(" ").join("px, ")}px)`:""}},border:{borderColor:Ze,borderRadius:He,borderWidth:He,borderStyle:Be({solid:"solid",dashed:"dashed"})}};var lt;function ct(e){return Object.keys(e).reduce(((t,n)=>(n&&e[n]&&Object.keys(e[n]).forEach((a=>{if(!st[n])throw new Error(`No styling transformers exist for styling category key: ${n}`);const i=st[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 dt="FAILED_TEMPLATING_DATA",ut=new Map;function pt(e){return String.fromCharCode(97+e)}function ft(e,t,n){const a=`${e||O.pluginId}-${void 0!==t?String(t):"outer"}`,i=ut.get(a);if(i&&i.sheet.container.isConnected)return i.css;const o=function(e,t){const n={key:void 0!==e?`inner-css-${pt(e)}`:"outer-css",container:t};return t&&t.parentElement&&(n.container=t.parentElement),p(n)}(t,n);return ut.set(a,o),o.css}const yt="%%%OWN_CLASS_REF%%%",mt=i.memoizeWith(((e,t,n,a)=>`${String(e)}-${t}-${n}`),ht);function ht(e,t,n,a){const i=ft(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]:vt(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(yt,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 vt(e,t,n,a,i){return e.map(function(e,t,n){return a=>Object.entries(a).map((([a,i])=>{const o=i?ct(i):"";switch(!0){case"default"===a:return o?`\n${o}\n`:"";case Boolean(e):return`\n .${e}${ge(a)} & {\n${o}\n}\n`;case t&&"own"!==n:return`\n .${yt}${ge(a)} & {\n${o}\n}\n`;default:return`\n &${ge(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:`${he(a,t)}\n`):e}),"")}const gt=t.createContext(i.always(void 0)),bt=()=>t.useContext(gt),It=t.createContext(null);function Et(e,n){var a;const i=t.useContext(It);return i&&null!==(a=n(i))&&void 0!==a?a:e}const xt=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")})),St=xt.Consumer,Ct=()=>t.useContext(xt),wt=e=>t.createElement(xt.Provider,{value:(t,n,a)=>e.value(t,null!=n?n:e.overrides,a)},e.children),Ot=t.createContext(null),Tt=()=>t.useContext(Ot),At=t.createContext({get(){throw Error("Offer context has not been set")}}),jt=e=>t.createElement(At.Provider,{value:{get:()=>e.context}},e.children),Rt=()=>t.useContext(At).get(),Nt=()=>{try{return t.useContext(At).get().creative.copy}catch(e){return}},Lt=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),Dt=i.compose(i.not,i.isEmpty),kt=i.where({url:Dt,title:Dt});function _t(e,t,n){return t.reduce(((t,n)=>{const[a,i]=n.slice(0,-1).split("["),o=i?i.split(","):[];if(!a)throw new Error($t(e,"This Meta Attribute could not be parsed."));return function(e,t,n,a){switch(t){case"openLinks":return function(e,t,n){Pt(t,e,"openLinks",1,2);const a=Ft(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),i=Gt(t,1,(e=>"string"==typeof e&&e.length?e:null));if("InApp"===a)return n.replace(Lt,((e,t)=>`<a ${le} ${i?`${ce}="${i}" `:""}${t}`));return n}(e,n,a);case"sliceText":return function(e,t,n){Pt(t,e,"sliceText",2,2);const a=Ft(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),i=Ft(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($t(e,`Unknown "SliceBy" value. ${a}`))}(e,n,a);default:throw new Error($t(e,`Unknown Meta Attribute '${t}'.`))}}(e,a,o,t)}),n)}function Pt(e,t,n,a,i){const o=new Error($t(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 $t(e,t){return`Malformed Meta Attribute: '${e}' - ${t}`}function Ft(e,t,n,a,i){const o=Gt(e,n,a);if(null!==o)return o;throw Error($t(t,i||`Could not parse meta attribute argument at index ${n} from arguments ${JSON.stringify(e)}`))}function Gt(e,t,n){return n(e[t])}const Mt="DATA",Bt="STATE",Ut=new RegExp(`^(${Mt}|${Bt})`),Vt=new RegExp(`^${Bt}`),zt=new RegExp(`%\\^(?:${Mt}|${Bt})\\.[a-zA-Z0-9]+[a-zA-Z0-9\\.]*(?:\\:[a-zA-Z0-9]+\\[[a-zA-Z0-9\\.,]*\\])*(?:\\|.*?)?\\^%`,"g"),qt=Symbol("invalid");function Ht(e,t="creativeCopy"){const n=Wt({data:e},t);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Wt(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(Ut.test(t)){if(!this.dataMap.has(t)&&Vt.test(t))throw new N(dt,`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===qt)throw new N(dt,`Invalid template key referenced: "${t}" is an object but expected a string, boolean, number or empty. \nDid you mean to reference a child property of ${t}?`);if(a.length>1&&n)try{n=_t(a[0],a.slice(1),n)}catch(e){throw new N(dt,`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(zt,r,o);return!1===a?s:""}.bind({dataMap:n})}function Wt(e,t,n){const a=new Map(n);return"data"in e&&o(e.data,`${Mt}${t?"."+t:""}`),"state"in e&&o(e.state,`${Bt}${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,qt),e&&"object"==typeof e&&i.forEachObjIndexed(((e,n)=>o(e,`${t}.${n}`)),e)}}const Kt=t.createContext(Ht({})),Yt=Kt.Consumer,Jt=Kt.Provider,Zt=()=>t.useContext(Kt),Qt=t.createContext(null),Xt=Qt.Provider,en=t.createContext("OUTER"),tn=()=>"VARIANT"===t.useContext(en),nn=t.createContext(void 0),an=()=>t.useContext(nn);var on,rn,sn,ln,cn,dn,un=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())}))},pn=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},fn=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 yn{constructor(e,t,n,a,o){on.set(this,void 0),rn.set(this,void 0),sn.set(this,new Set),ln.set(this,void 0),cn.set(this,void 0),dn.set(this,void 0),pn(this,on,i.partial(e.subscribe.bind(e),[n]),"f"),pn(this,rn,i.partial(e.dispatch.bind(e),[n]),"f"),pn(this,ln,t,"f"),pn(this,cn,a,"f"),pn(this,dn,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=fn(this,on,"f").call(this,e),n=()=>{t(),fn(this,sn,"f").delete(n)};return fn(this,sn,"f").add(n),n}onInteractivityChange(e){return fn(this,cn,"f").subscribe(e)}onEvent(...e){const t=e.reduce(((e,t)=>{if("partner"===t.source||"*"===t.source){const n=fn(this,dn,"f").call(this,t.name).subscribe(t.callback);return[...e,()=>n.unsubscribe()]}return e}),[]),n=()=>{t.forEach((e=>{e()})),fn(this,sn,"f").delete(n)};return fn(this,sn,"f").add(n),n}globalDispatch(e){fn(this,rn,"f").call(this,e)}dispose(){fn(this,sn,"f").forEach((e=>e())),pn(this,sn,new Set,"f"),fn(this,cn,"f").clear()}createChildPlugin(e){return fn(this,ln,"f").call(this,e)}}on=new WeakMap,rn=new WeakMap,sn=new WeakMap,ln=new WeakMap,cn=new WeakMap,dn=new WeakMap;class mn{onGlobalStateChange(){return()=>{}}onInteractivityChange(){return()=>{}}onEvent(){return()=>{}}globalDispatch(){}dispose(){}createChildPlugin(){return{close:()=>un(this,void 0,void 0,(function*(){})),onClose:()=>un(this,void 0,void 0,(function*(){})),putConfig:()=>un(this,void 0,void 0,(function*(){})),send:()=>un(this,void 0,void 0,(function*(){})),onEvent:()=>({subscribe:()=>({unsubscribe:()=>{}})})}}}var hn,vn,gn=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},bn=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 In{constructor(e){hn.set(this,void 0),vn.set(this,new Set),gn(this,hn,e,"f")}subscribe(e){return bn(this,vn,"f").add(e),!0===e(bn(this,hn,"f"))&&bn(this,vn,"f").delete(e),()=>{bn(this,vn,"f").delete(e)}}publish(e){gn(this,hn,e,"f"),bn(this,vn,"f").forEach((e=>{!0===e(bn(this,hn,"f"))&&bn(this,vn,"f").delete(e)}))}clear(){bn(this,vn,"f").clear()}}hn=new WeakMap,vn=new WeakMap;var En=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)},xn=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 Sn="breakpoint-0px";class Cn{constructor(){this.logger=()=>{}}withAppFactory(e){return this.appFactory=e,this}withLogger(e){return this.logger=e,this}withGatewayFactory(e){return this.gatewayFactory=e,this}build(){var e,t,n,a,i,o,r,s,l,c,d,u,p,f;const y=this.appFactory,m=this.logger,h=null!==(e=this.gatewayFactory)&&void 0!==e?e:()=>new mn;return f=class extends HTMLElement{static get observedAttributes(){return["visible","interactivity","active-breakpoint"]}constructor(){super(),t.add(this),n.set(this,(()=>null)),a.set(this,(()=>null)),i.set(this,void 0),o.set(this,!1),r.set(this,null),s.set(this,null),l.set(this,null);const e=this.attachShadow({mode:"open"});xn(this,i,document.createElement("div"),"f"),En(this,i,"f").id="app-container",En(this,i,"f").classList.add("default"),e.appendChild(En(this,i,"f"))}attributeChangedCallback(e,i,o){if(o!==i)switch(e){case"visible":En(this,n,"f").call(this,"true"===o);break;case"interactivity":"ENABLED"!==o&&"DISABLED"!==o||En(this,a,"f").call(this,o);break;case"active-breakpoint":En(this,t,"m",c).call(this,o,i)}}makeInteractivityUpdateHandler(e){xn(this,a,(t=>{e.publish(t)}),"f")}makeVisbilityUpdateHandler(e,a,i){const o="true"===this.getAttribute("visible"),r=this.getAttribute("slotInstanceGuid");xn(this,n,(o=>{o?(xn(this,n,(()=>null),"f"),0===e&&i.globalDispatch({type:Q,payload:{event:"Interactive"}}),a&&(i.globalDispatch({type:Z,payload:{name:"SignalImpression",parentGuid:a}}),this.trackViewability(a,i)),r&&i.globalDispatch({type:Z,payload:{name:"SignalImpression",parentGuid:r}})):En(this,t,"m",p).call(this)}),"f"),En(this,n,"f").call(this,o)}trackViewability(e,n){if(!En(this,o,"f"))if("IntersectionObserver"in window&&!En(this,r,"f")){const a=()=>{En(this,o,"f")||(n.globalDispatch({type:Z,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!0}}),xn(this,o,!0,"f"),En(this,t,"m",p).call(this),En(this,i,"f").removeEventListener("click",a))};En(this,i,"f").addEventListener("click",a),xn(this,r,new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=.5?En(this,t,"m",u).call(this,(()=>{En(this,o,"f")||(n.globalDispatch({type:Z,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!1}}),xn(this,o,!0,"f"),En(this,t,"m",p).call(this),En(this,i,"f").removeEventListener("click",a))})):En(this,t,"m",d).call(this)}))}),{threshold:.5}),"f"),xn(this,l,(()=>{var e,n;"visible"===document.visibilityState?null===(e=En(this,r,"f"))||void 0===e||e.observe(En(this,i,"f")):(En(this,t,"m",d).call(this),null===(n=En(this,r,"f"))||void 0===n||n.disconnect())}),"f"),document.addEventListener("visibilitychange",En(this,l,"f")),En(this,l,"f").call(this)}else n.globalDispatch({type:Z,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!1,inferred:!1}}),xn(this,o,!0,"f")}getOfferPositionAttr(){const e=this.getAttribute("offerPositionIndex"),t=Number(e);return(null==e||isNaN(t)||t<0)&&v(`Offer position attribute (${e}) is invalid`),t}getJSONAttr(e,t="{}"){const n=this.getAttribute(e);try{return JSON.parse(null!=n?n:t)}catch(t){v(`Invalid JSON attribute ${e}: ${n}`)}}disconnectedCallback(){En(this,t,"m",p).call(this)}connectedCallback(){var e,t,n;const a=this.getAttribute("container"),o=this.getAttribute("plugin-id");En(this,i,"f").setAttribute("style","width:100%;display:flex;flex-direction:"+("column"===a?"column":"row"));const r=this.getOfferPositionAttr(),s=this.getJSONAttr("layoutSchema"),l=this.getJSONAttr("childLayouts","[]"),c=this.getJSONAttr("offerData"),d=new In("DISABLED"===this.getAttribute("interactivity")?"DISABLED":"ENABLED"),u=null!==(e=this.getAttribute("schemaVersion"))&&void 0!==e?e:"",p=this.getJSONAttr("offerState","{}");y||v("Cannot create app without factory. Please build the connector withAppFactory.");const f=h({offerPositionIndex:r,creativeInstanceGuid:null===(t=null==c?void 0:c.creative)||void 0===t?void 0:t.instanceGuid},d);this.makeInteractivityUpdateHandler(d),y({rootElement:En(this,i,"f"),gateway:f,logger:m,offerPositionIndex:r,offerData:c,layoutSchema:s,childLayouts:l,schemaVersion:u,pluginId:o||O.pluginId,offerState:p}),this.makeVisbilityUpdateHandler(r,null===(n=null==c?void 0:c.creative)||void 0===n?void 0:n.instanceGuid,f)}},n=new WeakMap,a=new WeakMap,i=new WeakMap,o=new WeakMap,r=new WeakMap,s=new WeakMap,l=new WeakMap,t=new WeakSet,c=function(e,t){En(this,i,"f").classList.remove(t||Sn),En(this,i,"f").classList.add(e||Sn)},d=function(){En(this,s,"f")&&(clearTimeout(En(this,s,"f")),xn(this,s,null,"f"))},u=function(e){En(this,t,"m",d).call(this),xn(this,s,window.setTimeout(e,1e3),"f")},p=function(){En(this,t,"m",d).call(this),En(this,r,"f")&&(En(this,r,"f").disconnect(),xn(this,r,null,"f")),En(this,l,"f")&&(document.removeEventListener("visibilitychange",En(this,l,"f")),xn(this,l,null,"f"))},f;function v(e){throw m({level:j,code:"MODULE_BUILDER/FAILED_TO_BUILD_MODULE",message:e}),Error(e)}}}const wn=t.createContext({get:()=>new mn}),On=e=>t.createElement(wn.Provider,{value:{get:()=>e.context}},e.children);const Tn=t.createContext({get(){throw Error("Layout Schema context has not been set")}}),An=e=>t.createElement(Tn.Provider,{value:{get:()=>e.context}},e.children),jn=()=>t.useContext(Tn).get(),Rn=t.createContext("ENABLED"),Nn=()=>t.useContext(Rn);function Ln(e){const t=kn(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:kn(t,this.dataMap)});if(!n)throw new N("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 Dn={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function kn(e,t=Dn){return["images","links","icons","copy","responseOptionsMap"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Object.assign(Object.assign({},t[n]),e[n])})),t)}const _n=t.createContext(Ln({}));_n.Consumer;const Pn=_n.Provider,$n=()=>t.useContext(_n),Fn=t.createContext({});function Gn({info:e,children:n}){const a=t.useContext(Fn);return t.createElement(Fn.Provider,{value:Object.assign(Object.assign({},a),e)},n)}const Mn=t.createContext({get(){throw Error("Catalog Item context has not been set")}}),Bn=e=>t.createElement(Mn.Provider,{value:{get:()=>e.context}},e.children),Un=()=>t.useContext(Mn).get(),Vn=t.createContext(""),zn=()=>t.useContext(Vn),qn=t.createContext(""),Hn=t.createContext(void 0);function Wn({children:e}){const n=t.useMemo((()=>{const e=document.createElement("div");return e.inert=!0,{inert:!0===e.inert}}),[]);return t.createElement(Hn.Provider,{value:n},e)}const Kn=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")),Yn=i.compose(i.isEmpty,i.prop("predicates"));function Jn(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(ct(a)),transitionBaseClassname:e(Jn(t,(o=a,i.toPairs(o).flatMap((e=>{const[t,n]=null!=e?e:[];return n&&t?i.keys(n).map((e=>Ie(t,e))):[]})))))};var o})),Qn=i.anyPass([Kn,Yn]);const Xn={is:i.equals,"is-not":i.compose(i.not,i.equals),"is-below":i.lt,"is-above":i.gt};function ea(e,t){return e.includes(t)}const ta={is:i.equals,"is-not":i.compose(i.not,i.equals),exists:ea,"not-exists":i.compose(i.not,ea)},na={exists:i.compose(i.not,i.either(i.isNil,i.isEmpty)),"not-exists":i.either(i.isNil,i.isEmpty)},aa={"is-true":i.equals(!0),"is-false":i.equals(!1)},ia={is:i.equals,"is-not":i.compose(i.not,i.equals)};function oa(e){return(t,n)=>n[e]}const ra=i.cond([[(e,t)=>i.equals("Breakpoint",e),oa("activeBreakpoint")],[(e,t)=>i.equals("Progression",e),oa("progressionIndex")],[(e,t)=>i.equals("Position",e),oa("positionIndex")]]);function sa(e,t){return e.creativeCopy&&"string"==typeof e.creativeCopy[t]?e.creativeCopy[t]:void 0}const la=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))]]),ca=i.compose(i.not,isNaN);function da(e,t){return e.map((e=>{var n,a,i;switch(e.type){case"StaticString":return(0,ia[e.predicate.condition])(e.predicate.input,e.predicate.value);case"CreativeCopy":return(0,na[e.predicate.condition])(sa(t,e.predicate.value));case"StaticBoolean":return(0,aa[e.predicate.condition])(e.predicate.value);case"CustomState":return(0,Xn[e.predicate.condition])(null!==(n=t.customStates[e.predicate.key])&&void 0!==n?n:0,e.predicate.value);case"DomainState":return(0,Xn[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,ta[e.predicate.content.condition])(e.predicate.content.input,e.predicate.content.value);case"TextLength":return(0,Xn[e.predicate.content.condition])(e.predicate.content.input.length,e.predicate.content.value);case"Numeric":return(0,Xn[e.predicate.content.condition])(Number(e.predicate.content.input),e.predicate.content.value);default:return!1}}(e);default:{const n=Xn[e.predicate.condition],a=null!==(i=ra(e.type,t))&&void 0!==i?i:NaN,o=la(e.type,e.predicate.value,t);return!!ca(a)&&n(a,o)}}}))}function ua(e){return i.pathOr(0,["breakpoint","breakpoints",e.breakpoint.activeBreakpoint],e)}const pa={breakpoints:{},activeBreakpoint:NaN,progressionIndex:NaN,positionIndex:NaN,totalOffers:NaN,totalGroups:NaN,creativeCopy:{},customStates:{},domainStates:{}};function fa(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:${sa(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:${ra(e.type,t)}:${t.totalGroups}`}}(e,t),r=n.current.get(o);return i.evolve(ya(r)?{cached:i.append(r)}:{uncached:i.append({key:o,predicate:e})},a)}(a,n,e,t)),{cached:[],uncached:[]}),l=da(s.map((({predicate:e})=>e)),n);return i.zip(s,l).forEach((([{key:t},n])=>{e.current.set(t,n)})),r.concat(l)}const ya=i.is(Boolean);const ma=i.curry(((e,t,n)=>{var a,i,o,r,s,l;return{breakpoints:n.breakpoint.breakpoints,activeBreakpoint:ua(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}})),ha=i.lensPath(["predicate","content","input"]),va=i.lensPath(["predicate","content","value"]),ga=i.lensPath(["predicate","key"]);function ba(e,t){const n=i.over(ha,(t=>t?e(t):"")),a=i.over(va,(t=>"string"==typeof t?e(t):t)),o=i.compose(n,a),r=i.over(ga,(t=>t?e(t):""));return t.map((e=>{switch(e.type){case"Placeholder":return"TextValue"===e.predicate.type?o(e):n(e);case"CustomState":return r(e);default:return e}}))}const Ia=i.all(i.equals(!0));function Ea(e){const n=tn(),a=an(),o=t.useRef(new Map),r=Nt(),s=Et(pa,ma(a,r)),l=Zt();return t.useMemo((()=>i.mapObjIndexed((e=>{const t=ba(l,e);return Ia(fa(o,t,s,n))}),e)),[o,e,s,n,l])}function xa(e){e&&(e.style.display="")}function Sa(e){e&&(e.style.display="none")}function Ca(e){return e.settings.duration}const wa=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],Oa=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function Ta(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const a=t?wa:Oa,i=e.animate(a,{duration:n,iterations:1});return i.onfinish=()=>{t?xa(e):Sa(e)},i.oncancel=()=>{t?xa(e):Sa(e)},()=>{i.finish()}}return t?xa(e):Sa(e),()=>{}}function Aa({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)Ta(e,t,n)}(r.current,a,Ca(e),e.type)})):!a&&n?n.forEach((e=>{r.current&&function(e,t,n,a){if("FadeOut"===a)Ta(e,t,n)}(r.current,a,Ca(e),e.type)})):()=>{}),[a]),t.createElement("div",{ref:r,style:{display:"none"},className:o},i)}function ja(e){const n=Ct(),a=function(e){const n=tn(),a=an(),i=t.useRef(new Map),o=Nt(),r=Et(pa,ma(a,o)),s=ba(Zt(),e);return t.useMemo((()=>Ia(fa(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(Aa,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:a},i):"functionally"===e.schema.hide?t.createElement(Rn.Provider,{value:a?"ENABLED":"DISABLED"},i):a?t.createElement(t.Fragment,null,i):null}const Ra=i.mergeWith(((e,t)=>`${e||""} ${t||""}`.trim())),Na=e=>{var n;const a=t.useContext(Qt),o=an(),r=Tt()||document.head,s=zn(),l=ft(s,o,r),c=t.useCallback(mt,[]),d=Et([],(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=Ea(f?i.mapObjIndexed(i.propOr([],"predicates"),f):{}),m=i.mapObjIndexed(((e,t)=>e?function(e,t){var n;if(e&&t in e)return null===(n=e[t])||void 0===n?void 0:n.classname}(f,t):void 0),y),h=f?i.mapObjIndexed(i.prop("transitionBaseClassname"),f):{},v=e.styles?(g=h,Ra(Ra(p,m),g)):void 0;var g;return e.children({classnames:v,mapperRef:u})};function La(e){const n=Ct();return t.createElement(Na,{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 Da(e){const n=Ct();return t.createElement(Na,{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 ka={allowedTags:["em","strong","a","br","u","p","li","ul","ol","s"],allowedAttributes:{a:["href","target",le,ce],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],s:[]},allowedSchemes:["http","https"]},_a=new Map([["&","_;^;_"]]),Pa=new RegExp(`<a *(?=${ka.allowedAttributes.a.join("|")}|>)`,"g"),$a=new RegExp('<a [^>]*href="([^"]+)"',"g"),Fa=new RegExp("(<br *?>)|(<br *?/>)","g"),Ga="<br/>";function Ma(e){const n=Zt(),a=Nn(),i=t.useMemo((()=>{const t=n(e.schema.value);if(!function(e){const t=function(e){return e.replaceAll($a,((e,t)=>{const n=t.replaceAll("&",_a.get("&"));return e.replace(t,n)})).replaceAll(Fa,Ga)}(e);return t===u(t,ka)}(t))throw new N("FAILED_SANITISING_HTML","Invalid HTML tags");return t.trim()?t:""}),[e.schema.value,n]),{tabIndex:o,styles:r,isDisabled:s}=h(a);return i?t.createElement(Na,{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(Pa,`<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(Pa,`<a ${a.join(" ")}`)}});var l})):null}function Ba(e){const n=Zt()(e.schema.value),a=Nn(),{tabIndex:i,styles:o,isDisabled:r}=h(a);return n?t.createElement(Na,{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 Ua(e,n,a){if("BasicText"===e.type)return t.createElement(Ba,{schema:e.node,testId:n,isInline:null!=a&&a})}function Va(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,U(t,a)))))}function za(e){const n=bt(),a=Ct(),i=Rt(),o=Zt(),r=an(),s=Nn(),l=i.creative.responseOptionsMap[e.schema.responseKey],c=S(l);t.useEffect((()=>{c&&n(function(e){if(e.paymentTriggerConfig)return{type:ne,payload:{criteria:{key:"PAYMENT_OFFER_SELECTED"},signal:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:e.action,externalKey:"PAYMENT_OFFER_SELECTED"}}}};throw new Error(`Invalid External Response: No 'paymentTriggerConfig' found for external response option with instanceGuid: ${e.instanceGuid}`)}(l))}),[l,n,c]);const d=l?o({data:l},"creativeResponse"):o,{tabIndex:u,styles:p,isDisabled:f}=h(s);return I(l)&&!c&&void 0!==r?t.createElement(Na,{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(Jt,{value:d},(null==o?void 0:o.own)?function(e,n,a,i,o){return t.createElement(Xt,{value:a(n)},Va(e,i,o))}(e.schema.children,o.own,r,a,e.testId):Va(e.schema.children,a,e.testId)))})):null}function qa(e){const n=Nn(),{styles:a,isDisabled:i}=h(n);return e.schema.url.light?t.createElement(Na,{styles:m(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 Ha(e){const n=Nn(),{styles:a,isDisabled:i}=h(n),o=(e=>{const n=t.useContext(_n),a=e.split("|");for(const e of a){const t=n(e.trim(),"images");if(t)return t}})(e.schema.imageKey);return null!=(r=o)&&"object"==typeof r&&"light"in r&&"string"==typeof r.light?t.createElement(Na,{styles:m(e.schema.styles)},(({classnames:n})=>t.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},a),{display:"inline-block"}),alt:o.alt,title:o.title,className:n?n.own:void 0,"data-testid":e.testId,"data-e2e":"DataImage",src:o.light}))):null;var r}const Wa={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function Ka(e){const n=e.schema.name,a=e.schema.description,i=e.schema.styles?M(Wa,e.schema.styles):Wa,o=Nn(),{styles:r,isDisabled:s}=h(o);return n?t.createElement(Na,{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 Ya={backgroundColor:"#FFEEEE",color:"#FF0000",fontSize:"10px",padding:"4px",border:"1px solid #FF0000",margin:0,whiteSpace:"normal"};class Ja 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"===me.REPORT_RENDER_ERRORS&&this.props.reporter({level:j,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"===me.DISPLAY_ERRORS?t.createElement("pre",{style:Ya},t.createElement("strong",null,"Error:")," [",t.createElement("em",null,this.props.schema.type),"]"," ",this.state.errorMessage):void 0:this.props.children}}Ja.contextType=Fn;const Za={internally:"_top",externally:"_blank"};function Qa(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Xa(e){var n;const a=Za[e.schema.open],i=Ct(),o=Nn(),{tabIndex:r,styles:s,isDisabled:l}=h(o);return(null===(n=e.schema.children)||void 0===n?void 0:n.length)>0?t.createElement(Na,{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(Xt,{value:a(n)},Qa(e,i,o))}(e.schema.children,null==n?void 0:n.own,o,i,e.testId):Qa(e.schema.children,i,e.testId))})):null}function ei(e,n,a){if("StaticLink"===e.type)return t.createElement(Xa,{schema:e.node,testId:n,isInline:null!=a&&a})}const ti={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function ni(e){const n=(a=e.schema.iconKey,t.useContext(_n)(a,"icons"));var a;const i=null==n?void 0:n.name,o=e.schema.styles?M(ti,e.schema.styles):ti,r=Nn(),{styles:s}=h(r);return i?t.createElement(Na,{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 ai=o.css`
2
2
  display: flex;
3
3
  position: relative;
4
4
  overflow: hidden;
@@ -6,7 +6,7 @@
6
6
  > * {
7
7
  position: absolute !important;
8
8
  }
9
- `;function ii(e){const n=Ct(),a=t.useRef(null);return t.useEffect((()=>{const e=new ResizeObserver((()=>{requestAnimationFrame((()=>{if(a.current){const e=Array.from(a.current.children).reduce(((e,t)=>Math.max(e,t.clientHeight)),0);a.current.style.height=`${e}px`}}))}));return a.current&&Array.from(a.current.children).forEach((t=>{e.observe(t)})),()=>{e.disconnect()}}),[]),t.createElement(Na,{styles:e.schema.styles},(({classnames:i})=>{var o;return t.createElement("div",{ref:a,className:[ai,null==i?void 0:i.own].filter(Boolean).join(" ")||void 0,"aria-label":null!==(o=e.schema.a11yLabel)&&void 0!==o?o:void 0,"data-testid":e.testId,"data-e2e":"ZStack"},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))}))}const oi={elements:{own:[{default:{dimension:{width:{type:"percentage",value:100},height:{type:"fixed",value:50}},background:{backgroundColor:{light:"#000"}},border:{borderRadius:25}}}],thumb:[{default:{dimension:{width:{type:"fixed",value:50},height:{type:"fixed",value:50}},background:{backgroundColor:{light:"#FFF"}},text:{fontSize:22,fontFamily:"rokt-icons",horizontalTextAlign:"center"},border:{borderRadius:25}}}],fill:[{default:{background:{backgroundColor:{light:"#000"}}}}],label:[{default:{text:{fontSize:18,textColor:{light:"#FFF"},horizontalTextAlign:"center"}}}]}};function ri(e){const[n,a]=t.useState(!1),[i,o]=t.useState(!1),r=zn(),s=Nn(),l=an(),c=bt(),{customStateValue:d,label:u,a11yLabel:p,thumb:f}=e.schema,{containerClass:y,trackClass:h,fillClass:v,thumbClass:b,labelClass:I,buttonClass:E}=function(e,t){const n=ft(e,t);return{containerClass:n`
9
+ `;function ii(e){const n=Ct(),a=t.useRef(null);return t.useEffect((()=>{const e=new ResizeObserver((()=>{requestAnimationFrame((()=>{if(a.current){const e=Array.from(a.current.children).reduce(((e,t)=>Math.max(e,t.clientHeight)),0);a.current.style.height=`${e}px`}}))}));return a.current&&Array.from(a.current.children).forEach((t=>{e.observe(t)})),()=>{e.disconnect()}}),[]),t.createElement(Na,{styles:e.schema.styles},(({classnames:i})=>{var o;return t.createElement("div",{ref:a,className:[ai,null==i?void 0:i.own].filter(Boolean).join(" ")||void 0,"aria-label":null!==(o=e.schema.a11yLabel)&&void 0!==o?o:void 0,"data-testid":e.testId,"data-e2e":"ZStack"},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))}))}const oi={elements:{own:[{default:{dimension:{width:{type:"percentage",value:100},height:{type:"fixed",value:50}},background:{backgroundColor:{light:"#000"}},border:{borderRadius:25}}}],thumb:[{default:{dimension:{width:{type:"fixed",value:50},height:{type:"fixed",value:50}},background:{backgroundColor:{light:"#FFF"}},text:{fontSize:22,fontFamily:"rokt-icons",horizontalTextAlign:"center"},border:{borderRadius:25}}}],fill:[{default:{background:{backgroundColor:{light:"#000"}}}}],label:[{default:{text:{fontSize:18,textColor:{light:"#FFF"},horizontalTextAlign:"center"}}}]}};function ri(e){const[n,a]=t.useState(!1),[i,o]=t.useState(!1),r=zn(),s=Nn(),l=an(),c=bt(),{customStateValue:d,label:u,a11yLabel:p,thumb:f}=e.schema,{containerClass:y,trackClass:m,fillClass:v,thumbClass:b,labelClass:I,buttonClass:E}=function(e,t){const n=ft(e,t);return{containerClass:n`
10
10
  position: relative;
11
11
  z-index: 1;
12
12
  flex: 1;
@@ -54,7 +54,7 @@
54
54
  z-index: 0;
55
55
  background-color: #00000000;
56
56
  color: #00000000;
57
- `}}(r,l),S=Zt();if(!e.schema.customStateKey)throw new Error("No custom state key provided for state trigger node.");const x=S(e.schema.customStateKey),C={type:X,payload:{key:x,value:null!=d?d:1}},w={type:Z,payload:{name:"SignalUserInteraction",action:"Swipe",context:"SlideStateTrigger"}},O=e.schema.styles?M(oi,e.schema.styles):oi,T=t.useRef(null),A=t.useRef(null),j=t.useRef(null),R=t.useRef(!1),N=t.useRef(void 0),{isDisabled:L}=m(s);t.useEffect((()=>{if(n)return g()?(document.addEventListener("touchmove",k),document.addEventListener("touchend",D)):(document.addEventListener("mousemove",k),document.addEventListener("mouseup",D)),B}),[n]);const D=()=>{B(),N.current=void 0,a(!1),i||(G(!0),R.current?(F($()),P()):F(0))},_=e=>{n||i||L||(N.current=li(e),G(!1),a(!0))},k=e=>{var t,n;if(si(j)){const a=Math.min(Math.max(0,(null!==(t=li(e))&&void 0!==t?t:0)-(null!==(n=N.current)&&void 0!==n?n:0)),$());F(a),a/$()*100>=75?R.current=!0:R.current=!1}},P=()=>{var e,t;o(!0),c(C),c(w),null===(t=null===(e=si(T).parentElement)||void 0===e?void 0:e.parentElement)||void 0===t||t.focus()},$=()=>si(T).getBoundingClientRect().width-si(j).getBoundingClientRect().width,F=e=>{var t;si(j).style.transform=`translateX(${e}px)`,si(A).style.transform=`translateX(${e+(null===(t=si(j))||void 0===t?void 0:t.getBoundingClientRect().width)/2}px)`},G=e=>{e?(si(j).style.transition="transform .2s",si(A).style.transition="transform .2s"):(si(j).style.transition="",si(A).style.transition="")},B=()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",D),document.removeEventListener("touchmove",k),document.removeEventListener("touchend",D)};return t.createElement(Na,{styles:O},(({classnames:n})=>{var a,o,r,s,l,c;return t.createElement("div",{className:`${y}`,"data-testid":e.testId,"data-e2e":"SlideStateTrigger"},t.createElement("div",{className:`${h} ${null!==(a=null==n?void 0:n.own)&&void 0!==a?a:""}`,ref:T,"aria-hidden":!0,"data-testid":e.testId&&`${e.testId}-track`},(null==u?void 0:u.value)?t.createElement("div",{className:`${I} ${null!==(o=null==n?void 0:n.label)&&void 0!==o?o:""}`,"data-testid":e.testId&&`${e.testId}-label`},u.value):null,t.createElement("div",{className:`${v} ${null!==(r=null==n?void 0:n.fill)&&void 0!==r?r:""}`,ref:A,"data-testid":e.testId&&`${e.testId}-fill`}),t.createElement("div",{className:`${b} ${null!==(s=null==n?void 0:n.thumb)&&void 0!==s?s:""}`,ref:j,"data-testid":e.testId&&`${e.testId}-thumb`,"data-e2e":"SlideStateTrigger-thumb",onMouseDown:_,onTouchStart:_},null!==(l=null==f?void 0:f.icon)&&void 0!==l?l:"ArrowForward")),t.createElement("button",{className:E,"aria-label":null!=p?p:void 0,onClick:P,disabled:i||L,"data-testid":e.testId&&`${e.testId}-button`},null!==(c=null==u?void 0:u.value)&&void 0!==c?c:"Unlock Offers"))}))}function si(e){if(!e.current)throw new Error("Unexpected missing reference to required SlideStateTrigger Element");return e.current}function li(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientX:e.clientX}function ci(e){const n=Ct();return t.createElement(Na,{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",flexWrap:"wrap"},"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 di(e){const n=Nn(),a=bt(),i=Zt()(e.schema.customStateKey),o=Et(0,(e=>e.customStates[i])),{tabIndex:r,styles:s,isDisabled:l}=m(n),c=()=>{a({type:X,payload:{key:i,value:o?0:1}})};return t.createElement(Na,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:c,"data-testid":e.testId,"data-e2e":"ToggleButtonStateTrigger",disabled:l,"aria-disabled":l,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:r,style:Object.assign({cursor:"pointer"},s)},t.createElement(xt,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function ui(e){const n=Ct();return t.createElement(Na,{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",overflowX:"auto"},"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 pi(e){const n=Ct();return t.createElement(Na,{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",overflowY:"auto"},"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 fi=t.createContext({extensions:{ctx:new Map,cache:[]}}),yi=()=>t.useContext(fi).extensions;function hi({extensions:e,extendStore:n,children:a}){const i=yi(),o=new Map([...i.ctx,...e.ctx]),r=i.cache.concat(e.cache);return t.createElement(fi.Provider,{value:{extensions:{ctx:o,cache:r},extendStore:n}},a)}function mi(e,t){const n=function(e){try{const t=JSON.parse(e);if(null!=t&&"object"==typeof t&&"type"in t&&"Extension"===t.type&&"name"in t&&"string"==typeof t.name&&t.name.trim().length>0&&"body"in t&&"object"==typeof t.body)return{type:"Extension",name:t.name,body:t.body}}catch(e){}return null}(t),a=n?e.ctx.get(n.name):null;return n&&a?[n,a]:null}function vi({data:e}){const n=mi(yi(),e);var a;if((e=>{const{extendStore:n,extensions:a}=t.useContext(fi);t.useEffect((()=>{e&&n&&!a.cache.includes(e.name)&&(n(e),a.cache.push(e.name))}),[e,a.cache,n])})((a=null==n?void 0:n[1])?{sagas:a.sagas,reducer:a.reducer,name:a.name,interceptors:a.interceptors}:void 0),n){const[e,t]=n;return t.componentFactory(e.body)}return null}function gi(e,n){if(v("Extension",e))return t.createElement(vi,{data:e.node.data})}function bi(e){const n=$n(),a=Rt(),i=Zt(),o=Ct(),r=bt(),s=t.useMemo((()=>a.catalogItems||[]),[a]),l=e=>i({data:e},"catalogItem");return t.useEffect((()=>{for(const e of s)r({type:Z,payload:{name:"SignalImpression",parentGuid:e.instanceGuid}})}),[s,r]),s.length>0?t.createElement(Na,{styles:e.schema.styles},(({classnames:a})=>t.createElement("div",{"data-testid":e.testId,"data-e2e":"CatalogStackedCollection",className:null==a?void 0:a.own,style:{display:"flex",flexDirection:"column"}},t.Children.toArray(s.map(((a,i)=>t.createElement(Bn,{context:a},t.createElement(Pn,{value:n(a)},t.createElement(Jt,{value:l(a)},o(e.schema.template,void 0,U(i,e.testId))))))))))):null}const Ii={BasicText:(e,t)=>Ua(e,t,!0),StaticLink:(e,t)=>ei(e,t,!0)};function Ei(e){const n=Ct();return t.createElement(wt,{value:n,overrides:Ii},t.createElement(xt,null,(n=>t.createElement(Na,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:null==a?void 0:a.own,"data-testid":e.testId,"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 Si(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,U(t,a)))))}function xi(e){const n=Nn(),a=bt(),o=Ct(),r=Zt(),{event:s}=e.schema,{tabIndex:l,styles:c,isDisabled:d}=m(n),u=i.mapObjIndexed((e=>r(e)),s.data||{}),p=()=>{a({type:ee,payload:{name:s.type,body:{offerId:u.providerOfferId,title:u.title,description:u.description}}})};return t.createElement(Na,{styles:e.schema.styles},(({classnames:n,mapperRef:a})=>{var i;return t.createElement("button",{"aria-disabled":d,"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0,className:null==n?void 0:n.own,"data-e2e":"PartnerEventButtonTrigger","data-testid":e.testId,disabled:d,onClick:p,tabIndex:l,type:"button",style:Object.assign({cursor:"pointer"},c)},t.createElement(Jt,{value:r},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(Xt,{value:a(n)},Si(e,i,o))}(e.schema.children,n.own,a,o,e.testId):Si(e.schema.children,o,e.testId)))}))}function Ci(e){const n=bt(),a=Zt(),i=e.schema.delay?e.schema.delay:1,o=a(e.schema.customStateKey),r=Et(0,(e=>e.customStates[o]));return function({delay:e,callback:n}){const a=t.useRef(null);t.useEffect((()=>{a.current=setTimeout(n,e)}),[])}({delay:i,callback:()=>{n({type:X,payload:{key:o,value:r?0:1}})}}),null}function wi(e){const n=Nn(),a=Zt(),i=a(e.schema.value),o=bt(),r=a(e.schema.customStateKey),s=Et(0,(e=>e.customStates[r])),{tabIndex:l,styles:c,isDisabled:d}=m(n),u=()=>{navigator.clipboard.writeText(i),s||o({type:X,payload:{key:r,value:1}})};return t.createElement(Na,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:u,"data-testid":e.testId,"data-e2e":"CopyToClipboardButton",disabled:d,"aria-disabled":d,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:l,style:Object.assign({cursor:"pointer"},c)},t.createElement(xt,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function Oi(e){const n=Nn(),a=bt(),i=Zt()(e.schema.customStateKey),{value:o}=e.schema,{tabIndex:r,styles:s,isDisabled:l}=m(n),c=()=>{a({type:X,payload:{key:i,value:o}})};return t.createElement(Na,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:c,"data-testid":e.testId,"data-e2e":"ButtonStateTrigger",disabled:l,"aria-disabled":l,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:r,style:Object.assign({backgroundColor:"transparent",cursor:"pointer",margin:0,padding:0},s)},t.createElement(xt,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function Ti({schema:e,testId:n}){var a,o,r,s,l,c,u,p;const f=$n(),y=Rt(),h=Ct(),v=bt(),g=t.useMemo((()=>y.catalogItems||[]),[y]),b=Zt(),I=e=>b({data:e},"catalogItem"),E=Et(0,(e=>{return(t=e.breakpoint.activeBreakpoint,i.compose(i.findIndex(i.equals(t)),ye,fe,i.toPairs,i.pathOr({},["breakpoint","breakpoints"])))({breakpoint:Object.assign(Object.assign({},e.breakpoint),{initialised:!0})});var t})),S=Nn(),{tabIndex:x,isDisabled:C,styles:w}=m(S),O=e.viewableItems.length-1,[T]=d({slidesToScroll:null!==(a=e.viewableItems[Math.min(E,O)])&&void 0!==a?a:"auto",containScroll:"trimSnaps"});t.useEffect((()=>{for(const e of g)v({type:Z,payload:{name:"SignalImpression",parentGuid:e.instanceGuid}})}),[g,v]);const A=`${null!==(u=null===(c=null===(l=null===(s=null===(r=null===(o=e.styles)||void 0===o?void 0:o.elements)||void 0===r?void 0:r.own[E])||void 0===s?void 0:s.default)||void 0===l?void 0:l.container)||void 0===c?void 0:c.gap)&&void 0!==u?u:"0"}px`,j={overflow:"hidden"},R={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:A,alignItems:"stretch"},N=e.peekThroughSize[Math.min(E,e.peekThroughSize.length-1)],L=N?"fixed"===(D=N).type?`${D.value}px`:`${D.value}%`:"0px";var D;const _=null!==(p=e.viewableItems[Math.min(O,E)])&&void 0!==p?p:1,k={flex:`0 0 calc(${(e=>"0px"!==e&&"0%"!==e)(L)?`(100% - 2 * ${L} - (${_} + 1) * ${A})/${_}`:`(100% - (${_} - 1) * ${A})/${_}`})`,position:"relative",display:"flex",backgroundColor:"transparent"};return g.length>0?t.createElement(Na,{styles:e.styles},(({classnames:a})=>t.createElement("div",{ref:T,style:Object.assign(Object.assign({},j),w),"aria-disabled":C,tabIndex:x,className:null==a?void 0:a.own,"data-e2e":"CarouselDistribution","data-testid":n&&`${n}`},t.createElement("div",{style:R,"data-testid":n&&`${n}-container`,"data-e2e":"CarouselDistribution-Container"},t.Children.toArray(g.map(((a,i)=>t.createElement(Bn,{context:a},t.createElement(Pn,{value:f(a)},t.createElement(Jt,{value:I(a)},t.createElement("div",{style:k,"data-testid":n&&`${n}-slide-${i}`,"data-e2e":`CarouselDistribution-Slide-${i}`},h(e.template,void 0,U(i,n))))))))))))):null}function Ai(e){return()=>{throw new N("FAILED_CREATING_UNHANDLED_NODE",`The default mapper does not handle the ${e} node. Make sure when you use the NodeMapperProvider, you pass an override for ${e} node.`)}}const ji={Column:function(e,n){if("Column"===e.type)return t.createElement(La,{schema:e.node,testId:n})},Row:function(e,n){if("Row"===e.type)return t.createElement(Da,{schema:e.node,testId:n})},StaticImage:function(e,n){if("StaticImage"===e.type)return t.createElement(qa,{schema:e.node,testId:n})},DataImage:function(e,n){if("DataImage"===e.type)return t.createElement(Ha,{schema:e.node,testId:n})},CreativeResponse:function(e,n){if("CreativeResponse"===e.type)return t.createElement(za,{schema:e.node,testId:n})},OneByOneDistribution:Ai("OneByOneDistribution"),StackedDistribution:Ai("StackedDistribution"),CarouselDistribution:Ai("CarouselDistribution"),GroupedDistribution:Ai("GroupedDistribution"),ProgressIndicator:Ai("ProgressIndicator"),ProgressControl:Ai("ProgressControl"),When:function(e,n){if("When"===e.type)return t.createElement(ja,{schema:e.node,testId:n})},Overlay:Ai("Overlay"),CloseButton:Ai("CloseButton"),RichText:function(e,n){if("RichText"===e.type)return t.createElement(Ma,{schema:e.node,testId:n})},BasicText:Ua,StaticLink:ei,DataIcon:function(e,n){if("DataIcon"===e.type)return t.createElement(ni,{schema:e.node,testId:n})},StaticIcon:function(e,n){if("StaticIcon"===e.type)return t.createElement(Ka,{schema:e.node,testId:n})},ZStack:function(e,n){if("ZStack"===e.type)return t.createElement(ii,{schema:e.node,testId:n})},FlowRow:function(e,n){if("FlowRow"===e.type)return t.createElement(ci,{schema:e.node,testId:n})},SlideStateTrigger:function(e,n){if("SlideStateTrigger"===e.type)return t.createElement(ri,{schema:e.node,testId:n})},ToggleButtonStateTrigger:function(e,n){if("ToggleButtonStateTrigger"===e.type)return t.createElement(di,{schema:e.node,testId:n})},PartnerEventButtonTrigger:function(e,n){if("PartnerEventButtonTrigger"===e.type)return t.createElement(xi,{schema:e.node,testId:n})},TimerStateTrigger:function(e,n){if("TimerStateTrigger"===e.type)return t.createElement(Ci,{schema:e.node})},CatalogStackedCollection:function(e,n){if("CatalogStackedCollection"===e.type)return t.createElement(bi,{schema:e.node,testId:n})},CatalogResponseButton:Ai("CatalogResponseButton"),ScrollableRow:function(e,n){if("ScrollableRow"===e.type)return t.createElement(ui,{schema:e.node,testId:n})},ScrollableColumn:function(e,n){if("ScrollableColumn"===e.type)return t.createElement(pi,{schema:e.node,testId:n})},EscapeHatch:gi,BottomSheet:Ai("BottomSheet"),CatalogQuantityOption:Ai("CatalogQuantityOption"),CatalogRadioGroup:Ai("CatalogRadioGroup"),CatalogQuantityCounter:Ai("CatalogQuantityCounter"),InlineContainer:function(e,n){if("InlineContainer"===e.type)return t.createElement(Ei,{schema:e.node,testId:n})},CopyToClipboardButton:function(e,n){if("CopyToClipboardButton"===e.type)return t.createElement(wi,{schema:e.node,testId:n})},ButtonStateTrigger:function(e,n){if("ButtonStateTrigger"===e.type)return t.createElement(Oi,{schema:e.node,testId:n})},CatalogCombinedCollection:Ai("CatalogCombinedCollection"),CatalogCarouselCollection:function(e,n){if("CatalogCarouselCollection"===e.type)return t.createElement(Ti,{schema:e.node,testId:n})},IconGroup:Ai("IconGroup")};function Ri(e){return function(n,a,i){const o=a&&a[n.type],r=null!=o?o:ji[n.type];return t.createElement(Ja,{schema:n,reporter:e},r&&r(n,i)||function(e){throw new N("FAILED_CREATING_LAYOUT_NODE",`Failed to create layout node ${JSON.stringify(e)}`)}(n))}}const Ni={transformLinksToAnchorText:function(e={}){return{data:i.mapObjIndexed((e=>_t(e)?`<a target="_blank" href="${e.url}">${e.title}</a>`:""),e)}}};function Li(e){const{childLayouts:n}=e,a=bt(),[o,r]=t.useMemo((()=>{const e=i.indexBy(i.prop("childLayoutId"),n);return[e,i.mapObjIndexed((e=>e.childLayoutSchema.predicates),e)]}),[n]),s=Ea(r);t.useEffect((()=>{Object.entries(s).forEach((([e,t])=>{const n=o[e];t&&n&&a({type:re,payload:n})}))}),[s,o,a])}function Di(e){const{settings:n,dispatch:a,children:i}=e,o=Ht(n.offerData.creative.copy||{})(Ni.transformLinksToAnchorText(n.offerData.creative.links),"creativeLink"),r=Ri(n.logger),[s,l]=t.useState("ENABLED");return t.useEffect((()=>n.gateway.onInteractivityChange(l)),[n]),de(n.rootElement,a),t.createElement(en.Provider,{value:"VARIANT"},t.createElement(Ot.Provider,{value:n.rootElement},t.createElement(Vn.Provider,{value:n.pluginId},t.createElement(On,{context:n.gateway},t.createElement(An,{context:n.layoutSchema},t.createElement(qn.Provider,{value:n.schemaVersion},t.createElement(jt,{context:n.offerData},t.createElement(Pn,{value:Ln(n.offerData.creative)},t.createElement(Rn.Provider,{value:s},t.createElement(wt,{value:r},t.createElement(nn.Provider,{value:n.offerPositionIndex},t.createElement(gt.Provider,{value:a},t.createElement(Jt,{value:o},t.createElement(_i,null,t.createElement(Li,{childLayouts:n.childLayouts}),i))))))))))))))}function _i(e){var n;const{children:a}=e,o=zn(),r=function(){const[e,n]=t.useState(null),a=t.useContext(wn).get();return t.useEffect((()=>a.onGlobalStateChange((t=>{i.equals(t,e)||n(t)}))),[a]),e}(),s=t.useContext(Ot)||void 0,l=an(),c=t.useCallback((e=>mt(e,o,l,s)),[s]);return r?t.createElement(Xt,{value:c(Object.values(null!==(n=null==r?void 0:r.breakpoint.breakpoints)&&void 0!==n?n:{}))},t.createElement(It.Provider,{value:r},a)):null}function ki(e){return t.createElement("style",{"data-testid":e.testId},"\n* {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n}\nbody {\n margin: 0;\n font-family: sans-serif;\n}\np {\n margin: 0;\n}\nimg {\n max-width: 100%;\n}\n")}function Pi(e,t,n,a,i,o){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){o.current.isRunning=!0,i&&"in"===t&&function(e,t){e.style.height=`${t.clientHeight}px`}(i,e);const r=e.animate(n,{duration:a,iterations:1});return r.onfinish=()=>{"in"===t?Sa(e):xa(e),o.current.isRunning=!1},r.oncancel=()=>{"in"===t?Sa(e):xa(e),o.current.isRunning=!1},()=>{r.finish()}}return"in"===t?Sa(e):xa(e),()=>{}}const $i={FadeInOut:{in:[{opacity:0,display:"none"},{opacity:0,display:"none",offset:.5},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],out:[{opacity:1},{opacity:0,offset:.75},{opacity:0}]}};function Fi({visible:e,effect:n,children:a,parentElement:i,containerClassName:o}){const[r,s]=t.useState(e),l=t.useRef(null),c=t.useRef({isRunning:!1}),d=Ca(n);return t.useEffect((()=>{const t=new ResizeObserver((function(t){i&&e&&!c.current.isRunning&&t.forEach((e=>{e.contentBoxSize?function(e,t){var n;Array.isArray(e.contentBoxSize)&&e.contentBoxSize[0]?t.style.height=e.contentBoxSize[0].blockSize+"px":"object"==typeof(n=e.contentBoxSize)&&null!=n&&"blockSize"in n&&"number"==typeof n.blockSize&&"inlineSize"in n&&"number"==typeof n.inlineSize?t.style.height=e.contentBoxSize.blockSize+"px":t.style.height="auto"}(e,i):e.contentRect&&function(e,t){t.style.height=`${e.contentRect.height}px`}(e,i)}))}));return e&&l.current&&(Sa(l.current),t.observe(l.current)),()=>{t.disconnect()}}),[e,i]),t.useEffect((()=>e&&!r&&l.current&&i?(s(!0),Pi(l.current,"in",$i[n.type].in,d,i,c)):!e&&r&&l.current&&i?(s(!1),Pi(l.current,"out",$i[n.type].out,d/2,i,c)):()=>{}),[e,i,d]),t.createElement("div",{ref:l,style:{display:"none"},className:o},a)}function Gi(e){const n=Ct();return t.createElement(Na,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:null==a?void 0:a.own,"data-testid":e.testId,style:{display:"flex",flexDirection:"column"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},n(e.schema.template))}))}const Mi="ACTIVE/ADD",Bi="ACTIVE/DELETE",Ui="BREAKPOINT/UPDATE_ACTIVE",Vi="BREAKPOINT/INITIALISE",zi="BREAKPOINT/SET_BREAKPOINTS",qi="FONTS/SET",Hi="LAYOUT/UPDATE",Wi="CONFIG/HANDLE",Ki="PLUGIN/CLOSE_PLUGIN",Yi="SETTINGS/SET",Ji="CACHE/ADD_SERIALIZED_VALUE",Zi="CACHE/UPDATE_SERIALIZED_VALUE",Qi="CACHE/CLEAR_SERIALIZED_VALUE",Xi="SIGNAL/QUEUE",eo="SIGNAL/PROCESSED",to="SIGNAL/PROCESS",no="OVERLAY/DISMISS_OVERLAY",ao="ERROR/REPORT",io="LOG",oo="CUSTOM_STATES/SET",ro={LAYOUT_UPDATE:Hi,UPDATE_ACTIVE_BREAKPOINT:Ui,INITIALISE_BREAKPOINT:Vi,ACTIVE_ADD:Mi,ACTIVE_DELETE:Bi,SET_FONTS:qi,QUEUE_SIGNAL:Xi,SIGNAL_PROCESSED:eo,CACHE_SERIALIZED_VALUE:Ji,UPDATE_CACHED_SERIALIZED_VALUE:Zi,CLEAR_SERIALIZED_VALUE_FROM_CACHE:Qi,SET_SETTINGS:Yi,SET_CUSTOM_STATE:oo},so={HANDLE_CONFIG:Wi,SET_BREAKPOINTS:zi,CLOSE_PLUGIN:Ki,RAISE_METRIC:V,PREPARE_SIGNAL:ne,DISMISS_OVERLAY:no,REPORT_ERROR:ao,LOG:io,OPEN_LINK:ae},lo="plugin-overlay",co="plugin";function uo(n){var i;const o=n.schema.styles,r=a.useDispatch(),s={type:(null===(i=n.action)||void 0===i?void 0:i.type)||no,payload:{id:lo,dismissalMethod:n.schema.dismissalMethod}},l=()=>{r(s)},c=Nn(),{tabIndex:d,styles:u,isDisabled:p}=m(c);return e.jsx(Na,{styles:o,children:({classnames:a})=>{var i;return e.jsx("button",{title:"Close",className:null==a?void 0:a.own,onClick:l,"data-testid":n.testId,"data-e2e":"CloseButton",disabled:p,tabIndex:d,"aria-disabled":p,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:void 0,style:Object.assign({cursor:"pointer"},u),children:e.jsx(xt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}const po={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var fo;function yo({isOpen:n,schema:o,testId:r,children:s}){const l=ue(),c=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),d=a.useSelector((e=>e.active.has(co))),u=a.useDispatch(),p=()=>{u({type:so.DISMISS_OVERLAY,payload:{id:lo,dismissalMethod:"rokt_backdrop"}})};t.useEffect((()=>{c&&u({type:Z,payload:{name:"SignalActivation",parentGuid:c}})}),[c]),t.useEffect((()=>{d&&requestAnimationFrame((()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}))}),[d]);const f=Nn(),{tabIndex:y,isDisabled:h,styles:v}=m(f),g=o.styles?i.mergeRight(po,o.styles):po;if(!n)return null;const b=e.jsx(xt,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(Na,{styles:g,children:({classnames:t})=>{var n;return e.jsxs("div",{className:null==t?void 0:t.wrapper,style:Object.assign({position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9999",display:"flex",overflow:"auto"},v),"aria-label":null!==(n=o.a11yLabel)&&void 0!==n?n:void 0,"aria-hidden":h,role:"dialog","aria-modal":!0,tabIndex:y,"data-testid":r,"data-e2e":"Overlay-Wrapper",children:[e.jsx("div",{style:{position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},onClick:o.allowBackdropToClose?p:void 0,"data-testid":r&&`${r}-backdrop`,"data-e2e":"Overlay-Backdrop"}),s(b,l)]})}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(fo||(fo={}));const ho={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const mo=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(ho,t.styles):ho;return e.jsx(Na,{styles:r,children:({classnames:t})=>e.jsx("div",{className:null==t?void 0:t.own,style:{position:"relative",zIndex:"3",outline:"none"},ref:o,tabIndex:-1,"data-e2e":"Overlay-Container","data-testid":n&&`${n}-container`,children:a})})}));const vo=a.connect((function(e){return{isOpen:e.active.has(lo)}}))((function(t){return e.jsx(yo,Object.assign({},t,{children:(n,a)=>e.jsx(mo,Object.assign({},t,{ref:a,children:n}))}))}));const go=a.connect((function(e){return{isOpen:e.active.has(lo)}})),bo={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const Io=t.forwardRef((function({schema:n,testId:a,children:o},r){const s=t.useRef(null),l=n.styles?i.mergeRight(bo,n.styles):bo;return t.useEffect((()=>{if(s.current)return function(e){const t=requestAnimationFrame((()=>{e&&e.style.setProperty("max-height","100%")}));return()=>{cancelAnimationFrame(t)}}(s.current)}),[]),e.jsx(Na,{styles:l,children:({classnames:t})=>e.jsx("div",{style:{width:"100%",maxHeight:"0%",transition:"max-height 0.8s",transitionTimingFunction:"cubic-bezier(0.05, 0.7, 0.1, 1.0)",alignSelf:"flex-end"},ref:s,children:e.jsx("div",{className:null==t?void 0:t.own,style:{position:"relative",zIndex:"3",outline:"none",borderBottomLeftRadius:"0",borderBottomRightRadius:"0"},ref:r,tabIndex:-1,"data-testid":a&&`${a}-container`,"data-e2e":"BottomSheet-Container",children:o})})})}));const Eo=go((function(t){const n=a.useSelector((e=>e.breakpoint.activeBreakpoint));return e.jsx(yo,Object.assign({},t,{children:(a,i)=>"default"===n?e.jsx(Io,Object.assign({},t,{ref:i,children:a})):e.jsx(mo,Object.assign({},t,{ref:i,children:a}))}))}));const So="DisplayPreset.FULLSCREEN",xo="DisplayPreset.EMBEDDED",Co="DisplayPreset.ATTACHED",wo="ERROR",Oo="INFO",To="WARNING";var Ao;!function(e){e.PAYPAL="Paypal"}(Ao||(Ao={}));const jo="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DCUI_SCHEMA_VERSION:"",ROKT_DOMAIN:""};function*Ro(e,t,n){(function(e){return"object"==typeof e&&null!==e&&"type"in e&&Object.values(se).includes(e.type)})(n)&&!e.includes(n.type)&&(yield r.call(t.globalDispatch.bind(t),n))}function No(e,t){return!e||t<1?null:{cartItemId:e.cartItemId,catalogItemId:e.catalogItemId,name:e.title,description:e.description,quantity:t,currency:e.currency||"$",unitPrice:e.price||0,totalPrice:(e.price||0)*t,linkedProductId:e.linkedProductId,quantityMustBeSynchronized:e.quantityMustBeSynchronized,providerData:e.providerData||""}}function Lo(e){switch(typeof e){case"undefined":return"";case"object":return null===e?"":JSON.stringify(e);case"string":return e;default:return String(e)}}function Do(e){return i.map(Lo,e)}function*_o(e,t){const n=yield r.actionChannel(e,l.buffers.expanding(10));for(;n;){const e=yield r.take(n);yield r.call(t,e)}}function*ko(e,t){const n=yield r.take(e);yield r.call(t,n)}function*Po(e){for(;;){const t=yield r.take(e);yield r.put(t)}}function*$o(e,t){const n=i.over(i.lensProp("moduleName"),i.defaultTo("orchestrator"),t.payload.additionalInformation||{}),a=Object.assign(Object.assign({},t.payload),{additionalInformation:n?Do(n):{}});try{yield r.call(e,a)}catch(e){}t.payload.level===wo&&(yield r.put({type:ee,payload:{name:"PLACEMENT_FAILURE"}}),yield r.put({type:so.CLOSE_PLUGIN}))}const Fo="INVALID_RESPONSE_OBJECT",Go="FAILED_TO_OPEN_LINK",Mo="NO_PARENT_GUID",Bo="FAILED_TO_NOTIFY_INTERACTIVE",Uo="FAILED_TO_ESTABLISH_PARTNER_VALIDATION";var Vo=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(n[a[i]]=e[a[i]])}return n};function zo(e,t){return n=>n&&n.replace(e,t)}const qo=zo(/['""();{}@:[\]!/=]/g,""),Ho=/^(normal|italic|oblique( \d+deg)*)$/i,Wo=(e="")=>Ho.test(e)?e:void 0,Ko=zo(/[;{}@[\]!]/g,"");function Yo(e){const{fontFamily:t,sources:n}=e,a=Vo(e,["fontFamily","sources"]),i=document.fonts,o=new FontFace(t,n.join(", "),a);return i.add(o),o.load().catch((e=>(i.delete(o),Promise.reject(e))))}function Jo(e=[]){const t=Array.from(document.fonts.values());return Promise.all(e.map((e=>{const n=function(e){return{fontFamily:qo(e.fontFamily)||"",style:Wo(e.style),weight:qo(e.weight),sources:e.sources.map((e=>Ko(e)||"")),display:e.display}}(e);return t.find((e=>e.family===n.fontFamily&&e.weight===n.weight&&(e.style===n.style||!n.style)))?Promise.resolve():Yo(n).then((()=>{})).catch((e=>`${e}`.includes("SyntaxError")?(n.fontFamily='"'+n.fontFamily+'"',Yo(n).then((()=>{}))):Promise.reject(e))).catch((e=>Promise.resolve(`Error loading font: [Font (${JSON.stringify(n)})] [Message - ${e}]`)))}))).then((e=>{const t=e.filter(Boolean);return t.length>0?Promise.reject(t):Promise.resolve()}))}function Zo(e){const n=a.useDispatch(),i=a.useSelector((e=>{const t=e.fonts.map((e=>({fontFamily:e.fontFamily,style:e.fontStyle||"normal",weight:e.fontWeight,sources:e.src}))),n=t.find((e=>"rokt-icons"===e.fontFamily));if(n)n.display="block";else{const e=null!==(a=jo.ROKT_DOMAIN)&&void 0!==a?a:"";t.push(function(e=""){return{fontFamily:"rokt-icons",weight:"400",sources:[`url("${e}/icons/rokt-icons.woff") format("woff")`],display:"block"}}(e))}var a;return JSON.stringify(t)}));return t.useEffect((()=>{Jo(JSON.parse(i)).catch((e=>{const t={type:ao,payload:{level:Oo,code:"FAILED_TO_LOAD_FONT",message:`Error loading fonts:\n\t${e.join("\n\t")}`}};n(t)}))}),[i]),t.useEffect((()=>{const e=()=>{var e,t;null===(t=null===(e=window.frameElement)||void 0===e?void 0:e.iFrameResizer)||void 0===t||t.resize()};return document.fonts.addEventListener("loadingdone",e),()=>{document.fonts.removeEventListener("loadingdone",e)}}),[]),null}function Qo(e){return null!=e?e:null}function Xo(){return new Set([lo])}function er(e){return e.breakpoint.breakpoints[e.breakpoint.activeBreakpoint]||0}const tr=i.sortBy(i.prop(1)),nr=i.map(i.prop(0)),ar=e=>i.compose(i.findIndex(i.equals(e)),nr,tr,i.toPairs,i.pathOr({},["breakpoint","breakpoints"]));function ir(e){return ar(e.breakpoint.activeBreakpoint)(e)}function or(e,t){return e.customStates[`module${t}`]||{}}function rr(e){return`${e.name}:${e.parentGuid}`}function sr(e,t){return!e.processed.includes(rr(t))||(n=t.name,void 0!==A.find((e=>e===n)));var n}function lr(){return new Map}const cr={layout:function(e=Qo(),t){return t.type===Hi?t.payload:e},breakpoint:function(e={breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},t){var n;switch(t.type){case Ui:return Object.prototype.hasOwnProperty.call(e.breakpoints,t.payload.activeBreakpoint)?Object.assign(Object.assign({},e),{activeBreakpoint:t.payload.activeBreakpoint}):e;case Vi:return{activeBreakpoint:null!==(n=t.payload.activeBreakpoint)&&void 0!==n?n:"default",breakpoints:Object.assign({default:0},t.payload.breakpoints),initialised:!0};default:return e}},active:function(e=Xo(),t){var n,a;switch(t.type){case Mi:{const a=new Set(e);return a.add(null===(n=t.payload)||void 0===n?void 0:n.id),a}case Bi:{const n=new Set(e);return n.delete(null===(a=t.payload)||void 0===a?void 0:a.id),n}default:return e}},fonts:function(e=[],t){return t.type===qi?t.payload:e},signal:function(e={queue:[],processed:[]},t){switch(t.type){case Xi:return i.evolve({queue:n=>sr(e,t.payload.signal)?i.uniqBy(i.pipe(i.prop("signal"),rr),n.concat(t.payload)):n},e);case eo:return i.evolve({queue:e=>i.reject(i.pipe(i.prop("signal"),i.whereEq({name:t.payload.name,parentGuid:t.payload.parentGuid})))(e),processed:i.append(rr(t.payload))},e);default:return e}},serializableCache:function(e=lr(),t){switch(t.type){case Ji:case Zi:if(t.payload.key&&t.payload.value){return new Map([...e]).set(t.payload.key,t.payload.value)}return e;case Qi:{const n=new Map([...e]);return t.payload&&n.delete(t.payload),n}default:return e}},settings:function(e={closeOnComplete:!0},t){return t.type===Yi?i.mergeDeepWith(((e,t)=>i.isNil(t)?e:t),e,t.payload):e},customStates:function(e={root:{}},t){if(t.type===oo){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:"root";return i.assocPath([n,t.payload.key],Number(t.payload.value),e)}return e}return e}};function*dr(e,t){var n,a;try{const i=(null===(n=e.activeBreakpointEventChannel)||void 0===n?void 0:n.call(e,t.payload))||(a=t.payload,l.eventChannel((e=>{const t=Object.entries(a).reduce(((e,t)=>{const a=window.matchMedia(`(min-width: ${t[1]}px)`);return"addEventListener"in a&&"function"==typeof a.addEventListener?(a.addEventListener("change",n),e[t[0]]=a):"addListener"in a&&"function"==typeof a.addListener&&(a.addListener(n),e[t[0]]=a),e}),{});return setTimeout((()=>n()),0),()=>{Object.entries(t).forEach((e=>{const t=e[1];"removeEventListener"in t&&"function"==typeof t.removeEventListener?t.removeEventListener("change",n):"removeListener"in t&&"function"==typeof t.removeListener&&t.removeListener(n)}))};function n(){try{e(function(e,t){return Object.entries(e).reduce(((e,n)=>n[1].matches&&(t[n[0]]||0)>(t[e]||0)?n[0]:e),"default")}(t,a))}catch(t){e(t)}}})));try{let e=yield r.take(i);for(yield r.put({type:ro.INITIALISE_BREAKPOINT,payload:{activeBreakpoint:e,breakpoints:t.payload}});;)e=yield r.take(i),yield r.put({type:ro.UPDATE_ACTIVE_BREAKPOINT,payload:{activeBreakpoint:e}})}catch(e){const n=e;yield r.put({type:ao,payload:{level:To,code:"FAILED_TO_DETERMINE_BREAKPOINT",message:null==n?void 0:n.message,additionalInformation:{stack:null==n?void 0:n.stack,breakpoints:t.payload}}})}finally{(yield r.cancelled())&&i.close()}}catch(e){const n=e;yield r.put({type:ao,payload:{level:wo,code:"FAILED_TO_ESTABLISH_BREAKPOINT_CHANNEL",message:null==n?void 0:n.message,additionalInformation:{stack:null==n?void 0:n.stack,breakpoints:t.payload}}})}}function ur(e,t,n){return l.eventChannel((a=>{const i=e.subscribe((e=>{const t=n(e);t&&a({type:Wi,payload:t})}),(e=>{a(e)})),o=t.fonts.subscribe((e=>{a({type:qi,payload:e})}),(e=>{a(e)}));return()=>{i.unsubscribe(),o.unsubscribe()}}),l.buffers.sliding(2))}var pr=Object.freeze({__proto__:null,CartEvent:{UPDATE_CART_ITEM_MESSAGE:"UPDATE_CART_ITEM_MESSAGE",UPSERT_ALERT:"UPSERT_ALERT",DELETE_ALERT:"DELETE_ALERT",UPSERT_DELIVERY_DETAILS:"UPSERT_DELIVERY_DETAILS"}}),fr=Object.freeze({__proto__:null,PartnerMessage:{UpdateCartItem:"V2_UPDATE_CART_ITEM"},PlacementMessage:{CartItemUpdated:"V2_CART_ITEM_UPDATED"}}),yr=Object.freeze({__proto__:null,V1:pr,V2:fr}),hr=Object.freeze({__proto__:null,PartnerMessage:{CartItemInstantPurchaseResponse:"CART_ITEM_INSTANT_PURCHASE_RESPONSE"},PlacementMessage:{CartItemInstantPurchase:"CART_ITEM_INSTANT_PURCHASE"}}),mr=Object.freeze({__proto__:null,PartnerValidationEvent:{SET_PARTNER_VALIDATION_STATUS:"SET_PARTNER_VALIDATION_STATUS",OPT_IN_TO_PARTNER_VALIDATION:"OPT_IN_TO_PARTNER_VALIDATION",SHOW_PARTNER_VALIDATION_STATUS:"SHOW_PARTNER_VALIDATION_STATUS"}});const vr="LINK_NAVIGATION_REQUEST",gr="REALTIME_OFFER_FULFILLMENT_SUCCESS",br="REALTIME_OFFER_FULFILLMENT_FAILURE";var Ir=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())}))};const Er={newTab:"_blank",self:"_top",roktWebViewSDK:"roktWebViewSDK",inApp:"inApp",overrideLinkNavigation:"overrideLinkNavigation"};function Sr({url:e,urlBehavior:t,external:n},a=window){return Ir(this,void 0,void 0,(function*(){if(!e)return null;if("overrideLinkNavigation"===t)return n.partner.send(vr,{url:e}).then((()=>null));const i=Er[t];if(a.RoktWebViewSDK){const t=a.RoktWebViewSDK.open(e);return t?{ref:t}:null}if("_top"===i&&a.top)return a.top.location.href=e,null;const o=a.open(e,i);if(o)try{o.opener=null}catch(e){}return o?{ref:o}:null}))}var xr=Object.freeze({__proto__:null,openLink:Sr});function Cr(e,t,n,a){const i=function(e){return"object"==typeof e&&null!=e&&"message"in e&&"string"==typeof e.message&&e.message.includes("timed out")}(e),o=i?{originErrorCode:n}:void 0;return{type:ao,payload:{level:To,code:i?"COMMUNICATION_FAILURE_WITH_WSDK":n,message:t,additionalInformation:Object.assign(Object.assign({},o),a)}}}var wr=Object.freeze({__proto__:null,makePluginWarningAction:Cr});function Or(e){return null!=e&&"object"==typeof e&&"ref"in e&&"object"==typeof e.ref&&!Array.isArray(e.ref)&&null!=e.ref}var Tr=Object.freeze({__proto__:null,isWindow:Or}),Ar=Object.assign(Object.assign(Object.assign({},xr),wr),Tr);function jr(e){switch(e){case"ATTACHED":return Co;case"EMBEDDED":return xo;default:return So}}function Rr(e,t){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e.offsetBottom&&{bottom:Ke(e.offsetBottom)}),e.offsetLeft&&{left:Ke(e.offsetLeft)}),e.offsetRight&&{right:Ke(e.offsetRight)}),e.offsetTop&&{top:Ke(e.offsetTop)}),(e.offsetAnchorX||e.offsetAnchorY)&&{transform:`translate(${"center"===e.offsetAnchorX?e.offsetLeft?"-50%":"50%":"0"}, ${"center"===e.offsetAnchorY?e.offsetTop?"-50%":"50%":"0"})`}),e.maxWidth?{maxWidth:Ke(e.maxWidth)}:void 0),t)}function*Nr(e=10){(yield r.select((e=>e.signal.queue.length>0)))&&(yield c.delay(30),e>=1&&(yield*Nr(e-1)))}function*Lr(e){try{yield*Nr(10),yield c.call(e.close)}catch(e){const t=Ar.makePluginWarningAction(e,"Failed to close the plugin","FAILED_TO_CLOSE_PLUGIN");yield c.put(t)}}function*Dr(e,{payload:t}){var n;if("string"==typeof(n=t.name)&&L.includes(n))switch(t.name){case"V2_CART_ITEM_UPDATED":case"CART_ITEM_INSTANT_PURCHASE":case"UPSELL_CREATIVE_SENT":case"INITIATE_INSTANT_PURCHASE_EVENT":case"REALTIME_OFFER_FULFILLMENT_REFERRAL":case"REALTIME_OFFER_FULFILLMENT_CONVERSION":case"REALTIME_OFFER_FULFILLMENT_SUCCESS":yield e.send(t.name,t.body);break;case"OFFER_ENGAGEMENT":case"PLACEMENT_CLOSED":case"PLACEMENT_COMPLETED":case"PLACEMENT_FAILURE":case"PLACEMENT_INTERACTIVE":case"POSITIVE_ENGAGEMENT":yield e.send(t.name);break;default:return}}const _r=i.propOr("FAILED_TO_PARSE_CONFIG","code");function*kr(e,t){var n;const a=yield c.call(ur,e.configService,e.themeService,t);for(;;)try{const e=yield c.take(a);yield c.put(e)}catch(e){const t=e;yield c.put({type:ao,payload:{level:wo,code:_r(t),message:null!==(n=null==t?void 0:t.message)&&void 0!==n?n:"An error occured parsing or receiving Plugin config, fonts or configurables.",additionalInformation:{stack:null==t?void 0:t.stack}}})}}function*Pr(e,t){yield c.all([c.spawn(kr,e,t),c.takeEvery(ee,Dr,e.partnerInteractionService)])}function*$r(e,t,n){const a=function(e,t){if(!t)return{preset:jr(e)};switch(e){case"ATTACHED":return{autoresize:!0,applyHighestZIndex:!0,replaceTargetElement:"body",outerCss:Rr(t,{position:"fixed",width:"100%",minWidth:"1px"}),innerCss:{width:"100%"}};case"EMBEDDED":return{autoresize:!0,css:Rr(t,{width:"1px",minWidth:"100%"})};default:return{autoresize:!1,applyHighestZIndex:!0,replaceTargetElement:"body",css:Rr(t,{position:"fixed",height:"100%",width:"100%"})}}}(t,n);yield c.call(e.setDisplaySettings,a),yield c.put({type:ro.ACTIVE_ADD,payload:{id:co}})}function*Fr(e,t){var n;const a=null!==(n=t.payload.data)&&void 0!==n?n:{};try{yield r.call(e,{code:t.payload.code,level:Oo,message:t.payload.message||"Plugin Generic Log",additionalInformation:Do(a)})}catch(e){}}function*Gr(e){yield r.put({type:ro.QUEUE_SIGNAL,payload:{signal:e.payload}}),yield r.put({type:to})}function*Mr(e){yield r.put({type:ro.QUEUE_SIGNAL,payload:e.payload}),yield r.put({type:to})}function*Br(e,t){const n=yield r.select((e=>e.signal.queue.filter((t=>sr(e.signal,t.signal)))));if(Array.isArray(n)&&n.length)for(const e of n){const t="criteria"in e?e.criteria:void 0;switch(e.signal.name){case"SignalActivation":case"SignalLoadComplete":case"SignalImpression":yield*Ur(e.signal,a(t));break;case"SignalViewed":yield*Vr(e.signal,a(t));break;case"SignalDismissal":yield*zr(e.signal,a(t));break;case"SignalInstantPurchaseDismissal":yield*qr(e.signal,a(t));break;case"SignalLoadStart":yield*Hr(e.signal,a(t));break;case"SignalGatedResponse":case"SignalResponse":yield*Wr(e.signal,a(t,!0));break;case"SignalProductItemResponse":yield*Kr(e.signal,a(t));break;case"SignalUserInteraction":yield*Yr(e.signal,a(t));break;case"SignalCartItemQuantitySelected":yield*Jr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseInitiated":yield*Zr(e.signal,a(t));break;case"SignalCartItemInstantPurchase":yield*Qr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseFailure":yield*Xr(e.signal,a(t))}yield r.put({type:ro.SIGNAL_PROCESSED,payload:e.signal})}function a(t,n=!1){return function(a,i,o){return t?r.call(e.prepareExternalSignal,t.key,a,i,o):n?r.call(e.issueSignalSync,a,i,o):r.call(e.issueSignal,a,i,o)}}}function*Ur(e,t){let n;e.creativeInstanceGuid&&(n={},n.creativeInstanceGuid=e.creativeInstanceGuid);try{yield t(e.name,e.parentGuid,n)}catch(t){yield es(e,t)}}function*Vr(e,t){try{yield t(e.name,e.parentGuid,{objectData:{supportedByBrowser:e.supportedByBrowser.toString()},metadata:[{name:"inferred",value:e.inferred.toString()}]})}catch(t){yield es(e,t)}}function*zr(e,t){try{yield t(e.name,e.parentGuid,e.dismissalMethod?{objectData:{dismissalMethod:e.dismissalMethod}}:void 0)}catch(t){yield es(e,t)}}function*qr(e,t){try{yield t(e.name,e.parentGuid,void 0)}catch(t){yield es(e,t)}}function*Hr(e,t){var n;const a={overrideTimestamp:null!==(n=e.overrideTimestamp)&&void 0!==n?n:new Date};try{yield t(e.name,e.parentGuid,a)}catch(t){yield es(e,t)}}function*Wr(e,t){try{yield t(e.name,e.parentGuid,function(e){const t={creativeInstanceGuid:e.responseActionPayload.creativeInstanceGuid};"Url"===e.responseActionPayload.name&&(t.transformedTrafficURL=e.responseActionPayload.transformedTrafficURL);return t}(e))}catch(t){yield es(e,t)}}function*Kr(e,t){try{yield t(e.name,e.parentGuid,{objectData:{catalogItemId:e.objectData.catalogItemId,productSku:e.objectData.productSku,catalogId:e.objectData.catalogId,accountId:e.objectData.accountId}})}catch(t){yield es(e,t)}}function*Yr(e,t){const n=e.parentGuid?e.parentGuid:yield r.select((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid}));try{if(!n||"string"!=typeof n)throw new Error(`Cannot raise SignalUserInteraction, missing or invalid parent GUID: ${JSON.stringify(e)}`);yield t(e.name,n,{objectData:{action:e.action,context:e.context}})}catch(t){yield es(e,t)}}function*Jr(e,t){const n={objectData:{preselected:e.objectData.preselected.toString(),quantity:e.objectData.quantity.toString()}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield es(e,t)}}function*Zr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString()}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield es(e,t)}}function*Qr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString(),initiatedBy:e.objectData.initiatedBy}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield es(e,t)}}function*Xr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString(),failureReason:e.objectData.failureReason,providerId:e.objectData.providerId}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield es(e,t)}}function es(e,t){const n=Ar.makePluginWarningAction(t,(null==t?void 0:t.message)||"Failed to issue signal","FAILED_TO_ISSUE_SIGNAL",{signalName:null==e?void 0:e.name,parentGuid:null==e?void 0:e.parentGuid,stack:null==t?void 0:t.stack});return r.put(n)}function*ts(e){yield r.put({type:oo,payload:e.payload})}function*ns(e,t){if("Interactive"===t.payload.name)try{yield*function*(e){const t="METRIC";(yield r.select((e=>e.serializableCache.has(t))))||(yield r.call(e.notifyInteractive),yield r.put({type:Ji,payload:{key:t,value:"Interactive"}}))}(e)}catch(e){const t=e;yield*function*(e){var t;yield r.put({type:ao,payload:{level:Oo,code:Bo,message:null!==(t=null==e?void 0:e.message)&&void 0!==t?t:"Failed to notify interactive",additionalInformation:{stack:null==e?void 0:e.stack}}})}(t)}}function*as(e,t){const n=e.context.getOverrideLinkNavigation()?"overrideLinkNavigation":t.payload.urlBehaviour;try{"inApp"===n?yield r.call(e.createChildPlugin,{name:"url-modal",config:{url:t.payload.url,method:"GET"}}):yield r.call(Sr,{url:t.payload.url,urlBehavior:n,external:e})}catch(e){yield r.put(Cr(e,"Failed to open link",Go,{url:t.payload.url,urlBehaviour:n}))}}function*is(e){const t=yield r.select((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid}));yield r.put({type:ro.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Ki}),t?yield r.put({type:Z,payload:{name:"SignalDismissal",parentGuid:t,dismissalMethod:e.payload.dismissalMethod}}):yield r.put({type:ao,payload:{level:Oo,code:Mo,message:"ParentGuid does not exist"}})}const os=a.connect((function(e){return{isOpen:e.active.has(lo)}})),rs="undefined"!=typeof window;function ss(e,n){t.useEffect((()=>{if(!rs||n)return;const t=e.current;if(!t)return;const a=e=>{e.preventDefault()},i=["wheel","touchmove"];i.forEach((e=>{t.addEventListener(e,a,{passive:!1})}));const o=e=>{["ArrowUp","ArrowDown","PageUp","PageDown","Space"].includes(e.code)&&e.preventDefault()};return window.addEventListener("keydown",o),()=>{i.forEach((e=>{t.removeEventListener(e,a)})),window.removeEventListener("keydown",o)}}),[e,n])}const ls="Minimized",cs=()=>{const e=t.useRef(null),n=t.useRef(null),a=t.useRef(null),i=t.useRef(null),o=t.useRef(null),r=Et(0,(e=>e.customStates[ls])),s=bt(),l=Nn(),c=t.useRef(0),d=t.useRef(!1),u=t.useRef(0),p=t.useRef([]),f=t.useRef(void 0),{isDisabled:y}=m(l);ss(e,!!r);const h=t.useCallback((()=>{_(),f.current=void 0,d.current=!1,N(!0);v()?S():R(0)}),[]),v=()=>{const e=j();return r?e<=-.2:e>=.2};t.useEffect((()=>{r?(C(),s(us(!0))):(w(),s(us(!1)))}),[r,s]),t.useEffect((()=>{requestAnimationFrame((()=>{D(!r,a),D(!!r,i),L()}))}),[]);const b=t.useCallback((e=>{if(n.current){e.preventDefault();const t=E(e);R(t)}}),[n]),I=t.useCallback((e=>{Date.now()-u.current<200||(u.current=Date.now(),r?x(!1):d.current||y||(d.current=!0,A(),f.current=ds(e),N(!1),k()))}),[r,y]);t.useEffect((()=>{const e=n.current;return e&&(e.addEventListener("mousedown",I),e.addEventListener("touchstart",I)),()=>{null==e||e.removeEventListener("mousedown",I),null==e||e.removeEventListener("touchstart",I)}}),[n,I]);const E=e=>{var t,n;return(null!==(t=ds(e))&&void 0!==t?t:0)-(null!==(n=f.current)&&void 0!==n?n:0)},S=()=>{x(!r)},x=e=>{const t=(e=>({type:X,payload:{key:ls,value:e?1:0}}))(e);t&&s(t)},C=()=>{var e,t,n,o;const r=null!==(t=null===(e=a.current)||void 0===e?void 0:e.clientHeight)&&void 0!==t?t:0,s=(null!==(o=null===(n=i.current)||void 0===n?void 0:n.clientHeight)&&void 0!==o?o:0)-r;N(!0),L(!0,!0),R(s),D(!1,a),D(!0,i),P()},w=()=>{N(!0),L(!0,!1),R(0),f.current=void 0,D(!0,a),D(!1,i),$()},O=t.useCallback((()=>{d.current&&(T(),requestAnimationFrame(O))}),[]),T=()=>{p.current.push({yPosition:c.current,timestamp:Date.now()}),p.current.length>20&&p.current.shift()},A=t.useCallback((()=>{p.current=[],O()}),[O]),j=()=>{const e=p.current;if(!e)return 0;const t=e[0],n=e[e.length-1];if(!t||!n)return 0;const a=n.timestamp-t.timestamp;return(n.yPosition-t.yPosition)/a},R=e=>{const t=Math.round(e);c.current=t,n.current&&(n.current.style.transform=`translateY(${t}px)`)},N=e=>{e?n.current&&(n.current.style.transition="transform .2s"):n.current&&(n.current.style.transition="")},L=(e,t=!1)=>{const n=t?i:a,o=t?a:i;o.current&&(o.current.style.transition="opacity .5s"),n.current&&(n.current.style.transition="opacity .2s")},D=(e,t)=>{const n=t.current;if(!n)return;const a=e?0:1;n.style.opacity=`${a}`,e?n.style.pointerEvents="none":setTimeout((()=>{n.style.pointerEvents="auto"}),400)},_=t.useCallback((()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",h),document.removeEventListener("touchmove",b),document.removeEventListener("touchend",h)}),[b,h]),k=t.useCallback((()=>{g()?(document.addEventListener("touchmove",b,{passive:!1}),document.addEventListener("touchend",h)):(document.addEventListener("mousemove",b,{passive:!1}),document.addEventListener("mouseup",h))}),[b,h]),P=()=>{const t=e.current;t&&(o.current=setTimeout((()=>{var e;const n=((null===(e=a.current)||void 0===e?void 0:e.clientHeight)||0)+1;t.style.height=n+"px"}),200))},$=()=>{o.current&&clearTimeout(o.current),e.current&&(e.current.style.height="100000px")};return{wrapperRef:e,containerRef:n,minimizedChildRef:a,maximizedChildRef:i}};function ds(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientY:e.clientY}const us=e=>({type:Z,payload:{action:e?"BottomSheetMinimized":"BottomSheetMaximized",name:"SignalUserInteraction",context:"BottomSheetMinimized"}}),ps={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var fs;function ys({schema:n,testId:o}){const r=ue(),s=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),l=a.useSelector((e=>e.active.has(co))),c=t.useRef(null),d=a.useDispatch(),u=()=>{d({type:so.DISMISS_OVERLAY,payload:{id:lo,dismissalMethod:"rokt_backdrop"}})},p=Et(0,(e=>e.customStates[ls]));t.useEffect((()=>{f(!!p)}),[p]),ss(c,!!p);const f=e=>{const t=c.current;t&&(e?t.style.opacity="0":(t.style.display="flex",t.style.opacity="1"))};t.useEffect((()=>{s&&d({type:Z,payload:{name:"SignalActivation",parentGuid:s}})}),[s]),t.useEffect((()=>{l&&requestAnimationFrame((()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.focus()}))}),[l]);const y=Nn(),{tabIndex:h,isDisabled:v,styles:g}=m(y),b=n.styles?i.mergeRight(ps,n.styles):ps;return e.jsx(Na,{styles:b,children:({classnames:t})=>{var a;return e.jsx("div",{className:null==t?void 0:t.wrapper,style:Object.assign({height:"100%",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9998",overflow:"hidden",display:"flex",opacity:"1",transition:"opacity 0.2s ease-in-out"},g),"aria-label":null!==(a=n.a11yLabel)&&void 0!==a?a:void 0,"aria-hidden":v,role:"dialog","aria-modal":!0,tabIndex:h,"data-testid":o,"data-e2e":"Overlay-Wrapper",ref:c,children:e.jsx("div",{style:{position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},onClick:n.allowBackdropToClose?u:void 0,"data-testid":o&&`${o}-backdrop`,"data-e2e":"Overlay-Backdrop"})})}})}function hs(){return e.jsx("div",{style:{width:"48px",height:"4px",backgroundColor:"#C6C6C8",borderRadius:"2px",margin:"0 auto -4px",position:"relative",top:"6px"}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(fs||(fs={}));const ms={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};function vs(t){const n=a.useSelector((e=>e.slots)),i=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0}));return e.jsx(gs,Object.assign({},t,{slots:n,currentIndex:i}))}function gs(t){const{wrapperRef:n,containerRef:a,minimizedChildRef:i,maximizedChildRef:o}=cs();return t.isOpen?e.jsxs("div",{ref:n,style:{height:"100000px"},children:[e.jsx(ys,Object.assign({},t)),e.jsx(Is,Object.assign({},t,{containerRef:a,minimizedChildRef:i,maximizedChildRef:o}))]}):null}const bs=o.css`
57
+ `}}(r,l),x=Zt();if(!e.schema.customStateKey)throw new Error("No custom state key provided for state trigger node.");const S=x(e.schema.customStateKey),C={type:X,payload:{key:S,value:null!=d?d:1}},w={type:Z,payload:{name:"SignalUserInteraction",action:"Swipe",context:"SlideStateTrigger"}},O=e.schema.styles?M(oi,e.schema.styles):oi,T=t.useRef(null),A=t.useRef(null),j=t.useRef(null),R=t.useRef(!1),N=t.useRef(void 0),{isDisabled:L}=h(s);t.useEffect((()=>{if(n)return g()?(document.addEventListener("touchmove",_),document.addEventListener("touchend",D)):(document.addEventListener("mousemove",_),document.addEventListener("mouseup",D)),B}),[n]);const D=()=>{B(),N.current=void 0,a(!1),i||(G(!0),R.current?(F($()),P()):F(0))},k=e=>{n||i||L||(N.current=li(e),G(!1),a(!0))},_=e=>{var t,n;if(si(j)){const a=Math.min(Math.max(0,(null!==(t=li(e))&&void 0!==t?t:0)-(null!==(n=N.current)&&void 0!==n?n:0)),$());F(a),a/$()*100>=75?R.current=!0:R.current=!1}},P=()=>{var e,t;o(!0),c(C),c(w),null===(t=null===(e=si(T).parentElement)||void 0===e?void 0:e.parentElement)||void 0===t||t.focus()},$=()=>si(T).getBoundingClientRect().width-si(j).getBoundingClientRect().width,F=e=>{var t;si(j).style.transform=`translateX(${e}px)`,si(A).style.transform=`translateX(${e+(null===(t=si(j))||void 0===t?void 0:t.getBoundingClientRect().width)/2}px)`},G=e=>{e?(si(j).style.transition="transform .2s",si(A).style.transition="transform .2s"):(si(j).style.transition="",si(A).style.transition="")},B=()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",D),document.removeEventListener("touchmove",_),document.removeEventListener("touchend",D)};return t.createElement(Na,{styles:O},(({classnames:n})=>{var a,o,r,s,l,c;return t.createElement("div",{className:`${y}`,"data-testid":e.testId,"data-e2e":"SlideStateTrigger"},t.createElement("div",{className:`${m} ${null!==(a=null==n?void 0:n.own)&&void 0!==a?a:""}`,ref:T,"aria-hidden":!0,"data-testid":e.testId&&`${e.testId}-track`},(null==u?void 0:u.value)?t.createElement("div",{className:`${I} ${null!==(o=null==n?void 0:n.label)&&void 0!==o?o:""}`,"data-testid":e.testId&&`${e.testId}-label`},u.value):null,t.createElement("div",{className:`${v} ${null!==(r=null==n?void 0:n.fill)&&void 0!==r?r:""}`,ref:A,"data-testid":e.testId&&`${e.testId}-fill`}),t.createElement("div",{className:`${b} ${null!==(s=null==n?void 0:n.thumb)&&void 0!==s?s:""}`,ref:j,"data-testid":e.testId&&`${e.testId}-thumb`,"data-e2e":"SlideStateTrigger-thumb",onMouseDown:k,onTouchStart:k},null!==(l=null==f?void 0:f.icon)&&void 0!==l?l:"ArrowForward")),t.createElement("button",{className:E,"aria-label":null!=p?p:void 0,onClick:P,disabled:i||L,"data-testid":e.testId&&`${e.testId}-button`},null!==(c=null==u?void 0:u.value)&&void 0!==c?c:"Unlock Offers"))}))}function si(e){if(!e.current)throw new Error("Unexpected missing reference to required SlideStateTrigger Element");return e.current}function li(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientX:e.clientX}function ci(e){const n=Ct();return t.createElement(Na,{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",flexWrap:"wrap"},"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 di(e){const n=Nn(),a=bt(),i=Zt()(e.schema.customStateKey),o=Et(0,(e=>e.customStates[i])),{tabIndex:r,styles:s,isDisabled:l}=h(n),c=()=>{a({type:X,payload:{key:i,value:o?0:1}})};return t.createElement(Na,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:c,"data-testid":e.testId,"data-e2e":"ToggleButtonStateTrigger",disabled:l,"aria-disabled":l,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:r,style:Object.assign({cursor:"pointer"},s)},t.createElement(St,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function ui(e){const n=Ct();return t.createElement(Na,{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",overflowX:"auto"},"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 pi(e){const n=Ct();return t.createElement(Na,{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",overflowY:"auto"},"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 fi=t.createContext({extensions:{ctx:new Map,cache:[]}}),yi=()=>t.useContext(fi).extensions;function mi({extensions:e,extendStore:n,children:a}){const i=yi(),o=new Map([...i.ctx,...e.ctx]),r=i.cache.concat(e.cache);return t.createElement(fi.Provider,{value:{extensions:{ctx:o,cache:r},extendStore:n}},a)}function hi(e,t){const n=function(e){try{const t=JSON.parse(e);if(null!=t&&"object"==typeof t&&"type"in t&&"Extension"===t.type&&"name"in t&&"string"==typeof t.name&&t.name.trim().length>0&&"body"in t&&"object"==typeof t.body)return{type:"Extension",name:t.name,body:t.body}}catch(e){}return null}(t),a=n?e.ctx.get(n.name):null;return n&&a?[n,a]:null}function vi({data:e}){const n=hi(yi(),e);var a;if((e=>{const{extendStore:n,extensions:a}=t.useContext(fi);t.useEffect((()=>{e&&n&&!a.cache.includes(e.name)&&(n(e),a.cache.push(e.name))}),[e,a.cache,n])})((a=null==n?void 0:n[1])?{sagas:a.sagas,reducer:a.reducer,name:a.name,interceptors:a.interceptors}:void 0),n){const[e,t]=n;return t.componentFactory(e.body)}return null}function gi(e,n){if(v("Extension",e))return t.createElement(vi,{data:e.node.data})}function bi(e){const n=$n(),a=Rt(),i=Zt(),o=Ct(),r=bt(),s=t.useMemo((()=>a.catalogItems||[]),[a]),l=e=>i({data:e},"catalogItem");return t.useEffect((()=>{for(const e of s)r({type:Z,payload:{name:"SignalImpression",parentGuid:e.instanceGuid}})}),[s,r]),s.length>0?t.createElement(Na,{styles:e.schema.styles},(({classnames:a})=>t.createElement("div",{"data-testid":e.testId,"data-e2e":"CatalogStackedCollection",className:null==a?void 0:a.own,style:{display:"flex",flexDirection:"column"}},t.Children.toArray(s.map(((a,i)=>t.createElement(Bn,{context:a},t.createElement(Pn,{value:n(a)},t.createElement(Jt,{value:l(a)},o(e.schema.template,void 0,U(i,e.testId))))))))))):null}const Ii={BasicText:(e,t)=>Ua(e,t,!0),StaticLink:(e,t)=>ei(e,t,!0)};function Ei(e){const n=Ct();return t.createElement(wt,{value:n,overrides:Ii},t.createElement(St,null,(n=>t.createElement(Na,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:null==a?void 0:a.own,"data-testid":e.testId,"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 xi(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,U(t,a)))))}function Si(e){const n=Nn(),a=bt(),o=Ct(),r=Zt(),{event:s}=e.schema,{tabIndex:l,styles:c,isDisabled:d}=h(n),u=i.mapObjIndexed((e=>r(e)),s.data||{}),p=()=>{a({type:ee,payload:{name:s.type,body:{offerId:u.providerOfferId,title:u.title,description:u.description}}})};return t.createElement(Na,{styles:e.schema.styles},(({classnames:n,mapperRef:a})=>{var i;return t.createElement("button",{"aria-disabled":d,"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0,className:null==n?void 0:n.own,"data-e2e":"PartnerEventButtonTrigger","data-testid":e.testId,disabled:d,onClick:p,tabIndex:l,type:"button",style:Object.assign({cursor:"pointer"},c)},t.createElement(Jt,{value:r},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(Xt,{value:a(n)},xi(e,i,o))}(e.schema.children,n.own,a,o,e.testId):xi(e.schema.children,o,e.testId)))}))}function Ci(e){const n=bt(),a=Zt(),i=e.schema.delay?e.schema.delay:1,o=a(e.schema.customStateKey),r=Et(0,(e=>e.customStates[o]));return function({delay:e,callback:n}){const a=t.useRef(null);t.useEffect((()=>{a.current=setTimeout(n,e)}),[])}({delay:i,callback:()=>{n({type:X,payload:{key:o,value:r?0:1}})}}),null}function wi(e){const n=Nn(),a=Zt(),i=a(e.schema.value),o=bt(),r=a(e.schema.customStateKey),s=Et(0,(e=>e.customStates[r])),{tabIndex:l,styles:c,isDisabled:d}=h(n),u=()=>{navigator.clipboard.writeText(i),s||o({type:X,payload:{key:r,value:1}})};return t.createElement(Na,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:u,"data-testid":e.testId,"data-e2e":"CopyToClipboardButton",disabled:d,"aria-disabled":d,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:l,style:Object.assign({cursor:"pointer"},c)},t.createElement(St,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function Oi(e){const n=Nn(),a=bt(),i=Zt()(e.schema.customStateKey),{value:o}=e.schema,{tabIndex:r,styles:s,isDisabled:l}=h(n),c=()=>{a({type:X,payload:{key:i,value:o}})};return t.createElement(Na,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:c,"data-testid":e.testId,"data-e2e":"ButtonStateTrigger",disabled:l,"aria-disabled":l,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:r,style:Object.assign({backgroundColor:"transparent",cursor:"pointer",margin:0,padding:0},s)},t.createElement(St,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function Ti({schema:e,testId:n}){var a,o,r,s,l,c,u,p;const f=$n(),y=Rt(),m=Ct(),v=bt(),g=t.useMemo((()=>y.catalogItems||[]),[y]),b=Zt(),I=e=>b({data:e},"catalogItem"),E=Et(0,(e=>{return(t=e.breakpoint.activeBreakpoint,i.compose(i.findIndex(i.equals(t)),ye,fe,i.toPairs,i.pathOr({},["breakpoint","breakpoints"])))({breakpoint:Object.assign(Object.assign({},e.breakpoint),{initialised:!0})});var t})),x=Nn(),{tabIndex:S,isDisabled:C,styles:w}=h(x),O=e.viewableItems.length-1,[T]=d({slidesToScroll:null!==(a=e.viewableItems[Math.min(E,O)])&&void 0!==a?a:"auto",containScroll:"trimSnaps"});t.useEffect((()=>{for(const e of g)v({type:Z,payload:{name:"SignalImpression",parentGuid:e.instanceGuid}})}),[g,v]);const A=`${null!==(u=null===(c=null===(l=null===(s=null===(r=null===(o=e.styles)||void 0===o?void 0:o.elements)||void 0===r?void 0:r.own[E])||void 0===s?void 0:s.default)||void 0===l?void 0:l.container)||void 0===c?void 0:c.gap)&&void 0!==u?u:"0"}px`,j={overflow:"hidden"},R={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:A,alignItems:"stretch"},N=e.peekThroughSize[Math.min(E,e.peekThroughSize.length-1)],L=N?"fixed"===(D=N).type?`${D.value}px`:`${D.value}%`:"0px";var D;const k=null!==(p=e.viewableItems[Math.min(O,E)])&&void 0!==p?p:1,_={flex:`0 0 calc(${(e=>"0px"!==e&&"0%"!==e)(L)?`(100% - 2 * ${L} - (${k} + 1) * ${A})/${k}`:`(100% - (${k} - 1) * ${A})/${k}`})`,position:"relative",display:"flex",backgroundColor:"transparent"};return g.length>0?t.createElement(Na,{styles:e.styles},(({classnames:a})=>t.createElement("div",{ref:T,style:Object.assign(Object.assign({},j),w),"aria-disabled":C,tabIndex:S,className:null==a?void 0:a.own,"data-e2e":"CarouselDistribution","data-testid":n&&`${n}`},t.createElement("div",{style:R,"data-testid":n&&`${n}-container`,"data-e2e":"CarouselDistribution-Container"},t.Children.toArray(g.map(((a,i)=>t.createElement(Bn,{context:a},t.createElement(Pn,{value:f(a)},t.createElement(Jt,{value:I(a)},t.createElement("div",{style:_,"data-testid":n&&`${n}-slide-${i}`,"data-e2e":`CarouselDistribution-Slide-${i}`},m(e.template,void 0,U(i,n))))))))))))):null}function Ai(e){return()=>{throw new N("FAILED_CREATING_UNHANDLED_NODE",`The default mapper does not handle the ${e} node. Make sure when you use the NodeMapperProvider, you pass an override for ${e} node.`)}}const ji={Column:function(e,n){if("Column"===e.type)return t.createElement(La,{schema:e.node,testId:n})},Row:function(e,n){if("Row"===e.type)return t.createElement(Da,{schema:e.node,testId:n})},StaticImage:function(e,n){if("StaticImage"===e.type)return t.createElement(qa,{schema:e.node,testId:n})},DataImage:function(e,n){if("DataImage"===e.type)return t.createElement(Ha,{schema:e.node,testId:n})},CreativeResponse:function(e,n){if("CreativeResponse"===e.type)return t.createElement(za,{schema:e.node,testId:n})},OneByOneDistribution:Ai("OneByOneDistribution"),StackedDistribution:Ai("StackedDistribution"),CarouselDistribution:Ai("CarouselDistribution"),GroupedDistribution:Ai("GroupedDistribution"),ProgressIndicator:Ai("ProgressIndicator"),ProgressControl:Ai("ProgressControl"),When:function(e,n){if("When"===e.type)return t.createElement(ja,{schema:e.node,testId:n})},Overlay:Ai("Overlay"),CloseButton:Ai("CloseButton"),RichText:function(e,n){if("RichText"===e.type)return t.createElement(Ma,{schema:e.node,testId:n})},BasicText:Ua,StaticLink:ei,DataIcon:function(e,n){if("DataIcon"===e.type)return t.createElement(ni,{schema:e.node,testId:n})},StaticIcon:function(e,n){if("StaticIcon"===e.type)return t.createElement(Ka,{schema:e.node,testId:n})},ZStack:function(e,n){if("ZStack"===e.type)return t.createElement(ii,{schema:e.node,testId:n})},FlowRow:function(e,n){if("FlowRow"===e.type)return t.createElement(ci,{schema:e.node,testId:n})},SlideStateTrigger:function(e,n){if("SlideStateTrigger"===e.type)return t.createElement(ri,{schema:e.node,testId:n})},ToggleButtonStateTrigger:function(e,n){if("ToggleButtonStateTrigger"===e.type)return t.createElement(di,{schema:e.node,testId:n})},PartnerEventButtonTrigger:function(e,n){if("PartnerEventButtonTrigger"===e.type)return t.createElement(Si,{schema:e.node,testId:n})},TimerStateTrigger:function(e,n){if("TimerStateTrigger"===e.type)return t.createElement(Ci,{schema:e.node})},CatalogStackedCollection:function(e,n){if("CatalogStackedCollection"===e.type)return t.createElement(bi,{schema:e.node,testId:n})},CatalogResponseButton:Ai("CatalogResponseButton"),ScrollableRow:function(e,n){if("ScrollableRow"===e.type)return t.createElement(ui,{schema:e.node,testId:n})},ScrollableColumn:function(e,n){if("ScrollableColumn"===e.type)return t.createElement(pi,{schema:e.node,testId:n})},EscapeHatch:gi,BottomSheet:Ai("BottomSheet"),CatalogQuantityOption:Ai("CatalogQuantityOption"),CatalogRadioGroup:Ai("CatalogRadioGroup"),CatalogQuantityCounter:Ai("CatalogQuantityCounter"),InlineContainer:function(e,n){if("InlineContainer"===e.type)return t.createElement(Ei,{schema:e.node,testId:n})},CopyToClipboardButton:function(e,n){if("CopyToClipboardButton"===e.type)return t.createElement(wi,{schema:e.node,testId:n})},ButtonStateTrigger:function(e,n){if("ButtonStateTrigger"===e.type)return t.createElement(Oi,{schema:e.node,testId:n})},CatalogCombinedCollection:Ai("CatalogCombinedCollection"),CatalogCarouselCollection:function(e,n){if("CatalogCarouselCollection"===e.type)return t.createElement(Ti,{schema:e.node,testId:n})},IconGroup:Ai("IconGroup")};function Ri(e){return function(n,a,i){const o=a&&a[n.type],r=null!=o?o:ji[n.type];return t.createElement(Ja,{schema:n,reporter:e},r&&r(n,i)||function(e){throw new N("FAILED_CREATING_LAYOUT_NODE",`Failed to create layout node ${JSON.stringify(e)}`)}(n))}}const Ni={transformLinksToAnchorText:function(e={}){return{data:i.mapObjIndexed((e=>kt(e)?`<a target="_blank" href="${e.url}">${e.title}</a>`:""),e)}}};function Li(e){const{childLayouts:n}=e,a=bt(),[o,r]=t.useMemo((()=>{const e=i.indexBy(i.prop("childLayoutId"),n);return[e,i.mapObjIndexed((e=>e.childLayoutSchema.predicates),e)]}),[n]),s=Ea(r);t.useEffect((()=>{Object.entries(s).forEach((([e,t])=>{const n=o[e];t&&n&&a({type:re,payload:n})}))}),[s,o,a])}function Di(e){const{settings:n,dispatch:a,children:i}=e,o=Ht(n.offerData.creative.copy||{})(Ni.transformLinksToAnchorText(n.offerData.creative.links),"creativeLink"),r=Ri(n.logger),[s,l]=t.useState("ENABLED");return t.useEffect((()=>n.gateway.onInteractivityChange(l)),[n]),de(n.rootElement,a),t.createElement(en.Provider,{value:"VARIANT"},t.createElement(Ot.Provider,{value:n.rootElement},t.createElement(Vn.Provider,{value:n.pluginId},t.createElement(On,{context:n.gateway},t.createElement(An,{context:n.layoutSchema},t.createElement(qn.Provider,{value:n.schemaVersion},t.createElement(jt,{context:n.offerData},t.createElement(Pn,{value:Ln(n.offerData.creative)},t.createElement(Rn.Provider,{value:s},t.createElement(wt,{value:r},t.createElement(nn.Provider,{value:n.offerPositionIndex},t.createElement(gt.Provider,{value:a},t.createElement(Jt,{value:o},t.createElement(ki,null,t.createElement(Li,{childLayouts:n.childLayouts}),i))))))))))))))}function ki(e){var n;const{children:a}=e,o=zn(),r=function(){const[e,n]=t.useState(null),a=t.useContext(wn).get();return t.useEffect((()=>a.onGlobalStateChange((t=>{i.equals(t,e)||n(t)}))),[a]),e}(),s=t.useContext(Ot)||void 0,l=an(),c=t.useCallback((e=>ht(e,o,l,s)),[s]);return r?t.createElement(Xt,{value:c(Object.values(null!==(n=null==r?void 0:r.breakpoint.breakpoints)&&void 0!==n?n:{}))},t.createElement(It.Provider,{value:r},a)):null}function _i(e){return t.createElement("style",{"data-testid":e.testId},"\n* {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n}\nbody {\n margin: 0;\n font-family: sans-serif;\n}\np {\n margin: 0;\n}\nimg {\n max-width: 100%;\n}\n")}function Pi(e,t,n,a,i,o){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){o.current.isRunning=!0,i&&"in"===t&&function(e,t){e.style.height=`${t.clientHeight}px`}(i,e);const r=e.animate(n,{duration:a,iterations:1});return r.onfinish=()=>{"in"===t?xa(e):Sa(e),o.current.isRunning=!1},r.oncancel=()=>{"in"===t?xa(e):Sa(e),o.current.isRunning=!1},()=>{r.finish()}}return"in"===t?xa(e):Sa(e),()=>{}}const $i={FadeInOut:{in:[{opacity:0,display:"none"},{opacity:0,display:"none",offset:.5},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],out:[{opacity:1},{opacity:0,offset:.75},{opacity:0}]}};function Fi({visible:e,effect:n,children:a,parentElement:i,containerClassName:o}){const[r,s]=t.useState(e),l=t.useRef(null),c=t.useRef({isRunning:!1}),d=Ca(n);return t.useEffect((()=>{const t=new ResizeObserver((function(t){i&&e&&!c.current.isRunning&&t.forEach((e=>{e.contentBoxSize?function(e,t){var n;Array.isArray(e.contentBoxSize)&&e.contentBoxSize[0]?t.style.height=e.contentBoxSize[0].blockSize+"px":"object"==typeof(n=e.contentBoxSize)&&null!=n&&"blockSize"in n&&"number"==typeof n.blockSize&&"inlineSize"in n&&"number"==typeof n.inlineSize?t.style.height=e.contentBoxSize.blockSize+"px":t.style.height="auto"}(e,i):e.contentRect&&function(e,t){t.style.height=`${e.contentRect.height}px`}(e,i)}))}));return e&&l.current&&(xa(l.current),t.observe(l.current)),()=>{t.disconnect()}}),[e,i]),t.useEffect((()=>e&&!r&&l.current&&i?(s(!0),Pi(l.current,"in",$i[n.type].in,d,i,c)):!e&&r&&l.current&&i?(s(!1),Pi(l.current,"out",$i[n.type].out,d/2,i,c)):()=>{}),[e,i,d]),t.createElement("div",{ref:l,style:{display:"none"},className:o},a)}function Gi(e){const n=Ct();return t.createElement(Na,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:null==a?void 0:a.own,"data-testid":e.testId,style:{display:"flex",flexDirection:"column"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},n(e.schema.template))}))}const Mi="ACTIVE/ADD",Bi="ACTIVE/DELETE",Ui="BREAKPOINT/UPDATE_ACTIVE",Vi="BREAKPOINT/INITIALISE",zi="BREAKPOINT/SET_BREAKPOINTS",qi="FONTS/SET",Hi="LAYOUT/UPDATE",Wi="CONFIG/HANDLE",Ki="PLUGIN/CLOSE_PLUGIN",Yi="SETTINGS/SET",Ji="CACHE/ADD_SERIALIZED_VALUE",Zi="CACHE/UPDATE_SERIALIZED_VALUE",Qi="CACHE/CLEAR_SERIALIZED_VALUE",Xi="SIGNAL/QUEUE",eo="SIGNAL/PROCESSED",to="SIGNAL/PROCESS",no="OVERLAY/DISMISS_OVERLAY",ao="ERROR/REPORT",io="LOG",oo="CUSTOM_STATES/SET",ro={LAYOUT_UPDATE:Hi,UPDATE_ACTIVE_BREAKPOINT:Ui,INITIALISE_BREAKPOINT:Vi,ACTIVE_ADD:Mi,ACTIVE_DELETE:Bi,SET_FONTS:qi,QUEUE_SIGNAL:Xi,SIGNAL_PROCESSED:eo,CACHE_SERIALIZED_VALUE:Ji,UPDATE_CACHED_SERIALIZED_VALUE:Zi,CLEAR_SERIALIZED_VALUE_FROM_CACHE:Qi,SET_SETTINGS:Yi,SET_CUSTOM_STATE:oo},so={HANDLE_CONFIG:Wi,SET_BREAKPOINTS:zi,CLOSE_PLUGIN:Ki,RAISE_METRIC:V,PREPARE_SIGNAL:ne,DISMISS_OVERLAY:no,REPORT_ERROR:ao,LOG:io,OPEN_LINK:ae},lo="plugin-overlay",co="plugin";function uo(n){var i;const o=n.schema.styles,r=a.useDispatch(),s={type:(null===(i=n.action)||void 0===i?void 0:i.type)||no,payload:{id:lo,dismissalMethod:n.schema.dismissalMethod}},l=()=>{r(s)},c=Nn(),{tabIndex:d,styles:u,isDisabled:p}=h(c);return e.jsx(Na,{styles:o,children:({classnames:a})=>{var i;return e.jsx("button",{title:"Close",className:null==a?void 0:a.own,onClick:l,"data-testid":n.testId,"data-e2e":"CloseButton",disabled:p,tabIndex:d,"aria-disabled":p,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:void 0,style:Object.assign({cursor:"pointer"},u),children:e.jsx(St,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}const po={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var fo;function yo({isOpen:n,schema:o,testId:r,children:s}){const l=ue(),c=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),d=a.useSelector((e=>e.active.has(co))),u=a.useDispatch(),p=()=>{u({type:so.DISMISS_OVERLAY,payload:{id:lo,dismissalMethod:"rokt_backdrop"}})};t.useEffect((()=>{c&&u({type:Z,payload:{name:"SignalActivation",parentGuid:c}})}),[c]),t.useEffect((()=>{d&&requestAnimationFrame((()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}))}),[d]);const f=Nn(),{tabIndex:y,isDisabled:m,styles:v}=h(f),g=o.styles?i.mergeRight(po,o.styles):po;if(!n)return null;const b=e.jsx(St,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(Na,{styles:g,children:({classnames:t})=>{var n;return e.jsxs("div",{className:null==t?void 0:t.wrapper,style:Object.assign({position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9999",display:"flex",overflow:"auto"},v),"aria-label":null!==(n=o.a11yLabel)&&void 0!==n?n:void 0,"aria-hidden":m,role:"dialog","aria-modal":!0,tabIndex:y,"data-testid":r,"data-e2e":"Overlay-Wrapper",children:[e.jsx("div",{style:{position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},onClick:o.allowBackdropToClose?p:void 0,"data-testid":r&&`${r}-backdrop`,"data-e2e":"Overlay-Backdrop"}),s(b,l)]})}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(fo||(fo={}));const mo={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const ho=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(mo,t.styles):mo;return e.jsx(Na,{styles:r,children:({classnames:t})=>e.jsx("div",{className:null==t?void 0:t.own,style:{position:"relative",zIndex:"3",outline:"none"},ref:o,tabIndex:-1,"data-e2e":"Overlay-Container","data-testid":n&&`${n}-container`,children:a})})}));const vo=a.connect((function(e){return{isOpen:e.active.has(lo)}}))((function(t){return e.jsx(yo,Object.assign({},t,{children:(n,a)=>e.jsx(ho,Object.assign({},t,{ref:a,children:n}))}))}));const go=a.connect((function(e){return{isOpen:e.active.has(lo)}})),bo={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const Io=t.forwardRef((function({schema:n,testId:a,children:o},r){const s=t.useRef(null),l=n.styles?i.mergeRight(bo,n.styles):bo;return t.useEffect((()=>{if(s.current)return function(e){const t=requestAnimationFrame((()=>{e&&e.style.setProperty("max-height","100%")}));return()=>{cancelAnimationFrame(t)}}(s.current)}),[]),e.jsx(Na,{styles:l,children:({classnames:t})=>e.jsx("div",{style:{width:"100%",maxHeight:"0%",transition:"max-height 0.8s",transitionTimingFunction:"cubic-bezier(0.05, 0.7, 0.1, 1.0)",alignSelf:"flex-end"},ref:s,children:e.jsx("div",{className:null==t?void 0:t.own,style:{position:"relative",zIndex:"3",outline:"none",borderBottomLeftRadius:"0",borderBottomRightRadius:"0"},ref:r,tabIndex:-1,"data-testid":a&&`${a}-container`,"data-e2e":"BottomSheet-Container",children:o})})})}));const Eo=go((function(t){const n=a.useSelector((e=>e.breakpoint.activeBreakpoint));return e.jsx(yo,Object.assign({},t,{children:(a,i)=>"default"===n?e.jsx(Io,Object.assign({},t,{ref:i,children:a})):e.jsx(ho,Object.assign({},t,{ref:i,children:a}))}))}));const xo="DisplayPreset.FULLSCREEN",So="DisplayPreset.EMBEDDED",Co="DisplayPreset.ATTACHED",wo="ERROR",Oo="INFO",To="WARNING";var Ao;!function(e){e.PAYPAL="Paypal"}(Ao||(Ao={}));const jo="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DCUI_SCHEMA_VERSION:"",ROKT_DOMAIN:""};function*Ro(e,t,n){(function(e){return"object"==typeof e&&null!==e&&"type"in e&&Object.values(se).includes(e.type)})(n)&&!e.includes(n.type)&&(yield r.call(t.globalDispatch.bind(t),n))}function No(e,t){return!e||t<1?null:{cartItemId:e.cartItemId,catalogItemId:e.catalogItemId,name:e.title,description:e.description,quantity:t,currency:e.currency||"$",unitPrice:e.price||0,totalPrice:(e.price||0)*t,linkedProductId:e.linkedProductId,quantityMustBeSynchronized:e.quantityMustBeSynchronized,providerData:e.providerData||""}}function Lo(e){switch(typeof e){case"undefined":return"";case"object":return null===e?"":JSON.stringify(e);case"string":return e;default:return String(e)}}function Do(e){return i.map(Lo,e)}function*ko(e,t){const n=yield r.actionChannel(e,l.buffers.expanding(10));for(;n;){const e=yield r.take(n);yield r.call(t,e)}}function*_o(e,t){const n=yield r.take(e);yield r.call(t,n)}function*Po(e){for(;;){const t=yield r.take(e);yield r.put(t)}}function*$o(e,t){const n=i.over(i.lensProp("moduleName"),i.defaultTo("orchestrator"),t.payload.additionalInformation||{}),a=Object.assign(Object.assign({},t.payload),{additionalInformation:n?Do(n):{}});try{yield r.call(e,a)}catch(e){}t.payload.level===wo&&(yield r.put({type:ee,payload:{name:"PLACEMENT_FAILURE"}}),yield r.put({type:so.CLOSE_PLUGIN}))}const Fo="INVALID_RESPONSE_OBJECT",Go="FAILED_TO_OPEN_LINK",Mo="NO_PARENT_GUID",Bo="FAILED_TO_NOTIFY_INTERACTIVE",Uo="FAILED_TO_ESTABLISH_PARTNER_VALIDATION";var Vo=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(n[a[i]]=e[a[i]])}return n};function zo(e,t){return n=>n&&n.replace(e,t)}const qo=zo(/['""();{}@:[\]!/=]/g,""),Ho=/^(normal|italic|oblique( \d+deg)*)$/i,Wo=(e="")=>Ho.test(e)?e:void 0,Ko=zo(/[;{}@[\]!]/g,"");function Yo(e){const{fontFamily:t,sources:n}=e,a=Vo(e,["fontFamily","sources"]),i=document.fonts,o=new FontFace(t,n.join(", "),a);return i.add(o),o.load().catch((e=>(i.delete(o),Promise.reject(e))))}function Jo(e=[]){const t=Array.from(document.fonts.values());return Promise.all(e.map((e=>{const n=function(e){return{fontFamily:qo(e.fontFamily)||"",style:Wo(e.style),weight:qo(e.weight),sources:e.sources.map((e=>Ko(e)||"")),display:e.display}}(e);return t.find((e=>e.family===n.fontFamily&&e.weight===n.weight&&(e.style===n.style||!n.style)))?Promise.resolve():Yo(n).then((()=>{})).catch((e=>`${e}`.includes("SyntaxError")?(n.fontFamily='"'+n.fontFamily+'"',Yo(n).then((()=>{}))):Promise.reject(e))).catch((e=>Promise.resolve(`Error loading font: [Font (${JSON.stringify(n)})] [Message - ${e}]`)))}))).then((e=>{const t=e.filter(Boolean);return t.length>0?Promise.reject(t):Promise.resolve()}))}function Zo(e){const n=a.useDispatch(),i=a.useSelector((e=>{const t=e.fonts.map((e=>({fontFamily:e.fontFamily,style:e.fontStyle||"normal",weight:e.fontWeight,sources:e.src}))),n=t.find((e=>"rokt-icons"===e.fontFamily));if(n)n.display="block";else{const e=null!==(a=jo.ROKT_DOMAIN)&&void 0!==a?a:"";t.push(function(e=""){return{fontFamily:"rokt-icons",weight:"400",sources:[`url("${e}/icons/rokt-icons.woff") format("woff")`],display:"block"}}(e))}var a;return JSON.stringify(t)}));return t.useEffect((()=>{Jo(JSON.parse(i)).catch((e=>{const t={type:ao,payload:{level:Oo,code:"FAILED_TO_LOAD_FONT",message:`Error loading fonts:\n\t${e.join("\n\t")}`}};n(t)}))}),[i]),t.useEffect((()=>{const e=()=>{var e,t;null===(t=null===(e=window.frameElement)||void 0===e?void 0:e.iFrameResizer)||void 0===t||t.resize()};return document.fonts.addEventListener("loadingdone",e),()=>{document.fonts.removeEventListener("loadingdone",e)}}),[]),null}function Qo(e){return null!=e?e:null}function Xo(){return new Set([lo])}function er(e){return e.breakpoint.breakpoints[e.breakpoint.activeBreakpoint]||0}const tr=i.sortBy(i.prop(1)),nr=i.map(i.prop(0)),ar=e=>i.compose(i.findIndex(i.equals(e)),nr,tr,i.toPairs,i.pathOr({},["breakpoint","breakpoints"]));function ir(e){return ar(e.breakpoint.activeBreakpoint)(e)}function or(e,t){return e.customStates[`module${t}`]||{}}function rr(e){return`${e.name}:${e.parentGuid}`}function sr(e,t){return!e.processed.includes(rr(t))||(n=t.name,void 0!==A.find((e=>e===n)));var n}function lr(){return new Map}const cr={layout:function(e=Qo(),t){return t.type===Hi?t.payload:e},breakpoint:function(e={breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},t){var n;switch(t.type){case Ui:return Object.prototype.hasOwnProperty.call(e.breakpoints,t.payload.activeBreakpoint)?Object.assign(Object.assign({},e),{activeBreakpoint:t.payload.activeBreakpoint}):e;case Vi:return{activeBreakpoint:null!==(n=t.payload.activeBreakpoint)&&void 0!==n?n:"default",breakpoints:Object.assign({default:0},t.payload.breakpoints),initialised:!0};default:return e}},active:function(e=Xo(),t){var n,a;switch(t.type){case Mi:{const a=new Set(e);return a.add(null===(n=t.payload)||void 0===n?void 0:n.id),a}case Bi:{const n=new Set(e);return n.delete(null===(a=t.payload)||void 0===a?void 0:a.id),n}default:return e}},fonts:function(e=[],t){return t.type===qi?t.payload:e},signal:function(e={queue:[],processed:[]},t){switch(t.type){case Xi:return i.evolve({queue:n=>sr(e,t.payload.signal)?i.uniqBy(i.pipe(i.prop("signal"),rr),n.concat(t.payload)):n},e);case eo:return i.evolve({queue:e=>i.reject(i.pipe(i.prop("signal"),i.whereEq({name:t.payload.name,parentGuid:t.payload.parentGuid})))(e),processed:i.append(rr(t.payload))},e);default:return e}},serializableCache:function(e=lr(),t){switch(t.type){case Ji:case Zi:if(t.payload.key&&t.payload.value){return new Map([...e]).set(t.payload.key,t.payload.value)}return e;case Qi:{const n=new Map([...e]);return t.payload&&n.delete(t.payload),n}default:return e}},settings:function(e={closeOnComplete:!0},t){return t.type===Yi?i.mergeDeepWith(((e,t)=>i.isNil(t)?e:t),e,t.payload):e},customStates:function(e={root:{}},t){if(t.type===oo){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:"root";return i.assocPath([n,t.payload.key],Number(t.payload.value),e)}return e}return e}};function*dr(e,t){var n,a;try{const i=(null===(n=e.activeBreakpointEventChannel)||void 0===n?void 0:n.call(e,t.payload))||(a=t.payload,l.eventChannel((e=>{const t=Object.entries(a).reduce(((e,t)=>{const a=window.matchMedia(`(min-width: ${t[1]}px)`);return"addEventListener"in a&&"function"==typeof a.addEventListener?(a.addEventListener("change",n),e[t[0]]=a):"addListener"in a&&"function"==typeof a.addListener&&(a.addListener(n),e[t[0]]=a),e}),{});return setTimeout((()=>n()),0),()=>{Object.entries(t).forEach((e=>{const t=e[1];"removeEventListener"in t&&"function"==typeof t.removeEventListener?t.removeEventListener("change",n):"removeListener"in t&&"function"==typeof t.removeListener&&t.removeListener(n)}))};function n(){try{e(function(e,t){return Object.entries(e).reduce(((e,n)=>n[1].matches&&(t[n[0]]||0)>(t[e]||0)?n[0]:e),"default")}(t,a))}catch(t){e(t)}}})));try{let e=yield r.take(i);for(yield r.put({type:ro.INITIALISE_BREAKPOINT,payload:{activeBreakpoint:e,breakpoints:t.payload}});;)e=yield r.take(i),yield r.put({type:ro.UPDATE_ACTIVE_BREAKPOINT,payload:{activeBreakpoint:e}})}catch(e){const n=e;yield r.put({type:ao,payload:{level:To,code:"FAILED_TO_DETERMINE_BREAKPOINT",message:null==n?void 0:n.message,additionalInformation:{stack:null==n?void 0:n.stack,breakpoints:t.payload}}})}finally{(yield r.cancelled())&&i.close()}}catch(e){const n=e;yield r.put({type:ao,payload:{level:wo,code:"FAILED_TO_ESTABLISH_BREAKPOINT_CHANNEL",message:null==n?void 0:n.message,additionalInformation:{stack:null==n?void 0:n.stack,breakpoints:t.payload}}})}}function ur(e,t,n){return l.eventChannel((a=>{const i=e.subscribe((e=>{const t=n(e);t&&a({type:Wi,payload:t})}),(e=>{a(e)})),o=t.fonts.subscribe((e=>{a({type:qi,payload:e})}),(e=>{a(e)}));return()=>{i.unsubscribe(),o.unsubscribe()}}),l.buffers.sliding(2))}var pr=Object.freeze({__proto__:null,CartEvent:{UPDATE_CART_ITEM_MESSAGE:"UPDATE_CART_ITEM_MESSAGE",UPSERT_ALERT:"UPSERT_ALERT",DELETE_ALERT:"DELETE_ALERT",UPSERT_DELIVERY_DETAILS:"UPSERT_DELIVERY_DETAILS"}}),fr=Object.freeze({__proto__:null,PartnerMessage:{UpdateCartItem:"V2_UPDATE_CART_ITEM"},PlacementMessage:{CartItemUpdated:"V2_CART_ITEM_UPDATED"}}),yr=Object.freeze({__proto__:null,V1:pr,V2:fr}),mr=Object.freeze({__proto__:null,PartnerMessage:{CartItemInstantPurchaseResponse:"CART_ITEM_INSTANT_PURCHASE_RESPONSE"},PlacementMessage:{CartItemInstantPurchase:"CART_ITEM_INSTANT_PURCHASE"}}),hr=Object.freeze({__proto__:null,PartnerValidationEvent:{SET_PARTNER_VALIDATION_STATUS:"SET_PARTNER_VALIDATION_STATUS",OPT_IN_TO_PARTNER_VALIDATION:"OPT_IN_TO_PARTNER_VALIDATION",SHOW_PARTNER_VALIDATION_STATUS:"SHOW_PARTNER_VALIDATION_STATUS"}});const vr="LINK_NAVIGATION_REQUEST",gr="REALTIME_OFFER_FULFILLMENT_SUCCESS",br="REALTIME_OFFER_FULFILLMENT_FAILURE";var Ir=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())}))};const Er={newTab:"_blank",self:"_top",roktWebViewSDK:"roktWebViewSDK",inApp:"inApp",overrideLinkNavigation:"overrideLinkNavigation"};function xr({url:e,urlBehavior:t,external:n},a=window){return Ir(this,void 0,void 0,(function*(){if(!e)return null;if("overrideLinkNavigation"===t)return n.partner.send(vr,{url:e}).then((()=>null));const i=Er[t];if(a.RoktWebViewSDK){const t=a.RoktWebViewSDK.open(e);return t?{ref:t}:null}if("_top"===i&&a.top)return a.top.location.href=e,null;const o=a.open(e,i);if(o)try{o.opener=null}catch(e){}return o?{ref:o}:null}))}var Sr=Object.freeze({__proto__:null,openLink:xr});function Cr(e,t,n,a){const i=function(e){return"object"==typeof e&&null!=e&&"message"in e&&"string"==typeof e.message&&e.message.includes("timed out")}(e),o=i?{originErrorCode:n}:void 0;return{type:ao,payload:{level:To,code:i?"COMMUNICATION_FAILURE_WITH_WSDK":n,message:t,additionalInformation:Object.assign(Object.assign({},o),a)}}}var wr=Object.freeze({__proto__:null,makePluginWarningAction:Cr});function Or(e){return null!=e&&"object"==typeof e&&"ref"in e&&"object"==typeof e.ref&&!Array.isArray(e.ref)&&null!=e.ref}var Tr=Object.freeze({__proto__:null,isWindow:Or}),Ar=Object.assign(Object.assign(Object.assign({},Sr),wr),Tr);function jr(e){switch(e){case"ATTACHED":return Co;case"EMBEDDED":return So;default:return xo}}function Rr(e,t){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e.offsetBottom&&{bottom:Ke(e.offsetBottom)}),e.offsetLeft&&{left:Ke(e.offsetLeft)}),e.offsetRight&&{right:Ke(e.offsetRight)}),e.offsetTop&&{top:Ke(e.offsetTop)}),(e.offsetAnchorX||e.offsetAnchorY)&&{transform:`translate(${"center"===e.offsetAnchorX?e.offsetLeft?"-50%":"50%":"0"}, ${"center"===e.offsetAnchorY?e.offsetTop?"-50%":"50%":"0"})`}),e.maxWidth?{maxWidth:Ke(e.maxWidth)}:void 0),t)}function*Nr(e=10){(yield r.select((e=>e.signal.queue.length>0)))&&(yield c.delay(30),e>=1&&(yield*Nr(e-1)))}function*Lr(e){try{yield*Nr(10),yield c.call(e.close)}catch(e){const t=Ar.makePluginWarningAction(e,"Failed to close the plugin","FAILED_TO_CLOSE_PLUGIN");yield c.put(t)}}function*Dr(e,{payload:t}){var n;if("string"==typeof(n=t.name)&&L.includes(n))switch(t.name){case"V2_CART_ITEM_UPDATED":case"CART_ITEM_INSTANT_PURCHASE":case"UPSELL_CREATIVE_SENT":case"INITIATE_INSTANT_PURCHASE_EVENT":case"REALTIME_OFFER_FULFILLMENT_REFERRAL":case"REALTIME_OFFER_FULFILLMENT_CONVERSION":case"REALTIME_OFFER_FULFILLMENT_SUCCESS":yield e.send(t.name,t.body);break;case"OFFER_ENGAGEMENT":case"PLACEMENT_CLOSED":case"PLACEMENT_COMPLETED":case"PLACEMENT_FAILURE":case"PLACEMENT_INTERACTIVE":case"POSITIVE_ENGAGEMENT":yield e.send(t.name);break;default:return}}const kr=i.propOr("FAILED_TO_PARSE_CONFIG","code");function*_r(e,t){var n;const a=yield c.call(ur,e.configService,e.themeService,t);for(;;)try{const e=yield c.take(a);yield c.put(e)}catch(e){const t=e;yield c.put({type:ao,payload:{level:wo,code:kr(t),message:null!==(n=null==t?void 0:t.message)&&void 0!==n?n:"An error occured parsing or receiving Plugin config, fonts or configurables.",additionalInformation:{stack:null==t?void 0:t.stack}}})}}function*Pr(e,t){yield c.all([c.spawn(_r,e,t),c.takeEvery(ee,Dr,e.partnerInteractionService)])}function*$r(e,t,n){const a=function(e,t){if(!t)return{preset:jr(e)};switch(e){case"ATTACHED":return{autoresize:!0,applyHighestZIndex:!0,replaceTargetElement:"body",outerCss:Rr(t,{position:"fixed",width:"100%",minWidth:"1px"}),innerCss:{width:"100%"}};case"EMBEDDED":return{autoresize:!0,css:Rr(t,{width:"1px",minWidth:"100%"})};default:return{autoresize:!1,applyHighestZIndex:!0,replaceTargetElement:"body",css:Rr(t,{position:"fixed",height:"100%",width:"100%"})}}}(t,n);yield c.call(e.setDisplaySettings,a),yield c.put({type:ro.ACTIVE_ADD,payload:{id:co}})}function*Fr(e,t){var n;const a=null!==(n=t.payload.data)&&void 0!==n?n:{};try{yield r.call(e,{code:t.payload.code,level:Oo,message:t.payload.message||"Plugin Generic Log",additionalInformation:Do(a)})}catch(e){}}function*Gr(e){yield r.put({type:ro.QUEUE_SIGNAL,payload:{signal:e.payload}}),yield r.put({type:to})}function*Mr(e){yield r.put({type:ro.QUEUE_SIGNAL,payload:e.payload}),yield r.put({type:to})}function*Br(e,t){const n=yield r.select((e=>e.signal.queue.filter((t=>sr(e.signal,t.signal)))));if(Array.isArray(n)&&n.length)for(const e of n){const t="criteria"in e?e.criteria:void 0;switch(e.signal.name){case"SignalActivation":case"SignalLoadComplete":case"SignalImpression":yield*Ur(e.signal,a(t));break;case"SignalViewed":yield*Vr(e.signal,a(t));break;case"SignalDismissal":yield*zr(e.signal,a(t));break;case"SignalInstantPurchaseDismissal":yield*qr(e.signal,a(t));break;case"SignalLoadStart":yield*Hr(e.signal,a(t));break;case"SignalGatedResponse":case"SignalResponse":yield*Wr(e.signal,a(t,!0));break;case"SignalProductItemResponse":yield*Kr(e.signal,a(t));break;case"SignalUserInteraction":yield*Yr(e.signal,a(t));break;case"SignalCartItemQuantitySelected":yield*Jr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseInitiated":yield*Zr(e.signal,a(t));break;case"SignalCartItemInstantPurchase":yield*Qr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseFailure":yield*Xr(e.signal,a(t))}yield r.put({type:ro.SIGNAL_PROCESSED,payload:e.signal})}function a(t,n=!1){return function(a,i,o){return t?r.call(e.prepareExternalSignal,t.key,a,i,o):n?r.call(e.issueSignalSync,a,i,o):r.call(e.issueSignal,a,i,o)}}}function*Ur(e,t){let n;e.creativeInstanceGuid&&(n={},n.creativeInstanceGuid=e.creativeInstanceGuid);try{yield t(e.name,e.parentGuid,n)}catch(t){yield es(e,t)}}function*Vr(e,t){try{yield t(e.name,e.parentGuid,{objectData:{supportedByBrowser:e.supportedByBrowser.toString()},metadata:[{name:"inferred",value:e.inferred.toString()}]})}catch(t){yield es(e,t)}}function*zr(e,t){try{yield t(e.name,e.parentGuid,e.dismissalMethod?{objectData:{dismissalMethod:e.dismissalMethod}}:void 0)}catch(t){yield es(e,t)}}function*qr(e,t){try{yield t(e.name,e.parentGuid,void 0)}catch(t){yield es(e,t)}}function*Hr(e,t){var n;const a={overrideTimestamp:null!==(n=e.overrideTimestamp)&&void 0!==n?n:new Date};try{yield t(e.name,e.parentGuid,a)}catch(t){yield es(e,t)}}function*Wr(e,t){try{yield t(e.name,e.parentGuid,function(e){const t={creativeInstanceGuid:e.responseActionPayload.creativeInstanceGuid};"Url"===e.responseActionPayload.name&&(t.transformedTrafficURL=e.responseActionPayload.transformedTrafficURL);return t}(e))}catch(t){yield es(e,t)}}function*Kr(e,t){try{yield t(e.name,e.parentGuid,{objectData:{catalogItemId:e.objectData.catalogItemId,productSku:e.objectData.productSku,catalogId:e.objectData.catalogId,accountId:e.objectData.accountId}})}catch(t){yield es(e,t)}}function*Yr(e,t){const n=e.parentGuid?e.parentGuid:yield r.select((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid}));try{if(!n||"string"!=typeof n)throw new Error(`Cannot raise SignalUserInteraction, missing or invalid parent GUID: ${JSON.stringify(e)}`);yield t(e.name,n,{objectData:{action:e.action,context:e.context}})}catch(t){yield es(e,t)}}function*Jr(e,t){const n={objectData:{preselected:e.objectData.preselected.toString(),quantity:e.objectData.quantity.toString()}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield es(e,t)}}function*Zr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString()}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield es(e,t)}}function*Qr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString(),initiatedBy:e.objectData.initiatedBy}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield es(e,t)}}function*Xr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString(),failureReason:e.objectData.failureReason,providerId:e.objectData.providerId}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield es(e,t)}}function es(e,t){const n=Ar.makePluginWarningAction(t,(null==t?void 0:t.message)||"Failed to issue signal","FAILED_TO_ISSUE_SIGNAL",{signalName:null==e?void 0:e.name,parentGuid:null==e?void 0:e.parentGuid,stack:null==t?void 0:t.stack});return r.put(n)}function*ts(e){yield r.put({type:oo,payload:e.payload})}function*ns(e,t){if("Interactive"===t.payload.name)try{yield*function*(e){const t="METRIC";(yield r.select((e=>e.serializableCache.has(t))))||(yield r.call(e.notifyInteractive),yield r.put({type:Ji,payload:{key:t,value:"Interactive"}}))}(e)}catch(e){const t=e;yield*function*(e){var t;yield r.put({type:ao,payload:{level:Oo,code:Bo,message:null!==(t=null==e?void 0:e.message)&&void 0!==t?t:"Failed to notify interactive",additionalInformation:{stack:null==e?void 0:e.stack}}})}(t)}}function*as(e,t){const n=e.context.getOverrideLinkNavigation()?"overrideLinkNavigation":t.payload.urlBehaviour;try{"inApp"===n?yield r.call(e.createChildPlugin,{name:"url-modal",config:{url:t.payload.url,method:"GET"}}):yield r.call(xr,{url:t.payload.url,urlBehavior:n,external:e})}catch(e){yield r.put(Cr(e,"Failed to open link",Go,{url:t.payload.url,urlBehaviour:n}))}}function*is(e){const t=yield r.select((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid}));yield r.put({type:ro.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Ki}),t?yield r.put({type:Z,payload:{name:"SignalDismissal",parentGuid:t,dismissalMethod:e.payload.dismissalMethod}}):yield r.put({type:ao,payload:{level:Oo,code:Mo,message:"ParentGuid does not exist"}})}const os=a.connect((function(e){return{isOpen:e.active.has(lo)}})),rs="undefined"!=typeof window;function ss(e,n){t.useEffect((()=>{if(!rs||n)return;const t=e.current;if(!t)return;const a=e=>{e.preventDefault()},i=["wheel","touchmove"];i.forEach((e=>{t.addEventListener(e,a,{passive:!1})}));const o=e=>{["ArrowUp","ArrowDown","PageUp","PageDown","Space"].includes(e.code)&&e.preventDefault()};return window.addEventListener("keydown",o),()=>{i.forEach((e=>{t.removeEventListener(e,a)})),window.removeEventListener("keydown",o)}}),[e,n])}const ls="Minimized",cs=()=>{const e=t.useRef(null),n=t.useRef(null),a=t.useRef(null),i=t.useRef(null),o=t.useRef(null),r=Et(0,(e=>e.customStates[ls])),s=bt(),l=Nn(),c=t.useRef(0),d=t.useRef(!1),u=t.useRef(0),p=t.useRef([]),f=t.useRef(void 0),{isDisabled:y}=h(l);ss(e,!!r);const m=t.useCallback((()=>{k(),f.current=void 0,d.current=!1,N(!0);v()?x():R(0)}),[]),v=()=>{const e=j();return r?e<=-.2:e>=.2};t.useEffect((()=>{r?(C(),s(us(!0))):(w(),s(us(!1)))}),[r,s]),t.useEffect((()=>{requestAnimationFrame((()=>{D(!r,a),D(!!r,i),L()}))}),[]);const b=t.useCallback((e=>{if(n.current){e.preventDefault();const t=E(e);R(t)}}),[n]),I=t.useCallback((e=>{Date.now()-u.current<200||(u.current=Date.now(),r?S(!1):d.current||y||(d.current=!0,A(),f.current=ds(e),N(!1),_()))}),[r,y]);t.useEffect((()=>{const e=n.current;return e&&(e.addEventListener("mousedown",I),e.addEventListener("touchstart",I)),()=>{null==e||e.removeEventListener("mousedown",I),null==e||e.removeEventListener("touchstart",I)}}),[n,I]);const E=e=>{var t,n;return(null!==(t=ds(e))&&void 0!==t?t:0)-(null!==(n=f.current)&&void 0!==n?n:0)},x=()=>{S(!r)},S=e=>{const t=(e=>({type:X,payload:{key:ls,value:e?1:0}}))(e);t&&s(t)},C=()=>{var e,t,n,o;const r=null!==(t=null===(e=a.current)||void 0===e?void 0:e.clientHeight)&&void 0!==t?t:0,s=(null!==(o=null===(n=i.current)||void 0===n?void 0:n.clientHeight)&&void 0!==o?o:0)-r;N(!0),L(!0,!0),R(s),D(!1,a),D(!0,i),P()},w=()=>{N(!0),L(!0,!1),R(0),f.current=void 0,D(!0,a),D(!1,i),$()},O=t.useCallback((()=>{d.current&&(T(),requestAnimationFrame(O))}),[]),T=()=>{p.current.push({yPosition:c.current,timestamp:Date.now()}),p.current.length>20&&p.current.shift()},A=t.useCallback((()=>{p.current=[],O()}),[O]),j=()=>{const e=p.current;if(!e)return 0;const t=e[0],n=e[e.length-1];if(!t||!n)return 0;const a=n.timestamp-t.timestamp;return(n.yPosition-t.yPosition)/a},R=e=>{const t=Math.round(e);c.current=t,n.current&&(n.current.style.transform=`translateY(${t}px)`)},N=e=>{e?n.current&&(n.current.style.transition="transform .2s"):n.current&&(n.current.style.transition="")},L=(e,t=!1)=>{const n=t?i:a,o=t?a:i;o.current&&(o.current.style.transition="opacity .5s"),n.current&&(n.current.style.transition="opacity .2s")},D=(e,t)=>{const n=t.current;if(!n)return;const a=e?0:1;n.style.opacity=`${a}`,e?n.style.pointerEvents="none":setTimeout((()=>{n.style.pointerEvents="auto"}),400)},k=t.useCallback((()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",m),document.removeEventListener("touchmove",b),document.removeEventListener("touchend",m)}),[b,m]),_=t.useCallback((()=>{g()?(document.addEventListener("touchmove",b,{passive:!1}),document.addEventListener("touchend",m)):(document.addEventListener("mousemove",b,{passive:!1}),document.addEventListener("mouseup",m))}),[b,m]),P=()=>{const t=e.current;t&&(o.current=setTimeout((()=>{var e;const n=((null===(e=a.current)||void 0===e?void 0:e.clientHeight)||0)+1;t.style.height=n+"px"}),200))},$=()=>{o.current&&clearTimeout(o.current),e.current&&(e.current.style.height="100000px")};return{wrapperRef:e,containerRef:n,minimizedChildRef:a,maximizedChildRef:i}};function ds(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientY:e.clientY}const us=e=>({type:Z,payload:{action:e?"BottomSheetMinimized":"BottomSheetMaximized",name:"SignalUserInteraction",context:"BottomSheetMinimized"}}),ps={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var fs;function ys({schema:n,testId:o}){const r=ue(),s=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),l=a.useSelector((e=>e.active.has(co))),c=t.useRef(null),d=a.useDispatch(),u=()=>{d({type:so.DISMISS_OVERLAY,payload:{id:lo,dismissalMethod:"rokt_backdrop"}})},p=Et(0,(e=>e.customStates[ls]));t.useEffect((()=>{f(!!p)}),[p]),ss(c,!!p);const f=e=>{const t=c.current;t&&(e?t.style.opacity="0":(t.style.display="flex",t.style.opacity="1"))};t.useEffect((()=>{s&&d({type:Z,payload:{name:"SignalActivation",parentGuid:s}})}),[s]),t.useEffect((()=>{l&&requestAnimationFrame((()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.focus()}))}),[l]);const y=Nn(),{tabIndex:m,isDisabled:v,styles:g}=h(y),b=n.styles?i.mergeRight(ps,n.styles):ps;return e.jsx(Na,{styles:b,children:({classnames:t})=>{var a;return e.jsx("div",{className:null==t?void 0:t.wrapper,style:Object.assign({height:"100%",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9998",overflow:"hidden",display:"flex",opacity:"1",transition:"opacity 0.2s ease-in-out"},g),"aria-label":null!==(a=n.a11yLabel)&&void 0!==a?a:void 0,"aria-hidden":v,role:"dialog","aria-modal":!0,tabIndex:m,"data-testid":o,"data-e2e":"Overlay-Wrapper",ref:c,children:e.jsx("div",{style:{position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},onClick:n.allowBackdropToClose?u:void 0,"data-testid":o&&`${o}-backdrop`,"data-e2e":"Overlay-Backdrop"})})}})}function ms(){return e.jsx("div",{style:{width:"48px",height:"4px",backgroundColor:"#C6C6C8",borderRadius:"2px",margin:"0 auto -4px",position:"relative",top:"6px"}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(fs||(fs={}));const hs={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};function vs(t){const n=a.useSelector((e=>e.slots)),i=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0}));return e.jsx(gs,Object.assign({},t,{slots:n,currentIndex:i}))}function gs(t){const{wrapperRef:n,containerRef:a,minimizedChildRef:i,maximizedChildRef:o}=cs();return t.isOpen?e.jsxs("div",{ref:n,style:{height:"100000px"},children:[e.jsx(ys,Object.assign({},t)),e.jsx(Is,Object.assign({},t,{containerRef:a,minimizedChildRef:i,maximizedChildRef:o}))]}):null}const bs=o.css`
58
58
  display: flex;
59
59
  position: relative;
60
60
  overflow: hidden;
@@ -62,7 +62,7 @@
62
62
  > * {
63
63
  position: absolute !important;
64
64
  }
65
- `,Is=t.forwardRef((function({schema:n,testId:a,slots:o,currentIndex:r,minimizedChildRef:s,containerRef:l,maximizedChildRef:c},d){var u,p;const f=t.useRef(null),y=t.useRef(null),h=t.useRef(!0),m=n.styles?i.mergeRight(ms,n.styles):ms,v=Ct(),g=()=>{const e=y.current;if(!e)return 0;return Array.from(e.children).reduce(((e,t)=>Math.max(e,t.clientHeight)),0)};t.useEffect((()=>{const e=new ResizeObserver((()=>{(()=>{const e=y.current;if(!e)return;const t=g();e.style.height=`${t}px`})(),h.current&&(()=>{const e=g(),t=f.current;t&&(h.current=!1,t.style.setProperty("transform",`translateY(${e}px)`),requestAnimationFrame((()=>{t.style.transition="transform 0.8s",t.style.setProperty("transform","translateY(0px)")})))})()}));return y.current&&Array.from(y.current.children).forEach((t=>{e.observe(t)})),()=>{e.disconnect()}}),[]);const b=null===(p=null===(u=o[r])||void 0===u?void 0:u.offer)||void 0===p?void 0:p.creative,I=null==b?void 0:b.copy,E=Ht(I||{})(Ni.transformLinksToAnchorText(null==b?void 0:b.links),"creativeLink");return e.jsx(Na,{styles:m,children:({classnames:i})=>{var o;return e.jsxs("div",{style:{width:"100%",position:"absolute",bottom:"-1000px",zIndex:"9999"},ref:l,children:[e.jsx("div",{style:{zIndex:"3",width:"100%",maxHeight:"0%",transitionTimingFunction:"cubic-bezier(0.05, 0.7, 0.1, 1.0)"},ref:f,children:e.jsxs("div",{className:null==i?void 0:i.own,style:{height:"100%",position:"relative",outline:"none",borderBottomLeftRadius:"0",borderBottomRightRadius:"0",border:"1px solid #D5D7DA",borderBottom:"none",margin:"0px -1px"},ref:l,tabIndex:-1,"data-testid":a&&`${a}-container`,"data-e2e":"BottomSheet-Container",children:[e.jsx(hs,{}),e.jsx("div",{ref:y,className:bs,"aria-label":null!==(o=n.a11yLabel)&&void 0!==o?o:void 0,children:t.Children.toArray([e.jsx("div",{ref:c,style:{width:"100%"},children:v(n.children[0],void 0,U(0,a))},"0"),e.jsx(Jt,{value:E,children:e.jsx(Pn,{value:Ln(b),children:e.jsx("div",{ref:s,style:{width:"100%"},children:I&&e.jsx("div",{children:v(n.children[1],void 0,U(1,a))})},"1")})})])})]})}),e.jsx("div",{style:{width:"100%",height:"1000px",backgroundColor:"white"}})]})}})}));function*Es(){(yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex})))===(yield r.select((e=>{var t;return(null===(t=e.slots)||void 0===t?void 0:t.length)||1})))-1&&(yield r.put({type:X,payload:{key:"Minimized",value:1}}))}os(vs);const Ss={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var xs;function Cs({isOpen:n,schema:o,testId:r,children:s}){const l=ue(),c=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),d=a.useSelector((e=>e.active.has(co))),u=a.useDispatch();t.useEffect((()=>{c&&u({type:Z,payload:{name:"SignalActivation",parentGuid:c}})}),[c]),t.useEffect((()=>{d&&requestAnimationFrame((()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}))}),[d]);const p=Nn(),{tabIndex:f,isDisabled:y,styles:h}=m(p),v=o.styles?i.mergeRight(Ss,o.styles):Ss;if(!n)return null;const g=e.jsx(xt,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(Na,{styles:v,children:({classnames:t})=>{var n;return e.jsx("div",{className:null==t?void 0:t.wrapper,style:Object.assign({height:"10000px",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9999",display:"flex",overflow:"auto",flexDirection:"column",justifyContent:"flex-end"},h),"aria-label":null!==(n=o.a11yLabel)&&void 0!==n?n:void 0,"aria-hidden":y,role:"dialog","aria-modal":!0,tabIndex:f,"data-testid":r,"data-e2e":"Overlay-Wrapper",children:s(g,l)})}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(xs||(xs={}));const ws={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const Os=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(ws,t.styles):ws;return e.jsx(Na,{styles:r,children:({classnames:i})=>{var r;return e.jsx("div",{className:null==i?void 0:i.own,style:{position:"relative",zIndex:"3",outline:"none",alignSelf:"center"},ref:o,tabIndex:-1,"data-e2e":"Overlay-Container","aria-label":null!==(r=t.a11yLabel)&&void 0!==r?r:void 0,role:"dialog","aria-modal":!0,"data-testid":n&&`${n}-container`,children:a})}})}));const Ts=a.connect((function(e){return{isOpen:e.active.has(lo)}}))((function(t){return e.jsx(Cs,Object.assign({},t,{children:(n,a)=>e.jsx(Os,Object.assign({},t,{ref:a,children:n}))}))})),As=os(vs),js={name:"minimized-bottomsheet-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",Es)])},componentFactory:t=>"Overlay"===t.type?e.jsx(Ts,{schema:t}):function(e){const t=e.children instanceof Array;return t}(t)?e.jsx(As,{schema:t}):e.jsx("div",{children:"Could not Render Bottom Sheet"})};const Rs=a.connect((function(e,{schema:t}){var n,a,i;const o=t.startPosition||1;if((null===(n=e.progression)||void 0===n?void 0:n.totalCount)&&(null===(a=e.progression)||void 0===a?void 0:a.groupSize)){const t=(r=e.progression.totalCount,(s=e.progression.groupSize)<=0||r<=0||s>r?0:Math.ceil(r/s));let n;n=o>0?o-1:t+o>-1?t+o:0;return{numOfIndicators:t-n>-1?t-n:0,activeIndex:null!==(i=e.progression.currentGroupIndex)&&void 0!==i?i:0,startIndex:n}}var r,s;return{numOfIndicators:0,activeIndex:0,startIndex:0}})),Ns=t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"37",height:"29",viewBox:"0 0 37 29",fill:"inherit",style:{maxWidth:"44px",maxHeight:"32px",width:"100%",height:"100%"}},t.createElement("path",{d:"M5.62263 14.7123L5.48251 5.86667L11.3433 4.79804L11.3655 6.53531L7.57989 7.22555L7.61586 9.03828L11.0283 8.41606L11.0513 10.1575L7.63884 10.7797L7.69779 14.3339L5.62263 14.7123ZM17.5824 3.66043L19.6534 3.28282L19.745 8.98818C19.7555 9.64756 19.6126 10.2497 19.3164 10.7947C19.0224 11.3363 18.6042 11.7908 18.0619 12.1583C17.5191 12.5229 16.8858 12.7712 16.1619 12.9032C15.4352 13.0357 14.7983 13.019 14.2512 12.8531C13.7035 12.6844 13.2748 12.3843 12.9651 11.9527C12.6549 11.5184 12.4931 10.9717 12.4799 10.3129L12.3882 4.60752L14.4634 4.22914L14.5473 9.74965C14.5538 10.0546 14.6243 10.3146 14.7588 10.5298C14.8957 10.7416 15.0825 10.8952 15.3194 10.9907C15.5557 11.0833 15.8276 11.1016 16.135 11.0455C16.4453 10.989 16.717 10.8716 16.9501 10.6933C17.1828 10.5123 17.3621 10.2919 17.488 10.0321C17.6134 9.76959 17.6728 9.48585 17.6663 9.18094L17.5824 3.66043ZM28.2611 1.71333L28.4012 10.5589L26.6405 10.88L23.1503 6.39639L23.0916 6.40709L23.1693 11.5129L21.0941 11.8913L20.954 3.04567L22.7399 2.72004L26.2075 7.19908L26.2788 7.18608L26.1901 2.09094L28.2611 1.71333ZM4.24231 28.1783L4.10219 19.3327L9.96295 18.2641L9.98516 20.0013L6.19957 20.6916L6.23554 22.5043L9.64803 21.8821L9.67101 23.6235L6.25852 24.2457L6.31747 27.7999L4.24231 28.1783ZM11.933 26.776L9.70271 27.1827L12.4594 17.8089L15.2221 17.3051L18.2591 25.6225L16.0288 26.0292L13.9145 19.7787L13.8474 19.7909L11.933 26.776ZM11.5852 23.3481L16.247 22.4981L16.2661 24.1233L11.6043 24.9733L11.5852 23.3481ZM26.4764 18.4671L24.4054 18.8447C24.3768 18.6247 24.3205 18.4343 24.2363 18.2735C24.1516 18.1099 24.0407 17.9771 23.9037 17.875C23.7662 17.7701 23.6063 17.7011 23.4241 17.6679C23.2419 17.6347 23.0376 17.6387 22.8113 17.68C22.3781 17.759 22.005 17.9382 21.6921 18.2176C21.3792 18.497 21.1409 18.861 20.9772 19.3096C20.8136 19.7581 20.7359 20.2747 20.7444 20.8594C20.7576 21.423 20.8423 21.8797 20.9985 22.2295C21.1575 22.5788 21.3782 22.823 21.6605 22.9621C21.9424 23.0985 22.2748 23.1317 22.6577 23.0619C22.9064 23.0165 23.1316 22.9451 23.3333 22.8477C23.5373 22.747 23.7155 22.6235 23.8679 22.4774C24.0203 22.3312 24.1446 22.1656 24.2408 21.9805C24.3393 21.7922 24.4051 21.591 24.4383 21.3771L26.5261 20.9964C26.4914 21.3926 26.3895 21.7996 26.2202 22.2174C26.0532 22.6319 25.8184 23.0227 25.5157 23.3898C25.213 23.7568 24.842 24.0743 24.4028 24.342C23.9636 24.6098 23.4548 24.7965 22.8762 24.902C22.0853 25.0462 21.371 24.993 20.7333 24.7426C20.0985 24.4916 19.5925 24.0525 19.2153 23.4253C18.8405 22.7948 18.6436 21.9846 18.6249 20.9947C18.6089 20.0359 18.7692 19.1967 19.1057 18.4769C19.4451 17.7566 19.9106 17.1736 20.5022 16.7279C21.0965 16.2817 21.764 15.991 22.5047 15.856C23.0413 15.7581 23.5366 15.7429 23.9907 15.8103C24.4471 15.8743 24.8501 16.0174 25.1996 16.2396C25.5486 16.459 25.8322 16.7552 26.0504 17.1284C26.2714 17.501 26.4134 17.9473 26.4764 18.4671ZM27.362 16.8329L27.3398 15.0956L34.5966 13.7725L34.6188 15.5097L32.0154 15.9844L32.1333 23.0928L30.0875 23.4658L29.9696 16.3575L27.362 16.8329Z",fill:"inherit"})),Ls="FunFactMode";function Ds({activeIndex:e,startIndex:n,numOfIndicators:i,schema:o,slots:r}){var s,l,c;const d=Nn(),u=a.useDispatch(),{tabIndex:p,styles:f,isDisabled:y}=m(d),h=Array(i+1).fill(o.indicator),[v,g]=t.useState(new Set([n])),[b,I]=t.useState(!1),E=Et(0,(e=>e.customStates[Ls])),S=t.useCallback((e=>v.has(e)||v.has(e-1)),[v]);t.useEffect((()=>{g((t=>new Set([...t,e])))}),[e,E]),t.useEffect((()=>{E&&I(!0)}),[E]);const x=()=>{u({type:X,payload:{key:Ls,value:1}})},C=null===(l=null===(s=r[e])||void 0===s?void 0:s.offer)||void 0===l?void 0:l.creative,w=null===(c=null==C?void 0:C.images.creativeImage)||void 0===c?void 0:c.light;return i>0&&(T=i+n+1,(O=e)>=n&&O<=T)?t.createElement(Yt,null,(a=>t.createElement(Na,{styles:o.styles},(o=>{var r;const s=o.classnames,l=t=>{var n,a,o,r;return t===i&&E?`${null==s?void 0:s.indicator} ${null!==(n=null==s?void 0:s.activeIndicator)&&void 0!==n?n:""}`:t!==e||E?v.has(t)||t===i&&b?`${null==s?void 0:s.indicator} ${null!==(o=null==s?void 0:s.seenIndicator)&&void 0!==o?o:""}`:t==e+1?`${null==s?void 0:s.indicator} ${null!==(r=null==s?void 0:s.clickableIndicator)&&void 0!==r?r:""}`:`${null==s?void 0:s.indicator}`:`${null==s?void 0:s.indicator} ${null!==(a=null==s?void 0:s.activeIndicator)&&void 0!==a?a:""}`};return t.createElement("div",{className:null!==(r=null==s?void 0:s.own)&&void 0!==r?r:"",style:Object.assign({display:"flex",flexDirection:"row",gap:"8px"},f),"data-e2e":"ProgressIndicator",tabIndex:p,"aria-hidden":y},t.Children.toArray(h.map(((o,r)=>{return r===i?t.createElement("button",{onClick:b||e==i-1?x:void 0,className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",fill:E?"#101828":"#A3A3A3",cursor:b||e==i-1?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(o),t.createElement("div",{style:{marginTop:"3px",marginLeft:"2px"},"data-testid":"fun-fact-icon"},Ns)):r!==e||E?t.createElement("button",{onClick:(s=r,()=>{S(s)&&(u({type:"PROGRESSION/INITIALISE",payload:{totalCount:i,currentGroupIndex:s,groupSize:1}}),E&&u({type:X,payload:{key:Ls,value:0}}))}),className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",cursor:S(r)?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(""),t.createElement("div",{style:{fontSize:"30px",fontWeight:"700",lineHeight:"38px",display:"inline-block"}},`${r+1}`)):t.createElement("button",{className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",cursor:S(r)?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(""),w?t.createElement("img",{src:w,style:{marginTop:"3px"}}):t.createElement("div",{style:{fontSize:"30px",fontWeight:"700",lineHeight:"38px",display:"inline-block"}},`${r+1}`));var s}))))})))):null;var O,T}const _s=Rs(((e,n)=>{const i=a.useSelector((e=>e.slots)),o=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0}));return t.createElement(Ds,Object.assign({},e,{slots:i,currentIndex:o,partnerColor:n}))})),ks=({children:e,partnerColor:n,schema:a})=>{var i;const r=Ct(),s=t.useMemo((()=>Math.random()),[]),l=Ht((null!==(i=Ps[Math.floor(s*Ps.length)])&&void 0!==i?i:{text:"",header:""})||{},"funfact"),c=o.css`
65
+ `,Is=t.forwardRef((function({schema:n,testId:a,slots:o,currentIndex:r,minimizedChildRef:s,containerRef:l,maximizedChildRef:c},d){var u,p;const f=t.useRef(null),y=t.useRef(null),m=t.useRef(!0),h=n.styles?i.mergeRight(hs,n.styles):hs,v=Ct(),g=()=>{const e=y.current;if(!e)return 0;return Array.from(e.children).reduce(((e,t)=>Math.max(e,t.clientHeight)),0)};t.useEffect((()=>{const e=new ResizeObserver((()=>{(()=>{const e=y.current;if(!e)return;const t=g();e.style.height=`${t}px`})(),m.current&&(()=>{const e=g(),t=f.current;t&&(m.current=!1,t.style.setProperty("transform",`translateY(${e}px)`),requestAnimationFrame((()=>{t.style.transition="transform 0.8s",t.style.setProperty("transform","translateY(0px)")})))})()}));return y.current&&Array.from(y.current.children).forEach((t=>{e.observe(t)})),()=>{e.disconnect()}}),[]);const b=null===(p=null===(u=o[r])||void 0===u?void 0:u.offer)||void 0===p?void 0:p.creative,I=null==b?void 0:b.copy,E=Ht(I||{})(Ni.transformLinksToAnchorText(null==b?void 0:b.links),"creativeLink");return e.jsx(Na,{styles:h,children:({classnames:i})=>{var o;return e.jsxs("div",{style:{width:"100%",position:"absolute",bottom:"-1000px",zIndex:"9999"},ref:l,children:[e.jsx("div",{style:{zIndex:"3",width:"100%",maxHeight:"0%",transitionTimingFunction:"cubic-bezier(0.05, 0.7, 0.1, 1.0)"},ref:f,children:e.jsxs("div",{className:null==i?void 0:i.own,style:{height:"100%",position:"relative",outline:"none",borderBottomLeftRadius:"0",borderBottomRightRadius:"0",border:"1px solid #D5D7DA",borderBottom:"none",margin:"0px -1px"},ref:l,tabIndex:-1,"data-testid":a&&`${a}-container`,"data-e2e":"BottomSheet-Container",children:[e.jsx(ms,{}),e.jsx("div",{ref:y,className:bs,"aria-label":null!==(o=n.a11yLabel)&&void 0!==o?o:void 0,children:t.Children.toArray([e.jsx("div",{ref:c,style:{width:"100%"},children:v(n.children[0],void 0,U(0,a))},"0"),e.jsx(Jt,{value:E,children:e.jsx(Pn,{value:Ln(b),children:e.jsx("div",{ref:s,style:{width:"100%"},children:I&&e.jsx("div",{children:v(n.children[1],void 0,U(1,a))})},"1")})})])})]})}),e.jsx("div",{style:{width:"100%",height:"1000px",backgroundColor:"white"}})]})}})}));function*Es(){(yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex})))===(yield r.select((e=>{var t;return(null===(t=e.slots)||void 0===t?void 0:t.length)||1})))-1&&(yield r.put({type:X,payload:{key:"Minimized",value:1}}))}os(vs);const xs={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var Ss;function Cs({isOpen:n,schema:o,testId:r,children:s}){const l=ue(),c=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),d=a.useSelector((e=>e.active.has(co))),u=a.useDispatch();t.useEffect((()=>{c&&u({type:Z,payload:{name:"SignalActivation",parentGuid:c}})}),[c]),t.useEffect((()=>{d&&requestAnimationFrame((()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}))}),[d]);const p=Nn(),{tabIndex:f,isDisabled:y,styles:m}=h(p),v=o.styles?i.mergeRight(xs,o.styles):xs;if(!n)return null;const g=e.jsx(St,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(Na,{styles:v,children:({classnames:t})=>{var n;return e.jsx("div",{className:null==t?void 0:t.wrapper,style:Object.assign({height:"10000px",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9999",display:"flex",overflow:"auto",flexDirection:"column",justifyContent:"flex-end"},m),"aria-label":null!==(n=o.a11yLabel)&&void 0!==n?n:void 0,"aria-hidden":y,role:"dialog","aria-modal":!0,tabIndex:f,"data-testid":r,"data-e2e":"Overlay-Wrapper",children:s(g,l)})}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(Ss||(Ss={}));const ws={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const Os=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(ws,t.styles):ws;return e.jsx(Na,{styles:r,children:({classnames:i})=>{var r;return e.jsx("div",{className:null==i?void 0:i.own,style:{position:"relative",zIndex:"3",outline:"none",alignSelf:"center"},ref:o,tabIndex:-1,"data-e2e":"Overlay-Container","aria-label":null!==(r=t.a11yLabel)&&void 0!==r?r:void 0,role:"dialog","aria-modal":!0,"data-testid":n&&`${n}-container`,children:a})}})}));const Ts=a.connect((function(e){return{isOpen:e.active.has(lo)}}))((function(t){return e.jsx(Cs,Object.assign({},t,{children:(n,a)=>e.jsx(Os,Object.assign({},t,{ref:a,children:n}))}))})),As=os(vs),js={name:"minimized-bottomsheet-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",Es)])},componentFactory:t=>"Overlay"===t.type?e.jsx(Ts,{schema:t}):function(e){const t=e.children instanceof Array;return t}(t)?e.jsx(As,{schema:t}):e.jsx("div",{children:"Could not Render Bottom Sheet"})};const Rs=a.connect((function(e,{schema:t}){var n,a,i;const o=t.startPosition||1;if((null===(n=e.progression)||void 0===n?void 0:n.totalCount)&&(null===(a=e.progression)||void 0===a?void 0:a.groupSize)){const t=(r=e.progression.totalCount,(s=e.progression.groupSize)<=0||r<=0||s>r?0:Math.ceil(r/s));let n;n=o>0?o-1:t+o>-1?t+o:0;return{numOfIndicators:t-n>-1?t-n:0,activeIndex:null!==(i=e.progression.currentGroupIndex)&&void 0!==i?i:0,startIndex:n}}var r,s;return{numOfIndicators:0,activeIndex:0,startIndex:0}})),Ns=t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"37",height:"29",viewBox:"0 0 37 29",fill:"inherit",style:{maxWidth:"44px",maxHeight:"32px",width:"100%",height:"100%"}},t.createElement("path",{d:"M5.62263 14.7123L5.48251 5.86667L11.3433 4.79804L11.3655 6.53531L7.57989 7.22555L7.61586 9.03828L11.0283 8.41606L11.0513 10.1575L7.63884 10.7797L7.69779 14.3339L5.62263 14.7123ZM17.5824 3.66043L19.6534 3.28282L19.745 8.98818C19.7555 9.64756 19.6126 10.2497 19.3164 10.7947C19.0224 11.3363 18.6042 11.7908 18.0619 12.1583C17.5191 12.5229 16.8858 12.7712 16.1619 12.9032C15.4352 13.0357 14.7983 13.019 14.2512 12.8531C13.7035 12.6844 13.2748 12.3843 12.9651 11.9527C12.6549 11.5184 12.4931 10.9717 12.4799 10.3129L12.3882 4.60752L14.4634 4.22914L14.5473 9.74965C14.5538 10.0546 14.6243 10.3146 14.7588 10.5298C14.8957 10.7416 15.0825 10.8952 15.3194 10.9907C15.5557 11.0833 15.8276 11.1016 16.135 11.0455C16.4453 10.989 16.717 10.8716 16.9501 10.6933C17.1828 10.5123 17.3621 10.2919 17.488 10.0321C17.6134 9.76959 17.6728 9.48585 17.6663 9.18094L17.5824 3.66043ZM28.2611 1.71333L28.4012 10.5589L26.6405 10.88L23.1503 6.39639L23.0916 6.40709L23.1693 11.5129L21.0941 11.8913L20.954 3.04567L22.7399 2.72004L26.2075 7.19908L26.2788 7.18608L26.1901 2.09094L28.2611 1.71333ZM4.24231 28.1783L4.10219 19.3327L9.96295 18.2641L9.98516 20.0013L6.19957 20.6916L6.23554 22.5043L9.64803 21.8821L9.67101 23.6235L6.25852 24.2457L6.31747 27.7999L4.24231 28.1783ZM11.933 26.776L9.70271 27.1827L12.4594 17.8089L15.2221 17.3051L18.2591 25.6225L16.0288 26.0292L13.9145 19.7787L13.8474 19.7909L11.933 26.776ZM11.5852 23.3481L16.247 22.4981L16.2661 24.1233L11.6043 24.9733L11.5852 23.3481ZM26.4764 18.4671L24.4054 18.8447C24.3768 18.6247 24.3205 18.4343 24.2363 18.2735C24.1516 18.1099 24.0407 17.9771 23.9037 17.875C23.7662 17.7701 23.6063 17.7011 23.4241 17.6679C23.2419 17.6347 23.0376 17.6387 22.8113 17.68C22.3781 17.759 22.005 17.9382 21.6921 18.2176C21.3792 18.497 21.1409 18.861 20.9772 19.3096C20.8136 19.7581 20.7359 20.2747 20.7444 20.8594C20.7576 21.423 20.8423 21.8797 20.9985 22.2295C21.1575 22.5788 21.3782 22.823 21.6605 22.9621C21.9424 23.0985 22.2748 23.1317 22.6577 23.0619C22.9064 23.0165 23.1316 22.9451 23.3333 22.8477C23.5373 22.747 23.7155 22.6235 23.8679 22.4774C24.0203 22.3312 24.1446 22.1656 24.2408 21.9805C24.3393 21.7922 24.4051 21.591 24.4383 21.3771L26.5261 20.9964C26.4914 21.3926 26.3895 21.7996 26.2202 22.2174C26.0532 22.6319 25.8184 23.0227 25.5157 23.3898C25.213 23.7568 24.842 24.0743 24.4028 24.342C23.9636 24.6098 23.4548 24.7965 22.8762 24.902C22.0853 25.0462 21.371 24.993 20.7333 24.7426C20.0985 24.4916 19.5925 24.0525 19.2153 23.4253C18.8405 22.7948 18.6436 21.9846 18.6249 20.9947C18.6089 20.0359 18.7692 19.1967 19.1057 18.4769C19.4451 17.7566 19.9106 17.1736 20.5022 16.7279C21.0965 16.2817 21.764 15.991 22.5047 15.856C23.0413 15.7581 23.5366 15.7429 23.9907 15.8103C24.4471 15.8743 24.8501 16.0174 25.1996 16.2396C25.5486 16.459 25.8322 16.7552 26.0504 17.1284C26.2714 17.501 26.4134 17.9473 26.4764 18.4671ZM27.362 16.8329L27.3398 15.0956L34.5966 13.7725L34.6188 15.5097L32.0154 15.9844L32.1333 23.0928L30.0875 23.4658L29.9696 16.3575L27.362 16.8329Z",fill:"inherit"})),Ls="FunFactMode";function Ds({activeIndex:e,startIndex:n,numOfIndicators:i,schema:o,slots:r}){var s,l,c;const d=Nn(),u=a.useDispatch(),{tabIndex:p,styles:f,isDisabled:y}=h(d),m=Array(i+1).fill(o.indicator),[v,g]=t.useState(new Set([n])),[b,I]=t.useState(!1),E=Et(0,(e=>e.customStates[Ls])),x=t.useCallback((e=>v.has(e)||v.has(e-1)),[v]);t.useEffect((()=>{g((t=>new Set([...t,e])))}),[e,E]),t.useEffect((()=>{E&&I(!0)}),[E]);const S=()=>{u({type:X,payload:{key:Ls,value:1}})},C=null===(l=null===(s=r[e])||void 0===s?void 0:s.offer)||void 0===l?void 0:l.creative,w=null===(c=null==C?void 0:C.images.creativeImage)||void 0===c?void 0:c.light;return i>0&&(T=i+n+1,(O=e)>=n&&O<=T)?t.createElement(Yt,null,(a=>t.createElement(Na,{styles:o.styles},(o=>{var r;const s=o.classnames,l=t=>{var n,a,o,r;return t===i&&E?`${null==s?void 0:s.indicator} ${null!==(n=null==s?void 0:s.activeIndicator)&&void 0!==n?n:""}`:t!==e||E?v.has(t)||t===i&&b?`${null==s?void 0:s.indicator} ${null!==(o=null==s?void 0:s.seenIndicator)&&void 0!==o?o:""}`:t==e+1?`${null==s?void 0:s.indicator} ${null!==(r=null==s?void 0:s.clickableIndicator)&&void 0!==r?r:""}`:`${null==s?void 0:s.indicator}`:`${null==s?void 0:s.indicator} ${null!==(a=null==s?void 0:s.activeIndicator)&&void 0!==a?a:""}`};return t.createElement("div",{className:null!==(r=null==s?void 0:s.own)&&void 0!==r?r:"",style:Object.assign({display:"flex",flexDirection:"row",gap:"8px"},f),"data-e2e":"ProgressIndicator",tabIndex:p,"aria-hidden":y},t.Children.toArray(m.map(((o,r)=>{return r===i?t.createElement("button",{onClick:b||e==i-1?S:void 0,className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",fill:E?"#101828":"#A3A3A3",cursor:b||e==i-1?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(o),t.createElement("div",{style:{marginTop:"3px",marginLeft:"2px"},"data-testid":"fun-fact-icon"},Ns)):r!==e||E?t.createElement("button",{onClick:(s=r,()=>{x(s)&&(u({type:"PROGRESSION/INITIALISE",payload:{totalCount:i,currentGroupIndex:s,groupSize:1}}),E&&u({type:X,payload:{key:Ls,value:0}}))}),className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",cursor:x(r)?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(""),t.createElement("div",{style:{fontSize:"30px",fontWeight:"700",lineHeight:"38px",display:"inline-block"}},`${r+1}`)):t.createElement("button",{className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",cursor:x(r)?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(""),w?t.createElement("img",{src:w,style:{marginTop:"3px"}}):t.createElement("div",{style:{fontSize:"30px",fontWeight:"700",lineHeight:"38px",display:"inline-block"}},`${r+1}`));var s}))))})))):null;var O,T}const ks=Rs(((e,n)=>{const i=a.useSelector((e=>e.slots)),o=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0}));return t.createElement(Ds,Object.assign({},e,{slots:i,currentIndex:o,partnerColor:n}))})),_s=({children:e,partnerColor:n,schema:a})=>{var i;const r=Ct(),s=t.useMemo((()=>Math.random()),[]),l=Ht((null!==(i=Ps[Math.floor(s*Ps.length)])&&void 0!==i?i:{text:"",header:""})||{},"funfact"),c=o.css`
66
66
  display: inline;
67
67
  margin: 8px 16px;
68
68
  p {
@@ -72,7 +72,7 @@
72
72
  font-size: 24px;
73
73
  font-weight: 600;
74
74
  color: ${n};
75
- `;return t.createElement(Jt,{value:l},t.createElement(Na,{styles:a.styles},(n=>{const a=n.classnames;return t.createElement(t.Fragment,null,t.Children.toArray(null==e?void 0:e.map(((e,n)=>t.createElement("div",{className:`${c} ${null==a?void 0:a.own}`},0===n?t.createElement(t.Fragment,null,t.createElement("p",{className:`${d} ${null==a?void 0:a.own}`},"Did you know...")," ",t.createElement("span",{className:`${null==a?void 0:a.own}`},r(e))):t.createElement("span",{className:`${null==a?void 0:a.own}`},r(e)))))))})))},Ps=[{header:"the Eiffel Tower can grow taller in summer?",text:"The heat causes the metal to expand, adding up to six inches to its height."},{header:"flamingos aren't born pink?",text:"Their feathers turn pink from eating shrimp and algae rich in carotenoids."},{header:"bananas are berries, but strawberries aren't?",text:"Botanically, strawberries are aggregate fruits, while bananas meet all the criteria for a true berry."},{header:"a day on Venus is longer than a year on Venus?",text:"It takes Venus 243 Earth days to rotate once but only 225 Earth days to orbit the Sun."},{header:"sea cucumbers can eject their guts when threatened?",text:"This defense mechanism helps them escape predators and they regenerate the lost organs later."},{header:"prunes used to be said instead of cheese for photos?",text:'In the 1840s, people said "prunes" to maintain a tight-lipped expression instead of smiling.'},{header:"some frogs can freeze solid and survive?",text:"Species like wood frogs produce special proteins that prevent ice from damaging their cells."},{header:"Venus is the only planet that spins clockwise?",text:"Its unusual rotation direction makes it stand out among other planets in our solar system."},{header:"cats have 230 bones while humans have only 206?",text:"Their extra bones make them incredibly flexible jumpers and climbers."},{header:"the Statue of Liberty once functioned as a lighthouse?",text:"From 1886 to 1902, its light could be seen up to 24 miles away."},{header:"the first commercial flight lasted just 23 minutes?",text:"It flew between St. Petersburg and Tampa, Florida, in 1914."},{header:"octopuses have blue blood and nine brains?",text:"Their unique blood helps them survive in low-oxygen environments, and each arm has its own mini-brain."},{header:"hummingbirds can fly backward?",text:"They're the only birds capable of this agile movement thanks to their unique wing structure."},{header:"gorillas burp when they're happy?",text:"It's one of their ways of expressing contentment and relaxation."},{header:"Australia is wider than the Moon?",text:"Australia spans about 2,485 miles across, while the Moon's diameter is only about 2,159 miles."},{header:"ants can carry up to 50 times their body weight?",text:"These tiny insects are incredibly strong for their size due to their muscle structure."},{header:"lightning is five times hotter than the surface of the Sun?",text:"A single bolt can reach temperatures of up to 50,000 degrees Fahrenheit."},{header:"sharks are the only fish that can blink with both eyes?",text:"They have an extra eyelid called a nictitating membrane for protection during attacks or feeding."},{header:"octopuses have three hearts?",text:"Two pump blood to the gills, while the third pumps it to the rest of the body—and it stops beating when they swim."},{header:"a group of flamingos is called a flamboyance?",text:"Their bright pink color and synchronized movements make this name quite fitting."},{header:"honey never spoils?",text:"Archaeologists have found pots of honey in ancient Egyptian tombs that are still edible."},{header:"cats can't taste sweetness?",text:"Their taste buds lack the receptors for sugary flavors, which might explain their disinterest in desserts."},{header:"a crocodile can't stick out its tongue?",text:"A special membrane holds their tongue in place, helping them swallow prey underwater."},{header:"sea otters hold hands while they sleep?",text:"This keeps them from drifting apart in the water, especially when they're napping in groups."},{header:"bananas glow blue under black light?",text:"This happens because of the way their peel breaks down as they ripen."},{header:"a watermelon is 92% water?",text:"That's why it's such a refreshing snack on a hot day!"},{header:"butterflies taste with their feet?",text:"Their taste sensors are located on their legs, helping them identify suitable plants for laying eggs."},{header:"an ostrich's eye is bigger than its brain?",text:"This might explain why these birds rely more on instinct than intelligence."},{header:"kangaroos can't walk backward?",text:"Their muscular tails and body structure make this movement impossible."},{header:"avocados are fruits, not vegetables?",text:"They're technically berries because of their fleshy pulp and single seed."},{header:"dolphins have names for each other?",text:"They use unique whistles to identify and call out to specific individuals in their pods."},{header:'the Hollywood sign originally said "Hollywoodland"?',text:"It was installed in 1923 as an advertisement for a real estate development."},{header:"giraffe tongues can be up to 20 inches long?",text:"Their dark color helps protect them from sunburn while reaching for leaves."},{header:"M&M's were the first candy eaten in space?",text:"Astronauts love them because they don't crumble and create messes in zero gravity."},{header:"starfish don't have brains?",text:"They rely on a simple nervous system to sense their surroundings and move around."},{header:"peanuts are legumes, not nuts?",text:"They grow underground like beans and peas, making them part of the legume family."},{header:"the shortest war in history lasted only 38 minutes?",text:"It was between Britain and Zanzibar on August 27, 1896."},{header:"clouds can weigh over a million pounds?",text:"Despite their massive weight, the water droplets are spread out enough to float in the air!"}];function*$s(){(yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex})))===(yield r.select((e=>{var t;return(null===(t=e.slots)||void 0===t?void 0:t.length)||1})))-1&&(yield r.put({type:X,payload:{key:"FunFactMode",value:1}}))}const Fs={name:"logo-clickable-progression-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",$s)])},componentFactory:e=>e?"fun-fact"===e.variant?t.createElement(ks,{partnerColor:e.partnerColor,schema:e},e.children):t.createElement(_s,{schema:Object.assign(Object.assign({},e),{indicator:""}),partnerColor:e.partnerColor}):t.createElement("div",null,"Could not render Logo Clickable Progression"),interceptors:{}};const Gs=o.css`
75
+ `;return t.createElement(Jt,{value:l},t.createElement(Na,{styles:a.styles},(n=>{const a=n.classnames;return t.createElement(t.Fragment,null,t.Children.toArray(null==e?void 0:e.map(((e,n)=>t.createElement("div",{className:`${c} ${null==a?void 0:a.own}`},0===n?t.createElement(t.Fragment,null,t.createElement("p",{className:`${d} ${null==a?void 0:a.own}`},"Did you know...")," ",t.createElement("span",{className:`${null==a?void 0:a.own}`},r(e))):t.createElement("span",{className:`${null==a?void 0:a.own}`},r(e)))))))})))},Ps=[{header:"the Eiffel Tower can grow taller in summer?",text:"The heat causes the metal to expand, adding up to six inches to its height."},{header:"flamingos aren't born pink?",text:"Their feathers turn pink from eating shrimp and algae rich in carotenoids."},{header:"bananas are berries, but strawberries aren't?",text:"Botanically, strawberries are aggregate fruits, while bananas meet all the criteria for a true berry."},{header:"a day on Venus is longer than a year on Venus?",text:"It takes Venus 243 Earth days to rotate once but only 225 Earth days to orbit the Sun."},{header:"sea cucumbers can eject their guts when threatened?",text:"This defense mechanism helps them escape predators and they regenerate the lost organs later."},{header:"prunes used to be said instead of cheese for photos?",text:'In the 1840s, people said "prunes" to maintain a tight-lipped expression instead of smiling.'},{header:"some frogs can freeze solid and survive?",text:"Species like wood frogs produce special proteins that prevent ice from damaging their cells."},{header:"Venus is the only planet that spins clockwise?",text:"Its unusual rotation direction makes it stand out among other planets in our solar system."},{header:"cats have 230 bones while humans have only 206?",text:"Their extra bones make them incredibly flexible jumpers and climbers."},{header:"the Statue of Liberty once functioned as a lighthouse?",text:"From 1886 to 1902, its light could be seen up to 24 miles away."},{header:"the first commercial flight lasted just 23 minutes?",text:"It flew between St. Petersburg and Tampa, Florida, in 1914."},{header:"octopuses have blue blood and nine brains?",text:"Their unique blood helps them survive in low-oxygen environments, and each arm has its own mini-brain."},{header:"hummingbirds can fly backward?",text:"They're the only birds capable of this agile movement thanks to their unique wing structure."},{header:"gorillas burp when they're happy?",text:"It's one of their ways of expressing contentment and relaxation."},{header:"Australia is wider than the Moon?",text:"Australia spans about 2,485 miles across, while the Moon's diameter is only about 2,159 miles."},{header:"ants can carry up to 50 times their body weight?",text:"These tiny insects are incredibly strong for their size due to their muscle structure."},{header:"lightning is five times hotter than the surface of the Sun?",text:"A single bolt can reach temperatures of up to 50,000 degrees Fahrenheit."},{header:"sharks are the only fish that can blink with both eyes?",text:"They have an extra eyelid called a nictitating membrane for protection during attacks or feeding."},{header:"octopuses have three hearts?",text:"Two pump blood to the gills, while the third pumps it to the rest of the body—and it stops beating when they swim."},{header:"a group of flamingos is called a flamboyance?",text:"Their bright pink color and synchronized movements make this name quite fitting."},{header:"honey never spoils?",text:"Archaeologists have found pots of honey in ancient Egyptian tombs that are still edible."},{header:"cats can't taste sweetness?",text:"Their taste buds lack the receptors for sugary flavors, which might explain their disinterest in desserts."},{header:"a crocodile can't stick out its tongue?",text:"A special membrane holds their tongue in place, helping them swallow prey underwater."},{header:"sea otters hold hands while they sleep?",text:"This keeps them from drifting apart in the water, especially when they're napping in groups."},{header:"bananas glow blue under black light?",text:"This happens because of the way their peel breaks down as they ripen."},{header:"a watermelon is 92% water?",text:"That's why it's such a refreshing snack on a hot day!"},{header:"butterflies taste with their feet?",text:"Their taste sensors are located on their legs, helping them identify suitable plants for laying eggs."},{header:"an ostrich's eye is bigger than its brain?",text:"This might explain why these birds rely more on instinct than intelligence."},{header:"kangaroos can't walk backward?",text:"Their muscular tails and body structure make this movement impossible."},{header:"avocados are fruits, not vegetables?",text:"They're technically berries because of their fleshy pulp and single seed."},{header:"dolphins have names for each other?",text:"They use unique whistles to identify and call out to specific individuals in their pods."},{header:'the Hollywood sign originally said "Hollywoodland"?',text:"It was installed in 1923 as an advertisement for a real estate development."},{header:"giraffe tongues can be up to 20 inches long?",text:"Their dark color helps protect them from sunburn while reaching for leaves."},{header:"M&M's were the first candy eaten in space?",text:"Astronauts love them because they don't crumble and create messes in zero gravity."},{header:"starfish don't have brains?",text:"They rely on a simple nervous system to sense their surroundings and move around."},{header:"peanuts are legumes, not nuts?",text:"They grow underground like beans and peas, making them part of the legume family."},{header:"the shortest war in history lasted only 38 minutes?",text:"It was between Britain and Zanzibar on August 27, 1896."},{header:"clouds can weigh over a million pounds?",text:"Despite their massive weight, the water droplets are spread out enough to float in the air!"}];function*$s(){(yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex})))===(yield r.select((e=>{var t;return(null===(t=e.slots)||void 0===t?void 0:t.length)||1})))-1&&(yield r.put({type:X,payload:{key:"FunFactMode",value:1}}))}const Fs={name:"logo-clickable-progression-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",$s)])},componentFactory:e=>e?"fun-fact"===e.variant?t.createElement(_s,{partnerColor:e.partnerColor,schema:e},e.children):t.createElement(ks,{schema:Object.assign(Object.assign({},e),{indicator:""}),partnerColor:e.partnerColor}):t.createElement("div",null,"Could not render Logo Clickable Progression"),interceptors:{}};const Gs=o.css`
76
76
  height: 20px;
77
77
  border-radius: 4px;
78
78
  width: 100%;
@@ -107,7 +107,7 @@
107
107
  `},e)))):null):null}const qs=o.keyframes`
108
108
  0% { width: 0; }
109
109
  100% { width: 100%; }
110
- }`;function Hs(e){const[n,i]=t.useState(!1),[r,s]=t.useState(!1),l=a.useDispatch(),c=Ct(),{type:d,children:u,durationMS:p,styles:f,partnerText:y,animationSpeedMS:h}=e.data;let m=null;switch(d){case"skeleton":m=t.createElement(Vs,{hasLoaded:n,animationSpeedMS:h,styles:f});break;case"partnerText":m=t.createElement(zs,{partnerText:y,hasLoaded:n,animationSpeedMS:h,styles:f})}return t.useEffect((()=>{let e=null;const t=setTimeout((()=>{i(!0),e=setTimeout((()=>{s(!0)}),h)}),1.25*p);return()=>{t&&clearTimeout(t),e&&clearTimeout(e)}}),[p,l]),t.createElement("div",{"data-testid":"Loading"},t.createElement("div",{className:o.css`
110
+ }`;function Hs(e){const[n,i]=t.useState(!1),[r,s]=t.useState(!1),l=a.useDispatch(),c=Ct(),{type:d,children:u,durationMS:p,styles:f,partnerText:y,animationSpeedMS:m}=e.data;let h=null;switch(d){case"skeleton":h=t.createElement(Vs,{hasLoaded:n,animationSpeedMS:m,styles:f});break;case"partnerText":h=t.createElement(zs,{partnerText:y,hasLoaded:n,animationSpeedMS:m,styles:f})}return t.useEffect((()=>{let e=null;const t=setTimeout((()=>{i(!0),e=setTimeout((()=>{s(!0)}),m)}),1.25*p);return()=>{t&&clearTimeout(t),e&&clearTimeout(e)}}),[p,l]),t.createElement("div",{"data-testid":"Loading"},t.createElement("div",{className:o.css`
111
111
  position: relative;
112
112
  `},t.createElement("div",{className:o.css`
113
113
  height: 4px;
@@ -115,7 +115,7 @@
115
115
  position: absolute;
116
116
  top: 0;
117
117
  animation: ${qs} ${p}ms linear forwards;
118
- transition: opacity ${h}ms ease-in-out;
118
+ transition: opacity ${m}ms ease-in-out;
119
119
  opacity: ${n?0:1};
120
120
  `}),t.createElement("div",{className:o.css`
121
121
  position: relative;
@@ -127,13 +127,13 @@
127
127
  bottom: 0;
128
128
  z-index: 20;
129
129
  border-width: 2px;
130
- transition: border-color ${h}ms ease-in-out;
130
+ transition: border-color ${m}ms ease-in-out;
131
131
  ${r?"\n border-color: transparent;\n user-select: none;\n pointer-events: none;\n ":`\n border-color: ${n?(null==f?void 0:f.primaryColor)||"#7F56D9":"transparent"};\n `}
132
- `},m),t.createElement("div",{"data-testid":"slots",className:o.css`
132
+ `},h),t.createElement("div",{"data-testid":"slots",className:o.css`
133
133
  z-index: 10;
134
- transition: opacity ${h}ms ease-in-out;
134
+ transition: opacity ${m}ms ease-in-out;
135
135
  ${r?"\n opacity: 1;\n user-select: auto;\n pointer-events: auto;\n ":"\n opacity: 0;\n user-select: none;\n pointer-events: none;\n "}
136
- `},t.Children.toArray(u.map((e=>c(e))))))))}const Ws={name:"loading-extension",componentFactory:e=>t.createElement(Hs,{data:e}),interceptors:{}};function Ks({linearGradient:e,color1:n,color2:a,color3:i,duration:o,additionalStyles:r,gradientAngle:s}){const l=t.useRef(null);t.useEffect((()=>{const e=()=>{var e;if(null===(e=l.current)||void 0===e?void 0:e.parentElement){const e=l.current.parentElement;requestAnimationFrame((()=>{const t=Array.from(e.children).filter((e=>!e.classList.contains("background-shimmer")));if(t.length>0){const n=t.reduce(((e,t)=>Math.max(e,t.offsetHeight)),0),a=parseInt(e.style.height||"0");n>0&&n!==a&&(e.style.height=`${n}px`)}}))}};let t;const n=()=>{clearTimeout(t),t=setTimeout(e,100)};return window.addEventListener("resize",n),setTimeout(e,100),()=>{window.removeEventListener("resize",n),clearTimeout(t)}}),[]);const c=t.useMemo((()=>`\n @keyframes slideGradient {\n 0% {\n left: -90%;\n opacity: 0;\n }\n 8% {\n left: -90%;\n opacity: 1;\n }\n 22% {\n left: 90%;\n opacity: 1;\n }\n 28% {\n left: 100%;\n opacity: 0;\n }\n 100% {\n left: 100%;\n opacity: 0;\n }\n }\n .background-shimmer {\n position: absolute !important;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n pointer-events: none;\n z-index: 0;\n }\n \n .background-shimmer::after {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n right: 0;\n bottom: 0;\n width: 50%;\n background: ${e||`linear-gradient(\n ${s||"to right"},\n transparent 0%,\n ${n||"rgba(217, 217, 217, 0.30)"} 20%,\n ${a||"rgba(217, 217, 217, 0.50)"} 50%,\n ${i||"rgba(217, 217, 217, 0.30)"} 80%,\n transparent 100%\n )`};\n animation: slideGradient ${o||"3.94s"} linear infinite forwards;\n pointer-events: none;\n z-index: 0;\n }\n ${r}\n`),[e,n,a,i,o,r,s]);return t.createElement(Yt,null,(e=>t.createElement(Na,{styles:{}},(e=>{var n;const a=e.classnames;return t.createElement(t.Fragment,null,t.createElement("style",null,c),t.createElement("div",{ref:l,className:`${null!==(n=null==a?void 0:a.own)&&void 0!==n?n:""} background-shimmer`}))}))))}const Ys={name:"shimmer-background-extension",componentFactory:e=>e?t.createElement(Ks,{linearGradient:e.linearGradient,color1:e.color1,color2:e.color2,color3:e.color3,duration:e.duration,additionalStyles:e.additionalStyles}):t.createElement("div",null,"Could not render Shimmer Background"),interceptors:{}},Js=1e3;function Zs(e){const n=e.data,{minutes:o,seconds:r,timeRemaining:s,restartTimer:l}=function(e){const[n,a]=t.useState(e),i=(new Date).getTime()/Js,o=t.useRef(null),r=()=>{const t=(new Date).getTime()/Js;a(Math.max(Math.floor(e-(t-i)),0))};return t.useEffect((()=>(o.current=setInterval(r,Js),()=>{o.current&&"number"==typeof o.current&&clearInterval(o.current)})),[]),{minutes:Math.floor(n/60).toString(),seconds:Math.floor(Math.min(n%60,59)).toLocaleString("en-US",{minimumIntegerDigits:2,maximumFractionDigits:0,useGrouping:!1}),timeRemaining:n,restartTimer:function(){o.current&&"number"==typeof o.current&&clearInterval(o.current),a(e),o.current=setInterval(r,Js)}}}((null==n?void 0:n.duration)||300),c=a.useSelector((e=>{const t=i.path(["progression","currentGroupIndex"],e);return"number"==typeof t?t:0})),d=a.useDispatch();t.useEffect((()=>{l()}),[c]),t.useEffect((()=>{0===s&&(d({type:Z,payload:{name:"SignalUserInteraction",action:"TimerExpired",context:"TimerProgression"}}),d({type:"PROGRESSION/PROCESS",payload:{offerProcessStatus:"CONTINUE"}}))}),[o,r]);const u=Nn(),{tabIndex:p,styles:f,isDisabled:y}=m(u);return t.createElement("p",{tabIndex:p,style:Object.assign(Object.assign({},null==n?void 0:n.styles),f),"aria-hidden":y,"data-e2e":"Timer"},`${o}:${r}`)}const Qs={name:"timer-progression-extension",componentFactory:e=>t.createElement(Zs,{data:e}),interceptors:{}},Xs="MODULE/ADD_LOADED",el="MODULE/LOAD",tl="PROGRESSION/INITIALISE",nl="PROGRESSION/NEXT",al="PROGRESSION/PREV",il="PROGRESSION/UPDATE_GROUP_SIZE",ol="PROGRESSION/PROCESS",rl="SLOTS/SET",sl="INSTANT_PURCHASE/DISMISS",ll="OFFER_LIFECYCLE",cl="DOMAIN_STATES/SET",dl="OFFER_ENGAGEMENT",ul="GLOBAL_OFFER_DATA_STATE/SET_CART",pl=Object.assign(Object.assign({},ro),{NEXT_IN_PROGRESSION:nl,PREV_IN_PROGRESSION:al,INITIALISE_PROGRESSION:tl,UPDATE_GROUP_SIZE:il,SET_SLOTS:rl,ADD_LOADED_MODULE:Xs,SET_DOMAIN_STATE:cl,SET_GLOBAL_OFFER_DATA_CART:ul}),fl=Object.assign(Object.assign({},so),{LOAD_MODULES:el,DISMISS_INSTANT_PURCHASE:sl,PROCESS_PROGRESSION:ol,OFFER_LIFECYCLE:ll,OFFER_ENGAGEMENT:dl,SET_PARTNER_VALIDATION_STATUS:ie});function yl(e,t){return t<=0||e<=0||t>e?0:Math.ceil(e/t)}function hl(e,t){const n=[];if(t<=0||e<=0||t>e)throw Error(`Could not generate the progression groups with groupSize: ${t} and totalCount: ${e}`);for(let a=0;a<yl(e,t);a++){const i=[];for(let n=0;n<t;n++)i.push(Math.min(a*t+n,e-1));n.push([...new Set(i)])}return n}const ml=Symbol("root");function vl(){return{[ml]:{}}}const gl=Object.assign({progression:function(e=null,t){switch(t.type){case tl:if(function(e){const{totalCount:t,currentGroupIndex:n,groupSize:a}=e;return t>=0&&a>=0&&n>=0&&a<=t&&n<yl(t,a)}(t.payload)){const{totalCount:e,_:n,groupSize:a}=t.payload;return Object.assign(Object.assign({},t.payload),{indexGroups:hl(e,a)})}return null;case il:{const{groupSize:n}=t.payload,a=null==e?void 0:e.totalCount;return a&&n<=a&&n>0?Object.assign(Object.assign({},e),{groupSize:n,indexGroups:hl(a,n),currentGroupIndex:0}):null}case nl:{if(!e)return null;const{totalCount:t,groupSize:n,currentGroupIndex:a}=e;return t>0&&n>0&&a>=0?Object.assign(Object.assign({},e),{currentGroupIndex:Math.min(a+1,yl(t,n)-1)}):null}case al:{if(!e)return null;const{totalCount:t,groupSize:n,currentGroupIndex:a}=e;return t>0&&n>0&&a>=0?Object.assign(Object.assign({},e),{currentGroupIndex:Math.max(a-1,0)}):null}default:return e}},slots:function(e=[],t){return t.type===rl?t.payload:e},module:function(e={loadedModules:[]},t){return t.type===Xs?Object.assign(Object.assign({},e),{loadedModules:[...e.loadedModules,t.payload]}):e},domainStates:function(e=vl(),t){if(t.type===cl){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:ml;return n===ml?e:Object.assign(Object.assign({},i.assocPath([n,t.payload.key],Number(t.payload.value),e)),{[ml]:{}})}return e}return e},globalOfferDataState:function(e={},t){if(t.type===ul){if(t.payload.cart){const n=`module${t.payload.offerPositionIndex}`;return Object.assign(Object.assign({},e),{[n]:{cart:t.payload.cart}})}return e}return e}},cr);function bl(e={}){return Object.assign(Object.assign(Object.assign({},function(e={}){return Object.assign({layout:Qo(),breakpoint:{breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},active:Xo(),fonts:[],signal:{queue:[],processed:[]},serializableCache:lr(),settings:{closeOnComplete:!0},customStates:{root:{}}},e)}(e)),{progression:null,slots:[],module:{loadedModules:[]},domainStates:vl(),globalOfferDataState:{}}),e)}function Il(e){var t;return!!e.progression&&(1===e.progression.groupSize&&e.progression.currentGroupIndex===(null===(t=e.progression)||void 0===t?void 0:t.totalCount)-1)}function El(e){return e.progression?{activeGroupIndex:e.progression.currentGroupIndex,totalOffers:e.progression.totalCount,totalGroups:yl(e.progression.totalCount,e.progression.groupSize),isLast:Il(e)}:null}function Sl(e,t){return e.domainStates[`module${t}`]||{offerComplete:0,checkout:0}}function xl(e){return Object.values(e.globalOfferDataState).reduce(((e,t)=>{if(t&&"object"==typeof t&&"cart"in t){const n=t.cart;if(Array.isArray(n))return e+n.reduce(((e,t)=>e+("number"==typeof t.quantity?t.quantity:0)),0)}return e}),0)}function Cl(n){var i;const{config:o,position:r,visible:s,container:l,testId:c}=n,d=zn(),u=Nn(),p=a.useSelector(er),f=a.useSelector((e=>function(e,t){return e.globalOfferDataState[`module${t}`]}(e,r))),y=t.useContext(qn),h=t.useContext(Hn),m=`rokt-${o.layoutVariant.moduleName}-${d}`;return e.jsxs(e.Fragment,{children:[!s&&e.jsx("div",{style:{position:"absolute",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},"aria-hidden":"true"}),e.jsx(m,{style:{display:"flex",flexDirection:"column"===l?"column":"row",width:"100%"},slotInstanceGuid:o.instanceGuid,layoutSchema:JSON.stringify(o.layoutVariant.layoutVariantSchema),schemaVersion:y,childLayouts:JSON.stringify(null!==(i=o.layoutVariant.childLayouts)&&void 0!==i?i:[]),offerData:JSON.stringify(o.offer),offerPositionIndex:r,visible:s,container:l,interactivity:u,"data-testid":c,"data-e2e":`OfferSlot-${r}`,inert:(null==h?void 0:h.inert)&&!s?"":void 0,"aria-hidden":(null==h?void 0:h.inert)?void 0:!s,"module-component":!0,"plugin-id":d,"active-breakpoint":B(p),offerState:JSON.stringify(f)})]})}function wl({schema:n,testId:i}){const o=n.styles,r=a.useSelector((e=>e.slots)),s=t.useRef(null),l=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0})),c=Nn(),{tabIndex:d,isDisabled:u,styles:p}=m(c);return r.length&&r[l]?e.jsx(Na,{styles:o,children:({classnames:a})=>e.jsx("div",{ref:s,"data-testid":i,"data-e2e":"OneByOneDistribution",className:null==a?void 0:a.own,tabIndex:d,"aria-hidden":u,style:Object.assign({position:"relative",transition:`height ${n.transition.settings.duration/2}ms ease-in-out`,overflow:"hidden",boxSizing:"content-box"},p),children:t.Children.toArray(r.map(((t,a)=>e.jsx(Fi,{effect:n.transition,visible:a===l,parentElement:s.current,children:e.jsx(Cl,{config:t,position:a,visible:a===l,container:"column"})}))))})}):null}const Ol=a.connect((function(e,{schema:t}){var n,a,i;const o=t.startPosition||1;if((null===(n=e.progression)||void 0===n?void 0:n.totalCount)&&(null===(a=e.progression)||void 0===a?void 0:a.groupSize)){const t=yl(e.progression.totalCount,e.progression.groupSize);let n;n=o>0?o-1:t+o>-1?t+o:0;return{numOfIndicators:t-n>-1?t-n:0,activeIndex:null!==(i=e.progression.currentGroupIndex)&&void 0!==i?i:0,startIndex:n}}return{numOfIndicators:0,activeIndex:0,startIndex:0}}))((function({activeIndex:t,startIndex:n,numOfIndicators:a,schema:i}){const o=Nn(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=Array(a).fill(i.indicator);return a>1&&(u=a+n-1,(d=t)>=n&&d<=u)?e.jsx(Yt,{children:a=>e.jsx(Na,{styles:i.styles,children:i=>{var o;const d=i.classnames,u=e=>{var n,a;return e===t?`${null==d?void 0:d.indicator} ${(null==d?void 0:d.activeIndicator)?d.activeIndicator:null!==(n=null==d?void 0:d.seenIndicator)&&void 0!==n?n:""}`:e<t?`${null==d?void 0:d.indicator} ${null!==(a=null==d?void 0:d.seenIndicator)&&void 0!==a?a:""}`:null==d?void 0:d.indicator};return e.jsx("div",{className:null!==(o=null==d?void 0:d.own)&&void 0!==o?o:"",style:Object.assign({display:"flex",flexDirection:"row"},s),"data-e2e":"ProgressIndicator",tabIndex:r,"aria-hidden":l,children:y.Children.toArray(c.map(((t,i)=>e.jsx("span",{className:u(i+n),style:{display:"flex"},children:a({state:{indicatorPosition:String(i+1+n)}})(t)}))))})}})}):null;var d,u}));const Tl="partnerValidationUI",Al="stackedViewableItems";function jl(n){var o;const r=a.useDispatch(),s=a.useSelector((e=>e.slots)),l=null!==(o=n.schema.viewableItems)&&void 0!==o?o:[],c=Ea(l.reduce(((e,t,n)=>Object.assign(Object.assign({},e),{[n]:t.when})),{})),d=i.compose((e=>{var t;return e&&(null===(t=l[e[0]])||void 0===t?void 0:t.value)||s.length}),i.find((([e,t])=>t)),i.toPairs)(c);t.useEffect((()=>{r({type:Zi,payload:{key:Al,value:String(d)}})}),[d]);const u=s.slice(0,d),p=Nn(),{tabIndex:f,isDisabled:y,styles:h}=m(p);return(null==u?void 0:u.length)>0?e.jsx(Na,{styles:n.schema.styles,children:({classnames:a})=>e.jsx("div",{"data-testid":n.testId,"data-e2e":"StackedDistribution",className:null==a?void 0:a.own,"aria-hidden":y,tabIndex:f,style:Object.assign({display:"flex",flexDirection:"column"},h),children:t.Children.toArray(u.map(((t,n)=>e.jsx(Cl,{config:t,position:n,visible:!0,container:"column"}))))})}):null}function Rl(n){const i=n.schema.styles,o=a.useDispatch(),r=Nn(),s="Backward"===n.schema.direction?"Previous":"Next",{tabIndex:l,styles:c,isDisabled:d}=m(r),u=()=>{o({type:"Backward"===n.schema.direction?pl.PREV_IN_PROGRESSION:pl.NEXT_IN_PROGRESSION})};return e.jsx(Na,{styles:i,children:({classnames:a})=>{var i;return e.jsx("button",{title:s,className:null==a?void 0:a.own,onClick:u,"data-testid":n.testId,"data-e2e":"ProgressControl","data-e2e-direction":`${n.schema.direction}`,disabled:d,"aria-disabled":d,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:s,tabIndex:l,style:Object.assign({cursor:"pointer"},c),children:e.jsx(xt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}function Nl({schema:n,testId:i}){var o,r,s,l,c,u,p,f,y;const h=a.useSelector((e=>e.progression)),v=null==h?void 0:h.indexGroups[null==h?void 0:h.currentGroupIndex],g=null!==(o=null==h?void 0:h.currentGroupIndex)&&void 0!==o?o:0,b=a.useSelector((e=>e.slots)),I=a.useSelector(ir),E=n.viewableItems.length-1,[S,x]=d({slidesToScroll:null!==(r=n.viewableItems[Math.min(I,E)])&&void 0!==r?r:"auto",containScroll:"trimSnaps"}),C=a.useDispatch(),w=Nn(),{tabIndex:O,isDisabled:T,styles:A}=m(w),j=`${null!==(f=null===(p=null===(u=null===(c=null===(l=null===(s=n.styles)||void 0===s?void 0:s.elements)||void 0===l?void 0:l.own[I])||void 0===c?void 0:c.default)||void 0===u?void 0:u.container)||void 0===p?void 0:p.gap)&&void 0!==f?f:"0"}px`;t.useEffect((()=>{function e(e){var t,n;const a=null!==(t=null==e?void 0:e.selectedScrollSnap())&&void 0!==t?t:0,i=null!==(n=null==e?void 0:e.previousScrollSnap())&&void 0!==n?n:0;a!==g&&(a>i?C({type:pl.NEXT_IN_PROGRESSION}):a<i&&C({type:pl.PREV_IN_PROGRESSION}))}return null!=g&&(null==x||x.on("select",e),null==x||x.scrollTo(g)),()=>{null==x||x.off("select",e)}}),[x,g,C]);const R={overflow:"hidden"},N={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:j,alignItems:"stretch"},L=e=>{var t;return null!==(t=null==v?void 0:v.includes(e))&&void 0!==t&&t},D=n.peekThroughSize[Math.min(I,n.peekThroughSize.length-1)],_=D?"Fixed"===(k=D).type?`${k.value}px`:`${k.value}%`:"0px";var k;const P=null!==(y=n.viewableItems[Math.min(E,I)])&&void 0!==y?y:1,$={flex:`0 0 calc(${(e=>"0px"!==e&&"0%"!==e)(_)?`(100% - 2 * ${_} - (${P} + 1) * ${j})/${P}`:`(100% - (${P} - 1) * ${j})/${P}`})`,position:"relative",display:"flex",overflow:"auto"};return(null==b?void 0:b.length)>0?e.jsx(Na,{styles:n.styles,children:({classnames:n})=>e.jsx("div",{ref:S,style:Object.assign(Object.assign({},R),A),"aria-disabled":T,tabIndex:O,className:null==n?void 0:n.own,"data-e2e":"CarouselDistribution","data-testid":i&&`${i}`,children:e.jsx("div",{style:N,"data-testid":i&&`${i}-container`,"data-e2e":"CarouselDistribution-Container",children:t.Children.toArray(b.map(((t,n)=>e.jsx("div",{style:$,"data-testid":i&&`${i}-slide-${n}`,"data-e2e":`CarouselDistribution-Slide-${n}`,children:e.jsx(Cl,{config:t,position:n,container:"row",visible:L(n)})}))))})})}):null}const Ll=Object.freeze([]);function Dl({schema:n,testId:i}){const o=zn(),r=t.useMemo((()=>ft(o)([{display:"flex",flexDirection:"column"}])),[o]),s=a.useSelector((e=>{var t;return(null===(t=e.progression)||void 0===t?void 0:t.groupSize)||0})),l=a.useSelector((e=>{var t;return(null===(t=e.progression)||void 0===t?void 0:t.indexGroups)||Ll})),c=a.useSelector((e=>e.slots||Ll)),d=t.useMemo((()=>l.map((e=>e.map((e=>c[e])).filter((e=>null!=e))))),[l,c]),u=t.useRef(null),p=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0})),f=Nn(),{tabIndex:y,isDisabled:h,styles:v}=m(f);return d.length?e.jsx(Na,{styles:n.styles,children:({classnames:a})=>e.jsx("div",{ref:u,"data-testid":i,"data-e2e":"GroupedDistribution","aria-disabled":h,tabIndex:y,style:Object.assign({position:"relative",transition:`height ${n.transition.settings.duration/2}ms ease-in-out`,overflow:"hidden",boxSizing:"content-box"},v),children:t.Children.toArray(d.map(((o,l)=>e.jsx(Fi,{effect:n.transition,visible:l===p,parentElement:u.current,containerClassName:[r,null==a?void 0:a.own].filter(Boolean).join(" ")||void 0,children:t.Children.toArray(o.map(((t,n)=>{const a=s*l+n;return e.jsx(Cl,{config:t,position:a,visible:l===p,container:"column",testId:i?`${i}-child${a}`:void 0})})))}))))})}):null}const _l={action:{CaptureOnly:"CaptureOnly",Url:"Url",Fulfillment:"Fulfillment",ExternalPaymentTrigger:"ExternalPaymentTrigger"},urlBehavior:{newTab:"newTab",roktWebViewSDK:"roktWebViewSDK",self:"self"},signalType:{SignalResponse:"SignalResponse",SignalGatedResponse:"SignalGatedResponse",SignalSecondaryResponse:"SignalSecondaryResponse"},conversionType:{Default:"Default",RealTime:"RealTime",RealTimeReferral:"RealTimeReferral"}};function kl(e,t,n=!1){return Error(`Could not translate ${e} with guid: ${t}${n?" for child layout":""}`)}function Pl(e,t=!1){var n;try{if(e.responseOptionsMap||t)return Object.assign(Object.assign({},e),{responseOptionsMap:i.mapObjIndexed($l,null!==(n=e.responseOptionsMap)&&void 0!==n?n:{})});{const t=`Creative: ${e.instanceGuid}, did not receive a valid response options map.`;throw new N("NO_CREATIVE_RESPONSE_OPTIONS_MAP",t)}}catch(n){throw n.message?n:kl("Creative",e.instanceGuid,t)}}function $l(e){try{let t,n;if(e.urlBehavior&&(t=_l.urlBehavior[e.urlBehavior]),e.conversionType&&(n=_l.conversionType[e.conversionType]),"External"===e.action){const t=`Creative response with instanceGuid '${e.instanceGuid}' uses legacy action type 'External'. This should be 'ExternalPaymentTrigger'.`;throw new N("LEGACY_EXTERNAL_ACTION_TYPE",t)}return Object.assign(Object.assign({},e),{urlBehavior:t,action:_l.action[e.action],signalType:_l.signalType[e.signalType],conversionType:n})}catch(t){throw t.message?t:kl("CreativeResponse",e.instanceGuid)}}function Fl(e,t,n){try{return JSON.parse(e)}catch(e){throw Error(`Parse JSON failed, invalid JSON file for ${t} with guid ${n}.`)}}function Gl(){t.useEffect((()=>{const e=new ResizeObserver(function(e=100){let t;return()=>{t&&clearTimeout(t),t=setTimeout((()=>{var e,n;null===(n=null===(e=window.frameElement)||void 0===e?void 0:e.iFrameResizer)||void 0===n||n.resize(),t=void 0}),e)}}());return e.observe(document.body),()=>{e.disconnect()}}),[])}const Ml={OneByOneDistribution:function(t){if("OneByOneDistribution"===t.type)return e.jsx(wl,{schema:t.node})},StackedDistribution:function(t){if("StackedDistribution"===t.type)return e.jsx(jl,{schema:t.node})},ProgressIndicator:function(t){if("ProgressIndicator"===t.type)return e.jsx(Ol,{schema:t.node})},ProgressControl:function(t){if("ProgressControl"===t.type)return e.jsx(Rl,{schema:t.node})},Overlay:function(t){if("Overlay"===t.type)return e.jsx(vo,{schema:t.node})},CloseButton:function(t){if("CloseButton"===t.type)return e.jsx(uo,{schema:t.node})},EscapeHatch:(Bl=[function(t,n){if(v("CloseButton",t)){const n=JSON.parse(t.node.data);return e.jsx(uo,{schema:n.node,action:n.action})}},gi],e=>Bl.reduce(((t,n)=>void 0===t?n(e):t),void 0)),CarouselDistribution:function(t){if("CarouselDistribution"===t.type)return e.jsx(Nl,{schema:t.node})},GroupedDistribution:function(t){if("GroupedDistribution"===t.type)return e.jsx(Dl,{schema:t.node})},BottomSheet:function(t){if("BottomSheet"===t.type)return e.jsx(Eo,{schema:t.node})}};var Bl;function Ul(e,t){e({type:Z,payload:{name:"SignalActivation",parentGuid:t}})}function Vl({pageInstanceGuid:n}){var o,r,s,l,c,d;const u=a.useSelector((e=>e.layout),i.equals),p=a.useDispatch(),f=a.useSelector((e=>({breakpoint:e.breakpoint,progression:El(e),customStates:e.customStates.root,domainStates:e.domainStates[ml]})),i.equals),y=a.useSelector((e=>e.slots.length)),h=a.useSelector((e=>{var t;const n=Number(null!==(t=e.serializableCache.get(Al))&&void 0!==t?t:"");return y-n})),m=a.useSelector(xl);de(Tt(),p),t.useEffect((()=>(u&&document.body.addEventListener("click",Ul.bind(null,p,u.instanceGuid),{once:!0}),()=>{u&&document.body.removeEventListener("click",Ul.bind(null,p,u.instanceGuid))})),[null==u?void 0:u.instanceGuid]),Gl(),t.useEffect((()=>{if(u){const e={type:Z,payload:{name:"SignalImpression",parentGuid:u.instanceGuid}},t={type:io,payload:{code:"LAYOUT_IMPRESSED"}};p(e),p(t)}}),[u]);const v=e=>{p({type:fl.REPORT_ERROR,payload:e})},g=a.useSelector((e=>e.breakpoint.initialised));if(u&&g){const t=Ht({})({state:{progression:(null!==(r=null===(o=f.progression)||void 0===o?void 0:o.activeGroupIndex)&&void 0!==r?r:0)+1,maxProgression:null!==(l=null===(s=f.progression)||void 0===s?void 0:s.totalGroups)&&void 0!==l?l:1,availableOffersCount:null!==(d=null===(c=f.progression)||void 0===c?void 0:c.totalGroups)&&void 0!==d?d:y,selectedCatalogItemQuantity:m,hiddenItemCount:h}}),a=Ri(v);return e.jsx(Gn,{info:{layoutType:"OuterLayout",pageInstanceGuid:n},children:e.jsx(Jt,{value:t,children:e.jsx(wt,{value:a,overrides:Ml,children:e.jsx(It.Provider,{value:f,children:e.jsx(gt.Provider,{value:p,children:e.jsx(en.Provider,{value:"OUTER",children:e.jsx(qn.Provider,{value:u.layoutSchemaVersion,children:e.jsx(xt,{children:e=>e(u.layoutSchema)})})})})})})})})}return null}var zl=Object.freeze({__proto__:null,getDistribution:function e(t){var n;switch(t.type){case"OneByOneDistribution":case"StackedDistribution":case"CarouselDistribution":case"GroupedDistribution":return t;case"Row":case"Column":case"When":case"ZStack":case"FlowRow":case"InlineContainer":case"ScrollableRow":case"ScrollableColumn":case"BottomSheet":case"Overlay":for(const n of t.node.children){const t=e(n);if(t)return t}break;case"EscapeHatch":try{const{name:a,body:i}=JSON.parse(t.node.data);if(("loading-extension"===a||"minimized-bottomsheet-extension"===a)&&(null===(n=null==i?void 0:i.children)||void 0===n?void 0:n.length))for(const t of i.children){const n=e(t);if(n)return n}break}catch(e){break}case"StaticImage":case"DataImage":case"RichText":case"BasicText":case"ProgressIndicator":case"CreativeResponse":case"StaticLink":case"CloseButton":case"ProgressControl":case"StaticIcon":case"DataIcon":case"SlideStateTrigger":case"ToggleButtonStateTrigger":case"TimerStateTrigger":case"CatalogStackedCollection":case"CatalogCarouselCollection":case"CatalogResponseButton":case"CatalogQuantityOption":case"CatalogRadioGroup":case"CatalogQuantityCounter":case"PartnerEventButtonTrigger":case"CopyToClipboardButton":case"ButtonStateTrigger":case"CatalogCombinedCollection":case"IconGroup":break;default:!function(e){throw Error(`Could not handle layout: ${JSON.stringify(e)}`)}(t)}},getDistributionViewableItems:function(e){switch(null==e?void 0:e.type){case"CarouselDistribution":case"GroupedDistribution":return e.node.viewableItems;default:return}}}),ql=Object.assign({},zl);function*Hl(e,t){const n=ql.getDistribution(t),a=null==n?void 0:n.type,i=yield r.select(ir),o=function(e=0,t){var n;switch(null==t?void 0:t.type){case"CarouselDistribution":case"GroupedDistribution":{const a=Math.min(t.node.viewableItems.length,e);return null!==(n=t.node.viewableItems[a])&&void 0!==n?n:1}default:return 1}}("number"==typeof i?i:0,n);"OneByOneDistribution"!==a&&"CarouselDistribution"!==a&&"GroupedDistribution"!==a||(yield c.put({type:pl.INITIALISE_PROGRESSION,payload:{currentGroupIndex:0,totalCount:e,groupSize:o}}))}function*Wl(e,t){var n;const{instanceGuid:a,layoutSchemaVersion:o,outerLayoutSchema:r,slots:s}=t.payload;a?yield c.put({type:Z,payload:{name:"SignalLoadComplete",parentGuid:a}}):yield c.put({type:ao,payload:{level:Oo,code:Mo,message:"Layout instance guid does not exist"}}),yield c.put({type:el,payload:{modules:s.map((e=>e.layoutVariant.moduleName))}}),yield c.put({type:zi,payload:r.breakpoints}),yield c.put({type:pl.LAYOUT_UPDATE,payload:{instanceGuid:a,layoutSchemaVersion:o,layoutSchema:r.layout,settings:r.settings}}),yield c.put({type:pl.SET_SLOTS,payload:s}),i.isNil(r.settings)||(yield c.put({type:pl.SET_SETTINGS,payload:r.settings})),yield*Hl(s.length,r.layout);const l=yield*function*(e,t,n){const a=null==t?void 0:t.enablePartnerValidation,i=["add-to-cart"],o=n.some((e=>i.some((t=>t===e.layoutVariant.moduleName))));if(a&&o)try{yield c.call(e.send,mr.PartnerValidationEvent.OPT_IN_TO_PARTNER_VALIDATION),yield c.spawn(Kl,e,mr.PartnerValidationEvent.SHOW_PARTNER_VALIDATION_STATUS,(()=>({type:"ACTIVE/ADD",payload:{id:Tl}})))}catch(e){return yield c.put({type:ao,payload:{level:wo,code:Uo,message:"Failed to establish partner validation."}}),"FAILURE"}return"OK"}(e.partner,r.settings,s);"OK"===l&&(yield c.call($r,e.display,r.display,null===(n=r.settings)||void 0===n?void 0:n.frameControls))}function*Kl(e,t,n){const a=l.eventChannel((a=>{const i=e.onEvent(t).subscribe((e=>{a(n(e))}));return()=>{i.unsubscribe()}}));for(;;){const e=yield c.take(a);yield c.put(e)}}function Yl(e){return kc(e)}function Jl(e,t){return Error(`Migration process from v0_0 to v0_1 failed: could not transform ${e} node. For more details: ${t}`)}const Zl=i.all(i.anyPass([function(e){return"Row"===e.type&&tc(e.node.children)},function(e){return"Column"===e.type&&tc(e.node.children)},oc,rc])),Ql=i.all(i.anyPass([function(e){return"Row"===e.type&&nc(e.node.children)},function(e){return"Column"===e.type&&nc(e.node.children)},rc,oc,function(e){return"DataImage"===e.type},function(e){return"When"===e.type&&nc(e.node.children)}])),Xl=i.all(i.anyPass([function(e){return"Row"===e.type&&ac(e.node.children)},function(e){return"Column"===e.type&&ac(e.node.children)},rc,oc])),ec=i.all(i.anyPass([function(e){return"Row"===e.type&&ic(e.node.children)},function(e){return"Column"===e.type&&ic(e.node.children)},oc,function(e){return"RichText"===e.type},rc,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&ic(e.node.children)},function(e){return"StaticLink"===e.type&&ic(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CloseButton"===e.type&&ic(e.node.children)}]));function tc(e){return Zl(e)}function nc(e){return Ql(e)}function ac(e){return Xl(e)}function ic(e){return ec(e)}function oc(e){return"StaticImage"===e.type}function rc(e){return"BasicText"===e.type}const sc=i.lensPath(["styles","elements","link"]),lc=i.lensPath(["styles","elements","activeIndicator"]),cc=i.lensPath(["styles","elements","indicator"]),dc=i.lensPath(["styles","elements","seenIndicator"]),uc=i.lensPath(["focussed"]),pc=i.lensPath(["hovered"]),fc=i.lensPath(["default"]),yc=i.lensPath(["pressed"]),hc=e=>{var t;return{text:null!==(t=null==e?void 0:e.text)&&void 0!==t?t:{}}},mc=i.when(i.hasPath(["styles","elements","link"]),i.pipe(i.over(sc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default})))),i.over(sc,i.map(i.when(i.has("focussed"),i.over(uc,hc)))),i.over(sc,i.map(i.when(i.has("hovered"),i.over(pc,hc)))),i.over(sc,i.map(i.when(i.has("default"),i.over(fc,hc)))),i.over(sc,i.map(i.when(i.has("pressed"),i.over(yc,hc)))))),vc=i.pipe(i.when(i.hasPath(["styles","elements","activeIndicator"]),i.over(lc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","indicator"]),i.over(cc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","seenIndicator"]),i.over(dc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))));function gc(e,t){return e?{elements:{own:e.elements.own.map(t)}}:void 0}const bc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),Ic=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),Ec=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),Sc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),xc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),Cc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),wc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),Oc=e=>{switch(e){case"is":return"is";case"is not":return"is-not";case"is below":return"is-below";case"is above":return"is-above";default:throw Jl("When",`Invalid condition: ${e}`)}},Tc=e=>{switch(e){case"breakpoint":return"Breakpoint";case"progression":return"Progression";case"position":return"Position";default:throw Jl("When",`Invalid target: ${e}`)}},Ac=e=>{const{target:t,condition:n,value:a}=e;return{type:Tc(t),predicate:{condition:Oc(n),value:a}}};function jc(e){const t={type:"FadeInOut",settings:{duration:e.transition.settings.duration}};return{styles:e.style,transition:t}}function Rc(e){const t=e.children.map((e=>kc(e)));if(tc(t))return Object.assign(Object.assign({},e),{children:t,styles:gc(e.styles,xc)});throw Jl("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function Nc(e){const t=e.children.map((e=>kc(e)));if(nc(t))return Object.assign(Object.assign({},e),{children:t,styles:gc(e.styles,Cc)});throw Jl("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function Lc(e){const t=e.children.map((e=>kc(e)));if(ac(t))return Object.assign(Object.assign({},e),{children:t,styles:gc(e.styles,wc)});throw Jl("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}const Dc=e=>({own:e.overlayContainer,wrapper:e.overlayWrapper});function _c(e){var t,n;const a=(null===(t=e.styles)||void 0===t?void 0:t.elements)?{elements:Dc(null===(n=e.styles)||void 0===n?void 0:n.elements)}:void 0,i=e.children.map((e=>kc(e)));if(ic(i))return Object.assign(Object.assign({},e),{styles:a,children:i});throw Jl("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function kc(e){switch(e.type){case"When":return{type:"When",node:(s=e.node,{predicates:s.predicates.map(Ac),children:s.children.map((e=>kc(e)))})};case"OneByOneDistribution":return{type:e.type,node:jc(e.node)};case"Overlay":return{type:e.type,node:_c(e.node)};case"Column":return{type:e.type,node:(r=e.node,{styles:gc(r.styles,bc),children:r.children.map((e=>kc(e)))})};case"Row":return{type:e.type,node:(o=e.node,{styles:gc(o.styles,Ic),children:o.children.map((e=>kc(e)))})};case"RichText":return{type:e.type,node:(i=e.node,mc(i))};case"CloseButton":return{type:e.type,node:Rc(e.node)};case"CreativeResponse":return{type:e.type,node:Nc(e.node)};case"StaticLink":return{type:e.type,node:Lc(e.node)};case"StaticImage":return{type:e.type,node:(a=e.node,Object.assign(Object.assign({},a),{styles:gc(a.styles,Ec)}))};case"DataImage":return{type:e.type,node:(n=e.node,Object.assign(Object.assign({},n),{styles:gc(n.styles,Sc)}))};case"ProgressIndicator":return{type:e.type,node:(t=e.node,vc(t))};default:return e}var t,n,a,i,o,r,s}function Pc(e){return Ud(e)}function $c(e,t){return Error(`Migration process from v0_23 to v1_0 failed: could not transform ${e} node. For more details: ${t}`)}const Fc=e=>"scroll"===e||"auto"===e?"visible":e,Gc=i.lensPath(["elements","own"]),Mc=i.lensPath(["transitions","transition","value","own"]),Bc=i.lensPath(["elements","wrapper"]),Uc=i.lensPath(["transitions","transition","value","wrapper"]),Vc=i.lensPath(["elements","indicator"]),zc=i.lensPath(["transitions","transition","value","indicator"]),qc=i.lensPath(["elements","activeIndicator"]),Hc=i.lensPath(["transitions","transition","value","activeIndicator"]),Wc=i.lensPath(["elements","seenIndicator"]),Kc=i.lensPath(["transitions","transition","value","seenIndicator"]),Yc=i.lensPath(["default","container","overflow"]),Jc=i.lensPath(["pressed","container","overflow"]),Zc=i.lensPath(["hovered","container","overflow"]),Qc=i.lensPath(["focussed","container","overflow"]),Xc=i.lensPath(["disabled","container","overflow"]),ed=i.lensPath(["container","overflow"]),td=i.pipe(i.when(i.hasPath(["default","container","overflow"]),i.over(Yc,Fc)),i.when(i.hasPath(["pressed","container","overflow"]),i.over(Jc,Fc)),i.when(i.hasPath(["hovered","container","overflow"]),i.over(Zc,Fc)),i.when(i.hasPath(["focussed","container","overflow"]),i.over(Qc,Fc)),i.when(i.hasPath(["disabled","container","overflow"]),i.over(Xc,Fc))),nd=i.when(i.hasPath(["container","overflow"]),i.over(ed,Fc)),ad=i.pipe(i.when(i.hasPath(["elements","own"]),i.over(Gc,i.map(td))),i.when(i.hasPath(["transitions","transition","value","own"]),i.over(Mc,nd))),id=i.when(i.has("transitions"),(e=>{var t;return i.compose(i.omit(["transitions"]),i.assoc("conditionalTransitions",null===(t=e.transitions)||void 0===t?void 0:t.transition))(e)})),od=i.pipe(ad,id),rd=i.pipe(i.when(i.hasPath(["elements","wrapper"]),i.over(Bc,i.map(td))),i.when(i.hasPath(["transitions","transition","value","wrapper"]),i.over(Uc,nd))),sd=i.pipe(i.when(i.hasPath(["elements","indicator"]),i.over(Vc,i.map(td))),i.when(i.hasPath(["transitions","transition","value","indicator"]),i.over(zc,nd))),ld=i.pipe(i.when(i.hasPath(["elements","activeIndicator"]),i.over(qc,i.map(td))),i.when(i.hasPath(["transitions","transition","value","activeIndicator"]),i.over(Hc,nd))),cd=i.pipe(i.when(i.hasPath(["elements","seenIndicator"]),i.over(Wc,i.map(td))),i.when(i.hasPath(["transitions","transition","value","seenIndicator"]),i.over(Kc,nd)));function dd(e){return"StaticImage"===e.type}function ud(e){return"StaticIcon"===e.type}function pd(e){return"BasicText"===e.type}function fd(e){return"DataImage"===e.type}function yd(e){return"DataIcon"===e.type}function hd(e){return"RichText"===e.type}function md(e){return"SlideStateTrigger"===e.type}function vd(e){return"ToggleButtonStateTrigger"===e.type}const gd=i.all(i.anyPass([function(e){return"Row"===e.type&&bd(e.node.children)},function(e){return"Column"===e.type&&bd(e.node.children)},dd,ud,hd,pd,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&bd(e.node.children)},function(e){return"StaticLink"===e.type&&bd(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CarouselDistribution"===e.type},function(e){return"GroupedDistribution"===e.type},function(e){return"CloseButton"===e.type&&bd(e.node.children)},function(e){return"ProgressControl"===e.type&&jd(e.node.children)},function(e){return"ZStack"===e.type&&bd(e.node.children)},function(e){return"FlowRow"===e.type&&bd(e.node.children)},md,vd]));function bd(e){return gd(e)}const Id=i.pipe(ad,rd,id);function Ed(e){const t=e.children.map((e=>Ud(e)));if(bd(t))return Object.assign(Object.assign({},i.omit(["settings"],e)),{children:t,allowBackdropToClose:e.settings.allowBackdropToClose,styles:e.styles?Id(e.styles):void 0});throw $c("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function Sd(e){const t=e.children.map((e=>Ud(e)));if(jd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?od(e.styles):void 0});throw $c("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function xd(e){const t=e.children.map((e=>Ud(e)));if(Nd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?od(e.styles):void 0});throw $c("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function Cd(e){const t=e.children.map((e=>Ud(e)));if(jd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?od(e.styles):void 0});throw $c("ProgressControl",`Invalid schema: ${JSON.stringify(e)}`)}const wd=i.pipe(ad,sd,ld,cd,id);const Od=i.all(i.anyPass([pd,dd,ud,fd,yd,function(e){return"Row"===e.type&&Td(e.node.children)},function(e){return"FlowRow"===e.type&&Td(e.node.children)},function(e){return"Column"===e.type&&Td(e.node.children)},function(e){return"ZStack"===e.type&&Td(e.node.children)},function(e){return"When"===e.type&&Td(e.node.children)}]));function Td(e){return Od(e)}const Ad=i.all(i.anyPass([pd,dd,ud,function(e){return"Row"===e.type&&jd(e.node.children)},function(e){return"FlowRow"===e.type&&jd(e.node.children)},function(e){return"Column"===e.type&&jd(e.node.children)},function(e){return"ZStack"===e.type&&jd(e.node.children)},function(e){return"When"===e.type&&jd(e.node.children)}]));function jd(e){return Ad(e)}const Rd=i.all(i.anyPass([pd,dd,ud,fd,yd,function(e){return"Row"===e.type&&Nd(e.node.children)},function(e){return"FlowRow"===e.type&&Nd(e.node.children)},function(e){return"Column"===e.type&&Nd(e.node.children)},function(e){return"ZStack"===e.type&&Nd(e.node.children)},function(e){return"When"===e.type&&Nd(e.node.children)}]));function Nd(e){return Rd(e)}function Ld(e){const t=e.children.map((e=>Ud(e)));if(Td(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?od(e.styles):void 0});throw $c("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}function Dd(e){const t=e.children.map((e=>Ud(e)));if(Nd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?od(e.styles):void 0});throw $c("CatalogResponseButton",`Invalid schema: ${JSON.stringify(e)}`)}function _d(e){return"Row"===e.type&&$d(e.node.children)}function kd(e){return"Column"===e.type&&$d(e.node.children)}const Pd=i.all(i.anyPass([pd,dd,ud,fd,yd,hd,function(e){return"StaticLink"===e.type},md,vd,function(e){return"CatalogResponseButton"===e.type},_d,function(e){return"FlowRow"===e.type&&$d(e.node.children)},kd,function(e){return"ZStack"===e.type&&$d(e.node.children)},function(e){return"When"===e.type&&$d(e.node.children)}]));function $d(e){return Pd(e)}const Fd=i.anyPass([_d,kd]);function Gd(e){const t=Ud(e.template);if(function(e){return Fd(e)}(t))return Object.assign(Object.assign({},e),{template:t,styles:e.styles?od(e.styles):void 0});throw $c("CatalogStackedCollection",`Invalid schema: ${JSON.stringify(e)}`)}function Md(e){const t=e.children.map((e=>Ud(e)));if(Td(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?od(e.styles):void 0});throw $c("ToggleButtonStateTrigger",`Invalid schema: ${JSON.stringify(e)}`)}function Bd(e){const t=e.transition?{inTransition:e.transition.in,outTransition:e.transition.out}:void 0;return Object.assign(Object.assign({},e),{children:e.children.map((e=>Ud(e))),transition:t})}function Ud(e){switch(e.type){case"Row":return{type:e.type,node:(g=e.node,Object.assign(Object.assign({},g),{children:g.children.map((e=>Ud(e))),styles:g.styles?od(g.styles):void 0}))};case"When":return{type:e.type,node:Bd(e.node)};case"FlowRow":return{type:e.type,node:(v=e.node,Object.assign(Object.assign({},v),{styles:v.styles?od(v.styles):void 0,children:v.children.map((e=>Ud(e)))}))};case"Column":return{type:e.type,node:(m=e.node,Object.assign(Object.assign({},m),{children:m.children.map((e=>Ud(e))),styles:m.styles?od(m.styles):void 0}))};case"ZStack":return{type:e.type,node:(h=e.node,Object.assign(Object.assign({},h),{styles:h.styles?od(h.styles):void 0,children:h.children.map((e=>Ud(e)))}))};case"Overlay":return{type:e.type,node:Ed(e.node)};case"ProgressControl":return{type:e.type,node:Cd(e.node)};case"CarouselDistribution":return{type:"CarouselDistribution",node:(y=e.node,Object.assign(Object.assign({},i.omit(["settings"],y)),{viewableItems:y.settings.viewableItems,peekThroughSize:y.settings.peekThroughSize,styles:y.styles?od(y.styles):void 0}))};case"CloseButton":return{type:"CloseButton",node:Sd(e.node)};case"CreativeResponse":return{type:"CreativeResponse",node:xd(e.node)};case"GroupedDistribution":return{type:"GroupedDistribution",node:(f=e.node,Object.assign(Object.assign({},i.omit(["settings"],f)),{viewableItems:f.settings.viewableItems,transition:f.settings.transition,styles:f.styles?od(f.styles):void 0}))};case"OneByOneDistribution":return{type:"OneByOneDistribution",node:(p=e.node,Object.assign(Object.assign({},p),{styles:p.styles?od(p.styles):void 0}))};case"ProgressIndicator":return{type:"ProgressIndicator",node:(d=e.node,Object.assign(Object.assign({},i.omit(["settings"],d)),{startPosition:null===(u=d.settings)||void 0===u?void 0:u.startPosition,styles:d.styles?wd(d.styles):void 0}))};case"SlideStateTrigger":return{type:"SlideStateTrigger",node:(c=e.node,Object.assign(Object.assign({},c),{styles:c.styles?od(c.styles):void 0}))};case"StackedDistribution":return{type:"StackedDistribution",node:(l=e.node,Object.assign(Object.assign({viewableItems:[]},l),{styles:l.styles?od(l.styles):void 0}))};case"StaticLink":return{type:"StaticLink",node:Ld(e.node)};case"ToggleButtonStateTrigger":return{type:"ToggleButtonStateTrigger",node:Md(e.node)};case"CatalogResponseButton":return{type:"CatalogResponseButton",node:Dd(e.node)};case"CatalogStackedCollection":return{type:"CatalogStackedCollection",node:Gd(e.node)};case"RichText":return{type:"RichText",node:(s=e.node,Object.assign(Object.assign({},s),{styles:s.styles?id(s.styles):void 0}))};case"DataImage":return{type:"DataImage",node:(r=e.node,Object.assign(Object.assign({},r),{styles:r.styles?id(r.styles):void 0}))};case"StaticImage":return{type:"StaticImage",node:(o=e.node,Object.assign(Object.assign({},o),{styles:o.styles?id(o.styles):void 0}))};case"DataIcon":return{type:"DataIcon",node:(a=e.node,Object.assign(Object.assign({},a),{styles:a.styles?id(a.styles):void 0}))};case"StaticIcon":return{type:"StaticIcon",node:(n=e.node,Object.assign(Object.assign({},n),{styles:n.styles?id(n.styles):void 0}))};case"BasicText":return{type:"BasicText",node:(t=e.node,Object.assign(Object.assign({},t),{styles:t.styles?id(t.styles):void 0}))};default:return e}var t,n,a,o,r,s,l,c,d,u,p,f,y,h,m,v,g}function Vd(e){const t=e.split("."),n=Number(t[0]),a=Number(t[1]);if(t.length<2||Number.isNaN(n)||Number.isNaN(a))throw Error(`Fail to convert version ${e} to a valid version.`);return{major:n,minor:a}}function zd(e,t){return e.major===t.major&&e.minor===t.minor}const qd=(e,t,n)=>i.allPass([i.lte(e),i.gte(t)])(n);function Hd(e,t){return zd(t,{major:0,minor:0})?Hd(Yl(e),{major:0,minor:1}):function(e,t){return 0===t.major&&qd(1,23,t.minor)}(0,t)?Hd(Pc(e),{major:1,minor:0}):e}function Wd(e,t){return zd(t,{major:0,minor:0})?Wd(function(e){return Object.assign(Object.assign({},e),{layout:Yl(e.layout)})}(e),{major:0,minor:1}):function(e,t){return 0===t.major&&qd(1,23,t.minor)}(0,t)?Wd(function(e){return Object.assign(Object.assign({},e),{layout:Pc(e.layout)})}(e),{major:1,minor:0}):e}function Kd(e,t,n,a){const i=Vd(n);if(a){const s=Vd(a);if(r=i,(o=s).major<r.major||o.major===r.major&&o.minor<r.minor||zd(s,i))return t(e,s);throw Error(`Could not migrate received layout config, config schema version ${a} is higher than the supported version ${n}.`)}return t(e,Vd("0.0"));var o,r}function Yd(e){var t;try{return Object.assign(Object.assign({},i.clone(e)),{offer:Object.assign(Object.assign({},i.clone(e.offer)),{creative:Pl(e.offer.creative)}),layoutVariant:Object.assign(Object.assign({},i.clone(e.layoutVariant)),{layoutVariantSchema:"string"==typeof e.layoutVariant.layoutVariantSchema?Fl(e.layoutVariant.layoutVariantSchema,"LayoutSlotLayoutVariant",e.instanceGuid):e.layoutVariant.layoutVariantSchema,childLayouts:i.map(Jd,null!==(t=e.layoutVariant.childLayouts)&&void 0!==t?t:[])})})}catch(t){throw t.message?t:kl("Slot",e.instanceGuid)}}function Jd(e){return Object.assign(Object.assign({},i.clone(e)),{childLayoutSchema:"string"==typeof e.childLayoutSchema?Fl(e.childLayoutSchema,"ChildLayoutRootSchema",e.childLayoutId):e.childLayoutSchema})}function Zd(e){if(e){const t=function(e){try{return Object.assign(Object.assign({},i.clone(e)),{outerLayoutSchema:"string"==typeof e.outerLayoutSchema?Fl(e.outerLayoutSchema,"LayoutRootLayoutSchema",e.instanceGuid):e.outerLayoutSchema,slots:i.map(Yd,e.slots)})}catch(t){throw t.message?t:kl("LayoutConfig",e.instanceGuid)}}(e);return function(e,t){const{layoutSchemaVersion:n}=e,a=i.lensPath(["outerLayoutSchema"]),o=i.lensPath(["slots"]),r=i.lensPath(["layoutVariant","layoutVariantSchema"]);return i.pipe(i.over(o,i.map(i.over(r,(e=>Kd(e,Hd,t,n))))),i.over(a,(e=>Kd(e,Wd,t,n))))(e)}(t,jo.DCUI_SCHEMA_VERSION)}}const Qd=i.cond([[i.where({signalType:i.equals("SignalSecondaryResponse")}),function*(e,t){return yield r.put({type:ao,payload:{level:To,code:Fo,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}],[i.where({isPositive:i.equals(!0)}),function*(e,t,n,a){var i,o;if("url"in e&&e.url){const s=e.instanceGuid;"SignalProductItemResponse"===e.signalType&&(W(o=a.payload)&&"catalogItemId"in o&&"productSku"in o&&"catalogId"in o&&"accountID"in o&&"string"==typeof o.catalogItemId&&"string"==typeof o.productSku&&"string"==typeof o.catalogId&&"string"==typeof o.accountID)?yield r.put({type:Z,payload:{name:"SignalProductItemResponse",parentGuid:s,objectData:{catalogItemId:a.payload.catalogItemId,productSku:a.payload.productSku,catalogId:a.payload.catalogId,accountId:a.payload.accountID}}}):yield r.put({type:Z,payload:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:s,responseActionPayload:{name:"Url",transformedTrafficURL:e.url,creativeInstanceGuid:e.creativeInstanceGuid}}});const l=t.getOverrideLinkNavigation()?"overrideLinkNavigation":null!==(i=e.urlBehavior)&&void 0!==i?i:"newTab",c=yield*function*(e,t,n){try{const a=yield r.call(Sr,t),i=Or(a)?a.ref:void 0;return yield r.call(e.addAdvertiserWindowRef,i,n),Or(a)||"newTab"!==t.urlBehavior?"SUCCESS":(yield r.put({type:ao,payload:{level:To,code:Go,message:`Did not receive a window reference opening link ${t.url}`}}),"UNSPECIFIED")}catch(e){return yield r.put({type:ao,payload:{level:To,code:Go,message:`Errored attempting to open link ${t.url}: ${e.message}`,stack:e.stack}}),"ERROR"}}(t,{url:e.url,urlBehavior:l,external:{partner:n}},s);return"self"===l?"END":c}return yield r.put({type:ao,payload:{level:To,code:Fo,message:"URL response doesn't have a valid url",additionalInformation:{instanceGuid:e.instanceGuid}}}),"ERROR"}],[i.T,function*(){return"EXPLICIT_DISMISSAL"}]]);function*Xd(e){return yield r.put({type:ao,payload:{level:To,code:Fo,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}function*eu(e,t){let n="IMPLICIT_DISMISSAL";const a=t.payload.offerPositionIndex,i=W(t.payload)||K(t.payload)||H(t.payload)?t.payload:t.payload.responseOption;switch(i.action){case"Url":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:io,payload:{code:"CREATIVE_RESPONSE",message:"creative positive response",data:{type:i.action,isPositive:i.isPositive,responseInstanceGuid:i.instanceGuid}}}),yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*Xd(i):yield*Qd(i,e.context,e.partner,t);break;case"CaptureOnly":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*Xd(i):yield*function*(e){return yield r.put({type:Z,payload:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:"CaptureOnly",creativeInstanceGuid:e.creativeInstanceGuid}}}),e.isPositive?"SUCCESS":"EXPLICIT_DISMISSAL"}(i);break;case"Fulfillment":yield r.put({type:ao,payload:{level:To,code:"INCORRECTLY_HANDLE_FULFILLMENT_ACTION",message:`Fulfillment action is incorrectly handled by the orchestrator instead of a module with the option ID: ${i.instanceGuid}`}}),n="ERROR";break;case"ExternalPaymentTrigger":yield r.put({type:ao,payload:{level:To,code:"INCORRECTLY_HANDLE_EXTERNAL_ACTION",message:`External action was dispatched as an engagement erroneously. Instance GUID: ${i.instanceGuid}`}}),n="ERROR"}Y(t.payload)||(yield r.put(function(e,t){switch(e){case"SUCCESS":return{type:ll,payload:{event:"Completed",completionReason:"Success",offerPositionIndex:t}};case"UNSPECIFIED":return{type:ll,payload:{event:"Completed",completionReason:"Unspecified",offerPositionIndex:t}};case"ERROR":return{type:ll,payload:{event:"Completed",completionReason:"Error",offerPositionIndex:t}};case"EXPLICIT_DISMISSAL":return{type:ll,payload:{event:"Dismissed",dismissalReason:"Explicit",offerPositionIndex:t}};case"IMPLICIT_DISMISSAL":return{type:ll,payload:{event:"Dismissed",dismissalReason:"Implicit",offerPositionIndex:t}};default:return{type:ol,payload:{offerProcessStatus:"END"}}}}(n,a)))}function tu(e,t,n,a){return l.eventChannel((i=>(a().then((e=>Promise.all([t.getRoktPageInstanceGuid(),(t.getUId||t.getPluginInstanceId)()]).then((([t,n])=>Object.assign(Object.assign({},e),{pageInstanceGuid:t,pluginInstanceId:n}))).catch((()=>e)))).then((({moduleConnectorBuilder:t,pageInstanceGuid:a,pluginInstanceId:o})=>{const r=`rokt-${n}-${o}`.toLowerCase();if(!customElements.get(r)){const o=t.withGatewayFactory(e).withLogger((e=>{i({type:ao,payload:{level:e.level,code:e.code,message:e.message,additionalInformation:Object.assign(Object.assign({},e.additionalInformation),{moduleName:n,layoutType:"LayoutVariant",pageInstanceGuid:null!=a?a:"N/A"})}})})).build();customElements.define(r,o)}})).catch((e=>{const t=e&&"object"==typeof e&&"message"in e?e.message:void 0,a=e&&"object"==typeof e&&"stack"in e?e.stack:void 0;i({type:ao,payload:{level:j,code:"FAILED_TO_LOAD_MODULE",message:t,additionalInformation:{stack:a,reason:t?void 0:e,moduleName:n}}}),i(l.END)})),()=>{})))}const nu={"standard-marketing":()=>Promise.resolve().then((function(){return dp})),"add-to-cart":()=>Promise.resolve().then((function(){return gf})),"instant-purchase":()=>Promise.resolve().then((function(){return Ry})),"layouts-xp-sandbox":()=>Promise.resolve().then((function(){return lh}))};function*au(e,t,n){let a=yield r.select((e=>e.module.loadedModules));for(const i of n.payload.modules)a&&!(null==a?void 0:a.includes(i))&&(a=[...a,i],yield r.fork(iu,e,t,i))}function*iu(e,t,n){if(n in nu){yield r.put({type:Xs,payload:n});const a=yield r.call(tu,e,t,n,nu[n]);yield r.call(Po,a)}else yield r.put({type:ao,payload:{level:wo,code:"INVALID_MODULE_NAME",message:`Could not load unknown module ${n}`}})}function*ou(e){const t=yield r.select((e=>ql.getDistributionViewableItems(e.layout?ql.getDistribution(e.layout.layoutSchema):void 0))),n=yield r.select((n=>{var a;const i=ar(e.payload.activeBreakpoint)(n);return i>=0&&t?null!==(a=t[Math.min(t.length-1,i)])&&void 0!==a?a:1:void 0}));if("number"==typeof n){const e={type:il,payload:{groupSize:n}};yield r.put(e)}}const ru=i.cond([[(e,t,n,a)=>"END"===e.offerProcessStatus,i.always({type:Ki})],[(e,t,n,a)=>t.isLastOffer&&n,i.always({type:Ki})],[(e,t,n,a)=>1===a&&!t.isLastOffer,i.always({type:nl})],[i.T,i.always(void 0)]]);function*su(e){const t=yield r.select((e=>({exists:null!==e.progression,isLastOffer:Il(e)}))),n=yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.groupSize}));var a;null!=(a=t)&&a instanceof Object&&"exists"in a&&"isLastOffer"in a&&t.exists&&(yield*function*(e,t,n){const a=yield r.select((e=>e.settings.closeOnComplete)),i=ru(e,t,"boolean"==typeof a&&a,n);i&&(i.type===Ki&&(yield r.put({type:ee,payload:{name:"PLACEMENT_COMPLETED"}})),yield r.put(i))}(e.payload,t,n))}function lu(e){return e.type===ll&&"Interactive"===e.payload.event}function cu(e){return e.type===ll&&"Interactive"!==e.payload.event}function*du(e){switch(e.payload.event){case"Dismissed":yield r.put({type:ol,payload:{offerProcessStatus:"CONTINUE"}});break;case"Completed":yield r.put({type:cl,payload:{key:"offerComplete",value:i.cond([[i.equals("Error"),i.always(-1)],[i.equals("Success"),i.always(1)],[i.T,i.always(2)]])(e.payload.completionReason),offerPositionIndex:e.payload.offerPositionIndex}}),yield r.put({type:ol,payload:{offerProcessStatus:"CONTINUE"}});break;case"Interactive":yield r.put({type:V,payload:{name:"Interactive",offerPositionIndex:e.payload.offerPositionIndex}}),yield r.put({type:ee,payload:{name:"PLACEMENT_INTERACTIVE"}})}}function*uu(e,t){var n;try{const n=yield r.select((e=>{var t,n,a;return null!==(a=null===(n=null===(t=e.layout)||void 0===t?void 0:t.settings)||void 0===n?void 0:n.enablePartnerValidation)&&void 0!==a&&a}));n&&(yield r.call(e.partner.send,mr.PartnerValidationEvent.SET_PARTNER_VALIDATION_STATUS,{errors:t.payload.errors}))}catch(a){const i=yield r.select((({slots:e})=>{var n,a;return"number"==typeof t.payload.offerPositionIndex?null!==(a=null===(n=e.at(t.payload.offerPositionIndex))||void 0===n?void 0:n.layoutVariant.moduleName)&&void 0!==a?a:"Unknown":"orchestrator"})),o=null!==(n=yield r.call(e.context.getRoktPageInstanceGuid))&&void 0!==n?n:"N/A",s={type:ao,payload:{level:R,code:"PARTNER_VALIDATION_UPDATE_FAILED",message:"Failed to update the partner with error status",additionalInformation:{moduleName:i,layoutType:"number"==typeof t.payload.offerPositionIndex?"LayoutVariant":"OuterLayout",pageInstanceGuid:o}}};yield r.put(s)}}function*pu(e){const t=yield r.select((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid}));yield r.put({type:pl.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Ki}),t?(yield r.put({type:Z,payload:{name:"SignalInstantPurchaseDismissal",parentGuid:t}}),yield r.put({type:Z,payload:{name:"SignalDismissal",parentGuid:t}})):yield r.put({type:ao,payload:{level:Oo,code:Mo,message:"ParentGuid does not exist"}})}function*fu(e,t){yield r.all([r.takeEvery(ao,$o.bind(null,e.errorService.raise)),r.takeLatest(Wi,Wl.bind(null,{display:e.displayService,partner:e.partnerInteractionService})),r.takeEvery(el,au.bind(null,t,e.contextService)),r.takeLatest(dl,eu.bind(null,{partner:e.partnerInteractionService,context:e.contextService})),r.takeEvery(ol,su),r.takeEvery(cu,du),ko(lu,du),r.takeLatest(zi,dr.bind(null,e.displayService)),r.takeLatest(Ki,Lr.bind(null,e.contextService)),r.takeLatest(sl,pu),r.takeLatest(no,is),r.takeEvery(Z,Gr),r.takeEvery(ne,Mr),_o(V,ns.bind(null,e.metricsService)),_o(to,Br.bind(null,e.rdnService)),r.takeEvery(io,Fr.bind(null,e.errorService.raise)),r.takeLatest(Ui,ou),r.takeEvery(X,ts),r.takeEvery(ae,as.bind(null,{createChildPlugin:e.childPlugin.create,partner:e.partnerInteractionService,context:e.contextService})),r.takeLatest(ie,uu.bind(null,{partner:e.partnerInteractionService,context:e.contextService}))])}var yu,hu,mu,vu,gu,bu=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},Iu=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)};const Eu={[se.SET_CUSTOM_STATE]:pl.SET_CUSTOM_STATE,[se.SET_DOMAIN_STATE]:pl.SET_DOMAIN_STATE,[se.SET_GLOBAL_OFFER_DATA_CART]:pl.SET_GLOBAL_OFFER_DATA_CART,[se.OFFER_LIFECYCLE]:fl.OFFER_LIFECYCLE,[se.OFFER_ENGAGEMENT]:fl.OFFER_ENGAGEMENT,[se.SET_PARTNER_VALIDATION_STATUS]:fl.SET_PARTNER_VALIDATION_STATUS};class Su{constructor(e){yu.add(this),hu.set(this,void 0),bu(this,hu,e,"f")}getState(e){const t=Iu(this,hu,"f").getState();return{breakpoint:t.breakpoint,progression:El(t),customStates:or(t,e.offerPositionIndex),domainStates:Sl(t,e.offerPositionIndex)}}dispatch(e,t){Iu(this,hu,"f").dispatch(Iu(this,yu,"m",gu).call(this,e,t))}subscribe(e,t){return t(this.getState(e)),Iu(this,hu,"f").subscribe((()=>{t(this.getState(e))}))}}function xu(e,t){const n=l(),a={},i=s.configureStore({reducer:gl,devTools:{name:"Orchestrator"},preloadedState:Object.assign(Object.assign({},bl()),t),middleware:e=>{return e({thunk:!1,serializableCheck:!1}).concat((t=a,e=>e=>n=>{if("object"==typeof n&&null!==n&&"type"in n){const a=n.type,i=t[`${a}`];return e(i?i(n):n)}return e(n)}),n);var t}}),o=(r=function(e){return new Su(e)}(i),c=e.childPlugin.create,d=e.partnerInteractionService.onEvent,(e,t)=>new yn(r,c,e,t,d));var r,c,d;n.run(fu,e,o),n.run(Pr,e,Zd);const u={};return Object.assign(Object.assign({},i),{extend:({reducer:e,interceptors:t,sagas:o})=>{e&&(Object.assign(u,e),i.replaceReducer(s.combineReducers(Object.assign(Object.assign({},gl),u)))),t&&Object.assign(a,t),o&&n.run(o)}})}hu=new WeakMap,yu=new WeakSet,mu=function(e,t,n){return{type:e,payload:Object.assign(Object.assign({},t),{offerPositionIndex:n.offerPositionIndex,creativeInstanceGuid:n.creativeInstanceGuid})}},vu=function(e,t){return t.type===ne?t.payload.signal.parentGuid||(t.payload.signal.parentGuid=e.creativeInstanceGuid):(t.payload.creativeInstanceGuid=e.creativeInstanceGuid,t.payload.parentGuid||(t.payload.parentGuid=e.creativeInstanceGuid)),t},gu=function(e,t){return function(e){return e.type in Eu}(t)?Iu(this,yu,"m",mu).call(this,Eu[t.type],t.payload,e):t.type===Z||t.type===ne?Iu(this,yu,"m",vu).call(this,e,t):t};var Cu=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())}))};const wu={ctx:new Map([[Qs.name,Qs],[Ws.name,Ws],[js.name,js],[Fs.name,Fs],[Ys.name,Ys]]),cache:[]};class Ou{constructor(){this._subscribers=[]}add(e){this._subscribers.push(e)}unsubscribe(){this._subscribers.forEach((e=>e.unsubscribe()))}}const Tu=()=>{},Au=(e=Tu,t=Tu,n=Tu)=>"function"!=typeof e?e:{next:e,error:t,complete:n};class ju{constructor(e){this._setupFn=e}subscribe(e,t,n){const a=Au(e,t,n);let i,o=!0;const r={next:e=>{o&&a.next(e)},complete:()=>{o&&(i&&i(),a.complete(),o=!1)},error:e=>{o&&(a.error(e),o=!1)}};i=this._setupFn(r),o||i&&i();const s=new Ou;return s.add({unsubscribe:()=>{i&&i(),o=!1}}),s}}class Ru extends ju{constructor(){super((e=>(this._isComplete&&e.complete(),this._observers.push(e),()=>this._observers=this._observers.filter((t=>t!==e))))),this._observers=[],this._isComplete=!1}next(e){for(const t of this._observers)t.next(e)}error(e){for(const t of this._observers)t.error(e)}complete(){this._isComplete=!0;for(const e of this._observers)e.complete()}asObservable(){return new ju((e=>{const t=this.subscribe(e);return()=>t.unsubscribe()}))}}const Nu={CompletedBeforeEmit:"CompletedBeforeEmit"};var Lu=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())}))};class Du{constructor(e,t){this._target=e,this._handler=t}subscribe(e,t,n){const a=e.next?e.next.bind(e):e,i={next:(...e)=>Lu(this,void 0,void 0,(function*(){try{yield a(...e)}catch(e){this._handler(e)}})),error:e.error?e.error.bind(e):t,complete:e.complete?e.complete.bind(e):n};return this._target.subscribe(i)}}class _u{constructor(e){this.value=e,this.complete=!1,this.skip=!1}}var ku=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())}))};const Pu={getBreakpointCSSClass:B},$u="CHILD_LAYOUTS/ADD_LAUNCHED",Fu="DYNAMIC_DATA/ADD";function Gu(e={launched:{}},t){if(t.type===$u){const n=t.payload;return n.childLayoutId?i.assocPath(["launched",n.childLayoutId],n.shouldRelaunch,e):e}return e}function Mu(e=null,t){return e}function Bu(e=null,t){if(t.type===Fu){const n=t.payload;return e?n?i.mergeDeepRight(e,n):e:n}return e}function Uu(e,t){var n;return null===(n=e.childLayouts.launched[t])||void 0===n||n}function Vu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer}function zu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.schemaVersion}const qu=Object.freeze({});function Hu(e){var t;return(null===(t=e.dynamicData)||void 0===t?void 0:t.text)?e.dynamicData.text:qu}const Wu="FAILED_TO_LAUNCH_CHILD_LAYOUT";function*Ku(e,t,n){var a;if(yield null===(a=r.select(Uu,n.payload.childLayoutId))||void 0===a||a){const a=yield r.select(zu),o=yield r.select(Vu),s=yield r.select(Hu);try{const l=(i=function(e,t,n,a){return{instanceGuid:e.instanceGuid,childLayoutId:e.childLayoutId,childLayoutSchema:e.childLayoutSchema,offer:t,layoutSchemaVersion:n,content:{text:a}}}(n.payload,o,a,s),JSON.parse(JSON.stringify(i)));try{yield r.call(e.createChildPlugin,{name:"dcui-child",config:l,targetElementSelector:n.payload.targetElementSelector})}catch(e){yield r.call(t,{level:R,code:Wu,message:"Could not launch child layout, failed creating plugin."})}}catch(e){yield r.call(t,{level:R,code:Wu,message:"Could not launch child layout, failed to make the child layout config serializable."})}yield r.put({type:$u,payload:{childLayoutId:n.payload.childLayoutId,shouldRelaunch:!1}})}var i}const Yu={cursor:"pointer",paddingInline:0,paddingBlock:0};function Ju(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Zu(t){var n;const a=bt(),i=Ct(),o=t.schema.response_key||"positive",r=Un(),s=Rt(),l=Nn(),{tabIndex:c,styles:d,isDisabled:u}=m(l),p=null===(n=r.responseOptionsMap)||void 0===n?void 0:n[o];return p&&e.jsx(Na,{styles:t.schema.styles,children:({classnames:n})=>e.jsx("button",{type:"button",tabIndex:c,"aria-disabled":u,disabled:u,style:Object.assign(Object.assign({},Yu),d),"data-testid":t.testId,"data-e2e":"CatalogItemResponse-standard-marketing",onClick:e=>{e.preventDefault();const t=function(e,t,n){var a,i;return Object.assign(Object.assign({},t),{accountID:e.accountId,creativeInstanceGuid:e.creative.instanceGuid,referralCreativeID:e.creative.referralCreativeId,catalogItemId:n.catalogItemId,productSku:n.productSku||(null===(a=n.copy)||void 0===a?void 0:a["provider.productSku"])||"",catalogId:n.catalogId||(null===(i=n.copy)||void 0===i?void 0:i["provider.catalogId"])||""})}(s,p,r);a({type:z,payload:t})},className:null==n?void 0:n.own,children:Ju(t.schema.children,i,t.testId)})})}const Qu={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(Zu,{schema:t.node,testId:n})}};function Xu(){const t=jn(),n=a.useSelector(Hu),i=Zt(),o=Ct(),r=i({state:n},"textContent");return e.jsx(Jt,{value:r,children:e.jsx(wt,{value:o,overrides:Qu,children:e.jsx(xt,{children:e=>e(t)})})})}const ep={staticData:Mu,dynamicData:Bu,childLayouts:Gu};function tp(e={}){return Object.assign({staticData:null,dynamicData:null,childLayouts:{launched:{}}},e)}function np(e){let t,n,a;return l.eventChannel((i=>(Promise.race([e.onClose().then((()=>"CLOSED")),new Promise((n=>{t=e.onEvent("PLUGIN_TRANSITION_OFFER_SUCCESS").subscribe((()=>{n("SUCCESS")}))})),new Promise((t=>{n=e.onEvent("PLUGIN_TRANSITION_OFFER_CLOSE").subscribe((()=>{t("UNSPECIFIED")}))})),new Promise((e=>{a=e}))]).then((e=>{"END"!==e&&(i(e),i(l.END))})),()=>{null==t||t.unsubscribe(),null==n||n.unsubscribe(),a("END")})))}function ap(e){return"object"==typeof e&&null!==e&&Object.entries(e).every((([e,t])=>"string"==typeof e&&"string"==typeof t))}function*ip(e,t,n,a,i){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Q,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":if((n||a)&&i){yield r.call(i);break}t({type:Q,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Q,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*op(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n,o=Y(n),s=J(n);yield r.put({type:Z,payload:{name:"SignalResponse",parentGuid:a.instanceGuid,responseActionPayload:{name:"Fulfillment"}}});const l=yield r.call(e.createChildPlugin.bind(e),i);if("object"==typeof l&&"onClose"in l&&"close"in l){const a=yield r.call(np,l);if("object"==typeof a&&"take"in a){const i=function(e,t,n,a){if(n.responseOption.rclid)return function*(){yield r.put({type:ee,payload:{name:"REALTIME_OFFER_FULFILLMENT_CONVERSION",body:{rclid:n.responseOption.rclid,accountID:n.accountID,referralCreativeID:n.referralCreativeID}}}),yield r.call(rp,e,t,a)}}(e,t,n,l);return void(yield r.call(ip,a,e.globalDispatch.bind(e),o,s,i))}}yield r.call(t,{level:j,code:"UNEXPECTED_NEXT_VALUE_IN_SAGA",message:'Received an unexpected input at a step in the saga "handleFullfillmentResponse" and could not continue.'})}else yield r.call(t,{level:j,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}function*rp(e,t,n){const a=function(e){return l.eventChannel((t=>{const n=e.onEvent({name:gr,source:"partner",callback:e=>{ap(e)&&t({eventName:gr,data:e})}},{name:br,source:"partner",callback:e=>{ap(e)&&t({eventName:br,data:e})}});return()=>{n()}}))}(e);try{for(;;){const i=yield r.take(a);switch(i.eventName){case gr:yield r.put({type:ee,payload:{name:gr,body:i.data}}),yield r.put({type:Fu,payload:{text:i.data}}),e.globalDispatch({type:Q,payload:{event:"Completed",completionReason:"Success"}}),n&&(yield r.call(n.close.bind(n)));break;case br:e.globalDispatch({type:Q,payload:{event:"Completed",completionReason:"Error"}}),n&&(yield r.call(n.close.bind(n)));break;default:t({level:j,code:"UNKNOWN_REALTIME_OFFER_FULFILLMENT_EVENT",message:`Unknown event: ${i.eventName}`})}}}catch(e){const n=e;t({level:R,code:"FAILED_TO_PROCESS_REALTIME_OFFER_FULFILLMENT_EVENT",message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&a.close()}}function*sp(e,t,n){const a=W(n.payload)||K(n.payload)||H(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":yield r.call(e.globalDispatch.bind(e),n),(Y(n.payload)||J(n.payload))&&(yield r.put({type:ee,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:a.accountID,referralCreativeID:a.referralCreativeID,referralOnly:J(n.payload)}}}),Y(n.payload)&&(yield r.call(rp,e,t)));break;case"CaptureOnly":yield r.call(e.globalDispatch.bind(e),n);break;case"Fulfillment":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),J(n.payload)&&(yield r.put({type:ee,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:n.payload.accountID,referralCreativeID:n.payload.referralCreativeID,referralOnly:!0}}})),yield*op(e,t,n.payload)}}function*lp(e,t){yield r.all([r.takeLatest(z,sp.bind(null,e,t)),r.takeEvery(re,Ku.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}Object.assign({},se);const cp=(new Cn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=tp({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=tp()){const a=l(),i=s.configureStore({reducer:ep,devTools:{name:"Standard Marketing"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(lp,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Gn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(ki,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Di,{settings:i,dispatch:d.dispatch,children:e.jsx(Xu,{})})})]})}))}}));var dp=Object.freeze({__proto__:null,moduleConnectorBuilder:cp});const up="CART/UPDATE",pp="CATALOG_ITEM/RESPONSE",fp="USER_CREATIVE_RESPONSE_HISTORY/ADD",yp=i.cond([[(e,t)=>0!==t,i.equals],[(e,t)=>!Number.isNaN(e)&&0===t,i.equals],[(e,t)=>Number.isNaN(e)&&0===t,i.F]]);function hp({isChecked:t,isDisabled:n,outerClassname:a,outerCheckedClassname:i,innerClassname:o,innerCheckedClassname:r}){return e.jsx("span",{style:{display:"flex"},children:e.jsx("span",{className:`${a} ${t?i:""}`,tabIndex:n?-1:1,style:{display:"flex",boxSizing:"border-box"},children:e.jsx("span",{className:`${o} ${t?r:""}`,style:{flex:1}})})})}const mp="catalogRadioGroup__label",vp=["Enter","Space"],gp={elements:{own:[],optionContainer:[],radioButtonInner:[{default:{border:{borderRadius:11},background:{backgroundColor:{light:"#FFF"}}}}],radioButtonInnerChecked:[{default:{background:{backgroundColor:{light:"#529ff4"}}}}],radioButtonOuter:[{default:{border:{borderRadius:16,borderColor:{light:"#999"},borderStyle:"solid",borderWidth:"1"},dimension:{width:{type:"fixed",value:16},height:{type:"fixed",value:16}},spacing:{padding:"4"}}}],radioButtonOuterChecked:[]}};function bp(e,t,n){return e.map(i.cond([[i.compose(i.equals("Required"),i.propOr("","type")),({value:e})=>Number.isNaN(n)&&t>0?e.message:""],[i.T,i.always("")]])).filter(i.isNotEmpty)}function Ip({schema:n,testId:i}){var o;const r=a.useDispatch(),s=Un(),l=null!==(o=a.useSelector((e=>{var t,n;return s.cartItemId in e.cart?null!==(n=null===(t=e.cart[s.cartItemId])||void 0===t?void 0:t.quantity)&&void 0!==n?n:0:void 0})))&&void 0!==o?o:NaN,c=t.useMemo((()=>bp(n.validations,n.options.length,l)),[n.validations,n.options.length,l]),d=Nn(),{tabIndex:u,styles:p,isDisabled:f}=m(d);t.useEffect((()=>{f||r(Ep(c))}),[]);const y=n.options.filter((({quantity:e})=>{var t,n;return e>=(null!==(t=s.minItemCount)&&void 0!==t?t:-1/0)&&e<=(null!==(n=s.maxItemCount)&&void 0!==n?n:1/0)}));function h(e){r({type:pp,payload:{catalogItem:s,quantity:e}});const t=bp(n.validations,n.options.length,e);r(Ep(t))}return y.length>0?e.jsx(Na,{styles:n.styles?M(gp,n.styles):gp,children:({classnames:n,mapperRef:a})=>e.jsx("div",{className:null==n?void 0:n.own,style:Object.assign({display:"flex",flexDirection:"column"},p),children:e.jsx(Xt,{value:a(mp),children:t.Children.toArray(y.map(((t,a)=>{var o;const r=yp(l,t.quantity),c=e=>i?`${i}-option${a}${e}`:void 0;return e.jsxs("label",{tabIndex:u,"aria-disabled":f,style:{display:"flex"},className:`${mp} ${null!==(o=null==n?void 0:n.optionContainer)&&void 0!==o?o:""}`,onKeyDown:e=>{r||!vp.includes(e.code)||f||h(t.quantity)},"data-e2e":"CatalogRadioGroup-Option","data-e2e-quantity":`${t.quantity}`,"data-testid":c("Label"),children:[e.jsx("input",{type:"radio",style:{display:"none"},tabIndex:-1,name:s.instanceGuid,value:t.quantity,checked:r,onChange:()=>h(t.quantity),"aria-disabled":f,disabled:f}),e.jsx(hp,{isChecked:r,isDisabled:f,innerClassname:null==n?void 0:n.radioButtonInner,innerCheckedClassname:null==n?void 0:n.radioButtonInnerChecked,outerClassname:null==n?void 0:n.radioButtonOuter,outerCheckedClassname:null==n?void 0:n.radioButtonOuterChecked}),e.jsx(Gi,{schema:t,testId:c("Content")})]})})))})})}):null}function Ep(e){return{type:ie,payload:{errors:e}}}function Sp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function xp(t){const n=a.useDispatch(),i=Ct(),o=Un(),r=Nn(),{tabIndex:s,styles:l,isDisabled:c}=m(r);return e.jsx(Na,{styles:t.schema.styles,children:({classnames:a})=>e.jsx("button",{type:"button",tabIndex:s,"aria-disabled":c,disabled:c,style:Object.assign({cursor:"pointer"},l),"data-testid":t.testId,"data-e2e":"CatalogItemResponse",onClick:e=>{e.preventDefault();n({type:pp,payload:{catalogItem:o,quantity:1}})},className:null==a?void 0:a.own,children:Sp(t.schema.children,i,t.testId)})})}const Cp={allowedTags:["em","strong","a","br","u","p","li","ul","ol","span"],allowedAttributes:{a:["href","target"],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],span:[]},allowedSchemes:["http","https"]},wp=new Map([["&","_;^;_"]]),Op=new RegExp(`<a *(?=${Cp.allowedAttributes.a.join("|")}|>)`,"g"),Tp=new RegExp(`<a *(?:(?:${Cp.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),Ap=new RegExp("(<br *?>)|(<br *?/>)","g"),jp=new RegExp(`<ul *(?=${Cp.allowedAttributes.ul.join("|")}|>)`,"g"),Rp=new RegExp(`<ol *(?=${Cp.allowedAttributes.ol.join("|")}|>)`,"g"),Np=new RegExp("<li *(?=>|\\s[^>]*>)","g"),Lp="<br/>";function Dp(n){const a=Zt(),i=Nn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Tp,((e,t)=>{const n=t.replaceAll("&",wp.get("&"));return e.replace(t,n)})).replaceAll(Ap,Lp)}(e);return t===u(t,Cp)}(e))throw new N("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(Na,{styles:n.schema.styles,children:({classnames:t})=>{const a=[(null==t?void 0:t.link)?`class="${null==t?void 0:t.link}"`:"",l?'tabindex="-1"':"",l?"style=\"pointer-events: 'none'; user-select: none;\"":"",l?'aria-disabled="true"':""].filter((e=>e.length>0)),i=((null==t?void 0:t.list)?`class="${t.list}"`:"")+' style="list-style-type: none; padding-inline-start: 0px; display: flex; flex-direction: column;"',c=((null==t?void 0:t.listItem)?`class="${t.listItem}"`:"")+' style="display: flex; align-items: flex-start; flex-shrink: 0; flex-grow: 1;"',d=`class="rokt-icon${(null==t?void 0:t.span)?" "+t.span:""}" style="display: inline-block; pointer-events: none; user-select: none;" aria-disabled="true"`,u=o.replace(Op,`<a ${a.join(" ")}`).replace(jp,`<ul ${i}`).replace(Rp,`<ol ${i}`).replace(Np,`<li ${c}><span ${d}>Check</span`);return p=o,new RegExp("</(p|ul|ol)>").test(p)?e.jsx("div",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:u}}):e.jsx("p",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:u}});var p}}):null}const _p={internally:"_top",externally:"_blank"};function kp(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:Pp(t,i,o)})}function Pp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function $p(t){var n,i;const o=_p[t.schema.open],r=Ct(),s=Un(),l=Nn(),c=a.useDispatch(),d=null!==(n=s.url)&&void 0!==n?n:"",{tabIndex:u,styles:p,isDisabled:f}=m(l);return Boolean(d)&&(null===(i=t.schema.children)||void 0===i?void 0:i.length)>0?e.jsx(Na,{styles:t.schema.styles,children:({classnames:n,mapperRef:a})=>{var i;return e.jsx("a",{href:d,onClick:()=>{var e;c({type:Z,payload:{name:"SignalResponse",parentGuid:null!==(e=s.instanceGuid)&&void 0!==e?e:"",responseActionPayload:{name:"Url",transformedTrafficURL:d}}})},"data-testid":t.testId,"data-e2e":"CatalogUrlLink",target:null!=o?o:"_blank",tabIndex:u,"aria-disabled":f,"aria-label":null!==(i=t.schema.a11yLabel)&&void 0!==i?i:void 0,style:Object.assign({cursor:"pointer",textDecoration:"none",display:"block"},p),className:null==n?void 0:n.own,children:(null==n?void 0:n.own)?kp(t.schema.children,null==n?void 0:n.own,a,r,t.testId):Pp(t.schema.children,r,t.testId)})}}):null}function Fp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Gp(t){const n=Ct(),a=Un(),i=Nn(),{tabIndex:o,styles:r,isDisabled:s}=m(i),l=No(a,1),c=bt();return e.jsx(Na,{styles:t.schema.styles,children:({classnames:i})=>e.jsx("button",{type:"button",tabIndex:o,"aria-disabled":s,disabled:s,style:Object.assign({cursor:"pointer"},r),"data-testid":t.testId,"data-e2e":"CatalogPartnerEventButton",onClick:()=>{s||(c({type:Z,payload:{name:"SignalCartItemQuantitySelected",parentGuid:a.instanceGuid,objectData:{quantity:1,preselected:!1}}}),c({type:ee,payload:{name:"V2_CART_ITEM_UPDATED",body:{oldCartItem:null,cartItem:l}}}))},className:null==i?void 0:i.own,children:Fp(t.schema.children,n,t.testId)})})}function Mp(e,t){const n=e.cart[t];return n||null}function Bp(e){var t,n;const a=null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[],i=function(e){return Object.values(e.cart).filter((e=>null!==e))}(e);return i.filter((e=>a.find((t=>t.catalogItemId===e.catalogItemId))))}function Up(e,t){var n,a,i,o;const r=null===(n=e.staticData)||void 0===n?void 0:n.offer;if(r){const n=function(e){return Bp(e).reduce(((e,t)=>e+t.quantity),0)}(e),s=Mp(e,t.cartItemId),l=(null!==(a=null==r?void 0:r.maxTotalItemsQtyInOffer)&&void 0!==a?a:1/0)-n,c=(null!==(i=t.maxItemCount)&&void 0!==i?i:1/0)-(null!==(o=null==s?void 0:s.quantity)&&void 0!==o?o:0);return Math.min(l,c)}return 0}const Vp={is:i.equals,"is-not":i.compose(i.not,i.equals),"is-below":i.lt,"is-above":i.gt};function zp({schema:n,testId:o}){const{children:r,predicates:s}=n,l=Zt()(n.cartItemId),c=a.useSelector((e=>{var t;return(null===(t=Mp(e,l))||void 0===t?void 0:t.quantity)||0}));return(()=>{const e=s.map((e=>(0,Vp[e.condition])(c,e.value)));return i.all(i.equals(!0),e)})()?e.jsx(xt,{children:e=>t.Children.toArray(r.map(((t,n)=>e(t,void 0,o?`${o}-child-${n}`:`when-catalog-quantity-child-${n}`))))}):null}function qp(e){var t,n;const a=null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[];return a.length>0?a:null}function Hp(e,t){var n,a;return null!==(a=null===(n=qp(e))||void 0===n?void 0:n.find((e=>e.catalogItemId===t)))&&void 0!==a?a:null}function Wp(e){var t;const n=null===(t=qp(e))||void 0===t?void 0:t.filter((e=>e.preSelectedQuantity&&e.preSelectedQuantity>0));return n&&n.length>0?n:null}function Kp(e){var t,n;return null!==(n=null===(t=Wp(e))||void 0===t?void 0:t.reduce(((e,t)=>{var n;return e+(null!==(n=t.preSelectedQuantity)&&void 0!==n?n:0)}),0))&&void 0!==n?n:0}const Yp=i.compose((e=>e.filter((e=>!i.isNil(e[1]))).map((([e,t])=>({cartItemId:t.cartItemId,quantity:t.quantity})))),i.toPairs,i.prop("cart"));function Jp(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:i(t,void 0,o)})}function Zp(e,t,n){return t(e,void 0,n)}function Qp(t){var n;const{schema:i,testId:o}=t,{a11yInputLabel:r,styles:s,showInputField:l,buttons:c,forcedUpsellText:d}=i,{increment:u,decrement:p,a11yIncrementLabel:f,a11yDecrementLabel:y}=c||{},h=a.useDispatch(),v=Un(),g=Ct(),b=Zt(),I=Nn(),{tabIndex:E,styles:S,isDisabled:x}=m(I),C=a.useSelector((e=>function(e,t){var n,a,i;const o=Hp(e,t);return Boolean(o&&(null!==(n=o.preSelectedQuantity)&&void 0!==n?n:0)>0&&o.preSelectedQuantity===(null!==(a=o.minItemCount)&&void 0!==a?a:0)&&o.preSelectedQuantity===(null!==(i=o.maxItemCount)&&void 0!==i?i:0))}(e,v.catalogItemId))),w=a.useSelector((e=>Mp(e,v.cartItemId))),O=a.useSelector((e=>Up(e,v))),T=(null==w?void 0:w.quantity)||0,A=m(x||T<=(null!==(n=v.minItemCount)&&void 0!==n?n:0)?"DISABLED":I),j=m(x||O<=0?"DISABLED":I),R=m(x||C?"DISABLED":I),N=e=>{var t;const n=e.target.value;if(0===n.length)L(null!==(t=v.minItemCount)&&void 0!==t?t:0);else{const e=Number(n);!Number.isNaN(e)&&e>=0&&L(e)}},L=e=>{x||h({type:pp,payload:{catalogItem:v,quantity:e}})};return e.jsx(Na,{styles:s,children:({classnames:t,mapperRef:n})=>e.jsx("div",{className:null==t?void 0:t.own,style:Object.assign({display:"flex",flexDirection:"row"},S),children:C&&d?e.jsx(Ba,{schema:d,isInline:!1,testId:o?`${o}-forced-upsell-text`:void 0}):e.jsxs(e.Fragment,{children:[p?e.jsx("button",{className:null==t?void 0:t.decrementButton,style:Object.assign(Object.assign({},A.styles),{cursor:A.isDisabled?"not-allowed":"pointer",pointerEvents:"auto"}),onClick:e=>{e.preventDefault(),L(T-1)},tabIndex:A.tabIndex,"aria-label":y||void 0,disabled:A.isDisabled,"data-testid":o?`${o}-decrement-button`:void 0,children:e.jsx(Jt,{value:b,children:(null==t?void 0:t.decrementButton)?Jp(p,t.decrementButton,n,g,o):Zp(p,g,o)})}):null,l?e.jsx("input",{type:"text",className:null==t?void 0:t.input,style:Object.assign(Object.assign({},R),{cursor:R.isDisabled?"not-allowed":"auto",caretColor:R.isDisabled?"transparent":"auto",pointerEvents:"auto",outline:"none"}),value:T,onChange:N,"aria-label":r||void 0,tabIndex:E,disabled:x,"data-testid":o?`${o}-input`:void 0}):e.jsx("p",{className:null==t?void 0:t.input,style:S,"data-testid":o?`${o}-quantity-text`:void 0,children:T}),u?e.jsx("button",{className:null==t?void 0:t.incrementButton,style:Object.assign(Object.assign({},j.styles),{cursor:j.isDisabled?"not-allowed":"pointer",pointerEvents:"auto"}),onClick:e=>{e.preventDefault(),L(T+1)},tabIndex:j.tabIndex,"aria-label":f||void 0,disabled:j.isDisabled,"data-testid":o?`${o}-increment-button`:void 0,children:e.jsx(Jt,{value:b,children:(null==t?void 0:t.incrementButton)?Jp(u,t.incrementButton,n,g,o):Zp(u,g,o)})}):null]})})})}const Xp={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(xp,{schema:t.node,testId:n})},EscapeHatch:function(t){if("EscapeHatch"===t.type&&t.node.data){const n=JSON.parse(t.node.data);switch(null==n?void 0:n.type){case"InsuranceRichText":return e.jsx(Dp,{schema:n.node});case"CatalogUrlLink":return e.jsx($p,{schema:n.node});case"CatalogPartnerEventButton":return e.jsx(Gp,{schema:n.node});case"WhenCatalogQuantity":return e.jsx(zp,{schema:n.node});default:return}}},CatalogRadioGroup:function(t){if("CatalogRadioGroup"===t.type)return e.jsx(Ip,{schema:t.node})},CatalogQuantityCounter:function(t){if("CatalogQuantityCounter"===t.type)return e.jsx(Qp,{schema:t.node})}};function ef(){const t=jn(),n=Ct();return e.jsx(wt,{value:n,overrides:Xp,children:e.jsx(xt,{children:e=>e(t)})})}function tf(e){return e.reduce(((e,t)=>(e[t.cartItemId]=function(e={}){return Object.assign({cartItemId:"cartItemId",catalogItemId:"catalogItemId",name:"Catalog Title",description:"This is a catalog item",unitPrice:10,totalPrice:10,quantity:1,currency:"USD",linkedProductId:void 0,quantityMustBeSynchronized:void 0,providerData:""},e)}({cartItemId:t.cartItemId,quantity:t.quantity}),e)),{})}const nf={cart:function(e=tf([]),t){if(t.type===up){const{catalogItem:n,quantity:a}=t.payload,i=n.cartItemId,o=No(n,a);return Object.assign(Object.assign({},e),{[i]:o})}return e},userCreativeResponseHistory:function(e=[],t){return t.type===fp?e.concat(t.payload.responseId):e},staticData:Mu,childLayouts:Gu};const af="INVALID_PARTNER_MESSAGE",of="MISCONFIGURED_CATALOG_ITEM",rf="FAILED_TO_PROCESS_PARTNER_UPDATE_CART_ITEM";function*sf(e){var t,n;const a=yield r.select(Wp),i=yield r.select(Kp),o=yield r.select((e=>{var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer.maxTotalItemsQtyInOffer}));if(pf(i)&&pf(o)&&i>o)yield r.call(e,{level:R,code:of,message:`Catalog items preselected quantities (${i}) exceeds the maximum allowed quantity (${o}) for this offer`});else if(a&&Array.isArray(a))for(const i of a){const a=null!==(t=i.preSelectedQuantity)&&void 0!==t?t:0,o=null!==(n=i.maxItemCount)&&void 0!==n?n:1/0;a>o?yield r.call(e,{level:R,code:of,message:`Preselected quantity (${a}) is greater than maxItemCount (${o}) for catalog item (${i.instanceGuid})`}):yield*uf(i,a,!0)}}function*lf(e,t,n){const{catalogItem:a,quantity:i}=n.payload;if(yield*uf(a,i,!1)){const n=yield r.select((e=>{var t,n,a;const i=null===(t=e.staticData)||void 0===t?void 0:t.offer.creative.responseOptionsMap.positive,o=e.userCreativeResponseHistory.at(-1),r=null===(n=e.staticData)||void 0===n?void 0:n.offer.creative.responseOptionsMap.negative;if(i&&o&&i.id===o&&"SignalGatedResponse"===(null==r?void 0:r.signalType))return function(e,t){var n;switch(e.action){case"Fulfillment":{const a=null==t?void 0:t.creative.fulfillment;return b(a)?{type:z,payload:{fulfillment:a,responseOption:e,accountID:null!==(n=null==t?void 0:t.accountId)&&void 0!==n?n:""}}:`Could not get fulfillment for response (instanceGuid: ${e.instanceGuid})`}case"Url":return(null==t?void 0:t.accountId)?{type:z,payload:Object.assign(Object.assign({},e),{accountID:t.accountId})}:`Could not get accountId for response (instanceGuid: ${e.instanceGuid})`;default:return{type:z,payload:e}}}(r,null===(a=e.staticData)||void 0===a?void 0:a.offer)}));null!=(o=n)&&"object"==typeof o&&"type"in o&&"payload"in o&&"object"==typeof o.payload?yield r.call(e.globalDispatch,n):function(e){return"string"==typeof e}(n)&&(yield r.call(t,{level:R,code:"INVALID_RESPONSE_OBJECT",message:n}))}var o}function*cf(e,t){const n=function(e,t){return l.eventChannel((n=>{const a=e.onEvent({name:yr.V2.PartnerMessage.UpdateCartItem,source:"partner",callback:e=>{!function(e){return null!==e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&!("unitPrice"in e)}(e)?t({level:R,code:af,message:`Invalid UpdateCartItemPartnerMessageBody: ${JSON.stringify(e)}`}):n(e)}});return()=>{a()}}))}(e,t);try{for(;;){const e=yield r.take(n);yield r.call(df,e,t)}}catch(e){const n=e;t({level:R,code:rf,message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&n.close()}}function*df(e,t){const{cartItemId:n,quantity:a}=e,i=yield r.select(Mp,n);if(ff(i)){const e=yield r.select(Hp,i.catalogItemId);null!==(o=e)&&"object"==typeof o&&"catalogItemId"in o&&"price"in o?yield*uf(e,a,!1):yield r.call(t,{level:R,code:rf,message:`Catalog item not found for cart item id (${n})`})}else yield r.call(t,{level:R,code:rf,message:`Cart item not found for cart item id (${n})`});var o}function*uf(e,t,n){var a;const i=yield r.select(Mp,e.cartItemId),o=yield r.select(Up,e),s=pf(o)?o:0,l=ff(i)?i.quantity:0;if(t!==l&&t>=(null!==(a=e.minItemCount)&&void 0!==a?a:0)&&t-l<=s){yield r.put({type:up,payload:{catalogItem:e,quantity:t}});const a=yield r.select(Mp,e.cartItemId),o=yield r.select(Yp);return yield r.put({type:oe,payload:{cart:o}}),yield r.put({type:Z,payload:{name:"SignalCartItemQuantitySelected",parentGuid:e.instanceGuid,objectData:{quantity:t,preselected:n}}}),yield r.put({type:ee,payload:{name:"V2_CART_ITEM_UPDATED",body:{oldCartItem:i,cartItem:a}}}),!0}return!1}function pf(e){return"number"==typeof e}function ff(e){return null!=e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&"unitPrice"in e}function*yf(e,t){var n;yield r.put({type:fp,payload:{responseId:(n=t.payload,q(n)?n.responseOption.id:n.id)}}),yield r.call(e.globalDispatch.bind(e),t)}function*hf(e,t){yield r.all([r.spawn(sf.bind(null,t)),r.spawn(cf.bind(null,e,t)),r.takeLatest(pp,lf.bind(null,e,t)),r.takeLatest(z,yf.bind(null,e)),r.takeEvery(re,Ku.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}function mf(e){return"object"==typeof e&&null!==e&&"cartItemId"in e&&"quantity"in e}Object.assign(Object.assign({},se),{CATALOG_ITEM_RESPONSE:pp});const vf=(new Cn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=function(e){return"object"==typeof e&&null!==e&&"cart"in e&&Array.isArray(e.cart)&&e.cart.every(mf)}(i.offerState)?i.offerState:{cart:[]},d=function(e={}){return Object.assign({cart:tf([]),userCreativeResponseHistory:[],staticData:null,childLayouts:{launched:{}}},e)}({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion},cart:tf(c.cart)}),u=function(e,t,n){const a=l(),i=s.configureStore({reducer:nf,devTools:{name:"Add To Cart"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(hf,e,t),i}(i.gateway,i.logger,d);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Gn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(ki,{}),e.jsx(a.Provider,{store:u,children:e.jsx(Di,{settings:i,dispatch:u.dispatch,children:e.jsx(ef,{})})})]})}))}}));var gf=Object.freeze({__proto__:null,moduleConnectorBuilder:vf});const bf="CATALOG/TRIGGER_SELECT_ITEM",If="CATALOG/SET_SELECTED_ITEM",Ef="CHECKOUT_LIFECYCLE",Sf="INSTANT_PURCHASE/INITIATE",xf="INSTANT_PURCHASE/PARTNER_RESPONSE",Cf="INSTANT_PURCHASE/WSDK_RESPONSE",wf=t.createContext(null);function Of(n){const[a,i]=t.useState({});return e.jsx(wf.Provider,{value:{registerValidators:function(e,t){i((n=>Object.assign(Object.assign({},n),{[e]:{validators:t,isValid:!0}})))},validateFieldKeys:function(e){const t={};let n=!0;for(const i of e){const e=a[i];if(e){const a=Object.assign({},e),o=e.validators.every((e=>e()));o!==a.isValid&&(t[i]=Object.assign(Object.assign({},a),{isValid:o})),n&&(n=o)}else n=!1}return Object.values(t).length>0&&i((e=>Object.assign(Object.assign({},e),t))),n},getFieldKeyValidity:function(e){var t;return(null===(t=a[e])||void 0===t?void 0:t.isValid)||!1}},children:n.children})}function Tf(){const e=t.useContext(wf);if(!e)throw new Error("useValidator must be used within a ValidatorProvider");return e}function Af(e,n){const a=Tf();t.useEffect((()=>{e&&a.registerValidators(e,n)}),[])}function jf(e,t){return t?t.validators.map((t=>e[t])).filter((e=>void 0!==e)):[]}function Rf(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:Nf(t,i,o)})}function Nf(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Lf(t){const n=t.schema.validatorTriggerConfig,i=a.useDispatch(),o=Ct(),r=Nn(),{tabIndex:s,styles:l,isDisabled:c}=m(r),d=Un(),u=Ht(d,"catalogItem"),p=Tf();return e.jsx(Na,{styles:t.schema.styles,children:({classnames:a,mapperRef:r})=>e.jsx("button",{type:"button",tabIndex:s,"aria-disabled":c,disabled:c,style:Object.assign({cursor:"pointer"},l),"data-testid":t.testId,"data-e2e":"CatalogItemResponse",onClick:e=>{e.preventDefault(),function(){let e=!0;n&&(e=p.validateFieldKeys(n.validatorFieldKeys)),e&&i({type:Sf,payload:{catalogItem:d,quantity:1,useInstantPurchaseExtension:!0}})}()},className:null==a?void 0:a.own,children:e.jsx(Jt,{value:u,children:(null==a?void 0:a.own)?Rf(t.schema.children,a.own,r,o,t.testId):Nf(t.schema.children,o,t.testId)})})})}const Df=["ArrowDown","ArrowUp","Enter","Escape","Tab"];function _f(n){const i=n.schema.validatorFieldConfig,o=n.schema.disableProgrammaticFocus||!1,r=Rt(),s=Ct(),l=Zt(),c=e=>l({data:e},"catalogItem"),d=t.useMemo((()=>r.catalogItems||[]),[r]),u=Nn(),{styles:p,isDisabled:f}=m(u),y=t.useRef(null),h=t.useRef([]),[v,g]=t.useState(!1),[b,I]=t.useState(-1),E=a.useDispatch(),S=Tf(),x=a.useSelector((e=>e.selectedItem)),C=t.useRef(x);function w(){return!!C.current}const O=t.useMemo((()=>jf({required:w},i)),[i]);function T(t,a,i,o){return t?function(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:i(t,void 0,o)})}(a,t,i,s,o||n.testId):function(e,t,n){return t(e,void 0,n)}(a,s,o||n.testId)}function A(){return!i||S.getFieldKeyValidity(i.validationFieldKey)}function j(){f||(v?N():R())}function R(){f||g(!0)}function N(){f||g(!1)}function L(e){var t;I(d.indexOf(e)),N(),E({type:bf,payload:{catalogItem:e}}),C.current=e,i&&i.validateOnChange&&S.validateFieldKeys([i.validationFieldKey]),null===(t=y.current)||void 0===t||t.focus()}function D(e){const t=[null==e?void 0:e.dropDownSelectedElement];return A()||t.push((null==e?void 0:e.dropDownContainerErrorStyles)||""),t.join(" ")}Af(null==i?void 0:i.validationFieldKey,O),t.useEffect((()=>{var e;if(!o)if(v)if(-1===b)null===(e=y.current)||void 0===e||e.focus();else{const e=h.current[b];e&&e.focus()}else x||I(-1)}),[v,b,x,o]);const _={elements:{own:[{default:{background:{backgroundColor:{light:"#ffffff"}},dimension:{width:{type:"percentage",value:100}}}}]}};function k(e){var t;if(!f&&Df.includes(e.key))switch(e.key){case"ArrowDown":{e.preventDefault();const t=b+1;t<d.length&&I(t);break}case"ArrowUp":{e.preventDefault();const t=b-1;t>=0&&I(t);break}case"Enter":if(e.preventDefault(),v){const e=d[b];e&&L(e)}else R();break;case"Tab":if(v&&x){N();const e=d.indexOf(x);-1!==e&&I(e)}break;case"Escape":e.preventDefault(),v&&(N(),null===(t=y.current)||void 0===t||t.focus())}}return d.length>1?e.jsx(Na,{styles:n.schema.styles?M(_,n.schema.styles):_,children:({classnames:t,mapperRef:a})=>e.jsxs("div",{className:null==t?void 0:t.dropDownContainer,children:[e.jsxs("div",{ref:y,className:null==t?void 0:t.own,onKeyDown:k,onClick:j,onBlur:e=>{var t;(null===(t=y.current)||void 0===t?void 0:t.contains(e.relatedTarget))||v&&N()},"data-e2e":"DropDown","data-testid":n.testId?`${n.testId}-drop-down-container`:void 0,"aria-disabled":f,style:Object.assign({position:"relative"},p),tabIndex:0,children:[e.jsx("div",{className:D(t),"aria-disabled":f,"data-testid":n.testId?`${n.testId}-drop-down-selected-element`:void 0,style:Object.assign({cursor:"pointer"},p),children:x?e.jsx(Jt,{value:c(x),children:T(null==t?void 0:t.dropDownSelectedElement,n.schema.closedTemplate,a)}):T(null==t?void 0:t.dropDownSelectedElement,n.schema.closedDefaultTemplate,a)}),v&&e.jsx("ul",{className:null==t?void 0:t.dropDownListContainer,onClick:e=>e.stopPropagation(),"data-testid":n.testId?`${n.testId}-drop-down-list-container`:void 0,tabIndex:-1,style:Object.assign({listStyle:"none",padding:0,zIndex:9999,position:"absolute",top:"100%",left:0,right:0,backgroundColor:"#FFF",overflow:"hidden"},p),children:d.map(((i,o)=>e.jsx("li",{ref:e=>function(e,t){h.current[t]=e}(e,o),className:null==t?void 0:t.dropDownListElement,onClick:e=>{e.stopPropagation(),f||L(i)},tabIndex:-1,"data-e2e":"DropDownItem","data-testid":n.testId?`${n.testId}-drop-down-item-${o}`:void 0,style:Object.assign({cursor:"pointer",display:"flex"},p),children:e.jsx(Jt,{value:c(i),children:T(null==t?void 0:t.dropDownSelectedElement,n.schema.openTemplate,a)})},i.catalogItemId)))})]}),!A()&&n.schema.requiredSelectionErrorTemplate?T(null==t?void 0:t.errorContentContainerStyles,n.schema.requiredSelectionErrorTemplate,a,"dropdown-required-selection-error"):e.jsx("p",{className:(null==t?void 0:t.errorContentContainerStyles)||"",children:" "})]})}):null}function kf(n){const i=n.schema.styles,o=a.useDispatch(),r=a.useSelector((e=>e.staticData)),s=Nn(),{tabIndex:l,styles:c,isDisabled:d}=m(s),u=()=>{var e;o({type:Ef,payload:{event:"Checkout",targetStep:n.schema.targetStep,offerPositionIndex:null!==(e=null==r?void 0:r.position)&&void 0!==e?e:0,data:n.schema.data}})};return e.jsx(Na,{styles:i,children:({classnames:a})=>{var i;return e.jsx("button",{title:n.schema.targetStep,className:null==a?void 0:a.own,onClick:u,"data-testid":n.testId,"data-e2e":"CheckoutStateButtonTrigger",disabled:d,"aria-disabled":d,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:n.schema.targetStep,tabIndex:l,style:Object.assign({cursor:"pointer"},c),children:e.jsx(xt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,U(a,n.testId)))))})})}})}const Pf=/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/;function $f(t){const n=Zt(),a=Nn(),{schema:i,testId:o}=t,r=n(i.value),{tabIndex:s,styles:l,isDisabled:c}=m(a);return"string"==typeof(d=r)&&Pf.test(d)?e.jsx(Na,{styles:i.styles,children:({classnames:t})=>e.jsx("div",{"aria-hidden":c,className:null==t?void 0:t.own,"data-e2e":"ColorSwatch","data-testid":o,style:Object.assign({backgroundColor:r},l),tabIndex:s})}):null;var d}function Ff(e){return{name:e,styles:{elements:{own:[{default:{text:{fontSize:28},border:{borderColor:{light:"#131317"},borderRadius:50,borderStyle:"solid",borderWidth:"2"},spacing:{padding:"4"}}}]}}}}const Gf=Ff("ChevronLeft"),Mf=Ff("ChevronRight");function Bf(n){const{schema:a,testId:i}=n,o=a.scrollGradientLength||36,r=Un(),s=Object.values(r.images||{}),l=s.length>1?1:0,c=t.useMemo((()=>l?[s.at(-1),...s,s.at(0)].filter((e=>void 0!==e)):s),[s,l]),[d,u]=t.useState({left:o,right:o}),[p,f]=t.useState(l),[y,h]=t.useState(0),[v,g]=t.useState(!1),[b,I]=t.useState(0),[E,S]=t.useState(!1),[x,C]=t.useState(!1),w=Nn(),{styles:O,isDisabled:T,tabIndex:A}=m(w),j=t.useRef(null),R=t.useRef(null),N=t.useRef([]),L=t.useRef([]),D=t.useRef(null);function _(){const e=j.current;e&&g(e.scrollWidth>e.clientWidth)}function k(e){const{scrollLeft:t,scrollWidth:n,clientWidth:a}=e,i=n-a-t;u({left:t<o?t:o,right:i<o?i:o})}!function(){const e=t.useRef(null);t.useEffect((()=>{const t=R.current;if(!t)return;let n=0,a=t.scrollLeft;const i=()=>{const o=t.scrollLeft;o===a?n++:(n=0,a=o),n>=5?(null!==e.current&&(cancelAnimationFrame(e.current),e.current=null),D.current&&D.current()):e.current=requestAnimationFrame(i)};return i(),()=>{null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)}}),[D.current])}(),t.useEffect((()=>{var e,t;f(l),h(0),null===(e=L.current[0])||void 0===e||e.scrollIntoView({behavior:"instant"}),null===(t=N.current[l])||void 0===t||t.scrollIntoView({behavior:"instant"}),_()}),[r.catalogItemId,l]),t.useEffect((()=>{const e=j.current;if(!e)return;function t(e){const t=j.current;t&&0!==e.deltaY&&(e.preventDefault(),t.scrollLeft+=e.deltaY)}const n=new ResizeObserver((()=>{var t,n;_(),k(e),e.clientWidth!==b&&(null===(t=N.current[p])||void 0===t||t.scrollIntoView({behavior:"instant"}),null===(n=L.current[y])||void 0===n||n.scrollIntoView({behavior:"instant"}),I(e.clientWidth))}));return n.observe(e),e.addEventListener("wheel",t,{passive:!1}),()=>{n.disconnect(),e&&e.removeEventListener("wheel",t)}}),[]);const P={display:"flex",position:"absolute",top:"50%",transform:"translateY(-50%)",backgroundColor:"transparent",cursor:T?"not-allowed":"pointer"};function $(e){var t,n;if(E)return;const a=p+e;let i=a,o=y+e;0===a?(i=c.length-2,o=s.length-1):o===s.length&&(i=1,o=0),S(!0),null===(t=N.current[a])||void 0===t||t.scrollIntoView({}),null===(n=L.current[o])||void 0===n||n.scrollIntoView({}),h(o),f(i),D.current=a===i?()=>{S(!1)}:()=>{var e;null===(e=N.current[i])||void 0===e||e.scrollIntoView({behavior:"instant"}),S(!1)}}return s.length>0?e.jsx(Na,{styles:a.styles,children:({classnames:n})=>e.jsxs("div",{className:null==n?void 0:n.own,children:[e.jsxs("div",{onMouseOver:()=>C(!0),onMouseOut:()=>C(!1),style:{position:"relative"},"data-testid":`${i}-main-image-container`,children:[x&&1===l&&e.jsxs(e.Fragment,{children:[e.jsx("button",{style:Object.assign(Object.assign({},P),{left:"5%"}),className:null==n?void 0:n.scrollIconButton,onClick:()=>$(-1),"data-testid":"main-image-scroll-left-button",children:e.jsx(Ka,{schema:a.leftScrollIconTemplate||Gf})}),e.jsx("button",{style:Object.assign(Object.assign({},P),{right:"5%"}),className:null==n?void 0:n.scrollIconButton,onClick:()=>$(1),"data-testid":"main-image-scroll-right-button",children:e.jsx(Ka,{schema:a.rightScrollIconTemplate||Mf})})]}),e.jsx("div",{ref:R,style:{display:"flex",aspectRatio:"1 / 1",overflow:"hidden",scrollBehavior:"smooth"},children:t.Children.toArray(c.map(((t,a)=>e.jsx("div",{ref:e=>function(e,t){N.current[t]=e}(e,a),style:{aspectRatio:"1 / 1"},children:e.jsx("img",{src:t.light,alt:t.alt,title:t.title,className:null==n?void 0:n.mainImage,loading:"lazy",style:Object.assign(Object.assign({},O),{height:"100%"}),"data-testid":`${i}-main-image-${a}`,"data-e2e":"CatalogImageGallery-mainImage"})},`${t.light}-${a}`))))})]}),e.jsx("div",{ref:j,onScroll:e=>k(e.currentTarget),className:null==n?void 0:n.thumbnailList,style:Object.assign(Object.assign({},O),{display:"flex",overflow:"auto",justifyContent:v?"flex-start":"center",scrollbarWidth:"none",scrollBehavior:"smooth",maskImage:`linear-gradient(to right, transparent 0, black ${d.left}px, black calc(100% - ${d.right}px), transparent 100%)`}),children:t.Children.toArray(s.map(((t,a)=>e.jsx("div",{style:{flexShrink:0,aspectRatio:"1 / 1",overflow:"hidden"},children:e.jsx("img",{ref:e=>function(e,t){L.current[t]=e}(e,a),src:t.light,alt:t.alt,title:t.title,className:a===y?null==n?void 0:n.selectedThumbnailImage:null==n?void 0:n.thumbnailImage,loading:"lazy",style:Object.assign(Object.assign({},O),{cursor:T?"not-allowed":"pointer",pointerEvents:"auto",aspectRatio:"1 / 1"}),"data-testid":`${i}-thumbnail-${a}`,"data-e2e":"CatalogImageGallery-thumbnail",tabIndex:A,onClick:()=>function(e){var t,n;if(E)return;S(!0);const a=l?e+1:e;f(a),h(e),null===(t=N.current[a])||void 0===t||t.scrollIntoView({}),null===(n=L.current[e])||void 0===n||n.scrollIntoView({}),D.current=()=>{S(!1)}}(a)})}))))})]})}):null}const Uf={size:80,radius:30,stroke:7,duration:2,primaryColor:"#222",secondaryColor:"#d6d6d6",primaryRotation:-50,secondaryRotation:45,arcFraction:1/3.5},Vf={elements:{own:[{default:{container:{justifyContent:"center",alignItems:"center"},dimension:{width:{type:"percentage",value:100}}}}],spinner:[{default:{container:{justifyContent:"center",alignItems:"center"}}}]}};function zf(t){var n;const{config:a}=t.schema,i=Object.assign(Object.assign({},Uf),a),o=i.radius,r=2*Math.PI*o,s=r*(null!==(n=i.arcFraction)&&void 0!==n?n:1/3.5),l=r-s,c=i.size/2,d={container:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%"},spinner:{display:"block",animation:`spin ${i.duration}s ease-in-out infinite`,transformOrigin:"center center"}};return e.jsx(Na,{styles:t.schema.styles?M(Vf,t.schema.styles):Vf,children:({classnames:n})=>e.jsxs("div",{className:null==n?void 0:n.own,"data-testid":t.testId,"data-e2e":"LoadingSpinner",style:d.container,children:[e.jsxs("svg",{width:i.size,height:i.size,viewBox:`0 0 ${i.size} ${i.size}`,className:null==n?void 0:n.spinner,style:d.spinner,children:[e.jsx("circle",{cx:c,cy:c,r:o,fill:"none",stroke:i.primaryColor,strokeWidth:i.stroke,strokeDasharray:`${s} ${l}`,strokeDashoffset:"0",strokeLinecap:"butt",transform:`rotate(${i.primaryRotation} ${c} ${c})`}),i.secondaryColor&&e.jsx("circle",{cx:c,cy:c,r:o,fill:"none",stroke:i.secondaryColor,strokeWidth:i.stroke,strokeDasharray:`${s} ${l}`,strokeDashoffset:"0",strokeLinecap:"butt",transform:`rotate(${i.secondaryRotation} ${c} ${c})`})]}),e.jsx("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]})})}function qf(n){const i=1e3*n.schema.durationInSeconds,o=n.schema.format||"M:SS",r=n.testId,s=a.useDispatch(),[l,c]=t.useState(i),d=t.useRef(null),u=t.useRef(null);function p(){const e=Math.ceil(l/1e3);if("S"===o)return e;{const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,"0")}`}}return t.useEffect((()=>(u.current=requestAnimationFrame((function e(t){d.current||(d.current=t);const n=t-d.current,a=Math.max(i-n,0);c(a),a>0?u.current=requestAnimationFrame(e):s({type:Q,payload:{event:"Dismissed",dismissalReason:"Implicit"}})})),()=>{u.current&&cancelAnimationFrame(u.current)})),[i,s]),e.jsx(Na,{styles:n.schema.styles,children:({classnames:t})=>e.jsx("span",{className:null==t?void 0:t.own,"data-testid":r||"","data-e2e":"OfferLifecycleTimer",children:p()})})}function Hf(n){const i=a.useDispatch(),o=n.schema,r=o.validatorTriggerConfig,s=n.schema.styles,l=Nn(),{styles:c,isDisabled:d}=m(l),u=Tf();function p(){let e=!0;r&&(e=u.validateFieldKeys(r.validatorFieldKeys)),e&&i({type:X,payload:{key:o.customStateKey,value:o.customStateValue}})}return e.jsx(Na,{styles:s,children:({classnames:a})=>{var i;return e.jsx("button",{className:null==a?void 0:a.own,onClick:p,"data-testid":n.testId,"data-e2e":"CatalogVariationSelectionButton",disabled:d,"aria-disabled":d,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:"",style:Object.assign({cursor:"pointer"},c),children:e.jsx(xt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,U(a,n.testId)))))})})}})}function Wf(n){var a;const{schema:i}=n,[o,r]=t.useState(!1),[s,l]=t.useState(!1),[c,d]=t.useState(!1),[u,p]=t.useState(!1),[f,y]=t.useState(0),h=Nn(),{tabIndex:v,isDisabled:g}=m(h),b=Zt(),I=t.useRef(null),E=t.useRef(null),S=i.lineHeight*i.lineLimit,x=S-i.lineHeight;function C(){const e=i.linearGradientConfig;return e?{background:`linear-gradient(to bottom, ${e.linearColorStart} ${x}px, ${e.linearColorStop||"transparent"})`,backgroundClip:"text",color:"transparent"}:{}}function w(){const e={overflow:"hidden",textOverflow:"clip"};return u?Object.assign(Object.assign(Object.assign({},e),o?{}:C()),{transition:"height 0.3s ease",height:o?`${f}px`:`${S}px`}):!o&&c?Object.assign(Object.assign(Object.assign(Object.assign({},e),i.linearGradientConfig?{}:{display:"-webkit-box",WebkitLineClamp:i.lineLimit,lineClamp:i.lineLimit,WebkitBoxOrient:"vertical"}),C()),i.linearGradientConfig?{height:`${S}px`}:{}):e}return t.useEffect((()=>{const e=I.current;if(!e)return;const t=()=>{d(e.scrollHeight>S),y(e.scrollHeight)};r(!1),l(!1),p(!1),d(!1),t();const n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect(),E.current&&cancelAnimationFrame(E.current)}}),[null===(a=I.current)||void 0===a?void 0:a.innerText,S]),e.jsx(Na,{styles:n.schema.styles,children:({classnames:t})=>e.jsxs("div",{"aria-hidden":g,"data-testid":n.testId,"data-e2e":"ReadMoreTextContainer",className:null==t?void 0:t.own,children:[e.jsx("div",{ref:I,"data-testid":`${n.testId}-content-container`,className:null==t?void 0:t.contentContainer,style:w(),onTransitionEnd:()=>{E.current=requestAnimationFrame((()=>{p(!1),E.current=null})),l((e=>!e))},children:e.jsx(Ma,{schema:{value:i.value}})}),c&&e.jsx("button",{onClick:()=>{p(!0),E.current=requestAnimationFrame((()=>{r((e=>!e)),E.current=null}))},tabIndex:v,className:null==t?void 0:t.expansionButton,style:{background:"none",cursor:"pointer"},children:b(s?i.collapseLabel:i.expandLabel)})]})})}function Kf(n){const i=a.useDispatch(),o=a.useSelector((e=>e.staticData)),r=Nn(),{tabIndex:s,styles:l,isDisabled:c}=m(r);function d(){i({type:Z,payload:{name:"SignalInstantPurchaseDismissal",parentGuid:(null==o?void 0:o.offer.creative.instanceGuid)||""}}),i({type:Q,payload:{event:"Dismissed",dismissalReason:"Explicit"}})}return e.jsx(Na,{styles:n.schema.styles,children:({classnames:a})=>e.jsx("button",{className:null==a?void 0:a.own,onClick:d,"data-testid":n.testId,"data-e2e":"DismissInstantPurchaseButton",disabled:c,"aria-disabled":c,"aria-label":n.schema.a11yLabel||"",tabIndex:s,style:Object.assign({cursor:"pointer"},l),children:e.jsx(xt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,U(a,n.testId)))))})})})}function Yf(n){var a;const{validatorFieldConfig:i,checkboxColor:o}=n.schema,[r,s]=t.useState(null!==(a=n.schema.value)&&void 0!==a&&a),l=t.useRef(r),c=Tf();function d(){return l.current}const u=t.useMemo((()=>jf({required:d},i)),[i]);function p(){return!i||c.getFieldKeyValidity(i.validationFieldKey)}function f(e,t){const n=[e];return p()||n.push(t),n.join(" ")}function y(e){return f(null==e?void 0:e.checkbox,null==e?void 0:e.checkboxError)}function h(e){return f(null==e?void 0:e.label,null==e?void 0:e.labelError)}function m(a,i){return e.jsx(xt,{children:e=>t.Children.toArray(a.map(((t,a)=>e(t,void 0,U(a,`${n.testId}-${i}`)))))})}return Af(null==i?void 0:i.validationFieldKey,u),e.jsx(Na,{styles:n.schema.styles,children:({classnames:t})=>{return e.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.jsxs("div",{className:(a=t,f(null==a?void 0:a.own,null==a?void 0:a.checkboxContainerError)),style:{display:"flex",gap:"8px",flexDirection:"row"},children:[e.jsx("input",{"data-testid":n.testId,className:y(t),type:"checkbox",checked:r,onChange:e=>{return t=e.target.checked,l.current=t,i&&i.validateOnChange&&c.validateFieldKeys([i.validationFieldKey]),void s(t);var t},style:Object.assign({},o?{accentColor:o}:{})}),n.schema.labelTemplate&&e.jsx("div",{className:h(t),children:m(n.schema.labelTemplate,"label")})]}),!p()&&n.schema.errorContentTemplate&&e.jsx("div",{className:null==t?void 0:t.errorContent,children:m(n.schema.errorContentTemplate,"error-content")})]});var a}})}function Jf(n){const i=Ct(),o=$n(),r=Zt(),s=bt(),l=Rt().catalogItems||[],c=a.useSelector((e=>e.selectedItem))||l[0];return t.useEffect((()=>{c&&s({type:Z,payload:{name:"SignalImpression",parentGuid:null==c?void 0:c.instanceGuid}})}),[c,s]),c?e.jsx(Na,{styles:n.schema.styles,children:({classnames:a})=>{return e.jsx("div",{"data-testid":n.testId,"data-e2e":"CatalogCombinedCollection",className:null==a?void 0:a.own,style:{display:"flex",flexDirection:"column"},children:t.Children.toArray(e.jsx(Of,{children:e.jsx(Bn,{context:c,children:e.jsx(Pn,{value:o(c),children:e.jsx(Jt,{value:(s=c,r({data:s},"catalogItem")),children:i(n.schema.template,void 0,n.testId?`${n.testId}-child`:"")})})})}))});var s}}):null}const Zf={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(Lf,{schema:t.node,testId:n})},CatalogCombinedCollection:function(t,n){if("CatalogCombinedCollection"===t.type)return e.jsx(Jf,{schema:t.node,testId:n})},EscapeHatch:function(t){if("EscapeHatch"===t.type&&t.node.data){const n=JSON.parse(t.node.data);switch(null==n?void 0:n.type){case"CatalogDropDown":return e.jsx(_f,{schema:n.node});case"CatalogVariationSelectionButton":return e.jsx(Hf,{schema:n.node});case"Checkbox":return e.jsx(Yf,{schema:n.node});case"CheckoutStateButtonTrigger":return e.jsx(kf,{schema:n.node});case"ColorSwatch":return e.jsx($f,{schema:n.node});case"CatalogImageGallery":return e.jsx(Bf,{schema:n.node});case"DismissInstantPurchaseButton":return e.jsx(Kf,{schema:n.node});case"LoadingSpinner":return e.jsx(zf,{schema:n.node});case"OfferLifecycleTimer":return e.jsx(qf,{schema:n.node});case"ReadMoreTextContainer":return e.jsx(Wf,{schema:n.node});default:return}}}};function Qf(){const t=jn(),n=Ct(),i=a.useSelector(Hu),o=Zt()({state:i},"textContent");return e.jsx(wt,{value:n,overrides:Zf,children:e.jsx(Jt,{value:o,children:e.jsx(xt,{children:e=>e(t)})})})}function Xf(e){if(!e.copy)return null;const t=t=>e.copy[`ppu.${t}`]||"";return{shippingAttributes:{address1:t("shippingAddress1"),address2:t("shippingAddress2"),city:t("shippingCity"),state:t("shippingState"),country:t("shippingCountry"),postalCode:t("shippingZipcode")}}}const ey={staticData:Mu,selectedItem:(e=null,t)=>t.type===If?t.payload:e,dynamicData:Bu,childLayouts:Gu,fulfillmentDetails:(e=null,t)=>"INSTANT_PURCHASE/SET_FULFILLMENT_DETAILS"===t.type?t.payload:e};function ty(e={}){return Object.assign({staticData:null,selectedItem:null,dynamicData:null,childLayouts:{launched:{}},fulfillmentDetails:null},e)}const ny="INVALID_RESPONSE_OBJECT",ay="MISSING_APP_STATE_IN_INSTANT_PURCHASE_MODULE",iy="MISSING_PAYMENT_REF_IN_INSTANT_PURCHASE_MODULE",oy="MISSING_STATIC_DATA_IN_INSTANT_PURCHASE_MODULE";function ry(e,t){return l.eventChannel((n=>e.onEvent({name:hr.PartnerMessage.CartItemInstantPurchaseResponse,source:"partner",callback:e=>{var a;"object"==typeof(a=e)&&null!==a&&"upsellItems"in a&&Array.isArray(a.upsellItems)&&a.upsellItems.every((e=>"object"==typeof e))&&"totalUpsellPrice"in a&&"number"==typeof a.totalUpsellPrice&&"currency"in a&&"string"==typeof a.currency&&"paid"in a&&"boolean"==typeof a.paid&&"success"in a&&"boolean"==typeof a.success?n(e):t({level:R,code:"MALFORMED_INSTANT_PURCHASE_PARTNER_DATA",message:`Malformed data received from partner\n ${e}`})}})))}function*sy(e,t){var n;try{for(;;){const t=yield r.take(e);t&&(yield r.put({type:xf,payload:t}))}}catch(e){yield r.call(t,{level:R,code:"INSTANT_PURCHASE_PARTNER_CHANNEL_ERROR",message:null!==(n=e.message)&&void 0!==n?n:"Unknown error in instant-purchase partner channel"})}finally{e.close()}}function*ly(e,t){var n;try{for(;;){const t=yield r.take(e);if(t){yield r.put({type:Cf,payload:t});break}}}catch(e){yield r.call(t,{level:R,code:"INSTANT_PURCHASE_WSDK_CHANNEL_ERROR",message:null!==(n=e.message)&&void 0!==n?n:"Unknown error in instant-purchase WSDK channel"})}finally{e.close()}}const cy="Unknown failure reason",dy=6e4;function*uy(){var e,t;const n=yield r.select((e=>e)),a=null!==(t=null===(e=null==n?void 0:n.staticData)||void 0===e?void 0:e.offer.catalogItems)&&void 0!==t?t:[];1===a.length&&a[0]&&(yield*gy(a[0]))}function*py(e){const{catalogItem:t}=e.payload;yield*gy(t)}function*fy(e,t,n){const{catalogItem:a,quantity:i}=n.payload,o=No(a,i);o?(yield r.put({type:Z,payload:{name:"SignalCartItemInstantPurchaseInitiated",parentGuid:a.instanceGuid,objectData:{catalogItemId:a.catalogItemId,quantity:i}}}),yield*Sy("ProcessingState",1),n.payload.useInstantPurchaseExtension?yield*function*(e,t,n){const a=yield r.select((e=>e));if(!a)return yield r.call(n,{level:R,code:ay,message:"App state is not set within Redux store."}),void(yield*xy("offerComplete",2));if(!a.staticData)return yield r.call(n,{level:R,code:oy,message:"App state is not configured with static data."}),void(yield*xy("offerComplete",2));const i=a.staticData.offer.creative.copy["ppu.partnerPaymentReference"];if(!i)return yield r.call(n,{level:R,code:iy,message:"Partner payment reference is not set within creative copy."}),void(yield*xy("offerComplete",2));const o={upsellItems:[{cartItemId:e.cartItemId,catalogItemId:e.catalogItemId,quantity:e.quantity,unitPrice:e.unitPrice,totalPrice:e.totalPrice,currency:e.currency}],totalUpsellPrice:e.totalPrice,currency:e.currency,paymentDetails:{partnerPaymentReference:i}};a.fulfillmentDetails&&(o.fulfillmentDetails=a.fulfillmentDetails);yield r.fork(vy,t,n),yield r.put({type:ee,payload:{name:"INITIATE_INSTANT_PURCHASE_EVENT",body:o}})}(o,e,t):yield*function*(e,t,n){yield r.fork(my,t,n),yield r.put({type:ee,payload:{name:"CART_ITEM_INSTANT_PURCHASE",body:{upsellItems:[e],totalUpsellPrice:e.totalPrice||0,currency:e.currency}}})}(o,e,t)):(yield r.call(t,{level:R,code:ny,message:`Unable to translate catalog item with ID ${a.catalogItemId} to cart item for instant purchase transaction.`}),yield*xy("offerComplete",2))}function*yy(e,t){const n=yield r.select((e=>e.staticData));if(!n)return yield r.call(e,{level:R,code:oy,message:"App state is not configured with static data."}),void(yield*Ey("Error"));if(!n.offer.catalogItems)return yield r.call(e,{level:R,code:"MISSING_CATALOG_ITEMS",message:"No catalog items found within offer data."}),void(yield*Ey("Error"));const a={accountId:n.offer.accountId,catalogItems:n.offer.catalogItems};let i,o;t.payload.success?(i=by,o="Success"):(i=(e,n)=>function(e,t,n,a){return{name:"SignalCartItemInstantPurchaseFailure",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,failureReason:a.reason||cy,providerId:n.accountId.toString()}}}(e,n,a,t.payload),o="Unspecified"),yield*function*(e,t,n,a){const i=[];for(const a of e.upsellItems){const e=Iy(a,t.catalogItems);void 0===e?i.push(a):yield r.put({type:Z,payload:n(e,a.quantity)})}i.length>0&&(yield*function*(e,t){const n=JSON.stringify(e,null,"\t").replaceAll('"',"");yield r.call(t,{level:R,code:ny,message:`Unable to map cart items to catalog items in the instant purchase partner response: ${n}.`})}(i,a))}(t.payload,a,i,e),yield*Ey(o)}function*hy(e){e.payload.response&&e.payload.response.success?yield*xy("offerComplete",1):yield*xy("offerComplete",2)}function*my(e,t){const n=ry(e,t),{timeout:a}=yield r.race({channel:r.call(sy,n,t),timeout:r.delay(dy)});a&&(yield r.call(t,{level:R,code:"INSTANT_PURCHASE_PARTNER_RESPONSE_TIMEOUT",message:"Instant-purchase partner response timed out after 60000ms"}),n.close(),yield*function*(e){yield*Sy("ProcessingState",0),yield r.put({type:Q,payload:{event:"Dismissed",dismissalReason:e}})}("Implicit"))}function*vy(e,t){const n=function(e,t){return l.eventChannel((n=>e.onEvent(...["INSTANT_PURCHASE_SUCCESS","INSTANT_PURCHASE_FAILURE"].map((e=>({name:e,source:"partner",callback:e=>{var a;"object"==typeof(a=e)&&null!==a&&"timestamp"in a&&"string"==typeof a.timestamp&&"sessionId"in a&&"string"==typeof a.sessionId?n(e):t({level:R,code:"MALFORMED_INSTANT_PURCHASE_WSDK_DATA",message:`Malformed data received from wsdk\n ${e}`})}}))))))}(e,t),{timeout:a}=yield r.race({channel:r.call(ly,n,t),timeout:r.delay(dy)});a&&(yield r.call(t,{level:R,code:"INSTANT_PURCHASE_WSDK_RESPONSE_TIMEOUT",message:"Instant-purchase wsdk response timed out after 60000ms"}),n.close(),yield*xy("offerComplete",2))}function*gy(e){var t,n,a;yield r.put({type:If,payload:e});const i={title:null!==(t=e.title)&&void 0!==t?t:"",description:null!==(n=e.description)&&void 0!==n?n:"",price:null!==(a=e.priceFormatted)&&void 0!==a?a:""};e.copy&&Object.entries(e.copy).forEach((([e,t])=>{i[`copy.${e}`]=t})),yield r.put({type:Fu,payload:{text:i}})}function by(e,t){return{name:"SignalCartItemInstantPurchase",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,initiatedBy:T.DCUI}}}function Iy(e,t){return t.find((t=>t.catalogItemId===e.catalogItemId))}function*Ey(e){yield*Sy("ProcessingState",0),yield r.put({type:Q,payload:{event:"Completed",completionReason:e}})}function*Sy(e,t){yield r.put({type:X,payload:{key:e,value:t}})}function*xy(e,t){yield*Sy("ProcessingState",0),yield r.put({type:te,payload:{key:e,value:t}})}const Cy=["Success","Unspecified","Error"],wy=["Implicit","Explicit"];function*Oy(e,t){if("Checkout"!==t.payload.event)return;yield r.put({type:te,payload:{key:"checkout",value:Ty(t.payload),offerPositionIndex:t.payload.offerPositionIndex}});const n=t.payload.data;if(n){const a="Completed"===n.event;if("Completed"===n.event||"Dismissed"===n.event){(a?Cy.includes(n.reason):wy.includes(n.reason))?yield r.put({type:Q,payload:Object.assign(Object.assign({event:n.event},a?{completionReason:n.reason}:{dismissalReason:n.reason}),{offerPositionIndex:t.payload.offerPositionIndex})}):yield r.call(e,{level:R,code:"CHECKOUT_BUTTON_INVALID_OFFERLIFECYCLE",message:`Misconfigured offer lifecycle payload in handleCheckoutLifecycle: ${n}.`})}else yield r.call(e,{level:R,code:"CHECKOUT_BUTTON_UNKNOWN_EVENT",message:`Unknown event type in checkout lifecycle: ${JSON.stringify(n)}`})}}function Ty(e){var t;return null!==(t={ViewOffer:0,ViewTransactionDetails:1,EditPayment:2,EditShipping:3,EditPaymentAndShipping:4,CostBreakdown:5,Confirmation:6,CloseOffer:7}[e.targetStep])&&void 0!==t?t:0}function*Ay(e,t){yield r.all([r.spawn(uy),r.takeEvery(Ef,Oy.bind(null,t)),r.takeEvery(bf,py),r.takeLatest(Sf,fy.bind(null,e,t)),r.takeLatest(xf,yy.bind(null,t)),r.takeLatest(Cf,hy.bind(null)),r.takeEvery(re,Ku.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}Object.assign(Object.assign({},se),{INITIATE_INSTANT_PURCHASE:Sf,INSTANT_PURCHASE_PARTNER_RESPONSE:xf,INSTANT_PURCHASE_WSDK_RESPONSE:Cf});const jy=(new Cn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=ty({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion},fulfillmentDetails:Xf(i.offerData.creative)}),d=function(e,t,n=ty()){const a=l(),i=s.configureStore({reducer:ey,devTools:{name:"Instant Purchase"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Ay,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Gn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(ki,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Di,{settings:i,dispatch:d.dispatch,children:e.jsx(Qf,{})})})]})}))}}));var Ry=Object.freeze({__proto__:null,moduleConnectorBuilder:jy});const Ny=t.createContext(null),Ly=({children:n})=>{var a;const[i,o]=t.useState([]),[r,s]=t.useState(0),[l,c]=t.useState(0),d=Zt();return t.useEffect((()=>{let e=0;const t=i.length,n=setInterval((()=>{e=e+1>=t?0:e+1,s(e)}),l);return()=>clearInterval(n)}),[l,i]),e.jsx(Ny.Provider,{value:{images:i,activeIndex:r,duration:l,setImages:o,setActiveIndex:s,setDuration:c},children:e.jsx(Jt,{value:d({data:{"image.title":null===(a=i[r])||void 0===a?void 0:a.title}},"creativeCopy"),children:n})})};function Dy({active:n,duration:a,containerStyles:i,indicatorStyles:o}){const r=t.useRef(null);return t.useEffect((()=>{n&&r.current&&function(e,t){const n="animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype,a=[{width:0},{width:"100%"}];if(n){const n=e.animate(a,{duration:t,iterations:1});return()=>{n.finish()}}}(r.current,a)}),[n]),e.jsx("div",{style:Object.assign({position:"relative",height:"2px",width:"100%",backgroundColor:"#FFFFFF66"},i),children:e.jsx("span",{ref:r,style:Object.assign({animationIterationCount:"infinite",animationFillMode:"forwards",animationTimingFunction:"linear",position:"absolute",top:0,left:0,height:"100%",backgroundColor:"#FFF",width:n?"100%":0},o)})})}function _y(e){const n=t.useContext(kn),a=[];return e.forEach((e=>{const t=n(`${e}.src`,"copy"),i=n(`${e}.title`,"copy");if(void 0===t)return;const o=function(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)}({light:t,title:i});a.push(o)})),a}function ky({schema:n,testId:a}){const i=JSON.parse(n.data),{styles:o,duration:r,imageKeys:s}=i,l=t.useContext(Ny),c=_y(s);return t.useEffect((()=>{null==l||l.setImages(c),null==l||l.setDuration(r)}),[]),e.jsxs("div",{"data-testid":a,style:Object.assign({position:"relative",flexShrink:1,flexGrow:0,width:"100%"},o.elements.own),children:[t.Children.toArray(c.map(((t,n)=>e.jsx("img",{src:t.light,alt:t.title,style:Object.assign({opacity:n===(null==l?void 0:l.activeIndex)?1:0,position:0===n?"relative":"absolute",display:0===n?"block":"",top:0,width:"100%",height:"100%",maxHeight:"100%",maxWidth:"100%",transition:"opacity 300ms ease-in-out",objectFit:"contain"},o.elements.image)})))),e.jsx("div",{style:Object.assign({display:"flex",gap:"2px",width:"70%",position:"absolute",margin:"0 15%",bottom:"8px",zIndex:20,justifyContent:"center"},o.elements.indicatorWrapper),children:t.Children.toArray(c.map(((t,n)=>e.jsx(Dy,{duration:r,active:n===(null==l?void 0:l.activeIndex),containerStyles:o.elements.indicatorContainer,indicatorStyles:o.elements.indicator}))))})]})}const Py={allowedTags:["em","strong","a","br","u","p","li","ul","ol","span"],allowedAttributes:{a:["href","target"],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],span:[]},allowedSchemes:["http","https"]},$y=new Map([["&","_;^;_"]]),Fy=new RegExp(`<a *(?=${Py.allowedAttributes.a.join("|")}|>)`,"g"),Gy=new RegExp("<span*>","g"),My=new RegExp(`<a *(?:(?:${Py.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),By=new RegExp("(<br *?>)|(<br *?/>)","g"),Uy="<br/>";function Vy(n){const a=Zt(),i=Nn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(My,((e,t)=>{const n=t.replaceAll("&",$y.get("&"));return e.replace(t,n)})).replaceAll(By,Uy)}(e);return t===u(t,Py)}(e))throw new N("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(Na,{styles:n.schema.styles,children:({classnames:t})=>{const a=[(null==t?void 0:t.link)?`class = "${null==t?void 0:t.link}"`:"",l?'tabindex="-1"':"",l?"style=\"pointer-events: 'none'; user-select: none;\"":"",l?'aria-disabled="true"':""].filter((e=>e.length>0));return i=o,new RegExp("</(p|ul|ol)>").test(i)?e.jsx("div",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:o.replace(Fy,`<a ${a.join(" ")}`).replace(Gy,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}}):e.jsx("p",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:o.replace(Fy,`<a ${a.join(" ")}`).replace(Gy,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}});var i}}):null}function zy({schema:n}){const a=Ct(),i=ft(zn(),an()),o=JSON.parse(n.data),[r]=d({loop:!1,align:"start",slidesToScroll:2,containScroll:"trimSnaps"}),{styles:s,body:{tierItems:l}}=o;if(!l||!l.length)return;const c=l.length>2;return e.jsx("div",{className:i`
136
+ `},t.Children.toArray(u.map((e=>c(e))))))))}const Ws={name:"loading-extension",componentFactory:e=>t.createElement(Hs,{data:e}),interceptors:{}};function Ks({linearGradient:e,color1:n,color2:a,color3:i,duration:o,additionalStyles:r,gradientAngle:s}){const l=t.useRef(null);t.useEffect((()=>{const e=()=>{var e;if(null===(e=l.current)||void 0===e?void 0:e.parentElement){const e=l.current.parentElement;requestAnimationFrame((()=>{const t=Array.from(e.children).filter((e=>!e.classList.contains("background-shimmer")));if(t.length>0){const n=t.reduce(((e,t)=>Math.max(e,t.offsetHeight)),0),a=parseInt(e.style.height||"0");n>0&&n!==a&&(e.style.height=`${n}px`)}}))}};let t;const n=()=>{clearTimeout(t),t=setTimeout(e,100)};return window.addEventListener("resize",n),setTimeout(e,100),()=>{window.removeEventListener("resize",n),clearTimeout(t)}}),[]);const c=t.useMemo((()=>`\n @keyframes slideGradient {\n 0% {\n left: -90%;\n opacity: 0;\n }\n 8% {\n left: -90%;\n opacity: 1;\n }\n 22% {\n left: 90%;\n opacity: 1;\n }\n 28% {\n left: 100%;\n opacity: 0;\n }\n 100% {\n left: 100%;\n opacity: 0;\n }\n }\n .background-shimmer {\n position: absolute !important;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n pointer-events: none;\n z-index: 0;\n }\n \n .background-shimmer::after {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n right: 0;\n bottom: 0;\n width: 50%;\n background: ${e||`linear-gradient(\n ${s||"to right"},\n transparent 0%,\n ${n||"rgba(217, 217, 217, 0.30)"} 20%,\n ${a||"rgba(217, 217, 217, 0.50)"} 50%,\n ${i||"rgba(217, 217, 217, 0.30)"} 80%,\n transparent 100%\n )`};\n animation: slideGradient ${o||"3.94s"} linear infinite forwards;\n pointer-events: none;\n z-index: 0;\n }\n ${r}\n`),[e,n,a,i,o,r,s]);return t.createElement(Yt,null,(e=>t.createElement(Na,{styles:{}},(e=>{var n;const a=e.classnames;return t.createElement(t.Fragment,null,t.createElement("style",null,c),t.createElement("div",{ref:l,className:`${null!==(n=null==a?void 0:a.own)&&void 0!==n?n:""} background-shimmer`}))}))))}const Ys={name:"shimmer-background-extension",componentFactory:e=>e?t.createElement(Ks,{linearGradient:e.linearGradient,color1:e.color1,color2:e.color2,color3:e.color3,duration:e.duration,additionalStyles:e.additionalStyles}):t.createElement("div",null,"Could not render Shimmer Background"),interceptors:{}},Js=1e3;function Zs(e){const n=e.data,{minutes:o,seconds:r,timeRemaining:s,restartTimer:l}=function(e){const[n,a]=t.useState(e),i=(new Date).getTime()/Js,o=t.useRef(null),r=()=>{const t=(new Date).getTime()/Js;a(Math.max(Math.floor(e-(t-i)),0))};return t.useEffect((()=>(o.current=setInterval(r,Js),()=>{o.current&&"number"==typeof o.current&&clearInterval(o.current)})),[]),{minutes:Math.floor(n/60).toString(),seconds:Math.floor(Math.min(n%60,59)).toLocaleString("en-US",{minimumIntegerDigits:2,maximumFractionDigits:0,useGrouping:!1}),timeRemaining:n,restartTimer:function(){o.current&&"number"==typeof o.current&&clearInterval(o.current),a(e),o.current=setInterval(r,Js)}}}((null==n?void 0:n.duration)||300),c=a.useSelector((e=>{const t=i.path(["progression","currentGroupIndex"],e);return"number"==typeof t?t:0})),d=a.useDispatch();t.useEffect((()=>{l()}),[c]),t.useEffect((()=>{0===s&&(d({type:Z,payload:{name:"SignalUserInteraction",action:"TimerExpired",context:"TimerProgression"}}),d({type:"PROGRESSION/PROCESS",payload:{offerProcessStatus:"CONTINUE"}}))}),[o,r]);const u=Nn(),{tabIndex:p,styles:f,isDisabled:y}=h(u);return t.createElement("p",{tabIndex:p,style:Object.assign(Object.assign({},null==n?void 0:n.styles),f),"aria-hidden":y,"data-e2e":"Timer"},`${o}:${r}`)}const Qs={name:"timer-progression-extension",componentFactory:e=>t.createElement(Zs,{data:e}),interceptors:{}};function Xs(e){var n,a,i,o,r;const s=!1===e.isValid&&!!e.error;return t.createElement("div",{"data-testid":e.testId},t.createElement("label",{className:null===(n=e.classnames)||void 0===n?void 0:n.label},e.schema.label),t.createElement("input",{className:s?`${null===(a=e.classnames)||void 0===a?void 0:a.error}`:`${null===(i=e.classnames)||void 0===i?void 0:i.field}`,type:"text",value:e.value||"",placeholder:e.schema.placeholder,required:"Required"===e.schema.validator,onChange:t=>{var n;let a=t.target.value;e.schema.inputFilter&&(a=function(e,t){if(!t)return e;if("object"==typeof t&&t.pattern){const n=new RegExp(t.pattern,"g");return e.replace(n,"")}return"numeric"===t?e.replace(/[^0-9]/g,""):e}(a,e.schema.inputFilter)),null===(n=e.onChange)||void 0===n||n.call(e,a)},"aria-invalid":!!s,"aria-describedby":s?`${e.testId}-error`:void 0}),s&&t.createElement("div",{style:{display:"flex",alignItems:"center",flexDirection:"row"}},t.createElement("img",{src:e.errorIcon,className:null===(o=e.classnames)||void 0===o?void 0:o.errorIcon,alt:"Error"}),t.createElement("div",{className:null===(r=e.classnames)||void 0===r?void 0:r.errorText},e.error)))}function el(e){const{schema:n,disabled:a,onClick:i,testId:o,classnames:r}=e,s=[null==r?void 0:r.button,a?"disabled":""].filter(Boolean).join(" ");return t.createElement("button",{type:"button",className:s,onClick:e=>{e.preventDefault(),e.stopPropagation(),i&&i()},disabled:a,"data-testid":o,"data-e2e":"FormButton","aria-label":n.ariaLabel||n.label,style:{cursor:a?"not-allowed":"pointer",pointerEvents:"auto",flexWrap:"wrap",minWidth:"max-content"}},t.createElement("span",{className:null==r?void 0:r.text},n.label))}const tl="FORMS/UPDATE",nl=(e,t,n)=>{if(!t)return{isValid:!0};switch(t){case"Required":return e.trim()?{isValid:!0}:{isValid:!1,error:(null==n?void 0:n.missingLabel)||"This field is required"};case"PhoneNumber":if(!e.trim())return{isValid:!1,error:(null==n?void 0:n.missingLabel)||"Phone number is required"};return/^[+]?[1-9][\d]{0,15}$/.test(e.replace(/\s/g,""))?{isValid:!0}:{isValid:!1,error:(null==n?void 0:n.errorLabel)||"Invalid phone number"};case"Contains":{if(!e.trim())return{isValid:!1,error:(null==n?void 0:n.missingLabel)||"This field is required"};const t=(null==n?void 0:n.allowedValues)||[];return t.includes(e.trim())?{isValid:!0}:{isValid:!1,error:(null==n?void 0:n.errorLabel)||`Invalid value. Allowed values: ${t.join(", ")}`}}case"ZipCode":if(!e.trim())return{isValid:!1,error:(null==n?void 0:n.missingLabel)||"Postal code is required"};return/^\d{5}(-\d{4})?$/.test(e)?{isValid:!0}:{isValid:!1,error:(null==n?void 0:n.errorLabel)||"Invalid ZIP code"};default:return{isValid:!0}}};function al(e,t){const n={};return Object.keys(t).forEach((e=>{n[e]={value:"",isValid:!0,error:void 0}})),e&&"object"==typeof e&&Object.keys(t).forEach((t=>{const a=e[t],i=n[t];"string"==typeof a&&i&&(i.value=a)})),n}function il(e){const n=a.useDispatch(),i=e.schema.noGroupBreakpoints||[],o=Et(!0,(e=>{var t;return 0===i.length||!i.includes(null===(t=null==e?void 0:e.breakpoint)||void 0===t?void 0:t.activeBreakpoint)})),r=a.useSelector((t=>{var n;return null===(n=t.forms)||void 0===n?void 0:n[e.schema.formId]})),s=a.useSelector((e=>{var t;return(null===(t=e.slots)||void 0===t?void 0:t.length)||0})),l=e=>{null==e||e.forEach((e=>{"CUSTOM_EVENT"===e.type?n({type:X,payload:e.payload}):"SLOT_EVENT"===e.type&&Array.from({length:s},((e,t)=>t)).forEach((t=>{n({type:"CUSTOM_STATES/SET",payload:Object.assign(Object.assign({},e.payload),{offerPositionIndex:t})})}))}))},c=Nn(),{tabIndex:d,isDisabled:u,styles:p}=h(c),{fields:f,fieldGroups:y,controls:m}=e.schema,[v,g]=t.useState((()=>al(r,f))),[b,I]=t.useState(!1),E=t.useCallback((()=>Object.entries(v).reduce(((e,[t,n])=>(e[t]=n.value,e)),{})),[v]),x=()=>{var t;I(!0);const a=Object.assign({},v);let i=!0;if(Object.keys(f).forEach((e=>{var t;const n=f[e],o=(null===(t=v[e])||void 0===t?void 0:t.value)||"",r=nl(o,null==n?void 0:n.validator,n);a[e]={value:o,isValid:r.isValid,error:r.error},r.isValid||(i=!1)})),g(a),i){const a=E();n({type:tl,payload:{formId:e.schema.formId,formData:a}}),l((null===(t=null==m?void 0:m.saveButton)||void 0===t?void 0:t.eventModels)||[])}},S=()=>{var e;g(al(r,f)),I(!1),l((null===(e=null==m?void 0:m.cancelButton)||void 0===e?void 0:e.eventModels)||[])};return t.createElement(Na,{styles:e.schema.styles},(({classnames:n})=>t.createElement("div",{"data-testid":e.testId,"data-e2e":"Form",className:null==n?void 0:n.own,"aria-hidden":u,tabIndex:d,style:Object.assign({display:"flex",flexDirection:"column"},p)},b&&Object.values(v).some((e=>!e.isValid))&&t.createElement("div",{className:null==n?void 0:n.formError,style:{display:"flex",alignItems:"center",flexDirection:"row"}},t.createElement("img",{className:null==n?void 0:n.formErrorIcon,alt:"Error",src:e.schema.error.url.light}),t.createElement("span",{className:null==n?void 0:n.formErrorText},e.schema.error.text)),y.map(((a,i)=>{const r=o&&1!==a.fields.length?"row":"column";return t.createElement("div",{key:i,style:{display:"flex",flexDirection:r},className:"row"===r?null==n?void 0:n.groupRowWrapper:""},a.fields.map((a=>{const i=f[a],o=v[a]||{value:"",isValid:!0,error:void 0};return i?t.createElement("div",{key:a,style:{flex:"1"}},t.createElement(Xs,{schema:i,value:o.value,error:o.error,errorIcon:e.schema.error.url.light,isValid:o.isValid,onChange:e=>((e,t)=>{const n=f[e];let a,i=!0;if((null==n?void 0:n.validateOnChange)&&n.validator){const e=nl(t,n.validator,n);i=e.isValid,a=e.error}g((n=>Object.assign(Object.assign({},n),{[e]:{value:t,isValid:i,error:a}})))})(a,e),testId:`${e.testId}-${a}`,classnames:{label:null==n?void 0:n.fieldLabel,field:null==n?void 0:n.fieldInput,error:null==n?void 0:n.fieldError,errorText:null==n?void 0:n.fieldErrorText,errorIcon:null==n?void 0:n.fieldErrorIcon}})):null})))})),((null==m?void 0:m.saveButton)||(null==m?void 0:m.cancelButton))&&t.createElement("div",{className:null==n?void 0:n.buttonGroup,style:{display:"flex",flexDirection:o?"row":"column",justifyContent:"flex-end",gap:"12px",marginTop:"24px",pointerEvents:"auto"}},(null==m?void 0:m.cancelButton)&&t.createElement(el,{schema:m.cancelButton,onClick:S,testId:`${e.testId}-cancel`,disabled:!1,classnames:{button:null==n?void 0:n.cancelButton}}),(null==m?void 0:m.saveButton)&&t.createElement(el,{schema:m.saveButton,onClick:x,disabled:!1,testId:`${e.testId}-save`,classnames:{button:null==n?void 0:n.saveButton}})))))}function ol(e){const n=Ct(),i=Ht(a.useSelector((t=>{var n;return null===(n=t.forms)||void 0===n?void 0:n[e.schema.formId]}))||{},e.schema.formId);return t.createElement(Jt,{value:i},n(e.schema.node,void 0,e.testId))}const rl={name:"address-form-extension",reducer:{forms:(e,t)=>{if(void 0===e)return{};if(t.type===tl){const n=t.payload,{formId:a,formData:i}=n;return Object.assign(Object.assign({},e),{[a]:i})}return e}},componentFactory:e=>{if(!e||"object"!=typeof e)return t.createElement("div",null,"Could not render Form - invalid data");if((e=>{if("object"!=typeof e||null===e)return!1;const t=e;return"type"in t&&"edit"===t.type&&"formId"in t&&"string"==typeof t.formId&&""!==t.formId.trim()&&"fields"in t&&"object"==typeof t.fields&&"node"in t&&"object"==typeof t.node&&null!==t.node})(e)){const n={formId:e.formId,fields:e.fields||{},node:e.node};return t.createElement(ol,{schema:n,testId:"edit-form-extension"})}if((e=>{if("object"!=typeof e||null===e)return!1;const t=e;return"type"in t&&"view"===t.type&&"formId"in t&&"string"==typeof t.formId&&""!==t.formId.trim()&&"fields"in t&&"object"==typeof t.fields&&null!==t.fields&&"fieldGroups"in t&&Array.isArray(t.fieldGroups)&&"error"in t&&"object"==typeof t.error&&null!==t.error})(e)){const n={formId:e.formId||"default-form",fields:e.fields,fieldGroups:e.fieldGroups||[],controls:e.controls,error:e.error||{url:{light:""},text:"Error occurred"},styles:e.styles,noGroupBreakpoints:e.noGroupBreakpoints||[]};return t.createElement(il,{schema:n,testId:"form-extension"})}return t.createElement("div",null,"Could not render Form - invalid type.")},interceptors:{}},sl="MODULE/ADD_LOADED",ll="MODULE/LOAD",cl="PROGRESSION/INITIALISE",dl="PROGRESSION/NEXT",ul="PROGRESSION/PREV",pl="PROGRESSION/UPDATE_GROUP_SIZE",fl="PROGRESSION/PROCESS",yl="SLOTS/SET",ml="INSTANT_PURCHASE/DISMISS",hl="OFFER_LIFECYCLE",vl="DOMAIN_STATES/SET",gl="OFFER_ENGAGEMENT",bl="GLOBAL_OFFER_DATA_STATE/SET_CART",Il=Object.assign(Object.assign({},ro),{NEXT_IN_PROGRESSION:dl,PREV_IN_PROGRESSION:ul,INITIALISE_PROGRESSION:cl,UPDATE_GROUP_SIZE:pl,SET_SLOTS:yl,ADD_LOADED_MODULE:sl,SET_DOMAIN_STATE:vl,SET_GLOBAL_OFFER_DATA_CART:bl}),El=Object.assign(Object.assign({},so),{LOAD_MODULES:ll,DISMISS_INSTANT_PURCHASE:ml,PROCESS_PROGRESSION:fl,OFFER_LIFECYCLE:hl,OFFER_ENGAGEMENT:gl,SET_PARTNER_VALIDATION_STATUS:ie});function xl(e,t){return t<=0||e<=0||t>e?0:Math.ceil(e/t)}function Sl(e,t){const n=[];if(t<=0||e<=0||t>e)throw Error(`Could not generate the progression groups with groupSize: ${t} and totalCount: ${e}`);for(let a=0;a<xl(e,t);a++){const i=[];for(let n=0;n<t;n++)i.push(Math.min(a*t+n,e-1));n.push([...new Set(i)])}return n}const Cl=Symbol("root");function wl(){return{[Cl]:{}}}const Ol=Object.assign({progression:function(e=null,t){switch(t.type){case cl:if(function(e){const{totalCount:t,currentGroupIndex:n,groupSize:a}=e;return t>=0&&a>=0&&n>=0&&a<=t&&n<xl(t,a)}(t.payload)){const{totalCount:e,_:n,groupSize:a}=t.payload;return Object.assign(Object.assign({},t.payload),{indexGroups:Sl(e,a)})}return null;case pl:{const{groupSize:n}=t.payload,a=null==e?void 0:e.totalCount;return a&&n<=a&&n>0?Object.assign(Object.assign({},e),{groupSize:n,indexGroups:Sl(a,n),currentGroupIndex:0}):null}case dl:{if(!e)return null;const{totalCount:t,groupSize:n,currentGroupIndex:a}=e;return t>0&&n>0&&a>=0?Object.assign(Object.assign({},e),{currentGroupIndex:Math.min(a+1,xl(t,n)-1)}):null}case ul:{if(!e)return null;const{totalCount:t,groupSize:n,currentGroupIndex:a}=e;return t>0&&n>0&&a>=0?Object.assign(Object.assign({},e),{currentGroupIndex:Math.max(a-1,0)}):null}default:return e}},slots:function(e=[],t){return t.type===yl?t.payload:e},module:function(e={loadedModules:[]},t){return t.type===sl?Object.assign(Object.assign({},e),{loadedModules:[...e.loadedModules,t.payload]}):e},domainStates:function(e=wl(),t){if(t.type===vl){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:Cl;return n===Cl?e:Object.assign(Object.assign({},i.assocPath([n,t.payload.key],Number(t.payload.value),e)),{[Cl]:{}})}return e}return e},globalOfferDataState:function(e={},t){if(t.type===bl){if(t.payload.cart){const n=`module${t.payload.offerPositionIndex}`;return Object.assign(Object.assign({},e),{[n]:{cart:t.payload.cart}})}return e}return e}},cr);function Tl(e={}){return Object.assign(Object.assign(Object.assign({},function(e={}){return Object.assign({layout:Qo(),breakpoint:{breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},active:Xo(),fonts:[],signal:{queue:[],processed:[]},serializableCache:lr(),settings:{closeOnComplete:!0},customStates:{root:{}}},e)}(e)),{progression:null,slots:[],module:{loadedModules:[]},domainStates:wl(),globalOfferDataState:{}}),e)}function Al(e){var t;return!!e.progression&&(1===e.progression.groupSize&&e.progression.currentGroupIndex===(null===(t=e.progression)||void 0===t?void 0:t.totalCount)-1)}function jl(e){return e.progression?{activeGroupIndex:e.progression.currentGroupIndex,totalOffers:e.progression.totalCount,totalGroups:xl(e.progression.totalCount,e.progression.groupSize),isLast:Al(e)}:null}function Rl(e,t){return e.domainStates[`module${t}`]||{offerComplete:0,checkout:0}}function Nl(e){return Object.values(e.globalOfferDataState).reduce(((e,t)=>{if(t&&"object"==typeof t&&"cart"in t){const n=t.cart;if(Array.isArray(n))return e+n.reduce(((e,t)=>e+("number"==typeof t.quantity?t.quantity:0)),0)}return e}),0)}function Ll(n){var i;const{config:o,position:r,visible:s,container:l,testId:c}=n,d=zn(),u=Nn(),p=a.useSelector(er),f=a.useSelector((e=>function(e,t){return e.globalOfferDataState[`module${t}`]}(e,r))),y=t.useContext(qn),m=t.useContext(Hn),h=`rokt-${o.layoutVariant.moduleName}-${d}`;return e.jsxs(e.Fragment,{children:[!s&&e.jsx("div",{style:{position:"absolute",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},"aria-hidden":"true"}),e.jsx(h,{style:{display:"flex",flexDirection:"column"===l?"column":"row",width:"100%"},slotInstanceGuid:o.instanceGuid,layoutSchema:JSON.stringify(o.layoutVariant.layoutVariantSchema),schemaVersion:y,childLayouts:JSON.stringify(null!==(i=o.layoutVariant.childLayouts)&&void 0!==i?i:[]),offerData:JSON.stringify(o.offer),offerPositionIndex:r,visible:s,container:l,interactivity:u,"data-testid":c,"data-e2e":`OfferSlot-${r}`,inert:(null==m?void 0:m.inert)&&!s?"":void 0,"aria-hidden":(null==m?void 0:m.inert)?void 0:!s,"module-component":!0,"plugin-id":d,"active-breakpoint":B(p),offerState:JSON.stringify(f)})]})}function Dl({schema:n,testId:i}){const o=n.styles,r=a.useSelector((e=>e.slots)),s=t.useRef(null),l=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0})),c=Nn(),{tabIndex:d,isDisabled:u,styles:p}=h(c);return r.length&&r[l]?e.jsx(Na,{styles:o,children:({classnames:a})=>e.jsx("div",{ref:s,"data-testid":i,"data-e2e":"OneByOneDistribution",className:null==a?void 0:a.own,tabIndex:d,"aria-hidden":u,style:Object.assign({position:"relative",transition:`height ${n.transition.settings.duration/2}ms ease-in-out`,overflow:"hidden",boxSizing:"content-box"},p),children:t.Children.toArray(r.map(((t,a)=>e.jsx(Fi,{effect:n.transition,visible:a===l,parentElement:s.current,children:e.jsx(Ll,{config:t,position:a,visible:a===l,container:"column"})}))))})}):null}const kl=a.connect((function(e,{schema:t}){var n,a,i;const o=t.startPosition||1;if((null===(n=e.progression)||void 0===n?void 0:n.totalCount)&&(null===(a=e.progression)||void 0===a?void 0:a.groupSize)){const t=xl(e.progression.totalCount,e.progression.groupSize);let n;n=o>0?o-1:t+o>-1?t+o:0;return{numOfIndicators:t-n>-1?t-n:0,activeIndex:null!==(i=e.progression.currentGroupIndex)&&void 0!==i?i:0,startIndex:n}}return{numOfIndicators:0,activeIndex:0,startIndex:0}}))((function({activeIndex:t,startIndex:n,numOfIndicators:a,schema:i}){const o=Nn(),{tabIndex:r,styles:s,isDisabled:l}=h(o),c=Array(a).fill(i.indicator);return a>1&&(u=a+n-1,(d=t)>=n&&d<=u)?e.jsx(Yt,{children:a=>e.jsx(Na,{styles:i.styles,children:i=>{var o;const d=i.classnames,u=e=>{var n,a;return e===t?`${null==d?void 0:d.indicator} ${(null==d?void 0:d.activeIndicator)?d.activeIndicator:null!==(n=null==d?void 0:d.seenIndicator)&&void 0!==n?n:""}`:e<t?`${null==d?void 0:d.indicator} ${null!==(a=null==d?void 0:d.seenIndicator)&&void 0!==a?a:""}`:null==d?void 0:d.indicator};return e.jsx("div",{className:null!==(o=null==d?void 0:d.own)&&void 0!==o?o:"",style:Object.assign({display:"flex",flexDirection:"row"},s),"data-e2e":"ProgressIndicator",tabIndex:r,"aria-hidden":l,children:y.Children.toArray(c.map(((t,i)=>e.jsx("span",{className:u(i+n),style:{display:"flex"},children:a({state:{indicatorPosition:String(i+1+n)}})(t)}))))})}})}):null;var d,u}));const _l="partnerValidationUI",Pl="stackedViewableItems";function $l(n){var o;const r=a.useDispatch(),s=a.useSelector((e=>e.slots)),l=null!==(o=n.schema.viewableItems)&&void 0!==o?o:[],c=Ea(l.reduce(((e,t,n)=>Object.assign(Object.assign({},e),{[n]:t.when})),{})),d=i.compose((e=>{var t;return e&&(null===(t=l[e[0]])||void 0===t?void 0:t.value)||s.length}),i.find((([e,t])=>t)),i.toPairs)(c);t.useEffect((()=>{r({type:Zi,payload:{key:Pl,value:String(d)}})}),[d]);const u=s.slice(0,d),p=Nn(),{tabIndex:f,isDisabled:y,styles:m}=h(p);return(null==u?void 0:u.length)>0?e.jsx(Na,{styles:n.schema.styles,children:({classnames:a})=>e.jsx("div",{"data-testid":n.testId,"data-e2e":"StackedDistribution",className:null==a?void 0:a.own,"aria-hidden":y,tabIndex:f,style:Object.assign({display:"flex",flexDirection:"column"},m),children:t.Children.toArray(u.map(((t,n)=>e.jsx(Ll,{config:t,position:n,visible:!0,container:"column"}))))})}):null}function Fl(n){const i=n.schema.styles,o=a.useDispatch(),r=Nn(),s="Backward"===n.schema.direction?"Previous":"Next",{tabIndex:l,styles:c,isDisabled:d}=h(r),u=()=>{o({type:"Backward"===n.schema.direction?Il.PREV_IN_PROGRESSION:Il.NEXT_IN_PROGRESSION})};return e.jsx(Na,{styles:i,children:({classnames:a})=>{var i;return e.jsx("button",{title:s,className:null==a?void 0:a.own,onClick:u,"data-testid":n.testId,"data-e2e":"ProgressControl","data-e2e-direction":`${n.schema.direction}`,disabled:d,"aria-disabled":d,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:s,tabIndex:l,style:Object.assign({cursor:"pointer"},c),children:e.jsx(St,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}function Gl({schema:n,testId:i}){var o,r,s,l,c,u,p,f,y;const m=a.useSelector((e=>e.progression)),v=null==m?void 0:m.indexGroups[null==m?void 0:m.currentGroupIndex],g=null!==(o=null==m?void 0:m.currentGroupIndex)&&void 0!==o?o:0,b=a.useSelector((e=>e.slots)),I=a.useSelector(ir),E=n.viewableItems.length-1,[x,S]=d({slidesToScroll:null!==(r=n.viewableItems[Math.min(I,E)])&&void 0!==r?r:"auto",containScroll:"trimSnaps"}),C=a.useDispatch(),w=Nn(),{tabIndex:O,isDisabled:T,styles:A}=h(w),j=`${null!==(f=null===(p=null===(u=null===(c=null===(l=null===(s=n.styles)||void 0===s?void 0:s.elements)||void 0===l?void 0:l.own[I])||void 0===c?void 0:c.default)||void 0===u?void 0:u.container)||void 0===p?void 0:p.gap)&&void 0!==f?f:"0"}px`;t.useEffect((()=>{function e(e){var t,n;const a=null!==(t=null==e?void 0:e.selectedScrollSnap())&&void 0!==t?t:0,i=null!==(n=null==e?void 0:e.previousScrollSnap())&&void 0!==n?n:0;a!==g&&(a>i?C({type:Il.NEXT_IN_PROGRESSION}):a<i&&C({type:Il.PREV_IN_PROGRESSION}))}return null!=g&&(null==S||S.on("select",e),null==S||S.scrollTo(g)),()=>{null==S||S.off("select",e)}}),[S,g,C]);const R={overflow:"hidden"},N={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:j,alignItems:"stretch"},L=e=>{var t;return null!==(t=null==v?void 0:v.includes(e))&&void 0!==t&&t},D=n.peekThroughSize[Math.min(I,n.peekThroughSize.length-1)],k=D?"Fixed"===(_=D).type?`${_.value}px`:`${_.value}%`:"0px";var _;const P=null!==(y=n.viewableItems[Math.min(E,I)])&&void 0!==y?y:1,$={flex:`0 0 calc(${(e=>"0px"!==e&&"0%"!==e)(k)?`(100% - 2 * ${k} - (${P} + 1) * ${j})/${P}`:`(100% - (${P} - 1) * ${j})/${P}`})`,position:"relative",display:"flex",overflow:"auto"};return(null==b?void 0:b.length)>0?e.jsx(Na,{styles:n.styles,children:({classnames:n})=>e.jsx("div",{ref:x,style:Object.assign(Object.assign({},R),A),"aria-disabled":T,tabIndex:O,className:null==n?void 0:n.own,"data-e2e":"CarouselDistribution","data-testid":i&&`${i}`,children:e.jsx("div",{style:N,"data-testid":i&&`${i}-container`,"data-e2e":"CarouselDistribution-Container",children:t.Children.toArray(b.map(((t,n)=>e.jsx("div",{style:$,"data-testid":i&&`${i}-slide-${n}`,"data-e2e":`CarouselDistribution-Slide-${n}`,children:e.jsx(Ll,{config:t,position:n,container:"row",visible:L(n)})}))))})})}):null}const Ml=Object.freeze([]);function Bl({schema:n,testId:i}){const o=zn(),r=t.useMemo((()=>ft(o)([{display:"flex",flexDirection:"column"}])),[o]),s=a.useSelector((e=>{var t;return(null===(t=e.progression)||void 0===t?void 0:t.groupSize)||0})),l=a.useSelector((e=>{var t;return(null===(t=e.progression)||void 0===t?void 0:t.indexGroups)||Ml})),c=a.useSelector((e=>e.slots||Ml)),d=t.useMemo((()=>l.map((e=>e.map((e=>c[e])).filter((e=>null!=e))))),[l,c]),u=t.useRef(null),p=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0})),f=Nn(),{tabIndex:y,isDisabled:m,styles:v}=h(f);return d.length?e.jsx(Na,{styles:n.styles,children:({classnames:a})=>e.jsx("div",{ref:u,"data-testid":i,"data-e2e":"GroupedDistribution","aria-disabled":m,tabIndex:y,style:Object.assign({position:"relative",transition:`height ${n.transition.settings.duration/2}ms ease-in-out`,overflow:"hidden",boxSizing:"content-box"},v),children:t.Children.toArray(d.map(((o,l)=>e.jsx(Fi,{effect:n.transition,visible:l===p,parentElement:u.current,containerClassName:[r,null==a?void 0:a.own].filter(Boolean).join(" ")||void 0,children:t.Children.toArray(o.map(((t,n)=>{const a=s*l+n;return e.jsx(Ll,{config:t,position:a,visible:l===p,container:"column",testId:i?`${i}-child${a}`:void 0})})))}))))})}):null}const Ul={action:{CaptureOnly:"CaptureOnly",Url:"Url",Fulfillment:"Fulfillment",ExternalPaymentTrigger:"ExternalPaymentTrigger"},urlBehavior:{newTab:"newTab",roktWebViewSDK:"roktWebViewSDK",self:"self"},signalType:{SignalResponse:"SignalResponse",SignalGatedResponse:"SignalGatedResponse",SignalSecondaryResponse:"SignalSecondaryResponse"},conversionType:{Default:"Default",RealTime:"RealTime",RealTimeReferral:"RealTimeReferral"}};function Vl(e,t,n=!1){return Error(`Could not translate ${e} with guid: ${t}${n?" for child layout":""}`)}function zl(e,t=!1){var n;try{if(e.responseOptionsMap||t)return Object.assign(Object.assign({},e),{responseOptionsMap:i.mapObjIndexed(ql,null!==(n=e.responseOptionsMap)&&void 0!==n?n:{})});{const t=`Creative: ${e.instanceGuid}, did not receive a valid response options map.`;throw new N("NO_CREATIVE_RESPONSE_OPTIONS_MAP",t)}}catch(n){throw n.message?n:Vl("Creative",e.instanceGuid,t)}}function ql(e){try{let t,n;if(e.urlBehavior&&(t=Ul.urlBehavior[e.urlBehavior]),e.conversionType&&(n=Ul.conversionType[e.conversionType]),"External"===e.action){const t=`Creative response with instanceGuid '${e.instanceGuid}' uses legacy action type 'External'. This should be 'ExternalPaymentTrigger'.`;throw new N("LEGACY_EXTERNAL_ACTION_TYPE",t)}return Object.assign(Object.assign({},e),{urlBehavior:t,action:Ul.action[e.action],signalType:Ul.signalType[e.signalType],conversionType:n})}catch(t){throw t.message?t:Vl("CreativeResponse",e.instanceGuid)}}function Hl(e,t,n){try{return JSON.parse(e)}catch(e){throw Error(`Parse JSON failed, invalid JSON file for ${t} with guid ${n}.`)}}function Wl(){t.useEffect((()=>{const e=new ResizeObserver(function(e=100){let t;return()=>{t&&clearTimeout(t),t=setTimeout((()=>{var e,n;null===(n=null===(e=window.frameElement)||void 0===e?void 0:e.iFrameResizer)||void 0===n||n.resize(),t=void 0}),e)}}());return e.observe(document.body),()=>{e.disconnect()}}),[])}const Kl={OneByOneDistribution:function(t){if("OneByOneDistribution"===t.type)return e.jsx(Dl,{schema:t.node})},StackedDistribution:function(t){if("StackedDistribution"===t.type)return e.jsx($l,{schema:t.node})},ProgressIndicator:function(t){if("ProgressIndicator"===t.type)return e.jsx(kl,{schema:t.node})},ProgressControl:function(t){if("ProgressControl"===t.type)return e.jsx(Fl,{schema:t.node})},Overlay:function(t){if("Overlay"===t.type)return e.jsx(vo,{schema:t.node})},CloseButton:function(t){if("CloseButton"===t.type)return e.jsx(uo,{schema:t.node})},EscapeHatch:(Yl=[function(t,n){if(v("CloseButton",t)){const n=JSON.parse(t.node.data);return e.jsx(uo,{schema:n.node,action:n.action})}},gi],e=>Yl.reduce(((t,n)=>void 0===t?n(e):t),void 0)),CarouselDistribution:function(t){if("CarouselDistribution"===t.type)return e.jsx(Gl,{schema:t.node})},GroupedDistribution:function(t){if("GroupedDistribution"===t.type)return e.jsx(Bl,{schema:t.node})},BottomSheet:function(t){if("BottomSheet"===t.type)return e.jsx(Eo,{schema:t.node})}};var Yl;function Jl(e,t){e({type:Z,payload:{name:"SignalActivation",parentGuid:t}})}function Zl({pageInstanceGuid:n}){var o,r,s,l,c,d;const u=a.useSelector((e=>e.layout),i.equals),p=a.useDispatch(),f=a.useSelector((e=>({breakpoint:e.breakpoint,progression:jl(e),customStates:e.customStates.root,domainStates:e.domainStates[Cl]})),i.equals),y=a.useSelector((e=>e.slots.length)),m=a.useSelector((e=>{var t;const n=Number(null!==(t=e.serializableCache.get(Pl))&&void 0!==t?t:"");return y-n})),h=a.useSelector(Nl);de(Tt(),p),t.useEffect((()=>(u&&document.body.addEventListener("click",Jl.bind(null,p,u.instanceGuid),{once:!0}),()=>{u&&document.body.removeEventListener("click",Jl.bind(null,p,u.instanceGuid))})),[null==u?void 0:u.instanceGuid]),Wl(),t.useEffect((()=>{if(u){const e={type:Z,payload:{name:"SignalImpression",parentGuid:u.instanceGuid}},t={type:io,payload:{code:"LAYOUT_IMPRESSED"}};p(e),p(t)}}),[u]);const v=e=>{p({type:El.REPORT_ERROR,payload:e})},g=a.useSelector((e=>e.breakpoint.initialised));if(u&&g){const t=Ht({})({state:{progression:(null!==(r=null===(o=f.progression)||void 0===o?void 0:o.activeGroupIndex)&&void 0!==r?r:0)+1,maxProgression:null!==(l=null===(s=f.progression)||void 0===s?void 0:s.totalGroups)&&void 0!==l?l:1,availableOffersCount:null!==(d=null===(c=f.progression)||void 0===c?void 0:c.totalGroups)&&void 0!==d?d:y,selectedCatalogItemQuantity:h,hiddenItemCount:m}}),a=Ri(v);return e.jsx(Gn,{info:{layoutType:"OuterLayout",pageInstanceGuid:n},children:e.jsx(Jt,{value:t,children:e.jsx(wt,{value:a,overrides:Kl,children:e.jsx(It.Provider,{value:f,children:e.jsx(gt.Provider,{value:p,children:e.jsx(en.Provider,{value:"OUTER",children:e.jsx(qn.Provider,{value:u.layoutSchemaVersion,children:e.jsx(St,{children:e=>e(u.layoutSchema)})})})})})})})})}return null}var Ql=Object.freeze({__proto__:null,getDistribution:function e(t){var n;switch(t.type){case"OneByOneDistribution":case"StackedDistribution":case"CarouselDistribution":case"GroupedDistribution":return t;case"Row":case"Column":case"When":case"ZStack":case"FlowRow":case"InlineContainer":case"ScrollableRow":case"ScrollableColumn":case"BottomSheet":case"Overlay":for(const n of t.node.children){const t=e(n);if(t)return t}break;case"EscapeHatch":try{const{name:a,body:i}=JSON.parse(t.node.data);if(("loading-extension"===a||"minimized-bottomsheet-extension"===a)&&(null===(n=null==i?void 0:i.children)||void 0===n?void 0:n.length))for(const t of i.children){const n=e(t);if(n)return n}break}catch(e){break}case"StaticImage":case"DataImage":case"RichText":case"BasicText":case"ProgressIndicator":case"CreativeResponse":case"StaticLink":case"CloseButton":case"ProgressControl":case"StaticIcon":case"DataIcon":case"SlideStateTrigger":case"ToggleButtonStateTrigger":case"TimerStateTrigger":case"CatalogStackedCollection":case"CatalogCarouselCollection":case"CatalogResponseButton":case"CatalogQuantityOption":case"CatalogRadioGroup":case"CatalogQuantityCounter":case"PartnerEventButtonTrigger":case"CopyToClipboardButton":case"ButtonStateTrigger":case"CatalogCombinedCollection":case"IconGroup":break;default:!function(e){throw Error(`Could not handle layout: ${JSON.stringify(e)}`)}(t)}},getDistributionViewableItems:function(e){switch(null==e?void 0:e.type){case"CarouselDistribution":case"GroupedDistribution":return e.node.viewableItems;default:return}}}),Xl=Object.assign({},Ql);function*ec(e,t){const n=Xl.getDistribution(t),a=null==n?void 0:n.type,i=yield r.select(ir),o=function(e=0,t){var n;switch(null==t?void 0:t.type){case"CarouselDistribution":case"GroupedDistribution":{const a=Math.min(t.node.viewableItems.length,e);return null!==(n=t.node.viewableItems[a])&&void 0!==n?n:1}default:return 1}}("number"==typeof i?i:0,n);"OneByOneDistribution"!==a&&"CarouselDistribution"!==a&&"GroupedDistribution"!==a||(yield c.put({type:Il.INITIALISE_PROGRESSION,payload:{currentGroupIndex:0,totalCount:e,groupSize:o}}))}function*tc(e,t){var n;const{instanceGuid:a,layoutSchemaVersion:o,outerLayoutSchema:r,slots:s}=t.payload;a?yield c.put({type:Z,payload:{name:"SignalLoadComplete",parentGuid:a}}):yield c.put({type:ao,payload:{level:Oo,code:Mo,message:"Layout instance guid does not exist"}}),yield c.put({type:ll,payload:{modules:s.map((e=>e.layoutVariant.moduleName))}}),yield c.put({type:zi,payload:r.breakpoints}),yield c.put({type:Il.LAYOUT_UPDATE,payload:{instanceGuid:a,layoutSchemaVersion:o,layoutSchema:r.layout,settings:r.settings}}),yield c.put({type:Il.SET_SLOTS,payload:s}),i.isNil(r.settings)||(yield c.put({type:Il.SET_SETTINGS,payload:r.settings})),yield*ec(s.length,r.layout);const l=yield*function*(e,t,n){const a=null==t?void 0:t.enablePartnerValidation,i=["add-to-cart"],o=n.some((e=>i.some((t=>t===e.layoutVariant.moduleName))));if(a&&o)try{yield c.call(e.send,hr.PartnerValidationEvent.OPT_IN_TO_PARTNER_VALIDATION),yield c.spawn(nc,e,hr.PartnerValidationEvent.SHOW_PARTNER_VALIDATION_STATUS,(()=>({type:"ACTIVE/ADD",payload:{id:_l}})))}catch(e){return yield c.put({type:ao,payload:{level:wo,code:Uo,message:"Failed to establish partner validation."}}),"FAILURE"}return"OK"}(e.partner,r.settings,s);"OK"===l&&(yield c.call($r,e.display,r.display,null===(n=r.settings)||void 0===n?void 0:n.frameControls))}function*nc(e,t,n){const a=l.eventChannel((a=>{const i=e.onEvent(t).subscribe((e=>{a(n(e))}));return()=>{i.unsubscribe()}}));for(;;){const e=yield c.take(a);yield c.put(e)}}function ac(e){return Vc(e)}function ic(e,t){return Error(`Migration process from v0_0 to v0_1 failed: could not transform ${e} node. For more details: ${t}`)}const oc=i.all(i.anyPass([function(e){return"Row"===e.type&&cc(e.node.children)},function(e){return"Column"===e.type&&cc(e.node.children)},fc,yc])),rc=i.all(i.anyPass([function(e){return"Row"===e.type&&dc(e.node.children)},function(e){return"Column"===e.type&&dc(e.node.children)},yc,fc,function(e){return"DataImage"===e.type},function(e){return"When"===e.type&&dc(e.node.children)}])),sc=i.all(i.anyPass([function(e){return"Row"===e.type&&uc(e.node.children)},function(e){return"Column"===e.type&&uc(e.node.children)},yc,fc])),lc=i.all(i.anyPass([function(e){return"Row"===e.type&&pc(e.node.children)},function(e){return"Column"===e.type&&pc(e.node.children)},fc,function(e){return"RichText"===e.type},yc,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&pc(e.node.children)},function(e){return"StaticLink"===e.type&&pc(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CloseButton"===e.type&&pc(e.node.children)}]));function cc(e){return oc(e)}function dc(e){return rc(e)}function uc(e){return sc(e)}function pc(e){return lc(e)}function fc(e){return"StaticImage"===e.type}function yc(e){return"BasicText"===e.type}const mc=i.lensPath(["styles","elements","link"]),hc=i.lensPath(["styles","elements","activeIndicator"]),vc=i.lensPath(["styles","elements","indicator"]),gc=i.lensPath(["styles","elements","seenIndicator"]),bc=i.lensPath(["focussed"]),Ic=i.lensPath(["hovered"]),Ec=i.lensPath(["default"]),xc=i.lensPath(["pressed"]),Sc=e=>{var t;return{text:null!==(t=null==e?void 0:e.text)&&void 0!==t?t:{}}},Cc=i.when(i.hasPath(["styles","elements","link"]),i.pipe(i.over(mc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default})))),i.over(mc,i.map(i.when(i.has("focussed"),i.over(bc,Sc)))),i.over(mc,i.map(i.when(i.has("hovered"),i.over(Ic,Sc)))),i.over(mc,i.map(i.when(i.has("default"),i.over(Ec,Sc)))),i.over(mc,i.map(i.when(i.has("pressed"),i.over(xc,Sc)))))),wc=i.pipe(i.when(i.hasPath(["styles","elements","activeIndicator"]),i.over(hc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","indicator"]),i.over(vc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","seenIndicator"]),i.over(gc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))));function Oc(e,t){return e?{elements:{own:e.elements.own.map(t)}}:void 0}const Tc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),Ac=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),jc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),Rc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),Nc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),Lc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),Dc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),kc=e=>{switch(e){case"is":return"is";case"is not":return"is-not";case"is below":return"is-below";case"is above":return"is-above";default:throw ic("When",`Invalid condition: ${e}`)}},_c=e=>{switch(e){case"breakpoint":return"Breakpoint";case"progression":return"Progression";case"position":return"Position";default:throw ic("When",`Invalid target: ${e}`)}},Pc=e=>{const{target:t,condition:n,value:a}=e;return{type:_c(t),predicate:{condition:kc(n),value:a}}};function $c(e){const t={type:"FadeInOut",settings:{duration:e.transition.settings.duration}};return{styles:e.style,transition:t}}function Fc(e){const t=e.children.map((e=>Vc(e)));if(cc(t))return Object.assign(Object.assign({},e),{children:t,styles:Oc(e.styles,Nc)});throw ic("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function Gc(e){const t=e.children.map((e=>Vc(e)));if(dc(t))return Object.assign(Object.assign({},e),{children:t,styles:Oc(e.styles,Lc)});throw ic("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function Mc(e){const t=e.children.map((e=>Vc(e)));if(uc(t))return Object.assign(Object.assign({},e),{children:t,styles:Oc(e.styles,Dc)});throw ic("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}const Bc=e=>({own:e.overlayContainer,wrapper:e.overlayWrapper});function Uc(e){var t,n;const a=(null===(t=e.styles)||void 0===t?void 0:t.elements)?{elements:Bc(null===(n=e.styles)||void 0===n?void 0:n.elements)}:void 0,i=e.children.map((e=>Vc(e)));if(pc(i))return Object.assign(Object.assign({},e),{styles:a,children:i});throw ic("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function Vc(e){switch(e.type){case"When":return{type:"When",node:(s=e.node,{predicates:s.predicates.map(Pc),children:s.children.map((e=>Vc(e)))})};case"OneByOneDistribution":return{type:e.type,node:$c(e.node)};case"Overlay":return{type:e.type,node:Uc(e.node)};case"Column":return{type:e.type,node:(r=e.node,{styles:Oc(r.styles,Tc),children:r.children.map((e=>Vc(e)))})};case"Row":return{type:e.type,node:(o=e.node,{styles:Oc(o.styles,Ac),children:o.children.map((e=>Vc(e)))})};case"RichText":return{type:e.type,node:(i=e.node,Cc(i))};case"CloseButton":return{type:e.type,node:Fc(e.node)};case"CreativeResponse":return{type:e.type,node:Gc(e.node)};case"StaticLink":return{type:e.type,node:Mc(e.node)};case"StaticImage":return{type:e.type,node:(a=e.node,Object.assign(Object.assign({},a),{styles:Oc(a.styles,jc)}))};case"DataImage":return{type:e.type,node:(n=e.node,Object.assign(Object.assign({},n),{styles:Oc(n.styles,Rc)}))};case"ProgressIndicator":return{type:e.type,node:(t=e.node,wc(t))};default:return e}var t,n,a,i,o,r,s}function zc(e){return Jd(e)}function qc(e,t){return Error(`Migration process from v0_23 to v1_0 failed: could not transform ${e} node. For more details: ${t}`)}const Hc=e=>"scroll"===e||"auto"===e?"visible":e,Wc=i.lensPath(["elements","own"]),Kc=i.lensPath(["transitions","transition","value","own"]),Yc=i.lensPath(["elements","wrapper"]),Jc=i.lensPath(["transitions","transition","value","wrapper"]),Zc=i.lensPath(["elements","indicator"]),Qc=i.lensPath(["transitions","transition","value","indicator"]),Xc=i.lensPath(["elements","activeIndicator"]),ed=i.lensPath(["transitions","transition","value","activeIndicator"]),td=i.lensPath(["elements","seenIndicator"]),nd=i.lensPath(["transitions","transition","value","seenIndicator"]),ad=i.lensPath(["default","container","overflow"]),id=i.lensPath(["pressed","container","overflow"]),od=i.lensPath(["hovered","container","overflow"]),rd=i.lensPath(["focussed","container","overflow"]),sd=i.lensPath(["disabled","container","overflow"]),ld=i.lensPath(["container","overflow"]),cd=i.pipe(i.when(i.hasPath(["default","container","overflow"]),i.over(ad,Hc)),i.when(i.hasPath(["pressed","container","overflow"]),i.over(id,Hc)),i.when(i.hasPath(["hovered","container","overflow"]),i.over(od,Hc)),i.when(i.hasPath(["focussed","container","overflow"]),i.over(rd,Hc)),i.when(i.hasPath(["disabled","container","overflow"]),i.over(sd,Hc))),dd=i.when(i.hasPath(["container","overflow"]),i.over(ld,Hc)),ud=i.pipe(i.when(i.hasPath(["elements","own"]),i.over(Wc,i.map(cd))),i.when(i.hasPath(["transitions","transition","value","own"]),i.over(Kc,dd))),pd=i.when(i.has("transitions"),(e=>{var t;return i.compose(i.omit(["transitions"]),i.assoc("conditionalTransitions",null===(t=e.transitions)||void 0===t?void 0:t.transition))(e)})),fd=i.pipe(ud,pd),yd=i.pipe(i.when(i.hasPath(["elements","wrapper"]),i.over(Yc,i.map(cd))),i.when(i.hasPath(["transitions","transition","value","wrapper"]),i.over(Jc,dd))),md=i.pipe(i.when(i.hasPath(["elements","indicator"]),i.over(Zc,i.map(cd))),i.when(i.hasPath(["transitions","transition","value","indicator"]),i.over(Qc,dd))),hd=i.pipe(i.when(i.hasPath(["elements","activeIndicator"]),i.over(Xc,i.map(cd))),i.when(i.hasPath(["transitions","transition","value","activeIndicator"]),i.over(ed,dd))),vd=i.pipe(i.when(i.hasPath(["elements","seenIndicator"]),i.over(td,i.map(cd))),i.when(i.hasPath(["transitions","transition","value","seenIndicator"]),i.over(nd,dd)));function gd(e){return"StaticImage"===e.type}function bd(e){return"StaticIcon"===e.type}function Id(e){return"BasicText"===e.type}function Ed(e){return"DataImage"===e.type}function xd(e){return"DataIcon"===e.type}function Sd(e){return"RichText"===e.type}function Cd(e){return"SlideStateTrigger"===e.type}function wd(e){return"ToggleButtonStateTrigger"===e.type}const Od=i.all(i.anyPass([function(e){return"Row"===e.type&&Td(e.node.children)},function(e){return"Column"===e.type&&Td(e.node.children)},gd,bd,Sd,Id,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&Td(e.node.children)},function(e){return"StaticLink"===e.type&&Td(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CarouselDistribution"===e.type},function(e){return"GroupedDistribution"===e.type},function(e){return"CloseButton"===e.type&&Td(e.node.children)},function(e){return"ProgressControl"===e.type&&$d(e.node.children)},function(e){return"ZStack"===e.type&&Td(e.node.children)},function(e){return"FlowRow"===e.type&&Td(e.node.children)},Cd,wd]));function Td(e){return Od(e)}const Ad=i.pipe(ud,yd,pd);function jd(e){const t=e.children.map((e=>Jd(e)));if(Td(t))return Object.assign(Object.assign({},i.omit(["settings"],e)),{children:t,allowBackdropToClose:e.settings.allowBackdropToClose,styles:e.styles?Ad(e.styles):void 0});throw qc("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function Rd(e){const t=e.children.map((e=>Jd(e)));if($d(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?fd(e.styles):void 0});throw qc("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function Nd(e){const t=e.children.map((e=>Jd(e)));if(Gd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?fd(e.styles):void 0});throw qc("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function Ld(e){const t=e.children.map((e=>Jd(e)));if($d(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?fd(e.styles):void 0});throw qc("ProgressControl",`Invalid schema: ${JSON.stringify(e)}`)}const Dd=i.pipe(ud,md,hd,vd,pd);const kd=i.all(i.anyPass([Id,gd,bd,Ed,xd,function(e){return"Row"===e.type&&_d(e.node.children)},function(e){return"FlowRow"===e.type&&_d(e.node.children)},function(e){return"Column"===e.type&&_d(e.node.children)},function(e){return"ZStack"===e.type&&_d(e.node.children)},function(e){return"When"===e.type&&_d(e.node.children)}]));function _d(e){return kd(e)}const Pd=i.all(i.anyPass([Id,gd,bd,function(e){return"Row"===e.type&&$d(e.node.children)},function(e){return"FlowRow"===e.type&&$d(e.node.children)},function(e){return"Column"===e.type&&$d(e.node.children)},function(e){return"ZStack"===e.type&&$d(e.node.children)},function(e){return"When"===e.type&&$d(e.node.children)}]));function $d(e){return Pd(e)}const Fd=i.all(i.anyPass([Id,gd,bd,Ed,xd,function(e){return"Row"===e.type&&Gd(e.node.children)},function(e){return"FlowRow"===e.type&&Gd(e.node.children)},function(e){return"Column"===e.type&&Gd(e.node.children)},function(e){return"ZStack"===e.type&&Gd(e.node.children)},function(e){return"When"===e.type&&Gd(e.node.children)}]));function Gd(e){return Fd(e)}function Md(e){const t=e.children.map((e=>Jd(e)));if(_d(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?fd(e.styles):void 0});throw qc("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}function Bd(e){const t=e.children.map((e=>Jd(e)));if(Gd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?fd(e.styles):void 0});throw qc("CatalogResponseButton",`Invalid schema: ${JSON.stringify(e)}`)}function Ud(e){return"Row"===e.type&&qd(e.node.children)}function Vd(e){return"Column"===e.type&&qd(e.node.children)}const zd=i.all(i.anyPass([Id,gd,bd,Ed,xd,Sd,function(e){return"StaticLink"===e.type},Cd,wd,function(e){return"CatalogResponseButton"===e.type},Ud,function(e){return"FlowRow"===e.type&&qd(e.node.children)},Vd,function(e){return"ZStack"===e.type&&qd(e.node.children)},function(e){return"When"===e.type&&qd(e.node.children)}]));function qd(e){return zd(e)}const Hd=i.anyPass([Ud,Vd]);function Wd(e){const t=Jd(e.template);if(function(e){return Hd(e)}(t))return Object.assign(Object.assign({},e),{template:t,styles:e.styles?fd(e.styles):void 0});throw qc("CatalogStackedCollection",`Invalid schema: ${JSON.stringify(e)}`)}function Kd(e){const t=e.children.map((e=>Jd(e)));if(_d(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?fd(e.styles):void 0});throw qc("ToggleButtonStateTrigger",`Invalid schema: ${JSON.stringify(e)}`)}function Yd(e){const t=e.transition?{inTransition:e.transition.in,outTransition:e.transition.out}:void 0;return Object.assign(Object.assign({},e),{children:e.children.map((e=>Jd(e))),transition:t})}function Jd(e){switch(e.type){case"Row":return{type:e.type,node:(g=e.node,Object.assign(Object.assign({},g),{children:g.children.map((e=>Jd(e))),styles:g.styles?fd(g.styles):void 0}))};case"When":return{type:e.type,node:Yd(e.node)};case"FlowRow":return{type:e.type,node:(v=e.node,Object.assign(Object.assign({},v),{styles:v.styles?fd(v.styles):void 0,children:v.children.map((e=>Jd(e)))}))};case"Column":return{type:e.type,node:(h=e.node,Object.assign(Object.assign({},h),{children:h.children.map((e=>Jd(e))),styles:h.styles?fd(h.styles):void 0}))};case"ZStack":return{type:e.type,node:(m=e.node,Object.assign(Object.assign({},m),{styles:m.styles?fd(m.styles):void 0,children:m.children.map((e=>Jd(e)))}))};case"Overlay":return{type:e.type,node:jd(e.node)};case"ProgressControl":return{type:e.type,node:Ld(e.node)};case"CarouselDistribution":return{type:"CarouselDistribution",node:(y=e.node,Object.assign(Object.assign({},i.omit(["settings"],y)),{viewableItems:y.settings.viewableItems,peekThroughSize:y.settings.peekThroughSize,styles:y.styles?fd(y.styles):void 0}))};case"CloseButton":return{type:"CloseButton",node:Rd(e.node)};case"CreativeResponse":return{type:"CreativeResponse",node:Nd(e.node)};case"GroupedDistribution":return{type:"GroupedDistribution",node:(f=e.node,Object.assign(Object.assign({},i.omit(["settings"],f)),{viewableItems:f.settings.viewableItems,transition:f.settings.transition,styles:f.styles?fd(f.styles):void 0}))};case"OneByOneDistribution":return{type:"OneByOneDistribution",node:(p=e.node,Object.assign(Object.assign({},p),{styles:p.styles?fd(p.styles):void 0}))};case"ProgressIndicator":return{type:"ProgressIndicator",node:(d=e.node,Object.assign(Object.assign({},i.omit(["settings"],d)),{startPosition:null===(u=d.settings)||void 0===u?void 0:u.startPosition,styles:d.styles?Dd(d.styles):void 0}))};case"SlideStateTrigger":return{type:"SlideStateTrigger",node:(c=e.node,Object.assign(Object.assign({},c),{styles:c.styles?fd(c.styles):void 0}))};case"StackedDistribution":return{type:"StackedDistribution",node:(l=e.node,Object.assign(Object.assign({viewableItems:[]},l),{styles:l.styles?fd(l.styles):void 0}))};case"StaticLink":return{type:"StaticLink",node:Md(e.node)};case"ToggleButtonStateTrigger":return{type:"ToggleButtonStateTrigger",node:Kd(e.node)};case"CatalogResponseButton":return{type:"CatalogResponseButton",node:Bd(e.node)};case"CatalogStackedCollection":return{type:"CatalogStackedCollection",node:Wd(e.node)};case"RichText":return{type:"RichText",node:(s=e.node,Object.assign(Object.assign({},s),{styles:s.styles?pd(s.styles):void 0}))};case"DataImage":return{type:"DataImage",node:(r=e.node,Object.assign(Object.assign({},r),{styles:r.styles?pd(r.styles):void 0}))};case"StaticImage":return{type:"StaticImage",node:(o=e.node,Object.assign(Object.assign({},o),{styles:o.styles?pd(o.styles):void 0}))};case"DataIcon":return{type:"DataIcon",node:(a=e.node,Object.assign(Object.assign({},a),{styles:a.styles?pd(a.styles):void 0}))};case"StaticIcon":return{type:"StaticIcon",node:(n=e.node,Object.assign(Object.assign({},n),{styles:n.styles?pd(n.styles):void 0}))};case"BasicText":return{type:"BasicText",node:(t=e.node,Object.assign(Object.assign({},t),{styles:t.styles?pd(t.styles):void 0}))};default:return e}var t,n,a,o,r,s,l,c,d,u,p,f,y,m,h,v,g}function Zd(e){const t=e.split("."),n=Number(t[0]),a=Number(t[1]);if(t.length<2||Number.isNaN(n)||Number.isNaN(a))throw Error(`Fail to convert version ${e} to a valid version.`);return{major:n,minor:a}}function Qd(e,t){return e.major===t.major&&e.minor===t.minor}const Xd=(e,t,n)=>i.allPass([i.lte(e),i.gte(t)])(n);function eu(e,t){return Qd(t,{major:0,minor:0})?eu(ac(e),{major:0,minor:1}):function(e,t){return 0===t.major&&Xd(1,23,t.minor)}(0,t)?eu(zc(e),{major:1,minor:0}):e}function tu(e,t){return Qd(t,{major:0,minor:0})?tu(function(e){return Object.assign(Object.assign({},e),{layout:ac(e.layout)})}(e),{major:0,minor:1}):function(e,t){return 0===t.major&&Xd(1,23,t.minor)}(0,t)?tu(function(e){return Object.assign(Object.assign({},e),{layout:zc(e.layout)})}(e),{major:1,minor:0}):e}function nu(e,t,n,a){const i=Zd(n);if(a){const s=Zd(a);if(r=i,(o=s).major<r.major||o.major===r.major&&o.minor<r.minor||Qd(s,i))return t(e,s);throw Error(`Could not migrate received layout config, config schema version ${a} is higher than the supported version ${n}.`)}return t(e,Zd("0.0"));var o,r}function au(e){var t;try{return Object.assign(Object.assign({},i.clone(e)),{offer:Object.assign(Object.assign({},i.clone(e.offer)),{creative:zl(e.offer.creative)}),layoutVariant:Object.assign(Object.assign({},i.clone(e.layoutVariant)),{layoutVariantSchema:"string"==typeof e.layoutVariant.layoutVariantSchema?Hl(e.layoutVariant.layoutVariantSchema,"LayoutSlotLayoutVariant",e.instanceGuid):e.layoutVariant.layoutVariantSchema,childLayouts:i.map(iu,null!==(t=e.layoutVariant.childLayouts)&&void 0!==t?t:[])})})}catch(t){throw t.message?t:Vl("Slot",e.instanceGuid)}}function iu(e){return Object.assign(Object.assign({},i.clone(e)),{childLayoutSchema:"string"==typeof e.childLayoutSchema?Hl(e.childLayoutSchema,"ChildLayoutRootSchema",e.childLayoutId):e.childLayoutSchema})}function ou(e){if(e){const t=function(e){try{return Object.assign(Object.assign({},i.clone(e)),{outerLayoutSchema:"string"==typeof e.outerLayoutSchema?Hl(e.outerLayoutSchema,"LayoutRootLayoutSchema",e.instanceGuid):e.outerLayoutSchema,slots:i.map(au,e.slots)})}catch(t){throw t.message?t:Vl("LayoutConfig",e.instanceGuid)}}(e);return function(e,t){const{layoutSchemaVersion:n}=e,a=i.lensPath(["outerLayoutSchema"]),o=i.lensPath(["slots"]),r=i.lensPath(["layoutVariant","layoutVariantSchema"]);return i.pipe(i.over(o,i.map(i.over(r,(e=>nu(e,eu,t,n))))),i.over(a,(e=>nu(e,tu,t,n))))(e)}(t,jo.DCUI_SCHEMA_VERSION)}}const ru=i.cond([[i.where({signalType:i.equals("SignalSecondaryResponse")}),function*(e,t){return yield r.put({type:ao,payload:{level:To,code:Fo,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}],[i.where({isPositive:i.equals(!0)}),function*(e,t,n,a){var i,o;if("url"in e&&e.url){const s=e.instanceGuid;"SignalProductItemResponse"===e.signalType&&(W(o=a.payload)&&"catalogItemId"in o&&"productSku"in o&&"catalogId"in o&&"accountID"in o&&"string"==typeof o.catalogItemId&&"string"==typeof o.productSku&&"string"==typeof o.catalogId&&"string"==typeof o.accountID)?yield r.put({type:Z,payload:{name:"SignalProductItemResponse",parentGuid:s,objectData:{catalogItemId:a.payload.catalogItemId,productSku:a.payload.productSku,catalogId:a.payload.catalogId,accountId:a.payload.accountID}}}):yield r.put({type:Z,payload:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:s,responseActionPayload:{name:"Url",transformedTrafficURL:e.url,creativeInstanceGuid:e.creativeInstanceGuid}}});const l=t.getOverrideLinkNavigation()?"overrideLinkNavigation":null!==(i=e.urlBehavior)&&void 0!==i?i:"newTab",c=yield*function*(e,t,n){try{const a=yield r.call(xr,t),i=Or(a)?a.ref:void 0;return yield r.call(e.addAdvertiserWindowRef,i,n),Or(a)||"newTab"!==t.urlBehavior?"SUCCESS":(yield r.put({type:ao,payload:{level:To,code:Go,message:`Did not receive a window reference opening link ${t.url}`}}),"UNSPECIFIED")}catch(e){return yield r.put({type:ao,payload:{level:To,code:Go,message:`Errored attempting to open link ${t.url}: ${e.message}`,stack:e.stack}}),"ERROR"}}(t,{url:e.url,urlBehavior:l,external:{partner:n}},s);return"self"===l?"END":c}return yield r.put({type:ao,payload:{level:To,code:Fo,message:"URL response doesn't have a valid url",additionalInformation:{instanceGuid:e.instanceGuid}}}),"ERROR"}],[i.T,function*(){return"EXPLICIT_DISMISSAL"}]]);function*su(e){return yield r.put({type:ao,payload:{level:To,code:Fo,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}function*lu(e,t){let n="IMPLICIT_DISMISSAL";const a=t.payload.offerPositionIndex,i=W(t.payload)||K(t.payload)||H(t.payload)?t.payload:t.payload.responseOption;switch(i.action){case"Url":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:io,payload:{code:"CREATIVE_RESPONSE",message:"creative positive response",data:{type:i.action,isPositive:i.isPositive,responseInstanceGuid:i.instanceGuid}}}),yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*su(i):yield*ru(i,e.context,e.partner,t);break;case"CaptureOnly":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*su(i):yield*function*(e){return yield r.put({type:Z,payload:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:"CaptureOnly",creativeInstanceGuid:e.creativeInstanceGuid}}}),e.isPositive?"SUCCESS":"EXPLICIT_DISMISSAL"}(i);break;case"Fulfillment":yield r.put({type:ao,payload:{level:To,code:"INCORRECTLY_HANDLE_FULFILLMENT_ACTION",message:`Fulfillment action is incorrectly handled by the orchestrator instead of a module with the option ID: ${i.instanceGuid}`}}),n="ERROR";break;case"ExternalPaymentTrigger":yield r.put({type:ao,payload:{level:To,code:"INCORRECTLY_HANDLE_EXTERNAL_ACTION",message:`External action was dispatched as an engagement erroneously. Instance GUID: ${i.instanceGuid}`}}),n="ERROR"}Y(t.payload)||(yield r.put(function(e,t){switch(e){case"SUCCESS":return{type:hl,payload:{event:"Completed",completionReason:"Success",offerPositionIndex:t}};case"UNSPECIFIED":return{type:hl,payload:{event:"Completed",completionReason:"Unspecified",offerPositionIndex:t}};case"ERROR":return{type:hl,payload:{event:"Completed",completionReason:"Error",offerPositionIndex:t}};case"EXPLICIT_DISMISSAL":return{type:hl,payload:{event:"Dismissed",dismissalReason:"Explicit",offerPositionIndex:t}};case"IMPLICIT_DISMISSAL":return{type:hl,payload:{event:"Dismissed",dismissalReason:"Implicit",offerPositionIndex:t}};default:return{type:fl,payload:{offerProcessStatus:"END"}}}}(n,a)))}function cu(e,t,n,a){return l.eventChannel((i=>(a().then((e=>Promise.all([t.getRoktPageInstanceGuid(),(t.getUId||t.getPluginInstanceId)()]).then((([t,n])=>Object.assign(Object.assign({},e),{pageInstanceGuid:t,pluginInstanceId:n}))).catch((()=>e)))).then((({moduleConnectorBuilder:t,pageInstanceGuid:a,pluginInstanceId:o})=>{const r=`rokt-${n}-${o}`.toLowerCase();if(!customElements.get(r)){const o=t.withGatewayFactory(e).withLogger((e=>{i({type:ao,payload:{level:e.level,code:e.code,message:e.message,additionalInformation:Object.assign(Object.assign({},e.additionalInformation),{moduleName:n,layoutType:"LayoutVariant",pageInstanceGuid:null!=a?a:"N/A"})}})})).build();customElements.define(r,o)}})).catch((e=>{const t=e&&"object"==typeof e&&"message"in e?e.message:void 0,a=e&&"object"==typeof e&&"stack"in e?e.stack:void 0;i({type:ao,payload:{level:j,code:"FAILED_TO_LOAD_MODULE",message:t,additionalInformation:{stack:a,reason:t?void 0:e,moduleName:n}}}),i(l.END)})),()=>{})))}const du={"standard-marketing":()=>Promise.resolve().then((function(){return gp})),"add-to-cart":()=>Promise.resolve().then((function(){return Of})),"instant-purchase":()=>Promise.resolve().then((function(){return Fy})),"layouts-xp-sandbox":()=>Promise.resolve().then((function(){return hm}))};function*uu(e,t,n){let a=yield r.select((e=>e.module.loadedModules));for(const i of n.payload.modules)a&&!(null==a?void 0:a.includes(i))&&(a=[...a,i],yield r.fork(pu,e,t,i))}function*pu(e,t,n){if(n in du){yield r.put({type:sl,payload:n});const a=yield r.call(cu,e,t,n,du[n]);yield r.call(Po,a)}else yield r.put({type:ao,payload:{level:wo,code:"INVALID_MODULE_NAME",message:`Could not load unknown module ${n}`}})}function*fu(e){const t=yield r.select((e=>Xl.getDistributionViewableItems(e.layout?Xl.getDistribution(e.layout.layoutSchema):void 0))),n=yield r.select((n=>{var a;const i=ar(e.payload.activeBreakpoint)(n);return i>=0&&t?null!==(a=t[Math.min(t.length-1,i)])&&void 0!==a?a:1:void 0}));if("number"==typeof n){const e={type:pl,payload:{groupSize:n}};yield r.put(e)}}const yu=i.cond([[(e,t,n,a)=>"END"===e.offerProcessStatus,i.always({type:Ki})],[(e,t,n,a)=>t.isLastOffer&&n,i.always({type:Ki})],[(e,t,n,a)=>1===a&&!t.isLastOffer,i.always({type:dl})],[i.T,i.always(void 0)]]);function*mu(e){const t=yield r.select((e=>({exists:null!==e.progression,isLastOffer:Al(e)}))),n=yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.groupSize}));var a;null!=(a=t)&&a instanceof Object&&"exists"in a&&"isLastOffer"in a&&t.exists&&(yield*function*(e,t,n){const a=yield r.select((e=>e.settings.closeOnComplete)),i=yu(e,t,"boolean"==typeof a&&a,n);i&&(i.type===Ki&&(yield r.put({type:ee,payload:{name:"PLACEMENT_COMPLETED"}})),yield r.put(i))}(e.payload,t,n))}function hu(e){return e.type===hl&&"Interactive"===e.payload.event}function vu(e){return e.type===hl&&"Interactive"!==e.payload.event}function*gu(e){switch(e.payload.event){case"Dismissed":yield r.put({type:fl,payload:{offerProcessStatus:"CONTINUE"}});break;case"Completed":yield r.put({type:vl,payload:{key:"offerComplete",value:i.cond([[i.equals("Error"),i.always(-1)],[i.equals("Success"),i.always(1)],[i.T,i.always(2)]])(e.payload.completionReason),offerPositionIndex:e.payload.offerPositionIndex}}),yield r.put({type:fl,payload:{offerProcessStatus:"CONTINUE"}});break;case"Interactive":yield r.put({type:V,payload:{name:"Interactive",offerPositionIndex:e.payload.offerPositionIndex}}),yield r.put({type:ee,payload:{name:"PLACEMENT_INTERACTIVE"}})}}function*bu(e,t){var n;try{const n=yield r.select((e=>{var t,n,a;return null!==(a=null===(n=null===(t=e.layout)||void 0===t?void 0:t.settings)||void 0===n?void 0:n.enablePartnerValidation)&&void 0!==a&&a}));n&&(yield r.call(e.partner.send,hr.PartnerValidationEvent.SET_PARTNER_VALIDATION_STATUS,{errors:t.payload.errors}))}catch(a){const i=yield r.select((({slots:e})=>{var n,a;return"number"==typeof t.payload.offerPositionIndex?null!==(a=null===(n=e.at(t.payload.offerPositionIndex))||void 0===n?void 0:n.layoutVariant.moduleName)&&void 0!==a?a:"Unknown":"orchestrator"})),o=null!==(n=yield r.call(e.context.getRoktPageInstanceGuid))&&void 0!==n?n:"N/A",s={type:ao,payload:{level:R,code:"PARTNER_VALIDATION_UPDATE_FAILED",message:"Failed to update the partner with error status",additionalInformation:{moduleName:i,layoutType:"number"==typeof t.payload.offerPositionIndex?"LayoutVariant":"OuterLayout",pageInstanceGuid:o}}};yield r.put(s)}}function*Iu(e){const t=yield r.select((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid}));yield r.put({type:Il.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Ki}),t?(yield r.put({type:Z,payload:{name:"SignalInstantPurchaseDismissal",parentGuid:t}}),yield r.put({type:Z,payload:{name:"SignalDismissal",parentGuid:t}})):yield r.put({type:ao,payload:{level:Oo,code:Mo,message:"ParentGuid does not exist"}})}function*Eu(e,t){yield r.all([r.takeEvery(ao,$o.bind(null,e.errorService.raise)),r.takeLatest(Wi,tc.bind(null,{display:e.displayService,partner:e.partnerInteractionService})),r.takeEvery(ll,uu.bind(null,t,e.contextService)),r.takeLatest(gl,lu.bind(null,{partner:e.partnerInteractionService,context:e.contextService})),r.takeEvery(fl,mu),r.takeEvery(vu,gu),_o(hu,gu),r.takeLatest(zi,dr.bind(null,e.displayService)),r.takeLatest(Ki,Lr.bind(null,e.contextService)),r.takeLatest(ml,Iu),r.takeLatest(no,is),r.takeEvery(Z,Gr),r.takeEvery(ne,Mr),ko(V,ns.bind(null,e.metricsService)),ko(to,Br.bind(null,e.rdnService)),r.takeEvery(io,Fr.bind(null,e.errorService.raise)),r.takeLatest(Ui,fu),r.takeEvery(X,ts),r.takeEvery(ae,as.bind(null,{createChildPlugin:e.childPlugin.create,partner:e.partnerInteractionService,context:e.contextService})),r.takeLatest(ie,bu.bind(null,{partner:e.partnerInteractionService,context:e.contextService}))])}var xu,Su,Cu,wu,Ou,Tu=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},Au=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)};const ju={[se.SET_CUSTOM_STATE]:Il.SET_CUSTOM_STATE,[se.SET_DOMAIN_STATE]:Il.SET_DOMAIN_STATE,[se.SET_GLOBAL_OFFER_DATA_CART]:Il.SET_GLOBAL_OFFER_DATA_CART,[se.OFFER_LIFECYCLE]:El.OFFER_LIFECYCLE,[se.OFFER_ENGAGEMENT]:El.OFFER_ENGAGEMENT,[se.SET_PARTNER_VALIDATION_STATUS]:El.SET_PARTNER_VALIDATION_STATUS};class Ru{constructor(e){xu.add(this),Su.set(this,void 0),Tu(this,Su,e,"f")}getState(e){const t=Au(this,Su,"f").getState();return{breakpoint:t.breakpoint,progression:jl(t),customStates:or(t,e.offerPositionIndex),domainStates:Rl(t,e.offerPositionIndex)}}dispatch(e,t){Au(this,Su,"f").dispatch(Au(this,xu,"m",Ou).call(this,e,t))}subscribe(e,t){return t(this.getState(e)),Au(this,Su,"f").subscribe((()=>{t(this.getState(e))}))}}function Nu(e,t){const n=l(),a={},i=s.configureStore({reducer:Ol,devTools:{name:"Orchestrator"},preloadedState:Object.assign(Object.assign({},Tl()),t),middleware:e=>{return e({thunk:!1,serializableCheck:!1}).concat((t=a,e=>e=>n=>{if("object"==typeof n&&null!==n&&"type"in n){const a=n.type,i=t[`${a}`];return e(i?i(n):n)}return e(n)}),n);var t}}),o=(r=function(e){return new Ru(e)}(i),c=e.childPlugin.create,d=e.partnerInteractionService.onEvent,(e,t)=>new yn(r,c,e,t,d));var r,c,d;n.run(Eu,e,o),n.run(Pr,e,ou);const u={};return Object.assign(Object.assign({},i),{extend:({reducer:e,interceptors:t,sagas:o})=>{e&&(Object.assign(u,e),i.replaceReducer(s.combineReducers(Object.assign(Object.assign({},Ol),u)))),t&&Object.assign(a,t),o&&n.run(o)}})}Su=new WeakMap,xu=new WeakSet,Cu=function(e,t,n){return{type:e,payload:Object.assign(Object.assign({},t),{offerPositionIndex:n.offerPositionIndex,creativeInstanceGuid:n.creativeInstanceGuid})}},wu=function(e,t){return t.type===ne?t.payload.signal.parentGuid||(t.payload.signal.parentGuid=e.creativeInstanceGuid):(t.payload.creativeInstanceGuid=e.creativeInstanceGuid,t.payload.parentGuid||(t.payload.parentGuid=e.creativeInstanceGuid)),t},Ou=function(e,t){return function(e){return e.type in ju}(t)?Au(this,xu,"m",Cu).call(this,ju[t.type],t.payload,e):t.type===Z||t.type===ne?Au(this,xu,"m",wu).call(this,e,t):t};var Lu=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())}))};const Du={ctx:new Map([[Qs.name,Qs],[Ws.name,Ws],[js.name,js],[Fs.name,Fs],[Ys.name,Ys],[rl.name,rl]]),cache:[]};class ku{constructor(){this._subscribers=[]}add(e){this._subscribers.push(e)}unsubscribe(){this._subscribers.forEach((e=>e.unsubscribe()))}}const _u=()=>{},Pu=(e=_u,t=_u,n=_u)=>"function"!=typeof e?e:{next:e,error:t,complete:n};class $u{constructor(e){this._setupFn=e}subscribe(e,t,n){const a=Pu(e,t,n);let i,o=!0;const r={next:e=>{o&&a.next(e)},complete:()=>{o&&(i&&i(),a.complete(),o=!1)},error:e=>{o&&(a.error(e),o=!1)}};i=this._setupFn(r),o||i&&i();const s=new ku;return s.add({unsubscribe:()=>{i&&i(),o=!1}}),s}}class Fu extends $u{constructor(){super((e=>(this._isComplete&&e.complete(),this._observers.push(e),()=>this._observers=this._observers.filter((t=>t!==e))))),this._observers=[],this._isComplete=!1}next(e){for(const t of this._observers)t.next(e)}error(e){for(const t of this._observers)t.error(e)}complete(){this._isComplete=!0;for(const e of this._observers)e.complete()}asObservable(){return new $u((e=>{const t=this.subscribe(e);return()=>t.unsubscribe()}))}}const Gu={CompletedBeforeEmit:"CompletedBeforeEmit"};var Mu=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())}))};class Bu{constructor(e,t){this._target=e,this._handler=t}subscribe(e,t,n){const a=e.next?e.next.bind(e):e,i={next:(...e)=>Mu(this,void 0,void 0,(function*(){try{yield a(...e)}catch(e){this._handler(e)}})),error:e.error?e.error.bind(e):t,complete:e.complete?e.complete.bind(e):n};return this._target.subscribe(i)}}class Uu{constructor(e){this.value=e,this.complete=!1,this.skip=!1}}var Vu=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())}))};const zu={getBreakpointCSSClass:B},qu="CHILD_LAYOUTS/ADD_LAUNCHED",Hu="DYNAMIC_DATA/ADD";function Wu(e={launched:{}},t){if(t.type===qu){const n=t.payload;return n.childLayoutId?i.assocPath(["launched",n.childLayoutId],n.shouldRelaunch,e):e}return e}function Ku(e=null,t){return e}function Yu(e=null,t){if(t.type===Hu){const n=t.payload;return e?n?i.mergeDeepRight(e,n):e:n}return e}function Ju(e,t){var n;return null===(n=e.childLayouts.launched[t])||void 0===n||n}function Zu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer}function Qu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.schemaVersion}const Xu=Object.freeze({});function ep(e){var t;return(null===(t=e.dynamicData)||void 0===t?void 0:t.text)?e.dynamicData.text:Xu}const tp="FAILED_TO_LAUNCH_CHILD_LAYOUT";function*np(e,t,n){var a;if(yield null===(a=r.select(Ju,n.payload.childLayoutId))||void 0===a||a){const a=yield r.select(Qu),o=yield r.select(Zu),s=yield r.select(ep);try{const l=(i=function(e,t,n,a){return{instanceGuid:e.instanceGuid,childLayoutId:e.childLayoutId,childLayoutSchema:e.childLayoutSchema,offer:t,layoutSchemaVersion:n,content:{text:a}}}(n.payload,o,a,s),JSON.parse(JSON.stringify(i)));try{yield r.call(e.createChildPlugin,{name:"dcui-child",config:l,targetElementSelector:n.payload.targetElementSelector})}catch(e){yield r.call(t,{level:R,code:tp,message:"Could not launch child layout, failed creating plugin."})}}catch(e){yield r.call(t,{level:R,code:tp,message:"Could not launch child layout, failed to make the child layout config serializable."})}yield r.put({type:qu,payload:{childLayoutId:n.payload.childLayoutId,shouldRelaunch:!1}})}var i}const ap={cursor:"pointer",paddingInline:0,paddingBlock:0};function ip(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function op(t){var n;const a=bt(),i=Ct(),o=t.schema.response_key||"positive",r=Un(),s=Rt(),l=Nn(),{tabIndex:c,styles:d,isDisabled:u}=h(l),p=null===(n=r.responseOptionsMap)||void 0===n?void 0:n[o];return p&&e.jsx(Na,{styles:t.schema.styles,children:({classnames:n})=>e.jsx("button",{type:"button",tabIndex:c,"aria-disabled":u,disabled:u,style:Object.assign(Object.assign({},ap),d),"data-testid":t.testId,"data-e2e":"CatalogItemResponse-standard-marketing",onClick:e=>{e.preventDefault();const t=function(e,t,n){var a,i;return Object.assign(Object.assign({},t),{accountID:e.accountId,creativeInstanceGuid:e.creative.instanceGuid,referralCreativeID:e.creative.referralCreativeId,catalogItemId:n.catalogItemId,productSku:n.productSku||(null===(a=n.copy)||void 0===a?void 0:a["provider.productSku"])||"",catalogId:n.catalogId||(null===(i=n.copy)||void 0===i?void 0:i["provider.catalogId"])||""})}(s,p,r);a({type:z,payload:t})},className:null==n?void 0:n.own,children:ip(t.schema.children,i,t.testId)})})}const rp={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(op,{schema:t.node,testId:n})}};function sp(){const t=jn(),n=a.useSelector(ep),i=Zt(),o=Ct(),r=i({state:n},"textContent");return e.jsx(Jt,{value:r,children:e.jsx(wt,{value:o,overrides:rp,children:e.jsx(St,{children:e=>e(t)})})})}const lp={staticData:Ku,dynamicData:Yu,childLayouts:Wu};function cp(e={}){return Object.assign({staticData:null,dynamicData:null,childLayouts:{launched:{}}},e)}function dp(e){let t,n,a;return l.eventChannel((i=>(Promise.race([e.onClose().then((()=>"CLOSED")),new Promise((n=>{t=e.onEvent("PLUGIN_TRANSITION_OFFER_SUCCESS").subscribe((()=>{n("SUCCESS")}))})),new Promise((t=>{n=e.onEvent("PLUGIN_TRANSITION_OFFER_CLOSE").subscribe((()=>{t("UNSPECIFIED")}))})),new Promise((e=>{a=e}))]).then((e=>{"END"!==e&&(i(e),i(l.END))})),()=>{null==t||t.unsubscribe(),null==n||n.unsubscribe(),a("END")})))}function up(e){return"object"==typeof e&&null!==e&&Object.entries(e).every((([e,t])=>"string"==typeof e&&"string"==typeof t))}function*pp(e,t,n,a,i){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Q,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":if((n||a)&&i){yield r.call(i);break}t({type:Q,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Q,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*fp(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n,o=Y(n),s=J(n);yield r.put({type:Z,payload:{name:"SignalResponse",parentGuid:a.instanceGuid,responseActionPayload:{name:"Fulfillment"}}});const l=yield r.call(e.createChildPlugin.bind(e),i);if("object"==typeof l&&"onClose"in l&&"close"in l){const a=yield r.call(dp,l);if("object"==typeof a&&"take"in a){const i=function(e,t,n,a){if(n.responseOption.rclid)return function*(){yield r.put({type:ee,payload:{name:"REALTIME_OFFER_FULFILLMENT_CONVERSION",body:{rclid:n.responseOption.rclid,accountID:n.accountID,referralCreativeID:n.referralCreativeID}}}),yield r.call(yp,e,t,a)}}(e,t,n,l);return void(yield r.call(pp,a,e.globalDispatch.bind(e),o,s,i))}}yield r.call(t,{level:j,code:"UNEXPECTED_NEXT_VALUE_IN_SAGA",message:'Received an unexpected input at a step in the saga "handleFullfillmentResponse" and could not continue.'})}else yield r.call(t,{level:j,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}function*yp(e,t,n){const a=function(e){return l.eventChannel((t=>{const n=e.onEvent({name:gr,source:"partner",callback:e=>{up(e)&&t({eventName:gr,data:e})}},{name:br,source:"partner",callback:e=>{up(e)&&t({eventName:br,data:e})}});return()=>{n()}}))}(e);try{for(;;){const i=yield r.take(a);switch(i.eventName){case gr:yield r.put({type:ee,payload:{name:gr,body:i.data}}),yield r.put({type:Hu,payload:{text:i.data}}),e.globalDispatch({type:Q,payload:{event:"Completed",completionReason:"Success"}}),n&&(yield r.call(n.close.bind(n)));break;case br:e.globalDispatch({type:Q,payload:{event:"Completed",completionReason:"Error"}}),n&&(yield r.call(n.close.bind(n)));break;default:t({level:j,code:"UNKNOWN_REALTIME_OFFER_FULFILLMENT_EVENT",message:`Unknown event: ${i.eventName}`})}}}catch(e){const n=e;t({level:R,code:"FAILED_TO_PROCESS_REALTIME_OFFER_FULFILLMENT_EVENT",message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&a.close()}}function*mp(e,t,n){const a=W(n.payload)||K(n.payload)||H(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":yield r.call(e.globalDispatch.bind(e),n),(Y(n.payload)||J(n.payload))&&(yield r.put({type:ee,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:a.accountID,referralCreativeID:a.referralCreativeID,referralOnly:J(n.payload)}}}),Y(n.payload)&&(yield r.call(yp,e,t)));break;case"CaptureOnly":yield r.call(e.globalDispatch.bind(e),n);break;case"Fulfillment":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),J(n.payload)&&(yield r.put({type:ee,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:n.payload.accountID,referralCreativeID:n.payload.referralCreativeID,referralOnly:!0}}})),yield*fp(e,t,n.payload)}}function*hp(e,t){yield r.all([r.takeLatest(z,mp.bind(null,e,t)),r.takeEvery(re,np.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}Object.assign({},se);const vp=(new Cn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=cp({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=cp()){const a=l(),i=s.configureStore({reducer:lp,devTools:{name:"Standard Marketing"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(hp,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Gn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(_i,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Di,{settings:i,dispatch:d.dispatch,children:e.jsx(sp,{})})})]})}))}}));var gp=Object.freeze({__proto__:null,moduleConnectorBuilder:vp});const bp="CART/UPDATE",Ip="CATALOG_ITEM/RESPONSE",Ep="USER_CREATIVE_RESPONSE_HISTORY/ADD",xp=i.cond([[(e,t)=>0!==t,i.equals],[(e,t)=>!Number.isNaN(e)&&0===t,i.equals],[(e,t)=>Number.isNaN(e)&&0===t,i.F]]);function Sp({isChecked:t,isDisabled:n,outerClassname:a,outerCheckedClassname:i,innerClassname:o,innerCheckedClassname:r}){return e.jsx("span",{style:{display:"flex"},children:e.jsx("span",{className:`${a} ${t?i:""}`,tabIndex:n?-1:1,style:{display:"flex",boxSizing:"border-box"},children:e.jsx("span",{className:`${o} ${t?r:""}`,style:{flex:1}})})})}const Cp="catalogRadioGroup__label",wp=["Enter","Space"],Op={elements:{own:[],optionContainer:[],radioButtonInner:[{default:{border:{borderRadius:11},background:{backgroundColor:{light:"#FFF"}}}}],radioButtonInnerChecked:[{default:{background:{backgroundColor:{light:"#529ff4"}}}}],radioButtonOuter:[{default:{border:{borderRadius:16,borderColor:{light:"#999"},borderStyle:"solid",borderWidth:"1"},dimension:{width:{type:"fixed",value:16},height:{type:"fixed",value:16}},spacing:{padding:"4"}}}],radioButtonOuterChecked:[]}};function Tp(e,t,n){return e.map(i.cond([[i.compose(i.equals("Required"),i.propOr("","type")),({value:e})=>Number.isNaN(n)&&t>0?e.message:""],[i.T,i.always("")]])).filter(i.isNotEmpty)}function Ap({schema:n,testId:i}){var o;const r=a.useDispatch(),s=Un(),l=null!==(o=a.useSelector((e=>{var t,n;return s.cartItemId in e.cart?null!==(n=null===(t=e.cart[s.cartItemId])||void 0===t?void 0:t.quantity)&&void 0!==n?n:0:void 0})))&&void 0!==o?o:NaN,c=t.useMemo((()=>Tp(n.validations,n.options.length,l)),[n.validations,n.options.length,l]),d=Nn(),{tabIndex:u,styles:p,isDisabled:f}=h(d);t.useEffect((()=>{f||r(jp(c))}),[]);const y=n.options.filter((({quantity:e})=>{var t,n;return e>=(null!==(t=s.minItemCount)&&void 0!==t?t:-1/0)&&e<=(null!==(n=s.maxItemCount)&&void 0!==n?n:1/0)}));function m(e){r({type:Ip,payload:{catalogItem:s,quantity:e}});const t=Tp(n.validations,n.options.length,e);r(jp(t))}return y.length>0?e.jsx(Na,{styles:n.styles?M(Op,n.styles):Op,children:({classnames:n,mapperRef:a})=>e.jsx("div",{className:null==n?void 0:n.own,style:Object.assign({display:"flex",flexDirection:"column"},p),children:e.jsx(Xt,{value:a(Cp),children:t.Children.toArray(y.map(((t,a)=>{var o;const r=xp(l,t.quantity),c=e=>i?`${i}-option${a}${e}`:void 0;return e.jsxs("label",{tabIndex:u,"aria-disabled":f,style:{display:"flex"},className:`${Cp} ${null!==(o=null==n?void 0:n.optionContainer)&&void 0!==o?o:""}`,onKeyDown:e=>{r||!wp.includes(e.code)||f||m(t.quantity)},"data-e2e":"CatalogRadioGroup-Option","data-e2e-quantity":`${t.quantity}`,"data-testid":c("Label"),children:[e.jsx("input",{type:"radio",style:{display:"none"},tabIndex:-1,name:s.instanceGuid,value:t.quantity,checked:r,onChange:()=>m(t.quantity),"aria-disabled":f,disabled:f}),e.jsx(Sp,{isChecked:r,isDisabled:f,innerClassname:null==n?void 0:n.radioButtonInner,innerCheckedClassname:null==n?void 0:n.radioButtonInnerChecked,outerClassname:null==n?void 0:n.radioButtonOuter,outerCheckedClassname:null==n?void 0:n.radioButtonOuterChecked}),e.jsx(Gi,{schema:t,testId:c("Content")})]})})))})})}):null}function jp(e){return{type:ie,payload:{errors:e}}}function Rp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Np(t){const n=a.useDispatch(),i=Ct(),o=Un(),r=Nn(),{tabIndex:s,styles:l,isDisabled:c}=h(r);return e.jsx(Na,{styles:t.schema.styles,children:({classnames:a})=>e.jsx("button",{type:"button",tabIndex:s,"aria-disabled":c,disabled:c,style:Object.assign({cursor:"pointer"},l),"data-testid":t.testId,"data-e2e":"CatalogItemResponse",onClick:e=>{e.preventDefault();n({type:Ip,payload:{catalogItem:o,quantity:1}})},className:null==a?void 0:a.own,children:Rp(t.schema.children,i,t.testId)})})}const Lp={allowedTags:["em","strong","a","br","u","p","li","ul","ol","span"],allowedAttributes:{a:["href","target"],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],span:[]},allowedSchemes:["http","https"]},Dp=new Map([["&","_;^;_"]]),kp=new RegExp(`<a *(?=${Lp.allowedAttributes.a.join("|")}|>)`,"g"),_p=new RegExp(`<a *(?:(?:${Lp.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),Pp=new RegExp("(<br *?>)|(<br *?/>)","g"),$p=new RegExp(`<ul *(?=${Lp.allowedAttributes.ul.join("|")}|>)`,"g"),Fp=new RegExp(`<ol *(?=${Lp.allowedAttributes.ol.join("|")}|>)`,"g"),Gp=new RegExp("<li *(?=>|\\s[^>]*>)","g"),Mp="<br/>";function Bp(n){const a=Zt(),i=Nn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(_p,((e,t)=>{const n=t.replaceAll("&",Dp.get("&"));return e.replace(t,n)})).replaceAll(Pp,Mp)}(e);return t===u(t,Lp)}(e))throw new N("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=h(i);return o?e.jsx(Na,{styles:n.schema.styles,children:({classnames:t})=>{const a=[(null==t?void 0:t.link)?`class="${null==t?void 0:t.link}"`:"",l?'tabindex="-1"':"",l?"style=\"pointer-events: 'none'; user-select: none;\"":"",l?'aria-disabled="true"':""].filter((e=>e.length>0)),i=((null==t?void 0:t.list)?`class="${t.list}"`:"")+' style="list-style-type: none; padding-inline-start: 0px; display: flex; flex-direction: column;"',c=((null==t?void 0:t.listItem)?`class="${t.listItem}"`:"")+' style="display: flex; align-items: flex-start; flex-shrink: 0; flex-grow: 1;"',d=`class="rokt-icon${(null==t?void 0:t.span)?" "+t.span:""}" style="display: inline-block; pointer-events: none; user-select: none;" aria-disabled="true"`,u=o.replace(kp,`<a ${a.join(" ")}`).replace($p,`<ul ${i}`).replace(Fp,`<ol ${i}`).replace(Gp,`<li ${c}><span ${d}>Check</span`);return p=o,new RegExp("</(p|ul|ol)>").test(p)?e.jsx("div",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:u}}):e.jsx("p",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:u}});var p}}):null}const Up={internally:"_top",externally:"_blank"};function Vp(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:zp(t,i,o)})}function zp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function qp(t){var n,i;const o=Up[t.schema.open],r=Ct(),s=Un(),l=Nn(),c=a.useDispatch(),d=null!==(n=s.url)&&void 0!==n?n:"",{tabIndex:u,styles:p,isDisabled:f}=h(l);return Boolean(d)&&(null===(i=t.schema.children)||void 0===i?void 0:i.length)>0?e.jsx(Na,{styles:t.schema.styles,children:({classnames:n,mapperRef:a})=>{var i;return e.jsx("a",{href:d,onClick:()=>{var e;c({type:Z,payload:{name:"SignalResponse",parentGuid:null!==(e=s.instanceGuid)&&void 0!==e?e:"",responseActionPayload:{name:"Url",transformedTrafficURL:d}}})},"data-testid":t.testId,"data-e2e":"CatalogUrlLink",target:null!=o?o:"_blank",tabIndex:u,"aria-disabled":f,"aria-label":null!==(i=t.schema.a11yLabel)&&void 0!==i?i:void 0,style:Object.assign({cursor:"pointer",textDecoration:"none",display:"block"},p),className:null==n?void 0:n.own,children:(null==n?void 0:n.own)?Vp(t.schema.children,null==n?void 0:n.own,a,r,t.testId):zp(t.schema.children,r,t.testId)})}}):null}function Hp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Wp(t){const n=Ct(),a=Un(),i=Nn(),{tabIndex:o,styles:r,isDisabled:s}=h(i),l=No(a,1),c=bt();return e.jsx(Na,{styles:t.schema.styles,children:({classnames:i})=>e.jsx("button",{type:"button",tabIndex:o,"aria-disabled":s,disabled:s,style:Object.assign({cursor:"pointer"},r),"data-testid":t.testId,"data-e2e":"CatalogPartnerEventButton",onClick:()=>{s||(c({type:Z,payload:{name:"SignalCartItemQuantitySelected",parentGuid:a.instanceGuid,objectData:{quantity:1,preselected:!1}}}),c({type:ee,payload:{name:"V2_CART_ITEM_UPDATED",body:{oldCartItem:null,cartItem:l}}}))},className:null==i?void 0:i.own,children:Hp(t.schema.children,n,t.testId)})})}function Kp(e,t){const n=e.cart[t];return n||null}function Yp(e){var t,n;const a=null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[],i=function(e){return Object.values(e.cart).filter((e=>null!==e))}(e);return i.filter((e=>a.find((t=>t.catalogItemId===e.catalogItemId))))}function Jp(e,t){var n,a,i,o;const r=null===(n=e.staticData)||void 0===n?void 0:n.offer;if(r){const n=function(e){return Yp(e).reduce(((e,t)=>e+t.quantity),0)}(e),s=Kp(e,t.cartItemId),l=(null!==(a=null==r?void 0:r.maxTotalItemsQtyInOffer)&&void 0!==a?a:1/0)-n,c=(null!==(i=t.maxItemCount)&&void 0!==i?i:1/0)-(null!==(o=null==s?void 0:s.quantity)&&void 0!==o?o:0);return Math.min(l,c)}return 0}const Zp={is:i.equals,"is-not":i.compose(i.not,i.equals),"is-below":i.lt,"is-above":i.gt};function Qp({schema:n,testId:o}){const{children:r,predicates:s}=n,l=Zt()(n.cartItemId),c=a.useSelector((e=>{var t;return(null===(t=Kp(e,l))||void 0===t?void 0:t.quantity)||0}));return(()=>{const e=s.map((e=>(0,Zp[e.condition])(c,e.value)));return i.all(i.equals(!0),e)})()?e.jsx(St,{children:e=>t.Children.toArray(r.map(((t,n)=>e(t,void 0,o?`${o}-child-${n}`:`when-catalog-quantity-child-${n}`))))}):null}function Xp(e){var t,n;const a=null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[];return a.length>0?a:null}function ef(e,t){var n,a;return null!==(a=null===(n=Xp(e))||void 0===n?void 0:n.find((e=>e.catalogItemId===t)))&&void 0!==a?a:null}function tf(e){var t;const n=null===(t=Xp(e))||void 0===t?void 0:t.filter((e=>e.preSelectedQuantity&&e.preSelectedQuantity>0));return n&&n.length>0?n:null}function nf(e){var t,n;return null!==(n=null===(t=tf(e))||void 0===t?void 0:t.reduce(((e,t)=>{var n;return e+(null!==(n=t.preSelectedQuantity)&&void 0!==n?n:0)}),0))&&void 0!==n?n:0}const af=i.compose((e=>e.filter((e=>!i.isNil(e[1]))).map((([e,t])=>({cartItemId:t.cartItemId,quantity:t.quantity})))),i.toPairs,i.prop("cart"));function of(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:i(t,void 0,o)})}function rf(e,t,n){return t(e,void 0,n)}function sf(t){var n;const{schema:i,testId:o}=t,{a11yInputLabel:r,styles:s,showInputField:l,buttons:c,forcedUpsellText:d}=i,{increment:u,decrement:p,a11yIncrementLabel:f,a11yDecrementLabel:y}=c||{},m=a.useDispatch(),v=Un(),g=Ct(),b=Zt(),I=Nn(),{tabIndex:E,styles:x,isDisabled:S}=h(I),C=a.useSelector((e=>function(e,t){var n,a,i;const o=ef(e,t);return Boolean(o&&(null!==(n=o.preSelectedQuantity)&&void 0!==n?n:0)>0&&o.preSelectedQuantity===(null!==(a=o.minItemCount)&&void 0!==a?a:0)&&o.preSelectedQuantity===(null!==(i=o.maxItemCount)&&void 0!==i?i:0))}(e,v.catalogItemId))),w=a.useSelector((e=>Kp(e,v.cartItemId))),O=a.useSelector((e=>Jp(e,v))),T=(null==w?void 0:w.quantity)||0,A=h(S||T<=(null!==(n=v.minItemCount)&&void 0!==n?n:0)?"DISABLED":I),j=h(S||O<=0?"DISABLED":I),R=h(S||C?"DISABLED":I),N=e=>{var t;const n=e.target.value;if(0===n.length)L(null!==(t=v.minItemCount)&&void 0!==t?t:0);else{const e=Number(n);!Number.isNaN(e)&&e>=0&&L(e)}},L=e=>{S||m({type:Ip,payload:{catalogItem:v,quantity:e}})};return e.jsx(Na,{styles:s,children:({classnames:t,mapperRef:n})=>e.jsx("div",{className:null==t?void 0:t.own,style:Object.assign({display:"flex",flexDirection:"row"},x),children:C&&d?e.jsx(Ba,{schema:d,isInline:!1,testId:o?`${o}-forced-upsell-text`:void 0}):e.jsxs(e.Fragment,{children:[p?e.jsx("button",{className:null==t?void 0:t.decrementButton,style:Object.assign(Object.assign({},A.styles),{cursor:A.isDisabled?"not-allowed":"pointer",pointerEvents:"auto"}),onClick:e=>{e.preventDefault(),L(T-1)},tabIndex:A.tabIndex,"aria-label":y||void 0,disabled:A.isDisabled,"data-testid":o?`${o}-decrement-button`:void 0,children:e.jsx(Jt,{value:b,children:(null==t?void 0:t.decrementButton)?of(p,t.decrementButton,n,g,o):rf(p,g,o)})}):null,l?e.jsx("input",{type:"text",className:null==t?void 0:t.input,style:Object.assign(Object.assign({},R),{cursor:R.isDisabled?"not-allowed":"auto",caretColor:R.isDisabled?"transparent":"auto",pointerEvents:"auto",outline:"none"}),value:T,onChange:N,"aria-label":r||void 0,tabIndex:E,disabled:S,"data-testid":o?`${o}-input`:void 0}):e.jsx("p",{className:null==t?void 0:t.input,style:x,"data-testid":o?`${o}-quantity-text`:void 0,children:T}),u?e.jsx("button",{className:null==t?void 0:t.incrementButton,style:Object.assign(Object.assign({},j.styles),{cursor:j.isDisabled?"not-allowed":"pointer",pointerEvents:"auto"}),onClick:e=>{e.preventDefault(),L(T+1)},tabIndex:j.tabIndex,"aria-label":f||void 0,disabled:j.isDisabled,"data-testid":o?`${o}-increment-button`:void 0,children:e.jsx(Jt,{value:b,children:(null==t?void 0:t.incrementButton)?of(u,t.incrementButton,n,g,o):rf(u,g,o)})}):null]})})})}const lf={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(Np,{schema:t.node,testId:n})},EscapeHatch:function(t){if("EscapeHatch"===t.type&&t.node.data){const n=JSON.parse(t.node.data);switch(null==n?void 0:n.type){case"InsuranceRichText":return e.jsx(Bp,{schema:n.node});case"CatalogUrlLink":return e.jsx(qp,{schema:n.node});case"CatalogPartnerEventButton":return e.jsx(Wp,{schema:n.node});case"WhenCatalogQuantity":return e.jsx(Qp,{schema:n.node});default:return}}},CatalogRadioGroup:function(t){if("CatalogRadioGroup"===t.type)return e.jsx(Ap,{schema:t.node})},CatalogQuantityCounter:function(t){if("CatalogQuantityCounter"===t.type)return e.jsx(sf,{schema:t.node})}};function cf(){const t=jn(),n=Ct();return e.jsx(wt,{value:n,overrides:lf,children:e.jsx(St,{children:e=>e(t)})})}function df(e){return e.reduce(((e,t)=>(e[t.cartItemId]=function(e={}){return Object.assign({cartItemId:"cartItemId",catalogItemId:"catalogItemId",name:"Catalog Title",description:"This is a catalog item",unitPrice:10,totalPrice:10,quantity:1,currency:"USD",linkedProductId:void 0,quantityMustBeSynchronized:void 0,providerData:""},e)}({cartItemId:t.cartItemId,quantity:t.quantity}),e)),{})}const uf={cart:function(e=df([]),t){if(t.type===bp){const{catalogItem:n,quantity:a}=t.payload,i=n.cartItemId,o=No(n,a);return Object.assign(Object.assign({},e),{[i]:o})}return e},userCreativeResponseHistory:function(e=[],t){return t.type===Ep?e.concat(t.payload.responseId):e},staticData:Ku,childLayouts:Wu};const pf="INVALID_PARTNER_MESSAGE",ff="MISCONFIGURED_CATALOG_ITEM",yf="FAILED_TO_PROCESS_PARTNER_UPDATE_CART_ITEM";function*mf(e){var t,n;const a=yield r.select(tf),i=yield r.select(nf),o=yield r.select((e=>{var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer.maxTotalItemsQtyInOffer}));if(If(i)&&If(o)&&i>o)yield r.call(e,{level:R,code:ff,message:`Catalog items preselected quantities (${i}) exceeds the maximum allowed quantity (${o}) for this offer`});else if(a&&Array.isArray(a))for(const i of a){const a=null!==(t=i.preSelectedQuantity)&&void 0!==t?t:0,o=null!==(n=i.maxItemCount)&&void 0!==n?n:1/0;a>o?yield r.call(e,{level:R,code:ff,message:`Preselected quantity (${a}) is greater than maxItemCount (${o}) for catalog item (${i.instanceGuid})`}):yield*bf(i,a,!0)}}function*hf(e,t,n){const{catalogItem:a,quantity:i}=n.payload;if(yield*bf(a,i,!1)){const n=yield r.select((e=>{var t,n,a;const i=null===(t=e.staticData)||void 0===t?void 0:t.offer.creative.responseOptionsMap.positive,o=e.userCreativeResponseHistory.at(-1),r=null===(n=e.staticData)||void 0===n?void 0:n.offer.creative.responseOptionsMap.negative;if(i&&o&&i.id===o&&"SignalGatedResponse"===(null==r?void 0:r.signalType))return function(e,t){var n;switch(e.action){case"Fulfillment":{const a=null==t?void 0:t.creative.fulfillment;return b(a)?{type:z,payload:{fulfillment:a,responseOption:e,accountID:null!==(n=null==t?void 0:t.accountId)&&void 0!==n?n:""}}:`Could not get fulfillment for response (instanceGuid: ${e.instanceGuid})`}case"Url":return(null==t?void 0:t.accountId)?{type:z,payload:Object.assign(Object.assign({},e),{accountID:t.accountId})}:`Could not get accountId for response (instanceGuid: ${e.instanceGuid})`;default:return{type:z,payload:e}}}(r,null===(a=e.staticData)||void 0===a?void 0:a.offer)}));null!=(o=n)&&"object"==typeof o&&"type"in o&&"payload"in o&&"object"==typeof o.payload?yield r.call(e.globalDispatch,n):function(e){return"string"==typeof e}(n)&&(yield r.call(t,{level:R,code:"INVALID_RESPONSE_OBJECT",message:n}))}var o}function*vf(e,t){const n=function(e,t){return l.eventChannel((n=>{const a=e.onEvent({name:yr.V2.PartnerMessage.UpdateCartItem,source:"partner",callback:e=>{!function(e){return null!==e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&!("unitPrice"in e)}(e)?t({level:R,code:pf,message:`Invalid UpdateCartItemPartnerMessageBody: ${JSON.stringify(e)}`}):n(e)}});return()=>{a()}}))}(e,t);try{for(;;){const e=yield r.take(n);yield r.call(gf,e,t)}}catch(e){const n=e;t({level:R,code:yf,message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&n.close()}}function*gf(e,t){const{cartItemId:n,quantity:a}=e,i=yield r.select(Kp,n);if(Ef(i)){const e=yield r.select(ef,i.catalogItemId);null!==(o=e)&&"object"==typeof o&&"catalogItemId"in o&&"price"in o?yield*bf(e,a,!1):yield r.call(t,{level:R,code:yf,message:`Catalog item not found for cart item id (${n})`})}else yield r.call(t,{level:R,code:yf,message:`Cart item not found for cart item id (${n})`});var o}function*bf(e,t,n){var a;const i=yield r.select(Kp,e.cartItemId),o=yield r.select(Jp,e),s=If(o)?o:0,l=Ef(i)?i.quantity:0;if(t!==l&&t>=(null!==(a=e.minItemCount)&&void 0!==a?a:0)&&t-l<=s){yield r.put({type:bp,payload:{catalogItem:e,quantity:t}});const a=yield r.select(Kp,e.cartItemId),o=yield r.select(af);return yield r.put({type:oe,payload:{cart:o}}),yield r.put({type:Z,payload:{name:"SignalCartItemQuantitySelected",parentGuid:e.instanceGuid,objectData:{quantity:t,preselected:n}}}),yield r.put({type:ee,payload:{name:"V2_CART_ITEM_UPDATED",body:{oldCartItem:i,cartItem:a}}}),!0}return!1}function If(e){return"number"==typeof e}function Ef(e){return null!=e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&"unitPrice"in e}function*xf(e,t){var n;yield r.put({type:Ep,payload:{responseId:(n=t.payload,q(n)?n.responseOption.id:n.id)}}),yield r.call(e.globalDispatch.bind(e),t)}function*Sf(e,t){yield r.all([r.spawn(mf.bind(null,t)),r.spawn(vf.bind(null,e,t)),r.takeLatest(Ip,hf.bind(null,e,t)),r.takeLatest(z,xf.bind(null,e)),r.takeEvery(re,np.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}function Cf(e){return"object"==typeof e&&null!==e&&"cartItemId"in e&&"quantity"in e}Object.assign(Object.assign({},se),{CATALOG_ITEM_RESPONSE:Ip});const wf=(new Cn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=function(e){return"object"==typeof e&&null!==e&&"cart"in e&&Array.isArray(e.cart)&&e.cart.every(Cf)}(i.offerState)?i.offerState:{cart:[]},d=function(e={}){return Object.assign({cart:df([]),userCreativeResponseHistory:[],staticData:null,childLayouts:{launched:{}}},e)}({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion},cart:df(c.cart)}),u=function(e,t,n){const a=l(),i=s.configureStore({reducer:uf,devTools:{name:"Add To Cart"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Sf,e,t),i}(i.gateway,i.logger,d);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Gn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(_i,{}),e.jsx(a.Provider,{store:u,children:e.jsx(Di,{settings:i,dispatch:u.dispatch,children:e.jsx(cf,{})})})]})}))}}));var Of=Object.freeze({__proto__:null,moduleConnectorBuilder:wf});const Tf="CATALOG/TRIGGER_SELECT_ITEM",Af="CATALOG/SET_SELECTED_ITEM",jf="CHECKOUT_LIFECYCLE",Rf="INSTANT_PURCHASE/INITIATE",Nf="INSTANT_PURCHASE/PARTNER_RESPONSE",Lf="INSTANT_PURCHASE/WSDK_RESPONSE",Df=t.createContext(null);function kf(n){const[a,i]=t.useState({});return e.jsx(Df.Provider,{value:{registerValidators:function(e,t){i((n=>Object.assign(Object.assign({},n),{[e]:{validators:t,isValid:!0}})))},validateFieldKeys:function(e){const t={};let n=!0;for(const i of e){const e=a[i];if(e){const a=Object.assign({},e),o=e.validators.every((e=>e()));o!==a.isValid&&(t[i]=Object.assign(Object.assign({},a),{isValid:o})),n&&(n=o)}else n=!1}return Object.values(t).length>0&&i((e=>Object.assign(Object.assign({},e),t))),n},getFieldKeyValidity:function(e){var t;return(null===(t=a[e])||void 0===t?void 0:t.isValid)||!1}},children:n.children})}function _f(){const e=t.useContext(Df);if(!e)throw new Error("useValidator must be used within a ValidatorProvider");return e}function Pf(e,n){const a=_f();t.useEffect((()=>{e&&a.registerValidators(e,n)}),[])}function $f(e,t){return t?t.validators.map((t=>e[t])).filter((e=>void 0!==e)):[]}function Ff(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:Gf(t,i,o)})}function Gf(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Mf(t){const n=t.schema.validatorTriggerConfig,i=a.useDispatch(),o=Ct(),r=Nn(),{tabIndex:s,styles:l,isDisabled:c}=h(r),d=Un(),u=Ht(d,"catalogItem"),p=_f();return e.jsx(Na,{styles:t.schema.styles,children:({classnames:a,mapperRef:r})=>e.jsx("button",{type:"button",tabIndex:s,"aria-disabled":c,disabled:c,style:Object.assign({cursor:"pointer"},l),"data-testid":t.testId,"data-e2e":"CatalogItemResponse",onClick:e=>{e.preventDefault(),function(){let e=!0;n&&(e=p.validateFieldKeys(n.validatorFieldKeys)),e&&i({type:Rf,payload:{catalogItem:d,quantity:1,useInstantPurchaseExtension:!0}})}()},className:null==a?void 0:a.own,children:e.jsx(Jt,{value:u,children:(null==a?void 0:a.own)?Ff(t.schema.children,a.own,r,o,t.testId):Gf(t.schema.children,o,t.testId)})})})}const Bf=["ArrowDown","ArrowUp","Enter","Escape","Tab"];function Uf(n){const i=n.schema.validatorFieldConfig,o=n.schema.disableProgrammaticFocus||!1,r=Rt(),s=Ct(),l=Zt(),c=e=>l({data:e},"catalogItem"),d=t.useMemo((()=>r.catalogItems||[]),[r]),u=Nn(),{styles:p,isDisabled:f}=h(u),y=t.useRef(null),m=t.useRef([]),[v,g]=t.useState(!1),[b,I]=t.useState(-1),E=a.useDispatch(),x=_f(),S=a.useSelector((e=>e.selectedItem)),C=t.useRef(S);function w(){return!!C.current}const O=t.useMemo((()=>$f({required:w},i)),[i]);function T(t,a,i,o){return t?function(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:i(t,void 0,o)})}(a,t,i,s,o||n.testId):function(e,t,n){return t(e,void 0,n)}(a,s,o||n.testId)}function A(){return!i||x.getFieldKeyValidity(i.validationFieldKey)}function j(){f||(v?N():R())}function R(){f||g(!0)}function N(){f||g(!1)}function L(e){var t;I(d.indexOf(e)),N(),E({type:Tf,payload:{catalogItem:e}}),C.current=e,i&&i.validateOnChange&&x.validateFieldKeys([i.validationFieldKey]),null===(t=y.current)||void 0===t||t.focus()}function D(e){const t=[null==e?void 0:e.dropDownSelectedElement];return A()||t.push((null==e?void 0:e.dropDownContainerErrorStyles)||""),t.join(" ")}Pf(null==i?void 0:i.validationFieldKey,O),t.useEffect((()=>{var e;if(!o)if(v)if(-1===b)null===(e=y.current)||void 0===e||e.focus();else{const e=m.current[b];e&&e.focus()}else S||I(-1)}),[v,b,S,o]);const k={elements:{own:[{default:{background:{backgroundColor:{light:"#ffffff"}},dimension:{width:{type:"percentage",value:100}}}}]}};function _(e){var t;if(!f&&Bf.includes(e.key))switch(e.key){case"ArrowDown":{e.preventDefault();const t=b+1;t<d.length&&I(t);break}case"ArrowUp":{e.preventDefault();const t=b-1;t>=0&&I(t);break}case"Enter":if(e.preventDefault(),v){const e=d[b];e&&L(e)}else R();break;case"Tab":if(v&&S){N();const e=d.indexOf(S);-1!==e&&I(e)}break;case"Escape":e.preventDefault(),v&&(N(),null===(t=y.current)||void 0===t||t.focus())}}return d.length>1?e.jsx(Na,{styles:n.schema.styles?M(k,n.schema.styles):k,children:({classnames:t,mapperRef:a})=>e.jsxs("div",{className:null==t?void 0:t.dropDownContainer,children:[e.jsxs("div",{ref:y,className:null==t?void 0:t.own,onKeyDown:_,onClick:j,onBlur:e=>{var t;(null===(t=y.current)||void 0===t?void 0:t.contains(e.relatedTarget))||v&&N()},"data-e2e":"DropDown","data-testid":n.testId?`${n.testId}-drop-down-container`:void 0,"aria-disabled":f,style:Object.assign({position:"relative"},p),tabIndex:0,children:[e.jsx("div",{className:D(t),"aria-disabled":f,"data-testid":n.testId?`${n.testId}-drop-down-selected-element`:void 0,style:Object.assign({cursor:"pointer"},p),children:S?e.jsx(Jt,{value:c(S),children:T(null==t?void 0:t.dropDownSelectedElement,n.schema.closedTemplate,a)}):T(null==t?void 0:t.dropDownSelectedElement,n.schema.closedDefaultTemplate,a)}),v&&e.jsx("ul",{className:null==t?void 0:t.dropDownListContainer,onClick:e=>e.stopPropagation(),"data-testid":n.testId?`${n.testId}-drop-down-list-container`:void 0,tabIndex:-1,style:Object.assign({listStyle:"none",padding:0,zIndex:9999,position:"absolute",top:"100%",left:0,right:0,backgroundColor:"#FFF",overflow:"hidden"},p),children:d.map(((i,o)=>e.jsx("li",{ref:e=>function(e,t){m.current[t]=e}(e,o),className:null==t?void 0:t.dropDownListElement,onClick:e=>{e.stopPropagation(),f||L(i)},tabIndex:-1,"data-e2e":"DropDownItem","data-testid":n.testId?`${n.testId}-drop-down-item-${o}`:void 0,style:Object.assign({cursor:"pointer",display:"flex"},p),children:e.jsx(Jt,{value:c(i),children:T(null==t?void 0:t.dropDownSelectedElement,n.schema.openTemplate,a)})},i.catalogItemId)))})]}),!A()&&n.schema.requiredSelectionErrorTemplate?T(null==t?void 0:t.errorContentContainerStyles,n.schema.requiredSelectionErrorTemplate,a,"dropdown-required-selection-error"):e.jsx("p",{className:(null==t?void 0:t.errorContentContainerStyles)||"",children:" "})]})}):null}function Vf(n){const i=n.schema.styles,o=a.useDispatch(),r=a.useSelector((e=>e.staticData)),s=Nn(),{tabIndex:l,styles:c,isDisabled:d}=h(s),u=()=>{var e;o({type:jf,payload:{event:"Checkout",targetStep:n.schema.targetStep,offerPositionIndex:null!==(e=null==r?void 0:r.position)&&void 0!==e?e:0,data:n.schema.data}})};return e.jsx(Na,{styles:i,children:({classnames:a})=>{var i;return e.jsx("button",{title:n.schema.targetStep,className:null==a?void 0:a.own,onClick:u,"data-testid":n.testId,"data-e2e":"CheckoutStateButtonTrigger",disabled:d,"aria-disabled":d,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:n.schema.targetStep,tabIndex:l,style:Object.assign({cursor:"pointer"},c),children:e.jsx(St,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,U(a,n.testId)))))})})}})}const zf=/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/;function qf(t){const n=Zt(),a=Nn(),{schema:i,testId:o}=t,r=n(i.value),{tabIndex:s,styles:l,isDisabled:c}=h(a);return"string"==typeof(d=r)&&zf.test(d)?e.jsx(Na,{styles:i.styles,children:({classnames:t})=>e.jsx("div",{"aria-hidden":c,className:null==t?void 0:t.own,"data-e2e":"ColorSwatch","data-testid":o,style:Object.assign({backgroundColor:r},l),tabIndex:s})}):null;var d}function Hf(e){return{name:e,styles:{elements:{own:[{default:{text:{fontSize:28},border:{borderColor:{light:"#131317"},borderRadius:50,borderStyle:"solid",borderWidth:"2"},spacing:{padding:"4"}}}]}}}}const Wf=Hf("ChevronLeft"),Kf=Hf("ChevronRight");function Yf(n){const{schema:a,testId:i}=n,o=a.scrollGradientLength||36,r=Un(),s=Object.values(r.images||{}),l=s.length>1?1:0,c=t.useMemo((()=>l?[s.at(-1),...s,s.at(0)].filter((e=>void 0!==e)):s),[s,l]),[d,u]=t.useState({left:o,right:o}),[p,f]=t.useState(l),[y,m]=t.useState(0),[v,g]=t.useState(!1),[b,I]=t.useState(0),[E,x]=t.useState(!1),[S,C]=t.useState(!1),w=Nn(),{styles:O,isDisabled:T,tabIndex:A}=h(w),j=t.useRef(null),R=t.useRef(null),N=t.useRef([]),L=t.useRef([]),D=t.useRef(null);function k(){const e=j.current;e&&g(e.scrollWidth>e.clientWidth)}function _(e){const{scrollLeft:t,scrollWidth:n,clientWidth:a}=e,i=n-a-t;u({left:t<o?t:o,right:i<o?i:o})}!function(){const e=t.useRef(null);t.useEffect((()=>{const t=R.current;if(!t)return;let n=0,a=t.scrollLeft;const i=()=>{const o=t.scrollLeft;o===a?n++:(n=0,a=o),n>=5?(null!==e.current&&(cancelAnimationFrame(e.current),e.current=null),D.current&&D.current()):e.current=requestAnimationFrame(i)};return i(),()=>{null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)}}),[D.current])}(),t.useEffect((()=>{var e,t;f(l),m(0),null===(e=L.current[0])||void 0===e||e.scrollIntoView({behavior:"instant"}),null===(t=N.current[l])||void 0===t||t.scrollIntoView({behavior:"instant"}),k()}),[r.catalogItemId,l]),t.useEffect((()=>{const e=j.current;if(!e)return;function t(e){const t=j.current;t&&0!==e.deltaY&&(e.preventDefault(),t.scrollLeft+=e.deltaY)}const n=new ResizeObserver((()=>{var t,n;k(),_(e),e.clientWidth!==b&&(null===(t=N.current[p])||void 0===t||t.scrollIntoView({behavior:"instant"}),null===(n=L.current[y])||void 0===n||n.scrollIntoView({behavior:"instant"}),I(e.clientWidth))}));return n.observe(e),e.addEventListener("wheel",t,{passive:!1}),()=>{n.disconnect(),e&&e.removeEventListener("wheel",t)}}),[]);const P={display:"flex",position:"absolute",top:"50%",transform:"translateY(-50%)",backgroundColor:"transparent",cursor:T?"not-allowed":"pointer"};function $(e){var t,n;if(E)return;const a=p+e;let i=a,o=y+e;0===a?(i=c.length-2,o=s.length-1):o===s.length&&(i=1,o=0),x(!0),null===(t=N.current[a])||void 0===t||t.scrollIntoView({}),null===(n=L.current[o])||void 0===n||n.scrollIntoView({}),m(o),f(i),D.current=a===i?()=>{x(!1)}:()=>{var e;null===(e=N.current[i])||void 0===e||e.scrollIntoView({behavior:"instant"}),x(!1)}}return s.length>0?e.jsx(Na,{styles:a.styles,children:({classnames:n})=>e.jsxs("div",{className:null==n?void 0:n.own,children:[e.jsxs("div",{onMouseOver:()=>C(!0),onMouseOut:()=>C(!1),style:{position:"relative"},"data-testid":`${i}-main-image-container`,children:[S&&1===l&&e.jsxs(e.Fragment,{children:[e.jsx("button",{style:Object.assign(Object.assign({},P),{left:"5%"}),className:null==n?void 0:n.scrollIconButton,onClick:()=>$(-1),"data-testid":"main-image-scroll-left-button",children:e.jsx(Ka,{schema:a.leftScrollIconTemplate||Wf})}),e.jsx("button",{style:Object.assign(Object.assign({},P),{right:"5%"}),className:null==n?void 0:n.scrollIconButton,onClick:()=>$(1),"data-testid":"main-image-scroll-right-button",children:e.jsx(Ka,{schema:a.rightScrollIconTemplate||Kf})})]}),e.jsx("div",{ref:R,style:{display:"flex",aspectRatio:"1 / 1",overflow:"hidden",scrollBehavior:"smooth"},children:t.Children.toArray(c.map(((t,a)=>e.jsx("div",{ref:e=>function(e,t){N.current[t]=e}(e,a),style:{aspectRatio:"1 / 1"},children:e.jsx("img",{src:t.light,alt:t.alt,title:t.title,className:null==n?void 0:n.mainImage,loading:"lazy",style:Object.assign(Object.assign({},O),{height:"100%"}),"data-testid":`${i}-main-image-${a}`,"data-e2e":"CatalogImageGallery-mainImage"})},`${t.light}-${a}`))))})]}),e.jsx("div",{ref:j,onScroll:e=>_(e.currentTarget),className:null==n?void 0:n.thumbnailList,style:Object.assign(Object.assign({},O),{display:"flex",overflow:"auto",justifyContent:v?"flex-start":"center",scrollbarWidth:"none",scrollBehavior:"smooth",maskImage:`linear-gradient(to right, transparent 0, black ${d.left}px, black calc(100% - ${d.right}px), transparent 100%)`}),children:t.Children.toArray(s.map(((t,a)=>e.jsx("div",{style:{flexShrink:0,aspectRatio:"1 / 1",overflow:"hidden"},children:e.jsx("img",{ref:e=>function(e,t){L.current[t]=e}(e,a),src:t.light,alt:t.alt,title:t.title,className:a===y?null==n?void 0:n.selectedThumbnailImage:null==n?void 0:n.thumbnailImage,loading:"lazy",style:Object.assign(Object.assign({},O),{cursor:T?"not-allowed":"pointer",pointerEvents:"auto",aspectRatio:"1 / 1"}),"data-testid":`${i}-thumbnail-${a}`,"data-e2e":"CatalogImageGallery-thumbnail",tabIndex:A,onClick:()=>function(e){var t,n;if(E)return;x(!0);const a=l?e+1:e;f(a),m(e),null===(t=N.current[a])||void 0===t||t.scrollIntoView({}),null===(n=L.current[e])||void 0===n||n.scrollIntoView({}),D.current=()=>{x(!1)}}(a)})}))))})]})}):null}const Jf={size:80,radius:30,stroke:7,duration:2,primaryColor:"#222",secondaryColor:"#d6d6d6",primaryRotation:-50,secondaryRotation:45,arcFraction:1/3.5},Zf={elements:{own:[{default:{container:{justifyContent:"center",alignItems:"center"},dimension:{width:{type:"percentage",value:100}}}}],spinner:[{default:{container:{justifyContent:"center",alignItems:"center"}}}]}};function Qf(t){var n;const{config:a}=t.schema,i=Object.assign(Object.assign({},Jf),a),o=i.radius,r=2*Math.PI*o,s=r*(null!==(n=i.arcFraction)&&void 0!==n?n:1/3.5),l=r-s,c=i.size/2,d={container:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%"},spinner:{display:"block",animation:`spin ${i.duration}s ease-in-out infinite`,transformOrigin:"center center"}};return e.jsx(Na,{styles:t.schema.styles?M(Zf,t.schema.styles):Zf,children:({classnames:n})=>e.jsxs("div",{className:null==n?void 0:n.own,"data-testid":t.testId,"data-e2e":"LoadingSpinner",style:d.container,children:[e.jsxs("svg",{width:i.size,height:i.size,viewBox:`0 0 ${i.size} ${i.size}`,className:null==n?void 0:n.spinner,style:d.spinner,children:[e.jsx("circle",{cx:c,cy:c,r:o,fill:"none",stroke:i.primaryColor,strokeWidth:i.stroke,strokeDasharray:`${s} ${l}`,strokeDashoffset:"0",strokeLinecap:"butt",transform:`rotate(${i.primaryRotation} ${c} ${c})`}),i.secondaryColor&&e.jsx("circle",{cx:c,cy:c,r:o,fill:"none",stroke:i.secondaryColor,strokeWidth:i.stroke,strokeDasharray:`${s} ${l}`,strokeDashoffset:"0",strokeLinecap:"butt",transform:`rotate(${i.secondaryRotation} ${c} ${c})`})]}),e.jsx("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]})})}function Xf(n){const i=1e3*n.schema.durationInSeconds,o=n.schema.format||"M:SS",r=n.testId,s=a.useDispatch(),[l,c]=t.useState(i),d=t.useRef(null),u=t.useRef(null);function p(){const e=Math.ceil(l/1e3);if("S"===o)return e;{const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,"0")}`}}return t.useEffect((()=>(u.current=requestAnimationFrame((function e(t){d.current||(d.current=t);const n=t-d.current,a=Math.max(i-n,0);c(a),a>0?u.current=requestAnimationFrame(e):s({type:Q,payload:{event:"Dismissed",dismissalReason:"Implicit"}})})),()=>{u.current&&cancelAnimationFrame(u.current)})),[i,s]),e.jsx(Na,{styles:n.schema.styles,children:({classnames:t})=>e.jsx("span",{className:null==t?void 0:t.own,"data-testid":r||"","data-e2e":"OfferLifecycleTimer",children:p()})})}function ey(n){const i=a.useDispatch(),o=n.schema,r=o.validatorTriggerConfig,s=n.schema.styles,l=Nn(),{styles:c,isDisabled:d}=h(l),u=_f();function p(){let e=!0;r&&(e=u.validateFieldKeys(r.validatorFieldKeys)),e&&i({type:X,payload:{key:o.customStateKey,value:o.customStateValue}})}return e.jsx(Na,{styles:s,children:({classnames:a})=>{var i;return e.jsx("button",{className:null==a?void 0:a.own,onClick:p,"data-testid":n.testId,"data-e2e":"CatalogVariationSelectionButton",disabled:d,"aria-disabled":d,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:"",style:Object.assign({cursor:"pointer"},c),children:e.jsx(St,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,U(a,n.testId)))))})})}})}function ty(n){var a;const{schema:i}=n,[o,r]=t.useState(!1),[s,l]=t.useState(!1),[c,d]=t.useState(!1),[u,p]=t.useState(!1),[f,y]=t.useState(0),m=Nn(),{tabIndex:v,isDisabled:g}=h(m),b=Zt(),I=t.useRef(null),E=t.useRef(null),x=i.lineHeight*i.lineLimit,S=x-i.lineHeight;function C(){const e=i.linearGradientConfig;return e?{background:`linear-gradient(to bottom, ${e.linearColorStart} ${S}px, ${e.linearColorStop||"transparent"})`,backgroundClip:"text",color:"transparent"}:{}}function w(){const e={overflow:"hidden",textOverflow:"clip"};return u?Object.assign(Object.assign(Object.assign({},e),o?{}:C()),{transition:"height 0.3s ease",height:o?`${f}px`:`${x}px`}):!o&&c?Object.assign(Object.assign(Object.assign(Object.assign({},e),i.linearGradientConfig?{}:{display:"-webkit-box",WebkitLineClamp:i.lineLimit,lineClamp:i.lineLimit,WebkitBoxOrient:"vertical"}),C()),i.linearGradientConfig?{height:`${x}px`}:{}):e}return t.useEffect((()=>{const e=I.current;if(!e)return;const t=()=>{d(e.scrollHeight>x),y(e.scrollHeight)};r(!1),l(!1),p(!1),d(!1),t();const n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect(),E.current&&cancelAnimationFrame(E.current)}}),[null===(a=I.current)||void 0===a?void 0:a.innerText,x]),e.jsx(Na,{styles:n.schema.styles,children:({classnames:t})=>e.jsxs("div",{"aria-hidden":g,"data-testid":n.testId,"data-e2e":"ReadMoreTextContainer",className:null==t?void 0:t.own,children:[e.jsx("div",{ref:I,"data-testid":`${n.testId}-content-container`,className:null==t?void 0:t.contentContainer,style:w(),onTransitionEnd:()=>{E.current=requestAnimationFrame((()=>{p(!1),E.current=null})),l((e=>!e))},children:e.jsx(Ma,{schema:{value:i.value}})}),c&&e.jsx("button",{onClick:()=>{p(!0),E.current=requestAnimationFrame((()=>{r((e=>!e)),E.current=null}))},tabIndex:v,className:null==t?void 0:t.expansionButton,style:{background:"none",cursor:"pointer"},children:b(s?i.collapseLabel:i.expandLabel)})]})})}function ny(n){const i=a.useDispatch(),o=a.useSelector((e=>e.staticData)),r=Nn(),{tabIndex:s,styles:l,isDisabled:c}=h(r);function d(){i({type:Z,payload:{name:"SignalInstantPurchaseDismissal",parentGuid:(null==o?void 0:o.offer.creative.instanceGuid)||""}}),i({type:Q,payload:{event:"Dismissed",dismissalReason:"Explicit"}})}return e.jsx(Na,{styles:n.schema.styles,children:({classnames:a})=>e.jsx("button",{className:null==a?void 0:a.own,onClick:d,"data-testid":n.testId,"data-e2e":"DismissInstantPurchaseButton",disabled:c,"aria-disabled":c,"aria-label":n.schema.a11yLabel||"",tabIndex:s,style:Object.assign({cursor:"pointer"},l),children:e.jsx(St,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,U(a,n.testId)))))})})})}function ay(n){var a;const{validatorFieldConfig:i,checkboxColor:o}=n.schema,[r,s]=t.useState(null!==(a=n.schema.value)&&void 0!==a&&a),l=t.useRef(r),c=_f();function d(){return l.current}const u=t.useMemo((()=>$f({required:d},i)),[i]);function p(){return!i||c.getFieldKeyValidity(i.validationFieldKey)}function f(e,t){const n=[e];return p()||n.push(t),n.join(" ")}function y(e){return f(null==e?void 0:e.checkbox,null==e?void 0:e.checkboxError)}function m(e){return f(null==e?void 0:e.label,null==e?void 0:e.labelError)}function h(a,i){return e.jsx(St,{children:e=>t.Children.toArray(a.map(((t,a)=>e(t,void 0,U(a,`${n.testId}-${i}`)))))})}return Pf(null==i?void 0:i.validationFieldKey,u),e.jsx(Na,{styles:n.schema.styles,children:({classnames:t})=>{return e.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.jsxs("div",{className:(a=t,f(null==a?void 0:a.own,null==a?void 0:a.checkboxContainerError)),style:{display:"flex",gap:"8px",flexDirection:"row"},children:[e.jsx("input",{"data-testid":n.testId,className:y(t),type:"checkbox",checked:r,onChange:e=>{return t=e.target.checked,l.current=t,i&&i.validateOnChange&&c.validateFieldKeys([i.validationFieldKey]),void s(t);var t},style:Object.assign({},o?{accentColor:o}:{})}),n.schema.labelTemplate&&e.jsx("div",{className:m(t),children:h(n.schema.labelTemplate,"label")})]}),!p()&&n.schema.errorContentTemplate&&e.jsx("div",{className:null==t?void 0:t.errorContent,children:h(n.schema.errorContentTemplate,"error-content")})]});var a}})}function iy(n){const i=Ct(),o=$n(),r=Zt(),s=bt(),l=Rt().catalogItems||[],c=a.useSelector((e=>e.selectedItem))||l[0];return t.useEffect((()=>{c&&s({type:Z,payload:{name:"SignalImpression",parentGuid:null==c?void 0:c.instanceGuid}})}),[c,s]),c?e.jsx(Na,{styles:n.schema.styles,children:({classnames:a})=>{return e.jsx("div",{"data-testid":n.testId,"data-e2e":"CatalogCombinedCollection",className:null==a?void 0:a.own,style:{display:"flex",flexDirection:"column"},children:t.Children.toArray(e.jsx(kf,{children:e.jsx(Bn,{context:c,children:e.jsx(Pn,{value:o(c),children:e.jsx(Jt,{value:(s=c,r({data:s},"catalogItem")),children:i(n.schema.template,void 0,n.testId?`${n.testId}-child`:"")})})})}))});var s}}):null}const oy={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(Mf,{schema:t.node,testId:n})},CatalogCombinedCollection:function(t,n){if("CatalogCombinedCollection"===t.type)return e.jsx(iy,{schema:t.node,testId:n})},EscapeHatch:function(t){if("EscapeHatch"===t.type&&t.node.data){const n=JSON.parse(t.node.data);switch(null==n?void 0:n.type){case"CatalogDropDown":return e.jsx(Uf,{schema:n.node});case"CatalogVariationSelectionButton":return e.jsx(ey,{schema:n.node});case"Checkbox":return e.jsx(ay,{schema:n.node});case"CheckoutStateButtonTrigger":return e.jsx(Vf,{schema:n.node});case"ColorSwatch":return e.jsx(qf,{schema:n.node});case"CatalogImageGallery":return e.jsx(Yf,{schema:n.node});case"DismissInstantPurchaseButton":return e.jsx(ny,{schema:n.node});case"LoadingSpinner":return e.jsx(Qf,{schema:n.node});case"OfferLifecycleTimer":return e.jsx(Xf,{schema:n.node});case"ReadMoreTextContainer":return e.jsx(ty,{schema:n.node});default:return}}}};function ry(){const t=jn(),n=Ct(),i=a.useSelector(ep),o=Zt()({state:i},"textContent");return e.jsx(wt,{value:n,overrides:oy,children:e.jsx(Jt,{value:o,children:e.jsx(St,{children:e=>e(t)})})})}function sy(e){if(!e.copy)return null;const t=t=>e.copy[`ppu.${t}`]||"";return{shippingAttributes:{address1:t("shippingAddress1"),address2:t("shippingAddress2"),city:t("shippingCity"),state:t("shippingState"),country:t("shippingCountry"),postalCode:t("shippingZipcode")}}}const ly={staticData:Ku,selectedItem:(e=null,t)=>t.type===Af?t.payload:e,dynamicData:Yu,childLayouts:Wu,fulfillmentDetails:(e=null,t)=>"INSTANT_PURCHASE/SET_FULFILLMENT_DETAILS"===t.type?t.payload:e};function cy(e={}){return Object.assign({staticData:null,selectedItem:null,dynamicData:null,childLayouts:{launched:{}},fulfillmentDetails:null},e)}const dy="INVALID_RESPONSE_OBJECT",uy="MISSING_APP_STATE_IN_INSTANT_PURCHASE_MODULE",py="MISSING_PAYMENT_REF_IN_INSTANT_PURCHASE_MODULE",fy="MISSING_STATIC_DATA_IN_INSTANT_PURCHASE_MODULE";function yy(e,t){return l.eventChannel((n=>e.onEvent({name:mr.PartnerMessage.CartItemInstantPurchaseResponse,source:"partner",callback:e=>{var a;"object"==typeof(a=e)&&null!==a&&"upsellItems"in a&&Array.isArray(a.upsellItems)&&a.upsellItems.every((e=>"object"==typeof e))&&"totalUpsellPrice"in a&&"number"==typeof a.totalUpsellPrice&&"currency"in a&&"string"==typeof a.currency&&"paid"in a&&"boolean"==typeof a.paid&&"success"in a&&"boolean"==typeof a.success?n(e):t({level:R,code:"MALFORMED_INSTANT_PURCHASE_PARTNER_DATA",message:`Malformed data received from partner\n ${e}`})}})))}function*my(e,t){var n;try{for(;;){const t=yield r.take(e);t&&(yield r.put({type:Nf,payload:t}))}}catch(e){yield r.call(t,{level:R,code:"INSTANT_PURCHASE_PARTNER_CHANNEL_ERROR",message:null!==(n=e.message)&&void 0!==n?n:"Unknown error in instant-purchase partner channel"})}finally{e.close()}}function*hy(e,t){var n;try{for(;;){const t=yield r.take(e);if(t){yield r.put({type:Lf,payload:t});break}}}catch(e){yield r.call(t,{level:R,code:"INSTANT_PURCHASE_WSDK_CHANNEL_ERROR",message:null!==(n=e.message)&&void 0!==n?n:"Unknown error in instant-purchase WSDK channel"})}finally{e.close()}}const vy="Unknown failure reason",gy=6e4;function*by(){var e,t;const n=yield r.select((e=>e)),a=null!==(t=null===(e=null==n?void 0:n.staticData)||void 0===e?void 0:e.offer.catalogItems)&&void 0!==t?t:[];1===a.length&&a[0]&&(yield*Oy(a[0]))}function*Iy(e){const{catalogItem:t}=e.payload;yield*Oy(t)}function*Ey(e,t,n){const{catalogItem:a,quantity:i}=n.payload,o=No(a,i);o?(yield r.put({type:Z,payload:{name:"SignalCartItemInstantPurchaseInitiated",parentGuid:a.instanceGuid,objectData:{catalogItemId:a.catalogItemId,quantity:i}}}),yield*Ry("ProcessingState",1),n.payload.useInstantPurchaseExtension?yield*function*(e,t,n){const a=yield r.select((e=>e));if(!a)return yield r.call(n,{level:R,code:uy,message:"App state is not set within Redux store."}),void(yield*Ny("offerComplete",2));if(!a.staticData)return yield r.call(n,{level:R,code:fy,message:"App state is not configured with static data."}),void(yield*Ny("offerComplete",2));const i=a.staticData.offer.creative.copy["ppu.partnerPaymentReference"];if(!i)return yield r.call(n,{level:R,code:py,message:"Partner payment reference is not set within creative copy."}),void(yield*Ny("offerComplete",2));const o={upsellItems:[{cartItemId:e.cartItemId,catalogItemId:e.catalogItemId,quantity:e.quantity,unitPrice:e.unitPrice,totalPrice:e.totalPrice,currency:e.currency}],totalUpsellPrice:e.totalPrice,currency:e.currency,paymentDetails:{partnerPaymentReference:i}};a.fulfillmentDetails&&(o.fulfillmentDetails=a.fulfillmentDetails);yield r.fork(wy,t,n),yield r.put({type:ee,payload:{name:"INITIATE_INSTANT_PURCHASE_EVENT",body:o}})}(o,e,t):yield*function*(e,t,n){yield r.fork(Cy,t,n),yield r.put({type:ee,payload:{name:"CART_ITEM_INSTANT_PURCHASE",body:{upsellItems:[e],totalUpsellPrice:e.totalPrice||0,currency:e.currency}}})}(o,e,t)):(yield r.call(t,{level:R,code:dy,message:`Unable to translate catalog item with ID ${a.catalogItemId} to cart item for instant purchase transaction.`}),yield*Ny("offerComplete",2))}function*xy(e,t){const n=yield r.select((e=>e.staticData));if(!n)return yield r.call(e,{level:R,code:fy,message:"App state is not configured with static data."}),void(yield*jy("Error"));if(!n.offer.catalogItems)return yield r.call(e,{level:R,code:"MISSING_CATALOG_ITEMS",message:"No catalog items found within offer data."}),void(yield*jy("Error"));const a={accountId:n.offer.accountId,catalogItems:n.offer.catalogItems};let i,o;t.payload.success?(i=Ty,o="Success"):(i=(e,n)=>function(e,t,n,a){return{name:"SignalCartItemInstantPurchaseFailure",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,failureReason:a.reason||vy,providerId:n.accountId.toString()}}}(e,n,a,t.payload),o="Unspecified"),yield*function*(e,t,n,a){const i=[];for(const a of e.upsellItems){const e=Ay(a,t.catalogItems);void 0===e?i.push(a):yield r.put({type:Z,payload:n(e,a.quantity)})}i.length>0&&(yield*function*(e,t){const n=JSON.stringify(e,null,"\t").replaceAll('"',"");yield r.call(t,{level:R,code:dy,message:`Unable to map cart items to catalog items in the instant purchase partner response: ${n}.`})}(i,a))}(t.payload,a,i,e),yield*jy(o)}function*Sy(e){e.payload.response&&e.payload.response.success?yield*Ny("offerComplete",1):yield*Ny("offerComplete",2)}function*Cy(e,t){const n=yy(e,t),{timeout:a}=yield r.race({channel:r.call(my,n,t),timeout:r.delay(gy)});a&&(yield r.call(t,{level:R,code:"INSTANT_PURCHASE_PARTNER_RESPONSE_TIMEOUT",message:"Instant-purchase partner response timed out after 60000ms"}),n.close(),yield*function*(e){yield*Ry("ProcessingState",0),yield r.put({type:Q,payload:{event:"Dismissed",dismissalReason:e}})}("Implicit"))}function*wy(e,t){const n=function(e,t){return l.eventChannel((n=>e.onEvent(...["INSTANT_PURCHASE_SUCCESS","INSTANT_PURCHASE_FAILURE"].map((e=>({name:e,source:"partner",callback:e=>{var a;"object"==typeof(a=e)&&null!==a&&"timestamp"in a&&"string"==typeof a.timestamp&&"sessionId"in a&&"string"==typeof a.sessionId?n(e):t({level:R,code:"MALFORMED_INSTANT_PURCHASE_WSDK_DATA",message:`Malformed data received from wsdk\n ${e}`})}}))))))}(e,t),{timeout:a}=yield r.race({channel:r.call(hy,n,t),timeout:r.delay(gy)});a&&(yield r.call(t,{level:R,code:"INSTANT_PURCHASE_WSDK_RESPONSE_TIMEOUT",message:"Instant-purchase wsdk response timed out after 60000ms"}),n.close(),yield*Ny("offerComplete",2))}function*Oy(e){var t,n,a;yield r.put({type:Af,payload:e});const i={title:null!==(t=e.title)&&void 0!==t?t:"",description:null!==(n=e.description)&&void 0!==n?n:"",price:null!==(a=e.priceFormatted)&&void 0!==a?a:""};e.copy&&Object.entries(e.copy).forEach((([e,t])=>{i[`copy.${e}`]=t})),yield r.put({type:Hu,payload:{text:i}})}function Ty(e,t){return{name:"SignalCartItemInstantPurchase",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,initiatedBy:T.DCUI}}}function Ay(e,t){return t.find((t=>t.catalogItemId===e.catalogItemId))}function*jy(e){yield*Ry("ProcessingState",0),yield r.put({type:Q,payload:{event:"Completed",completionReason:e}})}function*Ry(e,t){yield r.put({type:X,payload:{key:e,value:t}})}function*Ny(e,t){yield*Ry("ProcessingState",0),yield r.put({type:te,payload:{key:e,value:t}})}const Ly=["Success","Unspecified","Error"],Dy=["Implicit","Explicit"];function*ky(e,t){if("Checkout"!==t.payload.event)return;yield r.put({type:te,payload:{key:"checkout",value:_y(t.payload),offerPositionIndex:t.payload.offerPositionIndex}});const n=t.payload.data;if(n){const a="Completed"===n.event;if("Completed"===n.event||"Dismissed"===n.event){(a?Ly.includes(n.reason):Dy.includes(n.reason))?yield r.put({type:Q,payload:Object.assign(Object.assign({event:n.event},a?{completionReason:n.reason}:{dismissalReason:n.reason}),{offerPositionIndex:t.payload.offerPositionIndex})}):yield r.call(e,{level:R,code:"CHECKOUT_BUTTON_INVALID_OFFERLIFECYCLE",message:`Misconfigured offer lifecycle payload in handleCheckoutLifecycle: ${n}.`})}else yield r.call(e,{level:R,code:"CHECKOUT_BUTTON_UNKNOWN_EVENT",message:`Unknown event type in checkout lifecycle: ${JSON.stringify(n)}`})}}function _y(e){var t;return null!==(t={ViewOffer:0,ViewTransactionDetails:1,EditPayment:2,EditShipping:3,EditPaymentAndShipping:4,CostBreakdown:5,Confirmation:6,CloseOffer:7}[e.targetStep])&&void 0!==t?t:0}function*Py(e,t){yield r.all([r.spawn(by),r.takeEvery(jf,ky.bind(null,t)),r.takeEvery(Tf,Iy),r.takeLatest(Rf,Ey.bind(null,e,t)),r.takeLatest(Nf,xy.bind(null,t)),r.takeLatest(Lf,Sy.bind(null)),r.takeEvery(re,np.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}Object.assign(Object.assign({},se),{INITIATE_INSTANT_PURCHASE:Rf,INSTANT_PURCHASE_PARTNER_RESPONSE:Nf,INSTANT_PURCHASE_WSDK_RESPONSE:Lf});const $y=(new Cn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=cy({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion},fulfillmentDetails:sy(i.offerData.creative)}),d=function(e,t,n=cy()){const a=l(),i=s.configureStore({reducer:ly,devTools:{name:"Instant Purchase"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Py,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Gn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(_i,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Di,{settings:i,dispatch:d.dispatch,children:e.jsx(ry,{})})})]})}))}}));var Fy=Object.freeze({__proto__:null,moduleConnectorBuilder:$y});const Gy=t.createContext(null),My=({children:n})=>{var a;const[i,o]=t.useState([]),[r,s]=t.useState(0),[l,c]=t.useState(0),d=Zt();return t.useEffect((()=>{let e=0;const t=i.length,n=setInterval((()=>{e=e+1>=t?0:e+1,s(e)}),l);return()=>clearInterval(n)}),[l,i]),e.jsx(Gy.Provider,{value:{images:i,activeIndex:r,duration:l,setImages:o,setActiveIndex:s,setDuration:c},children:e.jsx(Jt,{value:d({data:{"image.title":null===(a=i[r])||void 0===a?void 0:a.title}},"creativeCopy"),children:n})})};function By({active:n,duration:a,containerStyles:i,indicatorStyles:o}){const r=t.useRef(null);return t.useEffect((()=>{n&&r.current&&function(e,t){const n="animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype,a=[{width:0},{width:"100%"}];if(n){const n=e.animate(a,{duration:t,iterations:1});return()=>{n.finish()}}}(r.current,a)}),[n]),e.jsx("div",{style:Object.assign({position:"relative",height:"2px",width:"100%",backgroundColor:"#FFFFFF66"},i),children:e.jsx("span",{ref:r,style:Object.assign({animationIterationCount:"infinite",animationFillMode:"forwards",animationTimingFunction:"linear",position:"absolute",top:0,left:0,height:"100%",backgroundColor:"#FFF",width:n?"100%":0},o)})})}function Uy(e){const n=t.useContext(_n),a=[];return e.forEach((e=>{const t=n(`${e}.src`,"copy"),i=n(`${e}.title`,"copy");if(void 0===t)return;const o=function(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)}({light:t,title:i});a.push(o)})),a}function Vy({schema:n,testId:a}){const i=JSON.parse(n.data),{styles:o,duration:r,imageKeys:s}=i,l=t.useContext(Gy),c=Uy(s);return t.useEffect((()=>{null==l||l.setImages(c),null==l||l.setDuration(r)}),[]),e.jsxs("div",{"data-testid":a,style:Object.assign({position:"relative",flexShrink:1,flexGrow:0,width:"100%"},o.elements.own),children:[t.Children.toArray(c.map(((t,n)=>e.jsx("img",{src:t.light,alt:t.title,style:Object.assign({opacity:n===(null==l?void 0:l.activeIndex)?1:0,position:0===n?"relative":"absolute",display:0===n?"block":"",top:0,width:"100%",height:"100%",maxHeight:"100%",maxWidth:"100%",transition:"opacity 300ms ease-in-out",objectFit:"contain"},o.elements.image)})))),e.jsx("div",{style:Object.assign({display:"flex",gap:"2px",width:"70%",position:"absolute",margin:"0 15%",bottom:"8px",zIndex:20,justifyContent:"center"},o.elements.indicatorWrapper),children:t.Children.toArray(c.map(((t,n)=>e.jsx(By,{duration:r,active:n===(null==l?void 0:l.activeIndex),containerStyles:o.elements.indicatorContainer,indicatorStyles:o.elements.indicator}))))})]})}const zy={allowedTags:["em","strong","a","br","u","p","li","ul","ol","span"],allowedAttributes:{a:["href","target"],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],span:[]},allowedSchemes:["http","https"]},qy=new Map([["&","_;^;_"]]),Hy=new RegExp(`<a *(?=${zy.allowedAttributes.a.join("|")}|>)`,"g"),Wy=new RegExp("<span*>","g"),Ky=new RegExp(`<a *(?:(?:${zy.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),Yy=new RegExp("(<br *?>)|(<br *?/>)","g"),Jy="<br/>";function Zy(n){const a=Zt(),i=Nn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Ky,((e,t)=>{const n=t.replaceAll("&",qy.get("&"));return e.replace(t,n)})).replaceAll(Yy,Jy)}(e);return t===u(t,zy)}(e))throw new N("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=h(i);return o?e.jsx(Na,{styles:n.schema.styles,children:({classnames:t})=>{const a=[(null==t?void 0:t.link)?`class = "${null==t?void 0:t.link}"`:"",l?'tabindex="-1"':"",l?"style=\"pointer-events: 'none'; user-select: none;\"":"",l?'aria-disabled="true"':""].filter((e=>e.length>0));return i=o,new RegExp("</(p|ul|ol)>").test(i)?e.jsx("div",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:o.replace(Hy,`<a ${a.join(" ")}`).replace(Wy,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}}):e.jsx("p",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:o.replace(Hy,`<a ${a.join(" ")}`).replace(Wy,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}});var i}}):null}function Qy({schema:n}){const a=Ct(),i=ft(zn(),an()),o=JSON.parse(n.data),[r]=d({loop:!1,align:"start",slidesToScroll:2,containScroll:"trimSnaps"}),{styles:s,body:{tierItems:l}}=o;if(!l||!l.length)return;const c=l.length>2;return e.jsx("div",{className:i`
137
137
  position: relative;
138
138
  `,"data-testid":"ProductTierCarousel",children:e.jsx("div",Object.assign({},c&&{ref:r},{className:i`
139
139
  width: 100%;
@@ -172,15 +172,15 @@
172
172
  background-color: ${(null===(d=null==s?void 0:s.primaryColor)||void 0===d?void 0:d.light)||"#F9FAFB"};
173
173
  color: #f9fafb;
174
174
  }
175
- `,children:t.Children.toArray(n.map((e=>a(e))))})})))})}))})}const qy=(e,t)=>`\n position: absolute;\n top: 0;\n ${t?"right: 0;":"left: 0;"}\n bottom: 0;\n opacity: 0;\n z-index: 10;\n padding: 0 16px;\n transition: opacity 200ms ease-in-out;\n pointer-events: ${e?"none":"auto"};\n background: linear-gradient(${t?"":"-"}90deg, rgba(0,0,0,0.00) 0%, rgba(0,0,0,0.70) 100%);\n &:hover {\n opacity: ${e?0:1};\n }\n`;function Hy({disabled:t,onClick:n}){const a=ft(zn(),an());return e.jsx("button",{onClick:n,disabled:t,className:a`
176
- ${qy(t)}
177
- `,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M14.2951 18L15.7051 16.59L11.1251 12L15.7051 7.41L14.2951 6L8.29508 12L14.2951 18Z",fill:"#ffffff"})})})}function Wy({disabled:t,onClick:n}){const a=ft(zn(),an());return e.jsx("button",{onClick:n,disabled:t,className:a`
178
- ${qy(t,!0)}
179
- `,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M9.70492 6L8.29492 7.41L12.8749 12L8.29492 16.59L9.70492 18L15.7049 12L9.70492 6Z",fill:"#ffffff"})})})}function Ky(e){const n=t.useContext(kn);return e.map((e=>({src:n(`${e}.link.src`,"copy"),open:n(`${e}.link.open`,"copy")})))}function Yy(e){return{type:"StaticImage",node:{url:e,styles:{elements:{own:[{default:{border:{borderRadius:5,borderWidth:"0"},dimension:{width:{type:"percentage",value:100}}}}]}}}}}function Jy(e,t){return{type:"CreativeResponse",node:{responseKey:"positive",styles:{elements:{own:[{default:{spacing:{padding:"0"},background:{backgroundColor:{light:"#F9FAFB"}},border:{borderWidth:"0"}}}]}},children:t?[Yy(t)]:[]}}}function Zy({schema:n}){var a,i;const o=Ct(),r=ft(zn(),an()),s=function(e){try{return JSON.parse(e.data)}catch(e){return null}}(n),[l,c]=[_y((null===(a=null==s?void 0:s.body)||void 0===a?void 0:a.imageKeys)||[]),Ky((null===(i=null==s?void 0:s.body)||void 0===i?void 0:i.imageKeys)||[])],u=Rt(),p=u.creative.responseOptionsMap.positive,{carousel:f,styles:y}=(null==s?void 0:s.body)||{},h=(null==f?void 0:f.slidesToScroll)||3,m=(null==f?void 0:f.aspectRatio)||"1/1",v=!(null==f?void 0:f.disabled)&&Array.isArray(l)&&l.length>2,g=v?l:null==l?void 0:l.slice(0,h),[b,I]=d({loop:!1,align:"start",slidesToScroll:h,containScroll:"trimSnaps"}),{prevBtnDisabled:E,nextBtnDisabled:S,onPrevButtonClick:x,onNextButtonClick:C}=function(e){const[n,a]=t.useState(!0),[i,o]=t.useState(!0);return t.useEffect((()=>{if(!e)return;const t=()=>{a(!e.canScrollPrev()),o(!e.canScrollNext())};t(),e.on("reInit",t).on("select",t)}),[e]),{prevBtnDisabled:n,nextBtnDisabled:i,onPrevButtonClick:e?e.scrollPrev:void 0,onNextButtonClick:e?e.scrollNext:void 0}}(I);return s&&g&&g.length&&p?e.jsxs("div",{"data-testid":"product-catalog-carousel",className:r`
175
+ `,children:t.Children.toArray(n.map((e=>a(e))))})})))})}))})}const Xy=(e,t)=>`\n position: absolute;\n top: 0;\n ${t?"right: 0;":"left: 0;"}\n bottom: 0;\n opacity: 0;\n z-index: 10;\n padding: 0 16px;\n transition: opacity 200ms ease-in-out;\n pointer-events: ${e?"none":"auto"};\n background: linear-gradient(${t?"":"-"}90deg, rgba(0,0,0,0.00) 0%, rgba(0,0,0,0.70) 100%);\n &:hover {\n opacity: ${e?0:1};\n }\n`;function em({disabled:t,onClick:n}){const a=ft(zn(),an());return e.jsx("button",{onClick:n,disabled:t,className:a`
176
+ ${Xy(t)}
177
+ `,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M14.2951 18L15.7051 16.59L11.1251 12L15.7051 7.41L14.2951 6L8.29508 12L14.2951 18Z",fill:"#ffffff"})})})}function tm({disabled:t,onClick:n}){const a=ft(zn(),an());return e.jsx("button",{onClick:n,disabled:t,className:a`
178
+ ${Xy(t,!0)}
179
+ `,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M9.70492 6L8.29492 7.41L12.8749 12L8.29492 16.59L9.70492 18L15.7049 12L9.70492 6Z",fill:"#ffffff"})})})}function nm(e){const n=t.useContext(_n);return e.map((e=>({src:n(`${e}.link.src`,"copy"),open:n(`${e}.link.open`,"copy")})))}function am(e){return{type:"StaticImage",node:{url:e,styles:{elements:{own:[{default:{border:{borderRadius:5,borderWidth:"0"},dimension:{width:{type:"percentage",value:100}}}}]}}}}}function im(e,t){return{type:"CreativeResponse",node:{responseKey:"positive",styles:{elements:{own:[{default:{spacing:{padding:"0"},background:{backgroundColor:{light:"#F9FAFB"}},border:{borderWidth:"0"}}}]}},children:t?[am(t)]:[]}}}function om({schema:n}){var a,i;const o=Ct(),r=ft(zn(),an()),s=function(e){try{return JSON.parse(e.data)}catch(e){return null}}(n),[l,c]=[Uy((null===(a=null==s?void 0:s.body)||void 0===a?void 0:a.imageKeys)||[]),nm((null===(i=null==s?void 0:s.body)||void 0===i?void 0:i.imageKeys)||[])],u=Rt(),p=u.creative.responseOptionsMap.positive,{carousel:f,styles:y}=(null==s?void 0:s.body)||{},m=(null==f?void 0:f.slidesToScroll)||3,h=(null==f?void 0:f.aspectRatio)||"1/1",v=!(null==f?void 0:f.disabled)&&Array.isArray(l)&&l.length>2,g=v?l:null==l?void 0:l.slice(0,m),[b,I]=d({loop:!1,align:"start",slidesToScroll:m,containScroll:"trimSnaps"}),{prevBtnDisabled:E,nextBtnDisabled:x,onPrevButtonClick:S,onNextButtonClick:C}=function(e){const[n,a]=t.useState(!0),[i,o]=t.useState(!0);return t.useEffect((()=>{if(!e)return;const t=()=>{a(!e.canScrollPrev()),o(!e.canScrollNext())};t(),e.on("reInit",t).on("select",t)}),[e]),{prevBtnDisabled:n,nextBtnDisabled:i,onPrevButtonClick:e?e.scrollPrev:void 0,onNextButtonClick:e?e.scrollNext:void 0}}(I);return s&&g&&g.length&&p?e.jsxs("div",{"data-testid":"product-catalog-carousel",className:r`
180
180
  position: relative;
181
181
  margin: 8px 0;
182
182
  ${y||""}
183
- `,children:[v?e.jsx(Hy,{onClick:x,disabled:E}):null,e.jsx("div",Object.assign({},v&&{ref:b},{className:r`
183
+ `,children:[v?e.jsx(em,{onClick:S,disabled:E}):null,e.jsx("div",Object.assign({},v&&{ref:b},{className:r`
184
184
  width: 100%;
185
185
  margin: auto;
186
186
  overflow: hidden;
@@ -190,6 +190,6 @@
190
190
  `,children:t.Children.toArray(g.map(((t,n)=>{var a,i;const s=Object.assign(Object.assign({},p),{url:null===(a=null==c?void 0:c[n])||void 0===a?void 0:a.src}),l=Object.assign(Object.assign({},u),{creative:Object.assign(Object.assign({},u.creative),{responseOptionsMap:Object.assign(Object.assign({},u.creative.responseOptionsMap),{positive:s})})});return e.jsx(jt,{context:l,children:e.jsx("div",{"data-testid":"carousel-item",className:r`
191
191
  min-width: 0;
192
192
  overflow: hidden;
193
- aspect-ratio: ${m};
194
- ${v?"flex: 0 0 33%;":`width: ${100/h}%;`}
195
- `,children:o((null===(i=null==c?void 0:c[n])||void 0===i?void 0:i.src)?Jy(c[n],t):Yy(t))})})})))})})),v?e.jsx(Wy,{onClick:C,disabled:S}):null]}):null}function Qy({schema:t}){const n=JSON.parse(t.data),{styles:a,content:i,smallFontSize:o,largeFontSize:r}=n,s=Zt(),l=`\n @keyframes textAnimation {\n 0% { transform: scale(1); }\n 42% { transform: scale(1.2); } /* 800ms out of 1900ms cycle */\n 60% { transform: scale(1.2); }\n 100% { transform: scale(1); }\n }\n\n .animated-text {\n font-size: ${o}px;\n animation: textAnimation 1.9s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;\n }\n `;return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:l}),e.jsx("p",{style:Object.assign({},a),className:"animated-text",children:s(i)})]})}const Xy={EscapeHatch:function(t){if("EscapeHatch"===t.type&&t.node.data){const n=JSON.parse(t.node.data);switch(null==n?void 0:n.type){case"ImageCarousel":return e.jsx(ky,{schema:t.node});case"RichText":return e.jsx(Vy,{schema:n.node});case"ProductTierCarousel":return e.jsx(zy,{schema:t.node});case"ProductCatalogCarousel":return e.jsx(Zy,{schema:t.node});case"TextAnimate":return e.jsx(Qy,{schema:t.node});default:return}}}};function eh(){const t=jn(),n=Ct();return e.jsx(Ly,{children:e.jsx(wt,{value:n,overrides:Xy,children:e.jsx(xt,{children:e=>e(t)})})})}const th={staticData:Mu,childLayouts:Gu};function nh(e={}){return Object.assign({staticData:null,childLayouts:{launched:{}}},e)}function ah(e){let t,n,a;return l.eventChannel((i=>(Promise.race([e.onClose().then((()=>"CLOSED")),new Promise((n=>{t=e.onEvent("PLUGIN_TRANSITION_OFFER_SUCCESS").subscribe((()=>{n("SUCCESS")}))})),new Promise((t=>{n=e.onEvent("PLUGIN_TRANSITION_OFFER_CLOSE").subscribe((()=>{t("UNSPECIFIED")}))})),new Promise((e=>{a=e}))]).then((e=>{"END"!==e&&(i(e),i(l.END))})),()=>{null==t||t.unsubscribe(),null==n||n.unsubscribe(),a("END")})))}function*ih(e,t){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Q,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":t({type:Q,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Q,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*oh(e,t,n){const a=W(n.payload)||K(n.payload)||H(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":case"CaptureOnly":yield r.call(e.globalDispatch.bind(e),n);break;case"Fulfillment":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),yield*function*(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n;yield r.put({type:Z,payload:{name:"SignalResponse",parentGuid:a.instanceGuid,responseActionPayload:{name:"Fulfillment"}}});const o=yield r.call(e.createChildPlugin.bind(e),i);if("object"==typeof o&&"onClose"in o){const t=yield r.call(ah,o);if("object"==typeof t&&"take"in t)return void(yield r.call(ih,t,e.globalDispatch.bind(e)))}yield r.call(t,{level:j,code:"UNEXPECTED_NEXT_VALUE_IN_SAGA",message:'Received an unexpected input at a step in the saga "handleFullfillmentResponse" and could not continue.'})}else yield r.call(t,{level:j,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}(e,t,n.payload)}}function*rh(e,t){yield r.all([r.takeLatest(z,oh.bind(null,e,t)),r.takeEvery(re,Ku.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}Object.assign({},se);const sh=(new Cn).withAppFactory((function(i){if(i.rootElement){const o=n.createRoot(i.rootElement),r=nh({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),c=function(e,t,n=nh()){const a=l(),i=s.configureStore({reducer:th,devTools:{name:"layouts-xp-sandbox"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(rh,e,t),i}(i.gateway,i.logger,r);o.render(e.jsx(t.StrictMode,{children:e.jsxs(Gn,{info:{layoutType:"LayoutVariant",referralCreativeId:String(i.offerData.creative.referralCreativeId)||"N/A"},children:[e.jsx(ki,{}),e.jsx(a.Provider,{store:c,children:e.jsx(Di,{settings:i,dispatch:c.dispatch,children:e.jsx(eh,{})})})]})}))}}));var lh=Object.freeze({__proto__:null,moduleConnectorBuilder:sh});exports.BehaviorSubject=class extends Ru{constructor(e){super(),this._lastValue=e}subscribe(e,t,n){const a=Au(e,t,n);return a.next(this._lastValue),super.subscribe(a)}next(e){return this._lastValue=e,super.next(e)}getValue(){return this._lastValue}},exports.CatchSubscriber=Du,exports.DisplayPreset={FULLSCREEN:"DisplayPreset.FULLSCREEN",EMBEDDED:"DisplayPreset.EMBEDDED",ATTACHED:"DisplayPreset.ATTACHED"},exports.ErrorLevel={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},exports.FirstValueFromError=Nu,exports.Observable=ju,exports.ReplaySubject=class extends Ru{constructor(e=-1){super(),this._buffer=[],this._error=null,this._bufferLength=e}subscribe(e,t,n){const a=Au(e,t,n);let i=!0;return this._buffer.filter((e=>(e===this._error&&(i=!1),i))).forEach((e=>a.next(e))),this._error&&a.error(this._error),a.error=e=>{this._error=e,t(e)},super.subscribe(a)}next(e){this._error||this._addToBuffer(e),super.next(e)}error(e){this._error=e,this._addToBuffer(e),super.error(e)}_addToBuffer(e){-1!==this._bufferLength&&this._buffer.length===this._bufferLength?(this._buffer.shift(),this._buffer.push(e)):this._buffer.push(e)}},exports.Subject=Ru,exports.Subscription=Ou,exports.addCatchToSubscriber=function(e,t){return new Du(e,t)},exports.combineLatest=(...e)=>new ju((t=>{if(!e.length)return t.complete(),Tu;const n=new Ou,a=new Array(e.length),i=new Array(e.length),o=e=>!a.includes(void 0)&&t.next(e);for(let t=0;t<e.length;t++){const r=e[t].subscribe((e=>{i[t]=e,a[t]=!0,o(i)}));n.add(r)}return()=>n.unsubscribe()})),exports.dcuiUtils=Pu,exports.filter=e=>t=>(!1===e(t.value)&&(t.skip=!0),t),exports.first=e=>t=>(e?!0===e(t.value)?t.complete=!0:t.skip=!0:t.complete=!0,t),exports.firstValueFrom=(e,t)=>{let n;const a="object"==typeof t;return new Promise(((i,o)=>{n=e.subscribe(i,o,(()=>{a?i(t.defaultValue):o(new Error(Nu.CompletedBeforeEmit))}))})).then((e=>(n.unsubscribe(),e))).catch((e=>{throw n.unsubscribe(),e}))},exports.fromEvent=(e,t)=>new ju((n=>{const a=e=>n.next(e);return e.addEventListener(t,a),()=>e.removeEventListener(t,a)})),exports.fromPromise=function(e){return new ju((t=>{e.then((e=>{t.next(e),t.complete()}),(e=>t.error(e)))}))},exports.init=function(i,o){return Cu(this,void 0,void 0,(function*(){const{pluginId:r,pageInstanceGuid:s}=yield function(e){return Promise.allSettled([(e.contextService.getUId||e.contextService.getPluginInstanceId)(),e.contextService.getRoktPageInstanceGuid()]).then((([e,t])=>({pluginId:"fulfilled"===e.status?e.value:O.pluginId,pageInstanceGuid:"fulfilled"===t.status?t.value:O.pageInstanceGuid}))).catch((()=>O))}(o),l=n.createRoot(i),c=xu(o);l.render(e.jsxs(t.StrictMode,{children:[e.jsx(ki,{}),e.jsx(Wn,{children:e.jsx(a.Provider,{store:c,children:e.jsxs(Vn.Provider,{value:r,children:[e.jsx(Zo,{}),e.jsx(Ot.Provider,{value:i,children:e.jsx(hi,{extensions:wu,extendStore:c.extend.bind(c),children:e.jsx(Vl,{pageInstanceGuid:s})})})]})})})]}))}))},exports.lastValueFrom=(e,t)=>new Promise(((n,a)=>{let i;"object"==typeof t&&(i=t.defaultValue),e.subscribe((e=>i=e),(e=>a(e)),(()=>n(i)))})),exports.map=e=>t=>{const n=e(t.value);return new _u(n)},exports.merge=(...e)=>new ju((t=>{const n=new Ou;let a=0;for(const i of e)n.add(i.subscribe((e=>t.next(e)),(e=>t.error(e)),(()=>{a+=1,a>=e.length&&t.complete()})));return()=>n.unsubscribe()})),exports.noop=Tu,exports.normaliseToObserver=Au,exports.of=(...e)=>new ju((t=>{for(const n of e)t.next(n)})),exports.pipe=e=>(...t)=>new ju((n=>{const a=e.subscribe((e=>ku(void 0,void 0,void 0,(function*(){try{let a=new _u(e);for(const e of t){const t=e(a);if(a=t.then?yield t:t,!0===a.skip||!0===a.complete)break}if(a.skip)return;n.next(a.value),!0===a.complete&&n.complete()}catch(e){n.error(e)}}))),(e=>n.error(e)),(()=>n.complete()));return()=>a.unsubscribe()})),exports.tap=e=>t=>(e(t.value),t);
193
+ aspect-ratio: ${h};
194
+ ${v?"flex: 0 0 33%;":`width: ${100/m}%;`}
195
+ `,children:o((null===(i=null==c?void 0:c[n])||void 0===i?void 0:i.src)?im(c[n],t):am(t))})})})))})})),v?e.jsx(tm,{onClick:C,disabled:x}):null]}):null}function rm({schema:t}){const n=JSON.parse(t.data),{styles:a,content:i,smallFontSize:o,largeFontSize:r}=n,s=Zt(),l=`\n @keyframes textAnimation {\n 0% { transform: scale(1); }\n 42% { transform: scale(1.2); } /* 800ms out of 1900ms cycle */\n 60% { transform: scale(1.2); }\n 100% { transform: scale(1); }\n }\n\n .animated-text {\n font-size: ${o}px;\n animation: textAnimation 1.9s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;\n }\n `;return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:l}),e.jsx("p",{style:Object.assign({},a),className:"animated-text",children:s(i)})]})}const sm={EscapeHatch:function(t){if("EscapeHatch"===t.type&&t.node.data){const n=JSON.parse(t.node.data);switch(null==n?void 0:n.type){case"ImageCarousel":return e.jsx(Vy,{schema:t.node});case"RichText":return e.jsx(Zy,{schema:n.node});case"ProductTierCarousel":return e.jsx(Qy,{schema:t.node});case"ProductCatalogCarousel":return e.jsx(om,{schema:t.node});case"TextAnimate":return e.jsx(rm,{schema:t.node});default:return}}}};function lm(){const t=jn(),n=Ct();return e.jsx(My,{children:e.jsx(wt,{value:n,overrides:sm,children:e.jsx(St,{children:e=>e(t)})})})}const cm={staticData:Ku,childLayouts:Wu};function dm(e={}){return Object.assign({staticData:null,childLayouts:{launched:{}}},e)}function um(e){let t,n,a;return l.eventChannel((i=>(Promise.race([e.onClose().then((()=>"CLOSED")),new Promise((n=>{t=e.onEvent("PLUGIN_TRANSITION_OFFER_SUCCESS").subscribe((()=>{n("SUCCESS")}))})),new Promise((t=>{n=e.onEvent("PLUGIN_TRANSITION_OFFER_CLOSE").subscribe((()=>{t("UNSPECIFIED")}))})),new Promise((e=>{a=e}))]).then((e=>{"END"!==e&&(i(e),i(l.END))})),()=>{null==t||t.unsubscribe(),null==n||n.unsubscribe(),a("END")})))}function*pm(e,t){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Q,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":t({type:Q,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Q,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*fm(e,t,n){const a=W(n.payload)||K(n.payload)||H(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":case"CaptureOnly":yield r.call(e.globalDispatch.bind(e),n);break;case"Fulfillment":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),yield*function*(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n;yield r.put({type:Z,payload:{name:"SignalResponse",parentGuid:a.instanceGuid,responseActionPayload:{name:"Fulfillment"}}});const o=yield r.call(e.createChildPlugin.bind(e),i);if("object"==typeof o&&"onClose"in o){const t=yield r.call(um,o);if("object"==typeof t&&"take"in t)return void(yield r.call(pm,t,e.globalDispatch.bind(e)))}yield r.call(t,{level:j,code:"UNEXPECTED_NEXT_VALUE_IN_SAGA",message:'Received an unexpected input at a step in the saga "handleFullfillmentResponse" and could not continue.'})}else yield r.call(t,{level:j,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}(e,t,n.payload)}}function*ym(e,t){yield r.all([r.takeLatest(z,fm.bind(null,e,t)),r.takeEvery(re,np.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}Object.assign({},se);const mm=(new Cn).withAppFactory((function(i){if(i.rootElement){const o=n.createRoot(i.rootElement),r=dm({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),c=function(e,t,n=dm()){const a=l(),i=s.configureStore({reducer:cm,devTools:{name:"layouts-xp-sandbox"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(ym,e,t),i}(i.gateway,i.logger,r);o.render(e.jsx(t.StrictMode,{children:e.jsxs(Gn,{info:{layoutType:"LayoutVariant",referralCreativeId:String(i.offerData.creative.referralCreativeId)||"N/A"},children:[e.jsx(_i,{}),e.jsx(a.Provider,{store:c,children:e.jsx(Di,{settings:i,dispatch:c.dispatch,children:e.jsx(lm,{})})})]})}))}}));var hm=Object.freeze({__proto__:null,moduleConnectorBuilder:mm});exports.BehaviorSubject=class extends Fu{constructor(e){super(),this._lastValue=e}subscribe(e,t,n){const a=Pu(e,t,n);return a.next(this._lastValue),super.subscribe(a)}next(e){return this._lastValue=e,super.next(e)}getValue(){return this._lastValue}},exports.CatchSubscriber=Bu,exports.DisplayPreset={FULLSCREEN:"DisplayPreset.FULLSCREEN",EMBEDDED:"DisplayPreset.EMBEDDED",ATTACHED:"DisplayPreset.ATTACHED"},exports.ErrorLevel={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},exports.FirstValueFromError=Gu,exports.Observable=$u,exports.ReplaySubject=class extends Fu{constructor(e=-1){super(),this._buffer=[],this._error=null,this._bufferLength=e}subscribe(e,t,n){const a=Pu(e,t,n);let i=!0;return this._buffer.filter((e=>(e===this._error&&(i=!1),i))).forEach((e=>a.next(e))),this._error&&a.error(this._error),a.error=e=>{this._error=e,t(e)},super.subscribe(a)}next(e){this._error||this._addToBuffer(e),super.next(e)}error(e){this._error=e,this._addToBuffer(e),super.error(e)}_addToBuffer(e){-1!==this._bufferLength&&this._buffer.length===this._bufferLength?(this._buffer.shift(),this._buffer.push(e)):this._buffer.push(e)}},exports.Subject=Fu,exports.Subscription=ku,exports.addCatchToSubscriber=function(e,t){return new Bu(e,t)},exports.combineLatest=(...e)=>new $u((t=>{if(!e.length)return t.complete(),_u;const n=new ku,a=new Array(e.length),i=new Array(e.length),o=e=>!a.includes(void 0)&&t.next(e);for(let t=0;t<e.length;t++){const r=e[t].subscribe((e=>{i[t]=e,a[t]=!0,o(i)}));n.add(r)}return()=>n.unsubscribe()})),exports.dcuiUtils=zu,exports.filter=e=>t=>(!1===e(t.value)&&(t.skip=!0),t),exports.first=e=>t=>(e?!0===e(t.value)?t.complete=!0:t.skip=!0:t.complete=!0,t),exports.firstValueFrom=(e,t)=>{let n;const a="object"==typeof t;return new Promise(((i,o)=>{n=e.subscribe(i,o,(()=>{a?i(t.defaultValue):o(new Error(Gu.CompletedBeforeEmit))}))})).then((e=>(n.unsubscribe(),e))).catch((e=>{throw n.unsubscribe(),e}))},exports.fromEvent=(e,t)=>new $u((n=>{const a=e=>n.next(e);return e.addEventListener(t,a),()=>e.removeEventListener(t,a)})),exports.fromPromise=function(e){return new $u((t=>{e.then((e=>{t.next(e),t.complete()}),(e=>t.error(e)))}))},exports.init=function(i,o){return Lu(this,void 0,void 0,(function*(){const{pluginId:r,pageInstanceGuid:s}=yield function(e){return Promise.allSettled([(e.contextService.getUId||e.contextService.getPluginInstanceId)(),e.contextService.getRoktPageInstanceGuid()]).then((([e,t])=>({pluginId:"fulfilled"===e.status?e.value:O.pluginId,pageInstanceGuid:"fulfilled"===t.status?t.value:O.pageInstanceGuid}))).catch((()=>O))}(o),l=n.createRoot(i),c=Nu(o);l.render(e.jsxs(t.StrictMode,{children:[e.jsx(_i,{}),e.jsx(Wn,{children:e.jsx(a.Provider,{store:c,children:e.jsxs(Vn.Provider,{value:r,children:[e.jsx(Zo,{}),e.jsx(Ot.Provider,{value:i,children:e.jsx(mi,{extensions:Du,extendStore:c.extend.bind(c),children:e.jsx(Zl,{pageInstanceGuid:s})})})]})})})]}))}))},exports.lastValueFrom=(e,t)=>new Promise(((n,a)=>{let i;"object"==typeof t&&(i=t.defaultValue),e.subscribe((e=>i=e),(e=>a(e)),(()=>n(i)))})),exports.map=e=>t=>{const n=e(t.value);return new Uu(n)},exports.merge=(...e)=>new $u((t=>{const n=new ku;let a=0;for(const i of e)n.add(i.subscribe((e=>t.next(e)),(e=>t.error(e)),(()=>{a+=1,a>=e.length&&t.complete()})));return()=>n.unsubscribe()})),exports.noop=_u,exports.normaliseToObserver=Pu,exports.of=(...e)=>new $u((t=>{for(const n of e)t.next(n)})),exports.pipe=e=>(...t)=>new $u((n=>{const a=e.subscribe((e=>Vu(void 0,void 0,void 0,(function*(){try{let a=new Uu(e);for(const e of t){const t=e(a);if(a=t.then?yield t:t,!0===a.skip||!0===a.complete)break}if(a.skip)return;n.next(a.value),!0===a.complete&&n.complete()}catch(e){n.error(e)}}))),(e=>n.error(e)),(()=>n.complete()));return()=>a.unsubscribe()})),exports.tap=e=>t=>(e(t.value),t);