@salla.sa/twilight-components 2.14.387 → 2.14.388

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 (248) hide show
  1. package/dist/cjs/{filepond-DY8Bk_1p.js → filepond-JwtIy_PZ.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-DRBpp2WC.js → filepond-plugin-file-poster-HbVPHajC.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-Ps1G9vOF.js → filepond-plugin-file-validate-size-BfnCLQbe.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-fVUTClJE.js → filepond-plugin-file-validate-type-ZlRC1VfY.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-Bh4Pqw-q.js → filepond-plugin-image-edit-DiQE1wz9.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-D_Tfa9YD.js → filepond-plugin-image-exif-orientation-DIwNNDxM.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-Bsg4ZULY.js → filepond-plugin-image-preview-C51b46QP.js} +1 -1
  8. package/dist/cjs/{index-DjO53bco.js → index-ByBROVOr.js} +1 -1
  9. package/dist/cjs/{index-B99uI20k.js → index-DO-q5keQ.js} +2 -2
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/cjs/salla-accordion-body_3.cjs.entry.js +1 -1
  12. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-add-product-button_4.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
  19. package/dist/cjs/salla-bullet-delivery.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-comment-form_8.cjs.entry.js +35 -21
  23. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-count-down_2.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-progress-bar.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  80. package/dist/cjs/twilight.cjs.js +1 -1
  81. package/dist/cjs/{vanilla-picker-DmWOIwng.js → vanilla-picker-DiJq-dd5.js} +1 -1
  82. package/dist/collection/components/salla-comments/salla-comments.js +34 -20
  83. package/dist/components/index.js +2 -2
  84. package/dist/components/salla-comments.js +34 -20
  85. package/dist/esm/{filepond-CqDfFTVp.js → filepond-CtRmlCu3.js} +1 -1
  86. package/dist/esm/{filepond-plugin-file-poster-Bj5ejqRD.js → filepond-plugin-file-poster-CMkOcEkV.js} +1 -1
  87. package/dist/esm/{filepond-plugin-file-validate-size-CDa3pirY.js → filepond-plugin-file-validate-size-DzG8gDvA.js} +1 -1
  88. package/dist/esm/{filepond-plugin-file-validate-type-BHJfNcLt.js → filepond-plugin-file-validate-type-DSshuV-e.js} +1 -1
  89. package/dist/esm/{filepond-plugin-image-edit-CzuXmnyp.js → filepond-plugin-image-edit-soyMBqQc.js} +1 -1
  90. package/dist/esm/{filepond-plugin-image-exif-orientation-Bxdqligt.js → filepond-plugin-image-exif-orientation-Bt8OVYG8.js} +1 -1
  91. package/dist/esm/{filepond-plugin-image-preview-DRM_r5yF.js → filepond-plugin-image-preview-N0oEw9xZ.js} +1 -1
  92. package/dist/esm/{index-Dbv0I4re.js → index-CvIpy7Cj.js} +2 -2
  93. package/dist/esm/{index-nTW4l4L5.js → index-Cw-jhhOv.js} +1 -1
  94. package/dist/esm/loader.js +2 -2
  95. package/dist/esm/salla-accordion-body_3.entry.js +1 -1
  96. package/dist/esm/salla-accordion_6.entry.js +1 -1
  97. package/dist/esm/salla-add-product-button_4.entry.js +1 -1
  98. package/dist/esm/salla-advertisement.entry.js +1 -1
  99. package/dist/esm/salla-alert_2.entry.js +1 -1
  100. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  101. package/dist/esm/salla-apps-icons.entry.js +1 -1
  102. package/dist/esm/salla-booking-field_7.entry.js +10 -10
  103. package/dist/esm/salla-bullet-delivery.entry.js +1 -1
  104. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  105. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  106. package/dist/esm/salla-comment-form_8.entry.js +35 -21
  107. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  108. package/dist/esm/salla-contacts.entry.js +1 -1
  109. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  110. package/dist/esm/salla-count-down_2.entry.js +1 -1
  111. package/dist/esm/salla-custom-fields.entry.js +1 -1
  112. package/dist/esm/salla-filters-widget.entry.js +1 -1
  113. package/dist/esm/salla-filters.entry.js +1 -1
  114. package/dist/esm/salla-gifting.entry.js +1 -1
  115. package/dist/esm/salla-hook.entry.js +1 -1
  116. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  117. package/dist/esm/salla-installment.entry.js +1 -1
  118. package/dist/esm/salla-list-tile.entry.js +1 -1
  119. package/dist/esm/salla-localization-modal.entry.js +1 -1
  120. package/dist/esm/salla-login-modal.entry.js +1 -1
  121. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  122. package/dist/esm/salla-loyalty-program.entry.js +1 -1
  123. package/dist/esm/salla-loyalty.entry.js +1 -1
  124. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  125. package/dist/esm/salla-menu.entry.js +1 -1
  126. package/dist/esm/salla-metadata.entry.js +1 -1
  127. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  128. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  129. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  130. package/dist/esm/salla-notification-item.entry.js +1 -1
  131. package/dist/esm/salla-notifications.entry.js +1 -1
  132. package/dist/esm/salla-offer-modal.entry.js +1 -1
  133. package/dist/esm/salla-offer.entry.js +1 -1
  134. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  135. package/dist/esm/salla-order-details-options.entry.js +1 -1
  136. package/dist/esm/salla-order-details.entry.js +1 -1
  137. package/dist/esm/salla-order-summary.entry.js +1 -1
  138. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  139. package/dist/esm/salla-orders.entry.js +1 -1
  140. package/dist/esm/salla-payments.entry.js +1 -1
  141. package/dist/esm/salla-placeholder.entry.js +1 -1
  142. package/dist/esm/salla-price-range.entry.js +1 -1
  143. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  144. package/dist/esm/salla-products-list.entry.js +1 -1
  145. package/dist/esm/salla-products-slider.entry.js +1 -1
  146. package/dist/esm/salla-progress-bar.entry.js +1 -1
  147. package/dist/esm/salla-quick-order.entry.js +1 -1
  148. package/dist/esm/salla-rating-modal.entry.js +1 -1
  149. package/dist/esm/salla-scopes.entry.js +1 -1
  150. package/dist/esm/salla-search.entry.js +1 -1
  151. package/dist/esm/salla-skeleton.entry.js +1 -1
  152. package/dist/esm/salla-slider.entry.js +1 -1
  153. package/dist/esm/salla-social-share.entry.js +1 -1
  154. package/dist/esm/salla-social.entry.js +1 -1
  155. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  156. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  157. package/dist/esm/salla-tooltip.entry.js +1 -1
  158. package/dist/esm/salla-trust-badges.entry.js +1 -1
  159. package/dist/esm/salla-user-menu.entry.js +1 -1
  160. package/dist/esm/salla-user-profile.entry.js +1 -1
  161. package/dist/esm/salla-user-settings.entry.js +1 -1
  162. package/dist/esm/salla-verify.entry.js +1 -1
  163. package/dist/esm/salla-wallet.entry.js +1 -1
  164. package/dist/esm/twilight.js +2 -2
  165. package/dist/esm/{vanilla-picker-CYgHVJAF.js → vanilla-picker-CGGBRKTl.js} +1 -1
  166. package/dist/twilight/{p-f5465c7d.entry.js → p-02aa05b3.entry.js} +1 -1
  167. package/dist/twilight/{p-d3f4480c.entry.js → p-04072cae.entry.js} +1 -1
  168. package/dist/twilight/{p-b176814d.entry.js → p-06eb15e2.entry.js} +1 -1
  169. package/dist/twilight/{p-926bdbde.entry.js → p-073ee1c3.entry.js} +1 -1
  170. package/dist/twilight/p-189b3238.entry.js +4 -0
  171. package/dist/twilight/{p-940c57a3.entry.js → p-1b097cea.entry.js} +1 -1
  172. package/dist/twilight/{p-dbec33e9.entry.js → p-1cb9d96c.entry.js} +1 -1
  173. package/dist/twilight/{p-323012d3.entry.js → p-2200f944.entry.js} +1 -1
  174. package/dist/twilight/{p-ecdb3842.entry.js → p-221456be.entry.js} +1 -1
  175. package/dist/twilight/{p-99e87c67.entry.js → p-23099ba2.entry.js} +1 -1
  176. package/dist/twilight/{p-4aa4dcec.entry.js → p-242b6421.entry.js} +1 -1
  177. package/dist/twilight/{p-0da615ba.entry.js → p-249c9d98.entry.js} +1 -1
  178. package/dist/twilight/{p-f51c98c3.entry.js → p-2dfe2197.entry.js} +1 -1
  179. package/dist/twilight/{p-1e58ee3f.entry.js → p-300be242.entry.js} +1 -1
  180. package/dist/twilight/{p-d8093d37.entry.js → p-306c4986.entry.js} +1 -1
  181. package/dist/twilight/{p-a083cc65.entry.js → p-31458cbf.entry.js} +1 -1
  182. package/dist/twilight/{p-a1210656.entry.js → p-348106f0.entry.js} +1 -1
  183. package/dist/twilight/{p-f265dd49.entry.js → p-3589bed2.entry.js} +1 -1
  184. package/dist/twilight/{p-34a94492.entry.js → p-3c8e6e9f.entry.js} +1 -1
  185. package/dist/twilight/{p-a19637e3.entry.js → p-3c982608.entry.js} +1 -1
  186. package/dist/twilight/{p-ad66730c.entry.js → p-3d3b3856.entry.js} +1 -1
  187. package/dist/twilight/{p-5a936889.entry.js → p-402fc86d.entry.js} +1 -1
  188. package/dist/twilight/{p-6d7d53fa.entry.js → p-48c94220.entry.js} +1 -1
  189. package/dist/twilight/{p-2110682a.entry.js → p-49b7c969.entry.js} +1 -1
  190. package/dist/twilight/{p-ef9c28da.entry.js → p-4a4c1969.entry.js} +1 -1
  191. package/dist/twilight/{p-876ed9cf.entry.js → p-4c007dc0.entry.js} +1 -1
  192. package/dist/twilight/{p-1706c904.entry.js → p-4da987fc.entry.js} +1 -1
  193. package/dist/twilight/{p-969f4a67.entry.js → p-4fc10acd.entry.js} +1 -1
  194. package/dist/twilight/{p-224c2f65.entry.js → p-507fac68.entry.js} +1 -1
  195. package/dist/twilight/{p-c5a13ec9.entry.js → p-540297d6.entry.js} +1 -1
  196. package/dist/twilight/{p-e50916c1.entry.js → p-5638111c.entry.js} +1 -1
  197. package/dist/twilight/{p-31b1f09e.entry.js → p-59758658.entry.js} +1 -1
  198. package/dist/twilight/{p-1b4cb4f3.entry.js → p-5f52e482.entry.js} +1 -1
  199. package/dist/twilight/{p-05911caf.entry.js → p-6257e0cd.entry.js} +1 -1
  200. package/dist/twilight/{p-c944064d.entry.js → p-694aa670.entry.js} +1 -1
  201. package/dist/twilight/{p-7d932e81.entry.js → p-6ca09b34.entry.js} +1 -1
  202. package/dist/twilight/{p-aeaa9d52.entry.js → p-7020a339.entry.js} +1 -1
  203. package/dist/twilight/{p-595983cf.entry.js → p-73113e85.entry.js} +1 -1
  204. package/dist/twilight/{p-462c51a2.entry.js → p-7a87c0a9.entry.js} +1 -1
  205. package/dist/twilight/{p-3d1043b6.entry.js → p-7c8fe050.entry.js} +1 -1
  206. package/dist/twilight/{p-9770a33e.entry.js → p-8043f8ea.entry.js} +1 -1
  207. package/dist/twilight/{p-34ab1e5c.entry.js → p-8bd3ba9e.entry.js} +1 -1
  208. package/dist/twilight/{p-decce284.entry.js → p-93623f07.entry.js} +1 -1
  209. package/dist/twilight/{p-7a886993.entry.js → p-9f3f2ac3.entry.js} +1 -1
  210. package/dist/twilight/{p-Cp5Iu5XS.js → p-B1ZkITMY.js} +1 -1
  211. package/dist/twilight/{p-CWQNB-G4.js → p-BXOq5BwG.js} +1 -1
  212. package/dist/twilight/{p-jBYzSajd.js → p-BlMSs0A2.js} +1 -1
  213. package/dist/twilight/{p-Dbv0I4re.js → p-CvIpy7Cj.js} +1 -1
  214. package/dist/twilight/{p-Ct4jcDIY.js → p-D26J1_uI.js} +1 -1
  215. package/dist/twilight/{p-njEAbf-H.js → p-DWxyBEuT.js} +1 -1
  216. package/dist/twilight/{p-Dlb0Gd5v.js → p-NiLajaRX.js} +1 -1
  217. package/dist/twilight/{p-DjEHkwKr.js → p-VRwnn1Qc.js} +1 -1
  218. package/dist/twilight/{p-543bc44f.entry.js → p-a248f209.entry.js} +1 -1
  219. package/dist/twilight/{p-b951691e.entry.js → p-a2c5e7bc.entry.js} +1 -1
  220. package/dist/twilight/{p-08702001.entry.js → p-a41f0590.entry.js} +1 -1
  221. package/dist/twilight/{p-74a9e4dd.entry.js → p-a97f10a1.entry.js} +1 -1
  222. package/dist/twilight/{p-1881e1df.entry.js → p-aa5bf3b5.entry.js} +1 -1
  223. package/dist/twilight/{p-fdc30e0c.entry.js → p-b1e8296d.entry.js} +1 -1
  224. package/dist/twilight/{p-8a8cc10a.entry.js → p-b2537237.entry.js} +1 -1
  225. package/dist/twilight/{p-1ab7646d.entry.js → p-b4f431bf.entry.js} +1 -1
  226. package/dist/twilight/{p-258e8407.entry.js → p-bc65bb02.entry.js} +1 -1
  227. package/dist/twilight/{p-8b19cac5.entry.js → p-be1c54e6.entry.js} +1 -1
  228. package/dist/twilight/{p-4bc9bc63.entry.js → p-c43be30b.entry.js} +1 -1
  229. package/dist/twilight/{p-e2d073fb.entry.js → p-ce560f66.entry.js} +1 -1
  230. package/dist/twilight/{p-08d98540.entry.js → p-d00fc4bf.entry.js} +1 -1
  231. package/dist/twilight/{p-cdd125b8.entry.js → p-d07f5e44.entry.js} +1 -1
  232. package/dist/twilight/{p-f5bf4c88.entry.js → p-d215b7d2.entry.js} +1 -1
  233. package/dist/twilight/{p-416b578d.entry.js → p-d4b83f2a.entry.js} +1 -1
  234. package/dist/twilight/{p-814a00c6.entry.js → p-da155135.entry.js} +1 -1
  235. package/dist/twilight/{p-9722f5ed.entry.js → p-e0b13c19.entry.js} +1 -1
  236. package/dist/twilight/{p-0c31270e.entry.js → p-e3b4a179.entry.js} +1 -1
  237. package/dist/twilight/{p-2d089b2b.entry.js → p-e46cb169.entry.js} +1 -1
  238. package/dist/twilight/{p-c27bfa01.entry.js → p-e79ad638.entry.js} +1 -1
  239. package/dist/twilight/{p-58d796a0.entry.js → p-e9be8c03.entry.js} +1 -1
  240. package/dist/twilight/{p-8465d71e.entry.js → p-ed08f5e5.entry.js} +1 -1
  241. package/dist/twilight/{p-07cdbd6f.entry.js → p-f7f592ab.entry.js} +1 -1
  242. package/dist/twilight/{p-a28f7329.entry.js → p-f81195ae.entry.js} +1 -1
  243. package/dist/twilight/{p-CQc5Pmlu.js → p-uADDAGsE.js} +1 -1
  244. package/dist/twilight/{p-DL3ab5Vo.js → p-wnPgaQoR.js} +1 -1
  245. package/dist/twilight/twilight.esm.js +1 -1
  246. package/dist/types/components/salla-comments/salla-comments.d.ts +2 -0
  247. package/package.json +5 -5
  248. package/dist/twilight/p-8e120858.entry.js +0 -4
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,c as e,h as s,H as i}from"./p-Dbv0I4re.js";import{a}from"./p-BedNk7k1.js";const l=class{constructor(s){t(this,s),this.changed=e(this,"changed"),this.min=0,this.max=1e4,this.moreThanLabel="أكثر من",this.lessThanLabel="أقل من",this.toLabel="الى",this.fromLabel="من",this.typing=!1,this.isMin=!1,this.isRTL=salla.config.get("theme.is_rtl",!0),this.filterValues=[]}connectedCallback(){if(this.filtersData&&this.filtersData?.price&&(this.minPrice=this.filtersData.price.min,this.maxPrice=this.filtersData.price.max),salla.lang.onLoaded((()=>{this.moreThanLabel=salla.lang.getWithDefault("common.elements.more_than",this.moreThanLabel),this.lessThanLabel=salla.lang.getWithDefault("common.elements.less_than",this.lessThanLabel),this.toLabel=salla.lang.getWithDefault("common.elements.to",this.toLabel),this.fromLabel=salla.lang.getWithDefault("common.elements.from",this.fromLabel)})),1==this.option.values.length)return;if(this.option.values.length<=5)return void(this.filterValues=this.option.values);const t=Math.ceil(this.option.values.length/5);for(let e=0;e<this.option.values.length;e+=t)this.filterValues.push(this.option.values.slice(e,e+t).reduce(((t,e)=>(t.to=e.to,t.count+=e.count,t))))}async reset(){this.minInput.value=null,this.maxInput.value=null,this.minPrice=null,this.maxPrice=null}getPriceLabel(t){return isNaN(t.from)||t.from<1?`${this.lessThanLabel} ${salla.money(t.to)}`:isNaN(t.to)||t.to<1?`${this.moreThanLabel} ${salla.money(t.from)}`:`${salla.money(t.from)} ${this.toLabel} ${salla.money(t.to)}`}minInputValidation(t){t&&(t>this.max||this.maxPrice&&t>this.maxPrice)||(t<this.min?this.minPrice=this.min:t&&(this.minPrice=t))}maxInputValidation(t){t&&(t<this.min||this.minPrice&&t<this.minPrice)||t>this.max&&(this.maxPrice=this.max)}async changedEventHandler(t){salla.helpers.inputDigitsOnly(this.minInput),salla.helpers.inputDigitsOnly(this.maxInput);const e=this.minPrice?1*+this.minPrice:null,s=this.maxPrice?1*+this.maxPrice:null;this.maxPrice||(this.maxPrice=""),this.isMin?this.minInputValidation(e):(this.minPrice||(this.minPrice=0),this.maxInputValidation(s)),this.isReady&&this.changed.emit({event:t,option:this.option,value:{max:this.maxPrice,min:this.minPrice}})}handleMinMaxPrice(t,e){this.minPrice=e.from,this.maxPrice="*"!==e.to?e.to:"",this.changedEventHandler(t)}isChecked(t){return!(!this.minPrice&&!this.maxPrice)&&(((t.from<1||"*"==t.from)&&0==this.minPrice||t.from==this.minPrice)&&("*"==t.to||!t.to||t.to==this.maxPrice))}handleMinPrice(t){this.isMin=!0;const e=t.target.value;this.minPrice=""===e?0:e}handleMaxPrice(t){this.isMin=!1;const e=t.target.value;this.maxPrice=void 0===e?"":e}render(){return s(i,{key:"01971028ddbcb6dd89aec0e1552f4c724c32e76f"},this.filterValues.map(((t,e)=>s("label",{class:"s-filters-label",htmlFor:`${this.option.key}-${e}`,key:e},s("input",{id:`${this.option.key}-${e}`,name:"price",type:"radio",checked:this.isChecked(t),class:"s-filters-radio",onChange:e=>this.handleMinMaxPrice(e,t)}),s("span",{innerHTML:this.getPriceLabel(t)})))),s("div",{key:"0961c02c062e2cad89f35fd51cdcbb379965f31c",class:"flex justify-center items-center"},s("div",{key:"f503bbb2b490dc6908b06c5f1353a6577466cd66",class:"relative max-w-xl w-full"},s("div",{key:"6149d29228345ecd88d2c3e1c4622fd91dba52a2",class:"s-price-range-inputs"},s("div",{key:"8e45f9e8728de535671809d6b71fda57a8c9f763",class:"s-price-range-relative"},s("div",{key:"8cf8df2c549ab8f9bf6bc3fcb89a4155c8acfe0c",class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{key:"c79d97935d8675ba44e38c28d72513cb4ba4f614",type:"number",maxlength:"5",ref:t=>this.minInput=t,onBlur:t=>this.handleMinPrice(t),value:this.minPrice,placeholder:this.fromLabel,class:"s-price-range-number-input"})),s("div",{key:"c2826af5c0d8073d5278dac67f40412e562d6a80",class:"s-price-range-gray-text"}," -"),s("div",{key:"3a1c1641ee465c673dd4914cf4d19acd2d7f6911",class:"s-price-range-relative"},s("div",{key:"2efecf246fb31f52a792e19f3af42da55f5f5407",class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{key:"85dea69e3ae374aff1a6d7f1764346475a8688c8",type:"number",maxlength:"5",ref:t=>this.maxInput=t,onBlur:t=>this.handleMaxPrice(t),value:this.maxPrice,placeholder:this.toLabel,class:"s-price-range-number-input","aria-describedby":"price-currency"})),s("salla-button",{key:"59722b42d4cd5eef95360b95093772cdd59aed6c",color:"gray",shape:"icon",size:"small",fill:"outline",onClick:t=>this.changedEventHandler(t)},s("span",{key:"2142e831cb931574a63bb4f6ba12787677fecb1f",innerHTML:this.isRTL?a:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>arrow-right</title>\n<path d="M29.217 15.465c-0.019-0.044-0.056-0.077-0.080-0.119-0.067-0.116-0.139-0.227-0.236-0.317-0.011-0.009-0.013-0.024-0.024-0.033l-10.667-9.333c-0.553-0.484-1.396-0.429-1.881 0.125-0.484 0.555-0.428 1.396 0.127 1.881l7.996 6.997h-20.452c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h20.452l-7.996 6.997c-0.555 0.485-0.611 1.327-0.127 1.881 0.264 0.3 0.633 0.455 1.004 0.455 0.312 0 0.625-0.109 0.877-0.331l10.667-9.333c0.011-0.009 0.015-0.024 0.024-0.033 0.097-0.091 0.169-0.201 0.236-0.317 0.024-0.041 0.060-0.075 0.080-0.119 0.073-0.163 0.116-0.343 0.116-0.533s-0.043-0.371-0.116-0.535z"></path>\n</svg>\n'}))))))}componentDidLoad(){this.isReady=!0}};l.style=":host{display:block}.rtl .rtl-range-slider,[dir=rtl] .rtl-range-slider{transform:rotateY(180deg)}.rtl .rtl-range-numbers,[dir=rtl] .rtl-range-numbers{flex-direction:row-reverse}.rtl .form-select,.rtl select,[dir=rtl] .form-select,[dir=rtl] select{background-position:left 0.5rem center;padding-right:12px}.rtl .menu-divide li:not(:last-child):after,[dir=rtl] .menu-divide li:not(:last-child):after{left:0;right:auto}input[type=range]::-webkit-slider-thumb{pointer-events:all;width:24px;height:24px;-webkit-appearance:none}[type=checkbox]:checked{background-size:80%}";export{l as salla_price_range}
4
+ import{r as t,c as e,h as s,H as i}from"./p-CvIpy7Cj.js";import{a}from"./p-BedNk7k1.js";const l=class{constructor(s){t(this,s),this.changed=e(this,"changed"),this.min=0,this.max=1e4,this.moreThanLabel="أكثر من",this.lessThanLabel="أقل من",this.toLabel="الى",this.fromLabel="من",this.typing=!1,this.isMin=!1,this.isRTL=salla.config.get("theme.is_rtl",!0),this.filterValues=[]}connectedCallback(){if(this.filtersData&&this.filtersData?.price&&(this.minPrice=this.filtersData.price.min,this.maxPrice=this.filtersData.price.max),salla.lang.onLoaded((()=>{this.moreThanLabel=salla.lang.getWithDefault("common.elements.more_than",this.moreThanLabel),this.lessThanLabel=salla.lang.getWithDefault("common.elements.less_than",this.lessThanLabel),this.toLabel=salla.lang.getWithDefault("common.elements.to",this.toLabel),this.fromLabel=salla.lang.getWithDefault("common.elements.from",this.fromLabel)})),1==this.option.values.length)return;if(this.option.values.length<=5)return void(this.filterValues=this.option.values);const t=Math.ceil(this.option.values.length/5);for(let e=0;e<this.option.values.length;e+=t)this.filterValues.push(this.option.values.slice(e,e+t).reduce(((t,e)=>(t.to=e.to,t.count+=e.count,t))))}async reset(){this.minInput.value=null,this.maxInput.value=null,this.minPrice=null,this.maxPrice=null}getPriceLabel(t){return isNaN(t.from)||t.from<1?`${this.lessThanLabel} ${salla.money(t.to)}`:isNaN(t.to)||t.to<1?`${this.moreThanLabel} ${salla.money(t.from)}`:`${salla.money(t.from)} ${this.toLabel} ${salla.money(t.to)}`}minInputValidation(t){t&&(t>this.max||this.maxPrice&&t>this.maxPrice)||(t<this.min?this.minPrice=this.min:t&&(this.minPrice=t))}maxInputValidation(t){t&&(t<this.min||this.minPrice&&t<this.minPrice)||t>this.max&&(this.maxPrice=this.max)}async changedEventHandler(t){salla.helpers.inputDigitsOnly(this.minInput),salla.helpers.inputDigitsOnly(this.maxInput);const e=this.minPrice?1*+this.minPrice:null,s=this.maxPrice?1*+this.maxPrice:null;this.maxPrice||(this.maxPrice=""),this.isMin?this.minInputValidation(e):(this.minPrice||(this.minPrice=0),this.maxInputValidation(s)),this.isReady&&this.changed.emit({event:t,option:this.option,value:{max:this.maxPrice,min:this.minPrice}})}handleMinMaxPrice(t,e){this.minPrice=e.from,this.maxPrice="*"!==e.to?e.to:"",this.changedEventHandler(t)}isChecked(t){return!(!this.minPrice&&!this.maxPrice)&&(((t.from<1||"*"==t.from)&&0==this.minPrice||t.from==this.minPrice)&&("*"==t.to||!t.to||t.to==this.maxPrice))}handleMinPrice(t){this.isMin=!0;const e=t.target.value;this.minPrice=""===e?0:e}handleMaxPrice(t){this.isMin=!1;const e=t.target.value;this.maxPrice=void 0===e?"":e}render(){return s(i,{key:"01971028ddbcb6dd89aec0e1552f4c724c32e76f"},this.filterValues.map(((t,e)=>s("label",{class:"s-filters-label",htmlFor:`${this.option.key}-${e}`,key:e},s("input",{id:`${this.option.key}-${e}`,name:"price",type:"radio",checked:this.isChecked(t),class:"s-filters-radio",onChange:e=>this.handleMinMaxPrice(e,t)}),s("span",{innerHTML:this.getPriceLabel(t)})))),s("div",{key:"0961c02c062e2cad89f35fd51cdcbb379965f31c",class:"flex justify-center items-center"},s("div",{key:"f503bbb2b490dc6908b06c5f1353a6577466cd66",class:"relative max-w-xl w-full"},s("div",{key:"6149d29228345ecd88d2c3e1c4622fd91dba52a2",class:"s-price-range-inputs"},s("div",{key:"8e45f9e8728de535671809d6b71fda57a8c9f763",class:"s-price-range-relative"},s("div",{key:"8cf8df2c549ab8f9bf6bc3fcb89a4155c8acfe0c",class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{key:"c79d97935d8675ba44e38c28d72513cb4ba4f614",type:"number",maxlength:"5",ref:t=>this.minInput=t,onBlur:t=>this.handleMinPrice(t),value:this.minPrice,placeholder:this.fromLabel,class:"s-price-range-number-input"})),s("div",{key:"c2826af5c0d8073d5278dac67f40412e562d6a80",class:"s-price-range-gray-text"}," -"),s("div",{key:"3a1c1641ee465c673dd4914cf4d19acd2d7f6911",class:"s-price-range-relative"},s("div",{key:"2efecf246fb31f52a792e19f3af42da55f5f5407",class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{key:"85dea69e3ae374aff1a6d7f1764346475a8688c8",type:"number",maxlength:"5",ref:t=>this.maxInput=t,onBlur:t=>this.handleMaxPrice(t),value:this.maxPrice,placeholder:this.toLabel,class:"s-price-range-number-input","aria-describedby":"price-currency"})),s("salla-button",{key:"59722b42d4cd5eef95360b95093772cdd59aed6c",color:"gray",shape:"icon",size:"small",fill:"outline",onClick:t=>this.changedEventHandler(t)},s("span",{key:"2142e831cb931574a63bb4f6ba12787677fecb1f",innerHTML:this.isRTL?a:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>arrow-right</title>\n<path d="M29.217 15.465c-0.019-0.044-0.056-0.077-0.080-0.119-0.067-0.116-0.139-0.227-0.236-0.317-0.011-0.009-0.013-0.024-0.024-0.033l-10.667-9.333c-0.553-0.484-1.396-0.429-1.881 0.125-0.484 0.555-0.428 1.396 0.127 1.881l7.996 6.997h-20.452c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h20.452l-7.996 6.997c-0.555 0.485-0.611 1.327-0.127 1.881 0.264 0.3 0.633 0.455 1.004 0.455 0.312 0 0.625-0.109 0.877-0.331l10.667-9.333c0.011-0.009 0.015-0.024 0.024-0.033 0.097-0.091 0.169-0.201 0.236-0.317 0.024-0.041 0.060-0.075 0.080-0.119 0.073-0.163 0.116-0.343 0.116-0.533s-0.043-0.371-0.116-0.535z"></path>\n</svg>\n'}))))))}componentDidLoad(){this.isReady=!0}};l.style=":host{display:block}.rtl .rtl-range-slider,[dir=rtl] .rtl-range-slider{transform:rotateY(180deg)}.rtl .rtl-range-numbers,[dir=rtl] .rtl-range-numbers{flex-direction:row-reverse}.rtl .form-select,.rtl select,[dir=rtl] .form-select,[dir=rtl] select{background-position:left 0.5rem center;padding-right:12px}.rtl .menu-divide li:not(:last-child):after,[dir=rtl] .menu-divide li:not(:last-child):after{left:0;right:auto}input[type=range]::-webkit-slider-thumb{pointer-events:all;width:24px;height:24px;-webkit-appearance:none}[type=checkbox]:checked{background-size:80%}";export{l as salla_price_range}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as t,H as r}from"./p-Dbv0I4re.js";var s;!function(e){e.PERCENTAGE="percentage",e.FIXED="fixed"}(s||(s={}));const i={staticIcons:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M13.7276 3.44418L15.4874 6.99288C15.7274 7.48687 16.3673 7.9607 16.9073 8.05143L20.0969 8.58575C22.1367 8.92853 22.6167 10.4206 21.1468 11.8925L18.6671 14.3927C18.2471 14.8161 18.0172 15.6327 18.1471 16.2175L18.8571 19.3125C19.417 21.7623 18.1271 22.71 15.9774 21.4296L12.9877 19.6452C12.4478 19.3226 11.5579 19.3226 11.0079 19.6452L8.01827 21.4296C5.8785 22.71 4.57865 21.7522 5.13859 19.3125L5.84851 16.2175C5.97849 15.6327 5.74852 14.8161 5.32856 14.3927L2.84884 11.8925C1.389 10.4206 1.85895 8.92853 3.89872 8.58575L7.08837 8.05143C7.61831 7.9607 8.25824 7.48687 8.49821 6.99288L10.258 3.44418C11.2179 1.51861 12.7777 1.51861 13.7276 3.44418Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M3 12C7.5 12 12 7.5 12 3C12 7.5 16.5 12 21 12C16.5 12 12 16.5 12 21C12 16.5 7.5 12 3 12Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M2 19.5C2.83333 19.5 4.5 17.8333 4.5 17C4.5 17.8333 6.16667 19.5 7 19.5C6.16667 19.5 4.5 21.1667 4.5 22C4.5 21.1667 2.83333 19.5 2 19.5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M16 5C17 5 19 3 19 2C19 3 21 5 22 5C21 5 19 7 19 8C19 7 17 5 16 5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M14.2644 18.3717C14.5806 17.407 14.7387 16.9247 15.0616 16.593C15.215 16.4354 15.3932 16.3048 15.5887 16.2066C16.0003 16 16.5003 16 17.5002 16C18.5001 16 19.0001 16 19.4116 16.2066C19.6072 16.3048 19.7853 16.4354 19.9388 16.593C20.2617 16.9247 20.4198 17.407 20.736 18.3717L21.0624 19.3675C21.4561 20.5688 21.653 21.1694 21.3587 21.5847C21.0643 22 20.4418 22 19.1966 22H15.8038C14.5586 22 13.936 22 13.6417 21.5847C13.3473 21.1694 13.5442 20.5688 13.938 19.3675L14.2644 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M8.76421 10.3717C9.08041 9.40705 9.23851 8.92471 9.56143 8.59298C9.71485 8.43537 9.89299 8.3048 10.0885 8.20663C10.5001 8 11.0001 8 12 8C12.9999 8 13.4999 8 13.9115 8.20663C14.107 8.3048 14.2851 8.43537 14.4386 8.59298C14.7615 8.92471 14.9196 9.40705 15.2358 10.3717L15.5622 11.3675C15.956 12.5688 16.1528 13.1694 15.8585 13.5847C15.5642 14 14.9416 14 13.6964 14H10.3036C9.05842 14 8.43585 14 8.1415 13.5847C7.84716 13.1694 8.04404 12.5688 8.43779 11.3675L8.76421 10.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M3.26439 18.3717C3.58059 17.407 3.73869 16.9247 4.06162 16.593C4.21504 16.4354 4.39317 16.3048 4.58872 16.2066C5.00031 16 5.50027 16 6.50018 16C7.5001 16 8.00006 16 8.41165 16.2066C8.6072 16.3048 8.78533 16.4354 8.93875 16.593C9.26167 16.9247 9.41977 17.407 9.73597 18.3717L10.0624 19.3675C10.4561 20.5688 10.653 21.1694 10.3587 21.5847C10.0643 22 9.44176 22 8.19661 22H4.80375C3.5586 22 2.93603 22 2.64169 21.5847C2.34735 21.1694 2.54422 20.5688 2.93797 19.3675L3.26439 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M12 2V4M7.5 3.5L9 5M16.5 3.5L15 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M5.78223 4.18192C6.43007 3.68319 6.754 3.43383 7.12788 3.27323C7.29741 3.20041 7.47367 3.14158 7.65459 3.09741C8.0536 3 8.4767 3 9.32289 3H14.6771C15.5233 3 15.9464 3 16.3454 3.09741C16.5263 3.14158 16.7026 3.20041 16.8721 3.27323C17.246 3.43383 17.5699 3.68319 18.2178 4.18192C20.3644 5.83448 21.4378 6.66077 21.8057 7.73078C21.9694 8.20673 22.0305 8.70728 21.9858 9.20461C21.8852 10.3227 21.0379 11.346 19.3433 13.3925L15.3498 18.2153C13.8126 20.0718 13.044 21 12 21C10.956 21 10.1874 20.0718 8.65018 18.2153L4.65671 13.3925C2.96208 11.346 2.11476 10.3227 2.0142 9.20461C1.96947 8.70728 2.03064 8.20673 2.1943 7.73078C2.56224 6.66077 3.63557 5.83448 5.78223 4.18192Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M10 8.5H14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>'],staticColors:["#993018","#444444","#D18F36","#315F9C"]};class o{static findTierByIndex(e,t){return e.find((e=>e.index===t))||null}static findTierByName(e,t){return e.find((e=>e.tier_name===t))||null}static getTierNameByIndex(e,t){return this.findTierByIndex(e,t)?.tier_name}static findCurrentTierIndex(e,t){if(!t)return 0;for(let r=t.length-1;r>=0;r--)if(e>=t[r].threshold)return t[r].index;return 0}}const n=class{constructor(t){e(this,t),this.currentTierIndex=0,this.canRender=!1,this.isLoading=!1,this.handleTabClick=e=>{this.activeTabTier=e},salla.lang.onLoaded((()=>{this.loyaltyProgramText=salla.lang.get("blocks.tiered_offer.program_title"),this.currentTierText=salla.lang.get("blocks.tiered_offer.current_tier"),this.discountText=salla.lang.get("blocks.tiered_offer.discount"),this.benefitText=salla.lang.get("blocks.tiered_offer.tier_description")}))}async componentWillLoad(){try{if(await salla.onReady(),!this.checkFeatureEnabled())return;if(!this.checkCartExists())return;this.isLoading=!0;const e=await this.fetchTieredOfferData();if(!e)return;this.initializeComponent(e)}catch(e){this.canRender=!1,salla.logger.warn("salla-tiered-offer:: ",e)}finally{this.isLoading=!1}}checkFeatureEnabled(){return salla.config.get("store.features")?.includes("tiered-offer")}checkCartExists(){return!!salla.storage.get("cart")?.summary?.count}validateCouponCompatibility(e,t){return!(t&&!e.details?.applied_with_coupon)}async fetchTieredOfferData(){try{const{data:e}=await salla.api.cart.offers(),t=e.find((e=>"tiered_offer"===e.type));return t?this.validateCouponCompatibility(t,salla.storage.get("cart")?.coupon)?t:(this.canRender=!1,null):null}catch(e){throw e}}initializeComponent(e){this.apiOfferData=e,this.tieredOfferData=this.mapApiDataToTiers(this.apiOfferData),this.loyaltyProgramText=this.apiOfferData.title||this.loyaltyProgramText;const t=this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0);0!==t?(this.currentTierIndex=t,this.currentTier=o.getTierNameByIndex(this.tieredOfferData.tiers,t),this.activeTabTier=this.currentTier,this.canRender=!0):this.canRender=!1}componentDidLoad(){salla.event.on("cart::updated",(async e=>{const t=await this.fetchTieredOfferData();t&&this.updateOfferValues(e,t)}))}mapApiDataToTiers(e){const t=[...e.details.discounts].sort(((e,t)=>e.min_spend-t.min_spend)).map(((e,t)=>({name:e.name,tier_name:e.name,discount:e.type===s.PERCENTAGE?`${salla.helpers.number(e.value)}%`:salla.money(e.value),icon:i.staticIcons[t]||i.staticIcons[0],threshold:e.min_spend,text_color:i.staticColors[t],index:t+1})));return{current_tier:o.getTierNameByIndex(t,this.findCurrentTierIndex(e.details.current_value,t)),tiers:t}}findCurrentTierIndex(e,t=this.tieredOfferData?.tiers){return o.findCurrentTierIndex(e,t||[])}updateOfferValues(e,t){if(!t||!this.tieredOfferData)return;if(!this.validateCouponCompatibility(t,e.coupon))return void(this.canRender=!1);if(this.canRender=!0,!1===t.details?.with_current_cart)return;const r=t.details?.current_value||0;this.apiOfferData=t;const s=this.findCurrentTierIndex(r);0!==s?(this.canRender=!0,this.currentTierIndex=s,this.currentTier=o.getTierNameByIndex(this.tieredOfferData.tiers,s),this.activeTabTier!==this.currentTier&&(this.activeTabTier=this.currentTier)):this.canRender=!1}getLoadingSkeletonView(){return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-skeleton-wrapper"},t("div",{class:"s-tiered-offer-skeleton-title"},t("salla-skeleton",{height:"16px",width:"40%"})),t("div",{class:"s-tiered-offer-skeleton-subtitle"},t("salla-skeleton",{height:"20px",width:"60%"})),t("div",{class:"s-tiered-offer-skeleton-progress"},t("salla-skeleton",{height:"16px",width:"100%"})),t("div",{class:"s-tiered-offer-skeleton-tabs"},t("salla-skeleton",{height:"50px",width:"100%"})))))}getCurrentTierData(){return o.findTierByIndex(this.tieredOfferData.tiers,this.currentTierIndex)||this.tieredOfferData.tiers[0]}getProgressWidth(){const e=this.tieredOfferData.tiers.length;return this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0)/e*100}calculateMilestonePosition(e,t){return 1===t?"calc(100% - 18px)":`${Math.max(2,Math.min(95,(e+1)/t*100-8/t))}%`}getMilestoneStyles(e,t,r){const s="rtl"===document.documentElement.dir,i=this.calculateMilestonePosition(t,r),o=e.name.length>6?"flex-end":"center";return{[s?"right":"left"]:i,alignItems:o,position:"absolute",transform:s?"translateX(50%)":"translateX(-50%)"}}getMilestoneIconStyles(e,t,r){return t?{color:e.text_color}:r?{color:"var(--color-primary)"}:{}}renderProgressBarBackground(e){return[t("div",{class:"s-tiered-offer-progress-bg"}),t("div",{class:"s-tiered-offer-progress-fill",style:{width:`${e}%`}})]}renderMilestoneIcon(e,r,s){const i=["s-tiered-offer-milestone-icon",r?"s-tiered-offer-milestone-active":"",s?"s-tiered-offer-milestone-completed":""].filter(Boolean).join(" ");return t("div",{class:i,style:this.getMilestoneIconStyles(e,r,s)},t("span",{innerHTML:e.icon}))}renderMilestoneName(e,r){return t("div",{class:"s-tiered-offer-milestone-name"},r&&t("span",{style:{color:e.text_color}},e.name))}renderMilestones(e,r){return t("div",{class:"s-tiered-offer-milestones-wrapper"},t("div",{class:1===r?"s-tiered-offer-single-milestone-justify-end":"s-tiered-offer-milestones"},this.tieredOfferData.tiers.map(((s,i)=>{const o=e>=s.threshold,n=s.tier_name===this.currentTier;return t("div",{class:"s-tiered-offer-milestone",style:this.getMilestoneStyles(s,i,r)},this.renderMilestoneIcon(s,n,o),this.renderMilestoneName(s,n))}))))}renderProgressBar(){const e=this.getProgressWidth(),r=this.tieredOfferData.tiers.length,s=this.apiOfferData.details?.current_value||0;return t("div",{class:"s-tiered-offer-progress-container"},t("div",{class:"s-tiered-offer-progress-wrapper"},this.renderProgressBarBackground(e),this.renderMilestones(s,r)))}renderTabs(){return t("div",{class:"s-tiered-offer-tabs-container"},t("div",{class:"s-tiered-offer-tab-headers"},this.tieredOfferData.tiers.map((e=>t("button",{class:"s-tiered-offer-tab-header "+(e.tier_name===this.activeTabTier?"s-tiered-offer-tab-active":""),onClick:()=>this.handleTabClick(e.tier_name)},t("span",null,e.name))))),t("div",{class:"s-tiered-offer-tab-content-wrapper"},(()=>{const e=o.findTierByName(this.tieredOfferData.tiers,this.activeTabTier);return e?t("div",{class:"s-tiered-offer-tab-content"},t("div",{class:"s-tiered-offer-tab-content-inner"},t("div",{class:"s-tiered-offer-discount-section"},t("p",{class:"s-tiered-offer-discount-title"},this.discountText," ",t("span",{innerHTML:e.discount})),t("p",{class:"s-tiered-offer-benefit-description"},this.benefitText," ",e.name)))):null})()))}render(){if(this.isLoading)return this.getLoadingSkeletonView();if(!this.canRender||!this.tieredOfferData)return null;const e=this.getCurrentTierData();return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-header"},t("div",{class:"s-tiered-offer-header-content"},t("p",{class:"s-tiered-offer-program-title"},this.loyaltyProgramText),t("div",{class:"s-tiered-offer-current-tier-name-wrapper"},t("h2",{class:"s-tiered-offer-current-tier"},this.currentTierText," ",t("span",{class:"s-tiered-offer-tier-name"},e.name)),t("span",{innerHTML:e.icon})))),this.renderProgressBar(),this.renderTabs()))}};n.style=".s-tiered-offer-milestone-icon svg{color:currentColor}.s-tiered-offer-milestone-icon svg path{stroke:currentColor;fill:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg path{fill:currentColor;stroke:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg[fill=none] path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg[fill=none] path{fill:none;stroke:currentColor}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-bg{transform:scaleX(-1)}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-fill{transform:scaleX(-1);left:auto}[dir=rtl] .flip-x{transform:scaleX(-1)}";export{n as salla_tiered_offer}
4
+ import{r as e,h as t,H as r}from"./p-CvIpy7Cj.js";var s;!function(e){e.PERCENTAGE="percentage",e.FIXED="fixed"}(s||(s={}));const i={staticIcons:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M13.7276 3.44418L15.4874 6.99288C15.7274 7.48687 16.3673 7.9607 16.9073 8.05143L20.0969 8.58575C22.1367 8.92853 22.6167 10.4206 21.1468 11.8925L18.6671 14.3927C18.2471 14.8161 18.0172 15.6327 18.1471 16.2175L18.8571 19.3125C19.417 21.7623 18.1271 22.71 15.9774 21.4296L12.9877 19.6452C12.4478 19.3226 11.5579 19.3226 11.0079 19.6452L8.01827 21.4296C5.8785 22.71 4.57865 21.7522 5.13859 19.3125L5.84851 16.2175C5.97849 15.6327 5.74852 14.8161 5.32856 14.3927L2.84884 11.8925C1.389 10.4206 1.85895 8.92853 3.89872 8.58575L7.08837 8.05143C7.61831 7.9607 8.25824 7.48687 8.49821 6.99288L10.258 3.44418C11.2179 1.51861 12.7777 1.51861 13.7276 3.44418Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M3 12C7.5 12 12 7.5 12 3C12 7.5 16.5 12 21 12C16.5 12 12 16.5 12 21C12 16.5 7.5 12 3 12Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M2 19.5C2.83333 19.5 4.5 17.8333 4.5 17C4.5 17.8333 6.16667 19.5 7 19.5C6.16667 19.5 4.5 21.1667 4.5 22C4.5 21.1667 2.83333 19.5 2 19.5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M16 5C17 5 19 3 19 2C19 3 21 5 22 5C21 5 19 7 19 8C19 7 17 5 16 5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M14.2644 18.3717C14.5806 17.407 14.7387 16.9247 15.0616 16.593C15.215 16.4354 15.3932 16.3048 15.5887 16.2066C16.0003 16 16.5003 16 17.5002 16C18.5001 16 19.0001 16 19.4116 16.2066C19.6072 16.3048 19.7853 16.4354 19.9388 16.593C20.2617 16.9247 20.4198 17.407 20.736 18.3717L21.0624 19.3675C21.4561 20.5688 21.653 21.1694 21.3587 21.5847C21.0643 22 20.4418 22 19.1966 22H15.8038C14.5586 22 13.936 22 13.6417 21.5847C13.3473 21.1694 13.5442 20.5688 13.938 19.3675L14.2644 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M8.76421 10.3717C9.08041 9.40705 9.23851 8.92471 9.56143 8.59298C9.71485 8.43537 9.89299 8.3048 10.0885 8.20663C10.5001 8 11.0001 8 12 8C12.9999 8 13.4999 8 13.9115 8.20663C14.107 8.3048 14.2851 8.43537 14.4386 8.59298C14.7615 8.92471 14.9196 9.40705 15.2358 10.3717L15.5622 11.3675C15.956 12.5688 16.1528 13.1694 15.8585 13.5847C15.5642 14 14.9416 14 13.6964 14H10.3036C9.05842 14 8.43585 14 8.1415 13.5847C7.84716 13.1694 8.04404 12.5688 8.43779 11.3675L8.76421 10.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M3.26439 18.3717C3.58059 17.407 3.73869 16.9247 4.06162 16.593C4.21504 16.4354 4.39317 16.3048 4.58872 16.2066C5.00031 16 5.50027 16 6.50018 16C7.5001 16 8.00006 16 8.41165 16.2066C8.6072 16.3048 8.78533 16.4354 8.93875 16.593C9.26167 16.9247 9.41977 17.407 9.73597 18.3717L10.0624 19.3675C10.4561 20.5688 10.653 21.1694 10.3587 21.5847C10.0643 22 9.44176 22 8.19661 22H4.80375C3.5586 22 2.93603 22 2.64169 21.5847C2.34735 21.1694 2.54422 20.5688 2.93797 19.3675L3.26439 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M12 2V4M7.5 3.5L9 5M16.5 3.5L15 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M5.78223 4.18192C6.43007 3.68319 6.754 3.43383 7.12788 3.27323C7.29741 3.20041 7.47367 3.14158 7.65459 3.09741C8.0536 3 8.4767 3 9.32289 3H14.6771C15.5233 3 15.9464 3 16.3454 3.09741C16.5263 3.14158 16.7026 3.20041 16.8721 3.27323C17.246 3.43383 17.5699 3.68319 18.2178 4.18192C20.3644 5.83448 21.4378 6.66077 21.8057 7.73078C21.9694 8.20673 22.0305 8.70728 21.9858 9.20461C21.8852 10.3227 21.0379 11.346 19.3433 13.3925L15.3498 18.2153C13.8126 20.0718 13.044 21 12 21C10.956 21 10.1874 20.0718 8.65018 18.2153L4.65671 13.3925C2.96208 11.346 2.11476 10.3227 2.0142 9.20461C1.96947 8.70728 2.03064 8.20673 2.1943 7.73078C2.56224 6.66077 3.63557 5.83448 5.78223 4.18192Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M10 8.5H14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>'],staticColors:["#993018","#444444","#D18F36","#315F9C"]};class o{static findTierByIndex(e,t){return e.find((e=>e.index===t))||null}static findTierByName(e,t){return e.find((e=>e.tier_name===t))||null}static getTierNameByIndex(e,t){return this.findTierByIndex(e,t)?.tier_name}static findCurrentTierIndex(e,t){if(!t)return 0;for(let r=t.length-1;r>=0;r--)if(e>=t[r].threshold)return t[r].index;return 0}}const n=class{constructor(t){e(this,t),this.currentTierIndex=0,this.canRender=!1,this.isLoading=!1,this.handleTabClick=e=>{this.activeTabTier=e},salla.lang.onLoaded((()=>{this.loyaltyProgramText=salla.lang.get("blocks.tiered_offer.program_title"),this.currentTierText=salla.lang.get("blocks.tiered_offer.current_tier"),this.discountText=salla.lang.get("blocks.tiered_offer.discount"),this.benefitText=salla.lang.get("blocks.tiered_offer.tier_description")}))}async componentWillLoad(){try{if(await salla.onReady(),!this.checkFeatureEnabled())return;if(!this.checkCartExists())return;this.isLoading=!0;const e=await this.fetchTieredOfferData();if(!e)return;this.initializeComponent(e)}catch(e){this.canRender=!1,salla.logger.warn("salla-tiered-offer:: ",e)}finally{this.isLoading=!1}}checkFeatureEnabled(){return salla.config.get("store.features")?.includes("tiered-offer")}checkCartExists(){return!!salla.storage.get("cart")?.summary?.count}validateCouponCompatibility(e,t){return!(t&&!e.details?.applied_with_coupon)}async fetchTieredOfferData(){try{const{data:e}=await salla.api.cart.offers(),t=e.find((e=>"tiered_offer"===e.type));return t?this.validateCouponCompatibility(t,salla.storage.get("cart")?.coupon)?t:(this.canRender=!1,null):null}catch(e){throw e}}initializeComponent(e){this.apiOfferData=e,this.tieredOfferData=this.mapApiDataToTiers(this.apiOfferData),this.loyaltyProgramText=this.apiOfferData.title||this.loyaltyProgramText;const t=this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0);0!==t?(this.currentTierIndex=t,this.currentTier=o.getTierNameByIndex(this.tieredOfferData.tiers,t),this.activeTabTier=this.currentTier,this.canRender=!0):this.canRender=!1}componentDidLoad(){salla.event.on("cart::updated",(async e=>{const t=await this.fetchTieredOfferData();t&&this.updateOfferValues(e,t)}))}mapApiDataToTiers(e){const t=[...e.details.discounts].sort(((e,t)=>e.min_spend-t.min_spend)).map(((e,t)=>({name:e.name,tier_name:e.name,discount:e.type===s.PERCENTAGE?`${salla.helpers.number(e.value)}%`:salla.money(e.value),icon:i.staticIcons[t]||i.staticIcons[0],threshold:e.min_spend,text_color:i.staticColors[t],index:t+1})));return{current_tier:o.getTierNameByIndex(t,this.findCurrentTierIndex(e.details.current_value,t)),tiers:t}}findCurrentTierIndex(e,t=this.tieredOfferData?.tiers){return o.findCurrentTierIndex(e,t||[])}updateOfferValues(e,t){if(!t||!this.tieredOfferData)return;if(!this.validateCouponCompatibility(t,e.coupon))return void(this.canRender=!1);if(this.canRender=!0,!1===t.details?.with_current_cart)return;const r=t.details?.current_value||0;this.apiOfferData=t;const s=this.findCurrentTierIndex(r);0!==s?(this.canRender=!0,this.currentTierIndex=s,this.currentTier=o.getTierNameByIndex(this.tieredOfferData.tiers,s),this.activeTabTier!==this.currentTier&&(this.activeTabTier=this.currentTier)):this.canRender=!1}getLoadingSkeletonView(){return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-skeleton-wrapper"},t("div",{class:"s-tiered-offer-skeleton-title"},t("salla-skeleton",{height:"16px",width:"40%"})),t("div",{class:"s-tiered-offer-skeleton-subtitle"},t("salla-skeleton",{height:"20px",width:"60%"})),t("div",{class:"s-tiered-offer-skeleton-progress"},t("salla-skeleton",{height:"16px",width:"100%"})),t("div",{class:"s-tiered-offer-skeleton-tabs"},t("salla-skeleton",{height:"50px",width:"100%"})))))}getCurrentTierData(){return o.findTierByIndex(this.tieredOfferData.tiers,this.currentTierIndex)||this.tieredOfferData.tiers[0]}getProgressWidth(){const e=this.tieredOfferData.tiers.length;return this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0)/e*100}calculateMilestonePosition(e,t){return 1===t?"calc(100% - 18px)":`${Math.max(2,Math.min(95,(e+1)/t*100-8/t))}%`}getMilestoneStyles(e,t,r){const s="rtl"===document.documentElement.dir,i=this.calculateMilestonePosition(t,r),o=e.name.length>6?"flex-end":"center";return{[s?"right":"left"]:i,alignItems:o,position:"absolute",transform:s?"translateX(50%)":"translateX(-50%)"}}getMilestoneIconStyles(e,t,r){return t?{color:e.text_color}:r?{color:"var(--color-primary)"}:{}}renderProgressBarBackground(e){return[t("div",{class:"s-tiered-offer-progress-bg"}),t("div",{class:"s-tiered-offer-progress-fill",style:{width:`${e}%`}})]}renderMilestoneIcon(e,r,s){const i=["s-tiered-offer-milestone-icon",r?"s-tiered-offer-milestone-active":"",s?"s-tiered-offer-milestone-completed":""].filter(Boolean).join(" ");return t("div",{class:i,style:this.getMilestoneIconStyles(e,r,s)},t("span",{innerHTML:e.icon}))}renderMilestoneName(e,r){return t("div",{class:"s-tiered-offer-milestone-name"},r&&t("span",{style:{color:e.text_color}},e.name))}renderMilestones(e,r){return t("div",{class:"s-tiered-offer-milestones-wrapper"},t("div",{class:1===r?"s-tiered-offer-single-milestone-justify-end":"s-tiered-offer-milestones"},this.tieredOfferData.tiers.map(((s,i)=>{const o=e>=s.threshold,n=s.tier_name===this.currentTier;return t("div",{class:"s-tiered-offer-milestone",style:this.getMilestoneStyles(s,i,r)},this.renderMilestoneIcon(s,n,o),this.renderMilestoneName(s,n))}))))}renderProgressBar(){const e=this.getProgressWidth(),r=this.tieredOfferData.tiers.length,s=this.apiOfferData.details?.current_value||0;return t("div",{class:"s-tiered-offer-progress-container"},t("div",{class:"s-tiered-offer-progress-wrapper"},this.renderProgressBarBackground(e),this.renderMilestones(s,r)))}renderTabs(){return t("div",{class:"s-tiered-offer-tabs-container"},t("div",{class:"s-tiered-offer-tab-headers"},this.tieredOfferData.tiers.map((e=>t("button",{class:"s-tiered-offer-tab-header "+(e.tier_name===this.activeTabTier?"s-tiered-offer-tab-active":""),onClick:()=>this.handleTabClick(e.tier_name)},t("span",null,e.name))))),t("div",{class:"s-tiered-offer-tab-content-wrapper"},(()=>{const e=o.findTierByName(this.tieredOfferData.tiers,this.activeTabTier);return e?t("div",{class:"s-tiered-offer-tab-content"},t("div",{class:"s-tiered-offer-tab-content-inner"},t("div",{class:"s-tiered-offer-discount-section"},t("p",{class:"s-tiered-offer-discount-title"},this.discountText," ",t("span",{innerHTML:e.discount})),t("p",{class:"s-tiered-offer-benefit-description"},this.benefitText," ",e.name)))):null})()))}render(){if(this.isLoading)return this.getLoadingSkeletonView();if(!this.canRender||!this.tieredOfferData)return null;const e=this.getCurrentTierData();return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-header"},t("div",{class:"s-tiered-offer-header-content"},t("p",{class:"s-tiered-offer-program-title"},this.loyaltyProgramText),t("div",{class:"s-tiered-offer-current-tier-name-wrapper"},t("h2",{class:"s-tiered-offer-current-tier"},this.currentTierText," ",t("span",{class:"s-tiered-offer-tier-name"},e.name)),t("span",{innerHTML:e.icon})))),this.renderProgressBar(),this.renderTabs()))}};n.style=".s-tiered-offer-milestone-icon svg{color:currentColor}.s-tiered-offer-milestone-icon svg path{stroke:currentColor;fill:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg path{fill:currentColor;stroke:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg[fill=none] path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg[fill=none] path{fill:none;stroke:currentColor}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-bg{transform:scaleX(-1)}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-fill{transform:scaleX(-1);left:auto}[dir=rtl] .flip-x{transform:scaleX(-1)}";export{n as salla_tiered_offer}
@@ -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}from"./p-Dbv0I4re.js";var s,a;!function(t){t.PERCENTAGE="percentage",t.FIXED="fixed",t.FREE_PRODUCT="free_product"}(s||(s={})),function(t){t.PRODUCT_COUNT="products_count",t.PRODUCT_PURCHASE="order_amount"}(a||(a={}));const l=class{constructor(i){t(this,i),this.offer=null,this.products={},this.isLoading=!1,this.canRender=!0}componentWillLoad(){salla.onReady().then((()=>{if(!salla.config.get("store.features")?.includes("conditional-offer")||""!==salla.storage.get("cart")&&!salla.storage.get("cart")?.summary?.count)throw new Error("feature or cart object does not existed")})).then((()=>salla.api.cart.offers())).then((({data:t})=>{if(this.offer=t.find((t=>"conditional"===t.type)),this.offer)return this.isLoading=!0,this.offer.details.discounts.unshift({value:0,min_spend:0}),this.updateInitialOfferValue();this.canRender=!1})).then((()=>{if(this.offer)return this.getProducts()})).then((()=>{this.offer&&salla.event.on("cart::updated",(t=>this.updateOfferValues(t)))})).catch((t=>{this.canRender=!1,salla.logger.warn("salla-conditional-offer:: ",t)})).finally((()=>{this.isLoading=!1}))}getProducts(){const t=this.offer.details.discounts.filter((({type:t})=>t===s.FREE_PRODUCT)).map((({value:t})=>t)).filter(Boolean);if(t.length>0)return salla.product.fetch({source:"selected",source_value:t}).then((t=>{const i=t?.data;if(i&&Array.isArray(i)){const t={...this.products};i.forEach((({id:i,url:e,image:s,name:a,price:l})=>{i&&a&&s?.url&&e&&void 0!==l&&(t[i]={url:e,image:s,name:a,price:l})})),this.products=t}}))}updateInitialOfferValue(){return salla.api.cart.details().then((({data:{cart:t}})=>this.updateOfferValues(t)))}updateOfferValues({items:t,sub_total:i}){const e=this.offer.details.based_on===a.PRODUCT_COUNT?t?.reduce(((t,{quantity:i})=>t+i),0)??0:i;return this.offer={...this.offer,details:{...this.offer?.details,current_value:e}},this.offer}renderTooltip(t){const e=t.value,s=this.products[e];return s?i("salla-tooltip",{class:"absolute left-0 -top-2",targetId:`avatar-product-${e}`,theme:"dark"},i("div",{class:"flex gap-3 text-start"},s?.image?.url&&i("img",{src:s.image.url,alt:s?.image?.alt||s.name||"",class:"w-12 h-12 object-cover rounded-lg flex-shrink-0",loading:"lazy",decoding:"async"}),i("div",{class:"flex-1"},i("div",{class:"leading-tight mb-1"},s.name),i("div",{class:"text-xs text-gray-300",innerHTML:salla.money(s.price)})))):(salla.logger.error(`salla-conditional-offer:: there is no product with id (${t.value})!`),null)}getCheckpointContent(t){if(t.type===s.PERCENTAGE)return`${t.value}%`;if(t.type===s.FIXED)return i("span",{innerHTML:salla.money(t.value)});if(t.type!==s.FREE_PRODUCT)return salla.logger.error(`salla-conditional-offer:: unexpected type (${t.type})!`),"";const e=this.products[t.value];return e?i("a",{class:"s-conditional-offer-product-link",href:e.url},i("img",{class:"s-conditional-offer-checkpoint-image-content",loading:"lazy",decoding:"async",alt:e?.image?.alt||"",src:e?.image?.url})):(salla.logger.error(`salla-conditional-offer:: there is no product with id (${t.value})!`),"")}getOfferType(t){const i=this.offer.details?.based_on;return i===a.PRODUCT_COUNT?salla.lang.choice("blocks.header.products_count",t.min_spend):i===a.PRODUCT_PURCHASE?salla.money(t.min_spend):(salla.logger.warn(`salla-conditional-offer:: Unexpected offer detail's based_on value: ${i}`),`${t.min_spend}`)}clamp(t,i,e){return Math.max(i,Math.min(t,e))}mapValueRanges(t,i,e,s,a){const l=(t-i)*(a-s)/(e-i)+s;return l===Number.POSITIVE_INFINITY?100:l===Number.NEGATIVE_INFINITY?0:this.clamp(l,0,100)}getCheckPointView(t,e){const a=this.offer.details.discounts.findIndex((({min_spend:i})=>i===t.min_spend)),l=this.mapValueRanges(this.offer.details.current_value,this.offer.details.discounts[a-1]?.min_spend??0,t.min_spend,0,100),n=t.min_spend<=this.offer.details.current_value;return i("div",{class:"s-conditional-offer-checkpoint-container"},e>0?[i("div",{key:"progress-line",class:"s-conditional-offer-progress-line-container"},i("div",{class:"s-conditional-offer-progress-line-inactive"}),i("div",{class:"s-conditional-offer-progress-line-active",style:{width:`${l}%`}})),i("div",{key:"checkpoint",class:"s-conditional-offer-checkpoint "+(n?"s-conditional-offer-active-checkpoint":"")},i("div",{class:"s-conditional-offer-item-avatar-content "+(n?"active":""),id:t.type===s.FREE_PRODUCT?`avatar-product-${t.value}`:`avatar-${t.value??e}`},this.products&&this.getCheckpointContent(t)),this.products&&t.type===s.FREE_PRODUCT&&this.renderTooltip(t),i("div",{class:"s-conditional-offer-checkpoint-label "+(n?"active":""),innerHTML:this.getOfferType(t)}))]:i("div",{key:"label",class:{"s-conditional-offer-checkpoint-label":!0,"first-checkpoint":0===e,active:n},innerHTML:this.getOfferType(t)}))}getLoadingSkeletonView(){return i(e,{class:"s-conditional-offer-container"},i("div",{class:"s-conditional-offer-skeleton-inner-container"},i("div",{class:"s-conditional-offer-skeleton-subtitle"},i("salla-skeleton",{height:"16px",width:"30%"})),i("div",{class:"s-conditional-offer-skeleton-subtitle"},i("salla-skeleton",{height:"16px",width:"35%"})),i("div",{class:"s-conditional-offer-skeleton-checkpoints-wrapper"},Array(3).fill(null).map((()=>[i("salla-skeleton",{key:"checkpoint-line",height:"8px"}),i("div",{key:"checkpoint"},i("salla-skeleton",{height:"60px",width:"60px",type:"circle"}))])))))}render(){return this.canRender?this.isLoading?this.getLoadingSkeletonView():this.offer?i(e,{class:"s-conditional-offer-container"},i("div",{class:"s-conditional-offer-title-wrapper"},i("div",{class:"s-conditional-offer-title"},this.offer.title),this.offer.description?i("div",{class:"s-conditional-offer-subtitle"},this.offer.description," ",i("i",{class:"sicon-information"})):null),i("div",{class:"s-conditional-offer-progress-container"},this.offer.details.discounts.map(((t,e)=>i("div",{class:{"flex-1":e>0},key:t.min_spend},this.getCheckPointView(t,e)))))):null:null}};l.style=":host{display:block}";export{l as salla_conditional_offer}
4
+ import{r as t,h as i,H as e}from"./p-CvIpy7Cj.js";var s,a;!function(t){t.PERCENTAGE="percentage",t.FIXED="fixed",t.FREE_PRODUCT="free_product"}(s||(s={})),function(t){t.PRODUCT_COUNT="products_count",t.PRODUCT_PURCHASE="order_amount"}(a||(a={}));const l=class{constructor(i){t(this,i),this.offer=null,this.products={},this.isLoading=!1,this.canRender=!0}componentWillLoad(){salla.onReady().then((()=>{if(!salla.config.get("store.features")?.includes("conditional-offer")||""!==salla.storage.get("cart")&&!salla.storage.get("cart")?.summary?.count)throw new Error("feature or cart object does not existed")})).then((()=>salla.api.cart.offers())).then((({data:t})=>{if(this.offer=t.find((t=>"conditional"===t.type)),this.offer)return this.isLoading=!0,this.offer.details.discounts.unshift({value:0,min_spend:0}),this.updateInitialOfferValue();this.canRender=!1})).then((()=>{if(this.offer)return this.getProducts()})).then((()=>{this.offer&&salla.event.on("cart::updated",(t=>this.updateOfferValues(t)))})).catch((t=>{this.canRender=!1,salla.logger.warn("salla-conditional-offer:: ",t)})).finally((()=>{this.isLoading=!1}))}getProducts(){const t=this.offer.details.discounts.filter((({type:t})=>t===s.FREE_PRODUCT)).map((({value:t})=>t)).filter(Boolean);if(t.length>0)return salla.product.fetch({source:"selected",source_value:t}).then((t=>{const i=t?.data;if(i&&Array.isArray(i)){const t={...this.products};i.forEach((({id:i,url:e,image:s,name:a,price:l})=>{i&&a&&s?.url&&e&&void 0!==l&&(t[i]={url:e,image:s,name:a,price:l})})),this.products=t}}))}updateInitialOfferValue(){return salla.api.cart.details().then((({data:{cart:t}})=>this.updateOfferValues(t)))}updateOfferValues({items:t,sub_total:i}){const e=this.offer.details.based_on===a.PRODUCT_COUNT?t?.reduce(((t,{quantity:i})=>t+i),0)??0:i;return this.offer={...this.offer,details:{...this.offer?.details,current_value:e}},this.offer}renderTooltip(t){const e=t.value,s=this.products[e];return s?i("salla-tooltip",{class:"absolute left-0 -top-2",targetId:`avatar-product-${e}`,theme:"dark"},i("div",{class:"flex gap-3 text-start"},s?.image?.url&&i("img",{src:s.image.url,alt:s?.image?.alt||s.name||"",class:"w-12 h-12 object-cover rounded-lg flex-shrink-0",loading:"lazy",decoding:"async"}),i("div",{class:"flex-1"},i("div",{class:"leading-tight mb-1"},s.name),i("div",{class:"text-xs text-gray-300",innerHTML:salla.money(s.price)})))):(salla.logger.error(`salla-conditional-offer:: there is no product with id (${t.value})!`),null)}getCheckpointContent(t){if(t.type===s.PERCENTAGE)return`${t.value}%`;if(t.type===s.FIXED)return i("span",{innerHTML:salla.money(t.value)});if(t.type!==s.FREE_PRODUCT)return salla.logger.error(`salla-conditional-offer:: unexpected type (${t.type})!`),"";const e=this.products[t.value];return e?i("a",{class:"s-conditional-offer-product-link",href:e.url},i("img",{class:"s-conditional-offer-checkpoint-image-content",loading:"lazy",decoding:"async",alt:e?.image?.alt||"",src:e?.image?.url})):(salla.logger.error(`salla-conditional-offer:: there is no product with id (${t.value})!`),"")}getOfferType(t){const i=this.offer.details?.based_on;return i===a.PRODUCT_COUNT?salla.lang.choice("blocks.header.products_count",t.min_spend):i===a.PRODUCT_PURCHASE?salla.money(t.min_spend):(salla.logger.warn(`salla-conditional-offer:: Unexpected offer detail's based_on value: ${i}`),`${t.min_spend}`)}clamp(t,i,e){return Math.max(i,Math.min(t,e))}mapValueRanges(t,i,e,s,a){const l=(t-i)*(a-s)/(e-i)+s;return l===Number.POSITIVE_INFINITY?100:l===Number.NEGATIVE_INFINITY?0:this.clamp(l,0,100)}getCheckPointView(t,e){const a=this.offer.details.discounts.findIndex((({min_spend:i})=>i===t.min_spend)),l=this.mapValueRanges(this.offer.details.current_value,this.offer.details.discounts[a-1]?.min_spend??0,t.min_spend,0,100),n=t.min_spend<=this.offer.details.current_value;return i("div",{class:"s-conditional-offer-checkpoint-container"},e>0?[i("div",{key:"progress-line",class:"s-conditional-offer-progress-line-container"},i("div",{class:"s-conditional-offer-progress-line-inactive"}),i("div",{class:"s-conditional-offer-progress-line-active",style:{width:`${l}%`}})),i("div",{key:"checkpoint",class:"s-conditional-offer-checkpoint "+(n?"s-conditional-offer-active-checkpoint":"")},i("div",{class:"s-conditional-offer-item-avatar-content "+(n?"active":""),id:t.type===s.FREE_PRODUCT?`avatar-product-${t.value}`:`avatar-${t.value??e}`},this.products&&this.getCheckpointContent(t)),this.products&&t.type===s.FREE_PRODUCT&&this.renderTooltip(t),i("div",{class:"s-conditional-offer-checkpoint-label "+(n?"active":""),innerHTML:this.getOfferType(t)}))]:i("div",{key:"label",class:{"s-conditional-offer-checkpoint-label":!0,"first-checkpoint":0===e,active:n},innerHTML:this.getOfferType(t)}))}getLoadingSkeletonView(){return i(e,{class:"s-conditional-offer-container"},i("div",{class:"s-conditional-offer-skeleton-inner-container"},i("div",{class:"s-conditional-offer-skeleton-subtitle"},i("salla-skeleton",{height:"16px",width:"30%"})),i("div",{class:"s-conditional-offer-skeleton-subtitle"},i("salla-skeleton",{height:"16px",width:"35%"})),i("div",{class:"s-conditional-offer-skeleton-checkpoints-wrapper"},Array(3).fill(null).map((()=>[i("salla-skeleton",{key:"checkpoint-line",height:"8px"}),i("div",{key:"checkpoint"},i("salla-skeleton",{height:"60px",width:"60px",type:"circle"}))])))))}render(){return this.canRender?this.isLoading?this.getLoadingSkeletonView():this.offer?i(e,{class:"s-conditional-offer-container"},i("div",{class:"s-conditional-offer-title-wrapper"},i("div",{class:"s-conditional-offer-title"},this.offer.title),this.offer.description?i("div",{class:"s-conditional-offer-subtitle"},this.offer.description," ",i("i",{class:"sicon-information"})):null),i("div",{class:"s-conditional-offer-progress-container"},this.offer.details.discounts.map(((t,e)=>i("div",{class:{"flex-1":e>0},key:t.min_spend},this.getCheckPointView(t,e)))))):null:null}};l.style=":host{display:block}";export{l as salla_conditional_offer}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as s,H as c,a}from"./p-Dbv0I4re.js";import{W as e}from"./p-CgR-T_ZS.js";import{M as n}from"./p-DmgxDvXL.js";const i=class{constructor(s){t(this,s),this.contacts=salla.config.get("store.contacts"),this.iconsList={mobile:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>iphone</title>\n<path d="M15.053 27.613c0.133 0.12 0.28 0.213 0.44 0.28s0.333 0.107 0.507 0.107c0.36 0 0.693-0.135 0.947-0.387 0.12-0.135 0.213-0.28 0.28-0.44 0.080-0.16 0.107-0.333 0.107-0.507 0-0.347-0.147-0.695-0.387-0.947-0.507-0.493-1.387-0.493-1.893 0-0.12 0.12-0.213 0.267-0.28 0.44-0.067 0.16-0.107 0.333-0.107 0.507s0.040 0.347 0.107 0.507 0.16 0.305 0.28 0.44zM24 0h-16c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h16c2.205 0 4-1.795 4-4v-24c0-2.205-1.795-4-4-4zM25.333 28c0 0.736-0.599 1.333-1.333 1.333h-16c-0.735 0-1.333-0.597-1.333-1.333v-4h18.667zM25.333 21.333h-18.667v-17.333c0-0.735 0.599-1.333 1.333-1.333h16c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n',whatsapp:e,phone:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>phone</title>\n<path d="M30.823 21.713l-3.883-3.883c-1.569-1.568-4.12-1.568-5.689 0l-2.568 2.568c-3.063-1.499-5.583-4.019-7.081-7.083l2.568-2.567c0.759-0.76 1.177-1.771 1.177-2.845s-0.419-2.084-1.179-2.844l-3.881-3.881c-1.52-1.521-4.171-1.521-5.689 0l-1.845 1.847c-2.22 2.219-3.183 5.407-2.573 8.527 1.98 10.144 10.125 18.292 20.269 20.271 0.616 0.121 1.236 0.18 1.849 0.18 2.492 0 4.896-0.972 6.677-2.752l1.847-1.847c1.568-1.571 1.568-4.121 0.001-5.691zM28.936 25.517l-1.845 1.847c-1.592 1.592-3.883 2.283-6.132 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.596-0.397 0.959-0.397s0.703 0.14 0.959 0.397l3.883 3.883c0.256 0.256 0.397 0.596 0.397 0.959s-0.141 0.703-0.397 0.96l-3.22 3.217c-0.383 0.384-0.496 0.959-0.287 1.457 1.813 4.339 5.343 7.868 9.683 9.684 0.497 0.207 1.073 0.095 1.457-0.288l3.22-3.22c0.529-0.529 1.389-0.528 1.917 0l3.881 3.883c0.528 0.529 0.528 1.389 0 1.919z"></path>\n</svg>\n',telegram:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>paper-plane-o</title>\n<path d="M31.5 0.482c0.375 0.268 0.554 0.696 0.482 1.143l-4.571 27.429c-0.054 0.339-0.268 0.625-0.571 0.804-0.161 0.089-0.357 0.143-0.554 0.143-0.143 0-0.286-0.036-0.429-0.089l-9.411-3.839-5.321 5.839c-0.214 0.25-0.518 0.375-0.839 0.375-0.143 0-0.286-0.018-0.411-0.071-0.446-0.179-0.732-0.607-0.732-1.071v-8.071l-8.429-3.446c-0.411-0.161-0.679-0.536-0.714-0.982-0.036-0.429 0.196-0.839 0.571-1.054l29.714-17.143c0.375-0.232 0.857-0.214 1.214 0.036zM25.393 27.25l3.946-23.625-25.607 14.768 6 2.446 15.411-11.411-8.536 14.232z"></path>\n</svg>\n',email:n},this.contactSlot=this.host.querySelector('[slot="contact"]')?.innerHTML||`<a href={link} class="s-contacts-item"><span class="s-contacts-icon">{icon}</span>${!this.iconsOnly&&"<span class='unicode'>{value}</span>"}</a>`,salla.onReady((()=>{this.contacts=salla.config.get("store.contacts")})),salla.lang.onLoaded((()=>{this.contactsTitle=this.contactsTitle||salla.lang.get("blocks.footer.social")}))}getContactsArray(){return Object.entries(this.contacts).filter((([t,s])=>""!==s)).map((([t,s])=>({type:t,value:s})))}getContactLink(t){const s=this.contacts[t];switch(t){case"phone":case"mobile":return`tel:${s}`;case"whatsapp":const t=(s||"").toString().replace(/[^\d]/g,"");return t?`https://wa.me/${t}`:salla.url.get("whatsapp/send");case"email":return`mailto:${s}`;case"telegram":return s.startsWith("https://t.me/")?s:`https://t.me/${s}`;default:return s}}getContactIcon(t){return this.iconsList[t]}componentWillLoad(){return new Promise((t=>salla.onReady(t)))}render(){const t=this.getContactsArray();if(t&&0!=t.length)return this.isHeader?s(c,{class:"s-contacts s-contacts-header"},t.filter((t=>"phone"==t.type||"email"==t.type)).map(((t,c)=>s("a",{href:this.getContactLink(t.type),key:c,class:"s-contacts-topnav-link"},"email"===t.type?t.value:[s("span",null,this.contactsTitle,": "),s("a",{class:"unicode",href:this.iconsList[t.type]},t.value)])))):s(c,{class:"s-contacts"},!this.hideTitle&&s("h3",{class:"s-contacts-title"},this.contactsTitle),s("div",{class:{"s-contacts-list":!0,"s-contacts-list-horizontal":this.horizontal,"s-contacts-list-vertical":!this.horizontal,"s-contacts-list-icons-only":this.iconsOnly}},t.map(((t,c)=>s("div",{key:c,id:"contact-slot",innerHTML:this.contactSlot.replace(/\{icon\}/g,this.getContactIcon(t.type)).replace(/\{value\}/g,t.value.toString()).replace(/\{link\}/g,this.getContactLink(t.type))})))))}componentDidRender(){this.host.querySelector('[slot="contact"]')?.remove()}get host(){return a(this)}};i.style=".unicode{unicode-bidi:plaintext}";export{i as salla_contacts}
4
+ import{r as t,h as s,H as c,a}from"./p-CvIpy7Cj.js";import{W as e}from"./p-CgR-T_ZS.js";import{M as n}from"./p-DmgxDvXL.js";const i=class{constructor(s){t(this,s),this.contacts=salla.config.get("store.contacts"),this.iconsList={mobile:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>iphone</title>\n<path d="M15.053 27.613c0.133 0.12 0.28 0.213 0.44 0.28s0.333 0.107 0.507 0.107c0.36 0 0.693-0.135 0.947-0.387 0.12-0.135 0.213-0.28 0.28-0.44 0.080-0.16 0.107-0.333 0.107-0.507 0-0.347-0.147-0.695-0.387-0.947-0.507-0.493-1.387-0.493-1.893 0-0.12 0.12-0.213 0.267-0.28 0.44-0.067 0.16-0.107 0.333-0.107 0.507s0.040 0.347 0.107 0.507 0.16 0.305 0.28 0.44zM24 0h-16c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h16c2.205 0 4-1.795 4-4v-24c0-2.205-1.795-4-4-4zM25.333 28c0 0.736-0.599 1.333-1.333 1.333h-16c-0.735 0-1.333-0.597-1.333-1.333v-4h18.667zM25.333 21.333h-18.667v-17.333c0-0.735 0.599-1.333 1.333-1.333h16c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n',whatsapp:e,phone:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>phone</title>\n<path d="M30.823 21.713l-3.883-3.883c-1.569-1.568-4.12-1.568-5.689 0l-2.568 2.568c-3.063-1.499-5.583-4.019-7.081-7.083l2.568-2.567c0.759-0.76 1.177-1.771 1.177-2.845s-0.419-2.084-1.179-2.844l-3.881-3.881c-1.52-1.521-4.171-1.521-5.689 0l-1.845 1.847c-2.22 2.219-3.183 5.407-2.573 8.527 1.98 10.144 10.125 18.292 20.269 20.271 0.616 0.121 1.236 0.18 1.849 0.18 2.492 0 4.896-0.972 6.677-2.752l1.847-1.847c1.568-1.571 1.568-4.121 0.001-5.691zM28.936 25.517l-1.845 1.847c-1.592 1.592-3.883 2.283-6.132 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.596-0.397 0.959-0.397s0.703 0.14 0.959 0.397l3.883 3.883c0.256 0.256 0.397 0.596 0.397 0.959s-0.141 0.703-0.397 0.96l-3.22 3.217c-0.383 0.384-0.496 0.959-0.287 1.457 1.813 4.339 5.343 7.868 9.683 9.684 0.497 0.207 1.073 0.095 1.457-0.288l3.22-3.22c0.529-0.529 1.389-0.528 1.917 0l3.881 3.883c0.528 0.529 0.528 1.389 0 1.919z"></path>\n</svg>\n',telegram:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>paper-plane-o</title>\n<path d="M31.5 0.482c0.375 0.268 0.554 0.696 0.482 1.143l-4.571 27.429c-0.054 0.339-0.268 0.625-0.571 0.804-0.161 0.089-0.357 0.143-0.554 0.143-0.143 0-0.286-0.036-0.429-0.089l-9.411-3.839-5.321 5.839c-0.214 0.25-0.518 0.375-0.839 0.375-0.143 0-0.286-0.018-0.411-0.071-0.446-0.179-0.732-0.607-0.732-1.071v-8.071l-8.429-3.446c-0.411-0.161-0.679-0.536-0.714-0.982-0.036-0.429 0.196-0.839 0.571-1.054l29.714-17.143c0.375-0.232 0.857-0.214 1.214 0.036zM25.393 27.25l3.946-23.625-25.607 14.768 6 2.446 15.411-11.411-8.536 14.232z"></path>\n</svg>\n',email:n},this.contactSlot=this.host.querySelector('[slot="contact"]')?.innerHTML||`<a href={link} class="s-contacts-item"><span class="s-contacts-icon">{icon}</span>${!this.iconsOnly&&"<span class='unicode'>{value}</span>"}</a>`,salla.onReady((()=>{this.contacts=salla.config.get("store.contacts")})),salla.lang.onLoaded((()=>{this.contactsTitle=this.contactsTitle||salla.lang.get("blocks.footer.social")}))}getContactsArray(){return Object.entries(this.contacts).filter((([t,s])=>""!==s)).map((([t,s])=>({type:t,value:s})))}getContactLink(t){const s=this.contacts[t];switch(t){case"phone":case"mobile":return`tel:${s}`;case"whatsapp":const t=(s||"").toString().replace(/[^\d]/g,"");return t?`https://wa.me/${t}`:salla.url.get("whatsapp/send");case"email":return`mailto:${s}`;case"telegram":return s.startsWith("https://t.me/")?s:`https://t.me/${s}`;default:return s}}getContactIcon(t){return this.iconsList[t]}componentWillLoad(){return new Promise((t=>salla.onReady(t)))}render(){const t=this.getContactsArray();if(t&&0!=t.length)return this.isHeader?s(c,{class:"s-contacts s-contacts-header"},t.filter((t=>"phone"==t.type||"email"==t.type)).map(((t,c)=>s("a",{href:this.getContactLink(t.type),key:c,class:"s-contacts-topnav-link"},"email"===t.type?t.value:[s("span",null,this.contactsTitle,": "),s("a",{class:"unicode",href:this.iconsList[t.type]},t.value)])))):s(c,{class:"s-contacts"},!this.hideTitle&&s("h3",{class:"s-contacts-title"},this.contactsTitle),s("div",{class:{"s-contacts-list":!0,"s-contacts-list-horizontal":this.horizontal,"s-contacts-list-vertical":!this.horizontal,"s-contacts-list-icons-only":this.iconsOnly}},t.map(((t,c)=>s("div",{key:c,id:"contact-slot",innerHTML:this.contactSlot.replace(/\{icon\}/g,this.getContactIcon(t.type)).replace(/\{value\}/g,t.value.toString()).replace(/\{link\}/g,this.getContactLink(t.type))})))))}componentDidRender(){this.host.querySelector('[slot="contact"]')?.remove()}get host(){return a(this)}};i.style=".unicode{unicode-bidi:plaintext}";export{i as salla_contacts}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as s,H as a}from"./p-Dbv0I4re.js";const r=class{constructor(s){e(this,s),this.dark=!1,this.commercialRegisterLabel="",this.freelanceLabel=""}componentWillLoad(){this.initializeTranslations()}initializeTranslations(){salla.lang.onLoaded((()=>{const e=(e,s,a)=>{salla.helpers.setNested(salla.lang.messages[e],s,a)};e("ar.trans","blocks.footer.commercial_register","السجل التجاري"),e("en.trans","blocks.footer.commercial_register","Commercial Register"),e("ar.trans","blocks.footer.freelance","وثيقة العمل الحر"),e("en.trans","blocks.footer.freelance","Freelance Certificate"),this.commercialRegisterLabel=salla.lang.getWithDefault("blocks.footer.commercial_register","السجل التجاري"),this.freelanceLabel=salla.lang.getWithDefault("blocks.footer.freelance","وثيقة العمل الحر")}))}getBadgeData(){const e=salla.config.get("store.settings.commercial_number"),s=salla.config.get("store.settings.freelance_number");return e?{number:e,label:this.commercialRegisterLabel||"السجل التجاري",imageUrl:salla.url.cdn("images/commercial-register.png",70,70),type:"commercial"}:s?{number:s,label:this.freelanceLabel||"وثيقة العمل الحر",imageUrl:this.dark?salla.url.cdn("images/freelance-white.png"):salla.url.cdn("images/freelance.png"),type:"freelance"}:null}render(){const e=this.getBadgeData();return e?s(a,{class:"s-trust-badges-wrapper "+(this.dark?"dark":"")},s("img",{class:"s-trust-badges-image",width:"55",height:"55",src:e.imageUrl,alt:e.label}),s("div",{class:"s-trust-badges-content"},s("p",{class:"s-trust-badges-label"},e.label),s("b",{class:"s-trust-badges-number"},e.number))):null}};r.style="";export{r as salla_trust_badges}
4
+ import{r as e,h as s,H as a}from"./p-CvIpy7Cj.js";const t=class{constructor(s){e(this,s),this.dark=!1,this.commercialRegisterLabel="",this.freelanceLabel=""}componentWillLoad(){this.initializeTranslations()}initializeTranslations(){salla.lang.onLoaded((()=>{const e=(e,s,a)=>{salla.helpers.setNested(salla.lang.messages[e],s,a)};e("ar.trans","blocks.footer.commercial_register","السجل التجاري"),e("en.trans","blocks.footer.commercial_register","Commercial Register"),e("ar.trans","blocks.footer.freelance","وثيقة العمل الحر"),e("en.trans","blocks.footer.freelance","Freelance Certificate"),this.commercialRegisterLabel=salla.lang.getWithDefault("blocks.footer.commercial_register","السجل التجاري"),this.freelanceLabel=salla.lang.getWithDefault("blocks.footer.freelance","وثيقة العمل الحر")}))}getBadgeData(){const e=salla.config.get("store.settings.commercial_number"),s=salla.config.get("store.settings.freelance_number");return e?{number:e,label:this.commercialRegisterLabel||"السجل التجاري",imageUrl:salla.url.cdn("images/commercial-register.png",70,70),type:"commercial"}:s?{number:s,label:this.freelanceLabel||"وثيقة العمل الحر",imageUrl:this.dark?salla.url.cdn("images/freelance-white.png"):salla.url.cdn("images/freelance.png"),type:"freelance"}:null}render(){const e=this.getBadgeData();return e?s(a,{class:"s-trust-badges-wrapper "+(this.dark?"dark":"")},s("img",{class:"s-trust-badges-image",width:"55",height:"55",src:e.imageUrl,alt:e.label}),s("div",{class:"s-trust-badges-content"},s("p",{class:"s-trust-badges-label"},e.label),s("b",{class:"s-trust-badges-number"},e.number))):null}};t.style="";export{t as salla_trust_badges}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as t,H as i,a as e,c as a}from"./p-Dbv0I4re.js";import{A as r,a as l}from"./p-Vqpj4CWE.js";import{C as o}from"./p-BsLF_HK7.js";import{C as n}from"./p-BV4kqbdL.js";import{H as d}from"./p-CHf8XdiS.js";import"./p-CgtvEd63.js";const h=class{constructor(t){s(this,t),this.collapsible=!0,this.bordered=!1,this.size="md",this.collapsed=!0,this.dir=document.dir||"rtl"}directionChangedHandler(s){this.dir=s.detail.dir}handleCollapse(s){this.collapsed=s.detail.payload.collapsed}setcollapsibleProp(){const s=this.host.querySelector("salla-accordion-head");this.collapsible&&s&&(s.setAttribute("collapsible","true"),s.setAttribute("collapsed",this.collapsed.toString()))}componentDidRender(){this.setcollapsibleProp();const s=this.host.querySelector("salla-accordion-body");this.collapsible&&(this.host.setAttribute("data-collapsed",this.collapsed.toString()),s?.setAttribute("data-collapsed",this.collapsed.toString()))}render(){return t(i,{key:"fb12197f13d8836304bfebb14400c79c8c4d31f0",class:`s-accordion-wrapper ${this.dir} ${this.bordered?"s-accordion-wrapper-bordered":""} ${this.size?`size-${this.size}`:""}`,"data-collapsed":this.collapsed.toString()},t("slot",{key:"460e8d7238bf9f014fe0bbb6c0da592c8cb3e15e"}))}get host(){return e(this)}};h.style="";const c=class{constructor(t){s(this,t),this.sessionStorageKey="breadcrumb_snapshot",this.itemSlot=this.host.querySelector('[slot="item"]')?.outerHTML||'<li class="s-breadcrumb-item"><a href={url}>{title}</a></li>',this.iconSlot=this.host.querySelector('[slot="icon"]')?.outerHTML}componentWillLoad(){return new Promise((s=>salla.onReady((()=>salla.lang.onLoaded(s))))).then((()=>{if(salla.url.is_page("index"))throw new Error("salla-breadcrumb:: breadcrumb not supported on home page")})).then((()=>{if(!salla.config.get("theme.settings.is_breadcrumbs_enabled",!0))throw new Error("salla-breadcrumb:: merchant disabled the feature")})).then((()=>{const s=salla.config.get("page");if(!s||!s.slug)return salla.logger.error('salla-breadcrumbs:: page object not existed on salla.config.get("page")!'),void(this.breadcrumbs=[]);let t=this.getSessionBreadcrumbs(),i=t[t.length-1];return"product.single"===s.slug&&t&&t.length>0&&i?.url&&s.parent?.url&&i.url===s.parent.url?(t.push({title:s.title,url:s.url}),this.breadcrumbs=this.setBreadcrumbsFromArray(t),this.storeBreadcrumbSnapshot()):t&&t.length>0?this.isNewPage(s,t)?(this.breadcrumbs=this.generateBreadcrumbs(s),this.storeBreadcrumbSnapshot()):this.breadcrumbs=this.setBreadcrumbsFromArray(t):(this.breadcrumbs=this.generateBreadcrumbs(s),this.storeBreadcrumbSnapshot()),this.breadcrumbs?.length&&(this.breadcrumbs[this.breadcrumbs.length-1].is_last=!0),this.breadcrumbs})).catch((s=>{salla.logger.error("salla-breadcrumb:: unexpected error!",s),this.breadcrumbs=[]}))}getSessionBreadcrumbs(){return"search-bar"===new URLSearchParams(window.location.search).get("from")?[]:JSON.parse(sessionStorage.getItem(this.sessionStorageKey)||"[]")}isNewPage(s,t){const i=t[t.length-1];return i?.url!==s.url}setBreadcrumbsFromArray(s){return s.map(((t,i)=>({...t,is_last:i===s.length-1})))}sanitizeBreadcrumbTitle(s,t=1){return s.includes("|")?s.split("|").map((s=>s.trim()))[t]:s.trim()}generateBreadcrumbs(s){let t=[];if("product.single"===s.slug){const t=this.getSessionBreadcrumbs(),i=t[t.length-1];if(t.length>0&&i?.url&&s.parent?.url&&i.url===s.parent.url)return this.setBreadcrumbsFromArray([...t,{title:s.title,url:s.url}])}let i=s;for(;i;)i.title&&t.unshift({title:i.title,url:i.url}),i=i.parent;return s.slug.includes("customer")&&"customer.profile"!==s.slug&&t.unshift({title:salla.lang.get("common.titles.profile"),url:salla.url.get("profile")}),s.slug.includes("blog")&&t.unshift({title:salla.lang.get("blocks.footer.blog"),url:salla.url.get("blog")}),"brands.single"===s.slug&&t.unshift({title:salla.lang.get("common.titles.brands"),url:salla.url.get("brands")}),s.title||"loyalty"!==s.slug||t.unshift({title:salla.lang.get("common.titles.loyalty_program"),url:salla.url.get("loyalty")}),t.unshift({title:salla.lang.get("common.titles.home"),url:salla.url.get("")}),t}storeBreadcrumbSnapshot(){try{const s=salla.config.get("page");if("product.single"===s?.slug)return;const t=[...this.breadcrumbs],i=t.length-1;i>=0&&(t[i].url=window.location.href);const e=JSON.stringify(t);sessionStorage.setItem(this.sessionStorageKey,e)}catch(s){salla.logger.error("salla-breadcrumb:: Failed to store breadcrumb snapshot in sessionStorage.",s)}}render(){return this.breadcrumbs.length<=1?(salla.log("salla-breadcrumb:: There is no breadcrumbs!"),null):t("ol",{class:{"s-breadcrumb-wrapper":!0,"s-breadcrumb-dark":salla.url.is_page("loyalty"),"s-breadcrumb-primary-reverse":salla.config.get("page.slug").includes("customer")}},this.breadcrumbs.map((s=>{const i="product.single"===salla.config.get("page.slug")&&s.is_last?s.title:this.sanitizeBreadcrumbTitle(s.title),e=this.itemSlot.replace(/\{url\}/g,s.url).replace(/\{title\}/g,i);return[t("div",{class:"s-breadcrumb-slot",innerHTML:e}),this.getArrowDomForItem(s)]})))}getArrowDomForItem(s){if(s.is_last)return"";let i=this.iconSlot||(salla.config.get("theme.is_rtl",!0)?r:l);return t("li",{class:"s-breadcrumb-arrow"},t("div",{class:{"s-breadcrumb-icon-slot":!0,"s-breadcrumb-default-icon":!this.iconSlot},innerHTML:i}))}componentDidRender(){this.host.querySelectorAll(".s-breadcrumb-slot").forEach((s=>s.replaceWith(s.firstChild))),this.host.querySelectorAll(".s-breadcrumb-icon-slot.s-breadcrumb-default-icon").forEach((s=>s.replaceWith(s.querySelector("svg")))),this.host.querySelector('[slot="item"]')?.remove(),this.host.querySelector('[slot="icon"]')?.remove();let s=this.host.querySelectorAll(".s-breadcrumb-item")[this.breadcrumbs.length-1]?.querySelector("a");s&&s.replaceWith(s.firstChild)}get host(){return e(this)}};c.style=":host{display:block}";const u=class{constructor(t){s(this,t),this.shape="btn",this.color="primary",this.fill="solid",this.size="medium",this.width="normal",this.loading=!1,this.disabled=!1,this.loaderPosition="after",this.type="button"}async load(){return"center"==this.loaderPosition&&this.text.classList.add("s-button-hide"),this.host.setAttribute("loading",""),this.host}async stop(){return this.host.removeAttribute("loading"),this.host.querySelector("button").removeAttribute("loading"),"center"==this.loaderPosition&&this.text.classList.remove("s-button-hide"),this.host}async setText(s){return this.text.innerHTML=s,this.host}async disable(){return this.host.setAttribute("disabled",""),this.host}async enable(){return this.host.removeAttribute("disabled"),this.host}getBtnAttributes(){const s={};for(let t=0;t<this.host.attributes.length;t++)["color","fill","size","width","id"].includes(this.host.attributes[t].name)||(s[this.host.attributes[t].name]=this.host.attributes[t].value);s.type=s.type||this.type;const t=s.class||"";return s.class=t+" s-button-element s-button-"+this.shape+" s-button-"+("none"==this.fill?"fill-none":this.fill)+("medium"!=this.size?" s-button-"+this.size:"")+("normal"!=this.width?" s-button-"+this.width:"")+("link"==this.shape?" s-button-"+this.color+"-link":"")+("link"!=this.shape&&"outline"!=this.fill?" s-button-"+this.color:"")+("outline"==this.fill?" s-button-"+this.color+"-outline":"")+(this.disabled?" s-button-disabled ":"")+("icon"==this.shape?" s-button-loader-center":" s-button-loader-"+this.loaderPosition),s["aria-label"]||s["aria-labelledby"]||(this.host.textContent||"").trim()||(t.includes("btn--wishlist")||t.includes("wishlist")?s["aria-label"]=salla.lang.getWithDefault("pages.products.add_to_wishlist","Add or remove to wishlist"):"icon"===this.shape&&console.warn("Icon button is missing aria-label attribute")),s}button(){return t("button",{...this.getBtnAttributes(),disabled:this.disabled},t("span",{class:"s-button-text",ref:s=>this.text=s},t("slot",null)),this.loading?t("span",{class:"s-button-loader"}):"")}render(){return this.host.closest(".swiper-slide")?.classList.contains("swiper-slide-duplicate")?"":t(i,{class:"s-button-wrap"},this.href?t("a",{href:this.href},this.button()):this.button())}get host(){return e(this)}};u.style="";var m='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert-engine</title>\n<path d="M16 18.673c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM2.667 16c0-3.092 1.083-6.105 3.047-8.484 0.469-0.568 0.389-1.408-0.179-1.877-0.568-0.468-1.408-0.388-1.877 0.179-2.359 2.857-3.657 6.473-3.657 10.183s1.299 7.325 3.657 10.183c0.264 0.319 0.645 0.484 1.029 0.484 0.299 0 0.6-0.1 0.848-0.305 0.568-0.469 0.648-1.309 0.179-1.877-1.964-2.379-3.047-5.392-3.047-8.484zM16 10.667c-0.736 0-1.333 0.597-1.333 1.333v4c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-4c0-0.736-0.597-1.333-1.333-1.333zM16 5.333c-5.881 0-10.667 4.785-10.667 10.667s4.785 10.667 10.667 10.667 10.667-4.785 10.667-10.667-4.785-10.667-10.667-10.667zM16 24c-4.412 0-8-3.588-8-8s3.588-8 8-8 8 3.588 8 8-3.588 8-8 8zM28.343 5.817c-0.469-0.567-1.307-0.647-1.877-0.179-0.568 0.469-0.648 1.309-0.179 1.877 1.964 2.379 3.047 5.392 3.047 8.484s-1.083 6.105-3.047 8.484c-0.469 0.568-0.389 1.408 0.179 1.877 0.249 0.205 0.549 0.305 0.848 0.305 0.384 0 0.765-0.165 1.028-0.484 2.36-2.857 3.659-6.473 3.659-10.183s-1.299-7.325-3.657-10.183z"></path>\n</svg>\n';const b=class{constructor(t){s(this,t),this.drawerVisibilityChanged=a(this,"drawerVisibilityChanged"),this.isClosable=!0,this.width="md",this.position="right",this.visible=!1,this.hasSkeleton=!1,this.isLoading=!1,this.subTitleFirst=!1,this.noPadding=!1,this.subTitle="",this.centered=!1,this.iconStyle=void 0,salla.event.on("drawer::open",(s=>s==this.host.id&&this.open())),salla.event.on("drawer::close",(s=>s==this.host.id&&this.close())),this.drawerTitle=this.host.getAttribute("drawer-title")}handleVisible(s){if(!s)return this.drawerVisibilityChanged.emit(!1),void this.toggleDrawer(!1);this.drawerVisibilityChanged.emit(!0),this.host.classList.remove("s-hidden"),setTimeout((()=>this.toggleDrawer(!0)))}handleKeyUp(s){"Escape"===s.key&&this.closeDrawer()}async open(){return this.host.setAttribute("visible",""),this.handleAutoFocus(),this.host}async close(){return this.host.removeAttribute("visible"),this.host}async setTitle(s){return this.drawerTitle=s,this.host}async loading(){return this.isLoading=!0,this.host}async stopLoading(){return this.isLoading=!1,this.host}handleAutoFocus(){const s=this.host.querySelector("input, textarea, select");s&&setTimeout((()=>{s.focus()}),100)}toggleDrawer(s){const t=this.host.querySelector(".s-drawer-body");d.toggleElementClassIf(t,"s-drawer-entering","s-drawer-leaving",(()=>s)).toggleElementClassIf(this.overlay,"s-drawer-entering","s-drawer-overlay-leaving",(()=>s)).toggleElementClassIf(document.body,"drawer-is-open","drawer-is-closed",(()=>s)),s||setTimeout((()=>this.host.classList.add("s-hidden")),350)}closeDrawer(s){this.isClosable&&(salla.event.dispatch("drawer::close",{reason:s}),this.host.removeAttribute("visible"))}iconBlockClasses(){return{"s-drawer-icon":!0,"s-drawer-bg-error":"error"==this.iconStyle,"s-drawer-bg-success":"success"==this.iconStyle,"s-drawer-bg-normal":!this.iconStyle,"s-drawer-bg-primary":"primary"==this.iconStyle}}getWidth(){return this.isLoading?this.hasSkeleton?"md":"xs":this.width}render(){return this.host.id=this.host.id||"salla-drawer",this.isLoading?t(i,{class:"salla-drawer s-drawer s-drawer-container s-hidden","aria-modal":"true",role:"dialog",onKeyUp:s=>this.handleKeyUp(s)},t("div",{class:"s-drawer-overlay s-drawer-overlay-leaving",ref:s=>this.overlay=s,onClick:()=>this.closeDrawer("backdropClick")}),t("div",{class:"s-drawer-wrapper s-drawer-wrapper-"+this.position},t("div",{class:"s-drawer-body flex justify-center s-drawer-leaving s-drawer-"+this.position+" s-drawer-"+this.getWidth()+(this.noPadding?" s-drawer-nopadding":" s-drawer-padding")},t("slot",{name:"loading"},t("salla-loading",null)),t("div",{class:"s-hidden"},t("slot",null))))):t(i,{class:"salla-drawer s-drawer s-drawer-container s-hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-drawer-overlay s-drawer-overlay-leaving",ref:s=>this.overlay=s,onClick:()=>this.closeDrawer("backdropClick")}),t("div",{class:"s-drawer-wrapper s-drawer-wrapper-"+this.position},t("div",{class:"s-drawer-body s-drawer-leaving s-drawer-"+this.position+" s-drawer-"+this.getWidth()+(this.noPadding?" s-drawer-nopadding":" s-drawer-padding")},t("div",{class:{"s-drawer-header":!0,"s-drawer-is-center":this.centered}},this.isClosable?t("button",{class:"s-drawer-close",onClick:()=>this.closeDrawer("closeButtonClick"),type:"button"},t("span",{innerHTML:o})):"",this.drawerTitle||this.subTitle?t("div",{class:"s-drawer-header-inner"},t("slot",{name:"icon"},this.iconStyle?t("div",{class:this.iconBlockClasses(),innerHTML:"error"==this.iconStyle?m:n}):""),t("div",{class:"s-drawer-header-content"},this.drawerTitle?t("div",{class:{"s-drawer-title":!0,"s-drawer-title-below":this.subTitleFirst},innerHTML:this.drawerTitle}):"",this.subTitle?t("p",{class:{"s-drawer-sub-title":!0},innerHTML:this.subTitle}):"")):""),t("slot",null),t("slot",{name:"footer"}))))}componentDidLoad(){document.body.append(this.host)}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}};b.style="";const p=class{constructor(t){s(this,t),this.size=32,this.width=2,this.color=void 0,this.bgColor="#e5e7eb"}render(){return t(i,{key:"64a270526fd172b66a0671749bf36acee7cc8de1",class:"s-loading-container"},t("svg",{key:"380bae806d8aa39e3ac07fba3daf181cfe040f70","aria-hidden":"true",style:{width:`${this.size}px`,height:`${this.size}px`,fill:this.color,color:this.bgColor},class:"s-loading",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{key:"c531098ed793fcd2ec90f10bfb470bcc4543b346",d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),t("path",{key:"cc6b89a57e8168937ee13b5ccdc25aa024e05223",d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})))}};p.style=".s-loading{animation:spin 1s linear infinite;fill:var(--color-primary)}.s-loading-container{display:flex;justify-content:center;align-items:center}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";const g=class{constructor(t){s(this,t),this.modalVisibilityChanged=a(this,"modalVisibilityChanged"),this.isClosable=!0,this.width="md",this.position="middle",this.visible=!1,this.hasSkeleton=!1,this.isLoading=!1,this.subTitleFirst=!1,this.noPadding=!1,this.subTitle="",this.centered=!1,this.iconStyle=void 0,salla.event.on("modal::open",(s=>s==this.host.id&&this.open())),salla.event.on("modal::close",(s=>s==this.host.id&&this.close())),this.modalTitle=this.host.getAttribute("modal-title")}handleVisible(s){if(!s)return this.modalVisibilityChanged.emit(!1),void this.toggleModal(!1);this.modalVisibilityChanged.emit(!0),this.host.classList.remove("s-hidden"),setTimeout((()=>this.toggleModal(!0)))}handleKeyUp(s){"KeyUp"===s.key&&this.closeModal()}async open(){return this.host.setAttribute("visible",""),this.handleAutoFocus(),this.host}async close(){return this.host.removeAttribute("visible"),this.host}async setTitle(s){return this.modalTitle=s,this.host}async loading(){return this.isLoading=!0,this.host}async stopLoading(){return this.isLoading=!1,this.host}handleAutoFocus(){const s=this.host.querySelector("input, textarea, select");s&&setTimeout((()=>{s.focus()}),100)}toggleModal(s){const t=this.host.querySelector(".s-modal-body");d.toggleElementClassIf(t,"s-modal-entering","s-modal-leaving",(()=>s)).toggleElementClassIf(this.overlay,"s-modal-entering","s-modal-overlay-leaving",(()=>s)).toggleElementClassIf(document.body,"modal-is-open","modal-is-closed",(()=>s)),s||setTimeout((()=>this.host.classList.add("s-hidden")),350)}closeModal(s){this.isClosable&&(salla.event.dispatch("modal::close",{reason:s}),this.host.removeAttribute("visible"))}iconBlockClasses(){return{"s-modal-icon":!0,"s-modal-bg-error":"error"==this.iconStyle,"s-modal-bg-success":"success"==this.iconStyle,"s-modal-bg-normal":!this.iconStyle,"s-modal-bg-primary":"primary"==this.iconStyle}}getWidth(){return this.isLoading?this.hasSkeleton?"md":"xs":this.width}render(){return this.host.id=this.host.id||"salla-modal",this.isLoading?t(i,{class:"salla-modal s-modal s-modal-container s-hidden","aria-modal":"true",role:"dialog",onKeyUp:s=>this.handleKeyUp(s)},t("div",{class:"s-modal-overlay",ref:s=>this.overlay=s,onClick:()=>this.closeModal("backdropClick")}),t("div",{class:"s-modal-wrapper"},t("span",{class:"s-modal-spacer s-modal-align-"+this.position},"​"),t("div",{class:"s-modal-body s-modal-align-"+this.position+" s-modal-"+this.getWidth()+(this.noPadding?" s-modal-nopadding":" s-modal-padding")},t("slot",{name:"loading"},t("salla-loading",null)),t("div",{class:"s-hidden"},t("slot",null))))):t(i,{class:"salla-modal s-modal s-modal-container s-hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-modal-overlay",ref:s=>this.overlay=s,onClick:()=>this.closeModal("backdropClick")}),t("div",{class:"s-modal-wrapper"},t("span",{class:"s-modal-spacer s-modal-align-"+this.position},"​"),t("div",{class:"s-modal-body s-modal-align-"+this.position+" s-modal-"+this.getWidth()+(this.noPadding?" s-modal-nopadding":" s-modal-padding")},t("div",{class:{"s-modal-header":!0,"s-modal-is-center":this.centered}},this.isClosable?t("button",{class:"s-modal-close",onClick:()=>this.closeModal("closeButtonClick"),type:"button"},t("span",{innerHTML:o})):"",this.modalTitle||this.subTitle?t("div",{class:"s-modal-header-inner"},t("slot",{name:"icon"},this.iconStyle?t("div",{class:this.iconBlockClasses(),innerHTML:"error"==this.iconStyle?m:n}):""),t("div",{class:"s-modal-header-content"},this.modalTitle?t("div",{class:{"s-modal-title":!0,"s-modal-title-below":this.subTitleFirst},innerHTML:this.modalTitle}):"",this.subTitle?t("p",{class:{"s-modal-sub-title":!0},innerHTML:this.subTitle}):"")):""),t("slot",null),t("slot",{name:"footer"}))))}componentDidLoad(){document.body.append(this.host)}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}};g.style="@media screen and (max-width: 470px){.modal-is-open{position:fixed;width:100%}}";export{h as salla_accordion,c as salla_breadcrumb,u as salla_button,b as salla_drawer,p as salla_loading,g as salla_modal}
4
+ import{r as s,h as t,H as i,a as e,c as a}from"./p-CvIpy7Cj.js";import{A as r,a as l}from"./p-Vqpj4CWE.js";import{C as o}from"./p-BsLF_HK7.js";import{C as n}from"./p-BV4kqbdL.js";import{H as d}from"./p-CHf8XdiS.js";import"./p-CgtvEd63.js";const h=class{constructor(t){s(this,t),this.collapsible=!0,this.bordered=!1,this.size="md",this.collapsed=!0,this.dir=document.dir||"rtl"}directionChangedHandler(s){this.dir=s.detail.dir}handleCollapse(s){this.collapsed=s.detail.payload.collapsed}setcollapsibleProp(){const s=this.host.querySelector("salla-accordion-head");this.collapsible&&s&&(s.setAttribute("collapsible","true"),s.setAttribute("collapsed",this.collapsed.toString()))}componentDidRender(){this.setcollapsibleProp();const s=this.host.querySelector("salla-accordion-body");this.collapsible&&(this.host.setAttribute("data-collapsed",this.collapsed.toString()),s?.setAttribute("data-collapsed",this.collapsed.toString()))}render(){return t(i,{key:"fb12197f13d8836304bfebb14400c79c8c4d31f0",class:`s-accordion-wrapper ${this.dir} ${this.bordered?"s-accordion-wrapper-bordered":""} ${this.size?`size-${this.size}`:""}`,"data-collapsed":this.collapsed.toString()},t("slot",{key:"460e8d7238bf9f014fe0bbb6c0da592c8cb3e15e"}))}get host(){return e(this)}};h.style="";const c=class{constructor(t){s(this,t),this.sessionStorageKey="breadcrumb_snapshot",this.itemSlot=this.host.querySelector('[slot="item"]')?.outerHTML||'<li class="s-breadcrumb-item"><a href={url}>{title}</a></li>',this.iconSlot=this.host.querySelector('[slot="icon"]')?.outerHTML}componentWillLoad(){return new Promise((s=>salla.onReady((()=>salla.lang.onLoaded(s))))).then((()=>{if(salla.url.is_page("index"))throw new Error("salla-breadcrumb:: breadcrumb not supported on home page")})).then((()=>{if(!salla.config.get("theme.settings.is_breadcrumbs_enabled",!0))throw new Error("salla-breadcrumb:: merchant disabled the feature")})).then((()=>{const s=salla.config.get("page");if(!s||!s.slug)return salla.logger.error('salla-breadcrumbs:: page object not existed on salla.config.get("page")!'),void(this.breadcrumbs=[]);let t=this.getSessionBreadcrumbs(),i=t[t.length-1];return"product.single"===s.slug&&t&&t.length>0&&i?.url&&s.parent?.url&&i.url===s.parent.url?(t.push({title:s.title,url:s.url}),this.breadcrumbs=this.setBreadcrumbsFromArray(t),this.storeBreadcrumbSnapshot()):t&&t.length>0?this.isNewPage(s,t)?(this.breadcrumbs=this.generateBreadcrumbs(s),this.storeBreadcrumbSnapshot()):this.breadcrumbs=this.setBreadcrumbsFromArray(t):(this.breadcrumbs=this.generateBreadcrumbs(s),this.storeBreadcrumbSnapshot()),this.breadcrumbs?.length&&(this.breadcrumbs[this.breadcrumbs.length-1].is_last=!0),this.breadcrumbs})).catch((s=>{salla.logger.error("salla-breadcrumb:: unexpected error!",s),this.breadcrumbs=[]}))}getSessionBreadcrumbs(){return"search-bar"===new URLSearchParams(window.location.search).get("from")?[]:JSON.parse(sessionStorage.getItem(this.sessionStorageKey)||"[]")}isNewPage(s,t){const i=t[t.length-1];return i?.url!==s.url}setBreadcrumbsFromArray(s){return s.map(((t,i)=>({...t,is_last:i===s.length-1})))}sanitizeBreadcrumbTitle(s,t=1){return s.includes("|")?s.split("|").map((s=>s.trim()))[t]:s.trim()}generateBreadcrumbs(s){let t=[];if("product.single"===s.slug){const t=this.getSessionBreadcrumbs(),i=t[t.length-1];if(t.length>0&&i?.url&&s.parent?.url&&i.url===s.parent.url)return this.setBreadcrumbsFromArray([...t,{title:s.title,url:s.url}])}let i=s;for(;i;)i.title&&t.unshift({title:i.title,url:i.url}),i=i.parent;return s.slug.includes("customer")&&"customer.profile"!==s.slug&&t.unshift({title:salla.lang.get("common.titles.profile"),url:salla.url.get("profile")}),s.slug.includes("blog")&&t.unshift({title:salla.lang.get("blocks.footer.blog"),url:salla.url.get("blog")}),"brands.single"===s.slug&&t.unshift({title:salla.lang.get("common.titles.brands"),url:salla.url.get("brands")}),s.title||"loyalty"!==s.slug||t.unshift({title:salla.lang.get("common.titles.loyalty_program"),url:salla.url.get("loyalty")}),t.unshift({title:salla.lang.get("common.titles.home"),url:salla.url.get("")}),t}storeBreadcrumbSnapshot(){try{const s=salla.config.get("page");if("product.single"===s?.slug)return;const t=[...this.breadcrumbs],i=t.length-1;i>=0&&(t[i].url=window.location.href);const e=JSON.stringify(t);sessionStorage.setItem(this.sessionStorageKey,e)}catch(s){salla.logger.error("salla-breadcrumb:: Failed to store breadcrumb snapshot in sessionStorage.",s)}}render(){return this.breadcrumbs.length<=1?(salla.log("salla-breadcrumb:: There is no breadcrumbs!"),null):t("ol",{class:{"s-breadcrumb-wrapper":!0,"s-breadcrumb-dark":salla.url.is_page("loyalty"),"s-breadcrumb-primary-reverse":salla.config.get("page.slug").includes("customer")}},this.breadcrumbs.map((s=>{const i="product.single"===salla.config.get("page.slug")&&s.is_last?s.title:this.sanitizeBreadcrumbTitle(s.title),e=this.itemSlot.replace(/\{url\}/g,s.url).replace(/\{title\}/g,i);return[t("div",{class:"s-breadcrumb-slot",innerHTML:e}),this.getArrowDomForItem(s)]})))}getArrowDomForItem(s){if(s.is_last)return"";let i=this.iconSlot||(salla.config.get("theme.is_rtl",!0)?r:l);return t("li",{class:"s-breadcrumb-arrow"},t("div",{class:{"s-breadcrumb-icon-slot":!0,"s-breadcrumb-default-icon":!this.iconSlot},innerHTML:i}))}componentDidRender(){this.host.querySelectorAll(".s-breadcrumb-slot").forEach((s=>s.replaceWith(s.firstChild))),this.host.querySelectorAll(".s-breadcrumb-icon-slot.s-breadcrumb-default-icon").forEach((s=>s.replaceWith(s.querySelector("svg")))),this.host.querySelector('[slot="item"]')?.remove(),this.host.querySelector('[slot="icon"]')?.remove();let s=this.host.querySelectorAll(".s-breadcrumb-item")[this.breadcrumbs.length-1]?.querySelector("a");s&&s.replaceWith(s.firstChild)}get host(){return e(this)}};c.style=":host{display:block}";const u=class{constructor(t){s(this,t),this.shape="btn",this.color="primary",this.fill="solid",this.size="medium",this.width="normal",this.loading=!1,this.disabled=!1,this.loaderPosition="after",this.type="button"}async load(){return"center"==this.loaderPosition&&this.text.classList.add("s-button-hide"),this.host.setAttribute("loading",""),this.host}async stop(){return this.host.removeAttribute("loading"),this.host.querySelector("button").removeAttribute("loading"),"center"==this.loaderPosition&&this.text.classList.remove("s-button-hide"),this.host}async setText(s){return this.text.innerHTML=s,this.host}async disable(){return this.host.setAttribute("disabled",""),this.host}async enable(){return this.host.removeAttribute("disabled"),this.host}getBtnAttributes(){const s={};for(let t=0;t<this.host.attributes.length;t++)["color","fill","size","width","id"].includes(this.host.attributes[t].name)||(s[this.host.attributes[t].name]=this.host.attributes[t].value);s.type=s.type||this.type;const t=s.class||"";return s.class=t+" s-button-element s-button-"+this.shape+" s-button-"+("none"==this.fill?"fill-none":this.fill)+("medium"!=this.size?" s-button-"+this.size:"")+("normal"!=this.width?" s-button-"+this.width:"")+("link"==this.shape?" s-button-"+this.color+"-link":"")+("link"!=this.shape&&"outline"!=this.fill?" s-button-"+this.color:"")+("outline"==this.fill?" s-button-"+this.color+"-outline":"")+(this.disabled?" s-button-disabled ":"")+("icon"==this.shape?" s-button-loader-center":" s-button-loader-"+this.loaderPosition),s["aria-label"]||s["aria-labelledby"]||(this.host.textContent||"").trim()||(t.includes("btn--wishlist")||t.includes("wishlist")?s["aria-label"]=salla.lang.getWithDefault("pages.products.add_to_wishlist","Add or remove to wishlist"):"icon"===this.shape&&console.warn("Icon button is missing aria-label attribute")),s}button(){return t("button",{...this.getBtnAttributes(),disabled:this.disabled},t("span",{class:"s-button-text",ref:s=>this.text=s},t("slot",null)),this.loading?t("span",{class:"s-button-loader"}):"")}render(){return this.host.closest(".swiper-slide")?.classList.contains("swiper-slide-duplicate")?"":t(i,{class:"s-button-wrap"},this.href?t("a",{href:this.href},this.button()):this.button())}get host(){return e(this)}};u.style="";var m='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert-engine</title>\n<path d="M16 18.673c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM2.667 16c0-3.092 1.083-6.105 3.047-8.484 0.469-0.568 0.389-1.408-0.179-1.877-0.568-0.468-1.408-0.388-1.877 0.179-2.359 2.857-3.657 6.473-3.657 10.183s1.299 7.325 3.657 10.183c0.264 0.319 0.645 0.484 1.029 0.484 0.299 0 0.6-0.1 0.848-0.305 0.568-0.469 0.648-1.309 0.179-1.877-1.964-2.379-3.047-5.392-3.047-8.484zM16 10.667c-0.736 0-1.333 0.597-1.333 1.333v4c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-4c0-0.736-0.597-1.333-1.333-1.333zM16 5.333c-5.881 0-10.667 4.785-10.667 10.667s4.785 10.667 10.667 10.667 10.667-4.785 10.667-10.667-4.785-10.667-10.667-10.667zM16 24c-4.412 0-8-3.588-8-8s3.588-8 8-8 8 3.588 8 8-3.588 8-8 8zM28.343 5.817c-0.469-0.567-1.307-0.647-1.877-0.179-0.568 0.469-0.648 1.309-0.179 1.877 1.964 2.379 3.047 5.392 3.047 8.484s-1.083 6.105-3.047 8.484c-0.469 0.568-0.389 1.408 0.179 1.877 0.249 0.205 0.549 0.305 0.848 0.305 0.384 0 0.765-0.165 1.028-0.484 2.36-2.857 3.659-6.473 3.659-10.183s-1.299-7.325-3.657-10.183z"></path>\n</svg>\n';const b=class{constructor(t){s(this,t),this.drawerVisibilityChanged=a(this,"drawerVisibilityChanged"),this.isClosable=!0,this.width="md",this.position="right",this.visible=!1,this.hasSkeleton=!1,this.isLoading=!1,this.subTitleFirst=!1,this.noPadding=!1,this.subTitle="",this.centered=!1,this.iconStyle=void 0,salla.event.on("drawer::open",(s=>s==this.host.id&&this.open())),salla.event.on("drawer::close",(s=>s==this.host.id&&this.close())),this.drawerTitle=this.host.getAttribute("drawer-title")}handleVisible(s){if(!s)return this.drawerVisibilityChanged.emit(!1),void this.toggleDrawer(!1);this.drawerVisibilityChanged.emit(!0),this.host.classList.remove("s-hidden"),setTimeout((()=>this.toggleDrawer(!0)))}handleKeyUp(s){"Escape"===s.key&&this.closeDrawer()}async open(){return this.host.setAttribute("visible",""),this.handleAutoFocus(),this.host}async close(){return this.host.removeAttribute("visible"),this.host}async setTitle(s){return this.drawerTitle=s,this.host}async loading(){return this.isLoading=!0,this.host}async stopLoading(){return this.isLoading=!1,this.host}handleAutoFocus(){const s=this.host.querySelector("input, textarea, select");s&&setTimeout((()=>{s.focus()}),100)}toggleDrawer(s){const t=this.host.querySelector(".s-drawer-body");d.toggleElementClassIf(t,"s-drawer-entering","s-drawer-leaving",(()=>s)).toggleElementClassIf(this.overlay,"s-drawer-entering","s-drawer-overlay-leaving",(()=>s)).toggleElementClassIf(document.body,"drawer-is-open","drawer-is-closed",(()=>s)),s||setTimeout((()=>this.host.classList.add("s-hidden")),350)}closeDrawer(s){this.isClosable&&(salla.event.dispatch("drawer::close",{reason:s}),this.host.removeAttribute("visible"))}iconBlockClasses(){return{"s-drawer-icon":!0,"s-drawer-bg-error":"error"==this.iconStyle,"s-drawer-bg-success":"success"==this.iconStyle,"s-drawer-bg-normal":!this.iconStyle,"s-drawer-bg-primary":"primary"==this.iconStyle}}getWidth(){return this.isLoading?this.hasSkeleton?"md":"xs":this.width}render(){return this.host.id=this.host.id||"salla-drawer",this.isLoading?t(i,{class:"salla-drawer s-drawer s-drawer-container s-hidden","aria-modal":"true",role:"dialog",onKeyUp:s=>this.handleKeyUp(s)},t("div",{class:"s-drawer-overlay s-drawer-overlay-leaving",ref:s=>this.overlay=s,onClick:()=>this.closeDrawer("backdropClick")}),t("div",{class:"s-drawer-wrapper s-drawer-wrapper-"+this.position},t("div",{class:"s-drawer-body flex justify-center s-drawer-leaving s-drawer-"+this.position+" s-drawer-"+this.getWidth()+(this.noPadding?" s-drawer-nopadding":" s-drawer-padding")},t("slot",{name:"loading"},t("salla-loading",null)),t("div",{class:"s-hidden"},t("slot",null))))):t(i,{class:"salla-drawer s-drawer s-drawer-container s-hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-drawer-overlay s-drawer-overlay-leaving",ref:s=>this.overlay=s,onClick:()=>this.closeDrawer("backdropClick")}),t("div",{class:"s-drawer-wrapper s-drawer-wrapper-"+this.position},t("div",{class:"s-drawer-body s-drawer-leaving s-drawer-"+this.position+" s-drawer-"+this.getWidth()+(this.noPadding?" s-drawer-nopadding":" s-drawer-padding")},t("div",{class:{"s-drawer-header":!0,"s-drawer-is-center":this.centered}},this.isClosable?t("button",{class:"s-drawer-close",onClick:()=>this.closeDrawer("closeButtonClick"),type:"button"},t("span",{innerHTML:o})):"",this.drawerTitle||this.subTitle?t("div",{class:"s-drawer-header-inner"},t("slot",{name:"icon"},this.iconStyle?t("div",{class:this.iconBlockClasses(),innerHTML:"error"==this.iconStyle?m:n}):""),t("div",{class:"s-drawer-header-content"},this.drawerTitle?t("div",{class:{"s-drawer-title":!0,"s-drawer-title-below":this.subTitleFirst},innerHTML:this.drawerTitle}):"",this.subTitle?t("p",{class:{"s-drawer-sub-title":!0},innerHTML:this.subTitle}):"")):""),t("slot",null),t("slot",{name:"footer"}))))}componentDidLoad(){document.body.append(this.host)}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}};b.style="";const p=class{constructor(t){s(this,t),this.size=32,this.width=2,this.color=void 0,this.bgColor="#e5e7eb"}render(){return t(i,{key:"64a270526fd172b66a0671749bf36acee7cc8de1",class:"s-loading-container"},t("svg",{key:"380bae806d8aa39e3ac07fba3daf181cfe040f70","aria-hidden":"true",style:{width:`${this.size}px`,height:`${this.size}px`,fill:this.color,color:this.bgColor},class:"s-loading",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{key:"c531098ed793fcd2ec90f10bfb470bcc4543b346",d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),t("path",{key:"cc6b89a57e8168937ee13b5ccdc25aa024e05223",d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})))}};p.style=".s-loading{animation:spin 1s linear infinite;fill:var(--color-primary)}.s-loading-container{display:flex;justify-content:center;align-items:center}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";const g=class{constructor(t){s(this,t),this.modalVisibilityChanged=a(this,"modalVisibilityChanged"),this.isClosable=!0,this.width="md",this.position="middle",this.visible=!1,this.hasSkeleton=!1,this.isLoading=!1,this.subTitleFirst=!1,this.noPadding=!1,this.subTitle="",this.centered=!1,this.iconStyle=void 0,salla.event.on("modal::open",(s=>s==this.host.id&&this.open())),salla.event.on("modal::close",(s=>s==this.host.id&&this.close())),this.modalTitle=this.host.getAttribute("modal-title")}handleVisible(s){if(!s)return this.modalVisibilityChanged.emit(!1),void this.toggleModal(!1);this.modalVisibilityChanged.emit(!0),this.host.classList.remove("s-hidden"),setTimeout((()=>this.toggleModal(!0)))}handleKeyUp(s){"KeyUp"===s.key&&this.closeModal()}async open(){return this.host.setAttribute("visible",""),this.handleAutoFocus(),this.host}async close(){return this.host.removeAttribute("visible"),this.host}async setTitle(s){return this.modalTitle=s,this.host}async loading(){return this.isLoading=!0,this.host}async stopLoading(){return this.isLoading=!1,this.host}handleAutoFocus(){const s=this.host.querySelector("input, textarea, select");s&&setTimeout((()=>{s.focus()}),100)}toggleModal(s){const t=this.host.querySelector(".s-modal-body");d.toggleElementClassIf(t,"s-modal-entering","s-modal-leaving",(()=>s)).toggleElementClassIf(this.overlay,"s-modal-entering","s-modal-overlay-leaving",(()=>s)).toggleElementClassIf(document.body,"modal-is-open","modal-is-closed",(()=>s)),s||setTimeout((()=>this.host.classList.add("s-hidden")),350)}closeModal(s){this.isClosable&&(salla.event.dispatch("modal::close",{reason:s}),this.host.removeAttribute("visible"))}iconBlockClasses(){return{"s-modal-icon":!0,"s-modal-bg-error":"error"==this.iconStyle,"s-modal-bg-success":"success"==this.iconStyle,"s-modal-bg-normal":!this.iconStyle,"s-modal-bg-primary":"primary"==this.iconStyle}}getWidth(){return this.isLoading?this.hasSkeleton?"md":"xs":this.width}render(){return this.host.id=this.host.id||"salla-modal",this.isLoading?t(i,{class:"salla-modal s-modal s-modal-container s-hidden","aria-modal":"true",role:"dialog",onKeyUp:s=>this.handleKeyUp(s)},t("div",{class:"s-modal-overlay",ref:s=>this.overlay=s,onClick:()=>this.closeModal("backdropClick")}),t("div",{class:"s-modal-wrapper"},t("span",{class:"s-modal-spacer s-modal-align-"+this.position},"​"),t("div",{class:"s-modal-body s-modal-align-"+this.position+" s-modal-"+this.getWidth()+(this.noPadding?" s-modal-nopadding":" s-modal-padding")},t("slot",{name:"loading"},t("salla-loading",null)),t("div",{class:"s-hidden"},t("slot",null))))):t(i,{class:"salla-modal s-modal s-modal-container s-hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-modal-overlay",ref:s=>this.overlay=s,onClick:()=>this.closeModal("backdropClick")}),t("div",{class:"s-modal-wrapper"},t("span",{class:"s-modal-spacer s-modal-align-"+this.position},"​"),t("div",{class:"s-modal-body s-modal-align-"+this.position+" s-modal-"+this.getWidth()+(this.noPadding?" s-modal-nopadding":" s-modal-padding")},t("div",{class:{"s-modal-header":!0,"s-modal-is-center":this.centered}},this.isClosable?t("button",{class:"s-modal-close",onClick:()=>this.closeModal("closeButtonClick"),type:"button"},t("span",{innerHTML:o})):"",this.modalTitle||this.subTitle?t("div",{class:"s-modal-header-inner"},t("slot",{name:"icon"},this.iconStyle?t("div",{class:this.iconBlockClasses(),innerHTML:"error"==this.iconStyle?m:n}):""),t("div",{class:"s-modal-header-content"},this.modalTitle?t("div",{class:{"s-modal-title":!0,"s-modal-title-below":this.subTitleFirst},innerHTML:this.modalTitle}):"",this.subTitle?t("p",{class:{"s-modal-sub-title":!0},innerHTML:this.subTitle}):"")):""),t("slot",null),t("slot",{name:"footer"}))))}componentDidLoad(){document.body.append(this.host)}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}};g.style="@media screen and (max-width: 470px){.modal-is-open{position:fixed;width:100%}}";export{h as salla_accordion,c as salla_breadcrumb,u as salla_button,b as salla_drawer,p as salla_loading,g as salla_modal}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as t,F as e}from"./p-Dbv0I4re.js";const l=class{constructor(t){s(this,t),this.source="header",this.useReactLink=!1,this.menus=[]}async componentWillLoad(){return salla.onReady((()=>{if(this.displayAllText=salla.lang.get("blocks.home.display_all"),!this.sourceValue||"json"!==this.source)return this.getMenuItems();this.menus="string"==typeof this.sourceValue?JSON.parse(this.sourceValue):this.sourceValue||[]}))}getMenuItems(){return salla.api.component.getMenus(this.source).then((({data:s})=>{this.menus=s})).catch((s=>{salla.logger.error("salla-menu::Error fetching menus",s)}))}hasChildren(s){return s?.children?.length>0}hasProducts(s){return s?.products?.length>0}getDesktopClasses(s,t){return`!hidden lg:!block ${t?"root-level lg:!inline-block":"relative"} ${s.products?" mega-menu":""}\n ${this.hasChildren(s)?"has-children":""}`}getAttributes(s){return s.trim().split(" ").reduce(((s,t)=>{let[e,l]=t.split("=");return s[e]=l.replace(/"/g,""),s}),{})}getMobileMenu(s,l){const i=s.image?t("img",{src:s.image,class:"rounded-full",width:"48",height:"48",alt:s.title}):null;return t("li",{class:"lg:hidden text-sm font-bold",...this.getAttributes(s.attrs)},this.hasChildren(s)?t(e,null,t("span",{class:s.image?"!py-3":""},i,s.title),t("ul",null,t("li",{class:"text-sm font-bold"},t("a",{href:s.url,class:"text-gray-500"},l)),s.children.map((s=>this.getMobileMenu(s,l))))):t("a",{href:s.url,"aria-label":s.title||"category",class:"text-gray-500 "+(s.image?"!py-3":""),...this.getAttributes(s.link_attrs)},i,t("span",null,s.title||"")))}getDesktopMenu(s,e){return t("li",{class:this.getDesktopClasses(s,e),...this.getAttributes(s.attrs)},t("a",{href:s.url,"aria-label":s.title||"category",...this.getAttributes(s.link_attrs)},t("span",null,s.title)),this.hasChildren(s)?t("div",{class:"sub-menu shadow-default "+(this.hasProducts(s)?"w-full left-0 flex":"w-56")},t("ul",{class:this.hasProducts(s)?"w-56 shrink-0 m-8 rtl:ml-0 ltr:mr-0":""},s.children.map((s=>this.getDesktopMenu(s,!1)))),this.hasProducts(s)?t("salla-products-list",{source:"selected","shadow-on-hover":!0,"source-value":`[${s.products}]`}):null):null)}getFooterMenu(s){const e=this.topnav||this.limit?s.slice(0,this.limit||3):s;return t("div",null,t("div",{class:{"s-menu-footer-list":!this.topnav,"s-menu-topnav-list":this.topnav}},e.map((s=>t("a",{key:s.id,href:s.url,target:s.target,class:{"s-menu-footer-item":!this.topnav,"s-menu-topnav-item topnav-link-item right-side":this.topnav}},s.title)))))}getHeaderMenu(s){return s.map((s=>[this.getMobileMenu(s,this.displayAllText),this.getDesktopMenu(s,!0)]))}render(){return"footer"===this.source?this.getFooterMenu(this.menus):[t("nav",{key:"main-nav",id:"mobile-menu",class:"mobile-menu"},t("ul",{class:"main-menu"},this.getHeaderMenu(this.menus)),t("button",{class:"btn--close close-mobile-menu sicon-cancel lg:hidden"})),t("button",{key:"close-btn",class:"btn--close-sm close-mobile-menu sicon-cancel hidden"})]}};l.style=":host{display:block}";export{l as salla_menu}
4
+ import{r as s,h as t,F as e}from"./p-CvIpy7Cj.js";const l=class{constructor(t){s(this,t),this.source="header",this.useReactLink=!1,this.menus=[]}async componentWillLoad(){return salla.onReady((()=>{if(this.displayAllText=salla.lang.get("blocks.home.display_all"),!this.sourceValue||"json"!==this.source)return this.getMenuItems();this.menus="string"==typeof this.sourceValue?JSON.parse(this.sourceValue):this.sourceValue||[]}))}getMenuItems(){return salla.api.component.getMenus(this.source).then((({data:s})=>{this.menus=s})).catch((s=>{salla.logger.error("salla-menu::Error fetching menus",s)}))}hasChildren(s){return s?.children?.length>0}hasProducts(s){return s?.products?.length>0}getDesktopClasses(s,t){return`!hidden lg:!block ${t?"root-level lg:!inline-block":"relative"} ${s.products?" mega-menu":""}\n ${this.hasChildren(s)?"has-children":""}`}getAttributes(s){return s.trim().split(" ").reduce(((s,t)=>{let[e,l]=t.split("=");return s[e]=l.replace(/"/g,""),s}),{})}getMobileMenu(s,l){const i=s.image?t("img",{src:s.image,class:"rounded-full",width:"48",height:"48",alt:s.title}):null;return t("li",{class:"lg:hidden text-sm font-bold",...this.getAttributes(s.attrs)},this.hasChildren(s)?t(e,null,t("span",{class:s.image?"!py-3":""},i,s.title),t("ul",null,t("li",{class:"text-sm font-bold"},t("a",{href:s.url,class:"text-gray-500"},l)),s.children.map((s=>this.getMobileMenu(s,l))))):t("a",{href:s.url,"aria-label":s.title||"category",class:"text-gray-500 "+(s.image?"!py-3":""),...this.getAttributes(s.link_attrs)},i,t("span",null,s.title||"")))}getDesktopMenu(s,e){return t("li",{class:this.getDesktopClasses(s,e),...this.getAttributes(s.attrs)},t("a",{href:s.url,"aria-label":s.title||"category",...this.getAttributes(s.link_attrs)},t("span",null,s.title)),this.hasChildren(s)?t("div",{class:"sub-menu shadow-default "+(this.hasProducts(s)?"w-full left-0 flex":"w-56")},t("ul",{class:this.hasProducts(s)?"w-56 shrink-0 m-8 rtl:ml-0 ltr:mr-0":""},s.children.map((s=>this.getDesktopMenu(s,!1)))),this.hasProducts(s)?t("salla-products-list",{source:"selected","shadow-on-hover":!0,"source-value":`[${s.products}]`}):null):null)}getFooterMenu(s){const e=this.topnav||this.limit?s.slice(0,this.limit||3):s;return t("div",null,t("div",{class:{"s-menu-footer-list":!this.topnav,"s-menu-topnav-list":this.topnav}},e.map((s=>t("a",{key:s.id,href:s.url,target:s.target,class:{"s-menu-footer-item":!this.topnav,"s-menu-topnav-item topnav-link-item right-side":this.topnav}},s.title)))))}getHeaderMenu(s){return s.map((s=>[this.getMobileMenu(s,this.displayAllText),this.getDesktopMenu(s,!0)]))}render(){return"footer"===this.source?this.getFooterMenu(this.menus):[t("nav",{key:"main-nav",id:"mobile-menu",class:"mobile-menu"},t("ul",{class:"main-menu"},this.getHeaderMenu(this.menus)),t("button",{class:"btn--close close-mobile-menu sicon-cancel lg:hidden"})),t("button",{key:"close-btn",class:"btn--close-sm close-mobile-menu sicon-cancel hidden"})]}};l.style=":host{display:block}";export{l as salla_menu}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,c as t,h as i,H as e,a as h}from"./p-Dbv0I4re.js";import{M as r}from"./p-DmgxDvXL.js";const l=class{constructor(i){s(this,i),this.verified=t(this,"verified"),this.translationLoaded=!1,this.display="modal",this.type="mobile",this.autoReload=!0,this.supportWebAuth=!0,this.resendAfter=30,this.isProfileVerify=!1,salla.lang.onLoaded((()=>{this.translationLoaded=!0,this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+this.type),this.modal?.setTitle(this.title)})),"inline"!=this.display?(salla.event.on("profile::verification",(s=>{let t=Array.isArray(s)?s[0]:s;this.isProfileVerify=!0,this.open(t),this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+t.type),this.modal?.setTitle(this.title)})),salla.event.on("modalClosed",(()=>{this.resendAfter=0,this.timer.innerHTML="30 : 00"}))):this.modal={open:()=>"",close:()=>"",setTitle:()=>""}}splitNumber(s){this.resetError();let t=s.data||s.target.value;t&&1!==t.length&&this.modifyNext(s.target,t)}modifyNext(s,t){s.value=t[0],t=t.substring(1),s.nextElementSibling&&t.length?this.modifyNext(s.nextElementSibling,t):s.nextElementSibling||0!==t.length?s.nextElementSibling&&0===t.length&&s.nextElementSibling.focus():s.focus()}checkAllInputs(){let s=!0;for(let t=0;t<this.otpInputs.length;t++)""===this.otpInputs[t].value&&(s=!1);return s}handleKeyUp(s){if(this.resetError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(s.key))return;let t=s.keyCode||s.charCode;s.target.value?(s.target.nextElementSibling?.focus(),s.target.nextElementSibling?.select()):[8,46].includes(t)&&(s.target.previousElementSibling?.focus(),s.target.previousElementSibling?.select()),s.target.value.length>1&&this.splitNumber(s)}handlePaste(s){this.resetError();let t=(salla.helpers.number(s.clipboardData.getData("text"))||"").replace(/[^0-9]/g,"");t=t.substring(0,this.otpInputs.length),this.otpInputs.forEach((s=>s.value="")),this.modifyNext(this.otpInputs[0],t)}handleInput(s){this.resetError(),salla.helpers.inputDigitsOnly(s.target),this.checkAllInputs()&&setTimeout((()=>{this.toggleOTPSubmit()}),100)}resetError(){this.hasError=!1,this.errorMessage=""}handleFocus(s){s.target!==this.firstOtpInput&&(""==this.firstOtpInput?.value&&this.firstOtpInput.focus(),""==s.target.previousElementSibling.value&&s.target.previousElementSibling.focus())}async getCode(){return this.code.value}async open(s){this.data=s,this.data.type=this.data.type||this.type,this.type=this.data.type,this.resendTimer(),this.otpInputs=this.body.querySelectorAll(".s-verify-input"),this.firstOtpInput=this.body.querySelector("#otp-1"),this.reset(),this.resetError(),"modal"==this.display&&this.modal?.setTitle(this.title),this.modal.open(),this.firstOtpInput?.addEventListener("input",(s=>this.splitNumber(s))),setTimeout((()=>this.otpInputs[0].focus()),100)}toggleOTPSubmit(){let s=[];if(this.otpInputs.forEach((t=>t.value&&s.push(t.value))),this.code.value=s.join(""),4===s.length)return this.btn.disable(),void this.btn.click();this.btn.enable()}reset(){this.otpInputs.forEach((s=>s.value="")),this.code.value="",this.otpInputs[0].focus()}resendTimer(){this.resendMessage.style.display="block",this.resend.style.display="none",this.resendAfter=30;let s=setInterval((()=>{this.resendAfter<=0?(clearInterval(s),this.resend.style.display="block",this.resendMessage.style.display="none"):(this.timer.innerHTML=`${this.resendAfter>=10?this.resendAfter:"0"+this.resendAfter} : 00`,this.resendAfter--)}),1e3)}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((s=>s.value="")),this.otpInputs[0].focus()})).then((()=>salla.api.auth.resend(this.data))).finally((()=>this.resendTimer()))}submit(){if(this.code.value.length<4)return this.otpInputs[this.code.value.length].focus(),void salla.log("Trying to submit without 4 digits!");let s={code:this.code.value,...this.data};return this.btn.load().then((()=>this.btn.disable())).then((()=>this.isProfileVerify?salla.profile.verify(s):salla.auth.verify(s,this.supportWebAuth))).then((s=>this.verified.emit(s))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.close())).then((()=>this.autoReload&&window.location.reload())).catch((s=>{this.hasError=!0,this.errorMessage=s.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"),s.response?salla.logger.error(s):console.log("Unexpected error",s),this.btn.stop()&&this.btn.enable()&&this.reset()}))}render(){return"inline"==this.display?i(e,null,this.myBody()):i("salla-modal",{width:"xs",class:"s-verify",ref:s=>this.modal=s,"modal-title":this.title},i("span",{slot:"icon",class:"s-verify-header-icon",innerHTML:"mobile"==this.type?'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>android-phone</title>\n<path d="M22.667 0h-13.333c-2.941 0-5.333 2.392-5.333 5.333v21.333c0 2.941 2.392 5.333 5.333 5.333h13.333c2.941 0 5.333-2.392 5.333-5.333v-21.333c0-2.941-2.392-5.333-5.333-5.333zM25.333 26.667c0 1.471-1.196 2.667-2.667 2.667h-13.333c-1.471 0-2.667-1.196-2.667-2.667v-2.667h18.667zM25.333 21.333h-18.667v-16c0-1.471 1.196-2.667 2.667-2.667h13.333c1.471 0 2.667 1.196 2.667 2.667zM13.333 28h5.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n':r}),this.myBody())}myBody(){return i("div",{class:"s-verify-body",ref:s=>this.body=s},i("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),i("slot",{name:"mobile"}),i("slot",{name:"email"}),i("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:s=>this.code=s}),i("div",{class:{"s-verify-codes":!0,"has-error":this.hasError},dir:"ltr"},[1,2,3,4].map((s=>i("input",{type:"number",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",value:"",id:`otp-${s}`,class:{"s-verify-input":!0,"s-has-error":this.hasError},onInput:s=>this.handleInput(s),onPaste:s=>this.handlePaste(s),onKeyUp:s=>this.handleKeyUp(s),onFocus:s=>this.handleFocus(s),required:!0})))),this.hasError&&this.errorMessage?i("span",{class:"s-verify-error-message"},this.errorMessage):"",i("div",{slot:"footer",class:"s-verify-footer"},i("salla-button",{class:"s-verify-submit","loader-position":"center",disabled:!0,onClick:()=>this.submit(),ref:s=>this.btn=s},salla.lang.get("pages.profile.verify")),i("p",{class:"s-verify-resend-message",ref:s=>this.resendMessage=s},salla.lang.get("blocks.header.resend_after"),i("b",{class:"s-verify-timer",ref:s=>this.timer=s})),i("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:s=>this.resend=s},salla.lang.get("blocks.comments.submit"))),i("slot",{name:"after-footer"}))}get host(){return h(this)}};l.style="salla-verify{display:block}.s-verify-input{}.s-verify-input::-webkit-outer-spin-button,.s-verify-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-verify-input[type=number]{-moz-appearance:textfield}";export{l as salla_verify}
4
+ import{r as s,c as t,h as i,H as e,a as h}from"./p-CvIpy7Cj.js";import{M as r}from"./p-DmgxDvXL.js";const l=class{constructor(i){s(this,i),this.verified=t(this,"verified"),this.translationLoaded=!1,this.display="modal",this.type="mobile",this.autoReload=!0,this.supportWebAuth=!0,this.resendAfter=30,this.isProfileVerify=!1,salla.lang.onLoaded((()=>{this.translationLoaded=!0,this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+this.type),this.modal?.setTitle(this.title)})),"inline"!=this.display?(salla.event.on("profile::verification",(s=>{let t=Array.isArray(s)?s[0]:s;this.isProfileVerify=!0,this.open(t),this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+t.type),this.modal?.setTitle(this.title)})),salla.event.on("modalClosed",(()=>{this.resendAfter=0,this.timer.innerHTML="30 : 00"}))):this.modal={open:()=>"",close:()=>"",setTitle:()=>""}}splitNumber(s){this.resetError();let t=s.data||s.target.value;t&&1!==t.length&&this.modifyNext(s.target,t)}modifyNext(s,t){s.value=t[0],t=t.substring(1),s.nextElementSibling&&t.length?this.modifyNext(s.nextElementSibling,t):s.nextElementSibling||0!==t.length?s.nextElementSibling&&0===t.length&&s.nextElementSibling.focus():s.focus()}checkAllInputs(){let s=!0;for(let t=0;t<this.otpInputs.length;t++)""===this.otpInputs[t].value&&(s=!1);return s}handleKeyUp(s){if(this.resetError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(s.key))return;let t=s.keyCode||s.charCode;s.target.value?(s.target.nextElementSibling?.focus(),s.target.nextElementSibling?.select()):[8,46].includes(t)&&(s.target.previousElementSibling?.focus(),s.target.previousElementSibling?.select()),s.target.value.length>1&&this.splitNumber(s)}handlePaste(s){this.resetError();let t=(salla.helpers.number(s.clipboardData.getData("text"))||"").replace(/[^0-9]/g,"");t=t.substring(0,this.otpInputs.length),this.otpInputs.forEach((s=>s.value="")),this.modifyNext(this.otpInputs[0],t)}handleInput(s){this.resetError(),salla.helpers.inputDigitsOnly(s.target),this.checkAllInputs()&&setTimeout((()=>{this.toggleOTPSubmit()}),100)}resetError(){this.hasError=!1,this.errorMessage=""}handleFocus(s){s.target!==this.firstOtpInput&&(""==this.firstOtpInput?.value&&this.firstOtpInput.focus(),""==s.target.previousElementSibling.value&&s.target.previousElementSibling.focus())}async getCode(){return this.code.value}async open(s){this.data=s,this.data.type=this.data.type||this.type,this.type=this.data.type,this.resendTimer(),this.otpInputs=this.body.querySelectorAll(".s-verify-input"),this.firstOtpInput=this.body.querySelector("#otp-1"),this.reset(),this.resetError(),"modal"==this.display&&this.modal?.setTitle(this.title),this.modal.open(),this.firstOtpInput?.addEventListener("input",(s=>this.splitNumber(s))),setTimeout((()=>this.otpInputs[0].focus()),100)}toggleOTPSubmit(){let s=[];if(this.otpInputs.forEach((t=>t.value&&s.push(t.value))),this.code.value=s.join(""),4===s.length)return this.btn.disable(),void this.btn.click();this.btn.enable()}reset(){this.otpInputs.forEach((s=>s.value="")),this.code.value="",this.otpInputs[0].focus()}resendTimer(){this.resendMessage.style.display="block",this.resend.style.display="none",this.resendAfter=30;let s=setInterval((()=>{this.resendAfter<=0?(clearInterval(s),this.resend.style.display="block",this.resendMessage.style.display="none"):(this.timer.innerHTML=`${this.resendAfter>=10?this.resendAfter:"0"+this.resendAfter} : 00`,this.resendAfter--)}),1e3)}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((s=>s.value="")),this.otpInputs[0].focus()})).then((()=>salla.api.auth.resend(this.data))).finally((()=>this.resendTimer()))}submit(){if(this.code.value.length<4)return this.otpInputs[this.code.value.length].focus(),void salla.log("Trying to submit without 4 digits!");let s={code:this.code.value,...this.data};return this.btn.load().then((()=>this.btn.disable())).then((()=>this.isProfileVerify?salla.profile.verify(s):salla.auth.verify(s,this.supportWebAuth))).then((s=>this.verified.emit(s))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.close())).then((()=>this.autoReload&&window.location.reload())).catch((s=>{this.hasError=!0,this.errorMessage=s.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"),s.response?salla.logger.error(s):console.log("Unexpected error",s),this.btn.stop()&&this.btn.enable()&&this.reset()}))}render(){return"inline"==this.display?i(e,null,this.myBody()):i("salla-modal",{width:"xs",class:"s-verify",ref:s=>this.modal=s,"modal-title":this.title},i("span",{slot:"icon",class:"s-verify-header-icon",innerHTML:"mobile"==this.type?'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>android-phone</title>\n<path d="M22.667 0h-13.333c-2.941 0-5.333 2.392-5.333 5.333v21.333c0 2.941 2.392 5.333 5.333 5.333h13.333c2.941 0 5.333-2.392 5.333-5.333v-21.333c0-2.941-2.392-5.333-5.333-5.333zM25.333 26.667c0 1.471-1.196 2.667-2.667 2.667h-13.333c-1.471 0-2.667-1.196-2.667-2.667v-2.667h18.667zM25.333 21.333h-18.667v-16c0-1.471 1.196-2.667 2.667-2.667h13.333c1.471 0 2.667 1.196 2.667 2.667zM13.333 28h5.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n':r}),this.myBody())}myBody(){return i("div",{class:"s-verify-body",ref:s=>this.body=s},i("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),i("slot",{name:"mobile"}),i("slot",{name:"email"}),i("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:s=>this.code=s}),i("div",{class:{"s-verify-codes":!0,"has-error":this.hasError},dir:"ltr"},[1,2,3,4].map((s=>i("input",{type:"number",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",value:"",id:`otp-${s}`,class:{"s-verify-input":!0,"s-has-error":this.hasError},onInput:s=>this.handleInput(s),onPaste:s=>this.handlePaste(s),onKeyUp:s=>this.handleKeyUp(s),onFocus:s=>this.handleFocus(s),required:!0})))),this.hasError&&this.errorMessage?i("span",{class:"s-verify-error-message"},this.errorMessage):"",i("div",{slot:"footer",class:"s-verify-footer"},i("salla-button",{class:"s-verify-submit","loader-position":"center",disabled:!0,onClick:()=>this.submit(),ref:s=>this.btn=s},salla.lang.get("pages.profile.verify")),i("p",{class:"s-verify-resend-message",ref:s=>this.resendMessage=s},salla.lang.get("blocks.header.resend_after"),i("b",{class:"s-verify-timer",ref:s=>this.timer=s})),i("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:s=>this.resend=s},salla.lang.get("blocks.comments.submit"))),i("slot",{name:"after-footer"}))}get host(){return h(this)}};l.style="salla-verify{display:block}.s-verify-input{}.s-verify-input::-webkit-outer-spin-button,.s-verify-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-verify-input[type=number]{-moz-appearance:textfield}";export{l as salla_verify}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as i,h as a}from"./p-Dbv0I4re.js";const e=class{constructor(a){i(this,a)}render(){return a("a",{key:"c568ebb15db1854f8f32ffa406f4751b16e67e4d",href:this.notification.url,class:{"s-notifications-item":!0,"s-notifications-item-shadow":!0,"s-notifications-item-read":!this.notification.is_new}},a("span",{key:"af8ce6607fb53b0459673aec66d4e4453fa13f94",class:"s-notifications-item-icon"},a("i",{key:"9a55f3c72eb6bef64f58e24395bab8f787c084ed",class:{"s-notifications-item-icon sicon-bell-ring":!0,"s-notifications-item-icon-new":this.notification.is_new}})),a("div",{key:"20559c46d9087d602c83f82f409c5fa43966a8de",class:"s-notifications-item-content"},a("div",{key:"22a21adb2253a0db5d9d404ba196fe1a2094c7ff",class:"s-notifications-item-content-leading"},a("h4",{key:"3a07031fe0e697a4c818dece184623bd13249f30"},this.notification.title),a("p",{key:"a481734126292bbb2b22f4a326d7a489131a0828"},this.notification.sub_title)),a("span",{key:"adad90fe0b72bd92363d53c8ffcc39602da00399",class:"s-notifications-item-content-trailing"},a("i",{key:"65401a987fd64c6647f1cabc4d802f6c835f0e61",class:"sicon-time s-notifications-item-content-trailing-icon"}),a("span",{key:"1c73bdb085cb3e5c3ecaea7352d3112b9facdf38"},this.notification.date))))}};e.style="";export{e as salla_notification_item}
4
+ import{r as i,h as a}from"./p-CvIpy7Cj.js";const t=class{constructor(a){i(this,a)}render(){return a("a",{key:"c568ebb15db1854f8f32ffa406f4751b16e67e4d",href:this.notification.url,class:{"s-notifications-item":!0,"s-notifications-item-shadow":!0,"s-notifications-item-read":!this.notification.is_new}},a("span",{key:"af8ce6607fb53b0459673aec66d4e4453fa13f94",class:"s-notifications-item-icon"},a("i",{key:"9a55f3c72eb6bef64f58e24395bab8f787c084ed",class:{"s-notifications-item-icon sicon-bell-ring":!0,"s-notifications-item-icon-new":this.notification.is_new}})),a("div",{key:"20559c46d9087d602c83f82f409c5fa43966a8de",class:"s-notifications-item-content"},a("div",{key:"22a21adb2253a0db5d9d404ba196fe1a2094c7ff",class:"s-notifications-item-content-leading"},a("h4",{key:"3a07031fe0e697a4c818dece184623bd13249f30"},this.notification.title),a("p",{key:"a481734126292bbb2b22f4a326d7a489131a0828"},this.notification.sub_title)),a("span",{key:"adad90fe0b72bd92363d53c8ffcc39602da00399",class:"s-notifications-item-content-trailing"},a("i",{key:"65401a987fd64c6647f1cabc4d802f6c835f0e61",class:"sicon-time s-notifications-item-content-trailing-icon"}),a("span",{key:"1c73bdb085cb3e5c3ecaea7352d3112b9facdf38"},this.notification.date))))}};t.style="";export{t as salla_notification_item}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as a,H as t}from"./p-Dbv0I4re.js";const s=class{constructor(a){e(this,a),this.href=void 0,this.target="_self"}generateClass(){return{"s-list-tile-item":!0,"s-list-tile-item-href":!!this.href}}render(){return a(t,{key:"e1528afcea1eda05a5ce206e95791e7611d24dd0"},a("a",{key:"749a73c76d68ad36f1a6609ada69778662d56566",class:this.generateClass(),href:this.href||"#",target:this.target,"aria-label":"List Tile Link"},a("div",{key:"7bfd448f86790b2afe0b7a5b8a5460c3b2be66ee",class:"s-list-tile-item-icon"},a("slot",{key:"383e28a8832483e8ecc61e4f48a3ff1fe5db1038",name:"icon"})),a("div",{key:"c42bf126a9ff4014a4e2d85ff12b41d1a88a0e03",class:"s-list-tile-item-content"},a("div",{key:"18a4a9ebd39e3a710f70dc33554d24e3c2850e53",class:"s-list-tile-item-title"},a("slot",{key:"7211d627511bf2448cf161f40cc82b1822dd1e7a",name:"title"})),a("div",{key:"044a7d76e05841f484387c7ed299107f33c9bc21",class:"s-list-tile-item-subtitle"},a("slot",{key:"df131034f1c5434722543e25552caed142794d55",name:"subtitle"}))),a("div",{key:"37abe0abab720da11cd55660578ec256c062e763",class:"s-list-tile-item-action"},a("slot",{key:"fcac02da17981ef4c6fa3cea50c551e3010352d9",name:"action"}))))}};s.style="";export{s as salla_list_tile}
4
+ import{r as e,h as a,H as t}from"./p-CvIpy7Cj.js";const s=class{constructor(a){e(this,a),this.href=void 0,this.target="_self"}generateClass(){return{"s-list-tile-item":!0,"s-list-tile-item-href":!!this.href}}render(){return a(t,{key:"e1528afcea1eda05a5ce206e95791e7611d24dd0"},a("a",{key:"749a73c76d68ad36f1a6609ada69778662d56566",class:this.generateClass(),href:this.href||"#",target:this.target,"aria-label":"List Tile Link"},a("div",{key:"7bfd448f86790b2afe0b7a5b8a5460c3b2be66ee",class:"s-list-tile-item-icon"},a("slot",{key:"383e28a8832483e8ecc61e4f48a3ff1fe5db1038",name:"icon"})),a("div",{key:"c42bf126a9ff4014a4e2d85ff12b41d1a88a0e03",class:"s-list-tile-item-content"},a("div",{key:"18a4a9ebd39e3a710f70dc33554d24e3c2850e53",class:"s-list-tile-item-title"},a("slot",{key:"7211d627511bf2448cf161f40cc82b1822dd1e7a",name:"title"})),a("div",{key:"044a7d76e05841f484387c7ed299107f33c9bc21",class:"s-list-tile-item-subtitle"},a("slot",{key:"df131034f1c5434722543e25552caed142794d55",name:"subtitle"}))),a("div",{key:"37abe0abab720da11cd55660578ec256c062e763",class:"s-list-tile-item-action"},a("slot",{key:"fcac02da17981ef4c6fa3cea50c551e3010352d9",name:"action"}))))}};s.style="";export{s as salla_list_tile}