@salla.sa/twilight-components 3.0.28 → 3.0.30

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 (353) hide show
  1. package/dist/cjs/{Helper-D5nuQnlA.js → Helper-CigI49vP.js} +1 -1
  2. package/dist/cjs/{filepond-C4YwUSjY.js → filepond-BiMGitQY.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-poster-B-m6bwrO.js → filepond-plugin-file-poster-Ck74ON7P.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-size-CmLAuKK8.js → filepond-plugin-file-validate-size-CVhF1tOl.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-file-validate-type-HAq2ahg2.js → filepond-plugin-file-validate-type-Dl1QbcFU.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-edit-WPZzSlfF.js → filepond-plugin-image-edit-fNw4v5VI.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-exif-orientation-DwRyC-Iy.js → filepond-plugin-image-exif-orientation-K26RIxgg.js} +1 -1
  8. package/dist/cjs/{filepond-plugin-image-preview-Bva7TPZg.js → filepond-plugin-image-preview-DUPpLMnJ.js} +1 -1
  9. package/dist/cjs/{index-CpC602lV.js → index-BC6gcbLd.js} +2 -2
  10. package/dist/cjs/{intlTelInput-xxeZCkBx.js → intlTelInput-PXq8m_uI.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +2 -2
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +2 -2
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-applied-filters.cjs.entry.js +2 -2
  19. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-attachment-view_9.cjs.entry.js +11 -11
  21. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-bullet-delivery_3.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-comment-form_9.cjs.entry.js +2 -2
  30. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters-widget.cjs.entry.js +2 -2
  38. package/dist/cjs/salla-filters.cjs.entry.js +2 -2
  39. package/dist/cjs/salla-free-shipping-banner.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-free-shipping-tag.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-gift-card-redeem_2.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +2 -2
  46. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-map_3.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-mobile-update-modal.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-notification-item_2.cjs.entry.js +2 -2
  66. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-order-items.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-order-options-modal.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-order-payment.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-order-rewards.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-orders.cjs.entry.js +2 -2
  84. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-product-card.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-products-list.cjs.entry.js +2 -2
  91. package/dist/cjs/salla-products-slider.cjs.entry.js +2 -2
  92. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +2 -2
  94. package/dist/cjs/salla-rating-modal.cjs.entry.js +2 -2
  95. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-search-product-card.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-search.cjs.entry.js +2 -2
  100. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-thank-you-header.cjs.entry.js +1 -1
  105. package/dist/cjs/salla-thank-you-page.cjs.entry.js +1 -1
  106. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  107. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  108. package/dist/cjs/salla-user-menu.cjs.entry.js +2 -2
  109. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  110. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  111. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  112. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  113. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  114. package/dist/cjs/salla-wishlist-summary.cjs.entry.js +2 -2
  115. package/dist/cjs/twilight.cjs.js +1 -1
  116. package/dist/cjs/{vanilla-picker-B4ryCcaf.js → vanilla-picker-BtI42wjx.js} +1 -1
  117. package/dist/collection/components/salla-user-menu/salla-user-menu.css +2 -0
  118. package/dist/components/index.js +2 -2
  119. package/dist/components/salla-user-menu.js +1 -1
  120. package/dist/docs.json +1 -1
  121. package/dist/esm/{Helper-qEdrYF7X.js → Helper-Xo2bQXZz.js} +1 -1
  122. package/dist/esm/{filepond-CpWsO7Mv.js → filepond-CnC-Gw5u.js} +1 -1
  123. package/dist/esm/{filepond-plugin-file-poster-BA_cB5e8.js → filepond-plugin-file-poster-Tq5buhXU.js} +1 -1
  124. package/dist/esm/{filepond-plugin-file-validate-size-7bfJMSeh.js → filepond-plugin-file-validate-size-Fvp89fAI.js} +1 -1
  125. package/dist/esm/{filepond-plugin-file-validate-type-y8X7We_2.js → filepond-plugin-file-validate-type-0J-wZKP5.js} +1 -1
  126. package/dist/esm/{filepond-plugin-image-edit-D_eWaz3f.js → filepond-plugin-image-edit-BGdpmDUz.js} +1 -1
  127. package/dist/esm/{filepond-plugin-image-exif-orientation-DHbfnm0Z.js → filepond-plugin-image-exif-orientation-gP2ZIc0I.js} +1 -1
  128. package/dist/esm/{filepond-plugin-image-preview-D47iLjXV.js → filepond-plugin-image-preview-DEn_x6Op.js} +1 -1
  129. package/dist/esm/{index-DRvWpd5P.js → index-BXSGktmF.js} +2 -2
  130. package/dist/esm/{intlTelInput-CmiKdRvm.js → intlTelInput-D7f8BwQF.js} +1 -1
  131. package/dist/esm/loader.js +2 -2
  132. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  133. package/dist/esm/salla-accordion_6.entry.js +2 -2
  134. package/dist/esm/salla-add-product-button_5.entry.js +2 -2
  135. package/dist/esm/salla-advertisement.entry.js +1 -1
  136. package/dist/esm/salla-alert_2.entry.js +1 -1
  137. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  138. package/dist/esm/salla-applied-filters.entry.js +2 -2
  139. package/dist/esm/salla-apps-icons.entry.js +1 -1
  140. package/dist/esm/salla-attachment-view_9.entry.js +11 -11
  141. package/dist/esm/salla-badge.entry.js +1 -1
  142. package/dist/esm/salla-basket-gap.entry.js +1 -1
  143. package/dist/esm/salla-bullet-delivery_3.entry.js +1 -1
  144. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  145. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  146. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  147. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  148. package/dist/esm/salla-comment-factors.entry.js +1 -1
  149. package/dist/esm/salla-comment-form_9.entry.js +2 -2
  150. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  151. package/dist/esm/salla-contacts.entry.js +1 -1
  152. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  153. package/dist/esm/salla-count-down.entry.js +1 -1
  154. package/dist/esm/salla-custom-fields.entry.js +1 -1
  155. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  156. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  157. package/dist/esm/salla-filters-widget.entry.js +2 -2
  158. package/dist/esm/salla-filters.entry.js +2 -2
  159. package/dist/esm/salla-free-shipping-banner.entry.js +1 -1
  160. package/dist/esm/salla-free-shipping-tag.entry.js +1 -1
  161. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  162. package/dist/esm/salla-gift-card-redeem_2.entry.js +1 -1
  163. package/dist/esm/salla-gifting.entry.js +1 -1
  164. package/dist/esm/salla-hook.entry.js +1 -1
  165. package/dist/esm/salla-infinite-scroll.entry.js +2 -2
  166. package/dist/esm/salla-installment.entry.js +1 -1
  167. package/dist/esm/salla-list-tile.entry.js +1 -1
  168. package/dist/esm/salla-localization-modal.entry.js +1 -1
  169. package/dist/esm/salla-login-modal.entry.js +1 -1
  170. package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
  171. package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
  172. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  173. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  174. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  175. package/dist/esm/salla-loyalty.entry.js +1 -1
  176. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  177. package/dist/esm/salla-map_3.entry.js +1 -1
  178. package/dist/esm/salla-menu.entry.js +1 -1
  179. package/dist/esm/salla-metadata.entry.js +1 -1
  180. package/dist/esm/salla-mobile-update-modal.entry.js +1 -1
  181. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  182. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  183. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  184. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  185. package/dist/esm/salla-notification-item_2.entry.js +2 -2
  186. package/dist/esm/salla-offer-modal.entry.js +1 -1
  187. package/dist/esm/salla-offer.entry.js +1 -1
  188. package/dist/esm/salla-order-branch.entry.js +1 -1
  189. package/dist/esm/salla-order-cancel.entry.js +1 -1
  190. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  191. package/dist/esm/salla-order-details-options.entry.js +1 -1
  192. package/dist/esm/salla-order-details.entry.js +1 -1
  193. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  194. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  195. package/dist/esm/salla-order-edit.entry.js +1 -1
  196. package/dist/esm/salla-order-items.entry.js +1 -1
  197. package/dist/esm/salla-order-options-modal.entry.js +1 -1
  198. package/dist/esm/salla-order-payment.entry.js +1 -1
  199. package/dist/esm/salla-order-rewards.entry.js +1 -1
  200. package/dist/esm/salla-order-shipments.entry.js +1 -1
  201. package/dist/esm/salla-order-summary.entry.js +1 -1
  202. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  203. package/dist/esm/salla-orders.entry.js +2 -2
  204. package/dist/esm/salla-payments.entry.js +1 -1
  205. package/dist/esm/salla-placeholder.entry.js +1 -1
  206. package/dist/esm/salla-price-range.entry.js +1 -1
  207. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  208. package/dist/esm/salla-product-card.entry.js +1 -1
  209. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  210. package/dist/esm/salla-products-list.entry.js +2 -2
  211. package/dist/esm/salla-products-slider.entry.js +2 -2
  212. package/dist/esm/salla-quick-order.entry.js +1 -1
  213. package/dist/esm/salla-rating-modal-v2.entry.js +2 -2
  214. package/dist/esm/salla-rating-modal.entry.js +2 -2
  215. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  216. package/dist/esm/salla-review-order-item.entry.js +1 -1
  217. package/dist/esm/salla-scopes.entry.js +1 -1
  218. package/dist/esm/salla-search-product-card.entry.js +1 -1
  219. package/dist/esm/salla-search.entry.js +2 -2
  220. package/dist/esm/salla-skeleton.entry.js +1 -1
  221. package/dist/esm/salla-social-share.entry.js +1 -1
  222. package/dist/esm/salla-social.entry.js +1 -1
  223. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  224. package/dist/esm/salla-thank-you-header.entry.js +1 -1
  225. package/dist/esm/salla-thank-you-page.entry.js +1 -1
  226. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  227. package/dist/esm/salla-trust-badges.entry.js +1 -1
  228. package/dist/esm/salla-user-menu.entry.js +2 -2
  229. package/dist/esm/salla-user-profile.entry.js +1 -1
  230. package/dist/esm/salla-user-settings.entry.js +1 -1
  231. package/dist/esm/salla-verify.entry.js +1 -1
  232. package/dist/esm/salla-wallet.entry.js +1 -1
  233. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  234. package/dist/esm/salla-wishlist-summary.entry.js +2 -2
  235. package/dist/esm/twilight.js +2 -2
  236. package/dist/esm/{vanilla-picker-Ci35-SnN.js → vanilla-picker-Dwx-r_Pm.js} +1 -1
  237. package/dist/twilight/{p-1b1cde5a.entry.js → p-0686190e.entry.js} +1 -1
  238. package/dist/twilight/{p-740a85ac.entry.js → p-0ce60a63.entry.js} +1 -1
  239. package/dist/twilight/{p-9512fe0d.entry.js → p-0f97e754.entry.js} +1 -1
  240. package/dist/twilight/{p-Caey3A5m.js → p-0rlOrj5t.js} +1 -1
  241. package/dist/twilight/{p-4301f0ae.entry.js → p-11edbe40.entry.js} +1 -1
  242. package/dist/twilight/{p-40aa0ef0.entry.js → p-130ab6b5.entry.js} +1 -1
  243. package/dist/twilight/{p-5c5cee6e.entry.js → p-13c2fb33.entry.js} +1 -1
  244. package/dist/twilight/{p-0d61b6c5.entry.js → p-14c163a9.entry.js} +1 -1
  245. package/dist/twilight/{p-c98da1d6.entry.js → p-17763ef6.entry.js} +1 -1
  246. package/dist/twilight/{p-8d80b93c.entry.js → p-1a64c3d0.entry.js} +1 -1
  247. package/dist/twilight/{p-bb5e4345.entry.js → p-1ab12ccb.entry.js} +1 -1
  248. package/dist/twilight/{p-48bd10f2.entry.js → p-1c973898.entry.js} +1 -1
  249. package/dist/twilight/{p-daa00d46.entry.js → p-207e7fdf.entry.js} +1 -1
  250. package/dist/twilight/{p-8d940345.entry.js → p-223c2dc0.entry.js} +1 -1
  251. package/dist/twilight/{p-30a6af2b.entry.js → p-22f0669b.entry.js} +1 -1
  252. package/dist/twilight/{p-472e79db.entry.js → p-2304639e.entry.js} +1 -1
  253. package/dist/twilight/{p-38619d31.entry.js → p-23a82841.entry.js} +1 -1
  254. package/dist/twilight/{p-f4ca4be7.entry.js → p-2610f6a3.entry.js} +1 -1
  255. package/dist/twilight/{p-b1c2df04.entry.js → p-267851e6.entry.js} +1 -1
  256. package/dist/twilight/{p-bdb8e50b.entry.js → p-28bc42d1.entry.js} +1 -1
  257. package/dist/twilight/{p-2a4e490f.entry.js → p-2b7c3785.entry.js} +1 -1
  258. package/dist/twilight/{p-fb621cbb.entry.js → p-2bb3157d.entry.js} +1 -1
  259. package/dist/twilight/{p-943ed402.entry.js → p-3032896e.entry.js} +1 -1
  260. package/dist/twilight/{p-2453c50b.entry.js → p-324b7ff8.entry.js} +1 -1
  261. package/dist/twilight/{p-b20bdd64.entry.js → p-32f4944b.entry.js} +1 -1
  262. package/dist/twilight/{p-eb1bea38.entry.js → p-356e8a56.entry.js} +1 -1
  263. package/dist/twilight/{p-c5cb3d2c.entry.js → p-361aeb38.entry.js} +1 -1
  264. package/dist/twilight/{p-823148d1.entry.js → p-3c9c7b93.entry.js} +1 -1
  265. package/dist/twilight/{p-8e43d05b.entry.js → p-3d9cb623.entry.js} +1 -1
  266. package/dist/twilight/{p-a3e6a85b.entry.js → p-3fd0fe12.entry.js} +1 -1
  267. package/dist/twilight/{p-000493f6.entry.js → p-44bc082c.entry.js} +1 -1
  268. package/dist/twilight/{p-5039a05c.entry.js → p-459ae423.entry.js} +1 -1
  269. package/dist/twilight/{p-f9dc67d8.entry.js → p-46a2c78f.entry.js} +1 -1
  270. package/dist/twilight/{p-8b97ac4e.entry.js → p-47a90994.entry.js} +1 -1
  271. package/dist/twilight/{p-1aaa095a.entry.js → p-48873da8.entry.js} +1 -1
  272. package/dist/twilight/{p-8d055316.entry.js → p-49336e4b.entry.js} +1 -1
  273. package/dist/twilight/{p-bacbb6e6.entry.js → p-4966b0e8.entry.js} +1 -1
  274. package/dist/twilight/{p-609ab0f6.entry.js → p-4ac770ba.entry.js} +1 -1
  275. package/dist/twilight/{p-c66e49f8.entry.js → p-4db163a5.entry.js} +1 -1
  276. package/dist/twilight/{p-43b5e25d.entry.js → p-4e22341d.entry.js} +1 -1
  277. package/dist/twilight/{p-370d884d.entry.js → p-50c14a2f.entry.js} +1 -1
  278. package/dist/twilight/{p-762b0a48.entry.js → p-51fa9d4b.entry.js} +1 -1
  279. package/dist/twilight/{p-41b8775c.entry.js → p-557ab2fd.entry.js} +1 -1
  280. package/dist/twilight/{p-179bd9bf.entry.js → p-5a030d37.entry.js} +1 -1
  281. package/dist/twilight/{p-b08ad979.entry.js → p-5c4dc8c2.entry.js} +1 -1
  282. package/dist/twilight/{p-a77645a3.entry.js → p-5d9e112e.entry.js} +1 -1
  283. package/dist/twilight/{p-b01c8601.entry.js → p-5df145be.entry.js} +1 -1
  284. package/dist/twilight/{p-e662da2a.entry.js → p-6905f49b.entry.js} +1 -1
  285. package/dist/twilight/{p-8f212f33.entry.js → p-6f203973.entry.js} +1 -1
  286. package/dist/twilight/{p-184d6532.entry.js → p-708b76ba.entry.js} +1 -1
  287. package/dist/twilight/{p-e4f7ad14.entry.js → p-710e2dd0.entry.js} +1 -1
  288. package/dist/twilight/{p-09b9bdd3.entry.js → p-72af03a1.entry.js} +1 -1
  289. package/dist/twilight/{p-3cd1ae8c.entry.js → p-74c07d23.entry.js} +1 -1
  290. package/dist/twilight/{p-429fbb5c.entry.js → p-74e9cd11.entry.js} +1 -1
  291. package/dist/twilight/{p-18758910.entry.js → p-8a74ba4a.entry.js} +1 -1
  292. package/dist/twilight/{p-132b1d58.entry.js → p-8b8bf23b.entry.js} +1 -1
  293. package/dist/twilight/{p-47038481.entry.js → p-8c89eb67.entry.js} +1 -1
  294. package/dist/twilight/{p-9ad1c68e.entry.js → p-8dfb9637.entry.js} +1 -1
  295. package/dist/twilight/{p-e322b07f.entry.js → p-8eeed35f.entry.js} +1 -1
  296. package/dist/twilight/{p-9d665017.entry.js → p-90417d6e.entry.js} +1 -1
  297. package/dist/twilight/{p-47947478.entry.js → p-98944116.entry.js} +1 -1
  298. package/dist/twilight/{p-07ecd9d8.entry.js → p-9979137b.entry.js} +1 -1
  299. package/dist/twilight/{p-67e91147.entry.js → p-9ae7c9de.entry.js} +1 -1
  300. package/dist/twilight/{p-d7615756.entry.js → p-9bda3abb.entry.js} +1 -1
  301. package/dist/twilight/{p-1d13928b.entry.js → p-9d157683.entry.js} +1 -1
  302. package/dist/twilight/{p-2c1078ae.entry.js → p-9ef88bed.entry.js} +1 -1
  303. package/dist/twilight/{p-DRvWpd5P.js → p-BXSGktmF.js} +1 -1
  304. package/dist/twilight/{p-D7SrsZe-.js → p-Bd5XukuC.js} +1 -1
  305. package/dist/twilight/{p-CiicuNzl.js → p-BpnQsIO1.js} +1 -1
  306. package/dist/twilight/{p-C7lKOlTc.js → p-C-sZpMJx.js} +1 -1
  307. package/dist/twilight/{p-BPhzgwOk.js → p-CFVeu87-.js} +2 -2
  308. package/dist/twilight/{p-DAvwtq5S.js → p-C_MosVdY.js} +1 -1
  309. package/dist/twilight/{p-I3Sp2yk-.js → p-CgL66erE.js} +1 -1
  310. package/dist/twilight/{p-C_5zZPrL.js → p-DdOkxzC4.js} +1 -1
  311. package/dist/twilight/{p-Bj0PA-Xf.js → p-DjKYLHWC.js} +1 -1
  312. package/dist/twilight/{p-65817439.entry.js → p-a1b41729.entry.js} +1 -1
  313. package/dist/twilight/{p-d0453b1b.entry.js → p-a29b3ad6.entry.js} +1 -1
  314. package/dist/twilight/{p-c807b4ba.entry.js → p-a2dd20a2.entry.js} +1 -1
  315. package/dist/twilight/{p-96a7975e.entry.js → p-a63881bf.entry.js} +1 -1
  316. package/dist/twilight/{p-72869219.entry.js → p-a7fa4a38.entry.js} +1 -1
  317. package/dist/twilight/{p-34054859.entry.js → p-adf98025.entry.js} +1 -1
  318. package/dist/twilight/{p-353e0af4.entry.js → p-aeb7635f.entry.js} +1 -1
  319. package/dist/twilight/{p-a10a389c.entry.js → p-b37da44e.entry.js} +1 -1
  320. package/dist/twilight/{p-6547d545.entry.js → p-b638254e.entry.js} +1 -1
  321. package/dist/twilight/{p-448ead38.entry.js → p-bd7d60a4.entry.js} +1 -1
  322. package/dist/twilight/{p-a5c0b2b3.entry.js → p-bda3eb32.entry.js} +1 -1
  323. package/dist/twilight/{p-d2aaa905.entry.js → p-be1ab62d.entry.js} +1 -1
  324. package/dist/twilight/{p-457cc3d1.entry.js → p-c3704c29.entry.js} +1 -1
  325. package/dist/twilight/p-c969af19.entry.js +4 -0
  326. package/dist/twilight/{p-aa52b7c9.entry.js → p-c97764b4.entry.js} +1 -1
  327. package/dist/twilight/{p-c71bc218.entry.js → p-ca065012.entry.js} +1 -1
  328. package/dist/twilight/{p-c4e61610.entry.js → p-cb9e72a0.entry.js} +1 -1
  329. package/dist/twilight/{p-983926d2.entry.js → p-cfdf4aa0.entry.js} +1 -1
  330. package/dist/twilight/{p-3737ffc8.entry.js → p-d2cf3929.entry.js} +1 -1
  331. package/dist/twilight/{p-a0311373.entry.js → p-d3865329.entry.js} +1 -1
  332. package/dist/twilight/{p-7016175e.entry.js → p-d4a3cf3e.entry.js} +1 -1
  333. package/dist/twilight/{p-cb14daa7.entry.js → p-d4b86e14.entry.js} +1 -1
  334. package/dist/twilight/{p-59c7175c.entry.js → p-d7a2b55c.entry.js} +1 -1
  335. package/dist/twilight/{p-d42fcaaa.entry.js → p-d95b2d33.entry.js} +1 -1
  336. package/dist/twilight/{p-93dff336.entry.js → p-db5139a3.entry.js} +1 -1
  337. package/dist/twilight/{p-f1d8d7eb.entry.js → p-dca2fdae.entry.js} +1 -1
  338. package/dist/twilight/{p-f88ada3f.entry.js → p-deca2029.entry.js} +1 -1
  339. package/dist/twilight/{p-6e778277.entry.js → p-e080de31.entry.js} +1 -1
  340. package/dist/twilight/{p-4d710e55.entry.js → p-e3dd1bd6.entry.js} +1 -1
  341. package/dist/twilight/{p-c1827b4d.entry.js → p-e40876ba.entry.js} +1 -1
  342. package/dist/twilight/{p-cdb5fe5d.entry.js → p-eb407211.entry.js} +1 -1
  343. package/dist/twilight/{p-75ae36b8.entry.js → p-f39f2210.entry.js} +1 -1
  344. package/dist/twilight/{p-181e17fe.entry.js → p-f3ebe745.entry.js} +1 -1
  345. package/dist/twilight/{p-b34f97bf.entry.js → p-f7da9b5a.entry.js} +1 -1
  346. package/dist/twilight/{p-d839e68a.entry.js → p-fa94864c.entry.js} +1 -1
  347. package/dist/twilight/{p-f9e2522e.entry.js → p-fb9a843b.entry.js} +1 -1
  348. package/dist/twilight/{p-2a124554.entry.js → p-fd7c9983.entry.js} +1 -1
  349. package/dist/twilight/{p-f31d8513.entry.js → p-fd9b2c38.entry.js} +1 -1
  350. package/dist/twilight/{p-BerWJEF6.js → p-qWzMt6Cu.js} +1 -1
  351. package/dist/twilight/twilight.esm.js +1 -1
  352. package/package.json +5 -5
  353. package/dist/twilight/p-ebe11191.entry.js +0 -4
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as i,H as e,a as r}from"./p-DRvWpd5P.js";var o,n;!function(t){t.PERCENTAGE="percentage",t.FIXED="fixed",t.FREE_PRODUCT="free_product",t.FREE_SHIPPING="free_shipping"}(o||(o={})),function(t){t.PRODUCT_COUNT="products_count",t.PRODUCT_PURCHASE="order_amount"}(n||(n={}));const s=Object.freeze([]),a=Object.freeze([]);let l,c=null,d=null,h=null,f=!1,u=null,p=null,g=0;function m(t){return"CartNotCreated"===t?.name}function b(){try{const t=salla.api?.cart?.getStoredCartId?salla.api.cart.getStoredCartId():salla.storage?.get?.("cart.id");return null==t||""===t?null:String(t)}catch(t){return null}}function w(){const t=b();void 0!==l&&l!==t&&(g++,d=null,c=null,h=null,f=!1,u=null),l=t}function y(t){return null==t?0:"number"==typeof t?isFinite(t)?t:0:"string"==typeof t&&parseFloat(t)||0}function x(t){if(null==t||""===t)return null;const i=y(t);return isFinite(i)?i:null}function v(t,i){if(null!==i)return i.length;const e=x(t?.data?.cart?.count??t?.data?.count??t?.cart?.count??t?.count);return null!==e&&e>=0?e:null}function k(t){for(const i of[t?.original_price,t?.product_price,t?.price]){const t=x(i&&"object"==typeof i?i.amount:i);if(null!==t&&t>0)return t}return null}function _(t,i){const e=t?.free_gift_quantity;return null!=e&&""!==e?y(e):i>0?i:0}function C(t){const i=[];for(const e of t){if(null==e?.id)continue;if(!e.added_by_offer)continue;const t=y(e.quantity),r=_(e,t);r<=0||i.push({id:String(e.id),offerId:x(e.offer_id),quantity:r,freeQuantity:r,lineQuantity:t,name:String(e.product_name??e.name??""),imageUrl:String(e.product_image?.url??e.product_image??e.image?.url??""),imageAlt:String(e.product_image?.alt??e.image?.alt??e.product_name??""),url:String(e.url??""),originalPrice:k(e)})}return i}function M(t){const i=[];for(const e of t){if(null==e?.id)continue;const t=y(e.quantity);i.push({id:String(e.id),productId:x(e.product_id),quantity:t,freeQuantity:e.added_by_offer?Math.max(0,_(e,t)):0,offerId:e.added_by_offer?x(e.offer_id):null})}return i}function P(){if(u)return u;const t=g,i=Promise.resolve().then((()=>salla.api?.cart?.details?.())).then((t=>{const i=function(t){const i=t?.data?.cart?.items??t?.data?.items??t?.cart?.items??t?.items;return Array.isArray(i)?i:null}(t),e=i??[];return{gifts:C(e),lines:M(e),count:v(t,i),ok:!0}})).catch((t=>({gifts:d??[],lines:c??[],count:m(t)?0:h,ok:!1}))).then((({gifts:i,lines:e,count:r,ok:o})=>{t===g&&(d=i,c=e,h=r,f=o)})).finally((()=>{u===i&&(u=null)}));return u=i,i}function S(){return w(),f}function T(){if(p)return p;g++,d=null,c=null,h=null,f=!1,l=b();const t=()=>(p===i&&(p=null),P()),i=(u??Promise.resolve()).then(t,t).finally((()=>{p===i&&(p=null)}));return p=i,i}const z=-1;var L,$;function F(t){const i="number"==typeof t?t:parseFloat(t);return Number.isFinite(i)?i:null}function I(t){return"boolean"==typeof t?t:1===t||0===t?1===t:"true"===t||"1"===t||"false"!==t&&"0"!==t&&void 0}function N(t){return F(t)??0}function R(t,i,e){return Math.max(i,Math.min(t,e))}function j(t){const i="number"==typeof t?t:parseFloat(t);if(!Number.isFinite(i))return null;const e=Math.trunc(i);return e>=0&&e<=4?e:null}!function(t){t.LOCKED="locked",t.CURRENT="current",t.COMPLETED="completed"}(L||(L={})),function(t){t.CURRENCY="currency",t.COUNT="count"}($||($={}));const V=[1e3,2e3,4e3],A='[data-testid^="store-cart-item-"], form[id^="item-"]',H="salla-conditional-offer:reloaded-for",O='form[id^="item-"]:not(.cart-options form)';let q=0;const D={badges_summary:":completed of :total offers unlocked",congrats:"Congratulations! You’ve unlocked all rewards in this promotion",details_title:"Offer details",free_gift:"Free Gift",free_products_title:"Free products selected from the offer",free_products_unavailable:"The free products are currently unavailable",free_products_choose:"Choose :count free products",free_products_choose_two:"Choose 2 free products",free_product_choose_one:"Choose your free product",free_product_got_one:"You got a free product",free_product_got_pick_one:"You got a free product! Choose it now",free_products_got:"You got :count free products",free_products_got_pick:"You got :count free products! Choose them now",free_products_got_pick_two:"You got 2 free products! Choose them now",free_products_got_two:"You got 2 free products",free_product_reward_one:"a free product",free_products_reward:":count free products",free_products_reward_two:"2 free products",guidance_conditions_unmet:"Your cart doesn’t meet the conditions for the next reward yet",guidance_next:"Add :remaining and get :reward",guidance_next_generic:"Add :remaining to unlock the next reward",manage_offer:"Manage offer",offer_toggle:"Offer",tier_requirement:"Spend :threshold and get :reward",tier_requirement_count:"Buy :threshold and get :reward",tier_requirement_count_generic:"Buy :threshold to unlock this offer",tier_requirement_generic:"Spend :threshold to unlock this offer",tier_title:"Offer (:number)"},B="pages.checkout.free_charge";function G(t){const i=document.createElement("div");return i.textContent=t??"",i.innerHTML}const W=(t={})=>i("svg",{class:t.class,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false"},i("path",{d:"M5.00016 9.16634C2.69898 9.16634 0.833496 7.30084 0.833496 4.99967C0.833496 2.69849 2.69898 0.833008 5.00016 0.833008C7.30133 0.833008 9.16683 2.69849 9.16683 4.99967C9.16683 7.30084 7.30133 9.16634 5.00016 9.16634ZM4.58458 6.66634L7.53087 3.72006L6.94162 3.13081L4.58458 5.48784L3.40608 4.3093L2.81683 4.89859L4.58458 6.66634Z",fill:"currentColor"})),Y=(t={})=>i("svg",{class:t.class,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false"},i("path",{d:"M12.6667 6.66683H13.3333C13.7015 6.66683 14 6.9653 14 7.3335V14.0002C14 14.3684 13.7015 14.6668 13.3333 14.6668H2.66667C2.29848 14.6668 2 14.3684 2 14.0002V7.3335C2 6.9653 2.29848 6.66683 2.66667 6.66683H3.33333V6.00016C3.33333 3.42284 5.42267 1.3335 8 1.3335C10.5773 1.3335 12.6667 3.42284 12.6667 6.00016V6.66683ZM11.3333 6.66683V6.00016C11.3333 4.15922 9.84093 2.66683 8 2.66683C6.15905 2.66683 4.66667 4.15922 4.66667 6.00016V6.66683H11.3333ZM7.33333 9.3335V12.0002H8.66667V9.3335H7.33333Z",fill:"currentColor"})),E=(t={})=>i("svg",{class:t.class,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false"},i("path",{d:"M7.00033 12.8337C3.77866 12.8337 1.16699 10.222 1.16699 7.00033C1.16699 3.77866 3.77866 1.16699 7.00033 1.16699C10.222 1.16699 12.8337 3.77866 12.8337 7.00033C12.8337 10.222 10.222 12.8337 7.00033 12.8337ZM6.41699 6.41699V9.91699H7.58366V6.41699H6.41699ZM6.41699 4.08366V5.25033H7.58366V4.08366H6.41699Z",fill:"currentColor"})),Z=class{constructor(i){t(this,i),this.offer=null,this.isLoading=!1,this.canRender=!0,this.gifts=[],this.cartLines=[],this.cartLinesLoaded=!1,this.freeProductCards={},this.pendingFreeProduct=null,this.pendingFreeProductSettledAt=null,this.pendingFreeProductTimer=null,this.cartPageCheckAfter=null,this.insertingCartLines=!1,this.pendingCartPageLines=null,this.pickerLookupRetries=0,this.pickerLookupTimer=null,this.cartItemCount=null,this.isTooltipHovered=!1,this.isTooltipPinned=!1,this.isGiftsOpen=!0,this.instanceId=++q,this.refreshGeneration=0,this.giftsGeneration=0,this.cartRefreshTimer=null,this.cartRefreshPending=!1,this.wantsCartUpdates=!1,this.isListeningToCartUpdates=!1,this.cartLookupRetryTimer=null,this.cartLookupRetries=0,this.cartLookupRetryPending=!1,this.deferredByEmptyCart=!1,this.isDisconnected=!1,this.skeletonWatchdog=null,this.skeletonDeadline=0,this.hasRelocated=!1,this.hasLoaded=!1,this.relocationObserver=null,this.relocationWatchTimer=null,this.relocationWatchExpired=!1,this.relocationLogged=!1,this.cartUpdatedHandler=t=>{this.readCartCountFromEvent(t),this.clearCartLookupRetry(),this.scheduleCartRefresh()}}componentWillLoad(){this.ensureSkeletonIsWatched();try{this.isEnabled()&&this.startLoading(),this.load().catch((t=>{this.stopLoading(),this.safeLog("load() failed",t)}))}catch(t){this.stopLoading(),this.safeLog("componentWillLoad threw synchronously",t)}}safeLog(t,i){try{salla.logger.warn("salla-conditional-offer::",t,i)}catch(t){}}connectedCallback(){this.isDisconnected=!1,this.ensureSkeletonIsWatched(),this.wantsCartUpdates&&!this.isListeningToCartUpdates&&this.subscribeToCartUpdates()&&(this.cartRefreshPending=!0),this.cartRefreshPending&&this.scheduleCartRefresh(),this.cartLookupRetryPending&&this.scheduleCartLookupRetry()}disconnectedCallback(){this.isDisconnected=!0,null!==this.cartRefreshTimer&&(clearTimeout(this.cartRefreshTimer),this.cartRefreshTimer=null),this.unlockFreeProduct(),this.clearPickerLookupRetry(),null!==this.cartLookupRetryTimer&&(clearTimeout(this.cartLookupRetryTimer),this.cartLookupRetryTimer=null),Promise.resolve().then((()=>{this.isDisconnected&&this.unsubscribeFromCartUpdates()})),null!==this.skeletonWatchdog&&(clearTimeout(this.skeletonWatchdog),this.skeletonWatchdog=null),this.stopWatchingForItemsColumn()}componentDidLoad(){this.hasLoaded=!0,this.relocateIntoItemsColumn()}isShowingSomething(){return this.canRender&&this.hasCartItems()}componentDidRender(){this.hasLoaded&&this.relocateIntoItemsColumn(),this.positionTooltip(),this.ensureSkeletonIsWatched()}relocateIntoItemsColumn(){if(!this.hasRelocated&&this.isShowingSomething())try{const t=this.hostEl;if(!t?.parentElement)return;const i=this.findItemsColumn(t);if(!i)return void this.watchForItemsColumn();if(this.hasRelocated=!0,this.stopWatchingForItemsColumn(),i===t.parentElement&&i.firstElementChild===t)return;i.insertBefore(t,i.firstChild)}catch(t){this.hasRelocated=!0,this.stopWatchingForItemsColumn(),this.safeLog("relocating the banner into the cart items column failed",t)}}findItemsColumn(t){let i=t;for(let e=0;i&&e<=3;e++){for(const e of this.getFollowingSiblings(i)){if(i===t&&this.matches(e,A))return t.parentElement;const r=this.findColumnWithin(e,t);if(r)return r}if(i=i.parentElement,!i||i===document.body||i===document.documentElement)break}return null}getFollowingSiblings(t){const i=[];for(let e=t.nextElementSibling;e;e=e.nextElementSibling)i.push(e);return i}findColumnWithin(t,i){const e=t.querySelector(A),r=(e?this.climbToChildOf(e,t):null)??t.querySelector(".main-content, [data-cart-items]");return!r||r===i||r.contains(i)?null:r}climbToChildOf(t,i){let e=t;for(;e&&e.parentElement&&e.parentElement!==i;)e=e.parentElement;return e?.parentElement===i?e:null}matches(t,i){return"function"==typeof t.matches&&t.matches(i)}watchForItemsColumn(){this.hasRelocated||this.relocationWatchExpired||this.relocationObserver||("undefined"!=typeof MutationObserver?(this.relocationObserver=new MutationObserver((()=>this.relocateIntoItemsColumn())),this.relocationObserver.observe(document.documentElement,{childList:!0,subtree:!0}),this.relocationWatchTimer=setTimeout((()=>{this.relocationWatchTimer=null,this.relocationWatchExpired=!0,this.stopWatchingForItemsColumn(),this.logNoItemsColumn()}),5e3)):this.logNoItemsColumn())}stopWatchingForItemsColumn(){if(this.relocationObserver){try{this.relocationObserver.disconnect()}catch(t){}this.relocationObserver=null}null!==this.relocationWatchTimer&&(clearTimeout(this.relocationWatchTimer),this.relocationWatchTimer=null)}logNoItemsColumn(){this.relocationLogged||(this.relocationLogged=!0,this.safeLog("no cart items column found — leaving the banner at full page width"))}ensureSkeletonIsWatched(){if(!this.isLoading)return;if(null!==this.skeletonWatchdog)return;const t=Date.now();0===this.skeletonDeadline&&(this.skeletonDeadline=t+8e3);const i=Math.max(0,this.skeletonDeadline-t);this.skeletonWatchdog=setTimeout((()=>{this.skeletonWatchdog=null,this.isLoading&&(Date.now()<this.skeletonDeadline?this.ensureSkeletonIsWatched():(this.isLoading=!1,this.skeletonDeadline=0,this.safeLog("still loading after 8000ms — dropping the skeleton")))}),i)}clearSkeletonWatchdog(){this.skeletonDeadline=0,null!==this.skeletonWatchdog&&(clearTimeout(this.skeletonWatchdog),this.skeletonWatchdog=null)}startLoading(){this.isLoading=!0,this.ensureSkeletonIsWatched()}stopLoading(){this.isLoading=!1,this.clearSkeletonWatchdog()}async load(){this.wantsCartUpdates=!0,this.subscribeToCartUpdates()||this.subscribeWhenSdkIsReady(),this.loadCart(),await this.waitForSdk(),await this.refresh()}waitForSdk(){let t,i;try{t=Promise.resolve(salla.onReady?.())}catch(t){return this.safeLog("salla.onReady() threw",t),Promise.resolve()}const e=new Promise((t=>{i=setTimeout(t,3e3)}));return Promise.race([t.catch((t=>this.safeLog("salla.onReady() rejected",t))),e]).then((()=>{clearTimeout(i)}))}subscribeToCartUpdates(){if(this.isListeningToCartUpdates)return!0;try{salla.event.on("cart::updated",this.cartUpdatedHandler),this.isListeningToCartUpdates=!0}catch(t){this.safeLog("cart::updated subscription failed",t)}return this.isListeningToCartUpdates}unsubscribeFromCartUpdates(){if(this.isListeningToCartUpdates){this.isListeningToCartUpdates=!1;try{salla.event.off("cart::updated",this.cartUpdatedHandler)}catch(t){this.safeLog("cart::updated unsubscription failed",t)}}}subscribeWhenSdkIsReady(){let t;try{t=Promise.resolve(salla.onReady?.())}catch(t){return}const i=()=>{this.isDisconnected||this.subscribeToCartUpdates()};t.then(i,i)}scheduleCartRefresh(){this.cartRefreshPending=!0,null!==this.cartRefreshTimer&&clearTimeout(this.cartRefreshTimer),this.cartRefreshTimer=null,this.isDisconnected||(this.cartRefreshTimer=setTimeout((()=>{this.cartRefreshTimer=null,this.runCartRefresh()}),200))}runCartRefresh(){this.isDisconnected||(this.cartRefreshPending=!1,this.refresh(),this.clearPickerLookupRetry(),T().then((()=>this.loadCart()),(()=>this.loadCart())))}readCartCountFromEvent(t){const i=this.toCartCount(t?.count)??this.readCartCountFromStorage();null!==i&&(this.cartItemCount=i)}readCartCountFromStorage(){try{return this.toCartCount(salla.storage?.get?.("cart.summary.count"))}catch(t){return null}}toCartCount(t){return"number"==typeof t&&Number.isFinite(t)&&t>=0?t:null}getFreeLabel(){const t=salla.lang.get(B);return t&&t!==B?t:"Free"}getAddLabel(){return this.sharedLabel("common.elements.add","Add")}sharedLabel(t,i){const e=salla.lang.get(t);return e&&e!==t?e:i}trans(t,i){const e=`blocks.cart_offer.${t}`,r=salla.lang.get(e,i);return r&&r!==e?r:Object.entries(i??{}).reduce(((t,[i,e])=>t.split(`:${i}`).join(e)),D[t])}isEnabled(){try{return!!salla.config.get("store.features")?.includes("conditional-offer")}catch(t){return!1}}async fetchOffer(){const{data:t}=await salla.api.cart.offers(),i=(t||[]).find((t=>"conditional"===t.type));return i?.details?.discounts?.length?i:null}async refresh(){const t=++this.refreshGeneration;if(!this.isEnabled())return this.stopLoading(),void(this.canRender=!1);if(0===this.cartItemCount)return this.stopLoading(),void(S()||(this.deferredByEmptyCart=!0,this.loadCart()));this.deferredByEmptyCart=!1,this.offer?this.stopLoading():this.startLoading();try{const i=await this.fetchOffer();if(this.isSuperseded(t))return;if(!i)return this.offer=null,void(this.canRender=!1);this.offer=i,this.canRender=!0,this.loadCart(),this.loadFreeProductCards()}catch(i){if(this.isSuperseded(t))return;this.safeLog("offers() failed",i)}finally{t===this.refreshGeneration&&this.stopLoading()}}hasCartItems(){return"number"==typeof this.cartItemCount&&this.cartItemCount>=1}isSuperseded(t){return t!==this.refreshGeneration||this.isDisconnected}loadCart(){const t=++this.giftsGeneration;return Promise.all([(w(),f&&d?Promise.resolve(d):P().then((()=>d??s))),(w(),f&&d?Promise.resolve(h):P().then((()=>h))),(w(),f&&d?Promise.resolve(c??a):P().then((()=>c??a)))]).then((([i,e,r])=>{if(t!==this.giftsGeneration||this.isDisconnected)return;if(this.cartRefreshPending)return;const o=S();null!==e&&(this.cartItemCount=e),null!==e?this.clearCartLookupRetry():null===this.cartItemCount&&this.scheduleCartLookupRetry(),this.deferredByEmptyCart&&this.hasCartItems()&&(this.deferredByEmptyCart=!1,this.refresh());const n=null!==this.getPickerStage(this.getStages()),s=null!==this.pendingFreeProductSettledAt||null!==this.cartPageCheckAfter;o||!n&&!s?(this.clearPickerLookupRetry(),this.gifts=this.offer?this.selectOwnGifts(i):[],this.cartLines=this.offer?r:[],this.cartLinesLoaded=!!this.offer,null!==this.pendingFreeProductSettledAt&&t>this.pendingFreeProductSettledAt&&this.unlockFreeProduct(),null!==this.cartPageCheckAfter&&t>this.cartPageCheckAfter&&(this.cartPageCheckAfter=null,this.showMissingCartLines(r))):(s||!this.cartLinesLoaded&&this.hasCartItems())&&this.retryPickerCartLookup()})).catch((t=>{this.safeLog("cart lookup failed",t)}))}scheduleCartLookupRetry(){this.cartLookupRetries>=V.length||(this.cartLookupRetryPending=!0,null!==this.cartLookupRetryTimer||this.isDisconnected||(this.cartLookupRetryTimer=setTimeout((()=>{this.cartLookupRetryTimer=null,this.cartLookupRetryPending=!1,this.canRender&&(this.cartLookupRetries++,this.loadCart())}),V[this.cartLookupRetries])))}retryPickerCartLookup(){null!==this.pickerLookupTimer||this.pickerLookupRetries>=V.length||(this.pickerLookupTimer=setTimeout((()=>{this.pickerLookupTimer=null,this.pickerLookupRetries++,this.loadCart()}),V[this.pickerLookupRetries]))}clearPickerLookupRetry(){this.pickerLookupRetries=0,null!==this.pickerLookupTimer&&(clearTimeout(this.pickerLookupTimer),this.pickerLookupTimer=null)}clearCartLookupRetry(){this.cartLookupRetries=0,this.cartLookupRetryPending=!1,null!==this.cartLookupRetryTimer&&(clearTimeout(this.cartLookupRetryTimer),this.cartLookupRetryTimer=null)}selectOwnGifts(t){const i=Number(this.offer?.id);if(!Number.isFinite(i))return t;const e=t.filter((t=>null!==t.offerId&&Number(t.offerId)===i));return e.length?e:t.filter((t=>null===t.offerId))}getStages(){const t=(this.offer?.details?.discounts??[]).filter((({min_spend:t})=>null!==F(t)));return i=({min_spend:t})=>t,e=({id:t})=>t,(t??[]).map(((t,r)=>({item:t,index:r,threshold:N(i(t)),identity:e?F(e(t)):null}))).sort(((t,i)=>t.threshold!==i.threshold?t.threshold-i.threshold:null!==t.identity&&null!==i.identity&&t.identity!==i.identity?t.identity-i.identity:t.index-i.index)).map((({item:t})=>t));var i,e}getProgress(t){return function(t,i,e=0,r=[],o=[],n=[]){const s=(i??[]).map(((t,i)=>({index:i,threshold:F(t),applied:I(r?.[i]),tierValue:F(o?.[i]),canAddFree:"boolean"==typeof n?.[i]?n[i]:void 0}))).filter((t=>null!==t.threshold)).sort(((t,i)=>t.threshold-i.threshold||t.index-i.index)),a=s.map((t=>t.threshold)),l=s.map((t=>t.applied)),c=l.some((t=>void 0!==t)),d=N(e);if(!a.length)return{thresholds:a,met:[],applied:l,appliedIndex:z,hasEngineVerdict:c,metCount:0,nextUnmetIndex:z,allMet:!1,lastReachedIndex:z,currentIndex:z,isComplete:!1,value:Math.max(0,N(t)),values:[],startValue:d,fills:[],overallPercentage:0};const h=a[a.length-1],f=R(N(t),0,Math.max(0,h)),u=s.map((({tierValue:t})=>null===t?f:R(t,0,Math.max(0,h))));let p=z;for(let t=0;t<a.length;t++)u[t]>=a[t]&&(p=t);const g=p===a.length-1,m=g?z:p+1,b=a.map(((t,i)=>function(t,i,e){return e<=i?t>=e?100:0:R((t-i)/(e-i)*100,0,100)}(u[i],0===i?d:a[i-1],t))),w=g?100:R((p+1+(b[m]??0)/100)/a.length*100,0,100);let y=z;for(let t=0;t<l.length;t++)!0===l[t]&&(y=t);let x=z;for(let t=0;t<a.length;t++){const i=s[t].canAddFree;(void 0===i?u[t]>=a[t]:i)&&(x=t)}const v=a.map(c?(t,i)=>i<=y:(t,i)=>i<=x),k=v.filter(Boolean).length,_=v.findIndex((t=>!t));return{thresholds:a,met:v,applied:l,appliedIndex:y,hasEngineVerdict:c,metCount:k,nextUnmetIndex:_,allMet:_===z,lastReachedIndex:p,currentIndex:m,isComplete:g,value:f,values:u,startValue:d,fills:b,overallPercentage:w}}(this.offer?.details?.current_value,t.map((({min_spend:t})=>t)),this.offer?.details?.start_value,t.map((({is_applied:t})=>t)),t.map((({current_value:t})=>t)),t.map((({can_add_free:t})=>t)))}tierKey(t,i){const e=Number(t?.id);return Number.isFinite(e)?`tier-${e}`:`pos-${i}`}stageMeasure(){return this.offer?.details?.based_on===n.PRODUCT_COUNT?$.COUNT:$.CURRENCY}formatRequirement(t){const i=this.offer?.details?.based_on;if(i===n.PRODUCT_COUNT)try{return salla.lang.choice("blocks.header.products_count",t)}catch(i){return this.safeLog("invalid products_count interval",i),`${t}`}return i===n.PRODUCT_PURCHASE?salla.money(t):(this.safeLog(`unexpected offer detail's based_on value: ${i}`),`${t}`)}getRewardText(t){if(this.isPickerTier(t)){const i=Math.max(1,Math.floor(Number(t.max_free_products)||1));return 1===i?this.trans("free_product_reward_one"):2===i?this.trans("free_products_reward_two"):this.trans("free_products_reward",{count:`${i}`})}return(t?.reward_label??"").trim()}getGuidanceMessage(t,i){if(i.nextUnmetIndex===z)return"";const e=Number(t[i.nextUnmetIndex]?.amount_needed),r=this.isPickerTier(t[i.nextUnmetIndex])&&Number.isFinite(e)&&e>0?e:function(t,i,e=$.CURRENCY){const r=i.thresholds[t];if(void 0===r)return 0;const o=Math.max(0,r-(i.values?.[t]??i.value));if(0===o)return 0;const n=e===$.COUNT?0:function(){try{const t="undefined"!=typeof salla?salla:void 0,i=j(t?.config?.currency?.()?.decimals);if(null!==i)return i;const e=j(t?.config?.get?.("store.currency.decimals"));if(null!==e)return e}catch(t){}return 2}(),s=Math.pow(10,n),a=Math.ceil(o*s-1e-6)/s;return a>0?a:1/s}(i.nextUnmetIndex,i,this.stageMeasure());if(r<=0)return this.trans("guidance_conditions_unmet");const o=this.formatRequirement(r),n=this.getRewardText(t[i.nextUnmetIndex]);return n?this.trans("guidance_next",{remaining:o,reward:G(n)}):this.trans("guidance_next_generic",{remaining:o})}getTierSentence(t,i,e){const r=this.formatRequirement(e.thresholds[i]),o=this.getRewardText(t),n=this.stageMeasure()===$.COUNT;return o?this.trans(n?"tier_requirement_count":"tier_requirement",{threshold:r,reward:G(o)}):this.trans(n?"tier_requirement_count_generic":"tier_requirement_generic",{threshold:r})}getRewardIcon(t){switch(t?.type){case o.PERCENTAGE:return"sicon-percentage";case o.FREE_PRODUCT:return"sicon-gift";case o.FIXED:return this.usesSarSymbol()?"sicon-sar":"sicon-banknote";default:return"sicon-tag"}}usesSarSymbol(){try{const t=salla.config.currency?.()?.symbol;return["SAR","ر.س"].includes(t)&&!!salla.config.get("store.settings.use_sar_symbol")}catch(t){return!1}}get isTooltipOpen(){return this.isTooltipHovered||this.isTooltipPinned}toggleTooltip(){this.isTooltipPinned=!this.isTooltipPinned}closeTooltip(t=!1){this.isTooltipOpen&&(this.isTooltipPinned=!1,this.isTooltipHovered=!1,t&&this.infoTriggerEl?.focus?.())}positionTooltip(){const t=this.tooltipEl,i=this.infoTriggerEl;if(this.isTooltipOpen&&t&&i)try{this.setTooltipOffsets(t,0,0);const e=window.innerWidth||document.documentElement?.clientWidth||0,r=t.getBoundingClientRect(),o=i.getBoundingClientRect(),n=r?.width||0;if(n<=0||e<=0)return;const s=o.left+o.width/2-n/2,a=8,l=Math.min(Math.max(s,a),Math.max(a,e-a-n))-s,c=Math.max(0,n/2-16),d=Math.min(Math.max(-l,-c),c);this.setTooltipOffsets(t,l,d)}catch(t){this.safeLog("positioning the offer details popover failed",t)}}setTooltipOffsets(t,i,e){t.style?.setProperty?.("--s-conditional-offer-tooltip-shift",`${Math.round(i)}px`),t.style?.setProperty?.("--s-conditional-offer-tooltip-caret",`${Math.round(e)}px`)}handleWindowResize(){this.positionTooltip()}handleDocumentKeydown(t){"Escape"!==t.key&&"Esc"!==t.key||this.closeTooltip(!0)}handleDocumentClick(t){if(!this.isTooltipPinned||!this.infoAnchorEl)return;const i="function"==typeof t.composedPath?t.composedPath():[];(i.length?i.includes(this.infoAnchorEl):this.infoAnchorEl.contains(t.target))||this.closeTooltip()}elementId(t){return`s-conditional-offer-${t}-${this.instanceId}`}renderBadges(t,e){return i("div",{class:"s-conditional-offer-badges",role:"img","aria-label":this.trans("badges_summary",{completed:`${e.metCount}`,total:`${t.length}`})},t.map(((t,r)=>{const o=e.met[r],n=this.tierKey(t,r);return[r>0?i("span",{key:`${n}-link`,class:{"s-conditional-offer-badge-link":!0,"s-conditional-offer-badge-link-met":o,"s-conditional-offer-badge-link-unmet":!o},"aria-hidden":"true"}):null,i("span",{key:n,class:{"s-conditional-offer-badge":!0,"s-conditional-offer-badge-met":o,"s-conditional-offer-badge-unmet":!o},"data-tier-state":o?"met":"unmet","data-tier-id":t?.id??void 0},i(o?W:Y,{class:"s-conditional-offer-badge-icon"}))]})))}renderTooltip(t,e){const r=function(t){const i=t?.details?.rules;if("string"==typeof i){const t=i.trim();return""===t?null:t}if(Array.isArray(i)){const t=i.filter((t=>"string"==typeof t)).map((t=>t.trim())).filter((t=>""!==t)).join(" ");return""===t?null:t}return null}(this.offer);return i("div",{class:"s-conditional-offer-tooltip",id:this.elementId("tooltip"),role:"tooltip",ref:t=>this.tooltipEl=t},i("div",{class:"s-conditional-offer-tooltip-title"},this.offer?.title),r?i("div",{class:"s-conditional-offer-tooltip-description"},r):null,i("ul",{class:"s-conditional-offer-tooltip-list"},t.map(((t,r)=>{const o=e.met[r];return i("li",{key:this.tierKey(t,r),class:"s-conditional-offer-tier","data-tier-state":o?"met":"unmet","data-tier-id":t?.id??void 0},i("span",{class:{"s-conditional-offer-tier-icon":!0,"s-conditional-offer-tier-icon-met":o,"s-conditional-offer-tier-icon-unmet":!o}},i("i",{class:this.getRewardIcon(t),"aria-hidden":"true"}),i("span",{class:{"s-conditional-offer-tier-status":!0,"s-conditional-offer-tier-status-met":o,"s-conditional-offer-tier-status-unmet":!o},"aria-hidden":"true"},o?i(W,{class:"s-conditional-offer-tier-status-check"}):i(Y,{class:"s-conditional-offer-tier-status-lock"}))),i("div",{class:"s-conditional-offer-tier-body"},i("div",{class:"s-conditional-offer-tier-title"},this.trans("tier_title",{number:`${r+1}`})),i("div",{class:{"s-conditional-offer-tier-text":!0,"s-conditional-offer-tier-text-met":o},innerHTML:this.getTierSentence(t,r,e)})))}))))}getPickerStage(t){return t.find((t=>this.isPickerTier(t)))??null}isPickerTier(t){return t?.type===o.FREE_PRODUCT&&Array.isArray(t.free_products)&&t.free_products.length>0}areGiftsUnavailable(t,i){const e=t[i.lastReachedIndex];return e?.type===o.FREE_PRODUCT&&Array.isArray(e.free_products)&&0===e.free_products.length&&0===this.gifts.length}loadFreeProductCards(){const t=this.getPickerStage(this.getStages()),i=(t?.free_products??[]).map((t=>String(t.id))).filter((t=>t&&!this.freeProductCards[t]));if(!i.length)return Promise.resolve();const e=new Set((t.free_products??[]).map((t=>String(t.id))));return Promise.resolve().then((()=>salla.product.fetch({source:"selected",source_value:i}))).then((t=>{if(this.isDisconnected)return;const i={...this.freeProductCards};(Array.isArray(t?.data)?t.data:[]).forEach((t=>{const r=String(t?.id??"");r&&e.has(r)&&(i[r]={id:r,name:String(t.name??""),imageUrl:String(t.image?.url??""),imageAlt:String(t.image?.alt??t.name??""),price:Number.isFinite(Number(t.price))?Number(t.price):null})})),this.freeProductCards=i})).catch((t=>this.safeLog("free product lookup failed",t)))}getPickerState(t){const i=this.cartLines.filter((t=>t.freeQuantity>0)),e=this.selectOwnFreeLines(i),r=new Set(e.map((t=>t.productId)).filter((t=>null!==t))),o=Math.max(1,Math.floor(Number(t.max_free_products)||1)),n=Number(t.current_value??this.offer?.details?.current_value??0);return{limit:o,reached:"boolean"==typeof t.can_add_free?t.can_add_free:Number.isFinite(n)&&n>=Number(t.min_spend),freeCount:r.size}}selectOwnFreeLines(t){const i=Number(this.offer?.id);if(!Number.isFinite(i))return t;const e=t.filter((t=>null!==t.offerId&&Number(t.offerId)===i));return e.length?e:t.filter((t=>null===t.offerId))}addFreeProduct(t){this.pendingFreeProduct||(this.pendingFreeProduct=t.id,this.runFreeProductChange((()=>Promise.resolve(salla.cart.addItem(t.id)).then((()=>{this.cartPageCheckAfter=this.giftsGeneration}))),"free product add failed"))}reloadPage(){window.location.reload()}fetchCartPageHtml(){const t=new AbortController,i=setTimeout((()=>t.abort()),8e3);return fetch(window.location.href,{cache:"no-store",credentials:"same-origin",headers:{Accept:"text/html"},signal:t.signal}).then((t=>t.ok?t.text():Promise.reject(new Error(`cart page ${t.status}`)))).finally((()=>clearTimeout(i)))}showMissingCartLines(t){this.insertingCartLines?this.pendingCartPageLines=t:this.missingCartLineIds(t).length&&(this.insertingCartLines=!0,Promise.resolve().then((()=>this.fetchCartPageHtml())).then((t=>{if(this.isDisconnected||this.cartChangedDuringPageFetch())return;const i=this.missingCartLineIds(this.cartLines);i.length&&!this.insertCartLineForms(t,i)&&this.reloadForMissingCartLines(i)})).catch((t=>{this.safeLog("cart page fetch for the new lines failed, reloading",t),this.isDisconnected||this.cartChangedDuringPageFetch()||this.reloadForMissingCartLines(this.missingCartLineIds(this.cartLines))})).finally((()=>{this.insertingCartLines=!1;const t=this.pendingCartPageLines;this.pendingCartPageLines=null,t&&!this.isDisconnected&&this.showMissingCartLines(t)})))}cartChangedDuringPageFetch(){return!(null===this.pendingFreeProduct&&this.cartLinesLoaded||(null===this.cartPageCheckAfter&&(this.cartPageCheckAfter=this.giftsGeneration),0))}missingCartLineIds(t){try{return document.querySelector(O)?t.map((t=>t.id)).filter((t=>!document.getElementById(`item-${t}`))).sort():[]}catch(t){return this.safeLog("cart page check after a free product add failed",t),[]}}insertCartLineForms(t,i){try{const e=Array.from((new DOMParser).parseFromString(t,"text/html").querySelectorAll(O)),r=e.map((t=>t.getAttribute("id")));return!i.some((t=>!r.includes(`item-${t}`)))&&(e.forEach(((t,e)=>{const o=r[e];if(!i.includes(o.slice(5))||document.getElementById(o))return;const n=r.slice(e+1).map((t=>document.getElementById(t))).find(Boolean);if(n)n.parentNode.insertBefore(t,n);else{const i=document.querySelectorAll(O),e=i[i.length-1];e.parentNode.insertBefore(t,e.nextSibling)}})),i.every((t=>document.getElementById(`item-${t}`))))}catch(t){return this.safeLog("cart line insert failed",t),!1}}reloadForMissingCartLines(t){if(!t.length)return;const i=t.join(","),e=this.readReloadGuard();e!==i&&(void 0===e&&this.pageWasReloaded()||(this.writeReloadGuard(i),this.reloadPage()))}readReloadGuard(){try{return window.sessionStorage.getItem(H)}catch{return}}writeReloadGuard(t){try{window.sessionStorage.setItem(H,t)}catch{}}pageWasReloaded(){try{const t=window.performance?.getEntriesByType?.("navigation")?.[0];return"reload"===t?.type}catch{return!1}}runFreeProductChange(t,i){Promise.resolve().then(t).then((()=>{if(this.isDisconnected)return this.unlockFreeProduct();this.pendingFreeProductSettledAt=this.giftsGeneration,this.pendingFreeProductTimer=setTimeout((()=>this.unlockOnStaleLines()),5e3)})).catch((t=>{this.safeLog(i,t),this.unlockFreeProduct(),null!==this.cartPageCheckAfter&&this.loadCart()}))}unlockOnStaleLines(){this.unlockFreeProduct(),this.cartLinesLoaded=!1,this.clearPickerLookupRetry(),T().then((()=>this.loadCart()),(()=>this.loadCart()))}unlockFreeProduct(){null!==this.pendingFreeProductTimer&&clearTimeout(this.pendingFreeProductTimer),this.pendingFreeProductTimer=null,this.pendingFreeProductSettledAt=null,this.pendingFreeProduct=null}pickerGotMessage(t,i){return 1===t?this.trans(i?"free_product_got_pick_one":"free_product_got_one"):2===t?this.trans(i?"free_products_got_pick_two":"free_products_got_two"):this.trans(i?"free_products_got_pick":"free_products_got",{count:`${t}`})}getPickerCards(t){return(t.free_products??[]).map((t=>this.freeProductCards[String(t.id)])).filter(Boolean)}renderPicker(t){const e=this.getPickerState(t),r=this.getPickerCards(t);return r.length?i("div",{class:"s-conditional-offer-picker","data-picker-reached":e.reached?"true":"false"},i("div",{class:"s-conditional-offer-picker-header"},i("span",{class:"s-conditional-offer-picker-counter","aria-label":`${e.freeCount}/${e.limit}`},`${e.freeCount}/${e.limit}`),i("span",{class:"s-conditional-offer-picker-title"},1===e.limit?this.trans("free_product_choose_one"):2===e.limit?this.trans("free_products_choose_two"):this.trans("free_products_choose",{count:`${e.limit}`}))),i("ul",{class:"s-conditional-offer-picker-list"},r.map((t=>this.renderPickerCard(t))))):null}renderPickerCard(t){return i("li",{class:"s-conditional-offer-picker-card","data-product-id":t.id},i("span",{class:"s-conditional-offer-picker-thumb"},t.imageUrl?i("img",{class:"s-conditional-offer-picker-image",src:t.imageUrl,alt:t.imageAlt||t.name,loading:"lazy",decoding:"async"}):i("i",{class:"sicon-gift","aria-hidden":"true"})),i("span",{class:"s-conditional-offer-picker-name"},t.name),null!==t.price?i("span",{class:"s-conditional-offer-picker-prices"},i("span",{class:"s-conditional-offer-picker-price-regular",innerHTML:salla.money(t.price)})):null,i("span",{class:"s-conditional-offer-picker-actions"},i("button",{type:"button",class:"s-conditional-offer-picker-add",onClick:()=>this.addFreeProduct(t)},this.getAddLabel())))}renderGiftsToggle(t,e){return i("button",{type:"button",id:this.elementId(`toggle-${t}`),class:{"s-conditional-offer-toggle":!0,"s-conditional-offer-toggle-inline":"inline"===t,"s-conditional-offer-toggle-bar":"bar"===t},"aria-expanded":this.isGiftsOpen?"true":"false","aria-controls":this.elementId("gifts"),onClick:()=>this.isGiftsOpen=!this.isGiftsOpen},i("span",null,this.trans(e?"offer_toggle":"manage_offer")),i("i",{class:{"sicon-keyboard_arrow_down":!0,"s-conditional-offer-toggle-icon":!0,"s-conditional-offer-toggle-icon-open":this.isGiftsOpen},"aria-hidden":"true"}))}renderGiftsCard(t=null){if(!t)return i("div",{class:"s-conditional-offer-panel",id:this.elementId("gifts")},i("div",{class:"s-conditional-offer-gifts-header"},i("span",{class:"s-conditional-offer-gifts-icon"},i("i",{class:"sicon-gift","aria-hidden":"true"})),i("span",{class:"s-conditional-offer-gifts-title"},this.trans("free_products_title"))),i("ul",{class:"s-conditional-offer-gifts-list"},this.gifts.map((t=>this.renderGiftRow(t)))));const e=this.getPickerState(t);return i("div",{class:"s-conditional-offer-panel",id:this.elementId("gifts")},e.reached?this.renderPicker(t):null,this.gifts.length?i("div",{class:"s-conditional-offer-gifts"},i("div",{class:"s-conditional-offer-gifts-header"},i("span",{class:"s-conditional-offer-gifts-icon"},i("i",{class:"sicon-gift","aria-hidden":"true"})),i("span",{class:"s-conditional-offer-gifts-title"},this.sharedLabel("pages.loyalty_program.free_product_title","Free products"))),i("ul",{class:"s-conditional-offer-gifts-list"},this.gifts.map((t=>this.renderGiftRow(t))))):null)}renderGiftRow(t){return i("li",{class:"s-conditional-offer-gift","data-item-id":t.id},i("span",{class:"s-conditional-offer-gift-thumb"},t.imageUrl?i("img",{class:"s-conditional-offer-gift-image",src:t.imageUrl,alt:t.imageAlt||t.name,loading:"lazy",decoding:"async"}):i("i",{class:"sicon-gift","aria-hidden":"true"})),i("div",{class:"s-conditional-offer-gift-body"},i("span",{class:"s-conditional-offer-gift-name"},t.name||this.trans("free_gift")),i("span",{class:"s-conditional-offer-gift-prices"},i("span",{class:"s-conditional-offer-gift-free"},this.getFreeLabel()),null!==t.originalPrice?i("span",{class:"s-conditional-offer-gift-price",innerHTML:salla.money(t.originalPrice)}):null)))}getLoadingSkeletonView(){return i(e,{class:"s-conditional-offer-root"},i("div",{class:"s-conditional-offer-banner"},i("div",{class:"s-conditional-offer-lead"},i("salla-skeleton",{height:"24px",width:"80px"}),i("div",{class:"s-conditional-offer-skeleton-text"},i("salla-skeleton",{height:"12px",width:"35%"}),i("salla-skeleton",{height:"16px",width:"60%"})))))}render(){if(!this.canRender)return null;if(!this.hasCartItems())return null;if(this.isLoading)return this.getLoadingSkeletonView();if(!this.offer)return null;const t=this.getStages(),r=this.getProgress(t),o=this.getGuidanceMessage(t,r),n=this.trans("details_title"),s=this.getPickerStage(t),a=null!==s?this.getPickerState(s):null,l=a?.reached??!1,c=this.gifts.length>0||l&&this.getPickerCards(s).length>0,d=l&&this.cartLinesLoaded&&0===a.freeCount,h=r.allMet&&l&&a.freeCount>0&&t[t.length-1]===s;return i(e,{class:"s-conditional-offer-root"},i("div",{class:"s-conditional-offer-banner"},i("div",{class:"s-conditional-offer-lead"},this.renderBadges(t,r),i("div",{class:"s-conditional-offer-text"},i("div",{class:"s-conditional-offer-heading",onMouseEnter:()=>this.isTooltipHovered=!0,onMouseLeave:()=>this.isTooltipHovered=!1},i("span",{class:"s-conditional-offer-name"},this.offer.title),i("span",{class:"s-conditional-offer-info",ref:t=>this.infoAnchorEl=t},i("button",{type:"button",class:"s-conditional-offer-info-trigger",ref:t=>this.infoTriggerEl=t,"aria-label":n,title:n,"aria-expanded":this.isTooltipOpen?"true":"false","aria-describedby":this.elementId("tooltip"),onClick:()=>this.toggleTooltip()},i(E,{class:"s-conditional-offer-info-icon"})),this.isTooltipOpen?this.renderTooltip(t,r):null)),d||h?i("div",{class:"s-conditional-offer-message",role:"status"},this.pickerGotMessage(a.limit,d)):this.areGiftsUnavailable(t,r)?i("div",{class:"s-conditional-offer-message",role:"status"},this.trans("free_products_unavailable")):r.allMet?i("div",{class:"s-conditional-offer-message",role:"status"},this.trans("congrats")):o?i("div",{class:"s-conditional-offer-message",innerHTML:o}):null)),c?this.renderGiftsToggle("inline",!!s):null),c&&this.isGiftsOpen?this.renderGiftsCard(s):null,c?this.renderGiftsToggle("bar",!!s):null)}get hostEl(){return r(this)}};Z.style='/*!twlt*/:host{display:block}.s-conditional-offer-root{background-color:rgba(0, 137, 123, 0.06);background-color:color-mix(in srgb, var(--color-primary, #00897b) 7%, transparent)}.s-conditional-offer-badges::-webkit-scrollbar{height:3px}.s-conditional-offer-badges::-webkit-scrollbar-thumb{border-radius:9999px;background-color:rgba(0, 0, 0, 0.15)}.s-conditional-offer-badges::-webkit-scrollbar-track{background-color:transparent}.s-conditional-offer-tooltip{--s-conditional-offer-tooltip-shift:0px;--s-conditional-offer-tooltip-caret:0px;transform:translateX(calc(-50% + var(--s-conditional-offer-tooltip-shift)))}.s-conditional-offer-tooltip::before{content:"";position:absolute;bottom:100%;left:50%;transform:translateX(calc(-50% + var(--s-conditional-offer-tooltip-caret)));border:8px solid transparent;border-bottom-color:#fff}.s-conditional-offer-tier-icon-met,.s-conditional-offer-tier-icon-unmet{color:var(--color-primary-dark, #00695c);background-color:rgba(0, 137, 123, 0.12);background-color:color-mix(in srgb, var(--color-primary, #00897b) 14%, transparent)}.s-conditional-offer-tier:not(:last-child)::before{content:"";position:absolute;top:2.5rem;bottom:-1rem;inset-inline-start:1.125rem;width:1px;background-color:#d1d5db}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.block{display:block}.inline{display:inline}.flex{display:flex}.hidden{display:none}.w-6{width:1.5rem}.resize{resize:both}.gap-1{gap:0.25rem}.rounded{border-radius:var(--s-radius, 0.25rem)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-conditional-offer-root{margin-bottom:1.25rem;display:block;width:100%;min-width:0px;max-width:100%;border-radius:0.375rem;padding:0.75rem}@media (min-width: 768px){.s-conditional-offer-root{padding:1rem}}.s-conditional-offer-banner{display:flex;width:100%;min-width:0px;align-items:center;justify-content:space-between;gap:0.75rem}@media (min-width: 768px){.s-conditional-offer-banner{gap:1rem}}.s-conditional-offer-lead{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.5rem}@media (min-width: 768px){.s-conditional-offer-lead{gap:0.75rem}}.s-conditional-offer-badges{display:flex;max-width:45%;flex-shrink:0;flex-wrap:nowrap;align-items:center;gap:0.25rem;overflow-x:auto;overscroll-behavior-x:contain;scroll-behavior:smooth;scrollbar-width:thin}.s-conditional-offer-badge{display:inline-flex;height:1.5rem;width:1.5rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;font-size:11px;line-height:1;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-conditional-offer-badge-met{background-color:var(--color-primary)}.s-conditional-offer-badge-unmet{--tw-bg-opacity:1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.s-conditional-offer-badge-link{width:0.5rem;flex-shrink:0;border-top-width:1px}.s-conditional-offer-badge-link-met{border-color:var(--color-primary)}.s-conditional-offer-badge-link-unmet{border-style:dashed;--tw-border-opacity:1;border-color:rgb(82 82 82 / var(--tw-border-opacity, 1))}.s-conditional-offer-badge-icon{height:0.75rem;width:0.75rem;flex-shrink:0}.s-conditional-offer-text{display:flex;min-width:0px;flex-direction:column;gap:0.125rem;text-align:start}.s-conditional-offer-heading{display:flex;min-width:0px;align-items:center;gap:0.375rem}.s-conditional-offer-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(82 82 82 / var(--tw-text-opacity, 1))}.s-conditional-offer-info{position:relative;display:inline-flex;flex-shrink:0;align-items:center}.s-conditional-offer-info-trigger{display:inline-flex;height:1rem;width:1rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;--tw-text-opacity:1;color:rgb(115 115 115 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-conditional-offer-info-trigger:hover{color:var(--color-primary-dark)}.s-conditional-offer-info-icon{height:0.875rem;width:0.875rem;flex-shrink:0}.s-conditional-offer-message{font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary-dark)}@media (min-width: 768px){.s-conditional-offer-message{font-size:1rem;line-height:1.5rem}}.s-conditional-offer-toggle{align-items:center;justify-content:center;gap:0.375rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(38 38 38 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-conditional-offer-toggle:hover{color:var(--color-primary-dark)}.s-conditional-offer-toggle-inline{display:none;flex-shrink:0}@media (min-width: 768px){.s-conditional-offer-toggle-inline{display:inline-flex}}.s-conditional-offer-toggle-bar{margin-top:0.5rem;display:inline-flex;width:100%;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-left:0.75rem;padding-right:0.75rem;padding-top:0.625rem;padding-bottom:0.625rem}@media (min-width: 768px){.s-conditional-offer-toggle-bar{display:none}}.s-conditional-offer-toggle-icon{font-size:1rem;line-height:1.5rem;line-height:1;transition-property:transform;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-conditional-offer-toggle-icon-open{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-conditional-offer-panel{margin-top:0.75rem;width:100%;min-width:0px;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.75rem}.s-conditional-offer-gifts-header{margin-bottom:0.75rem;display:flex;align-items:center;gap:0.5rem}.s-conditional-offer-gifts-icon{display:inline-flex;height:2rem;width:2rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-color:var(--color-primary);font-size:1rem;line-height:1.5rem;line-height:1;color:var(--color-primary)}.s-conditional-offer-gifts-title{font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary-dark)}.s-conditional-offer-gifts-list{margin:0px;display:flex;list-style-type:none;flex-direction:column;gap:0.5rem;padding:0px}.s-conditional-offer-gift{display:flex;align-items:center;gap:0.75rem;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));padding:0.5rem}.s-conditional-offer-gift-thumb{display:inline-flex;height:3.5rem;width:3.5rem;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));font-size:1.25rem;line-height:1.75rem;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-conditional-offer-gift-image{height:100%;width:100%;object-fit:contain}.s-conditional-offer-gift-body{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:0.125rem;text-align:start}.s-conditional-offer-gift-name{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(38 38 38 / var(--tw-text-opacity, 1))}.s-conditional-offer-gift-prices{display:flex;align-items:center;gap:0.5rem;font-size:0.75rem;line-height:1rem}.s-conditional-offer-gift-free{font-weight:700;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-conditional-offer-gift-price{--tw-text-opacity:1;color:rgb(115 115 115 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-conditional-offer-gifts{margin-top:0.75rem;width:100%;min-width:0px;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));padding:0.75rem}.s-conditional-offer-picker{display:flex;width:100%;min-width:0px;flex-direction:column;gap:0.75rem}.s-conditional-offer-picker-header{display:flex;align-items:center;gap:0.5rem}.s-conditional-offer-picker-counter{display:inline-flex;height:2.25rem;width:2.25rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;border-width:2px;border-color:var(--color-primary);font-size:0.75rem;line-height:1rem;font-weight:700;color:var(--color-primary-dark)}.s-conditional-offer-picker-title{font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary-dark)}.s-conditional-offer-picker-list{margin:0px;display:flex;list-style-type:none;gap:0.75rem;overflow-x:auto;overscroll-behavior-x:contain;scroll-behavior:smooth;padding:0px;padding-bottom:0.25rem;scrollbar-width:thin}.s-conditional-offer-picker-card{display:flex;width:9rem;flex-shrink:0;flex-direction:column;gap:0.375rem;text-align:start}.s-conditional-offer-picker-thumb{display:inline-flex;height:7rem;width:100%;align-items:center;justify-content:center;overflow:hidden;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));font-size:1.5rem;line-height:2rem;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-conditional-offer-picker-image{height:100%;width:100%;object-fit:contain}.s-conditional-offer-picker-name{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(38 38 38 / var(--tw-text-opacity, 1))}.s-conditional-offer-picker-prices{display:flex;align-items:center;gap:0.5rem;font-size:0.75rem;line-height:1rem}.s-conditional-offer-picker-price-regular{font-weight:700;--tw-text-opacity:1;color:rgb(23 23 23 / var(--tw-text-opacity, 1))}.s-conditional-offer-picker-actions{margin-top:auto;display:flex;width:100%;align-items:center;gap:0.375rem}.s-conditional-offer-picker-add{display:inline-flex;height:2.25rem;flex:1 1 0%;align-items:center;justify-content:center;border-radius:0.375rem;border-width:1px;border-color:var(--color-primary);font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary-dark);transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-conditional-offer-picker-add:hover{background-color:var(--color-primary);--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-conditional-offer-tooltip{position:absolute;top:calc(100% + 0.75rem);left:50%;z-index:10;width:min(22rem, calc(100vw - 2rem));border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1rem;text-align:start;--tw-shadow:5px 10px 30px #2B2D340D;--tw-shadow-colored:5px 10px 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-conditional-offer-tooltip-title{font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary-dark)}.s-conditional-offer-tooltip-description{margin-top:0.25rem;font-size:0.75rem;line-height:1rem;line-height:1.625;--tw-text-opacity:1;color:rgb(82 82 82 / var(--tw-text-opacity, 1))}.s-conditional-offer-tooltip-list{margin:0px;margin-top:0.75rem;display:flex;list-style-type:none;flex-direction:column;gap:1rem;padding:0px}.s-conditional-offer-tier{position:relative;display:flex;align-items:flex-start;gap:0.75rem}.s-conditional-offer-tier-icon{position:relative;display:inline-flex;height:2.25rem;width:2.25rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;font-size:1rem;line-height:1.5rem;line-height:1}.s-conditional-offer-tier-icon-unmet{color:var(--color-primary-dark)}.s-conditional-offer-tier-status{position:absolute;bottom:-0.125rem;display:inline-flex;height:1rem;width:1rem;align-items:center;justify-content:center;border-radius:9999px;border-width:2px;--tw-border-opacity:1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));inset-inline-start:-2px}.s-conditional-offer-tier-status-met{color:var(--color-primary-dark)}.s-conditional-offer-tier-status-unmet{--tw-text-opacity:1;color:rgb(163 163 163 / var(--tw-text-opacity, 1))}.s-conditional-offer-tier-status-check{height:0.75rem;width:0.75rem;flex-shrink:0}.s-conditional-offer-tier-status-lock{height:0.625rem;width:0.625rem;flex-shrink:0}.s-conditional-offer-tier-body{display:flex;min-width:0px;flex-direction:column;gap:0.125rem}.s-conditional-offer-tier-title{font-size:0.75rem;line-height:1rem;font-weight:700;color:var(--color-primary-dark)}.s-conditional-offer-tier-text{font-size:0.75rem;line-height:1rem;line-height:1.625;--tw-text-opacity:1;color:rgb(82 82 82 / var(--tw-text-opacity, 1))}.s-conditional-offer-tier-text-met{text-decoration-line:line-through}.s-conditional-offer-skeleton-text{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:0.375rem}';export{Z as salla_conditional_offer}
4
+ import{r as t,h as i,H as e,a as r}from"./p-BXSGktmF.js";var o,n;!function(t){t.PERCENTAGE="percentage",t.FIXED="fixed",t.FREE_PRODUCT="free_product",t.FREE_SHIPPING="free_shipping"}(o||(o={})),function(t){t.PRODUCT_COUNT="products_count",t.PRODUCT_PURCHASE="order_amount"}(n||(n={}));const s=Object.freeze([]),a=Object.freeze([]);let l,c=null,d=null,h=null,f=!1,u=null,p=null,g=0;function m(t){return"CartNotCreated"===t?.name}function b(){try{const t=salla.api?.cart?.getStoredCartId?salla.api.cart.getStoredCartId():salla.storage?.get?.("cart.id");return null==t||""===t?null:String(t)}catch(t){return null}}function w(){const t=b();void 0!==l&&l!==t&&(g++,d=null,c=null,h=null,f=!1,u=null),l=t}function y(t){return null==t?0:"number"==typeof t?isFinite(t)?t:0:"string"==typeof t&&parseFloat(t)||0}function x(t){if(null==t||""===t)return null;const i=y(t);return isFinite(i)?i:null}function v(t,i){if(null!==i)return i.length;const e=x(t?.data?.cart?.count??t?.data?.count??t?.cart?.count??t?.count);return null!==e&&e>=0?e:null}function k(t){for(const i of[t?.original_price,t?.product_price,t?.price]){const t=x(i&&"object"==typeof i?i.amount:i);if(null!==t&&t>0)return t}return null}function _(t,i){const e=t?.free_gift_quantity;return null!=e&&""!==e?y(e):i>0?i:0}function C(t){const i=[];for(const e of t){if(null==e?.id)continue;if(!e.added_by_offer)continue;const t=y(e.quantity),r=_(e,t);r<=0||i.push({id:String(e.id),offerId:x(e.offer_id),quantity:r,freeQuantity:r,lineQuantity:t,name:String(e.product_name??e.name??""),imageUrl:String(e.product_image?.url??e.product_image??e.image?.url??""),imageAlt:String(e.product_image?.alt??e.image?.alt??e.product_name??""),url:String(e.url??""),originalPrice:k(e)})}return i}function M(t){const i=[];for(const e of t){if(null==e?.id)continue;const t=y(e.quantity);i.push({id:String(e.id),productId:x(e.product_id),quantity:t,freeQuantity:e.added_by_offer?Math.max(0,_(e,t)):0,offerId:e.added_by_offer?x(e.offer_id):null})}return i}function P(){if(u)return u;const t=g,i=Promise.resolve().then((()=>salla.api?.cart?.details?.())).then((t=>{const i=function(t){const i=t?.data?.cart?.items??t?.data?.items??t?.cart?.items??t?.items;return Array.isArray(i)?i:null}(t),e=i??[];return{gifts:C(e),lines:M(e),count:v(t,i),ok:!0}})).catch((t=>({gifts:d??[],lines:c??[],count:m(t)?0:h,ok:!1}))).then((({gifts:i,lines:e,count:r,ok:o})=>{t===g&&(d=i,c=e,h=r,f=o)})).finally((()=>{u===i&&(u=null)}));return u=i,i}function S(){return w(),f}function T(){if(p)return p;g++,d=null,c=null,h=null,f=!1,l=b();const t=()=>(p===i&&(p=null),P()),i=(u??Promise.resolve()).then(t,t).finally((()=>{p===i&&(p=null)}));return p=i,i}const z=-1;var L,F;function $(t){const i="number"==typeof t?t:parseFloat(t);return Number.isFinite(i)?i:null}function I(t){return"boolean"==typeof t?t:1===t||0===t?1===t:"true"===t||"1"===t||"false"!==t&&"0"!==t&&void 0}function N(t){return $(t)??0}function R(t,i,e){return Math.max(i,Math.min(t,e))}function j(t){const i="number"==typeof t?t:parseFloat(t);if(!Number.isFinite(i))return null;const e=Math.trunc(i);return e>=0&&e<=4?e:null}!function(t){t.LOCKED="locked",t.CURRENT="current",t.COMPLETED="completed"}(L||(L={})),function(t){t.CURRENCY="currency",t.COUNT="count"}(F||(F={}));const V=[1e3,2e3,4e3],A='[data-testid^="store-cart-item-"], form[id^="item-"]',H="salla-conditional-offer:reloaded-for",O='form[id^="item-"]:not(.cart-options form)';let q=0;const B={badges_summary:":completed of :total offers unlocked",congrats:"Congratulations! You’ve unlocked all rewards in this promotion",details_title:"Offer details",free_gift:"Free Gift",free_products_title:"Free products selected from the offer",free_products_unavailable:"The free products are currently unavailable",free_products_choose:"Choose :count free products",free_products_choose_two:"Choose 2 free products",free_product_choose_one:"Choose your free product",free_product_got_one:"You got a free product",free_product_got_pick_one:"You got a free product! Choose it now",free_products_got:"You got :count free products",free_products_got_pick:"You got :count free products! Choose them now",free_products_got_pick_two:"You got 2 free products! Choose them now",free_products_got_two:"You got 2 free products",free_product_reward_one:"a free product",free_products_reward:":count free products",free_products_reward_two:"2 free products",guidance_conditions_unmet:"Your cart doesn’t meet the conditions for the next reward yet",guidance_next:"Add :remaining and get :reward",guidance_next_generic:"Add :remaining to unlock the next reward",manage_offer:"Manage offer",offer_toggle:"Offer",tier_requirement:"Spend :threshold and get :reward",tier_requirement_count:"Buy :threshold and get :reward",tier_requirement_count_generic:"Buy :threshold to unlock this offer",tier_requirement_generic:"Spend :threshold to unlock this offer",tier_title:"Offer (:number)"},G="pages.checkout.free_charge";function D(t){const i=document.createElement("div");return i.textContent=t??"",i.innerHTML}const Y=(t={})=>i("svg",{class:t.class,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false"},i("path",{d:"M5.00016 9.16634C2.69898 9.16634 0.833496 7.30084 0.833496 4.99967C0.833496 2.69849 2.69898 0.833008 5.00016 0.833008C7.30133 0.833008 9.16683 2.69849 9.16683 4.99967C9.16683 7.30084 7.30133 9.16634 5.00016 9.16634ZM4.58458 6.66634L7.53087 3.72006L6.94162 3.13081L4.58458 5.48784L3.40608 4.3093L2.81683 4.89859L4.58458 6.66634Z",fill:"currentColor"})),E=(t={})=>i("svg",{class:t.class,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false"},i("path",{d:"M12.6667 6.66683H13.3333C13.7015 6.66683 14 6.9653 14 7.3335V14.0002C14 14.3684 13.7015 14.6668 13.3333 14.6668H2.66667C2.29848 14.6668 2 14.3684 2 14.0002V7.3335C2 6.9653 2.29848 6.66683 2.66667 6.66683H3.33333V6.00016C3.33333 3.42284 5.42267 1.3335 8 1.3335C10.5773 1.3335 12.6667 3.42284 12.6667 6.00016V6.66683ZM11.3333 6.66683V6.00016C11.3333 4.15922 9.84093 2.66683 8 2.66683C6.15905 2.66683 4.66667 4.15922 4.66667 6.00016V6.66683H11.3333ZM7.33333 9.3335V12.0002H8.66667V9.3335H7.33333Z",fill:"currentColor"})),W=(t={})=>i("svg",{class:t.class,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false"},i("path",{d:"M7.00033 12.8337C3.77866 12.8337 1.16699 10.222 1.16699 7.00033C1.16699 3.77866 3.77866 1.16699 7.00033 1.16699C10.222 1.16699 12.8337 3.77866 12.8337 7.00033C12.8337 10.222 10.222 12.8337 7.00033 12.8337ZM6.41699 6.41699V9.91699H7.58366V6.41699H6.41699ZM6.41699 4.08366V5.25033H7.58366V4.08366H6.41699Z",fill:"currentColor"})),Z=class{constructor(i){t(this,i),this.offer=null,this.isLoading=!1,this.canRender=!0,this.gifts=[],this.cartLines=[],this.cartLinesLoaded=!1,this.freeProductCards={},this.pendingFreeProduct=null,this.pendingFreeProductSettledAt=null,this.pendingFreeProductTimer=null,this.cartPageCheckAfter=null,this.insertingCartLines=!1,this.pendingCartPageLines=null,this.pickerLookupRetries=0,this.pickerLookupTimer=null,this.cartItemCount=null,this.isTooltipHovered=!1,this.isTooltipPinned=!1,this.isGiftsOpen=!0,this.instanceId=++q,this.refreshGeneration=0,this.giftsGeneration=0,this.cartRefreshTimer=null,this.cartRefreshPending=!1,this.wantsCartUpdates=!1,this.isListeningToCartUpdates=!1,this.cartLookupRetryTimer=null,this.cartLookupRetries=0,this.cartLookupRetryPending=!1,this.deferredByEmptyCart=!1,this.isDisconnected=!1,this.skeletonWatchdog=null,this.skeletonDeadline=0,this.hasRelocated=!1,this.hasLoaded=!1,this.relocationObserver=null,this.relocationWatchTimer=null,this.relocationWatchExpired=!1,this.relocationLogged=!1,this.cartUpdatedHandler=t=>{this.readCartCountFromEvent(t),this.clearCartLookupRetry(),this.scheduleCartRefresh()}}componentWillLoad(){this.ensureSkeletonIsWatched();try{this.isEnabled()&&this.startLoading(),this.load().catch((t=>{this.stopLoading(),this.safeLog("load() failed",t)}))}catch(t){this.stopLoading(),this.safeLog("componentWillLoad threw synchronously",t)}}safeLog(t,i){try{salla.logger.warn("salla-conditional-offer::",t,i)}catch(t){}}connectedCallback(){this.isDisconnected=!1,this.ensureSkeletonIsWatched(),this.wantsCartUpdates&&!this.isListeningToCartUpdates&&this.subscribeToCartUpdates()&&(this.cartRefreshPending=!0),this.cartRefreshPending&&this.scheduleCartRefresh(),this.cartLookupRetryPending&&this.scheduleCartLookupRetry()}disconnectedCallback(){this.isDisconnected=!0,null!==this.cartRefreshTimer&&(clearTimeout(this.cartRefreshTimer),this.cartRefreshTimer=null),this.unlockFreeProduct(),this.clearPickerLookupRetry(),null!==this.cartLookupRetryTimer&&(clearTimeout(this.cartLookupRetryTimer),this.cartLookupRetryTimer=null),Promise.resolve().then((()=>{this.isDisconnected&&this.unsubscribeFromCartUpdates()})),null!==this.skeletonWatchdog&&(clearTimeout(this.skeletonWatchdog),this.skeletonWatchdog=null),this.stopWatchingForItemsColumn()}componentDidLoad(){this.hasLoaded=!0,this.relocateIntoItemsColumn()}isShowingSomething(){return this.canRender&&this.hasCartItems()}componentDidRender(){this.hasLoaded&&this.relocateIntoItemsColumn(),this.positionTooltip(),this.ensureSkeletonIsWatched()}relocateIntoItemsColumn(){if(!this.hasRelocated&&this.isShowingSomething())try{const t=this.hostEl;if(!t?.parentElement)return;const i=this.findItemsColumn(t);if(!i)return void this.watchForItemsColumn();if(this.hasRelocated=!0,this.stopWatchingForItemsColumn(),i===t.parentElement&&i.firstElementChild===t)return;i.insertBefore(t,i.firstChild)}catch(t){this.hasRelocated=!0,this.stopWatchingForItemsColumn(),this.safeLog("relocating the banner into the cart items column failed",t)}}findItemsColumn(t){let i=t;for(let e=0;i&&e<=3;e++){for(const e of this.getFollowingSiblings(i)){if(i===t&&this.matches(e,A))return t.parentElement;const r=this.findColumnWithin(e,t);if(r)return r}if(i=i.parentElement,!i||i===document.body||i===document.documentElement)break}return null}getFollowingSiblings(t){const i=[];for(let e=t.nextElementSibling;e;e=e.nextElementSibling)i.push(e);return i}findColumnWithin(t,i){const e=t.querySelector(A),r=(e?this.climbToChildOf(e,t):null)??t.querySelector(".main-content, [data-cart-items]");return!r||r===i||r.contains(i)?null:r}climbToChildOf(t,i){let e=t;for(;e&&e.parentElement&&e.parentElement!==i;)e=e.parentElement;return e?.parentElement===i?e:null}matches(t,i){return"function"==typeof t.matches&&t.matches(i)}watchForItemsColumn(){this.hasRelocated||this.relocationWatchExpired||this.relocationObserver||("undefined"!=typeof MutationObserver?(this.relocationObserver=new MutationObserver((()=>this.relocateIntoItemsColumn())),this.relocationObserver.observe(document.documentElement,{childList:!0,subtree:!0}),this.relocationWatchTimer=setTimeout((()=>{this.relocationWatchTimer=null,this.relocationWatchExpired=!0,this.stopWatchingForItemsColumn(),this.logNoItemsColumn()}),5e3)):this.logNoItemsColumn())}stopWatchingForItemsColumn(){if(this.relocationObserver){try{this.relocationObserver.disconnect()}catch(t){}this.relocationObserver=null}null!==this.relocationWatchTimer&&(clearTimeout(this.relocationWatchTimer),this.relocationWatchTimer=null)}logNoItemsColumn(){this.relocationLogged||(this.relocationLogged=!0,this.safeLog("no cart items column found — leaving the banner at full page width"))}ensureSkeletonIsWatched(){if(!this.isLoading)return;if(null!==this.skeletonWatchdog)return;const t=Date.now();0===this.skeletonDeadline&&(this.skeletonDeadline=t+8e3);const i=Math.max(0,this.skeletonDeadline-t);this.skeletonWatchdog=setTimeout((()=>{this.skeletonWatchdog=null,this.isLoading&&(Date.now()<this.skeletonDeadline?this.ensureSkeletonIsWatched():(this.isLoading=!1,this.skeletonDeadline=0,this.safeLog("still loading after 8000ms — dropping the skeleton")))}),i)}clearSkeletonWatchdog(){this.skeletonDeadline=0,null!==this.skeletonWatchdog&&(clearTimeout(this.skeletonWatchdog),this.skeletonWatchdog=null)}startLoading(){this.isLoading=!0,this.ensureSkeletonIsWatched()}stopLoading(){this.isLoading=!1,this.clearSkeletonWatchdog()}async load(){this.wantsCartUpdates=!0,this.subscribeToCartUpdates()||this.subscribeWhenSdkIsReady(),this.loadCart(),await this.waitForSdk(),await this.refresh()}waitForSdk(){let t,i;try{t=Promise.resolve(salla.onReady?.())}catch(t){return this.safeLog("salla.onReady() threw",t),Promise.resolve()}const e=new Promise((t=>{i=setTimeout(t,3e3)}));return Promise.race([t.catch((t=>this.safeLog("salla.onReady() rejected",t))),e]).then((()=>{clearTimeout(i)}))}subscribeToCartUpdates(){if(this.isListeningToCartUpdates)return!0;try{salla.event.on("cart::updated",this.cartUpdatedHandler),this.isListeningToCartUpdates=!0}catch(t){this.safeLog("cart::updated subscription failed",t)}return this.isListeningToCartUpdates}unsubscribeFromCartUpdates(){if(this.isListeningToCartUpdates){this.isListeningToCartUpdates=!1;try{salla.event.off("cart::updated",this.cartUpdatedHandler)}catch(t){this.safeLog("cart::updated unsubscription failed",t)}}}subscribeWhenSdkIsReady(){let t;try{t=Promise.resolve(salla.onReady?.())}catch(t){return}const i=()=>{this.isDisconnected||this.subscribeToCartUpdates()};t.then(i,i)}scheduleCartRefresh(){this.cartRefreshPending=!0,null!==this.cartRefreshTimer&&clearTimeout(this.cartRefreshTimer),this.cartRefreshTimer=null,this.isDisconnected||(this.cartRefreshTimer=setTimeout((()=>{this.cartRefreshTimer=null,this.runCartRefresh()}),200))}runCartRefresh(){this.isDisconnected||(this.cartRefreshPending=!1,this.refresh(),this.clearPickerLookupRetry(),T().then((()=>this.loadCart()),(()=>this.loadCart())))}readCartCountFromEvent(t){const i=this.toCartCount(t?.count)??this.readCartCountFromStorage();null!==i&&(this.cartItemCount=i)}readCartCountFromStorage(){try{return this.toCartCount(salla.storage?.get?.("cart.summary.count"))}catch(t){return null}}toCartCount(t){return"number"==typeof t&&Number.isFinite(t)&&t>=0?t:null}getFreeLabel(){const t=salla.lang.get(G);return t&&t!==G?t:"Free"}getAddLabel(){return this.sharedLabel("common.elements.add","Add")}sharedLabel(t,i){const e=salla.lang.get(t);return e&&e!==t?e:i}trans(t,i){const e=`blocks.cart_offer.${t}`,r=salla.lang.get(e,i);return r&&r!==e?r:Object.entries(i??{}).reduce(((t,[i,e])=>t.split(`:${i}`).join(e)),B[t])}isEnabled(){try{return!!salla.config.get("store.features")?.includes("conditional-offer")}catch(t){return!1}}async fetchOffer(){const{data:t}=await salla.api.cart.offers(),i=(t||[]).find((t=>"conditional"===t.type));return i?.details?.discounts?.length?i:null}async refresh(){const t=++this.refreshGeneration;if(!this.isEnabled())return this.stopLoading(),void(this.canRender=!1);if(0===this.cartItemCount)return this.stopLoading(),void(S()||(this.deferredByEmptyCart=!0,this.loadCart()));this.deferredByEmptyCart=!1,this.offer?this.stopLoading():this.startLoading();try{const i=await this.fetchOffer();if(this.isSuperseded(t))return;if(!i)return this.offer=null,void(this.canRender=!1);this.offer=i,this.canRender=!0,this.loadCart(),this.loadFreeProductCards()}catch(i){if(this.isSuperseded(t))return;this.safeLog("offers() failed",i)}finally{t===this.refreshGeneration&&this.stopLoading()}}hasCartItems(){return"number"==typeof this.cartItemCount&&this.cartItemCount>=1}isSuperseded(t){return t!==this.refreshGeneration||this.isDisconnected}loadCart(){const t=++this.giftsGeneration;return Promise.all([(w(),f&&d?Promise.resolve(d):P().then((()=>d??s))),(w(),f&&d?Promise.resolve(h):P().then((()=>h))),(w(),f&&d?Promise.resolve(c??a):P().then((()=>c??a)))]).then((([i,e,r])=>{if(t!==this.giftsGeneration||this.isDisconnected)return;if(this.cartRefreshPending)return;const o=S();null!==e&&(this.cartItemCount=e),null!==e?this.clearCartLookupRetry():null===this.cartItemCount&&this.scheduleCartLookupRetry(),this.deferredByEmptyCart&&this.hasCartItems()&&(this.deferredByEmptyCart=!1,this.refresh());const n=null!==this.getPickerStage(this.getStages()),s=null!==this.pendingFreeProductSettledAt||null!==this.cartPageCheckAfter;o||!n&&!s?(this.clearPickerLookupRetry(),this.gifts=this.offer?this.selectOwnGifts(i):[],this.cartLines=this.offer?r:[],this.cartLinesLoaded=!!this.offer,null!==this.pendingFreeProductSettledAt&&t>this.pendingFreeProductSettledAt&&this.unlockFreeProduct(),null!==this.cartPageCheckAfter&&t>this.cartPageCheckAfter&&(this.cartPageCheckAfter=null,this.showMissingCartLines(r))):(s||!this.cartLinesLoaded&&this.hasCartItems())&&this.retryPickerCartLookup()})).catch((t=>{this.safeLog("cart lookup failed",t)}))}scheduleCartLookupRetry(){this.cartLookupRetries>=V.length||(this.cartLookupRetryPending=!0,null!==this.cartLookupRetryTimer||this.isDisconnected||(this.cartLookupRetryTimer=setTimeout((()=>{this.cartLookupRetryTimer=null,this.cartLookupRetryPending=!1,this.canRender&&(this.cartLookupRetries++,this.loadCart())}),V[this.cartLookupRetries])))}retryPickerCartLookup(){null!==this.pickerLookupTimer||this.pickerLookupRetries>=V.length||(this.pickerLookupTimer=setTimeout((()=>{this.pickerLookupTimer=null,this.pickerLookupRetries++,this.loadCart()}),V[this.pickerLookupRetries]))}clearPickerLookupRetry(){this.pickerLookupRetries=0,null!==this.pickerLookupTimer&&(clearTimeout(this.pickerLookupTimer),this.pickerLookupTimer=null)}clearCartLookupRetry(){this.cartLookupRetries=0,this.cartLookupRetryPending=!1,null!==this.cartLookupRetryTimer&&(clearTimeout(this.cartLookupRetryTimer),this.cartLookupRetryTimer=null)}selectOwnGifts(t){const i=Number(this.offer?.id);if(!Number.isFinite(i))return t;const e=t.filter((t=>null!==t.offerId&&Number(t.offerId)===i));return e.length?e:t.filter((t=>null===t.offerId))}getStages(){const t=(this.offer?.details?.discounts??[]).filter((({min_spend:t})=>null!==$(t)));return i=({min_spend:t})=>t,e=({id:t})=>t,(t??[]).map(((t,r)=>({item:t,index:r,threshold:N(i(t)),identity:e?$(e(t)):null}))).sort(((t,i)=>t.threshold!==i.threshold?t.threshold-i.threshold:null!==t.identity&&null!==i.identity&&t.identity!==i.identity?t.identity-i.identity:t.index-i.index)).map((({item:t})=>t));var i,e}getProgress(t){return function(t,i,e=0,r=[],o=[],n=[]){const s=(i??[]).map(((t,i)=>({index:i,threshold:$(t),applied:I(r?.[i]),tierValue:$(o?.[i]),canAddFree:"boolean"==typeof n?.[i]?n[i]:void 0}))).filter((t=>null!==t.threshold)).sort(((t,i)=>t.threshold-i.threshold||t.index-i.index)),a=s.map((t=>t.threshold)),l=s.map((t=>t.applied)),c=l.some((t=>void 0!==t)),d=N(e);if(!a.length)return{thresholds:a,met:[],applied:l,appliedIndex:z,hasEngineVerdict:c,metCount:0,nextUnmetIndex:z,allMet:!1,lastReachedIndex:z,currentIndex:z,isComplete:!1,value:Math.max(0,N(t)),values:[],startValue:d,fills:[],overallPercentage:0};const h=a[a.length-1],f=R(N(t),0,Math.max(0,h)),u=s.map((({tierValue:t})=>null===t?f:R(t,0,Math.max(0,h))));let p=z;for(let t=0;t<a.length;t++)u[t]>=a[t]&&(p=t);const g=p===a.length-1,m=g?z:p+1,b=a.map(((t,i)=>function(t,i,e){return e<=i?t>=e?100:0:R((t-i)/(e-i)*100,0,100)}(u[i],0===i?d:a[i-1],t))),w=g?100:R((p+1+(b[m]??0)/100)/a.length*100,0,100);let y=z;for(let t=0;t<l.length;t++)!0===l[t]&&(y=t);let x=z;for(let t=0;t<a.length;t++){const i=s[t].canAddFree;(void 0===i?u[t]>=a[t]:i)&&(x=t)}const v=a.map(c?(t,i)=>i<=y:(t,i)=>i<=x),k=v.filter(Boolean).length,_=v.findIndex((t=>!t));return{thresholds:a,met:v,applied:l,appliedIndex:y,hasEngineVerdict:c,metCount:k,nextUnmetIndex:_,allMet:_===z,lastReachedIndex:p,currentIndex:m,isComplete:g,value:f,values:u,startValue:d,fills:b,overallPercentage:w}}(this.offer?.details?.current_value,t.map((({min_spend:t})=>t)),this.offer?.details?.start_value,t.map((({is_applied:t})=>t)),t.map((({current_value:t})=>t)),t.map((({can_add_free:t})=>t)))}tierKey(t,i){const e=Number(t?.id);return Number.isFinite(e)?`tier-${e}`:`pos-${i}`}stageMeasure(){return this.offer?.details?.based_on===n.PRODUCT_COUNT?F.COUNT:F.CURRENCY}formatRequirement(t){const i=this.offer?.details?.based_on;if(i===n.PRODUCT_COUNT)try{return salla.lang.choice("blocks.header.products_count",t)}catch(i){return this.safeLog("invalid products_count interval",i),`${t}`}return i===n.PRODUCT_PURCHASE?salla.money(t):(this.safeLog(`unexpected offer detail's based_on value: ${i}`),`${t}`)}getRewardText(t){if(this.isPickerTier(t)){const i=Math.max(1,Math.floor(Number(t.max_free_products)||1));return 1===i?this.trans("free_product_reward_one"):2===i?this.trans("free_products_reward_two"):this.trans("free_products_reward",{count:`${i}`})}return(t?.reward_label??"").trim()}getGuidanceMessage(t,i){if(i.nextUnmetIndex===z)return"";const e=Number(t[i.nextUnmetIndex]?.amount_needed),r=this.isPickerTier(t[i.nextUnmetIndex])&&Number.isFinite(e)&&e>0?e:function(t,i,e=F.CURRENCY){const r=i.thresholds[t];if(void 0===r)return 0;const o=Math.max(0,r-(i.values?.[t]??i.value));if(0===o)return 0;const n=e===F.COUNT?0:function(){try{const t="undefined"!=typeof salla?salla:void 0,i=j(t?.config?.currency?.()?.decimals);if(null!==i)return i;const e=j(t?.config?.get?.("store.currency.decimals"));if(null!==e)return e}catch(t){}return 2}(),s=Math.pow(10,n),a=Math.ceil(o*s-1e-6)/s;return a>0?a:1/s}(i.nextUnmetIndex,i,this.stageMeasure());if(r<=0)return this.trans("guidance_conditions_unmet");const o=this.formatRequirement(r),n=this.getRewardText(t[i.nextUnmetIndex]);return n?this.trans("guidance_next",{remaining:o,reward:D(n)}):this.trans("guidance_next_generic",{remaining:o})}getTierSentence(t,i,e){const r=this.formatRequirement(e.thresholds[i]),o=this.getRewardText(t),n=this.stageMeasure()===F.COUNT;return o?this.trans(n?"tier_requirement_count":"tier_requirement",{threshold:r,reward:D(o)}):this.trans(n?"tier_requirement_count_generic":"tier_requirement_generic",{threshold:r})}getRewardIcon(t){switch(t?.type){case o.PERCENTAGE:return"sicon-percentage";case o.FREE_PRODUCT:return"sicon-gift";case o.FIXED:return this.usesSarSymbol()?"sicon-sar":"sicon-banknote";default:return"sicon-tag"}}usesSarSymbol(){try{const t=salla.config.currency?.()?.symbol;return["SAR","ر.س"].includes(t)&&!!salla.config.get("store.settings.use_sar_symbol")}catch(t){return!1}}get isTooltipOpen(){return this.isTooltipHovered||this.isTooltipPinned}toggleTooltip(){this.isTooltipPinned=!this.isTooltipPinned}closeTooltip(t=!1){this.isTooltipOpen&&(this.isTooltipPinned=!1,this.isTooltipHovered=!1,t&&this.infoTriggerEl?.focus?.())}positionTooltip(){const t=this.tooltipEl,i=this.infoTriggerEl;if(this.isTooltipOpen&&t&&i)try{this.setTooltipOffsets(t,0,0);const e=window.innerWidth||document.documentElement?.clientWidth||0,r=t.getBoundingClientRect(),o=i.getBoundingClientRect(),n=r?.width||0;if(n<=0||e<=0)return;const s=o.left+o.width/2-n/2,a=8,l=Math.min(Math.max(s,a),Math.max(a,e-a-n))-s,c=Math.max(0,n/2-16),d=Math.min(Math.max(-l,-c),c);this.setTooltipOffsets(t,l,d)}catch(t){this.safeLog("positioning the offer details popover failed",t)}}setTooltipOffsets(t,i,e){t.style?.setProperty?.("--s-conditional-offer-tooltip-shift",`${Math.round(i)}px`),t.style?.setProperty?.("--s-conditional-offer-tooltip-caret",`${Math.round(e)}px`)}handleWindowResize(){this.positionTooltip()}handleDocumentKeydown(t){"Escape"!==t.key&&"Esc"!==t.key||this.closeTooltip(!0)}handleDocumentClick(t){if(!this.isTooltipPinned||!this.infoAnchorEl)return;const i="function"==typeof t.composedPath?t.composedPath():[];(i.length?i.includes(this.infoAnchorEl):this.infoAnchorEl.contains(t.target))||this.closeTooltip()}elementId(t){return`s-conditional-offer-${t}-${this.instanceId}`}renderBadges(t,e){return i("div",{class:"s-conditional-offer-badges",role:"img","aria-label":this.trans("badges_summary",{completed:`${e.metCount}`,total:`${t.length}`})},t.map(((t,r)=>{const o=e.met[r],n=this.tierKey(t,r);return[r>0?i("span",{key:`${n}-link`,class:{"s-conditional-offer-badge-link":!0,"s-conditional-offer-badge-link-met":o,"s-conditional-offer-badge-link-unmet":!o},"aria-hidden":"true"}):null,i("span",{key:n,class:{"s-conditional-offer-badge":!0,"s-conditional-offer-badge-met":o,"s-conditional-offer-badge-unmet":!o},"data-tier-state":o?"met":"unmet","data-tier-id":t?.id??void 0},i(o?Y:E,{class:"s-conditional-offer-badge-icon"}))]})))}renderTooltip(t,e){const r=function(t){const i=t?.details?.rules;if("string"==typeof i){const t=i.trim();return""===t?null:t}if(Array.isArray(i)){const t=i.filter((t=>"string"==typeof t)).map((t=>t.trim())).filter((t=>""!==t)).join(" ");return""===t?null:t}return null}(this.offer);return i("div",{class:"s-conditional-offer-tooltip",id:this.elementId("tooltip"),role:"tooltip",ref:t=>this.tooltipEl=t},i("div",{class:"s-conditional-offer-tooltip-title"},this.offer?.title),r?i("div",{class:"s-conditional-offer-tooltip-description"},r):null,i("ul",{class:"s-conditional-offer-tooltip-list"},t.map(((t,r)=>{const o=e.met[r];return i("li",{key:this.tierKey(t,r),class:"s-conditional-offer-tier","data-tier-state":o?"met":"unmet","data-tier-id":t?.id??void 0},i("span",{class:{"s-conditional-offer-tier-icon":!0,"s-conditional-offer-tier-icon-met":o,"s-conditional-offer-tier-icon-unmet":!o}},i("i",{class:this.getRewardIcon(t),"aria-hidden":"true"}),i("span",{class:{"s-conditional-offer-tier-status":!0,"s-conditional-offer-tier-status-met":o,"s-conditional-offer-tier-status-unmet":!o},"aria-hidden":"true"},o?i(Y,{class:"s-conditional-offer-tier-status-check"}):i(E,{class:"s-conditional-offer-tier-status-lock"}))),i("div",{class:"s-conditional-offer-tier-body"},i("div",{class:"s-conditional-offer-tier-title"},this.trans("tier_title",{number:`${r+1}`})),i("div",{class:{"s-conditional-offer-tier-text":!0,"s-conditional-offer-tier-text-met":o},innerHTML:this.getTierSentence(t,r,e)})))}))))}getPickerStage(t){return t.find((t=>this.isPickerTier(t)))??null}isPickerTier(t){return t?.type===o.FREE_PRODUCT&&Array.isArray(t.free_products)&&t.free_products.length>0}areGiftsUnavailable(t,i){const e=t[i.lastReachedIndex];return e?.type===o.FREE_PRODUCT&&Array.isArray(e.free_products)&&0===e.free_products.length&&0===this.gifts.length}loadFreeProductCards(){const t=this.getPickerStage(this.getStages()),i=(t?.free_products??[]).map((t=>String(t.id))).filter((t=>t&&!this.freeProductCards[t]));if(!i.length)return Promise.resolve();const e=new Set((t.free_products??[]).map((t=>String(t.id))));return Promise.resolve().then((()=>salla.product.fetch({source:"selected",source_value:i}))).then((t=>{if(this.isDisconnected)return;const i={...this.freeProductCards};(Array.isArray(t?.data)?t.data:[]).forEach((t=>{const r=String(t?.id??"");r&&e.has(r)&&(i[r]={id:r,name:String(t.name??""),imageUrl:String(t.image?.url??""),imageAlt:String(t.image?.alt??t.name??""),price:Number.isFinite(Number(t.price))?Number(t.price):null})})),this.freeProductCards=i})).catch((t=>this.safeLog("free product lookup failed",t)))}getPickerState(t){const i=this.cartLines.filter((t=>t.freeQuantity>0)),e=this.selectOwnFreeLines(i),r=new Set(e.map((t=>t.productId)).filter((t=>null!==t))),o=Math.max(1,Math.floor(Number(t.max_free_products)||1)),n=Number(t.current_value??this.offer?.details?.current_value??0);return{limit:o,reached:"boolean"==typeof t.can_add_free?t.can_add_free:Number.isFinite(n)&&n>=Number(t.min_spend),freeCount:r.size}}selectOwnFreeLines(t){const i=Number(this.offer?.id);if(!Number.isFinite(i))return t;const e=t.filter((t=>null!==t.offerId&&Number(t.offerId)===i));return e.length?e:t.filter((t=>null===t.offerId))}addFreeProduct(t){this.pendingFreeProduct||(this.pendingFreeProduct=t.id,this.runFreeProductChange((()=>Promise.resolve(salla.cart.addItem(t.id)).then((()=>{this.cartPageCheckAfter=this.giftsGeneration}))),"free product add failed"))}reloadPage(){window.location.reload()}fetchCartPageHtml(){const t=new AbortController,i=setTimeout((()=>t.abort()),8e3);return fetch(window.location.href,{cache:"no-store",credentials:"same-origin",headers:{Accept:"text/html"},signal:t.signal}).then((t=>t.ok?t.text():Promise.reject(new Error(`cart page ${t.status}`)))).finally((()=>clearTimeout(i)))}showMissingCartLines(t){this.insertingCartLines?this.pendingCartPageLines=t:this.missingCartLineIds(t).length&&(this.insertingCartLines=!0,Promise.resolve().then((()=>this.fetchCartPageHtml())).then((t=>{if(this.isDisconnected||this.cartChangedDuringPageFetch())return;const i=this.missingCartLineIds(this.cartLines);i.length&&!this.insertCartLineForms(t,i)&&this.reloadForMissingCartLines(i)})).catch((t=>{this.safeLog("cart page fetch for the new lines failed, reloading",t),this.isDisconnected||this.cartChangedDuringPageFetch()||this.reloadForMissingCartLines(this.missingCartLineIds(this.cartLines))})).finally((()=>{this.insertingCartLines=!1;const t=this.pendingCartPageLines;this.pendingCartPageLines=null,t&&!this.isDisconnected&&this.showMissingCartLines(t)})))}cartChangedDuringPageFetch(){return!(null===this.pendingFreeProduct&&this.cartLinesLoaded||(null===this.cartPageCheckAfter&&(this.cartPageCheckAfter=this.giftsGeneration),0))}missingCartLineIds(t){try{return document.querySelector(O)?t.map((t=>t.id)).filter((t=>!document.getElementById(`item-${t}`))).sort():[]}catch(t){return this.safeLog("cart page check after a free product add failed",t),[]}}insertCartLineForms(t,i){try{const e=Array.from((new DOMParser).parseFromString(t,"text/html").querySelectorAll(O)),r=e.map((t=>t.getAttribute("id")));return!i.some((t=>!r.includes(`item-${t}`)))&&(e.forEach(((t,e)=>{const o=r[e];if(!i.includes(o.slice(5))||document.getElementById(o))return;const n=r.slice(e+1).map((t=>document.getElementById(t))).find(Boolean);if(n)n.parentNode.insertBefore(t,n);else{const i=document.querySelectorAll(O),e=i[i.length-1];e.parentNode.insertBefore(t,e.nextSibling)}})),i.every((t=>document.getElementById(`item-${t}`))))}catch(t){return this.safeLog("cart line insert failed",t),!1}}reloadForMissingCartLines(t){if(!t.length)return;const i=t.join(","),e=this.readReloadGuard();e!==i&&(void 0===e&&this.pageWasReloaded()||(this.writeReloadGuard(i),this.reloadPage()))}readReloadGuard(){try{return window.sessionStorage.getItem(H)}catch{return}}writeReloadGuard(t){try{window.sessionStorage.setItem(H,t)}catch{}}pageWasReloaded(){try{const t=window.performance?.getEntriesByType?.("navigation")?.[0];return"reload"===t?.type}catch{return!1}}runFreeProductChange(t,i){Promise.resolve().then(t).then((()=>{if(this.isDisconnected)return this.unlockFreeProduct();this.pendingFreeProductSettledAt=this.giftsGeneration,this.pendingFreeProductTimer=setTimeout((()=>this.unlockOnStaleLines()),5e3)})).catch((t=>{this.safeLog(i,t),this.unlockFreeProduct(),null!==this.cartPageCheckAfter&&this.loadCart()}))}unlockOnStaleLines(){this.unlockFreeProduct(),this.cartLinesLoaded=!1,this.clearPickerLookupRetry(),T().then((()=>this.loadCart()),(()=>this.loadCart()))}unlockFreeProduct(){null!==this.pendingFreeProductTimer&&clearTimeout(this.pendingFreeProductTimer),this.pendingFreeProductTimer=null,this.pendingFreeProductSettledAt=null,this.pendingFreeProduct=null}pickerGotMessage(t,i){return 1===t?this.trans(i?"free_product_got_pick_one":"free_product_got_one"):2===t?this.trans(i?"free_products_got_pick_two":"free_products_got_two"):this.trans(i?"free_products_got_pick":"free_products_got",{count:`${t}`})}getPickerCards(t){return(t.free_products??[]).map((t=>this.freeProductCards[String(t.id)])).filter(Boolean)}renderPicker(t){const e=this.getPickerState(t),r=this.getPickerCards(t);return r.length?i("div",{class:"s-conditional-offer-picker","data-picker-reached":e.reached?"true":"false"},i("div",{class:"s-conditional-offer-picker-header"},i("span",{class:"s-conditional-offer-picker-counter","aria-label":`${e.freeCount}/${e.limit}`},`${e.freeCount}/${e.limit}`),i("span",{class:"s-conditional-offer-picker-title"},1===e.limit?this.trans("free_product_choose_one"):2===e.limit?this.trans("free_products_choose_two"):this.trans("free_products_choose",{count:`${e.limit}`}))),i("ul",{class:"s-conditional-offer-picker-list"},r.map((t=>this.renderPickerCard(t))))):null}renderPickerCard(t){return i("li",{class:"s-conditional-offer-picker-card","data-product-id":t.id},i("span",{class:"s-conditional-offer-picker-thumb"},t.imageUrl?i("img",{class:"s-conditional-offer-picker-image",src:t.imageUrl,alt:t.imageAlt||t.name,loading:"lazy",decoding:"async"}):i("i",{class:"sicon-gift","aria-hidden":"true"})),i("span",{class:"s-conditional-offer-picker-name"},t.name),null!==t.price?i("span",{class:"s-conditional-offer-picker-prices"},i("span",{class:"s-conditional-offer-picker-price-regular",innerHTML:salla.money(t.price)})):null,i("span",{class:"s-conditional-offer-picker-actions"},i("button",{type:"button",class:"s-conditional-offer-picker-add",onClick:()=>this.addFreeProduct(t)},this.getAddLabel())))}renderGiftsToggle(t,e){return i("button",{type:"button",id:this.elementId(`toggle-${t}`),class:{"s-conditional-offer-toggle":!0,"s-conditional-offer-toggle-inline":"inline"===t,"s-conditional-offer-toggle-bar":"bar"===t},"aria-expanded":this.isGiftsOpen?"true":"false","aria-controls":this.elementId("gifts"),onClick:()=>this.isGiftsOpen=!this.isGiftsOpen},i("span",null,this.trans(e?"offer_toggle":"manage_offer")),i("i",{class:{"sicon-keyboard_arrow_down":!0,"s-conditional-offer-toggle-icon":!0,"s-conditional-offer-toggle-icon-open":this.isGiftsOpen},"aria-hidden":"true"}))}renderGiftsCard(t=null){if(!t)return i("div",{class:"s-conditional-offer-panel",id:this.elementId("gifts")},i("div",{class:"s-conditional-offer-gifts-header"},i("span",{class:"s-conditional-offer-gifts-icon"},i("i",{class:"sicon-gift","aria-hidden":"true"})),i("span",{class:"s-conditional-offer-gifts-title"},this.trans("free_products_title"))),i("ul",{class:"s-conditional-offer-gifts-list"},this.gifts.map((t=>this.renderGiftRow(t)))));const e=this.getPickerState(t);return i("div",{class:"s-conditional-offer-panel",id:this.elementId("gifts")},e.reached?this.renderPicker(t):null,this.gifts.length?i("div",{class:"s-conditional-offer-gifts"},i("div",{class:"s-conditional-offer-gifts-header"},i("span",{class:"s-conditional-offer-gifts-icon"},i("i",{class:"sicon-gift","aria-hidden":"true"})),i("span",{class:"s-conditional-offer-gifts-title"},this.sharedLabel("pages.loyalty_program.free_product_title","Free products"))),i("ul",{class:"s-conditional-offer-gifts-list"},this.gifts.map((t=>this.renderGiftRow(t))))):null)}renderGiftRow(t){return i("li",{class:"s-conditional-offer-gift","data-item-id":t.id},i("span",{class:"s-conditional-offer-gift-thumb"},t.imageUrl?i("img",{class:"s-conditional-offer-gift-image",src:t.imageUrl,alt:t.imageAlt||t.name,loading:"lazy",decoding:"async"}):i("i",{class:"sicon-gift","aria-hidden":"true"})),i("div",{class:"s-conditional-offer-gift-body"},i("span",{class:"s-conditional-offer-gift-name"},t.name||this.trans("free_gift")),i("span",{class:"s-conditional-offer-gift-prices"},i("span",{class:"s-conditional-offer-gift-free"},this.getFreeLabel()),null!==t.originalPrice?i("span",{class:"s-conditional-offer-gift-price",innerHTML:salla.money(t.originalPrice)}):null)))}getLoadingSkeletonView(){return i(e,{class:"s-conditional-offer-root"},i("div",{class:"s-conditional-offer-banner"},i("div",{class:"s-conditional-offer-lead"},i("salla-skeleton",{height:"24px",width:"80px"}),i("div",{class:"s-conditional-offer-skeleton-text"},i("salla-skeleton",{height:"12px",width:"35%"}),i("salla-skeleton",{height:"16px",width:"60%"})))))}render(){if(!this.canRender)return null;if(!this.hasCartItems())return null;if(this.isLoading)return this.getLoadingSkeletonView();if(!this.offer)return null;const t=this.getStages(),r=this.getProgress(t),o=this.getGuidanceMessage(t,r),n=this.trans("details_title"),s=this.getPickerStage(t),a=null!==s?this.getPickerState(s):null,l=a?.reached??!1,c=this.gifts.length>0||l&&this.getPickerCards(s).length>0,d=l&&this.cartLinesLoaded&&0===a.freeCount,h=r.allMet&&l&&a.freeCount>0&&t[t.length-1]===s;return i(e,{class:"s-conditional-offer-root"},i("div",{class:"s-conditional-offer-banner"},i("div",{class:"s-conditional-offer-lead"},this.renderBadges(t,r),i("div",{class:"s-conditional-offer-text"},i("div",{class:"s-conditional-offer-heading",onMouseEnter:()=>this.isTooltipHovered=!0,onMouseLeave:()=>this.isTooltipHovered=!1},i("span",{class:"s-conditional-offer-name"},this.offer.title),i("span",{class:"s-conditional-offer-info",ref:t=>this.infoAnchorEl=t},i("button",{type:"button",class:"s-conditional-offer-info-trigger",ref:t=>this.infoTriggerEl=t,"aria-label":n,title:n,"aria-expanded":this.isTooltipOpen?"true":"false","aria-describedby":this.elementId("tooltip"),onClick:()=>this.toggleTooltip()},i(W,{class:"s-conditional-offer-info-icon"})),this.isTooltipOpen?this.renderTooltip(t,r):null)),d||h?i("div",{class:"s-conditional-offer-message",role:"status"},this.pickerGotMessage(a.limit,d)):this.areGiftsUnavailable(t,r)?i("div",{class:"s-conditional-offer-message",role:"status"},this.trans("free_products_unavailable")):r.allMet?i("div",{class:"s-conditional-offer-message",role:"status"},this.trans("congrats")):o?i("div",{class:"s-conditional-offer-message",innerHTML:o}):null)),c?this.renderGiftsToggle("inline",!!s):null),c&&this.isGiftsOpen?this.renderGiftsCard(s):null,c?this.renderGiftsToggle("bar",!!s):null)}get hostEl(){return r(this)}};Z.style='/*!twlt*/:host{display:block}.s-conditional-offer-root{background-color:rgba(0, 137, 123, 0.06);background-color:color-mix(in srgb, var(--color-primary, #00897b) 7%, transparent)}.s-conditional-offer-badges::-webkit-scrollbar{height:3px}.s-conditional-offer-badges::-webkit-scrollbar-thumb{border-radius:9999px;background-color:rgba(0, 0, 0, 0.15)}.s-conditional-offer-badges::-webkit-scrollbar-track{background-color:transparent}.s-conditional-offer-tooltip{--s-conditional-offer-tooltip-shift:0px;--s-conditional-offer-tooltip-caret:0px;transform:translateX(calc(-50% + var(--s-conditional-offer-tooltip-shift)))}.s-conditional-offer-tooltip::before{content:"";position:absolute;bottom:100%;left:50%;transform:translateX(calc(-50% + var(--s-conditional-offer-tooltip-caret)));border:8px solid transparent;border-bottom-color:#fff}.s-conditional-offer-tier-icon-met,.s-conditional-offer-tier-icon-unmet{color:var(--color-primary-dark, #00695c);background-color:rgba(0, 137, 123, 0.12);background-color:color-mix(in srgb, var(--color-primary, #00897b) 14%, transparent)}.s-conditional-offer-tier:not(:last-child)::before{content:"";position:absolute;top:2.5rem;bottom:-1rem;inset-inline-start:1.125rem;width:1px;background-color:#d1d5db}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.block{display:block}.inline{display:inline}.flex{display:flex}.hidden{display:none}.w-6{width:1.5rem}.resize{resize:both}.gap-1{gap:0.25rem}.rounded{border-radius:var(--s-radius, 0.25rem)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-conditional-offer-root{margin-bottom:1.25rem;display:block;width:100%;min-width:0px;max-width:100%;border-radius:0.375rem;padding:0.75rem}@media (min-width: 768px){.s-conditional-offer-root{padding:1rem}}.s-conditional-offer-banner{display:flex;width:100%;min-width:0px;align-items:center;justify-content:space-between;gap:0.75rem}@media (min-width: 768px){.s-conditional-offer-banner{gap:1rem}}.s-conditional-offer-lead{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.5rem}@media (min-width: 768px){.s-conditional-offer-lead{gap:0.75rem}}.s-conditional-offer-badges{display:flex;max-width:45%;flex-shrink:0;flex-wrap:nowrap;align-items:center;gap:0.25rem;overflow-x:auto;overscroll-behavior-x:contain;scroll-behavior:smooth;scrollbar-width:thin}.s-conditional-offer-badge{display:inline-flex;height:1.5rem;width:1.5rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;font-size:11px;line-height:1;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-conditional-offer-badge-met{background-color:var(--color-primary)}.s-conditional-offer-badge-unmet{--tw-bg-opacity:1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.s-conditional-offer-badge-link{width:0.5rem;flex-shrink:0;border-top-width:1px}.s-conditional-offer-badge-link-met{border-color:var(--color-primary)}.s-conditional-offer-badge-link-unmet{border-style:dashed;--tw-border-opacity:1;border-color:rgb(82 82 82 / var(--tw-border-opacity, 1))}.s-conditional-offer-badge-icon{height:0.75rem;width:0.75rem;flex-shrink:0}.s-conditional-offer-text{display:flex;min-width:0px;flex-direction:column;gap:0.125rem;text-align:start}.s-conditional-offer-heading{display:flex;min-width:0px;align-items:center;gap:0.375rem}.s-conditional-offer-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(82 82 82 / var(--tw-text-opacity, 1))}.s-conditional-offer-info{position:relative;display:inline-flex;flex-shrink:0;align-items:center}.s-conditional-offer-info-trigger{display:inline-flex;height:1rem;width:1rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;--tw-text-opacity:1;color:rgb(115 115 115 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-conditional-offer-info-trigger:hover{color:var(--color-primary-dark)}.s-conditional-offer-info-icon{height:0.875rem;width:0.875rem;flex-shrink:0}.s-conditional-offer-message{font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary-dark)}@media (min-width: 768px){.s-conditional-offer-message{font-size:1rem;line-height:1.5rem}}.s-conditional-offer-toggle{align-items:center;justify-content:center;gap:0.375rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(38 38 38 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-conditional-offer-toggle:hover{color:var(--color-primary-dark)}.s-conditional-offer-toggle-inline{display:none;flex-shrink:0}@media (min-width: 768px){.s-conditional-offer-toggle-inline{display:inline-flex}}.s-conditional-offer-toggle-bar{margin-top:0.5rem;display:inline-flex;width:100%;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-left:0.75rem;padding-right:0.75rem;padding-top:0.625rem;padding-bottom:0.625rem}@media (min-width: 768px){.s-conditional-offer-toggle-bar{display:none}}.s-conditional-offer-toggle-icon{font-size:1rem;line-height:1.5rem;line-height:1;transition-property:transform;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-conditional-offer-toggle-icon-open{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-conditional-offer-panel{margin-top:0.75rem;width:100%;min-width:0px;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.75rem}.s-conditional-offer-gifts-header{margin-bottom:0.75rem;display:flex;align-items:center;gap:0.5rem}.s-conditional-offer-gifts-icon{display:inline-flex;height:2rem;width:2rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-color:var(--color-primary);font-size:1rem;line-height:1.5rem;line-height:1;color:var(--color-primary)}.s-conditional-offer-gifts-title{font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary-dark)}.s-conditional-offer-gifts-list{margin:0px;display:flex;list-style-type:none;flex-direction:column;gap:0.5rem;padding:0px}.s-conditional-offer-gift{display:flex;align-items:center;gap:0.75rem;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));padding:0.5rem}.s-conditional-offer-gift-thumb{display:inline-flex;height:3.5rem;width:3.5rem;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));font-size:1.25rem;line-height:1.75rem;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-conditional-offer-gift-image{height:100%;width:100%;object-fit:contain}.s-conditional-offer-gift-body{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:0.125rem;text-align:start}.s-conditional-offer-gift-name{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(38 38 38 / var(--tw-text-opacity, 1))}.s-conditional-offer-gift-prices{display:flex;align-items:center;gap:0.5rem;font-size:0.75rem;line-height:1rem}.s-conditional-offer-gift-free{font-weight:700;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-conditional-offer-gift-price{--tw-text-opacity:1;color:rgb(115 115 115 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-conditional-offer-gifts{margin-top:0.75rem;width:100%;min-width:0px;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));padding:0.75rem}.s-conditional-offer-picker{display:flex;width:100%;min-width:0px;flex-direction:column;gap:0.75rem}.s-conditional-offer-picker-header{display:flex;align-items:center;gap:0.5rem}.s-conditional-offer-picker-counter{display:inline-flex;height:2.25rem;width:2.25rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;border-width:2px;border-color:var(--color-primary);font-size:0.75rem;line-height:1rem;font-weight:700;color:var(--color-primary-dark)}.s-conditional-offer-picker-title{font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary-dark)}.s-conditional-offer-picker-list{margin:0px;display:flex;list-style-type:none;gap:0.75rem;overflow-x:auto;overscroll-behavior-x:contain;scroll-behavior:smooth;padding:0px;padding-bottom:0.25rem;scrollbar-width:thin}.s-conditional-offer-picker-card{display:flex;width:9rem;flex-shrink:0;flex-direction:column;gap:0.375rem;text-align:start}.s-conditional-offer-picker-thumb{display:inline-flex;height:7rem;width:100%;align-items:center;justify-content:center;overflow:hidden;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));font-size:1.5rem;line-height:2rem;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-conditional-offer-picker-image{height:100%;width:100%;object-fit:contain}.s-conditional-offer-picker-name{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(38 38 38 / var(--tw-text-opacity, 1))}.s-conditional-offer-picker-prices{display:flex;align-items:center;gap:0.5rem;font-size:0.75rem;line-height:1rem}.s-conditional-offer-picker-price-regular{font-weight:700;--tw-text-opacity:1;color:rgb(23 23 23 / var(--tw-text-opacity, 1))}.s-conditional-offer-picker-actions{margin-top:auto;display:flex;width:100%;align-items:center;gap:0.375rem}.s-conditional-offer-picker-add{display:inline-flex;height:2.25rem;flex:1 1 0%;align-items:center;justify-content:center;border-radius:0.375rem;border-width:1px;border-color:var(--color-primary);font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary-dark);transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-conditional-offer-picker-add:hover{background-color:var(--color-primary);--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-conditional-offer-tooltip{position:absolute;top:calc(100% + 0.75rem);left:50%;z-index:10;width:min(22rem, calc(100vw - 2rem));border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1rem;text-align:start;--tw-shadow:5px 10px 30px #2B2D340D;--tw-shadow-colored:5px 10px 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-conditional-offer-tooltip-title{font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary-dark)}.s-conditional-offer-tooltip-description{margin-top:0.25rem;font-size:0.75rem;line-height:1rem;line-height:1.625;--tw-text-opacity:1;color:rgb(82 82 82 / var(--tw-text-opacity, 1))}.s-conditional-offer-tooltip-list{margin:0px;margin-top:0.75rem;display:flex;list-style-type:none;flex-direction:column;gap:1rem;padding:0px}.s-conditional-offer-tier{position:relative;display:flex;align-items:flex-start;gap:0.75rem}.s-conditional-offer-tier-icon{position:relative;display:inline-flex;height:2.25rem;width:2.25rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;font-size:1rem;line-height:1.5rem;line-height:1}.s-conditional-offer-tier-icon-unmet{color:var(--color-primary-dark)}.s-conditional-offer-tier-status{position:absolute;bottom:-0.125rem;display:inline-flex;height:1rem;width:1rem;align-items:center;justify-content:center;border-radius:9999px;border-width:2px;--tw-border-opacity:1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));inset-inline-start:-2px}.s-conditional-offer-tier-status-met{color:var(--color-primary-dark)}.s-conditional-offer-tier-status-unmet{--tw-text-opacity:1;color:rgb(163 163 163 / var(--tw-text-opacity, 1))}.s-conditional-offer-tier-status-check{height:0.75rem;width:0.75rem;flex-shrink:0}.s-conditional-offer-tier-status-lock{height:0.625rem;width:0.625rem;flex-shrink:0}.s-conditional-offer-tier-body{display:flex;min-width:0px;flex-direction:column;gap:0.125rem}.s-conditional-offer-tier-title{font-size:0.75rem;line-height:1rem;font-weight:700;color:var(--color-primary-dark)}.s-conditional-offer-tier-text{font-size:0.75rem;line-height:1rem;line-height:1.625;--tw-text-opacity:1;color:rgb(82 82 82 / var(--tw-text-opacity, 1))}.s-conditional-offer-tier-text-met{text-decoration-line:line-through}.s-conditional-offer-skeleton-text{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:0.375rem}';export{Z as salla_conditional_offer}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as i,F as s,a as t}from"./p-DRvWpd5P.js";const a={title:{ar:"تحديث رقم الجوال",en:"Update your mobile number"},clarification:{ar:"رقم الجوال مكرر مع حساب آخر يبدو أنك تملك حساباً مسبقاً بهذا الرقم! يرجى تسجيل الدخول عبر البريد الإلكتروني، أو المتابعة باستخدام رقم جوال جديد.",en:"This mobile number is duplicated with another account. It looks like you already have an account with this number! Please log in with your email, or continue with a new mobile number."},choice:{ar:"هل هذا الرقم رقم جوالك؟ أكّد رقمك الحالي أو أدخل رقماً جديداً لإتمام الطلب.",en:"Is this your mobile number? Confirm your current number or enter a new one to complete the order."},same_number:{ar:"تأكيد رقمي الحالي",en:"Confirm my current number"},new_number:{ar:"استخدام رقم جديد",en:"Use a new number"},send_code:{ar:"إرسال رمز التحقق",en:"Send verification code"},exists:{ar:"رقم الجوال موجود مسبقاً",en:"Mobile number exists"},blocked:{ar:"يرجى إدخال رقم جوال جديد لإتمام الطلب",en:"Please provide a new mobile number to complete the order"},too_many:{ar:"تجاوزت عدد المحاولات المسموح بها، حاول مرة أخرى بعد 10 دقائق",en:"Too many attempts, please try again after 10 minutes"},back:{ar:"رجوع",en:"Back"}},l=class{constructor(i){e(this,i),this.options=["new_number"],this.step="mobile",this.mode="new_number",this.errorMessage="",this.fieldError="",this.phone={},this.completed=!1,this.sending=!1,this.flow=0,this.dialCode="",this.verifyCode=e=>("same_number"===this.mode?salla.api.profile.requiredMobile("requiredMobileSameVerify",{code:e.code}):salla.api.profile.requiredMobile("requiredMobileUpdate",{...this.phone,code:e.code})).then((e=>(this.completed=!0,salla.event.emit("mobile-update::updated",e),this.modal.close(),e))),this.resendCode=()=>this.requestCode().catch((e=>{this.fail(e,salla.lang.get("common.errors.error_occurred"))}))}t(e){const i=a[e],s="ar"===salla.lang.locale?i.ar:i.en;return salla.lang.getWithDefault({back:"common.elements.back",send_code:"pages.checkout.send_code"}[e]||`pages.mobile_update.${e}`,s)}async open(e={}){this.options=e.options?.length?e.options:["new_number"],this.completed=!1,this.sending=!1,this.flow++,this.errorMessage="",this.fieldError="",this.step=this.options.includes("same_number")?"choice":"mobile",this.mode="new_number",await this.modal.open()}onVisibilityChanged(e){e||this.completed||salla.event.emit("mobile-update::dismissed")}fail(e,i=""){const s=e?.response?.status,t=[].concat((e?.response?.data?.error?.fields||{}).phone||[])[0];this.errorMessage="",this.fieldError="",429!==s&&t?this.fieldError=this.t("exists"):this.errorMessage=429===s?this.t("too_many"):e?.response?.data?.error?.message||i}async sendCode(){if(this.sending)return;this.errorMessage="",this.fieldError="";const e=this.flow;this.sending=!0;try{if("new_number"===this.mode){if(!await this.telInput.isValid())return;const e=await this.telInput.getValues();this.phone={phone:e.phone,country_code:e.countryCode},this.dialCode=String(e.countryKey||"")}await this.requestCode(),e===this.flow&&(this.step="verify")}catch(i){e===this.flow&&this.fail(i,salla.lang.get("common.errors.error_occurred"))}finally{e===this.flow&&(this.sending=!1)}}requestCode(){return"same_number"===this.mode?salla.api.profile.requiredMobile("requiredMobileSameSend"):salla.api.profile.requiredMobile("requiredMobileSend",this.phone)}componentDidRender(){"verify"===this.step&&this.verify&&!this.verify.dataset.opened&&(this.verify.dataset.opened="true",this.verify.open({type:"mobile"}))}chooseMode(e){if(!this.sending){if(this.mode=e,this.errorMessage="",this.fieldError="","same_number"===e)return this.sendCode();this.step="mobile"}}changeNumber(){this.step="same_number"===this.mode?"choice":"mobile",this.errorMessage="",this.fieldError=""}sentTo(){return"same_number"===this.mode?String(salla.config.get("user.mobile","")||""):`${this.dialCode}${this.phone.phone||""}`}clarification(){return this.options.includes("same_number")?this.t("choice"):this.t("clarification")}body(){return"choice"===this.step?i(s,null,i("p",{class:"s-mobile-update-message"},this.clarification()),i("salla-button",{class:"s-mobile-update-same",width:"wide",onClick:()=>this.chooseMode("same_number")},this.t("same_number")),i("salla-button",{class:"s-mobile-update-new",width:"wide",color:"light",onClick:()=>this.chooseMode("new_number")},this.t("new_number"))):"mobile"===this.step?i(s,null,i("p",{class:"s-mobile-update-message"},this.clarification()),!this.options.includes("same_number")&&i("p",{class:"s-mobile-update-blocked"},this.t("blocked")),i("div",{class:"s-mobile-update-field"},i("salla-tel-input",{ref:e=>this.telInput=e}),this.fieldError&&i("span",{class:"s-tel-input-error-msg s-mobile-update-field-error"},this.fieldError)),i("salla-button",{class:"s-mobile-update-send",width:"wide",onClick:()=>this.sendCode()},this.t("send_code")),this.options.includes("same_number")&&i("salla-button",{class:"s-mobile-update-back",width:"wide",color:"light",fill:"outline",onClick:()=>{this.sending||(this.step="choice",this.errorMessage="",this.fieldError="")}},this.t("back"))):i(s,null,i("salla-verify",{display:"inline",type:"mobile",autoReload:!1,verifyHandler:this.verifyCode,resendHandler:this.resendCode,ref:e=>{this.verify=e}},i("b",{slot:"mobile",class:"s-mobile-update-number",dir:"ltr"},this.sentTo())),i("salla-button",{class:"s-mobile-update-change",width:"wide",color:"light",fill:"outline",onClick:()=>this.changeNumber()},this.t("back")))}render(){return i("salla-modal",{key:"9b414affef0063fc82fb99b0a065062aacf840be",class:"s-mobile-update-modal",width:"xs","is-closable":!0,"modal-title":this.t("title"),ref:e=>this.modal=e,onModalVisibilityChanged:e=>this.onVisibilityChanged(!!e.detail)},i("div",{key:"2de95104b0b048b47baa4a7472cea566e4e961e4",class:"s-mobile-update-content"},this.body(),this.errorMessage&&i("span",{key:"f8ccbd204e9dcaa31a48b2beb974a4b5d8691d53",class:"s-mobile-update-error"},this.errorMessage)))}get host(){return t(this)}};l.style="/*!twlt*/.s-mobile-update-content,.s-mobile-update-content salla-verify .s-verify-body{display:flex;flex-direction:column;gap:1rem}.s-mobile-update-message,.s-mobile-update-blocked{margin:0}.s-mobile-update-field{display:flex;flex-direction:column;gap:0.25rem}.s-mobile-update-field-error{display:block;color:#ef4444;font-size:0.875rem}.s-mobile-update-number{display:block;text-align:center}.s-mobile-update-content .s-verify-footer{display:flex;flex-direction:column;gap:1rem}.\\!visible{visibility:visible !important}.visible{visibility:visible}.inline{display:inline}.outline{outline-style:solid}";export{l as salla_mobile_update_modal}
4
+ import{r as e,h as i,F as s,a as t}from"./p-BXSGktmF.js";const a={title:{ar:"تحديث رقم الجوال",en:"Update your mobile number"},clarification:{ar:"رقم الجوال مكرر مع حساب آخر يبدو أنك تملك حساباً مسبقاً بهذا الرقم! يرجى تسجيل الدخول عبر البريد الإلكتروني، أو المتابعة باستخدام رقم جوال جديد.",en:"This mobile number is duplicated with another account. It looks like you already have an account with this number! Please log in with your email, or continue with a new mobile number."},choice:{ar:"هل هذا الرقم رقم جوالك؟ أكّد رقمك الحالي أو أدخل رقماً جديداً لإتمام الطلب.",en:"Is this your mobile number? Confirm your current number or enter a new one to complete the order."},same_number:{ar:"تأكيد رقمي الحالي",en:"Confirm my current number"},new_number:{ar:"استخدام رقم جديد",en:"Use a new number"},send_code:{ar:"إرسال رمز التحقق",en:"Send verification code"},exists:{ar:"رقم الجوال موجود مسبقاً",en:"Mobile number exists"},blocked:{ar:"يرجى إدخال رقم جوال جديد لإتمام الطلب",en:"Please provide a new mobile number to complete the order"},too_many:{ar:"تجاوزت عدد المحاولات المسموح بها، حاول مرة أخرى بعد 10 دقائق",en:"Too many attempts, please try again after 10 minutes"},back:{ar:"رجوع",en:"Back"}},l=class{constructor(i){e(this,i),this.options=["new_number"],this.step="mobile",this.mode="new_number",this.errorMessage="",this.fieldError="",this.phone={},this.completed=!1,this.sending=!1,this.flow=0,this.dialCode="",this.verifyCode=e=>("same_number"===this.mode?salla.api.profile.requiredMobile("requiredMobileSameVerify",{code:e.code}):salla.api.profile.requiredMobile("requiredMobileUpdate",{...this.phone,code:e.code})).then((e=>(this.completed=!0,salla.event.emit("mobile-update::updated",e),this.modal.close(),e))),this.resendCode=()=>this.requestCode().catch((e=>{this.fail(e,salla.lang.get("common.errors.error_occurred"))}))}t(e){const i=a[e],s="ar"===salla.lang.locale?i.ar:i.en;return salla.lang.getWithDefault({back:"common.elements.back",send_code:"pages.checkout.send_code"}[e]||`pages.mobile_update.${e}`,s)}async open(e={}){this.options=e.options?.length?e.options:["new_number"],this.completed=!1,this.sending=!1,this.flow++,this.errorMessage="",this.fieldError="",this.step=this.options.includes("same_number")?"choice":"mobile",this.mode="new_number",await this.modal.open()}onVisibilityChanged(e){e||this.completed||salla.event.emit("mobile-update::dismissed")}fail(e,i=""){const s=e?.response?.status,t=[].concat((e?.response?.data?.error?.fields||{}).phone||[])[0];this.errorMessage="",this.fieldError="",429!==s&&t?this.fieldError=this.t("exists"):this.errorMessage=429===s?this.t("too_many"):e?.response?.data?.error?.message||i}async sendCode(){if(this.sending)return;this.errorMessage="",this.fieldError="";const e=this.flow;this.sending=!0;try{if("new_number"===this.mode){if(!await this.telInput.isValid())return;const e=await this.telInput.getValues();this.phone={phone:e.phone,country_code:e.countryCode},this.dialCode=String(e.countryKey||"")}await this.requestCode(),e===this.flow&&(this.step="verify")}catch(i){e===this.flow&&this.fail(i,salla.lang.get("common.errors.error_occurred"))}finally{e===this.flow&&(this.sending=!1)}}requestCode(){return"same_number"===this.mode?salla.api.profile.requiredMobile("requiredMobileSameSend"):salla.api.profile.requiredMobile("requiredMobileSend",this.phone)}componentDidRender(){"verify"===this.step&&this.verify&&!this.verify.dataset.opened&&(this.verify.dataset.opened="true",this.verify.open({type:"mobile"}))}chooseMode(e){if(!this.sending){if(this.mode=e,this.errorMessage="",this.fieldError="","same_number"===e)return this.sendCode();this.step="mobile"}}changeNumber(){this.step="same_number"===this.mode?"choice":"mobile",this.errorMessage="",this.fieldError=""}sentTo(){return"same_number"===this.mode?String(salla.config.get("user.mobile","")||""):`${this.dialCode}${this.phone.phone||""}`}clarification(){return this.options.includes("same_number")?this.t("choice"):this.t("clarification")}body(){return"choice"===this.step?i(s,null,i("p",{class:"s-mobile-update-message"},this.clarification()),i("salla-button",{class:"s-mobile-update-same",width:"wide",onClick:()=>this.chooseMode("same_number")},this.t("same_number")),i("salla-button",{class:"s-mobile-update-new",width:"wide",color:"light",onClick:()=>this.chooseMode("new_number")},this.t("new_number"))):"mobile"===this.step?i(s,null,i("p",{class:"s-mobile-update-message"},this.clarification()),!this.options.includes("same_number")&&i("p",{class:"s-mobile-update-blocked"},this.t("blocked")),i("div",{class:"s-mobile-update-field"},i("salla-tel-input",{ref:e=>this.telInput=e}),this.fieldError&&i("span",{class:"s-tel-input-error-msg s-mobile-update-field-error"},this.fieldError)),i("salla-button",{class:"s-mobile-update-send",width:"wide",onClick:()=>this.sendCode()},this.t("send_code")),this.options.includes("same_number")&&i("salla-button",{class:"s-mobile-update-back",width:"wide",color:"light",fill:"outline",onClick:()=>{this.sending||(this.step="choice",this.errorMessage="",this.fieldError="")}},this.t("back"))):i(s,null,i("salla-verify",{display:"inline",type:"mobile",autoReload:!1,verifyHandler:this.verifyCode,resendHandler:this.resendCode,ref:e=>{this.verify=e}},i("b",{slot:"mobile",class:"s-mobile-update-number",dir:"ltr"},this.sentTo())),i("salla-button",{class:"s-mobile-update-change",width:"wide",color:"light",fill:"outline",onClick:()=>this.changeNumber()},this.t("back")))}render(){return i("salla-modal",{key:"9b414affef0063fc82fb99b0a065062aacf840be",class:"s-mobile-update-modal",width:"xs","is-closable":!0,"modal-title":this.t("title"),ref:e=>this.modal=e,onModalVisibilityChanged:e=>this.onVisibilityChanged(!!e.detail)},i("div",{key:"2de95104b0b048b47baa4a7472cea566e4e961e4",class:"s-mobile-update-content"},this.body(),this.errorMessage&&i("span",{key:"f8ccbd204e9dcaa31a48b2beb974a4b5d8691d53",class:"s-mobile-update-error"},this.errorMessage)))}get host(){return t(this)}};l.style="/*!twlt*/.s-mobile-update-content,.s-mobile-update-content salla-verify .s-verify-body{display:flex;flex-direction:column;gap:1rem}.s-mobile-update-message,.s-mobile-update-blocked{margin:0}.s-mobile-update-field{display:flex;flex-direction:column;gap:0.25rem}.s-mobile-update-field-error{display:block;color:#ef4444;font-size:0.875rem}.s-mobile-update-number{display:block;text-align:center}.s-mobile-update-content .s-verify-footer{display:flex;flex-direction:column;gap:1rem}.\\!visible{visibility:visible !important}.visible{visibility:visible}.inline{display:inline}.outline{outline-style:solid}";export{l as salla_mobile_update_modal}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as i,h as s,H as t}from"./p-DRvWpd5P.js";import{H as r}from"./p-00vBRoH3.js";import{H as e}from"./p-BerWJEF6.js";const a=class{constructor(s){i(this,s),this.isEnabled=!1,this.wishlistCount=0,this.wishlistLabel=salla.lang.get("common.titles.wishlist"),salla.wishlist.event.onAdded((()=>this.syncCount())),salla.wishlist.event.onRemoved((()=>this.syncCount())),salla.event.on("wishlist::storage.synced",(()=>this.syncCount()))}componentWillLoad(){return new Promise((i=>salla.onReady((()=>{const s=e.getPlanName();this.isEnabled=!!s&&["basic","plus"].includes(s),this.syncCount(),i()}))))}syncCount(){this.wishlistCount=(salla.storage.get("salla::wishlist",[])||[]).length}render(){const i=salla.config.isGuest();return!this.isEnabled||i?s(t,{hidden:!0}):s(t,null,s("a",{class:"s-wishlist-summary-wrapper",href:salla.url.get("account/wishlist"),"aria-label":this.wishlistLabel},s("i",{class:"s-wishlist-summary-icon",innerHTML:r}),this.wishlistCount>0&&s("span",{class:"s-wishlist-summary-count"},salla.helpers.number(this.wishlistCount))))}};a.style='/*!twlt*/:host{display:inline-flex;align-items:center;margin-inline-start:1rem}.hidden{display:none}.s-wishlist-summary-wrapper{position:relative;margin-inline-start:0.75rem;display:inline-flex;align-items:center;border-style:none;text-decoration-line:none;outline:2px solid transparent;outline-offset:2px;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}.s-wishlist-summary-wrapper:hover{opacity:0.8}.s-wishlist-summary-icon{display:inline-flex;height:2.5rem;width:2.5rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-color:var(--color-border,#e5e7eb);color:var(--color-text-primary,#374151)}.s-wishlist-summary-icon svg{height:1.25rem;width:1.25rem;fill:currentColor}.s-wishlist-summary-count{position:absolute;top:-4px;left:-6px;display:inline-flex;height:1.25rem;width:1.25rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1));padding:0.25rem;font-size:0.75rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-wishlist-summary-count:where([dir="rtl"],[dir="rtl"] *){left:unset;right:-6px}';export{a as salla_wishlist_summary}
4
+ import{r as i,h as s,H as t}from"./p-BXSGktmF.js";import{H as r}from"./p-00vBRoH3.js";import{H as e}from"./p-qWzMt6Cu.js";const a=class{constructor(s){i(this,s),this.isEnabled=!1,this.wishlistCount=0,this.wishlistLabel=salla.lang.get("common.titles.wishlist"),salla.wishlist.event.onAdded((()=>this.syncCount())),salla.wishlist.event.onRemoved((()=>this.syncCount())),salla.event.on("wishlist::storage.synced",(()=>this.syncCount()))}componentWillLoad(){return new Promise((i=>salla.onReady((()=>{const s=e.getPlanName();this.isEnabled=!!s&&["basic","plus"].includes(s),this.syncCount(),i()}))))}syncCount(){this.wishlistCount=(salla.storage.get("salla::wishlist",[])||[]).length}render(){const i=salla.config.isGuest();return!this.isEnabled||i?s(t,{hidden:!0}):s(t,null,s("a",{class:"s-wishlist-summary-wrapper",href:salla.url.get("account/wishlist"),"aria-label":this.wishlistLabel},s("i",{class:"s-wishlist-summary-icon",innerHTML:r}),this.wishlistCount>0&&s("span",{class:"s-wishlist-summary-count"},salla.helpers.number(this.wishlistCount))))}};a.style='/*!twlt*/:host{display:inline-flex;align-items:center;margin-inline-start:1rem}.hidden{display:none}.s-wishlist-summary-wrapper{position:relative;margin-inline-start:0.75rem;display:inline-flex;align-items:center;border-style:none;text-decoration-line:none;outline:2px solid transparent;outline-offset:2px;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}.s-wishlist-summary-wrapper:hover{opacity:0.8}.s-wishlist-summary-icon{display:inline-flex;height:2.5rem;width:2.5rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-color:var(--color-border,#e5e7eb);color:var(--color-text-primary,#374151)}.s-wishlist-summary-icon svg{height:1.25rem;width:1.25rem;fill:currentColor}.s-wishlist-summary-count{position:absolute;top:-4px;left:-6px;display:inline-flex;height:1.25rem;width:1.25rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1));padding:0.25rem;font-size:0.75rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-wishlist-summary-count:where([dir="rtl"],[dir="rtl"] *){left:unset;right:-6px}';export{a as salla_wishlist_summary}