@rokt/dcui-orchestrator 0.0.2-rc.4 → 0.0.2-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extensions/minimized-bottomsheet/src/hooks/useScrollTrap.d.ts +2 -0
- package/dist/index.cjs +40 -30
- package/dist/index.js +43 -33
- package/dist/libraries/dcui-components/src/components/child-layout-handler/child-layout-handler.d.ts +5 -0
- package/dist/libraries/dcui-components/src/components/child-layout-handler/index.d.ts +1 -0
- package/dist/libraries/dcui-components/src/components/index.d.ts +1 -0
- package/dist/libraries/dcui-components/src/components/partner-event-button-trigger/factory.d.ts +2 -0
- package/dist/libraries/dcui-components/src/components/partner-event-button-trigger/index.d.ts +2 -0
- package/dist/libraries/dcui-components/src/components/partner-event-button-trigger/partner-event-button-trigger.d.ts +6 -0
- package/dist/libraries/dcui-components/src/contexts/index.d.ts +1 -1
- package/dist/libraries/dcui-components/src/contexts/schema-version-context.d.ts +2 -0
- package/dist/libraries/domain/src/behaviors/child-layout.d.ts +6 -0
- package/dist/libraries/domain/src/behaviors/global-actions.d.ts +3 -1
- package/dist/libraries/domain/src/behaviors/index.d.ts +1 -0
- package/dist/libraries/domain/src/behaviors/offer-engagement.d.ts +1 -0
- package/dist/libraries/domain/src/behaviors/send-partner.d.ts +14 -2
- package/dist/libraries/domain/src/models/layout/index.d.ts +1 -0
- package/dist/libraries/domain/src/models/layout/layout-child-config.d.ts +4 -0
- package/dist/libraries/domain/src/models/layout/layout-child-layout.d.ts +8 -0
- package/dist/libraries/domain/src/models/layout/layout-variant.d.ts +3 -1
- package/dist/libraries/domain/src/models/partner-event.d.ts +1 -1
- package/dist/libraries/domain/src/models/plugin/index.d.ts +1 -0
- package/dist/libraries/domain/src/models/plugin/plugin-child-layout-model.d.ts +6 -2
- package/dist/libraries/domain/src/models/plugin/plugin-creative-response-option.d.ts +4 -0
- package/dist/libraries/domain/src/models/plugin/plugin-layout-child.d.ts +9 -0
- package/dist/libraries/domain/src/models/plugin/plugin-layout-variant.d.ts +2 -0
- package/dist/libraries/domain/src/models/plugin/plugin-offer.d.ts +3 -0
- package/dist/libraries/domain/src/models/signals.d.ts +7 -1
- package/dist/libraries/layout-renderer-utils/src/actions/custom-states.d.ts +1 -0
- package/dist/libraries/module-connector/src/main.d.ts +3 -3
- package/dist/libraries/module-connector/src/models/module-attributes.d.ts +3 -1
- package/dist/libraries/module-connector/src/models/module-connector-builder.d.ts +5 -3
- package/dist/libraries/module-connector/src/models/module.d.ts +1 -1
- package/dist/libraries/orchestrator/src/actions/domain-states.d.ts +1 -0
- package/dist/libraries/orchestrator/src/actions/index.d.ts +2 -2
- package/dist/libraries/orchestrator/src/actions/offer-lifecycle.d.ts +1 -0
- package/dist/modules/add-to-cart/src/models/state/index.d.ts +0 -1
- package/dist/modules/add-to-cart/src/reducers/index.d.ts +5 -3
- package/dist/modules/add-to-cart/src/sagas/index.d.ts +1 -0
- package/dist/modules/instant-purchase/src/channels/channel.d.ts +3 -3
- package/dist/modules/instant-purchase/src/components/drop-down/drop-down.d.ts +7 -6
- package/dist/modules/instant-purchase/src/components/image-gallery/image-gallery.d.ts +28 -0
- package/dist/modules/instant-purchase/src/hooks/index.d.ts +1 -0
- package/dist/modules/instant-purchase/src/hooks/use-image-mapper.d.ts +2 -0
- package/dist/modules/instant-purchase/src/reducers/index.d.ts +4 -3
- package/dist/modules/instant-purchase/src/sagas/error-codes.d.ts +2 -0
- package/dist/modules/instant-purchase/src/sagas/index.d.ts +1 -0
- package/dist/modules/instant-purchase/src/sagas/instant-purchase/sagas.d.ts +8 -3
- package/dist/modules/layouts-xp-sandbox/src/reducers/index.d.ts +6 -4
- package/dist/modules/layouts-xp-sandbox/src/sagas/index.d.ts +1 -0
- package/dist/modules/standard-marketing/src/reducers/index.d.ts +8 -4
- package/dist/modules/standard-marketing/src/sagas/error-codes.d.ts +2 -0
- package/dist/modules/standard-marketing/src/sagas/index.d.ts +1 -0
- package/dist/modules/standard-marketing/src/sagas/offer-engagement/channels.d.ts +8 -1
- package/dist/modules/standard-marketing/src/sagas/offer-engagement/sagas.d.ts +4 -3
- package/node_modules/@rokt/plugin/interface/child-plugin-factory.d.ts +1 -0
- package/node_modules/@rokt/plugin/interface/rdn.d.ts +1 -0
- package/node_modules/@rokt/plugin/package.json +1 -1
- package/package.json +2 -2
- package/dist/libraries/dcui-components/src/contexts/when-visibility-context.d.ts +0 -6
- package/dist/modules/add-to-cart/src/models/state/static-data.d.ts +0 -5
- package/dist/modules/add-to-cart/src/reducers/static-data/index.d.ts +0 -1
- package/dist/modules/add-to-cart/src/reducers/static-data/reducer.d.ts +0 -4
- package/dist/modules/instant-purchase/src/models/index.d.ts +0 -1
- package/dist/modules/instant-purchase/src/models/state/index.d.ts +0 -1
- package/dist/modules/instant-purchase/src/models/state/static-data.d.ts +0 -5
- package/dist/modules/instant-purchase/src/reducers/static-data/index.d.ts +0 -1
- package/dist/modules/instant-purchase/src/reducers/static-data/reducer.d.ts +0 -4
- package/dist/modules/layouts-xp-sandbox/src/reducers/mock/index.d.ts +0 -1
- package/dist/modules/layouts-xp-sandbox/src/reducers/mock/reducer.d.ts +0 -9
- package/dist/modules/standard-marketing/src/reducers/mock/index.d.ts +0 -1
- package/dist/modules/standard-marketing/src/reducers/mock/reducer.d.ts +0 -9
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("react-dom/client"),a=require("react-redux"),i=require("ramda"),o=require("@emotion/css"),r=require("redux-saga/effects"),s=require("@reduxjs/toolkit"),l=require("redux-saga"),c=require("@redux-saga/core/effects"),d=require("embla-carousel-react"),u=require("insane"),p=require("@emotion/css/create-instance");function f(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var y=f(t);function m(e){const t=["elements","own"],n=["default","dimension","width","type"],a=["default","dimension","width","value"],o=["default","dimension","minWidth"],r=i.path(t,e);return r&&Array.isArray(r)&&r.length?i.assocPath(t,r.map(i.when(i.allPass([i.hasPath(n),i.complement(i.hasPath(o)),i.pathEq("fixed",n)]),(e=>i.assocPath(o,i.path(a,e),e)))),e):e}function h(e){const t="DISABLED"===e;return{tabIndex:t?-1:void 0,styles:t?{pointerEvents:"none",userSelect:"none"}:void 0,isDisabled:t}}function v(e,t){if("EscapeHatch"===t.type)try{return JSON.parse(t.node.data).type===e}catch(e){return!1}return!1}function g(){return"ontouchstart"in document.documentElement}function b(e){return null!=e&&"object"==typeof e&&("url"in e||"name"in e)&&"config"in e}function E(e){return null!=e&&"object"==typeof e&&"id"in e&&"action"in e&&"instanceGuid"in e&&"signalType"in e}function I(e){return E(e)&&"External"===e.action}const S={pluginId:"shared",pageInstanceGuid:"N/A"};var x;!function(e){e.DCUI="DCUI",e.Partner="partner"}(x||(x={}));const O=["SignalCartItemQuantitySelected"],w="ERROR",C="WARNING";class A extends Error{constructor(e,t){super(t),this.code=null!=e?e:"UNHANDLED_EXCEPTION"}toString(){return`CodedError (${this.code}): ${this.message}`}}const T=["V2_CART_ITEM_UPDATED","CART_ITEM_INSTANT_PURCHASE","OFFER_ENGAGEMENT","POSITIVE_ENGAGEMENT","REALTIME_OFFER_FULFILLMENT_REFERRAL","PLACEMENT_CLOSED","PLACEMENT_COMPLETED","PLACEMENT_INTERACTIVE","PLACEMENT_FAILURE"];const j=(e,t)=>i.concat(e,i.slice(e.length,t.length,t)),R=(e,t)=>{if(Array.isArray(e)&&Array.isArray(t)){const n=e.length>t.length?j(t,e):t,a=t.length>e.length?j(e,t):e;return i.zipWith(P,a,n)}return t},N=e=>null==e,_=e=>!N(e),D=(e,t)=>N(t)?e:t,k=(e,t)=>{throw new A("MERGE_TYPE_INCONSISTENCY",`Unable to merge values for inconsistent types, left = ${e}, right = ${t}`)};function P(e,t){return i.cond([[(e,t)=>i.type(e)!==i.type(t)&&_(e)&&_(t),k],[(e,t)=>N(e)||N(t),D],[(e,t)=>"Object"===i.type(e),i.mergeDeepWith(P)],[(e,t)=>"Array"===i.type(e),R],[i.T,i.flip(i.unary(i.identity))]])(e,t)}function L(e,t){return P(e,t)}function $(e=0){return`breakpoint-${e}px`}function G(e,t){return t?`${t}-child${e}`:void 0}const F="GLOBAL/RAISE_METRIC",M="GLOBAL/OFFER_ENGAGEMENT";function B(e){return null!=e&&"object"==typeof e&&"responseOption"in e&&function(e){return E(e)&&"Fulfillment"===e.action}(e.responseOption)&&"fulfillment"in e&&b(e.fulfillment)}function U(e){return I(e)}function V(e){return function(e){return E(e)&&"Url"===e.action}(e)}function z(e){return function(e){return E(e)&&"CaptureOnly"===e.action}(e)}const q="GLOBAL/RAISE_SIGNAL",H="GLOBAL/OFFER_LIFECYCLE",W="GLOBAL/SET_CUSTOM_STATE",J="GLOBAL/SEND_PARTNER",K="GLOBAL/PREPARE_SIGNAL",Y="GLOBAL/OPEN_LINK",Z="GLOBAL/SET_PARTNER_VALIDATION_STATUS",Q="GLOBAL/SET_GLOBAL_OFFER_DATA_CART",X={RAISE_METRIC:F,PREPARE_SIGNAL:K,OFFER_ENGAGEMENT:M,RAISE_SIGNAL:q,OFFER_LIFECYCLE:H,SEND_PARTNER:J,SET_CUSTOM_STATE:W,SET_DOMAIN_STATE:"GLOBAL/SET_DOMAIN_STATE",OPEN_LINK:Y,SET_PARTNER_VALIDATION_STATUS:Z,SET_GLOBAL_OFFER_DATA_CART:Q},ee="data-open-in-app",te="data-click-signal-context";function ne(e,n){function a(e){var t;if(!(e.target&&e.target instanceof HTMLElement))return;const a=null===(t=e.target)||void 0===t?void 0:t.closest("a");if(a){const t=a.getAttribute("href"),i=a.getAttribute(te);if(i&&n({type:q,payload:{name:"SignalUserInteraction",action:"Click",context:i}}),t){e.preventDefault();let i="newTab";a.hasAttribute(ee)&&(i="inApp"),n({type:Y,payload:{url:t,urlBehaviour:i}})}}}t.useEffect((()=>null!==e?(e.addEventListener("click",a),()=>{e.removeEventListener("click",a)}):()=>{}),[e])}function ae(){const e=t.useRef(null);return t.useEffect((()=>{const t=t=>{"Tab"===t.key&&ie(t,e)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)}),[e]),e}const ie=(e,t)=>{var n;const a=null===(n=t.current)||void 0===n?void 0:n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!a)return;const i=a[0],o=a[a.length-1],{activeElement:r}=window.document;if(1!==a.length)return r===i&&e.shiftKey?(o&&o.focus(),void e.preventDefault()):r!==o||e.shiftKey?void 0:(i&&i.focus(),void e.preventDefault());e.preventDefault()},oe="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DISPLAY_ERRORS:"true",REPORT_RENDER_ERRORS:"true",USE_MEDIA_QUERY_NESTING:"true"};function re(e,t){return t?"false"!==oe.USE_MEDIA_QUERY_NESTING?`${n=e,`@media (min-width: ${n}px)`} {${t}}`:t.includes(" & ")?`#app-container.${$(e)} ${t.trim()}`:`#app-container.${$(e)} & {${t}}`:"";var n}const se={hovered:":hover",pressed:":active",focussed:":focus",disabled:":disabled"};function le(e){return function(e){return Object.keys(se).indexOf(e)>-1}(e)?se[e]:""}const ce={container:{justifyContent:"justify-content",alignItems:"align-items",shadow:"box-shadow",gap:"gap",overflow:"overflow",blur:"filter",opacity:"opacity"},text:{textColor:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",lineHeight:"line-height",lineLimit:"",letterSpacing:"letter-spacing",baselineTextAlign:"vertical-align",horizontalTextAlign:"text-align",textDecoration:"text-decoration",textTransform:"text-transform"},background:{backgroundColor:"background-color",backgroundImage:""},dimension:{width:"width",maxWidth:"max-width",minWidth:"min-width",height:"height",maxHeight:"max-height",minHeight:"min-height",rotateZ:"transform"},flexChild:{alignSelf:"align-self",weight:"flex",order:"order"},spacing:{margin:"margin",padding:"padding",offset:""},border:{borderColor:"border-color",borderRadius:"border-radius",borderWidth:"border-width",borderStyle:"border-style"}};function de(e,t){if(!ce[e]||!ce[e][t])throw new Error(`No CSS property mapping exists for styling property: ${e}.${t.toString()}`);return ce[e][t]}function ue(e,t){return n=>t(...Object.keys(e).map((t=>e[t](n[t]))))}function pe(...e){let t="";const n=(...e)=>e.reduce(((e,n)=>(e&&n?e=e+t+n:n&&(e=n),e)),"");return 1===e.length?(t=e[0],n):n(...e)}function fe(e,t){return`${e}:${t};`}function ye(e){return function(e,t){return`@media (${e}) {${t}}\n`}("prefers-color-scheme: dark",e)}class me extends Error{constructor(e,t){super(`Invalid styling value '${t}': ${e}.`),this.name=this.constructor.name}}function he(e,t){if(null===t)return!1;const n=("function"==typeof e?[e]:e).map((e=>e(t))).reduce(((e,t)=>t?e?e+=`, ${t}`:t:e),void 0);if(n)throw new me(n,JSON.stringify(t));return!0}function ve(e){if(isNaN(e)||"number"!=typeof e&&"string"!=typeof e)return"value must be a number"}function ge(e){return t=>{const n=t&&"symbol"!=typeof t?t.toString():t;if(!(e.indexOf(n)>=0))return`value must be one of [${e.join(",")}]`}}function be(e){if(null==e||""===e)return"value must not be omitted"}function Ee(e){const t=new RegExp(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/);if("string"!=typeof e||!t.test(e))return"value must be a valid hex color"}function Ie(e){const t=new RegExp(/^(?:(?:data:image\/[^;]+;base64[^"]+)|(?:(?:https?:)?\/\/[a-zA-Z\d-]+(?:\.[a-zA-Z\d-]+)*(?::\d{1,10})?)?(?:\.\.?\/?)*\/(?:[a-zA-Z\d\-_]+\/)*[a-zA-Z\d\-_]+\.[a-zA-Z\d]{2,6}(?:\?(?:.+=.+&?)*)?)(?:#.+)?$/);if("string"!=typeof e||!t.test(e))return"value must be a valid CSS URL string"}function Se(e){if(null!=e&&""!==e)return"value must not be specified"}function xe(e){return t=>{if(t&&"object"==typeof t&&"value"in t&&"type"in t&&"string"==typeof t.type&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t.type)&&"function"==typeof e[t.type]){const n=e[t.type](t.value);if(!n)return;return`object must have valid "value" for type: ${t.type}: ${n}`}return`value must be an object that has a "type" property that matches one of: [${Object.keys(e).join(", ")}] and a "value" property`}}function Oe(...e){return t=>{if("string"==typeof t){const n=t.split(" ");if(n.length>1&&e.indexOf(n.length)>-1){if(!n.reduce(((e,t)=>e||ve(t)),void 0))return}}return`value must be a space separated list of numbers, of one of the following lengths: ${e.join(" ,")}`}}function we(e,t){return n=>{const a=e(n),i=t(n);if(a&&i)return`one of these must be true: ${a} -OR- ${i}`}}function Ce(e){if("string"!=typeof e)return"value must be a string"}const Ae=i.is(Object);function Te(e){const t=Object.entries(e);return n=>Ae(n)&&!Array.isArray(n)?t.reduce(((e,[t,a])=>e||a(n[t])),void 0):`Input value (${e}) must be an object`}function je(e){if("number"!=typeof e&&"string"!=typeof e||isNaN(e)||!(e>=0))return"value must be a positive number"}function Re(e,t,n){return he(ve,n)?fe(de(e,t),`${n}`):""}function Ne(e){return(t,n,a)=>he(ge(Object.keys(e)),a)?fe(de(t,n),`${e[a]}`):""}function _e(e){return he(be,e)?ue({light:t(Ie,!1),dark:t(we(Se,Ie),!0)},pe("\n "))(e):"";function t(e,t){return n=>{if(he(e,n)&&n){const e=fe("background-image",`url("${n}")`);return t?ye(e):e}return""}}}function De(e){const t={crop:"auto",fit:"contain",fill:"cover"};return"string"==typeof e&&(e=e.toLowerCase()),he(we(Se,ge(Object.keys(t))),e)&&e?fe("background-size",t[e]):""}const ke=i.cond([[i.equals("top-left"),i.always("top left")],[i.equals("top-right"),i.always("top right")],[i.equals("bottom-left"),i.always("bottom left")],[i.equals("bottom-right"),i.always("bottom right")],[i.T,i.identity]]);function Pe(e){const t="string"==typeof e?e.toLowerCase():e;return he(we(Se,ge(["top","right","bottom","left","center","top-left","top-right","bottom-left","bottom-right"])),t)&&t?fe("background-position",ke(t)):""}function Le(e,t,n){return he(we(ve,Oe(2,3,4)),n)?fe(de(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function $e(e){return(t,n,a)=>he(xe({fit:ge(e),percentage:ve,fixed:ve}),a)?fe(de(t,n),function(e){const t={"wrap-content":"fit-content","fit-width":"100%","fit-height":"100%"};switch(e.type){case"fixed":return`${e.value}px`;case"percentage":return`${e.value}%`;case"fit":return t[e.value]}}(a)):""}const Ge=Te({light:Ee,dark:we(Se,Ee)});function Fe(e,t,n){return a=>{if(a){const i=fe(de(e,t),Be(String(a)));return n?ye(i):i}return""}}function Me(e,t,n){return he(Ge,n)?ue({light:Fe(e,t,!1),dark:Fe(e,t,!0)},pe("\n "))(n):""}function Be(e){const t=e.toUpperCase();switch(t.length){case 5:return`#${t.substring(2,5)}${t[1]}`;case 9:return`#${t.substring(3,9)}${t[1]}${t[2]}`;default:return t.toUpperCase()}}const Ue=Te({offsetX:we(Se,ve),offsetY:we(Se,ve),blurRadius:we(Se,ve),spreadRadius:we(Se,ve),color:Ge}),Ve=e=>t=>null!=t?String(t):e,ze=i.compose(i.concat(i.__,"px"),Ve("0")),qe=e=>t=>"string"==typeof t?e(t):t,He=i.compose(qe(i.concat(i.__,"px")),Ve(void 0)),We=i.compose(qe(Be),i.prop("dark"));function Je(e,t,n){return fe(e,ue({offsetX:ze,offsetY:ze,blurRadius:t.spreadRadius?ze:He,spreadRadius:He,color:n},pe(" "))(t))}const Ke={center:"center","flex-end":"flex-end","flex-start":"flex-start",stretch:"stretch"},Ye={container:{justifyContent:Ne(Ke),alignItems:Ne(Ke),shadow:function(e,t,n){var a,o,r;if(he(Ue,n)){const s=de(e,t);return pe("\n")(Je(s,n,(o="light",r="#80000000",i.compose(Be,i.propOr(r,o)))),(null===(a=n.color)||void 0===a?void 0:a.dark)?ye(Je(s,n,We)):"")}return""},gap:Le,overflow:Ne({hidden:"hidden",visible:"visible"}),blur:function(e,t,n){return he(je,n)?fe(de(e,t),`blur(${n.toString()}px)`):""},opacity:Re},text:{textColor:Me,fontSize:Le,fontFamily:function(e,t,n){return he(Ce,n)?fe(de(e,t),(a=`${n}`,a.replace(/['();{}@:[\]!/=]/g,"")).split(",").map(((e,t)=>{const n=0===t?e:e.trim();if(n.includes(" ")){const e=n.startsWith('"')?"":'"',t=n.endsWith('"')?"":'"';return`${e}${n}${t}`}return n})).join(",")):"";var a},fontWeight:Ne({100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900}),fontStyle:Ne({normal:"normal",italic:"italic"}),lineHeight:Le,lineLimit:function(e,t,n){return he(ve,n)?`\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: ${n};\n line-clamp: ${n}; \n -webkit-box-orient: vertical;\n `:""},letterSpacing:Le,baselineTextAlign:Ne({super:"super",sub:"sub",baseline:"baseline"}),horizontalTextAlign:Ne({left:"left",right:"right",center:"center",start:"start",end:"end",justify:"justify"}),textDecoration:Ne({underline:"underline","strike-through":"line-through",none:"none"}),textTransform:Ne({capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",none:"none"})},background:{backgroundColor:Me,backgroundImage:function(e,t,n){return he(be,n)?ue({url:_e,position:Pe,scale:De},pe)(n):""}},dimension:{width:$e(["wrap-content","fit-width"]),maxWidth:Le,minWidth:Le,height:$e(["wrap-content","fit-height"]),maxHeight:Le,minHeight:Le,rotateZ:(Ze="Z",(e,t,n)=>{const a=`rotate${Ze}`;return he(ve,n)?fe(de(e,t),`${a}(${n.toString()}deg)`):""})},flexChild:{alignSelf:Ne(Ke),weight:Re,order:Re},spacing:{margin:Le,padding:Le,offset:function(e,t,n){return he(Oe(2),n)?`transform:translate(${n.split(" ").join("px, ")}px)`:""}},border:{borderColor:Me,borderRadius:Le,borderWidth:Le,borderStyle:Ne({solid:"solid",dashed:"dashed"})}};var Ze;function Qe(e){return Object.keys(e).reduce(((t,n)=>(n&&e[n]&&Object.keys(e[n]).forEach((a=>{if(!Ye[n])throw new Error(`No styling transformers exist for styling category key: ${n}`);const i=Ye[n][a];if(!i)throw new Error(`No styling transformer exists for property: ${n}.${a.toString()}`);try{t+=i(n,a,e[n][a])}catch(e){throw e&&"object"==typeof e&&"message"in e&&(e.message=`Error parsing styling key ${n}.${a.toString()}: ${e.message}`),e}})),t)),"")}const Xe="FAILED_TEMPLATING_DATA",et=new Map;function tt(e){return String.fromCharCode(97+e)}function nt(e,t,n){const a=`${e||S.pluginId}-${void 0!==t?String(t):"outer"}`,i=et.get(a);if(i&&i.sheet.container.isConnected)return i.css;const o=function(e,t){const n={key:void 0!==e?`inner-css-${tt(e)}`:"outer-css",container:t};return t&&t.parentElement&&(n.container=t.parentElement),p(n)}(t,n);return et.set(a,o),o.css}const at="%%%OWN_CLASS_REF%%%",it=i.memoizeWith(((e,t,n,a)=>`${String(e)}-${t}-${n}`),ot);function ot(e,t,n,a){const i=nt(t,n,a);let o=1;return function t(n,a=!1){var r;if("string"==typeof n){const e={scopeClass:n};return t.bind(e)}const s=n,l=this.scopeClass,c=Object.entries(null!==(r=s.elements)&&void 0!==r?r:{});try{const t=c.reduce(((t,[n,i])=>Object.assign(Object.assign({},t),{[n]:rt(i,l,a,String(n),e)})),{}),n=Object.entries(t),r=a?"parent-"+o++:"",s=function(e){return"own"in e&&"string"==typeof e.own&&e.own.length>0}(t)?i(t.own):"";return n.reduce(((e,[t,n=""])=>{if("own"===t)return e;const a=n.replace(at,r);return Object.assign(Object.assign({},e),{[t]:a?i(a):""})}),{own:`${s}${s&&r?" ":""}${r}`})}catch(e){const t=e;throw t.code="FAILED_PARSING_STYLES",t}}.bind({})}function rt(e,t,n,a,i){return e.map(function(e,t,n){return a=>Object.entries(a).map((([a,i])=>{const o=i?Qe(i):"";switch(!0){case"default"===a:return o?`\n${o}\n`:"";case Boolean(e):return`\n .${e}${le(a)} & {\n${o}\n}\n`;case t&&"own"!==n:return`\n .${at}${le(a)} & {\n${o}\n}\n`;default:return`\n &${le(a)} {\n${o}\n}\n`}})).join("")}(t,n,a)).reduce(((e,t,n)=>{const a=i[n];return void 0!==a?e+(0===n?t:`${re(a,t)}\n`):e}),"")}const st=t.createContext(i.always(void 0)),lt=()=>t.useContext(st),ct=t.createContext(null);function dt(e,n){var a;const i=t.useContext(ct);return i&&null!==(a=n(i))&&void 0!==a?a:e}const ut=t.createContext((()=>{throw Error("Node Mapper Context does not have a mapper. Use the NodeMapperProvider with the default nodeMapper as a value before you consume this mapper")})),pt=ut.Consumer,ft=()=>t.useContext(ut),yt=e=>t.createElement(ut.Provider,{value:(t,n,a)=>e.value(t,null!=n?n:e.overrides,a)},e.children),mt=t.createContext(null),ht=()=>t.useContext(mt),vt=t.createContext({get(){throw Error("Offer context has not been set")}}),gt=e=>t.createElement(vt.Provider,{value:{get:()=>e.context}},e.children),bt=()=>t.useContext(vt).get(),Et=()=>{try{return t.useContext(vt).get().creative.copy}catch(e){return}},It=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),St=i.compose(i.not,i.isEmpty),xt=i.where({url:St,title:St});function Ot(e,t,n){return t.reduce(((t,n)=>{const[a,i]=n.slice(0,-1).split("["),o=i?i.split(","):[];if(!a)throw new Error(Ct(e,"This Meta Attribute could not be parsed."));return function(e,t,n,a){switch(t){case"openLinks":return function(e,t,n){wt(t,e,"openLinks",1,2);const a=At(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),i=Tt(t,1,(e=>"string"==typeof e&&e.length?e:null));if("InApp"===a)return n.replace(It,((e,t)=>`<a ${ee} ${i?`${te}="${i}" `:""}${t}`));return n}(e,n,a);case"sliceText":return function(e,t,n){wt(t,e,"sliceText",2,2);const a=At(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),i=At(t,e,1,(e=>{const t=Number(e);return!Number.isNaN(t)&&t>=0?t:null}),"sliceText meta attribute second argument must be a positive number");if("Chars"===a)return function(e,t){const n=new RegExp("(?<=<a.*>).*(?=</a>)");return e.startsWith("<a")?e.replace(n,(e=>e.slice(0,t))):e.slice(0,t)}(n,i);throw Error(Ct(e,`Unknown "SliceBy" value. ${a}`))}(e,n,a);default:throw new Error(Ct(e,`Unknown Meta Attribute '${t}'.`))}}(e,a,o,t)}),n)}function wt(e,t,n,a,i){const o=new Error(Ct(t,`${n} meta attribute takes ${a!=i?`between ${a} and ${i}`:a} arguments; received ${e.length}.`));if(e.length<a||e.length>i)throw o}function Ct(e,t){return`Malformed Meta Attribute: '${e}' - ${t}`}function At(e,t,n,a,i){const o=Tt(e,n,a);if(null!==o)return o;throw Error(Ct(t,i||`Could not parse meta attribute argument at index ${n} from arguments ${JSON.stringify(e)}`))}function Tt(e,t,n){return n(e[t])}const jt="DATA",Rt="STATE",Nt=new RegExp(`^(${jt}|${Rt})`),_t=new RegExp(`^${Rt}`),Dt=new RegExp(`%\\^(?:${jt}|${Rt})\\.[a-zA-Z0-9]+[a-zA-Z0-9\\.]*(?:\\:[a-zA-Z0-9]+\\[[a-zA-Z0-9\\.,]*\\])*(?:\\|.*?)?\\^%`,"g"),kt=Symbol("invalid");function Pt(e,t="creativeCopy"){const n=Lt({data:e},t);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Lt(t,n,this.dataMap)});let a=!1;const o=t,r=i.pipe(i.slice(2,-2),i.split("|"),(e=>{const t=i.reduce(((e,t)=>{let n;if(Nt.test(t)){if(!this.dataMap.has(t)&&_t.test(t))throw new A(Xe,`Invalid use of STATE template key in a context it does not exist: ${t}`);const a=i.split(":",t);if(a[0]){if(n=this.dataMap.get(a[0]),n&&n===kt)throw new A(Xe,`Invalid template key referenced: "${t}" is an object but expected a string, boolean, number or empty. \nDid you mean to reference a child property of ${t}?`);if(a.length>1&&n)try{n=Ot(a[0],a.slice(1),n)}catch(e){throw new A(Xe,`Failed to apply meta attributes. ${function(e){return null!=e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:String(e)}(e)}`)}}return n?i.reduced({provided:!0,value:n}):e}return i.reduced({provided:!0,value:t})}),{provided:!1,value:""},e);return t.provided||(a=!0),t.value})),s=i.replace(Dt,r,o);return!1===a?s:""}.bind({dataMap:n})}function Lt(e,t,n){const a=new Map(n);return"data"in e&&o(e.data,`${jt}${t?"."+t:""}`),"state"in e&&o(e.state,`${Rt}${t?"."+t:""}`),a;function o(e,t){"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e?a.set(t,(null==e?void 0:e.toString())||""):a.set(t,kt),e&&"object"==typeof e&&i.forEachObjIndexed(((e,n)=>o(e,`${t}.${n}`)),e)}}const $t=t.createContext(Pt({})),Gt=$t.Consumer,Ft=$t.Provider,Mt=()=>t.useContext($t),Bt=t.createContext(null),Ut=Bt.Provider,Vt=t.createContext("OUTER"),zt=()=>"VARIANT"===t.useContext(Vt),qt=t.createContext(void 0),Ht=()=>t.useContext(qt);var Wt,Jt,Kt,Yt,Zt,Qt,Xt=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())}))},en=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},tn=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};class nn{constructor(e,t,n,a,o){Wt.set(this,void 0),Jt.set(this,void 0),Kt.set(this,new Set),Yt.set(this,void 0),Zt.set(this,void 0),Qt.set(this,void 0),en(this,Wt,i.partial(e.subscribe.bind(e),[n]),"f"),en(this,Jt,i.partial(e.dispatch.bind(e),[n]),"f"),en(this,Yt,t,"f"),en(this,Zt,a,"f"),en(this,Qt,o,"f")}onGlobalStateChange(e){const t=tn(this,Wt,"f").call(this,e),n=()=>{t(),tn(this,Kt,"f").delete(n)};return tn(this,Kt,"f").add(n),n}onInteractivityChange(e){return tn(this,Zt,"f").subscribe(e)}onEvent(...e){const t=e.reduce(((e,t)=>{if("partner"===t.source||"*"===t.source){const n=tn(this,Qt,"f").call(this,t.name).subscribe(t.callback);return[...e,()=>n.unsubscribe()]}return e}),[]),n=()=>{t.forEach((e=>{e()})),tn(this,Kt,"f").delete(n)};return tn(this,Kt,"f").add(n),n}globalDispatch(e){tn(this,Jt,"f").call(this,e)}dispose(){tn(this,Kt,"f").forEach((e=>e())),en(this,Kt,new Set,"f"),tn(this,Zt,"f").clear()}createChildPlugin(e){return tn(this,Yt,"f").call(this,e)}}Wt=new WeakMap,Jt=new WeakMap,Kt=new WeakMap,Yt=new WeakMap,Zt=new WeakMap,Qt=new WeakMap;class an{onGlobalStateChange(){return()=>{}}onInteractivityChange(){return()=>{}}onEvent(){return()=>{}}globalDispatch(){}dispose(){}createChildPlugin(){return{close:()=>Xt(this,void 0,void 0,(function*(){})),onClose:()=>Xt(this,void 0,void 0,(function*(){})),putConfig:()=>Xt(this,void 0,void 0,(function*(){})),send:()=>Xt(this,void 0,void 0,(function*(){})),onEvent:()=>({subscribe:()=>({unsubscribe:()=>{}})})}}}var on,rn,sn=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n},ln=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};class cn{constructor(e){on.set(this,void 0),rn.set(this,new Set),sn(this,on,e,"f")}subscribe(e){return ln(this,rn,"f").add(e),!0===e(ln(this,on,"f"))&&ln(this,rn,"f").delete(e),()=>{ln(this,rn,"f").delete(e)}}publish(e){sn(this,on,e,"f"),ln(this,rn,"f").forEach((e=>{!0===e(ln(this,on,"f"))&&ln(this,rn,"f").delete(e)}))}clear(){ln(this,rn,"f").clear()}}on=new WeakMap,rn=new WeakMap;var dn=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)},un=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n};const pn="breakpoint-0px";class fn{constructor(){this.logger=()=>{}}withAppFactory(e){return this.appFactory=e,this}withLogger(e){return this.logger=e,this}withGatewayFactory(e){return this.gatewayFactory=e,this}build(){var e,t,n,a,i,o,r;const s=this.appFactory,l=this.logger,c=null!==(e=this.gatewayFactory)&&void 0!==e?e:()=>new an;return r=class extends HTMLElement{static get observedAttributes(){return["visible","interactivity","active-breakpoint"]}attributeChangedCallback(e,i,r){if(r!==i)switch(e){case"visible":dn(this,n,"f").call(this,"true"===r);break;case"interactivity":"ENABLED"!==r&&"DISABLED"!==r||dn(this,a,"f").call(this,r);break;case"active-breakpoint":dn(this,t,"m",o).call(this,r,i)}}makeInteractivityUpdateHandler(e){un(this,a,(t=>{e.publish(t)}),"f")}makeVisbilityUpdateHandler(e,t,a){const i="true"===this.getAttribute("visible"),o=this.getAttribute("slotInstanceGuid");un(this,n,(i=>{i&&(un(this,n,(()=>null),"f"),0===e&&a.globalDispatch({type:H,payload:{event:"Interactive"}}),t&&a.globalDispatch({type:q,payload:{name:"SignalImpression",parentGuid:t}}),o&&a.globalDispatch({type:q,payload:{name:"SignalImpression",parentGuid:o}}))}),"f"),dn(this,n,"f").call(this,i)}getOfferPositionAttr(){const e=this.getAttribute("offerPositionIndex"),t=Number(e);return(null==e||isNaN(t)||t<0)&&d(`Offer position attribute (${e}) is invalid`),t}getJSONAttr(e){const t=this.getAttribute(e);try{return JSON.parse(null!=t?t:"{}")}catch(n){d(`Invalid JSON attribute ${e}: ${t}`)}}constructor(){super(),t.add(this),n.set(this,(()=>null)),a.set(this,(()=>null)),i.set(this,void 0);const e=this.attachShadow({mode:"open"});un(this,i,document.createElement("div"),"f"),dn(this,i,"f").id="app-container",dn(this,i,"f").classList.add("default"),e.appendChild(dn(this,i,"f"))}connectedCallback(){var e,t;const n=this.getAttribute("container"),a=this.getAttribute("plugin-id");dn(this,i,"f").setAttribute("style","width:100%;display:flex;flex-direction:"+("column"===n?"column":"row"));const o=this.getOfferPositionAttr(),r=this.getJSONAttr("layoutSchema"),u=this.getJSONAttr("offerData"),p=new cn("DISABLED"===this.getAttribute("interactivity")?"DISABLED":"ENABLED");s||d("Cannot create app without factory. Please build the connector withAppFactory.");const f=c({offerPositionIndex:o,creativeInstanceGuid:null===(e=null==u?void 0:u.creative)||void 0===e?void 0:e.instanceGuid},p);this.makeInteractivityUpdateHandler(p),s({rootElement:dn(this,i,"f"),gateway:f,logger:l,offerPositionIndex:o,offerData:u,layoutSchema:r,pluginId:a||S.pluginId}),this.makeVisbilityUpdateHandler(o,null===(t=null==u?void 0:u.creative)||void 0===t?void 0:t.instanceGuid,f)}},n=new WeakMap,a=new WeakMap,i=new WeakMap,t=new WeakSet,o=function(e,t){dn(this,i,"f").classList.remove(t||pn),dn(this,i,"f").classList.add(e||pn)},r;function d(e){throw l({level:w,code:"MODULE_BUILDER/FAILED_TO_BUILD_MODULE",message:e}),Error(e)}}}const yn=t.createContext({get:()=>new an}),mn=e=>t.createElement(yn.Provider,{value:{get:()=>e.context}},e.children);const hn=t.createContext({get(){throw Error("Layout Schema context has not been set")}}),vn=e=>t.createElement(hn.Provider,{value:{get:()=>e.context}},e.children),gn=()=>t.useContext(hn).get(),bn=t.createContext("ENABLED"),En=()=>t.useContext(bn);function In(e){const t=xn(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:xn(t,this.dataMap)});if(!n)throw new A("FAILED_TO_MAP_STATIC_DATA","No namespace submitted to StaticData Mapper");const a=t;return i.path([n,a],this.dataMap)}.bind({dataMap:t})}const Sn={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function xn(e,t=Sn){return["images","links","icons","copy","responseOptionsMap"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Object.assign(Object.assign({},t[n]),e[n])})),t)}const On=t.createContext(In({}));On.Consumer;const wn=On.Provider,Cn=()=>t.useContext(On),An=t.createContext({});function Tn({info:e,children:n}){const a=t.useContext(An);return t.createElement(An.Provider,{value:Object.assign(Object.assign({},a),e)},n)}const jn=t.createContext({get(){throw Error("Catalog Item context has not been set")}}),Rn=e=>t.createElement(jn.Provider,{value:{get:()=>e.context}},e.children),Nn=()=>t.useContext(jn).get(),_n=t.createContext(""),Dn=()=>t.useContext(_n),kn=t.createContext("VISIBLE"),Pn=()=>t.useContext(kn);function Ln(){return"VISIBLE"===Pn()?void 0:{display:"none"}}const $n=i.compose(i.anyPass([i.isEmpty,i.all(i.isEmpty)]),i.flatten,i.map(i.values),i.map(i.ifElse(i.isNil,i.always({}),i.identity)),i.values,i.propOr({},"value")),Gn=i.compose(i.isEmpty,i.prop("predicates"));function Fn(e,t){return`transition: ${t.map((t=>`${t} ${e}ms`)).join(", ")};`}const Mn=i.curry(((e,{duration:t,predicates:n,styles:a})=>{return{predicates:n,classname:e(Qe(a)),transitionBaseClassname:e(Fn(t,(o=a,i.toPairs(o).flatMap((e=>{const[t,n]=null!=e?e:[];return n&&t?i.keys(n).map((e=>de(t,e))):[]})))))};var o})),Bn=i.anyPass([$n,Gn]);const Un={is:i.equals,"is-not":i.compose(i.not,i.equals),"is-below":i.lt,"is-above":i.gt};function Vn(e,t){return e.includes(t)}const zn={is:i.equals,"is-not":i.compose(i.not,i.equals),exists:Vn,"not-exists":i.compose(i.not,Vn)},qn={exists:i.compose(i.not,i.either(i.isNil,i.isEmpty)),"not-exists":i.either(i.isNil,i.isEmpty)},Hn={"is-true":i.equals(!0),"is-false":i.equals(!1)},Wn={is:i.equals,"is-not":i.compose(i.not,i.equals)};function Jn(e){return(t,n)=>n[e]}const Kn=i.cond([[(e,t)=>i.equals("Breakpoint",e),Jn("activeBreakpoint")],[(e,t)=>i.equals("Progression",e),Jn("progressionIndex")],[(e,t)=>i.equals("Position",e),Jn("positionIndex")]]);function Yn(e,t){return e.creativeCopy&&"string"==typeof e.creativeCopy[t]?e.creativeCopy[t]:void 0}const Zn=i.cond([[i.equals("Breakpoint"),(e,t,n)=>{const a=i.lensPath(["breakpoints",t]);return i.pipe(i.over(a,Number),i.view(a))(n)}],[i.equals("Progression"),(e,t,n)=>i.cond([[i.gt(0),i.add(n.totalGroups)],[i.lte(0),i.identity]])(Number(t))],[i.equals("Position"),(e,t,n)=>i.cond([[i.gt(0),i.add(n.totalOffers)],[i.lte(0),i.identity]])(Number(t))]]),Qn=i.compose(i.not,isNaN);function Xn(e,t){return e.map((e=>{var n,a,i;switch(e.type){case"StaticString":return(0,Wn[e.predicate.condition])(e.predicate.input,e.predicate.value);case"CreativeCopy":return(0,qn[e.predicate.condition])(Yn(t,e.predicate.value));case"StaticBoolean":return(0,Hn[e.predicate.condition])(e.predicate.value);case"CustomState":return(0,Un[e.predicate.condition])(null!==(n=t.customStates[e.predicate.key])&&void 0!==n?n:0,e.predicate.value);case"DomainState":return(0,Un[e.predicate.condition])(null!==(a=t.domainStates[e.predicate.key])&&void 0!==a?a:0,e.predicate.value);case"DarkMode":throw new Error("DarkMode has not yet been implemented.");case"Placeholder":return function(e){switch(e.predicate.type){case"TextValue":return(0,zn[e.predicate.content.condition])(e.predicate.content.input,e.predicate.content.value);case"TextLength":return(0,Un[e.predicate.content.condition])(e.predicate.content.input.length,e.predicate.content.value);case"Numeric":return(0,Un[e.predicate.content.condition])(Number(e.predicate.content.input),e.predicate.content.value);default:return!1}}(e);default:{const n=Un[e.predicate.condition],a=null!==(i=Kn(e.type,t))&&void 0!==i?i:NaN,o=Zn(e.type,e.predicate.value,t);return!!Qn(a)&&n(a,o)}}}))}function ea(e){return i.pathOr(0,["breakpoint","breakpoints",e.breakpoint.activeBreakpoint],e)}const ta={breakpoints:{},activeBreakpoint:NaN,progressionIndex:NaN,positionIndex:NaN,totalOffers:NaN,totalGroups:NaN,creativeCopy:{},customStates:{},domainStates:{}};function na(e,t,n,a){const o=t.map((e=>"Progression"===e.type?Object.assign(Object.assign({},e),{type:a?"Position":e.type}):e)),{cached:r,uncached:s}=o.reduce(((t,a)=>function(e,t,n,a){const o=function(e,t){switch(e.type){case"Position":case"StaticBoolean":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"StaticString":return`${e.type}:${e.predicate.input}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"CreativeCopy":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${Yn(t,e.predicate.value)}:${t.totalGroups}`;case"CustomState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.customStates[e.predicate.key]}`;case"DomainState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.domainStates[e.predicate.key]}`;case"Placeholder":return`${e.type}:${e.predicate.type}:${e.predicate.content.condition}:data:${e.predicate.content.input}:${e.predicate.content.value}`;default:return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${Kn(e.type,t)}:${t.totalGroups}`}}(e,t),r=n.current.get(o);return i.evolve(aa(r)?{cached:i.append(r)}:{uncached:i.append({key:o,predicate:e})},a)}(a,n,e,t)),{cached:[],uncached:[]}),l=Xn(s.map((({predicate:e})=>e)),n);return i.zip(s,l).forEach((([{key:t},n])=>{e.current.set(t,n)})),r.concat(l)}const aa=i.is(Boolean);const ia=i.curry(((e,t,n)=>{var a,i,o,r,s,l;return{breakpoints:n.breakpoint.breakpoints,activeBreakpoint:ea(n),progressionIndex:null!==(i=null===(a=n.progression)||void 0===a?void 0:a.activeGroupIndex)&&void 0!==i?i:0,totalOffers:null!==(r=null===(o=n.progression)||void 0===o?void 0:o.totalOffers)&&void 0!==r?r:0,totalGroups:null!==(l=null===(s=n.progression)||void 0===s?void 0:s.totalGroups)&&void 0!==l?l:0,customStates:n.customStates,domainStates:n.domainStates,positionIndex:e,creativeCopy:t}})),oa=i.lensPath(["predicate","content","input"]),ra=i.lensPath(["predicate","content","value"]);function sa(e,t){const n=i.over(oa,(t=>t?e(t):"")),a=i.over(ra,(t=>"string"==typeof t?e(t):t)),o=i.compose(n,a);return t.map((e=>"Placeholder"===e.type?"TextValue"===e.predicate.type?o(e):n(e):e))}const la=i.all(i.equals(!0));function ca(e){const n=zt(),a=Ht(),o=t.useRef(new Map),r=Et(),s=dt(ta,ia(a,r)),l=Mt();return t.useMemo((()=>i.mapObjIndexed((e=>{const t=sa(l,e);return la(na(o,t,s,n))}),e)),[o,e,s,n,l])}function da(e){e&&(e.style.display="")}function ua(e){e&&(e.style.display="none")}function pa(e){return e.settings.duration}const fa=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],ya=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function ma(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const a=t?fa:ya,i=e.animate(a,{duration:n,iterations:1});return i.onfinish=()=>{t?da(e):ua(e)},i.oncancel=()=>{t?da(e):ua(e)},()=>{i.finish()}}return t?da(e):ua(e),()=>{}}function ha({inTransitions:e,outTransitions:n,visible:a,children:i,containerClassName:o}){const r=t.useRef(null);return t.useEffect((()=>a&&e?e.forEach((e=>{r.current&&function(e,t,n,a){if("FadeIn"===a)ma(e,t,n)}(r.current,a,pa(e),e.type)})):!a&&n?n.forEach((e=>{r.current&&function(e,t,n,a){if("FadeOut"===a)ma(e,t,n)}(r.current,a,pa(e),e.type)})):()=>{}),[a]),t.createElement("div",{ref:r,style:{display:"none"},className:o},i)}function va(e){const n=ft(),a=function(e){const n=zt(),a=Ht(),i=t.useRef(new Map),o=Et(),r=dt(ta,ia(a,o)),s=sa(Mt(),e);return t.useMemo((()=>la(na(i,s,r,n))),[i,s,r,n])}(e.schema.predicates),i=Pn(),o=t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))),[r,s]=t.useState(!1),l="VISIBLE"===i&&a?"VISIBLE":"HIDDEN";return e.schema.transition?(!r&&s(!0),t.createElement(kn.Provider,{value:l},t.createElement(ha,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:a},o))):"functionally"===e.schema.hide?(!r&&s(!0),t.createElement(bn.Provider,{value:a?"ENABLED":"DISABLED"},o)):a||r?(!r&&s(!0),t.createElement(kn.Provider,{value:l},o)):null}const ga=i.mergeWith(((e,t)=>`${e||""} ${t||""}`.trim())),ba=e=>{var n;const a=t.useContext(Bt),o=Ht(),r=ht()||document.head,s=Dn(),l=nt(s,o,r),c=t.useCallback(it,[]),d=dt([],(e=>Object.values(e.breakpoint.breakpoints))),u=a||c(d,s,o,r),p=e.styles?u(e.styles):{},f=e.styles&&e.styles.conditionalTransitions?function(e,t){const n=Mn(e);return i.mapObjIndexed((e=>Bn(t)||!e?null:n({predicates:t.predicates,duration:t.duration,styles:e})),t.value)}(l,null===(n=e.styles)||void 0===n?void 0:n.conditionalTransitions):void 0,y=ca(f?i.mapObjIndexed(i.propOr([],"predicates"),f):{}),m=i.mapObjIndexed(((e,t)=>e?function(e,t){var n;if(e&&t in e)return null===(n=e[t])||void 0===n?void 0:n.classname}(f,t):void 0),y),h=f?i.mapObjIndexed(i.prop("transitionBaseClassname"),f):{},v=e.styles?(g=h,ga(ga(p,m),g)):void 0;var g;return e.children({classnames:v,mapperRef:u})};function Ea(e){const n=ft(),a=Ln();return t.createElement(ba,{styles:e.schema.styles},(({classnames:i})=>{var o;return t.createElement("div",{className:i?i.own:void 0,"data-testid":e.testId,style:Object.assign({display:"flex",flexDirection:"column"},a),"aria-label":null!==(o=e.schema.a11yLabel)&&void 0!==o?o:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,G(a,e.testId))))))}))}function Ia(e){const n=ft(),a=Ln();return t.createElement(ba,{styles:e.schema.styles},(({classnames:i})=>{var o;return t.createElement("div",{className:i?i.own:void 0,"data-testid":e.testId,style:Object.assign({display:"flex",flexDirection:"row"},a),"aria-label":null!==(o=e.schema.a11yLabel)&&void 0!==o?o:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,G(a,e.testId))))))}))}const Sa={allowedTags:["em","strong","a","br","u","p","li","ul","ol","s"],allowedAttributes:{a:["href","target",ee,te],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],s:[]},allowedSchemes:["http","https"]},xa=new Map([["&","_;^;_"]]),Oa=new RegExp(`<a *(?=${Sa.allowedAttributes.a.join("|")}|>)`,"g"),wa=new RegExp('<a [^>]*href="([^"]+)"',"g"),Ca=new RegExp("(<br *?>)|(<br *?/>)","g"),Aa="<br/>";function Ta(e){const n=Mt(),a=En(),o=Ln(),r=t.useMemo((()=>{const t=n(e.schema.value);if(!function(e){const t=function(e){return e.replaceAll(wa,((e,t)=>{const n=t.replaceAll("&",xa.get("&"));return e.replace(t,n)})).replaceAll(Ca,Aa)}(e);return t===u(t,Sa)}(t))throw new A("FAILED_SANITISING_HTML","Invalid HTML tags");return t}),[e.schema.value,n]),{tabIndex:s,styles:l,isDisabled:c}=h(a),d=Object.assign(Object.assign({},l),o),p=i.isEmpty(d)?void 0:d;return r?t.createElement(ba,{styles:e.schema.styles},(({classnames:n})=>{const a=[(null==n?void 0:n.link)?`class = "${null==n?void 0:n.link}"`:"",c?'tabindex="-1"':"",c?"style=\"pointer-events: 'none'; user-select: none;\"":"",c?'aria-disabled="true"':""].filter((e=>e.length>0)),i={__html:r.replace(Oa,`<a ${a.join(" ")}`)};return o=r,new RegExp("</(p|ul|ol)>").test(o)?t.createElement("div",{tabIndex:s,style:p,"aria-hidden":c,className:null==n?void 0:n.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:i}):t.createElement("p",{tabIndex:s,style:p,"aria-hidden":c,className:null==n?void 0:n.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:i});var o})):null}function ja(e){const n=Mt()(e.schema.value),a=En(),o=Ln(),{tabIndex:r,styles:s,isDisabled:l}=h(a),c=i.mergeAll([s,o]);return n?t.createElement(ba,{styles:e.schema.styles},(({classnames:a})=>{const o={tabIndex:r,"aria-hidden":l,className:null==a?void 0:a.own,"data-testid":e.testId,"data-e2e":"BasicText",style:i.isEmpty(c)?void 0:c};return e.isInline?t.createElement("span",Object.assign({},o),n):t.createElement("p",Object.assign({},o),n)})):null}function Ra(e,n,a){if("BasicText"===e.type)return t.createElement(ja,{schema:e.node,testId:n,isInline:null!=a&&a})}function Na(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,G(t,a)))))}function _a(e){const n=lt(),a=ft(),i=bt(),o=Mt(),r=Ht(),s=En(),l=Ln(),c=i.creative.responseOptionsMap[e.schema.responseKey],d=I(c);t.useEffect((()=>{d&&n(function(e){if(e.externalKey)return{type:K,payload:{criteria:{key:e.externalKey},signal:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:e.action,externalKey:e.externalKey}}}};throw new Error(`Invalid External Response: No 'externalKey' found for external response option with instanceGuid: ${e.instanceGuid}`)}(c))}),[c,n,d]);const u=c?o({data:c},"creativeResponse"):o,{tabIndex:p,styles:f,isDisabled:y}=h(s);return E(c)&&!d&&void 0!==r?t.createElement(ba,{styles:e.schema.styles},(({classnames:o,mapperRef:r})=>{var s;return t.createElement("button",{type:"button",tabIndex:p,"aria-disabled":y,"aria-label":null!==(s=e.schema.a11yLabel)&&void 0!==s?s:void 0,style:Object.assign(Object.assign({cursor:"pointer"},f),l),"data-testid":e.testId,"data-e2e":"CreativeResponse","data-e2e-response-type":e.schema.responseKey,onClick:e=>{e.preventDefault();const t=function(e,t){switch(t.action){case"Fulfillment":{const n=e.creative.fulfillment;if(b(n))return{fulfillment:n,responseOption:t};throw new Error(`Invalid Fulfillment: ${n} with referralCreativeID: ${e.creative.referralCreativeId}`)}case"Url":return Object.assign(Object.assign({},t),{accountID:e.accountId,referralCreativeID:e.creative.referralCreativeId});default:return t}}(i,c);n({type:M,payload:t})},className:null==o?void 0:o.own,disabled:y},t.createElement(Ft,{value:u},(null==o?void 0:o.own)?function(e,n,a,i,o){return t.createElement(Ut,{value:a(n)},Na(e,i,o))}(e.schema.children,o.own,r,a,e.testId):Na(e.schema.children,a,e.testId)))})):null}function Da(e){const n=En(),a=Ln(),{styles:i,isDisabled:o}=h(n);return e.schema.url.light?t.createElement(ba,{styles:m(e.schema.styles)},(({classnames:n})=>t.createElement("img",{"aria-hidden":o,style:Object.assign(Object.assign(Object.assign({},i),{display:"inline-block"}),a),alt:o?void 0:e.schema.alt||void 0,title:e.schema.title||void 0,className:n?n.own:void 0,"data-testid":e.testId,"data-e2e":"StaticImage",src:e.schema.url.light}))):null}function ka(e){const n=En(),a=Ln(),{styles:i,isDisabled:o}=h(n),r=(s=e.schema.imageKey,t.useContext(On)(s,"images"));var s,l;return null!=(l=r)&&"object"==typeof l&&"light"in l&&"string"==typeof l.light?t.createElement(ba,{styles:m(e.schema.styles)},(({classnames:n})=>t.createElement("img",{"aria-hidden":o,style:Object.assign(Object.assign(Object.assign({},i),{display:"inline-block"}),a),alt:r.alt,title:r.title,className:n?n.own:void 0,"data-testid":e.testId,"data-e2e":"DataImage",src:r.light}))):null}const Pa={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function La(e){const n=e.schema.name,a=e.schema.description,i=e.schema.styles?L(Pa,e.schema.styles):Pa,o=En(),{styles:r,isDisabled:s}=h(o),l=Ln();return n?t.createElement(ba,{styles:i},(({classnames:i})=>t.createElement("span",Object.assign({style:Object.assign(Object.assign(Object.assign({},r),{display:"inline-block"}),l),className:"rokt-icon"+((null==i?void 0:i.own)?" "+i.own:""),"data-testid":e.testId,"data-e2e":`StaticIcon-${n}`},!s&&a?{title:a}:{"aria-hidden":"true"}),n))):null}const $a={backgroundColor:"#FFEEEE",color:"#FF0000",fontSize:"10px",padding:"4px",border:"1px solid #FF0000",margin:0,whiteSpace:"normal"};class Ga extends t.Component{constructor(e){super(e),this.state={errorMessage:""}}static getDerivedStateFromError(e){return{errorMessage:e.message}}componentDidUpdate(e){this.state.errorMessage&&JSON.stringify(e.schema)!==JSON.stringify(this.props.schema)&&this.setState({errorMessage:""})}componentDidCatch(e,t){var n;this.props.reporter&&"true"===oe.REPORT_RENDER_ERRORS&&this.props.reporter({level:w,code:null!==(n=e.code)&&void 0!==n?n:"UNHANDLED_RENDERING_EXCEPTION",message:e.message,additionalInformation:Object.assign({componentStack:t.componentStack,stack:e.stack},this.context||{})})}render(){return this.state.errorMessage?"true"===oe.DISPLAY_ERRORS?t.createElement("pre",{style:$a},t.createElement("strong",null,"Error:")," [",t.createElement("em",null,this.props.schema.type),"]"," ",this.state.errorMessage):void 0:this.props.children}}Ga.contextType=An;const Fa={internally:"_top",externally:"_blank"};function Ma(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Ba(e){var n;const a=Fa[e.schema.open],i=ft(),o=En(),r=Ln(),{tabIndex:s,styles:l,isDisabled:c}=h(o);return(null===(n=e.schema.children)||void 0===n?void 0:n.length)>0?t.createElement(ba,{styles:e.schema.styles},(({classnames:n,mapperRef:o})=>{var d;return t.createElement("a",{href:e.schema.src,"data-testid":e.testId,"data-e2e":"StaticLink",target:null!=a?a:"_blank",tabIndex:s,"aria-disabled":c,"aria-label":null!==(d=e.schema.a11yLabel)&&void 0!==d?d:void 0,style:Object.assign(Object.assign({cursor:"pointer",textDecoration:"none",display:e.isInline?"inline":"block"},l),r),className:null==n?void 0:n.own},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(Ut,{value:a(n)},Ma(e,i,o))}(e.schema.children,null==n?void 0:n.own,o,i,e.testId):Ma(e.schema.children,i,e.testId))})):null}function Ua(e,n,a){if("StaticLink"===e.type)return t.createElement(Ba,{schema:e.node,testId:n,isInline:null!=a&&a})}const Va={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function za(e){const n=(a=e.schema.iconKey,t.useContext(On)(a,"icons"));var a;const i=null==n?void 0:n.name,o=e.schema.styles?L(Va,e.schema.styles):Va,r=En(),s=Ln(),{styles:l}=h(r);return i?t.createElement(ba,{styles:o},(({classnames:n})=>t.createElement("span",{style:Object.assign(Object.assign(Object.assign({},l),{display:"inline-block"}),s),"aria-hidden":"true",className:"rokt-icon"+((null==n?void 0:n.own)?" "+n.own:""),"data-testid":e.testId,"data-e2e":`DataIcon-${i}`},i))):null}const qa=o.css`
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("react-dom/client"),a=require("react-redux"),i=require("ramda"),o=require("@emotion/css"),r=require("redux-saga/effects"),s=require("@reduxjs/toolkit"),l=require("redux-saga"),c=require("@redux-saga/core/effects"),d=require("embla-carousel-react"),u=require("insane"),p=require("@emotion/css/create-instance");function f(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var y=f(t);function h(e){const t=["elements","own"],n=["default","dimension","width","type"],a=["default","dimension","width","value"],o=["default","dimension","minWidth"],r=i.path(t,e);return r&&Array.isArray(r)&&r.length?i.assocPath(t,r.map(i.when(i.allPass([i.hasPath(n),i.complement(i.hasPath(o)),i.pathEq("fixed",n)]),(e=>i.assocPath(o,i.path(a,e),e)))),e):e}function m(e){const t="DISABLED"===e;return{tabIndex:t?-1:void 0,styles:t?{pointerEvents:"none",userSelect:"none"}:void 0,isDisabled:t}}function v(e,t){if("EscapeHatch"===t.type)try{return JSON.parse(t.node.data).type===e}catch(e){return!1}return!1}function g(){return"ontouchstart"in document.documentElement}function b(e){return null!=e&&"object"==typeof e&&("url"in e||"name"in e)&&"config"in e}function E(e){return null!=e&&"object"==typeof e&&"id"in e&&"action"in e&&"instanceGuid"in e&&"signalType"in e}function I(e){return E(e)&&"External"===e.action}function x(e={}){return Object.assign({light:"https://plus.unsplash.com/premium_photo-1675826774817-fe983ceb0475?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=200&q=80",dark:"https://images.unsplash.com/photo-1679941734238-56628f5991f7?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=200&q=80"},e)}const S={pluginId:"shared",pageInstanceGuid:"N/A"};var w;!function(e){e.DCUI="DCUI",e.Partner="partner"}(w||(w={}));const C=["SignalCartItemQuantitySelected"],O="ERROR",A="WARNING";class T extends Error{constructor(e,t){super(t),this.code=null!=e?e:"UNHANDLED_EXCEPTION"}toString(){return`CodedError (${this.code}): ${this.message}`}}const R=["V2_CART_ITEM_UPDATED","CART_ITEM_INSTANT_PURCHASE","OFFER_ENGAGEMENT","POSITIVE_ENGAGEMENT","UPSELL_CREATIVE_SENT","REALTIME_OFFER_FULFILLMENT_REFERRAL","REALTIME_OFFER_FULFILLMENT_SUCCESS","PLACEMENT_CLOSED","PLACEMENT_COMPLETED","PLACEMENT_INTERACTIVE","PLACEMENT_FAILURE"];const j=(e,t)=>i.concat(e,i.slice(e.length,t.length,t)),L=(e,t)=>{if(Array.isArray(e)&&Array.isArray(t)){const n=e.length>t.length?j(t,e):t,a=t.length>e.length?j(e,t):e;return i.zipWith(P,a,n)}return t},N=e=>null==e,_=e=>!N(e),D=(e,t)=>N(t)?e:t,k=(e,t)=>{throw new T("MERGE_TYPE_INCONSISTENCY",`Unable to merge values for inconsistent types, left = ${e}, right = ${t}`)};function P(e,t){return i.cond([[(e,t)=>i.type(e)!==i.type(t)&&_(e)&&_(t),k],[(e,t)=>N(e)||N(t),D],[(e,t)=>"Object"===i.type(e),i.mergeDeepWith(P)],[(e,t)=>"Array"===i.type(e),L],[i.T,i.flip(i.unary(i.identity))]])(e,t)}function $(e,t){return P(e,t)}function G(e=0){return`breakpoint-${e}px`}function F(e,t){return t?`${t}-child${e}`:void 0}const M="GLOBAL/RAISE_METRIC",B="GLOBAL/OFFER_ENGAGEMENT";function U(e){return null!=e&&"object"==typeof e&&"responseOption"in e&&function(e){return E(e)&&"Fulfillment"===e.action}(e.responseOption)&&"fulfillment"in e&&b(e.fulfillment)}function V(e){return I(e)}function z(e){return function(e){return E(e)&&"Url"===e.action}(e)}function q(e){return function(e){return E(e)&&"CaptureOnly"===e.action}(e)}const H="GLOBAL/RAISE_SIGNAL",W="GLOBAL/OFFER_LIFECYCLE",J="GLOBAL/SET_CUSTOM_STATE",Y="GLOBAL/SEND_PARTNER",K="GLOBAL/PREPARE_SIGNAL",Z="GLOBAL/OPEN_LINK",Q="GLOBAL/SET_PARTNER_VALIDATION_STATUS",X="GLOBAL/SET_GLOBAL_OFFER_DATA_CART",ee="GLOBAL/LAUNCH_CHILD_LAYOUT",te={RAISE_METRIC:M,PREPARE_SIGNAL:K,OFFER_ENGAGEMENT:B,RAISE_SIGNAL:H,OFFER_LIFECYCLE:W,SEND_PARTNER:Y,SET_CUSTOM_STATE:J,SET_DOMAIN_STATE:"GLOBAL/SET_DOMAIN_STATE",OPEN_LINK:Z,SET_PARTNER_VALIDATION_STATUS:Q,SET_GLOBAL_OFFER_DATA_CART:X,LAUNCH_CHILD_LAYOUT:ee},ne="data-open-in-app",ae="data-click-signal-context";function ie(e,n){function a(e){var t;if(!(e.target&&e.target instanceof HTMLElement))return;const a=null===(t=e.target)||void 0===t?void 0:t.closest("a");if(a){const t=a.getAttribute("href"),i=a.getAttribute(ae);if(i&&n({type:H,payload:{name:"SignalUserInteraction",action:"Click",context:i}}),t){e.preventDefault();let i="newTab";a.hasAttribute(ne)&&(i="inApp"),n({type:Z,payload:{url:t,urlBehaviour:i}})}}}t.useEffect((()=>null!==e?(e.addEventListener("click",a),()=>{e.removeEventListener("click",a)}):()=>{}),[e])}function oe(){const e=t.useRef(null);return t.useEffect((()=>{const t=t=>{"Tab"===t.key&&re(t,e)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)}),[e]),e}const re=(e,t)=>{var n;const a=null===(n=t.current)||void 0===n?void 0:n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!a)return;const i=a[0],o=a[a.length-1],{activeElement:r}=window.document;if(1!==a.length)return r===i&&e.shiftKey?(o&&o.focus(),void e.preventDefault()):r!==o||e.shiftKey?void 0:(i&&i.focus(),void e.preventDefault());e.preventDefault()},se="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DISPLAY_ERRORS:"true",REPORT_RENDER_ERRORS:"true",USE_MEDIA_QUERY_NESTING:"true"};function le(e,t){return t?"false"!==se.USE_MEDIA_QUERY_NESTING?`${n=e,`@media (min-width: ${n}px)`} {${t}}`:t.includes(" & ")?`#app-container.${G(e)} ${t.trim()}`:`#app-container.${G(e)} & {${t}}`:"";var n}const ce={hovered:":hover",pressed:":active",focussed:":focus",disabled:":disabled"};function de(e){return function(e){return Object.keys(ce).indexOf(e)>-1}(e)?ce[e]:""}const ue={container:{justifyContent:"justify-content",alignItems:"align-items",shadow:"box-shadow",gap:"gap",overflow:"overflow",blur:"filter",opacity:"opacity"},text:{textColor:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",lineHeight:"line-height",lineLimit:"",letterSpacing:"letter-spacing",baselineTextAlign:"vertical-align",horizontalTextAlign:"text-align",textDecoration:"text-decoration",textTransform:"text-transform"},background:{backgroundColor:"background-color",backgroundImage:""},dimension:{width:"width",maxWidth:"max-width",minWidth:"min-width",height:"height",maxHeight:"max-height",minHeight:"min-height",rotateZ:"transform"},flexChild:{alignSelf:"align-self",weight:"flex",order:"order"},spacing:{margin:"margin",padding:"padding",offset:""},border:{borderColor:"border-color",borderRadius:"border-radius",borderWidth:"border-width",borderStyle:"border-style"}};function pe(e,t){if(!ue[e]||!ue[e][t])throw new Error(`No CSS property mapping exists for styling property: ${e}.${t.toString()}`);return ue[e][t]}function fe(e,t){return n=>t(...Object.keys(e).map((t=>e[t](n[t]))))}function ye(...e){let t="";const n=(...e)=>e.reduce(((e,n)=>(e&&n?e=e+t+n:n&&(e=n),e)),"");return 1===e.length?(t=e[0],n):n(...e)}function he(e,t){return`${e}:${t};`}function me(e){return function(e,t){return`@media (${e}) {${t}}\n`}("prefers-color-scheme: dark",e)}class ve extends Error{constructor(e,t){super(`Invalid styling value '${t}': ${e}.`),this.name=this.constructor.name}}function ge(e,t){if(null===t)return!1;const n=("function"==typeof e?[e]:e).map((e=>e(t))).reduce(((e,t)=>t?e?e+=`, ${t}`:t:e),void 0);if(n)throw new ve(n,JSON.stringify(t));return!0}function be(e){if(isNaN(e)||"number"!=typeof e&&"string"!=typeof e)return"value must be a number"}function Ee(e){return t=>{const n=t&&"symbol"!=typeof t?t.toString():t;if(!(e.indexOf(n)>=0))return`value must be one of [${e.join(",")}]`}}function Ie(e){if(null==e||""===e)return"value must not be omitted"}function xe(e){const t=new RegExp(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/);if("string"!=typeof e||!t.test(e))return"value must be a valid hex color"}function Se(e){const t=new RegExp(/^(?:(?:data:image\/[^;]+;base64[^"]+)|(?:(?:https?:)?\/\/[a-zA-Z\d-]+(?:\.[a-zA-Z\d-]+)*(?::\d{1,10})?)?(?:\.\.?\/?)*\/(?:[a-zA-Z\d\-_]+\/)*[a-zA-Z\d\-_]+\.[a-zA-Z\d]{2,6}(?:\?(?:.+=.+&?)*)?)(?:#.+)?$/);if("string"!=typeof e||!t.test(e))return"value must be a valid CSS URL string"}function we(e){if(null!=e&&""!==e)return"value must not be specified"}function Ce(e){return t=>{if(t&&"object"==typeof t&&"value"in t&&"type"in t&&"string"==typeof t.type&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t.type)&&"function"==typeof e[t.type]){const n=e[t.type](t.value);if(!n)return;return`object must have valid "value" for type: ${t.type}: ${n}`}return`value must be an object that has a "type" property that matches one of: [${Object.keys(e).join(", ")}] and a "value" property`}}function Oe(...e){return t=>{if("string"==typeof t){const n=t.split(" ");if(n.length>1&&e.indexOf(n.length)>-1){if(!n.reduce(((e,t)=>e||be(t)),void 0))return}}return`value must be a space separated list of numbers, of one of the following lengths: ${e.join(" ,")}`}}function Ae(e,t){return n=>{const a=e(n),i=t(n);if(a&&i)return`one of these must be true: ${a} -OR- ${i}`}}function Te(e){if("string"!=typeof e)return"value must be a string"}const Re=i.is(Object);function je(e){const t=Object.entries(e);return n=>Re(n)&&!Array.isArray(n)?t.reduce(((e,[t,a])=>e||a(n[t])),void 0):`Input value (${e}) must be an object`}function Le(e){if("number"!=typeof e&&"string"!=typeof e||isNaN(e)||!(e>=0))return"value must be a positive number"}function Ne(e,t,n){return ge(be,n)?he(pe(e,t),`${n}`):""}function _e(e){return(t,n,a)=>ge(Ee(Object.keys(e)),a)?he(pe(t,n),`${e[a]}`):""}function De(e){return ge(Ie,e)?fe({light:t(Se,!1),dark:t(Ae(we,Se),!0)},ye("\n "))(e):"";function t(e,t){return n=>{if(ge(e,n)&&n){const e=he("background-image",`url("${n}")`);return t?me(e):e}return""}}}function ke(e){const t={crop:"auto",fit:"contain",fill:"cover"};return"string"==typeof e&&(e=e.toLowerCase()),ge(Ae(we,Ee(Object.keys(t))),e)&&e?he("background-size",t[e]):""}const Pe=i.cond([[i.equals("top-left"),i.always("top left")],[i.equals("top-right"),i.always("top right")],[i.equals("bottom-left"),i.always("bottom left")],[i.equals("bottom-right"),i.always("bottom right")],[i.T,i.identity]]);function $e(e){const t="string"==typeof e?e.toLowerCase():e;return ge(Ae(we,Ee(["top","right","bottom","left","center","top-left","top-right","bottom-left","bottom-right"])),t)&&t?he("background-position",Pe(t)):""}function Ge(e,t,n){return ge(Ae(be,Oe(2,3,4)),n)?he(pe(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function Fe(e){return(t,n,a)=>ge(Ce({fit:Ee(e),percentage:be,fixed:be}),a)?he(pe(t,n),function(e){const t={"wrap-content":"fit-content","fit-width":"100%","fit-height":"100%"};switch(e.type){case"fixed":return`${e.value}px`;case"percentage":return`${e.value}%`;case"fit":return t[e.value]}}(a)):""}const Me=je({light:xe,dark:Ae(we,xe)});function Be(e,t,n){return a=>{if(a){const i=he(pe(e,t),Ve(String(a)));return n?me(i):i}return""}}function Ue(e,t,n){return ge(Me,n)?fe({light:Be(e,t,!1),dark:Be(e,t,!0)},ye("\n "))(n):""}function Ve(e){const t=e.toUpperCase();switch(t.length){case 5:return`#${t.substring(2,5)}${t[1]}`;case 9:return`#${t.substring(3,9)}${t[1]}${t[2]}`;default:return t.toUpperCase()}}const ze=je({offsetX:Ae(we,be),offsetY:Ae(we,be),blurRadius:Ae(we,be),spreadRadius:Ae(we,be),color:Me}),qe=e=>t=>null!=t?String(t):e,He=i.compose(i.concat(i.__,"px"),qe("0")),We=e=>t=>"string"==typeof t?e(t):t,Je=i.compose(We(i.concat(i.__,"px")),qe(void 0)),Ye=i.compose(We(Ve),i.prop("dark"));function Ke(e,t,n){return he(e,fe({offsetX:He,offsetY:He,blurRadius:t.spreadRadius?He:Je,spreadRadius:Je,color:n},ye(" "))(t))}const Ze={center:"center","flex-end":"flex-end","flex-start":"flex-start",stretch:"stretch"},Qe={container:{justifyContent:_e(Ze),alignItems:_e(Ze),shadow:function(e,t,n){var a,o,r;if(ge(ze,n)){const s=pe(e,t);return ye("\n")(Ke(s,n,(o="light",r="#80000000",i.compose(Ve,i.propOr(r,o)))),(null===(a=n.color)||void 0===a?void 0:a.dark)?me(Ke(s,n,Ye)):"")}return""},gap:Ge,overflow:_e({hidden:"hidden",visible:"visible"}),blur:function(e,t,n){return ge(Le,n)?he(pe(e,t),`blur(${n.toString()}px)`):""},opacity:Ne},text:{textColor:Ue,fontSize:Ge,fontFamily:function(e,t,n){return ge(Te,n)?he(pe(e,t),(a=`${n}`,a.replace(/['();{}@:[\]!/=]/g,"")).split(",").map(((e,t)=>{const n=0===t?e:e.trim();if(n.includes(" ")){const e=n.startsWith('"')?"":'"',t=n.endsWith('"')?"":'"';return`${e}${n}${t}`}return n})).join(",")):"";var a},fontWeight:_e({100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900}),fontStyle:_e({normal:"normal",italic:"italic"}),lineHeight:Ge,lineLimit:function(e,t,n){return ge(be,n)?`\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: ${n};\n line-clamp: ${n}; \n -webkit-box-orient: vertical;\n `:""},letterSpacing:Ge,baselineTextAlign:_e({super:"super",sub:"sub",baseline:"baseline"}),horizontalTextAlign:_e({left:"left",right:"right",center:"center",start:"start",end:"end",justify:"justify"}),textDecoration:_e({underline:"underline","strike-through":"line-through",none:"none"}),textTransform:_e({capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",none:"none"})},background:{backgroundColor:Ue,backgroundImage:function(e,t,n){return ge(Ie,n)?fe({url:De,position:$e,scale:ke},ye)(n):""}},dimension:{width:Fe(["wrap-content","fit-width"]),maxWidth:Ge,minWidth:Ge,height:Fe(["wrap-content","fit-height"]),maxHeight:Ge,minHeight:Ge,rotateZ:(Xe="Z",(e,t,n)=>{const a=`rotate${Xe}`;return ge(be,n)?he(pe(e,t),`${a}(${n.toString()}deg)`):""})},flexChild:{alignSelf:_e(Ze),weight:Ne,order:Ne},spacing:{margin:Ge,padding:Ge,offset:function(e,t,n){return ge(Oe(2),n)?`transform:translate(${n.split(" ").join("px, ")}px)`:""}},border:{borderColor:Ue,borderRadius:Ge,borderWidth:Ge,borderStyle:_e({solid:"solid",dashed:"dashed"})}};var Xe;function et(e){return Object.keys(e).reduce(((t,n)=>(n&&e[n]&&Object.keys(e[n]).forEach((a=>{if(!Qe[n])throw new Error(`No styling transformers exist for styling category key: ${n}`);const i=Qe[n][a];if(!i)throw new Error(`No styling transformer exists for property: ${n}.${a.toString()}`);try{t+=i(n,a,e[n][a])}catch(e){throw e&&"object"==typeof e&&"message"in e&&(e.message=`Error parsing styling key ${n}.${a.toString()}: ${e.message}`),e}})),t)),"")}const tt="FAILED_TEMPLATING_DATA",nt=new Map;function at(e){return String.fromCharCode(97+e)}function it(e,t,n){const a=`${e||S.pluginId}-${void 0!==t?String(t):"outer"}`,i=nt.get(a);if(i&&i.sheet.container.isConnected)return i.css;const o=function(e,t){const n={key:void 0!==e?`inner-css-${at(e)}`:"outer-css",container:t};return t&&t.parentElement&&(n.container=t.parentElement),p(n)}(t,n);return nt.set(a,o),o.css}const ot="%%%OWN_CLASS_REF%%%",rt=i.memoizeWith(((e,t,n,a)=>`${String(e)}-${t}-${n}`),st);function st(e,t,n,a){const i=it(t,n,a);let o=1;return function t(n,a=!1){var r;if("string"==typeof n){const e={scopeClass:n};return t.bind(e)}const s=n,l=this.scopeClass,c=Object.entries(null!==(r=s.elements)&&void 0!==r?r:{});try{const t=c.reduce(((t,[n,i])=>Object.assign(Object.assign({},t),{[n]:lt(i,l,a,String(n),e)})),{}),n=Object.entries(t),r=a?"parent-"+o++:"",s=function(e){return"own"in e&&"string"==typeof e.own&&e.own.length>0}(t)?i(t.own):"";return n.reduce(((e,[t,n=""])=>{if("own"===t)return e;const a=n.replace(ot,r);return Object.assign(Object.assign({},e),{[t]:a?i(a):""})}),{own:`${s}${s&&r?" ":""}${r}`})}catch(e){const t=e;throw t.code="FAILED_PARSING_STYLES",t}}.bind({})}function lt(e,t,n,a,i){return e.map(function(e,t,n){return a=>Object.entries(a).map((([a,i])=>{const o=i?et(i):"";switch(!0){case"default"===a:return o?`\n${o}\n`:"";case Boolean(e):return`\n .${e}${de(a)} & {\n${o}\n}\n`;case t&&"own"!==n:return`\n .${ot}${de(a)} & {\n${o}\n}\n`;default:return`\n &${de(a)} {\n${o}\n}\n`}})).join("")}(t,n,a)).reduce(((e,t,n)=>{const a=i[n];return void 0!==a?e+(0===n?t:`${le(a,t)}\n`):e}),"")}const ct=t.createContext(i.always(void 0)),dt=()=>t.useContext(ct),ut=t.createContext(null);function pt(e,n){var a;const i=t.useContext(ut);return i&&null!==(a=n(i))&&void 0!==a?a:e}const ft=t.createContext((()=>{throw Error("Node Mapper Context does not have a mapper. Use the NodeMapperProvider with the default nodeMapper as a value before you consume this mapper")})),yt=ft.Consumer,ht=()=>t.useContext(ft),mt=e=>t.createElement(ft.Provider,{value:(t,n,a)=>e.value(t,null!=n?n:e.overrides,a)},e.children),vt=t.createContext(null),gt=()=>t.useContext(vt),bt=t.createContext({get(){throw Error("Offer context has not been set")}}),Et=e=>t.createElement(bt.Provider,{value:{get:()=>e.context}},e.children),It=()=>t.useContext(bt).get(),xt=()=>{try{return t.useContext(bt).get().creative.copy}catch(e){return}},St=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),wt=i.compose(i.not,i.isEmpty),Ct=i.where({url:wt,title:wt});function Ot(e,t,n){return t.reduce(((t,n)=>{const[a,i]=n.slice(0,-1).split("["),o=i?i.split(","):[];if(!a)throw new Error(Tt(e,"This Meta Attribute could not be parsed."));return function(e,t,n,a){switch(t){case"openLinks":return function(e,t,n){At(t,e,"openLinks",1,2);const a=Rt(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),i=jt(t,1,(e=>"string"==typeof e&&e.length?e:null));if("InApp"===a)return n.replace(St,((e,t)=>`<a ${ne} ${i?`${ae}="${i}" `:""}${t}`));return n}(e,n,a);case"sliceText":return function(e,t,n){At(t,e,"sliceText",2,2);const a=Rt(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),i=Rt(t,e,1,(e=>{const t=Number(e);return!Number.isNaN(t)&&t>=0?t:null}),"sliceText meta attribute second argument must be a positive number");if("Chars"===a)return function(e,t){const n=new RegExp("(?<=<a.*>).*(?=</a>)");return e.startsWith("<a")?e.replace(n,(e=>e.slice(0,t))):e.slice(0,t)}(n,i);throw Error(Tt(e,`Unknown "SliceBy" value. ${a}`))}(e,n,a);default:throw new Error(Tt(e,`Unknown Meta Attribute '${t}'.`))}}(e,a,o,t)}),n)}function At(e,t,n,a,i){const o=new Error(Tt(t,`${n} meta attribute takes ${a!=i?`between ${a} and ${i}`:a} arguments; received ${e.length}.`));if(e.length<a||e.length>i)throw o}function Tt(e,t){return`Malformed Meta Attribute: '${e}' - ${t}`}function Rt(e,t,n,a,i){const o=jt(e,n,a);if(null!==o)return o;throw Error(Tt(t,i||`Could not parse meta attribute argument at index ${n} from arguments ${JSON.stringify(e)}`))}function jt(e,t,n){return n(e[t])}const Lt="DATA",Nt="STATE",_t=new RegExp(`^(${Lt}|${Nt})`),Dt=new RegExp(`^${Nt}`),kt=new RegExp(`%\\^(?:${Lt}|${Nt})\\.[a-zA-Z0-9]+[a-zA-Z0-9\\.]*(?:\\:[a-zA-Z0-9]+\\[[a-zA-Z0-9\\.,]*\\])*(?:\\|.*?)?\\^%`,"g"),Pt=Symbol("invalid");function $t(e,t="creativeCopy"){const n=Gt({data:e},t);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Gt(t,n,this.dataMap)});let a=!1;const o=t,r=i.pipe(i.slice(2,-2),i.split("|"),(e=>{const t=i.reduce(((e,t)=>{let n;if(_t.test(t)){if(!this.dataMap.has(t)&&Dt.test(t))throw new T(tt,`Invalid use of STATE template key in a context it does not exist: ${t}`);const a=i.split(":",t);if(a[0]){if(n=this.dataMap.get(a[0]),n&&n===Pt)throw new T(tt,`Invalid template key referenced: "${t}" is an object but expected a string, boolean, number or empty. \nDid you mean to reference a child property of ${t}?`);if(a.length>1&&n)try{n=Ot(a[0],a.slice(1),n)}catch(e){throw new T(tt,`Failed to apply meta attributes. ${function(e){return null!=e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:String(e)}(e)}`)}}return n?i.reduced({provided:!0,value:n}):e}return i.reduced({provided:!0,value:t})}),{provided:!1,value:""},e);return t.provided||(a=!0),t.value})),s=i.replace(kt,r,o);return!1===a?s:""}.bind({dataMap:n})}function Gt(e,t,n){const a=new Map(n);return"data"in e&&o(e.data,`${Lt}${t?"."+t:""}`),"state"in e&&o(e.state,`${Nt}${t?"."+t:""}`),a;function o(e,t){"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e?a.set(t,(null==e?void 0:e.toString())||""):a.set(t,Pt),e&&"object"==typeof e&&i.forEachObjIndexed(((e,n)=>o(e,`${t}.${n}`)),e)}}const Ft=t.createContext($t({})),Mt=Ft.Consumer,Bt=Ft.Provider,Ut=()=>t.useContext(Ft),Vt=t.createContext(null),zt=Vt.Provider,qt=t.createContext("OUTER"),Ht=()=>"VARIANT"===t.useContext(qt),Wt=t.createContext(void 0),Jt=()=>t.useContext(Wt);var Yt,Kt,Zt,Qt,Xt,en,tn=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())}))},nn=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},an=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};class on{constructor(e,t,n,a,o){Yt.set(this,void 0),Kt.set(this,void 0),Zt.set(this,new Set),Qt.set(this,void 0),Xt.set(this,void 0),en.set(this,void 0),nn(this,Yt,i.partial(e.subscribe.bind(e),[n]),"f"),nn(this,Kt,i.partial(e.dispatch.bind(e),[n]),"f"),nn(this,Qt,t,"f"),nn(this,Xt,a,"f"),nn(this,en,o,"f"),this.onGlobalStateChange=this.onGlobalStateChange.bind(this),this.onInteractivityChange=this.onInteractivityChange.bind(this),this.onEvent=this.onEvent.bind(this),this.globalDispatch=this.globalDispatch.bind(this),this.createChildPlugin=this.createChildPlugin.bind(this)}onGlobalStateChange(e){const t=an(this,Yt,"f").call(this,e),n=()=>{t(),an(this,Zt,"f").delete(n)};return an(this,Zt,"f").add(n),n}onInteractivityChange(e){return an(this,Xt,"f").subscribe(e)}onEvent(...e){const t=e.reduce(((e,t)=>{if("partner"===t.source||"*"===t.source){const n=an(this,en,"f").call(this,t.name).subscribe(t.callback);return[...e,()=>n.unsubscribe()]}return e}),[]),n=()=>{t.forEach((e=>{e()})),an(this,Zt,"f").delete(n)};return an(this,Zt,"f").add(n),n}globalDispatch(e){an(this,Kt,"f").call(this,e)}dispose(){an(this,Zt,"f").forEach((e=>e())),nn(this,Zt,new Set,"f"),an(this,Xt,"f").clear()}createChildPlugin(e){return an(this,Qt,"f").call(this,e)}}Yt=new WeakMap,Kt=new WeakMap,Zt=new WeakMap,Qt=new WeakMap,Xt=new WeakMap,en=new WeakMap;class rn{onGlobalStateChange(){return()=>{}}onInteractivityChange(){return()=>{}}onEvent(){return()=>{}}globalDispatch(){}dispose(){}createChildPlugin(){return{close:()=>tn(this,void 0,void 0,(function*(){})),onClose:()=>tn(this,void 0,void 0,(function*(){})),putConfig:()=>tn(this,void 0,void 0,(function*(){})),send:()=>tn(this,void 0,void 0,(function*(){})),onEvent:()=>({subscribe:()=>({unsubscribe:()=>{}})})}}}var sn,ln,cn=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},dn=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};class un{constructor(e){sn.set(this,void 0),ln.set(this,new Set),cn(this,sn,e,"f")}subscribe(e){return dn(this,ln,"f").add(e),!0===e(dn(this,sn,"f"))&&dn(this,ln,"f").delete(e),()=>{dn(this,ln,"f").delete(e)}}publish(e){cn(this,sn,e,"f"),dn(this,ln,"f").forEach((e=>{!0===e(dn(this,sn,"f"))&&dn(this,ln,"f").delete(e)}))}clear(){dn(this,ln,"f").clear()}}sn=new WeakMap,ln=new WeakMap;var pn=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)},fn=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n};const yn="breakpoint-0px";class hn{constructor(){this.logger=()=>{}}withAppFactory(e){return this.appFactory=e,this}withLogger(e){return this.logger=e,this}withGatewayFactory(e){return this.gatewayFactory=e,this}build(){var e,t,n,a,i,o,r;const s=this.appFactory,l=this.logger,c=null!==(e=this.gatewayFactory)&&void 0!==e?e:()=>new rn;return r=class extends HTMLElement{static get observedAttributes(){return["visible","interactivity","active-breakpoint"]}attributeChangedCallback(e,i,r){if(r!==i)switch(e){case"visible":pn(this,n,"f").call(this,"true"===r);break;case"interactivity":"ENABLED"!==r&&"DISABLED"!==r||pn(this,a,"f").call(this,r);break;case"active-breakpoint":pn(this,t,"m",o).call(this,r,i)}}makeInteractivityUpdateHandler(e){fn(this,a,(t=>{e.publish(t)}),"f")}makeVisbilityUpdateHandler(e,t,a){const i="true"===this.getAttribute("visible"),o=this.getAttribute("slotInstanceGuid");fn(this,n,(i=>{i&&(fn(this,n,(()=>null),"f"),0===e&&a.globalDispatch({type:W,payload:{event:"Interactive"}}),t&&a.globalDispatch({type:H,payload:{name:"SignalImpression",parentGuid:t}}),o&&a.globalDispatch({type:H,payload:{name:"SignalImpression",parentGuid:o}}))}),"f"),pn(this,n,"f").call(this,i)}getOfferPositionAttr(){const e=this.getAttribute("offerPositionIndex"),t=Number(e);return(null==e||isNaN(t)||t<0)&&d(`Offer position attribute (${e}) is invalid`),t}getJSONAttr(e,t="{}"){const n=this.getAttribute(e);try{return JSON.parse(null!=n?n:t)}catch(t){d(`Invalid JSON attribute ${e}: ${n}`)}}constructor(){super(),t.add(this),n.set(this,(()=>null)),a.set(this,(()=>null)),i.set(this,void 0);const e=this.attachShadow({mode:"open"});fn(this,i,document.createElement("div"),"f"),pn(this,i,"f").id="app-container",pn(this,i,"f").classList.add("default"),e.appendChild(pn(this,i,"f"))}connectedCallback(){var e,t,n;const a=this.getAttribute("container"),o=this.getAttribute("plugin-id");pn(this,i,"f").setAttribute("style","width:100%;display:flex;flex-direction:"+("column"===a?"column":"row"));const r=this.getOfferPositionAttr(),u=this.getJSONAttr("layoutSchema"),p=this.getJSONAttr("childLayouts","[]"),f=this.getJSONAttr("offerData"),y=new un("DISABLED"===this.getAttribute("interactivity")?"DISABLED":"ENABLED"),h=null!==(e=this.getAttribute("schemaVersion"))&&void 0!==e?e:"";s||d("Cannot create app without factory. Please build the connector withAppFactory.");const m=c({offerPositionIndex:r,creativeInstanceGuid:null===(t=null==f?void 0:f.creative)||void 0===t?void 0:t.instanceGuid},y);this.makeInteractivityUpdateHandler(y),s({rootElement:pn(this,i,"f"),gateway:m,logger:l,offerPositionIndex:r,offerData:f,layoutSchema:u,childLayouts:p,schemaVersion:h,pluginId:o||S.pluginId}),this.makeVisbilityUpdateHandler(r,null===(n=null==f?void 0:f.creative)||void 0===n?void 0:n.instanceGuid,m)}},n=new WeakMap,a=new WeakMap,i=new WeakMap,t=new WeakSet,o=function(e,t){pn(this,i,"f").classList.remove(t||yn),pn(this,i,"f").classList.add(e||yn)},r;function d(e){throw l({level:O,code:"MODULE_BUILDER/FAILED_TO_BUILD_MODULE",message:e}),Error(e)}}}const mn=t.createContext({get:()=>new rn}),vn=e=>t.createElement(mn.Provider,{value:{get:()=>e.context}},e.children);const gn=t.createContext({get(){throw Error("Layout Schema context has not been set")}}),bn=e=>t.createElement(gn.Provider,{value:{get:()=>e.context}},e.children),En=()=>t.useContext(gn).get(),In=t.createContext("ENABLED"),xn=()=>t.useContext(In);function Sn(e){const t=Cn(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Cn(t,this.dataMap)});if(!n)throw new T("FAILED_TO_MAP_STATIC_DATA","No namespace submitted to StaticData Mapper");const a=t;return i.path([n,a],this.dataMap)}.bind({dataMap:t})}const wn={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function Cn(e,t=wn){return["images","links","icons","copy","responseOptionsMap"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Object.assign(Object.assign({},t[n]),e[n])})),t)}const On=t.createContext(Sn({}));On.Consumer;const An=On.Provider,Tn=()=>t.useContext(On),Rn=t.createContext({});function jn({info:e,children:n}){const a=t.useContext(Rn);return t.createElement(Rn.Provider,{value:Object.assign(Object.assign({},a),e)},n)}const Ln=t.createContext({get(){throw Error("Catalog Item context has not been set")}}),Nn=e=>t.createElement(Ln.Provider,{value:{get:()=>e.context}},e.children),_n=()=>t.useContext(Ln).get(),Dn=t.createContext(""),kn=()=>t.useContext(Dn),Pn=t.createContext(""),$n=i.compose(i.anyPass([i.isEmpty,i.all(i.isEmpty)]),i.flatten,i.map(i.values),i.map(i.ifElse(i.isNil,i.always({}),i.identity)),i.values,i.propOr({},"value")),Gn=i.compose(i.isEmpty,i.prop("predicates"));function Fn(e,t){return`transition: ${t.map((t=>`${t} ${e}ms`)).join(", ")};`}const Mn=i.curry(((e,{duration:t,predicates:n,styles:a})=>{return{predicates:n,classname:e(et(a)),transitionBaseClassname:e(Fn(t,(o=a,i.toPairs(o).flatMap((e=>{const[t,n]=null!=e?e:[];return n&&t?i.keys(n).map((e=>pe(t,e))):[]})))))};var o})),Bn=i.anyPass([$n,Gn]);const Un={is:i.equals,"is-not":i.compose(i.not,i.equals),"is-below":i.lt,"is-above":i.gt};function Vn(e,t){return e.includes(t)}const zn={is:i.equals,"is-not":i.compose(i.not,i.equals),exists:Vn,"not-exists":i.compose(i.not,Vn)},qn={exists:i.compose(i.not,i.either(i.isNil,i.isEmpty)),"not-exists":i.either(i.isNil,i.isEmpty)},Hn={"is-true":i.equals(!0),"is-false":i.equals(!1)},Wn={is:i.equals,"is-not":i.compose(i.not,i.equals)};function Jn(e){return(t,n)=>n[e]}const Yn=i.cond([[(e,t)=>i.equals("Breakpoint",e),Jn("activeBreakpoint")],[(e,t)=>i.equals("Progression",e),Jn("progressionIndex")],[(e,t)=>i.equals("Position",e),Jn("positionIndex")]]);function Kn(e,t){return e.creativeCopy&&"string"==typeof e.creativeCopy[t]?e.creativeCopy[t]:void 0}const Zn=i.cond([[i.equals("Breakpoint"),(e,t,n)=>{const a=i.lensPath(["breakpoints",t]);return i.pipe(i.over(a,Number),i.view(a))(n)}],[i.equals("Progression"),(e,t,n)=>i.cond([[i.gt(0),i.add(n.totalGroups)],[i.lte(0),i.identity]])(Number(t))],[i.equals("Position"),(e,t,n)=>i.cond([[i.gt(0),i.add(n.totalOffers)],[i.lte(0),i.identity]])(Number(t))]]),Qn=i.compose(i.not,isNaN);function Xn(e,t){return e.map((e=>{var n,a,i;switch(e.type){case"StaticString":return(0,Wn[e.predicate.condition])(e.predicate.input,e.predicate.value);case"CreativeCopy":return(0,qn[e.predicate.condition])(Kn(t,e.predicate.value));case"StaticBoolean":return(0,Hn[e.predicate.condition])(e.predicate.value);case"CustomState":return(0,Un[e.predicate.condition])(null!==(n=t.customStates[e.predicate.key])&&void 0!==n?n:0,e.predicate.value);case"DomainState":return(0,Un[e.predicate.condition])(null!==(a=t.domainStates[e.predicate.key])&&void 0!==a?a:0,e.predicate.value);case"DarkMode":throw new Error("DarkMode has not yet been implemented.");case"Placeholder":return function(e){switch(e.predicate.type){case"TextValue":return(0,zn[e.predicate.content.condition])(e.predicate.content.input,e.predicate.content.value);case"TextLength":return(0,Un[e.predicate.content.condition])(e.predicate.content.input.length,e.predicate.content.value);case"Numeric":return(0,Un[e.predicate.content.condition])(Number(e.predicate.content.input),e.predicate.content.value);default:return!1}}(e);default:{const n=Un[e.predicate.condition],a=null!==(i=Yn(e.type,t))&&void 0!==i?i:NaN,o=Zn(e.type,e.predicate.value,t);return!!Qn(a)&&n(a,o)}}}))}function ea(e){return i.pathOr(0,["breakpoint","breakpoints",e.breakpoint.activeBreakpoint],e)}const ta={breakpoints:{},activeBreakpoint:NaN,progressionIndex:NaN,positionIndex:NaN,totalOffers:NaN,totalGroups:NaN,creativeCopy:{},customStates:{},domainStates:{}};function na(e,t,n,a){const o=t.map((e=>"Progression"===e.type?Object.assign(Object.assign({},e),{type:a?"Position":e.type}):e)),{cached:r,uncached:s}=o.reduce(((t,a)=>function(e,t,n,a){const o=function(e,t){switch(e.type){case"Position":case"StaticBoolean":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"StaticString":return`${e.type}:${e.predicate.input}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"CreativeCopy":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${Kn(t,e.predicate.value)}:${t.totalGroups}`;case"CustomState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.customStates[e.predicate.key]}`;case"DomainState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.domainStates[e.predicate.key]}`;case"Placeholder":return`${e.type}:${e.predicate.type}:${e.predicate.content.condition}:data:${e.predicate.content.input}:${e.predicate.content.value}`;default:return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${Yn(e.type,t)}:${t.totalGroups}`}}(e,t),r=n.current.get(o);return i.evolve(aa(r)?{cached:i.append(r)}:{uncached:i.append({key:o,predicate:e})},a)}(a,n,e,t)),{cached:[],uncached:[]}),l=Xn(s.map((({predicate:e})=>e)),n);return i.zip(s,l).forEach((([{key:t},n])=>{e.current.set(t,n)})),r.concat(l)}const aa=i.is(Boolean);const ia=i.curry(((e,t,n)=>{var a,i,o,r,s,l;return{breakpoints:n.breakpoint.breakpoints,activeBreakpoint:ea(n),progressionIndex:null!==(i=null===(a=n.progression)||void 0===a?void 0:a.activeGroupIndex)&&void 0!==i?i:0,totalOffers:null!==(r=null===(o=n.progression)||void 0===o?void 0:o.totalOffers)&&void 0!==r?r:0,totalGroups:null!==(l=null===(s=n.progression)||void 0===s?void 0:s.totalGroups)&&void 0!==l?l:0,customStates:n.customStates,domainStates:n.domainStates,positionIndex:e,creativeCopy:t}})),oa=i.lensPath(["predicate","content","input"]),ra=i.lensPath(["predicate","content","value"]);function sa(e,t){const n=i.over(oa,(t=>t?e(t):"")),a=i.over(ra,(t=>"string"==typeof t?e(t):t)),o=i.compose(n,a);return t.map((e=>"Placeholder"===e.type?"TextValue"===e.predicate.type?o(e):n(e):e))}const la=i.all(i.equals(!0));function ca(e){const n=Ht(),a=Jt(),o=t.useRef(new Map),r=xt(),s=pt(ta,ia(a,r)),l=Ut();return t.useMemo((()=>i.mapObjIndexed((e=>{const t=sa(l,e);return la(na(o,t,s,n))}),e)),[o,e,s,n,l])}function da(e){e&&(e.style.display="")}function ua(e){e&&(e.style.display="none")}function pa(e){return e.settings.duration}const fa=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],ya=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function ha(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const a=t?fa:ya,i=e.animate(a,{duration:n,iterations:1});return i.onfinish=()=>{t?da(e):ua(e)},i.oncancel=()=>{t?da(e):ua(e)},()=>{i.finish()}}return t?da(e):ua(e),()=>{}}function ma({inTransitions:e,outTransitions:n,visible:a,children:i,containerClassName:o}){const r=t.useRef(null);return t.useEffect((()=>a&&e?e.forEach((e=>{r.current&&function(e,t,n,a){if("FadeIn"===a)ha(e,t,n)}(r.current,a,pa(e),e.type)})):!a&&n?n.forEach((e=>{r.current&&function(e,t,n,a){if("FadeOut"===a)ha(e,t,n)}(r.current,a,pa(e),e.type)})):()=>{}),[a]),t.createElement("div",{ref:r,style:{display:"none"},className:o},i)}function va(e){const n=ht(),a=function(e){const n=Ht(),a=Jt(),i=t.useRef(new Map),o=xt(),r=pt(ta,ia(a,o)),s=sa(Ut(),e);return t.useMemo((()=>la(na(i,s,r,n))),[i,s,r,n])}(e.schema.predicates),i=t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0))));return e.schema.transition?t.createElement(ma,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:a},i):"functionally"===e.schema.hide?t.createElement(In.Provider,{value:a?"ENABLED":"DISABLED"},i):a?t.createElement(t.Fragment,null,i):null}const ga=i.mergeWith(((e,t)=>`${e||""} ${t||""}`.trim())),ba=e=>{var n;const a=t.useContext(Vt),o=Jt(),r=gt()||document.head,s=kn(),l=it(s,o,r),c=t.useCallback(rt,[]),d=pt([],(e=>Object.values(e.breakpoint.breakpoints))),u=a||c(d,s,o,r),p=e.styles?u(e.styles):{},f=e.styles&&e.styles.conditionalTransitions?function(e,t){const n=Mn(e);return i.mapObjIndexed((e=>Bn(t)||!e?null:n({predicates:t.predicates,duration:t.duration,styles:e})),t.value)}(l,null===(n=e.styles)||void 0===n?void 0:n.conditionalTransitions):void 0,y=ca(f?i.mapObjIndexed(i.propOr([],"predicates"),f):{}),h=i.mapObjIndexed(((e,t)=>e?function(e,t){var n;if(e&&t in e)return null===(n=e[t])||void 0===n?void 0:n.classname}(f,t):void 0),y),m=f?i.mapObjIndexed(i.prop("transitionBaseClassname"),f):{},v=e.styles?(g=m,ga(ga(p,h),g)):void 0;var g;return e.children({classnames:v,mapperRef:u})};function Ea(e){const n=ht();return t.createElement(ba,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"column"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,F(a,e.testId))))))}))}function Ia(e){const n=ht();return t.createElement(ba,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"row"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,F(a,e.testId))))))}))}const xa={allowedTags:["em","strong","a","br","u","p","li","ul","ol","s"],allowedAttributes:{a:["href","target",ne,ae],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],s:[]},allowedSchemes:["http","https"]},Sa=new Map([["&","_;^;_"]]),wa=new RegExp(`<a *(?=${xa.allowedAttributes.a.join("|")}|>)`,"g"),Ca=new RegExp('<a [^>]*href="([^"]+)"',"g"),Oa=new RegExp("(<br *?>)|(<br *?/>)","g"),Aa="<br/>";function Ta(e){const n=Ut(),a=xn(),i=t.useMemo((()=>{const t=n(e.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Ca,((e,t)=>{const n=t.replaceAll("&",Sa.get("&"));return e.replace(t,n)})).replaceAll(Oa,Aa)}(e);return t===u(t,xa)}(t))throw new T("FAILED_SANITISING_HTML","Invalid HTML tags");return t}),[e.schema.value,n]),{tabIndex:o,styles:r,isDisabled:s}=m(a);return i?t.createElement(ba,{styles:e.schema.styles},(({classnames:n})=>{const a=[(null==n?void 0:n.link)?`class = "${null==n?void 0:n.link}"`:"",s?'tabindex="-1"':"",s?"style=\"pointer-events: 'none'; user-select: none;\"":"",s?'aria-disabled="true"':""].filter((e=>e.length>0));return l=i,new RegExp("</(p|ul|ol)>").test(l)?t.createElement("div",{tabIndex:o,style:r,"aria-hidden":s,className:null==n?void 0:n.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:i.replace(wa,`<a ${a.join(" ")}`)}}):t.createElement("p",{tabIndex:o,style:r,"aria-hidden":s,className:null==n?void 0:n.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:i.replace(wa,`<a ${a.join(" ")}`)}});var l})):null}function Ra(e){const n=Ut()(e.schema.value),a=xn(),{tabIndex:i,styles:o,isDisabled:r}=m(a);return n?t.createElement(ba,{styles:e.schema.styles},(({classnames:a})=>{const s={tabIndex:i,"aria-hidden":r,className:null==a?void 0:a.own,"data-testid":e.testId,"data-e2e":"BasicText"};return e.isInline?t.createElement("span",Object.assign({style:o},s),n):t.createElement("p",Object.assign({style:o},s),n)})):null}function ja(e,n,a){if("BasicText"===e.type)return t.createElement(Ra,{schema:e.node,testId:n,isInline:null!=a&&a})}function La(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,F(t,a)))))}function Na(e){const n=dt(),a=ht(),i=It(),o=Ut(),r=Jt(),s=xn(),l=i.creative.responseOptionsMap[e.schema.responseKey],c=I(l);t.useEffect((()=>{c&&n(function(e){if(e.externalKey)return{type:K,payload:{criteria:{key:e.externalKey},signal:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:e.action,externalKey:e.externalKey}}}};throw new Error(`Invalid External Response: No 'externalKey' found for external response option with instanceGuid: ${e.instanceGuid}`)}(l))}),[l,n,c]);const d=l?o({data:l},"creativeResponse"):o,{tabIndex:u,styles:p,isDisabled:f}=m(s);return E(l)&&!c&&void 0!==r?t.createElement(ba,{styles:e.schema.styles},(({classnames:o,mapperRef:r})=>{var s;return t.createElement("button",{type:"button",tabIndex:u,"aria-disabled":f,"aria-label":null!==(s=e.schema.a11yLabel)&&void 0!==s?s:void 0,style:Object.assign({cursor:"pointer"},p),"data-testid":e.testId,"data-e2e":"CreativeResponse","data-e2e-response-type":e.schema.responseKey,onClick:e=>{e.preventDefault();const t=function(e,t){switch(t.action){case"Fulfillment":{const n=e.creative.fulfillment;if(b(n))return{fulfillment:n,responseOption:t,creativeInstanceGuid:e.creative.instanceGuid};throw new Error(`Invalid Fulfillment: ${n} with referralCreativeID: ${e.creative.referralCreativeId}`)}case"Url":return Object.assign(Object.assign({},t),{accountID:e.accountId,creativeInstanceGuid:e.creative.instanceGuid,referralCreativeID:e.creative.referralCreativeId});default:return Object.assign(Object.assign({},t),{creativeInstanceGuid:e.creative.instanceGuid})}}(i,l);n({type:B,payload:t})},className:null==o?void 0:o.own,disabled:f},t.createElement(Bt,{value:d},(null==o?void 0:o.own)?function(e,n,a,i,o){return t.createElement(zt,{value:a(n)},La(e,i,o))}(e.schema.children,o.own,r,a,e.testId):La(e.schema.children,a,e.testId)))})):null}function _a(e){const n=xn(),{styles:a,isDisabled:i}=m(n);return e.schema.url.light?t.createElement(ba,{styles:h(e.schema.styles)},(({classnames:n})=>t.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},a),{display:"inline-block"}),alt:i?void 0:e.schema.alt||void 0,title:e.schema.title||void 0,className:n?n.own:void 0,"data-testid":e.testId,"data-e2e":"StaticImage",src:e.schema.url.light}))):null}function Da(e){const n=xn(),{styles:a,isDisabled:i}=m(n),o=(r=e.schema.imageKey,t.useContext(On)(r,"images"));var r,s;return null!=(s=o)&&"object"==typeof s&&"light"in s&&"string"==typeof s.light?t.createElement(ba,{styles:h(e.schema.styles)},(({classnames:n})=>t.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},a),{display:"inline-block"}),alt:o.alt,title:o.title,className:n?n.own:void 0,"data-testid":e.testId,"data-e2e":"DataImage",src:o.light}))):null}const ka={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function Pa(e){const n=e.schema.name,a=e.schema.description,i=e.schema.styles?$(ka,e.schema.styles):ka,o=xn(),{styles:r,isDisabled:s}=m(o);return n?t.createElement(ba,{styles:i},(({classnames:i})=>t.createElement("span",Object.assign({style:Object.assign(Object.assign({},r),{display:"inline-block"}),className:"rokt-icon"+((null==i?void 0:i.own)?" "+i.own:""),"data-testid":e.testId,"data-e2e":`StaticIcon-${n}`},!s&&a?{title:a}:{"aria-hidden":"true"}),n))):null}const $a={backgroundColor:"#FFEEEE",color:"#FF0000",fontSize:"10px",padding:"4px",border:"1px solid #FF0000",margin:0,whiteSpace:"normal"};class Ga extends t.Component{constructor(e){super(e),this.state={errorMessage:""}}static getDerivedStateFromError(e){return{errorMessage:e.message}}componentDidUpdate(e){this.state.errorMessage&&JSON.stringify(e.schema)!==JSON.stringify(this.props.schema)&&this.setState({errorMessage:""})}componentDidCatch(e,t){var n;this.props.reporter&&"true"===se.REPORT_RENDER_ERRORS&&this.props.reporter({level:O,code:null!==(n=e.code)&&void 0!==n?n:"UNHANDLED_RENDERING_EXCEPTION",message:e.message,additionalInformation:Object.assign({componentStack:t.componentStack,stack:e.stack},this.context||{})})}render(){return this.state.errorMessage?"true"===se.DISPLAY_ERRORS?t.createElement("pre",{style:$a},t.createElement("strong",null,"Error:")," [",t.createElement("em",null,this.props.schema.type),"]"," ",this.state.errorMessage):void 0:this.props.children}}Ga.contextType=Rn;const Fa={internally:"_top",externally:"_blank"};function Ma(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Ba(e){var n;const a=Fa[e.schema.open],i=ht(),o=xn(),{tabIndex:r,styles:s,isDisabled:l}=m(o);return(null===(n=e.schema.children)||void 0===n?void 0:n.length)>0?t.createElement(ba,{styles:e.schema.styles},(({classnames:n,mapperRef:o})=>{var c;return t.createElement("a",{href:e.schema.src,"data-testid":e.testId,"data-e2e":"StaticLink",target:null!=a?a:"_blank",tabIndex:r,"aria-disabled":l,"aria-label":null!==(c=e.schema.a11yLabel)&&void 0!==c?c:void 0,style:Object.assign({cursor:"pointer",textDecoration:"none",display:e.isInline?"inline":"block"},s),className:null==n?void 0:n.own},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(zt,{value:a(n)},Ma(e,i,o))}(e.schema.children,null==n?void 0:n.own,o,i,e.testId):Ma(e.schema.children,i,e.testId))})):null}function Ua(e,n,a){if("StaticLink"===e.type)return t.createElement(Ba,{schema:e.node,testId:n,isInline:null!=a&&a})}const Va={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function za(e){const n=(a=e.schema.iconKey,t.useContext(On)(a,"icons"));var a;const i=null==n?void 0:n.name,o=e.schema.styles?$(Va,e.schema.styles):Va,r=xn(),{styles:s}=m(r);return i?t.createElement(ba,{styles:o},(({classnames:n})=>t.createElement("span",{style:Object.assign(Object.assign({},s),{display:"inline-block"}),"aria-hidden":"true",className:"rokt-icon"+((null==n?void 0:n.own)?" "+n.own:""),"data-testid":e.testId,"data-e2e":`DataIcon-${i}`},i))):null}const qa=o.css`
|
|
2
2
|
display: flex;
|
|
3
3
|
position: relative;
|
|
4
4
|
overflow: hidden;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
> * {
|
|
7
7
|
position: absolute !important;
|
|
8
8
|
}
|
|
9
|
-
`;function Ha(e){const n=
|
|
9
|
+
`;function Ha(e){const n=ht(),a=t.useRef(null);return t.useEffect((()=>{const e=new ResizeObserver((()=>{requestAnimationFrame((()=>{if(a.current){const e=Array.from(a.current.children).reduce(((e,t)=>Math.max(e,t.clientHeight)),0);a.current.style.height=`${e}px`}}))}));return a.current&&Array.from(a.current.children).forEach((t=>{e.observe(t)})),()=>{e.disconnect()}}),[]),t.createElement(ba,{styles:e.schema.styles},(({classnames:i})=>{var o;return t.createElement("div",{ref:a,className:[qa,null==i?void 0:i.own].filter(Boolean).join(" ")||void 0,"aria-label":null!==(o=e.schema.a11yLabel)&&void 0!==o?o:void 0,"data-testid":e.testId,"data-e2e":"ZStack"},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,F(a,e.testId))))))}))}const Wa={elements:{own:[{default:{dimension:{width:{type:"percentage",value:100},height:{type:"fixed",value:50}},background:{backgroundColor:{light:"#000"}},border:{borderRadius:25}}}],thumb:[{default:{dimension:{width:{type:"fixed",value:50},height:{type:"fixed",value:50}},background:{backgroundColor:{light:"#FFF"}},text:{fontSize:22,fontFamily:"rokt-icons",horizontalTextAlign:"center"},border:{borderRadius:25}}}],fill:[{default:{background:{backgroundColor:{light:"#000"}}}}],label:[{default:{text:{fontSize:18,textColor:{light:"#FFF"},horizontalTextAlign:"center"}}}]}};function Ja(e){const[n,a]=t.useState(!1),[i,o]=t.useState(!1),r=kn(),s=xn(),l=Jt(),c=dt(),{customStateKey:d,customStateValue:u,label:p,a11yLabel:f,thumb:y}=e.schema,{containerClass:h,trackClass:v,fillClass:b,thumbClass:E,labelClass:I,buttonClass:x}=function(e,t){const n=it(e,t);return{containerClass:n`
|
|
10
10
|
position: relative;
|
|
11
11
|
z-index: 1;
|
|
12
12
|
flex: 1;
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
z-index: 0;
|
|
55
55
|
background-color: #00000000;
|
|
56
56
|
color: #00000000;
|
|
57
|
-
`}}(r,c);if(!u)throw new Error("No custom state key provided for state trigger node.");const O={type:W,payload:{key:u,value:null!=p?p:1}},w={type:q,payload:{name:"SignalUserInteraction",action:"Swipe",context:"SlideStateTrigger"}},C=e.schema.styles?L(Wa,e.schema.styles):Wa,A=t.useRef(null),T=t.useRef(null),j=t.useRef(null),R=t.useRef(!1),N=t.useRef(void 0),{isDisabled:_}=h(s);t.useEffect((()=>{if(n)return g()?(document.addEventListener("touchmove",P),document.addEventListener("touchend",D)):(document.addEventListener("mousemove",P),document.addEventListener("mouseup",D)),B}),[n]);const D=()=>{B(),N.current=void 0,a(!1),i||(M(!0),R.current?(F(G()),$()):F(0))},k=e=>{n||i||_||(N.current=Ya(e),M(!1),a(!0))},P=e=>{var t,n;if(Ka(j)){const a=Math.min(Math.max(0,(null!==(t=Ya(e))&&void 0!==t?t:0)-(null!==(n=N.current)&&void 0!==n?n:0)),G());F(a),a/G()*100>=75?R.current=!0:R.current=!1}},$=()=>{var e,t;o(!0),d(O),d(w),null===(t=null===(e=Ka(A).parentElement)||void 0===e?void 0:e.parentElement)||void 0===t||t.focus()},G=()=>Ka(A).getBoundingClientRect().width-Ka(j).getBoundingClientRect().width,F=e=>{var t;Ka(j).style.transform=`translateX(${e}px)`,Ka(T).style.transform=`translateX(${e+(null===(t=Ka(j))||void 0===t?void 0:t.getBoundingClientRect().width)/2}px)`},M=e=>{e?(Ka(j).style.transition="transform .2s",Ka(T).style.transition="transform .2s"):(Ka(j).style.transition="",Ka(T).style.transition="")},B=()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",D),document.removeEventListener("touchmove",P),document.removeEventListener("touchend",D)};return t.createElement(ba,{styles:C},(({classnames:n})=>{var a,o,r,s,c,d;return t.createElement("div",{className:`${v}`,"data-testid":e.testId,style:l,"data-e2e":"SlideStateTrigger"},t.createElement("div",{className:`${b} ${null!==(a=null==n?void 0:n.own)&&void 0!==a?a:""}`,ref:A,"aria-hidden":!0,"data-testid":e.testId&&`${e.testId}-track`},(null==f?void 0:f.value)?t.createElement("div",{className:`${S} ${null!==(o=null==n?void 0:n.label)&&void 0!==o?o:""}`,"data-testid":e.testId&&`${e.testId}-label`},f.value):null,t.createElement("div",{className:`${E} ${null!==(r=null==n?void 0:n.fill)&&void 0!==r?r:""}`,ref:T,"data-testid":e.testId&&`${e.testId}-fill`}),t.createElement("div",{className:`${I} ${null!==(s=null==n?void 0:n.thumb)&&void 0!==s?s:""}`,ref:j,"data-testid":e.testId&&`${e.testId}-thumb`,"data-e2e":"SlideStateTrigger-thumb",onMouseDown:k,onTouchStart:k},null!==(c=null==m?void 0:m.icon)&&void 0!==c?c:"ArrowForward")),t.createElement("button",{className:x,"aria-label":null!=y?y:void 0,onClick:$,disabled:i||_,"data-testid":e.testId&&`${e.testId}-button`},null!==(d=null==f?void 0:f.value)&&void 0!==d?d:"Unlock Offers"))}))}function Ka(e){if(!e.current)throw new Error("Unexpected missing reference to required SlideStateTrigger Element");return e.current}function Ya(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientX:e.clientX}function Za(e){const n=ft(),a=Ln();return t.createElement(ba,{styles:e.schema.styles},(({classnames:i})=>{var o;return t.createElement("div",{className:i?i.own:void 0,"data-testid":e.testId,style:Object.assign({display:"flex",flexDirection:"row",flexWrap:"wrap"},a),"aria-label":null!==(o=e.schema.a11yLabel)&&void 0!==o?o:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,G(a,e.testId))))))}))}function Qa(e){const n=En(),a=Ln(),i=lt(),o=e.schema.customStateKey,r=dt(0,(e=>e.customStates[o])),{tabIndex:s,styles:l,isDisabled:c}=h(n),d=()=>{i({type:W,payload:{key:o,value:r?0:1}})};return t.createElement(ba,{styles:e.schema.styles},(({classnames:n})=>{var i;return t.createElement("button",{className:null==n?void 0:n.own,onClick:d,"data-testid":e.testId,"data-e2e":"ToggleButtonStateTrigger",disabled:c,"aria-disabled":c,"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0,tabIndex:s,style:Object.assign(Object.assign({cursor:"pointer"},l),a)},t.createElement(pt,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function Xa(e){const n=ft(),a=Ln();return t.createElement(ba,{styles:e.schema.styles},(({classnames:i})=>{var o;return t.createElement("div",{className:i?i.own:void 0,"data-testid":e.testId,style:Object.assign({display:"flex",flexDirection:"row",overflowX:"auto"},a),"aria-label":null!==(o=e.schema.a11yLabel)&&void 0!==o?o:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,G(a,e.testId))))))}))}function ei(e){const n=ft(),a=Ln();return t.createElement(ba,{styles:e.schema.styles},(({classnames:i})=>{var o;return t.createElement("div",{className:i?i.own:void 0,"data-testid":e.testId,style:Object.assign({display:"flex",flexDirection:"column",overflowY:"auto"},a),"aria-label":null!==(o=e.schema.a11yLabel)&&void 0!==o?o:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,G(a,e.testId))))))}))}const ti=t.createContext({extensions:{ctx:new Map,cache:[]}}),ni=()=>t.useContext(ti).extensions;function ai({extensions:e,extendStore:n,children:a}){const i=ni(),o=new Map([...i.ctx,...e.ctx]),r=i.cache.concat(e.cache);return t.createElement(ti.Provider,{value:{extensions:{ctx:o,cache:r},extendStore:n}},a)}function ii(e,t){const n=function(e){try{const t=JSON.parse(e);if(null!=t&&"object"==typeof t&&"type"in t&&"Extension"===t.type&&"name"in t&&"string"==typeof t.name&&t.name.trim().length>0&&"body"in t&&"object"==typeof t.body)return{type:"Extension",name:t.name,body:t.body}}catch(e){}return null}(t),a=n?e.ctx.get(n.name):null;return n&&a?[n,a]:null}function oi({data:e}){const n=ii(ni(),e);var a;if((e=>{const{extendStore:n,extensions:a}=t.useContext(ti);t.useEffect((()=>{e&&n&&!a.cache.includes(e.name)&&(n(e),a.cache.push(e.name))}),[e,a.cache,n])})((a=null==n?void 0:n[1])?{sagas:a.sagas,reducer:a.reducer,name:a.name,interceptors:a.interceptors}:void 0),n){const[e,t]=n;return t.componentFactory(e.body)}return null}function ri(e,n){if(v("Extension",e))return t.createElement(oi,{data:e.node.data})}function si(e){const n=Cn(),a=bt(),i=Mt(),o=ft(),r=lt(),s=a.catalogItems||[],l=e=>i({data:e},"catalogItem"),c=Ln();return t.useEffect((()=>{for(const e of s)r({type:q,payload:{name:"SignalImpression",parentGuid:e.instanceGuid}})}),[s,r]),s.length>0?t.createElement(ba,{styles:e.schema.styles},(({classnames:a})=>t.createElement("div",{"data-testid":e.testId,"data-e2e":"CatalogStackedCollection",className:null==a?void 0:a.own,style:Object.assign({display:"flex",flexDirection:"column"},c)},t.Children.toArray(s.map(((a,i)=>t.createElement(Rn,{context:a},t.createElement(wn,{value:n(a)},t.createElement(Ft,{value:l(a)},o(e.schema.template,void 0,G(i,e.testId))))))))))):null}const li={BasicText:(e,t)=>Ra(e,t,!0),StaticLink:(e,t)=>Ua(e,t,!0)};function ci(e){const n=ft(),a=Ln();return t.createElement(yt,{value:n,overrides:li},t.createElement(pt,null,(n=>t.createElement(ba,{styles:e.schema.styles},(({classnames:i})=>{var o;return t.createElement("div",{className:null==i?void 0:i.own,"data-testid":e.testId,"aria-label":null!==(o=e.schema.a11yLabel)&&void 0!==o?o:void 0,style:a},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,G(a,e.testId))))))})))))}function di(e){const n=lt(),a=e.schema.delay?e.schema.delay:1,i=e.schema.customStateKey,o=dt(0,(e=>e.customStates[i]));return function({delay:e,callback:n}){const a=t.useRef(null);t.useEffect((()=>{a.current=setTimeout(n,e)}),[])}({delay:a,callback:()=>{n({type:W,payload:{key:i,value:o?0:1}})}}),null}function ui(e){return()=>{throw new A("FAILED_CREATING_UNHANDLED_NODE",`The default mapper does not handle the ${e} node. Make sure when you use the NodeMapperProvider, you pass an override for ${e} node.`)}}const pi={Column:function(e,n){if("Column"===e.type)return t.createElement(Ea,{schema:e.node,testId:n})},Row:function(e,n){if("Row"===e.type)return t.createElement(Ia,{schema:e.node,testId:n})},StaticImage:function(e,n){if("StaticImage"===e.type)return t.createElement(Da,{schema:e.node,testId:n})},DataImage:function(e,n){if("DataImage"===e.type)return t.createElement(ka,{schema:e.node,testId:n})},CreativeResponse:function(e,n){if("CreativeResponse"===e.type)return t.createElement(_a,{schema:e.node,testId:n})},OneByOneDistribution:ui("OneByOneDistribution"),StackedDistribution:ui("StackedDistribution"),CarouselDistribution:ui("CarouselDistribution"),GroupedDistribution:ui("GroupedDistribution"),ProgressIndicator:ui("ProgressIndicator"),ProgressControl:ui("ProgressControl"),When:function(e,n){if("When"===e.type)return t.createElement(va,{schema:e.node,testId:n})},Overlay:ui("Overlay"),CloseButton:ui("CloseButton"),RichText:function(e,n){if("RichText"===e.type)return t.createElement(Ta,{schema:e.node,testId:n})},BasicText:Ra,StaticLink:Ua,DataIcon:function(e,n){if("DataIcon"===e.type)return t.createElement(za,{schema:e.node,testId:n})},StaticIcon:function(e,n){if("StaticIcon"===e.type)return t.createElement(La,{schema:e.node,testId:n})},ZStack:function(e,n){if("ZStack"===e.type)return t.createElement(Ha,{schema:e.node,testId:n})},FlowRow:function(e,n){if("FlowRow"===e.type)return t.createElement(Za,{schema:e.node,testId:n})},SlideStateTrigger:function(e,n){if("SlideStateTrigger"===e.type)return t.createElement(Ja,{schema:e.node,testId:n})},ToggleButtonStateTrigger:function(e,n){if("ToggleButtonStateTrigger"===e.type)return t.createElement(Qa,{schema:e.node,testId:n})},TimerStateTrigger:function(e,n){if("TimerStateTrigger"===e.type)return t.createElement(di,{schema:e.node})},CatalogStackedCollection:function(e,n){if("CatalogStackedCollection"===e.type)return t.createElement(si,{schema:e.node,testId:n})},CatalogResponseButton:ui("CatalogResponseButton"),ScrollableRow:function(e,n){if("ScrollableRow"===e.type)return t.createElement(Xa,{schema:e.node,testId:n})},ScrollableColumn:function(e,n){if("ScrollableColumn"===e.type)return t.createElement(ei,{schema:e.node,testId:n})},EscapeHatch:ri,BottomSheet:ui("BottomSheet"),CatalogQuantityOption:ui("CatalogQuantityOption"),CatalogRadioGroup:ui("CatalogRadioGroup"),CatalogQuantityCounter:ui("CatalogQuantityCounter"),InlineContainer:function(e,n){if("InlineContainer"===e.type)return t.createElement(ci,{schema:e.node,testId:n})}};function fi(e){return function(n,a,i){const o=a&&a[n.type],r=null!=o?o:pi[n.type];return t.createElement(Ga,{schema:n,reporter:e},r&&r(n,i)||function(e){throw new A("FAILED_CREATING_LAYOUT_NODE",`Failed to create layout node ${JSON.stringify(e)}`)}(n))}}const yi={transformLinksToAnchorText:function(e={}){return{data:i.mapObjIndexed((e=>xt(e)?`<a target="_blank" href="${e.url}">${e.title}</a>`:""),e)}}};function mi(e){const{settings:n,dispatch:a,children:i}=e,o=Pt(n.offerData.creative.copy||{})(yi.transformLinksToAnchorText(n.offerData.creative.links),"creativeLink"),r=fi(n.logger),[s,l]=t.useState("ENABLED");return t.useEffect((()=>n.gateway.onInteractivityChange(l)),[n]),ne(n.rootElement,a),t.createElement(Vt.Provider,{value:"VARIANT"},t.createElement(mt.Provider,{value:n.rootElement},t.createElement(_n.Provider,{value:n.pluginId},t.createElement(mn,{context:n.gateway},t.createElement(vn,{context:n.layoutSchema},t.createElement(gt,{context:n.offerData},t.createElement(wn,{value:In(n.offerData.creative)},t.createElement(bn.Provider,{value:s},t.createElement(yt,{value:r},t.createElement(qt.Provider,{value:n.offerPositionIndex},t.createElement(st.Provider,{value:a},t.createElement(Ft,{value:o},t.createElement(hi,null,i)))))))))))))}function hi(e){var n;const{children:a}=e,o=Dn(),r=function(){const[e,n]=t.useState(null),a=t.useContext(yn).get();return t.useEffect((()=>a.onGlobalStateChange((t=>{i.equals(t,e)||n(t)}))),[a]),e}(),s=t.useContext(mt)||void 0,l=Ht(),c=t.useCallback((e=>ot(e,o,l,s)),[s]);return r?t.createElement(Ut,{value:c(Object.values(null!==(n=null==r?void 0:r.breakpoint.breakpoints)&&void 0!==n?n:{}))},t.createElement(ct.Provider,{value:r},a)):null}function vi(e){return t.createElement("style",{"data-testid":e.testId},"\n* {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n}\nbody {\n margin: 0;\n font-family: sans-serif;\n}\np {\n margin: 0;\n}\nimg {\n max-width: 100%;\n}\n")}function gi(e,t,n,a,i,o){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){o.current.isRunning=!0,i&&"in"===t&&function(e,t){e.style.height=`${t.clientHeight}px`}(i,e);const r=e.animate(n,{duration:a,iterations:1});return r.onfinish=()=>{"in"===t?da(e):ua(e),o.current.isRunning=!1},r.oncancel=()=>{"in"===t?da(e):ua(e),o.current.isRunning=!1},()=>{r.finish()}}return"in"===t?da(e):ua(e),()=>{}}const bi={FadeInOut:{in:[{opacity:0,display:"none"},{opacity:0,display:"none",offset:.5},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],out:[{opacity:1},{opacity:0,offset:.75},{opacity:0}]}};function Ei({visible:e,effect:n,children:a,parentElement:i,containerClassName:o}){const[r,s]=t.useState(e),l=t.useRef(null),c=t.useRef({isRunning:!1}),d=pa(n);return t.useEffect((()=>{const t=new ResizeObserver((function(t){i&&e&&!c.current.isRunning&&t.forEach((e=>{e.contentBoxSize?function(e,t){var n;Array.isArray(e.contentBoxSize)&&e.contentBoxSize[0]?t.style.height=e.contentBoxSize[0].blockSize+"px":"object"==typeof(n=e.contentBoxSize)&&null!=n&&"blockSize"in n&&"number"==typeof n.blockSize&&"inlineSize"in n&&"number"==typeof n.inlineSize?t.style.height=e.contentBoxSize.blockSize+"px":t.style.height="auto"}(e,i):e.contentRect&&function(e,t){t.style.height=`${e.contentRect.height}px`}(e,i)}))}));return e&&l.current&&(da(l.current),t.observe(l.current)),()=>{t.disconnect()}}),[e,i]),t.useEffect((()=>e&&!r&&l.current&&i?(s(!0),gi(l.current,"in",bi[n.type].in,d,i,c)):!e&&r&&l.current&&i?(s(!1),gi(l.current,"out",bi[n.type].out,d/2,i,c)):()=>{}),[e,i,d]),t.createElement("div",{ref:l,style:{display:"none"},className:o},a)}function Ii(e){const n=ft(),a=Ln();return t.createElement(ba,{styles:e.schema.styles},(({classnames:i})=>{var o;return t.createElement("div",{className:null==i?void 0:i.own,"data-testid":e.testId,style:Object.assign({display:"flex",flexDirection:"column"},a),"aria-label":null!==(o=e.schema.a11yLabel)&&void 0!==o?o:void 0},n(e.schema.template))}))}const Si="ACTIVE/ADD",xi="ACTIVE/DELETE",Oi="BREAKPOINT/UPDATE_ACTIVE",wi="BREAKPOINT/INITIALISE",Ci="BREAKPOINT/SET_BREAKPOINTS",Ai="FONTS/SET",Ti="LAYOUT/UPDATE",ji="CONFIG/HANDLE",Ri="PLUGIN/CLOSE_PLUGIN",Ni="SETTINGS/SET",_i="CACHE/ADD_SERIALIZED_VALUE",Di="CACHE/UPDATE_SERIALIZED_VALUE",ki="CACHE/CLEAR_SERIALIZED_VALUE",Pi="SIGNAL/QUEUE",Li="SIGNAL/PROCESSED",$i="SIGNAL/PROCESS",Gi="OVERLAY/DISMISS_OVERLAY",Fi="ERROR/REPORT",Mi="LOG",Bi="CUSTOM_STATES/SET",Ui={LAYOUT_UPDATE:Ti,UPDATE_ACTIVE_BREAKPOINT:Oi,INITIALISE_BREAKPOINT:wi,ACTIVE_ADD:Si,ACTIVE_DELETE:xi,SET_FONTS:Ai,QUEUE_SIGNAL:Pi,SIGNAL_PROCESSED:Li,CACHE_SERIALIZED_VALUE:_i,UPDATE_CACHED_SERIALIZED_VALUE:Di,CLEAR_SERIALIZED_VALUE_FROM_CACHE:ki,SET_SETTINGS:Ni,SET_CUSTOM_STATE:Bi},Vi={HANDLE_CONFIG:ji,SET_BREAKPOINTS:Ci,CLOSE_PLUGIN:Ri,RAISE_METRIC:F,PREPARE_SIGNAL:K,DISMISS_OVERLAY:Gi,REPORT_ERROR:Fi,LOG:Mi,OPEN_LINK:Y},zi="plugin-overlay",qi="plugin";function Hi(n){var i;const o=n.schema.styles,r=a.useDispatch(),s={type:(null===(i=n.action)||void 0===i?void 0:i.type)||Gi,payload:{id:zi,dismissalMethod:n.schema.dismissalMethod}},l=()=>{r(s)},c=En(),d=Ln(),{tabIndex:u,styles:p,isDisabled:f}=h(c);return e.jsx(ba,{styles:o,children:({classnames:a})=>{var i;return e.jsx("button",{title:"Close",className:null==a?void 0:a.own,onClick:l,"data-testid":n.testId,"data-e2e":"CloseButton",disabled:f,tabIndex:u,"aria-disabled":f,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:void 0,style:Object.assign(Object.assign({cursor:"pointer"},p),d),children:e.jsx(pt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}const Wi={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var Ji;function Ki({isOpen:n,schema:o,testId:r,children:s}){const l=ae(),c=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),d=a.useSelector((e=>e.active.has(qi))),u=a.useDispatch(),p=()=>{u({type:Vi.DISMISS_OVERLAY,payload:{id:zi,dismissalMethod:"rokt_backdrop"}})};t.useEffect((()=>{c&&u({type:q,payload:{name:"SignalActivation",parentGuid:c}})}),[c]),t.useEffect((()=>{d&&requestAnimationFrame((()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}))}),[d]);const f=En(),{tabIndex:y,isDisabled:m,styles:v}=h(f),g=Ln(),b=o.styles?i.mergeRight(Wi,o.styles):Wi;if(!n)return null;const E=e.jsx(pt,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(ba,{styles:b,children:({classnames:t})=>{var n;return e.jsxs("div",{className:null==t?void 0:t.wrapper,style:Object.assign(Object.assign({position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9999",display:"flex",overflow:"auto"},v),g),"aria-label":null!==(n=o.a11yLabel)&&void 0!==n?n:void 0,"aria-hidden":m,role:"dialog","aria-modal":!0,tabIndex:y,"data-testid":r,"data-e2e":"Overlay-Wrapper",children:[e.jsx("div",{style:{position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},onClick:o.allowBackdropToClose?p:void 0,"data-testid":r&&`${r}-backdrop`,"data-e2e":"Overlay-Backdrop"}),s(E,l)]})}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(Ji||(Ji={}));const Yi={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const Zi=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(Yi,t.styles):Yi;return e.jsx(ba,{styles:r,children:({classnames:i})=>{var r;return e.jsx("div",{className:null==i?void 0:i.own,style:{position:"relative",zIndex:"3",outline:"none"},ref:o,tabIndex:-1,"data-e2e":"Overlay-Container","aria-label":null!==(r=t.a11yLabel)&&void 0!==r?r:void 0,role:"dialog","aria-modal":!0,"data-testid":n&&`${n}-container`,children:a})}})}));const Qi=a.connect((function(e){return{isOpen:e.active.has(zi)}}))((function(t){return e.jsx(Ki,Object.assign({},t,{children:(n,a)=>e.jsx(Zi,Object.assign({},t,{ref:a,children:n}))}))}));const Xi=a.connect((function(e){return{isOpen:e.active.has(zi)}})),eo={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const to=t.forwardRef((function({schema:n,testId:a,children:o},r){const s=t.useRef(null),l=n.styles?i.mergeRight(eo,n.styles):eo;return t.useEffect((()=>{if(s.current)return function(e){const t=requestAnimationFrame((()=>{e&&e.style.setProperty("max-height","100%")}));return()=>{cancelAnimationFrame(t)}}(s.current)}),[]),e.jsx(ba,{styles:l,children:({classnames:t})=>e.jsx("div",{style:{width:"100%",maxHeight:"0%",transition:"max-height 0.8s",transitionTimingFunction:"cubic-bezier(0.05, 0.7, 0.1, 1.0)",alignSelf:"flex-end"},ref:s,children:e.jsx("div",{className:null==t?void 0:t.own,style:{position:"relative",zIndex:"3",outline:"none",borderBottomLeftRadius:"0",borderBottomRightRadius:"0"},ref:r,tabIndex:-1,"data-testid":a&&`${a}-container`,"data-e2e":"BottomSheet-Container",children:o})})})}));const no=Xi((function(t){return e.jsx(Ki,Object.assign({},t,{children:(n,a)=>e.jsx(to,Object.assign({},t,{ref:a,children:n}))}))}));const ao="DisplayPreset.FULLSCREEN",io="DisplayPreset.EMBEDDED",oo="DisplayPreset.ATTACHED",ro="ERROR",so="INFO",lo="WARNING";var co;!function(e){e.PAYPAL="Paypal"}(co||(co={}));const uo="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DCUI_SCHEMA_VERSION:"",ROKT_DOMAIN:""};function*po(e,t,n){(function(e){return"object"==typeof e&&null!==e&&"type"in e&&Object.values(X).includes(e.type)})(n)&&!e.includes(n.type)&&(yield r.call(t.globalDispatch.bind(t),n))}function fo(e,t){return!e||t<1?null:{cartItemId:e.cartItemId,catalogItemId:e.catalogItemId,name:e.title,description:e.description,quantity:t,currency:e.currency||"$",unitPrice:e.price||0,totalPrice:(e.price||0)*t,linkedProductId:e.linkedProductId,quantityMustBeSynchronized:e.quantityMustBeSynchronized,providerData:e.providerData||""}}function yo(e){switch(typeof e){case"undefined":return"";case"object":return null===e?"":JSON.stringify(e);case"string":return e;default:return String(e)}}function mo(e){return i.map(yo,e)}function*ho(e,t){const n=yield r.actionChannel(e,l.buffers.expanding(10));for(;n;){const e=yield r.take(n);yield r.call(t,e)}}function*vo(e,t){const n=yield r.take(e);yield r.call(t,n)}function go(e){return!!V(e)&&(e.rclid&&"RealTime"===e.conversionType&&e.accountID&&e.referralCreativeID)}function*bo(e){for(;;){const t=yield r.take(e);yield r.put(t)}}function*Eo(e,t){const n=i.over(i.lensProp("moduleName"),i.defaultTo("orchestrator"),t.payload.additionalInformation||{}),a=Object.assign(Object.assign({},t.payload),{additionalInformation:n?mo(n):{}});try{yield r.call(e,a)}catch(e){}t.payload.level===ro&&(yield r.put({type:J,payload:{name:"PLACEMENT_FAILURE"}}),yield r.put({type:Vi.CLOSE_PLUGIN}))}const Io="INVALID_RESPONSE_OBJECT",So="FAILED_TO_OPEN_LINK",xo="NO_PARENT_GUID",Oo="FAILED_TO_NOTIFY_INTERACTIVE",wo="FAILED_TO_ESTABLISH_PARTNER_VALIDATION";var Co=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(n[a[i]]=e[a[i]])}return n};function Ao(e,t){return n=>n&&n.replace(e,t)}const To=Ao(/['""();{}@:[\]!/=]/g,""),jo=/^(normal|italic|oblique( \d+deg)*)$/i,Ro=(e="")=>jo.test(e)?e:void 0,No=Ao(/[;{}@[\]!]/g,"");function _o(e){const{fontFamily:t,sources:n}=e,a=Co(e,["fontFamily","sources"]),i=document.fonts,o=new FontFace(t,n.join(", "),a);return i.add(o),o.load().catch((e=>(i.delete(o),Promise.reject(e))))}function Do(e=[]){const t=Array.from(document.fonts.values());return Promise.all(e.map((e=>{const n=function(e){return{fontFamily:To(e.fontFamily)||"",style:Ro(e.style),weight:To(e.weight),sources:e.sources.map((e=>No(e)||"")),display:e.display}}(e);return t.find((e=>e.family===n.fontFamily&&e.weight===n.weight&&(e.style===n.style||!n.style)))?Promise.resolve():_o(n).then((()=>{})).catch((e=>`${e}`.includes("SyntaxError")?(n.fontFamily='"'+n.fontFamily+'"',_o(n).then((()=>{}))):Promise.reject(e))).catch((e=>Promise.resolve(`Error loading font: [Font (${JSON.stringify(n)})] [Message - ${e}]`)))}))).then((e=>{const t=e.filter(Boolean);return t.length>0?Promise.reject(t):Promise.resolve()}))}function ko(e){const n=a.useDispatch(),i=a.useSelector((e=>{const t=e.fonts.map((e=>({fontFamily:e.fontFamily,style:e.fontStyle||"normal",weight:e.fontWeight,sources:e.src}))),n=t.find((e=>"rokt-icons"===e.fontFamily));if(n)n.display="block";else{const e=null!==(a=uo.ROKT_DOMAIN)&&void 0!==a?a:"";t.push(function(e=""){return{fontFamily:"rokt-icons",weight:"400",sources:[`url("${e}/icons/rokt-icons.woff") format("woff")`],display:"block"}}(e))}var a;return JSON.stringify(t)}));return t.useEffect((()=>{Do(JSON.parse(i)).catch((e=>{const t={type:Fi,payload:{level:so,code:"FAILED_TO_LOAD_FONT",message:`Error loading fonts:\n\t${e.join("\n\t")}`}};n(t)}))}),[i]),t.useEffect((()=>{const e=()=>{var e,t;null===(t=null===(e=window.frameElement)||void 0===e?void 0:e.iFrameResizer)||void 0===t||t.resize()};return document.fonts.addEventListener("loadingdone",e),()=>{document.fonts.removeEventListener("loadingdone",e)}}),[]),null}function Po(e){return null!=e?e:null}function Lo(){return new Set([zi])}function $o(e){return e.breakpoint.breakpoints[e.breakpoint.activeBreakpoint]||0}const Go=i.sortBy(i.prop(1)),Fo=i.map(i.prop(0)),Mo=e=>i.compose(i.findIndex(i.equals(e)),Fo,Go,i.toPairs,i.pathOr({},["breakpoint","breakpoints"]));function Bo(e){return Mo(e.breakpoint.activeBreakpoint)(e)}function Uo(e,t){return e.customStates[`module${t}`]||{}}function Vo(e){return`${e.name}:${e.parentGuid}`}function zo(e,t){return!e.processed.includes(Vo(t))||(n=t.name,void 0!==O.find((e=>e===n)));var n}function qo(){return new Map}const Ho={layout:function(e=Po(),t){return t.type===Ti?t.payload:e},breakpoint:function(e={breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},t){var n;switch(t.type){case Oi:return Object.prototype.hasOwnProperty.call(e.breakpoints,t.payload.activeBreakpoint)?Object.assign(Object.assign({},e),{activeBreakpoint:t.payload.activeBreakpoint}):e;case wi:return{activeBreakpoint:null!==(n=t.payload.activeBreakpoint)&&void 0!==n?n:"default",breakpoints:Object.assign({default:0},t.payload.breakpoints),initialised:!0};default:return e}},active:function(e=Lo(),t){var n,a;switch(t.type){case Si:{const a=new Set(e);return a.add(null===(n=t.payload)||void 0===n?void 0:n.id),a}case xi:{const n=new Set(e);return n.delete(null===(a=t.payload)||void 0===a?void 0:a.id),n}default:return e}},fonts:function(e=[],t){return t.type===Ai?t.payload:e},signal:function(e={queue:[],processed:[]},t){switch(t.type){case Pi:return i.evolve({queue:n=>zo(e,t.payload.signal)?i.uniqBy(i.pipe(i.prop("signal"),Vo),n.concat(t.payload)):n},e);case Li:return i.evolve({queue:e=>i.reject(i.pipe(i.prop("signal"),i.whereEq({name:t.payload.name,parentGuid:t.payload.parentGuid})))(e),processed:i.append(Vo(t.payload))},e);default:return e}},serializableCache:function(e=qo(),t){switch(t.type){case _i:case Di:if(t.payload.key&&t.payload.value){return new Map([...e]).set(t.payload.key,t.payload.value)}return e;case ki:{const n=new Map([...e]);return t.payload&&n.delete(t.payload),n}default:return e}},settings:function(e={closeOnComplete:!0},t){return t.type===Ni?i.mergeDeepWith(((e,t)=>i.isNil(t)?e:t),e,t.payload):e},customStates:function(e={root:{}},t){if(t.type===Bi){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:"root";return i.assocPath([n,t.payload.key],Number(t.payload.value),e)}return e}return e}};function*Wo(e,t){var n,a;try{const i=(null===(n=e.activeBreakpointEventChannel)||void 0===n?void 0:n.call(e,t.payload))||(a=t.payload,l.eventChannel((e=>{const t=Object.entries(a).reduce(((e,t)=>{const a=window.matchMedia(`(min-width: ${t[1]}px)`);return"addEventListener"in a&&"function"==typeof a.addEventListener?(a.addEventListener("change",n),e[t[0]]=a):"addListener"in a&&"function"==typeof a.addListener&&(a.addListener(n),e[t[0]]=a),e}),{});return setTimeout((()=>n()),0),()=>{Object.entries(t).forEach((e=>{const t=e[1];"removeEventListener"in t&&"function"==typeof t.removeEventListener?t.removeEventListener("change",n):"removeListener"in t&&"function"==typeof t.removeListener&&t.removeListener(n)}))};function n(){try{e(function(e,t){return Object.entries(e).reduce(((e,n)=>n[1].matches&&(t[n[0]]||0)>(t[e]||0)?n[0]:e),"default")}(t,a))}catch(t){e(t)}}})));try{let e=yield r.take(i);for(yield r.put({type:Ui.INITIALISE_BREAKPOINT,payload:{activeBreakpoint:e,breakpoints:t.payload}});;)e=yield r.take(i),yield r.put({type:Ui.UPDATE_ACTIVE_BREAKPOINT,payload:{activeBreakpoint:e}})}catch(e){const n=e;yield r.put({type:Fi,payload:{level:lo,code:"FAILED_TO_DETERMINE_BREAKPOINT",message:null==n?void 0:n.message,additionalInformation:{stack:null==n?void 0:n.stack,breakpoints:t.payload}}})}finally{(yield r.cancelled())&&i.close()}}catch(e){const n=e;yield r.put({type:Fi,payload:{level:ro,code:"FAILED_TO_ESTABLISH_BREAKPOINT_CHANNEL",message:null==n?void 0:n.message,additionalInformation:{stack:null==n?void 0:n.stack,breakpoints:t.payload}}})}}function Jo(e,t,n){return l.eventChannel((a=>{const i=e.subscribe((e=>{const t=n(e);t&&a({type:ji,payload:t})}),(e=>{a(e)})),o=t.fonts.subscribe((e=>{a({type:Ai,payload:e})}),(e=>{a(e)}));return()=>{i.unsubscribe(),o.unsubscribe()}}),l.buffers.sliding(2))}var Ko=Object.freeze({__proto__:null,CartEvent:{UPDATE_CART_ITEM_MESSAGE:"UPDATE_CART_ITEM_MESSAGE",UPSERT_ALERT:"UPSERT_ALERT",DELETE_ALERT:"DELETE_ALERT",UPSERT_DELIVERY_DETAILS:"UPSERT_DELIVERY_DETAILS"}}),Yo=Object.freeze({__proto__:null,PartnerMessage:{UpdateCartItem:"V2_UPDATE_CART_ITEM"},PlacementMessage:{CartItemUpdated:"V2_CART_ITEM_UPDATED"}}),Zo=Object.freeze({__proto__:null,V1:Ko,V2:Yo}),Qo=Object.freeze({__proto__:null,PartnerMessage:{CartItemInstantPurchaseResponse:"CART_ITEM_INSTANT_PURCHASE_RESPONSE"},PlacementMessage:{CartItemInstantPurchase:"CART_ITEM_INSTANT_PURCHASE"}}),Xo=Object.freeze({__proto__:null,PartnerValidationEvent:{SET_PARTNER_VALIDATION_STATUS:"SET_PARTNER_VALIDATION_STATUS",OPT_IN_TO_PARTNER_VALIDATION:"OPT_IN_TO_PARTNER_VALIDATION",SHOW_PARTNER_VALIDATION_STATUS:"SHOW_PARTNER_VALIDATION_STATUS"}});const er="LINK_NAVIGATION_REQUEST";var tr=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 nr={newTab:"_blank",self:"_top",roktWebViewSDK:"roktWebViewSDK",inApp:"inApp",overrideLinkNavigation:"overrideLinkNavigation"};function ar({url:e,urlBehavior:t,external:n},a=window){return tr(this,void 0,void 0,(function*(){if(!e)return null;if("overrideLinkNavigation"===t)return n.partner.send(er,{url:e}).then((()=>null));const i=nr[t];if(a.RoktWebViewSDK){const t=a.RoktWebViewSDK.open(e);return t?{ref:t}:null}if("_top"===i&&a.top)return a.top.location.href=e,null;const o=a.open(e,i);if(o)try{o.opener=null}catch(e){}return o?{ref:o}:null}))}var ir=Object.freeze({__proto__:null,openLink:ar});function or(e,t,n,a){const i=function(e){return"object"==typeof e&&null!=e&&"message"in e&&"string"==typeof e.message&&e.message.includes("timed out")}(e),o=i?{originErrorCode:n}:void 0;return{type:Fi,payload:{level:lo,code:i?"COMMUNICATION_FAILURE_WITH_WSDK":n,message:t,additionalInformation:Object.assign(Object.assign({},o),a)}}}var rr=Object.freeze({__proto__:null,makePluginWarningAction:or});function sr(e){return null!=e&&"object"==typeof e&&"ref"in e&&"object"==typeof e.ref&&!Array.isArray(e.ref)&&null!=e.ref}var lr=Object.freeze({__proto__:null,isWindow:sr}),cr=Object.assign(Object.assign(Object.assign({},ir),rr),lr);function*dr(e=10){(yield r.select((e=>e.signal.queue.length>0)))&&(yield c.delay(30),e>=1&&(yield*dr(e-1)))}function*ur(e){try{yield*dr(10),yield c.call(e.close)}catch(e){const t=cr.makePluginWarningAction(e,"Failed to close the plugin","FAILED_TO_CLOSE_PLUGIN");yield c.put(t)}}function*pr(e,{payload:t}){var n;if("string"==typeof(n=t.name)&&T.includes(n))switch(t.name){case"V2_CART_ITEM_UPDATED":case"CART_ITEM_INSTANT_PURCHASE":case"REALTIME_OFFER_FULFILLMENT_REFERRAL":yield e.send(t.name,t.body);break;case"OFFER_ENGAGEMENT":case"PLACEMENT_CLOSED":case"PLACEMENT_COMPLETED":case"PLACEMENT_FAILURE":case"PLACEMENT_INTERACTIVE":case"POSITIVE_ENGAGEMENT":yield e.send(t.name);break;default:return}}const fr=i.propOr("FAILED_TO_PARSE_CONFIG","code");function*yr(e,t){var n;const a=yield c.call(Jo,e.configService,e.themeService,t);for(;;)try{const e=yield c.take(a);yield c.put(e)}catch(e){const t=e;yield c.put({type:Fi,payload:{level:ro,code:fr(t),message:null!==(n=null==t?void 0:t.message)&&void 0!==n?n:"An error occured parsing or receiving Plugin config, fonts or configurables.",additionalInformation:{stack:null==t?void 0:t.stack}}})}}function*mr(e,t){yield c.all([c.spawn(yr,e,t),c.takeEvery(J,pr,e.partnerInteractionService)])}function hr(e){switch(e){case"ATTACHED":return oo;case"EMBEDDED":return io;default:return ao}}function*vr(e,t){const n={preset:hr(t)};yield c.call(e.setDisplaySettings,n),yield c.put({type:Ui.ACTIVE_ADD,payload:{id:qi}})}function*gr(e,t){var n;const a=null!==(n=t.payload.data)&&void 0!==n?n:{};try{yield r.call(e,{code:t.payload.code,level:so,message:t.payload.message||"Plugin Generic Log",additionalInformation:mo(a)})}catch(e){}}function*br(e){yield r.put({type:Ui.QUEUE_SIGNAL,payload:{signal:e.payload}}),yield r.put({type:$i})}function*Er(e){yield r.put({type:Ui.QUEUE_SIGNAL,payload:e.payload}),yield r.put({type:$i})}function*Ir(e,t){const n=yield r.select((e=>e.signal.queue.filter((t=>zo(e.signal,t.signal)))));if(Array.isArray(n)&&n.length)for(const e of n){const t="criteria"in e?e.criteria:void 0;switch(e.signal.name){case"SignalActivation":case"SignalLoadComplete":case"SignalImpression":yield*Sr(e.signal,a(t));break;case"SignalDismissal":yield*xr(e.signal,a(t));break;case"SignalInstantPurchaseDismissal":yield*Or(e.signal,a(t));break;case"SignalLoadStart":yield*wr(e.signal,a(t));break;case"SignalGatedResponse":case"SignalResponse":yield*Cr(e.signal,a(t,!0));break;case"SignalUserInteraction":yield*Ar(e.signal,a(t));break;case"SignalCartItemQuantitySelected":yield*Tr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseInitiated":yield*jr(e.signal,a(t));break;case"SignalCartItemInstantPurchase":yield*Rr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseFailure":yield*Nr(e.signal,a(t))}yield r.put({type:Ui.SIGNAL_PROCESSED,payload:e.signal})}function a(t,n=!1){return function(a,i,o){return t?r.call(e.prepareExternalSignal,t.key,a,i,o):n?r.call(e.issueSignalSync,a,i,o):r.call(e.issueSignal,a,i,o)}}}function*Sr(e,t){try{yield t(e.name,e.parentGuid)}catch(t){yield _r(e,t)}}function*xr(e,t){try{yield t(e.name,e.parentGuid,e.dismissalMethod?{objectData:{dismissalMethod:e.dismissalMethod}}:void 0)}catch(t){yield _r(e,t)}}function*Or(e,t){try{yield t(e.name,e.parentGuid,void 0)}catch(t){yield _r(e,t)}}function*wr(e,t){var n;const a={overrideTimestamp:null!==(n=e.overrideTimestamp)&&void 0!==n?n:new Date};try{yield t(e.name,e.parentGuid,a)}catch(t){yield _r(e,t)}}function*Cr(e,t){try{yield t(e.name,e.parentGuid,function(e){if("Url"===e.responseActionPayload.name)return{transformedTrafficURL:e.responseActionPayload.transformedTrafficURL}}(e))}catch(t){yield _r(e,t)}}function*Ar(e,t){const n=e.parentGuid?e.parentGuid:yield r.select((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid}));try{if(!n||"string"!=typeof n)throw new Error(`Cannot raise SignalUserInteraction, missing or invalid parent GUID: ${JSON.stringify(e)}`);yield t(e.name,n,{objectData:{action:e.action,context:e.context}})}catch(t){yield _r(e,t)}}function*Tr(e,t){const n={objectData:{preselected:e.objectData.preselected.toString(),quantity:e.objectData.quantity.toString()}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield _r(e,t)}}function*jr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString()}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield _r(e,t)}}function*Rr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString(),initiatedBy:e.objectData.initiatedBy}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield _r(e,t)}}function*Nr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString(),failureReason:e.objectData.failureReason,providerId:e.objectData.providerId}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield _r(e,t)}}function _r(e,t){const n=cr.makePluginWarningAction(t,(null==t?void 0:t.message)||"Failed to issue signal","FAILED_TO_ISSUE_SIGNAL",{signalName:null==e?void 0:e.name,parentGuid:null==e?void 0:e.parentGuid,stack:null==t?void 0:t.stack});return r.put(n)}function*Dr(e){yield r.put({type:Bi,payload:e.payload})}function*kr(e,t){if("Interactive"===t.payload.name)try{yield*function*(e){const t="METRIC";(yield r.select((e=>e.serializableCache.has(t))))||(yield r.call(e.notifyInteractive),yield r.put({type:_i,payload:{key:t,value:"Interactive"}}))}(e)}catch(e){const t=e;yield*function*(e){var t;yield r.put({type:Fi,payload:{level:so,code:Oo,message:null!==(t=null==e?void 0:e.message)&&void 0!==t?t:"Failed to notify interactive",additionalInformation:{stack:null==e?void 0:e.stack}}})}(t)}}function*Pr(e,t){const n=e.context.getOverrideLinkNavigation()?"overrideLinkNavigation":t.payload.urlBehaviour;try{"inApp"===n?yield r.call(e.createChildPlugin,{name:"url-modal",config:{url:t.payload.url,method:"GET"}}):yield r.call(ar,{url:t.payload.url,urlBehavior:n,external:e})}catch(e){yield r.put(or(e,"Failed to open link",So,{url:t.payload.url,urlBehaviour:n}))}}function*Lr(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:Ui.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Ri}),t?yield r.put({type:q,payload:{name:"SignalDismissal",parentGuid:t,dismissalMethod:e.payload.dismissalMethod}}):yield r.put({type:Fi,payload:{level:so,code:xo,message:"ParentGuid does not exist"}})}const $r=a.connect((function(e){return{isOpen:e.active.has(zi)}})),Gr="Minimized",Fr=()=>{const e=t.useRef(null),n=t.useRef(null),a=t.useRef(null),i=t.useRef(null),o=t.useRef(null),r=dt(0,(e=>e.customStates[Gr])),s=lt(),l=En(),c=t.useRef(0),d=t.useRef(!1),u=t.useRef(0),p=t.useRef([]),f=t.useRef(void 0),{isDisabled:y}=h(l),m=t.useCallback((()=>{k(),f.current=void 0,d.current=!1,N(!0);v()?S():R(0)}),[]),v=()=>{const e=j();return r?e<=-.2:e>=.2};t.useEffect((()=>{r?(O(),s(Br(!0))):(w(),s(Br(!1)))}),[r,s]),t.useEffect((()=>{requestAnimationFrame((()=>{D(!r,a),D(!!r,i),_()}))}),[]);const b=t.useCallback((e=>{if(n.current){e.preventDefault();const t=I(e);R(t)}}),[n]),E=t.useCallback((e=>{Date.now()-u.current<200||(u.current=Date.now(),r?x(!1):d.current||y||(d.current=!0,T(),f.current=Mr(e),N(!1),P()))}),[r,y]);t.useEffect((()=>{const e=n.current;return e&&(e.addEventListener("mousedown",E),e.addEventListener("touchstart",E)),()=>{null==e||e.removeEventListener("mousedown",E),null==e||e.removeEventListener("touchstart",E)}}),[n,E]);const I=e=>{var t,n;return(null!==(t=Mr(e))&&void 0!==t?t:0)-(null!==(n=f.current)&&void 0!==n?n:0)},S=()=>{x(!r)},x=e=>{const t=(e=>({type:W,payload:{key:Gr,value:e?1:0}}))(e);s(t)},O=()=>{var e,t,n,o;const r=null!==(t=null===(e=a.current)||void 0===e?void 0:e.clientHeight)&&void 0!==t?t:0,s=(null!==(o=null===(n=i.current)||void 0===n?void 0:n.clientHeight)&&void 0!==o?o:0)-r;N(!0),_(!0,!0),R(s),D(!1,a),D(!0,i),L()},w=()=>{N(!0),_(!0,!1),R(0),f.current=void 0,D(!0,a),D(!1,i),$()},C=t.useCallback((()=>{d.current&&(A(),requestAnimationFrame(C))}),[]),A=()=>{p.current.push({yPosition:c.current,timestamp:Date.now()}),p.current.length>20&&p.current.shift()},T=t.useCallback((()=>{p.current=[],C()}),[C]),j=()=>{const e=p.current;if(!e)return 0;const t=e[0],n=e[e.length-1];if(!t||!n)return 0;const a=n.timestamp-t.timestamp;return(n.yPosition-t.yPosition)/a},R=e=>{const t=Math.round(e);c.current=t,n.current&&(n.current.style.transform=`translateY(${t}px)`)},N=e=>{e?n.current&&(n.current.style.transition="transform .2s"):n.current&&(n.current.style.transition="")},_=(e,t=!1)=>{const n=t?i:a,o=t?a:i;o.current&&(o.current.style.transition="opacity .5s"),n.current&&(n.current.style.transition="opacity .2s")},D=(e,t)=>{const n=t.current;if(n){const t=e?0:1;n.style.opacity=`${t}`,n.style.pointerEvents=e?"none":"auto"}},k=t.useCallback((()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",m),document.removeEventListener("touchmove",b),document.removeEventListener("touchend",m)}),[b,m]),P=t.useCallback((()=>{g()?(document.addEventListener("touchmove",b,{passive:!1}),document.addEventListener("touchend",m)):(document.addEventListener("mousemove",b,{passive:!1}),document.addEventListener("mouseup",m))}),[b,m]),L=()=>{const t=e.current;t&&(o.current=setTimeout((()=>{var e;const n=((null===(e=a.current)||void 0===e?void 0:e.clientHeight)||0)+1;t.style.height=n+"px"}),200))},$=()=>{o.current&&clearTimeout(o.current),e.current&&(e.current.style.height="100000px")};return{wrapperRef:e,containerRef:n,minimizedChildRef:a,maximizedChildRef:i}};function Mr(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientY:e.clientY}const Br=e=>({type:q,payload:{action:e?"BottomSheetMinimized":"BottomSheetMaximized",name:"SignalUserInteraction",context:"BottomSheetMinimized"}}),Ur={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var Vr;function zr({schema:n,testId:o}){const r=ae(),s=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),l=a.useSelector((e=>e.active.has(qi))),c=t.useRef(null),d=a.useDispatch(),u=()=>{d({type:Vi.DISMISS_OVERLAY,payload:{id:zi,dismissalMethod:"rokt_backdrop"}})},p=dt(0,(e=>e.customStates[Gr]));t.useEffect((()=>{f(!!p)}),[p]);const f=e=>{const t=c.current;t&&(e?t.style.opacity="0":(t.style.display="flex",t.style.opacity="1"))};t.useEffect((()=>{s&&d({type:q,payload:{name:"SignalActivation",parentGuid:s}})}),[s]),t.useEffect((()=>{l&&requestAnimationFrame((()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.focus()}))}),[l]);const y=En(),{tabIndex:m,isDisabled:v,styles:g}=h(y),b=n.styles?i.mergeRight(Ur,n.styles):Ur;return e.jsx(ba,{styles:b,children:({classnames:t})=>{var a;return e.jsx("div",{className:null==t?void 0:t.wrapper,style:Object.assign({height:"100%",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9998",overflow:"hidden",display:"flex",opacity:"1",transition:"opacity 0.2s ease-in-out"},g),"aria-label":null!==(a=n.a11yLabel)&&void 0!==a?a:void 0,"aria-hidden":v,role:"dialog","aria-modal":!0,tabIndex:m,"data-testid":o,"data-e2e":"Overlay-Wrapper",ref:c,children:e.jsx("div",{style:{position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},onClick:n.allowBackdropToClose?u:void 0,"data-testid":o&&`${o}-backdrop`,"data-e2e":"Overlay-Backdrop"})})}})}function qr(){return e.jsx("div",{style:{width:"48px",height:"4px",backgroundColor:"#C6C6C8",borderRadius:"2px",margin:"0 auto -4px",position:"relative",top:"6px"}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(Vr||(Vr={}));const Hr={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};function Wr(t){const n=a.useSelector((e=>e.slots)),i=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0}));return e.jsx(Jr,Object.assign({},t,{slots:n,currentIndex:i}))}function Jr(t){const{wrapperRef:n,containerRef:a,minimizedChildRef:i,maximizedChildRef:o}=Fr();return t.isOpen?e.jsxs("div",{ref:n,style:{height:"100000px"},children:[e.jsx(zr,Object.assign({},t)),e.jsx(Yr,Object.assign({},t,{containerRef:a,minimizedChildRef:i,maximizedChildRef:o}))]}):null}const Kr=o.css`
|
|
57
|
+
`}}(r,l);if(!d)throw new Error("No custom state key provided for state trigger node.");const S={type:J,payload:{key:d,value:null!=u?u:1}},w={type:H,payload:{name:"SignalUserInteraction",action:"Swipe",context:"SlideStateTrigger"}},C=e.schema.styles?$(Wa,e.schema.styles):Wa,O=t.useRef(null),A=t.useRef(null),T=t.useRef(null),R=t.useRef(!1),j=t.useRef(void 0),{isDisabled:L}=m(s);t.useEffect((()=>{if(n)return g()?(document.addEventListener("touchmove",D),document.addEventListener("touchend",N)):(document.addEventListener("mousemove",D),document.addEventListener("mouseup",N)),M}),[n]);const N=()=>{M(),j.current=void 0,a(!1),i||(F(!0),R.current?(G(P()),k()):G(0))},_=e=>{n||i||L||(j.current=Ka(e),F(!1),a(!0))},D=e=>{var t,n;if(Ya(T)){const a=Math.min(Math.max(0,(null!==(t=Ka(e))&&void 0!==t?t:0)-(null!==(n=j.current)&&void 0!==n?n:0)),P());G(a),a/P()*100>=75?R.current=!0:R.current=!1}},k=()=>{var e,t;o(!0),c(S),c(w),null===(t=null===(e=Ya(O).parentElement)||void 0===e?void 0:e.parentElement)||void 0===t||t.focus()},P=()=>Ya(O).getBoundingClientRect().width-Ya(T).getBoundingClientRect().width,G=e=>{var t;Ya(T).style.transform=`translateX(${e}px)`,Ya(A).style.transform=`translateX(${e+(null===(t=Ya(T))||void 0===t?void 0:t.getBoundingClientRect().width)/2}px)`},F=e=>{e?(Ya(T).style.transition="transform .2s",Ya(A).style.transition="transform .2s"):(Ya(T).style.transition="",Ya(A).style.transition="")},M=()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",N),document.removeEventListener("touchmove",D),document.removeEventListener("touchend",N)};return t.createElement(ba,{styles:C},(({classnames:n})=>{var a,o,r,s,l,c;return t.createElement("div",{className:`${h}`,"data-testid":e.testId,"data-e2e":"SlideStateTrigger"},t.createElement("div",{className:`${v} ${null!==(a=null==n?void 0:n.own)&&void 0!==a?a:""}`,ref:O,"aria-hidden":!0,"data-testid":e.testId&&`${e.testId}-track`},(null==p?void 0:p.value)?t.createElement("div",{className:`${I} ${null!==(o=null==n?void 0:n.label)&&void 0!==o?o:""}`,"data-testid":e.testId&&`${e.testId}-label`},p.value):null,t.createElement("div",{className:`${b} ${null!==(r=null==n?void 0:n.fill)&&void 0!==r?r:""}`,ref:A,"data-testid":e.testId&&`${e.testId}-fill`}),t.createElement("div",{className:`${E} ${null!==(s=null==n?void 0:n.thumb)&&void 0!==s?s:""}`,ref:T,"data-testid":e.testId&&`${e.testId}-thumb`,"data-e2e":"SlideStateTrigger-thumb",onMouseDown:_,onTouchStart:_},null!==(l=null==y?void 0:y.icon)&&void 0!==l?l:"ArrowForward")),t.createElement("button",{className:x,"aria-label":null!=f?f:void 0,onClick:k,disabled:i||L,"data-testid":e.testId&&`${e.testId}-button`},null!==(c=null==p?void 0:p.value)&&void 0!==c?c:"Unlock Offers"))}))}function Ya(e){if(!e.current)throw new Error("Unexpected missing reference to required SlideStateTrigger Element");return e.current}function Ka(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientX:e.clientX}function Za(e){const n=ht();return t.createElement(ba,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"row",flexWrap:"wrap"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,F(a,e.testId))))))}))}function Qa(e){const n=xn(),a=dt(),i=e.schema.customStateKey,o=pt(0,(e=>e.customStates[i])),{tabIndex:r,styles:s,isDisabled:l}=m(n),c=()=>{a({type:J,payload:{key:i,value:o?0:1}})};return t.createElement(ba,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:c,"data-testid":e.testId,"data-e2e":"ToggleButtonStateTrigger",disabled:l,"aria-disabled":l,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:r,style:Object.assign({cursor:"pointer"},s)},t.createElement(yt,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function Xa(e){const n=ht();return t.createElement(ba,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"row",overflowX:"auto"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,F(a,e.testId))))))}))}function ei(e){const n=ht();return t.createElement(ba,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"column",overflowY:"auto"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,F(a,e.testId))))))}))}const ti=t.createContext({extensions:{ctx:new Map,cache:[]}}),ni=()=>t.useContext(ti).extensions;function ai({extensions:e,extendStore:n,children:a}){const i=ni(),o=new Map([...i.ctx,...e.ctx]),r=i.cache.concat(e.cache);return t.createElement(ti.Provider,{value:{extensions:{ctx:o,cache:r},extendStore:n}},a)}function ii(e,t){const n=function(e){try{const t=JSON.parse(e);if(null!=t&&"object"==typeof t&&"type"in t&&"Extension"===t.type&&"name"in t&&"string"==typeof t.name&&t.name.trim().length>0&&"body"in t&&"object"==typeof t.body)return{type:"Extension",name:t.name,body:t.body}}catch(e){}return null}(t),a=n?e.ctx.get(n.name):null;return n&&a?[n,a]:null}function oi({data:e}){const n=ii(ni(),e);var a;if((e=>{const{extendStore:n,extensions:a}=t.useContext(ti);t.useEffect((()=>{e&&n&&!a.cache.includes(e.name)&&(n(e),a.cache.push(e.name))}),[e,a.cache,n])})((a=null==n?void 0:n[1])?{sagas:a.sagas,reducer:a.reducer,name:a.name,interceptors:a.interceptors}:void 0),n){const[e,t]=n;return t.componentFactory(e.body)}return null}function ri(e,n){if(v("Extension",e))return t.createElement(oi,{data:e.node.data})}function si(e){const n=Tn(),a=It(),i=Ut(),o=ht(),r=dt(),s=t.useMemo((()=>a.catalogItems||[]),[a]),l=e=>i({data:e},"catalogItem");return t.useEffect((()=>{for(const e of s)r({type:H,payload:{name:"SignalImpression",parentGuid:e.instanceGuid}})}),[s,r]),s.length>0?t.createElement(ba,{styles:e.schema.styles},(({classnames:a})=>t.createElement("div",{"data-testid":e.testId,"data-e2e":"CatalogStackedCollection",className:null==a?void 0:a.own,style:{display:"flex",flexDirection:"column"}},t.Children.toArray(s.map(((a,i)=>t.createElement(Nn,{context:a},t.createElement(An,{value:n(a)},t.createElement(Bt,{value:l(a)},o(e.schema.template,void 0,F(i,e.testId))))))))))):null}const li={BasicText:(e,t)=>ja(e,t,!0),StaticLink:(e,t)=>Ua(e,t,!0)};function ci(e){const n=ht();return t.createElement(mt,{value:n,overrides:li},t.createElement(yt,null,(n=>t.createElement(ba,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:null==a?void 0:a.own,"data-testid":e.testId,"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,F(a,e.testId))))))})))))}function di(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,F(t,a)))))}function ui(e){const n=xn(),a=dt(),o=ht(),r=Ut(),{event:s}=e.schema,{tabIndex:l,styles:c,isDisabled:d}=m(n),u=i.mapObjIndexed((e=>r(e)),s.data||{}),p=()=>{a({type:Y,payload:{name:s.type,body:{offerId:u.providerOfferId,title:u.title,description:u.description}}})};return t.createElement(ba,{styles:e.schema.styles},(({classnames:n,mapperRef:a})=>{var i;return t.createElement("button",{"aria-disabled":d,"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0,className:null==n?void 0:n.own,"data-e2e":"PartnerEventButtonTrigger","data-testid":e.testId,disabled:d,onClick:p,tabIndex:l,type:"button",style:Object.assign({cursor:"pointer"},c)},t.createElement(Bt,{value:r},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(zt,{value:a(n)},di(e,i,o))}(e.schema.children,n.own,a,o,e.testId):di(e.schema.children,o,e.testId)))}))}function pi(e){const n=dt(),a=e.schema.delay?e.schema.delay:1,i=e.schema.customStateKey,o=pt(0,(e=>e.customStates[i]));return function({delay:e,callback:n}){const a=t.useRef(null);t.useEffect((()=>{a.current=setTimeout(n,e)}),[])}({delay:a,callback:()=>{n({type:J,payload:{key:i,value:o?0:1}})}}),null}function fi(e){return()=>{throw new T("FAILED_CREATING_UNHANDLED_NODE",`The default mapper does not handle the ${e} node. Make sure when you use the NodeMapperProvider, you pass an override for ${e} node.`)}}const yi={Column:function(e,n){if("Column"===e.type)return t.createElement(Ea,{schema:e.node,testId:n})},Row:function(e,n){if("Row"===e.type)return t.createElement(Ia,{schema:e.node,testId:n})},StaticImage:function(e,n){if("StaticImage"===e.type)return t.createElement(_a,{schema:e.node,testId:n})},DataImage:function(e,n){if("DataImage"===e.type)return t.createElement(Da,{schema:e.node,testId:n})},CreativeResponse:function(e,n){if("CreativeResponse"===e.type)return t.createElement(Na,{schema:e.node,testId:n})},OneByOneDistribution:fi("OneByOneDistribution"),StackedDistribution:fi("StackedDistribution"),CarouselDistribution:fi("CarouselDistribution"),GroupedDistribution:fi("GroupedDistribution"),ProgressIndicator:fi("ProgressIndicator"),ProgressControl:fi("ProgressControl"),When:function(e,n){if("When"===e.type)return t.createElement(va,{schema:e.node,testId:n})},Overlay:fi("Overlay"),CloseButton:fi("CloseButton"),RichText:function(e,n){if("RichText"===e.type)return t.createElement(Ta,{schema:e.node,testId:n})},BasicText:ja,StaticLink:Ua,DataIcon:function(e,n){if("DataIcon"===e.type)return t.createElement(za,{schema:e.node,testId:n})},StaticIcon:function(e,n){if("StaticIcon"===e.type)return t.createElement(Pa,{schema:e.node,testId:n})},ZStack:function(e,n){if("ZStack"===e.type)return t.createElement(Ha,{schema:e.node,testId:n})},FlowRow:function(e,n){if("FlowRow"===e.type)return t.createElement(Za,{schema:e.node,testId:n})},SlideStateTrigger:function(e,n){if("SlideStateTrigger"===e.type)return t.createElement(Ja,{schema:e.node,testId:n})},ToggleButtonStateTrigger:function(e,n){if("ToggleButtonStateTrigger"===e.type)return t.createElement(Qa,{schema:e.node,testId:n})},PartnerEventButtonTrigger:function(e,n){if("PartnerEventButtonTrigger"===e.type)return t.createElement(ui,{schema:e.node,testId:n})},TimerStateTrigger:function(e,n){if("TimerStateTrigger"===e.type)return t.createElement(pi,{schema:e.node})},CatalogStackedCollection:function(e,n){if("CatalogStackedCollection"===e.type)return t.createElement(si,{schema:e.node,testId:n})},CatalogResponseButton:fi("CatalogResponseButton"),ScrollableRow:function(e,n){if("ScrollableRow"===e.type)return t.createElement(Xa,{schema:e.node,testId:n})},ScrollableColumn:function(e,n){if("ScrollableColumn"===e.type)return t.createElement(ei,{schema:e.node,testId:n})},EscapeHatch:ri,BottomSheet:fi("BottomSheet"),CatalogQuantityOption:fi("CatalogQuantityOption"),CatalogRadioGroup:fi("CatalogRadioGroup"),CatalogQuantityCounter:fi("CatalogQuantityCounter"),InlineContainer:function(e,n){if("InlineContainer"===e.type)return t.createElement(ci,{schema:e.node,testId:n})}};function hi(e){return function(n,a,i){const o=a&&a[n.type],r=null!=o?o:yi[n.type];return t.createElement(Ga,{schema:n,reporter:e},r&&r(n,i)||function(e){throw new T("FAILED_CREATING_LAYOUT_NODE",`Failed to create layout node ${JSON.stringify(e)}`)}(n))}}const mi={transformLinksToAnchorText:function(e={}){return{data:i.mapObjIndexed((e=>Ct(e)?`<a target="_blank" href="${e.url}">${e.title}</a>`:""),e)}}};function vi(e){const{childLayouts:n}=e,a=dt(),[o,r]=t.useMemo((()=>{const e=i.indexBy(i.prop("childLayoutId"),n);return[e,i.mapObjIndexed((e=>e.childLayoutSchema.predicates),e)]}),[n]),s=ca(r);t.useEffect((()=>{Object.entries(s).forEach((([e,t])=>{const n=o[e];t&&n&&a({type:ee,payload:n})}))}),[s,o,a])}function gi(e){const{settings:n,dispatch:a,children:i}=e,o=$t(n.offerData.creative.copy||{})(mi.transformLinksToAnchorText(n.offerData.creative.links),"creativeLink"),r=hi(n.logger),[s,l]=t.useState("ENABLED");return t.useEffect((()=>n.gateway.onInteractivityChange(l)),[n]),ie(n.rootElement,a),t.createElement(qt.Provider,{value:"VARIANT"},t.createElement(vt.Provider,{value:n.rootElement},t.createElement(Dn.Provider,{value:n.pluginId},t.createElement(vn,{context:n.gateway},t.createElement(bn,{context:n.layoutSchema},t.createElement(Pn.Provider,{value:n.schemaVersion},t.createElement(Et,{context:n.offerData},t.createElement(An,{value:Sn(n.offerData.creative)},t.createElement(In.Provider,{value:s},t.createElement(mt,{value:r},t.createElement(Wt.Provider,{value:n.offerPositionIndex},t.createElement(ct.Provider,{value:a},t.createElement(Bt,{value:o},t.createElement(bi,null,t.createElement(vi,{childLayouts:n.childLayouts}),i))))))))))))))}function bi(e){var n;const{children:a}=e,o=kn(),r=function(){const[e,n]=t.useState(null),a=t.useContext(mn).get();return t.useEffect((()=>a.onGlobalStateChange((t=>{i.equals(t,e)||n(t)}))),[a]),e}(),s=t.useContext(vt)||void 0,l=Jt(),c=t.useCallback((e=>st(e,o,l,s)),[s]);return r?t.createElement(zt,{value:c(Object.values(null!==(n=null==r?void 0:r.breakpoint.breakpoints)&&void 0!==n?n:{}))},t.createElement(ut.Provider,{value:r},a)):null}function Ei(e){return t.createElement("style",{"data-testid":e.testId},"\n* {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n}\nbody {\n margin: 0;\n font-family: sans-serif;\n}\np {\n margin: 0;\n}\nimg {\n max-width: 100%;\n}\n")}function Ii(e,t,n,a,i,o){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){o.current.isRunning=!0,i&&"in"===t&&function(e,t){e.style.height=`${t.clientHeight}px`}(i,e);const r=e.animate(n,{duration:a,iterations:1});return r.onfinish=()=>{"in"===t?da(e):ua(e),o.current.isRunning=!1},r.oncancel=()=>{"in"===t?da(e):ua(e),o.current.isRunning=!1},()=>{r.finish()}}return"in"===t?da(e):ua(e),()=>{}}const xi={FadeInOut:{in:[{opacity:0,display:"none"},{opacity:0,display:"none",offset:.5},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],out:[{opacity:1},{opacity:0,offset:.75},{opacity:0}]}};function Si({visible:e,effect:n,children:a,parentElement:i,containerClassName:o}){const[r,s]=t.useState(e),l=t.useRef(null),c=t.useRef({isRunning:!1}),d=pa(n);return t.useEffect((()=>{const t=new ResizeObserver((function(t){i&&e&&!c.current.isRunning&&t.forEach((e=>{e.contentBoxSize?function(e,t){var n;Array.isArray(e.contentBoxSize)&&e.contentBoxSize[0]?t.style.height=e.contentBoxSize[0].blockSize+"px":"object"==typeof(n=e.contentBoxSize)&&null!=n&&"blockSize"in n&&"number"==typeof n.blockSize&&"inlineSize"in n&&"number"==typeof n.inlineSize?t.style.height=e.contentBoxSize.blockSize+"px":t.style.height="auto"}(e,i):e.contentRect&&function(e,t){t.style.height=`${e.contentRect.height}px`}(e,i)}))}));return e&&l.current&&(da(l.current),t.observe(l.current)),()=>{t.disconnect()}}),[e,i]),t.useEffect((()=>e&&!r&&l.current&&i?(s(!0),Ii(l.current,"in",xi[n.type].in,d,i,c)):!e&&r&&l.current&&i?(s(!1),Ii(l.current,"out",xi[n.type].out,d/2,i,c)):()=>{}),[e,i,d]),t.createElement("div",{ref:l,style:{display:"none"},className:o},a)}function wi(e){const n=ht();return t.createElement(ba,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:null==a?void 0:a.own,"data-testid":e.testId,style:{display:"flex",flexDirection:"column"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},n(e.schema.template))}))}const Ci="ACTIVE/ADD",Oi="ACTIVE/DELETE",Ai="BREAKPOINT/UPDATE_ACTIVE",Ti="BREAKPOINT/INITIALISE",Ri="BREAKPOINT/SET_BREAKPOINTS",ji="FONTS/SET",Li="LAYOUT/UPDATE",Ni="CONFIG/HANDLE",_i="PLUGIN/CLOSE_PLUGIN",Di="SETTINGS/SET",ki="CACHE/ADD_SERIALIZED_VALUE",Pi="CACHE/UPDATE_SERIALIZED_VALUE",$i="CACHE/CLEAR_SERIALIZED_VALUE",Gi="SIGNAL/QUEUE",Fi="SIGNAL/PROCESSED",Mi="SIGNAL/PROCESS",Bi="OVERLAY/DISMISS_OVERLAY",Ui="ERROR/REPORT",Vi="LOG",zi="CUSTOM_STATES/SET",qi={LAYOUT_UPDATE:Li,UPDATE_ACTIVE_BREAKPOINT:Ai,INITIALISE_BREAKPOINT:Ti,ACTIVE_ADD:Ci,ACTIVE_DELETE:Oi,SET_FONTS:ji,QUEUE_SIGNAL:Gi,SIGNAL_PROCESSED:Fi,CACHE_SERIALIZED_VALUE:ki,UPDATE_CACHED_SERIALIZED_VALUE:Pi,CLEAR_SERIALIZED_VALUE_FROM_CACHE:$i,SET_SETTINGS:Di,SET_CUSTOM_STATE:zi},Hi={HANDLE_CONFIG:Ni,SET_BREAKPOINTS:Ri,CLOSE_PLUGIN:_i,RAISE_METRIC:M,PREPARE_SIGNAL:K,DISMISS_OVERLAY:Bi,REPORT_ERROR:Ui,LOG:Vi,OPEN_LINK:Z},Wi="plugin-overlay",Ji="plugin";function Yi(n){var i;const o=n.schema.styles,r=a.useDispatch(),s={type:(null===(i=n.action)||void 0===i?void 0:i.type)||Bi,payload:{id:Wi,dismissalMethod:n.schema.dismissalMethod}},l=()=>{r(s)},c=xn(),{tabIndex:d,styles:u,isDisabled:p}=m(c);return e.jsx(ba,{styles:o,children:({classnames:a})=>{var i;return e.jsx("button",{title:"Close",className:null==a?void 0:a.own,onClick:l,"data-testid":n.testId,"data-e2e":"CloseButton",disabled:p,tabIndex:d,"aria-disabled":p,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:void 0,style:Object.assign({cursor:"pointer"},u),children:e.jsx(yt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}const Ki={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var Zi;function Qi({isOpen:n,schema:o,testId:r,children:s}){const l=oe(),c=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),d=a.useSelector((e=>e.active.has(Ji))),u=a.useDispatch(),p=()=>{u({type:Hi.DISMISS_OVERLAY,payload:{id:Wi,dismissalMethod:"rokt_backdrop"}})};t.useEffect((()=>{c&&u({type:H,payload:{name:"SignalActivation",parentGuid:c}})}),[c]),t.useEffect((()=>{d&&requestAnimationFrame((()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}))}),[d]);const f=xn(),{tabIndex:y,isDisabled:h,styles:v}=m(f),g=o.styles?i.mergeRight(Ki,o.styles):Ki;if(!n)return null;const b=e.jsx(yt,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(ba,{styles:g,children:({classnames:t})=>{var n;return e.jsxs("div",{className:null==t?void 0:t.wrapper,style:Object.assign({position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9999",display:"flex",overflow:"auto"},v),"aria-label":null!==(n=o.a11yLabel)&&void 0!==n?n:void 0,"aria-hidden":h,role:"dialog","aria-modal":!0,tabIndex:y,"data-testid":r,"data-e2e":"Overlay-Wrapper",children:[e.jsx("div",{style:{position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},onClick:o.allowBackdropToClose?p:void 0,"data-testid":r&&`${r}-backdrop`,"data-e2e":"Overlay-Backdrop"}),s(b,l)]})}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(Zi||(Zi={}));const Xi={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const eo=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(Xi,t.styles):Xi;return e.jsx(ba,{styles:r,children:({classnames:i})=>{var r;return e.jsx("div",{className:null==i?void 0:i.own,style:{position:"relative",zIndex:"3",outline:"none"},ref:o,tabIndex:-1,"data-e2e":"Overlay-Container","aria-label":null!==(r=t.a11yLabel)&&void 0!==r?r:void 0,role:"dialog","aria-modal":!0,"data-testid":n&&`${n}-container`,children:a})}})}));const to=a.connect((function(e){return{isOpen:e.active.has(Wi)}}))((function(t){return e.jsx(Qi,Object.assign({},t,{children:(n,a)=>e.jsx(eo,Object.assign({},t,{ref:a,children:n}))}))}));const no=a.connect((function(e){return{isOpen:e.active.has(Wi)}})),ao={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const io=t.forwardRef((function({schema:n,testId:a,children:o},r){const s=t.useRef(null),l=n.styles?i.mergeRight(ao,n.styles):ao;return t.useEffect((()=>{if(s.current)return function(e){const t=requestAnimationFrame((()=>{e&&e.style.setProperty("max-height","100%")}));return()=>{cancelAnimationFrame(t)}}(s.current)}),[]),e.jsx(ba,{styles:l,children:({classnames:t})=>e.jsx("div",{style:{width:"100%",maxHeight:"0%",transition:"max-height 0.8s",transitionTimingFunction:"cubic-bezier(0.05, 0.7, 0.1, 1.0)",alignSelf:"flex-end"},ref:s,children:e.jsx("div",{className:null==t?void 0:t.own,style:{position:"relative",zIndex:"3",outline:"none",borderBottomLeftRadius:"0",borderBottomRightRadius:"0"},ref:r,tabIndex:-1,"data-testid":a&&`${a}-container`,"data-e2e":"BottomSheet-Container",children:o})})})}));const oo=no((function(t){return e.jsx(Qi,Object.assign({},t,{children:(n,a)=>e.jsx(io,Object.assign({},t,{ref:a,children:n}))}))}));const ro="DisplayPreset.FULLSCREEN",so="DisplayPreset.EMBEDDED",lo="DisplayPreset.ATTACHED",co="ERROR",uo="INFO",po="WARNING";var fo;!function(e){e.PAYPAL="Paypal"}(fo||(fo={}));const yo="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DCUI_SCHEMA_VERSION:"",ROKT_DOMAIN:""};function*ho(e,t,n){(function(e){return"object"==typeof e&&null!==e&&"type"in e&&Object.values(te).includes(e.type)})(n)&&!e.includes(n.type)&&(yield r.call(t.globalDispatch.bind(t),n))}function mo(e,t){return!e||t<1?null:{cartItemId:e.cartItemId,catalogItemId:e.catalogItemId,name:e.title,description:e.description,quantity:t,currency:e.currency||"$",unitPrice:e.price||0,totalPrice:(e.price||0)*t,linkedProductId:e.linkedProductId,quantityMustBeSynchronized:e.quantityMustBeSynchronized,providerData:e.providerData||""}}function vo(e){switch(typeof e){case"undefined":return"";case"object":return null===e?"":JSON.stringify(e);case"string":return e;default:return String(e)}}function go(e){return i.map(vo,e)}function*bo(e,t){const n=yield r.actionChannel(e,l.buffers.expanding(10));for(;n;){const e=yield r.take(n);yield r.call(t,e)}}function*Eo(e,t){const n=yield r.take(e);yield r.call(t,n)}function Io(e){return!!z(e)&&(e.rclid&&"RealTime"===e.conversionType&&e.accountID&&e.referralCreativeID)}function*xo(e){for(;;){const t=yield r.take(e);yield r.put(t)}}function*So(e,t){const n=i.over(i.lensProp("moduleName"),i.defaultTo("orchestrator"),t.payload.additionalInformation||{}),a=Object.assign(Object.assign({},t.payload),{additionalInformation:n?go(n):{}});try{yield r.call(e,a)}catch(e){}t.payload.level===co&&(yield r.put({type:Y,payload:{name:"PLACEMENT_FAILURE"}}),yield r.put({type:Hi.CLOSE_PLUGIN}))}const wo="INVALID_RESPONSE_OBJECT",Co="FAILED_TO_OPEN_LINK",Oo="NO_PARENT_GUID",Ao="FAILED_TO_NOTIFY_INTERACTIVE",To="FAILED_TO_ESTABLISH_PARTNER_VALIDATION";var Ro=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(n[a[i]]=e[a[i]])}return n};function jo(e,t){return n=>n&&n.replace(e,t)}const Lo=jo(/['""();{}@:[\]!/=]/g,""),No=/^(normal|italic|oblique( \d+deg)*)$/i,_o=(e="")=>No.test(e)?e:void 0,Do=jo(/[;{}@[\]!]/g,"");function ko(e){const{fontFamily:t,sources:n}=e,a=Ro(e,["fontFamily","sources"]),i=document.fonts,o=new FontFace(t,n.join(", "),a);return i.add(o),o.load().catch((e=>(i.delete(o),Promise.reject(e))))}function Po(e=[]){const t=Array.from(document.fonts.values());return Promise.all(e.map((e=>{const n=function(e){return{fontFamily:Lo(e.fontFamily)||"",style:_o(e.style),weight:Lo(e.weight),sources:e.sources.map((e=>Do(e)||"")),display:e.display}}(e);return t.find((e=>e.family===n.fontFamily&&e.weight===n.weight&&(e.style===n.style||!n.style)))?Promise.resolve():ko(n).then((()=>{})).catch((e=>`${e}`.includes("SyntaxError")?(n.fontFamily='"'+n.fontFamily+'"',ko(n).then((()=>{}))):Promise.reject(e))).catch((e=>Promise.resolve(`Error loading font: [Font (${JSON.stringify(n)})] [Message - ${e}]`)))}))).then((e=>{const t=e.filter(Boolean);return t.length>0?Promise.reject(t):Promise.resolve()}))}function $o(e){const n=a.useDispatch(),i=a.useSelector((e=>{const t=e.fonts.map((e=>({fontFamily:e.fontFamily,style:e.fontStyle||"normal",weight:e.fontWeight,sources:e.src}))),n=t.find((e=>"rokt-icons"===e.fontFamily));if(n)n.display="block";else{const e=null!==(a=yo.ROKT_DOMAIN)&&void 0!==a?a:"";t.push(function(e=""){return{fontFamily:"rokt-icons",weight:"400",sources:[`url("${e}/icons/rokt-icons.woff") format("woff")`],display:"block"}}(e))}var a;return JSON.stringify(t)}));return t.useEffect((()=>{Po(JSON.parse(i)).catch((e=>{const t={type:Ui,payload:{level:uo,code:"FAILED_TO_LOAD_FONT",message:`Error loading fonts:\n\t${e.join("\n\t")}`}};n(t)}))}),[i]),t.useEffect((()=>{const e=()=>{var e,t;null===(t=null===(e=window.frameElement)||void 0===e?void 0:e.iFrameResizer)||void 0===t||t.resize()};return document.fonts.addEventListener("loadingdone",e),()=>{document.fonts.removeEventListener("loadingdone",e)}}),[]),null}function Go(e){return null!=e?e:null}function Fo(){return new Set([Wi])}function Mo(e){return e.breakpoint.breakpoints[e.breakpoint.activeBreakpoint]||0}const Bo=i.sortBy(i.prop(1)),Uo=i.map(i.prop(0)),Vo=e=>i.compose(i.findIndex(i.equals(e)),Uo,Bo,i.toPairs,i.pathOr({},["breakpoint","breakpoints"]));function zo(e){return Vo(e.breakpoint.activeBreakpoint)(e)}function qo(e,t){return e.customStates[`module${t}`]||{}}function Ho(e){return`${e.name}:${e.parentGuid}`}function Wo(e,t){return!e.processed.includes(Ho(t))||(n=t.name,void 0!==C.find((e=>e===n)));var n}function Jo(){return new Map}const Yo={layout:function(e=Go(),t){return t.type===Li?t.payload:e},breakpoint:function(e={breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},t){var n;switch(t.type){case Ai:return Object.prototype.hasOwnProperty.call(e.breakpoints,t.payload.activeBreakpoint)?Object.assign(Object.assign({},e),{activeBreakpoint:t.payload.activeBreakpoint}):e;case Ti:return{activeBreakpoint:null!==(n=t.payload.activeBreakpoint)&&void 0!==n?n:"default",breakpoints:Object.assign({default:0},t.payload.breakpoints),initialised:!0};default:return e}},active:function(e=Fo(),t){var n,a;switch(t.type){case Ci:{const a=new Set(e);return a.add(null===(n=t.payload)||void 0===n?void 0:n.id),a}case Oi:{const n=new Set(e);return n.delete(null===(a=t.payload)||void 0===a?void 0:a.id),n}default:return e}},fonts:function(e=[],t){return t.type===ji?t.payload:e},signal:function(e={queue:[],processed:[]},t){switch(t.type){case Gi:return i.evolve({queue:n=>Wo(e,t.payload.signal)?i.uniqBy(i.pipe(i.prop("signal"),Ho),n.concat(t.payload)):n},e);case Fi:return i.evolve({queue:e=>i.reject(i.pipe(i.prop("signal"),i.whereEq({name:t.payload.name,parentGuid:t.payload.parentGuid})))(e),processed:i.append(Ho(t.payload))},e);default:return e}},serializableCache:function(e=Jo(),t){switch(t.type){case ki:case Pi:if(t.payload.key&&t.payload.value){return new Map([...e]).set(t.payload.key,t.payload.value)}return e;case $i:{const n=new Map([...e]);return t.payload&&n.delete(t.payload),n}default:return e}},settings:function(e={closeOnComplete:!0},t){return t.type===Di?i.mergeDeepWith(((e,t)=>i.isNil(t)?e:t),e,t.payload):e},customStates:function(e={root:{}},t){if(t.type===zi){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:"root";return i.assocPath([n,t.payload.key],Number(t.payload.value),e)}return e}return e}};function*Ko(e,t){var n,a;try{const i=(null===(n=e.activeBreakpointEventChannel)||void 0===n?void 0:n.call(e,t.payload))||(a=t.payload,l.eventChannel((e=>{const t=Object.entries(a).reduce(((e,t)=>{const a=window.matchMedia(`(min-width: ${t[1]}px)`);return"addEventListener"in a&&"function"==typeof a.addEventListener?(a.addEventListener("change",n),e[t[0]]=a):"addListener"in a&&"function"==typeof a.addListener&&(a.addListener(n),e[t[0]]=a),e}),{});return setTimeout((()=>n()),0),()=>{Object.entries(t).forEach((e=>{const t=e[1];"removeEventListener"in t&&"function"==typeof t.removeEventListener?t.removeEventListener("change",n):"removeListener"in t&&"function"==typeof t.removeListener&&t.removeListener(n)}))};function n(){try{e(function(e,t){return Object.entries(e).reduce(((e,n)=>n[1].matches&&(t[n[0]]||0)>(t[e]||0)?n[0]:e),"default")}(t,a))}catch(t){e(t)}}})));try{let e=yield r.take(i);for(yield r.put({type:qi.INITIALISE_BREAKPOINT,payload:{activeBreakpoint:e,breakpoints:t.payload}});;)e=yield r.take(i),yield r.put({type:qi.UPDATE_ACTIVE_BREAKPOINT,payload:{activeBreakpoint:e}})}catch(e){const n=e;yield r.put({type:Ui,payload:{level:po,code:"FAILED_TO_DETERMINE_BREAKPOINT",message:null==n?void 0:n.message,additionalInformation:{stack:null==n?void 0:n.stack,breakpoints:t.payload}}})}finally{(yield r.cancelled())&&i.close()}}catch(e){const n=e;yield r.put({type:Ui,payload:{level:co,code:"FAILED_TO_ESTABLISH_BREAKPOINT_CHANNEL",message:null==n?void 0:n.message,additionalInformation:{stack:null==n?void 0:n.stack,breakpoints:t.payload}}})}}function Zo(e,t,n){return l.eventChannel((a=>{const i=e.subscribe((e=>{const t=n(e);t&&a({type:Ni,payload:t})}),(e=>{a(e)})),o=t.fonts.subscribe((e=>{a({type:ji,payload:e})}),(e=>{a(e)}));return()=>{i.unsubscribe(),o.unsubscribe()}}),l.buffers.sliding(2))}var Qo=Object.freeze({__proto__:null,CartEvent:{UPDATE_CART_ITEM_MESSAGE:"UPDATE_CART_ITEM_MESSAGE",UPSERT_ALERT:"UPSERT_ALERT",DELETE_ALERT:"DELETE_ALERT",UPSERT_DELIVERY_DETAILS:"UPSERT_DELIVERY_DETAILS"}}),Xo=Object.freeze({__proto__:null,PartnerMessage:{UpdateCartItem:"V2_UPDATE_CART_ITEM"},PlacementMessage:{CartItemUpdated:"V2_CART_ITEM_UPDATED"}}),er=Object.freeze({__proto__:null,V1:Qo,V2:Xo}),tr=Object.freeze({__proto__:null,PartnerMessage:{CartItemInstantPurchaseResponse:"CART_ITEM_INSTANT_PURCHASE_RESPONSE"},PlacementMessage:{CartItemInstantPurchase:"CART_ITEM_INSTANT_PURCHASE"}}),nr=Object.freeze({__proto__:null,PartnerValidationEvent:{SET_PARTNER_VALIDATION_STATUS:"SET_PARTNER_VALIDATION_STATUS",OPT_IN_TO_PARTNER_VALIDATION:"OPT_IN_TO_PARTNER_VALIDATION",SHOW_PARTNER_VALIDATION_STATUS:"SHOW_PARTNER_VALIDATION_STATUS"}});const ar="LINK_NAVIGATION_REQUEST",ir="REALTIME_OFFER_FULFILLMENT_SUCCESS",or="REALTIME_OFFER_FULFILLMENT_FAILURE";var rr=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 sr={newTab:"_blank",self:"_top",roktWebViewSDK:"roktWebViewSDK",inApp:"inApp",overrideLinkNavigation:"overrideLinkNavigation"};function lr({url:e,urlBehavior:t,external:n},a=window){return rr(this,void 0,void 0,(function*(){if(!e)return null;if("overrideLinkNavigation"===t)return n.partner.send(ar,{url:e}).then((()=>null));const i=sr[t];if(a.RoktWebViewSDK){const t=a.RoktWebViewSDK.open(e);return t?{ref:t}:null}if("_top"===i&&a.top)return a.top.location.href=e,null;const o=a.open(e,i);if(o)try{o.opener=null}catch(e){}return o?{ref:o}:null}))}var cr=Object.freeze({__proto__:null,openLink:lr});function dr(e,t,n,a){const i=function(e){return"object"==typeof e&&null!=e&&"message"in e&&"string"==typeof e.message&&e.message.includes("timed out")}(e),o=i?{originErrorCode:n}:void 0;return{type:Ui,payload:{level:po,code:i?"COMMUNICATION_FAILURE_WITH_WSDK":n,message:t,additionalInformation:Object.assign(Object.assign({},o),a)}}}var ur=Object.freeze({__proto__:null,makePluginWarningAction:dr});function pr(e){return null!=e&&"object"==typeof e&&"ref"in e&&"object"==typeof e.ref&&!Array.isArray(e.ref)&&null!=e.ref}var fr=Object.freeze({__proto__:null,isWindow:pr}),yr=Object.assign(Object.assign(Object.assign({},cr),ur),fr);function*hr(e=10){(yield r.select((e=>e.signal.queue.length>0)))&&(yield c.delay(30),e>=1&&(yield*hr(e-1)))}function*mr(e){try{yield*hr(10),yield c.call(e.close)}catch(e){const t=yr.makePluginWarningAction(e,"Failed to close the plugin","FAILED_TO_CLOSE_PLUGIN");yield c.put(t)}}function*vr(e,{payload:t}){var n;if("string"==typeof(n=t.name)&&R.includes(n))switch(t.name){case"V2_CART_ITEM_UPDATED":case"CART_ITEM_INSTANT_PURCHASE":case"UPSELL_CREATIVE_SENT":case"REALTIME_OFFER_FULFILLMENT_REFERRAL":case"REALTIME_OFFER_FULFILLMENT_SUCCESS":yield e.send(t.name,t.body);break;case"OFFER_ENGAGEMENT":case"PLACEMENT_CLOSED":case"PLACEMENT_COMPLETED":case"PLACEMENT_FAILURE":case"PLACEMENT_INTERACTIVE":case"POSITIVE_ENGAGEMENT":yield e.send(t.name);break;default:return}}const gr=i.propOr("FAILED_TO_PARSE_CONFIG","code");function*br(e,t){var n;const a=yield c.call(Zo,e.configService,e.themeService,t);for(;;)try{const e=yield c.take(a);yield c.put(e)}catch(e){const t=e;yield c.put({type:Ui,payload:{level:co,code:gr(t),message:null!==(n=null==t?void 0:t.message)&&void 0!==n?n:"An error occured parsing or receiving Plugin config, fonts or configurables.",additionalInformation:{stack:null==t?void 0:t.stack}}})}}function*Er(e,t){yield c.all([c.spawn(br,e,t),c.takeEvery(Y,vr,e.partnerInteractionService)])}function Ir(e){switch(e){case"ATTACHED":return lo;case"EMBEDDED":return so;default:return ro}}function*xr(e,t){const n={preset:Ir(t)};yield c.call(e.setDisplaySettings,n),yield c.put({type:qi.ACTIVE_ADD,payload:{id:Ji}})}function*Sr(e,t){var n;const a=null!==(n=t.payload.data)&&void 0!==n?n:{};try{yield r.call(e,{code:t.payload.code,level:uo,message:t.payload.message||"Plugin Generic Log",additionalInformation:go(a)})}catch(e){}}function*wr(e){yield r.put({type:qi.QUEUE_SIGNAL,payload:{signal:e.payload}}),yield r.put({type:Mi})}function*Cr(e){yield r.put({type:qi.QUEUE_SIGNAL,payload:e.payload}),yield r.put({type:Mi})}function*Or(e,t){const n=yield r.select((e=>e.signal.queue.filter((t=>Wo(e.signal,t.signal)))));if(Array.isArray(n)&&n.length)for(const e of n){const t="criteria"in e?e.criteria:void 0;switch(e.signal.name){case"SignalActivation":case"SignalLoadComplete":case"SignalImpression":yield*Ar(e.signal,a(t));break;case"SignalDismissal":yield*Tr(e.signal,a(t));break;case"SignalInstantPurchaseDismissal":yield*Rr(e.signal,a(t));break;case"SignalLoadStart":yield*jr(e.signal,a(t));break;case"SignalGatedResponse":case"SignalResponse":yield*Lr(e.signal,a(t,!0));break;case"SignalUserInteraction":yield*Nr(e.signal,a(t));break;case"SignalCartItemQuantitySelected":yield*_r(e.signal,a(t));break;case"SignalCartItemInstantPurchaseInitiated":yield*Dr(e.signal,a(t));break;case"SignalCartItemInstantPurchase":yield*kr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseFailure":yield*Pr(e.signal,a(t))}yield r.put({type:qi.SIGNAL_PROCESSED,payload:e.signal})}function a(t,n=!1){return function(a,i,o){return t?r.call(e.prepareExternalSignal,t.key,a,i,o):n?r.call(e.issueSignalSync,a,i,o):r.call(e.issueSignal,a,i,o)}}}function*Ar(e,t){let n;e.creativeInstanceGuid&&(n={},n.creativeInstanceGuid=e.creativeInstanceGuid);try{yield t(e.name,e.parentGuid,n)}catch(t){yield $r(e,t)}}function*Tr(e,t){try{yield t(e.name,e.parentGuid,e.dismissalMethod?{objectData:{dismissalMethod:e.dismissalMethod}}:void 0)}catch(t){yield $r(e,t)}}function*Rr(e,t){try{yield t(e.name,e.parentGuid,void 0)}catch(t){yield $r(e,t)}}function*jr(e,t){var n;const a={overrideTimestamp:null!==(n=e.overrideTimestamp)&&void 0!==n?n:new Date};try{yield t(e.name,e.parentGuid,a)}catch(t){yield $r(e,t)}}function*Lr(e,t){try{yield t(e.name,e.parentGuid,function(e){const t={creativeInstanceGuid:e.responseActionPayload.creativeInstanceGuid};"Url"===e.responseActionPayload.name&&(t.transformedTrafficURL=e.responseActionPayload.transformedTrafficURL);return t}(e))}catch(t){yield $r(e,t)}}function*Nr(e,t){const n=e.parentGuid?e.parentGuid:yield r.select((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid}));try{if(!n||"string"!=typeof n)throw new Error(`Cannot raise SignalUserInteraction, missing or invalid parent GUID: ${JSON.stringify(e)}`);yield t(e.name,n,{objectData:{action:e.action,context:e.context}})}catch(t){yield $r(e,t)}}function*_r(e,t){const n={objectData:{preselected:e.objectData.preselected.toString(),quantity:e.objectData.quantity.toString()}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield $r(e,t)}}function*Dr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString()}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield $r(e,t)}}function*kr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString(),initiatedBy:e.objectData.initiatedBy}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield $r(e,t)}}function*Pr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString(),failureReason:e.objectData.failureReason,providerId:e.objectData.providerId}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield $r(e,t)}}function $r(e,t){const n=yr.makePluginWarningAction(t,(null==t?void 0:t.message)||"Failed to issue signal","FAILED_TO_ISSUE_SIGNAL",{signalName:null==e?void 0:e.name,parentGuid:null==e?void 0:e.parentGuid,stack:null==t?void 0:t.stack});return r.put(n)}function*Gr(e){yield r.put({type:zi,payload:e.payload})}function*Fr(e,t){if("Interactive"===t.payload.name)try{yield*function*(e){const t="METRIC";(yield r.select((e=>e.serializableCache.has(t))))||(yield r.call(e.notifyInteractive),yield r.put({type:ki,payload:{key:t,value:"Interactive"}}))}(e)}catch(e){const t=e;yield*function*(e){var t;yield r.put({type:Ui,payload:{level:uo,code:Ao,message:null!==(t=null==e?void 0:e.message)&&void 0!==t?t:"Failed to notify interactive",additionalInformation:{stack:null==e?void 0:e.stack}}})}(t)}}function*Mr(e,t){const n=e.context.getOverrideLinkNavigation()?"overrideLinkNavigation":t.payload.urlBehaviour;try{"inApp"===n?yield r.call(e.createChildPlugin,{name:"url-modal",config:{url:t.payload.url,method:"GET"}}):yield r.call(lr,{url:t.payload.url,urlBehavior:n,external:e})}catch(e){yield r.put(dr(e,"Failed to open link",Co,{url:t.payload.url,urlBehaviour:n}))}}function*Br(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:qi.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:_i}),t?yield r.put({type:H,payload:{name:"SignalDismissal",parentGuid:t,dismissalMethod:e.payload.dismissalMethod}}):yield r.put({type:Ui,payload:{level:uo,code:Oo,message:"ParentGuid does not exist"}})}const Ur=a.connect((function(e){return{isOpen:e.active.has(Wi)}})),Vr="undefined"!=typeof window;function zr(e,n){t.useEffect((()=>{if(!Vr||n)return;const t=e.current;if(!t)return;const a=e=>{e.preventDefault()},i=["wheel","touchmove"];i.forEach((e=>{t.addEventListener(e,a,{passive:!1})}));const o=e=>{["ArrowUp","ArrowDown","PageUp","PageDown","Space"].includes(e.code)&&e.preventDefault()};return window.addEventListener("keydown",o),()=>{i.forEach((e=>{t.removeEventListener(e,a)})),window.removeEventListener("keydown",o)}}),[e,n])}const qr="Minimized",Hr=()=>{const e=t.useRef(null),n=t.useRef(null),a=t.useRef(null),i=t.useRef(null),o=t.useRef(null),r=pt(0,(e=>e.customStates[qr])),s=dt(),l=xn(),c=t.useRef(0),d=t.useRef(!1),u=t.useRef(0),p=t.useRef([]),f=t.useRef(void 0),{isDisabled:y}=m(l);zr(e,!!r);const h=t.useCallback((()=>{D(),f.current=void 0,d.current=!1,L(!0);v()?x():j(0)}),[]),v=()=>{const e=R();return r?e<=-.2:e>=.2};t.useEffect((()=>{r?(w(),s(Jr(!0))):(C(),s(Jr(!1)))}),[r,s]),t.useEffect((()=>{requestAnimationFrame((()=>{_(!r,a),_(!!r,i),N()}))}),[]);const b=t.useCallback((e=>{if(n.current){e.preventDefault();const t=I(e);j(t)}}),[n]),E=t.useCallback((e=>{Date.now()-u.current<200||(u.current=Date.now(),r?S(!1):d.current||y||(d.current=!0,T(),f.current=Wr(e),L(!1),k()))}),[r,y]);t.useEffect((()=>{const e=n.current;return e&&(e.addEventListener("mousedown",E),e.addEventListener("touchstart",E)),()=>{null==e||e.removeEventListener("mousedown",E),null==e||e.removeEventListener("touchstart",E)}}),[n,E]);const I=e=>{var t,n;return(null!==(t=Wr(e))&&void 0!==t?t:0)-(null!==(n=f.current)&&void 0!==n?n:0)},x=()=>{S(!r)},S=e=>{const t=(e=>({type:J,payload:{key:qr,value:e?1:0}}))(e);s(t)},w=()=>{var e,t,n,o;const r=null!==(t=null===(e=a.current)||void 0===e?void 0:e.clientHeight)&&void 0!==t?t:0,s=(null!==(o=null===(n=i.current)||void 0===n?void 0:n.clientHeight)&&void 0!==o?o:0)-r;L(!0),N(!0,!0),j(s),_(!1,a),_(!0,i),P()},C=()=>{L(!0),N(!0,!1),j(0),f.current=void 0,_(!0,a),_(!1,i),$()},O=t.useCallback((()=>{d.current&&(A(),requestAnimationFrame(O))}),[]),A=()=>{p.current.push({yPosition:c.current,timestamp:Date.now()}),p.current.length>20&&p.current.shift()},T=t.useCallback((()=>{p.current=[],O()}),[O]),R=()=>{const e=p.current;if(!e)return 0;const t=e[0],n=e[e.length-1];if(!t||!n)return 0;const a=n.timestamp-t.timestamp;return(n.yPosition-t.yPosition)/a},j=e=>{const t=Math.round(e);c.current=t,n.current&&(n.current.style.transform=`translateY(${t}px)`)},L=e=>{e?n.current&&(n.current.style.transition="transform .2s"):n.current&&(n.current.style.transition="")},N=(e,t=!1)=>{const n=t?i:a,o=t?a:i;o.current&&(o.current.style.transition="opacity .5s"),n.current&&(n.current.style.transition="opacity .2s")},_=(e,t)=>{const n=t.current;if(!n)return;const a=e?0:1;n.style.opacity=`${a}`,e?n.style.pointerEvents="none":setTimeout((()=>{n.style.pointerEvents="auto"}),400)},D=t.useCallback((()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",h),document.removeEventListener("touchmove",b),document.removeEventListener("touchend",h)}),[b,h]),k=t.useCallback((()=>{g()?(document.addEventListener("touchmove",b,{passive:!1}),document.addEventListener("touchend",h)):(document.addEventListener("mousemove",b,{passive:!1}),document.addEventListener("mouseup",h))}),[b,h]),P=()=>{const t=e.current;t&&(o.current=setTimeout((()=>{var e;const n=((null===(e=a.current)||void 0===e?void 0:e.clientHeight)||0)+1;t.style.height=n+"px"}),200))},$=()=>{o.current&&clearTimeout(o.current),e.current&&(e.current.style.height="100000px")};return{wrapperRef:e,containerRef:n,minimizedChildRef:a,maximizedChildRef:i}};function Wr(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientY:e.clientY}const Jr=e=>({type:H,payload:{action:e?"BottomSheetMinimized":"BottomSheetMaximized",name:"SignalUserInteraction",context:"BottomSheetMinimized"}}),Yr={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var Kr;function Zr({schema:n,testId:o}){const r=oe(),s=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),l=a.useSelector((e=>e.active.has(Ji))),c=t.useRef(null),d=a.useDispatch(),u=()=>{d({type:Hi.DISMISS_OVERLAY,payload:{id:Wi,dismissalMethod:"rokt_backdrop"}})},p=pt(0,(e=>e.customStates[qr]));t.useEffect((()=>{f(!!p)}),[p]),zr(c,!!p);const f=e=>{const t=c.current;t&&(e?t.style.opacity="0":(t.style.display="flex",t.style.opacity="1"))};t.useEffect((()=>{s&&d({type:H,payload:{name:"SignalActivation",parentGuid:s}})}),[s]),t.useEffect((()=>{l&&requestAnimationFrame((()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.focus()}))}),[l]);const y=xn(),{tabIndex:h,isDisabled:v,styles:g}=m(y),b=n.styles?i.mergeRight(Yr,n.styles):Yr;return e.jsx(ba,{styles:b,children:({classnames:t})=>{var a;return e.jsx("div",{className:null==t?void 0:t.wrapper,style:Object.assign({height:"100%",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9998",overflow:"hidden",display:"flex",opacity:"1",transition:"opacity 0.2s ease-in-out"},g),"aria-label":null!==(a=n.a11yLabel)&&void 0!==a?a:void 0,"aria-hidden":v,role:"dialog","aria-modal":!0,tabIndex:h,"data-testid":o,"data-e2e":"Overlay-Wrapper",ref:c,children:e.jsx("div",{style:{position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},onClick:n.allowBackdropToClose?u:void 0,"data-testid":o&&`${o}-backdrop`,"data-e2e":"Overlay-Backdrop"})})}})}function Qr(){return e.jsx("div",{style:{width:"48px",height:"4px",backgroundColor:"#C6C6C8",borderRadius:"2px",margin:"0 auto -4px",position:"relative",top:"6px"}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(Kr||(Kr={}));const Xr={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};function es(t){const n=a.useSelector((e=>e.slots)),i=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0}));return e.jsx(ts,Object.assign({},t,{slots:n,currentIndex:i}))}function ts(t){const{wrapperRef:n,containerRef:a,minimizedChildRef:i,maximizedChildRef:o}=Hr();return t.isOpen?e.jsxs("div",{ref:n,style:{height:"100000px"},children:[e.jsx(Zr,Object.assign({},t)),e.jsx(as,Object.assign({},t,{containerRef:a,minimizedChildRef:i,maximizedChildRef:o}))]}):null}const ns=o.css`
|
|
58
58
|
display: flex;
|
|
59
59
|
position: relative;
|
|
60
60
|
overflow: hidden;
|
|
@@ -62,7 +62,17 @@
|
|
|
62
62
|
> * {
|
|
63
63
|
position: absolute !important;
|
|
64
64
|
}
|
|
65
|
-
`,Yr=t.forwardRef((function({schema:n,testId:a,slots:o,currentIndex:r,minimizedChildRef:s,containerRef:l,maximizedChildRef:c}){var d,u;const p=t.useRef(null),f=t.useRef(null),y=t.useRef(!0),m=n.styles?i.mergeRight(Hr,n.styles):Hr,h=ft(),v=()=>{const e=f.current;if(!e)return 0;return Array.from(e.children).reduce(((e,t)=>Math.max(e,t.clientHeight)),0)};t.useEffect((()=>{const e=new ResizeObserver((()=>{(()=>{const e=f.current;if(!e)return;const t=v();e.style.height=`${t}px`})(),y.current&&(()=>{const e=v(),t=p.current;t&&(y.current=!1,t.style.setProperty("transform",`translateY(${e}px)`),requestAnimationFrame((()=>{t.style.transition="transform 0.8s",t.style.setProperty("transform","translateY(0px)")})))})()}));return f.current&&Array.from(f.current.children).forEach((t=>{e.observe(t)})),()=>{e.disconnect()}}),[]);const g=null===(u=null===(d=o[r])||void 0===d?void 0:d.offer)||void 0===u?void 0:u.creative,b=null==g?void 0:g.copy,E=Pt(b||{})(yi.transformLinksToAnchorText(null==g?void 0:g.links),"creativeLink");return e.jsx(ba,{styles:m,children:({classnames:i})=>{var o;return e.jsxs("div",{style:{width:"100%",position:"absolute",bottom:"-1000px",zIndex:"9999"},ref:l,children:[e.jsx("div",{style:{zIndex:"3",width:"100%",maxHeight:"0%",transitionTimingFunction:"cubic-bezier(0.05, 0.7, 0.1, 1.0)"},ref:p,children:e.jsxs("div",{className:null==i?void 0:i.own,style:{height:"100%",position:"relative",outline:"none",borderBottomLeftRadius:"0",borderBottomRightRadius:"0",border:"1px solid #D5D7DA",borderBottom:"none",margin:"0px -1px"},ref:l,tabIndex:-1,"data-testid":a&&`${a}-container`,"data-e2e":"BottomSheet-Container",children:[e.jsx(qr,{}),e.jsx("div",{ref:f,className:Kr,"aria-label":null!==(o=n.a11yLabel)&&void 0!==o?o:void 0,children:t.Children.toArray([e.jsx("div",{ref:c,style:{width:"100%"},children:h(n.children[0],void 0,G(0,a))},"0"),e.jsx(Ft,{value:E,children:e.jsx(wn,{value:In(g),children:e.jsx("div",{ref:s,style:{width:"100%"},children:b&&e.jsx("div",{children:h(n.children[1],void 0,G(1,a))})},"1")})})])})]})}),e.jsx("div",{style:{width:"100%",height:"1000px",backgroundColor:"white"}})]})}})}));function*Zr(){(yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex})))===(yield r.select((e=>{var t;return(null===(t=e.slots)||void 0===t?void 0:t.length)||1})))-1&&(yield r.put({type:W,payload:{key:"Minimized",value:1}}))}$r(Wr);const Qr={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var Xr;function es({isOpen:n,schema:o,testId:r,children:s}){const l=ae(),c=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),d=a.useSelector((e=>e.active.has(qi))),u=a.useDispatch();t.useEffect((()=>{c&&u({type:q,payload:{name:"SignalActivation",parentGuid:c}})}),[c]),t.useEffect((()=>{d&&requestAnimationFrame((()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}))}),[d]);const p=En(),{tabIndex:f,isDisabled:y,styles:m}=h(p),v=o.styles?i.mergeRight(Qr,o.styles):Qr;if(!n)return null;const g=e.jsx(pt,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(ba,{styles:v,children:({classnames:t})=>{var n;return e.jsx("div",{className:null==t?void 0:t.wrapper,style:Object.assign({height:"10000px",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9999",display:"flex",overflow:"auto",flexDirection:"column",justifyContent:"flex-end"},m),"aria-label":null!==(n=o.a11yLabel)&&void 0!==n?n:void 0,"aria-hidden":y,role:"dialog","aria-modal":!0,tabIndex:f,"data-testid":r,"data-e2e":"Overlay-Wrapper",children:s(g,l)})}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(Xr||(Xr={}));const ts={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const ns=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(ts,t.styles):ts;return e.jsx(ba,{styles:r,children:({classnames:i})=>{var r;return e.jsx("div",{className:null==i?void 0:i.own,style:{position:"relative",zIndex:"3",outline:"none",alignSelf:"center"},ref:o,tabIndex:-1,"data-e2e":"Overlay-Container","aria-label":null!==(r=t.a11yLabel)&&void 0!==r?r:void 0,role:"dialog","aria-modal":!0,"data-testid":n&&`${n}-container`,children:a})}})}));const as=a.connect((function(e){return{isOpen:e.active.has(zi)}}))((function(t){return e.jsx(es,Object.assign({},t,{children:(n,a)=>e.jsx(ns,Object.assign({},t,{ref:a,children:n}))}))})),is=$r(Wr),os={name:"minimized-bottomsheet-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",Zr)])},componentFactory:t=>"Overlay"===t.type?e.jsx(as,{schema:t}):function(e){const t=e.children instanceof Array;return t}(t)?e.jsx(is,{schema:t}):e.jsx("div",{children:"Could not Render Bottom Sheet"})};const rs=o.css`
|
|
65
|
+
`,as=t.forwardRef((function({schema:n,testId:a,slots:o,currentIndex:r,minimizedChildRef:s,containerRef:l,maximizedChildRef:c}){var d,u;const p=t.useRef(null),f=t.useRef(null),y=t.useRef(!0),h=n.styles?i.mergeRight(Xr,n.styles):Xr,m=ht(),v=()=>{const e=f.current;if(!e)return 0;return Array.from(e.children).reduce(((e,t)=>Math.max(e,t.clientHeight)),0)};t.useEffect((()=>{const e=new ResizeObserver((()=>{(()=>{const e=f.current;if(!e)return;const t=v();e.style.height=`${t}px`})(),y.current&&(()=>{const e=v(),t=p.current;t&&(y.current=!1,t.style.setProperty("transform",`translateY(${e}px)`),requestAnimationFrame((()=>{t.style.transition="transform 0.8s",t.style.setProperty("transform","translateY(0px)")})))})()}));return f.current&&Array.from(f.current.children).forEach((t=>{e.observe(t)})),()=>{e.disconnect()}}),[]);const g=null===(u=null===(d=o[r])||void 0===d?void 0:d.offer)||void 0===u?void 0:u.creative,b=null==g?void 0:g.copy,E=$t(b||{})(mi.transformLinksToAnchorText(null==g?void 0:g.links),"creativeLink");return e.jsx(ba,{styles:h,children:({classnames:i})=>{var o;return e.jsxs("div",{style:{width:"100%",position:"absolute",bottom:"-1000px",zIndex:"9999"},ref:l,children:[e.jsx("div",{style:{zIndex:"3",width:"100%",maxHeight:"0%",transitionTimingFunction:"cubic-bezier(0.05, 0.7, 0.1, 1.0)"},ref:p,children:e.jsxs("div",{className:null==i?void 0:i.own,style:{height:"100%",position:"relative",outline:"none",borderBottomLeftRadius:"0",borderBottomRightRadius:"0",border:"1px solid #D5D7DA",borderBottom:"none",margin:"0px -1px"},ref:l,tabIndex:-1,"data-testid":a&&`${a}-container`,"data-e2e":"BottomSheet-Container",children:[e.jsx(Qr,{}),e.jsx("div",{ref:f,className:ns,"aria-label":null!==(o=n.a11yLabel)&&void 0!==o?o:void 0,children:t.Children.toArray([e.jsx("div",{ref:c,style:{width:"100%"},children:m(n.children[0],void 0,F(0,a))},"0"),e.jsx(Bt,{value:E,children:e.jsx(An,{value:Sn(g),children:e.jsx("div",{ref:s,style:{width:"100%"},children:b&&e.jsx("div",{children:m(n.children[1],void 0,F(1,a))})},"1")})})])})]})}),e.jsx("div",{style:{width:"100%",height:"1000px",backgroundColor:"white"}})]})}})}));function*is(){(yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex})))===(yield r.select((e=>{var t;return(null===(t=e.slots)||void 0===t?void 0:t.length)||1})))-1&&(yield r.put({type:J,payload:{key:"Minimized",value:1}}))}Ur(es);const os={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var rs;function ss({isOpen:n,schema:o,testId:r,children:s}){const l=oe(),c=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),d=a.useSelector((e=>e.active.has(Ji))),u=a.useDispatch();t.useEffect((()=>{c&&u({type:H,payload:{name:"SignalActivation",parentGuid:c}})}),[c]),t.useEffect((()=>{d&&requestAnimationFrame((()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}))}),[d]);const p=xn(),{tabIndex:f,isDisabled:y,styles:h}=m(p),v=o.styles?i.mergeRight(os,o.styles):os;if(!n)return null;const g=e.jsx(yt,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(ba,{styles:v,children:({classnames:t})=>{var n;return e.jsx("div",{className:null==t?void 0:t.wrapper,style:Object.assign({height:"10000px",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9999",display:"flex",overflow:"auto",flexDirection:"column",justifyContent:"flex-end"},h),"aria-label":null!==(n=o.a11yLabel)&&void 0!==n?n:void 0,"aria-hidden":y,role:"dialog","aria-modal":!0,tabIndex:f,"data-testid":r,"data-e2e":"Overlay-Wrapper",children:s(g,l)})}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(rs||(rs={}));const ls={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const cs=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(ls,t.styles):ls;return e.jsx(ba,{styles:r,children:({classnames:i})=>{var r;return e.jsx("div",{className:null==i?void 0:i.own,style:{position:"relative",zIndex:"3",outline:"none",alignSelf:"center"},ref:o,tabIndex:-1,"data-e2e":"Overlay-Container","aria-label":null!==(r=t.a11yLabel)&&void 0!==r?r:void 0,role:"dialog","aria-modal":!0,"data-testid":n&&`${n}-container`,children:a})}})}));const ds=a.connect((function(e){return{isOpen:e.active.has(Wi)}}))((function(t){return e.jsx(ss,Object.assign({},t,{children:(n,a)=>e.jsx(cs,Object.assign({},t,{ref:a,children:n}))}))})),us=Ur(es),ps={name:"minimized-bottomsheet-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",is)])},componentFactory:t=>"Overlay"===t.type?e.jsx(ds,{schema:t}):function(e){const t=e.children instanceof Array;return t}(t)?e.jsx(us,{schema:t}):e.jsx("div",{children:"Could not Render Bottom Sheet"})};const fs=a.connect((function(e,{schema:t}){var n,a,i;const o=t.startPosition||1;if((null===(n=e.progression)||void 0===n?void 0:n.totalCount)&&(null===(a=e.progression)||void 0===a?void 0:a.groupSize)){const t=(r=e.progression.totalCount,(s=e.progression.groupSize)<=0||r<=0||s>r?0:Math.ceil(r/s));let n;n=o>0?o-1:t+o>-1?t+o:0;return{numOfIndicators:t-n>-1?t-n:0,activeIndex:null!==(i=e.progression.currentGroupIndex)&&void 0!==i?i:0,startIndex:n}}var r,s;return{numOfIndicators:0,activeIndex:0,startIndex:0}})),ys=t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"37",height:"29",viewBox:"0 0 37 29",fill:"inherit",style:{maxWidth:"44px",maxHeight:"32px",width:"100%",height:"100%"}},t.createElement("path",{d:"M5.62263 14.7123L5.48251 5.86667L11.3433 4.79804L11.3655 6.53531L7.57989 7.22555L7.61586 9.03828L11.0283 8.41606L11.0513 10.1575L7.63884 10.7797L7.69779 14.3339L5.62263 14.7123ZM17.5824 3.66043L19.6534 3.28282L19.745 8.98818C19.7555 9.64756 19.6126 10.2497 19.3164 10.7947C19.0224 11.3363 18.6042 11.7908 18.0619 12.1583C17.5191 12.5229 16.8858 12.7712 16.1619 12.9032C15.4352 13.0357 14.7983 13.019 14.2512 12.8531C13.7035 12.6844 13.2748 12.3843 12.9651 11.9527C12.6549 11.5184 12.4931 10.9717 12.4799 10.3129L12.3882 4.60752L14.4634 4.22914L14.5473 9.74965C14.5538 10.0546 14.6243 10.3146 14.7588 10.5298C14.8957 10.7416 15.0825 10.8952 15.3194 10.9907C15.5557 11.0833 15.8276 11.1016 16.135 11.0455C16.4453 10.989 16.717 10.8716 16.9501 10.6933C17.1828 10.5123 17.3621 10.2919 17.488 10.0321C17.6134 9.76959 17.6728 9.48585 17.6663 9.18094L17.5824 3.66043ZM28.2611 1.71333L28.4012 10.5589L26.6405 10.88L23.1503 6.39639L23.0916 6.40709L23.1693 11.5129L21.0941 11.8913L20.954 3.04567L22.7399 2.72004L26.2075 7.19908L26.2788 7.18608L26.1901 2.09094L28.2611 1.71333ZM4.24231 28.1783L4.10219 19.3327L9.96295 18.2641L9.98516 20.0013L6.19957 20.6916L6.23554 22.5043L9.64803 21.8821L9.67101 23.6235L6.25852 24.2457L6.31747 27.7999L4.24231 28.1783ZM11.933 26.776L9.70271 27.1827L12.4594 17.8089L15.2221 17.3051L18.2591 25.6225L16.0288 26.0292L13.9145 19.7787L13.8474 19.7909L11.933 26.776ZM11.5852 23.3481L16.247 22.4981L16.2661 24.1233L11.6043 24.9733L11.5852 23.3481ZM26.4764 18.4671L24.4054 18.8447C24.3768 18.6247 24.3205 18.4343 24.2363 18.2735C24.1516 18.1099 24.0407 17.9771 23.9037 17.875C23.7662 17.7701 23.6063 17.7011 23.4241 17.6679C23.2419 17.6347 23.0376 17.6387 22.8113 17.68C22.3781 17.759 22.005 17.9382 21.6921 18.2176C21.3792 18.497 21.1409 18.861 20.9772 19.3096C20.8136 19.7581 20.7359 20.2747 20.7444 20.8594C20.7576 21.423 20.8423 21.8797 20.9985 22.2295C21.1575 22.5788 21.3782 22.823 21.6605 22.9621C21.9424 23.0985 22.2748 23.1317 22.6577 23.0619C22.9064 23.0165 23.1316 22.9451 23.3333 22.8477C23.5373 22.747 23.7155 22.6235 23.8679 22.4774C24.0203 22.3312 24.1446 22.1656 24.2408 21.9805C24.3393 21.7922 24.4051 21.591 24.4383 21.3771L26.5261 20.9964C26.4914 21.3926 26.3895 21.7996 26.2202 22.2174C26.0532 22.6319 25.8184 23.0227 25.5157 23.3898C25.213 23.7568 24.842 24.0743 24.4028 24.342C23.9636 24.6098 23.4548 24.7965 22.8762 24.902C22.0853 25.0462 21.371 24.993 20.7333 24.7426C20.0985 24.4916 19.5925 24.0525 19.2153 23.4253C18.8405 22.7948 18.6436 21.9846 18.6249 20.9947C18.6089 20.0359 18.7692 19.1967 19.1057 18.4769C19.4451 17.7566 19.9106 17.1736 20.5022 16.7279C21.0965 16.2817 21.764 15.991 22.5047 15.856C23.0413 15.7581 23.5366 15.7429 23.9907 15.8103C24.4471 15.8743 24.8501 16.0174 25.1996 16.2396C25.5486 16.459 25.8322 16.7552 26.0504 17.1284C26.2714 17.501 26.4134 17.9473 26.4764 18.4671ZM27.362 16.8329L27.3398 15.0956L34.5966 13.7725L34.6188 15.5097L32.0154 15.9844L32.1333 23.0928L30.0875 23.4658L29.9696 16.3575L27.362 16.8329Z",fill:"inherit"})),hs="FunFactMode";function ms({activeIndex:e,startIndex:n,numOfIndicators:i,schema:o,slots:r}){var s,l,c;const d=xn(),u=a.useDispatch(),{tabIndex:p,styles:f,isDisabled:y}=m(d),h=Array(i+1).fill(o.indicator),[v,g]=t.useState(new Set([n])),[b,E]=t.useState(!1),I=pt(0,(e=>e.customStates[hs])),x=t.useCallback((e=>v.has(e)||v.has(e-1)),[v]);t.useEffect((()=>{g((t=>new Set([...t,e])))}),[e,I]),t.useEffect((()=>{I&&E(!0)}),[I]);const S=()=>{u({type:J,payload:{key:hs,value:1}})},w=null===(l=null===(s=r[e])||void 0===s?void 0:s.offer)||void 0===l?void 0:l.creative,C=null===(c=null==w?void 0:w.images.creativeImage)||void 0===c?void 0:c.light;return i>0&&(A=i+n+1,(O=e)>=n&&O<=A)?t.createElement(Mt,null,(a=>t.createElement(ba,{styles:o.styles},(o=>{var r;const s=o.classnames,l=t=>{var n,a,o,r;return t===i&&I?`${null==s?void 0:s.indicator} ${null!==(n=null==s?void 0:s.activeIndicator)&&void 0!==n?n:""}`:t!==e||I?v.has(t)||t===i&&b?`${null==s?void 0:s.indicator} ${null!==(o=null==s?void 0:s.seenIndicator)&&void 0!==o?o:""}`:t==e+1?`${null==s?void 0:s.indicator} ${null!==(r=null==s?void 0:s.clickableIndicator)&&void 0!==r?r:""}`:`${null==s?void 0:s.indicator}`:`${null==s?void 0:s.indicator} ${null!==(a=null==s?void 0:s.activeIndicator)&&void 0!==a?a:""}`};return t.createElement("div",{className:null!==(r=null==s?void 0:s.own)&&void 0!==r?r:"",style:Object.assign({display:"flex",flexDirection:"row",gap:"8px"},f),"data-e2e":"ProgressIndicator",tabIndex:p,"aria-hidden":y},t.Children.toArray(h.map(((o,r)=>{return r===i?t.createElement("button",{onClick:b||e==i-1?S:void 0,className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",fill:I?"#101828":"#A3A3A3",cursor:b||e==i-1?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(o),t.createElement("div",{style:{marginTop:"3px",marginLeft:"2px"},"data-testid":"fun-fact-icon"},ys)):r!==e||I?t.createElement("button",{onClick:(s=r,()=>{x(s)&&(u({type:"PROGRESSION/INITIALISE",payload:{totalCount:i,currentGroupIndex:s,groupSize:1}}),I&&u({type:J,payload:{key:hs,value:0}}))}),className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",cursor:x(r)?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(""),t.createElement("div",{style:{fontSize:"30px",fontWeight:"700",lineHeight:"38px",display:"inline-block"}},`${r+1}`)):t.createElement("button",{className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",cursor:x(r)?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(""),C?t.createElement("img",{src:C,style:{marginTop:"3px"}}):t.createElement("div",{style:{fontSize:"30px",fontWeight:"700",lineHeight:"38px",display:"inline-block"}},`${r+1}`));var s}))))})))):null;var O,A}const vs=fs(((e,n)=>{const i=a.useSelector((e=>e.slots)),o=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0}));return t.createElement(ms,Object.assign({},e,{slots:i,currentIndex:o,partnerColor:n}))})),gs=({children:e,partnerColor:n,schema:a})=>{var i;const r=ht(),s=t.useMemo((()=>Math.random()),[]),l=$t((null!==(i=bs[Math.floor(s*bs.length)])&&void 0!==i?i:{text:"",header:""})||{},"funfact"),c=o.css`
|
|
66
|
+
display: inline;
|
|
67
|
+
margin: 8px 16px;
|
|
68
|
+
p {
|
|
69
|
+
display: inline !important;
|
|
70
|
+
}
|
|
71
|
+
`,d=o.css`
|
|
72
|
+
font-size: 24px;
|
|
73
|
+
font-weight: 600;
|
|
74
|
+
color: ${n};
|
|
75
|
+
`;return t.createElement(Bt,{value:l},t.createElement(ba,{styles:a.styles},(n=>{const a=n.classnames;return t.createElement(t.Fragment,null,t.Children.toArray(null==e?void 0:e.map(((e,n)=>t.createElement("div",{className:`${c} ${null==a?void 0:a.own}`},0===n?t.createElement(t.Fragment,null,t.createElement("p",{className:`${d} ${null==a?void 0:a.own}`},"Did you know...")," ",t.createElement("span",{className:`${null==a?void 0:a.own}`},r(e))):t.createElement("span",{className:`${null==a?void 0:a.own}`},r(e)))))))})))},bs=[{header:"the Eiffel Tower can grow taller in summer?",text:"The heat causes the metal to expand, adding up to six inches to its height."},{header:"flamingos aren't born pink?",text:"Their feathers turn pink from eating shrimp and algae rich in carotenoids."},{header:"bananas are berries, but strawberries aren't?",text:"Botanically, strawberries are aggregate fruits, while bananas meet all the criteria for a true berry."},{header:"a day on Venus is longer than a year on Venus?",text:"It takes Venus 243 Earth days to rotate once but only 225 Earth days to orbit the Sun."},{header:"sea cucumbers can eject their guts when threatened?",text:"This defense mechanism helps them escape predators and they regenerate the lost organs later."},{header:"prunes used to be said instead of cheese for photos?",text:'In the 1840s, people said "prunes" to maintain a tight-lipped expression instead of smiling.'},{header:"some frogs can freeze solid and survive?",text:"Species like wood frogs produce special proteins that prevent ice from damaging their cells."},{header:"Venus is the only planet that spins clockwise?",text:"Its unusual rotation direction makes it stand out among other planets in our solar system."},{header:"cats have 230 bones while humans have only 206?",text:"Their extra bones make them incredibly flexible jumpers and climbers."},{header:"the Statue of Liberty once functioned as a lighthouse?",text:"From 1886 to 1902, its light could be seen up to 24 miles away."},{header:"the first commercial flight lasted just 23 minutes?",text:"It flew between St. Petersburg and Tampa, Florida, in 1914."},{header:"octopuses have blue blood and nine brains?",text:"Their unique blood helps them survive in low-oxygen environments, and each arm has its own mini-brain."},{header:"hummingbirds can fly backward?",text:"They're the only birds capable of this agile movement thanks to their unique wing structure."},{header:"gorillas burp when they're happy?",text:"It's one of their ways of expressing contentment and relaxation."},{header:"Australia is wider than the Moon?",text:"Australia spans about 2,485 miles across, while the Moon's diameter is only about 2,159 miles."},{header:"ants can carry up to 50 times their body weight?",text:"These tiny insects are incredibly strong for their size due to their muscle structure."},{header:"lightning is five times hotter than the surface of the Sun?",text:"A single bolt can reach temperatures of up to 50,000 degrees Fahrenheit."},{header:"sharks are the only fish that can blink with both eyes?",text:"They have an extra eyelid called a nictitating membrane for protection during attacks or feeding."},{header:"octopuses have three hearts?",text:"Two pump blood to the gills, while the third pumps it to the rest of the body—and it stops beating when they swim."},{header:"a group of flamingos is called a flamboyance?",text:"Their bright pink color and synchronized movements make this name quite fitting."},{header:"honey never spoils?",text:"Archaeologists have found pots of honey in ancient Egyptian tombs that are still edible."},{header:"cats can't taste sweetness?",text:"Their taste buds lack the receptors for sugary flavors, which might explain their disinterest in desserts."},{header:"a crocodile can't stick out its tongue?",text:"A special membrane holds their tongue in place, helping them swallow prey underwater."},{header:"sea otters hold hands while they sleep?",text:"This keeps them from drifting apart in the water, especially when they're napping in groups."},{header:"bananas glow blue under black light?",text:"This happens because of the way their peel breaks down as they ripen."},{header:"a watermelon is 92% water?",text:"That's why it's such a refreshing snack on a hot day!"},{header:"butterflies taste with their feet?",text:"Their taste sensors are located on their legs, helping them identify suitable plants for laying eggs."},{header:"an ostrich's eye is bigger than its brain?",text:"This might explain why these birds rely more on instinct than intelligence."},{header:"kangaroos can't walk backward?",text:"Their muscular tails and body structure make this movement impossible."},{header:"avocados are fruits, not vegetables?",text:"They're technically berries because of their fleshy pulp and single seed."},{header:"dolphins have names for each other?",text:"They use unique whistles to identify and call out to specific individuals in their pods."},{header:'the Hollywood sign originally said "Hollywoodland"?',text:"It was installed in 1923 as an advertisement for a real estate development."},{header:"giraffe tongues can be up to 20 inches long?",text:"Their dark color helps protect them from sunburn while reaching for leaves."},{header:"M&M's were the first candy eaten in space?",text:"Astronauts love them because they don't crumble and create messes in zero gravity."},{header:"starfish don't have brains?",text:"They rely on a simple nervous system to sense their surroundings and move around."},{header:"peanuts are legumes, not nuts?",text:"They grow underground like beans and peas, making them part of the legume family."},{header:"the shortest war in history lasted only 38 minutes?",text:"It was between Britain and Zanzibar on August 27, 1896."},{header:"clouds can weigh over a million pounds?",text:"Despite their massive weight, the water droplets are spread out enough to float in the air!"}];function*Es(){(yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex})))===(yield r.select((e=>{var t;return(null===(t=e.slots)||void 0===t?void 0:t.length)||1})))-1&&(yield r.put({type:J,payload:{key:"FunFactMode",value:1}}))}const Is={name:"logo-clickable-progression-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",Es)])},componentFactory:e=>e?"fun-fact"===e.variant?t.createElement(gs,{partnerColor:e.partnerColor,schema:e},e.children):t.createElement(vs,{schema:Object.assign(Object.assign({},e),{indicator:""}),partnerColor:e.partnerColor}):t.createElement("div",null,"Could not render Logo Clickable Progression"),interceptors:{}};const xs=o.css`
|
|
66
76
|
height: 20px;
|
|
67
77
|
border-radius: 4px;
|
|
68
78
|
width: 100%;
|
|
@@ -71,41 +81,41 @@
|
|
|
71
81
|
background-size: 200% 100%;
|
|
72
82
|
animation: 1.5s ${o.keyframes`to { background-position-x: -200%; }`} linear
|
|
73
83
|
infinite;
|
|
74
|
-
`,
|
|
84
|
+
`,Ss=o.css`
|
|
75
85
|
width: 75%;
|
|
76
|
-
`,
|
|
86
|
+
`,ws=o.css`
|
|
77
87
|
height: 40px;
|
|
78
88
|
width: 200px;
|
|
79
|
-
`,
|
|
89
|
+
`,Cs=o.css`
|
|
80
90
|
width: 150px;
|
|
81
|
-
`;function
|
|
91
|
+
`;function Os({hasLoaded:e,animationSpeedMS:n,styles:a}){const[i,r]=t.useState(!0);return t.useEffect((()=>{if(e){const e=setTimeout((()=>{r(!1)}),n);return()=>clearTimeout(e)}return()=>null}),[e]),i?t.createElement("div",{"data-testid":"skeleton",className:o.css(Object.assign({height:"100%"},null==a?void 0:a.skeleton))},t.createElement("div",{className:o.css`
|
|
82
92
|
padding: 30px 24px;
|
|
83
93
|
display: flex;
|
|
84
94
|
flex-direction: column;
|
|
85
95
|
gap: 16px;
|
|
86
96
|
height: inherit;
|
|
87
97
|
justify-content: center;
|
|
88
|
-
`},t.createElement("div",{className:
|
|
98
|
+
`},t.createElement("div",{className:xs}),t.createElement("div",{className:xs}),t.createElement("div",{className:xs}),t.createElement("div",{className:o.cx(xs,Ss)}),t.createElement("div",{className:o.css`
|
|
89
99
|
display: flex;
|
|
90
100
|
gap: 16px;
|
|
91
101
|
align-items: center;
|
|
92
|
-
`},t.createElement("div",{className:o.cx(
|
|
102
|
+
`},t.createElement("div",{className:o.cx(xs,ws)}),t.createElement("div",{className:o.cx(xs,Cs)})))):null}function As({styles:e,hasLoaded:n,partnerText:a,animationSpeedMS:i}){if(!Array.isArray(a)||!(null==a?void 0:a.length))throw new Error("partnerText must be an string[]");const[r,s]=t.useState(!0);return t.useEffect((()=>{if(n){const e=setTimeout((()=>{s(!1)}),i);return()=>clearTimeout(e)}return()=>null}),[n]),r?t.createElement("div",{"data-testid":"partner-text",className:o.css(Object.assign({height:"100%",width:"100%",display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"center",opacity:n?0:1,transition:`opacity ${i}ms ease-in-out`},null==e?void 0:e.partnerText))},a?t.Children.toArray(a.map((e=>t.createElement("p",{className:o.css`
|
|
93
103
|
font-weight: 600;
|
|
94
104
|
font-size: 14px;
|
|
95
105
|
line-height: 21px;
|
|
96
106
|
padding: 0 16px;
|
|
97
|
-
`},e)))):null):null}const
|
|
107
|
+
`},e)))):null):null}const Ts=o.keyframes`
|
|
98
108
|
0% { width: 0; }
|
|
99
109
|
100% { width: 100%; }
|
|
100
|
-
}`;function
|
|
110
|
+
}`;function Rs(e){const[n,i]=t.useState(!1),[r,s]=t.useState(!1),l=a.useDispatch(),c=ht(),{type:d,children:u,durationMS:p,styles:f,partnerText:y,animationSpeedMS:h}=e.data;let m=null;switch(d){case"skeleton":m=t.createElement(Os,{hasLoaded:n,animationSpeedMS:h,styles:f});break;case"partnerText":m=t.createElement(As,{partnerText:y,hasLoaded:n,animationSpeedMS:h,styles:f})}return t.useEffect((()=>{let e=null;const t=setTimeout((()=>{i(!0),e=setTimeout((()=>{s(!0)}),h)}),1.25*p);return()=>{t&&clearTimeout(t),e&&clearTimeout(e)}}),[p,l]),t.createElement("div",{"data-testid":"Loading"},t.createElement("div",{className:o.css`
|
|
101
111
|
position: relative;
|
|
102
112
|
`},t.createElement("div",{className:o.css`
|
|
103
113
|
height: 4px;
|
|
104
114
|
background-color: ${(null==f?void 0:f.primaryColor)||"#7F56D9"};
|
|
105
115
|
position: absolute;
|
|
106
116
|
top: 0;
|
|
107
|
-
animation: ${
|
|
108
|
-
transition: opacity ${
|
|
117
|
+
animation: ${Ts} ${p}ms linear forwards;
|
|
118
|
+
transition: opacity ${h}ms ease-in-out;
|
|
109
119
|
opacity: ${n?0:1};
|
|
110
120
|
`}),t.createElement("div",{className:o.css`
|
|
111
121
|
position: relative;
|
|
@@ -117,13 +127,13 @@
|
|
|
117
127
|
bottom: 0;
|
|
118
128
|
z-index: 20;
|
|
119
129
|
border-width: 2px;
|
|
120
|
-
transition: border-color ${
|
|
130
|
+
transition: border-color ${h}ms ease-in-out;
|
|
121
131
|
${r?"\n border-color: transparent;\n user-select: none;\n pointer-events: none;\n ":`\n border-color: ${n?(null==f?void 0:f.primaryColor)||"#7F56D9":"transparent"};\n `}
|
|
122
|
-
`},
|
|
132
|
+
`},m),t.createElement("div",{"data-testid":"slots",className:o.css`
|
|
123
133
|
z-index: 10;
|
|
124
|
-
transition: opacity ${
|
|
134
|
+
transition: opacity ${h}ms ease-in-out;
|
|
125
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 "}
|
|
126
|
-
`},t.Children.toArray(u.map((e=>c(e))))))))}const ys={name:"loading-extension",componentFactory:e=>t.createElement(fs,{data:e}),interceptors:{}},ms=1e3;function hs(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()/ms,o=t.useRef(null),r=()=>{const t=(new Date).getTime()/ms;a(Math.max(Math.floor(e-(t-i)),0))};return t.useEffect((()=>(o.current=setInterval(r,ms),()=>{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,ms)}}}((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:q,payload:{name:"SignalUserInteraction",action:"TimerExpired",context:"TimerProgression"}}),d({type:"PROGRESSION/PROCESS",payload:{offerProcessStatus:"CONTINUE"}}))}),[o,r]);const u=En(),{tabIndex:p,styles:f,isDisabled:y}=h(u);return t.createElement("p",{tabIndex:p,style:Object.assign(Object.assign({},null==n?void 0:n.styles),f),"aria-hidden":y,"data-e2e":"Timer"},`${o}:${r}`)}const vs={name:"timer-progression-extension",componentFactory:e=>t.createElement(hs,{data:e}),interceptors:{}},gs="MODULE/ADD_LOADED",bs="MODULE/LOAD",Es="PROGRESSION/INITIALISE",Is="PROGRESSION/NEXT",Ss="PROGRESSION/PREV",xs="PROGRESSION/UPDATE_GROUP_SIZE",Os="PROGRESSION/PROCESS",ws="SLOTS/SET",Cs="INSTANT_PURCHASE/DISMISS",As="OFFER_LIFECYCLE",Ts="DOMAIN_STATES/SET",js="OFFER_ENGAGEMENT",Rs="GLOBAL_OFFER_DATA_STATE/SET_CART",Ns=Object.assign(Object.assign({},Ui),{NEXT_IN_PROGRESSION:Is,PREV_IN_PROGRESSION:Ss,INITIALISE_PROGRESSION:Es,UPDATE_GROUP_SIZE:xs,SET_SLOTS:ws,ADD_LOADED_MODULE:gs,SET_DOMAIN_STATE:Ts,SET_GLOBAL_OFFER_DATA_CART:Rs}),_s=Object.assign(Object.assign({},Vi),{LOAD_MODULES:bs,DISMISS_INSTANT_PURCHASE:Cs,PROCESS_PROGRESSION:Os,OFFER_LIFECYCLE:As,OFFER_ENGAGEMENT:js,SET_PARTNER_VALIDATION_STATUS:Z});function Ds(e,t){return t<=0||e<=0||t>e?0:Math.ceil(e/t)}function ks(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<Ds(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 Ps=Symbol("root");function Ls(){return{[Ps]:{}}}const $s=Object.assign({progression:function(e=null,t){switch(t.type){case Es:if(function(e){const{totalCount:t,currentGroupIndex:n,groupSize:a}=e;return t>=0&&a>=0&&n>=0&&a<=t&&n<Ds(t,a)}(t.payload)){const{totalCount:e,_:n,groupSize:a}=t.payload;return Object.assign(Object.assign({},t.payload),{indexGroups:ks(e,a)})}return null;case xs:{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:ks(a,n),currentGroupIndex:0}):null}case Is:{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,Ds(t,n)-1)}):null}case Ss:{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===gs?Object.assign(Object.assign({},e),{loadedModules:[...e.loadedModules,t.payload]}):e},domainStates:function(e=Ls(),t){if(t.type===Ts){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:Ps;return n===Ps?e:Object.assign(Object.assign({},i.assocPath([n,t.payload.key],Number(t.payload.value),e)),{[Ps]:{}})}return e}return e},globalOfferDataState:function(e={},t){if(t.type===Rs){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}},Ho);function Gs(e={}){return Object.assign(Object.assign(Object.assign({},function(e={}){return Object.assign({layout:Po(),breakpoint:{breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},active:Lo(),fonts:[],signal:{queue:[],processed:[]},serializableCache:qo(),settings:{closeOnComplete:!0},customStates:{root:{}}},e)}(e)),{progression:null,slots:[],module:{loadedModules:[]},domainStates:Ls(),globalOfferDataState:{}}),e)}function Fs(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 Ms(e){return e.progression?{activeGroupIndex:e.progression.currentGroupIndex,totalOffers:e.progression.totalCount,totalGroups:Ds(e.progression.totalCount,e.progression.groupSize),isLast:Fs(e)}:null}function Bs(e,t){return e.domainStates[`module${t}`]||{offerComplete:0}}function Us(e){return Object.values(e.globalOfferDataState).reduce(((e,t)=>t.cart?e+t.cart.reduce(((e,t)=>e+t.quantity),0):e),0)}function Vs(t){const{config:n,position:i,visible:o,container:r,testId:s}=t,l=Dn(),c=En(),d=a.useSelector($o),u=`rokt-${n.layoutVariant.moduleName}-${l}`;return e.jsxs(e.Fragment,{children:[!o&&e.jsx("div",{style:{position:"absolute",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},"aria-hidden":"true"}),e.jsx(u,{style:{display:"flex",flexDirection:"column"===r?"column":"row",width:"100%"},slotInstanceGuid:n.instanceGuid,layoutSchema:JSON.stringify(n.layoutVariant.layoutVariantSchema),offerData:JSON.stringify(n.offer),offerPositionIndex:i,visible:o,container:r,interactivity:c,"data-testid":s,"data-e2e":`OfferSlot-${i}`,"aria-hidden":!o,"module-component":!0,"plugin-id":l,"active-breakpoint":$(d)})]})}function zs({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=En(),d=Ln(),{tabIndex:u,isDisabled:p,styles:f}=h(c);return r.length&&r[l]?e.jsx(ba,{styles:o,children:({classnames:a})=>e.jsx("div",{ref:s,"data-testid":i,"data-e2e":"OneByOneDistribution",className:null==a?void 0:a.own,tabIndex:u,"aria-hidden":p,style:Object.assign(Object.assign({position:"relative",transition:`height ${n.transition.settings.duration/2}ms ease-in-out`,overflow:"hidden",boxSizing:"content-box"},f),d),children:t.Children.toArray(r.map(((t,a)=>e.jsx(Ei,{effect:n.transition,visible:a===l,parentElement:s.current,children:e.jsx(Vs,{config:t,position:a,visible:a===l,container:"column"})}))))})}):null}const qs=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=Ds(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=En(),r=Ln(),{tabIndex:s,styles:l,isDisabled:c}=h(o),d=Array(a).fill(i.indicator);return a>0&&(p=a+n-1,(u=t)>=n&&u<=p)?e.jsx(Gt,{children:a=>e.jsx(ba,{styles:i.styles,children:i=>{var o;const u=i.classnames,p=e=>{var n,a;return e===t?`${null==u?void 0:u.indicator} ${(null==u?void 0:u.activeIndicator)?u.activeIndicator:null!==(n=null==u?void 0:u.seenIndicator)&&void 0!==n?n:""}`:e<t?`${null==u?void 0:u.indicator} ${null!==(a=null==u?void 0:u.seenIndicator)&&void 0!==a?a:""}`:null==u?void 0:u.indicator};return e.jsx("div",{className:null!==(o=null==u?void 0:u.own)&&void 0!==o?o:"",style:Object.assign(Object.assign({display:"flex",flexDirection:"row"},l),r),"data-e2e":"ProgressIndicator",tabIndex:s,"aria-hidden":c,children:y.Children.toArray(d.map(((t,i)=>e.jsx("span",{className:p(i+n),style:{display:"flex"},children:a({state:{indicatorPosition:String(i+1+n)}})(t)}))))})}})}):null;var u,p}));const Hs="partnerValidationUI",Ws="stackedViewableItems";function Js(n){var o;const r=a.useDispatch(),s=a.useSelector((e=>e.slots)),l=null!==(o=n.schema.viewableItems)&&void 0!==o?o:[],c=ca(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:Di,payload:{key:Ws,value:String(d)}})}),[d]);const u=s.slice(0,d),p=En(),f=Ln(),{tabIndex:y,isDisabled:m,styles:v}=h(p);return(null==u?void 0:u.length)>0?e.jsx(ba,{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":m,tabIndex:y,style:Object.assign(Object.assign({display:"flex",flexDirection:"column"},v),f),children:t.Children.toArray(u.map(((t,n)=>e.jsx(Vs,{config:t,position:n,visible:!0,container:"column"}))))})}):null}function Ks(n){const i=n.schema.styles,o=a.useDispatch(),r=En(),s=Ln(),l="Backward"===n.schema.direction?"Previous":"Next",{tabIndex:c,styles:d,isDisabled:u}=h(r),p=()=>{o({type:"Backward"===n.schema.direction?Ns.PREV_IN_PROGRESSION:Ns.NEXT_IN_PROGRESSION})};return e.jsx(ba,{styles:i,children:({classnames:a})=>{var i;return e.jsx("button",{title:l,className:null==a?void 0:a.own,onClick:p,"data-testid":n.testId,"data-e2e":"ProgressControl","data-e2e-direction":`${n.schema.direction}`,disabled:u,"aria-disabled":u,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:l,tabIndex:c,style:Object.assign(Object.assign({cursor:"pointer"},d),s),children:e.jsx(pt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}function Ys({schema:n,testId:i}){var o,r,s,l,c,u,p,f,y;const m=a.useSelector((e=>e.progression)),v=null==m?void 0:m.indexGroups[null==m?void 0:m.currentGroupIndex],g=null!==(o=null==m?void 0:m.currentGroupIndex)&&void 0!==o?o:0,b=a.useSelector((e=>e.slots)),E=a.useSelector(Bo),I=n.viewableItems.length-1,[S,x]=d({slidesToScroll:null!==(r=n.viewableItems[Math.min(E,I)])&&void 0!==r?r:"auto",containScroll:"trimSnaps"}),O=a.useDispatch(),w=En(),C=Ln(),{tabIndex:A,isDisabled:T,styles:j}=h(w),R=`${null!==(f=null===(p=null===(u=null===(c=null===(l=null===(s=n.styles)||void 0===s?void 0:s.elements)||void 0===l?void 0:l.own[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?O({type:Ns.NEXT_IN_PROGRESSION}):a<i&&O({type:Ns.PREV_IN_PROGRESSION}))}return null!=g&&(null==x||x.on("select",e),null==x||x.scrollTo(g)),()=>{null==x||x.off("select",e)}}),[x,g,O]);const N={overflow:"hidden"},_={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:R,alignItems:"stretch"},D=e=>{var t;return null!==(t=null==v?void 0:v.includes(e))&&void 0!==t&&t},k=n.peekThroughSize[Math.min(E,n.peekThroughSize.length-1)],P=k?"Fixed"===(L=k).type?`${L.value}px`:`${L.value}%`:"0px";var L;const $=null!==(y=n.viewableItems[Math.min(I,E)])&&void 0!==y?y:1,G={flex:`0 0 calc(${(e=>"0px"!==e&&"0%"!==e)(P)?`(100% - 2 * ${P} - (${$} + 1) * ${R})/${$}`:`(100% - (${$} - 1) * ${R})/${$}`})`,position:"relative",display:"flex",overflow:"auto"};return(null==b?void 0:b.length)>0?e.jsx(ba,{styles:n.styles,children:({classnames:n})=>e.jsx("div",{ref:S,style:Object.assign(Object.assign(Object.assign({},N),j),C),"aria-disabled":T,tabIndex:A,className:null==n?void 0:n.own,"data-e2e":"CarouselDistribution","data-testid":i&&`${i}`,children:e.jsx("div",{style:_,"data-testid":i&&`${i}-container`,"data-e2e":"CarouselDistribution-Container",children:t.Children.toArray(b.map(((t,n)=>e.jsx("div",{style:G,"data-testid":i&&`${i}-slide-${n}`,"data-e2e":`CarouselDistribution-Slide-${n}`,children:e.jsx(Vs,{config:t,position:n,container:"row",visible:D(n)})}))))})})}):null}function Zs({schema:n,testId:i}){const o=Dn(),r=t.useMemo((()=>nt(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=En(),p=Ln(),{tabIndex:f,isDisabled:y,styles:m}=h(u);return l.length?e.jsx(ba,{styles:n.styles,children:({classnames:a})=>e.jsx("div",{ref:c,"data-testid":i,"data-e2e":"GroupedDistribution","aria-disabled":y,tabIndex:f,style:Object.assign(Object.assign({position:"relative",transition:`height ${n.transition.settings.duration/2}ms ease-in-out`,overflow:"hidden",boxSizing:"content-box"},m),p),children:t.Children.toArray(l.map(((o,l)=>e.jsx(Ei,{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(Vs,{config:t,position:a,visible:l===d,container:"column",testId:i?`${i}-child${a}`:void 0})})))}))))})}):null}const Qs={action:{CaptureOnly:"CaptureOnly",Url:"Url",Fulfillment:"Fulfillment",External:"External"},urlBehavior:{newTab:"newTab",roktWebViewSDK:"roktWebViewSDK",self:"self"},signalType:{SignalResponse:"SignalResponse",SignalGatedResponse:"SignalGatedResponse",SignalSecondaryResponse:"SignalSecondaryResponse"}};function Xs(e,t,n=!1){return Error(`Could not translate ${e} with guid: ${t}${n?" for child layout":""}`)}function el(e,t=!1){var n;try{if(e.responseOptionsMap||t)return Object.assign(Object.assign({},e),{responseOptionsMap:i.mapObjIndexed(tl,null!==(n=e.responseOptionsMap)&&void 0!==n?n:{})});{const t=`Creative: ${e.instanceGuid}, did not receive a valid response options map.`;throw new A("NO_CREATIVE_RESPONSE_OPTIONS_MAP",t)}}catch(n){throw n.message?n:Xs("Creative",e.instanceGuid,t)}}function tl(e){try{let t;e.urlBehavior&&(t=Qs.urlBehavior[e.urlBehavior]);return Object.assign(Object.assign({},e),{urlBehavior:t,action:Qs.action[e.action],signalType:Qs.signalType[e.signalType]})}catch(t){throw t.message?t:Xs("CreativeResponse",e.instanceGuid)}}function nl(e,t,n){try{return JSON.parse(e)}catch(e){throw Error(`Parse JSON failed, invalid JSON file for ${t} with guid ${n}.`)}}function al(){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 il={OneByOneDistribution:function(t){if("OneByOneDistribution"===t.type)return e.jsx(zs,{schema:t.node})},StackedDistribution:function(t){if("StackedDistribution"===t.type)return e.jsx(Js,{schema:t.node})},ProgressIndicator:function(t){if("ProgressIndicator"===t.type)return e.jsx(qs,{schema:t.node})},ProgressControl:function(t){if("ProgressControl"===t.type)return e.jsx(Ks,{schema:t.node})},Overlay:function(t){if("Overlay"===t.type)return e.jsx(Qi,{schema:t.node})},CloseButton:function(t){if("CloseButton"===t.type)return e.jsx(Hi,{schema:t.node})},EscapeHatch:(ol=[function(t,n){if(v("CloseButton",t)){const n=JSON.parse(t.node.data);return e.jsx(Hi,{schema:n.node,action:n.action})}},ri],e=>ol.reduce(((t,n)=>void 0===t?n(e):t),void 0)),CarouselDistribution:function(t){if("CarouselDistribution"===t.type)return e.jsx(Ys,{schema:t.node})},GroupedDistribution:function(t){if("GroupedDistribution"===t.type)return e.jsx(Zs,{schema:t.node})},BottomSheet:function(t){if("BottomSheet"===t.type)return e.jsx(no,{schema:t.node})}};var ol;function rl(e,t){e({type:q,payload:{name:"SignalActivation",parentGuid:t}})}function sl({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:Ms(e),customStates:e.customStates.root,domainStates:e.domainStates[Ps]})),i.equals),y=a.useSelector((e=>e.slots.length)),m=a.useSelector((e=>{var t;const n=Number(null!==(t=e.serializableCache.get(Ws))&&void 0!==t?t:"");return y-n})),h=a.useSelector(Us);ne(ht(),p),t.useEffect((()=>(u&&document.body.addEventListener("click",rl.bind(null,p,u.instanceGuid),{once:!0}),()=>{u&&document.body.removeEventListener("click",rl.bind(null,p,u.instanceGuid))})),[null==u?void 0:u.instanceGuid]),al(),t.useEffect((()=>{if(u){const e={type:q,payload:{name:"SignalImpression",parentGuid:u.instanceGuid}},t={type:Mi,payload:{code:"LAYOUT_IMPRESSED"}};p(e),p(t)}}),[u]);const v=e=>{p({type:_s.REPORT_ERROR,payload:e})},g=a.useSelector((e=>e.breakpoint.initialised));if(u&&g){const t=Pt({})({state:{progression:(null!==(r=null===(o=f.progression)||void 0===o?void 0:o.activeGroupIndex)&&void 0!==r?r:0)+1,maxProgression:null!==(l=null===(s=f.progression)||void 0===s?void 0:s.totalGroups)&&void 0!==l?l:1,availableOffersCount:null!==(d=null===(c=f.progression)||void 0===c?void 0:c.totalGroups)&&void 0!==d?d:y,selectedCatalogItemQuantity:h,hiddenItemCount:m}}),a=fi(v);return e.jsx(Tn,{info:{layoutType:"OuterLayout",pageInstanceGuid:n},children:e.jsx(Ft,{value:t,children:e.jsx(yt,{value:a,overrides:il,children:e.jsx(ct.Provider,{value:f,children:e.jsx(st.Provider,{value:p,children:e.jsx(Vt.Provider,{value:"OUTER",children:e.jsx(pt,{children:e=>e(u.layoutSchema)})})})})})})})}return null}var ll=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":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}}}),cl=Object.assign({},ll);function*dl(e,t){const n=cl.getDistribution(t),a=null==n?void 0:n.type,i=yield r.select(Bo),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:Ns.INITIALISE_PROGRESSION,payload:{currentGroupIndex:0,totalCount:e,groupSize:o}}))}function*ul(e,t){const{instanceGuid:n,layoutSchemaVersion:a,outerLayoutSchema:o,slots:r}=t.payload;n?yield c.put({type:q,payload:{name:"SignalLoadComplete",parentGuid:n}}):yield c.put({type:Fi,payload:{level:so,code:xo,message:"Layout instance guid does not exist"}}),yield c.put({type:bs,payload:{modules:r.map((e=>e.layoutVariant.moduleName))}}),yield c.put({type:Ci,payload:o.breakpoints}),yield c.put({type:Ns.LAYOUT_UPDATE,payload:{instanceGuid:n,layoutSchemaVersion:a,layoutSchema:o.layout,settings:o.settings}}),yield c.put({type:Ns.SET_SLOTS,payload:r}),i.isNil(o.settings)||(yield c.put({type:Ns.SET_SETTINGS,payload:o.settings})),yield*dl(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,Xo.PartnerValidationEvent.OPT_IN_TO_PARTNER_VALIDATION),yield c.spawn(pl,e,Xo.PartnerValidationEvent.SHOW_PARTNER_VALIDATION_STATUS,(()=>({type:"ACTIVE/ADD",payload:{id:Hs}})))}catch(e){return yield c.put({type:Fi,payload:{level:ro,code:wo,message:"Failed to establish partner validation."}}),"FAILURE"}return"OK"}(e.partner,o.settings,r);"OK"===s&&(yield c.call(vr,e.display,o.display))}function*pl(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 fl(e){return Xl(e)}function yl(e,t){return Error(`Migration process from v0_0 to v0_1 failed: could not transform ${e} node. For more details: ${t}`)}const ml=i.all(i.anyPass([function(e){return"Row"===e.type&&bl(e.node.children)},function(e){return"Column"===e.type&&bl(e.node.children)},xl,Ol])),hl=i.all(i.anyPass([function(e){return"Row"===e.type&&El(e.node.children)},function(e){return"Column"===e.type&&El(e.node.children)},Ol,xl,function(e){return"DataImage"===e.type},function(e){return"When"===e.type&&El(e.node.children)}])),vl=i.all(i.anyPass([function(e){return"Row"===e.type&&Il(e.node.children)},function(e){return"Column"===e.type&&Il(e.node.children)},Ol,xl])),gl=i.all(i.anyPass([function(e){return"Row"===e.type&&Sl(e.node.children)},function(e){return"Column"===e.type&&Sl(e.node.children)},xl,function(e){return"RichText"===e.type},Ol,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&Sl(e.node.children)},function(e){return"StaticLink"===e.type&&Sl(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CloseButton"===e.type&&Sl(e.node.children)}]));function bl(e){return ml(e)}function El(e){return hl(e)}function Il(e){return vl(e)}function Sl(e){return gl(e)}function xl(e){return"StaticImage"===e.type}function Ol(e){return"BasicText"===e.type}const wl=i.lensPath(["styles","elements","link"]),Cl=i.lensPath(["styles","elements","activeIndicator"]),Al=i.lensPath(["styles","elements","indicator"]),Tl=i.lensPath(["styles","elements","seenIndicator"]),jl=i.lensPath(["focussed"]),Rl=i.lensPath(["hovered"]),Nl=i.lensPath(["default"]),_l=i.lensPath(["pressed"]),Dl=e=>{var t;return{text:null!==(t=null==e?void 0:e.text)&&void 0!==t?t:{}}},kl=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(jl,Dl)))),i.over(wl,i.map(i.when(i.has("hovered"),i.over(Rl,Dl)))),i.over(wl,i.map(i.when(i.has("default"),i.over(Nl,Dl)))),i.over(wl,i.map(i.when(i.has("pressed"),i.over(_l,Dl)))))),Pl=i.pipe(i.when(i.hasPath(["styles","elements","activeIndicator"]),i.over(Cl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","indicator"]),i.over(Al,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","seenIndicator"]),i.over(Tl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))));function Ll(e,t){return e?{elements:{own:e.elements.own.map(t)}}:void 0}const $l=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),Gl=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),Fl=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),Ml=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),Bl=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),Ul=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),Vl=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),zl=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 yl("When",`Invalid condition: ${e}`)}},ql=e=>{switch(e){case"breakpoint":return"Breakpoint";case"progression":return"Progression";case"position":return"Position";default:throw yl("When",`Invalid target: ${e}`)}},Hl=e=>{const{target:t,condition:n,value:a}=e;return{type:ql(t),predicate:{condition:zl(n),value:a}}};function Wl(e){const t={type:"FadeInOut",settings:{duration:e.transition.settings.duration}};return{styles:e.style,transition:t}}function Jl(e){const t=e.children.map((e=>Xl(e)));if(bl(t))return Object.assign(Object.assign({},e),{children:t,styles:Ll(e.styles,Bl)});throw yl("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function Kl(e){const t=e.children.map((e=>Xl(e)));if(El(t))return Object.assign(Object.assign({},e),{children:t,styles:Ll(e.styles,Ul)});throw yl("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function Yl(e){const t=e.children.map((e=>Xl(e)));if(Il(t))return Object.assign(Object.assign({},e),{children:t,styles:Ll(e.styles,Vl)});throw yl("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}const Zl=e=>({own:e.overlayContainer,wrapper:e.overlayWrapper});function Ql(e){var t,n;const a=(null===(t=e.styles)||void 0===t?void 0:t.elements)?{elements:Zl(null===(n=e.styles)||void 0===n?void 0:n.elements)}:void 0,i=e.children.map((e=>Xl(e)));if(Sl(i))return Object.assign(Object.assign({},e),{styles:a,children:i});throw yl("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function Xl(e){switch(e.type){case"When":return{type:"When",node:(s=e.node,{predicates:s.predicates.map(Hl),children:s.children.map((e=>Xl(e)))})};case"OneByOneDistribution":return{type:e.type,node:Wl(e.node)};case"Overlay":return{type:e.type,node:Ql(e.node)};case"Column":return{type:e.type,node:(r=e.node,{styles:Ll(r.styles,$l),children:r.children.map((e=>Xl(e)))})};case"Row":return{type:e.type,node:(o=e.node,{styles:Ll(o.styles,Gl),children:o.children.map((e=>Xl(e)))})};case"RichText":return{type:e.type,node:(i=e.node,kl(i))};case"CloseButton":return{type:e.type,node:Jl(e.node)};case"CreativeResponse":return{type:e.type,node:Kl(e.node)};case"StaticLink":return{type:e.type,node:Yl(e.node)};case"StaticImage":return{type:e.type,node:(a=e.node,Object.assign(Object.assign({},a),{styles:Ll(a.styles,Fl)}))};case"DataImage":return{type:e.type,node:(n=e.node,Object.assign(Object.assign({},n),{styles:Ll(n.styles,Ml)}))};case"ProgressIndicator":return{type:e.type,node:(t=e.node,Pl(t))};default:return e}var t,n,a,i,o,r,s}function ec(e){return rd(e)}function tc(e,t){return Error(`Migration process from v0_23 to v1_0 failed: could not transform ${e} node. For more details: ${t}`)}const nc=e=>"scroll"===e||"auto"===e?"visible":e,ac=i.lensPath(["elements","own"]),ic=i.lensPath(["transitions","transition","value","own"]),oc=i.lensPath(["elements","wrapper"]),rc=i.lensPath(["transitions","transition","value","wrapper"]),sc=i.lensPath(["elements","indicator"]),lc=i.lensPath(["transitions","transition","value","indicator"]),cc=i.lensPath(["elements","activeIndicator"]),dc=i.lensPath(["transitions","transition","value","activeIndicator"]),uc=i.lensPath(["elements","seenIndicator"]),pc=i.lensPath(["transitions","transition","value","seenIndicator"]),fc=i.lensPath(["default","container","overflow"]),yc=i.lensPath(["pressed","container","overflow"]),mc=i.lensPath(["hovered","container","overflow"]),hc=i.lensPath(["focussed","container","overflow"]),vc=i.lensPath(["disabled","container","overflow"]),gc=i.lensPath(["container","overflow"]),bc=i.pipe(i.when(i.hasPath(["default","container","overflow"]),i.over(fc,nc)),i.when(i.hasPath(["pressed","container","overflow"]),i.over(yc,nc)),i.when(i.hasPath(["hovered","container","overflow"]),i.over(mc,nc)),i.when(i.hasPath(["focussed","container","overflow"]),i.over(hc,nc)),i.when(i.hasPath(["disabled","container","overflow"]),i.over(vc,nc))),Ec=i.when(i.hasPath(["container","overflow"]),i.over(gc,nc)),Ic=i.pipe(i.when(i.hasPath(["elements","own"]),i.over(ac,i.map(bc))),i.when(i.hasPath(["transitions","transition","value","own"]),i.over(ic,Ec))),Sc=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)})),xc=i.pipe(Ic,Sc),Oc=i.pipe(i.when(i.hasPath(["elements","wrapper"]),i.over(oc,i.map(bc))),i.when(i.hasPath(["transitions","transition","value","wrapper"]),i.over(rc,Ec))),wc=i.pipe(i.when(i.hasPath(["elements","indicator"]),i.over(sc,i.map(bc))),i.when(i.hasPath(["transitions","transition","value","indicator"]),i.over(lc,Ec))),Cc=i.pipe(i.when(i.hasPath(["elements","activeIndicator"]),i.over(cc,i.map(bc))),i.when(i.hasPath(["transitions","transition","value","activeIndicator"]),i.over(dc,Ec))),Ac=i.pipe(i.when(i.hasPath(["elements","seenIndicator"]),i.over(uc,i.map(bc))),i.when(i.hasPath(["transitions","transition","value","seenIndicator"]),i.over(pc,Ec)));function Tc(e){return"StaticImage"===e.type}function jc(e){return"StaticIcon"===e.type}function Rc(e){return"BasicText"===e.type}function Nc(e){return"DataImage"===e.type}function _c(e){return"DataIcon"===e.type}function Dc(e){return"RichText"===e.type}function kc(e){return"SlideStateTrigger"===e.type}function Pc(e){return"ToggleButtonStateTrigger"===e.type}const Lc=i.all(i.anyPass([function(e){return"Row"===e.type&&$c(e.node.children)},function(e){return"Column"===e.type&&$c(e.node.children)},Tc,jc,Dc,Rc,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&$c(e.node.children)},function(e){return"StaticLink"===e.type&&$c(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&&$c(e.node.children)},function(e){return"ProgressControl"===e.type&&Wc(e.node.children)},function(e){return"ZStack"===e.type&&$c(e.node.children)},function(e){return"FlowRow"===e.type&&$c(e.node.children)},kc,Pc]));function $c(e){return Lc(e)}const Gc=i.pipe(Ic,Oc,Sc);function Fc(e){const t=e.children.map((e=>rd(e)));if($c(t))return Object.assign(Object.assign({},i.omit(["settings"],e)),{children:t,allowBackdropToClose:e.settings.allowBackdropToClose,styles:e.styles?Gc(e.styles):void 0});throw tc("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function Mc(e){const t=e.children.map((e=>rd(e)));if(Wc(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?xc(e.styles):void 0});throw tc("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function Bc(e){const t=e.children.map((e=>rd(e)));if(Kc(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?xc(e.styles):void 0});throw tc("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function Uc(e){const t=e.children.map((e=>rd(e)));if(Wc(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?xc(e.styles):void 0});throw tc("ProgressControl",`Invalid schema: ${JSON.stringify(e)}`)}const Vc=i.pipe(Ic,wc,Cc,Ac,Sc);const zc=i.all(i.anyPass([Rc,Tc,jc,Nc,_c,function(e){return"Row"===e.type&&qc(e.node.children)},function(e){return"FlowRow"===e.type&&qc(e.node.children)},function(e){return"Column"===e.type&&qc(e.node.children)},function(e){return"ZStack"===e.type&&qc(e.node.children)},function(e){return"When"===e.type&&qc(e.node.children)}]));function qc(e){return zc(e)}const Hc=i.all(i.anyPass([Rc,Tc,jc,function(e){return"Row"===e.type&&Wc(e.node.children)},function(e){return"FlowRow"===e.type&&Wc(e.node.children)},function(e){return"Column"===e.type&&Wc(e.node.children)},function(e){return"ZStack"===e.type&&Wc(e.node.children)},function(e){return"When"===e.type&&Wc(e.node.children)}]));function Wc(e){return Hc(e)}const Jc=i.all(i.anyPass([Rc,Tc,jc,Nc,_c,function(e){return"Row"===e.type&&Kc(e.node.children)},function(e){return"FlowRow"===e.type&&Kc(e.node.children)},function(e){return"Column"===e.type&&Kc(e.node.children)},function(e){return"ZStack"===e.type&&Kc(e.node.children)},function(e){return"When"===e.type&&Kc(e.node.children)}]));function Kc(e){return Jc(e)}function Yc(e){const t=e.children.map((e=>rd(e)));if(qc(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?xc(e.styles):void 0});throw tc("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}function Zc(e){const t=e.children.map((e=>rd(e)));if(Kc(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?xc(e.styles):void 0});throw tc("CatalogResponseButton",`Invalid schema: ${JSON.stringify(e)}`)}function Qc(e){return"Row"===e.type&&td(e.node.children)}function Xc(e){return"Column"===e.type&&td(e.node.children)}const ed=i.all(i.anyPass([Rc,Tc,jc,Nc,_c,Dc,function(e){return"StaticLink"===e.type},kc,Pc,function(e){return"CatalogResponseButton"===e.type},Qc,function(e){return"FlowRow"===e.type&&td(e.node.children)},Xc,function(e){return"ZStack"===e.type&&td(e.node.children)},function(e){return"When"===e.type&&td(e.node.children)}]));function td(e){return ed(e)}const nd=i.anyPass([Qc,Xc]);function ad(e){const t=rd(e.template);if(function(e){return nd(e)}(t))return Object.assign(Object.assign({},e),{template:t,styles:e.styles?xc(e.styles):void 0});throw tc("CatalogStackedCollection",`Invalid schema: ${JSON.stringify(e)}`)}function id(e){const t=e.children.map((e=>rd(e)));if(qc(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?xc(e.styles):void 0});throw tc("ToggleButtonStateTrigger",`Invalid schema: ${JSON.stringify(e)}`)}function od(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=>rd(e))),transition:t})}function rd(e){switch(e.type){case"Row":return{type:e.type,node:(g=e.node,Object.assign(Object.assign({},g),{children:g.children.map((e=>rd(e))),styles:g.styles?xc(g.styles):void 0}))};case"When":return{type:e.type,node:od(e.node)};case"FlowRow":return{type:e.type,node:(v=e.node,Object.assign(Object.assign({},v),{styles:v.styles?xc(v.styles):void 0,children:v.children.map((e=>rd(e)))}))};case"Column":return{type:e.type,node:(h=e.node,Object.assign(Object.assign({},h),{children:h.children.map((e=>rd(e))),styles:h.styles?xc(h.styles):void 0}))};case"ZStack":return{type:e.type,node:(m=e.node,Object.assign(Object.assign({},m),{styles:m.styles?xc(m.styles):void 0,children:m.children.map((e=>rd(e)))}))};case"Overlay":return{type:e.type,node:Fc(e.node)};case"ProgressControl":return{type:e.type,node:Uc(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?xc(y.styles):void 0}))};case"CloseButton":return{type:"CloseButton",node:Mc(e.node)};case"CreativeResponse":return{type:"CreativeResponse",node:Bc(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?xc(f.styles):void 0}))};case"OneByOneDistribution":return{type:"OneByOneDistribution",node:(p=e.node,Object.assign(Object.assign({},p),{styles:p.styles?xc(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?Vc(d.styles):void 0}))};case"SlideStateTrigger":return{type:"SlideStateTrigger",node:(c=e.node,Object.assign(Object.assign({},c),{styles:c.styles?xc(c.styles):void 0}))};case"StackedDistribution":return{type:"StackedDistribution",node:(l=e.node,Object.assign(Object.assign({viewableItems:[]},l),{styles:l.styles?xc(l.styles):void 0}))};case"StaticLink":return{type:"StaticLink",node:Yc(e.node)};case"ToggleButtonStateTrigger":return{type:"ToggleButtonStateTrigger",node:id(e.node)};case"CatalogResponseButton":return{type:"CatalogResponseButton",node:Zc(e.node)};case"CatalogStackedCollection":return{type:"CatalogStackedCollection",node:ad(e.node)};case"RichText":return{type:"RichText",node:(s=e.node,Object.assign(Object.assign({},s),{styles:s.styles?Sc(s.styles):void 0}))};case"DataImage":return{type:"DataImage",node:(r=e.node,Object.assign(Object.assign({},r),{styles:r.styles?Sc(r.styles):void 0}))};case"StaticImage":return{type:"StaticImage",node:(o=e.node,Object.assign(Object.assign({},o),{styles:o.styles?Sc(o.styles):void 0}))};case"DataIcon":return{type:"DataIcon",node:(a=e.node,Object.assign(Object.assign({},a),{styles:a.styles?Sc(a.styles):void 0}))};case"StaticIcon":return{type:"StaticIcon",node:(n=e.node,Object.assign(Object.assign({},n),{styles:n.styles?Sc(n.styles):void 0}))};case"BasicText":return{type:"BasicText",node:(t=e.node,Object.assign(Object.assign({},t),{styles:t.styles?Sc(t.styles):void 0}))};default:return e}var t,n,a,o,r,s,l,c,d,u,p,f,y,m,h,v,g}function sd(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 ld(e,t){return e.major===t.major&&e.minor===t.minor}const cd=(e,t,n)=>i.allPass([i.lte(e),i.gte(t)])(n);function dd(e,t){return ld(t,{major:0,minor:0})?dd(fl(e),{major:0,minor:1}):function(e,t){return 0===t.major&&cd(1,23,t.minor)}(0,t)?dd(ec(e),{major:1,minor:0}):e}function ud(e,t){return ld(t,{major:0,minor:0})?ud(function(e){return Object.assign(Object.assign({},e),{layout:fl(e.layout)})}(e),{major:0,minor:1}):function(e,t){return 0===t.major&&cd(1,23,t.minor)}(0,t)?ud(function(e){return Object.assign(Object.assign({},e),{layout:ec(e.layout)})}(e),{major:1,minor:0}):e}function pd(e,t,n,a){const i=sd(n);if(a){const s=sd(a);if(r=i,(o=s).major<r.major||o.major===r.major&&o.minor<r.minor||ld(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,sd("0.0"));var o,r}function fd(e){try{return Object.assign(Object.assign({},i.clone(e)),{offer:Object.assign(Object.assign({},i.clone(e.offer)),{creative:el(e.offer.creative)}),layoutVariant:Object.assign(Object.assign({},i.clone(e.layoutVariant)),{layoutVariantSchema:"string"==typeof e.layoutVariant.layoutVariantSchema?nl(e.layoutVariant.layoutVariantSchema,"LayoutSlotLayoutVariant",e.instanceGuid):e.layoutVariant.layoutVariantSchema})})}catch(t){throw t.message?t:Xs("Slot",e.instanceGuid)}}function yd(e){if(e){const t=function(e){try{return Object.assign(Object.assign({},i.clone(e)),{outerLayoutSchema:"string"==typeof e.outerLayoutSchema?nl(e.outerLayoutSchema,"LayoutRootLayoutSchema",e.instanceGuid):e.outerLayoutSchema,slots:i.map(fd,e.slots)})}catch(t){throw t.message?t:Xs("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,ud,t,n))))(e)}(t,uo.DCUI_SCHEMA_VERSION)}}const md=i.cond([[i.where({signalType:i.equals("SignalSecondaryResponse")}),function*(e,t){return yield r.put({type:Fi,payload:{level:lo,code:Io,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:q,payload:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:i,responseActionPayload:{name:"Url",transformedTrafficURL:e.url}}});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(ar,t),i=sr(a)?a.ref:void 0;return yield r.call(e.addAdvertiserWindowRef,i,n),sr(a)||"newTab"!==t.urlBehavior?"SUCCESS":(yield r.put({type:Fi,payload:{level:lo,code:So,message:`Did not receive a window reference opening link ${t.url}`}}),"UNSPECIFIED")}catch(e){return yield r.put({type:Fi,payload:{level:lo,code:So,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:Fi,payload:{level:lo,code:Io,message:"URL response doesn't have a valid url",additionalInformation:{instanceGuid:e.instanceGuid}}}),"ERROR"}],[i.T,function*(){return"EXPLICIT_DISMISSAL"}]]);function*hd(e){return yield r.put({type:Fi,payload:{level:lo,code:Io,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}function*vd(e,t){let n="IMPLICIT_DISMISSAL";const a=t.payload.offerPositionIndex,i=V(t.payload)||z(t.payload)||U(t.payload)?t.payload:t.payload.responseOption;switch(i.action){case"Url":yield r.put({type:J,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:Mi,payload:{code:"CREATIVE_RESPONSE",message:"creative positive response",data:{type:i.action,isPositive:i.isPositive,responseInstanceGuid:i.instanceGuid}}}),yield r.put({type:J,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*hd(i):yield*md(i,e.context,e.partner);break;case"CaptureOnly":yield r.put({type:J,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:J,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*hd(i):yield*function*(e){return yield r.put({type:q,payload:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:"CaptureOnly"}}}),e.isPositive?"SUCCESS":"EXPLICIT_DISMISSAL"}(i);break;case"Fulfillment":yield r.put({type:Fi,payload:{level:lo,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:Fi,payload:{level:lo,code:"INCORRECTLY_HANDLE_EXTERNAL_ACTION",message:`External action was dispatched as an engagement erroneously. Instance GUID: ${i.instanceGuid}`}}),n="ERROR"}go(t.payload)||(yield r.put(function(e,t){switch(e){case"SUCCESS":return{type:As,payload:{event:"Completed",completionReason:"Success",offerPositionIndex:t}};case"UNSPECIFIED":return{type:As,payload:{event:"Completed",completionReason:"Unspecified",offerPositionIndex:t}};case"ERROR":return{type:As,payload:{event:"Completed",completionReason:"Error",offerPositionIndex:t}};case"EXPLICIT_DISMISSAL":return{type:As,payload:{event:"Dismissed",dismissalReason:"Explicit",offerPositionIndex:t}};case"IMPLICIT_DISMISSAL":return{type:As,payload:{event:"Dismissed",dismissalReason:"Implicit",offerPositionIndex:t}};default:return{type:Os,payload:{offerProcessStatus:"END"}}}}(n,a)))}function gd(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:Fi,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:Fi,payload:{level:w,code:"FAILED_TO_LOAD_MODULE",message:t,additionalInformation:{stack:a,reason:t?void 0:e,moduleName:n}}}),i(l.END)})),()=>{})))}const bd={"standard-marketing":()=>Promise.resolve().then((function(){return lu})),"add-to-cart":()=>Promise.resolve().then((function(){return cp})),"instant-purchase":()=>Promise.resolve().then((function(){return Lp})),"layouts-xp-sandbox":()=>Promise.resolve().then((function(){return mf}))};function*Ed(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(Id,e,t,i))}function*Id(e,t,n){if(n in bd){yield r.put({type:gs,payload:n});const a=yield r.call(gd,e,t,n,bd[n]);yield r.call(bo,a)}else yield r.put({type:Fi,payload:{level:ro,code:"INVALID_MODULE_NAME",message:`Could not load unknown module ${n}`}})}function*Sd(e){const t=yield r.select((e=>cl.getDistributionViewableItems(e.layout?cl.getDistribution(e.layout.layoutSchema):void 0))),n=yield r.select((n=>{var a;const i=Mo(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:xs,payload:{groupSize:n}};yield r.put(e)}}const xd=i.cond([[(e,t,n,a)=>"END"===e.offerProcessStatus,i.always({type:Ri})],[(e,t,n,a)=>t.isLastOffer&&n,i.always({type:Ri})],[(e,t,n,a)=>1===a&&!t.isLastOffer,i.always({type:Is})],[i.T,i.always(void 0)]]);function*Od(e){const t=yield r.select((e=>({exists:null!==e.progression,isLastOffer:Fs(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=xd(e,t,"boolean"==typeof a&&a,n);i&&(i.type===Ri&&(yield r.put({type:J,payload:{name:"PLACEMENT_COMPLETED"}})),yield r.put(i))}(e.payload,t,n))}function wd(e){return e.type===As&&"Interactive"===e.payload.event}function Cd(e){return e.type===As&&"Interactive"!==e.payload.event}function*Ad(e){switch(e.payload.event){case"Dismissed":yield r.put({type:Os,payload:{offerProcessStatus:"CONTINUE"}});break;case"Completed":yield r.put({type:Ts,payload:{key:"offerCompleted",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:Os,payload:{offerProcessStatus:"CONTINUE"}});break;case"Interactive":yield r.put({type:F,payload:{name:"Interactive",offerPositionIndex:e.payload.offerPositionIndex}}),yield r.put({type:J,payload:{name:"PLACEMENT_INTERACTIVE"}})}}function*Td(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,Xo.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:Fi,payload:{level:C,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*jd(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:Ns.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Ri}),t?(yield r.put({type:q,payload:{name:"SignalInstantPurchaseDismissal",parentGuid:t}}),yield r.put({type:q,payload:{name:"SignalDismissal",parentGuid:t}})):yield r.put({type:Fi,payload:{level:so,code:xo,message:"ParentGuid does not exist"}})}function*Rd(e,t){yield r.all([r.takeEvery(Fi,Eo.bind(null,e.errorService.raise)),r.takeLatest(ji,ul.bind(null,{display:e.displayService,partner:e.partnerInteractionService})),r.takeEvery(bs,Ed.bind(null,t,e.contextService)),r.takeLatest(js,vd.bind(null,{partner:e.partnerInteractionService,context:e.contextService})),r.takeEvery(Os,Od),r.takeEvery(Cd,Ad),vo(wd,Ad),r.takeLatest(Ci,Wo.bind(null,e.displayService)),r.takeLatest(Ri,ur.bind(null,e.contextService)),r.takeLatest(Cs,jd),r.takeLatest(Gi,Lr),r.takeEvery(q,br),r.takeEvery(K,Er),ho(F,kr.bind(null,e.metricsService)),ho($i,Ir.bind(null,e.rdnService)),r.takeEvery(Mi,gr.bind(null,e.errorService.raise)),r.takeLatest(Oi,Sd),r.takeEvery(W,Dr),r.takeEvery(Y,Pr.bind(null,{createChildPlugin:e.childPlugin.create,partner:e.partnerInteractionService,context:e.contextService})),r.takeLatest(Z,Td.bind(null,{partner:e.partnerInteractionService,context:e.contextService}))])}var Nd,_d,Dd,kd,Pd,Ld=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},$d=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 Gd={[X.SET_CUSTOM_STATE]:Ns.SET_CUSTOM_STATE,[X.SET_DOMAIN_STATE]:Ns.SET_DOMAIN_STATE,[X.SET_GLOBAL_OFFER_DATA_CART]:Ns.SET_GLOBAL_OFFER_DATA_CART,[X.OFFER_LIFECYCLE]:_s.OFFER_LIFECYCLE,[X.OFFER_ENGAGEMENT]:_s.OFFER_ENGAGEMENT,[X.SET_PARTNER_VALIDATION_STATUS]:_s.SET_PARTNER_VALIDATION_STATUS};class Fd{constructor(e){Nd.add(this),_d.set(this,void 0),Ld(this,_d,e,"f")}getState(e){const t=$d(this,_d,"f").getState();return{breakpoint:t.breakpoint,progression:Ms(t),customStates:Uo(t,e.offerPositionIndex),domainStates:Bs(t,e.offerPositionIndex)}}dispatch(e,t){$d(this,_d,"f").dispatch($d(this,Nd,"m",Pd).call(this,e,t))}subscribe(e,t){return t(this.getState(e)),$d(this,_d,"f").subscribe((()=>{t(this.getState(e))}))}}function Md(e,t){const n=l(),a={},i=s.configureStore({reducer:$s,devTools:{name:"Orchestrator"},preloadedState:Object.assign(Object.assign({},Gs()),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 Fd(e)}(i),c=e.childPlugin.create,d=e.partnerInteractionService.onEvent,(e,t)=>new nn(r,c,e,t,d));var r,c,d;n.run(Rd,e,o),n.run(mr,e,yd);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({},$s),u)))),t&&Object.assign(a,t),o&&n.run(o)}})}_d=new WeakMap,Nd=new WeakSet,Dd=function(e,t,n){return{type:e,payload:Object.assign(Object.assign({},t),{offerPositionIndex:n})}},kd=function(e,t){return t.type===K?t.payload.signal.parentGuid||(t.payload.signal.parentGuid=e.creativeInstanceGuid):t.payload.parentGuid||(t.payload.parentGuid=e.creativeInstanceGuid),t},Pd=function(e,t){return function(e){return e.type in Gd}(t)?$d(this,Nd,"m",Dd).call(this,Gd[t.type],t.payload,e.offerPositionIndex):t.type===q||t.type===K?$d(this,Nd,"m",kd).call(this,e,t):t};var Bd=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 Ud={ctx:new Map([[vs.name,vs],[ys.name,ys],[os.name,os]]),cache:[]};class Vd{constructor(){this._subscribers=[]}add(e){this._subscribers.push(e)}unsubscribe(){this._subscribers.forEach((e=>e.unsubscribe()))}}const zd=()=>{},qd=(e=zd,t=zd,n=zd)=>"function"!=typeof e?e:{next:e,error:t,complete:n};class Hd{constructor(e){this._setupFn=e}subscribe(e,t,n){const a=qd(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 Vd;return s.add({unsubscribe:()=>{i&&i(),o=!1}}),s}}class Wd extends Hd{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 Hd((e=>{const t=this.subscribe(e);return()=>t.unsubscribe()}))}}const Jd={CompletedBeforeEmit:"CompletedBeforeEmit"};var Kd=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 Yd{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)=>Kd(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 Zd{constructor(e){this.value=e,this.complete=!1,this.skip=!1}}var Qd=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 Xd={getBreakpointCSSClass:$};function eu(){const t=gn();return e.jsx(pt,{children:e=>e(t)})}const tu={mock:function(e=null,t){return t.type,e}};function nu(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*au(e,t){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:H,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":t({type:H,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:H,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*iu(e,t,n){const a=V(n.payload)||z(n.payload)||U(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":go(n.payload)&&(yield r.put({type:J,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:a.accountID,referralCreativeID:a.referralCreativeID}}})),yield r.call(e.globalDispatch.bind(e),n);break;case"CaptureOnly":yield r.call(e.globalDispatch.bind(e),n);break;case"Fulfillment":yield r.put({type:J,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:J,payload:{name:"POSITIVE_ENGAGEMENT"}})),yield*function*(e,t,n){if(B(n)){const{responseOption:a,fulfillment:i}=n;yield r.put({type:q,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(nu,o);if("object"==typeof t&&"take"in t)return void(yield r.call(au,t,e.globalDispatch.bind(e)))}yield r.call(t,{level:w,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:w,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}(e,t,n.payload)}}function*ou(e,t){yield r.all([r.takeLatest(M,iu.bind(null,e,t)),r.takeEvery("*",po.bind(null,[M],e))])}function ru(e,t,n=function(e={}){return Object.assign({mock:null},e)}()){const a=l(),i=s.configureStore({reducer:tu,devTools:{name:"Standard Marketing"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(ou,e,t),i}Object.assign({},X);const su=(new fn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),s=ru(i.gateway,i.logger);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Tn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(vi,{}),e.jsx(a.Provider,{store:s,children:e.jsx(mi,{settings:i,dispatch:s.dispatch,children:e.jsx(eu,{})})})]})}))}}));var lu=Object.freeze({__proto__:null,moduleConnectorBuilder:su});const cu="CART/UPDATE",du="CATALOG_ITEM/RESPONSE",uu="USER_CREATIVE_RESPONSE_HISTORY/ADD",pu=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 fu({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 yu="catalogRadioGroup__label",mu=["Enter","Space"],hu={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 vu(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 gu({schema:n,testId:i}){const o=a.useDispatch(),r=Nn(),[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,vu(n.validations,n.options.length,i)]})),c=En(),d=Ln(),{tabIndex:u,styles:p,isDisabled:f}=h(c);t.useEffect((()=>{f||o(bu(l))}),[]);const y=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 m(e){o({type:du,payload:{catalogItem:r,quantity:e}});const t=vu(n.validations,n.options.length,e);o(bu(t))}return y.length>0?e.jsx(ba,{styles:n.styles?L(hu,n.styles):hu,children:({classnames:n,mapperRef:a})=>e.jsx("div",{className:null==n?void 0:n.own,style:Object.assign(Object.assign({display:"flex",flexDirection:"column"},p),d),children:e.jsx(Ut,{value:a(yu),children:t.Children.toArray(y.map(((t,a)=>{var o;const l=pu(s,t.quantity),c=e=>i?`${i}-option${a}${e}`:void 0;return e.jsxs("label",{tabIndex:u,"aria-disabled":f,style:{display:"flex"},className:`${yu} ${null!==(o=null==n?void 0:n.optionContainer)&&void 0!==o?o:""}`,onKeyDown:e=>{l||!mu.includes(e.code)||f||m(t.quantity)},"data-e2e":"CatalogRadioGroup-Option","data-e2e-quantity":`${t.quantity}`,"data-testid":c("Label"),children:[e.jsx("input",{type:"radio",style:{display:"none"},tabIndex:-1,name:r.instanceGuid,value:t.quantity,checked:l,onChange:()=>m(t.quantity),"aria-disabled":f,disabled:f}),e.jsx(fu,{isChecked:l,isDisabled:f,innerClassname:null==n?void 0:n.radioButtonInner,innerCheckedClassname:null==n?void 0:n.radioButtonInnerChecked,outerClassname:null==n?void 0:n.radioButtonOuter,outerCheckedClassname:null==n?void 0:n.radioButtonOuterChecked}),e.jsx(Ii,{schema:t,testId:c("Content")})]})})))})})}):null}function bu(e){return{type:Z,payload:{errors:e}}}function Eu(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Iu(t){const n=a.useDispatch(),i=ft(),o=Nn(),r=En(),s=Ln(),{tabIndex:l,styles:c,isDisabled:d}=h(r);return e.jsx(ba,{styles:t.schema.styles,children:({classnames:a})=>e.jsx("button",{type:"button",tabIndex:l,"aria-disabled":d,disabled:d,style:Object.assign(Object.assign({cursor:"pointer"},c),s),"data-testid":t.testId,"data-e2e":"CatalogItemResponse",onClick:e=>{e.preventDefault();n({type:du,payload:{catalogItem:o,quantity:1}})},className:null==a?void 0:a.own,children:Eu(t.schema.children,i,t.testId)})})}const Su={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"]},xu=new Map([["&","_;^;_"]]),Ou=new RegExp(`<a *(?=${Su.allowedAttributes.a.join("|")}|>)`,"g"),wu=new RegExp(`<a *(?:(?:${Su.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),Cu=new RegExp("(<br *?>)|(<br *?/>)","g"),Au=new RegExp(`<ul *(?=${Su.allowedAttributes.ul.join("|")}|>)`,"g"),Tu=new RegExp(`<ol *(?=${Su.allowedAttributes.ol.join("|")}|>)`,"g"),ju=new RegExp("<li *(?=>|\\s[^>]*>)","g"),Ru="<br/>";function Nu(n){const a=Mt(),o=En(),r=Ln(),s=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(wu,((e,t)=>{const n=t.replaceAll("&",xu.get("&"));return e.replace(t,n)})).replaceAll(Cu,Ru)}(e);return t===u(t,Su)}(e))throw new A("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:l,styles:c,isDisabled:d}=h(o),p=Object.assign(Object.assign({},c),r),f=i.isEmpty(p)?void 0:p;return s?e.jsx(ba,{styles:n.schema.styles,children:({classnames:t})=>{const a=[(null==t?void 0:t.link)?`class="${null==t?void 0:t.link}"`:"",d?'tabindex="-1"':"",d?"style=\"pointer-events: 'none'; user-select: none;\"":"",d?'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;"',o=((null==t?void 0:t.listItem)?`class="${t.listItem}"`:"")+' style="display: flex; align-items: flex-start; flex-shrink: 0; flex-grow: 1;"',r=`class="rokt-icon${(null==t?void 0:t.span)?" "+t.span:""}" style="display: inline-block; pointer-events: none; user-select: none;" aria-disabled="true"`,c=s.replace(Ou,`<a ${a.join(" ")}`).replace(Au,`<ul ${i}`).replace(Tu,`<ol ${i}`).replace(ju,`<li ${o}><span ${r}>Check</span`);return u=s,new RegExp("</(p|ul|ol)>").test(u)?e.jsx("div",{tabIndex:l,style:f,"aria-hidden":d,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:c}}):e.jsx("p",{tabIndex:l,style:f,"aria-hidden":d,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:c}});var u}}):null}const _u={internally:"_top",externally:"_blank"};function Du(t,n,a,i,o){return e.jsx(Ut,{value:a(n),children:ku(t,i,o)})}function ku(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Pu(t){var n,i;const o=_u[t.schema.open],r=ft(),s=Nn(),l=En(),c=a.useDispatch(),d=null!==(n=s.url)&&void 0!==n?n:"",{tabIndex:u,styles:p,isDisabled:f}=h(l);return Boolean(d)&&(null===(i=t.schema.children)||void 0===i?void 0:i.length)>0?e.jsx(ba,{styles:t.schema.styles,children:({classnames:n,mapperRef:a})=>{var i;return e.jsx("a",{href:d,onClick:()=>{var e;c({type:q,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)?Du(t.schema.children,null==n?void 0:n.own,a,r,t.testId):ku(t.schema.children,r,t.testId)})}}):null}function Lu(e,t){const n=e.cart[t];return n||null}function $u(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 Gu(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 $u(e).reduce(((e,t)=>e+t.quantity),0)}(e),s=Lu(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 Fu(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 Mu(e,t){var n,a;return null!==(a=null===(n=Fu(e))||void 0===n?void 0:n.find((e=>e.catalogItemId===t)))&&void 0!==a?a:null}function Bu(e){var t;const n=null===(t=Fu(e))||void 0===t?void 0:t.filter((e=>e.preSelectedQuantity&&e.preSelectedQuantity>0));return n&&n.length>0?n:null}function Uu(e){var t,n;return null!==(n=null===(t=Bu(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 Vu=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 zu(t,n,a,i,o){return e.jsx(Ut,{value:a(n),children:i(t,void 0,o)})}function qu(e,t,n){return t(e,void 0,n)}function Hu(t){var n;const{schema:i,testId:o}=t,{a11yInputLabel:r,styles:s,showInputField:l,buttons:c,forcedUpsellText:d}=i,{increment:u,decrement:p,a11yIncrementLabel:f,a11yDecrementLabel:y}=c||{},m=a.useDispatch(),v=Nn(),g=ft(),b=Mt(),E=En(),I=Ln(),{tabIndex:S,styles:x,isDisabled:O}=h(E),w=a.useSelector((e=>function(e,t){var n,a,i;const o=Mu(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=>Lu(e,v.cartItemId))),A=a.useSelector((e=>Gu(e,v))),T=(null==C?void 0:C.quantity)||0,j=h(O||T<=(null!==(n=v.minItemCount)&&void 0!==n?n:0)?"DISABLED":E),R=h(O||A<=0?"DISABLED":E),N=h(O||w?"DISABLED":E),_=e=>{var t;const n=e.target.value;if(0===n.length)D(null!==(t=v.minItemCount)&&void 0!==t?t:0);else{const e=Number(n);!Number.isNaN(e)&&e>=0&&D(e)}},D=e=>{O||m({type:du,payload:{catalogItem:v,quantity:e}})};return e.jsx(ba,{styles:s,children:({classnames:t,mapperRef:n})=>e.jsx("div",{className:null==t?void 0:t.own,style:Object.assign(Object.assign({display:"flex",flexDirection:"row"},x),I),children:w&&d?e.jsx(ja,{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({},j.styles),{cursor:j.isDisabled?"not-allowed":"pointer",pointerEvents:"auto"}),onClick:e=>{e.preventDefault(),D(T-1)},tabIndex:j.tabIndex,"aria-label":y||void 0,disabled:j.isDisabled,"data-testid":o?`${o}-decrement-button`:void 0,children:e.jsx(Ft,{value:b,children:(null==t?void 0:t.decrementButton)?zu(p,t.decrementButton,n,g,o):qu(p,g,o)})}):null,l?e.jsx("input",{type:"text",className:null==t?void 0:t.input,style:Object.assign(Object.assign({},N),{cursor:N.isDisabled?"not-allowed":"auto",caretColor:N.isDisabled?"transparent":"auto",pointerEvents:"auto",outline:"none"}),value:T,onChange:_,"aria-label":r||void 0,tabIndex:S,disabled:O,"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(),D(T+1)},tabIndex:R.tabIndex,"aria-label":f||void 0,disabled:R.isDisabled,"data-testid":o?`${o}-increment-button`:void 0,children:e.jsx(Ft,{value:b,children:(null==t?void 0:t.incrementButton)?zu(u,t.incrementButton,n,g,o):qu(u,g,o)})}):null]})})})}const Wu={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(Iu,{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(Nu,{schema:n.node});case"CatalogUrlLink":return e.jsx(Pu,{schema:n.node});default:return}}},CatalogRadioGroup:function(t){if("CatalogRadioGroup"===t.type)return e.jsx(gu,{schema:t.node})},CatalogQuantityCounter:function(t){if("CatalogQuantityCounter"===t.type)return e.jsx(Hu,{schema:t.node})}};function Ju(){const t=gn(),n=ft();return e.jsx(yt,{value:n,overrides:Wu,children:e.jsx(pt,{children:e=>e(t)})})}const Ku={cart:function(e={},t){if(t.type===cu){const{catalogItem:n,quantity:a}=t.payload,i=n.cartItemId,o=fo(n,a);return Object.assign(Object.assign({},e),{[i]:o})}return e},userCreativeResponseHistory:function(e=[],t){return t.type===uu?e.concat(t.payload.responseId):e},staticData:function(e=null,t){return e}};const Yu="INVALID_PARTNER_MESSAGE",Zu="MISCONFIGURED_CATALOG_ITEM",Qu="FAILED_TO_PROCESS_PARTNER_UPDATE_CART_ITEM";function*Xu(e){var t,n;const a=yield r.select(Bu),i=yield r.select(Uu),o=yield r.select((e=>{var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer.maxTotalItemsQtyInOffer}));if(ip(i)&&ip(o)&&i>o)yield r.call(e,{level:C,code:Zu,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:C,code:Zu,message:`Preselected quantity (${a}) is greater than maxItemCount (${o}) for catalog item (${i.instanceGuid})`}):yield*ap(i,a,!0)}}function*ep(e,t,n){const{catalogItem:a,quantity:i}=n.payload;if(yield*ap(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){switch(e.action){case"Fulfillment":{const n=null==t?void 0:t.creative.fulfillment;return b(n)?{type:M,payload:{fulfillment:n,responseOption:e}}:`Could not get fulfillment for response (instanceGuid: ${e.instanceGuid})`}case"Url":return(null==t?void 0:t.accountId)?{type:M,payload:Object.assign(Object.assign({},e),{accountID:null==t?void 0:t.accountId})}:`Could not get accountId for response (instanceGuid: ${e.instanceGuid})`;default:return{type:M,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:C,code:"INVALID_RESPONSE_OBJECT",message:n}))}var o}function*tp(e,t){const n=function(e,t){return l.eventChannel((n=>{const a=e.onEvent({name:Zo.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:C,code:Yu,message:`Invalid UpdateCartItemPartnerMessageBody: ${JSON.stringify(e)}`}):n(e)}});return()=>{a()}}))}(e,t);try{for(;;){const e=yield r.take(n);yield r.call(np,e,t)}}catch(e){const n=e;t({level:C,code:Qu,message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&n.close()}}function*np(e,t){const{cartItemId:n,quantity:a}=e,i=yield r.select(Lu,n);if(op(i)){const e=yield r.select(Mu,i.catalogItemId);null!==(o=e)&&"object"==typeof o&&"catalogItemId"in o&&"price"in o?yield*ap(e,a,!1):yield r.call(t,{level:C,code:Qu,message:`Catalog item not found for cart item id (${n})`})}else yield r.call(t,{level:C,code:Qu,message:`Cart item not found for cart item id (${n})`});var o}function*ap(e,t,n){var a;const i=yield r.select(Lu,e.cartItemId),o=yield r.select(Gu,e),s=ip(o)?o:0,l=op(i)?i.quantity:0;if(t!==l&&t>=(null!==(a=e.minItemCount)&&void 0!==a?a:0)&&t-l<=s){yield r.put({type:cu,payload:{catalogItem:e,quantity:t}});const a=yield r.select(Lu,e.cartItemId),o=yield r.select(Vu);return yield r.put({type:Q,payload:{cart:o}}),yield r.put({type:q,payload:{name:"SignalCartItemQuantitySelected",parentGuid:e.instanceGuid,objectData:{quantity:t,preselected:n}}}),yield r.put({type:J,payload:{name:"V2_CART_ITEM_UPDATED",body:{oldCartItem:i,cartItem:a}}}),!0}return!1}function ip(e){return"number"==typeof e}function op(e){return null!=e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&"unitPrice"in e}function*rp(e,t){var n;yield r.put({type:uu,payload:{responseId:(n=t.payload,B(n)?n.responseOption.id:n.id)}}),yield r.call(e.globalDispatch.bind(e),t)}function*sp(e,t){yield r.all([r.spawn(Xu.bind(null,t)),r.spawn(tp.bind(null,e,t)),r.takeLatest(du,ep.bind(null,e,t)),r.takeLatest(M,rp.bind(null,e)),r.takeEvery("*",po.bind(null,[M],e))])}Object.assign(Object.assign({},X),{CATALOG_ITEM_RESPONSE:du});const lp=(new fn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=function(e={}){return Object.assign({cart:{},userCreativeResponseHistory:[],staticData:null},e)}({staticData:{offer:i.offerData,position:i.offerPositionIndex}}),d=function(e,t,n){const a=l(),i=s.configureStore({reducer:Ku,devTools:{name:"Add To Cart"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(sp,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Tn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(vi,{}),e.jsx(a.Provider,{store:d,children:e.jsx(mi,{settings:i,dispatch:d.dispatch,children:e.jsx(Ju,{})})})]})}))}}));var cp=Object.freeze({__proto__:null,moduleConnectorBuilder:lp});const dp="CATALOG/SET_SELECTED_ITEM",up="INSTANT_PURCHASE/INITIATE",pp="INSTANT_PURCHASE/PARTNER_RESPONSE";function fp(t,n,a,i,o){return e.jsx(Ut,{value:a(n),children:yp(t,i,o)})}function yp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function mp(t){const n=a.useDispatch(),i=ft(),o=En(),r=Ln(),{tabIndex:s,styles:l,isDisabled:c}=h(o),d=Nn(),u=Pt(d,"catalogItem");return e.jsx(ba,{styles:t.schema.styles,children:({classnames:a,mapperRef:o})=>e.jsx("button",{type:"button",tabIndex:s,"aria-disabled":c,disabled:c,style:Object.assign(Object.assign({cursor:"pointer"},l),r),"data-testid":t.testId,"data-e2e":"CatalogItemResponse",onClick:e=>{e.preventDefault();n({type:up,payload:{catalogItem:d,quantity:1}})},className:null==a?void 0:a.own,children:e.jsx(Ft,{value:u,children:(null==a?void 0:a.own)?fp(t.schema.children,a.own,o,i,t.testId):yp(t.schema.children,i,t.testId)})})})}const hp=["ArrowDown","ArrowUp","Enter","Escape"];function vp(n){const i="Select an option",o=bt().catalogItems||[],r=En(),s=Ln(),{styles:l,isDisabled:c}=h(r),d=a.useDispatch(),u=a.useSelector((e=>e.selectedItem)),p=o.map(((e,t)=>({label:e.title,value:e.catalogItemId,index:t}))),[f,y]=t.useState(!1),[m,v]=t.useState(u?{label:u.title,value:u.catalogItemId,index:o.findIndex((e=>e.catalogItemId===u.catalogItemId))}:null),[g,b]=t.useState(m?m.index:null);function E(){c||(f?S():I())}function I(){c||y(!0)}function S(){c||(y(!1),b(null))}function x(e){v(e),S(),d({type:dp,payload:o[e.index]})}t.useEffect((()=>{f&&T(m?m.index:0)}),[f,m]);const O=t.useRef(null),w=t.useRef([]),C={elements:{own:[{default:{background:{backgroundColor:{light:"#ffffff"}},border:{borderColor:{light:"#D0D5DD"},borderRadius:4,borderStyle:"solid",borderWidth:"1"},dimension:{width:{type:"percentage",value:100}},spacing:{padding:"10"}}}]}};function A(e){if(!c)if(f){if(hp.includes(e.key))switch(e.preventDefault(),e.key){case"ArrowDown":null!==g&&g!==p.length-1&&T(g+1);break;case"ArrowUp":null!==g&&0!==g&&T(g-1);break;case"Enter":if(null!==g){const e=p[g];e&&(x(e),j())}break;case"Escape":S(),j()}}else"Enter"===e.key&&I()}function T(e){const t=w.current[e];null!=t&&(b(e),t.focus())}function j(e){e&&e.preventDefault(),O.current&&O.current.focus()}return e.jsx(ba,{styles:n.schema.styles?L(C,n.schema.styles):C,children:({classnames:t})=>{var a;return e.jsxs("div",{ref:O,className:null==t?void 0:t.own,onKeyDown:A,onMouseDown:j,onClick:E,onBlur:e=>{var t;(null===(t=O.current)||void 0===t?void 0:t.contains(e.relatedTarget))||f&&S()},"aria-disabled":c,"aria-label":null!==(a=n.schema.a11yLabel)&&void 0!==a?a:i,style:Object.assign(Object.assign({position:"relative"},l),s),tabIndex:0,children:[e.jsx("div",{className:null==t?void 0:t.dropDownSelectedElement,"aria-disabled":c,style:l,children:m?m.label:i}),f&&e.jsx("ul",{className:null==t?void 0:t.dropDownListContainer,onClick:e=>e.stopPropagation(),style:Object.assign({listStyle:"none",margin:0,padding:0,zIndex:9999,position:"absolute",top:"100%",left:0,right:0,backgroundColor:"white",boxShadow:"0 2px 5px rgba(0,0,0,0.2)"},l),children:p.map(((n,a)=>e.jsx("li",{ref:e=>function(e,t){w.current[t]=e}(e,a),className:null==t?void 0:t.dropDownListElement,onClick:e=>{e.stopPropagation(),c||x(n)},tabIndex:-1,"aria-label":n.label,style:Object.assign({cursor:"pointer"},l),children:e.jsx("span",{children:n.label})},n.value)))})]})}})}function gp(n){const i=ft(),o=Cn(),r=Mt(),s=lt(),l=Ln(),c=bt().catalogItems||[],d=a.useSelector((e=>e.selectedItem))||c[0];return t.useEffect((()=>{d&&s({type:q,payload:{name:"SignalImpression",parentGuid:null==d?void 0:d.instanceGuid}})}),[d,s]),d?e.jsx(ba,{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:Object.assign({display:"flex",flexDirection:"column"},l),children:t.Children.toArray(e.jsx(Rn,{context:d,children:e.jsx(wn,{value:o(d),children:e.jsx(Ft,{value:(s=d,r({data:s},"catalogItem")),children:i(n.schema.template,void 0,n.testId?`${n.testId}-child`:"")})})}))});var s}}):null}const bp={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(mp,{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"DropDown":return e.jsx(vp,{schema:n.node});case"CatalogCombinedCollection":return e.jsx(gp,{schema:n.node});default:return}}}};function Ep(){const t=gn(),n=ft();return e.jsx(yt,{value:n,overrides:bp,children:e.jsx(pt,{children:e=>e(t)})})}const Ip={staticData:function(e=null,t){return e},selectedItem:(e=null,t)=>t.type===dp?t.payload:e};function Sp(e={}){return Object.assign({staticData:null,selectedItem:null},e)}const xp="INVALID_RESPONSE_OBJECT";function Op(e,t){return l.eventChannel((n=>e.onEvent({name:Qo.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:C,code:"MALFORMED_PARTNER_DATA",message:`Malformed data received from partner\n ${e}`})}})))}function*wp(e){for(;;){const t=yield r.take(e);t&&(yield r.put({type:pp,payload:t}))}}function*Cp(e,t){const n=yield r.call(Op,e,t),a=yield r.fork(wp,n);return function*(){n.close(),yield r.cancel(a)}}const Ap="Unknown failure reason";function*Tp(e,t,n){const{catalogItem:a,quantity:i}=n.payload,o=fo(a,i);o?(yield r.put({type:q,payload:{name:"SignalCartItemInstantPurchaseInitiated",parentGuid:a.instanceGuid,objectData:{catalogItemId:a.catalogItemId,quantity:i}}}),yield r.fork(Rp,e,t),yield r.put({type:J,payload:{name:"CART_ITEM_INSTANT_PURCHASE",body:{upsellItems:[o],totalUpsellPrice:o.totalPrice||0,currency:o.currency}}})):yield r.call(t,{level:C,code:xp,message:`Unable to translate catalog item with ID ${a.catalogItemId} to cart item for instant purchase transaction.`})}function*jp(e,t){const n=yield r.select((e=>e.staticData));if(!n)return void(yield r.call(e,{level:C,code:"MISSING_STATIC_DATA_IN_INSTANT_PURCHASE_MODULE",message:"App state is not configured with static data."}));if(!n.offer.catalogItems)return void(yield r.call(e,{level:C,code:"MISSING_CATALOG_ITEMS",message:"No catalog items found within offer data."}));const a={accountId:n.offer.accountId,catalogItems:n.offer.catalogItems};t.payload.success?yield*Np(t.payload,a,_p,e):yield*Np(t.payload,a,((e,n)=>function(e,t,n,a){return{name:"SignalCartItemInstantPurchaseFailure",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,failureReason:a.reason||Ap,providerId:n.accountId.toString()}}}(e,n,a,t.payload)),e)}function*Rp(e,t){const{unsubscriber:n,timeout:a}=yield r.race({unsubscriber:r.call(Cp,e,t),timeout:r.delay(6e4)});a&&n()}function*Np(e,t,n,a){const i=[];for(const a of e.upsellItems){const e=Dp(a,t.catalogItems);void 0===e?i.push(a):yield r.put({type:q,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:C,code:xp,message:`Unable to map cart items to catalog items in the instant purchase partner response: ${n}.`})}(i,a))}function _p(e,t){return{name:"SignalCartItemInstantPurchase",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,initiatedBy:x.DCUI}}}function Dp(e,t){return t.find((t=>t.catalogItemId===e.catalogItemId))}function*kp(e,t){yield r.all([r.takeLatest(up,Tp.bind(null,e,t)),r.takeLatest(pp,jp.bind(null,t)),r.takeEvery("*",po.bind(null,[M],e))])}Object.assign(Object.assign({},X),{INITIATE_INSTANT_PURCHASE:up,INSTANT_PURCHASE_PARTNER_RESPONSE:pp});const Pp=(new fn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=Sp({staticData:{offer:i.offerData,position:i.offerPositionIndex}}),d=function(e,t,n=Sp()){const a=l(),i=s.configureStore({reducer:Ip,devTools:{name:"Instant Purchase"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(kp,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Tn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(vi,{}),e.jsx(a.Provider,{store:d,children:e.jsx(mi,{settings:i,dispatch:d.dispatch,children:e.jsx(Ep,{})})})]})}))}}));var Lp=Object.freeze({__proto__:null,moduleConnectorBuilder:Pp});const $p=t.createContext(null),Gp=({children:n})=>{var a;const[i,o]=t.useState([]),[r,s]=t.useState(0),[l,c]=t.useState(0),d=Mt();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($p.Provider,{value:{images:i,activeIndex:r,duration:l,setImages:o,setActiveIndex:s,setDuration:c},children:e.jsx(Ft,{value:d({data:{"image.title":null===(a=i[r])||void 0===a?void 0:a.title}},"creativeCopy"),children:n})})};function Fp({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 Mp(e){const n=t.useContext(On),a=[];return e.forEach((e=>{const t=n(`${e}.src`,"copy"),i=n(`${e}.title`,"copy");if(void 0===t)return;const o=function(e={}){return Object.assign({light:"https://plus.unsplash.com/premium_photo-1675826774817-fe983ceb0475?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=200&q=80",dark:"https://images.unsplash.com/photo-1679941734238-56628f5991f7?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=200&q=80"},e)}({light:t,title:i});a.push(o)})),a}function Bp({schema:n,testId:a}){const i=JSON.parse(n.data),{styles:o,duration:r,imageKeys:s}=i,l=t.useContext($p),c=Ln(),d=Mp(s);return t.useEffect((()=>{null==l||l.setImages(d),null==l||l.setDuration(r)}),[]),e.jsxs("div",{"data-testid":a,style:Object.assign(Object.assign({position:"relative",flexShrink:1,flexGrow:0,width:"100%"},o.elements.own),c),children:[t.Children.toArray(d.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(d.map(((t,n)=>e.jsx(Fp,{duration:r,active:n===(null==l?void 0:l.activeIndex),containerStyles:o.elements.indicatorContainer,indicatorStyles:o.elements.indicator}))))})]})}const Up={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"]},Vp=new Map([["&","_;^;_"]]),zp=new RegExp(`<a *(?=${Up.allowedAttributes.a.join("|")}|>)`,"g"),qp=new RegExp("<span*>","g"),Hp=new RegExp(`<a *(?:(?:${Up.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),Wp=new RegExp("(<br *?>)|(<br *?/>)","g"),Jp="<br/>";function Kp(n){const a=Mt(),o=En(),r=Ln(),s=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Hp,((e,t)=>{const n=t.replaceAll("&",Vp.get("&"));return e.replace(t,n)})).replaceAll(Wp,Jp)}(e);return t===u(t,Up)}(e))throw new A("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:l,styles:c,isDisabled:d}=h(o),p=Object.assign(Object.assign({},c),r),f=i.isEmpty(p)?void 0:p;return s?e.jsx(ba,{styles:n.schema.styles,children:({classnames:t})=>{const a=[(null==t?void 0:t.link)?`class = "${null==t?void 0:t.link}"`:"",d?'tabindex="-1"':"",d?"style=\"pointer-events: 'none'; user-select: none;\"":"",d?'aria-disabled="true"':""].filter((e=>e.length>0));return i=s,new RegExp("</(p|ul|ol)>").test(i)?e.jsx("div",{tabIndex:l,style:f,"aria-hidden":d,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:s.replace(zp,`<a ${a.join(" ")}`).replace(qp,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}}):e.jsx("p",{tabIndex:l,style:f,"aria-hidden":d,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:s.replace(zp,`<a ${a.join(" ")}`).replace(qp,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}});var i}}):null}function Yp({schema:n}){const a=ft(),i=nt(Dn(),Ht()),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 js={name:"loading-extension",componentFactory:e=>t.createElement(Rs,{data:e}),interceptors:{}},Ls=1e3;function Ns(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()/Ls,o=t.useRef(null),r=()=>{const t=(new Date).getTime()/Ls;a(Math.max(Math.floor(e-(t-i)),0))};return t.useEffect((()=>(o.current=setInterval(r,Ls),()=>{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,Ls)}}}((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:H,payload:{name:"SignalUserInteraction",action:"TimerExpired",context:"TimerProgression"}}),d({type:"PROGRESSION/PROCESS",payload:{offerProcessStatus:"CONTINUE"}}))}),[o,r]);const u=xn(),{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 _s={name:"timer-progression-extension",componentFactory:e=>t.createElement(Ns,{data:e}),interceptors:{}},Ds="MODULE/ADD_LOADED",ks="MODULE/LOAD",Ps="PROGRESSION/INITIALISE",$s="PROGRESSION/NEXT",Gs="PROGRESSION/PREV",Fs="PROGRESSION/UPDATE_GROUP_SIZE",Ms="PROGRESSION/PROCESS",Bs="SLOTS/SET",Us="INSTANT_PURCHASE/DISMISS",Vs="OFFER_LIFECYCLE",zs="DOMAIN_STATES/SET",qs="OFFER_ENGAGEMENT",Hs="GLOBAL_OFFER_DATA_STATE/SET_CART",Ws=Object.assign(Object.assign({},qi),{NEXT_IN_PROGRESSION:$s,PREV_IN_PROGRESSION:Gs,INITIALISE_PROGRESSION:Ps,UPDATE_GROUP_SIZE:Fs,SET_SLOTS:Bs,ADD_LOADED_MODULE:Ds,SET_DOMAIN_STATE:zs,SET_GLOBAL_OFFER_DATA_CART:Hs}),Js=Object.assign(Object.assign({},Hi),{LOAD_MODULES:ks,DISMISS_INSTANT_PURCHASE:Us,PROCESS_PROGRESSION:Ms,OFFER_LIFECYCLE:Vs,OFFER_ENGAGEMENT:qs,SET_PARTNER_VALIDATION_STATUS:Q});function Ys(e,t){return t<=0||e<=0||t>e?0:Math.ceil(e/t)}function Ks(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<Ys(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 Zs=Symbol("root");function Qs(){return{[Zs]:{}}}const Xs=Object.assign({progression:function(e=null,t){switch(t.type){case Ps:if(function(e){const{totalCount:t,currentGroupIndex:n,groupSize:a}=e;return t>=0&&a>=0&&n>=0&&a<=t&&n<Ys(t,a)}(t.payload)){const{totalCount:e,_:n,groupSize:a}=t.payload;return Object.assign(Object.assign({},t.payload),{indexGroups:Ks(e,a)})}return null;case Fs:{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:Ks(a,n),currentGroupIndex:0}):null}case $s:{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,Ys(t,n)-1)}):null}case Gs:{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===Bs?t.payload:e},module:function(e={loadedModules:[]},t){return t.type===Ds?Object.assign(Object.assign({},e),{loadedModules:[...e.loadedModules,t.payload]}):e},domainStates:function(e=Qs(),t){if(t.type===zs){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:Zs;return n===Zs?e:Object.assign(Object.assign({},i.assocPath([n,t.payload.key],Number(t.payload.value),e)),{[Zs]:{}})}return e}return e},globalOfferDataState:function(e={},t){if(t.type===Hs){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}},Yo);function el(e={}){return Object.assign(Object.assign(Object.assign({},function(e={}){return Object.assign({layout:Go(),breakpoint:{breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},active:Fo(),fonts:[],signal:{queue:[],processed:[]},serializableCache:Jo(),settings:{closeOnComplete:!0},customStates:{root:{}}},e)}(e)),{progression:null,slots:[],module:{loadedModules:[]},domainStates:Qs(),globalOfferDataState:{}}),e)}function tl(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 nl(e){return e.progression?{activeGroupIndex:e.progression.currentGroupIndex,totalOffers:e.progression.totalCount,totalGroups:Ys(e.progression.totalCount,e.progression.groupSize),isLast:tl(e)}:null}function al(e,t){return e.domainStates[`module${t}`]||{offerComplete:0}}function il(e){return Object.values(e.globalOfferDataState).reduce(((e,t)=>t.cart?e+t.cart.reduce(((e,t)=>e+t.quantity),0):e),0)}function ol(n){var i;const{config:o,position:r,visible:s,container:l,testId:c}=n,d=kn(),u=xn(),p=a.useSelector(Mo),f=t.useContext(Pn),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":G(p)})]})}function rl({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=xn(),{tabIndex:d,isDisabled:u,styles:p}=m(c);return r.length&&r[l]?e.jsx(ba,{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(Si,{effect:n.transition,visible:a===l,parentElement:s.current,children:e.jsx(ol,{config:t,position:a,visible:a===l,container:"column"})}))))})}):null}const sl=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=Ys(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=xn(),{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(Mt,{children:a=>e.jsx(ba,{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 ll="partnerValidationUI",cl="stackedViewableItems";function dl(n){var o;const r=a.useDispatch(),s=a.useSelector((e=>e.slots)),l=null!==(o=n.schema.viewableItems)&&void 0!==o?o:[],c=ca(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:Pi,payload:{key:cl,value:String(d)}})}),[d]);const u=s.slice(0,d),p=xn(),{tabIndex:f,isDisabled:y,styles:h}=m(p);return(null==u?void 0:u.length)>0?e.jsx(ba,{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(ol,{config:t,position:n,visible:!0,container:"column"}))))})}):null}function ul(n){const i=n.schema.styles,o=a.useDispatch(),r=xn(),s="Backward"===n.schema.direction?"Previous":"Next",{tabIndex:l,styles:c,isDisabled:d}=m(r),u=()=>{o({type:"Backward"===n.schema.direction?Ws.PREV_IN_PROGRESSION:Ws.NEXT_IN_PROGRESSION})};return e.jsx(ba,{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(yt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}function pl({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(zo),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=xn(),{tabIndex:O,isDisabled:A,styles:T}=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:Ws.NEXT_IN_PROGRESSION}):a<i&&w({type:Ws.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(ba,{styles:n.styles,children:({classnames:n})=>e.jsx("div",{ref:x,style:Object.assign(Object.assign({},j),T),"aria-disabled":A,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(ol,{config:t,position:n,container:"row",visible:N(n)})}))))})})}):null}function fl({schema:n,testId:i}){const o=kn(),r=t.useMemo((()=>it(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=xn(),{tabIndex:p,isDisabled:f,styles:y}=m(u);return l.length?e.jsx(ba,{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(Si,{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(ol,{config:t,position:a,visible:l===d,container:"column",testId:i?`${i}-child${a}`:void 0})})))}))))})}):null}const yl={action:{CaptureOnly:"CaptureOnly",Url:"Url",Fulfillment:"Fulfillment",External:"External"},urlBehavior:{newTab:"newTab",roktWebViewSDK:"roktWebViewSDK",self:"self"},signalType:{SignalResponse:"SignalResponse",SignalGatedResponse:"SignalGatedResponse",SignalSecondaryResponse:"SignalSecondaryResponse"}};function hl(e,t,n=!1){return Error(`Could not translate ${e} with guid: ${t}${n?" for child layout":""}`)}function ml(e,t=!1){var n;try{if(e.responseOptionsMap||t)return Object.assign(Object.assign({},e),{responseOptionsMap:i.mapObjIndexed(vl,null!==(n=e.responseOptionsMap)&&void 0!==n?n:{})});{const t=`Creative: ${e.instanceGuid}, did not receive a valid response options map.`;throw new T("NO_CREATIVE_RESPONSE_OPTIONS_MAP",t)}}catch(n){throw n.message?n:hl("Creative",e.instanceGuid,t)}}function vl(e){try{let t;e.urlBehavior&&(t=yl.urlBehavior[e.urlBehavior]);return Object.assign(Object.assign({},e),{urlBehavior:t,action:yl.action[e.action],signalType:yl.signalType[e.signalType]})}catch(t){throw t.message?t:hl("CreativeResponse",e.instanceGuid)}}function gl(e,t,n){try{return JSON.parse(e)}catch(e){throw Error(`Parse JSON failed, invalid JSON file for ${t} with guid ${n}.`)}}function bl(){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 El={OneByOneDistribution:function(t){if("OneByOneDistribution"===t.type)return e.jsx(rl,{schema:t.node})},StackedDistribution:function(t){if("StackedDistribution"===t.type)return e.jsx(dl,{schema:t.node})},ProgressIndicator:function(t){if("ProgressIndicator"===t.type)return e.jsx(sl,{schema:t.node})},ProgressControl:function(t){if("ProgressControl"===t.type)return e.jsx(ul,{schema:t.node})},Overlay:function(t){if("Overlay"===t.type)return e.jsx(to,{schema:t.node})},CloseButton:function(t){if("CloseButton"===t.type)return e.jsx(Yi,{schema:t.node})},EscapeHatch:(Il=[function(t,n){if(v("CloseButton",t)){const n=JSON.parse(t.node.data);return e.jsx(Yi,{schema:n.node,action:n.action})}},ri],e=>Il.reduce(((t,n)=>void 0===t?n(e):t),void 0)),CarouselDistribution:function(t){if("CarouselDistribution"===t.type)return e.jsx(pl,{schema:t.node})},GroupedDistribution:function(t){if("GroupedDistribution"===t.type)return e.jsx(fl,{schema:t.node})},BottomSheet:function(t){if("BottomSheet"===t.type)return e.jsx(oo,{schema:t.node})}};var Il;function xl(e,t){e({type:H,payload:{name:"SignalActivation",parentGuid:t}})}function Sl({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:nl(e),customStates:e.customStates.root,domainStates:e.domainStates[Zs]})),i.equals),y=a.useSelector((e=>e.slots.length)),h=a.useSelector((e=>{var t;const n=Number(null!==(t=e.serializableCache.get(cl))&&void 0!==t?t:"");return y-n})),m=a.useSelector(il);ie(gt(),p),t.useEffect((()=>(u&&document.body.addEventListener("click",xl.bind(null,p,u.instanceGuid),{once:!0}),()=>{u&&document.body.removeEventListener("click",xl.bind(null,p,u.instanceGuid))})),[null==u?void 0:u.instanceGuid]),bl(),t.useEffect((()=>{if(u){const e={type:H,payload:{name:"SignalImpression",parentGuid:u.instanceGuid}},t={type:Vi,payload:{code:"LAYOUT_IMPRESSED"}};p(e),p(t)}}),[u]);const v=e=>{p({type:Js.REPORT_ERROR,payload:e})},g=a.useSelector((e=>e.breakpoint.initialised));if(u&&g){const t=$t({})({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=hi(v);return e.jsx(jn,{info:{layoutType:"OuterLayout",pageInstanceGuid:n},children:e.jsx(Bt,{value:t,children:e.jsx(mt,{value:a,overrides:El,children:e.jsx(ut.Provider,{value:f,children:e.jsx(ct.Provider,{value:p,children:e.jsx(qt.Provider,{value:"OUTER",children:e.jsx(Pn.Provider,{value:u.layoutSchemaVersion,children:e.jsx(yt,{children:e=>e(u.layoutSchema)})})})})})})})})}return null}var wl=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":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}}}),Cl=Object.assign({},wl);function*Ol(e,t){const n=Cl.getDistribution(t),a=null==n?void 0:n.type,i=yield r.select(zo),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:Ws.INITIALISE_PROGRESSION,payload:{currentGroupIndex:0,totalCount:e,groupSize:o}}))}function*Al(e,t){const{instanceGuid:n,layoutSchemaVersion:a,outerLayoutSchema:o,slots:r}=t.payload;n?yield c.put({type:H,payload:{name:"SignalLoadComplete",parentGuid:n}}):yield c.put({type:Ui,payload:{level:uo,code:Oo,message:"Layout instance guid does not exist"}}),yield c.put({type:ks,payload:{modules:r.map((e=>e.layoutVariant.moduleName))}}),yield c.put({type:Ri,payload:o.breakpoints}),yield c.put({type:Ws.LAYOUT_UPDATE,payload:{instanceGuid:n,layoutSchemaVersion:a,layoutSchema:o.layout,settings:o.settings}}),yield c.put({type:Ws.SET_SLOTS,payload:r}),i.isNil(o.settings)||(yield c.put({type:Ws.SET_SETTINGS,payload:o.settings})),yield*Ol(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,nr.PartnerValidationEvent.OPT_IN_TO_PARTNER_VALIDATION),yield c.spawn(Tl,e,nr.PartnerValidationEvent.SHOW_PARTNER_VALIDATION_STATUS,(()=>({type:"ACTIVE/ADD",payload:{id:ll}})))}catch(e){return yield c.put({type:Ui,payload:{level:co,code:To,message:"Failed to establish partner validation."}}),"FAILURE"}return"OK"}(e.partner,o.settings,r);"OK"===s&&(yield c.call(xr,e.display,o.display))}function*Tl(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 Rl(e){return hc(e)}function jl(e,t){return Error(`Migration process from v0_0 to v0_1 failed: could not transform ${e} node. For more details: ${t}`)}const Ll=i.all(i.anyPass([function(e){return"Row"===e.type&&kl(e.node.children)},function(e){return"Column"===e.type&&kl(e.node.children)},Fl,Ml])),Nl=i.all(i.anyPass([function(e){return"Row"===e.type&&Pl(e.node.children)},function(e){return"Column"===e.type&&Pl(e.node.children)},Ml,Fl,function(e){return"DataImage"===e.type},function(e){return"When"===e.type&&Pl(e.node.children)}])),_l=i.all(i.anyPass([function(e){return"Row"===e.type&&$l(e.node.children)},function(e){return"Column"===e.type&&$l(e.node.children)},Ml,Fl])),Dl=i.all(i.anyPass([function(e){return"Row"===e.type&&Gl(e.node.children)},function(e){return"Column"===e.type&&Gl(e.node.children)},Fl,function(e){return"RichText"===e.type},Ml,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&Gl(e.node.children)},function(e){return"StaticLink"===e.type&&Gl(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CloseButton"===e.type&&Gl(e.node.children)}]));function kl(e){return Ll(e)}function Pl(e){return Nl(e)}function $l(e){return _l(e)}function Gl(e){return Dl(e)}function Fl(e){return"StaticImage"===e.type}function Ml(e){return"BasicText"===e.type}const Bl=i.lensPath(["styles","elements","link"]),Ul=i.lensPath(["styles","elements","activeIndicator"]),Vl=i.lensPath(["styles","elements","indicator"]),zl=i.lensPath(["styles","elements","seenIndicator"]),ql=i.lensPath(["focussed"]),Hl=i.lensPath(["hovered"]),Wl=i.lensPath(["default"]),Jl=i.lensPath(["pressed"]),Yl=e=>{var t;return{text:null!==(t=null==e?void 0:e.text)&&void 0!==t?t:{}}},Kl=i.when(i.hasPath(["styles","elements","link"]),i.pipe(i.over(Bl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default})))),i.over(Bl,i.map(i.when(i.has("focussed"),i.over(ql,Yl)))),i.over(Bl,i.map(i.when(i.has("hovered"),i.over(Hl,Yl)))),i.over(Bl,i.map(i.when(i.has("default"),i.over(Wl,Yl)))),i.over(Bl,i.map(i.when(i.has("pressed"),i.over(Jl,Yl)))))),Zl=i.pipe(i.when(i.hasPath(["styles","elements","activeIndicator"]),i.over(Ul,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","indicator"]),i.over(Vl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","seenIndicator"]),i.over(zl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))));function Ql(e,t){return e?{elements:{own:e.elements.own.map(t)}}:void 0}const Xl=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),ec=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),tc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),nc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),ac=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),ic=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),oc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),rc=e=>{switch(e){case"is":return"is";case"is not":return"is-not";case"is below":return"is-below";case"is above":return"is-above";default:throw jl("When",`Invalid condition: ${e}`)}},sc=e=>{switch(e){case"breakpoint":return"Breakpoint";case"progression":return"Progression";case"position":return"Position";default:throw jl("When",`Invalid target: ${e}`)}},lc=e=>{const{target:t,condition:n,value:a}=e;return{type:sc(t),predicate:{condition:rc(n),value:a}}};function cc(e){const t={type:"FadeInOut",settings:{duration:e.transition.settings.duration}};return{styles:e.style,transition:t}}function dc(e){const t=e.children.map((e=>hc(e)));if(kl(t))return Object.assign(Object.assign({},e),{children:t,styles:Ql(e.styles,ac)});throw jl("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function uc(e){const t=e.children.map((e=>hc(e)));if(Pl(t))return Object.assign(Object.assign({},e),{children:t,styles:Ql(e.styles,ic)});throw jl("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function pc(e){const t=e.children.map((e=>hc(e)));if($l(t))return Object.assign(Object.assign({},e),{children:t,styles:Ql(e.styles,oc)});throw jl("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}const fc=e=>({own:e.overlayContainer,wrapper:e.overlayWrapper});function yc(e){var t,n;const a=(null===(t=e.styles)||void 0===t?void 0:t.elements)?{elements:fc(null===(n=e.styles)||void 0===n?void 0:n.elements)}:void 0,i=e.children.map((e=>hc(e)));if(Gl(i))return Object.assign(Object.assign({},e),{styles:a,children:i});throw jl("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function hc(e){switch(e.type){case"When":return{type:"When",node:(s=e.node,{predicates:s.predicates.map(lc),children:s.children.map((e=>hc(e)))})};case"OneByOneDistribution":return{type:e.type,node:cc(e.node)};case"Overlay":return{type:e.type,node:yc(e.node)};case"Column":return{type:e.type,node:(r=e.node,{styles:Ql(r.styles,Xl),children:r.children.map((e=>hc(e)))})};case"Row":return{type:e.type,node:(o=e.node,{styles:Ql(o.styles,ec),children:o.children.map((e=>hc(e)))})};case"RichText":return{type:e.type,node:(i=e.node,Kl(i))};case"CloseButton":return{type:e.type,node:dc(e.node)};case"CreativeResponse":return{type:e.type,node:uc(e.node)};case"StaticLink":return{type:e.type,node:pc(e.node)};case"StaticImage":return{type:e.type,node:(a=e.node,Object.assign(Object.assign({},a),{styles:Ql(a.styles,tc)}))};case"DataImage":return{type:e.type,node:(n=e.node,Object.assign(Object.assign({},n),{styles:Ql(n.styles,nc)}))};case"ProgressIndicator":return{type:e.type,node:(t=e.node,Zl(t))};default:return e}var t,n,a,i,o,r,s}function mc(e){return xd(e)}function vc(e,t){return Error(`Migration process from v0_23 to v1_0 failed: could not transform ${e} node. For more details: ${t}`)}const gc=e=>"scroll"===e||"auto"===e?"visible":e,bc=i.lensPath(["elements","own"]),Ec=i.lensPath(["transitions","transition","value","own"]),Ic=i.lensPath(["elements","wrapper"]),xc=i.lensPath(["transitions","transition","value","wrapper"]),Sc=i.lensPath(["elements","indicator"]),wc=i.lensPath(["transitions","transition","value","indicator"]),Cc=i.lensPath(["elements","activeIndicator"]),Oc=i.lensPath(["transitions","transition","value","activeIndicator"]),Ac=i.lensPath(["elements","seenIndicator"]),Tc=i.lensPath(["transitions","transition","value","seenIndicator"]),Rc=i.lensPath(["default","container","overflow"]),jc=i.lensPath(["pressed","container","overflow"]),Lc=i.lensPath(["hovered","container","overflow"]),Nc=i.lensPath(["focussed","container","overflow"]),_c=i.lensPath(["disabled","container","overflow"]),Dc=i.lensPath(["container","overflow"]),kc=i.pipe(i.when(i.hasPath(["default","container","overflow"]),i.over(Rc,gc)),i.when(i.hasPath(["pressed","container","overflow"]),i.over(jc,gc)),i.when(i.hasPath(["hovered","container","overflow"]),i.over(Lc,gc)),i.when(i.hasPath(["focussed","container","overflow"]),i.over(Nc,gc)),i.when(i.hasPath(["disabled","container","overflow"]),i.over(_c,gc))),Pc=i.when(i.hasPath(["container","overflow"]),i.over(Dc,gc)),$c=i.pipe(i.when(i.hasPath(["elements","own"]),i.over(bc,i.map(kc))),i.when(i.hasPath(["transitions","transition","value","own"]),i.over(Ec,Pc))),Gc=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)})),Fc=i.pipe($c,Gc),Mc=i.pipe(i.when(i.hasPath(["elements","wrapper"]),i.over(Ic,i.map(kc))),i.when(i.hasPath(["transitions","transition","value","wrapper"]),i.over(xc,Pc))),Bc=i.pipe(i.when(i.hasPath(["elements","indicator"]),i.over(Sc,i.map(kc))),i.when(i.hasPath(["transitions","transition","value","indicator"]),i.over(wc,Pc))),Uc=i.pipe(i.when(i.hasPath(["elements","activeIndicator"]),i.over(Cc,i.map(kc))),i.when(i.hasPath(["transitions","transition","value","activeIndicator"]),i.over(Oc,Pc))),Vc=i.pipe(i.when(i.hasPath(["elements","seenIndicator"]),i.over(Ac,i.map(kc))),i.when(i.hasPath(["transitions","transition","value","seenIndicator"]),i.over(Tc,Pc)));function zc(e){return"StaticImage"===e.type}function qc(e){return"StaticIcon"===e.type}function Hc(e){return"BasicText"===e.type}function Wc(e){return"DataImage"===e.type}function Jc(e){return"DataIcon"===e.type}function Yc(e){return"RichText"===e.type}function Kc(e){return"SlideStateTrigger"===e.type}function Zc(e){return"ToggleButtonStateTrigger"===e.type}const Qc=i.all(i.anyPass([function(e){return"Row"===e.type&&Xc(e.node.children)},function(e){return"Column"===e.type&&Xc(e.node.children)},zc,qc,Yc,Hc,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&Xc(e.node.children)},function(e){return"StaticLink"===e.type&&Xc(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&&Xc(e.node.children)},function(e){return"ProgressControl"===e.type&&cd(e.node.children)},function(e){return"ZStack"===e.type&&Xc(e.node.children)},function(e){return"FlowRow"===e.type&&Xc(e.node.children)},Kc,Zc]));function Xc(e){return Qc(e)}const ed=i.pipe($c,Mc,Gc);function td(e){const t=e.children.map((e=>xd(e)));if(Xc(t))return Object.assign(Object.assign({},i.omit(["settings"],e)),{children:t,allowBackdropToClose:e.settings.allowBackdropToClose,styles:e.styles?ed(e.styles):void 0});throw vc("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function nd(e){const t=e.children.map((e=>xd(e)));if(cd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Fc(e.styles):void 0});throw vc("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function ad(e){const t=e.children.map((e=>xd(e)));if(ud(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Fc(e.styles):void 0});throw vc("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function id(e){const t=e.children.map((e=>xd(e)));if(cd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Fc(e.styles):void 0});throw vc("ProgressControl",`Invalid schema: ${JSON.stringify(e)}`)}const od=i.pipe($c,Bc,Uc,Vc,Gc);const rd=i.all(i.anyPass([Hc,zc,qc,Wc,Jc,function(e){return"Row"===e.type&&sd(e.node.children)},function(e){return"FlowRow"===e.type&&sd(e.node.children)},function(e){return"Column"===e.type&&sd(e.node.children)},function(e){return"ZStack"===e.type&&sd(e.node.children)},function(e){return"When"===e.type&&sd(e.node.children)}]));function sd(e){return rd(e)}const ld=i.all(i.anyPass([Hc,zc,qc,function(e){return"Row"===e.type&&cd(e.node.children)},function(e){return"FlowRow"===e.type&&cd(e.node.children)},function(e){return"Column"===e.type&&cd(e.node.children)},function(e){return"ZStack"===e.type&&cd(e.node.children)},function(e){return"When"===e.type&&cd(e.node.children)}]));function cd(e){return ld(e)}const dd=i.all(i.anyPass([Hc,zc,qc,Wc,Jc,function(e){return"Row"===e.type&&ud(e.node.children)},function(e){return"FlowRow"===e.type&&ud(e.node.children)},function(e){return"Column"===e.type&&ud(e.node.children)},function(e){return"ZStack"===e.type&&ud(e.node.children)},function(e){return"When"===e.type&&ud(e.node.children)}]));function ud(e){return dd(e)}function pd(e){const t=e.children.map((e=>xd(e)));if(sd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Fc(e.styles):void 0});throw vc("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}function fd(e){const t=e.children.map((e=>xd(e)));if(ud(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Fc(e.styles):void 0});throw vc("CatalogResponseButton",`Invalid schema: ${JSON.stringify(e)}`)}function yd(e){return"Row"===e.type&&vd(e.node.children)}function hd(e){return"Column"===e.type&&vd(e.node.children)}const md=i.all(i.anyPass([Hc,zc,qc,Wc,Jc,Yc,function(e){return"StaticLink"===e.type},Kc,Zc,function(e){return"CatalogResponseButton"===e.type},yd,function(e){return"FlowRow"===e.type&&vd(e.node.children)},hd,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.anyPass([yd,hd]);function bd(e){const t=xd(e.template);if(function(e){return gd(e)}(t))return Object.assign(Object.assign({},e),{template:t,styles:e.styles?Fc(e.styles):void 0});throw vc("CatalogStackedCollection",`Invalid schema: ${JSON.stringify(e)}`)}function Ed(e){const t=e.children.map((e=>xd(e)));if(sd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Fc(e.styles):void 0});throw vc("ToggleButtonStateTrigger",`Invalid schema: ${JSON.stringify(e)}`)}function Id(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=>xd(e))),transition:t})}function xd(e){switch(e.type){case"Row":return{type:e.type,node:(g=e.node,Object.assign(Object.assign({},g),{children:g.children.map((e=>xd(e))),styles:g.styles?Fc(g.styles):void 0}))};case"When":return{type:e.type,node:Id(e.node)};case"FlowRow":return{type:e.type,node:(v=e.node,Object.assign(Object.assign({},v),{styles:v.styles?Fc(v.styles):void 0,children:v.children.map((e=>xd(e)))}))};case"Column":return{type:e.type,node:(m=e.node,Object.assign(Object.assign({},m),{children:m.children.map((e=>xd(e))),styles:m.styles?Fc(m.styles):void 0}))};case"ZStack":return{type:e.type,node:(h=e.node,Object.assign(Object.assign({},h),{styles:h.styles?Fc(h.styles):void 0,children:h.children.map((e=>xd(e)))}))};case"Overlay":return{type:e.type,node:td(e.node)};case"ProgressControl":return{type:e.type,node:id(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?Fc(y.styles):void 0}))};case"CloseButton":return{type:"CloseButton",node:nd(e.node)};case"CreativeResponse":return{type:"CreativeResponse",node:ad(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?Fc(f.styles):void 0}))};case"OneByOneDistribution":return{type:"OneByOneDistribution",node:(p=e.node,Object.assign(Object.assign({},p),{styles:p.styles?Fc(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?od(d.styles):void 0}))};case"SlideStateTrigger":return{type:"SlideStateTrigger",node:(c=e.node,Object.assign(Object.assign({},c),{styles:c.styles?Fc(c.styles):void 0}))};case"StackedDistribution":return{type:"StackedDistribution",node:(l=e.node,Object.assign(Object.assign({viewableItems:[]},l),{styles:l.styles?Fc(l.styles):void 0}))};case"StaticLink":return{type:"StaticLink",node:pd(e.node)};case"ToggleButtonStateTrigger":return{type:"ToggleButtonStateTrigger",node:Ed(e.node)};case"CatalogResponseButton":return{type:"CatalogResponseButton",node:fd(e.node)};case"CatalogStackedCollection":return{type:"CatalogStackedCollection",node:bd(e.node)};case"RichText":return{type:"RichText",node:(s=e.node,Object.assign(Object.assign({},s),{styles:s.styles?Gc(s.styles):void 0}))};case"DataImage":return{type:"DataImage",node:(r=e.node,Object.assign(Object.assign({},r),{styles:r.styles?Gc(r.styles):void 0}))};case"StaticImage":return{type:"StaticImage",node:(o=e.node,Object.assign(Object.assign({},o),{styles:o.styles?Gc(o.styles):void 0}))};case"DataIcon":return{type:"DataIcon",node:(a=e.node,Object.assign(Object.assign({},a),{styles:a.styles?Gc(a.styles):void 0}))};case"StaticIcon":return{type:"StaticIcon",node:(n=e.node,Object.assign(Object.assign({},n),{styles:n.styles?Gc(n.styles):void 0}))};case"BasicText":return{type:"BasicText",node:(t=e.node,Object.assign(Object.assign({},t),{styles:t.styles?Gc(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 Sd(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 wd(e,t){return e.major===t.major&&e.minor===t.minor}const Cd=(e,t,n)=>i.allPass([i.lte(e),i.gte(t)])(n);function Od(e,t){return wd(t,{major:0,minor:0})?Od(Rl(e),{major:0,minor:1}):function(e,t){return 0===t.major&&Cd(1,23,t.minor)}(0,t)?Od(mc(e),{major:1,minor:0}):e}function Ad(e,t){return wd(t,{major:0,minor:0})?Ad(function(e){return Object.assign(Object.assign({},e),{layout:Rl(e.layout)})}(e),{major:0,minor:1}):function(e,t){return 0===t.major&&Cd(1,23,t.minor)}(0,t)?Ad(function(e){return Object.assign(Object.assign({},e),{layout:mc(e.layout)})}(e),{major:1,minor:0}):e}function Td(e,t,n,a){const i=Sd(n);if(a){const s=Sd(a);if(r=i,(o=s).major<r.major||o.major===r.major&&o.minor<r.minor||wd(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,Sd("0.0"));var o,r}function Rd(e){var t;try{return Object.assign(Object.assign({},i.clone(e)),{offer:Object.assign(Object.assign({},i.clone(e.offer)),{creative:ml(e.offer.creative)}),layoutVariant:Object.assign(Object.assign({},i.clone(e.layoutVariant)),{layoutVariantSchema:"string"==typeof e.layoutVariant.layoutVariantSchema?gl(e.layoutVariant.layoutVariantSchema,"LayoutSlotLayoutVariant",e.instanceGuid):e.layoutVariant.layoutVariantSchema,childLayouts:i.map(jd,null!==(t=e.layoutVariant.childLayouts)&&void 0!==t?t:[])})})}catch(t){throw t.message?t:hl("Slot",e.instanceGuid)}}function jd(e){return Object.assign(Object.assign({},i.clone(e)),{childLayoutSchema:"string"==typeof e.childLayoutSchema?gl(e.childLayoutSchema,"ChildLayoutRootSchema",e.childLayoutId):e.childLayoutSchema})}function Ld(e){if(e){const t=function(e){try{return Object.assign(Object.assign({},i.clone(e)),{outerLayoutSchema:"string"==typeof e.outerLayoutSchema?gl(e.outerLayoutSchema,"LayoutRootLayoutSchema",e.instanceGuid):e.outerLayoutSchema,slots:i.map(Rd,e.slots)})}catch(t){throw t.message?t:hl("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=>Td(e,Od,t,n))))),i.over(a,(e=>Td(e,Ad,t,n))))(e)}(t,yo.DCUI_SCHEMA_VERSION)}}const Nd=i.cond([[i.where({signalType:i.equals("SignalSecondaryResponse")}),function*(e,t){return yield r.put({type:Ui,payload:{level:po,code:wo,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:H,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(lr,t),i=pr(a)?a.ref:void 0;return yield r.call(e.addAdvertiserWindowRef,i,n),pr(a)||"newTab"!==t.urlBehavior?"SUCCESS":(yield r.put({type:Ui,payload:{level:po,code:Co,message:`Did not receive a window reference opening link ${t.url}`}}),"UNSPECIFIED")}catch(e){return yield r.put({type:Ui,payload:{level:po,code:Co,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:Ui,payload:{level:po,code:wo,message:"URL response doesn't have a valid url",additionalInformation:{instanceGuid:e.instanceGuid}}}),"ERROR"}],[i.T,function*(){return"EXPLICIT_DISMISSAL"}]]);function*_d(e){return yield r.put({type:Ui,payload:{level:po,code:wo,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}function*Dd(e,t){let n="IMPLICIT_DISMISSAL";const a=t.payload.offerPositionIndex,i=z(t.payload)||q(t.payload)||V(t.payload)?t.payload:t.payload.responseOption;switch(i.action){case"Url":yield r.put({type:Y,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:Vi,payload:{code:"CREATIVE_RESPONSE",message:"creative positive response",data:{type:i.action,isPositive:i.isPositive,responseInstanceGuid:i.instanceGuid}}}),yield r.put({type:Y,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*_d(i):yield*Nd(i,e.context,e.partner);break;case"CaptureOnly":yield r.put({type:Y,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:Y,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*_d(i):yield*function*(e){return yield r.put({type:H,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:Ui,payload:{level:po,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:Ui,payload:{level:po,code:"INCORRECTLY_HANDLE_EXTERNAL_ACTION",message:`External action was dispatched as an engagement erroneously. Instance GUID: ${i.instanceGuid}`}}),n="ERROR"}Io(t.payload)||(yield r.put(function(e,t){switch(e){case"SUCCESS":return{type:Vs,payload:{event:"Completed",completionReason:"Success",offerPositionIndex:t}};case"UNSPECIFIED":return{type:Vs,payload:{event:"Completed",completionReason:"Unspecified",offerPositionIndex:t}};case"ERROR":return{type:Vs,payload:{event:"Completed",completionReason:"Error",offerPositionIndex:t}};case"EXPLICIT_DISMISSAL":return{type:Vs,payload:{event:"Dismissed",dismissalReason:"Explicit",offerPositionIndex:t}};case"IMPLICIT_DISMISSAL":return{type:Vs,payload:{event:"Dismissed",dismissalReason:"Implicit",offerPositionIndex:t}};default:return{type:Ms,payload:{offerProcessStatus:"END"}}}}(n,a)))}function kd(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:Ui,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:Ui,payload:{level:O,code:"FAILED_TO_LOAD_MODULE",message:t,additionalInformation:{stack:a,reason:t?void 0:e,moduleName:n}}}),i(l.END)})),()=>{})))}const Pd={"standard-marketing":()=>Promise.resolve().then((function(){return $u})),"add-to-cart":()=>Promise.resolve().then((function(){return Gp})),"instant-purchase":()=>Promise.resolve().then((function(){return pf})),"layouts-xp-sandbox":()=>Promise.resolve().then((function(){return zf}))};function*$d(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(Gd,e,t,i))}function*Gd(e,t,n){if(n in Pd){yield r.put({type:Ds,payload:n});const a=yield r.call(kd,e,t,n,Pd[n]);yield r.call(xo,a)}else yield r.put({type:Ui,payload:{level:co,code:"INVALID_MODULE_NAME",message:`Could not load unknown module ${n}`}})}function*Fd(e){const t=yield r.select((e=>Cl.getDistributionViewableItems(e.layout?Cl.getDistribution(e.layout.layoutSchema):void 0))),n=yield r.select((n=>{var a;const i=Vo(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:Fs,payload:{groupSize:n}};yield r.put(e)}}const Md=i.cond([[(e,t,n,a)=>"END"===e.offerProcessStatus,i.always({type:_i})],[(e,t,n,a)=>t.isLastOffer&&n,i.always({type:_i})],[(e,t,n,a)=>1===a&&!t.isLastOffer,i.always({type:$s})],[i.T,i.always(void 0)]]);function*Bd(e){const t=yield r.select((e=>({exists:null!==e.progression,isLastOffer:tl(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=Md(e,t,"boolean"==typeof a&&a,n);i&&(i.type===_i&&(yield r.put({type:Y,payload:{name:"PLACEMENT_COMPLETED"}})),yield r.put(i))}(e.payload,t,n))}function Ud(e){return e.type===Vs&&"Interactive"===e.payload.event}function Vd(e){return e.type===Vs&&"Interactive"!==e.payload.event}function*zd(e){switch(e.payload.event){case"Dismissed":yield r.put({type:Ms,payload:{offerProcessStatus:"CONTINUE"}});break;case"Completed":yield r.put({type:zs,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:Ms,payload:{offerProcessStatus:"CONTINUE"}});break;case"Interactive":yield r.put({type:M,payload:{name:"Interactive",offerPositionIndex:e.payload.offerPositionIndex}}),yield r.put({type:Y,payload:{name:"PLACEMENT_INTERACTIVE"}})}}function*qd(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,nr.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:Ui,payload:{level:A,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*Hd(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:Ws.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:_i}),t?(yield r.put({type:H,payload:{name:"SignalInstantPurchaseDismissal",parentGuid:t}}),yield r.put({type:H,payload:{name:"SignalDismissal",parentGuid:t}})):yield r.put({type:Ui,payload:{level:uo,code:Oo,message:"ParentGuid does not exist"}})}function*Wd(e,t){yield r.all([r.takeEvery(Ui,So.bind(null,e.errorService.raise)),r.takeLatest(Ni,Al.bind(null,{display:e.displayService,partner:e.partnerInteractionService})),r.takeEvery(ks,$d.bind(null,t,e.contextService)),r.takeLatest(qs,Dd.bind(null,{partner:e.partnerInteractionService,context:e.contextService})),r.takeEvery(Ms,Bd),r.takeEvery(Vd,zd),Eo(Ud,zd),r.takeLatest(Ri,Ko.bind(null,e.displayService)),r.takeLatest(_i,mr.bind(null,e.contextService)),r.takeLatest(Us,Hd),r.takeLatest(Bi,Br),r.takeEvery(H,wr),r.takeEvery(K,Cr),bo(M,Fr.bind(null,e.metricsService)),bo(Mi,Or.bind(null,e.rdnService)),r.takeEvery(Vi,Sr.bind(null,e.errorService.raise)),r.takeLatest(Ai,Fd),r.takeEvery(J,Gr),r.takeEvery(Z,Mr.bind(null,{createChildPlugin:e.childPlugin.create,partner:e.partnerInteractionService,context:e.contextService})),r.takeLatest(Q,qd.bind(null,{partner:e.partnerInteractionService,context:e.contextService}))])}var Jd,Yd,Kd,Zd,Qd,Xd=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},eu=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 tu={[te.SET_CUSTOM_STATE]:Ws.SET_CUSTOM_STATE,[te.SET_DOMAIN_STATE]:Ws.SET_DOMAIN_STATE,[te.SET_GLOBAL_OFFER_DATA_CART]:Ws.SET_GLOBAL_OFFER_DATA_CART,[te.OFFER_LIFECYCLE]:Js.OFFER_LIFECYCLE,[te.OFFER_ENGAGEMENT]:Js.OFFER_ENGAGEMENT,[te.SET_PARTNER_VALIDATION_STATUS]:Js.SET_PARTNER_VALIDATION_STATUS};class nu{constructor(e){Jd.add(this),Yd.set(this,void 0),Xd(this,Yd,e,"f")}getState(e){const t=eu(this,Yd,"f").getState();return{breakpoint:t.breakpoint,progression:nl(t),customStates:qo(t,e.offerPositionIndex),domainStates:al(t,e.offerPositionIndex)}}dispatch(e,t){eu(this,Yd,"f").dispatch(eu(this,Jd,"m",Qd).call(this,e,t))}subscribe(e,t){return t(this.getState(e)),eu(this,Yd,"f").subscribe((()=>{t(this.getState(e))}))}}function au(e,t){const n=l(),a={},i=s.configureStore({reducer:Xs,devTools:{name:"Orchestrator"},preloadedState:Object.assign(Object.assign({},el()),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 nu(e)}(i),c=e.childPlugin.create,d=e.partnerInteractionService.onEvent,(e,t)=>new on(r,c,e,t,d));var r,c,d;n.run(Wd,e,o),n.run(Er,e,Ld);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({},Xs),u)))),t&&Object.assign(a,t),o&&n.run(o)}})}Yd=new WeakMap,Jd=new WeakSet,Kd=function(e,t,n){return{type:e,payload:Object.assign(Object.assign({},t),{offerPositionIndex:n.offerPositionIndex,creativeInstanceGuid:n.creativeInstanceGuid})}},Zd=function(e,t){return t.type===K?t.payload.signal.parentGuid||(t.payload.signal.parentGuid=e.creativeInstanceGuid):(t.payload.creativeInstanceGuid=e.creativeInstanceGuid,t.payload.parentGuid||(t.payload.parentGuid=e.creativeInstanceGuid)),t},Qd=function(e,t){return function(e){return e.type in tu}(t)?eu(this,Jd,"m",Kd).call(this,tu[t.type],t.payload,e):t.type===H||t.type===K?eu(this,Jd,"m",Zd).call(this,e,t):t};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 ou={ctx:new Map([[_s.name,_s],[js.name,js],[ps.name,ps],[Is.name,Is]]),cache:[]};class ru{constructor(){this._subscribers=[]}add(e){this._subscribers.push(e)}unsubscribe(){this._subscribers.forEach((e=>e.unsubscribe()))}}const su=()=>{},lu=(e=su,t=su,n=su)=>"function"!=typeof e?e:{next:e,error:t,complete:n};class cu{constructor(e){this._setupFn=e}subscribe(e,t,n){const a=lu(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 ru;return s.add({unsubscribe:()=>{i&&i(),o=!1}}),s}}class du extends cu{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 cu((e=>{const t=this.subscribe(e);return()=>t.unsubscribe()}))}}const uu={CompletedBeforeEmit:"CompletedBeforeEmit"};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())}))};class fu{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)=>pu(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 yu{constructor(e){this.value=e,this.complete=!1,this.skip=!1}}var hu=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 mu={getBreakpointCSSClass:G},vu="CHILD_LAYOUTS/ADD_LAUNCHED",gu="DYNAMIC_DATA/ADD";function bu(e={launched:{}},t){if(t.type===vu){const n=t.payload;return n.childLayoutId?i.assocPath(["launched",n.childLayoutId],n.shouldRelaunch,e):e}return e}function Eu(e=null,t){return e}function Iu(e,t){var n;return null===(n=e.childLayouts.launched[t])||void 0===n||n}function xu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer}function Su(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.schemaVersion}function wu(e){var t,n;return null!==(n=null===(t=e.dynamicData)||void 0===t?void 0:t.text)&&void 0!==n?n:{}}const Cu="FAILED_TO_LAUNCH_CHILD_LAYOUT";function*Ou(e,t,n){var a;if(yield null===(a=r.select(Iu,n.payload.childLayoutId))||void 0===a||a){const a=yield r.select(Su),o=yield r.select(xu),s=yield r.select(wu);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:A,code:Cu,message:"Could not launch child layout, failed creating plugin."})}}catch(e){yield r.call(t,{level:A,code:Cu,message:"Could not launch child layout, failed to make the child layout config serializable."})}yield r.put({type:vu,payload:{childLayoutId:n.payload.childLayoutId,shouldRelaunch:!1}})}var i}function Au(){const t=En(),n=a.useSelector(wu),i=Ut()({state:n},"textContent");return e.jsx(Bt,{value:i,children:e.jsx(yt,{children:e=>e(t)})})}const Tu={staticData:Eu,dynamicData:function(e=null,t){if(t.type===gu){const n=t.payload;return e?n?i.mergeDeepRight(e,n):e:n}return e},childLayouts:bu};function Ru(e={}){return Object.assign({staticData:null,dynamicData:null,childLayouts:{launched:{}}},e)}function ju(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 Lu(e){return"object"==typeof e&&null!==e&&Object.entries(e).every((([e,t])=>"string"==typeof e&&"string"==typeof t))}function*Nu(e,t){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:W,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":t({type:W,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:W,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*_u(e,t){const n=function(e){return l.eventChannel((t=>{const n=e.onEvent({name:ir,source:"partner",callback:e=>{Lu(e)&&t({eventName:ir,data:e})}},{name:or,source:"partner",callback:e=>{Lu(e)&&t({eventName:or,data:e})}});return()=>{n()}}))}(e);try{for(;;){const a=yield r.take(n);switch(a.eventName){case ir:yield r.put({type:Y,payload:{name:ir,body:a.data}}),yield r.put({type:gu,payload:{text:a.data}}),e.globalDispatch({type:W,payload:{event:"Completed",completionReason:"Success"}});break;case or:e.globalDispatch({type:W,payload:{event:"Completed",completionReason:"Error"}});break;default:t({level:O,code:"UNKNOWN_REALTIME_OFFER_FULFILLMENT_EVENT",message:`Unknown event: ${a.eventName}`})}}}catch(e){const n=e;t({level:A,code:"FAILED_TO_PROCESS_REALTIME_OFFER_FULFILLMENT_EVENT",message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&n.close()}}function*Du(e,t,n){const a=z(n.payload)||q(n.payload)||V(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":yield r.call(e.globalDispatch.bind(e),n),Io(n.payload)&&(yield r.put({type:Y,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:a.accountID,referralCreativeID:a.referralCreativeID}}}),yield r.call(_u,e,t));break;case"CaptureOnly":yield r.call(e.globalDispatch.bind(e),n);break;case"Fulfillment":yield r.put({type:Y,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:Y,payload:{name:"POSITIVE_ENGAGEMENT"}})),yield*function*(e,t,n){if(U(n)){const{responseOption:a,fulfillment:i}=n;yield r.put({type:H,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(ju,o);if("object"==typeof t&&"take"in t)return void(yield r.call(Nu,t,e.globalDispatch.bind(e)))}yield r.call(t,{level:O,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:O,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}(e,t,n.payload)}}function*ku(e,t){yield r.all([r.takeLatest(B,Du.bind(null,e,t)),r.takeEvery(ee,Ou.bind(null,e,t)),r.takeEvery("*",ho.bind(null,[B,ee],e))])}Object.assign({},te);const Pu=(new hn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=Ru({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=Ru()){const a=l(),i=s.configureStore({reducer:Tu,devTools:{name:"Standard Marketing"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(ku,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(jn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Ei,{}),e.jsx(a.Provider,{store:d,children:e.jsx(gi,{settings:i,dispatch:d.dispatch,children:e.jsx(Au,{})})})]})}))}}));var $u=Object.freeze({__proto__:null,moduleConnectorBuilder:Pu});const Gu="CART/UPDATE",Fu="CATALOG_ITEM/RESPONSE",Mu="USER_CREATIVE_RESPONSE_HISTORY/ADD",Bu=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 Uu({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 Vu="catalogRadioGroup__label",zu=["Enter","Space"],qu={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 Hu(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 Wu({schema:n,testId:i}){const o=a.useDispatch(),r=_n(),[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,Hu(n.validations,n.options.length,i)]})),c=xn(),{tabIndex:d,styles:u,isDisabled:p}=m(c);t.useEffect((()=>{p||o(Ju(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:Fu,payload:{catalogItem:r,quantity:e}});const t=Hu(n.validations,n.options.length,e);o(Ju(t))}return f.length>0?e.jsx(ba,{styles:n.styles?$(qu,n.styles):qu,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(zt,{value:a(Vu),children:t.Children.toArray(f.map(((t,a)=>{var o;const l=Bu(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:`${Vu} ${null!==(o=null==n?void 0:n.optionContainer)&&void 0!==o?o:""}`,onKeyDown:e=>{l||!zu.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(Uu,{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(wi,{schema:t,testId:c("Content")})]})})))})})}):null}function Ju(e){return{type:Q,payload:{errors:e}}}function Yu(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Ku(t){const n=a.useDispatch(),i=ht(),o=_n(),r=xn(),{tabIndex:s,styles:l,isDisabled:c}=m(r);return e.jsx(ba,{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:Fu,payload:{catalogItem:o,quantity:1}})},className:null==a?void 0:a.own,children:Yu(t.schema.children,i,t.testId)})})}const Zu={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"]},Qu=new Map([["&","_;^;_"]]),Xu=new RegExp(`<a *(?=${Zu.allowedAttributes.a.join("|")}|>)`,"g"),ep=new RegExp(`<a *(?:(?:${Zu.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),tp=new RegExp("(<br *?>)|(<br *?/>)","g"),np=new RegExp(`<ul *(?=${Zu.allowedAttributes.ul.join("|")}|>)`,"g"),ap=new RegExp(`<ol *(?=${Zu.allowedAttributes.ol.join("|")}|>)`,"g"),ip=new RegExp("<li *(?=>|\\s[^>]*>)","g"),op="<br/>";function rp(n){const a=Ut(),i=xn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(ep,((e,t)=>{const n=t.replaceAll("&",Qu.get("&"));return e.replace(t,n)})).replaceAll(tp,op)}(e);return t===u(t,Zu)}(e))throw new T("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(ba,{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(Xu,`<a ${a.join(" ")}`).replace(np,`<ul ${i}`).replace(ap,`<ol ${i}`).replace(ip,`<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 sp={internally:"_top",externally:"_blank"};function lp(t,n,a,i,o){return e.jsx(zt,{value:a(n),children:cp(t,i,o)})}function cp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function dp(t){var n,i;const o=sp[t.schema.open],r=ht(),s=_n(),l=xn(),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(ba,{styles:t.schema.styles,children:({classnames:n,mapperRef:a})=>{var i;return e.jsx("a",{href:d,onClick:()=>{var e;c({type:H,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)?lp(t.schema.children,null==n?void 0:n.own,a,r,t.testId):cp(t.schema.children,r,t.testId)})}}):null}function up(e,t){const n=e.cart[t];return n||null}function pp(e){var t,n;const a=null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[],i=function(e){return Object.values(e.cart).filter((e=>null!==e))}(e);return i.filter((e=>a.find((t=>t.catalogItemId===e.catalogItemId))))}function fp(e,t){var n,a,i,o;const r=null===(n=e.staticData)||void 0===n?void 0:n.offer;if(r){const n=function(e){return pp(e).reduce(((e,t)=>e+t.quantity),0)}(e),s=up(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 yp(e){var t,n;const a=null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[];return a.length>0?a:null}function hp(e,t){var n,a;return null!==(a=null===(n=yp(e))||void 0===n?void 0:n.find((e=>e.catalogItemId===t)))&&void 0!==a?a:null}function mp(e){var t;const n=null===(t=yp(e))||void 0===t?void 0:t.filter((e=>e.preSelectedQuantity&&e.preSelectedQuantity>0));return n&&n.length>0?n:null}function vp(e){var t,n;return null!==(n=null===(t=mp(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 gp=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 bp(t,n,a,i,o){return e.jsx(zt,{value:a(n),children:i(t,void 0,o)})}function Ep(e,t,n){return t(e,void 0,n)}function Ip(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=_n(),g=ht(),b=Ut(),E=xn(),{tabIndex:I,styles:x,isDisabled:S}=m(E),w=a.useSelector((e=>function(e,t){var n,a,i;const o=hp(e,t);return Boolean(o&&(null!==(n=o.preSelectedQuantity)&&void 0!==n?n:0)>0&&o.preSelectedQuantity===(null!==(a=o.minItemCount)&&void 0!==a?a:0)&&o.preSelectedQuantity===(null!==(i=o.maxItemCount)&&void 0!==i?i:0))}(e,v.catalogItemId))),C=a.useSelector((e=>up(e,v.cartItemId))),O=a.useSelector((e=>fp(e,v))),A=(null==C?void 0:C.quantity)||0,T=m(S||A<=(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:Fu,payload:{catalogItem:v,quantity:e}})};return e.jsx(ba,{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(Ra,{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({},T.styles),{cursor:T.isDisabled?"not-allowed":"pointer",pointerEvents:"auto"}),onClick:e=>{e.preventDefault(),N(A-1)},tabIndex:T.tabIndex,"aria-label":y||void 0,disabled:T.isDisabled,"data-testid":o?`${o}-decrement-button`:void 0,children:e.jsx(Bt,{value:b,children:(null==t?void 0:t.decrementButton)?bp(p,t.decrementButton,n,g,o):Ep(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:A,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:A}),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(A+1)},tabIndex:R.tabIndex,"aria-label":f||void 0,disabled:R.isDisabled,"data-testid":o?`${o}-increment-button`:void 0,children:e.jsx(Bt,{value:b,children:(null==t?void 0:t.incrementButton)?bp(u,t.incrementButton,n,g,o):Ep(u,g,o)})}):null]})})})}const xp={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(Ku,{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(rp,{schema:n.node});case"CatalogUrlLink":return e.jsx(dp,{schema:n.node});default:return}}},CatalogRadioGroup:function(t){if("CatalogRadioGroup"===t.type)return e.jsx(Wu,{schema:t.node})},CatalogQuantityCounter:function(t){if("CatalogQuantityCounter"===t.type)return e.jsx(Ip,{schema:t.node})}};function Sp(){const t=En(),n=ht();return e.jsx(mt,{value:n,overrides:xp,children:e.jsx(yt,{children:e=>e(t)})})}const wp={cart:function(e={},t){if(t.type===Gu){const{catalogItem:n,quantity:a}=t.payload,i=n.cartItemId,o=mo(n,a);return Object.assign(Object.assign({},e),{[i]:o})}return e},userCreativeResponseHistory:function(e=[],t){return t.type===Mu?e.concat(t.payload.responseId):e},staticData:Eu,childLayouts:bu};const Cp="INVALID_PARTNER_MESSAGE",Op="MISCONFIGURED_CATALOG_ITEM",Ap="FAILED_TO_PROCESS_PARTNER_UPDATE_CART_ITEM";function*Tp(e){var t,n;const a=yield r.select(mp),i=yield r.select(vp),o=yield r.select((e=>{var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer.maxTotalItemsQtyInOffer}));if(_p(i)&&_p(o)&&i>o)yield r.call(e,{level:A,code:Op,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:A,code:Op,message:`Preselected quantity (${a}) is greater than maxItemCount (${o}) for catalog item (${i.instanceGuid})`}):yield*Np(i,a,!0)}}function*Rp(e,t,n){const{catalogItem:a,quantity:i}=n.payload;if(yield*Np(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){switch(e.action){case"Fulfillment":{const n=null==t?void 0:t.creative.fulfillment;return b(n)?{type:B,payload:{fulfillment:n,responseOption:e}}:`Could not get fulfillment for response (instanceGuid: ${e.instanceGuid})`}case"Url":return(null==t?void 0:t.accountId)?{type:B,payload:Object.assign(Object.assign({},e),{accountID:null==t?void 0:t.accountId})}:`Could not get accountId for response (instanceGuid: ${e.instanceGuid})`;default:return{type:B,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:A,code:"INVALID_RESPONSE_OBJECT",message:n}))}var o}function*jp(e,t){const n=function(e,t){return l.eventChannel((n=>{const a=e.onEvent({name:er.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:A,code:Cp,message:`Invalid UpdateCartItemPartnerMessageBody: ${JSON.stringify(e)}`}):n(e)}});return()=>{a()}}))}(e,t);try{for(;;){const e=yield r.take(n);yield r.call(Lp,e,t)}}catch(e){const n=e;t({level:A,code:Ap,message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&n.close()}}function*Lp(e,t){const{cartItemId:n,quantity:a}=e,i=yield r.select(up,n);if(Dp(i)){const e=yield r.select(hp,i.catalogItemId);null!==(o=e)&&"object"==typeof o&&"catalogItemId"in o&&"price"in o?yield*Np(e,a,!1):yield r.call(t,{level:A,code:Ap,message:`Catalog item not found for cart item id (${n})`})}else yield r.call(t,{level:A,code:Ap,message:`Cart item not found for cart item id (${n})`});var o}function*Np(e,t,n){var a;const i=yield r.select(up,e.cartItemId),o=yield r.select(fp,e),s=_p(o)?o:0,l=Dp(i)?i.quantity:0;if(t!==l&&t>=(null!==(a=e.minItemCount)&&void 0!==a?a:0)&&t-l<=s){yield r.put({type:Gu,payload:{catalogItem:e,quantity:t}});const a=yield r.select(up,e.cartItemId),o=yield r.select(gp);return yield r.put({type:X,payload:{cart:o}}),yield r.put({type:H,payload:{name:"SignalCartItemQuantitySelected",parentGuid:e.instanceGuid,objectData:{quantity:t,preselected:n}}}),yield r.put({type:Y,payload:{name:"V2_CART_ITEM_UPDATED",body:{oldCartItem:i,cartItem:a}}}),!0}return!1}function _p(e){return"number"==typeof e}function Dp(e){return null!=e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&"unitPrice"in e}function*kp(e,t){var n;yield r.put({type:Mu,payload:{responseId:(n=t.payload,U(n)?n.responseOption.id:n.id)}}),yield r.call(e.globalDispatch.bind(e),t)}function*Pp(e,t){yield r.all([r.spawn(Tp.bind(null,t)),r.spawn(jp.bind(null,e,t)),r.takeLatest(Fu,Rp.bind(null,e,t)),r.takeLatest(B,kp.bind(null,e)),r.takeEvery(ee,Ou.bind(null,e,t)),r.takeEvery("*",ho.bind(null,[B,ee],e))])}Object.assign(Object.assign({},te),{CATALOG_ITEM_RESPONSE:Fu});const $p=(new hn).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:wp,devTools:{name:"Add To Cart"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Pp,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(jn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Ei,{}),e.jsx(a.Provider,{store:d,children:e.jsx(gi,{settings:i,dispatch:d.dispatch,children:e.jsx(Sp,{})})})]})}))}}));var Gp=Object.freeze({__proto__:null,moduleConnectorBuilder:$p});const Fp="CATALOG/SET_SELECTED_ITEM",Mp="INSTANT_PURCHASE/INITIATE",Bp="INSTANT_PURCHASE/PARTNER_RESPONSE";function Up(t,n,a,i,o){return e.jsx(zt,{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 zp(t){const n=a.useDispatch(),i=ht(),o=xn(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=_n(),d=$t(c,"catalogItem");return e.jsx(ba,{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:Mp,payload:{catalogItem:c,quantity:1}})},className:null==a?void 0:a.own,children:e.jsx(Bt,{value:d,children:(null==a?void 0:a.own)?Up(t.schema.children,a.own,o,i,t.testId):Vp(t.schema.children,i,t.testId)})})})}const qp=["ArrowDown","ArrowUp","Enter","Escape"];function Hp(n){const i=It(),o=Tn(),r=ht(),s=Ut(),l=i.catalogItems||[],c=xn(),{styles:d,isDisabled:u}=m(c),p=a.useDispatch(),f=a.useSelector((e=>e.selectedItem)),y=l.map(((e,t)=>({catalogItem:e,index:t}))),h=t.useRef(null),v=t.useRef([]),[g,b]=t.useState(!1),[E,I]=t.useState(f?{catalogItem:f,index:l.findIndex((e=>e.catalogItemId===f.catalogItemId))}:null),[x,S]=t.useState(E?E.index:null);function w(){u||(g?O():C())}function C(){u||b(!0)}function O(){u||(b(!1),S(null))}function A(e){I(e),O(),p({type:Fp,payload:e.catalogItem})}t.useEffect((()=>{g&&j(E?E.index:0)}),[g,E]);const T={elements:{own:[{default:{background:{backgroundColor:{light:"#ffffff"}},border:{borderColor:{light:"#D0D5DD"},borderRadius:4,borderStyle:"solid",borderWidth:"1"},dimension:{width:{type:"percentage",value:100}},spacing:{padding:"10"}}}]}};function R(e){if(!u)if(g){if(qp.includes(e.key))switch(e.preventDefault(),e.key){case"ArrowDown":null!==x&&x!==y.length-1&&j(x+1);break;case"ArrowUp":null!==x&&0!==x&&j(x-1);break;case"Enter":if(null!==x){const e=y[x];e&&(A(e),L())}break;case"Escape":O(),L()}}else"Enter"===e.key&&C()}function j(e){const t=v.current[e];null!=t&&(S(e),t.focus())}function L(e){e&&e.preventDefault(),h.current&&h.current.focus()}function N(t){return e.jsx(Nn,{context:t.catalogItem,children:e.jsx(An,{value:o(t.catalogItem),children:e.jsx(Bt,{value:(n=t.catalogItem,s({data:n},"catalogItem")),children:r(t.schema,void 0,t.testId)})})});var n}function _(){const t=n.testId?`${n.testId}-child-label`:"closed-drop-down-child-label";return f?N({catalogItem:f,schema:n.schema.closedTemplate,testId:t}):e.jsx(mt,{value:r,children:e.jsx(yt,{children:e=>e(n.schema.closedDefaultTemplate,void 0,t)})})}return e.jsx(ba,{styles:n.schema.styles?$(T,n.schema.styles):T,children:({classnames:t})=>e.jsxs("div",{ref:h,className:null==t?void 0:t.own,onKeyDown:R,onMouseDown:L,onClick:w,onBlur:e=>{var t;(null===(t=h.current)||void 0===t?void 0:t.contains(e.relatedTarget))||g&&O()},"data-e2e":"DropDown","aria-disabled":u,style:Object.assign({position:"relative"},d),tabIndex:0,children:[e.jsx("div",{className:null==t?void 0:t.dropDownSelectedElement,"aria-disabled":u,style:d,children:_()}),g&&e.jsx("ul",{className:null==t?void 0:t.dropDownListContainer,onClick:e=>e.stopPropagation(),style:Object.assign({listStyle:"none",margin:0,padding:0,zIndex:9999,position:"absolute",top:"100%",left:0,right:0,backgroundColor:"white",boxShadow:"0 2px 5px rgba(0,0,0,0.2)"},d),children:y.map(((a,i)=>e.jsx("li",{ref:e=>function(e,t){v.current[t]=e}(e,i),className:null==t?void 0:t.dropDownListElement,onClick:e=>{e.stopPropagation(),u||A(a)},tabIndex:-1,"data-e2e":"DropDownItem",style:Object.assign({cursor:"pointer"},d),children:N({catalogItem:a.catalogItem,schema:n.schema.openTemplate,testId:n.testId?`${n.testId}-child-${i}`:`opened-drop-down-child-${i}`})},a.catalogItem.catalogItemId)))})]})})}function Wp(n){const i=ht(),o=Tn(),r=Ut(),s=dt(),l=It().catalogItems||[],c=a.useSelector((e=>e.selectedItem))||l[0];return t.useEffect((()=>{c&&s({type:H,payload:{name:"SignalImpression",parentGuid:null==c?void 0:c.instanceGuid}})}),[c,s]),c?e.jsx(ba,{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(Nn,{context:c,children:e.jsx(An,{value:o(c),children:e.jsx(Bt,{value:(s=c,r({data:s},"catalogItem")),children:i(n.schema.template,void 0,n.testId?`${n.testId}-child`:"")})})}))});var s}}):null}function Jp(n){const{schema:{imageKeys:a,styles:i},testId:o}=n,[r,s]=t.useState(0),l=xn(),c=function(e){const n=t.useContext(On);return e.reduce(((e,t)=>{const a=n(`${t}.src`,"copy"),i=n(`${t}.title`,"copy");return void 0===a?e:[...e,x({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(ba,{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 Yp={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(zp,{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"DropDown":return e.jsx(Hp,{schema:n.node});case"CatalogCombinedCollection":return e.jsx(Wp,{schema:n.node});case"ImageGallery":return e.jsx(Jp,{schema:n.node});default:return}}}};function Kp(){const t=En(),n=ht();return e.jsx(mt,{value:n,overrides:Yp,children:e.jsx(yt,{children:e=>e(t)})})}const Zp={staticData:Eu,selectedItem:(e=null,t)=>t.type===Fp?t.payload:e,childLayouts:bu};function Qp(e={}){return Object.assign({staticData:null,selectedItem:null,childLayouts:{launched:{}}},e)}const Xp="INVALID_RESPONSE_OBJECT";function ef(e,t){return l.eventChannel((n=>e.onEvent({name:tr.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:A,code:"MALFORMED_PARTNER_DATA",message:`Malformed data received from partner\n ${e}`})}})))}function*tf(e,t){var n;try{for(;;){const t=yield r.take(e);t&&(yield r.put({type:Bp,payload:t}))}}catch(e){yield r.call(t,{level:A,code:"INSTANT_PURCHASE_CHANNEL_ERROR",message:null!==(n=e.message)&&void 0!==n?n:"Unknown error in instant-purchase channel"})}finally{e.close()}}const nf="Unknown failure reason";function*af(e,t,n){const{catalogItem:a,quantity:i}=n.payload,o=mo(a,i);o?(yield r.put({type:H,payload:{name:"SignalCartItemInstantPurchaseInitiated",parentGuid:a.instanceGuid,objectData:{catalogItemId:a.catalogItemId,quantity:i}}}),yield r.fork(rf,e,t),yield r.put({type:Y,payload:{name:"CART_ITEM_INSTANT_PURCHASE",body:{upsellItems:[o],totalUpsellPrice:o.totalPrice||0,currency:o.currency}}})):yield r.call(t,{level:A,code:Xp,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:A,code:"MISSING_STATIC_DATA_IN_INSTANT_PURCHASE_MODULE",message:"App state is not configured with static data."}),void(yield*cf("Error"));if(!n.offer.catalogItems)return yield r.call(e,{level:A,code:"MISSING_CATALOG_ITEMS",message:"No catalog items found within offer data."}),void(yield*cf("Error"));const a={accountId:n.offer.accountId,catalogItems:n.offer.catalogItems};let i,o;t.payload.success?(i=sf,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||nf,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=lf(a,t.catalogItems);void 0===e?i.push(a):yield r.put({type:H,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:A,code:Xp,message:`Unable to map cart items to catalog items in the instant purchase partner response: ${n}.`})}(i,a))}(t.payload,a,i,e),yield*cf(o)}function*rf(e,t){const n=ef(e,t),{timeout:a}=yield r.race({channelListener:r.call(tf,n,t),timeout:r.delay(6e4)});a&&(yield r.call(t,{level:A,code:"INSTANT_PURCHASE_RESPONSE_TIMEOUT",message:"Instant-purchase response timed out after 60000ms"}),n.close(),yield r.put({type:W,payload:{event:"Dismissed",dismissalReason:"Implicit"}}))}function sf(e,t){return{name:"SignalCartItemInstantPurchase",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,initiatedBy:w.DCUI}}}function lf(e,t){return t.find((t=>t.catalogItemId===e.catalogItemId))}function*cf(e){yield r.put({type:W,payload:{event:"Completed",completionReason:e}})}function*df(e,t){yield r.all([r.takeLatest(Mp,af.bind(null,e,t)),r.takeLatest(Bp,of.bind(null,t)),r.takeEvery(ee,Ou.bind(null,e,t)),r.takeEvery("*",ho.bind(null,[B,ee],e))])}Object.assign(Object.assign({},te),{INITIATE_INSTANT_PURCHASE:Mp,INSTANT_PURCHASE_PARTNER_RESPONSE:Bp});const uf=(new hn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=Qp({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=Qp()){const a=l(),i=s.configureStore({reducer:Zp,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(jn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Ei,{}),e.jsx(a.Provider,{store:d,children:e.jsx(gi,{settings:i,dispatch:d.dispatch,children:e.jsx(Kp,{})})})]})}))}}));var pf=Object.freeze({__proto__:null,moduleConnectorBuilder:uf});const ff=t.createContext(null),yf=({children:n})=>{var a;const[i,o]=t.useState([]),[r,s]=t.useState(0),[l,c]=t.useState(0),d=Ut();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(ff.Provider,{value:{images:i,activeIndex:r,duration:l,setImages:o,setActiveIndex:s,setDuration:c},children:e.jsx(Bt,{value:d({data:{"image.title":null===(a=i[r])||void 0===a?void 0:a.title}},"creativeCopy"),children:n})})};function hf({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(On),a=[];return e.forEach((e=>{const t=n(`${e}.src`,"copy"),i=n(`${e}.title`,"copy");if(void 0===t)return;const o=x({light:t,title:i});a.push(o)})),a}function vf({schema:n,testId:a}){const i=JSON.parse(n.data),{styles:o,duration:r,imageKeys:s}=i,l=t.useContext(ff),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(hf,{duration:r,active:n===(null==l?void 0:l.activeIndex),containerStyles:o.elements.indicatorContainer,indicatorStyles:o.elements.indicator}))))})]})}const gf={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([["&","_;^;_"]]),Ef=new RegExp(`<a *(?=${gf.allowedAttributes.a.join("|")}|>)`,"g"),If=new RegExp("<span*>","g"),xf=new RegExp(`<a *(?:(?:${gf.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),Sf=new RegExp("(<br *?>)|(<br *?/>)","g"),wf="<br/>";function Cf(n){const a=Ut(),i=xn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(xf,((e,t)=>{const n=t.replaceAll("&",bf.get("&"));return e.replace(t,n)})).replaceAll(Sf,wf)}(e);return t===u(t,gf)}(e))throw new T("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(ba,{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(Ef,`<a ${a.join(" ")}`).replace(If,`<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(Ef,`<a ${a.join(" ")}`).replace(If,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}});var i}}):null}function Of({schema:n}){const a=ht(),i=it(kn(),Jt()),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`
|
|
127
137
|
position: relative;
|
|
128
138
|
`,"data-testid":"ProductTierCarousel",children:e.jsx("div",Object.assign({},c&&{ref:r},{className:i`
|
|
129
139
|
width: 100%;
|
|
@@ -162,24 +172,24 @@
|
|
|
162
172
|
background-color: ${(null===(d=null==s?void 0:s.primaryColor)||void 0===d?void 0:d.light)||"#F9FAFB"};
|
|
163
173
|
color: #f9fafb;
|
|
164
174
|
}
|
|
165
|
-
`,children:t.Children.toArray(n.map((e=>a(e))))})})))})}))})}const
|
|
166
|
-
${
|
|
167
|
-
`,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
|
|
168
|
-
${
|
|
169
|
-
`,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
|
|
175
|
+
`,children:t.Children.toArray(n.map((e=>a(e))))})})))})}))})}const Af=(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 Tf({disabled:t,onClick:n}){const a=it(kn(),Jt());return e.jsx("button",{onClick:n,disabled:t,className:a`
|
|
176
|
+
${Af(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 Rf({disabled:t,onClick:n}){const a=it(kn(),Jt());return e.jsx("button",{onClick:n,disabled:t,className:a`
|
|
178
|
+
${Af(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 jf(e){const n=t.useContext(On);return e.map((e=>({src:n(`${e}.link.src`,"copy"),open:n(`${e}.link.open`,"copy")})))}function Lf(e){return{type:"StaticImage",node:{url:e,styles:{elements:{own:[{default:{border:{borderRadius:5,borderWidth:"0"},dimension:{width:{type:"percentage",value:100}}}}]}}}}}function Nf(e,t){return{type:"CreativeResponse",node:{responseKey:"positive",styles:{elements:{own:[{default:{spacing:{padding:"0"},background:{backgroundColor:{light:"#F9FAFB"}},border:{borderWidth:"0"}}}]}},children:t?[Lf(t)]:[]}}}function _f({schema:n}){var a,i;const o=ht(),r=it(kn(),Jt()),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)||[]),jf((null===(i=null==s?void 0:s.body)||void 0===i?void 0:i.imageKeys)||[])],u=It(),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`
|
|
170
180
|
position: relative;
|
|
171
181
|
margin: 8px 0;
|
|
172
|
-
${
|
|
173
|
-
`,
|
|
182
|
+
${y||""}
|
|
183
|
+
`,children:[v?e.jsx(Tf,{onClick:S,disabled:I}):null,e.jsx("div",Object.assign({},v&&{ref:b},{className:r`
|
|
174
184
|
width: 100%;
|
|
175
185
|
margin: auto;
|
|
176
186
|
overflow: hidden;
|
|
177
|
-
`,children:e.jsx("div",{className:
|
|
187
|
+
`,children:e.jsx("div",{className:r`
|
|
178
188
|
display: flex;
|
|
179
189
|
gap: 16px;
|
|
180
|
-
`,children:t.Children.toArray(
|
|
190
|
+
`,children:t.Children.toArray(g.map(((t,n)=>{var a,i;const s=Object.assign(Object.assign({},p),{url:null===(a=null==c?void 0:c[n])||void 0===a?void 0:a.src}),l=Object.assign(Object.assign({},u),{creative:Object.assign(Object.assign({},u.creative),{responseOptionsMap:Object.assign(Object.assign({},u.creative.responseOptionsMap),{positive:s})})});return e.jsx(Et,{context:l,children:e.jsx("div",{"data-testid":"carousel-item",className:r`
|
|
181
191
|
min-width: 0;
|
|
182
192
|
overflow: hidden;
|
|
183
|
-
aspect-ratio: ${
|
|
184
|
-
${
|
|
185
|
-
`,children:o((null===(i=null==
|
|
193
|
+
aspect-ratio: ${m};
|
|
194
|
+
${v?"flex: 0 0 33%;":`width: ${100/h}%;`}
|
|
195
|
+
`,children:o((null===(i=null==c?void 0:c[n])||void 0===i?void 0:i.src)?Nf(c[n],t):Lf(t))})})})))})})),v?e.jsx(Rf,{onClick:w,disabled:x}):null]}):null}function Df({schema:t}){const n=JSON.parse(t.data),{styles:a,content:i,smallFontSize:o,largeFontSize:r}=n,s=Ut(),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 kf={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(vf,{schema:t.node});case"RichText":return e.jsx(Cf,{schema:n.node});case"ProductTierCarousel":return e.jsx(Of,{schema:t.node});case"ProductCatalogCarousel":return e.jsx(_f,{schema:t.node});case"TextAnimate":return e.jsx(Df,{schema:t.node});default:return}}}};function Pf(){const t=En(),n=ht();return e.jsx(yf,{children:e.jsx(mt,{value:n,overrides:kf,children:e.jsx(yt,{children:e=>e(t)})})})}const $f={staticData:Eu,childLayouts:bu};function Gf(e={}){return Object.assign({staticData:null,childLayouts:{launched:{}}},e)}function Ff(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*Mf(e,t){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:W,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":t({type:W,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:W,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*Bf(e,t,n){const a=z(n.payload)||q(n.payload)||V(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:Y,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:Y,payload:{name:"POSITIVE_ENGAGEMENT"}})),yield*function*(e,t,n){if(U(n)){const{responseOption:a,fulfillment:i}=n;yield r.put({type:H,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(Ff,o);if("object"==typeof t&&"take"in t)return void(yield r.call(Mf,t,e.globalDispatch.bind(e)))}yield r.call(t,{level:O,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:O,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}(e,t,n.payload)}}function*Uf(e,t){yield r.all([r.takeLatest(B,Bf.bind(null,e,t)),r.takeEvery(ee,Ou.bind(null,e,t)),r.takeEvery("*",ho.bind(null,[B,ee],e))])}Object.assign({},te);const Vf=(new hn).withAppFactory((function(i){if(i.rootElement){const o=n.createRoot(i.rootElement),r=Gf({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),c=function(e,t,n=Gf()){const a=l(),i=s.configureStore({reducer:$f,devTools:{name:"layouts-xp-sandbox"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Uf,e,t),i}(i.gateway,i.logger,r);o.render(e.jsx(t.StrictMode,{children:e.jsxs(jn,{info:{layoutType:"LayoutVariant",referralCreativeId:String(i.offerData.creative.referralCreativeId)||"N/A"},children:[e.jsx(Ei,{}),e.jsx(a.Provider,{store:c,children:e.jsx(gi,{settings:i,dispatch:c.dispatch,children:e.jsx(Pf,{})})})]})}))}}));var zf=Object.freeze({__proto__:null,moduleConnectorBuilder:Vf});exports.BehaviorSubject=class extends du{constructor(e){super(),this._lastValue=e}subscribe(e,t,n){const a=lu(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=fu,exports.DisplayPreset={FULLSCREEN:"DisplayPreset.FULLSCREEN",EMBEDDED:"DisplayPreset.EMBEDDED",ATTACHED:"DisplayPreset.ATTACHED"},exports.ErrorLevel={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},exports.FirstValueFromError=uu,exports.Observable=cu,exports.ReplaySubject=class extends du{constructor(e=-1){super(),this._buffer=[],this._error=null,this._bufferLength=e}subscribe(e,t,n){const a=lu(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=du,exports.Subscription=ru,exports.addCatchToSubscriber=function(e,t){return new fu(e,t)},exports.combineLatest=(...e)=>new cu((t=>{if(!e.length)return t.complete(),su;const n=new ru,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=mu,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(uu.CompletedBeforeEmit))}))})).finally((()=>n.unsubscribe()))},exports.fromEvent=(e,t)=>new cu((n=>{const a=e=>n.next(e);return e.addEventListener(t,a),()=>e.removeEventListener(t,a)})),exports.fromPromise=function(e){return new cu((t=>{e.then((e=>{t.next(e),t.complete()}),(e=>t.error(e)))}))},exports.init=function(i,o){return iu(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:S.pluginId,pageInstanceGuid:"fulfilled"===t.status?t.value:S.pageInstanceGuid}))).catch((()=>S))}(o),l=n.createRoot(i),c=au(o);l.render(e.jsxs(t.StrictMode,{children:[e.jsx(Ei,{}),e.jsx(a.Provider,{store:c,children:e.jsxs(Dn.Provider,{value:r,children:[e.jsx($o,{}),e.jsx(vt.Provider,{value:i,children:e.jsx(ai,{extensions:ou,extendStore:c.extend.bind(c),children:e.jsx(Sl,{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 yu(n)},exports.merge=(...e)=>new cu((t=>{const n=new ru;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=su,exports.normaliseToObserver=lu,exports.of=(...e)=>new cu((t=>{for(const n of e)t.next(n)})),exports.pipe=e=>(...t)=>new cu((n=>{const a=e.subscribe((e=>hu(void 0,void 0,void 0,(function*(){try{let a=new yu(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);
|