@salla.sa/twilight-components 2.14.505 → 2.14.506

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 (332) hide show
  1. package/dist/cjs/{catalog-recommendations-Bzt0HRy8.js → catalog-recommendations-B_DRy6NT.js} +3 -6
  2. package/dist/cjs/{filepond-DD_rFAOS.js → filepond-CQFqhIgb.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-poster-Dd8ZNsxi.js → filepond-plugin-file-poster-CTDc0IDu.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-size-CmQS5jpF.js → filepond-plugin-file-validate-size-DeXqfYrx.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-file-validate-type-BpimuCmP.js → filepond-plugin-file-validate-type-DoefblL8.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-edit-Ddpq7EPd.js → filepond-plugin-image-edit-C99AhKIk.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-exif-orientation-C-rvvxtT.js → filepond-plugin-image-exif-orientation-BTZtq0LO.js} +1 -1
  8. package/dist/cjs/{filepond-plugin-image-preview-DcWsDFH7.js → filepond-plugin-image-preview-CU543Avx.js} +1 -1
  9. package/dist/cjs/{functions-CV9ZtvDO.js → functions-Brh5XeCA.js} +1 -1
  10. package/dist/cjs/{index-BBzpQqif.js → index-9k1NC_jh.js} +1 -1
  11. package/dist/cjs/{index-CaEXunge.js → index-Bo4N7lyD.js} +2 -2
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +2 -2
  16. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-basket-gap.cjs.entry.js +2 -2
  22. package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
  23. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-count-down_2.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  48. package/dist/cjs/salla-loyalty-exchange-product-card_5.cjs.entry.js +3 -3
  49. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
  50. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  51. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  55. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
  56. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  105. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  106. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  107. package/dist/cjs/{tracked-promise-CgPIBiVQ.js → tracked-promise-D50-kn8O.js} +1 -1
  108. package/dist/cjs/twilight.cjs.js +1 -1
  109. package/dist/cjs/{vanilla-picker-CpYZmdB0.js → vanilla-picker-Bd-sUQLP.js} +1 -1
  110. package/dist/collection/shared/catalog-recommendations.js +3 -6
  111. package/dist/components/catalog-recommendations.js +3 -6
  112. package/dist/components/index.js +2 -2
  113. package/dist/esm/{catalog-recommendations-9fzJJ_Ox.js → catalog-recommendations-CehbSKTM.js} +3 -6
  114. package/dist/esm/{filepond-B-UStH94.js → filepond-DJlkJWaI.js} +1 -1
  115. package/dist/esm/{filepond-plugin-file-poster-DclqOfrk.js → filepond-plugin-file-poster-Cxg1C-ZT.js} +1 -1
  116. package/dist/esm/{filepond-plugin-file-validate-size-BMsBPOJQ.js → filepond-plugin-file-validate-size-D7U4TtzO.js} +1 -1
  117. package/dist/esm/{filepond-plugin-file-validate-type-C5VEW1-h.js → filepond-plugin-file-validate-type-Bc55hyvc.js} +1 -1
  118. package/dist/esm/{filepond-plugin-image-edit-B7yXlSpX.js → filepond-plugin-image-edit-BSZHdCO-.js} +1 -1
  119. package/dist/esm/{filepond-plugin-image-exif-orientation-BD2JbThi.js → filepond-plugin-image-exif-orientation-DEVx9XUq.js} +1 -1
  120. package/dist/esm/{filepond-plugin-image-preview-cID5YN1G.js → filepond-plugin-image-preview-B55MpdBs.js} +1 -1
  121. package/dist/esm/{functions-VivHV3zU.js → functions-3aFA0yP9.js} +1 -1
  122. package/dist/esm/{index-19doeROM.js → index-B5uQvRDw.js} +1 -1
  123. package/dist/esm/{index-DgmW0rL4.js → index-DpB3UAAA.js} +2 -2
  124. package/dist/esm/loader.js +2 -2
  125. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  126. package/dist/esm/salla-accordion_6.entry.js +1 -1
  127. package/dist/esm/salla-add-product-button_5.entry.js +2 -2
  128. package/dist/esm/salla-advertisement.entry.js +1 -1
  129. package/dist/esm/salla-alert_2.entry.js +1 -1
  130. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  131. package/dist/esm/salla-apps-icons.entry.js +1 -1
  132. package/dist/esm/salla-badge.entry.js +1 -1
  133. package/dist/esm/salla-basket-gap.entry.js +2 -2
  134. package/dist/esm/salla-booking-field_7.entry.js +10 -10
  135. package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
  136. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  137. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  138. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  139. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  140. package/dist/esm/salla-comment-factors.entry.js +1 -1
  141. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  142. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  143. package/dist/esm/salla-contacts.entry.js +1 -1
  144. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  145. package/dist/esm/salla-count-down_2.entry.js +1 -1
  146. package/dist/esm/salla-custom-fields.entry.js +1 -1
  147. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  148. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  149. package/dist/esm/salla-filters-widget.entry.js +1 -1
  150. package/dist/esm/salla-filters.entry.js +1 -1
  151. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  152. package/dist/esm/salla-gifting.entry.js +1 -1
  153. package/dist/esm/salla-hook.entry.js +1 -1
  154. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  155. package/dist/esm/salla-installment.entry.js +1 -1
  156. package/dist/esm/salla-list-tile.entry.js +1 -1
  157. package/dist/esm/salla-localization-modal.entry.js +1 -1
  158. package/dist/esm/salla-login-modal.entry.js +1 -1
  159. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  160. package/dist/esm/salla-loyalty-exchange-product-card_5.entry.js +3 -3
  161. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  162. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  163. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  164. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  165. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  166. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  167. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  168. package/dist/esm/salla-loyalty.entry.js +1 -1
  169. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  170. package/dist/esm/salla-map_2.entry.js +1 -1
  171. package/dist/esm/salla-menu.entry.js +1 -1
  172. package/dist/esm/salla-metadata.entry.js +1 -1
  173. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  174. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  175. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  176. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  177. package/dist/esm/salla-notification-item.entry.js +1 -1
  178. package/dist/esm/salla-notifications.entry.js +1 -1
  179. package/dist/esm/salla-offer-modal.entry.js +1 -1
  180. package/dist/esm/salla-offer.entry.js +1 -1
  181. package/dist/esm/salla-order-branch.entry.js +1 -1
  182. package/dist/esm/salla-order-cancel.entry.js +1 -1
  183. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  184. package/dist/esm/salla-order-details-options.entry.js +1 -1
  185. package/dist/esm/salla-order-details.entry.js +1 -1
  186. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  187. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  188. package/dist/esm/salla-order-edit.entry.js +1 -1
  189. package/dist/esm/salla-order-summary.entry.js +1 -1
  190. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  191. package/dist/esm/salla-orders.entry.js +1 -1
  192. package/dist/esm/salla-payments.entry.js +1 -1
  193. package/dist/esm/salla-placeholder.entry.js +1 -1
  194. package/dist/esm/salla-price-range.entry.js +1 -1
  195. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  196. package/dist/esm/salla-product-card_2.entry.js +1 -1
  197. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  198. package/dist/esm/salla-products-list.entry.js +1 -1
  199. package/dist/esm/salla-quick-order.entry.js +1 -1
  200. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  201. package/dist/esm/salla-rating-modal.entry.js +1 -1
  202. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  203. package/dist/esm/salla-scopes.entry.js +1 -1
  204. package/dist/esm/salla-search.entry.js +1 -1
  205. package/dist/esm/salla-skeleton.entry.js +1 -1
  206. package/dist/esm/salla-slider.entry.js +1 -1
  207. package/dist/esm/salla-social-share.entry.js +1 -1
  208. package/dist/esm/salla-social.entry.js +1 -1
  209. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  210. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  211. package/dist/esm/salla-tooltip.entry.js +1 -1
  212. package/dist/esm/salla-trust-badges.entry.js +1 -1
  213. package/dist/esm/salla-user-menu.entry.js +1 -1
  214. package/dist/esm/salla-user-profile.entry.js +1 -1
  215. package/dist/esm/salla-user-settings.entry.js +1 -1
  216. package/dist/esm/salla-verify.entry.js +1 -1
  217. package/dist/esm/salla-wallet.entry.js +1 -1
  218. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  219. package/dist/esm/{tracked-promise-BKcvXHlH.js → tracked-promise-DIZYgNBp.js} +1 -1
  220. package/dist/esm/twilight.js +2 -2
  221. package/dist/esm/{vanilla-picker-Dd_VXZC4.js → vanilla-picker-DxRdT8WJ.js} +1 -1
  222. package/dist/twilight/{p-faccc612.entry.js → p-01061d2b.entry.js} +1 -1
  223. package/dist/twilight/{p-f6dede5f.entry.js → p-0916141f.entry.js} +1 -1
  224. package/dist/twilight/{p-f8f4fa45.entry.js → p-0a9a252a.entry.js} +1 -1
  225. package/dist/twilight/{p-e296dc06.entry.js → p-0b7cba6e.entry.js} +1 -1
  226. package/dist/twilight/{p-71df210d.entry.js → p-0c23685b.entry.js} +1 -1
  227. package/dist/twilight/{p-dc268526.entry.js → p-0de7fca3.entry.js} +1 -1
  228. package/dist/twilight/{p-096d5d28.entry.js → p-0e5abc9e.entry.js} +1 -1
  229. package/dist/twilight/{p-BNLuRnE-.js → p-0sBrxdoA.js} +1 -1
  230. package/dist/twilight/{p-363d2512.entry.js → p-127fd5c4.entry.js} +1 -1
  231. package/dist/twilight/{p-3a51668d.entry.js → p-16ce4fef.entry.js} +1 -1
  232. package/dist/twilight/{p-e8ffdd82.entry.js → p-16d19553.entry.js} +1 -1
  233. package/dist/twilight/{p-b0e5635e.entry.js → p-224d0232.entry.js} +1 -1
  234. package/dist/twilight/{p-58f137e4.entry.js → p-246f44ed.entry.js} +1 -1
  235. package/dist/twilight/{p-2d508573.entry.js → p-250d3b32.entry.js} +1 -1
  236. package/dist/twilight/{p-ac629acb.entry.js → p-25535800.entry.js} +1 -1
  237. package/dist/twilight/{p-a2bf0687.entry.js → p-304c100d.entry.js} +1 -1
  238. package/dist/twilight/{p-c760f4c7.entry.js → p-31396c77.entry.js} +1 -1
  239. package/dist/twilight/{p-0b3cd18a.entry.js → p-322c22ec.entry.js} +1 -1
  240. package/dist/twilight/{p-07a65b7d.entry.js → p-34166195.entry.js} +1 -1
  241. package/dist/twilight/{p-0d9d9d79.entry.js → p-3541ed02.entry.js} +1 -1
  242. package/dist/twilight/{p-a57683c6.entry.js → p-3cfb3db1.entry.js} +1 -1
  243. package/dist/twilight/{p-0dc76b8d.entry.js → p-3fddbb1a.entry.js} +1 -1
  244. package/dist/twilight/{p-4ebe6127.entry.js → p-416f536b.entry.js} +1 -1
  245. package/dist/twilight/{p-2c2b7eea.entry.js → p-47314e12.entry.js} +1 -1
  246. package/dist/twilight/{p-16d84218.entry.js → p-4a041952.entry.js} +1 -1
  247. package/dist/twilight/{p-5d8bb043.entry.js → p-4dc6b621.entry.js} +1 -1
  248. package/dist/twilight/{p-a74da1d9.entry.js → p-4ec9995f.entry.js} +1 -1
  249. package/dist/twilight/{p-56fb3cfa.entry.js → p-4ee5d25f.entry.js} +1 -1
  250. package/dist/twilight/{p-fed7874a.entry.js → p-52086d78.entry.js} +1 -1
  251. package/dist/twilight/{p-ab1d1e8d.entry.js → p-568dcceb.entry.js} +1 -1
  252. package/dist/twilight/{p-7264d8f5.entry.js → p-591b2f9d.entry.js} +1 -1
  253. package/dist/twilight/{p-a348708b.entry.js → p-5aefa966.entry.js} +1 -1
  254. package/dist/twilight/{p-b49457fd.entry.js → p-5db94199.entry.js} +1 -1
  255. package/dist/twilight/{p-0ff1279b.entry.js → p-5e2920de.entry.js} +1 -1
  256. package/dist/twilight/{p-de7bbaa9.entry.js → p-5ef6af67.entry.js} +1 -1
  257. package/dist/twilight/{p-db5e358c.entry.js → p-612ba607.entry.js} +1 -1
  258. package/dist/twilight/{p-16ee6031.entry.js → p-64bf5054.entry.js} +1 -1
  259. package/dist/twilight/{p-7f2c9615.entry.js → p-68b0e437.entry.js} +1 -1
  260. package/dist/twilight/{p-ff81cfff.entry.js → p-6c4504dc.entry.js} +1 -1
  261. package/dist/twilight/{p-19ad6321.entry.js → p-6e21cd17.entry.js} +1 -1
  262. package/dist/twilight/{p-99dfeb4c.entry.js → p-7271d781.entry.js} +1 -1
  263. package/dist/twilight/{p-2f4a2425.entry.js → p-74c99ff0.entry.js} +1 -1
  264. package/dist/twilight/{p-29943826.entry.js → p-75b51510.entry.js} +1 -1
  265. package/dist/twilight/{p-8dd36b54.entry.js → p-7776af70.entry.js} +1 -1
  266. package/dist/twilight/{p-ad262ff7.entry.js → p-7c347d49.entry.js} +1 -1
  267. package/dist/twilight/{p-c87ccd08.entry.js → p-7d197b66.entry.js} +1 -1
  268. package/dist/twilight/{p-79f4f459.entry.js → p-7d5a3995.entry.js} +1 -1
  269. package/dist/twilight/{p-ccdcd135.entry.js → p-7f699be4.entry.js} +1 -1
  270. package/dist/twilight/{p-10cffe37.entry.js → p-86f0ba20.entry.js} +1 -1
  271. package/dist/twilight/{p-cd87f415.entry.js → p-8961c821.entry.js} +1 -1
  272. package/dist/twilight/{p-4911099b.entry.js → p-89a74a55.entry.js} +1 -1
  273. package/dist/twilight/{p-b0c392f7.entry.js → p-94fb9d40.entry.js} +1 -1
  274. package/dist/twilight/{p-1cd06f96.entry.js → p-98e25f3a.entry.js} +1 -1
  275. package/dist/twilight/{p-ad7729e9.entry.js → p-9f90b7d2.entry.js} +1 -1
  276. package/dist/twilight/{p-DXLiwTWx.js → p-B7nGGDcs.js} +1 -1
  277. package/dist/twilight/{p-CU3ZhU09.js → p-CSZ-P877.js} +1 -1
  278. package/dist/twilight/{p-HAahk8iL.js → p-CUT8CVCo.js} +1 -1
  279. package/dist/twilight/p-CehbSKTM.js +4 -0
  280. package/dist/twilight/{p-CdC1U3cm.js → p-Cv5nxveF.js} +1 -1
  281. package/dist/twilight/{p-CRrQRrvo.js → p-DVsQiYvE.js} +1 -1
  282. package/dist/twilight/{p-tOYoACRZ.js → p-Di2RDF2Q.js} +1 -1
  283. package/dist/twilight/{p-DgmW0rL4.js → p-DpB3UAAA.js} +1 -1
  284. package/dist/twilight/{p-PM-JSky9.js → p-DshtSdt6.js} +1 -1
  285. package/dist/twilight/{p-DZ0KVYQI.js → p-INkBE6fU.js} +1 -1
  286. package/dist/twilight/{p-2e132d80.entry.js → p-a75fab7d.entry.js} +1 -1
  287. package/dist/twilight/{p-501f352c.entry.js → p-a82e0f9b.entry.js} +1 -1
  288. package/dist/twilight/{p-ca914b96.entry.js → p-aca94595.entry.js} +1 -1
  289. package/dist/twilight/{p-a444db9e.entry.js → p-afc29ef5.entry.js} +1 -1
  290. package/dist/twilight/{p-53364bda.entry.js → p-b37d2e41.entry.js} +1 -1
  291. package/dist/twilight/{p-527e00f3.entry.js → p-b394d2ff.entry.js} +1 -1
  292. package/dist/twilight/{p-cd25a8ed.entry.js → p-b3dfff70.entry.js} +1 -1
  293. package/dist/twilight/{p-09b32c27.entry.js → p-b7c129de.entry.js} +1 -1
  294. package/dist/twilight/{p-7e8973ef.entry.js → p-b8ecee79.entry.js} +1 -1
  295. package/dist/twilight/{p-155e517d.entry.js → p-ba11a528.entry.js} +1 -1
  296. package/dist/twilight/{p-9a1b9892.entry.js → p-ba7f4e42.entry.js} +1 -1
  297. package/dist/twilight/{p-5f93b8c4.entry.js → p-bedece0c.entry.js} +1 -1
  298. package/dist/twilight/{p-7de68ea9.entry.js → p-c10ff742.entry.js} +1 -1
  299. package/dist/twilight/{p-b679191f.entry.js → p-c3db8509.entry.js} +1 -1
  300. package/dist/twilight/{p-c83b026f.entry.js → p-c61cf7ef.entry.js} +1 -1
  301. package/dist/twilight/{p-fe0875c2.entry.js → p-c6a4bb6b.entry.js} +1 -1
  302. package/dist/twilight/{p-1c7323b3.entry.js → p-c8f1b2b7.entry.js} +1 -1
  303. package/dist/twilight/{p-7596fb5c.entry.js → p-d004e1bb.entry.js} +1 -1
  304. package/dist/twilight/{p-8103412a.entry.js → p-d0849886.entry.js} +1 -1
  305. package/dist/twilight/{p-b513590c.entry.js → p-d22cfff8.entry.js} +1 -1
  306. package/dist/twilight/{p-da9cb482.entry.js → p-d493d768.entry.js} +1 -1
  307. package/dist/twilight/{p-982c4d6e.entry.js → p-d6d1f072.entry.js} +1 -1
  308. package/dist/twilight/{p-d18e34ae.entry.js → p-d7a160a7.entry.js} +1 -1
  309. package/dist/twilight/{p-8b58a66c.entry.js → p-dae97b2d.entry.js} +1 -1
  310. package/dist/twilight/{p-508b2db2.entry.js → p-daeeea6d.entry.js} +1 -1
  311. package/dist/twilight/{p-e5f88988.entry.js → p-dd4f363e.entry.js} +1 -1
  312. package/dist/twilight/{p-04df9e0b.entry.js → p-e1be7398.entry.js} +1 -1
  313. package/dist/twilight/{p-95d46bfb.entry.js → p-e55c0663.entry.js} +1 -1
  314. package/dist/twilight/{p-b52c612e.entry.js → p-e76c8fa2.entry.js} +1 -1
  315. package/dist/twilight/{p-4e0ab6a0.entry.js → p-ea84a210.entry.js} +1 -1
  316. package/dist/twilight/{p-979661ca.entry.js → p-eb8ccf1d.entry.js} +1 -1
  317. package/dist/twilight/{p-5b95ed84.entry.js → p-ec9a05e6.entry.js} +1 -1
  318. package/dist/twilight/p-ed9919cd.entry.js +4 -0
  319. package/dist/twilight/{p-57fa471e.entry.js → p-f00c30a1.entry.js} +1 -1
  320. package/dist/twilight/{p-d3136121.entry.js → p-f13e8759.entry.js} +1 -1
  321. package/dist/twilight/{p-1962f0c0.entry.js → p-f5905f20.entry.js} +1 -1
  322. package/dist/twilight/{p-bfe32f25.entry.js → p-f7177061.entry.js} +1 -1
  323. package/dist/twilight/{p-d34d6f74.entry.js → p-f870575b.entry.js} +1 -1
  324. package/dist/twilight/{p-8cac5280.entry.js → p-f879b71d.entry.js} +1 -1
  325. package/dist/twilight/{p-ecaf331f.entry.js → p-f8f07022.entry.js} +1 -1
  326. package/dist/twilight/{p-ecd335fb.entry.js → p-fcba9566.entry.js} +1 -1
  327. package/dist/twilight/{p-WsUy1Vwc.js → p-qtv65mC4.js} +1 -1
  328. package/dist/twilight/{p-BFIidK_r.js → p-tEBqC22E.js} +1 -1
  329. package/dist/twilight/twilight.esm.js +1 -1
  330. package/package.json +5 -5
  331. package/dist/twilight/p-47b6123d.entry.js +0 -4
  332. package/dist/twilight/p-9fzJJ_Ox.js +0 -4
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as a,H as s,a as i}from"./p-DgmW0rL4.js";import{a as e}from"./p-CgtvEd63.js";import{C as l}from"./p-BV4kqbdL.js";import{I as r}from"./p-C-tzSDxw.js";import{e as n}from"./p-DzAIgzdz.js";import{S as o}from"./p-lMgMt31Q.js";import{S as d}from"./p-CeFAfcTv.js";import{W as m}from"./p-CgR-T_ZS.js";import{H as h}from"./p-XnA1YTjA.js";const g=class{constructor(a){t(this,a),this.hasError=!1,this.showContactWidget=!0,this.images=[],this.productImages={},this.editItemImages=[],this.contact_body=(t,a,s)=>salla.lang.get("pages.rating.contact_subject",{store:t,id:a,customer:s}),this.editMode=!1,this.defaultMode=!1,this.deleteMode=!1,this.shouldOpenDeleteModal=!1,this.editItem=null,this.loyaltyImageRatingPoints=0,this.enableNewPopUp=!1,this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.addImagesLabel=salla.lang.get("pages.rating.add_images"),this.editImagesLabel=salla.lang.get("pages.rating.edit_images"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.contactUsLabel=salla.lang.get("blocks.footer.social"),this.loyaltyPointsForImagesLabel=salla.lang.get("pages.rating.loyalty_points_for_images",{points:":points"}),this.allowAttachImages=salla.config.get("store.settings.rating.allow_attach_images"),this.allowContactSupport=salla.config.get("store.settings.rating.allow_contact_support"),this.contentRefs=[],this.hiddenInputs=[],this.isOpen=[],this.stepsCount=0,this.currentIndex=0,this.submitted=[],this.MAX_UPLOAD_LIMIT=3,this.onOpen=t=>new Promise((a=>{e({targets:this.contentRefs[t],duration:100,height:this.contentRefs[t].scrollHeight,opacity:[0,1],easing:"easeOutQuart",complete:()=>a()})})),this.onClose=t=>new Promise((a=>{e({targets:this.contentRefs[t],duration:100,height:0,opacity:[1,0],easing:"easeOutQuart",complete:()=>a()})})),this.toggleUploader=async t=>{this.isOpen[t]=!this.isOpen[t],h.toggleElementClassIf(this.contentRefs[t],"is-closed","is-opened",(()=>!this.isOpen[t])),await(this.isOpen[t]?this.onOpen(t):this.onClose(t)),await new Promise((t=>setTimeout(t,101))),this.body&&this.currentTab&&setTimeout((()=>this.body.setAttribute("style",`height:${this.currentTab.offsetHeight+(this.editMode?60:0)}px`)))},salla.onReady((()=>{this.orderId=salla.config.get("page.id")})),salla.lang.onLoaded((()=>{this.contactUsLabel=salla.lang.get("blocks.footer.social");const t=(t,a,s)=>new Promise((i=>{salla.helpers.setNested(salla.lang.messages[t],a,s),i(!0)}));(async()=>{await t("ar.trans","common.uploader.drag_and_drop_files","اسحب الملفات وأفلتها هنا"),await t("en.trans","common.uploader.drag_and_drop_files","Drag and drop files here"),await t("ar.trans","common.uploader.allowed_images_types"," .jpg أو jpeg أو png يُسمح بإضافة صور بصيغة"),await t("en.trans","common.uploader.allowed_images_types","Images in jpg, jpeg, or png format are allowed."),await t("ar.trans","pages.rating.add_images","اضافة صور"),await t("en.trans","pages.rating.add_images","Add Images"),await t("ar.trans","pages.rating.edit_images","تعديل الصور"),await t("en.trans","pages.rating.edit_images","Edit Images"),await t("ar.trans","pages.rating.edit_review","تعديل التقييم"),await t("en.trans","pages.rating.edit_review","Edit review"),await t("ar.trans","pages.rating.confirm_deletion","تأكيد حذف التقييم"),await t("en.trans","pages.rating.confirm_deletion","Confirm review deletion"),await t("ar.trans","pages.rating.are_you_sure_you_want_to_delete_review","هل أنت متأكد من حذف تقييمك؟"),await t("en.trans","pages.rating.are_you_sure_you_want_to_delete_review","Are you sure you want to delete your review?"),await t("ar.trans","pages.rating.review_updated_successfully","تم تعديل التقييم بنجاح"),await t("en.trans","pages.rating.review_updated_successfully","The review has been successfully updated."),await t("ar.trans","pages.rating.review_deleted_successfully","تم حذف التقييم بنجاح"),await t("en.trans","pages.rating.review_deleted_successfully","The review has been successfully deleted."),await t("ar.trans","pages.rating.images_count","الصور ( :current من أصل :total )"),await t("en.trans","pages.rating.images_count","Images ( :current of :total )"),await t("ar.trans","pages.rating.loyalty_points_for_images","اكسب :points نقطة ولاء عند إضافة صور لتقييمك!"),await t("en.trans","pages.rating.loyalty_points_for_images","Earn :points loyalty points when adding photos to your review!"),await t("ar.trans","common.uploader.max_three_images",`.أضف ${this.MAX_UPLOAD_LIMIT} صور كحد أقصى`),await t("en.trans","common.uploader.max_three_images",`Add up to ${this.MAX_UPLOAD_LIMIT} images maximum.`),await t("ar.trans","common.elements.confirm_delete","تأكيد الحذف"),await t("en.trans","common.elements.confirm_delete","Confirm deletion"),this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.addImagesLabel=salla.lang.get("pages.rating.add_images"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.editImagesLabel=salla.lang.get("pages.rating.edit_images"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.loyaltyPointsForImagesLabel=salla.lang.get("pages.rating.loyalty_points_for_images",{points:":points"}),this.contact_body=(t,a,s)=>salla.lang.get("pages.rating.contact_body",{store:t,id:a,customer:s})})()}))}getV2Ref(){return this.v2Ref??this.host.querySelector("salla-rating-modal-v2")}syncNewPopUpFlag(){this.enableNewPopUp=!!salla.config.get("store.features")?.includes("new_popup_rating")}async open(){return await salla.onReady(),this.syncNewPopUpFlag(),this.enableNewPopUp?this.getV2Ref()?.open():(this.defaultMode=!0,new Promise((t=>{setTimeout((()=>{this.modal.open().then((()=>this.order||salla.api.withoutNotifier((()=>salla.rating.api.order(this.orderId?this.orderId:salla.config.get("page.id")))).then((t=>this.order=t.data)))).then((()=>this.readyUpLoyaltyPoints())).then((()=>this.modal.setTitle(`${salla.lang.get("pages.rating.rate_order")} <span class="unicode">(#${this.order.id})</span>`))).then((()=>{const t={};if(this.order?.products)for(const a of this.order.products)t[a.product.id]=[];this.productImages=t})).then((()=>this.modal.stopLoading())).then((()=>this.stepsCount=[this.order.testimonials_enabled,this.order.products_enabled,this.order.shipping_enabled].filter((t=>t)).length)).then((()=>setTimeout((()=>this.handleWizard()),100))).catch((a=>{t(!1),this.hasError=!0,this.errorMessage=a.response?.data?.error?.message||a.response?.data,this.modal.stopLoading()})),t(!0)}),50)})))}async openEditModal(t){if(await salla.onReady(),this.syncNewPopUpFlag(),this.enableNewPopUp)return this.getV2Ref()?.openEditModal(t);this.defaultMode=!1,this.editMode=!0,this.editType=t.type,this.editFeedbackId=t.feedback_id;try{await this.fetchEditItem(t.feedback_id),await this.readyUpLoyaltyPoints(),this.editModal.open()}catch(t){this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data}}async fetchEditItem(t){const a=`rating/${t}/show`,s=await salla.api.request(a);this.editItem=s.data,this.allowAttachImages&&"product"==this.editType&&this.editItem.images.length&&(this.editItemImages=this.editItem.images.map((t=>({id:`${Math.floor(100+900*Math.random())}`,url:t}))))}async editReview(){const t={};this.editModal.querySelectorAll("[name]").forEach((a=>{const s=salla.helpers.inputData(a.name,a.value,t);t[s.name]=s.value})),t.images&&(t.images=t.images.split(","));const a=`rating/${this.editFeedbackId}`;await salla.api.request(a,t,"put").then((t=>{this.editModal.close(),salla.notify.success(t.message||this.updatedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async openDeleteModal(t){return await salla.onReady(),this.syncNewPopUpFlag(),this.enableNewPopUp?this.getV2Ref()?.openDeleteModal(t):(this.defaultMode=!1,this.deleteMode=!0,this.deleteFeedbackId=t.feedback_id,this.shouldOpenDeleteModal=!0,new Promise((t=>{setTimeout((()=>{this.deleteModal.open().then((()=>t(!0)))}),50)})))}async deleteReview(){const t=`rating/${this.deleteFeedbackId}`;await salla.api.request(t,null,"delete").then((()=>{this.deleteModal.close(),salla.notify.success(this.deletedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async close(){return this.enableNewPopUp?this.getV2Ref()?.close():this.modal.close()}handleWizard(){this.steps=this.modal.querySelectorAll(".s-rating-modal-step"),this.dots=this.modal.querySelectorAll(".s-rating-modal-step-dot"),this.showActiveStep()}showActiveStep(t=null){this.currentTab=t||this.steps[this.currentIndex],h.toggleClassIf(".s-rating-modal-step-dot","s-rating-modal-bg-gray","s-rating-modal-bg-primary",(t=>t!=this.dots[this.currentIndex])).toggleClassIf(".s-rating-modal-step","s-rating-modal-active","s-rating-modal-hidden",(t=>t==this.currentTab)),0!==this.currentIndex&&(h.toggleElementClassIf(this.currentTab,"s-rating-modal-unactive","s-rating-modal-hidden",(()=>!0)),setTimeout((()=>h.toggleElementClassIf(this.currentTab,"s-rating-modal-active","s-rating-modal-unactive",(()=>!0))),300));const a=this.steps[this.currentIndex+1]?.dataset.type;this.nextBtn?.setText(a?`${salla.lang.get("pages.rating.rate")} ${salla.lang.get(`pages.rating.${a}`)}`:salla.lang.get("pages.rating.send_ratings")),setTimeout((()=>this.body?.setAttribute("style",`height:${this.currentTab?.offsetHeight}px`)))}previousTab(){this.currentIndex>0&&this.currentIndex--,h.toggleElementClassIf(this.backBtn,"s-rating-modal-unvisiable","block",(()=>0==this.currentIndex)),this.showActiveStep()}submit(){this.submittedBefore()||this.validate(),salla.config.canLeave=!1,this.nextBtn.load().then((()=>this.submittedBefore()||this.sendFeedback())).then((()=>this.currentTab.querySelectorAll("[name],.s-rating-modal-btn-star").forEach((t=>t.setAttribute("disabled",""))))).then((()=>this.currentIndex<this.stepsCount&&this.currentIndex++)).then((()=>this.showActiveStep())).then((()=>h.toggleClassIf("#prev-btn","block","s-rating-modal-unvisiable",(()=>!0)))).finally((()=>{this.nextBtn.stop(),salla.config.canLeave=!0,this.currentIndex==this.stepsCount&&(this.showThankYou(),this.showContactWidget=!1)}))}submittedBefore(){return this.submitted.includes(this.currentIndex)}validate(t=null,a=null){if(!t&&"products"===this.currentTab.dataset.type)return void this.currentTab.querySelectorAll(".rating-outer-form").forEach((t=>this.validate(t,"product")));const s=(t=t||this.currentTab).querySelector(".rating_hidden_input").value,i=t.querySelector(".s-rating-modal-validation-msg");if(a=a||t.dataset.type,!s)throw i.innerHTML=salla.lang.get(`pages.rating.rate_${a}_stars`).replace(" (:item)",""),new Error(i.innerHTML);i.innerHTML=""}sendFeedback(){const t={};if(this.currentTab.querySelectorAll("[name]").forEach((a=>{const s=salla.helpers.inputData(a.name,a.value,t);t[s.name]=s.value})),this.allowAttachImages&&t.products)for(let a in t.products)t.products[a].images&&(t.products[a].images=t.products[a].images.split(","));if(0!=Object.keys(t).length)return t.order_id=this.orderId,t.type=this.currentTab.dataset.type,salla.rating.api[this.currentTab.dataset.type](t).then((t=>(this.submitted.push(this.currentIndex),t)))}showThankYou(){let t=10,a=setInterval((()=>{this.thanksTime.innerHTML="00:0"+t--,t>0||(clearInterval(a),this.thanksTime.remove(),this.close().then((()=>window.location.reload())))}),1e3);this.modal.querySelector(".s-rating-modal-footer").classList.add("s-rating-modal-unvisiable"),this.showActiveStep(this.thanksTab)}getFilepondPlaceholder(){return`<div class="s-rating-modal-filepond-placeholder"><span class="s-rating-modal-filepond-placeholder-icon">${r}</span><p class="s-rating-modal-filepond-placeholder-text">${this.dragAndDropFilesLabel}<br>\n <span> ${this.allowedImagesTypesLabel} <br> ${this.threeImagesMax} </span></p></div>`}getCustomerName(){return`${salla.config.get("user.first_name")||salla.storage.get("user.first_name")||""} ${salla.config.get("user.last_name")||salla.storage.get("user.last_name")||""}`}handleSendEmail(){const t=`${this.contactSubjectLabel} #${this.order.id}`,a=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),s=`mailto:${salla.config.get("store.contacts.email")}?subject=${encodeURIComponent(t)}&body=${encodeURIComponent(a)}`;window.open(s,"_blank")}handleSendWhatsApp(){const t=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),a=`https://wa.me/${salla.config.get("store.contacts.whatsapp")}?text=${encodeURIComponent(t)}`;window.open(a,"_blank")}resetData(t){t.detail||(this.modal?.close(),this.editItem=null,this.editItemImages=[],this.hiddenInputs[1]&&(this.hiddenInputs[1].value=""),this.deleteFeedbackId=null,this.editFeedbackId=null,this.shouldOpenDeleteModal=!1,this.editMode=!1,this.deleteMode=!1,this.defaultMode=!1,this.loyaltyImageRatingPoints=0)}async readyUpLoyaltyPoints(){const t=salla.loyalty?.isFeatureEnabled?.();if(!t)return void(this.loyaltyImageRatingPoints=0);const a=salla.config.get("store.settings.rating.rating_product_points")||0,s=salla.config.get("store.settings.rating.rating_product_with_image_points")||0;this.loyaltyImageRatingPoints=Number(s)+Number(a)}loyaltyPointsNote(){if(!this.loyaltyImageRatingPoints||!this.loyaltyPointsForImagesLabel)return null;const t=a("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a("path",{d:"M10 0C13.6819 0 16.6667 2.98477 16.6667 6.66664C16.6667 9.37047 15.057 11.6984 12.7437 12.7444C11.6978 15.0575 9.3701 16.6666 6.66668 16.6666C2.98477 16.6666 0 13.6819 0 9.99998C0 7.29656 1.60918 4.96894 3.92195 3.92276C4.96827 1.60964 7.29618 0 10 0ZM6.66668 5C3.90524 5 1.66667 7.23856 1.66667 9.99998C1.66667 12.7614 3.90524 15 6.66668 15C9.4281 15 11.6667 12.7614 11.6667 9.99998C11.6667 7.23856 9.4281 5 6.66668 5ZM7.50002 5.83333V6.66664H9.16668V8.33331H5.83333C5.60322 8.33331 5.41667 8.51989 5.41667 8.74998C5.41667 8.95456 5.56407 9.12464 5.75844 9.15998L5.83333 9.16664H7.50002C8.6506 9.16664 9.58335 10.0994 9.58335 11.25C9.58335 12.4006 8.6506 13.3333 7.50002 13.3333V14.1666H5.83333V13.3333H4.16667V11.6666H7.50002C7.7301 11.6666 7.91668 11.4801 7.91668 11.25C7.91668 11.0455 7.76927 10.8753 7.57493 10.8401L7.50002 10.8333H5.83333C4.68274 10.8333 3.75 9.90056 3.75 8.74998C3.75 7.59939 4.68274 6.66664 5.83333 6.66664V5.83333H7.50002ZM10 1.66667C8.51377 1.66667 7.17893 2.31513 6.26313 3.34457C6.39704 3.33736 6.53138 3.33333 6.66668 3.33333C10.3486 3.33333 13.3333 6.3181 13.3333 9.99998C13.3333 10.1356 13.3293 10.2702 13.3213 10.4037C14.3513 9.48814 15 8.15314 15 6.66664C15 3.90524 12.7614 1.66667 10 1.66667Z",fill:"#008C56"}));return a("div",{class:"s-rating-modal-loyalty-points-note-container"},a("span",{class:"s-rating-modal-loyalty-points-note-icon"},t),a("p",{class:"s-rating-modal-loyalty-points-note-text"},this.loyaltyPointsForImagesLabel.replace(":points",String(this.loyaltyImageRatingPoints))))}getDeleteModal(){return a("salla-modal",{ref:t=>this.deleteModal=t,width:"xs",onModalVisibilityChanged:t=>this.resetData(t)},a("div",{class:"s-rating-modal-delete-wrapper",ref:t=>this.body=t},a("h3",null,this.confirmDeletionLabel),a("p",null,this.areYouSureLabel),a("div",{class:"s-rating-modal-delete-actions"},a("salla-button",{loaderPosition:"center",onClick:()=>this.deleteReview()},this.confirmDeleteBtn),a("salla-button",{color:"danger",fill:"outline",onClick:()=>this.deleteModal.close()},this.cancelLabel))))}renderUploadedImagesCount(t){const s=this.editMode?this.editItemImages.length:(this.productImages[t]||[]).length;return a("span",{class:"s-rating-modal-upload-count"},salla.lang.choice("pages.rating.images_count",s,{current:s,total:this.MAX_UPLOAD_LIMIT}))}getEditModal(){return a("salla-modal",{ref:t=>this.editModal=t,width:"md",onModalVisibilityChanged:t=>this.resetData(t)},a("div",{class:"s-rating-modal-edit-wrapper",ref:t=>this.body=t},"store"===this.editType&&this.editItem?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"store",ref:t=>this.currentTab=t},a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),a("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),a("textarea",{name:"content",value:this.editItem.content,class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):null,"shipping"===this.editType&&this.editItem?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"shipping",ref:t=>this.currentTab=t},this.editItem.shipping.logo?a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:this.editItem.shipping.logo,class:"s-rating-modal-shipping-logo",alt:this.editItem.shipping.name})):a("span",{class:"s-rating-modal-icon",innerHTML:o}),a("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.editItem.shipping.name}`),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),a("textarea",{name:"content",class:"s-rating-modal-comment",value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):null,"product"==this.editType&&this.editItem?a("section",{class:"s-rating-modal-step","data-type":"products",ref:t=>this.currentTab=t},a("div",{class:"s-rating-modal-product"},this.allowAttachImages&&this.loyaltyPointsNote(),a("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},a("div",{class:"s-rating-modal-product-img-wrap"},a("img",{src:this.editItem.product.image.url,alt:this.editItem.product.name,class:"s-rating-modal-product-img"})),a("div",{class:"s-rating-modal-product-details"},a("div",{class:"s-rating-modal-product-details-main"},a("div",null,a("h3",{class:"s-rating-modal-product-title"}," ",this.editItem.product.name),a("div",{class:"s-rating-modal-stars-product"},a("salla-rating-stars",{withLabel:!0,size:"small",editable:!0,value:this.editItem.stars}))),this.allowAttachImages&&a("salla-button",{class:"s-comments-item-like-btn mt-0",loaderPosition:"center",fill:"outline",size:"small",onClick:()=>this.toggleUploader(1)},a("span",null,this.editItemImages.length?this.editImagesLabel:this.addImagesLabel),a("span",{innerHTML:r}))),a("textarea",{value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"content",class:"s-rating-modal-comment"}),a("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&a("div",{class:"s-rating-modal-uploader is-closed",ref:t=>this.contentRefs[1]=t},a("salla-file-upload",{name:"images",allowMultiple:!0,maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,filePosterHeight:117,"instant-upload":!0,type:"feedback",files:JSON.stringify(this.editItemImages),payloadName:"files[]",id:`file-${this.editItem.product.id}`,title:this.editItem.product.name,instantUpload:!0,accept:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:t=>{this.editItemImages=[...this.editItemImages,t.detail],this.hiddenInputs[1].value=this.editItemImages.map((t=>t.url)).join()},onRemoved:t=>{const a=t.detail;a&&(this.editItemImages=this.editItemImages.filter((t=>t.id!==a)),this.hiddenInputs[1].value=this.editItemImages.map((t=>t.url)).join())},labelIdle:this.getFilepondPlaceholder()}),a("input",{type:"hidden",name:"images",value:this.editItem.images.join(","),ref:t=>this.hiddenInputs[1]=t}),this.renderUploadedImagesCount(this.editItem.product.id)))):null,a("div",{class:"s-rating-modal-footer s-rating-modal-footer-end"},a("salla-button",{"loader-position":"center",onClick:()=>this.editReview()},this.editReviewLabel))))}render(){return this.enableNewPopUp?a(s,{class:"s-rating-modal"},a("salla-rating-modal-v2",{ref:t=>this.v2Ref=t,orderId:this.orderId})):this.deleteMode?a(s,{class:"s-rating-modal"},this.getDeleteModal()):this.editMode?a(s,{class:"s-rating-modal"},this.getEditModal()):this.defaultMode?a(s,{class:"s-rating-modal"},a("salla-modal",{class:"s-rating-modal-wrap",onModalVisibilityChanged:t=>this.resetData(t),isLoading:!0,width:"md",ref:t=>this.modal=t},a("div",{slot:"loading"},a("div",{class:"s-rating-modal-skeleton"},a("salla-skeleton",{type:"circle",height:"80px",width:"80px"}),a("salla-skeleton",{height:"15px",width:"60%"}),a("salla-skeleton",{height:"10px",width:"30%"}),a("div",{class:"s-rating-modal-skeleton-stars"},[...Array(5)].map((t=>a("div",{key:t,innerHTML:d})))),a("salla-skeleton",{height:"100px",width:"100%"}),a("div",{class:"s-rating-modal-skeleton-footer"},a("salla-skeleton",{height:"40px",width:"30%"})))),!this.hasError&&this.order?[a("div",{class:"s-rating-modal-wrapper",ref:t=>this.body=t},this.order?.testimonials_enabled?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"store"},a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),a("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large"})),a("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):"",this.order.products_enabled?a("section",{class:"s-rating-modal-step s-rating-modal-hidden","data-type":"products"},this.allowAttachImages&&this.loyaltyPointsNote(),this.order.products.map(((t,s)=>a("div",{class:"s-rating-modal-product",key:s},a("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},a("div",{class:"s-rating-modal-product-img-wrap"},a("img",{src:t.product.thumbnail,alt:t.product.name,class:"s-rating-modal-product-img"})),a("div",{class:"s-rating-modal-product-details"},a("div",{class:"s-rating-modal-product-details-main"},a("div",null,a("h3",{class:"s-rating-modal-product-title"}," ",t.product.name),a("div",{class:"s-rating-modal-stars-product"},a("salla-rating-stars",{withLabel:!0,size:"small",name:`products[${s}][rating]`}))),this.allowAttachImages&&a("salla-button",{class:"s-comments-item-like-btn mt-0",loaderPosition:"center",fill:"outline",size:"small",onClick:()=>this.toggleUploader(s)},a("span",null,this.addImagesLabel),a("span",{innerHTML:r}))),a("input",{type:"hidden",name:`products[${s}][product_id]`,value:t.product.id}),a("textarea",{placeholder:salla.lang.get("pages.rating.write_product_rate"),name:`products[${s}][comment]`,class:"s-rating-modal-comment"}),a("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&a("div",{class:"s-rating-modal-uploader is-closed",ref:t=>this.contentRefs[s]=t},a("salla-file-upload",{name:"image",maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,"instant-upload":!0,type:"feedback",payloadName:"files[]",id:`file-${t.product.id}`,title:t.product.name,allowMultiple:!0,instantUpload:!0,accept:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:a=>{this.productImages={...this.productImages,[t.product.id]:[...this.productImages[t.product.id]||[],a.detail]},this.hiddenInputs[s].value=this.productImages[t.product.id].map((t=>t.url)).join(",")},onRemoved:a=>{const i=a.detail;i&&this.productImages[t.product.id]&&(this.productImages={...this.productImages,[t.product.id]:this.productImages[t.product.id].filter((t=>t.id!==i))},this.hiddenInputs[s].value=this.productImages[t.product.id].map((t=>t.url)).join(","))},labelIdle:this.getFilepondPlaceholder()}),a("input",{type:"hidden",name:`products[${s}][images]`,value:(this.productImages[t.product.id]||[]).map((t=>t.url)).join(","),ref:t=>this.hiddenInputs[s]=t}),this.renderUploadedImagesCount(t.product.id)))))):"",this.order.shipping_enabled&&this.order.shipping?.company?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"shipping"},a("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.company.id}),this.order.shipping.company.logo?a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:this.order.shipping.company.logo,class:"s-rating-modal-shipping-logo",alt:this.order.shipping.company.name})):a("span",{class:"s-rating-modal-icon",innerHTML:o}),a("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.order.shipping.company.name}`),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large"})),a("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):"",a("div",{class:"s-rating-modal-thanks s-rating-modal-hidden",ref:t=>this.thanksTab=t},a("span",{class:"s-rating-modal-icon",innerHTML:l}),a("h3",{class:"s-rating-modal-thanks-title"},salla.lang.get("pages.rating.thanks")),a("div",{class:"s-rating-modal-thanks-msg",innerHTML:this.order.thanks_message}),a("time",{class:"s-rating-modal-thanks-time",ref:t=>this.thanksTime=t}))),this.allowContactSupport&&this.showContactWidget&&(salla.config.get("store.contacts.whatsapp")||salla.config.get("store.contacts.email"))?a("div",{class:"s-rating-modal-contact"},a("p",null,this.contactUsLabel),a("div",{class:"s-rating-modal-contact-icons"},salla.config.get("store.contacts.whatsapp")&&a("span",{onClick:()=>this.handleSendWhatsApp(),innerHTML:m}),salla.config.get("store.contacts.email")&&a("span",{onClick:()=>this.handleSendEmail(),innerHTML:n}))):"",a("div",{class:"s-rating-modal-footer"},a("button",{ref:t=>this.backBtn=t,onClick:()=>this.previousTab(),class:"s-rating-modal-btn s-rating-modal-unvisiable"},salla.lang.get("common.elements.back")),this.stepsCount>1?a("ul",{class:"s-rating-modal-dots"},[0,1,2].slice(0,this.stepsCount).map((t=>a("li",{key:t,class:"s-rating-modal-bg-gray s-rating-modal-step-dot"})))):"",a("salla-button",{"loader-position":"center",ref:t=>this.nextBtn=t,onClick:()=>this.submit()},salla.lang.get("common.elements.next")))]:a("salla-placeholder",{alignment:"center"}))):void 0}async componentWillLoad(){salla.event.on("rating::open",(()=>this.open())),salla.event.on("rating::edit",(t=>this.openEditModal(t))),salla.event.on("rating::delete",(t=>this.openDeleteModal(t))),await salla.onReady(),this.syncNewPopUpFlag()}componentDidLoad(){salla.event.dispatch("rating::ready",this)}get host(){return i(this)}};g.style=".s-rating-modal-product-details{padding-bottom:0.5rem}.s-rating-modal-comment{margin-top:0.35rem}.s-rating-modal-product{margin-bottom:1rem}.s-rating-modal-product-img{position:absolute !important;inset:0;display:block;width:100% !important;max-width:100% !important;height:100% !important;object-fit:cover}.s-rating-modal-product-title{font-size:0.95rem;font-weight:600;line-height:1.5;margin:0}.s-rating-modal-stars-product{margin-top:0.5rem}.s-rating-modal-loyalty-points-note-container{display:flex;align-items:center;gap:0.625rem;width:100%;margin-top:1.5rem;margin-bottom:0.75rem;padding:0.75rem;border-radius:0.5rem;background-color:#E6F4EA}.s-rating-modal-loyalty-points-note-icon{display:flex;flex-shrink:0;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;color:#1B7F5C}.s-rating-modal-loyalty-points-note-icon svg{width:1.5rem;height:1.5rem;fill:currentColor}.s-rating-modal-loyalty-points-note-text{flex:1;margin:0;font-size:0.875rem;line-height:1.25rem;color:#1f2937}.s-rating-modal-product-details-main{display:flex;align-items:center;margin-bottom:0.5rem;padding-bottom:0;border-bottom:0}.s-rating-modal-product-info-row{display:flex;align-items:center;gap:0.6rem;margin-bottom:0.5rem;padding-bottom:0;border-bottom:0}.s-rating-modal-product-main-review{width:100%;text-align:right}.s-rating-modal-product-rating-rows{display:grid;gap:0.45rem;margin:0.2rem 0 0.7rem}.s-rating-modal-product-rating-row{display:flex;align-items:center;justify-content:space-between;gap:0.75rem;min-height:2rem}.s-rating-modal-product-rating-row salla-rating-stars{flex-shrink:0}.s-rating-modal-product-rating-row .s-rating-stars-wrapper{align-items:center;min-height:1.75rem}.s-rating-modal-product-rating-row .s-rating-stars-label,.s-rating-modal-product-rating-row .s-rating-stars-label-without-tag{min-width:auto;min-height:1.25rem;line-height:1.25rem;font-size:0.8rem;color:#5b6470;white-space:nowrap;text-align:end;transition:opacity 0.15s ease}.s-rating-modal-product-rating-row .s-rating-stars-label--empty,.s-rating-modal-product-rating-row .s-rating-stars-label-without-tag--empty{opacity:0}.s-rating-modal-product-rating-row-main{margin-bottom:0.35rem;padding:0.5rem 0.6rem;border:1px solid #d1d5db;border-radius:0.45rem;background:transparent}.s-rating-modal-product-factor-name{color:#5b6470;font-size:0.9rem;line-height:1.25}.s-rating-modal-product-rating-row-main .s-rating-modal-product-factor-name{font-size:1rem;color:#5b6470}.s-rating-modal-product-factor-required{color:#f87171;margin-inline-start:0.2rem}.s-rating-modal-product-img-wrap{position:relative;width:5rem !important;min-width:5rem !important;max-width:5rem !important;height:3.5rem !important;flex-shrink:0 !important;overflow:hidden;border-radius:0.375rem;background:#f3f4f6}.s-rating-modal-uploader.is-opened{height:auto !important;opacity:1 !important;overflow:visible !important;pointer-events:auto !important;margin-bottom:1rem}";export{g as salla_rating_modal}
4
+ import{r as t,h as a,H as s,a as i}from"./p-DpB3UAAA.js";import{a as e}from"./p-CgtvEd63.js";import{C as l}from"./p-BV4kqbdL.js";import{I as r}from"./p-C-tzSDxw.js";import{e as n}from"./p-DzAIgzdz.js";import{S as o}from"./p-lMgMt31Q.js";import{S as d}from"./p-CeFAfcTv.js";import{W as h}from"./p-CgR-T_ZS.js";import{H as m}from"./p-XnA1YTjA.js";const g=class{constructor(a){t(this,a),this.hasError=!1,this.showContactWidget=!0,this.images=[],this.productImages={},this.editItemImages=[],this.contact_body=(t,a,s)=>salla.lang.get("pages.rating.contact_subject",{store:t,id:a,customer:s}),this.editMode=!1,this.defaultMode=!1,this.deleteMode=!1,this.shouldOpenDeleteModal=!1,this.editItem=null,this.loyaltyImageRatingPoints=0,this.enableNewPopUp=!1,this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.addImagesLabel=salla.lang.get("pages.rating.add_images"),this.editImagesLabel=salla.lang.get("pages.rating.edit_images"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.contactUsLabel=salla.lang.get("blocks.footer.social"),this.loyaltyPointsForImagesLabel=salla.lang.get("pages.rating.loyalty_points_for_images",{points:":points"}),this.allowAttachImages=salla.config.get("store.settings.rating.allow_attach_images"),this.allowContactSupport=salla.config.get("store.settings.rating.allow_contact_support"),this.contentRefs=[],this.hiddenInputs=[],this.isOpen=[],this.stepsCount=0,this.currentIndex=0,this.submitted=[],this.MAX_UPLOAD_LIMIT=3,this.onOpen=t=>new Promise((a=>{e({targets:this.contentRefs[t],duration:100,height:this.contentRefs[t].scrollHeight,opacity:[0,1],easing:"easeOutQuart",complete:()=>a()})})),this.onClose=t=>new Promise((a=>{e({targets:this.contentRefs[t],duration:100,height:0,opacity:[1,0],easing:"easeOutQuart",complete:()=>a()})})),this.toggleUploader=async t=>{this.isOpen[t]=!this.isOpen[t],m.toggleElementClassIf(this.contentRefs[t],"is-closed","is-opened",(()=>!this.isOpen[t])),await(this.isOpen[t]?this.onOpen(t):this.onClose(t)),await new Promise((t=>setTimeout(t,101))),this.body&&this.currentTab&&setTimeout((()=>this.body.setAttribute("style",`height:${this.currentTab.offsetHeight+(this.editMode?60:0)}px`)))},salla.onReady((()=>{this.orderId=salla.config.get("page.id")})),salla.lang.onLoaded((()=>{this.contactUsLabel=salla.lang.get("blocks.footer.social");const t=(t,a,s)=>new Promise((i=>{salla.helpers.setNested(salla.lang.messages[t],a,s),i(!0)}));(async()=>{await t("ar.trans","common.uploader.drag_and_drop_files","اسحب الملفات وأفلتها هنا"),await t("en.trans","common.uploader.drag_and_drop_files","Drag and drop files here"),await t("ar.trans","common.uploader.allowed_images_types"," .jpg أو jpeg أو png يُسمح بإضافة صور بصيغة"),await t("en.trans","common.uploader.allowed_images_types","Images in jpg, jpeg, or png format are allowed."),await t("ar.trans","pages.rating.add_images","اضافة صور"),await t("en.trans","pages.rating.add_images","Add Images"),await t("ar.trans","pages.rating.edit_images","تعديل الصور"),await t("en.trans","pages.rating.edit_images","Edit Images"),await t("ar.trans","pages.rating.edit_review","تعديل التقييم"),await t("en.trans","pages.rating.edit_review","Edit review"),await t("ar.trans","pages.rating.confirm_deletion","تأكيد حذف التقييم"),await t("en.trans","pages.rating.confirm_deletion","Confirm review deletion"),await t("ar.trans","pages.rating.are_you_sure_you_want_to_delete_review","هل أنت متأكد من حذف تقييمك؟"),await t("en.trans","pages.rating.are_you_sure_you_want_to_delete_review","Are you sure you want to delete your review?"),await t("ar.trans","pages.rating.review_updated_successfully","تم تعديل التقييم بنجاح"),await t("en.trans","pages.rating.review_updated_successfully","The review has been successfully updated."),await t("ar.trans","pages.rating.review_deleted_successfully","تم حذف التقييم بنجاح"),await t("en.trans","pages.rating.review_deleted_successfully","The review has been successfully deleted."),await t("ar.trans","pages.rating.images_count","الصور ( :current من أصل :total )"),await t("en.trans","pages.rating.images_count","Images ( :current of :total )"),await t("ar.trans","pages.rating.loyalty_points_for_images","اكسب :points نقطة ولاء عند إضافة صور لتقييمك!"),await t("en.trans","pages.rating.loyalty_points_for_images","Earn :points loyalty points when adding photos to your review!"),await t("ar.trans","common.uploader.max_three_images",`.أضف ${this.MAX_UPLOAD_LIMIT} صور كحد أقصى`),await t("en.trans","common.uploader.max_three_images",`Add up to ${this.MAX_UPLOAD_LIMIT} images maximum.`),await t("ar.trans","common.elements.confirm_delete","تأكيد الحذف"),await t("en.trans","common.elements.confirm_delete","Confirm deletion"),this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.addImagesLabel=salla.lang.get("pages.rating.add_images"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.editImagesLabel=salla.lang.get("pages.rating.edit_images"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.loyaltyPointsForImagesLabel=salla.lang.get("pages.rating.loyalty_points_for_images",{points:":points"}),this.contact_body=(t,a,s)=>salla.lang.get("pages.rating.contact_body",{store:t,id:a,customer:s})})()}))}getV2Ref(){return this.v2Ref??this.host.querySelector("salla-rating-modal-v2")}syncNewPopUpFlag(){this.enableNewPopUp=!!salla.config.get("store.features")?.includes("new_popup_rating")}async open(){return await salla.onReady(),this.syncNewPopUpFlag(),this.enableNewPopUp?this.getV2Ref()?.open():(this.defaultMode=!0,new Promise((t=>{setTimeout((()=>{this.modal.open().then((()=>this.order||salla.api.withoutNotifier((()=>salla.rating.api.order(this.orderId?this.orderId:salla.config.get("page.id")))).then((t=>this.order=t.data)))).then((()=>this.readyUpLoyaltyPoints())).then((()=>this.modal.setTitle(`${salla.lang.get("pages.rating.rate_order")} <span class="unicode">(#${this.order.id})</span>`))).then((()=>{const t={};if(this.order?.products)for(const a of this.order.products)t[a.product.id]=[];this.productImages=t})).then((()=>this.modal.stopLoading())).then((()=>this.stepsCount=[this.order.testimonials_enabled,this.order.products_enabled,this.order.shipping_enabled].filter((t=>t)).length)).then((()=>setTimeout((()=>this.handleWizard()),100))).catch((a=>{t(!1),this.hasError=!0,this.errorMessage=a.response?.data?.error?.message||a.response?.data,this.modal.stopLoading()})),t(!0)}),50)})))}async openEditModal(t){if(await salla.onReady(),this.syncNewPopUpFlag(),this.enableNewPopUp)return this.getV2Ref()?.openEditModal(t);this.defaultMode=!1,this.editMode=!0,this.editType=t.type,this.editFeedbackId=t.feedback_id;try{await this.fetchEditItem(t.feedback_id),await this.readyUpLoyaltyPoints(),this.editModal.open()}catch(t){this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data}}async fetchEditItem(t){const a=`rating/${t}/show`,s=await salla.api.request(a);this.editItem=s.data,this.allowAttachImages&&"product"==this.editType&&this.editItem.images.length&&(this.editItemImages=this.editItem.images.map((t=>({id:`${Math.floor(100+900*Math.random())}`,url:t}))))}async editReview(){const t={};this.editModal.querySelectorAll("[name]").forEach((a=>{const s=salla.helpers.inputData(a.name,a.value,t);t[s.name]=s.value})),t.images&&(t.images=t.images.split(","));const a=`rating/${this.editFeedbackId}`;await salla.api.request(a,t,"put").then((t=>{this.editModal.close(),salla.notify.success(t.message||this.updatedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async openDeleteModal(t){return await salla.onReady(),this.syncNewPopUpFlag(),this.enableNewPopUp?this.getV2Ref()?.openDeleteModal(t):(this.defaultMode=!1,this.deleteMode=!0,this.deleteFeedbackId=t.feedback_id,this.shouldOpenDeleteModal=!0,new Promise((t=>{setTimeout((()=>{this.deleteModal.open().then((()=>t(!0)))}),50)})))}async deleteReview(){const t=`rating/${this.deleteFeedbackId}`;await salla.api.request(t,null,"delete").then((()=>{this.deleteModal.close(),salla.notify.success(this.deletedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async close(){return this.enableNewPopUp?this.getV2Ref()?.close():this.modal.close()}handleWizard(){this.steps=this.modal.querySelectorAll(".s-rating-modal-step"),this.dots=this.modal.querySelectorAll(".s-rating-modal-step-dot"),this.showActiveStep()}showActiveStep(t=null){this.currentTab=t||this.steps[this.currentIndex],m.toggleClassIf(".s-rating-modal-step-dot","s-rating-modal-bg-gray","s-rating-modal-bg-primary",(t=>t!=this.dots[this.currentIndex])).toggleClassIf(".s-rating-modal-step","s-rating-modal-active","s-rating-modal-hidden",(t=>t==this.currentTab)),0!==this.currentIndex&&(m.toggleElementClassIf(this.currentTab,"s-rating-modal-unactive","s-rating-modal-hidden",(()=>!0)),setTimeout((()=>m.toggleElementClassIf(this.currentTab,"s-rating-modal-active","s-rating-modal-unactive",(()=>!0))),300));const a=this.steps[this.currentIndex+1]?.dataset.type;this.nextBtn?.setText(a?`${salla.lang.get("pages.rating.rate")} ${salla.lang.get(`pages.rating.${a}`)}`:salla.lang.get("pages.rating.send_ratings")),setTimeout((()=>this.body?.setAttribute("style",`height:${this.currentTab?.offsetHeight}px`)))}previousTab(){this.currentIndex>0&&this.currentIndex--,m.toggleElementClassIf(this.backBtn,"s-rating-modal-unvisiable","block",(()=>0==this.currentIndex)),this.showActiveStep()}submit(){this.submittedBefore()||this.validate(),salla.config.canLeave=!1,this.nextBtn.load().then((()=>this.submittedBefore()||this.sendFeedback())).then((()=>this.currentTab.querySelectorAll("[name],.s-rating-modal-btn-star").forEach((t=>t.setAttribute("disabled",""))))).then((()=>this.currentIndex<this.stepsCount&&this.currentIndex++)).then((()=>this.showActiveStep())).then((()=>m.toggleClassIf("#prev-btn","block","s-rating-modal-unvisiable",(()=>!0)))).finally((()=>{this.nextBtn.stop(),salla.config.canLeave=!0,this.currentIndex==this.stepsCount&&(this.showThankYou(),this.showContactWidget=!1)}))}submittedBefore(){return this.submitted.includes(this.currentIndex)}validate(t=null,a=null){if(!t&&"products"===this.currentTab.dataset.type)return void this.currentTab.querySelectorAll(".rating-outer-form").forEach((t=>this.validate(t,"product")));const s=(t=t||this.currentTab).querySelector(".rating_hidden_input").value,i=t.querySelector(".s-rating-modal-validation-msg");if(a=a||t.dataset.type,!s)throw i.innerHTML=salla.lang.get(`pages.rating.rate_${a}_stars`).replace(" (:item)",""),new Error(i.innerHTML);i.innerHTML=""}sendFeedback(){const t={};if(this.currentTab.querySelectorAll("[name]").forEach((a=>{const s=salla.helpers.inputData(a.name,a.value,t);t[s.name]=s.value})),this.allowAttachImages&&t.products)for(let a in t.products)t.products[a].images&&(t.products[a].images=t.products[a].images.split(","));if(0!=Object.keys(t).length)return t.order_id=this.orderId,t.type=this.currentTab.dataset.type,salla.rating.api[this.currentTab.dataset.type](t).then((t=>(this.submitted.push(this.currentIndex),t)))}showThankYou(){let t=10,a=setInterval((()=>{this.thanksTime.innerHTML="00:0"+t--,t>0||(clearInterval(a),this.thanksTime.remove(),this.close().then((()=>window.location.reload())))}),1e3);this.modal.querySelector(".s-rating-modal-footer").classList.add("s-rating-modal-unvisiable"),this.showActiveStep(this.thanksTab)}getFilepondPlaceholder(){return`<div class="s-rating-modal-filepond-placeholder"><span class="s-rating-modal-filepond-placeholder-icon">${r}</span><p class="s-rating-modal-filepond-placeholder-text">${this.dragAndDropFilesLabel}<br>\n <span> ${this.allowedImagesTypesLabel} <br> ${this.threeImagesMax} </span></p></div>`}getCustomerName(){return`${salla.config.get("user.first_name")||salla.storage.get("user.first_name")||""} ${salla.config.get("user.last_name")||salla.storage.get("user.last_name")||""}`}handleSendEmail(){const t=`${this.contactSubjectLabel} #${this.order.id}`,a=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),s=`mailto:${salla.config.get("store.contacts.email")}?subject=${encodeURIComponent(t)}&body=${encodeURIComponent(a)}`;window.open(s,"_blank")}handleSendWhatsApp(){const t=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),a=`https://wa.me/${salla.config.get("store.contacts.whatsapp")}?text=${encodeURIComponent(t)}`;window.open(a,"_blank")}resetData(t){t.detail||(this.modal?.close(),this.editItem=null,this.editItemImages=[],this.hiddenInputs[1]&&(this.hiddenInputs[1].value=""),this.deleteFeedbackId=null,this.editFeedbackId=null,this.shouldOpenDeleteModal=!1,this.editMode=!1,this.deleteMode=!1,this.defaultMode=!1,this.loyaltyImageRatingPoints=0)}async readyUpLoyaltyPoints(){const t=salla.loyalty?.isFeatureEnabled?.();if(!t)return void(this.loyaltyImageRatingPoints=0);const a=salla.config.get("store.settings.rating.rating_product_points")||0,s=salla.config.get("store.settings.rating.rating_product_with_image_points")||0;this.loyaltyImageRatingPoints=Number(s)+Number(a)}loyaltyPointsNote(){if(!this.loyaltyImageRatingPoints||!this.loyaltyPointsForImagesLabel)return null;const t=a("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a("path",{d:"M10 0C13.6819 0 16.6667 2.98477 16.6667 6.66664C16.6667 9.37047 15.057 11.6984 12.7437 12.7444C11.6978 15.0575 9.3701 16.6666 6.66668 16.6666C2.98477 16.6666 0 13.6819 0 9.99998C0 7.29656 1.60918 4.96894 3.92195 3.92276C4.96827 1.60964 7.29618 0 10 0ZM6.66668 5C3.90524 5 1.66667 7.23856 1.66667 9.99998C1.66667 12.7614 3.90524 15 6.66668 15C9.4281 15 11.6667 12.7614 11.6667 9.99998C11.6667 7.23856 9.4281 5 6.66668 5ZM7.50002 5.83333V6.66664H9.16668V8.33331H5.83333C5.60322 8.33331 5.41667 8.51989 5.41667 8.74998C5.41667 8.95456 5.56407 9.12464 5.75844 9.15998L5.83333 9.16664H7.50002C8.6506 9.16664 9.58335 10.0994 9.58335 11.25C9.58335 12.4006 8.6506 13.3333 7.50002 13.3333V14.1666H5.83333V13.3333H4.16667V11.6666H7.50002C7.7301 11.6666 7.91668 11.4801 7.91668 11.25C7.91668 11.0455 7.76927 10.8753 7.57493 10.8401L7.50002 10.8333H5.83333C4.68274 10.8333 3.75 9.90056 3.75 8.74998C3.75 7.59939 4.68274 6.66664 5.83333 6.66664V5.83333H7.50002ZM10 1.66667C8.51377 1.66667 7.17893 2.31513 6.26313 3.34457C6.39704 3.33736 6.53138 3.33333 6.66668 3.33333C10.3486 3.33333 13.3333 6.3181 13.3333 9.99998C13.3333 10.1356 13.3293 10.2702 13.3213 10.4037C14.3513 9.48814 15 8.15314 15 6.66664C15 3.90524 12.7614 1.66667 10 1.66667Z",fill:"#008C56"}));return a("div",{class:"s-rating-modal-loyalty-points-note-container"},a("span",{class:"s-rating-modal-loyalty-points-note-icon"},t),a("p",{class:"s-rating-modal-loyalty-points-note-text"},this.loyaltyPointsForImagesLabel.replace(":points",String(this.loyaltyImageRatingPoints))))}getDeleteModal(){return a("salla-modal",{ref:t=>this.deleteModal=t,width:"xs",onModalVisibilityChanged:t=>this.resetData(t)},a("div",{class:"s-rating-modal-delete-wrapper",ref:t=>this.body=t},a("h3",null,this.confirmDeletionLabel),a("p",null,this.areYouSureLabel),a("div",{class:"s-rating-modal-delete-actions"},a("salla-button",{loaderPosition:"center",onClick:()=>this.deleteReview()},this.confirmDeleteBtn),a("salla-button",{color:"danger",fill:"outline",onClick:()=>this.deleteModal.close()},this.cancelLabel))))}renderUploadedImagesCount(t){const s=this.editMode?this.editItemImages.length:(this.productImages[t]||[]).length;return a("span",{class:"s-rating-modal-upload-count"},salla.lang.choice("pages.rating.images_count",s,{current:s,total:this.MAX_UPLOAD_LIMIT}))}getEditModal(){return a("salla-modal",{ref:t=>this.editModal=t,width:"md",onModalVisibilityChanged:t=>this.resetData(t)},a("div",{class:"s-rating-modal-edit-wrapper",ref:t=>this.body=t},"store"===this.editType&&this.editItem?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"store",ref:t=>this.currentTab=t},a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),a("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),a("textarea",{name:"content",value:this.editItem.content,class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):null,"shipping"===this.editType&&this.editItem?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"shipping",ref:t=>this.currentTab=t},this.editItem.shipping.logo?a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:this.editItem.shipping.logo,class:"s-rating-modal-shipping-logo",alt:this.editItem.shipping.name})):a("span",{class:"s-rating-modal-icon",innerHTML:o}),a("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.editItem.shipping.name}`),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),a("textarea",{name:"content",class:"s-rating-modal-comment",value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):null,"product"==this.editType&&this.editItem?a("section",{class:"s-rating-modal-step","data-type":"products",ref:t=>this.currentTab=t},a("div",{class:"s-rating-modal-product"},this.allowAttachImages&&this.loyaltyPointsNote(),a("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},a("div",{class:"s-rating-modal-product-img-wrap"},a("img",{src:this.editItem.product.image.url,alt:this.editItem.product.name,class:"s-rating-modal-product-img"})),a("div",{class:"s-rating-modal-product-details"},a("div",{class:"s-rating-modal-product-details-main"},a("div",null,a("h3",{class:"s-rating-modal-product-title"}," ",this.editItem.product.name),a("div",{class:"s-rating-modal-stars-product"},a("salla-rating-stars",{withLabel:!0,size:"small",editable:!0,value:this.editItem.stars}))),this.allowAttachImages&&a("salla-button",{class:"s-comments-item-like-btn mt-0",loaderPosition:"center",fill:"outline",size:"small",onClick:()=>this.toggleUploader(1)},a("span",null,this.editItemImages.length?this.editImagesLabel:this.addImagesLabel),a("span",{innerHTML:r}))),a("textarea",{value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"content",class:"s-rating-modal-comment"}),a("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&a("div",{class:"s-rating-modal-uploader is-closed",ref:t=>this.contentRefs[1]=t},a("salla-file-upload",{name:"images",allowMultiple:!0,maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,filePosterHeight:117,"instant-upload":!0,type:"feedback",files:JSON.stringify(this.editItemImages),payloadName:"files[]",id:`file-${this.editItem.product.id}`,title:this.editItem.product.name,instantUpload:!0,accept:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:t=>{this.editItemImages=[...this.editItemImages,t.detail],this.hiddenInputs[1].value=this.editItemImages.map((t=>t.url)).join()},onRemoved:t=>{const a=t.detail;a&&(this.editItemImages=this.editItemImages.filter((t=>t.id!==a)),this.hiddenInputs[1].value=this.editItemImages.map((t=>t.url)).join())},labelIdle:this.getFilepondPlaceholder()}),a("input",{type:"hidden",name:"images",value:this.editItem.images.join(","),ref:t=>this.hiddenInputs[1]=t}),this.renderUploadedImagesCount(this.editItem.product.id)))):null,a("div",{class:"s-rating-modal-footer s-rating-modal-footer-end"},a("salla-button",{"loader-position":"center",onClick:()=>this.editReview()},this.editReviewLabel))))}render(){return this.enableNewPopUp?a(s,{class:"s-rating-modal"},a("salla-rating-modal-v2",{ref:t=>this.v2Ref=t,orderId:this.orderId})):this.deleteMode?a(s,{class:"s-rating-modal"},this.getDeleteModal()):this.editMode?a(s,{class:"s-rating-modal"},this.getEditModal()):this.defaultMode?a(s,{class:"s-rating-modal"},a("salla-modal",{class:"s-rating-modal-wrap",onModalVisibilityChanged:t=>this.resetData(t),isLoading:!0,width:"md",ref:t=>this.modal=t},a("div",{slot:"loading"},a("div",{class:"s-rating-modal-skeleton"},a("salla-skeleton",{type:"circle",height:"80px",width:"80px"}),a("salla-skeleton",{height:"15px",width:"60%"}),a("salla-skeleton",{height:"10px",width:"30%"}),a("div",{class:"s-rating-modal-skeleton-stars"},[...Array(5)].map((t=>a("div",{key:t,innerHTML:d})))),a("salla-skeleton",{height:"100px",width:"100%"}),a("div",{class:"s-rating-modal-skeleton-footer"},a("salla-skeleton",{height:"40px",width:"30%"})))),!this.hasError&&this.order?[a("div",{class:"s-rating-modal-wrapper",ref:t=>this.body=t},this.order?.testimonials_enabled?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"store"},a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),a("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large"})),a("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):"",this.order.products_enabled?a("section",{class:"s-rating-modal-step s-rating-modal-hidden","data-type":"products"},this.allowAttachImages&&this.loyaltyPointsNote(),this.order.products.map(((t,s)=>a("div",{class:"s-rating-modal-product",key:s},a("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},a("div",{class:"s-rating-modal-product-img-wrap"},a("img",{src:t.product.thumbnail,alt:t.product.name,class:"s-rating-modal-product-img"})),a("div",{class:"s-rating-modal-product-details"},a("div",{class:"s-rating-modal-product-details-main"},a("div",null,a("h3",{class:"s-rating-modal-product-title"}," ",t.product.name),a("div",{class:"s-rating-modal-stars-product"},a("salla-rating-stars",{withLabel:!0,size:"small",name:`products[${s}][rating]`}))),this.allowAttachImages&&a("salla-button",{class:"s-comments-item-like-btn mt-0",loaderPosition:"center",fill:"outline",size:"small",onClick:()=>this.toggleUploader(s)},a("span",null,this.addImagesLabel),a("span",{innerHTML:r}))),a("input",{type:"hidden",name:`products[${s}][product_id]`,value:t.product.id}),a("textarea",{placeholder:salla.lang.get("pages.rating.write_product_rate"),name:`products[${s}][comment]`,class:"s-rating-modal-comment"}),a("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&a("div",{class:"s-rating-modal-uploader is-closed",ref:t=>this.contentRefs[s]=t},a("salla-file-upload",{name:"image",maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,"instant-upload":!0,type:"feedback",payloadName:"files[]",id:`file-${t.product.id}`,title:t.product.name,allowMultiple:!0,instantUpload:!0,accept:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:a=>{this.productImages={...this.productImages,[t.product.id]:[...this.productImages[t.product.id]||[],a.detail]},this.hiddenInputs[s].value=this.productImages[t.product.id].map((t=>t.url)).join(",")},onRemoved:a=>{const i=a.detail;i&&this.productImages[t.product.id]&&(this.productImages={...this.productImages,[t.product.id]:this.productImages[t.product.id].filter((t=>t.id!==i))},this.hiddenInputs[s].value=this.productImages[t.product.id].map((t=>t.url)).join(","))},labelIdle:this.getFilepondPlaceholder()}),a("input",{type:"hidden",name:`products[${s}][images]`,value:(this.productImages[t.product.id]||[]).map((t=>t.url)).join(","),ref:t=>this.hiddenInputs[s]=t}),this.renderUploadedImagesCount(t.product.id)))))):"",this.order.shipping_enabled&&this.order.shipping?.company?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"shipping"},a("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.company.id}),this.order.shipping.company.logo?a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:this.order.shipping.company.logo,class:"s-rating-modal-shipping-logo",alt:this.order.shipping.company.name})):a("span",{class:"s-rating-modal-icon",innerHTML:o}),a("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.order.shipping.company.name}`),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large"})),a("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):"",a("div",{class:"s-rating-modal-thanks s-rating-modal-hidden",ref:t=>this.thanksTab=t},a("span",{class:"s-rating-modal-icon",innerHTML:l}),a("h3",{class:"s-rating-modal-thanks-title"},salla.lang.get("pages.rating.thanks")),a("div",{class:"s-rating-modal-thanks-msg",innerHTML:this.order.thanks_message}),a("time",{class:"s-rating-modal-thanks-time",ref:t=>this.thanksTime=t}))),this.allowContactSupport&&this.showContactWidget&&(salla.config.get("store.contacts.whatsapp")||salla.config.get("store.contacts.email"))?a("div",{class:"s-rating-modal-contact"},a("p",null,this.contactUsLabel),a("div",{class:"s-rating-modal-contact-icons"},salla.config.get("store.contacts.whatsapp")&&a("span",{onClick:()=>this.handleSendWhatsApp(),innerHTML:h}),salla.config.get("store.contacts.email")&&a("span",{onClick:()=>this.handleSendEmail(),innerHTML:n}))):"",a("div",{class:"s-rating-modal-footer"},a("button",{ref:t=>this.backBtn=t,onClick:()=>this.previousTab(),class:"s-rating-modal-btn s-rating-modal-unvisiable"},salla.lang.get("common.elements.back")),this.stepsCount>1?a("ul",{class:"s-rating-modal-dots"},[0,1,2].slice(0,this.stepsCount).map((t=>a("li",{key:t,class:"s-rating-modal-bg-gray s-rating-modal-step-dot"})))):"",a("salla-button",{"loader-position":"center",ref:t=>this.nextBtn=t,onClick:()=>this.submit()},salla.lang.get("common.elements.next")))]:a("salla-placeholder",{alignment:"center"}))):void 0}async componentWillLoad(){salla.event.on("rating::open",(()=>this.open())),salla.event.on("rating::edit",(t=>this.openEditModal(t))),salla.event.on("rating::delete",(t=>this.openDeleteModal(t))),await salla.onReady(),this.syncNewPopUpFlag()}componentDidLoad(){salla.event.dispatch("rating::ready",this)}get host(){return i(this)}};g.style=".s-rating-modal-product-details{padding-bottom:0.5rem}.s-rating-modal-comment{margin-top:0.35rem}.s-rating-modal-product{margin-bottom:1rem}.s-rating-modal-product-img{position:absolute !important;inset:0;display:block;width:100% !important;max-width:100% !important;height:100% !important;object-fit:cover}.s-rating-modal-product-title{font-size:0.95rem;font-weight:600;line-height:1.5;margin:0}.s-rating-modal-stars-product{margin-top:0.5rem}.s-rating-modal-loyalty-points-note-container{display:flex;align-items:center;gap:0.625rem;width:100%;margin-top:1.5rem;margin-bottom:0.75rem;padding:0.75rem;border-radius:0.5rem;background-color:#E6F4EA}.s-rating-modal-loyalty-points-note-icon{display:flex;flex-shrink:0;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;color:#1B7F5C}.s-rating-modal-loyalty-points-note-icon svg{width:1.5rem;height:1.5rem;fill:currentColor}.s-rating-modal-loyalty-points-note-text{flex:1;margin:0;font-size:0.875rem;line-height:1.25rem;color:#1f2937}.s-rating-modal-product-details-main{display:flex;align-items:center;margin-bottom:0.5rem;padding-bottom:0;border-bottom:0}.s-rating-modal-product-info-row{display:flex;align-items:center;gap:0.6rem;margin-bottom:0.5rem;padding-bottom:0;border-bottom:0}.s-rating-modal-product-main-review{width:100%;text-align:right}.s-rating-modal-product-rating-rows{display:grid;gap:0.45rem;margin:0.2rem 0 0.7rem}.s-rating-modal-product-rating-row{display:flex;align-items:center;justify-content:space-between;gap:0.75rem;min-height:2rem}.s-rating-modal-product-rating-row salla-rating-stars{flex-shrink:0}.s-rating-modal-product-rating-row .s-rating-stars-wrapper{align-items:center;min-height:1.75rem}.s-rating-modal-product-rating-row .s-rating-stars-label,.s-rating-modal-product-rating-row .s-rating-stars-label-without-tag{min-width:auto;min-height:1.25rem;line-height:1.25rem;font-size:0.8rem;color:#5b6470;white-space:nowrap;text-align:end;transition:opacity 0.15s ease}.s-rating-modal-product-rating-row .s-rating-stars-label--empty,.s-rating-modal-product-rating-row .s-rating-stars-label-without-tag--empty{opacity:0}.s-rating-modal-product-rating-row-main{margin-bottom:0.35rem;padding:0.5rem 0.6rem;border:1px solid #d1d5db;border-radius:0.45rem;background:transparent}.s-rating-modal-product-factor-name{color:#5b6470;font-size:0.9rem;line-height:1.25}.s-rating-modal-product-rating-row-main .s-rating-modal-product-factor-name{font-size:1rem;color:#5b6470}.s-rating-modal-product-factor-required{color:#f87171;margin-inline-start:0.2rem}.s-rating-modal-product-img-wrap{position:relative;width:5rem !important;min-width:5rem !important;max-width:5rem !important;height:3.5rem !important;flex-shrink:0 !important;overflow:hidden;border-radius:0.375rem;background:#f3f4f6}.s-rating-modal-uploader.is-opened{height:auto !important;opacity:1 !important;overflow:visible !important;pointer-events:auto !important;margin-bottom:1rem}";export{g as salla_rating_modal}
@@ -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,i as r,j as n,k as l,d as o}from"./p-DgmW0rL4.js";import{S as h}from"./p-BZp0rKEO.js";import{a as c}from"./p-CgtvEd63.js";import{H as m}from"./p-XnA1YTjA.js";import{S as d}from"./p-D4oPi1Ov.js";import{a as p}from"./p-BedNk7k1.js";import{S as g}from"./p-DiKTtDW5.js";const u=class{constructor(i){s(this,i),this.commentAdded=t(this,"commentAdded"),this.placeholder=salla.lang.get("blocks.comments.placeholder"),this.submitText=salla.lang.get("blocks.comments.submit"),salla.lang.onLoaded((()=>{this.placeholder=salla.lang.get("blocks.comments.placeholder"),this.submitText=salla.lang.get("blocks.comments.submit")})),salla.onReady((()=>{this.canComment=salla.config.get("user.can_comment"),this.itemId=salla.config.get("page.id"),this.type=salla.url.is_page("page-single")?"page":salla.url.is_page("blog.single")?"blog":"product"}))}submit(){if(!this.commentForm.reportValidity())return void salla.log("CommentForm:: validation error!");const s=this.commentField.value;this.submitBtn.load().then((()=>salla.comment.add({id:this.itemId,comment:s,type:this.type}))).then((()=>{this.commentAdded.emit({name:salla.config.get("user.name"),avatar:salla.config.get("user.avatar"),content:s,is_pending:!0,created_at:{date:(new Date).toISOString().replace("T"," ").substring(0,19)},images:[]}),this.commentField.value=""})).finally((()=>this.submitBtn.stop()))}render(){return i(e,{key:"0e3a24dcfe8922106b9479aa559cf0e126bc3fcf"},this.canComment?i("form",{ref:s=>this.commentForm=s},i("div",{class:"s-comment-form-wrapper"},this.showAvatar?i("img",{class:"s-comment-form-avatar",src:salla.config.get("user.avatar"),alt:"user avatar"}):"",i("div",{class:"s-comment-form-content"},i("textarea",{cols:30,rows:5,minlength:"4",maxlength:"500",ref:s=>this.commentField=s,placeholder:this.placeholder,class:"s-comment-form-input",required:!0}),i("br",null),i("div",{class:"s-comment-form-action"},i("salla-button",{ref:s=>this.submitBtn=s,"loader-position":"center",onClick:()=>this.submit()},this.submitText))))):"")}};u.style=":host{display:block}";const v=class{constructor(t){s(this,t),this.locked_trans=salla.lang.get("blocks.comments.locked"),this.has_bought_trans=salla.lang.get("blocks.comments.has_bought"),this.rated_trans=salla.lang.get("pages.rating.rated"),this.waiting_approval_trans=salla.lang.get("blocks.comments.waiting_approval"),this.has_order_trans=salla.lang.get("blocks.comments.has_order"),this.allowLikes=salla.config.get("store.settings.rating.allow_likes"),this.allowAttachImages=salla.config.get("store.settings.rating.allow_attach_images"),this.helpfulLabel=salla.lang.get("blocks.comments.helpful"),this.reviewDetailsLabel=salla.lang.get("blocks.comments.review_details"),this.likesCount=0,this.likedComments=[],this.showReviewFactors=!1,salla.lang.onLoaded((()=>{const s=(s,t,i)=>new Promise((e=>{salla.helpers.setNested(salla.lang.messages[s],t,i),e(!0)}));this.locked_trans=salla.lang.get("blocks.comments.locked"),this.has_bought_trans=salla.lang.get("blocks.comments.has_bought"),this.rated_trans=salla.lang.get("pages.rating.rated"),this.waiting_approval_trans=salla.lang.get("blocks.comments.waiting_approval"),this.has_order_trans=salla.lang.get("blocks.comments.has_order"),(async()=>{await s("ar.trans","blocks.comments.helpful","مفيد"),await s("en.trans","blocks.comments.helpful","Helpful"),await s("ar.trans","blocks.comments.review_details","تفاصيل التقييم"),await s("en.trans","blocks.comments.review_details","Review details"),await s("ar.trans","blocks.comments.locked","الرد غير ظاهر لباقي العملاء"),await s("en.trans","blocks.comments.locked","The reply is not visible to other customers"),this.reviewDetailsLabel=salla.lang.get("blocks.comments.review_details"),this.helpfulLabel=salla.lang.get("blocks.comments.helpful"),this.locked_trans=salla.lang.getWithDefault("blocks.comments.locked","الرد غير ظاهر لباقي العملاء")})()}))}componentDidLoad(){if(this.comment){this.likesCount=this.comment.likes_count;try{this.likedComments=JSON.parse(localStorage.getItem("liked_comments")||"[]"),this.likedComments.includes(this.comment.id)&&(this.likeBtn.classList.add("liked"),this.likeBtn.fill="solid")}catch{salla.log("Bad json for liked_comments")}}}getReplies(){return Array.isArray(this.comment.replies)?this.comment.replies:[this.comment.replies]}getDate(s){const[t]=s.split(" "),[i,e,a]=t.split("-");return`${parseInt(a,10)}/${parseInt(e,10)}/${parseInt(i,10)}`}getTime(s){const[,t]=s.split(" "),[i,e]=t.split(":");return`${parseInt(i,10)}:${parseInt(e,10)}`}async toggleLike(){if(salla.config.isGuest())return salla.notify.error(salla.lang.get("common.messages.must_login"));this.likedComments=JSON.parse(localStorage.getItem("liked_comments")||"[]");const s=this.likedComments.includes(this.comment.id);try{const t=s?`rating/${this.comment.id}/unlike`:`rating/${this.comment.id}/like`,i=await salla.api.request(t,"","put");salla.log(i.message),s?(this.likeBtn.classList.remove("liked"),this.likeBtn.fill="outline",this.updateLikedComments(this.comment.id,!1),this.likesCount--):(this.likeBtn.classList.add("liked"),this.likeBtn.fill="solid",this.updateLikedComments(this.comment.id,!0),this.likesCount++)}catch(s){409==s.response.status&&(this.likeBtn.classList.contains("liked")?(this.likeBtn.fill="outline",this.likeBtn.classList.remove("liked"),this.updateLikedComments(this.comment.id,!1),this.likesCount--):(this.likeBtn.fill="solid",this.likeBtn.classList.add("liked"),salla.logger.warn("Like already exists"),this.updateLikedComments(this.comment.id,!0)))}}updateLikedComments(s,t){this.likedComments=JSON.parse(localStorage.getItem("liked_comments")||"[]"),t?this.likedComments.includes(s)||this.likedComments.push(s):this.likedComments=this.likedComments.filter((t=>t!==s)),localStorage.setItem("liked_comments",JSON.stringify(this.likedComments))}isPrivateComment(s){return"hidden"===s.status}getReviewFactors(){return Array.isArray(this.comment.factor_reviews)?this.comment.factor_reviews:[]}PinnedIcon(){return i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"16",height:"16",color:"#555555",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},i("path",{d:"M12 16V21"}),i("path",{d:"M8 5.2918C8 5.02079 8 4.88529 8.01312 4.77132C8.1194 3.84789 8.84789 3.1194 9.77133 3.01312C9.88529 3 10.0208 3 10.2918 3H13.7082C13.9792 3 14.1147 3 14.2287 3.01312C15.1521 3.1194 15.8806 3.84789 15.9869 4.77132C16 4.88529 16 5.02079 16 5.2918C16 5.37885 16 5.42237 15.9967 5.46264C15.9708 5.78281 15.7927 6.07104 15.5179 6.2374C15.4834 6.25832 15.4444 6.27779 15.3666 6.31672L15.1055 6.44726C14.7021 6.64897 14.5003 6.74983 14.3681 6.90564C14.26 7.03286 14.1856 7.18509 14.1515 7.34846C14.1097 7.54854 14.1539 7.76968 14.2424 8.21197L15 12H15.3333C15.9533 12 16.2633 12 16.5176 12.0681C17.2078 12.2531 17.7469 12.7922 17.9319 13.4824C18 13.7367 18 14.0467 18 14.6667C18 14.9767 18 15.1317 17.9659 15.2588C17.8735 15.6039 17.6039 15.8735 17.2588 15.9659C17.1317 16 16.9767 16 16.6667 16H7.33333C7.02334 16 6.86835 16 6.74118 15.9659C6.39609 15.8735 6.12654 15.6039 6.03407 15.2588C6 15.1317 6 14.9767 6 14.6667C6 14.0467 6 13.7367 6.06815 13.4824C6.25308 12.7922 6.79218 12.2531 7.48236 12.0681C7.73669 12 8.04669 12 8.66667 12H9L9.75761 8.21197C9.84606 7.76968 9.89029 7.54854 9.84852 7.34846C9.81441 7.18509 9.73995 7.03286 9.63194 6.90564C9.49965 6.74983 9.29794 6.64897 8.89452 6.44726L8.63344 6.31672C8.55558 6.27779 8.51665 6.25832 8.48208 6.2374C8.20731 6.07104 8.02917 5.78281 8.00326 5.46264C8 5.42237 8 5.37885 8 5.2918Z"}))}LockedIcon(){return i("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("path",{d:"M3.5 4.66683V4.0835C3.5 2.1505 5.067 0.583496 7 0.583496C8.93299 0.583496 10.5 2.1505 10.5 4.0835V4.66683H11.6667C11.9888 4.66683 12.25 4.928 12.25 5.25016V12.2502C12.25 12.5723 11.9888 12.8335 11.6667 12.8335H2.33333C2.01117 12.8335 1.75 12.5723 1.75 12.2502V5.25016C1.75 4.928 2.01117 4.66683 2.33333 4.66683H3.5ZM11.0833 5.8335H2.91667V11.6668H11.0833V5.8335ZM6.41667 9.1774C6.06795 8.97568 5.83333 8.59867 5.83333 8.16683C5.83333 7.52248 6.35565 7.00016 7 7.00016C7.64435 7.00016 8.16667 7.52248 8.16667 8.16683C8.16667 8.59867 7.93205 8.97568 7.58333 9.1774V10.5002H6.41667V9.1774ZM4.66667 4.66683H9.33333V4.0835C9.33333 2.79483 8.28864 1.75016 7 1.75016C5.71134 1.75016 4.66667 2.79483 4.66667 4.0835V4.66683Z",fill:"#555555"}))}render(){if(!this.comment)return null;let s="admin"==this.comment.type;const t=this.getReviewFactors(),a=t.length>0;return i(e,{class:s?"s-comments-item-admin":"s-comments-item"},i("div",{class:{"s-comments-item-wrapper":!s,"s-comments-item-admin-wrapper":s},id:`s-comments-item-${this.comment.id}`},i("div",{class:"s-comments-item-inner s-comments-flex-1"},s&&i("span",{class:"s-comments-item-reply-icon",innerHTML:'\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>reply</title>\n<path d="M20 14.667h-12.609l9.401-6.927c0.592-0.436 0.72-1.271 0.283-1.863-0.439-0.595-1.273-0.72-1.864-0.283l-12.667 9.333c-0.343 0.251-0.544 0.649-0.544 1.072s0.201 0.821 0.543 1.073l12.667 9.333c0.237 0.176 0.515 0.26 0.789 0.26 0.409 0 0.813-0.188 1.075-0.543 0.437-0.592 0.309-1.427-0.283-1.863l-9.4-6.928h12.609c4.412 0 8 3.588 8 8 0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-5.881-4.785-10.667-10.667-10.667z"></path>\n</svg>\n'}),i("div",{class:"s-comments-item-avatar"},i("img",{"data-src":this.comment?.avatar,alt:this.comment?.name,src:this.comment?.avatar,class:"s-comments-item-avatar-img lazy"})),i("div",{class:"s-comments-flex-1"},i("div",{class:"s-comments-item-user-wrapper"},i("div",{class:"s-comments-item-user-info"},i("h3",{class:this.comment.is_pinned?"s-comments-item-user-info-name":"s-comments-item-user-info-name-with-margin"},this.comment?.name),this.comment.is_pinned?i("div",{class:"s-comments-item-pinned-icon-with-margin"},this.PinnedIcon()):null,!this.comment.has_order&&!this.comment.rating||this.comment.is_pending||this.hideBought?null:i("div",{class:"s-comments-flex"},this.comment.has_order?[i("span",{class:"s-comments-item-has-order-check-icon",innerHTML:h}),i("span",{class:"s-comments-item-has-order-check-text"},this.has_bought_trans," ",this.comment.rating?", ":"")]:null,this.comment.rating?i("span",{class:"s-comments-item-rated-widget"},this.rated_trans):null)),i("p",{class:"s-comments-item-timestamp s-ltr"},this.getDate(this.comment.created_at?.date),i("span",{class:"s-comments-item-time"}," - ",this.getTime(this.comment.created_at?.date)))),(!!this.comment.rating||!!this.comment.stars||a)&&i("div",{class:"flex flex-row gap-4 mt-2 mb-4"},this.comment.rating||this.comment.stars?i("salla-rating-stars",{class:"w-auto",size:"medium",value:this.comment.rating||this.comment.stars}):null,a&&i("button",{class:"s-comments-item-review-factors-toggle",type:"button",onClick:()=>this.showReviewFactors=!this.showReviewFactors},i("span",null,this.reviewDetailsLabel),i("span",{class:{"s-comments-item-review-factors-chevron":!0,"is-open":this.showReviewFactors}},"⌃"))),i("div",{class:"s-comments-item-content"},a&&this.showReviewFactors&&i("salla-comment-factors",{factors:t}),i("div",{class:"s-comments-item-content-container"},this.isPrivateComment(this.comment)?i("div",{id:`s-comments-item-${this.comment.id}-locked-icon`,class:"s-comments-item-pinned-icon"},this.LockedIcon()):null,i("p",{innerHTML:this.comment.content})),this.isPrivateComment(this.comment)?i("salla-tooltip",{text:this.locked_trans,targetId:`s-comments-item-${this.comment.id}-locked-icon`}):null,this.allowAttachImages&&i("div",{class:"s-comments-item-images"},this.comment.images.map(((s,t)=>i("img",{key:t,src:s,alt:"",onClick:()=>this.modal.open()}))),i("salla-modal",{ref:s=>this.modal=s,width:"sm"},i("salla-slider",{id:`s-comments-item-${this.comment.id}-images`,class:"s-comments-item-images-slider",type:"thumbs","auto-height":!0,showControls:this.comment.images.length>1,"show-thumbs-controls":"false"},i("div",{slot:"items"},this.comment.images.map(((s,t)=>i("img",{key:t,src:s,alt:""})))),i("div",{slot:"thumbs"},this.comment.images.map(((s,t)=>i("div",{class:"s-comments-item-images-slider-thumb"},i("img",{key:t,src:s,alt:""})))))))),this.allowLikes&&!s&&this.comment.id&&salla.url.is_page("product.single")?i("salla-button",{ref:s=>this.likeBtn=s,class:"s-comments-item-like-btn "+(this.likedComments.includes(this.comment.id)?"liked":""),loaderPosition:"center",fill:"outline",size:"small",onClick:()=>this.toggleLike()},i("span",null,this.helpfulLabel," ",this.likesCount>0?`(${this.likesCount})`:""),i("span",{innerHTML:'\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>thumbs-up</title>\n<path d="M26.667 10.667h-8.261l1.279-3.38c0.723-1.911 0.087-4.051-1.549-5.203-0.909-0.639-2.004-0.881-3.085-0.684-1.101 0.203-2.061 0.837-2.703 1.787l-5.452 8.067c-0.148 0.22-0.228 0.48-0.228 0.747v12c0 3.676 2.991 6.667 6.667 6.667h8.688c2.535 0 4.817-1.407 5.955-3.671l2.548-5.063c0.093-0.187 0.143-0.392 0.143-0.6v-6.667c0-2.205-1.795-4-4-4zM28 21.017l-2.405 4.78c-0.683 1.359-2.052 2.203-3.573 2.203h-8.688c-2.205 0-4-1.795-4-4v-11.592l5.223-7.728c0.237-0.352 0.584-0.585 0.975-0.657 0.367-0.067 0.749 0.017 1.068 0.241 0.631 0.444 0.879 1.317 0.591 2.079l-1.963 5.185c-0.156 0.409-0.099 0.869 0.149 1.229s0.66 0.576 1.099 0.576h10.192c0.735 0 1.333 0.599 1.333 1.333zM2.667 10.667c-0.736 0-1.333 0.597-1.333 1.333v16c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-16c0-0.736-0.597-1.333-1.333-1.333z"></path>\n</svg>\n'})):"",this.comment.is_pending?i("span",{class:"s-comments-item-pending-text"},this.waiting_approval_trans):null))),this.getReplies().length&&!s?this.getReplies().map((s=>i("div",null,i("salla-comment-item",{comment:s})))):null))}get host(){return a(this)}};var w;v.style=":host{display:block}.s-comments-item-review-factors-toggle{display:inline-flex;align-items:center;gap:0.35rem;padding:0;border:0;background:transparent;color:#0f6a7c;font-size:0.9rem;font-weight:500;cursor:pointer}.s-comments-item-review-factors-chevron{line-height:1;transform:rotate(180deg);transition:transform 0.2s ease}.s-comments-item-review-factors-chevron.is-open{transform:rotate(0deg)}.s-comments-item-review-factors{border:1px solid #e8e8e8;background:rgba(255, 255, 255, 0.3);border-radius:0.6rem;width:min(100%, 26rem);max-width:100%;margin:0 0 1rem;padding:0.85rem 1rem}@media (max-width: 767px){.s-comments-item-review-factors{width:100%;padding:0.75rem}}.s-comments-item-review-factor-row{display:flex;align-items:center;justify-content:space-between;gap:1rem;direction:ltr;min-width:0}@media (max-width: 767px){.s-comments-item-review-factor-row{flex-direction:row;align-items:stretch;gap:0.35rem}}.s-comments-item-review-factor-row+.s-comments-item-review-factor-row{margin-top:0.5rem}.s-comments-item-review-factor-label,.s-comments-item-review-factor-name{color:#4b5563;font-size:0.9rem;line-height:1.45}.s-comments-item-review-factor-name{min-width:6.5rem;text-align:end;flex-shrink:0}@media (max-width: 767px){.s-comments-item-review-factor-name{min-width:5rem;text-align:end}}.s-comments-item-review-factor-label{display:inline-block;min-width:4.75rem}@media (max-width: 767px){.s-comments-item-review-factor-label{min-width:0;flex:1 1 auto}}.s-comments-item-review-factor-value{display:inline-flex;align-items:center;gap:0.35rem;min-width:0}@media (max-width: 767px){.s-comments-item-review-factor-value{width:100%;justify-content:space-between;gap:0.25rem}}.s-comments-item-review-factor-stars{flex-shrink:0}.s-comments-item-review-factor-stars .s-rating-stars-wrapper{gap:0}",function(s){s.PAGE="page",s.PRODUCT="product",s.BLOG="blog"}(w||(w={}));const f=class{constructor(t){s(this,t),this.type=w.PAGE,this.showFormAvatar=!1,this.hideBought=!1,this.testimonials=!1,this.customerId=null,this.noComments=salla.lang.get("blocks.comments.no_comments"),this.comment_title=salla.lang.get("blocks.comments.title"),this.comment_name=salla.lang.get("blocks.comments.comment"),this.showRatingSummary=salla.config.get("store.settings.rating.show_rating_summary"),this.allowLikes=salla.config.get("store.settings.rating.allow_likes"),salla.onReady((()=>{this.allowLikes=salla.config.get("store.settings.rating.allow_likes"),this.showRatingSummary=salla.config.get("store.settings.rating.show_rating_summary")})),salla.lang.onLoaded((()=>{this.comment_title=salla.lang.get("blocks.comments.title"),this.comment_name=salla.lang.get("blocks.comments.comment"),this.noComments=salla.lang.get("pages.rating.no_ratings");const s=(s,t,i)=>new Promise((e=>{salla.helpers.setNested(salla.lang.messages[s],t,i),e(!0)}));(async()=>{await s("ar.trans","blocks.comments.most_helpful","الأكثر إفادة"),await s("en.trans","blocks.comments.most_helpful","Most helpful"),this.mostHelpfulLabel=salla.lang.get("blocks.comments.most_helpful"),this.comment_title=salla.lang.get("blocks.comments.title"),this.comment_name=salla.lang.get("blocks.comments.comment"),this.noComments=salla.lang.get("pages.rating.no_ratings")})()}))}pluralize(s,t){const i=s.split("|"),e=[{condition:0===t,index:0},{condition:1===t,index:1},{condition:2===t,index:2},{condition:t>2&&t<=10,index:3},{condition:t>=11,index:4}],{index:a}=e.find((({condition:s})=>s))||{index:i.length-1};return i[a].replace(":count",salla.helpers.number(t.toString())).replace(/\{[0-9]+\}/g,"").replace(/\[\d+,\d+\]|\[11,\*\]/g,"")}wrapConsoleError(){Salla.infiniteScroll.errorWrapped||((()=>{const s=console.error.bind(console);console.error=(...t)=>{const i=t[0];return"string"==typeof i&&i.toLowerCase().replace(/\s/g,"").includes("infinitescroll")?console.log(...t):s(...t)}})(),Salla.infiniteScroll.errorWrapped=!0)}patchNextPageUrl(){if(this.nextPage)try{const s=new URL(this.nextPage,window.location.origin);this.sort&&!s.searchParams.get("sort")&&s.searchParams.set("sort",this.sort),this.customerId&&!s.searchParams.get("private_comments")&&s.searchParams.set("private_comments",this.customerId),this.nextPage=s.toString()}catch(s){const t=this.nextPage.includes("?");if(this.sort&&!/[?&]sort=/.test(this.nextPage)&&(this.nextPage=this.nextPage+(t?"&":"?")+`sort=${this.sort}`),this.customerId&&!/[?&]private_comments=/.test(this.nextPage)){const s=this.nextPage.includes("?")?"&":"?";this.nextPage=this.nextPage+s+`private_comments=${this.customerId}`}}}initiateInfiniteScroll(){this.wrapper?(this.wrapConsoleError(),this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:!1,nextPage:this.nextPage,scrollThreshold:!1},!0),this.infiniteScroll?.on("request",(()=>{this.loading()})),this.infiniteScroll?.on("load",(s=>{this.pagination=s.pagination,this.nextPage="object"==typeof s.pagination.links&&s.pagination.links.next?s.pagination.links.next:null,this.patchNextPageUrl();for(const t of this.handleResponse(s))this.wrapper.append(t);const t=this.host.querySelectorAll("salla-comment-item:not(.animated):not(.s-comments-item-admin)");this.animateItems(t),this.loading(!1)})),this.infiniteScroll?.on("error",(s=>{salla.console.error("Error loading more comments:",s)}))):console.error("Wrapper is undefined. Cannot initiate infinite scroll.")}loading(s=!0){const t=this.status?.querySelector(".s-button-text");t&&(m.toggleElementClassIf(t,"s-button-hide","s-button-show",(()=>s)),this.btnLoader.style.display=s?"inherit":"none")}animateItems(s){c({targets:s,opacity:[0,1],duration:1200,translateY:[20,0],delay:(s,t)=>100*t,easing:"easeOutExpo",complete:()=>{for(const t of s)t.classList.add("animated")}})}async reload(){if(this.showPlaceholder=!1,this.wrapper){this.wrapper.innerHTML="";const s=document.createElement("salla-loading");this.wrapper.append(s)}this.nextPage=null,this.loadInitialData()}getCommentHTML(s){const t=document.createElement("salla-comment-item");return t.comment=s,t.hideBought=this.hideBought,t}handleResponse(s){return s.data?.map((s=>this.getCommentHTML(s)))||[]}componentWillLoad(){return salla.onReady().then((()=>{this.showRatingSummary=salla.config.get("store.settings.rating.show_rating_summary")})).then((()=>this.loading())).then((()=>(this.hideTitle=this.hideTitle||this.testimonials,this.hideForm=this.hideForm||this.testimonials,this.loadInitialData())))}onCommentAdded(s){const t=s.detail;t&&(this.showPlaceholder||!this.total?(this.showPlaceholder=!1,this.total=(this.total||0)+1,this.comments=this.comments||[]):this.total=(this.total||0)+1,setTimeout((()=>{if(!this.wrapper)return;const s=this.getCommentHTML(t);this.wrapper.prepend(s),this.animateItems([s])}),0))}async loadInitialData(){try{let s={data:[],pagination:{}};const t=new URLSearchParams(window.location.search);if(t.has("sort")&&(this.sort=t.get("sort")),this.testimonials){const t={sort:this.sort,type:"store"};s=await salla.api.request("reviews",{params:t},"get")}else{const i=t.get("private_comments");this.customerId=i&&"user"===Salla.config.get("user.type")&&Salla.config.get("user.id")?Salla.config.get("user.id"):null,s=await salla.api.comment.getComments(this.type,this.itemId,1,5,this.sort,this.customerId)}if(!s.data||!s.data.length)return this.showPlaceholder=!1,void this.loading(!1);this.wrapper&&(this.wrapper.innerHTML=""),this.comments=s.data,this.pagination=s.pagination,this.total=s.pagination.total,this.nextPage="object"==typeof s.pagination.links&&s.pagination.links.next?s.pagination.links.next:null,this.patchNextPageUrl(),setTimeout((()=>{for(const t of this.handleResponse(s))this.wrapper.append(t);this.initiateInfiniteScroll();const t=this.wrapper.querySelectorAll("salla-comment-item:not(.animated)");this.animateItems(t)}),100)}catch(s){console.error("Error loading initial data:",s),this.showPlaceholder=!0,this.loading(!1)}}async loadMore(){this.infiniteScroll?.loadNextPage()}render(){return this.showPlaceholder?i("div",null,this.total&&!this.hideTitle?i("h2",{class:"s-comments-title"},this.blockTitle?this.blockTitle:this.comment_title):"",this.hideForm||this.testimonials?"":i("salla-comment-form",{showAvatar:this.showFormAvatar,type:this.type,"item-id":this.itemId}),i("div",{class:"s-comments-placeholder"},i("span",{innerHTML:'\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>chat-bubbles</title>\n<path d="M15.333 17.333c4.779 0 8.667-3.888 8.667-8.667s-3.888-8.667-8.667-8.667h-6.667c-4.779 0-8.667 3.888-8.667 8.667 0 2.985 1.513 5.712 4 7.297v4.703c0 0.497 0.277 0.953 0.717 1.183 0.195 0.1 0.405 0.151 0.616 0.151 0.269 0 0.536-0.081 0.764-0.241l6.323-4.425zM11.236 14.908l-4.569 3.199v-2.913c0-0.5-0.28-0.959-0.725-1.187-2.020-1.035-3.275-3.080-3.275-5.34 0-3.308 2.692-6 6-6h6.667c3.308 0 6 2.692 6 6s-2.692 6-6 6h-3.333c-0.273 0-0.54 0.084-0.764 0.241zM29.196 12.964c-0.543-0.5-1.388-0.464-1.884 0.077-0.5 0.541-0.465 1.385 0.077 1.884 1.253 1.156 1.944 2.72 1.944 4.408 0 2.26-1.255 4.305-3.275 5.339-0.445 0.228-0.725 0.687-0.725 1.188v2.572l-5.441-2.939c-0.195-0.104-0.412-0.16-0.633-0.16h-2.592c-1.688 0-3.309-0.724-4.451-1.988-0.492-0.545-1.335-0.591-1.883-0.096-0.547 0.493-0.589 1.336-0.096 1.883 1.644 1.823 3.988 2.868 6.429 2.868h2.255l7.111 3.84c0.199 0.107 0.417 0.16 0.635 0.16 0.236 0 0.472-0.063 0.683-0.188 0.404-0.241 0.651-0.676 0.651-1.145v-4.036c2.487-1.585 4-4.311 4-7.297 0-2.407-1.023-4.727-2.804-6.369z"></path>\n</svg>\n'}),i("p",null,this.noComments))):i("div",{class:`s-comments s-comments-${this.testimonials?"testimonials":this.type}`},i("div",{class:this.type===w.PAGE?"s-comments-page-container":"s-comments-container"},this.total&&!this.hideTitle?i("h2",{class:"s-comments-title"},this.blockTitle?this.blockTitle:this.comment_title):"",!this.hideForm&&i("salla-comment-form",{showAvatar:this.showFormAvatar,type:this.type,"item-id":this.itemId}),salla.url.is_page("product.single")?i("salla-reviews-summary",{itemId:this.itemId}):"",i("div",{class:"s-comments-header "+(this.total?"has-total":"")},!!this.total&&i("span",{class:"s-comments-count-label",innerHTML:this.pluralize(this.comment_name,this.total)}),this.total&&!this.testimonials&&this.type!==w.BLOG?i("div",{class:"s-comments-filter-wrapper"},i("label",{class:"s-comments-filter-label",htmlFor:"comments-filter"},salla.lang.get("pages.categories.sorting")),i("select",{id:"comments-filter","aria-label":salla.lang.get("pages.categories.sorting"),class:"s-form-control s-comments-sort-input",onChange:s=>{this.sort=s.target.value,this.reload()}},i("option",{value:"latest",selected:!0},salla.lang.get("pages.testimonials.sort_by_date_desc")),i("option",{value:"oldest"},salla.lang.get("pages.testimonials.sort_by_date_asc")),this.allowLikes&&i("option",{value:"most_helpful"},this.mostHelpfulLabel))):""),i("div",{ref:s=>{this.wrapper=s}}),this.nextPage&&i("div",{class:"s-infinite-scroll-wrapper",ref:s=>{this.status=s}},i("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary",type:"button"},i("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")),i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:s=>{this.btnLoader=s},style:{display:"none"}})))))}get host(){return a(this)}};f.style=":host{display:block}.s-comments-item-review-factors-toggle{display:inline-flex;align-items:center;gap:0.35rem;padding:0;border:0;background:transparent;color:#0f6a7c;font-size:0.9rem;font-weight:500;cursor:pointer}.s-comments-item-review-factors-chevron{line-height:1;transform:rotate(180deg);transition:transform 0.2s ease}.s-comments-item-review-factors-chevron.is-open{transform:rotate(0deg)}.s-comments-item-review-factors{border:1px solid #e8e8e8;background:rgba(255, 255, 255, 0.3);border-radius:0.6rem;width:min(100%, 26rem);max-width:100%;margin:0 0 1rem;padding:0.85rem 1rem}@media (max-width: 767px){.s-comments-item-review-factors{width:100%;padding:0.75rem}}.s-comments-item-review-factor-row{display:flex;align-items:center;justify-content:space-between;gap:1rem;direction:ltr;min-width:0}@media (max-width: 767px){.s-comments-item-review-factor-row{flex-direction:row;align-items:stretch;gap:0.35rem}}.s-comments-item-review-factor-row+.s-comments-item-review-factor-row{margin-top:0.5rem}.s-comments-item-review-factor-label,.s-comments-item-review-factor-name{color:#4b5563;font-size:0.9rem;line-height:1.45}.s-comments-item-review-factor-name{min-width:6.5rem;text-align:end;flex-shrink:0}@media (max-width: 767px){.s-comments-item-review-factor-name{min-width:5rem;text-align:end}}.s-comments-item-review-factor-label{display:inline-block;min-width:4.75rem}@media (max-width: 767px){.s-comments-item-review-factor-label{min-width:0;flex:1 1 auto}}.s-comments-item-review-factor-value{display:inline-flex;align-items:center;gap:0.35rem;min-width:0}@media (max-width: 767px){.s-comments-item-review-factor-value{width:100%;justify-content:space-between;gap:0.25rem}}.s-comments-item-review-factor-stars{flex-shrink:0}.s-comments-item-review-factor-stars .s-rating-stars-wrapper{gap:0}";const b=class{constructor(t){s(this,t),this.translationsLoaded=!1,this.labels=[],this.reviewLabel="",this.selectedStar=0,this.name="rating",this.size="medium",this.reviews=0,this.labelBeforeStars=!1,this.editable=!1,this.tag=!0}getLabelClassName(){return this.tag?"s-rating-stars-label":"s-rating-stars-label-without-tag"}setLabelDisplay(s){if(!this.labelElem)return;this.labelElem.textContent=s||" ";const t=this.getLabelClassName();this.labelElem.classList.toggle(`${t}--empty`,!s),this.labelElem.setAttribute("aria-hidden",s?"false":"true")}async componentWillLoad(){await new Promise((s=>{salla.lang.onLoaded((()=>{this.labels=[salla.lang.get("pages.rating.poor"),salla.lang.get("pages.rating.average"),salla.lang.get("pages.rating.good"),salla.lang.get("pages.rating.very_good"),salla.lang.get("pages.rating.excellent")],this.value&&this.withLabel&&(this.reviewLabel=this.labels[this.value-1]),this.reviewsElement&&(this.reviewsElement.innerText=`(${salla.helpers.number(salla.lang.choice("pages.rating.reviews",this.reviews))})`),this.translationsLoaded=!0,s()}))}))}initiateRating(){this.host.addEventListener("click",(s=>this.handleRating(s)))}handleRating(s){if(!this.starsElem)return;let t=this.starsElem.querySelectorAll(".s-rating-stars-hovered"),i=t[t.length-1];if(!i&&s?.target instanceof HTMLElement&&(i=s.target.closest(".s-rating-stars-btn-star[data-star]")),!i)return;let e=parseInt(i.getAttribute("data-star"));this.starsElem.querySelector(".rating_hidden_input").value=e.toString(),this.starsElem.querySelectorAll(".s-rating-stars-btn-star").forEach(((s,t)=>m.toggleElementClassIf(s,"s-rating-stars-selected","s-rating-stars-unselected",(()=>t<e)))),this.starsElem.querySelectorAll("[aria-pressed]").forEach((s=>s.removeAttribute("aria-pressed"))),i.setAttribute("aria-pressed","true"),this.selectedStar=e,this.withLabel&&this.setLabelDisplay(this.labels[e-1])}triggerRatingProgrammatically(s){if(!this.starsElem)return;const t=this.starsElem.querySelectorAll(".s-rating-stars-btn-star");t&&s>=0&&s<=t.length&&(t.forEach(((t,i)=>{t.classList.toggle("s-rating-stars-hovered",i<=s)})),this.handleRating())}highlightSelectedStars(){let s="s-rating-stars-hovered",t=this.starsElem?.querySelectorAll(".s-rating-stars-btn-star");t?.forEach(((i,e)=>{i.addEventListener("mouseover",(()=>{for(let i=0;i<=e;i++)t[i].classList.add(s);this.withLabel&&this.setLabelDisplay(this.labels[e])})),i.addEventListener("mouseout",(()=>{i.classList.remove(s),this.withLabel&&this.setLabelDisplay(this.selectedStar?this.labels[this.selectedStar-1]:"")}))})),this.starsElem?.addEventListener("mouseout",(()=>t.forEach((t=>t.classList.remove(s)))))}createStars(s){let t=[];for(let e=0;e<5;e++)t.push(i("span",{class:{"s-rating-stars-btn-star":!0,["s-rating-stars-"+this.size]:!0,"s-rating-stars-selected":e<s},innerHTML:d}));return this.reviews>0&&t.push(i("span",{class:"s-rating-stars-reviews",ref:s=>this.reviewsElement=s},"(",salla.helpers.number(salla.lang.choice("pages.rating.reviews",this.reviews)),")")),t}renderReviewLabel(){if(!this.withLabel)return null;const s=this.getLabelClassName();return i("span",{ref:s=>{this.labelElem=s},class:{[s]:!0,[`${s}--empty`]:!this.reviewLabel},"aria-hidden":this.reviewLabel?"false":"true"},this.reviewLabel||" ")}renderStarsWrapper(s){const t=this.renderReviewLabel();return i("div",{class:{"s-rating-stars-wrapper":!0,"s-rating-stars-wrapper--with-label":this.withLabel,"s-rating-stars-wrapper--label-first":this.labelBeforeStars}},this.labelBeforeStars?[t,s]:[s,t])}renderEditableStars(){return i("div",{class:"s-rating-stars-element",ref:s=>this.starsElem=s},i("input",{type:"hidden",class:"rating_hidden_input",name:this.name,value:""}),[1,2,3,4,5].map((s=>i("button",{class:"s-rating-stars-btn-star s-rating-stars-"+this.size,"data-star":s},i("span",{innerHTML:d})))))}render(){return this.translationsLoaded?this.host.closest(".swiper-slide")?.classList.contains("swiper-slide-duplicate")?"":i(e,null,this.renderStarsWrapper(!this.value&&0!=this.value||this.editable?this.renderEditableStars():this.createStars(this.value))):i(e,null)}componentDidLoad(){this.initiateRating(),this.highlightSelectedStars(),this.syncEditableRating()}componentDidUpdate(){this.syncEditableRating()}syncEditableRating(){if(!(this.translationsLoaded&&this.editable&&this.value&&this.starsElem))return;if(this.selectedStar>0)return;const s=this.starsElem.querySelectorAll(".s-rating-stars-btn-star");s?.length&&this.value>=1&&this.value<=s.length&&this.triggerRatingProgrammatically(this.value-1)}get host(){return a(this)}};b.style=":host{display:inline-flex;vertical-align:middle}.s-rating-stars-wrapper{display:inline-flex;align-items:center;gap:0.5rem;min-height:1.75rem}.s-rating-stars-wrapper--with-label{min-height:1.75rem}.s-rating-stars-element{display:inline-flex;align-items:center;flex-shrink:0}.s-rating-stars-label,.s-rating-stars-label-without-tag{flex-shrink:0;min-width:5.5rem;min-height:1.25rem;line-height:1.25rem;text-align:end;transition:opacity 0.15s ease}.s-rating-stars-label--empty,.s-rating-stars-label-without-tag--empty{opacity:0}.s-rating-stars-btn-star{flex-shrink:0}";const y=class{constructor(t){s(this,t),this.currentSlide=0,this.showPurchaseCount=!1,this.startPoint={x:0,y:0},this.isSwiping=!1,this.isRTL="rtl",this.handlePointerDown=s=>{s.isPrimary&&(this.sliderElement?.setPointerCapture(s.pointerId),this.startSwipe(s.clientX,s.clientY),s.preventDefault())},this.handlePointerMove=s=>{this.isSwiping&&s.isPrimary&&s.preventDefault()},this.handlePointerUp=s=>{this.isSwiping&&s.isPrimary&&(this.sliderElement?.releasePointerCapture(s.pointerId),this.endSwipe(s.clientX,s.clientY))},this.handlePointerCancel=s=>{this.isSwiping&&s.isPrimary&&(this.sliderElement?.releasePointerCapture(s.pointerId),this.isSwiping=!1)},this.goToSlide=s=>{this.currentSlide=Math.max(0,Math.min(s,this.images.length-1))}}async componentDidLoad(){await salla.onReady(),this.showPurchaseCount=!!salla.config.get("store.settings.product.total_sold_enabled",!1),this.isRTL=salla.config.get("theme.is_rtl",!0),this.purchasedCount=salla.lang.getWithDefault("blocks.home.reviews.purchased_count",this.isRTL?` تم شراءه ${this.review.product?.sold_quantity} مرة`:`Purchased ${this.review.product.sold_quantity} times`,{count:this.review.product?.sold_quantity}),this.initializeSlider()}disconnectedCallback(){this.removeEventListeners()}get images(){const{review:s}=this;return s?.images?.length>1?s.images.map(((s,t)=>({url:s,alt:"",id:t}))):s?.product?.images||[]}get hasMultipleImages(){return this.images.length>1}get slideTransform(){return`translateX(${100*this.currentSlide*(this.isRTL?1:-1)}%)`}initializeSlider(){this.hasMultipleImages&&(this.sliderElement=this.el.querySelector(".s-review-card-slider-container"),this.sliderElement&&(this.sliderElement.style.touchAction="pan-y pinch-zoom",this.addEventListeners()))}addEventListeners(){this.sliderElement&&(this.sliderElement.addEventListener("pointerdown",this.handlePointerDown,{passive:!1}),this.sliderElement.addEventListener("pointermove",this.handlePointerMove,{passive:!1}),this.sliderElement.addEventListener("pointerup",this.handlePointerUp,{passive:!0}),this.sliderElement.addEventListener("pointercancel",this.handlePointerCancel,{passive:!0}))}removeEventListeners(){this.sliderElement&&(this.sliderElement.removeEventListener("pointerdown",this.handlePointerDown),this.sliderElement.removeEventListener("pointermove",this.handlePointerMove),this.sliderElement.removeEventListener("pointerup",this.handlePointerUp),this.sliderElement.removeEventListener("pointercancel",this.handlePointerCancel))}startSwipe(s,t){this.startPoint={x:s,y:t},this.isSwiping=!0}componentDidRender(){this.removeEventListeners(),this.addEventListeners()}endSwipe(s,t){this.isSwiping=!1,this.processSwipe(s-this.startPoint.x,t-this.startPoint.y)}processSwipe(s,t){if(Math.abs(s)<10||Math.abs(t)>Math.abs(s))return;const i=s<0;(this.isRTL?!i:i)?this.goToNextSlide():this.goToPrevSlide()}goToNextSlide(){this.currentSlide<this.images.length-1&&this.currentSlide++}goToPrevSlide(){this.currentSlide>0&&this.currentSlide--}renderStars(){return Array(5).fill(null).map(((s,t)=>i("span",{key:t,innerHTML:this.review.stars>=t+1?' <svg width="18" height="17" view-box="0 0 18 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M9.00045 13.6951L3.71036 16.6563L4.89186 10.71L0.440918 6.59397L6.4612 5.88017L9.00045 0.375122L11.5396 5.88017L17.5599 6.59397L13.109 10.71L14.2905 16.6563L9.00045 13.6951Z" fill="currentcolor" />\n</svg>':' <svg width="18" height="17" view-box="0 0 18 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M9.00045 13.6951L3.71036 16.6563L4.89186 10.71L0.440918 6.59397L6.4612 5.88017L9.00045 0.375122L11.5396 5.88017L17.5599 6.59397L13.109 10.71L14.2905 16.6563L9.00045 13.6951Z" fill="#DDDDDD" />\n</svg>'})))}renderDots(){return this.images.map((({url:s},t)=>i("button",{key:s||t,type:"button",class:"s-review-card-slider-dot "+(this.currentSlide===t?"active":""),onClick:()=>this.goToSlide(t),"aria-label":`Go to slide ${t+1}`,onPointerDown:()=>this.goToSlide(t)})))}renderSlider(){return this.hasMultipleImages?i("div",{class:"s-review-card-slider-container"},i("div",{class:"s-review-card-slides",style:{transform:this.slideTransform}},this.images.map((s=>i("div",{key:s?.id,class:"s-review-card-slider-slide"},i("img",{src:s.url,alt:s.alt||"Product image",width:275,height:275,loading:"lazy",draggable:!1}))))),i("div",{class:"s-review-card-slider-dots"},this.renderDots())):null}renderSingleImage(){const s=this.review?.product?.image;return!s||this.hasMultipleImages?null:i("img",{src:s.url,alt:s.alt||"Product image",class:"s-review-card-image",width:275,height:275,loading:"lazy",decoding:"async",draggable:!1})}renderHeader(){return i("div",{class:"s-review-card-header"},i("div",{class:"s-review-card-reviewer-name"},i("p",null,this.review?.name),this.review?.has_order&&i("span",{class:"s-review-card-verified-icon",innerHTML:h})),i("div",{class:"s-review-card-stars"},this.renderStars()))}renderProductInfo(){const s=this.review?.product;return s?i("a",{href:this.review?.product?.url,class:"s-review-card-product-container"},i("img",{alt:s.image?.alt||"Product",src:s.image?.url,class:"s-review-card-product-image",width:60,height:60,loading:"lazy",decoding:"async",draggable:!1}),i("div",{class:"s-review-card-product-details"},i("p",{class:"s-review-card-product-details-name"},s.name),this.showPurchaseCount?i("p",{class:"s-review-card-product-details-purchase-count"},i("span",{innerHTML:' <svg width="12" height="17" view-box="0 0 12 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M6 16.2501C9.10658 16.2501 11.625 13.7317 11.625 10.6251C11.625 9.976 11.4523 9.35252 11.25 8.77232C9.99998 10.0075 9.05002 10.6251 8.4 10.6251C11.3966 5.37512 9.75 3.12512 5.25 0.125122C5.625 3.87475 3.15302 5.58043 2.14634 6.52757C1.0559 7.5535 0.375 9.00977 0.375 10.6251C0.375 13.7317 2.89339 16.2501 6 16.2501ZM6.53205 2.92636C8.96333 4.98908 8.97495 6.59185 7.09725 9.88157C6.5265 10.8815 7.2486 12.1251 8.4 12.1251C8.9163 12.1251 9.43807 11.9745 9.98917 11.6789C9.52342 13.4466 7.91393 14.7501 6 14.7501C3.72182 14.7501 1.875 12.9033 1.875 10.6251C1.875 9.47072 2.34959 8.39582 3.17419 7.62002C3.2687 7.53115 3.74812 7.1062 3.76858 7.08782C4.08646 6.8017 4.34835 6.54985 4.60718 6.2727C5.52998 5.28461 6.19283 4.18735 6.53205 2.92636Z" fill="currentcolor" />\n </svg>'}),this.purchasedCount):null)):null}render(){return i("div",{key:"3fd3fe6c1bdb3a160c9f267ba0653155d0334e44",class:"s-review-card-container"},this.renderSlider(),this.renderSingleImage(),k(),i("div",{key:"63b0be0923c9f4db0195f91a24e4ed05591cdb3b",class:"s-review-card-content"},this.renderHeader(),i("p",{key:"9b16ebeb60b400a8afcd1eaa0b8097a9b0c3b062",class:"s-review-card-review-content",innerHTML:this.review?.content}),k(),this.renderProductInfo()))}get el(){return a(this)}},k=()=>i("div",{class:"s-review-card-divider "});y.style=":host{display:block}";const x=class{constructor(t){s(this,t),this.limit=5,this.type="store",this.sort="latest",this.hideCustomerInfo=!1,this.reviews=[],this.showReviews=!1,this.testimonialText=salla.lang.get("blocks.home.testimonials"),this.displayAllLinkText=salla.lang.get("blocks.home.display_all"),this.displayAllURL=null,this.source=this.source,salla.onReady((()=>{this.displayAllURL=salla.url.get("testimonials"),this.isRTL=salla.config.get("theme.is_rtl",!0)})),salla.lang.onLoaded((()=>{this.testimonialText=salla.lang.get("blocks.home.testimonials"),this.displayAllLinkText=salla.lang.get("blocks.home.display_all")}))}fetchReviews(){if("json"===this.source)return Promise.resolve(JSON.parse(this.sourceValue));const s=["products","categories"].includes(this.source),t={limit:this.limit,source:this.source,items:s?JSON.parse(this.sourceValue):this.sourceValue,sort:this.sort,type:this.type,hide_customer_info:this.hideCustomerInfo?1:0};return salla.api.request("reviews",{params:t},"get")}componentWillLoad(){return new Promise((s=>salla.onReady(s))).then((()=>this.fetchReviews())).then((s=>s.data||[])).then((s=>{s.length&&(this.reviews=s,this.showReviews=!0,m.generateReviewSchema(this.reviews))}))}render(){return i("div",{key:"24e50ca2634208ad3ffcb9ca503aa7e18331b3a1",class:"s-reviews-container"},i("div",{key:"a1632306fc1a92051d030707aab075c825537e01",class:"s-reviews-header-wrapper"},i("h1",{key:"e2a4df75011da111e89c1b732e7741ddf452b9d5",class:"s-reviews-header"},this.testimonialText),this.displayAllLink?i("a",{href:this.displayAllURL,class:"s-reviews-display-all"},this.displayAllLinkText,i("span",{class:"s-reviews-display-all-icon",innerHTML:p})):null),i("salla-slider",{key:"89009e55e3a5121c241295efd510405b623f45c3",centered:!0,"slides-per-view":1,type:"testimonials",class:"s-reviews-testimonials-slider","controls-outer":!0,"auto-play":!0,id:`testimonials-${this.source}-slider`},i("div",{key:"8b6b8df42043c8ecdb05dbbc30ecacde297f0dda",slot:"items"},this.reviews.map(((s,t)=>i("div",{key:t,class:"s-reviews-swiper-slide"},i("div",{class:"s-reviews-testimonial"},i("div",{class:"s-reviews-testimonial__inner"},i("div",{class:"s-reviews-testimonial__avatar"},i("img",{src:"images/s-empty.png","data-src":s.avatar,alt:s.name?s.name:"testimonial-"+t,class:"lazy"})),i("div",{class:"s-reviews-testimonial__text"},i("p",{innerHTML:s.content}),i("div",{class:"s-reviews-testimonial__name_wrapper"},i("div",{class:"s-reviews-testimonial__info"},s.name&&i("h2",null,`${s.name}`)),i("div",{class:"s-reviews-testimonial__rating"},i("salla-rating-stars",{size:"small",value:s.stars})))),i("span",{class:"s-reviews-testimonial__icon",innerHTML:'\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>quote-open</title>\n<path d="M8 12v-5.333c0-0.737-0.596-1.333-1.333-1.333-3.676 0-6.667 2.991-6.667 6.667v8c0 3.676 2.991 6.667 6.667 6.667h1.333c3.676 0 6.667-2.991 6.667-6.667v-1.333c0-3.676-2.991-6.667-6.667-6.667zM12 20c0 2.205-1.795 4-4 4h-1.333c-2.205 0-4-1.795-4-4v-8c0-1.739 1.115-3.221 2.667-3.772v5.105c0 0.737 0.596 1.333 1.333 1.333h1.333c2.205 0 4 1.795 4 4zM25.333 12v-5.333c0-0.737-0.596-1.333-1.333-1.333-3.676 0-6.667 2.991-6.667 6.667v8c0 3.676 2.991 6.667 6.667 6.667h1.333c3.676 0 6.667-2.991 6.667-6.667v-1.333c0-3.676-2.991-6.667-6.667-6.667zM29.333 20c0 2.205-1.795 4-4 4h-1.333c-2.205 0-4-1.795-4-4v-8c0-1.739 1.115-3.221 2.667-3.772v5.105c0 0.737 0.596 1.333 1.333 1.333h1.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n'})))))))))}};var _,C,L,M,S,T,z,H,$,D,I,P;function j(){if(D)return $;D=1;var s=n(),t=function(){if(C)return _;C=1;var s=r();return _=function(){return s.Date.now()}}(),i=function(){if(H)return z;H=1;var s=function(){if(T)return S;T=1;var s=function(){if(M)return L;M=1;var s=/\s/;return L=function(t){for(var i=t.length;i--&&s.test(t.charAt(i)););return i}}(),t=/^\s+/;return S=function(i){return i?i.slice(0,s(i)+1).replace(t,""):i}}(),t=n(),i=l(),e=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,r=/^0o[0-7]+$/i,o=parseInt;return z=function(n){if("number"==typeof n)return n;if(i(n))return NaN;if(t(n)){var l="function"==typeof n.valueOf?n.valueOf():n;n=t(l)?l+"":l}if("string"!=typeof n)return 0===n?n:+n;n=s(n);var h=a.test(n);return h||r.test(n)?o(n.slice(2),h?2:8):e.test(n)?NaN:+n}}(),e=Math.max,a=Math.min;return $=function(r,n,l){var o,h,c,m,d,p,g=0,u=!1,v=!1,w=!0;if("function"!=typeof r)throw new TypeError("Expected a function");function f(s){var t=o,i=h;return o=h=void 0,g=s,m=r.apply(i,t)}function b(s){var t=s-p;return void 0===p||t>=n||t<0||v&&s-g>=c}function y(){var s=t();if(b(s))return k(s);d=setTimeout(y,function(s){var t=n-(s-p);return v?a(t,c-(s-g)):t}(s))}function k(s){return d=void 0,w&&o?f(s):(o=h=void 0,m)}function x(){var s=t(),i=b(s);if(o=arguments,h=this,p=s,i){if(void 0===d)return function(s){return g=s,d=setTimeout(y,n),u?f(s):m}(p);if(v)return clearTimeout(d),d=setTimeout(y,n),f(p)}return void 0===d&&(d=setTimeout(y,n)),m}return n=i(n)||0,s(l)&&(u=!!l.leading,c=(v="maxWait"in l)?e(i(l.maxWait)||0,n):c,w="trailing"in l?!!l.trailing:w),x.cancel=function(){void 0!==d&&clearTimeout(d),g=0,o=p=h=d=void 0},x.flush=function(){return void 0===d?m:k(t())},x},$}x.style="";var E=o(function(){if(P)return I;P=1;var s=j(),t=n();return I=function(i,e,a){var r=!0,n=!0;if("function"!=typeof i)throw new TypeError("Expected a function");return t(a)&&(r="leading"in a?!!a.leading:r,n="trailing"in a?!!a.trailing:n),s(i,e,{leading:r,maxWait:e,trailing:n})}}());class R{constructor(s){this.grid=s,this.create=()=>{this.mutationObserver.observe(this.grid,{childList:!0});for(const s of Array.from(this.grid.children))this.resizeObserver.observe(s)},this.onContainerMutation=s=>{const t=s.flatMap((s=>Array.from(s.removedNodes))),i=s.flatMap((s=>Array.from(s.addedNodes)));for(const s of t)s instanceof Element&&this.resizeObserver.unobserve(s);for(const s of i)s instanceof Element&&this.resizeObserver.observe(s);t.length>0&&0===i.length&&this.update()},this.onChildrenResize=s=>{s.filter((s=>null!==s.target.parentElement)).length>0&&this.update()},this.update=E((()=>{const s=window.getComputedStyle(this.grid);if(!1===s.getPropertyValue("display").includes("grid"))return void this.clean();const t=function(s){return window.getComputedStyle(s).getPropertyValue("grid-template-columns").trim().split(/\s+(?=(?:[^()]*\([^()]*\))*[^()]*$)/)}(this.grid);if(t.length<=1)return void this.clean();const i=Number.parseFloat(s.getPropertyValue("row-gap").trim())||0,e=Array.from(this.grid.children);for(let s=0;s<t.length;s++){const t=e[s];t?.style.removeProperty("margin-top")}for(let s=0;s<e.length;s++){const a=e[s-t.length],r=e[s];if(void 0!==a&&void 0!==r){const s=a.getBoundingClientRect().bottom;r.style.removeProperty("margin-top");const t=r.getBoundingClientRect().top;if(t-i!==s){const e=Math.round(100*(s-(t-i)+Number.EPSILON))/100;r.style.setProperty("margin-top",`${e}px`)}}}}),32),this.destroy=()=>{this.resizeObserver.disconnect(),this.mutationObserver.disconnect(),this.clean()},this.clean=()=>{for(const s of Array.from(this.grid.children))s.style.removeProperty("margin-top")},this.mutationObserver=new MutationObserver(this.onContainerMutation),this.resizeObserver=new ResizeObserver(this.onChildrenResize),!1===CSS.supports("grid-template-rows","masonry")&&this.create()}[Symbol.dispose](){this.destroy()}}const N=class{constructor(t){s(this,t),this.reviews=[],this.isLoading=!1,this.pagination=null,this.sort="latest"}getUrlParams(){const s=new URLSearchParams(window.location.search);return{sort:s.get("sort")||null,page:Number.parseInt(s.get("page"))||1}}updateUrlParams(s){const t=new URL(window.location.href);for(const[i,e]of Object.entries(s))e?t.searchParams.set(i,e.toString()):t.searchParams.delete(i);window.history.replaceState({},"",t.toString())}fetchReviews(s,t){const i=this.getUrlParams();return salla.api.request("reviews",{params:{type:"products",format:"lite",per_page:8,page:t||i.page||1,sort:s||i.sort||null}})}async initializeMasonry(){const s=this.el.querySelector(".s-reviews-page-grid");if(s)try{new R(s),salla.logger.info("Masonry initialized successfully")}catch(s){salla.logger.error("Masonry initialization failed:",s)}}animateReviewCards(){const s=this.wrapper.querySelectorAll("salla-review-card:not(.animated)");m.animateItems(s)}initiateInfiniteScroll(){this.wrapper?(this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.pagination?.links?.next||null,history:!1,scrollThreshold:!1},!0),this.infiniteScroll?.on("request",(()=>{this.isLoading=!0})),this.infiniteScroll?.on("load",(s=>{this.pagination=s.pagination,this.reviews=[...this.reviews,...s.data],this.isLoading=!1,this.updateUrlParams({page:s.pagination.current_page})})),this.infiniteScroll?.on("error",(s=>{salla.logger.error("Error loading more reviews:",s),this.isLoading=!1}))):salla.logger.error("Wrapper is undefined. Cannot initiate infinite scroll.")}componentDidRender(){setTimeout((()=>{requestAnimationFrame(this.animateReviewCards.bind(this))}),176)}async componentWillLoad(){try{await salla.onReady(),this.langTitlesReviews=salla.lang.get("common.titles.reviews"),this.langSorting=salla.lang.get("pages.categories.sorting"),this.placeholderText=salla.lang.choice("pages.rating.reviews",0),this.langLoadMore=salla.lang.get("common.elements.load_more"),this.langSortByTopRating=salla.lang.get("pages.testimonials.sort_by_rating_desc"),this.langSortByMostRecent=salla.lang.get("pages.testimonials.sort_by_date_desc"),this.langSortByLeastRated=salla.lang.get("pages.testimonials.sort_by_rating_asc"),this.langSortByLeastRecent=salla.lang.get("pages.testimonials.sort_by_date_asc");const s=this.getUrlParams(),t=await this.fetchReviews(s.sort);this.sort=s.sort,this.reviews=t.data,this.pagination=t.pagination,this.langRatingReviews=salla.lang.choice("pages.rating.reviews",this.pagination?.total)}catch(s){salla.logger.error("Error loading reviews:",s)}}async handleSorting(s){const t=s.target.value;this.sort=t,this.updateUrlParams({sort:t,page:1});const i=await this.fetchReviews(t,1);this.reviews=i.data,this.pagination=i.pagination}async componentDidLoad(){await this.initializeMasonry(),this.initiateInfiniteScroll(),this.sort=this.getUrlParams().sort||"latest",this.updateUrlParams({sort:this.sort,page:1})}disconnectedCallback(){this.infiniteScroll&&this.infiniteScroll.destroy()}renderSortingOptions(){return[{value:"latest",label:this.langSortByMostRecent},{value:"oldest",label:this.langSortByLeastRecent},{value:"top_rating",label:this.langSortByTopRating},{value:"bottom_rating",label:this.langSortByLeastRated}].map((s=>i("option",{key:s.value,value:s.value,selected:s.value===this.sort},s.label)))}render(){return i("host",{key:"b82b491ae189f825367881b7b4f03ad64e471aae"},i("div",{key:"d124f10806cfabd1c1f85044786541011edff3ff",class:"s-reviews-page-header-wrapper"},i("h2",{key:"30c58bb14bea27da968e874a0c1454a35e8db207",class:"s-reviews-page-title"},this.langTitlesReviews,i("span",{key:"8850771469ae20d1b07efcb45be58738de377e6d",class:"s-reviews-page-count"},"(",this.langRatingReviews,")")),i("div",{key:"5a0060c5bdbfe4d37003b04d4c6368460be8cd38",class:"s-reviews-page-filter-wrapper"},i("label",{key:"637d1aeec005ae662c6019c423ef3f1c3a6ff264",class:"s-reviews-page-filter-label",htmlFor:"testimonials-filter"},this.langSorting),i("select",{key:"5b68b9441d4647f12583c71da61958c30c0dcda6",onChange:s=>this.handleSorting(s),disabled:!this.reviews.length,class:"s-reviews-page-filter"},this.renderSortingOptions()))),this.reviews.length?i("main",{class:"s-reviews-page-grid",ref:s=>{this.wrapper=s}},this.reviews.map((s=>i("salla-review-card",{key:s.id,review:s})))):i("div",{class:"s-products-list-placeholder"},i("span",{innerHTML:g}),i("p",null,this.placeholderText)),this.pagination?.links?.next&&this.reviews.length?i("div",{class:"s-reviews-page-load-more-container"},i("salla-button",{class:"s-reviews-page-load-more-btn",loading:this.isLoading,onClick:()=>this.infiniteScroll?.loadNextPage(),onKeyUp:()=>this.infiniteScroll?.loadNextPage()},this.langLoadMore)):null)}get el(){return a(this)}};N.style=":host{display:block}";const A=class{constructor(t){s(this,t),this.canRender=!1,this.showRatingSummary=!1,this.recommendationOnly=!1,this.showRecommendation=!1}async componentWillLoad(){try{await salla.onReady(),this.initializeLanguages(),this.loadConfig(),(this.showRatingSummary||this.showRecommendation)&&await this.loadSummary()}catch(s){console.error("Failed to initialize reviews summary component:",s)}}async loadConfig(){this.showRatingSummary=salla.config.get("store.settings.rating.show_rating_summary"),this.showRecommendation=salla.config.get("store.settings.rating.show_recommendation"),this.recommendationOnly=this.showRecommendation&&!this.showRatingSummary}initializeLanguages(){return Salla.lang.onLoaded((()=>{Salla.lang.addBulk({"blocks.comments.based_on":{ar:"بناءً على",en:"Based on"},"blocks.comments.recommended":{ar:"أوصوا بالمنتج",en:"Recommended"},"blocks.comments.overall_rating":{ar:"التقييم العام",en:"Overall rating"}}),this.basedOnLabel=salla.lang.get("blocks.comments.based_on"),this.recommendedLabel=salla.lang.get("blocks.comments.recommended"),this.overallRatingLabel=salla.lang.get("blocks.comments.overall_rating")}))}async loadSummary(){if(!this.itemId)return console.error("Error loading reviews summary: itemId is not defined"),this.canRender=!1;try{const s=await salla.api.request(`rating/summary/${this.itemId}`);if(!s?.data||Array.isArray(s.data.reviews)&&!s.data.reviews.length)return this.canRender=!1,void(this.data=null);this.data=s.data,this.canRender=!0}catch(s){this.canRender=!1,this.data=null,console.error("Error loading reviews summary:",s)}}renderFactorTags(){const s=this.data?.factors||[];return s.length?i("div",{class:"s-reviews-summary-factors"},s.map((s=>i("div",{class:"s-reviews-summary-factor-tag"},i("span",{class:"s-reviews-summary-factor-name"},s.name),i("span",{class:"s-reviews-summary-factor-star",innerHTML:d}),i("span",{class:"s-reviews-summary-factor-rating"},s.rating||""))))):null}renderRecommendation(){return this.showRecommendation&&this.data?.recommendation?i("div",{class:("s-reviews-summary-header-section "+(this.recommendationOnly?"s-reviews-summary-recommendation-only":"")).trim()},i("h4",{class:"s-reviews-summary-recommendation-percentage"},"%",this.data?.recommendation),i("p",{class:"s-reviews-summary-count"},this.recommendedLabel)):null}render(){if(!this.canRender)return null;if(this.recommendationOnly)return this.renderRecommendation();const s={1:0,2:0,3:0,4:0,5:0,...this.data.reviews},t=Object.keys(s).reverse().map((t=>{const e=s[t];return i("div",{key:t,class:"s-reviews-summary-row"},i("div",{class:"s-reviews-summary-row-rate"},t," ",i("span",{innerHTML:d})),i("salla-progress-bar",{class:"s-reviews-summary-progress",value:e,target:100,hideUnits:!0,height:"16px"}),i("span",{class:"s-reviews-summary-percentage"},e,"%"))}));return i(e,{class:"s-reviews-summary-wrapper"},i("div",{class:"s-reviews-summary-header"},i("div",{class:"s-reviews-summary-overall-section items-start"},i("p",{class:"s-reviews-summary-overall-label"},this.overallRatingLabel),i("div",{class:"s-reviews-summary-overall-row"},i("h3",{class:"s-reviews-summary-average"},this.data.rating),i("div",null,i("salla-rating-stars",{size:"large",value:this.data.rating}),i("p",{class:"s-reviews-summary-count"},this.basedOnLabel," ",salla.helpers.number(salla.lang.choice("pages.rating.reviews",this.data.count)))))),this.renderFactorTags(),this.renderRecommendation()),i("div",{class:"s-reviews-summary-rows"},t))}};A.style=":host{display:block}.s-reviews-summary-overall-section{display:flex;flex-direction:column;align-items:flex-start;gap:0.35rem;padding:0 0.5rem}.s-reviews-summary-overall-label{color:#111827;font-size:1.15rem;font-weight:600;line-height:1.3;margin-bottom:0.75rem}.s-reviews-summary-overall-row{display:inline-flex;align-items:flex-start;gap:0.7rem}.s-reviews-summary-factors{display:flex;flex-wrap:wrap;gap:0.5rem;justify-content:flex-start;margin-bottom:0.6rem}.s-reviews-summary-factor-tag{display:inline-flex;align-items:center;gap:0.25rem;border-radius:999px;border:1px solid #e8e8e8;background:rgba(255, 255, 255, 0.3);color:#374151;font-size:0.85rem;line-height:1;padding:0.4rem 0.65rem}.s-reviews-summary-factor-rating{font-weight:600;color:#0f6a7c}.s-reviews-summary-factor-star{display:inline-flex;width:0.8rem;height:0.8rem;fill:#0f6a7c}.s-reviews-summary-factor-star svg{width:100%;height:100%}";export{u as salla_comment_form,v as salla_comment_item,f as salla_comments,b as salla_rating_stars,y as salla_review_card,x as salla_reviews,N as salla_reviews_page,A as salla_reviews_summary}
4
+ import{r as s,c as t,h as i,H as e,a,i as r,j as n,k as l,d as o}from"./p-DpB3UAAA.js";import{S as h}from"./p-BZp0rKEO.js";import{a as c}from"./p-CgtvEd63.js";import{H as m}from"./p-XnA1YTjA.js";import{S as d}from"./p-D4oPi1Ov.js";import{a as p}from"./p-BedNk7k1.js";import{S as g}from"./p-DiKTtDW5.js";const u=class{constructor(i){s(this,i),this.commentAdded=t(this,"commentAdded"),this.placeholder=salla.lang.get("blocks.comments.placeholder"),this.submitText=salla.lang.get("blocks.comments.submit"),salla.lang.onLoaded((()=>{this.placeholder=salla.lang.get("blocks.comments.placeholder"),this.submitText=salla.lang.get("blocks.comments.submit")})),salla.onReady((()=>{this.canComment=salla.config.get("user.can_comment"),this.itemId=salla.config.get("page.id"),this.type=salla.url.is_page("page-single")?"page":salla.url.is_page("blog.single")?"blog":"product"}))}submit(){if(!this.commentForm.reportValidity())return void salla.log("CommentForm:: validation error!");const s=this.commentField.value;this.submitBtn.load().then((()=>salla.comment.add({id:this.itemId,comment:s,type:this.type}))).then((()=>{this.commentAdded.emit({name:salla.config.get("user.name"),avatar:salla.config.get("user.avatar"),content:s,is_pending:!0,created_at:{date:(new Date).toISOString().replace("T"," ").substring(0,19)},images:[]}),this.commentField.value=""})).finally((()=>this.submitBtn.stop()))}render(){return i(e,{key:"0e3a24dcfe8922106b9479aa559cf0e126bc3fcf"},this.canComment?i("form",{ref:s=>this.commentForm=s},i("div",{class:"s-comment-form-wrapper"},this.showAvatar?i("img",{class:"s-comment-form-avatar",src:salla.config.get("user.avatar"),alt:"user avatar"}):"",i("div",{class:"s-comment-form-content"},i("textarea",{cols:30,rows:5,minlength:"4",maxlength:"500",ref:s=>this.commentField=s,placeholder:this.placeholder,class:"s-comment-form-input",required:!0}),i("br",null),i("div",{class:"s-comment-form-action"},i("salla-button",{ref:s=>this.submitBtn=s,"loader-position":"center",onClick:()=>this.submit()},this.submitText))))):"")}};u.style=":host{display:block}";const v=class{constructor(t){s(this,t),this.locked_trans=salla.lang.get("blocks.comments.locked"),this.has_bought_trans=salla.lang.get("blocks.comments.has_bought"),this.rated_trans=salla.lang.get("pages.rating.rated"),this.waiting_approval_trans=salla.lang.get("blocks.comments.waiting_approval"),this.has_order_trans=salla.lang.get("blocks.comments.has_order"),this.allowLikes=salla.config.get("store.settings.rating.allow_likes"),this.allowAttachImages=salla.config.get("store.settings.rating.allow_attach_images"),this.helpfulLabel=salla.lang.get("blocks.comments.helpful"),this.reviewDetailsLabel=salla.lang.get("blocks.comments.review_details"),this.likesCount=0,this.likedComments=[],this.showReviewFactors=!1,salla.lang.onLoaded((()=>{const s=(s,t,i)=>new Promise((e=>{salla.helpers.setNested(salla.lang.messages[s],t,i),e(!0)}));this.locked_trans=salla.lang.get("blocks.comments.locked"),this.has_bought_trans=salla.lang.get("blocks.comments.has_bought"),this.rated_trans=salla.lang.get("pages.rating.rated"),this.waiting_approval_trans=salla.lang.get("blocks.comments.waiting_approval"),this.has_order_trans=salla.lang.get("blocks.comments.has_order"),(async()=>{await s("ar.trans","blocks.comments.helpful","مفيد"),await s("en.trans","blocks.comments.helpful","Helpful"),await s("ar.trans","blocks.comments.review_details","تفاصيل التقييم"),await s("en.trans","blocks.comments.review_details","Review details"),await s("ar.trans","blocks.comments.locked","الرد غير ظاهر لباقي العملاء"),await s("en.trans","blocks.comments.locked","The reply is not visible to other customers"),this.reviewDetailsLabel=salla.lang.get("blocks.comments.review_details"),this.helpfulLabel=salla.lang.get("blocks.comments.helpful"),this.locked_trans=salla.lang.getWithDefault("blocks.comments.locked","الرد غير ظاهر لباقي العملاء")})()}))}componentDidLoad(){if(this.comment){this.likesCount=this.comment.likes_count;try{this.likedComments=JSON.parse(localStorage.getItem("liked_comments")||"[]"),this.likedComments.includes(this.comment.id)&&(this.likeBtn.classList.add("liked"),this.likeBtn.fill="solid")}catch{salla.log("Bad json for liked_comments")}}}getReplies(){return Array.isArray(this.comment.replies)?this.comment.replies:[this.comment.replies]}getDate(s){const[t]=s.split(" "),[i,e,a]=t.split("-");return`${parseInt(a,10)}/${parseInt(e,10)}/${parseInt(i,10)}`}getTime(s){const[,t]=s.split(" "),[i,e]=t.split(":");return`${parseInt(i,10)}:${parseInt(e,10)}`}async toggleLike(){if(salla.config.isGuest())return salla.notify.error(salla.lang.get("common.messages.must_login"));this.likedComments=JSON.parse(localStorage.getItem("liked_comments")||"[]");const s=this.likedComments.includes(this.comment.id);try{const t=s?`rating/${this.comment.id}/unlike`:`rating/${this.comment.id}/like`,i=await salla.api.request(t,"","put");salla.log(i.message),s?(this.likeBtn.classList.remove("liked"),this.likeBtn.fill="outline",this.updateLikedComments(this.comment.id,!1),this.likesCount--):(this.likeBtn.classList.add("liked"),this.likeBtn.fill="solid",this.updateLikedComments(this.comment.id,!0),this.likesCount++)}catch(s){409==s.response.status&&(this.likeBtn.classList.contains("liked")?(this.likeBtn.fill="outline",this.likeBtn.classList.remove("liked"),this.updateLikedComments(this.comment.id,!1),this.likesCount--):(this.likeBtn.fill="solid",this.likeBtn.classList.add("liked"),salla.logger.warn("Like already exists"),this.updateLikedComments(this.comment.id,!0)))}}updateLikedComments(s,t){this.likedComments=JSON.parse(localStorage.getItem("liked_comments")||"[]"),t?this.likedComments.includes(s)||this.likedComments.push(s):this.likedComments=this.likedComments.filter((t=>t!==s)),localStorage.setItem("liked_comments",JSON.stringify(this.likedComments))}isPrivateComment(s){return"hidden"===s.status}getReviewFactors(){return Array.isArray(this.comment.factor_reviews)?this.comment.factor_reviews:[]}PinnedIcon(){return i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"16",height:"16",color:"#555555",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},i("path",{d:"M12 16V21"}),i("path",{d:"M8 5.2918C8 5.02079 8 4.88529 8.01312 4.77132C8.1194 3.84789 8.84789 3.1194 9.77133 3.01312C9.88529 3 10.0208 3 10.2918 3H13.7082C13.9792 3 14.1147 3 14.2287 3.01312C15.1521 3.1194 15.8806 3.84789 15.9869 4.77132C16 4.88529 16 5.02079 16 5.2918C16 5.37885 16 5.42237 15.9967 5.46264C15.9708 5.78281 15.7927 6.07104 15.5179 6.2374C15.4834 6.25832 15.4444 6.27779 15.3666 6.31672L15.1055 6.44726C14.7021 6.64897 14.5003 6.74983 14.3681 6.90564C14.26 7.03286 14.1856 7.18509 14.1515 7.34846C14.1097 7.54854 14.1539 7.76968 14.2424 8.21197L15 12H15.3333C15.9533 12 16.2633 12 16.5176 12.0681C17.2078 12.2531 17.7469 12.7922 17.9319 13.4824C18 13.7367 18 14.0467 18 14.6667C18 14.9767 18 15.1317 17.9659 15.2588C17.8735 15.6039 17.6039 15.8735 17.2588 15.9659C17.1317 16 16.9767 16 16.6667 16H7.33333C7.02334 16 6.86835 16 6.74118 15.9659C6.39609 15.8735 6.12654 15.6039 6.03407 15.2588C6 15.1317 6 14.9767 6 14.6667C6 14.0467 6 13.7367 6.06815 13.4824C6.25308 12.7922 6.79218 12.2531 7.48236 12.0681C7.73669 12 8.04669 12 8.66667 12H9L9.75761 8.21197C9.84606 7.76968 9.89029 7.54854 9.84852 7.34846C9.81441 7.18509 9.73995 7.03286 9.63194 6.90564C9.49965 6.74983 9.29794 6.64897 8.89452 6.44726L8.63344 6.31672C8.55558 6.27779 8.51665 6.25832 8.48208 6.2374C8.20731 6.07104 8.02917 5.78281 8.00326 5.46264C8 5.42237 8 5.37885 8 5.2918Z"}))}LockedIcon(){return i("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("path",{d:"M3.5 4.66683V4.0835C3.5 2.1505 5.067 0.583496 7 0.583496C8.93299 0.583496 10.5 2.1505 10.5 4.0835V4.66683H11.6667C11.9888 4.66683 12.25 4.928 12.25 5.25016V12.2502C12.25 12.5723 11.9888 12.8335 11.6667 12.8335H2.33333C2.01117 12.8335 1.75 12.5723 1.75 12.2502V5.25016C1.75 4.928 2.01117 4.66683 2.33333 4.66683H3.5ZM11.0833 5.8335H2.91667V11.6668H11.0833V5.8335ZM6.41667 9.1774C6.06795 8.97568 5.83333 8.59867 5.83333 8.16683C5.83333 7.52248 6.35565 7.00016 7 7.00016C7.64435 7.00016 8.16667 7.52248 8.16667 8.16683C8.16667 8.59867 7.93205 8.97568 7.58333 9.1774V10.5002H6.41667V9.1774ZM4.66667 4.66683H9.33333V4.0835C9.33333 2.79483 8.28864 1.75016 7 1.75016C5.71134 1.75016 4.66667 2.79483 4.66667 4.0835V4.66683Z",fill:"#555555"}))}render(){if(!this.comment)return null;let s="admin"==this.comment.type;const t=this.getReviewFactors(),a=t.length>0;return i(e,{class:s?"s-comments-item-admin":"s-comments-item"},i("div",{class:{"s-comments-item-wrapper":!s,"s-comments-item-admin-wrapper":s},id:`s-comments-item-${this.comment.id}`},i("div",{class:"s-comments-item-inner s-comments-flex-1"},s&&i("span",{class:"s-comments-item-reply-icon",innerHTML:'\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>reply</title>\n<path d="M20 14.667h-12.609l9.401-6.927c0.592-0.436 0.72-1.271 0.283-1.863-0.439-0.595-1.273-0.72-1.864-0.283l-12.667 9.333c-0.343 0.251-0.544 0.649-0.544 1.072s0.201 0.821 0.543 1.073l12.667 9.333c0.237 0.176 0.515 0.26 0.789 0.26 0.409 0 0.813-0.188 1.075-0.543 0.437-0.592 0.309-1.427-0.283-1.863l-9.4-6.928h12.609c4.412 0 8 3.588 8 8 0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-5.881-4.785-10.667-10.667-10.667z"></path>\n</svg>\n'}),i("div",{class:"s-comments-item-avatar"},i("img",{"data-src":this.comment?.avatar,alt:this.comment?.name,src:this.comment?.avatar,class:"s-comments-item-avatar-img lazy"})),i("div",{class:"s-comments-flex-1"},i("div",{class:"s-comments-item-user-wrapper"},i("div",{class:"s-comments-item-user-info"},i("h3",{class:this.comment.is_pinned?"s-comments-item-user-info-name":"s-comments-item-user-info-name-with-margin"},this.comment?.name),this.comment.is_pinned?i("div",{class:"s-comments-item-pinned-icon-with-margin"},this.PinnedIcon()):null,!this.comment.has_order&&!this.comment.rating||this.comment.is_pending||this.hideBought?null:i("div",{class:"s-comments-flex"},this.comment.has_order?[i("span",{class:"s-comments-item-has-order-check-icon",innerHTML:h}),i("span",{class:"s-comments-item-has-order-check-text"},this.has_bought_trans," ",this.comment.rating?", ":"")]:null,this.comment.rating?i("span",{class:"s-comments-item-rated-widget"},this.rated_trans):null)),i("p",{class:"s-comments-item-timestamp s-ltr"},this.getDate(this.comment.created_at?.date),i("span",{class:"s-comments-item-time"}," - ",this.getTime(this.comment.created_at?.date)))),(!!this.comment.rating||!!this.comment.stars||a)&&i("div",{class:"flex flex-row gap-4 mt-2 mb-4"},this.comment.rating||this.comment.stars?i("salla-rating-stars",{class:"w-auto",size:"medium",value:this.comment.rating||this.comment.stars}):null,a&&i("button",{class:"s-comments-item-review-factors-toggle",type:"button",onClick:()=>this.showReviewFactors=!this.showReviewFactors},i("span",null,this.reviewDetailsLabel),i("span",{class:{"s-comments-item-review-factors-chevron":!0,"is-open":this.showReviewFactors}},"⌃"))),i("div",{class:"s-comments-item-content"},a&&this.showReviewFactors&&i("salla-comment-factors",{factors:t}),i("div",{class:"s-comments-item-content-container"},this.isPrivateComment(this.comment)?i("div",{id:`s-comments-item-${this.comment.id}-locked-icon`,class:"s-comments-item-pinned-icon"},this.LockedIcon()):null,i("p",{innerHTML:this.comment.content})),this.isPrivateComment(this.comment)?i("salla-tooltip",{text:this.locked_trans,targetId:`s-comments-item-${this.comment.id}-locked-icon`}):null,this.allowAttachImages&&i("div",{class:"s-comments-item-images"},this.comment.images.map(((s,t)=>i("img",{key:t,src:s,alt:"",onClick:()=>this.modal.open()}))),i("salla-modal",{ref:s=>this.modal=s,width:"sm"},i("salla-slider",{id:`s-comments-item-${this.comment.id}-images`,class:"s-comments-item-images-slider",type:"thumbs","auto-height":!0,showControls:this.comment.images.length>1,"show-thumbs-controls":"false"},i("div",{slot:"items"},this.comment.images.map(((s,t)=>i("img",{key:t,src:s,alt:""})))),i("div",{slot:"thumbs"},this.comment.images.map(((s,t)=>i("div",{class:"s-comments-item-images-slider-thumb"},i("img",{key:t,src:s,alt:""})))))))),this.allowLikes&&!s&&this.comment.id&&salla.url.is_page("product.single")?i("salla-button",{ref:s=>this.likeBtn=s,class:"s-comments-item-like-btn "+(this.likedComments.includes(this.comment.id)?"liked":""),loaderPosition:"center",fill:"outline",size:"small",onClick:()=>this.toggleLike()},i("span",null,this.helpfulLabel," ",this.likesCount>0?`(${this.likesCount})`:""),i("span",{innerHTML:'\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>thumbs-up</title>\n<path d="M26.667 10.667h-8.261l1.279-3.38c0.723-1.911 0.087-4.051-1.549-5.203-0.909-0.639-2.004-0.881-3.085-0.684-1.101 0.203-2.061 0.837-2.703 1.787l-5.452 8.067c-0.148 0.22-0.228 0.48-0.228 0.747v12c0 3.676 2.991 6.667 6.667 6.667h8.688c2.535 0 4.817-1.407 5.955-3.671l2.548-5.063c0.093-0.187 0.143-0.392 0.143-0.6v-6.667c0-2.205-1.795-4-4-4zM28 21.017l-2.405 4.78c-0.683 1.359-2.052 2.203-3.573 2.203h-8.688c-2.205 0-4-1.795-4-4v-11.592l5.223-7.728c0.237-0.352 0.584-0.585 0.975-0.657 0.367-0.067 0.749 0.017 1.068 0.241 0.631 0.444 0.879 1.317 0.591 2.079l-1.963 5.185c-0.156 0.409-0.099 0.869 0.149 1.229s0.66 0.576 1.099 0.576h10.192c0.735 0 1.333 0.599 1.333 1.333zM2.667 10.667c-0.736 0-1.333 0.597-1.333 1.333v16c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-16c0-0.736-0.597-1.333-1.333-1.333z"></path>\n</svg>\n'})):"",this.comment.is_pending?i("span",{class:"s-comments-item-pending-text"},this.waiting_approval_trans):null))),this.getReplies().length&&!s?this.getReplies().map((s=>i("div",null,i("salla-comment-item",{comment:s})))):null))}get host(){return a(this)}};var w;v.style=":host{display:block}.s-comments-item-review-factors-toggle{display:inline-flex;align-items:center;gap:0.35rem;padding:0;border:0;background:transparent;color:#0f6a7c;font-size:0.9rem;font-weight:500;cursor:pointer}.s-comments-item-review-factors-chevron{line-height:1;transform:rotate(180deg);transition:transform 0.2s ease}.s-comments-item-review-factors-chevron.is-open{transform:rotate(0deg)}.s-comments-item-review-factors{border:1px solid #e8e8e8;background:rgba(255, 255, 255, 0.3);border-radius:0.6rem;width:min(100%, 26rem);max-width:100%;margin:0 0 1rem;padding:0.85rem 1rem}@media (max-width: 767px){.s-comments-item-review-factors{width:100%;padding:0.75rem}}.s-comments-item-review-factor-row{display:flex;align-items:center;justify-content:space-between;gap:1rem;direction:ltr;min-width:0}@media (max-width: 767px){.s-comments-item-review-factor-row{flex-direction:row;align-items:stretch;gap:0.35rem}}.s-comments-item-review-factor-row+.s-comments-item-review-factor-row{margin-top:0.5rem}.s-comments-item-review-factor-label,.s-comments-item-review-factor-name{color:#4b5563;font-size:0.9rem;line-height:1.45}.s-comments-item-review-factor-name{min-width:6.5rem;text-align:end;flex-shrink:0}@media (max-width: 767px){.s-comments-item-review-factor-name{min-width:5rem;text-align:end}}.s-comments-item-review-factor-label{display:inline-block;min-width:4.75rem}@media (max-width: 767px){.s-comments-item-review-factor-label{min-width:0;flex:1 1 auto}}.s-comments-item-review-factor-value{display:inline-flex;align-items:center;gap:0.35rem;min-width:0}@media (max-width: 767px){.s-comments-item-review-factor-value{width:100%;justify-content:space-between;gap:0.25rem}}.s-comments-item-review-factor-stars{flex-shrink:0}.s-comments-item-review-factor-stars .s-rating-stars-wrapper{gap:0}",function(s){s.PAGE="page",s.PRODUCT="product",s.BLOG="blog"}(w||(w={}));const f=class{constructor(t){s(this,t),this.type=w.PAGE,this.showFormAvatar=!1,this.hideBought=!1,this.testimonials=!1,this.customerId=null,this.noComments=salla.lang.get("blocks.comments.no_comments"),this.comment_title=salla.lang.get("blocks.comments.title"),this.comment_name=salla.lang.get("blocks.comments.comment"),this.showRatingSummary=salla.config.get("store.settings.rating.show_rating_summary"),this.allowLikes=salla.config.get("store.settings.rating.allow_likes"),salla.onReady((()=>{this.allowLikes=salla.config.get("store.settings.rating.allow_likes"),this.showRatingSummary=salla.config.get("store.settings.rating.show_rating_summary")})),salla.lang.onLoaded((()=>{this.comment_title=salla.lang.get("blocks.comments.title"),this.comment_name=salla.lang.get("blocks.comments.comment"),this.noComments=salla.lang.get("pages.rating.no_ratings");const s=(s,t,i)=>new Promise((e=>{salla.helpers.setNested(salla.lang.messages[s],t,i),e(!0)}));(async()=>{await s("ar.trans","blocks.comments.most_helpful","الأكثر إفادة"),await s("en.trans","blocks.comments.most_helpful","Most helpful"),this.mostHelpfulLabel=salla.lang.get("blocks.comments.most_helpful"),this.comment_title=salla.lang.get("blocks.comments.title"),this.comment_name=salla.lang.get("blocks.comments.comment"),this.noComments=salla.lang.get("pages.rating.no_ratings")})()}))}pluralize(s,t){const i=s.split("|"),e=[{condition:0===t,index:0},{condition:1===t,index:1},{condition:2===t,index:2},{condition:t>2&&t<=10,index:3},{condition:t>=11,index:4}],{index:a}=e.find((({condition:s})=>s))||{index:i.length-1};return i[a].replace(":count",salla.helpers.number(t.toString())).replace(/\{[0-9]+\}/g,"").replace(/\[\d+,\d+\]|\[11,\*\]/g,"")}wrapConsoleError(){Salla.infiniteScroll.errorWrapped||((()=>{const s=console.error.bind(console);console.error=(...t)=>{const i=t[0];return"string"==typeof i&&i.toLowerCase().replace(/\s/g,"").includes("infinitescroll")?console.log(...t):s(...t)}})(),Salla.infiniteScroll.errorWrapped=!0)}patchNextPageUrl(){if(this.nextPage)try{const s=new URL(this.nextPage,window.location.origin);this.sort&&!s.searchParams.get("sort")&&s.searchParams.set("sort",this.sort),this.customerId&&!s.searchParams.get("private_comments")&&s.searchParams.set("private_comments",this.customerId),this.nextPage=s.toString()}catch(s){const t=this.nextPage.includes("?");if(this.sort&&!/[?&]sort=/.test(this.nextPage)&&(this.nextPage=this.nextPage+(t?"&":"?")+`sort=${this.sort}`),this.customerId&&!/[?&]private_comments=/.test(this.nextPage)){const s=this.nextPage.includes("?")?"&":"?";this.nextPage=this.nextPage+s+`private_comments=${this.customerId}`}}}initiateInfiniteScroll(){this.wrapper?(this.wrapConsoleError(),this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:!1,nextPage:this.nextPage,scrollThreshold:!1},!0),this.infiniteScroll?.on("request",(()=>{this.loading()})),this.infiniteScroll?.on("load",(s=>{this.pagination=s.pagination,this.nextPage="object"==typeof s.pagination.links&&s.pagination.links.next?s.pagination.links.next:null,this.patchNextPageUrl();for(const t of this.handleResponse(s))this.wrapper.append(t);const t=this.host.querySelectorAll("salla-comment-item:not(.animated):not(.s-comments-item-admin)");this.animateItems(t),this.loading(!1)})),this.infiniteScroll?.on("error",(s=>{salla.console.error("Error loading more comments:",s)}))):console.error("Wrapper is undefined. Cannot initiate infinite scroll.")}loading(s=!0){const t=this.status?.querySelector(".s-button-text");t&&(m.toggleElementClassIf(t,"s-button-hide","s-button-show",(()=>s)),this.btnLoader.style.display=s?"inherit":"none")}animateItems(s){c({targets:s,opacity:[0,1],duration:1200,translateY:[20,0],delay:(s,t)=>100*t,easing:"easeOutExpo",complete:()=>{for(const t of s)t.classList.add("animated")}})}async reload(){if(this.showPlaceholder=!1,this.wrapper){this.wrapper.innerHTML="";const s=document.createElement("salla-loading");this.wrapper.append(s)}this.nextPage=null,this.loadInitialData()}getCommentHTML(s){const t=document.createElement("salla-comment-item");return t.comment=s,t.hideBought=this.hideBought,t}handleResponse(s){return s.data?.map((s=>this.getCommentHTML(s)))||[]}componentWillLoad(){return salla.onReady().then((()=>{this.showRatingSummary=salla.config.get("store.settings.rating.show_rating_summary")})).then((()=>this.loading())).then((()=>(this.hideTitle=this.hideTitle||this.testimonials,this.hideForm=this.hideForm||this.testimonials,this.loadInitialData())))}onCommentAdded(s){const t=s.detail;t&&(this.showPlaceholder||!this.total?(this.showPlaceholder=!1,this.total=(this.total||0)+1,this.comments=this.comments||[]):this.total=(this.total||0)+1,setTimeout((()=>{if(!this.wrapper)return;const s=this.getCommentHTML(t);this.wrapper.prepend(s),this.animateItems([s])}),0))}async loadInitialData(){try{let s={data:[],pagination:{}};const t=new URLSearchParams(window.location.search);if(t.has("sort")&&(this.sort=t.get("sort")),this.testimonials){const t={sort:this.sort,type:"store"};s=await salla.api.request("reviews",{params:t},"get")}else{const i=t.get("private_comments");this.customerId=i&&"user"===Salla.config.get("user.type")&&Salla.config.get("user.id")?Salla.config.get("user.id"):null,s=await salla.api.comment.getComments(this.type,this.itemId,1,5,this.sort,this.customerId)}if(!s.data||!s.data.length)return this.showPlaceholder=!1,void this.loading(!1);this.wrapper&&(this.wrapper.innerHTML=""),this.comments=s.data,this.pagination=s.pagination,this.total=s.pagination.total,this.nextPage="object"==typeof s.pagination.links&&s.pagination.links.next?s.pagination.links.next:null,this.patchNextPageUrl(),setTimeout((()=>{for(const t of this.handleResponse(s))this.wrapper.append(t);this.initiateInfiniteScroll();const t=this.wrapper.querySelectorAll("salla-comment-item:not(.animated)");this.animateItems(t)}),100)}catch(s){console.error("Error loading initial data:",s),this.showPlaceholder=!0,this.loading(!1)}}async loadMore(){this.infiniteScroll?.loadNextPage()}render(){return this.showPlaceholder?i("div",null,this.total&&!this.hideTitle?i("h2",{class:"s-comments-title"},this.blockTitle?this.blockTitle:this.comment_title):"",this.hideForm||this.testimonials?"":i("salla-comment-form",{showAvatar:this.showFormAvatar,type:this.type,"item-id":this.itemId}),i("div",{class:"s-comments-placeholder"},i("span",{innerHTML:'\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>chat-bubbles</title>\n<path d="M15.333 17.333c4.779 0 8.667-3.888 8.667-8.667s-3.888-8.667-8.667-8.667h-6.667c-4.779 0-8.667 3.888-8.667 8.667 0 2.985 1.513 5.712 4 7.297v4.703c0 0.497 0.277 0.953 0.717 1.183 0.195 0.1 0.405 0.151 0.616 0.151 0.269 0 0.536-0.081 0.764-0.241l6.323-4.425zM11.236 14.908l-4.569 3.199v-2.913c0-0.5-0.28-0.959-0.725-1.187-2.020-1.035-3.275-3.080-3.275-5.34 0-3.308 2.692-6 6-6h6.667c3.308 0 6 2.692 6 6s-2.692 6-6 6h-3.333c-0.273 0-0.54 0.084-0.764 0.241zM29.196 12.964c-0.543-0.5-1.388-0.464-1.884 0.077-0.5 0.541-0.465 1.385 0.077 1.884 1.253 1.156 1.944 2.72 1.944 4.408 0 2.26-1.255 4.305-3.275 5.339-0.445 0.228-0.725 0.687-0.725 1.188v2.572l-5.441-2.939c-0.195-0.104-0.412-0.16-0.633-0.16h-2.592c-1.688 0-3.309-0.724-4.451-1.988-0.492-0.545-1.335-0.591-1.883-0.096-0.547 0.493-0.589 1.336-0.096 1.883 1.644 1.823 3.988 2.868 6.429 2.868h2.255l7.111 3.84c0.199 0.107 0.417 0.16 0.635 0.16 0.236 0 0.472-0.063 0.683-0.188 0.404-0.241 0.651-0.676 0.651-1.145v-4.036c2.487-1.585 4-4.311 4-7.297 0-2.407-1.023-4.727-2.804-6.369z"></path>\n</svg>\n'}),i("p",null,this.noComments))):i("div",{class:`s-comments s-comments-${this.testimonials?"testimonials":this.type}`},i("div",{class:this.type===w.PAGE?"s-comments-page-container":"s-comments-container"},this.total&&!this.hideTitle?i("h2",{class:"s-comments-title"},this.blockTitle?this.blockTitle:this.comment_title):"",!this.hideForm&&i("salla-comment-form",{showAvatar:this.showFormAvatar,type:this.type,"item-id":this.itemId}),salla.url.is_page("product.single")?i("salla-reviews-summary",{itemId:this.itemId}):"",i("div",{class:"s-comments-header "+(this.total?"has-total":"")},!!this.total&&i("span",{class:"s-comments-count-label",innerHTML:this.pluralize(this.comment_name,this.total)}),this.total&&!this.testimonials&&this.type!==w.BLOG?i("div",{class:"s-comments-filter-wrapper"},i("label",{class:"s-comments-filter-label",htmlFor:"comments-filter"},salla.lang.get("pages.categories.sorting")),i("select",{id:"comments-filter","aria-label":salla.lang.get("pages.categories.sorting"),class:"s-form-control s-comments-sort-input",onChange:s=>{this.sort=s.target.value,this.reload()}},i("option",{value:"latest",selected:!0},salla.lang.get("pages.testimonials.sort_by_date_desc")),i("option",{value:"oldest"},salla.lang.get("pages.testimonials.sort_by_date_asc")),this.allowLikes&&i("option",{value:"most_helpful"},this.mostHelpfulLabel))):""),i("div",{ref:s=>{this.wrapper=s}}),this.nextPage&&i("div",{class:"s-infinite-scroll-wrapper",ref:s=>{this.status=s}},i("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary",type:"button"},i("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")),i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:s=>{this.btnLoader=s},style:{display:"none"}})))))}get host(){return a(this)}};f.style=":host{display:block}.s-comments-item-review-factors-toggle{display:inline-flex;align-items:center;gap:0.35rem;padding:0;border:0;background:transparent;color:#0f6a7c;font-size:0.9rem;font-weight:500;cursor:pointer}.s-comments-item-review-factors-chevron{line-height:1;transform:rotate(180deg);transition:transform 0.2s ease}.s-comments-item-review-factors-chevron.is-open{transform:rotate(0deg)}.s-comments-item-review-factors{border:1px solid #e8e8e8;background:rgba(255, 255, 255, 0.3);border-radius:0.6rem;width:min(100%, 26rem);max-width:100%;margin:0 0 1rem;padding:0.85rem 1rem}@media (max-width: 767px){.s-comments-item-review-factors{width:100%;padding:0.75rem}}.s-comments-item-review-factor-row{display:flex;align-items:center;justify-content:space-between;gap:1rem;direction:ltr;min-width:0}@media (max-width: 767px){.s-comments-item-review-factor-row{flex-direction:row;align-items:stretch;gap:0.35rem}}.s-comments-item-review-factor-row+.s-comments-item-review-factor-row{margin-top:0.5rem}.s-comments-item-review-factor-label,.s-comments-item-review-factor-name{color:#4b5563;font-size:0.9rem;line-height:1.45}.s-comments-item-review-factor-name{min-width:6.5rem;text-align:end;flex-shrink:0}@media (max-width: 767px){.s-comments-item-review-factor-name{min-width:5rem;text-align:end}}.s-comments-item-review-factor-label{display:inline-block;min-width:4.75rem}@media (max-width: 767px){.s-comments-item-review-factor-label{min-width:0;flex:1 1 auto}}.s-comments-item-review-factor-value{display:inline-flex;align-items:center;gap:0.35rem;min-width:0}@media (max-width: 767px){.s-comments-item-review-factor-value{width:100%;justify-content:space-between;gap:0.25rem}}.s-comments-item-review-factor-stars{flex-shrink:0}.s-comments-item-review-factor-stars .s-rating-stars-wrapper{gap:0}";const b=class{constructor(t){s(this,t),this.translationsLoaded=!1,this.labels=[],this.reviewLabel="",this.selectedStar=0,this.name="rating",this.size="medium",this.reviews=0,this.labelBeforeStars=!1,this.editable=!1,this.tag=!0}getLabelClassName(){return this.tag?"s-rating-stars-label":"s-rating-stars-label-without-tag"}setLabelDisplay(s){if(!this.labelElem)return;this.labelElem.textContent=s||" ";const t=this.getLabelClassName();this.labelElem.classList.toggle(`${t}--empty`,!s),this.labelElem.setAttribute("aria-hidden",s?"false":"true")}async componentWillLoad(){await new Promise((s=>{salla.lang.onLoaded((()=>{this.labels=[salla.lang.get("pages.rating.poor"),salla.lang.get("pages.rating.average"),salla.lang.get("pages.rating.good"),salla.lang.get("pages.rating.very_good"),salla.lang.get("pages.rating.excellent")],this.value&&this.withLabel&&(this.reviewLabel=this.labels[this.value-1]),this.reviewsElement&&(this.reviewsElement.innerText=`(${salla.helpers.number(salla.lang.choice("pages.rating.reviews",this.reviews))})`),this.translationsLoaded=!0,s()}))}))}initiateRating(){this.host.addEventListener("click",(s=>this.handleRating(s)))}handleRating(s){if(!this.starsElem)return;let t=this.starsElem.querySelectorAll(".s-rating-stars-hovered"),i=t[t.length-1];if(!i&&s?.target instanceof HTMLElement&&(i=s.target.closest(".s-rating-stars-btn-star[data-star]")),!i)return;let e=parseInt(i.getAttribute("data-star"));this.starsElem.querySelector(".rating_hidden_input").value=e.toString(),this.starsElem.querySelectorAll(".s-rating-stars-btn-star").forEach(((s,t)=>m.toggleElementClassIf(s,"s-rating-stars-selected","s-rating-stars-unselected",(()=>t<e)))),this.starsElem.querySelectorAll("[aria-pressed]").forEach((s=>s.removeAttribute("aria-pressed"))),i.setAttribute("aria-pressed","true"),this.selectedStar=e,this.withLabel&&this.setLabelDisplay(this.labels[e-1])}triggerRatingProgrammatically(s){if(!this.starsElem)return;const t=this.starsElem.querySelectorAll(".s-rating-stars-btn-star");t&&s>=0&&s<=t.length&&(t.forEach(((t,i)=>{t.classList.toggle("s-rating-stars-hovered",i<=s)})),this.handleRating())}highlightSelectedStars(){let s="s-rating-stars-hovered",t=this.starsElem?.querySelectorAll(".s-rating-stars-btn-star");t?.forEach(((i,e)=>{i.addEventListener("mouseover",(()=>{for(let i=0;i<=e;i++)t[i].classList.add(s);this.withLabel&&this.setLabelDisplay(this.labels[e])})),i.addEventListener("mouseout",(()=>{i.classList.remove(s),this.withLabel&&this.setLabelDisplay(this.selectedStar?this.labels[this.selectedStar-1]:"")}))})),this.starsElem?.addEventListener("mouseout",(()=>t.forEach((t=>t.classList.remove(s)))))}createStars(s){let t=[];for(let e=0;e<5;e++)t.push(i("span",{class:{"s-rating-stars-btn-star":!0,["s-rating-stars-"+this.size]:!0,"s-rating-stars-selected":e<s},innerHTML:d}));return this.reviews>0&&t.push(i("span",{class:"s-rating-stars-reviews",ref:s=>this.reviewsElement=s},"(",salla.helpers.number(salla.lang.choice("pages.rating.reviews",this.reviews)),")")),t}renderReviewLabel(){if(!this.withLabel)return null;const s=this.getLabelClassName();return i("span",{ref:s=>{this.labelElem=s},class:{[s]:!0,[`${s}--empty`]:!this.reviewLabel},"aria-hidden":this.reviewLabel?"false":"true"},this.reviewLabel||" ")}renderStarsWrapper(s){const t=this.renderReviewLabel();return i("div",{class:{"s-rating-stars-wrapper":!0,"s-rating-stars-wrapper--with-label":this.withLabel,"s-rating-stars-wrapper--label-first":this.labelBeforeStars}},this.labelBeforeStars?[t,s]:[s,t])}renderEditableStars(){return i("div",{class:"s-rating-stars-element",ref:s=>this.starsElem=s},i("input",{type:"hidden",class:"rating_hidden_input",name:this.name,value:""}),[1,2,3,4,5].map((s=>i("button",{class:"s-rating-stars-btn-star s-rating-stars-"+this.size,"data-star":s},i("span",{innerHTML:d})))))}render(){return this.translationsLoaded?this.host.closest(".swiper-slide")?.classList.contains("swiper-slide-duplicate")?"":i(e,null,this.renderStarsWrapper(!this.value&&0!=this.value||this.editable?this.renderEditableStars():this.createStars(this.value))):i(e,null)}componentDidLoad(){this.initiateRating(),this.highlightSelectedStars(),this.syncEditableRating()}componentDidUpdate(){this.syncEditableRating()}syncEditableRating(){if(!(this.translationsLoaded&&this.editable&&this.value&&this.starsElem))return;if(this.selectedStar>0)return;const s=this.starsElem.querySelectorAll(".s-rating-stars-btn-star");s?.length&&this.value>=1&&this.value<=s.length&&this.triggerRatingProgrammatically(this.value-1)}get host(){return a(this)}};b.style=":host{display:inline-flex;vertical-align:middle}.s-rating-stars-wrapper{display:inline-flex;align-items:center;gap:0.5rem;min-height:1.75rem}.s-rating-stars-wrapper--with-label{min-height:1.75rem}.s-rating-stars-element{display:inline-flex;align-items:center;flex-shrink:0}.s-rating-stars-label,.s-rating-stars-label-without-tag{flex-shrink:0;min-width:5.5rem;min-height:1.25rem;line-height:1.25rem;text-align:end;transition:opacity 0.15s ease}.s-rating-stars-label--empty,.s-rating-stars-label-without-tag--empty{opacity:0}.s-rating-stars-btn-star{flex-shrink:0}";const y=class{constructor(t){s(this,t),this.currentSlide=0,this.showPurchaseCount=!1,this.startPoint={x:0,y:0},this.isSwiping=!1,this.isRTL="rtl",this.handlePointerDown=s=>{s.isPrimary&&(this.sliderElement?.setPointerCapture(s.pointerId),this.startSwipe(s.clientX,s.clientY),s.preventDefault())},this.handlePointerMove=s=>{this.isSwiping&&s.isPrimary&&s.preventDefault()},this.handlePointerUp=s=>{this.isSwiping&&s.isPrimary&&(this.sliderElement?.releasePointerCapture(s.pointerId),this.endSwipe(s.clientX,s.clientY))},this.handlePointerCancel=s=>{this.isSwiping&&s.isPrimary&&(this.sliderElement?.releasePointerCapture(s.pointerId),this.isSwiping=!1)},this.goToSlide=s=>{this.currentSlide=Math.max(0,Math.min(s,this.images.length-1))}}async componentDidLoad(){await salla.onReady(),this.showPurchaseCount=!!salla.config.get("store.settings.product.total_sold_enabled",!1),this.isRTL=salla.config.get("theme.is_rtl",!0),this.purchasedCount=salla.lang.getWithDefault("blocks.home.reviews.purchased_count",this.isRTL?` تم شراءه ${this.review.product?.sold_quantity} مرة`:`Purchased ${this.review.product.sold_quantity} times`,{count:this.review.product?.sold_quantity}),this.initializeSlider()}disconnectedCallback(){this.removeEventListeners()}get images(){const{review:s}=this;return s?.images?.length>1?s.images.map(((s,t)=>({url:s,alt:"",id:t}))):s?.product?.images||[]}get hasMultipleImages(){return this.images.length>1}get slideTransform(){return`translateX(${100*this.currentSlide*(this.isRTL?1:-1)}%)`}initializeSlider(){this.hasMultipleImages&&(this.sliderElement=this.el.querySelector(".s-review-card-slider-container"),this.sliderElement&&(this.sliderElement.style.touchAction="pan-y pinch-zoom",this.addEventListeners()))}addEventListeners(){this.sliderElement&&(this.sliderElement.addEventListener("pointerdown",this.handlePointerDown,{passive:!1}),this.sliderElement.addEventListener("pointermove",this.handlePointerMove,{passive:!1}),this.sliderElement.addEventListener("pointerup",this.handlePointerUp,{passive:!0}),this.sliderElement.addEventListener("pointercancel",this.handlePointerCancel,{passive:!0}))}removeEventListeners(){this.sliderElement&&(this.sliderElement.removeEventListener("pointerdown",this.handlePointerDown),this.sliderElement.removeEventListener("pointermove",this.handlePointerMove),this.sliderElement.removeEventListener("pointerup",this.handlePointerUp),this.sliderElement.removeEventListener("pointercancel",this.handlePointerCancel))}startSwipe(s,t){this.startPoint={x:s,y:t},this.isSwiping=!0}componentDidRender(){this.removeEventListeners(),this.addEventListeners()}endSwipe(s,t){this.isSwiping=!1,this.processSwipe(s-this.startPoint.x,t-this.startPoint.y)}processSwipe(s,t){if(Math.abs(s)<10||Math.abs(t)>Math.abs(s))return;const i=s<0;(this.isRTL?!i:i)?this.goToNextSlide():this.goToPrevSlide()}goToNextSlide(){this.currentSlide<this.images.length-1&&this.currentSlide++}goToPrevSlide(){this.currentSlide>0&&this.currentSlide--}renderStars(){return Array(5).fill(null).map(((s,t)=>i("span",{key:t,innerHTML:this.review.stars>=t+1?' <svg width="18" height="17" view-box="0 0 18 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M9.00045 13.6951L3.71036 16.6563L4.89186 10.71L0.440918 6.59397L6.4612 5.88017L9.00045 0.375122L11.5396 5.88017L17.5599 6.59397L13.109 10.71L14.2905 16.6563L9.00045 13.6951Z" fill="currentcolor" />\n</svg>':' <svg width="18" height="17" view-box="0 0 18 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M9.00045 13.6951L3.71036 16.6563L4.89186 10.71L0.440918 6.59397L6.4612 5.88017L9.00045 0.375122L11.5396 5.88017L17.5599 6.59397L13.109 10.71L14.2905 16.6563L9.00045 13.6951Z" fill="#DDDDDD" />\n</svg>'})))}renderDots(){return this.images.map((({url:s},t)=>i("button",{key:s||t,type:"button",class:"s-review-card-slider-dot "+(this.currentSlide===t?"active":""),onClick:()=>this.goToSlide(t),"aria-label":`Go to slide ${t+1}`,onPointerDown:()=>this.goToSlide(t)})))}renderSlider(){return this.hasMultipleImages?i("div",{class:"s-review-card-slider-container"},i("div",{class:"s-review-card-slides",style:{transform:this.slideTransform}},this.images.map((s=>i("div",{key:s?.id,class:"s-review-card-slider-slide"},i("img",{src:s.url,alt:s.alt||"Product image",width:275,height:275,loading:"lazy",draggable:!1}))))),i("div",{class:"s-review-card-slider-dots"},this.renderDots())):null}renderSingleImage(){const s=this.review?.product?.image;return!s||this.hasMultipleImages?null:i("img",{src:s.url,alt:s.alt||"Product image",class:"s-review-card-image",width:275,height:275,loading:"lazy",decoding:"async",draggable:!1})}renderHeader(){return i("div",{class:"s-review-card-header"},i("div",{class:"s-review-card-reviewer-name"},i("p",null,this.review?.name),this.review?.has_order&&i("span",{class:"s-review-card-verified-icon",innerHTML:h})),i("div",{class:"s-review-card-stars"},this.renderStars()))}renderProductInfo(){const s=this.review?.product;return s?i("a",{href:this.review?.product?.url,class:"s-review-card-product-container"},i("img",{alt:s.image?.alt||"Product",src:s.image?.url,class:"s-review-card-product-image",width:60,height:60,loading:"lazy",decoding:"async",draggable:!1}),i("div",{class:"s-review-card-product-details"},i("p",{class:"s-review-card-product-details-name"},s.name),this.showPurchaseCount?i("p",{class:"s-review-card-product-details-purchase-count"},i("span",{innerHTML:' <svg width="12" height="17" view-box="0 0 12 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M6 16.2501C9.10658 16.2501 11.625 13.7317 11.625 10.6251C11.625 9.976 11.4523 9.35252 11.25 8.77232C9.99998 10.0075 9.05002 10.6251 8.4 10.6251C11.3966 5.37512 9.75 3.12512 5.25 0.125122C5.625 3.87475 3.15302 5.58043 2.14634 6.52757C1.0559 7.5535 0.375 9.00977 0.375 10.6251C0.375 13.7317 2.89339 16.2501 6 16.2501ZM6.53205 2.92636C8.96333 4.98908 8.97495 6.59185 7.09725 9.88157C6.5265 10.8815 7.2486 12.1251 8.4 12.1251C8.9163 12.1251 9.43807 11.9745 9.98917 11.6789C9.52342 13.4466 7.91393 14.7501 6 14.7501C3.72182 14.7501 1.875 12.9033 1.875 10.6251C1.875 9.47072 2.34959 8.39582 3.17419 7.62002C3.2687 7.53115 3.74812 7.1062 3.76858 7.08782C4.08646 6.8017 4.34835 6.54985 4.60718 6.2727C5.52998 5.28461 6.19283 4.18735 6.53205 2.92636Z" fill="currentcolor" />\n </svg>'}),this.purchasedCount):null)):null}render(){return i("div",{key:"3fd3fe6c1bdb3a160c9f267ba0653155d0334e44",class:"s-review-card-container"},this.renderSlider(),this.renderSingleImage(),k(),i("div",{key:"63b0be0923c9f4db0195f91a24e4ed05591cdb3b",class:"s-review-card-content"},this.renderHeader(),i("p",{key:"9b16ebeb60b400a8afcd1eaa0b8097a9b0c3b062",class:"s-review-card-review-content",innerHTML:this.review?.content}),k(),this.renderProductInfo()))}get el(){return a(this)}},k=()=>i("div",{class:"s-review-card-divider "});y.style=":host{display:block}";const x=class{constructor(t){s(this,t),this.limit=5,this.type="store",this.sort="latest",this.hideCustomerInfo=!1,this.reviews=[],this.showReviews=!1,this.testimonialText=salla.lang.get("blocks.home.testimonials"),this.displayAllLinkText=salla.lang.get("blocks.home.display_all"),this.displayAllURL=null,this.source=this.source,salla.onReady((()=>{this.displayAllURL=salla.url.get("testimonials"),this.isRTL=salla.config.get("theme.is_rtl",!0)})),salla.lang.onLoaded((()=>{this.testimonialText=salla.lang.get("blocks.home.testimonials"),this.displayAllLinkText=salla.lang.get("blocks.home.display_all")}))}fetchReviews(){if("json"===this.source)return Promise.resolve(JSON.parse(this.sourceValue));const s=["products","categories"].includes(this.source),t={limit:this.limit,source:this.source,items:s?JSON.parse(this.sourceValue):this.sourceValue,sort:this.sort,type:this.type,hide_customer_info:this.hideCustomerInfo?1:0};return salla.api.request("reviews",{params:t},"get")}componentWillLoad(){return new Promise((s=>salla.onReady(s))).then((()=>this.fetchReviews())).then((s=>s.data||[])).then((s=>{s.length&&(this.reviews=s,this.showReviews=!0,m.generateReviewSchema(this.reviews))}))}render(){return i("div",{key:"24e50ca2634208ad3ffcb9ca503aa7e18331b3a1",class:"s-reviews-container"},i("div",{key:"a1632306fc1a92051d030707aab075c825537e01",class:"s-reviews-header-wrapper"},i("h1",{key:"e2a4df75011da111e89c1b732e7741ddf452b9d5",class:"s-reviews-header"},this.testimonialText),this.displayAllLink?i("a",{href:this.displayAllURL,class:"s-reviews-display-all"},this.displayAllLinkText,i("span",{class:"s-reviews-display-all-icon",innerHTML:p})):null),i("salla-slider",{key:"89009e55e3a5121c241295efd510405b623f45c3",centered:!0,"slides-per-view":1,type:"testimonials",class:"s-reviews-testimonials-slider","controls-outer":!0,"auto-play":!0,id:`testimonials-${this.source}-slider`},i("div",{key:"8b6b8df42043c8ecdb05dbbc30ecacde297f0dda",slot:"items"},this.reviews.map(((s,t)=>i("div",{key:t,class:"s-reviews-swiper-slide"},i("div",{class:"s-reviews-testimonial"},i("div",{class:"s-reviews-testimonial__inner"},i("div",{class:"s-reviews-testimonial__avatar"},i("img",{src:"images/s-empty.png","data-src":s.avatar,alt:s.name?s.name:"testimonial-"+t,class:"lazy"})),i("div",{class:"s-reviews-testimonial__text"},i("p",{innerHTML:s.content}),i("div",{class:"s-reviews-testimonial__name_wrapper"},i("div",{class:"s-reviews-testimonial__info"},s.name&&i("h2",null,`${s.name}`)),i("div",{class:"s-reviews-testimonial__rating"},i("salla-rating-stars",{size:"small",value:s.stars})))),i("span",{class:"s-reviews-testimonial__icon",innerHTML:'\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>quote-open</title>\n<path d="M8 12v-5.333c0-0.737-0.596-1.333-1.333-1.333-3.676 0-6.667 2.991-6.667 6.667v8c0 3.676 2.991 6.667 6.667 6.667h1.333c3.676 0 6.667-2.991 6.667-6.667v-1.333c0-3.676-2.991-6.667-6.667-6.667zM12 20c0 2.205-1.795 4-4 4h-1.333c-2.205 0-4-1.795-4-4v-8c0-1.739 1.115-3.221 2.667-3.772v5.105c0 0.737 0.596 1.333 1.333 1.333h1.333c2.205 0 4 1.795 4 4zM25.333 12v-5.333c0-0.737-0.596-1.333-1.333-1.333-3.676 0-6.667 2.991-6.667 6.667v8c0 3.676 2.991 6.667 6.667 6.667h1.333c3.676 0 6.667-2.991 6.667-6.667v-1.333c0-3.676-2.991-6.667-6.667-6.667zM29.333 20c0 2.205-1.795 4-4 4h-1.333c-2.205 0-4-1.795-4-4v-8c0-1.739 1.115-3.221 2.667-3.772v5.105c0 0.737 0.596 1.333 1.333 1.333h1.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n'})))))))))}};var _,C,L,M,S,T,z,H,$,D,I,P;function j(){if(D)return $;D=1;var s=n(),t=function(){if(C)return _;C=1;var s=r();return _=function(){return s.Date.now()}}(),i=function(){if(H)return z;H=1;var s=function(){if(T)return S;T=1;var s=function(){if(M)return L;M=1;var s=/\s/;return L=function(t){for(var i=t.length;i--&&s.test(t.charAt(i)););return i}}(),t=/^\s+/;return S=function(i){return i?i.slice(0,s(i)+1).replace(t,""):i}}(),t=n(),i=l(),e=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,r=/^0o[0-7]+$/i,o=parseInt;return z=function(n){if("number"==typeof n)return n;if(i(n))return NaN;if(t(n)){var l="function"==typeof n.valueOf?n.valueOf():n;n=t(l)?l+"":l}if("string"!=typeof n)return 0===n?n:+n;n=s(n);var h=a.test(n);return h||r.test(n)?o(n.slice(2),h?2:8):e.test(n)?NaN:+n}}(),e=Math.max,a=Math.min;return $=function(r,n,l){var o,h,c,m,d,p,g=0,u=!1,v=!1,w=!0;if("function"!=typeof r)throw new TypeError("Expected a function");function f(s){var t=o,i=h;return o=h=void 0,g=s,m=r.apply(i,t)}function b(s){var t=s-p;return void 0===p||t>=n||t<0||v&&s-g>=c}function y(){var s=t();if(b(s))return k(s);d=setTimeout(y,function(s){var t=n-(s-p);return v?a(t,c-(s-g)):t}(s))}function k(s){return d=void 0,w&&o?f(s):(o=h=void 0,m)}function x(){var s=t(),i=b(s);if(o=arguments,h=this,p=s,i){if(void 0===d)return function(s){return g=s,d=setTimeout(y,n),u?f(s):m}(p);if(v)return clearTimeout(d),d=setTimeout(y,n),f(p)}return void 0===d&&(d=setTimeout(y,n)),m}return n=i(n)||0,s(l)&&(u=!!l.leading,c=(v="maxWait"in l)?e(i(l.maxWait)||0,n):c,w="trailing"in l?!!l.trailing:w),x.cancel=function(){void 0!==d&&clearTimeout(d),g=0,o=p=h=d=void 0},x.flush=function(){return void 0===d?m:k(t())},x},$}x.style="";var E=o(function(){if(P)return I;P=1;var s=j(),t=n();return I=function(i,e,a){var r=!0,n=!0;if("function"!=typeof i)throw new TypeError("Expected a function");return t(a)&&(r="leading"in a?!!a.leading:r,n="trailing"in a?!!a.trailing:n),s(i,e,{leading:r,maxWait:e,trailing:n})}}());class R{constructor(s){this.grid=s,this.create=()=>{this.mutationObserver.observe(this.grid,{childList:!0});for(const s of Array.from(this.grid.children))this.resizeObserver.observe(s)},this.onContainerMutation=s=>{const t=s.flatMap((s=>Array.from(s.removedNodes))),i=s.flatMap((s=>Array.from(s.addedNodes)));for(const s of t)s instanceof Element&&this.resizeObserver.unobserve(s);for(const s of i)s instanceof Element&&this.resizeObserver.observe(s);t.length>0&&0===i.length&&this.update()},this.onChildrenResize=s=>{s.filter((s=>null!==s.target.parentElement)).length>0&&this.update()},this.update=E((()=>{const s=window.getComputedStyle(this.grid);if(!1===s.getPropertyValue("display").includes("grid"))return void this.clean();const t=function(s){return window.getComputedStyle(s).getPropertyValue("grid-template-columns").trim().split(/\s+(?=(?:[^()]*\([^()]*\))*[^()]*$)/)}(this.grid);if(t.length<=1)return void this.clean();const i=Number.parseFloat(s.getPropertyValue("row-gap").trim())||0,e=Array.from(this.grid.children);for(let s=0;s<t.length;s++){const t=e[s];t?.style.removeProperty("margin-top")}for(let s=0;s<e.length;s++){const a=e[s-t.length],r=e[s];if(void 0!==a&&void 0!==r){const s=a.getBoundingClientRect().bottom;r.style.removeProperty("margin-top");const t=r.getBoundingClientRect().top;if(t-i!==s){const e=Math.round(100*(s-(t-i)+Number.EPSILON))/100;r.style.setProperty("margin-top",`${e}px`)}}}}),32),this.destroy=()=>{this.resizeObserver.disconnect(),this.mutationObserver.disconnect(),this.clean()},this.clean=()=>{for(const s of Array.from(this.grid.children))s.style.removeProperty("margin-top")},this.mutationObserver=new MutationObserver(this.onContainerMutation),this.resizeObserver=new ResizeObserver(this.onChildrenResize),!1===CSS.supports("grid-template-rows","masonry")&&this.create()}[Symbol.dispose](){this.destroy()}}const A=class{constructor(t){s(this,t),this.reviews=[],this.isLoading=!1,this.pagination=null,this.sort="latest"}getUrlParams(){const s=new URLSearchParams(window.location.search);return{sort:s.get("sort")||null,page:Number.parseInt(s.get("page"))||1}}updateUrlParams(s){const t=new URL(window.location.href);for(const[i,e]of Object.entries(s))e?t.searchParams.set(i,e.toString()):t.searchParams.delete(i);window.history.replaceState({},"",t.toString())}fetchReviews(s,t){const i=this.getUrlParams();return salla.api.request("reviews",{params:{type:"products",format:"lite",per_page:8,page:t||i.page||1,sort:s||i.sort||null}})}async initializeMasonry(){const s=this.el.querySelector(".s-reviews-page-grid");if(s)try{new R(s),salla.logger.info("Masonry initialized successfully")}catch(s){salla.logger.error("Masonry initialization failed:",s)}}animateReviewCards(){const s=this.wrapper.querySelectorAll("salla-review-card:not(.animated)");m.animateItems(s)}initiateInfiniteScroll(){this.wrapper?(this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.pagination?.links?.next||null,history:!1,scrollThreshold:!1},!0),this.infiniteScroll?.on("request",(()=>{this.isLoading=!0})),this.infiniteScroll?.on("load",(s=>{this.pagination=s.pagination,this.reviews=[...this.reviews,...s.data],this.isLoading=!1,this.updateUrlParams({page:s.pagination.current_page})})),this.infiniteScroll?.on("error",(s=>{salla.logger.error("Error loading more reviews:",s),this.isLoading=!1}))):salla.logger.error("Wrapper is undefined. Cannot initiate infinite scroll.")}componentDidRender(){setTimeout((()=>{requestAnimationFrame(this.animateReviewCards.bind(this))}),176)}async componentWillLoad(){try{await salla.onReady(),this.langTitlesReviews=salla.lang.get("common.titles.reviews"),this.langSorting=salla.lang.get("pages.categories.sorting"),this.placeholderText=salla.lang.choice("pages.rating.reviews",0),this.langLoadMore=salla.lang.get("common.elements.load_more"),this.langSortByTopRating=salla.lang.get("pages.testimonials.sort_by_rating_desc"),this.langSortByMostRecent=salla.lang.get("pages.testimonials.sort_by_date_desc"),this.langSortByLeastRated=salla.lang.get("pages.testimonials.sort_by_rating_asc"),this.langSortByLeastRecent=salla.lang.get("pages.testimonials.sort_by_date_asc");const s=this.getUrlParams(),t=await this.fetchReviews(s.sort);this.sort=s.sort,this.reviews=t.data,this.pagination=t.pagination,this.langRatingReviews=salla.lang.choice("pages.rating.reviews",this.pagination?.total)}catch(s){salla.logger.error("Error loading reviews:",s)}}async handleSorting(s){const t=s.target.value;this.sort=t,this.updateUrlParams({sort:t,page:1});const i=await this.fetchReviews(t,1);this.reviews=i.data,this.pagination=i.pagination}async componentDidLoad(){await this.initializeMasonry(),this.initiateInfiniteScroll(),this.sort=this.getUrlParams().sort||"latest",this.updateUrlParams({sort:this.sort,page:1})}disconnectedCallback(){this.infiniteScroll&&this.infiniteScroll.destroy()}renderSortingOptions(){return[{value:"latest",label:this.langSortByMostRecent},{value:"oldest",label:this.langSortByLeastRecent},{value:"top_rating",label:this.langSortByTopRating},{value:"bottom_rating",label:this.langSortByLeastRated}].map((s=>i("option",{key:s.value,value:s.value,selected:s.value===this.sort},s.label)))}render(){return i("host",{key:"b82b491ae189f825367881b7b4f03ad64e471aae"},i("div",{key:"d124f10806cfabd1c1f85044786541011edff3ff",class:"s-reviews-page-header-wrapper"},i("h2",{key:"30c58bb14bea27da968e874a0c1454a35e8db207",class:"s-reviews-page-title"},this.langTitlesReviews,i("span",{key:"8850771469ae20d1b07efcb45be58738de377e6d",class:"s-reviews-page-count"},"(",this.langRatingReviews,")")),i("div",{key:"5a0060c5bdbfe4d37003b04d4c6368460be8cd38",class:"s-reviews-page-filter-wrapper"},i("label",{key:"637d1aeec005ae662c6019c423ef3f1c3a6ff264",class:"s-reviews-page-filter-label",htmlFor:"testimonials-filter"},this.langSorting),i("select",{key:"5b68b9441d4647f12583c71da61958c30c0dcda6",onChange:s=>this.handleSorting(s),disabled:!this.reviews.length,class:"s-reviews-page-filter"},this.renderSortingOptions()))),this.reviews.length?i("main",{class:"s-reviews-page-grid",ref:s=>{this.wrapper=s}},this.reviews.map((s=>i("salla-review-card",{key:s.id,review:s})))):i("div",{class:"s-products-list-placeholder"},i("span",{innerHTML:g}),i("p",null,this.placeholderText)),this.pagination?.links?.next&&this.reviews.length?i("div",{class:"s-reviews-page-load-more-container"},i("salla-button",{class:"s-reviews-page-load-more-btn",loading:this.isLoading,onClick:()=>this.infiniteScroll?.loadNextPage(),onKeyUp:()=>this.infiniteScroll?.loadNextPage()},this.langLoadMore)):null)}get el(){return a(this)}};A.style=":host{display:block}";const N=class{constructor(t){s(this,t),this.canRender=!1,this.showRatingSummary=!1,this.recommendationOnly=!1,this.showRecommendation=!1}async componentWillLoad(){try{await salla.onReady(),this.initializeLanguages(),this.loadConfig(),(this.showRatingSummary||this.showRecommendation)&&await this.loadSummary()}catch(s){console.error("Failed to initialize reviews summary component:",s)}}async loadConfig(){this.showRatingSummary=salla.config.get("store.settings.rating.show_rating_summary"),this.showRecommendation=salla.config.get("store.settings.rating.show_recommendation"),this.recommendationOnly=this.showRecommendation&&!this.showRatingSummary}initializeLanguages(){return Salla.lang.onLoaded((()=>{Salla.lang.addBulk({"blocks.comments.based_on":{ar:"بناءً على",en:"Based on"},"blocks.comments.recommended":{ar:"أوصوا بالمنتج",en:"Recommended"},"blocks.comments.overall_rating":{ar:"التقييم العام",en:"Overall rating"}}),this.basedOnLabel=salla.lang.get("blocks.comments.based_on"),this.recommendedLabel=salla.lang.get("blocks.comments.recommended"),this.overallRatingLabel=salla.lang.get("blocks.comments.overall_rating")}))}async loadSummary(){if(!this.itemId)return console.error("Error loading reviews summary: itemId is not defined"),this.canRender=!1;try{const s=await salla.api.request(`rating/summary/${this.itemId}`);if(!s?.data||Array.isArray(s.data.reviews)&&!s.data.reviews.length)return this.canRender=!1,void(this.data=null);this.data=s.data,this.canRender=!0}catch(s){this.canRender=!1,this.data=null,console.error("Error loading reviews summary:",s)}}renderFactorTags(){const s=this.data?.factors||[];return s.length?i("div",{class:"s-reviews-summary-factors"},s.map((s=>i("div",{class:"s-reviews-summary-factor-tag"},i("span",{class:"s-reviews-summary-factor-name"},s.name),i("span",{class:"s-reviews-summary-factor-star",innerHTML:d}),i("span",{class:"s-reviews-summary-factor-rating"},s.rating||""))))):null}renderRecommendation(){return this.showRecommendation&&this.data?.recommendation?i("div",{class:("s-reviews-summary-header-section "+(this.recommendationOnly?"s-reviews-summary-recommendation-only":"")).trim()},i("h4",{class:"s-reviews-summary-recommendation-percentage"},"%",this.data?.recommendation),i("p",{class:"s-reviews-summary-count"},this.recommendedLabel)):null}render(){if(!this.canRender)return null;if(this.recommendationOnly)return this.renderRecommendation();const s={1:0,2:0,3:0,4:0,5:0,...this.data.reviews},t=Object.keys(s).reverse().map((t=>{const e=s[t];return i("div",{key:t,class:"s-reviews-summary-row"},i("div",{class:"s-reviews-summary-row-rate"},t," ",i("span",{innerHTML:d})),i("salla-progress-bar",{class:"s-reviews-summary-progress",value:e,target:100,hideUnits:!0,height:"16px"}),i("span",{class:"s-reviews-summary-percentage"},e,"%"))}));return i(e,{class:"s-reviews-summary-wrapper"},i("div",{class:"s-reviews-summary-header"},i("div",{class:"s-reviews-summary-overall-section items-start"},i("p",{class:"s-reviews-summary-overall-label"},this.overallRatingLabel),i("div",{class:"s-reviews-summary-overall-row"},i("h3",{class:"s-reviews-summary-average"},this.data.rating),i("div",null,i("salla-rating-stars",{size:"large",value:this.data.rating}),i("p",{class:"s-reviews-summary-count"},this.basedOnLabel," ",salla.helpers.number(salla.lang.choice("pages.rating.reviews",this.data.count)))))),this.renderFactorTags(),this.renderRecommendation()),i("div",{class:"s-reviews-summary-rows"},t))}};N.style=":host{display:block}.s-reviews-summary-overall-section{display:flex;flex-direction:column;align-items:flex-start;gap:0.35rem;padding:0 0.5rem}.s-reviews-summary-overall-label{color:#111827;font-size:1.15rem;font-weight:600;line-height:1.3;margin-bottom:0.75rem}.s-reviews-summary-overall-row{display:inline-flex;align-items:flex-start;gap:0.7rem}.s-reviews-summary-factors{display:flex;flex-wrap:wrap;gap:0.5rem;justify-content:flex-start;margin-bottom:0.6rem}.s-reviews-summary-factor-tag{display:inline-flex;align-items:center;gap:0.25rem;border-radius:999px;border:1px solid #e8e8e8;background:rgba(255, 255, 255, 0.3);color:#374151;font-size:0.85rem;line-height:1;padding:0.4rem 0.65rem}.s-reviews-summary-factor-rating{font-weight:600;color:#0f6a7c}.s-reviews-summary-factor-star{display:inline-flex;width:0.8rem;height:0.8rem;fill:#0f6a7c}.s-reviews-summary-factor-star svg{width:100%;height:100%}";export{u as salla_comment_form,v as salla_comment_item,f as salla_comments,b as salla_rating_stars,y as salla_review_card,x as salla_reviews,A as salla_reviews_page,N as salla_reviews_summary}