@rokt/dcui-orchestrator 0.0.4-rc.15 → 0.0.4-rc.17

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
@@ -133,7 +133,7 @@
133
133
  z-index: 10;
134
134
  transition: opacity ${h}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 Ps={name:"loading-extension",componentFactory:e=>t.createElement(ks,{data:e}),interceptors:{}},$s=1e3;function Gs(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()/$s,o=t.useRef(null),r=()=>{const t=(new Date).getTime()/$s;a(Math.max(Math.floor(e-(t-i)),0))};return t.useEffect((()=>(o.current=setInterval(r,$s),()=>{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,$s)}}}((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:Y,payload:{name:"SignalUserInteraction",action:"TimerExpired",context:"TimerProgression"}}),d({type:"PROGRESSION/PROCESS",payload:{offerProcessStatus:"CONTINUE"}}))}),[o,r]);const u=Tn(),{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 Fs={name:"timer-progression-extension",componentFactory:e=>t.createElement(Gs,{data:e}),interceptors:{}},Ms="MODULE/ADD_LOADED",Bs="MODULE/LOAD",Us="PROGRESSION/INITIALISE",Vs="PROGRESSION/NEXT",zs="PROGRESSION/PREV",qs="PROGRESSION/UPDATE_GROUP_SIZE",Hs="PROGRESSION/PROCESS",Ws="SLOTS/SET",Js="INSTANT_PURCHASE/DISMISS",Ks="OFFER_LIFECYCLE",Ys="DOMAIN_STATES/SET",Zs="OFFER_ENGAGEMENT",Qs="GLOBAL_OFFER_DATA_STATE/SET_CART",Xs=Object.assign(Object.assign({},Zi),{NEXT_IN_PROGRESSION:Vs,PREV_IN_PROGRESSION:zs,INITIALISE_PROGRESSION:Us,UPDATE_GROUP_SIZE:qs,SET_SLOTS:Ws,ADD_LOADED_MODULE:Ms,SET_DOMAIN_STATE:Ys,SET_GLOBAL_OFFER_DATA_CART:Qs}),el=Object.assign(Object.assign({},Qi),{LOAD_MODULES:Bs,DISMISS_INSTANT_PURCHASE:Js,PROCESS_PROGRESSION:Hs,OFFER_LIFECYCLE:Ks,OFFER_ENGAGEMENT:Zs,SET_PARTNER_VALIDATION_STATUS:ae});function tl(e,t){return t<=0||e<=0||t>e?0:Math.ceil(e/t)}function nl(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<tl(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 al=Symbol("root");function il(){return{[al]:{}}}const ol=Object.assign({progression:function(e=null,t){switch(t.type){case Us:if(function(e){const{totalCount:t,currentGroupIndex:n,groupSize:a}=e;return t>=0&&a>=0&&n>=0&&a<=t&&n<tl(t,a)}(t.payload)){const{totalCount:e,_:n,groupSize:a}=t.payload;return Object.assign(Object.assign({},t.payload),{indexGroups:nl(e,a)})}return null;case qs:{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:nl(a,n),currentGroupIndex:0}):null}case Vs:{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,tl(t,n)-1)}):null}case zs:{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===Ws?t.payload:e},module:function(e={loadedModules:[]},t){return t.type===Ms?Object.assign(Object.assign({},e),{loadedModules:[...e.loadedModules,t.payload]}):e},domainStates:function(e=il(),t){if(t.type===Ys){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:al;return n===al?e:Object.assign(Object.assign({},i.assocPath([n,t.payload.key],Number(t.payload.value),e)),{[al]:{}})}return e}return e},globalOfferDataState:function(e={},t){if(t.type===Qs){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}},er);function rl(e={}){return Object.assign(Object.assign(Object.assign({},function(e={}){return Object.assign({layout:Vo(),breakpoint:{breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},active:zo(),fonts:[],signal:{queue:[],processed:[]},serializableCache:Xo(),settings:{closeOnComplete:!0},customStates:{root:{}}},e)}(e)),{progression:null,slots:[],module:{loadedModules:[]},domainStates:il(),globalOfferDataState:{}}),e)}function sl(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 ll(e){return e.progression?{activeGroupIndex:e.progression.currentGroupIndex,totalOffers:e.progression.totalCount,totalGroups:tl(e.progression.totalCount,e.progression.groupSize),isLast:sl(e)}:null}function cl(e,t){return e.domainStates[`module${t}`]||{offerComplete:0,checkout:0}}function dl(e){return Object.values(e.globalOfferDataState).reduce(((e,t)=>t.cart?e+t.cart.reduce(((e,t)=>e+t.quantity),0):e),0)}function ul(n){var i;const{config:o,position:r,visible:s,container:l,testId:c}=n,d=Mn(),u=Tn(),p=a.useSelector(qo),f=t.useContext(Bn),y=`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(y,{style:{display:"flex",flexDirection:"column"===l?"column":"row",width:"100%"},slotInstanceGuid:o.instanceGuid,layoutSchema:JSON.stringify(o.layoutVariant.layoutVariantSchema),schemaVersion:f,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}`,"aria-hidden":!s,"module-component":!0,"plugin-id":d,"active-breakpoint":B(p)})]})}function pl({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=Tn(),{tabIndex:d,isDisabled:u,styles:p}=m(c);return r.length&&r[l]?e.jsx(wa,{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(Ri,{effect:n.transition,visible:a===l,parentElement:s.current,children:e.jsx(ul,{config:t,position:a,visible:a===l,container:"column"})}))))})}):null}const fl=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=tl(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=Tn(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=Array(a).fill(i.indicator);return a>0&&(u=a+n-1,(d=t)>=n&&d<=u)?e.jsx(qt,{children:a=>e.jsx(wa,{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 yl="partnerValidationUI",hl="stackedViewableItems";function ml(n){var o;const r=a.useDispatch(),s=a.useSelector((e=>e.slots)),l=null!==(o=n.schema.viewableItems)&&void 0!==o?o:[],c=ya(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:Ui,payload:{key:hl,value:String(d)}})}),[d]);const u=s.slice(0,d),p=Tn(),{tabIndex:f,isDisabled:y,styles:h}=m(p);return(null==u?void 0:u.length)>0?e.jsx(wa,{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(ul,{config:t,position:n,visible:!0,container:"column"}))))})}):null}function vl(n){const i=n.schema.styles,o=a.useDispatch(),r=Tn(),s="Backward"===n.schema.direction?"Previous":"Next",{tabIndex:l,styles:c,isDisabled:d}=m(r),u=()=>{o({type:"Backward"===n.schema.direction?Xs.PREV_IN_PROGRESSION:Xs.NEXT_IN_PROGRESSION})};return e.jsx(wa,{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(bt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}function gl({schema:n,testId:i}){var o,r,s,l,c,u,p,f,y;const 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)),E=a.useSelector(Ko),I=n.viewableItems.length-1,[x,S]=d({slidesToScroll:null!==(r=n.viewableItems[Math.min(E,I)])&&void 0!==r?r:"auto",containScroll:"trimSnaps"}),w=a.useDispatch(),C=Tn(),{tabIndex:O,isDisabled:T,styles:A}=m(C),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[E])||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?w({type:Xs.NEXT_IN_PROGRESSION}):a<i&&w({type:Xs.PREV_IN_PROGRESSION}))}return null!=g&&(null==S||S.on("select",e),null==S||S.scrollTo(g)),()=>{null==S||S.off("select",e)}}),[S,g,w]);const j={overflow:"hidden"},L={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:R,alignItems:"stretch"},N=e=>{var t;return null!==(t=null==v?void 0:v.includes(e))&&void 0!==t&&t},_=n.peekThroughSize[Math.min(E,n.peekThroughSize.length-1)],D=_?"Fixed"===(k=_).type?`${k.value}px`:`${k.value}%`:"0px";var k;const P=null!==(y=n.viewableItems[Math.min(I,E)])&&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(wa,{styles:n.styles,children:({classnames:n})=>e.jsx("div",{ref:x,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:L,"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(ul,{config:t,position:n,container:"row",visible:N(n)})}))))})})}):null}function bl({schema:n,testId:i}){const o=Mn(),r=t.useMemo((()=>ct(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)||[]).map((t=>t.map((t=>e.slots[t])).filter((e=>null!=e))))})),c=t.useRef(null),d=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})),u=Tn(),{tabIndex:p,isDisabled:f,styles:y}=m(u);return l.length?e.jsx(wa,{styles:n.styles,children:({classnames:a})=>e.jsx("div",{ref:c,"data-testid":i,"data-e2e":"GroupedDistribution","aria-disabled":f,tabIndex:p,style:Object.assign({position:"relative",transition:`height ${n.transition.settings.duration/2}ms ease-in-out`,overflow:"hidden",boxSizing:"content-box"},y),children:t.Children.toArray(l.map(((o,l)=>e.jsx(Ri,{effect:n.transition,visible:l===d,parentElement:c.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(ul,{config:t,position:a,visible:l===d,container:"column",testId:i?`${i}-child${a}`:void 0})})))}))))})}):null}const El={action:{CaptureOnly:"CaptureOnly",Url:"Url",Fulfillment:"Fulfillment",External:"External"},urlBehavior:{newTab:"newTab",roktWebViewSDK:"roktWebViewSDK",self:"self"},signalType:{SignalResponse:"SignalResponse",SignalGatedResponse:"SignalGatedResponse",SignalSecondaryResponse:"SignalSecondaryResponse"},conversionType:{Default:"Default",RealTime:"RealTime"}};function Il(e,t,n=!1){return Error(`Could not translate ${e} with guid: ${t}${n?" for child layout":""}`)}function xl(e,t=!1){var n;try{if(e.responseOptionsMap||t)return Object.assign(Object.assign({},e),{responseOptionsMap:i.mapObjIndexed(Sl,null!==(n=e.responseOptionsMap)&&void 0!==n?n:{})});{const t=`Creative: ${e.instanceGuid}, did not receive a valid response options map.`;throw new L("NO_CREATIVE_RESPONSE_OPTIONS_MAP",t)}}catch(n){throw n.message?n:Il("Creative",e.instanceGuid,t)}}function Sl(e){try{let t,n;e.urlBehavior&&(t=El.urlBehavior[e.urlBehavior]),e.conversionType&&(n=El.conversionType[e.conversionType]);return Object.assign(Object.assign({},e),{urlBehavior:t,action:El.action[e.action],signalType:El.signalType[e.signalType],conversionType:n})}catch(t){throw t.message?t:Il("CreativeResponse",e.instanceGuid)}}function wl(e,t,n){try{return JSON.parse(e)}catch(e){throw Error(`Parse JSON failed, invalid JSON file for ${t} with guid ${n}.`)}}function Cl(){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 Ol={OneByOneDistribution:function(t){if("OneByOneDistribution"===t.type)return e.jsx(pl,{schema:t.node})},StackedDistribution:function(t){if("StackedDistribution"===t.type)return e.jsx(ml,{schema:t.node})},ProgressIndicator:function(t){if("ProgressIndicator"===t.type)return e.jsx(fl,{schema:t.node})},ProgressControl:function(t){if("ProgressControl"===t.type)return e.jsx(vl,{schema:t.node})},Overlay:function(t){if("Overlay"===t.type)return e.jsx(so,{schema:t.node})},CloseButton:function(t){if("CloseButton"===t.type)return e.jsx(to,{schema:t.node})},EscapeHatch:(Tl=[function(t,n){if(v("CloseButton",t)){const n=JSON.parse(t.node.data);return e.jsx(to,{schema:n.node,action:n.action})}},ui],e=>Tl.reduce(((t,n)=>void 0===t?n(e):t),void 0)),CarouselDistribution:function(t){if("CarouselDistribution"===t.type)return e.jsx(gl,{schema:t.node})},GroupedDistribution:function(t){if("GroupedDistribution"===t.type)return e.jsx(bl,{schema:t.node})},BottomSheet:function(t){if("BottomSheet"===t.type)return e.jsx(po,{schema:t.node})}};var Tl;function Al(e,t){e({type:Y,payload:{name:"SignalActivation",parentGuid:t}})}function Rl({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:ll(e),customStates:e.customStates.root,domainStates:e.domainStates[al]})),i.equals),y=a.useSelector((e=>e.slots.length)),h=a.useSelector((e=>{var t;const n=Number(null!==(t=e.serializableCache.get(hl))&&void 0!==t?t:"");return y-n})),m=a.useSelector(dl);ce(St(),p),t.useEffect((()=>(u&&document.body.addEventListener("click",Al.bind(null,p,u.instanceGuid),{once:!0}),()=>{u&&document.body.removeEventListener("click",Al.bind(null,p,u.instanceGuid))})),[null==u?void 0:u.instanceGuid]),Cl(),t.useEffect((()=>{if(u){const e={type:Y,payload:{name:"SignalImpression",parentGuid:u.instanceGuid}},t={type:Ki,payload:{code:"LAYOUT_IMPRESSED"}};p(e),p(t)}}),[u]);const v=e=>{p({type:el.REPORT_ERROR,payload:e})},g=a.useSelector((e=>e.breakpoint.initialised));if(u&&g){const t=Ut({})({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=Ii(v);return e.jsx(kn,{info:{layoutType:"OuterLayout",pageInstanceGuid:n},children:e.jsx(Ht,{value:t,children:e.jsx(It,{value:a,overrides:Ol,children:e.jsx(mt.Provider,{value:f,children:e.jsx(yt.Provider,{value:p,children:e.jsx(Yt.Provider,{value:"OUTER",children:e.jsx(Bn.Provider,{value:u.layoutSchemaVersion,children:e.jsx(bt,{children:e=>e(u.layoutSchema)})})})})})})})})}return null}var jl=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"CatalogResponseButton":case"CatalogQuantityOption":case"CatalogRadioGroup":case"CatalogQuantityCounter":case"PartnerEventButtonTrigger":case"CopyToClipboardButton":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}}}),Ll=Object.assign({},jl);function*Nl(e,t){const n=Ll.getDistribution(t),a=null==n?void 0:n.type,i=yield r.select(Ko),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:Xs.INITIALISE_PROGRESSION,payload:{currentGroupIndex:0,totalCount:e,groupSize:o}}))}function*_l(e,t){const{instanceGuid:n,layoutSchemaVersion:a,outerLayoutSchema:o,slots:r}=t.payload;n?yield c.put({type:Y,payload:{name:"SignalLoadComplete",parentGuid:n}}):yield c.put({type:Ji,payload:{level:vo,code:Lo,message:"Layout instance guid does not exist"}}),yield c.put({type:Bs,payload:{modules:r.map((e=>e.layoutVariant.moduleName))}}),yield c.put({type:ki,payload:o.breakpoints}),yield c.put({type:Xs.LAYOUT_UPDATE,payload:{instanceGuid:n,layoutSchemaVersion:a,layoutSchema:o.layout,settings:o.settings}}),yield c.put({type:Xs.SET_SLOTS,payload:r}),i.isNil(o.settings)||(yield c.put({type:Xs.SET_SETTINGS,payload:o.settings})),yield*Nl(r.length,o.layout);const s=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,sr.PartnerValidationEvent.OPT_IN_TO_PARTNER_VALIDATION),yield c.spawn(Dl,e,sr.PartnerValidationEvent.SHOW_PARTNER_VALIDATION_STATUS,(()=>({type:"ACTIVE/ADD",payload:{id:yl}})))}catch(e){return yield c.put({type:Ji,payload:{level:mo,code:_o,message:"Failed to establish partner validation."}}),"FAILURE"}return"OK"}(e.partner,o.settings,r);"OK"===s&&(yield c.call(Tr,e.display,o.display))}function*Dl(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 kl(e){return Ic(e)}function Pl(e,t){return Error(`Migration process from v0_0 to v0_1 failed: could not transform ${e} node. For more details: ${t}`)}const $l=i.all(i.anyPass([function(e){return"Row"===e.type&&Bl(e.node.children)},function(e){return"Column"===e.type&&Bl(e.node.children)},ql,Hl])),Gl=i.all(i.anyPass([function(e){return"Row"===e.type&&Ul(e.node.children)},function(e){return"Column"===e.type&&Ul(e.node.children)},Hl,ql,function(e){return"DataImage"===e.type},function(e){return"When"===e.type&&Ul(e.node.children)}])),Fl=i.all(i.anyPass([function(e){return"Row"===e.type&&Vl(e.node.children)},function(e){return"Column"===e.type&&Vl(e.node.children)},Hl,ql])),Ml=i.all(i.anyPass([function(e){return"Row"===e.type&&zl(e.node.children)},function(e){return"Column"===e.type&&zl(e.node.children)},ql,function(e){return"RichText"===e.type},Hl,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&zl(e.node.children)},function(e){return"StaticLink"===e.type&&zl(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CloseButton"===e.type&&zl(e.node.children)}]));function Bl(e){return $l(e)}function Ul(e){return Gl(e)}function Vl(e){return Fl(e)}function zl(e){return Ml(e)}function ql(e){return"StaticImage"===e.type}function Hl(e){return"BasicText"===e.type}const Wl=i.lensPath(["styles","elements","link"]),Jl=i.lensPath(["styles","elements","activeIndicator"]),Kl=i.lensPath(["styles","elements","indicator"]),Yl=i.lensPath(["styles","elements","seenIndicator"]),Zl=i.lensPath(["focussed"]),Ql=i.lensPath(["hovered"]),Xl=i.lensPath(["default"]),ec=i.lensPath(["pressed"]),tc=e=>{var t;return{text:null!==(t=null==e?void 0:e.text)&&void 0!==t?t:{}}},nc=i.when(i.hasPath(["styles","elements","link"]),i.pipe(i.over(Wl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default})))),i.over(Wl,i.map(i.when(i.has("focussed"),i.over(Zl,tc)))),i.over(Wl,i.map(i.when(i.has("hovered"),i.over(Ql,tc)))),i.over(Wl,i.map(i.when(i.has("default"),i.over(Xl,tc)))),i.over(Wl,i.map(i.when(i.has("pressed"),i.over(ec,tc)))))),ac=i.pipe(i.when(i.hasPath(["styles","elements","activeIndicator"]),i.over(Jl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","indicator"]),i.over(Kl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","seenIndicator"]),i.over(Yl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))));function ic(e,t){return e?{elements:{own:e.elements.own.map(t)}}:void 0}const oc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),rc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),sc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),lc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),cc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),dc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),uc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),pc=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 Pl("When",`Invalid condition: ${e}`)}},fc=e=>{switch(e){case"breakpoint":return"Breakpoint";case"progression":return"Progression";case"position":return"Position";default:throw Pl("When",`Invalid target: ${e}`)}},yc=e=>{const{target:t,condition:n,value:a}=e;return{type:fc(t),predicate:{condition:pc(n),value:a}}};function hc(e){const t={type:"FadeInOut",settings:{duration:e.transition.settings.duration}};return{styles:e.style,transition:t}}function mc(e){const t=e.children.map((e=>Ic(e)));if(Bl(t))return Object.assign(Object.assign({},e),{children:t,styles:ic(e.styles,cc)});throw Pl("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function vc(e){const t=e.children.map((e=>Ic(e)));if(Ul(t))return Object.assign(Object.assign({},e),{children:t,styles:ic(e.styles,dc)});throw Pl("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function gc(e){const t=e.children.map((e=>Ic(e)));if(Vl(t))return Object.assign(Object.assign({},e),{children:t,styles:ic(e.styles,uc)});throw Pl("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}const bc=e=>({own:e.overlayContainer,wrapper:e.overlayWrapper});function Ec(e){var t,n;const a=(null===(t=e.styles)||void 0===t?void 0:t.elements)?{elements:bc(null===(n=e.styles)||void 0===n?void 0:n.elements)}:void 0,i=e.children.map((e=>Ic(e)));if(zl(i))return Object.assign(Object.assign({},e),{styles:a,children:i});throw Pl("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function Ic(e){switch(e.type){case"When":return{type:"When",node:(s=e.node,{predicates:s.predicates.map(yc),children:s.children.map((e=>Ic(e)))})};case"OneByOneDistribution":return{type:e.type,node:hc(e.node)};case"Overlay":return{type:e.type,node:Ec(e.node)};case"Column":return{type:e.type,node:(r=e.node,{styles:ic(r.styles,oc),children:r.children.map((e=>Ic(e)))})};case"Row":return{type:e.type,node:(o=e.node,{styles:ic(o.styles,rc),children:o.children.map((e=>Ic(e)))})};case"RichText":return{type:e.type,node:(i=e.node,nc(i))};case"CloseButton":return{type:e.type,node:mc(e.node)};case"CreativeResponse":return{type:e.type,node:vc(e.node)};case"StaticLink":return{type:e.type,node:gc(e.node)};case"StaticImage":return{type:e.type,node:(a=e.node,Object.assign(Object.assign({},a),{styles:ic(a.styles,sc)}))};case"DataImage":return{type:e.type,node:(n=e.node,Object.assign(Object.assign({},n),{styles:ic(n.styles,lc)}))};case"ProgressIndicator":return{type:e.type,node:(t=e.node,ac(t))};default:return e}var t,n,a,i,o,r,s}function xc(e){return Ad(e)}function Sc(e,t){return Error(`Migration process from v0_23 to v1_0 failed: could not transform ${e} node. For more details: ${t}`)}const wc=e=>"scroll"===e||"auto"===e?"visible":e,Cc=i.lensPath(["elements","own"]),Oc=i.lensPath(["transitions","transition","value","own"]),Tc=i.lensPath(["elements","wrapper"]),Ac=i.lensPath(["transitions","transition","value","wrapper"]),Rc=i.lensPath(["elements","indicator"]),jc=i.lensPath(["transitions","transition","value","indicator"]),Lc=i.lensPath(["elements","activeIndicator"]),Nc=i.lensPath(["transitions","transition","value","activeIndicator"]),_c=i.lensPath(["elements","seenIndicator"]),Dc=i.lensPath(["transitions","transition","value","seenIndicator"]),kc=i.lensPath(["default","container","overflow"]),Pc=i.lensPath(["pressed","container","overflow"]),$c=i.lensPath(["hovered","container","overflow"]),Gc=i.lensPath(["focussed","container","overflow"]),Fc=i.lensPath(["disabled","container","overflow"]),Mc=i.lensPath(["container","overflow"]),Bc=i.pipe(i.when(i.hasPath(["default","container","overflow"]),i.over(kc,wc)),i.when(i.hasPath(["pressed","container","overflow"]),i.over(Pc,wc)),i.when(i.hasPath(["hovered","container","overflow"]),i.over($c,wc)),i.when(i.hasPath(["focussed","container","overflow"]),i.over(Gc,wc)),i.when(i.hasPath(["disabled","container","overflow"]),i.over(Fc,wc))),Uc=i.when(i.hasPath(["container","overflow"]),i.over(Mc,wc)),Vc=i.pipe(i.when(i.hasPath(["elements","own"]),i.over(Cc,i.map(Bc))),i.when(i.hasPath(["transitions","transition","value","own"]),i.over(Oc,Uc))),zc=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)})),qc=i.pipe(Vc,zc),Hc=i.pipe(i.when(i.hasPath(["elements","wrapper"]),i.over(Tc,i.map(Bc))),i.when(i.hasPath(["transitions","transition","value","wrapper"]),i.over(Ac,Uc))),Wc=i.pipe(i.when(i.hasPath(["elements","indicator"]),i.over(Rc,i.map(Bc))),i.when(i.hasPath(["transitions","transition","value","indicator"]),i.over(jc,Uc))),Jc=i.pipe(i.when(i.hasPath(["elements","activeIndicator"]),i.over(Lc,i.map(Bc))),i.when(i.hasPath(["transitions","transition","value","activeIndicator"]),i.over(Nc,Uc))),Kc=i.pipe(i.when(i.hasPath(["elements","seenIndicator"]),i.over(_c,i.map(Bc))),i.when(i.hasPath(["transitions","transition","value","seenIndicator"]),i.over(Dc,Uc)));function Yc(e){return"StaticImage"===e.type}function Zc(e){return"StaticIcon"===e.type}function Qc(e){return"BasicText"===e.type}function Xc(e){return"DataImage"===e.type}function ed(e){return"DataIcon"===e.type}function td(e){return"RichText"===e.type}function nd(e){return"SlideStateTrigger"===e.type}function ad(e){return"ToggleButtonStateTrigger"===e.type}const id=i.all(i.anyPass([function(e){return"Row"===e.type&&od(e.node.children)},function(e){return"Column"===e.type&&od(e.node.children)},Yc,Zc,td,Qc,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&od(e.node.children)},function(e){return"StaticLink"===e.type&&od(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&&od(e.node.children)},function(e){return"ProgressControl"===e.type&&hd(e.node.children)},function(e){return"ZStack"===e.type&&od(e.node.children)},function(e){return"FlowRow"===e.type&&od(e.node.children)},nd,ad]));function od(e){return id(e)}const rd=i.pipe(Vc,Hc,zc);function sd(e){const t=e.children.map((e=>Ad(e)));if(od(t))return Object.assign(Object.assign({},i.omit(["settings"],e)),{children:t,allowBackdropToClose:e.settings.allowBackdropToClose,styles:e.styles?rd(e.styles):void 0});throw Sc("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function ld(e){const t=e.children.map((e=>Ad(e)));if(hd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?qc(e.styles):void 0});throw Sc("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function cd(e){const t=e.children.map((e=>Ad(e)));if(vd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?qc(e.styles):void 0});throw Sc("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function dd(e){const t=e.children.map((e=>Ad(e)));if(hd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?qc(e.styles):void 0});throw Sc("ProgressControl",`Invalid schema: ${JSON.stringify(e)}`)}const ud=i.pipe(Vc,Wc,Jc,Kc,zc);const pd=i.all(i.anyPass([Qc,Yc,Zc,Xc,ed,function(e){return"Row"===e.type&&fd(e.node.children)},function(e){return"FlowRow"===e.type&&fd(e.node.children)},function(e){return"Column"===e.type&&fd(e.node.children)},function(e){return"ZStack"===e.type&&fd(e.node.children)},function(e){return"When"===e.type&&fd(e.node.children)}]));function fd(e){return pd(e)}const yd=i.all(i.anyPass([Qc,Yc,Zc,function(e){return"Row"===e.type&&hd(e.node.children)},function(e){return"FlowRow"===e.type&&hd(e.node.children)},function(e){return"Column"===e.type&&hd(e.node.children)},function(e){return"ZStack"===e.type&&hd(e.node.children)},function(e){return"When"===e.type&&hd(e.node.children)}]));function hd(e){return yd(e)}const md=i.all(i.anyPass([Qc,Yc,Zc,Xc,ed,function(e){return"Row"===e.type&&vd(e.node.children)},function(e){return"FlowRow"===e.type&&vd(e.node.children)},function(e){return"Column"===e.type&&vd(e.node.children)},function(e){return"ZStack"===e.type&&vd(e.node.children)},function(e){return"When"===e.type&&vd(e.node.children)}]));function vd(e){return md(e)}function gd(e){const t=e.children.map((e=>Ad(e)));if(fd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?qc(e.styles):void 0});throw Sc("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}function bd(e){const t=e.children.map((e=>Ad(e)));if(vd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?qc(e.styles):void 0});throw Sc("CatalogResponseButton",`Invalid schema: ${JSON.stringify(e)}`)}function Ed(e){return"Row"===e.type&&Sd(e.node.children)}function Id(e){return"Column"===e.type&&Sd(e.node.children)}const xd=i.all(i.anyPass([Qc,Yc,Zc,Xc,ed,td,function(e){return"StaticLink"===e.type},nd,ad,function(e){return"CatalogResponseButton"===e.type},Ed,function(e){return"FlowRow"===e.type&&Sd(e.node.children)},Id,function(e){return"ZStack"===e.type&&Sd(e.node.children)},function(e){return"When"===e.type&&Sd(e.node.children)}]));function Sd(e){return xd(e)}const wd=i.anyPass([Ed,Id]);function Cd(e){const t=Ad(e.template);if(function(e){return wd(e)}(t))return Object.assign(Object.assign({},e),{template:t,styles:e.styles?qc(e.styles):void 0});throw Sc("CatalogStackedCollection",`Invalid schema: ${JSON.stringify(e)}`)}function Od(e){const t=e.children.map((e=>Ad(e)));if(fd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?qc(e.styles):void 0});throw Sc("ToggleButtonStateTrigger",`Invalid schema: ${JSON.stringify(e)}`)}function Td(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=>Ad(e))),transition:t})}function Ad(e){switch(e.type){case"Row":return{type:e.type,node:(g=e.node,Object.assign(Object.assign({},g),{children:g.children.map((e=>Ad(e))),styles:g.styles?qc(g.styles):void 0}))};case"When":return{type:e.type,node:Td(e.node)};case"FlowRow":return{type:e.type,node:(v=e.node,Object.assign(Object.assign({},v),{styles:v.styles?qc(v.styles):void 0,children:v.children.map((e=>Ad(e)))}))};case"Column":return{type:e.type,node:(m=e.node,Object.assign(Object.assign({},m),{children:m.children.map((e=>Ad(e))),styles:m.styles?qc(m.styles):void 0}))};case"ZStack":return{type:e.type,node:(h=e.node,Object.assign(Object.assign({},h),{styles:h.styles?qc(h.styles):void 0,children:h.children.map((e=>Ad(e)))}))};case"Overlay":return{type:e.type,node:sd(e.node)};case"ProgressControl":return{type:e.type,node:dd(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?qc(y.styles):void 0}))};case"CloseButton":return{type:"CloseButton",node:ld(e.node)};case"CreativeResponse":return{type:"CreativeResponse",node:cd(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?qc(f.styles):void 0}))};case"OneByOneDistribution":return{type:"OneByOneDistribution",node:(p=e.node,Object.assign(Object.assign({},p),{styles:p.styles?qc(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?ud(d.styles):void 0}))};case"SlideStateTrigger":return{type:"SlideStateTrigger",node:(c=e.node,Object.assign(Object.assign({},c),{styles:c.styles?qc(c.styles):void 0}))};case"StackedDistribution":return{type:"StackedDistribution",node:(l=e.node,Object.assign(Object.assign({viewableItems:[]},l),{styles:l.styles?qc(l.styles):void 0}))};case"StaticLink":return{type:"StaticLink",node:gd(e.node)};case"ToggleButtonStateTrigger":return{type:"ToggleButtonStateTrigger",node:Od(e.node)};case"CatalogResponseButton":return{type:"CatalogResponseButton",node:bd(e.node)};case"CatalogStackedCollection":return{type:"CatalogStackedCollection",node:Cd(e.node)};case"RichText":return{type:"RichText",node:(s=e.node,Object.assign(Object.assign({},s),{styles:s.styles?zc(s.styles):void 0}))};case"DataImage":return{type:"DataImage",node:(r=e.node,Object.assign(Object.assign({},r),{styles:r.styles?zc(r.styles):void 0}))};case"StaticImage":return{type:"StaticImage",node:(o=e.node,Object.assign(Object.assign({},o),{styles:o.styles?zc(o.styles):void 0}))};case"DataIcon":return{type:"DataIcon",node:(a=e.node,Object.assign(Object.assign({},a),{styles:a.styles?zc(a.styles):void 0}))};case"StaticIcon":return{type:"StaticIcon",node:(n=e.node,Object.assign(Object.assign({},n),{styles:n.styles?zc(n.styles):void 0}))};case"BasicText":return{type:"BasicText",node:(t=e.node,Object.assign(Object.assign({},t),{styles:t.styles?zc(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 Rd(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 jd(e,t){return e.major===t.major&&e.minor===t.minor}const Ld=(e,t,n)=>i.allPass([i.lte(e),i.gte(t)])(n);function Nd(e,t){return jd(t,{major:0,minor:0})?Nd(kl(e),{major:0,minor:1}):function(e,t){return 0===t.major&&Ld(1,23,t.minor)}(0,t)?Nd(xc(e),{major:1,minor:0}):e}function _d(e,t){return jd(t,{major:0,minor:0})?_d(function(e){return Object.assign(Object.assign({},e),{layout:kl(e.layout)})}(e),{major:0,minor:1}):function(e,t){return 0===t.major&&Ld(1,23,t.minor)}(0,t)?_d(function(e){return Object.assign(Object.assign({},e),{layout:xc(e.layout)})}(e),{major:1,minor:0}):e}function Dd(e,t,n,a){const i=Rd(n);if(a){const s=Rd(a);if(r=i,(o=s).major<r.major||o.major===r.major&&o.minor<r.minor||jd(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,Rd("0.0"));var o,r}function kd(e){var t;try{return Object.assign(Object.assign({},i.clone(e)),{offer:Object.assign(Object.assign({},i.clone(e.offer)),{creative:xl(e.offer.creative)}),layoutVariant:Object.assign(Object.assign({},i.clone(e.layoutVariant)),{layoutVariantSchema:"string"==typeof e.layoutVariant.layoutVariantSchema?wl(e.layoutVariant.layoutVariantSchema,"LayoutSlotLayoutVariant",e.instanceGuid):e.layoutVariant.layoutVariantSchema,childLayouts:i.map(Pd,null!==(t=e.layoutVariant.childLayouts)&&void 0!==t?t:[])})})}catch(t){throw t.message?t:Il("Slot",e.instanceGuid)}}function Pd(e){return Object.assign(Object.assign({},i.clone(e)),{childLayoutSchema:"string"==typeof e.childLayoutSchema?wl(e.childLayoutSchema,"ChildLayoutRootSchema",e.childLayoutId):e.childLayoutSchema})}function $d(e){if(e){const t=function(e){try{return Object.assign(Object.assign({},i.clone(e)),{outerLayoutSchema:"string"==typeof e.outerLayoutSchema?wl(e.outerLayoutSchema,"LayoutRootLayoutSchema",e.instanceGuid):e.outerLayoutSchema,slots:i.map(kd,e.slots)})}catch(t){throw t.message?t:Il("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=>Dd(e,Nd,t,n))))),i.over(a,(e=>Dd(e,_d,t,n))))(e)}(t,Eo.DCUI_SCHEMA_VERSION)}}const Gd=i.cond([[i.where({signalType:i.equals("SignalSecondaryResponse")}),function*(e,t){return yield r.put({type:Ji,payload:{level:go,code:Ro,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){var a;if("url"in e&&e.url){const i=e.instanceGuid;yield r.put({type:Y,payload:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:i,responseActionPayload:{name:"Url",transformedTrafficURL:e.url,creativeInstanceGuid:e.creativeInstanceGuid}}});const o=t.getOverrideLinkNavigation()?"overrideLinkNavigation":null!==(a=e.urlBehavior)&&void 0!==a?a:"newTab",s=yield*function*(e,t,n){try{const a=yield r.call(fr,t),i=vr(a)?a.ref:void 0;return yield r.call(e.addAdvertiserWindowRef,i,n),vr(a)||"newTab"!==t.urlBehavior?"SUCCESS":(yield r.put({type:Ji,payload:{level:go,code:jo,message:`Did not receive a window reference opening link ${t.url}`}}),"UNSPECIFIED")}catch(e){return yield r.put({type:Ji,payload:{level:go,code:jo,message:`Errored attempting to open link ${t.url}: ${e.message}`,stack:e.stack}}),"ERROR"}}(t,{url:e.url,urlBehavior:o,external:{partner:n}},i);return"self"===o?"END":s}return yield r.put({type:Ji,payload:{level:go,code:Ro,message:"URL response doesn't have a valid url",additionalInformation:{instanceGuid:e.instanceGuid}}}),"ERROR"}],[i.T,function*(){return"EXPLICIT_DISMISSAL"}]]);function*Fd(e){return yield r.put({type:Ji,payload:{level:go,code:Ro,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}function*Md(e,t){let n="IMPLICIT_DISMISSAL";const a=t.payload.offerPositionIndex,i=W(t.payload)||J(t.payload)||H(t.payload)?t.payload:t.payload.responseOption;switch(i.action){case"Url":yield r.put({type:X,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:Ki,payload:{code:"CREATIVE_RESPONSE",message:"creative positive response",data:{type:i.action,isPositive:i.isPositive,responseInstanceGuid:i.instanceGuid}}}),yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*Fd(i):yield*Gd(i,e.context,e.partner);break;case"CaptureOnly":yield r.put({type:X,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*Fd(i):yield*function*(e){return yield r.put({type:Y,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:Ji,payload:{level:go,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"External":yield r.put({type:Ji,payload:{level:go,code:"INCORRECTLY_HANDLE_EXTERNAL_ACTION",message:`External action was dispatched as an engagement erroneously. Instance GUID: ${i.instanceGuid}`}}),n="ERROR"}K(t.payload)||(yield r.put(function(e,t){switch(e){case"SUCCESS":return{type:Ks,payload:{event:"Completed",completionReason:"Success",offerPositionIndex:t}};case"UNSPECIFIED":return{type:Ks,payload:{event:"Completed",completionReason:"Unspecified",offerPositionIndex:t}};case"ERROR":return{type:Ks,payload:{event:"Completed",completionReason:"Error",offerPositionIndex:t}};case"EXPLICIT_DISMISSAL":return{type:Ks,payload:{event:"Dismissed",dismissalReason:"Explicit",offerPositionIndex:t}};case"IMPLICIT_DISMISSAL":return{type:Ks,payload:{event:"Dismissed",dismissalReason:"Implicit",offerPositionIndex:t}};default:return{type:Hs,payload:{offerProcessStatus:"END"}}}}(n,a)))}function Bd(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:Ji,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:Ji,payload:{level:R,code:"FAILED_TO_LOAD_MODULE",message:t,additionalInformation:{stack:a,reason:t?void 0:e,moduleName:n}}}),i(l.END)})),()=>{})))}const Ud={"standard-marketing":()=>Promise.resolve().then((function(){return qu})),"add-to-cart":()=>Promise.resolve().then((function(){return Hp})),"instant-purchase":()=>Promise.resolve().then((function(){return Df})),"layouts-xp-sandbox":()=>Promise.resolve().then((function(){return py}))};function*Vd(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(zd,e,t,i))}function*zd(e,t,n){if(n in Ud){yield r.put({type:Ms,payload:n});const a=yield r.call(Bd,e,t,n,Ud[n]);yield r.call(To,a)}else yield r.put({type:Ji,payload:{level:mo,code:"INVALID_MODULE_NAME",message:`Could not load unknown module ${n}`}})}function*qd(e){const t=yield r.select((e=>Ll.getDistributionViewableItems(e.layout?Ll.getDistribution(e.layout.layoutSchema):void 0))),n=yield r.select((n=>{var a;const i=Jo(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:qs,payload:{groupSize:n}};yield r.put(e)}}const Hd=i.cond([[(e,t,n,a)=>"END"===e.offerProcessStatus,i.always({type:Fi})],[(e,t,n,a)=>t.isLastOffer&&n,i.always({type:Fi})],[(e,t,n,a)=>1===a&&!t.isLastOffer,i.always({type:Vs})],[i.T,i.always(void 0)]]);function*Wd(e){const t=yield r.select((e=>({exists:null!==e.progression,isLastOffer:sl(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=Hd(e,t,"boolean"==typeof a&&a,n);i&&(i.type===Fi&&(yield r.put({type:X,payload:{name:"PLACEMENT_COMPLETED"}})),yield r.put(i))}(e.payload,t,n))}function Jd(e){return e.type===Ks&&"Interactive"===e.payload.event}function Kd(e){return e.type===Ks&&"Interactive"!==e.payload.event}function*Yd(e){switch(e.payload.event){case"Dismissed":yield r.put({type:Hs,payload:{offerProcessStatus:"CONTINUE"}});break;case"Completed":yield r.put({type:Ys,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:Hs,payload:{offerProcessStatus:"CONTINUE"}});break;case"Interactive":yield r.put({type:V,payload:{name:"Interactive",offerPositionIndex:e.payload.offerPositionIndex}}),yield r.put({type:X,payload:{name:"PLACEMENT_INTERACTIVE"}})}}function*Zd(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,sr.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:Ji,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*Qd(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:Xs.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Fi}),t?(yield r.put({type:Y,payload:{name:"SignalInstantPurchaseDismissal",parentGuid:t}}),yield r.put({type:Y,payload:{name:"SignalDismissal",parentGuid:t}})):yield r.put({type:Ji,payload:{level:vo,code:Lo,message:"ParentGuid does not exist"}})}function*Xd(e,t){yield r.all([r.takeEvery(Ji,Ao.bind(null,e.errorService.raise)),r.takeLatest(Gi,_l.bind(null,{display:e.displayService,partner:e.partnerInteractionService})),r.takeEvery(Bs,Vd.bind(null,t,e.contextService)),r.takeLatest(Zs,Md.bind(null,{partner:e.partnerInteractionService,context:e.contextService})),r.takeEvery(Hs,Wd),r.takeEvery(Kd,Yd),Oo(Jd,Yd),r.takeLatest(ki,tr.bind(null,e.displayService)),r.takeLatest(Fi,Ir.bind(null,e.contextService)),r.takeLatest(Js,Qd),r.takeLatest(Wi,Wr),r.takeEvery(Y,Rr),r.takeEvery(te,jr),Co(V,qr.bind(null,e.metricsService)),Co(Hi,Lr.bind(null,e.rdnService)),r.takeEvery(Ki,Ar.bind(null,e.errorService.raise)),r.takeLatest(_i,qd),r.takeEvery(Q,zr),r.takeEvery(ne,Hr.bind(null,{createChildPlugin:e.childPlugin.create,partner:e.partnerInteractionService,context:e.contextService})),r.takeLatest(ae,Zd.bind(null,{partner:e.partnerInteractionService,context:e.contextService}))])}var eu,tu,nu,au,iu,ou=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},ru=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 su={[re.SET_CUSTOM_STATE]:Xs.SET_CUSTOM_STATE,[re.SET_DOMAIN_STATE]:Xs.SET_DOMAIN_STATE,[re.SET_GLOBAL_OFFER_DATA_CART]:Xs.SET_GLOBAL_OFFER_DATA_CART,[re.OFFER_LIFECYCLE]:el.OFFER_LIFECYCLE,[re.OFFER_ENGAGEMENT]:el.OFFER_ENGAGEMENT,[re.SET_PARTNER_VALIDATION_STATUS]:el.SET_PARTNER_VALIDATION_STATUS};class lu{constructor(e){eu.add(this),tu.set(this,void 0),ou(this,tu,e,"f")}getState(e){const t=ru(this,tu,"f").getState();return{breakpoint:t.breakpoint,progression:ll(t),customStates:Yo(t,e.offerPositionIndex),domainStates:cl(t,e.offerPositionIndex)}}dispatch(e,t){ru(this,tu,"f").dispatch(ru(this,eu,"m",iu).call(this,e,t))}subscribe(e,t){return t(this.getState(e)),ru(this,tu,"f").subscribe((()=>{t(this.getState(e))}))}}function cu(e,t){const n=l(),a={},i=s.configureStore({reducer:ol,devTools:{name:"Orchestrator"},preloadedState:Object.assign(Object.assign({},rl()),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 lu(e)}(i),c=e.childPlugin.create,d=e.partnerInteractionService.onEvent,(e,t)=>new dn(r,c,e,t,d));var r,c,d;n.run(Xd,e,o),n.run(Cr,e,$d);const u={};return Object.assign(Object.assign({},i),{extend:({reducer:e,interceptors:t,sagas:o})=>{e&&(Object.assign(u,e),i.replaceReducer(s.combineReducers(Object.assign(Object.assign({},ol),u)))),t&&Object.assign(a,t),o&&n.run(o)}})}tu=new WeakMap,eu=new WeakSet,nu=function(e,t,n){return{type:e,payload:Object.assign(Object.assign({},t),{offerPositionIndex:n.offerPositionIndex,creativeInstanceGuid:n.creativeInstanceGuid})}},au=function(e,t){return t.type===te?t.payload.signal.parentGuid||(t.payload.signal.parentGuid=e.creativeInstanceGuid):(t.payload.creativeInstanceGuid=e.creativeInstanceGuid,t.payload.parentGuid||(t.payload.parentGuid=e.creativeInstanceGuid)),t},iu=function(e,t){return function(e){return e.type in su}(t)?ru(this,eu,"m",nu).call(this,su[t.type],t.payload,e):t.type===Y||t.type===te?ru(this,eu,"m",au).call(this,e,t):t};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 uu={ctx:new Map([[Fs.name,Fs],[Ps.name,Ps],[gs.name,gs],[Ts.name,Ts]]),cache:[]};class pu{constructor(){this._subscribers=[]}add(e){this._subscribers.push(e)}unsubscribe(){this._subscribers.forEach((e=>e.unsubscribe()))}}const fu=()=>{},yu=(e=fu,t=fu,n=fu)=>"function"!=typeof e?e:{next:e,error:t,complete:n};class hu{constructor(e){this._setupFn=e}subscribe(e,t,n){const a=yu(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 pu;return s.add({unsubscribe:()=>{i&&i(),o=!1}}),s}}class mu extends hu{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 hu((e=>{const t=this.subscribe(e);return()=>t.unsubscribe()}))}}const vu={CompletedBeforeEmit:"CompletedBeforeEmit"};var gu=function(e,t,n,a){return new(n||(n=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((a=a.apply(e,t||[])).next())}))};class bu{constructor(e,t){this._target=e,this._handler=t}subscribe(e,t,n){const a=e.next?e.next.bind(e):e,i={next:(...e)=>gu(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 Eu{constructor(e){this.value=e,this.complete=!1,this.skip=!1}}var Iu=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 xu={getBreakpointCSSClass:B},Su="CHILD_LAYOUTS/ADD_LAUNCHED",wu="DYNAMIC_DATA/ADD";function Cu(e={launched:{}},t){if(t.type===Su){const n=t.payload;return n.childLayoutId?i.assocPath(["launched",n.childLayoutId],n.shouldRelaunch,e):e}return e}function Ou(e=null,t){return e}function Tu(e=null,t){if(t.type===wu){const n=t.payload;return e?n?i.mergeDeepRight(e,n):e:n}return e}function Au(e,t){var n;return null===(n=e.childLayouts.launched[t])||void 0===n||n}function Ru(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer}function ju(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.schemaVersion}function Lu(e){var t,n;return null!==(n=null===(t=e.dynamicData)||void 0===t?void 0:t.text)&&void 0!==n?n:{}}const Nu="FAILED_TO_LAUNCH_CHILD_LAYOUT";function*_u(e,t,n){var a;if(yield null===(a=r.select(Au,n.payload.childLayoutId))||void 0===a||a){const a=yield r.select(ju),o=yield r.select(Ru),s=yield r.select(Lu);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:Nu,message:"Could not launch child layout, failed creating plugin."})}}catch(e){yield r.call(t,{level:j,code:Nu,message:"Could not launch child layout, failed to make the child layout config serializable."})}yield r.put({type:Su,payload:{childLayoutId:n.payload.childLayoutId,shouldRelaunch:!1}})}var i}function Du(){const t=Cn(),n=a.useSelector(Lu),i=Wt()({state:n},"textContent");return e.jsx(Ht,{value:i,children:e.jsx(bt,{children:e=>e(t)})})}const ku={staticData:Ou,dynamicData:Tu,childLayouts:Cu};function Pu(e={}){return Object.assign({staticData:null,dynamicData:null,childLayouts:{launched:{}}},e)}function $u(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 Gu(e){return"object"==typeof e&&null!==e&&Object.entries(e).every((([e,t])=>"string"==typeof e&&"string"==typeof t))}function*Fu(e,t,n,a){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Z,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":if(n&&a){yield r.call(a);break}t({type:Z,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Z,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*Mu(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n,o=K(n);yield r.put({type:Y,payload:{name:"SignalResponse",parentGuid:a.instanceGuid,responseActionPayload:{name:"Fulfillment"}}});const s=yield r.call(e.createChildPlugin.bind(e),i);if("object"==typeof s&&"onClose"in s&&"close"in s){const a=yield r.call($u,s);if("object"==typeof a&&"take"in a){const i=function(e,t,n,a){if(n.responseOption.rclid)return function*(){yield r.put({type:X,payload:{name:"REALTIME_OFFER_FULFILLMENT_CONVERSION",body:{rclid:n.responseOption.rclid,accountID:n.accountID,referralCreativeID:n.referralCreativeID}}}),yield r.call(Bu,e,t,a)}}(e,t,n,s);return void(yield r.call(Fu,a,e.globalDispatch.bind(e),o,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*Bu(e,t,n){const a=function(e){return l.eventChannel((t=>{const n=e.onEvent({name:cr,source:"partner",callback:e=>{Gu(e)&&t({eventName:cr,data:e})}},{name:dr,source:"partner",callback:e=>{Gu(e)&&t({eventName:dr,data:e})}});return()=>{n()}}))}(e);try{for(;;){const i=yield r.take(a);switch(i.eventName){case cr:yield r.put({type:X,payload:{name:cr,body:i.data}}),yield r.put({type:wu,payload:{text:i.data}}),e.globalDispatch({type:Z,payload:{event:"Completed",completionReason:"Success"}}),n&&(yield r.call(n.close.bind(n)));break;case dr:e.globalDispatch({type:Z,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*Uu(e,t,n){const a=W(n.payload)||J(n.payload)||H(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":yield r.call(e.globalDispatch.bind(e),n),K(n.payload)&&(yield r.put({type:X,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:a.accountID,referralCreativeID:a.referralCreativeID}}}),yield r.call(Bu,e,t));break;case"CaptureOnly":yield r.call(e.globalDispatch.bind(e),n);break;case"Fulfillment":yield r.put({type:X,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),yield*Mu(e,t,n.payload)}}function*Vu(e,t){yield r.all([r.takeLatest(z,Uu.bind(null,e,t)),r.takeEvery(oe,_u.bind(null,e,t)),r.takeEvery("*",Io.bind(null,[z,oe],e))])}Object.assign({},re);const zu=(new En).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=Pu({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=Pu()){const a=l(),i=s.configureStore({reducer:ku,devTools:{name:"Standard Marketing"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Vu,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(kn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Oi,{}),e.jsx(a.Provider,{store:d,children:e.jsx(wi,{settings:i,dispatch:d.dispatch,children:e.jsx(Du,{})})})]})}))}}));var qu=Object.freeze({__proto__:null,moduleConnectorBuilder:zu});const Hu="CART/UPDATE",Wu="CATALOG_ITEM/RESPONSE",Ju="USER_CREATIVE_RESPONSE_HISTORY/ADD",Ku=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 Yu({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 Zu="catalogRadioGroup__label",Qu=["Enter","Space"],Xu={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 ep(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 tp({schema:n,testId:i}){const o=a.useDispatch(),r=Gn(),[s,l]=a.useSelector((e=>{var t,a;const i=r.cartItemId in e.cart?null!==(a=null===(t=e.cart[r.cartItemId])||void 0===t?void 0:t.quantity)&&void 0!==a?a:0:NaN;return[i,ep(n.validations,n.options.length,i)]})),c=Tn(),{tabIndex:d,styles:u,isDisabled:p}=m(c);t.useEffect((()=>{p||o(np(l))}),[]);const f=n.options.filter((({quantity:e})=>{var t,n;return e>=(null!==(t=r.minItemCount)&&void 0!==t?t:-1/0)&&e<=(null!==(n=r.maxItemCount)&&void 0!==n?n:1/0)}));function y(e){o({type:Wu,payload:{catalogItem:r,quantity:e}});const t=ep(n.validations,n.options.length,e);o(np(t))}return f.length>0?e.jsx(wa,{styles:n.styles?M(Xu,n.styles):Xu,children:({classnames:n,mapperRef:a})=>e.jsx("div",{className:null==n?void 0:n.own,style:Object.assign({display:"flex",flexDirection:"column"},u),children:e.jsx(Kt,{value:a(Zu),children:t.Children.toArray(f.map(((t,a)=>{var o;const l=Ku(s,t.quantity),c=e=>i?`${i}-option${a}${e}`:void 0;return e.jsxs("label",{tabIndex:d,"aria-disabled":p,style:{display:"flex"},className:`${Zu} ${null!==(o=null==n?void 0:n.optionContainer)&&void 0!==o?o:""}`,onKeyDown:e=>{l||!Qu.includes(e.code)||p||y(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:r.instanceGuid,value:t.quantity,checked:l,onChange:()=>y(t.quantity),"aria-disabled":p,disabled:p}),e.jsx(Yu,{isChecked:l,isDisabled:p,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(ji,{schema:t,testId:c("Content")})]})})))})})}):null}function np(e){return{type:ae,payload:{errors:e}}}function ap(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function ip(t){const n=a.useDispatch(),i=Et(),o=Gn(),r=Tn(),{tabIndex:s,styles:l,isDisabled:c}=m(r);return e.jsx(wa,{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:Wu,payload:{catalogItem:o,quantity:1}})},className:null==a?void 0:a.own,children:ap(t.schema.children,i,t.testId)})})}const op={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"]},rp=new Map([["&","_;^;_"]]),sp=new RegExp(`<a *(?=${op.allowedAttributes.a.join("|")}|>)`,"g"),lp=new RegExp(`<a *(?:(?:${op.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),cp=new RegExp("(<br *?>)|(<br *?/>)","g"),dp=new RegExp(`<ul *(?=${op.allowedAttributes.ul.join("|")}|>)`,"g"),up=new RegExp(`<ol *(?=${op.allowedAttributes.ol.join("|")}|>)`,"g"),pp=new RegExp("<li *(?=>|\\s[^>]*>)","g"),fp="<br/>";function yp(n){const a=Wt(),i=Tn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(lp,((e,t)=>{const n=t.replaceAll("&",rp.get("&"));return e.replace(t,n)})).replaceAll(cp,fp)}(e);return t===u(t,op)}(e))throw new L("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(wa,{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(sp,`<a ${a.join(" ")}`).replace(dp,`<ul ${i}`).replace(up,`<ol ${i}`).replace(pp,`<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 hp={internally:"_top",externally:"_blank"};function mp(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:vp(t,i,o)})}function vp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function gp(t){var n,i;const o=hp[t.schema.open],r=Et(),s=Gn(),l=Tn(),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(wa,{styles:t.schema.styles,children:({classnames:n,mapperRef:a})=>{var i;return e.jsx("a",{href:d,onClick:()=>{var e;c({type:Y,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)?mp(t.schema.children,null==n?void 0:n.own,a,r,t.testId):vp(t.schema.children,r,t.testId)})}}):null}function bp(e,t){const n=e.cart[t];return n||null}function Ep(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 Ip(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 Ep(e).reduce(((e,t)=>e+t.quantity),0)}(e),s=bp(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 xp(e){var t,n;const a=null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[];return a.length>0?a:null}function Sp(e,t){var n,a;return null!==(a=null===(n=xp(e))||void 0===n?void 0:n.find((e=>e.catalogItemId===t)))&&void 0!==a?a:null}function wp(e){var t;const n=null===(t=xp(e))||void 0===t?void 0:t.filter((e=>e.preSelectedQuantity&&e.preSelectedQuantity>0));return n&&n.length>0?n:null}function Cp(e){var t,n;return null!==(n=null===(t=wp(e))||void 0===t?void 0:t.reduce(((e,t)=>{var n;return e+(null!==(n=t.preSelectedQuantity)&&void 0!==n?n:0)}),0))&&void 0!==n?n:0}const Op=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 Tp(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:i(t,void 0,o)})}function Ap(e,t,n){return t(e,void 0,n)}function Rp(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=Gn(),g=Et(),b=Wt(),E=Tn(),{tabIndex:I,styles:x,isDisabled:S}=m(E),w=a.useSelector((e=>function(e,t){var n,a,i;const o=Sp(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))),C=a.useSelector((e=>bp(e,v.cartItemId))),O=a.useSelector((e=>Ip(e,v))),T=(null==C?void 0:C.quantity)||0,A=m(S||T<=(null!==(n=v.minItemCount)&&void 0!==n?n:0)?"DISABLED":E),R=m(S||O<=0?"DISABLED":E),j=m(S||w?"DISABLED":E),L=e=>{var t;const n=e.target.value;if(0===n.length)N(null!==(t=v.minItemCount)&&void 0!==t?t:0);else{const e=Number(n);!Number.isNaN(e)&&e>=0&&N(e)}},N=e=>{S||h({type:Wu,payload:{catalogItem:v,quantity:e}})};return e.jsx(wa,{styles:s,children:({classnames:t,mapperRef:n})=>e.jsx("div",{className:null==t?void 0:t.own,style:Object.assign({display:"flex",flexDirection:"row"},x),children:w&&d?e.jsx(Da,{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(),N(T-1)},tabIndex:A.tabIndex,"aria-label":y||void 0,disabled:A.isDisabled,"data-testid":o?`${o}-decrement-button`:void 0,children:e.jsx(Ht,{value:b,children:(null==t?void 0:t.decrementButton)?Tp(p,t.decrementButton,n,g,o):Ap(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:L,"aria-label":r||void 0,tabIndex:I,disabled:S,"data-testid":o?`${o}-input`:void 0}):e.jsx("p",{className:null==t?void 0:t.input,style:x,"data-testid":o?`${o}-quantity-text`:void 0,children:T}),u?e.jsx("button",{className:null==t?void 0:t.incrementButton,style:Object.assign(Object.assign({},R.styles),{cursor:R.isDisabled?"not-allowed":"pointer",pointerEvents:"auto"}),onClick:e=>{e.preventDefault(),N(T+1)},tabIndex:R.tabIndex,"aria-label":f||void 0,disabled:R.isDisabled,"data-testid":o?`${o}-increment-button`:void 0,children:e.jsx(Ht,{value:b,children:(null==t?void 0:t.incrementButton)?Tp(u,t.incrementButton,n,g,o):Ap(u,g,o)})}):null]})})})}const jp={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(ip,{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(yp,{schema:n.node});case"CatalogUrlLink":return e.jsx(gp,{schema:n.node});default:return}}},CatalogRadioGroup:function(t){if("CatalogRadioGroup"===t.type)return e.jsx(tp,{schema:t.node})},CatalogQuantityCounter:function(t){if("CatalogQuantityCounter"===t.type)return e.jsx(Rp,{schema:t.node})}};function Lp(){const t=Cn(),n=Et();return e.jsx(It,{value:n,overrides:jp,children:e.jsx(bt,{children:e=>e(t)})})}const Np={cart:function(e={},t){if(t.type===Hu){const{catalogItem:n,quantity:a}=t.payload,i=n.cartItemId,o=xo(n,a);return Object.assign(Object.assign({},e),{[i]:o})}return e},userCreativeResponseHistory:function(e=[],t){return t.type===Ju?e.concat(t.payload.responseId):e},staticData:Ou,childLayouts:Cu};const _p="INVALID_PARTNER_MESSAGE",Dp="MISCONFIGURED_CATALOG_ITEM",kp="FAILED_TO_PROCESS_PARTNER_UPDATE_CART_ITEM";function*Pp(e){var t,n;const a=yield r.select(wp),i=yield r.select(Cp),o=yield r.select((e=>{var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer.maxTotalItemsQtyInOffer}));if(Bp(i)&&Bp(o)&&i>o)yield r.call(e,{level:j,code:Dp,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:Dp,message:`Preselected quantity (${a}) is greater than maxItemCount (${o}) for catalog item (${i.instanceGuid})`}):yield*Mp(i,a,!0)}}function*$p(e,t,n){const{catalogItem:a,quantity:i}=n.payload;if(yield*Mp(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*Gp(e,t){const n=function(e,t){return l.eventChannel((n=>{const a=e.onEvent({name:or.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:_p,message:`Invalid UpdateCartItemPartnerMessageBody: ${JSON.stringify(e)}`}):n(e)}});return()=>{a()}}))}(e,t);try{for(;;){const e=yield r.take(n);yield r.call(Fp,e,t)}}catch(e){const n=e;t({level:j,code:kp,message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&n.close()}}function*Fp(e,t){const{cartItemId:n,quantity:a}=e,i=yield r.select(bp,n);if(Up(i)){const e=yield r.select(Sp,i.catalogItemId);null!==(o=e)&&"object"==typeof o&&"catalogItemId"in o&&"price"in o?yield*Mp(e,a,!1):yield r.call(t,{level:j,code:kp,message:`Catalog item not found for cart item id (${n})`})}else yield r.call(t,{level:j,code:kp,message:`Cart item not found for cart item id (${n})`});var o}function*Mp(e,t,n){var a;const i=yield r.select(bp,e.cartItemId),o=yield r.select(Ip,e),s=Bp(o)?o:0,l=Up(i)?i.quantity:0;if(t!==l&&t>=(null!==(a=e.minItemCount)&&void 0!==a?a:0)&&t-l<=s){yield r.put({type:Hu,payload:{catalogItem:e,quantity:t}});const a=yield r.select(bp,e.cartItemId),o=yield r.select(Op);return yield r.put({type:ie,payload:{cart:o}}),yield r.put({type:Y,payload:{name:"SignalCartItemQuantitySelected",parentGuid:e.instanceGuid,objectData:{quantity:t,preselected:n}}}),yield r.put({type:X,payload:{name:"V2_CART_ITEM_UPDATED",body:{oldCartItem:i,cartItem:a}}}),!0}return!1}function Bp(e){return"number"==typeof e}function Up(e){return null!=e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&"unitPrice"in e}function*Vp(e,t){var n;yield r.put({type:Ju,payload:{responseId:(n=t.payload,q(n)?n.responseOption.id:n.id)}}),yield r.call(e.globalDispatch.bind(e),t)}function*zp(e,t){yield r.all([r.spawn(Pp.bind(null,t)),r.spawn(Gp.bind(null,e,t)),r.takeLatest(Wu,$p.bind(null,e,t)),r.takeLatest(z,Vp.bind(null,e)),r.takeEvery(oe,_u.bind(null,e,t)),r.takeEvery("*",Io.bind(null,[z,oe],e))])}Object.assign(Object.assign({},re),{CATALOG_ITEM_RESPONSE:Wu});const qp=(new En).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=function(e={}){return Object.assign({cart:{},userCreativeResponseHistory:[],staticData:null,childLayouts:{launched:{}}},e)}({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n){const a=l(),i=s.configureStore({reducer:Np,devTools:{name:"Add To Cart"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(zp,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(kn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Oi,{}),e.jsx(a.Provider,{store:d,children:e.jsx(wi,{settings:i,dispatch:d.dispatch,children:e.jsx(Lp,{})})})]})}))}}));var Hp=Object.freeze({__proto__:null,moduleConnectorBuilder:qp});const Wp="CATALOG/TRIGGER_SELECT_ITEM",Jp="CATALOG/SET_SELECTED_ITEM",Kp="CHECKOUT_LIFECYCLE",Yp="INSTANT_PURCHASE/INITIATE",Zp="INSTANT_PURCHASE/PARTNER_RESPONSE";function Qp(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:Xp(t,i,o)})}function Xp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function ef(t){const n=a.useDispatch(),i=Et(),o=Tn(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=Gn(),d=Ut(c,"catalogItem");return e.jsx(wa,{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:Yp,payload:{catalogItem:c,quantity:1}})},className:null==a?void 0:a.own,children:e.jsx(Ht,{value:d,children:(null==a?void 0:a.own)?Qp(t.schema.children,a.own,o,i,t.testId):Xp(t.schema.children,i,t.testId)})})})}function tf(n){const a=Tn(),i=ht(),{customStateKey:o,customStateValue:r}=n.schema,{tabIndex:s,styles:l,isDisabled:c}=m(a),d=()=>{i({type:Q,payload:{key:o,value:r}})};return e.jsx(wa,{styles:n.schema.styles,children:({classnames:a})=>{var i;return e.jsx("button",{className:null==a?void 0:a.own,onClick:d,"data-testid":n.testId,"data-e2e":"ButtonStateTrigger",disabled:c,"aria-disabled":c,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:void 0,tabIndex:s,style:Object.assign({backgroundColor:"transparent",cursor:"pointer",margin:0,padding:0},l),children:e.jsx(bt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}function nf(n){const i=Et(),o=_n(),r=Wt(),s=ht(),l=Ot().catalogItems||[],c=a.useSelector((e=>e.selectedItem))||l[0];return t.useEffect((()=>{c&&s({type:Y,payload:{name:"SignalImpression",parentGuid:null==c?void 0:c.instanceGuid}})}),[c,s]),c?e.jsx(wa,{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($n,{context:c,children:e.jsx(Nn,{value:o(c),children:e.jsx(Ht,{value:(s=c,r({data:s},"catalogItem")),children:i(n.schema.template,void 0,n.testId?`${n.testId}-child`:"")})})}))});var s}}):null}function af(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:i(t,void 0,o)})}function of(e,t,n){return t(e,void 0,n)}const rf=["ArrowDown","ArrowUp","Enter","Escape","Tab"];function sf(n){const i=Ot(),o=Et(),r=Gn(),s=Wt(),l=e=>s({data:e},"catalogItem"),c=t.useMemo((()=>i.catalogItems||[]),[i]),d=Tn(),{styles:u,isDisabled:p}=m(d),f=t.useRef(null),y=t.useRef([]),[h,v]=t.useState(!1),[g,b]=t.useState(0),E=a.useDispatch();function I(){p||(h?S():x())}function x(){p||v(!0)}function S(){p||v(!1)}function w(e){b(c.indexOf(e)),S(),E({type:Wp,payload:{catalogItem:e}})}t.useEffect((()=>{if(h){const e=y.current[g];e&&e.focus()}}),[h,g]);const C={elements:{own:[{default:{background:{backgroundColor:{light:"#ffffff"}},dimension:{width:{type:"percentage",value:100}}}}]}};function O(e){if(!p&&rf.includes(e.key))switch(e.key){case"ArrowDown":{e.preventDefault();const t=g+1;t<c.length&&b(t);break}case"ArrowUp":{e.preventDefault();const t=g-1;t>=0&&b(t);break}case"Enter":if(e.preventDefault(),h){const e=c[g];e&&w(e)}else x();break;case"Tab":if(h){S();const e=c.indexOf(r);-1!==e&&b(e)}break;case"Escape":if(e.preventDefault(),h){S();const e=c.indexOf(r);-1!==e&&b(e)}}}return e.jsx(wa,{styles:n.schema.styles?M(C,n.schema.styles):C,children:({classnames:t,mapperRef:a})=>e.jsxs("div",{ref:f,className:null==t?void 0:t.own,onKeyDown:O,onClick:I,onBlur:e=>{var t;(null===(t=f.current)||void 0===t?void 0:t.contains(e.relatedTarget))||h&&S()},"data-e2e":"DropDown","data-testid":n.testId?`${n.testId}-drop-down-container`:void 0,"aria-disabled":p,style:Object.assign({position:"relative"},u),tabIndex:0,children:[e.jsx("div",{className:null==t?void 0:t.dropDownSelectedElement,"aria-disabled":p,"data-testid":n.testId?`${n.testId}-drop-down-selected-element`:void 0,style:Object.assign({cursor:"pointer"},u),children:e.jsx(Ht,{value:l(r),children:(null==t?void 0:t.dropDownSelectedElement)?af(n.schema.closedTemplate,t.dropDownSelectedElement,a,o,n.testId):of(n.schema.closedTemplate,o,n.testId)})}),h&&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"},u),children:c.map(((i,r)=>e.jsx("li",{ref:e=>function(e,t){y.current[t]=e}(e,r),className:null==t?void 0:t.dropDownListElement,onClick:e=>{e.stopPropagation(),p||w(i)},tabIndex:-1,"data-e2e":"DropDownItem","data-testid":n.testId?`${n.testId}-drop-down-item-${r}`:void 0,style:Object.assign({cursor:"pointer",display:"flex"},u),children:e.jsx(Ht,{value:l(i),children:(null==t?void 0:t.dropDownListElement)?af(n.schema.openTemplate,t.dropDownListElement,a,o,n.testId):of(n.schema.openTemplate,o,n.testId)})},i.catalogItemId)))})]})})}function lf(n){const i=n.schema.styles,o=a.useDispatch(),r=a.useSelector((e=>e.staticData)),s=Tn(),{tabIndex:l,styles:c,isDisabled:d}=m(s),u=()=>{var e;o({type:Kp,payload:{event:"Checkout",targetStep:n.schema.targetStep,offerPositionIndex:null!==(e=null==r?void 0:r.position)&&void 0!==e?e:0}})};return e.jsx(wa,{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(bt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,U(a,n.testId)))))})})}})}const cf=/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/;function df(t){const n=Wt(),a=Tn(),{schema:i,testId:o}=t,r=n(i.value),{tabIndex:s,styles:l,isDisabled:c}=m(a);return"string"==typeof(d=r)&&cf.test(d)?e.jsx(wa,{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 uf(n){const{schema:{imageKeys:a,styles:i},testId:o}=n,[r,s]=t.useState(0),l=Tn(),c=function(e){const n=t.useContext(Ln);return e.reduce(((e,t)=>{const a=n(`${t}.src`,"copy"),i=n(`${t}.title`,"copy");return void 0===a?e:[...e,C({light:a,title:i})]}),[])}(a),{styles:d,isDisabled:u,tabIndex:p}=m(l),f=c[r]||c[0];return c.length>0&&f?e.jsx(wa,{styles:i,children:({classnames:n})=>e.jsxs("div",{className:null==n?void 0:n.own,children:[e.jsx("img",{"aria-hidden":u,src:f.light,alt:f.alt,title:f.title,className:null==n?void 0:n.mainImage,style:d,"data-testid":`${o}-main-image`,"data-e2e":"ImageGallery-mainImage"}),e.jsx("div",{className:null==n?void 0:n.thumbnailList,style:Object.assign(Object.assign({},d),{display:"flex"}),children:t.Children.toArray(c.map(((t,a)=>e.jsx("img",{src:t.light,alt:t.alt,title:t.title,className:null==n?void 0:n.thumbnailImage,style:Object.assign(Object.assign({},d),{cursor:u?"not-allowed":"pointer",pointerEvents:"auto"}),"data-testid":`${o}-thumbnail-${a}`,"data-e2e":"ImageGallery-thumbnail",tabIndex:p,onClick:()=>s(a)}))))})]})}):null}const pf={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(ef,{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"ButtonStateTrigger":return e.jsx(tf,{schema:n.node});case"CatalogCombinedCollection":return e.jsx(nf,{schema:n.node});case"CatalogDropDown":return e.jsx(sf,{schema:n.node});case"CheckoutStateButtonTrigger":return e.jsx(lf,{schema:n.node});case"ColorSwatch":return e.jsx(df,{schema:n.node});case"ImageGallery":return e.jsx(uf,{schema:n.node});default:return}}}};function ff(){const t=Cn(),n=Et(),i=a.useSelector(Lu),o=Wt()({state:i},"textContent");return e.jsx(It,{value:n,overrides:pf,children:e.jsx(Ht,{value:o,children:e.jsx(bt,{children:e=>e(t)})})})}const yf={staticData:Ou,selectedItem:(e=null,t)=>t.type===Jp?t.payload:e,dynamicData:Tu,childLayouts:Cu};function hf(e={}){return Object.assign({staticData:null,selectedItem:null,dynamicData:null,childLayouts:{launched:{}}},e)}const mf="INVALID_RESPONSE_OBJECT";function vf(e,t){return l.eventChannel((n=>e.onEvent({name:rr.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_PARTNER_DATA",message:`Malformed data received from partner\n ${e}`})}})))}function*gf(e,t){var n;try{for(;;){const t=yield r.take(e);t&&(yield r.put({type:Zp,payload:t}))}}catch(e){yield r.call(t,{level:j,code:"INSTANT_PURCHASE_CHANNEL_ERROR",message:null!==(n=e.message)&&void 0!==n?n:"Unknown error in instant-purchase channel"})}finally{e.close()}}function bf(e){const t=function(e){var t,n;return null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[]}(e);return t[0]}const Ef="Unknown failure reason";function*If(){const e=yield r.select(bf);e&&(yield*Of(e))}function*xf(e){const{catalogItem:t}=e.payload;yield*Of(t)}function*Sf(e,t,n){const{catalogItem:a,quantity:i}=n.payload,o=xo(a,i);o?(yield r.put({type:Y,payload:{name:"SignalCartItemInstantPurchaseInitiated",parentGuid:a.instanceGuid,objectData:{catalogItemId:a.catalogItemId,quantity:i}}}),yield r.fork(Cf,e,t),yield r.put({type:X,payload:{name:"CART_ITEM_INSTANT_PURCHASE",body:{upsellItems:[o],totalUpsellPrice:o.totalPrice||0,currency:o.currency}}})):yield r.call(t,{level:j,code:mf,message:`Unable to translate catalog item with ID ${a.catalogItemId} to cart item for instant purchase transaction.`})}function*wf(e,t){const n=yield r.select((e=>e.staticData));if(!n)return yield r.call(e,{level:j,code:"MISSING_STATIC_DATA_IN_INSTANT_PURCHASE_MODULE",message:"App state is not configured with static data."}),void(yield*Rf("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*Rf("Error"));const a={accountId:n.offer.accountId,catalogItems:n.offer.catalogItems};let i,o;t.payload.success?(i=Tf,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||Ef,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=Af(a,t.catalogItems);void 0===e?i.push(a):yield r.put({type:Y,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:mf,message:`Unable to map cart items to catalog items in the instant purchase partner response: ${n}.`})}(i,a))}(t.payload,a,i,e),yield*Rf(o)}function*Cf(e,t){const n=vf(e,t),{timeout:a}=yield r.race({channelListener:r.call(gf,n,t),timeout:r.delay(6e4)});a&&(yield r.call(t,{level:j,code:"INSTANT_PURCHASE_RESPONSE_TIMEOUT",message:"Instant-purchase response timed out after 60000ms"}),n.close(),yield r.put({type:Z,payload:{event:"Dismissed",dismissalReason:"Implicit"}}))}function*Of(e){var t,n,a;yield r.put({type:Jp,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:wu,payload:{text:i}})}function Tf(e,t){return{name:"SignalCartItemInstantPurchase",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,initiatedBy:T.DCUI}}}function Af(e,t){return t.find((t=>t.catalogItemId===e.catalogItemId))}function*Rf(e){yield r.put({type:Z,payload:{event:"Completed",completionReason:e}})}function*jf(e){"Checkout"===e.payload.event&&(yield r.put({type:ee,payload:{key:"checkout",value:Lf(e.payload),offerPositionIndex:e.payload.offerPositionIndex}}))}function Lf(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*Nf(e,t){yield r.all([r.spawn(If),r.takeEvery(Kp,jf),r.takeEvery(Wp,xf),r.takeLatest(Yp,Sf.bind(null,e,t)),r.takeLatest(Zp,wf.bind(null,t)),r.takeEvery(oe,_u.bind(null,e,t)),r.takeEvery("*",Io.bind(null,[z,oe],e))])}Object.assign(Object.assign({},re),{INITIATE_INSTANT_PURCHASE:Yp,INSTANT_PURCHASE_PARTNER_RESPONSE:Zp});const _f=(new En).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=hf({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=hf()){const a=l(),i=s.configureStore({reducer:yf,devTools:{name:"Instant Purchase"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Nf,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(kn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Oi,{}),e.jsx(a.Provider,{store:d,children:e.jsx(wi,{settings:i,dispatch:d.dispatch,children:e.jsx(ff,{})})})]})}))}}));var Df=Object.freeze({__proto__:null,moduleConnectorBuilder:_f});const kf=t.createContext(null),Pf=({children:n})=>{var a;const[i,o]=t.useState([]),[r,s]=t.useState(0),[l,c]=t.useState(0),d=Wt();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(kf.Provider,{value:{images:i,activeIndex:r,duration:l,setImages:o,setActiveIndex:s,setDuration:c},children:e.jsx(Ht,{value:d({data:{"image.title":null===(a=i[r])||void 0===a?void 0:a.title}},"creativeCopy"),children:n})})};function $f({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 Gf(e){const n=t.useContext(Ln),a=[];return e.forEach((e=>{const t=n(`${e}.src`,"copy"),i=n(`${e}.title`,"copy");if(void 0===t)return;const o=C({light:t,title:i});a.push(o)})),a}function Ff({schema:n,testId:a}){const i=JSON.parse(n.data),{styles:o,duration:r,imageKeys:s}=i,l=t.useContext(kf),c=Gf(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($f,{duration:r,active:n===(null==l?void 0:l.activeIndex),containerStyles:o.elements.indicatorContainer,indicatorStyles:o.elements.indicator}))))})]})}const Mf={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"]},Bf=new Map([["&","_;^;_"]]),Uf=new RegExp(`<a *(?=${Mf.allowedAttributes.a.join("|")}|>)`,"g"),Vf=new RegExp("<span*>","g"),zf=new RegExp(`<a *(?:(?:${Mf.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),qf=new RegExp("(<br *?>)|(<br *?/>)","g"),Hf="<br/>";function Wf(n){const a=Wt(),i=Tn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(zf,((e,t)=>{const n=t.replaceAll("&",Bf.get("&"));return e.replace(t,n)})).replaceAll(qf,Hf)}(e);return t===u(t,Mf)}(e))throw new L("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(wa,{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(Uf,`<a ${a.join(" ")}`).replace(Vf,`<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(Uf,`<a ${a.join(" ")}`).replace(Vf,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}});var i}}):null}function Jf({schema:n}){const a=Et(),i=ct(Mn(),Xt()),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 Ps={name:"loading-extension",componentFactory:e=>t.createElement(ks,{data:e}),interceptors:{}},$s=1e3;function Gs(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()/$s,o=t.useRef(null),r=()=>{const t=(new Date).getTime()/$s;a(Math.max(Math.floor(e-(t-i)),0))};return t.useEffect((()=>(o.current=setInterval(r,$s),()=>{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,$s)}}}((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:Y,payload:{name:"SignalUserInteraction",action:"TimerExpired",context:"TimerProgression"}}),d({type:"PROGRESSION/PROCESS",payload:{offerProcessStatus:"CONTINUE"}}))}),[o,r]);const u=Tn(),{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 Fs={name:"timer-progression-extension",componentFactory:e=>t.createElement(Gs,{data:e}),interceptors:{}},Ms="MODULE/ADD_LOADED",Bs="MODULE/LOAD",Us="PROGRESSION/INITIALISE",Vs="PROGRESSION/NEXT",zs="PROGRESSION/PREV",qs="PROGRESSION/UPDATE_GROUP_SIZE",Hs="PROGRESSION/PROCESS",Ws="SLOTS/SET",Js="INSTANT_PURCHASE/DISMISS",Ks="OFFER_LIFECYCLE",Ys="DOMAIN_STATES/SET",Zs="OFFER_ENGAGEMENT",Qs="GLOBAL_OFFER_DATA_STATE/SET_CART",Xs=Object.assign(Object.assign({},Zi),{NEXT_IN_PROGRESSION:Vs,PREV_IN_PROGRESSION:zs,INITIALISE_PROGRESSION:Us,UPDATE_GROUP_SIZE:qs,SET_SLOTS:Ws,ADD_LOADED_MODULE:Ms,SET_DOMAIN_STATE:Ys,SET_GLOBAL_OFFER_DATA_CART:Qs}),el=Object.assign(Object.assign({},Qi),{LOAD_MODULES:Bs,DISMISS_INSTANT_PURCHASE:Js,PROCESS_PROGRESSION:Hs,OFFER_LIFECYCLE:Ks,OFFER_ENGAGEMENT:Zs,SET_PARTNER_VALIDATION_STATUS:ae});function tl(e,t){return t<=0||e<=0||t>e?0:Math.ceil(e/t)}function nl(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<tl(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 al=Symbol("root");function il(){return{[al]:{}}}const ol=Object.assign({progression:function(e=null,t){switch(t.type){case Us:if(function(e){const{totalCount:t,currentGroupIndex:n,groupSize:a}=e;return t>=0&&a>=0&&n>=0&&a<=t&&n<tl(t,a)}(t.payload)){const{totalCount:e,_:n,groupSize:a}=t.payload;return Object.assign(Object.assign({},t.payload),{indexGroups:nl(e,a)})}return null;case qs:{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:nl(a,n),currentGroupIndex:0}):null}case Vs:{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,tl(t,n)-1)}):null}case zs:{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===Ws?t.payload:e},module:function(e={loadedModules:[]},t){return t.type===Ms?Object.assign(Object.assign({},e),{loadedModules:[...e.loadedModules,t.payload]}):e},domainStates:function(e=il(),t){if(t.type===Ys){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:al;return n===al?e:Object.assign(Object.assign({},i.assocPath([n,t.payload.key],Number(t.payload.value),e)),{[al]:{}})}return e}return e},globalOfferDataState:function(e={},t){if(t.type===Qs){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}},er);function rl(e={}){return Object.assign(Object.assign(Object.assign({},function(e={}){return Object.assign({layout:Vo(),breakpoint:{breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},active:zo(),fonts:[],signal:{queue:[],processed:[]},serializableCache:Xo(),settings:{closeOnComplete:!0},customStates:{root:{}}},e)}(e)),{progression:null,slots:[],module:{loadedModules:[]},domainStates:il(),globalOfferDataState:{}}),e)}function sl(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 ll(e){return e.progression?{activeGroupIndex:e.progression.currentGroupIndex,totalOffers:e.progression.totalCount,totalGroups:tl(e.progression.totalCount,e.progression.groupSize),isLast:sl(e)}:null}function cl(e,t){return e.domainStates[`module${t}`]||{offerComplete:0,checkout:0}}function dl(e){return Object.values(e.globalOfferDataState).reduce(((e,t)=>t.cart?e+t.cart.reduce(((e,t)=>e+t.quantity),0):e),0)}function ul(n){var i;const{config:o,position:r,visible:s,container:l,testId:c}=n,d=Mn(),u=Tn(),p=a.useSelector(qo),f=t.useContext(Bn),y=`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(y,{style:{display:"flex",flexDirection:"column"===l?"column":"row",width:"100%"},slotInstanceGuid:o.instanceGuid,layoutSchema:JSON.stringify(o.layoutVariant.layoutVariantSchema),schemaVersion:f,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}`,"aria-hidden":!s,"module-component":!0,"plugin-id":d,"active-breakpoint":B(p)})]})}function pl({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=Tn(),{tabIndex:d,isDisabled:u,styles:p}=m(c);return r.length&&r[l]?e.jsx(wa,{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(Ri,{effect:n.transition,visible:a===l,parentElement:s.current,children:e.jsx(ul,{config:t,position:a,visible:a===l,container:"column"})}))))})}):null}const fl=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=tl(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=Tn(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=Array(a).fill(i.indicator);return a>0&&(u=a+n-1,(d=t)>=n&&d<=u)?e.jsx(qt,{children:a=>e.jsx(wa,{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 yl="partnerValidationUI",hl="stackedViewableItems";function ml(n){var o;const r=a.useDispatch(),s=a.useSelector((e=>e.slots)),l=null!==(o=n.schema.viewableItems)&&void 0!==o?o:[],c=ya(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:Ui,payload:{key:hl,value:String(d)}})}),[d]);const u=s.slice(0,d),p=Tn(),{tabIndex:f,isDisabled:y,styles:h}=m(p);return(null==u?void 0:u.length)>0?e.jsx(wa,{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(ul,{config:t,position:n,visible:!0,container:"column"}))))})}):null}function vl(n){const i=n.schema.styles,o=a.useDispatch(),r=Tn(),s="Backward"===n.schema.direction?"Previous":"Next",{tabIndex:l,styles:c,isDisabled:d}=m(r),u=()=>{o({type:"Backward"===n.schema.direction?Xs.PREV_IN_PROGRESSION:Xs.NEXT_IN_PROGRESSION})};return e.jsx(wa,{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(bt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}function gl({schema:n,testId:i}){var o,r,s,l,c,u,p,f,y;const 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)),E=a.useSelector(Ko),I=n.viewableItems.length-1,[x,S]=d({slidesToScroll:null!==(r=n.viewableItems[Math.min(E,I)])&&void 0!==r?r:"auto",containScroll:"trimSnaps"}),w=a.useDispatch(),C=Tn(),{tabIndex:O,isDisabled:T,styles:A}=m(C),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[E])||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?w({type:Xs.NEXT_IN_PROGRESSION}):a<i&&w({type:Xs.PREV_IN_PROGRESSION}))}return null!=g&&(null==S||S.on("select",e),null==S||S.scrollTo(g)),()=>{null==S||S.off("select",e)}}),[S,g,w]);const j={overflow:"hidden"},L={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:R,alignItems:"stretch"},N=e=>{var t;return null!==(t=null==v?void 0:v.includes(e))&&void 0!==t&&t},_=n.peekThroughSize[Math.min(E,n.peekThroughSize.length-1)],D=_?"Fixed"===(k=_).type?`${k.value}px`:`${k.value}%`:"0px";var k;const P=null!==(y=n.viewableItems[Math.min(I,E)])&&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(wa,{styles:n.styles,children:({classnames:n})=>e.jsx("div",{ref:x,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:L,"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(ul,{config:t,position:n,container:"row",visible:N(n)})}))))})})}):null}function bl({schema:n,testId:i}){const o=Mn(),r=t.useMemo((()=>ct(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)||[]).map((t=>t.map((t=>e.slots[t])).filter((e=>null!=e))))})),c=t.useRef(null),d=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})),u=Tn(),{tabIndex:p,isDisabled:f,styles:y}=m(u);return l.length?e.jsx(wa,{styles:n.styles,children:({classnames:a})=>e.jsx("div",{ref:c,"data-testid":i,"data-e2e":"GroupedDistribution","aria-disabled":f,tabIndex:p,style:Object.assign({position:"relative",transition:`height ${n.transition.settings.duration/2}ms ease-in-out`,overflow:"hidden",boxSizing:"content-box"},y),children:t.Children.toArray(l.map(((o,l)=>e.jsx(Ri,{effect:n.transition,visible:l===d,parentElement:c.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(ul,{config:t,position:a,visible:l===d,container:"column",testId:i?`${i}-child${a}`:void 0})})))}))))})}):null}const El={action:{CaptureOnly:"CaptureOnly",Url:"Url",Fulfillment:"Fulfillment",External:"External"},urlBehavior:{newTab:"newTab",roktWebViewSDK:"roktWebViewSDK",self:"self"},signalType:{SignalResponse:"SignalResponse",SignalGatedResponse:"SignalGatedResponse",SignalSecondaryResponse:"SignalSecondaryResponse"},conversionType:{Default:"Default",RealTime:"RealTime"}};function Il(e,t,n=!1){return Error(`Could not translate ${e} with guid: ${t}${n?" for child layout":""}`)}function xl(e,t=!1){var n;try{if(e.responseOptionsMap||t)return Object.assign(Object.assign({},e),{responseOptionsMap:i.mapObjIndexed(Sl,null!==(n=e.responseOptionsMap)&&void 0!==n?n:{})});{const t=`Creative: ${e.instanceGuid}, did not receive a valid response options map.`;throw new L("NO_CREATIVE_RESPONSE_OPTIONS_MAP",t)}}catch(n){throw n.message?n:Il("Creative",e.instanceGuid,t)}}function Sl(e){try{let t,n;e.urlBehavior&&(t=El.urlBehavior[e.urlBehavior]),e.conversionType&&(n=El.conversionType[e.conversionType]);return Object.assign(Object.assign({},e),{urlBehavior:t,action:El.action[e.action],signalType:El.signalType[e.signalType],conversionType:n})}catch(t){throw t.message?t:Il("CreativeResponse",e.instanceGuid)}}function wl(e,t,n){try{return JSON.parse(e)}catch(e){throw Error(`Parse JSON failed, invalid JSON file for ${t} with guid ${n}.`)}}function Cl(){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 Ol={OneByOneDistribution:function(t){if("OneByOneDistribution"===t.type)return e.jsx(pl,{schema:t.node})},StackedDistribution:function(t){if("StackedDistribution"===t.type)return e.jsx(ml,{schema:t.node})},ProgressIndicator:function(t){if("ProgressIndicator"===t.type)return e.jsx(fl,{schema:t.node})},ProgressControl:function(t){if("ProgressControl"===t.type)return e.jsx(vl,{schema:t.node})},Overlay:function(t){if("Overlay"===t.type)return e.jsx(so,{schema:t.node})},CloseButton:function(t){if("CloseButton"===t.type)return e.jsx(to,{schema:t.node})},EscapeHatch:(Tl=[function(t,n){if(v("CloseButton",t)){const n=JSON.parse(t.node.data);return e.jsx(to,{schema:n.node,action:n.action})}},ui],e=>Tl.reduce(((t,n)=>void 0===t?n(e):t),void 0)),CarouselDistribution:function(t){if("CarouselDistribution"===t.type)return e.jsx(gl,{schema:t.node})},GroupedDistribution:function(t){if("GroupedDistribution"===t.type)return e.jsx(bl,{schema:t.node})},BottomSheet:function(t){if("BottomSheet"===t.type)return e.jsx(po,{schema:t.node})}};var Tl;function Al(e,t){e({type:Y,payload:{name:"SignalActivation",parentGuid:t}})}function Rl({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:ll(e),customStates:e.customStates.root,domainStates:e.domainStates[al]})),i.equals),y=a.useSelector((e=>e.slots.length)),h=a.useSelector((e=>{var t;const n=Number(null!==(t=e.serializableCache.get(hl))&&void 0!==t?t:"");return y-n})),m=a.useSelector(dl);ce(St(),p),t.useEffect((()=>(u&&document.body.addEventListener("click",Al.bind(null,p,u.instanceGuid),{once:!0}),()=>{u&&document.body.removeEventListener("click",Al.bind(null,p,u.instanceGuid))})),[null==u?void 0:u.instanceGuid]),Cl(),t.useEffect((()=>{if(u){const e={type:Y,payload:{name:"SignalImpression",parentGuid:u.instanceGuid}},t={type:Ki,payload:{code:"LAYOUT_IMPRESSED"}};p(e),p(t)}}),[u]);const v=e=>{p({type:el.REPORT_ERROR,payload:e})},g=a.useSelector((e=>e.breakpoint.initialised));if(u&&g){const t=Ut({})({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=Ii(v);return e.jsx(kn,{info:{layoutType:"OuterLayout",pageInstanceGuid:n},children:e.jsx(Ht,{value:t,children:e.jsx(It,{value:a,overrides:Ol,children:e.jsx(mt.Provider,{value:f,children:e.jsx(yt.Provider,{value:p,children:e.jsx(Yt.Provider,{value:"OUTER",children:e.jsx(Bn.Provider,{value:u.layoutSchemaVersion,children:e.jsx(bt,{children:e=>e(u.layoutSchema)})})})})})})})})}return null}var jl=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"CatalogResponseButton":case"CatalogQuantityOption":case"CatalogRadioGroup":case"CatalogQuantityCounter":case"PartnerEventButtonTrigger":case"CopyToClipboardButton":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}}}),Ll=Object.assign({},jl);function*Nl(e,t){const n=Ll.getDistribution(t),a=null==n?void 0:n.type,i=yield r.select(Ko),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:Xs.INITIALISE_PROGRESSION,payload:{currentGroupIndex:0,totalCount:e,groupSize:o}}))}function*_l(e,t){const{instanceGuid:n,layoutSchemaVersion:a,outerLayoutSchema:o,slots:r}=t.payload;n?yield c.put({type:Y,payload:{name:"SignalLoadComplete",parentGuid:n}}):yield c.put({type:Ji,payload:{level:vo,code:Lo,message:"Layout instance guid does not exist"}}),yield c.put({type:Bs,payload:{modules:r.map((e=>e.layoutVariant.moduleName))}}),yield c.put({type:ki,payload:o.breakpoints}),yield c.put({type:Xs.LAYOUT_UPDATE,payload:{instanceGuid:n,layoutSchemaVersion:a,layoutSchema:o.layout,settings:o.settings}}),yield c.put({type:Xs.SET_SLOTS,payload:r}),i.isNil(o.settings)||(yield c.put({type:Xs.SET_SETTINGS,payload:o.settings})),yield*Nl(r.length,o.layout);const s=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,sr.PartnerValidationEvent.OPT_IN_TO_PARTNER_VALIDATION),yield c.spawn(Dl,e,sr.PartnerValidationEvent.SHOW_PARTNER_VALIDATION_STATUS,(()=>({type:"ACTIVE/ADD",payload:{id:yl}})))}catch(e){return yield c.put({type:Ji,payload:{level:mo,code:_o,message:"Failed to establish partner validation."}}),"FAILURE"}return"OK"}(e.partner,o.settings,r);"OK"===s&&(yield c.call(Tr,e.display,o.display)),yield*function*(e){for(const t of e)kl(t.offer.creative)&&(yield c.put({type:te,payload:{criteria:{key:Pl(t.offer.creative),type:"PAYMENT_OFFER_PROVIDED"},signal:{name:"SignalResponse",parentGuid:t.offer.creative.instanceGuid}}}))}(r)}function*Dl(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 kl(e){const t=null==e?void 0:e.ResponseOptions;return(null==t?void 0:t.some((e=>{const t=e.PaymentTriggerConfig;return t&&t.ExternalKey})))||!1}function Pl(e){const t=null==e?void 0:e.ResponseOptions;if(!t)return"DigitalPayment";for(const e of t){const t=e.PaymentTriggerConfig;if(t&&t.ExternalKey)return t.ExternalKey}return"DigitalPayment"}function $l(e){return Sc(e)}function Gl(e,t){return Error(`Migration process from v0_0 to v0_1 failed: could not transform ${e} node. For more details: ${t}`)}const Fl=i.all(i.anyPass([function(e){return"Row"===e.type&&Vl(e.node.children)},function(e){return"Column"===e.type&&Vl(e.node.children)},Wl,Jl])),Ml=i.all(i.anyPass([function(e){return"Row"===e.type&&zl(e.node.children)},function(e){return"Column"===e.type&&zl(e.node.children)},Jl,Wl,function(e){return"DataImage"===e.type},function(e){return"When"===e.type&&zl(e.node.children)}])),Bl=i.all(i.anyPass([function(e){return"Row"===e.type&&ql(e.node.children)},function(e){return"Column"===e.type&&ql(e.node.children)},Jl,Wl])),Ul=i.all(i.anyPass([function(e){return"Row"===e.type&&Hl(e.node.children)},function(e){return"Column"===e.type&&Hl(e.node.children)},Wl,function(e){return"RichText"===e.type},Jl,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&Hl(e.node.children)},function(e){return"StaticLink"===e.type&&Hl(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CloseButton"===e.type&&Hl(e.node.children)}]));function Vl(e){return Fl(e)}function zl(e){return Ml(e)}function ql(e){return Bl(e)}function Hl(e){return Ul(e)}function Wl(e){return"StaticImage"===e.type}function Jl(e){return"BasicText"===e.type}const Kl=i.lensPath(["styles","elements","link"]),Yl=i.lensPath(["styles","elements","activeIndicator"]),Zl=i.lensPath(["styles","elements","indicator"]),Ql=i.lensPath(["styles","elements","seenIndicator"]),Xl=i.lensPath(["focussed"]),ec=i.lensPath(["hovered"]),tc=i.lensPath(["default"]),nc=i.lensPath(["pressed"]),ac=e=>{var t;return{text:null!==(t=null==e?void 0:e.text)&&void 0!==t?t:{}}},ic=i.when(i.hasPath(["styles","elements","link"]),i.pipe(i.over(Kl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default})))),i.over(Kl,i.map(i.when(i.has("focussed"),i.over(Xl,ac)))),i.over(Kl,i.map(i.when(i.has("hovered"),i.over(ec,ac)))),i.over(Kl,i.map(i.when(i.has("default"),i.over(tc,ac)))),i.over(Kl,i.map(i.when(i.has("pressed"),i.over(nc,ac)))))),oc=i.pipe(i.when(i.hasPath(["styles","elements","activeIndicator"]),i.over(Yl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","indicator"]),i.over(Zl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","seenIndicator"]),i.over(Ql,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))));function rc(e,t){return e?{elements:{own:e.elements.own.map(t)}}:void 0}const sc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),lc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),cc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),dc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),uc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),pc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),fc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),yc=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 Gl("When",`Invalid condition: ${e}`)}},hc=e=>{switch(e){case"breakpoint":return"Breakpoint";case"progression":return"Progression";case"position":return"Position";default:throw Gl("When",`Invalid target: ${e}`)}},mc=e=>{const{target:t,condition:n,value:a}=e;return{type:hc(t),predicate:{condition:yc(n),value:a}}};function vc(e){const t={type:"FadeInOut",settings:{duration:e.transition.settings.duration}};return{styles:e.style,transition:t}}function gc(e){const t=e.children.map((e=>Sc(e)));if(Vl(t))return Object.assign(Object.assign({},e),{children:t,styles:rc(e.styles,uc)});throw Gl("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function bc(e){const t=e.children.map((e=>Sc(e)));if(zl(t))return Object.assign(Object.assign({},e),{children:t,styles:rc(e.styles,pc)});throw Gl("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function Ec(e){const t=e.children.map((e=>Sc(e)));if(ql(t))return Object.assign(Object.assign({},e),{children:t,styles:rc(e.styles,fc)});throw Gl("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}const Ic=e=>({own:e.overlayContainer,wrapper:e.overlayWrapper});function xc(e){var t,n;const a=(null===(t=e.styles)||void 0===t?void 0:t.elements)?{elements:Ic(null===(n=e.styles)||void 0===n?void 0:n.elements)}:void 0,i=e.children.map((e=>Sc(e)));if(Hl(i))return Object.assign(Object.assign({},e),{styles:a,children:i});throw Gl("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function Sc(e){switch(e.type){case"When":return{type:"When",node:(s=e.node,{predicates:s.predicates.map(mc),children:s.children.map((e=>Sc(e)))})};case"OneByOneDistribution":return{type:e.type,node:vc(e.node)};case"Overlay":return{type:e.type,node:xc(e.node)};case"Column":return{type:e.type,node:(r=e.node,{styles:rc(r.styles,sc),children:r.children.map((e=>Sc(e)))})};case"Row":return{type:e.type,node:(o=e.node,{styles:rc(o.styles,lc),children:o.children.map((e=>Sc(e)))})};case"RichText":return{type:e.type,node:(i=e.node,ic(i))};case"CloseButton":return{type:e.type,node:gc(e.node)};case"CreativeResponse":return{type:e.type,node:bc(e.node)};case"StaticLink":return{type:e.type,node:Ec(e.node)};case"StaticImage":return{type:e.type,node:(a=e.node,Object.assign(Object.assign({},a),{styles:rc(a.styles,cc)}))};case"DataImage":return{type:e.type,node:(n=e.node,Object.assign(Object.assign({},n),{styles:rc(n.styles,dc)}))};case"ProgressIndicator":return{type:e.type,node:(t=e.node,oc(t))};default:return e}var t,n,a,i,o,r,s}function wc(e){return jd(e)}function Cc(e,t){return Error(`Migration process from v0_23 to v1_0 failed: could not transform ${e} node. For more details: ${t}`)}const Oc=e=>"scroll"===e||"auto"===e?"visible":e,Tc=i.lensPath(["elements","own"]),Ac=i.lensPath(["transitions","transition","value","own"]),Rc=i.lensPath(["elements","wrapper"]),jc=i.lensPath(["transitions","transition","value","wrapper"]),Lc=i.lensPath(["elements","indicator"]),Nc=i.lensPath(["transitions","transition","value","indicator"]),_c=i.lensPath(["elements","activeIndicator"]),Dc=i.lensPath(["transitions","transition","value","activeIndicator"]),kc=i.lensPath(["elements","seenIndicator"]),Pc=i.lensPath(["transitions","transition","value","seenIndicator"]),$c=i.lensPath(["default","container","overflow"]),Gc=i.lensPath(["pressed","container","overflow"]),Fc=i.lensPath(["hovered","container","overflow"]),Mc=i.lensPath(["focussed","container","overflow"]),Bc=i.lensPath(["disabled","container","overflow"]),Uc=i.lensPath(["container","overflow"]),Vc=i.pipe(i.when(i.hasPath(["default","container","overflow"]),i.over($c,Oc)),i.when(i.hasPath(["pressed","container","overflow"]),i.over(Gc,Oc)),i.when(i.hasPath(["hovered","container","overflow"]),i.over(Fc,Oc)),i.when(i.hasPath(["focussed","container","overflow"]),i.over(Mc,Oc)),i.when(i.hasPath(["disabled","container","overflow"]),i.over(Bc,Oc))),zc=i.when(i.hasPath(["container","overflow"]),i.over(Uc,Oc)),qc=i.pipe(i.when(i.hasPath(["elements","own"]),i.over(Tc,i.map(Vc))),i.when(i.hasPath(["transitions","transition","value","own"]),i.over(Ac,zc))),Hc=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)})),Wc=i.pipe(qc,Hc),Jc=i.pipe(i.when(i.hasPath(["elements","wrapper"]),i.over(Rc,i.map(Vc))),i.when(i.hasPath(["transitions","transition","value","wrapper"]),i.over(jc,zc))),Kc=i.pipe(i.when(i.hasPath(["elements","indicator"]),i.over(Lc,i.map(Vc))),i.when(i.hasPath(["transitions","transition","value","indicator"]),i.over(Nc,zc))),Yc=i.pipe(i.when(i.hasPath(["elements","activeIndicator"]),i.over(_c,i.map(Vc))),i.when(i.hasPath(["transitions","transition","value","activeIndicator"]),i.over(Dc,zc))),Zc=i.pipe(i.when(i.hasPath(["elements","seenIndicator"]),i.over(kc,i.map(Vc))),i.when(i.hasPath(["transitions","transition","value","seenIndicator"]),i.over(Pc,zc)));function Qc(e){return"StaticImage"===e.type}function Xc(e){return"StaticIcon"===e.type}function ed(e){return"BasicText"===e.type}function td(e){return"DataImage"===e.type}function nd(e){return"DataIcon"===e.type}function ad(e){return"RichText"===e.type}function id(e){return"SlideStateTrigger"===e.type}function od(e){return"ToggleButtonStateTrigger"===e.type}const rd=i.all(i.anyPass([function(e){return"Row"===e.type&&sd(e.node.children)},function(e){return"Column"===e.type&&sd(e.node.children)},Qc,Xc,ad,ed,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&sd(e.node.children)},function(e){return"StaticLink"===e.type&&sd(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&&sd(e.node.children)},function(e){return"ProgressControl"===e.type&&vd(e.node.children)},function(e){return"ZStack"===e.type&&sd(e.node.children)},function(e){return"FlowRow"===e.type&&sd(e.node.children)},id,od]));function sd(e){return rd(e)}const ld=i.pipe(qc,Jc,Hc);function cd(e){const t=e.children.map((e=>jd(e)));if(sd(t))return Object.assign(Object.assign({},i.omit(["settings"],e)),{children:t,allowBackdropToClose:e.settings.allowBackdropToClose,styles:e.styles?ld(e.styles):void 0});throw Cc("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function dd(e){const t=e.children.map((e=>jd(e)));if(vd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Wc(e.styles):void 0});throw Cc("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function ud(e){const t=e.children.map((e=>jd(e)));if(bd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Wc(e.styles):void 0});throw Cc("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function pd(e){const t=e.children.map((e=>jd(e)));if(vd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Wc(e.styles):void 0});throw Cc("ProgressControl",`Invalid schema: ${JSON.stringify(e)}`)}const fd=i.pipe(qc,Kc,Yc,Zc,Hc);const yd=i.all(i.anyPass([ed,Qc,Xc,td,nd,function(e){return"Row"===e.type&&hd(e.node.children)},function(e){return"FlowRow"===e.type&&hd(e.node.children)},function(e){return"Column"===e.type&&hd(e.node.children)},function(e){return"ZStack"===e.type&&hd(e.node.children)},function(e){return"When"===e.type&&hd(e.node.children)}]));function hd(e){return yd(e)}const md=i.all(i.anyPass([ed,Qc,Xc,function(e){return"Row"===e.type&&vd(e.node.children)},function(e){return"FlowRow"===e.type&&vd(e.node.children)},function(e){return"Column"===e.type&&vd(e.node.children)},function(e){return"ZStack"===e.type&&vd(e.node.children)},function(e){return"When"===e.type&&vd(e.node.children)}]));function vd(e){return md(e)}const gd=i.all(i.anyPass([ed,Qc,Xc,td,nd,function(e){return"Row"===e.type&&bd(e.node.children)},function(e){return"FlowRow"===e.type&&bd(e.node.children)},function(e){return"Column"===e.type&&bd(e.node.children)},function(e){return"ZStack"===e.type&&bd(e.node.children)},function(e){return"When"===e.type&&bd(e.node.children)}]));function bd(e){return gd(e)}function Ed(e){const t=e.children.map((e=>jd(e)));if(hd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Wc(e.styles):void 0});throw Cc("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}function Id(e){const t=e.children.map((e=>jd(e)));if(bd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Wc(e.styles):void 0});throw Cc("CatalogResponseButton",`Invalid schema: ${JSON.stringify(e)}`)}function xd(e){return"Row"===e.type&&Cd(e.node.children)}function Sd(e){return"Column"===e.type&&Cd(e.node.children)}const wd=i.all(i.anyPass([ed,Qc,Xc,td,nd,ad,function(e){return"StaticLink"===e.type},id,od,function(e){return"CatalogResponseButton"===e.type},xd,function(e){return"FlowRow"===e.type&&Cd(e.node.children)},Sd,function(e){return"ZStack"===e.type&&Cd(e.node.children)},function(e){return"When"===e.type&&Cd(e.node.children)}]));function Cd(e){return wd(e)}const Od=i.anyPass([xd,Sd]);function Td(e){const t=jd(e.template);if(function(e){return Od(e)}(t))return Object.assign(Object.assign({},e),{template:t,styles:e.styles?Wc(e.styles):void 0});throw Cc("CatalogStackedCollection",`Invalid schema: ${JSON.stringify(e)}`)}function Ad(e){const t=e.children.map((e=>jd(e)));if(hd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Wc(e.styles):void 0});throw Cc("ToggleButtonStateTrigger",`Invalid schema: ${JSON.stringify(e)}`)}function Rd(e){const t=e.transition?{inTransition:e.transition.in,outTransition:e.transition.out}:void 0;return Object.assign(Object.assign({},e),{children:e.children.map((e=>jd(e))),transition:t})}function jd(e){switch(e.type){case"Row":return{type:e.type,node:(g=e.node,Object.assign(Object.assign({},g),{children:g.children.map((e=>jd(e))),styles:g.styles?Wc(g.styles):void 0}))};case"When":return{type:e.type,node:Rd(e.node)};case"FlowRow":return{type:e.type,node:(v=e.node,Object.assign(Object.assign({},v),{styles:v.styles?Wc(v.styles):void 0,children:v.children.map((e=>jd(e)))}))};case"Column":return{type:e.type,node:(m=e.node,Object.assign(Object.assign({},m),{children:m.children.map((e=>jd(e))),styles:m.styles?Wc(m.styles):void 0}))};case"ZStack":return{type:e.type,node:(h=e.node,Object.assign(Object.assign({},h),{styles:h.styles?Wc(h.styles):void 0,children:h.children.map((e=>jd(e)))}))};case"Overlay":return{type:e.type,node:cd(e.node)};case"ProgressControl":return{type:e.type,node:pd(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?Wc(y.styles):void 0}))};case"CloseButton":return{type:"CloseButton",node:dd(e.node)};case"CreativeResponse":return{type:"CreativeResponse",node:ud(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?Wc(f.styles):void 0}))};case"OneByOneDistribution":return{type:"OneByOneDistribution",node:(p=e.node,Object.assign(Object.assign({},p),{styles:p.styles?Wc(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?fd(d.styles):void 0}))};case"SlideStateTrigger":return{type:"SlideStateTrigger",node:(c=e.node,Object.assign(Object.assign({},c),{styles:c.styles?Wc(c.styles):void 0}))};case"StackedDistribution":return{type:"StackedDistribution",node:(l=e.node,Object.assign(Object.assign({viewableItems:[]},l),{styles:l.styles?Wc(l.styles):void 0}))};case"StaticLink":return{type:"StaticLink",node:Ed(e.node)};case"ToggleButtonStateTrigger":return{type:"ToggleButtonStateTrigger",node:Ad(e.node)};case"CatalogResponseButton":return{type:"CatalogResponseButton",node:Id(e.node)};case"CatalogStackedCollection":return{type:"CatalogStackedCollection",node:Td(e.node)};case"RichText":return{type:"RichText",node:(s=e.node,Object.assign(Object.assign({},s),{styles:s.styles?Hc(s.styles):void 0}))};case"DataImage":return{type:"DataImage",node:(r=e.node,Object.assign(Object.assign({},r),{styles:r.styles?Hc(r.styles):void 0}))};case"StaticImage":return{type:"StaticImage",node:(o=e.node,Object.assign(Object.assign({},o),{styles:o.styles?Hc(o.styles):void 0}))};case"DataIcon":return{type:"DataIcon",node:(a=e.node,Object.assign(Object.assign({},a),{styles:a.styles?Hc(a.styles):void 0}))};case"StaticIcon":return{type:"StaticIcon",node:(n=e.node,Object.assign(Object.assign({},n),{styles:n.styles?Hc(n.styles):void 0}))};case"BasicText":return{type:"BasicText",node:(t=e.node,Object.assign(Object.assign({},t),{styles:t.styles?Hc(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 Ld(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 Nd(e,t){return e.major===t.major&&e.minor===t.minor}const _d=(e,t,n)=>i.allPass([i.lte(e),i.gte(t)])(n);function Dd(e,t){return Nd(t,{major:0,minor:0})?Dd($l(e),{major:0,minor:1}):function(e,t){return 0===t.major&&_d(1,23,t.minor)}(0,t)?Dd(wc(e),{major:1,minor:0}):e}function kd(e,t){return Nd(t,{major:0,minor:0})?kd(function(e){return Object.assign(Object.assign({},e),{layout:$l(e.layout)})}(e),{major:0,minor:1}):function(e,t){return 0===t.major&&_d(1,23,t.minor)}(0,t)?kd(function(e){return Object.assign(Object.assign({},e),{layout:wc(e.layout)})}(e),{major:1,minor:0}):e}function Pd(e,t,n,a){const i=Ld(n);if(a){const s=Ld(a);if(r=i,(o=s).major<r.major||o.major===r.major&&o.minor<r.minor||Nd(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,Ld("0.0"));var o,r}function $d(e){var t;try{return Object.assign(Object.assign({},i.clone(e)),{offer:Object.assign(Object.assign({},i.clone(e.offer)),{creative:xl(e.offer.creative)}),layoutVariant:Object.assign(Object.assign({},i.clone(e.layoutVariant)),{layoutVariantSchema:"string"==typeof e.layoutVariant.layoutVariantSchema?wl(e.layoutVariant.layoutVariantSchema,"LayoutSlotLayoutVariant",e.instanceGuid):e.layoutVariant.layoutVariantSchema,childLayouts:i.map(Gd,null!==(t=e.layoutVariant.childLayouts)&&void 0!==t?t:[])})})}catch(t){throw t.message?t:Il("Slot",e.instanceGuid)}}function Gd(e){return Object.assign(Object.assign({},i.clone(e)),{childLayoutSchema:"string"==typeof e.childLayoutSchema?wl(e.childLayoutSchema,"ChildLayoutRootSchema",e.childLayoutId):e.childLayoutSchema})}function Fd(e){if(e){const t=function(e){try{return Object.assign(Object.assign({},i.clone(e)),{outerLayoutSchema:"string"==typeof e.outerLayoutSchema?wl(e.outerLayoutSchema,"LayoutRootLayoutSchema",e.instanceGuid):e.outerLayoutSchema,slots:i.map($d,e.slots)})}catch(t){throw t.message?t:Il("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=>Pd(e,Dd,t,n))))),i.over(a,(e=>Pd(e,kd,t,n))))(e)}(t,Eo.DCUI_SCHEMA_VERSION)}}const Md=i.cond([[i.where({signalType:i.equals("SignalSecondaryResponse")}),function*(e,t){return yield r.put({type:Ji,payload:{level:go,code:Ro,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){var a;if("url"in e&&e.url){const i=e.instanceGuid;yield r.put({type:Y,payload:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:i,responseActionPayload:{name:"Url",transformedTrafficURL:e.url,creativeInstanceGuid:e.creativeInstanceGuid}}});const o=t.getOverrideLinkNavigation()?"overrideLinkNavigation":null!==(a=e.urlBehavior)&&void 0!==a?a:"newTab",s=yield*function*(e,t,n){try{const a=yield r.call(fr,t),i=vr(a)?a.ref:void 0;return yield r.call(e.addAdvertiserWindowRef,i,n),vr(a)||"newTab"!==t.urlBehavior?"SUCCESS":(yield r.put({type:Ji,payload:{level:go,code:jo,message:`Did not receive a window reference opening link ${t.url}`}}),"UNSPECIFIED")}catch(e){return yield r.put({type:Ji,payload:{level:go,code:jo,message:`Errored attempting to open link ${t.url}: ${e.message}`,stack:e.stack}}),"ERROR"}}(t,{url:e.url,urlBehavior:o,external:{partner:n}},i);return"self"===o?"END":s}return yield r.put({type:Ji,payload:{level:go,code:Ro,message:"URL response doesn't have a valid url",additionalInformation:{instanceGuid:e.instanceGuid}}}),"ERROR"}],[i.T,function*(){return"EXPLICIT_DISMISSAL"}]]);function*Bd(e){return yield r.put({type:Ji,payload:{level:go,code:Ro,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}function*Ud(e,t){let n="IMPLICIT_DISMISSAL";const a=t.payload.offerPositionIndex,i=W(t.payload)||J(t.payload)||H(t.payload)?t.payload:t.payload.responseOption;switch(i.action){case"Url":yield r.put({type:X,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:Ki,payload:{code:"CREATIVE_RESPONSE",message:"creative positive response",data:{type:i.action,isPositive:i.isPositive,responseInstanceGuid:i.instanceGuid}}}),yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*Bd(i):yield*Md(i,e.context,e.partner);break;case"CaptureOnly":yield r.put({type:X,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*Bd(i):yield*function*(e){return yield r.put({type:Y,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:Ji,payload:{level:go,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"External":yield r.put({type:Ji,payload:{level:go,code:"INCORRECTLY_HANDLE_EXTERNAL_ACTION",message:`External action was dispatched as an engagement erroneously. Instance GUID: ${i.instanceGuid}`}}),n="ERROR"}K(t.payload)||(yield r.put(function(e,t){switch(e){case"SUCCESS":return{type:Ks,payload:{event:"Completed",completionReason:"Success",offerPositionIndex:t}};case"UNSPECIFIED":return{type:Ks,payload:{event:"Completed",completionReason:"Unspecified",offerPositionIndex:t}};case"ERROR":return{type:Ks,payload:{event:"Completed",completionReason:"Error",offerPositionIndex:t}};case"EXPLICIT_DISMISSAL":return{type:Ks,payload:{event:"Dismissed",dismissalReason:"Explicit",offerPositionIndex:t}};case"IMPLICIT_DISMISSAL":return{type:Ks,payload:{event:"Dismissed",dismissalReason:"Implicit",offerPositionIndex:t}};default:return{type:Hs,payload:{offerProcessStatus:"END"}}}}(n,a)))}function Vd(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:Ji,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:Ji,payload:{level:R,code:"FAILED_TO_LOAD_MODULE",message:t,additionalInformation:{stack:a,reason:t?void 0:e,moduleName:n}}}),i(l.END)})),()=>{})))}const zd={"standard-marketing":()=>Promise.resolve().then((function(){return Wu})),"add-to-cart":()=>Promise.resolve().then((function(){return Jp})),"instant-purchase":()=>Promise.resolve().then((function(){return Pf})),"layouts-xp-sandbox":()=>Promise.resolve().then((function(){return yy}))};function*qd(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(Hd,e,t,i))}function*Hd(e,t,n){if(n in zd){yield r.put({type:Ms,payload:n});const a=yield r.call(Vd,e,t,n,zd[n]);yield r.call(To,a)}else yield r.put({type:Ji,payload:{level:mo,code:"INVALID_MODULE_NAME",message:`Could not load unknown module ${n}`}})}function*Wd(e){const t=yield r.select((e=>Ll.getDistributionViewableItems(e.layout?Ll.getDistribution(e.layout.layoutSchema):void 0))),n=yield r.select((n=>{var a;const i=Jo(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:qs,payload:{groupSize:n}};yield r.put(e)}}const Jd=i.cond([[(e,t,n,a)=>"END"===e.offerProcessStatus,i.always({type:Fi})],[(e,t,n,a)=>t.isLastOffer&&n,i.always({type:Fi})],[(e,t,n,a)=>1===a&&!t.isLastOffer,i.always({type:Vs})],[i.T,i.always(void 0)]]);function*Kd(e){const t=yield r.select((e=>({exists:null!==e.progression,isLastOffer:sl(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=Jd(e,t,"boolean"==typeof a&&a,n);i&&(i.type===Fi&&(yield r.put({type:X,payload:{name:"PLACEMENT_COMPLETED"}})),yield r.put(i))}(e.payload,t,n))}function Yd(e){return e.type===Ks&&"Interactive"===e.payload.event}function Zd(e){return e.type===Ks&&"Interactive"!==e.payload.event}function*Qd(e){switch(e.payload.event){case"Dismissed":yield r.put({type:Hs,payload:{offerProcessStatus:"CONTINUE"}});break;case"Completed":yield r.put({type:Ys,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:Hs,payload:{offerProcessStatus:"CONTINUE"}});break;case"Interactive":yield r.put({type:V,payload:{name:"Interactive",offerPositionIndex:e.payload.offerPositionIndex}}),yield r.put({type:X,payload:{name:"PLACEMENT_INTERACTIVE"}})}}function*Xd(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,sr.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:Ji,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*eu(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:Xs.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Fi}),t?(yield r.put({type:Y,payload:{name:"SignalInstantPurchaseDismissal",parentGuid:t}}),yield r.put({type:Y,payload:{name:"SignalDismissal",parentGuid:t}})):yield r.put({type:Ji,payload:{level:vo,code:Lo,message:"ParentGuid does not exist"}})}function*tu(e,t){yield r.all([r.takeEvery(Ji,Ao.bind(null,e.errorService.raise)),r.takeLatest(Gi,_l.bind(null,{display:e.displayService,partner:e.partnerInteractionService})),r.takeEvery(Bs,qd.bind(null,t,e.contextService)),r.takeLatest(Zs,Ud.bind(null,{partner:e.partnerInteractionService,context:e.contextService})),r.takeEvery(Hs,Kd),r.takeEvery(Zd,Qd),Oo(Yd,Qd),r.takeLatest(ki,tr.bind(null,e.displayService)),r.takeLatest(Fi,Ir.bind(null,e.contextService)),r.takeLatest(Js,eu),r.takeLatest(Wi,Wr),r.takeEvery(Y,Rr),r.takeEvery(te,jr),Co(V,qr.bind(null,e.metricsService)),Co(Hi,Lr.bind(null,e.rdnService)),r.takeEvery(Ki,Ar.bind(null,e.errorService.raise)),r.takeLatest(_i,Wd),r.takeEvery(Q,zr),r.takeEvery(ne,Hr.bind(null,{createChildPlugin:e.childPlugin.create,partner:e.partnerInteractionService,context:e.contextService})),r.takeLatest(ae,Xd.bind(null,{partner:e.partnerInteractionService,context:e.contextService}))])}var nu,au,iu,ou,ru,su=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},lu=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 cu={[re.SET_CUSTOM_STATE]:Xs.SET_CUSTOM_STATE,[re.SET_DOMAIN_STATE]:Xs.SET_DOMAIN_STATE,[re.SET_GLOBAL_OFFER_DATA_CART]:Xs.SET_GLOBAL_OFFER_DATA_CART,[re.OFFER_LIFECYCLE]:el.OFFER_LIFECYCLE,[re.OFFER_ENGAGEMENT]:el.OFFER_ENGAGEMENT,[re.SET_PARTNER_VALIDATION_STATUS]:el.SET_PARTNER_VALIDATION_STATUS};class du{constructor(e){nu.add(this),au.set(this,void 0),su(this,au,e,"f")}getState(e){const t=lu(this,au,"f").getState();return{breakpoint:t.breakpoint,progression:ll(t),customStates:Yo(t,e.offerPositionIndex),domainStates:cl(t,e.offerPositionIndex)}}dispatch(e,t){lu(this,au,"f").dispatch(lu(this,nu,"m",ru).call(this,e,t))}subscribe(e,t){return t(this.getState(e)),lu(this,au,"f").subscribe((()=>{t(this.getState(e))}))}}function uu(e,t){const n=l(),a={},i=s.configureStore({reducer:ol,devTools:{name:"Orchestrator"},preloadedState:Object.assign(Object.assign({},rl()),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 du(e)}(i),c=e.childPlugin.create,d=e.partnerInteractionService.onEvent,(e,t)=>new dn(r,c,e,t,d));var r,c,d;n.run(tu,e,o),n.run(Cr,e,Fd);const u={};return Object.assign(Object.assign({},i),{extend:({reducer:e,interceptors:t,sagas:o})=>{e&&(Object.assign(u,e),i.replaceReducer(s.combineReducers(Object.assign(Object.assign({},ol),u)))),t&&Object.assign(a,t),o&&n.run(o)}})}au=new WeakMap,nu=new WeakSet,iu=function(e,t,n){return{type:e,payload:Object.assign(Object.assign({},t),{offerPositionIndex:n.offerPositionIndex,creativeInstanceGuid:n.creativeInstanceGuid})}},ou=function(e,t){return t.type===te?t.payload.signal.parentGuid||(t.payload.signal.parentGuid=e.creativeInstanceGuid):(t.payload.creativeInstanceGuid=e.creativeInstanceGuid,t.payload.parentGuid||(t.payload.parentGuid=e.creativeInstanceGuid)),t},ru=function(e,t){return function(e){return e.type in cu}(t)?lu(this,nu,"m",iu).call(this,cu[t.type],t.payload,e):t.type===Y||t.type===te?lu(this,nu,"m",ou).call(this,e,t):t};var pu=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 fu={ctx:new Map([[Fs.name,Fs],[Ps.name,Ps],[gs.name,gs],[Ts.name,Ts]]),cache:[]};class yu{constructor(){this._subscribers=[]}add(e){this._subscribers.push(e)}unsubscribe(){this._subscribers.forEach((e=>e.unsubscribe()))}}const hu=()=>{},mu=(e=hu,t=hu,n=hu)=>"function"!=typeof e?e:{next:e,error:t,complete:n};class vu{constructor(e){this._setupFn=e}subscribe(e,t,n){const a=mu(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 yu;return s.add({unsubscribe:()=>{i&&i(),o=!1}}),s}}class gu extends vu{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 vu((e=>{const t=this.subscribe(e);return()=>t.unsubscribe()}))}}const bu={CompletedBeforeEmit:"CompletedBeforeEmit"};var Eu=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 Iu{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)=>Eu(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 xu{constructor(e){this.value=e,this.complete=!1,this.skip=!1}}var Su=function(e,t,n,a){return new(n||(n=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((a=a.apply(e,t||[])).next())}))};const wu={getBreakpointCSSClass:B},Cu="CHILD_LAYOUTS/ADD_LAUNCHED",Ou="DYNAMIC_DATA/ADD";function Tu(e={launched:{}},t){if(t.type===Cu){const n=t.payload;return n.childLayoutId?i.assocPath(["launched",n.childLayoutId],n.shouldRelaunch,e):e}return e}function Au(e=null,t){return e}function Ru(e=null,t){if(t.type===Ou){const n=t.payload;return e?n?i.mergeDeepRight(e,n):e:n}return e}function ju(e,t){var n;return null===(n=e.childLayouts.launched[t])||void 0===n||n}function Lu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer}function Nu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.schemaVersion}function _u(e){var t,n;return null!==(n=null===(t=e.dynamicData)||void 0===t?void 0:t.text)&&void 0!==n?n:{}}const Du="FAILED_TO_LAUNCH_CHILD_LAYOUT";function*ku(e,t,n){var a;if(yield null===(a=r.select(ju,n.payload.childLayoutId))||void 0===a||a){const a=yield r.select(Nu),o=yield r.select(Lu),s=yield r.select(_u);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:Du,message:"Could not launch child layout, failed creating plugin."})}}catch(e){yield r.call(t,{level:j,code:Du,message:"Could not launch child layout, failed to make the child layout config serializable."})}yield r.put({type:Cu,payload:{childLayoutId:n.payload.childLayoutId,shouldRelaunch:!1}})}var i}function Pu(){const t=Cn(),n=a.useSelector(_u),i=Wt()({state:n},"textContent");return e.jsx(Ht,{value:i,children:e.jsx(bt,{children:e=>e(t)})})}const $u={staticData:Au,dynamicData:Ru,childLayouts:Tu};function Gu(e={}){return Object.assign({staticData:null,dynamicData:null,childLayouts:{launched:{}}},e)}function Fu(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 Mu(e){return"object"==typeof e&&null!==e&&Object.entries(e).every((([e,t])=>"string"==typeof e&&"string"==typeof t))}function*Bu(e,t,n,a){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Z,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":if(n&&a){yield r.call(a);break}t({type:Z,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Z,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*Uu(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n,o=K(n);yield r.put({type:Y,payload:{name:"SignalResponse",parentGuid:a.instanceGuid,responseActionPayload:{name:"Fulfillment"}}});const s=yield r.call(e.createChildPlugin.bind(e),i);if("object"==typeof s&&"onClose"in s&&"close"in s){const a=yield r.call(Fu,s);if("object"==typeof a&&"take"in a){const i=function(e,t,n,a){if(n.responseOption.rclid)return function*(){yield r.put({type:X,payload:{name:"REALTIME_OFFER_FULFILLMENT_CONVERSION",body:{rclid:n.responseOption.rclid,accountID:n.accountID,referralCreativeID:n.referralCreativeID}}}),yield r.call(Vu,e,t,a)}}(e,t,n,s);return void(yield r.call(Bu,a,e.globalDispatch.bind(e),o,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*Vu(e,t,n){const a=function(e){return l.eventChannel((t=>{const n=e.onEvent({name:cr,source:"partner",callback:e=>{Mu(e)&&t({eventName:cr,data:e})}},{name:dr,source:"partner",callback:e=>{Mu(e)&&t({eventName:dr,data:e})}});return()=>{n()}}))}(e);try{for(;;){const i=yield r.take(a);switch(i.eventName){case cr:yield r.put({type:X,payload:{name:cr,body:i.data}}),yield r.put({type:Ou,payload:{text:i.data}}),e.globalDispatch({type:Z,payload:{event:"Completed",completionReason:"Success"}}),n&&(yield r.call(n.close.bind(n)));break;case dr:e.globalDispatch({type:Z,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*zu(e,t,n){const a=W(n.payload)||J(n.payload)||H(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":yield r.call(e.globalDispatch.bind(e),n),K(n.payload)&&(yield r.put({type:X,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:a.accountID,referralCreativeID:a.referralCreativeID}}}),yield r.call(Vu,e,t));break;case"CaptureOnly":yield r.call(e.globalDispatch.bind(e),n);break;case"Fulfillment":yield r.put({type:X,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),yield*Uu(e,t,n.payload)}}function*qu(e,t){yield r.all([r.takeLatest(z,zu.bind(null,e,t)),r.takeEvery(oe,ku.bind(null,e,t)),r.takeEvery("*",Io.bind(null,[z,oe],e))])}Object.assign({},re);const Hu=(new En).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=Gu({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=Gu()){const a=l(),i=s.configureStore({reducer:$u,devTools:{name:"Standard Marketing"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(qu,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(kn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Oi,{}),e.jsx(a.Provider,{store:d,children:e.jsx(wi,{settings:i,dispatch:d.dispatch,children:e.jsx(Pu,{})})})]})}))}}));var Wu=Object.freeze({__proto__:null,moduleConnectorBuilder:Hu});const Ju="CART/UPDATE",Ku="CATALOG_ITEM/RESPONSE",Yu="USER_CREATIVE_RESPONSE_HISTORY/ADD",Zu=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 Qu({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 Xu="catalogRadioGroup__label",ep=["Enter","Space"],tp={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 np(e,t,n){return e.map(i.cond([[i.compose(i.equals("Required"),i.propOr("","type")),({value:e})=>Number.isNaN(n)&&t>0?e.message:""],[i.T,i.always("")]])).filter(i.isNotEmpty)}function ap({schema:n,testId:i}){const o=a.useDispatch(),r=Gn(),[s,l]=a.useSelector((e=>{var t,a;const i=r.cartItemId in e.cart?null!==(a=null===(t=e.cart[r.cartItemId])||void 0===t?void 0:t.quantity)&&void 0!==a?a:0:NaN;return[i,np(n.validations,n.options.length,i)]})),c=Tn(),{tabIndex:d,styles:u,isDisabled:p}=m(c);t.useEffect((()=>{p||o(ip(l))}),[]);const f=n.options.filter((({quantity:e})=>{var t,n;return e>=(null!==(t=r.minItemCount)&&void 0!==t?t:-1/0)&&e<=(null!==(n=r.maxItemCount)&&void 0!==n?n:1/0)}));function y(e){o({type:Ku,payload:{catalogItem:r,quantity:e}});const t=np(n.validations,n.options.length,e);o(ip(t))}return f.length>0?e.jsx(wa,{styles:n.styles?M(tp,n.styles):tp,children:({classnames:n,mapperRef:a})=>e.jsx("div",{className:null==n?void 0:n.own,style:Object.assign({display:"flex",flexDirection:"column"},u),children:e.jsx(Kt,{value:a(Xu),children:t.Children.toArray(f.map(((t,a)=>{var o;const l=Zu(s,t.quantity),c=e=>i?`${i}-option${a}${e}`:void 0;return e.jsxs("label",{tabIndex:d,"aria-disabled":p,style:{display:"flex"},className:`${Xu} ${null!==(o=null==n?void 0:n.optionContainer)&&void 0!==o?o:""}`,onKeyDown:e=>{l||!ep.includes(e.code)||p||y(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:r.instanceGuid,value:t.quantity,checked:l,onChange:()=>y(t.quantity),"aria-disabled":p,disabled:p}),e.jsx(Qu,{isChecked:l,isDisabled:p,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(ji,{schema:t,testId:c("Content")})]})})))})})}):null}function ip(e){return{type:ae,payload:{errors:e}}}function op(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function rp(t){const n=a.useDispatch(),i=Et(),o=Gn(),r=Tn(),{tabIndex:s,styles:l,isDisabled:c}=m(r);return e.jsx(wa,{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:Ku,payload:{catalogItem:o,quantity:1}})},className:null==a?void 0:a.own,children:op(t.schema.children,i,t.testId)})})}const sp={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"]},lp=new Map([["&","_;^;_"]]),cp=new RegExp(`<a *(?=${sp.allowedAttributes.a.join("|")}|>)`,"g"),dp=new RegExp(`<a *(?:(?:${sp.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),up=new RegExp("(<br *?>)|(<br *?/>)","g"),pp=new RegExp(`<ul *(?=${sp.allowedAttributes.ul.join("|")}|>)`,"g"),fp=new RegExp(`<ol *(?=${sp.allowedAttributes.ol.join("|")}|>)`,"g"),yp=new RegExp("<li *(?=>|\\s[^>]*>)","g"),hp="<br/>";function mp(n){const a=Wt(),i=Tn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(dp,((e,t)=>{const n=t.replaceAll("&",lp.get("&"));return e.replace(t,n)})).replaceAll(up,hp)}(e);return t===u(t,sp)}(e))throw new L("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(wa,{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(cp,`<a ${a.join(" ")}`).replace(pp,`<ul ${i}`).replace(fp,`<ol ${i}`).replace(yp,`<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 vp={internally:"_top",externally:"_blank"};function gp(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:bp(t,i,o)})}function bp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Ep(t){var n,i;const o=vp[t.schema.open],r=Et(),s=Gn(),l=Tn(),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(wa,{styles:t.schema.styles,children:({classnames:n,mapperRef:a})=>{var i;return e.jsx("a",{href:d,onClick:()=>{var e;c({type:Y,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)?gp(t.schema.children,null==n?void 0:n.own,a,r,t.testId):bp(t.schema.children,r,t.testId)})}}):null}function Ip(e,t){const n=e.cart[t];return n||null}function xp(e){var t,n;const a=null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[],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 Sp(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 xp(e).reduce(((e,t)=>e+t.quantity),0)}(e),s=Ip(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 wp(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 Cp(e,t){var n,a;return null!==(a=null===(n=wp(e))||void 0===n?void 0:n.find((e=>e.catalogItemId===t)))&&void 0!==a?a:null}function Op(e){var t;const n=null===(t=wp(e))||void 0===t?void 0:t.filter((e=>e.preSelectedQuantity&&e.preSelectedQuantity>0));return n&&n.length>0?n:null}function Tp(e){var t,n;return null!==(n=null===(t=Op(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 Ap=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 Rp(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:i(t,void 0,o)})}function jp(e,t,n){return t(e,void 0,n)}function Lp(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=Gn(),g=Et(),b=Wt(),E=Tn(),{tabIndex:I,styles:x,isDisabled:S}=m(E),w=a.useSelector((e=>function(e,t){var n,a,i;const o=Cp(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))),C=a.useSelector((e=>Ip(e,v.cartItemId))),O=a.useSelector((e=>Sp(e,v))),T=(null==C?void 0:C.quantity)||0,A=m(S||T<=(null!==(n=v.minItemCount)&&void 0!==n?n:0)?"DISABLED":E),R=m(S||O<=0?"DISABLED":E),j=m(S||w?"DISABLED":E),L=e=>{var t;const n=e.target.value;if(0===n.length)N(null!==(t=v.minItemCount)&&void 0!==t?t:0);else{const e=Number(n);!Number.isNaN(e)&&e>=0&&N(e)}},N=e=>{S||h({type:Ku,payload:{catalogItem:v,quantity:e}})};return e.jsx(wa,{styles:s,children:({classnames:t,mapperRef:n})=>e.jsx("div",{className:null==t?void 0:t.own,style:Object.assign({display:"flex",flexDirection:"row"},x),children:w&&d?e.jsx(Da,{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(),N(T-1)},tabIndex:A.tabIndex,"aria-label":y||void 0,disabled:A.isDisabled,"data-testid":o?`${o}-decrement-button`:void 0,children:e.jsx(Ht,{value:b,children:(null==t?void 0:t.decrementButton)?Rp(p,t.decrementButton,n,g,o):jp(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:L,"aria-label":r||void 0,tabIndex:I,disabled:S,"data-testid":o?`${o}-input`:void 0}):e.jsx("p",{className:null==t?void 0:t.input,style:x,"data-testid":o?`${o}-quantity-text`:void 0,children:T}),u?e.jsx("button",{className:null==t?void 0:t.incrementButton,style:Object.assign(Object.assign({},R.styles),{cursor:R.isDisabled?"not-allowed":"pointer",pointerEvents:"auto"}),onClick:e=>{e.preventDefault(),N(T+1)},tabIndex:R.tabIndex,"aria-label":f||void 0,disabled:R.isDisabled,"data-testid":o?`${o}-increment-button`:void 0,children:e.jsx(Ht,{value:b,children:(null==t?void 0:t.incrementButton)?Rp(u,t.incrementButton,n,g,o):jp(u,g,o)})}):null]})})})}const Np={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(rp,{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(mp,{schema:n.node});case"CatalogUrlLink":return e.jsx(Ep,{schema:n.node});default:return}}},CatalogRadioGroup:function(t){if("CatalogRadioGroup"===t.type)return e.jsx(ap,{schema:t.node})},CatalogQuantityCounter:function(t){if("CatalogQuantityCounter"===t.type)return e.jsx(Lp,{schema:t.node})}};function _p(){const t=Cn(),n=Et();return e.jsx(It,{value:n,overrides:Np,children:e.jsx(bt,{children:e=>e(t)})})}const Dp={cart:function(e={},t){if(t.type===Ju){const{catalogItem:n,quantity:a}=t.payload,i=n.cartItemId,o=xo(n,a);return Object.assign(Object.assign({},e),{[i]:o})}return e},userCreativeResponseHistory:function(e=[],t){return t.type===Yu?e.concat(t.payload.responseId):e},staticData:Au,childLayouts:Tu};const kp="INVALID_PARTNER_MESSAGE",Pp="MISCONFIGURED_CATALOG_ITEM",$p="FAILED_TO_PROCESS_PARTNER_UPDATE_CART_ITEM";function*Gp(e){var t,n;const a=yield r.select(Op),i=yield r.select(Tp),o=yield r.select((e=>{var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer.maxTotalItemsQtyInOffer}));if(Vp(i)&&Vp(o)&&i>o)yield r.call(e,{level:j,code:Pp,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:Pp,message:`Preselected quantity (${a}) is greater than maxItemCount (${o}) for catalog item (${i.instanceGuid})`}):yield*Up(i,a,!0)}}function*Fp(e,t,n){const{catalogItem:a,quantity:i}=n.payload;if(yield*Up(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*Mp(e,t){const n=function(e,t){return l.eventChannel((n=>{const a=e.onEvent({name:or.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:kp,message:`Invalid UpdateCartItemPartnerMessageBody: ${JSON.stringify(e)}`}):n(e)}});return()=>{a()}}))}(e,t);try{for(;;){const e=yield r.take(n);yield r.call(Bp,e,t)}}catch(e){const n=e;t({level:j,code:$p,message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&n.close()}}function*Bp(e,t){const{cartItemId:n,quantity:a}=e,i=yield r.select(Ip,n);if(zp(i)){const e=yield r.select(Cp,i.catalogItemId);null!==(o=e)&&"object"==typeof o&&"catalogItemId"in o&&"price"in o?yield*Up(e,a,!1):yield r.call(t,{level:j,code:$p,message:`Catalog item not found for cart item id (${n})`})}else yield r.call(t,{level:j,code:$p,message:`Cart item not found for cart item id (${n})`});var o}function*Up(e,t,n){var a;const i=yield r.select(Ip,e.cartItemId),o=yield r.select(Sp,e),s=Vp(o)?o:0,l=zp(i)?i.quantity:0;if(t!==l&&t>=(null!==(a=e.minItemCount)&&void 0!==a?a:0)&&t-l<=s){yield r.put({type:Ju,payload:{catalogItem:e,quantity:t}});const a=yield r.select(Ip,e.cartItemId),o=yield r.select(Ap);return yield r.put({type:ie,payload:{cart:o}}),yield r.put({type:Y,payload:{name:"SignalCartItemQuantitySelected",parentGuid:e.instanceGuid,objectData:{quantity:t,preselected:n}}}),yield r.put({type:X,payload:{name:"V2_CART_ITEM_UPDATED",body:{oldCartItem:i,cartItem:a}}}),!0}return!1}function Vp(e){return"number"==typeof e}function zp(e){return null!=e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&"unitPrice"in e}function*qp(e,t){var n;yield r.put({type:Yu,payload:{responseId:(n=t.payload,q(n)?n.responseOption.id:n.id)}}),yield r.call(e.globalDispatch.bind(e),t)}function*Hp(e,t){yield r.all([r.spawn(Gp.bind(null,t)),r.spawn(Mp.bind(null,e,t)),r.takeLatest(Ku,Fp.bind(null,e,t)),r.takeLatest(z,qp.bind(null,e)),r.takeEvery(oe,ku.bind(null,e,t)),r.takeEvery("*",Io.bind(null,[z,oe],e))])}Object.assign(Object.assign({},re),{CATALOG_ITEM_RESPONSE:Ku});const Wp=(new En).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=function(e={}){return Object.assign({cart:{},userCreativeResponseHistory:[],staticData:null,childLayouts:{launched:{}}},e)}({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n){const a=l(),i=s.configureStore({reducer:Dp,devTools:{name:"Add To Cart"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Hp,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(kn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Oi,{}),e.jsx(a.Provider,{store:d,children:e.jsx(wi,{settings:i,dispatch:d.dispatch,children:e.jsx(_p,{})})})]})}))}}));var Jp=Object.freeze({__proto__:null,moduleConnectorBuilder:Wp});const Kp="CATALOG/TRIGGER_SELECT_ITEM",Yp="CATALOG/SET_SELECTED_ITEM",Zp="CHECKOUT_LIFECYCLE",Qp="INSTANT_PURCHASE/INITIATE",Xp="INSTANT_PURCHASE/PARTNER_RESPONSE";function ef(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:tf(t,i,o)})}function tf(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function nf(t){const n=a.useDispatch(),i=Et(),o=Tn(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=Gn(),d=Ut(c,"catalogItem");return e.jsx(wa,{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:Qp,payload:{catalogItem:c,quantity:1}})},className:null==a?void 0:a.own,children:e.jsx(Ht,{value:d,children:(null==a?void 0:a.own)?ef(t.schema.children,a.own,o,i,t.testId):tf(t.schema.children,i,t.testId)})})})}function af(n){const a=Tn(),i=ht(),{customStateKey:o,customStateValue:r}=n.schema,{tabIndex:s,styles:l,isDisabled:c}=m(a),d=()=>{i({type:Q,payload:{key:o,value:r}})};return e.jsx(wa,{styles:n.schema.styles,children:({classnames:a})=>{var i;return e.jsx("button",{className:null==a?void 0:a.own,onClick:d,"data-testid":n.testId,"data-e2e":"ButtonStateTrigger",disabled:c,"aria-disabled":c,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:void 0,tabIndex:s,style:Object.assign({backgroundColor:"transparent",cursor:"pointer",margin:0,padding:0},l),children:e.jsx(bt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}function of(n){const i=Et(),o=_n(),r=Wt(),s=ht(),l=Ot().catalogItems||[],c=a.useSelector((e=>e.selectedItem))||l[0];return t.useEffect((()=>{c&&s({type:Y,payload:{name:"SignalImpression",parentGuid:null==c?void 0:c.instanceGuid}})}),[c,s]),c?e.jsx(wa,{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($n,{context:c,children:e.jsx(Nn,{value:o(c),children:e.jsx(Ht,{value:(s=c,r({data:s},"catalogItem")),children:i(n.schema.template,void 0,n.testId?`${n.testId}-child`:"")})})}))});var s}}):null}function rf(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:i(t,void 0,o)})}function sf(e,t,n){return t(e,void 0,n)}const lf=["ArrowDown","ArrowUp","Enter","Escape","Tab"];function cf(n){const i=Ot(),o=Et(),r=Gn(),s=Wt(),l=e=>s({data:e},"catalogItem"),c=t.useMemo((()=>i.catalogItems||[]),[i]),d=Tn(),{styles:u,isDisabled:p}=m(d),f=t.useRef(null),y=t.useRef([]),[h,v]=t.useState(!1),[g,b]=t.useState(0),E=a.useDispatch();function I(){p||(h?S():x())}function x(){p||v(!0)}function S(){p||v(!1)}function w(e){b(c.indexOf(e)),S(),E({type:Kp,payload:{catalogItem:e}})}t.useEffect((()=>{if(h){const e=y.current[g];e&&e.focus()}}),[h,g]);const C={elements:{own:[{default:{background:{backgroundColor:{light:"#ffffff"}},dimension:{width:{type:"percentage",value:100}}}}]}};function O(e){if(!p&&lf.includes(e.key))switch(e.key){case"ArrowDown":{e.preventDefault();const t=g+1;t<c.length&&b(t);break}case"ArrowUp":{e.preventDefault();const t=g-1;t>=0&&b(t);break}case"Enter":if(e.preventDefault(),h){const e=c[g];e&&w(e)}else x();break;case"Tab":if(h){S();const e=c.indexOf(r);-1!==e&&b(e)}break;case"Escape":if(e.preventDefault(),h){S();const e=c.indexOf(r);-1!==e&&b(e)}}}return e.jsx(wa,{styles:n.schema.styles?M(C,n.schema.styles):C,children:({classnames:t,mapperRef:a})=>e.jsxs("div",{ref:f,className:null==t?void 0:t.own,onKeyDown:O,onClick:I,onBlur:e=>{var t;(null===(t=f.current)||void 0===t?void 0:t.contains(e.relatedTarget))||h&&S()},"data-e2e":"DropDown","data-testid":n.testId?`${n.testId}-drop-down-container`:void 0,"aria-disabled":p,style:Object.assign({position:"relative"},u),tabIndex:0,children:[e.jsx("div",{className:null==t?void 0:t.dropDownSelectedElement,"aria-disabled":p,"data-testid":n.testId?`${n.testId}-drop-down-selected-element`:void 0,style:Object.assign({cursor:"pointer"},u),children:e.jsx(Ht,{value:l(r),children:(null==t?void 0:t.dropDownSelectedElement)?rf(n.schema.closedTemplate,t.dropDownSelectedElement,a,o,n.testId):sf(n.schema.closedTemplate,o,n.testId)})}),h&&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"},u),children:c.map(((i,r)=>e.jsx("li",{ref:e=>function(e,t){y.current[t]=e}(e,r),className:null==t?void 0:t.dropDownListElement,onClick:e=>{e.stopPropagation(),p||w(i)},tabIndex:-1,"data-e2e":"DropDownItem","data-testid":n.testId?`${n.testId}-drop-down-item-${r}`:void 0,style:Object.assign({cursor:"pointer",display:"flex"},u),children:e.jsx(Ht,{value:l(i),children:(null==t?void 0:t.dropDownListElement)?rf(n.schema.openTemplate,t.dropDownListElement,a,o,n.testId):sf(n.schema.openTemplate,o,n.testId)})},i.catalogItemId)))})]})})}function df(n){const i=n.schema.styles,o=a.useDispatch(),r=a.useSelector((e=>e.staticData)),s=Tn(),{tabIndex:l,styles:c,isDisabled:d}=m(s),u=()=>{var e;o({type:Zp,payload:{event:"Checkout",targetStep:n.schema.targetStep,offerPositionIndex:null!==(e=null==r?void 0:r.position)&&void 0!==e?e:0}})};return e.jsx(wa,{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(bt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,U(a,n.testId)))))})})}})}const uf=/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/;function pf(t){const n=Wt(),a=Tn(),{schema:i,testId:o}=t,r=n(i.value),{tabIndex:s,styles:l,isDisabled:c}=m(a);return"string"==typeof(d=r)&&uf.test(d)?e.jsx(wa,{styles:i.styles,children:({classnames:t})=>e.jsx("div",{"aria-hidden":c,className:null==t?void 0:t.own,"data-e2e":"ColorSwatch","data-testid":o,style:Object.assign({backgroundColor:r},l),tabIndex:s})}):null;var d}function ff(n){const{schema:{imageKeys:a,styles:i},testId:o}=n,[r,s]=t.useState(0),l=Tn(),c=function(e){const n=t.useContext(Ln);return e.reduce(((e,t)=>{const a=n(`${t}.src`,"copy"),i=n(`${t}.title`,"copy");return void 0===a?e:[...e,C({light:a,title:i})]}),[])}(a),{styles:d,isDisabled:u,tabIndex:p}=m(l),f=c[r]||c[0];return c.length>0&&f?e.jsx(wa,{styles:i,children:({classnames:n})=>e.jsxs("div",{className:null==n?void 0:n.own,children:[e.jsx("img",{"aria-hidden":u,src:f.light,alt:f.alt,title:f.title,className:null==n?void 0:n.mainImage,style:d,"data-testid":`${o}-main-image`,"data-e2e":"ImageGallery-mainImage"}),e.jsx("div",{className:null==n?void 0:n.thumbnailList,style:Object.assign(Object.assign({},d),{display:"flex"}),children:t.Children.toArray(c.map(((t,a)=>e.jsx("img",{src:t.light,alt:t.alt,title:t.title,className:null==n?void 0:n.thumbnailImage,style:Object.assign(Object.assign({},d),{cursor:u?"not-allowed":"pointer",pointerEvents:"auto"}),"data-testid":`${o}-thumbnail-${a}`,"data-e2e":"ImageGallery-thumbnail",tabIndex:p,onClick:()=>s(a)}))))})]})}):null}const yf={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(nf,{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"ButtonStateTrigger":return e.jsx(af,{schema:n.node});case"CatalogCombinedCollection":return e.jsx(of,{schema:n.node});case"CatalogDropDown":return e.jsx(cf,{schema:n.node});case"CheckoutStateButtonTrigger":return e.jsx(df,{schema:n.node});case"ColorSwatch":return e.jsx(pf,{schema:n.node});case"ImageGallery":return e.jsx(ff,{schema:n.node});default:return}}}};function hf(){const t=Cn(),n=Et(),i=a.useSelector(_u),o=Wt()({state:i},"textContent");return e.jsx(It,{value:n,overrides:yf,children:e.jsx(Ht,{value:o,children:e.jsx(bt,{children:e=>e(t)})})})}const mf={staticData:Au,selectedItem:(e=null,t)=>t.type===Yp?t.payload:e,dynamicData:Ru,childLayouts:Tu};function vf(e={}){return Object.assign({staticData:null,selectedItem:null,dynamicData:null,childLayouts:{launched:{}}},e)}const gf="INVALID_RESPONSE_OBJECT";function bf(e,t){return l.eventChannel((n=>e.onEvent({name:rr.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_PARTNER_DATA",message:`Malformed data received from partner\n ${e}`})}})))}function*Ef(e,t){var n;try{for(;;){const t=yield r.take(e);t&&(yield r.put({type:Xp,payload:t}))}}catch(e){yield r.call(t,{level:j,code:"INSTANT_PURCHASE_CHANNEL_ERROR",message:null!==(n=e.message)&&void 0!==n?n:"Unknown error in instant-purchase channel"})}finally{e.close()}}function If(e){const t=function(e){var t,n;return null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[]}(e);return t[0]}const xf="Unknown failure reason";function*Sf(){const e=yield r.select(If);e&&(yield*Af(e))}function*wf(e){const{catalogItem:t}=e.payload;yield*Af(t)}function*Cf(e,t,n){const{catalogItem:a,quantity:i}=n.payload,o=xo(a,i);o?(yield r.put({type:Y,payload:{name:"SignalCartItemInstantPurchaseInitiated",parentGuid:a.instanceGuid,objectData:{catalogItemId:a.catalogItemId,quantity:i}}}),yield r.fork(Tf,e,t),yield r.put({type:X,payload:{name:"CART_ITEM_INSTANT_PURCHASE",body:{upsellItems:[o],totalUpsellPrice:o.totalPrice||0,currency:o.currency}}})):yield r.call(t,{level:j,code:gf,message:`Unable to translate catalog item with ID ${a.catalogItemId} to cart item for instant purchase transaction.`})}function*Of(e,t){const n=yield r.select((e=>e.staticData));if(!n)return yield r.call(e,{level:j,code:"MISSING_STATIC_DATA_IN_INSTANT_PURCHASE_MODULE",message:"App state is not configured with static data."}),void(yield*Lf("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*Lf("Error"));const a={accountId:n.offer.accountId,catalogItems:n.offer.catalogItems};let i,o;t.payload.success?(i=Rf,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=jf(a,t.catalogItems);void 0===e?i.push(a):yield r.put({type:Y,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:gf,message:`Unable to map cart items to catalog items in the instant purchase partner response: ${n}.`})}(i,a))}(t.payload,a,i,e),yield*Lf(o)}function*Tf(e,t){const n=bf(e,t),{timeout:a}=yield r.race({channelListener:r.call(Ef,n,t),timeout:r.delay(6e4)});a&&(yield r.call(t,{level:j,code:"INSTANT_PURCHASE_RESPONSE_TIMEOUT",message:"Instant-purchase response timed out after 60000ms"}),n.close(),yield r.put({type:Z,payload:{event:"Dismissed",dismissalReason:"Implicit"}}))}function*Af(e){var t,n,a;yield r.put({type:Yp,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:Ou,payload:{text:i}})}function Rf(e,t){return{name:"SignalCartItemInstantPurchase",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,initiatedBy:T.DCUI}}}function jf(e,t){return t.find((t=>t.catalogItemId===e.catalogItemId))}function*Lf(e){yield r.put({type:Z,payload:{event:"Completed",completionReason:e}})}function*Nf(e){"Checkout"===e.payload.event&&(yield r.put({type:ee,payload:{key:"checkout",value:_f(e.payload),offerPositionIndex:e.payload.offerPositionIndex}}))}function _f(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*Df(e,t){yield r.all([r.spawn(Sf),r.takeEvery(Zp,Nf),r.takeEvery(Kp,wf),r.takeLatest(Qp,Cf.bind(null,e,t)),r.takeLatest(Xp,Of.bind(null,t)),r.takeEvery(oe,ku.bind(null,e,t)),r.takeEvery("*",Io.bind(null,[z,oe],e))])}Object.assign(Object.assign({},re),{INITIATE_INSTANT_PURCHASE:Qp,INSTANT_PURCHASE_PARTNER_RESPONSE:Xp});const kf=(new En).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=vf({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=vf()){const a=l(),i=s.configureStore({reducer:mf,devTools:{name:"Instant Purchase"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Df,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(kn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Oi,{}),e.jsx(a.Provider,{store:d,children:e.jsx(wi,{settings:i,dispatch:d.dispatch,children:e.jsx(hf,{})})})]})}))}}));var Pf=Object.freeze({__proto__:null,moduleConnectorBuilder:kf});const $f=t.createContext(null),Gf=({children:n})=>{var a;const[i,o]=t.useState([]),[r,s]=t.useState(0),[l,c]=t.useState(0),d=Wt();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($f.Provider,{value:{images:i,activeIndex:r,duration:l,setImages:o,setActiveIndex:s,setDuration:c},children:e.jsx(Ht,{value:d({data:{"image.title":null===(a=i[r])||void 0===a?void 0:a.title}},"creativeCopy"),children:n})})};function Ff({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 Mf(e){const n=t.useContext(Ln),a=[];return e.forEach((e=>{const t=n(`${e}.src`,"copy"),i=n(`${e}.title`,"copy");if(void 0===t)return;const o=C({light:t,title:i});a.push(o)})),a}function Bf({schema:n,testId:a}){const i=JSON.parse(n.data),{styles:o,duration:r,imageKeys:s}=i,l=t.useContext($f),c=Mf(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(Ff,{duration:r,active:n===(null==l?void 0:l.activeIndex),containerStyles:o.elements.indicatorContainer,indicatorStyles:o.elements.indicator}))))})]})}const Uf={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"]},Vf=new Map([["&","_;^;_"]]),zf=new RegExp(`<a *(?=${Uf.allowedAttributes.a.join("|")}|>)`,"g"),qf=new RegExp("<span*>","g"),Hf=new RegExp(`<a *(?:(?:${Uf.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),Wf=new RegExp("(<br *?>)|(<br *?/>)","g"),Jf="<br/>";function Kf(n){const a=Wt(),i=Tn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Hf,((e,t)=>{const n=t.replaceAll("&",Vf.get("&"));return e.replace(t,n)})).replaceAll(Wf,Jf)}(e);return t===u(t,Uf)}(e))throw new L("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(wa,{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(zf,`<a ${a.join(" ")}`).replace(qf,`<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(zf,`<a ${a.join(" ")}`).replace(qf,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}});var i}}):null}function Yf({schema:n}){const a=Et(),i=ct(Mn(),Xt()),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 Kf=(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 Yf({disabled:t,onClick:n}){const a=ct(Mn(),Xt());return e.jsx("button",{onClick:n,disabled:t,className:a`
176
- ${Kf(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 Zf({disabled:t,onClick:n}){const a=ct(Mn(),Xt());return e.jsx("button",{onClick:n,disabled:t,className:a`
178
- ${Kf(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 Qf(e){const n=t.useContext(Ln);return e.map((e=>({src:n(`${e}.link.src`,"copy"),open:n(`${e}.link.open`,"copy")})))}function Xf(e){return{type:"StaticImage",node:{url:e,styles:{elements:{own:[{default:{border:{borderRadius:5,borderWidth:"0"},dimension:{width:{type:"percentage",value:100}}}}]}}}}}function ey(e,t){return{type:"CreativeResponse",node:{responseKey:"positive",styles:{elements:{own:[{default:{spacing:{padding:"0"},background:{backgroundColor:{light:"#F9FAFB"}},border:{borderWidth:"0"}}}]}},children:t?[Xf(t)]:[]}}}function ty({schema:n}){var a,i;const o=Et(),r=ct(Mn(),Xt()),s=function(e){try{return JSON.parse(e.data)}catch(e){return null}}(n),[l,c]=[Gf((null===(a=null==s?void 0:s.body)||void 0===a?void 0:a.imageKeys)||[]),Qf((null===(i=null==s?void 0:s.body)||void 0===i?void 0:i.imageKeys)||[])],u=Ot(),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,E]=d({loop:!1,align:"start",slidesToScroll:h,containScroll:"trimSnaps"}),{prevBtnDisabled:I,nextBtnDisabled:x,onPrevButtonClick:S,onNextButtonClick:w}=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}}(E);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 Zf=(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 Qf({disabled:t,onClick:n}){const a=ct(Mn(),Xt());return e.jsx("button",{onClick:n,disabled:t,className:a`
176
+ ${Zf(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 Xf({disabled:t,onClick:n}){const a=ct(Mn(),Xt());return e.jsx("button",{onClick:n,disabled:t,className:a`
178
+ ${Zf(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 ey(e){const n=t.useContext(Ln);return e.map((e=>({src:n(`${e}.link.src`,"copy"),open:n(`${e}.link.open`,"copy")})))}function ty(e){return{type:"StaticImage",node:{url:e,styles:{elements:{own:[{default:{border:{borderRadius:5,borderWidth:"0"},dimension:{width:{type:"percentage",value:100}}}}]}}}}}function ny(e,t){return{type:"CreativeResponse",node:{responseKey:"positive",styles:{elements:{own:[{default:{spacing:{padding:"0"},background:{backgroundColor:{light:"#F9FAFB"}},border:{borderWidth:"0"}}}]}},children:t?[ty(t)]:[]}}}function ay({schema:n}){var a,i;const o=Et(),r=ct(Mn(),Xt()),s=function(e){try{return JSON.parse(e.data)}catch(e){return null}}(n),[l,c]=[Mf((null===(a=null==s?void 0:s.body)||void 0===a?void 0:a.imageKeys)||[]),ey((null===(i=null==s?void 0:s.body)||void 0===i?void 0:i.imageKeys)||[])],u=Ot(),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,E]=d({loop:!1,align:"start",slidesToScroll:h,containScroll:"trimSnaps"}),{prevBtnDisabled:I,nextBtnDisabled:x,onPrevButtonClick:S,onNextButtonClick:w}=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}}(E);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(Yf,{onClick:S,disabled:I}):null,e.jsx("div",Object.assign({},v&&{ref:b},{className:r`
183
+ `,children:[v?e.jsx(Qf,{onClick:S,disabled:I}):null,e.jsx("div",Object.assign({},v&&{ref:b},{className:r`
184
184
  width: 100%;
185
185
  margin: auto;
186
186
  overflow: hidden;
@@ -192,4 +192,4 @@
192
192
  overflow: hidden;
193
193
  aspect-ratio: ${m};
194
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)?ey(c[n],t):Xf(t))})})})))})})),v?e.jsx(Zf,{onClick:w,disabled:x}):null]}):null}function ny({schema:t}){const n=JSON.parse(t.data),{styles:a,content:i,smallFontSize:o,largeFontSize:r}=n,s=Wt(),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 ay={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(Ff,{schema:t.node});case"RichText":return e.jsx(Wf,{schema:n.node});case"ProductTierCarousel":return e.jsx(Jf,{schema:t.node});case"ProductCatalogCarousel":return e.jsx(ty,{schema:t.node});case"TextAnimate":return e.jsx(ny,{schema:t.node});default:return}}}};function iy(){const t=Cn(),n=Et();return e.jsx(Pf,{children:e.jsx(It,{value:n,overrides:ay,children:e.jsx(bt,{children:e=>e(t)})})})}const oy={staticData:Ou,childLayouts:Cu};function ry(e={}){return Object.assign({staticData:null,childLayouts:{launched:{}}},e)}function sy(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*ly(e,t){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Z,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":t({type:Z,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Z,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*cy(e,t,n){const a=W(n.payload)||J(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:X,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),yield*function*(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n;yield r.put({type:Y,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(sy,o);if("object"==typeof t&&"take"in t)return void(yield r.call(ly,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*dy(e,t){yield r.all([r.takeLatest(z,cy.bind(null,e,t)),r.takeEvery(oe,_u.bind(null,e,t)),r.takeEvery("*",Io.bind(null,[z,oe],e))])}Object.assign({},re);const uy=(new En).withAppFactory((function(i){if(i.rootElement){const o=n.createRoot(i.rootElement),r=ry({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),c=function(e,t,n=ry()){const a=l(),i=s.configureStore({reducer:oy,devTools:{name:"layouts-xp-sandbox"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(dy,e,t),i}(i.gateway,i.logger,r);o.render(e.jsx(t.StrictMode,{children:e.jsxs(kn,{info:{layoutType:"LayoutVariant",referralCreativeId:String(i.offerData.creative.referralCreativeId)||"N/A"},children:[e.jsx(Oi,{}),e.jsx(a.Provider,{store:c,children:e.jsx(wi,{settings:i,dispatch:c.dispatch,children:e.jsx(iy,{})})})]})}))}}));var py=Object.freeze({__proto__:null,moduleConnectorBuilder:uy});exports.BehaviorSubject=class extends mu{constructor(e){super(),this._lastValue=e}subscribe(e,t,n){const a=yu(e,t,n);return a.next(this._lastValue),super.subscribe(a)}next(e){return this._lastValue=e,super.next(e)}getValue(){return this._lastValue}},exports.CatchSubscriber=bu,exports.DisplayPreset={FULLSCREEN:"DisplayPreset.FULLSCREEN",EMBEDDED:"DisplayPreset.EMBEDDED",ATTACHED:"DisplayPreset.ATTACHED"},exports.ErrorLevel={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},exports.FirstValueFromError=vu,exports.Observable=hu,exports.ReplaySubject=class extends mu{constructor(e=-1){super(),this._buffer=[],this._error=null,this._bufferLength=e}subscribe(e,t,n){const a=yu(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=mu,exports.Subscription=pu,exports.addCatchToSubscriber=function(e,t){return new bu(e,t)},exports.combineLatest=(...e)=>new hu((t=>{if(!e.length)return t.complete(),fu;const n=new pu,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=xu,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(vu.CompletedBeforeEmit))}))})).then((e=>(n.unsubscribe(),e))).catch((e=>{throw n.unsubscribe(),e}))},exports.fromEvent=(e,t)=>new hu((n=>{const a=e=>n.next(e);return e.addEventListener(t,a),()=>e.removeEventListener(t,a)})),exports.fromPromise=function(e){return new hu((t=>{e.then((e=>{t.next(e),t.complete()}),(e=>t.error(e)))}))},exports.init=function(i,o){return du(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=cu(o);l.render(e.jsxs(t.StrictMode,{children:[e.jsx(Oi,{}),e.jsx(a.Provider,{store:c,children:e.jsxs(Fn.Provider,{value:r,children:[e.jsx(Uo,{}),e.jsx(xt.Provider,{value:i,children:e.jsx(li,{extensions:uu,extendStore:c.extend.bind(c),children:e.jsx(Rl,{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 Eu(n)},exports.merge=(...e)=>new hu((t=>{const n=new pu;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=fu,exports.normaliseToObserver=yu,exports.of=(...e)=>new hu((t=>{for(const n of e)t.next(n)})),exports.pipe=e=>(...t)=>new hu((n=>{const a=e.subscribe((e=>Iu(void 0,void 0,void 0,(function*(){try{let a=new Eu(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);
195
+ `,children:o((null===(i=null==c?void 0:c[n])||void 0===i?void 0:i.src)?ny(c[n],t):ty(t))})})})))})})),v?e.jsx(Xf,{onClick:w,disabled:x}):null]}):null}function iy({schema:t}){const n=JSON.parse(t.data),{styles:a,content:i,smallFontSize:o,largeFontSize:r}=n,s=Wt(),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 oy={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(Bf,{schema:t.node});case"RichText":return e.jsx(Kf,{schema:n.node});case"ProductTierCarousel":return e.jsx(Yf,{schema:t.node});case"ProductCatalogCarousel":return e.jsx(ay,{schema:t.node});case"TextAnimate":return e.jsx(iy,{schema:t.node});default:return}}}};function ry(){const t=Cn(),n=Et();return e.jsx(Gf,{children:e.jsx(It,{value:n,overrides:oy,children:e.jsx(bt,{children:e=>e(t)})})})}const sy={staticData:Au,childLayouts:Tu};function ly(e={}){return Object.assign({staticData:null,childLayouts:{launched:{}}},e)}function cy(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*dy(e,t){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Z,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":t({type:Z,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Z,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*uy(e,t,n){const a=W(n.payload)||J(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:X,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),yield*function*(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n;yield r.put({type:Y,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(cy,o);if("object"==typeof t&&"take"in t)return void(yield r.call(dy,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*py(e,t){yield r.all([r.takeLatest(z,uy.bind(null,e,t)),r.takeEvery(oe,ku.bind(null,e,t)),r.takeEvery("*",Io.bind(null,[z,oe],e))])}Object.assign({},re);const fy=(new En).withAppFactory((function(i){if(i.rootElement){const o=n.createRoot(i.rootElement),r=ly({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),c=function(e,t,n=ly()){const a=l(),i=s.configureStore({reducer:sy,devTools:{name:"layouts-xp-sandbox"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(py,e,t),i}(i.gateway,i.logger,r);o.render(e.jsx(t.StrictMode,{children:e.jsxs(kn,{info:{layoutType:"LayoutVariant",referralCreativeId:String(i.offerData.creative.referralCreativeId)||"N/A"},children:[e.jsx(Oi,{}),e.jsx(a.Provider,{store:c,children:e.jsx(wi,{settings:i,dispatch:c.dispatch,children:e.jsx(ry,{})})})]})}))}}));var yy=Object.freeze({__proto__:null,moduleConnectorBuilder:fy});exports.BehaviorSubject=class extends gu{constructor(e){super(),this._lastValue=e}subscribe(e,t,n){const a=mu(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=Iu,exports.DisplayPreset={FULLSCREEN:"DisplayPreset.FULLSCREEN",EMBEDDED:"DisplayPreset.EMBEDDED",ATTACHED:"DisplayPreset.ATTACHED"},exports.ErrorLevel={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},exports.FirstValueFromError=bu,exports.Observable=vu,exports.ReplaySubject=class extends gu{constructor(e=-1){super(),this._buffer=[],this._error=null,this._bufferLength=e}subscribe(e,t,n){const a=mu(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=gu,exports.Subscription=yu,exports.addCatchToSubscriber=function(e,t){return new Iu(e,t)},exports.combineLatest=(...e)=>new vu((t=>{if(!e.length)return t.complete(),hu;const n=new yu,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=wu,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(bu.CompletedBeforeEmit))}))})).then((e=>(n.unsubscribe(),e))).catch((e=>{throw n.unsubscribe(),e}))},exports.fromEvent=(e,t)=>new vu((n=>{const a=e=>n.next(e);return e.addEventListener(t,a),()=>e.removeEventListener(t,a)})),exports.fromPromise=function(e){return new vu((t=>{e.then((e=>{t.next(e),t.complete()}),(e=>t.error(e)))}))},exports.init=function(i,o){return pu(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=uu(o);l.render(e.jsxs(t.StrictMode,{children:[e.jsx(Oi,{}),e.jsx(a.Provider,{store:c,children:e.jsxs(Fn.Provider,{value:r,children:[e.jsx(Uo,{}),e.jsx(xt.Provider,{value:i,children:e.jsx(li,{extensions:fu,extendStore:c.extend.bind(c),children:e.jsx(Rl,{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 xu(n)},exports.merge=(...e)=>new vu((t=>{const n=new yu;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=hu,exports.normaliseToObserver=mu,exports.of=(...e)=>new vu((t=>{for(const n of e)t.next(n)})),exports.pipe=e=>(...t)=>new vu((n=>{const a=e.subscribe((e=>Su(void 0,void 0,void 0,(function*(){try{let a=new xu(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);