@encorekit/web-sdk 2.3.0 → 2.4.0

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.
Files changed (265) hide show
  1. package/README.md +66 -1
  2. package/dist/cjs/index.cjs +1 -1
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/preview.cjs +2 -0
  5. package/dist/cjs/preview.cjs.map +1 -0
  6. package/dist/cjs/react.cjs +1 -1
  7. package/dist/cjs/react.cjs.map +1 -1
  8. package/dist/esm/chunks/ClaimReminder-DFyrm5bJ.js +2 -0
  9. package/dist/esm/chunks/ClaimReminder-DFyrm5bJ.js.map +1 -0
  10. package/dist/esm/chunks/GiftsButton-B0lVB463.js +2 -0
  11. package/dist/esm/chunks/GiftsButton-B0lVB463.js.map +1 -0
  12. package/dist/esm/chunks/TriggerHost-CNTiNrTH.js +2 -0
  13. package/dist/esm/chunks/TriggerHost-CNTiNrTH.js.map +1 -0
  14. package/dist/esm/chunks/autoPops-CngtK_R0.js +2 -0
  15. package/dist/esm/chunks/autoPops-CngtK_R0.js.map +1 -0
  16. package/dist/esm/chunks/customClaim-B4uj-aOc.js +2 -0
  17. package/dist/esm/chunks/customClaim-B4uj-aOc.js.map +1 -0
  18. package/dist/esm/chunks/eligibility-BY7fL8Ve.js +2 -0
  19. package/dist/esm/chunks/eligibility-BY7fL8Ve.js.map +1 -0
  20. package/dist/esm/chunks/index-CaBSqauy.js +2 -0
  21. package/dist/esm/chunks/index-CaBSqauy.js.map +1 -0
  22. package/dist/esm/chunks/lookValues-B9z2VWpH.js +2 -0
  23. package/dist/esm/chunks/lookValues-B9z2VWpH.js.map +1 -0
  24. package/dist/esm/chunks/sduiView-Ds7QtFId.js +2 -0
  25. package/dist/esm/chunks/sduiView-Ds7QtFId.js.map +1 -0
  26. package/dist/esm/chunks/spot-DkKMLpB-.js +2 -0
  27. package/dist/esm/chunks/spot-DkKMLpB-.js.map +1 -0
  28. package/dist/esm/chunks/template-B9p4CbPD.js +2 -0
  29. package/dist/esm/chunks/template-B9p4CbPD.js.map +1 -0
  30. package/dist/esm/chunks/textSlots-BnwxUg9V.js +2 -0
  31. package/dist/esm/chunks/textSlots-BnwxUg9V.js.map +1 -0
  32. package/dist/esm/chunks/timers-Bva4yoGM.js +2 -0
  33. package/dist/esm/chunks/timers-Bva4yoGM.js.map +1 -0
  34. package/dist/esm/index.js +1 -1
  35. package/dist/esm/index.js.map +1 -1
  36. package/dist/esm/preview.js +2 -0
  37. package/dist/esm/preview.js.map +1 -0
  38. package/dist/esm/react.js +1 -1
  39. package/dist/esm/react.js.map +1 -1
  40. package/dist/umd/encore.min.js +1 -1
  41. package/dist/umd/encore.min.js.map +1 -1
  42. package/package.json +9 -1
  43. package/types/analytics/DiagnosticsOutbox.d.ts +1 -0
  44. package/types/analytics/DiagnosticsOutbox.d.ts.map +1 -1
  45. package/types/analytics/events.d.ts +105 -5
  46. package/types/analytics/events.d.ts.map +1 -1
  47. package/types/analytics/models.d.ts +2 -0
  48. package/types/analytics/models.d.ts.map +1 -1
  49. package/types/analytics/transport.d.ts +6 -0
  50. package/types/analytics/transport.d.ts.map +1 -1
  51. package/types/api/APIClient.d.ts +58 -3
  52. package/types/api/APIClient.d.ts.map +1 -1
  53. package/types/api/contract.d.ts +4 -1
  54. package/types/api/contract.d.ts.map +1 -1
  55. package/types/api/generated/types.d.ts +420 -39
  56. package/types/api/generated/types.d.ts.map +1 -1
  57. package/types/api/models.d.ts +18 -2
  58. package/types/api/models.d.ts.map +1 -1
  59. package/types/api/offerBuilder.d.ts +10 -4
  60. package/types/api/offerBuilder.d.ts.map +1 -1
  61. package/types/core/Encore.d.ts +145 -3
  62. package/types/core/Encore.d.ts.map +1 -1
  63. package/types/core/OfferManager.d.ts +25 -3
  64. package/types/core/OfferManager.d.ts.map +1 -1
  65. package/types/core/PlacementBuilder.d.ts +6 -1
  66. package/types/core/PlacementBuilder.d.ts.map +1 -1
  67. package/types/core/SignalManager.d.ts.map +1 -1
  68. package/types/core/StorageManager.d.ts +3 -2
  69. package/types/core/StorageManager.d.ts.map +1 -1
  70. package/types/core/StrictUnlockReconciler.d.ts +1 -1
  71. package/types/core/StrictUnlockReconciler.d.ts.map +1 -1
  72. package/types/core/claimHandle.d.ts +44 -0
  73. package/types/core/claimHandle.d.ts.map +1 -0
  74. package/types/core/claimLog.d.ts +102 -0
  75. package/types/core/claimLog.d.ts.map +1 -0
  76. package/types/core/claimRefusal.d.ts +3 -0
  77. package/types/core/claimRefusal.d.ts.map +1 -0
  78. package/types/core/claimStatusCheck.d.ts +62 -0
  79. package/types/core/claimStatusCheck.d.ts.map +1 -0
  80. package/types/core/giftVariant.d.ts +5 -0
  81. package/types/core/giftVariant.d.ts.map +1 -1
  82. package/types/core/hostDisplay.d.ts +9 -2
  83. package/types/core/hostDisplay.d.ts.map +1 -1
  84. package/types/core/sduiVariables.d.ts +20 -0
  85. package/types/core/sduiVariables.d.ts.map +1 -0
  86. package/types/core/strings.d.ts +114 -0
  87. package/types/core/strings.d.ts.map +1 -0
  88. package/types/core/unlockCode.d.ts +8 -1
  89. package/types/core/unlockCode.d.ts.map +1 -1
  90. package/types/core/userKeys.d.ts +7 -0
  91. package/types/core/userKeys.d.ts.map +1 -0
  92. package/types/core/version.d.ts +1 -1
  93. package/types/experiments/ExposureOutbox.d.ts +1 -0
  94. package/types/experiments/ExposureOutbox.d.ts.map +1 -1
  95. package/types/preview.d.ts +51 -0
  96. package/types/preview.d.ts.map +1 -0
  97. package/types/react.d.ts +53 -1
  98. package/types/react.d.ts.map +1 -1
  99. package/types/sdui/actions.d.ts +93 -0
  100. package/types/sdui/actions.d.ts.map +1 -0
  101. package/types/sdui/bindings.d.ts +63 -0
  102. package/types/sdui/bindings.d.ts.map +1 -0
  103. package/types/sdui/compile.d.ts +88 -0
  104. package/types/sdui/compile.d.ts.map +1 -0
  105. package/types/sdui/conditions.d.ts +22 -0
  106. package/types/sdui/conditions.d.ts.map +1 -0
  107. package/types/sdui/context.d.ts +132 -0
  108. package/types/sdui/context.d.ts.map +1 -0
  109. package/types/sdui/countdown.d.ts +31 -0
  110. package/types/sdui/countdown.d.ts.map +1 -0
  111. package/types/sdui/decode.d.ts +35 -0
  112. package/types/sdui/decode.d.ts.map +1 -0
  113. package/types/sdui/deps.d.ts +43 -0
  114. package/types/sdui/deps.d.ts.map +1 -0
  115. package/types/sdui/dominantColor.d.ts +24 -0
  116. package/types/sdui/dominantColor.d.ts.map +1 -0
  117. package/types/sdui/elements/confetti.d.ts +38 -0
  118. package/types/sdui/elements/confetti.d.ts.map +1 -0
  119. package/types/sdui/elements/content.d.ts +27 -0
  120. package/types/sdui/elements/content.d.ts.map +1 -0
  121. package/types/sdui/elements/interactive.d.ts +48 -0
  122. package/types/sdui/elements/interactive.d.ts.map +1 -0
  123. package/types/sdui/elements/layout.d.ts +41 -0
  124. package/types/sdui/elements/layout.d.ts.map +1 -0
  125. package/types/sdui/elements/marquee.d.ts +17 -0
  126. package/types/sdui/elements/marquee.d.ts.map +1 -0
  127. package/types/sdui/elements/progress.d.ts +10 -0
  128. package/types/sdui/elements/progress.d.ts.map +1 -0
  129. package/types/sdui/elements/shared.d.ts +138 -0
  130. package/types/sdui/elements/shared.d.ts.map +1 -0
  131. package/types/sdui/elements/symbols.d.ts +22 -0
  132. package/types/sdui/elements/symbols.d.ts.map +1 -0
  133. package/types/sdui/elements/triggerText.d.ts +55 -0
  134. package/types/sdui/elements/triggerText.d.ts.map +1 -0
  135. package/types/sdui/host.d.ts +274 -0
  136. package/types/sdui/host.d.ts.map +1 -0
  137. package/types/sdui/inlineMarkup.d.ts +22 -0
  138. package/types/sdui/inlineMarkup.d.ts.map +1 -0
  139. package/types/sdui/lookValues.d.ts +50 -0
  140. package/types/sdui/lookValues.d.ts.map +1 -0
  141. package/types/sdui/model.d.ts +130 -0
  142. package/types/sdui/model.d.ts.map +1 -0
  143. package/types/sdui/motion.d.ts +37 -0
  144. package/types/sdui/motion.d.ts.map +1 -0
  145. package/types/sdui/precheck.d.ts +94 -0
  146. package/types/sdui/precheck.d.ts.map +1 -0
  147. package/types/sdui/scrollMath.d.ts +32 -0
  148. package/types/sdui/scrollMath.d.ts.map +1 -0
  149. package/types/sdui/style.d.ts +99 -0
  150. package/types/sdui/style.d.ts.map +1 -0
  151. package/types/sdui/triggerKit.d.ts +24 -0
  152. package/types/sdui/triggerKit.d.ts.map +1 -0
  153. package/types/sdui/unrunnable.d.ts +11 -0
  154. package/types/sdui/unrunnable.d.ts.map +1 -0
  155. package/types/sdui/vocabulary.d.ts +119 -0
  156. package/types/sdui/vocabulary.d.ts.map +1 -0
  157. package/types/triggers/claimReminder/ClaimReminder.d.ts +65 -0
  158. package/types/triggers/claimReminder/ClaimReminder.d.ts.map +1 -0
  159. package/types/triggers/claimReminder/bindings.d.ts +40 -0
  160. package/types/triggers/claimReminder/bindings.d.ts.map +1 -0
  161. package/types/triggers/claimReminder/config.d.ts +56 -0
  162. package/types/triggers/claimReminder/config.d.ts.map +1 -0
  163. package/types/triggers/claimReminder/eligibility.d.ts +37 -0
  164. package/types/triggers/claimReminder/eligibility.d.ts.map +1 -0
  165. package/types/triggers/claimReminder/servedWindow.d.ts +15 -0
  166. package/types/triggers/claimReminder/servedWindow.d.ts.map +1 -0
  167. package/types/triggers/claimReminder/source.d.ts +29 -0
  168. package/types/triggers/claimReminder/source.d.ts.map +1 -0
  169. package/types/triggers/giftsButton/GiftsButton.d.ts +60 -0
  170. package/types/triggers/giftsButton/GiftsButton.d.ts.map +1 -0
  171. package/types/triggers/giftsButton/config.d.ts +53 -0
  172. package/types/triggers/giftsButton/config.d.ts.map +1 -0
  173. package/types/triggers/giftsButton/spot.d.ts +54 -0
  174. package/types/triggers/giftsButton/spot.d.ts.map +1 -0
  175. package/types/triggers/host/TriggerHost.d.ts +127 -0
  176. package/types/triggers/host/TriggerHost.d.ts.map +1 -0
  177. package/types/triggers/host/autoPops.d.ts +16 -0
  178. package/types/triggers/host/autoPops.d.ts.map +1 -0
  179. package/types/triggers/host/configCache.d.ts +29 -0
  180. package/types/triggers/host/configCache.d.ts.map +1 -0
  181. package/types/triggers/host/customClaim.d.ts +85 -0
  182. package/types/triggers/host/customClaim.d.ts.map +1 -0
  183. package/types/triggers/host/dismissStore.d.ts +37 -0
  184. package/types/triggers/host/dismissStore.d.ts.map +1 -0
  185. package/types/triggers/host/readThrottle.d.ts +15 -0
  186. package/types/triggers/host/readThrottle.d.ts.map +1 -0
  187. package/types/triggers/host/registry.d.ts +17 -0
  188. package/types/triggers/host/registry.d.ts.map +1 -0
  189. package/types/triggers/host/sduiView.d.ts +31 -0
  190. package/types/triggers/host/sduiView.d.ts.map +1 -0
  191. package/types/triggers/host/template.d.ts +28 -0
  192. package/types/triggers/host/template.d.ts.map +1 -0
  193. package/types/triggers/host/textSlots.d.ts +35 -0
  194. package/types/triggers/host/textSlots.d.ts.map +1 -0
  195. package/types/triggers/host/theme.d.ts +87 -0
  196. package/types/triggers/host/theme.d.ts.map +1 -0
  197. package/types/triggers/host/timers.d.ts +11 -0
  198. package/types/triggers/host/timers.d.ts.map +1 -0
  199. package/types/triggers/host/types.d.ts +278 -0
  200. package/types/triggers/host/types.d.ts.map +1 -0
  201. package/types/triggers/host/wire.d.ts +55 -0
  202. package/types/triggers/host/wire.d.ts.map +1 -0
  203. package/types/triggers/preview.d.ts +78 -0
  204. package/types/triggers/preview.d.ts.map +1 -0
  205. package/types/triggers/request.d.ts +53 -0
  206. package/types/triggers/request.d.ts.map +1 -0
  207. package/types/types.d.ts +329 -1
  208. package/types/types.d.ts.map +1 -1
  209. package/types/ui/ClaimScreen.d.ts +1 -1
  210. package/types/ui/ClaimScreen.d.ts.map +1 -1
  211. package/types/ui/CodeUnlock.d.ts +12 -2
  212. package/types/ui/CodeUnlock.d.ts.map +1 -1
  213. package/types/ui/GiftHero.d.ts.map +1 -1
  214. package/types/ui/GiftList.d.ts.map +1 -1
  215. package/types/ui/GiftPicker.d.ts.map +1 -1
  216. package/types/ui/GiftPickerHero.d.ts.map +1 -1
  217. package/types/ui/GiftReveal.d.ts.map +1 -1
  218. package/types/ui/GiftSheet.d.ts +5 -5
  219. package/types/ui/GiftSheet.d.ts.map +1 -1
  220. package/types/ui/GiftUnwrap.d.ts.map +1 -1
  221. package/types/ui/OfferCard.d.ts.map +1 -1
  222. package/types/ui/OfferCarousel.d.ts.map +1 -1
  223. package/types/ui/OfferModal.d.ts +31 -0
  224. package/types/ui/OfferModal.d.ts.map +1 -1
  225. package/types/ui/PrimerScreen.d.ts +2 -0
  226. package/types/ui/PrimerScreen.d.ts.map +1 -1
  227. package/types/ui/RedemptionScreen.d.ts +5 -0
  228. package/types/ui/RedemptionScreen.d.ts.map +1 -1
  229. package/types/ui/RewardActions.d.ts.map +1 -1
  230. package/types/ui/RewardCard.d.ts.map +1 -1
  231. package/types/ui/SduiRewardSurface.d.ts +145 -0
  232. package/types/ui/SduiRewardSurface.d.ts.map +1 -0
  233. package/types/ui/Tooltip.d.ts.map +1 -1
  234. package/types/ui/brandComponents.d.ts.map +1 -1
  235. package/types/ui/brandTint.d.ts.map +1 -1
  236. package/types/ui/colorScheme.d.ts +15 -0
  237. package/types/ui/colorScheme.d.ts.map +1 -0
  238. package/types/ui/covered.d.ts +12 -0
  239. package/types/ui/covered.d.ts.map +1 -0
  240. package/types/ui/giftCategoryGroups.d.ts +13 -0
  241. package/types/ui/giftCategoryGroups.d.ts.map +1 -1
  242. package/types/ui/giftCopy.d.ts +14 -9
  243. package/types/ui/giftCopy.d.ts.map +1 -1
  244. package/types/ui/giftUnwrapCopy.d.ts.map +1 -1
  245. package/types/ui/imageURL.d.ts +44 -0
  246. package/types/ui/imageURL.d.ts.map +1 -0
  247. package/types/ui/impressionGate.d.ts +9 -0
  248. package/types/ui/impressionGate.d.ts.map +1 -1
  249. package/types/ui/offerBadge.d.ts.map +1 -1
  250. package/types/ui/rewardSurface.d.ts +11 -1
  251. package/types/ui/rewardSurface.d.ts.map +1 -1
  252. package/types/ui/sduiTheme.d.ts +48 -0
  253. package/types/ui/sduiTheme.d.ts.map +1 -0
  254. package/types/ui/sheetDetents.d.ts +28 -0
  255. package/types/ui/sheetDetents.d.ts.map +1 -0
  256. package/types/ui/styles.d.ts +11 -8
  257. package/types/ui/styles.d.ts.map +1 -1
  258. package/types/ui/termsLine.d.ts +3 -3
  259. package/types/ui/termsLine.d.ts.map +1 -1
  260. package/types/ui/toast.d.ts +11 -0
  261. package/types/ui/toast.d.ts.map +1 -0
  262. package/types/utils/logger.d.ts +10 -0
  263. package/types/utils/logger.d.ts.map +1 -1
  264. package/types/utils/text.d.ts +17 -0
  265. package/types/utils/text.d.ts.map +1 -1
@@ -0,0 +1,2 @@
1
+ "use strict";var e;!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"}(e||(e={}));const t={reduceChurn:"churn-intervention",rewardUsers:"post-action-reward"},n=Object.fromEntries(Object.entries(t).map(([e,t])=>[t,e])),i=Object.keys(t);function r(e){return t[e]}function o(e){if(e)return n[e]}function s(e){return"string"==typeof e?`'${e.slice(0,64)}'`:typeof e}function a(e){return i.includes(e)}const l=["none","error","warn","info","debug"],c="[Encore SDK]",d=e=>l.indexOf(e),u=new class{#e="none";setLogLevel(e){this.#e=e}getLogLevel(){return this.#e}#t(e){return d(this.#e)>=d(e)}debug(...e){this.#t("debug")&&console.debug(c,...e)}info(...e){this.#t("info")&&console.info(c,...e)}warn(...e){this.#t("warn")&&console.warn(c,...e)}error(...e){this.#t("error")&&console.error(c,...e)}deprecated(...e){console.warn(c,"[DEPRECATED]",...e)}ignored(...e){console.warn(c,...e)}critical(...e){console.error(c,"[CRITICAL]",...e)}};class h{#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",resolveVariantsByPlacement:!0===e.resolveVariantsByPlacement,filterOffersByVariant:!0===e.filterOffersByVariant},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&&!l.includes(e.logLevel)?`logLevel must be one of: ${l.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"}getResolveVariantsByPlacement(){return this.#n?.resolveVariantsByPlacement??!1}getFilterOffersByVariant(){return this.#n?.filterOffersByVariant??!1}reset(){this.#n=null,this.#i=!1,u.debug("Configuration reset")}}const p="encore_";class f{#a;#l;constructor(){this.#l=new Map}get#c(){return void 0===this.#a&&(this.#a=this.#d(),u.debug(`StorageManager initialized with ${this.#a}`)),this.#a}#d(){return this.#u("localStorage")?"localStorage":this.#u("sessionStorage")?"sessionStorage":(u.warn("Neither localStorage nor sessionStorage available, using in-memory storage"),"memory")}#u(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.#c?localStorage:"sessionStorage"===this.#c?sessionStorage:this.#l}#p(e){return`${p}${e}`}set(e,t){if(void 0===t)return void u.warn(`Attempted to store undefined value for key: ${e}`);const n=this.#p(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.#c}`)}catch(e){e instanceof Error&&"QuotaExceededError"===e.name?u.error("Storage quota exceeded:",e):u.error("Failed to store item:",e),"memory"!==this.#c&&(u.warn("Falling back to memory storage for this item"),this.#l.set(n,i))}}get(e){const t=this.#p(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.#p(e);try{const n=this.#h();n instanceof Map?n.delete(t):n.removeItem(t),u.debug(`Removed ${e} from ${this.#c}`)}catch(t){u.error(`Failed to remove ${e}:`,t)}}clear(e){const t=t=>t.startsWith(p)&&!e?.(t.slice(7));try{const e=this.#h();if(e instanceof Map)for(const n of e.keys())t(n)&&e.delete(n);else{const n=[];for(let i=0;i<e.length;i++){const r=e.key(i);r&&t(r)&&n.push(r)}n.forEach(t=>e.removeItem(t))}u.debug(`Cleared all Encore data from ${this.#c}`)}catch(e){u.error("Failed to clear storage:",e)}}getStorageType(){return this.#c}}const m="_signal_queue",g="_strict_pending";function y(e){return`${e}${m}`}function b(e){return"object"==typeof e&&null!==e&&"string"==typeof e.transactionId&&("provisional"===e.grantType||"final"===e.grantType)}function v(e,t){return e.transactionId===t.transactionId&&e.grantType===t.grantType}class w{#f;#m;#g;#y=[];#b=!1;#v=!1;#w;constructor(e,t,n){this.#f=e,this.#m=t,this.#g=n,this.#x(),this.#k(),this.processQueue()}setUserId(e){this.#g!==e&&(u.debug("SignalManager: User ID changed, clearing queue"),this.#g=e,this.#y=[],this.#x())}#x(){try{const e=y(this.#g),t=this.#f.get(e);t&&Array.isArray(t)&&(this.#y=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)}}#$(e){const t=y(this.#g),n=this.#f.get(t);this.#f.set(t,e(Array.isArray(n)?n.filter(b):[]))}#C(){try{const e=y(this.#g);this.#f.set(e,this.#y),u.debug("Saved grant signal queue to storage",{count:this.#y.length})}catch(e){u.error("Failed to save grant signal queue to storage:",e)}}enqueue(e,t){if(this.#v){const n={transactionId:e,grantType:t,timestamp:(new Date).toISOString(),attempts:0};return void this.#$(e=>e.some(e=>v(e,n))?e:[...e,n])}const n=this.#y.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.#y.push(i),this.#C(),u.info("Grant signal added to queue",{transactionId:e,grantType:t})}dequeue(e){if(this.#v)return void this.#$(t=>t.filter(t=>!v(t,e)));const t=this.#y.findIndex(t=>t.transactionId===e.transactionId&&t.grantType===e.grantType);-1!==t&&(this.#y.splice(t,1),this.#C(),u.debug("Grant signal removed from queue",{transactionId:e.transactionId,grantType:e.grantType}))}getQueue(){return[...this.#y]}clearQueue(){this.#y=[],this.#C(),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.#y.length){this.#b=!0,u.info("Processing grant signal queue",{count:this.#y.length});try{for(const e of[...this.#y]){if(this.#v)return;await this.#I(e),this.#y.length>1&&await this.#S(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(),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.#C();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})}}#k(){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.#v=!0,this.#w&&(this.#w(),this.#w=void 0)}#S(e){return new Promise(t=>setTimeout(t,e))}}const x=Object.freeze({impression:"sdk_trigger_impression",clicked:"sdk_trigger_clicked",autoOpened:"sdk_trigger_auto_opened",dismissed:"sdk_trigger_dismissed",eligibleNotShown:"sdk_trigger_eligible_not_shown"}),k=Object.freeze({holdout:"holdout",sheetUnavailable:"sheet_unavailable",autoHeld:"auto_held",unrenderable:"unrenderable",afterCompleteHide:"after_complete_hide",unknownStep:"unknown_step"}),$="customClaim",C=Object.freeze({claimReminder:"claimReminder",giftsButton:"giftsButton"});function I(...e){for(const t of e){const e=t?.trim();if(e)return e}}function S(e){const t=I(e);return t?.slice(0,64)}const E=/^[a-z]{2,3}(-[a-z]{4})?(-([a-z]{2}|[0-9]{3}))?(-([a-z0-9]{5,8}|[0-9][a-z0-9]{3}))*(-[0-9a-wyz](-[a-z0-9]{2,8})+)*(-x(-[a-z0-9]{1,8})+)?$/i,T={iw:"he",in:"id",ji:"yi",jw:"jv"};function A(e){if("string"!=typeof e||!E.test(e))return null;let t=!1;return e.split("-").map((e,n)=>{if(1===e.length&&(t=!0),0===n){const t=e.toLowerCase();return T[t]??t}return t?e.toLowerCase():4===e.length&&/^[a-z]+$/i.test(e)?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():2===e.length?e.toUpperCase():e.toLowerCase()}).join("-")}function L(e){if("string"!=typeof e)return null;const[t=""]=e.trim().split("@",1);return A(t.replace(/_/g,"-"))}const O="transaction_start_failed",N="share_unavailable",M="clipboard",U={userClosedModal:"close_button",userClickedOutside:"dismissed",userDeclinedLastOffer:"last_offer_declined",error:"interrupted",appBackgrounded:"app_backgrounded",appTerminated:"app_terminated"};function R(e){if(null!=e)return U[e]??e}function F(e){return e?{use_case:r(e)}:{}}function P(e){const t=S(e);return t?{placement_id:t}:{}}function z(e){if(e.length<=64)return e;try{const t=Intl.Segmenter;if("function"==typeof t){let n="",i=0;for(const{segment:r}of new t(void 0,{granularity:"grapheme"}).segment(e)){if(64===i)break;n+=r,i+=1}return n}}catch{}return Array.from(e).slice(0,64).join("")}function j(e){return{trigger:e.trigger,...P(e.placementId),...e.variantId&&{variantId:e.variantId},experimentId:e.experimentId,use_case:r(e.useCase),...e.transactionId&&{transactionId:e.transactionId},...e.campaignId&&{campaignId:e.campaignId},...e.layout&&{layout:z(e.layout)},...e.presentationId&&{presentationId:e.presentationId},...e.hostTrigger&&{hostTrigger:e.hostTrigger},...e.step&&{step:e.step,stepExperimentId:e.stepExperimentId??null},...e.textSlots&&e.textSlots.length>0&&{textSlots:[...e.textSlots]}}}function D(e,t,n,i={}){return{name:e,distinctId:t,properties:{...j(n),...i},...n.locale&&{locale:n.locale}}}function B(e,t){return D(x.impression,e,t)}function H(e,t,n){return D(x.clicked,e,t,{target:n})}function _(e,t){return D(x.autoOpened,e,t)}function V(e,t){return D(x.dismissed,e,t)}function q(e,t,n){const{textSlots:i,...r}=t;return D(x.eligibleNotShown,e,r,{reason:n})}function W(e,t,n,i,r,o,s){return{name:"sdk_offer_presentation_failed",distinctId:e,properties:{reason:t,presentationId:n,...i&&{variantId:i},...s&&{experimentId:s},...F(r),...P(o)}}}function K(e,t){const{useCase:n,placementId:i,...r}=t;return{name:"sdk_offer_time_spent",distinctId:e,properties:{...r,...F(n),...P(i)}}}function G(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,...F(t),...P(n)}}function Y(e,t,n){return{name:"sdk_offer_claim_failed",distinctId:e,properties:{...G(t),reason:n.reason,...n.errorDescription&&{errorDescription:n.errorDescription},...n.transactionId&&{transactionId:n.transactionId}}}}function Z(e,t){return{name:"sdk_offer_share_tapped",distinctId:e,properties:G(t)}}function Q(e,t,n){return{name:"sdk_offer_share_failed",distinctId:e,properties:{...G(t),reason:n.reason}}}function X(e,t,n){return{name:"sdk_offer_share_completed",distinctId:e,properties:{...G(t),...n.shareDestination&&{shareDestination:n.shareDestination},completed:n.completed}}}function J(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,...F(t.useCase),...P(t.placementId)}}}function ee(e){return"object"==typeof e&&null!==e&&"offerAlreadyCompleted"===e.code}function te(){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 ne{#m;#E;#g;#T=new Map;#A=new Map;#L=new Map;#O=0;#N=new Map;pendingScopeCount(){return this.#L.size}#M=0;#U=[];#R=new Set;#F=0;#P=null;#z=null;#j=new Map;#D=0;#B=new Set;#H;#_;#V;#q;#W=null;#K=!1;#G=null;constructor(e,t,n){this.#m=e,this.#g=t,this.#E=n??null,this.#Y()}fetchOffers(e,t=!0,n,i,r){return this.#Z(e,t,n,i,r,!0)}async prefetchOffers(e,t){try{await this.#Z(e,!0,void 0,void 0,t,!1)}catch{}}async searchForTrigger(e,t,n,i,r=!1){const o=[this.#Q(e,n),void 0!==i,this.#M].join("|"),s=this.#N.get(o);if(s&&(!r||s.fresh))return[...await s.search];const a=this.#Z(e,!r,t,i,n,!1).then(({offers:e})=>e),l={search:a,fresh:r};this.#N.set(o,l);const c=()=>{this.#N.get(o)===l&&this.#N.delete(o)};return a.then(c,c),[...await a]}#Q(e,t){return[t?.variantId??"",t?.useCase??"",t?.ruledPlacementId??"",(n=e,JSON.stringify(n,(e,t)=>t&&"object"==typeof t&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([e],[t])=>e<t?-1:e>t?1:0)):t))].join("|");var n}async#Z(e,t,n,i,r,o){const s=void 0!==i,a=this.#Q(e,r);if(s&&o&&r?.fromTrigger){const e=this.#A.get(a),t=e?this.#X(e):[];if(t.length>0)return this.#U=t,{offers:[...t]}}const l=!s&&t?this.#T.get(a):void 0,c=l?this.#X(l):[];if(c.length>0)return u.debug("Using cached offers",{count:c.length}),o&&(this.#U=c),{offers:[...c]};t||o||(this.#T.delete(a),this.#A.delete(a));const d=this.#M,h=this.#F,p=++this.#O,f=this.#L.get(a)??{latest:0,pending:0};f.latest=p,f.pending++,this.#L.set(a,f);const m=()=>f.latest===p&&this.#L.get(a)===f;let g=!1;const y=()=>{g||(g=!0,f.pending--,f.pending<=0&&this.#L.get(a)===f&&this.#L.delete(a))};try{u.debug("Fetching offers from API",{userId:this.#g,maxPostbackTimeMs:i});const l=await this.#m.fetchOffers(this.#g,e,n,i,r),c=h===this.#F&&Array.isArray(l.offers)?{...l,offers:this.#X(l.offers)}:l;o&&(this.#U=c.offers??[]);const p=m();if(y(),!o&&!p){const e=s?this.#A.get(a):this.#T.get(a);return{offers:e?this.#X(e):[]}}if(0===c.offers?.length)return t||o||d!==this.#M||!p||(this.#T.delete(a),this.#A.delete(a)),u.info("No offers available for user"),{offers:[]};if(s&&!o&&d===this.#M&&p&&(this.#A.delete(a),this.#A.set(a,c.offers),this.#A.size>16)){const e=this.#A.keys().next().value;void 0!==e&&this.#A.delete(e)}if(!s&&d===this.#M&&p&&(this.#T.delete(a),this.#T.set(a,c.offers),this.#T.size>16)){const e=this.#T.keys().next().value;void 0!==e&&this.#T.delete(e)}return u.info("Offers fetched successfully",{count:c.offers.length,offerIds:c.offers.map(e=>e.id)}),{offers:[...c.offers]}}catch(e){throw y(),u.error("Failed to fetch offers",e),e}}beginPresentation(e,t,n,i,r){return this.#P=i??te(),this.#z=Date.now(),this.#j.clear(),this.#B.clear(),this.#D=0,this.#W=null,this.#H=e,this.#_=r,this.#V=t,this.#q=n,this.#K=!1,this.#P}get placementId(){return this.#q}get presentationId(){return this.#P}#J(){return this.#H?{variantId:this.#H}:{}}#ee(){return this.#_?{experimentId:this.#_}:{}}#te(){return this.#q?{placementId:this.#q}:{}}trackOfferPresented(e,t,n,i,r,o,s){if(!this.#E||!this.#P)return;if(this.#B.has(t))return;this.#B.add(t),this.#D++,this.#W&&this.#W!==e.id&&this.trackOfferViewEnd(this.#W),this.#W=e.id;const a=this.#j.get(e.id);a?(a.viewCount++,a.startTime=Date.now()):this.#j.set(e.id,{startTime:Date.now(),totalTime:0,viewCount:1,reported:!1}),this.#E.track(function(e,t){const{useCase:n,placementId:i,...r}=t;return{name:"sdk_offer_presented",distinctId:e,properties:{...r,...F(n),...P(i)}}}(this.#g,{campaignId:e.campaignId,...e.creativeId&&{creativeId:e.creativeId},...null!=e.merchantName&&{advertiserName:e.merchantName},impressionId:t,offerIndex:n,totalOffers:i,...o&&{presentationTrigger:o},presentationId:this.#P,...this.#J(),...this.#ee(),...this.#te(),...r&&{useCase:r},...void 0!==s&&{imageCacheHit:s}}))}trackOfferViewEnd(e){const t=this.#j.get(e);t&&t.startTime>0&&(t.totalTime+=(Date.now()-t.startTime)/1e3,t.startTime=0)}trackOfferClaimed(e,t,n,i,r,o){this.#E&&this.#P&&this.#E.track(function(e,t){const{useCase:n,placementId:i,...r}=t;return{name:"sdk_offer_claimed",distinctId:e,properties:{...r,...F(n),...P(i)}}}(this.#g,{campaignId:e.campaignId,...e.creativeId&&{creativeId:e.creativeId},...null!=e.merchantName&&{advertiserName:e.merchantName},impressionId:t,transactionId:n,offerIndex:i,totalOffers:r,presentationId:this.#P,...this.#J(),...this.#ee(),...this.#te(),...o&&{useCase:o}}))}trackOfferDeclined(e,t,n,i,r,o){if(!this.#E||!this.#P)return;const s=R(r);this.#E.track(function(e,t){const{useCase:n,placementId:i,...r}=t;return{name:"sdk_offer_declined",distinctId:e,properties:{...r,...F(n),...P(i)}}}(this.#g,{campaignId:e.campaignId,...e.creativeId&&{creativeId:e.creativeId},...null!=e.merchantName&&{advertiserName:e.merchantName},impressionId:t,offerIndex:n,totalOffers:i,...null!=s&&{declineReason:s},presentationId:this.#P,...this.#J(),...this.#te(),...o&&{useCase:o}}))}endPresentation(e,t){this.#ne(e,t,!1),this.#P=null,this.#z=null,this.#j.clear(),this.#B.clear(),this.#D=0,this.#W=null,this.#H=void 0,this.#_=void 0,this.#V=void 0,this.#q=void 0,this.#K=!1}#ne(e,t,n,i=!0){if(!this.#E||!this.#P||!this.#z)return;const r=Date.now(),o=(r-this.#z)/1e3,s=n?{keepalive:!0}:void 0;for(const[e,n]of this.#j){let i=n.totalTime;if(n.startTime>0&&(i+=(r-n.startTime)/1e3),n.reported&&i<=0)continue;n.reported=!0;const o=this.#U.find(t=>t.id===e),a=o?this.#U.indexOf(o):0;this.#E.track(K(this.#g,{campaignId:o?.campaignId??"",offerIndex:a,timeSpentSeconds:i,viewCount:n.viewCount,totalOffers:this.#U.length,presentationId:this.#P,...this.#J(),...this.#te(),...t&&{useCase:t}}),s),n.totalTime=0,n.startTime>0&&(n.startTime=r)}if(!i||this.#K)return;this.#K=!0;const a=R(e);this.#E.track(function(e,t){const{useCase:n,placementId:i,...r}=t;return{name:"sdk_offer_sheet_dismissed",distinctId:e,properties:{...r,...F(n),...P(i)}}}(this.#g,{presentationId:this.#P,totalTimeSpentSeconds:o,totalOffers:this.#U.length,offersViewed:this.#D,...null!=a&&{declineReason:a},...this.#J(),...this.#ee(),...this.#te(),...t&&{useCase:t}}),s)}flushForPageLifecycle(e,t){try{this.#ne(e?"appTerminated":"appBackgrounded",t,!0,e)}catch{}}#Y(){if("undefined"!=typeof window&&"undefined"!=typeof document)try{const e=()=>this.flushForPageLifecycle(!0,this.#V),t=()=>{"hidden"===document.visibilityState&&this.flushForPageLifecycle(!1,this.#V)};window.addEventListener("pagehide",e),document.addEventListener("visibilitychange",t),this.#G=()=>{window.removeEventListener("pagehide",e),document.removeEventListener("visibilitychange",t)}}catch{}}destroy(){this.#G?.(),this.#G=null}async startTransaction(e,t){const n=this.#F;try{u.debug("Starting transaction",{campaignId:e,useCase:t});const n=await this.#m.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 ee(t)?(this.#ie(e,n),u.info("Claim refused: offer already completed",{campaignId:e})):u.error("Failed to start transaction",{campaignId:e,error:t}),t}}#ie(e,t){t===this.#F&&this.#R.add(e)}#X(e){return 0===this.#R.size?e:e.filter(e=>!this.#R.has(e.campaignId))}clearCache(){this.#T.clear(),this.#A.clear(),this.#L.clear(),this.#N.clear(),this.#M++,this.#U=[],u.debug("Offer cache cleared")}setUserId(e){this.#g=e,this.#F+=1,this.#R.clear(),this.clearCache(),u.debug("OfferManager user ID updated",{userId:e})}}const ie={[e.NETWORK_ERROR]:"network_error",[e.TIMEOUT]:"network_error",[e.STORAGE_ERROR]:"persistence_error",[e.CONFIGURATION_ERROR]:"not_configured",[e.INITIALIZATION_ERROR]:"not_configured",[e.INVALID_REQUEST]:"api_error",[e.UNKNOWN_ERROR]:"domain_error"};function re(e,t){const n=e[t];return"string"==typeof n?n:void 0}function oe(t){if("object"!=typeof t||null===t)return"domain_error";const n=t,i=re(n,"code"),r="number"==typeof n.statusCode;if(i){return ie[i]||(i===String(e.API_ERROR)&&r?"http_error":"api_error")}return r?"http_error":t instanceof SyntaxError?"decoding_error":"domain_error"}class se{#m;#re;#oe;#se=0;#ae=1e3;#le=8e3;#ce=null;#de=!1;#ue=!1;constructor(e,t){this.#m=e,this.#re=t.transactionId,this.#oe=t.timeout??3e4}async poll(){return this.#de?(u.warn("Verification polling already in progress",{transactionId:this.#re}),"pending"):(this.#de=!0,this.#se=Date.now(),u.debug("Starting verification polling",{transactionId:this.#re,timeout:this.#oe}),this.#he())}stop(){this.#de=!1,null!==this.#ce&&(clearTimeout(this.#ce),this.#ce=null),u.debug("Verification polling stopped",{transactionId:this.#re})}async#he(){for(;this.#de;){const e=Date.now()-this.#se;if(e>=this.#oe)return u.warn("Verification polling timeout",{transactionId:this.#re,elapsed:e}),this.stop(),"pending";try{const e=await this.#m.checkVerificationStatus(this.#re);if(u.debug("Verification status checked",{transactionId:this.#re,status:e.status,rawStatus:e.raw}),"verified"===e.status)return u.info("Transaction verified",{transactionId:this.#re}),this.stop(),"verified";if("failed"===e.status)return u.warn("Transaction failed verification",{transactionId:this.#re}),this.stop(),"failed";await this.#S(this.#ae),this.#ae=Math.min(2*this.#ae,this.#le)}catch(e){u.error("Error checking verification status",{transactionId:this.#re,error:e}),this.#ue||(this.#ue=!0,this.#m.reportError({errorType:oe(e),message:e instanceof Error?e.message:String(e),context:"verify_transaction",...e instanceof Error&&e.stack?{stackTrace:e.stack}:{}})),await this.#S(this.#ae)}}return"pending"}async#S(e){return new Promise(t=>{this.#ce=window.setTimeout(()=>{this.#ce=null,t()},e)})}}const ae=/^[A-Za-z0-9_-]+$/;class le{#f;#m;#g;constructor(e,t,n){this.#f=e,this.#m=t,this.#g=n}setUserId(e,t=!0){if(this.#g===e)return;const n=t?this.getPending():null;t&&this.clearPending(),this.#g=e,n&&this.#f.set(this.#pe(),n)}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.#f.set(this.#pe(),n),u.debug("StrictUnlockReconciler: noted pending claim",{transactionId:e})}clearPending(){this.#f.remove(this.#pe()),u.debug("StrictUnlockReconciler: cleared pending claim")}getPending(){const e=this.#f.get(this.#pe());if(!e)return null;if("string"!=typeof e.transactionId||"string"!=typeof e.recordedAt||!ae.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||a(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 se(this.#m,{transactionId:e,timeout:t});return await n.poll()}catch(t){return u.warn("StrictUnlockReconciler: verification poll failed",{transactionId:e,error:t}),"pending"}}#pe(){return`${this.#g}${g}`}}class ce{#fe=null;#me=null;#ge;#ye;#be;#ve;constructor(e,t,n,i){this.#be=e,this.#ge=t,this.#ve=n,this.#ye=i}useCase(e){return this.#ve={...this.#ve,useCase:e},this}headline(e){return this.#ve={...this.#ve,headline:e},this}subheadline(e){return this.#ve={...this.#ve,subheadline:e},this}publisherReward(e){return this.#ve={...this.#ve,publisherReward:e},this}onNotGranted(e){return this.#fe=e,this}onLoadingStateChange(e){return this.#me=e,this}async show(){try{this.#me&&this.#me(!0),u.debug("PlacementBuilder: Executing presentation",{id:this.#be});const e=await this.#ge(this.#ve);return this.#me&&this.#me(!1),"dismissed"===e.status&&e.reason&&this.#fe&&this.#fe(e.reason),e}catch(t){this.#me&&this.#me(!1),u.error("PlacementBuilder: Error during presentation",t);const n={type:"error",error:{code:e.UNKNOWN_ERROR,message:t instanceof Error?t.message:"Unknown error"}};return this.#fe&&this.#fe(n),{status:"dismissed",reason:n}}}async redeem(){return u.debug("PlacementBuilder: Redeeming",{id:this.#be}),this.#ye(this.#be)}}function de(e){return"immediate"!==e}const ue={reduceChurn:"deferred",rewardUsers:"immediate"},he=["immediate","deferred","deferredWhileAlive"];const pe="transactions";function fe(e){const t=new Date(e.createdAt).getTime();return Number.isFinite(t)?t:0}function me(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function ge(e,t){if(!me(e))return{};const n={};for(const[i,r]of Object.entries(e))t(r)&&(n[i]=r);return n}class ye{#we;constructor(e){this.#we=e}#xe(){const e=this.#we.read();return me(e)?{transactions:ge(e.transactions,me),placements:ge(e.placements,e=>"string"==typeof e),latest:"string"==typeof e.latest?e.latest:null}:{transactions:{},placements:{},latest:null}}#ke(e){this.#we.write(e)}#$e(e){return!!e&&"claimed"===e.status&&!this.#Ce(e)}#Ce(e){const t=new Date(e.expiresAt).getTime();return!Number.isFinite(t)||t<=Date.now()}save(e){const t=this.#xe();t.transactions[e.id]=e,e.placementId&&(t.placements[e.placementId]=e.id),t.latest=e.id,this.#Ie(t),this.#ke(t),u.debug("TransactionStore: saved transaction",{transactionId:e.id,placement:e.placementId})}getByTransactionId(e){return this.#xe().transactions[e]??null}getByPlacement(e){const t=this.#xe(),n=t.placements[e];if(!n)return null;const i=t.transactions[n];return this.#$e(i)?i:null}getLatest(){const e=this.#xe();if(e.latest){const t=e.transactions[e.latest];if(this.#$e(t))return t}return Object.values(e.transactions).filter(e=>this.#$e(e)).sort((e,t)=>fe(t)-fe(e))[0]??null}markRedeemed(e){const t=this.#xe(),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.#ke(t),u.debug("TransactionStore: marked redeemed",{transactionId:e}))}#Ie(e){for(const[t,n]of Object.entries(e.transactions))(this.#Ce(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.#ke({transactions:{},placements:{},latest:null})}}let be,ve={};const we=/\$\{(\w+)\}/g;function xe(e,t){return t?e.replace(we,(e,n)=>Object.prototype.hasOwnProperty.call(t,n)?String(t[n]):e):e}const ke=e=>"string"==typeof e&&""!==e.trim();function $e(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return ke(t.other)&&Object.values(t).every(e=>ke(e))}function Ce(e,t){const n=be;!function(e){be=ke(e)?e.trim():void 0}(e),t?function(...e){ve={};for(const t of e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const[e,n]of Object.entries(t))(ke(n)||$e(n))&&(ve[e]=n)}(t.strings,t.plurals):be!==n&&(ve={})}function Ie(){return be}function Se(){ve={},be=void 0}function Ee(e,t,n){const i=ve[e];return xe("string"==typeof i?i:t,n)}function Te(e,t,n,i){const r=ve[e],[o,s]=r&&"object"==typeof r?[r,be]:[n,"en"],a=o[function(e,t){try{return new Intl.PluralRules(e).select(t)}catch{return new Intl.PluralRules("en").select(t)}}(s,t)]??o.other;return xe(a,{count:String(t),...i})}function Ae(e,t,n,i=e=>document.createTextNode(e)){const r=[],o=new Set;let s="",a=0;const l=()=>{s&&r.push(i(s)),s=""};for(const i of e.matchAll(we)){const[c,d=""]=i;s+=e.slice(a,i.index),a=(i.index??0)+c.length;const u=Object.prototype.hasOwnProperty.call(t,d)?t[d]:void 0;u&&!o.has(d)?(l(),r.push(u),o.add(d)):s+=xe(c,n)}s+=e.slice(a);for(const[e,n]of Object.entries(t))o.has(e)||(s&&!/\s$/.test(s)?s+=" ":!s&&r.length>0&&(s=" "),l(),r.push(n));return l(),r}function Le(e,t){const n={};for(const[i,r]of Object.entries(t))Object.defineProperty(n,i,{enumerable:!0,get:()=>Ee(`${e}.${i}`,r)});return n}const Oe=new Set(["ar","arc","ckb","dv","fa","he","iw","ks","lrc","mzn","nqo","ps","sd","syr","ug","ur","yi","ji"]);function Ne(e){return!!e&&Oe.has((e.trim().split(/[-_]/)[0]??"").toLowerCase())}function Me(e){if(!be)return e.removeAttribute("lang"),void e.removeAttribute("dir");e.setAttribute("lang",be),e.setAttribute("dir",Ne(be)?"rtl":"ltr")}function Ue(e,t){return function(e){return"rtl"===e?.closest("[dir]")?.getAttribute("dir")}(t)?"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e:e}const Re=()=>function(e){if(e)try{return Intl.getCanonicalLocales(e)[0]}catch{return}}(be);function Fe(e){return new Intl.NumberFormat(Re()).format(e)}const Pe={day:{one:"${count} day",other:"${count} days"},week:{one:"${count} week",other:"${count} weeks"},month:{one:"${count} month",other:"${count} months"},year:{one:"${count} year",other:"${count} years"}},ze=e=>{const t=e?.trim();if(void 0!==t&&t.length>0)return t};const je=e=>Ee("redemption.subtitle","All ${app} features are now unlocked.",{app:e}),De="/config";function Be(e,t){let n=e;for(const[e,i]of Object.entries(t))n=n.replace(`:${e}`,encodeURIComponent(i));return n}const He="2.4.0",_e=new Set(["localhost","127.0.0.1","[::1]"]);function Ve(e){return _e.has(e)}function qe(e){if(!e)return;let t;try{t=new URL(e)}catch{return}return"https:"===t.protocol||"http:"===t.protocol&&Ve(t.hostname)?e:void 0}function We(e,t){if("object"!=typeof e||null===e)return;const n=e[t];if("string"!=typeof n)return;const i=n.trim();return""===i?void 0:i}function Ke(e,t){if("object"!=typeof e||null===e)return;const n=e[t];return"string"==typeof n?qe(n.trim()):void 0}const Ge=e=>"object"!=typeof e||null===e||Array.isArray(e)?void 0:e,Ye=e=>"string"==typeof e?e:void 0;function Ze(e,t=!1){const n=Ge(e);if(!n)return;const i=Object.entries(n).filter(([,e])=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e).map(([e,t])=>[e,String(t)]).filter(([e,n])=>!t||""!==e.trim()&&""!==n.trim());return i.length>0?Object.fromEntries(i):void 0}const Qe=new Set([9,10,11,12,13,28,29,30,31,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8232,8233,8239,8287,8288,12288,65279,173,847,1564,6158,10240,12644,65440].map(e=>String.fromCodePoint(e)));function Xe(e){if(!Array.isArray(e))return;const t=e.flatMap(e=>{const t=Ge(e),n=Ye(t?.title),i=Ye(t?.subtitle);if(!t||void 0===n||void 0===i)return[];const r=Ye(t.ctaButtonText),o=I(Ye(t.imageUrl));return[{title:n,subtitle:i,...null!=r&&{ctaButtonText:r},...o&&{imageUrl:o}}]});return t.length>0?t:void 0}function Je(e){const t=Ye(Ge(e.organization)?.name),n=Ye(e.perk),i=e.badgeLabel,r=We(e,"category"),o=We(e,"categoryGroup"),s=We(e,"categoryGroupDisplayName"),a=Ke(e,"heroImageUrl"),l=Ke(e,"termsUrl"),c=function(e){if("object"!=typeof e||null===e)return;const t=e.shareUrl;if("string"!=typeof t)return;const n=t.trim();if(""!==n)try{const{protocol:e}=new URL(n);return"https:"===e||"http:"===e?n:void 0}catch{return}}(e),d=function(e){if("object"!=typeof e||null===e)return;const t=e.expectedDomain;if("string"!=typeof t)return;const n=t.trim().toLowerCase().replace(/^www\./,"").replace(/\.$/,""),i="[\\p{L}\\p{N}](?:[\\p{L}\\p{N}-]*[\\p{L}\\p{N}])?";return new RegExp(`^${i}(?:\\.${i})+$`,"u").test(n)?n:void 0}(e),u=function(e){const t=Ge(e);if(!t)return;const n=Object.entries(t).filter(e=>"string"==typeof e[1]&&[...e[1]].some(e=>!Qe.has(e)));return n.length>0?Object.fromEntries(n):void 0}(e.displayProperties);return{...t&&{merchantName:t},...n&&{perk:n},...("free_trial"===i||"discount"===i)&&{badgeLabel:i},...void 0!==r&&{category:r},...void 0!==o&&{categoryGroup:o},...void 0!==s&&{categoryGroupDisplayName:s},...void 0!==a&&{heroImageUrl:a},...void 0!==l&&{termsUrl:l},...void 0!==c&&{shareUrl:c},...void 0!==d&&{expectedDomain:d},...void 0!==u&&{displayProperties:u}}}function et(e,t,n,i){const r=Ge(e.organization),o=I(Ye(n.logoUrl),Ye(r?.logoUrl)),s=Ye(n.primaryImageUrl),a=Ze(n.trackingParameters),l=I(Ye(n.ctaText)),c=Ye(n.description);return{id:i,title:Ye(n.title)??"",description:Ye(n.quickInstructions)??Ye(n.subtitle)??Ye(n.description)??"",...s&&{imageUrl:s},...l&&{ctaText:l},advertiserUrl:Ye(n.destinationUrl)??Ye(e.destinationUrl)??"",campaignId:t,creativeId:i,quickInstructions:Ye(n.quickInstructions)??"",...c&&{creativeDescription:c},instructions:Xe(n.instructions)??[],tooltipText:Ye(n.tooltipText)??"",...Je(e),...o&&{logoUrl:o},...a&&{trackingParameters:a}}}function tt(e){const t=Ye(e.id);if(!t)return null;const n=Array.isArray(e.creatives)?e.creatives:[];for(const i of n){const n=Ge(i),r=Ye(n?.id);if(n&&r&&(void 0===n?.status||"active"===n.status))return et(e,t,n,r)}return function(e,t){const n=Ge(e.organization),i=I(Ye(e.destinationUrl)),r=Ze(e.trackingParameters,!0),o=I(Ye(e.title),Ye(n?.name));if(!i||!r||!o)return null;const s=I(Ye(e.logoUrl),Ye(n?.logoUrl)),a=I(Ye(e.quickInstructions)),l=I(Ye(e.ctaText)),c=Ye(e.description);return{id:t,title:o,description:a??I(Ye(e.subtitle),Ye(e.description))??"",...l&&{ctaText:l},advertiserUrl:i,campaignId:t,quickInstructions:a??"",...c&&{creativeDescription:c},instructions:Xe(e.instructions)??[],tooltipText:I(Ye(e.tooltipText))??"",...Je(e),...s&&{logoUrl:s},trackingParameters:r}}(e,t)}function nt(e){const t=[];for(const n of e??[]){const e=Ge(n),i=e&&tt(e);i&&t.push(i)}return t}function it(e,t){return e.length<=t?e:e.slice(0,t-15)+"... [truncated]"}function rt(e,t,n){return it(""===e.trim()?n:e,t)}function ot(e,t){return Object.assign(e,{code:t})}const st=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;class at{#Se;#Ee;#Te;constructor(e,t){this.#Se=e,this.#Ee=t,this.#Te=new Map}setApiKey(e){this.#Se=e}setBaseURL(e){this.#Ee=e}async get(e,t){return this.#Ae({url:`${this.#Ee}${e}`,options:{method:"GET",...t},apiKey:this.#Se})}async post(e,t,n){return this.#Ae({url:`${this.#Ee}${e}`,options:{method:"POST",body:t,...n},apiKey:this.#Se})}async patch(e,t,n){return this.#Ae({url:`${this.#Ee}${e}`,options:{method:"PATCH",body:t,...n},apiKey:this.#Se})}async#Ae(e){const{url:t,options:n,apiKey:i}=e,r=this.#Le(t,n),o=this.#Te.get(r);if(o)return u.debug("Deduplicating request:",t),o;const s=this.#Oe(t,n,i);this.#Te.set(r,s);try{return await s}finally{this.#Te.delete(r)}}async#Oe(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.#S(e)}return await this.#Ne(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#Ne(t,n,i){const r=n.timeout??3e4,o=new AbortController,s=setTimeout(()=>o.abort(),r);try{const e={"X-API-Key":i,"X-Platform":"web","Content-Type":"application/json","User-Agent":`Encore-Web-SDK/${He}`,...n.headers},r={method:n.method,headers:e,signal:o.signal};n.body&&(r.body=JSON.stringify(n.body)),u.debug(`${n.method} ${t}`);const s=await fetch(t,r);return s.ok||await this.#Ue(s),await s.json()}catch(t){if(t instanceof Error){if("AbortError"===t.name)throw ot(new Error("Request timeout"),e.TIMEOUT);if(this.#Re(t))throw ot(new Error(`Network error: ${t.message}`),e.NETWORK_ERROR)}if(t instanceof Error)throw t;throw ot(new Error(String(t)),e.UNKNOWN_ERROR)}finally{clearTimeout(s)}}async#Ue(t){let n,i=`HTTP ${t.status}: ${t.statusText}`;try{const e=await t.json();"object"==typeof e&&null!==e&&"string"==typeof e.error&&(i=e.error,n="string"==typeof e.code?e.code:void 0)}catch{}const r={code:n??e.API_ERROR,statusCode:t.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}#Re(e){return e.message.includes("fetch")||e.message.includes("network")||e.message.includes("ECONNREFUSED")||e.message.includes("ETIMEDOUT")}#Le(e,t){const n=t.body?JSON.stringify(t.body):"";return`${t.method}:${e}:${n}`}#S(e){return new Promise(t=>setTimeout(t,e))}#Fe(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,o){try{const s=S(n),a=o?.variantId??o?.wireVariantId,l=o?.useCase,c="prefetch"===o?.purpose?{retries:0}:void 0;return{offers:nt((await this.post("/offers/search",{userId:e,attributes:t,platform:"web",sdkVersion:He,...s&&{placementId:s},...void 0!==i&&{maxPostbackTimeMs:i},...a&&st.test(a)&&{variantId:a},...l&&"reduceChurn"!==l&&{useCase:r(l)},..."prefetch"===o?.purpose&&{purpose:o.purpose}},c)).offers)}}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:r(n)}})}catch(e){throw ee(e)||u.error("Failed to start transaction:",e),e}}async sendGrantSignal(e,t){try{const n=function(e){return Be("/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,t={}){try{const n=function(e){return Be("/transactions/:transactionId/status",{transactionId:e})}(e),i=await this.get(n,t.quiet?{retries:0}:void 0);return{status:this.#Fe(i.status),raw:i.status}}catch(e){throw t.quiet?u.debug("Failed to check verification status:",e):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,i,o,s){try{const a=`${De}?userId=${encodeURIComponent(e)}&sdkVersion=${encodeURIComponent(t)}`+(n&&"reduceChurn"!==n?`&useCase=${encodeURIComponent(r(n))}`:"")+(i?`&demoVariant=${encodeURIComponent(i)}`:"")+(o?`&placementId=${encodeURIComponent(o)}`:"")+(s?`&language=${encodeURIComponent(s)}`:"");return await this.get(a)}catch(e){throw u.error("Failed to fetch config:",e),e}}async fetchTriggerConfig(e,t,n,i){const o=S(i.placementId),s=`${De}?userId=${encodeURIComponent(e)}&sdkVersion=${encodeURIComponent(t)}&trigger=${encodeURIComponent(n)}&useCase=${encodeURIComponent(r(i.useCase))}`+(o?`&placementId=${encodeURIComponent(o)}`:"")+(i.language?`&language=${encodeURIComponent(i.language)}`:"")+(i.layout?`&layout=${encodeURIComponent(i.layout)}`:"")+("off"===i.autoOpen?"&autoOpen=off":"")+(i.state?`&state=${encodeURIComponent(i.state)}`:"");return this.get(s,{timeout:1e4,retries:0})}async reportError(e){try{const n="undefined"!=typeof window?window.location.hostname:"unknown";await this.post("/errors",{errorType:it(e.errorType,100),message:rt(e.message,2e3,"Unknown error"),context:it(e.context,200),severity:e.severity??"error",timestamp:(new Date).toISOString(),platform:"web",sdkVersion:He,appBundleId:rt(n,200,"unknown"),...e.stackTrace&&{stackTrace:it(e.stackTrace,1e4)},...e.userId&&{userId:it(e.userId,200)},...e.metadata&&{metadata:(t=e.metadata,Object.fromEntries(Object.entries(t).map(([e,t])=>[e,it(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}}}const lt="unknown",ct="android",dt="ipados",ut="windows",ht=["googlebot","bingbot","headlesschrome","prerender","applebot","pinterestbot","adsbot","mediapartners-google","gptbot","claudebot","yandexbot","duckduckbot","ahrefsbot","semrushbot","bytespider","lighthouse","inspectiontool"];function pt(){const e="undefined"!=typeof screen?screen:void 0;return!(!e||"number"!=typeof e.width||"number"!=typeof e.height)&&Math.min(e.width,e.height)>0&&Math.min(e.width,e.height)<500}function ft(e){return{agentType:"browser",deviceOs:e}}let mt;function gt(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase()}function yt(e){const t={};for(const[n,i]of Object.entries(e))t[gt(n)]=i;return t}function bt(e,t=te(),n){const i="undefined"!=typeof window?window.location.hostname:"unknown",r=(mt??=function(){const e=e=>({agentType:e,deviceOs:null});try{if("undefined"==typeof window||"undefined"==typeof navigator)return e(lt);const n=navigator.userAgent;if("string"!=typeof n||""===n.trim())return e(lt);const i=n.trim().toLowerCase();if(ht.some(e=>i.includes(e)))return e("bot");if(i.includes("windows phone"))return ft(ut);if(i.includes("android"))return ft(ct);if(i.includes("iphone")||i.includes("ipod"))return ft("ios");if(i.includes("ipad"))return ft(dt);if(i.includes("macintosh")||i.includes("mac os x"))return ft("number"!=typeof(t=navigator.maxTouchPoints)?"macos_or_ipados":t<=1?"macos":pt()?"ios":dt);if(i.includes("windows"))return ft(ut);if(i.includes("linux")&&"number"==typeof navigator.maxTouchPoints&&navigator.maxTouchPoints>1){if("android"===function(){const e=navigator,t=e.userAgentData?.platform;return"string"==typeof t?t.toLowerCase():void 0}())return ft(ct);if(pt())return ft(ct)}return ft("other")}catch{return e(lt)}var t}(),mt),o=e.locale??Ie();return{event_id:t,event_name:e.name,event_timestamp:(new Date).toISOString(),distinct_id:e.distinctId,properties:{...yt(e.properties),platform:"web",agent_type:r.agentType,device_os:r.deviceOs,sdk_version:He,app_bundle_id:i,...n?{demo_variant:n}:{},...o?{locale:o}:{}}}}function vt(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 wt=new Set(["user_identified"]);class xt{#Se;#Pe;#f;#ze=null;constructor(e,t,n){this.#Se=e,this.#Pe=t,this.#f=n??null}setDemoVariant(e){this.#ze=e}track(e,t){try{if(this.#je(e))return;const n=bt(e,void 0,this.#ze);vt(this.#Pe,this.#Se,n,t).catch(t=>{u.warn("Analytics event dispatch failed",{eventName:e.name,error:t})})}catch{}}#je(e){if(!this.#f||!wt.has(e.name))return!1;const t=`analytics_dedup_${e.name}_${e.distinctId}`;try{const e=this.#f.get(t),n=Date.now();return"number"==typeof e&&n-e<864e5||(this.#f.set(t,n),!1)}catch{return!1}}}async function kt(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 $t="ncl_assignment",Ct="ncl_exposure_marker";class It{#f;#De;#Be;#n=null;constructor(e,t,n){this.#f=e,this.#De=t,this.#Be=n}setConfig(e){this.#n=e??null}async getCohort(){try{return await this.#He()}catch(e){return u.warn("[Experiment] getCohort failed — treating as notEnrolled",e),"notEnrolled"}}async#He(){const e=this.#De();if(!e)return"notEnrolled";const t=this.#n;if(!t?.enabled)return"notEnrolled";const n=this.#f.get($t);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 kt(e,t.assignmentVersion),r=function(e,t){return e<t?"treatment":"control"}(i,t.rolloutPct);return this.#f.set($t,{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.#De();if(!t||!n)return;const i=`${n}:${t.assignmentVersion}`;if(this.#f.get(Ct)===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=te();this.#Be.enqueue(r,o)&&this.#f.set(Ct,i)}async getState(){const e=this.#De(),t=this.#n,n=await this.getCohort();let i=null;if(e&&t?.enabled&&"undefined"!=typeof crypto&&crypto.subtle)try{i=await kt(e,t.assignmentVersion)}catch{i=null}const r=!!e&&!!t&&this.#f.get(Ct)===`${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 St{#Se;#Pe;#f;#_e;#L=new Set;#ze=null;constructor(e,t,n,i){this.#Se=e,this.#Pe=t,this.#f=n,this.#_e=i,this.#Y()}setDemoVariant(e){this.#ze=e}enqueue(e,t){const n=bt(e,t,this.#ze),i=this.#Ve();i.some(e=>e.event_id===t)||(i.push(n),this.#qe(i));const r=this.#Ve().some(e=>e.event_id===t);return this.#We(n),r}flush(){for(const e of this.#Ve())this.#We(e)}async#We(e){if(!this.#L.has(e.event_id)){this.#L.add(e.event_id);try{const t=await vt(this.#Pe,this.#Se,e,{keepalive:!0});t.ok?this.#Ke(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.#L.delete(e.event_id)}}}#Ke(e){const t=this.#Ve().filter(t=>t.event_id!==e);this.#qe(t)}#Ve(){return this.#f.get(this.#_e)??[]}#qe(e){this.#f.set(this.#_e,e)}#Y(){"undefined"!=typeof window&&"undefined"!=typeof document&&(window.addEventListener("pagehide",()=>this.flush()),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.flush()}))}}const Et="ncl_exposure_outbox";class Tt extends St{constructor(e,t,n){super(e,t,n,Et)}}const At="diagnostics_outbox";class Lt extends St{constructor(e,t,n){super(e,t,n,At)}}const Ot={userClosedModal:"close_button",userClickedOutside:"dismissed",userDeclinedLastOffer:"last_offer_declined"},Nt={advertiserOutcome:"not_attempted",publisherOutcome:"not_attempted",dismissal:"dismissed"};function Mt(e,t){if("claimed"===e.status)return{resolution:"presented",...Nt,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",...Nt,...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",...Nt,...void 0!==Ot[n]&&{dismissal:Ot[n]}}:{resolution:"not_presented",notPresentedReason:(i=n.error.code,`error.${i.toLowerCase()}`)}:{resolution:"presented",...Nt};var i}class Ut{#Ge;constructor(){this.#Ge=new Map}on(e,t){this.#Ge.has(e)||this.#Ge.set(e,new Set);const n=this.#Ge.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.#Ge.get(e);n&&(n.delete(t),u.debug(`Event listener removed for '${String(e)}'`),0===n.size&&this.#Ge.delete(e))}emit(e,t){const n=this.#Ge.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.#Ge.delete(e),u.debug(`All listeners removed for '${String(e)}'`)):(this.#Ge.clear(),u.debug("All event listeners removed"))}listenerCount(e){return this.#Ge.get(e)?.size??0}hasListeners(e){const t=this.#Ge.get(e);return void 0!==t&&t.size>0}}const Rt=[320,640,960,1280],Ft=["/creatives/","/apps/","/campaigns/","/organizations/","/sdk-assets/","/website-assets/"],Pt=96;function zt(e,t){return`${e.origin}/w/${t}${e.pathname}${e.search}`}function jt(e){try{const t=new URL(e);return"assets.encorekit.com"===t.hostname&&Ft.some(e=>t.pathname.startsWith(e))?t:void 0}catch{return}}function Dt(e,t,n){const i=jt(e);if(!i)return e;const r=t*(n>0?n:1),o=Math.max(...Rt);return zt(i,Rt.find(e=>e>=r)??o)}const Bt=new WeakMap;function Ht(e,t,n,i=!0,r=!0){i?e.setAttribute("loading","lazy"):e.removeAttribute("loading"),e.setAttribute("decoding","async");const o=function(e){const t=jt(e);if(t)return Rt.map(e=>`${zt(t,e)} ${e}w`).join(", ")}(t);if(o?(e.setAttribute("sizes",`${n}px`),e.setAttribute("srcset",o)):Yt(e),e.src=Dt(t,n,window.devicePixelRatio||1),function(e,t){const n=Bt.get(e);if(n&&e.removeEventListener("error",n,!0),Bt.delete(e),!t)return;const i=n=>{e.removeEventListener("error",i,!0),Bt.delete(e),n.stopImmediatePropagation(),Yt(e),e.src=t};Bt.set(e,i),e.addEventListener("error",i,!0)}(e,o?qe(t):void 0),Kt(e),r){const n=Qt(t),i=n.some(e=>Vt.has(e))||e.complete&&e.naturalWidth>0;n.forEach(e=>_t.set(e,i))}}const _t=new Map,Vt=new Set,qt=new Set,Wt=new WeakSet;function Kt(e){Wt.has(e)||(Wt.add(e),e.addEventListener("load",()=>{const t=e.currentSrc||e.src;e.naturalWidth>0&&(Vt.add(t),qt.delete(t))}),e.addEventListener("error",()=>qt.add(e.currentSrc||e.src)))}const Gt=new Map;function Yt(e){e.removeAttribute("srcset"),e.removeAttribute("sizes")}function Zt(e,t){const n=qe(e);n&&Ht(new Image,n,t,!1,!1)}function Qt(e){const t=jt(e),n=new URL(e).href;return t?[n,...Rt.map(e=>zt(t,e))]:[n]}function Xt(e){try{const t=Array.from(function(e){const t=new Set;for(const n of e){const e=qe(n);e&&Qt(e).forEach(e=>t.add(e))}return t}([e.imageUrl?.trim()?e.imageUrl:e.logoUrl]));if(0===t.length)return;const n=t.map(e=>_t.get(e)).filter(e=>void 0!==e);if(n.length>0)return n.some(Boolean);const i=[...Array.from(document.images),...Gt.values()].filter(e=>t.includes(e.currentSrc||e.src));return!!i.some(e=>e.complete&&e.naturalWidth>0)||!(i.length>0||t.some(e=>qt.has(e)))&&(!!t.some(e=>Vt.has(e))||void 0)}catch{return}}const Jt=16;function en(e,t,n){return Math.min(n,Math.max(t,e))}function tn(e,t,n){return(.2126*e+.7152*t+.0722*n)/255}function nn(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 rn(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(en(255*(e+c),0,255)).toString(16).padStart(2,"0");return`#${d(s)}${d(a)}${d(l)}`}(e,en(t,.45,.95),en(n,.45,.62))}const on=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,sn=/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(\s*[0-9a-z.,%\s/+-]{1,80}\)$/i,an=/^[a-z]{3,24}$/i,ln=/^var\(\s*--[a-z0-9_-]{1,60}\s*(?:,[a-z0-9#%.,\s-]{0,60})?\)$/i,cn=/^[a-z0-9\s,'"_\-\u00C0-\u024F\u1E00-\u1EFF]{1,128}$/i,dn=/^(?:0|-?(?:\d{1,5}|\d{0,5}\.\d{1,3})(?:px|rem|em|%|pt|vh|vw|ch|ex))$/i,un=/^(?:normal|bold|lighter|bolder)$/i,hn=new Set(["left","center","right","start","end"]),pn=/\/\*|\*\/|[;{}<>\\]/;function fn(e,t){u.warn(`[Encore SDK] Ignoring unsupported ${e} appearance value`,{value:t})}function mn(e){if(null==e)return;if("string"!=typeof e)return null;const t=e.trim();return 0!==t.length?t.length>128||pn.test(t)?null:t:void 0}function gn(e){const t=mn(e);if(void 0!==t)return null===t?fn("colour",e):on.test(t)||sn.test(t)||an.test(t)||ln.test(t)?t:fn("colour",e)}function yn(e){const t=mn(e);if(void 0!==t)return null===t?fn("font-family",e):cn.test(t)?t:fn("font-family",e)}function bn(e){const t=mn(e);if(void 0!==t)return null===t?fn("length",e):dn.test(t)?t:fn("length",e)}function vn(e){if(null==e)return;if("number"==typeof e)return Number.isInteger(e)&&e>=1&&e<=1e3?String(e):fn("font-weight",e);const t=mn(e);if(void 0===t)return;if(null===t)return fn("font-weight",e);if(un.test(t))return t;const n=Number(t);return Number.isInteger(n)&&n>=1&&n<=1e3?t:fn("font-weight",e)}const wn="encore-sdk-styles",xn="encore-",kn="767px",$n="#B728F5";function Cn(e){const t={},n=gn(e.primaryColor),i=gn(e.backgroundColor),r=gn(e.textColor),o=bn(e.borderRadius),s=yn(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 In="12px",Sn="20px",En="40px";function Tn(e={}){const t=Cn(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 \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 \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 \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 \n .${xn}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 .${xn}backdrop.${xn}visible {\n opacity: 1;\n }\n\n \n .${xn}modal,\n .${xn}modal *,\n .${xn}backdrop {\n box-sizing: border-box;\n }\n\n \n .${xn}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 \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: start;\n text-transform: none;\n text-indent: 0;\n white-space: normal;\n text-shadow: none;\n }\n\n .${xn}modal.${xn}visible {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n\n \n @media (min-width: 768px) {\n .${xn}modal.${xn}modal-sdui {\n \n width: min(720px, 86vw, 86vh);\n height: min(720px, 86vw, 86vh);\n \n --sdui-container-height: min(720px, 86vw, 86vh);\n max-width: none;\n max-height: none;\n background-color: #ffffff;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n .${xn}modal.${xn}modal-sdui .${xn}modal-body {\n flex: 1;\n min-height: 0;\n overflow: hidden;\n }\n \n .${xn}modal.${xn}modal-sdui.${xn}modal-fit {\n height: auto;\n max-height: min(720px, 86vw, 86vh);\n }\n \n .${xn}backdrop.${xn}backdrop-sdui {\n background-color: var(--encore-sdui-backdrop, #f2f2f7);\n backdrop-filter: blur(12px);\n }\n }\n\n \n @media (max-width: ${kn}) {\n .${xn}modal.${xn}modal-sheet {\n top: auto;\n bottom: 0;\n height: calc(var(--encore-sheet-fraction, 1) * 100vh);\n height: calc(var(--encore-sheet-fraction, 1) * 100dvh);\n border-radius: var(--encore-sheet-radius, 20px) var(--encore-sheet-radius, 20px) 0 0;\n transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1),\n height 300ms cubic-bezier(0.2, 0.8, 0.2, 1);\n touch-action: pan-x;\n }\n .${xn}modal.${xn}modal-sheet[data-sheet-dragging] {\n transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n }\n\n \n [data-sdui-locked] [data-sdui-close] {\n display: none !important;\n }\n\n [data-sdui="button"]:focus,\n [data-sdui-part="tap"]:focus {\n outline: none;\n }\n\n @media (hover: hover) and (pointer: fine) {\n [data-sdui="button"]:focus-visible,\n [data-sdui-part="tap"]:focus-visible {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n }\n\n \n .${xn}toast {\n position: fixed;\n left: 50%;\n bottom: calc(24px + env(safe-area-inset-bottom));\n transform: translate(-50%, 8px);\n z-index: 10000;\n max-width: calc(100vw - 32px);\n padding: 10px 16px;\n border-radius: 999px;\n background: rgba(28, 28, 30, 0.92);\n color: #ffffff;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n font-size: 14px;\n font-weight: 500;\n line-height: 1.3;\n text-align: center;\n pointer-events: none;\n opacity: 0;\n transition: opacity 200ms ease, transform 200ms ease;\n }\n .${xn}toast.${xn}toast-visible {\n opacity: 1;\n transform: translate(-50%, 0);\n }\n @media (prefers-reduced-motion: reduce) {\n .${xn}toast { transition: none; }\n }\n\n \n .${xn}close-button {\n position: absolute;\n top: 20px;\n inset-inline-end: 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 .${xn}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 .${xn}close-button:active {\n transform: scale(0.98);\n }\n\n .${xn}close-button:hover {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n .${xn}close-button svg {\n width: 18px;\n height: 18px;\n }\n\n \n body.${xn}no-scroll {\n overflow: hidden;\n }\n\n \n .${xn}modal-header {\n padding: 24px 24px 16px;\n border-bottom: 1px solid var(--encore-border-color);\n }\n\n .${xn}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 .${xn}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 \n .${xn}modal-body {\n padding: 0;\n position: relative;\n isolation: isolate;\n }\n\n \n .${xn}carousel {\n display: flex;\n flex-direction: column;\n overflow: visible;\n }\n\n \n .${xn}carousel-header {\n padding: 40px 68px 28px;\n text-align: center;\n }\n\n .${xn}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 .${xn}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 \n .${xn}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 .${xn}carousel-cards::-webkit-scrollbar {\n display: none;\n }\n\n \n .${xn}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 \n .${xn}carousel-item.${xn}active {\n opacity: 1;\n z-index: 1;\n }\n\n \n .${xn}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 \n .${xn}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 .${xn}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 .${xn}offer-banner-image.${xn}loaded {\n opacity: 1;\n }\n\n .${xn}offer-card .${xn}offer-banner.${xn}offer-banner-logo {\n height: 120px;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--encore-surface-color);\n }\n\n .${xn}offer-banner.${xn}offer-banner-logo .${xn}offer-banner-image {\n width: 72px;\n height: 72px;\n object-fit: contain;\n border-radius: 16px;\n }\n\n \n .${xn}banner-info-button {\n position: absolute;\n top: 20px;\n inset-inline-end: 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 .${xn}banner-info-button:hover {\n background-color: var(--encore-border-color);\n transform: scale(1.05);\n }\n\n .${xn}banner-info-button:focus {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n .${xn}banner-info-button svg {\n width: 14px;\n height: 14px;\n color: var(--encore-text-color);\n stroke-width: 2;\n }\n\n \n .${xn}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 .${xn}tooltip-visible {\n opacity: 1;\n transform: translateY(0);\n }\n\n \n .${xn}tooltip::after {\n content: '';\n position: absolute;\n width: 0;\n height: 0;\n border-style: solid;\n }\n\n .${xn}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 .${xn}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 .${xn}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 .${xn}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 \n .${xn}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 \n .${xn}offer-merchant {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n min-width: 0;\n }\n\n .${xn}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 .${xn}offer-logo.${xn}loaded {\n opacity: 1;\n }\n\n .${xn}offer-merchant-text {\n display: flex;\n flex-direction: column;\n gap: 2px;\n flex: 1;\n min-width: 0;\n }\n\n .${xn}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 .${xn}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 \n .${xn}button-claim {\n padding: 8px 16px;\n min-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: normal;\n overflow-wrap: anywhere;\n text-align: center;\n line-height: 1.2;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .${xn}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 .${xn}button-claim:active {\n transform: translateY(0);\n background: color-mix(in srgb, var(--encore-primary-color) 75%, black);\n }\n\n .${xn}button-claim:focus {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n .${xn}button-claim:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n transform: none;\n }\n\n \n .${xn}carousel-navigation {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 40px;\n padding: 28px 32px 32px;\n }\n\n .${xn}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 .${xn}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 .${xn}nav-button:active:not(:disabled) {\n transform: scale(0.95);\n }\n\n .${xn}nav-button:focus {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n .${xn}nav-button svg {\n width: 20px;\n height: 20px;\n stroke-width: 2;\n }\n\n .${xn}nav-button:not(:disabled) {\n border-color: var(--encore-primary-color);\n color: var(--encore-primary-color);\n }\n\n .${xn}nav-button:disabled,\n .${xn}nav-button.${xn}disabled {\n opacity: 1;\n cursor: not-allowed;\n border-color: var(--encore-text-muted);\n color: var(--encore-text-muted);\n }\n\n .${xn}nav-button:disabled:hover,\n .${xn}nav-button.${xn}disabled:hover {\n border-color: var(--encore-text-muted);\n color: var(--encore-text-muted);\n transform: none;\n }\n\n \n .${xn}loading {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 48px;\n }\n\n .${xn}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: ${xn}spin 0.8s linear infinite;\n }\n\n @keyframes ${xn}spin {\n to { transform: rotate(360deg); }\n }\n\n \n @media (max-width: ${kn}) {\n \n .${xn}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 \n .${xn}modal.${xn}visible {\n transform: none;\n }\n\n \n .${xn}modal-body {\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n flex-direction: column;\n }\n\n \n .${xn}carousel {\n flex: 1 1 auto;\n min-height: 0;\n overflow: hidden;\n }\n\n \n .${xn}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 .${xn}carousel-title {\n font-size: 22px;\n }\n\n .${xn}carousel-subtitle {\n font-size: 14px;\n }\n\n \n .${xn}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 \n .${xn}carousel-item {\n flex: 0 0 auto;\n width: 100%;\n opacity: 1;\n scroll-snap-align: none;\n overflow: visible;\n }\n\n \n .${xn}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 \n .${xn}offer-banner {\n height: auto;\n padding: 0;\n border-radius: 16px 16px 0 0;\n }\n\n .${xn}offer-banner-image {\n width: 100%;\n height: auto;\n display: block;\n }\n\n \n .${xn}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 .${xn}offer-merchant {\n flex: 1 1 auto;\n min-width: 0;\n }\n\n \n .${xn}button-claim {\n flex: 0 0 auto;\n width: auto;\n }\n\n \n .${xn}carousel-navigation {\n display: none;\n }\n\n \n .${xn}close-button {\n top: calc(16px + env(safe-area-inset-top));\n inset-inline-end: 16px;\n }\n\n \n .${xn}carousel-paged .${xn}carousel-navigation {\n display: flex;\n }\n\n \n }\n\n \n @media (min-width: 768px) and (max-width: 1023px) {\n .${xn}modal {\n max-width: 600px;\n }\n }\n\n \n @media (min-width: 1024px) {\n .${xn}modal {\n max-width: 600px;\n }\n }\n\n \n @media (prefers-contrast: high) {\n .${xn}button {\n border: 2px solid currentColor;\n }\n }\n\n \n @media (prefers-reduced-motion: reduce) {\n .${xn}backdrop,\n .${xn}modal,\n .${xn}button,\n .${xn}close-button {\n transition: none;\n }\n\n .${xn}spinner {\n animation: none;\n }\n }\n\n \n .${xn}button:focus-visible,\n .${xn}close-button:focus-visible {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n\n \n \n .${xn}carousel-paged .${xn}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 \n scroll-behavior: auto;\n gap: 12px;\n \n padding: ${Sn} 0;\n \n --encore-page-size: min(100% - 64px, 480px);\n }\n\n .${xn}carousel-paged .${xn}carousel-item {\n \n flex: 0 0 auto;\n width: var(--encore-page-size);\n max-width: 100%;\n \n opacity: 0.65;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n overflow: visible;\n }\n\n \n .${xn}carousel-paged .${xn}carousel-item:first-child {\n margin-inline-start: calc((100% - var(--encore-page-size)) / 2);\n }\n\n .${xn}carousel-paged .${xn}carousel-item:last-child {\n margin-inline-end: calc((100% - var(--encore-page-size)) / 2);\n }\n\n .${xn}carousel-paged .${xn}carousel-item.${xn}active {\n opacity: 1;\n }\n\n .${xn}carousel-paged .${xn}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 \n .${xn}carousel-paged .${xn}offer-banner {\n height: auto;\n }\n\n .${xn}carousel-paged .${xn}offer-banner-image {\n width: 100%;\n height: auto;\n display: block;\n }\n\n \n .${xn}carousel-paged .${xn}carousel-navigation {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 24px;\n padding: 4px 20px ${Sn};\n }\n\n .${xn}carousel-paged .${xn}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 \n .${xn}carousel-paged .${xn}nav-button:not(:disabled) {\n border-color: var(--encore-border-color);\n color: var(--encore-text-color);\n }\n\n .${xn}carousel-paged .${xn}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 .${xn}carousel-paged .${xn}nav-button svg {\n width: 22px;\n height: 22px;\n }\n\n .${xn}carousel-paged .${xn}nav-button:disabled,\n .${xn}carousel-paged .${xn}nav-button.${xn}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 \n \n .${xn}thankyou {\n display: flex;\n flex-direction: column;\n }\n\n \n .${xn}thankyou-status {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n padding: ${En} 24px 0;\n }\n\n \n .${xn}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 + ${In});\n }\n\n .${xn}thankyou-check svg {\n width: 24px;\n height: 24px;\n }\n\n \n .${xn}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 \n .${xn}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 \n .${xn}thankyou .${xn}carousel-cards {\n padding-top: 16px;\n padding-bottom: ${In};\n }\n\n \n @media (max-width: ${kn}) {\n .${xn}thankyou {\n flex: 1 1 auto;\n min-height: 0;\n }\n\n .${xn}thankyou-status {\n flex: 0 0 auto;\n padding-top: calc(${En} + env(safe-area-inset-top));\n }\n\n .${xn}thankyou-check {\n width: 44px;\n height: 44px;\n }\n\n .${xn}thankyou .${xn}carousel {\n flex: 1 1 auto;\n min-height: 0;\n justify-content: center;\n }\n\n .${xn}thankyou .${xn}carousel-cards {\n flex: 0 1 auto;\n min-height: 0;\n }\n }\n\n \n .${xn}thankyou--reward .${xn}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 .${xn}thankyou--reward .${xn}thankyou-subtitle {\n font-size: 16px;\n font-weight: 400;\n line-height: 1.35;\n text-align: center;\n }\n\n .${xn}thankyou--reward .${xn}thankyou-status {\n padding-left: 20px;\n padding-right: 20px;\n }\n\n \n @media (max-width: ${kn}) {\n .${xn}thankyou--reward .${xn}carousel-cards {\n padding-left: 20px;\n padding-right: 20px;\n }\n }\n\n \n .${xn}thankyou--reward .${xn}carousel-item[aria-selected] {\n cursor: pointer;\n }\n\n \n .${xn}carousel-select:focus {\n outline: none;\n }\n\n @media (hover: hover) and (pointer: fine) {\n \n .${xn}carousel-select:focus-visible:not(.${xn}carousel-select--quiet) {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: -2px;\n border-radius: 16px;\n }\n }\n\n \n .${xn}page-indicator {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 8px;\n padding: 19px 20px 0;\n }\n\n \n .${xn}dot {\n flex: 0 0 auto;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n \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 .${xn}dot.${xn}active {\n width: 10px;\n height: 10px;\n background: var(--encore-dot-active-color, var(--encore-reward-brand));\n }\n\n \n .${xn}reward-actions {\n display: flex;\n flex-direction: column;\n gap: 12px;\n \n padding: 20px 20px max(31px, env(safe-area-inset-bottom));\n }\n\n .${xn}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 }\n\n .${xn}reward-cta-stack {\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n\n \n .${xn}reward-cta-primary,\n .${xn}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 .${xn}reward-cta-primary:disabled,\n .${xn}reward-cta-primary[aria-disabled='true'] {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .${xn}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 \n .${xn}reward-cta-primary:hover {\n box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.12);\n }\n\n .${xn}reward-cta-primary:active {\n box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.2);\n }\n\n .${xn}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 .${xn}reward-cta-secondary:hover {\n border-color: rgba(0, 0, 0, 0.22);\n color: var(--encore-text-color);\n }\n\n .${xn}reward-cta-primary:focus-visible,\n .${xn}reward-cta-secondary:focus-visible {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n \n\n \n .${xn}gift {\n display: flex;\n flex-direction: column;\n gap: 22px;\n }\n\n .${xn}gift-hero {\n position: relative;\n display: flex;\n \n align-items: flex-start;\n justify-content: center;\n height: 258px;\n flex: none;\n }\n\n .${xn}gift-box {\n position: relative;\n width: 270px;\n height: 236px;\n }\n\n .${xn}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 .${xn}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 .${xn}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 \n .${xn}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 .${xn}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 .${xn}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 .${xn}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 .${xn}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 .${xn}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 .${xn}gift-box-bow svg {\n display: block;\n width: 100px;\n height: 36px;\n }\n\n \n .${xn}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 .${xn}gift-tile--t1 {\n transform: translate(-74px, -88px);\n }\n\n .${xn}gift-tile--t2 {\n transform: translate(-7px, -126px);\n }\n\n .${xn}gift-tile--t3 {\n transform: translate(72px, -88px);\n }\n\n .${xn}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 .${xn}gift-tile--t2 .${xn}gift-tile-inner {\n width: 78px;\n height: 78px;\n border-radius: 22px;\n font-size: 18px;\n }\n\n .${xn}gift-tile--t1 .${xn}gift-tile-inner {\n transform: rotate(-12deg);\n }\n\n .${xn}gift-tile--t3 .${xn}gift-tile-inner {\n transform: rotate(12deg);\n }\n\n .${xn}gift-tile-image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n \n .${xn}gift-box--solo .${xn}gift-tile--t1,\n .${xn}gift-box--solo .${xn}gift-tile--t3 {\n display: none;\n }\n\n \n .${xn}gift-hero--play .${xn}gift-box-lid,\n .${xn}gift-hero--play .${xn}gift-box-bow {\n animation: ${xn}gift-lid 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s both;\n }\n\n .${xn}gift-hero--play .${xn}gift-tile--t1 {\n animation: ${xn}gift-rise1 0.7s cubic-bezier(0.2, 1.2, 0.3, 1) 0.45s both;\n }\n\n .${xn}gift-hero--play .${xn}gift-tile--t2 {\n animation: ${xn}gift-rise2 0.7s cubic-bezier(0.2, 1.2, 0.3, 1) 0.38s both;\n }\n\n .${xn}gift-hero--play .${xn}gift-tile--t3 {\n animation: ${xn}gift-rise3 0.7s cubic-bezier(0.2, 1.2, 0.3, 1) 0.52s both;\n }\n\n @keyframes ${xn}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 ${xn}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 ${xn}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 ${xn}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 \n @keyframes ${xn}gift-in {\n from {\n opacity: 0;\n visibility: hidden;\n \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 \n .${xn}gift-hero--play ~ .${xn}gift .${xn}gift-row--intro {\n animation: ${xn}gift-in 0.46s cubic-bezier(0.2, 1.2, 0.3, 1) 0.62s both;\n }\n\n .${xn}gift-hero--play ~ .${xn}gift .${xn}gift-row--intro:nth-child(2) {\n animation-delay: 0.69s;\n }\n\n .${xn}gift-hero--play ~ .${xn}gift .${xn}gift-row--intro:nth-child(3) {\n animation-delay: 0.76s;\n }\n\n \n .${xn}gift-hero--play ~ .${xn}reward-actions {\n animation: ${xn}gift-in 0.46s cubic-bezier(0.2, 1.2, 0.3, 1) 0.83s both;\n }\n\n \n @media (prefers-reduced-motion: reduce) {\n .${xn}gift-hero--play .${xn}gift-box-lid,\n .${xn}gift-hero--play .${xn}gift-box-bow {\n animation: none;\n opacity: 0;\n }\n .${xn}gift-hero--play .${xn}gift-tile--t1 {\n animation: none;\n opacity: 1;\n transform: translate(-74px, -88px);\n }\n .${xn}gift-hero--play .${xn}gift-tile--t2 {\n animation: none;\n opacity: 1;\n transform: translate(-7px, -126px);\n }\n .${xn}gift-hero--play .${xn}gift-tile--t3 {\n animation: none;\n opacity: 1;\n transform: translate(72px, -88px);\n }\n .${xn}gift-row,\n .${xn}gift-sheet,\n .${xn}gift-scrim {\n transition: none;\n }\n \n .${xn}gift-hero--play ~ .${xn}gift .${xn}gift-row--intro,\n .${xn}gift-hero--play ~ .${xn}reward-actions {\n animation: none;\n }\n }\n\n \n .${xn}gift-hero .${xn}reward-confetti {\n z-index: 7;\n }\n\n \n .${xn}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 \n background: linear-gradient(180deg, #f5f9ff 0%, #ffffff 46%);\n color: var(--encore-gift-ink);\n \n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n min-height: 0;\n flex: 1 1 auto;\n }\n\n \n \n .${xn}thankyou--gift .${xn}gift-sheet-layer {\n position: fixed;\n }\n\n \n .${xn}thankyou--gift .${xn}thankyou-status {\n padding-top: 0;\n }\n\n \n .${xn}gift-em {\n color: var(--encore-gift-accent);\n font-style: normal;\n }\n\n .${xn}thankyou--gift .${xn}thankyou-title {\n color: var(--encore-gift-ink);\n }\n\n .${xn}thankyou--gift .${xn}thankyou-subtitle,\n .${xn}thankyou--gift .${xn}reward-trust,\n .${xn}thankyou--gift .${xn}reward-terms {\n color: var(--encore-gift-muted);\n }\n\n \n .${xn}thankyou--gift .${xn}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 .${xn}thankyou--gift .${xn}reward-cta-primary:hover {\n background: var(--encore-gift-accent);\n filter: brightness(0.94);\n }\n\n .${xn}thankyou--gift .${xn}reward-cta-link,\n .${xn}thankyou--gift .${xn}reward-cta-link:hover {\n background: none;\n color: var(--encore-gift-muted);\n }\n\n .${xn}thankyou--gift .${xn}reward-cta-secondary {\n border-color: var(--encore-gift-line);\n color: var(--encore-gift-ink);\n }\n\n \n .${xn}thankyou--gift .${xn}gift-row,\n .${xn}thankyou--gift .${xn}gift-card {\n background: var(--encore-gift-surface);\n border-color: var(--encore-gift-line);\n color: var(--encore-gift-ink);\n }\n\n .${xn}thankyou--gift .${xn}gift-row[aria-checked='true'],\n .${xn}thankyou--gift .${xn}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 .${xn}thankyou--gift .${xn}gift-row-secondary,\n .${xn}thankyou--gift .${xn}gift-sheet-fine {\n color: var(--encore-gift-muted);\n }\n\n .${xn}thankyou--gift .${xn}gift-row-radio {\n border-color: #c9ccd3;\n background: var(--encore-gift-surface);\n }\n\n .${xn}thankyou--gift\n .${xn}gift-row[aria-checked='true']\n .${xn}gift-row-radio {\n border-color: var(--encore-gift-accent);\n background: var(--encore-gift-accent);\n }\n\n .${xn}thankyou--gift .${xn}gift-sheet,\n .${xn}thankyou--gift .${xn}gift-sheet-title {\n background-color: var(--encore-gift-surface);\n color: var(--encore-gift-ink);\n }\n\n .${xn}thankyou--gift .${xn}gift-row:focus-visible,\n .${xn}thankyou--gift .${xn}gift-card:focus-visible,\n .${xn}thankyou--gift .${xn}reward-cta-primary:focus-visible,\n .${xn}thankyou--gift .${xn}reward-cta-secondary:focus-visible {\n outline-color: var(--encore-gift-accent);\n }\n\n \n\n \n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}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 \n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}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 \n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}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 \n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}gift-rows {\n gap: 9px;\n padding: 22px 20px 0;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}gift-row {\n min-height: 62px;\n gap: 12px;\n }\n\n \n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}gift-row-primary {\n font-size: 15px;\n font-weight: 700;\n letter-spacing: -0.2px;\n line-height: 1.25;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}gift-row-secondary {\n font-size: 12px;\n font-weight: 500;\n color: #8a8c93;\n margin-top: 1px;\n }\n\n \n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}gift-row-icon {\n width: 34px;\n height: 34px;\n border-radius: 9px;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}gift-row-radio {\n border-color: #c9ccd3;\n }\n\n \n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}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 \n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}reward-terms {\n font-size: 11.5px;\n color: #b0b2b8;\n padding: 10px 20px 0;\n }\n\n \n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}reward-cta-link,\n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}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 \n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}reward-actions {\n padding-left: 0;\n padding-right: 0;\n gap: 0;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift .${xn}reward-cta-stack {\n padding: 0 20px;\n gap: 0;\n }\n\n \n .${xn}thankyou--reward.${xn}thankyou--gift {\n padding-top: max(22px, env(safe-area-inset-top));\n }\n\n \n \n @media (max-height: 820px) {\n \n .${xn}gift-hero {\n height: 194px;\n }\n .${xn}gift-box {\n transform: scale(0.8);\n transform-origin: 50% 0;\n }\n }\n\n \n @media (max-height: 700px) {\n \n .${xn}gift-hero {\n height: 128px;\n }\n .${xn}gift-box {\n transform: scale(0.54);\n }\n .${xn}gift {\n gap: 14px;\n }\n .${xn}thankyou--gift .${xn}reward-actions {\n padding-top: 12px;\n }\n \n .${xn}thankyou--reward.${xn}thankyou--gift\n .${xn}gift-rows {\n padding-top: 12px;\n }\n .${xn}thankyou--reward.${xn}thankyou--gift\n .${xn}reward-trust {\n padding-bottom: 6px;\n }\n }\n\n \n .${xn}gift-rows {\n display: flex;\n flex-direction: column;\n gap: 9px;\n padding: 0 20px;\n }\n\n .${xn}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: start;\n cursor: pointer;\n transition: background 0.15s, border-color 0.15s;\n }\n\n .${xn}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 .${xn}gift-row:focus-visible,\n .${xn}gift-card:focus-visible,\n .${xn}gift-sheet-close:focus-visible {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n .${xn}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 .${xn}gift-row-icon img,\n .${xn}gift-card-icon img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .${xn}gift-row-text {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-width: 0;\n gap: 1px;\n }\n\n .${xn}gift-row-primary {\n font-size: 15px;\n font-weight: 700;\n line-height: 1.25;\n }\n\n .${xn}gift-row-secondary {\n font-size: 12px;\n font-weight: 500;\n color: var(--encore-text-muted);\n }\n\n .${xn}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 .${xn}gift-row[aria-checked='true'] .${xn}gift-row-radio {\n border-color: var(--encore-primary-color);\n background: var(--encore-primary-color);\n }\n\n .${xn}gift-row[aria-checked='true'] .${xn}gift-row-radio::after {\n content: '';\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: #fff;\n }\n\n \n .${xn}gift-sheet-layer {\n position: absolute;\n inset: 0;\n z-index: 2;\n pointer-events: none;\n }\n\n .${xn}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 .${xn}gift-scrim--open {\n opacity: 1;\n pointer-events: auto;\n }\n\n .${xn}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 \n .${xn}gift-sheet[hidden] {\n display: none;\n }\n\n .${xn}gift-sheet--open {\n transform: none;\n }\n\n .${xn}gift-sheet-header {\n display: flex;\n align-items: center;\n gap: 8px;\n }\n\n .${xn}gift-sheet-title {\n flex: 1;\n margin: 0;\n padding-inline-end: 28px;\n font-size: 17px;\n font-weight: 800;\n text-align: center;\n }\n\n .${xn}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 \n .${xn}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 .${xn}gift-sheet-tabs::-webkit-scrollbar {\n display: none;\n }\n\n .${xn}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 .${xn}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 .${xn}gift-sheet-tab:focus-visible {\n outline: 2px solid #163bf5;\n outline-offset: -2px;\n }\n\n \n .${xn}gift-sheet-panel {\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n min-height: 0;\n }\n\n \n .${xn}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 .${xn}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: start;\n cursor: pointer;\n }\n\n .${xn}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 .${xn}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 .${xn}gift-card-label {\n font-size: 14px;\n font-weight: 700;\n line-height: 1.25;\n }\n\n .${xn}gift-sheet-cta {\n margin-top: 12px;\n flex: none;\n }\n\n .${xn}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 \n .${xn}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 .${xn}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.${xn}gift-terms-link {\n margin: 0;\n padding: 0;\n border: 0;\n background: none;\n cursor: pointer;\n }\n\n \n .${xn}reward-terms {\n margin: 0;\n font-size: 12px;\n color: var(--encore-text-muted);\n text-align: center;\n }\n\n .${xn}reward-cta-link,\n .${xn}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 \n .${xn}slot-custom {\n font: inherit;\n color: inherit;\n letter-spacing: normal;\n margin: 0;\n }\n\n .${xn}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 .${xn}slot-host:hover,\n .${xn}slot-host:active {\n box-shadow: none;\n border-color: transparent;\n color: inherit;\n }\n\n \n @media (max-width: ${kn}) {\n .${xn}thankyou--reward .${xn}reward-actions {\n flex: 0 0 auto;\n margin-top: auto;\n }\n }\n\n \n\n \n .${xn}thankyou--reward {\n --encore-reward-brand: ${$n};\n --encore-reward-brand-deep: #6515ED;\n \n position: relative;\n }\n\n \n .${xn}thankyou--reward > .${xn}thankyou-status,\n .${xn}thankyou--reward > .${xn}carousel,\n .${xn}thankyou--reward > .${xn}gift-hero,\n .${xn}thankyou--reward .${xn}gift-rows,\n .${xn}thankyou--reward > .${xn}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 \n .${xn}thankyou--reward .${xn}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 .${xn}thankyou--reward .${xn}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 \n color: color-mix(in srgb, var(--encore-text-color) 55%, transparent);\n }\n\n \n .${xn}thankyou--reward .${xn}carousel {\n position: relative;\n }\n\n .${xn}thankyou--reward .${xn}carousel-cards {\n gap: 10px;\n \n padding: 26px calc(50% - 105px);\n align-items: center;\n }\n\n .${xn}thankyou--reward .${xn}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 \n .${xn}thankyou--reward .${xn}carousel-item.${xn}active {\n opacity: 1;\n transform: none;\n z-index: 1;\n }\n\n \n @property --encore-card-tint {\n syntax: '<color>';\n inherits: false;\n initial-value: ${$n};\n }\n\n \n .${xn}reward-card {\n --encore-card-tint: ${$n};\n position: relative;\n box-sizing: border-box;\n width: 210px;\n height: 260px;\n \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 \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 .${xn}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 \n .${xn}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 .${xn}reward-card-icon-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n display: block;\n }\n\n \n .${xn}reward-card-monogram {\n font-size: 32px;\n font-weight: 700;\n line-height: 1;\n color: #ffffff;\n }\n\n \n .${xn}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 \n .${xn}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 \n .${xn}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 \n .${xn}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 .${xn}reward-arrow svg {\n width: 20px;\n height: 20px;\n display: block;\n }\n\n .${xn}reward-arrow-prev {\n inset-inline-start: 12px;\n }\n\n .${xn}reward-arrow-next {\n inset-inline-end: 12px;\n }\n\n [dir='rtl'] .${xn}nav-button svg,\n [dir='rtl'] .${xn}reward-arrow svg,\n [dir='rtl'] .${xn}unwrap-back-icon {\n scale: -1 1;\n }\n\n .${xn}reward-arrow:hover {\n background: #ffffff;\n }\n\n .${xn}reward-arrow:focus-visible {\n outline: 2px solid var(--encore-reward-brand);\n outline-offset: 2px;\n }\n\n \n .${xn}reward-arrow:disabled {\n opacity: 0.35;\n cursor: default;\n }\n\n \n .${xn}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 \n @media (prefers-reduced-motion: reduce) {\n .${xn}thankyou--reward .${xn}carousel-item,\n .${xn}reward-card,\n .${xn}dot,\n .${xn}reward-arrow {\n transition: none;\n }\n }\n\n \n .${xn}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: ${xn}fade-in 0.3s ease-out;\n }\n\n .${xn}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: ${xn}scale-in 0.5s ease-out;\n }\n\n .${xn}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 .${xn}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 .${xn}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 .${xn}success-detail {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0.5rem 0;\n }\n\n .${xn}success-detail:not(:last-child) {\n border-bottom: 1px solid rgba(0, 0, 0, 0.05);\n }\n\n .${xn}success-detail-label {\n font-size: 0.875rem;\n color: var(--encore-text-muted);\n font-weight: 500;\n }\n\n .${xn}success-detail-value {\n font-size: 1rem;\n color: var(--encore-text-color);\n font-weight: 600;\n }\n\n .${xn}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 .${xn}success-button:hover {\n transform: translateY(-2px);\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);\n }\n\n .${xn}success-button:active {\n transform: translateY(0);\n }\n\n .${xn}success-button:focus-visible {\n outline: 2px solid var(--encore-primary-color);\n outline-offset: 2px;\n }\n\n @keyframes ${xn}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 \n @keyframes ${xn}fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n \n\n \n .${xn}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 \n .${xn}lockup {\n display: flex;\n justify-content: center;\n align-items: center;\n margin: 0.5rem 0 1.5rem 0;\n }\n\n .${xn}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 .${xn}lockup-tile-partner {\n transform: rotate(-4deg);\n animation: ${xn}lockup-settle-left 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards;\n z-index: 1;\n }\n\n .${xn}lockup-tile-host {\n margin-inline-start: -10px;\n transform: rotate(4deg);\n animation: ${xn}lockup-settle-right 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards;\n z-index: 2;\n }\n\n @keyframes ${xn}lockup-settle-left {\n from { transform: rotate(-6deg) translateX(-4px); }\n to { transform: rotate(-4deg) translateX(0); }\n }\n\n @keyframes ${xn}lockup-settle-right {\n from { transform: rotate(6deg) translateX(4px); }\n to { transform: rotate(4deg) translateX(0); }\n }\n\n \n .${xn}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: start;\n overflow: hidden;\n }\n\n .${xn}ledger-row {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 14px 16px;\n }\n\n .${xn}ledger-row + .${xn}ledger-row {\n border-top: 1px solid var(--encore-border-color);\n }\n\n \n .${xn}ledger-logo {\n width: 44px;\n height: 44px;\n border-radius: 11px;\n object-fit: cover;\n flex-shrink: 0;\n }\n\n img.${xn}ledger-logo {\n display: block;\n }\n\n .${xn}ledger-text {\n display: flex;\n flex-direction: column;\n gap: 2px;\n flex: 1 1 auto;\n min-width: 0;\n }\n\n .${xn}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 .${xn}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 .${xn}ledger-status {\n font-size: 0.85rem;\n font-weight: 600;\n flex-shrink: 0;\n }\n\n .${xn}ledger-status-active {\n color: var(--encore-success-color);\n }\n\n .${xn}ledger-status-pending {\n color: var(--encore-text-muted);\n }\n\n \n .${xn}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: ${xn}fade-in 0.3s ease-out;\n }\n\n .${xn}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 .${xn}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 \n .${xn}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 \n .${xn}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: ${xn}fade-in 0.3s ease-out;\n }\n\n .${xn}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 .${xn}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 .${xn}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 .${xn}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 \n @media (max-width: ${kn}) {\n \n .${xn}primer-container,\n .${xn}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 \n .${xn}primer-container .${xn}lockup {\n margin-top: auto;\n }\n\n .${xn}primer-cta {\n margin-top: auto;\n }\n\n .${xn}redemption-container > :first-child {\n margin-top: auto;\n }\n\n .${xn}redemption-cta {\n margin-top: auto;\n }\n }\n\n \n .${xn}thankyou--gift-picker {\n --encore-gp-accent: #1e78bc;\n --encore-gp-accent-ink: #ffffff;\n --encore-gp-perk: #1a72b9;\n --encore-gp-ink: #17181c;\n --encore-gp-muted: #51545c;\n --encore-gp-line: #dee1e7;\n --encore-gp-surface: #ffffff;\n --encore-gp-selected: #eaf5fd;\n --encore-gp-fine: #a3a6ad;\n background: var(--encore-gp-surface);\n color: var(--encore-gp-ink);\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n min-height: 0;\n flex: 1 1 auto;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-picker {\n padding-top: max(8px, env(safe-area-inset-top));\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-picker > .${xn}gift-picker-hero,\n .${xn}thankyou--reward.${xn}thankyou--gift-picker .${xn}gift-picker-rows {\n position: relative;\n z-index: 1;\n width: 100%;\n max-width: 393px;\n margin-left: auto;\n margin-right: auto;\n box-sizing: border-box;\n }\n\n \n .${xn}thankyou--gift-picker .${xn}gift-sheet-layer {\n position: fixed;\n }\n\n \n .${xn}gift-picker {\n display: flex;\n flex-direction: column;\n flex: 1 0 auto;\n }\n\n .${xn}gift-picker-hero {\n display: flex;\n flex-direction: column;\n flex: none;\n }\n\n .${xn}gift-picker-host {\n display: flex;\n align-items: center;\n gap: 8px;\n min-height: 36px;\n padding: 0 24px;\n box-sizing: border-box;\n color: var(--encore-gp-ink);\n font-size: 16px;\n font-weight: 700;\n letter-spacing: -0.2px;\n line-height: 1.2;\n }\n\n .${xn}gift-picker-host-icon {\n display: block;\n flex: none;\n width: 24px;\n height: 24px;\n border-radius: 6px;\n object-fit: cover;\n }\n\n .${xn}gift-picker-host-name {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .${xn}gift-picker-fan {\n position: relative;\n width: 240px;\n height: 104px;\n margin: 4px auto 0;\n }\n\n .${xn}gift-picker-fan-confetti,\n .${xn}gift-picker-fan-confetti svg {\n position: absolute;\n inset: 0;\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .${xn}gift-picker-fan-confetti {\n color: var(--encore-gp-accent);\n animation: ${xn}gift-picker-dots 0.4s ease-out 0.4s both;\n }\n\n .${xn}gift-picker-tile {\n --encore-gp-fan-r: 0deg;\n position: absolute;\n top: 31px;\n left: 50%;\n width: 56px;\n height: 56px;\n margin-left: -28px;\n transform: rotate(var(--encore-gp-fan-r));\n animation: ${xn}gift-picker-pop 0.42s cubic-bezier(0.2, 1.3, 0.4, 1) 0.18s both;\n }\n\n .${xn}gift-picker-tile--t1 {\n --encore-gp-fan-r: -12deg;\n left: calc(50% - 55px);\n z-index: 1;\n animation-delay: 0.24s;\n }\n\n .${xn}gift-picker-tile--t3 {\n --encore-gp-fan-r: 12deg;\n left: calc(50% + 55px);\n z-index: 1;\n animation-delay: 0.3s;\n }\n\n .${xn}gift-picker-tile--t2 {\n top: 16px;\n width: 64px;\n height: 64px;\n margin-left: -32px;\n z-index: 2;\n }\n\n .${xn}gift-picker-tile-inner {\n display: grid;\n place-items: center;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow: hidden;\n border: 3px solid #ffffff;\n border-radius: 15px;\n background: var(--encore-gp-selected);\n box-shadow: 0 6px 16px rgba(17, 24, 39, 0.16);\n color: var(--encore-gp-accent);\n font-size: 22px;\n font-weight: 800;\n }\n\n .${xn}gift-picker-tile--t2 .${xn}gift-picker-tile-inner {\n border-radius: 17px;\n }\n\n .${xn}gift-picker-tile-image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .${xn}gift-picker-fan--solo .${xn}gift-picker-tile--t1,\n .${xn}gift-picker-fan--solo .${xn}gift-picker-tile--t3 {\n display: none;\n }\n\n \n @keyframes ${xn}gift-picker-pop {\n from {\n opacity: 0;\n transform: translateY(14px) scale(0.6) rotate(var(--encore-gp-fan-r));\n }\n }\n\n @keyframes ${xn}gift-picker-dots {\n from {\n opacity: 0;\n transform: scale(0.85);\n }\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-picker .${xn}thankyou-status {\n padding-top: 0;\n margin-top: 8px;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-picker .${xn}thankyou-title {\n color: var(--encore-gp-ink);\n font-size: 22px;\n font-weight: 800;\n letter-spacing: -0.5px;\n line-height: 1.2;\n text-wrap: balance;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-picker .${xn}thankyou-subtitle {\n color: var(--encore-gp-muted);\n font-size: 15px;\n line-height: 1.4;\n margin-top: 6px;\n opacity: 1;\n }\n\n .${xn}thankyou--gift-picker .${xn}gift-em {\n color: var(--encore-gp-perk);\n font-style: normal;\n }\n\n .${xn}gift-picker-rows {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 16px 24px 0;\n }\n\n .${xn}gift-picker-row {\n display: flex;\n align-items: center;\n gap: 12px;\n width: 100%;\n min-height: 59px;\n padding: 11px 14px 11px 12px;\n border: 1.5px solid var(--encore-gp-line);\n border-radius: 14px;\n background: var(--encore-gp-surface);\n color: var(--encore-gp-ink);\n font: inherit;\n text-align: start;\n cursor: pointer;\n transition: background 0.15s, border-color 0.15s;\n }\n\n .${xn}gift-picker-row[aria-checked='true'] {\n border-color: var(--encore-gp-accent);\n background: var(--encore-gp-selected);\n }\n\n .${xn}gift-picker-row-icon {\n display: grid;\n place-items: center;\n flex: none;\n width: 32px;\n height: 32px;\n border-radius: 8px;\n overflow: hidden;\n background: var(--encore-gp-selected);\n color: var(--encore-gp-accent);\n font-size: 13px;\n font-weight: 800;\n }\n\n .${xn}gift-picker-row-icon img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .${xn}gift-picker-row-text {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-width: 0;\n gap: 3px;\n }\n\n .${xn}gift-picker-row-primary {\n font-size: 14px;\n font-weight: 600;\n letter-spacing: -0.1px;\n line-height: 1.2;\n }\n\n .${xn}gift-picker-row-perk {\n font-size: 13px;\n font-weight: 500;\n line-height: 1.25;\n color: var(--encore-gp-perk);\n }\n\n .${xn}gift-picker-row-radio {\n display: grid;\n place-items: center;\n flex: none;\n width: 22px;\n height: 22px;\n box-sizing: border-box;\n border: 1.5px solid #c7cad1;\n border-radius: 50%;\n background: var(--encore-gp-surface);\n }\n\n .${xn}gift-picker-row[aria-checked='true'] .${xn}gift-picker-row-radio {\n border-color: var(--encore-gp-accent);\n background: var(--encore-gp-accent);\n }\n\n .${xn}gift-picker-row[aria-checked='true'] .${xn}gift-picker-row-radio::after {\n content: '';\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: #ffffff;\n }\n\n \n .${xn}gift-picker-more {\n align-self: center;\n margin: auto 0 0;\n padding: 18px 12px 8px;\n border: 0;\n background: none;\n color: var(--encore-gp-ink);\n font: inherit;\n font-size: 16px;\n font-weight: 600;\n line-height: 1.2;\n text-decoration: underline;\n text-decoration-thickness: 1.5px;\n text-underline-offset: 3px;\n cursor: pointer;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-picker .${xn}reward-actions {\n padding: 8px 0 max(12px, env(safe-area-inset-bottom));\n gap: 0;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-picker .${xn}reward-cta-stack {\n padding: 0 24px;\n gap: 0;\n }\n\n \n .${xn}thankyou--reward.${xn}thankyou--gift-picker .${xn}reward-cta-primary {\n height: 46px;\n min-height: 46px;\n border-radius: 999px;\n border-color: var(--encore-gp-accent);\n background: var(--encore-gp-accent);\n color: var(--encore-gp-accent-ink);\n font-size: 17px;\n font-weight: 600;\n letter-spacing: -0.2px;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-picker .${xn}reward-cta-primary:hover {\n background: var(--encore-gp-accent);\n filter: brightness(0.94);\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-picker .${xn}reward-cta-secondary {\n margin-top: 8px;\n border-color: var(--encore-gp-line);\n color: var(--encore-gp-ink);\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-picker .${xn}gift-terms {\n margin: 10px 0 0;\n font-size: 12px;\n letter-spacing: 0;\n color: var(--encore-gp-fine);\n }\n\n \n .${xn}thankyou--reward.${xn}thankyou--gift-picker .${xn}gift-terms-link {\n font-weight: 400;\n text-decoration: none;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-picker a.${xn}gift-terms-link {\n text-decoration: underline;\n }\n\n \n .${xn}thankyou--gift-picker .${xn}gift-sheet,\n .${xn}thankyou--gift-picker .${xn}gift-sheet-title {\n background-color: var(--encore-gp-surface);\n color: var(--encore-gp-ink);\n }\n\n .${xn}thankyou--gift-picker .${xn}gift-card {\n background: var(--encore-gp-surface);\n border-color: var(--encore-gp-line);\n color: var(--encore-gp-ink);\n }\n\n .${xn}thankyou--gift-picker .${xn}gift-card[aria-checked='true'] {\n background: var(--encore-gp-selected);\n border-color: var(--encore-gp-accent);\n }\n\n .${xn}thankyou--gift-picker .${xn}gift-sheet-fine {\n color: var(--encore-gp-muted);\n }\n\n .${xn}thankyou--gift-picker .${xn}gift-picker-row:focus-visible,\n .${xn}thankyou--gift-picker .${xn}gift-picker-more:focus-visible,\n .${xn}thankyou--gift-picker .${xn}gift-terms-link:focus-visible,\n .${xn}thankyou--gift-picker .${xn}gift-card:focus-visible,\n .${xn}thankyou--gift-picker .${xn}reward-cta-primary:focus-visible,\n .${xn}thankyou--gift-picker .${xn}reward-cta-secondary:focus-visible {\n outline: 2px solid var(--encore-gp-accent);\n outline-offset: 2px;\n }\n\n @media (prefers-reduced-motion: reduce) {\n .${xn}gift-picker-tile,\n .${xn}gift-picker-fan-confetti {\n animation: none;\n }\n .${xn}gift-picker-row {\n transition: none;\n }\n }\n\n \n @media (max-height: 700px) {\n .${xn}gift-picker-fan {\n transform: scale(0.78);\n transform-origin: 50% 0;\n margin-bottom: -23px;\n }\n .${xn}gift-picker-rows {\n padding-top: 14px;\n }\n .${xn}gift-picker-more {\n padding-top: 12px;\n }\n }\n\n \n .${xn}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 .${xn}thankyou--reward.${xn}thankyou--gift-list {\n padding-top: max(20px, env(safe-area-inset-top));\n }\n\n .${xn}thankyou--gift-list .${xn}gift-sheet-layer {\n position: fixed;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}thankyou-status {\n padding-top: 0;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-list > .${xn}gift-list-presents,\n .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}gift-list-art,\n .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}gift-list-rows,\n .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}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 .${xn}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 .${xn}gift-list-presents-icon {\n width: 26px;\n height: 26px;\n border-radius: 6px;\n object-fit: cover;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}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 .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}thankyou-title .${xn}gift-em {\n font-weight: 700;\n color: var(--encore-gl-accent);\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}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 .${xn}gift-list {\n display: flex;\n flex-direction: column;\n }\n\n .${xn}gift-list-art {\n position: relative;\n height: 148px;\n margin-top: 20px;\n }\n\n \n .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}gift-list-art {\n max-width: none;\n }\n\n .${xn}gift-list-art[hidden] {\n display: none;\n }\n\n .${xn}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 .${xn}gift-list-art-layer {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .${xn}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 .${xn}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 .${xn}gift-list-art-logo img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .${xn}gift-list-rows {\n display: flex;\n flex-direction: column;\n gap: 10px;\n margin-top: 24px;\n padding: 0 20px;\n }\n\n .${xn}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: start;\n cursor: pointer;\n transition: border-color 0.15s;\n }\n\n .${xn}gift-list-row[aria-checked='true'] {\n border-color: var(--encore-gl-accent, #ff8800);\n }\n\n .${xn}gift-list-row:focus-visible,\n .${xn}gift-list-more:focus-visible {\n outline: 2px solid var(--encore-gl-accent, #ff8800);\n outline-offset: 2px;\n }\n\n .${xn}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 .${xn}gift-list-logo img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .${xn}gift-list-text {\n display: flex;\n flex-direction: column;\n gap: 3px;\n min-width: 0;\n }\n\n .${xn}gift-list-name {\n font-size: 14px;\n font-weight: 500;\n line-height: 1.3;\n color: #020623;\n }\n\n .${xn}gift-list-perk {\n font-size: 12px;\n line-height: 1.3;\n color: #6b7075;\n }\n\n .${xn}gift-list-em {\n font-weight: 600;\n color: var(--encore-gl-accent, #ff8800);\n }\n\n .${xn}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 .${xn}gift-list-radio svg {\n display: block;\n }\n\n .${xn}gift-list-row[aria-checked='true'] .${xn}gift-list-radio {\n visibility: visible;\n }\n\n .${xn}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: ${xn}gift-list-fade-in 0.2s ease-out both;\n }\n\n .${xn}gift-list-desc[hidden] {\n display: none;\n }\n\n .${xn}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 .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}reward-actions {\n padding-top: 16px;\n padding-left: 0;\n padding-right: 0;\n gap: 0;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}reward-cta-stack {\n padding: 0 20px;\n gap: 0;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}reward-cta-primary,\n .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}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 .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}reward-cta-primary:hover {\n background: var(--encore-gl-accent);\n filter: brightness(0.96);\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}gift-sheet {\n background: var(--encore-gl-page);\n color: #020623;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}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 .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}gift-card[aria-checked='true'] {\n border-color: var(--encore-gl-accent);\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-list .${xn}gift-card .${xn}gift-em {\n color: var(--encore-gl-accent);\n }\n\n \n @keyframes ${xn}gift-list-rise {\n from {\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n }\n }\n\n @keyframes ${xn}gift-list-fade-in {\n from {\n opacity: 0;\n }\n }\n\n @keyframes ${xn}gift-list-fade-out {\n to {\n opacity: 0;\n }\n }\n\n .${xn}gift-list-art-layer--intro {\n animation: ${xn}gift-list-rise 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both;\n }\n\n .${xn}gift-list-art-layer--in {\n animation: ${xn}gift-list-fade-in 0.2s ease-out both;\n }\n\n .${xn}gift-list-art-layer--out {\n animation: ${xn}gift-list-fade-out 0.2s ease-in forwards;\n pointer-events: none;\n }\n\n .${xn}gift-list-row--intro {\n animation: ${xn}gift-list-rise 0.36s cubic-bezier(0.2, 0.8, 0.2, 1) both;\n }\n\n .${xn}gift-list-row--intro:nth-child(2) {\n animation-delay: 0.06s;\n }\n\n .${xn}gift-list-row--intro:nth-child(3) {\n animation-delay: 0.12s;\n }\n\n @media (prefers-reduced-motion: reduce) {\n .${xn}gift-list-art-layer--intro,\n .${xn}gift-list-art-layer--in,\n .${xn}gift-list-art-layer--out,\n .${xn}gift-list-row--intro,\n .${xn}gift-list-row--intro:nth-child(2),\n .${xn}gift-list-row--intro:nth-child(3),\n .${xn}gift-list-desc {\n animation: none;\n }\n }\n${function(){const e=`.${xn}thankyou--reward.${xn}thankyou--gift-unwrap`;return`\n .${xn}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: ${kn}) {\n .${xn}unwrap {\n flex: 1 1 auto;\n }\n }\n\n .${xn}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 .${xn}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 .${xn}modal:has(.${xn}unwrap) {\n background: #f6f6f6;\n }\n\n .${xn}modal:has(.${xn}unwrap) .${xn}close-button {\n background: transparent;\n box-shadow: none;\n color: rgba(0, 0, 0, 0.3);\n }\n\n .${xn}unwrap-hero {\n display: flex;\n justify-content: center;\n pointer-events: none;\n }\n\n .${xn}unwrap-hero-box,\n .${xn}unwrap-hero-box svg {\n display: block;\n width: 183px;\n height: 183px;\n }\n\n ${e} .${xn}thankyou-status {\n padding: 10px 20px 0;\n }\n\n ${e} .${xn}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} .${xn}thankyou-title .${xn}gift-em,\n .${xn}unwrap-em {\n font-weight: 700;\n color: var(--encore-gu-accent);\n }\n\n ${e} .${xn}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 .${xn}unwrap-body {\n display: flex;\n flex-direction: column;\n }\n\n .${xn}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 .${xn}unwrap-row,\n ${e} .${xn}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: start;\n cursor: pointer;\n transition: border-color 0.15s;\n }\n\n .${xn}unwrap-row[aria-checked='true'],\n ${e} .${xn}gift-card[aria-checked='true'] {\n border-color: var(--encore-gu-accent);\n background: #ffffff;\n }\n\n .${xn}unwrap-row:focus-visible,\n .${xn}unwrap-more:focus-visible,\n .${xn}unwrap-back:focus-visible,\n .${xn}unwrap-cta:focus-visible,\n ${e} .${xn}gift-card:focus-visible {\n outline: 2px solid var(--encore-gu-accent);\n outline-offset: 2px;\n }\n\n .${xn}unwrap-row-logo,\n .${xn}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 .${xn}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 .${xn}unwrap-row-logo img,\n .${xn}unwrap-logo-inner img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .${xn}unwrap-row-text {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-width: 0;\n gap: 3px;\n }\n\n .${xn}unwrap-row-title,\n .${xn}unwrap-row-perk {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n line-height: 1.3;\n }\n\n .${xn}unwrap-row-title {\n font-size: 14px;\n font-weight: 510;\n }\n\n .${xn}unwrap-row-perk {\n font-size: 12px;\n font-weight: 400;\n color: #6b7075;\n }\n\n .${xn}unwrap-row-perk .${xn}unwrap-em {\n font-weight: 590;\n }\n\n .${xn}unwrap-radio,\n .${xn}unwrap-radio svg {\n display: block;\n flex: none;\n width: 20px;\n height: 20px;\n }\n\n .${xn}unwrap-radio {\n box-sizing: border-box;\n border: 1px solid #e3e3e8;\n border-radius: 50%;\n }\n\n .${xn}unwrap-radio svg {\n visibility: hidden;\n margin: -1px;\n }\n\n [aria-checked='true'] > .${xn}unwrap-radio {\n border-color: transparent;\n }\n\n [aria-checked='true'] > .${xn}unwrap-radio svg {\n visibility: visible;\n }\n\n .${xn}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} .${xn}reward-actions {\n margin-top: auto;\n padding: 24px 0 max(20px, env(safe-area-inset-bottom));\n gap: 0;\n }\n\n ${e} .${xn}reward-cta-stack {\n padding: 0 20px;\n gap: 0;\n }\n\n ${e} .${xn}reward-cta-primary,\n ${e} .${xn}gift-sheet-cta,\n .${xn}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} .${xn}reward-cta-primary:hover,\n .${xn}unwrap-cta:hover {\n background: var(--encore-gu-accent);\n box-shadow: none;\n filter: brightness(0.96);\n }\n\n .${xn}unwrap-cta:disabled,\n .${xn}unwrap-cta[aria-disabled='true'] {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n ${e} .${xn}gift-sheet-layer {\n position: fixed;\n }\n\n ${e} .${xn}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} .${xn}gift-sheet-title {\n font-size: 18px;\n font-weight: 700;\n letter-spacing: -0.18px;\n color: #141414;\n }\n\n ${e} .${xn}gift-sheet-close {\n color: rgba(0, 0, 0, 0.3);\n }\n\n ${e} .${xn}gift-sheet-tabs {\n margin-top: 0;\n }\n\n ${e} .${xn}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} .${xn}gift-sheet-cta {\n flex: none;\n height: 52px;\n min-height: 52px;\n margin-top: 0;\n border-radius: 26px;\n }\n\n .${xn}unwrap-back {\n position: absolute;\n top: calc(16px + env(safe-area-inset-top));\n inset-inline-start: 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 .${xn}unwrap-back-icon,\n .${xn}unwrap-back-icon svg {\n display: block;\n width: 20px;\n height: 20px;\n }\n\n .${xn}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 .${xn}unwrap-reveal,\n .${xn}unwrap-closed,\n .${xn}unwrap-open,\n .${xn}unwrap-open-layer {\n position: relative;\n width: 284px;\n height: 284px;\n }\n\n .${xn}unwrap-closed,\n .${xn}unwrap-open,\n .${xn}unwrap-open-layer {\n position: absolute;\n inset: 0;\n }\n\n .${xn}unwrap-closed svg,\n .${xn}unwrap-open-layer svg {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .${xn}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 .${xn}unwrap-glow svg {\n display: block;\n }\n\n .${xn}unwrap-closed {\n opacity: 0;\n transform-origin: 50% 80%;\n }\n\n .${xn}unwrap-open {\n transform-origin: 50% 50%;\n }\n\n .${xn}unwrap-logo {\n position: absolute;\n left: 97px;\n top: 86px;\n width: 96px;\n height: 96px;\n transform: rotate(-9deg);\n }\n\n .${xn}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 .${xn}unwrap-reveal--play .${xn}unwrap-closed {\n animation:\n ${xn}unwrap-closed-fade 1752ms cubic-bezier(0.22, 1, 0.36, 1),\n ${xn}unwrap-closed-squash 1752ms ease-in-out;\n }\n\n .${xn}unwrap-reveal--play .${xn}unwrap-open {\n animation:\n ${xn}unwrap-open-fade 1752ms ease-in-out,\n ${xn}unwrap-open-rise 1752ms ease-in-out;\n }\n\n .${xn}unwrap-reveal--play .${xn}unwrap-logo {\n animation:\n ${xn}unwrap-logo-fade 1752ms ease-in-out,\n ${xn}unwrap-logo-pop 1752ms ease-in-out;\n }\n\n .${xn}unwrap-reveal--play .${xn}unwrap-glow {\n animation: ${xn}unwrap-glow 1752ms cubic-bezier(0.22, 1, 0.36, 1);\n }\n\n @keyframes ${xn}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 ${xn}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 ${xn}unwrap-open-fade {\n 0%, 27.4% { opacity: 0; }\n 37%, 100% { opacity: 1; }\n }\n\n @keyframes ${xn}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 ${xn}unwrap-logo-fade {\n 0%, 39.7% { opacity: 0; }\n 50.7%, 100% { opacity: 1; }\n }\n\n @keyframes ${xn}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 ${xn}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 .${xn}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 .${xn}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 .${xn}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 .${xn}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 .${xn}unwrap-bullet-icon,\n .${xn}unwrap-bullet-icon svg {\n display: block;\n flex: none;\n width: 20px;\n height: 20px;\n }\n\n .${xn}unwrap-bullet-icon {\n margin-top: 2.81px;\n }\n\n .${xn}unwrap-actions {\n margin-top: auto;\n padding: 24px 20px max(20px, env(safe-area-inset-bottom));\n }\n\n \n\n \n .${xn}close-button[hidden] {\n display: none;\n }\n\n \n .${xn}modal--close-start .${xn}close-button {\n inset-inline-start: 20px;\n inset-inline-end: auto;\n }\n\n \n .${xn}modal:has(.${xn}keep-panel .${xn}gift-sheet--open) .${xn}close-button {\n opacity: 0;\n pointer-events: none;\n }\n\n .${xn}unwrap-share {\n position: absolute;\n top: 23px;\n inset-inline-end: 23px;\n z-index: 1;\n display: grid;\n place-items: center;\n width: 34px;\n height: 34px;\n padding: 0;\n border: 0;\n border-radius: 50%;\n background: rgba(118, 118, 128, 0.12);\n color: #000000;\n cursor: pointer;\n }\n\n .${xn}unwrap-share[hidden] {\n display: none;\n }\n\n .${xn}unwrap-share svg {\n display: block;\n width: 17px;\n height: 17px;\n }\n\n .${xn}unwrap-share:focus-visible,\n .${xn}keep-panel .${xn}gift-sheet-close:focus-visible,\n .${xn}keep-panel .${xn}gift-card:focus-visible,\n .${xn}keep-panel .${xn}gift-sheet-cta:focus-visible {\n outline: 2px solid var(--encore-gu-accent);\n outline-offset: 2px;\n }\n\n @media (max-width: ${kn}) {\n .${xn}modal--close-start .${xn}close-button {\n inset-inline-start: 16px;\n }\n\n .${xn}unwrap-share {\n top: calc(19px + env(safe-area-inset-top));\n inset-inline-end: 19px;\n }\n }\n\n \n .${xn}unwrap-notice {\n position: absolute;\n left: 50%;\n top: calc(22px + env(safe-area-inset-top));\n z-index: 3;\n padding: 10px 16px;\n border-radius: 999px;\n background: #1f1e1e;\n color: #ffffff;\n font-size: 14px;\n font-weight: 600;\n line-height: 1.2;\n white-space: nowrap;\n opacity: 0;\n transform: translate(-50%, -8px);\n transition: opacity 0.2s, transform 0.2s;\n pointer-events: none;\n }\n\n .${xn}unwrap-notice--visible {\n opacity: 1;\n transform: translate(-50%, 0);\n }\n\n \n .${xn}keep-panel .${xn}gift-scrim {\n background: rgba(17, 18, 22, 0.82);\n }\n\n .${xn}keep-panel .${xn}gift-sheet {\n top: 50%;\n left: 50%;\n right: auto;\n bottom: auto;\n box-sizing: border-box;\n width: min(340px, calc(100% - 32px));\n max-height: calc(100% - 32px);\n gap: 14px;\n padding: 16px 20px 20px;\n border-radius: 28px;\n background: #ffffff;\n color: #000000;\n text-align: center;\n box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);\n opacity: 0;\n transform: translate(-50%, -46%) scale(0.96);\n transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s;\n }\n\n .${xn}keep-panel .${xn}gift-sheet--open {\n opacity: 1;\n transform: translate(-50%, -50%);\n }\n\n .${xn}keep-panel .${xn}gift-sheet-header {\n flex-direction: column;\n align-items: stretch;\n gap: 0;\n }\n\n .${xn}keep-panel .${xn}gift-sheet-close {\n align-self: flex-end;\n width: 28px;\n height: 28px;\n margin: -4px -6px 0 0;\n padding: 0;\n font-size: 18px;\n color: rgba(60, 60, 67, 0.6);\n }\n\n .${xn}keep-panel .${xn}gift-sheet-title {\n padding: 0;\n font-size: 20px;\n font-weight: 700;\n line-height: 1.2;\n color: #000000;\n }\n\n .${xn}keep-panel .${xn}gift-sheet-subtitle {\n margin: 0;\n font-size: 15px;\n line-height: 1.35;\n color: rgba(60, 60, 67, 0.6);\n white-space: pre-line;\n }\n\n \n .${xn}keep-panel .${xn}gift-sheet-list {\n display: flex;\n flex: none;\n flex-direction: row;\n gap: 12px;\n margin: 0 -20px;\n padding: 4px calc(50% - 75px) 8px;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-snap-type: x mandatory;\n scrollbar-width: none;\n }\n\n .${xn}keep-panel .${xn}gift-sheet-list::-webkit-scrollbar {\n display: none;\n }\n\n .${xn}keep-panel .${xn}gift-card {\n flex: none;\n align-items: center;\n box-sizing: border-box;\n width: 150px;\n height: 190px;\n gap: 10px;\n padding: 16px 12px;\n border: 1.5px solid transparent;\n border-radius: 20px;\n background: #fff3e5;\n color: #17181c;\n text-align: center;\n scroll-snap-align: center;\n }\n\n .${xn}keep-panel .${xn}gift-card[aria-checked='true'] {\n border-color: var(--encore-gu-accent);\n background: #fff3e5;\n }\n\n .${xn}keep-card-logo {\n display: grid;\n place-items: center;\n flex: none;\n width: 56px;\n height: 56px;\n border-radius: 14px;\n overflow: hidden;\n background: #ffffff;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);\n font-size: 20px;\n font-weight: 700;\n }\n\n .${xn}keep-card-logo img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .${xn}keep-card-title {\n max-width: 100%;\n overflow: hidden;\n font-size: 15px;\n font-weight: 600;\n line-height: 1.25;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n\n .${xn}keep-card-perk {\n display: -webkit-box;\n overflow: hidden;\n font-size: 12px;\n line-height: 1.3;\n color: rgba(23, 24, 28, 0.62);\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n }\n\n .${xn}keep-panel .${xn}gift-sheet-cta {\n width: 100%;\n height: 52px;\n min-height: 52px;\n margin-top: 0;\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: 17px;\n font-weight: 600;\n cursor: pointer;\n }\n\n \n .${xn}keep-panel .${xn}gift-sheet-cta[hidden] {\n display: none;\n }\n\n .${xn}keep-panel .${xn}gift-sheet-cta:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n @media (prefers-reduced-motion: reduce) {\n .${xn}keep-panel .${xn}gift-sheet,\n .${xn}unwrap-notice {\n transition: none;\n }\n }\n\n @media (max-height: 740px) {\n .${xn}unwrap-hero-box,\n .${xn}unwrap-hero-box svg {\n width: 140px;\n height: 140px;\n }\n .${xn}unwrap-stage-frame {\n height: 228px;\n }\n .${xn}unwrap-reveal {\n transform: scale(0.8);\n transform-origin: 50% 0;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .${xn}unwrap-reveal--play .${xn}unwrap-closed,\n .${xn}unwrap-reveal--play .${xn}unwrap-open,\n .${xn}unwrap-reveal--play .${xn}unwrap-logo,\n .${xn}unwrap-reveal--play .${xn}unwrap-glow {\n animation: none;\n }\n .${xn}unwrap-row,\n ${e} .${xn}gift-card {\n transition: none;\n }\n }\n `}()}\n${function(){const e=`.${xn}code-unlock--opening`,t=`.${xn}code-unlock-screen--entering`,n=`.${xn}code-unlock--swapping`,i=`.${xn}modal:has(.${xn}code-unlock)`;return`\n .${xn}code-unlock {\n --encore-gp-accent: #1e78bc;\n --encore-gp-accent-ink: #ffffff;\n --encore-gp-perk: #1a72b9;\n --encore-gp-ink: #17181c;\n --encore-gp-muted: #51545c;\n --encore-gp-line: #dee1e7;\n --encore-gp-surface: #ffffff;\n --encore-gp-selected: #eaf5fd;\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n min-height: 0;\n \n background: var(\n --encore-cu-bg,\n radial-gradient(55% 45% at 12% 18%, var(--encore-gp-selected), transparent 70%),\n radial-gradient(35% 35% at 96% 4%, rgba(30, 120, 188, 0.1), transparent 70%),\n var(--encore-gp-surface)\n );\n color: var(--encore-gp-ink);\n font-family: var(--encore-cu-font, var(--encore-font-family));\n }\n\n ${i} {\n inset: 0;\n top: 0;\n left: 0;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100vh;\n height: 100dvh;\n max-width: none;\n max-height: none;\n margin: 0;\n border-radius: 0;\n overflow: hidden;\n transform: none;\n }\n\n ${i} .${xn}modal-body {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n min-height: 0;\n }\n\n \n .${xn}code-unlock-screen {\n display: block;\n }\n\n .${xn}code-unlock-screen[hidden] {\n display: none;\n }\n\n \n ${n} .${xn}code-unlock-copy {\n position: relative;\n }\n\n ${n} .${xn}code-unlock-screen--lock {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n pointer-events: none;\n animation: ${xn}code-unlock-out 0.22s ease-in both;\n }\n\n \n .${xn}code-unlock {\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n \n scrollbar-gutter: stable;\n }\n\n .${xn}code-unlock-page {\n width: 100%;\n max-width: 1120px;\n margin: 0 auto;\n padding: max(14px, env(safe-area-inset-top)) 24px\n calc(max(28px, env(safe-area-inset-bottom)) + var(--encore-cu-kb, 0px));\n box-sizing: border-box;\n }\n\n .${xn}code-unlock-header {\n display: flex;\n align-items: center;\n gap: 10px;\n min-height: 40px;\n padding-inline-end: 48px;\n font-family: var(--encore-cu-heading-font, inherit);\n font-size: 17px;\n font-weight: 700;\n letter-spacing: -0.2px;\n }\n\n .${xn}code-unlock-logo {\n display: block;\n width: auto;\n max-width: min(220px, 60vw);\n height: 32px;\n object-fit: contain;\n object-position: left center;\n }\n\n [dir='rtl'] .${xn}code-unlock-logo {\n object-position: right center;\n }\n\n .${xn}code-unlock-header-icon {\n width: 24px;\n height: 24px;\n border-radius: 6px;\n object-fit: cover;\n }\n\n .${xn}code-unlock-card-brand {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n }\n\n .${xn}code-unlock-card-brand-icon {\n width: 28px;\n height: 28px;\n border-radius: 8px;\n background: #ffffff;\n object-fit: cover;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);\n }\n\n .${xn}code-unlock-hero {\n display: grid;\n grid-template-columns: 1fr;\n gap: 28px;\n \n align-items: start;\n padding: 20px 0 36px;\n }\n\n .${xn}code-unlock-card {\n position: relative;\n justify-self: center;\n width: min(100%, 440px);\n aspect-ratio: 1.6;\n padding: 22px 24px;\n box-sizing: border-box;\n overflow: hidden;\n border-radius: 24px;\n background: linear-gradient(135deg, #3294e0 0%, #1e78bc 52%, #135c93 100%);\n color: #ffffff;\n box-shadow: 0 30px 60px -24px rgba(30, 120, 188, 0.6);\n transform: rotate(-4deg);\n }\n\n .${xn}code-unlock-card::before {\n content: '';\n position: absolute;\n width: 70%;\n aspect-ratio: 1;\n right: -18%;\n top: -45%;\n border-radius: 50%;\n background: rgba(255, 255, 255, 0.1);\n }\n\n .${xn}code-unlock-card::after {\n content: '';\n position: absolute;\n width: 120%;\n aspect-ratio: 1;\n left: -60%;\n bottom: -95%;\n border: 10px solid rgba(255, 255, 255, 0.12);\n border-radius: 50%;\n }\n\n \n .${xn}code-unlock-card.${xn}code-unlock-card--image {\n transform: none;\n aspect-ratio: auto;\n padding: 0;\n overflow: visible;\n border-radius: 0;\n background: none;\n box-shadow: none;\n }\n\n .${xn}code-unlock-card--image::before,\n .${xn}code-unlock-card--image::after {\n content: none;\n }\n\n .${xn}code-unlock-card-image {\n display: block;\n width: 100%;\n height: auto;\n max-height: 50vh;\n object-fit: contain;\n }\n\n .${xn}code-unlock-card-top {\n position: relative;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 16px;\n font-weight: 700;\n }\n\n .${xn}code-unlock-lock {\n display: grid;\n place-items: center;\n width: 40px;\n height: 40px;\n border-radius: 50%;\n background: rgba(255, 255, 255, 0.18);\n color: #ffffff;\n }\n\n .${xn}code-unlock-lock svg {\n display: block;\n width: 22px;\n height: 22px;\n overflow: visible;\n }\n\n .${xn}code-unlock-shackle {\n transform-box: fill-box;\n transform-origin: 100% 100%;\n }\n\n .${xn}code-unlock-card-value {\n position: absolute;\n z-index: 1;\n inset-inline-start: 24px;\n bottom: 20px;\n display: flex;\n flex-direction: column;\n max-width: 62%;\n }\n\n .${xn}code-unlock-card-small {\n font-size: 15px;\n font-weight: 600;\n opacity: 0.9;\n }\n\n .${xn}code-unlock-card-amount {\n font-size: clamp(44px, 13vw, 64px);\n font-weight: 800;\n letter-spacing: -2px;\n line-height: 1;\n }\n\n .${xn}code-unlock-card-amount.${xn}code-unlock-card-amount--text {\n font-size: clamp(24px, 7vw, 32px);\n letter-spacing: -0.6px;\n line-height: 1.1;\n }\n\n .${xn}code-unlock-card-box {\n position: absolute;\n right: -4%;\n bottom: -12%;\n width: 44%;\n }\n\n .${xn}code-unlock-card-box svg {\n display: block;\n width: 100%;\n height: auto;\n }\n\n .${xn}code-unlock-title {\n margin: 0;\n color: var(--encore-gp-ink);\n font-family: var(--encore-cu-heading-font, inherit);\n font-size: clamp(32px, 8.5vw, 52px);\n font-weight: var(--encore-cu-heading-weight, 800);\n letter-spacing: -1.2px;\n line-height: 1.06;\n text-wrap: balance;\n }\n\n .${xn}code-unlock-subline {\n margin: 12px 0 0;\n opacity: 1;\n color: var(--encore-gp-muted);\n font-size: 17px;\n line-height: 1.45;\n }\n\n .${xn}code-unlock-form {\n margin-top: 24px;\n }\n\n .${xn}code-unlock-label {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n }\n\n .${xn}code-unlock-field {\n display: flex;\n gap: 6px;\n max-width: 520px;\n padding: 6px;\n box-sizing: border-box;\n border: 1.5px solid var(--encore-gp-line);\n border-radius: 16px;\n background: var(--encore-gp-surface);\n box-shadow: 0 10px 30px -18px rgba(23, 24, 28, 0.35);\n }\n\n .${xn}code-unlock-field:focus-within {\n border-color: var(--encore-gp-accent);\n box-shadow: 0 0 0 4px color-mix(in srgb, var(--encore-gp-accent) 18%, transparent);\n }\n\n .${xn}code-unlock .${xn}code-unlock-input {\n flex: 1 1 auto;\n min-width: 0;\n height: 50px;\n padding: 0 12px;\n border: 0;\n background: transparent;\n color: var(--encore-gp-ink);\n font: 600 18px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n letter-spacing: 2px;\n outline: none;\n box-shadow: none;\n }\n\n .${xn}code-unlock .${xn}code-unlock-input:focus {\n outline: none;\n }\n\n .${xn}code-unlock .${xn}code-unlock-input::placeholder {\n color: #8a8d94;\n font-family: var(--encore-cu-font, var(--encore-font-family));\n font-weight: 500;\n letter-spacing: 0;\n }\n\n .${xn}code-unlock-field:has(.${xn}code-unlock-input[aria-invalid='true']) {\n border-color: #c4314b;\n }\n\n .${xn}code-unlock-error {\n min-height: 18px;\n margin: 8px 0 0;\n color: #c4314b;\n font-size: 13px;\n line-height: 18px;\n }\n\n .${xn}code-unlock .${xn}code-unlock-cta {\n flex: 0 1 auto;\n min-height: 50px;\n padding: 6px 22px;\n border: 0;\n border-radius: 12px;\n background: var(--encore-cu-cta-bg, var(--encore-gp-accent));\n color: var(--encore-cu-cta-ink, var(--encore-gp-accent-ink));\n font: inherit;\n font-family: var(--encore-cu-heading-font, inherit);\n font-size: 16px;\n font-weight: var(--encore-cu-heading-weight, 700);\n line-height: 1.2;\n cursor: pointer;\n }\n\n .${xn}code-unlock .${xn}code-unlock-cta:hover {\n filter: brightness(0.94);\n }\n\n .${xn}code-unlock .${xn}code-unlock-cta[aria-busy='true'] {\n opacity: 0.7;\n cursor: progress;\n }\n\n .${xn}code-unlock .${xn}code-unlock-cta:focus {\n outline: none;\n }\n\n .${xn}code-unlock .${xn}code-unlock-cta:focus-visible {\n outline: 2px solid var(--encore-gp-accent);\n outline-offset: 2px;\n }\n\n .${xn}code-unlock-preview-title,\n .${xn}code-unlock-how-title {\n margin: 0;\n color: var(--encore-gp-ink);\n font-family: var(--encore-cu-heading-font, inherit);\n font-size: 22px;\n font-weight: var(--encore-cu-heading-weight, 800);\n letter-spacing: -0.4px;\n }\n\n .${xn}code-unlock-preview-note {\n margin: 4px 0 0;\n color: var(--encore-gp-muted);\n font-size: 15px;\n }\n\n .${xn}code-unlock-strip {\n display: flex;\n gap: 12px;\n margin: 0;\n padding: 16px 2px 10px;\n list-style: none;\n overflow-x: auto;\n scroll-snap-type: x mandatory;\n -webkit-overflow-scrolling: touch;\n }\n\n .${xn}code-unlock-tile {\n display: flex;\n flex: 0 0 128px;\n flex-direction: column;\n align-items: center;\n gap: 10px;\n padding: 16px 10px 14px;\n box-sizing: border-box;\n border: 1px solid var(--encore-gp-line);\n border-radius: 18px;\n background: var(--encore-gp-surface);\n box-shadow: 0 8px 20px -16px rgba(23, 24, 28, 0.4);\n scroll-snap-align: start;\n text-align: center;\n }\n\n .${xn}code-unlock-tile-logo {\n display: grid;\n place-items: center;\n width: 52px;\n height: 52px;\n overflow: hidden;\n border-radius: 14px;\n background: var(--encore-gp-selected);\n color: var(--encore-gp-accent);\n font-size: 22px;\n font-weight: 800;\n }\n\n .${xn}code-unlock-tile-logo img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .${xn}code-unlock-tile-name {\n display: -webkit-box;\n overflow: hidden;\n font-size: 13px;\n font-weight: 600;\n line-height: 1.3;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n }\n\n .${xn}code-unlock-how {\n margin-top: 32px;\n }\n\n .${xn}code-unlock-steps {\n display: grid;\n grid-template-columns: 1fr;\n gap: 10px;\n margin: 14px 0 0;\n padding: 0;\n list-style: none;\n }\n\n .${xn}code-unlock-step {\n display: flex;\n align-items: flex-start;\n gap: 14px;\n padding: 16px 18px;\n border-radius: 18px;\n background: #f4f8fc;\n }\n\n .${xn}code-unlock-step-num {\n display: grid;\n flex: none;\n place-items: center;\n width: 32px;\n height: 32px;\n border-radius: 50%;\n background: var(--encore-gp-accent);\n color: #ffffff;\n font-size: 15px;\n font-weight: 800;\n }\n\n .${xn}code-unlock-step strong {\n display: block;\n font-family: var(--encore-cu-heading-font, inherit);\n font-size: 16px;\n font-weight: var(--encore-cu-heading-weight, 700);\n }\n\n .${xn}code-unlock-steps--icons .${xn}code-unlock-step {\n align-items: center;\n padding: 16px 18px;\n border: 1px solid var(--encore-gp-line);\n background: var(--encore-gp-surface);\n box-shadow: 0 10px 24px -18px rgba(23, 24, 28, 0.35);\n }\n\n .${xn}code-unlock-step-icon {\n display: block;\n flex: none;\n width: 48px;\n height: 48px;\n object-fit: contain;\n }\n\n .${xn}code-unlock--pill .${xn}code-unlock-field {\n border-radius: 999px;\n }\n\n .${xn}code-unlock--pill .${xn}code-unlock-input {\n padding-inline-start: 18px;\n }\n\n .${xn}code-unlock.${xn}code-unlock--pill .${xn}code-unlock-cta {\n padding: 6px 28px;\n border-radius: 999px;\n }\n\n .${xn}code-unlock-step strong + span {\n color: var(--encore-gp-muted);\n font-size: 14px;\n }\n\n @media (max-width: 479px) {\n .${xn}code-unlock-field {\n flex-direction: column;\n }\n .${xn}code-unlock .${xn}code-unlock-input {\n text-align: center;\n }\n .${xn}code-unlock .${xn}code-unlock-cta {\n width: 100%;\n }\n .${xn}code-unlock--pill .${xn}code-unlock-field {\n gap: 10px;\n padding: 0;\n border: 0;\n border-radius: 0;\n background: none;\n box-shadow: none;\n }\n .${xn}code-unlock--pill .${xn}code-unlock-field:focus-within {\n box-shadow: none;\n }\n .${xn}code-unlock.${xn}code-unlock--pill .${xn}code-unlock-input {\n padding: 0 18px;\n border: 1.5px solid var(--encore-gp-line);\n border-radius: 999px;\n background: var(--encore-gp-surface);\n box-shadow: 0 10px 30px -18px rgba(23, 24, 28, 0.35);\n }\n .${xn}code-unlock.${xn}code-unlock--pill .${xn}code-unlock-input:focus {\n border-color: var(--encore-gp-accent);\n box-shadow: 0 0 0 4px color-mix(in srgb, var(--encore-gp-accent) 18%, transparent);\n }\n .${xn}code-unlock--pill .${xn}code-unlock-field:has(.${xn}code-unlock-input[aria-invalid='true']) .${xn}code-unlock-input {\n border-color: #c4314b;\n }\n }\n\n @media (min-width: 700px) {\n .${xn}code-unlock-steps {\n grid-template-columns: repeat(3, 1fr);\n }\n .${xn}code-unlock-steps--icons .${xn}code-unlock-step {\n flex-direction: column;\n gap: 12px;\n padding: 22px 18px 20px;\n text-align: center;\n }\n }\n\n @media (min-width: 900px) {\n .${xn}code-unlock-page {\n padding-left: 48px;\n padding-right: 48px;\n }\n .${xn}code-unlock-hero {\n grid-template-columns: 1.05fr 1fr;\n gap: 64px;\n min-height: min(560px, 68vh);\n padding: 24px 0 48px;\n }\n .${xn}code-unlock-strip {\n flex-wrap: wrap;\n overflow: visible;\n }\n .${xn}code-unlock-tile {\n flex: 0 0 calc((100% - 60px) / 6);\n }\n }\n\n .${xn}code-unlock-badge {\n display: inline-flex;\n flex: none;\n align-self: flex-start;\n align-items: center;\n gap: 6px;\n padding: 6px 12px;\n border-radius: 999px;\n background: var(--encore-gp-selected);\n color: var(--encore-gp-perk);\n font-size: 13px;\n font-weight: 700;\n letter-spacing: 0.2px;\n outline: none;\n }\n\n .${xn}code-unlock-badge-icon svg {\n display: block;\n width: 14px;\n height: 14px;\n }\n\n \n .${xn}code-unlock-rewards.${xn}thankyou--gift-picker {\n flex: none;\n min-height: 0;\n padding: 0;\n overflow: visible;\n background: none;\n }\n\n .${xn}code-unlock-rewards .${xn}gift-picker {\n flex: none;\n }\n\n .${xn}code-unlock-rewards {\n margin-top: 22px;\n }\n\n .${xn}code-unlock-rewards .${xn}gift-picker-rows,\n .${xn}code-unlock-rewards .${xn}reward-actions {\n width: 100%;\n max-width: 560px;\n margin-left: 0;\n margin-right: 0;\n }\n\n .${xn}thankyou--reward.${xn}code-unlock-rewards .${xn}reward-actions {\n padding-bottom: 0;\n }\n\n .${xn}code-unlock-rewards.${xn}thankyou--gift-picker {\n --encore-gp-accent: inherit;\n --encore-gp-accent-ink: inherit;\n --encore-gp-perk: inherit;\n --encore-gp-ink: inherit;\n --encore-gp-muted: inherit;\n --encore-gp-line: inherit;\n --encore-gp-surface: inherit;\n --encore-gp-selected: inherit;\n }\n\n .${xn}thankyou--reward.${xn}thankyou--gift-picker.${xn}code-unlock-rewards .${xn}reward-cta-primary,\n .${xn}thankyou--reward.${xn}thankyou--gift-picker.${xn}code-unlock-rewards .${xn}reward-cta-primary:hover {\n border-color: transparent;\n background: var(--encore-cu-cta-bg, var(--encore-gp-accent));\n color: var(--encore-cu-cta-ink, var(--encore-gp-accent-ink));\n font-family: var(--encore-cu-heading-font, inherit);\n font-weight: var(--encore-cu-heading-weight, 600);\n }\n\n .${xn}code-unlock-screen--offers .${xn}thankyou-title {\n font-family: var(--encore-cu-heading-font, inherit);\n font-weight: var(--encore-cu-heading-weight, 600);\n }\n\n .${xn}code-unlock--unlocked .${xn}code-unlock-hero {\n padding-bottom: 32px;\n }\n\n .${xn}code-unlock-badge {\n margin-bottom: 12px;\n }\n\n \n .${xn}code-unlock-card--open {\n transform: rotate(0deg);\n }\n\n .${xn}code-unlock-card--open .${xn}code-unlock-shackle {\n transform: translateY(-4px) rotate(-32deg);\n }\n\n ${e} .${xn}code-unlock-page {\n pointer-events: none;\n }\n\n ${e} .${xn}code-unlock-shackle {\n animation: ${xn}code-unlock-shackle 0.3s cubic-bezier(0.3, 1.4, 0.5, 1) both;\n }\n\n ${e} .${xn}code-unlock-card {\n animation: ${xn}code-unlock-lift 0.45s ease-out both;\n }\n\n ${e} .${xn}code-unlock-page > :not(.${xn}code-unlock-hero):not(.${xn}code-unlock-header),\n ${e} .${xn}code-unlock-screen--lock {\n animation: ${xn}code-unlock-fade 0.45s ease-in both;\n }\n\n ${t} .${xn}code-unlock-badge {\n animation: ${xn}code-unlock-badge 0.36s cubic-bezier(0.2, 1.3, 0.4, 1) both;\n }\n\n ${t},\n ${t} .${xn}code-unlock-rewards {\n position: relative;\n top: 0;\n animation: ${xn}code-unlock-rise 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;\n }\n\n ${t} .${xn}code-unlock-rewards {\n animation-delay: 0.05s;\n }\n\n @keyframes ${xn}code-unlock-shackle {\n 0% { transform: none; }\n 45% { transform: translateY(-4px); }\n 100% { transform: translateY(-4px) rotate(-32deg); }\n }\n\n \n ${e} .${xn}code-unlock-card--image {\n animation: none;\n }\n\n @keyframes ${xn}code-unlock-lift {\n 0%, 35% { transform: rotate(-4deg); }\n 70% { transform: rotate(0deg) scale(1.05); }\n 100% { transform: rotate(0deg) scale(1); }\n }\n\n \n @keyframes ${xn}code-unlock-fade {\n 0%, 30% { opacity: 1; }\n 100% { opacity: 0.45; transform: translateY(8px); }\n }\n\n @keyframes ${xn}code-unlock-out {\n to { opacity: 0; }\n }\n\n @keyframes ${xn}code-unlock-badge {\n from { opacity: 0; transform: scale(0.6); }\n }\n\n @keyframes ${xn}code-unlock-rise {\n from { opacity: 0; top: 18px; pointer-events: none; }\n }\n\n @media (prefers-reduced-motion: reduce) {\n ${e} .${xn}code-unlock-shackle,\n ${e} .${xn}code-unlock-card,\n ${e} .${xn}code-unlock-page > :not(.${xn}code-unlock-hero):not(.${xn}code-unlock-header),\n ${e} .${xn}code-unlock-screen--lock,\n ${t} .${xn}code-unlock-badge,\n ${t},\n ${t} .${xn}code-unlock-rewards,\n ${n} .${xn}code-unlock-screen--lock {\n animation: none;\n }\n }\n `}()}\n\n \n .${xn}modal.${xn}modal--inline {\n position: relative;\n inset: auto;\n transform: none;\n z-index: auto;\n margin: 0 auto;\n opacity: 1;\n transition: none;\n }\n `}let An=!0;function Ln(e={}){if(An)if(document.getElementById(wn))u.debug("Encore styles already injected");else try{const t=document.createElement("style");t.id=wn,t.textContent=Tn(e),document.head.appendChild(t),u.debug("Encore styles injected successfully")}catch(e){u.error("Failed to inject Encore styles:",e)}}function On(e){return`${xn}${e}`}const Nn=['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(", "),Mn=[.48,.95],Un=e=>Array.isArray(e)?e.filter(e=>"number"==typeof e&&e>0&&e<=1):void 0;const Rn={preventScroll:!0,focusVisible:!1};class Fn{#Ye;#Ze=null;#Qe=null;#Xe=null;#Je=null;#et=!1;#tt=!1;#nt=null;#it=[];#rt=null;#ot=null;#st;#at;#lt=!1;#ct;#dt=null;#ut;#ht;#pt;#ft;#mt=!1;#gt;constructor(e={},t={}){this.#Ye=new Ut,this.#ut=t.dismissible??!0,this.#st=(t.showCloseButton??!0)&&this.#ut,this.#at=!0===t.sdui,this.#ct=t.sheet,this.#ht=gn(t.backgroundColor),this.#pt="start"===t.closePosition,this.#ft=t.interceptDismiss,this.#gt=t.mount,Ln(e)}show(){this.#et?u.warn("Modal is already visible"):(this.#lt=this.#at,this.#yt(),this.#gt?this.#Qe&&this.#gt.appendChild(this.#Qe):(this.#nt=document.activeElement,this.#Ze&&document.body.appendChild(this.#Ze),this.#Qe&&document.body.appendChild(this.#Qe),this.#Qe&&this.#ct&&(this.#dt=function(e,t){const n=e.ownerDocument.defaultView??window,i="function"==typeof n.matchMedia?n.matchMedia("(max-width: 767px)"):void 0;let r,o=null;const s=t=>{r=t,e.style.setProperty("--encore-sheet-fraction",String(t))},a=()=>{const a=t.detents();if(o=i?.matches?a:null,e.classList.toggle(On("modal-fit"),!o&&null!==a),(()=>{if(e.style.removeProperty("height"),!e.classList.contains(On("modal-fit")))return;const t=e.offsetHeight,i=parseFloat(n.getComputedStyle(e).maxHeight);t>0&&t+34<=i?e.style.height=`${t+34}px`:e.classList.remove(On("modal-fit"))})(),!o)return e.classList.remove(On("modal-sheet")),e.style.removeProperty("--encore-sheet-fraction"),void(r=void 0);e.classList.add(On("modal-sheet")),void 0!==t.cornerRadius&&e.style.setProperty("--encore-sheet-radius",`${t.cornerRadius}px`);const l=r,c=void 0===l?o[0]:o.reduce((e,t)=>Math.abs(t-l)<Math.abs(e-l)?t:e);s(c)};let l;const c=t=>{o&&t.isPrimary&&0===t.button&&(function(e,t){for(let n=e;n&&n!==t;n=n.parentElement){const e=getComputedStyle(n).overflowY;if(("auto"===e||"scroll"===e)&&n.scrollHeight>n.clientHeight+1)return!0}return!1}(t.target,e)||(l={id:t.pointerId,x:t.clientX,y:t.clientY,t:t.timeStamp,height:e.getBoundingClientRect().height,moving:!1}))},d=t=>{if(!l||t.pointerId!==l.id)return;const i=t.clientX-l.x,r=t.clientY-l.y;if(!l.moving){if(Math.abs(r)<6&&Math.abs(i)<6)return;if(Math.abs(i)>Math.abs(r))return void(l=void 0);l.moving=!0,e.setPointerCapture?.(t.pointerId),e.dataset.sheetDragging="true"}const s=Math.max(...o??[1])*n.innerHeight;e.style.height=`${Math.min(s,Math.max(0,l.height-r))}px`},u=i=>{if(!l||i.pointerId!==l.id)return;const r=l.moving,a=i.clientY-l.y,c=a/Math.max(1,i.timeStamp-l.t),d=l.height-a;if(l=void 0,delete e.dataset.sheetDragging,e.style.height="",!r||!o)return;e.addEventListener("click",h,{capture:!0,once:!0}),e.addEventListener("pointerdown",p,{capture:!0,once:!0});const u=(d-150*c)/n.innerHeight;t.onDismiss&&u<o[0]/2?t.onDismiss():s(o.reduce((e,t)=>Math.abs(t-u)<Math.abs(e-u)?t:e))},h=e=>{e.stopPropagation(),e.preventDefault()},p=()=>{e.removeEventListener("click",h,{capture:!0})};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",d),e.addEventListener("pointerup",u),e.addEventListener("pointercancel",u),i?.addEventListener?.("change",a),n.addEventListener("resize",a),a(),{refresh:a,destroy:()=>{e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",u),e.removeEventListener("pointercancel",u),e.removeEventListener("pointerdown",p,{capture:!0}),p(),i?.removeEventListener?.("change",a),n.removeEventListener("resize",a)}}}(this.#Qe,{...this.#ct,...this.#ut&&{onDismiss:()=>{this.#Ye.emit("close",void 0),this.hide()}}})),document.body.classList.add(On("no-scroll"))),requestAnimationFrame(()=>{this.#Qe&&this.#et&&null===this.#ot&&(this.#Ze?.classList.add(On("visible")),this.#Qe.classList.add(On("visible")),this.#bt(!0))}),this.#gt||(this.#vt(),this.#wt(),this.#xt()),this.#et=!0,this.#Ye.emit("show",void 0),u.debug("Modal shown"))}hide(){this.#et&&!this.#gt&&(this.#Ze?.classList.remove(On("visible")),this.#Qe?.classList.remove(On("visible")),this.#bt(!1),this.#kt(),this.#ot=setTimeout(()=>{this.#ot=null,this.#$t()},200))}#$t(){this.#bt(!1),this.#Ct(),this.#gt||document.body.classList.remove(On("no-scroll")),!this.#gt&&this.#nt instanceof HTMLElement&&this.#nt.focus(),this.#et=!1,this.#Ye.emit("hide",void 0),u.debug("Modal hidden")}#kt(){null!==this.#ot&&(clearTimeout(this.#ot),this.#ot=null)}onVisibilityChange(e){const t=this.#Ye.on("visibility",e);return this.#tt&&e(!0),t}#bt(e){this.#tt!==e&&(this.#tt=e,this.#Ye.emit("visibility",e))}setBackdropTint(e){this.#Ze?.style.setProperty("--encore-sdui-backdrop",e)}setSduiFrame(e,t){e&&!this.#ht&&(this.#Qe?.style.setProperty("background-color",e),this.#Ze?.style.setProperty("--encore-sdui-backdrop",e)),this.#Qe?.style.setProperty("color-scheme",t)}unlockClose(){this.#Qe&&delete this.#Qe.dataset.sduiLocked}refreshSheet(){this.#dt?.refresh()}isVisible(){return this.#et}setLabelledBy(e){this.#Qe?.setAttribute("aria-labelledby",e)}setCloseButtonHidden(e){this.#mt=e;const t=this.#Xe;if(!t)return;const n=t===document.activeElement;t.hidden=e,e&&n&&this.#xt()}getCloseButton(){return this.#Xe}#It(e){if(!this.#ft)return!1;try{return!0===this.#ft(e)}catch(e){return u.warn("Dismiss interceptor failed; dismissing normally",e),!1}}setContent(e){this.#Je?(this.#Je.innerHTML="",this.#Je.appendChild(e),this.#wt(),this.#dt?.refresh(),this.#Qe?.contains(document.activeElement)||this.#xt()):u.error("Modal body not initialized")}on(e,t){return this.#Ye.on(e,t)}#yt(){this.#gt||(this.#Ze=document.createElement("div"),this.#Ze.className=On("backdrop"),this.#at&&this.#Ze.classList.add(On("backdrop-sdui")),this.#Ze.setAttribute("aria-hidden","true")),this.#Qe=document.createElement("div"),this.#Qe.className=On("modal"),this.#at&&this.#Qe.classList.add(On("modal-sdui")),this.#ut||(this.#Qe.dataset.sduiLocked=""),this.#pt&&this.#Qe.classList.add(On("modal--close-start")),this.#gt&&this.#Qe.classList.add(On("modal--inline")),this.#Qe.setAttribute("role","dialog"),Me(this.#Qe),this.#gt||this.#Qe.setAttribute("aria-modal","true"),this.#Qe.setAttribute("aria-labelledby",On("modal-title")),this.#ht&&this.#Qe.style.setProperty("background-color",this.#ht),this.#st&&(this.#Xe=document.createElement("button"),this.#Xe.className=On("close-button"),this.#Xe.setAttribute("aria-label",Ee("modal.close","Close modal")),this.#Xe.hidden=this.#mt,this.#Xe.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.#Je=document.createElement("div"),this.#Je.className=On("modal-body"),this.#Xe&&this.#Qe.appendChild(this.#Xe),this.#Qe.appendChild(this.#Je)}#Ct(){this.#dt?.destroy(),this.#dt=null,this.#Ze?.remove(),this.#Qe?.remove(),this.#Ze=null,this.#Qe=null,this.#Xe=null,this.#Je=null}#vt(){this.#Xe?.addEventListener("click",()=>{this.#It("close")||(this.#Ye.emit("close",void 0),this.hide())}),this.#ut&&this.#Ze?.addEventListener("click",()=>{this.#It("backdrop")||(this.#Ye.emit("backdropClick",void 0),this.hide())}),this.#rt=this.#St.bind(this),document.addEventListener("keydown",this.#rt)}#St(e){if(this.#et)switch(e.key){case"Escape":if(e.preventDefault(),!this.#ut)break;if(this.#It("escape"))break;this.#Ye.emit("close",void 0),this.hide();break;case"Tab":e.preventDefault(),this.#Et(e.shiftKey)}}#Et(e){const t=this.#Tt();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()}#Tt(){return this.#wt(),this.#it.filter(e=>null===e.closest("[hidden]")&&null===e.closest('[aria-hidden="true"]')&&null===e.closest("[inert]"))}#wt(){this.#Qe&&(this.#it=Array.from(this.#Qe.querySelectorAll(Nn)))}#xt(){if(this.#gt)return;const e=this.#Tt()[0];e&&(e.focus(this.#at?this.#lt?Rn:{preventScroll:!0}:void 0),this.#lt=!1)}destroy(){this.#rt&&document.removeEventListener("keydown",this.#rt),this.#Ye.removeAllListeners(),this.#kt(),this.#et&&this.#$t()}}const Pn="default",zn="selectedOfferId";function jn(e){const t={};for(const[n,i]of Object.entries(e))t[`item.${n}`]=i;return t}function Dn(e){if(void 0!==e.rowOfferId)return e.rowOfferId;const t=e.values[zn];return void 0!==t&&e.offers.some(e=>e.id===t)?t:void 0!==e.currentIndex?e.offers[e.currentIndex]?.id:void 0}function Bn(e){const t=Dn(e);if(void 0===t)return;const n=e.offers.findIndex(e=>e.id===t);return n>=0?n:void 0}function Hn(e){const t=Dn(e);return void 0===t?void 0:e.offers.find(e=>e.id===t)}function _n(e,t,n=e.isCurrentPage){return{...e,rowOfferId:t,isCurrentPage:n}}function Vn(e){const t=e.dominantColors;if(!t)return e.values;const n=Hn(e)?.logoUrl,i=e.values.selectedOfferLogoUrl,r=void 0!==n?t[n]:void 0,o=void 0!==i?t[i]:void 0,s=void 0!==e.appIconUrl?t[e.appIconUrl]:void 0;return void 0===r&&void 0===o&&void 0===s?e.values:{...e.values,...void 0!==s?{appDominantColor:s}:{},...void 0!==r?{offerDominantColor:r}:{},...void 0!==o?{selectedOfferDominantColor:o}:{}}}function qn(e,t){switch(e.kind){case"literal":return e.value;case"binding":return t.values[e.key];case"state":return t.currentState;case"offerIndex":{const e=Bn(t);return void 0===e?void 0:String(e)}case"categoryName":return t.rowCategory;case"offerAttribute":return Wn(e.attribute,t)}}function Wn(e,t){const n=Hn(t);if(n)switch(e){case"badgeLabel":return n.badgeLabel;case"perk":return n.perk;case"advertiserName":return n.advertiserName;case"description":return n.description;case"category":return n.category;case"shareUrl":return n.shareUrl;case"termsUrl":return n.termsUrl;case"quickInstructions":return n.quickInstructions;case"instructions":{const e=n.instructions?.length??0;return 0===e?void 0:String(e)}}}function Kn(e,t){const{name:n,operands:i,payload:r}=e;switch(n){case"and":return(i??[]).every(e=>Kn(e,t));case"or":return(i??[]).some(e=>Kn(e,t));case"not":return!(i??[]).every(e=>Kn(e,t));case"hasMultipleOffers":return t.offers.length>1;case"isCurrentPage":return t.currentIndex===Yn(r);case"isCurrentPageBinding":return t.isCurrentPage;case"stateEquals":return t.currentState===Gn(r,"state");case"valueEquals":{const e=Gn(r,"key"),n=Gn(r,"value");return void 0!==e&&void 0!==n&&t.values[e]===n}case"hasValue":{const e=Gn(r,"key");return void 0!==e&&Object.prototype.hasOwnProperty.call(t.values,e)}case"isSelectedOffer":{const e=Dn(t);if(void 0===e)return!1;const n=Gn(r,"targetKey")??zn;return t.values[n]===e}case"hasIntroOffer":return t.hasIntroOffer;case"hasFreeTrial":return t.hasFreeTrial;case"equals":{const e=r;if(!e)return!1;const n=qn(e.lhs,t),i=qn(e.rhs,t);return void 0!==n&&n===i}case"hasOfferAttribute":return void 0!==Wn(r,t);case"hasInstructionSubtitle":{const e=t.rowStep;if(void 0===e)return!1;const n=(e.subtitle??"").trim(),i=(e.title??"").trim();return""!==n&&n.toLowerCase()!==i.toLowerCase()}case"hasOfferProperty":return"string"==typeof r&&void 0!==Hn(t)?.displayProperties?.[r];case"hasInstructionImage":return void 0!==t.rowStep?.imageUrl;case"isFirstOffer":return 0===Bn(t);case"isLastOffer":{const e=Bn(t);return void 0!==e&&e===t.offers.length-1}case"isMiddleOffer":{const e=Bn(t);return void 0!==e&&t.offers.length>0&&e===Math.floor(t.offers.length/2)}case"offerIndexEquals":return Bn(t)===Yn(r);case"listCountAtLeast":{const{list:e,min:n}=r;return(t.lists?.[e]?.length??0)>=n}}}function Gn(e,t){if("string"==typeof e)return e;if("object"==typeof e&&null!==e){const n=e[t];if("string"==typeof n)return n}}function Yn(e){if("number"==typeof e)return e;if("object"==typeof e&&null!==e){const t=e.index;if("number"==typeof t)return t}}const Zn=e=>"number"==typeof e&&Number.isFinite(e)?`${e}px`:void 0,Qn=e=>"number"==typeof e&&Number.isFinite(e)?e:void 0,Xn=e=>"object"!=typeof e||null===e||Array.isArray(e)?void 0:e;function Jn(e){if("object"!=typeof e||null===e)return[];const t=e,n=[];if("string"==typeof t.binding)n.push(t.binding);else if("object"==typeof t.binding&&null!==t.binding){const e=t.binding;"string"==typeof e.key&&n.push(e.key),n.push(...Jn(e.fallback))}return n}function ei(e,t,n){return`color-mix(in srgb, ${e}, ${t} ${100*Math.min(Math.max(n,0),1)}%)`}function ti(e,t=0){if(t>8||"object"!=typeof e||null===e)return[];if(Array.isArray(e))return e.flatMap(e=>ti(e,t+1));const n=Jn(e);for(const i of Object.values(e))n.push(...ti(i,t+1));return n}function ni(e,t){const n={},i={},r=[],o=(e,t)=>{void 0!==t&&(n[e]=t)};if(!e)return{css:n,structural:i};const s=Xn(e.padding);if(s){const e=Zn(s.all);void 0!==e&&o("padding",e);const t=Zn(s.horizontal);void 0!==t&&o("padding-inline",t);const n=Zn(s.vertical);void 0!==n&&o("padding-block",n),o("padding-top",Zn(s.top)),o("padding-bottom",Zn(s.bottom)),o("padding-inline-start",Zn(s.leading)),o("padding-inline-end",Zn(s.trailing))}const a=Xn(e.frame);if(a){o("width",ii(a.width)),o("height",ii(a.height)),o("min-width",Zn(a.minWidth)),o("max-width",ii(a.maxWidth)),o("min-height",Zn(a.minHeight)),o("max-height",ii(a.maxHeight));const e=a.alignment;if("string"==typeof e){const t=oi[e];t&&(o("display","grid"),o("grid-template-columns","minmax(0, 1fr)"),o("grid-template-rows","minmax(0, 1fr)"),o("justify-items",t.justify),o("align-items",t.align))}}o("border-radius",Zn(e.cornerRadius));const l=Xn(e.cornerRadii);if(l){const e=e=>Zn(l[e])??"0px";o("border-radius",`${e("topLeading")} ${e("topTrailing")} ${e("bottomTrailing")} ${e("bottomLeading")}`)}o("background-color",t(e.backgroundColor)),o("box-shadow",ri(e.shadow,t,!1)??void 0),o("opacity",void 0===e.opacity?void 0:String(Qn(e.opacity)??1)),o("overflow",!0===e.clipped?"hidden":void 0),o("border-width",Zn(e.borderWidth)),void 0!==e.borderWidth&&o("border-style","solid"),o("border-color",t(e.borderColor));const c=Xn(e.offset);c&&r.push(`translate(${Zn(c.x)??"0px"}, ${Zn(c.y)??"0px"})`);const d=Qn(e.scale);void 0!==d&&r.push(`scale(${d})`);const u=Qn(e.rotation);void 0!==u&&r.push(`rotate(${u}deg)`),r.length>0&&o("transform",r.join(" "));const h=ri(e.innerShadow,t,!0);h&&(n["box-shadow"]=n["box-shadow"]?`${n["box-shadow"]}, ${h}`:h);const p=function(e){switch("string"==typeof e?e:Xn(e)?Object.keys(Xn(e))[0]:void 0){case"circle":return{"clip-path":"circle(50%)"};case"capsule":return{"border-radius":"9999px","clip-path":"inset(0 round 9999px)"};case"rectangle":{const t=Xn(e)?Zn(Xn(Xn(e).rectangle)?.cornerRadius??Xn(e).rectangle):void 0;return t?{"border-radius":t,"clip-path":`inset(0 round ${t})`}:{"clip-path":"inset(0)"}}default:return}}(e.clipShape);p&&Object.assign(n,p);const f=Xn(e.fixedSize);f&&(!0===f.horizontal&&(o("flex-shrink","0"),o("width","max-content")),!0===f.vertical&&o("height","max-content"));for(const t of["overlay","backgroundElement","gradientBorder","stateStyles","stateAnimation"])void 0!==e[t]&&(i[t]=e[t]);const m=Qn(e.layoutPriority);void 0!==m&&0!==m&&o("flex-shrink",m>0?"0":"1000");const g=e.containerRelativeFrame;if(void 0!==g){const e=Xn(g)?.axis??(!0===g?"horizontal":void 0);"vertical"===e?o("height","100%"):"horizontal"!==e&&!0!==g||o("width","calc(100cqw - var(--sdui-margin-inline, 0px))")}!0===e.ignoresSafeArea&&(o("margin-top","calc(-1 * env(safe-area-inset-top))"),o("margin-bottom","calc(-1 * env(safe-area-inset-bottom))"));const y=t=>{const n=Xn(e.padding);if(!n)return;const i="top"===t||"bottom"===t?"vertical":"horizontal";return Zn(n[t])??Zn(n[i])??Zn(n.all)},b=(e,t)=>[y(e),y(t)].filter(e=>void 0!==e).map(e=>` + ${e}`).join(""),v=Qn(e.relativeWidth);void 0!==v&&o("width",`calc((100cqw - var(--sdui-margin-inline, 0px)) * ${v}${b("leading","trailing")})`);const w=Qn(e.relativeHeight);void 0!==w&&o("height",`calc(var(--sdui-container-height, 100dvh) * ${w}${b("top","bottom")})`);const x=[["top","top","padding-top"],["bottom","bottom","padding-bottom"],["leading","left","padding-inline-start"],["trailing","right","padding-inline-end"]],k=!0===e.safeAreaPadding,$=Xn(e.safeAreaPadding);for(const[e,t,n]of x)(k||!0===$?.[e])&&o(n,`calc(${y(e)??"0px"} + env(safe-area-inset-${t}) + 16px)`);!0===e.scrollTargetLayout&&(i.scrollTargetLayout=!0);for(const t of["scrollTransition","scrollFade"])void 0!==e[t]&&(i[t]=e[t]);return((Qn(e.cornerRadius)??0)>0||void 0!==Xn(e.cornerRadii))&&void 0===e.overlay&&(i.clipContent=!0),{css:n,structural:i}}function ii(e){if("infinity"===e)return"100%";const t=Xn(e);return t?!0===t.infinity?"100%":Zn(t.fixed):Zn(e)}function ri(e,t,n){const i=Xn(e);if(!i)return;const r=Zn(i.x)??"0px",o=Zn(i.y)??"0px",s=Zn(i.radius)??Zn(i.blur)??"0px",a=Qn(i.opacity)??(n?1:si),l=ai(t(i.color),a);return void 0!==l?`${n?"inset ":""}${r} ${o} ${s} ${l}`:void 0}const oi={leading:{justify:"start",align:"center"},trailing:{justify:"end",align:"center"},center:{justify:"center",align:"center"},top:{justify:"center",align:"start"},bottom:{justify:"center",align:"end"},topLeading:{justify:"start",align:"start"},topTrailing:{justify:"end",align:"start"},bottomLeading:{justify:"start",align:"end"},bottomTrailing:{justify:"end",align:"end"}},si=.1;function ai(e,t){if(void 0!==e)return t>=1?e:`color-mix(in srgb, ${e} ${100*Math.max(0,Math.min(t,1))}%, transparent)`}const li="state",ci="offers",di="index",ui="row",hi="lists",pi="time",fi="motion",mi=e=>`value:${e}`;function gi(e){return e.flatMap(e=>"offerDominantColor"===e?[mi(e),ci,di,ui]:"selectedOfferDominantColor"===e?[mi(e),mi("selectedOfferLogoUrl")]:[mi(e)])}function yi(e){switch(e.kind){case"literal":return[];case"binding":return[mi(e.key)];case"state":return[li];case"offerIndex":case"offerAttribute":return[ci,di,ui];case"categoryName":return[ui]}}function bi(e){const t=new Set;return vi(e,t),[...t]}function vi(e,t){for(const n of e.operands??[])vi(n,t);switch(e.name){case"and":case"or":case"not":return;case"hasMultipleOffers":return void t.add(ci);case"isCurrentPage":return void t.add(di);case"isCurrentPageBinding":return t.add(di),void t.add(ui);case"stateEquals":return void t.add(li);case"valueEquals":case"hasValue":{const n=function(e){if("string"==typeof e)return e;if("object"==typeof e&&null!==e){const t=e.key;if("string"==typeof t)return t}}(e.payload);return void t.add(void 0===n?li:mi(n))}case"isSelectedOffer":{const n=function(e){if("object"==typeof e&&null!==e){const t=e.targetKey;if("string"==typeof t)return t}return"selectedOfferId"}(e.payload);return t.add(mi(n)),t.add(ci),t.add(di),void t.add(ui)}case"hasIntroOffer":case"hasFreeTrial":return void t.add("iap");case"equals":{const n=e.payload;if(n?.lhs)for(const e of yi(n.lhs))t.add(e);if(n?.rhs)for(const e of yi(n.rhs))t.add(e);return}case"hasOfferAttribute":case"isFirstOffer":case"isLastOffer":case"isMiddleOffer":case"offerIndexEquals":case"hasOfferProperty":return t.add(ci),t.add(di),void t.add(ui);case"listCountAtLeast":return void t.add(hi);case"hasInstructionSubtitle":case"hasInstructionImage":return t.add(ui),t.add(ci),void t.add(di)}}const wi=e=>Math.min(Math.abs(e),1),xi=(e,t)=>1-(1-(e.scale??1))*wi(t),ki=(e,t)=>(e.rotation??0)*t,$i=(e,t)=>(e.yOffset??0)*wi(t);function Ci(e,t,n,i,r){r(i.color(e,Vn(t)));const o=Jn(e);0!==o.length&&n.addSite({deps:gi(o),run:t=>r(i.color(e,Vn(t)))})}function Ii(e,t){if("stroke"===e.dataset.sdui)return;const n="zStack"!==e.dataset.sdui&&"confetti"!==e.dataset.sdui&&"true"!==e.dataset.sduiBleed||void 0===t.pointerEvents?t:{...t,pointerEvents:void 0};if("contents"!==e.style.display){for(const[t,i]of Object.entries(n))void 0!==i&&("maxWidth"!==t&&"maxHeight"!==t||!e.style[t])&&(e.style[t]=i);return}const i={...Si(e),...n};e.dataset.sduiFill=JSON.stringify(i);for(const t of Array.from(e.children))Ii(t,i)}function Si(e){try{return JSON.parse(e.dataset.sduiFill??"{}")}catch{return{}}}function Ei(e,t){const n=Si(e);0!==Object.keys(n).length&&t instanceof Element&&t instanceof HTMLElement&&Ii(t,n)}function Ti(e,t){for(const[n,i]of Object.entries(t))e.style.setProperty(n,i)}function Ai(e,t,n,i,r){e.style.boxSizing="border-box";const o=e=>t=>r.color(t,Vn(e)),{css:s,structural:a}=ni(t.style,o(n));if(Ti(e,s),!0===t.style?.accessibilityHidden&&e.setAttribute("aria-hidden","true"),"ltr"===t.style?.layoutDirection&&(e.dir="ltr"),a.clipContent&&!s.overflow&&(e.style.overflow="clip"),(void 0!==s.width||void 0!==s.height)&&!s.display){const t=e.tagName,n=e.style.display;"SPAN"!==t&&"A"!==t||""!==n&&"inline"!==n||(e.style.display="inline-grid",e.style.placeItems="center")}const l=ti(t.style);if(l.length>0&&i.addSite({deps:gi(l),run:n=>{Ti(e,ni(t.style,o(n)).css),a.gradientBorder&&Bi(e,a.gradientBorder,r,n)}}),(a.backgroundElement||a.overlay)&&(""===e.style.position&&(e.style.position="relative"),e.style.isolation="isolate"),a.backgroundElement){const t=i.compileChild(a.backgroundElement,n).node;Oi(t),t.style.zIndex="0",e.insertBefore(t,e.firstChild)}if(a.scrollTargetLayout)for(const t of Array.from(e.children))Ii(t,{scrollSnapAlign:"center"});a.gradientBorder&&Bi(e,a.gradientBorder,r,n),a.stateStyles&&function(e,t,n,i,r){const o=zi(n?.duration)??.25;e.style.transition=`all ${o}s ${Hi["string"==typeof n?.curve?n.curve:"easeInOut"]??"ease-in-out"}`;const s={};for(let t=0;t<e.style.length;t+=1){const n=e.style.item(t);s[n]=e.style.getPropertyValue(n)}r.addSite({deps:[li],run:n=>{for(const[t,n]of Object.entries(s))e.style.setProperty(t,n);const r=ji(t[n.currentState]);r&&Ti(e,ni(r,e=>i.color(e,Vn(n))).css)}})}(e,a.stateStyles,a.stateAnimation,r,i),r.motion&&r.trigger&&void 0!==t.style?.loop&&r.trigger.kit.attachLoop(e,t.style.loop,{transform:s.transform??"",opacity:s.opacity??""},r.motion,i);const c=a.scrollFade,d={opacity:1},u=a.scrollTransition?function(e,t,n){const i=e.style.transform,r=()=>e.closest("[data-sdui='scrollView']"),o=()=>{const o=r();if(!o)return;const s=o.getBoundingClientRect(),a=e.getBoundingClientRect();if(0===s.width)return;const l=(c=s.width/2)<=0?0:Math.min(Math.max((a.left+a.width/2-(s.left+s.width/2))/c,-1),1);var c;{const r={...void 0!==zi(t.scale)?{scale:zi(t.scale)}:{},...void 0!==zi(t.opacity)?{opacity:zi(t.opacity)}:{},...void 0!==zi(t.rotation)?{rotation:zi(t.rotation)}:{},...void 0!==zi(t.yOffset)?{yOffset:zi(t.yOffset)}:{}};e.style.transform=[i,`scale(${xi(r,l)})`,`rotate(${ki(r,l)}deg)`,`translateY(${$i(r,l)}px)`].filter(e=>""!==e).join(" "),e.style.opacity=String(((e,t)=>1-(1-(e.opacity??1))*wi(t))(r,l)*n.opacity)}};return queueMicrotask(()=>{const t=r();if(!t)return;t.addEventListener("scroll",o,{passive:!0}),o();const n=t.ownerDocument.defaultView,i=n&&"function"==typeof n.ResizeObserver?new n.ResizeObserver(o):void 0;i?.observe(t);const s=t.firstElementChild;s&&i?.observe(s,{box:"border-box"});const a=new MutationObserver(()=>{e.isConnected||(t.removeEventListener("scroll",o),i?.disconnect(),a.disconnect())});a.observe(t,{childList:!0,subtree:!0})}),o}(e,a.scrollTransition,d):void 0;if(c){u||e.style.transition||(e.style.transition="opacity 0.25s ease-in-out");const t=t=>{const n=Bn(t),i=void 0===n?0:Math.abs(n-(t.currentIndex??0));d.opacity=function(e,t=1,n=0){return t+(n-t)*Math.min(Math.max(Math.abs(e),0),1)}(i,zi(c.centeredOpacity)??1,zi(c.offCenterOpacity)??0),u?u():e.style.opacity=String(d.opacity)};t(n),i.addSite({deps:[di,ci,ui],run:t})}if(a.overlay){const t=i.compileChild(a.overlay,n).node;Oi(t),t.style.zIndex="2",e.appendChild(t)}}function Li(e,t=0){if(t>12)return!1;const n=[...e.children??[],...e.content?[e.content]:[],...e.itemTemplate?[e.itemTemplate]:[],...e.ifTrue?[e.ifTrue]:[],...e.ifFalse?[e.ifFalse]:[],...e.label?[e.label]:[]];return!("hStack"!==e.element||!n.some(e=>"spacer"===e.element))||n.some(e=>Li(e,t+1))}function Oi(e){"contents"!==e.style.display&&""!==e.style.display||(e.style.display="grid"),e.style.position="absolute",e.style.inset="0"}function Ni(e,t=0){if(t>8)return{wide:!1,tall:!1};const n=e.style?.frame,i="object"==typeof n&&null!==n&&void 0!==n.width||void 0!==e.style?.relativeWidth;let r=!i&&(Ri(n,"maxWidth")||Li(e)),o=Ri(n,"maxHeight");if("shape"===e.element||"gradient"===e.element){const t="object"==typeof n&&null!==n?n:{},i=e.style??{};void 0===t.width&&void 0===i.relativeWidth&&(r=!0),void 0===t.height&&void 0===i.relativeHeight&&(o=!0)}"progress"!==e.element||i||(r=!0),"scrollView"!==e.element||i||(r=!0);const s=Mi.has(e.element);if(!Ui.has(e.element)&&!s||r&&o)return{wide:r,tall:o};const a="object"==typeof n&&null!==n&&void 0!==n.height||void 0!==e.style?.relativeHeight;for(const n of[e.ifTrue,e.ifFalse,e.itemTemplate,e.content,...s?e.children??[]:[]]){if(!n)continue;const e=Ni(n,t+1);r=r||!i&&e.wide,o=o||!a&&e.tall}return{wide:r,tall:o}}const Mi=new Set(["vStack","hStack","zStack"]),Ui=new Set(["conditional","forEach","button","group"]);function Ri(e,t){if("object"!=typeof e||null===e)return!1;const n=e[t];return"infinity"===n||"object"==typeof n&&null!==n&&!0===n.infinity}function Fi(e,t){if(!t.content)return;const{wide:n,tall:i}=Ni(t.content);if(!n&&!i)return;const r=e.firstElementChild;if(!r)return;""!==e.style.display&&"contents"!==e.style.display||(e.style.display="grid",e.style.gridTemplateColumns="minmax(0, 1fr)",e.style.gridTemplateRows="minmax(0, 1fr)");const o={};n&&(o.justifySelf="stretch"),i&&(o.alignSelf="stretch"),Ii(r,o)}function Pi(e,t,n,i,r){const o=i.document.createElement(e);o.dataset.sdui=t.element;for(const e of t.children??[])o.appendChild(i.compileChild(e,n).node);return t.content&&o.appendChild(i.compileChild(t.content,n).node),Ai(o,t,n,i,r),{el:o,rendered:{node:o}}}const zi=e=>"number"==typeof e&&Number.isFinite(e)?e:void 0,ji=e=>"object"!=typeof e||null===e||Array.isArray(e)?void 0:e,Di={topToBottom:"to bottom",bottomToTop:"to top",leadingToTrailing:"to right",trailingToLeading:"to left"};function Bi(e,t,n,i){const r=Array.isArray(t.colors)?t.colors.map(e=>n.color(e,Vn(i))).filter(e=>void 0!==e):[];let o=Array.from(e.children).find(e=>"stroke"===e.dataset.sdui);if(0===r.length)return void o?.remove();o||(o=e.ownerDocument.createElement("div"),o.dataset.sdui="stroke",e.appendChild(o)),""===e.style.position&&(e.style.position="relative"),e.style.isolation="isolate";const s=Di[String(t.direction)]??Di.leadingToTrailing,a=1===r.length?[r[0],r[0]]:r,l=zi(t.cornerRadius),c="linear-gradient(#000 0 0)";Object.assign(o.style,{position:"absolute",inset:"0",zIndex:"1",pointerEvents:"none",boxSizing:"border-box",padding:`${zi(t.width)??1}px`,borderRadius:void 0===l?"inherit":`${l}px`,background:`linear-gradient(${s}, ${a.join(", ")})`}),o.style.setProperty("-webkit-mask",`${c} content-box, ${c}`),o.style.setProperty("-webkit-mask-composite","xor"),o.style.setProperty("mask",`${c} content-box exclude, ${c}`)}const Hi={linear:"linear",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",spring:"cubic-bezier(0.34, 1.56, 0.64, 1)"};function _i(e){for(const t of Array.from(e.children)){const e=t.style;if("contents"===e.display){if(_i(t))return!0}else if("none"!==e.display)return!0}return!1}function Vi(e){let t=e;for(;"contents"===t?.style.display;)t=t.parentElement;if("group"!==t?.dataset.sdui)return;const n=!_i(t);if(n&&void 0===t.dataset.sduiVacant)t.dataset.sduiVacant=t.style.display,t.style.display="none";else{if(n||void 0===t.dataset.sduiVacant)return;t.style.display=t.dataset.sduiVacant,delete t.dataset.sduiVacant}Vi(t.parentElement)}class qi extends Error{constructor(e){super(e),this.name="SduiCompileError"}}const Wi=e=>e,Ki=e=>void 0===e||e.active&&Ki(e.parent);class Gi{#At=new Map;register(e,t){return this.#At.set(e,t),this}get(e){return this.#At.get(e)}get registered(){return[...this.#At.keys()]}}class Yi{root;#Lt;constructor(e,t){this.root=e,this.#Lt=t}get siteCount(){return this.#Lt.length}get activeSiteCount(){return this.#Lt.filter(e=>Ki(e.group)).length}update(e,t){const n=void 0===t?void 0:new Set(t);let i=0;for(const t of[...this.#Lt])Ki(t.group)&&(void 0===n||t.deps.some(e=>n.has(e)))&&(t.run(t.scope(e)),i+=1);return i}}const Zi=2,Qi=2,Xi=["text","systemImage","asyncImage","asyncVideo","appIcon","button","vStack","hStack","zStack","spacer","shape","gradient","scrollView","forEach","conditional","group","textField","toggle","slideButton","compactPageIndicator","confetti","empty"],Ji=["hasMultipleOffers","isCurrentPage","isCurrentPageBinding","stateEquals","valueEquals","hasValue","hasIntroOffer","hasFreeTrial","isSelectedOffer","and","or","not","equals","hasOfferAttribute","hasOfferProperty","hasInstructionSubtitle","hasInstructionImage","isFirstOffer","isLastOffer","isMiddleOffer","offerIndexEquals"],er=["accent","onAccent","accentTitle","background","onBackground","surface","onSurface","border","muted","error"],tr=["rectangle","roundedRectangle","circle","capsule"],nr=["topToBottom","bottomToTop","leadingToTrailing","trailingToLeading"],ir=["progress","marquee"],rr=["listCountAtLeast"],or=e=>new Set(e),sr=or(Xi);or(Ji);const ar=or(["and","or","not"]),lr=or(["close","claimOffer","openUrl","setState","setValue","selectOffer","setOfferIndex","triggerIAP","submitLead","share","reportCompletion"]),cr=or(["badgeLabel","perk","advertiserName","description","category","shareUrl","termsUrl","quickInstructions","instructions"]),dr=or(["offers","pageIndicators","categories","instructions"]),ur=or(["offerAdvertiserName","offerDescription","offerPerk","offerCtaText","offerQuickInstructions","offerNewPrice","offerOldPrice","titleText","accentTitleText","subtitleText","categoryName","instructionTitle","instructionSubtitle","instructionCtaText","instructionNumber"]),hr=or(["offerPrimaryCreative","offerLogoImage","offerHeroImage","instructionImage"]),pr=or(["padding","frame","cornerRadius","cornerRadii","backgroundColor","shadow","innerShadow","opacity","clipShape","clipped","ignoresSafeArea","layoutPriority","containerRelativeFrame","scrollTargetLayout","borderWidth","borderColor","fixedSize","offset","stateStyles","stateAnimation","scale","rotation","relativeWidth","relativeHeight","overlay","backgroundElement","gradientBorder","scrollTransition","scrollFade","safeAreaPadding"]),fr=or(ir);or(rr);const mr=or(["trigger","dismissTrigger"]),gr=or(["hostList"]),yr=or(["loop","layoutDirection","accessibilityHidden"]);class br extends Error{path;constructor(e,t){super(`${e} (at ${t})`),this.name="SduiDecodeError",this.path=t}}const vr=e=>"string"==typeof e?e:JSON.stringify(e)??String(e),wr=e=>"object"==typeof e&&null!==e&&!Array.isArray(e);let xr=!1;const kr=e=>sr.has(e)||xr&&fr.has(e),$r=new Set(["style","children","content","itemTemplate","label","filter","alignment","condition","ifTrue","ifFalse","dataSource","action","fallback","animateWhen"]),Cr=e=>{if(!wr(e))return!1;const t=Object.keys(e);return 1===t.length&&kr(t[0])&&wr(e[t[0]])},Ir=e=>Cr(e)||Array.isArray(e)&&e.length>0&&e.every(Cr),Sr=e=>new Set(e),Er=Sr(["leading","trailing","center","top","bottom","topLeading","topTrailing","bottomLeading","bottomTrailing"]),Tr=Sr(["ultraLight","thin","light","regular","medium","semibold","bold","heavy","black"]),Ar=Sr(tr),Lr=Sr(nr),Or=Sr(["horizontal","vertical"]),Nr=Sr(["viewAligned","paging"]),Mr=Sr(["fit","fill"]),Ur=Sr(["row","creative"]),Rr=Sr(["emailAddress"]),Fr=Sr(["emailAddress"]),Pr=Sr(["label","secondaryLabel","tertiaryLabel","systemBackground","secondarySystemBackground","systemGroupedBackground","secondarySystemGroupedBackground","separator","tertiarySystemFill"]),zr=Sr(er),jr=Sr([...er,"inkOnAccent","secondary","track","backgroundEnd"]),Dr=Sr([...tr,"ellipse"]),Br=Sr(["card","arrow","button"]),Hr=Sr(["linear","radial"]),_r=Sr(["clock","hoursMinutes","hours","minutes","seconds","largestUnit"]),Vr=Sr(["linear","easeIn","easeOut","easeInOut"]),qr=Sr(["horizontal","vertical"]),Wr=Sr(["ltr"]),Kr=Sr(["linear","easeIn","easeOut","easeInOut","spring"]);function Gr(e,t){if("string"==typeof e)return{kind:"literal",value:e};if(!wr(e))throw new br("value ref must be a string or an object",t);if("string"==typeof e.value)return{kind:"literal",value:e.value};if("string"==typeof e.binding)return{kind:"binding",key:e.binding};if(void 0!==e.state)return{kind:"state"};if(void 0!==e.offerIndex)return{kind:"offerIndex"};if(void 0!==e.categoryName)return{kind:"categoryName"};if(void 0!==e.offerAttribute){const n=e.offerAttribute;if("string"!=typeof n||!cr.has(n))throw new br(`unknown offer attribute "${vr(n)}"`,t);return{kind:"offerAttribute",attribute:n}}throw new br("value ref names no known form",t)}function Yr(e,t){if(!wr(e))throw new br("condition must be an object",t);const n=(xr?[...Ji,...rr]:Ji).find(t=>t in e);if(void 0===n)throw new br(`unknown condition "${vr(Object.keys(e)[0])}"`,t);const i=e[n],r=`${t}.${n}`;if(ar.has(n)){const e="not"===n?[i]:i;if(!Array.isArray(e))throw new br(`"${n}" needs ${"not"===n?"a condition":"an array"}`,r);return{name:n,operands:e.map((e,t)=>Yr(e,`${r}[${t}]`))}}if("equals"===n){if(!wr(i))throw new br('"equals" needs an object',r);return{name:"equals",payload:{lhs:Gr(i.lhs,`${r}.lhs`),rhs:Gr(i.rhs,`${r}.rhs`)}}}if("hasOfferAttribute"===n){const e="string"==typeof i?i:wr(i)?i.attribute:void 0;if("string"!=typeof e||!cr.has(e))throw new br(`unknown offer attribute "${vr(e)}"`,r);return{name:"hasOfferAttribute",payload:e}}if("listCountAtLeast"===n){if(!wr(i)||"string"!=typeof i.list||!Number.isInteger(i.min))throw new br('"listCountAtLeast" needs a list and an integer min',r);return{name:"listCountAtLeast",payload:{list:i.list,min:i.min}}}if("hasOfferProperty"===n&&"string"!=typeof i)throw new br('"hasOfferProperty" needs a key',r);return{name:n,payload:i}}const Zr=e=>lr.has(e)||xr&&mr.has(e),Qr=Object.freeze({type:"unknown",params:Object.freeze({})});function Xr(e,t){if("string"==typeof e)return Zr(e)?{type:e,params:{}}:Qr;if(!wr(e))throw new br("action must be a string or an object",t);const n=e.type;if(void 0===n||"string"!=typeof n)throw new br("action type must be a string",t);if(!Zr(n))return Qr;const i={};for(const[t,n]of Object.entries(e))"type"!==t&&(i[t]=n);if("trigger"===n){const e=i.target;if("string"!=typeof e||!Br.has(e))throw new br(`unknown trigger target "${vr(e)}"`,t)}for(const e of["offerIndex","offerIndexDelta","promoteToIndex"]){const n=i[e];if(null!=n&&!Number.isInteger(n))throw new br(`${e} must be an integer`,t)}const r=i.urlAttribute;if(null!=r&&("string"!=typeof r||!cr.has(r)))throw new br(`unknown offer attribute "${vr(r)}"`,`${t}.urlAttribute`);const o={type:n,params:i};return null==i.setValueRef?o:{...o,valueRef:Gr(i.setValueRef,`${t}.setValueRef`)}}const Jr=new Set(["overlay","backgroundElement"]);function eo(e,t){if(!wr(e))throw new br("node must be an object",t);const n=(xr?[...Xi,...ir]:Xi).find(t=>t in e);if(void 0===n)throw new br(`unknown element "${vr(Object.keys(e)[0])}"`,t);const i=`${t}.${n}`,r=e[n],o=wr(r)?to(r):{},s={element:n,props:{}};for(const[e,t]of Object.entries(o))$r.has(e)||(s.props[e]=t);!function(e,t,n){if("gradient"===e&&(!xr||"radial"!==t.type)&&"string"!=typeof t.direction)throw new br('gradient needs "direction"',n);for(const[i,r]of io[e]??[]){const o=t[i];if(!("any"===r?void 0!==o:"array"===r?Array.isArray(o):"object"===r?wr(o):typeof o===r))throw new br(`${e} needs "${i}"`,n)}}(n,o,i),function(e,t,n){for(const[i,r]of ro){if("type"===i&&"shape"!==e)continue;const o=t[i];if(null!=o&&("string"!=typeof o||!(xr&&"type"===i?Dr:r).has(o)))throw new br(`unknown ${i} "${vr(o)}"`,n)}}(n,o,i),function(e,t,n){if("compactPageIndicator"===e||"confetti"===e)return;const i=(e,t)=>{if(void 0!==e){if(!wr(e)||"number"!=typeof e.size)throw new br("font needs a size",t);if("string"!=typeof e.weight||!Tr.has(e.weight))throw new br(`unknown font weight "${vr(e.weight)}"`,t)}};"text"!==e&&"systemImage"!==e||i(t.font,`${n}.font`),"gradient"===e&&Array.isArray(t.colors)&&t.colors.forEach((e,t)=>{if(!wr(e)||null==e.color)throw new br("gradient stop needs a color",`${n}.colors[${t}]`)}),"text"===e&&Array.isArray(t.segments)&&t.segments.forEach((e,t)=>{const r=`${n}.segments[${t}]`;if(!wr(e)||"string"!=typeof e.text)throw new br("segment needs a text",r);const o=e.textBinding;if(null!=o&&("string"!=typeof o||!ur.has(o)))throw new br(`unknown textBinding "${vr(o)}"`,r);i(e.font??void 0,`${r}.font`)});const r="conditional"!==e&&wr(t.style)?t.style.frame:void 0,o=wr(r)?r.alignment:void 0;if(null!=o&&("string"!=typeof o||!Er.has(o)))throw new br(`unknown frame alignment "${vr(o)}"`,`${n}.style.frame`)}(n,o,i),function(e,t){for(const n of so){const i=e[n];if(null!=i&&!Number.isInteger(i))throw new br(`${n} must be an integer`,t)}}(o,i),xr&&function(e,t,n){const i=(e,t,n,i)=>{if(null!=e&&("string"!=typeof e||!t.has(e)))throw new br(`unknown ${n} "${vr(e)}"`,i)};if("gradient"===e&&i(t.type,Hr,"gradient type",n),"marquee"===e&&i(t.axis,qr,"marquee axis",n),"text"===e&&null!=t.countdown){const e=t.countdown;if(!wr(e)||"string"!=typeof e.to)throw new br("countdown needs a time key",`${n}.countdown`);i(e.format,_r,"countdown format",`${n}.countdown`)}const r=wr(t.style)?t.style:void 0;if(r){i(r.layoutDirection,Wr,"layout direction",`${n}.style`);const e=r.loop;if(null!=e){if(!wr(e))throw new br("loop must be an object",`${n}.style.loop`);i(e.curve,Vr,"loop curve",`${n}.style.loop`),function(e,t){const n=e=>{throw new br(`loop ${e}`,t)},i=e=>"number"==typeof e&&Number.isFinite(e);if((!i(e.duration)||e.duration<=0)&&n("needs a positive duration"),null!=e.phaseOffset){const t=e.phaseOffset;(!i(t)||t<0||t>1)&&n("phaseOffset must be 0..1")}const r=e.keyframes;(!Array.isArray(r)||r.length<2)&&n("needs at least two keyframes");const o=r.map(e=>wr(e)&&i(e.at)?e.at:NaN);0===o[0]&&1===o[o.length-1]||n("keyframes must run from at 0 to at 1");for(let e=1;e<o.length;e+=1)o[e]>o[e-1]||n("keyframes must ascend")}(e,`${n}.style.loop`)}}}(n,o,i);for(const[e,t]of Object.entries(o))$r.has(e)||ao(t,i);if(wr(o.style)&&ao(o.style,`${i}.style`),void 0!==o.style&&(s.style=function(e,t){if(!wr(e))throw new br("style must be an object",t);const n={};for(const[i,r]of Object.entries(to(e)))(pr.has(i)||xr&&yr.has(i))&&(n[i]=Jr.has(i)?eo(r,`${t}.${i}`):r);return n}(o.style,`${i}.style`)),void 0!==o.children){if(!Array.isArray(o.children))throw new br("children must be an array",i);s.children=o.children.map((e,t)=>eo(e,`${i}.children[${t}]`))}if(void 0!==o.content&&(s.content=eo(o.content,`${i}.content`)),void 0!==o.itemTemplate&&(s.itemTemplate=eo(o.itemTemplate,`${i}.itemTemplate`)),void 0!==o.alignment){const e=o.alignment;if("string"!=typeof e||!Er.has(e))throw new br(`unknown alignment "${vr(e)}"`,i);s.alignment=e}if(void 0!==o.condition&&(s.condition=Yr(o.condition,`${i}.condition`)),void 0!==o.ifTrue&&(s.ifTrue=eo(o.ifTrue,`${i}.ifTrue`)),void 0!==o.ifFalse&&(s.ifFalse=eo(o.ifFalse,`${i}.ifFalse`)),void 0!==o.dataSource){const e=o.dataSource;if("string"!=typeof e||!(dr.has(e)||xr&&gr.has(e)))throw new br(`unknown data source "${vr(e)}"`,i);if("hostList"===e&&"string"!=typeof o.list)throw new br('a "hostList" forEach needs a list',i);s.dataSource=e}void 0!==o.fallback&&xr&&(s.fallback=eo(o.fallback,`${i}.fallback`)),void 0!==o.animateWhen&&xr&&(s.animateWhen=Yr(o.animateWhen,`${i}.animateWhen`)),void 0!==o.label&&(s.label=eo(o.label,`${i}.label`)),void 0!==o.filter&&(s.filter=Yr(o.filter,`${i}.filter`)),void 0!==o.action&&(s.action=Xr(o.action,`${i}.action`));for(const[e,t]of Object.entries(s.props))if(Ir(t))throw new br(`"${e}" holds a subtree this build does not decode`,i);return s}function to(e){const t={};for(const[n,i]of Object.entries(e))null!==i&&(t[n]=i);return t}function no(e,t={}){const n=xr;xr=!0===t.trigger;try{return function(e){if(!wr(e))throw new br("template must be an object","root");if(void 0===e.root)throw new br("template has no root","root");const t={};for(const[n,i]of Object.entries(e))"root"!==n&&"version"!==n&&"useCase"!==n&&(t[n]=i);const n=function(e){if(null==e)return;if(!wr(e))throw new br("stateActions must be an object","stateActions");const t={};for(const[n,i]of Object.entries(e)){const e=`stateActions.${n}`;if(!wr(i))throw new br("state actions must be an object",e);t[n]=null==i.onEnter?{}:{onEnter:Xr(i.onEnter,`${e}.onEnter`)}}return t}(e.stateActions);return{..."string"==typeof e.version?{version:e.version}:{},..."string"==typeof e.useCase?{useCase:e.useCase}:{},root:eo(e.root,"root"),presentation:t,...void 0===n?{}:{stateActions:n}}}(e)}finally{xr=n}}const io={text:[["text","string"]],systemImage:[["systemName","string"]],button:[["content","object"],["action","any"]],vStack:[["children","array"]],hStack:[["children","array"]],zStack:[["children","array"]],group:[["content","object"]],textField:[["valueKey","string"]],toggle:[["valueKey","string"],["label","object"]],slideButton:[["text","string"],["action","any"]],shape:[["type","string"]],gradient:[["colors","array"]],scrollView:[["content","object"]],forEach:[["dataSource","string"],["itemTemplate","object"]],conditional:[["condition","object"],["ifTrue","object"]]},ro=[["textBinding",ur],["urlBinding",hr],["weight",Tr],["type",Ar],["direction",Lr],["axis",Or],["scrollTargetBehavior",Nr],["contentMode",Mr],["impressionSource",Ur],["keyboardType",Rr],["textContentType",Fr],["multilineAlignment",Er]],oo=[["semantic",Pr],["appearance",zr],["curve",Kr]],so=["limit","offset","columns","lineLimit"];function ao(e,t,n=0){if(!(n>6)&&wr(e)){for(const[n,i]of oo){const r=e[n];if(null!=r&&("string"!=typeof r||!(xr&&"appearance"===n?jr:i).has(r)))throw new br(`unknown ${n} "${vr(r)}"`,t)}for(const[i,r]of Object.entries(e))if(!kr(i))if(Array.isArray(r))for(const e of r)ao(e,t,n+1);else ao(r,t,n+1)}}const lo=new Set(["triggerIAP","submitLead"]);function co(e){for(const t of function(e){const t=new Set,n=e=>{if("string"==typeof e)t.add(e);else if("object"==typeof e&&null!==e){const n=e.type;"string"==typeof n&&t.add(n)}},i=(e,t)=>{if(!(t>64||"object"!=typeof e||null===e))if(Array.isArray(e))for(const n of e)i(n,t+1);else for(const[r,o]of Object.entries(e))"action"!==r&&"onEnter"!==r||n(o),i(o,t+1)};return i(e,0),!0===e?.triggerIAPFirst&&t.add("triggerIAP"),t}(e))if(lo.has(t))return t}const uo={leading:"flex-start",trailing:"flex-end",center:"center",top:"center",bottom:"center",topLeading:"flex-start",topTrailing:"flex-end",bottomLeading:"flex-start",bottomTrailing:"flex-end"},ho={leading:"center",trailing:"center",center:"center",top:"flex-start",bottom:"flex-end",topLeading:"flex-start",topTrailing:"flex-start",bottomLeading:"flex-end",bottomTrailing:"flex-end"},po={leading:{justify:"flex-start",align:"center"},trailing:{justify:"flex-end",align:"center"},center:{justify:"center",align:"center"},top:{justify:"center",align:"flex-start"},bottom:{justify:"center",align:"flex-end"},topLeading:{justify:"flex-start",align:"flex-start"},topTrailing:{justify:"flex-end",align:"flex-start"},bottomLeading:{justify:"flex-start",align:"flex-end"},bottomTrailing:{justify:"flex-end",align:"flex-end"}};function fo(e,t,n,i=!1){for(const[r,o]of(t.children??[]).entries()){const t=e.children[r];if(!t)continue;const{wide:s,tall:a}=Ni(o),l={},c=bo(o);if("row"===n&&c.width&&(l.flexShrink="0"),"column"===n&&c.height&&(l.flexShrink="0"),"spacer"===o.element){const e=o.style??{};("row"===n?c.width||void 0!==e.relativeWidth:"column"===n&&(c.height||void 0!==e.relativeHeight))&&(l.flexGrow="0")}const d=To(o),u=(o.style?.layoutPriority??0)<0,h="horizontal"===d&&Eo(o);if(u||h||"column"!==n||"horizontal"!==d||(l.flexShrink="0"),h&&"column"===n&&(l.flexShrink="1",l.minHeight="0px"),u||"row"!==n||"vertical"!==d||(l.flexShrink="0"),s&&So(o)){"row"===n?l.marginInline="auto":"column"===n?l.alignSelf="center":l.justifySelf="center",Ii(t,l);continue}const p=Co(o);"column"===n?(s&&(l.alignSelf=p.width?e.style.alignItems||"center":"stretch",p.width&&(l.width="100%")),a&&(l.flexGrow="1",l.flexBasis="0",l.minHeight="0px")):"row"===n?(s&&(l.flexGrow="1"),a&&(l.alignSelf="stretch"),!i||s||c.width||p.width||"text"!==o.element||1!==o.props.lineLimit||(l.flexGrow="1",l.flexBasis="0px",l.minWidth="0px","100%"===t.style.maxWidth&&(t.style.maxWidth="max-content"))):(s&&(l.justifySelf=p.width?e.style.justifyItems||"center":"stretch",p.width&&(l.width="100%")),a&&(l.alignSelf=p.height?e.style.alignItems||"center":"stretch",p.height&&(l.height="100%"))),Object.keys(l).length>0&&Ii(t,l)}}const mo={leading:"flex-start",topLeading:"flex-start",bottomLeading:"flex-start",trailing:"flex-end",topTrailing:"flex-end",bottomTrailing:"flex-end",center:"center",top:"center",bottom:"center"},go={top:"flex-start",topLeading:"flex-start",topTrailing:"flex-start",bottom:"flex-end",bottomLeading:"flex-end",bottomTrailing:"flex-end",center:"center",leading:"center",trailing:"center"};function yo(e,t,n){const i=t.style?.frame;if("object"!=typeof i||null===i)return;const r=i.alignment??"center";if("string"!=typeof r)return;const o=("row"===n?mo:go)[r];o&&(e.style.justifyContent=o)}function bo(e,t=0){const n=e.style?.frame;if("object"==typeof n&&null!==n&&(void 0!==n.width||void 0!==n.height))return{width:void 0!==n.width,height:void 0!==n.height};if(t>8||!Ui.has(e.element))return{width:!1,height:!1};let i=!1,r=!1;for(const n of[e.ifTrue,e.ifFalse,e.itemTemplate]){if(!n)continue;const e=bo(n,t+1);i=i||e.width,r=r||e.height}return{width:i,height:r}}function vo(e){return Array.from(e.querySelectorAll("*")).filter(e=>"center"===e.style.scrollSnapAlign)}function wo(e){let t=0;for(let n=e;n;n=n.offsetParent)t+=n.offsetLeft;return t}function xo(e,t){return wo(t)-wo(e)+t.offsetWidth/2-(e.scrollLeft+e.clientWidth/2)}function ko(e,t){let n=-1,i=1/0;return t.forEach((t,r)=>{const o=Math.abs(xo(e,t));o<i&&(n=r,i=o)}),n}function $o(e,t,n){const i=xo(e,t);if(Math.abs(i)<2)return;const r=e.scrollLeft+i;"function"==typeof e.scrollTo?e.scrollTo({left:r,behavior:n?"smooth":"auto"}):e.scrollLeft=r}function Co(e,t=0){const n=e.style?.frame;if("object"==typeof n&&null!==n){const e=n,t=e=>"number"==typeof e||"object"==typeof e&&null!==e&&"number"==typeof e.fixed;if(t(e.maxWidth)||t(e.maxHeight))return{width:t(e.maxWidth),height:t(e.maxHeight)}}if(t>8||!Ui.has(e.element))return{width:!1,height:!1};for(const n of[e.ifTrue,e.ifFalse,e.itemTemplate,e.content]){if(!n)continue;const e=Co(n,t+1);if(e.width||e.height)return e}return{width:!1,height:!1}}const Io=["backgroundColor","background","backgroundElement","border","borderColor","borderWidth","gradientBorder","shadow","innerShadow","overlay"];function So(e,t=0){if("text"===e.element){const t=e.style?.frame;if("object"!=typeof t||null===t)return!1;const n=e.style;return!Io.some(e=>void 0!==n[e])&&(void 0===t.alignment&&void 0===t.width&&("infinity"===t.maxWidth||"object"==typeof t.maxWidth&&null!==t.maxWidth&&!0===t.maxWidth.infinity))}if(t>8||"conditional"!==e.element&&"group"!==e.element)return!1;for(const n of[e.ifTrue,e.ifFalse,e.content])if(n&&So(n,t+1))return!0;return!1}function Eo(e,t=0){return!(!e||t>12)&&("asyncImage"===e.element?"number"==typeof e.props.aspectRatio&&"infinity"===(e.style?.frame??{}).maxWidth:[...e.children??[],e.content,e.itemTemplate,e.ifTrue,e.ifFalse].some(e=>Eo(e,t+1)))}function To(e,t=0){if("scrollView"===e.element)return"horizontal"===e.props.axis?"horizontal":"vertical";if(!(t>8)&&Ui.has(e.element))for(const n of[e.ifTrue,e.ifFalse,e.itemTemplate,e.content]){if(!n)continue;const e=To(n,t+1);if(e)return e}}const Ao=e=>{const t=e.props.spacing;return"number"==typeof t&&Number.isFinite(t)?`${t}px`:void 0};function Lo(e,t){return e.register("vStack",(e,n,i)=>{const{el:r,rendered:o}=Pi("div",e,n,i,t);r.style.display="flex",r.style.flexDirection="column",r.style.alignItems=uo[e.alignment??"center"];const s=Ao(e);return s&&(r.style.gap=s),yo(r,e,"column"),fo(r,e,"column"),o}),e.register("hStack",(e,n,i)=>{const{el:r,rendered:o}=Pi("div",e,n,i,t);r.style.display="flex",r.style.flexDirection="row",r.style.alignItems=ho[e.alignment??"center"];const s=Ao(e);return s&&(r.style.gap=s),yo(r,e,"row"),fo(r,e,"row",void 0!==t.trigger),o}),e.register("zStack",(e,n,i)=>{const{el:r,rendered:o}=Pi("div",e,n,i,t);r.style.display="grid",r.style.gridTemplateColumns="minmax(0, 1fr)",r.style.gridTemplateRows="minmax(0, 1fr)";const s=po[e.alignment??"center"];r.style.justifyItems=s.justify,r.style.alignItems=s.align;for(const e of Array.from(r.children))Ii(e,{gridArea:"1 / 1",maxWidth:"100%",maxHeight:"100%",zIndex:"0"});r.style.pointerEvents="none";for(const e of Array.from(r.children))Ii(e,{pointerEvents:"auto"});return fo(r,e,"stacked"),o}),e.register("spacer",(e,n,i)=>{const r=i.document.createElement("div");r.dataset.sdui="spacer",r.style.flexGrow="1",r.style.flexShrink="0";const o=e.props.minLength;return"number"==typeof o&&(r.style.flexBasis=`${o}px`),Ai(r,e,n,i,t),{node:r}}),e.register("group",(e,n,i)=>{const{el:r,rendered:o}=Pi("div",e,n,i,t);return Fi(r,e),o}),e.register("scrollView",(e,n,i)=>{const{el:r,rendered:o}=Pi("div",e,n,i,t),s="horizontal"===e.props.axis;r.style.overflowX=s?"auto":"hidden",r.style.overflowY=s?"hidden":"auto",s?(r.style.maxWidth||(r.style.maxWidth="100%"),r.style.minWidth="0px"):(r.style.maxHeight||(r.style.maxHeight="100%"),r.style.minHeight="0px"),void 0!==e.props.scrollTargetBehavior&&(r.style.scrollSnapType=(s?"x":"y")+" mandatory");const a="object"==typeof e.props.contentMargins&&null!==e.props.contentMargins?e.props.contentMargins:void 0,l=(...e)=>{for(const t of e){const e=a?.[t];if("number"==typeof e)return e}},c=s?l("leading","horizontal","all"):l("top","vertical","all");if(void 0!==c){const e=r.firstElementChild??r;s?e.style.paddingInline=`${c}px`:e.style.paddingBlock=`${c}px`}if(r.style.setProperty("container-type","inline-size"),r.style.setProperty("--sdui-margin-inline",(s?2*(c??0):0)+"px"),s&&Eo(e.content)&&function(e){const t=()=>{const t=e.firstElementChild;if(t){t.style.height="100%";for(const e of Array.from(t.children)){const t="contents"===e.style.display?Array.from(e.children):[e];for(const e of t)e.style.maxHeight="100%",e.style.minHeight="0px"}}};t(),"function"==typeof MutationObserver&&new MutationObserver(t).observe(e,{childList:!0,subtree:!0})}(r),!s){!function(e){const t=e=>{for(const n of Array.from(e.children))if("scrollView"!==n.dataset.sdui){if("contents"===n.style.display&&n.dataset.sduiFill){const e=Si(n);"0"===e.flexBasis&&(n.dataset.sduiFill=JSON.stringify({...e,flexBasis:"auto",minHeight:"auto"}))}"0px"!==n.style.flexBasis&&"0"!==n.style.flexBasis||(n.style.flexBasis="auto",n.style.minHeight="auto"),n.style.height.endsWith("px")||t(n)}};t(e),"function"==typeof MutationObserver&&new MutationObserver(()=>t(e)).observe(e,{childList:!0,subtree:!0})}(r);const e=()=>{if(0===r.clientHeight)return;const e=`${r.clientHeight}px`;r.style.getPropertyValue("--sdui-container-height")!==e&&r.style.setProperty("--sdui-container-height",e)};e();const t=r.ownerDocument.defaultView;t&&"function"==typeof t.ResizeObserver&&new t.ResizeObserver(e).observe(r)}if("center"===e.props.scrollAlignment&&(r.style.scrollSnapType=(s?"x":"y")+" mandatory"),s){const n=r.firstElementChild;if(n&&!n.style.width&&(n.style.width="max-content"),function(e){if("undefined"==typeof window)return;if(!0!==window.matchMedia?.("(pointer: fine)").matches)return;e.addEventListener("wheel",t=>{if(Math.abs(t.deltaY)<=Math.abs(t.deltaX))return;const n=e.scrollWidth-e.clientWidth,i=Math.min(Math.max(e.scrollLeft+t.deltaY,0),n);if(n<=0||i===e.scrollLeft)return;t.preventDefault();const r=vo(e);if(r.length>0){const n=Date.now();if(n-o<350)return;o=n;const i=ko(e,r),s=r[Math.min(Math.max(i+Math.sign(t.deltaY),0),r.length-1)];return void(s&&$o(e,s,!0))}e.scrollLeft=i},{passive:!1});let t=0,n=0,i=!1,r=!1,o=0,s=-1,a="";e.addEventListener("pointerdown",o=>{0===o.button&&(i=!0,r=!1,t=o.clientX,n=e.scrollLeft)}),e.addEventListener("pointermove",o=>{if(!i)return;const l=o.clientX-t;!r&&Math.abs(l)<4||(r||(s=ko(e,vo(e)),a=e.style.scrollSnapType,a&&(e.style.scrollSnapType="none"),e.dataset.sduiDragging="true"),r=!0,e.setPointerCapture?.(o.pointerId),e.scrollLeft=n-l)});const l=n=>{const o=i&&r;if(i=!1,!o)return;if(delete e.dataset.sduiDragging,!a)return;e.style.scrollSnapType=a;const l=vo(e);let c=ko(e,l);const d=(n?.clientX??t)-t;c===s&&Math.abs(d)>40&&(c=Math.min(Math.max(c-Math.sign(d),0),l.length-1));const u=l[c];u&&$o(e,u,!0)};e.addEventListener("pointerup",e=>l(e)),e.addEventListener("pointercancel",()=>l()),e.addEventListener("click",e=>{r&&(r=!1,e.stopPropagation(),e.preventDefault())},!0)}(r),void 0!==e.props.scrollTargetBehavior){for(const e of Array.from(n?.children??[]))Ii(e,{scrollSnapAlign:"center"});!function(e,t,n,i){const r=()=>{if(!i)return;const t=e.firstElementChild,n=vo(e)[0],r=function(e,t){if(!(e<1||t<1))return Math.max(0,(e-t)/2)}(e.clientWidth,n?.offsetWidth??0);t&&void 0!==r&&(t.style.paddingInline=`${r}px`)};i&&"function"==typeof ResizeObserver&&new ResizeObserver(()=>r()).observe(e);const o=e=>e.closest("[data-sdui-offer-id]")?.dataset.sduiOfferId,s=t=>{const n=t.offers[t.currentIndex??0]?.id;return vo(e).find(e=>o(e)===n)};if(t.addSite({deps:[di,ci],run:t=>{const n=s(t);n&&e.isConnected&&$o(e,n,!0)}}),"function"==typeof requestAnimationFrame){let t=0;const i=()=>{const o=n.currentContext?.(),a=o?s(o):void 0;!a||!e.isConnected||e.clientWidth<1?++t<60&&requestAnimationFrame(i):(r(),$o(e,a,!1))};requestAnimationFrame(i)}let a;const l=()=>{if(a=void 0,!e.isConnected||"true"===e.dataset.sduiDragging)return;const t=vo(e),i=t[ko(e,t)],r=i?o(i):void 0,s=n.currentContext?.();if(!r||!s)return;const l=s.offers.findIndex(e=>e.id===r);l<0||l===s.currentIndex||n.actionHost?.setOfferIndex?.(l,zn)};e.addEventListener("scroll",()=>{void 0!==a&&clearTimeout(a),a=setTimeout(l,120)},{passive:!0})}(r,i,t,"center"===e.props.scrollAlignment)}}return function(e,t){let n=0;const i=()=>{n=0;const i=t?e.scrollLeft:e.scrollTop,r=t?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=function(e,t,n){return t||n?`linear-gradient(${e?"to right":"to bottom"}, ${t?"transparent 0, #000 28px":"#000 0"}, ${n?"#000 calc(100% - 28px), transparent 100%":"#000 100%"})`:""}(t,r>1&&i>1,r>1&&i<r-1);e.style.setProperty("mask-image",o),e.style.setProperty("-webkit-mask-image",o)},r=()=>{if("function"!=typeof requestAnimationFrame)return i();0===n&&(n=requestAnimationFrame(i))};if(e.addEventListener("scroll",r,{passive:!0}),"function"==typeof ResizeObserver){const t=new ResizeObserver(r);t.observe(e),e.firstElementChild&&t.observe(e.firstElementChild)}r()}(r,s),s&&function(e){const t=e.style??{};return!0!==t.clipped&&void 0===t.clipShape&&void 0===t.padding&&void 0===(t.frame??{}).width&&void 0===t.relativeWidth}(e)&&function(e,t,n){e.dataset.sduiBleed="true",e.style.boxSizing="content-box",e.style.paddingBlock="24px",e.style.marginBlock="-24px",e.style.pointerEvents="none";const i=e.firstElementChild;i&&(i.style.pointerEvents="auto");const r="100%"===e.style.maxWidth;let o=0;const s=()=>{const s=e.getBoundingClientRect();if(0===s.width)return;const a=function(e){const t=e.ownerDocument.defaultView;for(let n=e.parentElement;n;n=n.parentElement){const e=t?.getComputedStyle(n);if(e&&("visible"!==e.overflowX||"none"!==e.clipPath)){const e=n.getBoundingClientRect();return{left:e.left,right:e.right}}}return{left:0,right:t?.innerWidth??0}}(e),l=Math.min(s.left+o-a.left,a.right-(s.right-o)),c=Math.min(64,Math.max(0,Math.round(l)));c!==o&&(o=c,e.style.marginInline=`-${o}px`,r&&(e.style.maxWidth=`calc(100% + ${2*o}px)`),e.style.setProperty("--sdui-margin-inline",2*(t+o)+"px"),!n&&i&&(i.style.paddingInline=`${t+o}px`))};"function"==typeof requestAnimationFrame&&requestAnimationFrame(s);const a=e.ownerDocument.defaultView;a&&"function"==typeof a.ResizeObserver&&e.parentElement&&new a.ResizeObserver(s).observe(e.parentElement)}(r,c??0,"center"===e.props.scrollAlignment),!1===e.props.showsIndicators&&(r.style.scrollbarWidth="none",r.dataset.sduiHideScrollbar="true"),o}),e}const Oo="Get 1 month",No=" for free",Mo="Claim an exclusive offer and get free access to all features",Uo="${";function Ro(e,t,n={}){let i=e;if(i.includes(Uo))for(const[e,n]of Object.entries(t))i=i.split(`${Uo}${e}}`).join(n);if(!i.includes(Uo))return i;for(const[e,t]of Object.entries(n))i=i.split(`${Uo}${e}}`).join(t);return i}function Fo(e,t,n,i,r){switch(e){case"offerAdvertiserName":return t?.advertiserName??"";case"offerDescription":return t?.description??"";case"offerPerk":return t?.perk??"";case"offerCtaText":return t?t.ctaText??n.claimText??"Claim":n.getText??"Get";case"offerNewPrice":return t?.newPrice??"";case"offerOldPrice":return t?.oldPrice??"";case"offerQuickInstructions":return t?.quickInstructions??"";case"titleText":return n.titleText??Oo;case"accentTitleText":return n.accentTitleText??No;case"subtitleText":return n.subtitleText??Mo;case"categoryName":return void 0===i?"":n.categoryLabels?.[i]??i;case"instructionTitle":return r?.title??"";case"instructionSubtitle":return r?.subtitle??"";case"instructionCtaText":return r?.ctaButtonText??"";case"instructionNumber":return void 0===r?.position?"":String(r.position)}}function Po(e,t,n){switch(e){case"offerPrimaryCreative":return t?.primaryImageUrl;case"offerLogoImage":return t?.logoUrl;case"offerHeroImage":return t?.heroImageUrl??t?.primaryImageUrl;case"instructionImage":return n?.imageUrl}}const zo=e=>`<path d="${e}" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>`,jo=e=>`<path d="${e}" fill="currentColor"/>`,Do=(e,t,n)=>`<mask id="${e}"><rect width="24" height="24" fill="#fff"/><path d="${n}" fill="none" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></mask><path d="${t}" fill="currentColor" mask="url(#${e})"/>`,Bo="M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Z",Ho={"arrowshape.turn.up.right":zo("M3 18v-3a6 6 0 0 1 6-6h8M13 5l4 4-4 4"),checkmark:zo("M4 12.5l5 5L20 6.5"),"checkmark.circle.fill":Do("sdui-sf-check-fill",Bo,"M7.5 12.5l3 3 6-6"),"chevron.left":zo("M15 5l-7 7 7 7"),"clock.fill":Do("sdui-sf-clock-fill",Bo,"M12 6.5V12l4 2.5"),"gift.fill":jo("M4 11h16v9a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-9Zm-1-5h18v4H3V6Zm9 0V4m0 2c-2 0-3.5-1-3.5-2S10 2 12 6Zm0 0c2 0 3.5-1 3.5-2S14 2 12 6Z"),"heart.fill":jo("M12 21s-8-5-8-10a4.5 4.5 0 0 1 8-2.8A4.5 4.5 0 0 1 20 11c0 5-8 10-8 10Z"),"lock.open.fill":jo("M6 11h12a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1Z")+zo("M8 11V7a4 4 0 0 1 8 0"),plus:zo("M12 5v14M5 12h14"),sparkles:jo("M12 3l1.6 4.4L18 9l-4.4 1.6L12 15l-1.6-4.4L6 9l4.4-1.6L12 3Zm6 9l.9 2.3L21 15l-2.1.7L18 18l-.9-2.3L15 15l2.1-.7L18 12Z"),xmark:zo("M6 6l12 12M18 6L6 18"),gift:zo("M4 11h16v9a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-9ZM3 7h18v4H3V7Zm9 0v14m0-14c-2 0-3.5-1-3.5-2.2S10 3 12 7Zm0 0c2 0 3.5-1 3.5-2.2S14 3 12 7Z"),"chevron.forward":zo("M9 5l7 7-7 7"),"arrow.forward":zo("M5 12h14M13 6l6 6-6 6")};function _o(e){if(!e?.includes("${"))return[];const t=[],n=/\$\{([^}]+)\}/g;let i;for(;null!==(i=n.exec(e));)t.push(i[1]);return t}const Vo=1.2,qo=e=>"object"!=typeof e||null===e||Array.isArray(e)?void 0:e,Wo=e=>"number"==typeof e&&Number.isFinite(e)?e:void 0,Ko=e=>"string"==typeof e?e:void 0,Go={topToBottom:"to bottom",bottomToTop:"to top",leadingToTrailing:"to right",trailingToLeading:"to left"},Yo="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";function Zo(e,t,n,i){const r="object"==typeof t.font&&null!==t.font?t.font:void 0;if(r){const t=Wo(r.size);void 0!==t&&(e.style.fontSize=`${i?Number((t*i.fontScale).toFixed(2)):t}px`),i&&!0===r.monospacedDigits&&e.style.setProperty("font-variant-numeric","tabular-nums");const n=Ko(r.weight);void 0!==n&&(e.style.fontWeight=Qo[n]??"normal");const o=Wo(r.tracking);void 0!==o&&(e.style.letterSpacing=`${o}px`)}e.style.textAlign=n&&"leading"!==n?"trailing"===n?"end":"center":"start",!0===t.underline&&(e.style.textDecoration="underline"),!0===t.strikethrough&&(e.style.textDecoration="line-through");const o=Wo(qo(t.font)?.size),s=Wo(t.lineHeightMultiple),a=Wo(t.lineHeight),l=Wo(t.lineSpacing);e.style.lineHeight=String(void 0!==s?s:void 0!==a?Vo+(a-1):void 0!==l&&void 0!==o?Vo+l/o:Vo);const c=Wo(t.lineLimit);void 0!==c&&(e.style.display="-webkit-inline-box",e.style.verticalAlign="top",e.style.maxWidth="100%",e.style.setProperty("-webkit-line-clamp",String(c)),e.style.setProperty("-webkit-box-orient","vertical"),e.style.overflow="hidden")}const Qo={ultraLight:"100",thin:"200",light:"300",regular:"400",medium:"500",semibold:"600",bold:"700",heavy:"800",black:"900"},Xo=["#B728F5","#6515ED","#FF9F2B","#22C55E","#38BDF8","#F43F5E"];function Jo(e,t){return e+Math.random()*(t-e)}class es{#Ot=null;#Nt=null;#Mt=[];#Ut=null;#Rt=0;#Ft=0;#v=!1;static shouldSkip(){try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}start(e,t={}){if(!this.#v&&!es.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=On("reward-confetti"),o.setAttribute("aria-hidden","true");const s=o.getContext("2d");if(!s)return;e.appendChild(o),this.#Ot=o,this.#Nt=s,this.#Pt(i,r),this.#zt(t.origin),this.#Rt=performance.now(),this.#Ft=this.#Rt,this.#Ut=requestAnimationFrame(this.#jt)}catch(e){u.debug("Confetti unavailable — rendering the sheet without it",e),this.destroy()}}#Pt(e,t){const n=this.#Ot,i=this.#Nt;if(!n||!i)return;const r=Math.min(2,window.devicePixelRatio||1);n.width=e*r,n.height=t*r,i.scale(r,r)}#zt(e){const t=this.#Ot;if(!t)return;if(e)return void this.#Dt(e);const n=Math.min(2,window.devicePixelRatio||1),i=t.width/n,r=t.height/n;this.#Mt=Array.from({length:22},()=>{const e=Jo(6,11);return{x:Jo(0,i)+Jo(-46,46),y:0*r+Jo(.15*-r,.3*r),vx:Jo(-46,46),vy:Jo(40,160),w:e,h:e*Jo(.4,.7),rotation:Jo(0,2*Math.PI),spin:Jo(-4,4),color:Xo[Math.floor(Jo(0,Xo.length))]??"#B728F5"}})}#Dt(e){this.#Mt=Array.from({length:22},()=>{const t=Jo(6,11),n=.95*-Math.PI+Math.random()*Math.PI*.9,i=Jo(220,460);return{x:e.x,y:e.y,vx:Math.cos(n)*i,vy:Math.sin(n)*i,w:t,h:t*Jo(.4,.7),rotation:Jo(0,2*Math.PI),spin:Jo(-4,4),color:Xo[Math.floor(Jo(0,Xo.length))]??"#B728F5"}})}#jt=e=>{if(this.#v)return;const t=this.#Ot,n=this.#Nt;if(!t||!n)return;const i=e-this.#Rt,r=Math.min(.05,(e-this.#Ft)/1e3);if(this.#Ft=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.#Mt)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.#Ut=requestAnimationFrame(this.#jt)};destroy(){this.#v=!0,null!==this.#Ut&&(cancelAnimationFrame(this.#Ut),this.#Ut=null),this.#Ot?.remove(),this.#Ot=null,this.#Nt=null,this.#Mt=[]}}const ts=new Set(["shareUrl","termsUrl"]),ns=e=>"string"==typeof e?e:void 0,is=e=>"number"==typeof e&&Number.isFinite(e)?e:void 0;function rs(e,t,n){try{return function(e,t,n){switch(e.type){case"close":return n.close?.(),void 0!==n.close;case"trigger":{const t=ns(e.params.target);return void 0!==t&&(n.trigger?.(t),void 0!==n.trigger)}case"dismissTrigger":return n.dismissTrigger?.(),void 0!==n.dismissTrigger;case"claimOffer":return n.claimOffer?.(Dn(t),ns(e.params.onSuccessState)),void 0!==n.claimOffer;case"openUrl":{const i=function(e,t){const n=ns(e.params.urlAttribute);if(void 0!==n){if(!ts.has(n))return;const e=Hn(t);if(!e)return;const i=e[n];return function(e){if(void 0===e)return;const t=e.trim();if(""===t)return;let n;try{n=new URL(t)}catch{return}return"https:"===n.protocol||"http:"===n.protocol?t:void 0}("string"==typeof i?i:void 0)}}(e,t);return void 0!==i&&(n.openUrl?.(i),void 0!==n.openUrl)}case"share":return n.share?.(Dn(t),ns(e.params.onSuccessState)),void 0!==n.share;case"setState":{const t=ns(e.params.setState);return void 0!==t&&(n.setState?.(t),void 0!==n.setState)}case"setValue":{const i=ns(e.params.setValueKey);if(void 0===i)return!1;const r=void 0===e.valueRef?ns(e.params.setValueValue):qn(e.valueRef,t);return void 0!==r&&(n.setValue?.(i,r),void 0!==n.setValue)}case"selectOffer":{const i=Dn(t);if(void 0===i)return!1;const r=is(e.params.promoteToIndex);return void 0!==r&&n.promoteOffer?.(i,r),n.selectOffer?.(i,ns(e.params.targetKey)??zn),void 0!==n.selectOffer}case"setOfferIndex":{const i=function(e,t){const n=t.offers.length;if(0===n)return;const i=is(e.params.offerIndex);if(void 0!==i)return i>=0&&i<n?i:void 0;const r=is(e.params.offerIndexDelta);return void 0!==r?Math.min(Math.max((t.currentIndex??0)+r,0),n-1):void 0}(e,t);return void 0!==i&&(n.setOfferIndex?.(i,ns(e.params.targetKey)??zn),void 0!==n.setOfferIndex)}case"triggerIAP":return n.triggerIAP?.(ns(e.params.onSuccessState),ns(e.params.onCancelAction)),void 0!==n.triggerIAP;case"submitLead":return n.submitLead?.(t.values,ns(e.params.onSuccessState)),void 0!==n.submitLead;case"reportCompletion":return n.reportCompletion?.(Dn(t),ns(e.params.onSuccessState)),void 0!==n.reportCompletion;case"unknown":return u.warn("[sdui] unknown action on a button, ignoring the tap"),!1}}(e,t,n)}catch(t){return u.warn(`SDUI action "${e.type}" failed`,t),!1}}const os=["rgb(255, 59, 48)","rgb(255, 46, 84)","rgb(255, 148, 0)","rgb(255, 204, 0)","rgb(51, 199, 89)","rgb(0, 122, 255)","rgb(176, 82, 222)"],ss=(e,t)=>e+(2*Math.random()-1)*t;const as=e=>"number"==typeof e&&Number.isFinite(e)?e:void 0,ls=e=>"string"==typeof e?e:void 0;function cs(e,t){return e.register("button",(e,n,i)=>{const r=void 0!==t.trigger&&void 0!==e.content&&ds(e.content),o=i.document.createElement(r?"div":"button");o.dataset.sdui="button",r||(o.type="button");const s=r?function(e){const t=e.createElement("button");t.type="button",t.dataset.sduiPart="tap";const n=t.style;return n.position="absolute",n.inset="0",n.margin="0",n.padding="0",n.border="none",n.background="none",n.borderRadius="inherit",n.pointerEvents="none",n.setProperty("-webkit-tap-highlight-color","transparent"),t}(i.document):void 0,a=s??o;o.style.background="none",o.style.border="none",o.style.padding="0",o.style.font="inherit",o.style.color="inherit",o.style.cursor="pointer",o.style.setProperty("-webkit-tap-highlight-color","transparent");const l=e.content?i.compileChild(e.content,n).node:void 0;l&&o.appendChild(l);const c=e.content?function(e,t){const n=[];let i=!1;const r=(e,t)=>{if(!(t>12||i)){"text"!==e.element&&"textField"!==e.element||(i=!0),"systemImage"===e.element&&"string"==typeof e.props.systemName&&n.push(e.props.systemName);for(const n of[...e.children??[],e.content,e.ifTrue,e.ifFalse,e.itemTemplate,e.label])n&&r(n,t+1)}};if(r(e,0),!i)for(const e of n){const n=t.symbolLabel?.(e);if(n)return n}}(e.content,t):void 0;c&&a.setAttribute("aria-label",c),s&&(!c&&void 0===ls(e.props.accessibilityLabel)&&l instanceof Element&&(l.id||(l.id="sdui-card-"+ ++us),s.setAttribute("aria-labelledby",l.id)),o.appendChild(s));const d="claimOffer"===e.action?.type&&!1===t.claimEnabled,u=!0===e.props.disabled||d;u&&(a.disabled=!0,o.style.cursor="default");const h=e.action;if("close"===h?.type&&(o.dataset.sduiClose=""),h){const e={...void 0!==n.rowOfferId&&{rowOfferId:n.rowOfferId},...void 0!==n.rowCategory&&{rowCategory:n.rowCategory},...void 0!==n.rowStep&&{rowStep:n.rowStep}};o.addEventListener("click",n=>{if(t.trigger&&!hs(n,o))return;if(r&&u)return;const i=t.currentContext();t.reportTap?.(h.type,i.currentState),rs(h,{...i,...e},t.actionHost)})}return Ai(o,e,n,i,t),Fi(o,e),s&&""===o.style.position&&(o.style.position="relative"),d&&(o.style.filter="opacity(0.4)"),t.trigger?(function(e,t){const n="object"==typeof t&&null!==t?t:void 0,i=as(n?.scale);if(void 0===i)return;const r=`scale ${as(n?.duration)??.12}s ease-out`;e.style.transition=e.style.transition?`${e.style.transition}, ${r}`:r,e.addEventListener("pointerdown",t=>{hs(t,e)&&e.style.setProperty("scale",String(i))});for(const t of["pointerup","pointercancel","pointerleave"])e.addEventListener(t,()=>e.style.removeProperty("scale"))}(o,e.props.pressedStyle),{node:o,...fs(a,e,t,i.document)}):{node:o}}),e.register("textField",(e,n,i)=>{const r=i.document.createElement("input");r.dataset.sdui="textField",r.type="emailAddress"===e.props.keyboardType?"email":"text","emailAddress"===e.props.textContentType&&(r.autocomplete="email");const o=ls(e.props.placeholder);void 0!==o&&(r.placeholder=o);const s=ls(e.props.valueKey);return void 0!==s&&r.addEventListener("input",()=>{t.editValue?t.editValue(s,r.value):t.actionHost.setValue?.(s,r.value)}),Ai(r,e,n,i,t),{node:r,deps:s?[mi(s)]:[],update:e=>{if(void 0===s)return;const t=e.values[s]??"";r.value!==t&&(r.value=t)}}}),e.register("toggle",(e,n,i)=>{const r=i.document.createElement("label");r.dataset.sdui="toggle";const o=i.document.createElement("input");o.type="checkbox";const s=ls(e.props.valueKey);return void 0!==s&&o.addEventListener("change",()=>{t.actionHost.setValue?.(s,o.checked?"true":"false")}),r.appendChild(o),e.label&&r.appendChild(i.compileChild(e.label,n).node),Ai(r,e,n,i,t),{node:r,deps:s?[mi(s)]:[],update:e=>{void 0!==s&&(o.checked="true"===e.values[s])}}}),e.register("slideButton",(e,n,i)=>{const r=i.document.createElement("div");r.dataset.sdui="slideButton",r.style.position="relative",r.style.touchAction="none",r.setAttribute("role","button"),r.tabIndex=0;const o=i.document.createElement("div");o.dataset.sduiPart="knob",o.style.position="absolute",o.style.left="0",r.appendChild(o);const s=i.document.createElement("span");s.dataset.sduiPart="caption",r.appendChild(s),e.content&&r.appendChild(i.compileChild(e.content,n).node);const a=e.action,l=as(e.props.threshold)??.8,c=ls(e.props.requiredValueKey),d=ls(e.props.text)??"",u=ls(e.props.disabledText)??d;let h,p=!0;const f=()=>{if(!a||!p)return;const e=t.currentContext();t.reportTap?.(a.type,e.currentState),rs(a,e,t.actionHost)};return r.addEventListener("pointerdown",e=>{h=e.clientX,r.setPointerCapture(e.pointerId)}),r.addEventListener("pointermove",e=>{if(void 0===h)return;const t=r.getBoundingClientRect().width||1,n=Math.min(Math.max((e.clientX-h)/t,0),1);o.style.transform=`translateX(${100*n}%)`}),r.addEventListener("pointerup",e=>{if(void 0===h)return;const t=r.getBoundingClientRect().width||1,n=(e.clientX-h)/t;h=void 0,n>=l?f():o.style.transform="translateX(0%)"}),r.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),f())}),Ai(r,e,n,i,t),{node:r,deps:c?[mi(c)]:[],update:e=>{p=(e=>void 0===c||""!==(e.values[c]??""))(e),r.dataset.sduiEnabled=p?"true":"false",r.setAttribute("aria-disabled",p?"false":"true"),s.textContent=p?d:u}}}),e.register("compactPageIndicator",(e,n,i)=>{const r=i.document.createElement("div");return r.dataset.sdui="compactPageIndicator",r.style.display="flex",r.style.alignItems="center",r.style.gap=`${gs}px`,r.setAttribute("aria-hidden","true"),Ai(r,e,n,i,t),{node:r,deps:[ci,di,ui,...gi(Jn(e.props.activeColor)),...gi(Jn(e.props.inactiveColor))],update:n=>{const o=function(e,t){const n=e<=ys?0:Math.min(Math.max(t-Math.floor(ys/2),0),e-ys),i=Math.min(n+ys,e),r=[];for(let o=n;o<i;o+=1){const s=o===n&&n>0||o===i-1&&i<e?ms*bs:ms,a=o===t;r.push({index:o,active:a,width:a?ms*vs:s,height:s})}return r}(n.offers.length,n.currentIndex??0),s=new Map;for(const e of Array.from(r.querySelectorAll(':scope > [data-sdui-part="dot"]')))s.set(Number(e.dataset.sduiPage),e);const a=new Map;for(const[e,t]of s)a.set(e,t.getBoundingClientRect().left);const l=new Set(o.map(e=>e.index));for(const[e,t]of s)l.has(e)||(r.removeChild(t),s.delete(e));const c=o.map(e=>{let t=s.get(e.index);return t||(t=i.document.createElement("span"),t.dataset.sduiPart="dot",t.dataset.sduiPage=String(e.index),t.style.display="block",t.style.borderRadius="999px",t.style.flexShrink="0"),r.appendChild(t),t}),d=t.color(e.props.activeColor,Vn(n))??t.color({appearance:"accent"},Vn(n)),u=t.color(e.props.inactiveColor,Vn(n))??t.color({semantic:"tertiaryLabel"},Vn(n));o.forEach((e,t)=>{const n=c[t];n.dataset.sduiActive=e.active?"true":"false",n.style.width=`${e.width}px`,n.style.height=`${e.height}px`;const i=e.active?d:u;i&&(n.style.background=i)});for(const[e,t]of s){const n=a.get(e);if(void 0===n)continue;const i=n-t.getBoundingClientRect().left;Math.abs(i)<.5||(t.style.transition="none",t.style.transform=`translateX(${i}px)`,t.style.transition=ws,t.style.transform="")}for(const e of c)e.style.transition||(e.style.transition=ws)}}}),e.register("confetti",(e,n,i)=>{const r=i.document.createElement("div");r.dataset.sdui="confetti",r.setAttribute("aria-hidden","true"),r.style.pointerEvents="none",Ai(r,e,n,i,t),""===r.style.position&&(r.style.position="relative");const o=function(e){const n=e=>"number"==typeof e&&Number.isFinite(e)?e:void 0,i=(e,t,n)=>Math.min(n,Math.max(t,e)),r=Array.isArray(e.colors)?e.colors.flatMap(e=>"string"==typeof e?(e=>t.color({hex:e},{}))(e)??[]:[]):[],o=n(e.originX);return{colors:r.length>0?r:os,intensity:Math.max(1,Math.round(n(e.intensity)??20)),duration:Math.max(.1,n(e.duration)??2.5),originY:i(n(e.originY)??0,0,1),originX:void 0===o?void 0:i(o,0,1)}}(e.props);return function(e,t){if("function"!=typeof requestAnimationFrame||es.shouldSkip())return;let n=0;const i=()=>{const r=e.getBoundingClientRect();!e.isConnected||r.width<1||r.height<1?++n<xs&&requestAnimationFrame(i):function(e,t){const n=e.getBoundingClientRect(),i=Math.round(n.width),r=Math.round(n.height),o=e.ownerDocument.createElement("canvas"),s=i>0&&r>0?o.getContext("2d"):null;if(!s)return()=>{};const a=Math.min(2,window.devicePixelRatio||1);o.width=i*a,o.height=r*a,Object.assign(o.style,{position:"absolute",inset:"0",width:"100%",height:"100%",pointerEvents:"none"}),o.setAttribute("aria-hidden","true"),s.scale(a,a),e.appendChild(o);const l=function(e,t,n){const i=Math.max(1,e.intensity/e.colors.length),r=Math.min(600,Math.round(i*e.colors.length*e.duration)),o=e.originY<=0?-8:n*e.originY,s=void 0===e.originX?Math.PI/4:Math.PI/180*75;return Array.from({length:r},(n,i)=>{const r=i%e.colors.length,a=ss(Math.PI/2,s),l=ss(210,80);return{born:Math.random()*e.duration,life:ss(6,1.5),x:void 0===e.originX?Math.random()*t:t*e.originX,y:o,vx:Math.cos(a)*l,vy:Math.sin(a)*l,spin:ss(3.5,4),rotation:Math.random()*Math.PI*2,scale:ss(.55,.25),color:e.colors[r]??os[0],round:r%2==1}})}(t,i,r),c=t.duration+7.5,d=performance.now();let u=0;const h=()=>{cancelAnimationFrame(u),o.remove()},p=e=>{const t=(e-d)/1e3;if(t>=c||!o.isConnected)h();else{s.clearRect(0,0,i,r);for(const e of l){const n=t-e.born;if(n<0||n>e.life)continue;const i=e.x+e.vx*n,o=e.y+e.vy*n+160*n*n;o>r+20||(s.save(),s.translate(i,o),s.rotate(e.rotation+e.spin*n),s.scale(e.scale,e.scale),s.fillStyle=e.color,e.round?(s.beginPath(),s.arc(0,0,4.5,0,2*Math.PI),s.fill()):s.fillRect(-4,-6,8,12),s.restore())}u=requestAnimationFrame(p)}};u=requestAnimationFrame(p)}(e,t)};requestAnimationFrame(i)}(r,o),{node:r}}),e}function ds(e,t=0){return!(t>12)&&("button"===e.element||[...e.children??[],e.content,e.ifTrue,e.ifFalse,e.itemTemplate,e.style?.overlay,e.style?.backgroundElement,e.fallback].some(e=>void 0!==e&&ds(e,t+1)))}let us=0;function hs(e,t){const n=e.target;return n?.closest?.('[data-sdui="button"]')===t}let ps=0;function fs(e,t,n,i){const r=ls(t.props.accessibilityLabel),o=ls(t.props.accessibilityHint);if(void 0===r&&void 0===o)return{};let s;void 0!==o&&(s=i.createElement("span"),s.id="sdui-hint-"+ ++ps,s.hidden=!0,s.style.display="none",e.appendChild(s),e.setAttribute("aria-describedby",s.id));const a=(e,t)=>{const i=n.textEnvironment?.();return Ro(e,i?.variables??{},{...i?.values,...t.values})};return{deps:[r,o].flatMap(e=>[...(e??"").matchAll(/\$\{([^}]+)\}/g)].map(e=>mi(e[1]))),update:t=>{void 0!==r&&e.setAttribute("aria-label",a(r,t)),s&&void 0!==o&&(s.textContent=a(o,t))}}}const ms=8,gs=8,ys=5,bs=.5,vs=2.2,ws="transform 0.3s cubic-bezier(0.34, 1.3, 0.64, 1), width 0.3s ease, height 0.3s ease",xs=60,ks=24;const $s=new Map,Cs=new Map;function Is(e){return{id:e.id,...void 0!==e.merchantName?{advertiserName:e.merchantName}:{},...void 0!==e.description?{description:e.description}:{},...void 0!==e.perk?{perk:e.perk}:{},...void 0!==e.ctaText?{ctaText:e.ctaText}:{},...void 0!==e.imageUrl?{primaryImageUrl:e.imageUrl}:{},...void 0!==e.logoUrl?{logoUrl:e.logoUrl}:{},...void 0!==e.heroImageUrl?{heroImageUrl:e.heroImageUrl}:{},...void 0!==e.badgeLabel?{badgeLabel:e.badgeLabel}:{},...void 0!==e.category?{category:e.category}:{},...void 0!==e.termsUrl?{termsUrl:e.termsUrl}:{},...void 0!==e.shareUrl?{shareUrl:e.shareUrl}:{},...void 0!==e.quickInstructions?{quickInstructions:e.quickInstructions}:{},...void 0!==e.instructions?{instructions:(t=e.instructions,t.filter(e=>""!==(e.title??"").trim()||""!==(e.subtitle??"").trim()).map((e,t)=>({...e,position:t+1})))}:{},...void 0!==e.displayProperties?{displayProperties:e.displayProperties}:{}};var t}function Ss(e,t){const n="number"==typeof t&&Number.isFinite(t)?Math.max(t,1):1.3,i=e.defaultView,r=e.body??e.documentElement;if(!i||!r)return 1;const o=e.createElement("div");o.dataset.sduiTextProbe="",o.style.cssText="position:absolute;visibility:hidden;font-size:medium",r.appendChild(o);let s=Number.NaN;try{s=parseFloat(i.getComputedStyle(o).fontSize)}finally{o.remove()}const a=Number.isFinite(s)?s/16:1;return Math.min(Math.max(a,1),n)}class Es{root;inlineHeight;#Bt;#Ht={};#Nt;#_t;#Vt=Date.now();#qt;#Wt;constructor(e,t,n,i,r,o,s,a){this.root=e,void 0!==s&&(this.inlineHeight=s),this.#Bt=t,this.#Nt=n,i&&(this.#Ht=i),r&&(this.#_t=r),o&&(this.#qt=o),a&&(this.#Wt=a)}destroy(){this.#Wt?.destroy(),this.root.parentNode?.removeChild(this.root)}requestDominantColors(){const e=this.#qt;if(!e)return;const t=this.#Nt.offers.flatMap(e=>e.logoUrl?[e.logoUrl]:[]);this.#Nt.appIconUrl&&t.push(this.#Nt.appIconUrl),function(e,t,n){for(const i of new Set(e)){if(!i||$s.has(i))continue;let e=Cs.get(i);e||(e=t(i).catch(()=>null).then(e=>(Cs.delete(i),e&&$s.set(i,e),e)),Cs.set(i,e)),e.then(e=>{e&&n(i,e)})}}(t,e,(e,t)=>this.#Kt(e,t))}#Kt(e,t){this.#Nt.dominantColors?.[e]!==t&&this.#Gt({...this.#Nt,dominantColors:{...this.#Nt.dominantColors,[e]:t}},[mi("offerDominantColor"),mi("selectedOfferDominantColor"),mi("appDominantColor")])}report(e){try{this.#_t?.(e)}catch(e){u.warn("[Encore SDK] SDUI analytics sink threw; ignoring",e)}}get context(){return this.#Nt}onEnter(e){return this.#Ht[e]?.onEnter}setState(e){const t=this.#Nt.currentState,n=Date.now(),i=n-this.#Vt;return this.#Vt=n,this.#Gt({...this.#Nt,currentState:e},[li]),this.report({kind:"stateTransition",fromState:t,toState:e,timeInPreviousStateMs:i}),this.onEnter(e)}editValue(e,t){const n=`${e}Error`,i={...this.#Nt.values,[e]:t},r=Object.prototype.hasOwnProperty.call(i,n);r&&delete i[n];const o=e===zn?[ci,di,ui]:[];this.#Gt({...this.#Nt,values:i},[mi(e),...r?[mi(n)]:[],...o])}setValue(e,t){const n=e===zn?[ci,di,ui]:[];this.#Gt({...this.#Nt,values:{...this.#Nt.values,[e]:t}},[mi(e),...n]),this.report({kind:"valueSet",key:e,value:t})}setOfferIndex(e,t=zn){const n=this.#Nt.offers[e];n&&this.#Yt(n,e,t)}promoteOffer(e,t){const n=this.#Nt.offers,i=n.findIndex(t=>t.id===e);if(i<0)return;const r=Math.min(Math.max(t,0),n.length-1);if(i===r)return;const o=[...n];o.splice(r,0,...o.splice(i,1)),this.#Gt({...this.#Nt,offers:o},[ci,di,ui])}selectOffer(e,t=zn){const n=this.#Nt.offers.findIndex(t=>t.id===e),i=n>=0?this.#Nt.offers[n]:void 0;i&&(this.#Yt(i,n,t),this.report({kind:"valueSet",key:t,value:i.id,offerId:i.id}))}seedSelection(e,t=zn){const n=this.#Nt.offers.findIndex(t=>t.id===e),i=n>=0?this.#Nt.offers[n]:void 0;i&&this.#Yt(i,n,t)}#Yt(e,t,n){const i={...this.#Nt.values},r=(e,t)=>{void 0===t?delete i[e]:i[e]=t};r(n,e.id),r("selectedAdvertiserName",e.advertiserName),r("selectedOfferLogoUrl",e.logoUrl),r("selectedOfferDescription",e.description),r("selectedOfferPerk",e.perk),r("selectedOfferIsFreeTrial","free_trial"===e.badgeLabel?"true":"false"),this.#Gt({...this.#Nt,values:i,currentIndex:t},[di,ci,...[n,"selectedAdvertiserName","selectedOfferLogoUrl","selectedOfferDescription","selectedOfferPerk","selectedOfferIsFreeTrial"].map(mi)])}setOffers(e){this.#Gt({...this.#Nt,offers:e.map(Is)},[ci,di,ui]),this.requestDominantColors()}setLists(e){this.#Gt({...this.#Nt,lists:e},[hi])}setNow(e){this.#Gt({...this.#Nt,now:e},[pi])}setTimes(e){this.#Gt({...this.#Nt,times:e},[pi])}setMotion(e){Ts(this.root,e.paused),this.#Gt({...this.#Nt,motionPaused:e.paused,reduceMotion:e.reduce},[fi])}refresh(){this.#Bt.update(this.#Nt)}#Gt(e,t){this.#Nt=e,this.#Bt.update(e,t)}}function Ts(e,t){if(1!==e.nodeType)return;const n=e;t?n.dataset.paused="true":delete n.dataset.paused}function As(e){const t=e.document??document;try{const r="inline"===e.mode,o=r?e.kit:void 0;if(r&&!o)throw new Error("an inline mount needs the trigger kit");const s=r?function(e){const t=e?.root;if("object"!=typeof t||null===t)return;const n=Object.values(t);if(1!==n.length)return;const i=n[0]?.style,r=i?.frame,o=r?.height;return"number"==typeof o&&Number.isFinite(o)&&o>0?o:void 0}(e.template):void 0;if(r&&void 0===s)throw new Error("an inline template needs a positive numeric root frame.height");const a=r?no(e.template,{trigger:!0}):no(e.template),l=a.presentation,c="string"==typeof l.initialState?l.initialState:void 0,d=Os(l.initialValues,"initialValues"),u=Ns(l.textMaps),h=function(e,t){if(!e||0===e.length)return[...t];const n=new Set,i=[];for(const r of e)r<0||r>=t.length||n.has(r)||(n.add(r),i.push(t[r]));return t.forEach((e,t)=>{n.has(t)||i.push(e)}),i}(Ms(l.offerDisplayOrder,"offerDisplayOrder"),e.offers.map(Is)),p=null!=l.initialSelection?Ls(l.initialSelection,h.length):!0===l.autoSelectFirstOffer&&h.length>0?0:void 0,f=u?{...e.textEnvironment,textMaps:{...e.textEnvironment.textMaps,...u}}:e.textEnvironment,m=function(e={}){return{offers:[],currentState:Pn,values:{},isCurrentPage:!1,hasIntroOffer:!1,hasFreeTrial:!1,...e}}({offers:h,currentState:e.initialState??c??Pn,...void 0!==e.initialIndex?{currentIndex:e.initialIndex}:{},values:{...e.textEnvironment.values,...d},dominantColors:Object.fromEntries($s),...e.textEnvironment.variables.appIconUrl?{appIconUrl:e.textEnvironment.variables.appIconUrl}:{},...r&&e.lists?{lists:e.lists}:{},...r?{times:e.times??{},now:e.now??Date.now(),motionPaused:!0===e.motionPaused,reduceMotion:!0===e.reduceMotion}:{}}),g={},y={color:(t,n)=>Us(r&&e.exactColor?.(t)?function(e){if("object"!=typeof e||null===e)return e;const{opacity:t,...n}=e;return n}(t):t,n,e.color),textEnvironment:()=>f,actionHost:(n=e.actionHost,i=()=>g.current,{...n,setState:e=>{i()?.setState(e),n.setState?.(e)},setValue:(e,t)=>{i()?.setValue(e,t),n.setValue?.(e,t)},selectOffer:(e,t)=>{i()?.selectOffer(e,t),n.selectOffer?.(e,t)},setOfferIndex:(e,t)=>{i()?.setOfferIndex(e,t),n.setOfferIndex?.(e,t)},promoteOffer:(e,t)=>{i()?.promoteOffer(e,t),n.promoteOffer?.(e,t)}}),currentContext:()=>g.current?.context??m,reportTap:(e,t)=>{g.current?.report({kind:"buttonTapped",actionType:e,currentState:t})},claimEnabled:!1!==e.claimEnabled,editValue:(e,t)=>{g.current?.editValue(e,t)},symbolLabel:e=>f.defaults.symbolLabels?.[e],...r?{trigger:{fontScale:Ss(t,l.maxFontScale),kit:o,scaleGroups:new o.ScaleGroups}}:{},...o?{motion:new o.MotionSheet(t)}:{}},b=cs(function(e,t){return e.register("text",(e,n,i)=>{const r=i.document.createElement("span");r.dataset.sdui="text",r.style.whiteSpace="pre-line",Zo(r,e.props,e.alignment??Ko(e.props.multilineAlignment),t.trigger),Ci(e.props.color,n,i,t,e=>{e&&(r.style.color=e)}),Ai(r,e,n,i,t),function(e,t){const n=Number(e.style.lineHeight)-Vo;!Number.isFinite(n)||Math.abs(n)<.001||t&&["padding","backgroundColor","borderWidth","gradientBorder","backgroundElement"].some(e=>void 0!==t[e])||(e.style.marginBlock=`${Number((-n/2).toFixed(4))}em`)}(r,e.style),t.trigger&&void 0!==Wo(e.props.lineLimit)&&(r.style.paddingTop||r.style.paddingBottom)&&(r.style.clipPath=`inset(${r.style.paddingTop||"0px"} 0px ${r.style.paddingBottom||"0px"} 0px)`);const o=t.trigger?Ko(e.props.scaleGroup):void 0,s=t.trigger?qo(e.props.countdown):void 0,a=o?t.trigger.scaleGroups.join(o,r,e.props,s?.format):void 0,l=o?s?void 0:a:t.trigger?t.trigger.kit.oneLineFit(r,e.props):void 0,c=e=>l?{...e,update:t=>{e.update(t),l()}}:e,d=t.trigger?qo(e.props.countdown):void 0;if(d)return c(t.trigger.kit.countdownText(r,d,t));const u=Array.isArray(e.props.segments)?e.props.segments.filter(e=>"object"==typeof e&&null!==e):void 0,h=e.props.textBinding,p=Ko(e.props.propertyKey),f=Ko(e.props.valueKey),m=Ko(e.props.textMapKey),g=[li,ci,di,ui];f&&g.push(mi(f)),m&&g.push(mi(Ko(e.props.textMapValueKey)??m));for(const t of[Ko(e.props.text),...(u??[]).map(e=>Ko(e.text))])for(const e of _o(t))g.push(mi(e));g.push(...gi(Jn(e.props.highlightColor)));const y=u?.map(e=>{const o=i.document.createElement("span");o.dataset.sduiPart="segment",Zo(o,e,void 0,t.trigger),Ci(e.color,n,i,t,e=>{e&&(o.style.color=e)}),r.appendChild(o);const s="string"==typeof e.textBinding?e.textBinding:void 0;return{span:o,raw:Ko(e.text)??"",binding:s,propertyKey:Ko(e.propertyKey)}});return c({node:r,deps:g,update:n=>{const o=t.textEnvironment(),s={...o.values,...n.values};if(y){for(const e of y)e.span.textContent=void 0===e.propertyKey?void 0!==e.binding?Fo(e.binding,Hn(n),o.defaults,n.rowCategory,n.rowStep):Ro(e.raw,o.variables,s):Hn(n)?.displayProperties?.[e.propertyKey]??"";return}if(void 0!==p)return void(r.textContent=Hn(n)?.displayProperties?.[p]??"");const a=function(e,t){const{values:n,textMaps:i,variables:r,offer:o,defaults:s,category:a,step:l}=t;if(void 0!==e.valueKey){const t=n[e.valueKey];if(void 0!==t)return Ro(t,r,n)}if(void 0!==e.textMapKey){const t=n[e.textMapValueKey??e.textMapKey],o=void 0===t?void 0:i[e.textMapKey]?.[t];if(void 0!==o)return Ro(o,r,n)}return void 0!==e.textBinding?Fo(e.textBinding,o,s,a,l):Ro(e.text??"",r,n)}({...void 0!==f?{valueKey:f}:{},...void 0!==m?{textMapKey:m}:{},...void 0!==Ko(e.props.textMapValueKey)?{textMapValueKey:Ko(e.props.textMapValueKey)}:{},..."string"==typeof h?{textBinding:h}:{},...void 0!==Ko(e.props.text)?{text:Ko(e.props.text)}:{}},{values:{...o.values,...n.values},textMaps:o.textMaps,variables:o.variables,defaults:o.defaults,...void 0!==Hn(n)?{offer:Hn(n)}:{},...void 0!==n.rowCategory?{category:n.rowCategory}:{},...void 0!==n.rowStep?{step:n.rowStep}:{}}),l=t.color(e.props.highlightColor,Vn(n));if(void 0!==l){r.replaceChildren();for(const e of function(e){if(!e.includes("*"))return[{text:e,isHighlighted:!1}];const t=[];let n,i="";for(const r of e)"*"===r?void 0!==n?(""!==i&&(t.push({text:i,isHighlighted:!1}),i=""),""!==n&&t.push({text:n,isHighlighted:!0}),n=void 0):n="":void 0!==n?n+=r:i+=r;return void 0!==n&&(i+="*"+n),""!==i&&t.push({text:i,isHighlighted:!1}),0===t.length?[{text:"",isHighlighted:!1}]:function(e){const t=[];for(const n of e){const e=t[t.length-1];void 0!==e&&e.isHighlighted===n.isHighlighted?t[t.length-1]={text:e.text+n.text,isHighlighted:n.isHighlighted}:t.push(n)}return t}(t)}(a)){const t=i.document.createElement("span");t.textContent=e.text,e.isHighlighted&&(t.dataset.sduiPart="highlight",t.style.color=l),r.appendChild(t)}}else r.textContent=a}})}),e.register("systemImage",(e,n,i)=>{const r=i.document.createElement("span");r.dataset.sdui="systemImage",r.style.display="inline-flex",r.style.alignItems="center",r.style.justifyContent="center";const o=qo(e.props.font),s=function(e,t){if("string"!=typeof e)return;const n=Ho[e];if(void 0===n)return;const i=e.endsWith(".forward");return`<svg viewBox="0 0 24 24" width="${t}" height="${t}" aria-hidden="true" focusable="false"${i?" data-sdui-mirror":""}>${i?"<style>svg[data-sdui-mirror]:dir(rtl){transform:scaleX(-1)}</style>":""}${n}</svg>`}(e.props.systemName,Wo(o?.size)??Wo(e.props.size)??17);return s&&(r.innerHTML=s),Ci(e.props.color,n,i,t,e=>{e&&(r.style.color=e)}),Ai(r,e,n,i,t),{node:r}}),e.register("asyncImage",(e,n,i)=>{const r=i.document.createElement("img");let o;r.dataset.sdui="asyncImage",r.alt="",r.setAttribute("aria-hidden","true"),r.loading="lazy",r.style.objectFit="fill"===e.props.contentMode?"cover":"contain",Ci(e.props.placeholderColor,n,i,t,e=>{o=e,e&&(r.style.backgroundColor=e)});const s=Wo(e.props.aspectRatio);void 0!==s&&(r.style.aspectRatio=String(s),r.style.minHeight="0px");const a=new Set;let l;const c=()=>{l=void 0,Yt(r),r.getAttribute("src")!==Yo&&(r.src=Yo)};let d;const u={};r.addEventListener("error",()=>{r.getAttribute("src")!==Yo&&(l&&a.add(l),c(),u.show?.(!0))}),r.addEventListener("load",()=>{r.getAttribute("src")!==Yo&&(d&&(r.dataset.sduiCreativeOfferId=d),u.show?.(!1))});const h=[ci,di,ui],p=Ko(e.props.url);for(const e of _o(p))h.push(mi(e));const f="offerLogoImage"===e.props.urlBinding||"${selectedOfferLogoUrl}"===p,m=n=>{const i=e.props.urlBinding,s=Hn(n),h=qe("string"==typeof i?Po(i,s,n.rowStep):function(e,t,n){if(!e?.includes("${"))return e;const i=Ro(e,t,n);return i.includes("${")?void 0:i}(p,t.textEnvironment().variables,n.values)),m="offerPrimaryCreative"===i||"offerHeroImage"===i,g=m&&!h?qe(s?.logoUrl):void 0,y=g&&Dt(g,Pt,window.devicePixelRatio||1),b=m&&!h;h&&!a.has(h)?l!==h&&(l=h,Ht(r,h,f?Pt:Math.min(720,window.innerWidth||720))):c(),r.style.backgroundColor=b?o??t.color({appearance:"secondarySystemBackground"},n.values)??"#f2f2f7":o??"",r.style.backgroundImage=y?`url("${y.replace(/["\\]/g,"\\$&")}")`:"",y&&function(e){if(_t.set(e,Vt.has(e)),Gt.has(e)||Vt.has(e))return;const t=new Image;Kt(t);const n=()=>Gt.delete(e);t.addEventListener("load",n),t.addEventListener("error",n),t.src=e,Gt.set(e,t)}(y),r.style.backgroundRepeat="no-repeat",r.style.backgroundPosition="center",r.style.backgroundSize="auto min(72px, 60%)";const v="offerPrimaryCreative"===i?s?.id:void 0;d=v;const w=r.complete&&r.naturalWidth>0&&r.getAttribute("src")!==Yo;v&&(b||w)?r.dataset.sduiCreativeOfferId=v:delete r.dataset.sduiCreativeOfferId,u.show?.(!w)};if(!e.fallback)return Ai(r,e,n,i,t),{node:r,deps:h,update:m};const g=i.document.createElement("div");g.dataset.sdui="asyncImage",g.style.display="grid",g.style.gridTemplateColumns="minmax(0, 1fr)",g.style.gridTemplateRows="minmax(0, 1fr)",delete r.dataset.sdui,r.dataset.sduiPart="image",r.style.width="100%",r.style.height="100%",r.style.gridArea="1 / 1";const y=i.compileChild(e.fallback,n).node;g.append(r,y);const b=1===y.nodeType?y:void 0;return b&&Ii(b,{gridArea:"1 / 1",justifySelf:"stretch",alignSelf:"stretch"}),u.show=e=>{r.style.visibility=e?"hidden":"",b&&(b.style.visibility=e?"":"hidden")},Ai(g,e,n,i,t),{node:g,deps:h,update:m}}),e.register("asyncVideo",(e,n,i)=>{const r=i.document.createElement("video");r.dataset.sdui="asyncVideo",r.muted=!0,r.playsInline=!0,r.loop=!1!==e.props.loop,r.autoplay=!1!==e.props.autoplay,r.setAttribute("aria-hidden","true");const o=e.props.urlBinding;return Ai(r,e,n,i,t),{node:r,deps:[ci,di,ui],update:t=>{const n=qe("string"==typeof o?Po(o,Hn(t)):Ko(e.props.url));n?r.src=n:r.removeAttribute("src")}}}),e.register("appIcon",(e,n,i)=>{const r=i.document.createElement("img");r.dataset.sdui="appIcon",r.alt="",r.setAttribute("aria-hidden","true");const o=qe(t.textEnvironment().variables.appIconUrl);return o?(Ht(r,o,Pt),Ai(r,e,n,i,t),{node:r}):{node:i.document.createComment("sdui:appIcon")}}),e.register("shape",(e,n,i)=>{const r=i.document.createElement("div");r.dataset.sdui="shape";const o=t.trigger?Wo(e.props.strokeWidth):void 0,s=void 0!==o?e.props.strokeColor:void 0;switch(void 0!==o&&(r.style.borderStyle="solid",r.style.borderWidth=`${o}px`),e.props.type){case"circle":case"ellipse":r.style.borderRadius="50%";break;case"capsule":r.style.borderRadius="9999px";break;case"roundedRectangle":{const t=Wo(e.props.cornerRadius);void 0!==t&&(r.style.borderRadius=`${t}px`);break}}return Ai(r,e,n,i,t),{node:r,deps:[ci,di,ui,...gi(Jn(e.props.fillColor)),...gi(Jn(s))],update:n=>{const i=t.color(e.props.fillColor,Vn(n));i&&(r.style.background=i),void 0!==o&&(r.style.borderColor=t.color(s,Vn(n))??"transparent")}}}),e.register("gradient",(e,n,i)=>{const r=i.document.createElement("div");r.dataset.sdui="gradient";const o=e.props.colors,s=Array.isArray(o)?o:[],a="radial"===e.props.type,l=Wo(e.props.startRadius)??0,c=Wo(e.props.endRadius),d=Ko(e.props.direction),u=void 0!==d&&nr.includes(d)?Go[d]:"to bottom",h=e=>{const n=(e=>s.map(n=>{const i=qo(n),r=t.color(i?.color,Vn(e));if(void 0===r)return;const o=Wo(i?.opacity);return void 0===o||o>=1?r:`color-mix(in srgb, ${r} ${100*Math.max(0,Math.min(o,1))}%, transparent)`}).filter(e=>void 0!==e))(e);r.style.background=1===n.length?n[0]:n.length>1?a?`radial-gradient(circle at center, ${(e=>e.map((t,n)=>void 0===c?t:`${t} ${l+(c-l)*n/(e.length-1)}px`).join(", "))(n)})`:`linear-gradient(${u}, ${n.join(", ")})`:""};h(n);const p=s.flatMap(e=>{const t=qo(e);return Jn(void 0!==t&&"color"in t?t.color:e)});return p.length>0&&i.addSite({deps:gi(p),run:h}),Ai(r,e,n,i,t),{node:r}}),e.register("empty",(e,t,n)=>({node:n.document.createComment("sdui:empty")})),e}(Lo(new Gi,y),y),y);o&&(o.registerMarqueeElement(b,y),o.registerProgressElement(b,y));const v=function(e,t,n,i=document){const r=[];let o=1,s=Wi,a={id:0,parent:void 0,active:!0};const l=e=>(o+=1,{id:o,parent:e,active:!0}),c=e=>{for(let t=r.length-1;t>=0;t-=1)d(r[t].group,e)&&r.splice(t,1)},d=(e,t)=>void 0!==e&&(e===t||d(e.parent,t));function u(e,t,n,i){const o=r.length,l=function(e,t,n){const i=s,r=a;s=e,a=t;try{return n()}finally{s=i,a=r}}(t,n,()=>p(e,t(i)));for(const e of r.slice(o))e.run(e.scope(i));return l.node}const h={document:i,compileChild:(e,t)=>p(e,t),addSite:e=>{r.push({deps:e.deps,scope:s,group:a,run:t=>e.run(t)})}};function p(e,t){const o=function(e,t){if("conditional"===e.element)return function(e){const t=s,n=a,o=i.createElement("div");o.dataset.sduiConditional="",o.style.display="contents";const c=i.createComment("sdui:conditional");o.appendChild(c);const h=new Map;let p;return{node:o,deps:e.condition?bi(e.condition):[],update:i=>{const s=e.condition&&Kn(e.condition,i)?"true":"false";if(p?.branch===s)return;p&&(p.group.active=!1,p.node.parentNode?.removeChild(p.node),p=void 0);const a="true"===s?e.ifTrue:e.ifFalse;if(!a)return void Vi(o.parentElement);let f=h.get(s);if(f)f.group.active=!0,function(e,t){for(const n of[...r])d(n.group,e)&&Ki(n.group)&&n.run(n.scope(t))}(f.group,i);else{const e=l(n);f={node:u(a,t,e,i),group:e},h.set(s,f)}c.parentNode?.insertBefore(f.node,c),Ei(o,f.node),p={branch:s,...f},Vi(o.parentElement)}}}(e);if("forEach"===e.element)return function(e){const t=s,n=a,r=i.createElement("div"),o=e.dataSource??"offers";r.dataset.sduiForeach=o,"none"===e.props.impressionProbe?r.dataset.sduiImpressions="none":"categories"===o&&(r.dataset.sduiImpressions="claimed");const d=function(e){const t=e.props.columns;return"number"==typeof t&&Number.isInteger(t)?Math.min(Math.max(t,1),12):void 0}(e);if(void 0===d)r.style.display="contents";else{r.style.display="grid",r.style.gridTemplateColumns=`repeat(${d}, minmax(0, 1fr))`;const t=e.props.gridSpacing;"number"==typeof t&&Number.isFinite(t)&&(r.style.gap=`${Math.max(t,0)}px`)}const h=e.style&&e.itemTemplate?{element:"group",props:{},style:e.style,content:e.itemTemplate}:e.itemTemplate,p=new Map,f=function(e){const t=e.props.offset,n=e.props.limit;return{offset:"number"==typeof t&&Number.isFinite(t)?Math.max(t,0):0,limit:"number"==typeof n&&Number.isFinite(n)?Math.max(n,0):void 0}}(e),m=e.filter?bi(e.filter):[];return{node:r,deps:[ci,ui,di,hi,...m],update:i=>{if(!h)return;const s=function(e,t,n,i){const r=t.filter;switch(e){case"pageIndicators":return n.offers.map((e,t)=>({key:`${t}`,scope:n=>_n(n,e.id,n.currentIndex===t)}));case"offers":{let e=n.offers.slice(i.offset);void 0!==i.limit&&(e=e.slice(0,i.limit));const t=e.map((e,t)=>{const n=i.offset+t;return{key:e.id,scope:t=>_n(t,e.id,t.currentIndex===n)}});return function(e,t,n){return void 0===t?e:e.filter(e=>Kn(t,e.scope(n)))}(t,r,n)}case"categories":{let e=n.offers.slice(i.offset);void 0!==i.limit&&(e=e.slice(0,i.limit));const t=new Map,r=[];for(const n of e)void 0!==n.category&&""!==n.category&&(t.has(n.category)||r.push(n.category),t.set(n.category,(t.get(n.category)??0)+1));const o=[...t.values()].filter(e=>e>=Zi);return o.length<Qi?[]:r.map(e=>({key:e,scope:t=>({...t,rowCategory:e})}))}case"instructions":{let e=(Hn(n)?.instructions??[]).slice(i.offset);return void 0!==i.limit&&(e=e.slice(0,i.limit)),e.map((e,t)=>{const n=i.offset+t;return{key:`${n}`,scope:e=>{const t=Hn(e)?.instructions?.[n];return void 0===t?e:{...e,rowStep:t}}}})}case"hostList":{const e=t.props.list;let r=("string"==typeof e?n.lists?.[e]??[]:[]).slice(i.offset);return void 0!==i.limit&&(r=r.slice(0,i.limit)),r.map((e,t)=>({key:`${i.offset+t}:${JSON.stringify(e)}`,scope:t=>({...t,rowItem:e,values:{...t.values,...jn(e)}})}))}default:return[]}}(o,e,i,f);for(const[e,t]of p)s.some(t=>t.key===e)||(t.group.active=!1,c(t.group),t.node.parentNode?.removeChild(t.node),p.delete(e));for(const e of s){let s=p.get(e.key);if(s)s.box.scope=n=>e.scope(t(n));else{const r=l(n),o={scope:n=>e.scope(t(n))};s={node:u(h,e=>o.scope(e),r,i),group:r,box:o},p.set(e.key,s)}"offers"===o&&1===s.node.nodeType&&(s.node.dataset.sduiOfferId=e.key),r.appendChild(s.node),Ei(r,s.node)}}}}(e);const o=n.get(e.element);if(!o)throw new qi(`no renderer registered for element "${e.element}"`);return o(e,t,h)}(e,t);return o.update&&r.push({deps:o.deps??[],scope:s,group:a,run:e=>o.update?.(e)}),o}const f=p(e.root,t),m=new Yi(f.node,r);return m.update(t),m}(a,m,b,t);if(void 0!==s&&v.root instanceof t.defaultView.HTMLElement){const e=`${s}px`;v.root.style.width="100%",v.root.style.height=e,v.root.style.minHeight=e,v.root.style.maxHeight=e,v.root.style.boxSizing="border-box",v.root.style.setProperty("container-type","inline-size"),v.root.style.getPropertyValue("--sdui-margin-inline")||v.root.style.setProperty("--sdui-margin-inline","0px"),Ts(v.root,!0===m.motionPaused),y.motion&&v.root.appendChild(y.motion.element)}else v.root instanceof t.defaultView.HTMLElement&&(void 0!==v.root.dataset.sduiConditional&&(v.root.style.display="grid",v.root.style.gridTemplateColumns="minmax(0, 1fr)",v.root.style.gridTemplateRows="minmax(0, 1fr)"),v.root.style.width="100%",v.root.style.height="100%",v.root.style.boxSizing="border-box",v.root.style.setProperty("container-type","inline-size"),v.root.style.getPropertyValue("--sdui-margin-inline")||v.root.style.setProperty("--sdui-margin-inline","0px"));g.current=new Es(v.root,v,m,a.stateActions,e.analytics,JSON.stringify(e.template).includes("DominantColor")?e.dominantColor??(e=>function(e,t=document){return new Promise(n=>{const i=t.defaultView;if(!i)return n(null);let r=!1;const o=e=>{r||(r=!0,i.clearTimeout(s),n(e))},s=i.setTimeout(()=>o(null),4e3);try{const n=new i.Image;n.crossOrigin="anonymous",n.onload=()=>{try{const e=t.createElement("canvas");e.width=ks,e.height=ks;const i=e.getContext("2d");if(!i)return o(null);i.drawImage(n,0,0,ks,ks),o(function(e){const t=new Array(12).fill(0),n=new Array(12).fill(0),i=new Array(12).fill(0),r=new Array(12).fill(0);let o=0,s=0,a=0,l=0;for(let c=0;c+3<e.length;c+=4){const d=e[c+3]/255;if(d<.5)continue;const u=e[c]*d/255,h=e[c+1]*d/255,p=e[c+2]*d/255,f=Math.max(u,h,p),m=Math.min(u,h,p),g=f-m,y=(f+m)/2,b=0===g?0:g/(1-Math.abs(2*y-1));if(y>.92||y>.82&&b<.15)continue;if(o+=u,s+=h,a+=p,l+=1,b<.22||y<.1||y>.9)continue;let v=0;0!==g&&(v=f===u?(h-p)/g%6*60:f===h?60*((p-u)/g+2):60*((u-h)/g+4),v<0&&(v+=360));const w=Math.min(11,Math.floor(v/30));t[w]+=b,n[w]+=u*b,i[w]+=h*b,r[w]+=p*b}let c,d=0;for(let e=1;e<12;e+=1)t[e]>t[d]&&(d=e);if(t[d]>0){const e=t[d];c=[n[d]/e,i[d]/e,r[d]/e]}else{if(!(l>0))return null;c=[o/l,s/l,a/l]}const u=e=>Math.trunc(Math.max(0,Math.min(255,255*e))).toString(16).toUpperCase().padStart(2,"0");return`#${u(c[0])}${u(c[1])}${u(c[2])}`}(i.getImageData(0,0,ks,ks).data))}catch{o(null)}},n.onerror=()=>o(null),n.src=Dt(e,Pt,i.devicePixelRatio||1)}catch{o(null)}})}(e,t)):void 0,s,y.motion);const w=void 0===p?void 0:m.offers[p];return w&&g.current.seedSelection(w.id),g.current.requestDominantColors(),g.current}catch(e){return void u.warn("[Encore SDK] SDUI variant could not be rendered; keeping the built-in surface",e)}var n,i}function Ls(e,t){if("first"!==e&&"middle"!==e&&"last"!==e&&!Number.isInteger(e))throw new Error('initialSelection must be "first", "middle", "last" or an integer');if(0!==t)return"first"===e?0:"middle"===e?Math.floor(t/2):"last"===e?t-1:Math.max(0,Math.min(e,t-1))}function Os(e,t){if(null!=e){if("object"!=typeof e||Array.isArray(e)||!Object.values(e).every(e=>"string"==typeof e))throw new Error(`${t} must map keys to strings`);return e}}function Ns(e){const t=e??void 0;if(void 0===t)return;if("object"!=typeof t||Array.isArray(t))throw new Error("textMaps must map names to string maps");const n={};for(const[e,i]of Object.entries(t))n[e]=Os(i,`textMaps.${e}`)??{};return n}function Ms(e,t){if(null!=e){if(!Array.isArray(e)||!e.every(e=>Number.isInteger(e)))throw new Error(`${t} must be a list of integers`);return e}}function Us(e,t,n){return function(e,t){const n=Xn(t);if(void 0===e||!n)return e;let i=e;const r=Qn(n.lighten);void 0!==r&&r>0&&(i=ei(i,"white",r));const o=Qn(n.darken);void 0!==o&&o>0&&(i=ei(i,"black",o));const s=Qn(n.opacity);return void 0!==s&&(i=ai(i,s)??i),i}(function(e,t,n){if("object"!=typeof e||null===e||!("binding"in e))return(i=n,(e,t)=>gn(i(e,t)))(e,t);var i;const r=e.binding;if("string"==typeof r){const e=t?.[r];return void 0===e||""===e?void 0:gn(e)}if("object"==typeof r&&null!==r){const e=r,i="string"==typeof e.key?t?.[e.key]:void 0;return void 0!==i&&""!==i?gn(i):void 0===e.fallback?void 0:Us(e.fallback,t,n)}}(e,t,n),e)}const Rs={status:"failed",reason:N},Fs=new Set(["AbortError","NotAllowedError","InvalidStateError"]);async function Ps(e){const t="undefined"==typeof navigator?void 0:navigator;if(t&&"function"==typeof t.share&&function(e,t){if("function"!=typeof e.canShare)return!0;try{return e.canShare({url:t})}catch{return!1}}(t,e))try{return await t.share({url:e}),{status:"shared",destination:"web_share"}}catch(e){if(Fs.has(e?.name))return{status:"cancelled"};u.debug("Share sheet refused the link; trying the clipboard",e)}return await async function(e,t){const n=t?.clipboard;if(n&&"function"==typeof n.writeText)try{return await n.writeText(e),!0}catch(e){u.debug("Clipboard write refused",e)}return function(e){if("undefined"==typeof document||"function"!=typeof document.execCommand)return!1;const t=document.activeElement,n=document.createElement("textarea");try{n.value=e,n.setAttribute("readonly",""),n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),n.setSelectionRange(0,e.length);const t=n.selectionEnd-n.selectionStart;return document.execCommand("copy")&&t>0}catch(e){return u.debug("Copy command refused",e),!1}finally{n.remove(),t instanceof HTMLElement&&t.focus({preventScroll:!0})}}(e)}(e,t)?{status:"shared",destination:M}:Rs}function zs(e,t=Ps){let n=!1,i=!1;const r=e=>{try{e()}catch(e){u.debug("Share event could not be reported",e)}},o=(t,i)=>(n=!1,r("failed"===i.status?()=>e.failed(t,i.reason):"cancelled"===i.status?()=>e.completed(t,void 0,!1):()=>e.completed(t,i.destination,!0)),i);return{run(s,a){if(n||i)return null;if(n=!0,r(()=>e.tapped(a)),!s)return Promise.resolve(o(a,{status:"failed",reason:"missing_share_link"}));let l;try{l=t(s)}catch{l=Promise.resolve(Rs)}return l.then(e=>o(a,e),()=>o(a,Rs))},lock(){i=!0}}}const js=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1],Ds=["animationend","animationcancel","transitionend","transitioncancel"];function Bs(e){const t=e.boundingClientRect,n=t.width*t.height;if(n<=0)return 0;const i=e.rootBounds;if(!i)return e.intersectionRatio;const r=i.width*i.height;if(r<=0||n<=r)return e.intersectionRatio;const o=e.intersectionRect;return o.width*o.height/r}class Hs{#Zt;#Qt=new Set;#Xt=new Map;#Jt=new WeakMap;#en=new Set;#tn=null;#nn=null;#in=!1;#rn=!1;#v=!1;#on=null;#sn=null;#an=null;#ln=null;constructor(e={}){this.#Zt=e.threshold??.5}register(e,t,n,i={}){if(this.#v||this.#Qt.has(t))return Vs;this.#cn(e),this.#Xt.set(e,{element:e,key:t,onShown:n,eligible:i.eligible}),this.#dn();const r=this.#un();if(r)try{r.observe(e)}catch(e){u.debug("Impression gate could not observe an element",e)}else this.#hn(e);return()=>this.#cn(e)}setContainerVisible(e){this.#v||(this.#rn=e,e&&this.recheck())}recheck(){if(!this.#v){for(const e of Array.from(this.#en))this.#pn(e);for(const e of Array.from(this.#Xt.keys()))this.#hn(e)}}hasShown(e){return this.#Qt.has(e)}destroy(){if(!this.#v){this.#v=!0;try{this.#nn?.disconnect()}catch{}if(this.#nn=null,this.#tn?.disconnect(),this.#tn=null,this.#en.clear(),this.#Xt.clear(),this.#Qt.clear(),this.#on&&(document.removeEventListener("visibilitychange",this.#on),this.#on=null),this.#sn){for(const e of Ds)document.removeEventListener(e,this.#sn,!0);this.#sn=null}this.#an&&(window.removeEventListener("scroll",this.#an,!0),window.removeEventListener("resize",this.#an),this.#an=null),null!==this.#ln&&(clearTimeout(this.#ln),this.#ln=null)}}#dn(){if(!this.#on){try{this.#on=()=>this.recheck(),document.addEventListener("visibilitychange",this.#on)}catch(e){u.debug("Impression gate could not watch page visibility",e),this.#on=null}try{this.#sn=()=>this.recheck();for(const e of Ds)document.addEventListener(e,this.#sn,!0)}catch(e){u.debug("Impression gate could not watch for paint",e),this.#sn=null}}}#cn(e){if(this.#Xt.delete(e)){this.#en.delete(e),this.#tn?.unobserve(e);try{this.#nn?.unobserve(e)}catch{}}}#un(){if(this.#in)return this.#nn;this.#in=!0;try{if("function"!=typeof IntersectionObserver)throw new Error("unavailable");this.#nn=new IntersectionObserver(e=>this.#fn(e),{root:null,threshold:js})}catch(e){u.debug("IntersectionObserver unavailable; impressions use a geometry check",e),this.#nn=null,this.#mn()}return this.#nn}#fn(e){try{for(const t of e){this.#Jt.set(t.target,t.isIntersecting&&Bs(t)>=this.#Zt);const e=t.boundingClientRect;e.width*e.height>0?this.#en.delete(t.target):this.#gn(t.target),this.#hn(t.target)}}catch(e){u.debug("Impression gate observer callback failed",e)}}#pn(e){this.#nn&&this.#Xt.has(e)&&(this.#nn.unobserve(e),this.#nn.observe(e))}#gn(e){this.#en.add(e),"function"==typeof ResizeObserver&&(this.#tn??=new ResizeObserver(e=>{for(const{target:t,contentRect:n}of e)n.width*n.height<=0||(this.#tn?.unobserve(t),this.#pn(t))}),this.#tn.observe(e))}#hn(e){const t=this.#Xt.get(e);if(t&&!this.#v&&this.#rn){try{if("visible"!==document.visibilityState)return;if(t.eligible&&!t.eligible())return;if(!(this.#nn?!0===this.#Jt.get(e):this.#yn(e)))return;if(!this.#bn(e))return}catch(e){return void u.debug("Impression gate evaluation failed",e)}this.#vn(t)}}#vn(e){for(const[t,n]of Array.from(this.#Xt))n.key===e.key&&this.#cn(t);if(!this.#Qt.has(e.key)){this.#Qt.add(e.key);try{e.onShown()}catch(e){u.error("Impression handler failed",e)}}}#bn(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}#yn(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.#Zt}#mn(){try{this.#an=()=>{null!==this.#ln&&clearTimeout(this.#ln),this.#ln=setTimeout(()=>{this.#ln=null,this.recheck()},100)},window.addEventListener("scroll",this.#an,!0),window.addEventListener("resize",this.#an)}catch(e){u.debug("Impression gate could not listen for scrolls",e),this.#an=null}}}class _s{#wn;#xn=[];constructor(e){this.#wn=e}register(e,t,n,i){this.#xn.push(this.#wn.register(e,t,n,i))}clear(){const e=this.#xn;this.#xn=[];for(const t of e)t()}}function Vs(){}const qs=["Watch & listen","Money","Everyday"],Ws="Everyday",Ks=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])),Gs=new Set,Ys={"Watch & listen":"gift.categoryWatch",Money:"gift.categoryMoney",Everyday:"gift.categoryEveryday"};function Zs(e){return qs.find(t=>t===e?.categoryGroup)??function(e){const t="string"==typeof e?e.trim():"";if(""===t)return Ws;const n=t.toLowerCase();return Ks.get(n)||(Gs.has(n)||(Gs.add(n),u.debug(`Unknown offer category "${t}"; showing it under ${Ws}`)),Ws)}(e?.category)}function Qs(e,t){return Ee(Ys[e],t??e)}function Xs(e){return{id:e.id,title:e.title,...void 0!==e.creativeDescription&&{description:e.creativeDescription},...void 0!==e.ctaText&&{ctaText:e.ctaText},...void 0!==e.merchantName&&{merchantName:e.merchantName},...void 0!==e.imageUrl&&{imageUrl:e.imageUrl},...void 0!==e.logoUrl&&{logoUrl:e.logoUrl},...void 0!==e.heroImageUrl&&{heroImageUrl:e.heroImageUrl},...void 0!==e.termsUrl&&{termsUrl:e.termsUrl},...void 0!==e.shareUrl&&{shareUrl:e.shareUrl},...void 0!==e.perk&&{perk:e.perk},...void 0!==e.badgeLabel&&{badgeLabel:e.badgeLabel},...void 0!==e.categoryGroup&&{category:e.categoryGroup},...e.quickInstructions?.trim()&&{quickInstructions:e.quickInstructions},...void 0!==e.instructions&&{instructions:e.instructions},...void 0!==e.displayProperties&&{displayProperties:e.displayProperties}}}function Js(e,t){return n=>{if("valueSet"!==n.kind||void 0===n.offerId)return t(n);const{offerId:i,...r}=n,o=e.find(e=>e.id===i)?.campaignId;t({...r,value:o??r.value})}}class ea{#kn;#ve;#$n=new Ut;#Cn;#In=null;#Sn=0;#v=!1;#En;#Tn;#An;#wn;#Ln;#On;#Nn=null;#Mn=zs({tapped:({offer:e,index:t})=>this.#Un({kind:"tapped",offer:e,index:t}),failed:({offer:e,index:t},n)=>this.#Un({kind:"failed",reason:n,offer:e,index:t}),completed:({offer:e,index:t},n,i)=>this.#Un({kind:"completed",completed:i,offer:e,index:t,...n&&{destination:n}})});constructor(e,t,n){this.#kn=e,this.#ve=t,this.#Cn=n,this.#Ln=!t.impressions,this.#wn=t.impressions??new Hs,this.#On=new _s(this.#wn)}static create(e,t){const n=co(t.template);if(n)return void u.warn(`SDUI variant needs "${n}", which web cannot run`);const i={},r=(e,t)=>{i.current?.emit(e,t)};let o=e;const s={},a=e=>o.findIndex(t=>t.id===e),l=As({template:t.template,offers:e.map(Xs),textEnvironment:{values:{},textMaps:{},variables:t.variables,defaults:{getText:Ee("card.get","Get"),claimText:Ee("card.claim","Claim"),titleText:t.variables.titleText??Ee("churn.fallbackTitle",Oo),accentTitleText:t.variables.accentTitleText??Ee("churn.fallbackAccent",No),subtitleText:t.variables.subtitleText??Ee("churn.fallbackSubtitle",Mo),categoryLabels:Object.fromEntries(qs.map(e=>[e,Qs(e)])),symbolLabels:{xmark:Ee("sdui.close","Close"),"chevron.left":Ee("sdui.back","Back"),"arrowshape.turn.up.right":Ee("sdui.share","Share")}}},actionHost:{claimOffer:(e,n)=>{if(!1===t.claimEnabled)return void u.warn("Claim requested while claiming is disabled — ignoring");const i=a(e),s=o[i];s?r("offerClaim",{offer:s,index:i,...n?{successState:n}:{}}):u.warn("SDUI claim named an offer this presentation does not have")},selectOffer:e=>{const t=a(e),n=o[t];n&&(i.current?.setSelectedIndex(t),r("offerSelect",{offer:n,index:t}))},setOfferIndex:e=>{const t=s.current?.context.offers[e]?.id,n=void 0===t?e:a(t),l=o[n];l&&(i.current?.setSelectedIndex(n),r("offerSelect",{offer:l,index:n}))},close:()=>i.current?.requestClose(),reportCompletion:(e,t)=>{i.current?.applyTransition(t??"close")},openUrl:e=>{window.open(e,"_blank","noopener,noreferrer")},share:(e,t)=>{i.current?.share(e,t)},setState:e=>{i.current?.notifyStateChange(e)}},color:t.color,...t.analytics&&{analytics:Js(e,t.analytics)},...!1===t.claimEnabled&&{claimEnabled:!1},initialIndex:0});if(!l)return;s.current=l;const c=new Map(e.map(e=>[e.id,e]));o=l.context.offers.flatMap(e=>c.get(e.id)??[]);const d=new ea(o,t,l);return d.#Sn=Bn(l.context)??0,i.current=d,d}emit(e,t){this.#v||this.#$n.emit(e,t)}setSelectedIndex(e){this.#Sn=e}on(e,t){return this.#$n.on(e,t)}render(){const e=this.#Cn?.root;if(!(e instanceof HTMLElement))throw new Error("SDUI surface has no root element");return this.#In=e,this.#Rn(e),e}#Rn(e){const t=()=>{if(this.#v)return;this.#On.clear();const t=t=>[...e.matches(t)?[e]:[],...e.querySelectorAll(t)],n=e=>null!==e.closest('[data-sdui-impressions="none"]');for(const e of t("[data-sdui-offer-id]"))n(e)||this.#Fn(e,e.dataset.sduiOfferId);for(const e of t("[data-sdui-creative-offer-id]"))e.closest("[data-sdui-offer-id], [data-sdui-impressions]")||this.#Fn(e,e.dataset.sduiCreativeOfferId)};t();const n=e.ownerDocument.defaultView;if(!n?.MutationObserver)return;let i=!1;this.#Nn=new n.MutationObserver(()=>{i||(i=!0,queueMicrotask(()=>{i=!1,t()}))}),this.#Nn.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-sdui-offer-id","data-sdui-creative-offer-id"]})}#Fn(e,t){const n=this.#kn.findIndex(e=>e.id===t),i=this.#kn[n];i&&void 0!==t&&this.#On.register(e,t,()=>this.emit("offerView",{offer:i,index:n}))}canvasColor(){const e=this.#In,t=e?.ownerDocument.defaultView;if(!e||!t)return;const n=e.getBoundingClientRect(),i=n.width*n.height;if(i<=0)return;const r=(e,o)=>{const s=t.getComputedStyle(e);if("none"===s.display||"hidden"===s.visibility||"0"===s.opacity)return;if(o<6)for(const t of Array.from(e.children).reverse()){const e=r(t,o+1);if(e)return e}const a=s.backgroundColor;return l=e.getBoundingClientRect(),Math.max(0,Math.min(l.right,n.right)-Math.max(l.left,n.left))*Math.max(0,Math.min(l.bottom,n.bottom)-Math.max(l.top,n.top))>=.9*i&&function(e){if(e.startsWith("rgb("))return!0;const t=/rgba\([^)]*,\s*([\d.]+)\)/.exec(e)?.[1];return void 0!==t&&Number(t)>=1}(a)?a:void 0;var l};return r(e,0)}frame(){return{background:this.#ve.color({appearance:"background"}),scheme:this.#ve.scheme??"light"}}getTotalOffers(){return this.#kn.length}getCurrentIndex(){return this.#Sn}getSelectedOffer(){return this.#kn[this.#Sn]}selectOffer(e){const t=this.#kn[e];t&&(this.#Sn=e,this.#Cn?.selectOffer(t.id),this.#$n.emit("offerSelect",{offer:t,index:e}))}next(){const e=this.#Sn+1;e>=this.#kn.length||this.selectOffer(e)}claimSelected(){if(!1===this.#ve.claimEnabled)return void u.warn("Claim requested while claiming is disabled — ignoring");const e=this.getSelectedOffer();e?this.#$n.emit("offerClaim",{offer:e,index:this.#Sn}):u.warn("Claim requested with no selected offer — ignoring")}onRequestClose(e){this.#En=e}requestClose(){this.#v||this.#En?.()}get currentState(){return this.#Cn?.context.currentState}onStateChange(e){this.#An=e}notifyStateChange(e){this.#v||this.#An?.(e)}onShare(e){this.#Tn=e}async share(e,t){if(this.#v)return;const n=void 0===e?this.#Sn:this.#kn.findIndex(t=>t.id===e),i=this.#kn[n];if(!i)return;const r=this.#Mn.run(i.shareUrl,{offer:i,index:n});if(!r)return;const o=await r;"shared"!==o.status||this.#v||(o.destination===M&&function(e,t=globalThis.document){if(!t?.body)return;t.querySelector(`.${On("toast")}`)?.remove();const n=t.createElement("div");n.className=On("toast"),n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),n.textContent=e,t.body.appendChild(n),setTimeout(()=>n.classList.add(On("toast-visible")),16),setTimeout(()=>{n.classList.remove(On("toast-visible")),setTimeout(()=>n.remove(),200)},2200)}("Link copied to clipboard"),t&&this.applyTransition(t))}#Un(e){this.#v||this.#Tn?.(e)}setState(e){this.#Cn?.setState(e),this.notifyStateChange(e)}applyTransition(e){"close"!==e?this.setState(e):this.requestClose()}destroy(){this.#v=!0,this.#Nn?.disconnect(),this.#Nn=null,this.#On.clear(),this.#Ln&&this.#wn.destroy(),this.#$n.removeAllListeners(),this.#In?.remove(),this.#In=null,this.#Cn=void 0}}const ta={accent:"#6743F5",onAccent:"#ffffff",accentTitle:"#16BD25",background:"#f2f2f7",onBackground:"#111111",surface:"#ffffff",onSurface:"#111111",border:"rgba(60, 60, 67, 0.12)",muted:"#8e8e93",error:"#d1344b",label:"#111111",secondaryLabel:"#6c6c70",tertiaryLabel:"#aeaeb2",systemBackground:"#ffffff",secondarySystemBackground:"#f2f2f7",systemGroupedBackground:"#f2f2f7",secondarySystemGroupedBackground:"#ffffff",separator:"rgba(60, 60, 67, 0.12)",tertiarySystemFill:"#e9e9ec"},na={...ta,background:"#000000",onBackground:"#ffffff",surface:"#1c1c1e",onSurface:"#ffffff",border:"rgba(84, 84, 88, 0.5)",muted:"rgba(235, 235, 245, 0.6)",error:"#ff453a",label:"#ffffff",secondaryLabel:"rgba(235, 235, 245, 0.6)",tertiaryLabel:"rgba(235, 235, 245, 0.3)",systemBackground:"#000000",secondarySystemBackground:"#1c1c1e",systemGroupedBackground:"#000000",secondarySystemGroupedBackground:"#1c1c1e",separator:"rgba(84, 84, 88, 0.5)",tertiarySystemFill:"rgba(118, 118, 128, 0.24)"};function ia(e={}){const t={..."dark"===e.scheme?na:ta},n=e.accent??oa(e.serverAccent);n&&(t.accent=n);const i=oa(e.serverAccentTitle);i&&(t.accentTitle=i);const r=e.background?sa(e.background):void 0;if(e.background&&r){const n=(e.text?sa(e.text):void 0)??function(e){const t=e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return.2126*t(e[0])+.7152*t(e[1])+.0722*t(e[2])>.179?[0,0,0]:[255,255,255]}(r),i=e.text??aa(n),o=aa(n,.6),s=aa(la(r,n,.05)),a=aa(la(r,n,.1));Object.assign(t,{background:e.background,onBackground:i,onSurface:i,muted:o,surface:s,border:a,systemGroupedBackground:e.background,systemBackground:s,secondarySystemBackground:s,secondarySystemGroupedBackground:s,label:i,secondaryLabel:o,tertiaryLabel:o,separator:a,tertiarySystemFill:a})}else e.background&&(t.background=e.background,t.systemGroupedBackground=e.background);return!r&&e.text&&(t.onBackground=e.text,t.onSurface=e.text,t.label=e.text),e=>{if("object"!=typeof e||null===e)return;const n=e;return"string"==typeof n.hex?ra(n.hex):"string"==typeof n.appearance?t[n.appearance]:"string"==typeof n.semantic?t[n.semantic]:void 0}}function ra(e){const t=e.trim().replace(/^#/,"");if(/^(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t))return 8===t.length?`#${t.slice(2)}${t.slice(0,2)}`:`#${t}`}function oa(e){return e?ra(e):void 0}function sa(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return;const n=3===t[1].length?[...t[1]].map(e=>e+e).join(""):t[1];return[0,2,4].map(e=>parseInt(n.slice(e,e+2),16))}const aa=(e,t=1)=>1===t?`rgb(${e.join(", ")})`:`rgba(${e.join(", ")}, ${t})`,la=(e,t,n)=>e.map((e,i)=>Math.round(e+(t[i]-e)*n));class ca{#Pn=null;#zn;#ve;#et=!1;#jn=null;#Dn=null;#Bn=null;#Hn=null;#_n=null;#Vn=null;constructor(e,t){this.#zn=e,this.#ve={position:"top",maxWidth:200,...t},this.#qn()}#qn(){this.#Hn=this.#Wn.bind(this),this.#_n=this.#Kn.bind(this),this.#Vn=this.#Gn.bind(this),this.#zn.addEventListener("mouseenter",this.#Hn),this.#zn.addEventListener("mouseleave",this.#_n)}#Wn(){this.#Dn&&(clearTimeout(this.#Dn),this.#Dn=null),this.#jn=window.setTimeout(()=>{this.#Yn()},50)}#Kn(){this.#jn&&(clearTimeout(this.#jn),this.#jn=null),this.#Dn=window.setTimeout(()=>{this.#Zn()},100)}#Yn(){if(this.#et)return;this.#Qn(),this.#Pn=document.createElement("div"),this.#Pn.className=On("tooltip"),this.#Pn.setAttribute("role","tooltip"),this.#Pn.textContent=this.#ve.content,this.#ve.maxWidth&&(this.#Pn.style.maxWidth=`${this.#ve.maxWidth}px`),this.#ve.position&&this.#Pn.classList.add(On(`tooltip-${this.#ve.position}`));const e=this.#zn.getBoundingClientRect();this.#Pn.style.top=`${e.top}px`,this.#Pn.style.left=`${e.left}px`,Me(this.#Pn);const t=this.#zn.closest(`.${On("modal--inline")}`)?.parentNode,n=this.#zn.getRootNode();(t??(n instanceof ShadowRoot?n:document.body)).appendChild(this.#Pn),this.#Vn&&(window.addEventListener("scroll",this.#Vn,!0),window.addEventListener("resize",this.#Vn)),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.#Pn&&(this.#Gn(),this.#Pn.classList.add(On("tooltip-visible")))})}),this.#et=!0}#Zn(){this.#et&&this.#Pn&&(this.#Vn&&(window.removeEventListener("scroll",this.#Vn,!0),window.removeEventListener("resize",this.#Vn)),this.#Pn.classList.remove(On("tooltip-visible")),this.#et=!1,this.#Bn=window.setTimeout(()=>this.#Qn(),200))}#Qn(){null!==this.#Bn&&(clearTimeout(this.#Bn),this.#Bn=null),this.#Pn?.remove(),this.#Pn=null}#Gn(){if(!this.#Pn||!this.#et)return;const e=this.#zn.getBoundingClientRect(),t=this.#Pn.getBoundingClientRect();let n=0,i=0;switch(this.#ve.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.#Pn.style.top=`${n}px`,this.#Pn.style.left=`${i}px`}updateContent(e){this.#ve.content=e,this.#Pn&&(this.#Pn.textContent=e,this.#Gn())}destroy(){this.#jn&&(clearTimeout(this.#jn),this.#jn=null),this.#Dn&&(clearTimeout(this.#Dn),this.#Dn=null),this.#et&&this.#Zn(),this.#Qn(),this.#Hn&&this.#zn.removeEventListener("mouseenter",this.#Hn),this.#_n&&this.#zn.removeEventListener("mouseleave",this.#_n),this.#Vn&&(window.removeEventListener("scroll",this.#Vn,!0),window.removeEventListener("resize",this.#Vn))}}class da{#Ye;#Xn=null;#Jn=null;#ei=null;#ti=!0;constructor(e){this.#Ye=new Ut,this.#ti=e?.claimEnabled??!0}render(e){this.#Xn=e,this.#Jn=document.createElement("div"),this.#Jn.className=On("offer-card");const t=qe(e.logoUrl);if(e.imageUrl?.trim())this.#Jn.appendChild(this.#ni(e.imageUrl,460,e.title,e.tooltipText));else if(t){const n=this.#ni(t,Pt,e.title,e.tooltipText);n.classList.add(On("offer-banner-logo"));const i=n.querySelector("img");i&&(i.alt="",i.onerror=()=>n.remove()),this.#Jn.appendChild(n)}const n=this.#ii(e);return this.#Jn.appendChild(n),this.#Jn}on(e,t){return this.#Ye.on(e,t)}#ni(e,t,n,i){const r=document.createElement("div");r.className=On("offer-banner");const o=document.createElement("img");o.className=On("offer-banner-image"),o.alt=n??Ee("card.imageAlt","Offer image");const s=qe(e);s?(Ht(o,s,t),o.complete?o.classList.add(On("loaded")):o.onload=()=>{o.classList.add(On("loaded"))},o.onerror=()=>{u.warn("Failed to load offer image, using fallback"),Yt(o),o.src=this.#ri(),o.classList.add(On("loaded"))}):(o.src=this.#ri(),o.classList.add(On("loaded"))),r.appendChild(o);const a=document.createElement("button");return a.className=On("banner-info-button"),a.setAttribute("aria-label",Ee("card.moreInfo","More information")),a.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 ',a.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),u.debug("Info button clicked for offer",{title:n,tooltipText:i})}),i&&(this.#ei=new ca(a,{content:i,position:"bottom",maxWidth:200}),r.appendChild(a)),r}#ri(){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 ')}`}#ii(e){const t=document.createElement("div");t.className=On("offer-footer");const n=document.createElement("div");n.className=On("offer-merchant");const i=qe(e.logoUrl);if(i){const t=document.createElement("img");t.className=On("offer-logo"),Ht(t,i,Pt),t.alt=e.merchantName?Ee("card.logoAlt","${name} logo",{name:e.merchantName}):Ee("card.logoAltUnnamed","Merchant logo"),t.complete?t.classList.add(On("loaded")):t.onload=()=>{t.classList.add(On("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=On("offer-merchant-text"),e.merchantName){const t=document.createElement("div");t.className=On("offer-merchant-name"),t.textContent=e.merchantName,r.appendChild(t)}if(e.description){const t=document.createElement("div");t.className=On("offer-merchant-desc"),t.textContent=e.description,r.appendChild(t)}n.appendChild(r);const o=document.createElement("button");return o.className=`${On("button")} ${On("button-claim")}`,o.textContent=e.ctaText??Ee("card.claim","Claim"),o.setAttribute("aria-label",e.title?Ee("card.claimLabel","Claim offer: ${title}",{title:e.title}):Ee("card.claimLabelUntitled","Claim offer")),this.#ti?o.addEventListener("click",()=>{this.#Xn&&this.#Ye.emit("claim",{offer:this.#Xn})}):(o.disabled=!0,o.setAttribute("aria-disabled","true")),t.appendChild(n),t.appendChild(o),t}destroy(){this.#ei&&(this.#ei.destroy(),this.#ei=null),this.#Ye.removeAllListeners(),this.#Jn=null,this.#Xn=null}}const ua=Le("gift",{unnamedGift:"your gift",unnamedGiftBare:"gift",claimFallback:"Claim gift",headline:"Here’s a FREE gift for you",subline:"A free present from us. Pick one.",finePrint:"FREE trial. You can cancel anytime.",sheetContinue:"Continue",sheetTitle:"Other gifts",terms:"One gift per person · Offer terms",pickerTermsLine:"One gift per person · ${link}",pickerTermsLink:"Offer terms",moreGifts:"More gifts",getFallback:"Get your gift",termsLine:"By proceeding you agree to our ${link}",termsLink:"offer terms",chooseLabel:"Choose your gift",closeSheetLabel:"Close other gifts",sheetCategoriesLabel:"Gift categories",presents:"${logo} Presents",showMore:"Show more gifts"});function ha(e){const t=I(e.merchantName);if(t)return t;return function(e){const t=I(e);if(t)try{const{hostname:e}=new URL(t);return I(e.replace(/^www\./i,""))}catch{return}}(e.advertiserUrl)||I(e.title)}function pa(e){return I(e.perk,e.description,e.title)}function fa(e){const t=ha(e),n=pa(e)??t??ua.unnamedGift,i=t&&(r=t,!n.toLowerCase().includes(r.toLowerCase()))?t:void 0;var r;return{primary:n,...i&&{secondary:i}}}function ma(e){const t=ha(e)??pa(e)??ua.unnamedGift,n=pa(e);return{brand:t,...n&&(i=n,r=t,!(i.trim().toLowerCase()===r.trim().toLowerCase()))&&{perk:n}};var i,r}function ga(e,t="Claim"){const n=pa(e);if(n&&n.length<=32)return"Get"===t?Ee("gift.ctaGetPerk","Get ${perk}",{perk:n}):Ee("gift.ctaClaimPerk","Claim ${perk}",{perk:n});const i=ha(e);if(i){const e="Get"===t?Ee("gift.ctaGetBrand","Get your ${brand} gift",{brand:i}):Ee("gift.ctaClaimBrand","Claim your ${brand} gift",{brand:i});if(e.length<=38)return e}return"Get"===t?ua.getFallback:ua.claimFallback}function ya(e){const{primary:t,secondary:n}=fa(e);return n?`${t}, ${n}`:t}function ba(e){const{brand:t,perk:n}=ma(e);return n?`${t}, ${n}`:t}const va=/\bFREE\b/g,wa=/\bfree\b([\s.!]*)$/i;function xa(e,t,n){const i=wa.exec(t);if(!i)return void ka(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 ka(e,t,n){e.textContent="";let i=0;for(const r of t.matchAll(va)){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 $a=/\p{Sc}\s?\p{Nd}+(?:[.,]\p{Nd}+)?|\p{Nd}+(?:[.,]\p{Nd}+)?\s?\p{Sc}/u;function Ca(e,t,n){if(xa(e,t,n),e.querySelector(`.${n}`))return;const i=$a.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 Ia="[\\s\\u200e\\u200f\\u061c]*",Sa="usd|gbp|eur|cad|aud|nzd|chf|jpy|cny|inr|brl|mxn|sek|nok|dkk|pln|krw|rub|sar|aed|egp|ils|zar|hkd|sgd|kr|rs",Ea="zł|円|元|원|руб|ر\\.?س|ج\\.?م|د\\.?إ|ریال|تومان",Ta=new RegExp([`\\p{Sc}${Ia}\\p{Nd}`,`\\p{Nd}${Ia}[a-z]{0,3}\\p{Sc}`,`\\b(?:${Sa})${Ia}\\p{Nd}`,`\\p{Nd}${Ia}(?:${Sa})\\b`,`(?:${Ea})${Ia}\\p{Nd}`,`\\p{Nd}${Ia}(?:${Ea})`].join("|"),"iu");function Aa(e){if(!e)return!1;const t=pa(e);return!!t&&Ta.test(t)}const La={free_trial:()=>Ee("badge.freeTrial","Free trial"),discount:()=>Ee("badge.discount","Discount")},Oa=()=>Ee("badge.exclusive","Exclusive");function Na(e){return"free_trial"===e?.badgeLabel&&!Aa(e)}class Ma{#ve;#oi=null;#v=!1;constructor(e={}){this.#ve=e}render(e){const t=document.createElement("div");t.className=On("reward-card"),this.#oi=t;const n=I(e.merchantName,e.title)??e.id;t.style.setProperty("--encore-card-tint",function(e){return rn(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.#si(e);const i=I(this.#ve.badgeText)??function(e){const t=e?.badgeLabel;return t?"free_trial"===t&&Aa(e)?Oa():La[t]?.()??Oa():Oa()}(e),r=document.createElement("span");r.className=On("reward-card-badge"),r.textContent=i,t.appendChild(r),t.appendChild(this.#ai(e));const o=document.createElement("div");o.className=On("reward-card-text");const s=document.createElement("div");s.className=On("reward-card-name"),s.textContent=I(e.merchantName,e.title)??"",o.appendChild(s);const a=I(e.perk,e.description);if(a){const e=document.createElement("div");e.className=On("reward-card-offer"),e.textContent=a,o.appendChild(e)}return t.appendChild(o),t}#ai(e){const t=document.createElement("div");t.className=On("reward-card-icon");const n=I(e.merchantName,e.title)??"",i=qe(e.logoUrl);if(!i)return t.appendChild(this.#li(n)),t;const r=document.createElement("img");return r.className=On("reward-card-icon-image"),r.alt="",r.setAttribute("aria-hidden","true"),Ht(r,i,Pt),r.onerror=()=>{r.remove(),t.appendChild(this.#li(n))},t.appendChild(r),t}#li(e){const t=document.createElement("span");return t.className=On("reward-card-monogram"),t.setAttribute("aria-hidden","true"),t.textContent=(Array.from(e)[0]??"★").toUpperCase(),t}#si(e){const t=qe(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=Jt,t.height=Jt;const n=t.getContext("2d");if(!n)return null;n.drawImage(e,0,0,Jt,Jt);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=tn(s,a,l);if(c>.92||c<.1)continue;const{s:d}=nn(s,a,l);if(d<.18)continue;const u=d*d;t+=u,n+=s*u,i+=a*u,r+=l*u}if(0===t)return null;const{h:o,s:s,l:a}=nn(n/t,i/t,r/t);return rn(o,s,a)}(n.getImageData(0,0,Jt,Jt).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=Dt(n,Pt,window.devicePixelRatio||1)}catch(e){u.debug("Brand tint sampling unavailable — keeping the fallback tint",e),i(null)}}):Promise.resolve(null)).then(e=>{e&&!this.#v&&this.#oi&&this.#oi.style.setProperty("--encore-card-tint",e)})}destroy(){this.#v=!0,this.#oi?.remove(),this.#oi=null}}let Ua=0;class Ra{#Ye;#kn;#ci=0;#Jn=null;#di=null;#ui=null;#hi=null;#pi=[];#fi=null;#mi=null;#gi=null;#yi=null;#bi=null;#vi=0;#wi=null;#xi=!1;#wn;#Ln;#ki;#$i=-1;#Ci;#Ii=window.matchMedia(`(max-width: ${kn})`);#Si=!1;#Ei=null;#Ti=null;#Ai=-1;#Li=!1;#Oi=!1;#Ni=!1;#ti=!0;#Mi=[];#Ui=[];#Ri=[];#Fi="";#Pi=null;#zi=null;#ji;#Di;constructor(e,t,n){if(this.#Ye=new Ut,this.#kn=e,this.#Ci=t,this.#Li="paged"===n?.mode,this.#Oi=n?.hideHeader??!1,this.#Ni=n?.selectable??!1,this.#ti=n?.claimEnabled??!0,this.#ji=gn(n?.dotColor),this.#Di=gn(n?.dotActiveColor),this.#Fi=`${On("offer-option")}-${Ua+=1}-`,0===e.length)throw new Error("OfferCarousel requires at least one offer");this.#Ln=void 0===n?.impressions,this.#wn=n?.impressions??new Hs,this.#ki=new _s(this.#wn),Zt(e[0]?.imageUrl,460),Zt(e[0]?.logoUrl,Pt)}render(){if(this.#Jn=document.createElement("div"),this.#Jn.className=this.#Li?`${On("carousel")} ${On("carousel-paged")}`:On("carousel"),this.#fi=document.createElement("div"),this.#fi.setAttribute("role","status"),this.#fi.setAttribute("aria-live","polite"),this.#fi.setAttribute("aria-atomic","true"),this.#fi.className="sr-only",this.#fi.style.position="absolute",this.#fi.style.width="1px",this.#fi.style.height="1px",this.#fi.style.padding="0",this.#fi.style.margin="-1px",this.#fi.style.overflow="hidden",this.#fi.style.clip="rect(0, 0, 0, 0)",this.#fi.style.whiteSpace="nowrap",this.#fi.style.border="0",!this.#Oi){const e=this.#Bi();this.#Jn.appendChild(e)}if(this.#di=document.createElement("div"),this.#di.className=On("carousel-cards"),this.#Ni&&(this.#di.setAttribute("role","listbox"),this.#di.setAttribute("tabindex","0"),this.#di.setAttribute("aria-label",Ee("carousel.choose","Choose an offer")),this.#di.classList.add(On("carousel-select"),On("carousel-select--quiet"))),this.#Jn.appendChild(this.#fi),this.#Jn.appendChild(this.#di),this.#kn.length>1){const e=this.#Ni?this.#Hi():this.#_i();this.#Jn.appendChild(e)}return this.#Vi(),this.#qi(),this.#Si=!this.#Li&&this.#Ii.matches,this.#Wi(),this.#Li||(this.#Ei=this.#Ki.bind(this),this.#Ii.addEventListener("change",this.#Ei)),this.#Jn}#Wi(){this.#Gi(),this.#$i=this.#ci,this.#Yi(),this.#Si?this.#Zi():(this.#Ni?this.#Qi():this.#Xi(),this.#Ji(),this.#xi=!1,this.#er(this.#ci,!1),this.#tr(this.#ci),this.#nr(this.#ci))}#qi(){this.#ki.clear();const e=this.#di?.querySelectorAll(`.${On("carousel-item")}`);e?.forEach(e=>{const t=Number(e.getAttribute("data-index")),n=this.#kn[t];n&&this.#ki.register(e,n.id,()=>this.#Ye.emit("offerView",{offer:n,index:t}),{eligible:()=>t===this.#ci&&!this.#xi})})}#Ki(){const e=this.#Ii.matches;e!==this.#Si&&(this.#Si=e,this.#Wi())}#Gi(){this.#mi&&(document.removeEventListener("keydown",this.#mi),this.#mi=null),this.#di&&this.#Pi&&(this.#di.removeEventListener("keydown",this.#Pi),this.#Pi=null),this.#di&&this.#zi&&(this.#di.removeEventListener("focusout",this.#zi),this.#zi=null),this.#di&&this.#gi&&(this.#di.removeEventListener("scroll",this.#gi),this.#gi=null),this.#di&&this.#yi&&(this.#di.removeEventListener("scrollend",this.#yi),this.#yi=null),null!==this.#bi&&(cancelAnimationFrame(this.#bi),this.#bi=null),this.#wi&&(clearTimeout(this.#wi),this.#wi=null),this.#Ti&&(this.#Ti.disconnect(),this.#Ti=null)}#Zi(){this.#di&&(this.#Ti=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.#Ai&&(this.#Ai=n,this.#ci=n,n!==this.#$i&&(this.#$i=n,this.#Ye.emit("scroll",{axis:"vertical",position:n})),this.#wn.recheck(),u.debug(`Offer ${n+1} entered view`))},{root:this.#di,threshold:.5}),this.#di.querySelectorAll(`.${On("carousel-item")}`).forEach(e=>this.#Ti?.observe(e)))}on(e,t){return this.#Ye.on(e,t)}getCurrentIndex(){return this.#ci}getTotalOffers(){return this.#kn.length}next(){const e=Math.min(this.#ci+1,this.#kn.length-1);e!==this.#ci&&(this.#ci=e,this.#tr(e),this.#er(e),this.#ir(Ee("carousel.showing","Showing offer ${n} of ${total}",{n:Fe(e+1),total:Fe(this.#kn.length)})),u.debug(`Navigated to offer ${e+1}`))}getSelectedOffer(){return this.#kn[this.#ci]}claimSelected(){const e=this.getSelectedOffer();e?this.#Ye.emit("offerClaim",{offer:e,index:this.#ci}):u.warn("Claim requested with no selected offer — ignoring")}selectOffer(e){e<0||e>=this.#kn.length||e===this.#ci||(this.#ci=e,this.#tr(e),this.#er(e),this.#ir(Ee("carousel.selected","Selected offer ${n} of ${total}",{n:Fe(e+1),total:Fe(this.#kn.length)})),e!==this.#$i&&(this.#$i=e,this.#Ye.emit("scroll",{axis:"horizontal",position:e})))}previous(){const e=Math.max(this.#ci-1,0);e!==this.#ci&&(this.#ci=e,this.#tr(e),this.#er(e),this.#ir(Ee("carousel.showing","Showing offer ${n} of ${total}",{n:Fe(e+1),total:Fe(this.#kn.length)})),u.debug(`Navigated to offer ${e+1}`))}#Vi(){if(!this.#di)return;const e=this.#di;this.#kn.forEach((t,n)=>{let i;if(this.#Ni){const e=new Ma;i=e.render(t),this.#Ui.push(e)}else{const e=new da({claimEnabled:this.#ti});i=e.render(t),this.#pi.push(e),e.on("claim",()=>{this.#Ye.emit("offerClaim",{offer:t,index:n})})}const r=document.createElement("div");r.className=On("carousel-item"),r.setAttribute("data-index",n.toString()),r.appendChild(i),this.#Ni&&(r.id=`${this.#Fi}${n}`,r.setAttribute("role","option"),r.setAttribute("aria-selected",String(n===this.#ci)),r.addEventListener("click",()=>this.selectOffer(n))),e.appendChild(r)}),requestAnimationFrame(()=>{e.classList.add(On("cards-ready"))})}#er(e,t=!0){if(!this.#di)return;const n=this.#di.querySelectorAll(`.${On("carousel-item")}`)[e];if(n){if(this.#Ni){const e=this.#di,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"})}}#tr(e){this.#rr(),this.#or(e),this.#sr(e)}#sr(e){if(!this.#Ni||!this.#di)return;const t=this.#di.querySelectorAll(`.${On("carousel-item")}`);t.forEach((t,n)=>t.setAttribute("aria-selected",String(n===e)));const n=t[e]?.id;n?this.#di.setAttribute("aria-activedescendant",n):this.#di.removeAttribute("aria-activedescendant"),this.#Mi.forEach((t,n)=>t.classList.toggle(On("active"),n===e)),this.#ar(e);const i=this.#kn[e];i&&this.#Ye.emit("offerSelect",{offer:i,index:e})}#Hi(){const e=document.createElement("div");return e.className=On("page-indicator"),e.setAttribute("aria-hidden","true"),this.#ji&&e.style.setProperty("--encore-dot-color",this.#ji),this.#Di&&e.style.setProperty("--encore-dot-active-color",this.#Di),this.#Mi=this.#kn.map((t,n)=>{const i=document.createElement("span");return i.className=n===this.#ci?`${On("dot")} ${On("active")}`:On("dot"),e.appendChild(i),i}),e}#Yi(){const e=this.#Jn;if(!e)return;const t=this.#Ni&&this.#kn.length>1&&!this.#Si;if(t&&0===this.#Ri.length)for(const t of this.#lr())e.appendChild(t);else if(!t&&this.#Ri.length>0){for(const e of this.#Ri)e.remove();this.#Ri=[]}}#lr(){const e=(e,t,n,i)=>{const r=document.createElement("button");return r.type="button",r.className=`${On("reward-arrow")} ${On(`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.#Ri=[e("prev",Ee("carousel.previous","Previous offer"),"M14.5 5.5L8 12l6.5 6.5",()=>this.selectOffer(this.#ci-1)),e("next",Ee("carousel.next","Next offer"),"M9.5 5.5L16 12l-6.5 6.5",()=>this.selectOffer(this.#ci+1))],this.#ar(this.#ci),this.#Ri}#ar(e){const[t,n]=this.#Ri;t&&(t.disabled=0===e,t.classList.toggle(On("disabled"),t.disabled)),n&&(n.disabled=e===this.#kn.length-1,n.classList.toggle(On("disabled"),n.disabled))}#Qi(){this.#di&&(this.#Pi=e=>{this.#cr();let t=null;switch(Ue(e.key,this.#di)){case"ArrowLeft":case"ArrowUp":t=this.#ci-1;break;case"ArrowRight":case"ArrowDown":t=this.#ci+1;break;case"Home":t=0;break;case"End":t=this.#kn.length-1;break;default:return}e.preventDefault(),this.selectOffer(Math.max(0,Math.min(t,this.#kn.length-1)))},this.#di.addEventListener("keydown",this.#Pi),this.#zi=e=>{const t=e.relatedTarget;t instanceof Node&&t.ownerDocument===document&&document.contains(t)&&this.#cr()},this.#di.addEventListener("focusout",this.#zi))}#cr(){this.#di?.classList.remove(On("carousel-select--quiet"))}#nr(e){this.#di&&(this.#vi=e,this.#di.querySelectorAll(`.${On("carousel-item")}`).forEach((t,n)=>{n===e?t.classList.add(On("active")):t.classList.remove(On("active"))}))}#Bi(){const e=document.createElement("div");e.className=On("carousel-header");const t=document.createElement("h2");t.className=On("carousel-title"),t.id=On("modal-title"),t.textContent=this.#Ci?.customHeadline??this.#Ci?.titleText??Ee("carousel.title","Exclusive offers");const n=document.createElement("p");return n.className=On("carousel-subtitle"),n.textContent=this.#dr(this.#ci),this.#ui=n,e.appendChild(t),e.appendChild(n),e}#dr(e){const t=this.#Ci?.customSubheadline??this.#Ci?.subtitleText??"";if(!this.#Li)return t;const n=this.#kn[e]?.perk?.trim();return n||t}#or(e){if(!this.#Li||!this.#ui)return;const t=this.#dr(e);this.#ui.textContent!==t&&(this.#ui.textContent=t)}#_i(){const e=document.createElement("div");e.className=On("carousel-navigation");const t=document.createElement("button");t.className=On("nav-button"),t.setAttribute("aria-label",Ee("carousel.previous","Previous offer")),t.innerHTML=this.#Li?'\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=On("nav-button"),n.setAttribute("aria-label",Ee("carousel.next","Next offer")),n.innerHTML=this.#Li?'\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.#hi=e,this.#rr(t,n),e}#rr(e,t){if(!this.#hi)return;const n=this.#hi.querySelectorAll(`.${On("nav-button")}`),i=e??n[0],r=t??n[1];i&&(i.disabled=0===this.#ci,i.classList.toggle(On("disabled"),0===this.#ci)),r&&(r.disabled=this.#ci===this.#kn.length-1,r.classList.toggle(On("disabled"),this.#ci===this.#kn.length-1))}#Xi(){this.#mi=this.#ur.bind(this),document.addEventListener("keydown",this.#mi)}#ur(e){if(this.#Jn)switch(Ue(e.key,this.#Jn)){case"ArrowLeft":e.preventDefault(),this.previous();break;case"ArrowRight":e.preventDefault(),this.next()}}#Ji(){if(!this.#di)return;const e=this.#di,t="onscrollend"in e;this.#gi=()=>{this.#xi=!0,null===this.#bi&&(this.#bi=window.requestAnimationFrame(()=>{this.#bi=null,this.#hr()})),t||(this.#wi&&clearTimeout(this.#wi),this.#wi=window.setTimeout(()=>this.#pr(),120))},e.addEventListener("scroll",this.#gi),t&&(this.#yi=()=>this.#pr(),e.addEventListener("scrollend",this.#yi))}#fr(){if(!this.#di)return this.#ci;const e=this.#di,t=e.querySelectorAll(`.${On("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}#hr(){if(!this.#di)return;const e=this.#fr();e!==this.#vi&&this.#nr(e)}#pr(){this.#wi&&(clearTimeout(this.#wi),this.#wi=null);const e=this.#fr();e!==this.#ci&&(this.#ci=e,this.#tr(e),u.debug(`Gesture settled on offer ${e+1}`)),this.#nr(e),e!==this.#$i&&(this.#$i=e,this.#Ye.emit("scroll",{axis:"horizontal",position:e})),this.#xi=!1,this.#wn.recheck()}#ir(e){this.#fi&&(this.#fi.textContent=e)}destroy(){this.#Gi(),this.#ki.clear(),this.#Ln&&this.#wn.destroy(),this.#Ei&&(this.#Ii.removeEventListener("change",this.#Ei),this.#Ei=null),this.#pi.forEach(e=>e.destroy()),this.#pi=[],this.#Ui.forEach(e=>e.destroy()),this.#Ui=[],this.#Ri=[],this.#Ye.removeAllListeners(),this.#Jn=null,this.#di=null,this.#ui=null,this.#hi=null,this.#fi=null,this.#Mi=[]}}function Fa(e,t,n,i=!1){const r=document.createElement("div");r.className=`${t} ${On("brand-tile-placeholder")}`;const o=e.name?.trim().charAt(0);r.textContent=o?o.toUpperCase():"★",i&&r.setAttribute("aria-hidden","true");const s=qe(e.logoUrl);if(s){const o=document.createElement("img");o.className=t,o.alt=i?"":e.name?Ee("card.logoAlt","${name} logo",{name:e.name}):Ee("brand.logoAlt","Brand logo"),i&&o.setAttribute("aria-hidden","true"),o.width=n,o.height=n,o.addEventListener("load",()=>r.replaceWith(o)),Ht(o,s,Pt,!1)}return r}function Pa(e,t){const n=document.createElement("div");n.className=On("lockup"),n.setAttribute("aria-hidden","true");const i=Fa(e,`${On("lockup-tile")} ${On("lockup-tile-partner")}`,56);return n.appendChild(i),(t.name||t.logoUrl)&&n.appendChild(Fa(t,`${On("lockup-tile")} ${On("lockup-tile-host")}`,56)),n}function za(e){const t=document.createElement("div");return t.className=On("ledger"),e.forEach(e=>t.appendChild(function(e){const t=document.createElement("div");t.className=On("ledger-row");const n=Fa(e.brand,On("ledger-logo"),44,!0),i=document.createElement("div");i.className=On("ledger-text");const r=document.createElement("div");if(r.className=On("ledger-name"),r.textContent=e.name,i.appendChild(r),e.detail){const t=document.createElement("div");t.className=On("ledger-detail"),t.textContent=e.detail,i.appendChild(t)}const o=document.createElement("div");return o.className=`${On("ledger-status")} ${On(`ledger-status-${e.status.tone}`)}`,o.textContent=e.status.text,t.appendChild(n),t.appendChild(i),t.appendChild(o),t}(e))),t}function ja(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 Da{#Jn=null;#Ye;#n;constructor(e){this.#n=e,this.#Ye=new Ut}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=On("primer-container");const o=t.logoUrl??t.imageUrl,s=Pa({...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=On("primer-title"),a.id=On("modal-title"),a.textContent="activation"===i&&n?(l=n,(c=e.trialPeriod)?Ee("primer.titleTrial","Amazing! Your ${trial} free trial of ${app} is ready",{trial:c,app:l}):Ee("primer.title","Amazing! Your ${app} reward is ready",{app:l})):Ee("holding.title","Your reward is saved");const d=document.createElement("p");d.className=On("primer-subtitle"),d.textContent="activation"===i&&n?((e,t=!1)=>t?Ee("primer.subtitleTrial","Next you'll see the ${app} activation screen. No charge today.",{app:e}):Ee("primer.subtitle","Next you'll see the ${app} activation screen.",{app:e}))(n,!!e.trialPeriod):((e,t=!1)=>e?t?Ee("holding.subtitleNamedTrial","Come back any time to claim it from ${advertiser}. No charge today.",{advertiser:e}):Ee("holding.subtitleNamed","Come back any time to claim it from ${advertiser}.",{advertiser:e}):t?Ee("holding.subtitleTrial","Come back any time to claim it. No charge today."):Ee("holding.subtitle","Come back any time to claim it."))(t.name,!0===t.freeTrial);const h=ja("activation"===i&&n?((e,t)=>t?Ee("primer.ctaTrial","Activate ${app} trial",{app:e}):Ee("primer.cta","Continue to ${app}",{app:e}))(n,e.trialPeriod):Ee("holding.cta","Continue"),On("primer-cta"),()=>{u.debug("User tapped the primer CTA"),this.#Ye.emit("continue",void 0)});return r.appendChild(s),r.appendChild(a),r.appendChild(d),r.appendChild(h),this.#Jn=r,u.debug("Primer screen rendered",{variant:i}),r}on(e,t){return this.#Ye.on(e,t)}destroy(){this.#Jn&&(this.#Jn.remove(),this.#Jn=null),this.#Ye.removeAllListeners(),u.debug("Primer screen destroyed")}}const Ba=e=>({...e.advertiserName&&{name:e.advertiserName},...(e.logoUrl??e.imageUrl)&&{logoUrl:e.logoUrl??e.imageUrl}}),Ha=e=>({brand:Ba(e),name:e.advertiserName??Ee("redemption.rewardFallback","Your reward"),...e.reward&&{detail:e.reward},status:{text:Ee("redemption.pending","Pending"),tone:"pending"}}),_a=e=>{const t=document.createElement("h2");return t.className=On("redemption-title"),t.id=On("modal-title"),t.textContent=e,t},Va=e=>{const t=document.createElement("p");return t.className=On("redemption-subtitle"),t.textContent=e,t},qa={activation(e){const t=e.host??{},n=t.name??Ee("redemption.appFallback","your app"),i=[{brand:{name:n,...t.logoUrl&&{logoUrl:t.logoUrl}},name:n,...t.detail&&{detail:t.detail},status:{text:t.status??Ee("redemption.active","Active"),tone:"active"}},Ha(e)];return[Pa(Ba(e),{name:n,...t.logoUrl&&{logoUrl:t.logoUrl}}),_a((r=n,o=t.trialPeriod,o?Ee("redemption.titleTrial","Congratulations! Your ${trial} free trial is active.",{trial:o}):Ee("redemption.titlePlan","Congratulations! Your ${app} plan is active.",{app:r}))),Va(je(n)),za(i)];var r,o},reward:e=>[_a(Ee("redemption.rewardTitle","Congratulations!")),Va(e.reward?Ee("redemption.claimNamed","Now claim your ${reward}",{reward:e.reward}):Ee("redemption.claim","Now claim your reward")),za([Ha(e)])]};class Wa{#Jn=null;#Ye;#n;constructor(e){this.#n=e,this.#Ye=new Ut}render(){const{advertiserName:e,buttonText:t}=this.#n,n=this.#n.variant??"reward",i=Object.prototype.hasOwnProperty.call(qa,n)?n:"reward",r=document.createElement("div");r.className=On("redemption-container");for(const e of qa[i](this.#n))r.appendChild(e);const o=(l=!0===this.#n.freeTrial,(a=e)?l?Ee("redemption.noteNamedTrial","You'll be sent to ${advertiser}. No payment now, cancel anytime.",{advertiser:a}):Ee("redemption.noteNamed","You'll be sent to ${advertiser}.",{advertiser:a}):l?Ee("redemption.noteTrial","No payment now, cancel anytime."):void 0),s=ja(t??Ee("redemption.cta","Claim your reward"),On("redemption-cta"),()=>{u.debug("User tapped the redemption CTA"),this.#Ye.emit("continue",void 0)});var a,l;if(o){const e=document.createElement("p");e.className=On("redemption-note"),e.textContent=o,r.appendChild(e)}return r.appendChild(s),this.#Jn=r,u.debug("Redemption screen rendered",{variant:i}),r}on(e,t){return this.#Ye.on(e,t)}destroy(){this.#Jn&&(this.#Jn.remove(),this.#Jn=null),this.#Ye.removeAllListeners(),u.debug("Redemption screen destroyed")}}function Ka(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 Ga(e,t){return null==e?null:"function"==typeof e?function(e,t){try{const n=e(t);return null==n?null:Ka(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):Ka(e)?e:null}function Ya(e){if(null!=e&&"function"!=typeof e&&!Ka(e))return e}function Za(e,t,n){void 0!==n&&e.style.setProperty(t,n)}function Qa(e,t){Za(e,"color",gn(t.color)),Za(e,"font-family",yn(t.fontFamily)),Za(e,"font-size",bn(t.fontSize)),Za(e,"font-weight",vn(t.fontWeight)),Za(e,"letter-spacing",bn(t.letterSpacing)),Za(e,"text-align",function(e){const t=mn(e);if(void 0!==t)return null===t?fn("text-align",e):hn.has(t.toLowerCase())?t.toLowerCase():fn("text-align",e)}(t.textAlign))}function Xa(e){return"string"==typeof e?.text?I(e.text):void 0}function Ja(e,t,n,i){if(null==i)return e;const r=Ga(i,{text:t,useCase:n,defaultElement:e});if(r)return r===e?e:nl(e,r,On("slot-custom"))?(!e.textContent?.trim()&&t&&e.setAttribute("aria-label",t),e):e;const o=Ya(i);if(o){const t=Xa(o);t&&(e.textContent=t),Qa(e,o)}return e}function el(e){return Xa(Ya(e))}function tl(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=>rl(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:()=>I(a.textContent)??l,destroy:()=>e.abort()}},h=Ga(o,{text:n,useCase:r,defaultElement:a});if(!h||h===a){h===a&&a.textContent!==n&&(l=a.textContent??n,c=!0);const e=Ya(o);if(e){const t=Xa(e);t&&(a.textContent=t,l=t,c=!0),function(e,t){Qa(e,t),Za(e,"background-color",gn(t.backgroundColor)),Za(e,"border-radius",bn(t.borderRadius));const n=gn(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} ${On("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(il))];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),!nl(p,h))return d();p.textContent?.trim()||p.setAttribute("aria-label",n);const f=new AbortController,m=e=>{e.preventDefault(),e.stopImmediatePropagation(),i()};return s&&(p.addEventListener("click",m,{capture:!0,signal:f.signal}),p.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||m(e)},{capture:!0,signal:f.signal})),{element:p,setAccessibleName:e=>rl(p,e,p.textContent?.trim()?void 0:l),setLabel:e=>{p.textContent?.trim()||(l=e,p.setAttribute("aria-label",e))},getLabel:()=>I(p.textContent)??l,destroy:()=>{f.abort(),h.remove()}}}function nl(e,t,n){if(!0===t.parentElement?.classList.contains(On("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 il='a[href], button, input, select, textarea, iframe, [tabindex], [contenteditable="true"]';function rl(e,t,n){t?e.setAttribute("aria-label",t):n?e.setAttribute("aria-label",n):e.removeAttribute("aria-label")}const ol=On("thankyou-title"),sl=Le("reward",{trust:"No charges until trial ends, cancel anytime.",trustUnknown:"Terms apply. See the offer for details.",primary:"Claim gift",secondary:"No thanks",next:"Next offer",more:"Other gifts"}),al={decline:()=>sl.secondary,next:()=>sl.next,more:()=>sl.more};class ll{#ve;#oi=null;#mr=null;#gr=null;#yr=null;#br;#vr;#wr;constructor(e){this.#ve=e,this.#wr=I(e.primaryLabel)}#xr(){const e=this.#ve.secondary??"decline";return"next"!==e||this.#ve.onNext?"more"!==e||this.#ve.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=On("reward-actions"),!1!==this.#ve.showTrust){const t=document.createElement("p");t.className=On("reward-trust"),this.#yr=t,this.#kr(),e.appendChild(t)}const t=document.createElement("div");t.className=On("reward-cta-stack");const n=this.#ve.useCase??"rewardUsers",i=tl({className:On("reward-cta-primary"),label:this.#wr??sl.primary,onActivate:()=>this.#ve.onClaim(),enabled:!1!==this.#ve.claimEnabled,useCase:n,...this.#ve.claimSlot&&{slot:this.#ve.claimSlot}});t.appendChild(i.element),this.#mr=i,this.#$r();const r=I(this.#ve.termsText);if(this.#ve.termsElement)t.appendChild(this.#ve.termsElement);else if(r){const e=document.createElement("p");e.className=On("reward-terms"),e.textContent=r,t.appendChild(e)}const o=this.#xr();if("none"!==o){const e=tl({className:"more"===o?`${On("reward-cta-secondary")} ${On("reward-cta-link")}`:On("reward-cta-secondary"),label:al[o](),onActivate:()=>"next"===o?this.#ve.onNext?.():"more"===o?this.#ve.onMore?.():this.#ve.onDecline(),useCase:n,..."decline"===o&&this.#ve.declineSlot&&{slot:this.#ve.declineSlot}});t.appendChild(e.element),this.#gr=e}return e.appendChild(t),this.#oi=e,e}setSelectedOffer(e){this.#vr=e,this.#$r()}getSecondaryElement(){return this.#gr?.element}setTrustText(e){this.#br=I(e),this.#kr()}#kr(){const e=this.#yr;e&&(e.textContent=I(this.#br,this.#ve.trustText)??sl.trust)}setPrimaryLabel(e){const t=I(e);t&&(this.#wr=t,this.#mr?.setLabel(t),this.#$r())}#$r(){if(!this.#mr)return;const e=this.#vr?.trim(),t=this.#mr.getLabel();this.#mr.setAccessibleName(e?Ee("reward.ctaFrom","${label} from ${name}",{label:t,name:e}):void 0)}destroy(){this.#mr?.destroy(),this.#gr?.destroy(),this.#oi?.remove(),this.#oi=null,this.#mr=null,this.#gr=null}}class cl{#Cr;#Ir=null;#Sr=[];#v=!1;constructor(e=("undefined"==typeof document?null:document)){this.#Cr=e}get origin(){return this.#Ir}point(e){if(this.#v)return;if(this.#Ir)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&&Ve(t.hostname))&&t.origin&&"null"!==t.origin?t.origin:null}(e);if(!t)return;const n=this.#Cr;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.#Sr.push(i)}this.#Ir=t}catch(e){u.warn("Advertiser preconnect failed",{origin:t,error:e}),this.#Er(),this.#Ir=null}}destroy(){this.#v=!0,this.#Er(),this.#Ir=null}#Er(){for(const e of this.#Sr.splice(0))e.remove()}}const dl=Object.freeze({giftReveal:"giftReveal",giftList:"giftList",giftUnwrap:"giftUnwrap",giftPicker:"giftPicker",giftPickerPreload:"giftPicker",codeUnlock:"codeUnlock",shareFromHeader:"shareFromHeader",shareForLater:"shareForLater"});function ul(e,t=dl){return e&&Object.prototype.hasOwnProperty.call(t,e)?t[e]??null:null}function hl(e){return"carouselControl"===e}const pl=new Set(["giftPickerPreload"]),fl=()=>Ee("claim.loading","Loading your FREE offer"),ml="encore-claim-screen-styles",gl="encore-claim-",yl=`${gl}root--sheet`,bl=`\n.${gl}root{position:fixed;inset:0;z-index:10000;display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:0 20px;background:rgba(255,255,255,.65);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,sans-serif;color:#0b0a0d;text-align:center}\n.${gl}root--tab{background:#fff}\n.${yl}{position:fixed;border-radius:inherit;z-index:20}\n.${gl}root:focus{outline:none}\n.${gl}col{display:flex;flex-direction:column;align-items:center;gap:10px;box-sizing:border-box;width:100%;max-width:353px;padding:30px 26px 20px;transform:translateY(-27.39px)}\n.${gl}logo{width:80px;height:80px;border-radius:16px;object-fit:cover;margin:0 4.43px 4.43px 0;box-shadow:0 4px 44px rgba(7,119,255,.35)}\n.${gl}text{display:flex;flex-direction:column;align-items:stretch;width:100%}\n.${gl}title{display:flex;align-items:center;justify-content:center;gap:10px;margin:0;padding-top:16px;font-size:21px;font-weight:700;line-height:25.62px;letter-spacing:-.4px}\n.${gl}spin{width:30.78px;height:30.78px;padding:2px;box-sizing:border-box;flex:none}\n.${gl}spin span{display:block;width:100%;height:100%;border-radius:50%;box-sizing:border-box;border:3.6px solid #d4f1fc;border-top-color:#02afef;border-right-color:#02afef;border-bottom-color:#02afef;animation:${gl}spin .96s linear infinite}\n.${gl}domain{margin:8px 0 0;font-size:14.5px;line-height:19.14px}\n.${gl}rows{list-style:none;margin:32px 0 0;padding:0;display:flex;flex-direction:column;align-items:flex-start;gap:8px;text-align:left}\n.${gl}row{display:flex;align-items:center;gap:10px;font-size:16px;font-weight:700;line-height:25.62px;letter-spacing:-.4px}\n.${gl}row svg{flex:none}\n.${gl}close{position:absolute;top:calc(16px + env(safe-area-inset-top));right:16px;width:36px;height:36px;border:0;border-radius:50%;background:rgba(0,0,0,.06);color:#3c3c43;font-size:18px;line-height:36px;cursor:pointer}\n@keyframes ${gl}spin{to{transform:rotate(360deg)}}\n@media (prefers-reduced-motion:reduce){.${gl}spin span{animation:none}}\n`;function vl(e,t,n,i){if(!e.getElementById(ml)){const t=e.createElement("style");t.id=ml,t.textContent=bl,(e.head??e.documentElement).appendChild(t)}if("tab"===n){const t=e.createElement("meta");t.name="viewport",t.content="width=device-width, initial-scale=1",(e.head??e.documentElement).appendChild(t),e.title=fl(),Me(e.documentElement)}const r=e.createElement("div");r.className="tab"===n?`${gl}root ${gl}root--tab`:i?`${gl}root ${yl}`:`${gl}root`,r.setAttribute("role","status"),r.setAttribute("aria-live","polite"),"inPage"===n&&Me(r);const o=e.createElement("div");o.className=`${gl}col`,r.appendChild(o);const s=qe(t.logoUrl);if(s){const t=e.createElement("img");t.className=`${gl}logo`,Ht(t,s,Pt,!1),t.alt="",o.appendChild(t)}const a=e.createElement("div");a.className=`${gl}text`,o.appendChild(a);const l=e.createElement("p");l.className=`${gl}title`,l.append(fl());const c=e.createElement("span");if(c.className=`${gl}spin`,c.setAttribute("aria-hidden","true"),c.appendChild(e.createElement("span")),l.appendChild(c),a.appendChild(l),t.expectedDomain){const n=e.createElement("p");n.className=`${gl}domain`,n.textContent=Ee("claim.finishOn","Finish on ${domain}",{domain:t.expectedDomain}),a.appendChild(n)}const d=function(e){return(e.instructions??[]).map(e=>"string"==typeof e.title?e.title.trim():"").filter(e=>""!==e).slice(0,3)}(t);if(d.length>0){const t=e.createElement("ul");t.className=`${gl}rows`;for(const n of d){const i=e.createElement("li");i.className=`${gl}row`,i.innerHTML='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" aria-hidden="true"><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="#353535"/></svg>',i.append(n),t.appendChild(i)}a.appendChild(t)}return(i??e.body).appendChild(r),r}function wl(e){if(!e)return!1;try{return!("document"in e)}catch{return!1}}const xl=["t2","t1","t3"];class kl{#oi=null;#Tr=null;#Ar=null;#v=!1;#jt=null;#Lr=null;#Or=!1;render(e){const t=document.createElement("div");t.className=On("gift-hero"),t.setAttribute("aria-hidden","true");const n=document.createElement("div");n.className=e.length<=1?`${On("gift-box")} ${On("gift-box--solo")}`:On("gift-box"),n.appendChild(this.#Nr("gift-box-shadow")),n.appendChild(this.#Nr("gift-box-back")),e.slice(0,3).forEach((e,t)=>{const i=xl[t];i&&n.appendChild(this.#Mr(e,i))}),n.appendChild(this.#Nr("gift-box-front")),n.appendChild(this.#Nr("gift-box-lid"));const i=this.#Nr("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.#oi=t,this.#Tr=n,t}updateTiles(e){if(!this.#v&&this.#Tr)try{e.slice(0,3).forEach((e,t)=>{const n=xl[t];if(!n)return;const i=this.#Tr?.querySelector(`.${On(`gift-tile--${n}`)}`),r=i?.querySelector(`.${On("gift-tile-inner")}`);r instanceof HTMLElement&&(r.textContent="",this.#Ur(r,e))})}catch(e){u.debug("Gift hero could not refresh its tiles",e)}}#Nr(e){const t=document.createElement("div");return t.className=On(e),t}#Mr(e,t){const n=document.createElement("div");n.className=`${On("gift-tile")} ${On(`gift-tile--${t}`)}`;const i=document.createElement("div");return i.className=On("gift-tile-inner"),this.#Ur(i,e),n.appendChild(i),n}#Ur(e,t){const n=ha(t)??"",i=qe(t.logoUrl);if(!i)return void e.appendChild(this.#Rr(n));const r=document.createElement("img");r.className=On("gift-tile-image"),r.alt="",r.setAttribute("aria-hidden","true"),Ht(r,i,Pt),r.onerror=()=>{e.contains(r)&&(r.remove(),e.appendChild(this.#Rr(n)))},e.appendChild(r)}#Rr(e){const t=document.createElement("span");return t.className=On("gift-tile-monogram"),t.setAttribute("aria-hidden","true"),t.textContent=(Array.from(e)[0]??"★").toUpperCase(),t}play(){if(!this.#v&&!this.#Or){try{this.#jt=requestAnimationFrame(()=>{this.#jt=null,this.#Fr()})}catch(e){u.debug("Gift hero could not schedule a frame — falling back to the timer",e)}try{this.#Lr=setTimeout(()=>{this.#Lr=null,this.#Fr()},120)}catch(e){u.debug("Gift hero could not schedule its fallback — opening now",e),this.#Fr()}}}#Fr(){if(!this.#v&&!this.#Or){this.#Or=!0,this.#Pr();try{this.#zr()}catch(e){u.debug("Gift hero animation unavailable — rendering the box open",e)}}}#Pr(){null!==this.#Lr&&(clearTimeout(this.#Lr),this.#Lr=null)}#zr(){const e=this.#oi;if(!e)return;e.classList.add(On("gift-hero--play"));const t=new es;this.#Ar=t,t.start(e,{origin:this.#jr()})}#jr(){const e=this.#Tr,t=this.#oi,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.#v=!0,null!==this.#jt&&(cancelAnimationFrame(this.#jt),this.#jt=null),this.#Pr(),this.#Ar?.destroy(),this.#Ar=null,this.#oi?.remove(),this.#oi=null,this.#Tr=null}}function $l(){try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function Cl(e,t){const n=document.createElement("span");n.className=On(t),n.setAttribute("aria-hidden","true");const i=ha(e)??"",r=qe(e.logoUrl);if(!r)return n.textContent=(Array.from(i)[0]??"★").toUpperCase(),n;const o=document.createElement("img");return o.alt="",Ht(o,r,Pt,!1),o.onerror=()=>{o.remove(),n.textContent=(Array.from(i)[0]??"★").toUpperCase()},n.appendChild(o),n}let Il=0;class Sl{#ve;#Dr=null;#Br=null;#Hr=null;#v=!1;#_r=null;#ot=null;#Vr=null;#zr=!1;#ki;#qr=null;#Wr=null;#Kr=[];#Gr=void 0;#Yr=null;#Zr=!0;#Qr=On("gift-sheet-"+ ++Il);constructor(e){this.#ve=e,this.#ki=e.impressions?new _s(e.impressions):null}render(){const{signal:e}=this.#ve,t=document.createElement("div");t.className=On("gift-sheet-layer"),this.#ve.layerClass&&t.classList.add(On(this.#ve.layerClass));const n=document.createElement("div");n.className=On("gift-scrim"),n.addEventListener("click",()=>{this.#Zr&&this.close()},{signal:e}),this.#Br=n,t.appendChild(n);const i=document.createElement("div");i.className=On("gift-sheet"),i.setAttribute("role","group");const r=this.#ve.title??ua.sheetTitle;i.setAttribute("aria-label",r),i.hidden=!0,this.#Dr=i;const o=document.createElement("div");o.className=On("gift-sheet-header");const s=document.createElement("button");s.type="button",s.className=On("gift-sheet-close"),s.setAttribute("aria-label",this.#ve.closeLabel??ua.closeSheetLabel),s.textContent="×",s.addEventListener("click",()=>this.#Xr(),{signal:e}),o.appendChild(s);const a=document.createElement("h3");if(a.className=On("gift-sheet-title"),a.textContent=r,o.appendChild(a),i.appendChild(o),this.#ve.subtitle){const e=document.createElement("p");e.className=On("gift-sheet-subtitle"),e.textContent=this.#ve.subtitle,i.appendChild(e)}const l=document.createElement("div");l.className=On("gift-sheet-list"),l.setAttribute("role","radiogroup"),l.setAttribute("aria-label",r),this.#Hr=l,i.appendChild(l);const c=document.createElement("button");c.type="button",c.className=`${On("reward-cta-primary")} ${On("gift-sheet-cta")}`,c.textContent=ua.sheetContinue,c.disabled=!0,c.setAttribute("aria-disabled","true"),c.addEventListener("click",()=>this.#Jr(),{signal:e}),i.appendChild(c);const d=this.#ve.footer();return d&&i.appendChild(d),i.addEventListener("keydown",e=>{if("Escape"===e.key)return e.preventDefault(),e.stopPropagation(),void this.#Xr();"Tab"===e.key&&(e.preventDefault(),e.stopPropagation(),this.#eo(e.shiftKey))},{signal:e}),t.appendChild(i),this.renderList(),t}#eo(e){const t=this.#Dr;if(!t)return;const n=Array.from(t.querySelectorAll(Nn)).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.#Hr&&(this.#Yr=null,this.#to(),this.#no())}#io(){const e=this.#ve.listed();return 0===this.#Kr.length?[...e]:e.filter(e=>Zs(this.#ve.offers[e])===this.#Gr)}#no(){const e=this.#Hr;if(!e)return;e.textContent="";const t=this.#io();for(const n of t){const t=this.#ve.offers[n];t&&e.appendChild(this.#ro(t,n))}const n=this.#Yr;null!==n&&t.includes(n)?this.#oo(n):(this.#Yr=null,this.#so()),this.#qi()}#qi(){const e=this.#ki;if(!e)return;e.clear();const t=this.#Hr;if(this.#zr&&t)for(const n of Array.from(t.children)){const t=Number(n.dataset.offerIndex),i=this.#ve.offers[t];i&&e.register(n,i.id,()=>this.#ve.onShown?.(t))}}#to(){const e=this.#Dr,t=this.#Hr;if(!e||!t)return;const{offers:n,listed:i}=this.#ve,r=!1===this.#ve.tabs?[]:function(e){const t=new Map;for(const n of e){const e=Zs(n);t.set(e,(t.get(e)??0)+1)}let n=0;for(const e of t.values())e>=2&&(n+=1);return n<2?[]:qs.filter(e=>t.has(e))}(i().map(e=>n[e]));if(this.#Kr=r,0===r.length)return this.#qr?.remove(),this.#qr=null,void(this.#Wr&&(this.#Wr.replaceWith(t),this.#Wr=null));const o=this.#Gr;if(void 0!==o&&r.includes(o)||(this.#Gr=r[0]),!this.#Wr){const e=document.createElement("div");e.className=On("gift-sheet-panel"),e.id=`${this.#Qr}-panel`,e.setAttribute("role","tabpanel"),t.replaceWith(e),e.appendChild(t),this.#Wr=e}if(!this.#qr){const e=document.createElement("div");e.className=On("gift-sheet-tabs"),e.setAttribute("role","tablist"),e.setAttribute("aria-label",ua.sheetCategoriesLabel),this.#Wr.before(e),this.#qr=e}const s=this.#qr;s.textContent="",r.forEach((e,t)=>{s.appendChild(this.#ao(e,t))}),this.#lo()}#ao(e,t){const{signal:n}=this.#ve,i=document.createElement("button");return i.type="button",i.className=On("gift-sheet-tab"),i.id=`${this.#Qr}-tab-${t}`,i.setAttribute("role","tab"),i.setAttribute("aria-controls",`${this.#Qr}-panel`),i.textContent=Qs(e,this.#ve.offers.find(t=>t.categoryGroupDisplayName&&t.categoryGroup===e)?.categoryGroupDisplayName),i.addEventListener("click",()=>this.#co(e),{signal:n}),i.addEventListener("keydown",e=>this.#do(e,t),{signal:n}),i}#lo(){const e=Array.from(this.#qr?.children??[]),t=this.#Gr,n=void 0===t?-1:this.#Kr.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.#Wr?.setAttribute("aria-labelledby",e.id)})}#co(e){this.#Kr.includes(e)&&e!==this.#Gr&&(this.#Gr=e,this.#lo(),this.#no())}#do(e,t){const n=this.#Kr.length;if(0===n)return;let i;switch(Ue(e.key,e.currentTarget)){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.#Kr[i];if(void 0===r)return;this.#co(r);const o=this.#qr?.children[i];o instanceof HTMLElement&&o.focus()}#so(){this.#ve.onPick?.(null);const e=this.#uo();e&&(e.textContent=ua.sheetContinue,e.hidden=!1,e.disabled=!0,e.setAttribute("aria-disabled","true"))}#ro(e,t){const{signal:n}=this.#ve,i=document.createElement("button");if(i.type="button",i.className=On("gift-card"),i.setAttribute("role","radio"),i.setAttribute("aria-checked","false"),i.setAttribute("aria-label",(this.#ve.cardLabel??ya)(e)),i.dataset.offerIndex=String(t),i.tabIndex=0===this.#Hr?.childElementCount?0:-1,this.#ve.cardBody)this.#ve.cardBody(i,e);else{i.appendChild(Cl(e,"gift-card-icon"));const t=document.createElement("span");t.className=On("gift-card-label"),xa(t,fa(e).primary,On("gift-em")),i.appendChild(t)}return i.addEventListener("click",()=>this.#oo(t),{signal:n}),i.addEventListener("keydown",e=>this.#ho(e,i),{signal:n}),i}#ho(e,t){const n=Array.from(this.#Hr?.children??[]).filter(e=>e instanceof HTMLElement);if(0===n.length)return;const i=n.indexOf(t);let r=null;switch(Ue(e.key,e.currentTarget)){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.#oo(s),o.focus()}pick(e){this.#io().includes(e)&&this.#oo(e)}#Xr(){this.#ve.onClose?this.#ve.onClose():this.close()}#oo(e){const t=this.#Hr;if(!t||!this.#Zr)return;this.#Yr=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.#ve.offers[e];this.#ve.onPick?.(n??null);const i=this.#uo();i&&n&&(i.textContent=(this.#ve.ctaLabel??ga)(n),i.hidden=!!this.#ve.ctaFor&&!this.#ve.ctaFor(n),!1!==this.#ve.claimEnabled&&(i.disabled=!1,i.removeAttribute("aria-disabled")))}#uo(){const e=this.#Dr?.querySelector(`.${On("gift-sheet-cta")}`);return e instanceof HTMLButtonElement?e:null}#Jr(){if(!this.#Zr)return;const e=this.#Hr?.querySelector('[aria-checked="true"]');if(!(e instanceof HTMLElement))return;const t=Number(e.dataset.offerIndex);Number.isInteger(t)&&this.#ve.onCommit(t)}open(e){const t=this.#Dr;if(!t||this.#v)return;this.#kt(),this.#_r=e??null,t.hidden=!1,t.removeAttribute("aria-hidden"),this.#Br?.classList.add(On("gift-scrim--open")),t.classList.add(On("gift-sheet--open")),this.#zr=!0,this.#qi(),this.#po(),this.#Vr=setTimeout(()=>{this.#Vr=null,this.#v||this.#ve.impressions?.recheck()},300);const n=this.#Hr,i=n?.querySelector('[aria-checked="true"]')??n?.firstElementChild;i instanceof HTMLElement&&i.focus()}setInteractive(e){this.#Zr=e;const t=this.#Dr;if(!t)return;const n=t.querySelector(`.${On("gift-sheet-close")}`);for(const i of Array.from(t.querySelectorAll("button")))i!==n&&(e?"true"!==i.getAttribute("aria-disabled")&&(i.disabled=!1):i.disabled=!0)}isOpen(){return this.#zr}close(){const e=this.#Dr;if(e&&!e.hidden){this.#zr=!1,this.#ki?.clear(),this.#po(),e.classList.remove(On("gift-sheet--open")),this.#Br?.classList.remove(On("gift-scrim--open")),e.setAttribute("aria-hidden","true"),this.#_r?.focus(),this.#_r=null;try{this.#ve.onClosed?.()}catch{}this.#kt(),$l()?e.hidden=!0:this.#ot=setTimeout(()=>{this.#ot=null,this.#v||(e.hidden=!0)},300)}}#kt(){null!==this.#ot&&(clearTimeout(this.#ot),this.#ot=null)}#po(){null!==this.#Vr&&(clearTimeout(this.#Vr),this.#Vr=null)}destroy(){this.#v=!0,this.#zr=!1,this.#ki?.clear(),this.#po(),this.#kt(),this.#Dr=null,this.#Br=null,this.#Hr=null,this.#qr=null,this.#Wr=null,this.#_r=null}}const El=e=>void 0!==e;class Tl{#kn;#ve;#$n=new Ut;#fo=new kl;#In=null;#mo=null;#dt=null;#v=!1;#go=new AbortController;#yo;#Sn=0;#wn;#Ln;#bo;constructor(e,t={}){this.#kn=e,this.#ve=t,this.#Ln=void 0===t.impressions,this.#wn=t.impressions??new Hs,this.#bo=new _s(this.#wn),this.#yo=e.slice(0,3).map((e,t)=>t)}on(e,t){return this.#$n.on(e,t)}getTotalOffers(){return this.#kn.length}getCurrentIndex(){return this.#Sn}getSelectedOffer(){return this.#kn[this.#Sn]}hasMoreGifts(){return this.#kn.length>this.#yo.length}renderHero(){return this.#fo.render(this.#yo.map(e=>this.#kn[e]).filter(El))}render(){const e=document.createElement("div");e.className=On("gift"),this.#In=e;const t=document.createElement("div");return t.className=On("gift-rows"),t.setAttribute("role","radiogroup"),t.setAttribute("aria-label",ua.chooseLabel),this.#mo=t,e.appendChild(t),this.#vo(!0),this.hasMoreGifts()&&e.appendChild(this.#wo()),this.#xo(),this.#fo.play(),e}#vo(e=!1){const t=this.#mo;t&&(t.textContent="",this.#bo.clear(),this.#yo.forEach((n,i)=>{const r=this.#kn[n];if(!r)return;const o=this.#ko(r,n,i,e);t.appendChild(o),this.#$o(o,n)}))}#ko(e,t,n,i=!1){const r=document.createElement("button");r.type="button",r.className=i?`${On("gift-row")} ${On("gift-row--intro")}`:On("gift-row"),r.setAttribute("role","radio");const o=t===this.#Sn;r.setAttribute("aria-checked",String(o)),r.tabIndex=o?0:-1,r.setAttribute("aria-label",ya(e)),r.dataset.offerIndex=String(t),r.appendChild(Cl(e,"gift-row-icon"));const s=document.createElement("span");s.className=On("gift-row-text");const{primary:a,secondary:l}=fa(e),c=document.createElement("span");if(c.className=On("gift-row-primary"),xa(c,a,On("gift-em")),s.appendChild(c),l){const e=document.createElement("small");e.className=On("gift-row-secondary"),e.textContent=l,s.appendChild(e)}r.appendChild(s);const d=document.createElement("span");return d.className=On("gift-row-radio"),d.setAttribute("aria-hidden","true"),r.appendChild(d),r.addEventListener("click",()=>this.selectOffer(t),{signal:this.#go.signal}),r.addEventListener("keydown",e=>this.#Co(e,n),{signal:this.#go.signal}),r}#Co(e,t){const n=this.#yo.length;if(0===n)return;let i=null;switch(Ue(e.key,e.currentTarget)){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.#yo[i];void 0!==r&&(this.selectOffer(r),this.#Io(i))}#Io(e){const t=this.#mo?.children[e];t instanceof HTMLElement&&t.focus()}selectOffer(e){!Number.isInteger(e)||e<0||e>=this.#kn.length?u.warn("Gift selection ignored — index out of range",{index:e}):e===this.#Sn&&this.#yo.includes(e)||(this.#yo.includes(e)||this.#So(e),this.#Sn=e,this.#Eo(),this.#xo())}next(){0!==this.#kn.length&&this.selectOffer((this.#Sn+1)%this.#kn.length)}#So(e){this.#yo.length<3?this.#yo.push(e):this.#yo[this.#yo.length-1]=e,this.#vo(),this.#dt?.renderList(),this.#fo.updateTiles(this.#yo.map(e=>this.#kn[e]).filter(El))}#Eo(){const e=this.#mo?.children;e&&this.#yo.forEach((t,n)=>{const i=e[n];if(!(i instanceof HTMLElement))return;const r=t===this.#Sn;i.setAttribute("aria-checked",String(r)),i.tabIndex=r?0:-1})}#xo(){const e=this.getSelectedOffer();e&&this.#$n.emit("offerSelect",{offer:e,index:this.#Sn})}#$o(e,t){const n=this.#kn[t];n&&this.#bo.register(e,n.id,()=>this.#To(t))}#To(e){const t=this.#kn[e];t&&this.#$n.emit("offerView",{offer:t,index:e})}claimSelected(){if(!1===this.#ve.claimEnabled)return void u.warn("Claim requested while claiming is disabled — ignoring");const e=this.getSelectedOffer();e?this.#$n.emit("offerClaim",{offer:e,index:this.#Sn}):u.warn("Claim requested with no selected gift — ignoring")}#wo(){const e=new Sl({offers:this.#kn,listed:()=>this.#kn.map((e,t)=>t).filter(e=>!this.#yo.includes(e)),claimEnabled:!1!==this.#ve.claimEnabled,footer:()=>{const e=I(this.#ve.trustText)??sl.trustUnknown,t=document.createElement("p");return t.className=On("gift-sheet-fine"),t.textContent=e,t},onCommit:e=>{this.selectOffer(e),this.closeSheet(),this.claimSelected()},impressions:this.#wn,onShown:e=>this.#To(e),signal:this.#go.signal});return this.#dt=e,e.render()}openSheet(e){this.#v||this.#dt?.open(e)}closeSheet(){this.#dt?.close()}destroy(){this.#v=!0,this.#dt?.destroy(),this.#bo.clear(),this.#Ln&&this.#wn.destroy(),this.#go.abort(),this.#fo.destroy(),this.#$n.removeAllListeners(),this.#In?.remove(),this.#In=null,this.#mo=null,this.#dt=null}}const Al=["t2","t1","t3"];class Ll{#oi=null;#Ao=null;#v=!1;render(e,t={}){const n=document.createElement("div");n.className=On("gift-picker-hero");const i=this.#Lo(t);i&&n.appendChild(i);const r=document.createElement("div");r.className=e.length<=1?`${On("gift-picker-fan")} ${On("gift-picker-fan--solo")}`:On("gift-picker-fan"),r.setAttribute("aria-hidden","true");const o=document.createElement("div");return o.className=On("gift-picker-fan-confetti"),o.innerHTML='<svg viewBox="0 0 240 104" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><circle cx="24" cy="20" r="3" fill="#F5B93D"/><circle cx="118" cy="4" r="3" fill="#F5B93D"/><circle cx="30" cy="80" r="2.5" fill="currentColor"/><circle cx="73" cy="90" r="2.5" fill="#DE446A"/><circle cx="203" cy="32" r="3" fill="#DE446A"/><circle cx="194" cy="87" r="3" fill="#86C85C"/></svg>',r.appendChild(o),e.slice(0,3).forEach((e,t)=>{const n=Al[t];n&&r.appendChild(this.#Mr(e,n))}),n.appendChild(r),this.#oi=n,this.#Ao=r,n}updateTiles(e){if(!this.#v&&this.#Ao)try{e.slice(0,3).forEach((e,t)=>{const n=Al[t];if(!n)return;const i=this.#Ao?.querySelector(`.${On(`gift-picker-tile--${n}`)} .${On("gift-picker-tile-inner")}`);i instanceof HTMLElement&&(i.textContent="",this.#Ur(i,e))})}catch(e){u.debug("Gift hero could not refresh its tiles",e)}}#Lo({name:e,iconUrl:t}){const n=I(e);if(!n)return;const i=document.createElement("div");i.className=On("gift-picker-host");const r=qe(t);if(r){const e=document.createElement("img");e.className=On("gift-picker-host-icon"),e.alt="",Ht(e,r,Pt),e.onerror=()=>e.remove(),i.appendChild(e)}const o=document.createElement("span");return o.className=On("gift-picker-host-name"),o.textContent=n,i.appendChild(o),i}#Mr(e,t){const n=document.createElement("div");n.className=`${On("gift-picker-tile")} ${On(`gift-picker-tile--${t}`)}`;const i=document.createElement("div");return i.className=On("gift-picker-tile-inner"),this.#Ur(i,e),n.appendChild(i),n}#Ur(e,t){const n=ha(t)??"",i=qe(t.logoUrl);if(!i)return void e.appendChild(this.#Rr(n));const r=document.createElement("img");r.className=On("gift-picker-tile-image"),r.alt="",Ht(r,i,Pt),r.onerror=()=>{e.contains(r)&&(r.remove(),e.appendChild(this.#Rr(n)))},e.appendChild(r)}#Rr(e){const t=document.createElement("span");return t.className=On("gift-picker-tile-monogram"),t.textContent=(Array.from(e)[0]??"★").toUpperCase(),t}destroy(){this.#v=!0,this.#oi?.remove(),this.#oi=null,this.#Ao=null}}const Ol=e=>void 0!==e;class Nl{#kn;#ve;#$n=new Ut;#fo=new Ll;#In=null;#mo=null;#dt=null;#v=!1;#go=new AbortController;#yo;#Sn=0;#wn;#Ln;#bo;constructor(e,t={}){this.#kn=e,this.#ve=t,this.#Ln=void 0===t.impressions,this.#wn=t.impressions??new Hs,this.#bo=new _s(this.#wn),this.#yo=e.slice(0,3).map((e,t)=>t)}on(e,t){return this.#$n.on(e,t)}getTotalOffers(){return this.#kn.length}getCurrentIndex(){return this.#Sn}getSelectedOffer(){return this.#kn[this.#Sn]}hasMoreGifts(){return this.#kn.length>this.#yo.length}renderHero(){return this.#fo.render(this.#yo.map(e=>this.#kn[e]).filter(Ol),{...void 0!==this.#ve.hostName&&{name:this.#ve.hostName},...void 0!==this.#ve.hostIconUrl&&{iconUrl:this.#ve.hostIconUrl}})}render(){const e=document.createElement("div");e.className=On("gift-picker"),this.#In=e;const t=document.createElement("div");if(t.className=On("gift-picker-rows"),t.setAttribute("role","radiogroup"),t.setAttribute("aria-label",ua.chooseLabel),this.#mo=t,e.appendChild(t),this.#vo(),this.hasMoreGifts()){const t=document.createElement("button");t.type="button",t.className=On("gift-picker-more"),t.textContent=ua.moreGifts,t.addEventListener("click",()=>this.openSheet(t),{signal:this.#go.signal}),e.appendChild(t),e.appendChild(this.#wo())}return this.#xo(),e}#vo(){const e=this.#mo;e&&(e.textContent="",this.#bo.clear(),this.#yo.forEach((t,n)=>{const i=this.#kn[t];if(!i)return;const r=this.#ko(i,t,n);e.appendChild(r),this.#$o(r,t)}))}#ko(e,t,n){const i=document.createElement("button");i.type="button",i.className=On("gift-picker-row"),i.setAttribute("role","radio");const r=t===this.#Sn;i.setAttribute("aria-checked",String(r)),i.tabIndex=r?0:-1,i.setAttribute("aria-label",ba(e)),i.dataset.offerIndex=String(t),i.appendChild(Cl(e,"gift-picker-row-icon"));const o=document.createElement("span");o.className=On("gift-picker-row-text");const{brand:s,perk:a}=ma(e),l=document.createElement("span");if(l.className=On("gift-picker-row-primary"),l.textContent=s,o.appendChild(l),a){const e=document.createElement("small");e.className=`${On("gift-picker-row-secondary")} ${On("gift-picker-row-perk")}`,e.textContent=a,o.appendChild(e)}i.appendChild(o);const c=document.createElement("span");return c.className=On("gift-picker-row-radio"),c.setAttribute("aria-hidden","true"),i.appendChild(c),i.addEventListener("click",()=>this.selectOffer(t),{signal:this.#go.signal}),i.addEventListener("keydown",e=>this.#Co(e,n),{signal:this.#go.signal}),i}#Co(e,t){const n=this.#yo.length;if(0===n)return;let i=null;switch(Ue(e.key,e.currentTarget)){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.#yo[i];void 0!==r&&(this.selectOffer(r),this.#Io(i))}#Io(e){const t=this.#mo?.children[e];t instanceof HTMLElement&&t.focus()}selectOffer(e){!Number.isInteger(e)||e<0||e>=this.#kn.length?u.warn("Gift selection ignored — index out of range",{index:e}):e===this.#Sn&&this.#yo.includes(e)||(this.#yo.includes(e)||this.#So(e),this.#Sn=e,this.#Eo(),this.#xo())}next(){0!==this.#kn.length&&this.selectOffer((this.#Sn+1)%this.#kn.length)}#So(e){this.#yo.length<3?this.#yo.push(e):this.#yo[this.#yo.length-1]=e,this.#vo(),this.#dt?.renderList(),this.#fo.updateTiles(this.#yo.map(e=>this.#kn[e]).filter(Ol))}#Eo(){const e=this.#mo?.children;e&&this.#yo.forEach((t,n)=>{const i=e[n];if(!(i instanceof HTMLElement))return;const r=t===this.#Sn;i.setAttribute("aria-checked",String(r)),i.tabIndex=r?0:-1})}#xo(){const e=this.getSelectedOffer();e&&this.#$n.emit("offerSelect",{offer:e,index:this.#Sn})}#$o(e,t){const n=this.#kn[t];n&&this.#bo.register(e,n.id,()=>this.#To(t))}#To(e){const t=this.#kn[e];t&&this.#$n.emit("offerView",{offer:t,index:e})}claimSelected(){if(!1===this.#ve.claimEnabled)return void u.warn("Claim requested while claiming is disabled — ignoring");const e=this.getSelectedOffer();e?this.#$n.emit("offerClaim",{offer:e,index:this.#Sn}):u.warn("Claim requested with no selected gift — ignoring")}#wo(){const e=new Sl({offers:this.#kn,listed:()=>this.#kn.map((e,t)=>t).filter(e=>!this.#yo.includes(e)),claimEnabled:!1!==this.#ve.claimEnabled,footer:()=>{const e=I(this.#ve.trustText)??sl.trustUnknown,t=document.createElement("p");return t.className=On("gift-sheet-fine"),t.textContent=e,t},onCommit:e=>{this.selectOffer(e),this.closeSheet(),this.claimSelected()},impressions:this.#wn,onShown:e=>this.#To(e),signal:this.#go.signal});return this.#dt=e,e.render()}openSheet(e){this.#v||this.#dt?.open(e)}closeSheet(){this.#dt?.close()}destroy(){this.#v=!0,this.#dt?.destroy(),this.#bo.clear(),this.#Ln&&this.#wn.destroy(),this.#go.abort(),this.#fo.destroy(),this.#$n.removeAllListeners(),this.#In?.remove(),this.#In=null,this.#mo=null,this.#dt=null}}function Ml(e={}){const t=document.createElement("p");return t.className=On("gift-terms"),t.append(...Ae(e.template??ua.termsLine,{link:Rl(e)})),t}function Ul(e,t){const n=e.querySelector(`.${On("gift-terms-link")}`),i=n?.textContent??void 0,r=Rl({...void 0!==t&&{termsUrl:t},...i&&{linkText:i}});n?n.replaceWith(r):e.appendChild(r)}function Rl({onOpen:e,termsUrl:t,linkText:n}){const i=qe(t);let r;if(i){const e=document.createElement("a");e.href=i,e.target="_blank",e.rel="noopener noreferrer",r=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)}}),r=t}else r=document.createElement("span");return r.className=On("gift-terms-link"),r.textContent=n??ua.termsLink,r}let Fl=0;const Pl=(e,t)=>!!e&&!!t&&e.toLowerCase()===t.toLowerCase();class zl{#kn;#ve;#$n=new Ut;#go=new AbortController;#In=null;#Oo=null;#mo=null;#dt=null;#v=!1;#yo;#Sn=0;#wn;#Ln;#bo;#No=void 0;#Mo=null;#Uo=new Set;#Ro=new Set;constructor(e,t={}){this.#kn=e,this.#ve=t,this.#Ln=void 0===t.impressions,this.#wn=t.impressions??new Hs,this.#bo=new _s(this.#wn),this.#yo=e.slice(0,3).map((e,t)=>t)}on(e,t){return this.#$n.on(e,t)}getTotalOffers(){return this.#kn.length}getCurrentIndex(){return this.#Sn}getSelectedOffer(){return this.#kn[this.#Sn]}hasMoreGifts(){return this.#kn.length>this.#yo.length}renderHero(){try{const e=qe(this.#ve.hostIconUrl);if(!e)return;const t=document.createElement("div");t.className=On("gift-list-presents");const n=document.createElement("img");n.className=On("gift-list-presents-icon"),n.alt=I(this.#ve.hostName)??"",Ht(n,e,Pt),n.onerror=()=>t.remove();const i=ua.presents,r=i.includes("${logo}")?i:`\${logo} ${i}`,o=e=>{const t=document.createElement("span");return t.textContent=e.trim(),t};return t.append(...Ae(r,{logo:n},void 0,o).filter(e=>e===n||""!==e.textContent)),t}catch(e){return void u.error("Gift list presents row failed to render",e)}}render(){const e=document.createElement("div");e.className=On("gift-list"),this.#In=e;const t=document.createElement("div");t.className=On("gift-list-art"),t.setAttribute("aria-hidden","true"),t.hidden=!0,this.#Oo=t,e.appendChild(t);const n=document.createElement("div");if(n.className=On("gift-list-rows"),n.setAttribute("role","radiogroup"),n.setAttribute("aria-label",ua.chooseLabel),this.#mo=n,e.appendChild(n),this.#vo(!0),this.#Fo(!0),this.hasMoreGifts()){const t=document.createElement("button");t.type="button",t.className=On("gift-list-more"),t.textContent=ua.showMore,t.addEventListener("click",()=>this.openSheet(t),{signal:this.#go.signal}),e.appendChild(t),e.appendChild(this.#wo())}return this.#xo(),e}#vo(e=!1){const t=this.#mo;t&&(t.textContent="",this.#bo.clear(),this.#yo.forEach((n,i)=>{const r=this.#kn[n];if(!r)return;const o=this.#ko(r,n,i,e);t.appendChild(o),this.#$o(o,n)}))}#ko(e,t,n,i){const r=document.createElement("button");r.type="button",r.className=i?`${On("gift-list-row")} ${On("gift-list-row--intro")}`:On("gift-list-row"),r.setAttribute("role","radio");const o=t===this.#Sn;r.setAttribute("aria-checked",String(o)),r.tabIndex=o?0:-1,r.setAttribute("aria-label",ba(e)),r.dataset.offerIndex=String(t),r.appendChild(Cl(e,"gift-list-logo"));const{brand:s,perk:a}=ma(e),l=document.createElement("span");l.className=On("gift-list-text");const c=document.createElement("span");if(c.className=On("gift-list-name"),c.textContent=s,l.appendChild(c),a){const e=document.createElement("span");e.className=On("gift-list-perk"),Ca(e,a,On("gift-list-em")),l.appendChild(e)}r.appendChild(l);const d=document.createElement("span");d.className=On("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 u=I(e.description);if(u&&!Pl(u,a)&&!Pl(u,s)){const e=document.createElement("span");e.className=On("gift-list-desc"),Fl+=1,e.id=On(`gift-list-desc-${Fl}`),e.textContent=u,e.hidden=!o,r.appendChild(e),o&&r.setAttribute("aria-describedby",e.id)}return r.addEventListener("click",()=>this.selectOffer(t),{signal:this.#go.signal}),r.addEventListener("keydown",e=>this.#Co(e,n),{signal:this.#go.signal}),r}#Co(e,t){const n=this.#yo.length;if(0===n)return;let i=null;switch(Ue(e.key,e.currentTarget)){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.#yo[i];if(void 0===r)return;this.selectOffer(r);const o=this.#mo?.children[i];o instanceof HTMLElement&&o.focus()}selectOffer(e){this.#v||(!Number.isInteger(e)||e<0||e>=this.#kn.length?u.warn("Gift selection ignored — index out of range",{index:e}):e===this.#Sn&&this.#yo.includes(e)||(this.#yo.includes(e)||this.#So(e),this.#Sn=e,this.#Eo(),this.#Fo(!1),this.#xo()))}next(){0!==this.#kn.length&&this.selectOffer((this.#Sn+1)%this.#kn.length)}#So(e){this.#yo.length<3?this.#yo.push(e):this.#yo[this.#yo.length-1]=e,this.#vo(),this.#dt?.renderList()}#Eo(){const e=this.#mo?.children;e&&this.#yo.forEach((t,n)=>{const i=e[n];if(!(i instanceof HTMLElement))return;const r=t===this.#Sn;i.setAttribute("aria-checked",String(r)),i.tabIndex=r?0:-1;const o=i.querySelector(`.${On("gift-list-desc")}`);o&&(o.hidden=!r,r?i.setAttribute("aria-describedby",o.id):i.removeAttribute("aria-describedby"))})}#xo(){const e=this.getSelectedOffer();e&&this.#$n.emit("offerSelect",{offer:e,index:this.#Sn})}#$o(e,t){const n=this.#kn[t];n&&this.#bo.register(e,n.id,()=>this.#To(t))}#To(e){const t=this.#kn[e];t&&this.#$n.emit("offerView",{offer:t,index:e})}claimSelected(){if(!1===this.#ve.claimEnabled)return void u.warn("Claim requested while claiming is disabled — ignoring");const e=this.getSelectedOffer();e?this.#$n.emit("offerClaim",{offer:e,index:this.#Sn}):u.warn("Claim requested with no selected gift — ignoring")}#Po(e){if(!e)return null;for(const t of[e.heroImageUrl,e.imageUrl]){const e=qe(t);if(e&&!this.#Uo.has(e))return{kind:"image",src:e}}const t=qe(e.logoUrl);return t&&!this.#Uo.has(t)?{kind:"logo",src:t}:null}#Fo(e){const t=this.#Oo;if(t)try{const n=this.#Po(this.getSelectedOffer()),i=n?`${n.kind}:${n.src}`:null;if(i===this.#No)return;if(this.#No=i,this.#zo(t),!n)return void(t.querySelector(`.${On("gift-list-art-layer--out")}`)||(t.hidden=!0));t.hidden=!1;const r=document.createElement("span");r.className=`${On("gift-list-art-layer")} ${On(e?"gift-list-art-layer--intro":"gift-list-art-layer--in")}`;const o=document.createElement("img");if(o.alt="",Ht(o,n.src,"image"===n.kind?252:Pt),o.onerror=()=>{this.#Uo.add(n.src),this.#No===i&&(this.#No=void 0,this.#Fo(!1))},"image"===n.kind)o.className=On("gift-list-art-image"),r.appendChild(o);else{const e=document.createElement("span");e.className=On("gift-list-art-logo"),e.appendChild(o),r.appendChild(e)}t.appendChild(r)}catch(e){u.error("Gift list artwork failed to render",e)}}#zo(e){const t=Array.from(e.children).filter(e=>e instanceof HTMLElement&&!e.classList.contains(On("gift-list-art-layer--out")));if(0!==t.length)if($l())for(const e of t)e.remove();else for(const n of t){n.classList.remove(On("gift-list-art-layer--intro"),On("gift-list-art-layer--in")),n.classList.add(On("gift-list-art-layer--out"));const t=setTimeout(()=>{this.#Ro.delete(t),n.remove(),null===this.#No&&0===e.childElementCount&&(e.hidden=!0)},200);this.#Ro.add(t)}}#wo(){const e=new Sl({offers:this.#kn,listed:()=>this.#kn.map((e,t)=>t).filter(e=>!this.#yo.includes(e)),claimEnabled:!1!==this.#ve.claimEnabled,footer:()=>(this.#Mo=Ml(),this.#Mo),onPick:e=>{this.#Mo&&Ul(this.#Mo,e?.termsUrl)},onCommit:e=>{this.selectOffer(e),this.closeSheet(),this.claimSelected()},impressions:this.#wn,onShown:e=>this.#To(e),signal:this.#go.signal});return this.#dt=e,e.render()}openSheet(e){this.#v||this.#dt?.open(e)}closeSheet(){this.#dt?.close()}destroy(){this.#v=!0,this.#dt?.destroy(),this.#bo.clear(),this.#Ln&&this.#wn.destroy(),this.#go.abort();for(const e of this.#Ro)clearTimeout(e);this.#Ro.clear(),this.#$n.removeAllListeners(),this.#In?.remove(),this.#In=null,this.#Oo=null,this.#mo=null,this.#dt=null}}const jl=Le("unwrap",{sheetTitle:"More gifts",closeSheetLabel:"Close more gifts",continue:"Continue",back:"Back",readyTitle:"Your gift is ready"}),Dl=Le("share",{panelTitle:"Keep your gift for later",panelSubtitle:"Choose any offer below.\nShare the link to pick it later.",panelCloseLabel:"Close",copied:"Link copied",unavailable:"Couldn’t share the link"});function Bl(e){const t=e?ha(e):void 0;return t?Ee("share.named","Share ${name}",{name:t}):Ee("share.gift","Share this gift")}let Hl=0;function _l(){return Hl+=1,`encore-unwrap-art-${Hl}`}const Vl='<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" overflow="visible" ';function ql(){const e=_l();return`${Vl}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 Wl=`${Vl}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>`,Kl=`${Vl}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>`,Gl=`${Vl}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>`,Yl=`${Vl}width="18" height="18" viewBox="0 0 24 24" fill="none"><path d="M13.5 4.75 20.75 11.5 13.5 18.25v-3.9c-4.6 0-7.7 1.3-10.25 4.4.75-5.35 3.9-8.85 10.25-9.7V4.75Z" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/></svg>`,Zl=On("unwrap-ready-title");class Ql{#kn;#ve;#$n=new Ut;#go=new AbortController;#In=null;#jo=null;#Do=null;#fo=null;#Bo=null;#mo=null;#dt=null;#Ho=null;#_o=null;#Vo=null;#qo=null;#Wo=null;#Ko=null;#Go=null;#Yo=null;#Zo=null;#Qo=null;#Xo=null;#yo;#Sn=0;#wn;#Ln;#bo;#Jo="pick";#es=null;#ts=null;#Ar=null;#ns=null;#is=null;#rs=!1;#v=!1;constructor(e,t={}){this.#kn=e,this.#ve=t,this.#Ln=void 0===t.impressions,this.#wn=t.impressions??new Hs,this.#bo=new _s(this.#wn),this.#yo=e.slice(0,3).map((e,t)=>t)}on(e,t){return this.#$n.on(e,t)}onShareEvent(e,t){return this.#$n.on(e,t)}getTotalOffers(){return this.#kn.length}getCurrentIndex(){return this.#Sn}getSelectedOffer(){return this.#kn[this.#Sn]}hasMoreGifts(){return this.#kn.length>this.#yo.length}getScreen(){return this.#Jo}renderHero(){const e=document.createElement("div");e.className=On("unwrap-hero"),e.setAttribute("aria-hidden","true");const t=document.createElement("div");return t.className=On("unwrap-hero-box"),t.innerHTML=ql(),e.appendChild(t),this.#fo=e,e}render(){const e=document.createElement("div");e.className=On("unwrap-body"),this.#Bo=e;const t=document.createElement("div");if(t.className=On("unwrap-rows"),t.setAttribute("role","radiogroup"),t.setAttribute("aria-label",ua.chooseLabel),this.#mo=t,e.appendChild(t),this.#vo(),this.hasMoreGifts()){const t=document.createElement("button");t.type="button",t.className=On("unwrap-more"),t.textContent=ua.showMore,t.addEventListener("click",()=>this.openSheet(t),{signal:this.#go.signal}),e.appendChild(t),e.appendChild(this.#wo())}return this.#xo(),e}compose(e,t={}){this.#es=t.setLabelledBy??null,this.#Xo=t.onScreenChange??null;const n=document.createElement("div");n.className=On("unwrap"),this.#In=n;const i=document.createElement("div");i.className=`${On("unwrap-screen")} ${On("unwrap-screen--pick")}`,i.appendChild(e),this.#jo=i,n.appendChild(i),n.appendChild(this.#os());const r=this.#ve.share;if("header"===r&&(n.prepend(this.#ss()),this.#as()),"forLater"===r&&n.appendChild(this.#ls()),r){const e=document.createElement("div");e.className=On("unwrap-notice"),e.setAttribute("role","status"),this.#Zo=e,n.appendChild(e)}return this.#cs(),n}#ss(){const e=document.createElement("button");return e.type="button",e.className=On("unwrap-share"),e.setAttribute("aria-label",Bl(this.getSelectedOffer())),e.innerHTML=Yl,e.addEventListener("click",()=>this.#ds(),{signal:this.#go.signal}),this.#Go=e,e}#as(){const e=this.#Go;e&&(e.hidden="ready"===this.#Jo||!Jl(this.getSelectedOffer()))}#ds(){const e=this.getSelectedOffer();e&&this.#$n.emit("offerShare",{offer:e,index:this.#Sn})}#ls(){const e=new Sl({offers:this.#kn,listed:()=>this.#us(),footer:()=>null,onCommit:e=>{this.selectOffer(e),this.#ds()},signal:this.#go.signal,title:Dl.panelTitle,subtitle:Dl.panelSubtitle,closeLabel:Dl.panelCloseLabel,onClose:()=>this.#$n.emit("closeRequest",void 0),layerClass:"keep-panel",cardBody:ec,cardLabel:ba,ctaLabel:Bl,ctaFor:Jl,tabs:!1,onClosed:()=>this.#hs()});return this.#Yo=e,e.render()}openKeepForLater(e){const t=this.#Yo;return!(!t||this.#v||"pick"!==this.#Jo||!this.#In?.isConnected||!this.#us().some(e=>Jl(this.#kn[e]))||(this.closeSheet(),t.renderList(),t.pick(this.#Sn),t.open(e),0))}isKeepForLaterOpen(){return this.#Yo?.isOpen()??!1}lockKeepForLater(){this.#Yo?.setInteractive(!1)}#us(){const e=this.#kn.slice(0,5).map((e,t)=>t),t=this.#Sn;return e.length>0&&!e.includes(t)&&(e[e.length-1]=t),e}showShareNotice(e){const t=this.#Zo;t&&!this.#v&&(t.textContent=e,t.classList.add(On("unwrap-notice--visible")),null!==this.#Qo&&clearTimeout(this.#Qo),this.#Qo=setTimeout(()=>{this.#Qo=null,t.classList.remove(On("unwrap-notice--visible")),t.textContent=""},1500))}#vo(){const e=this.#mo;e&&(e.textContent="",this.#bo.clear(),this.#yo.forEach((t,n)=>{const i=this.#kn[t];if(!i)return;const r=t===this.#Sn,o=document.createElement("button");o.type="button",o.className=On("unwrap-row"),o.setAttribute("role","radio"),o.setAttribute("aria-checked",String(r)),o.tabIndex=r?0:-1,o.setAttribute("aria-label",ba(i)),o.dataset.offerIndex=String(t),Xl(o,i),o.addEventListener("click",()=>this.selectOffer(t),{signal:this.#go.signal}),o.addEventListener("keydown",e=>this.#Co(e,n),{signal:this.#go.signal}),e.appendChild(o)}),this.#hs())}#hs(){if(this.#bo.clear(),this.#Yo?.isOpen())return;const e=this.#mo?.children;e&&this.#yo.forEach((t,n)=>{const i=e[n];i instanceof HTMLElement&&this.#$o(i,t)})}#Co(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}}(Ue(e.key,e.currentTarget),t,this.#yo.length);if(null===n)return;e.preventDefault();const i=this.#yo[n];if(void 0===i)return;this.selectOffer(i);const r=this.#mo?.children[n];r instanceof HTMLElement&&r.focus()}selectOffer(e){!Number.isInteger(e)||e<0||e>=this.#kn.length?u.warn("Gift selection ignored — index out of range",{index:e}):e===this.#Sn&&this.#yo.includes(e)||(this.#yo.includes(e)||this.#So(e),this.#Sn=e,this.#Eo(),this.#xo())}next(){0!==this.#kn.length&&this.selectOffer((this.#Sn+1)%this.#kn.length)}#So(e){this.#yo.length<3?this.#yo.push(e):this.#yo[this.#yo.length-1]=e,this.#vo(),this.#dt?.renderList()}#Eo(){const e=this.#mo?.children;e&&this.#yo.forEach((t,n)=>{const i=e[n];if(!(i instanceof HTMLElement))return;const r=t===this.#Sn;i.setAttribute("aria-checked",String(r)),i.tabIndex=r?0:-1})}#xo(){const e=this.getSelectedOffer();this.#Go?.setAttribute("aria-label",Bl(e)),this.#as(),e&&this.#$n.emit("offerSelect",{offer:e,index:this.#Sn})}#$o(e,t){const n=this.#kn[t];n&&this.#bo.register(e,n.id,()=>this.#To(t))}#To(e){const t=this.#kn[e];t&&this.#$n.emit("offerView",{offer:t,index:e})}claimSelected(){if(!1===this.#ve.claimEnabled)return void u.warn("Claim requested while claiming is disabled — ignoring");const e=this.getSelectedOffer();e?this.#$n.emit("offerClaim",{offer:e,index:this.#Sn}):u.warn("Claim requested with no selected gift — ignoring")}showReady(){if(this.#v)return;const e=this.getSelectedOffer(),t=this.#Do,n=this.#jo;if(!e||!t||!n)return void(t||u.warn("Gift unwrap has no ready screen — compose() was not called"));const i=document.activeElement;this.#ts=i instanceof HTMLElement&&n.contains(i)?i:null,this.closeSheet();try{this.#ps(e)}catch(e){u.debug("Gift unwrap could not fill the ready screen",e)}n.hidden=!0,t.hidden=!1,t.scrollTop=0,this.#Jo="ready",this.#fs(),this.#ms(),this.#gs(Zl),this.#Vo?.focus({preventScroll:!0})}showPick(){if(this.#v)return;const e=this.#Do,t=this.#jo;if(!e||!t)return;e.hidden=!0,t.hidden=!1,this.#Jo="pick",this.#fs(),this.#Ho?.classList.remove(On("unwrap-reveal--play")),this.#gs(ol);const n=this.#ts;this.#ts=null;const i=n?.isConnected&&!n.closest('[aria-hidden="true"]')?n:this.#mo?.querySelector('[aria-checked="true"]');i?.focus({preventScroll:!0})}#fs(){this.#as();try{this.#Xo?.(this.#Jo)}catch(e){u.debug("Gift unwrap screen listener failed",e)}}#gs(e){try{this.#es?.(e)}catch(e){u.debug("Gift unwrap could not relabel the dialog",e)}}#ms(){const e=this.#Ho;if(!e)return;const t=On("unwrap-reveal--play");e.classList.remove(t),e.classList.add(t)}#os(){const e=this.#go.signal,t=document.createElement("div");t.className=`${On("unwrap-screen")} ${On("unwrap-screen--ready")}`,t.hidden=!0,this.#Do=t;const n=document.createElement("button");n.type="button",n.className=On("unwrap-back");const i=document.createElement("span");i.className=On("unwrap-back-icon"),i.setAttribute("aria-hidden","true"),i.innerHTML=Gl,n.appendChild(i),n.appendChild(document.createTextNode(jl.back)),n.addEventListener("click",()=>this.showPick(),{signal:e}),t.appendChild(n);const r=document.createElement("div");r.className=On("unwrap-stage-frame"),r.setAttribute("aria-hidden","true");const o=document.createElement("div");o.className=On("unwrap-reveal"),this.#Ho=o,o.appendChild(tc("unwrap-glow",function(){const e=_l();return`${Vl}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(tc("unwrap-closed",ql()));const s=document.createElement("div");s.className=On("unwrap-open"),s.appendChild(tc("unwrap-open-layer",function(){const e=_l();return`${Vl}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=On("unwrap-logo"),this.#_o=a,s.appendChild(a),s.appendChild(tc("unwrap-open-layer",function(){const e=_l();return`${Vl}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=On("unwrap-ready-title"),l.id=Zl,l.tabIndex=-1,l.textContent=jl.readyTitle,this.#Vo=l,t.appendChild(l);const c=document.createElement("p");c.className=On("unwrap-ready-subline"),this.#Ko=c,t.appendChild(c);const d=document.createElement("ul");d.className=On("unwrap-bullets"),this.#qo=d,t.appendChild(d);const u=document.createElement("div");u.className=On("unwrap-actions");const h=tl({className:On("unwrap-cta"),label:jl.continue,onActivate:()=>this.claimSelected(),enabled:!1!==this.#ve.claimEnabled,useCase:"rewardUsers",...this.#ve.claimSlot&&{slot:this.#ve.claimSlot}});return this.#Wo=h,u.appendChild(h.element),t.appendChild(u),t}#ps(e){const t=this.#_o;t&&(t.textContent="",t.appendChild(Cl(e,"unwrap-logo-inner")));const n=this.#qo;if(n){n.textContent="";for(const t of function(e){const t=[],n=pa(e);n&&t.push(n);const i=ha(e);return Na(e)?(t.push(i?Ee("unwrap.cardAskHost","${host} will ask for a card",{host:i}):Ee("unwrap.cardAsk","You’ll be asked for a card")),t.push(i?Ee("unwrap.trialHost","Cancel anytime, nothing is charged before the ${host} trial ends",{host:i}):Ee("unwrap.trial","Cancel anytime, nothing is charged before the trial ends"))):t.push(i?Ee("unwrap.finishOnHost","You’ll finish claiming on ${host}",{host:i}):Ee("unwrap.finishNext","You’ll finish claiming on the next screen")),t}(e)){const e=document.createElement("li");e.className=On("unwrap-bullet");const i=document.createElement("span");i.className=On("unwrap-bullet-icon"),i.setAttribute("aria-hidden","true"),i.innerHTML=Wl,e.appendChild(i);const r=document.createElement("span");r.textContent=t,e.appendChild(r),n.appendChild(e)}}this.#Ko&&(this.#Ko.textContent=function(e){const t=ha(e);return t?Ee("unwrap.readySublineHost","Now we’ll take you to ${host}, where you can claim your offer.",{host:t}):Ee("unwrap.readySubline","Next, you’ll finish claiming your offer.")}(e)),this.#Wo?.setLabel(function(e){const t=ha(e);return t?Ee("unwrap.continueTo","Continue to ${host}",{host:t}):jl.continue}(e))}#wo(){const e=new Sl({offers:this.#kn,listed:()=>this.#kn.map((e,t)=>t).filter(e=>!this.#yo.includes(e)),claimEnabled:!1!==this.#ve.claimEnabled,footer:()=>null,onCommit:e=>{this.selectOffer(e),this.showReady()},impressions:this.#wn,onShown:e=>this.#To(e),signal:this.#go.signal,title:jl.sheetTitle,closeLabel:jl.closeSheetLabel,cardBody:(e,t)=>Xl(e,t),cardLabel:ba,ctaLabel:()=>jl.continue});return this.#dt=e,e.render()}openSheet(e){this.#v||this.#dt?.open(e)}closeSheet(){this.#dt?.close()}#cs(){const e=()=>{if(this.#v||this.#rs)return;this.#rs=!0,this.#ys();const e=this.#jo;if(e)try{const t=new es;this.#Ar=t,t.start(e)}catch(e){u.debug("Gift unwrap confetti unavailable",e)}};try{this.#ns=requestAnimationFrame(()=>{this.#ns=null,e()})}catch(e){u.debug("Gift unwrap could not schedule a frame for confetti",e)}try{this.#is=setTimeout(e,120)}catch(e){u.debug("Gift unwrap could not schedule its confetti fallback",e)}}#ys(){if(null!==this.#ns){try{cancelAnimationFrame(this.#ns)}catch{}this.#ns=null}null!==this.#is&&(clearTimeout(this.#is),this.#is=null)}destroy(){this.#v=!0,this.#dt?.destroy(),this.#Yo?.destroy(),null!==this.#Qo&&clearTimeout(this.#Qo),this.#Qo=null,this.#bo.clear(),this.#Ln&&this.#wn.destroy(),this.#Wo?.destroy(),this.#ys(),this.#go.abort(),this.#Ar?.destroy(),this.#Ar=null,this.#$n.removeAllListeners(),this.#In?.remove(),this.#fo?.remove(),this.#Bo?.remove(),this.#In=null,this.#jo=null,this.#Do=null,this.#fo=null,this.#Bo=null,this.#mo=null,this.#dt=null,this.#Ho=null,this.#_o=null,this.#Vo=null,this.#qo=null,this.#Wo=null,this.#Ko=null,this.#ts=null,this.#es=null,this.#Xo=null,this.#Go=null,this.#Yo=null,this.#Zo=null}}function Xl(e,t){e.appendChild(Cl(t,"unwrap-row-logo"));const n=document.createElement("span");n.className=On("unwrap-row-text");const{brand:i,perk:r}=ma(t),o=document.createElement("span");if(o.className=On("unwrap-row-title"),o.textContent=i,n.appendChild(o),r){const e=document.createElement("span");e.className=On("unwrap-row-perk"),Ca(e,r,On("unwrap-em")),n.appendChild(e)}e.appendChild(n);const s=document.createElement("span");s.className=On("unwrap-radio"),s.setAttribute("aria-hidden","true"),s.innerHTML=Kl,e.appendChild(s)}function Jl(e){return Boolean(e?.shareUrl)}function ec(e,t){e.appendChild(Cl(t,"keep-card-logo"));const{brand:n,perk:i}=ma(t),r=document.createElement("span");if(r.className=On("keep-card-title"),r.textContent=n,e.appendChild(r),i){const t=document.createElement("span");t.className=On("keep-card-perk"),t.textContent=i,e.appendChild(t)}}function tc(e,t){const n=document.createElement("div");return n.className=On(e),n.innerHTML=t,n}function nc(e){return"string"!=typeof e?"":e.trim().slice(0,64)}function ic(e){if("string"!=typeof e)return null;const t=e.trim(),n=oc.exec(t);if(!n)return null;const i=Ie();if(!i)return t;const[,r,o,s,a,l,c]=n,d=r??c??"",u=s??l;try{return new Intl.NumberFormat(i,{style:"currency",currency:rc[d]??d,currencyDisplay:rc[d]?"narrowSymbol":"symbol",minimumFractionDigits:u?2:0,maximumFractionDigits:u?2:0}).format(Number(`${o??a}.${u??"0"}`))}catch{return t}}const rc={$:"USD","€":"EUR","£":"GBP"},oc=/^(?:([$€£]|USD|EUR|GBP|CAD|AUD)\s?(\d{1,5})(?:[.,](\d{2}))?|(\d{1,5})(?:[.,](\d{2}))?\s?([$€£]|USD|EUR|GBP|CAD|AUD))$/;function sc(e){return Promise.resolve(nc(e)?{ok:!0}:{ok:!1,reason:"empty"})}const ac=On("code-unlock-title");let lc=!1;const cc=On("code-unlock-input"),dc=On("code-unlock-error"),uc=Le("codeUnlock",{title:"Your rewards are waiting",inputLabel:"Your code",inputPlaceholder:"Enter your code",cta:"Unlock my rewards",emptyError:"Enter your code to continue.",rejectedError:"That code didn’t work. Check it and try again.",unlocked:"Exclusive offers unlocked",cardFallback:"Rewards picked for you",previewTitle:"Rewards you can choose from",previewNote:"Unlock to pick yours.",howTitle:"How it works",step1Title:"Enter your code",step1Body:"It’s in the email we sent you.",step2Title:"Pick a reward",step2Body:"Choose the one you like best.",step3Title:"Enjoy it",step3Body:"Finish on the brand’s site.",cardAmount:"Up to ${amount} in rewards",offersHeadline:"Your exclusive offers",offersSubline:"Pick one, it’s on us"}),hc=`<svg viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path class="${On("code-unlock-shackle")}" d="M15 22v-6a9 9 0 0 1 18 0v6" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round"/><rect x="10" y="21" width="28" height="21" rx="6" fill="currentColor"/><circle cx="24" cy="30" r="3" fill="#fff"/><path d="M24 31v5" stroke="#fff" stroke-width="3" stroke-linecap="round"/></svg>`;function pc(e){return"string"==typeof e?e:void 0}class fc{#ve;#go=new AbortController;#In=null;#bs=null;#vs=null;#ws=[];#xs=null;#ks=null;#$s=null;#uo=null;#Cs=null;#es=null;#Is=null;#Ss="locked";#v=!1;#Es=new Set;constructor(e={}){this.#ve=e}isUnlocked(){return"unlocked"===this.#Ss}compose(e,t={}){this.#es=t.setLabelledBy??null;const n=document.createElement("div");n.className=On("code-unlock"),this.#In=n,this.#Ts(n);const i=document.createElement("div");i.className=On("code-unlock-page");const r=this.#As();r&&i.appendChild(r);const o=document.createElement("section");o.className=On("code-unlock-hero");const s=ic(this.#ve.valueLabel),a=this.#Ls(s)??this.#ro(s);this.#vs=a,o.appendChild(a);const l=document.createElement("div");l.className=On("code-unlock-copy"),l.appendChild(this.#Os()),l.appendChild(this.#Ns(e)),o.appendChild(l),i.appendChild(o);const c=lc,d=this.#Ms();d&&(this.#ws.push(d),i.appendChild(d));const u=this.#Us();return this.#ws.push(u),i.appendChild(u),n.appendChild(i),c?this.#Rs():(this.#gs(ac),this.#Fs()),n}#Ts(e){const t=this.#ve.appearance;try{for(const[n,i]of Object.entries(function(e){if(!e||"object"!=typeof e)return{};const t={},n=(e,n)=>{n&&(t[e]=n)};n("--encore-cu-font",yn(e.fontFamily)),n("--encore-cu-heading-font",yn(e.headingFontFamily)),n("--encore-cu-heading-weight",vn(e.headingFontWeight)),n("--encore-gp-ink",gn(e.textColor)),n("--encore-gp-muted",gn(e.mutedTextColor));const i=gn(e.accentColor);return n("--encore-gp-accent",i),n("--encore-gp-perk",i),n("--encore-gp-selected",gn(e.tintColor)),n("--encore-cu-bg",gn(e.backgroundColor)),n("--encore-cu-cta-bg",function(e){if(Array.isArray(e)){if(2!==e.length)return;const t=gn(e[0]),n=gn(e[1]);return t&&n?`linear-gradient(90deg, ${t}, ${n})`:void 0}return gn(e)}(e.ctaBackground)),n("--encore-cu-cta-ink",gn(e.ctaTextColor)),t}(t)))e.style.setProperty(n,i);"pill"===t?.shape&&e.classList.add(On("code-unlock--pill"))}catch(e){u.debug("Code unlock appearance not applied",e)}}#Rs(){const e=this.#bs,t=this.#xs;if(e&&t){this.#vs?.classList.add(On("code-unlock-card--open")),this.#In?.classList.add(On("code-unlock--unlocked"));for(const e of this.#ws)e.hidden=!0;e.hidden=!0,t.hidden=!1,this.#Ss="unlocked",this.#gs(ol)}}#Ns(e){const t=document.createElement("div");t.className=`${On("code-unlock-screen")} ${On("code-unlock-screen--offers")}`,t.hidden=!0,this.#xs=t;const n=document.createElement("div");n.className=On("code-unlock-badge"),n.setAttribute("role","status"),n.tabIndex=-1;const i=document.createElement("span");i.className=On("code-unlock-badge-icon"),i.innerHTML='<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M5 7V5a3 3 0 0 1 5.8-1" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><rect x="3" y="7" width="10" height="7.5" rx="2" fill="currentColor"/></svg>',n.appendChild(i),n.appendChild(document.createTextNode(uc.unlocked)),this.#Cs=n,t.appendChild(n);const r=document.createElement("h2");if(r.className=On("thankyou-title"),r.id=ol,r.textContent=e.title,t.appendChild(r),e.subtitle){const n=document.createElement("p");n.className=On("thankyou-subtitle"),n.textContent=e.subtitle,t.appendChild(n)}const o=document.createElement("div");return o.className=`${On("thankyou")} ${On("thankyou--reward")} ${On("thankyou--gift-picker")} ${On("code-unlock-rewards")}`,o.appendChild(e.surface),e.actions&&o.appendChild(e.actions),t.appendChild(o),t}#Fs(){try{const e=window.visualViewport;if(!e)return;const t=()=>{const t=Math.max(0,Math.round(window.innerHeight-e.height-e.offsetTop));this.#In?.style.setProperty("--encore-cu-kb",`${t}px`)};e.addEventListener("resize",t),e.addEventListener("scroll",t),this.#Is=()=>{e.removeEventListener("resize",t),e.removeEventListener("scroll",t),this.#In?.style.removeProperty("--encore-cu-kb")},t()}catch(e){u.debug("Code unlock could not follow the on-screen keyboard",e)}}#Ps(){this.#Is?.(),this.#Is=null}#Os(){const e=document.createElement("div");e.className=`${On("code-unlock-screen")} ${On("code-unlock-screen--lock")}`,this.#bs=e;const t=document.createElement("h2");t.className=On("code-unlock-title"),t.id=ac,t.textContent=uc.title,e.appendChild(t);const n=document.createElement("p");var i;return n.className=On("code-unlock-subline"),n.textContent=(i=ic(this.#ve.valueLabel))?Ee("codeUnlock.sublineAmount","Unlock up to ${amount} in rewards with the code we sent you.",{amount:i}):Ee("codeUnlock.subline","Unlock them with the code we sent you."),e.appendChild(n),e.appendChild(this.#zs()),e}#As(){const e=I(this.#ve.hostName);return this.#js(e)||this.#Ds(e)}#js(e){const t=this.#ve.appearance,n=qe(pc(t?.logoUrl));if(!n)return null;const i=document.createElement("header");i.className=`${On("code-unlock-header")} ${On("code-unlock-header--logo")}`;const r=document.createElement("img");return r.className=On("code-unlock-logo"),r.alt=I(pc(t?.logoAlt))??e??"",r.onerror=()=>{if(this.#v)return;const t=this.#Ds(e);t?i.replaceWith(t):i.remove()},Ht(r,n,220,!1),i.appendChild(r),i}#Ds(e){if(!e)return null;const t=document.createElement("header");t.className=On("code-unlock-header");const n=qe(this.#ve.hostIconUrl);if(n){const e=document.createElement("img");e.className=On("code-unlock-header-icon"),e.alt="",Ht(e,n,Pt),e.onerror=()=>e.remove(),t.appendChild(e)}const i=document.createElement("span");return i.textContent=e,t.appendChild(i),t}#Ls(e){const t=qe(this.#ve.cardImageUrl);if(!t)return null;const n=document.createElement("div");n.className=`${On("code-unlock-card")} ${On("code-unlock-card--image")}`;const i=document.createElement("img");return i.className=On("code-unlock-card-image"),i.alt=I(this.#ve.cardImageAlt)??(e?Ee("codeUnlock.cardImageAlt","${amount} gift card",{amount:e}):Ee("codeUnlock.cardImageAltUnnamed","Gift card")),i.onerror=()=>{if(this.#v||this.#vs!==n)return;const t=this.#ro(e);n.classList.contains(On("code-unlock-card--open"))&&t.classList.add(On("code-unlock-card--open")),n.replaceWith(t),this.#vs=t},Ht(i,t,460,!1),n.appendChild(i),n}#ro(e){const t=document.createElement("div");t.className=On("code-unlock-card"),t.setAttribute("aria-hidden","true");const n=document.createElement("div");n.className=On("code-unlock-card-top");const i=document.createElement("span");i.className=On("code-unlock-card-brand");const r=qe(this.#ve.hostIconUrl);if(r){const e=document.createElement("img");e.className=On("code-unlock-card-brand-icon"),e.alt="",Ht(e,r,Pt),e.onerror=()=>e.remove(),i.appendChild(e)}i.appendChild(document.createTextNode(I(this.#ve.hostName)??"")),n.appendChild(i);const o=document.createElement("span");o.className=On("code-unlock-lock"),o.innerHTML=hc,n.appendChild(o),t.appendChild(n);const s=document.createElement("div");if(s.className=On("code-unlock-card-value"),e){const t=document.createElement("span");t.className=On("code-unlock-card-amount"),t.textContent=e,s.append(...Ae(uc.cardAmount,{amount:t},void 0,e=>{const t=document.createElement("span");return t.className=On("code-unlock-card-small"),t.textContent=e,t}))}else{const e=document.createElement("span");e.className=On("code-unlock-card-amount"),e.classList.add(On("code-unlock-card-amount--text")),e.textContent=uc.cardFallback,s.appendChild(e)}t.appendChild(s);const a=document.createElement("div");return a.className=On("code-unlock-card-box"),a.innerHTML=ql(),t.appendChild(a),t}#zs(){const e=this.#go.signal,t=document.createElement("form");t.className=On("code-unlock-form"),t.noValidate=!0;const n=document.createElement("label");n.className=On("code-unlock-label"),n.htmlFor=cc,n.textContent=uc.inputLabel,t.appendChild(n);const i=document.createElement("div");i.className=On("code-unlock-field");const r=document.createElement("input");r.className=On("code-unlock-input"),r.id=cc,r.type="text",r.maxLength=64,r.setAttribute("autocomplete","off"),r.setAttribute("autocapitalize","characters"),r.setAttribute("autocorrect","off"),r.setAttribute("spellcheck","false"),r.setAttribute("enterkeyhint","go"),r.placeholder=uc.inputPlaceholder,r.value=nc(this.#ve.initialCode),r.addEventListener("input",()=>this.#Bs(null),{signal:e}),this.#ks=r,i.appendChild(r);const o=document.createElement("button");o.type="submit",o.className=On("code-unlock-cta"),o.textContent=I(pc(this.#ve.appearance?.ctaText))??uc.cta,this.#uo=o,i.appendChild(o),t.appendChild(i);const s=document.createElement("p");return s.className=On("code-unlock-error"),s.id=dc,s.setAttribute("role","alert"),this.#$s=s,t.appendChild(s),t.addEventListener("submit",e=>{e.preventDefault(),this.#Hs()},{signal:e}),t}#Ms(){const e=this.#ve.offers??[];if(0===e.length)return null;const t=document.createElement("section");t.className=On("code-unlock-preview");const n=On("code-unlock-preview-title");t.setAttribute("aria-labelledby",n);const i=document.createElement("h3");i.className=On("code-unlock-preview-title"),i.id=n,i.textContent=uc.previewTitle,t.appendChild(i);const r=document.createElement("p");r.className=On("code-unlock-preview-note"),r.textContent=uc.previewNote,t.appendChild(r);const o=document.createElement("ul");o.className=On("code-unlock-strip");for(const t of e){const e=document.createElement("li");e.className=On("code-unlock-tile"),e.appendChild(Cl(t,"code-unlock-tile-logo"));const n=document.createElement("span");n.className=On("code-unlock-tile-name"),n.textContent=ha(t)??"",e.appendChild(n),o.appendChild(e)}return t.appendChild(o),t}#Us(){const e=document.createElement("section");e.className=On("code-unlock-how");const t=On("code-unlock-how-title");e.setAttribute("aria-labelledby",t);const n=document.createElement("h3");n.className=On("code-unlock-how-title"),n.id=t,n.textContent=uc.howTitle,e.appendChild(n);const i=document.createElement("ol");i.className=On("code-unlock-steps");const r=[[uc.step1Title,uc.step1Body],[uc.step2Title,uc.step2Body],[uc.step3Title,uc.step3Body]],o=this.#ve.appearance?.stepIconUrls,s=r.map((e,t)=>Array.isArray(o)?qe(pc(o[t])):void 0);return s.some(Boolean)&&i.classList.add(On("code-unlock-steps--icons")),r.forEach(([e,t],n)=>{const r=document.createElement("li");r.className=On("code-unlock-step");const o=document.createElement("span");o.className=On("code-unlock-step-num"),o.setAttribute("aria-hidden","true"),o.textContent=String(n+1);const a=s[n];if(a){const e=document.createElement("img");e.className=On("code-unlock-step-icon"),e.alt="",e.onerror=()=>{this.#v||e.replaceWith(o)},Ht(e,a,Pt),r.appendChild(e)}else r.appendChild(o);const l=document.createElement("span"),c=document.createElement("strong");c.textContent=e;const d=document.createElement("span");d.textContent=t,l.append(c,d),r.appendChild(l),i.appendChild(r)}),e.appendChild(i),e}async#Hs(){if(this.#v||"locked"!==this.#Ss)return;const e=nc(this.#ks?.value);let t;this.#Ss="checking",this.#uo?.setAttribute("aria-busy","true"),this.#ks&&(this.#ks.readOnly=!0);try{t=await(this.#ve.check??sc)(e)}catch(e){u.warn("Unlock code check failed; unlocking anyway",e),t={ok:!0}}if(!this.#v){if(this.#Ss="locked",this.#uo?.removeAttribute("aria-busy"),this.#ks&&(this.#ks.readOnly=!1),!t.ok)return this.#Bs("empty"===t.reason?uc.emptyError:uc.rejectedError),void this.#ks?.focus({preventScroll:!0});this.#_s()}}#Bs(e){const t=this.#ks,n=this.#$s;t&&n&&(n.textContent=e??"",e?(t.setAttribute("aria-invalid","true"),t.setAttribute("aria-describedby",dc)):(t.removeAttribute("aria-invalid"),t.removeAttribute("aria-describedby")))}#_s(){this.#Ss="opening",$l()?this.#Vs(!1):(this.#In?.classList.add(On("code-unlock--opening")),this.#qs(()=>this.#Vs(!0),450))}#Vs(e){const t=this.#bs,n=this.#xs;if(this.#v||!t||!n)return;this.#vs?.classList.add(On("code-unlock-card--open")),this.#In?.classList.add(On("code-unlock--unlocked")),this.#In?.classList.remove(On("code-unlock--opening"));for(const e of this.#ws)e.hidden=!0;const i=On("code-unlock-screen--entering"),r=On("code-unlock--swapping");e&&(n.classList.add(i),this.#qs(()=>n.classList.remove(i),500)),this.#Ps(),n.hidden=!1,e?(this.#In?.classList.add(r),this.#qs(()=>{t.hidden=!0,this.#In?.classList.remove(r)},220)):t.hidden=!0,this.#Ss="unlocked",lc=!0,this.#gs(ol),this.#Cs?.focus({preventScroll:!0});try{this.#ve.onUnlock?.()}catch(e){u.debug("Code unlock callback failed",e)}}#qs(e,t){const n=setTimeout(()=>{this.#Es.delete(n),e()},t);this.#Es.add(n)}#gs(e){try{this.#es?.(e)}catch(e){u.debug("Code unlock could not relabel the dialog",e)}}destroy(){this.#v=!0;for(const e of this.#Es)clearTimeout(e);this.#Es.clear(),this.#Ps(),this.#go.abort(),this.#In?.remove(),this.#In=null,this.#bs=null,this.#xs=null,this.#vs=null,this.#ws.length=0,this.#ks=null,this.#$s=null,this.#uo=null,this.#Cs=null,this.#es=null}}const mc=Object.freeze({[C.giftsButton]:"rewardUsers",[C.claimReminder]:"rewardUsers",[$]:"rewardUsers"}),gc=new Set([C.giftsButton,$]),yc="thanks";function bc(e,t){return gc.has(e)&&"off"!==t.autoOpen&&void 0===t.layout}function vc(e){return"string"==typeof e?e.slice(0,64):typeof e}const wc=new Set;function xc(e,t){wc.has(e)||(wc.add(e),u.warn(t))}function kc(e,t){const n=t??{},i=void 0===n.useCase?mc[e]??"rewardUsers":n.useCase;if("reduceChurn"===i)return xc("churn","Encore.triggers: useCase reduceChurn is not supported by triggers yet; rendering nothing"),null;if(!a(i))return xc(`useCase|${e}|${vc(i)}`,`Encore.triggers.${e}: useCase "${vc(i)}" is not supported; rendering nothing`),null;let r,o;if(void 0!==n.layout){if("string"!=typeof n.layout||""===n.layout.trim())return xc(`layout|${e}|${vc(n.layout)}`,`Encore.triggers.${e}: layout "${vc(n.layout)}" is not a layout name; rendering nothing`),null;const t=n.layout.trim();if(t.toLowerCase()===yc)return xc(`layout|${e}|thanks`,`Encore.triggers.${e}: layout "thanks" cannot be pinned; Encore serves it after a completion. Rendering nothing`),null;r=t}return gc.has(e)&&void 0!==n.autoOpen&&("off"===n.autoOpen?o="off":"on"===n.autoOpen||"experiment"===n.autoOpen||!0===n.autoOpen?xc(`autoOpen|${e}|${vc(n.autoOpen)}`,`Encore.triggers.${e}: autoOpen "${vc(n.autoOpen)}" is not an option; only 'off' is, to stop Encore opening the sheet by itself. Encore decides`):(o="off",xc(`autoOpen|${e}|${vc(n.autoOpen)}`,`Encore.triggers.${e}: autoOpen "${vc(n.autoOpen)}" is not an option; only 'off' is. Reading it as 'off'`))),{useCase:i,...void 0!==r&&{layout:r},...o&&{autoOpen:o}}}const $c="claim_log";function Cc(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Ic(e){return"string"==typeof e&&""!==e.trim()?e:void 0}function Sc(e){if(!Cc(e))return null;const t=Ic(e.id),n=Ic(e.campaignId),i=Ic(e.useCase),r=e.claimedAt;if(!(t&&n&&i&&"number"==typeof r&&Number.isFinite(r)))return null;const o=Ic(e.transactionId),s=Ic(e.logoUrl),a=Ic(e.placement),l=Ic(e.perk),c="number"==typeof e.completedAt&&Number.isFinite(e.completedAt)?e.completedAt:void 0,d="number"==typeof e.thanksTappedAt&&Number.isFinite(e.thanksTappedAt)?e.thanksTappedAt:void 0;return{id:t,campaignId:n,advertiserName:"string"==typeof e.advertiserName?e.advertiserName:"",claimedAt:r,useCase:i,...o&&{transactionId:o},...s&&{logoUrl:s},...l&&{perk:l},...a&&{placement:a},...!0===e.finished&&{finished:!0},...!0===e.finished&&void 0!==c&&{completedAt:c},...!0===e.finished&&void 0!==c&&void 0!==d&&{thanksTappedAt:d}}}function Ec(e,t){const n=new Map;for(const t of e){const e=n.get(t.id);if(e){if(t.finished){const i=e.completedAt??t.completedAt,r=e.thanksTappedAt??t.thanksTappedAt;n.set(t.id,{...e,finished:!0,...void 0!==i&&{completedAt:i},...void 0!==r&&{thanksTappedAt:r}})}}else n.set(t.id,t)}return[...n.values()].filter(e=>t-e.claimedAt<=2592e6&&e.claimedAt<=t).sort((e,t)=>t.claimedAt-e.claimedAt).slice(0,50)}class Tc{#Ws;#Ks;#Gs=Object.create(null);constructor(e,t=()=>Date.now()){this.#Ws=e,this.#Ks=t}#Ys(){let e;try{e=function(e){const t=Object.create(null);if(!Cc(e)||!Cc(e.users))return t;for(const[n,i]of Object.entries(e.users)){if(!Array.isArray(i))continue;const e=i.map(Sc).filter(e=>null!==e);e.length>0&&(t[n]=e)}return t}(this.#Ws.get($c))}catch{e=Object.create(null)}const t=this.#Ks(),n=Object.create(null);for(const i of new Set([...Object.keys(e),...Object.keys(this.#Gs)])){const r=Ec([...e[i]??[],...this.#Gs[i]??[]],t);r.length>0&&(n[i]=r)}return n}#ke(e){this.#Gs=e;try{this.#Ws.set($c,{v:1,users:e})}catch{}}record(e,t){try{const n=this.#Ys(),i=t.transactionId??`campaign:${t.campaignId}`,r={...t,id:i,claimedAt:t.claimedAt??this.#Ks()},o=(n[e]??[]).filter(e=>e.id!==i);n[e]=Ec([r,...o],this.#Ks()),this.#ke(n)}catch{}}finish(e,t=!0){try{const n=this.#Ys(),i=this.#Ks();let r=!1;for(const o of Object.keys(n))n[o]=n[o].map(n=>{if(n.transactionId!==e)return n;const o=t&&void 0===n.completedAt;return n.finished&&!o?n:(r=!0,{...n,finished:!0,...o&&{completedAt:i}})});return r&&this.#ke(n),r}catch{return!1}}completedToday(e,t){try{return null!==this.#Zs(this.#Ys()[e]??[],t)}catch{return!1}}thanksDue(e,t){return null!==this.thanksFor(e,t)}thanksFor(e,t){try{const n=this.#Zs(this.#Ys()[e]??[],t);return null===n||void 0!==n.thanksTappedAt?null:n.transactionId??String(n.completedAt)}catch{return null}}thanksTapped(e){try{const t=this.#Ys(),n=t[e]??[],i=this.#Zs(n,this.#Ks());if(!i||void 0!==i.thanksTappedAt)return;const r=this.#Ks();t[e]=n.map(e=>e===i?{...e,thanksTappedAt:r}:e),this.#ke(t)}catch{}}#Zs(e,t){const n=new Date(t).toDateString();let i=null;for(const r of e){const e=r.completedAt;void 0===e||e>t||new Date(e).toDateString()!==n||(null===i||e>i.completedAt)&&(i=r)}if(null===i)return null;const r=i.completedAt;return e.some(e=>e.claimedAt>r)?null:i}open(e){try{return(this.#Ys()[e]??[]).filter(e=>!e.finished)}catch{return[]}}finished(e,t){try{return(this.#Ys()[e]??[]).some(e=>e.transactionId===t&&!0===e.finished)}catch{return!1}}carryOver(e,t){if(e!==t)try{const n=this.#Ys(),i=n[e];if(!i)return;delete n[e],n[t]=Ec([...i,...n[t]??[]],this.#Ks()),this.#ke(n)}catch{}}clear(){this.#Gs=Object.create(null);try{this.#Ws.remove($c)}catch{}}age(e,t){try{const n=this.#Ys(),i=n[e];if(!i)return;n[e]=i.map(e=>({...e,claimedAt:e.claimedAt-t})),this.#ke(n)}catch{}}}function Ac(e){return{transactionId:e.id,campaignId:e.campaignId,advertiserName:e.advertiserName,advertiserLogoUrl:e.logoUrl??null,...e.perk&&{perk:e.perk},claimedAt:new Date(e.claimedAt).toISOString(),availability:"available"}}const Lc=Object.freeze({maxPerCheck:3,cacheMs:3e5,windowMs:2592e6,rateLimitPauseMs:6e5}),Oc=new Set(["verified","final_granted"]),Nc=new Set(["expired","failed"]);function Mc(e){return"number"==typeof e&&Number.isFinite(e)}class Uc{#Qs;#Ks;#Xs;#Js;#ea=new Map;#L=new Map;#ta=0;#na=0;#Ws;onEnded=null;constructor(e,t=()=>Date.now(),n=()=>.8+.4*Math.random(),i=Lc,r=null){this.#Qs=e,this.#Ks=t,this.#Xs=n,this.#Js=i,this.#Ws=r}#Ve(){if(!this.#Ws)return;let e;try{e=function(e){const t=new Map;let n=0;if("object"!=typeof e||null===e)return{records:t,pausedUntil:n};const i=e;if(Mc(i.pausedUntil)&&(n=i.pausedUntil),"object"==typeof i.checks&&null!==i.checks)for(const[e,n]of Object.entries(i.checks))Array.isArray(n)&&Mc(n[0])&&Mc(n[1])&&t.set(e,{last:n[0],gap:n[1]});return{records:t,pausedUntil:n}}(this.#Ws.get())}catch{return}this.#ta=Math.max(this.#ta,e.pausedUntil);for(const[t,n]of e.records){const e=this.#ea.get(t);(!e||n.last>e.last)&&this.#ea.set(t,n)}}#qe(){if(!this.#Ws)return;const e={};for(const[t,n]of this.#ea)e[t]=[n.last,n.gap];try{this.#Ws.set({v:1,checks:e,pausedUntil:this.#ta})}catch{}}async run(e,t,n){try{const i=this.#Ks(),r=e.open(t).filter(e=>void 0!==e.transactionId&&!0!==n?.(e.transactionId)).slice(0,this.#Js.maxPerCheck);this.#Ve(),this.#Ie(i);const o=this.#na;let s=!1;for(const t of r){if(o!==this.#na)break;const n=t.transactionId,i=this.#L.get(n);if(i?s=await i||s:this.#ia(n,t.claimedAt,this.#Ks())&&(s=await this.#ra(n,e)||s),this.#Ks()<this.#ta)break}return s}catch(e){return u.debug("Encore.claim: status check failed",e),!1}}beforeTap(e,t,n){try{if(t.finished(n,e))return!1;const i=t.open(n).find(t=>t.transactionId===e);return i&&!this.#L.has(e)&&this.#Ve(),i&&!this.#L.has(e)&&this.#ia(e,i.claimedAt,this.#Ks())&&this.#ra(e,t),!0}catch{return!0}}forget(){this.#na++,this.#ea.clear(),this.#L.clear(),this.#ta=0}#ia(e,t,n){if(n<this.#ta)return!1;if(n-t>=this.#Js.windowMs)return!1;const i=this.#ea.get(e);return!i||n-i.last>=i.gap}#ra(e,t){this.#ea.set(e,{last:this.#Ks(),gap:this.#Js.cacheMs*this.#Xs()}),this.#qe();const n=(async()=>{let n;try{n=await this.#Qs(e)}catch(e){return function(e){return"object"==typeof e&&null!==e&&429===e.statusCode}(e)?(this.#ta=this.#Ks()+this.#Js.rateLimitPauseMs,this.#qe(),u.debug("Encore.claim: status check rate limited; pausing checks",e)):u.debug("Encore.claim: status check failed; the claim stays open",e),!1}if("string"!=typeof n)return!1;const i=Oc.has(n)?t.finish(e,!0):Nc.has(n)&&t.finish(e,!1);if(i)try{this.onEnded?.()}catch{}return i})().finally(()=>this.#L.delete(e));return this.#L.set(e,n),n}#Ie(e){for(const[t,n]of this.#ea)e-n.last>=this.#Js.windowMs&&this.#ea.delete(t)}}function Rc(e){try{const t=e.getBoundingClientRect();if(!(t.width>0&&t.height>0))return!1;const n=t.left+t.width/2,i=t.top+t.height/2,r=window.innerWidth||document.documentElement.clientWidth,o=window.innerHeight||document.documentElement.clientHeight;if(n<0||i<0||n>=r||i>=o)return!1;if("function"!=typeof document.elementFromPoint)return!1;let s=document.elementFromPoint(n,i);if(null===s)return!1;const a=[];if("undefined"!=typeof ShadowRoot)for(let t=e.getRootNode();t instanceof ShadowRoot;t=t.host.getRootNode())a.unshift(t);for(const e of a){const t=e.host;if(s!==t&&!t.contains(s))return!0;if("function"!=typeof e.elementFromPoint)return!1;if(s=e.elementFromPoint(n,i),null===s)return!1}return s!==e&&!e.contains(s)}catch{return!1}}const Fc=Object.freeze({kind:"hidden"}),Pc=Object.freeze({status:"unavailable"}),zc=new Map,jc=new Set;let Dc=null;function Bc(e){zc.delete(e),0===zc.size&&(Dc?.disconnect(),Dc=null)}class Hc{#Ss=Fc;#Ge=new Set;#yo=new Map;#oa=0;#sa=new Set;#aa=new Map;#go=null;#v=!1;#la=new WeakSet;#ca=null;#da;constructor(e){this.#da=e}get state(){return this.#Ss}get destroyed(){return this.#v}attach(e){this.#v?e.destroy():(this.#go=e,e.setVisible(this.#ua(),this.#ha))}setState(e){if(!this.#v&&(t=this.#Ss,JSON.stringify(e)!==JSON.stringify(t))){var t;this.#Ss=e;for(const t of[...this.#Ge])try{t(e)}catch(e){u.warn("Encore.claim: a state listener threw",e)}}}subscribe(e){if("function"!=typeof e||this.#v)return()=>{};this.#Ge.add(e),jc.add(this);try{e(this.#Ss)}catch(e){u.warn("Encore.claim: a state listener threw",e)}return()=>{this.#Ge.delete(e),0===this.#Ge.size&&jc.delete(this)}}#ha=()=>{const e=[...this.#yo].filter(([,e])=>e>0).map(([e])=>e);return e.length>0&&e.every(e=>Rc(e))};#ua(){let e=this.#oa;for(const t of this.#yo.values())e=Math.max(e,t);return e}#pa(){try{this.#go?.setVisible(this.#ua(),this.#ha)}catch(e){u.warn("Encore.claim: visibility failed",e)}}setVisible(e){this.#v||(this.#oa="number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(e,0),1):0,this.#pa())}tap(e){if(this.#v||!this.#go)return Promise.resolve(Pc);try{return this.#go.tap(e).catch(()=>Pc)}catch(e){return u.warn("Encore.claim: tap failed",e),Promise.resolve(Pc)}}dismiss(){if(!this.#v)try{this.#go?.dismiss()}catch(e){u.warn("Encore.claim: dismiss failed",e)}}bind(e,t){const n="undefined"!=typeof window?window.Element:void 0;if(this.#v||!n||!(e instanceof n))return()=>{};const i=this.#aa.get(e);if(i)return i;const r=t?.target,o=!1!==t?.tap,s=[],a=function(e){return e.matches("button, a[href], input, select, textarea, summary")}(e);!o||a||e.hasAttribute("role")||(e.setAttribute("role","button"),s.push("role")),!o||a||e.hasAttribute("tabindex")||(e.setAttribute("tabindex","0"),s.push("tabindex"));const l=t=>{const i=t.target instanceof n?t.target.closest('button, a[href], input, select, textarea, summary, [role="button"], [role="link"]'):null;return null!==i&&i!==e&&e.contains(i)},c=e=>{l(e)||this.tap(r)},d=e=>{a||l(e)||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.tap(r))};o&&(e.addEventListener("click",c),e.addEventListener("keydown",d)),this.#yo.set(e,0);let h=null;const p="undefined"!=typeof window?window.IntersectionObserver:void 0;if("function"==typeof p)try{h=new p(t=>{for(const n of t)n.target===e&&this.#yo.has(e)&&this.#yo.set(e,n.isIntersecting?Bs(n):0);this.#pa()},{threshold:[...js]}),h.observe(e)}catch(e){u.warn("Encore.claim: IntersectionObserver unavailable",e)}let f=!0;const m=()=>{if(f){f=!1,this.#sa.delete(m),this.#aa.delete(e),h?.disconnect(),o&&(e.removeEventListener("click",c),e.removeEventListener("keydown",d));for(const t of s)e.removeAttribute(t);this.#yo.delete(e),this.#pa()}};return this.#sa.add(m),this.#aa.set(e,m),e.isConnected&&this.#la.add(e),function(e,t){if(zc.set(e,t),!Dc&&"function"==typeof MutationObserver&&"undefined"!=typeof document)try{Dc=new MutationObserver(e=>{if(0!==e.length)for(const e of[...zc.values()])e()}),Dc.observe(document.documentElement,{childList:!0,subtree:!0})}catch{Dc=null}}(this,()=>this.#fa()),m}#ma(){if(0===this.#aa.size||this.#Ge.size>0)return!1;let e=!0;for(const t of this.#aa.keys())t.isConnected?(this.#la.add(t),e=!1):this.#la.has(t)||(e=!1);return e}#fa(){this.#v||null!==this.#ca||(0!==this.#aa.size?this.#ma()&&(this.#ca=setTimeout(()=>{this.#ca=null,!this.#v&&this.#ma()&&this.destroy()},0)):Bc(this))}destroy(){if(!this.#v){for(const e of[...this.#sa])e();this.#v=!0,jc.delete(this),Bc(this),null!==this.#ca&&clearTimeout(this.#ca),this.#ca=null,this.#Ge.clear();try{this.#go?.destroy()}catch{}this.#go=null;try{this.#da?.()}catch{}}}}class _c{#ga=new Map;#ya=new Set;constructor(e){for(const t of e){let e=null;this.#ga.set(t.id,{id:t.id,load:()=>(e??=t.load().catch(t=>{throw e=null,t}),e)})}}get(e){const t="string"==typeof e?e:String(e);return this.#ga.get(t)||(this.#ya.has(t)||(this.#ya.add(t),u.warn(`Encore.triggers: no trigger "${t}" in this SDK version; rendering nothing`)),null)}}class Vc{#ba=new Map;static key(e){return JSON.stringify([e.triggerId,e.useCase,e.placementId??"",e.userId,e.language??"",e.layout??"",e.autoOpen??"",e.state??""])}get(e,t){const n=this.#ba.get(e);if(n)return n;const i=t();return this.#ba.set(e,i),i.catch(()=>{this.#ba.get(e)===i&&this.#ba.delete(e)}),i}clear(){this.#ba.clear()}}class qc{#va=null;#wa=null;#xa=!1;start(e){this.#xa?u.warn("FocusDetector already active"):(this.#va=()=>{u.debug("Window focused"),e()},this.#wa=()=>{"visible"===document.visibilityState&&(u.debug("Document became visible"),e())},window.addEventListener("focus",this.#va),document.addEventListener("visibilitychange",this.#wa),this.#xa=!0,u.debug("FocusDetector started"))}stop(){this.#xa&&(this.#va&&(window.removeEventListener("focus",this.#va),this.#va=null),this.#wa&&(document.removeEventListener("visibilitychange",this.#wa),this.#wa=null),this.#xa=!1,u.debug("FocusDetector stopped"))}isActive(){return this.#xa}}const Wc={title:"titleText",subtitle:"subtitleText",offerDescription:"offerDescriptionText",instructionsTitle:"instructionsTitleText",lastStepHeader:"lastStepHeaderText",lastStepDescription:"lastStepDescriptionText",creditClaimedTitle:"creditClaimedTitleText",creditClaimedSubtitle:"creditClaimedSubtitleText",applyCreditsButton:"applyCreditsButtonText",accentTitle:"accentTitleText"};const Kc="user_id",Gc="user_id_named",Yc=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Zc="user_attributes";function Qc(e){const{age:t,...n}=e;return n}const Xc="language_override",Jc=Le("rewardFallback",{headline:"Congrats! You’ve unlocked an exclusive gift",subheadline:"Choose one of our partner offers below"}),ed="claim_status";function td(e){const t=e.useCase;if(void 0===t||a(t))return e;const n="string"==typeof t?o(t):void 0,{useCase:i,...r}=e;return n?{...r,useCase:n}:r}function nd(e){const t=e?.values?.text;return!!t&&Object.keys(t).length>0}function id(e){const t=e?.experimentId;return"string"==typeof t&&""!==t?t:void 0}function rd(e){return"reduceChurn"===(e??"reduceChurn")}const od="function"==typeof FinalizationRegistry?new FinalizationRegistry(e=>{try{e.destroy()}catch{}}):null,sd=0,ad=120,ld=/^(\d{4})-(\d{2})-(\d{2})(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2}))?$/;function cd(e){if("string"!=typeof e)return null;const t=e.trim(),n=ld.exec(t);if(!n)return null;const i=Number(n[1]),r=Number(n[2]),o=Number(n[3]),s=new Date(Date.UTC(i,r-1,o));if(s.getUTCFullYear()!==i||s.getUTCMonth()!==r-1||s.getUTCDate()!==o)return null;if(10===t.length)return{year:i,month:r,day:o};const a=new Date(t);return Number.isNaN(a.getTime())?null:{year:a.getUTCFullYear(),month:a.getUTCMonth()+1,day:a.getUTCDate()}}let dd=!1;function ud(e){const{dateOfBirth:t,age:n,...i}=e,r={...i};return void 0!==t&&(cd(t)?r.dateOfBirth=t.trim():dd||(dd=!0,u.warn("setUserAttributes: dateOfBirth must be YYYY-MM-DD; it is not used"))),void 0===n?r:"number"==typeof n&&n>=sd&&n<=ad?(r.age=Math.floor(n),r):(u.warn("setUserAttributes: age must be a number of years from 0 to 120; it is not sent"),r)}function hd(e,t=new Date){const{dateOfBirth:n,...i}=e;if(void 0===n)return i;const r=function(e,t=new Date){const n=cd(e);if(!n)return null;const i=t.getUTCMonth()+1,r=t.getUTCDate(),o=i<n.month||i===n.month&&r<n.day,s=t.getUTCFullYear()-n.year-(o?1:0);return s>=sd&&s<=ad?s:null}(n,t);if(null===r)return i;const o=void 0===i.age?r:Math.min(i.age,r);return{...i,age:o}}class pd{#ka=new Set;#$a;#f;#m=null;#E=null;#Ca=null;#Ia=null;#Sa=null;#Ea=null;#Ta=null;#Aa=new Set;#Ye;#La=null;#g=null;#Oa=!1;#Na={};#Ma=!1;#Ua=!1;#Ra=[];#ti=!0;#Fa=null;#Pa=new Tc({get:e=>this.#f.get(e),set:(e,t)=>this.#f.set(e,t),remove:e=>this.#f.remove(e)});#za=new WeakMap;#ja=new Uc(async e=>{const t=this.#m;return t?(await t.checkVerificationStatus(e,{quiet:!0})).raw:null},void 0,void 0,void 0,{get:()=>this.#f.get(ed),set:e=>this.#f.set(ed,e)});#Da=new _c([{id:C.claimReminder,load:()=>Promise.resolve().then(function(){return xh}).then(e=>e.claimReminderPlugin(this.#Ba()))},{id:C.giftsButton,load:()=>Promise.all([Promise.resolve().then(function(){return jh}),Promise.resolve().then(function(){return xh}),Promise.resolve().then(function(){return Bh})]).then(([e,t,n])=>(this.#Ha=e,n.giftsSpotPlugin(e.giftsButtonPlugin({checkSheet:(e,t,n)=>this.#_a(e,t,n),storage:()=>"undefined"!=typeof window?window.localStorage:null,thanksTapped:()=>this.#Va()}),t.claimReminderPlugin(this.#Ba()),{checkClaims:e=>this.#qa(e),thanksFor:()=>this.#Wa()})))}]);#Ba(){return{source:()=>({openClaims:()=>this.#Ka()}),checkSheet:(e,t,n)=>this.#_a(e,t,n),claimTapped:e=>this.#Ga(e),thanksFor:()=>this.#Wa(),thanksTapped:()=>this.#Va(),storage:()=>"undefined"!=typeof window?window.localStorage:null}}triggers={mount:(e,t,n)=>this.#Ya(e,t,n),claimReminder:{mount:(e,t)=>this.#Ya(C.claimReminder,e,{...t,autoOpen:"off"})},giftsButton:{mount:(e,t)=>this.#Ya(C.giftsButton,e,t)}};#Za=null;#Ha=null;#Qa=null;claim(e){const t=new Hc(()=>{this.#Xa.delete(r)}),n={...e??{}};let i=!1;const r=()=>{if(i||t.destroyed)return;const e=this.#Ja();e&&(i=!0,this.#Xa.delete(r),Promise.resolve().then(function(){return Mp}).then(i=>{if(this.#Qa=i,t.destroyed)return;const r="function"==typeof WeakRef?new WeakRef(t):null,o=i.startCustomClaim(n,{checkSheet:(e,t,n)=>this.#_a(e,t,n),claims:()=>this.#Ka(),checkClaims:e=>this.#qa(e),completedToday:()=>this.#el(),thanksFor:()=>this.#Wa(),thanksTapped:()=>this.#Va(),claimTapped:e=>this.#Ga(e),host:e},r?e=>r.deref()?.setState(e):e=>t.setState(e));t.attach(o),od?.register(t,o,o)}).catch(e=>{u.warn("Encore.claim: failed to load; hiding",e)}))};try{this.#Xa.add(r),r()}catch(e){u.warn("Encore.claim: failed to start; hiding",e)}return t}#tl=new Set;#nl=new Vc;#Xa=new Set;#Ya(e,t,n){try{const i=this.#Da.get(e);if(!i)return{unmount:()=>{},setAlignment:()=>{},setText:()=>{}};if(!kc(i.id,n))return{unmount:()=>{},setAlignment:()=>{},setText:()=>{}};const r=n;let o,s,a=null,l=!1,c=!1;const d=!0===t?.isConnected,h=()=>d&&!0!==t?.isConnected,p=()=>{if(l||c)return;if(h())return void f.unmount();const e=this.#Ja();e&&(c=!0,this.#Xa.delete(p),Promise.resolve().then(function(){return Sp}).then(n=>{this.#Za=n,l||(h()?f.unmount():(a=n.mountTrigger(i,t,r,e,()=>{this.#tl.delete(f)}),a===n.NOOP_HANDLE?this.#tl.delete(f):(void 0!==o&&a.setAlignment(o),void 0!==s&&a.setText(s))))}).catch(e=>{this.#tl.delete(f),u.warn("Encore.triggers: failed to load; rendering nothing",e)}))},f={triggerId:i.id,unmount:()=>{l=!0,this.#Xa.delete(p),this.#tl.delete(f),a?.unmount()},reload:e=>a?.reload(e),refresh:()=>a?.refresh(),setAlignment:e=>{o=e,a?.setAlignment(e)},setText:e=>{s=e,a?.setText(e)}};return this.#tl.add(f),this.#Xa.add(p),p(),{unmount:()=>f.unmount(),setAlignment:e=>f.setAlignment(e),setText:e=>f.setText(e)}}catch(e){return u.warn("Encore.triggers: mount failed; rendering nothing",e),{unmount:()=>{},setAlignment:()=>{},setText:()=>{}}}}#il(e="identity"){this.#nl.clear();for(const t of this.#tl)t.reload(e);try{this.#Qa?.reloadCustom(e)}catch(e){u.warn("Encore.claim: could not start over",e)}}#Ja(){return this.#$a.isConfigured()&&this.#m&&this.#g?{fetchConfig:(e,t,n)=>{const i=this.#m,r=this.#g;if(!i||!r)return Promise.reject(new Error("SDK not configured"));const o=this.#rl(),s=S(t),a=Vc.key({triggerId:e,useCase:n.useCase,placementId:s,userId:r,language:o,layout:n.layout,autoOpen:n.autoOpen,...n.state&&{state:n.state}});return this.#nl.get(a,()=>i.fetchTriggerConfig(r,He,e,{useCase:n.useCase,...s&&{placementId:s},...o&&{language:o},...n.layout&&{layout:n.layout},..."off"===n.autoOpen&&{autoOpen:"off"},...n.state&&{state:n.state}}).then(e=>{const t=e?.ui;if("object"!=typeof e||null===e||!0!==e.success||"object"!=typeof t||null===t||Array.isArray(t))throw new Error("trigger /config: not a success response");return e}))},track:e=>this.#ol(e),storage:()=>"undefined"!=typeof window?window.localStorage:null,presentSheet:({useCase:e,placement:t,presentationId:n,isCurrent:i,publisherReward:r,onPresented:o,automatic:s})=>this.#sl(e,t,n,i,r,o,!0===s),sheetBusy:()=>this.#Ua}:null}async#_a(e,t,n){try{const i=this.#Ia,r=this.#g;if(!i||!r||!this.#$a.isConfigured())return{status:"none"};const o=this.#rl(),s=await this.#al(e,t);if(this.#g!==r||this.#rl()!==o)return{status:"none"};if(!s)return{status:this.#ll.has(e)?"sheet_unavailable":"none"};const a=s.variantId,l=S(t),c=l&&this.#cl?.has(l)?l:void 0,d=this.#$a.getFilterOffersByVariant(),u="strict"===this.#$a.getUnlockMode(),h=await i.searchForTrigger(this.#dl(),t,{useCase:e,...a&&(d?{variantId:a}:{wireVariantId:a}),...c&&{ruledPlacementId:c},purpose:"prefetch"},u?15e3:void 0,n);return 0===h.length?{status:"none"}:{status:"offers",campaignIds:new Set(h.map(e=>e.campaignId)),offers:h.map(e=>({campaignId:e.campaignId,...e.merchantName&&{advertiserName:e.merchantName},...e.logoUrl&&{logoUrl:e.logoUrl}}))}}catch(e){return u.debug("Encore.triggers: no offers to show",e),{status:"none"}}}async#sl(e,t,n,i,r,o,s=!1){if(!a(e))return{status:"unavailable"};for(;this.#Ua;)await new Promise(e=>this.#Ra.push(e));if(!i())return{status:"unavailable"};const l={useCase:e,...r&&{publisherReward:r}},c=S(t),{result:d,aborted:u,...h}=await this.#ul(void 0,l,c,n,o,s?i:void 0);return u||this.#hl(d,h,l,c),d}async#Ka(){const e=this.#g;if(!e)return[];const t=this.#Pa.open(e),n=this.#Fa;let i=null;if(n)try{const e=await n.openClaims();i=Array.isArray(e)?e:null}catch(e){u.debug("Encore.triggers: claims read failed; using this browser's claims",e)}return function(e,t,n){if(null===t)return e.map(Ac);const i=new Set(t.map(e=>e.transactionId)),r=new Set(t.map(e=>e.campaignId)),o=e.filter(e=>!(e=>e.transactionId?i.has(e.transactionId):r.has(e.campaignId))(e)&&n-e.claimedAt<6e5);return[...t,...o.map(Ac)]}(t,i,Date.now())}#pl(e,t,n,i){if(!i)return;const{logoUrl:r,perk:o}=this.#za.get(e)??{};this.#Pa.record(i,{campaignId:e.campaignId,advertiserName:e.advertiserName,useCase:t,...e.transactionId&&{transactionId:e.transactionId},...r&&{logoUrl:r},...o&&{perk:o},...n&&{placement:n}}),this.#fl()}#qa(e){const t=this.#g;if(!t||!this.#m)return Promise.resolve();const n=this.#ja.run(this.#Pa,t,e).then(()=>{});let i;const r=new Promise(e=>{i=setTimeout(e,1500)});return Promise.race([n,r]).finally(()=>clearTimeout(i))}#Ga(e){const t=this.#g;return!t||!this.#m||this.#ja.beforeTap(e,this.#Pa,t)}#Wa(){const e=this.#g;return e?this.#Pa.thanksFor(e,Date.now()):null}#Va(){const e=this.#g;e&&this.#Pa.thanksTapped(e)}#el(){const e=this.#g;return Boolean(e)&&this.#Pa.completedToday(e,Date.now())}#fl(){try{this.#Za?.claimsChanged(),this.#Qa?.claimsChangedForCustom()}catch(e){u.warn("Encore.triggers: could not update after a claim",e)}}static bindClaimReminderSource(e,t){e.#Fa=t;for(const t of e.#tl)t.triggerId===C.claimReminder&&t.reload("language");e.#fl()}#ml=null;#gl={};#yl;#bl;#vl={};#wl=new Set;#xl;#kl;#$l={};#Cl={};#ll=new Set;#Il=new Set;#Sl=new Map;#El=new Map;#Tl=null;#ze=null;#Al=null;#Ll=!1;#Ol=0;#Nl=null;#Ml;#Ul;constructor(){var e;this.#$a=new h,this.#f=new f,this.#Ml=new ye((e=this.#f,{read:()=>e.get(pe),write:t=>e.set(pe,t)})),this.#Ul=new ye(function(){let e=null;return{read:()=>e,write:t=>{e=t}}}()),this.#Ye=new Ut,this.#ja.onEnded=()=>this.#fl()}configure(e){const t=this.#$a.configure(e);if(this.#Rl(e.demoVariant),t){let t=this.#f.get(Kc)??null;this.#Fl(),this.#Pl();const n="string"==typeof e.userId?e.userId.trim():"";t&&this.#zl(n,t)&&(this.#jl(),t=null);const i=this.#Dl(e.userId,t),r=this.#$a.getBaseURL(),o=this.#$a.getAnalyticsBaseURL(),s=this.#$a.getApiKey()??"";if(r){if(this.#m=new at(s,r),o){if(this.#E=new xt(s,o,this.#f),!this.#Sa){const e=new Tt(s,o,this.#f);this.#Sa=new It(this.#f,()=>this.#g,e),e.flush()}this.#La||(this.#La=new Lt(s,o,this.#f),this.#La.flush())}this.#g&&(this.#Ca=new w(this.#f,this.#m,this.#g),this.#Ta="strict"===this.#$a.getUnlockMode()?new le(this.#f,this.#m,this.#g):null,this.#Ia?.destroy(),this.#Ia=new ne(this.#m,this.#g,this.#E??void 0)),this.#Ea=new qc}if(this.#Bl(),u.info("Encore SDK initialized successfully",{version:He}),this.#E&&this.#g){const e="undefined"!=typeof window?window.location.hostname:"unknown";this.#E.track(function(e,t,n){return{name:"sdk_initialized",distinctId:e,properties:{sdkVersion:He,appBundleId:n,platform:"web"}}}(this.#g,0,e))}i&&this.#g&&this.#Hl(i,this.#g),this.#g&&this.#_l(this.#g),this.#Vl(),this.#ql();for(const e of[...this.#Xa])e()}return t}#Fl(){const e=this.#f.get(Kc);e?(this.#g=e,this.#Oa=!0===this.#f.get(Gc),u.debug("Loaded existing user ID:",e)):(this.#g=te(),this.#f.set(Kc,this.#g),u.debug("Generated new user ID:",this.#g));const t=this.#f.get(Zc);t&&(this.#Na=Qc(ud(t)),u.debug("Loaded user attributes"))}#Dl(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.#Oa=!0,this.#f.set(Gc,!0),this.#f.set(Kc,n),u.debug("User identified at configure:",n),t&&t!==n?t:null)}#_l(e,t){this.#m&&(t?this.#m.initUser(e,t):this.#m.initUser(e)).catch(e=>{u.warn("Failed to init user on backend (non-blocking)",e),this.#Wl("api_request",e)})}#zl(e,t){return""!==e&&e!==t&&!this.#Kl(t)}#jl(){this.#Gl(e=>e===Et||e===At||function(e){return e.endsWith(m)||e.endsWith(g)}(e),!1)}#Kl(e){return!this.#Oa&&Yc.test(e)}#Yl(){return!!this.#$a.isConfigured()||(u.error("SDK not configured. Call Encore.configure() first."),!1)}#Pl(){const e=this.#f.get(Xc);let t=A(e);if(null!==e&&null===t&&this.#f.remove(Xc),Object.prototype.hasOwnProperty.call(this.#Na,"language")){const{language:e,...n}=this.#Na;this.#Na=n,this.#f.set(Zc,Qc(n)),null===t&&(t=L(e),null!==t&&this.#f.set(Xc,t)),u.debug("Took language out of the stored attributes",{legacy:e,override:t})}this.#Al=t}#rl(){return this.#Al??void 0}#Zl(e){if(e===this.#Al)return;const t=this.#rl();this.#Al=e,null===e?this.#f.remove(Xc):this.#f.set(Xc,e),this.#Ql(t),this.#Vl(),this.#rl()!==t&&(this.#Xl(),this.#il("language"))}#Xl(){const e=this.#Tl,t=this.#g,n=this.#Ol;e&&t&&e.then(()=>{if(this.#g!==t||this.#Ol!==n)return;if(this.#Jl(t,this.#Na),!this.#Ia||"strict"===this.#$a.getUnlockMode())return;const e=this.#ec("reduceChurn");this.#Ia.prefetchOffers(this.#dl(),{...e&&this.#$a.getFilterOffersByVariant()&&{variantId:e},useCase:"reduceChurn"})})}#dl(){const e=this.#rl(),t=hd(this.#Na);return e?{...t,language:e}:t}#Ql(e){this.#rl()!==e&&(u.debug("Language changed; dropping cached copy and offers",{from:e,to:this.#rl()}),this.#tc())}#Rl(e){if(void 0===e)return;const t="string"==typeof e?e.trim():"";""!==t?t!==this.#ze&&(this.#ze=t,this.#nc(),this.#tc(),this.#Bl()):u.warn("configure() ignored demoVariant: it must be a non-empty string")}#nc(){const e=this.#$a.getApiKey();if(!e)return;const t=function(e){return"string"!=typeof e?"unknown":e.startsWith("pk_test_")?"test":e.startsWith("pk_live_")?"live":"unknown"}(e);"test"!==t&&u.warn(`[DEMO] demoVariant '${this.#ze}' is set on ${function(e){switch(e){case"test":return"a test key (pk_test_*)";case"live":return"a live key (pk_live_*)";default:return"a key of unrecognised kind (expected pk_test_* or pk_live_*)"}}(t)}. The backend honours it on any test key (pk_test_*), and on a pk_live_* key only for Encore's own demo apps; for every other app it will be ignored.`)}#Bl(){this.#E?.setDemoVariant(this.#ze),this.#La?.setDemoVariant(this.#ze)}#tc(){this.#cl=void 0,this.#gl={},this.#yl=void 0,this.#bl=void 0,this.#xl=void 0,this.#kl=void 0,this.#vl={},this.#$l={},this.#Cl={},this.#ll.clear(),this.#Sl=new Map,this.#Tl=null,this.#Ol+=1,this.#Ia?.clearCache(),Se()}#ic(e,t){this.#ze&&t!==this.#ze&&u.warn(`[DEMO] demoVariant '${this.#ze}' was not honoured for '${e}' — the server served ${null===t?"no variant":`'${t}'`}. Rendering what the server served.`)}identify(e,t){if(!this.#Yl())return;if(!e||"string"!=typeof e)return void u.error("identify() requires a valid user ID string");let n=this.#g;n&&this.#zl(e,n)&&(this.#jl(),n=null),this.#g=e,this.#Oa=!0,this.#f.set(Gc,!0),this.#f.set(Kc,e);const{language:i,...r}=t??{};t&&this.setUserAttributes(r),n!==e&&(this.#Hl(n,e,t),this.#il()),null===n&&(this.#_l(e,t?.email?{email:t.email}:void 0),this.#Ca?.processQueue(),this.#rc()),this.#oc(i)}#Hl(e,t,n){u.info("User identified:",t),e&&e!==t&&this.#Pa.carryOver(e,t),this.#Ca&&this.#Ca.setUserId(t),this.#Ia&&this.#Ia.setUserId(t),this.#Ta?.setUserId(t),this.#m&&e&&this.#m.identifyUser(e,t,n?.email?{email:n.email}:void 0).catch(e=>{u.warn("Failed to identify user on backend (non-blocking)",e),this.#Wl("api_request",e)}),this.#Jl(t,n)}#Jl(e,t){if(!this.#E)return;const n="undefined"!=typeof window?window.location.hostname:"unknown";this.#E.track(function(e,t,n,i){return{name:"user_identified",distinctId:e,properties:{userId:t,appBundleId:n,...i&&{attributes:i}}}}(e,e,n,function(e){const t=function(e){if(!e||!("language"in e))return e;const{language:t,...n}=e;return Object.keys(n).length>0?n:void 0}(e);if(!t)return;const n=hd(ud(t));return Object.keys(n).length>0?n:void 0}(t)))}getCurrentUserId(){return this.#g}getAppAccountId(){return this.#g}reset(){this.#Gl()}#Gl(e,t=!0){if(this.#Yl()){if(u.info("Resetting SDK"),this.#f.clear(e),this.#Pa.clear(),this.#ja.forget(),!e){!function(){try{if("undefined"==typeof window||!window.localStorage)return;const e=window.localStorage,t=[];for(let n=0;n<e.length;n++){const i=e.key(n);i?.startsWith("encore.trigger.")&&t.push(i)}for(const n of t)e.removeItem(n)}catch{}}();try{this.#Za?.forgetTriggerMemory(),this.#Ha?.forgetAutoPops()}catch(e){u.warn("Encore.triggers: could not forget trigger state on reset",e)}}null!==this.#Al&&this.#f.set(Xc,this.#Al);for(const e of Array.from(this.#ka))e();this.#ka.clear(),lc=!1,this.#g=te(),this.#Oa=!1,this.#f.set(Kc,this.#g),this.#Na={},this.#gl={},this.#$l={},this.#cl=void 0,this.#vl={},this.#xl=void 0,this.#kl=void 0,this.#yl=void 0,this.#bl=void 0,this.#Ul.clear(),this.#Cl={},this.#ll.clear(),this.#Sl=new Map,this.#El.clear(),this.#Tl=null,this.#Ol+=1,Se(),this.#Ca&&(e||this.#Ca.clearQueue(),this.#Ca.destroy(),this.#m&&this.#g&&(this.#Ca=new w(this.#f,this.#m,this.#g))),this.#g&&this.#Ta?.setUserId(this.#g,!e),this.#Ia&&(this.#Ia.clearCache(),this.#Ia.destroy(),this.#m&&this.#g&&(this.#Ia=new ne(this.#m,this.#g,this.#E??void 0))),this.#Ea?.isActive()&&this.#Ea.stop(),this.#ql(),this.#Nl?.(),this.#Nl=null,t&&this.#il(),u.debug("SDK reset complete",{newUserId:this.#g})}}getVersion(){return He}get isClaimEnabled(){return this.#ti}set isClaimEnabled(e){this.#ti=e,u.debug("Claim enablement changed",{isClaimEnabled:e})}isConfigured(){return this.#$a.isConfigured()}getConfiguration(){return this.#$a.isConfigured()?{apiKey:this.#$a.getApiKey()??"",environment:this.#$a.getEnvironment()??"",baseURL:this.#$a.getBaseURL()??"",analyticsBaseURL:this.#$a.getAnalyticsBaseURL()??"",logLevel:this.#$a.getConfig()?.logLevel??"none"}:null}async getExperimentState(){return this.#$a.isConfigured()&&this.#Sa?this.#Sa.getState():null}setLogLevel(e){u.setLogLevel(e)}async revokeEntitlements(){if(!this.#Yl())return!1;if(!this.#m||!this.#g)return!1;try{return await this.#m.revokeEntitlements(this.#g)}catch(e){return u.error("Failed to revoke entitlements",e),!1}}setUserAttributes(e){if(!this.#Yl())return;if(!e||"object"!=typeof e)return void u.error("setUserAttributes() requires a valid UserAttributes object");const{language:t,...n}=e,i=ud(n);this.#Na={...this.#Na,...i,custom:{...this.#Na.custom,...i.custom}},this.#f.set(Zc,Qc(this.#Na)),u.debug("User attributes updated",this.#Na);for(const e of this.#tl)e.refresh();try{this.#Qa?.refreshCustom()}catch(e){u.warn("Encore.claim: could not refresh after a targeting change",e)}this.#oc(t)}#oc(e){void 0!==e&&(this.#Ll||(this.#Ll=!0,u.deprecated("UserAttributes.language is deprecated and will be removed in the next major version. Call Encore.setLanguage(tag) instead; it is kept on this device until Encore.clearLanguage().")),this.#Yl()&&this.#sc(L(e),e))}setLanguage(e){this.#Yl()&&this.#sc(A(e),e)}#sc(e,t){null!==e?this.#Zl(e):u.ignored(`setLanguage() ignored ${"string"==typeof t?JSON.stringify(t):String(t)}: expected a language tag such as 'fr' or 'pt-BR'`)}clearLanguage(){this.#Yl()&&this.#Zl(null)}getUserAttributes(){return{...this.#Na}}async show(e,t,n){const{result:i,...r}=await this.#ul(e,t,n);return this.#hl(i,r,t,n),i}async#ul(t,n,r,o,l,c){const d=o??te(),h=(p=n?.useCase,a(p)?p:"reduceChurn");var p;if(this.#ac(d,h,r),!this.#Yl()){const n="notConfigured";return t?.onNotGranted?.(n),t?.onError?.({code:e.INITIALIZATION_ERROR,message:"SDK not configured"}),this.#lc("not_configured",d,h,r),{result:{status:"dismissed",reason:n},presentationId:d}}const f=function(t){return void 0===t||i.includes(t)?null:{code:e.INVALID_REQUEST,message:`useCase ${s(t)} is not a recognised Encore use case — nothing was presented. Supported values: ${i.map(e=>`'${e}'`).join(", ")}.`,details:{useCase:t}}}(n?.useCase);if(f){u.error(`[Encore SDK] Integration error: ${f.message}`),this.#Wl("configuration",new Error(f.message));const e={type:"error",error:f};return t?.onNotGranted?.(e),t?.onError?.(f),{result:{status:"dismissed",reason:e},presentationId:d}}if(this.#Ua){u.warn("show() called while already presenting, ignoring duplicate request");const e="alreadyPresenting";return t?.onNotGranted?.(e),this.#lc("already_presenting",d,h,r),{result:{status:"dismissed",reason:e},presentationId:d}}this.#Ua=!0;const m=this.#g;try{const e=await this.#cc(d,n,r,void 0!==o,l,c),i=e.result;if("claimed"===i.status&&this.#pl(i,h,r,m),"claimed"===i.status&&void 0===o)try{this.#Za?.appSheetClaimed()}catch(e){u.warn("Encore.triggers: could not drop held pops after a claim",e)}return"claimed"===i.status?t?.onGranted?.(void 0):"dismissed"===i.status&&i.reason&&t?.onNotGranted?.(i.reason),e}catch(n){u.error("Error during show",n),this.#Wl("present_offer_initialization",n);const i={type:"error",error:{code:e.UNKNOWN_ERROR,message:n instanceof Error?n.message:"Unknown error"}};return t?.onError?.(i.error),t?.onNotGranted?.(i),{result:{status:"dismissed",reason:i},presentationId:d,override:{notPresentedReason:"error.unknown_error"}}}finally{this.#Ua=!1;for(const e of this.#Ra.splice(0))e()}}#ac(e,t,n){var i;this.#La&&this.#g&&this.#La.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:r(i.useCase),...P(i.placementId)}},te())}#lc(e,t,n,i,o){var s;this.#La&&this.#g&&this.#La.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!==o&&{variantId:o}}).reason,presentationId:s.presentationId,use_case:r(s.useCase),...P(s.placementId),...void 0!==s.variantId&&{variantId:s.variantId}}},te())}#hl(e,t,n,i){if(!this.#La||!this.#g)return;const o=t.presentationId,s={...void 0!==i&&{placementId:i},presentationId:o,useCase:r(n?.useCase??"reduceChurn"),unlockMode:this.#$a.getUnlockMode(),...void 0!==t.variantId&&{variantId:t.variantId},...Mt(e,t.override)};this.#La.enqueue(function(e,t){const{placementId:n,...i}=t,r=S(n);return{name:"sdk_placement_resolved",distinctId:e,properties:{...i,...r&&{placementId:r}}}}(this.#g,s),o)}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(t){if(!this.#Yl())return{status:"dismissed",reason:{type:"error",error:{code:e.INITIALIZATION_ERROR,message:"SDK not configured"}}};const n=this.#dc(t?.placement);if(n&&"rewardUsers"!==n.transaction.useCase&&!t?.host?.name&&await this.#uc(),!n)return u.info("redeem(): nothing pending to redeem"),{status:"unavailable"};const{transaction:i,store:r}=n;let o=null;try{this.#Ma||(Ln({}),this.#Ma=!0),o=new Fn;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.#hc(n,i,t?.host,()=>{const t=this.#pc(),o=this.#El.has(i.id)?this.#El.get(i.id):this.#ec(i.useCase),s=i.useCase??"reduceChurn";if(this.#ol(e=>J(e,{...o&&{variantId:o},actionType:"claimOffer",presentationId:i.id,currentState:"redemption",useCase:s})),!this.#fc(i.offer,i.id,s,t,{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:e.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(t){return u.error("Error during redeem",t),this.#Wl("present_offer_initialization",t),{status:"dismissed",reason:{type:"error",error:{code:e.UNKNOWN_ERROR,message:t instanceof Error?t.message:"Unknown error"}}}}finally{o?.destroy()}}getPendingTransaction(e){return this.#Yl()?this.#dc(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.#Yl()&&(this.#Ca?t&&"string"==typeof t?this.#Ca.sendGrantSignal(t,e):u.error("didGrant() requires a valid transaction ID"):u.error("SignalManager not initialized"))}async waitForVerification(e,t){if(!this.#Yl())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 i=new se(this.#m,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.#Ye.on("strictUnlockVerified",e)}placement(e,t){let n,i,r;return"string"==typeof e?(n=e,i=e,r=t):(n=`placement_${te().slice(0,8)}`,r=e),new ce(n,async e=>this.show(void 0,e,i),r,async()=>this.redeem(i?{placement:i}:void 0))}#Wl(t,n){if(!this.#m)return;const i=n instanceof Error?n.message:String(n),r=n instanceof Error?n.stack:void 0,o=oe(n),s=function(t){if("object"!=typeof t||null===t)return{};const n=t,i=re(n,"code"),r=n.statusCode;return{...i&&i!==String(e.API_ERROR)?{serverCode:i}:{},..."number"==typeof r?{statusCode:String(r)}:{}}}(n);this.#m.reportError({errorType:o,message:i,context:t,severity:"error",...r&&{stackTrace:r},...this.#g&&{userId:this.#g},...Object.keys(s).length>0&&{metadata:s}}).catch(()=>{}),this.#E&&this.#g&&this.#E.track(function(e,t,n,i){return{name:"sdk_error",distinctId:e,properties:{errorType:t,errorDescription:n,...i&&{context:i}}}}(this.#g,o,i,t))}async#mc(e,t,n,i){if("reduceChurn"!==t)return null;const r=this.#Sa?await this.#Sa.getCohort():"notEnrolled";return this.#Sa?.logExposure(r),"control"!==r?null:(this.#E&&this.#g&&this.#E.track(W(this.#g,"experiment_control",e,i.variantId,t,n,i.experimentId)),this.#lc("experiment_control",e,t,n,i.variantId),u.debug("NCL control cohort — ghost trigger, no UI shown"),{result:{status:"unavailable"},override:{notPresentedReason:"experiment_control"}})}#cl;#gc(e){Ce(e.locale,e.ui?.values);const t=e.ui?.useCase&&e.ui.useCase!==r("reduceChurn")?void 0:e.ui;if(t){if(t.values?.text){const e=t.values.text;this.#gl={...e},u.debug("Remote config loaded",e)}}else this.#gl={};this.#yl=t?.variantId??void 0,this.#bl=nd(t)?id(t):void 0,this.#xl=t?.values,this.#kl=t?.template??void 0,this.#vl={...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},...e.entitlements?.iap?.premiumTierName&&{premiumTierName:e.entitlements.iap.premiumTierName}};const n=e.useCases??{},i={};for(const[e,t]of Object.entries(n)){const n=o(e);n&&(i[n]=t)}const s={};for(const e of Object.keys(this.#Cl)){const t=this.#$l[e];t&&(s[e]=t)}this.#$l={...i,...s},this.#Sa?.setConfig(e.experiments?.ncl);const a=e.ruledPlacements;this.#cl=Array.isArray(a)?new Set(a.flatMap(e=>{const t="string"==typeof e?S(e):void 0;return t?[t]:[]})):void 0}#yc(e){if(this.#ll.has(e))return null;const t=this.#$l[e];return t&&nd(t)?{variantId:t.variantId??void 0,experimentId:id(t),variantName:t.variantName??null,...t.template?{template:t.template}:{},values:t.values}:null}async#al(e,t){this.#Tl||this.#Vl();const n=Date.now()+2500,i=this.#bc(e,t);await this.#uc();let r=i?await this.#vc(i,n):null;return r??=this.#yc(e),r||(await this.#wc(e),r=this.#yc(e)),this.#ic(e,r?.variantName??null),r}#wc(e){const t=this.#Cl[e];if(t)return t;if(!this.#m||!this.#g)return Promise.resolve();this.#xc(e);const n=this.#g,i=this.#rl(),o=this.#Ol,s=this.#m.fetchConfig(n,He,e,this.#ze??void 0,void 0,i).then(t=>{if(this.#g!==n||this.#Ol!==o)return void(this.#Cl[e]===s&&delete this.#Cl[e]);Ce(t.locale,t.ui?.values);const i=t.ui,a=i?.useCase===r(e),l=i?.values;if(a&&nd({values:l})){this.#ll.delete(e);const t=id(i);this.#$l[e]={variantId:i.variantId??null,...t&&{experimentId:t},variantName:i.variantName??null,template:i.template??null,values:l}}else this.#ll.add(e),delete this.#$l[e]}).catch(t=>{u.warn(`Failed to fetch config for use case '${e}' (non-blocking)`,t),this.#Cl[e]===s&&delete this.#Cl[e]});return this.#Cl[e]=s,s}#bc(e,t){if("rewardUsers"!==e||!this.#$a.getResolveVariantsByPlacement())return null;const n=S(t);if(!n||!this.#m||!this.#g)return null;const i=function(e,t,n){return JSON.stringify([e,t,n])}(this.#g,e,n),o=this.#Sl.get(i);if(o)return o.task;const s=this.#Sl,a=this.#g,l={task:this.#m.fetchConfig(a,He,e,this.#ze??void 0,n,this.#rl()).then(t=>{if(this.#g!==a||this.#Sl!==s)return s.get(i)===l&&s.delete(i),null;Ce(t.locale,t.ui?.values);const n=t.ui,o=n?.useCase===r(e)&&nd({values:n.values});return l.value=o?{variantId:n.variantId??void 0,experimentId:id(n),variantName:n.variantName??null,...n.template?{template:n.template}:{},values:n.values,fromPlacement:!0}:null,l.value}).catch(e=>(u.warn(`Failed to resolve the variant for placement '${n}' (non-blocking); presenting the prefetched variant`,e),s.get(i)===l&&s.delete(i),null))};return s.set(i,l),l.task}async#vc(e,t){let n;const i=await Promise.race([e,new Promise(e=>{n=setTimeout(()=>e(null),Math.max(0,t-Date.now()))})]);return clearTimeout(n),i}#xc(e){this.#Il.has(e)||(this.#Il.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.`))}#ec(e){return e&&"reduceChurn"!==e?this.#yc(e)?.variantId:this.#yl}#kc(e,t){u.warn(`SDUI variant cannot render on web: ${t}`);const n=`${e??"unknown"}:${t}`;this.#wl.has(n)||(this.#wl.add(n),this.#Wl("configuration",new Error(`SDUI variant ${e??"(no id)"} cannot render on web: ${t}`)))}#$c(e){const t=e.template;if(!t)return;const n=e.variantId,i=function(e,t=document){return"light"===e||"dark"===e?e:function(e){const t=e.querySelector('meta[name="color-scheme"]')?.content,n=e.defaultView;return[t,e.documentElement.style.colorScheme,n?.getComputedStyle(e.documentElement).colorScheme,e.body?n?.getComputedStyle(e.body).colorScheme:void 0].some(e=>(e??"").toLowerCase().split(/\s+/).includes("dark"))}(t)&&function(e){try{return!0===e.defaultView?.matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}(t)?"dark":"light"}(e.values?.appearance?.mode),r=function(e){const t={};for(const[n,i]of Object.entries(e.text??{}))"string"==typeof i&&(t[n]=i);const n={...t};for(const[e,i]of Object.entries(Wc))void 0!==t[e]&&(n[i]=t[e]);for(const t of["accentColor","accentTitleColor"]){const i=e.appearance?.[t];"string"==typeof i&&(n[t]=i)}const i=t.customHeadline??t.title;void 0!==i&&(n.customHeadline=i);const r=t.customSubheadline??t.subtitle;void 0!==r&&(n.customSubheadline=r);const{entitlementValue:o,entitlementUnit:s}=e.host;return o&&(n.trialValue=o),s&&(n.trialUnit=function(e,t){const n=e.trim().toLowerCase().replace(/s$/,"");if(!["day","week","month","year"].includes(n))return e;const i=t?.trim()??"";return/^[+-]?\d+$/.test(i)?function(e,t){const n=ve[e];return n&&"object"==typeof n?Te(e,t,n):void 0}(`unitName.${n}`,Number(i))??e:e}(s,o)),e.host.premiumTierName?n.premiumTierName=e.host.premiumTierName:e.host.appName&&(n.premiumTierName=Ee("premiumTier.name","${appName} Premium",{appName:e.host.appName})),e.headline&&(n[e.churn?"customHeadline":"rewardHeadline"]=e.headline),e.subheadline&&(n[e.churn?"customSubheadline":"rewardSubheadline"]=e.subheadline),n}({text:e.values?.text,appearance:e.values?.appearance,host:this.#vl,churn:"rewardUsers"!==e.useCase,headline:I(e.headline),subheadline:I(e.subheadline)}),o=I(this.#Cc().logoUrl,e.values?.media?.appstoreIcon??void 0);o&&(r.appIconUrl=o);const s=ea.create(e.offers,{template:t,color:ia({...e.appearance?.accentColor&&{accent:e.appearance.accentColor},...e.appearance?.backgroundColor&&{background:e.appearance.backgroundColor},...e.appearance?.textColor&&{text:e.appearance.textColor},serverAccent:e.values?.appearance?.accentColor,serverAccentTitle:e.values?.appearance?.accentTitleColor,scheme:i}),scheme:i,variables:r,claimEnabled:this.#ti,impressions:e.impressions,analytics:t=>{const i={...n&&{variantId:n},presentationId:e.presentationId,...e.useCase&&{useCase:e.useCase},...e.placementId&&{placementId:e.placementId}};this.#ol(e=>"stateTransition"===t.kind?function(e,t){return{name:"sdk_sdui_state_transition",distinctId:e,properties:{...t.variantId&&{variantId:t.variantId},fromState:t.fromState,toState:t.toState,timeInPreviousStateMs:t.timeInPreviousStateMs,presentationId:t.presentationId,...F(t.useCase),...P(t.placementId)}}}(e,{...i,fromState:t.fromState,toState:t.toState,timeInPreviousStateMs:t.timeInPreviousStateMs}):"valueSet"===t.kind?function(e,t){return{name:"sdk_sdui_value_set",distinctId:e,properties:{...t.variantId&&{variantId:t.variantId},key:t.key,value:t.value,presentationId:t.presentationId,...F(t.useCase),...P(t.placementId)}}}(e,{...i,key:t.key,value:t.value}):J(e,{...i,actionType:t.actionType,currentState:t.currentState}))}});if(s)return u.debug("Rendering the served SDUI variant"),s;u.warn("SDUI variant cannot render on web; using the built-in surface")}#Vl(){if(!this.#m||!this.#g)return;const e=Date.now(),t=this.#g,n=this.#rl(),i=this.#Ol,r=this.#m.fetchConfig(t,He,void 0,this.#ze??void 0,void 0,n).then(n=>{this.#g===t&&this.#Ol===i?(this.#gc(n),this.#Ic("remote",Date.now()-e,n.ui?.variantId??void 0)):this.#Tl===r&&(this.#Tl=null)}).catch(t=>{u.warn("Failed to fetch remote config (non-blocking)",t),this.#Wl("configuration",t),this.#Tl===r&&(this.#Ic("fallback",Date.now()-e),this.#Tl=null)});this.#Tl=r}#Ic(e,t,n=this.#yl){var i;this.#E&&this.#g&&this.#E.track({name:"sdk_sdui_config_loaded",distinctId:this.#g,properties:{...(i={...n&&{variantId:n},loadSource:e,loadDurationMs:t}).variantId&&{variantId:i.variantId},loadSource:i.loadSource,loadDurationMs:i.loadDurationMs,...i.presentationId&&{presentationId:i.presentationId}}})}async#uc(){if(!this.#Tl)return;let e;await Promise.race([this.#Tl,new Promise(t=>{e=setTimeout(t,2500)})]),clearTimeout(e)}async#cc(t,n,i,r=!1,o,s){const a=n?.useCase??"reduceChurn";let l=null;if("reduceChurn"!==a&&(l=await this.#al(a,i),!l))return u.info(`[Encore SDK] No template for use case '${a}' on this app — no-op`),this.#E&&this.#g&&this.#E.track(W(this.#g,"no_template",t,void 0,a,i)),{result:{status:"unavailable"},presentationId:t,override:{notPresentedReason:"use_case_unavailable"}};if(!this.#Ia||!this.#m)return u.error("Managers not initialized"),{result:{status:"dismissed",reason:{type:"error",error:{code:e.INITIALIZATION_ERROR,message:"Managers not initialized"}}},presentationId:t};const c={title:I(n?.headline),subtitle:I(n?.subheadline)},{variantId:d,experimentId:h}=l??{variantId:this.#yl,experimentId:this.#bl},p="reduceChurn"===a?this.#kl:l?.template,f="rewardUsers"===a&&(null!==ul(l?.variantName)||hl(l?.variantName)),m=p&&!f?function(e){try{const t=no(e).presentation;Os(t.initialValues,"initialValues"),Ns(t.textMaps),Ms(t.offerDisplayOrder,"offerDisplayOrder"),null!=t.initialSelection&&Ls(t.initialSelection,1)}catch(e){return e instanceof Error?e.message:String(e)}const t=co(e);return t?`needs "${t}", which web cannot run`:void 0}(p):void 0;m&&this.#kc(d,m);const g=m?void 0:h;this.#E&&this.#g&&this.#E.track(function(e,t,n,i,r,o){return{name:"sdk_offer_presentation_triggered",distinctId:e,properties:{presentationId:t,...n&&{variantId:n},...o&&{experimentId:o},...F(i),...P(r)}}}(this.#g,t,d,a,i,g));const y=await this.#mc(t,a,i,{variantId:d,experimentId:g});if(y)return{...y,presentationId:t,...void 0!==d&&{variantId:d}};const b=[],v=()=>{for(const e of b.splice(0))try{e()}catch{}};try{const h=n?.appearance,p={...h?.accentColor&&{primaryColor:h.accentColor},...h?.backgroundColor&&{backgroundColor:h.backgroundColor},...h?.textColor&&{textColor:h.textColor}};this.#Ma?h&&function(e){const t=document.documentElement,n=Cn(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)}(p):(Ln(p),this.#Ma=!0),u.debug("Fetching offers");const f="strict"===this.#$a.getUnlockMode(),y="reduceChurn"===a,w=this.#Ia,x=async e=>{y&&!this.#Tl&&this.#Vl();const t=e&&!y?this.#al(a,i):void 0,n=S(i),o=n&&this.#cl?.has(n)?n:void 0,[{offers:s}]=await Promise.all([w.fetchOffers(this.#dl(),!0,i,f?15e3:void 0,{...d&&this.#$a.getFilterOffersByVariant()&&{variantId:d},...a&&{useCase:a},...o&&{ruledPlacementId:o},...r&&{fromTrigger:!0}}),y?this.#uc():t]);return t&&(l=await t??l),s},k=this.#Ol,$=this.#g;let C=await x(!1);this.#Ol===k&&this.#g===$||(u.debug("Language or user changed while fetching offers; fetching again"),C=await x(!0));const E="rewardUsers"===a?ul(l?.variantName):null,T=null!==E||"rewardUsers"===a&&hl(l?.variantName);if(s&&!s())return u.debug("Trigger sheet no longer wanted; not shown"),{result:{status:"unavailable"},presentationId:t,aborted:!0};if(0===C.length)return u.info("No offers available"),this.#E&&this.#g&&this.#E.track(W(this.#g,"no_offer_available",t,d,a,i,g)),{result:{status:"unavailable"},presentationId:t,...void 0!==d&&{variantId:d},override:{notPresentedReason:"no_offer_available"}};const A={...this.#gl,...c.title&&{titleText:c.title,customHeadline:c.title},...c.subtitle&&{subtitleText:c.subtitle,customSubheadline:c.subtitle}};this.#Ia.beginPresentation(d,a,i,t,g);const L=new Map;C.forEach(e=>{L.set(e.id,te())});const U=e=>{let t=L.get(e);return t||(t=te(),L.set(e,t)),t};this.#E&&this.#g&&this.#E.track(function(e,t,n,i,r,o,s){return{name:"sdk_offer_presentation_success",distinctId:e,properties:{presentationId:t,offerCount:n,...i&&{variantId:i},...s&&{experimentId:s},...F(r),...P(o)}}}(this.#g,t,C.length,d,a,i,g));const R=(e,n)=>({campaignId:e.campaignId,...e.creativeId&&{creativeId:e.creativeId},...null!=e.merchantName&&{advertiserName:e.merchantName},impressionId:U(e.id),offerIndex:n,totalOffers:C.length,presentationId:t,...d&&{variantId:d},...a&&{useCase:a},...i&&{placementId:i}}),z=new Hs;b.push(()=>z.destroy());const j=y?this.#kl:l?.template,D=y?this.#xl:l?.values;let B=!1;const H=T?void 0:this.#$c({offers:C,impressions:z,template:j,values:D,useCase:a,placementId:i,presentationId:t,appearance:n?.appearance,headline:n?.headline,subheadline:n?.subheadline,variantId:d});T||!j||H||m||this.#kc(d,"it passed its checks but failed to mount");const _=E,V=()=>{const e=this.#Cc(),t=I(e.logoUrl,l?.values?.media?.appstoreIcon??void 0),n=I(e.appDisplayName,l?.values?.text?.appName??void 0);return{...t&&{hostIconUrl:t},...n&&{hostName:n}}};let q=null,K=null;switch(_){case"giftReveal":q={kind:_,surface:new Tl(C,{impressions:z,claimEnabled:this.#ti,trustText:sl.trustUnknown})};break;case"giftList":{const{hostIconUrl:e,hostName:t}=V();q={kind:_,surface:new zl(C,{impressions:z,claimEnabled:this.#ti,...e&&{hostIconUrl:e},...t&&{hostName:t}})};break}case"giftUnwrap":case"shareFromHeader":case"shareForLater":{const e="shareFromHeader"===_?"header":"shareForLater"===_?"forLater":null;q={kind:"giftUnwrap",share:e,surface:new Ql(C,{impressions:z,claimEnabled:this.#ti,...h?.claimButton&&{claimSlot:h.claimButton},...e&&{share:e}})};break}case"giftPicker":case"codeUnlock":{const e=V();if(q={kind:"giftPicker",surface:new Nl(C,{impressions:z,claimEnabled:this.#ti,trustText:sl.trustUnknown,...e})},"codeUnlock"===_)try{const t=n?.unlockCode,i=n?.unlockValueLabel,r=n?.unlockCardImageUrl,o=n?.unlockCardImageAlt;K=new fc({..."string"==typeof t&&{initialCode:t},..."string"==typeof i&&{valueLabel:i},..."string"==typeof r&&{cardImageUrl:r},..."string"==typeof o&&{cardImageAlt:o},...h?.codeUnlock&&{appearance:h.codeUnlock},offers:C,...e.hostName&&{hostName:e.hostName},...e.hostIconUrl&&{hostIconUrl:e.hostIconUrl},onUnlock:()=>z.recheck()})}catch(e){u.warn("Code unlock screen unavailable; showing the gift picker",e)}break}}const ne="giftReveal"===q?.kind&&q.surface.hasMoreGifts(),ie="giftPicker"===q?.kind&&q.surface.hasMoreGifts(),re="giftUnwrap"===q?.kind?q.share:null,oe="giftUnwrap"===q?.kind&&"forLater"===q.share?q.surface:null,se=e=>{if(!oe||oe.isKeepForLaterOpen())return!1;const n=document.activeElement,r=n instanceof HTMLElement&&n!==document.body?n:ae.getCloseButton()??void 0;return!!oe.openKeepForLater(r)&&("close"!==e||this.#ol(e=>J(e,{...d&&{variantId:d},actionType:"setState",presentationId:t,currentState:"carousel",useCase:a,...i&&{placementId:i}})),!0)},ae=new Fn({},{...H?{sdui:!0}:{},...H&&{sheet:{detents:()=>B?null:function(e,t){if("object"!=typeof e||null===e)return null;const n=e;if("fullScreenCover"===n.presentationStyle)return null;const i=n.stateDetents,r=(i&&"object"==typeof i?Un(i[t]):void 0)??Un(n.presentationDetents)??[...Mn],o=[...new Set(r)].sort((e,t)=>e-t);return 0===o.length||o.every(e=>e>=1)?null:o}(j,H.currentState??""),...fd(j)}},showCloseButton:!H&&("rewardUsers"!==a||ne||ie||"giftList"===q?.kind||"giftUnwrap"===q?.kind||null!==K),...!1===n?.dismissible&&{dismissible:!1},..."header"===re&&{closePosition:"start"},...oe&&{interceptDismiss:se},...h?.modalBackgroundColor&&{backgroundColor:h.modalBackgroundColor},...this.#ml&&{mount:this.#ml.mount}}),le={rewardActions:null,confetti:null},ce=H??q?.surface??new Ra(C,A,"rewardUsers"===a?{impressions:z,mode:"paged",hideHeader:!0,selectable:!0,claimEnabled:this.#ti,...h?.dotColor&&{dotColor:h.dotColor},...h?.dotActiveColor&&{dotActiveColor:h.dotActiveColor}}:{impressions:z,claimEnabled:this.#ti});if(ae.onVisibilityChange(e=>z.setContainerVisible(e)),b.push(()=>ae.destroy()),b.push(()=>ce.destroy()),b.push(()=>le.rewardActions?.destroy()),b.push(()=>le.confetti?.destroy()),b.push(()=>K?.destroy()),this.#ti&&!this.#ml){const e=new cl;b.push(()=>e.destroy()),ce.on("offerSelect",t=>e.point(t.offer.advertiserUrl))}const ue=await new Promise(r=>{let s=!1,p=null,f=null,m=!1;const g=(e,n)=>{if(s)return;p?.inFlight()&&p.cancel(),s=!0;const i=n??(!n&&m&&"dismissed"===e.status?{advertiserOutcome:"failed"}:void 0);"claimed"===e.status&&this.#Ia?.endPresentation(void 0,a),r({result:e,presentationId:t,...void 0!==d&&{variantId:d},...i&&{override:i}})};this.#ml&&(this.#ml.end=()=>{g({status:"dismissed",reason:"userClosedModal"}),ae.destroy(),v()});let y=null,w="carousel";ce.on("offerClaim",n=>{if(this.#ml)return;if(f&&!p?.abandoned()||p?.inFlight())return void u.debug("Claim tap ignored: a claim is already in flight");const r=Symbol("claim"),o=n.offer;u.debug("User claimed offer",{offerId:o.id});const s=R(o,n.index);this.#Ia?.trackOfferPresented(o,U(o.id),n.index,C.length,a,"claim",Xt(o)),this.#ol(e=>function(e,t){return{name:"sdk_offer_claim_tapped",distinctId:e,properties:G(t)}}(e,s)),H||this.#ol(e=>J(e,{...d&&{variantId:d},actionType:"claimOffer",presentationId:t,currentState:"carousel",useCase:a,...i&&{placementId:i}}));const c=this.#Sc(a,l?.fromPlacement?l.values:void 0),h=de(c)?null:this.#pc(),v=!de(c)&&"rewardUsers"===a&&(x=l?.variantName,"string"==typeof x&&pl.has(x))?this.#Ec(h,o,{onAbandon:()=>{m=!0,this.#ol(e=>Y(e,s,{reason:O,errorDescription:"claim screen closed before the transaction returned"}))},onCover:e=>z.setContainerVisible(!e),sheet:$.closest(`.${On("modal")}`)}):null;var x;v&&(p=v,b.push(()=>v.cancel())),f=r,(async()=>{try{const e=U(o.id),t=n.index,r=await this.#Tc(o,e,t,C.length,a,v?()=>v.abandoned():void 0);if(v?.abandoned())return void this.#Ac(h);const p=this.#Lc(o,r);if(y=p,ae.unlockClose(),de(c)){const e=this.#Oc(c,o,r,a,i,o.perk);return l?.fromPlacement&&this.#El.set(e.id,d),this.#Ia?.endPresentation(void 0,a),w="primer",re&&ae.setCloseButtonHidden(!1),this.#Nc(ae,e,()=>{g(p),ae.hide()}),void(H&&(B=!0,ae.refreshSheet()))}if(this.#fc(o,r,a,h,s)?v?.handedOff():v&&(this.#Ac(h),v.remove()),H&&n.successState)return u.debug("Post-claim state authored; keeping the sheet up",{state:n.successState}),void H.applyTransition(n.successState);this.#Ia?.endPresentation(void 0,a),ae.hide(),g(p)}catch(t){if(v?.abandoned())return void this.#Ac(h);const n=!y&&ee(t);n?u.info("Claim refused: offer already completed",{offerId:o.id}):(u.error("Error creating transaction",{offerId:o.id,error:t}),this.#Wl("start_transaction",t)),y||this.#ol(e=>Y(e,s,{reason:this.#Ia?O:"manager_unavailable",errorDescription:t instanceof Error?t.message:"Transaction failed"})),this.#Ac(h),v?.remove(),this.#Ia?.endPresentation("error",a),ae.hide(),y?g(y):g(n?{status:"dismissed",reason:"alreadyCompleted"}:{status:"dismissed",reason:{type:"error",error:{code:e.UNKNOWN_ERROR,message:t instanceof Error?t.message:"Transaction failed"}}},{advertiserOutcome:"failed",dismissal:"interrupted"})}finally{f===r&&(f=null)}})()}),ce.on("complete",e=>{e.claimed||this.#ml||(u.debug("User declined last offer"),this.#Ia?.endPresentation("userDeclinedLastOffer",a),ce.destroy(),ae.hide(),g({status:"dismissed",reason:"userDeclinedLastOffer"}))});const x=(e=!0)=>{if(e&&this.#ol(e=>J(e,{...d&&{variantId:d},actionType:"close",presentationId:t,currentState:H&&!B?H.currentState??w:w,useCase:a,...i&&{placementId:i}})),y)return ce.destroy(),void g(y);u.debug("User closed modal"),this.#Ia?.endPresentation("userClosedModal",a),ce.destroy(),g({status:"dismissed",reason:"userClosedModal"})};if(ae.on("close",()=>x()),H?.onRequestClose(()=>{!1!==n?.dismissible||y?(x(!1),ae.hide()):u.debug("Close request ignored: the presentation is not dismissible")}),H?.onShare(e=>{const t=R(e.offer,e.index);this.#ol(n=>{switch(e.kind){case"tapped":return Z(n,t);case"failed":return Q(n,t,{reason:e.reason});case"completed":return X(n,t,{completed:e.completed,...e.destination&&{shareDestination:e.destination}})}})}),ae.on("backdropClick",()=>{if(y)return ce.destroy(),ae.hide(),void g(y);u.debug("User clicked outside modal"),this.#Ia?.endPresentation("userClickedOutside",a),ce.destroy(),ae.hide(),g({status:"dismissed",reason:"userClickedOutside"})}),"giftUnwrap"===q?.kind&&q.share){const e=q.surface,n="forLater"===q.share,r=zs({tapped:e=>this.#ol(t=>Z(t,e)),failed:(e,t)=>this.#ol(n=>Q(n,e,{reason:t})),completed:(e,t,n)=>this.#ol(i=>X(i,e,{...t&&{shareDestination:t},completed:n}))}),o=()=>{if(!s){if(y)return ce.destroy(),g(y),void ae.hide();this.#Ia?.endPresentation("userClosedModal",a),ce.destroy(),g({status:"dismissed",reason:"userClosedModal"}),ae.hide()}};let l=null;b.push(()=>{null!==l&&clearTimeout(l)}),e.onShareEvent("offerShare",({offer:s,index:c})=>{if(this.#ml)return;const u=r.run(s.shareUrl,R(s,c));u&&(this.#ol(e=>J(e,{...d&&{variantId:d},actionType:"share",presentationId:t,currentState:w,useCase:a,...i&&{placementId:i}})),u.then(t=>{if("failed"===t.status&&t.reason===N&&e.showShareNotice(Dl.unavailable),"shared"!==t.status)return;const i=t.destination===M;i&&e.showShareNotice(Dl.copied),n&&(r.lock(),i?(e.lockKeepForLater(),l=setTimeout(o,1500)):o())}))}),e.onShareEvent("closeRequest",()=>{x(),ae.hide()})}if(ce.on("offerView",e=>{const{offer:t}=e,n=U(t.id);this.#Ia&&this.#Ia.trackOfferPresented(t,n,e.index,C.length,a,void 0,Xt(t))}),ce.on("scroll",e=>{this.#ol(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,...F(t.useCase),...P(t.placementId)}}}(n,{...d&&{variantId:d},scrollAxis:e.axis,scrollPosition:e.position,presentationId:t,useCase:a,...i&&{placementId:i}}))}),ae.on("hide",()=>{g(y||{status:"dismissed",reason:"userClosedModal"})}),"rewardUsers"===a){const e=C[0]?.termsUrl,t="giftList"===q?.kind||"giftUnwrap"===q?.kind?Ml({...e&&{termsUrl:e}}):"giftPicker"===q?.kind?Ml({template:ua.pickerTermsLine,linkText:ua.pickerTermsLink,...e&&{termsUrl:e}}):null,i=new ll({onClaim:()=>"giftUnwrap"===q?.kind?q.surface.showReady():ce.claimSelected(),onDecline:()=>{this.#ml||(x(),ae.hide())},claimEnabled:this.#ti,useCase:a,..."giftReveal"===q?.kind&&{...C[0]&&{primaryLabel:ga(C[0])},termsText:ua.terms},..."giftList"===q?.kind&&{...C[0]&&{primaryLabel:ga(C[0])},showTrust:!1,...t&&{termsElement:t}},..."giftPicker"===q?.kind&&{...C[0]&&{primaryLabel:ga(C[0],"Get")},showTrust:!1,...t&&{termsElement:t}},..."giftUnwrap"===q?.kind&&{primaryLabel:jl.continue,showTrust:!1,...t&&{termsElement:t}},..."giftList"===q?.kind||"giftUnwrap"===q?.kind?{secondary:"none"}:"giftPicker"===q?.kind?ie||!1===n?.dismissible?{secondary:"none"}:{}:"giftReveal"===q?.kind?ne?{secondary:"more",onMore:()=>q.surface.openSheet(i.getSecondaryElement())}:!1===n?.dismissible?{secondary:"none"}:{}:!1===n?.dismissible?{secondary:ce.getTotalOffers()>1?"next":"none",onNext:()=>ce.getCurrentIndex()>=ce.getTotalOffers()-1?ce.selectOffer(0):ce.next()}:{},...h?.claimButton&&"giftUnwrap"!==q?.kind&&{claimSlot:h.claimButton},...h?.declineButton&&{declineSlot:h.declineButton}});le.rewardActions=i,ce.on("offerSelect",e=>{"giftUnwrap"!==q?.kind&&i.setSelectedOffer(e.offer.merchantName),i.setTrustText(Na(e.offer)?"giftReveal"===q?.kind?ua.finePrint:sl.trust:sl.trustUnknown),"giftReveal"!==q?.kind&&"giftList"!==q?.kind||i.setPrimaryLabel(ga(e.offer)),"giftPicker"===q?.kind&&i.setPrimaryLabel(ga(e.offer,"Get")),t&&Ul(t,e.offer.termsUrl)})}ae.show();try{o?.()}catch(e){u.warn("Encore.triggers: onPresented failed",e)}const k=K?void 0:"giftReveal"===q?.kind||"giftList"===q?.kind||"giftUnwrap"===q?.kind||"giftPicker"===q?.kind?q.surface.renderHero():void 0,$=ce.render();let S;if("rewardUsers"===a&&l&&!H){const e=l.values?.text,t=I(el(h?.headline),c.title,K?void 0:e?.rewardHeadline)??(K?uc.offersHeadline:q?ua.headline:Jc.headline),i=I(el(h?.subheadline),c.subtitle,K?void 0:e?.rewardSubheadline)??(K?uc.offersSubline:q?ua.subline:Jc.subheadline),r=()=>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=`${On("thankyou")} ${On("thankyou--reward")}${c?` ${On("thankyou--gift")}`:""}${d?` ${On(`thankyou--${d}`)}`:""}`,l&&f.appendChild(l);const m=document.createElement("div");if(m.className=On("thankyou-status"),"success"===r){const e=document.createElement("span");e.className=On("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>',m.appendChild(e)}if(n){const e=document.createElement("h2");e.className=On("thankyou-title"),e.id=ol,e.textContent=n;const t=Ja(e,n,p,s);h&&t===e&&0===t.childElementCount&&ka(t,t.textContent??"",On("gift-em")),m.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=On("thankyou-subtitle"),e.textContent=i??"";const t=Ja(e,i??"",p,a);(t.textContent?.trim()||t.childElementCount>0)&&m.appendChild(t)}return f.appendChild(m),f.appendChild(e),o&&f.appendChild(o),f}($,{...k&&{hero:k},..."giftReveal"===q?.kind&&{giftMode:!0},..."giftList"===q?.kind&&{rootModifier:"gift-list",emphasizeFree:t===ua.headline},..."giftUnwrap"===q?.kind&&{rootModifier:"gift-unwrap",emphasizeFree:t===ua.headline},..."giftPicker"===q?.kind&&{rootModifier:"gift-picker",emphasizeFree:!0},title:t,...i&&{subtitle:i},...n?.statusIcon&&{statusIcon:n.statusIcon},...le.rewardActions&&{actions:le.rewardActions.render()},useCase:a,...h?.headline&&{headlineSlot:h.headline},...h?.subheadline&&{subheadlineSlot:h.subheadline}});if(K)try{S=K.compose({title:t,...i&&{subtitle:i},surface:$,...le.rewardActions&&{actions:le.rewardActions.render()}},{setLabelledBy:e=>ae.setLabelledBy(e)})}catch(e){u.warn("Code unlock page failed to render; showing the gift picker",e),K.destroy(),K=null,S=r()}else S=r();K||ae.setLabelledBy(ol)}else S=$;if("giftUnwrap"===q?.kind&&(S=q.surface.compose(S,{setLabelledBy:e=>ae.setLabelledBy(e),...q.share&&{onScreenChange:e=>ae.setCloseButtonHidden("ready"===e)}})),ae.setContent(S),this.#ml?.mounted(),H){const e=H.frame();ae.setSduiFrame(e.background,e.scheme);const t=()=>{const e=H.canvasColor();e&&ae.setBackdropTint(e)};requestAnimationFrame(t),H.onStateChange(()=>{ae.refreshSheet(),setTimeout(t,300)})}if("rewardUsers"===a&&!q&&!H){const e=new es;le.confetti=e;const t=S;requestAnimationFrame(()=>e.start(t))}});return v(),ue}catch(n){return u.error("Error in offer flow",n),this.#Wl("present_offer_initialization",n),v(),{result:{status:"dismissed",reason:{type:"error",error:{code:e.UNKNOWN_ERROR,message:n instanceof Error?n.message:"Unknown error"}}},presentationId:t,...void 0!==d&&{variantId:d},override:{advertiserOutcome:"not_attempted",dismissal:"interrupted"}}}}#Lc(e,t){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.");const n={status:"claimed",offerId:e.id,campaignId:e.campaignId,advertiserName:e.merchantName??"",...t&&{transactionId:t}};return this.#za.set(n,{...e.logoUrl&&{logoUrl:e.logoUrl},...e.perk&&{perk:e.perk}}),n}async#Tc(e,t,n,i,r,o){if(!this.#Ia)throw new Error("OfferManager not initialized");const s=await this.#Ia.startTransaction(e.campaignId,r);if(o?.())return u.debug("Transaction returned after the claim was abandoned",{transactionId:s}),s;const a=this.#Ia.placementId;return this.#Ta?.notePending(s,{grantsEntitlement:rd(r),...void 0!==r&&{useCase:r},...void 0!==a&&{placementId:a}}),this.#Ia.trackOfferClaimed(e,t,s,n,i,r),u.debug("Transaction created",{transactionId:s}),s}#fc(e,t,n,i,r){const o=this.#Mc(e.advertiserUrl,e.trackingParameters,t),s=this.#Uc(o);r&&this.#ol(e=>function(e,t,n){return{name:"sdk_offer_webview_attempting_open",distinctId:e,properties:{...G(t),url:n.url,urlHost:n.urlHost}}}(e,r,{url:o,urlHost:s}));const a=this.#Rc(i,o);return a||u.warn("Failed to open advertiser URL (popup blocked?)"),r&&(a?(this.#ol(e=>function(e,t,n){return{name:"sdk_offer_webview_opened",distinctId:e,properties:{...G(t),url:n.url,urlHost:n.urlHost,openedAt:n.openedAt}}}(e,r,{url:o,urlHost:s,openedAt:(new Date).toISOString()})),this.#Fc(r,t)):this.#ol(e=>function(e,t,n){return{name:"sdk_offer_webview_load_failed",distinctId:e,properties:{...G(t),url:n.url,urlHost:n.urlHost,loadSuccess:!1,reason:n.reason}}}(e,r,{url:o,urlHost:s,reason:"popup_blocked"}))),a&&this.#Pc(t,r),rd(n)&&"strict"!==this.#$a.getUnlockMode()&&this.didGrant("provisional",t),a}#ql(){this.#Ta&&(this.#Ea?.start(()=>{this.#rc()}),this.#rc())}async#rc(){const e=this.#Ta;if(!e||this.#Ua)return;const t=e.getPending();if(t&&!this.#Aa.has(t.transactionId)){u.debug("Strict unlock: reconciling pending claim",{transactionId:t.transactionId}),this.#Aa.add(t.transactionId);try{"verified"===await e.verify(t.transactionId)&&this.#zc(t.transactionId)}finally{this.#Aa.delete(t.transactionId)}}}#Pc(e,t){const n=this.#Ta;n&&!this.#Aa.has(e)&&(this.#Aa.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.#zc(e,t)}finally{this.#Aa.delete(e)}})())}#zc(e,t){const n=this.#Ta?.getPending();n?.transactionId===e?(this.#Ta?.clearPending(),n.grantsEntitlement&&this.didGrant("final",e),this.#ol(i=>function(e,t,n){return{name:"sdk_offer_verified",distinctId:e,properties:{...n?G(n):{},transactionId:t.transactionId,...F(t.useCase),...P(t.placementId)}}}(i,{transactionId:e,...void 0!==n.useCase&&{useCase:n.useCase},...void 0!==n.placementId&&{placementId:n.placementId}},t)),this.#Ye.emit("strictUnlockVerified",e),u.debug("Strict unlock: claim verified",{transactionId:e}),this.#Pa.finish(e),this.#fl()):u.debug("Strict unlock: verification superseded by a newer claim",{transactionId:e})}#Uc(e){try{return new URL(e).hostname}catch{return""}}#Fc(e,t){if("undefined"==typeof window||"undefined"==typeof document)return;const n=this.#g;if(this.#E&&n)try{this.#Nl?.();const i=Date.now();let r=!1;const o=()=>{window.removeEventListener("focus",s),document.removeEventListener("visibilitychange",s),this.#Nl===o&&(this.#Nl=null)},s=()=>{if(r||"visible"!==document.visibilityState)return;r=!0,o();const s=(Date.now()-i)/1e3;this.#E?.track(function(e,t,n){return{name:"sdk_offer_claim_returned",distinctId:e,properties:{...G(t),...n.transactionId&&{transactionId:n.transactionId}}}}(n,e,{transactionId:t})),this.#E?.track(function(e,t,n){return{name:"sdk_offer_webview_dismissed",distinctId:e,properties:{...G(t),timeSpentSeconds:n.timeSpentSeconds}}}(n,e,{timeSpentSeconds:s}))};window.addEventListener("focus",s),document.addEventListener("visibilitychange",s),this.#Nl=o}catch{}}#ol(e){const t=this.#g;this.#E&&t&&this.#E.track(e(t))}#Mc(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)}}#pc(){try{return window.open("","_blank")}catch(e){return u.error("Failed to open blank advertiser window",{error:e}),null}}#Rc(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}}#Ec(e,t,n){const{onAbandon:i,onCover:r,sheet:o}=n;try{const s=function(e){if(!e)return null;try{const t=e.document;return"object"!=typeof t||null===t?null:"function"==typeof t.createElement&&t.body?t:null}catch{return null}}(e);if(s&&e){vl(s,t,"tab");let C=!1,I=!1,S=!1;const E=setInterval(()=>{e.closed&&A()},500),T=()=>clearInterval(E),A=()=>(C||I||S||!e.closed||(C=!0,T(),i()),C);return{inFlight:()=>!I&&!S&&!A(),handedOff:()=>{I=!0,T()},remove:()=>{S=!0,T()},cancel:()=>{if(T(),!(I||S||C)){C=!0;try{e.close()}catch{}i()}},abandoned:A}}const a=document.activeElement,l=vl(document,t,"inPage",o??void 0),c=o?Array.from(o.children).filter(e=>e instanceof HTMLElement&&e!==l&&!e.hasAttribute("inert")):[];for(const L of c)L.toggleAttribute("inert",!0);const d=c.filter(e=>!e.hasAttribute("aria-hidden"));for(const O of d)O.setAttribute("aria-hidden","true");r(!0),l.tabIndex=-1,l.focus({preventScroll:!0});let h=null,p=!1,f=!1,m=!1,g=null;const y=()=>{for(const e of c)e.toggleAttribute("inert",!1);for(const e of d)e.removeAttribute("aria-hidden")},b=(e=!1)=>{m=!0,k(),null!==h&&clearTimeout(h),h=null,y();const t=l.contains(document.activeElement);l.remove(),e&&r(!1),t&&a instanceof HTMLElement&&a.isConnected&&a.focus({preventScroll:!0})},v=null!==e&&!wl(e),w=()=>{if(!v||f||m||p)return;let t=!1;try{t=e.closed}catch{}t&&(p=!0,b(!0),i())},x=v?setInterval(w,500):null;function k(){null!==x&&clearInterval(x)}function $(){if(v)try{e?.close()}catch{}}return h=setTimeout(()=>{h=null,g=function(e){const t=e.ownerDocument.createElement("button");return t.type="button",t.className=`${gl}close`,t.setAttribute("aria-label",Ee("modal.close","Close modal")),t.textContent="×",t.addEventListener("click",()=>{f||(p=!0,b(!0),$(),i())}),e.appendChild(t),t.focus({preventScroll:!0}),t}(l)},8e3),{inFlight:()=>(w(),!f&&!m&&!p),handedOff:()=>{if(f=!0,k(),null!==h&&clearTimeout(h),h=null,g?.remove(),wl(e)&&o){y(),l.classList.remove(yl),document.body.appendChild(l);const e=()=>{clearTimeout(t),window.removeEventListener("pagehide",e),this.#ka.delete(e),l.remove()};this.#ka.add(e);const t=setTimeout(e,1e4);window.addEventListener("pagehide",e,{once:!0})}},remove:()=>b(),cancel:()=>{f||p||m||(p=!0,b(),$(),i())},abandoned:()=>(w(),p)}}catch(N){return u.warn("Claim screen could not be drawn",{error:N}),null}}#Ac(e){try{e?.close()}catch(e){u.error("Failed to close advertiser window",{error:e})}}#dc(e){const t=[this.#Ml,this.#Ul].map(t=>{const n=e?t.getByPlacement(e):t.getLatest();return n?{transaction:td(n),store:t}:null}).filter(e=>null!==e);return t.sort((e,t)=>fe(t.transaction)-fe(e.transaction))[0]??null}#Sc(e,t){return function(e,t){return function(e){if(!e||"object"!=typeof e)return;const t=e.claimBehavior;return he.includes(t)?t:void 0}(t)??ue[e]}(e,"reduceChurn"===e?this.#xl:t??this.#$l[e]?.values)}#Oc(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},freeTrial:Na(t)},useCase:i,status:"claimed",createdAt:new Date(s).toISOString(),expiresAt:new Date(s+6048e5).toISOString()};return("deferredWhileAlive"===e?this.#Ul:this.#Ml).save(a),a}#Cc(){return function(e){const t=ze(e.appName),n=function(e){const t=ze(e.entitlementValue),n=ze(e.entitlementUnit);if(!t||!n)return;const i=n.endsWith("s")?n.slice(0,-1):n,r=Number(t),o=i.toLowerCase(),s=Pe[o];return s&&Number.isFinite(r)?Te(`unit.${o}`,r,s):`${t} ${1===r?i:`${i}s`}`}(e),i=ze(e.appIconUrl);return{...t&&{appDisplayName:t},...n&&{trialPeriod:n},...i&&{logoUrl:i}}}(this.#vl)}#Nc(e,t,n){const i=this.#Cc();try{const r=new Da({variant:i.appDisplayName?"activation":"holding",display:i,partner:{freeTrial:!0===t.offer.freeTrial,...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()}}#hc(e,t,n,i){try{const{reward:a,advertiserName:l,logoUrl:c,imageUrl:d,freeTrial:h}=t.offer,p=this.#Cc(),f=n?.name??p.appDisplayName;let m={};if("rewardUsers"!==t.useCase&&f){const e=this.#vl.trialDurationDays,t=e?(r=new Date(Date.now()+24*e*60*60*1e3),Ee("redemption.freeUntil","Free until ${date}",{date:(o=r,s={month:"long",day:"numeric",year:"numeric"},new Intl.DateTimeFormat(Re(),s).format(o))})):void 0,i=n?.logoUrl??p.logoUrl;m={host:{name:f,...p.trialPeriod&&{trialPeriod:p.trialPeriod},...n?.status&&{status:n.status},...t&&{detail:t},...i&&{logoUrl:i}}}}const g=new Wa({variant:m.host?"activation":"reward",freeTrial:!0===h,...a&&{reward:a},...l&&{advertiserName:l},...c&&{logoUrl:c},...d&&{imageUrl:d},...m});g.on("continue",()=>{g.destroy(),i()}),e.setContent(g.render()),u.debug("Redemption screen displayed",{transactionId:t.id})}catch(e){u.error("Failed to show redemption screen",e),i()}var r,o,s}static runPreview(e,t,n){const i=new pd;i.#ml=e,i.#g="encore-preview",i.#m=t;const r=new ne(i.#m,i.#g,{track:()=>{}});return i.#Ia=r,{flow:i.#cc(te(),{useCase:n}).finally(()=>r.destroy()),stop:()=>{i.#g=null,e.end?.(),r.destroy()}}}}function fd(e){const t=e?.cornerRadius;return"number"==typeof t&&Number.isFinite(t)?{cornerRadius:t}:{}}new pd;const md=/^[a-z][A-Za-z0-9]{0,31}$/,gd="values.",yd=["headline","subheadline","cta"],bd=/[\u0000-\u001F\u007F-\u009F\u2028\u2029]/,vd=/^[\p{N}\p{P}\p{S} ]+$/u;function wd(e){return"string"==typeof e&&e.length>=1&&e.length<=64&&!e.includes("${")&&!bd.test(e)}function xd(e){return wd(e)&&vd.test(e)}function kd(e){const t=Object.create(null),n="object"==typeof e&&null!==e?e.values:void 0;if("object"!=typeof n||null===n||Array.isArray(n))return t;for(const[e,i]of Object.entries(n))md.test(e)&&xd(i)&&(t[e]=i);return t}function $d(e){const t=[];for(const n of e.matchAll(/\$\{values\.([^}]*)\}/g))t.push(n[1]);return t}function Cd(e,t,n,i){let r=!1;const o=e.replace(/\$\{(values\.[^}]*|advertiserName|claimCount)\}/g,(e,i)=>{if(i.startsWith(gd)){const n=Object.prototype.hasOwnProperty.call(t,i.slice(7))?t[i.slice(7)]:void 0;return void 0===n?(r=!0,e):n}return("advertiserName"===i?n.advertiserName:n.claimCount)??e});return r?i??"":o}function Id(e){const t=Object.create(null),n="object"==typeof e&&null!==e?e.strings:void 0;if("object"!=typeof n||null===n||Array.isArray(n))return t;for(const[e,i]of Object.entries(n))"string"==typeof i&&(t[e]=i);return t}const Sd={elements:["text","systemImage","asyncImage","button","vStack","hStack","zStack","spacer","shape","gradient","forEach","conditional","group","empty","progress","marquee"],fields:{text:["text","countdown","font","color","lineLimit","minimumScaleFactor","multilineAlignment","segments","scaleGroup","style"],systemImage:["systemName","font","color","style"],asyncImage:["url","contentMode","placeholderColor","fallback","style"],button:["content","action","disabled","accessibilityLabel","accessibilityHint","pressedStyle","style"],vStack:["alignment","spacing","children","style"],hStack:["alignment","spacing","children","style"],zStack:["alignment","children","style"],spacer:["minLength"],shape:["type","cornerRadius","fillColor","strokeColor","strokeWidth","style"],gradient:["type","direction","colors","startRadius","endRadius","style"],forEach:["dataSource","list","itemTemplate","limit","offset"],conditional:["condition","ifTrue","ifFalse"],group:["content","style"],empty:[],progress:["value","fillColor","trackColor","style"],marquee:["axis","duration","reverse","spacing","animateWhen","content","style"]},style:["padding","frame","cornerRadius","backgroundColor","shadow","opacity","clipShape","clipped","borderWidth","borderColor","offset","scale","rotation","overlay","backgroundElement","fixedSize","layoutPriority","stateStyles","stateAnimation","loop","layoutDirection","accessibilityHidden"],actions:["trigger","dismissTrigger"],targets:["card","arrow","button"],symbols:["gift","gift.fill","chevron.forward","arrow.forward","xmark"],conditions:["hasValue","valueEquals","stateEquals","and","or","not","listCountAtLeast"],appearance:["background","onBackground","surface","onSurface","accent","onAccent","inkOnAccent","border","secondary","track","backgroundEnd"],countdownFormats:["clock","hoursMinutes","hours","minutes","seconds","largestUnit"],curves:["linear","easeIn","easeOut","easeInOut"],shapeTypes:["rectangle","roundedRectangle","circle","capsule","ellipse"],dataSources:["hostList"],values:{giftsButton:["title","subtitle","cta","layout","icon","appIconUrl","offersTitle"],claimReminder:["title","subtitle","cta","layout","dismiss","hours","minutes","seconds","advertiserName","advertiserInitial","advertiserLogoUrl","accessibilityTitle","icon","appIconUrl","offerTitle","titleMany","claimCount","perk","accessibilityHint","left"]},times:{giftsButton:[],claimReminder:["start","deadline"]},lists:{giftsButton:["offerLogos","offerLogosA","offerLogosB"],claimReminder:["claims","marqueeLogos","marqueeLogosA","marqueeLogosB"]},itemFields:{claims:["transactionId","advertiserName","advertiserInitial","advertiserLogoUrl"],marqueeLogos:["logoUrl"],marqueeLogosA:["logoUrl"],marqueeLogosB:["logoUrl"],offerLogos:["logoUrl","advertiserName","advertiserInitial"],offerLogosA:["logoUrl","advertiserName","advertiserInitial"],offerLogosB:["logoUrl","advertiserName","advertiserInitial"]},behavior:{giftsButton:{afterClaim:["showReminder","stay"],afterComplete:["gifts","hide","thanks"],autoOpen:["off","on"],reminderLayout:"layout"},claimReminder:{afterComplete:["hide","thanks"]},customClaim:{afterClaim:["showReminder","stay"],afterComplete:["gifts","hide","thanks"],autoOpen:["off","on"]}},ranges:{rootHeight:[1,240],"frame.width":[0,600],"frame.minWidth":[0,600],"frame.maxWidth":[0,600,"infinity"],"frame.height":[0,480],"frame.minHeight":[0,480],"frame.maxHeight":[0,480,"infinity"],padding:[0,64],cornerRadius:[0,240],"shadow.radius":[0,32],"shadow.x":[-32,32],"shadow.y":[-32,32],opacity:[0,1],offset:[-64,64],scale:[0,2],rotation:[-360,360],borderWidth:[0,16],strokeWidth:[0,16],layoutPriority:[-10,10],duration:[0,120],phaseOffset:[0,1],keyframeAt:[0,1],"font.size":[1,64],"font.tracking":[-8,8],spacing:[-16,64],spacerMinLength:[0,480],lineLimit:[1,10],minimumScaleFactor:[.5,1],gradientRadius:[0,480],count:[0,100],progressLiteral:[0,1]}},Ed=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function Td(e,t){const n=Ed(Sd.behavior,t)?Sd.behavior[t]:{},i={};for(const[e,t]of Object.entries(n))"layout"!==t&&(i[e]=t[0]);const r=e.behavior;if(!zd(r))return i;for(const[e,t]of Object.entries(r)){if(!Ed(n,e))continue;const r=n[e];("layout"===r?Od(t):"string"==typeof t&&r.includes(t))&&(i[e]=t)}return i}const Ad=/^[a-z][A-Za-z0-9]{0,31}$/,Ld=new Set(["auto","custom","thanks"]),Od=e=>"string"==typeof e&&Ad.test(e)&&!Ld.has(e),Nd=new Set(["version","trigger","layout","pin","useCases","windowHours","dismissible","maxFontScale","colors","lightColors","strings","root","values","behavior","textSlots"]),Md=new Set(["background","accent","text"]),Ud=/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Rd=/\$\{([^}]+)\}/g,Fd=/\p{L}/u,Pd=e=>"string"==typeof e?e:JSON.stringify(e)??"undefined",zd=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),jd=e=>new Set(e),Dd=jd(Sd.elements),Bd=Object.fromEntries(Object.entries(Sd.fields).map(([e,t])=>[e,jd(t)])),Hd=jd(Sd.style),_d=jd(Sd.actions),Vd=jd(Sd.targets),qd=jd(Sd.symbols),Wd=jd(Sd.conditions),Kd=jd(Sd.appearance),Gd=jd(Sd.countdownFormats),Yd=jd(Sd.curves),Zd=jd(Sd.shapeTypes),Qd=jd(Sd.dataSources),Xd=new Set(["text","accessibilityLabel","accessibilityHint"]),Jd=/^[a-z][A-Za-z0-9]{0,31}$/;function eu(e,t){const n=jd(Sd.values[t]),i=jd(Sd.times[t]),r=jd(Sd.lists[t]),o=Sd.itemFields;let s;const a=(e,t)=>{s??={reason:e,path:t}};if(!zd(e))return{reason:"template is not an object",path:"$"};for(const t of Object.keys(e))Nd.has(t)||a(`template key "${t}"`,`$.${t}`);for(const t of["colors","lightColors"]){const n=e[t];if(void 0!==n)if(zd(n))for(const[e,i]of Object.entries(n))Md.has(e)&&"string"==typeof i&&Ud.test(i.trim())||a(`${t} entry "${e}"`,`$.${t}.${e}`);else a(`${t} is not an object`,`$.${t}`)}const l=new Set;if(void 0!==e.values)if(zd(e.values)){const t=Object.entries(e.values);t.length>16&&a("more than 16 values","$.values");for(const[e,n]of t)md.test(e)&&!yd.includes(e)&&xd(n)?l.add(e):a(`value default "${e}"`,`$.values.${e}`)}else a("values is not an object","$.values");const c=new Map;if(zd(e.strings))for(const[t,n]of Object.entries(e.strings))if("string"==typeof n){c.set(t,n);for(const e of $d(n))l.has(e)||a(`"\${values.${e}}" has no default`,`$.strings.${t}`)}const d=e.root;if(!zd(d))return s??{reason:"no root",path:"$.root"};const u=Object.values(d)[0],h=zd(u)&&zd(u.style)&&zd(u.style.frame)?u.style.frame.height:void 0;if("number"==typeof h&&Number.isFinite(h)){const[e,t]=Sd.ranges.rootHeight;(h<e||h>t)&&a(`root frame.height ${h}`,"$.root")}else a("no numeric root frame.height","$.root");let p=!1;const f=(e,t,n)=>{if(void 0===e)return;const[i,r,o]=Sd.ranges[t];void 0!==o&&e===o||("number"==typeof e&&Number.isFinite(e)?(e<i||e>r)&&a(`${t} ${e} outside ${i} to ${r}`,n):a(`${t} ${Pd(e)} is not a number`,n))},m=(e,t)=>{if(zd(e)&&(f(e.scale,"scale",`${t}.scale`),f(e.opacity,"opacity",`${t}.opacity`),f(e.rotation,"rotation",`${t}.rotation`),zd(e.offset)))for(const n of["x","y"])f(e.offset[n],"offset",`${t}.offset.${n}`)},g=(e,t)=>{zd(e)&&(f(e.size,"font.size",`${t}.font.size`),f(e.tracking,"font.tracking",`${t}.font.tracking`))},y=new Map,b=(e,t,i,r=!1)=>{if("string"==typeof e)for(const s of e.matchAll(Rd)){const e=s[1];if(e.includes("publisherReward")&&a(`publisherReward token "\${${e}}"`,t),e.startsWith("item."))void 0===i?a(`"\${${e}}" outside a hostList row`,t):(o[i]??[]).includes(e.slice(5))||a(`item field "${e}"`,t);else if(e.startsWith(gd))r?a(`look value "\${${e}}" here`,t):l.has(e.slice(7))||a(`"\${${e}}" has no default`,t);else if(!n.has(e)){const n=c.get(e);void 0===n?a(`value "\${${e}}" this trigger does not provide`,t):r&&$d(n).length>0&&a(`look value through "\${${e}}" here`,t)}}},v=(e,t,n,i)=>{"string"==typeof e&&(Fd.test(e.replace(Rd,""))&&a(`literal ${t}`,n),b(e,n,i))},w=(e,t)=>{if(void 0!==e)if(zd(e)){void 0!==e.binding&&a("colour binding",t);for(const n of["opacity","lighten","darken"])f(e[n],"opacity",`${t}.${n}`);void 0===e.appearance||Kd.has(Pd(e.appearance))||a(`appearance token "${Pd(e.appearance)}"`,t)}else a("colour is not an object",t)},x=(e,t)=>{if(!zd(e))return void a("condition is not an object",t);const n=Object.entries(e);if(1!==n.length)return void a("condition must have one key",t);const[i,o]=n[0];if(Wd.has(i)){if("and"===i||"or"===i)Array.isArray(o)&&o.forEach((e,n)=>x(e,`${t}.${i}[${n}]`));else if("not"===i)x(o,`${t}.not`);else if("hasValue"===i&&"string"==typeof o&&o.startsWith(gd))a(`hasValue "${o}"`,t);else if("listCountAtLeast"===i){const e=zd(o)?o.list:void 0;"string"==typeof e&&r.has(e)||a(`list "${Pd(e)}"`,t),zd(o)&&f(o.min,"count",`${t}.listCountAtLeast.min`)}}else a(`condition "${i}"`,t)},k=(e,t)=>{"string"==typeof e&&i.has(e)||a(`time key "${Pd(e)}"`,t)},$=(e,t,n)=>{if(zd(e)){if(zd(e.frame))for(const n of["width","minWidth","maxWidth","height","minHeight","maxHeight"])f(e.frame[n],`frame.${n}`,`${t}.frame.${n}`);if(zd(e.padding))for(const[n,i]of Object.entries(e.padding))f(i,"padding",`${t}.padding.${n}`);if(f(e.cornerRadius,"cornerRadius",`${t}.cornerRadius`),zd(e.shadow)){for(const n of["radius","x","y"])f(e.shadow[n],`shadow.${n}`,`${t}.shadow.${n}`);f(e.shadow.opacity,"opacity",`${t}.shadow.opacity`)}m(e,t),f(e.borderWidth,"borderWidth",`${t}.borderWidth`),f(e.layoutPriority,"layoutPriority",`${t}.layoutPriority`),zd(e.clipShape)&&zd(e.clipShape.rectangle)&&f(e.clipShape.rectangle.cornerRadius,"cornerRadius",`${t}.clipShape.rectangle.cornerRadius`),zd(e.stateAnimation)&&f(e.stateAnimation.duration,"duration",`${t}.stateAnimation.duration`);for(const[i,r]of Object.entries(e))if(Hd.has(i)){if("backgroundColor"===i||"borderColor"===i)w(r,`${t}.${i}`);else if("shadow"===i&&zd(r))w(r.color,`${t}.shadow.color`);else if("overlay"===i||"backgroundElement"===i)C(r,`${t}.${i}`,n);else if("stateStyles"===i&&zd(r))for(const[e,i]of Object.entries(r))$(i,`${t}.stateStyles.${e}`,n);else if("loop"===i&&zd(r)){void 0===r.curve||Yd.has(Pd(r.curve))||a(`loop curve "${Pd(r.curve)}"`,`${t}.loop`);const e=Array.isArray(r.keyframes)?r.keyframes:[],n=e.map(e=>zd(e)?e.at:void 0),i=n.every((e,t)=>"number"==typeof e&&(0===t||e>=n[t-1]));(n.length<2||0!==n[0]||1!==n[n.length-1]||!i)&&a("loop keyframes",`${t}.loop.keyframes`),f(r.duration,"duration",`${t}.loop.duration`),f(r.phaseOffset,"phaseOffset",`${t}.loop.phaseOffset`),e.forEach((e,n)=>m(e,`${t}.loop.keyframes[${n}]`)),m(r.reducedMotion,`${t}.loop.reducedMotion`)}}else a(`style key "${i}"`,`${t}.${i}`)}},C=(e,t,n)=>{if(!zd(e)||1!==Object.keys(e).length)return void a("element must have one key",t);const[i,o]=Object.entries(e)[0],s=`${t}.${i}`,l=Bd[i];if(!Dd.has(i)||!l)return void a(`element "${i}"`,s);const c=zd(o)?o:{};for(const e of Object.keys(c))l.has(e)||a(`field "${i}.${e}"`,`${s}.${e}`);switch(void 0!==c.style&&$(c.style,`${s}.style`,n),i){case"text":{v(c.text,"text",`${s}.text`,n),Array.isArray(c.segments)&&c.segments.forEach((e,t)=>v(zd(e)?e.text:void 0,"segment",`${s}.segments[${t}]`,n));const e=c.countdown;if(zd(e)&&(Gd.has(Pd(e.format))||a(`countdown format "${Pd(e.format)}"`,`${s}.countdown`),k(e.to,`${s}.countdown.to`),zd(e.units)))for(const[t,i]of Object.entries(e.units))b(i,`${s}.countdown.units.${t}`,n,!0);if(w(c.color,`${s}.color`),g(c.font,s),Array.isArray(c.segments)&&c.segments.forEach((e,t)=>{zd(e)&&g(e.font,`${s}.segments[${t}]`)}),f(c.lineLimit,"lineLimit",`${s}.lineLimit`),f(c.minimumScaleFactor,"minimumScaleFactor",`${s}.minimumScaleFactor`),void 0!==c.scaleGroup)if("string"==typeof c.scaleGroup&&Jd.test(c.scaleGroup)){const e=y.get(c.scaleGroup)??[];e.push({path:s,size:zd(c.font)?c.font.size:void 0,floor:c.minimumScaleFactor}),y.set(c.scaleGroup,e)}else a(`scaleGroup "${Pd(c.scaleGroup)}"`,`${s}.scaleGroup`);break}case"systemImage":qd.has(Pd(c.systemName))||a(`symbol "${Pd(c.systemName)}"`,`${s}.systemName`),w(c.color,`${s}.color`),g(c.font,s);break;case"asyncImage":b(c.url,`${s}.url`,n,!0),w(c.placeholderColor,`${s}.placeholderColor`),void 0!==c.fallback&&C(c.fallback,`${s}.fallback`,n);break;case"shape":Zd.has(Pd(c.type))||a(`shape "${Pd(c.type)}"`,`${s}.type`),w(c.fillColor,`${s}.fillColor`),w(c.strokeColor,`${s}.strokeColor`),f(c.cornerRadius,"cornerRadius",`${s}.cornerRadius`),f(c.strokeWidth,"strokeWidth",`${s}.strokeWidth`);break;case"gradient":Array.isArray(c.colors)&&c.colors.forEach((e,t)=>{w(zd(e)?e.color:void 0,`${s}.colors[${t}].color`),zd(e)&&f(e.opacity,"opacity",`${s}.colors[${t}].opacity`)});for(const e of["startRadius","endRadius"])f(c[e],"gradientRadius",`${s}.${e}`);break;case"progress":{const e=zd(c.value)?c.value:{};zd(e.timeRemaining)&&(k(e.timeRemaining.from,`${s}.value.timeRemaining.from`),k(e.timeRemaining.to,`${s}.value.timeRemaining.to`)),w(c.fillColor,`${s}.fillColor`),w(c.trackColor,`${s}.trackColor`),f(e.literal,"progressLiteral",`${s}.value.literal`);break}case"button":{const e=c.action,t="string"==typeof e?e:zd(e)?e.type:void 0;if("string"==typeof t&&_d.has(t))if("trigger"===t){const t=zd(e)?e.target:void 0;Vd.has(Pd(t))||a(`trigger target "${Pd(t)}"`,`${s}.action`)}else"dismissTrigger"===t&&(p=!0);else a(`action "${Pd(t)}"`,`${s}.action`);v(c.accessibilityLabel,"accessibilityLabel",`${s}.accessibilityLabel`,n),v(c.accessibilityHint,"accessibilityHint",`${s}.accessibilityHint`,n),zd(c.pressedStyle)&&(f(c.pressedStyle.scale,"scale",`${s}.pressedStyle.scale`),f(c.pressedStyle.duration,"duration",`${s}.pressedStyle.duration`)),C(c.content,`${s}.content`,n);break}case"forEach":{if(!Qd.has(Pd(c.dataSource))){a(`data source "${Pd(c.dataSource)}"`,`${s}.dataSource`);break}const e=c.list;if("string"!=typeof e||!r.has(e)){a(`list "${Pd(e)}"`,`${s}.list`);break}for(const e of["limit","offset"])f(c[e],"count",`${s}.${e}`);C(c.itemTemplate,`${s}.itemTemplate`,e);break}case"conditional":x(c.condition,`${s}.condition`),C(c.ifTrue,`${s}.ifTrue`,n),void 0!==c.ifFalse&&C(c.ifFalse,`${s}.ifFalse`,n);break;case"marquee":void 0!==c.animateWhen&&x(c.animateWhen,`${s}.animateWhen`),f(c.duration,"duration",`${s}.duration`),f(c.spacing,"spacing",`${s}.spacing`),C(c.content,`${s}.content`,n);break;case"group":C(c.content,`${s}.content`,n);break;case"vStack":case"hStack":f(c.spacing,"spacing",`${s}.spacing`);break;case"spacer":f(c.minLength,"spacerMinLength",`${s}.minLength`)}Array.isArray(c.children)&&c.children.forEach((e,t)=>C(e,`${s}.children[${t}]`,n))};C(d,"$.root",void 0);for(const[e,t]of y){const n=t[0].path;t.length<2?a(`scaleGroup "${e}" has one member`,n):t.some(e=>"number"!=typeof e.size)?a(`scaleGroup "${e}" member without font.size`,n):(t.some(e=>"number"!=typeof e.floor)||new Set(t.map(e=>e.floor)).size>1)&&a(`scaleGroup "${e}" members do not share one minimumScaleFactor`,n)}const I=(e,t,n)=>{if("string"==typeof e)e.includes("${"+gd)&&!Xd.has(n??"")&&a(`look value outside text at "${n??""}"`,t);else if(Array.isArray(e))e.forEach((e,i)=>I(e,`${t}[${i}]`,n));else if(zd(e))for(const[n,i]of Object.entries(e))I(i,`${t}.${n}`,n)};return I(d,"$.root",void 0),p&&!0!==e.dismissible&&a('a "dismissTrigger" without "dismissible": true',"$.dismissible"),s}const tu=["headline","subheadline","cta"],nu=new Set(["thanks"]),iu=/[\u0000-\u001f\u007f-\u009f\u2028\u2029\u202a-\u202e\u2066-\u2069]/g,ru=/^[\u0009-\u000d\u0020\u0085\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\u200b]+|[\u0009-\u000d\u0020\u0085\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\u200b]+$/g,ou=/^[\u200b-\u200f\u2060\u061c\ufeff]*$/;function su(e){if("string"!=typeof e)return null;let t=e.replace(iu,"");if(t=function(e){let t="";for(let n=0;n<e.length;n++){const i=e.charCodeAt(n);if(i>=55296&&i<=56319){const i=e.charCodeAt(n+1);i>=56320&&i<=57343&&(t+=e[n]+e[n+1],n++);continue}i>=56320&&i<=57343||(t+=e[n])}return t}(t),t=t.replace(ru,""),ou.test(t))return null;if(t.length>120){const e=t.charCodeAt(119);if(t=t.slice(0,e>=55296&&e<=56319?119:120),ou.test(t))return null}return t.includes("${")?null:t}function au(e){const t={};for(const n of tu){const i=su(e?.[n]);null!==i&&(t[n]=i)}return t}const lu=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),cu=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function du(e){if(!lu(e)||!lu(e.textSlots))return null;const t=e.textSlots.headline;return"string"==typeof t&&lu(e.strings)&&"string"==typeof e.strings[t]?t:null}const uu=36e5,hu=3e5;function pu(e){return Date.parse(e.claimedAt)}function fu(e,t){return pu(e)+t*uu}function mu(e,t,n,i){return e.filter(e=>{if("available"!==e.availability)return!1;if(""===e.advertiserName.trim())return!1;if(i.has(e.transactionId))return!1;const r=pu(e);return!(!Number.isFinite(r)||r>n+hu)&&n<fu(e,t)}).sort((e,t)=>pu(t)-pu(e))}const gu=720;function yu(e,t,n,i){const r=Math.min(i,gu);return e.some(e=>{if("available"!==e.availability)return!1;if(""===e.advertiserName.trim())return!1;if(n.has(e.transactionId))return!1;const i=pu(e);return!(!Number.isFinite(i)||i>t+hu)&&t-i<=r*uu})}const bu="encore.trigger.claimReminder.window",vu=e=>"number"==typeof e&&Number.isFinite(e)&&e>=1&&e<=gu;function wu(e){const t=Object.create(null);try{const n=e?.getItem(bu),i=n?JSON.parse(n):null;if(null!==i&&"object"==typeof i&&!Array.isArray(i))for(const[e,n]of Object.entries(i))vu(n)&&(t[e]=n)}catch{}return t}const xu=e=>S(e)??"";function ku(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function $u(e){return(Array.from(e.trim())[0]??"").toUpperCase()}function Cu(e){return"string"==typeof e&&""!==e.trim()?e:void 0}function Iu(e){if(!ku(e))return{};const t={};for(const n of["background","accent","text"]){const i=Cu(e[n]);i&&(t[n]=i)}return t}function Su(e){const t=new Set,n=[];for(const i of e){const e=qe(i.logoUrl),r=i.advertiserName?.trim()??"",o=r.toLowerCase()||i.campaignId;if(e&&!t.has(o)&&(t.add(o),n.push({logoUrl:e,...r&&{advertiserName:r,advertiserInitial:$u(r)}}),8===n.length))break}return n}const Eu=Object.freeze({title:"Didn't finish? Your gift is still here",subtitle:"Pick up right where you left off",cta:"Continue",dismiss:"Dismiss",hours:"hr",minutes:"min",seconds:"sec",offerTitle:"Finish your ${advertiserName} gift",titleMany:"${claimCount} gifts still waiting",left:"left"});function Tu(e){return{template:e,layout:"string"==typeof e.layout?e.layout:"",windowHours:(n=e.windowHours,"number"==typeof n&&Number.isFinite(n)&&n>=1&&n<=gu?n:24),dismissible:!1!==e.dismissible,colors:Iu(e.colors),lightColors:Iu(e.lightColors),copy:(t=e.strings,function(e,t){const n=ku(e)?e:{},i={...t};for(const e of Object.keys(t))i[e]=Cu(n[e])??t[e];return i}(t,Eu))};var t,n}function Au(e,t){return Math.min(Math.max(0,e-t),6048e5)}function Lu(e=Date.now()){const t=new Date(e);return t.setHours(24,0,0,0),t.getTime()}const Ou=Object.freeze({background:"#1E1F24",accent:"#DEB769",text:"#FFFFFF"}),Nu=Object.freeze({background:"#FFFFFF",accent:"#A3741C",text:"#1B1C20"});function Mu(){try{return!0===window.matchMedia?.("(prefers-color-scheme: dark)").matches}catch{return!1}}function Uu(e,t,n=Mu){const i=e=>"light"===e||"dark"===e?e:"system"===e||"auto"===e?n()?"dark":"light":void 0;return i(e?.colorScheme)??i(t.mode)??"dark"}const Ru=/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i;function Fu(e){if("string"!=typeof e)return;const t=e.trim();return Ru.test(t)?t:void 0}function Pu(e){const t=e.slice(1),n=t.length<6?[...t.slice(0,3)].map(e=>e+e):[0,2,4].map(e=>t.slice(e,e+2)),[i,r,o]=n.map(e=>(e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4})(parseInt(e,16)));return.2126*i+.7152*r+.0722*o>.179?"#000000":"#FFFFFF"}function zu(e,t,n,i="dark",r={}){const o="light"===i?r:t,s="light"===i?Nu:Ou,a="string"==typeof n?.accentColor?Fu(ra(n.accentColor)):void 0,l=Fu(e?.backgroundColor),c=Fu(o.background),d=Fu(e?.secondaryTextColor),u=Fu(e?.trackColor),h=Fu(e?.onAccentColor),p=Fu(e?.backgroundEndColor);return{...d&&{secondary:d},...p&&{backgroundEnd:p},...u&&{track:u},...h&&{onAccent:h},background:l??c??s.background,accent:Fu(e?.accentColor)??a??Fu(o.accent)??s.accent,text:Fu(e?.textColor)??(l&&Pu(l))??Fu(o.text)??(c&&Pu(c))??s.text}}function ju(e){const t=e.slice(1),n=t.length<6?[...t.slice(0,3)].map(e=>e+e):[0,2,4,6].map(e=>t.slice(e,e+2)),[i,r,o]=n.slice(0,3).map(e=>parseInt(e,16));return[i,r,o,2===n[3]?.length?parseInt(n[3],16)/255:1]}function Du([e,t,n]){const i=e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return.2126*i(e)+.7152*i(t)+.0722*i(n)}function Bu(e,t){const n=qe(t.appIconUrl),i="none"===e?"none":"appIcon"===e&&n?"appIcon":"gift";return n?{icon:i,appIconUrl:n}:{icon:i}}const Hu=new Set(["advertiserName","advertiserInitial","advertiserLogoUrl","claimCount","perk","accessibilityTitle","accessibilityHint","icon","appIconUrl","layout"]),_u=e=>qe(e.advertiserLogoUrl??void 0);function Vu(e){const t=e.advertiserName.trim(),n=_u(e);return{transactionId:e.transactionId,advertiserName:t,advertiserInitial:$u(t),...n&&{advertiserLogoUrl:n}}}function qu(e,t){const n=e[0],i=n.advertiserName.trim(),r=_u(n),o=String(e.length),s=t.lookValues??{},a=(e,t)=>Cd(e,s,{advertiserName:i,claimCount:o},t?function(e){return Object.prototype.hasOwnProperty.call(Eu,e)?Eu[e]:void 0}(t):void 0),l=a(t.copy.title,"title"),c=a(t.copy.offerTitle,"offerTitle"),d=a(t.copy.titleMany,"titleMany"),h=a(t.copy.subtitle,"subtitle"),p=n.perk?.trim()??"",f=!("logoMarquee"===t.layout&&e.length>=2)&&""!==i,m=f?c:"logoMarquee"===t.layout&&e.length>=2?d:l,g=t.headlineKey??null,y=null===g?void 0:"offerTitle"===g?t.copy.offerTitle:t.lookStrings?.[g],b=null===g||void 0===y||"offerTitle"===g&&!f?m:a(y,g),v={title:l,offerTitle:c,titleMany:d,claimCount:o,subtitle:h,cta:a(t.copy.cta,"cta"),dismiss:a(t.copy.dismiss,"dismiss"),hours:a(t.copy.hours,"hours"),minutes:a(t.copy.minutes,"minutes"),seconds:a(t.copy.seconds,"seconds"),left:a(t.copy.left,"left"),layout:t.layout,accessibilityTitle:!i||b.includes(i)?b:`${b}, ${i}`,accessibilityHint:p||h,icon:t.icon.icon};i&&(v.advertiserName=i,v.advertiserInitial=$u(i)),p&&(v.perk=p),t.icon.appIconUrl&&(v.appIconUrl=t.icon.appIconUrl),r&&(v.advertiserLogoUrl=r);for(const[e,n]of Object.entries(t.lookStrings??{}))Hu.has(e)?u.debug("Trigger claimReminder: a look string has a host value's key; the host value is drawn",e):Object.prototype.hasOwnProperty.call(v,e)||(v[e]=a(n,e));for(const[e,t]of Object.entries(s))v[`values.${e}`]=t;const w=function(e){const t=new Set,n=[];for(const i of e){const e=_u(i);if(e&&!t.has(i.campaignId)&&!n.includes(e)&&(t.add(i.campaignId),n.push(e),8===n.length))break}return n}(e).map(e=>({logoUrl:e})),x=1===w.length;return{values:v,times:{start:Date.parse(n.claimedAt),deadline:fu(n,t.windowHours)},lists:{claims:e.map(Vu),marqueeLogos:w,marqueeLogosA:x?w:w.filter((e,t)=>t%2==0),marqueeLogosB:x?w:w.filter((e,t)=>t%2==1)}}}const Wu=e=>String(e).padStart(2,"0"),Ku=e=>"object"!=typeof e||null===e||Array.isArray(e)?void 0:e,Gu=e=>Math.min(Math.max(e,0),1),Yu=e=>"number"==typeof e&&Number.isFinite(e)?e:void 0;function Zu(e,t){const n=e?.style?.frame;if("object"==typeof n&&null!==n)return Yu(n[t])}const Qu=e=>String(Number(e.toFixed(4)));let Xu=0;const Ju={linear:"linear",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out"},eh={linear:[0,0,1,1],easeIn:[.42,0,1,1],easeOut:[0,0,.58,1],easeInOut:[.42,0,.58,1]},th=e=>"number"==typeof e&&Number.isFinite(e)?e:void 0,nh=e=>"object"!=typeof e||null===e||Array.isArray(e)?void 0:e;function ih(e){const t=nh(e)??{},n=nh(t.offset),i={},r=th(t.scale);void 0!==r&&(i.scale=r);const o=th(t.opacity);void 0!==o&&(i.opacity=o);const s=th(t.rotation);return void 0!==s&&(i.rotation=s),n&&(i.x=th(n.x)??0,i.y=th(n.y)??0),i}const rh=e=>String(Number(e.toFixed(4)));function oh(e,t){const n=`translate(${rh(e.x??0)}px, ${rh(e.y??0)}px) scale(${rh(e.scale??1)}) rotate(${rh(e.rotation??0)}deg)`;return""===t?n:`${n} ${t}`}const sh=(e,t)=>t*(e.opacity??1),ah=e=>void 0!==e.scale||void 0!==e.rotation||void 0!==e.x;const lh=e=>"number"==typeof e&&Number.isFinite(e)?e:void 0,ch=e=>"string"==typeof e?e:void 0;function dh(e){e.style.minWidth="0";let t=!1;return()=>{if(!t&&e.isConnected){t=!0;for(let t=e.parentElement;t&&!t.hasAttribute("data-encore-trigger");t=t.parentElement)t.style.minWidth||(t.style.minWidth="0")}}}function uh(e){switch(e){case"clock":return"88:88:88";case"hoursMinutes":return"88:88";case"hours":case"minutes":case"seconds":return"88";default:return""}}function hh(e){const{el:t}=e;if(1===e.lines){const e=t.clientWidth;if(e<=0)return!0;const n=t.style.whiteSpace;t.style.whiteSpace="nowrap";const i=t.scrollWidth;return t.style.whiteSpace=n,i<=e+.5}if(!Number.isFinite(e.lines)||t.clientWidth<=0)return!0;const n=parseFloat(t.style.fontSize);return t.scrollHeight<=e.lines*function(e,t){const n=e.style.lineHeight,i=parseFloat(n);return Number.isFinite(i)?n.endsWith("px")?i:i*t:1.2*t}(t,n)+.5}const ph=Object.freeze({registerProgressElement:function(e,t){return e.register("progress",(e,n,i)=>{const r=i.document.createElement("div");r.dataset.sdui="progress",r.style.display="flex",r.style.flexDirection="row",r.style.justifyContent="flex-start",r.style.overflow="hidden",r.style.width="100%";const o=i.document.createElement("div");o.dataset.sduiPart="fill",o.style.height="100%",o.style.flex="none",o.style.transition="none",r.appendChild(o),Ci(e.props.trackColor,n,i,t,e=>{e&&(r.style.backgroundColor=e)}),Ci(e.props.fillColor,n,i,t,e=>{e&&(o.style.backgroundColor=e)}),Ai(r,e,n,i,t);const s=(a=e.style?.frame,"object"!=typeof a||null===a||Array.isArray(a)?void 0:a)?.height;var a;if("number"==typeof s&&Number.isFinite(s)&&s>0){const e=s/2+"px";r.style.borderRadius=e,o.style.borderRadius=e}return{node:r,deps:[pi],update:t=>{const n=function(e,t,n){const i=Ku(e);if(void 0===i)return 0;if("literal"in i){const e=i.literal;return"number"==typeof e&&Number.isFinite(e)?Gu(e):0}const r=Ku(i.timeRemaining);if(void 0===r||void 0===n)return 0;const o="string"==typeof r.from?t?.[r.from]:void 0,s="string"==typeof r.to?t?.[r.to]:void 0;if(void 0===o||void 0===s)return 0;const a=(s-n)/(s-o);return Number.isFinite(a)?Gu(a):0}(e.props.value,t.times,t.now);o.style.width=`${Number((100*n).toFixed(4))}%`}}}),e},registerMarqueeElement:function(e,t){return e.register("marquee",(e,n,i)=>{const r=i.document,o="vertical"===e.props.axis,s=o?"height":"width",a=Math.max(Yu(e.props.spacing)??0,0),l=Yu(e.props.duration)??0,c=!0===e.props.reverse,d=r.createElement("div");d.dataset.sdui="marquee";const u=r.createElement("div");u.dataset.sduiMarqueeTrack="",d.appendChild(u);const h=e.content?i.compileChild(e.content,n).node:void 0;h&&u.appendChild(h),Ai(d,e,n,i,t);const p=o?"column":"row";void 0===Zu(e,s)&&(d.style.setProperty("contain",o?"block-size":"inline-size"),d.style.setProperty(o?"min-height":"min-width","0px")),d.style.display="flex",d.style.flexDirection=p,d.style.alignItems="center",Object.assign(u.style,{display:"flex",flexDirection:p,alignItems:"center",gap:`${a}px`,flexShrink:"0"});const f=Zu("forEach"===e.content?.element?e.content.itemTemplate:e.content,s),m=e=>{const t=e.getBoundingClientRect();return o?t.height:t.width};let g=[];const y=e=>{for(const e of g)e.remove();if(g=[],h)for(let t=1;t<e;t+=1){const e=h.cloneNode(!0);e.setAttribute("aria-hidden","true"),e.setAttribute("inert",""),e.dataset.sduiMarqueeCopy="",u.appendChild(e),g.push(e)}},b=t.motion?.name();let v=n,w=!1;const x=n=>{v=n;const i=(!e.animateWhen||Kn(e.animateWhen,n))&&!0!==n.reduceMotion;if(i&&!0===n.motionPaused&&w)return d.dataset.sduiMarquee="paused",void u.style.setProperty("animation-play-state","paused");const r=i&&!0!==n.motionPaused,p=(()=>{const e=h?void 0!==h.dataset.sduiForeach?Array.from(h.children):[h]:[];return void 0!==f?e.length*(f+a):e.reduce((e,t)=>e+m(t)+a,0)})();if(!r||!b||!t.motion||p<=0||l<=0)return w=!1,d.dataset.sduiMarquee="static",y(1),d.style.justifyContent="center",void u.style.setProperty("animation-name","none");d.dataset.sduiMarquee="animating";const g=Zu(e,s)??m(d);y(g>0?Math.min(Math.ceil(g/p)+1,32):2),d.style.justifyContent="flex-start";const x=e=>`transform: ${o?"translateY":"translateX"}(${Qu(e)}px);`,[k,$]=c?[-p,0]:[0,-p];t.motion.define(b,d,`@keyframes ${b} {\n 0% { ${x(k)} }\n 100% { ${x($)} }\n}`),u.style.setProperty("animation-name",b),u.style.setProperty("animation-duration",`${Qu(l)}s`),u.style.setProperty("animation-timing-function","linear"),u.style.setProperty("animation-iteration-count","infinite"),u.style.setProperty("animation-play-state","running"),w=!0},k=r.defaultView;if(h&&k&&"function"==typeof k.MutationObserver&&new k.MutationObserver(()=>x(v)).observe(h,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),void 0===f&&k&&"function"==typeof k.ResizeObserver&&new k.ResizeObserver(()=>x(v)).observe(u),void 0===Zu(e,s)&&k&&"function"==typeof k.ResizeObserver){let e=-1;new k.ResizeObserver(()=>{const t=m(d);t!==e&&(e=t,x(v))}).observe(d)}return{node:d,deps:[fi,hi,...e.animateWhen?bi(e.animateWhen):[]],update:x}}),e},MotionSheet:class{element;#jc;#Dc=0;#Bc=new Map;constructor(e){this.element=e.createElement("style"),this.element.dataset.sduiMotion="",this.element.style.display="none",Xu+=1,this.#jc=`sdui-${Math.random().toString(36).slice(2,8)}${Xu}`}name(){return this.#Dc+=1,`${this.#jc}-${this.#Dc}`}define(e,t,n){const i=this.#Bc.get(e);if(i?.owner!==t||i.css!==n){if(this.#Bc.set(e,{owner:t,css:n}),this.element.isConnected)for(const[e,t]of this.#Bc)t.owner.isConnected||this.#Bc.delete(e);this.element.textContent=[...this.#Bc.values()].map(e=>e.css).join("\n")}}destroy(){this.#Bc.clear(),this.element.remove()}},attachLoop:function(e,t,n,i,r){const o=function(e){const t=nh(e),n=th(t?.duration);if(!t||void 0===n||!Array.isArray(t.keyframes))return;const i="string"==typeof t.curve&&t.curve in Ju?t.curve:"linear";return{duration:n,phaseOffset:th(t.phaseOffset)??0,curve:i,keyframes:t.keyframes.map(e=>({...ih(e),at:th(nh(e)?.at)??0})),...void 0!==t.reducedMotion?{reducedMotion:ih(t.reducedMotion)}:{}}}(t);if(!o)return;const s=th(Number(""===n.opacity?1:n.opacity))??1,a=i.name();i.define(a,e,function(e,t,n){const i=t.keyframes.some(ah),r=t.keyframes.some(e=>void 0!==e.opacity);return`@keyframes ${e} {\n${t.keyframes.map(e=>{const t=[];return i&&t.push(`transform: ${oh(e,n.transform)};`),r&&t.push(`opacity: ${rh(sh(e,n.opacity))};`),` ${rh(100*e.at)}% { ${t.join(" ")} }`}).join("\n")}\n}`}(a,o,{transform:n.transform,opacity:s}));const l=t=>{e.style.setProperty("animation-name","none"),e.style.transform=oh(t,n.transform),e.style.opacity=rh(sh(t,s))};let c=!1;r.addSite({deps:[fi,li],run:t=>!0===t.reduceMotion?(c=!1,e.dataset.sduiLoop="reduced",void l(o.reducedMotion??o.keyframes[0])):!0===t.motionPaused?(e.dataset.sduiLoop="paused",void(c?e.style.setProperty("animation-play-state","paused"):l(function(e,t){const n=e.keyframes;let i=0;for(;i<n.length-2&&t>n[i+1].at;)i+=1;const r=n[i],o=n[i+1],s=function(e,t){const n=Math.min(Math.max(t,0),1),[i,r,o,s]=eh[e];if("linear"===e)return n;const a=(e,t,n)=>3*(1-n)*(1-n)*n*e+3*(1-n)*n*n*t+n*n*n;let l=0,c=1;for(let e=0;e<40;e+=1){const e=(l+c)/2;a(i,o,e)<n?l=e:c=e}return a(r,s,(l+c)/2)}(e.curve,(t-r.at)/(o.at-r.at)),a=(e,t)=>e+(t-e)*s;return{scale:a(r.scale??1,o.scale??1),opacity:a(r.opacity??1,o.opacity??1),rotation:a(r.rotation??0,o.rotation??0),x:a(r.x??0,o.x??0),y:a(r.y??0,o.y??0)}}(o,o.phaseOffset)))):(c=!0,e.dataset.sduiLoop="running",e.style.setProperty("animation-play-state","running"),e.style.transform=n.transform,e.style.opacity=n.opacity,e.style.setProperty("animation-name",a),e.style.setProperty("animation-duration",`${rh(o.duration)}s`),e.style.setProperty("animation-timing-function",Ju[o.curve]),e.style.setProperty("animation-delay",`${rh(-o.phaseOffset*o.duration)}s`),void e.style.setProperty("animation-iteration-count","infinite"))})},countdownText:function(e,t,n){const i=ch(t.to),r=("object"!=typeof(o=t.units)||null===o||Array.isArray(o)?void 0:o)??{};var o;e.dataset.sduiCountdown=ch(t.format)??"";const s=["hours","minutes","seconds"],a=[pi];for(const e of s)for(const t of _o(ch(r[e])))a.push(mi(t));return{node:e,deps:a,update:o=>{const a=n.textEnvironment(),l={...a.values,...o.values},c={};for(const e of s){const t=ch(r[e]);void 0!==t&&(c[e]=Ro(t,a.variables,l))}const d=function(e,t){if(void 0===e||void 0===t)return 0;const n=Math.floor((e-t)/1e3);return!Number.isFinite(n)||n>315576e3?0:Math.max(n,0)}(void 0===i?void 0:o.times?.[i],o.now);e.textContent=function(e,t,n){const i=Math.floor(t/3600),r=Math.floor(t%3600/60),o=t%60;switch(e){case"hours":return Wu(i);case"minutes":return Wu(r);case"seconds":return Wu(o);case"hoursMinutes":return`${Wu(i)}:${Wu(r)}`;case"largestUnit":{const[e,t]=i>0?[i,n.hours]:r>0?[r,n.minutes]:[o,n.seconds];return t?`${e} ${t}`:String(e)}default:return`${Wu(i)}:${Wu(r)}:${Wu(o)}`}}(t.format,d,c)}}},oneLineFit:function(e,t){const n=lh(t.minimumScaleFactor);if(void 0===n||1!==lh(t.lineLimit))return;const i=Math.min(Math.max(n,.5),1),r=parseFloat(e.style.fontSize);if(!Number.isFinite(r)||i>=1)return;const o=dh(e),s=()=>{o(),e.style.fontSize=`${r}px`;const t=e.style.whiteSpace;e.style.whiteSpace="nowrap";const n=e.clientWidth,s=e.scrollWidth;if(e.style.whiteSpace=t,n<=0||s<=n)return;const a=Math.max(i,n/s);e.style.fontSize=`${Number((r*a).toFixed(2))}px`},a=e.ownerDocument.defaultView?.ResizeObserver;if("function"==typeof a){let t=-1;new a(()=>{const n=e.parentElement?.clientWidth??0;n!==t&&(t=n,s())}).observe(e.parentElement??e)}return s},ScaleGroups:class{#Hc=new Map;join(e,t,n,i){const r=parseFloat(t.style.fontSize),o=()=>this.fit(e);if(!Number.isFinite(r))return o;const s=lh(n.minimumScaleFactor),a=lh(n.lineLimit),l=this.#Hc.get(e)??[];l.push({el:t,base:r,lines:void 0===a?1/0:Math.max(1,Math.floor(a)),floor:void 0===s?1:Math.min(Math.max(s,.5),1),widest:void 0===i?"":uh(i),release:dh(t)}),this.#Hc.set(e,l);const c=t.ownerDocument.defaultView?.ResizeObserver;if("function"==typeof c){let e=-1;new c(()=>{const n=t.parentElement?.clientWidth??0;n!==e&&(e=n,o())}).observe(t.parentElement??t)}return o}fit(e){const t=this.#Hc.get(e);if(!t)return;for(const e of t)e.release();const n=t.map(e=>{if(!e.widest)return null;const t=e.el.textContent;return e.el.textContent=function(e,t){const n=(t??"").replace(/[0-9]/g,"8");return n.length>e.length?n:e}(e.widest,t),t}),i=Math.max(...t.map(e=>e.floor)),r=e=>{for(const n of t)n.el.style.fontSize=`${Number((n.base*e).toFixed(2))}px`},o=e=>(r(e),t.every(hh));let s=1;try{if(!o(1))if(o(i)){let e=i,t=1;for(let n=0;n<10;n++){const n=(e+t)/2;o(n)?e=n:t=n}s=e}else s=i}finally{t.forEach((e,t)=>{const i=n[t];null!=i&&(e.el.textContent=i)})}r(s)}}}),fh=(e,t)=>JSON.stringify(e??{})===JSON.stringify(t??{});function mh(e,t){const n=function(e){const t=ju(e.background),[n,i,r,o]=ju(e.accent),s=[n,i,r].map((e,n)=>t[n]+(e-t[n])*o),a=Du(s)>.179?"#000000":"#FFFFFF",l=1===t[3]&&function(e,t){const[n,i]=[Du(e),Du(t)].sort((e,t)=>t-e);return(n+.05)/(i+.05)}(s,t)>=3?`#${t.slice(0,3).map(e=>Math.round(e).toString(16).padStart(2,"0").toUpperCase()).join("")}`:a;return{background:e.background,backgroundEnd:e.backgroundEnd??e.background,surface:e.background,onBackground:e.text,onSurface:e.text,secondary:e.secondary??e.text,track:e.track??e.text,accent:e.accent,border:e.accent,onAccent:e.onAccent??a,inkOnAccent:e.onAccent??l}}(e.theme),i=function(e){const t=new Set;return void 0===e.secondary&&t.add("secondary"),void 0===e.track&&t.add("track"),t}(e.theme),r=new Set([...["secondary","track"].filter(e=>!i.has(e)),...e.theme.onAccent?["onAccent","inkOnAccent"]:[]]),o=()=>t.now?.()??Date.now();let s=!1,a=!0;const l=function(){try{return!0===window.matchMedia?.("(prefers-reduced-motion: reduce)").matches}catch{return!1}}(),c=As({template:e.template,mode:"inline",kit:ph,offers:[],textEnvironment:{values:e.values,variables:e.values,textMaps:{},defaults:{}},actionHost:{trigger:e=>{s||t.tapped(e)},dismissTrigger:()=>{s||t.dismissed()}},color:e=>{if("object"!=typeof e||null===e)return;const t=e;return"string"==typeof t.hex?ra(t.hex):"string"==typeof t.appearance?n[t.appearance]:void 0},exactColor:e=>"object"==typeof e&&null!==e&&r.has(String(e.appearance)),initialState:"idle",times:e.times??{},now:o(),lists:e.lists??{},motionPaused:!1,reduceMotion:l}),d=c?.inlineHeight;if(!c||void 0===d)throw new Error("trigger template is unrenderable on this build");const u=c,h=document.createElement("div");h.dataset.encoreTrigger="",h.dataset.triggerState="idle",e.values.layout&&(h.dataset.layout=e.values.layout),h.style.height=`${d}px`,h.style.width="100%";const p=function(e){const t=e.root;if("object"!=typeof t||null===t)return;const n=Object.values(t)[0],i=n?.style?.frame?.maxWidth;return"number"==typeof i&&Number.isFinite(i)&&i>=0?i:void 0}(e.template);if(void 0!==p){h.style.maxWidth=`${p}px`;const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("width",String(p)),e.setAttribute("height","0"),e.setAttribute("aria-hidden","true"),e.dataset.encoreWidth="",e.style.display="block",e.style.maxWidth="100%",e.style.height="0",h.appendChild(u.root),h.appendChild(e)}else h.appendChild(u.root);if(!l&&"function"==typeof h.animate)try{h.animate([{opacity:0},{opacity:1}],{duration:200,easing:"ease-out"})}catch{}const f=()=>{u.setMotion({paused:!a,reduce:l})};let m=e;return{root:h,update:e=>{return!(e.template!==m.template||(t=e.theme).background!==(n=m.theme).background||t.accent!==n.accent||t.text!==n.text||!fh(e.values,m.values)||(fh(e.lists,m.lists)||u.setLists(e.lists??{}),fh(e.times,m.times)||u.setTimes(e.times??{}),u.setNow(o()),m=e,0));var t,n},setBusy:e=>{s=e,h.dataset.triggerState=e?"busy":"idle",u.setState(e?"busy":"idle"),f()},setOnScreen:e=>{a=e,f()}}}const gh=C.claimReminder,yh="logoMarquee",bh=new Set(["title","offerTitle","titleMany"]);function vh(e,t,n,i){const r=t===yh&&n>=2?"titleMany":i.trim()?"offerTitle":"title",o=Object.entries(function(e){const t={};if(!lu(e)||!lu(e.textSlots))return t;for(const n of tu){const i=cu(e.textSlots,n)?e.textSlots[n]:void 0;"string"==typeof i&&(t[n]=i)}return t}(e)).filter(([,e])=>bh.has(e)&&e!==r).map(([e])=>e);return o.length>0?{undrawnSlots:o}:{}}function wh(e){const t=new Set,n=(e,t)=>`${e}|${S(t)??""}`,i=new Map,r=()=>{try{return e.storage?.()??null}catch{return null}},o=new WeakMap,s=t=>{const n=t.lists?.claims?.[0]?.transactionId;try{return"string"!=typeof n||!1!==e.claimTapped?.(n)}catch{return!0}};return{id:gh,async prepare(o){const{now:s,dismissed:a,placement:l}=o;o.fresh&&t.add(n(o.request.useCase,l));let c,d=null;try{d=e.source()}catch{d=null}if(!d)return null;try{c=await d.openClaims()}catch(e){if(t.has(n(o.request.useCase,l)))return null;throw e}const u=Array.isArray(c)?c:[],h=()=>{try{return e.thanksFor?.()??null}catch{return null}},p=(e=>i.get(S(e)??"")??function(e,t){return wu(e)[xu(t)]??24}(r(),e))(l);if(!yu(u,s,a,p)&&null===h())return null;const f=o.request.useCase,m=n(f,l),g=t.delete(m)||o.fresh,y=await e.checkSheet(f,l,g);if("sheet_unavailable"===y.status)return o.notShown(k.sheetUnavailable),null;if("offers"!==y.status)return null;const b=u.filter(e=>y.campaignIds.has(e.campaignId));if(yu(b,s,a,p)){const e=function(e,t,n,i){const r=Math.min(i,gu);let o=null;for(const i of e){if(!yu([i],t,n,r))continue;const e=pu(i)+r*uu+1;(null===o||e<o)&&(o=e)}return o}(b,s,a,p);return null!==e&&o.readAgainAt(e),{useCase:f,claims:b,campaignIds:y.campaignIds,windowHours:p}}const v=h();return null===v?null:(o.readAgainAt(Lu(s)),{useCase:f,claims:[],campaignIds:y.campaignIds,completion:v})},requestState:e=>e.claims.length>0?"claimOpen":e.completion?"completed":null,completionOf:e=>e.claims.length>0?null:e.completion??null,precheck:e=>eu(e,"claimReminder"),decode:Tu,present(e,t,{now:n,dismissed:o,appearance:s,placement:a,portal:l,icon:c,lookValues:d}){if(t.layout===yc){if(!e.completion||e.claims.length>0)return null;const n={},i={...kd(t.template),...d};for(const[e,r]of Object.entries(Id(t.template)))n[e]=Cd(r,i,{});for(const[e,t]of Object.entries(i))n[`values.${e}`]=t;return{model:{useCase:e.useCase,placement:a,thanks:!0,template:t.template,theme:zu(s,t.colors,l,Uu(s,l),t.lightColors),values:{...n,...Bu(c,l),layout:t.layout},lists:{}},contentKey:`thanks|${e.completion}`,eventFields:{layout:t.layout},dismissible:!1}}!function(e,t,n){if(!vu(n))return;const i=wu(e),r=xu(t);if(i[r]!==n){i[r]=n;try{e?.setItem(bu,JSON.stringify(i))}catch{}}}(r(),a,t.windowHours),i.set(S(a)??"",t.windowHours);const u=mu(e.claims,t.windowHours,n,o),h=u[0];if(!h)return null;const p=t.layout===yh?Math.min(...u.map(e=>fu(e,t.windowHours))):fu(h,t.windowHours);return{model:{useCase:e.useCase,placement:a,template:t.template,theme:zu(s,t.colors,l,Uu(s,l),t.lightColors),...qu(u,{copy:t.copy,windowHours:t.windowHours,layout:t.layout,icon:Bu(c,l),lookStrings:Id(t.template),headlineKey:du(t.template),lookValues:{...kd(t.template),...d}})},contentKey:h.transactionId,eventFields:{transactionId:h.transactionId,campaignId:h.campaignId,layout:t.layout,...vh(t.template,t.layout,u.length,h.advertiserName)},dismissible:t.dismissible,refreshAt:p}},opensSheet:e=>{if(e.thanks)return!0;const t=s(e);return o.set(e,t),t},onTap(t,n,i){if(t.thanks)return i.presentSheet({useCase:t.useCase,placement:t.placement,onPresented:()=>{try{e.thanksTapped?.()}catch{}}}).then(()=>"refresh");const r=o.get(t);return o.delete(t),r??s(t)?i.presentSheet({useCase:t.useCase,placement:t.placement}).then(()=>"refresh"):Promise.resolve("refresh")},render(e,t){const n=mh(e,t),i=e.lists?.claims?.[0]?.transactionId;return i&&(n.root.dataset.transactionId=i),n}}}var xh=Object.freeze({__proto__:null,CLAIM_REMINDER_ID:gh,claimReminderPlugin:wh});const kh="encore.trigger.giftsButton.autoPopped",$h=new Map,Ch=new Map;function Ih(e){const t=new Date(e),n=e=>String(e).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Sh(e){try{const t=e?.getItem(kh),n=t?JSON.parse(t):{};if("object"!=typeof n||null===n||Array.isArray(n))return{};const i=Object.create(null);for(const[e,t]of Object.entries(n))"string"==typeof t&&(i[e]=t);return i}catch{return{}}}function Eh(e){return S(e)??""}function Th(e){const t=()=>{try{return e()}catch{return null}};return{reservePop:(e,n)=>!((e,n)=>{const i=Eh(e),r=Ih(n);return Sh(t())[i]===r&&Ch.get(i)!==r||$h.get(i)===r})(e,n)&&(((e,n)=>{const i=Eh(e),r=Ih(n);$h.set(i,r),Ch.delete(i);try{const e=t();if(!e)return;const n=Sh(e),o=Object.create(null);for(const[e,t]of Object.entries(n))t===r&&(o[e]=t);o[i]=r,e.setItem(kh,JSON.stringify(o))}catch{}})(e,n),!0),releasePop:(e,n)=>{const i=Eh(e);$h.get(i)===n&&$h.delete(i),Ch.set(i,n);try{const e=t();if(!e)return;const r=Sh(e);r[i]===n&&(delete r[i],e.setItem(kh,JSON.stringify(r))),Ch.delete(i)}catch{}}}}function Ah(e){const t=ku(e.strings)?e.strings:{},n={};for(const e of["title","subtitle","cta","offersTitle"]){const i=Cu(t[e]);i&&(n[e]=i)}return{template:e,layout:"string"==typeof e.layout?e.layout:"",colors:Iu(e.colors),lightColors:Iu(e.lightColors),strings:n,autoOpen:"on"===Td(e,"giftsButton").autoOpen}}const Lh=Object.freeze({card:{title:"You have a gift",subtitle:"Tap to see what's inside",cta:"Open gift"},pulse:{title:"Tap to open your gift",subtitle:"",cta:"Open gift"},banner:{title:"A little thank you",subtitle:"Pick a gift from our partners",cta:"Open"},pill:{title:"",subtitle:"",cta:"Open gift"},thanks:{title:"Nice work, you finished it",subtitle:"More gifts are waiting",cta:"See gifts"}});function Oh(e,t){const n=Object.prototype.hasOwnProperty.call(Lh,e)?Lh[e]:Lh.card;return{title:t.title??n.title,subtitle:t.subtitle??n.subtitle,cta:t.cta??n.cta,offersTitle:t.offersTitle??"Pick a gift, on us"}}const Nh=C.giftsButton,Mh="auto",Uh="autoDecision";function Rh(e,t){void 0===e[Uh]&&bc(Nh,t)&&(e[Uh]="gaveUp")}const Fh="reservedDay";function Ph(e){const t=1===e.length;return{offerLogos:e,offerLogosA:t?e:e.filter((e,t)=>t%2==0),offerLogosB:t?e:e.filter((e,t)=>t%2==1)}}function zh(e){const{reservePop:t,releasePop:n}=Th(()=>{try{return e.storage()}catch{return null}}),i=(e,t)=>`${e}|${function(e){return S(e)??""}(t)}`,r=new Set;return{id:Nh,async prepare(t){const{placement:n}=t,o=t.request.useCase,s=i(o,n);t.fresh&&r.add(s);const a=r.delete(s),l=await e.checkSheet(o,n,a);return"sheet_unavailable"===l.status?(t.notShown(k.sheetUnavailable),null):"offers"!==l.status?null:{useCase:o,offerLogos:Su(l.offers??[])}},precheck:e=>eu(e,"giftsButton"),decode:Ah,present(e,n,r){const{now:o,appearance:s,placement:a,canAutoTap:l,mountState:c,request:d}=r,u=i(e.useCase,a),h=Uu(s,r.portal),p=Bu(r.icon,r.portal),f=(t,n)=>{const i={...kd(t.template),...r.lookValues},o=Oh(t.layout,{}),l=(e,t)=>Cd(e,i,{},o[t]),c={};for(const[e,n]of Object.entries(Id(t.template)))c[e]=l(n,e);const d={...Oh(t.layout,t.strings)};for(const[e,t]of Object.entries(d))c[e]=l(t,e);for(const[e,t]of Object.entries(i))c[`values.${e}`]=t;return{model:{useCase:e.useCase,placement:a,...e.thanks&&t.layout===yc&&{thanks:!0},template:t.template,theme:zu(s,t.colors,r.portal,h,t.lightColors),values:{...c,...p,layout:t.layout},lists:Ph(e.offerLogos)},contentKey:n,eventFields:{layout:t.layout},dismissible:!1}},m=t=>({model:{useCase:e.useCase,placement:a,template:null,theme:zu(s,n.colors,r.portal,h,n.lightColors),values:{layout:n.layout}},contentKey:t,eventFields:{layout:n.layout},dismissible:!1});if(n.layout===yc)return e.thanks?(Rh(c,d),f(n,`${u}|thanks|${e.thanks}`)):m(`${u}|thanks-ended`);const g=()=>f(n,`${u}|${Ih(o)}`);if(e.thanks)return Rh(c,d),g();if(!n.autoOpen||!bc(Nh,d))return g();const y=m(`${u}|auto`);switch(c[Uh]){case"popping":return y;case"popped":case"held":case"gaveUp":return g();default:return l?t(a,o)?(c[Uh]="popping",c[Fh]=Ih(o),{...y,autoTap:Mh}):(c[Uh]="held",{...g(),notShownReason:k.autoHeld}):y}},autoTapAbandoned(e,t,{mountState:i,placement:r}){const o=i[Fh];"string"==typeof o&&n(r,o),delete i[Fh],i[Uh]="gaveUp"},opensSheet:()=>!0,onTap(t,i,r){let o=!1;return r.presentSheet({useCase:t.useCase,placement:t.placement,onPresented:()=>{if(o=!0,t.thanks)try{e.thanksTapped?.()}catch{}}}).then(()=>{if(i===Mh){const{mountState:e}=r;if(o)e[Uh]="popped";else{const i=e[Fh];"string"==typeof i&&n(t.placement,i),delete e[Fh],e[Uh]="gaveUp"}}return"refresh"})},render(e,t){const{template:n}=e;if(!n)return function(e){const t=document.createElement("div");return t.dataset.encoreTrigger="",e.values.layout&&(t.dataset.layout=e.values.layout),t.hidden=!0,{root:t,update:e=>null===e.template}}(e);const i=mh({...e,template:n},t);return{...i,update:e=>!!e.template&&i.update({...e,template:e.template})}}}}var jh=Object.freeze({__proto__:null,AUTO_POP_STORAGE_KEY:kh,GIFTS_BUTTON_ID:Nh,forgetAutoPops:function(){$h.clear(),Ch.clear()},giftsButtonPlugin:zh,giveUpAutoOpen:Rh});function Dh(e,t,n){const i=C.claimReminder;return{id:e.id,alsoDraws:[i],async prepare(r){const o=r.dismissedOf(i);try{await(n.checkClaims?.(e=>o.has(e)))}catch{}const s=await e.prepare(r);if(null===s)return null;let a=null;try{a=await t.prepare({...r,fresh:!1,dismissed:r.dismissedOf(i)})}catch{a=null}const l=a&&(a?.claims??[]).length>0?a:null;let c=null;if(!l){try{c=n.thanksFor?.()??null}catch{c=null}c&&r.readAgainAt(Lu(r.now))}return{gifts:c?{...s,thanks:c}:s,reminder:l,completion:c}},requestState:e=>e.reminder?"claimOpen":e.completion?"completed":null,completionOf:e=>e.completion,precheck:n=>n.trigger===i?t.precheck?.(n):e.precheck?.(n),decode(n){if(n.trigger===i){const e=t.decode(n);return e?{of:"reminder",config:e}:null}const r=e.decode(n);return r?{of:"gifts",config:r}:null},present(n,r,o){if("reminder"===r.of){if(!n.reminder)return null;const e=o.dismissedOf(i),s=t.present(n.reminder,r.config,{...o,dismissed:e});if(!s)return n.reminder.windowHours!==r.config.windowHours&&o.readAgainAt(o.now),null;const a=mu(n.reminder.claims,r.config.windowHours,o.now,e).map(e=>e.transactionId);return Rh(o.mountState,o.request),{...s,model:{of:"reminder",model:s.model},drawnTrigger:i,dismissKeys:[s.contentKey,...a.filter(e=>e!==s.contentKey)]}}const s=e.present(n.gifts,r.config,o);return s?{...s,model:{of:"gifts",model:s.model}}:null},opensSheet:(n,i)=>"reminder"===n.of?!0===t.opensSheet?.(n.model,i):!0===e.opensSheet?.(n.model,i),onTap:(n,i,r)=>"reminder"===n.of?t.onTap(n.model,i,r):e.onTap(n.model,i,r),render(n,i){const r=n.of,o="reminder"===n.of?t.render(n.model,i):e.render(n.model,i);return{...o,root:o.root,update:e=>e.of===r&&o.update(e.model)}},autoTapAbandoned(t,n,i){"gifts"===t.of&&e.autoTapAbandoned?.(t.model,n,i)}}}var Bh=Object.freeze({__proto__:null,giftsSpotPlugin:Dh});const Hh=new Set,_h={checkSheet:()=>Promise.resolve({status:"none"}),storage:()=>null};function Vh(e,t,n,i,r){try{const o=e.precheck?.(t);if(o)return{result:{status:"unrenderable",reason:`${o.reason} at ${o.path}`}};const s=e.decode(t);if(!s)return{result:{status:"unrenderable",reason:"the look does not decode"}};const a=e.present(n,s,i);if(!a||r(a.model))return{result:{status:"empty"}};const l=e.render(a.model,{tapped:()=>{},dismissed:()=>{},now:()=>i.now}),c="string"==typeof t.layout?t.layout:"";return{result:{status:"rendered",trigger:String(t.trigger),layout:c},view:l}}catch(e){return{result:{status:"unrenderable",reason:e instanceof Error?e.message:String(e)}}}}An=!1;const qh=new Map,Wh=new Map;function Kh(e){let t=Wh.get(e);return t||(t=new Map,Wh.set(e,t)),t}function Gh(e,t){const n=new Map;for(const[i,r]of e){if(r>t||t-r>=2592e6)continue;const e=n.get(i);(void 0===e||r>e)&&n.set(i,r)}return[...n.entries()].map(([e,t])=>[e,t]).sort(([,e],[,t])=>e-t).slice(-100)}function Yh(e){return Array.isArray(e)&&2===e.length&&"string"==typeof e[0]&&"number"==typeof e[1]&&Number.isFinite(e[1])}class Zh{#f;#_e;#ga=[];constructor(e,t){this.#f=e,this.#_e=function(e){return`encore.trigger.${e}.dismissed`}(t),this.sync()}get size(){return this.#ga.length}has(e){return this.#ga.some(([t])=>t===e)}keys(){return new Set(this.#ga.map(([e])=>e))}sync(){this.#ga=this.#_c(Date.now())}add(e){const t=Date.now(),n=Gh([...this.#_c(t).filter(([t])=>t!==e),[e,t]],t),i=Kh(this.#_e);if(null===this.#Vc())qh.set(this.#_e,n);else try{if(!this.#f)throw new Error("no storage");this.#f.setItem(this.#_e,JSON.stringify(n)),i.clear(),qh.delete(this.#_e)}catch{i.delete(e),i.set(e,t);for(const e of i.keys()){if(i.size<=100)break;i.delete(e)}}this.#ga=n}#_c(e){const t=this.#Vc();if(null===t)return Gh(qh.get(this.#_e)??[],e);const n=[...Kh(this.#_e),...qh.get(this.#_e)??[]];return Gh([...t,...n],e)}#Vc(){if(!this.#f)return null;let e;try{e=this.#f.getItem(this.#_e)}catch{return null}if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(Yh):[]}catch{return[]}}}class Qh{#xe;#Ks;#qc=Number.NEGATIVE_INFINITY;#Lr=null;constructor(e,t=()=>Date.now()){this.#xe=e,this.#Ks=t}request(){const e=this.#Ks(),t=this.#qc+3e4-e;if(t<=0)return this.#Wc(),this.#qc=e,void this.#xe();null===this.#Lr&&(this.#Lr=setTimeout(()=>{this.#Lr=null,"undefined"!=typeof document&&"hidden"===document.visibilityState||(this.#qc=this.#Ks(),this.#xe())},t))}cancel(){this.#Wc()}#Wc(){null!==this.#Lr&&clearTimeout(this.#Lr),this.#Lr=null}}const Xh=()=>{},Jh=Object.freeze({triggerId:"",unmount:Xh,reload:Xh,refresh:Xh,setAlignment:Xh,setText:Xh});function ep(e){return"leading"===e||"trailing"===e?e:"center"}function tp(e,t,n){if(function(e){try{const t=getComputedStyle(Ip(e)).display;return/(^|\s|-)(flex|grid)$/.test(t)}catch{return!1}}(n))return e.style.marginLeft="",void(e.style.marginRight="");const i="leading"===t?"0px":"auto",r="trailing"===t?"0px":"auto",o=function(e){try{const t=e.ownerDocument.defaultView?.getComputedStyle(e).direction;if("rtl"===t||"ltr"===t)return"rtl"===t}catch{}return"rtl"===e.closest("[dir]")?.getAttribute("dir")?.toLowerCase()}(n);e.style.marginLeft=o?r:i,e.style.marginRight=o?i:r}function np(e){if(!hp(e))return{};const t=hp(e.appearance)?e.appearance:{},n=hp(e.media)?e.media:{},i=pp(t.accentColor),r=pp(t.mode),o=pp(n.appstoreIcon);return{...i&&{accentColor:i},...r&&{mode:r},...o&&{appIconUrl:o}}}const ip=new Set;let rp=null;function op(){for(const e of ip){if(rp)return;e.runHeldAutoTap()}}function sp(){for(const e of ip)e.abandonHeldAutoTap()}function ap(){return rp?null:(rp=Symbol("tap"),rp)}function lp(e,t){if(rp===e){rp=null,t?sp():op();for(const e of ip)e.refresh(t)}}const cp=new Set;function dp(e){return cp.add(e),()=>{cp.delete(e)}}function up(e,t){for(const t of ip)t.draws(e)&&t.dismissedElsewhere(e);for(const n of[...cp])if(n!==t)try{n(e)}catch(e){u.warn("Trigger dismiss listener failed",e)}}function hp(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function pp(e){return"string"==typeof e&&""!==e.trim()?e.trim():void 0}function fp(e,t,n){const i="string"==typeof t?[t]:t,r=i[0]??"";if(!hp(e)||!hp(e.ui))return null;const o=e.ui,s=o.template;if(!hp(s)||!i.includes(s.trigger))return null;let a;try{a=n(s)}catch(e){return u.warn(`Trigger ${r}: template decode failed`,e),null}if(null==a)return u.warn(`Trigger ${r}: served template could not be read; rendering nothing`),null;const l=pp(o.variantId),c=pp(o.experimentId),d=pp(e.locale);return{config:a,...l&&{variantId:l},...c&&{experimentId:c},...d&&{locale:d},...mp(o),portal:np(o.values)}}function mp(e){const t="afterClaim"===e.step||"afterComplete"===e.step?e.step:void 0;return t?{step:t,stepExperimentId:pp(e.stepExperimentId)??null}:{}}function gp(e,t){return e.drawnTrigger??t}const yp='button:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';const bp=new Set,vp=new Map;function wp(e,t,n){const i=function(e){return`encore.trigger.${e}.notShown`}(t),r=function(e){const t=new Date(e),n=e=>String(e).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}(Date.now());let o=vp.get(i);o||(o=new Map,vp.set(i,o));let s=Object.create(null);try{const t=e?.getItem(i),n=t?JSON.parse(t):null;if(hp(n))for(const[e,t]of Object.entries(n))t===r&&(s[e]=t)}catch{s=Object.create(null)}if(s[n]===r||o.get(n)===r)return!1;o.set(n,r),s[n]=r;try{e?.setItem(i,JSON.stringify(s))}catch{}return!0}const xp=new Map;class kp{id;#Ve;#Kc=null;#oi;#Gc="center";#ve;#Yc;#Zc;#Qc;#Xc=null;#Ae;#Jc;#ed;#td;#nd=new Set;#id=[];#f;#rd=null;#od=null;#Qt=null;#v=!1;#sd=null;#ad=null;#ld=null;#cd=1/0;#dd=null;#ud=0;#hd=null;#pd=0;#fd=0;#na=0;#md=null;#gd=!1;#yd=null;#bd=null;#vd=!1;#wd=null;#xd=null;#kd=null;#$d=Object.create(null);#Cd=null;#Id="idle";#Sd=null;#Ed=null;#Td=!1;#Ad=!1;#Ld=()=>this.#pa();#Od=new Qh(()=>{this.#Nd()});#Md=new Map;constructor(e,t,n,i,r,o){this.id=e.id,this.#Ae=i,this.#Ve=()=>e.load(),this.#oi=t,this.#ve=n,this.#Gc=ep(n.alignment),this.#Yc=function(e){const t=Object.create(null);if(!hp(e))return Object.freeze(t);for(const[n,i]of Object.entries(e))"string"==typeof i&&(t[n]=i);return Object.freeze(t)}(n.options),this.#Zc=function(e,t){const n=Object.create(null);if("object"!=typeof e||null===e||Array.isArray(e))return n;const i=[];for(const[n,r]of Object.entries(e))md.test(n)&&!yd.includes(n)&&wd(r)?i.push(n):t?.(n);i.sort((e,t)=>e<t?-1:e>t?1:0);for(const t of i.slice(0,16))n[t]=e[t];for(const e of i.slice(16))t?.(e);return n}(n.values,t=>u.debug(tu.includes(t)?`Trigger ${e.id}: "${t}" is a text slot, set with the ${t} option, not in values; ignored`:`Trigger ${e.id}: the mount's value "${t}" is not plain text under a valid key; the look's default shows`)),this.#Qc=au(n),this.#Jc=r,this.#td=o;let s=null;try{s=r.storage()}catch{s=null}this.#ed=new Zh(s,e.id),this.#f=s}get plugin(){if(!this.#Kc)throw new Error(`Trigger ${this.id}: plug-in not loaded`);return this.#Kc}async start(){if(!this.#v){if(!this.#Kc){this.#Ud();try{this.#Kc=await this.#Ve()}catch(e){return this.#Rd("failed to load; rendering nothing",e),void this.unmount()}if(this.#v)return}this.#Ud()?this.unmount():(ip.add(this),document.addEventListener("visibilitychange",this.#Ld),this.#Fd(),this.#Pd(),this.#vd&&await this.#Nd())}}refreshSoon(){this.#v||this.#Od.request()}reload(e="identity"){if(this.#v)return;const t=null!==this.#Qt&&!this.#oi.contains(this.#Qt.view.root);if(this.#Ud()||t)this.unmount();else{if("identity"===e){const e=this.#md;this.#zd(),e&&this.#jd(e)}if(this.#na++,this.#kd=null,this.#gd=!1,this.#Id="idle",this.#Sd=null,this.#Ed=null,this.#Ad=!1,this.#id=[],"identity"===e){this.#$d=Object.create(null),this.#nd.clear();for(const e of xp.keys())e.startsWith(`${this.id}|`)&&xp.delete(e)}document.removeEventListener("visibilitychange",this.#Ld),this.#Dd(),this.#Od.cancel(),this.#Bd(),this.#Zn(),this.#od=null,this.#rd=null,this.#Cd=null,this.start().catch(e=>{this.#Rd("failed to restart; rendering nothing",e)})}}unmount(){if(this.#v)return;const e=this.#md;this.#zd(),e&&this.#jd(e),this.#v=!0,ip.delete(this),document.removeEventListener("visibilitychange",this.#Ld),this.#Dd(),this.#Od.cancel(),this.#Bd(),this.#Hd(),this.#Zn();try{this.#td?.()}catch{}}refresh(e=!1){this.#v||this.#Nd(e)}runHeldAutoTap(){const e=this.#md;if(e)return Date.now()-e.since>=6e4?(this.#zd(),void this.#_d(e)):void(!this.#Vd()&&this.#qd()&&(!this.#Qt&&this.#pd>0||(this.#zd(),this.#v||(this.#Qt?this.#Wd(e.target,!0):this.#_d(e)))))}abandonHeldAutoTap(){const e=this.#md;e&&(this.#zd(),this.#_d(e))}#Vd(){if(rp)return!0;try{return!0===this.#Jc.sheetBusy?.()}catch{return!1}}#Kd(e,t){if(this.#md)return;const n=Date.now(),i=setInterval(()=>{const e=this.#md;e?.timer===i?this.runHeldAutoTap():clearInterval(i)},1e3);this.#md={target:e,model:t,since:n,timer:i}}#zd(){this.#md&&clearInterval(this.#md.timer),this.#md=null}#_d(e){this.#jd(e),this.#Gd()}#jd(e){if(!this.#v)try{this.plugin.autoTapAbandoned?.(e.model,e.target,{mountState:this.#$d,placement:this.#Yd()})}catch(e){this.#Rd("autoTapAbandoned failed",e)}}setAlignment(e){this.#Gc=ep(e),this.#Qt&&tp(this.#Qt.view.root,this.#Gc,this.#oi)}setText(e){const t=au(hp(e)?e:{});if(n=t,i=this.#Qc,tu.every(e=>n[e]===i[e]))return;var n,i;this.#Qc=t;const r=this.#Xc;if(this.#v||null===r||null===this.#od)return;const o=this.#Zd(r),s=fp(o.response,this.#Qd(),e=>this.plugin.decode(e));s&&(o.drawn.length>0&&(s.textSlots=o.drawn),this.#od=s,this.#Gd())}draws(e){return this.#Qd().includes(e)}dismissedElsewhere(e=this.id){this.#v||(e!==this.id?this.#Nd():this.#Gd())}#Rd(e,t){u.warn(`Trigger ${this.id}: ${e}`,t)}#Yd(){return"string"==typeof this.#ve.placement?this.#ve.placement:void 0}#Ud(){return this.#oi.isConnected?(this.#Td=!0,!1):this.#Td}async#Nd(e=!1,t=!0){if(this.#vd){this.#pd++;try{await this.#xe(e,t)}finally{this.#pd--}}}async#xe(e,t=!0){if(this.#Ud())return void this.unmount();if("none"===this.#Id&&!this.#Ed&&!this.#Xd())return;this.#Jd(),this.#Dd();const n=++this.#fd,i=this.#na,r=()=>this.#v||n!==this.#fd||i!==this.#na;this.#ed.sync();try{const t=await this.plugin.prepare({now:Date.now(),request:this.#Ae,fresh:e,dismissed:this.#ed.keys(),options:this.#Yc,placement:this.#Yd(),mountState:this.#$d,dismissedOf:e=>this.#eu(e).keys(),notShown:e=>{r()||this.#tu(e,null)},readAgainAt:e=>{r()||this.#nu(e)}});if(r())return;this.#rd=t??null}catch(e){if(this.#Rd("prepare failed",e),r())return}if(this.#iu(),"idle"===this.#Id&&null!==this.#rd)this.#Cd=this.#ru(i),await this.#Cd;else if("loading"===this.#Id&&this.#Cd){if(await this.#Cd,r())return;this.#iu()&&null!==this.#rd&&(this.#Cd=this.#ru(i),await this.#Cd)}r()||("none"===this.#Id&&this.#ou(),this.#Gd(t))}#Xd(){return null!==this.#Sd&&this.#Qd().length>1}#su(){this.#Id="none",this.#od=null,this.#Zn()}#au(){const e=this.#rd;if(null===e||!this.plugin.requestState)return null;try{return this.plugin.requestState(e)??null}catch(e){return this.#Rd("requestState failed",e),null}}#iu(){return!("ready"!==this.#Id&&"none"!==this.#Id||null===this.#rd||this.#au()===this.#Sd||(this.#Id="idle",0))}async#ru(e){this.#Id="loading",this.#Ed=null;const t=this.#au(),n=t?{...this.#Ae,state:t}:this.#Ae;let i;try{if(this.#v||e!==this.#na)return;i=await this.#Jc.fetchConfig(this.id,this.#Yd(),n)}catch(t){return this.#Rd("config request failed; rendering nothing",t),void(e===this.#na&&(this.#Id="idle"))}if(this.#v||e!==this.#na)return;if(this.#Sd=t,!hp(i)||!0!==i.success||!hp(i.ui))return this.#Rd("config response malformed; rendering nothing",i),void(this.#Id="idle");const r=this.#lu(i.ui);if(r){this.#su();const e=pp(i.locale);return void this.#tu("unrenderable",{...r.ids,...mp(i.ui),...e&&{locale:e}},r.layout?{layout:r.layout}:{})}const o=this.#Zd(i),s=fp(o.response,this.#Qd(),e=>this.plugin.decode(e));if(s&&o.drawn.length>0&&(s.textSlots=o.drawn),!s){this.#su();const e=function(e){if(!hp(e)||!0!==e.success||!hp(e.ui))return null;const t=e.ui;if(null!==t.template||"afterComplete"!==t.step)return null;const n=pp(t.variantId),i=pp(t.experimentId),r=pp(e.locale);return{...n&&{variantId:n},...i&&{experimentId:i},...r&&{locale:r},step:"afterComplete",stepExperimentId:pp(t.stepExperimentId)??null}}(i);if(e)return this.#Ed=e,void this.#ou();const t=function(e){if(!hp(e)||!0!==e.success||!hp(e.ui))return null;const t=e.ui,n=pp(t.step);if(null!==t.template||!n||"afterClaim"===n||"afterComplete"===n)return null;const i=pp(t.experimentId),r=pp(e.locale);return{...i&&{experimentId:i},...r&&{locale:r},step:n,stepExperimentId:pp(t.stepExperimentId)??null}}(i);if(t)return void this.#tu("unknown_step",t);const n=function(e){if(!hp(e)||!0!==e.success||!hp(e.ui))return null;const t=e.ui;if(null!==t.template)return null;const n=pp(t.experimentId);if(!n)return null;const i=pp(e.locale);return{experimentId:n,...i&&{locale:i}}}(i);return void(n&&this.#tu("holdout",n))}this.#od=s,this.#Xc=i,this.#Id="ready"}#Zd(e){if(!hp(e)||!hp(e.ui)||0===Object.keys(this.#Qc).length)return{response:e,drawn:[]};const t=e.ui,{template:n,drawn:i}=function(e,t){if(!lu(e)||!lu(e.textSlots)||!lu(e.strings))return{template:e,drawn:[]};if("string"==typeof e.layout&&nu.has(e.layout))return{template:e,drawn:[]};const n={...e.strings},i=[];for(const r of tu){const o=cu(e.textSlots,r)?e.textSlots[r]:void 0,s=t[r];"string"==typeof o&&void 0!==s&&cu(n,o)&&"string"==typeof n[o]&&(n[o]=s,i.push(r))}return 0===i.length?{template:e,drawn:i}:{template:{...e,strings:n},drawn:i.sort()}}(t.template,this.#Qc);return 0===i.length?{response:e,drawn:i}:{response:{...e,ui:{...t,template:n}},drawn:i}}#lu(e,t=!0){const n=e.template;if(!this.plugin.precheck||!hp(n))return null;if(!this.#Qd().includes(n.trigger)){if("string"!=typeof n.trigger||""===n.trigger)return null;const t=pp(e.variantId),i=pp(e.experimentId),r=pp(n.layout);return{ids:{...t&&{variantId:t},...i&&{experimentId:i}},...r&&{layout:r}}}let i;try{i=this.plugin.precheck(n)}catch(e){i={reason:String(e),path:"$"}}if(!i)return null;const r=pp(e.variantId),o=pp(e.experimentId),s=`${this.id}|${r??""}|${i.path}`;t&&!bp.has(s)&&(bp.add(s),u.warn(`Trigger ${this.id}: served template is unrenderable on this build (${i.reason} at ${i.path}); rendering nothing`));const a=pp(n.layout);return{ids:{...r&&{variantId:r},...o&&{experimentId:o},trigger:n.trigger},...a&&{layout:a}}}#Gd(e=!1){const t=this.#od,n=this.#rd;if(this.#v||!t||null===n)return void this.#Zn();this.#ed.sync();const i=this.#cu(),r=i&&(e||this.#gd);e?this.#gd=!i:r&&(this.#gd=!1);let o=null;try{o=this.plugin.present(n,t.config,{now:Date.now(),request:this.#Ae,dismissed:this.#ed.keys(),options:this.#Yc,placement:this.#Yd(),mountState:this.#$d,appearance:this.#ve.appearance,portal:t.portal??{},icon:this.#ve.icon,canAutoTap:r,lookValues:this.#Zc,dismissedOf:e=>this.#eu(e).keys(),readAgainAt:e=>{this.#v||this.#nu(e)}})}catch(e){this.#Rd("present failed; rendering nothing",e)}if(!o)return void this.#Zn();const s=this.#Qt;if(s&&s.presentation.contentKey===o.contentKey){let e=!1;try{e=s.view.update(o.model)}catch(e){this.#Rd("update failed; redrawing",e)}if(e)return s.presentation=o,this.#du(o.refreshAt),void this.#uu(o,t)}const a=this.#Qt,l=null!==a&&gp(a.presentation,this.id)!==gp(o,this.id),c=l&&a.view.root.contains(document.activeElement);this.#Zn(),this.#Yn(o,t),l&&this.#Qt&&function(e,t){try{t&&(e.matches(yp)?e:e.querySelector(yp))?.focus(),function(){try{return!0===window.matchMedia?.("(prefers-reduced-motion: reduce)").matches}catch{return!1}}()||"function"!=typeof e.animate||e.animate([{opacity:0},{opacity:1}],{duration:200})}catch{}}(this.#Qt.view.root,c)}#Yn(e,t){let n;try{n=this.plugin.render(e.model,{tapped:e=>this.#Wd(e),dismissed:()=>this.#hu()})}catch(n){return this.#Rd("render failed; rendering nothing",n),void this.#tu("unrenderable",{...t,trigger:gp(e,this.id)},e.eventFields)}t.locale&&(n.root.setAttribute("lang",t.locale),n.root.setAttribute("dir",Ne(t.locale)?"rtl":"ltr")),tp(n.root,this.#Gc,this.#oi),this.#oi.appendChild(n.root),this.#Qt={presentation:e,view:n,observer:null},this.#Qt.observer=this.#pu(n.root),this.#du(e.refreshAt),this.#uu(e,t),this.#sd??=setInterval(()=>{const e=null!==this.#Qt&&!this.#oi.contains(this.#Qt.view.root);this.#Ud()||e?this.unmount():"hidden"!==document.visibilityState&&(this.#Gd(),this.#fu(),this.#mu())},1e3)}#uu(e,t){(e.notShownReason||e.autoTap)&&this.#kd!==e.contentKey&&(this.#kd=e.contentKey,e.notShownReason&&this.#tu(e.notShownReason,t,e.notShownEventFields??e.eventFields),e.autoTap&&this.#Wd(e.autoTap))}#nu(e){if(!Number.isFinite(e))return;if(null!==this.#ld&&this.#cd<=e)return;this.#Dd(),this.#cd=e;const t=Au(e,Date.now());this.#ld=setTimeout(()=>{this.#ld=null,this.#v||"hidden"!==document.visibilityState&&this.#Nd(!1,!1)},t)}#Dd(){null!==this.#ld&&clearTimeout(this.#ld),this.#ld=null}#du(e){null!==this.#ad&&(clearTimeout(this.#ad),this.#ad=null),void 0!==e&&Number.isFinite(e)&&(this.#ad=setTimeout(()=>{this.#ad=null,this.#Gd()},Au(e,Date.now())))}#Zn(){this.#gu(),null!==this.#sd&&(clearInterval(this.#sd),this.#sd=null),null!==this.#ad&&(clearTimeout(this.#ad),this.#ad=null);const e=this.#Qt;e&&(this.#Qt=null,this.#ud=0,this.#hd=null,e.observer?.disconnect(),e.view.root.remove())}#pu(e){const t="undefined"!=typeof window?window.IntersectionObserver:void 0;if("function"!=typeof t)return null;try{const n=new t(t=>{const n=this.#Qt;if(n?.view.root===e){for(const n of t)n.target===e&&(this.#ud=n.isIntersecting?Bs(n):0);this.#fu(),this.#mu()}},{threshold:[...js]});return n.observe(e),n}catch(e){return this.#Rd("IntersectionObserver unavailable",e),null}}#fu(){const e=this.#Qt;if(!e)return;let t=!1;try{t=!0===this.#Jc.sheetBusy?.()}catch{t=!1}const n=this.#ud>0&&"hidden"!==document.visibilityState&&!t;if(n!==this.#hd){this.#hd=n;try{e.view.setOnScreen?.(n)}catch{}}}#mu(){const e=this.#Qt;if(null===e||this.#nd.has(e.presentation.contentKey)||!(this.#ud>=.5)||"hidden"===document.visibilityState||this.#Vd()||Cp(e.view.root)||Rc(e.view.root))return void this.#gu();if(null!==this.#dd)return;const t=e.presentation.contentKey;this.#dd=setTimeout(()=>{this.#dd=null,this.#Qt?.presentation.contentKey!==t||this.#nd.has(t)||this.#Vd()||Cp(this.#Qt.view.root)||Rc(this.#Qt.view.root)||(this.#nd.add(t),this.#yu((e,t)=>B(e,t)))},1e3)}#gu(){null!==this.#dd&&(clearTimeout(this.#dd),this.#dd=null)}#pa(){this.#v||(this.#Ud()?this.unmount():(this.#fu(),this.#mu(),this.#Jd(),"visible"===document.visibilityState&&this.#Od.request()))}#Wd(e,t=!1){const n=this.#Qt;if(!n||this.#v||this.#Ad)return;const i=t||e===n.presentation.autoTap;if(rp||i&&this.#Vd())return void(i&&this.#Kd(e,n.presentation.model));this.#zd();const r=Date.now(),o=`${this.id}|${n.presentation.contentKey}`;for(const[e,t]of xp)r-t>=1e3&&xp.delete(e);if(xp.has(o))return;xp.set(o,r);const s=this.#na,a=n.presentation.model;let l=!1;try{l=!0===this.plugin.opensSheet?.(a,e)}catch(e){this.#Rd("opensSheet failed",e)}const c=l?te():void 0;let d=!1,u=!1;const h=()=>{u||(u=!0,this.#yu((t,n)=>i?_(t,n):H(t,n,e),n,c))},p=i;p||h();const f={options:this.#Yc,mountState:this.#$d,...c&&{presentationId:c},presentSheet:e=>this.#bu(()=>d=!0,{...e,onPresented:()=>{p&&h();try{e.onPresented?.()}catch(e){this.#Rd("onPresented failed",e)}},presentationId:c??te(),...i&&{automatic:!0},...this.#ve.publisherReward&&{publisherReward:this.#ve.publisherReward},isCurrent:()=>!this.#v&&s===this.#na})};let m;try{m=this.plugin.onTap(a,e,f)}catch(e){this.#Rd("tap failed",e),m="refresh"}if("string"==typeof m)return void("refresh"===m&&this.#Nd(d));this.#Ad=!0;const g=Symbol("tap");rp=g,this.#vu(n,!0);const y=e=>{if(rp===g&&(rp=null,d?sp():op()),"refresh"===e)for(const e of ip)e!==this&&e.refresh(d);this.#v||s!==this.#na||(this.#Ad=!1,this.#vu(n,!1),"refresh"===e&&this.#Nd(d))};Promise.resolve(m).then(e=>y(e),e=>{this.#Rd("tap failed",e),y("refresh")}).catch(e=>this.#Rd("tap settle failed",e))}#vu(e,t){try{e.view.setBusy?.(t)}catch{}}#bu(e,t){return this.#wu(t).then(t=>("claimed"===t.status&&e(),t))}#wu(e){const t={status:"unavailable"},n=this.#Jc;if(!n.presentSheet)return Promise.resolve(t);let i;try{i=n.presentSheet(e).catch(()=>t)}catch{i=Promise.resolve(t)}return i.then(t=>{const n=this.#ve.onResult;if(e.automatic&&!e.isCurrent())return t;if("function"==typeof n)try{n(t)}catch(e){this.#Rd("onResult threw",e)}return t})}#xu(){try{if(this.#oi.contains(document.activeElement))return;const e=this.#Qt?.view.root,t=e?e.matches(yp)?e:e.querySelector(yp):null;if(t)return void t.focus();this.#oi.hasAttribute("tabindex")||this.#oi.setAttribute("tabindex","-1"),this.#oi.focus()}catch{}}#hu(){const e=this.#Qt;if(!e?.presentation.dismissible)return;const t=e.view.root.contains(document.activeElement);this.#yu((e,t)=>V(e,t));const n=gp(e.presentation,this.id),i=e.presentation.dismissKeys??[e.presentation.contentKey],r=this.#eu(n);for(const e of i)r.add(e);n!==this.id?this.#Nd():(this.#Gd(),t&&this.#xu());for(const e of ip)e!==this&&(e.draws(n)?e.dismissedElsewhere(n):e.id===this.id&&e.dismissedElsewhere());for(const e of[...cp])try{e(n)}catch(e){this.#Rd("dismiss listener failed",e)}}#tu(e,t,n={},i=null){const r=()=>{if(this.#v)return;const r=this.#Yd(),o=S(r)??"",s=t?.trigger??this.id,a=s!==this.id,l=a?`${o}|${e}|in:${this.id}`:`${o}|${e}`;if(!wp(this.#f,s,null===i?l:`${l}|${i}`))return;const c={trigger:s,...a&&{hostTrigger:this.id},useCase:this.#Ae.useCase,...void 0!==r&&{placementId:r},...t?.variantId&&{variantId:t.variantId},experimentId:t?.experimentId??null,...n.transactionId&&{transactionId:n.transactionId},...n.campaignId&&{campaignId:n.campaignId},...n.layout&&{layout:n.layout},...t?.locale&&{locale:t.locale},...t?.step&&{step:t.step,stepExperimentId:t.stepExperimentId??null}};try{this.#Jc.track(t=>q(t,c,e))}catch(e){this.#Rd("analytics failed",e)}};this.#qd()?r():this.#id.push(r)}#Qd(){let e=[];try{e=this.plugin.alsoDraws??[]}catch{e=[]}return[this.id,...e]}#ou(){const e=this.#Ed;if(!e)return;const t=this.#ku();null!==t&&this.#tu("after_complete_hide",e,{},t)}#ku(){const e=this.#rd;if(null===e||!this.plugin.completionOf)return null;try{return this.plugin.completionOf(e)??null}catch{return null}}#eu(e){if(e===this.id)return this.#ed;let t=this.#Md.get(e);return t||(t=new Zh(this.#f,e),this.#Md.set(e,t)),t.sync(),t}#qd(){return"hidden"!==document.visibilityState&&this.#oi.isConnected}#cu(){return this.#qd()&&!1!==this.#yd}#Fd(){if(this.#bd?.disconnect(),this.#bd=null,this.#yd=null,!bc(this.id,this.#Ae))return;const e="undefined"!=typeof window?window.IntersectionObserver:void 0;if("function"==typeof e)try{const t=new e(e=>{if(!this.#v&&this.#bd===t){for(const t of e)t.target===this.#xd&&(this.#yd=t.isIntersecting);this.#yd&&this.#gd&&this.#Gd()}});this.#yd=!1,this.#bd=t,this.#xd=Ip(this.#oi),t.observe(this.#xd)}catch(e){this.#yd=null,this.#Rd("IntersectionObserver unavailable",e)}}#Bd(){this.#bd?.disconnect(),this.#bd=null}#Pd(){if(this.#vd||this.#wd)return;const e="undefined"!=typeof window?window.IntersectionObserver:void 0;if("function"==typeof e)try{const t=Ip(this.#oi),n=new e(e=>{this.#v||this.#wd!==n||e.some(e=>e.target===t&&e.isIntersecting)&&(this.#vd=!0,this.#Hd(),this.#Nd())});this.#wd=n,n.observe(t)}catch(e){this.#vd=!0,this.#Rd("IntersectionObserver unavailable",e)}else this.#vd=!0}#Hd(){this.#wd?.disconnect(),this.#wd=null}#Jd(){if(this.#qd())for(const e of this.#id.splice(0))e()}#yu(e,t=this.#Qt,n){const i=this.#od;if(!t||!i)return;const r=this.#Yd(),{transactionId:o,campaignId:s,layout:a}=t.presentation.eventFields,l=gp(t.presentation,this.id),c={trigger:l,useCase:this.#Ae.useCase,...void 0!==r&&{placementId:r},...i.variantId&&{variantId:i.variantId},experimentId:i.experimentId??null,...o&&{transactionId:o},...s&&{campaignId:s},...a&&{layout:a},...i.locale&&{locale:i.locale},...n&&{presentationId:n},...l!==this.id&&{hostTrigger:this.id},...i.step&&{step:i.step,stepExperimentId:i.stepExperimentId??null},...$p(i.textSlots,t.presentation.eventFields.undrawnSlots)};try{this.#Jc.track(t=>e(t,c))}catch(e){this.#Rd("analytics failed",e)}}}function $p(e,t){const n=(e??[]).filter(e=>!(t??[]).includes(e));return n.length>0?{textSlots:n}:{}}function Cp(e){try{for(let t=e;t;t=t.parentElement)if(0===Number.parseFloat(window.getComputedStyle(t).opacity))return!0}catch{}return!1}function Ip(e){let t=e;try{for(;t.parentElement&&"contents"===getComputedStyle(t).display;)t=t.parentElement}catch{return e}return t}var Sp=Object.freeze({__proto__:null,NOOP_HANDLE:Jh,SWITCH_FADE_MS:200,appSheetClaimed:function(){sp()},claimNotShownToday:wp,claimsChanged:function(){for(const e of ip)e.refresh(!0)},dismissedByCustom:up,forgetPageTap:function(){rp=null,xp.clear(),vp.clear()},forgetTriggerMemory:function(){qh.clear(),Wh.clear(),vp.clear()},mountTrigger:function(e,t,n,i,r){const o=function(e){if("function"==typeof e.prepare){const t=e;return{id:t.id,load:()=>Promise.resolve(t)}}return e}(e);try{if("object"!=typeof(s=t)||null===s||"function"!=typeof s.appendChild||1!==s.nodeType)return u.error(`Trigger ${o.id}: mount() needs an element; rendering nothing`),Jh;if(!i)return Jh;const e=n??{},a=kc(o.id,e);if(!a)return Jh;const l=new kp(o,t,e,a,i,r);return l.start().catch(e=>{u.warn(`Trigger ${o.id}: failed to start; rendering nothing`,e)}),{triggerId:o.id,unmount:()=>l.unmount(),reload:e=>l.reload(e),refresh:()=>l.refreshSoon(),setAlignment:e=>l.setAlignment(e),setText:e=>l.setText(e)}}catch(e){return u.warn(`Trigger ${o.id}: mount failed; rendering nothing`,e),Jh}var s},noopHandle:function(){return{unmount:Xh,setAlignment:Xh,setText:Xh}},onTriggerDismissed:dp,readTriggerResponse:fp,settlePageTap:lp,takePageTap:ap,triggerAlignmentOf:ep});const Ep="custom",Tp=new Set,Ap=Object.freeze({showReminder:!0,hide:!1,thanks:!1,autoOpen:!1});function Lp(e){if("object"!=typeof e||null===e||Array.isArray(e))return null;const t=e,n=t.template;if("object"!=typeof n||null===n||Array.isArray(n))return null;if(n.trigger!==$)return null;const i=Td(n,$);return{rules:{showReminder:"stay"!==i.afterClaim,hide:"hide"===i.afterComplete,thanks:"thanks"===i.afterComplete,autoOpen:"on"===i.autoOpen},arm:{..."string"==typeof t.variantId&&""!==t.variantId&&{variantId:t.variantId},experimentId:"string"==typeof t.experimentId&&""!==t.experimentId?t.experimentId:null}}}const Op={status:"unavailable"};class Np{#ve;#Jc;#$u;#Cu;#Iu;#Bc=Ap;#Su=null;#Eu=!1;#Tu=!1;#Au;#Lu;#ed;#f=null;#Ss={kind:"hidden"};#Ou=null;#Nu=[];#ua=0;#Mu=null;#Uu=null;#nd=new Set;#dd=null;#ad=null;#Ru=0;#na=0;#Ad=!1;#v=!1;#Fu=!1;#Pu=null;#zu=e=>{e===C.claimReminder&&this.read(!1)};#Od=new Qh(()=>this.#ju());#Ld=()=>{this.#v||(this.#mu(),"visible"===document.visibilityState&&(this.#Du(),this.#Fu&&this.#Bu(),this.#Od.request()))};constructor(e,t,n){this.#ve=e,this.#Jc=t,this.#$u=n;const i=kc($,{useCase:e.useCase,autoOpen:e.autoOpen});this.#Cu=i?.useCase??null,this.#Iu="off"===i?.autoOpen,function(e){const t=e;for(const e of["afterClaim","afterComplete"])void 0!==t?.[e]&&xc(`retired|${e}`,`Encore.claim: ${e} is no longer an option and is ignored; Encore decides what your view shows after a claim and after a completion`)}(e),this.#Lu=S(e.placement)??"";try{this.#f=t.host.storage()}catch{this.#f=null}this.#ed=new Zh(this.#f,C.claimReminder),this.#Au=Th(()=>this.#f)}#Hu(){const e=this.#Jc.host.fetchConfig,t=this.#Cu;if(this.#Eu||this.#v||!e||!t)return;this.#Eu=!0;const n=this.#na;let i;try{i=e($,this.#ve.placement,{useCase:t,...this.#Iu&&{autoOpen:"off"}})}catch(e){i=Promise.reject(e instanceof Error?e:new Error(String(e)))}i.then(e=>{if(this.#v||n!==this.#na)return;const t=Lp(e?.ui);if(!t)return;const i=this.#Bc;this.#Su=t.arm,this.#Bc={...t.rules,autoOpen:t.rules.autoOpen&&!this.#Iu},(i.showReminder!==this.#Bc.showReminder||i.hide!==this.#Bc.hide||i.thanks!==this.#Bc.thanks)&&this.#ju();const r=this.#Ou;"gifts"===this.#Ss.kind&&null!==r&&this.#nd.has(r)&&this.#_u()}).catch(e=>{u.debug("Encore.claim: could not read the rules; keeping the defaults",e)})}start(){Tp.add(this),document.addEventListener("visibilitychange",this.#Ld),this.#Pu=dp(this.#zu),this.#ju()}#ju(){if(!(this.#Bc.showReminder||this.#Bc.hide||this.#Bc.thanks)||void 0===this.#Jc.checkClaims)return void this.read(!1);const e=this.#na;(async()=>{try{this.#ed.sync();const e=this.#ed.keys();await(this.#Jc.checkClaims?.(t=>e.has(t)))}catch(e){u.debug("Encore.claim: could not check the claims",e)}this.#v||e!==this.#na||this.read(!1)})()}#Vu(e){try{return!1!==this.#Jc.claimTapped?.(e)}catch{return!0}}#Wa(){if(!this.#Bc.thanks)return null;try{const e=this.#Jc.thanksFor?.();return"string"==typeof e&&""!==e?e:null}catch{return null}}#qu(){if(!this.#Bc.hide)return!1;try{return!0===this.#Jc.completedToday?.()}catch{return!1}}refreshSoon(){this.#v||this.#Od.request()}read(e){if(this.#v)return;const t=this.#Cu;if(!t)return void this.#Yn({kind:"hidden"},null);const n=++this.#Ru,i=this.#na,r=()=>this.#v||n!==this.#Ru||i!==this.#na;(async()=>{if(this.#qu())return void this.#Yn({kind:"hidden"},null);let n={status:"none"};try{n=await this.#Jc.checkSheet(t,this.#ve.placement,e)}catch{n={status:"none"}}if(r())return;if("sheet_unavailable"===n.status&&this.#Bu(),"offers"!==n.status)return void this.#Yn({kind:"hidden"},null);if(this.#Bc.showReminder){let e=[];try{const t=await this.#Jc.claims();e=Array.isArray(t)?t:[]}catch{e=[]}if(r())return;this.#ed.sync();const t=mu(e.filter(e=>n.campaignIds.has(e.campaignId)),24,Date.now(),this.#ed.keys()),i=t[0];if(i){const e=Date.parse(i.claimedAt),n=fu(i,24),r=Math.min(...t.map(e=>fu(e,24))),o=qe(i.advertiserLogoUrl??void 0),s=i.perk?.trim();return this.#Nu=t.map(e=>e.transactionId),void this.#Yn({kind:"reminder",transactionId:i.transactionId,campaignId:i.campaignId,advertiserName:i.advertiserName.trim(),...o&&{logoUrl:o},...s&&{perk:s},claimedAt:new Date(e),deadline:new Date(n),claimCount:t.length},i.transactionId,r)}}const i=Su(n.offers??[]).map(e=>({logoUrl:e.logoUrl,...e.advertiserName&&{advertiserName:e.advertiserName}})),o=n.offers?n.offers.length:n.campaignIds.size,s=this.#Wa();null===s?this.#Wu({kind:"gifts",offerCount:o,logos:i}):this.#Yn({kind:"thanks",offerCount:o,logos:i},`${this.#Lu}|thanks|${s}`,Lu())})().catch(e=>{u.warn("Encore.claim: read failed; hiding",e),r()||this.#Yn({kind:"hidden"},null)})}#Wu(e){this.#Yn(e,`${this.#Lu}|${Ih(Date.now())}`,Lu(),()=>{this.#Ss===e&&this.#Wu(e)})}#Yn(e,t,n,i){this.#Ss=e,this.#Ou=t,"reminder"!==e.kind&&(this.#Nu=[]),this.#Ku(n,i);try{this.#$u(e)}catch(e){u.warn("Encore.claim: state delivery failed",e)}this.#mu()}#Ku(e,t){null!==this.#ad&&clearTimeout(this.#ad),this.#ad=null,void 0!==e&&Number.isFinite(e)&&(this.#ad=setTimeout(()=>{this.#ad=null,this.#v||(t?t():"hidden"!==document.visibilityState&&this.read(!1))},Au(e,Date.now())))}#ha(){try{return!0===this.#Mu?.()}catch{return!1}}#Vd(){try{return!0===this.#Jc.host.sheetBusy?.()}catch{return!1}}setVisible(e,t){this.#Mu=t??null,this.#v||(this.#ua=e,this.#Du(),this.#mu())}#Du(){this.#ua>0&&"hidden"!==document.visibilityState&&this.#Hu()}#mu(){const e=this.#Ou,t=null!==e&&"hidden"!==this.#Ss.kind&&this.#ua>=.5&&"hidden"!==document.visibilityState&&!this.#nd.has(e);return null!==this.#Uu&&clearTimeout(this.#Uu),this.#Uu=null,t&&this.#ha()?(null!==this.#dd&&clearTimeout(this.#dd),this.#dd=null,void(this.#Uu=setTimeout(()=>{this.#Uu=null,this.#v||this.#mu()},250))):t?void(null===this.#dd&&(this.#dd=setTimeout(()=>{this.#dd=null,this.#v||this.#Ou!==e||this.#nd.has(e)||(this.#Vd()||"hidden"===document.visibilityState||this.#ua<.5||this.#ha()?this.#mu():(this.#nd.add(e),this.#yu((e,t)=>B(e,t)),"gifts"===this.#Ss.kind&&this.#_u()))},1e3))):(null!==this.#dd&&clearTimeout(this.#dd),void(this.#dd=null))}#Gu(e){const t=this.#Ss;if("hidden"===t.kind||!this.#Cu)return null;const n="reminder"===t.kind,i=this.#Su;return{trigger:$,useCase:this.#Cu,placementId:this.#ve.placement,...i?.variantId&&{variantId:i.variantId},experimentId:i?.experimentId??null,layout:Ep,...n&&{transactionId:t.transactionId,campaignId:t.campaignId},...e&&{presentationId:e}}}#yu(e,t){const n=this.#Gu(t);if(n)try{this.#Jc.host.track(t=>e(t,n))}catch(e){u.warn("Encore.claim: analytics failed",e)}}#Bu(){if(!this.#Cu)return;if("hidden"===document.visibilityState)return void(this.#Fu=!0);if(this.#Fu=!1,!wp(this.#f,$,`${this.#Lu}|${Ep}|sheet_unavailable`))return;const e={trigger:$,useCase:this.#Cu,placementId:this.#ve.placement,experimentId:null,layout:Ep};try{this.#Jc.host.track(t=>q(t,e,k.sheetUnavailable))}catch(e){u.warn("Encore.claim: analytics failed",e)}}#_u(){if(this.#Tu||!this.#Bc.autoOpen||this.#Iu)return;if(this.#Vd()||"hidden"===document.visibilityState)return;this.#Tu=!0;const e=Date.now();if(!this.#Au.reservePop(this.#ve.placement,e))return;const t=Ih(e);let n=!1;this.#zr("auto",!0,()=>{n=!0}).then(()=>{n||this.#Au.releasePop(this.#ve.placement,t)})}tap(e){return this.#zr(e,!1)}#zr(e,t,n){const i=this.#Ss,r=this.#Jc.host.presentSheet;if(this.#v||"hidden"===i.kind||this.#Ad||!this.#Cu||!r)return Promise.resolve(Op);if("reminder"===i.kind&&!this.#Vu(i.transactionId))return this.read(!1),Promise.resolve(Op);const o=ap();if(!o)return Promise.resolve(Op);this.#Ad=!0;const s=this.#na,a=te(),l=e??("reminder"===i.kind?"card":"button"),c=()=>this.#yu((e,n)=>t?_(e,n):H(e,n,l),a);let d;t||c();try{d=r({useCase:this.#Cu,placement:this.#ve.placement,presentationId:a,...this.#ve.publisherReward&&{publisherReward:this.#ve.publisherReward},isCurrent:()=>!this.#v&&s===this.#na,...t&&{automatic:!0},onPresented:()=>{if(t&&c(),n?.(),"thanks"===i.kind)try{this.#Jc.thanksTapped?.()}catch{}}}).catch(()=>Op)}catch{d=Promise.resolve(Op)}return d.then(e=>{this.#Ad=!1;const t="claimed"===e.status;lp(o,t);const n=this.#ve.onResult;if("function"==typeof n)try{n(e)}catch(e){u.warn("Encore.claim: onResult threw",e)}return this.read(t),e})}dismiss(){if(!this.#v&&"reminder"===this.#Ss.kind){this.#yu((e,t)=>V(e,t));for(const e of this.#Nu)this.#ed.add(e);up(C.claimReminder,this.#zu),this.read(!1)}}reload(e){if(!this.#v)return"identity"===e?(this.#na++,this.#nd.clear(),this.#Fu=!1,this.#Bc=Ap,this.#Su=null,this.#Eu=!1,this.#Tu=!1,this.#Du(),this.#Yn({kind:"hidden"},null),void this.#ju()):void this.read(!1)}destroy(){this.#v||(this.#v=!0,Tp.delete(this),document.removeEventListener("visibilitychange",this.#Ld),this.#Od.cancel(),this.#Pu?.(),this.#Pu=null,null!==this.#dd&&clearTimeout(this.#dd),null!==this.#ad&&clearTimeout(this.#ad),null!==this.#Uu&&clearTimeout(this.#Uu),this.#dd=null,this.#ad=null,this.#Uu=null)}}var Mp=Object.freeze({__proto__:null,CUSTOM_LAYOUT:Ep,CUSTOM_WINDOW_HOURS:24,claimsChangedForCustom:function(){for(const e of Tp)e.read(!0)},readClaimRules:Lp,refreshCustom:function(){for(const e of Tp)e.refreshSoon()},reloadCustom:function(e="identity"){for(const t of Tp)t.reload(e)},startCustomClaim:function(e,t,n){const i=new Np(e,t,n);try{i.start()}catch(e){u.warn("Encore.claim: failed to start; hiding",e)}return i}});exports.renderPreview=function(e,t){const n=document.createElement("style");n.textContent=function(e={}){return Tn(e)}(),e.insertBefore(n,e.firstChild);let i=null,r=!1;const s=t=>{i?.(),Se();const n=o(t.ui.useCase)??"reduceChurn",r={...t.ui,variantId:t.ui.variantId??null},s={success:!0,locale:t.locale,ui:r,useCases:"reduceChurn"===n?{}:{[t.ui.useCase]:r}},a=nt(t.offers);let l=!1,c=null;const d=pd.runPreview({mount:e,end:null,mounted:()=>{l&&c?.stop()}},{fetchConfig:()=>Promise.resolve(s),fetchOffers:()=>Promise.resolve({offers:a}),reportError:()=>Promise.resolve()},n);c=d,d.flow.then(({result:e,override:t})=>{l||u.warn(`Preview has nothing to render (${t?.notPresentedReason??JSON.stringify(e)})`)}),i=()=>{l=!0,d.stop()}};return s(t),{update:e=>{r||s(e)},destroy:()=>{r||(r=!0,i?.(),i=null,n.remove(),Se())}}},exports.renderTriggerPreview=function(e,t){let n,i={status:"empty"},r=!1;const o=t=>{n?.root.remove(),n=void 0;const r=function(e){const{template:t}=e,n=ku(t)?t.trigger:void 0,i=e.now??Date.now(),r=e.state??"default",o="completed"===r?"preview-completion":null,s="claimOpen"===r?function(e,t){return e.map((e,n)=>({transactionId:`preview-claim-${n+1}`,campaignId:`preview-campaign-${n+1}`,advertiserName:e.advertiserName,advertiserLogoUrl:e.advertiserLogoUrl??null,...void 0!==e.perk&&{perk:e.perk},claimedAt:e.claimedAt??new Date(t-72e5).toISOString(),availability:"available"}))}(e.claims??[],i):[],a={useCase:"rewardUsers",claims:s,campaignIds:new Set(s.map(e=>e.campaignId)),...o&&{completion:o}},l={now:i,request:{useCase:"rewardUsers",layout:(ku(t)&&"string"==typeof t.layout?t.layout:"")||"preview"},dismissed:Hh,dismissedOf:()=>Hh,options:{},placement:"preview",mountState:Object.create(null),appearance:{...e.appearance,colorScheme:e.colorScheme??"dark"},portal:{...e.portal},icon:e.icon??"gift",canAutoTap:!1,lookValues:e.values??{},readAgainAt:()=>{}},c=wh({..._h,source:()=>null});if(n===C.claimReminder)return Vh(c,t,a,l,()=>!1);if(n===C.giftsButton){const n=Su((e.offers??[]).map((e,t)=>({campaignId:`preview-offer-${t+1}`,...e})));return Vh(Dh(zh(_h),c,{}),t,{gifts:{useCase:"rewardUsers",offerLogos:n,...o&&{thanks:o}},reminder:s.length>0?a:null,completion:o},l,e=>null===e.model.template)}return{result:{status:"unrenderable",reason:`no drawn trigger "${String(n)}"`}}}(t);return i=r.result,n=r.view,n&&e.appendChild(n.root),i};return o(t),{get result(){return i},update:e=>r?i:o(e),destroy:()=>{r||(r=!0,n?.root.remove(),n=void 0,i={status:"empty"})}}};
2
+ //# sourceMappingURL=preview.cjs.map