@rokt/dcui-orchestrator 0.2.1-rc.4 → 0.2.1-rc.6

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"],R="ERROR",j="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 _=(e,t)=>i.concat(e,i.slice(e.length,t.length,t)),D=(e,t)=>{if(Array.isArray(e)&&Array.isArray(t)){const n=e.length>t.length?_(t,e):t,a=t.length>e.length?_(e,t):e;return i.zipWith(F,a,n)}return t},k=e=>null==e,P=e=>!k(e),$=(e,t)=>k(t)?e:t,G=(e,t)=>{throw new N("MERGE_TYPE_INCONSISTENCY",`Unable to merge values for inconsistent types, left = ${e}, right = ${t}`)};function F(e,t){return i.cond([[(e,t)=>i.type(e)!==i.type(t)&&P(e)&&P(t),G],[(e,t)=>k(e)||k(t),$],[(e,t)=>"Object"===i.type(e),i.mergeDeepWith(F)],[(e,t)=>"Array"===i.type(e),D],[i.T,i.flip(i.unary(i.identity))]])(e,t)}function M(e,t){return F(e,t)}function B(e=0){return`breakpoint-${e}px`}function U(e,t){return t?`${t}-child${e}`:void 0}const V="GLOBAL/RAISE_METRIC",z="GLOBAL/OFFER_ENGAGEMENT";function q(e){return null!=e&&"object"==typeof e&&"responseOption"in e&&E(e.responseOption)&&"fulfillment"in e&&b(e.fulfillment)}function H(e){return x(e)}function W(e){return S(e)}function Y(e){return function(e){return I(e)&&"CaptureOnly"===e.action}(e)}function J(e){return!!(C(e)||"responseOption"in e&&C(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}function K(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 Re(e){if(null==e||""===e)return"value must not be omitted"}function je(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 _e(e){return t=>{if(t&&"object"==typeof t&&"value"in t&&"type"in t&&"string"==typeof t.type&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t.type)&&"function"==typeof e[t.type]){const n=e[t.type](t.value);if(!n)return;return`object must have valid "value" for type: ${t.type}: ${n}`}return`value must be an object that has a "type" property that matches one of: [${Object.keys(e).join(", ")}] and a "value" property`}}function De(...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 Ge(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 Fe(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(Re,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,De(2,3,4)),n)?xe(Ie(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function We(e){return(t,n,a)=>Oe(_e({fit:Ae(e),percentage:Te,fixed:Te}),a)?xe(Ie(t,n),Ye(a)):""}function Ye(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 Je=Ge({light:je,dark:ke(Le,je)});function Ke(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(Je,n)?Ee({light:Ke(e,t,!1),dark:Ke(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=Ge({offsetX:ke(Le,Te),offsetY:ke(Le,Te),blurRadius:ke(Le,Te),spreadRadius:ke(Le,Te),color:Je}),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(Fe,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(Re,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(De(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")}}),Rt=e=>t.createElement(At.Provider,{value:{get:()=>e.context}},e.children),jt=()=>t.useContext(At).get(),Nt=()=>{try{return t.useContext(At).get().creative.copy}catch(e){return}},Lt=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),_t=i.compose(i.not,i.isEmpty),Dt=i.where({url:_t,title:_t});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=Gt(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),i=Ft(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=Gt(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),i=Gt(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 Gt(e,t,n,a,i){const o=Ft(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 Ft(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 Yt=t.createContext(Ht({})),Jt=Yt.Consumer,Kt=Yt.Provider,Zt=()=>t.useContext(Yt),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:R,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),Rn=()=>t.useContext(Tn).get(),jn=t.createContext("ENABLED"),Nn=()=>t.useContext(jn);function Ln(e){const t=Dn(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Dn(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 _n={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function Dn(e,t=_n){return["images","links","icons","copy","responseOptionsMap"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Object.assign(Object.assign({},t[n]),e[n])})),t)}const kn=t.createContext(Ln({}));kn.Consumer;const Pn=kn.Provider,$n=()=>t.useContext(kn),Gn=t.createContext({});function Fn({info:e,children:n}){const a=t.useContext(Gn);return t.createElement(Gn.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 Yn=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")),Jn=i.compose(i.isEmpty,i.prop("predicates"));function Kn(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(Kn(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([Yn,Jn]);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"]);function ga(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);return t.map((e=>"Placeholder"===e.type?"TextValue"===e.predicate.type?o(e):n(e):e))}const ba=i.all(i.equals(!0));function Ia(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=ga(l,e);return ba(fa(o,t,s,n))}),e)),[o,e,s,n,l])}function Ea(e){e&&(e.style.display="")}function Sa(e){e&&(e.style.display="none")}function xa(e){return e.settings.duration}const Ca=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],wa=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function Oa(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const a=t?Ca:wa,i=e.animate(a,{duration:n,iterations:1});return i.onfinish=()=>{t?Ea(e):Sa(e)},i.oncancel=()=>{t?Ea(e):Sa(e)},()=>{i.finish()}}return t?Ea(e):Sa(e),()=>{}}function Ta({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)Oa(e,t,n)}(r.current,a,xa(e),e.type)})):!a&&n?n.forEach((e=>{r.current&&function(e,t,n,a){if("FadeOut"===a)Oa(e,t,n)}(r.current,a,xa(e),e.type)})):()=>{}),[a]),t.createElement("div",{ref:r,style:{display:"none"},className:o},i)}function Aa(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=ga(Zt(),e);return t.useMemo((()=>ba(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(Ta,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:a},i):"functionally"===e.schema.hide?t.createElement(jn.Provider,{value:a?"ENABLED":"DISABLED"},i):a?t.createElement(t.Fragment,null,i):null}const Ra=i.mergeWith(((e,t)=>`${e||""} ${t||""}`.trim())),ja=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=Ia(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 Na(e){const n=Ct();return t.createElement(ja,{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 La(e){const n=Ct();return t.createElement(ja,{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"]},Da=new Map([["&","_;^;_"]]),ka=new RegExp(`<a *(?=${_a.allowedAttributes.a.join("|")}|>)`,"g"),Pa=new RegExp('<a [^>]*href="([^"]+)"',"g"),$a=new RegExp("(<br *?>)|(<br *?/>)","g"),Ga="<br/>";function Fa(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(Pa,((e,t)=>{const n=t.replaceAll("&",Da.get("&"));return e.replace(t,n)})).replaceAll($a,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(ja,{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(ka,`<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(ka,`<a ${a.join(" ")}`)}});var l})):null}function Ma(e){const n=Zt()(e.schema.value),a=Nn(),{tabIndex:i,styles:o,isDisabled:r}=m(a);return n?t.createElement(ja,{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 Ba(e,n,a){if("BasicText"===e.type)return t.createElement(Ma,{schema:e.node,testId:n,isInline:null!=a&&a})}function Ua(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,U(t,a)))))}function Va(e){const n=bt(),a=Ct(),i=jt(),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(ja,{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(Kt,{value:d},(null==o?void 0:o.own)?function(e,n,a,i,o){return t.createElement(Xt,{value:a(n)},Ua(e,i,o))}(e.schema.children,o.own,r,a,e.testId):Ua(e.schema.children,a,e.testId)))})):null}function za(e){const n=Nn(),{styles:a,isDisabled:i}=m(n);return e.schema.url.light?t.createElement(ja,{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 qa(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(ja,{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 Ha={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function Wa(e){const n=e.schema.name,a=e.schema.description,i=e.schema.styles?M(Ha,e.schema.styles):Ha,o=Nn(),{styles:r,isDisabled:s}=m(o);return n?t.createElement(ja,{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:R,code:null!==(n=e.code)&&void 0!==n?n:"UNHANDLED_RENDERING_EXCEPTION",message:e.message,additionalInformation:Object.assign({componentStack:t.componentStack,stack:e.stack},this.context||{})})}render(){return this.state.errorMessage?"true"===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=Gn;const Ka={internally:"_top",externally:"_blank"};function Za(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Qa(e){var n;const a=Ka[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(ja,{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)},Za(e,i,o))}(e.schema.children,null==n?void 0:n.own,o,i,e.testId):Za(e.schema.children,i,e.testId))})):null}function Xa(e,n,a){if("StaticLink"===e.type)return t.createElement(Qa,{schema:e.node,testId:n,isInline:null!=a&&a})}const ei={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function ti(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(ei,e.schema.styles):ei,r=Nn(),{styles:s}=m(r);return i?t.createElement(ja,{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 ni=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 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"],R="ERROR",j="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 _=(e,t)=>i.concat(e,i.slice(e.length,t.length,t)),D=(e,t)=>{if(Array.isArray(e)&&Array.isArray(t)){const n=e.length>t.length?_(t,e):t,a=t.length>e.length?_(e,t):e;return i.zipWith(F,a,n)}return t},k=e=>null==e,P=e=>!k(e),$=(e,t)=>k(t)?e:t,G=(e,t)=>{throw new N("MERGE_TYPE_INCONSISTENCY",`Unable to merge values for inconsistent types, left = ${e}, right = ${t}`)};function F(e,t){return i.cond([[(e,t)=>i.type(e)!==i.type(t)&&P(e)&&P(t),G],[(e,t)=>k(e)||k(t),$],[(e,t)=>"Object"===i.type(e),i.mergeDeepWith(F)],[(e,t)=>"Array"===i.type(e),D],[i.T,i.flip(i.unary(i.identity))]])(e,t)}function M(e,t){return F(e,t)}function B(e=0){return`breakpoint-${e}px`}function U(e,t){return t?`${t}-child${e}`:void 0}const V="GLOBAL/RAISE_METRIC",z="GLOBAL/OFFER_ENGAGEMENT";function q(e){return null!=e&&"object"==typeof e&&"responseOption"in e&&E(e.responseOption)&&"fulfillment"in e&&b(e.fulfillment)}function H(e){return x(e)}function W(e){return S(e)}function Y(e){return function(e){return I(e)&&"CaptureOnly"===e.action}(e)}function J(e){return!!(C(e)||"responseOption"in e&&C(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}function K(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 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 Re(e){if(null==e||""===e)return"value must not be omitted"}function je(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 _e(e){return t=>{if(t&&"object"==typeof t&&"value"in t&&"type"in t&&"string"==typeof t.type&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t.type)&&"function"==typeof e[t.type]){const n=e[t.type](t.value);if(!n)return;return`object must have valid "value" for type: ${t.type}: ${n}`}return`value must be an object that has a "type" property that matches one of: [${Object.keys(e).join(", ")}] and a "value" property`}}function De(...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 Ge(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 Fe(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(Re,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,De(2,3,4)),n)?xe(Ie(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function We(e){return(t,n,a)=>Oe(_e({fit:Ae(e),percentage:Te,fixed:Te}),a)?xe(Ie(t,n),Ye(a)):""}function Ye(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 Je=Ge({light:je,dark:ke(Le,je)});function Ke(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(Je,n)?Ee({light:Ke(e,t,!1),dark:Ke(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=Ge({offsetX:ke(Le,Te),offsetY:ke(Le,Te),blurRadius:ke(Le,Te),spreadRadius:ke(Le,Te),color:Je}),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(Fe,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(Re,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(De(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 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")}}),Rt=e=>t.createElement(At.Provider,{value:{get:()=>e.context}},e.children),jt=()=>t.useContext(At).get(),Nt=()=>{try{return t.useContext(At).get().creative.copy}catch(e){return}},Lt=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),_t=i.compose(i.not,i.isEmpty),Dt=i.where({url:_t,title:_t});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=Gt(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),i=Ft(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=Gt(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),i=Gt(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 Gt(e,t,n,a,i){const o=Ft(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 Ft(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 Yt=t.createContext(Ht({})),Jt=Yt.Consumer,Kt=Yt.Provider,Zt=()=>t.useContext(Yt),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)},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,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"});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=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||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 m({level:R,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),Rn=()=>t.useContext(Tn).get(),jn=t.createContext("ENABLED"),Nn=()=>t.useContext(jn);function Ln(e){const t=Dn(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Dn(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 _n={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function Dn(e,t=_n){return["images","links","icons","copy","responseOptionsMap"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Object.assign(Object.assign({},t[n]),e[n])})),t)}const kn=t.createContext(Ln({}));kn.Consumer;const Pn=kn.Provider,$n=()=>t.useContext(kn),Gn=t.createContext({});function Fn({info:e,children:n}){const a=t.useContext(Gn);return t.createElement(Gn.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 Yn=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")),Jn=i.compose(i.isEmpty,i.prop("predicates"));function Kn(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(Kn(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([Yn,Jn]);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"]);function ga(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);return t.map((e=>"Placeholder"===e.type?"TextValue"===e.predicate.type?o(e):n(e):e))}const ba=i.all(i.equals(!0));function Ia(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=ga(l,e);return ba(fa(o,t,s,n))}),e)),[o,e,s,n,l])}function Ea(e){e&&(e.style.display="")}function Sa(e){e&&(e.style.display="none")}function xa(e){return e.settings.duration}const Ca=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],wa=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function Oa(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const a=t?Ca:wa,i=e.animate(a,{duration:n,iterations:1});return i.onfinish=()=>{t?Ea(e):Sa(e)},i.oncancel=()=>{t?Ea(e):Sa(e)},()=>{i.finish()}}return t?Ea(e):Sa(e),()=>{}}function Ta({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)Oa(e,t,n)}(r.current,a,xa(e),e.type)})):!a&&n?n.forEach((e=>{r.current&&function(e,t,n,a){if("FadeOut"===a)Oa(e,t,n)}(r.current,a,xa(e),e.type)})):()=>{}),[a]),t.createElement("div",{ref:r,style:{display:"none"},className:o},i)}function Aa(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=ga(Zt(),e);return t.useMemo((()=>ba(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(Ta,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:a},i):"functionally"===e.schema.hide?t.createElement(jn.Provider,{value:a?"ENABLED":"DISABLED"},i):a?t.createElement(t.Fragment,null,i):null}const Ra=i.mergeWith(((e,t)=>`${e||""} ${t||""}`.trim())),ja=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=Ia(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 Na(e){const n=Ct();return t.createElement(ja,{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 La(e){const n=Ct();return t.createElement(ja,{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"]},Da=new Map([["&","_;^;_"]]),ka=new RegExp(`<a *(?=${_a.allowedAttributes.a.join("|")}|>)`,"g"),Pa=new RegExp('<a [^>]*href="([^"]+)"',"g"),$a=new RegExp("(<br *?>)|(<br *?/>)","g"),Ga="<br/>";function Fa(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(Pa,((e,t)=>{const n=t.replaceAll("&",Da.get("&"));return e.replace(t,n)})).replaceAll($a,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}=h(a);return i?t.createElement(ja,{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(ka,`<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(ka,`<a ${a.join(" ")}`)}});var l})):null}function Ma(e){const n=Zt()(e.schema.value),a=Nn(),{tabIndex:i,styles:o,isDisabled:r}=h(a);return n?t.createElement(ja,{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 Ba(e,n,a){if("BasicText"===e.type)return t.createElement(Ma,{schema:e.node,testId:n,isInline:null!=a&&a})}function Ua(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,U(t,a)))))}function Va(e){const n=bt(),a=Ct(),i=jt(),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}=h(s);return I(l)&&!c&&void 0!==r?t.createElement(ja,{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(Kt,{value:d},(null==o?void 0:o.own)?function(e,n,a,i,o){return t.createElement(Xt,{value:a(n)},Ua(e,i,o))}(e.schema.children,o.own,r,a,e.testId):Ua(e.schema.children,a,e.testId)))})):null}function za(e){const n=Nn(),{styles:a,isDisabled:i}=h(n);return e.schema.url.light?t.createElement(ja,{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 qa(e){const n=Nn(),{styles:a,isDisabled:i}=h(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(ja,{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 Ha={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function Wa(e){const n=e.schema.name,a=e.schema.description,i=e.schema.styles?M(Ha,e.schema.styles):Ha,o=Nn(),{styles:r,isDisabled:s}=h(o);return n?t.createElement(ja,{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:R,code:null!==(n=e.code)&&void 0!==n?n:"UNHANDLED_RENDERING_EXCEPTION",message:e.message,additionalInformation:Object.assign({componentStack:t.componentStack,stack:e.stack},this.context||{})})}render(){return this.state.errorMessage?"true"===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=Gn;const Ka={internally:"_top",externally:"_blank"};function Za(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Qa(e){var n;const a=Ka[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(ja,{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)},Za(e,i,o))}(e.schema.children,null==n?void 0:n.own,o,i,e.testId):Za(e.schema.children,i,e.testId))})):null}function Xa(e,n,a){if("StaticLink"===e.type)return t.createElement(Qa,{schema:e.node,testId:n,isInline:null!=a&&a})}const ei={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function ti(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(ei,e.schema.styles):ei,r=Nn(),{styles:s}=h(r);return i?t.createElement(ja,{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 ni=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 ai(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(ja,{styles:e.schema.styles},(({classnames:i})=>{var o;return t.createElement("div",{ref:a,className:[ni,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 ii={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 oi(e){const[n,a]=t.useState(!1),[i,o]=t.useState(!1),r=zn(),s=Nn(),l=an(),c=bt(),{customStateKey:d,customStateValue:u,label:p,a11yLabel:f,thumb:y}=e.schema,{containerClass:h,trackClass:v,fillClass:b,thumbClass:I,labelClass:E,buttonClass:S}=function(e,t){const n=ft(e,t);return{containerClass:n`
9
+ `;function ai(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(ja,{styles:e.schema.styles},(({classnames:i})=>{var o;return t.createElement("div",{ref:a,className:[ni,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 ii={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 oi(e){const[n,a]=t.useState(!1),[i,o]=t.useState(!1),r=zn(),s=Nn(),l=an(),c=bt(),{customStateKey:d,customStateValue:u,label:p,a11yLabel:f,thumb:y}=e.schema,{containerClass:m,trackClass:v,fillClass:b,thumbClass:I,labelClass:E,buttonClass:S}=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);if(!d)throw new Error("No custom state key provided for state trigger node.");const x={type:X,payload:{key:d,value:null!=u?u:1}},C={type:Z,payload:{name:"SignalUserInteraction",action:"Swipe",context:"SlideStateTrigger"}},w=e.schema.styles?M(ii,e.schema.styles):ii,O=t.useRef(null),T=t.useRef(null),A=t.useRef(null),R=t.useRef(!1),j=t.useRef(void 0),{isDisabled:N}=m(s);t.useEffect((()=>{if(n)return g()?(document.addEventListener("touchmove",D),document.addEventListener("touchend",L)):(document.addEventListener("mousemove",D),document.addEventListener("mouseup",L)),F}),[n]);const L=()=>{F(),j.current=void 0,a(!1),i||(G(!0),R.current?($(P()),k()):$(0))},_=e=>{n||i||N||(j.current=si(e),G(!1),a(!0))},D=e=>{var t,n;if(ri(A)){const a=Math.min(Math.max(0,(null!==(t=si(e))&&void 0!==t?t:0)-(null!==(n=j.current)&&void 0!==n?n:0)),P());$(a),a/P()*100>=75?R.current=!0:R.current=!1}},k=()=>{var e,t;o(!0),c(x),c(C),null===(t=null===(e=ri(O).parentElement)||void 0===e?void 0:e.parentElement)||void 0===t||t.focus()},P=()=>ri(O).getBoundingClientRect().width-ri(A).getBoundingClientRect().width,$=e=>{var t;ri(A).style.transform=`translateX(${e}px)`,ri(T).style.transform=`translateX(${e+(null===(t=ri(A))||void 0===t?void 0:t.getBoundingClientRect().width)/2}px)`},G=e=>{e?(ri(A).style.transition="transform .2s",ri(T).style.transition="transform .2s"):(ri(A).style.transition="",ri(T).style.transition="")},F=()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",L),document.removeEventListener("touchmove",D),document.removeEventListener("touchend",L)};return t.createElement(ja,{styles:w},(({classnames:n})=>{var a,o,r,s,l,c;return t.createElement("div",{className:`${h}`,"data-testid":e.testId,"data-e2e":"SlideStateTrigger"},t.createElement("div",{className:`${v} ${null!==(a=null==n?void 0:n.own)&&void 0!==a?a:""}`,ref:O,"aria-hidden":!0,"data-testid":e.testId&&`${e.testId}-track`},(null==p?void 0:p.value)?t.createElement("div",{className:`${E} ${null!==(o=null==n?void 0:n.label)&&void 0!==o?o:""}`,"data-testid":e.testId&&`${e.testId}-label`},p.value):null,t.createElement("div",{className:`${b} ${null!==(r=null==n?void 0:n.fill)&&void 0!==r?r:""}`,ref:T,"data-testid":e.testId&&`${e.testId}-fill`}),t.createElement("div",{className:`${I} ${null!==(s=null==n?void 0:n.thumb)&&void 0!==s?s:""}`,ref:A,"data-testid":e.testId&&`${e.testId}-thumb`,"data-e2e":"SlideStateTrigger-thumb",onMouseDown:_,onTouchStart:_},null!==(l=null==y?void 0:y.icon)&&void 0!==l?l:"ArrowForward")),t.createElement("button",{className:S,"aria-label":null!=f?f:void 0,onClick:k,disabled:i||N,"data-testid":e.testId&&`${e.testId}-button`},null!==(c=null==p?void 0:p.value)&&void 0!==c?c:"Unlock Offers"))}))}function ri(e){if(!e.current)throw new Error("Unexpected missing reference to required SlideStateTrigger Element");return e.current}function si(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientX:e.clientX}function li(e){const n=Ct();return t.createElement(ja,{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 ci(e){const n=Nn(),a=bt(),i=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(ja,{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 di(e){const n=Ct();return t.createElement(ja,{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 ui(e){const n=Ct();return t.createElement(ja,{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 pi=t.createContext({extensions:{ctx:new Map,cache:[]}}),fi=()=>t.useContext(pi).extensions;function yi({extensions:e,extendStore:n,children:a}){const i=fi(),o=new Map([...i.ctx,...e.ctx]),r=i.cache.concat(e.cache);return t.createElement(pi.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 mi({data:e}){const n=hi(fi(),e);var a;if((e=>{const{extendStore:n,extensions:a}=t.useContext(pi);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 vi(e,n){if(v("Extension",e))return t.createElement(mi,{data:e.node.data})}function gi(e){const n=$n(),a=jt(),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(ja,{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(Kt,{value:l(a)},o(e.schema.template,void 0,U(i,e.testId))))))))))):null}const bi={BasicText:(e,t)=>Ba(e,t,!0),StaticLink:(e,t)=>Xa(e,t,!0)};function Ii(e){const n=Ct();return t.createElement(wt,{value:n,overrides:bi},t.createElement(xt,null,(n=>t.createElement(ja,{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 Ei(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}=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(ja,{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(Kt,{value:r},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(Xt,{value:a(n)},Ei(e,i,o))}(e.schema.children,n.own,a,o,e.testId):Ei(e.schema.children,o,e.testId)))}))}function xi(e){const n=bt(),a=e.schema.delay?e.schema.delay:1,i=e.schema.customStateKey,o=Et(0,(e=>e.customStates[i]));return function({delay:e,callback:n}){const a=t.useRef(null);t.useEffect((()=>{a.current=setTimeout(n,e)}),[])}({delay:a,callback:()=>{n({type:X,payload:{key:i,value:o?0:1}})}}),null}function Ci(e){const n=Nn(),a=Zt()(e.schema.value),i=bt(),o=e.schema.customStateKey,r=Et(0,(e=>e.customStates[o])),{tabIndex:s,styles:l,isDisabled:c}=m(n),d=()=>{navigator.clipboard.writeText(a),r||i({type:X,payload:{key:o,value:1}})};return t.createElement(ja,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:d,"data-testid":e.testId,"data-e2e":"CopyToClipboardButton",disabled:c,"aria-disabled":c,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:s,style:Object.assign({cursor:"pointer"},l)},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 wi(e){const n=Nn(),a=bt(),{customStateKey:i,value:o}=e.schema,{tabIndex:r,styles:s,isDisabled:l}=m(n),c=()=>{a({type:X,payload:{key:i,value:o}})};return t.createElement(ja,{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 Oi({schema:e,testId:n}){var a,o,r,s,l,c,u,p;const f=$n(),y=jt(),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`,R={overflow:"hidden"},j={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:A,alignItems:"stretch"},N=e.peekThroughSize[Math.min(E,e.peekThroughSize.length-1)],L=N?"fixed"===(_=N).type?`${_.value}px`:`${_.value}%`:"0px";var _;const D=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} - (${D} + 1) * ${A})/${D}`:`(100% - (${D} - 1) * ${A})/${D}`})`,position:"relative",display:"flex",backgroundColor:"transparent"};return g.length>0?t.createElement(ja,{styles:e.styles},(({classnames:a})=>t.createElement("div",{ref:T,style:Object.assign(Object.assign({},R),w),"aria-disabled":C,tabIndex:x,className:null==a?void 0:a.own,"data-e2e":"CarouselDistribution","data-testid":n&&`${n}`},t.createElement("div",{style:j,"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(Kt,{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 Ti(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 Ai={Column:function(e,n){if("Column"===e.type)return t.createElement(Na,{schema:e.node,testId:n})},Row:function(e,n){if("Row"===e.type)return t.createElement(La,{schema:e.node,testId:n})},StaticImage:function(e,n){if("StaticImage"===e.type)return t.createElement(za,{schema:e.node,testId:n})},DataImage:function(e,n){if("DataImage"===e.type)return t.createElement(qa,{schema:e.node,testId:n})},CreativeResponse:function(e,n){if("CreativeResponse"===e.type)return t.createElement(Va,{schema:e.node,testId:n})},OneByOneDistribution:Ti("OneByOneDistribution"),StackedDistribution:Ti("StackedDistribution"),CarouselDistribution:Ti("CarouselDistribution"),GroupedDistribution:Ti("GroupedDistribution"),ProgressIndicator:Ti("ProgressIndicator"),ProgressControl:Ti("ProgressControl"),When:function(e,n){if("When"===e.type)return t.createElement(Aa,{schema:e.node,testId:n})},Overlay:Ti("Overlay"),CloseButton:Ti("CloseButton"),RichText:function(e,n){if("RichText"===e.type)return t.createElement(Fa,{schema:e.node,testId:n})},BasicText:Ba,StaticLink:Xa,DataIcon:function(e,n){if("DataIcon"===e.type)return t.createElement(ti,{schema:e.node,testId:n})},StaticIcon:function(e,n){if("StaticIcon"===e.type)return t.createElement(Wa,{schema:e.node,testId:n})},ZStack:function(e,n){if("ZStack"===e.type)return t.createElement(ai,{schema:e.node,testId:n})},FlowRow:function(e,n){if("FlowRow"===e.type)return t.createElement(li,{schema:e.node,testId:n})},SlideStateTrigger:function(e,n){if("SlideStateTrigger"===e.type)return t.createElement(oi,{schema:e.node,testId:n})},ToggleButtonStateTrigger:function(e,n){if("ToggleButtonStateTrigger"===e.type)return t.createElement(ci,{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(xi,{schema:e.node})},CatalogStackedCollection:function(e,n){if("CatalogStackedCollection"===e.type)return t.createElement(gi,{schema:e.node,testId:n})},CatalogResponseButton:Ti("CatalogResponseButton"),ScrollableRow:function(e,n){if("ScrollableRow"===e.type)return t.createElement(di,{schema:e.node,testId:n})},ScrollableColumn:function(e,n){if("ScrollableColumn"===e.type)return t.createElement(ui,{schema:e.node,testId:n})},EscapeHatch:vi,BottomSheet:Ti("BottomSheet"),CatalogQuantityOption:Ti("CatalogQuantityOption"),CatalogRadioGroup:Ti("CatalogRadioGroup"),CatalogQuantityCounter:Ti("CatalogQuantityCounter"),InlineContainer:function(e,n){if("InlineContainer"===e.type)return t.createElement(Ii,{schema:e.node,testId:n})},CopyToClipboardButton:function(e,n){if("CopyToClipboardButton"===e.type)return t.createElement(Ci,{schema:e.node,testId:n})},ButtonStateTrigger:function(e,n){if("ButtonStateTrigger"===e.type)return t.createElement(wi,{schema:e.node,testId:n})},CatalogCombinedCollection:Ti("CatalogCombinedCollection"),CatalogCarouselCollection:function(e,n){if("CatalogCarouselCollection"===e.type)return t.createElement(Oi,{schema:e.node,testId:n})},IconGroup:Ti("IconGroup")};function Ri(e){return function(n,a,i){const o=a&&a[n.type],r=null!=o?o:Ai[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 ji={transformLinksToAnchorText:function(e={}){return{data:i.mapObjIndexed((e=>Dt(e)?`<a target="_blank" href="${e.url}">${e.title}</a>`:""),e)}}};function Ni(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=Ia(r);t.useEffect((()=>{Object.entries(s).forEach((([e,t])=>{const n=o[e];t&&n&&a({type:re,payload:n})}))}),[s,o,a])}function Li(e){const{settings:n,dispatch:a,children:i}=e,o=Ht(n.offerData.creative.copy||{})(ji.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(Rt,{context:n.offerData},t.createElement(Pn,{value:Ln(n.offerData.creative)},t.createElement(jn.Provider,{value:s},t.createElement(wt,{value:r},t.createElement(nn.Provider,{value:n.offerPositionIndex},t.createElement(gt.Provider,{value:a},t.createElement(Kt,{value:o},t.createElement(_i,null,t.createElement(Ni,{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 Di(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 ki(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?Ea(e):Sa(e),o.current.isRunning=!1},r.oncancel=()=>{"in"===t?Ea(e):Sa(e),o.current.isRunning=!1},()=>{r.finish()}}return"in"===t?Ea(e):Sa(e),()=>{}}const Pi={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 $i({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=xa(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&&(Ea(l.current),t.observe(l.current)),()=>{t.disconnect()}}),[e,i]),t.useEffect((()=>e&&!r&&l.current&&i?(s(!0),ki(l.current,"in",Pi[n.type].in,d,i,c)):!e&&r&&l.current&&i?(s(!1),ki(l.current,"out",Pi[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(ja,{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 Fi="ACTIVE/ADD",Mi="ACTIVE/DELETE",Bi="BREAKPOINT/UPDATE_ACTIVE",Ui="BREAKPOINT/INITIALISE",Vi="BREAKPOINT/SET_BREAKPOINTS",zi="FONTS/SET",qi="LAYOUT/UPDATE",Hi="CONFIG/HANDLE",Wi="PLUGIN/CLOSE_PLUGIN",Yi="SETTINGS/SET",Ji="CACHE/ADD_SERIALIZED_VALUE",Ki="CACHE/UPDATE_SERIALIZED_VALUE",Zi="CACHE/CLEAR_SERIALIZED_VALUE",Qi="SIGNAL/QUEUE",Xi="SIGNAL/PROCESSED",eo="SIGNAL/PROCESS",to="OVERLAY/DISMISS_OVERLAY",no="ERROR/REPORT",ao="LOG",io="CUSTOM_STATES/SET",oo={LAYOUT_UPDATE:qi,UPDATE_ACTIVE_BREAKPOINT:Bi,INITIALISE_BREAKPOINT:Ui,ACTIVE_ADD:Fi,ACTIVE_DELETE:Mi,SET_FONTS:zi,QUEUE_SIGNAL:Qi,SIGNAL_PROCESSED:Xi,CACHE_SERIALIZED_VALUE:Ji,UPDATE_CACHED_SERIALIZED_VALUE:Ki,CLEAR_SERIALIZED_VALUE_FROM_CACHE:Zi,SET_SETTINGS:Yi,SET_CUSTOM_STATE:io},ro={HANDLE_CONFIG:Hi,SET_BREAKPOINTS:Vi,CLOSE_PLUGIN:Wi,RAISE_METRIC:V,PREPARE_SIGNAL:ne,DISMISS_OVERLAY:to,REPORT_ERROR:no,LOG:ao,OPEN_LINK:ae},so="plugin-overlay",lo="plugin";function co(n){var i;const o=n.schema.styles,r=a.useDispatch(),s={type:(null===(i=n.action)||void 0===i?void 0:i.type)||to,payload:{id:so,dismissalMethod:n.schema.dismissalMethod}},l=()=>{r(s)},c=Nn(),{tabIndex:d,styles:u,isDisabled:p}=m(c);return e.jsx(ja,{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 uo={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var po;function fo({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(lo))),u=a.useDispatch(),p=()=>{u({type:ro.DISMISS_OVERLAY,payload:{id:so,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(uo,o.styles):uo;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(ja,{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"}(po||(po={}));const yo={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(yo,t.styles):yo;return e.jsx(ja,{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 mo=a.connect((function(e){return{isOpen:e.active.has(so)}}))((function(t){return e.jsx(fo,Object.assign({},t,{children:(n,a)=>e.jsx(ho,Object.assign({},t,{ref:a,children:n}))}))}));const vo=a.connect((function(e){return{isOpen:e.active.has(so)}})),go={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const bo=t.forwardRef((function({schema:n,testId:a,children:o},r){const s=t.useRef(null),l=n.styles?i.mergeRight(go,n.styles):go;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(ja,{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 Io=vo((function(t){const n=a.useSelector((e=>e.breakpoint.activeBreakpoint));return e.jsx(fo,Object.assign({},t,{children:(a,i)=>"default"===n?e.jsx(bo,Object.assign({},t,{ref:i,children:a})):e.jsx(ho,Object.assign({},t,{ref:i,children:a}))}))}));const Eo="DisplayPreset.FULLSCREEN",So="DisplayPreset.EMBEDDED",xo="DisplayPreset.ATTACHED",Co="ERROR",wo="INFO",Oo="WARNING";var To;!function(e){e.PAYPAL="Paypal"}(To||(To={}));const Ao="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 jo(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 No(e){switch(typeof e){case"undefined":return"";case"object":return null===e?"":JSON.stringify(e);case"string":return e;default:return String(e)}}function Lo(e){return i.map(No,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*Do(e,t){const n=yield r.take(e);yield r.call(t,n)}function*ko(e){for(;;){const t=yield r.take(e);yield r.put(t)}}function*Po(e,t){const n=i.over(i.lensProp("moduleName"),i.defaultTo("orchestrator"),t.payload.additionalInformation||{}),a=Object.assign(Object.assign({},t.payload),{additionalInformation:n?Lo(n):{}});try{yield r.call(e,a)}catch(e){}t.payload.level===Co&&(yield r.put({type:ee,payload:{name:"PLACEMENT_FAILURE"}}),yield r.put({type:ro.CLOSE_PLUGIN}))}const $o="INVALID_RESPONSE_OBJECT",Go="FAILED_TO_OPEN_LINK",Fo="NO_PARENT_GUID",Mo="FAILED_TO_NOTIFY_INTERACTIVE",Bo="FAILED_TO_ESTABLISH_PARTNER_VALIDATION";var Uo=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 Vo(e,t){return n=>n&&n.replace(e,t)}const zo=Vo(/['""();{}@:[\]!/=]/g,""),qo=/^(normal|italic|oblique( \d+deg)*)$/i,Ho=(e="")=>qo.test(e)?e:void 0,Wo=Vo(/[;{}@[\]!]/g,"");function Yo(e){const{fontFamily:t,sources:n}=e,a=Uo(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:zo(e.fontFamily)||"",style:Ho(e.style),weight:zo(e.weight),sources:e.sources.map((e=>Wo(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 Ko(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=Ao.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:no,payload:{level:wo,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 Zo(e){return null!=e?e:null}function Qo(){return new Set([so])}function Xo(e){return e.breakpoint.breakpoints[e.breakpoint.activeBreakpoint]||0}const er=i.sortBy(i.prop(1)),tr=i.map(i.prop(0)),nr=e=>i.compose(i.findIndex(i.equals(e)),tr,er,i.toPairs,i.pathOr({},["breakpoint","breakpoints"]));function ar(e){return nr(e.breakpoint.activeBreakpoint)(e)}function ir(e,t){return e.customStates[`module${t}`]||{}}function or(e){return`${e.name}:${e.parentGuid}`}function rr(e,t){return!e.processed.includes(or(t))||(n=t.name,void 0!==A.find((e=>e===n)));var n}function sr(){return new Map}const lr={layout:function(e=Zo(),t){return t.type===qi?t.payload:e},breakpoint:function(e={breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},t){var n;switch(t.type){case Bi:return Object.prototype.hasOwnProperty.call(e.breakpoints,t.payload.activeBreakpoint)?Object.assign(Object.assign({},e),{activeBreakpoint:t.payload.activeBreakpoint}):e;case Ui: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=Qo(),t){var n,a;switch(t.type){case Fi:{const a=new Set(e);return a.add(null===(n=t.payload)||void 0===n?void 0:n.id),a}case Mi:{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===zi?t.payload:e},signal:function(e={queue:[],processed:[]},t){switch(t.type){case Qi:return i.evolve({queue:n=>rr(e,t.payload.signal)?i.uniqBy(i.pipe(i.prop("signal"),or),n.concat(t.payload)):n},e);case Xi: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(or(t.payload))},e);default:return e}},serializableCache:function(e=sr(),t){switch(t.type){case Ji:case Ki:if(t.payload.key&&t.payload.value){return new Map([...e]).set(t.payload.key,t.payload.value)}return e;case Zi:{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===io){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*cr(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:oo.INITIALISE_BREAKPOINT,payload:{activeBreakpoint:e,breakpoints:t.payload}});;)e=yield r.take(i),yield r.put({type:oo.UPDATE_ACTIVE_BREAKPOINT,payload:{activeBreakpoint:e}})}catch(e){const n=e;yield r.put({type:no,payload:{level:Oo,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:no,payload:{level:Co,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 dr(e,t,n){return l.eventChannel((a=>{const i=e.subscribe((e=>{const t=n(e);t&&a({type:Hi,payload:t})}),(e=>{a(e)})),o=t.fonts.subscribe((e=>{a({type:zi,payload:e})}),(e=>{a(e)}));return()=>{i.unsubscribe(),o.unsubscribe()}}),l.buffers.sliding(2))}var ur=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"}}),pr=Object.freeze({__proto__:null,PartnerMessage:{UpdateCartItem:"V2_UPDATE_CART_ITEM"},PlacementMessage:{CartItemUpdated:"V2_CART_ITEM_UPDATED"}}),fr=Object.freeze({__proto__:null,V1:ur,V2:pr}),yr=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 mr="LINK_NAVIGATION_REQUEST",vr="REALTIME_OFFER_FULFILLMENT_SUCCESS",gr="REALTIME_OFFER_FULFILLMENT_FAILURE";var br=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 Ir={newTab:"_blank",self:"_top",roktWebViewSDK:"roktWebViewSDK",inApp:"inApp",overrideLinkNavigation:"overrideLinkNavigation"};function Er({url:e,urlBehavior:t,external:n},a=window){return br(this,void 0,void 0,(function*(){if(!e)return null;if("overrideLinkNavigation"===t)return n.partner.send(mr,{url:e}).then((()=>null));const i=Ir[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:Er});function xr(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:no,payload:{level:Oo,code:i?"COMMUNICATION_FAILURE_WITH_WSDK":n,message:t,additionalInformation:Object.assign(Object.assign({},o),a)}}}var Cr=Object.freeze({__proto__:null,makePluginWarningAction:xr});function wr(e){return null!=e&&"object"==typeof e&&"ref"in e&&"object"==typeof e.ref&&!Array.isArray(e.ref)&&null!=e.ref}var Or=Object.freeze({__proto__:null,isWindow:wr}),Tr=Object.assign(Object.assign(Object.assign({},Sr),Cr),Or);function Ar(e){switch(e){case"ATTACHED":return xo;case"EMBEDDED":return So;default:return Eo}}function Rr(e,t){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e.offsetBottom&&{bottom:Ye(e.offsetBottom)}),e.offsetLeft&&{left:Ye(e.offsetLeft)}),e.offsetRight&&{right:Ye(e.offsetRight)}),e.offsetTop&&{top:Ye(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:Ye(e.maxWidth)}:void 0),t)}function*jr(e=10){(yield r.select((e=>e.signal.queue.length>0)))&&(yield c.delay(30),e>=1&&(yield*jr(e-1)))}function*Nr(e){try{yield*jr(10),yield c.call(e.close)}catch(e){const t=Tr.makePluginWarningAction(e,"Failed to close the plugin","FAILED_TO_CLOSE_PLUGIN");yield c.put(t)}}function*Lr(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*Dr(e,t){var n;const a=yield c.call(dr,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:no,payload:{level:Co,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*kr(e,t){yield c.all([c.spawn(Dr,e,t),c.takeEvery(ee,Lr,e.partnerInteractionService)])}function*Pr(e,t,n){const a=function(e,t){if(!t)return{preset:Ar(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:oo.ACTIVE_ADD,payload:{id:lo}})}function*$r(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:wo,message:t.payload.message||"Plugin Generic Log",additionalInformation:Lo(a)})}catch(e){}}function*Gr(e){yield r.put({type:oo.QUEUE_SIGNAL,payload:{signal:e.payload}}),yield r.put({type:eo})}function*Fr(e){yield r.put({type:oo.QUEUE_SIGNAL,payload:e.payload}),yield r.put({type:eo})}function*Mr(e,t){const n=yield r.select((e=>e.signal.queue.filter((t=>rr(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*Br(e.signal,a(t));break;case"SignalViewed":yield*Ur(e.signal,a(t));break;case"SignalDismissal":yield*Vr(e.signal,a(t));break;case"SignalInstantPurchaseDismissal":yield*zr(e.signal,a(t));break;case"SignalLoadStart":yield*qr(e.signal,a(t));break;case"SignalGatedResponse":case"SignalResponse":yield*Hr(e.signal,a(t,!0));break;case"SignalProductItemResponse":yield*Wr(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*Kr(e.signal,a(t));break;case"SignalCartItemInstantPurchase":yield*Zr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseFailure":yield*Qr(e.signal,a(t))}yield r.put({type:oo.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*Br(e,t){let n;e.creativeInstanceGuid&&(n={},n.creativeInstanceGuid=e.creativeInstanceGuid);try{yield t(e.name,e.parentGuid,n)}catch(t){yield Xr(e,t)}}function*Ur(e,t){try{yield t(e.name,e.parentGuid,{objectData:{supportedByBrowser:e.supportedByBrowser.toString()},metadata:[{name:"inferred",value:e.inferred.toString()}]})}catch(t){yield Xr(e,t)}}function*Vr(e,t){try{yield t(e.name,e.parentGuid,e.dismissalMethod?{objectData:{dismissalMethod:e.dismissalMethod}}:void 0)}catch(t){yield Xr(e,t)}}function*zr(e,t){try{yield t(e.name,e.parentGuid,void 0)}catch(t){yield Xr(e,t)}}function*qr(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 Xr(e,t)}}function*Hr(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 Xr(e,t)}}function*Wr(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 Xr(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 Xr(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 Xr(e,t)}}function*Kr(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 Xr(e,t)}}function*Zr(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 Xr(e,t)}}function*Qr(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 Xr(e,t)}}function Xr(e,t){const n=Tr.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*es(e){yield r.put({type:io,payload:e.payload})}function*ts(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:no,payload:{level:wo,code:Mo,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*ns(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(Er,{url:t.payload.url,urlBehavior:n,external:e})}catch(e){yield r.put(xr(e,"Failed to open link",Go,{url:t.payload.url,urlBehaviour:n}))}}function*as(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:oo.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Wi}),t?yield r.put({type:Z,payload:{name:"SignalDismissal",parentGuid:t,dismissalMethod:e.payload.dismissalMethod}}):yield r.put({type:no,payload:{level:wo,code:Fo,message:"ParentGuid does not exist"}})}const is=a.connect((function(e){return{isOpen:e.active.has(so)}})),os="undefined"!=typeof window;function rs(e,n){t.useEffect((()=>{if(!os||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 ss="Minimized",ls=()=>{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[ss])),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);rs(e,!!r);const h=t.useCallback((()=>{D(),f.current=void 0,d.current=!1,N(!0);v()?S():j(0)}),[]),v=()=>{const e=R();return r?e<=-.2:e>=.2};t.useEffect((()=>{r?(C(),s(ds(!0))):(w(),s(ds(!1)))}),[r,s]),t.useEffect((()=>{requestAnimationFrame((()=>{_(!r,a),_(!!r,i),L()}))}),[]);const b=t.useCallback((e=>{if(n.current){e.preventDefault();const t=E(e);j(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=cs(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=cs(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:ss,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),j(s),_(!1,a),_(!0,i),P()},w=()=>{N(!0),L(!0,!1),j(0),f.current=void 0,_(!0,a),_(!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]),R=()=>{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},j=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")},_=(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)},D=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 cs(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientY:e.clientY}const ds=e=>({type:Z,payload:{action:e?"BottomSheetMinimized":"BottomSheetMaximized",name:"SignalUserInteraction",context:"BottomSheetMinimized"}}),us={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var ps;function fs({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(lo))),c=t.useRef(null),d=a.useDispatch(),u=()=>{d({type:ro.DISMISS_OVERLAY,payload:{id:so,dismissalMethod:"rokt_backdrop"}})},p=Et(0,(e=>e.customStates[ss]));t.useEffect((()=>{f(!!p)}),[p]),rs(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(us,n.styles):us;return e.jsx(ja,{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 ys(){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"}(ps||(ps={}));const hs={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};function ms(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(vs,Object.assign({},t,{slots:n,currentIndex:i}))}function vs(t){const{wrapperRef:n,containerRef:a,minimizedChildRef:i,maximizedChildRef:o}=ls();return t.isOpen?e.jsxs("div",{ref:n,style:{height:"100000px"},children:[e.jsx(fs,Object.assign({},t)),e.jsx(bs,Object.assign({},t,{containerRef:a,minimizedChildRef:i,maximizedChildRef:o}))]}):null}const gs=o.css`
57
+ `}}(r,l);if(!d)throw new Error("No custom state key provided for state trigger node.");const x={type:X,payload:{key:d,value:null!=u?u:1}},C={type:Z,payload:{name:"SignalUserInteraction",action:"Swipe",context:"SlideStateTrigger"}},w=e.schema.styles?M(ii,e.schema.styles):ii,O=t.useRef(null),T=t.useRef(null),A=t.useRef(null),R=t.useRef(!1),j=t.useRef(void 0),{isDisabled:N}=h(s);t.useEffect((()=>{if(n)return g()?(document.addEventListener("touchmove",D),document.addEventListener("touchend",L)):(document.addEventListener("mousemove",D),document.addEventListener("mouseup",L)),F}),[n]);const L=()=>{F(),j.current=void 0,a(!1),i||(G(!0),R.current?($(P()),k()):$(0))},_=e=>{n||i||N||(j.current=si(e),G(!1),a(!0))},D=e=>{var t,n;if(ri(A)){const a=Math.min(Math.max(0,(null!==(t=si(e))&&void 0!==t?t:0)-(null!==(n=j.current)&&void 0!==n?n:0)),P());$(a),a/P()*100>=75?R.current=!0:R.current=!1}},k=()=>{var e,t;o(!0),c(x),c(C),null===(t=null===(e=ri(O).parentElement)||void 0===e?void 0:e.parentElement)||void 0===t||t.focus()},P=()=>ri(O).getBoundingClientRect().width-ri(A).getBoundingClientRect().width,$=e=>{var t;ri(A).style.transform=`translateX(${e}px)`,ri(T).style.transform=`translateX(${e+(null===(t=ri(A))||void 0===t?void 0:t.getBoundingClientRect().width)/2}px)`},G=e=>{e?(ri(A).style.transition="transform .2s",ri(T).style.transition="transform .2s"):(ri(A).style.transition="",ri(T).style.transition="")},F=()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",L),document.removeEventListener("touchmove",D),document.removeEventListener("touchend",L)};return t.createElement(ja,{styles:w},(({classnames:n})=>{var a,o,r,s,l,c;return t.createElement("div",{className:`${m}`,"data-testid":e.testId,"data-e2e":"SlideStateTrigger"},t.createElement("div",{className:`${v} ${null!==(a=null==n?void 0:n.own)&&void 0!==a?a:""}`,ref:O,"aria-hidden":!0,"data-testid":e.testId&&`${e.testId}-track`},(null==p?void 0:p.value)?t.createElement("div",{className:`${E} ${null!==(o=null==n?void 0:n.label)&&void 0!==o?o:""}`,"data-testid":e.testId&&`${e.testId}-label`},p.value):null,t.createElement("div",{className:`${b} ${null!==(r=null==n?void 0:n.fill)&&void 0!==r?r:""}`,ref:T,"data-testid":e.testId&&`${e.testId}-fill`}),t.createElement("div",{className:`${I} ${null!==(s=null==n?void 0:n.thumb)&&void 0!==s?s:""}`,ref:A,"data-testid":e.testId&&`${e.testId}-thumb`,"data-e2e":"SlideStateTrigger-thumb",onMouseDown:_,onTouchStart:_},null!==(l=null==y?void 0:y.icon)&&void 0!==l?l:"ArrowForward")),t.createElement("button",{className:S,"aria-label":null!=f?f:void 0,onClick:k,disabled:i||N,"data-testid":e.testId&&`${e.testId}-button`},null!==(c=null==p?void 0:p.value)&&void 0!==c?c:"Unlock Offers"))}))}function ri(e){if(!e.current)throw new Error("Unexpected missing reference to required SlideStateTrigger Element");return e.current}function si(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientX:e.clientX}function li(e){const n=Ct();return t.createElement(ja,{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 ci(e){const n=Nn(),a=bt(),i=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(ja,{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 di(e){const n=Ct();return t.createElement(ja,{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 ui(e){const n=Ct();return t.createElement(ja,{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 pi=t.createContext({extensions:{ctx:new Map,cache:[]}}),fi=()=>t.useContext(pi).extensions;function yi({extensions:e,extendStore:n,children:a}){const i=fi(),o=new Map([...i.ctx,...e.ctx]),r=i.cache.concat(e.cache);return t.createElement(pi.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 hi({data:e}){const n=mi(fi(),e);var a;if((e=>{const{extendStore:n,extensions:a}=t.useContext(pi);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 vi(e,n){if(v("Extension",e))return t.createElement(hi,{data:e.node.data})}function gi(e){const n=$n(),a=jt(),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(ja,{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(Kt,{value:l(a)},o(e.schema.template,void 0,U(i,e.testId))))))))))):null}const bi={BasicText:(e,t)=>Ba(e,t,!0),StaticLink:(e,t)=>Xa(e,t,!0)};function Ii(e){const n=Ct();return t.createElement(wt,{value:n,overrides:bi},t.createElement(xt,null,(n=>t.createElement(ja,{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 Ei(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(ja,{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(Kt,{value:r},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(Xt,{value:a(n)},Ei(e,i,o))}(e.schema.children,n.own,a,o,e.testId):Ei(e.schema.children,o,e.testId)))}))}function xi(e){const n=bt(),a=e.schema.delay?e.schema.delay:1,i=e.schema.customStateKey,o=Et(0,(e=>e.customStates[i]));return function({delay:e,callback:n}){const a=t.useRef(null);t.useEffect((()=>{a.current=setTimeout(n,e)}),[])}({delay:a,callback:()=>{n({type:X,payload:{key:i,value:o?0:1}})}}),null}function Ci(e){const n=Nn(),a=Zt()(e.schema.value),i=bt(),o=e.schema.customStateKey,r=Et(0,(e=>e.customStates[o])),{tabIndex:s,styles:l,isDisabled:c}=h(n),d=()=>{navigator.clipboard.writeText(a),r||i({type:X,payload:{key:o,value:1}})};return t.createElement(ja,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:d,"data-testid":e.testId,"data-e2e":"CopyToClipboardButton",disabled:c,"aria-disabled":c,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:s,style:Object.assign({cursor:"pointer"},l)},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 wi(e){const n=Nn(),a=bt(),{customStateKey:i,value:o}=e.schema,{tabIndex:r,styles:s,isDisabled:l}=h(n),c=()=>{a({type:X,payload:{key:i,value:o}})};return t.createElement(ja,{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 Oi({schema:e,testId:n}){var a,o,r,s,l,c,u,p;const f=$n(),y=jt(),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})),S=Nn(),{tabIndex:x,isDisabled:C,styles:w}=h(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`,R={overflow:"hidden"},j={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:A,alignItems:"stretch"},N=e.peekThroughSize[Math.min(E,e.peekThroughSize.length-1)],L=N?"fixed"===(_=N).type?`${_.value}px`:`${_.value}%`:"0px";var _;const D=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} - (${D} + 1) * ${A})/${D}`:`(100% - (${D} - 1) * ${A})/${D}`})`,position:"relative",display:"flex",backgroundColor:"transparent"};return g.length>0?t.createElement(ja,{styles:e.styles},(({classnames:a})=>t.createElement("div",{ref:T,style:Object.assign(Object.assign({},R),w),"aria-disabled":C,tabIndex:x,className:null==a?void 0:a.own,"data-e2e":"CarouselDistribution","data-testid":n&&`${n}`},t.createElement("div",{style:j,"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(Kt,{value:I(a)},t.createElement("div",{style:k,"data-testid":n&&`${n}-slide-${i}`,"data-e2e":`CarouselDistribution-Slide-${i}`},m(e.template,void 0,U(i,n))))))))))))):null}function Ti(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 Ai={Column:function(e,n){if("Column"===e.type)return t.createElement(Na,{schema:e.node,testId:n})},Row:function(e,n){if("Row"===e.type)return t.createElement(La,{schema:e.node,testId:n})},StaticImage:function(e,n){if("StaticImage"===e.type)return t.createElement(za,{schema:e.node,testId:n})},DataImage:function(e,n){if("DataImage"===e.type)return t.createElement(qa,{schema:e.node,testId:n})},CreativeResponse:function(e,n){if("CreativeResponse"===e.type)return t.createElement(Va,{schema:e.node,testId:n})},OneByOneDistribution:Ti("OneByOneDistribution"),StackedDistribution:Ti("StackedDistribution"),CarouselDistribution:Ti("CarouselDistribution"),GroupedDistribution:Ti("GroupedDistribution"),ProgressIndicator:Ti("ProgressIndicator"),ProgressControl:Ti("ProgressControl"),When:function(e,n){if("When"===e.type)return t.createElement(Aa,{schema:e.node,testId:n})},Overlay:Ti("Overlay"),CloseButton:Ti("CloseButton"),RichText:function(e,n){if("RichText"===e.type)return t.createElement(Fa,{schema:e.node,testId:n})},BasicText:Ba,StaticLink:Xa,DataIcon:function(e,n){if("DataIcon"===e.type)return t.createElement(ti,{schema:e.node,testId:n})},StaticIcon:function(e,n){if("StaticIcon"===e.type)return t.createElement(Wa,{schema:e.node,testId:n})},ZStack:function(e,n){if("ZStack"===e.type)return t.createElement(ai,{schema:e.node,testId:n})},FlowRow:function(e,n){if("FlowRow"===e.type)return t.createElement(li,{schema:e.node,testId:n})},SlideStateTrigger:function(e,n){if("SlideStateTrigger"===e.type)return t.createElement(oi,{schema:e.node,testId:n})},ToggleButtonStateTrigger:function(e,n){if("ToggleButtonStateTrigger"===e.type)return t.createElement(ci,{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(xi,{schema:e.node})},CatalogStackedCollection:function(e,n){if("CatalogStackedCollection"===e.type)return t.createElement(gi,{schema:e.node,testId:n})},CatalogResponseButton:Ti("CatalogResponseButton"),ScrollableRow:function(e,n){if("ScrollableRow"===e.type)return t.createElement(di,{schema:e.node,testId:n})},ScrollableColumn:function(e,n){if("ScrollableColumn"===e.type)return t.createElement(ui,{schema:e.node,testId:n})},EscapeHatch:vi,BottomSheet:Ti("BottomSheet"),CatalogQuantityOption:Ti("CatalogQuantityOption"),CatalogRadioGroup:Ti("CatalogRadioGroup"),CatalogQuantityCounter:Ti("CatalogQuantityCounter"),InlineContainer:function(e,n){if("InlineContainer"===e.type)return t.createElement(Ii,{schema:e.node,testId:n})},CopyToClipboardButton:function(e,n){if("CopyToClipboardButton"===e.type)return t.createElement(Ci,{schema:e.node,testId:n})},ButtonStateTrigger:function(e,n){if("ButtonStateTrigger"===e.type)return t.createElement(wi,{schema:e.node,testId:n})},CatalogCombinedCollection:Ti("CatalogCombinedCollection"),CatalogCarouselCollection:function(e,n){if("CatalogCarouselCollection"===e.type)return t.createElement(Oi,{schema:e.node,testId:n})},IconGroup:Ti("IconGroup")};function Ri(e){return function(n,a,i){const o=a&&a[n.type],r=null!=o?o:Ai[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 ji={transformLinksToAnchorText:function(e={}){return{data:i.mapObjIndexed((e=>Dt(e)?`<a target="_blank" href="${e.url}">${e.title}</a>`:""),e)}}};function Ni(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=Ia(r);t.useEffect((()=>{Object.entries(s).forEach((([e,t])=>{const n=o[e];t&&n&&a({type:re,payload:n})}))}),[s,o,a])}function Li(e){const{settings:n,dispatch:a,children:i}=e,o=Ht(n.offerData.creative.copy||{})(ji.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(Rt,{context:n.offerData},t.createElement(Pn,{value:Ln(n.offerData.creative)},t.createElement(jn.Provider,{value:s},t.createElement(wt,{value:r},t.createElement(nn.Provider,{value:n.offerPositionIndex},t.createElement(gt.Provider,{value:a},t.createElement(Kt,{value:o},t.createElement(_i,null,t.createElement(Ni,{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=>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 Di(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 ki(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?Ea(e):Sa(e),o.current.isRunning=!1},r.oncancel=()=>{"in"===t?Ea(e):Sa(e),o.current.isRunning=!1},()=>{r.finish()}}return"in"===t?Ea(e):Sa(e),()=>{}}const Pi={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 $i({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=xa(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&&(Ea(l.current),t.observe(l.current)),()=>{t.disconnect()}}),[e,i]),t.useEffect((()=>e&&!r&&l.current&&i?(s(!0),ki(l.current,"in",Pi[n.type].in,d,i,c)):!e&&r&&l.current&&i?(s(!1),ki(l.current,"out",Pi[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(ja,{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 Fi="ACTIVE/ADD",Mi="ACTIVE/DELETE",Bi="BREAKPOINT/UPDATE_ACTIVE",Ui="BREAKPOINT/INITIALISE",Vi="BREAKPOINT/SET_BREAKPOINTS",zi="FONTS/SET",qi="LAYOUT/UPDATE",Hi="CONFIG/HANDLE",Wi="PLUGIN/CLOSE_PLUGIN",Yi="SETTINGS/SET",Ji="CACHE/ADD_SERIALIZED_VALUE",Ki="CACHE/UPDATE_SERIALIZED_VALUE",Zi="CACHE/CLEAR_SERIALIZED_VALUE",Qi="SIGNAL/QUEUE",Xi="SIGNAL/PROCESSED",eo="SIGNAL/PROCESS",to="OVERLAY/DISMISS_OVERLAY",no="ERROR/REPORT",ao="LOG",io="CUSTOM_STATES/SET",oo={LAYOUT_UPDATE:qi,UPDATE_ACTIVE_BREAKPOINT:Bi,INITIALISE_BREAKPOINT:Ui,ACTIVE_ADD:Fi,ACTIVE_DELETE:Mi,SET_FONTS:zi,QUEUE_SIGNAL:Qi,SIGNAL_PROCESSED:Xi,CACHE_SERIALIZED_VALUE:Ji,UPDATE_CACHED_SERIALIZED_VALUE:Ki,CLEAR_SERIALIZED_VALUE_FROM_CACHE:Zi,SET_SETTINGS:Yi,SET_CUSTOM_STATE:io},ro={HANDLE_CONFIG:Hi,SET_BREAKPOINTS:Vi,CLOSE_PLUGIN:Wi,RAISE_METRIC:V,PREPARE_SIGNAL:ne,DISMISS_OVERLAY:to,REPORT_ERROR:no,LOG:ao,OPEN_LINK:ae},so="plugin-overlay",lo="plugin";function co(n){var i;const o=n.schema.styles,r=a.useDispatch(),s={type:(null===(i=n.action)||void 0===i?void 0:i.type)||to,payload:{id:so,dismissalMethod:n.schema.dismissalMethod}},l=()=>{r(s)},c=Nn(),{tabIndex:d,styles:u,isDisabled:p}=h(c);return e.jsx(ja,{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 uo={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var po;function fo({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(lo))),u=a.useDispatch(),p=()=>{u({type:ro.DISMISS_OVERLAY,payload:{id:so,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(uo,o.styles):uo;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(ja,{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"}(po||(po={}));const yo={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(yo,t.styles):yo;return e.jsx(ja,{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 ho=a.connect((function(e){return{isOpen:e.active.has(so)}}))((function(t){return e.jsx(fo,Object.assign({},t,{children:(n,a)=>e.jsx(mo,Object.assign({},t,{ref:a,children:n}))}))}));const vo=a.connect((function(e){return{isOpen:e.active.has(so)}})),go={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const bo=t.forwardRef((function({schema:n,testId:a,children:o},r){const s=t.useRef(null),l=n.styles?i.mergeRight(go,n.styles):go;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(ja,{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 Io=vo((function(t){const n=a.useSelector((e=>e.breakpoint.activeBreakpoint));return e.jsx(fo,Object.assign({},t,{children:(a,i)=>"default"===n?e.jsx(bo,Object.assign({},t,{ref:i,children:a})):e.jsx(mo,Object.assign({},t,{ref:i,children:a}))}))}));const Eo="DisplayPreset.FULLSCREEN",So="DisplayPreset.EMBEDDED",xo="DisplayPreset.ATTACHED",Co="ERROR",wo="INFO",Oo="WARNING";var To;!function(e){e.PAYPAL="Paypal"}(To||(To={}));const Ao="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 jo(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 No(e){switch(typeof e){case"undefined":return"";case"object":return null===e?"":JSON.stringify(e);case"string":return e;default:return String(e)}}function Lo(e){return i.map(No,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*Do(e,t){const n=yield r.take(e);yield r.call(t,n)}function*ko(e){for(;;){const t=yield r.take(e);yield r.put(t)}}function*Po(e,t){const n=i.over(i.lensProp("moduleName"),i.defaultTo("orchestrator"),t.payload.additionalInformation||{}),a=Object.assign(Object.assign({},t.payload),{additionalInformation:n?Lo(n):{}});try{yield r.call(e,a)}catch(e){}t.payload.level===Co&&(yield r.put({type:ee,payload:{name:"PLACEMENT_FAILURE"}}),yield r.put({type:ro.CLOSE_PLUGIN}))}const $o="INVALID_RESPONSE_OBJECT",Go="FAILED_TO_OPEN_LINK",Fo="NO_PARENT_GUID",Mo="FAILED_TO_NOTIFY_INTERACTIVE",Bo="FAILED_TO_ESTABLISH_PARTNER_VALIDATION";var Uo=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 Vo(e,t){return n=>n&&n.replace(e,t)}const zo=Vo(/['""();{}@:[\]!/=]/g,""),qo=/^(normal|italic|oblique( \d+deg)*)$/i,Ho=(e="")=>qo.test(e)?e:void 0,Wo=Vo(/[;{}@[\]!]/g,"");function Yo(e){const{fontFamily:t,sources:n}=e,a=Uo(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:zo(e.fontFamily)||"",style:Ho(e.style),weight:zo(e.weight),sources:e.sources.map((e=>Wo(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 Ko(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=Ao.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:no,payload:{level:wo,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 Zo(e){return null!=e?e:null}function Qo(){return new Set([so])}function Xo(e){return e.breakpoint.breakpoints[e.breakpoint.activeBreakpoint]||0}const er=i.sortBy(i.prop(1)),tr=i.map(i.prop(0)),nr=e=>i.compose(i.findIndex(i.equals(e)),tr,er,i.toPairs,i.pathOr({},["breakpoint","breakpoints"]));function ar(e){return nr(e.breakpoint.activeBreakpoint)(e)}function ir(e,t){return e.customStates[`module${t}`]||{}}function or(e){return`${e.name}:${e.parentGuid}`}function rr(e,t){return!e.processed.includes(or(t))||(n=t.name,void 0!==A.find((e=>e===n)));var n}function sr(){return new Map}const lr={layout:function(e=Zo(),t){return t.type===qi?t.payload:e},breakpoint:function(e={breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},t){var n;switch(t.type){case Bi:return Object.prototype.hasOwnProperty.call(e.breakpoints,t.payload.activeBreakpoint)?Object.assign(Object.assign({},e),{activeBreakpoint:t.payload.activeBreakpoint}):e;case Ui: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=Qo(),t){var n,a;switch(t.type){case Fi:{const a=new Set(e);return a.add(null===(n=t.payload)||void 0===n?void 0:n.id),a}case Mi:{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===zi?t.payload:e},signal:function(e={queue:[],processed:[]},t){switch(t.type){case Qi:return i.evolve({queue:n=>rr(e,t.payload.signal)?i.uniqBy(i.pipe(i.prop("signal"),or),n.concat(t.payload)):n},e);case Xi: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(or(t.payload))},e);default:return e}},serializableCache:function(e=sr(),t){switch(t.type){case Ji:case Ki:if(t.payload.key&&t.payload.value){return new Map([...e]).set(t.payload.key,t.payload.value)}return e;case Zi:{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===io){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*cr(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:oo.INITIALISE_BREAKPOINT,payload:{activeBreakpoint:e,breakpoints:t.payload}});;)e=yield r.take(i),yield r.put({type:oo.UPDATE_ACTIVE_BREAKPOINT,payload:{activeBreakpoint:e}})}catch(e){const n=e;yield r.put({type:no,payload:{level:Oo,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:no,payload:{level:Co,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 dr(e,t,n){return l.eventChannel((a=>{const i=e.subscribe((e=>{const t=n(e);t&&a({type:Hi,payload:t})}),(e=>{a(e)})),o=t.fonts.subscribe((e=>{a({type:zi,payload:e})}),(e=>{a(e)}));return()=>{i.unsubscribe(),o.unsubscribe()}}),l.buffers.sliding(2))}var ur=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"}}),pr=Object.freeze({__proto__:null,PartnerMessage:{UpdateCartItem:"V2_UPDATE_CART_ITEM"},PlacementMessage:{CartItemUpdated:"V2_CART_ITEM_UPDATED"}}),fr=Object.freeze({__proto__:null,V1:ur,V2:pr}),yr=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 hr="LINK_NAVIGATION_REQUEST",vr="REALTIME_OFFER_FULFILLMENT_SUCCESS",gr="REALTIME_OFFER_FULFILLMENT_FAILURE";var br=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 Ir={newTab:"_blank",self:"_top",roktWebViewSDK:"roktWebViewSDK",inApp:"inApp",overrideLinkNavigation:"overrideLinkNavigation"};function Er({url:e,urlBehavior:t,external:n},a=window){return br(this,void 0,void 0,(function*(){if(!e)return null;if("overrideLinkNavigation"===t)return n.partner.send(hr,{url:e}).then((()=>null));const i=Ir[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:Er});function xr(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:no,payload:{level:Oo,code:i?"COMMUNICATION_FAILURE_WITH_WSDK":n,message:t,additionalInformation:Object.assign(Object.assign({},o),a)}}}var Cr=Object.freeze({__proto__:null,makePluginWarningAction:xr});function wr(e){return null!=e&&"object"==typeof e&&"ref"in e&&"object"==typeof e.ref&&!Array.isArray(e.ref)&&null!=e.ref}var Or=Object.freeze({__proto__:null,isWindow:wr}),Tr=Object.assign(Object.assign(Object.assign({},Sr),Cr),Or);function Ar(e){switch(e){case"ATTACHED":return xo;case"EMBEDDED":return So;default:return Eo}}function Rr(e,t){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e.offsetBottom&&{bottom:Ye(e.offsetBottom)}),e.offsetLeft&&{left:Ye(e.offsetLeft)}),e.offsetRight&&{right:Ye(e.offsetRight)}),e.offsetTop&&{top:Ye(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:Ye(e.maxWidth)}:void 0),t)}function*jr(e=10){(yield r.select((e=>e.signal.queue.length>0)))&&(yield c.delay(30),e>=1&&(yield*jr(e-1)))}function*Nr(e){try{yield*jr(10),yield c.call(e.close)}catch(e){const t=Tr.makePluginWarningAction(e,"Failed to close the plugin","FAILED_TO_CLOSE_PLUGIN");yield c.put(t)}}function*Lr(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*Dr(e,t){var n;const a=yield c.call(dr,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:no,payload:{level:Co,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*kr(e,t){yield c.all([c.spawn(Dr,e,t),c.takeEvery(ee,Lr,e.partnerInteractionService)])}function*Pr(e,t,n){const a=function(e,t){if(!t)return{preset:Ar(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:oo.ACTIVE_ADD,payload:{id:lo}})}function*$r(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:wo,message:t.payload.message||"Plugin Generic Log",additionalInformation:Lo(a)})}catch(e){}}function*Gr(e){yield r.put({type:oo.QUEUE_SIGNAL,payload:{signal:e.payload}}),yield r.put({type:eo})}function*Fr(e){yield r.put({type:oo.QUEUE_SIGNAL,payload:e.payload}),yield r.put({type:eo})}function*Mr(e,t){const n=yield r.select((e=>e.signal.queue.filter((t=>rr(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*Br(e.signal,a(t));break;case"SignalViewed":yield*Ur(e.signal,a(t));break;case"SignalDismissal":yield*Vr(e.signal,a(t));break;case"SignalInstantPurchaseDismissal":yield*zr(e.signal,a(t));break;case"SignalLoadStart":yield*qr(e.signal,a(t));break;case"SignalGatedResponse":case"SignalResponse":yield*Hr(e.signal,a(t,!0));break;case"SignalProductItemResponse":yield*Wr(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*Kr(e.signal,a(t));break;case"SignalCartItemInstantPurchase":yield*Zr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseFailure":yield*Qr(e.signal,a(t))}yield r.put({type:oo.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*Br(e,t){let n;e.creativeInstanceGuid&&(n={},n.creativeInstanceGuid=e.creativeInstanceGuid);try{yield t(e.name,e.parentGuid,n)}catch(t){yield Xr(e,t)}}function*Ur(e,t){try{yield t(e.name,e.parentGuid,{objectData:{supportedByBrowser:e.supportedByBrowser.toString()},metadata:[{name:"inferred",value:e.inferred.toString()}]})}catch(t){yield Xr(e,t)}}function*Vr(e,t){try{yield t(e.name,e.parentGuid,e.dismissalMethod?{objectData:{dismissalMethod:e.dismissalMethod}}:void 0)}catch(t){yield Xr(e,t)}}function*zr(e,t){try{yield t(e.name,e.parentGuid,void 0)}catch(t){yield Xr(e,t)}}function*qr(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 Xr(e,t)}}function*Hr(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 Xr(e,t)}}function*Wr(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 Xr(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 Xr(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 Xr(e,t)}}function*Kr(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 Xr(e,t)}}function*Zr(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 Xr(e,t)}}function*Qr(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 Xr(e,t)}}function Xr(e,t){const n=Tr.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*es(e){yield r.put({type:io,payload:e.payload})}function*ts(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:no,payload:{level:wo,code:Mo,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*ns(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(Er,{url:t.payload.url,urlBehavior:n,external:e})}catch(e){yield r.put(xr(e,"Failed to open link",Go,{url:t.payload.url,urlBehaviour:n}))}}function*as(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:oo.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Wi}),t?yield r.put({type:Z,payload:{name:"SignalDismissal",parentGuid:t,dismissalMethod:e.payload.dismissalMethod}}):yield r.put({type:no,payload:{level:wo,code:Fo,message:"ParentGuid does not exist"}})}const is=a.connect((function(e){return{isOpen:e.active.has(so)}})),os="undefined"!=typeof window;function rs(e,n){t.useEffect((()=>{if(!os||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 ss="Minimized",ls=()=>{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[ss])),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);rs(e,!!r);const m=t.useCallback((()=>{D(),f.current=void 0,d.current=!1,N(!0);v()?S():j(0)}),[]),v=()=>{const e=R();return r?e<=-.2:e>=.2};t.useEffect((()=>{r?(C(),s(ds(!0))):(w(),s(ds(!1)))}),[r,s]),t.useEffect((()=>{requestAnimationFrame((()=>{_(!r,a),_(!!r,i),L()}))}),[]);const b=t.useCallback((e=>{if(n.current){e.preventDefault();const t=E(e);j(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=cs(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=cs(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:ss,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),j(s),_(!1,a),_(!0,i),P()},w=()=>{N(!0),L(!0,!1),j(0),f.current=void 0,_(!0,a),_(!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]),R=()=>{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},j=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")},_=(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)},D=t.useCallback((()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",m),document.removeEventListener("touchmove",b),document.removeEventListener("touchend",m)}),[b,m]),k=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 cs(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientY:e.clientY}const ds=e=>({type:Z,payload:{action:e?"BottomSheetMinimized":"BottomSheetMaximized",name:"SignalUserInteraction",context:"BottomSheetMinimized"}}),us={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var ps;function fs({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(lo))),c=t.useRef(null),d=a.useDispatch(),u=()=>{d({type:ro.DISMISS_OVERLAY,payload:{id:so,dismissalMethod:"rokt_backdrop"}})},p=Et(0,(e=>e.customStates[ss]));t.useEffect((()=>{f(!!p)}),[p]),rs(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(us,n.styles):us;return e.jsx(ja,{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 ys(){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"}(ps||(ps={}));const ms={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};function hs(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(vs,Object.assign({},t,{slots:n,currentIndex:i}))}function vs(t){const{wrapperRef:n,containerRef:a,minimizedChildRef:i,maximizedChildRef:o}=ls();return t.isOpen?e.jsxs("div",{ref:n,style:{height:"100000px"},children:[e.jsx(fs,Object.assign({},t)),e.jsx(bs,Object.assign({},t,{containerRef:a,minimizedChildRef:i,maximizedChildRef:o}))]}):null}const gs=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
- `,bs=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(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`})(),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||{})(ji.transformLinksToAnchorText(null==b?void 0:b.links),"creativeLink");return e.jsx(ja,{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(ys,{}),e.jsx("div",{ref:y,className:gs,"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(Kt,{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*Is(){(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}}))}is(ms);const Es={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var Ss;function xs({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(lo))),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(Es,o.styles):Es;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(ja,{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"}(Ss||(Ss={}));const Cs={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const ws=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(Cs,t.styles):Cs;return e.jsx(ja,{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 Os=a.connect((function(e){return{isOpen:e.active.has(so)}}))((function(t){return e.jsx(xs,Object.assign({},t,{children:(n,a)=>e.jsx(ws,Object.assign({},t,{ref:a,children:n}))}))})),Ts=is(ms),As={name:"minimized-bottomsheet-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",Is)])},componentFactory:t=>"Overlay"===t.type?e.jsx(Os,{schema:t}):function(e){const t=e.children instanceof Array;return t}(t)?e.jsx(Ts,{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}})),js=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"})),Ns="FunFactMode";function Ls({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[Ns])),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:Ns,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(Jt,null,(a=>t.createElement(ja,{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"},js)):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:Ns,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(Ls,Object.assign({},e,{slots:i,currentIndex:o,partnerColor:n}))})),Ds=({children:e,partnerColor:n,schema:a})=>{var i;const r=Ct(),s=t.useMemo((()=>Math.random()),[]),l=Ht((null!==(i=ks[Math.floor(s*ks.length)])&&void 0!==i?i:{text:"",header:""})||{},"funfact"),c=o.css`
65
+ `,bs=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(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`})(),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||{})(ji.transformLinksToAnchorText(null==b?void 0:b.links),"creativeLink");return e.jsx(ja,{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(ys,{}),e.jsx("div",{ref:y,className:gs,"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(Kt,{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*Is(){(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}}))}is(hs);const Es={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var Ss;function xs({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(lo))),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(Es,o.styles):Es;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(ja,{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 Cs={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const ws=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(Cs,t.styles):Cs;return e.jsx(ja,{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 Os=a.connect((function(e){return{isOpen:e.active.has(so)}}))((function(t){return e.jsx(xs,Object.assign({},t,{children:(n,a)=>e.jsx(ws,Object.assign({},t,{ref:a,children:n}))}))})),Ts=is(hs),As={name:"minimized-bottomsheet-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",Is)])},componentFactory:t=>"Overlay"===t.type?e.jsx(Os,{schema:t}):function(e){const t=e.children instanceof Array;return t}(t)?e.jsx(Ts,{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}})),js=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"})),Ns="FunFactMode";function Ls({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[Ns])),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:Ns,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(Jt,null,(a=>t.createElement(ja,{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?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"},js)):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:Ns,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(Ls,Object.assign({},e,{slots:i,currentIndex:o,partnerColor:n}))})),Ds=({children:e,partnerColor:n,schema:a})=>{var i;const r=Ct(),s=t.useMemo((()=>Math.random()),[]),l=Ht((null!==(i=ks[Math.floor(s*ks.length)])&&void 0!==i?i:{text:"",header:""})||{},"funfact"),c=o.css`
66
66
  display: inline;
67
67
  margin: 8px 16px;
68
68
  p {
@@ -107,7 +107,7 @@
107
107
  `},e)))):null):null}const zs=o.keyframes`
108
108
  0% { width: 0; }
109
109
  100% { width: 100%; }
110
- }`;function qs(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(Us,{hasLoaded:n,animationSpeedMS:h,styles:f});break;case"partnerText":m=t.createElement(Vs,{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 qs(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(Us,{hasLoaded:n,animationSpeedMS:m,styles:f});break;case"partnerText":h=t.createElement(Vs,{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: ${zs} ${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 Hs={name:"loading-extension",componentFactory:e=>t.createElement(qs,{data:e}),interceptors:{}};function Ws({linearGradient:e,color1:n,color2:a,color3:i,duration:o,additionalStyles:r}){const s=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 overflow: hidden;\n height: 100%; \n width: 100%;\n }\n .background-shimmer > * {\n position: relative;\n z-index: 0;\n }\n \n .background-shimmer::after {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 50%;\n height: 100%;\n background: ${e||`linear-gradient(\n 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]);return t.createElement(Jt,null,(e=>t.createElement(ja,{styles:{}},(e=>{var n;const a=e.classnames;return t.createElement(t.Fragment,null,t.createElement("style",null,s),t.createElement("div",{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(Ws,{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 Ks(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 Zs={name:"timer-progression-extension",componentFactory:e=>t.createElement(Ks,{data:e}),interceptors:{}},Qs="MODULE/ADD_LOADED",Xs="MODULE/LOAD",el="PROGRESSION/INITIALISE",tl="PROGRESSION/NEXT",nl="PROGRESSION/PREV",al="PROGRESSION/UPDATE_GROUP_SIZE",il="PROGRESSION/PROCESS",ol="SLOTS/SET",rl="INSTANT_PURCHASE/DISMISS",sl="OFFER_LIFECYCLE",ll="DOMAIN_STATES/SET",cl="OFFER_ENGAGEMENT",dl="GLOBAL_OFFER_DATA_STATE/SET_CART",ul=Object.assign(Object.assign({},oo),{NEXT_IN_PROGRESSION:tl,PREV_IN_PROGRESSION:nl,INITIALISE_PROGRESSION:el,UPDATE_GROUP_SIZE:al,SET_SLOTS:ol,ADD_LOADED_MODULE:Qs,SET_DOMAIN_STATE:ll,SET_GLOBAL_OFFER_DATA_CART:dl}),pl=Object.assign(Object.assign({},ro),{LOAD_MODULES:Xs,DISMISS_INSTANT_PURCHASE:rl,PROCESS_PROGRESSION:il,OFFER_LIFECYCLE:sl,OFFER_ENGAGEMENT:cl,SET_PARTNER_VALIDATION_STATUS:ie});function fl(e,t){return t<=0||e<=0||t>e?0:Math.ceil(e/t)}function yl(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<fl(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 hl=Symbol("root");function ml(){return{[hl]:{}}}const vl=Object.assign({progression:function(e=null,t){switch(t.type){case el:if(function(e){const{totalCount:t,currentGroupIndex:n,groupSize:a}=e;return t>=0&&a>=0&&n>=0&&a<=t&&n<fl(t,a)}(t.payload)){const{totalCount:e,_:n,groupSize:a}=t.payload;return Object.assign(Object.assign({},t.payload),{indexGroups:yl(e,a)})}return null;case al:{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:yl(a,n),currentGroupIndex:0}):null}case tl:{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,fl(t,n)-1)}):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.max(a-1,0)}):null}default:return e}},slots:function(e=[],t){return t.type===ol?t.payload:e},module:function(e={loadedModules:[]},t){return t.type===Qs?Object.assign(Object.assign({},e),{loadedModules:[...e.loadedModules,t.payload]}):e},domainStates:function(e=ml(),t){if(t.type===ll){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:hl;return n===hl?e:Object.assign(Object.assign({},i.assocPath([n,t.payload.key],Number(t.payload.value),e)),{[hl]:{}})}return e}return e},globalOfferDataState:function(e={},t){if(t.type===dl){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}},lr);function gl(e={}){return Object.assign(Object.assign(Object.assign({},function(e={}){return Object.assign({layout:Zo(),breakpoint:{breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},active:Qo(),fonts:[],signal:{queue:[],processed:[]},serializableCache:sr(),settings:{closeOnComplete:!0},customStates:{root:{}}},e)}(e)),{progression:null,slots:[],module:{loadedModules:[]},domainStates:ml(),globalOfferDataState:{}}),e)}function bl(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 Il(e){return e.progression?{activeGroupIndex:e.progression.currentGroupIndex,totalOffers:e.progression.totalCount,totalGroups:fl(e.progression.totalCount,e.progression.groupSize),isLast:bl(e)}:null}function El(e,t){return e.domainStates[`module${t}`]||{offerComplete:0,checkout:0}}function Sl(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 xl(n){var i;const{config:o,position:r,visible:s,container:l,testId:c}=n,d=zn(),u=Nn(),p=a.useSelector(Xo),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 Cl({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(ja,{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($i,{effect:n.transition,visible:a===l,parentElement:s.current,children:e.jsx(xl,{config:t,position:a,visible:a===l,container:"column"})}))))})}):null}const wl=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=fl(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(Jt,{children:a=>e.jsx(ja,{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 Ol="partnerValidationUI",Tl="stackedViewableItems";function Al(n){var o;const r=a.useDispatch(),s=a.useSelector((e=>e.slots)),l=null!==(o=n.schema.viewableItems)&&void 0!==o?o:[],c=Ia(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:Ki,payload:{key:Tl,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(ja,{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(xl,{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?ul.PREV_IN_PROGRESSION:ul.NEXT_IN_PROGRESSION})};return e.jsx(ja,{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 jl({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(ar),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),R=`${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:ul.NEXT_IN_PROGRESSION}):a<i&&C({type:ul.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 j={overflow:"hidden"},N={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:R,alignItems:"stretch"},L=e=>{var t;return null!==(t=null==v?void 0:v.includes(e))&&void 0!==t&&t},_=n.peekThroughSize[Math.min(I,n.peekThroughSize.length-1)],D=_?"Fixed"===(k=_).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)(D)?`(100% - 2 * ${D} - (${P} + 1) * ${R})/${P}`:`(100% - (${P} - 1) * ${R})/${P}`})`,position:"relative",display:"flex",overflow:"auto"};return(null==b?void 0:b.length)>0?e.jsx(ja,{styles:n.styles,children:({classnames:n})=>e.jsx("div",{ref:S,style:Object.assign(Object.assign({},j),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(xl,{config:t,position:n,container:"row",visible:L(n)})}))))})})}):null}const Nl=Object.freeze([]);function Ll({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)||Nl})),c=a.useSelector((e=>e.slots||Nl)),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(ja,{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($i,{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(xl,{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 Dl(e,t,n=!1){return Error(`Could not translate ${e} with guid: ${t}${n?" for child layout":""}`)}function kl(e,t=!1){var n;try{if(e.responseOptionsMap||t)return Object.assign(Object.assign({},e),{responseOptionsMap:i.mapObjIndexed(Pl,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:Dl("Creative",e.instanceGuid,t)}}function Pl(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:Dl("CreativeResponse",e.instanceGuid)}}function $l(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 Fl={OneByOneDistribution:function(t){if("OneByOneDistribution"===t.type)return e.jsx(Cl,{schema:t.node})},StackedDistribution:function(t){if("StackedDistribution"===t.type)return e.jsx(Al,{schema:t.node})},ProgressIndicator:function(t){if("ProgressIndicator"===t.type)return e.jsx(wl,{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(mo,{schema:t.node})},CloseButton:function(t){if("CloseButton"===t.type)return e.jsx(co,{schema:t.node})},EscapeHatch:(Ml=[function(t,n){if(v("CloseButton",t)){const n=JSON.parse(t.node.data);return e.jsx(co,{schema:n.node,action:n.action})}},vi],e=>Ml.reduce(((t,n)=>void 0===t?n(e):t),void 0)),CarouselDistribution:function(t){if("CarouselDistribution"===t.type)return e.jsx(jl,{schema:t.node})},GroupedDistribution:function(t){if("GroupedDistribution"===t.type)return e.jsx(Ll,{schema:t.node})},BottomSheet:function(t){if("BottomSheet"===t.type)return e.jsx(Io,{schema:t.node})}};var Ml;function Bl(e,t){e({type:Z,payload:{name:"SignalActivation",parentGuid:t}})}function Ul({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:Il(e),customStates:e.customStates.root,domainStates:e.domainStates[hl]})),i.equals),y=a.useSelector((e=>e.slots.length)),h=a.useSelector((e=>{var t;const n=Number(null!==(t=e.serializableCache.get(Tl))&&void 0!==t?t:"");return y-n})),m=a.useSelector(Sl);de(Tt(),p),t.useEffect((()=>(u&&document.body.addEventListener("click",Bl.bind(null,p,u.instanceGuid),{once:!0}),()=>{u&&document.body.removeEventListener("click",Bl.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:ao,payload:{code:"LAYOUT_IMPRESSED"}};p(e),p(t)}}),[u]);const v=e=>{p({type:pl.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(Fn,{info:{layoutType:"OuterLayout",pageInstanceGuid:n},children:e.jsx(Kt,{value:t,children:e.jsx(wt,{value:a,overrides:Fl,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 Vl=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}}}),zl=Object.assign({},Vl);function*ql(e,t){const n=zl.getDistribution(t),a=null==n?void 0:n.type,i=yield r.select(ar),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:ul.INITIALISE_PROGRESSION,payload:{currentGroupIndex:0,totalCount:e,groupSize:o}}))}function*Hl(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:no,payload:{level:wo,code:Fo,message:"Layout instance guid does not exist"}}),yield c.put({type:Xs,payload:{modules:s.map((e=>e.layoutVariant.moduleName))}}),yield c.put({type:Vi,payload:r.breakpoints}),yield c.put({type:ul.LAYOUT_UPDATE,payload:{instanceGuid:a,layoutSchemaVersion:o,layoutSchema:r.layout,settings:r.settings}}),yield c.put({type:ul.SET_SLOTS,payload:s}),i.isNil(r.settings)||(yield c.put({type:ul.SET_SETTINGS,payload:r.settings})),yield*ql(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(Wl,e,hr.PartnerValidationEvent.SHOW_PARTNER_VALIDATION_STATUS,(()=>({type:"ACTIVE/ADD",payload:{id:Ol}})))}catch(e){return yield c.put({type:no,payload:{level:Co,code:Bo,message:"Failed to establish partner validation."}}),"FAILURE"}return"OK"}(e.partner,r.settings,s);"OK"===l&&(yield c.call(Pr,e.display,r.display,null===(n=r.settings)||void 0===n?void 0:n.frameControls))}function*Wl(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 Dc(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 Kl=i.all(i.anyPass([function(e){return"Row"===e.type&&ec(e.node.children)},function(e){return"Column"===e.type&&ec(e.node.children)},ic,oc])),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,ic,function(e){return"DataImage"===e.type},function(e){return"When"===e.type&&tc(e.node.children)}])),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)},oc,ic])),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)},ic,function(e){return"RichText"===e.type},oc,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&ac(e.node.children)},function(e){return"StaticLink"===e.type&&ac(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CloseButton"===e.type&&ac(e.node.children)}]));function ec(e){return Kl(e)}function tc(e){return Zl(e)}function nc(e){return Ql(e)}function ac(e){return Xl(e)}function ic(e){return"StaticImage"===e.type}function oc(e){return"BasicText"===e.type}const rc=i.lensPath(["styles","elements","link"]),sc=i.lensPath(["styles","elements","activeIndicator"]),lc=i.lensPath(["styles","elements","indicator"]),cc=i.lensPath(["styles","elements","seenIndicator"]),dc=i.lensPath(["focussed"]),uc=i.lensPath(["hovered"]),pc=i.lensPath(["default"]),fc=i.lensPath(["pressed"]),yc=e=>{var t;return{text:null!==(t=null==e?void 0:e.text)&&void 0!==t?t:{}}},hc=i.when(i.hasPath(["styles","elements","link"]),i.pipe(i.over(rc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default})))),i.over(rc,i.map(i.when(i.has("focussed"),i.over(dc,yc)))),i.over(rc,i.map(i.when(i.has("hovered"),i.over(uc,yc)))),i.over(rc,i.map(i.when(i.has("default"),i.over(pc,yc)))),i.over(rc,i.map(i.when(i.has("pressed"),i.over(fc,yc)))))),mc=i.pipe(i.when(i.hasPath(["styles","elements","activeIndicator"]),i.over(sc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","indicator"]),i.over(lc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","seenIndicator"]),i.over(cc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))));function vc(e,t){return e?{elements:{own:e.elements.own.map(t)}}:void 0}const gc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),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,disabled:e.disabled}),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=>{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}`)}},Oc=e=>{switch(e){case"breakpoint":return"Breakpoint";case"progression":return"Progression";case"position":return"Position";default:throw Jl("When",`Invalid target: ${e}`)}},Tc=e=>{const{target:t,condition:n,value:a}=e;return{type:Oc(t),predicate:{condition:wc(n),value:a}}};function Ac(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=>Dc(e)));if(ec(t))return Object.assign(Object.assign({},e),{children:t,styles:vc(e.styles,Sc)});throw Jl("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function jc(e){const t=e.children.map((e=>Dc(e)));if(tc(t))return Object.assign(Object.assign({},e),{children:t,styles:vc(e.styles,xc)});throw Jl("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function Nc(e){const t=e.children.map((e=>Dc(e)));if(nc(t))return Object.assign(Object.assign({},e),{children:t,styles:vc(e.styles,Cc)});throw Jl("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}const Lc=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:Lc(null===(n=e.styles)||void 0===n?void 0:n.elements)}:void 0,i=e.children.map((e=>Dc(e)));if(ac(i))return Object.assign(Object.assign({},e),{styles:a,children:i});throw Jl("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function Dc(e){switch(e.type){case"When":return{type:"When",node:(s=e.node,{predicates:s.predicates.map(Tc),children:s.children.map((e=>Dc(e)))})};case"OneByOneDistribution":return{type:e.type,node:Ac(e.node)};case"Overlay":return{type:e.type,node:_c(e.node)};case"Column":return{type:e.type,node:(r=e.node,{styles:vc(r.styles,gc),children:r.children.map((e=>Dc(e)))})};case"Row":return{type:e.type,node:(o=e.node,{styles:vc(o.styles,bc),children:o.children.map((e=>Dc(e)))})};case"RichText":return{type:e.type,node:(i=e.node,hc(i))};case"CloseButton":return{type:e.type,node:Rc(e.node)};case"CreativeResponse":return{type:e.type,node:jc(e.node)};case"StaticLink":return{type:e.type,node:Nc(e.node)};case"StaticImage":return{type:e.type,node:(a=e.node,Object.assign(Object.assign({},a),{styles:vc(a.styles,Ic)}))};case"DataImage":return{type:e.type,node:(n=e.node,Object.assign(Object.assign({},n),{styles:vc(n.styles,Ec)}))};case"ProgressIndicator":return{type:e.type,node:(t=e.node,mc(t))};default:return e}var t,n,a,i,o,r,s}function kc(e){return Bd(e)}function Pc(e,t){return Error(`Migration process from v0_23 to v1_0 failed: could not transform ${e} node. For more details: ${t}`)}const $c=e=>"scroll"===e||"auto"===e?"visible":e,Gc=i.lensPath(["elements","own"]),Fc=i.lensPath(["transitions","transition","value","own"]),Mc=i.lensPath(["elements","wrapper"]),Bc=i.lensPath(["transitions","transition","value","wrapper"]),Uc=i.lensPath(["elements","indicator"]),Vc=i.lensPath(["transitions","transition","value","indicator"]),zc=i.lensPath(["elements","activeIndicator"]),qc=i.lensPath(["transitions","transition","value","activeIndicator"]),Hc=i.lensPath(["elements","seenIndicator"]),Wc=i.lensPath(["transitions","transition","value","seenIndicator"]),Yc=i.lensPath(["default","container","overflow"]),Jc=i.lensPath(["pressed","container","overflow"]),Kc=i.lensPath(["hovered","container","overflow"]),Zc=i.lensPath(["focussed","container","overflow"]),Qc=i.lensPath(["disabled","container","overflow"]),Xc=i.lensPath(["container","overflow"]),ed=i.pipe(i.when(i.hasPath(["default","container","overflow"]),i.over(Yc,$c)),i.when(i.hasPath(["pressed","container","overflow"]),i.over(Jc,$c)),i.when(i.hasPath(["hovered","container","overflow"]),i.over(Kc,$c)),i.when(i.hasPath(["focussed","container","overflow"]),i.over(Zc,$c)),i.when(i.hasPath(["disabled","container","overflow"]),i.over(Qc,$c))),td=i.when(i.hasPath(["container","overflow"]),i.over(Xc,$c)),nd=i.pipe(i.when(i.hasPath(["elements","own"]),i.over(Gc,i.map(ed))),i.when(i.hasPath(["transitions","transition","value","own"]),i.over(Fc,td))),ad=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)})),id=i.pipe(nd,ad),od=i.pipe(i.when(i.hasPath(["elements","wrapper"]),i.over(Mc,i.map(ed))),i.when(i.hasPath(["transitions","transition","value","wrapper"]),i.over(Bc,td))),rd=i.pipe(i.when(i.hasPath(["elements","indicator"]),i.over(Uc,i.map(ed))),i.when(i.hasPath(["transitions","transition","value","indicator"]),i.over(Vc,td))),sd=i.pipe(i.when(i.hasPath(["elements","activeIndicator"]),i.over(zc,i.map(ed))),i.when(i.hasPath(["transitions","transition","value","activeIndicator"]),i.over(qc,td))),ld=i.pipe(i.when(i.hasPath(["elements","seenIndicator"]),i.over(Hc,i.map(ed))),i.when(i.hasPath(["transitions","transition","value","seenIndicator"]),i.over(Wc,td)));function cd(e){return"StaticImage"===e.type}function dd(e){return"StaticIcon"===e.type}function ud(e){return"BasicText"===e.type}function pd(e){return"DataImage"===e.type}function fd(e){return"DataIcon"===e.type}function yd(e){return"RichText"===e.type}function hd(e){return"SlideStateTrigger"===e.type}function md(e){return"ToggleButtonStateTrigger"===e.type}const vd=i.all(i.anyPass([function(e){return"Row"===e.type&&gd(e.node.children)},function(e){return"Column"===e.type&&gd(e.node.children)},cd,dd,yd,ud,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&gd(e.node.children)},function(e){return"StaticLink"===e.type&&gd(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&&gd(e.node.children)},function(e){return"ProgressControl"===e.type&&Ad(e.node.children)},function(e){return"ZStack"===e.type&&gd(e.node.children)},function(e){return"FlowRow"===e.type&&gd(e.node.children)},hd,md]));function gd(e){return vd(e)}const bd=i.pipe(nd,od,ad);function Id(e){const t=e.children.map((e=>Bd(e)));if(gd(t))return Object.assign(Object.assign({},i.omit(["settings"],e)),{children:t,allowBackdropToClose:e.settings.allowBackdropToClose,styles:e.styles?bd(e.styles):void 0});throw Pc("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function Ed(e){const t=e.children.map((e=>Bd(e)));if(Ad(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?id(e.styles):void 0});throw Pc("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function Sd(e){const t=e.children.map((e=>Bd(e)));if(jd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?id(e.styles):void 0});throw Pc("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function xd(e){const t=e.children.map((e=>Bd(e)));if(Ad(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?id(e.styles):void 0});throw Pc("ProgressControl",`Invalid schema: ${JSON.stringify(e)}`)}const Cd=i.pipe(nd,rd,sd,ld,ad);const wd=i.all(i.anyPass([ud,cd,dd,pd,fd,function(e){return"Row"===e.type&&Od(e.node.children)},function(e){return"FlowRow"===e.type&&Od(e.node.children)},function(e){return"Column"===e.type&&Od(e.node.children)},function(e){return"ZStack"===e.type&&Od(e.node.children)},function(e){return"When"===e.type&&Od(e.node.children)}]));function Od(e){return wd(e)}const Td=i.all(i.anyPass([ud,cd,dd,function(e){return"Row"===e.type&&Ad(e.node.children)},function(e){return"FlowRow"===e.type&&Ad(e.node.children)},function(e){return"Column"===e.type&&Ad(e.node.children)},function(e){return"ZStack"===e.type&&Ad(e.node.children)},function(e){return"When"===e.type&&Ad(e.node.children)}]));function Ad(e){return Td(e)}const Rd=i.all(i.anyPass([ud,cd,dd,pd,fd,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 Rd(e)}function Nd(e){const t=e.children.map((e=>Bd(e)));if(Od(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?id(e.styles):void 0});throw Pc("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}function Ld(e){const t=e.children.map((e=>Bd(e)));if(jd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?id(e.styles):void 0});throw Pc("CatalogResponseButton",`Invalid schema: ${JSON.stringify(e)}`)}function _d(e){return"Row"===e.type&&Pd(e.node.children)}function Dd(e){return"Column"===e.type&&Pd(e.node.children)}const kd=i.all(i.anyPass([ud,cd,dd,pd,fd,yd,function(e){return"StaticLink"===e.type},hd,md,function(e){return"CatalogResponseButton"===e.type},_d,function(e){return"FlowRow"===e.type&&Pd(e.node.children)},Dd,function(e){return"ZStack"===e.type&&Pd(e.node.children)},function(e){return"When"===e.type&&Pd(e.node.children)}]));function Pd(e){return kd(e)}const $d=i.anyPass([_d,Dd]);function Gd(e){const t=Bd(e.template);if(function(e){return $d(e)}(t))return Object.assign(Object.assign({},e),{template:t,styles:e.styles?id(e.styles):void 0});throw Pc("CatalogStackedCollection",`Invalid schema: ${JSON.stringify(e)}`)}function Fd(e){const t=e.children.map((e=>Bd(e)));if(Od(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?id(e.styles):void 0});throw Pc("ToggleButtonStateTrigger",`Invalid schema: ${JSON.stringify(e)}`)}function Md(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=>Bd(e))),transition:t})}function Bd(e){switch(e.type){case"Row":return{type:e.type,node:(g=e.node,Object.assign(Object.assign({},g),{children:g.children.map((e=>Bd(e))),styles:g.styles?id(g.styles):void 0}))};case"When":return{type:e.type,node:Md(e.node)};case"FlowRow":return{type:e.type,node:(v=e.node,Object.assign(Object.assign({},v),{styles:v.styles?id(v.styles):void 0,children:v.children.map((e=>Bd(e)))}))};case"Column":return{type:e.type,node:(m=e.node,Object.assign(Object.assign({},m),{children:m.children.map((e=>Bd(e))),styles:m.styles?id(m.styles):void 0}))};case"ZStack":return{type:e.type,node:(h=e.node,Object.assign(Object.assign({},h),{styles:h.styles?id(h.styles):void 0,children:h.children.map((e=>Bd(e)))}))};case"Overlay":return{type:e.type,node:Id(e.node)};case"ProgressControl":return{type:e.type,node:xd(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?id(y.styles):void 0}))};case"CloseButton":return{type:"CloseButton",node:Ed(e.node)};case"CreativeResponse":return{type:"CreativeResponse",node:Sd(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?id(f.styles):void 0}))};case"OneByOneDistribution":return{type:"OneByOneDistribution",node:(p=e.node,Object.assign(Object.assign({},p),{styles:p.styles?id(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?Cd(d.styles):void 0}))};case"SlideStateTrigger":return{type:"SlideStateTrigger",node:(c=e.node,Object.assign(Object.assign({},c),{styles:c.styles?id(c.styles):void 0}))};case"StackedDistribution":return{type:"StackedDistribution",node:(l=e.node,Object.assign(Object.assign({viewableItems:[]},l),{styles:l.styles?id(l.styles):void 0}))};case"StaticLink":return{type:"StaticLink",node:Nd(e.node)};case"ToggleButtonStateTrigger":return{type:"ToggleButtonStateTrigger",node:Fd(e.node)};case"CatalogResponseButton":return{type:"CatalogResponseButton",node:Ld(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?ad(s.styles):void 0}))};case"DataImage":return{type:"DataImage",node:(r=e.node,Object.assign(Object.assign({},r),{styles:r.styles?ad(r.styles):void 0}))};case"StaticImage":return{type:"StaticImage",node:(o=e.node,Object.assign(Object.assign({},o),{styles:o.styles?ad(o.styles):void 0}))};case"DataIcon":return{type:"DataIcon",node:(a=e.node,Object.assign(Object.assign({},a),{styles:a.styles?ad(a.styles):void 0}))};case"StaticIcon":return{type:"StaticIcon",node:(n=e.node,Object.assign(Object.assign({},n),{styles:n.styles?ad(n.styles):void 0}))};case"BasicText":return{type:"BasicText",node:(t=e.node,Object.assign(Object.assign({},t),{styles:t.styles?ad(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 Ud(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 Vd(e,t){return e.major===t.major&&e.minor===t.minor}const zd=(e,t,n)=>i.allPass([i.lte(e),i.gte(t)])(n);function qd(e,t){return Vd(t,{major:0,minor:0})?qd(Yl(e),{major:0,minor:1}):function(e,t){return 0===t.major&&zd(1,23,t.minor)}(0,t)?qd(kc(e),{major:1,minor:0}):e}function Hd(e,t){return Vd(t,{major:0,minor:0})?Hd(function(e){return Object.assign(Object.assign({},e),{layout:Yl(e.layout)})}(e),{major:0,minor:1}):function(e,t){return 0===t.major&&zd(1,23,t.minor)}(0,t)?Hd(function(e){return Object.assign(Object.assign({},e),{layout:kc(e.layout)})}(e),{major:1,minor:0}):e}function Wd(e,t,n,a){const i=Ud(n);if(a){const s=Ud(a);if(r=i,(o=s).major<r.major||o.major===r.major&&o.minor<r.minor||Vd(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,Ud("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:kl(e.offer.creative)}),layoutVariant:Object.assign(Object.assign({},i.clone(e.layoutVariant)),{layoutVariantSchema:"string"==typeof e.layoutVariant.layoutVariantSchema?$l(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:Dl("Slot",e.instanceGuid)}}function Jd(e){return Object.assign(Object.assign({},i.clone(e)),{childLayoutSchema:"string"==typeof e.childLayoutSchema?$l(e.childLayoutSchema,"ChildLayoutRootSchema",e.childLayoutId):e.childLayoutSchema})}function Kd(e){if(e){const t=function(e){try{return Object.assign(Object.assign({},i.clone(e)),{outerLayoutSchema:"string"==typeof e.outerLayoutSchema?$l(e.outerLayoutSchema,"LayoutRootLayoutSchema",e.instanceGuid):e.outerLayoutSchema,slots:i.map(Yd,e.slots)})}catch(t){throw t.message?t:Dl("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=>Wd(e,qd,t,n))))),i.over(a,(e=>Wd(e,Hd,t,n))))(e)}(t,Ao.DCUI_SCHEMA_VERSION)}}const Zd=i.cond([[i.where({signalType:i.equals("SignalSecondaryResponse")}),function*(e,t){return yield r.put({type:no,payload:{level:Oo,code:$o,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(Er,t),i=wr(a)?a.ref:void 0;return yield r.call(e.addAdvertiserWindowRef,i,n),wr(a)||"newTab"!==t.urlBehavior?"SUCCESS":(yield r.put({type:no,payload:{level:Oo,code:Go,message:`Did not receive a window reference opening link ${t.url}`}}),"UNSPECIFIED")}catch(e){return yield r.put({type:no,payload:{level:Oo,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:no,payload:{level:Oo,code:$o,message:"URL response doesn't have a valid url",additionalInformation:{instanceGuid:e.instanceGuid}}}),"ERROR"}],[i.T,function*(){return"EXPLICIT_DISMISSAL"}]]);function*Qd(e){return yield r.put({type:no,payload:{level:Oo,code:$o,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}function*Xd(e,t){let n="IMPLICIT_DISMISSAL";const a=t.payload.offerPositionIndex,i=W(t.payload)||Y(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:ao,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*Qd(i):yield*Zd(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*Qd(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:no,payload:{level:Oo,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:no,payload:{level:Oo,code:"INCORRECTLY_HANDLE_EXTERNAL_ACTION",message:`External action was dispatched as an engagement erroneously. Instance GUID: ${i.instanceGuid}`}}),n="ERROR"}J(t.payload)||(yield r.put(function(e,t){switch(e){case"SUCCESS":return{type:sl,payload:{event:"Completed",completionReason:"Success",offerPositionIndex:t}};case"UNSPECIFIED":return{type:sl,payload:{event:"Completed",completionReason:"Unspecified",offerPositionIndex:t}};case"ERROR":return{type:sl,payload:{event:"Completed",completionReason:"Error",offerPositionIndex:t}};case"EXPLICIT_DISMISSAL":return{type:sl,payload:{event:"Dismissed",dismissalReason:"Explicit",offerPositionIndex:t}};case"IMPLICIT_DISMISSAL":return{type:sl,payload:{event:"Dismissed",dismissalReason:"Implicit",offerPositionIndex:t}};default:return{type:il,payload:{offerProcessStatus:"END"}}}}(n,a)))}function eu(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:no,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:no,payload:{level:R,code:"FAILED_TO_LOAD_MODULE",message:t,additionalInformation:{stack:a,reason:t?void 0:e,moduleName:n}}}),i(l.END)})),()=>{})))}const tu={"standard-marketing":()=>Promise.resolve().then((function(){return cp})),"add-to-cart":()=>Promise.resolve().then((function(){return ff})),"instant-purchase":()=>Promise.resolve().then((function(){return Iy})),"layouts-xp-sandbox":()=>Promise.resolve().then((function(){return Qy}))};function*nu(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(au,e,t,i))}function*au(e,t,n){if(n in tu){yield r.put({type:Qs,payload:n});const a=yield r.call(eu,e,t,n,tu[n]);yield r.call(ko,a)}else yield r.put({type:no,payload:{level:Co,code:"INVALID_MODULE_NAME",message:`Could not load unknown module ${n}`}})}function*iu(e){const t=yield r.select((e=>zl.getDistributionViewableItems(e.layout?zl.getDistribution(e.layout.layoutSchema):void 0))),n=yield r.select((n=>{var a;const i=nr(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:al,payload:{groupSize:n}};yield r.put(e)}}const ou=i.cond([[(e,t,n,a)=>"END"===e.offerProcessStatus,i.always({type:Wi})],[(e,t,n,a)=>t.isLastOffer&&n,i.always({type:Wi})],[(e,t,n,a)=>1===a&&!t.isLastOffer,i.always({type:tl})],[i.T,i.always(void 0)]]);function*ru(e){const t=yield r.select((e=>({exists:null!==e.progression,isLastOffer:bl(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=ou(e,t,"boolean"==typeof a&&a,n);i&&(i.type===Wi&&(yield r.put({type:ee,payload:{name:"PLACEMENT_COMPLETED"}})),yield r.put(i))}(e.payload,t,n))}function su(e){return e.type===sl&&"Interactive"===e.payload.event}function lu(e){return e.type===sl&&"Interactive"!==e.payload.event}function*cu(e){switch(e.payload.event){case"Dismissed":yield r.put({type:il,payload:{offerProcessStatus:"CONTINUE"}});break;case"Completed":yield r.put({type:ll,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:il,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*du(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:no,payload:{level:j,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*uu(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:ul.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Wi}),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:no,payload:{level:wo,code:Fo,message:"ParentGuid does not exist"}})}function*pu(e,t){yield r.all([r.takeEvery(no,Po.bind(null,e.errorService.raise)),r.takeLatest(Hi,Hl.bind(null,{display:e.displayService,partner:e.partnerInteractionService})),r.takeEvery(Xs,nu.bind(null,t,e.contextService)),r.takeLatest(cl,Xd.bind(null,{partner:e.partnerInteractionService,context:e.contextService})),r.takeEvery(il,ru),r.takeEvery(lu,cu),Do(su,cu),r.takeLatest(Vi,cr.bind(null,e.displayService)),r.takeLatest(Wi,Nr.bind(null,e.contextService)),r.takeLatest(rl,uu),r.takeLatest(to,as),r.takeEvery(Z,Gr),r.takeEvery(ne,Fr),_o(V,ts.bind(null,e.metricsService)),_o(eo,Mr.bind(null,e.rdnService)),r.takeEvery(ao,$r.bind(null,e.errorService.raise)),r.takeLatest(Bi,iu),r.takeEvery(X,es),r.takeEvery(ae,ns.bind(null,{createChildPlugin:e.childPlugin.create,partner:e.partnerInteractionService,context:e.contextService})),r.takeLatest(ie,du.bind(null,{partner:e.partnerInteractionService,context:e.contextService}))])}var fu,yu,hu,mu,vu,gu=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},bu=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 Iu={[se.SET_CUSTOM_STATE]:ul.SET_CUSTOM_STATE,[se.SET_DOMAIN_STATE]:ul.SET_DOMAIN_STATE,[se.SET_GLOBAL_OFFER_DATA_CART]:ul.SET_GLOBAL_OFFER_DATA_CART,[se.OFFER_LIFECYCLE]:pl.OFFER_LIFECYCLE,[se.OFFER_ENGAGEMENT]:pl.OFFER_ENGAGEMENT,[se.SET_PARTNER_VALIDATION_STATUS]:pl.SET_PARTNER_VALIDATION_STATUS};class Eu{constructor(e){fu.add(this),yu.set(this,void 0),gu(this,yu,e,"f")}getState(e){const t=bu(this,yu,"f").getState();return{breakpoint:t.breakpoint,progression:Il(t),customStates:ir(t,e.offerPositionIndex),domainStates:El(t,e.offerPositionIndex)}}dispatch(e,t){bu(this,yu,"f").dispatch(bu(this,fu,"m",vu).call(this,e,t))}subscribe(e,t){return t(this.getState(e)),bu(this,yu,"f").subscribe((()=>{t(this.getState(e))}))}}function Su(e,t){const n=l(),a={},i=s.configureStore({reducer:vl,devTools:{name:"Orchestrator"},preloadedState:Object.assign(Object.assign({},gl()),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 Eu(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(pu,e,o),n.run(kr,e,Kd);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({},vl),u)))),t&&Object.assign(a,t),o&&n.run(o)}})}yu=new WeakMap,fu=new WeakSet,hu=function(e,t,n){return{type:e,payload:Object.assign(Object.assign({},t),{offerPositionIndex:n.offerPositionIndex,creativeInstanceGuid:n.creativeInstanceGuid})}},mu=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},vu=function(e,t){return function(e){return e.type in Iu}(t)?bu(this,fu,"m",hu).call(this,Iu[t.type],t.payload,e):t.type===Z||t.type===ne?bu(this,fu,"m",mu).call(this,e,t):t};var xu=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 Cu={ctx:new Map([[Zs.name,Zs],[Hs.name,Hs],[As.name,As],[$s.name,$s],[Ys.name,Ys]]),cache:[]};class wu{constructor(){this._subscribers=[]}add(e){this._subscribers.push(e)}unsubscribe(){this._subscribers.forEach((e=>e.unsubscribe()))}}const Ou=()=>{},Tu=(e=Ou,t=Ou,n=Ou)=>"function"!=typeof e?e:{next:e,error:t,complete:n};class Au{constructor(e){this._setupFn=e}subscribe(e,t,n){const a=Tu(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 wu;return s.add({unsubscribe:()=>{i&&i(),o=!1}}),s}}class Ru extends Au{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 Au((e=>{const t=this.subscribe(e);return()=>t.unsubscribe()}))}}const ju={CompletedBeforeEmit:"CompletedBeforeEmit"};var Nu=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 Lu{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)=>Nu(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 Du=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 ku={getBreakpointCSSClass:B},Pu="CHILD_LAYOUTS/ADD_LAUNCHED",$u="DYNAMIC_DATA/ADD";function Gu(e={launched:{}},t){if(t.type===Pu){const n=t.payload;return n.childLayoutId?i.assocPath(["launched",n.childLayoutId],n.shouldRelaunch,e):e}return e}function Fu(e=null,t){return e}function Mu(e=null,t){if(t.type===$u){const n=t.payload;return e?n?i.mergeDeepRight(e,n):e:n}return e}function Bu(e,t){var n;return null===(n=e.childLayouts.launched[t])||void 0===n||n}function Uu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer}function Vu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.schemaVersion}const zu=Object.freeze({});function qu(e){var t;return(null===(t=e.dynamicData)||void 0===t?void 0:t.text)?e.dynamicData.text:zu}const Hu="FAILED_TO_LAUNCH_CHILD_LAYOUT";function*Wu(e,t,n){var a;if(yield null===(a=r.select(Bu,n.payload.childLayoutId))||void 0===a||a){const a=yield r.select(Vu),o=yield r.select(Uu),s=yield r.select(qu);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:j,code:Hu,message:"Could not launch child layout, failed creating plugin."})}}catch(e){yield r.call(t,{level:j,code:Hu,message:"Could not launch child layout, failed to make the child layout config serializable."})}yield r.put({type:Pu,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 Ku(t){var n;const a=bt(),i=Ct(),o=t.schema.response_key||"positive",r=Un(),s=jt(),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(ja,{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 Zu={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(Ku,{schema:t.node,testId:n})}};function Qu(){const t=Rn(),n=a.useSelector(qu),i=Zt(),o=Ct(),r=i({state:n},"textContent");return e.jsx(Kt,{value:r,children:e.jsx(wt,{value:o,overrides:Zu,children:e.jsx(xt,{children:e=>e(t)})})})}const Xu={staticData:Fu,dynamicData:Mu,childLayouts:Gu};function ep(e={}){return Object.assign({staticData:null,dynamicData:null,childLayouts:{launched:{}}},e)}function tp(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 np(e){return"object"==typeof e&&null!==e&&Object.entries(e).every((([e,t])=>"string"==typeof e&&"string"==typeof t))}function*ap(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*ip(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n,o=J(n),s=K(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(tp,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(op,e,t,a)}}(e,t,n,l);return void(yield r.call(ap,a,e.globalDispatch.bind(e),o,s,i))}}yield r.call(t,{level:R,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:R,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}function*op(e,t,n){const a=function(e){return l.eventChannel((t=>{const n=e.onEvent({name:vr,source:"partner",callback:e=>{np(e)&&t({eventName:vr,data:e})}},{name:gr,source:"partner",callback:e=>{np(e)&&t({eventName:gr,data:e})}});return()=>{n()}}))}(e);try{for(;;){const i=yield r.take(a);switch(i.eventName){case vr:yield r.put({type:ee,payload:{name:vr,body:i.data}}),yield r.put({type:$u,payload:{text:i.data}}),e.globalDispatch({type:Q,payload:{event:"Completed",completionReason:"Success"}}),n&&(yield r.call(n.close.bind(n)));break;case gr:e.globalDispatch({type:Q,payload:{event:"Completed",completionReason:"Error"}}),n&&(yield r.call(n.close.bind(n)));break;default:t({level:R,code:"UNKNOWN_REALTIME_OFFER_FULFILLMENT_EVENT",message:`Unknown event: ${i.eventName}`})}}}catch(e){const n=e;t({level:j,code:"FAILED_TO_PROCESS_REALTIME_OFFER_FULFILLMENT_EVENT",message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&a.close()}}function*rp(e,t,n){const a=W(n.payload)||Y(n.payload)||H(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":yield r.call(e.globalDispatch.bind(e),n),(J(n.payload)||K(n.payload))&&(yield r.put({type:ee,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:a.accountID,referralCreativeID:a.referralCreativeID,referralOnly:K(n.payload)}}}),J(n.payload)&&(yield r.call(op,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"}})),K(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*ip(e,t,n.payload)}}function*sp(e,t){yield r.all([r.takeLatest(z,rp.bind(null,e,t)),r.takeEvery(re,Wu.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}Object.assign({},se);const lp=(new Cn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=ep({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=ep()){const a=l(),i=s.configureStore({reducer:Xu,devTools:{name:"Standard Marketing"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(sp,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Fn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Di,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Li,{settings:i,dispatch:d.dispatch,children:e.jsx(Qu,{})})})]})}))}}));var cp=Object.freeze({__proto__:null,moduleConnectorBuilder:lp});const dp="CART/UPDATE",up="CATALOG_ITEM/RESPONSE",pp="USER_CREATIVE_RESPONSE_HISTORY/ADD",fp=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 yp({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 hp="catalogRadioGroup__label",mp=["Enter","Space"],vp={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 gp(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 bp({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((()=>gp(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(Ip(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:up,payload:{catalogItem:s,quantity:e}});const t=gp(n.validations,n.options.length,e);r(Ip(t))}return y.length>0?e.jsx(ja,{styles:n.styles?M(vp,n.styles):vp,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(hp),children:t.Children.toArray(y.map(((t,a)=>{var o;const r=fp(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:`${hp} ${null!==(o=null==n?void 0:n.optionContainer)&&void 0!==o?o:""}`,onKeyDown:e=>{r||!mp.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(yp,{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 Ip(e){return{type:ie,payload:{errors:e}}}function Ep(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Sp(t){const n=a.useDispatch(),i=Ct(),o=Un(),r=Nn(),{tabIndex:s,styles:l,isDisabled:c}=m(r);return e.jsx(ja,{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:up,payload:{catalogItem:o,quantity:1}})},className:null==a?void 0:a.own,children:Ep(t.schema.children,i,t.testId)})})}const xp={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"]},Cp=new Map([["&","_;^;_"]]),wp=new RegExp(`<a *(?=${xp.allowedAttributes.a.join("|")}|>)`,"g"),Op=new RegExp(`<a *(?:(?:${xp.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),Tp=new RegExp("(<br *?>)|(<br *?/>)","g"),Ap=new RegExp(`<ul *(?=${xp.allowedAttributes.ul.join("|")}|>)`,"g"),Rp=new RegExp(`<ol *(?=${xp.allowedAttributes.ol.join("|")}|>)`,"g"),jp=new RegExp("<li *(?=>|\\s[^>]*>)","g"),Np="<br/>";function Lp(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(Op,((e,t)=>{const n=t.replaceAll("&",Cp.get("&"));return e.replace(t,n)})).replaceAll(Tp,Np)}(e);return t===u(t,xp)}(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(ja,{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(wp,`<a ${a.join(" ")}`).replace(Ap,`<ul ${i}`).replace(Rp,`<ol ${i}`).replace(jp,`<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 Dp(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:kp(t,i,o)})}function kp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Pp(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(ja,{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)?Dp(t.schema.children,null==n?void 0:n.own,a,r,t.testId):kp(t.schema.children,r,t.testId)})}}):null}function $p(e,t){const n=e.cart[t];return n||null}function Gp(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 Fp(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 Gp(e).reduce(((e,t)=>e+t.quantity),0)}(e),s=$p(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}function Mp(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 Bp(e,t){var n,a;return null!==(a=null===(n=Mp(e))||void 0===n?void 0:n.find((e=>e.catalogItemId===t)))&&void 0!==a?a:null}function Up(e){var t;const n=null===(t=Mp(e))||void 0===t?void 0:t.filter((e=>e.preSelectedQuantity&&e.preSelectedQuantity>0));return n&&n.length>0?n:null}function Vp(e){var t,n;return null!==(n=null===(t=Up(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 zp=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 qp(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:i(t,void 0,o)})}function Hp(e,t,n){return t(e,void 0,n)}function Wp(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=Bp(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=>$p(e,v.cartItemId))),O=a.useSelector((e=>Fp(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),R=m(x||O<=0?"DISABLED":I),j=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:up,payload:{catalogItem:v,quantity:e}})};return e.jsx(ja,{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(Ma,{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(Kt,{value:b,children:(null==t?void 0:t.decrementButton)?qp(p,t.decrementButton,n,g,o):Hp(p,g,o)})}):null,l?e.jsx("input",{type:"text",className:null==t?void 0:t.input,style:Object.assign(Object.assign({},j),{cursor:j.isDisabled?"not-allowed":"auto",caretColor:j.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({},R.styles),{cursor:R.isDisabled?"not-allowed":"pointer",pointerEvents:"auto"}),onClick:e=>{e.preventDefault(),L(T+1)},tabIndex:R.tabIndex,"aria-label":f||void 0,disabled:R.isDisabled,"data-testid":o?`${o}-increment-button`:void 0,children:e.jsx(Kt,{value:b,children:(null==t?void 0:t.incrementButton)?qp(u,t.incrementButton,n,g,o):Hp(u,g,o)})}):null]})})})}const Yp={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(Sp,{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(Lp,{schema:n.node});case"CatalogUrlLink":return e.jsx(Pp,{schema:n.node});default:return}}},CatalogRadioGroup:function(t){if("CatalogRadioGroup"===t.type)return e.jsx(bp,{schema:t.node})},CatalogQuantityCounter:function(t){if("CatalogQuantityCounter"===t.type)return e.jsx(Wp,{schema:t.node})}};function Jp(){const t=Rn(),n=Ct();return e.jsx(wt,{value:n,overrides:Yp,children:e.jsx(xt,{children:e=>e(t)})})}function Kp(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 Zp={cart:function(e=Kp([]),t){if(t.type===dp){const{catalogItem:n,quantity:a}=t.payload,i=n.cartItemId,o=jo(n,a);return Object.assign(Object.assign({},e),{[i]:o})}return e},userCreativeResponseHistory:function(e=[],t){return t.type===pp?e.concat(t.payload.responseId):e},staticData:Fu,childLayouts:Gu};const Qp="INVALID_PARTNER_MESSAGE",Xp="MISCONFIGURED_CATALOG_ITEM",ef="FAILED_TO_PROCESS_PARTNER_UPDATE_CART_ITEM";function*tf(e){var t,n;const a=yield r.select(Up),i=yield r.select(Vp),o=yield r.select((e=>{var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer.maxTotalItemsQtyInOffer}));if(sf(i)&&sf(o)&&i>o)yield r.call(e,{level:j,code:Xp,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:j,code:Xp,message:`Preselected quantity (${a}) is greater than maxItemCount (${o}) for catalog item (${i.instanceGuid})`}):yield*rf(i,a,!0)}}function*nf(e,t,n){const{catalogItem:a,quantity:i}=n.payload;if(yield*rf(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:j,code:"INVALID_RESPONSE_OBJECT",message:n}))}var o}function*af(e,t){const n=function(e,t){return l.eventChannel((n=>{const a=e.onEvent({name:fr.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:j,code:Qp,message:`Invalid UpdateCartItemPartnerMessageBody: ${JSON.stringify(e)}`}):n(e)}});return()=>{a()}}))}(e,t);try{for(;;){const e=yield r.take(n);yield r.call(of,e,t)}}catch(e){const n=e;t({level:j,code:ef,message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&n.close()}}function*of(e,t){const{cartItemId:n,quantity:a}=e,i=yield r.select($p,n);if(lf(i)){const e=yield r.select(Bp,i.catalogItemId);null!==(o=e)&&"object"==typeof o&&"catalogItemId"in o&&"price"in o?yield*rf(e,a,!1):yield r.call(t,{level:j,code:ef,message:`Catalog item not found for cart item id (${n})`})}else yield r.call(t,{level:j,code:ef,message:`Cart item not found for cart item id (${n})`});var o}function*rf(e,t,n){var a;const i=yield r.select($p,e.cartItemId),o=yield r.select(Fp,e),s=sf(o)?o:0,l=lf(i)?i.quantity:0;if(t!==l&&t>=(null!==(a=e.minItemCount)&&void 0!==a?a:0)&&t-l<=s){yield r.put({type:dp,payload:{catalogItem:e,quantity:t}});const a=yield r.select($p,e.cartItemId),o=yield r.select(zp);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 sf(e){return"number"==typeof e}function lf(e){return null!=e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&"unitPrice"in e}function*cf(e,t){var n;yield r.put({type:pp,payload:{responseId:(n=t.payload,q(n)?n.responseOption.id:n.id)}}),yield r.call(e.globalDispatch.bind(e),t)}function*df(e,t){yield r.all([r.spawn(tf.bind(null,t)),r.spawn(af.bind(null,e,t)),r.takeLatest(up,nf.bind(null,e,t)),r.takeLatest(z,cf.bind(null,e)),r.takeEvery(re,Wu.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}function uf(e){return"object"==typeof e&&null!==e&&"cartItemId"in e&&"quantity"in e}Object.assign(Object.assign({},se),{CATALOG_ITEM_RESPONSE:up});const pf=(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(uf)}(i.offerState)?i.offerState:{cart:[]},d=function(e={}){return Object.assign({cart:Kp([]),userCreativeResponseHistory:[],staticData:null,childLayouts:{launched:{}}},e)}({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion},cart:Kp(c.cart)}),u=function(e,t,n){const a=l(),i=s.configureStore({reducer:Zp,devTools:{name:"Add To Cart"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(df,e,t),i}(i.gateway,i.logger,d);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Fn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Di,{}),e.jsx(a.Provider,{store:u,children:e.jsx(Li,{settings:i,dispatch:u.dispatch,children:e.jsx(Jp,{})})})]})}))}}));var ff=Object.freeze({__proto__:null,moduleConnectorBuilder:pf});const yf="CATALOG/TRIGGER_SELECT_ITEM",hf="CATALOG/SET_SELECTED_ITEM",mf="CHECKOUT_LIFECYCLE",vf="INSTANT_PURCHASE/INITIATE",gf="INSTANT_PURCHASE/PARTNER_RESPONSE",bf="INSTANT_PURCHASE/WSDK_RESPONSE",If="INSTANT_PURCHASE/SET_VARIATION_SELECTION_REQUIRED";function Ef(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:Sf(t,i,o)})}function Sf(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function xf(t){const n=a.useDispatch(),i=Ct(),o=Nn(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=Un(),d=Ht(c,"catalogItem");return e.jsx(ja,{styles:t.schema.styles,children:({classnames:a,mapperRef:o})=>e.jsx("button",{type:"button",tabIndex:r,"aria-disabled":l,disabled:l,style:Object.assign({cursor:"pointer"},s),"data-testid":t.testId,"data-e2e":"CatalogItemResponse",onClick:e=>{e.preventDefault();n({type:vf,payload:{catalogItem:c,quantity:1,useInstantPurchaseExtension:!0}})},className:null==a?void 0:a.own,children:e.jsx(Kt,{value:d,children:(null==a?void 0:a.own)?Ef(t.schema.children,a.own,o,i,t.testId):Sf(t.schema.children,i,t.testId)})})})}const Cf=["ArrowDown","ArrowUp","Enter","Escape","Tab"];function wf(n){const i=jt(),o=Ct(),r=Zt(),s=e=>r({data:e},"catalogItem"),l=t.useMemo((()=>i.catalogItems||[]),[i]),c=Nn(),{styles:d,isDisabled:u}=m(c),p=t.useRef(null),f=t.useRef([]),[y,h]=t.useState(!1),[v,g]=t.useState(0),b=a.useDispatch(),I=a.useSelector((e=>e.variationSelectionRequired)),E=a.useSelector((e=>e.selectedItem));function S(t,a,i,r){return t?function(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:i(t,void 0,o)})}(a,t,i,o,r||n.testId):function(e,t,n){return t(e,void 0,n)}(a,o,r||n.testId)}function x(){u||(y?w():C())}function C(){u||h(!0)}function w(){u||h(!1)}function O(e){g(l.indexOf(e)),w(),b({type:yf,payload:{catalogItem:e}}),I&&b({type:If,payload:null})}t.useEffect((()=>{if(y){const e=f.current[v];e&&e.focus()}}),[y,v]);const T={elements:{own:[{default:{background:{backgroundColor:{light:"#ffffff"}},dimension:{width:{type:"percentage",value:100}}}}]}};function A(e){if(!u&&Cf.includes(e.key))switch(e.key){case"ArrowDown":{e.preventDefault();const t=v+1;t<l.length&&g(t);break}case"ArrowUp":{e.preventDefault();const t=v-1;t>=0&&g(t);break}case"Enter":if(e.preventDefault(),y){const e=l[v];e&&O(e)}else C();break;case"Tab":if(y&&E){w();const e=l.indexOf(E);-1!==e&&g(e)}break;case"Escape":if(e.preventDefault(),y&&E){w();const e=l.indexOf(E);-1!==e&&g(e)}}}return l.length>1?e.jsx(ja,{styles:n.schema.styles?M(T,n.schema.styles):T,children:({classnames:t,mapperRef:a})=>e.jsxs("div",{className:null==t?void 0:t.dropDownContainer,children:[e.jsxs("div",{ref:p,className:null==t?void 0:t.own,onKeyDown:A,onClick:x,onBlur:e=>{var t;(null===(t=p.current)||void 0===t?void 0:t.contains(e.relatedTarget))||y&&w()},"data-e2e":"DropDown","data-testid":n.testId?`${n.testId}-drop-down-container`:void 0,"aria-disabled":u,style:Object.assign({position:"relative"},d),tabIndex:0,children:[e.jsx("div",{className:null==t?void 0:t.dropDownSelectedElement,"aria-disabled":u,"data-testid":n.testId?`${n.testId}-drop-down-selected-element`:void 0,style:Object.assign({cursor:"pointer"},d),children:E?e.jsx(Kt,{value:s(E),children:S(null==t?void 0:t.dropDownSelectedElement,n.schema.closedTemplate,a)}):S(null==t?void 0:t.dropDownSelectedElement,n.schema.closedDefaultTemplate,a)}),y&&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"},d),children:l.map(((i,o)=>e.jsx("li",{ref:e=>function(e,t){f.current[t]=e}(e,o),className:null==t?void 0:t.dropDownListElement,onClick:e=>{e.stopPropagation(),u||O(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"},d),children:e.jsx(Kt,{value:s(i),children:S(null==t?void 0:t.dropDownSelectedElement,n.schema.openTemplate,a)})},i.catalogItemId)))})]}),I&&n.schema.requiredSelectionErrorTemplate?S(null==t?void 0:t.requiredSelectionErrorElement,n.schema.requiredSelectionErrorTemplate,a,"dropdown-required-selection-error"):e.jsx("p",{className:(null==t?void 0:t.requiredSelectionErrorElement)||"",children:" "})]})}):null}function Of(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:mf,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(ja,{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 Tf=/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/;function Af(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)&&Tf.test(d)?e.jsx(ja,{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 Rf(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 jf=Rf("ChevronLeft"),Nf=Rf("ChevronRight");function Lf(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=Nn(),{styles:C,isDisabled:w,tabIndex:O}=m(x),T=t.useRef(null),A=t.useRef(null),R=t.useRef([]),j=t.useRef([]),N=t.useRef(null);function L(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=A.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),N.current&&N.current()):e.current=requestAnimationFrame(i)};return i(),()=>{null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)}}),[N.current])}(),t.useEffect((()=>{var e,t;f(l),h(0),null===(e=j.current[0])||void 0===e||e.scrollIntoView({behavior:"instant"}),null===(t=R.current[l])||void 0===t||t.scrollIntoView({behavior:"instant"})}),[r.catalogItemId,l]),t.useEffect((()=>{const e=T.current;if(!e)return;function t(e){const t=T.current;t&&0!==e.deltaY&&(e.preventDefault(),t.scrollLeft+=e.deltaY)}const n=new ResizeObserver((()=>{var t,n;g(e.scrollWidth>e.clientWidth),L(e),e.clientWidth!==b&&(null===(t=R.current[p])||void 0===t||t.scrollIntoView({behavior:"instant"}),null===(n=j.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 _={display:"flex",position:"absolute",top:"50%",transform:"translateY(-50%)",backgroundColor:"transparent",cursor:w?"not-allowed":"pointer"};function D(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=R.current[a])||void 0===t||t.scrollIntoView({}),null===(n=j.current[o])||void 0===n||n.scrollIntoView({}),h(o),f(i),N.current=a===i?()=>{S(!1)}:()=>{var e;null===(e=R.current[i])||void 0===e||e.scrollIntoView({behavior:"instant"}),S(!1)}}return s.length>0?e.jsx(ja,{styles:a.styles,children:({classnames:n})=>e.jsxs("div",{className:null==n?void 0:n.own,children:[e.jsxs("div",{style:{position:"relative"},children:[1===l&&e.jsxs(e.Fragment,{children:[e.jsx("button",{style:Object.assign(Object.assign({},_),{left:"5%"}),className:null==n?void 0:n.scrollIconButton,onClick:()=>D(-1),"data-testid":"main-image-scroll-left-button",children:e.jsx(Wa,{schema:a.leftScrollIconTemplate||jf})}),e.jsx("button",{style:Object.assign(Object.assign({},_),{right:"5%"}),className:null==n?void 0:n.scrollIconButton,onClick:()=>D(1),"data-testid":"main-image-scroll-right-button",children:e.jsx(Wa,{schema:a.rightScrollIconTemplate||Nf})})]}),e.jsx("div",{ref:A,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){R.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({},C),{height:"100%"}),"data-testid":`${i}-main-image-${a}`,"data-e2e":"CatalogImageGallery-mainImage"})},`${t.light}-${a}`))))})]}),e.jsx("div",{ref:T,onScroll:e=>L(e.currentTarget),className:null==n?void 0:n.thumbnailList,style:Object.assign(Object.assign({},C),{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){j.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({},C),{cursor:w?"not-allowed":"pointer",pointerEvents:"auto",aspectRatio:"1 / 1"}),"data-testid":`${i}-thumbnail-${a}`,"data-e2e":"CatalogImageGallery-thumbnail",tabIndex:O,onClick:()=>function(e){var t,n;if(E)return;S(!0);const a=l?e+1:e;f(a),h(e),null===(t=R.current[a])||void 0===t||t.scrollIntoView({}),null===(n=j.current[e])||void 0===n||n.scrollIntoView({}),N.current=()=>{S(!1)}}(a)})}))))})]})}):null}const _f={size:80,radius:30,stroke:7,duration:2,primaryColor:"#222",secondaryColor:"#d6d6d6",primaryRotation:-50,secondaryRotation:45,arcFraction:1/3.5},Df={elements:{own:[{default:{container:{justifyContent:"center",alignItems:"center"},dimension:{width:{type:"percentage",value:100}}}}],spinner:[{default:{container:{justifyContent:"center",alignItems:"center"}}}]}};function kf(t){var n;const{config:a}=t.schema,i=Object.assign(Object.assign({},_f),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(ja,{styles:t.schema.styles?M(Df,t.schema.styles):Df,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 Pf(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(ja,{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 $f(n){const i=a.useDispatch(),o=a.useSelector((e=>e.selectedItem)),r=n.schema,s=n.schema.styles,l=Nn(),{styles:c,isDisabled:d}=m(l);function u(){i(o?{type:X,payload:{key:r.customStateKey,value:r.customStateValue}}:{type:If,payload:"default"})}return e.jsx(ja,{styles:s,children:({classnames:a})=>{var i;return e.jsx("button",{className:null==a?void 0:a.own,onClick:u,"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 Gf(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(ja,{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(Fa,{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 Ff(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(ja,{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 Mf(n){const i=Ct(),o=$n(),r=Zt(),s=bt(),l=jt().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(ja,{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(Bn,{context:c,children:e.jsx(Pn,{value:o(c),children:e.jsx(Kt,{value:(s=c,r({data:s},"catalogItem")),children:i(n.schema.template,void 0,n.testId?`${n.testId}-child`:"")})})}))});var s}}):null}const Bf={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(xf,{schema:t.node,testId:n})},CatalogCombinedCollection:function(t,n){if("CatalogCombinedCollection"===t.type)return e.jsx(Mf,{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(wf,{schema:n.node});case"CatalogVariationSelectionButton":return e.jsx($f,{schema:n.node});case"CheckoutStateButtonTrigger":return e.jsx(Of,{schema:n.node});case"ColorSwatch":return e.jsx(Af,{schema:n.node});case"CatalogImageGallery":return e.jsx(Lf,{schema:n.node});case"DismissInstantPurchaseButton":return e.jsx(Ff,{schema:n.node});case"LoadingSpinner":return e.jsx(kf,{schema:n.node});case"OfferLifecycleTimer":return e.jsx(Pf,{schema:n.node});case"ReadMoreTextContainer":return e.jsx(Gf,{schema:n.node});default:return}}}};function Uf(){const t=Rn(),n=Ct(),i=a.useSelector(qu),o=Zt()({state:i},"textContent");return e.jsx(wt,{value:n,overrides:Bf,children:e.jsx(Kt,{value:o,children:e.jsx(xt,{children:e=>e(t)})})})}function Vf(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 zf={staticData:Fu,selectedItem:(e=null,t)=>t.type===hf?t.payload:e,dynamicData:Mu,childLayouts:Gu,fulfillmentDetails:(e=null,t)=>"INSTANT_PURCHASE/SET_FULFILLMENT_DETAILS"===t.type?t.payload:e,variationSelectionRequired:(e=null,t)=>t.type===If?t.payload:e};function qf(e={}){return Object.assign({staticData:null,selectedItem:null,dynamicData:null,childLayouts:{launched:{}},fulfillmentDetails:null,variationSelectionRequired:null},e)}const Hf="INVALID_RESPONSE_OBJECT",Wf="MISSING_APP_STATE_IN_INSTANT_PURCHASE_MODULE",Yf="MISSING_PAYMENT_REF_IN_INSTANT_PURCHASE_MODULE",Jf="MISSING_STATIC_DATA_IN_INSTANT_PURCHASE_MODULE";function Kf(e,t){return l.eventChannel((n=>e.onEvent({name:yr.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:j,code:"MALFORMED_INSTANT_PURCHASE_PARTNER_DATA",message:`Malformed data received from partner\n ${e}`})}})))}function*Zf(e,t){var n;try{for(;;){const t=yield r.take(e);t&&(yield r.put({type:gf,payload:t}))}}catch(e){yield r.call(t,{level:j,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*Qf(e,t){var n;try{for(;;){const t=yield r.take(e);if(t){yield r.put({type:bf,payload:t});break}}}catch(e){yield r.call(t,{level:j,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 Xf="Unknown failure reason",ey=6e4;function*ty(){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*ly(a[0]))}function*ny(e){const{catalogItem:t}=e.payload;yield*ly(t)}function*ay(e,t,n){const{catalogItem:a,quantity:i}=n.payload,o=jo(a,i);o?(yield r.put({type:Z,payload:{name:"SignalCartItemInstantPurchaseInitiated",parentGuid:a.instanceGuid,objectData:{catalogItemId:a.catalogItemId,quantity:i}}}),yield*py("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:j,code:Wf,message:"App state is not set within Redux store."}),void(yield*fy("offerComplete",2));if(!a.staticData)return yield r.call(n,{level:j,code:Jf,message:"App state is not configured with static data."}),void(yield*fy("offerComplete",2));const i=a.staticData.offer.creative.copy["ppu.partnerPaymentReference"];if(!i)return yield r.call(n,{level:j,code:Yf,message:"Partner payment reference is not set within creative copy."}),void(yield*fy("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(sy,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(ry,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:j,code:Hf,message:`Unable to translate catalog item with ID ${a.catalogItemId} to cart item for instant purchase transaction.`}),yield*fy("offerComplete",2))}function*iy(e,t){const n=yield r.select((e=>e.staticData));if(!n)return yield r.call(e,{level:j,code:Jf,message:"App state is not configured with static data."}),void(yield*uy("Error"));if(!n.offer.catalogItems)return yield r.call(e,{level:j,code:"MISSING_CATALOG_ITEMS",message:"No catalog items found within offer data."}),void(yield*uy("Error"));const a={accountId:n.offer.accountId,catalogItems:n.offer.catalogItems};let i,o;t.payload.success?(i=cy,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||Xf,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=dy(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:j,code:Hf,message:`Unable to map cart items to catalog items in the instant purchase partner response: ${n}.`})}(i,a))}(t.payload,a,i,e),yield*uy(o)}function*oy(e){e.payload.response&&e.payload.response.success?yield*fy("offerComplete",1):yield*fy("offerComplete",2)}function*ry(e,t){const n=Kf(e,t),{timeout:a}=yield r.race({channel:r.call(Zf,n,t),timeout:r.delay(ey)});a&&(yield r.call(t,{level:j,code:"INSTANT_PURCHASE_PARTNER_RESPONSE_TIMEOUT",message:"Instant-purchase partner response timed out after 60000ms"}),n.close(),yield*function*(e){yield*py("ProcessingState",0),yield r.put({type:Q,payload:{event:"Dismissed",dismissalReason:e}})}("Implicit"))}function*sy(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:j,code:"MALFORMED_INSTANT_PURCHASE_WSDK_DATA",message:`Malformed data received from wsdk\n ${e}`})}}))))))}(e,t),{timeout:a}=yield r.race({channel:r.call(Qf,n,t),timeout:r.delay(ey)});a&&(yield r.call(t,{level:j,code:"INSTANT_PURCHASE_WSDK_RESPONSE_TIMEOUT",message:"Instant-purchase wsdk response timed out after 60000ms"}),n.close(),yield*fy("offerComplete",2))}function*ly(e){var t,n,a;yield r.put({type:hf,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:$u,payload:{text:i}})}function cy(e,t){return{name:"SignalCartItemInstantPurchase",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,initiatedBy:T.DCUI}}}function dy(e,t){return t.find((t=>t.catalogItemId===e.catalogItemId))}function*uy(e){yield*py("ProcessingState",0),yield r.put({type:Q,payload:{event:"Completed",completionReason:e}})}function*py(e,t){yield r.put({type:X,payload:{key:e,value:t}})}function*fy(e,t){yield*py("ProcessingState",0),yield r.put({type:te,payload:{key:e,value:t}})}const yy=["Success","Unspecified","Error"],hy=["Implicit","Explicit"];function*my(e,t){if("Checkout"!==t.payload.event)return;yield r.put({type:te,payload:{key:"checkout",value:vy(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?yy.includes(n.reason):hy.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:j,code:"CHECKOUT_BUTTON_INVALID_OFFERLIFECYCLE",message:`Misconfigured offer lifecycle payload in handleCheckoutLifecycle: ${n}.`})}else yield r.call(e,{level:j,code:"CHECKOUT_BUTTON_UNKNOWN_EVENT",message:`Unknown event type in checkout lifecycle: ${JSON.stringify(n)}`})}}function vy(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*gy(e,t){yield r.all([r.spawn(ty),r.takeEvery(mf,my.bind(null,t)),r.takeEvery(yf,ny),r.takeLatest(vf,ay.bind(null,e,t)),r.takeLatest(gf,iy.bind(null,t)),r.takeLatest(bf,oy.bind(null)),r.takeEvery(re,Wu.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}Object.assign(Object.assign({},se),{INITIATE_INSTANT_PURCHASE:vf,INSTANT_PURCHASE_PARTNER_RESPONSE:gf,INSTANT_PURCHASE_WSDK_RESPONSE:bf});const by=(new Cn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=qf({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion},fulfillmentDetails:Vf(i.offerData.creative)}),d=function(e,t,n=qf()){const a=l(),i=s.configureStore({reducer:zf,devTools:{name:"Instant Purchase"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(gy,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Fn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Di,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Li,{settings:i,dispatch:d.dispatch,children:e.jsx(Uf,{})})})]})}))}}));var Iy=Object.freeze({__proto__:null,moduleConnectorBuilder:by});const Ey=t.createContext(null),Sy=({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(Ey.Provider,{value:{images:i,activeIndex:r,duration:l,setImages:o,setActiveIndex:s,setDuration:c},children:e.jsx(Kt,{value:d({data:{"image.title":null===(a=i[r])||void 0===a?void 0:a.title}},"creativeCopy"),children:n})})};function xy({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 Cy(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 wy({schema:n,testId:a}){const i=JSON.parse(n.data),{styles:o,duration:r,imageKeys:s}=i,l=t.useContext(Ey),c=Cy(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(xy,{duration:r,active:n===(null==l?void 0:l.activeIndex),containerStyles:o.elements.indicatorContainer,indicatorStyles:o.elements.indicator}))))})]})}const Oy={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"]},Ty=new Map([["&","_;^;_"]]),Ay=new RegExp(`<a *(?=${Oy.allowedAttributes.a.join("|")}|>)`,"g"),Ry=new RegExp("<span*>","g"),jy=new RegExp(`<a *(?:(?:${Oy.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),Ny=new RegExp("(<br *?>)|(<br *?/>)","g"),Ly="<br/>";function _y(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(jy,((e,t)=>{const n=t.replaceAll("&",Ty.get("&"));return e.replace(t,n)})).replaceAll(Ny,Ly)}(e);return t===u(t,Oy)}(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(ja,{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(Ay,`<a ${a.join(" ")}`).replace(Ry,`<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(Ay,`<a ${a.join(" ")}`).replace(Ry,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}});var i}}):null}function Dy({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 Hs={name:"loading-extension",componentFactory:e=>t.createElement(qs,{data:e}),interceptors:{}};function Ws({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(Jt,null,(e=>t.createElement(ja,{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(Ws,{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 Ks(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 Zs={name:"timer-progression-extension",componentFactory:e=>t.createElement(Ks,{data:e}),interceptors:{}},Qs="MODULE/ADD_LOADED",Xs="MODULE/LOAD",el="PROGRESSION/INITIALISE",tl="PROGRESSION/NEXT",nl="PROGRESSION/PREV",al="PROGRESSION/UPDATE_GROUP_SIZE",il="PROGRESSION/PROCESS",ol="SLOTS/SET",rl="INSTANT_PURCHASE/DISMISS",sl="OFFER_LIFECYCLE",ll="DOMAIN_STATES/SET",cl="OFFER_ENGAGEMENT",dl="GLOBAL_OFFER_DATA_STATE/SET_CART",ul=Object.assign(Object.assign({},oo),{NEXT_IN_PROGRESSION:tl,PREV_IN_PROGRESSION:nl,INITIALISE_PROGRESSION:el,UPDATE_GROUP_SIZE:al,SET_SLOTS:ol,ADD_LOADED_MODULE:Qs,SET_DOMAIN_STATE:ll,SET_GLOBAL_OFFER_DATA_CART:dl}),pl=Object.assign(Object.assign({},ro),{LOAD_MODULES:Xs,DISMISS_INSTANT_PURCHASE:rl,PROCESS_PROGRESSION:il,OFFER_LIFECYCLE:sl,OFFER_ENGAGEMENT:cl,SET_PARTNER_VALIDATION_STATUS:ie});function fl(e,t){return t<=0||e<=0||t>e?0:Math.ceil(e/t)}function yl(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<fl(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 hl(){return{[ml]:{}}}const vl=Object.assign({progression:function(e=null,t){switch(t.type){case el:if(function(e){const{totalCount:t,currentGroupIndex:n,groupSize:a}=e;return t>=0&&a>=0&&n>=0&&a<=t&&n<fl(t,a)}(t.payload)){const{totalCount:e,_:n,groupSize:a}=t.payload;return Object.assign(Object.assign({},t.payload),{indexGroups:yl(e,a)})}return null;case al:{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:yl(a,n),currentGroupIndex:0}):null}case tl:{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,fl(t,n)-1)}):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.max(a-1,0)}):null}default:return e}},slots:function(e=[],t){return t.type===ol?t.payload:e},module:function(e={loadedModules:[]},t){return t.type===Qs?Object.assign(Object.assign({},e),{loadedModules:[...e.loadedModules,t.payload]}):e},domainStates:function(e=hl(),t){if(t.type===ll){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===dl){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}},lr);function gl(e={}){return Object.assign(Object.assign(Object.assign({},function(e={}){return Object.assign({layout:Zo(),breakpoint:{breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},active:Qo(),fonts:[],signal:{queue:[],processed:[]},serializableCache:sr(),settings:{closeOnComplete:!0},customStates:{root:{}}},e)}(e)),{progression:null,slots:[],module:{loadedModules:[]},domainStates:hl(),globalOfferDataState:{}}),e)}function bl(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 Il(e){return e.progression?{activeGroupIndex:e.progression.currentGroupIndex,totalOffers:e.progression.totalCount,totalGroups:fl(e.progression.totalCount,e.progression.groupSize),isLast:bl(e)}:null}function El(e,t){return e.domainStates[`module${t}`]||{offerComplete:0,checkout:0}}function Sl(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 xl(n){var i;const{config:o,position:r,visible:s,container:l,testId:c}=n,d=zn(),u=Nn(),p=a.useSelector(Xo),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 Cl({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(ja,{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($i,{effect:n.transition,visible:a===l,parentElement:s.current,children:e.jsx(xl,{config:t,position:a,visible:a===l,container:"column"})}))))})}):null}const wl=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=fl(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(Jt,{children:a=>e.jsx(ja,{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 Ol="partnerValidationUI",Tl="stackedViewableItems";function Al(n){var o;const r=a.useDispatch(),s=a.useSelector((e=>e.slots)),l=null!==(o=n.schema.viewableItems)&&void 0!==o?o:[],c=Ia(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:Ki,payload:{key:Tl,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(ja,{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(xl,{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}=h(r),u=()=>{o({type:"Backward"===n.schema.direction?ul.PREV_IN_PROGRESSION:ul.NEXT_IN_PROGRESSION})};return e.jsx(ja,{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 jl({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(ar),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}=h(w),R=`${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:ul.NEXT_IN_PROGRESSION}):a<i&&C({type:ul.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 j={overflow:"hidden"},N={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:R,alignItems:"stretch"},L=e=>{var t;return null!==(t=null==v?void 0:v.includes(e))&&void 0!==t&&t},_=n.peekThroughSize[Math.min(I,n.peekThroughSize.length-1)],D=_?"Fixed"===(k=_).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)(D)?`(100% - 2 * ${D} - (${P} + 1) * ${R})/${P}`:`(100% - (${P} - 1) * ${R})/${P}`})`,position:"relative",display:"flex",overflow:"auto"};return(null==b?void 0:b.length)>0?e.jsx(ja,{styles:n.styles,children:({classnames:n})=>e.jsx("div",{ref:S,style:Object.assign(Object.assign({},j),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(xl,{config:t,position:n,container:"row",visible:L(n)})}))))})})}):null}const Nl=Object.freeze([]);function Ll({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)||Nl})),c=a.useSelector((e=>e.slots||Nl)),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(ja,{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($i,{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(xl,{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 Dl(e,t,n=!1){return Error(`Could not translate ${e} with guid: ${t}${n?" for child layout":""}`)}function kl(e,t=!1){var n;try{if(e.responseOptionsMap||t)return Object.assign(Object.assign({},e),{responseOptionsMap:i.mapObjIndexed(Pl,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:Dl("Creative",e.instanceGuid,t)}}function Pl(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:Dl("CreativeResponse",e.instanceGuid)}}function $l(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 Fl={OneByOneDistribution:function(t){if("OneByOneDistribution"===t.type)return e.jsx(Cl,{schema:t.node})},StackedDistribution:function(t){if("StackedDistribution"===t.type)return e.jsx(Al,{schema:t.node})},ProgressIndicator:function(t){if("ProgressIndicator"===t.type)return e.jsx(wl,{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(ho,{schema:t.node})},CloseButton:function(t){if("CloseButton"===t.type)return e.jsx(co,{schema:t.node})},EscapeHatch:(Ml=[function(t,n){if(v("CloseButton",t)){const n=JSON.parse(t.node.data);return e.jsx(co,{schema:n.node,action:n.action})}},vi],e=>Ml.reduce(((t,n)=>void 0===t?n(e):t),void 0)),CarouselDistribution:function(t){if("CarouselDistribution"===t.type)return e.jsx(jl,{schema:t.node})},GroupedDistribution:function(t){if("GroupedDistribution"===t.type)return e.jsx(Ll,{schema:t.node})},BottomSheet:function(t){if("BottomSheet"===t.type)return e.jsx(Io,{schema:t.node})}};var Ml;function Bl(e,t){e({type:Z,payload:{name:"SignalActivation",parentGuid:t}})}function Ul({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:Il(e),customStates:e.customStates.root,domainStates:e.domainStates[ml]})),i.equals),y=a.useSelector((e=>e.slots.length)),m=a.useSelector((e=>{var t;const n=Number(null!==(t=e.serializableCache.get(Tl))&&void 0!==t?t:"");return y-n})),h=a.useSelector(Sl);de(Tt(),p),t.useEffect((()=>(u&&document.body.addEventListener("click",Bl.bind(null,p,u.instanceGuid),{once:!0}),()=>{u&&document.body.removeEventListener("click",Bl.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:ao,payload:{code:"LAYOUT_IMPRESSED"}};p(e),p(t)}}),[u]);const v=e=>{p({type:pl.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(Fn,{info:{layoutType:"OuterLayout",pageInstanceGuid:n},children:e.jsx(Kt,{value:t,children:e.jsx(wt,{value:a,overrides:Fl,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 Vl=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}}}),zl=Object.assign({},Vl);function*ql(e,t){const n=zl.getDistribution(t),a=null==n?void 0:n.type,i=yield r.select(ar),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:ul.INITIALISE_PROGRESSION,payload:{currentGroupIndex:0,totalCount:e,groupSize:o}}))}function*Hl(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:no,payload:{level:wo,code:Fo,message:"Layout instance guid does not exist"}}),yield c.put({type:Xs,payload:{modules:s.map((e=>e.layoutVariant.moduleName))}}),yield c.put({type:Vi,payload:r.breakpoints}),yield c.put({type:ul.LAYOUT_UPDATE,payload:{instanceGuid:a,layoutSchemaVersion:o,layoutSchema:r.layout,settings:r.settings}}),yield c.put({type:ul.SET_SLOTS,payload:s}),i.isNil(r.settings)||(yield c.put({type:ul.SET_SETTINGS,payload:r.settings})),yield*ql(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(Wl,e,mr.PartnerValidationEvent.SHOW_PARTNER_VALIDATION_STATUS,(()=>({type:"ACTIVE/ADD",payload:{id:Ol}})))}catch(e){return yield c.put({type:no,payload:{level:Co,code:Bo,message:"Failed to establish partner validation."}}),"FAILURE"}return"OK"}(e.partner,r.settings,s);"OK"===l&&(yield c.call(Pr,e.display,r.display,null===(n=r.settings)||void 0===n?void 0:n.frameControls))}function*Wl(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 Dc(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 Kl=i.all(i.anyPass([function(e){return"Row"===e.type&&ec(e.node.children)},function(e){return"Column"===e.type&&ec(e.node.children)},ic,oc])),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,ic,function(e){return"DataImage"===e.type},function(e){return"When"===e.type&&tc(e.node.children)}])),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)},oc,ic])),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)},ic,function(e){return"RichText"===e.type},oc,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&ac(e.node.children)},function(e){return"StaticLink"===e.type&&ac(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CloseButton"===e.type&&ac(e.node.children)}]));function ec(e){return Kl(e)}function tc(e){return Zl(e)}function nc(e){return Ql(e)}function ac(e){return Xl(e)}function ic(e){return"StaticImage"===e.type}function oc(e){return"BasicText"===e.type}const rc=i.lensPath(["styles","elements","link"]),sc=i.lensPath(["styles","elements","activeIndicator"]),lc=i.lensPath(["styles","elements","indicator"]),cc=i.lensPath(["styles","elements","seenIndicator"]),dc=i.lensPath(["focussed"]),uc=i.lensPath(["hovered"]),pc=i.lensPath(["default"]),fc=i.lensPath(["pressed"]),yc=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(rc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default})))),i.over(rc,i.map(i.when(i.has("focussed"),i.over(dc,yc)))),i.over(rc,i.map(i.when(i.has("hovered"),i.over(uc,yc)))),i.over(rc,i.map(i.when(i.has("default"),i.over(pc,yc)))),i.over(rc,i.map(i.when(i.has("pressed"),i.over(fc,yc)))))),hc=i.pipe(i.when(i.hasPath(["styles","elements","activeIndicator"]),i.over(sc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","indicator"]),i.over(lc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","seenIndicator"]),i.over(cc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))));function vc(e,t){return e?{elements:{own:e.elements.own.map(t)}}:void 0}const gc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),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,disabled:e.disabled}),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=>{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}`)}},Oc=e=>{switch(e){case"breakpoint":return"Breakpoint";case"progression":return"Progression";case"position":return"Position";default:throw Jl("When",`Invalid target: ${e}`)}},Tc=e=>{const{target:t,condition:n,value:a}=e;return{type:Oc(t),predicate:{condition:wc(n),value:a}}};function Ac(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=>Dc(e)));if(ec(t))return Object.assign(Object.assign({},e),{children:t,styles:vc(e.styles,Sc)});throw Jl("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function jc(e){const t=e.children.map((e=>Dc(e)));if(tc(t))return Object.assign(Object.assign({},e),{children:t,styles:vc(e.styles,xc)});throw Jl("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function Nc(e){const t=e.children.map((e=>Dc(e)));if(nc(t))return Object.assign(Object.assign({},e),{children:t,styles:vc(e.styles,Cc)});throw Jl("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}const Lc=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:Lc(null===(n=e.styles)||void 0===n?void 0:n.elements)}:void 0,i=e.children.map((e=>Dc(e)));if(ac(i))return Object.assign(Object.assign({},e),{styles:a,children:i});throw Jl("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function Dc(e){switch(e.type){case"When":return{type:"When",node:(s=e.node,{predicates:s.predicates.map(Tc),children:s.children.map((e=>Dc(e)))})};case"OneByOneDistribution":return{type:e.type,node:Ac(e.node)};case"Overlay":return{type:e.type,node:_c(e.node)};case"Column":return{type:e.type,node:(r=e.node,{styles:vc(r.styles,gc),children:r.children.map((e=>Dc(e)))})};case"Row":return{type:e.type,node:(o=e.node,{styles:vc(o.styles,bc),children:o.children.map((e=>Dc(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:jc(e.node)};case"StaticLink":return{type:e.type,node:Nc(e.node)};case"StaticImage":return{type:e.type,node:(a=e.node,Object.assign(Object.assign({},a),{styles:vc(a.styles,Ic)}))};case"DataImage":return{type:e.type,node:(n=e.node,Object.assign(Object.assign({},n),{styles:vc(n.styles,Ec)}))};case"ProgressIndicator":return{type:e.type,node:(t=e.node,hc(t))};default:return e}var t,n,a,i,o,r,s}function kc(e){return Bd(e)}function Pc(e,t){return Error(`Migration process from v0_23 to v1_0 failed: could not transform ${e} node. For more details: ${t}`)}const $c=e=>"scroll"===e||"auto"===e?"visible":e,Gc=i.lensPath(["elements","own"]),Fc=i.lensPath(["transitions","transition","value","own"]),Mc=i.lensPath(["elements","wrapper"]),Bc=i.lensPath(["transitions","transition","value","wrapper"]),Uc=i.lensPath(["elements","indicator"]),Vc=i.lensPath(["transitions","transition","value","indicator"]),zc=i.lensPath(["elements","activeIndicator"]),qc=i.lensPath(["transitions","transition","value","activeIndicator"]),Hc=i.lensPath(["elements","seenIndicator"]),Wc=i.lensPath(["transitions","transition","value","seenIndicator"]),Yc=i.lensPath(["default","container","overflow"]),Jc=i.lensPath(["pressed","container","overflow"]),Kc=i.lensPath(["hovered","container","overflow"]),Zc=i.lensPath(["focussed","container","overflow"]),Qc=i.lensPath(["disabled","container","overflow"]),Xc=i.lensPath(["container","overflow"]),ed=i.pipe(i.when(i.hasPath(["default","container","overflow"]),i.over(Yc,$c)),i.when(i.hasPath(["pressed","container","overflow"]),i.over(Jc,$c)),i.when(i.hasPath(["hovered","container","overflow"]),i.over(Kc,$c)),i.when(i.hasPath(["focussed","container","overflow"]),i.over(Zc,$c)),i.when(i.hasPath(["disabled","container","overflow"]),i.over(Qc,$c))),td=i.when(i.hasPath(["container","overflow"]),i.over(Xc,$c)),nd=i.pipe(i.when(i.hasPath(["elements","own"]),i.over(Gc,i.map(ed))),i.when(i.hasPath(["transitions","transition","value","own"]),i.over(Fc,td))),ad=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)})),id=i.pipe(nd,ad),od=i.pipe(i.when(i.hasPath(["elements","wrapper"]),i.over(Mc,i.map(ed))),i.when(i.hasPath(["transitions","transition","value","wrapper"]),i.over(Bc,td))),rd=i.pipe(i.when(i.hasPath(["elements","indicator"]),i.over(Uc,i.map(ed))),i.when(i.hasPath(["transitions","transition","value","indicator"]),i.over(Vc,td))),sd=i.pipe(i.when(i.hasPath(["elements","activeIndicator"]),i.over(zc,i.map(ed))),i.when(i.hasPath(["transitions","transition","value","activeIndicator"]),i.over(qc,td))),ld=i.pipe(i.when(i.hasPath(["elements","seenIndicator"]),i.over(Hc,i.map(ed))),i.when(i.hasPath(["transitions","transition","value","seenIndicator"]),i.over(Wc,td)));function cd(e){return"StaticImage"===e.type}function dd(e){return"StaticIcon"===e.type}function ud(e){return"BasicText"===e.type}function pd(e){return"DataImage"===e.type}function fd(e){return"DataIcon"===e.type}function yd(e){return"RichText"===e.type}function md(e){return"SlideStateTrigger"===e.type}function hd(e){return"ToggleButtonStateTrigger"===e.type}const vd=i.all(i.anyPass([function(e){return"Row"===e.type&&gd(e.node.children)},function(e){return"Column"===e.type&&gd(e.node.children)},cd,dd,yd,ud,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&gd(e.node.children)},function(e){return"StaticLink"===e.type&&gd(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&&gd(e.node.children)},function(e){return"ProgressControl"===e.type&&Ad(e.node.children)},function(e){return"ZStack"===e.type&&gd(e.node.children)},function(e){return"FlowRow"===e.type&&gd(e.node.children)},md,hd]));function gd(e){return vd(e)}const bd=i.pipe(nd,od,ad);function Id(e){const t=e.children.map((e=>Bd(e)));if(gd(t))return Object.assign(Object.assign({},i.omit(["settings"],e)),{children:t,allowBackdropToClose:e.settings.allowBackdropToClose,styles:e.styles?bd(e.styles):void 0});throw Pc("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function Ed(e){const t=e.children.map((e=>Bd(e)));if(Ad(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?id(e.styles):void 0});throw Pc("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function Sd(e){const t=e.children.map((e=>Bd(e)));if(jd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?id(e.styles):void 0});throw Pc("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function xd(e){const t=e.children.map((e=>Bd(e)));if(Ad(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?id(e.styles):void 0});throw Pc("ProgressControl",`Invalid schema: ${JSON.stringify(e)}`)}const Cd=i.pipe(nd,rd,sd,ld,ad);const wd=i.all(i.anyPass([ud,cd,dd,pd,fd,function(e){return"Row"===e.type&&Od(e.node.children)},function(e){return"FlowRow"===e.type&&Od(e.node.children)},function(e){return"Column"===e.type&&Od(e.node.children)},function(e){return"ZStack"===e.type&&Od(e.node.children)},function(e){return"When"===e.type&&Od(e.node.children)}]));function Od(e){return wd(e)}const Td=i.all(i.anyPass([ud,cd,dd,function(e){return"Row"===e.type&&Ad(e.node.children)},function(e){return"FlowRow"===e.type&&Ad(e.node.children)},function(e){return"Column"===e.type&&Ad(e.node.children)},function(e){return"ZStack"===e.type&&Ad(e.node.children)},function(e){return"When"===e.type&&Ad(e.node.children)}]));function Ad(e){return Td(e)}const Rd=i.all(i.anyPass([ud,cd,dd,pd,fd,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 Rd(e)}function Nd(e){const t=e.children.map((e=>Bd(e)));if(Od(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?id(e.styles):void 0});throw Pc("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}function Ld(e){const t=e.children.map((e=>Bd(e)));if(jd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?id(e.styles):void 0});throw Pc("CatalogResponseButton",`Invalid schema: ${JSON.stringify(e)}`)}function _d(e){return"Row"===e.type&&Pd(e.node.children)}function Dd(e){return"Column"===e.type&&Pd(e.node.children)}const kd=i.all(i.anyPass([ud,cd,dd,pd,fd,yd,function(e){return"StaticLink"===e.type},md,hd,function(e){return"CatalogResponseButton"===e.type},_d,function(e){return"FlowRow"===e.type&&Pd(e.node.children)},Dd,function(e){return"ZStack"===e.type&&Pd(e.node.children)},function(e){return"When"===e.type&&Pd(e.node.children)}]));function Pd(e){return kd(e)}const $d=i.anyPass([_d,Dd]);function Gd(e){const t=Bd(e.template);if(function(e){return $d(e)}(t))return Object.assign(Object.assign({},e),{template:t,styles:e.styles?id(e.styles):void 0});throw Pc("CatalogStackedCollection",`Invalid schema: ${JSON.stringify(e)}`)}function Fd(e){const t=e.children.map((e=>Bd(e)));if(Od(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?id(e.styles):void 0});throw Pc("ToggleButtonStateTrigger",`Invalid schema: ${JSON.stringify(e)}`)}function Md(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=>Bd(e))),transition:t})}function Bd(e){switch(e.type){case"Row":return{type:e.type,node:(g=e.node,Object.assign(Object.assign({},g),{children:g.children.map((e=>Bd(e))),styles:g.styles?id(g.styles):void 0}))};case"When":return{type:e.type,node:Md(e.node)};case"FlowRow":return{type:e.type,node:(v=e.node,Object.assign(Object.assign({},v),{styles:v.styles?id(v.styles):void 0,children:v.children.map((e=>Bd(e)))}))};case"Column":return{type:e.type,node:(h=e.node,Object.assign(Object.assign({},h),{children:h.children.map((e=>Bd(e))),styles:h.styles?id(h.styles):void 0}))};case"ZStack":return{type:e.type,node:(m=e.node,Object.assign(Object.assign({},m),{styles:m.styles?id(m.styles):void 0,children:m.children.map((e=>Bd(e)))}))};case"Overlay":return{type:e.type,node:Id(e.node)};case"ProgressControl":return{type:e.type,node:xd(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?id(y.styles):void 0}))};case"CloseButton":return{type:"CloseButton",node:Ed(e.node)};case"CreativeResponse":return{type:"CreativeResponse",node:Sd(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?id(f.styles):void 0}))};case"OneByOneDistribution":return{type:"OneByOneDistribution",node:(p=e.node,Object.assign(Object.assign({},p),{styles:p.styles?id(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?Cd(d.styles):void 0}))};case"SlideStateTrigger":return{type:"SlideStateTrigger",node:(c=e.node,Object.assign(Object.assign({},c),{styles:c.styles?id(c.styles):void 0}))};case"StackedDistribution":return{type:"StackedDistribution",node:(l=e.node,Object.assign(Object.assign({viewableItems:[]},l),{styles:l.styles?id(l.styles):void 0}))};case"StaticLink":return{type:"StaticLink",node:Nd(e.node)};case"ToggleButtonStateTrigger":return{type:"ToggleButtonStateTrigger",node:Fd(e.node)};case"CatalogResponseButton":return{type:"CatalogResponseButton",node:Ld(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?ad(s.styles):void 0}))};case"DataImage":return{type:"DataImage",node:(r=e.node,Object.assign(Object.assign({},r),{styles:r.styles?ad(r.styles):void 0}))};case"StaticImage":return{type:"StaticImage",node:(o=e.node,Object.assign(Object.assign({},o),{styles:o.styles?ad(o.styles):void 0}))};case"DataIcon":return{type:"DataIcon",node:(a=e.node,Object.assign(Object.assign({},a),{styles:a.styles?ad(a.styles):void 0}))};case"StaticIcon":return{type:"StaticIcon",node:(n=e.node,Object.assign(Object.assign({},n),{styles:n.styles?ad(n.styles):void 0}))};case"BasicText":return{type:"BasicText",node:(t=e.node,Object.assign(Object.assign({},t),{styles:t.styles?ad(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 Ud(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 Vd(e,t){return e.major===t.major&&e.minor===t.minor}const zd=(e,t,n)=>i.allPass([i.lte(e),i.gte(t)])(n);function qd(e,t){return Vd(t,{major:0,minor:0})?qd(Yl(e),{major:0,minor:1}):function(e,t){return 0===t.major&&zd(1,23,t.minor)}(0,t)?qd(kc(e),{major:1,minor:0}):e}function Hd(e,t){return Vd(t,{major:0,minor:0})?Hd(function(e){return Object.assign(Object.assign({},e),{layout:Yl(e.layout)})}(e),{major:0,minor:1}):function(e,t){return 0===t.major&&zd(1,23,t.minor)}(0,t)?Hd(function(e){return Object.assign(Object.assign({},e),{layout:kc(e.layout)})}(e),{major:1,minor:0}):e}function Wd(e,t,n,a){const i=Ud(n);if(a){const s=Ud(a);if(r=i,(o=s).major<r.major||o.major===r.major&&o.minor<r.minor||Vd(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,Ud("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:kl(e.offer.creative)}),layoutVariant:Object.assign(Object.assign({},i.clone(e.layoutVariant)),{layoutVariantSchema:"string"==typeof e.layoutVariant.layoutVariantSchema?$l(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:Dl("Slot",e.instanceGuid)}}function Jd(e){return Object.assign(Object.assign({},i.clone(e)),{childLayoutSchema:"string"==typeof e.childLayoutSchema?$l(e.childLayoutSchema,"ChildLayoutRootSchema",e.childLayoutId):e.childLayoutSchema})}function Kd(e){if(e){const t=function(e){try{return Object.assign(Object.assign({},i.clone(e)),{outerLayoutSchema:"string"==typeof e.outerLayoutSchema?$l(e.outerLayoutSchema,"LayoutRootLayoutSchema",e.instanceGuid):e.outerLayoutSchema,slots:i.map(Yd,e.slots)})}catch(t){throw t.message?t:Dl("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=>Wd(e,qd,t,n))))),i.over(a,(e=>Wd(e,Hd,t,n))))(e)}(t,Ao.DCUI_SCHEMA_VERSION)}}const Zd=i.cond([[i.where({signalType:i.equals("SignalSecondaryResponse")}),function*(e,t){return yield r.put({type:no,payload:{level:Oo,code:$o,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(Er,t),i=wr(a)?a.ref:void 0;return yield r.call(e.addAdvertiserWindowRef,i,n),wr(a)||"newTab"!==t.urlBehavior?"SUCCESS":(yield r.put({type:no,payload:{level:Oo,code:Go,message:`Did not receive a window reference opening link ${t.url}`}}),"UNSPECIFIED")}catch(e){return yield r.put({type:no,payload:{level:Oo,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:no,payload:{level:Oo,code:$o,message:"URL response doesn't have a valid url",additionalInformation:{instanceGuid:e.instanceGuid}}}),"ERROR"}],[i.T,function*(){return"EXPLICIT_DISMISSAL"}]]);function*Qd(e){return yield r.put({type:no,payload:{level:Oo,code:$o,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}function*Xd(e,t){let n="IMPLICIT_DISMISSAL";const a=t.payload.offerPositionIndex,i=W(t.payload)||Y(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:ao,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*Qd(i):yield*Zd(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*Qd(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:no,payload:{level:Oo,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:no,payload:{level:Oo,code:"INCORRECTLY_HANDLE_EXTERNAL_ACTION",message:`External action was dispatched as an engagement erroneously. Instance GUID: ${i.instanceGuid}`}}),n="ERROR"}J(t.payload)||(yield r.put(function(e,t){switch(e){case"SUCCESS":return{type:sl,payload:{event:"Completed",completionReason:"Success",offerPositionIndex:t}};case"UNSPECIFIED":return{type:sl,payload:{event:"Completed",completionReason:"Unspecified",offerPositionIndex:t}};case"ERROR":return{type:sl,payload:{event:"Completed",completionReason:"Error",offerPositionIndex:t}};case"EXPLICIT_DISMISSAL":return{type:sl,payload:{event:"Dismissed",dismissalReason:"Explicit",offerPositionIndex:t}};case"IMPLICIT_DISMISSAL":return{type:sl,payload:{event:"Dismissed",dismissalReason:"Implicit",offerPositionIndex:t}};default:return{type:il,payload:{offerProcessStatus:"END"}}}}(n,a)))}function eu(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:no,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:no,payload:{level:R,code:"FAILED_TO_LOAD_MODULE",message:t,additionalInformation:{stack:a,reason:t?void 0:e,moduleName:n}}}),i(l.END)})),()=>{})))}const tu={"standard-marketing":()=>Promise.resolve().then((function(){return cp})),"add-to-cart":()=>Promise.resolve().then((function(){return mf})),"instant-purchase":()=>Promise.resolve().then((function(){return Sy})),"layouts-xp-sandbox":()=>Promise.resolve().then((function(){return em}))};function*nu(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(au,e,t,i))}function*au(e,t,n){if(n in tu){yield r.put({type:Qs,payload:n});const a=yield r.call(eu,e,t,n,tu[n]);yield r.call(ko,a)}else yield r.put({type:no,payload:{level:Co,code:"INVALID_MODULE_NAME",message:`Could not load unknown module ${n}`}})}function*iu(e){const t=yield r.select((e=>zl.getDistributionViewableItems(e.layout?zl.getDistribution(e.layout.layoutSchema):void 0))),n=yield r.select((n=>{var a;const i=nr(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:al,payload:{groupSize:n}};yield r.put(e)}}const ou=i.cond([[(e,t,n,a)=>"END"===e.offerProcessStatus,i.always({type:Wi})],[(e,t,n,a)=>t.isLastOffer&&n,i.always({type:Wi})],[(e,t,n,a)=>1===a&&!t.isLastOffer,i.always({type:tl})],[i.T,i.always(void 0)]]);function*ru(e){const t=yield r.select((e=>({exists:null!==e.progression,isLastOffer:bl(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=ou(e,t,"boolean"==typeof a&&a,n);i&&(i.type===Wi&&(yield r.put({type:ee,payload:{name:"PLACEMENT_COMPLETED"}})),yield r.put(i))}(e.payload,t,n))}function su(e){return e.type===sl&&"Interactive"===e.payload.event}function lu(e){return e.type===sl&&"Interactive"!==e.payload.event}function*cu(e){switch(e.payload.event){case"Dismissed":yield r.put({type:il,payload:{offerProcessStatus:"CONTINUE"}});break;case"Completed":yield r.put({type:ll,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:il,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*du(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:no,payload:{level:j,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*uu(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:ul.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Wi}),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:no,payload:{level:wo,code:Fo,message:"ParentGuid does not exist"}})}function*pu(e,t){yield r.all([r.takeEvery(no,Po.bind(null,e.errorService.raise)),r.takeLatest(Hi,Hl.bind(null,{display:e.displayService,partner:e.partnerInteractionService})),r.takeEvery(Xs,nu.bind(null,t,e.contextService)),r.takeLatest(cl,Xd.bind(null,{partner:e.partnerInteractionService,context:e.contextService})),r.takeEvery(il,ru),r.takeEvery(lu,cu),Do(su,cu),r.takeLatest(Vi,cr.bind(null,e.displayService)),r.takeLatest(Wi,Nr.bind(null,e.contextService)),r.takeLatest(rl,uu),r.takeLatest(to,as),r.takeEvery(Z,Gr),r.takeEvery(ne,Fr),_o(V,ts.bind(null,e.metricsService)),_o(eo,Mr.bind(null,e.rdnService)),r.takeEvery(ao,$r.bind(null,e.errorService.raise)),r.takeLatest(Bi,iu),r.takeEvery(X,es),r.takeEvery(ae,ns.bind(null,{createChildPlugin:e.childPlugin.create,partner:e.partnerInteractionService,context:e.contextService})),r.takeLatest(ie,du.bind(null,{partner:e.partnerInteractionService,context:e.contextService}))])}var fu,yu,mu,hu,vu,gu=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},bu=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 Iu={[se.SET_CUSTOM_STATE]:ul.SET_CUSTOM_STATE,[se.SET_DOMAIN_STATE]:ul.SET_DOMAIN_STATE,[se.SET_GLOBAL_OFFER_DATA_CART]:ul.SET_GLOBAL_OFFER_DATA_CART,[se.OFFER_LIFECYCLE]:pl.OFFER_LIFECYCLE,[se.OFFER_ENGAGEMENT]:pl.OFFER_ENGAGEMENT,[se.SET_PARTNER_VALIDATION_STATUS]:pl.SET_PARTNER_VALIDATION_STATUS};class Eu{constructor(e){fu.add(this),yu.set(this,void 0),gu(this,yu,e,"f")}getState(e){const t=bu(this,yu,"f").getState();return{breakpoint:t.breakpoint,progression:Il(t),customStates:ir(t,e.offerPositionIndex),domainStates:El(t,e.offerPositionIndex)}}dispatch(e,t){bu(this,yu,"f").dispatch(bu(this,fu,"m",vu).call(this,e,t))}subscribe(e,t){return t(this.getState(e)),bu(this,yu,"f").subscribe((()=>{t(this.getState(e))}))}}function Su(e,t){const n=l(),a={},i=s.configureStore({reducer:vl,devTools:{name:"Orchestrator"},preloadedState:Object.assign(Object.assign({},gl()),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 Eu(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(pu,e,o),n.run(kr,e,Kd);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({},vl),u)))),t&&Object.assign(a,t),o&&n.run(o)}})}yu=new WeakMap,fu=new WeakSet,mu=function(e,t,n){return{type:e,payload:Object.assign(Object.assign({},t),{offerPositionIndex:n.offerPositionIndex,creativeInstanceGuid:n.creativeInstanceGuid})}},hu=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},vu=function(e,t){return function(e){return e.type in Iu}(t)?bu(this,fu,"m",mu).call(this,Iu[t.type],t.payload,e):t.type===Z||t.type===ne?bu(this,fu,"m",hu).call(this,e,t):t};var xu=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 Cu={ctx:new Map([[Zs.name,Zs],[Hs.name,Hs],[As.name,As],[$s.name,$s],[Ys.name,Ys]]),cache:[]};class wu{constructor(){this._subscribers=[]}add(e){this._subscribers.push(e)}unsubscribe(){this._subscribers.forEach((e=>e.unsubscribe()))}}const Ou=()=>{},Tu=(e=Ou,t=Ou,n=Ou)=>"function"!=typeof e?e:{next:e,error:t,complete:n};class Au{constructor(e){this._setupFn=e}subscribe(e,t,n){const a=Tu(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 wu;return s.add({unsubscribe:()=>{i&&i(),o=!1}}),s}}class Ru extends Au{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 Au((e=>{const t=this.subscribe(e);return()=>t.unsubscribe()}))}}const ju={CompletedBeforeEmit:"CompletedBeforeEmit"};var Nu=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 Lu{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)=>Nu(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 Du=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 ku={getBreakpointCSSClass:B},Pu="CHILD_LAYOUTS/ADD_LAUNCHED",$u="DYNAMIC_DATA/ADD";function Gu(e={launched:{}},t){if(t.type===Pu){const n=t.payload;return n.childLayoutId?i.assocPath(["launched",n.childLayoutId],n.shouldRelaunch,e):e}return e}function Fu(e=null,t){return e}function Mu(e=null,t){if(t.type===$u){const n=t.payload;return e?n?i.mergeDeepRight(e,n):e:n}return e}function Bu(e,t){var n;return null===(n=e.childLayouts.launched[t])||void 0===n||n}function Uu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer}function Vu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.schemaVersion}const zu=Object.freeze({});function qu(e){var t;return(null===(t=e.dynamicData)||void 0===t?void 0:t.text)?e.dynamicData.text:zu}const Hu="FAILED_TO_LAUNCH_CHILD_LAYOUT";function*Wu(e,t,n){var a;if(yield null===(a=r.select(Bu,n.payload.childLayoutId))||void 0===a||a){const a=yield r.select(Vu),o=yield r.select(Uu),s=yield r.select(qu);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:j,code:Hu,message:"Could not launch child layout, failed creating plugin."})}}catch(e){yield r.call(t,{level:j,code:Hu,message:"Could not launch child layout, failed to make the child layout config serializable."})}yield r.put({type:Pu,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 Ku(t){var n;const a=bt(),i=Ct(),o=t.schema.response_key||"positive",r=Un(),s=jt(),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(ja,{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 Zu={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(Ku,{schema:t.node,testId:n})}};function Qu(){const t=Rn(),n=a.useSelector(qu),i=Zt(),o=Ct(),r=i({state:n},"textContent");return e.jsx(Kt,{value:r,children:e.jsx(wt,{value:o,overrides:Zu,children:e.jsx(xt,{children:e=>e(t)})})})}const Xu={staticData:Fu,dynamicData:Mu,childLayouts:Gu};function ep(e={}){return Object.assign({staticData:null,dynamicData:null,childLayouts:{launched:{}}},e)}function tp(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 np(e){return"object"==typeof e&&null!==e&&Object.entries(e).every((([e,t])=>"string"==typeof e&&"string"==typeof t))}function*ap(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*ip(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n,o=J(n),s=K(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(tp,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(op,e,t,a)}}(e,t,n,l);return void(yield r.call(ap,a,e.globalDispatch.bind(e),o,s,i))}}yield r.call(t,{level:R,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:R,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}function*op(e,t,n){const a=function(e){return l.eventChannel((t=>{const n=e.onEvent({name:vr,source:"partner",callback:e=>{np(e)&&t({eventName:vr,data:e})}},{name:gr,source:"partner",callback:e=>{np(e)&&t({eventName:gr,data:e})}});return()=>{n()}}))}(e);try{for(;;){const i=yield r.take(a);switch(i.eventName){case vr:yield r.put({type:ee,payload:{name:vr,body:i.data}}),yield r.put({type:$u,payload:{text:i.data}}),e.globalDispatch({type:Q,payload:{event:"Completed",completionReason:"Success"}}),n&&(yield r.call(n.close.bind(n)));break;case gr:e.globalDispatch({type:Q,payload:{event:"Completed",completionReason:"Error"}}),n&&(yield r.call(n.close.bind(n)));break;default:t({level:R,code:"UNKNOWN_REALTIME_OFFER_FULFILLMENT_EVENT",message:`Unknown event: ${i.eventName}`})}}}catch(e){const n=e;t({level:j,code:"FAILED_TO_PROCESS_REALTIME_OFFER_FULFILLMENT_EVENT",message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&a.close()}}function*rp(e,t,n){const a=W(n.payload)||Y(n.payload)||H(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":yield r.call(e.globalDispatch.bind(e),n),(J(n.payload)||K(n.payload))&&(yield r.put({type:ee,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:a.accountID,referralCreativeID:a.referralCreativeID,referralOnly:K(n.payload)}}}),J(n.payload)&&(yield r.call(op,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"}})),K(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*ip(e,t,n.payload)}}function*sp(e,t){yield r.all([r.takeLatest(z,rp.bind(null,e,t)),r.takeEvery(re,Wu.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}Object.assign({},se);const lp=(new Cn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=ep({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=ep()){const a=l(),i=s.configureStore({reducer:Xu,devTools:{name:"Standard Marketing"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(sp,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Fn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Di,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Li,{settings:i,dispatch:d.dispatch,children:e.jsx(Qu,{})})})]})}))}}));var cp=Object.freeze({__proto__:null,moduleConnectorBuilder:lp});const dp="CART/UPDATE",up="CATALOG_ITEM/RESPONSE",pp="USER_CREATIVE_RESPONSE_HISTORY/ADD",fp=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 yp({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",hp=["Enter","Space"],vp={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 gp(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 bp({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((()=>gp(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(Ip(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:up,payload:{catalogItem:s,quantity:e}});const t=gp(n.validations,n.options.length,e);r(Ip(t))}return y.length>0?e.jsx(ja,{styles:n.styles?M(vp,n.styles):vp,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=fp(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||!hp.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(yp,{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 Ip(e){return{type:ie,payload:{errors:e}}}function Ep(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Sp(t){const n=a.useDispatch(),i=Ct(),o=Un(),r=Nn(),{tabIndex:s,styles:l,isDisabled:c}=h(r);return e.jsx(ja,{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:up,payload:{catalogItem:o,quantity:1}})},className:null==a?void 0:a.own,children:Ep(t.schema.children,i,t.testId)})})}const xp={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"]},Cp=new Map([["&","_;^;_"]]),wp=new RegExp(`<a *(?=${xp.allowedAttributes.a.join("|")}|>)`,"g"),Op=new RegExp(`<a *(?:(?:${xp.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),Tp=new RegExp("(<br *?>)|(<br *?/>)","g"),Ap=new RegExp(`<ul *(?=${xp.allowedAttributes.ul.join("|")}|>)`,"g"),Rp=new RegExp(`<ol *(?=${xp.allowedAttributes.ol.join("|")}|>)`,"g"),jp=new RegExp("<li *(?=>|\\s[^>]*>)","g"),Np="<br/>";function Lp(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(Op,((e,t)=>{const n=t.replaceAll("&",Cp.get("&"));return e.replace(t,n)})).replaceAll(Tp,Np)}(e);return t===u(t,xp)}(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(ja,{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(wp,`<a ${a.join(" ")}`).replace(Ap,`<ul ${i}`).replace(Rp,`<ol ${i}`).replace(jp,`<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 Dp(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:kp(t,i,o)})}function kp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Pp(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}=h(l);return Boolean(d)&&(null===(i=t.schema.children)||void 0===i?void 0:i.length)>0?e.jsx(ja,{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)?Dp(t.schema.children,null==n?void 0:n.own,a,r,t.testId):kp(t.schema.children,r,t.testId)})}}):null}function $p(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}=h(i),l=jo(a,1),c=bt();return e.jsx(ja,{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:$p(t.schema.children,n,t.testId)})})}function Fp(e,t){const n=e.cart[t];return n||null}function Mp(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 Bp(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 Mp(e).reduce(((e,t)=>e+t.quantity),0)}(e),s=Fp(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}function Up(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 Vp(e,t){var n,a;return null!==(a=null===(n=Up(e))||void 0===n?void 0:n.find((e=>e.catalogItemId===t)))&&void 0!==a?a:null}function zp(e){var t;const n=null===(t=Up(e))||void 0===t?void 0:t.filter((e=>e.preSelectedQuantity&&e.preSelectedQuantity>0));return n&&n.length>0?n:null}function qp(e){var t,n;return null!==(n=null===(t=zp(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 Hp=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 Wp(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:i(t,void 0,o)})}function Yp(e,t,n){return t(e,void 0,n)}function Jp(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:S,isDisabled:x}=h(I),C=a.useSelector((e=>function(e,t){var n,a,i;const o=Vp(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=>Fp(e,v.cartItemId))),O=a.useSelector((e=>Bp(e,v))),T=(null==w?void 0:w.quantity)||0,A=h(x||T<=(null!==(n=v.minItemCount)&&void 0!==n?n:0)?"DISABLED":I),R=h(x||O<=0?"DISABLED":I),j=h(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||m({type:up,payload:{catalogItem:v,quantity:e}})};return e.jsx(ja,{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(Ma,{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(Kt,{value:b,children:(null==t?void 0:t.decrementButton)?Wp(p,t.decrementButton,n,g,o):Yp(p,g,o)})}):null,l?e.jsx("input",{type:"text",className:null==t?void 0:t.input,style:Object.assign(Object.assign({},j),{cursor:j.isDisabled?"not-allowed":"auto",caretColor:j.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({},R.styles),{cursor:R.isDisabled?"not-allowed":"pointer",pointerEvents:"auto"}),onClick:e=>{e.preventDefault(),L(T+1)},tabIndex:R.tabIndex,"aria-label":f||void 0,disabled:R.isDisabled,"data-testid":o?`${o}-increment-button`:void 0,children:e.jsx(Kt,{value:b,children:(null==t?void 0:t.incrementButton)?Wp(u,t.incrementButton,n,g,o):Yp(u,g,o)})}):null]})})})}const Kp={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(Sp,{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(Lp,{schema:n.node});case"CatalogUrlLink":return e.jsx(Pp,{schema:n.node});case"CatalogPartnerEventButton":return e.jsx(Gp,{schema:n.node});default:return}}},CatalogRadioGroup:function(t){if("CatalogRadioGroup"===t.type)return e.jsx(bp,{schema:t.node})},CatalogQuantityCounter:function(t){if("CatalogQuantityCounter"===t.type)return e.jsx(Jp,{schema:t.node})}};function Zp(){const t=Rn(),n=Ct();return e.jsx(wt,{value:n,overrides:Kp,children:e.jsx(xt,{children:e=>e(t)})})}function Qp(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 Xp={cart:function(e=Qp([]),t){if(t.type===dp){const{catalogItem:n,quantity:a}=t.payload,i=n.cartItemId,o=jo(n,a);return Object.assign(Object.assign({},e),{[i]:o})}return e},userCreativeResponseHistory:function(e=[],t){return t.type===pp?e.concat(t.payload.responseId):e},staticData:Fu,childLayouts:Gu};const ef="INVALID_PARTNER_MESSAGE",tf="MISCONFIGURED_CATALOG_ITEM",nf="FAILED_TO_PROCESS_PARTNER_UPDATE_CART_ITEM";function*af(e){var t,n;const a=yield r.select(zp),i=yield r.select(qp),o=yield r.select((e=>{var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer.maxTotalItemsQtyInOffer}));if(cf(i)&&cf(o)&&i>o)yield r.call(e,{level:j,code:tf,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:j,code:tf,message:`Preselected quantity (${a}) is greater than maxItemCount (${o}) for catalog item (${i.instanceGuid})`}):yield*lf(i,a,!0)}}function*of(e,t,n){const{catalogItem:a,quantity:i}=n.payload;if(yield*lf(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:j,code:"INVALID_RESPONSE_OBJECT",message:n}))}var o}function*rf(e,t){const n=function(e,t){return l.eventChannel((n=>{const a=e.onEvent({name:fr.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:j,code:ef,message:`Invalid UpdateCartItemPartnerMessageBody: ${JSON.stringify(e)}`}):n(e)}});return()=>{a()}}))}(e,t);try{for(;;){const e=yield r.take(n);yield r.call(sf,e,t)}}catch(e){const n=e;t({level:j,code:nf,message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&n.close()}}function*sf(e,t){const{cartItemId:n,quantity:a}=e,i=yield r.select(Fp,n);if(df(i)){const e=yield r.select(Vp,i.catalogItemId);null!==(o=e)&&"object"==typeof o&&"catalogItemId"in o&&"price"in o?yield*lf(e,a,!1):yield r.call(t,{level:j,code:nf,message:`Catalog item not found for cart item id (${n})`})}else yield r.call(t,{level:j,code:nf,message:`Cart item not found for cart item id (${n})`});var o}function*lf(e,t,n){var a;const i=yield r.select(Fp,e.cartItemId),o=yield r.select(Bp,e),s=cf(o)?o:0,l=df(i)?i.quantity:0;if(t!==l&&t>=(null!==(a=e.minItemCount)&&void 0!==a?a:0)&&t-l<=s){yield r.put({type:dp,payload:{catalogItem:e,quantity:t}});const a=yield r.select(Fp,e.cartItemId),o=yield r.select(Hp);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 cf(e){return"number"==typeof e}function df(e){return null!=e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&"unitPrice"in e}function*uf(e,t){var n;yield r.put({type:pp,payload:{responseId:(n=t.payload,q(n)?n.responseOption.id:n.id)}}),yield r.call(e.globalDispatch.bind(e),t)}function*pf(e,t){yield r.all([r.spawn(af.bind(null,t)),r.spawn(rf.bind(null,e,t)),r.takeLatest(up,of.bind(null,e,t)),r.takeLatest(z,uf.bind(null,e)),r.takeEvery(re,Wu.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}function ff(e){return"object"==typeof e&&null!==e&&"cartItemId"in e&&"quantity"in e}Object.assign(Object.assign({},se),{CATALOG_ITEM_RESPONSE:up});const yf=(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(ff)}(i.offerState)?i.offerState:{cart:[]},d=function(e={}){return Object.assign({cart:Qp([]),userCreativeResponseHistory:[],staticData:null,childLayouts:{launched:{}}},e)}({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion},cart:Qp(c.cart)}),u=function(e,t,n){const a=l(),i=s.configureStore({reducer:Xp,devTools:{name:"Add To Cart"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(pf,e,t),i}(i.gateway,i.logger,d);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Fn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Di,{}),e.jsx(a.Provider,{store:u,children:e.jsx(Li,{settings:i,dispatch:u.dispatch,children:e.jsx(Zp,{})})})]})}))}}));var mf=Object.freeze({__proto__:null,moduleConnectorBuilder:yf});const hf="CATALOG/TRIGGER_SELECT_ITEM",vf="CATALOG/SET_SELECTED_ITEM",gf="CHECKOUT_LIFECYCLE",bf="INSTANT_PURCHASE/INITIATE",If="INSTANT_PURCHASE/PARTNER_RESPONSE",Ef="INSTANT_PURCHASE/WSDK_RESPONSE",Sf="INSTANT_PURCHASE/SET_VARIATION_SELECTION_REQUIRED";function xf(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:Cf(t,i,o)})}function Cf(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function wf(t){const n=a.useDispatch(),i=Ct(),o=Nn(),{tabIndex:r,styles:s,isDisabled:l}=h(o),c=Un(),d=Ht(c,"catalogItem");return e.jsx(ja,{styles:t.schema.styles,children:({classnames:a,mapperRef:o})=>e.jsx("button",{type:"button",tabIndex:r,"aria-disabled":l,disabled:l,style:Object.assign({cursor:"pointer"},s),"data-testid":t.testId,"data-e2e":"CatalogItemResponse",onClick:e=>{e.preventDefault();n({type:bf,payload:{catalogItem:c,quantity:1,useInstantPurchaseExtension:!0}})},className:null==a?void 0:a.own,children:e.jsx(Kt,{value:d,children:(null==a?void 0:a.own)?xf(t.schema.children,a.own,o,i,t.testId):Cf(t.schema.children,i,t.testId)})})})}const Of=["ArrowDown","ArrowUp","Enter","Escape","Tab"];function Tf(n){const i=jt(),o=Ct(),r=Zt(),s=e=>r({data:e},"catalogItem"),l=t.useMemo((()=>i.catalogItems||[]),[i]),c=Nn(),{styles:d,isDisabled:u}=h(c),p=t.useRef(null),f=t.useRef([]),[y,m]=t.useState(!1),[v,g]=t.useState(-1),b=a.useDispatch(),I=a.useSelector((e=>e.variationSelectionRequired)),E=a.useSelector((e=>e.selectedItem));function S(t,a,i,r){return t?function(t,n,a,i,o){return e.jsx(Xt,{value:a(n),children:i(t,void 0,o)})}(a,t,i,o,r||n.testId):function(e,t,n){return t(e,void 0,n)}(a,o,r||n.testId)}function x(){u||(y?w():C())}function C(){u||m(!0)}function w(){u||m(!1)}function O(e){var t;g(l.indexOf(e)),w(),b({type:hf,payload:{catalogItem:e}}),I&&b({type:Sf,payload:null}),null===(t=p.current)||void 0===t||t.focus()}function T(e){const t=[null==e?void 0:e.dropDownSelectedElement];return I&&t.push((null==e?void 0:e.dropDownContainerErrorStyles)||""),t.join(" ")}t.useEffect((()=>{var e;if(y)if(-1===v)null===(e=p.current)||void 0===e||e.focus();else{const e=f.current[v];e&&e.focus()}else E||g(-1)}),[y,v,E]);const A={elements:{own:[{default:{background:{backgroundColor:{light:"#ffffff"}},dimension:{width:{type:"percentage",value:100}}}}]}};function R(e){var t;if(!u&&Of.includes(e.key))switch(e.key){case"ArrowDown":{e.preventDefault();const t=v+1;t<l.length&&g(t);break}case"ArrowUp":{e.preventDefault();const t=v-1;t>=0&&g(t);break}case"Enter":if(e.preventDefault(),y){const e=l[v];e&&O(e)}else C();break;case"Tab":if(y&&E){w();const e=l.indexOf(E);-1!==e&&g(e)}break;case"Escape":e.preventDefault(),y&&(w(),null===(t=p.current)||void 0===t||t.focus())}}return l.length>1?e.jsx(ja,{styles:n.schema.styles?M(A,n.schema.styles):A,children:({classnames:t,mapperRef:a})=>e.jsxs("div",{className:null==t?void 0:t.dropDownContainer,children:[e.jsxs("div",{ref:p,className:null==t?void 0:t.own,onKeyDown:R,onClick:x,onBlur:e=>{var t;(null===(t=p.current)||void 0===t?void 0:t.contains(e.relatedTarget))||y&&w()},"data-e2e":"DropDown","data-testid":n.testId?`${n.testId}-drop-down-container`:void 0,"aria-disabled":u,style:Object.assign({position:"relative"},d),tabIndex:0,children:[e.jsx("div",{className:T(t),"aria-disabled":u,"data-testid":n.testId?`${n.testId}-drop-down-selected-element`:void 0,style:Object.assign({cursor:"pointer"},d),children:E?e.jsx(Kt,{value:s(E),children:S(null==t?void 0:t.dropDownSelectedElement,n.schema.closedTemplate,a)}):S(null==t?void 0:t.dropDownSelectedElement,n.schema.closedDefaultTemplate,a)}),y&&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"},d),children:l.map(((i,o)=>e.jsx("li",{ref:e=>function(e,t){f.current[t]=e}(e,o),className:null==t?void 0:t.dropDownListElement,onClick:e=>{e.stopPropagation(),u||O(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"},d),children:e.jsx(Kt,{value:s(i),children:S(null==t?void 0:t.dropDownSelectedElement,n.schema.openTemplate,a)})},i.catalogItemId)))})]}),I&&n.schema.requiredSelectionErrorTemplate?S(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 Af(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:gf,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(ja,{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 Rf=/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/;function jf(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)&&Rf.test(d)?e.jsx(ja,{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 Nf(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 Lf=Nf("ChevronLeft"),_f=Nf("ChevronRight");function Df(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,S]=t.useState(!1),x=Nn(),{styles:C,isDisabled:w,tabIndex:O}=h(x),T=t.useRef(null),A=t.useRef(null),R=t.useRef([]),j=t.useRef([]),N=t.useRef(null);function L(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=A.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),N.current&&N.current()):e.current=requestAnimationFrame(i)};return i(),()=>{null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)}}),[N.current])}(),t.useEffect((()=>{var e,t;f(l),m(0),null===(e=j.current[0])||void 0===e||e.scrollIntoView({behavior:"instant"}),null===(t=R.current[l])||void 0===t||t.scrollIntoView({behavior:"instant"})}),[r.catalogItemId,l]),t.useEffect((()=>{const e=T.current;if(!e)return;function t(e){const t=T.current;t&&0!==e.deltaY&&(e.preventDefault(),t.scrollLeft+=e.deltaY)}const n=new ResizeObserver((()=>{var t,n;g(e.scrollWidth>e.clientWidth),L(e),e.clientWidth!==b&&(null===(t=R.current[p])||void 0===t||t.scrollIntoView({behavior:"instant"}),null===(n=j.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 _={display:"flex",position:"absolute",top:"50%",transform:"translateY(-50%)",backgroundColor:"transparent",cursor:w?"not-allowed":"pointer"};function D(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=R.current[a])||void 0===t||t.scrollIntoView({}),null===(n=j.current[o])||void 0===n||n.scrollIntoView({}),m(o),f(i),N.current=a===i?()=>{S(!1)}:()=>{var e;null===(e=R.current[i])||void 0===e||e.scrollIntoView({behavior:"instant"}),S(!1)}}return s.length>0?e.jsx(ja,{styles:a.styles,children:({classnames:n})=>e.jsxs("div",{className:null==n?void 0:n.own,children:[e.jsxs("div",{style:{position:"relative"},children:[1===l&&e.jsxs(e.Fragment,{children:[e.jsx("button",{style:Object.assign(Object.assign({},_),{left:"5%"}),className:null==n?void 0:n.scrollIconButton,onClick:()=>D(-1),"data-testid":"main-image-scroll-left-button",children:e.jsx(Wa,{schema:a.leftScrollIconTemplate||Lf})}),e.jsx("button",{style:Object.assign(Object.assign({},_),{right:"5%"}),className:null==n?void 0:n.scrollIconButton,onClick:()=>D(1),"data-testid":"main-image-scroll-right-button",children:e.jsx(Wa,{schema:a.rightScrollIconTemplate||_f})})]}),e.jsx("div",{ref:A,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){R.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({},C),{height:"100%"}),"data-testid":`${i}-main-image-${a}`,"data-e2e":"CatalogImageGallery-mainImage"})},`${t.light}-${a}`))))})]}),e.jsx("div",{ref:T,onScroll:e=>L(e.currentTarget),className:null==n?void 0:n.thumbnailList,style:Object.assign(Object.assign({},C),{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){j.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({},C),{cursor:w?"not-allowed":"pointer",pointerEvents:"auto",aspectRatio:"1 / 1"}),"data-testid":`${i}-thumbnail-${a}`,"data-e2e":"CatalogImageGallery-thumbnail",tabIndex:O,onClick:()=>function(e){var t,n;if(E)return;S(!0);const a=l?e+1:e;f(a),m(e),null===(t=R.current[a])||void 0===t||t.scrollIntoView({}),null===(n=j.current[e])||void 0===n||n.scrollIntoView({}),N.current=()=>{S(!1)}}(a)})}))))})]})}):null}const kf={size:80,radius:30,stroke:7,duration:2,primaryColor:"#222",secondaryColor:"#d6d6d6",primaryRotation:-50,secondaryRotation:45,arcFraction:1/3.5},Pf={elements:{own:[{default:{container:{justifyContent:"center",alignItems:"center"},dimension:{width:{type:"percentage",value:100}}}}],spinner:[{default:{container:{justifyContent:"center",alignItems:"center"}}}]}};function $f(t){var n;const{config:a}=t.schema,i=Object.assign(Object.assign({},kf),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(ja,{styles:t.schema.styles?M(Pf,t.schema.styles):Pf,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 Gf(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(ja,{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 Ff(n){const i=a.useDispatch(),o=a.useSelector((e=>e.selectedItem)),r=n.schema,s=n.schema.styles,l=Nn(),{styles:c,isDisabled:d}=h(l);function u(){i(o?{type:X,payload:{key:r.customStateKey,value:r.customStateValue}}:{type:Sf,payload:"default"})}return e.jsx(ja,{styles:s,children:({classnames:a})=>{var i;return e.jsx("button",{className:null==a?void 0:a.own,onClick:u,"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 Mf(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),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(ja,{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(Fa,{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 Bf(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(ja,{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 Uf(n){const i=Ct(),o=$n(),r=Zt(),s=bt(),l=jt().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(ja,{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(Bn,{context:c,children:e.jsx(Pn,{value:o(c),children:e.jsx(Kt,{value:(s=c,r({data:s},"catalogItem")),children:i(n.schema.template,void 0,n.testId?`${n.testId}-child`:"")})})}))});var s}}):null}const Vf={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(wf,{schema:t.node,testId:n})},CatalogCombinedCollection:function(t,n){if("CatalogCombinedCollection"===t.type)return e.jsx(Uf,{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(Tf,{schema:n.node});case"CatalogVariationSelectionButton":return e.jsx(Ff,{schema:n.node});case"CheckoutStateButtonTrigger":return e.jsx(Af,{schema:n.node});case"ColorSwatch":return e.jsx(jf,{schema:n.node});case"CatalogImageGallery":return e.jsx(Df,{schema:n.node});case"DismissInstantPurchaseButton":return e.jsx(Bf,{schema:n.node});case"LoadingSpinner":return e.jsx($f,{schema:n.node});case"OfferLifecycleTimer":return e.jsx(Gf,{schema:n.node});case"ReadMoreTextContainer":return e.jsx(Mf,{schema:n.node});default:return}}}};function zf(){const t=Rn(),n=Ct(),i=a.useSelector(qu),o=Zt()({state:i},"textContent");return e.jsx(wt,{value:n,overrides:Vf,children:e.jsx(Kt,{value:o,children:e.jsx(xt,{children:e=>e(t)})})})}function qf(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 Hf={staticData:Fu,selectedItem:(e=null,t)=>t.type===vf?t.payload:e,dynamicData:Mu,childLayouts:Gu,fulfillmentDetails:(e=null,t)=>"INSTANT_PURCHASE/SET_FULFILLMENT_DETAILS"===t.type?t.payload:e,variationSelectionRequired:(e=null,t)=>t.type===Sf?t.payload:e};function Wf(e={}){return Object.assign({staticData:null,selectedItem:null,dynamicData:null,childLayouts:{launched:{}},fulfillmentDetails:null,variationSelectionRequired:null},e)}const Yf="INVALID_RESPONSE_OBJECT",Jf="MISSING_APP_STATE_IN_INSTANT_PURCHASE_MODULE",Kf="MISSING_PAYMENT_REF_IN_INSTANT_PURCHASE_MODULE",Zf="MISSING_STATIC_DATA_IN_INSTANT_PURCHASE_MODULE";function Qf(e,t){return l.eventChannel((n=>e.onEvent({name:yr.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:j,code:"MALFORMED_INSTANT_PURCHASE_PARTNER_DATA",message:`Malformed data received from partner\n ${e}`})}})))}function*Xf(e,t){var n;try{for(;;){const t=yield r.take(e);t&&(yield r.put({type:If,payload:t}))}}catch(e){yield r.call(t,{level:j,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*ey(e,t){var n;try{for(;;){const t=yield r.take(e);if(t){yield r.put({type:Ef,payload:t});break}}}catch(e){yield r.call(t,{level:j,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 ty="Unknown failure reason",ny=6e4;function*ay(){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*dy(a[0]))}function*iy(e){const{catalogItem:t}=e.payload;yield*dy(t)}function*oy(e,t,n){const{catalogItem:a,quantity:i}=n.payload,o=jo(a,i);o?(yield r.put({type:Z,payload:{name:"SignalCartItemInstantPurchaseInitiated",parentGuid:a.instanceGuid,objectData:{catalogItemId:a.catalogItemId,quantity:i}}}),yield*yy("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:j,code:Jf,message:"App state is not set within Redux store."}),void(yield*my("offerComplete",2));if(!a.staticData)return yield r.call(n,{level:j,code:Zf,message:"App state is not configured with static data."}),void(yield*my("offerComplete",2));const i=a.staticData.offer.creative.copy["ppu.partnerPaymentReference"];if(!i)return yield r.call(n,{level:j,code:Kf,message:"Partner payment reference is not set within creative copy."}),void(yield*my("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(cy,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(ly,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:j,code:Yf,message:`Unable to translate catalog item with ID ${a.catalogItemId} to cart item for instant purchase transaction.`}),yield*my("offerComplete",2))}function*ry(e,t){const n=yield r.select((e=>e.staticData));if(!n)return yield r.call(e,{level:j,code:Zf,message:"App state is not configured with static data."}),void(yield*fy("Error"));if(!n.offer.catalogItems)return yield r.call(e,{level:j,code:"MISSING_CATALOG_ITEMS",message:"No catalog items found within offer data."}),void(yield*fy("Error"));const a={accountId:n.offer.accountId,catalogItems:n.offer.catalogItems};let i,o;t.payload.success?(i=uy,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||ty,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=py(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:j,code:Yf,message:`Unable to map cart items to catalog items in the instant purchase partner response: ${n}.`})}(i,a))}(t.payload,a,i,e),yield*fy(o)}function*sy(e){e.payload.response&&e.payload.response.success?yield*my("offerComplete",1):yield*my("offerComplete",2)}function*ly(e,t){const n=Qf(e,t),{timeout:a}=yield r.race({channel:r.call(Xf,n,t),timeout:r.delay(ny)});a&&(yield r.call(t,{level:j,code:"INSTANT_PURCHASE_PARTNER_RESPONSE_TIMEOUT",message:"Instant-purchase partner response timed out after 60000ms"}),n.close(),yield*function*(e){yield*yy("ProcessingState",0),yield r.put({type:Q,payload:{event:"Dismissed",dismissalReason:e}})}("Implicit"))}function*cy(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:j,code:"MALFORMED_INSTANT_PURCHASE_WSDK_DATA",message:`Malformed data received from wsdk\n ${e}`})}}))))))}(e,t),{timeout:a}=yield r.race({channel:r.call(ey,n,t),timeout:r.delay(ny)});a&&(yield r.call(t,{level:j,code:"INSTANT_PURCHASE_WSDK_RESPONSE_TIMEOUT",message:"Instant-purchase wsdk response timed out after 60000ms"}),n.close(),yield*my("offerComplete",2))}function*dy(e){var t,n,a;yield r.put({type:vf,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:$u,payload:{text:i}})}function uy(e,t){return{name:"SignalCartItemInstantPurchase",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,initiatedBy:T.DCUI}}}function py(e,t){return t.find((t=>t.catalogItemId===e.catalogItemId))}function*fy(e){yield*yy("ProcessingState",0),yield r.put({type:Q,payload:{event:"Completed",completionReason:e}})}function*yy(e,t){yield r.put({type:X,payload:{key:e,value:t}})}function*my(e,t){yield*yy("ProcessingState",0),yield r.put({type:te,payload:{key:e,value:t}})}const hy=["Success","Unspecified","Error"],vy=["Implicit","Explicit"];function*gy(e,t){if("Checkout"!==t.payload.event)return;yield r.put({type:te,payload:{key:"checkout",value:by(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?hy.includes(n.reason):vy.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:j,code:"CHECKOUT_BUTTON_INVALID_OFFERLIFECYCLE",message:`Misconfigured offer lifecycle payload in handleCheckoutLifecycle: ${n}.`})}else yield r.call(e,{level:j,code:"CHECKOUT_BUTTON_UNKNOWN_EVENT",message:`Unknown event type in checkout lifecycle: ${JSON.stringify(n)}`})}}function by(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*Iy(e,t){yield r.all([r.spawn(ay),r.takeEvery(gf,gy.bind(null,t)),r.takeEvery(hf,iy),r.takeLatest(bf,oy.bind(null,e,t)),r.takeLatest(If,ry.bind(null,t)),r.takeLatest(Ef,sy.bind(null)),r.takeEvery(re,Wu.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}Object.assign(Object.assign({},se),{INITIATE_INSTANT_PURCHASE:bf,INSTANT_PURCHASE_PARTNER_RESPONSE:If,INSTANT_PURCHASE_WSDK_RESPONSE:Ef});const Ey=(new Cn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=Wf({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion},fulfillmentDetails:qf(i.offerData.creative)}),d=function(e,t,n=Wf()){const a=l(),i=s.configureStore({reducer:Hf,devTools:{name:"Instant Purchase"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Iy,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Fn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Di,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Li,{settings:i,dispatch:d.dispatch,children:e.jsx(zf,{})})})]})}))}}));var Sy=Object.freeze({__proto__:null,moduleConnectorBuilder:Ey});const xy=t.createContext(null),Cy=({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(xy.Provider,{value:{images:i,activeIndex:r,duration:l,setImages:o,setActiveIndex:s,setDuration:c},children:e.jsx(Kt,{value:d({data:{"image.title":null===(a=i[r])||void 0===a?void 0:a.title}},"creativeCopy"),children:n})})};function wy({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 Oy(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 Ty({schema:n,testId:a}){const i=JSON.parse(n.data),{styles:o,duration:r,imageKeys:s}=i,l=t.useContext(xy),c=Oy(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(wy,{duration:r,active:n===(null==l?void 0:l.activeIndex),containerStyles:o.elements.indicatorContainer,indicatorStyles:o.elements.indicator}))))})]})}const Ay={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"]},Ry=new Map([["&","_;^;_"]]),jy=new RegExp(`<a *(?=${Ay.allowedAttributes.a.join("|")}|>)`,"g"),Ny=new RegExp("<span*>","g"),Ly=new RegExp(`<a *(?:(?:${Ay.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),_y=new RegExp("(<br *?>)|(<br *?/>)","g"),Dy="<br/>";function ky(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(Ly,((e,t)=>{const n=t.replaceAll("&",Ry.get("&"));return e.replace(t,n)})).replaceAll(_y,Dy)}(e);return t===u(t,Ay)}(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(ja,{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(jy,`<a ${a.join(" ")}`).replace(Ny,`<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(jy,`<a ${a.join(" ")}`).replace(Ny,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}});var i}}):null}function Py({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 ky=(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 Py({disabled:t,onClick:n}){const a=ft(zn(),an());return e.jsx("button",{onClick:n,disabled:t,className:a`
176
- ${ky(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 $y({disabled:t,onClick:n}){const a=ft(zn(),an());return e.jsx("button",{onClick:n,disabled:t,className:a`
178
- ${ky(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 Gy(e){const n=t.useContext(kn);return e.map((e=>({src:n(`${e}.link.src`,"copy"),open:n(`${e}.link.open`,"copy")})))}function Fy(e){return{type:"StaticImage",node:{url:e,styles:{elements:{own:[{default:{border:{borderRadius:5,borderWidth:"0"},dimension:{width:{type:"percentage",value:100}}}}]}}}}}function My(e,t){return{type:"CreativeResponse",node:{responseKey:"positive",styles:{elements:{own:[{default:{spacing:{padding:"0"},background:{backgroundColor:{light:"#F9FAFB"}},border:{borderWidth:"0"}}}]}},children:t?[Fy(t)]:[]}}}function By({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]=[Cy((null===(a=null==s?void 0:s.body)||void 0===a?void 0:a.imageKeys)||[]),Gy((null===(i=null==s?void 0:s.body)||void 0===i?void 0:i.imageKeys)||[])],u=jt(),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 $y=(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 Gy({disabled:t,onClick:n}){const a=ft(zn(),an());return e.jsx("button",{onClick:n,disabled:t,className:a`
176
+ ${$y(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 Fy({disabled:t,onClick:n}){const a=ft(zn(),an());return e.jsx("button",{onClick:n,disabled:t,className:a`
178
+ ${$y(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 My(e){const n=t.useContext(kn);return e.map((e=>({src:n(`${e}.link.src`,"copy"),open:n(`${e}.link.open`,"copy")})))}function By(e){return{type:"StaticImage",node:{url:e,styles:{elements:{own:[{default:{border:{borderRadius:5,borderWidth:"0"},dimension:{width:{type:"percentage",value:100}}}}]}}}}}function Uy(e,t){return{type:"CreativeResponse",node:{responseKey:"positive",styles:{elements:{own:[{default:{spacing:{padding:"0"},background:{backgroundColor:{light:"#F9FAFB"}},border:{borderWidth:"0"}}}]}},children:t?[By(t)]:[]}}}function Vy({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]=[Oy((null===(a=null==s?void 0:s.body)||void 0===a?void 0:a.imageKeys)||[]),My((null===(i=null==s?void 0:s.body)||void 0===i?void 0:i.imageKeys)||[])],u=jt(),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: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`
180
180
  position: relative;
181
181
  margin: 8px 0;
182
182
  ${y||""}
183
- `,children:[v?e.jsx(Py,{onClick:x,disabled:E}):null,e.jsx("div",Object.assign({},v&&{ref:b},{className:r`
183
+ `,children:[v?e.jsx(Gy,{onClick:x,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(Rt,{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)?My(c[n],t):Fy(t))})})})))})})),v?e.jsx($y,{onClick:C,disabled:S}):null]}):null}function Uy({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 Vy={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(wy,{schema:t.node});case"RichText":return e.jsx(_y,{schema:n.node});case"ProductTierCarousel":return e.jsx(Dy,{schema:t.node});case"ProductCatalogCarousel":return e.jsx(By,{schema:t.node});case"TextAnimate":return e.jsx(Uy,{schema:t.node});default:return}}}};function zy(){const t=Rn(),n=Ct();return e.jsx(Sy,{children:e.jsx(wt,{value:n,overrides:Vy,children:e.jsx(xt,{children:e=>e(t)})})})}const qy={staticData:Fu,childLayouts:Gu};function Hy(e={}){return Object.assign({staticData:null,childLayouts:{launched:{}}},e)}function Wy(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*Yy(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*Jy(e,t,n){const a=W(n.payload)||Y(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(Wy,o);if("object"==typeof t&&"take"in t)return void(yield r.call(Yy,t,e.globalDispatch.bind(e)))}yield r.call(t,{level:R,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:R,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}(e,t,n.payload)}}function*Ky(e,t){yield r.all([r.takeLatest(z,Jy.bind(null,e,t)),r.takeEvery(re,Wu.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}Object.assign({},se);const Zy=(new Cn).withAppFactory((function(i){if(i.rootElement){const o=n.createRoot(i.rootElement),r=Hy({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),c=function(e,t,n=Hy()){const a=l(),i=s.configureStore({reducer:qy,devTools:{name:"layouts-xp-sandbox"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Ky,e,t),i}(i.gateway,i.logger,r);o.render(e.jsx(t.StrictMode,{children:e.jsxs(Fn,{info:{layoutType:"LayoutVariant",referralCreativeId:String(i.offerData.creative.referralCreativeId)||"N/A"},children:[e.jsx(Di,{}),e.jsx(a.Provider,{store:c,children:e.jsx(Li,{settings:i,dispatch:c.dispatch,children:e.jsx(zy,{})})})]})}))}}));var Qy=Object.freeze({__proto__:null,moduleConnectorBuilder:Zy});exports.BehaviorSubject=class extends Ru{constructor(e){super(),this._lastValue=e}subscribe(e,t,n){const a=Tu(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=Lu,exports.DisplayPreset={FULLSCREEN:"DisplayPreset.FULLSCREEN",EMBEDDED:"DisplayPreset.EMBEDDED",ATTACHED:"DisplayPreset.ATTACHED"},exports.ErrorLevel={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},exports.FirstValueFromError=ju,exports.Observable=Au,exports.ReplaySubject=class extends Ru{constructor(e=-1){super(),this._buffer=[],this._error=null,this._bufferLength=e}subscribe(e,t,n){const a=Tu(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=wu,exports.addCatchToSubscriber=function(e,t){return new Lu(e,t)},exports.combineLatest=(...e)=>new Au((t=>{if(!e.length)return t.complete(),Ou;const n=new wu,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=ku,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(ju.CompletedBeforeEmit))}))})).then((e=>(n.unsubscribe(),e))).catch((e=>{throw n.unsubscribe(),e}))},exports.fromEvent=(e,t)=>new Au((n=>{const a=e=>n.next(e);return e.addEventListener(t,a),()=>e.removeEventListener(t,a)})),exports.fromPromise=function(e){return new Au((t=>{e.then((e=>{t.next(e),t.complete()}),(e=>t.error(e)))}))},exports.init=function(i,o){return xu(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=Su(o);l.render(e.jsxs(t.StrictMode,{children:[e.jsx(Di,{}),e.jsx(Wn,{children:e.jsx(a.Provider,{store:c,children:e.jsxs(Vn.Provider,{value:r,children:[e.jsx(Ko,{}),e.jsx(Ot.Provider,{value:i,children:e.jsx(yi,{extensions:Cu,extendStore:c.extend.bind(c),children:e.jsx(Ul,{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 Au((t=>{const n=new wu;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=Ou,exports.normaliseToObserver=Tu,exports.of=(...e)=>new Au((t=>{for(const n of e)t.next(n)})),exports.pipe=e=>(...t)=>new Au((n=>{const a=e.subscribe((e=>Du(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)?Uy(c[n],t):By(t))})})})))})})),v?e.jsx(Fy,{onClick:C,disabled:S}):null]}):null}function zy({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 qy={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(Ty,{schema:t.node});case"RichText":return e.jsx(ky,{schema:n.node});case"ProductTierCarousel":return e.jsx(Py,{schema:t.node});case"ProductCatalogCarousel":return e.jsx(Vy,{schema:t.node});case"TextAnimate":return e.jsx(zy,{schema:t.node});default:return}}}};function Hy(){const t=Rn(),n=Ct();return e.jsx(Cy,{children:e.jsx(wt,{value:n,overrides:qy,children:e.jsx(xt,{children:e=>e(t)})})})}const Wy={staticData:Fu,childLayouts:Gu};function Yy(e={}){return Object.assign({staticData:null,childLayouts:{launched:{}}},e)}function Jy(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*Ky(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*Zy(e,t,n){const a=W(n.payload)||Y(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(Jy,o);if("object"==typeof t&&"take"in t)return void(yield r.call(Ky,t,e.globalDispatch.bind(e)))}yield r.call(t,{level:R,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:R,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}(e,t,n.payload)}}function*Qy(e,t){yield r.all([r.takeLatest(z,Zy.bind(null,e,t)),r.takeEvery(re,Wu.bind(null,e,t)),r.takeEvery("*",Ro.bind(null,[z,re],e))])}Object.assign({},se);const Xy=(new Cn).withAppFactory((function(i){if(i.rootElement){const o=n.createRoot(i.rootElement),r=Yy({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),c=function(e,t,n=Yy()){const a=l(),i=s.configureStore({reducer:Wy,devTools:{name:"layouts-xp-sandbox"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Qy,e,t),i}(i.gateway,i.logger,r);o.render(e.jsx(t.StrictMode,{children:e.jsxs(Fn,{info:{layoutType:"LayoutVariant",referralCreativeId:String(i.offerData.creative.referralCreativeId)||"N/A"},children:[e.jsx(Di,{}),e.jsx(a.Provider,{store:c,children:e.jsx(Li,{settings:i,dispatch:c.dispatch,children:e.jsx(Hy,{})})})]})}))}}));var em=Object.freeze({__proto__:null,moduleConnectorBuilder:Xy});exports.BehaviorSubject=class extends Ru{constructor(e){super(),this._lastValue=e}subscribe(e,t,n){const a=Tu(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=Lu,exports.DisplayPreset={FULLSCREEN:"DisplayPreset.FULLSCREEN",EMBEDDED:"DisplayPreset.EMBEDDED",ATTACHED:"DisplayPreset.ATTACHED"},exports.ErrorLevel={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},exports.FirstValueFromError=ju,exports.Observable=Au,exports.ReplaySubject=class extends Ru{constructor(e=-1){super(),this._buffer=[],this._error=null,this._bufferLength=e}subscribe(e,t,n){const a=Tu(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=wu,exports.addCatchToSubscriber=function(e,t){return new Lu(e,t)},exports.combineLatest=(...e)=>new Au((t=>{if(!e.length)return t.complete(),Ou;const n=new wu,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=ku,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(ju.CompletedBeforeEmit))}))})).then((e=>(n.unsubscribe(),e))).catch((e=>{throw n.unsubscribe(),e}))},exports.fromEvent=(e,t)=>new Au((n=>{const a=e=>n.next(e);return e.addEventListener(t,a),()=>e.removeEventListener(t,a)})),exports.fromPromise=function(e){return new Au((t=>{e.then((e=>{t.next(e),t.complete()}),(e=>t.error(e)))}))},exports.init=function(i,o){return xu(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=Su(o);l.render(e.jsxs(t.StrictMode,{children:[e.jsx(Di,{}),e.jsx(Wn,{children:e.jsx(a.Provider,{store:c,children:e.jsxs(Vn.Provider,{value:r,children:[e.jsx(Ko,{}),e.jsx(Ot.Provider,{value:i,children:e.jsx(yi,{extensions:Cu,extendStore:c.extend.bind(c),children:e.jsx(Ul,{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 Au((t=>{const n=new wu;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=Ou,exports.normaliseToObserver=Tu,exports.of=(...e)=>new Au((t=>{for(const n of e)t.next(n)})),exports.pipe=e=>(...t)=>new Au((n=>{const a=e.subscribe((e=>Du(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);