@encorekit/web-sdk 2.0.7 → 2.1.1
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/README.md +6 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/umd/encore.min.js +1 -1
- package/dist/umd/encore.min.js.map +1 -1
- package/package.json +1 -1
- package/types/api/APIClient.d.ts +18 -0
- package/types/api/APIClient.d.ts.map +1 -1
- package/types/api/generated/types.d.ts +177 -2
- package/types/api/generated/types.d.ts.map +1 -1
- package/types/api/models.d.ts +32 -0
- package/types/api/models.d.ts.map +1 -1
- package/types/core/Encore.d.ts.map +1 -1
- package/types/core/giftVariant.d.ts +67 -0
- package/types/core/giftVariant.d.ts.map +1 -0
- package/types/core/version.d.ts +1 -1
- package/types/types.d.ts +31 -3
- package/types/types.d.ts.map +1 -1
- package/types/ui/GiftHero.d.ts +75 -0
- package/types/ui/GiftHero.d.ts.map +1 -0
- package/types/ui/GiftList.d.ts +110 -0
- package/types/ui/GiftList.d.ts.map +1 -0
- package/types/ui/GiftReveal.d.ts +133 -0
- package/types/ui/GiftReveal.d.ts.map +1 -0
- package/types/ui/GiftSheet.d.ts +126 -0
- package/types/ui/GiftSheet.d.ts.map +1 -0
- package/types/ui/GiftUnwrap.d.ts +155 -0
- package/types/ui/GiftUnwrap.d.ts.map +1 -0
- package/types/ui/OfferCarousel.d.ts +10 -3
- package/types/ui/OfferCarousel.d.ts.map +1 -1
- package/types/ui/OfferModal.d.ts +7 -0
- package/types/ui/OfferModal.d.ts.map +1 -1
- package/types/ui/RewardActions.d.ts +88 -4
- package/types/ui/RewardActions.d.ts.map +1 -1
- package/types/ui/RewardCard.d.ts +16 -8
- package/types/ui/RewardCard.d.ts.map +1 -1
- package/types/ui/RewardConfetti.d.ts +23 -1
- package/types/ui/RewardConfetti.d.ts.map +1 -1
- package/types/ui/RewardLayout.d.ts +35 -0
- package/types/ui/RewardLayout.d.ts.map +1 -1
- package/types/ui/advertiserPreconnect.d.ts +90 -0
- package/types/ui/advertiserPreconnect.d.ts.map +1 -0
- package/types/ui/appearance.d.ts +27 -0
- package/types/ui/appearance.d.ts.map +1 -1
- package/types/ui/focusable.d.ts +41 -0
- package/types/ui/focusable.d.ts.map +1 -0
- package/types/ui/giftCategoryGroups.d.ts +21 -0
- package/types/ui/giftCategoryGroups.d.ts.map +1 -0
- package/types/ui/giftCopy.d.ts +215 -0
- package/types/ui/giftCopy.d.ts.map +1 -0
- package/types/ui/giftUnwrapArt.d.ts +55 -0
- package/types/ui/giftUnwrapArt.d.ts.map +1 -0
- package/types/ui/giftUnwrapCopy.d.ts +57 -0
- package/types/ui/giftUnwrapCopy.d.ts.map +1 -0
- package/types/ui/impressionGate.d.ts +63 -0
- package/types/ui/impressionGate.d.ts.map +1 -0
- package/types/ui/offerBadge.d.ts +56 -0
- package/types/ui/offerBadge.d.ts.map +1 -0
- package/types/ui/rewardSurface.d.ts +82 -0
- package/types/ui/rewardSurface.d.ts.map +1 -0
- package/types/ui/safeImageSrc.d.ts +10 -0
- package/types/ui/safeImageSrc.d.ts.map +1 -1
- package/types/ui/styles.d.ts +166 -0
- package/types/ui/styles.d.ts.map +1 -1
- package/types/ui/termsLine.d.ts +33 -0
- package/types/ui/termsLine.d.ts.map +1 -0
package/dist/umd/encore.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Encore={})}(this,function(e){"use strict";var t;!function(e){e.NETWORK_ERROR="NETWORK_ERROR",e.API_ERROR="API_ERROR",e.CONFIGURATION_ERROR="CONFIGURATION_ERROR",e.INITIALIZATION_ERROR="INITIALIZATION_ERROR",e.STORAGE_ERROR="STORAGE_ERROR",e.INVALID_REQUEST="INVALID_REQUEST",e.UNAUTHORIZED="UNAUTHORIZED",e.NOT_FOUND="NOT_FOUND",e.TIMEOUT="TIMEOUT",e.UNKNOWN_ERROR="UNKNOWN_ERROR"}(t||(t={}));const n={reduceChurn:"churn-intervention",rewardUsers:"post-action-reward"},r=Object.fromEntries(Object.entries(n).map(([e,t])=>[t,e])),i=Object.keys(n);function o(e){return n[e]}function s(e){if(e)return r[e]}function a(e){return"string"==typeof e?`'${e.slice(0,64)}'`:typeof e}function l(e){return i.includes(e)}const c=["none","error","warn","info","debug"],d="[Encore SDK]",h=e=>c.indexOf(e),u=new class{#e="none";setLogLevel(e){this.#e=e}getLogLevel(){return this.#e}#t(e){return h(this.#e)>=h(e)}debug(...e){this.#t("debug")&&console.debug(d,...e)}info(...e){this.#t("info")&&console.info(d,...e)}warn(...e){this.#t("warn")&&console.warn(d,...e)}error(...e){this.#t("error")&&console.error(d,...e)}critical(...e){console.error(d,"[CRITICAL]",...e)}};class p{#n=null;#r=!1;configure(e){if(this.#r)return u.warn("SDK already configured. Ignoring subsequent configure() call."),!1;const t=this.#i(e);if(t)return u.error("Invalid configuration:",t),!1;const n=e.logLevel??"none",r=e.environment??"production";return this.#n={apiKey:e.apiKey,environment:r,baseURL:this.#o(r),analyticsBaseURL:this.#s(r),logLevel:n,unlockMode:e.unlockMode??"optimistic"},u.setLogLevel(n),this.#r=!0,u.debug("SDK configured successfully",this.#n),!0}#i(e){return e.apiKey&&"string"==typeof e.apiKey&&""!==e.apiKey.trim()?e.environment&&!["production","development","staging","localhost"].includes(e.environment)?"environment must be 'production', 'development', 'staging', or 'localhost'":e.logLevel&&!c.includes(e.logLevel)?`logLevel must be one of: ${c.join(", ")}`:e.unlockMode&&!["strict","optimistic"].includes(e.unlockMode)?"unlockMode must be 'strict' or 'optimistic'":null:"apiKey is required and must be a non-empty string"}#o(e){switch(e){case"localhost":return"http://localhost:4000/publisher/sdk/v1";case"development":return"https://api.dev.encorekit.com/encore/publisher/sdk/v1";case"staging":return"https://api.staging.encorekit.com/encore/publisher/sdk/v1";default:return"https://api.encorekit.com/encore/publisher/sdk/v1"}}#s(e){switch(e){case"localhost":return"http://localhost:8081/v1";case"development":return"https://api.dev.encorekit.com/analytics/v1";case"staging":return"https://api.staging.encorekit.com/analytics/v1";default:return"https://api.encorekit.com/analytics/v1"}}getConfig(){return this.#n}isConfigured(){return this.#r}getApiKey(){return this.#n?.apiKey??null}getBaseURL(){return this.#n?.baseURL??null}getAnalyticsBaseURL(){return this.#n?.analyticsBaseURL??null}getEnvironment(){return this.#n?.environment??null}getUnlockMode(){return this.#n?.unlockMode??"optimistic"}reset(){this.#n=null,this.#r=!1,u.debug("Configuration reset")}}const m="encore_";class f{#a;#l;constructor(){this.#l=new Map,this.#a=this.#c(),u.debug(`StorageManager initialized with ${this.#a}`)}#c(){return this.#d("localStorage")?"localStorage":this.#d("sessionStorage")?"sessionStorage":(u.warn("Neither localStorage nor sessionStorage available, using in-memory storage"),"memory")}#d(e){try{const t="localStorage"===e?localStorage:sessionStorage,n="__encore_test__";return t.setItem(n,"test"),t.removeItem(n),!0}catch{return!1}}#h(){return"localStorage"===this.#a?localStorage:"sessionStorage"===this.#a?sessionStorage:this.#l}#u(e){return`${m}${e}`}set(e,t){if(void 0===t)return void u.warn(`Attempted to store undefined value for key: ${e}`);const n=this.#u(e),r=JSON.stringify(t);try{const t=this.#h();t instanceof Map?t.set(n,r):t.setItem(n,r),u.debug(`Stored ${e} in ${this.#a}`)}catch(e){e instanceof Error&&"QuotaExceededError"===e.name?u.error("Storage quota exceeded:",e):u.error("Failed to store item:",e),"memory"!==this.#a&&(u.warn("Falling back to memory storage for this item"),this.#l.set(n,r))}}get(e){const t=this.#u(e);try{const n=this.#h();let r=null;return r=n instanceof Map?n.get(t)??null:n.getItem(t),null===r||"undefined"===r?("undefined"===r&&(u.warn(`Found corrupted value "undefined" for key: ${e}, cleaning up`),this.remove(e)),null):JSON.parse(r)}catch(t){return u.error(`Failed to retrieve ${e}:`,t),this.remove(e),null}}remove(e){const t=this.#u(e);try{const n=this.#h();n instanceof Map?n.delete(t):n.removeItem(t),u.debug(`Removed ${e} from ${this.#a}`)}catch(t){u.error(`Failed to remove ${e}:`,t)}}clear(){try{const e=this.#h();if(e instanceof Map)for(const t of e.keys())t.startsWith(m)&&e.delete(t);else{const t=[];for(let n=0;n<e.length;n++){const r=e.key(n);r?.startsWith(m)&&t.push(r)}t.forEach(t=>e.removeItem(t))}u.debug(`Cleared all Encore data from ${this.#a}`)}catch(e){u.error("Failed to clear storage:",e)}}getStorageType(){return this.#a}}const g="signal_queue";class b{#p;#m;#f;#g=[];#b=!1;#v;constructor(e,t,n){this.#p=e,this.#m=t,this.#f=n,this.#w(),this.#y(),this.processQueue()}setUserId(e){this.#f!==e&&(u.debug("SignalManager: User ID changed, clearing queue"),this.#f=e,this.#g=[],this.#w())}#w(){try{const e=`${this.#f}_${g}`,t=this.#p.get(e);t&&Array.isArray(t)&&(this.#g=t,u.debug("Loaded grant signal queue from storage",{count:t.length}))}catch(e){u.error("Failed to load grant signal queue from storage:",e)}}#x(){try{const e=`${this.#f}_${g}`;this.#p.set(e,this.#g),u.debug("Saved grant signal queue to storage",{count:this.#g.length})}catch(e){u.error("Failed to save grant signal queue to storage:",e)}}enqueue(e,t){const n=this.#g.some(n=>n.transactionId===e&&n.grantType===t);if(n)return void u.debug("Grant signal already in queue, skipping",{transactionId:e,grantType:t});const r={transactionId:e,grantType:t,timestamp:(new Date).toISOString(),attempts:0};this.#g.push(r),this.#x(),u.info("Grant signal added to queue",{transactionId:e,grantType:t})}dequeue(e){const t=this.#g.findIndex(t=>t.transactionId===e.transactionId&&t.grantType===e.grantType);-1!==t&&(this.#g.splice(t,1),this.#x(),u.debug("Grant signal removed from queue",{transactionId:e.transactionId,grantType:e.grantType}))}getQueue(){return[...this.#g]}clearQueue(){this.#g=[],this.#x(),u.debug("Grant signal queue cleared")}async sendGrantSignal(e,t){try{if(u.debug("Sending grant signal",{transactionId:e,grantType:t}),!await this.#m.sendGrantSignal(e,t))throw new Error("Grant signal failed (returned false)");u.info("Grant signal sent successfully",{transactionId:e,grantType:t})}catch{u.warn("Failed to send grant signal, adding to queue",{transactionId:e,grantType:t}),this.enqueue(e,t)}}async processQueue(){if(this.#b)u.debug("Queue processing already in progress, skipping");else if(0!==this.#g.length){this.#b=!0,u.info("Processing grant signal queue",{count:this.#g.length});try{for(const e of[...this.#g])await this.#I(e),this.#g.length>1&&await this.#C(100)}finally{this.#b=!1}}}async#I(e){if(e.attempts>=3)return u.error("Grant signal max attempts reached, removing from queue",{transactionId:e.transactionId,grantType:e.grantType,attempts:e.attempts}),void this.dequeue(e);if(e.lastAttemptAt){const t=new Date(e.lastAttemptAt).getTime(),n=Date.now(),r=1e3*Math.pow(2,e.attempts-1),i=n-t;if(i<r)return void u.debug("Skipping signal, waiting for backoff period",{transactionId:e.transactionId,remainingWait:r-i})}e.attempts++,e.lastAttemptAt=(new Date).toISOString(),this.#x();try{u.debug("Attempting to send queued grant signal",{transactionId:e.transactionId,grantType:e.grantType,attempt:e.attempts}),await this.#m.sendGrantSignal(e.transactionId,e.grantType)?(u.info("Queued grant signal sent successfully",{transactionId:e.transactionId,grantType:e.grantType}),this.dequeue(e)):u.warn("Grant signal failed, will retry",{transactionId:e.transactionId,attempt:e.attempts})}catch(t){u.warn("Failed to send queued grant signal, will retry",{transactionId:e.transactionId,attempt:e.attempts,error:t})}}#y(){this.#v=function(e){const t=()=>{u.debug("Network status: online"),e()};return window.addEventListener("online",t),()=>{window.removeEventListener("online",t)}}(()=>{u.debug("Network came online, processing grant signal queue"),this.processQueue()})}destroy(){this.#v&&(this.#v(),this.#v=void 0)}#C(e){return new Promise(t=>setTimeout(t,e))}}function v(...e){for(const t of e){const e=t?.trim();if(e)return e}}function w(e){const t=v(e);return t?.slice(0,64)}const y={userClosedModal:"close_button",userClickedOutside:"dismissed",userDeclinedLastOffer:"last_offer_declined",error:"interrupted",appBackgrounded:"app_backgrounded",appTerminated:"app_terminated"};function x(e){if(null!=e)return y[e]??e}function I(e){return e?{use_case:o(e)}:{}}function C(e){const t=w(e);return t?{placement_id:t}:{}}function k(e,t,n,r,i,o){return{name:"sdk_offer_presentation_failed",distinctId:e,properties:{reason:t,presentationId:n,...r&&{variantId:r},...I(i),...C(o)}}}function E(e,t){const{useCase:n,placementId:r,...i}=t;return{name:"sdk_offer_time_spent",distinctId:e,properties:{...i,...I(n),...C(r)}}}function $(e){const{useCase:t,placementId:n,...r}=e,i={};for(const e in r){const t=r[e];void 0!==t&&(i[e]=t)}return{...i,...I(t),...C(n)}}function S(e,t){return{name:"sdk_sdui_button_tapped",distinctId:e,properties:{...t.variantId&&{variantId:t.variantId},actionType:t.actionType,presentationId:t.presentationId,currentState:t.currentState,...I(t.useCase),...C(t.placementId)}}}function A(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=15&(crypto.getRandomValues(new Uint8Array(1))[0]??0);return("x"===e?t:3&t|8).toString(16)})}class T{#m;#k;#f;#E=[];#$=null;#S=null;#A=null;#T=new Map;#R=0;#N;#U;#L;#O=null;#_=!1;#P=null;constructor(e,t,n){this.#m=e,this.#f=t,this.#k=n??null,this.#M()}async fetchOffers(e,t=!0,n,r){const i=void 0!==r;if(!i&&t&&this.#E.length>0&&this.#$)return u.debug("Using cached offers",{count:this.#E.length}),{offers:[...this.#E]};try{u.debug("Fetching offers from API",{userId:this.#f,maxPostbackTimeMs:r});const t=await this.#m.fetchOffers(this.#f,e,n,r);return 0===t.offers?.length?(u.info("No offers available for user"),i||(this.#E=[],this.#$=Date.now()),{offers:[]}):(i||(this.#E=t.offers,this.#$=Date.now()),u.info("Offers fetched successfully",{count:t.offers.length,offerIds:t.offers.map(e=>e.id)}),{offers:[...t.offers]})}catch(e){throw u.error("Failed to fetch offers",e),e}}beginPresentation(e,t,n,r){return this.#S=r??A(),this.#A=Date.now(),this.#T.clear(),this.#R=0,this.#O=null,this.#N=e,this.#U=t,this.#L=n,this.#_=!1,this.#S}get placementId(){return this.#L}get presentationId(){return this.#S}#D(){return this.#N?{variantId:this.#N}:{}}#z(){return this.#L?{placementId:this.#L}:{}}trackOfferPresented(e,t,n,r,i){if(!this.#k||!this.#S)return;this.#R++,this.#O&&this.#O!==e.id&&this.trackOfferViewEnd(this.#O),this.#O=e.id;const o=this.#T.get(e.id);o?(o.viewCount++,o.startTime=Date.now()):this.#T.set(e.id,{startTime:Date.now(),totalTime:0,viewCount:1,reported:!1}),this.#k.track(function(e,t){const{useCase:n,placementId:r,...i}=t;return{name:"sdk_offer_presented",distinctId:e,properties:{...i,...I(n),...C(r)}}}(this.#f,{campaignId:e.campaignId,creativeId:e.creativeId,...null!=e.merchantName&&{advertiserName:e.merchantName},impressionId:t,offerIndex:n,totalOffers:r,presentationId:this.#S,...this.#D(),...this.#z(),...i&&{useCase:i}}))}trackOfferViewEnd(e){const t=this.#T.get(e);t&&t.startTime>0&&(t.totalTime+=(Date.now()-t.startTime)/1e3,t.startTime=0)}trackOfferClaimed(e,t,n,r,i,o){this.#k&&this.#S&&this.#k.track(function(e,t){const{useCase:n,placementId:r,...i}=t;return{name:"sdk_offer_claimed",distinctId:e,properties:{...i,...I(n),...C(r)}}}(this.#f,{campaignId:e.campaignId,creativeId:e.creativeId,...null!=e.merchantName&&{advertiserName:e.merchantName},impressionId:t,transactionId:n,offerIndex:r,totalOffers:i,presentationId:this.#S,...this.#D(),...this.#z(),...o&&{useCase:o}}))}trackOfferDeclined(e,t,n,r,i,o){if(!this.#k||!this.#S)return;const s=x(i);this.#k.track(function(e,t){const{useCase:n,placementId:r,...i}=t;return{name:"sdk_offer_declined",distinctId:e,properties:{...i,...I(n),...C(r)}}}(this.#f,{campaignId:e.campaignId,creativeId:e.creativeId,...null!=e.merchantName&&{advertiserName:e.merchantName},impressionId:t,offerIndex:n,totalOffers:r,...null!=s&&{declineReason:s},presentationId:this.#S,...this.#D(),...this.#z(),...o&&{useCase:o}}))}endPresentation(e,t){this.#F(e,t,!1),this.#S=null,this.#A=null,this.#T.clear(),this.#R=0,this.#O=null,this.#N=void 0,this.#U=void 0,this.#L=void 0,this.#_=!1}#F(e,t,n,r=!0){if(!this.#k||!this.#S||!this.#A)return;const i=Date.now(),o=(i-this.#A)/1e3,s=n?{keepalive:!0}:void 0;for(const[e,n]of this.#T){let r=n.totalTime;if(n.startTime>0&&(r+=(i-n.startTime)/1e3),n.reported&&r<=0)continue;n.reported=!0;const o=this.#E.find(t=>t.id===e),a=o?this.#E.indexOf(o):0;this.#k.track(E(this.#f,{campaignId:o?.campaignId??"",offerIndex:a,timeSpentSeconds:r,viewCount:n.viewCount,totalOffers:this.#E.length,presentationId:this.#S,...this.#D(),...this.#z(),...t&&{useCase:t}}),s),n.totalTime=0,n.startTime>0&&(n.startTime=i)}if(!r||this.#_)return;this.#_=!0;const a=x(e);this.#k.track(function(e,t){const{useCase:n,placementId:r,...i}=t;return{name:"sdk_offer_sheet_dismissed",distinctId:e,properties:{...i,...I(n),...C(r)}}}(this.#f,{presentationId:this.#S,totalTimeSpentSeconds:o,totalOffers:this.#E.length,offersViewed:this.#R,...null!=a&&{declineReason:a},...this.#D(),...this.#z(),...t&&{useCase:t}}),s)}flushForPageLifecycle(e,t){try{this.#F(e?"appTerminated":"appBackgrounded",t,!0,e)}catch{}}#M(){if("undefined"!=typeof window&&"undefined"!=typeof document)try{const e=()=>this.flushForPageLifecycle(!0,this.#U),t=()=>{"hidden"===document.visibilityState&&this.flushForPageLifecycle(!1,this.#U)};window.addEventListener("pagehide",e),document.addEventListener("visibilitychange",t),this.#P=()=>{window.removeEventListener("pagehide",e),document.removeEventListener("visibilitychange",t)}}catch{}}destroy(){this.#P?.(),this.#P=null}async startTransaction(e,t){try{u.debug("Starting transaction",{campaignId:e,useCase:t});const n=await this.#m.startTransaction(e,this.#f,t);if(!n.transactionId)throw new Error(n.error??"No transactionId in response");return u.info("Transaction started",{transactionId:n.transactionId,campaignId:e}),n.transactionId}catch(t){throw u.error("Failed to start transaction",{campaignId:e,error:t}),t}}clearCache(){this.#E=[],this.#$=null,u.debug("Offer cache cleared")}setUserId(e){this.#f=e,this.clearCache(),u.debug("OfferManager user ID updated",{userId:e})}}const R={[t.NETWORK_ERROR]:"network_error",[t.TIMEOUT]:"network_error",[t.STORAGE_ERROR]:"persistence_error",[t.CONFIGURATION_ERROR]:"not_configured",[t.INITIALIZATION_ERROR]:"not_configured",[t.INVALID_REQUEST]:"api_error",[t.UNKNOWN_ERROR]:"domain_error"};function N(e,t){const n=e[t];return"string"==typeof n?n:void 0}function U(e){if("object"!=typeof e||null===e)return"domain_error";const n=e,r=N(n,"code"),i="number"==typeof n.statusCode;if(r){return R[r]||(r===String(t.API_ERROR)&&i?"http_error":"api_error")}return i?"http_error":e instanceof SyntaxError?"decoding_error":"domain_error"}class L{#m;#B;#H;#V=0;#K=1e3;#q=8e3;#j=null;#W=!1;#G=!1;constructor(e,t){this.#m=e,this.#B=t.transactionId,this.#H=t.timeout??3e4}async poll(){return this.#W?(u.warn("Verification polling already in progress",{transactionId:this.#B}),"pending"):(this.#W=!0,this.#V=Date.now(),u.debug("Starting verification polling",{transactionId:this.#B,timeout:this.#H}),this.#Q())}stop(){this.#W=!1,null!==this.#j&&(clearTimeout(this.#j),this.#j=null),u.debug("Verification polling stopped",{transactionId:this.#B})}async#Q(){for(;this.#W;){const e=Date.now()-this.#V;if(e>=this.#H)return u.warn("Verification polling timeout",{transactionId:this.#B,elapsed:e}),this.stop(),"pending";try{const e=await this.#m.checkVerificationStatus(this.#B);if(u.debug("Verification status checked",{transactionId:this.#B,status:e.status,rawStatus:e.raw}),"verified"===e.status)return u.info("Transaction verified",{transactionId:this.#B}),this.stop(),"verified";if("failed"===e.status)return u.warn("Transaction failed verification",{transactionId:this.#B}),this.stop(),"failed";await this.#C(this.#K),this.#K=Math.min(2*this.#K,this.#q)}catch(e){u.error("Error checking verification status",{transactionId:this.#B,error:e}),this.#G||(this.#G=!0,this.#m.reportError({errorType:U(e),message:e instanceof Error?e.message:String(e),context:"verify_transaction",...e instanceof Error&&e.stack?{stackTrace:e.stack}:{}})),await this.#C(this.#K)}}return"pending"}async#C(e){return new Promise(t=>{this.#j=window.setTimeout(()=>{this.#j=null,t()},e)})}}const O=/^[A-Za-z0-9_-]+$/;class _{#p;#m;#f;constructor(e,t,n){this.#p=e,this.#m=t,this.#f=n}setUserId(e){if(this.#f===e)return;const t=this.getPending();this.clearPending(),this.#f=e,t&&this.#p.set(this.#Y(),t)}notePending(e,t){const n={transactionId:e,recordedAt:(new Date).toISOString(),grantsEntitlement:t?.grantsEntitlement??!1,...void 0!==t?.placementId&&{placementId:t.placementId},...void 0!==t?.useCase&&{useCase:t.useCase}};this.#p.set(this.#Y(),n),u.debug("StrictUnlockReconciler: noted pending claim",{transactionId:e})}clearPending(){this.#p.remove(this.#Y()),u.debug("StrictUnlockReconciler: cleared pending claim")}getPending(){const e=this.#p.get(this.#Y());if(!e)return null;if("string"!=typeof e.transactionId||"string"!=typeof e.recordedAt||!O.test(e.transactionId))return u.warn("StrictUnlockReconciler: dropping malformed pending claim"),this.clearPending(),null;const t=Date.now()-new Date(e.recordedAt).getTime();return!(t>=0)||t>6048e5?(u.debug("StrictUnlockReconciler: dropping stale pending claim",{age:t}),this.clearPending(),null):(void 0!==e.placementId&&"string"!=typeof e.placementId&&delete e.placementId,void 0===e.useCase||l(e.useCase)||(u.warn("StrictUnlockReconciler: dropping an unrecognised use case from a pending claim"),delete e.useCase),e)}async verify(e,t=15e3){try{const n=new L(this.#m,{transactionId:e,timeout:t});return await n.poll()}catch(t){return u.warn("StrictUnlockReconciler: verification poll failed",{transactionId:e,error:t}),"pending"}}#Y(){return`${this.#f}_strict_pending`}}class P{#X=null;#Z=null;#J;#ee;#te;#ne;constructor(e,t,n,r){this.#te=e,this.#J=t,this.#ne=n,this.#ee=r}useCase(e){return this.#ne={...this.#ne,useCase:e},this}headline(e){return this.#ne={...this.#ne,headline:e},this}subheadline(e){return this.#ne={...this.#ne,subheadline:e},this}onNotGranted(e){return this.#X=e,this}onLoadingStateChange(e){return this.#Z=e,this}async show(){try{this.#Z&&this.#Z(!0),u.debug("PlacementBuilder: Executing presentation",{id:this.#te});const e=await this.#J(this.#ne);return this.#Z&&this.#Z(!1),"dismissed"===e.status&&e.reason&&this.#X&&this.#X(e.reason),e}catch(e){this.#Z&&this.#Z(!1),u.error("PlacementBuilder: Error during presentation",e);const n={type:"error",error:{code:t.UNKNOWN_ERROR,message:e instanceof Error?e.message:"Unknown error"}};return this.#X&&this.#X(n),{status:"dismissed",reason:n}}}async redeem(){return u.debug("PlacementBuilder: Redeeming",{id:this.#te}),this.#ee(this.#te)}}function M(e){return"immediate"!==e}const D={reduceChurn:"deferred",rewardUsers:"immediate"},z=["immediate","deferred","deferredWhileAlive"];const F="transactions";function B(e){const t=new Date(e.createdAt).getTime();return Number.isFinite(t)?t:0}function H(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function V(e,t){if(!H(e))return{};const n={};for(const[r,i]of Object.entries(e))t(i)&&(n[r]=i);return n}class K{#re;constructor(e){this.#re=e}#ie(){const e=this.#re.read();return H(e)?{transactions:V(e.transactions,H),placements:V(e.placements,e=>"string"==typeof e),latest:"string"==typeof e.latest?e.latest:null}:{transactions:{},placements:{},latest:null}}#oe(e){this.#re.write(e)}#se(e){return!!e&&"claimed"===e.status&&!this.#ae(e)}#ae(e){const t=new Date(e.expiresAt).getTime();return!Number.isFinite(t)||t<=Date.now()}save(e){const t=this.#ie();t.transactions[e.id]=e,e.placementId&&(t.placements[e.placementId]=e.id),t.latest=e.id,this.#le(t),this.#oe(t),u.debug("TransactionStore: saved transaction",{transactionId:e.id,placement:e.placementId})}getByTransactionId(e){return this.#ie().transactions[e]??null}getByPlacement(e){const t=this.#ie(),n=t.placements[e];if(!n)return null;const r=t.transactions[n];return this.#se(r)?r:null}getLatest(){const e=this.#ie();if(e.latest){const t=e.transactions[e.latest];if(this.#se(t))return t}return Object.values(e.transactions).filter(e=>this.#se(e)).sort((e,t)=>B(t)-B(e))[0]??null}markRedeemed(e){const t=this.#ie(),n=t.transactions[e];n&&(n.status="redeemed",n.redeemedAt=(new Date).toISOString(),n.placementId&&t.placements[n.placementId]===e&&delete t.placements[n.placementId],t.latest===e&&(t.latest=null),this.#oe(t),u.debug("TransactionStore: marked redeemed",{transactionId:e}))}#le(e){for(const[t,n]of Object.entries(e.transactions))(this.#ae(n)||"redeemed"===n.status)&&delete e.transactions[t];for(const[t,n]of Object.entries(e.placements))e.transactions[n]||delete e.placements[t];e.latest&&!e.transactions[e.latest]&&(e.latest=null)}clear(){this.#oe({transactions:{},placements:{},latest:null})}}const q=e=>{const t=e?.trim();if(void 0!==t&&t.length>0)return t};const j=e=>`All ${e} features are now unlocked.`;function W(e,t){let n=e;for(const[e,r]of Object.entries(t))n=n.replace(`:${e}`,encodeURIComponent(r));return n}const G="2.0.7";function Q(e,t){return e.length<=t?e:e.slice(0,t-15)+"... [truncated]"}function Y(e,t,n){return Q(""===e.trim()?n:e,t)}function X(e,t){return Object.assign(e,{code:t})}class Z{#ce;#de;#he;constructor(e,t){this.#ce=e,this.#de=t,this.#he=new Map}setApiKey(e){this.#ce=e}setBaseURL(e){this.#de=e}async get(e,t){return this.#ue({url:`${this.#de}${e}`,options:{method:"GET",...t},apiKey:this.#ce})}async post(e,t,n){return this.#ue({url:`${this.#de}${e}`,options:{method:"POST",body:t,...n},apiKey:this.#ce})}async patch(e,t,n){return this.#ue({url:`${this.#de}${e}`,options:{method:"PATCH",body:t,...n},apiKey:this.#ce})}async#ue(e){const{url:t,options:n,apiKey:r}=e,i=this.#pe(t,n),o=this.#he.get(i);if(o)return u.debug("Deduplicating request:",t),o;const s=this.#me(t,n,r);this.#he.set(i,s);try{return await s}finally{this.#he.delete(i)}}async#me(e,t,n){const r=t.retries??3;let i=null;for(let o=0;o<=r;o++)try{if(o>0){const e=1e3*Math.pow(2,o-1);u.debug(`Retrying request (attempt ${o}/${r}) after ${e}ms`),await this.#C(e)}return await this.#fe(e,t,n)}catch(e){if(i=e,this.#ge(e))throw e;if(o===r)throw u.error(`Request failed after ${r} retries:`,e),e;u.warn("Request failed, will retry:",e)}throw i??new Error("Request failed")}async#fe(e,n,r){const i=n.timeout??3e4,o=new AbortController,s=setTimeout(()=>o.abort(),i);try{const t={"X-API-Key":r,"X-Platform":"web","Content-Type":"application/json","User-Agent":`Encore-Web-SDK/${G}`,...n.headers},i={method:n.method,headers:t,signal:o.signal};n.body&&(i.body=JSON.stringify(n.body)),u.debug(`${n.method} ${e}`);const s=await fetch(e,i);return s.ok||await this.#be(s),await s.json()}catch(e){if(e instanceof Error){if("AbortError"===e.name)throw X(new Error("Request timeout"),t.TIMEOUT);if(this.#ve(e))throw X(new Error(`Network error: ${e.message}`),t.NETWORK_ERROR)}if(e instanceof Error)throw e;throw X(new Error(String(e)),t.UNKNOWN_ERROR)}finally{clearTimeout(s)}}async#be(e){let n,r=`HTTP ${e.status}: ${e.statusText}`;try{const t=await e.json();"object"==typeof t&&null!==t&&"string"==typeof t.error&&(r=t.error,n="string"==typeof t.code?t.code:void 0)}catch{}const i=n?{code:n,message:r}:{code:t.API_ERROR,statusCode:e.status,message:r},o=new Error(r);throw Object.assign(o,i),o}#ge(e){if("object"==typeof e&&null!==e&&"statusCode"in e&&void 0!==e.statusCode){const t=e.statusCode;return t>=400&&t<500}return!1}#ve(e){return e.message.includes("fetch")||e.message.includes("network")||e.message.includes("ECONNREFUSED")||e.message.includes("ETIMEDOUT")}#pe(e,t){const n=t.body?JSON.stringify(t.body):"";return`${t.method}:${e}:${n}`}#C(e){return new Promise(t=>setTimeout(t,e))}#we(e){switch(e){case"pending_conversion":case"provisional_granted":default:return"pending";case"verified":case"final_granted":return"verified";case"expired":case"failed":return"failed"}}async fetchOffers(e,t,n,r){try{const i=w(n),o=await this.post("/offers/search",{userId:e,attributes:t,platform:"web",sdkVersion:G,...i&&{placementId:i},...void 0!==r&&{maxPostbackTimeMs:r}}),s=[];for(const e of o.offers){const t=e.creatives??[];for(const n of t){const t={id:n.id,title:n.title,description:n.quickInstructions??n.subtitle??n.description??"",imageUrl:n.primaryImageUrl,ctaText:n.ctaText,advertiserUrl:n.destinationUrl??e.destinationUrl??"",campaignId:e.id,creativeId:n.id,quickInstructions:n.quickInstructions??"",instructions:(n.instructions??[]).map(e=>({title:e.title,subtitle:e.subtitle,...null!=e.ctaButtonText&&{ctaButtonText:e.ctaButtonText}})),tooltipText:n.tooltipText??"",...e.organization?.name&&{merchantName:e.organization.name},...e.perk&&{perk:e.perk},...n.logoUrl&&{logoUrl:n.logoUrl},...n.trackingParameters&&{trackingParameters:Object.fromEntries(Object.entries(n.trackingParameters).filter(([,e])=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e).map(([e,t])=>[e,String(t)]))}};s.push(t)}}return{offers:s}}catch(e){throw u.error("Failed to fetch offers:",e),e}}async startTransaction(e,t,n){try{return await this.post("/transactions",{campaignId:e,userId:t,...n&&"reduceChurn"!==n&&{useCase:o(n)}})}catch(e){throw u.error("Failed to start transaction:",e),e}}async sendGrantSignal(e,t){try{const n=function(e){return W("/transactions/:transactionId/signals",{transactionId:e})}(e);return(await this.post(n,{grantType:t})).success}catch(e){throw u.error("Failed to send grant signal:",e),e}}async fetchEntitlements(e){try{const t=await this.get(`/entitlements?userId=${encodeURIComponent(e)}`),n=[],r=[{details:t.provisional,scope:"provisional"},{details:t.verified,scope:"verified"}];for(const{details:e,scope:t}of r)if(e){if(e.freeTrial&&n.push({type:"freeTrial",transactionId:"",scope:t,grantedAt:e.freeTrial.startedAt??"",expiresAt:e.freeTrial.expiresAt??""}),e.discounts)for(const r of e.discounts)n.push({type:"discount",value:r.value,unit:r.unit,transactionId:"",scope:t,grantedAt:"",expiresAt:r.expiresAt??""});e.credits&&n.push({type:"credit",value:e.credits.totalAmount,unit:"dollars",transactionId:"",scope:t,grantedAt:"",expiresAt:e.credits.expiresAt??""})}return u.debug("Transformed entitlements response",{totalCount:n.length}),n}catch(e){throw u.error("Failed to fetch entitlements:",e),e}}async checkVerificationStatus(e){try{const t=function(e){return W("/transactions/:transactionId/status",{transactionId:e})}(e),n=await this.get(t);return{status:this.#we(n.status),raw:n.status}}catch(e){throw u.error("Failed to check verification status:",e),e}}async initUser(e,t){try{return await this.post("/users",{userId:e,...t&&{attributes:t}})}catch(e){throw u.error("Failed to init user:",e),e}}async identifyUser(e,t,n){try{return await this.patch("/users/identify",{currentUserId:e,newUserId:t,...n&&{attributes:n}})}catch(e){throw u.error("Failed to identify user:",e),e}}async fetchConfig(e,t,n){try{const r=`/config?userId=${encodeURIComponent(e)}&sdkVersion=${encodeURIComponent(t)}`+(n&&"reduceChurn"!==n?`&useCase=${encodeURIComponent(o(n))}`:"");return await this.get(r)}catch(e){throw u.error("Failed to fetch config:",e),e}}async reportError(e){try{const n="undefined"!=typeof window?window.location.hostname:"unknown";await this.post("/errors",{errorType:Q(e.errorType,100),message:Y(e.message,2e3,"Unknown error"),context:Q(e.context,200),severity:e.severity??"error",timestamp:(new Date).toISOString(),platform:"web",sdkVersion:G,appBundleId:Y(n,200,"unknown"),...e.stackTrace&&{stackTrace:Q(e.stackTrace,1e4)},...e.userId&&{userId:Q(e.userId,200)},...e.metadata&&{metadata:(t=e.metadata,Object.fromEntries(Object.entries(t).map(([e,t])=>[e,Q(t,500)])))}},{retries:0})}catch(e){u.error("Failed to report error (non-blocking):",e)}var t}async revokeEntitlements(e){try{return(await this.post("/entitlements/revoke",{userId:e})).success}catch(e){throw u.error("Failed to revoke entitlements:",e),e}}}function J(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase()}function ee(e){const t={};for(const[n,r]of Object.entries(e))t[J(n)]=r;return t}function te(e,t=A()){const n="undefined"!=typeof window?window.location.hostname:"unknown";return{event_id:t,event_name:e.name,event_timestamp:(new Date).toISOString(),distinct_id:e.distinctId,properties:{...ee(e.properties),platform:"web",sdk_version:G,app_bundle_id:n}}}function ne(e,t,n,r){return fetch(`${e}/events`,{method:"POST",...r?.keepalive&&{keepalive:!0},headers:{"X-Analytics-Key":t,"X-Platform":"web","Content-Type":"application/json"},body:JSON.stringify(n)})}const re=new Set(["user_identified"]);class ie{#ce;#ye;#p;constructor(e,t,n){this.#ce=e,this.#ye=t,this.#p=n??null}track(e,t){try{if(this.#xe(e))return;const n=te(e);ne(this.#ye,this.#ce,n,t).catch(t=>{u.warn("Analytics event dispatch failed",{eventName:e.name,error:t})})}catch{}}#xe(e){if(!this.#p||!re.has(e.name))return!1;const t=`analytics_dedup_${e.name}_${e.distinctId}`;try{const e=this.#p.get(t),n=Date.now();return"number"==typeof e&&n-e<864e5||(this.#p.set(t,n),!1)}catch{return!1}}}async function oe(e,t){const n=`${e}:${t}`,r=(new TextEncoder).encode(n),i=new Uint8Array(await crypto.subtle.digest("SHA-256",r));let o=0n;for(let e=0;e<8;e++)o=o<<8n|BigInt(i[e]??0);return Number(o%100n)}const se="ncl_assignment",ae="ncl_exposure_marker";class le{#p;#Ie;#Ce;#n=null;constructor(e,t,n){this.#p=e,this.#Ie=t,this.#Ce=n}setConfig(e){this.#n=e??null}async getCohort(){try{return await this.#ke()}catch(e){return u.warn("[Experiment] getCohort failed — treating as notEnrolled",e),"notEnrolled"}}async#ke(){const e=this.#Ie();if(!e)return"notEnrolled";const t=this.#n;if(!t?.enabled)return"notEnrolled";const n=this.#p.get(se);if(n?.appAccountId===e&&n?.assignmentVersion===t.assignmentVersion)return n.cohort;if("undefined"==typeof crypto||!crypto.subtle)return u.warn("[Experiment] NCL disabled — crypto.subtle unavailable (page is not a secure context: serve over HTTPS)"),"notEnrolled";const r=await oe(e,t.assignmentVersion),i=function(e,t){return e<t?"treatment":"control"}(r,t.rolloutPct);return this.#p.set(se,{cohort:i,appAccountId:e,assignmentVersion:t.assignmentVersion}),u.debug("[Experiment] Assigned NCL cohort",{cohort:i,version:t.assignmentVersion,rolloutPct:t.rolloutPct,bucket:r}),i}logExposure(e){if("notEnrolled"===e)return;const t=this.#n,n=this.#Ie();if(!t||!n)return;const r=`${n}:${t.assignmentVersion}`;if(this.#p.get(ae)===r)return;const i=function(e,t){return{name:"sdk_experiment_exposure",distinctId:e,properties:{experiment:t.experiment,cohort:t.cohort,assignment_version:t.assignmentVersion,app_account_id:e}}}(n,{experiment:"ncl",cohort:e,assignmentVersion:t.assignmentVersion}),o=A();this.#Ce.enqueue(i,o)&&this.#p.set(ae,r)}async getState(){const e=this.#Ie(),t=this.#n,n=await this.getCohort();let r=null;if(e&&t?.enabled&&"undefined"!=typeof crypto&&crypto.subtle)try{r=await oe(e,t.assignmentVersion)}catch{r=null}const i=!!e&&!!t&&this.#p.get(ae)===`${e}:${t.assignmentVersion}`;return{experiment:"ncl",enabled:t?.enabled??!1,rolloutPct:t?.rolloutPct??null,assignmentVersion:t?.assignmentVersion??null,appAccountId:e,bucket:r,cohort:n,exposureLogged:i}}}class ce{#ce;#ye;#p;#Ee;#$e=new Set;constructor(e,t,n,r){this.#ce=e,this.#ye=t,this.#p=n,this.#Ee=r,this.#M()}enqueue(e,t){const n=te(e,t),r=this.#Se();r.some(e=>e.event_id===t)||(r.push(n),this.#Ae(r));const i=this.#Se().some(e=>e.event_id===t);return this.#Te(n),i}flush(){for(const e of this.#Se())this.#Te(e)}async#Te(e){if(!this.#$e.has(e.event_id)){this.#$e.add(e.event_id);try{const t=await ne(this.#ye,this.#ce,e,{keepalive:!0});t.ok?this.#Re(e.event_id):u.warn("Reliable delivery non-OK, will retry",{status:t.status})}catch(e){u.warn("Reliable delivery failed, will retry",{error:e})}finally{this.#$e.delete(e.event_id)}}}#Re(e){const t=this.#Se().filter(t=>t.event_id!==e);this.#Ae(t)}#Se(){return this.#p.get(this.#Ee)??[]}#Ae(e){this.#p.set(this.#Ee,e)}#M(){"undefined"!=typeof window&&"undefined"!=typeof document&&(window.addEventListener("pagehide",()=>this.flush()),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.flush()}))}}class de extends ce{constructor(e,t,n){super(e,t,n,"ncl_exposure_outbox")}}class he extends ce{constructor(e,t,n){super(e,t,n,"diagnostics_outbox")}}const ue={userClosedModal:"close_button",userClickedOutside:"dismissed",userDeclinedLastOffer:"last_offer_declined"},pe={advertiserOutcome:"not_attempted",publisherOutcome:"not_attempted",dismissal:"dismissed"};function me(e,t){if("claimed"===e.status)return{resolution:"presented",...pe,advertiserOutcome:t?.advertiserOutcome??"claimed",dismissal:t?.dismissal??"flow_completed",campaignId:e.campaignId,offerId:e.offerId,...void 0!==e.transactionId&&{transactionId:e.transactionId}};if("unavailable"===e.status)return{resolution:"not_presented",notPresentedReason:t?.notPresentedReason??"error.unknown_error"};const n=e.reason;return t?void 0!==t.notPresentedReason?{resolution:"not_presented",notPresentedReason:t.notPresentedReason}:{resolution:"presented",...pe,...void 0!==t.advertiserOutcome&&{advertiserOutcome:t.advertiserOutcome},...void 0!==t.dismissal&&{dismissal:t.dismissal}}:n?"string"==typeof n?"alreadyPresenting"===n?{resolution:"not_presented",notPresentedReason:"already_presenting"}:"notConfigured"===n?{resolution:"not_presented",notPresentedReason:"not_configured"}:{resolution:"presented",...pe,...void 0!==ue[n]&&{dismissal:ue[n]}}:{resolution:"not_presented",notPresentedReason:(r=n.error.code,`error.${r.toLowerCase()}`)}:{resolution:"presented",...pe};var r}class fe{#Ne;constructor(){this.#Ne=new Map}on(e,t){this.#Ne.has(e)||this.#Ne.set(e,new Set);const n=this.#Ne.get(e);if(!n)throw new Error(`Failed to get handlers for event '${String(e)}'`);return n.add(t),u.debug(`Event listener added for '${String(e)}'`),()=>{this.off(e,t)}}off(e,t){const n=this.#Ne.get(e);n&&(n.delete(t),u.debug(`Event listener removed for '${String(e)}'`),0===n.size&&this.#Ne.delete(e))}emit(e,t){const n=this.#Ne.get(e);if(n&&0!==n.size){u.debug(`Emitting event '${String(e)}'`,{listenerCount:n.size});for(const r of n)try{r(t)}catch(t){u.error(`Error in event handler for '${String(e)}':`,t)}}}removeAllListeners(e){e?(this.#Ne.delete(e),u.debug(`All listeners removed for '${String(e)}'`)):(this.#Ne.clear(),u.debug("All event listeners removed"))}listenerCount(e){return this.#Ne.get(e)?.size??0}hasListeners(e){const t=this.#Ne.get(e);return void 0!==t&&t.size>0}}const ge=16;function be(e,t,n){return Math.min(n,Math.max(t,e))}function ve(e,t,n){return(.2126*e+.7152*t+.0722*n)/255}function we(e,t,n){const r=e/255,i=t/255,o=n/255,s=Math.max(r,i,o),a=Math.min(r,i,o),l=(s+a)/2,c=s-a;return 0===c?{h:0,s:0,l:l}:{h:((s===r?(i-o)/c%6*60:s===i?60*((o-r)/c+2):60*((r-i)/c+4))%360+360)%360,s:c/(1-Math.abs(2*l-1)),l:l}}function ye(e,t,n){return function(e,t,n){const r=(1-Math.abs(2*n-1))*t,i=(e%360+360)%360/60,o=r*(1-Math.abs(i%2-1)),[s,a,l]=i<1?[r,o,0]:i<2?[o,r,0]:i<3?[0,r,o]:i<4?[0,o,r]:i<5?[o,0,r]:[r,0,o],c=n-r/2,d=e=>Math.round(be(255*(e+c),0,255)).toString(16).padStart(2,"0");return`#${d(s)}${d(a)}${d(l)}`}(e,be(t,.45,.95),be(n,.45,.62))}const xe=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ie=/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(\s*[0-9a-z.,%\s/+-]{1,80}\)$/i,Ce=/^[a-z]{3,24}$/i,ke=/^var\(\s*--[a-z0-9_-]{1,60}\s*(?:,[a-z0-9#%.,\s-]{0,60})?\)$/i,Ee=/^[a-z0-9\s,'"_\-\u00C0-\u024F\u1E00-\u1EFF]{1,128}$/i,$e=/^(?:0|-?(?:\d{1,5}|\d{0,5}\.\d{1,3})(?:px|rem|em|%|pt|vh|vw|ch|ex))$/i,Se=/^(?:normal|bold|lighter|bolder)$/i,Ae=new Set(["left","center","right","start","end"]),Te=/\/\*|\*\/|[;{}<>\\]/;function Re(e,t){u.warn(`[Encore SDK] Ignoring unsupported ${e} appearance value`,{value:t})}function Ne(e){if(null==e)return;if("string"!=typeof e)return null;const t=e.trim();return 0!==t.length?t.length>128||Te.test(t)?null:t:void 0}function Ue(e){const t=Ne(e);if(void 0!==t)return null===t?Re("colour",e):xe.test(t)||Ie.test(t)||Ce.test(t)||ke.test(t)?t:Re("colour",e)}function Le(e){const t=Ne(e);if(void 0!==t)return null===t?Re("font-family",e):Ee.test(t)?t:Re("font-family",e)}function Oe(e){const t=Ne(e);if(void 0!==t)return null===t?Re("length",e):$e.test(t)?t:Re("length",e)}const _e="encore-sdk-styles",Pe="encore-",Me="767px",De="#B728F5";function ze(e){const t={},n=Ue(e.primaryColor),r=Ue(e.backgroundColor),i=Ue(e.textColor),o=Oe(e.borderRadius),s=Le(e.fontFamily);return n&&(t.primaryColor=n),r&&(t.backgroundColor=r),i&&(t.textColor=i),o&&(t.borderRadius=o),s&&(t.fontFamily=s),t}const Fe="12px",Be="20px",He="40px";function Ve(e={}){if(document.getElementById(_e))u.debug("Encore styles already injected");else try{const t=document.createElement("style");t.id=_e,t.textContent=function(e={}){const t=ze(e),n=function(e){const t=[];return e.primaryColor&&t.push(`--encore-primary-color: ${e.primaryColor};`),e.backgroundColor&&t.push(`--encore-bg-color: ${e.backgroundColor};`),e.textColor&&t.push(`--encore-text-color: ${e.textColor};`),e.borderRadius&&t.push(`--encore-border-radius: ${e.borderRadius};`),e.fontFamily&&t.push(`--encore-font-family: ${e.fontFamily};`),t.join("\n ")}(t);return`\n /* CSS Custom Properties (Theme Variables) */\n :root {\n ${n||"/* No custom theme variables */"}\n --encore-primary-color: ${t.primaryColor??"#4F46E5"};\n --encore-bg-color: ${t.backgroundColor??"#ffffff"};\n --encore-text-color: ${t.textColor??"#1F2937"};\n --encore-text-muted: color-mix(in srgb, var(--encore-text-color) 60%, transparent);\n /* One step darker than muted, lighter than full text — lead-in copy that must\n read above captions without competing with the page title. */\n --encore-text-secondary: color-mix(in srgb, var(--encore-text-color) 78%, transparent);\n --encore-surface-color: color-mix(in srgb, var(--encore-text-color) 5%, var(--encore-bg-color));\n --encore-border-color: color-mix(in srgb, var(--encore-text-color) 10%, var(--encore-bg-color));\n --encore-border-radius: ${t.borderRadius??"12px"};\n /* Semantic success hue (the reward sheet's status check). Deliberately independent of the\n accent color: the check states a payment fact; the accent sells the offer CTA. */\n --encore-success-color: #159a5b;\n --encore-font-family: ${t.fontFamily??'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'};\n }\n\n /* Backdrop */\n .${Pe}backdrop {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(0, 0, 0, 0.55);\n backdrop-filter: blur(2px);\n z-index: 9998;\n opacity: 0;\n transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n .${Pe}backdrop.${Pe}visible {\n opacity: 1;\n }\n\n /* Box-sizing reset scoped to the SDK modal so padding/borders never cause\n horizontal overflow on host pages that don't set border-box globally. */\n .${Pe}modal,\n .${Pe}modal *,\n .${Pe}backdrop {\n box-sizing: border-box;\n }\n\n /* Modal Container */\n .${Pe}modal {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999;\n background-color: var(--encore-bg-color);\n border-radius: 20px;\n box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.18), 0 12px 24px -8px rgba(0, 0, 0, 0.08);\n max-width: 800px;\n max-height: 90vh;\n width: calc(100% - 32px);\n overflow-x: hidden;\n overflow-y: auto;\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.96);\n transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1), transform 250ms cubic-bezier(0.4, 0, 0.2, 1);\n font-family: var(--encore-font-family);\n color: var(--encore-text-color);\n /* Anchor the inherited typographic properties at the modal root so host\n page styles can't cascade in. Children inherit OUR values, not the\n host's. Interim guard until Shadow DOM — see web-sdk-style-isolation.md. */\n font-size: 16px;\n font-weight: 400;\n font-style: normal;\n line-height: 1.5;\n letter-spacing: normal;\n word-spacing: normal;\n text-align: left;\n text-transform: none;\n text-indent: 0;\n white-space: normal;\n text-shadow: none;\n }\n\n .${Pe}modal.${Pe}visible {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n\n /* Close Button */\n .${Pe}close-button {\n position: absolute;\n top: 20px;\n right: 20px;\n width: 40px;\n height: 40px;\n border: none;\n background-color: var(--encore-surface-color);\n cursor: pointer;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--encore-text-muted);\n transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);\n padding: 0;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);\n z-index: 10;\n }\n\n .${Pe}close-button:hover {\n background-color: var(--encore-bg-color);\n color: var(--encore-text-color);\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);\n transform: scale(1.05);\n }\n\n .${Pe}close-button:active {\n transform: scale(0.98);\n }\n\n .${Pe}close-button:hover {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n .${Pe}close-button svg {\n width: 18px;\n height: 18px;\n }\n\n /* Body scroll lock */\n body.${Pe}no-scroll {\n overflow: hidden;\n }\n\n /* Modal Header */\n .${Pe}modal-header {\n padding: 24px 24px 16px;\n border-bottom: 1px solid var(--encore-border-color);\n }\n\n .${Pe}modal-title {\n margin: 0;\n font-size: 24px;\n font-weight: 700;\n line-height: 1.25;\n color: var(--encore-text-color);\n }\n\n .${Pe}modal-subtitle {\n margin: 8px 0 0;\n font-size: 14px;\n color: var(--encore-text-muted);\n line-height: 1.5;\n }\n\n /* Modal Body */\n .${Pe}modal-body {\n padding: 0;\n position: relative;\n isolation: isolate;\n }\n\n /* Carousel Container */\n .${Pe}carousel {\n display: flex;\n flex-direction: column;\n overflow: visible;\n }\n\n /* Carousel Header */\n .${Pe}carousel-header {\n padding: 40px 68px 28px;\n text-align: center;\n }\n\n .${Pe}carousel-title {\n font-size: 32px;\n font-weight: 510;\n line-height: 1.1;\n color: var(--encore-text-color);\n margin: 0 0 8px 0;\n letter-spacing: -0.3px;\n }\n\n .${Pe}carousel-subtitle {\n font-size: 16px;\n line-height: 1.2;\n color: var(--encore-text-color);\n margin: 0;\n font-weight: 400;\n }\n\n /* Carousel Cards Container - Horizontal Scroll */\n .${Pe}carousel-cards {\n display: flex;\n flex-direction: row;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-behavior: smooth;\n scroll-snap-type: x mandatory;\n -webkit-overflow-scrolling: touch;\n scrollbar-width: none;\n -ms-overflow-style: none;\n gap: 24px;\n padding: 24px 78px;\n position: relative;\n }\n\n .${Pe}carousel-cards::-webkit-scrollbar {\n display: none;\n }\n\n /* Carousel Item Wrapper. Only opacity ever animates (active-card dimming) — a\n short 200ms so the highlight reads as tracking the swipe, not trailing it. */\n .${Pe}carousel-item {\n flex: 0 0 426px;\n width: 426px;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n opacity: 0.5;\n transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1);\n pointer-events: auto;\n }\n\n /* Active carousel item */\n .${Pe}carousel-item.${Pe}active {\n opacity: 1;\n z-index: 1;\n }\n\n /* Offer Card */\n .${Pe}offer-card {\n display: flex;\n flex-direction: column;\n background: var(--encore-bg-color);\n border-radius: 16px;\n box-shadow: 0 2px 12px rgba(116, 112, 133, 0.16);\n overflow: hidden;\n }\n\n /* Offer Banner */\n .${Pe}offer-banner {\n width: 100%;\n background-color: transparent;\n position: relative;\n padding: 0;\n height: 180px;\n overflow: hidden;\n border-radius: 16px 16px 0 0;\n }\n\n .${Pe}offer-banner-image {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: cover;\n background-color: var(--encore-surface-color);\n opacity: 0;\n transition: opacity 200ms ease-out;\n }\n\n .${Pe}offer-banner-image.${Pe}loaded {\n opacity: 1;\n }\n\n /* Info button on banner */\n .${Pe}banner-info-button {\n position: absolute;\n top: 20px;\n right: 20px;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n background-color: var(--encore-surface-color);\n backdrop-filter: blur(6px);\n border: none;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: all 150ms ease;\n z-index: 3;\n padding: 0;\n }\n\n .${Pe}banner-info-button:hover {\n background-color: var(--encore-border-color);\n transform: scale(1.05);\n }\n\n .${Pe}banner-info-button:focus {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n .${Pe}banner-info-button svg {\n width: 14px;\n height: 14px;\n color: var(--encore-text-color);\n stroke-width: 2;\n }\n\n /* Tooltip */\n .${Pe}tooltip {\n position: fixed;\n background-color: rgba(28, 28, 32, 0.95);\n color: #ffffff;\n padding: 8px 12px;\n border-radius: 8px;\n font-size: 12px;\n line-height: 1.4;\n font-weight: 500;\n z-index: 10000;\n pointer-events: none;\n opacity: 0;\n transform: translateY(4px);\n transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1), transform 200ms cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n white-space: normal;\n word-wrap: break-word;\n }\n\n .${Pe}tooltip-visible {\n opacity: 1;\n transform: translateY(0);\n }\n\n /* Tooltip arrow (optional - using pseudo-element) */\n .${Pe}tooltip::after {\n content: '';\n position: absolute;\n width: 0;\n height: 0;\n border-style: solid;\n }\n\n .${Pe}tooltip-top::after {\n bottom: -4px;\n left: 50%;\n transform: translateX(-50%);\n border-width: 4px 4px 0 4px;\n border-color: rgba(28, 28, 32, 0.95) transparent transparent transparent;\n }\n\n .${Pe}tooltip-bottom::after {\n top: -4px;\n left: 50%;\n transform: translateX(-50%);\n border-width: 0 4px 4px 4px;\n border-color: transparent transparent rgba(28, 28, 32, 0.95) transparent;\n }\n\n .${Pe}tooltip-left::after {\n right: -4px;\n top: 50%;\n transform: translateY(-50%);\n border-width: 4px 0 4px 4px;\n border-color: transparent transparent transparent rgba(28, 28, 32, 0.95);\n }\n\n .${Pe}tooltip-right::after {\n left: -4px;\n top: 50%;\n transform: translateY(-50%);\n border-width: 4px 4px 4px 0;\n border-color: transparent rgba(28, 28, 32, 0.95) transparent transparent;\n }\n\n /* Offer Footer */\n .${Pe}offer-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 20px;\n border-top: 1px solid var(--encore-border-color);\n gap: 12px;\n min-height: 74px;\n }\n\n /* Offer Merchant */\n .${Pe}offer-merchant {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n min-width: 0;\n }\n\n .${Pe}offer-logo {\n width: 42px;\n height: 42px;\n border-radius: 8px;\n object-fit: contain;\n background-color: var(--encore-surface-color);\n flex-shrink: 0;\n opacity: 0;\n transition: opacity 200ms ease-out;\n }\n\n .${Pe}offer-logo.${Pe}loaded {\n opacity: 1;\n }\n\n .${Pe}offer-merchant-text {\n display: flex;\n flex-direction: column;\n gap: 2px;\n flex: 1;\n min-width: 0;\n }\n\n .${Pe}offer-merchant-name {\n font-size: 16px;\n font-weight: 590;\n color: var(--encore-text-color);\n line-height: 1.1;\n letter-spacing: -1px;\n }\n\n .${Pe}offer-merchant-desc {\n font-size: 14px;\n color: var(--encore-text-muted);\n line-height: 1.2;\n letter-spacing: -1px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n /* Claim Button */\n .${Pe}button-claim {\n padding: 10px 16px;\n height: 34px;\n min-width: 78px;\n font-size: 14px;\n font-weight: 590;\n border-radius: 999px;\n border: none;\n background: var(--encore-primary-color);\n color: white;\n cursor: pointer;\n transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);\n font-family: var(--encore-font-family);\n white-space: nowrap;\n line-height: 1.2;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .${Pe}button-claim:hover:not(:disabled) {\n background: color-mix(in srgb, var(--encore-primary-color) 85%, black);\n transform: translateY(-1px);\n box-shadow: 0 2px 8px color-mix(in srgb, var(--encore-primary-color) 30%, transparent);\n }\n\n .${Pe}button-claim:active {\n transform: translateY(0);\n background: color-mix(in srgb, var(--encore-primary-color) 75%, black);\n }\n\n .${Pe}button-claim:focus {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n .${Pe}button-claim:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n transform: none;\n }\n\n /* Carousel Navigation */\n .${Pe}carousel-navigation {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 40px;\n padding: 28px 32px 32px;\n }\n\n .${Pe}nav-button {\n width: 32px;\n height: 32px;\n border-radius: 50%;\n border: 1px solid var(--encore-text-muted);\n background-color: var(--encore-bg-color);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--encore-text-muted);\n transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);\n padding: 0;\n }\n\n .${Pe}nav-button:hover:not(:disabled) {\n border-color: var(--encore-primary-color);\n color: var(--encore-primary-color);\n transform: scale(1.05);\n }\n\n .${Pe}nav-button:active:not(:disabled) {\n transform: scale(0.95);\n }\n\n .${Pe}nav-button:focus {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n .${Pe}nav-button svg {\n width: 20px;\n height: 20px;\n stroke-width: 2;\n }\n\n .${Pe}nav-button:not(:disabled) {\n border-color: var(--encore-primary-color);\n color: var(--encore-primary-color);\n }\n\n .${Pe}nav-button:disabled,\n .${Pe}nav-button.${Pe}disabled {\n opacity: 1;\n cursor: not-allowed;\n border-color: var(--encore-text-muted);\n color: var(--encore-text-muted);\n }\n\n .${Pe}nav-button:disabled:hover,\n .${Pe}nav-button.${Pe}disabled:hover {\n border-color: var(--encore-text-muted);\n color: var(--encore-text-muted);\n transform: none;\n }\n\n /* Loading State */\n .${Pe}loading {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 48px;\n }\n\n .${Pe}spinner {\n width: 40px;\n height: 40px;\n border: 3px solid var(--encore-border-color);\n border-top-color: var(--encore-primary-color);\n border-radius: 50%;\n animation: ${Pe}spin 0.8s linear infinite;\n }\n\n @keyframes ${Pe}spin {\n to { transform: rotate(360deg); }\n }\n\n /* Responsive: Mobile (0-767px) — full-screen vertical sheet */\n @media (max-width: ${Me}) {\n /* Modal becomes a full-screen sheet. dvh fallback so mobile browser URL\n bars don't clip the bottom. It is a flex column so the height\n propagates down to the scrollable cards region. */\n .${Pe}modal {\n display: flex;\n flex-direction: column;\n inset: 0;\n top: 0;\n left: 0;\n transform: none;\n width: 100%;\n height: 100vh;\n height: 100dvh;\n max-width: none;\n max-height: none;\n border-radius: 0;\n margin: 0;\n overflow: hidden;\n }\n\n /* Fade only — override the desktop scale/translate transition. */\n .${Pe}modal.${Pe}visible {\n transform: none;\n }\n\n /* Body fills the sheet and forwards the height to the carousel.\n min-height:0 lets the inner scroll container actually overflow. */\n .${Pe}modal-body {\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n flex-direction: column;\n }\n\n /* Carousel fills the body so the cards region can flex to fill height. */\n .${Pe}carousel {\n flex: 1 1 auto;\n min-height: 0;\n overflow: hidden;\n }\n\n /* Sticky header pinned while the list scrolls; respect the notch. 64px side\n The close button is an absolute overlay (top 16 + 40px tall), so the\n header reserves that band VERTICALLY: the title starts below the X and\n spans the full sheet width with slim symmetric side padding — no dead\n 64px gutters squeezing the headline into the X's row. */\n .${Pe}carousel-header {\n position: sticky;\n top: 0;\n z-index: 2;\n background: var(--encore-bg-color);\n padding: calc(64px + env(safe-area-inset-top)) 24px 20px;\n }\n\n .${Pe}carousel-title {\n font-size: 22px;\n }\n\n .${Pe}carousel-subtitle {\n font-size: 14px;\n }\n\n /* Vertical, full-height scrollable feed. */\n .${Pe}carousel-cards {\n flex: 1 1 auto;\n min-height: 0;\n flex-direction: column;\n overflow-x: hidden;\n overflow-y: auto;\n scroll-snap-type: none;\n overscroll-behavior: contain;\n gap: 16px;\n padding: 16px 16px calc(16px + env(safe-area-inset-bottom));\n }\n\n /* Full-width stacked cards, no carousel dimming or snapping.\n overflow:visible so each card's shadow isn't clipped by the item box. */\n .${Pe}carousel-item {\n flex: 0 0 auto;\n width: 100%;\n opacity: 1;\n scroll-snap-align: none;\n overflow: visible;\n }\n\n /* Keep the rounded card + visible shadow on mobile (matches design). */\n .${Pe}offer-card {\n width: 100%;\n max-width: 100%;\n border-radius: 16px;\n box-shadow: 0 4px 16px rgba(116, 112, 133, 0.22);\n border: 1px solid var(--encore-border-color);\n }\n\n /* Image fills the card edge-to-edge with rounded top corners\n (no inset padding, banner already clips to the card radius). */\n .${Pe}offer-banner {\n height: auto;\n padding: 0;\n border-radius: 16px 16px 0 0;\n }\n\n .${Pe}offer-banner-image {\n width: 100%;\n height: auto;\n display: block;\n }\n\n /* Logo + name + description on the left, small claim button pinned far\n right on a single row (no wrap / no full-width stacking). */\n .${Pe}offer-footer {\n flex-wrap: nowrap;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding: 14px 16px;\n }\n\n .${Pe}offer-merchant {\n flex: 1 1 auto;\n min-width: 0;\n }\n\n /* Small button hugging its label, to the far right. */\n .${Pe}button-claim {\n flex: 0 0 auto;\n width: auto;\n }\n\n /* No nav arrows in vertical mode. */\n .${Pe}carousel-navigation {\n display: none;\n }\n\n /* Keep the close button reachable inside the sticky header / below the notch. */\n .${Pe}close-button {\n top: calc(16px + env(safe-area-inset-top));\n right: 16px;\n }\n\n /* Paged carousel keeps its nav bubbles on mobile (the display:none above is\n the responsive/'list' vertical mode only). */\n .${Pe}carousel-paged .${Pe}carousel-navigation {\n display: flex;\n }\n\n /* NOTE: the reward sheet's own mobile overrides live in a dedicated media\n block AFTER the base reward-sheet section (source order matters at equal\n specificity — a media query adds none). */\n }\n\n /* Responsive: Tablet (768-1023px) */\n @media (min-width: 768px) and (max-width: 1023px) {\n .${Pe}modal {\n max-width: 600px;\n }\n }\n\n /* Responsive: Desktop (1024px+) */\n @media (min-width: 1024px) {\n .${Pe}modal {\n max-width: 600px;\n }\n }\n\n /* Accessibility: High Contrast Mode */\n @media (prefers-contrast: high) {\n .${Pe}button {\n border: 2px solid currentColor;\n }\n }\n\n /* Accessibility: Reduced Motion */\n @media (prefers-reduced-motion: reduce) {\n .${Pe}backdrop,\n .${Pe}modal,\n .${Pe}button,\n .${Pe}close-button {\n transition: none;\n }\n\n .${Pe}spinner {\n animation: none;\n }\n }\n\n /* Focus Visible (for keyboard navigation) */\n .${Pe}button:focus-visible,\n .${Pe}close-button:focus-visible {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n\n /* ===== Paged carousel (the reward sheet) ===== */\n /* Always-horizontal, one-card-per-view, scroll-snap paged — at every breakpoint.\n Scoped under carousel-paged so the responsive ('list') carousel rules are\n untouched. Each page is slightly narrower than the viewport so the neighboring\n cards PEEK in at the edges at reduced opacity — the same visual grammar as the\n list carousel: "there are more offers, swipe". Desktop caps the page width so\n the peek survives wide modals (no 426px hardcode). */\n .${Pe}carousel-paged .${Pe}carousel-cards {\n flex-direction: row;\n align-items: center;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-snap-type: x mandatory;\n /* auto, NOT the base 'smooth': smooth scroll-behavior makes the browser ANIMATE\n its own snap re-alignments (e.g. when an async banner image loads and reflows\n the row mid-gesture), which reads as a laggy post-swipe snap. Native gesture\n snapping is untouched, and programmatic paging still requests smooth\n explicitly via scrollIntoView's behavior option. */\n scroll-behavior: auto;\n gap: 12px;\n /* Horizontal padding is 0 — the symmetric first/last-item gutters below own\n the side spacing so the ACTIVE card is always centered. Vertical padding is\n shadow room: overflow-y:hidden would clip the card shadows without it. */\n padding: ${Be} 0;\n /* One "page" = the card slot. 64px total side allowance → 32px gutter each\n side (a ~20px neighbor-peek after the 12px gap at the 375px design width);\n the 480px cap keeps the peek alive in wide modals. Declared once here and\n shared by the item basis and the centering gutters so they can never drift. */\n --encore-page-size: min(100% - 64px, 480px);\n }\n\n .${Pe}carousel-paged .${Pe}carousel-item {\n /* Size via width (flex-basis:auto → width), NOT a math function inside the\n flex shorthand: engines that choke on functions in the shorthand drop the\n whole declaration and fall back to the base 426px item — which is exactly a\n clipped, overflowing card on a 375px phone. width + the max-width guard\n make overflow impossible at any breakpoint. */\n flex: 0 0 auto;\n width: var(--encore-page-size);\n max-width: 100%;\n /* Peek legibility: light creatives on the white sheet disappear below ~0.5,\n killing the "more offers" affordance. 0.65 keeps the active card clearly\n dominant while the neighbors stay readable. */\n opacity: 0.65;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n overflow: visible;\n }\n\n /* Symmetric centering gutters: first/last pages get margins of exactly\n (container − page) / 2, so card 0 RESTS CENTERED at scrollLeft 0 (empty gutter\n left, peek right), mid-cards show symmetric peeks, and the last card can reach\n center too. Both the margin percentage and the flex-basis percentage resolve against the same\n container content width, so the math is exact at any size — the natural resting\n position IS the snap position and mount needs no scroll correction. */\n .${Pe}carousel-paged .${Pe}carousel-item:first-child {\n margin-inline-start: calc((100% - var(--encore-page-size)) / 2);\n }\n\n .${Pe}carousel-paged .${Pe}carousel-item:last-child {\n margin-inline-end: calc((100% - var(--encore-page-size)) / 2);\n }\n\n .${Pe}carousel-paged .${Pe}carousel-item.${Pe}active {\n opacity: 1;\n }\n\n .${Pe}carousel-paged .${Pe}offer-card {\n max-width: 460px;\n margin: 0 auto;\n border: 1px solid var(--encore-border-color);\n box-shadow: 0 4px 16px rgba(116, 112, 133, 0.18);\n }\n\n /* Fluid banner: natural aspect, scales with the card. */\n .${Pe}carousel-paged .${Pe}offer-banner {\n height: auto;\n }\n\n .${Pe}carousel-paged .${Pe}offer-banner-image {\n width: 100%;\n height: auto;\n display: block;\n }\n\n /* Nav row: centered DIRECTLY beneath the cards — these chevrons are carousel\n controls and must read as part of the carousel unit, so they hug it (never\n bottom-anchored away from it). Comfortable 48px circular tap targets in normal\n flow — no overlay, no z-index games. Rhythm: cards→nav gap = the cards' bottom\n shadow gutter + 4px here (16px total inside the sheet); the 20px bottom padding\n is the nav→footer gap (and the sheet's bottom inset when no trust footer is\n configured). */\n .${Pe}carousel-paged .${Pe}carousel-navigation {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 24px;\n padding: 4px 20px ${Be};\n }\n\n .${Pe}carousel-paged .${Pe}nav-button {\n width: 48px;\n height: 48px;\n background-color: var(--encore-bg-color);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n }\n\n /* Neutral idle bubble (the accent belongs to the Claim CTA); accent only on hover. */\n .${Pe}carousel-paged .${Pe}nav-button:not(:disabled) {\n border-color: var(--encore-border-color);\n color: var(--encore-text-color);\n }\n\n .${Pe}carousel-paged .${Pe}nav-button:hover:not(:disabled) {\n border-color: var(--encore-primary-color);\n color: var(--encore-primary-color);\n box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);\n }\n\n .${Pe}carousel-paged .${Pe}nav-button svg {\n width: 22px;\n height: 22px;\n }\n\n .${Pe}carousel-paged .${Pe}nav-button:disabled,\n .${Pe}carousel-paged .${Pe}nav-button.${Pe}disabled {\n opacity: 0.35;\n box-shadow: none;\n border-color: var(--encore-border-color);\n color: var(--encore-text-muted);\n }\n\n /* ===== Reward sheet chrome (useCase: 'rewardUsers') =====\n The encore-thankyou class names predate the 3.0.0 rename — they are internal\n style hooks, kept so the whole visual system (including the --reward parity\n block below) did not have to churn. See ui/RewardLayout.ts. */\n /* Pure chrome around the unchanged carousel: status block above, trust footer\n below. Desktop: normal flow inside the content-sized modal (the stack is\n inherently tight there). Mobile: joins the sheet's flex chain — the content\n stack is optically centered while the trust footer stays bottom-pinned. */\n .${Pe}thankyou {\n display: flex;\n flex-direction: column;\n }\n\n /* SUCCESS UNIT — check → title → receipt as ONE tight visual group. Internal\n gaps are deliberately tight (proximity = grouping); the heading below is the\n sheet's single focal point. No bottom padding: the 32px section break lives\n on the intro header so it is owned in exactly one place. */\n .${Pe}thankyou-status {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n padding: ${He} 24px 0;\n }\n\n /* "Receipt stamp" check: deep-green disc in a soft halo. Calm by design — no\n pulse, no gradient (a payment fact, stated quietly). Margin-bottom is the\n 12px halo ring + the 12px check→title step of the ladder. */\n .${Pe}thankyou-check {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 48px;\n height: 48px;\n border-radius: 50%;\n background: var(--encore-success-color);\n color: #ffffff;\n box-shadow: 0 0 0 12px color-mix(in srgb, var(--encore-success-color) 14%, var(--encore-bg-color));\n margin: 0 0 calc(12px + ${Fe});\n }\n\n .${Pe}thankyou-check svg {\n width: 24px;\n height: 24px;\n }\n\n /* The ONLY large/heavy type on the sheet — everything else defers to it. */\n .${Pe}thankyou-title {\n margin: 0;\n font-size: 20px;\n font-weight: 600;\n line-height: 1.25;\n letter-spacing: -0.2px;\n color: var(--encore-text-color);\n overflow-wrap: anywhere;\n }\n\n /* Subheadline — sits tight under the title (same statement, quieter voice). */\n .${Pe}thankyou-subtitle {\n margin: 4px 0 0;\n font-size: 14px;\n line-height: 1.5;\n color: var(--encore-text-muted);\n overflow-wrap: anywhere;\n }\n\n /* Context → cards 16px, cards → nav 16px (12px shadow gutter + the nav row's 4px\n top padding): the carousel unit is bound tight to its lead-in above and its\n controls below. The 12px bottom gutter still clears the visible card shadow. */\n .${Pe}thankyou .${Pe}carousel-cards {\n padding-top: 16px;\n padding-bottom: ${Fe};\n }\n\n;\n font-size: 12px;\n line-height: 1.5;\n text-align: center;\n color: var(--encore-text-muted);\n overflow-wrap: anywhere;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n }\n\n /* The reward sheet on mobile full-screen: join the sheet's flex chain — the\n content stack floats optically centered above the bottom-pinned trust footer,\n and the carousel keeps its internal scroll. Type + rhythm come from the base\n system above (375px IS its design target) — only sheet-specific bits\n are overridden. This block must stay AFTER the base rules: it wins by\n source order, not specificity. */\n @media (max-width: ${Me}) {\n .${Pe}thankyou {\n flex: 1 1 auto;\n min-height: 0;\n }\n\n /* Full-height composition: everything except the trust footer is ONE tight,\n internally-rigid stack (success unit → context pair → cards → nav row),\n OPTICALLY CENTERED in the space above the bottom-pinned footer. Two\n zero-basis flex spaces own ALL the slack — this ::before above the stack\n (grow 1) and the carousel's ::after below it (grow 1.35, via the carousel's\n own grow factor) — an above:below ratio of 1:1.35 so the stack rests\n slightly high of true center. The stack's internal ladder gaps never\n stretch, so the composition compresses as a unit on short sheets and\n floats as a unit on tall ones. */\n .${Pe}thankyou::before {\n content: '';\n flex: 1 1 0;\n min-height: 0;\n }\n\n .${Pe}thankyou-status {\n flex: 0 0 auto;\n /* Real fixed margin above the check — the floor when the flex space above\n has fully compressed; the notch inset always survives. */\n padding-top: calc(${He} + env(safe-area-inset-top));\n }\n\n .${Pe}thankyou-check {\n width: 44px;\n height: 44px;\n }\n\n /* The carousel's grow factor IS the below-stack share: its extra height is\n absorbed entirely by the ::after spacer under the nav row, giving the\n 1:1.35 above:below split against the ::before above. Shrinks like before\n (basis auto, min-height 0) so short sheets compress the cards region. */\n .${Pe}thankyou .${Pe}carousel {\n flex: 1.35 1 auto;\n min-height: 0;\n }\n\n .${Pe}thankyou .${Pe}carousel::after {\n content: '';\n flex: 1 1 0;\n min-height: 0;\n }\n\n /* Nav hugs the cards (rigid ladder gap) — the old auto-margin bottom-anchor\n is gone: the arrows are carousel controls and read as part of the carousel\n unit, not footer furniture. */\n .${Pe}thankyou .${Pe}carousel-cards {\n flex: 0 1 auto;\n min-height: 0;\n }\n\n }\n\n /* ===== Reward parity with the native SDUI variant =====\n Tracks streaksCarousel.json — the SAME screen iOS and Android render — so a\n publisher running reward on more than one platform sees one design rather\n than three. Values are read off that file, not eyeballed from a screenshot:\n\n headline 28 / semibold, centered\n subheadline 16 / regular, centered\n offer card cornerRadius 24\n primary CTA cornerRadius 12 (deliberately NOT the pill the churn\n carousel uses — the variant is explicit)\n gutters 20 leading/trailing\n\n Scoped entirely to the --reward modifier, which the chrome always sets: the\n base rules keep a tighter 20/14 scale, and these override it with the\n celebration scale. Placed AFTER the mobile block so it wins on source\n order, matching the convention that block already documents. */\n .${Pe}thankyou--reward .${Pe}thankyou-title {\n font-size: 28px;\n font-weight: 600;\n line-height: 1.2;\n letter-spacing: -0.4px;\n text-align: center;\n }\n\n .${Pe}thankyou--reward .${Pe}thankyou-subtitle {\n font-size: 16px;\n font-weight: 400;\n line-height: 1.35;\n text-align: center;\n }\n\n .${Pe}thankyou--reward .${Pe}thankyou-status {\n padding-left: 20px;\n padding-right: 20px;\n }\n\n /* On the mobile full-screen sheet the variant is edge-to-edge (fullScreenCover,\n detent 1.0, no drag indicator) with 20px gutters. */\n @media (max-width: ${Me}) {\n .${Pe}thankyou--reward .${Pe}carousel-cards {\n padding-left: 20px;\n padding-right: 20px;\n }\n }\n\n /* ===== Reward interaction model — tracks streaksCarousel.json's browse state.\n Reward DOM only: either --reward-scoped, or a class (page-indicator / dot /\n reward-*) the reward composition alone renders. See RewardActions.ts and\n OfferCarousel's \`selectable\` option for the per-value rationale. ===== */\n .${Pe}thankyou--reward .${Pe}carousel-item[aria-selected] {\n cursor: pointer;\n }\n\n /* The listbox is one tab stop, so it needs its own ring. Inset — an outset one\n is clipped by the container's horizontal overflow.\n \n KEYBOARD DEVICES ONLY, and :focus-visible alone is not enough to say so.\n This is a div with tabindex="0", and Safari focuses one on TAP and then\n matches :focus-visible on it — so an iOS user tapping a card to browse\n got a 2px ring around the whole carousel, on a sheet where there is no\n Tab key and so nothing the ring could be telling them. Chrome on desktop\n does not do this, which is why it survived review.\n\n Gated on a fine pointer rather than on :focus-visible being smarter:\n a device with no keyboard has no use for a focus ring, and a device with\n one keeps it exactly as before. */\n .${Pe}carousel-select:focus {\n outline: none;\n }\n\n @media (hover: hover) and (pointer: fine) {\n .${Pe}carousel-select:focus-visible {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: -2px;\n border-radius: 16px;\n }\n }\n\n /* compactPageIndicator: position feedback only, never a control. */\n .${Pe}page-indicator {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 8px;\n padding: 19px 20px 0;\n }\n\n /* Figma 18304:3071 — four ellipses, inactive 6px, active 10px, 8px edge gaps\n (52px total for four). The size change IS the state change here, so both\n dimensions animate alongside the fill. */\n .${Pe}dot {\n flex: 0 0 auto;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n /* var() fallback = today's value, so an unset override is byte-identical. */\n background: var(\n --encore-dot-color,\n color-mix(in srgb, #6A6D81 30%, transparent)\n );\n transition:\n background 200ms cubic-bezier(0.4, 0, 0.2, 1),\n width 200ms cubic-bezier(0.4, 0, 0.2, 1),\n height 200ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n .${Pe}dot.${Pe}active {\n width: 10px;\n height: 10px;\n background: var(--encore-dot-active-color, var(--encore-reward-brand));\n }\n\n /* Trust line + CTA stack, 12px apart, 20px gutters. 31px bottom inset is the\n variant's browse-state padding; env() is ADDED so the 31 always survives. */\n .${Pe}reward-actions {\n display: flex;\n flex-direction: column;\n gap: 12px;\n /* max(), not addition. The 31px is the variant's browse-state padding\n and the inset is the hardware's; adding them stacked a full\n home-indicator gap ON TOP of a padding that was already clear of it,\n which is the space under the CTAs in a tall-phone screenshot. Taking\n the larger of the two keeps the 31 as the floor and lets the inset win\n only where it is genuinely bigger.\n\n A mobile browser's own bottom bar is NOT covered by this: it shrinks\n the viewport, which 100dvh on the sheet already tracks. */\n padding: 20px 20px max(31px, env(safe-area-inset-bottom));\n }\n\n .${Pe}reward-trust {\n margin: 0;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.2;\n text-align: center;\n color: color-mix(in srgb, var(--encore-text-color) 55%, transparent);\n overflow-wrap: anywhere;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n }\n\n .${Pe}reward-cta-stack {\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n\n /* Both buttons are full pills (Figma radius 100), not the variant's 12 — see\n REWARD_BRAND. Heights are the Figma's: primary 51, secondary 48. */\n .${Pe}reward-cta-primary,\n .${Pe}reward-cta-secondary {\n width: 100%;\n box-sizing: border-box;\n border-radius: 100px;\n font-family: var(--encore-font-family);\n font-size: 16px;\n line-height: 1.2;\n text-align: center;\n cursor: pointer;\n transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /*\n * Claiming switched off (Encore.isClaimEnabled). Matches the carousel's own\n * disabled Claim button: without this the reward CTA is unclickable but still\n * looks and feels live, which reads as a broken button rather than an\n * unavailable one.\n *\n * TWO selectors because there are two elements. The default CTA is a button and\n * carries the native disabled property. A publisher-supplied claim slot is mounted\n * in a div[role=button] host, where disabled is meaningless and :disabled never\n * matches it — that one carries aria-disabled instead. Dropping either selector\n * leaves one of the two paths looking live while it is inert.\n *\n * No backticks in this comment: the whole stylesheet is a template literal, and a\n * backtick here closes it.\n */\n .${Pe}reward-cta-primary:disabled,\n .${Pe}reward-cta-primary[aria-disabled='true'] {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .${Pe}reward-cta-primary {\n height: 51px;\n padding: 0 12px;\n border: none;\n font-weight: 700;\n background-image: linear-gradient(\n 98.22deg,\n var(--encore-reward-brand) 0%,\n var(--encore-reward-brand-deep) 100%\n );\n color: #ffffff;\n }\n\n /* Darken via an overlay rather than swapping the background: \`background-image\`\n cannot be color-mixed, and re-declaring the whole gradient per state would put\n the stops in four places. */\n .${Pe}reward-cta-primary:hover {\n box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.12);\n }\n\n .${Pe}reward-cta-primary:active {\n box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.2);\n }\n\n .${Pe}reward-cta-secondary {\n height: 48px;\n padding: 0 12px;\n border: 1px solid rgba(0, 0, 0, 0.1);\n font-weight: 500;\n background: transparent;\n color: #9c9c9c;\n }\n\n .${Pe}reward-cta-secondary:hover {\n border-color: rgba(0, 0, 0, 0.22);\n color: var(--encore-text-color);\n }\n\n .${Pe}reward-cta-primary:focus-visible,\n .${Pe}reward-cta-secondary:focus-visible {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n /* Publisher appearance slots — see APPEARANCE_SLOT_NOTES. */\n .${Pe}slot-custom {\n font: inherit;\n color: inherit;\n letter-spacing: normal;\n margin: 0;\n }\n\n .${Pe}slot-host {\n display: flex;\n align-items: center;\n justify-content: center;\n height: auto;\n padding: 0;\n border: none;\n background: none;\n background-image: none;\n box-shadow: none;\n color: inherit;\n cursor: pointer;\n }\n\n .${Pe}slot-host:hover,\n .${Pe}slot-host:active {\n box-shadow: none;\n border-color: transparent;\n color: inherit;\n }\n\n /* Rigid furniture on the sheet: never absorbs slack, never compresses. The\n carousel's ::after owns the elastic space that floats it to the bottom. */\n @media (max-width: ${Me}) {\n .${Pe}thankyou--reward .${Pe}reward-actions {\n flex: 0 0 auto;\n /* Pinned to the bottom of the sheet rather than left wherever the\n space split above it happened to end. auto absorbs ALL remaining\n slack, so the CTAs sit against the bottom inset at every height\n instead of floating with a gap under them on a tall phone.\n\n It does not fight the carousel's 1.35:1 share above: that split\n governs the space the carousel and its ::after divide between them,\n and this only claims what is left after the whole column is laid\n out — which on a short sheet is nothing. */\n margin-top: auto;\n }\n }\n\n /* ===== Reward visual parity — Figma 18304:2399. Reward-only selectors.\n Rationale lives in REWARD_VISUAL_NOTES (JS, stripped from the bundle). ===== */\n\n /* Flat: declares NO background, so the sheet inherits the modal's colour like\n every other composition. position stays as the confetti canvas's positioning\n context — it is not background. */\n .${Pe}thankyou--reward {\n --encore-reward-brand: ${De};\n --encore-reward-brand-deep: #6515ED;\n position: relative;\n }\n\n /* Content column holds the 393 design width and centres.\n z-index 1 lifts content over the confetti, per the zStack order. */\n .${Pe}thankyou--reward > .${Pe}thankyou-status,\n .${Pe}thankyou--reward > .${Pe}carousel,\n .${Pe}thankyou--reward > .${Pe}reward-actions {\n position: relative;\n z-index: 1;\n width: 100%;\n max-width: 393px;\n margin-left: auto;\n margin-right: auto;\n }\n\n /* Header (Figma 18304:3391). Text colours stay THEME TOKENS, never the Figma\n hexes — the variant's dark-mode rule (backend #426/#427). */\n .${Pe}thankyou--reward .${Pe}thankyou-title {\n margin: 0;\n font-size: 28px;\n font-weight: 600;\n line-height: 1.1;\n letter-spacing: -0.28px;\n text-align: center;\n text-wrap: balance;\n }\n\n .${Pe}thankyou--reward .${Pe}thankyou-subtitle {\n margin: 12px 0 0;\n font-size: 16px;\n font-weight: 400;\n line-height: 1.3;\n text-align: center;\n /* 0.55, not the Figma's 0.50: the variant's WCAG AA figure wins on contrast. */\n color: color-mix(in srgb, var(--encore-text-color) 55%, transparent);\n }\n\n /* Hero carousel. Neighbour = opacity .55 + scale .95 + translateY(11px),\n MEASURED off the render; no filter (opacity composites on the GPU). */\n .${Pe}thankyou--reward .${Pe}carousel {\n position: relative;\n }\n\n .${Pe}thankyou--reward .${Pe}carousel-cards {\n gap: 10px;\n /* Half container minus half card — lets the first/last card reach centre. */\n padding: 26px calc(50% - 105px);\n align-items: center;\n }\n\n .${Pe}thankyou--reward .${Pe}carousel-item {\n flex: 0 0 210px;\n width: 210px;\n opacity: 0.55;\n transform: translateY(11px) scale(0.95);\n transform-origin: center center;\n transition:\n opacity 260ms cubic-bezier(0.4, 0, 0.2, 1),\n transform 260ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* \`.active\` (geometric, tracks the drag), not \`[aria-selected]\` (commits on\n settle). One index, so they converge at rest. */\n .${Pe}thankyou--reward .${Pe}carousel-item.${Pe}active {\n opacity: 1;\n transform: none;\n z-index: 1;\n }\n\n /* Registering the tint makes it an ANIMATABLE colour rather than an opaque\n token, so the tier-1 -> tier-2 upgrade eases instead of popping. Measured at\n 69-156ms cold against production logos — inside the modal's 250ms fade, so the\n swap is normally masked — but that is a property of a fast connection, not a\n guarantee, and a slow one would land the swap on a fully-visible sheet.\n Browsers without @property ignore this and swap instantly, exactly as before. */\n @property --encore-card-tint {\n syntax: '<color>';\n inherits: false;\n initial-value: ${De};\n }\n\n /* ---- The card itself (Figma 18304:3383) ---- */\n .${Pe}reward-card {\n --encore-card-tint: ${De};\n position: relative;\n box-sizing: border-box;\n width: 210px;\n height: 260px;\n /* 43 to the pill, then the ladder below is gap-driven. */\n padding: 43px 15px 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n border-radius: 24px;\n overflow: hidden;\n background-color: #ffffff;\n /* Body = tint@10% over white (measured). The radials add the Figma's deeper\n right/bottom wash, derived from the same tint so any brand colour works. */\n background-image:\n radial-gradient(\n 120% 85% at 100% 0%,\n color-mix(in srgb, var(--encore-card-tint) 22%, transparent) 0%,\n transparent 68%\n ),\n radial-gradient(\n 140% 60% at 62% 112%,\n color-mix(in srgb, var(--encore-card-tint) 20%, transparent) 0%,\n transparent 74%\n ),\n linear-gradient(\n 0deg,\n color-mix(in srgb, var(--encore-card-tint) ${Math.round(10)}%, transparent) 0%,\n color-mix(in srgb, var(--encore-card-tint) ${Math.round(10)}%, transparent) 100%\n );\n box-shadow:\n 0 4px 12px rgba(0, 0, 0, 0.09),\n 0 4px 12px rgba(0, 0, 0, 0.02),\n 0 4px 74px rgba(0, 0, 0, 0.06),\n inset -8px 1px 13px color-mix(in srgb, var(--encore-card-tint) 13%, transparent);\n transition: --encore-card-tint 320ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n .${Pe}reward-card-badge {\n flex: 0 0 auto;\n max-width: 100%;\n box-sizing: border-box;\n padding: 4px 10px;\n border-radius: 16px;\n background: #ffffff;\n box-shadow: 0 2.769px 5.538px rgba(56, 30, 0, 0.03);\n font-size: 14px;\n font-weight: 500;\n line-height: 1.2;\n letter-spacing: -0.3px;\n color: var(--encore-text-color);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n /* 84 from the card top = 43 (pad) + 25 (pill) + 16. */\n .${Pe}reward-card-icon {\n flex: 0 0 auto;\n margin-top: 16px;\n width: 72px;\n height: 72px;\n border-radius: 18px;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background: color-mix(in srgb, var(--encore-card-tint) 92%, #ffffff);\n box-shadow: 0 2.769px 5.538px rgba(56, 30, 0, 0.15);\n }\n\n .${Pe}reward-card-icon-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n display: block;\n }\n\n /* No logo, or a failed load. Ordinary rendering — logoUrl is optional. */\n .${Pe}reward-card-monogram {\n font-size: 32px;\n font-weight: 700;\n line-height: 1;\n color: #ffffff;\n }\n\n /* 176 from the card top = 84 + 72 (icon) + 20. */\n .${Pe}reward-card-text {\n margin-top: 20px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n min-width: 0;\n }\n\n /* One line: a long name must not push the offer line out of a fixed card. */\n .${Pe}reward-card-name {\n max-width: 100%;\n font-size: 18px;\n font-weight: 600;\n line-height: 1.2;\n letter-spacing: -0.18px;\n text-align: center;\n color: var(--encore-text-color);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n /* Two lines then clamp — remote perk copy runs longer than the Figma's one. */\n .${Pe}reward-card-offer {\n max-width: 100%;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.2;\n letter-spacing: -0.28px;\n text-align: center;\n color: color-mix(in srgb, var(--encore-text-color) 75%, transparent);\n overflow-wrap: anywhere;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n }\n\n /* Desktop arrows (mobile has swipe). Rendered only above the breakpoint —\n see OfferCarousel.#createRewardArrows. Centred on padY + half the card. */\n .${Pe}reward-arrow {\n position: absolute;\n top: 156px;\n margin-top: -20px;\n z-index: 2;\n width: 40px;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n border: 1px solid rgba(0, 0, 0, 0.06);\n border-radius: 50%;\n background: rgba(255, 255, 255, 0.92);\n color: var(--encore-text-color);\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);\n cursor: pointer;\n transition:\n opacity 200ms cubic-bezier(0.4, 0, 0.2, 1),\n background 200ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n .${Pe}reward-arrow svg {\n width: 20px;\n height: 20px;\n display: block;\n }\n\n .${Pe}reward-arrow-prev {\n left: 12px;\n }\n\n .${Pe}reward-arrow-next {\n right: 12px;\n }\n\n .${Pe}reward-arrow:hover {\n background: #ffffff;\n }\n\n .${Pe}reward-arrow:focus-visible {\n outline: 2px solid var(--encore-reward-brand);\n outline-offset: 2px;\n }\n\n /* Stays in place and in the tab order: vanishing would shift layout. */\n .${Pe}reward-arrow:disabled {\n opacity: 0.35;\n cursor: default;\n }\n\n /* The variant's confetti: full-bleed, inert, self-removing after 2s. */\n .${Pe}reward-confetti {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n\n /* Reduced motion: confetti is skipped in JS; the hero becomes an instant\n state change. Selection is unaffected. */\n @media (prefers-reduced-motion: reduce) {\n .${Pe}thankyou--reward .${Pe}carousel-item,\n .${Pe}reward-card,\n .${Pe}dot,\n .${Pe}reward-arrow {\n transition: none;\n }\n }\n\n /* ===== Success Screen ===== */\n .${Pe}success-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 3rem 2rem;\n text-align: center;\n min-height: 400px;\n animation: ${Pe}fade-in 0.3s ease-out;\n }\n\n .${Pe}success-icon {\n width: 80px;\n height: 80px;\n background: var(--encore-primary-color);\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 48px;\n color: white;\n margin-bottom: 1.5rem;\n animation: ${Pe}scale-in 0.5s ease-out;\n }\n\n .${Pe}success-title {\n font-size: 1.75rem;\n font-weight: 700;\n color: var(--encore-text-color);\n margin: 0 0 0.75rem 0;\n }\n\n .${Pe}success-subtitle {\n font-size: 1.125rem;\n color: var(--encore-text-muted);\n margin: 0 0 2rem 0;\n line-height: 1.6;\n }\n\n .${Pe}success-details {\n background: color-mix(in srgb, var(--encore-primary-color) 5%, transparent);\n border-radius: 12px;\n padding: 1.5rem;\n margin-bottom: 2rem;\n min-width: 280px;\n }\n\n .${Pe}success-detail {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0.5rem 0;\n }\n\n .${Pe}success-detail:not(:last-child) {\n border-bottom: 1px solid rgba(0, 0, 0, 0.05);\n }\n\n .${Pe}success-detail-label {\n font-size: 0.875rem;\n color: var(--encore-text-muted);\n font-weight: 500;\n }\n\n .${Pe}success-detail-value {\n font-size: 1rem;\n color: var(--encore-text-color);\n font-weight: 600;\n }\n\n .${Pe}success-button {\n background: var(--encore-primary-color);\n color: white;\n border: none;\n border-radius: var(--encore-border-radius);\n padding: 0.875rem 2.5rem;\n font-size: 1rem;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s ease;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n }\n\n .${Pe}success-button:hover {\n transform: translateY(-2px);\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);\n }\n\n .${Pe}success-button:active {\n transform: translateY(0);\n }\n\n .${Pe}success-button:focus-visible {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n @keyframes ${Pe}scale-in {\n from {\n transform: scale(0);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n }\n\n /* Referenced by the reward chrome above as well as both deferred screens. */\n @keyframes ${Pe}fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n /* ==========================================================================\n Deferred flow: primer (the hold) + redemption (the ready state), and the\n brand components both share.\n ========================================================================== */\n\n /* Shared monogram tile — the guaranteed first paint for every brand logo. */\n .${Pe}brand-tile-placeholder {\n display: flex;\n align-items: center;\n justify-content: center;\n background: color-mix(in srgb, var(--encore-primary-color) 12%, var(--encore-bg-color));\n color: var(--encore-primary-color);\n font-weight: 700;\n font-size: 1.2rem;\n }\n\n /* Dual-brand lockup — two tiles settling together ("two brands, one deal"). */\n .${Pe}lockup {\n display: flex;\n justify-content: center;\n align-items: center;\n margin: 0.5rem 0 1.5rem 0;\n }\n\n .${Pe}lockup-tile {\n width: 56px;\n height: 56px;\n border-radius: 14px;\n object-fit: cover;\n box-shadow: 0 2px 8px color-mix(in srgb, var(--encore-text-color) 14%, transparent);\n background: var(--encore-bg-color);\n }\n\n .${Pe}lockup-tile-partner {\n transform: rotate(-4deg);\n animation: ${Pe}lockup-settle-left 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards;\n z-index: 1;\n }\n\n .${Pe}lockup-tile-host {\n margin-left: -10px;\n transform: rotate(4deg);\n animation: ${Pe}lockup-settle-right 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards;\n z-index: 2;\n }\n\n @keyframes ${Pe}lockup-settle-left {\n from { transform: rotate(-6deg) translateX(-4px); }\n to { transform: rotate(-4deg) translateX(0); }\n }\n\n @keyframes ${Pe}lockup-settle-right {\n from { transform: rotate(6deg) translateX(4px); }\n to { transform: rotate(4deg) translateX(0); }\n }\n\n /* Deal ledger — the claim state machine, rendered. */\n .${Pe}ledger {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--encore-border-color);\n border-radius: 16px;\n background: var(--encore-bg-color);\n box-shadow: 0 1px 3px color-mix(in srgb, var(--encore-text-color) 6%, transparent);\n text-align: left;\n overflow: hidden;\n }\n\n .${Pe}ledger-row {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 14px 16px;\n }\n\n .${Pe}ledger-row + .${Pe}ledger-row {\n border-top: 1px solid var(--encore-border-color);\n }\n\n /* The size class is worn by BOTH forms of the tile — the monogram div and the\n image that replaces it — so it must not set a display. It is emitted after\n .brand-tile-placeholder at equal specificity, so a block display here would\n beat that rule's flex centering and un-center every monogram in a ledger\n row. Scoped to the element that actually needs it, below. */\n .${Pe}ledger-logo {\n width: 44px;\n height: 44px;\n border-radius: 11px;\n object-fit: cover;\n flex-shrink: 0;\n }\n\n img.${Pe}ledger-logo {\n display: block;\n }\n\n .${Pe}ledger-text {\n display: flex;\n flex-direction: column;\n gap: 2px;\n flex: 1 1 auto;\n min-width: 0;\n }\n\n .${Pe}ledger-name {\n font-size: 0.95rem;\n font-weight: 600;\n color: var(--encore-text-color);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .${Pe}ledger-detail {\n font-size: 0.8rem;\n color: var(--encore-text-muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .${Pe}ledger-status {\n font-size: 0.85rem;\n font-weight: 600;\n flex-shrink: 0;\n }\n\n .${Pe}ledger-status-active {\n color: var(--encore-success-color);\n }\n\n .${Pe}ledger-status-pending {\n color: var(--encore-text-muted);\n }\n\n /* Primer screen — centered column, one forward CTA. */\n .${Pe}primer-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n max-width: 440px;\n margin: 0 auto;\n padding: 2.5rem 1.75rem 2rem;\n text-align: center;\n animation: ${Pe}fade-in 0.3s ease-out;\n }\n\n .${Pe}primer-title {\n font-size: 1.6rem;\n font-weight: 700;\n color: var(--encore-text-color);\n margin: 0 0 0.5rem 0;\n line-height: 1.2;\n }\n\n .${Pe}primer-subtitle {\n font-size: 1.05rem;\n color: var(--encore-text-muted);\n margin: 0 0 2rem 0;\n line-height: 1.5;\n }\n\n /* Reuses .encore-button-claim (the clean pill) — full-width + prominent. */\n .${Pe}primer-cta {\n width: 100%;\n height: auto;\n min-height: 50px;\n padding: 14px 24px;\n font-size: 1rem;\n font-weight: 600;\n }\n\n /* Redemption screen — the ready state shown by redeem(). */\n .${Pe}redemption-container {\n display: flex;\n flex-direction: column;\n max-width: 440px;\n margin: 0 auto;\n padding: 2rem 1.75rem;\n text-align: center;\n animation: ${Pe}fade-in 0.3s ease-out;\n }\n\n .${Pe}redemption-title {\n font-size: 1.6rem;\n font-weight: 700;\n color: var(--encore-text-color);\n margin: 0 0 0.5rem 0;\n line-height: 1.2;\n }\n\n .${Pe}redemption-subtitle {\n font-size: 1.05rem;\n color: var(--encore-text-muted);\n margin: 0 0 1.75rem 0;\n line-height: 1.5;\n }\n\n .${Pe}redemption-note {\n font-size: 0.8rem;\n color: var(--encore-text-muted);\n line-height: 1.5;\n margin: 1.25rem 0;\n }\n\n .${Pe}redemption-cta {\n width: 100%;\n height: auto;\n min-height: 50px;\n padding: 14px 24px;\n font-size: 1rem;\n font-weight: 600;\n }\n\n /* Mobile sheet composition for both screens. MUST stay AFTER the rules above:\n it overrides their paddings and margins, and the cascade is source order at\n equal specificity. */\n @media (max-width: ${Me}) {\n /* Both fill the full-height sheet (modal-body is a flex column). Top padding\n clears the close button's overlay band; bottom clears the home indicator. */\n .${Pe}primer-container,\n .${Pe}redemption-container {\n flex: 1 1 auto;\n max-width: none;\n width: 100%;\n box-sizing: border-box;\n padding: calc(64px + env(safe-area-inset-top)) 24px\n calc(24px + env(safe-area-inset-bottom));\n }\n\n /* The content block floats centered between two flexible spaces (auto margins\n above the lockup and above the CTA); the CTA sits on the bottom edge. */\n .${Pe}primer-container .${Pe}lockup {\n margin-top: auto;\n }\n\n .${Pe}primer-cta {\n margin-top: auto;\n }\n\n .${Pe}redemption-container > :first-child {\n margin-top: auto;\n }\n\n .${Pe}redemption-cta {\n margin-top: auto;\n }\n }\n `}(e),document.head.appendChild(t),u.debug("Encore styles injected successfully")}catch(e){u.error("Failed to inject Encore styles:",e)}}function Ke(e){return`${Pe}${e}`}class qe{#Ue;#Le=null;#Oe=null;#_e=null;#Pe=null;#Me=!1;#De=null;#ze=[];#Fe=null;#Be=null;#He;#Ve;#Ke;constructor(e={},t={}){this.#Ue=new fe,this.#Ve=t.dismissible??!0,this.#He=(t.showCloseButton??!0)&&this.#Ve,this.#Ke=Ue(t.backgroundColor),Ve(e)}show(){this.#Me?u.warn("Modal is already visible"):(this.#De=document.activeElement,this.#qe(),this.#Le&&document.body.appendChild(this.#Le),this.#Oe&&document.body.appendChild(this.#Oe),document.body.classList.add(Ke("no-scroll")),requestAnimationFrame(()=>{this.#Le?.classList.add(Ke("visible")),this.#Oe?.classList.add(Ke("visible"))}),this.#je(),this.#We(),this.#Ge(),this.#Me=!0,this.#Ue.emit("show",void 0),u.debug("Modal shown"))}hide(){this.#Me&&(this.#Le?.classList.remove(Ke("visible")),this.#Oe?.classList.remove(Ke("visible")),this.#Qe(),this.#Be=setTimeout(()=>{this.#Be=null,this.#Ye()},200))}#Ye(){this.#Xe(),document.body.classList.remove(Ke("no-scroll")),this.#De instanceof HTMLElement&&this.#De.focus(),this.#Me=!1,this.#Ue.emit("hide",void 0),u.debug("Modal hidden")}#Qe(){null!==this.#Be&&(clearTimeout(this.#Be),this.#Be=null)}isVisible(){return this.#Me}setLabelledBy(e){this.#Oe?.setAttribute("aria-labelledby",e)}setContent(e){this.#Pe?(this.#Pe.innerHTML="",this.#Pe.appendChild(e),this.#We(),this.#Oe?.contains(document.activeElement)||this.#Ge()):u.error("Modal body not initialized")}on(e,t){return this.#Ue.on(e,t)}#qe(){this.#Le=document.createElement("div"),this.#Le.className=Ke("backdrop"),this.#Le.setAttribute("aria-hidden","true"),this.#Oe=document.createElement("div"),this.#Oe.className=Ke("modal"),this.#Oe.setAttribute("role","dialog"),this.#Oe.setAttribute("aria-modal","true"),this.#Oe.setAttribute("aria-labelledby",Ke("modal-title")),this.#Ke&&this.#Oe.style.setProperty("background-color",this.#Ke),this.#He&&(this.#_e=document.createElement("button"),this.#_e.className=Ke("close-button"),this.#_e.setAttribute("aria-label","Close modal"),this.#_e.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">\n <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />\n </svg>\n '),this.#Pe=document.createElement("div"),this.#Pe.className=Ke("modal-body"),this.#_e&&this.#Oe.appendChild(this.#_e),this.#Oe.appendChild(this.#Pe)}#Xe(){this.#Le?.remove(),this.#Oe?.remove(),this.#Le=null,this.#Oe=null,this.#_e=null,this.#Pe=null}#je(){this.#_e?.addEventListener("click",()=>{this.#Ue.emit("close",void 0),this.hide()}),this.#Ve&&this.#Le?.addEventListener("click",()=>{this.#Ue.emit("backdropClick",void 0),this.hide()}),this.#Fe=this.#Ze.bind(this),document.addEventListener("keydown",this.#Fe)}#Ze(e){if(this.#Me)switch(e.key){case"Escape":if(e.preventDefault(),!this.#Ve)break;this.#Ue.emit("close",void 0),this.hide();break;case"Tab":e.preventDefault(),this.#Je(e.shiftKey)}}#Je(e){if(0===this.#ze.length)return;const t=this.#ze.findIndex(e=>e===document.activeElement);let n;n=e?t<=0?this.#ze.length-1:t-1:t>=this.#ze.length-1?0:t+1,this.#ze[n]?.focus()}#We(){if(!this.#Oe)return;const e=['button:not([disabled]):not([tabindex="-1"])','a[href]:not([tabindex="-1"])','input:not([disabled]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','[tabindex]:not([tabindex="-1"])'].join(", ");this.#ze=Array.from(this.#Oe.querySelectorAll(e))}#Ge(){this.#ze.length>0&&this.#ze[0]?.focus()}destroy(){this.#Fe&&document.removeEventListener("keydown",this.#Fe),this.#Ue.removeAllListeners(),this.#Qe(),this.#Me&&this.#Ye()}}const je=new Set(["localhost","127.0.0.1","[::1]"]);function We(e){if(!e)return;let t;try{t=new URL(e)}catch{return}return"https:"===t.protocol||"http:"===t.protocol&&je.has(t.hostname)?e:void 0}class Ge{#et=null;#tt;#ne;#Me=!1;#nt=null;#rt=null;#it=null;#ot=null;#st=null;constructor(e,t){this.#tt=e,this.#ne={position:"top",maxWidth:200,...t},this.#at()}#at(){this.#it=this.#lt.bind(this),this.#ot=this.#ct.bind(this),this.#st=this.#dt.bind(this),this.#tt.addEventListener("mouseenter",this.#it),this.#tt.addEventListener("mouseleave",this.#ot)}#lt(){this.#rt&&(clearTimeout(this.#rt),this.#rt=null),this.#nt=window.setTimeout(()=>{this.#ht()},50)}#ct(){this.#nt&&(clearTimeout(this.#nt),this.#nt=null),this.#rt=window.setTimeout(()=>{this.#ut()},100)}#ht(){if(this.#Me)return;this.#et=document.createElement("div"),this.#et.className=Ke("tooltip"),this.#et.setAttribute("role","tooltip"),this.#et.textContent=this.#ne.content,this.#ne.maxWidth&&(this.#et.style.maxWidth=`${this.#ne.maxWidth}px`),this.#ne.position&&this.#et.classList.add(Ke(`tooltip-${this.#ne.position}`));const e=this.#tt.getBoundingClientRect();this.#et.style.top=`${e.top}px`,this.#et.style.left=`${e.left}px`,document.body.appendChild(this.#et),this.#st&&(window.addEventListener("scroll",this.#st,!0),window.addEventListener("resize",this.#st)),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.#et&&(this.#dt(),this.#et.classList.add(Ke("tooltip-visible")))})}),this.#Me=!0}#ut(){this.#Me&&this.#et&&(this.#st&&(window.removeEventListener("scroll",this.#st,!0),window.removeEventListener("resize",this.#st)),this.#et.classList.remove(Ke("tooltip-visible")),setTimeout(()=>{this.#et&&this.#et.parentNode&&this.#et.parentNode.removeChild(this.#et),this.#et=null},200),this.#Me=!1)}#dt(){if(!this.#et||!this.#Me)return;const e=this.#tt.getBoundingClientRect(),t=this.#et.getBoundingClientRect();let n=0,r=0;switch(this.#ne.position??"top"){case"top":n=e.top-t.height-8,r=e.left+e.width/2-t.width/2;break;case"bottom":n=e.bottom+8,r=e.left+e.width/2-t.width/2;break;case"left":n=e.top+e.height/2-t.height/2,r=e.left-t.width-8;break;case"right":n=e.top+e.height/2-t.height/2,r=e.right+8}r=Math.max(8,Math.min(r,window.innerWidth-t.width-8)),n=Math.max(8,Math.min(n,window.innerHeight-t.height-8)),this.#et.style.top=`${n}px`,this.#et.style.left=`${r}px`}updateContent(e){this.#ne.content=e,this.#et&&(this.#et.textContent=e,this.#dt())}destroy(){this.#nt&&(clearTimeout(this.#nt),this.#nt=null),this.#rt&&(clearTimeout(this.#rt),this.#rt=null),this.#Me&&this.#ut(),this.#it&&this.#tt.removeEventListener("mouseenter",this.#it),this.#ot&&this.#tt.removeEventListener("mouseleave",this.#ot),this.#st&&(window.removeEventListener("scroll",this.#st,!0),window.removeEventListener("resize",this.#st))}}class Qe{#Ue;#pt=null;#mt=null;#ft=null;#gt=!0;constructor(e){this.#Ue=new fe,this.#gt=e?.claimEnabled??!0}render(e){this.#pt=e,this.#mt=document.createElement("div"),this.#mt.className=Ke("offer-card");const t=this.#bt(e.imageUrl,e.title,e.tooltipText);this.#mt.appendChild(t);const n=this.#vt(e);return this.#mt.appendChild(n),this.#mt}on(e,t){return this.#Ue.on(e,t)}#bt(e,t,n){const r=document.createElement("div");r.className=Ke("offer-banner");const i=document.createElement("img");i.className=Ke("offer-banner-image"),i.alt=t??"Offer image";const o=We(e);o?(i.src=o,i.complete?i.classList.add(Ke("loaded")):i.onload=()=>{i.classList.add(Ke("loaded"))},i.onerror=()=>{u.warn("Failed to load offer image, using fallback"),i.src=this.#wt(),i.classList.add(Ke("loaded"))}):(i.src=this.#wt(),i.classList.add(Ke("loaded"))),r.appendChild(i);const s=document.createElement("button");return s.className=Ke("banner-info-button"),s.setAttribute("aria-label","More information"),s.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">\n <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />\n </svg>\n ',s.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),u.debug("Info button clicked for offer",{title:t,tooltipText:n})}),n&&(this.#ft=new Ge(s,{content:n,position:"bottom",maxWidth:200}),r.appendChild(s)),r}#wt(){return`data:image/svg+xml;base64,${btoa('\n <svg xmlns="http://www.w3.org/2000/svg" width="600" height="240" viewBox="0 0 600 240">\n <rect width="600" height="240" fill="#E5E7EB"/>\n <text x="50%" y="50%" text-anchor="middle" dy=".3em" fill="#9CA3AF" font-family="sans-serif" font-size="18">\n Offer Image\n </text>\n </svg>\n ')}`}#vt(e){const t=document.createElement("div");t.className=Ke("offer-footer");const n=document.createElement("div");n.className=Ke("offer-merchant");const r=We(e.logoUrl);if(r){const t=document.createElement("img");t.className=Ke("offer-logo"),t.src=r,t.alt=`${e.merchantName??"Merchant"} logo`,t.complete?t.classList.add(Ke("loaded")):t.onload=()=>{t.classList.add(Ke("loaded"))},t.onerror=()=>{u.warn("Failed to load merchant logo",{merchantName:e.merchantName}),t.style.display="none"},n.appendChild(t)}const i=document.createElement("div");if(i.className=Ke("offer-merchant-text"),e.merchantName){const t=document.createElement("div");t.className=Ke("offer-merchant-name"),t.textContent=e.merchantName,i.appendChild(t)}if(e.description){const t=document.createElement("div");t.className=Ke("offer-merchant-desc"),t.textContent=e.description,i.appendChild(t)}n.appendChild(i);const o=document.createElement("button");return o.className=`${Ke("button")} ${Ke("button-claim")}`,o.textContent=e.ctaText??"Claim",o.setAttribute("aria-label",`Claim offer: ${e.title??"offer"}`),this.#gt?o.addEventListener("click",()=>{this.#pt&&this.#Ue.emit("claim",{offer:this.#pt})}):(o.disabled=!0,o.setAttribute("aria-disabled","true")),t.appendChild(n),t.appendChild(o),t}destroy(){this.#ft&&(this.#ft.destroy(),this.#ft=null),this.#Ue.removeAllListeners(),this.#mt=null,this.#pt=null}}class Ye{#ne;#yt=null;#xt=!1;constructor(e={}){this.#ne=e}render(e){const t=document.createElement("div");t.className=Ke("reward-card"),this.#yt=t;const n=v(e.merchantName,e.title)??e.id;t.style.setProperty("--encore-card-tint",function(e){return ye(function(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t>>>0}(e||"encore")%360,.72,.55)}(n)),this.#It(e);const r=v(this.#ne.badgeText)??"Free trial",i=document.createElement("span");i.className=Ke("reward-card-badge"),i.textContent=r,t.appendChild(i),t.appendChild(this.#Ct(e));const o=document.createElement("div");o.className=Ke("reward-card-text");const s=document.createElement("div");s.className=Ke("reward-card-name"),s.textContent=v(e.merchantName,e.title)??"",o.appendChild(s);const a=v(e.perk,e.description);if(a){const e=document.createElement("div");e.className=Ke("reward-card-offer"),e.textContent=a,o.appendChild(e)}return t.appendChild(o),t}#Ct(e){const t=document.createElement("div");t.className=Ke("reward-card-icon");const n=v(e.merchantName,e.title)??"",r=We(e.logoUrl);if(!r)return t.appendChild(this.#kt(n)),t;const i=document.createElement("img");return i.className=Ke("reward-card-icon-image"),i.alt="",i.setAttribute("aria-hidden","true"),i.src=r,i.onerror=()=>{i.remove(),t.appendChild(this.#kt(n))},t.appendChild(i),t}#kt(e){const t=document.createElement("span");return t.className=Ke("reward-card-monogram"),t.setAttribute("aria-hidden","true"),t.textContent=(Array.from(e)[0]??"★").toUpperCase(),t}#It(e){const t=We(e.logoUrl);var n;t&&(n=t,n?new Promise(e=>{let t=!1;const r=n=>{t||(t=!0,window.clearTimeout(i),e(n))},i=window.setTimeout(()=>r(null),4e3);try{const e=new Image;e.crossOrigin="anonymous",e.onload=()=>{try{r(function(e){const t=document.createElement("canvas");t.width=ge,t.height=ge;const n=t.getContext("2d");if(!n)return null;n.drawImage(e,0,0,ge,ge);try{return function(e){let t=0,n=0,r=0,i=0;for(let o=0;o<e.length;o+=4){if((e[o+3]??0)<200)continue;const s=e[o]??0,a=e[o+1]??0,l=e[o+2]??0,c=ve(s,a,l);if(c>.92||c<.1)continue;const{s:d}=we(s,a,l);if(d<.18)continue;const h=d*d;t+=h,n+=s*h,r+=a*h,i+=l*h}if(0===t)return null;const{h:o,s:s,l:a}=we(n/t,r/t,i/t);return ye(o,s,a)}(n.getImageData(0,0,ge,ge).data)}catch{return null}}(e))}catch(e){u.debug("Brand tint sampling failed — keeping the fallback tint",e),r(null)}},e.onerror=()=>r(null),e.src=n}catch(e){u.debug("Brand tint sampling unavailable — keeping the fallback tint",e),r(null)}}):Promise.resolve(null)).then(e=>{e&&!this.#xt&&this.#yt&&this.#yt.style.setProperty("--encore-card-tint",e)})}destroy(){this.#xt=!0,this.#yt?.remove(),this.#yt=null}}let Xe=0;class Ze{#Ue;#Et;#$t=0;#mt=null;#St=null;#At=null;#Tt=null;#Rt=[];#Nt=null;#Ut=null;#Lt=null;#Ot=null;#_t=null;#Pt=0;#Mt=null;#Dt=-1;#zt=-1;#Ft;#Bt=window.matchMedia(`(max-width: ${Me})`);#Ht=!1;#Vt=null;#Kt=null;#qt=-1;#jt=!1;#Wt=!1;#Gt=!1;#gt=!0;#Qt=[];#Yt=[];#Xt=[];#Zt="";#Jt=null;#en;#tn;constructor(e,t,n){if(this.#Ue=new fe,this.#Et=e,this.#Ft=t,this.#jt="paged"===n?.mode,this.#Wt=n?.hideHeader??!1,this.#Gt=n?.selectable??!1,this.#gt=n?.claimEnabled??!0,this.#en=Ue(n?.dotColor),this.#tn=Ue(n?.dotActiveColor),this.#Zt=`${Ke("offer-option")}-${Xe+=1}-`,0===e.length)throw new Error("OfferCarousel requires at least one offer");this.#nn()}render(){if(this.#mt=document.createElement("div"),this.#mt.className=this.#jt?`${Ke("carousel")} ${Ke("carousel-paged")}`:Ke("carousel"),this.#Nt=document.createElement("div"),this.#Nt.setAttribute("role","status"),this.#Nt.setAttribute("aria-live","polite"),this.#Nt.setAttribute("aria-atomic","true"),this.#Nt.className="sr-only",this.#Nt.style.position="absolute",this.#Nt.style.width="1px",this.#Nt.style.height="1px",this.#Nt.style.padding="0",this.#Nt.style.margin="-1px",this.#Nt.style.overflow="hidden",this.#Nt.style.clip="rect(0, 0, 0, 0)",this.#Nt.style.whiteSpace="nowrap",this.#Nt.style.border="0",!this.#Wt){const e=this.#rn();this.#mt.appendChild(e)}if(this.#St=document.createElement("div"),this.#St.className=Ke("carousel-cards"),this.#Gt&&(this.#St.setAttribute("role","listbox"),this.#St.setAttribute("tabindex","0"),this.#St.setAttribute("aria-label","Choose an offer"),this.#St.classList.add(Ke("carousel-select"))),this.#mt.appendChild(this.#Nt),this.#mt.appendChild(this.#St),this.#Et.length>1){const e=this.#Gt?this.#in():this.#on();if(this.#mt.appendChild(e),this.#Gt&&!this.#Bt.matches)for(const e of this.#sn())this.#mt.appendChild(e)}return this.#an(),this.#Ht=!this.#jt&&this.#Bt.matches,this.#ln(),this.#jt||(this.#Vt=this.#cn.bind(this),this.#Bt.addEventListener("change",this.#Vt)),this.#mt}#ln(){if(this.#dn(),this.#zt=this.#$t,this.#Ht)this.#hn();else{this.#Gt?this.#un():this.#pn(),this.#mn(),this.#fn(0,!1),this.#gn(this.#$t),this.#bn(this.#$t);const e=this.#Et[this.#$t];e&&this.#Dt!==this.#$t&&(this.#Dt=this.#$t,this.#Ue.emit("offerView",{offer:e,index:this.#$t}))}}#cn(){const e=this.#Bt.matches;e!==this.#Ht&&(this.#Ht=e,this.#ln())}#dn(){this.#Ut&&(document.removeEventListener("keydown",this.#Ut),this.#Ut=null),this.#St&&this.#Jt&&(this.#St.removeEventListener("keydown",this.#Jt),this.#Jt=null),this.#St&&this.#Lt&&(this.#St.removeEventListener("scroll",this.#Lt),this.#Lt=null),this.#St&&this.#Ot&&(this.#St.removeEventListener("scrollend",this.#Ot),this.#Ot=null),null!==this.#_t&&(cancelAnimationFrame(this.#_t),this.#_t=null),this.#Mt&&(clearTimeout(this.#Mt),this.#Mt=null),this.#Kt&&(this.#Kt.disconnect(),this.#Kt=null)}#hn(){this.#St&&(this.#Kt=new IntersectionObserver(e=>{let t=null;for(const n of e){if(!n.isIntersecting)continue;const e=n.target.getAttribute("data-index");if(null===e)continue;const r=Number(e);(!t||n.intersectionRatio>t.ratio)&&(t={index:r,ratio:n.intersectionRatio})}if(!t)return;const{index:n}=t;if(n===this.#qt)return;this.#qt=n,this.#$t=n,n!==this.#zt&&(this.#zt=n,this.#Ue.emit("scroll",{axis:"vertical",position:n}));const r=this.#Et[n];r&&(this.#Ue.emit("offerView",{offer:r,index:n}),u.debug(`Offer ${n+1} entered view`))},{root:this.#St,threshold:.5}),this.#St.querySelectorAll(`.${Ke("carousel-item")}`).forEach(e=>this.#Kt?.observe(e)))}on(e,t){return this.#Ue.on(e,t)}getCurrentIndex(){return this.#$t}getTotalOffers(){return this.#Et.length}next(){const e=Math.min(this.#$t+1,this.#Et.length-1);e!==this.#$t&&(this.#$t=e,this.#gn(e),this.#fn(e),this.#vn(`Showing offer ${e+1} of ${this.#Et.length}`),u.debug(`Navigated to offer ${e+1}`))}getSelectedOffer(){return this.#Et[this.#$t]}claimSelected(){const e=this.getSelectedOffer();e?this.#Ue.emit("offerClaim",{offer:e,index:this.#$t}):u.warn("Claim requested with no selected offer — ignoring")}selectOffer(e){e<0||e>=this.#Et.length||e===this.#$t||(this.#$t=e,this.#gn(e),this.#fn(e),this.#vn(`Selected offer ${e+1} of ${this.#Et.length}`),e!==this.#zt&&(this.#zt=e,this.#Ue.emit("scroll",{axis:"horizontal",position:e})))}previous(){const e=Math.max(this.#$t-1,0);e!==this.#$t&&(this.#$t=e,this.#gn(e),this.#fn(e),this.#vn(`Showing offer ${e+1} of ${this.#Et.length}`),u.debug(`Navigated to offer ${e+1}`))}#an(){if(!this.#St)return;const e=this.#St;this.#Et.forEach((t,n)=>{let r;if(this.#Gt){const e=new Ye;r=e.render(t),this.#Yt.push(e)}else{const e=new Qe({claimEnabled:this.#gt});r=e.render(t),this.#Rt.push(e),e.on("claim",()=>{this.#Ue.emit("offerClaim",{offer:t,index:n})})}const i=document.createElement("div");i.className=Ke("carousel-item"),i.setAttribute("data-index",n.toString()),i.appendChild(r),this.#Gt&&(i.id=`${this.#Zt}${n}`,i.setAttribute("role","option"),i.setAttribute("aria-selected",String(n===this.#$t)),i.addEventListener("click",()=>this.selectOffer(n))),e.appendChild(i)}),requestAnimationFrame(()=>{e.classList.add(Ke("cards-ready"))})}#fn(e,t=!0){if(!this.#St)return;const n=this.#St.querySelectorAll(`.${Ke("carousel-item")}`)[e];if(n){if(this.#Gt){const e=this.#St,r=n.getBoundingClientRect(),i=e.getBoundingClientRect(),o=e.scrollLeft+(r.left+r.width/2-(i.left+i.width/2));return void("function"==typeof e.scrollTo?e.scrollTo({left:o,behavior:t?"smooth":"auto"}):e.scrollLeft=o)}n.scrollIntoView({behavior:t?"smooth":"auto",block:"nearest",inline:"center"})}}#gn(e){this.#wn(),this.#yn(e),this.#xn(e)}#xn(e){if(!this.#Gt||!this.#St)return;const t=this.#St.querySelectorAll(`.${Ke("carousel-item")}`);t.forEach((t,n)=>t.setAttribute("aria-selected",String(n===e)));const n=t[e]?.id;n?this.#St.setAttribute("aria-activedescendant",n):this.#St.removeAttribute("aria-activedescendant"),this.#Qt.forEach((t,n)=>t.classList.toggle(Ke("active"),n===e)),this.#In(e);const r=this.#Et[e];r&&this.#Ue.emit("offerSelect",{offer:r,index:e})}#in(){const e=document.createElement("div");return e.className=Ke("page-indicator"),e.setAttribute("aria-hidden","true"),this.#en&&e.style.setProperty("--encore-dot-color",this.#en),this.#tn&&e.style.setProperty("--encore-dot-active-color",this.#tn),this.#Qt=this.#Et.map((t,n)=>{const r=document.createElement("span");return r.className=n===this.#$t?`${Ke("dot")} ${Ke("active")}`:Ke("dot"),e.appendChild(r),r}),e}#sn(){const e=(e,t,n,r)=>{const i=document.createElement("button");return i.type="button",i.className=`${Ke("reward-arrow")} ${Ke(`reward-arrow-${e}`)}`,i.setAttribute("aria-label",t),i.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${n}" /></svg>`,i.addEventListener("click",r),i};return this.#Xt=[e("prev","Previous offer","M14.5 5.5L8 12l6.5 6.5",()=>this.selectOffer(this.#$t-1)),e("next","Next offer","M9.5 5.5L16 12l-6.5 6.5",()=>this.selectOffer(this.#$t+1))],this.#In(this.#$t),this.#Xt}#In(e){const[t,n]=this.#Xt;t&&(t.disabled=0===e,t.classList.toggle(Ke("disabled"),t.disabled)),n&&(n.disabled=e===this.#Et.length-1,n.classList.toggle(Ke("disabled"),n.disabled))}#un(){this.#St&&(this.#Jt=e=>{let t=null;switch(e.key){case"ArrowLeft":case"ArrowUp":t=this.#$t-1;break;case"ArrowRight":case"ArrowDown":t=this.#$t+1;break;case"Home":t=0;break;case"End":t=this.#Et.length-1;break;default:return}e.preventDefault(),this.selectOffer(Math.max(0,Math.min(t,this.#Et.length-1)))},this.#St.addEventListener("keydown",this.#Jt))}#bn(e){this.#St&&(this.#Pt=e,this.#St.querySelectorAll(`.${Ke("carousel-item")}`).forEach((t,n)=>{n===e?t.classList.add(Ke("active")):t.classList.remove(Ke("active"))}))}#rn(){const e=document.createElement("div");e.className=Ke("carousel-header");const t=document.createElement("h2");t.className=Ke("carousel-title"),t.id=Ke("modal-title"),t.textContent=this.#Ft?.customHeadline??this.#Ft?.titleText??"Unlock 10 free articles – choose an offer below";const n=document.createElement("p");return n.className=Ke("carousel-subtitle"),n.textContent=this.#Cn(this.#$t),this.#At=n,e.appendChild(t),e.appendChild(n),e}#Cn(e){const t=this.#Ft?.customSubheadline??this.#Ft?.subtitleText??"";if(!this.#jt)return t;const n=this.#Et[e]?.perk?.trim();return n||t}#yn(e){if(!this.#jt||!this.#At)return;const t=this.#Cn(e);this.#At.textContent!==t&&(this.#At.textContent=t)}#on(){const e=document.createElement("div");e.className=Ke("carousel-navigation");const t=document.createElement("button");t.className=Ke("nav-button"),t.setAttribute("aria-label","Previous offer"),t.innerHTML=this.#jt?'\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round">\n <path d="M14.5 5.5L8 12l6.5 6.5" />\n </svg>\n ':'\n <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" style="transform: rotate(90deg);">\n <path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" />\n </svg>\n ',t.addEventListener("click",()=>this.previous());const n=document.createElement("button");return n.className=Ke("nav-button"),n.setAttribute("aria-label","Next offer"),n.innerHTML=this.#jt?'\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round">\n <path d="M9.5 5.5L16 12l-6.5 6.5" />\n </svg>\n ':'\n <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" style="transform: rotate(270deg);">\n <path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" />\n </svg>\n ',n.addEventListener("click",()=>this.next()),e.appendChild(t),e.appendChild(n),this.#Tt=e,this.#wn(t,n),e}#wn(e,t){if(!this.#Tt)return;const n=this.#Tt.querySelectorAll(`.${Ke("nav-button")}`),r=e??n[0],i=t??n[1];r&&(r.disabled=0===this.#$t,r.classList.toggle(Ke("disabled"),0===this.#$t)),i&&(i.disabled=this.#$t===this.#Et.length-1,i.classList.toggle(Ke("disabled"),this.#$t===this.#Et.length-1))}#pn(){this.#Ut=this.#kn.bind(this),document.addEventListener("keydown",this.#Ut)}#kn(e){if(this.#mt)switch(e.key){case"ArrowLeft":e.preventDefault(),this.previous();break;case"ArrowRight":e.preventDefault(),this.next()}}#mn(){if(!this.#St)return;const e=this.#St,t="onscrollend"in e;this.#Lt=()=>{null===this.#_t&&(this.#_t=window.requestAnimationFrame(()=>{this.#_t=null,this.#En()})),t||(this.#Mt&&clearTimeout(this.#Mt),this.#Mt=window.setTimeout(()=>this.#$n(),120))},e.addEventListener("scroll",this.#Lt),t&&(this.#Ot=()=>this.#$n(),e.addEventListener("scrollend",this.#Ot))}#Sn(){if(!this.#St)return this.#$t;const e=this.#St,t=e.querySelectorAll(`.${Ke("carousel-item")}`),n=e.getBoundingClientRect(),r=n.left+n.width/2;let i=0,o=1/0;return t.forEach((e,t)=>{const n=e.getBoundingClientRect(),s=Math.abs(r-(n.left+n.width/2));s<o&&(o=s,i=t)}),i}#En(){if(!this.#St)return;const e=this.#Sn();e!==this.#Pt&&this.#bn(e)}#$n(){this.#Mt&&(clearTimeout(this.#Mt),this.#Mt=null);const e=this.#Sn();e!==this.#$t&&(this.#$t=e,this.#gn(e),u.debug(`Gesture settled on offer ${e+1}`)),this.#bn(e),e!==this.#zt&&(this.#zt=e,this.#Ue.emit("scroll",{axis:"horizontal",position:e}));const t=this.#$t;if(t===this.#Dt)return;const n=this.#Et[t];n&&(this.#Dt=t,this.#Ue.emit("offerView",{offer:n,index:t}))}#vn(e){this.#Nt&&(this.#Nt.textContent=e)}#nn(){this.#Et.forEach(e=>{e.imageUrl&&((new Image).src=e.imageUrl,u.debug("Preloading offer image",{offerId:e.id,url:e.imageUrl})),e.logoUrl&&((new Image).src=e.logoUrl,u.debug("Preloading merchant logo",{offerId:e.id,url:e.logoUrl}))})}destroy(){this.#dn(),this.#Vt&&(this.#Bt.removeEventListener("change",this.#Vt),this.#Vt=null),this.#Rt.forEach(e=>e.destroy()),this.#Rt=[],this.#Yt.forEach(e=>e.destroy()),this.#Yt=[],this.#Xt=[],this.#Ue.removeAllListeners(),this.#mt=null,this.#St=null,this.#At=null,this.#Tt=null,this.#Nt=null,this.#Qt=[]}}function Je(e,t,n,r=!1){const i=document.createElement("div");i.className=`${t} ${Ke("brand-tile-placeholder")}`;const o=e.name?.trim().charAt(0);i.textContent=o?o.toUpperCase():"★",r&&i.setAttribute("aria-hidden","true");const s=We(e.logoUrl);if(s){const o=document.createElement("img");o.className=t,o.alt=r?"":e.name?`${e.name} logo`:"Brand logo",r&&o.setAttribute("aria-hidden","true"),o.width=n,o.height=n,o.decoding="async",o.addEventListener("load",()=>i.replaceWith(o)),o.src=s}return i}function et(e,t){const n=document.createElement("div");n.className=Ke("lockup"),n.setAttribute("aria-hidden","true");const r=Je(e,`${Ke("lockup-tile")} ${Ke("lockup-tile-partner")}`,56);return n.appendChild(r),(t.name||t.logoUrl)&&n.appendChild(Je(t,`${Ke("lockup-tile")} ${Ke("lockup-tile-host")}`,56)),n}function tt(e){const t=document.createElement("div");return t.className=Ke("ledger"),e.forEach(e=>t.appendChild(function(e){const t=document.createElement("div");t.className=Ke("ledger-row");const n=Je(e.brand,Ke("ledger-logo"),44,!0),r=document.createElement("div");r.className=Ke("ledger-text");const i=document.createElement("div");if(i.className=Ke("ledger-name"),i.textContent=e.name,r.appendChild(i),e.detail){const t=document.createElement("div");t.className=Ke("ledger-detail"),t.textContent=e.detail,r.appendChild(t)}const o=document.createElement("div");return o.className=`${Ke("ledger-status")} ${Ke(`ledger-status-${e.status.tone}`)}`,o.textContent=e.status.text,t.appendChild(n),t.appendChild(r),t.appendChild(o),t}(e))),t}function nt(e,t,n){const r=document.createElement("button");return r.className=`encore-button-claim ${t}`,r.setAttribute("type","button"),r.textContent=e,r.addEventListener("click",n),r}class rt{#mt=null;#Ue;#n;constructor(e){this.#n=e,this.#Ue=new fe}render(){const{display:e,partner:t}=this.#n,n=e.appDisplayName,r="activation"===this.#n.variant&&n?"activation":"holding",i=document.createElement("div");i.className=Ke("primer-container");const o=t.logoUrl??t.imageUrl,s=et({...t.name&&{name:t.name},...o&&{logoUrl:o}},{...n&&{name:n},...e.logoUrl&&{logoUrl:e.logoUrl}}),a=document.createElement("h2");var l,c;a.className=Ke("primer-title"),a.id=Ke("modal-title"),a.textContent="activation"===r&&n?(l=n,(c=e.trialPeriod)?`Amazing! Your ${c} free trial of ${l} is ready`:`Amazing! Your ${l} reward is ready`):"Your reward is saved";const d=document.createElement("p");var h;d.className=Ke("primer-subtitle"),d.textContent="activation"===r&&n?(e=>`Next you'll see the ${e} activation screen. No charge today.`)(n):(h=t.name)?`Come back any time to claim it from ${h}. No charge today.`:"Come back any time to claim it. No charge today.";const p=nt("activation"===r&&n?((e,t)=>t?`Activate ${e} trial`:`Continue to ${e}`)(n,e.trialPeriod):"Continue",Ke("primer-cta"),()=>{u.debug("User tapped the primer CTA"),this.#Ue.emit("continue",void 0)});return i.appendChild(s),i.appendChild(a),i.appendChild(d),i.appendChild(p),this.#mt=i,u.debug("Primer screen rendered",{variant:r}),i}on(e,t){return this.#Ue.on(e,t)}destroy(){this.#mt&&(this.#mt.remove(),this.#mt=null),this.#Ue.removeAllListeners(),u.debug("Primer screen destroyed")}}const it=e=>({...e.advertiserName&&{name:e.advertiserName},...(e.logoUrl??e.imageUrl)&&{logoUrl:e.logoUrl??e.imageUrl}}),ot=e=>({brand:it(e),name:e.advertiserName??"Your reward",...e.reward&&{detail:e.reward},status:{text:"Pending",tone:"pending"}}),st=e=>{const t=document.createElement("h2");return t.className=Ke("redemption-title"),t.id=Ke("modal-title"),t.textContent=e,t},at=e=>{const t=document.createElement("p");return t.className=Ke("redemption-subtitle"),t.textContent=e,t},lt={activation(e){const t=e.host??{},n=t.name??"your app",r=[{brand:{name:n,...t.logoUrl&&{logoUrl:t.logoUrl}},name:n,...t.detail&&{detail:t.detail},status:{text:t.status??"Active",tone:"active"}},ot(e)];return[et(it(e),{name:n,...t.logoUrl&&{logoUrl:t.logoUrl}}),st((i=n,o=t.trialPeriod,o?`Congratulations! Your ${o} free trial is active.`:`Congratulations! Your ${i} plan is active.`)),at(j(n)),tt(r)];var i,o},reward:e=>[st("Congratulations!"),at(e.reward?`Now claim your ${e.reward}`:"Now claim your reward"),tt([ot(e)])]};class ct{#mt=null;#Ue;#n;constructor(e){this.#n=e,this.#Ue=new fe}render(){const{advertiserName:e,buttonText:t}=this.#n,n=this.#n.variant??"reward",r=Object.prototype.hasOwnProperty.call(lt,n)?n:"reward",i=document.createElement("div");i.className=Ke("redemption-container");for(const e of lt[r](this.#n))i.appendChild(e);const o=document.createElement("p");o.className=Ke("redemption-note"),o.textContent=e?`You'll be sent to ${e}. No payment now, cancel anytime.`:"No payment now, cancel anytime.";const s=nt(t??"Claim your reward",Ke("redemption-cta"),()=>{u.debug("User tapped the redemption CTA"),this.#Ue.emit("continue",void 0)});return i.appendChild(o),i.appendChild(s),this.#mt=i,u.debug("Redemption screen rendered",{variant:r}),i}on(e,t){return this.#Ue.on(e,t)}destroy(){this.#mt&&(this.#mt.remove(),this.#mt=null),this.#Ue.removeAllListeners(),u.debug("Redemption screen destroyed")}}function dt(e){return"object"==typeof e&&null!==e&&(1===e.nodeType&&"string"==typeof e.nodeName&&"function"==typeof e.setAttribute&&"function"==typeof e.cloneNode&&"function"==typeof e.querySelectorAll)}function ht(e,t){return null==e?null:"function"==typeof e?function(e,t){try{const n=e(t);return null==n?null:dt(n)?n:(u.warn("[Encore SDK] Appearance renderer returned a non-element — using the default"),null)}catch(e){return u.warn("[Encore SDK] Appearance renderer threw — using the default",{error:e}),null}}(e,t):dt(e)?e:null}function ut(e){if(null!=e&&"function"!=typeof e&&!dt(e))return e}function pt(e,t,n){void 0!==n&&e.style.setProperty(t,n)}function mt(e,t){pt(e,"color",Ue(t.color)),pt(e,"font-family",Le(t.fontFamily)),pt(e,"font-size",Oe(t.fontSize)),pt(e,"font-weight",function(e){if(null==e)return;if("number"==typeof e)return Number.isInteger(e)&&e>=1&&e<=1e3?String(e):Re("font-weight",e);const t=Ne(e);if(void 0===t)return;if(null===t)return Re("font-weight",e);if(Se.test(t))return t;const n=Number(t);return Number.isInteger(n)&&n>=1&&n<=1e3?t:Re("font-weight",e)}(t.fontWeight)),pt(e,"letter-spacing",Oe(t.letterSpacing)),pt(e,"text-align",function(e){const t=Ne(e);if(void 0!==t)return null===t?Re("text-align",e):Ae.has(t.toLowerCase())?t.toLowerCase():Re("text-align",e)}(t.textAlign))}function ft(e){return"string"==typeof e?.text?v(e.text):void 0}function gt(e,t,n,r){if(null==r)return e;const i=ht(r,{text:t,useCase:n,defaultElement:e});if(i)return i===e?e:wt(e,i,Ke("slot-custom"))?(!e.textContent?.trim()&&t&&e.setAttribute("aria-label",t),e):e;const o=ut(r);if(o){const t=ft(o);t&&(e.textContent=t),mt(e,o)}return e}function bt(e){return ft(ut(e))}function vt(e){const{className:t,label:n,onActivate:r,useCase:i,slot:o}=e,s=!1!==e.enabled,a=document.createElement("button");a.type="button",a.className=t,a.textContent=n;const l=()=>{const e=new AbortController;return s?a.addEventListener("click",r,{signal:e.signal}):(a.disabled=!0,a.setAttribute("aria-disabled","true")),{element:a,setAccessibleName:e=>xt(a,e),destroy:()=>e.abort()}},c=ht(o,{text:n,useCase:i,defaultElement:a});if(!c||c===a){const e=ut(o);if(e){const t=ft(e);t&&(a.textContent=t),function(e,t){mt(e,t),pt(e,"background-color",Ue(t.backgroundColor)),pt(e,"border-radius",Oe(t.borderRadius));const n=Ue(t.borderColor);void 0!==n&&(e.style.setProperty("border-color",n),e.style.setProperty("border-style","solid"))}(a,e)}return l()}const d=document.createElement("div");if(d.className=`${t} ${Ke("slot-host")}`,d.setAttribute("role","button"),d.tabIndex=s?0:-1,s||d.setAttribute("aria-disabled","true"),function(e){try{e.style.setProperty("pointer-events","none");const t=[e,...Array.from(e.querySelectorAll(yt))];for(const e of t)e.setAttribute("tabindex","-1")}catch(e){u.warn("[Encore SDK] Could not neutralize a custom appearance element",{error:e})}}(c),!wt(d,c))return l();d.textContent?.trim()||d.setAttribute("aria-label",n);const h=new AbortController,p=e=>{e.preventDefault(),e.stopImmediatePropagation(),r()};return s&&(d.addEventListener("click",p,{capture:!0,signal:h.signal}),d.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||p(e)},{capture:!0,signal:h.signal})),{element:d,setAccessibleName:e=>xt(d,e,n),destroy:()=>{h.abort(),c.remove()}}}function wt(e,t,n){if(!0===t.parentElement?.classList.contains(Ke("slot-host")))return u.warn("[Encore SDK] The same element was supplied to more than one appearance slot — using the default for this one. Supply a separate element, or a renderer."),!1;const r=e.textContent;try{return e.textContent="",n&&e.classList.add(n),e.appendChild(t),!0}catch(t){return u.warn("[Encore SDK] Could not mount a custom appearance element",{error:t}),n&&e.classList.remove(n),e.textContent=r,!1}}const yt='a[href], button, input, select, textarea, iframe, [tabindex], [contenteditable="true"]';function xt(e,t,n){t?e.setAttribute("aria-label",t):n?e.setAttribute("aria-label",n):e.removeAttribute("aria-label")}const It=Ke("thankyou-title"),Ct="Claim gift";class kt{#ne;#yt=null;#An=null;#Tn=null;#Rn;constructor(e){this.#ne=e}render(){const e=document.createElement("div");e.className=Ke("reward-actions");const t=this.#ne.trustText?.trim(),n=document.createElement("p");n.className=Ke("reward-trust"),n.textContent=t&&t.length>0?t:"No charges until trial ends, cancel anytime.",e.appendChild(n);const r=document.createElement("div");r.className=Ke("reward-cta-stack");const i=this.#ne.useCase??"rewardUsers",o=vt({className:Ke("reward-cta-primary"),label:Ct,onActivate:()=>this.#ne.onClaim(),enabled:!1!==this.#ne.claimEnabled,useCase:i,...this.#ne.claimSlot&&{slot:this.#ne.claimSlot}});r.appendChild(o.element),this.#An=o,this.#Nn();const s=this.#ne.secondary??"decline";if("none"!==s){const e="next"===s,t=vt({className:Ke("reward-cta-secondary"),label:e?"Next offer":"No thanks",onActivate:()=>e?this.#ne.onNext?.():this.#ne.onDecline(),useCase:i,...!e&&this.#ne.declineSlot&&{slot:this.#ne.declineSlot}});r.appendChild(t.element),this.#Tn=t}return e.appendChild(r),this.#yt=e,e}setSelectedOffer(e){this.#Rn=e,this.#Nn()}#Nn(){if(!this.#An)return;const e=this.#Rn?.trim();this.#An.setAccessibleName(e?`${Ct} from ${e}`:void 0)}destroy(){this.#An?.destroy(),this.#Tn?.destroy(),this.#yt?.remove(),this.#yt=null,this.#An=null,this.#Tn=null}}const Et=["#B728F5","#6515ED","#FF9F2B","#22C55E","#38BDF8","#F43F5E"];function $t(e,t){return e+Math.random()*(t-e)}class St{#Un=null;#Ln=null;#On=[];#_n=null;#Pn=0;#Mn=0;#xt=!1;static shouldSkip(){try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}start(e){if(!this.#xt&&!St.shouldSkip())try{const t=e.getBoundingClientRect(),n=Math.round(t.width),r=Math.round(t.height);if(n<1||r<1)return;const i=document.createElement("canvas");i.className=Ke("reward-confetti"),i.setAttribute("aria-hidden","true");const o=i.getContext("2d");if(!o)return;e.appendChild(i),this.#Un=i,this.#Ln=o,this.#Dn(n,r),this.#zn(),this.#Pn=performance.now(),this.#Mn=this.#Pn,this.#_n=requestAnimationFrame(this.#Fn)}catch(e){u.debug("Confetti unavailable — rendering the sheet without it",e),this.destroy()}}#Dn(e,t){const n=this.#Un,r=this.#Ln;if(!n||!r)return;const i=Math.min(2,window.devicePixelRatio||1);n.width=e*i,n.height=t*i,r.scale(i,i)}#zn(){const e=this.#Un;if(!e)return;const t=Math.min(2,window.devicePixelRatio||1),n=e.width/t,r=e.height/t;this.#On=Array.from({length:22},()=>{const e=$t(6,11);return{x:$t(0,n)+$t(-46,46),y:0*r+$t(.15*-r,.3*r),vx:$t(-46,46),vy:$t(40,160),w:e,h:e*$t(.4,.7),rotation:$t(0,2*Math.PI),spin:$t(-4,4),color:Et[Math.floor($t(0,Et.length))]??"#B728F5"}})}#Fn=e=>{if(this.#xt)return;const t=this.#Un,n=this.#Ln;if(!t||!n)return;const r=e-this.#Pn,i=Math.min(.05,(e-this.#Mn)/1e3);if(this.#Mn=e,r>=2e3)return void this.destroy();const o=Math.min(2,window.devicePixelRatio||1),s=t.height/o;n.clearRect(0,0,t.width/o,s);const a=r/2e3;n.globalAlpha=a<.66?1:Math.max(0,1-(a-.66)/.34);for(const e of this.#On)e.vy+=320*i,e.vx*=Math.pow(.86,i),e.x+=e.vx*i,e.y+=e.vy*i,e.rotation+=e.spin*i,e.y-e.h>s||(n.save(),n.translate(e.x,e.y),n.rotate(e.rotation),n.fillStyle=e.color,n.fillRect(-e.w/2,-e.h/2,e.w,e.h),n.restore());this.#_n=requestAnimationFrame(this.#Fn)};destroy(){this.#xt=!0,null!==this.#_n&&(cancelAnimationFrame(this.#_n),this.#_n=null),this.#Un?.remove(),this.#Un=null,this.#Ln=null,this.#On=[]}}class At{#Bn=null;#Hn=null;#Vn=!1;start(e){this.#Vn?u.warn("FocusDetector already active"):(this.#Bn=()=>{u.debug("Window focused"),e()},this.#Hn=()=>{"visible"===document.visibilityState&&(u.debug("Document became visible"),e())},window.addEventListener("focus",this.#Bn),document.addEventListener("visibilitychange",this.#Hn),this.#Vn=!0,u.debug("FocusDetector started"))}stop(){this.#Vn&&(this.#Bn&&(window.removeEventListener("focus",this.#Bn),this.#Bn=null),this.#Hn&&(document.removeEventListener("visibilitychange",this.#Hn),this.#Hn=null),this.#Vn=!1,u.debug("FocusDetector stopped"))}isActive(){return this.#Vn}}const Tt="user_id",Rt="user_attributes";function Nt(e){const t=e.useCase;if(void 0===t||l(t))return e;const n="string"==typeof t?s(t):void 0,{useCase:r,...i}=e;return n?{...i,useCase:n}:i}function Ut(e){const t=e?.values?.text;return!!t&&Object.keys(t).length>0}function Lt(e){return"reduceChurn"===(e??"reduceChurn")}const Ot=new class{#Kn;#p;#m=null;#k=null;#qn=null;#jn=null;#Wn=null;#Gn=null;#Qn=null;#Yn=new Set;#Ue;#Xn=null;#f=null;#Zn={};#Jn=!1;#er=!1;#gt=!0;#tr={};#nr;#rr={};#ir;#or={};#sr={};#ar=new Set;#lr=new Set;#cr=null;#dr=null;#hr;#ur;constructor(){var e;this.#Kn=new p,this.#p=new f,this.#hr=new K((e=this.#p,{read:()=>e.get(F),write:t=>e.set(F,t)})),this.#ur=new K(function(){let e=null;return{read:()=>e,write:t=>{e=t}}}()),this.#Ue=new fe}configure(e){const t=this.#Kn.configure(e);if(t){this.#pr();const e=this.#Kn.getBaseURL(),t=this.#Kn.getAnalyticsBaseURL(),n=this.#Kn.getApiKey()??"";if(e){if(this.#m=new Z(n,e),t){if(this.#k=new ie(n,t,this.#p),!this.#Wn){const e=new de(n,t,this.#p);this.#Wn=new le(this.#p,()=>this.#f,e),e.flush()}this.#Xn||(this.#Xn=new he(n,t,this.#p),this.#Xn.flush())}this.#f&&(this.#qn=new b(this.#p,this.#m,this.#f),this.#Qn="strict"===this.#Kn.getUnlockMode()?new _(this.#p,this.#m,this.#f):null,this.#jn?.destroy(),this.#jn=new T(this.#m,this.#f,this.#k??void 0)),this.#Gn=new At}if(u.info("Encore SDK initialized successfully",{version:G}),this.#k&&this.#f){const e="undefined"!=typeof window?window.location.hostname:"unknown";this.#k.track(function(e,t,n){return{name:"sdk_initialized",distinctId:e,properties:{sdkVersion:t,appBundleId:n,platform:"web"}}}(this.#f,G,e))}this.#m&&this.#f&&this.#m.initUser(this.#f).catch(e=>{u.warn("Failed to init user on backend (non-blocking)",e),this.#mr("api_request",e)}),this.#fr(),this.#gr()}return t}#pr(){const e=this.#p.get(Tt);e?(this.#f=e,u.debug("Loaded existing user ID:",e)):(this.#f=A(),this.#p.set(Tt,this.#f),u.debug("Generated new user ID:",this.#f));const t=this.#p.get(Rt);t&&(this.#Zn=t,u.debug("Loaded user attributes"))}#br(){return!!this.#Kn.isConfigured()||(u.error("SDK not configured. Call Encore.configure() first."),!1)}identify(e,t){if(!this.#br())return;if(!e||"string"!=typeof e)return void u.error("identify() requires a valid user ID string");const n=this.#f;if(this.#f=e,this.#p.set(Tt,e),t&&this.setUserAttributes(t),n!==e&&(u.info("User identified:",e),this.#qn&&this.#qn.setUserId(e),this.#jn&&this.#jn.setUserId(e),this.#Qn?.setUserId(e),this.#m&&n&&this.#m.identifyUser(n,e,t?.email?{email:t.email}:void 0).catch(e=>{u.warn("Failed to identify user on backend (non-blocking)",e),this.#mr("api_request",e)}),this.#k)){const n="undefined"!=typeof window?window.location.hostname:"unknown";this.#k.track(function(e,t,n,r){return{name:"user_identified",distinctId:e,properties:{userId:t,appBundleId:n,...r&&{attributes:r}}}}(e,e,n,t))}}getCurrentUserId(){return this.#f}getAppAccountId(){return this.#f}reset(){this.#br()&&(u.info("Resetting SDK"),this.#p.clear(),this.#f=A(),this.#p.set(Tt,this.#f),this.#Zn={},this.#tr={},this.#or={},this.#rr={},this.#ir=void 0,this.#ur.clear(),this.#sr={},this.#ar.clear(),this.#cr=null,this.#qn&&(this.#qn.clearQueue(),this.#qn.destroy(),this.#m&&this.#f&&(this.#qn=new b(this.#p,this.#m,this.#f))),this.#f&&this.#Qn?.setUserId(this.#f),this.#jn&&(this.#jn.clearCache(),this.#jn.destroy(),this.#m&&this.#f&&(this.#jn=new T(this.#m,this.#f,this.#k??void 0))),this.#Gn?.isActive()&&this.#Gn.stop(),this.#gr(),this.#dr?.(),this.#dr=null,u.debug("SDK reset complete",{newUserId:this.#f}))}getVersion(){return G}get isClaimEnabled(){return this.#gt}set isClaimEnabled(e){this.#gt=e,u.debug("Claim enablement changed",{isClaimEnabled:e})}isConfigured(){return this.#Kn.isConfigured()}getConfiguration(){return this.#Kn.isConfigured()?{apiKey:this.#Kn.getApiKey()??"",environment:this.#Kn.getEnvironment()??"",baseURL:this.#Kn.getBaseURL()??"",analyticsBaseURL:this.#Kn.getAnalyticsBaseURL()??"",logLevel:this.#Kn.getConfig()?.logLevel??"none"}:null}async getExperimentState(){return this.#Kn.isConfigured()&&this.#Wn?this.#Wn.getState():null}setLogLevel(e){u.setLogLevel(e)}async revokeEntitlements(){if(!this.#br())return!1;if(!this.#m||!this.#f)return!1;try{return await this.#m.revokeEntitlements(this.#f)}catch(e){return u.error("Failed to revoke entitlements",e),!1}}setUserAttributes(e){this.#br()&&(e&&"object"==typeof e?(this.#Zn={...this.#Zn,...e,custom:{...this.#Zn.custom,...e.custom}},this.#p.set(Rt,this.#Zn),u.debug("User attributes updated",this.#Zn)):u.error("setUserAttributes() requires a valid UserAttributes object"))}getUserAttributes(){return{...this.#Zn}}async show(e,t,n){const{result:r,...i}=await this.#vr(e,t,n);return this.#wr(r,i,t,n),r}async#vr(e,n,r){const o=A(),s=(c=n?.useCase,l(c)?c:"reduceChurn");var c;if(this.#yr(o,s,r),!this.#br()){const n="notConfigured";return e?.onNotGranted?.(n),e?.onError?.({code:t.INITIALIZATION_ERROR,message:"SDK not configured"}),this.#xr("not_configured",o,s,r),{result:{status:"dismissed",reason:n},presentationId:o}}const d=function(e){return void 0===e||i.includes(e)?null:{code:t.INVALID_REQUEST,message:`useCase ${a(e)} is not a recognised Encore use case — nothing was presented. Supported values: ${i.map(e=>`'${e}'`).join(", ")}.`,details:{useCase:e}}}(n?.useCase);if(d){u.error(`[Encore SDK] Integration error: ${d.message}`),this.#mr("configuration",new Error(d.message));const t={type:"error",error:d};return e?.onNotGranted?.(t),e?.onError?.(d),{result:{status:"dismissed",reason:t},presentationId:o}}if(this.#er){u.warn("show() called while already presenting, ignoring duplicate request");const t="alreadyPresenting";return e?.onNotGranted?.(t),this.#xr("already_presenting",o,s,r),{result:{status:"dismissed",reason:t},presentationId:o}}this.#er=!0;try{const t=await this.#Ir(o,n,r),i=t.result;return"claimed"===i.status?e?.onGranted?.(void 0):"dismissed"===i.status&&i.reason&&e?.onNotGranted?.(i.reason),t}catch(n){u.error("Error during show",n),this.#mr("present_offer_initialization",n);const r={type:"error",error:{code:t.UNKNOWN_ERROR,message:n instanceof Error?n.message:"Unknown error"}};return e?.onError?.(r.error),e?.onNotGranted?.(r),{result:{status:"dismissed",reason:r},presentationId:o,override:{notPresentedReason:"error.unknown_error"}}}finally{this.#er=!1}}#yr(e,t,n){var r;this.#Xn&&this.#f&&this.#Xn.enqueue({name:"sdk_show_entered",distinctId:this.#f,properties:{layer:"web",presentationId:(r={presentationId:e,useCase:t,...void 0!==n&&{placementId:n}}).presentationId,use_case:o(r.useCase),...C(r.placementId)}},A())}#xr(e,t,n,r,i){var s;this.#Xn&&this.#f&&this.#Xn.enqueue({name:"sdk_show_aborted",distinctId:this.#f,properties:{layer:"web",reason:(s={reason:e,presentationId:t,useCase:n,...void 0!==r&&{placementId:r},...void 0!==i&&{variantId:i}}).reason,presentationId:s.presentationId,use_case:o(s.useCase),...C(s.placementId),...void 0!==s.variantId&&{variantId:s.variantId}}},A())}#wr(e,t,n,r){if(!this.#Xn||!this.#f)return;const i=t.presentationId,s={...void 0!==r&&{placementId:r},presentationId:i,useCase:o(n?.useCase??"reduceChurn"),unlockMode:this.#Kn.getUnlockMode(),...void 0!==t.variantId&&{variantId:t.variantId},...me(e,t.override)};this.#Xn.enqueue(function(e,t){const{placementId:n,...r}=t,i=w(n);return{name:"sdk_placement_resolved",distinctId:e,properties:{...r,...i&&{placementId:i}}}}(this.#f,s),i)}async presentOffer(e,t){const n=await this.show(e,t);switch(n.status){case"unavailable":return{granted:!1,reason:"noOffersAvailable"};case"dismissed":return{granted:!1,...n.reason&&{reason:n.reason}};case"claimed":return{granted:!0}}}async redeem(e){if(!this.#br())return{status:"dismissed",reason:{type:"error",error:{code:t.INITIALIZATION_ERROR,message:"SDK not configured"}}};const n=this.#Cr(e?.placement);if(n&&"rewardUsers"!==n.transaction.useCase&&!e?.host?.name&&await this.#kr(),!n)return u.info("redeem(): nothing pending to redeem"),{status:"unavailable"};const{transaction:r,store:i}=n;let o=null;try{this.#Jn||(Ve({}),this.#Jn=!0),o=new qe;const n=o;return await new Promise(o=>{let s=!1;const a=e=>{s||(s=!0,o(e))};n.on("close",()=>a({status:"dismissed"})),n.on("backdropClick",()=>{n.hide(),a({status:"dismissed"})}),n.on("hide",()=>a({status:"dismissed"})),n.show(),this.#Er(n,r,e?.host,()=>{const e=this.#$r(),o=this.#Sr(r.useCase),s=r.useCase??"reduceChurn";if(this.#Ar(e=>S(e,{...o&&{variantId:o},actionType:"claimOffer",presentationId:r.id,currentState:"redemption",useCase:s})),!this.#Tr(r.offer,r.id,s,e,{campaignId:r.offer.campaignId,...r.offer.advertiserName&&{advertiserName:r.offer.advertiserName},...o&&{variantId:o},useCase:s}))return a({status:"dismissed",reason:{type:"error",error:{code:t.UNKNOWN_ERROR,message:"The advertiser could not be opened (the browser blocked the popup). The claim is still pending — call redeem() again from a user gesture."}}}),void n.hide();i.markRedeemed(r.id),a({status:"redeemed"}),n.hide()})})}catch(e){return u.error("Error during redeem",e),this.#mr("present_offer_initialization",e),{status:"dismissed",reason:{type:"error",error:{code:t.UNKNOWN_ERROR,message:e instanceof Error?e.message:"Unknown error"}}}}finally{o?.destroy()}}getPendingTransaction(e){return this.#br()?this.#Cr(e)?.transaction??null:null}isActive(e,t){return u.error("isActive() has been removed. Entitlement validation must be done server-side. See: https://docs.encorekit.com/server-side-validation"),!1}didGrant(e,t){this.#br()&&(this.#qn?t&&"string"==typeof t?this.#qn.sendGrantSignal(t,e):u.error("didGrant() requires a valid transaction ID"):u.error("SignalManager not initialized"))}async waitForVerification(e,t){if(!this.#br())return u.error("SDK not configured"),"failed";if(!this.#m)return u.error("API client not initialized"),"failed";if(!e)return u.error("waitForVerification() requires a transaction ID"),"failed";try{u.debug("Starting verification wait",{transactionId:e,timeout:t});const n={transactionId:e};void 0!==t&&(n.timeout=t);const r=new L(this.#m,n);return await r.poll()}catch(t){return u.error("Error during verification wait",{transactionId:e,error:t}),"failed"}}on(e,t){return u.error("on() event listener has been removed. Entitlement validation must be done server-side. See: https://docs.encorekit.com/server-side-validation"),()=>{}}observeEntitlement(e,t){return u.error("observeEntitlement() has been removed. Entitlement validation must be done server-side. See: https://docs.encorekit.com/server-side-validation"),{subscribe:e=>()=>{}}}onStrictUnlockVerified(e){return this.#Ue.on("strictUnlockVerified",e)}placement(e,t){let n,r,i;return"string"==typeof e?(n=e,r=e,i=t):(n=`placement_${A().slice(0,8)}`,i=e),new P(n,async e=>this.show(void 0,e,r),i,async()=>this.redeem(r?{placement:r}:void 0))}#mr(e,n){if(!this.#m)return;const r=n instanceof Error?n.message:String(n),i=n instanceof Error?n.stack:void 0,o=U(n),s=function(e){if("object"!=typeof e||null===e)return{};const n=e,r=N(n,"code"),i=n.statusCode;return{...r&&r!==String(t.API_ERROR)?{serverCode:r}:{},..."number"==typeof i?{statusCode:String(i)}:{}}}(n);this.#m.reportError({errorType:o,message:r,context:e,severity:"error",...i&&{stackTrace:i},...this.#f&&{userId:this.#f},...Object.keys(s).length>0&&{metadata:s}}).catch(()=>{}),this.#k&&this.#f&&this.#k.track(function(e,t,n,r){return{name:"sdk_error",distinctId:e,properties:{errorType:t,errorDescription:n,...r&&{context:r}}}}(this.#f,o,r,e))}async#Rr(e,t,n){if("reduceChurn"!==t)return null;const r=this.#Wn?await this.#Wn.getCohort():"notEnrolled";return this.#Wn?.logExposure(r),"control"!==r?null:(this.#k&&this.#f&&this.#k.track(k(this.#f,"experiment_control",e,this.#nr,t,n)),this.#xr("experiment_control",e,t,n,this.#Sr(t)),u.debug("NCL control cohort — ghost trigger, no UI shown"),{result:{status:"unavailable"},override:{notPresentedReason:"experiment_control"}})}#Nr(e){if(e.ui?.values?.text){const t=e.ui.values.text;this.#tr={...t},u.debug("Remote config loaded",t)}this.#nr=e.ui?.variantId??void 0,this.#ir=e.ui?.values,this.#rr={...e.ui?.values?.text?.appName&&{appName:e.ui.values.text.appName},...e.ui?.values?.media?.appstoreIcon&&{appIconUrl:e.ui.values.media.appstoreIcon},...e.entitlements?.native&&{entitlementValue:e.entitlements.native.value,entitlementUnit:e.entitlements.native.unit,trialDurationDays:e.entitlements.native.durationDays}};const t=e.useCases??{},n={};for(const[e,r]of Object.entries(t)){const t=s(e);t&&(n[t]=r)}const r={};for(const e of Object.keys(this.#sr)){const t=this.#or[e];t&&(r[e]=t)}this.#or={...n,...r},this.#Wn?.setConfig(e.experiments?.ncl)}#Ur(e){if(this.#ar.has(e))return null;const t=this.#or[e];return t&&Ut(t)?{variantId:t.variantId??void 0,values:t.values}:null}async#Lr(e){this.#cr||this.#fr(),await this.#kr();return this.#Ur(e)||(await this.#Or(e),this.#Ur(e))}#Or(e){const t=this.#sr[e];if(t)return t;if(!this.#m||!this.#f)return Promise.resolve();this.#_r(e);const n=this.#f,r=this.#m.fetchConfig(n,G,e).then(t=>{if(this.#f!==n)return;const r=t.ui,i=r?.useCase===o(e),s=r?.values;i&&Ut({values:s})?(this.#ar.delete(e),this.#or[e]={variantId:r.variantId??null,variantName:r.variantName??null,template:r.template??null,values:s}):(this.#ar.add(e),delete this.#or[e])}).catch(t=>{u.warn(`Failed to fetch config for use case '${e}' (non-blocking)`,t),delete this.#sr[e]});return this.#sr[e]=r,r}#_r(e){this.#lr.has(e)||(this.#lr.add(e),u.warn(`[INTEGRATION] Use case '${e}' was not prefetched, so it is being fetched on demand — this first presentation will be slower, then it is cached. Nothing has failed. To make it instant, ask Encore to enable '${e}' for this app.`))}#Sr(e){return e&&"reduceChurn"!==e?this.#Ur(e)?.variantId:this.#nr}#fr(){if(!this.#m||!this.#f)return;const e=Date.now(),t=this.#f;this.#cr=this.#m.fetchConfig(t,G).then(n=>{this.#f===t&&(this.#Nr(n),this.#Pr("remote",Date.now()-e))}).catch(t=>{u.warn("Failed to fetch remote config (non-blocking)",t),this.#mr("configuration",t),this.#Pr("fallback",Date.now()-e),this.#cr=null})}#Pr(e,t){var n;this.#k&&this.#f&&this.#k.track({name:"sdk_sdui_config_loaded",distinctId:this.#f,properties:{...(n={...this.#nr&&{variantId:this.#nr},loadSource:e,loadDurationMs:t}).variantId&&{variantId:n.variantId},loadSource:n.loadSource,loadDurationMs:n.loadDurationMs,...n.presentationId&&{presentationId:n.presentationId}}})}async#kr(){if(!this.#cr)return;let e;await Promise.race([this.#cr,new Promise(t=>{e=setTimeout(t,2500)})]),clearTimeout(e)}async#Ir(e,n,r){const i=n?.useCase??"reduceChurn";let o=null;if("reduceChurn"!==i&&(o=await this.#Lr(i),!o))return u.info(`[Encore SDK] No template for use case '${i}' on this app — no-op`),this.#k&&this.#f&&this.#k.track(k(this.#f,"no_template",e,void 0,i,r)),{result:{status:"unavailable"},presentationId:e,override:{notPresentedReason:"use_case_unavailable"}};if(!this.#jn||!this.#m)return u.error("Managers not initialized"),{result:{status:"dismissed",reason:{type:"error",error:{code:t.INITIALIZATION_ERROR,message:"Managers not initialized"}}},presentationId:e};const s={title:v(n?.headline),subtitle:v(n?.subheadline)},a=this.#Sr(i);this.#k&&this.#f&&this.#k.track(function(e,t,n,r,i){return{name:"sdk_offer_presentation_triggered",distinctId:e,properties:{presentationId:t,...n&&{variantId:n},...I(r),...C(i)}}}(this.#f,e,a,i,r));const l=await this.#Rr(e,i,r);if(l)return{...l,presentationId:e,...void 0!==a&&{variantId:a}};const c=[],d=()=>{for(const e of c.splice(0))try{e()}catch{}};try{const l=n?.appearance,h={...l?.accentColor&&{primaryColor:l.accentColor},...l?.backgroundColor&&{backgroundColor:l.backgroundColor},...l?.textColor&&{textColor:l.textColor}};this.#Jn?l&&function(e){const t=document.documentElement,n=ze(e);n.primaryColor&&t.style.setProperty("--encore-primary-color",n.primaryColor),n.backgroundColor&&t.style.setProperty("--encore-bg-color",n.backgroundColor),n.textColor&&t.style.setProperty("--encore-text-color",n.textColor),n.borderRadius&&t.style.setProperty("--encore-border-radius",n.borderRadius),n.fontFamily&&t.style.setProperty("--encore-font-family",n.fontFamily),u.debug("Theme variables updated",n)}(h):(Ve(h),this.#Jn=!0),u.debug("Fetching offers");const p="strict"===this.#Kn.getUnlockMode(),{offers:m}=await this.#jn.fetchOffers(this.#Zn,!0,r,p?15e3:void 0);if(0===m.length)return u.info("No offers available"),this.#k&&this.#f&&this.#k.track(k(this.#f,"no_offer_available",e,a,i,r)),{result:{status:"unavailable"},presentationId:e,...void 0!==a&&{variantId:a},override:{notPresentedReason:"no_offer_available"}};const f={...this.#tr,...s.title&&{titleText:s.title,customHeadline:s.title},...s.subtitle&&{subtitleText:s.subtitle,customSubheadline:s.subtitle}};this.#jn.beginPresentation(a,i,r,e);const g=new Map;m.forEach(e=>{g.set(e.id,A())});const b=e=>{let t=g.get(e);return t||(t=A(),g.set(e,t)),t};this.#k&&this.#f&&this.#k.track(function(e,t,n,r,i,o){return{name:"sdk_offer_presentation_success",distinctId:e,properties:{presentationId:t,offerCount:n,...r&&{variantId:r},...I(i),...C(o)}}}(this.#f,e,m.length,a,i,r));const w=t=>({campaignId:t.campaignId,...t.creativeId&&{creativeId:t.creativeId},...null!=t.merchantName&&{advertiserName:t.merchantName},impressionId:b(t.id),offerIndex:m.indexOf(t),totalOffers:m.length,presentationId:e,...a&&{variantId:a},...i&&{useCase:i},...r&&{placementId:r}}),y=new qe({},{showCloseButton:"rewardUsers"!==i,...!1===n?.dismissible&&{dismissible:!1},...l?.modalBackgroundColor&&{backgroundColor:l.modalBackgroundColor}}),x={rewardActions:null,confetti:null},E=new Ze(m,f,"rewardUsers"===i?{mode:"paged",hideHeader:!0,selectable:!0,claimEnabled:this.#gt,...l?.dotColor&&{dotColor:l.dotColor},...l?.dotActiveColor&&{dotActiveColor:l.dotActiveColor}}:{claimEnabled:this.#gt});c.push(()=>y.destroy()),c.push(()=>E.destroy()),c.push(()=>x.rewardActions?.destroy()),c.push(()=>x.confetti?.destroy());const T=await new Promise(c=>{let d=!1;const h=(t,n)=>{d||(d=!0,c({result:t,presentationId:e,...void 0!==a&&{variantId:a},...n&&{override:n}}))};let p=null,f="carousel";E.on("offerClaim",n=>{const o=n.offer;u.debug("User claimed offer",{offerId:o.id});const s=w(o);this.#Ar(e=>function(e,t){return{name:"sdk_offer_claim_tapped",distinctId:e,properties:$(t)}}(e,s)),this.#Ar(t=>S(t,{...a&&{variantId:a},actionType:"claimOffer",presentationId:e,currentState:"carousel",useCase:i,...r&&{placementId:r}}));const l=this.#Mr(i),c=M(l)?null:this.#$r();(async()=>{try{const e=b(o.id),t=m.indexOf(o),n=await this.#Dr(o,e,t,m.length,i),a=this.#zr(o,n);if(p=a,M(l)){const e=this.#Fr(l,o,n,i,r,o.perk);return this.#jn?.endPresentation(void 0,i),f="primer",void this.#Br(y,e,()=>{h(a),y.hide()})}this.#Tr(o,n,i,c,s),this.#jn?.endPresentation(void 0,i),y.hide(),h(a)}catch(e){u.error("Error creating transaction",{offerId:o.id,error:e}),this.#mr("start_transaction",e),p||this.#Ar(t=>function(e,t,n){return{name:"sdk_offer_claim_failed",distinctId:e,properties:{...$(t),reason:n.reason,...n.errorDescription&&{errorDescription:n.errorDescription},...n.transactionId&&{transactionId:n.transactionId}}}}(t,s,{reason:this.#jn?"transaction_start_failed":"manager_unavailable",errorDescription:e instanceof Error?e.message:"Transaction failed"})),this.#Hr(c),this.#jn?.endPresentation("error",i),y.hide(),p?h(p):h({status:"dismissed",reason:{type:"error",error:{code:t.UNKNOWN_ERROR,message:e instanceof Error?e.message:"Transaction failed"}}},{advertiserOutcome:"failed",dismissal:"interrupted"})}})()}),E.on("complete",e=>{e.claimed||(u.debug("User declined last offer"),this.#jn?.endPresentation("userDeclinedLastOffer",i),E.destroy(),y.hide(),h({status:"dismissed",reason:"userDeclinedLastOffer"}))});const g=()=>{if(this.#Ar(t=>S(t,{...a&&{variantId:a},actionType:"close",presentationId:e,currentState:f,useCase:i,...r&&{placementId:r}})),p)return E.destroy(),void h(p);u.debug("User closed modal"),this.#jn?.endPresentation("userClosedModal",i),E.destroy(),h({status:"dismissed",reason:"userClosedModal"})};if(y.on("close",g),y.on("backdropClick",()=>{if(p)return E.destroy(),y.hide(),void h(p);u.debug("User clicked outside modal"),this.#jn?.endPresentation("userClickedOutside",i),E.destroy(),y.hide(),h({status:"dismissed",reason:"userClickedOutside"})}),E.on("offerView",e=>{const{offer:t}=e,n=b(t.id),r=m.indexOf(t);this.#jn&&this.#jn.trackOfferPresented(t,n,r,m.length,i)}),E.on("scroll",t=>{this.#Ar(n=>function(e,t){return{name:"sdk_sdui_scroll",distinctId:e,properties:{...t.variantId&&{variantId:t.variantId},scrollAxis:t.scrollAxis,scrollPosition:t.scrollPosition,presentationId:t.presentationId,...I(t.useCase),...C(t.placementId)}}}(n,{...a&&{variantId:a},scrollAxis:t.axis,scrollPosition:t.position,presentationId:e,useCase:i,...r&&{placementId:r}}))}),y.on("hide",()=>{h(p||{status:"dismissed",reason:"userClosedModal"})}),"rewardUsers"===i){const e=new kt({onClaim:()=>E.claimSelected(),onDecline:()=>{g(),y.hide()},claimEnabled:this.#gt,useCase:i,...!1===n?.dismissible&&{secondary:E.getTotalOffers()>1?"next":"none",onNext:()=>E.getCurrentIndex()>=E.getTotalOffers()-1?E.selectOffer(0):E.next()},...l?.claimButton&&{claimSlot:l.claimButton},...l?.declineButton&&{declineSlot:l.declineButton}});x.rewardActions=e,E.on("offerSelect",t=>{e.setSelectedOffer(t.offer.merchantName)})}y.show();const k=E.render();let A;if("rewardUsers"===i&&o){const e=o.values?.text,t=v(bt(l?.headline),s.title,e?.rewardHeadline)??"Congrats! You’ve unlocked an exclusive gift",r=v(bt(l?.subheadline),s.subtitle,e?.rewardSubheadline)??"Choose one of our partner offers below";A=function(e,t={}){const{title:n,subtitle:r,statusIcon:i="none",actions:o,headlineSlot:s,subheadlineSlot:a,useCase:l="rewardUsers"}=t,c=document.createElement("div");c.className=`${Ke("thankyou")} ${Ke("thankyou--reward")}`;const d=document.createElement("div");if(d.className=Ke("thankyou-status"),"success"===i){const e=document.createElement("span");e.className=Ke("thankyou-check"),e.setAttribute("aria-hidden","true"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5l4.5 4.5L19 7.5" /></svg>',d.appendChild(e)}if(n){const e=document.createElement("h2");e.className=Ke("thankyou-title"),e.id=It,e.textContent=n,d.appendChild(gt(e,n,l,s))}else u.warn("Reward layout rendered without a headline — the dialog has no accessible name");if(r||a){const e=document.createElement("p");e.className=Ke("thankyou-subtitle"),e.textContent=r??"";const t=gt(e,r??"",l,a);(t.textContent?.trim()||t.childElementCount>0)&&d.appendChild(t)}return c.appendChild(d),c.appendChild(e),o&&c.appendChild(o),c}(k,{title:t,...r&&{subtitle:r},...n?.statusIcon&&{statusIcon:n.statusIcon},...x.rewardActions&&{actions:x.rewardActions.render()},useCase:i,...l?.headline&&{headlineSlot:l.headline},...l?.subheadline&&{subheadlineSlot:l.subheadline}}),y.setLabelledBy(It)}else A=k;if(y.setContent(A),"rewardUsers"===i){const e=new St;x.confetti=e;const t=A;requestAnimationFrame(()=>e.start(t))}});return d(),T}catch(n){return u.error("Error in offer flow",n),this.#mr("present_offer_initialization",n),d(),{result:{status:"dismissed",reason:{type:"error",error:{code:t.UNKNOWN_ERROR,message:n instanceof Error?n.message:"Unknown error"}}},presentationId:e,...void 0!==a&&{variantId:a},override:{advertiserOutcome:"not_attempted",dismissal:"interrupted"}}}}#zr(e,t){return t||u.warn("[Encore SDK] Claim resolved WITHOUT a transactionId — this conversion cannot be traced back to the user or app. The claim itself succeeded; the transaction record did not."),{status:"claimed",offerId:e.id,campaignId:e.campaignId,advertiserName:e.merchantName??"",...t&&{transactionId:t}}}async#Dr(e,t,n,r,i){if(!this.#jn)throw new Error("OfferManager not initialized");const o=await this.#jn.startTransaction(e.campaignId,i),s=this.#jn.placementId;return this.#Qn?.notePending(o,{grantsEntitlement:Lt(i),...void 0!==i&&{useCase:i},...void 0!==s&&{placementId:s}}),this.#jn.trackOfferClaimed(e,t,o,n,r,i),u.debug("Transaction created",{transactionId:o}),o}#Tr(e,t,n,r,i){const o=this.#Vr(e.advertiserUrl,e.trackingParameters,t),s=this.#Kr(o);i&&this.#Ar(e=>function(e,t,n){return{name:"sdk_offer_webview_attempting_open",distinctId:e,properties:{...$(t),url:n.url,urlHost:n.urlHost}}}(e,i,{url:o,urlHost:s}));const a=this.#qr(r,o);return a||u.warn("Failed to open advertiser URL (popup blocked?)"),i&&(a?(this.#Ar(e=>function(e,t,n){return{name:"sdk_offer_webview_opened",distinctId:e,properties:{...$(t),url:n.url,urlHost:n.urlHost,openedAt:n.openedAt}}}(e,i,{url:o,urlHost:s,openedAt:(new Date).toISOString()})),this.#jr(i,t)):this.#Ar(e=>function(e,t,n){return{name:"sdk_offer_webview_load_failed",distinctId:e,properties:{...$(t),url:n.url,urlHost:n.urlHost,loadSuccess:!1,reason:n.reason}}}(e,i,{url:o,urlHost:s,reason:"popup_blocked"}))),a&&this.#Wr(t,i),Lt(n)&&"strict"!==this.#Kn.getUnlockMode()&&this.didGrant("provisional",t),a}#gr(){this.#Qn&&(this.#Gn?.start(()=>{this.#Gr()}),this.#Gr())}async#Gr(){const e=this.#Qn;if(!e||this.#er)return;const t=e.getPending();if(t&&!this.#Yn.has(t.transactionId)){u.debug("Strict unlock: reconciling pending claim",{transactionId:t.transactionId}),this.#Yn.add(t.transactionId);try{"verified"===await e.verify(t.transactionId)&&this.#Qr(t.transactionId)}finally{this.#Yn.delete(t.transactionId)}}}#Wr(e,t){const n=this.#Qn;n&&!this.#Yn.has(e)&&(this.#Yn.add(e),(async()=>{try{const r=await n.verify(e);if("verified"!==r)return void u.debug("Strict unlock: not verified in session, left pending",{transactionId:e,status:r});this.#Qr(e,t)}finally{this.#Yn.delete(e)}})())}#Qr(e,t){const n=this.#Qn?.getPending();n?.transactionId===e?(this.#Qn?.clearPending(),n.grantsEntitlement&&this.didGrant("final",e),this.#Ar(r=>function(e,t,n){return{name:"sdk_offer_verified",distinctId:e,properties:{...n?$(n):{},transactionId:t.transactionId,...I(t.useCase),...C(t.placementId)}}}(r,{transactionId:e,...void 0!==n.useCase&&{useCase:n.useCase},...void 0!==n.placementId&&{placementId:n.placementId}},t)),this.#Ue.emit("strictUnlockVerified",e),u.debug("Strict unlock: claim verified",{transactionId:e})):u.debug("Strict unlock: verification superseded by a newer claim",{transactionId:e})}#Kr(e){try{return new URL(e).hostname}catch{return""}}#jr(e,t){if("undefined"==typeof window||"undefined"==typeof document)return;const n=this.#f;if(this.#k&&n)try{this.#dr?.();const r=Date.now();let i=!1;const o=()=>{window.removeEventListener("focus",s),document.removeEventListener("visibilitychange",s),this.#dr===o&&(this.#dr=null)},s=()=>{if(i||"visible"!==document.visibilityState)return;i=!0,o();const s=(Date.now()-r)/1e3;this.#k?.track(function(e,t,n){return{name:"sdk_offer_claim_returned",distinctId:e,properties:{...$(t),...n.transactionId&&{transactionId:n.transactionId}}}}(n,e,{transactionId:t})),this.#k?.track(function(e,t,n){return{name:"sdk_offer_webview_dismissed",distinctId:e,properties:{...$(t),timeSpentSeconds:n.timeSpentSeconds}}}(n,e,{timeSpentSeconds:s}))};window.addEventListener("focus",s),document.addEventListener("visibilitychange",s),this.#dr=o}catch{}}#Ar(e){const t=this.#f;this.#k&&t&&this.#k.track(e(t))}#Vr(e,t,n){try{const r=new URL(e);t&&Object.entries(t).forEach(([e,t])=>{r.searchParams.append(e,String(t))});let i=r.toString();return i=i.replace(/TRANSACTION_ID/g,n),u.debug("Built final advertiser URL",{original:e,final:i,transactionId:n}),i}catch(t){return u.error("Failed to build advertiser URL",{url:e,error:t}),e.replace(/TRANSACTION_ID/g,n)}}#$r(){try{return window.open("","_blank")}catch(e){return u.error("Failed to open blank advertiser window",{error:e}),null}}#qr(e,t){try{if(e)return e.location.href=t,e.focus(),!0;const n=window.open(t,"_blank","noopener,noreferrer");return!!n&&(n.focus(),!0)}catch(e){return u.error("Failed to navigate advertiser URL",{url:t,error:e}),!1}}#Hr(e){try{e?.close()}catch(e){u.error("Failed to close advertiser window",{error:e})}}#Cr(e){return[this.#hr,this.#ur].map(t=>{const n=e?t.getByPlacement(e):t.getLatest();return n?{transaction:Nt(n),store:t}:null}).filter(e=>null!==e).sort((e,t)=>B(t.transaction)-B(e.transaction))[0]??null}#Mr(e){return function(e,t){return function(e){if(!e||"object"!=typeof e)return;const t=e.claimBehavior;return z.includes(t)?t:void 0}(t)??D[e]}(e,"reduceChurn"===e?this.#ir:this.#or[e]?.values)}#Fr(e,t,n,r,i,o){const s=Date.now(),a={id:n,appAccountId:this.#f??"",...i&&{placementId:i},offer:{id:t.id,campaignId:t.campaignId,advertiserUrl:t.advertiserUrl,...t.trackingParameters&&{trackingParameters:t.trackingParameters},...t.merchantName&&{advertiserName:t.merchantName},...o&&{reward:o},...t.imageUrl&&{imageUrl:t.imageUrl},...t.logoUrl&&{logoUrl:t.logoUrl}},useCase:r,status:"claimed",createdAt:new Date(s).toISOString(),expiresAt:new Date(s+6048e5).toISOString()};return("deferredWhileAlive"===e?this.#ur:this.#hr).save(a),a}#Yr(){return function(e){const t=q(e.appName),n=function(e){const t=q(e.entitlementValue),n=q(e.entitlementUnit);if(!t||!n)return;const r=n.endsWith("s")?n.slice(0,-1):n;return`${t} ${1===Number(t)?r:`${r}s`}`}(e),r=q(e.appIconUrl);return{...t&&{appDisplayName:t},...n&&{trialPeriod:n},...r&&{logoUrl:r}}}(this.#rr)}#Br(e,t,n){const r=this.#Yr();try{const i=new rt({variant:r.appDisplayName?"activation":"holding",display:r,partner:{...t.offer.advertiserName&&{name:t.offer.advertiserName},...t.offer.logoUrl&&{logoUrl:t.offer.logoUrl},...t.offer.imageUrl&&{imageUrl:t.offer.imageUrl}}});i.on("continue",()=>{i.destroy(),n()}),e.setContent(i.render()),u.debug("Primer screen displayed",{transactionId:t.id})}catch(e){u.error("Failed to show the primer screen",e),n()}}#Er(e,t,n,r){try{const{reward:o,advertiserName:s,logoUrl:a,imageUrl:l}=t.offer,c=this.#Yr(),d=n?.name??c.appDisplayName;let h={};if("rewardUsers"!==t.useCase&&d){const e=this.#rr.trialDurationDays,t=e?(i=new Date(Date.now()+24*e*60*60*1e3),`Free until ${new Intl.DateTimeFormat(void 0,{month:"long",day:"numeric",year:"numeric"}).format(i)}`):void 0,r=n?.logoUrl??c.logoUrl;h={host:{name:d,...c.trialPeriod&&{trialPeriod:c.trialPeriod},...n?.status&&{status:n.status},...t&&{detail:t},...r&&{logoUrl:r}}}}const p=new ct({variant:h.host?"activation":"reward",...o&&{reward:o},...s&&{advertiserName:s},...a&&{logoUrl:a},...l&&{imageUrl:l},...h});p.on("continue",()=>{p.destroy(),r()}),e.setContent(p.render()),u.debug("Redemption screen displayed",{transactionId:t.id})}catch(e){u.error("Failed to show redemption screen",e),r()}var i}};e.Encore=Ot,e.default=Ot,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Encore={})}(this,function(e){"use strict";var t;!function(e){e.NETWORK_ERROR="NETWORK_ERROR",e.API_ERROR="API_ERROR",e.CONFIGURATION_ERROR="CONFIGURATION_ERROR",e.INITIALIZATION_ERROR="INITIALIZATION_ERROR",e.STORAGE_ERROR="STORAGE_ERROR",e.INVALID_REQUEST="INVALID_REQUEST",e.UNAUTHORIZED="UNAUTHORIZED",e.NOT_FOUND="NOT_FOUND",e.TIMEOUT="TIMEOUT",e.UNKNOWN_ERROR="UNKNOWN_ERROR"}(t||(t={}));const n={reduceChurn:"churn-intervention",rewardUsers:"post-action-reward"},i=Object.fromEntries(Object.entries(n).map(([e,t])=>[t,e])),r=Object.keys(n);function o(e){return n[e]}function s(e){if(e)return i[e]}function a(e){return"string"==typeof e?`'${e.slice(0,64)}'`:typeof e}function l(e){return r.includes(e)}const c=["none","error","warn","info","debug"],d="[Encore SDK]",h=e=>c.indexOf(e),u=new class{#e="none";setLogLevel(e){this.#e=e}getLogLevel(){return this.#e}#t(e){return h(this.#e)>=h(e)}debug(...e){this.#t("debug")&&console.debug(d,...e)}info(...e){this.#t("info")&&console.info(d,...e)}warn(...e){this.#t("warn")&&console.warn(d,...e)}error(...e){this.#t("error")&&console.error(d,...e)}critical(...e){console.error(d,"[CRITICAL]",...e)}};class p{#n=null;#i=!1;configure(e){if(this.#i)return u.warn("SDK already configured. Ignoring subsequent configure() call."),!1;const t=this.#r(e);if(t)return u.error("Invalid configuration:",t),!1;const n=e.logLevel??"none",i=e.environment??"production";return this.#n={apiKey:e.apiKey,environment:i,baseURL:this.#o(i),analyticsBaseURL:this.#s(i),logLevel:n,unlockMode:e.unlockMode??"optimistic"},u.setLogLevel(n),this.#i=!0,u.debug("SDK configured successfully",this.#n),!0}#r(e){return e.apiKey&&"string"==typeof e.apiKey&&""!==e.apiKey.trim()?e.environment&&!["production","development","staging","localhost"].includes(e.environment)?"environment must be 'production', 'development', 'staging', or 'localhost'":e.logLevel&&!c.includes(e.logLevel)?`logLevel must be one of: ${c.join(", ")}`:e.unlockMode&&!["strict","optimistic"].includes(e.unlockMode)?"unlockMode must be 'strict' or 'optimistic'":null:"apiKey is required and must be a non-empty string"}#o(e){switch(e){case"localhost":return"http://localhost:4000/publisher/sdk/v1";case"development":return"https://api.dev.encorekit.com/encore/publisher/sdk/v1";case"staging":return"https://api.staging.encorekit.com/encore/publisher/sdk/v1";default:return"https://api.encorekit.com/encore/publisher/sdk/v1"}}#s(e){switch(e){case"localhost":return"http://localhost:8081/v1";case"development":return"https://api.dev.encorekit.com/analytics/v1";case"staging":return"https://api.staging.encorekit.com/analytics/v1";default:return"https://api.encorekit.com/analytics/v1"}}getConfig(){return this.#n}isConfigured(){return this.#i}getApiKey(){return this.#n?.apiKey??null}getBaseURL(){return this.#n?.baseURL??null}getAnalyticsBaseURL(){return this.#n?.analyticsBaseURL??null}getEnvironment(){return this.#n?.environment??null}getUnlockMode(){return this.#n?.unlockMode??"optimistic"}reset(){this.#n=null,this.#i=!1,u.debug("Configuration reset")}}const f="encore_";class g{#a;#l;constructor(){this.#l=new Map,this.#a=this.#c(),u.debug(`StorageManager initialized with ${this.#a}`)}#c(){return this.#d("localStorage")?"localStorage":this.#d("sessionStorage")?"sessionStorage":(u.warn("Neither localStorage nor sessionStorage available, using in-memory storage"),"memory")}#d(e){try{const t="localStorage"===e?localStorage:sessionStorage,n="__encore_test__";return t.setItem(n,"test"),t.removeItem(n),!0}catch{return!1}}#h(){return"localStorage"===this.#a?localStorage:"sessionStorage"===this.#a?sessionStorage:this.#l}#u(e){return`${f}${e}`}set(e,t){if(void 0===t)return void u.warn(`Attempted to store undefined value for key: ${e}`);const n=this.#u(e),i=JSON.stringify(t);try{const t=this.#h();t instanceof Map?t.set(n,i):t.setItem(n,i),u.debug(`Stored ${e} in ${this.#a}`)}catch(e){e instanceof Error&&"QuotaExceededError"===e.name?u.error("Storage quota exceeded:",e):u.error("Failed to store item:",e),"memory"!==this.#a&&(u.warn("Falling back to memory storage for this item"),this.#l.set(n,i))}}get(e){const t=this.#u(e);try{const n=this.#h();let i=null;return i=n instanceof Map?n.get(t)??null:n.getItem(t),null===i||"undefined"===i?("undefined"===i&&(u.warn(`Found corrupted value "undefined" for key: ${e}, cleaning up`),this.remove(e)),null):JSON.parse(i)}catch(t){return u.error(`Failed to retrieve ${e}:`,t),this.remove(e),null}}remove(e){const t=this.#u(e);try{const n=this.#h();n instanceof Map?n.delete(t):n.removeItem(t),u.debug(`Removed ${e} from ${this.#a}`)}catch(t){u.error(`Failed to remove ${e}:`,t)}}clear(){try{const e=this.#h();if(e instanceof Map)for(const t of e.keys())t.startsWith(f)&&e.delete(t);else{const t=[];for(let n=0;n<e.length;n++){const i=e.key(n);i?.startsWith(f)&&t.push(i)}t.forEach(t=>e.removeItem(t))}u.debug(`Cleared all Encore data from ${this.#a}`)}catch(e){u.error("Failed to clear storage:",e)}}getStorageType(){return this.#a}}const m="signal_queue";class b{#p;#f;#g;#m=[];#b=!1;#w;constructor(e,t,n){this.#p=e,this.#f=t,this.#g=n,this.#y(),this.#x(),this.processQueue()}setUserId(e){this.#g!==e&&(u.debug("SignalManager: User ID changed, clearing queue"),this.#g=e,this.#m=[],this.#y())}#y(){try{const e=`${this.#g}_${m}`,t=this.#p.get(e);t&&Array.isArray(t)&&(this.#m=t,u.debug("Loaded grant signal queue from storage",{count:t.length}))}catch(e){u.error("Failed to load grant signal queue from storage:",e)}}#v(){try{const e=`${this.#g}_${m}`;this.#p.set(e,this.#m),u.debug("Saved grant signal queue to storage",{count:this.#m.length})}catch(e){u.error("Failed to save grant signal queue to storage:",e)}}enqueue(e,t){const n=this.#m.some(n=>n.transactionId===e&&n.grantType===t);if(n)return void u.debug("Grant signal already in queue, skipping",{transactionId:e,grantType:t});const i={transactionId:e,grantType:t,timestamp:(new Date).toISOString(),attempts:0};this.#m.push(i),this.#v(),u.info("Grant signal added to queue",{transactionId:e,grantType:t})}dequeue(e){const t=this.#m.findIndex(t=>t.transactionId===e.transactionId&&t.grantType===e.grantType);-1!==t&&(this.#m.splice(t,1),this.#v(),u.debug("Grant signal removed from queue",{transactionId:e.transactionId,grantType:e.grantType}))}getQueue(){return[...this.#m]}clearQueue(){this.#m=[],this.#v(),u.debug("Grant signal queue cleared")}async sendGrantSignal(e,t){try{if(u.debug("Sending grant signal",{transactionId:e,grantType:t}),!await this.#f.sendGrantSignal(e,t))throw new Error("Grant signal failed (returned false)");u.info("Grant signal sent successfully",{transactionId:e,grantType:t})}catch{u.warn("Failed to send grant signal, adding to queue",{transactionId:e,grantType:t}),this.enqueue(e,t)}}async processQueue(){if(this.#b)u.debug("Queue processing already in progress, skipping");else if(0!==this.#m.length){this.#b=!0,u.info("Processing grant signal queue",{count:this.#m.length});try{for(const e of[...this.#m])await this.#k(e),this.#m.length>1&&await this.#$(100)}finally{this.#b=!1}}}async#k(e){if(e.attempts>=3)return u.error("Grant signal max attempts reached, removing from queue",{transactionId:e.transactionId,grantType:e.grantType,attempts:e.attempts}),void this.dequeue(e);if(e.lastAttemptAt){const t=new Date(e.lastAttemptAt).getTime(),n=Date.now(),i=1e3*Math.pow(2,e.attempts-1),r=n-t;if(r<i)return void u.debug("Skipping signal, waiting for backoff period",{transactionId:e.transactionId,remainingWait:i-r})}e.attempts++,e.lastAttemptAt=(new Date).toISOString(),this.#v();try{u.debug("Attempting to send queued grant signal",{transactionId:e.transactionId,grantType:e.grantType,attempt:e.attempts}),await this.#f.sendGrantSignal(e.transactionId,e.grantType)?(u.info("Queued grant signal sent successfully",{transactionId:e.transactionId,grantType:e.grantType}),this.dequeue(e)):u.warn("Grant signal failed, will retry",{transactionId:e.transactionId,attempt:e.attempts})}catch(t){u.warn("Failed to send queued grant signal, will retry",{transactionId:e.transactionId,attempt:e.attempts,error:t})}}#x(){this.#w=function(e){const t=()=>{u.debug("Network status: online"),e()};return window.addEventListener("online",t),()=>{window.removeEventListener("online",t)}}(()=>{u.debug("Network came online, processing grant signal queue"),this.processQueue()})}destroy(){this.#w&&(this.#w(),this.#w=void 0)}#$(e){return new Promise(t=>setTimeout(t,e))}}function w(...e){for(const t of e){const e=t?.trim();if(e)return e}}function y(e){const t=w(e);return t?.slice(0,64)}const x={userClosedModal:"close_button",userClickedOutside:"dismissed",userDeclinedLastOffer:"last_offer_declined",error:"interrupted",appBackgrounded:"app_backgrounded",appTerminated:"app_terminated"};function v(e){if(null!=e)return x[e]??e}function k(e){return e?{use_case:o(e)}:{}}function $(e){const t=y(e);return t?{placement_id:t}:{}}function C(e,t,n,i,r,o){return{name:"sdk_offer_presentation_failed",distinctId:e,properties:{reason:t,presentationId:n,...i&&{variantId:i},...k(r),...$(o)}}}function E(e,t){const{useCase:n,placementId:i,...r}=t;return{name:"sdk_offer_time_spent",distinctId:e,properties:{...r,...k(n),...$(i)}}}function I(e){const{useCase:t,placementId:n,...i}=e,r={};for(const e in i){const t=i[e];void 0!==t&&(r[e]=t)}return{...r,...k(t),...$(n)}}function T(e,t){return{name:"sdk_sdui_button_tapped",distinctId:e,properties:{...t.variantId&&{variantId:t.variantId},actionType:t.actionType,presentationId:t.presentationId,currentState:t.currentState,...k(t.useCase),...$(t.placementId)}}}function S(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=15&(crypto.getRandomValues(new Uint8Array(1))[0]??0);return("x"===e?t:3&t|8).toString(16)})}class A{#f;#C;#g;#E=[];#I=null;#T=null;#S=null;#A=new Map;#L=0;#N;#R;#O;#U=null;#M=!1;#F=null;constructor(e,t,n){this.#f=e,this.#g=t,this.#C=n??null,this.#_()}async fetchOffers(e,t=!0,n,i){const r=void 0!==i;if(!r&&t&&this.#E.length>0&&this.#I)return u.debug("Using cached offers",{count:this.#E.length}),{offers:[...this.#E]};try{u.debug("Fetching offers from API",{userId:this.#g,maxPostbackTimeMs:i});const t=await this.#f.fetchOffers(this.#g,e,n,i);return 0===t.offers?.length?(u.info("No offers available for user"),r||(this.#E=[],this.#I=Date.now()),{offers:[]}):(r||(this.#E=t.offers,this.#I=Date.now()),u.info("Offers fetched successfully",{count:t.offers.length,offerIds:t.offers.map(e=>e.id)}),{offers:[...t.offers]})}catch(e){throw u.error("Failed to fetch offers",e),e}}beginPresentation(e,t,n,i){return this.#T=i??S(),this.#S=Date.now(),this.#A.clear(),this.#L=0,this.#U=null,this.#N=e,this.#R=t,this.#O=n,this.#M=!1,this.#T}get placementId(){return this.#O}get presentationId(){return this.#T}#z(){return this.#N?{variantId:this.#N}:{}}#P(){return this.#O?{placementId:this.#O}:{}}trackOfferPresented(e,t,n,i,r){if(!this.#C||!this.#T)return;this.#L++,this.#U&&this.#U!==e.id&&this.trackOfferViewEnd(this.#U),this.#U=e.id;const o=this.#A.get(e.id);o?(o.viewCount++,o.startTime=Date.now()):this.#A.set(e.id,{startTime:Date.now(),totalTime:0,viewCount:1,reported:!1}),this.#C.track(function(e,t){const{useCase:n,placementId:i,...r}=t;return{name:"sdk_offer_presented",distinctId:e,properties:{...r,...k(n),...$(i)}}}(this.#g,{campaignId:e.campaignId,creativeId:e.creativeId,...null!=e.merchantName&&{advertiserName:e.merchantName},impressionId:t,offerIndex:n,totalOffers:i,presentationId:this.#T,...this.#z(),...this.#P(),...r&&{useCase:r}}))}trackOfferViewEnd(e){const t=this.#A.get(e);t&&t.startTime>0&&(t.totalTime+=(Date.now()-t.startTime)/1e3,t.startTime=0)}trackOfferClaimed(e,t,n,i,r,o){this.#C&&this.#T&&this.#C.track(function(e,t){const{useCase:n,placementId:i,...r}=t;return{name:"sdk_offer_claimed",distinctId:e,properties:{...r,...k(n),...$(i)}}}(this.#g,{campaignId:e.campaignId,creativeId:e.creativeId,...null!=e.merchantName&&{advertiserName:e.merchantName},impressionId:t,transactionId:n,offerIndex:i,totalOffers:r,presentationId:this.#T,...this.#z(),...this.#P(),...o&&{useCase:o}}))}trackOfferDeclined(e,t,n,i,r,o){if(!this.#C||!this.#T)return;const s=v(r);this.#C.track(function(e,t){const{useCase:n,placementId:i,...r}=t;return{name:"sdk_offer_declined",distinctId:e,properties:{...r,...k(n),...$(i)}}}(this.#g,{campaignId:e.campaignId,creativeId:e.creativeId,...null!=e.merchantName&&{advertiserName:e.merchantName},impressionId:t,offerIndex:n,totalOffers:i,...null!=s&&{declineReason:s},presentationId:this.#T,...this.#z(),...this.#P(),...o&&{useCase:o}}))}endPresentation(e,t){this.#D(e,t,!1),this.#T=null,this.#S=null,this.#A.clear(),this.#L=0,this.#U=null,this.#N=void 0,this.#R=void 0,this.#O=void 0,this.#M=!1}#D(e,t,n,i=!0){if(!this.#C||!this.#T||!this.#S)return;const r=Date.now(),o=(r-this.#S)/1e3,s=n?{keepalive:!0}:void 0;for(const[e,n]of this.#A){let i=n.totalTime;if(n.startTime>0&&(i+=(r-n.startTime)/1e3),n.reported&&i<=0)continue;n.reported=!0;const o=this.#E.find(t=>t.id===e),a=o?this.#E.indexOf(o):0;this.#C.track(E(this.#g,{campaignId:o?.campaignId??"",offerIndex:a,timeSpentSeconds:i,viewCount:n.viewCount,totalOffers:this.#E.length,presentationId:this.#T,...this.#z(),...this.#P(),...t&&{useCase:t}}),s),n.totalTime=0,n.startTime>0&&(n.startTime=r)}if(!i||this.#M)return;this.#M=!0;const a=v(e);this.#C.track(function(e,t){const{useCase:n,placementId:i,...r}=t;return{name:"sdk_offer_sheet_dismissed",distinctId:e,properties:{...r,...k(n),...$(i)}}}(this.#g,{presentationId:this.#T,totalTimeSpentSeconds:o,totalOffers:this.#E.length,offersViewed:this.#L,...null!=a&&{declineReason:a},...this.#z(),...this.#P(),...t&&{useCase:t}}),s)}flushForPageLifecycle(e,t){try{this.#D(e?"appTerminated":"appBackgrounded",t,!0,e)}catch{}}#_(){if("undefined"!=typeof window&&"undefined"!=typeof document)try{const e=()=>this.flushForPageLifecycle(!0,this.#R),t=()=>{"hidden"===document.visibilityState&&this.flushForPageLifecycle(!1,this.#R)};window.addEventListener("pagehide",e),document.addEventListener("visibilitychange",t),this.#F=()=>{window.removeEventListener("pagehide",e),document.removeEventListener("visibilitychange",t)}}catch{}}destroy(){this.#F?.(),this.#F=null}async startTransaction(e,t){try{u.debug("Starting transaction",{campaignId:e,useCase:t});const n=await this.#f.startTransaction(e,this.#g,t);if(!n.transactionId)throw new Error(n.error??"No transactionId in response");return u.info("Transaction started",{transactionId:n.transactionId,campaignId:e}),n.transactionId}catch(t){throw u.error("Failed to start transaction",{campaignId:e,error:t}),t}}clearCache(){this.#E=[],this.#I=null,u.debug("Offer cache cleared")}setUserId(e){this.#g=e,this.clearCache(),u.debug("OfferManager user ID updated",{userId:e})}}const L={[t.NETWORK_ERROR]:"network_error",[t.TIMEOUT]:"network_error",[t.STORAGE_ERROR]:"persistence_error",[t.CONFIGURATION_ERROR]:"not_configured",[t.INITIALIZATION_ERROR]:"not_configured",[t.INVALID_REQUEST]:"api_error",[t.UNKNOWN_ERROR]:"domain_error"};function N(e,t){const n=e[t];return"string"==typeof n?n:void 0}function R(e){if("object"!=typeof e||null===e)return"domain_error";const n=e,i=N(n,"code"),r="number"==typeof n.statusCode;if(i){return L[i]||(i===String(t.API_ERROR)&&r?"http_error":"api_error")}return r?"http_error":e instanceof SyntaxError?"decoding_error":"domain_error"}class O{#f;#B;#H;#V=0;#q=1e3;#K=8e3;#G=null;#W=!1;#j=!1;constructor(e,t){this.#f=e,this.#B=t.transactionId,this.#H=t.timeout??3e4}async poll(){return this.#W?(u.warn("Verification polling already in progress",{transactionId:this.#B}),"pending"):(this.#W=!0,this.#V=Date.now(),u.debug("Starting verification polling",{transactionId:this.#B,timeout:this.#H}),this.#Z())}stop(){this.#W=!1,null!==this.#G&&(clearTimeout(this.#G),this.#G=null),u.debug("Verification polling stopped",{transactionId:this.#B})}async#Z(){for(;this.#W;){const e=Date.now()-this.#V;if(e>=this.#H)return u.warn("Verification polling timeout",{transactionId:this.#B,elapsed:e}),this.stop(),"pending";try{const e=await this.#f.checkVerificationStatus(this.#B);if(u.debug("Verification status checked",{transactionId:this.#B,status:e.status,rawStatus:e.raw}),"verified"===e.status)return u.info("Transaction verified",{transactionId:this.#B}),this.stop(),"verified";if("failed"===e.status)return u.warn("Transaction failed verification",{transactionId:this.#B}),this.stop(),"failed";await this.#$(this.#q),this.#q=Math.min(2*this.#q,this.#K)}catch(e){u.error("Error checking verification status",{transactionId:this.#B,error:e}),this.#j||(this.#j=!0,this.#f.reportError({errorType:R(e),message:e instanceof Error?e.message:String(e),context:"verify_transaction",...e instanceof Error&&e.stack?{stackTrace:e.stack}:{}})),await this.#$(this.#q)}}return"pending"}async#$(e){return new Promise(t=>{this.#G=window.setTimeout(()=>{this.#G=null,t()},e)})}}const U=/^[A-Za-z0-9_-]+$/;class M{#p;#f;#g;constructor(e,t,n){this.#p=e,this.#f=t,this.#g=n}setUserId(e){if(this.#g===e)return;const t=this.getPending();this.clearPending(),this.#g=e,t&&this.#p.set(this.#Y(),t)}notePending(e,t){const n={transactionId:e,recordedAt:(new Date).toISOString(),grantsEntitlement:t?.grantsEntitlement??!1,...void 0!==t?.placementId&&{placementId:t.placementId},...void 0!==t?.useCase&&{useCase:t.useCase}};this.#p.set(this.#Y(),n),u.debug("StrictUnlockReconciler: noted pending claim",{transactionId:e})}clearPending(){this.#p.remove(this.#Y()),u.debug("StrictUnlockReconciler: cleared pending claim")}getPending(){const e=this.#p.get(this.#Y());if(!e)return null;if("string"!=typeof e.transactionId||"string"!=typeof e.recordedAt||!U.test(e.transactionId))return u.warn("StrictUnlockReconciler: dropping malformed pending claim"),this.clearPending(),null;const t=Date.now()-new Date(e.recordedAt).getTime();return!(t>=0)||t>6048e5?(u.debug("StrictUnlockReconciler: dropping stale pending claim",{age:t}),this.clearPending(),null):(void 0!==e.placementId&&"string"!=typeof e.placementId&&delete e.placementId,void 0===e.useCase||l(e.useCase)||(u.warn("StrictUnlockReconciler: dropping an unrecognised use case from a pending claim"),delete e.useCase),e)}async verify(e,t=15e3){try{const n=new O(this.#f,{transactionId:e,timeout:t});return await n.poll()}catch(t){return u.warn("StrictUnlockReconciler: verification poll failed",{transactionId:e,error:t}),"pending"}}#Y(){return`${this.#g}_strict_pending`}}class F{#Q=null;#X=null;#J;#ee;#te;#ne;constructor(e,t,n,i){this.#te=e,this.#J=t,this.#ne=n,this.#ee=i}useCase(e){return this.#ne={...this.#ne,useCase:e},this}headline(e){return this.#ne={...this.#ne,headline:e},this}subheadline(e){return this.#ne={...this.#ne,subheadline:e},this}onNotGranted(e){return this.#Q=e,this}onLoadingStateChange(e){return this.#X=e,this}async show(){try{this.#X&&this.#X(!0),u.debug("PlacementBuilder: Executing presentation",{id:this.#te});const e=await this.#J(this.#ne);return this.#X&&this.#X(!1),"dismissed"===e.status&&e.reason&&this.#Q&&this.#Q(e.reason),e}catch(e){this.#X&&this.#X(!1),u.error("PlacementBuilder: Error during presentation",e);const n={type:"error",error:{code:t.UNKNOWN_ERROR,message:e instanceof Error?e.message:"Unknown error"}};return this.#Q&&this.#Q(n),{status:"dismissed",reason:n}}}async redeem(){return u.debug("PlacementBuilder: Redeeming",{id:this.#te}),this.#ee(this.#te)}}function _(e){return"immediate"!==e}const z={reduceChurn:"deferred",rewardUsers:"immediate"},P=["immediate","deferred","deferredWhileAlive"];const D="transactions";function B(e){const t=new Date(e.createdAt).getTime();return Number.isFinite(t)?t:0}function H(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function V(e,t){if(!H(e))return{};const n={};for(const[i,r]of Object.entries(e))t(r)&&(n[i]=r);return n}class q{#ie;constructor(e){this.#ie=e}#re(){const e=this.#ie.read();return H(e)?{transactions:V(e.transactions,H),placements:V(e.placements,e=>"string"==typeof e),latest:"string"==typeof e.latest?e.latest:null}:{transactions:{},placements:{},latest:null}}#oe(e){this.#ie.write(e)}#se(e){return!!e&&"claimed"===e.status&&!this.#ae(e)}#ae(e){const t=new Date(e.expiresAt).getTime();return!Number.isFinite(t)||t<=Date.now()}save(e){const t=this.#re();t.transactions[e.id]=e,e.placementId&&(t.placements[e.placementId]=e.id),t.latest=e.id,this.#le(t),this.#oe(t),u.debug("TransactionStore: saved transaction",{transactionId:e.id,placement:e.placementId})}getByTransactionId(e){return this.#re().transactions[e]??null}getByPlacement(e){const t=this.#re(),n=t.placements[e];if(!n)return null;const i=t.transactions[n];return this.#se(i)?i:null}getLatest(){const e=this.#re();if(e.latest){const t=e.transactions[e.latest];if(this.#se(t))return t}return Object.values(e.transactions).filter(e=>this.#se(e)).sort((e,t)=>B(t)-B(e))[0]??null}markRedeemed(e){const t=this.#re(),n=t.transactions[e];n&&(n.status="redeemed",n.redeemedAt=(new Date).toISOString(),n.placementId&&t.placements[n.placementId]===e&&delete t.placements[n.placementId],t.latest===e&&(t.latest=null),this.#oe(t),u.debug("TransactionStore: marked redeemed",{transactionId:e}))}#le(e){for(const[t,n]of Object.entries(e.transactions))(this.#ae(n)||"redeemed"===n.status)&&delete e.transactions[t];for(const[t,n]of Object.entries(e.placements))e.transactions[n]||delete e.placements[t];e.latest&&!e.transactions[e.latest]&&(e.latest=null)}clear(){this.#oe({transactions:{},placements:{},latest:null})}}const K=e=>{const t=e?.trim();if(void 0!==t&&t.length>0)return t};const G=e=>`All ${e} features are now unlocked.`,W=new Set(["localhost","127.0.0.1","[::1]"]);function j(e){return W.has(e)}function Z(e){if(!e)return;let t;try{t=new URL(e)}catch{return}return"https:"===t.protocol||"http:"===t.protocol&&j(t.hostname)?e:void 0}function Y(e,t){let n=e;for(const[e,i]of Object.entries(t))n=n.replace(`:${e}`,encodeURIComponent(i));return n}const Q="2.1.1";function X(e,t){return e.length<=t?e:e.slice(0,t-15)+"... [truncated]"}function J(e,t,n){return X(""===e.trim()?n:e,t)}function ee(e,t){return Object.assign(e,{code:t})}function te(e){if("object"!=typeof e||null===e)return;const t=e.category;if("string"!=typeof t)return;const n=t.trim();return""===n?void 0:n}function ne(e,t){if("object"!=typeof e||null===e)return;const n=e[t];return"string"==typeof n?Z(n.trim()):void 0}class ie{#ce;#de;#he;constructor(e,t){this.#ce=e,this.#de=t,this.#he=new Map}setApiKey(e){this.#ce=e}setBaseURL(e){this.#de=e}async get(e,t){return this.#ue({url:`${this.#de}${e}`,options:{method:"GET",...t},apiKey:this.#ce})}async post(e,t,n){return this.#ue({url:`${this.#de}${e}`,options:{method:"POST",body:t,...n},apiKey:this.#ce})}async patch(e,t,n){return this.#ue({url:`${this.#de}${e}`,options:{method:"PATCH",body:t,...n},apiKey:this.#ce})}async#ue(e){const{url:t,options:n,apiKey:i}=e,r=this.#pe(t,n),o=this.#he.get(r);if(o)return u.debug("Deduplicating request:",t),o;const s=this.#fe(t,n,i);this.#he.set(r,s);try{return await s}finally{this.#he.delete(r)}}async#fe(e,t,n){const i=t.retries??3;let r=null;for(let o=0;o<=i;o++)try{if(o>0){const e=1e3*Math.pow(2,o-1);u.debug(`Retrying request (attempt ${o}/${i}) after ${e}ms`),await this.#$(e)}return await this.#ge(e,t,n)}catch(e){if(r=e,this.#me(e))throw e;if(o===i)throw u.error(`Request failed after ${i} retries:`,e),e;u.warn("Request failed, will retry:",e)}throw r??new Error("Request failed")}async#ge(e,n,i){const r=n.timeout??3e4,o=new AbortController,s=setTimeout(()=>o.abort(),r);try{const t={"X-API-Key":i,"X-Platform":"web","Content-Type":"application/json","User-Agent":`Encore-Web-SDK/${Q}`,...n.headers},r={method:n.method,headers:t,signal:o.signal};n.body&&(r.body=JSON.stringify(n.body)),u.debug(`${n.method} ${e}`);const s=await fetch(e,r);return s.ok||await this.#be(s),await s.json()}catch(e){if(e instanceof Error){if("AbortError"===e.name)throw ee(new Error("Request timeout"),t.TIMEOUT);if(this.#we(e))throw ee(new Error(`Network error: ${e.message}`),t.NETWORK_ERROR)}if(e instanceof Error)throw e;throw ee(new Error(String(e)),t.UNKNOWN_ERROR)}finally{clearTimeout(s)}}async#be(e){let n,i=`HTTP ${e.status}: ${e.statusText}`;try{const t=await e.json();"object"==typeof t&&null!==t&&"string"==typeof t.error&&(i=t.error,n="string"==typeof t.code?t.code:void 0)}catch{}const r=n?{code:n,message:i}:{code:t.API_ERROR,statusCode:e.status,message:i},o=new Error(i);throw Object.assign(o,r),o}#me(e){if("object"==typeof e&&null!==e&&"statusCode"in e&&void 0!==e.statusCode){const t=e.statusCode;return t>=400&&t<500}return!1}#we(e){return e.message.includes("fetch")||e.message.includes("network")||e.message.includes("ECONNREFUSED")||e.message.includes("ETIMEDOUT")}#pe(e,t){const n=t.body?JSON.stringify(t.body):"";return`${t.method}:${e}:${n}`}#$(e){return new Promise(t=>setTimeout(t,e))}#ye(e){switch(e){case"pending_conversion":case"provisional_granted":default:return"pending";case"verified":case"final_granted":return"verified";case"expired":case"failed":return"failed"}}async fetchOffers(e,t,n,i){try{const r=y(n),o=await this.post("/offers/search",{userId:e,attributes:t,platform:"web",sdkVersion:Q,...r&&{placementId:r},...void 0!==i&&{maxPostbackTimeMs:i}}),s=[];for(const e of o.offers){const t=e.creatives??[],n=te(e),i=ne(e,"heroImageUrl"),r=ne(e,"termsUrl");for(const o of t){const t={id:o.id,title:o.title,description:o.quickInstructions??o.subtitle??o.description??"",imageUrl:o.primaryImageUrl,ctaText:o.ctaText,advertiserUrl:o.destinationUrl??e.destinationUrl??"",campaignId:e.id,creativeId:o.id,quickInstructions:o.quickInstructions??"",instructions:(o.instructions??[]).map(e=>({title:e.title,subtitle:e.subtitle,...null!=e.ctaButtonText&&{ctaButtonText:e.ctaButtonText}})),tooltipText:o.tooltipText??"",...e.organization?.name&&{merchantName:e.organization.name},...e.perk&&{perk:e.perk},...("free_trial"===e.badgeLabel||"discount"===e.badgeLabel)&&{badgeLabel:e.badgeLabel},...void 0!==n&&{category:n},...void 0!==i&&{heroImageUrl:i},...void 0!==r&&{termsUrl:r},...o.logoUrl&&{logoUrl:o.logoUrl},...o.trackingParameters&&{trackingParameters:Object.fromEntries(Object.entries(o.trackingParameters).filter(([,e])=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e).map(([e,t])=>[e,String(t)]))}};s.push(t)}}return{offers:s}}catch(e){throw u.error("Failed to fetch offers:",e),e}}async startTransaction(e,t,n){try{return await this.post("/transactions",{campaignId:e,userId:t,...n&&"reduceChurn"!==n&&{useCase:o(n)}})}catch(e){throw u.error("Failed to start transaction:",e),e}}async sendGrantSignal(e,t){try{const n=function(e){return Y("/transactions/:transactionId/signals",{transactionId:e})}(e);return(await this.post(n,{grantType:t})).success}catch(e){throw u.error("Failed to send grant signal:",e),e}}async fetchEntitlements(e){try{const t=await this.get(`/entitlements?userId=${encodeURIComponent(e)}`),n=[],i=[{details:t.provisional,scope:"provisional"},{details:t.verified,scope:"verified"}];for(const{details:e,scope:t}of i)if(e){if(e.freeTrial&&n.push({type:"freeTrial",transactionId:"",scope:t,grantedAt:e.freeTrial.startedAt??"",expiresAt:e.freeTrial.expiresAt??""}),e.discounts)for(const i of e.discounts)n.push({type:"discount",value:i.value,unit:i.unit,transactionId:"",scope:t,grantedAt:"",expiresAt:i.expiresAt??""});e.credits&&n.push({type:"credit",value:e.credits.totalAmount,unit:"dollars",transactionId:"",scope:t,grantedAt:"",expiresAt:e.credits.expiresAt??""})}return u.debug("Transformed entitlements response",{totalCount:n.length}),n}catch(e){throw u.error("Failed to fetch entitlements:",e),e}}async checkVerificationStatus(e){try{const t=function(e){return Y("/transactions/:transactionId/status",{transactionId:e})}(e),n=await this.get(t);return{status:this.#ye(n.status),raw:n.status}}catch(e){throw u.error("Failed to check verification status:",e),e}}async initUser(e,t){try{return await this.post("/users",{userId:e,...t&&{attributes:t}})}catch(e){throw u.error("Failed to init user:",e),e}}async identifyUser(e,t,n){try{return await this.patch("/users/identify",{currentUserId:e,newUserId:t,...n&&{attributes:n}})}catch(e){throw u.error("Failed to identify user:",e),e}}async fetchConfig(e,t,n){try{const i=`/config?userId=${encodeURIComponent(e)}&sdkVersion=${encodeURIComponent(t)}`+(n&&"reduceChurn"!==n?`&useCase=${encodeURIComponent(o(n))}`:"");return await this.get(i)}catch(e){throw u.error("Failed to fetch config:",e),e}}async reportError(e){try{const n="undefined"!=typeof window?window.location.hostname:"unknown";await this.post("/errors",{errorType:X(e.errorType,100),message:J(e.message,2e3,"Unknown error"),context:X(e.context,200),severity:e.severity??"error",timestamp:(new Date).toISOString(),platform:"web",sdkVersion:Q,appBundleId:J(n,200,"unknown"),...e.stackTrace&&{stackTrace:X(e.stackTrace,1e4)},...e.userId&&{userId:X(e.userId,200)},...e.metadata&&{metadata:(t=e.metadata,Object.fromEntries(Object.entries(t).map(([e,t])=>[e,X(t,500)])))}},{retries:0})}catch(e){u.error("Failed to report error (non-blocking):",e)}var t}async revokeEntitlements(e){try{return(await this.post("/entitlements/revoke",{userId:e})).success}catch(e){throw u.error("Failed to revoke entitlements:",e),e}}}function re(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase()}function oe(e){const t={};for(const[n,i]of Object.entries(e))t[re(n)]=i;return t}function se(e,t=S()){const n="undefined"!=typeof window?window.location.hostname:"unknown";return{event_id:t,event_name:e.name,event_timestamp:(new Date).toISOString(),distinct_id:e.distinctId,properties:{...oe(e.properties),platform:"web",sdk_version:Q,app_bundle_id:n}}}function ae(e,t,n,i){return fetch(`${e}/events`,{method:"POST",...i?.keepalive&&{keepalive:!0},headers:{"X-Analytics-Key":t,"X-Platform":"web","Content-Type":"application/json"},body:JSON.stringify(n)})}const le=new Set(["user_identified"]);class ce{#ce;#xe;#p;constructor(e,t,n){this.#ce=e,this.#xe=t,this.#p=n??null}track(e,t){try{if(this.#ve(e))return;const n=se(e);ae(this.#xe,this.#ce,n,t).catch(t=>{u.warn("Analytics event dispatch failed",{eventName:e.name,error:t})})}catch{}}#ve(e){if(!this.#p||!le.has(e.name))return!1;const t=`analytics_dedup_${e.name}_${e.distinctId}`;try{const e=this.#p.get(t),n=Date.now();return"number"==typeof e&&n-e<864e5||(this.#p.set(t,n),!1)}catch{return!1}}}async function de(e,t){const n=`${e}:${t}`,i=(new TextEncoder).encode(n),r=new Uint8Array(await crypto.subtle.digest("SHA-256",i));let o=0n;for(let e=0;e<8;e++)o=o<<8n|BigInt(r[e]??0);return Number(o%100n)}const he="ncl_assignment",ue="ncl_exposure_marker";class pe{#p;#ke;#$e;#n=null;constructor(e,t,n){this.#p=e,this.#ke=t,this.#$e=n}setConfig(e){this.#n=e??null}async getCohort(){try{return await this.#Ce()}catch(e){return u.warn("[Experiment] getCohort failed — treating as notEnrolled",e),"notEnrolled"}}async#Ce(){const e=this.#ke();if(!e)return"notEnrolled";const t=this.#n;if(!t?.enabled)return"notEnrolled";const n=this.#p.get(he);if(n?.appAccountId===e&&n?.assignmentVersion===t.assignmentVersion)return n.cohort;if("undefined"==typeof crypto||!crypto.subtle)return u.warn("[Experiment] NCL disabled — crypto.subtle unavailable (page is not a secure context: serve over HTTPS)"),"notEnrolled";const i=await de(e,t.assignmentVersion),r=function(e,t){return e<t?"treatment":"control"}(i,t.rolloutPct);return this.#p.set(he,{cohort:r,appAccountId:e,assignmentVersion:t.assignmentVersion}),u.debug("[Experiment] Assigned NCL cohort",{cohort:r,version:t.assignmentVersion,rolloutPct:t.rolloutPct,bucket:i}),r}logExposure(e){if("notEnrolled"===e)return;const t=this.#n,n=this.#ke();if(!t||!n)return;const i=`${n}:${t.assignmentVersion}`;if(this.#p.get(ue)===i)return;const r=function(e,t){return{name:"sdk_experiment_exposure",distinctId:e,properties:{experiment:t.experiment,cohort:t.cohort,assignment_version:t.assignmentVersion,app_account_id:e}}}(n,{experiment:"ncl",cohort:e,assignmentVersion:t.assignmentVersion}),o=S();this.#$e.enqueue(r,o)&&this.#p.set(ue,i)}async getState(){const e=this.#ke(),t=this.#n,n=await this.getCohort();let i=null;if(e&&t?.enabled&&"undefined"!=typeof crypto&&crypto.subtle)try{i=await de(e,t.assignmentVersion)}catch{i=null}const r=!!e&&!!t&&this.#p.get(ue)===`${e}:${t.assignmentVersion}`;return{experiment:"ncl",enabled:t?.enabled??!1,rolloutPct:t?.rolloutPct??null,assignmentVersion:t?.assignmentVersion??null,appAccountId:e,bucket:i,cohort:n,exposureLogged:r}}}class fe{#ce;#xe;#p;#Ee;#Ie=new Set;constructor(e,t,n,i){this.#ce=e,this.#xe=t,this.#p=n,this.#Ee=i,this.#_()}enqueue(e,t){const n=se(e,t),i=this.#Te();i.some(e=>e.event_id===t)||(i.push(n),this.#Se(i));const r=this.#Te().some(e=>e.event_id===t);return this.#Ae(n),r}flush(){for(const e of this.#Te())this.#Ae(e)}async#Ae(e){if(!this.#Ie.has(e.event_id)){this.#Ie.add(e.event_id);try{const t=await ae(this.#xe,this.#ce,e,{keepalive:!0});t.ok?this.#Le(e.event_id):u.warn("Reliable delivery non-OK, will retry",{status:t.status})}catch(e){u.warn("Reliable delivery failed, will retry",{error:e})}finally{this.#Ie.delete(e.event_id)}}}#Le(e){const t=this.#Te().filter(t=>t.event_id!==e);this.#Se(t)}#Te(){return this.#p.get(this.#Ee)??[]}#Se(e){this.#p.set(this.#Ee,e)}#_(){"undefined"!=typeof window&&"undefined"!=typeof document&&(window.addEventListener("pagehide",()=>this.flush()),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.flush()}))}}class ge extends fe{constructor(e,t,n){super(e,t,n,"ncl_exposure_outbox")}}class me extends fe{constructor(e,t,n){super(e,t,n,"diagnostics_outbox")}}const be={userClosedModal:"close_button",userClickedOutside:"dismissed",userDeclinedLastOffer:"last_offer_declined"},we={advertiserOutcome:"not_attempted",publisherOutcome:"not_attempted",dismissal:"dismissed"};function ye(e,t){if("claimed"===e.status)return{resolution:"presented",...we,advertiserOutcome:t?.advertiserOutcome??"claimed",dismissal:t?.dismissal??"flow_completed",campaignId:e.campaignId,offerId:e.offerId,...void 0!==e.transactionId&&{transactionId:e.transactionId}};if("unavailable"===e.status)return{resolution:"not_presented",notPresentedReason:t?.notPresentedReason??"error.unknown_error"};const n=e.reason;return t?void 0!==t.notPresentedReason?{resolution:"not_presented",notPresentedReason:t.notPresentedReason}:{resolution:"presented",...we,...void 0!==t.advertiserOutcome&&{advertiserOutcome:t.advertiserOutcome},...void 0!==t.dismissal&&{dismissal:t.dismissal}}:n?"string"==typeof n?"alreadyPresenting"===n?{resolution:"not_presented",notPresentedReason:"already_presenting"}:"notConfigured"===n?{resolution:"not_presented",notPresentedReason:"not_configured"}:{resolution:"presented",...we,...void 0!==be[n]&&{dismissal:be[n]}}:{resolution:"not_presented",notPresentedReason:(i=n.error.code,`error.${i.toLowerCase()}`)}:{resolution:"presented",...we};var i}class xe{#Ne;constructor(){this.#Ne=new Map}on(e,t){this.#Ne.has(e)||this.#Ne.set(e,new Set);const n=this.#Ne.get(e);if(!n)throw new Error(`Failed to get handlers for event '${String(e)}'`);return n.add(t),u.debug(`Event listener added for '${String(e)}'`),()=>{this.off(e,t)}}off(e,t){const n=this.#Ne.get(e);n&&(n.delete(t),u.debug(`Event listener removed for '${String(e)}'`),0===n.size&&this.#Ne.delete(e))}emit(e,t){const n=this.#Ne.get(e);if(n&&0!==n.size){u.debug(`Emitting event '${String(e)}'`,{listenerCount:n.size});for(const i of n)try{i(t)}catch(t){u.error(`Error in event handler for '${String(e)}':`,t)}}}removeAllListeners(e){e?(this.#Ne.delete(e),u.debug(`All listeners removed for '${String(e)}'`)):(this.#Ne.clear(),u.debug("All event listeners removed"))}listenerCount(e){return this.#Ne.get(e)?.size??0}hasListeners(e){const t=this.#Ne.get(e);return void 0!==t&&t.size>0}}const ve=16;function ke(e,t,n){return Math.min(n,Math.max(t,e))}function $e(e,t,n){return(.2126*e+.7152*t+.0722*n)/255}function Ce(e,t,n){const i=e/255,r=t/255,o=n/255,s=Math.max(i,r,o),a=Math.min(i,r,o),l=(s+a)/2,c=s-a;return 0===c?{h:0,s:0,l:l}:{h:((s===i?(r-o)/c%6*60:s===r?60*((o-i)/c+2):60*((i-r)/c+4))%360+360)%360,s:c/(1-Math.abs(2*l-1)),l:l}}function Ee(e,t,n){return function(e,t,n){const i=(1-Math.abs(2*n-1))*t,r=(e%360+360)%360/60,o=i*(1-Math.abs(r%2-1)),[s,a,l]=r<1?[i,o,0]:r<2?[o,i,0]:r<3?[0,i,o]:r<4?[0,o,i]:r<5?[o,0,i]:[i,0,o],c=n-i/2,d=e=>Math.round(ke(255*(e+c),0,255)).toString(16).padStart(2,"0");return`#${d(s)}${d(a)}${d(l)}`}(e,ke(t,.45,.95),ke(n,.45,.62))}const Ie=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Te=/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(\s*[0-9a-z.,%\s/+-]{1,80}\)$/i,Se=/^[a-z]{3,24}$/i,Ae=/^var\(\s*--[a-z0-9_-]{1,60}\s*(?:,[a-z0-9#%.,\s-]{0,60})?\)$/i,Le=/^[a-z0-9\s,'"_\-\u00C0-\u024F\u1E00-\u1EFF]{1,128}$/i,Ne=/^(?:0|-?(?:\d{1,5}|\d{0,5}\.\d{1,3})(?:px|rem|em|%|pt|vh|vw|ch|ex))$/i,Re=/^(?:normal|bold|lighter|bolder)$/i,Oe=new Set(["left","center","right","start","end"]),Ue=/\/\*|\*\/|[;{}<>\\]/;function Me(e,t){u.warn(`[Encore SDK] Ignoring unsupported ${e} appearance value`,{value:t})}function Fe(e){if(null==e)return;if("string"!=typeof e)return null;const t=e.trim();return 0!==t.length?t.length>128||Ue.test(t)?null:t:void 0}function _e(e){const t=Fe(e);if(void 0!==t)return null===t?Me("colour",e):Ie.test(t)||Te.test(t)||Se.test(t)||Ae.test(t)?t:Me("colour",e)}function ze(e){const t=Fe(e);if(void 0!==t)return null===t?Me("font-family",e):Le.test(t)?t:Me("font-family",e)}function Pe(e){const t=Fe(e);if(void 0!==t)return null===t?Me("length",e):Ne.test(t)?t:Me("length",e)}const De="encore-sdk-styles",Be="encore-",He="767px",Ve="#B728F5";function qe(e){const t={},n=_e(e.primaryColor),i=_e(e.backgroundColor),r=_e(e.textColor),o=Pe(e.borderRadius),s=ze(e.fontFamily);return n&&(t.primaryColor=n),i&&(t.backgroundColor=i),r&&(t.textColor=r),o&&(t.borderRadius=o),s&&(t.fontFamily=s),t}const Ke="12px",Ge="20px",We="40px";function je(e={}){if(document.getElementById(De))u.debug("Encore styles already injected");else try{const t=document.createElement("style");t.id=De,t.textContent=function(e={}){const t=qe(e),n=function(e){const t=[];return e.primaryColor&&t.push(`--encore-primary-color: ${e.primaryColor};`),e.backgroundColor&&t.push(`--encore-bg-color: ${e.backgroundColor};`),e.textColor&&t.push(`--encore-text-color: ${e.textColor};`),e.borderRadius&&t.push(`--encore-border-radius: ${e.borderRadius};`),e.fontFamily&&t.push(`--encore-font-family: ${e.fontFamily};`),t.join("\n ")}(t);return`\n /* CSS Custom Properties (Theme Variables) */\n :root {\n ${n||"/* No custom theme variables */"}\n --encore-primary-color: ${t.primaryColor??"#4F46E5"};\n --encore-bg-color: ${t.backgroundColor??"#ffffff"};\n --encore-text-color: ${t.textColor??"#1F2937"};\n --encore-text-muted: color-mix(in srgb, var(--encore-text-color) 60%, transparent);\n /* One step darker than muted, lighter than full text — lead-in copy that must\n read above captions without competing with the page title. */\n --encore-text-secondary: color-mix(in srgb, var(--encore-text-color) 78%, transparent);\n --encore-surface-color: color-mix(in srgb, var(--encore-text-color) 5%, var(--encore-bg-color));\n --encore-border-color: color-mix(in srgb, var(--encore-text-color) 10%, var(--encore-bg-color));\n --encore-border-radius: ${t.borderRadius??"12px"};\n /* Semantic success hue (the reward sheet's status check). Deliberately independent of the\n accent color: the check states a payment fact; the accent sells the offer CTA. */\n --encore-success-color: #159a5b;\n --encore-font-family: ${t.fontFamily??'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'};\n }\n\n /* Backdrop */\n .${Be}backdrop {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(0, 0, 0, 0.55);\n backdrop-filter: blur(2px);\n z-index: 9998;\n opacity: 0;\n transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n .${Be}backdrop.${Be}visible {\n opacity: 1;\n }\n\n /* Box-sizing reset scoped to the SDK modal so padding/borders never cause\n horizontal overflow on host pages that don't set border-box globally. */\n .${Be}modal,\n .${Be}modal *,\n .${Be}backdrop {\n box-sizing: border-box;\n }\n\n /* Modal Container */\n .${Be}modal {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999;\n background-color: var(--encore-bg-color);\n border-radius: 20px;\n box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.18), 0 12px 24px -8px rgba(0, 0, 0, 0.08);\n max-width: 800px;\n max-height: 90vh;\n width: calc(100% - 32px);\n overflow-x: hidden;\n overflow-y: auto;\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.96);\n transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1), transform 250ms cubic-bezier(0.4, 0, 0.2, 1);\n font-family: var(--encore-font-family);\n color: var(--encore-text-color);\n /* Anchor the inherited typographic properties at the modal root so host\n page styles can't cascade in. Children inherit OUR values, not the\n host's. Interim guard until Shadow DOM — see web-sdk-style-isolation.md. */\n font-size: 16px;\n font-weight: 400;\n font-style: normal;\n line-height: 1.5;\n letter-spacing: normal;\n word-spacing: normal;\n text-align: left;\n text-transform: none;\n text-indent: 0;\n white-space: normal;\n text-shadow: none;\n }\n\n .${Be}modal.${Be}visible {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n\n /* Close Button */\n .${Be}close-button {\n position: absolute;\n top: 20px;\n right: 20px;\n width: 40px;\n height: 40px;\n border: none;\n background-color: var(--encore-surface-color);\n cursor: pointer;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--encore-text-muted);\n transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);\n padding: 0;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);\n z-index: 10;\n }\n\n .${Be}close-button:hover {\n background-color: var(--encore-bg-color);\n color: var(--encore-text-color);\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);\n transform: scale(1.05);\n }\n\n .${Be}close-button:active {\n transform: scale(0.98);\n }\n\n .${Be}close-button:hover {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n .${Be}close-button svg {\n width: 18px;\n height: 18px;\n }\n\n /* Body scroll lock */\n body.${Be}no-scroll {\n overflow: hidden;\n }\n\n /* Modal Header */\n .${Be}modal-header {\n padding: 24px 24px 16px;\n border-bottom: 1px solid var(--encore-border-color);\n }\n\n .${Be}modal-title {\n margin: 0;\n font-size: 24px;\n font-weight: 700;\n line-height: 1.25;\n color: var(--encore-text-color);\n }\n\n .${Be}modal-subtitle {\n margin: 8px 0 0;\n font-size: 14px;\n color: var(--encore-text-muted);\n line-height: 1.5;\n }\n\n /* Modal Body */\n .${Be}modal-body {\n padding: 0;\n position: relative;\n isolation: isolate;\n }\n\n /* Carousel Container */\n .${Be}carousel {\n display: flex;\n flex-direction: column;\n overflow: visible;\n }\n\n /* Carousel Header */\n .${Be}carousel-header {\n padding: 40px 68px 28px;\n text-align: center;\n }\n\n .${Be}carousel-title {\n font-size: 32px;\n font-weight: 510;\n line-height: 1.1;\n color: var(--encore-text-color);\n margin: 0 0 8px 0;\n letter-spacing: -0.3px;\n }\n\n .${Be}carousel-subtitle {\n font-size: 16px;\n line-height: 1.2;\n color: var(--encore-text-color);\n margin: 0;\n font-weight: 400;\n }\n\n /* Carousel Cards Container - Horizontal Scroll */\n .${Be}carousel-cards {\n display: flex;\n flex-direction: row;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-behavior: smooth;\n scroll-snap-type: x mandatory;\n -webkit-overflow-scrolling: touch;\n scrollbar-width: none;\n -ms-overflow-style: none;\n gap: 24px;\n padding: 24px 78px;\n position: relative;\n }\n\n .${Be}carousel-cards::-webkit-scrollbar {\n display: none;\n }\n\n /* Carousel Item Wrapper. Only opacity ever animates (active-card dimming) — a\n short 200ms so the highlight reads as tracking the swipe, not trailing it. */\n .${Be}carousel-item {\n flex: 0 0 426px;\n width: 426px;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n opacity: 0.5;\n transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1);\n pointer-events: auto;\n }\n\n /* Active carousel item */\n .${Be}carousel-item.${Be}active {\n opacity: 1;\n z-index: 1;\n }\n\n /* Offer Card */\n .${Be}offer-card {\n display: flex;\n flex-direction: column;\n background: var(--encore-bg-color);\n border-radius: 16px;\n box-shadow: 0 2px 12px rgba(116, 112, 133, 0.16);\n overflow: hidden;\n }\n\n /* Offer Banner */\n .${Be}offer-banner {\n width: 100%;\n background-color: transparent;\n position: relative;\n padding: 0;\n height: 180px;\n overflow: hidden;\n border-radius: 16px 16px 0 0;\n }\n\n .${Be}offer-banner-image {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: cover;\n background-color: var(--encore-surface-color);\n opacity: 0;\n transition: opacity 200ms ease-out;\n }\n\n .${Be}offer-banner-image.${Be}loaded {\n opacity: 1;\n }\n\n /* Info button on banner */\n .${Be}banner-info-button {\n position: absolute;\n top: 20px;\n right: 20px;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n background-color: var(--encore-surface-color);\n backdrop-filter: blur(6px);\n border: none;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: all 150ms ease;\n z-index: 3;\n padding: 0;\n }\n\n .${Be}banner-info-button:hover {\n background-color: var(--encore-border-color);\n transform: scale(1.05);\n }\n\n .${Be}banner-info-button:focus {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n .${Be}banner-info-button svg {\n width: 14px;\n height: 14px;\n color: var(--encore-text-color);\n stroke-width: 2;\n }\n\n /* Tooltip */\n .${Be}tooltip {\n position: fixed;\n background-color: rgba(28, 28, 32, 0.95);\n color: #ffffff;\n padding: 8px 12px;\n border-radius: 8px;\n font-size: 12px;\n line-height: 1.4;\n font-weight: 500;\n z-index: 10000;\n pointer-events: none;\n opacity: 0;\n transform: translateY(4px);\n transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1), transform 200ms cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n white-space: normal;\n word-wrap: break-word;\n }\n\n .${Be}tooltip-visible {\n opacity: 1;\n transform: translateY(0);\n }\n\n /* Tooltip arrow (optional - using pseudo-element) */\n .${Be}tooltip::after {\n content: '';\n position: absolute;\n width: 0;\n height: 0;\n border-style: solid;\n }\n\n .${Be}tooltip-top::after {\n bottom: -4px;\n left: 50%;\n transform: translateX(-50%);\n border-width: 4px 4px 0 4px;\n border-color: rgba(28, 28, 32, 0.95) transparent transparent transparent;\n }\n\n .${Be}tooltip-bottom::after {\n top: -4px;\n left: 50%;\n transform: translateX(-50%);\n border-width: 0 4px 4px 4px;\n border-color: transparent transparent rgba(28, 28, 32, 0.95) transparent;\n }\n\n .${Be}tooltip-left::after {\n right: -4px;\n top: 50%;\n transform: translateY(-50%);\n border-width: 4px 0 4px 4px;\n border-color: transparent transparent transparent rgba(28, 28, 32, 0.95);\n }\n\n .${Be}tooltip-right::after {\n left: -4px;\n top: 50%;\n transform: translateY(-50%);\n border-width: 4px 4px 4px 0;\n border-color: transparent rgba(28, 28, 32, 0.95) transparent transparent;\n }\n\n /* Offer Footer */\n .${Be}offer-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 20px;\n border-top: 1px solid var(--encore-border-color);\n gap: 12px;\n min-height: 74px;\n }\n\n /* Offer Merchant */\n .${Be}offer-merchant {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n min-width: 0;\n }\n\n .${Be}offer-logo {\n width: 42px;\n height: 42px;\n border-radius: 8px;\n object-fit: contain;\n background-color: var(--encore-surface-color);\n flex-shrink: 0;\n opacity: 0;\n transition: opacity 200ms ease-out;\n }\n\n .${Be}offer-logo.${Be}loaded {\n opacity: 1;\n }\n\n .${Be}offer-merchant-text {\n display: flex;\n flex-direction: column;\n gap: 2px;\n flex: 1;\n min-width: 0;\n }\n\n .${Be}offer-merchant-name {\n font-size: 16px;\n font-weight: 590;\n color: var(--encore-text-color);\n line-height: 1.1;\n letter-spacing: -1px;\n }\n\n .${Be}offer-merchant-desc {\n font-size: 14px;\n color: var(--encore-text-muted);\n line-height: 1.2;\n letter-spacing: -1px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n /* Claim Button */\n .${Be}button-claim {\n padding: 10px 16px;\n height: 34px;\n min-width: 78px;\n font-size: 14px;\n font-weight: 590;\n border-radius: 999px;\n border: none;\n background: var(--encore-primary-color);\n color: white;\n cursor: pointer;\n transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);\n font-family: var(--encore-font-family);\n white-space: nowrap;\n line-height: 1.2;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .${Be}button-claim:hover:not(:disabled) {\n background: color-mix(in srgb, var(--encore-primary-color) 85%, black);\n transform: translateY(-1px);\n box-shadow: 0 2px 8px color-mix(in srgb, var(--encore-primary-color) 30%, transparent);\n }\n\n .${Be}button-claim:active {\n transform: translateY(0);\n background: color-mix(in srgb, var(--encore-primary-color) 75%, black);\n }\n\n .${Be}button-claim:focus {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n .${Be}button-claim:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n transform: none;\n }\n\n /* Carousel Navigation */\n .${Be}carousel-navigation {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 40px;\n padding: 28px 32px 32px;\n }\n\n .${Be}nav-button {\n width: 32px;\n height: 32px;\n border-radius: 50%;\n border: 1px solid var(--encore-text-muted);\n background-color: var(--encore-bg-color);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--encore-text-muted);\n transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);\n padding: 0;\n }\n\n .${Be}nav-button:hover:not(:disabled) {\n border-color: var(--encore-primary-color);\n color: var(--encore-primary-color);\n transform: scale(1.05);\n }\n\n .${Be}nav-button:active:not(:disabled) {\n transform: scale(0.95);\n }\n\n .${Be}nav-button:focus {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n .${Be}nav-button svg {\n width: 20px;\n height: 20px;\n stroke-width: 2;\n }\n\n .${Be}nav-button:not(:disabled) {\n border-color: var(--encore-primary-color);\n color: var(--encore-primary-color);\n }\n\n .${Be}nav-button:disabled,\n .${Be}nav-button.${Be}disabled {\n opacity: 1;\n cursor: not-allowed;\n border-color: var(--encore-text-muted);\n color: var(--encore-text-muted);\n }\n\n .${Be}nav-button:disabled:hover,\n .${Be}nav-button.${Be}disabled:hover {\n border-color: var(--encore-text-muted);\n color: var(--encore-text-muted);\n transform: none;\n }\n\n /* Loading State */\n .${Be}loading {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 48px;\n }\n\n .${Be}spinner {\n width: 40px;\n height: 40px;\n border: 3px solid var(--encore-border-color);\n border-top-color: var(--encore-primary-color);\n border-radius: 50%;\n animation: ${Be}spin 0.8s linear infinite;\n }\n\n @keyframes ${Be}spin {\n to { transform: rotate(360deg); }\n }\n\n /* Responsive: Mobile (0-767px) — full-screen vertical sheet */\n @media (max-width: ${He}) {\n /* Modal becomes a full-screen sheet. dvh fallback so mobile browser URL\n bars don't clip the bottom. It is a flex column so the height\n propagates down to the scrollable cards region. */\n .${Be}modal {\n display: flex;\n flex-direction: column;\n inset: 0;\n top: 0;\n left: 0;\n transform: none;\n width: 100%;\n height: 100vh;\n height: 100dvh;\n max-width: none;\n max-height: none;\n border-radius: 0;\n margin: 0;\n overflow: hidden;\n }\n\n /* Fade only — override the desktop scale/translate transition. */\n .${Be}modal.${Be}visible {\n transform: none;\n }\n\n /* Body fills the sheet and forwards the height to the carousel.\n min-height:0 lets the inner scroll container actually overflow. */\n .${Be}modal-body {\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n flex-direction: column;\n }\n\n /* Carousel fills the body so the cards region can flex to fill height. */\n .${Be}carousel {\n flex: 1 1 auto;\n min-height: 0;\n overflow: hidden;\n }\n\n /* Sticky header pinned while the list scrolls; respect the notch. 64px side\n The close button is an absolute overlay (top 16 + 40px tall), so the\n header reserves that band VERTICALLY: the title starts below the X and\n spans the full sheet width with slim symmetric side padding — no dead\n 64px gutters squeezing the headline into the X's row. */\n .${Be}carousel-header {\n position: sticky;\n top: 0;\n z-index: 2;\n background: var(--encore-bg-color);\n padding: calc(64px + env(safe-area-inset-top)) 24px 20px;\n }\n\n .${Be}carousel-title {\n font-size: 22px;\n }\n\n .${Be}carousel-subtitle {\n font-size: 14px;\n }\n\n /* Vertical, full-height scrollable feed. */\n .${Be}carousel-cards {\n flex: 1 1 auto;\n min-height: 0;\n flex-direction: column;\n overflow-x: hidden;\n overflow-y: auto;\n scroll-snap-type: none;\n overscroll-behavior: contain;\n gap: 16px;\n padding: 16px 16px calc(16px + env(safe-area-inset-bottom));\n }\n\n /* Full-width stacked cards, no carousel dimming or snapping.\n overflow:visible so each card's shadow isn't clipped by the item box. */\n .${Be}carousel-item {\n flex: 0 0 auto;\n width: 100%;\n opacity: 1;\n scroll-snap-align: none;\n overflow: visible;\n }\n\n /* Keep the rounded card + visible shadow on mobile (matches design). */\n .${Be}offer-card {\n width: 100%;\n max-width: 100%;\n border-radius: 16px;\n box-shadow: 0 4px 16px rgba(116, 112, 133, 0.22);\n border: 1px solid var(--encore-border-color);\n }\n\n /* Image fills the card edge-to-edge with rounded top corners\n (no inset padding, banner already clips to the card radius). */\n .${Be}offer-banner {\n height: auto;\n padding: 0;\n border-radius: 16px 16px 0 0;\n }\n\n .${Be}offer-banner-image {\n width: 100%;\n height: auto;\n display: block;\n }\n\n /* Logo + name + description on the left, small claim button pinned far\n right on a single row (no wrap / no full-width stacking). */\n .${Be}offer-footer {\n flex-wrap: nowrap;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding: 14px 16px;\n }\n\n .${Be}offer-merchant {\n flex: 1 1 auto;\n min-width: 0;\n }\n\n /* Small button hugging its label, to the far right. */\n .${Be}button-claim {\n flex: 0 0 auto;\n width: auto;\n }\n\n /* No nav arrows in vertical mode. */\n .${Be}carousel-navigation {\n display: none;\n }\n\n /* Keep the close button reachable inside the sticky header / below the notch. */\n .${Be}close-button {\n top: calc(16px + env(safe-area-inset-top));\n right: 16px;\n }\n\n /* Paged carousel keeps its nav bubbles on mobile (the display:none above is\n the responsive/'list' vertical mode only). */\n .${Be}carousel-paged .${Be}carousel-navigation {\n display: flex;\n }\n\n /* NOTE: the reward sheet's own mobile overrides live in a dedicated media\n block AFTER the base reward-sheet section (source order matters at equal\n specificity — a media query adds none). */\n }\n\n /* Responsive: Tablet (768-1023px) */\n @media (min-width: 768px) and (max-width: 1023px) {\n .${Be}modal {\n max-width: 600px;\n }\n }\n\n /* Responsive: Desktop (1024px+) */\n @media (min-width: 1024px) {\n .${Be}modal {\n max-width: 600px;\n }\n }\n\n /* Accessibility: High Contrast Mode */\n @media (prefers-contrast: high) {\n .${Be}button {\n border: 2px solid currentColor;\n }\n }\n\n /* Accessibility: Reduced Motion */\n @media (prefers-reduced-motion: reduce) {\n .${Be}backdrop,\n .${Be}modal,\n .${Be}button,\n .${Be}close-button {\n transition: none;\n }\n\n .${Be}spinner {\n animation: none;\n }\n }\n\n /* Focus Visible (for keyboard navigation) */\n .${Be}button:focus-visible,\n .${Be}close-button:focus-visible {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n\n /* ===== Paged carousel (the reward sheet) ===== */\n /* Always-horizontal, one-card-per-view, scroll-snap paged — at every breakpoint.\n Scoped under carousel-paged so the responsive ('list') carousel rules are\n untouched. Each page is slightly narrower than the viewport so the neighboring\n cards PEEK in at the edges at reduced opacity — the same visual grammar as the\n list carousel: "there are more offers, swipe". Desktop caps the page width so\n the peek survives wide modals (no 426px hardcode). */\n .${Be}carousel-paged .${Be}carousel-cards {\n flex-direction: row;\n align-items: center;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-snap-type: x mandatory;\n /* auto, NOT the base 'smooth': smooth scroll-behavior makes the browser ANIMATE\n its own snap re-alignments (e.g. when an async banner image loads and reflows\n the row mid-gesture), which reads as a laggy post-swipe snap. Native gesture\n snapping is untouched, and programmatic paging still requests smooth\n explicitly via scrollIntoView's behavior option. */\n scroll-behavior: auto;\n gap: 12px;\n /* Horizontal padding is 0 — the symmetric first/last-item gutters below own\n the side spacing so the ACTIVE card is always centered. Vertical padding is\n shadow room: overflow-y:hidden would clip the card shadows without it. */\n padding: ${Ge} 0;\n /* One "page" = the card slot. 64px total side allowance → 32px gutter each\n side (a ~20px neighbor-peek after the 12px gap at the 375px design width);\n the 480px cap keeps the peek alive in wide modals. Declared once here and\n shared by the item basis and the centering gutters so they can never drift. */\n --encore-page-size: min(100% - 64px, 480px);\n }\n\n .${Be}carousel-paged .${Be}carousel-item {\n /* Size via width (flex-basis:auto → width), NOT a math function inside the\n flex shorthand: engines that choke on functions in the shorthand drop the\n whole declaration and fall back to the base 426px item — which is exactly a\n clipped, overflowing card on a 375px phone. width + the max-width guard\n make overflow impossible at any breakpoint. */\n flex: 0 0 auto;\n width: var(--encore-page-size);\n max-width: 100%;\n /* Peek legibility: light creatives on the white sheet disappear below ~0.5,\n killing the "more offers" affordance. 0.65 keeps the active card clearly\n dominant while the neighbors stay readable. */\n opacity: 0.65;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n overflow: visible;\n }\n\n /* Symmetric centering gutters: first/last pages get margins of exactly\n (container − page) / 2, so card 0 RESTS CENTERED at scrollLeft 0 (empty gutter\n left, peek right), mid-cards show symmetric peeks, and the last card can reach\n center too. Both the margin percentage and the flex-basis percentage resolve against the same\n container content width, so the math is exact at any size — the natural resting\n position IS the snap position and mount needs no scroll correction. */\n .${Be}carousel-paged .${Be}carousel-item:first-child {\n margin-inline-start: calc((100% - var(--encore-page-size)) / 2);\n }\n\n .${Be}carousel-paged .${Be}carousel-item:last-child {\n margin-inline-end: calc((100% - var(--encore-page-size)) / 2);\n }\n\n .${Be}carousel-paged .${Be}carousel-item.${Be}active {\n opacity: 1;\n }\n\n .${Be}carousel-paged .${Be}offer-card {\n max-width: 460px;\n margin: 0 auto;\n border: 1px solid var(--encore-border-color);\n box-shadow: 0 4px 16px rgba(116, 112, 133, 0.18);\n }\n\n /* Fluid banner: natural aspect, scales with the card. */\n .${Be}carousel-paged .${Be}offer-banner {\n height: auto;\n }\n\n .${Be}carousel-paged .${Be}offer-banner-image {\n width: 100%;\n height: auto;\n display: block;\n }\n\n /* Nav row: centered DIRECTLY beneath the cards — these chevrons are carousel\n controls and must read as part of the carousel unit, so they hug it (never\n bottom-anchored away from it). Comfortable 48px circular tap targets in normal\n flow — no overlay, no z-index games. Rhythm: cards→nav gap = the cards' bottom\n shadow gutter + 4px here (16px total inside the sheet); the 20px bottom padding\n is the nav→footer gap (and the sheet's bottom inset when no trust footer is\n configured). */\n .${Be}carousel-paged .${Be}carousel-navigation {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 24px;\n padding: 4px 20px ${Ge};\n }\n\n .${Be}carousel-paged .${Be}nav-button {\n width: 48px;\n height: 48px;\n background-color: var(--encore-bg-color);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n }\n\n /* Neutral idle bubble (the accent belongs to the Claim CTA); accent only on hover. */\n .${Be}carousel-paged .${Be}nav-button:not(:disabled) {\n border-color: var(--encore-border-color);\n color: var(--encore-text-color);\n }\n\n .${Be}carousel-paged .${Be}nav-button:hover:not(:disabled) {\n border-color: var(--encore-primary-color);\n color: var(--encore-primary-color);\n box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);\n }\n\n .${Be}carousel-paged .${Be}nav-button svg {\n width: 22px;\n height: 22px;\n }\n\n .${Be}carousel-paged .${Be}nav-button:disabled,\n .${Be}carousel-paged .${Be}nav-button.${Be}disabled {\n opacity: 0.35;\n box-shadow: none;\n border-color: var(--encore-border-color);\n color: var(--encore-text-muted);\n }\n\n /* ===== Reward sheet chrome (useCase: 'rewardUsers') =====\n The encore-thankyou class names predate the 3.0.0 rename — they are internal\n style hooks, kept so the whole visual system (including the --reward parity\n block below) did not have to churn. See ui/RewardLayout.ts. */\n /* Status block, carousel, CTA stack. Desktop: normal flow in the content-sized\n modal. Mobile: joins the sheet's flex chain (the mobile block below). */\n .${Be}thankyou {\n display: flex;\n flex-direction: column;\n }\n\n /* SUCCESS UNIT — check → title → receipt as ONE tight visual group. Internal\n gaps are deliberately tight (proximity = grouping); the heading below is the\n sheet's single focal point. No bottom padding: the 32px section break lives\n on the intro header so it is owned in exactly one place. */\n .${Be}thankyou-status {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n padding: ${We} 24px 0;\n }\n\n /* "Receipt stamp" check: deep-green disc in a soft halo. Calm by design — no\n pulse, no gradient (a payment fact, stated quietly). Margin-bottom is the\n 12px halo ring + the 12px check→title step of the ladder. */\n .${Be}thankyou-check {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 48px;\n height: 48px;\n border-radius: 50%;\n background: var(--encore-success-color);\n color: #ffffff;\n box-shadow: 0 0 0 12px color-mix(in srgb, var(--encore-success-color) 14%, var(--encore-bg-color));\n margin: 0 0 calc(12px + ${Ke});\n }\n\n .${Be}thankyou-check svg {\n width: 24px;\n height: 24px;\n }\n\n /* The ONLY large/heavy type on the sheet — everything else defers to it. */\n .${Be}thankyou-title {\n margin: 0;\n font-size: 20px;\n font-weight: 600;\n line-height: 1.25;\n letter-spacing: -0.2px;\n color: var(--encore-text-color);\n overflow-wrap: anywhere;\n }\n\n /* Subheadline — sits tight under the title (same statement, quieter voice). */\n .${Be}thankyou-subtitle {\n margin: 4px 0 0;\n font-size: 14px;\n line-height: 1.5;\n color: var(--encore-text-muted);\n overflow-wrap: anywhere;\n }\n\n /* Context → cards 16px, cards → nav 16px (12px shadow gutter + the nav row's 4px\n top padding): the carousel unit is bound tight to its lead-in above and its\n controls below. The 12px bottom gutter still clears the visible card shadow. */\n .${Be}thankyou .${Be}carousel-cards {\n padding-top: 16px;\n padding-bottom: ${Ke};\n }\n\n /* Mobile full-screen sheet: status on top, the carousel owns every spare pixel,\n the CTA stack is pinned to the bottom. See REWARD_MOBILE_NOTES. */\n @media (max-width: ${He}) {\n .${Be}thankyou {\n flex: 1 1 auto;\n min-height: 0;\n }\n\n .${Be}thankyou-status {\n flex: 0 0 auto;\n padding-top: calc(${We} + env(safe-area-inset-top));\n }\n\n .${Be}thankyou-check {\n width: 44px;\n height: 44px;\n }\n\n .${Be}thankyou .${Be}carousel {\n flex: 1 1 auto;\n min-height: 0;\n justify-content: center;\n }\n\n .${Be}thankyou .${Be}carousel-cards {\n flex: 0 1 auto;\n min-height: 0;\n }\n }\n\n /* ===== Reward parity with the native SDUI variant =====\n Tracks streaksCarousel.json — the SAME screen iOS and Android render — so a\n publisher running reward on more than one platform sees one design rather\n than three. Values are read off that file, not eyeballed from a screenshot:\n\n headline 28 / semibold, centered\n subheadline 16 / regular, centered\n offer card cornerRadius 24\n primary CTA cornerRadius 12 (deliberately NOT the pill the churn\n carousel uses — the variant is explicit)\n gutters 20 leading/trailing\n\n Scoped entirely to the --reward modifier, which the chrome always sets: the\n base rules keep a tighter 20/14 scale, and these override it with the\n celebration scale. Placed AFTER the mobile block so it wins on source\n order, matching the convention that block already documents. */\n .${Be}thankyou--reward .${Be}thankyou-title {\n font-size: 28px;\n font-weight: 600;\n line-height: 1.2;\n letter-spacing: -0.4px;\n text-align: center;\n }\n\n .${Be}thankyou--reward .${Be}thankyou-subtitle {\n font-size: 16px;\n font-weight: 400;\n line-height: 1.35;\n text-align: center;\n }\n\n .${Be}thankyou--reward .${Be}thankyou-status {\n padding-left: 20px;\n padding-right: 20px;\n }\n\n /* On the mobile full-screen sheet the variant is edge-to-edge (fullScreenCover,\n detent 1.0, no drag indicator) with 20px gutters. */\n @media (max-width: ${He}) {\n .${Be}thankyou--reward .${Be}carousel-cards {\n padding-left: 20px;\n padding-right: 20px;\n }\n }\n\n /* ===== Reward interaction model — tracks streaksCarousel.json's browse state.\n Reward DOM only: either --reward-scoped, or a class (page-indicator / dot /\n reward-*) the reward composition alone renders. See RewardActions.ts and\n OfferCarousel's \`selectable\` option for the per-value rationale. ===== */\n .${Be}thankyou--reward .${Be}carousel-item[aria-selected] {\n cursor: pointer;\n }\n\n /* The listbox is one tab stop, so it needs its own ring. Inset — an outset one\n is clipped by the container's horizontal overflow.\n \n KEYBOARD DEVICES ONLY, and :focus-visible alone is not enough to say so.\n This is a div with tabindex="0", and Safari focuses one on TAP and then\n matches :focus-visible on it — so an iOS user tapping a card to browse\n got a 2px ring around the whole carousel, on a sheet where there is no\n Tab key and so nothing the ring could be telling them. Chrome on desktop\n does not do this, which is why it survived review.\n\n Gated on a fine pointer rather than on :focus-visible being smarter:\n a device with no keyboard has no use for a focus ring, and a device with\n one keeps it exactly as before. */\n .${Be}carousel-select:focus {\n outline: none;\n }\n\n @media (hover: hover) and (pointer: fine) {\n /* --quiet: held back until a keyboard shows up (OfferCarousel#wakeFocusRing). */\n .${Be}carousel-select:focus-visible:not(.${Be}carousel-select--quiet) {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: -2px;\n border-radius: 16px;\n }\n }\n\n /* compactPageIndicator: position feedback only, never a control. */\n .${Be}page-indicator {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 8px;\n padding: 19px 20px 0;\n }\n\n /* Figma 18304:3071 — four ellipses, inactive 6px, active 10px, 8px edge gaps\n (52px total for four). The size change IS the state change here, so both\n dimensions animate alongside the fill. */\n .${Be}dot {\n flex: 0 0 auto;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n /* var() fallback = today's value, so an unset override is byte-identical. */\n background: var(\n --encore-dot-color,\n color-mix(in srgb, #6A6D81 30%, transparent)\n );\n transition:\n background 200ms cubic-bezier(0.4, 0, 0.2, 1),\n width 200ms cubic-bezier(0.4, 0, 0.2, 1),\n height 200ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n .${Be}dot.${Be}active {\n width: 10px;\n height: 10px;\n background: var(--encore-dot-active-color, var(--encore-reward-brand));\n }\n\n /* Trust line + CTA stack, 12px apart, 20px gutters. 31px bottom inset is the\n variant's browse-state padding; env() is ADDED so the 31 always survives. */\n .${Be}reward-actions {\n display: flex;\n flex-direction: column;\n gap: 12px;\n /* max(), not addition. The 31px is the variant's browse-state padding\n and the inset is the hardware's; adding them stacked a full\n home-indicator gap ON TOP of a padding that was already clear of it,\n which is the space under the CTAs in a tall-phone screenshot. Taking\n the larger of the two keeps the 31 as the floor and lets the inset win\n only where it is genuinely bigger.\n\n A mobile browser's own bottom bar is NOT covered by this: it shrinks\n the viewport, which 100dvh on the sheet already tracks. */\n padding: 20px 20px max(31px, env(safe-area-inset-bottom));\n }\n\n .${Be}reward-trust {\n margin: 0;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.2;\n text-align: center;\n color: color-mix(in srgb, var(--encore-text-color) 55%, transparent);\n overflow-wrap: anywhere;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n }\n\n .${Be}reward-cta-stack {\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n\n /* Both buttons are full pills (Figma radius 100), not the variant's 12 — see\n REWARD_BRAND. Heights are the Figma's: primary 51, secondary 48. */\n .${Be}reward-cta-primary,\n .${Be}reward-cta-secondary {\n width: 100%;\n box-sizing: border-box;\n border-radius: 100px;\n font-family: var(--encore-font-family);\n font-size: 16px;\n line-height: 1.2;\n text-align: center;\n cursor: pointer;\n transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /*\n * Claiming switched off (Encore.isClaimEnabled). Matches the carousel's own\n * disabled Claim button: without this the reward CTA is unclickable but still\n * looks and feels live, which reads as a broken button rather than an\n * unavailable one.\n *\n * TWO selectors because there are two elements. The default CTA is a button and\n * carries the native disabled property. A publisher-supplied claim slot is mounted\n * in a div[role=button] host, where disabled is meaningless and :disabled never\n * matches it — that one carries aria-disabled instead. Dropping either selector\n * leaves one of the two paths looking live while it is inert.\n *\n * No backticks in this comment: the whole stylesheet is a template literal, and a\n * backtick here closes it.\n */\n .${Be}reward-cta-primary:disabled,\n .${Be}reward-cta-primary[aria-disabled='true'] {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .${Be}reward-cta-primary {\n height: 51px;\n padding: 0 12px;\n border: none;\n font-weight: 700;\n background-image: linear-gradient(\n 98.22deg,\n var(--encore-reward-brand) 0%,\n var(--encore-reward-brand-deep) 100%\n );\n color: #ffffff;\n }\n\n /* Darken via an overlay rather than swapping the background: \`background-image\`\n cannot be color-mixed, and re-declaring the whole gradient per state would put\n the stops in four places. */\n .${Be}reward-cta-primary:hover {\n box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.12);\n }\n\n .${Be}reward-cta-primary:active {\n box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.2);\n }\n\n .${Be}reward-cta-secondary {\n height: 48px;\n padding: 0 12px;\n border: 1px solid rgba(0, 0, 0, 0.1);\n font-weight: 500;\n background: transparent;\n color: #9c9c9c;\n }\n\n .${Be}reward-cta-secondary:hover {\n border-color: rgba(0, 0, 0, 0.22);\n color: var(--encore-text-color);\n }\n\n .${Be}reward-cta-primary:focus-visible,\n .${Be}reward-cta-secondary:focus-visible {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n /* ===== Gift flow (useCase: rewardUsers) — see GIFT_FLOW_NOTES. =====\n Box geometry is tracked in GiftHero.ts; do not retune it here alone. */\n\n /* Deliberately NOT in the content-column rule above, and deliberately NOT\n positioned. It hosts the sheet overlay, which has to cover the WHOLE reward\n surface including the CTA stack below it; giving this element position/z-index\n would trap that overlay in a stacking context it cannot escape, leaving the\n claim CTA clickable behind the scrim. The 393px column is applied to\n .gift-rows instead, which is the part that is actually content. */\n .${Be}gift {\n display: flex;\n flex-direction: column;\n gap: 22px;\n }\n\n .${Be}gift-hero {\n position: relative;\n display: flex;\n /* Top-aligned at every size; the clearance above the box is the surface's top\n inset now. 258 + that 22px inset = the old 280. See GIFT_FLOW_NOTES. */\n align-items: flex-start;\n justify-content: center;\n height: 258px;\n flex: none;\n }\n\n .${Be}gift-box {\n position: relative;\n width: 270px;\n height: 236px;\n }\n\n .${Be}gift-box-shadow {\n position: absolute;\n left: 55px;\n top: 222px;\n width: 160px;\n height: 12px;\n border-radius: 50%;\n background: #17181c;\n opacity: 0.08;\n }\n\n .${Be}gift-box-back {\n position: absolute;\n left: 66px;\n top: 112px;\n width: 138px;\n height: 60px;\n border-radius: 12px 12px 0 0;\n background: #1233c9;\n }\n\n .${Be}gift-box-front {\n position: absolute;\n left: 60px;\n top: 134px;\n width: 150px;\n height: 90px;\n border-radius: 0 0 16px 16px;\n background: #1e43f0;\n z-index: 4;\n }\n\n /* Lit left face + the white ribbon down the middle. */\n .${Be}gift-box-front::before {\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n width: 75px;\n height: 100%;\n border-radius: 0 0 0 16px;\n background: rgba(255, 255, 255, 0.12);\n }\n\n .${Be}gift-box-front::after {\n content: '';\n position: absolute;\n left: 66px;\n top: 0;\n width: 18px;\n height: 100%;\n background: #fff;\n }\n\n .${Be}gift-box-lid {\n position: absolute;\n left: 50px;\n top: 118px;\n width: 170px;\n height: 26px;\n border-radius: 9px;\n background: #3b63ff;\n z-index: 5;\n transform-origin: 50% 100%;\n opacity: 0;\n transform: translate(6px, -170px) rotate(-14deg);\n }\n\n .${Be}gift-box-lid::before {\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n width: 85px;\n height: 100%;\n border-radius: 9px 0 0 9px;\n background: rgba(255, 255, 255, 0.12);\n }\n\n .${Be}gift-box-lid::after {\n content: '';\n position: absolute;\n left: 76px;\n top: 0;\n width: 18px;\n height: 100%;\n background: #fff;\n }\n\n .${Be}gift-box-bow {\n position: absolute;\n left: 85px;\n top: 98px;\n width: 100px;\n height: 36px;\n z-index: 6;\n transform-origin: 50% 100%;\n opacity: 0;\n transform: translate(6px, -170px) rotate(-14deg);\n }\n\n .${Be}gift-box-bow svg {\n display: block;\n width: 100px;\n height: 36px;\n }\n\n /* Base = risen out of the box; the rise keyframes start them inside it. */\n .${Be}gift-tile {\n position: absolute;\n left: 103px;\n top: 128px;\n width: 64px;\n height: 64px;\n z-index: 3;\n opacity: 1;\n }\n\n .${Be}gift-tile--t1 {\n transform: translate(-74px, -88px);\n }\n\n .${Be}gift-tile--t2 {\n transform: translate(-7px, -126px);\n }\n\n .${Be}gift-tile--t3 {\n transform: translate(72px, -88px);\n }\n\n .${Be}gift-tile-inner {\n display: grid;\n place-items: center;\n width: 100%;\n height: 100%;\n border-radius: 18px;\n overflow: hidden;\n background: #fff;\n font-size: 15px;\n font-weight: 800;\n color: #17181c;\n box-shadow: 0 14px 28px rgba(23, 24, 28, 0.16), 0 0 0 3px #fff;\n }\n\n .${Be}gift-tile--t2 .${Be}gift-tile-inner {\n width: 78px;\n height: 78px;\n border-radius: 22px;\n font-size: 18px;\n }\n\n .${Be}gift-tile--t1 .${Be}gift-tile-inner {\n transform: rotate(-12deg);\n }\n\n .${Be}gift-tile--t3 .${Be}gift-tile-inner {\n transform: rotate(12deg);\n }\n\n .${Be}gift-tile-image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n /* A single gift keeps only the centre tile. */\n .${Be}gift-box--solo .${Be}gift-tile--t1,\n .${Be}gift-box--solo .${Be}gift-tile--t3 {\n display: none;\n }\n\n /* The open. Lid and bow fly off; the tiles rise behind them. */\n .${Be}gift-hero--play .${Be}gift-box-lid,\n .${Be}gift-hero--play .${Be}gift-box-bow {\n animation: ${Be}gift-lid 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s both;\n }\n\n .${Be}gift-hero--play .${Be}gift-tile--t1 {\n animation: ${Be}gift-rise1 0.7s cubic-bezier(0.2, 1.2, 0.3, 1) 0.45s both;\n }\n\n .${Be}gift-hero--play .${Be}gift-tile--t2 {\n animation: ${Be}gift-rise2 0.7s cubic-bezier(0.2, 1.2, 0.3, 1) 0.38s both;\n }\n\n .${Be}gift-hero--play .${Be}gift-tile--t3 {\n animation: ${Be}gift-rise3 0.7s cubic-bezier(0.2, 1.2, 0.3, 1) 0.52s both;\n }\n\n @keyframes ${Be}gift-lid {\n from {\n opacity: 1;\n transform: none;\n }\n 60% {\n opacity: 1;\n }\n to {\n transform: translate(6px, -170px) rotate(-14deg);\n opacity: 0;\n }\n }\n\n @keyframes ${Be}gift-rise1 {\n from {\n opacity: 0;\n transform: translateY(20px) scale(0.5);\n }\n to {\n opacity: 1;\n transform: translate(-74px, -88px) scale(1);\n }\n }\n\n @keyframes ${Be}gift-rise2 {\n from {\n opacity: 0;\n transform: translateY(20px) scale(0.5);\n }\n to {\n opacity: 1;\n transform: translate(-7px, -126px) scale(1);\n }\n }\n\n @keyframes ${Be}gift-rise3 {\n from {\n opacity: 0;\n transform: translateY(20px) scale(0.5);\n }\n to {\n opacity: 1;\n transform: translate(72px, -88px) scale(1);\n }\n }\n\n /* Each row lands on the same frame as its own gift's tile. Delays/duration and\n the never-runs fallback are reasoned out in GIFT_FLOW_NOTES. */\n @keyframes ${Be}gift-in {\n from {\n opacity: 0;\n visibility: hidden;\n /* NOT belt-and-braces: visibility stops the hit test only on the element it is\n computed on, and the CTA is a CHILD of the animated block. GIFT_FLOW_NOTES. */\n pointer-events: none;\n transform: translateY(12px);\n }\n to {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n transform: translateY(0);\n }\n }\n\n /* Gated on --play AND on --intro (first render only): no class, no animation, and\n the row keeps its BASE state, which is the finished one. See GIFT_FLOW_NOTES. */\n .${Be}gift-hero--play ~ .${Be}gift .${Be}gift-row--intro {\n animation: ${Be}gift-in 0.46s cubic-bezier(0.2, 1.2, 0.3, 1) 0.62s both;\n }\n\n .${Be}gift-hero--play ~ .${Be}gift .${Be}gift-row--intro:nth-child(2) {\n animation-delay: 0.69s;\n }\n\n .${Be}gift-hero--play ~ .${Be}gift .${Be}gift-row--intro:nth-child(3) {\n animation-delay: 0.76s;\n }\n\n /* The action block is the FOURTH item on the same cadence, and it has to be: a\n claim CTA naming a gift while no gift is on screen is claimable. See\n GIFT_FLOW_NOTES. The sibling gate means only the gift composition is touched. */\n .${Be}gift-hero--play ~ .${Be}reward-actions {\n animation: ${Be}gift-in 0.46s cubic-bezier(0.2, 1.2, 0.3, 1) 0.83s both;\n }\n\n /* Reduced motion: the box is ALREADY open with the gifts out of it. Skipping\n the animation must not leave a box that never opens. Confetti is skipped in\n JS — see RewardConfetti.shouldSkip. */\n @media (prefers-reduced-motion: reduce) {\n .${Be}gift-hero--play .${Be}gift-box-lid,\n .${Be}gift-hero--play .${Be}gift-box-bow {\n animation: none;\n opacity: 0;\n }\n .${Be}gift-hero--play .${Be}gift-tile--t1 {\n animation: none;\n opacity: 1;\n transform: translate(-74px, -88px);\n }\n .${Be}gift-hero--play .${Be}gift-tile--t2 {\n animation: none;\n opacity: 1;\n transform: translate(-7px, -126px);\n }\n .${Be}gift-hero--play .${Be}gift-tile--t3 {\n animation: none;\n opacity: 1;\n transform: translate(72px, -88px);\n }\n .${Be}gift-row,\n .${Be}gift-sheet,\n .${Be}gift-scrim {\n transition: none;\n }\n /* Full selectors repeated on purpose: a bare .gift-row here is (0,1,0) and would\n lose to the (0,3,0) rule above whatever the source order. */\n .${Be}gift-hero--play ~ .${Be}gift .${Be}gift-row--intro,\n .${Be}gift-hero--play ~ .${Be}reward-actions {\n animation: none;\n }\n }\n\n /* The burst comes OUT of the box, so it sits above every box part (max z-index 6). */\n .${Be}gift-hero .${Be}reward-confetti {\n z-index: 7;\n }\n\n /* ===== Gift palette — FIXED, from sdk_artifact.css. See GIFT_FLOW_NOTES. =====\n Scoped to .thankyou--gift so reduceChurn and any other reward composition keep\n reading the publisher/variant theme exactly as before. */\n .${Be}thankyou--gift {\n --encore-gift-accent: #163bf5;\n --encore-gift-accent-ink: #ffffff;\n --encore-gift-ink: #17181c;\n --encore-gift-muted: #6f7178;\n --encore-gift-line: #e1e3e8;\n --encore-gift-surface: #ffffff;\n --encore-gift-selected: #eaf0ff;\n /* The SCREEN WASH, and the single biggest reason the two screens read as one\n design or two: a soft blue fading to white by 46% down. Everything else sits\n on top of it. sdk_artifact.css line 66. */\n background: linear-gradient(180deg, #f5f9ff 0%, #ffffff 46%);\n color: var(--encore-gift-ink);\n /* Owns its own scrolling — see the note above the fixed sheet layer below. */\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n min-height: 0;\n flex: 1 1 auto;\n }\n\n /* THE GIFT COMPOSITION OWNS ITS OWN SCROLLING.\n The mobile sheet is overflow:hidden and forwards its height down; the CAROUSEL\n composition scrolls inside its own cards region, so the modal never needed to.\n The gift flow has no such inner scroller, so on a viewport too short for it the\n overflow was simply CLIPPED. Measured on an SE webview: content 667 tall in a\n 610 viewport, scrollHeight equal to clientHeight, Other gifts unreachable with\n nothing on screen to suggest it existed. Tightening the layout is the fix for\n the sizes we know about; this is the one for the sizes we do not. */\n /* The sheet is anchored to the VIEWPORT, not to the scrolled content. Absolute\n positioning inside a scroll container pins the overlay to the top of the\n CONTENT, so a scrolled surface would show it half off screen. Fixed resolves\n against the modal on desktop (which is transformed, and a transform contains\n fixed descendants) and against the viewport on mobile (where the modal spans it\n exactly) — the correct box in both cases. */\n .${Be}thankyou--gift .${Be}gift-sheet-layer {\n position: fixed;\n }\n\n /* The status block's 40px top padding assumes it is the FIRST thing in the\n sheet. The gift composition puts the hero above it, so that padding becomes a\n gap between the box and the headline the design does not have (measured: 38px\n here against the artifact's 0), and it pushes Other gifts toward the fold on a\n 390pt phone. Zeroed for this composition only. */\n .${Be}thankyou--gift .${Be}thankyou-status {\n padding-top: 0;\n }\n\n /* The word FREE, in the accent. */\n .${Be}gift-em {\n color: var(--encore-gift-accent);\n font-style: normal;\n }\n\n .${Be}thankyou--gift .${Be}thankyou-title {\n color: var(--encore-gift-ink);\n }\n\n .${Be}thankyou--gift .${Be}thankyou-subtitle,\n .${Be}thankyou--gift .${Be}reward-trust,\n .${Be}thankyou--gift .${Be}reward-terms {\n color: var(--encore-gift-muted);\n }\n\n /* FLAT accent, never a gradient — the design has no gradient CTA, and the theme's\n default is one. Uses the background shorthand, not background-color, so the\n gradient is dropped rather than left layered underneath. */\n .${Be}thankyou--gift .${Be}reward-cta-primary {\n background: var(--encore-gift-accent);\n color: var(--encore-gift-accent-ink);\n border-color: var(--encore-gift-accent);\n }\n\n .${Be}thankyou--gift .${Be}reward-cta-primary:hover {\n background: var(--encore-gift-accent);\n filter: brightness(0.94);\n }\n\n .${Be}thankyou--gift .${Be}reward-cta-link,\n .${Be}thankyou--gift .${Be}reward-cta-link:hover {\n background: none;\n color: var(--encore-gift-muted);\n }\n\n .${Be}thankyou--gift .${Be}reward-cta-secondary {\n border-color: var(--encore-gift-line);\n color: var(--encore-gift-ink);\n }\n\n /* Rows, sheet cards and their radios all take the fixed palette. The SELECTED\n state is a PALE fill with dark ink — the theme's saturated accent behind\n near-black text was the contrast failure this replaces. */\n .${Be}thankyou--gift .${Be}gift-row,\n .${Be}thankyou--gift .${Be}gift-card {\n background: var(--encore-gift-surface);\n border-color: var(--encore-gift-line);\n color: var(--encore-gift-ink);\n }\n\n .${Be}thankyou--gift .${Be}gift-row[aria-checked='true'],\n .${Be}thankyou--gift .${Be}gift-card[aria-checked='true'] {\n background: var(--encore-gift-selected);\n border-color: var(--encore-gift-accent);\n color: var(--encore-gift-ink);\n }\n\n .${Be}thankyou--gift .${Be}gift-row-secondary,\n .${Be}thankyou--gift .${Be}gift-sheet-fine {\n color: var(--encore-gift-muted);\n }\n\n .${Be}thankyou--gift .${Be}gift-row-radio {\n border-color: #c9ccd3;\n background: var(--encore-gift-surface);\n }\n\n .${Be}thankyou--gift\n .${Be}gift-row[aria-checked='true']\n .${Be}gift-row-radio {\n border-color: var(--encore-gift-accent);\n background: var(--encore-gift-accent);\n }\n\n .${Be}thankyou--gift .${Be}gift-sheet,\n .${Be}thankyou--gift .${Be}gift-sheet-title {\n background-color: var(--encore-gift-surface);\n color: var(--encore-gift-ink);\n }\n\n .${Be}thankyou--gift .${Be}gift-row:focus-visible,\n .${Be}thankyou--gift .${Be}gift-card:focus-visible,\n .${Be}thankyou--gift .${Be}reward-cta-primary:focus-visible,\n .${Be}thankyou--gift .${Be}reward-cta-secondary:focus-visible {\n outline-color: var(--encore-gift-accent);\n }\n\n /* ===== Composition, tracked value-for-value against sdk_artifact.css. =====\n Every number below is read off that file, with its line noted. These are the\n ones that make it the same DESIGN rather than merely the same palette: type\n weight, the CTA's shape, the row rhythm, and which lines are dark or muted.\n\n Selectors carry BOTH root classes on purpose. The --reward block further down\n this stylesheet targets the same elements at equal specificity, so with one\n class these rules lost on source order alone — measured: the headline stayed at\n weight 600 and the subtitle kept its translucent ink token while every other\n value in this block applied. */\n\n /* h1 — line 161. Weight 800 is what makes the title punch. */\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}thankyou-title {\n font-size: 28px;\n font-weight: 800;\n letter-spacing: -0.7px;\n line-height: 1.15;\n text-wrap: balance;\n }\n\n /* .sub — line 163. A flat muted hex, not a translucent ink token. */\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}thankyou-subtitle {\n font-size: 15px;\n line-height: 1.45;\n margin-top: 8px;\n color: var(--encore-gift-muted);\n opacity: 1;\n }\n\n /* .btn — line 45. A 16px radius on a 56px button is a rounded RECTANGLE; the\n theme's pill radius reads as a different control entirely. */\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}reward-cta-primary {\n height: 56px;\n min-height: 56px;\n border-radius: 16px;\n font-size: 16.5px;\n font-weight: 700;\n letter-spacing: -0.2px;\n }\n\n /* .rows — line 164, and .row min-height from line 137 (the reveal hero's 62px,\n not the base 58px). */\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}gift-rows {\n gap: 9px;\n padding: 22px 20px 0;\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}gift-row {\n min-height: 62px;\n gap: 12px;\n }\n\n /* .row .lab / .lab small — lines 169 and 171. */\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}gift-row-primary {\n font-size: 15px;\n font-weight: 700;\n letter-spacing: -0.2px;\n line-height: 1.25;\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}gift-row-secondary {\n font-size: 12px;\n font-weight: 500;\n color: #8a8c93;\n margin-top: 1px;\n }\n\n /* .row .ico and .radio — lines 168 and 172. */\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}gift-row-icon {\n width: 34px;\n height: 34px;\n border-radius: 9px;\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}gift-row-radio {\n border-color: #c9ccd3;\n }\n\n /* .above — line 176. DARK and semibold, not a muted trust line: it is the\n sentence the design wants read, sitting right above the CTA. */\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}reward-trust {\n font-size: 13px;\n font-weight: 600;\n color: var(--encore-gift-ink);\n padding: 0 20px 10px;\n margin: 0;\n }\n\n /* .terms — line 179. The quietest line on the screen. */\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}reward-terms {\n font-size: 11.5px;\n color: #b0b2b8;\n padding: 10px 20px 0;\n }\n\n /* .link — line 46. */\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}reward-cta-link,\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}reward-cta-link:hover {\n font-size: 14px;\n font-weight: 600;\n color: var(--encore-gift-muted);\n text-decoration: underline;\n text-underline-offset: 3px;\n text-decoration-color: #c9ccd3;\n padding: 8px 0 6px;\n }\n\n /* .cta — line 178. 20px gutters, and the action block supplies no extra ones. */\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}reward-actions {\n padding-left: 0;\n padding-right: 0;\n gap: 0;\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift .${Be}reward-cta-stack {\n padding: 0 20px;\n gap: 0;\n }\n\n /* Top inset: a FLOOR, not a sum — the inset is 0 in an in-app browser. 22px is\n the design's clearance; each tier pays for it. See GIFT_FLOW_NOTES. */\n .${Be}thankyou--reward.${Be}thankyou--gift {\n padding-top: max(22px, env(safe-area-inset-top));\n }\n\n /* The short-viewport tiers live AFTER the composition block on purpose. A media\n query adds no specificity, so a base rule using a padding SHORTHAND would beat\n a tier's padding-top at equal specificity on source order alone — measured: the\n SE trims silently did nothing while every other value applied. */\n /* SHORT VIEWPORTS get a smaller box. A webview is not a phone screen: the host's\n browser chrome and the safe areas take 80-100pt off an already 852pt device, and\n the hero is the one block with slack to give. Scaled rather than re-specified so\n the hand-tracked geometry in GiftHero.ts stays the single source of the layout\n and the keyframe translates keep working; only the rendered size changes.\n Measured on a 16 Pro webview: this is what keeps Other gifts above the fold. */\n @media (max-height: 820px) {\n /* The stage keeps its full 236px LAYOUT height however much it is scaled, so\n box and origin are both top-anchored. 216 - 22 = 194 pays for the top inset\n out of this tier rather than the column; the box draws 188.8, inside 194. */\n .${Be}gift-hero {\n height: 194px;\n }\n .${Be}gift-box {\n transform: scale(0.8);\n transform-origin: 50% 0;\n }\n }\n\n /* A SECOND, tighter tier. 667pt is the floor that has to fit: the SE, the\n 8/7/6S family, and any taller phone whose host app spends 60-100pt on its own\n browser chrome. Measured in an SE webview (375x610 of usable viewport) the\n previous tier still put terms 14px and Other gifts 57px past the bottom. The\n hero is the only block with that much to give, so it gives it. */\n @media (max-height: 700px) {\n /* 150 - 22 = 128, same trade: the inset comes out of the hero, not the SE's\n 18px of headroom. The scale follows the height — 0.54 draws 127.4. */\n .${Be}gift-hero {\n height: 128px;\n }\n .${Be}gift-box {\n transform: scale(0.54);\n }\n .${Be}gift {\n gap: 14px;\n }\n .${Be}thankyou--gift .${Be}reward-actions {\n padding-top: 12px;\n }\n /* The design's 22px rows inset and 10px under the fine print are the next\n cheapest space on a 667pt phone, after the hero. Trimmed here only: at this\n size 4px of headroom is not a margin, and one extra line of publisher copy\n would put Other gifts back under the fold. */\n .${Be}thankyou--reward.${Be}thankyou--gift\n .${Be}gift-rows {\n padding-top: 12px;\n }\n .${Be}thankyou--reward.${Be}thankyou--gift\n .${Be}reward-trust {\n padding-bottom: 6px;\n }\n }\n\n /* ===== Gift rows: the radio group. ===== */\n .${Be}gift-rows {\n display: flex;\n flex-direction: column;\n gap: 9px;\n padding: 0 20px;\n }\n\n .${Be}gift-row {\n position: relative;\n display: flex;\n align-items: center;\n gap: 12px;\n width: 100%;\n min-height: 58px;\n padding: 14px;\n border: 1.5px solid var(--encore-border-color);\n border-radius: 14px;\n background: var(--encore-surface-color);\n color: var(--encore-text-color);\n font: inherit;\n text-align: left;\n cursor: pointer;\n transition: background 0.15s, border-color 0.15s;\n }\n\n .${Be}gift-row[aria-checked='true'] {\n border-color: var(--encore-primary-color);\n background: var(--encore-card-tint, var(--encore-surface-color));\n }\n\n .${Be}gift-row:focus-visible,\n .${Be}gift-card:focus-visible,\n .${Be}gift-sheet-close:focus-visible {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n .${Be}gift-row-icon {\n display: grid;\n place-items: center;\n flex: none;\n width: 34px;\n height: 34px;\n border-radius: 9px;\n overflow: hidden;\n background: var(--encore-bg-color);\n font-size: 13px;\n font-weight: 800;\n }\n\n .${Be}gift-row-icon img,\n .${Be}gift-card-icon img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .${Be}gift-row-text {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-width: 0;\n gap: 1px;\n }\n\n .${Be}gift-row-primary {\n font-size: 15px;\n font-weight: 700;\n line-height: 1.25;\n }\n\n .${Be}gift-row-secondary {\n font-size: 12px;\n font-weight: 500;\n color: var(--encore-text-muted);\n }\n\n .${Be}gift-row-radio {\n display: grid;\n place-items: center;\n flex: none;\n width: 22px;\n height: 22px;\n border: 1.5px solid var(--encore-border-color);\n border-radius: 50%;\n background: var(--encore-surface-color);\n }\n\n .${Be}gift-row[aria-checked='true'] .${Be}gift-row-radio {\n border-color: var(--encore-primary-color);\n background: var(--encore-primary-color);\n }\n\n .${Be}gift-row[aria-checked='true'] .${Be}gift-row-radio::after {\n content: '';\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: #fff;\n }\n\n /* ===== The other-gifts sheet. Category tabs only with 2+ categories — see GiftSheet. ===== */\n .${Be}gift-sheet-layer {\n position: absolute;\n inset: 0;\n z-index: 2;\n pointer-events: none;\n }\n\n .${Be}gift-scrim {\n position: absolute;\n inset: 0;\n background: rgba(17, 18, 22, 0.35);\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.3s;\n }\n\n .${Be}gift-scrim--open {\n opacity: 1;\n pointer-events: auto;\n }\n\n .${Be}gift-sheet {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n max-height: 82%;\n padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px));\n border-radius: 26px 26px 0 0;\n background: var(--encore-surface-color);\n box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.18);\n transform: translateY(105%);\n transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);\n pointer-events: auto;\n }\n\n /* display:flex above would otherwise defeat the hidden attribute. */\n .${Be}gift-sheet[hidden] {\n display: none;\n }\n\n .${Be}gift-sheet--open {\n transform: none;\n }\n\n .${Be}gift-sheet-header {\n display: flex;\n align-items: center;\n gap: 8px;\n }\n\n .${Be}gift-sheet-title {\n flex: 1;\n margin: 0;\n padding-right: 28px;\n font-size: 17px;\n font-weight: 800;\n text-align: center;\n }\n\n .${Be}gift-sheet-close {\n padding: 6px 8px;\n border: 0;\n background: none;\n font: inherit;\n font-size: 20px;\n line-height: 1;\n color: var(--encore-text-muted);\n cursor: pointer;\n }\n\n /* Category tabs: a fixed-palette segmented control, 236x36 at two tabs. */\n .${Be}gift-sheet-tabs {\n display: flex;\n flex: none;\n align-self: center;\n box-sizing: border-box;\n min-width: 236px;\n max-width: 100%;\n height: 36px;\n margin-top: 14px;\n padding: 3px;\n border-radius: 999px;\n background: rgba(118, 118, 128, 0.12);\n overflow-x: auto;\n scrollbar-width: none;\n }\n\n .${Be}gift-sheet-tabs::-webkit-scrollbar {\n display: none;\n }\n\n .${Be}gift-sheet-tab {\n flex: 1 0 auto;\n padding: 0 12px;\n border: 0;\n border-radius: 999px;\n background: none;\n font: inherit;\n font-size: 15px;\n font-weight: 600;\n line-height: 30px;\n white-space: nowrap;\n color: #6f7178;\n cursor: pointer;\n }\n\n .${Be}gift-sheet-tab[aria-selected='true'] {\n background: #ffffff;\n color: #141414;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);\n }\n\n .${Be}gift-sheet-tab:focus-visible {\n outline: 2px solid #163bf5;\n outline-offset: -2px;\n }\n\n /* With tabs the list sits in this panel, which takes over the list's flex sizing. */\n .${Be}gift-sheet-panel {\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n min-height: 0;\n }\n\n /* The LIST is the part that scrolls, so it has to be the flex child that shrinks.\n Without min-height:0 a grid/flex child refuses to go below its content height,\n and a long other-gifts list overflows the capped sheet instead of scrolling\n inside it — taking the sheet's own CTA off screen with it. */\n .${Be}gift-sheet-list {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 10px;\n margin-top: 14px;\n overflow: auto;\n padding-bottom: 4px;\n flex: 1 1 auto;\n min-height: 0;\n }\n\n .${Be}gift-card {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 10px;\n padding: 14px 12px 12px;\n border: 1.5px solid var(--encore-border-color);\n border-radius: 16px;\n background: var(--encore-surface-color);\n color: var(--encore-text-color);\n font: inherit;\n text-align: left;\n cursor: pointer;\n }\n\n .${Be}gift-card[aria-checked='true'] {\n border-color: var(--encore-primary-color);\n background: var(--encore-card-tint, var(--encore-surface-color));\n }\n\n .${Be}gift-card-icon {\n display: grid;\n place-items: center;\n width: 40px;\n height: 40px;\n border-radius: 12px;\n overflow: hidden;\n background: var(--encore-bg-color);\n font-size: 15px;\n font-weight: 800;\n }\n\n .${Be}gift-card-label {\n font-size: 14px;\n font-weight: 700;\n line-height: 1.25;\n }\n\n .${Be}gift-sheet-cta {\n margin-top: 12px;\n flex: none;\n }\n\n .${Be}gift-sheet-fine {\n margin: 0;\n padding-top: 10px;\n font-size: 12px;\n color: var(--encore-text-muted);\n text-align: center;\n }\n\n /* giftList / giftUnwrap terms line. See ui/termsLine.ts. */\n .${Be}gift-terms {\n margin: 12px 0 0;\n font-size: 11px;\n font-weight: 400;\n line-height: 1.2;\n letter-spacing: -0.22px;\n color: #6a6d81;\n text-align: center;\n }\n\n .${Be}gift-terms-link {\n font: inherit;\n font-weight: 600;\n letter-spacing: inherit;\n color: inherit;\n text-decoration: underline;\n text-underline-offset: 2px;\n }\n\n button.${Be}gift-terms-link {\n margin: 0;\n padding: 0;\n border: 0;\n background: none;\n cursor: pointer;\n }\n\n /* Terms under the CTA, and the Other-gifts control rendered as a link rather\n than a second button competing with it. Must follow reward-cta-secondary. */\n .${Be}reward-terms {\n margin: 0;\n font-size: 12px;\n color: var(--encore-text-muted);\n text-align: center;\n }\n\n .${Be}reward-cta-link,\n .${Be}reward-cta-link:hover {\n min-height: 0;\n height: auto;\n padding: 8px 0;\n border: 0;\n background: none;\n color: var(--encore-text-muted);\n font-weight: 600;\n text-decoration: underline;\n text-underline-offset: 3px;\n }\n\n /* Publisher appearance slots — see APPEARANCE_SLOT_NOTES. */\n .${Be}slot-custom {\n font: inherit;\n color: inherit;\n letter-spacing: normal;\n margin: 0;\n }\n\n .${Be}slot-host {\n display: flex;\n align-items: center;\n justify-content: center;\n height: auto;\n padding: 0;\n border: none;\n background: none;\n background-image: none;\n box-shadow: none;\n color: inherit;\n cursor: pointer;\n }\n\n .${Be}slot-host:hover,\n .${Be}slot-host:active {\n box-shadow: none;\n border-color: transparent;\n color: inherit;\n }\n\n /* Rigid, and pinned to the bottom of the sheet. See REWARD_MOBILE_NOTES. */\n @media (max-width: ${He}) {\n .${Be}thankyou--reward .${Be}reward-actions {\n flex: 0 0 auto;\n margin-top: auto;\n }\n }\n\n /* ===== Reward visual parity — Figma 18304:2399. Reward-only selectors.\n Rationale lives in REWARD_VISUAL_NOTES (JS, stripped from the bundle). ===== */\n\n /* Flat: declares NO background, so the sheet inherits the modal's colour like\n every other composition. position stays as the confetti canvas's positioning\n context — it is not background. */\n .${Be}thankyou--reward {\n --encore-reward-brand: ${Ve};\n --encore-reward-brand-deep: #6515ED;\n /* Also the containing block for the gift sheet's overlay, which has to cover\n this whole surface including the CTA stack. Declared once, here. */\n position: relative;\n }\n\n /* Content column holds the 393 design width and centres.\n z-index 1 lifts content over the confetti, per the zStack order. */\n .${Be}thankyou--reward > .${Be}thankyou-status,\n .${Be}thankyou--reward > .${Be}carousel,\n .${Be}thankyou--reward > .${Be}gift-hero,\n .${Be}thankyou--reward .${Be}gift-rows,\n .${Be}thankyou--reward > .${Be}reward-actions {\n position: relative;\n z-index: 1;\n width: 100%;\n max-width: 393px;\n margin-left: auto;\n margin-right: auto;\n }\n\n /* Header (Figma 18304:3391). Text colours stay THEME TOKENS, never the Figma\n hexes — the variant's dark-mode rule (backend #426/#427). */\n .${Be}thankyou--reward .${Be}thankyou-title {\n margin: 0;\n font-size: 28px;\n font-weight: 600;\n line-height: 1.1;\n letter-spacing: -0.28px;\n text-align: center;\n text-wrap: balance;\n }\n\n .${Be}thankyou--reward .${Be}thankyou-subtitle {\n margin: 12px 0 0;\n font-size: 16px;\n font-weight: 400;\n line-height: 1.3;\n text-align: center;\n /* 0.55, not the Figma's 0.50: the variant's WCAG AA figure wins on contrast. */\n color: color-mix(in srgb, var(--encore-text-color) 55%, transparent);\n }\n\n /* Hero carousel. Neighbour = opacity .55 + scale .95 + translateY(11px),\n MEASURED off the render; no filter (opacity composites on the GPU). */\n .${Be}thankyou--reward .${Be}carousel {\n position: relative;\n }\n\n .${Be}thankyou--reward .${Be}carousel-cards {\n gap: 10px;\n /* Half container minus half card — lets the first/last card reach centre. */\n padding: 26px calc(50% - 105px);\n align-items: center;\n }\n\n .${Be}thankyou--reward .${Be}carousel-item {\n flex: 0 0 210px;\n width: 210px;\n opacity: 0.55;\n transform: translateY(11px) scale(0.95);\n transform-origin: center center;\n transition:\n opacity 260ms cubic-bezier(0.4, 0, 0.2, 1),\n transform 260ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* \`.active\` (geometric, tracks the drag), not \`[aria-selected]\` (commits on\n settle). One index, so they converge at rest. */\n .${Be}thankyou--reward .${Be}carousel-item.${Be}active {\n opacity: 1;\n transform: none;\n z-index: 1;\n }\n\n /* Registering the tint makes it an ANIMATABLE colour rather than an opaque\n token, so the tier-1 -> tier-2 upgrade eases instead of popping. Measured at\n 69-156ms cold against production logos — inside the modal's 250ms fade, so the\n swap is normally masked — but that is a property of a fast connection, not a\n guarantee, and a slow one would land the swap on a fully-visible sheet.\n Browsers without @property ignore this and swap instantly, exactly as before. */\n @property --encore-card-tint {\n syntax: '<color>';\n inherits: false;\n initial-value: ${Ve};\n }\n\n /* ---- The card itself (Figma 18304:3383) ---- */\n .${Be}reward-card {\n --encore-card-tint: ${Ve};\n position: relative;\n box-sizing: border-box;\n width: 210px;\n height: 260px;\n /* 43 to the pill, then the ladder below is gap-driven. */\n padding: 43px 15px 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n border-radius: 24px;\n overflow: hidden;\n background-color: #ffffff;\n /* Body = tint@10% over white (measured). The radials add the Figma's deeper\n right/bottom wash, derived from the same tint so any brand colour works. */\n background-image:\n radial-gradient(\n 120% 85% at 100% 0%,\n color-mix(in srgb, var(--encore-card-tint) 22%, transparent) 0%,\n transparent 68%\n ),\n radial-gradient(\n 140% 60% at 62% 112%,\n color-mix(in srgb, var(--encore-card-tint) 20%, transparent) 0%,\n transparent 74%\n ),\n linear-gradient(\n 0deg,\n color-mix(in srgb, var(--encore-card-tint) ${Math.round(10)}%, transparent) 0%,\n color-mix(in srgb, var(--encore-card-tint) ${Math.round(10)}%, transparent) 100%\n );\n box-shadow:\n 0 4px 12px rgba(0, 0, 0, 0.09),\n 0 4px 12px rgba(0, 0, 0, 0.02),\n 0 4px 74px rgba(0, 0, 0, 0.06),\n inset -8px 1px 13px color-mix(in srgb, var(--encore-card-tint) 13%, transparent);\n transition: --encore-card-tint 320ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n .${Be}reward-card-badge {\n flex: 0 0 auto;\n max-width: 100%;\n box-sizing: border-box;\n padding: 4px 10px;\n border-radius: 16px;\n background: #ffffff;\n box-shadow: 0 2.769px 5.538px rgba(56, 30, 0, 0.03);\n font-size: 14px;\n font-weight: 500;\n line-height: 1.2;\n letter-spacing: -0.3px;\n color: var(--encore-text-color);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n /* 84 from the card top = 43 (pad) + 25 (pill) + 16. */\n .${Be}reward-card-icon {\n flex: 0 0 auto;\n margin-top: 16px;\n width: 72px;\n height: 72px;\n border-radius: 18px;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background: color-mix(in srgb, var(--encore-card-tint) 92%, #ffffff);\n box-shadow: 0 2.769px 5.538px rgba(56, 30, 0, 0.15);\n }\n\n .${Be}reward-card-icon-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n display: block;\n }\n\n /* No logo, or a failed load. Ordinary rendering — logoUrl is optional. */\n .${Be}reward-card-monogram {\n font-size: 32px;\n font-weight: 700;\n line-height: 1;\n color: #ffffff;\n }\n\n /* 176 from the card top = 84 + 72 (icon) + 20. */\n .${Be}reward-card-text {\n margin-top: 20px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n min-width: 0;\n }\n\n /* One line: a long name must not push the offer line out of a fixed card. */\n .${Be}reward-card-name {\n max-width: 100%;\n font-size: 18px;\n font-weight: 600;\n line-height: 1.2;\n letter-spacing: -0.18px;\n text-align: center;\n color: var(--encore-text-color);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n /* Two lines then clamp — remote perk copy runs longer than the Figma's one. */\n .${Be}reward-card-offer {\n max-width: 100%;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.2;\n letter-spacing: -0.28px;\n text-align: center;\n color: color-mix(in srgb, var(--encore-text-color) 75%, transparent);\n overflow-wrap: anywhere;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n }\n\n /* Desktop arrows (mobile has swipe). Rendered only above the breakpoint —\n see OfferCarousel.#createRewardArrows. Centred on padY + half the card. */\n .${Be}reward-arrow {\n position: absolute;\n top: 156px;\n margin-top: -20px;\n z-index: 2;\n width: 40px;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n border: 1px solid rgba(0, 0, 0, 0.06);\n border-radius: 50%;\n background: rgba(255, 255, 255, 0.92);\n color: var(--encore-text-color);\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);\n cursor: pointer;\n transition:\n opacity 200ms cubic-bezier(0.4, 0, 0.2, 1),\n background 200ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n .${Be}reward-arrow svg {\n width: 20px;\n height: 20px;\n display: block;\n }\n\n .${Be}reward-arrow-prev {\n left: 12px;\n }\n\n .${Be}reward-arrow-next {\n right: 12px;\n }\n\n .${Be}reward-arrow:hover {\n background: #ffffff;\n }\n\n .${Be}reward-arrow:focus-visible {\n outline: 2px solid var(--encore-reward-brand);\n outline-offset: 2px;\n }\n\n /* Stays in place and in the tab order: vanishing would shift layout. */\n .${Be}reward-arrow:disabled {\n opacity: 0.35;\n cursor: default;\n }\n\n /* The variant's confetti: full-bleed, inert, self-removing after 2s. */\n .${Be}reward-confetti {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n\n /* Reduced motion: confetti is skipped in JS; the hero becomes an instant\n state change. Selection is unaffected. */\n @media (prefers-reduced-motion: reduce) {\n .${Be}thankyou--reward .${Be}carousel-item,\n .${Be}reward-card,\n .${Be}dot,\n .${Be}reward-arrow {\n transition: none;\n }\n }\n\n /* ===== Success Screen ===== */\n .${Be}success-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 3rem 2rem;\n text-align: center;\n min-height: 400px;\n animation: ${Be}fade-in 0.3s ease-out;\n }\n\n .${Be}success-icon {\n width: 80px;\n height: 80px;\n background: var(--encore-primary-color);\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 48px;\n color: white;\n margin-bottom: 1.5rem;\n animation: ${Be}scale-in 0.5s ease-out;\n }\n\n .${Be}success-title {\n font-size: 1.75rem;\n font-weight: 700;\n color: var(--encore-text-color);\n margin: 0 0 0.75rem 0;\n }\n\n .${Be}success-subtitle {\n font-size: 1.125rem;\n color: var(--encore-text-muted);\n margin: 0 0 2rem 0;\n line-height: 1.6;\n }\n\n .${Be}success-details {\n background: color-mix(in srgb, var(--encore-primary-color) 5%, transparent);\n border-radius: 12px;\n padding: 1.5rem;\n margin-bottom: 2rem;\n min-width: 280px;\n }\n\n .${Be}success-detail {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0.5rem 0;\n }\n\n .${Be}success-detail:not(:last-child) {\n border-bottom: 1px solid rgba(0, 0, 0, 0.05);\n }\n\n .${Be}success-detail-label {\n font-size: 0.875rem;\n color: var(--encore-text-muted);\n font-weight: 500;\n }\n\n .${Be}success-detail-value {\n font-size: 1rem;\n color: var(--encore-text-color);\n font-weight: 600;\n }\n\n .${Be}success-button {\n background: var(--encore-primary-color);\n color: white;\n border: none;\n border-radius: var(--encore-border-radius);\n padding: 0.875rem 2.5rem;\n font-size: 1rem;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s ease;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n }\n\n .${Be}success-button:hover {\n transform: translateY(-2px);\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);\n }\n\n .${Be}success-button:active {\n transform: translateY(0);\n }\n\n .${Be}success-button:focus-visible {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n @keyframes ${Be}scale-in {\n from {\n transform: scale(0);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n }\n\n /* Referenced by the reward chrome above as well as both deferred screens. */\n @keyframes ${Be}fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n /* ==========================================================================\n Deferred flow: primer (the hold) + redemption (the ready state), and the\n brand components both share.\n ========================================================================== */\n\n /* Shared monogram tile — the guaranteed first paint for every brand logo. */\n .${Be}brand-tile-placeholder {\n display: flex;\n align-items: center;\n justify-content: center;\n background: color-mix(in srgb, var(--encore-primary-color) 12%, var(--encore-bg-color));\n color: var(--encore-primary-color);\n font-weight: 700;\n font-size: 1.2rem;\n }\n\n /* Dual-brand lockup — two tiles settling together ("two brands, one deal"). */\n .${Be}lockup {\n display: flex;\n justify-content: center;\n align-items: center;\n margin: 0.5rem 0 1.5rem 0;\n }\n\n .${Be}lockup-tile {\n width: 56px;\n height: 56px;\n border-radius: 14px;\n object-fit: cover;\n box-shadow: 0 2px 8px color-mix(in srgb, var(--encore-text-color) 14%, transparent);\n background: var(--encore-bg-color);\n }\n\n .${Be}lockup-tile-partner {\n transform: rotate(-4deg);\n animation: ${Be}lockup-settle-left 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards;\n z-index: 1;\n }\n\n .${Be}lockup-tile-host {\n margin-left: -10px;\n transform: rotate(4deg);\n animation: ${Be}lockup-settle-right 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards;\n z-index: 2;\n }\n\n @keyframes ${Be}lockup-settle-left {\n from { transform: rotate(-6deg) translateX(-4px); }\n to { transform: rotate(-4deg) translateX(0); }\n }\n\n @keyframes ${Be}lockup-settle-right {\n from { transform: rotate(6deg) translateX(4px); }\n to { transform: rotate(4deg) translateX(0); }\n }\n\n /* Deal ledger — the claim state machine, rendered. */\n .${Be}ledger {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--encore-border-color);\n border-radius: 16px;\n background: var(--encore-bg-color);\n box-shadow: 0 1px 3px color-mix(in srgb, var(--encore-text-color) 6%, transparent);\n text-align: left;\n overflow: hidden;\n }\n\n .${Be}ledger-row {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 14px 16px;\n }\n\n .${Be}ledger-row + .${Be}ledger-row {\n border-top: 1px solid var(--encore-border-color);\n }\n\n /* The size class is worn by BOTH forms of the tile — the monogram div and the\n image that replaces it — so it must not set a display. It is emitted after\n .brand-tile-placeholder at equal specificity, so a block display here would\n beat that rule's flex centering and un-center every monogram in a ledger\n row. Scoped to the element that actually needs it, below. */\n .${Be}ledger-logo {\n width: 44px;\n height: 44px;\n border-radius: 11px;\n object-fit: cover;\n flex-shrink: 0;\n }\n\n img.${Be}ledger-logo {\n display: block;\n }\n\n .${Be}ledger-text {\n display: flex;\n flex-direction: column;\n gap: 2px;\n flex: 1 1 auto;\n min-width: 0;\n }\n\n .${Be}ledger-name {\n font-size: 0.95rem;\n font-weight: 600;\n color: var(--encore-text-color);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .${Be}ledger-detail {\n font-size: 0.8rem;\n color: var(--encore-text-muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .${Be}ledger-status {\n font-size: 0.85rem;\n font-weight: 600;\n flex-shrink: 0;\n }\n\n .${Be}ledger-status-active {\n color: var(--encore-success-color);\n }\n\n .${Be}ledger-status-pending {\n color: var(--encore-text-muted);\n }\n\n /* Primer screen — centered column, one forward CTA. */\n .${Be}primer-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n max-width: 440px;\n margin: 0 auto;\n padding: 2.5rem 1.75rem 2rem;\n text-align: center;\n animation: ${Be}fade-in 0.3s ease-out;\n }\n\n .${Be}primer-title {\n font-size: 1.6rem;\n font-weight: 700;\n color: var(--encore-text-color);\n margin: 0 0 0.5rem 0;\n line-height: 1.2;\n }\n\n .${Be}primer-subtitle {\n font-size: 1.05rem;\n color: var(--encore-text-muted);\n margin: 0 0 2rem 0;\n line-height: 1.5;\n }\n\n /* Reuses .encore-button-claim (the clean pill) — full-width + prominent. */\n .${Be}primer-cta {\n width: 100%;\n height: auto;\n min-height: 50px;\n padding: 14px 24px;\n font-size: 1rem;\n font-weight: 600;\n }\n\n /* Redemption screen — the ready state shown by redeem(). */\n .${Be}redemption-container {\n display: flex;\n flex-direction: column;\n max-width: 440px;\n margin: 0 auto;\n padding: 2rem 1.75rem;\n text-align: center;\n animation: ${Be}fade-in 0.3s ease-out;\n }\n\n .${Be}redemption-title {\n font-size: 1.6rem;\n font-weight: 700;\n color: var(--encore-text-color);\n margin: 0 0 0.5rem 0;\n line-height: 1.2;\n }\n\n .${Be}redemption-subtitle {\n font-size: 1.05rem;\n color: var(--encore-text-muted);\n margin: 0 0 1.75rem 0;\n line-height: 1.5;\n }\n\n .${Be}redemption-note {\n font-size: 0.8rem;\n color: var(--encore-text-muted);\n line-height: 1.5;\n margin: 1.25rem 0;\n }\n\n .${Be}redemption-cta {\n width: 100%;\n height: auto;\n min-height: 50px;\n padding: 14px 24px;\n font-size: 1rem;\n font-weight: 600;\n }\n\n /* Mobile sheet composition for both screens. MUST stay AFTER the rules above:\n it overrides their paddings and margins, and the cascade is source order at\n equal specificity. */\n @media (max-width: ${He}) {\n /* Both fill the full-height sheet (modal-body is a flex column). Top padding\n clears the close button's overlay band; bottom clears the home indicator. */\n .${Be}primer-container,\n .${Be}redemption-container {\n flex: 1 1 auto;\n max-width: none;\n width: 100%;\n box-sizing: border-box;\n padding: calc(64px + env(safe-area-inset-top)) 24px\n calc(24px + env(safe-area-inset-bottom));\n }\n\n /* The content block floats centered between two flexible spaces (auto margins\n above the lockup and above the CTA); the CTA sits on the bottom edge. */\n .${Be}primer-container .${Be}lockup {\n margin-top: auto;\n }\n\n .${Be}primer-cta {\n margin-top: auto;\n }\n\n .${Be}redemption-container > :first-child {\n margin-top: auto;\n }\n\n .${Be}redemption-cta {\n margin-top: auto;\n }\n }\n\n /* ===== giftList (Figma 19796:48052). Fixed palette like giftReveal; see GiftList.ts. ===== */\n .${Be}thankyou--gift-list {\n --encore-gl-accent: #ff8800;\n --encore-gl-accent-ink: #1f1e1e;\n --encore-gl-page: #f6f6f6;\n background:\n url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='911' height='637' viewBox='0 0 911.318 636.812'%3E%3Cfilter id='b' x='0' y='0' width='911.318' height='636.812' filterUnits='userSpaceOnUse'%3E%3CfeGaussianBlur stdDeviation='102'/%3E%3C/filter%3E%3Cellipse cx='455.659' cy='318.406' rx='251.659' ry='114.406' fill='%23FF8700' fill-opacity='.2' filter='url(%23b)'/%3E%3C/svg%3E") calc(50% - 8px) -193px / 911px 637px no-repeat,\n linear-gradient(180deg, #f6f2ee 0, #f6f2ee 300px, var(--encore-gl-page) 340px);\n color: #292d32;\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n min-height: 0;\n flex: 1 1 auto;\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift-list {\n padding-top: max(20px, env(safe-area-inset-top));\n }\n\n .${Be}thankyou--gift-list .${Be}gift-sheet-layer {\n position: fixed;\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}thankyou-status {\n padding-top: 0;\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift-list > .${Be}gift-list-presents,\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}gift-list-art,\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}gift-list-rows,\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}gift-list-more {\n width: 100%;\n max-width: 393px;\n margin-left: auto;\n margin-right: auto;\n box-sizing: border-box;\n }\n\n .${Be}gift-list-presents {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n padding-bottom: 10px;\n font-size: 14px;\n font-weight: 500;\n line-height: 1.2;\n color: #000;\n }\n\n .${Be}gift-list-presents-icon {\n width: 26px;\n height: 26px;\n border-radius: 6px;\n object-fit: cover;\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}thankyou-title {\n font-size: 28px;\n font-weight: 600;\n line-height: 1.1;\n letter-spacing: -0.28px;\n color: #292d32;\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}thankyou-title .${Be}gift-em {\n font-weight: 700;\n color: var(--encore-gl-accent);\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}thankyou-subtitle {\n max-width: 274px;\n margin: 13px auto 0;\n font-size: 16px;\n line-height: 1.25;\n color: #051e34;\n opacity: 1;\n }\n\n .${Be}gift-list {\n display: flex;\n flex-direction: column;\n }\n\n .${Be}gift-list-art {\n position: relative;\n height: 148px;\n margin-top: 20px;\n }\n\n /* The fade under the art belongs to the whole surface, not the 393px column:\n a modal wider than a phone otherwise shows the band's side edges. The art\n layer centres its image, so the column cap is only needed on the rows. */\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}gift-list-art {\n max-width: none;\n }\n\n .${Be}gift-list-art[hidden] {\n display: none;\n }\n\n .${Be}gift-list-art::after {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n bottom: -12px;\n height: 64px;\n background: linear-gradient(180deg, rgba(246, 242, 238, 0) 0%, #f6f2ee 100%);\n pointer-events: none;\n }\n\n .${Be}gift-list-art-layer {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .${Be}gift-list-art-image {\n display: block;\n max-width: min(252px, 100%);\n max-height: 148px;\n border-radius: 7.5px;\n filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.16));\n }\n\n .${Be}gift-list-art-logo {\n display: block;\n width: 96px;\n height: 96px;\n overflow: hidden;\n border-radius: 20px;\n background: #fff;\n box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);\n }\n\n .${Be}gift-list-art-logo img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .${Be}gift-list-rows {\n display: flex;\n flex-direction: column;\n gap: 10px;\n margin-top: 24px;\n padding: 0 20px;\n }\n\n .${Be}gift-list-row {\n display: grid;\n grid-template-columns: 38px minmax(0, 1fr) 20px;\n align-items: center;\n column-gap: 12px;\n width: 100%;\n min-height: 64px;\n padding: 12px 14px;\n border: 1px solid transparent;\n border-radius: 14px;\n background: #fff;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);\n color: #020623;\n font: inherit;\n text-align: left;\n cursor: pointer;\n transition: border-color 0.15s;\n }\n\n .${Be}gift-list-row[aria-checked='true'] {\n border-color: var(--encore-gl-accent, #ff8800);\n }\n\n .${Be}gift-list-row:focus-visible,\n .${Be}gift-list-more:focus-visible {\n outline: 2px solid var(--encore-gl-accent, #ff8800);\n outline-offset: 2px;\n }\n\n .${Be}gift-list-logo {\n display: grid;\n place-items: center;\n width: 38px;\n height: 38px;\n overflow: hidden;\n border-radius: 8px;\n background: #fff;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);\n font-size: 15px;\n font-weight: 700;\n }\n\n .${Be}gift-list-logo img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .${Be}gift-list-text {\n display: flex;\n flex-direction: column;\n gap: 3px;\n min-width: 0;\n }\n\n .${Be}gift-list-name {\n font-size: 14px;\n font-weight: 500;\n line-height: 1.3;\n color: #020623;\n }\n\n .${Be}gift-list-perk {\n font-size: 12px;\n line-height: 1.3;\n color: #6b7075;\n }\n\n .${Be}gift-list-em {\n font-weight: 600;\n color: var(--encore-gl-accent, #ff8800);\n }\n\n .${Be}gift-list-radio {\n display: block;\n width: 20px;\n height: 20px;\n color: var(--encore-gl-accent, #ff8800);\n visibility: hidden;\n }\n\n .${Be}gift-list-radio svg {\n display: block;\n }\n\n .${Be}gift-list-row[aria-checked='true'] .${Be}gift-list-radio {\n visibility: visible;\n }\n\n .${Be}gift-list-desc {\n grid-column: 1 / -1;\n margin-top: 8px;\n font-size: 14px;\n font-weight: 500;\n line-height: 1.3;\n color: #292b2c;\n animation: ${Be}gift-list-fade-in 0.2s ease-out both;\n }\n\n .${Be}gift-list-desc[hidden] {\n display: none;\n }\n\n .${Be}gift-list-more {\n align-self: center;\n margin-top: 5px;\n padding: 8px 16px;\n border: 0;\n background: none;\n font: inherit;\n font-size: 14px;\n font-weight: 500;\n color: #020623;\n cursor: pointer;\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}reward-actions {\n padding-top: 16px;\n padding-left: 0;\n padding-right: 0;\n gap: 0;\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}reward-cta-stack {\n padding: 0 20px;\n gap: 0;\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}reward-cta-primary,\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}gift-sheet-cta {\n height: 51px;\n min-height: 51px;\n border: 0;\n border-radius: 999px;\n background: var(--encore-gl-accent);\n color: var(--encore-gl-accent-ink);\n font-size: 16px;\n font-weight: 700;\n line-height: 1.2;\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}reward-cta-primary:hover {\n background: var(--encore-gl-accent);\n filter: brightness(0.96);\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}gift-sheet {\n background: var(--encore-gl-page);\n color: #020623;\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}gift-card {\n border-color: transparent;\n background: #fff;\n color: #020623;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}gift-card[aria-checked='true'] {\n border-color: var(--encore-gl-accent);\n }\n\n .${Be}thankyou--reward.${Be}thankyou--gift-list .${Be}gift-card .${Be}gift-em {\n color: var(--encore-gl-accent);\n }\n\n /* Entrance: first render only (--intro), base rules are the finished state. */\n @keyframes ${Be}gift-list-rise {\n from {\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n }\n }\n\n @keyframes ${Be}gift-list-fade-in {\n from {\n opacity: 0;\n }\n }\n\n @keyframes ${Be}gift-list-fade-out {\n to {\n opacity: 0;\n }\n }\n\n .${Be}gift-list-art-layer--intro {\n animation: ${Be}gift-list-rise 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both;\n }\n\n .${Be}gift-list-art-layer--in {\n animation: ${Be}gift-list-fade-in 0.2s ease-out both;\n }\n\n .${Be}gift-list-art-layer--out {\n animation: ${Be}gift-list-fade-out 0.2s ease-in forwards;\n pointer-events: none;\n }\n\n .${Be}gift-list-row--intro {\n animation: ${Be}gift-list-rise 0.36s cubic-bezier(0.2, 0.8, 0.2, 1) both;\n }\n\n .${Be}gift-list-row--intro:nth-child(2) {\n animation-delay: 0.06s;\n }\n\n .${Be}gift-list-row--intro:nth-child(3) {\n animation-delay: 0.12s;\n }\n\n @media (prefers-reduced-motion: reduce) {\n .${Be}gift-list-art-layer--intro,\n .${Be}gift-list-art-layer--in,\n .${Be}gift-list-art-layer--out,\n .${Be}gift-list-row--intro,\n .${Be}gift-list-row--intro:nth-child(2),\n .${Be}gift-list-row--intro:nth-child(3),\n .${Be}gift-list-desc {\n animation: none;\n }\n }\n${function(){const e=`.${Be}thankyou--reward.${Be}thankyou--gift-unwrap`;return`\n .${Be}unwrap {\n --encore-gu-accent: #ff8800;\n --encore-gu-accent-ink: #1f1e1e;\n --encore-gu-page: #f6f6f6;\n position: relative;\n display: flex;\n flex-direction: column;\n min-height: 0;\n background: var(--encore-gu-page);\n color: #292d32;\n font-family: var(--encore-font-family);\n }\n\n @media (max-width: ${He}) {\n .${Be}unwrap {\n flex: 1 1 auto;\n }\n }\n\n .${Be}unwrap-screen {\n position: relative;\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n min-height: 0;\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n }\n\n .${Be}unwrap-screen[hidden] {\n display: none;\n }\n\n ${e} {\n flex: 1 0 auto;\n min-height: 0;\n padding-top: max(22px, env(safe-area-inset-top));\n }\n\n ${e}::before {\n content: none;\n }\n\n .${Be}modal:has(.${Be}unwrap) {\n background: #f6f6f6;\n }\n\n .${Be}modal:has(.${Be}unwrap) .${Be}close-button {\n background: transparent;\n box-shadow: none;\n color: rgba(0, 0, 0, 0.3);\n }\n\n .${Be}unwrap-hero {\n display: flex;\n justify-content: center;\n pointer-events: none;\n }\n\n .${Be}unwrap-hero-box,\n .${Be}unwrap-hero-box svg {\n display: block;\n width: 183px;\n height: 183px;\n }\n\n ${e} .${Be}thankyou-status {\n padding: 10px 20px 0;\n }\n\n ${e} .${Be}thankyou-title {\n font-size: 28px;\n font-weight: 590;\n line-height: 1.1;\n letter-spacing: -0.28px;\n color: #292d32;\n text-wrap: balance;\n }\n\n ${e} .${Be}thankyou-title .${Be}gift-em,\n .${Be}unwrap-em {\n font-weight: 700;\n color: var(--encore-gu-accent);\n }\n\n ${e} .${Be}thankyou-subtitle {\n max-width: 274px;\n margin: 13px auto 0;\n font-size: 16px;\n line-height: 1.25;\n color: #051e34;\n }\n\n .${Be}unwrap-body {\n display: flex;\n flex-direction: column;\n }\n\n .${Be}unwrap-rows {\n display: flex;\n flex-direction: column;\n gap: 10px;\n width: 100%;\n max-width: 393px;\n box-sizing: border-box;\n margin: 0 auto;\n padding: 25px 20px 0;\n }\n\n .${Be}unwrap-row,\n ${e} .${Be}gift-card {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 12px;\n width: 100%;\n height: 64px;\n flex: none;\n box-sizing: border-box;\n padding: 0 14px;\n border: 1px solid transparent;\n border-radius: 14px;\n background: #ffffff;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);\n color: #020623;\n font: inherit;\n text-align: left;\n cursor: pointer;\n transition: border-color 0.15s;\n }\n\n .${Be}unwrap-row[aria-checked='true'],\n ${e} .${Be}gift-card[aria-checked='true'] {\n border-color: var(--encore-gu-accent);\n background: #ffffff;\n }\n\n .${Be}unwrap-row:focus-visible,\n .${Be}unwrap-more:focus-visible,\n .${Be}unwrap-back:focus-visible,\n .${Be}unwrap-cta:focus-visible,\n ${e} .${Be}gift-card:focus-visible {\n outline: 2px solid var(--encore-gu-accent);\n outline-offset: 2px;\n }\n\n .${Be}unwrap-row-logo,\n .${Be}unwrap-logo-inner {\n display: grid;\n place-items: center;\n flex: none;\n overflow: hidden;\n background: #ffffff;\n color: #020623;\n font-weight: 700;\n }\n\n .${Be}unwrap-row-logo {\n width: 38px;\n height: 38px;\n border-radius: 8px;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);\n font-size: 15px;\n }\n\n .${Be}unwrap-row-logo img,\n .${Be}unwrap-logo-inner img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .${Be}unwrap-row-text {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-width: 0;\n gap: 3px;\n }\n\n .${Be}unwrap-row-title,\n .${Be}unwrap-row-perk {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n line-height: 1.3;\n }\n\n .${Be}unwrap-row-title {\n font-size: 14px;\n font-weight: 510;\n }\n\n .${Be}unwrap-row-perk {\n font-size: 12px;\n font-weight: 400;\n color: #6b7075;\n }\n\n .${Be}unwrap-row-perk .${Be}unwrap-em {\n font-weight: 590;\n }\n\n .${Be}unwrap-radio,\n .${Be}unwrap-radio svg {\n display: block;\n flex: none;\n width: 20px;\n height: 20px;\n }\n\n .${Be}unwrap-radio {\n box-sizing: border-box;\n border: 1px solid #e3e3e8;\n border-radius: 50%;\n }\n\n .${Be}unwrap-radio svg {\n visibility: hidden;\n margin: -1px;\n }\n\n [aria-checked='true'] > .${Be}unwrap-radio {\n border-color: transparent;\n }\n\n [aria-checked='true'] > .${Be}unwrap-radio svg {\n visibility: visible;\n }\n\n .${Be}unwrap-more {\n align-self: center;\n margin: 13px 0 0;\n padding: 6px 12px;\n border: 0;\n background: none;\n color: #141414;\n font: inherit;\n font-size: 16px;\n font-weight: 700;\n line-height: 1.2;\n cursor: pointer;\n }\n\n ${e} .${Be}reward-actions {\n margin-top: auto;\n padding: 24px 0 max(20px, env(safe-area-inset-bottom));\n gap: 0;\n }\n\n ${e} .${Be}reward-cta-stack {\n padding: 0 20px;\n gap: 0;\n }\n\n ${e} .${Be}reward-cta-primary,\n ${e} .${Be}gift-sheet-cta,\n .${Be}unwrap-cta {\n width: 100%;\n height: 51px;\n min-height: 51px;\n box-sizing: border-box;\n padding: 0 16px;\n border: 0;\n border-radius: 999px;\n background: var(--encore-gu-accent);\n color: var(--encore-gu-accent-ink);\n font: inherit;\n font-size: 16px;\n font-weight: 700;\n line-height: 1.2;\n cursor: pointer;\n }\n\n ${e} .${Be}reward-cta-primary:hover,\n .${Be}unwrap-cta:hover {\n background: var(--encore-gu-accent);\n box-shadow: none;\n filter: brightness(0.96);\n }\n\n .${Be}unwrap-cta:disabled,\n .${Be}unwrap-cta[aria-disabled='true'] {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n ${e} .${Be}gift-sheet-layer {\n position: fixed;\n }\n\n ${e} .${Be}gift-sheet {\n gap: 20px;\n max-height: 85%;\n padding: 18px 20px max(20px, env(safe-area-inset-bottom));\n border-radius: 24px 24px 0 0;\n background: var(--encore-gu-page);\n color: #141414;\n }\n\n ${e} .${Be}gift-sheet-title {\n font-size: 18px;\n font-weight: 700;\n letter-spacing: -0.18px;\n color: #141414;\n }\n\n ${e} .${Be}gift-sheet-close {\n color: rgba(0, 0, 0, 0.3);\n }\n\n ${e} .${Be}gift-sheet-tabs {\n margin-top: 0;\n }\n\n ${e} .${Be}gift-sheet-list {\n display: flex;\n flex-direction: column;\n gap: 12px;\n margin: -6px -6px 0;\n padding: 6px;\n }\n\n ${e} .${Be}gift-sheet-cta {\n flex: none;\n height: 52px;\n min-height: 52px;\n margin-top: 0;\n border-radius: 26px;\n }\n\n .${Be}unwrap-back {\n position: absolute;\n top: calc(16px + env(safe-area-inset-top));\n left: 12px;\n z-index: 1;\n display: flex;\n align-items: center;\n height: 40px;\n padding: 0 8px 0 7px;\n border: 0;\n background: none;\n color: #000000;\n font: inherit;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n }\n\n .${Be}unwrap-back-icon,\n .${Be}unwrap-back-icon svg {\n display: block;\n width: 20px;\n height: 20px;\n }\n\n .${Be}unwrap-stage-frame {\n flex: none;\n width: 284px;\n height: 284px;\n margin: calc(52px + env(safe-area-inset-top)) auto 0;\n }\n\n .${Be}unwrap-reveal,\n .${Be}unwrap-closed,\n .${Be}unwrap-open,\n .${Be}unwrap-open-layer {\n position: relative;\n width: 284px;\n height: 284px;\n }\n\n .${Be}unwrap-closed,\n .${Be}unwrap-open,\n .${Be}unwrap-open-layer {\n position: absolute;\n inset: 0;\n }\n\n .${Be}unwrap-closed svg,\n .${Be}unwrap-open-layer svg {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .${Be}unwrap-glow {\n position: absolute;\n left: 142px;\n top: 126px;\n width: 437px;\n height: 303px;\n margin: -151.5px 0 0 -218.5px;\n opacity: 0.5;\n pointer-events: none;\n }\n\n .${Be}unwrap-glow svg {\n display: block;\n }\n\n .${Be}unwrap-closed {\n opacity: 0;\n transform-origin: 50% 80%;\n }\n\n .${Be}unwrap-open {\n transform-origin: 50% 50%;\n }\n\n .${Be}unwrap-logo {\n position: absolute;\n left: 97px;\n top: 86px;\n width: 96px;\n height: 96px;\n transform: rotate(-9deg);\n }\n\n .${Be}unwrap-logo-inner {\n width: 100%;\n height: 100%;\n border-radius: 24px;\n box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);\n font-size: 40px;\n }\n\n .${Be}unwrap-reveal--play .${Be}unwrap-closed {\n animation:\n ${Be}unwrap-closed-fade 1752ms cubic-bezier(0.22, 1, 0.36, 1),\n ${Be}unwrap-closed-squash 1752ms ease-in-out;\n }\n\n .${Be}unwrap-reveal--play .${Be}unwrap-open {\n animation:\n ${Be}unwrap-open-fade 1752ms ease-in-out,\n ${Be}unwrap-open-rise 1752ms ease-in-out;\n }\n\n .${Be}unwrap-reveal--play .${Be}unwrap-logo {\n animation:\n ${Be}unwrap-logo-fade 1752ms ease-in-out,\n ${Be}unwrap-logo-pop 1752ms ease-in-out;\n }\n\n .${Be}unwrap-reveal--play .${Be}unwrap-glow {\n animation: ${Be}unwrap-glow 1752ms cubic-bezier(0.22, 1, 0.36, 1);\n }\n\n @keyframes ${Be}unwrap-closed-fade {\n 0%, 23.3% { opacity: 1; }\n 32.9% { opacity: 0.58; }\n 41.1% { opacity: 0.16; }\n 46.6%, 100% { opacity: 0; }\n }\n\n @keyframes ${Be}unwrap-closed-squash {\n 0%, 23.3% { translate: 0 0; scale: 1; }\n 35.6% { translate: 0 3px; scale: 0.985 0.97; }\n 46.6%, 100% { translate: 0 0; scale: 1; }\n }\n\n @keyframes ${Be}unwrap-open-fade {\n 0%, 27.4% { opacity: 0; }\n 37%, 100% { opacity: 1; }\n }\n\n @keyframes ${Be}unwrap-open-rise {\n 0%, 28.8% {\n translate: 0 104px;\n scale: 0.94;\n rotate: 1.5deg;\n animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);\n }\n 63% { translate: 0 -14px; scale: 1.03; rotate: -4.5deg; }\n 82.2% {\n translate: 0 4px;\n scale: 0.99;\n rotate: 1.2deg;\n animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);\n }\n 100% { translate: 0 0; scale: 1; rotate: 0deg; }\n }\n\n @keyframes ${Be}unwrap-logo-fade {\n 0%, 39.7% { opacity: 0; }\n 50.7%, 100% { opacity: 1; }\n }\n\n @keyframes ${Be}unwrap-logo-pop {\n 0%, 39.7% { translate: 0 5px; scale: 0.985 0.95; }\n 60.3% { translate: 0 -4px; scale: 1.018 1.03; }\n 80.8% { translate: 0 1px; scale: 0.997 0.992; }\n 97.3%, 100% { translate: 0 0; scale: 1; }\n }\n\n @keyframes ${Be}unwrap-glow {\n 0%, 38.4% { opacity: 0; scale: 0.72; }\n 58.9% { opacity: 0.57; scale: 1.08; }\n 100% { opacity: 0.5; scale: 1; }\n }\n\n .${Be}unwrap-ready-title {\n margin: 26px 20px 0;\n font-size: 28px;\n font-weight: 700;\n line-height: 1.1;\n letter-spacing: -0.28px;\n color: #0b0a0d;\n text-align: center;\n outline: none;\n }\n\n .${Be}unwrap-ready-subline {\n max-width: 301px;\n margin: 13px auto 0;\n font-size: 14.5px;\n line-height: 19.14px;\n color: #0b0a0d;\n text-align: center;\n }\n\n .${Be}unwrap-bullets {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: 100%;\n max-width: 393px;\n box-sizing: border-box;\n margin: 27px auto 0;\n padding: 0 35.5px;\n list-style: none;\n }\n\n .${Be}unwrap-bullet {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n font-size: 14px;\n font-weight: 510;\n line-height: 25.62px;\n letter-spacing: -0.4px;\n color: #0b0a0d;\n overflow-wrap: anywhere;\n }\n\n .${Be}unwrap-bullet-icon,\n .${Be}unwrap-bullet-icon svg {\n display: block;\n flex: none;\n width: 20px;\n height: 20px;\n }\n\n .${Be}unwrap-bullet-icon {\n margin-top: 2.81px;\n }\n\n .${Be}unwrap-actions {\n margin-top: auto;\n padding: 24px 20px max(20px, env(safe-area-inset-bottom));\n }\n\n @media (max-height: 740px) {\n .${Be}unwrap-hero-box,\n .${Be}unwrap-hero-box svg {\n width: 140px;\n height: 140px;\n }\n .${Be}unwrap-stage-frame {\n height: 228px;\n }\n .${Be}unwrap-reveal {\n transform: scale(0.8);\n transform-origin: 50% 0;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .${Be}unwrap-reveal--play .${Be}unwrap-closed,\n .${Be}unwrap-reveal--play .${Be}unwrap-open,\n .${Be}unwrap-reveal--play .${Be}unwrap-logo,\n .${Be}unwrap-reveal--play .${Be}unwrap-glow {\n animation: none;\n }\n .${Be}unwrap-row,\n ${e} .${Be}gift-card {\n transition: none;\n }\n }\n `}()}\n `}(e),document.head.appendChild(t),u.debug("Encore styles injected successfully")}catch(e){u.error("Failed to inject Encore styles:",e)}}function Ze(e){return`${Be}${e}`}const Ye=['button:not([disabled]):not([tabindex="-1"])','a[href]:not([tabindex="-1"])','input:not([disabled]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','[tabindex]:not([tabindex="-1"])'].join(", ");class Qe{#Re;#Oe=null;#Ue=null;#Me=null;#Fe=null;#_e=!1;#ze=!1;#Pe=null;#De=[];#Be=null;#He=null;#Ve;#qe;#Ke;constructor(e={},t={}){this.#Re=new xe,this.#qe=t.dismissible??!0,this.#Ve=(t.showCloseButton??!0)&&this.#qe,this.#Ke=_e(t.backgroundColor),je(e)}show(){this.#_e?u.warn("Modal is already visible"):(this.#Pe=document.activeElement,this.#Ge(),this.#Oe&&document.body.appendChild(this.#Oe),this.#Ue&&document.body.appendChild(this.#Ue),document.body.classList.add(Ze("no-scroll")),requestAnimationFrame(()=>{this.#Ue&&this.#_e&&null===this.#He&&(this.#Oe?.classList.add(Ze("visible")),this.#Ue.classList.add(Ze("visible")),this.#We(!0))}),this.#je(),this.#Ze(),this.#Ye(),this.#_e=!0,this.#Re.emit("show",void 0),u.debug("Modal shown"))}hide(){this.#_e&&(this.#Oe?.classList.remove(Ze("visible")),this.#Ue?.classList.remove(Ze("visible")),this.#We(!1),this.#Qe(),this.#He=setTimeout(()=>{this.#He=null,this.#Xe()},200))}#Xe(){this.#We(!1),this.#Je(),document.body.classList.remove(Ze("no-scroll")),this.#Pe instanceof HTMLElement&&this.#Pe.focus(),this.#_e=!1,this.#Re.emit("hide",void 0),u.debug("Modal hidden")}#Qe(){null!==this.#He&&(clearTimeout(this.#He),this.#He=null)}onVisibilityChange(e){const t=this.#Re.on("visibility",e);return this.#ze&&e(!0),t}#We(e){this.#ze!==e&&(this.#ze=e,this.#Re.emit("visibility",e))}isVisible(){return this.#_e}setLabelledBy(e){this.#Ue?.setAttribute("aria-labelledby",e)}setContent(e){this.#Fe?(this.#Fe.innerHTML="",this.#Fe.appendChild(e),this.#Ze(),this.#Ue?.contains(document.activeElement)||this.#Ye()):u.error("Modal body not initialized")}on(e,t){return this.#Re.on(e,t)}#Ge(){this.#Oe=document.createElement("div"),this.#Oe.className=Ze("backdrop"),this.#Oe.setAttribute("aria-hidden","true"),this.#Ue=document.createElement("div"),this.#Ue.className=Ze("modal"),this.#Ue.setAttribute("role","dialog"),this.#Ue.setAttribute("aria-modal","true"),this.#Ue.setAttribute("aria-labelledby",Ze("modal-title")),this.#Ke&&this.#Ue.style.setProperty("background-color",this.#Ke),this.#Ve&&(this.#Me=document.createElement("button"),this.#Me.className=Ze("close-button"),this.#Me.setAttribute("aria-label","Close modal"),this.#Me.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">\n <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />\n </svg>\n '),this.#Fe=document.createElement("div"),this.#Fe.className=Ze("modal-body"),this.#Me&&this.#Ue.appendChild(this.#Me),this.#Ue.appendChild(this.#Fe)}#Je(){this.#Oe?.remove(),this.#Ue?.remove(),this.#Oe=null,this.#Ue=null,this.#Me=null,this.#Fe=null}#je(){this.#Me?.addEventListener("click",()=>{this.#Re.emit("close",void 0),this.hide()}),this.#qe&&this.#Oe?.addEventListener("click",()=>{this.#Re.emit("backdropClick",void 0),this.hide()}),this.#Be=this.#et.bind(this),document.addEventListener("keydown",this.#Be)}#et(e){if(this.#_e)switch(e.key){case"Escape":if(e.preventDefault(),!this.#qe)break;this.#Re.emit("close",void 0),this.hide();break;case"Tab":e.preventDefault(),this.#tt(e.shiftKey)}}#tt(e){const t=this.#nt();if(0===t.length)return;const n=t.findIndex(e=>e===document.activeElement);let i;i=e?n<=0?t.length-1:n-1:n>=t.length-1?0:n+1,t[i]?.focus()}#nt(){return this.#Ze(),this.#De.filter(e=>null===e.closest("[hidden]")&&null===e.closest('[aria-hidden="true"]'))}#Ze(){this.#Ue&&(this.#De=Array.from(this.#Ue.querySelectorAll(Ye)))}#Ye(){this.#nt()[0]?.focus()}destroy(){this.#Be&&document.removeEventListener("keydown",this.#Be),this.#Re.removeAllListeners(),this.#Qe(),this.#_e&&this.#Xe()}}const Xe=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1],Je=["animationend","animationcancel","transitionend","transitioncancel"];function et(e){const t=e.rootBounds;if(!t)return e.intersectionRatio;const n=e.boundingClientRect,i=n.width*n.height,r=t.width*t.height;if(i<=0||r<=0||i<=r)return e.intersectionRatio;const o=e.intersectionRect;return o.width*o.height/r}class tt{#it;#rt=new Set;#ot=new Map;#st=new WeakMap;#at=null;#lt=!1;#ct=!1;#dt=!1;#ht=null;#ut=null;#pt=null;#ft=null;constructor(e={}){this.#it=e.threshold??.5}register(e,t,n,i={}){if(this.#dt||this.#rt.has(t))return it;this.#gt(e),this.#ot.set(e,{element:e,key:t,onShown:n,eligible:i.eligible}),this.#mt();const r=this.#bt();if(r)try{r.observe(e)}catch(e){u.debug("Impression gate could not observe an element",e)}else this.#wt(e);return()=>this.#gt(e)}setContainerVisible(e){this.#dt||(this.#ct=e,e&&this.recheck())}recheck(){if(!this.#dt)for(const e of Array.from(this.#ot.keys()))this.#wt(e)}hasShown(e){return this.#rt.has(e)}destroy(){if(!this.#dt){this.#dt=!0;try{this.#at?.disconnect()}catch{}if(this.#at=null,this.#ot.clear(),this.#rt.clear(),this.#ht&&(document.removeEventListener("visibilitychange",this.#ht),this.#ht=null),this.#ut){for(const e of Je)document.removeEventListener(e,this.#ut,!0);this.#ut=null}this.#pt&&(window.removeEventListener("scroll",this.#pt,!0),window.removeEventListener("resize",this.#pt),this.#pt=null),null!==this.#ft&&(clearTimeout(this.#ft),this.#ft=null)}}#mt(){if(!this.#ht){try{this.#ht=()=>this.recheck(),document.addEventListener("visibilitychange",this.#ht)}catch(e){u.debug("Impression gate could not watch page visibility",e),this.#ht=null}try{this.#ut=()=>this.recheck();for(const e of Je)document.addEventListener(e,this.#ut,!0)}catch(e){u.debug("Impression gate could not watch for paint",e),this.#ut=null}}}#gt(e){if(this.#ot.delete(e))try{this.#at?.unobserve(e)}catch{}}#bt(){if(this.#lt)return this.#at;this.#lt=!0;try{if("function"!=typeof IntersectionObserver)throw new Error("unavailable");this.#at=new IntersectionObserver(e=>this.#yt(e),{root:null,threshold:Xe})}catch(e){u.debug("IntersectionObserver unavailable; impressions use a geometry check",e),this.#at=null,this.#xt()}return this.#at}#yt(e){try{for(const t of e)this.#st.set(t.target,t.isIntersecting&&et(t)>=this.#it),this.#wt(t.target)}catch(e){u.debug("Impression gate observer callback failed",e)}}#wt(e){const t=this.#ot.get(e);if(t&&!this.#dt&&this.#ct){try{if("visible"!==document.visibilityState)return;if(t.eligible&&!t.eligible())return;if(!(this.#at?!0===this.#st.get(e):this.#vt(e)))return;if(!this.#kt(e))return}catch(e){return void u.debug("Impression gate evaluation failed",e)}this.#$t(t)}}#$t(e){for(const[t,n]of Array.from(this.#ot))n.key===e.key&&this.#gt(t);if(!this.#rt.has(e.key)){this.#rt.add(e.key);try{e.onShown()}catch(e){u.error("Impression handler failed",e)}}}#kt(e){const t=e.ownerDocument?.defaultView;if(!t?.getComputedStyle)return!0;const n=t.getComputedStyle(e);if("hidden"===n.visibility||"collapse"===n.visibility)return!1;for(let i=e;i;i=i.parentElement){const r=i===e?n:t.getComputedStyle(i);if("none"===r.display)return!1;if(0===Number.parseFloat(r.opacity))return!1}return!0}#vt(e){if(!e.isConnected)return!1;const t=e.getBoundingClientRect(),n=t.width*t.height;if(n<=0)return!1;let i=Math.max(t.left,0),r=Math.max(t.top,0),o=Math.min(t.right,window.innerWidth||document.documentElement.clientWidth),s=Math.min(t.bottom,window.innerHeight||document.documentElement.clientHeight);for(let t=e.parentElement;t&&t!==document.body;t=t.parentElement){const e=window.getComputedStyle(t);if("visible"===e.overflowX&&"visible"===e.overflowY)continue;const n=t.getBoundingClientRect();i=Math.max(i,n.left),r=Math.max(r,n.top),o=Math.min(o,n.right),s=Math.min(s,n.bottom)}const a=Math.max(0,o-i)*Math.max(0,s-r),l=(window.innerWidth||document.documentElement.clientWidth)*(window.innerHeight||document.documentElement.clientHeight);return a/(l>0?Math.min(n,l):n)>=this.#it}#xt(){try{this.#pt=()=>{null!==this.#ft&&clearTimeout(this.#ft),this.#ft=setTimeout(()=>{this.#ft=null,this.recheck()},100)},window.addEventListener("scroll",this.#pt,!0),window.addEventListener("resize",this.#pt)}catch(e){u.debug("Impression gate could not listen for scrolls",e),this.#pt=null}}}class nt{#Ct;#Et=[];constructor(e){this.#Ct=e}register(e,t,n,i){this.#Et.push(this.#Ct.register(e,t,n,i))}clear(){const e=this.#Et;this.#Et=[];for(const t of e)t()}}function it(){}class rt{#It=null;#Tt;#ne;#_e=!1;#St=null;#At=null;#Lt=null;#Nt=null;#Rt=null;constructor(e,t){this.#Tt=e,this.#ne={position:"top",maxWidth:200,...t},this.#Ot()}#Ot(){this.#Lt=this.#Ut.bind(this),this.#Nt=this.#Mt.bind(this),this.#Rt=this.#Ft.bind(this),this.#Tt.addEventListener("mouseenter",this.#Lt),this.#Tt.addEventListener("mouseleave",this.#Nt)}#Ut(){this.#At&&(clearTimeout(this.#At),this.#At=null),this.#St=window.setTimeout(()=>{this.#_t()},50)}#Mt(){this.#St&&(clearTimeout(this.#St),this.#St=null),this.#At=window.setTimeout(()=>{this.#zt()},100)}#_t(){if(this.#_e)return;this.#It=document.createElement("div"),this.#It.className=Ze("tooltip"),this.#It.setAttribute("role","tooltip"),this.#It.textContent=this.#ne.content,this.#ne.maxWidth&&(this.#It.style.maxWidth=`${this.#ne.maxWidth}px`),this.#ne.position&&this.#It.classList.add(Ze(`tooltip-${this.#ne.position}`));const e=this.#Tt.getBoundingClientRect();this.#It.style.top=`${e.top}px`,this.#It.style.left=`${e.left}px`,document.body.appendChild(this.#It),this.#Rt&&(window.addEventListener("scroll",this.#Rt,!0),window.addEventListener("resize",this.#Rt)),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.#It&&(this.#Ft(),this.#It.classList.add(Ze("tooltip-visible")))})}),this.#_e=!0}#zt(){this.#_e&&this.#It&&(this.#Rt&&(window.removeEventListener("scroll",this.#Rt,!0),window.removeEventListener("resize",this.#Rt)),this.#It.classList.remove(Ze("tooltip-visible")),setTimeout(()=>{this.#It&&this.#It.parentNode&&this.#It.parentNode.removeChild(this.#It),this.#It=null},200),this.#_e=!1)}#Ft(){if(!this.#It||!this.#_e)return;const e=this.#Tt.getBoundingClientRect(),t=this.#It.getBoundingClientRect();let n=0,i=0;switch(this.#ne.position??"top"){case"top":n=e.top-t.height-8,i=e.left+e.width/2-t.width/2;break;case"bottom":n=e.bottom+8,i=e.left+e.width/2-t.width/2;break;case"left":n=e.top+e.height/2-t.height/2,i=e.left-t.width-8;break;case"right":n=e.top+e.height/2-t.height/2,i=e.right+8}i=Math.max(8,Math.min(i,window.innerWidth-t.width-8)),n=Math.max(8,Math.min(n,window.innerHeight-t.height-8)),this.#It.style.top=`${n}px`,this.#It.style.left=`${i}px`}updateContent(e){this.#ne.content=e,this.#It&&(this.#It.textContent=e,this.#Ft())}destroy(){this.#St&&(clearTimeout(this.#St),this.#St=null),this.#At&&(clearTimeout(this.#At),this.#At=null),this.#_e&&this.#zt(),this.#Lt&&this.#Tt.removeEventListener("mouseenter",this.#Lt),this.#Nt&&this.#Tt.removeEventListener("mouseleave",this.#Nt),this.#Rt&&(window.removeEventListener("scroll",this.#Rt,!0),window.removeEventListener("resize",this.#Rt))}}class ot{#Re;#Pt=null;#Dt=null;#Bt=null;#Ht=!0;constructor(e){this.#Re=new xe,this.#Ht=e?.claimEnabled??!0}render(e){this.#Pt=e,this.#Dt=document.createElement("div"),this.#Dt.className=Ze("offer-card");const t=this.#Vt(e.imageUrl,e.title,e.tooltipText);this.#Dt.appendChild(t);const n=this.#qt(e);return this.#Dt.appendChild(n),this.#Dt}on(e,t){return this.#Re.on(e,t)}#Vt(e,t,n){const i=document.createElement("div");i.className=Ze("offer-banner");const r=document.createElement("img");r.className=Ze("offer-banner-image"),r.alt=t??"Offer image";const o=Z(e);o?(r.src=o,r.complete?r.classList.add(Ze("loaded")):r.onload=()=>{r.classList.add(Ze("loaded"))},r.onerror=()=>{u.warn("Failed to load offer image, using fallback"),r.src=this.#Kt(),r.classList.add(Ze("loaded"))}):(r.src=this.#Kt(),r.classList.add(Ze("loaded"))),i.appendChild(r);const s=document.createElement("button");return s.className=Ze("banner-info-button"),s.setAttribute("aria-label","More information"),s.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">\n <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />\n </svg>\n ',s.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),u.debug("Info button clicked for offer",{title:t,tooltipText:n})}),n&&(this.#Bt=new rt(s,{content:n,position:"bottom",maxWidth:200}),i.appendChild(s)),i}#Kt(){return`data:image/svg+xml;base64,${btoa('\n <svg xmlns="http://www.w3.org/2000/svg" width="600" height="240" viewBox="0 0 600 240">\n <rect width="600" height="240" fill="#E5E7EB"/>\n <text x="50%" y="50%" text-anchor="middle" dy=".3em" fill="#9CA3AF" font-family="sans-serif" font-size="18">\n Offer Image\n </text>\n </svg>\n ')}`}#qt(e){const t=document.createElement("div");t.className=Ze("offer-footer");const n=document.createElement("div");n.className=Ze("offer-merchant");const i=Z(e.logoUrl);if(i){const t=document.createElement("img");t.className=Ze("offer-logo"),t.src=i,t.alt=`${e.merchantName??"Merchant"} logo`,t.complete?t.classList.add(Ze("loaded")):t.onload=()=>{t.classList.add(Ze("loaded"))},t.onerror=()=>{u.warn("Failed to load merchant logo",{merchantName:e.merchantName}),t.style.display="none"},n.appendChild(t)}const r=document.createElement("div");if(r.className=Ze("offer-merchant-text"),e.merchantName){const t=document.createElement("div");t.className=Ze("offer-merchant-name"),t.textContent=e.merchantName,r.appendChild(t)}if(e.description){const t=document.createElement("div");t.className=Ze("offer-merchant-desc"),t.textContent=e.description,r.appendChild(t)}n.appendChild(r);const o=document.createElement("button");return o.className=`${Ze("button")} ${Ze("button-claim")}`,o.textContent=e.ctaText??"Claim",o.setAttribute("aria-label",`Claim offer: ${e.title??"offer"}`),this.#Ht?o.addEventListener("click",()=>{this.#Pt&&this.#Re.emit("claim",{offer:this.#Pt})}):(o.disabled=!0,o.setAttribute("aria-disabled","true")),t.appendChild(n),t.appendChild(o),t}destroy(){this.#Bt&&(this.#Bt.destroy(),this.#Bt=null),this.#Re.removeAllListeners(),this.#Dt=null,this.#Pt=null}}const st="your gift",at="Here’s a FREE gift for you",lt="Continue",ct="Choose your gift",dt="Show more gifts";function ht(e){const t=w(e.merchantName);if(t)return t;return function(e){const t=w(e);if(t)try{const{hostname:e}=new URL(t);return w(e.replace(/^www\./i,""))}catch{return}}(e.advertiserUrl)||w(e.title)}function ut(e){return w(e.perk,e.description,e.title)}function pt(e){const t=ht(e),n=ut(e)??t??st,i=t&&(r=t,!n.toLowerCase().includes(r.toLowerCase()))?t:void 0;var r;return{primary:n,...i&&{secondary:i}}}function ft(e){const t=ht(e)??ut(e)??st,n=ut(e);return{brand:t,...n&&(i=n,r=t,!(i.trim().toLowerCase()===r.trim().toLowerCase()))&&{perk:n}};var i,r}function gt(e){const t=ut(e);if(t&&t.length<=32)return`Claim ${t}`;const n=ht(e);if(n){const e=`Claim your ${n} gift`;if(e.length<=38)return e}return"Claim gift"}function mt(e){const{primary:t,secondary:n}=pt(e);return n?`${t}, ${n}`:t}function bt(e){const{brand:t,perk:n}=ft(e);return n?`${t}, ${n}`:t}const wt=/\bFREE\b/g,yt=/\bfree\b([\s.!]*)$/i;function xt(e,t,n){const i=yt.exec(t);if(!i)return void vt(e,t,n);e.textContent="";const r=i.index;r>0&&e.appendChild(document.createTextNode(t.slice(0,r)));const o=document.createElement("span");o.className=n,o.textContent="FREE",e.appendChild(o);const s=i[1]??"";s&&e.appendChild(document.createTextNode(s))}function vt(e,t,n){e.textContent="";let i=0;for(const r of t.matchAll(wt)){const o=r.index??0;o>i&&e.appendChild(document.createTextNode(t.slice(i,o)));const s=document.createElement("span");s.className=n,s.textContent=r[0],e.appendChild(s),i=o+r[0].length}i<t.length&&e.appendChild(document.createTextNode(t.slice(i)))}const kt=/[$£€]\s?\d+(?:[.,]\d+)?/;function $t(e,t,n){if(xt(e,t,n),e.querySelector(`.${n}`))return;const i=kt.exec(t);if(!i)return;e.textContent="";const r=i.index;r>0&&e.appendChild(document.createTextNode(t.slice(0,r)));const o=document.createElement("span");o.className=n,o.textContent=i[0],e.appendChild(o);const s=t.slice(r+i[0].length);s&&e.appendChild(document.createTextNode(s))}const Ct=/[$£€]\s*\d|\b(?:usd|gbp|eur)\s*\d|\d(?:[.,]\d+)?\s*(?:usd|gbp|eur)\b/i;function Et(e){if(!e)return!1;const t=ut(e);return!!t&&Ct.test(t)}const It={free_trial:"Free trial",discount:"Discount"},Tt="Exclusive";function St(e){return"free_trial"===e?.badgeLabel&&!Et(e)}class At{#ne;#Gt=null;#dt=!1;constructor(e={}){this.#ne=e}render(e){const t=document.createElement("div");t.className=Ze("reward-card"),this.#Gt=t;const n=w(e.merchantName,e.title)??e.id;t.style.setProperty("--encore-card-tint",function(e){return Ee(function(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t>>>0}(e||"encore")%360,.72,.55)}(n)),this.#Wt(e);const i=w(this.#ne.badgeText)??function(e){const t=e?.badgeLabel;return t?"free_trial"===t&&Et(e)?Tt:It[t]??Tt:Tt}(e),r=document.createElement("span");r.className=Ze("reward-card-badge"),r.textContent=i,t.appendChild(r),t.appendChild(this.#jt(e));const o=document.createElement("div");o.className=Ze("reward-card-text");const s=document.createElement("div");s.className=Ze("reward-card-name"),s.textContent=w(e.merchantName,e.title)??"",o.appendChild(s);const a=w(e.perk,e.description);if(a){const e=document.createElement("div");e.className=Ze("reward-card-offer"),e.textContent=a,o.appendChild(e)}return t.appendChild(o),t}#jt(e){const t=document.createElement("div");t.className=Ze("reward-card-icon");const n=w(e.merchantName,e.title)??"",i=Z(e.logoUrl);if(!i)return t.appendChild(this.#Zt(n)),t;const r=document.createElement("img");return r.className=Ze("reward-card-icon-image"),r.alt="",r.setAttribute("aria-hidden","true"),r.src=i,r.onerror=()=>{r.remove(),t.appendChild(this.#Zt(n))},t.appendChild(r),t}#Zt(e){const t=document.createElement("span");return t.className=Ze("reward-card-monogram"),t.setAttribute("aria-hidden","true"),t.textContent=(Array.from(e)[0]??"★").toUpperCase(),t}#Wt(e){const t=Z(e.logoUrl);var n;t&&(n=t,n?new Promise(e=>{let t=!1;const i=n=>{t||(t=!0,window.clearTimeout(r),e(n))},r=window.setTimeout(()=>i(null),4e3);try{const e=new Image;e.crossOrigin="anonymous",e.onload=()=>{try{i(function(e){const t=document.createElement("canvas");t.width=ve,t.height=ve;const n=t.getContext("2d");if(!n)return null;n.drawImage(e,0,0,ve,ve);try{return function(e){let t=0,n=0,i=0,r=0;for(let o=0;o<e.length;o+=4){if((e[o+3]??0)<200)continue;const s=e[o]??0,a=e[o+1]??0,l=e[o+2]??0,c=$e(s,a,l);if(c>.92||c<.1)continue;const{s:d}=Ce(s,a,l);if(d<.18)continue;const h=d*d;t+=h,n+=s*h,i+=a*h,r+=l*h}if(0===t)return null;const{h:o,s:s,l:a}=Ce(n/t,i/t,r/t);return Ee(o,s,a)}(n.getImageData(0,0,ve,ve).data)}catch{return null}}(e))}catch(e){u.debug("Brand tint sampling failed — keeping the fallback tint",e),i(null)}},e.onerror=()=>i(null),e.src=n}catch(e){u.debug("Brand tint sampling unavailable — keeping the fallback tint",e),i(null)}}):Promise.resolve(null)).then(e=>{e&&!this.#dt&&this.#Gt&&this.#Gt.style.setProperty("--encore-card-tint",e)})}destroy(){this.#dt=!0,this.#Gt?.remove(),this.#Gt=null}}let Lt=0;class Nt{#Re;#Yt;#Qt=0;#Dt=null;#Xt=null;#Jt=null;#en=null;#tn=[];#nn=null;#in=null;#rn=null;#on=null;#sn=null;#an=0;#ln=null;#cn=!1;#Ct;#dn;#hn;#un=-1;#pn;#fn=window.matchMedia(`(max-width: ${He})`);#gn=!1;#mn=null;#bn=null;#wn=-1;#yn=!1;#xn=!1;#vn=!1;#Ht=!0;#kn=[];#$n=[];#Cn=[];#En="";#In=null;#Tn=null;#Sn;#An;constructor(e,t,n){if(this.#Re=new xe,this.#Yt=e,this.#pn=t,this.#yn="paged"===n?.mode,this.#xn=n?.hideHeader??!1,this.#vn=n?.selectable??!1,this.#Ht=n?.claimEnabled??!0,this.#Sn=_e(n?.dotColor),this.#An=_e(n?.dotActiveColor),this.#En=`${Ze("offer-option")}-${Lt+=1}-`,0===e.length)throw new Error("OfferCarousel requires at least one offer");this.#dn=void 0===n?.impressions,this.#Ct=n?.impressions??new tt,this.#hn=new nt(this.#Ct),this.#Ln()}render(){if(this.#Dt=document.createElement("div"),this.#Dt.className=this.#yn?`${Ze("carousel")} ${Ze("carousel-paged")}`:Ze("carousel"),this.#nn=document.createElement("div"),this.#nn.setAttribute("role","status"),this.#nn.setAttribute("aria-live","polite"),this.#nn.setAttribute("aria-atomic","true"),this.#nn.className="sr-only",this.#nn.style.position="absolute",this.#nn.style.width="1px",this.#nn.style.height="1px",this.#nn.style.padding="0",this.#nn.style.margin="-1px",this.#nn.style.overflow="hidden",this.#nn.style.clip="rect(0, 0, 0, 0)",this.#nn.style.whiteSpace="nowrap",this.#nn.style.border="0",!this.#xn){const e=this.#Nn();this.#Dt.appendChild(e)}if(this.#Xt=document.createElement("div"),this.#Xt.className=Ze("carousel-cards"),this.#vn&&(this.#Xt.setAttribute("role","listbox"),this.#Xt.setAttribute("tabindex","0"),this.#Xt.setAttribute("aria-label","Choose an offer"),this.#Xt.classList.add(Ze("carousel-select"),Ze("carousel-select--quiet"))),this.#Dt.appendChild(this.#nn),this.#Dt.appendChild(this.#Xt),this.#Yt.length>1){const e=this.#vn?this.#Rn():this.#On();this.#Dt.appendChild(e)}return this.#Un(),this.#Mn(),this.#gn=!this.#yn&&this.#fn.matches,this.#Fn(),this.#yn||(this.#mn=this.#_n.bind(this),this.#fn.addEventListener("change",this.#mn)),this.#Dt}#Fn(){this.#zn(),this.#un=this.#Qt,this.#Pn(),this.#gn?this.#Dn():(this.#vn?this.#Bn():this.#Hn(),this.#Vn(),this.#cn=!1,this.#qn(this.#Qt,!1),this.#Kn(this.#Qt),this.#Gn(this.#Qt))}#Mn(){this.#hn.clear();const e=this.#Xt?.querySelectorAll(`.${Ze("carousel-item")}`);e?.forEach(e=>{const t=Number(e.getAttribute("data-index")),n=this.#Yt[t];n&&this.#hn.register(e,n.id,()=>this.#Re.emit("offerView",{offer:n,index:t}),{eligible:()=>t===this.#Qt&&!this.#cn})})}#_n(){const e=this.#fn.matches;e!==this.#gn&&(this.#gn=e,this.#Fn())}#zn(){this.#in&&(document.removeEventListener("keydown",this.#in),this.#in=null),this.#Xt&&this.#In&&(this.#Xt.removeEventListener("keydown",this.#In),this.#In=null),this.#Xt&&this.#Tn&&(this.#Xt.removeEventListener("focusout",this.#Tn),this.#Tn=null),this.#Xt&&this.#rn&&(this.#Xt.removeEventListener("scroll",this.#rn),this.#rn=null),this.#Xt&&this.#on&&(this.#Xt.removeEventListener("scrollend",this.#on),this.#on=null),null!==this.#sn&&(cancelAnimationFrame(this.#sn),this.#sn=null),this.#ln&&(clearTimeout(this.#ln),this.#ln=null),this.#bn&&(this.#bn.disconnect(),this.#bn=null)}#Dn(){this.#Xt&&(this.#bn=new IntersectionObserver(e=>{let t=null;for(const n of e){if(!n.isIntersecting)continue;const e=n.target.getAttribute("data-index");if(null===e)continue;const i=Number(e);(!t||n.intersectionRatio>t.ratio)&&(t={index:i,ratio:n.intersectionRatio})}if(!t)return;const{index:n}=t;n!==this.#wn&&(this.#wn=n,this.#Qt=n,n!==this.#un&&(this.#un=n,this.#Re.emit("scroll",{axis:"vertical",position:n})),this.#Ct.recheck(),u.debug(`Offer ${n+1} entered view`))},{root:this.#Xt,threshold:.5}),this.#Xt.querySelectorAll(`.${Ze("carousel-item")}`).forEach(e=>this.#bn?.observe(e)))}on(e,t){return this.#Re.on(e,t)}getCurrentIndex(){return this.#Qt}getTotalOffers(){return this.#Yt.length}next(){const e=Math.min(this.#Qt+1,this.#Yt.length-1);e!==this.#Qt&&(this.#Qt=e,this.#Kn(e),this.#qn(e),this.#Wn(`Showing offer ${e+1} of ${this.#Yt.length}`),u.debug(`Navigated to offer ${e+1}`))}getSelectedOffer(){return this.#Yt[this.#Qt]}claimSelected(){const e=this.getSelectedOffer();e?this.#Re.emit("offerClaim",{offer:e,index:this.#Qt}):u.warn("Claim requested with no selected offer — ignoring")}selectOffer(e){e<0||e>=this.#Yt.length||e===this.#Qt||(this.#Qt=e,this.#Kn(e),this.#qn(e),this.#Wn(`Selected offer ${e+1} of ${this.#Yt.length}`),e!==this.#un&&(this.#un=e,this.#Re.emit("scroll",{axis:"horizontal",position:e})))}previous(){const e=Math.max(this.#Qt-1,0);e!==this.#Qt&&(this.#Qt=e,this.#Kn(e),this.#qn(e),this.#Wn(`Showing offer ${e+1} of ${this.#Yt.length}`),u.debug(`Navigated to offer ${e+1}`))}#Un(){if(!this.#Xt)return;const e=this.#Xt;this.#Yt.forEach((t,n)=>{let i;if(this.#vn){const e=new At;i=e.render(t),this.#$n.push(e)}else{const e=new ot({claimEnabled:this.#Ht});i=e.render(t),this.#tn.push(e),e.on("claim",()=>{this.#Re.emit("offerClaim",{offer:t,index:n})})}const r=document.createElement("div");r.className=Ze("carousel-item"),r.setAttribute("data-index",n.toString()),r.appendChild(i),this.#vn&&(r.id=`${this.#En}${n}`,r.setAttribute("role","option"),r.setAttribute("aria-selected",String(n===this.#Qt)),r.addEventListener("click",()=>this.selectOffer(n))),e.appendChild(r)}),requestAnimationFrame(()=>{e.classList.add(Ze("cards-ready"))})}#qn(e,t=!0){if(!this.#Xt)return;const n=this.#Xt.querySelectorAll(`.${Ze("carousel-item")}`)[e];if(n){if(this.#vn){const e=this.#Xt,i=n.getBoundingClientRect(),r=e.getBoundingClientRect(),o=e.scrollLeft+(i.left+i.width/2-(r.left+r.width/2));return void("function"==typeof e.scrollTo?e.scrollTo({left:o,behavior:t?"smooth":"auto"}):e.scrollLeft=o)}n.scrollIntoView({behavior:t?"smooth":"auto",block:"nearest",inline:"center"})}}#Kn(e){this.#jn(),this.#Zn(e),this.#Yn(e)}#Yn(e){if(!this.#vn||!this.#Xt)return;const t=this.#Xt.querySelectorAll(`.${Ze("carousel-item")}`);t.forEach((t,n)=>t.setAttribute("aria-selected",String(n===e)));const n=t[e]?.id;n?this.#Xt.setAttribute("aria-activedescendant",n):this.#Xt.removeAttribute("aria-activedescendant"),this.#kn.forEach((t,n)=>t.classList.toggle(Ze("active"),n===e)),this.#Qn(e);const i=this.#Yt[e];i&&this.#Re.emit("offerSelect",{offer:i,index:e})}#Rn(){const e=document.createElement("div");return e.className=Ze("page-indicator"),e.setAttribute("aria-hidden","true"),this.#Sn&&e.style.setProperty("--encore-dot-color",this.#Sn),this.#An&&e.style.setProperty("--encore-dot-active-color",this.#An),this.#kn=this.#Yt.map((t,n)=>{const i=document.createElement("span");return i.className=n===this.#Qt?`${Ze("dot")} ${Ze("active")}`:Ze("dot"),e.appendChild(i),i}),e}#Pn(){const e=this.#Dt;if(!e)return;const t=this.#vn&&this.#Yt.length>1&&!this.#gn;if(t&&0===this.#Cn.length)for(const t of this.#Xn())e.appendChild(t);else if(!t&&this.#Cn.length>0){for(const e of this.#Cn)e.remove();this.#Cn=[]}}#Xn(){const e=(e,t,n,i)=>{const r=document.createElement("button");return r.type="button",r.className=`${Ze("reward-arrow")} ${Ze(`reward-arrow-${e}`)}`,r.setAttribute("aria-label",t),r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${n}" /></svg>`,r.addEventListener("click",i),r};return this.#Cn=[e("prev","Previous offer","M14.5 5.5L8 12l6.5 6.5",()=>this.selectOffer(this.#Qt-1)),e("next","Next offer","M9.5 5.5L16 12l-6.5 6.5",()=>this.selectOffer(this.#Qt+1))],this.#Qn(this.#Qt),this.#Cn}#Qn(e){const[t,n]=this.#Cn;t&&(t.disabled=0===e,t.classList.toggle(Ze("disabled"),t.disabled)),n&&(n.disabled=e===this.#Yt.length-1,n.classList.toggle(Ze("disabled"),n.disabled))}#Bn(){this.#Xt&&(this.#In=e=>{this.#Jn();let t=null;switch(e.key){case"ArrowLeft":case"ArrowUp":t=this.#Qt-1;break;case"ArrowRight":case"ArrowDown":t=this.#Qt+1;break;case"Home":t=0;break;case"End":t=this.#Yt.length-1;break;default:return}e.preventDefault(),this.selectOffer(Math.max(0,Math.min(t,this.#Yt.length-1)))},this.#Xt.addEventListener("keydown",this.#In),this.#Tn=e=>{const t=e.relatedTarget;t instanceof Node&&t.ownerDocument===document&&document.contains(t)&&this.#Jn()},this.#Xt.addEventListener("focusout",this.#Tn))}#Jn(){this.#Xt?.classList.remove(Ze("carousel-select--quiet"))}#Gn(e){this.#Xt&&(this.#an=e,this.#Xt.querySelectorAll(`.${Ze("carousel-item")}`).forEach((t,n)=>{n===e?t.classList.add(Ze("active")):t.classList.remove(Ze("active"))}))}#Nn(){const e=document.createElement("div");e.className=Ze("carousel-header");const t=document.createElement("h2");t.className=Ze("carousel-title"),t.id=Ze("modal-title"),t.textContent=this.#pn?.customHeadline??this.#pn?.titleText??"Unlock 10 free articles – choose an offer below";const n=document.createElement("p");return n.className=Ze("carousel-subtitle"),n.textContent=this.#ei(this.#Qt),this.#Jt=n,e.appendChild(t),e.appendChild(n),e}#ei(e){const t=this.#pn?.customSubheadline??this.#pn?.subtitleText??"";if(!this.#yn)return t;const n=this.#Yt[e]?.perk?.trim();return n||t}#Zn(e){if(!this.#yn||!this.#Jt)return;const t=this.#ei(e);this.#Jt.textContent!==t&&(this.#Jt.textContent=t)}#On(){const e=document.createElement("div");e.className=Ze("carousel-navigation");const t=document.createElement("button");t.className=Ze("nav-button"),t.setAttribute("aria-label","Previous offer"),t.innerHTML=this.#yn?'\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round">\n <path d="M14.5 5.5L8 12l6.5 6.5" />\n </svg>\n ':'\n <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" style="transform: rotate(90deg);">\n <path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" />\n </svg>\n ',t.addEventListener("click",()=>this.previous());const n=document.createElement("button");return n.className=Ze("nav-button"),n.setAttribute("aria-label","Next offer"),n.innerHTML=this.#yn?'\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round">\n <path d="M9.5 5.5L16 12l-6.5 6.5" />\n </svg>\n ':'\n <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" style="transform: rotate(270deg);">\n <path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" />\n </svg>\n ',n.addEventListener("click",()=>this.next()),e.appendChild(t),e.appendChild(n),this.#en=e,this.#jn(t,n),e}#jn(e,t){if(!this.#en)return;const n=this.#en.querySelectorAll(`.${Ze("nav-button")}`),i=e??n[0],r=t??n[1];i&&(i.disabled=0===this.#Qt,i.classList.toggle(Ze("disabled"),0===this.#Qt)),r&&(r.disabled=this.#Qt===this.#Yt.length-1,r.classList.toggle(Ze("disabled"),this.#Qt===this.#Yt.length-1))}#Hn(){this.#in=this.#ti.bind(this),document.addEventListener("keydown",this.#in)}#ti(e){if(this.#Dt)switch(e.key){case"ArrowLeft":e.preventDefault(),this.previous();break;case"ArrowRight":e.preventDefault(),this.next()}}#Vn(){if(!this.#Xt)return;const e=this.#Xt,t="onscrollend"in e;this.#rn=()=>{this.#cn=!0,null===this.#sn&&(this.#sn=window.requestAnimationFrame(()=>{this.#sn=null,this.#ni()})),t||(this.#ln&&clearTimeout(this.#ln),this.#ln=window.setTimeout(()=>this.#ii(),120))},e.addEventListener("scroll",this.#rn),t&&(this.#on=()=>this.#ii(),e.addEventListener("scrollend",this.#on))}#ri(){if(!this.#Xt)return this.#Qt;const e=this.#Xt,t=e.querySelectorAll(`.${Ze("carousel-item")}`),n=e.getBoundingClientRect(),i=n.left+n.width/2;let r=0,o=1/0;return t.forEach((e,t)=>{const n=e.getBoundingClientRect(),s=Math.abs(i-(n.left+n.width/2));s<o&&(o=s,r=t)}),r}#ni(){if(!this.#Xt)return;const e=this.#ri();e!==this.#an&&this.#Gn(e)}#ii(){this.#ln&&(clearTimeout(this.#ln),this.#ln=null);const e=this.#ri();e!==this.#Qt&&(this.#Qt=e,this.#Kn(e),u.debug(`Gesture settled on offer ${e+1}`)),this.#Gn(e),e!==this.#un&&(this.#un=e,this.#Re.emit("scroll",{axis:"horizontal",position:e})),this.#cn=!1,this.#Ct.recheck()}#Wn(e){this.#nn&&(this.#nn.textContent=e)}#Ln(){this.#Yt.forEach(e=>{e.imageUrl&&((new Image).src=e.imageUrl,u.debug("Preloading offer image",{offerId:e.id,url:e.imageUrl})),e.logoUrl&&((new Image).src=e.logoUrl,u.debug("Preloading merchant logo",{offerId:e.id,url:e.logoUrl}))})}destroy(){this.#zn(),this.#hn.clear(),this.#dn&&this.#Ct.destroy(),this.#mn&&(this.#fn.removeEventListener("change",this.#mn),this.#mn=null),this.#tn.forEach(e=>e.destroy()),this.#tn=[],this.#$n.forEach(e=>e.destroy()),this.#$n=[],this.#Cn=[],this.#Re.removeAllListeners(),this.#Dt=null,this.#Xt=null,this.#Jt=null,this.#en=null,this.#nn=null,this.#kn=[]}}function Rt(e,t,n,i=!1){const r=document.createElement("div");r.className=`${t} ${Ze("brand-tile-placeholder")}`;const o=e.name?.trim().charAt(0);r.textContent=o?o.toUpperCase():"★",i&&r.setAttribute("aria-hidden","true");const s=Z(e.logoUrl);if(s){const o=document.createElement("img");o.className=t,o.alt=i?"":e.name?`${e.name} logo`:"Brand logo",i&&o.setAttribute("aria-hidden","true"),o.width=n,o.height=n,o.decoding="async",o.addEventListener("load",()=>r.replaceWith(o)),o.src=s}return r}function Ot(e,t){const n=document.createElement("div");n.className=Ze("lockup"),n.setAttribute("aria-hidden","true");const i=Rt(e,`${Ze("lockup-tile")} ${Ze("lockup-tile-partner")}`,56);return n.appendChild(i),(t.name||t.logoUrl)&&n.appendChild(Rt(t,`${Ze("lockup-tile")} ${Ze("lockup-tile-host")}`,56)),n}function Ut(e){const t=document.createElement("div");return t.className=Ze("ledger"),e.forEach(e=>t.appendChild(function(e){const t=document.createElement("div");t.className=Ze("ledger-row");const n=Rt(e.brand,Ze("ledger-logo"),44,!0),i=document.createElement("div");i.className=Ze("ledger-text");const r=document.createElement("div");if(r.className=Ze("ledger-name"),r.textContent=e.name,i.appendChild(r),e.detail){const t=document.createElement("div");t.className=Ze("ledger-detail"),t.textContent=e.detail,i.appendChild(t)}const o=document.createElement("div");return o.className=`${Ze("ledger-status")} ${Ze(`ledger-status-${e.status.tone}`)}`,o.textContent=e.status.text,t.appendChild(n),t.appendChild(i),t.appendChild(o),t}(e))),t}function Mt(e,t,n){const i=document.createElement("button");return i.className=`encore-button-claim ${t}`,i.setAttribute("type","button"),i.textContent=e,i.addEventListener("click",n),i}class Ft{#Dt=null;#Re;#n;constructor(e){this.#n=e,this.#Re=new xe}render(){const{display:e,partner:t}=this.#n,n=e.appDisplayName,i="activation"===this.#n.variant&&n?"activation":"holding",r=document.createElement("div");r.className=Ze("primer-container");const o=t.logoUrl??t.imageUrl,s=Ot({...t.name&&{name:t.name},...o&&{logoUrl:o}},{...n&&{name:n},...e.logoUrl&&{logoUrl:e.logoUrl}}),a=document.createElement("h2");var l,c;a.className=Ze("primer-title"),a.id=Ze("modal-title"),a.textContent="activation"===i&&n?(l=n,(c=e.trialPeriod)?`Amazing! Your ${c} free trial of ${l} is ready`:`Amazing! Your ${l} reward is ready`):"Your reward is saved";const d=document.createElement("p");var h;d.className=Ze("primer-subtitle"),d.textContent="activation"===i&&n?(e=>`Next you'll see the ${e} activation screen. No charge today.`)(n):(h=t.name)?`Come back any time to claim it from ${h}. No charge today.`:"Come back any time to claim it. No charge today.";const p=Mt("activation"===i&&n?((e,t)=>t?`Activate ${e} trial`:`Continue to ${e}`)(n,e.trialPeriod):"Continue",Ze("primer-cta"),()=>{u.debug("User tapped the primer CTA"),this.#Re.emit("continue",void 0)});return r.appendChild(s),r.appendChild(a),r.appendChild(d),r.appendChild(p),this.#Dt=r,u.debug("Primer screen rendered",{variant:i}),r}on(e,t){return this.#Re.on(e,t)}destroy(){this.#Dt&&(this.#Dt.remove(),this.#Dt=null),this.#Re.removeAllListeners(),u.debug("Primer screen destroyed")}}const _t=e=>({...e.advertiserName&&{name:e.advertiserName},...(e.logoUrl??e.imageUrl)&&{logoUrl:e.logoUrl??e.imageUrl}}),zt=e=>({brand:_t(e),name:e.advertiserName??"Your reward",...e.reward&&{detail:e.reward},status:{text:"Pending",tone:"pending"}}),Pt=e=>{const t=document.createElement("h2");return t.className=Ze("redemption-title"),t.id=Ze("modal-title"),t.textContent=e,t},Dt=e=>{const t=document.createElement("p");return t.className=Ze("redemption-subtitle"),t.textContent=e,t},Bt={activation(e){const t=e.host??{},n=t.name??"your app",i=[{brand:{name:n,...t.logoUrl&&{logoUrl:t.logoUrl}},name:n,...t.detail&&{detail:t.detail},status:{text:t.status??"Active",tone:"active"}},zt(e)];return[Ot(_t(e),{name:n,...t.logoUrl&&{logoUrl:t.logoUrl}}),Pt((r=n,o=t.trialPeriod,o?`Congratulations! Your ${o} free trial is active.`:`Congratulations! Your ${r} plan is active.`)),Dt(G(n)),Ut(i)];var r,o},reward:e=>[Pt("Congratulations!"),Dt(e.reward?`Now claim your ${e.reward}`:"Now claim your reward"),Ut([zt(e)])]};class Ht{#Dt=null;#Re;#n;constructor(e){this.#n=e,this.#Re=new xe}render(){const{advertiserName:e,buttonText:t}=this.#n,n=this.#n.variant??"reward",i=Object.prototype.hasOwnProperty.call(Bt,n)?n:"reward",r=document.createElement("div");r.className=Ze("redemption-container");for(const e of Bt[i](this.#n))r.appendChild(e);const o=document.createElement("p");o.className=Ze("redemption-note"),o.textContent=e?`You'll be sent to ${e}. No payment now, cancel anytime.`:"No payment now, cancel anytime.";const s=Mt(t??"Claim your reward",Ze("redemption-cta"),()=>{u.debug("User tapped the redemption CTA"),this.#Re.emit("continue",void 0)});return r.appendChild(o),r.appendChild(s),this.#Dt=r,u.debug("Redemption screen rendered",{variant:i}),r}on(e,t){return this.#Re.on(e,t)}destroy(){this.#Dt&&(this.#Dt.remove(),this.#Dt=null),this.#Re.removeAllListeners(),u.debug("Redemption screen destroyed")}}function Vt(e){return"object"==typeof e&&null!==e&&(1===e.nodeType&&"string"==typeof e.nodeName&&"function"==typeof e.setAttribute&&"function"==typeof e.cloneNode&&"function"==typeof e.querySelectorAll)}function qt(e,t){return null==e?null:"function"==typeof e?function(e,t){try{const n=e(t);return null==n?null:Vt(n)?n:(u.warn("[Encore SDK] Appearance renderer returned a non-element — using the default"),null)}catch(e){return u.warn("[Encore SDK] Appearance renderer threw — using the default",{error:e}),null}}(e,t):Vt(e)?e:null}function Kt(e){if(null!=e&&"function"!=typeof e&&!Vt(e))return e}function Gt(e,t,n){void 0!==n&&e.style.setProperty(t,n)}function Wt(e,t){Gt(e,"color",_e(t.color)),Gt(e,"font-family",ze(t.fontFamily)),Gt(e,"font-size",Pe(t.fontSize)),Gt(e,"font-weight",function(e){if(null==e)return;if("number"==typeof e)return Number.isInteger(e)&&e>=1&&e<=1e3?String(e):Me("font-weight",e);const t=Fe(e);if(void 0===t)return;if(null===t)return Me("font-weight",e);if(Re.test(t))return t;const n=Number(t);return Number.isInteger(n)&&n>=1&&n<=1e3?t:Me("font-weight",e)}(t.fontWeight)),Gt(e,"letter-spacing",Pe(t.letterSpacing)),Gt(e,"text-align",function(e){const t=Fe(e);if(void 0!==t)return null===t?Me("text-align",e):Oe.has(t.toLowerCase())?t.toLowerCase():Me("text-align",e)}(t.textAlign))}function jt(e){return"string"==typeof e?.text?w(e.text):void 0}function Zt(e,t,n,i){if(null==i)return e;const r=qt(i,{text:t,useCase:n,defaultElement:e});if(r)return r===e?e:Xt(e,r,Ze("slot-custom"))?(!e.textContent?.trim()&&t&&e.setAttribute("aria-label",t),e):e;const o=Kt(i);if(o){const t=jt(o);t&&(e.textContent=t),Wt(e,o)}return e}function Yt(e){return jt(Kt(e))}function Qt(e){const{className:t,label:n,onActivate:i,useCase:r,slot:o}=e,s=!1!==e.enabled,a=document.createElement("button");a.type="button",a.className=t,a.textContent=n;let l=n,c=!1;const d=()=>{const e=new AbortController;return s?a.addEventListener("click",i,{signal:e.signal}):(a.disabled=!0,a.setAttribute("aria-disabled","true")),{element:a,setAccessibleName:e=>en(a,e),setLabel:e=>{if(c)return;l=e;const t=Array.from(a.childNodes).find(e=>3===e.nodeType);t?t.nodeValue=e:c=!0},getLabel:()=>w(a.textContent)??l,destroy:()=>e.abort()}},h=qt(o,{text:n,useCase:r,defaultElement:a});if(!h||h===a){h===a&&a.textContent!==n&&(l=a.textContent??n,c=!0);const e=Kt(o);if(e){const t=jt(e);t&&(a.textContent=t,l=t,c=!0),function(e,t){Wt(e,t),Gt(e,"background-color",_e(t.backgroundColor)),Gt(e,"border-radius",Pe(t.borderRadius));const n=_e(t.borderColor);void 0!==n&&(e.style.setProperty("border-color",n),e.style.setProperty("border-style","solid"))}(a,e)}return d()}const p=document.createElement("div");if(p.className=`${t} ${Ze("slot-host")}`,p.setAttribute("role","button"),p.tabIndex=s?0:-1,s||p.setAttribute("aria-disabled","true"),function(e){try{e.style.setProperty("pointer-events","none");const t=[e,...Array.from(e.querySelectorAll(Jt))];for(const e of t)e.setAttribute("tabindex","-1")}catch(e){u.warn("[Encore SDK] Could not neutralize a custom appearance element",{error:e})}}(h),!Xt(p,h))return d();p.textContent?.trim()||p.setAttribute("aria-label",n);const f=new AbortController,g=e=>{e.preventDefault(),e.stopImmediatePropagation(),i()};return s&&(p.addEventListener("click",g,{capture:!0,signal:f.signal}),p.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||g(e)},{capture:!0,signal:f.signal})),{element:p,setAccessibleName:e=>en(p,e,p.textContent?.trim()?void 0:l),setLabel:e=>{p.textContent?.trim()||(l=e,p.setAttribute("aria-label",e))},getLabel:()=>w(p.textContent)??l,destroy:()=>{f.abort(),h.remove()}}}function Xt(e,t,n){if(!0===t.parentElement?.classList.contains(Ze("slot-host")))return u.warn("[Encore SDK] The same element was supplied to more than one appearance slot — using the default for this one. Supply a separate element, or a renderer."),!1;const i=e.textContent;try{return e.textContent="",n&&e.classList.add(n),e.appendChild(t),!0}catch(t){return u.warn("[Encore SDK] Could not mount a custom appearance element",{error:t}),n&&e.classList.remove(n),e.textContent=i,!1}}const Jt='a[href], button, input, select, textarea, iframe, [tabindex], [contenteditable="true"]';function en(e,t,n){t?e.setAttribute("aria-label",t):n?e.setAttribute("aria-label",n):e.removeAttribute("aria-label")}const tn=Ze("thankyou-title"),nn="No charges until trial ends, cancel anytime.",rn="Terms apply. See the offer for details.",on={decline:"No thanks",next:"Next offer",more:"Other gifts"};class sn{#ne;#Gt=null;#oi=null;#si=null;#ai=null;#li;#ci;#di;constructor(e){this.#ne=e,this.#di=w(e.primaryLabel)}#hi(){const e=this.#ne.secondary??"decline";return"next"!==e||this.#ne.onNext?"more"!==e||this.#ne.onMore?e:(u.warn('Reward secondary set to "Other gifts" with no onMore — rendering no button'),"none"):(u.warn('Reward secondary set to "Next offer" with no onNext — rendering no button'),"none")}render(){const e=document.createElement("div");if(e.className=Ze("reward-actions"),!1!==this.#ne.showTrust){const t=document.createElement("p");t.className=Ze("reward-trust"),this.#ai=t,this.#ui(),e.appendChild(t)}const t=document.createElement("div");t.className=Ze("reward-cta-stack");const n=this.#ne.useCase??"rewardUsers",i=Qt({className:Ze("reward-cta-primary"),label:this.#di??"Claim gift",onActivate:()=>this.#ne.onClaim(),enabled:!1!==this.#ne.claimEnabled,useCase:n,...this.#ne.claimSlot&&{slot:this.#ne.claimSlot}});t.appendChild(i.element),this.#oi=i,this.#pi();const r=w(this.#ne.termsText);if(this.#ne.termsElement)t.appendChild(this.#ne.termsElement);else if(r){const e=document.createElement("p");e.className=Ze("reward-terms"),e.textContent=r,t.appendChild(e)}const o=this.#hi();if("none"!==o){const e=Qt({className:"more"===o?`${Ze("reward-cta-secondary")} ${Ze("reward-cta-link")}`:Ze("reward-cta-secondary"),label:on[o],onActivate:()=>"next"===o?this.#ne.onNext?.():"more"===o?this.#ne.onMore?.():this.#ne.onDecline(),useCase:n,..."decline"===o&&this.#ne.declineSlot&&{slot:this.#ne.declineSlot}});t.appendChild(e.element),this.#si=e}return e.appendChild(t),this.#Gt=e,e}setSelectedOffer(e){this.#ci=e,this.#pi()}getSecondaryElement(){return this.#si?.element}setTrustText(e){this.#li=w(e),this.#ui()}#ui(){const e=this.#ai;e&&(e.textContent=w(this.#li,this.#ne.trustText)??nn)}setPrimaryLabel(e){const t=w(e);t&&(this.#di=t,this.#oi?.setLabel(t),this.#pi())}#pi(){if(!this.#oi)return;const e=this.#ci?.trim(),t=this.#oi.getLabel();this.#oi.setAccessibleName(e?`${t} from ${e}`:void 0)}destroy(){this.#oi?.destroy(),this.#si?.destroy(),this.#Gt?.remove(),this.#Gt=null,this.#oi=null,this.#si=null}}class an{#fi;#gi=null;#mi=[];#dt=!1;constructor(e=("undefined"==typeof document?null:document)){this.#fi=e}get origin(){return this.#gi}point(e){if(this.#dt)return;if(this.#gi)return;const t=function(e){if(!e)return null;let t;try{t=new URL(e)}catch{return null}return("https:"===t.protocol||"http:"===t.protocol&&j(t.hostname))&&t.origin&&"null"!==t.origin?t.origin:null}(e);if(!t)return;const n=this.#fi;if(n?.head)try{for(const e of["preconnect","dns-prefetch"]){const i=n.createElement("link");i.rel=e,i.href=t,n.head.appendChild(i),this.#mi.push(i)}this.#gi=t}catch(e){u.warn("Advertiser preconnect failed",{origin:t,error:e}),this.#bi(),this.#gi=null}}destroy(){this.#dt=!0,this.#bi(),this.#gi=null}#bi(){for(const e of this.#mi.splice(0))e.remove()}}const ln=Object.freeze({giftReveal:"giftReveal",giftList:"giftList",giftUnwrap:"giftUnwrap"}),cn=["#B728F5","#6515ED","#FF9F2B","#22C55E","#38BDF8","#F43F5E"];function dn(e,t){return e+Math.random()*(t-e)}class hn{#wi=null;#yi=null;#xi=[];#vi=null;#ki=0;#$i=0;#dt=!1;static shouldSkip(){try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}start(e,t={}){if(!this.#dt&&!hn.shouldSkip())try{const n=e.getBoundingClientRect(),i=Math.round(n.width),r=Math.round(n.height);if(i<1||r<1)return;const o=document.createElement("canvas");o.className=Ze("reward-confetti"),o.setAttribute("aria-hidden","true");const s=o.getContext("2d");if(!s)return;e.appendChild(o),this.#wi=o,this.#yi=s,this.#Ci(i,r),this.#Ei(t.origin),this.#ki=performance.now(),this.#$i=this.#ki,this.#vi=requestAnimationFrame(this.#Ii)}catch(e){u.debug("Confetti unavailable — rendering the sheet without it",e),this.destroy()}}#Ci(e,t){const n=this.#wi,i=this.#yi;if(!n||!i)return;const r=Math.min(2,window.devicePixelRatio||1);n.width=e*r,n.height=t*r,i.scale(r,r)}#Ei(e){const t=this.#wi;if(!t)return;if(e)return void this.#Ti(e);const n=Math.min(2,window.devicePixelRatio||1),i=t.width/n,r=t.height/n;this.#xi=Array.from({length:22},()=>{const e=dn(6,11);return{x:dn(0,i)+dn(-46,46),y:0*r+dn(.15*-r,.3*r),vx:dn(-46,46),vy:dn(40,160),w:e,h:e*dn(.4,.7),rotation:dn(0,2*Math.PI),spin:dn(-4,4),color:cn[Math.floor(dn(0,cn.length))]??"#B728F5"}})}#Ti(e){this.#xi=Array.from({length:22},()=>{const t=dn(6,11),n=.95*-Math.PI+Math.random()*Math.PI*.9,i=dn(220,460);return{x:e.x,y:e.y,vx:Math.cos(n)*i,vy:Math.sin(n)*i,w:t,h:t*dn(.4,.7),rotation:dn(0,2*Math.PI),spin:dn(-4,4),color:cn[Math.floor(dn(0,cn.length))]??"#B728F5"}})}#Ii=e=>{if(this.#dt)return;const t=this.#wi,n=this.#yi;if(!t||!n)return;const i=e-this.#ki,r=Math.min(.05,(e-this.#$i)/1e3);if(this.#$i=e,i>=2e3)return void this.destroy();const o=Math.min(2,window.devicePixelRatio||1),s=t.height/o;n.clearRect(0,0,t.width/o,s);const a=i/2e3;n.globalAlpha=a<.66?1:Math.max(0,1-(a-.66)/.34);for(const e of this.#xi)e.vy+=320*r,e.vx*=Math.pow(.86,r),e.x+=e.vx*r,e.y+=e.vy*r,e.rotation+=e.spin*r,e.y-e.h>s||(n.save(),n.translate(e.x,e.y),n.rotate(e.rotation),n.fillStyle=e.color,n.fillRect(-e.w/2,-e.h/2,e.w,e.h),n.restore());this.#vi=requestAnimationFrame(this.#Ii)};destroy(){this.#dt=!0,null!==this.#vi&&(cancelAnimationFrame(this.#vi),this.#vi=null),this.#wi?.remove(),this.#wi=null,this.#yi=null,this.#xi=[]}}const un=["t2","t1","t3"];class pn{#Gt=null;#Si=null;#Ai=null;#dt=!1;#Ii=null;#Li=null;#Ni=!1;render(e){const t=document.createElement("div");t.className=Ze("gift-hero"),t.setAttribute("aria-hidden","true");const n=document.createElement("div");n.className=e.length<=1?`${Ze("gift-box")} ${Ze("gift-box--solo")}`:Ze("gift-box"),n.appendChild(this.#Ri("gift-box-shadow")),n.appendChild(this.#Ri("gift-box-back")),e.slice(0,3).forEach((e,t)=>{const i=un[t];i&&n.appendChild(this.#Oi(e,i))}),n.appendChild(this.#Ri("gift-box-front")),n.appendChild(this.#Ri("gift-box-lid"));const i=this.#Ri("gift-box-bow");return i.innerHTML='<svg viewBox="0 0 100 36" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M50 30C30 8 8 16 22 30c8 8 21 4 28 0z" fill="#FFD166" /><path d="M50 30c20-22 42-14 28 0-8 8-21 4-28 0z" fill="#FFD166" /><circle cx="50" cy="30" r="6" fill="#F4B942" /></svg>',n.appendChild(i),t.appendChild(n),this.#Gt=t,this.#Si=n,t}updateTiles(e){if(!this.#dt&&this.#Si)try{e.slice(0,3).forEach((e,t)=>{const n=un[t];if(!n)return;const i=this.#Si?.querySelector(`.${Ze(`gift-tile--${n}`)}`),r=i?.querySelector(`.${Ze("gift-tile-inner")}`);r instanceof HTMLElement&&(r.textContent="",this.#Ui(r,e))})}catch(e){u.debug("Gift hero could not refresh its tiles",e)}}#Ri(e){const t=document.createElement("div");return t.className=Ze(e),t}#Oi(e,t){const n=document.createElement("div");n.className=`${Ze("gift-tile")} ${Ze(`gift-tile--${t}`)}`;const i=document.createElement("div");return i.className=Ze("gift-tile-inner"),this.#Ui(i,e),n.appendChild(i),n}#Ui(e,t){const n=ht(t)??"",i=Z(t.logoUrl);if(!i)return void e.appendChild(this.#Mi(n));const r=document.createElement("img");r.className=Ze("gift-tile-image"),r.alt="",r.setAttribute("aria-hidden","true"),r.src=i,r.onerror=()=>{e.contains(r)&&(r.remove(),e.appendChild(this.#Mi(n)))},e.appendChild(r)}#Mi(e){const t=document.createElement("span");return t.className=Ze("gift-tile-monogram"),t.setAttribute("aria-hidden","true"),t.textContent=(Array.from(e)[0]??"★").toUpperCase(),t}play(){if(!this.#dt&&!this.#Ni){try{this.#Ii=requestAnimationFrame(()=>{this.#Ii=null,this.#Fi()})}catch(e){u.debug("Gift hero could not schedule a frame — falling back to the timer",e)}try{this.#Li=setTimeout(()=>{this.#Li=null,this.#Fi()},120)}catch(e){u.debug("Gift hero could not schedule its fallback — opening now",e),this.#Fi()}}}#Fi(){if(!this.#dt&&!this.#Ni){this.#Ni=!0,this.#_i();try{this.#zi()}catch(e){u.debug("Gift hero animation unavailable — rendering the box open",e)}}}#_i(){null!==this.#Li&&(clearTimeout(this.#Li),this.#Li=null)}#zi(){const e=this.#Gt;if(!e)return;e.classList.add(Ze("gift-hero--play"));const t=new hn;this.#Ai=t,t.start(e,{origin:this.#Pi()})}#Pi(){const e=this.#Si,t=this.#Gt,n={x:(e?.offsetLeft??0)+135,y:(e?.offsetTop??0)+130};if(!e||!t)return n;const i=e.getBoundingClientRect(),r=t.getBoundingClientRect(),o=e.offsetWidth;if(!o||!i.width)return n;const s=i.width/o;return{x:i.left-r.left+135*s,y:i.top-r.top+130*s}}destroy(){this.#dt=!0,null!==this.#Ii&&(cancelAnimationFrame(this.#Ii),this.#Ii=null),this.#_i(),this.#Ai?.destroy(),this.#Ai=null,this.#Gt?.remove(),this.#Gt=null,this.#Si=null}}const fn=["Watch & listen","Money","Everyday"],gn="Everyday",mn=new Map(Object.entries({"Music and Audio":"Watch & listen","Video and Streaming":"Watch & listen","News and Reading":"Watch & listen","Games and Entertainment":"Watch & listen","Finance and Credit":"Money","Cashback and Rewards":"Money","Food and Delivery":"Everyday","Shopping and Retail":"Everyday","Travel and Transport":"Everyday",Pets:"Everyday","Family and Baby":"Everyday","Health and Wellness":"Everyday",Fitness:"Everyday","Beauty and Personal Care":"Everyday","Mental Health and Therapy":"Everyday","Software and Productivity":"Everyday","Privacy and Connectivity":"Everyday","Learning and Education":"Everyday"}).map(([e,t])=>[e.toLowerCase(),t])),bn=new Set;function wn(e){const t="string"==typeof e?e.trim():"";if(""===t)return gn;const n=t.toLowerCase();return mn.get(n)||(bn.has(n)||(bn.add(n),u.debug(`Unknown offer category "${t}"; showing it under ${gn}`)),gn)}function yn(){try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function xn(e,t){const n=document.createElement("span");n.className=Ze(t),n.setAttribute("aria-hidden","true");const i=ht(e)??"",r=Z(e.logoUrl);if(!r)return n.textContent=(Array.from(i)[0]??"★").toUpperCase(),n;const o=document.createElement("img");return o.alt="",o.src=r,o.onerror=()=>{o.remove(),n.textContent=(Array.from(i)[0]??"★").toUpperCase()},n.appendChild(o),n}let vn=0;class kn{#ne;#Di=null;#Bi=null;#Hi=null;#dt=!1;#Vi=null;#He=null;#qi=null;#zi=!1;#hn;#Ki=null;#Gi=null;#Wi=[];#ji=void 0;#Zi=null;#Yi=Ze("gift-sheet-"+ ++vn);constructor(e){this.#ne=e,this.#hn=new nt(e.impressions)}render(){const{signal:e}=this.#ne,t=document.createElement("div");t.className=Ze("gift-sheet-layer");const n=document.createElement("div");n.className=Ze("gift-scrim"),n.addEventListener("click",()=>this.close(),{signal:e}),this.#Bi=n,t.appendChild(n);const i=document.createElement("div");i.className=Ze("gift-sheet"),i.setAttribute("role","group");const r=this.#ne.title??"Other gifts";i.setAttribute("aria-label",r),i.hidden=!0,this.#Di=i;const o=document.createElement("div");o.className=Ze("gift-sheet-header");const s=document.createElement("button");s.type="button",s.className=Ze("gift-sheet-close"),s.setAttribute("aria-label",this.#ne.closeLabel??"Close other gifts"),s.textContent="×",s.addEventListener("click",()=>this.close(),{signal:e}),o.appendChild(s);const a=document.createElement("h3");a.className=Ze("gift-sheet-title"),a.textContent=r,o.appendChild(a),i.appendChild(o);const l=document.createElement("div");l.className=Ze("gift-sheet-list"),l.setAttribute("role","radiogroup"),l.setAttribute("aria-label",r),this.#Hi=l,i.appendChild(l);const c=document.createElement("button");c.type="button",c.className=`${Ze("reward-cta-primary")} ${Ze("gift-sheet-cta")}`,c.textContent=lt,c.disabled=!0,c.setAttribute("aria-disabled","true"),c.addEventListener("click",()=>this.#Qi(),{signal:e}),i.appendChild(c);const d=this.#ne.footer();return d&&i.appendChild(d),i.addEventListener("keydown",e=>{if("Escape"===e.key)return e.preventDefault(),e.stopPropagation(),void this.close();"Tab"===e.key&&(e.preventDefault(),e.stopPropagation(),this.#Xi(e.shiftKey))},{signal:e}),t.appendChild(i),this.renderList(),t}#Xi(e){const t=this.#Di;if(!t)return;const n=Array.from(t.querySelectorAll(Ye)).filter(e=>null===e.closest("[hidden]")&&null===e.closest('[aria-hidden="true"]'));if(0===n.length)return;const i=n.findIndex(e=>e===document.activeElement),r=e?i<=0?n.length-1:i-1:i>=n.length-1?0:i+1;n[r]?.focus()}renderList(){this.#Hi&&(this.#Zi=null,this.#Ji(),this.#er())}#tr(){const e=this.#ne.listed();return 0===this.#Wi.length?[...e]:e.filter(e=>wn(this.#ne.offers[e]?.category)===this.#ji)}#er(){const e=this.#Hi;if(!e)return;e.textContent="";const t=this.#tr();for(const n of t){const t=this.#ne.offers[n];t&&e.appendChild(this.#nr(t,n))}const n=this.#Zi;null!==n&&t.includes(n)?this.#ir(n):(this.#Zi=null,this.#rr()),this.#Mn()}#Mn(){this.#hn.clear();const e=this.#Hi;if(this.#zi&&e)for(const t of Array.from(e.children)){const e=Number(t.dataset.offerIndex),n=this.#ne.offers[e];n&&this.#hn.register(t,n.id,()=>this.#ne.onShown(e))}}#Ji(){const e=this.#Di,t=this.#Hi;if(!e||!t)return;const{offers:n,listed:i}=this.#ne,r=function(e){const t=new Map;for(const n of e){const e=wn(n?.category);t.set(e,(t.get(e)??0)+1)}let n=0;for(const e of t.values())e>=2&&(n+=1);return n<2?[]:fn.filter(e=>t.has(e))}(i().map(e=>n[e]));if(this.#Wi=r,0===r.length)return this.#Ki?.remove(),this.#Ki=null,void(this.#Gi&&(this.#Gi.replaceWith(t),this.#Gi=null));const o=this.#ji;if(void 0!==o&&r.includes(o)||(this.#ji=r[0]),!this.#Gi){const e=document.createElement("div");e.className=Ze("gift-sheet-panel"),e.id=`${this.#Yi}-panel`,e.setAttribute("role","tabpanel"),t.replaceWith(e),e.appendChild(t),this.#Gi=e}if(!this.#Ki){const e=document.createElement("div");e.className=Ze("gift-sheet-tabs"),e.setAttribute("role","tablist"),e.setAttribute("aria-label","Gift categories"),this.#Gi.before(e),this.#Ki=e}const s=this.#Ki;s.textContent="",r.forEach((e,t)=>{s.appendChild(this.#or(e,t))}),this.#sr()}#or(e,t){const{signal:n}=this.#ne,i=document.createElement("button");return i.type="button",i.className=Ze("gift-sheet-tab"),i.id=`${this.#Yi}-tab-${t}`,i.setAttribute("role","tab"),i.setAttribute("aria-controls",`${this.#Yi}-panel`),i.textContent=e,i.addEventListener("click",()=>this.#ar(e),{signal:n}),i.addEventListener("keydown",e=>this.#lr(e,t),{signal:n}),i}#sr(){const e=Array.from(this.#Ki?.children??[]),t=this.#ji,n=void 0===t?-1:this.#Wi.indexOf(t);e.forEach((e,t)=>{if(!(e instanceof HTMLElement))return;const i=t===n;e.setAttribute("aria-selected",String(i)),e.tabIndex=i?0:-1,i&&this.#Gi?.setAttribute("aria-labelledby",e.id)})}#ar(e){this.#Wi.includes(e)&&e!==this.#ji&&(this.#ji=e,this.#sr(),this.#er())}#lr(e,t){const n=this.#Wi.length;if(0===n)return;let i;switch(e.key){case"ArrowRight":i=(t+1)%n;break;case"ArrowLeft":i=(t-1+n)%n;break;case"Home":i=0;break;case"End":i=n-1;break;default:return}e.preventDefault(),e.stopPropagation();const r=this.#Wi[i];if(void 0===r)return;this.#ar(r);const o=this.#Ki?.children[i];o instanceof HTMLElement&&o.focus()}#rr(){this.#ne.onPick?.(null);const e=this.#cr();e&&(e.textContent=lt,e.disabled=!0,e.setAttribute("aria-disabled","true"))}#nr(e,t){const{signal:n}=this.#ne,i=document.createElement("button");if(i.type="button",i.className=Ze("gift-card"),i.setAttribute("role","radio"),i.setAttribute("aria-checked","false"),i.setAttribute("aria-label",(this.#ne.cardLabel??mt)(e)),i.dataset.offerIndex=String(t),i.tabIndex=0===this.#Hi?.childElementCount?0:-1,this.#ne.cardBody)this.#ne.cardBody(i,e);else{i.appendChild(xn(e,"gift-card-icon"));const t=document.createElement("span");t.className=Ze("gift-card-label"),xt(t,pt(e).primary,Ze("gift-em")),i.appendChild(t)}return i.addEventListener("click",()=>this.#ir(t),{signal:n}),i.addEventListener("keydown",e=>this.#dr(e,i),{signal:n}),i}#dr(e,t){const n=Array.from(this.#Hi?.children??[]).filter(e=>e instanceof HTMLElement);if(0===n.length)return;const i=n.indexOf(t);let r=null;switch(e.key){case"ArrowDown":case"ArrowRight":r=(i+1)%n.length;break;case"ArrowUp":case"ArrowLeft":r=(i-1+n.length)%n.length;break;case"Home":r=0;break;case"End":r=n.length-1;break;default:return}e.preventDefault(),e.stopPropagation();const o=n[r];if(!o)return;const s=Number(o.dataset.offerIndex);Number.isInteger(s)&&this.#ir(s),o.focus()}#ir(e){const t=this.#Hi;if(!t)return;this.#Zi=e;for(const n of Array.from(t.children)){if(!(n instanceof HTMLElement))continue;const t=n.dataset.offerIndex===String(e);n.setAttribute("aria-checked",String(t)),n.tabIndex=t?0:-1}const n=this.#ne.offers[e];this.#ne.onPick?.(n??null);const i=this.#cr();i&&n&&(i.textContent=(this.#ne.ctaLabel??gt)(n),!1!==this.#ne.claimEnabled&&(i.disabled=!1,i.removeAttribute("aria-disabled")))}#cr(){const e=this.#Di?.querySelector(`.${Ze("gift-sheet-cta")}`);return e instanceof HTMLButtonElement?e:null}#Qi(){const e=this.#Hi?.querySelector('[aria-checked="true"]');if(!(e instanceof HTMLElement))return;const t=Number(e.dataset.offerIndex);Number.isInteger(t)&&this.#ne.onCommit(t)}open(e){const t=this.#Di;if(!t||this.#dt)return;this.#Qe(),this.#Vi=e??null,t.hidden=!1,t.removeAttribute("aria-hidden"),this.#Bi?.classList.add(Ze("gift-scrim--open")),t.classList.add(Ze("gift-sheet--open")),this.#zi=!0,this.#Mn(),this.#hr(),this.#qi=setTimeout(()=>{this.#qi=null,this.#dt||this.#ne.impressions.recheck()},300);const n=this.#Hi,i=n?.querySelector('[aria-checked="true"]')??n?.firstElementChild;i instanceof HTMLElement&&i.focus()}close(){const e=this.#Di;e&&!e.hidden&&(this.#zi=!1,this.#hn.clear(),this.#hr(),e.classList.remove(Ze("gift-sheet--open")),this.#Bi?.classList.remove(Ze("gift-scrim--open")),e.setAttribute("aria-hidden","true"),this.#Vi?.focus(),this.#Vi=null,this.#Qe(),yn()?e.hidden=!0:this.#He=setTimeout(()=>{this.#He=null,this.#dt||(e.hidden=!0)},300))}#Qe(){null!==this.#He&&(clearTimeout(this.#He),this.#He=null)}#hr(){null!==this.#qi&&(clearTimeout(this.#qi),this.#qi=null)}destroy(){this.#dt=!0,this.#zi=!1,this.#hn.clear(),this.#hr(),this.#Qe(),this.#Di=null,this.#Bi=null,this.#Hi=null,this.#Ki=null,this.#Gi=null,this.#Vi=null}}const $n=e=>void 0!==e;class Cn{#Yt;#ne;#ur=new xe;#pr=new pn;#fr=null;#gr=null;#mr=null;#dt=!1;#br=new AbortController;#wr;#yr=0;#Ct;#dn;#xr;constructor(e,t={}){this.#Yt=e,this.#ne=t,this.#dn=void 0===t.impressions,this.#Ct=t.impressions??new tt,this.#xr=new nt(this.#Ct),this.#wr=e.slice(0,3).map((e,t)=>t)}on(e,t){return this.#ur.on(e,t)}getTotalOffers(){return this.#Yt.length}getCurrentIndex(){return this.#yr}getSelectedOffer(){return this.#Yt[this.#yr]}hasMoreGifts(){return this.#Yt.length>this.#wr.length}renderHero(){return this.#pr.render(this.#wr.map(e=>this.#Yt[e]).filter($n))}render(){const e=document.createElement("div");e.className=Ze("gift"),this.#fr=e;const t=document.createElement("div");return t.className=Ze("gift-rows"),t.setAttribute("role","radiogroup"),t.setAttribute("aria-label",ct),this.#gr=t,e.appendChild(t),this.#vr(!0),this.hasMoreGifts()&&e.appendChild(this.#kr()),this.#$r(),this.#pr.play(),e}#vr(e=!1){const t=this.#gr;t&&(t.textContent="",this.#xr.clear(),this.#wr.forEach((n,i)=>{const r=this.#Yt[n];if(!r)return;const o=this.#Cr(r,n,i,e);t.appendChild(o),this.#Er(o,n)}))}#Cr(e,t,n,i=!1){const r=document.createElement("button");r.type="button",r.className=i?`${Ze("gift-row")} ${Ze("gift-row--intro")}`:Ze("gift-row"),r.setAttribute("role","radio");const o=t===this.#yr;r.setAttribute("aria-checked",String(o)),r.tabIndex=o?0:-1,r.setAttribute("aria-label",mt(e)),r.dataset.offerIndex=String(t),r.appendChild(xn(e,"gift-row-icon"));const s=document.createElement("span");s.className=Ze("gift-row-text");const{primary:a,secondary:l}=pt(e),c=document.createElement("span");if(c.className=Ze("gift-row-primary"),xt(c,a,Ze("gift-em")),s.appendChild(c),l){const e=document.createElement("small");e.className=Ze("gift-row-secondary"),e.textContent=l,s.appendChild(e)}r.appendChild(s);const d=document.createElement("span");return d.className=Ze("gift-row-radio"),d.setAttribute("aria-hidden","true"),r.appendChild(d),r.addEventListener("click",()=>this.selectOffer(t),{signal:this.#br.signal}),r.addEventListener("keydown",e=>this.#Ir(e,n),{signal:this.#br.signal}),r}#Ir(e,t){const n=this.#wr.length;if(0===n)return;let i=null;switch(e.key){case"ArrowDown":case"ArrowRight":i=(t+1)%n;break;case"ArrowUp":case"ArrowLeft":i=(t-1+n)%n;break;case"Home":i=0;break;case"End":i=n-1;break;default:return}e.preventDefault();const r=this.#wr[i];void 0!==r&&(this.selectOffer(r),this.#Tr(i))}#Tr(e){const t=this.#gr?.children[e];t instanceof HTMLElement&&t.focus()}selectOffer(e){!Number.isInteger(e)||e<0||e>=this.#Yt.length?u.warn("Gift selection ignored — index out of range",{index:e}):e===this.#yr&&this.#wr.includes(e)||(this.#wr.includes(e)||this.#Sr(e),this.#yr=e,this.#Ar(),this.#$r())}next(){0!==this.#Yt.length&&this.selectOffer((this.#yr+1)%this.#Yt.length)}#Sr(e){this.#wr.length<3?this.#wr.push(e):this.#wr[this.#wr.length-1]=e,this.#vr(),this.#mr?.renderList(),this.#pr.updateTiles(this.#wr.map(e=>this.#Yt[e]).filter($n))}#Ar(){const e=this.#gr?.children;e&&this.#wr.forEach((t,n)=>{const i=e[n];if(!(i instanceof HTMLElement))return;const r=t===this.#yr;i.setAttribute("aria-checked",String(r)),i.tabIndex=r?0:-1})}#$r(){const e=this.getSelectedOffer();e&&this.#ur.emit("offerSelect",{offer:e,index:this.#yr})}#Er(e,t){const n=this.#Yt[t];n&&this.#xr.register(e,n.id,()=>this.#Lr(t))}#Lr(e){const t=this.#Yt[e];t&&this.#ur.emit("offerView",{offer:t,index:e})}claimSelected(){if(!1===this.#ne.claimEnabled)return void u.warn("Claim requested while claiming is disabled — ignoring");const e=this.getSelectedOffer();e?this.#ur.emit("offerClaim",{offer:e,index:this.#yr}):u.warn("Claim requested with no selected gift — ignoring")}#kr(){const e=new kn({offers:this.#Yt,listed:()=>this.#Yt.map((e,t)=>t).filter(e=>!this.#wr.includes(e)),claimEnabled:!1!==this.#ne.claimEnabled,footer:()=>{const e=w(this.#ne.trustText)??rn,t=document.createElement("p");return t.className=Ze("gift-sheet-fine"),t.textContent=e,t},onCommit:e=>{this.selectOffer(e),this.closeSheet(),this.claimSelected()},impressions:this.#Ct,onShown:e=>this.#Lr(e),signal:this.#br.signal});return this.#mr=e,e.render()}openSheet(e){this.#dt||this.#mr?.open(e)}closeSheet(){this.#mr?.close()}destroy(){this.#dt=!0,this.#mr?.destroy(),this.#xr.clear(),this.#dn&&this.#Ct.destroy(),this.#br.abort(),this.#pr.destroy(),this.#ur.removeAllListeners(),this.#fr?.remove(),this.#fr=null,this.#gr=null,this.#mr=null}}function En(e={}){const t=document.createElement("p");return t.className=Ze("gift-terms"),t.appendChild(document.createTextNode("By proceeding you agree to our ")),t.appendChild(Tn(e)),t}function In(e,t){const n=Tn({...void 0!==t&&{termsUrl:t}}),i=e.querySelector(`.${Ze("gift-terms-link")}`);i?i.replaceWith(n):e.appendChild(n)}function Tn({onOpen:e,termsUrl:t}){const n=Z(t);let i;if(n){const e=document.createElement("a");e.href=n,e.target="_blank",e.rel="noopener noreferrer",i=e}else if(e){const t=document.createElement("button");t.type="button",t.addEventListener("click",()=>{try{e()}catch(e){u.error("Terms line opener failed",e)}}),i=t}else i=document.createElement("span");return i.className=Ze("gift-terms-link"),i.textContent="offer terms",i}let Sn=0;const An=(e,t)=>!!e&&!!t&&e.toLowerCase()===t.toLowerCase();class Ln{#Yt;#ne;#ur=new xe;#br=new AbortController;#fr=null;#Nr=null;#gr=null;#mr=null;#dt=!1;#wr;#yr=0;#Ct;#dn;#xr;#Rr=void 0;#Or=null;#Ur=new Set;#Mr=new Set;constructor(e,t={}){this.#Yt=e,this.#ne=t,this.#dn=void 0===t.impressions,this.#Ct=t.impressions??new tt,this.#xr=new nt(this.#Ct),this.#wr=e.slice(0,3).map((e,t)=>t)}on(e,t){return this.#ur.on(e,t)}getTotalOffers(){return this.#Yt.length}getCurrentIndex(){return this.#yr}getSelectedOffer(){return this.#Yt[this.#yr]}hasMoreGifts(){return this.#Yt.length>this.#wr.length}renderHero(){try{const e=Z(this.#ne.hostIconUrl);if(!e)return;const t=document.createElement("div");t.className=Ze("gift-list-presents");const n=document.createElement("img");n.className=Ze("gift-list-presents-icon"),n.alt=w(this.#ne.hostName)??"",n.src=e,n.onerror=()=>t.remove(),t.appendChild(n);const i=document.createElement("span");return i.textContent="Presents",t.appendChild(i),t}catch(e){return void u.error("Gift list presents row failed to render",e)}}render(){const e=document.createElement("div");e.className=Ze("gift-list"),this.#fr=e;const t=document.createElement("div");t.className=Ze("gift-list-art"),t.setAttribute("aria-hidden","true"),t.hidden=!0,this.#Nr=t,e.appendChild(t);const n=document.createElement("div");if(n.className=Ze("gift-list-rows"),n.setAttribute("role","radiogroup"),n.setAttribute("aria-label",ct),this.#gr=n,e.appendChild(n),this.#vr(!0),this.#Fr(!0),this.hasMoreGifts()){const t=document.createElement("button");t.type="button",t.className=Ze("gift-list-more"),t.textContent=dt,t.addEventListener("click",()=>this.openSheet(t),{signal:this.#br.signal}),e.appendChild(t),e.appendChild(this.#kr())}return this.#$r(),e}#vr(e=!1){const t=this.#gr;t&&(t.textContent="",this.#xr.clear(),this.#wr.forEach((n,i)=>{const r=this.#Yt[n];if(!r)return;const o=this.#Cr(r,n,i,e);t.appendChild(o),this.#Er(o,n)}))}#Cr(e,t,n,i){const r=document.createElement("button");r.type="button",r.className=i?`${Ze("gift-list-row")} ${Ze("gift-list-row--intro")}`:Ze("gift-list-row"),r.setAttribute("role","radio");const o=t===this.#yr;r.setAttribute("aria-checked",String(o)),r.tabIndex=o?0:-1,r.setAttribute("aria-label",bt(e)),r.dataset.offerIndex=String(t),r.appendChild(xn(e,"gift-list-logo"));const{brand:s,perk:a}=ft(e),l=document.createElement("span");l.className=Ze("gift-list-text");const c=document.createElement("span");if(c.className=Ze("gift-list-name"),c.textContent=s,l.appendChild(c),a){const e=document.createElement("span");e.className=Ze("gift-list-perk"),$t(e,a,Ze("gift-list-em")),l.appendChild(e)}r.appendChild(l);const d=document.createElement("span");d.className=Ze("gift-list-radio"),d.setAttribute("aria-hidden","true"),d.innerHTML='<svg viewBox="0 0 20 20" width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="0.5" y="0.5" width="19" height="19" rx="9.5" stroke="currentColor"/><circle cx="10" cy="10" r="6.4209" fill="currentColor"/></svg>',r.appendChild(d);const h=w(e.description);if(h&&!An(h,a)&&!An(h,s)){const e=document.createElement("span");e.className=Ze("gift-list-desc"),Sn+=1,e.id=Ze(`gift-list-desc-${Sn}`),e.textContent=h,e.hidden=!o,r.appendChild(e),o&&r.setAttribute("aria-describedby",e.id)}return r.addEventListener("click",()=>this.selectOffer(t),{signal:this.#br.signal}),r.addEventListener("keydown",e=>this.#Ir(e,n),{signal:this.#br.signal}),r}#Ir(e,t){const n=this.#wr.length;if(0===n)return;let i=null;switch(e.key){case"ArrowDown":case"ArrowRight":i=(t+1)%n;break;case"ArrowUp":case"ArrowLeft":i=(t-1+n)%n;break;case"Home":i=0;break;case"End":i=n-1;break;default:return}e.preventDefault();const r=this.#wr[i];if(void 0===r)return;this.selectOffer(r);const o=this.#gr?.children[i];o instanceof HTMLElement&&o.focus()}selectOffer(e){this.#dt||(!Number.isInteger(e)||e<0||e>=this.#Yt.length?u.warn("Gift selection ignored — index out of range",{index:e}):e===this.#yr&&this.#wr.includes(e)||(this.#wr.includes(e)||this.#Sr(e),this.#yr=e,this.#Ar(),this.#Fr(!1),this.#$r()))}next(){0!==this.#Yt.length&&this.selectOffer((this.#yr+1)%this.#Yt.length)}#Sr(e){this.#wr.length<3?this.#wr.push(e):this.#wr[this.#wr.length-1]=e,this.#vr(),this.#mr?.renderList()}#Ar(){const e=this.#gr?.children;e&&this.#wr.forEach((t,n)=>{const i=e[n];if(!(i instanceof HTMLElement))return;const r=t===this.#yr;i.setAttribute("aria-checked",String(r)),i.tabIndex=r?0:-1;const o=i.querySelector(`.${Ze("gift-list-desc")}`);o&&(o.hidden=!r,r?i.setAttribute("aria-describedby",o.id):i.removeAttribute("aria-describedby"))})}#$r(){const e=this.getSelectedOffer();e&&this.#ur.emit("offerSelect",{offer:e,index:this.#yr})}#Er(e,t){const n=this.#Yt[t];n&&this.#xr.register(e,n.id,()=>this.#Lr(t))}#Lr(e){const t=this.#Yt[e];t&&this.#ur.emit("offerView",{offer:t,index:e})}claimSelected(){if(!1===this.#ne.claimEnabled)return void u.warn("Claim requested while claiming is disabled — ignoring");const e=this.getSelectedOffer();e?this.#ur.emit("offerClaim",{offer:e,index:this.#yr}):u.warn("Claim requested with no selected gift — ignoring")}#_r(e){if(!e)return null;for(const t of[e.heroImageUrl,e.imageUrl]){const e=Z(t);if(e&&!this.#Ur.has(e))return{kind:"image",src:e}}const t=Z(e.logoUrl);return t&&!this.#Ur.has(t)?{kind:"logo",src:t}:null}#Fr(e){const t=this.#Nr;if(t)try{const n=this.#_r(this.getSelectedOffer()),i=n?`${n.kind}:${n.src}`:null;if(i===this.#Rr)return;if(this.#Rr=i,this.#zr(t),!n)return void(t.querySelector(`.${Ze("gift-list-art-layer--out")}`)||(t.hidden=!0));t.hidden=!1;const r=document.createElement("span");r.className=`${Ze("gift-list-art-layer")} ${Ze(e?"gift-list-art-layer--intro":"gift-list-art-layer--in")}`;const o=document.createElement("img");if(o.alt="",o.src=n.src,o.onerror=()=>{this.#Ur.add(n.src),this.#Rr===i&&(this.#Rr=void 0,this.#Fr(!1))},"image"===n.kind)o.className=Ze("gift-list-art-image"),r.appendChild(o);else{const e=document.createElement("span");e.className=Ze("gift-list-art-logo"),e.appendChild(o),r.appendChild(e)}t.appendChild(r)}catch(e){u.error("Gift list artwork failed to render",e)}}#zr(e){const t=Array.from(e.children).filter(e=>e instanceof HTMLElement&&!e.classList.contains(Ze("gift-list-art-layer--out")));if(0!==t.length)if(yn())for(const e of t)e.remove();else for(const n of t){n.classList.remove(Ze("gift-list-art-layer--intro"),Ze("gift-list-art-layer--in")),n.classList.add(Ze("gift-list-art-layer--out"));const t=setTimeout(()=>{this.#Mr.delete(t),n.remove(),null===this.#Rr&&0===e.childElementCount&&(e.hidden=!0)},200);this.#Mr.add(t)}}#kr(){const e=new kn({offers:this.#Yt,listed:()=>this.#Yt.map((e,t)=>t).filter(e=>!this.#wr.includes(e)),claimEnabled:!1!==this.#ne.claimEnabled,footer:()=>(this.#Or=En(),this.#Or),onPick:e=>{this.#Or&&In(this.#Or,e?.termsUrl)},onCommit:e=>{this.selectOffer(e),this.closeSheet(),this.claimSelected()},impressions:this.#Ct,onShown:e=>this.#Lr(e),signal:this.#br.signal});return this.#mr=e,e.render()}openSheet(e){this.#dt||this.#mr?.open(e)}closeSheet(){this.#mr?.close()}destroy(){this.#dt=!0,this.#mr?.destroy(),this.#xr.clear(),this.#dn&&this.#Ct.destroy(),this.#br.abort();for(const e of this.#Mr)clearTimeout(e);this.#Mr.clear(),this.#ur.removeAllListeners(),this.#fr?.remove(),this.#fr=null,this.#Nr=null,this.#gr=null,this.#mr=null}}const Nn="Continue";let Rn=0;function On(){return Rn+=1,`encore-unwrap-art-${Rn}`}const Un='<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" overflow="visible" ';function Mn(){const e=On();return`${Un}viewBox="0 0 200 200"><defs><linearGradient id="${e}-l" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#F8DFA8"/><stop offset="1" stop-color="#F6B96A"/></linearGradient><linearGradient id="${e}-r" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#FAEBC0"/><stop offset="1" stop-color="#F7C882"/></linearGradient><linearGradient id="${e}-t" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#FCF3D6"/><stop offset="1" stop-color="#F6DB99"/></linearGradient><linearGradient id="${e}-b" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#F7A21A"/><stop offset="1" stop-color="#F08400"/></linearGradient></defs><g stroke-linejoin="round" stroke-width="3"><ellipse cx="100" cy="182" rx="62" ry="9" fill="#000" fill-opacity="0.06" stroke="none"/><path d="M32 90L100 116V176L32 150Z" fill="url(#${e}-l)" stroke="#F4BD72"/><path d="M100 116L168 90V150L100 176Z" fill="url(#${e}-r)" stroke="#F6C880"/><path d="M57 99.5L71 104.9V164.9L57 159.5Z" fill="url(#${e}-b)" stroke="none"/><path d="M129 104.9L143 99.5V159.5L129 164.9Z" fill="url(#${e}-b)" stroke="none"/><path d="M26 70L100 98V118L26 90Z" fill="#F6D08F" stroke="#F4C47E"/><path d="M100 98L174 70V90L100 118Z" fill="#F9DFA6" stroke="#F6D08F"/><path d="M57 81.7L71 87V107L57 101.7Z" fill="#F28A00" stroke="none"/><path d="M129 87L143 81.7V101.7L129 107Z" fill="#F59400" stroke="none"/><path d="M26 70L100 42L174 70L100 98Z" fill="url(#${e}-t)" stroke="#F8E3B0"/><path d="M57 81.7L71 87L145 59L131 53.7Z" fill="#F79A0C" stroke="none"/><path d="M143 81.7L129 87L55 59L69 53.7Z" fill="#F9A41E" stroke="none"/></g><path d="M100 64C86 42 56 22 46 38C38 52 62 70 100 64Z" fill="#F58A00"/><path d="M96 61C82 46 62 34 56 42C52 50 70 62 96 61Z" fill="#E25A00"/><path d="M100 64C114 42 144 22 154 38C162 52 138 70 100 64Z" fill="#F79200"/><path d="M104 61C118 46 138 34 144 42C148 50 130 62 104 61Z" fill="#E86400"/><rect x="90" y="53" width="20" height="17" rx="6" fill="#F8980C"/></svg>`}const Fn=`${Un}width="20" height="20" viewBox="0 0 20 20" fill="none"><path d="M10 1.875C8.39303 1.875 6.82214 2.35152 5.48599 3.24431C4.14984 4.1371 3.10844 5.40605 2.49348 6.8907C1.87852 8.37535 1.71761 10.009 2.03112 11.5851C2.34462 13.1612 3.11846 14.6089 4.25476 15.7452C5.39106 16.8815 6.8388 17.6554 8.41489 17.9689C9.99099 18.2824 11.6247 18.1215 13.1093 17.5065C14.594 16.8916 15.8629 15.8502 16.7557 14.514C17.6485 13.1779 18.125 11.607 18.125 10C18.1227 7.84581 17.266 5.78051 15.7427 4.25727C14.2195 2.73403 12.1542 1.87727 10 1.875ZM13.5672 8.56719L9.19219 12.9422C9.13414 13.0003 9.06521 13.0464 8.98934 13.0779C8.91346 13.1093 8.83213 13.1255 8.75 13.1255C8.66787 13.1255 8.58654 13.1093 8.51066 13.0779C8.43479 13.0464 8.36586 13.0003 8.30781 12.9422L6.43281 11.0672C6.31554 10.9499 6.24965 10.7909 6.24965 10.625C6.24965 10.4591 6.31554 10.3001 6.43281 10.1828C6.55009 10.0655 6.70915 9.99965 6.875 9.99965C7.04085 9.99965 7.19991 10.0655 7.31719 10.1828L8.75 11.6164L12.6828 7.68281C12.7409 7.62474 12.8098 7.57868 12.8857 7.54725C12.9616 7.51583 13.0429 7.49965 13.125 7.49965C13.2071 7.49965 13.2884 7.51583 13.3643 7.54725C13.4402 7.57868 13.5091 7.62474 13.5672 7.68281C13.6253 7.74088 13.6713 7.80982 13.7027 7.88569C13.7342 7.96156 13.7503 8.04288 13.7503 8.125C13.7503 8.20712 13.7342 8.28844 13.7027 8.36431C13.6713 8.44018 13.6253 8.50912 13.5672 8.56719Z" fill="#17171A"/></svg>`,_n=`${Un}width="20" height="20" viewBox="0 0 20 20" fill="none"><rect x="0.5" y="0.5" width="19" height="19" rx="9.5" stroke="#FF8800"/><circle cx="10" cy="10" r="6.4209" fill="#FF8800"/></svg>`,zn=`${Un}width="20" height="20" viewBox="0 0 20 20" fill="none"><path d="M13.1625 15.5876C13.3386 15.7637 13.4375 16.0026 13.4375 16.2516C13.4375 16.5007 13.3386 16.7396 13.1625 16.9157C12.9863 17.0918 12.7475 17.1908 12.4984 17.1908C12.2493 17.1908 12.0105 17.0918 11.8343 16.9157L5.58433 10.6657C5.49693 10.5786 5.42759 10.4751 5.38027 10.3611C5.33295 10.2472 5.30859 10.125 5.30859 10.0016C5.30859 9.87824 5.33295 9.75606 5.38027 9.64211C5.42759 9.52815 5.49693 9.42466 5.58433 9.33756L11.8343 3.08756C12.0105 2.91144 12.2493 2.8125 12.4984 2.8125C12.7475 2.8125 12.9863 2.91144 13.1625 3.08756C13.3386 3.26368 13.4375 3.50255 13.4375 3.75163C13.4375 4.0007 13.3386 4.23957 13.1625 4.41569L7.5773 10.0008L13.1625 15.5876Z" fill="currentColor"/></svg>`,Pn=Ze("unwrap-ready-title");class Dn{#Yt;#ne;#ur=new xe;#br=new AbortController;#fr=null;#Pr=null;#Dr=null;#pr=null;#Br=null;#gr=null;#mr=null;#Hr=null;#Vr=null;#qr=null;#Kr=null;#Gr=null;#Wr=null;#wr;#yr=0;#Ct;#dn;#xr;#jr="pick";#Zr=null;#Yr=null;#Ai=null;#Qr=null;#Xr=null;#Jr=!1;#dt=!1;constructor(e,t={}){this.#Yt=e,this.#ne=t,this.#dn=void 0===t.impressions,this.#Ct=t.impressions??new tt,this.#xr=new nt(this.#Ct),this.#wr=e.slice(0,3).map((e,t)=>t)}on(e,t){return this.#ur.on(e,t)}getTotalOffers(){return this.#Yt.length}getCurrentIndex(){return this.#yr}getSelectedOffer(){return this.#Yt[this.#yr]}hasMoreGifts(){return this.#Yt.length>this.#wr.length}getScreen(){return this.#jr}renderHero(){const e=document.createElement("div");e.className=Ze("unwrap-hero"),e.setAttribute("aria-hidden","true");const t=document.createElement("div");return t.className=Ze("unwrap-hero-box"),t.innerHTML=Mn(),e.appendChild(t),this.#pr=e,e}render(){const e=document.createElement("div");e.className=Ze("unwrap-body"),this.#Br=e;const t=document.createElement("div");if(t.className=Ze("unwrap-rows"),t.setAttribute("role","radiogroup"),t.setAttribute("aria-label",ct),this.#gr=t,e.appendChild(t),this.#vr(),this.hasMoreGifts()){const t=document.createElement("button");t.type="button",t.className=Ze("unwrap-more"),t.textContent=dt,t.addEventListener("click",()=>this.openSheet(t),{signal:this.#br.signal}),e.appendChild(t),e.appendChild(this.#kr())}return this.#$r(),e}compose(e,t={}){this.#Zr=t.setLabelledBy??null;const n=document.createElement("div");n.className=Ze("unwrap"),this.#fr=n;const i=document.createElement("div");return i.className=`${Ze("unwrap-screen")} ${Ze("unwrap-screen--pick")}`,i.appendChild(e),this.#Pr=i,n.appendChild(i),n.appendChild(this.#eo()),this.#to(),n}#vr(){const e=this.#gr;e&&(e.textContent="",this.#xr.clear(),this.#wr.forEach((t,n)=>{const i=this.#Yt[t];if(!i)return;const r=t===this.#yr,o=document.createElement("button");o.type="button",o.className=Ze("unwrap-row"),o.setAttribute("role","radio"),o.setAttribute("aria-checked",String(r)),o.tabIndex=r?0:-1,o.setAttribute("aria-label",bt(i)),o.dataset.offerIndex=String(t),Bn(o,i),o.addEventListener("click",()=>this.selectOffer(t),{signal:this.#br.signal}),o.addEventListener("keydown",e=>this.#Ir(e,n),{signal:this.#br.signal}),e.appendChild(o),this.#Er(o,t)}))}#Ir(e,t){const n=function(e,t,n){if(0===n||t<0)return null;switch(e){case"ArrowDown":case"ArrowRight":return(t+1)%n;case"ArrowUp":case"ArrowLeft":return(t-1+n)%n;case"Home":return 0;case"End":return n-1;default:return null}}(e.key,t,this.#wr.length);if(null===n)return;e.preventDefault();const i=this.#wr[n];if(void 0===i)return;this.selectOffer(i);const r=this.#gr?.children[n];r instanceof HTMLElement&&r.focus()}selectOffer(e){!Number.isInteger(e)||e<0||e>=this.#Yt.length?u.warn("Gift selection ignored — index out of range",{index:e}):e===this.#yr&&this.#wr.includes(e)||(this.#wr.includes(e)||this.#Sr(e),this.#yr=e,this.#Ar(),this.#$r())}next(){0!==this.#Yt.length&&this.selectOffer((this.#yr+1)%this.#Yt.length)}#Sr(e){this.#wr.length<3?this.#wr.push(e):this.#wr[this.#wr.length-1]=e,this.#vr(),this.#mr?.renderList()}#Ar(){const e=this.#gr?.children;e&&this.#wr.forEach((t,n)=>{const i=e[n];if(!(i instanceof HTMLElement))return;const r=t===this.#yr;i.setAttribute("aria-checked",String(r)),i.tabIndex=r?0:-1})}#$r(){const e=this.getSelectedOffer();e&&this.#ur.emit("offerSelect",{offer:e,index:this.#yr})}#Er(e,t){const n=this.#Yt[t];n&&this.#xr.register(e,n.id,()=>this.#Lr(t))}#Lr(e){const t=this.#Yt[e];t&&this.#ur.emit("offerView",{offer:t,index:e})}claimSelected(){if(!1===this.#ne.claimEnabled)return void u.warn("Claim requested while claiming is disabled — ignoring");const e=this.getSelectedOffer();e?this.#ur.emit("offerClaim",{offer:e,index:this.#yr}):u.warn("Claim requested with no selected gift — ignoring")}showReady(){if(this.#dt)return;const e=this.getSelectedOffer(),t=this.#Dr,n=this.#Pr;if(!e||!t||!n)return void(t||u.warn("Gift unwrap has no ready screen — compose() was not called"));const i=document.activeElement;this.#Yr=i instanceof HTMLElement&&n.contains(i)?i:null,this.closeSheet();try{this.#no(e)}catch(e){u.debug("Gift unwrap could not fill the ready screen",e)}n.hidden=!0,t.hidden=!1,t.scrollTop=0,this.#jr="ready",this.#io(),this.#ro(Pn),this.#qr?.focus({preventScroll:!0})}showPick(){if(this.#dt)return;const e=this.#Dr,t=this.#Pr;if(!e||!t)return;e.hidden=!0,t.hidden=!1,this.#jr="pick",this.#Hr?.classList.remove(Ze("unwrap-reveal--play")),this.#ro(tn);const n=this.#Yr;this.#Yr=null;const i=n?.isConnected&&!n.closest('[aria-hidden="true"]')?n:this.#gr?.querySelector('[aria-checked="true"]');i?.focus({preventScroll:!0})}#ro(e){try{this.#Zr?.(e)}catch(e){u.debug("Gift unwrap could not relabel the dialog",e)}}#io(){const e=this.#Hr;if(!e)return;const t=Ze("unwrap-reveal--play");e.classList.remove(t),e.classList.add(t)}#eo(){const e=this.#br.signal,t=document.createElement("div");t.className=`${Ze("unwrap-screen")} ${Ze("unwrap-screen--ready")}`,t.hidden=!0,this.#Dr=t;const n=document.createElement("button");n.type="button",n.className=Ze("unwrap-back");const i=document.createElement("span");i.className=Ze("unwrap-back-icon"),i.setAttribute("aria-hidden","true"),i.innerHTML=zn,n.appendChild(i),n.appendChild(document.createTextNode("Back")),n.addEventListener("click",()=>this.showPick(),{signal:e}),t.appendChild(n);const r=document.createElement("div");r.className=Ze("unwrap-stage-frame"),r.setAttribute("aria-hidden","true");const o=document.createElement("div");o.className=Ze("unwrap-reveal"),this.#Hr=o,o.appendChild(Hn("unwrap-glow",function(){const e=On();return`${Un}width="437" height="303.092" viewBox="0 0 437 303.092" fill="none"><g filter="url(#${e})"><ellipse cx="218.5" cy="151.546" rx="104.5" ry="37.5459" fill="#016CEC"/></g><defs><filter id="${e}" x="0" y="0" width="437" height="303.092" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur stdDeviation="57" result="effect1_foregroundBlur"/></filter></defs></svg>`}())),o.appendChild(Hn("unwrap-closed",Mn()));const s=document.createElement("div");s.className=Ze("unwrap-open"),s.appendChild(Hn("unwrap-open-layer",function(){const e=On();return`${Un}viewBox="0 0 200 200"><defs><linearGradient id="${e}-in" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#C95A22"/><stop offset="1" stop-color="#EE9A4E"/></linearGradient><linearGradient id="${e}-t" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#FFD7A2"/><stop offset="1" stop-color="#FFB870"/></linearGradient></defs><ellipse cx="100" cy="190" rx="60" ry="8" fill="#000" fill-opacity="0.06"/><path d="M38 104L100 82L162 104L100 126Z" fill="url(#${e}-in)" stroke="#FFD9A0" stroke-width="3" stroke-linejoin="round"/><g transform="translate(36 12) rotate(-9 62 30)" stroke-linejoin="round"><path d="M0 20L62 42V60L0 38Z" fill="#FFB266" stroke="#FFAA5C" stroke-width="2"/><path d="M62 42L124 20V38L62 60Z" fill="#FFC27E" stroke="#FFB870" stroke-width="2"/><path d="M22 27.8L34 32V50L22 45.8Z" fill="#FF8C00"/><path d="M90 32L102 27.8V45.8L90 50Z" fill="#FF9500"/><path d="M0 20L62 0L124 20L62 42Z" fill="url(#${e}-t)" stroke="#FFD29A" stroke-width="2"/><path d="M22 27.8L34 32L96 11.3L84 7Z" fill="#FF9A10"/><path d="M102 27.8L90 32L28 11.3L40 7Z" fill="#FFA21E"/><path d="M62 14C50 -4 26 -18 18 -6C12 6 32 20 62 14Z" fill="#FE8C00"/><path d="M59 12C48 0 32 -8 27 -2C24 4 38 13 59 12Z" fill="#E15100"/><path d="M62 14C74 -4 98 -18 106 -6C112 6 92 20 62 14Z" fill="#FF9300"/><path d="M65 12C76 0 92 -8 97 -2C100 4 86 13 65 12Z" fill="#E45C00"/><rect x="54" y="5" width="16" height="14" rx="5" fill="#FF9A10"/></g></svg>`}()));const a=document.createElement("div");a.className=Ze("unwrap-logo"),this.#Vr=a,s.appendChild(a),s.appendChild(Hn("unwrap-open-layer",function(){const e=On();return`${Un}viewBox="0 0 200 200"><defs><linearGradient id="${e}-l" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#FFE3B2"/><stop offset="1" stop-color="#FFC585"/></linearGradient><linearGradient id="${e}-r" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#FFCE92"/><stop offset="1" stop-color="#FFAE68"/></linearGradient></defs><g stroke-linejoin="round"><path d="M38 104L100 126V184L38 162Z" fill="url(#${e}-l)" stroke="#FFD49C" stroke-width="3"/><path d="M100 126L162 104V162L100 184Z" fill="url(#${e}-r)" stroke="#FFC080" stroke-width="3"/><path d="M61 112.2L77 117.8V175.8L61 170.2Z" fill="#FF9900"/><path d="M123 117.8L139 112.2V170.2L123 175.8Z" fill="#FF8C00"/><path d="M38 104L100 126L162 104" fill="none" stroke="#FFEACB" stroke-width="2.5" stroke-linecap="round"/></g></svg>`}())),o.appendChild(s),r.appendChild(o),t.appendChild(r);const l=document.createElement("h2");l.className=Ze("unwrap-ready-title"),l.id=Pn,l.tabIndex=-1,l.textContent="Your gift is ready",this.#qr=l,t.appendChild(l);const c=document.createElement("p");c.className=Ze("unwrap-ready-subline"),this.#Wr=c,t.appendChild(c);const d=document.createElement("ul");d.className=Ze("unwrap-bullets"),this.#Kr=d,t.appendChild(d);const h=document.createElement("div");h.className=Ze("unwrap-actions");const u=Qt({className:Ze("unwrap-cta"),label:Nn,onActivate:()=>this.claimSelected(),enabled:!1!==this.#ne.claimEnabled,useCase:"rewardUsers",...this.#ne.claimSlot&&{slot:this.#ne.claimSlot}});return this.#Gr=u,h.appendChild(u.element),t.appendChild(h),t}#no(e){const t=this.#Vr;t&&(t.textContent="",t.appendChild(xn(e,"unwrap-logo-inner")));const n=this.#Kr;if(n){n.textContent="";for(const t of function(e){const t=[],n=ut(e);n&&t.push(n);const i=ht(e);return St(e)?(t.push(i?`${i} will ask for a card`:"You’ll be asked for a card"),t.push(i?`Cancel anytime, nothing is charged before the ${i} trial ends`:"Cancel anytime, nothing is charged before the trial ends")):t.push(i?`You’ll finish claiming on ${i}`:"You’ll finish claiming on the next screen"),t}(e)){const e=document.createElement("li");e.className=Ze("unwrap-bullet");const i=document.createElement("span");i.className=Ze("unwrap-bullet-icon"),i.setAttribute("aria-hidden","true"),i.innerHTML=Fn,e.appendChild(i);const r=document.createElement("span");r.textContent=t,e.appendChild(r),n.appendChild(e)}}this.#Wr&&(this.#Wr.textContent=function(e){const t=ht(e);return t?`Now we’ll take you to ${t}, where you can claim your offer.`:"Next, you’ll finish claiming your offer."}(e)),this.#Gr?.setLabel(function(e){const t=ht(e);return t?`Continue to ${t}`:Nn}(e))}#kr(){const e=new kn({offers:this.#Yt,listed:()=>this.#Yt.map((e,t)=>t).filter(e=>!this.#wr.includes(e)),claimEnabled:!1!==this.#ne.claimEnabled,footer:()=>null,onCommit:e=>{this.selectOffer(e),this.showReady()},impressions:this.#Ct,onShown:e=>this.#Lr(e),signal:this.#br.signal,title:"More gifts",closeLabel:"Close more gifts",cardBody:(e,t)=>Bn(e,t),cardLabel:bt,ctaLabel:()=>Nn});return this.#mr=e,e.render()}openSheet(e){this.#dt||this.#mr?.open(e)}closeSheet(){this.#mr?.close()}#to(){const e=()=>{if(this.#dt||this.#Jr)return;this.#Jr=!0,this.#oo();const e=this.#Pr;if(e)try{const t=new hn;this.#Ai=t,t.start(e)}catch(e){u.debug("Gift unwrap confetti unavailable",e)}};try{this.#Qr=requestAnimationFrame(()=>{this.#Qr=null,e()})}catch(e){u.debug("Gift unwrap could not schedule a frame for confetti",e)}try{this.#Xr=setTimeout(e,120)}catch(e){u.debug("Gift unwrap could not schedule its confetti fallback",e)}}#oo(){if(null!==this.#Qr){try{cancelAnimationFrame(this.#Qr)}catch{}this.#Qr=null}null!==this.#Xr&&(clearTimeout(this.#Xr),this.#Xr=null)}destroy(){this.#dt=!0,this.#mr?.destroy(),this.#xr.clear(),this.#dn&&this.#Ct.destroy(),this.#Gr?.destroy(),this.#oo(),this.#br.abort(),this.#Ai?.destroy(),this.#Ai=null,this.#ur.removeAllListeners(),this.#fr?.remove(),this.#pr?.remove(),this.#Br?.remove(),this.#fr=null,this.#Pr=null,this.#Dr=null,this.#pr=null,this.#Br=null,this.#gr=null,this.#mr=null,this.#Hr=null,this.#Vr=null,this.#qr=null,this.#Kr=null,this.#Gr=null,this.#Wr=null,this.#Yr=null,this.#Zr=null}}function Bn(e,t){e.appendChild(xn(t,"unwrap-row-logo"));const n=document.createElement("span");n.className=Ze("unwrap-row-text");const{brand:i,perk:r}=ft(t),o=document.createElement("span");if(o.className=Ze("unwrap-row-title"),o.textContent=i,n.appendChild(o),r){const e=document.createElement("span");e.className=Ze("unwrap-row-perk"),$t(e,r,Ze("unwrap-em")),n.appendChild(e)}e.appendChild(n);const s=document.createElement("span");s.className=Ze("unwrap-radio"),s.setAttribute("aria-hidden","true"),s.innerHTML=_n,e.appendChild(s)}function Hn(e,t){const n=document.createElement("div");return n.className=Ze(e),n.innerHTML=t,n}class Vn{#so=null;#ao=null;#lo=!1;start(e){this.#lo?u.warn("FocusDetector already active"):(this.#so=()=>{u.debug("Window focused"),e()},this.#ao=()=>{"visible"===document.visibilityState&&(u.debug("Document became visible"),e())},window.addEventListener("focus",this.#so),document.addEventListener("visibilitychange",this.#ao),this.#lo=!0,u.debug("FocusDetector started"))}stop(){this.#lo&&(this.#so&&(window.removeEventListener("focus",this.#so),this.#so=null),this.#ao&&(document.removeEventListener("visibilitychange",this.#ao),this.#ao=null),this.#lo=!1,u.debug("FocusDetector stopped"))}isActive(){return this.#lo}}const qn="user_id",Kn="user_attributes";function Gn(e){const t=e.useCase;if(void 0===t||l(t))return e;const n="string"==typeof t?s(t):void 0,{useCase:i,...r}=e;return n?{...r,useCase:n}:r}function Wn(e){const t=e?.values?.text;return!!t&&Object.keys(t).length>0}function jn(e){return"reduceChurn"===(e??"reduceChurn")}const Zn=new class{#co;#p;#f=null;#C=null;#do=null;#ho=null;#uo=null;#po=null;#fo=null;#go=new Set;#Re;#mo=null;#g=null;#bo={};#wo=!1;#yo=!1;#Ht=!0;#xo={};#vo;#ko={};#$o;#Co={};#Eo={};#Io=new Set;#To=new Set;#So=null;#Ao=null;#Lo;#No;constructor(){var e;this.#co=new p,this.#p=new g,this.#Lo=new q((e=this.#p,{read:()=>e.get(D),write:t=>e.set(D,t)})),this.#No=new q(function(){let e=null;return{read:()=>e,write:t=>{e=t}}}()),this.#Re=new xe}configure(e){const t=this.#co.configure(e);if(t){const t=this.#p.get(qn)??null;this.#Ro();const n=this.#Oo(e.userId,t),i=this.#co.getBaseURL(),r=this.#co.getAnalyticsBaseURL(),o=this.#co.getApiKey()??"";if(i){if(this.#f=new ie(o,i),r){if(this.#C=new ce(o,r,this.#p),!this.#uo){const e=new ge(o,r,this.#p);this.#uo=new pe(this.#p,()=>this.#g,e),e.flush()}this.#mo||(this.#mo=new me(o,r,this.#p),this.#mo.flush())}this.#g&&(this.#do=new b(this.#p,this.#f,this.#g),this.#fo="strict"===this.#co.getUnlockMode()?new M(this.#p,this.#f,this.#g):null,this.#ho?.destroy(),this.#ho=new A(this.#f,this.#g,this.#C??void 0)),this.#po=new Vn}if(u.info("Encore SDK initialized successfully",{version:Q}),this.#C&&this.#g){const e="undefined"!=typeof window?window.location.hostname:"unknown";this.#C.track(function(e,t,n){return{name:"sdk_initialized",distinctId:e,properties:{sdkVersion:t,appBundleId:n,platform:"web"}}}(this.#g,Q,e))}n&&this.#g&&this.#Uo(n,this.#g),this.#f&&this.#g&&this.#f.initUser(this.#g).catch(e=>{u.warn("Failed to init user on backend (non-blocking)",e),this.#Mo("api_request",e)}),this.#Fo(),this.#_o()}return t}#Ro(){const e=this.#p.get(qn);e?(this.#g=e,u.debug("Loaded existing user ID:",e)):(this.#g=S(),this.#p.set(qn,this.#g),u.debug("Generated new user ID:",this.#g));const t=this.#p.get(Kn);t&&(this.#bo=t,u.debug("Loaded user attributes"))}#Oo(e,t){if(void 0===e)return null;const n="string"==typeof e?e.trim():"";return""===n?(u.error("configure() ignored userId: it must be a non-empty string"),null):(this.#g=n,this.#p.set(qn,n),u.debug("User identified at configure:",n),t&&t!==n?t:null)}#zo(){return!!this.#co.isConfigured()||(u.error("SDK not configured. Call Encore.configure() first."),!1)}identify(e,t){if(!this.#zo())return;if(!e||"string"!=typeof e)return void u.error("identify() requires a valid user ID string");const n=this.#g;this.#g=e,this.#p.set(qn,e),t&&this.setUserAttributes(t),n!==e&&this.#Uo(n,e,t)}#Uo(e,t,n){if(u.info("User identified:",t),this.#do&&this.#do.setUserId(t),this.#ho&&this.#ho.setUserId(t),this.#fo?.setUserId(t),this.#f&&e&&this.#f.identifyUser(e,t,n?.email?{email:n.email}:void 0).catch(e=>{u.warn("Failed to identify user on backend (non-blocking)",e),this.#Mo("api_request",e)}),this.#C){const e="undefined"!=typeof window?window.location.hostname:"unknown";this.#C.track(function(e,t,n,i){return{name:"user_identified",distinctId:e,properties:{userId:t,appBundleId:n,...i&&{attributes:i}}}}(t,t,e,n))}}getCurrentUserId(){return this.#g}getAppAccountId(){return this.#g}reset(){this.#zo()&&(u.info("Resetting SDK"),this.#p.clear(),this.#g=S(),this.#p.set(qn,this.#g),this.#bo={},this.#xo={},this.#Co={},this.#ko={},this.#$o=void 0,this.#No.clear(),this.#Eo={},this.#Io.clear(),this.#So=null,this.#do&&(this.#do.clearQueue(),this.#do.destroy(),this.#f&&this.#g&&(this.#do=new b(this.#p,this.#f,this.#g))),this.#g&&this.#fo?.setUserId(this.#g),this.#ho&&(this.#ho.clearCache(),this.#ho.destroy(),this.#f&&this.#g&&(this.#ho=new A(this.#f,this.#g,this.#C??void 0))),this.#po?.isActive()&&this.#po.stop(),this.#_o(),this.#Ao?.(),this.#Ao=null,u.debug("SDK reset complete",{newUserId:this.#g}))}getVersion(){return Q}get isClaimEnabled(){return this.#Ht}set isClaimEnabled(e){this.#Ht=e,u.debug("Claim enablement changed",{isClaimEnabled:e})}isConfigured(){return this.#co.isConfigured()}getConfiguration(){return this.#co.isConfigured()?{apiKey:this.#co.getApiKey()??"",environment:this.#co.getEnvironment()??"",baseURL:this.#co.getBaseURL()??"",analyticsBaseURL:this.#co.getAnalyticsBaseURL()??"",logLevel:this.#co.getConfig()?.logLevel??"none"}:null}async getExperimentState(){return this.#co.isConfigured()&&this.#uo?this.#uo.getState():null}setLogLevel(e){u.setLogLevel(e)}async revokeEntitlements(){if(!this.#zo())return!1;if(!this.#f||!this.#g)return!1;try{return await this.#f.revokeEntitlements(this.#g)}catch(e){return u.error("Failed to revoke entitlements",e),!1}}setUserAttributes(e){this.#zo()&&(e&&"object"==typeof e?(this.#bo={...this.#bo,...e,custom:{...this.#bo.custom,...e.custom}},this.#p.set(Kn,this.#bo),u.debug("User attributes updated",this.#bo)):u.error("setUserAttributes() requires a valid UserAttributes object"))}getUserAttributes(){return{...this.#bo}}async show(e,t,n){const{result:i,...r}=await this.#Po(e,t,n);return this.#Do(i,r,t,n),i}async#Po(e,n,i){const o=S(),s=(c=n?.useCase,l(c)?c:"reduceChurn");var c;if(this.#Bo(o,s,i),!this.#zo()){const n="notConfigured";return e?.onNotGranted?.(n),e?.onError?.({code:t.INITIALIZATION_ERROR,message:"SDK not configured"}),this.#Ho("not_configured",o,s,i),{result:{status:"dismissed",reason:n},presentationId:o}}const d=function(e){return void 0===e||r.includes(e)?null:{code:t.INVALID_REQUEST,message:`useCase ${a(e)} is not a recognised Encore use case — nothing was presented. Supported values: ${r.map(e=>`'${e}'`).join(", ")}.`,details:{useCase:e}}}(n?.useCase);if(d){u.error(`[Encore SDK] Integration error: ${d.message}`),this.#Mo("configuration",new Error(d.message));const t={type:"error",error:d};return e?.onNotGranted?.(t),e?.onError?.(d),{result:{status:"dismissed",reason:t},presentationId:o}}if(this.#yo){u.warn("show() called while already presenting, ignoring duplicate request");const t="alreadyPresenting";return e?.onNotGranted?.(t),this.#Ho("already_presenting",o,s,i),{result:{status:"dismissed",reason:t},presentationId:o}}this.#yo=!0;try{const t=await this.#Vo(o,n,i),r=t.result;return"claimed"===r.status?e?.onGranted?.(void 0):"dismissed"===r.status&&r.reason&&e?.onNotGranted?.(r.reason),t}catch(n){u.error("Error during show",n),this.#Mo("present_offer_initialization",n);const i={type:"error",error:{code:t.UNKNOWN_ERROR,message:n instanceof Error?n.message:"Unknown error"}};return e?.onError?.(i.error),e?.onNotGranted?.(i),{result:{status:"dismissed",reason:i},presentationId:o,override:{notPresentedReason:"error.unknown_error"}}}finally{this.#yo=!1}}#Bo(e,t,n){var i;this.#mo&&this.#g&&this.#mo.enqueue({name:"sdk_show_entered",distinctId:this.#g,properties:{layer:"web",presentationId:(i={presentationId:e,useCase:t,...void 0!==n&&{placementId:n}}).presentationId,use_case:o(i.useCase),...$(i.placementId)}},S())}#Ho(e,t,n,i,r){var s;this.#mo&&this.#g&&this.#mo.enqueue({name:"sdk_show_aborted",distinctId:this.#g,properties:{layer:"web",reason:(s={reason:e,presentationId:t,useCase:n,...void 0!==i&&{placementId:i},...void 0!==r&&{variantId:r}}).reason,presentationId:s.presentationId,use_case:o(s.useCase),...$(s.placementId),...void 0!==s.variantId&&{variantId:s.variantId}}},S())}#Do(e,t,n,i){if(!this.#mo||!this.#g)return;const r=t.presentationId,s={...void 0!==i&&{placementId:i},presentationId:r,useCase:o(n?.useCase??"reduceChurn"),unlockMode:this.#co.getUnlockMode(),...void 0!==t.variantId&&{variantId:t.variantId},...ye(e,t.override)};this.#mo.enqueue(function(e,t){const{placementId:n,...i}=t,r=y(n);return{name:"sdk_placement_resolved",distinctId:e,properties:{...i,...r&&{placementId:r}}}}(this.#g,s),r)}async presentOffer(e,t){const n=await this.show(e,t);switch(n.status){case"unavailable":return{granted:!1,reason:"noOffersAvailable"};case"dismissed":return{granted:!1,...n.reason&&{reason:n.reason}};case"claimed":return{granted:!0}}}async redeem(e){if(!this.#zo())return{status:"dismissed",reason:{type:"error",error:{code:t.INITIALIZATION_ERROR,message:"SDK not configured"}}};const n=this.#qo(e?.placement);if(n&&"rewardUsers"!==n.transaction.useCase&&!e?.host?.name&&await this.#Ko(),!n)return u.info("redeem(): nothing pending to redeem"),{status:"unavailable"};const{transaction:i,store:r}=n;let o=null;try{this.#wo||(je({}),this.#wo=!0),o=new Qe;const n=o;return await new Promise(o=>{let s=!1;const a=e=>{s||(s=!0,o(e))};n.on("close",()=>a({status:"dismissed"})),n.on("backdropClick",()=>{n.hide(),a({status:"dismissed"})}),n.on("hide",()=>a({status:"dismissed"})),n.show(),this.#Go(n,i,e?.host,()=>{const e=this.#Wo(),o=this.#jo(i.useCase),s=i.useCase??"reduceChurn";if(this.#Zo(e=>T(e,{...o&&{variantId:o},actionType:"claimOffer",presentationId:i.id,currentState:"redemption",useCase:s})),!this.#Yo(i.offer,i.id,s,e,{campaignId:i.offer.campaignId,...i.offer.advertiserName&&{advertiserName:i.offer.advertiserName},...o&&{variantId:o},useCase:s}))return a({status:"dismissed",reason:{type:"error",error:{code:t.UNKNOWN_ERROR,message:"The advertiser could not be opened (the browser blocked the popup). The claim is still pending — call redeem() again from a user gesture."}}}),void n.hide();r.markRedeemed(i.id),a({status:"redeemed"}),n.hide()})})}catch(e){return u.error("Error during redeem",e),this.#Mo("present_offer_initialization",e),{status:"dismissed",reason:{type:"error",error:{code:t.UNKNOWN_ERROR,message:e instanceof Error?e.message:"Unknown error"}}}}finally{o?.destroy()}}getPendingTransaction(e){return this.#zo()?this.#qo(e)?.transaction??null:null}isActive(e,t){return u.error("isActive() has been removed. Entitlement validation must be done server-side. See: https://docs.encorekit.com/server-side-validation"),!1}didGrant(e,t){this.#zo()&&(this.#do?t&&"string"==typeof t?this.#do.sendGrantSignal(t,e):u.error("didGrant() requires a valid transaction ID"):u.error("SignalManager not initialized"))}async waitForVerification(e,t){if(!this.#zo())return u.error("SDK not configured"),"failed";if(!this.#f)return u.error("API client not initialized"),"failed";if(!e)return u.error("waitForVerification() requires a transaction ID"),"failed";try{u.debug("Starting verification wait",{transactionId:e,timeout:t});const n={transactionId:e};void 0!==t&&(n.timeout=t);const i=new O(this.#f,n);return await i.poll()}catch(t){return u.error("Error during verification wait",{transactionId:e,error:t}),"failed"}}on(e,t){return u.error("on() event listener has been removed. Entitlement validation must be done server-side. See: https://docs.encorekit.com/server-side-validation"),()=>{}}observeEntitlement(e,t){return u.error("observeEntitlement() has been removed. Entitlement validation must be done server-side. See: https://docs.encorekit.com/server-side-validation"),{subscribe:e=>()=>{}}}onStrictUnlockVerified(e){return this.#Re.on("strictUnlockVerified",e)}placement(e,t){let n,i,r;return"string"==typeof e?(n=e,i=e,r=t):(n=`placement_${S().slice(0,8)}`,r=e),new F(n,async e=>this.show(void 0,e,i),r,async()=>this.redeem(i?{placement:i}:void 0))}#Mo(e,n){if(!this.#f)return;const i=n instanceof Error?n.message:String(n),r=n instanceof Error?n.stack:void 0,o=R(n),s=function(e){if("object"!=typeof e||null===e)return{};const n=e,i=N(n,"code"),r=n.statusCode;return{...i&&i!==String(t.API_ERROR)?{serverCode:i}:{},..."number"==typeof r?{statusCode:String(r)}:{}}}(n);this.#f.reportError({errorType:o,message:i,context:e,severity:"error",...r&&{stackTrace:r},...this.#g&&{userId:this.#g},...Object.keys(s).length>0&&{metadata:s}}).catch(()=>{}),this.#C&&this.#g&&this.#C.track(function(e,t,n,i){return{name:"sdk_error",distinctId:e,properties:{errorType:t,errorDescription:n,...i&&{context:i}}}}(this.#g,o,i,e))}async#Qo(e,t,n){if("reduceChurn"!==t)return null;const i=this.#uo?await this.#uo.getCohort():"notEnrolled";return this.#uo?.logExposure(i),"control"!==i?null:(this.#C&&this.#g&&this.#C.track(C(this.#g,"experiment_control",e,this.#vo,t,n)),this.#Ho("experiment_control",e,t,n,this.#jo(t)),u.debug("NCL control cohort — ghost trigger, no UI shown"),{result:{status:"unavailable"},override:{notPresentedReason:"experiment_control"}})}#Xo(e){if(e.ui?.values?.text){const t=e.ui.values.text;this.#xo={...t},u.debug("Remote config loaded",t)}this.#vo=e.ui?.variantId??void 0,this.#$o=e.ui?.values,this.#ko={...e.ui?.values?.text?.appName&&{appName:e.ui.values.text.appName},...e.ui?.values?.media?.appstoreIcon&&{appIconUrl:e.ui.values.media.appstoreIcon},...e.entitlements?.native&&{entitlementValue:e.entitlements.native.value,entitlementUnit:e.entitlements.native.unit,trialDurationDays:e.entitlements.native.durationDays}};const t=e.useCases??{},n={};for(const[e,i]of Object.entries(t)){const t=s(e);t&&(n[t]=i)}const i={};for(const e of Object.keys(this.#Eo)){const t=this.#Co[e];t&&(i[e]=t)}this.#Co={...n,...i},this.#uo?.setConfig(e.experiments?.ncl)}#Jo(e){if(this.#Io.has(e))return null;const t=this.#Co[e];return t&&Wn(t)?{variantId:t.variantId??void 0,variantName:t.variantName??null,values:t.values}:null}async#es(e){this.#So||this.#Fo(),await this.#Ko();return this.#Jo(e)||(await this.#ts(e),this.#Jo(e))}#ts(e){const t=this.#Eo[e];if(t)return t;if(!this.#f||!this.#g)return Promise.resolve();this.#ns(e);const n=this.#g,i=this.#f.fetchConfig(n,Q,e).then(t=>{if(this.#g!==n)return;const i=t.ui,r=i?.useCase===o(e),s=i?.values;r&&Wn({values:s})?(this.#Io.delete(e),this.#Co[e]={variantId:i.variantId??null,variantName:i.variantName??null,template:i.template??null,values:s}):(this.#Io.add(e),delete this.#Co[e])}).catch(t=>{u.warn(`Failed to fetch config for use case '${e}' (non-blocking)`,t),delete this.#Eo[e]});return this.#Eo[e]=i,i}#ns(e){this.#To.has(e)||(this.#To.add(e),u.warn(`[INTEGRATION] Use case '${e}' was not prefetched, so it is being fetched on demand — this first presentation will be slower, then it is cached. Nothing has failed. To make it instant, ask Encore to enable '${e}' for this app.`))}#jo(e){return e&&"reduceChurn"!==e?this.#Jo(e)?.variantId:this.#vo}#Fo(){if(!this.#f||!this.#g)return;const e=Date.now(),t=this.#g;this.#So=this.#f.fetchConfig(t,Q).then(n=>{this.#g===t&&(this.#Xo(n),this.#is("remote",Date.now()-e))}).catch(t=>{u.warn("Failed to fetch remote config (non-blocking)",t),this.#Mo("configuration",t),this.#is("fallback",Date.now()-e),this.#So=null})}#is(e,t){var n;this.#C&&this.#g&&this.#C.track({name:"sdk_sdui_config_loaded",distinctId:this.#g,properties:{...(n={...this.#vo&&{variantId:this.#vo},loadSource:e,loadDurationMs:t}).variantId&&{variantId:n.variantId},loadSource:n.loadSource,loadDurationMs:n.loadDurationMs,...n.presentationId&&{presentationId:n.presentationId}}})}async#Ko(){if(!this.#So)return;let e;await Promise.race([this.#So,new Promise(t=>{e=setTimeout(t,2500)})]),clearTimeout(e)}async#Vo(e,n,i){const r=n?.useCase??"reduceChurn";let o=null;if("reduceChurn"!==r&&(o=await this.#es(r),!o))return u.info(`[Encore SDK] No template for use case '${r}' on this app — no-op`),this.#C&&this.#g&&this.#C.track(C(this.#g,"no_template",e,void 0,r,i)),{result:{status:"unavailable"},presentationId:e,override:{notPresentedReason:"use_case_unavailable"}};if(!this.#ho||!this.#f)return u.error("Managers not initialized"),{result:{status:"dismissed",reason:{type:"error",error:{code:t.INITIALIZATION_ERROR,message:"Managers not initialized"}}},presentationId:e};const s={title:w(n?.headline),subtitle:w(n?.subheadline)},a=this.#jo(r);this.#C&&this.#g&&this.#C.track(function(e,t,n,i,r){return{name:"sdk_offer_presentation_triggered",distinctId:e,properties:{presentationId:t,...n&&{variantId:n},...k(i),...$(r)}}}(this.#g,e,a,r,i));const l=await this.#Qo(e,r,i);if(l)return{...l,presentationId:e,...void 0!==a&&{variantId:a}};const c=[],d=()=>{for(const e of c.splice(0))try{e()}catch{}};try{const l=n?.appearance,h={...l?.accentColor&&{primaryColor:l.accentColor},...l?.backgroundColor&&{backgroundColor:l.backgroundColor},...l?.textColor&&{textColor:l.textColor}};this.#wo?l&&function(e){const t=document.documentElement,n=qe(e);n.primaryColor&&t.style.setProperty("--encore-primary-color",n.primaryColor),n.backgroundColor&&t.style.setProperty("--encore-bg-color",n.backgroundColor),n.textColor&&t.style.setProperty("--encore-text-color",n.textColor),n.borderRadius&&t.style.setProperty("--encore-border-radius",n.borderRadius),n.fontFamily&&t.style.setProperty("--encore-font-family",n.fontFamily),u.debug("Theme variables updated",n)}(h):(je(h),this.#wo=!0),u.debug("Fetching offers");const p="strict"===this.#co.getUnlockMode(),{offers:f}=await this.#ho.fetchOffers(this.#bo,!0,i,p?15e3:void 0);if(0===f.length)return u.info("No offers available"),this.#C&&this.#g&&this.#C.track(C(this.#g,"no_offer_available",e,a,r,i)),{result:{status:"unavailable"},presentationId:e,...void 0!==a&&{variantId:a},override:{notPresentedReason:"no_offer_available"}};const g={...this.#xo,...s.title&&{titleText:s.title,customHeadline:s.title},...s.subtitle&&{subtitleText:s.subtitle,customSubheadline:s.subtitle}};this.#ho.beginPresentation(a,r,i,e);const m=new Map;f.forEach(e=>{m.set(e.id,S())});const b=e=>{let t=m.get(e);return t||(t=S(),m.set(e,t)),t};this.#C&&this.#g&&this.#C.track(function(e,t,n,i,r,o){return{name:"sdk_offer_presentation_success",distinctId:e,properties:{presentationId:t,offerCount:n,...i&&{variantId:i},...k(r),...$(o)}}}(this.#g,e,f.length,a,r,i));const y=(t,n)=>({campaignId:t.campaignId,...t.creativeId&&{creativeId:t.creativeId},...null!=t.merchantName&&{advertiserName:t.merchantName},impressionId:b(t.id),offerIndex:n,totalOffers:f.length,presentationId:e,...a&&{variantId:a},...r&&{useCase:r},...i&&{placementId:i}}),x="rewardUsers"===r?function(e,t=ln){return e&&Object.prototype.hasOwnProperty.call(t,e)?t[e]??null:null}(o?.variantName):null,v=new tt;c.push(()=>v.destroy());let E=null;switch(x){case"giftReveal":E={kind:x,surface:new Cn(f,{impressions:v,claimEnabled:this.#Ht,trustText:rn})};break;case"giftList":{const e=this.#rs(),t=w(e.logoUrl,o?.values?.media?.appstoreIcon??void 0),n=w(e.appDisplayName,o?.values?.text?.appName??void 0);E={kind:x,surface:new Ln(f,{impressions:v,claimEnabled:this.#Ht,...t&&{hostIconUrl:t},...n&&{hostName:n}})};break}case"giftUnwrap":E={kind:x,surface:new Dn(f,{impressions:v,claimEnabled:this.#Ht,...l?.claimButton&&{claimSlot:l.claimButton}})}}const A="giftReveal"===E?.kind&&E.surface.hasMoreGifts(),L=new Qe({},{showCloseButton:"rewardUsers"!==r||A||"giftList"===E?.kind||"giftUnwrap"===E?.kind,...!1===n?.dismissible&&{dismissible:!1},...l?.modalBackgroundColor&&{backgroundColor:l.modalBackgroundColor}}),N={rewardActions:null,confetti:null},R=E?.surface??new Nt(f,g,"rewardUsers"===r?{impressions:v,mode:"paged",hideHeader:!0,selectable:!0,claimEnabled:this.#Ht,...l?.dotColor&&{dotColor:l.dotColor},...l?.dotActiveColor&&{dotActiveColor:l.dotActiveColor}}:{impressions:v,claimEnabled:this.#Ht});if(L.onVisibilityChange(e=>v.setContainerVisible(e)),c.push(()=>L.destroy()),c.push(()=>R.destroy()),c.push(()=>N.rewardActions?.destroy()),c.push(()=>N.confetti?.destroy()),this.#Ht){const e=new an;c.push(()=>e.destroy()),R.on("offerSelect",t=>e.point(t.offer.advertiserUrl))}const O=await new Promise(c=>{let d=!1;const h=(t,n)=>{d||(d=!0,c({result:t,presentationId:e,...void 0!==a&&{variantId:a},...n&&{override:n}}))};let p=null,g="carousel";R.on("offerClaim",n=>{const o=n.offer;u.debug("User claimed offer",{offerId:o.id});const s=y(o,n.index);this.#Zo(e=>function(e,t){return{name:"sdk_offer_claim_tapped",distinctId:e,properties:I(t)}}(e,s)),this.#Zo(t=>T(t,{...a&&{variantId:a},actionType:"claimOffer",presentationId:e,currentState:"carousel",useCase:r,...i&&{placementId:i}}));const l=this.#os(r),c=_(l)?null:this.#Wo();(async()=>{try{const e=b(o.id),t=n.index,a=await this.#ss(o,e,t,f.length,r),d=this.#as(o,a);if(p=d,_(l)){const e=this.#ls(l,o,a,r,i,o.perk);return this.#ho?.endPresentation(void 0,r),g="primer",void this.#cs(L,e,()=>{h(d),L.hide()})}this.#Yo(o,a,r,c,s),this.#ho?.endPresentation(void 0,r),L.hide(),h(d)}catch(e){u.error("Error creating transaction",{offerId:o.id,error:e}),this.#Mo("start_transaction",e),p||this.#Zo(t=>function(e,t,n){return{name:"sdk_offer_claim_failed",distinctId:e,properties:{...I(t),reason:n.reason,...n.errorDescription&&{errorDescription:n.errorDescription},...n.transactionId&&{transactionId:n.transactionId}}}}(t,s,{reason:this.#ho?"transaction_start_failed":"manager_unavailable",errorDescription:e instanceof Error?e.message:"Transaction failed"})),this.#ds(c),this.#ho?.endPresentation("error",r),L.hide(),p?h(p):h({status:"dismissed",reason:{type:"error",error:{code:t.UNKNOWN_ERROR,message:e instanceof Error?e.message:"Transaction failed"}}},{advertiserOutcome:"failed",dismissal:"interrupted"})}})()}),R.on("complete",e=>{e.claimed||(u.debug("User declined last offer"),this.#ho?.endPresentation("userDeclinedLastOffer",r),R.destroy(),L.hide(),h({status:"dismissed",reason:"userDeclinedLastOffer"}))});const m=()=>{if(this.#Zo(t=>T(t,{...a&&{variantId:a},actionType:"close",presentationId:e,currentState:g,useCase:r,...i&&{placementId:i}})),p)return R.destroy(),void h(p);u.debug("User closed modal"),this.#ho?.endPresentation("userClosedModal",r),R.destroy(),h({status:"dismissed",reason:"userClosedModal"})};if(L.on("close",m),L.on("backdropClick",()=>{if(p)return R.destroy(),L.hide(),void h(p);u.debug("User clicked outside modal"),this.#ho?.endPresentation("userClickedOutside",r),R.destroy(),L.hide(),h({status:"dismissed",reason:"userClickedOutside"})}),R.on("offerView",e=>{const{offer:t}=e,n=b(t.id);this.#ho&&this.#ho.trackOfferPresented(t,n,e.index,f.length,r)}),R.on("scroll",t=>{this.#Zo(n=>function(e,t){return{name:"sdk_sdui_scroll",distinctId:e,properties:{...t.variantId&&{variantId:t.variantId},scrollAxis:t.scrollAxis,scrollPosition:t.scrollPosition,presentationId:t.presentationId,...k(t.useCase),...$(t.placementId)}}}(n,{...a&&{variantId:a},scrollAxis:t.axis,scrollPosition:t.position,presentationId:e,useCase:r,...i&&{placementId:i}}))}),L.on("hide",()=>{h(p||{status:"dismissed",reason:"userClosedModal"})}),"rewardUsers"===r){const e="giftList"===E?.kind||"giftUnwrap"===E?.kind?En({...f[0]?.termsUrl&&{termsUrl:f[0].termsUrl}}):null,t=new sn({onClaim:()=>"giftUnwrap"===E?.kind?E.surface.showReady():R.claimSelected(),onDecline:()=>{m(),L.hide()},claimEnabled:this.#Ht,useCase:r,..."giftReveal"===E?.kind&&{...f[0]&&{primaryLabel:gt(f[0])},termsText:"One gift per person · Offer terms"},..."giftList"===E?.kind&&{...f[0]&&{primaryLabel:gt(f[0])},showTrust:!1,...e&&{termsElement:e}},..."giftUnwrap"===E?.kind&&{primaryLabel:Nn,showTrust:!1,...e&&{termsElement:e}},..."giftList"===E?.kind||"giftUnwrap"===E?.kind?{secondary:"none"}:"giftReveal"===E?.kind?A?{secondary:"more",onMore:()=>E.surface.openSheet(t.getSecondaryElement())}:!1===n?.dismissible?{secondary:"none"}:{}:!1===n?.dismissible?{secondary:R.getTotalOffers()>1?"next":"none",onNext:()=>R.getCurrentIndex()>=R.getTotalOffers()-1?R.selectOffer(0):R.next()}:{},...l?.claimButton&&"giftUnwrap"!==E?.kind&&{claimSlot:l.claimButton},...l?.declineButton&&{declineSlot:l.declineButton}});N.rewardActions=t,R.on("offerSelect",n=>{"giftUnwrap"!==E?.kind&&t.setSelectedOffer(n.offer.merchantName),t.setTrustText(St(n.offer)?"giftReveal"===E?.kind?"FREE trial. You can cancel anytime.":nn:rn),"giftReveal"!==E?.kind&&"giftList"!==E?.kind||t.setPrimaryLabel(gt(n.offer)),e&&In(e,n.offer.termsUrl)})}L.show();const x="giftReveal"===E?.kind||"giftList"===E?.kind||"giftUnwrap"===E?.kind?E.surface.renderHero():void 0,v=R.render();let C;if("rewardUsers"===r&&o){const e=o.values?.text,t=w(Yt(l?.headline),s.title,e?.rewardHeadline)??(E?at:"Congrats! You’ve unlocked an exclusive gift"),i=w(Yt(l?.subheadline),s.subtitle,e?.rewardSubheadline)??(E?"A free present from us. Pick one.":"Choose one of our partner offers below");C=function(e,t={}){const{title:n,subtitle:i,statusIcon:r="none",actions:o,headlineSlot:s,subheadlineSlot:a,hero:l,giftMode:c=!1,rootModifier:d,emphasizeFree:h=c,useCase:p="rewardUsers"}=t,f=document.createElement("div");f.className=`${Ze("thankyou")} ${Ze("thankyou--reward")}${c?` ${Ze("thankyou--gift")}`:""}${d?` ${Ze(`thankyou--${d}`)}`:""}`,l&&f.appendChild(l);const g=document.createElement("div");if(g.className=Ze("thankyou-status"),"success"===r){const e=document.createElement("span");e.className=Ze("thankyou-check"),e.setAttribute("aria-hidden","true"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5l4.5 4.5L19 7.5" /></svg>',g.appendChild(e)}if(n){const e=document.createElement("h2");e.className=Ze("thankyou-title"),e.id=tn,e.textContent=n;const t=Zt(e,n,p,s);h&&t===e&&0===t.childElementCount&&vt(t,t.textContent??"",Ze("gift-em")),g.appendChild(t)}else u.warn("Reward layout rendered without a headline — the dialog has no accessible name");if(i||a){const e=document.createElement("p");e.className=Ze("thankyou-subtitle"),e.textContent=i??"";const t=Zt(e,i??"",p,a);(t.textContent?.trim()||t.childElementCount>0)&&g.appendChild(t)}return f.appendChild(g),f.appendChild(e),o&&f.appendChild(o),f}(v,{...x&&{hero:x},..."giftReveal"===E?.kind&&{giftMode:!0},..."giftList"===E?.kind&&{rootModifier:"gift-list",emphasizeFree:t===at},..."giftUnwrap"===E?.kind&&{rootModifier:"gift-unwrap",emphasizeFree:t===at},title:t,...i&&{subtitle:i},...n?.statusIcon&&{statusIcon:n.statusIcon},...N.rewardActions&&{actions:N.rewardActions.render()},useCase:r,...l?.headline&&{headlineSlot:l.headline},...l?.subheadline&&{subheadlineSlot:l.subheadline}}),L.setLabelledBy(tn)}else C=v;if("giftUnwrap"===E?.kind&&(C=E.surface.compose(C,{setLabelledBy:e=>L.setLabelledBy(e)})),L.setContent(C),"rewardUsers"===r&&!E){const e=new hn;N.confetti=e;const t=C;requestAnimationFrame(()=>e.start(t))}});return d(),O}catch(n){return u.error("Error in offer flow",n),this.#Mo("present_offer_initialization",n),d(),{result:{status:"dismissed",reason:{type:"error",error:{code:t.UNKNOWN_ERROR,message:n instanceof Error?n.message:"Unknown error"}}},presentationId:e,...void 0!==a&&{variantId:a},override:{advertiserOutcome:"not_attempted",dismissal:"interrupted"}}}}#as(e,t){return t||u.warn("[Encore SDK] Claim resolved WITHOUT a transactionId — this conversion cannot be traced back to the user or app. The claim itself succeeded; the transaction record did not."),{status:"claimed",offerId:e.id,campaignId:e.campaignId,advertiserName:e.merchantName??"",...t&&{transactionId:t}}}async#ss(e,t,n,i,r){if(!this.#ho)throw new Error("OfferManager not initialized");const o=await this.#ho.startTransaction(e.campaignId,r),s=this.#ho.placementId;return this.#fo?.notePending(o,{grantsEntitlement:jn(r),...void 0!==r&&{useCase:r},...void 0!==s&&{placementId:s}}),this.#ho.trackOfferClaimed(e,t,o,n,i,r),u.debug("Transaction created",{transactionId:o}),o}#Yo(e,t,n,i,r){const o=this.#hs(e.advertiserUrl,e.trackingParameters,t),s=this.#us(o);r&&this.#Zo(e=>function(e,t,n){return{name:"sdk_offer_webview_attempting_open",distinctId:e,properties:{...I(t),url:n.url,urlHost:n.urlHost}}}(e,r,{url:o,urlHost:s}));const a=this.#ps(i,o);return a||u.warn("Failed to open advertiser URL (popup blocked?)"),r&&(a?(this.#Zo(e=>function(e,t,n){return{name:"sdk_offer_webview_opened",distinctId:e,properties:{...I(t),url:n.url,urlHost:n.urlHost,openedAt:n.openedAt}}}(e,r,{url:o,urlHost:s,openedAt:(new Date).toISOString()})),this.#fs(r,t)):this.#Zo(e=>function(e,t,n){return{name:"sdk_offer_webview_load_failed",distinctId:e,properties:{...I(t),url:n.url,urlHost:n.urlHost,loadSuccess:!1,reason:n.reason}}}(e,r,{url:o,urlHost:s,reason:"popup_blocked"}))),a&&this.#gs(t,r),jn(n)&&"strict"!==this.#co.getUnlockMode()&&this.didGrant("provisional",t),a}#_o(){this.#fo&&(this.#po?.start(()=>{this.#ms()}),this.#ms())}async#ms(){const e=this.#fo;if(!e||this.#yo)return;const t=e.getPending();if(t&&!this.#go.has(t.transactionId)){u.debug("Strict unlock: reconciling pending claim",{transactionId:t.transactionId}),this.#go.add(t.transactionId);try{"verified"===await e.verify(t.transactionId)&&this.#bs(t.transactionId)}finally{this.#go.delete(t.transactionId)}}}#gs(e,t){const n=this.#fo;n&&!this.#go.has(e)&&(this.#go.add(e),(async()=>{try{const i=await n.verify(e);if("verified"!==i)return void u.debug("Strict unlock: not verified in session, left pending",{transactionId:e,status:i});this.#bs(e,t)}finally{this.#go.delete(e)}})())}#bs(e,t){const n=this.#fo?.getPending();n?.transactionId===e?(this.#fo?.clearPending(),n.grantsEntitlement&&this.didGrant("final",e),this.#Zo(i=>function(e,t,n){return{name:"sdk_offer_verified",distinctId:e,properties:{...n?I(n):{},transactionId:t.transactionId,...k(t.useCase),...$(t.placementId)}}}(i,{transactionId:e,...void 0!==n.useCase&&{useCase:n.useCase},...void 0!==n.placementId&&{placementId:n.placementId}},t)),this.#Re.emit("strictUnlockVerified",e),u.debug("Strict unlock: claim verified",{transactionId:e})):u.debug("Strict unlock: verification superseded by a newer claim",{transactionId:e})}#us(e){try{return new URL(e).hostname}catch{return""}}#fs(e,t){if("undefined"==typeof window||"undefined"==typeof document)return;const n=this.#g;if(this.#C&&n)try{this.#Ao?.();const i=Date.now();let r=!1;const o=()=>{window.removeEventListener("focus",s),document.removeEventListener("visibilitychange",s),this.#Ao===o&&(this.#Ao=null)},s=()=>{if(r||"visible"!==document.visibilityState)return;r=!0,o();const s=(Date.now()-i)/1e3;this.#C?.track(function(e,t,n){return{name:"sdk_offer_claim_returned",distinctId:e,properties:{...I(t),...n.transactionId&&{transactionId:n.transactionId}}}}(n,e,{transactionId:t})),this.#C?.track(function(e,t,n){return{name:"sdk_offer_webview_dismissed",distinctId:e,properties:{...I(t),timeSpentSeconds:n.timeSpentSeconds}}}(n,e,{timeSpentSeconds:s}))};window.addEventListener("focus",s),document.addEventListener("visibilitychange",s),this.#Ao=o}catch{}}#Zo(e){const t=this.#g;this.#C&&t&&this.#C.track(e(t))}#hs(e,t,n){try{const i=new URL(e);t&&Object.entries(t).forEach(([e,t])=>{i.searchParams.append(e,String(t))});let r=i.toString();return r=r.replace(/TRANSACTION_ID/g,n),u.debug("Built final advertiser URL",{original:e,final:r,transactionId:n}),r}catch(t){return u.error("Failed to build advertiser URL",{url:e,error:t}),e.replace(/TRANSACTION_ID/g,n)}}#Wo(){try{return window.open("","_blank")}catch(e){return u.error("Failed to open blank advertiser window",{error:e}),null}}#ps(e,t){try{if(e)return e.location.href=t,e.focus(),!0;const n=window.open(t,"_blank","noopener,noreferrer");return!!n&&(n.focus(),!0)}catch(e){return u.error("Failed to navigate advertiser URL",{url:t,error:e}),!1}}#ds(e){try{e?.close()}catch(e){u.error("Failed to close advertiser window",{error:e})}}#qo(e){return[this.#Lo,this.#No].map(t=>{const n=e?t.getByPlacement(e):t.getLatest();return n?{transaction:Gn(n),store:t}:null}).filter(e=>null!==e).sort((e,t)=>B(t.transaction)-B(e.transaction))[0]??null}#os(e){return function(e,t){return function(e){if(!e||"object"!=typeof e)return;const t=e.claimBehavior;return P.includes(t)?t:void 0}(t)??z[e]}(e,"reduceChurn"===e?this.#$o:this.#Co[e]?.values)}#ls(e,t,n,i,r,o){const s=Date.now(),a={id:n,appAccountId:this.#g??"",...r&&{placementId:r},offer:{id:t.id,campaignId:t.campaignId,advertiserUrl:t.advertiserUrl,...t.trackingParameters&&{trackingParameters:t.trackingParameters},...t.merchantName&&{advertiserName:t.merchantName},...o&&{reward:o},...t.imageUrl&&{imageUrl:t.imageUrl},...t.logoUrl&&{logoUrl:t.logoUrl}},useCase:i,status:"claimed",createdAt:new Date(s).toISOString(),expiresAt:new Date(s+6048e5).toISOString()};return("deferredWhileAlive"===e?this.#No:this.#Lo).save(a),a}#rs(){return function(e){const t=K(e.appName),n=function(e){const t=K(e.entitlementValue),n=K(e.entitlementUnit);if(!t||!n)return;const i=n.endsWith("s")?n.slice(0,-1):n;return`${t} ${1===Number(t)?i:`${i}s`}`}(e),i=K(e.appIconUrl);return{...t&&{appDisplayName:t},...n&&{trialPeriod:n},...i&&{logoUrl:i}}}(this.#ko)}#cs(e,t,n){const i=this.#rs();try{const r=new Ft({variant:i.appDisplayName?"activation":"holding",display:i,partner:{...t.offer.advertiserName&&{name:t.offer.advertiserName},...t.offer.logoUrl&&{logoUrl:t.offer.logoUrl},...t.offer.imageUrl&&{imageUrl:t.offer.imageUrl}}});r.on("continue",()=>{r.destroy(),n()}),e.setContent(r.render()),u.debug("Primer screen displayed",{transactionId:t.id})}catch(e){u.error("Failed to show the primer screen",e),n()}}#Go(e,t,n,i){try{const{reward:o,advertiserName:s,logoUrl:a,imageUrl:l}=t.offer,c=this.#rs(),d=n?.name??c.appDisplayName;let h={};if("rewardUsers"!==t.useCase&&d){const e=this.#ko.trialDurationDays,t=e?(r=new Date(Date.now()+24*e*60*60*1e3),`Free until ${new Intl.DateTimeFormat(void 0,{month:"long",day:"numeric",year:"numeric"}).format(r)}`):void 0,i=n?.logoUrl??c.logoUrl;h={host:{name:d,...c.trialPeriod&&{trialPeriod:c.trialPeriod},...n?.status&&{status:n.status},...t&&{detail:t},...i&&{logoUrl:i}}}}const p=new Ht({variant:h.host?"activation":"reward",...o&&{reward:o},...s&&{advertiserName:s},...a&&{logoUrl:a},...l&&{imageUrl:l},...h});p.on("continue",()=>{p.destroy(),i()}),e.setContent(p.render()),u.debug("Redemption screen displayed",{transactionId:t.id})}catch(e){u.error("Failed to show redemption screen",e),i()}var r}};e.Encore=Zn,e.default=Zn,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=encore.min.js.map
|