@salla.sa/twilight-components 2.14.551 → 2.14.552

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 (331) hide show
  1. package/dist/cjs/{filepond-C99K1KEB.js → filepond-BTsLGLic.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-CggRjTNg.js → filepond-plugin-file-poster-DSHHkMx8.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-B009kdAV.js → filepond-plugin-file-validate-size-BB6ltSRf.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-DZs9-bai.js → filepond-plugin-file-validate-type-CNWlgtpi.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-DNNheErX.js → filepond-plugin-image-edit-DuY72vJR.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-ChN0IpOy.js → filepond-plugin-image-exif-orientation-DWzZOyOL.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-BZo2ftGo.js → filepond-plugin-image-preview-ropJ4nYL.js} +1 -1
  8. package/dist/cjs/{helpers-DHdDjm5V.js → helpers-Dm4BirHO.js} +2 -2
  9. package/dist/cjs/{index-0JUvtl0d.js → index-CoSVCFSp.js} +4 -4
  10. package/dist/cjs/{intlTelInput-D84-rI5D.js → intlTelInput-BSHBNNPO.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-applied-filters.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-attachment-view_9.cjs.entry.js +10 -10
  21. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  23. package/dist/cjs/{salla-bullet-delivery_2.cjs.entry.js → salla-bullet-delivery_3.cjs.entry.js} +60 -3
  24. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-comment-form_9.cjs.entry.js +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.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 +2 -2
  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_10.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-notification-item_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-options-modal_2.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  105. package/dist/cjs/twilight.cjs.js +2 -2
  106. package/dist/cjs/{vanilla-picker-D8r5xyK7.js → vanilla-picker-DdIwY7TN.js} +1 -1
  107. package/dist/collection/collection-manifest.json +6 -4
  108. package/dist/collection/components/salla-bullet-delivery/helpers.js +2 -2
  109. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +7 -1
  110. package/dist/collection/components/salla-bullet-delivery-tag/salla-bullet-delivery-tag.css +70 -0
  111. package/dist/collection/components/salla-bullet-delivery-tag/salla-bullet-delivery-tag.js +77 -0
  112. package/dist/components/helpers.js +2 -2
  113. package/dist/components/index.js +2 -2
  114. package/dist/components/salla-bullet-delivery-tag.d.ts +11 -0
  115. package/dist/components/salla-bullet-delivery-tag.js +76 -0
  116. package/dist/components/salla-bullet-delivery.js +7 -1
  117. package/dist/esm/{filepond-DuMUHI7t.js → filepond-CqbRA3Vl.js} +1 -1
  118. package/dist/esm/{filepond-plugin-file-poster-Dv25V2UU.js → filepond-plugin-file-poster-Byt9onuT.js} +1 -1
  119. package/dist/esm/{filepond-plugin-file-validate-size-Dxl4yPm6.js → filepond-plugin-file-validate-size-C1P2OJEv.js} +1 -1
  120. package/dist/esm/{filepond-plugin-file-validate-type-C602myuq.js → filepond-plugin-file-validate-type-BP2FLMsG.js} +1 -1
  121. package/dist/esm/{filepond-plugin-image-edit-DLd3ht_R.js → filepond-plugin-image-edit-C69hhmiF.js} +1 -1
  122. package/dist/esm/{filepond-plugin-image-exif-orientation-BaQ5DNLu.js → filepond-plugin-image-exif-orientation-B2QzeXLq.js} +1 -1
  123. package/dist/esm/{filepond-plugin-image-preview-C-RFNs7l.js → filepond-plugin-image-preview-CR1odLVd.js} +1 -1
  124. package/dist/esm/{helpers-BDChq2t4.js → helpers-CV6uPJEJ.js} +2 -2
  125. package/dist/esm/{index-BsIeN-bg.js → index-Q9lz4Iuq.js} +4 -4
  126. package/dist/esm/{intlTelInput-Cf6zBu5Y.js → intlTelInput-DzbfeHCl.js} +1 -1
  127. package/dist/esm/loader.js +3 -3
  128. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  129. package/dist/esm/salla-accordion_6.entry.js +1 -1
  130. package/dist/esm/salla-add-product-button_5.entry.js +1 -1
  131. package/dist/esm/salla-advertisement.entry.js +1 -1
  132. package/dist/esm/salla-alert_2.entry.js +1 -1
  133. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  134. package/dist/esm/salla-applied-filters.entry.js +1 -1
  135. package/dist/esm/salla-apps-icons.entry.js +1 -1
  136. package/dist/esm/salla-attachment-view_9.entry.js +10 -10
  137. package/dist/esm/salla-badge.entry.js +1 -1
  138. package/dist/esm/salla-basket-gap.entry.js +1 -1
  139. package/dist/esm/{salla-bullet-delivery_2.entry.js → salla-bullet-delivery_3.entry.js} +60 -4
  140. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  141. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  142. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  143. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  144. package/dist/esm/salla-comment-factors.entry.js +1 -1
  145. package/dist/esm/salla-comment-form_9.entry.js +1 -1
  146. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  147. package/dist/esm/salla-contacts.entry.js +1 -1
  148. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  149. package/dist/esm/salla-count-down.entry.js +1 -1
  150. package/dist/esm/salla-custom-fields.entry.js +1 -1
  151. package/dist/esm/salla-delivery-promise.entry.js +2 -2
  152. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  153. package/dist/esm/salla-filters-widget.entry.js +1 -1
  154. package/dist/esm/salla-filters.entry.js +1 -1
  155. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  156. package/dist/esm/salla-gifting.entry.js +1 -1
  157. package/dist/esm/salla-hook.entry.js +1 -1
  158. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  159. package/dist/esm/salla-installment.entry.js +1 -1
  160. package/dist/esm/salla-list-tile.entry.js +1 -1
  161. package/dist/esm/salla-localization-modal.entry.js +1 -1
  162. package/dist/esm/salla-login-modal.entry.js +1 -1
  163. package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
  164. package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
  165. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  166. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  167. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  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_2.entry.js +1 -1
  178. package/dist/esm/salla-offer-modal.entry.js +1 -1
  179. package/dist/esm/salla-offer.entry.js +1 -1
  180. package/dist/esm/salla-order-branch.entry.js +1 -1
  181. package/dist/esm/salla-order-cancel.entry.js +1 -1
  182. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  183. package/dist/esm/salla-order-details-options.entry.js +1 -1
  184. package/dist/esm/salla-order-details.entry.js +1 -1
  185. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  186. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  187. package/dist/esm/salla-order-edit.entry.js +1 -1
  188. package/dist/esm/salla-order-options-modal_2.entry.js +1 -1
  189. package/dist/esm/salla-order-shipments.entry.js +1 -1
  190. package/dist/esm/salla-order-summary.entry.js +1 -1
  191. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  192. package/dist/esm/salla-orders.entry.js +1 -1
  193. package/dist/esm/salla-payments.entry.js +1 -1
  194. package/dist/esm/salla-placeholder.entry.js +1 -1
  195. package/dist/esm/salla-price-range.entry.js +1 -1
  196. package/dist/esm/salla-product-card-embed.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-products-slider.entry.js +1 -1
  200. package/dist/esm/salla-quick-order.entry.js +1 -1
  201. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  202. package/dist/esm/salla-rating-modal.entry.js +1 -1
  203. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  204. package/dist/esm/salla-review-order-item.entry.js +1 -1
  205. package/dist/esm/salla-scopes.entry.js +1 -1
  206. package/dist/esm/salla-search.entry.js +1 -1
  207. package/dist/esm/salla-skeleton.entry.js +1 -1
  208. package/dist/esm/salla-slider.entry.js +1 -1
  209. package/dist/esm/salla-social-share.entry.js +1 -1
  210. package/dist/esm/salla-social.entry.js +1 -1
  211. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  212. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  213. package/dist/esm/salla-tooltip.entry.js +1 -1
  214. package/dist/esm/salla-trust-badges.entry.js +1 -1
  215. package/dist/esm/salla-user-menu.entry.js +1 -1
  216. package/dist/esm/salla-user-profile.entry.js +1 -1
  217. package/dist/esm/salla-user-settings.entry.js +1 -1
  218. package/dist/esm/salla-verify.entry.js +1 -1
  219. package/dist/esm/salla-wallet.entry.js +1 -1
  220. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  221. package/dist/esm/twilight.js +3 -3
  222. package/dist/esm/{vanilla-picker-S7qZ7YZm.js → vanilla-picker-DZSS4OVz.js} +1 -1
  223. package/dist/twilight/{p-18639885.entry.js → p-008dcf73.entry.js} +1 -1
  224. package/dist/twilight/{p-4ef06a6f.entry.js → p-00bb1a13.entry.js} +1 -1
  225. package/dist/twilight/{p-3aa6fa7d.entry.js → p-0100262e.entry.js} +1 -1
  226. package/dist/twilight/{p-18a604c5.entry.js → p-06109ef0.entry.js} +1 -1
  227. package/dist/twilight/{p-9dd126e2.entry.js → p-06abf9fb.entry.js} +1 -1
  228. package/dist/twilight/{p-8711224a.entry.js → p-0bb678e7.entry.js} +1 -1
  229. package/dist/twilight/{p-a8316527.entry.js → p-1242708e.entry.js} +1 -1
  230. package/dist/twilight/{p-90f29c99.entry.js → p-171c1927.entry.js} +1 -1
  231. package/dist/twilight/{p-f037e508.entry.js → p-1dc63988.entry.js} +1 -1
  232. package/dist/twilight/{p-0a332226.entry.js → p-25017fcd.entry.js} +1 -1
  233. package/dist/twilight/{p-3c2cc4fe.entry.js → p-25b7344e.entry.js} +1 -1
  234. package/dist/twilight/{p-43f8f33b.entry.js → p-27176c04.entry.js} +1 -1
  235. package/dist/twilight/{p-2a3d30d1.entry.js → p-2845de1c.entry.js} +1 -1
  236. package/dist/twilight/{p-6d787fa0.entry.js → p-31394018.entry.js} +1 -1
  237. package/dist/twilight/{p-ebc6ba28.entry.js → p-31d03d8c.entry.js} +1 -1
  238. package/dist/twilight/{p-847cdd79.entry.js → p-34dfff49.entry.js} +1 -1
  239. package/dist/twilight/{p-0944d367.entry.js → p-36aa4c09.entry.js} +1 -1
  240. package/dist/twilight/{p-56845467.entry.js → p-382e5a40.entry.js} +1 -1
  241. package/dist/twilight/{p-a9ef3c52.entry.js → p-3c0705e2.entry.js} +1 -1
  242. package/dist/twilight/{p-84cffb13.entry.js → p-40b70c18.entry.js} +1 -1
  243. package/dist/twilight/{p-2ff7bb22.entry.js → p-462a49e4.entry.js} +1 -1
  244. package/dist/twilight/{p-eb3a095b.entry.js → p-492c72eb.entry.js} +1 -1
  245. package/dist/twilight/{p-54974d98.entry.js → p-4941b3cd.entry.js} +1 -1
  246. package/dist/twilight/{p-af348a67.entry.js → p-49cbb9ed.entry.js} +1 -1
  247. package/dist/twilight/{p-2331e63a.entry.js → p-4abffe52.entry.js} +1 -1
  248. package/dist/twilight/{p-1118bee2.entry.js → p-4b827efc.entry.js} +1 -1
  249. package/dist/twilight/{p-56f164bb.entry.js → p-4bac36be.entry.js} +1 -1
  250. package/dist/twilight/{p-b5a2342c.entry.js → p-52e1754b.entry.js} +1 -1
  251. package/dist/twilight/{p-704553fb.entry.js → p-53e430c6.entry.js} +1 -1
  252. package/dist/twilight/{p-a344db00.entry.js → p-5470f52a.entry.js} +1 -1
  253. package/dist/twilight/{p-683db553.entry.js → p-54bdc583.entry.js} +1 -1
  254. package/dist/twilight/{p-523572e9.entry.js → p-56e93806.entry.js} +1 -1
  255. package/dist/twilight/{p-5918dd8d.entry.js → p-5b94bea7.entry.js} +1 -1
  256. package/dist/twilight/{p-357b5593.entry.js → p-5d671536.entry.js} +1 -1
  257. package/dist/twilight/{p-5ba2eb55.entry.js → p-61ca8dd2.entry.js} +1 -1
  258. package/dist/twilight/{p-5dfd449d.entry.js → p-67b60d33.entry.js} +1 -1
  259. package/dist/twilight/{p-1bf18c56.entry.js → p-6860331a.entry.js} +1 -1
  260. package/dist/twilight/{p-6f58ac6a.entry.js → p-6867eb35.entry.js} +1 -1
  261. package/dist/twilight/{p-a037e47d.entry.js → p-688b40b4.entry.js} +1 -1
  262. package/dist/twilight/{p-ff37c2af.entry.js → p-6f6d6f45.entry.js} +1 -1
  263. package/dist/twilight/{p-13c4b450.entry.js → p-7022989a.entry.js} +1 -1
  264. package/dist/twilight/{p-2c48bb97.entry.js → p-729f3fa0.entry.js} +1 -1
  265. package/dist/twilight/{p-83a5b8a4.entry.js → p-754af3dd.entry.js} +1 -1
  266. package/dist/twilight/{p-709c2184.entry.js → p-79451510.entry.js} +1 -1
  267. package/dist/twilight/{p-5cd4b67f.entry.js → p-79e2d7eb.entry.js} +1 -1
  268. package/dist/twilight/{p-2bef08e8.entry.js → p-7d3899e7.entry.js} +1 -1
  269. package/dist/twilight/{p-ef145c1e.entry.js → p-7d9e3032.entry.js} +1 -1
  270. package/dist/twilight/{p-cdba9d35.entry.js → p-7dda74dd.entry.js} +1 -1
  271. package/dist/twilight/{p-27456209.entry.js → p-7deba3f8.entry.js} +1 -1
  272. package/dist/twilight/{p-906b36e3.entry.js → p-7e8b2b0d.entry.js} +1 -1
  273. package/dist/twilight/{p-6f3516a1.entry.js → p-7f2bc499.entry.js} +1 -1
  274. package/dist/twilight/{p-22cb8a9c.entry.js → p-808fef3d.entry.js} +1 -1
  275. package/dist/twilight/{p-0e3d72ab.entry.js → p-8920aae0.entry.js} +1 -1
  276. package/dist/twilight/{p-869fe4c0.entry.js → p-89aad90f.entry.js} +1 -1
  277. package/dist/twilight/{p-2a683382.entry.js → p-8abf3859.entry.js} +1 -1
  278. package/dist/twilight/{p-49f9e536.entry.js → p-8bcf6db3.entry.js} +1 -1
  279. package/dist/twilight/{p-3fb485a6.entry.js → p-9118b3cf.entry.js} +1 -1
  280. package/dist/twilight/{p-e875f53e.entry.js → p-92fbada7.entry.js} +1 -1
  281. package/dist/twilight/{p-6a746b8a.entry.js → p-9f4fef0f.entry.js} +1 -1
  282. package/dist/twilight/{p-035DwuUC.js → p-B31LPQuk.js} +1 -1
  283. package/dist/twilight/{p-DNS31w5e.js → p-BCwAi8HD.js} +1 -1
  284. package/dist/twilight/{p-mgSPapOV.js → p-CA-ne4vX.js} +1 -1
  285. package/dist/twilight/{p-wqmCmzsY.js → p-CPEEGqkw.js} +1 -1
  286. package/dist/twilight/{p-BDChq2t4.js → p-CV6uPJEJ.js} +1 -1
  287. package/dist/twilight/{p-CPiqlSTo.js → p-Ce0SoG8e.js} +1 -1
  288. package/dist/twilight/{p-DeX830vG.js → p-DPu3dYaG.js} +1 -1
  289. package/dist/twilight/{p-BsIeN-bg.js → p-Q9lz4Iuq.js} +1 -1
  290. package/dist/twilight/{p-BRZVMxhy.js → p-VPmzkmKU.js} +1 -1
  291. package/dist/twilight/{p-CaCiueRc.js → p-WyyaE0fN.js} +1 -1
  292. package/dist/twilight/{p-9f431f78.entry.js → p-a0e73c0f.entry.js} +1 -1
  293. package/dist/twilight/{p-b238c74b.entry.js → p-a24168ae.entry.js} +1 -1
  294. package/dist/twilight/{p-47713dd1.entry.js → p-a70cbfe9.entry.js} +1 -1
  295. package/dist/twilight/{p-68d754be.entry.js → p-a7417d3a.entry.js} +1 -1
  296. package/dist/twilight/{p-aa8962f8.entry.js → p-aa1af88d.entry.js} +1 -1
  297. package/dist/twilight/{p-07adeb89.entry.js → p-ae5ce421.entry.js} +1 -1
  298. package/dist/twilight/{p-6edd1008.entry.js → p-b881f716.entry.js} +1 -1
  299. package/dist/twilight/{p-a30390a7.entry.js → p-b92af898.entry.js} +1 -1
  300. package/dist/twilight/{p-be0ac755.entry.js → p-bbdec84a.entry.js} +1 -1
  301. package/dist/twilight/{p-1abe8321.entry.js → p-bd389ba7.entry.js} +1 -1
  302. package/dist/twilight/{p-ecdbd18f.entry.js → p-bf860754.entry.js} +1 -1
  303. package/dist/twilight/{p-6c5a1ded.entry.js → p-bfa2b7c5.entry.js} +1 -1
  304. package/dist/twilight/{p-efe6493f.entry.js → p-c0599e5d.entry.js} +1 -1
  305. package/dist/twilight/{p-d5215891.entry.js → p-c6ed3a34.entry.js} +1 -1
  306. package/dist/twilight/{p-b1e0bc90.entry.js → p-c7482df4.entry.js} +1 -1
  307. package/dist/twilight/{p-01406425.entry.js → p-c90ff0bf.entry.js} +1 -1
  308. package/dist/twilight/{p-569c6d6c.entry.js → p-ce8205e2.entry.js} +1 -1
  309. package/dist/twilight/{p-501c0798.entry.js → p-d6a04817.entry.js} +1 -1
  310. package/dist/twilight/{p-9fdbe8a0.entry.js → p-d70c704f.entry.js} +25 -25
  311. package/dist/twilight/{p-211324e6.entry.js → p-d7c03cf7.entry.js} +1 -1
  312. package/dist/twilight/{p-a0ed97f5.entry.js → p-dfc67513.entry.js} +1 -1
  313. package/dist/twilight/{p-a64771f7.entry.js → p-e0868b92.entry.js} +1 -1
  314. package/dist/twilight/{p-a46a9d28.entry.js → p-e305f635.entry.js} +1 -1
  315. package/dist/twilight/{p-ea968ba3.entry.js → p-e69f6c43.entry.js} +1 -1
  316. package/dist/twilight/{p-8ebb86ce.entry.js → p-e6b1dd40.entry.js} +1 -1
  317. package/dist/twilight/{p-a01f64e7.entry.js → p-ea3480ff.entry.js} +1 -1
  318. package/dist/twilight/{p-f4f355e5.entry.js → p-eddf3ee5.entry.js} +1 -1
  319. package/dist/twilight/{p-e3e2baa2.entry.js → p-f0cefe50.entry.js} +1 -1
  320. package/dist/twilight/{p-9025e5d9.entry.js → p-f4207ccf.entry.js} +1 -1
  321. package/dist/twilight/{p-a3579980.entry.js → p-f5485435.entry.js} +1 -1
  322. package/dist/twilight/{p-aa91a230.entry.js → p-f632b2f7.entry.js} +1 -1
  323. package/dist/twilight/{p-49738042.entry.js → p-f7c2ff0f.entry.js} +1 -1
  324. package/dist/twilight/{p-fed3efba.entry.js → p-fe34bfd0.entry.js} +1 -1
  325. package/dist/twilight/{p-2df31e90.entry.js → p-ff6672b6.entry.js} +1 -1
  326. package/dist/twilight/{p-B3oo4tIx.js → p-sDtjU0pK.js} +1 -1
  327. package/dist/twilight/twilight.esm.js +1 -1
  328. package/dist/types/components/salla-bullet-delivery/interfaces.d.ts +2 -0
  329. package/dist/types/components/salla-bullet-delivery-tag/salla-bullet-delivery-tag.d.ts +26 -0
  330. package/dist/types/components.d.ts +77 -0
  331. package/package.json +5 -5
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as i,H as e}from"./p-BsIeN-bg.js";import{f as s,g as a}from"./p-DqXpn47Z.js";const l=class{constructor(i){t(this,i),this.productRatings=[],this.allowUpdate=!1}async componentWillLoad(){await salla.onReady(),await this.loadOrderItem()}async onProductIdChange(){this.orderItem=void 0,this.productRatings=[],await this.loadOrderItem()}resolveFetchOrderId(){return salla.config.get("page.id")}sameId(t,i){return null!=t&&null!=i&&String(t)===String(i)}label(t,i){return"function"==typeof salla?.lang?.getWithDefault?salla.lang.getWithDefault(t,i):salla?.lang?.get?.(t)||i}toOrderItemRating(t){return{id:t.id??t.feedback_id,stars:t.stars??t.rating,content:t.content||"",is_pending:t.is_pending,can_update:t.can_update,images:t.images||[],videos:t.videos||[],product:t.product}}resolveOrderItem(t,i){const e=Array.isArray(t?.items)?t.items:[],s=i.find((t=>this.sameId(t.product?.id,this.productId)));if(!s)return;const a=e.find((t=>this.sameId(t.product?.id,this.productId)))||{product:s.product||{id:this.productId}};return{...a,product:a.product||s.product||{id:this.productId},rating:this.toOrderItemRating(s)}}async loadOrderItem(){const t=this.resolveFetchOrderId();if(t&&null!=this.productId&&""!==this.productId){this.fetchOrderId=t,this.allowUpdate=!!salla.config.get("store.settings.rating.allow_update");try{const i=await s(t);this.productRatings=a(i?.rating),this.orderItem=this.resolveOrderItem(i,this.productRatings)}catch(t){console.error("[salla-review-order-item] failed to load order item review",t)}}}renderActions(t){const e=t.rating;return e&&this.allowUpdate?i("div",{class:"rating-actions"},i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.edit_period_ended","انتهت مدة التعديل"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",fill:"outline",color:"dark",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::edit",{type:"product",feedback_id:e.id}):void 0},i("i",{class:"sicon-format-border-color text-xl"}))),i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.delete_period_ended","انتهت مدة الحذف"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",color:"danger",fill:"outline",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::delete",{feedback_id:e.id}):void 0},i("i",{class:"sicon-trash-2 text-xl"})))):null}serializeRatingMedia(t){return JSON.stringify({images:t.images||[],videos:t.videos||[],product:t.product})}serializeProductRatings(){return JSON.stringify(this.productRatings)}render(){const t=this.orderItem,s=t?.rating;return t&&s&&this.fetchOrderId?i(e,null,i("section",{class:"flex justify-between items-start border-t mt-10 pt-8"},i("div",null,i("p",{innerHTML:s.content||""}),s.is_pending?i("span",null,this.label("pages.rating.pending","قيد المراجعة")):null,i("div",{class:"flex flex-row flex-wrap gap-2"},i("salla-rating-stars",{size:"large",value:s.stars}),i("salla-review-factors-tags",{"order-id":this.fetchOrderId,"rating-id":s.id,"product-id":t.product?.id})),i("div",{class:"mt-2"},i("salla-attachments",{rating:this.serializeRatingMedia(s),"product-ratings":this.serializeProductRatings(),"product-id":t.product?.id??null}))),this.renderActions(t))):i(e,null)}static get watchers(){return{productId:["onProductIdChange"]}}};export{l as salla_review_order_item}
4
+ import{r as t,h as i,H as e}from"./p-Q9lz4Iuq.js";import{f as s,g as l}from"./p-DqXpn47Z.js";const a=class{constructor(i){t(this,i),this.productRatings=[],this.allowUpdate=!1}async componentWillLoad(){await salla.onReady(),await this.loadOrderItem()}async onProductIdChange(){this.orderItem=void 0,this.productRatings=[],await this.loadOrderItem()}resolveFetchOrderId(){return salla.config.get("page.id")}sameId(t,i){return null!=t&&null!=i&&String(t)===String(i)}label(t,i){return"function"==typeof salla?.lang?.getWithDefault?salla.lang.getWithDefault(t,i):salla?.lang?.get?.(t)||i}toOrderItemRating(t){return{id:t.id??t.feedback_id,stars:t.stars??t.rating,content:t.content||"",is_pending:t.is_pending,can_update:t.can_update,images:t.images||[],videos:t.videos||[],product:t.product}}resolveOrderItem(t,i){const e=Array.isArray(t?.items)?t.items:[],s=i.find((t=>this.sameId(t.product?.id,this.productId)));if(!s)return;const l=e.find((t=>this.sameId(t.product?.id,this.productId)))||{product:s.product||{id:this.productId}};return{...l,product:l.product||s.product||{id:this.productId},rating:this.toOrderItemRating(s)}}async loadOrderItem(){const t=this.resolveFetchOrderId();if(t&&null!=this.productId&&""!==this.productId){this.fetchOrderId=t,this.allowUpdate=!!salla.config.get("store.settings.rating.allow_update");try{const i=await s(t);this.productRatings=l(i?.rating),this.orderItem=this.resolveOrderItem(i,this.productRatings)}catch(t){console.error("[salla-review-order-item] failed to load order item review",t)}}}renderActions(t){const e=t.rating;return e&&this.allowUpdate?i("div",{class:"rating-actions"},i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.edit_period_ended","انتهت مدة التعديل"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",fill:"outline",color:"dark",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::edit",{type:"product",feedback_id:e.id}):void 0},i("i",{class:"sicon-format-border-color text-xl"}))),i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.delete_period_ended","انتهت مدة الحذف"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",color:"danger",fill:"outline",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::delete",{feedback_id:e.id}):void 0},i("i",{class:"sicon-trash-2 text-xl"})))):null}serializeRatingMedia(t){return JSON.stringify({images:t.images||[],videos:t.videos||[],product:t.product})}serializeProductRatings(){return JSON.stringify(this.productRatings)}render(){const t=this.orderItem,s=t?.rating;return t&&s&&this.fetchOrderId?i(e,null,i("section",{class:"flex justify-between items-start border-t mt-10 pt-8"},i("div",null,i("p",{innerHTML:s.content||""}),s.is_pending?i("span",null,this.label("pages.rating.pending","قيد المراجعة")):null,i("div",{class:"flex flex-row flex-wrap gap-2"},i("salla-rating-stars",{size:"large",value:s.stars}),i("salla-review-factors-tags",{"order-id":this.fetchOrderId,"rating-id":s.id,"product-id":t.product?.id})),i("div",{class:"mt-2"},i("salla-attachments",{rating:this.serializeRatingMedia(s),"product-ratings":this.serializeProductRatings(),"product-id":t.product?.id??null}))),this.renderActions(t))):i(e,null)}static get watchers(){return{productId:["onProductIdChange"]}}};export{a as salla_review_order_item}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,c as e,h as s,H as r,a as i}from"./p-BsIeN-bg.js";import{L as a}from"./p-BO5AoBAP.js";var o={light:[{featureType:"water",elementType:"geometry",stylers:[{color:"#e9e9e9"},{lightness:17}]},{featureType:"landscape",elementType:"geometry",stylers:[{color:"#f5f5f5"},{lightness:20}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#ffffff"},{lightness:17}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#ffffff"},{lightness:29},{weight:.2}]},{featureType:"road.arterial",elementType:"geometry",stylers:[{color:"#ffffff"},{lightness:18}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#ffffff"},{lightness:16}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#f5f5f5"},{lightness:21}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#dedede"},{lightness:21}]},{elementType:"labels.text.stroke",stylers:[{visibility:"on"},{color:"#ffffff"},{lightness:16}]},{elementType:"labels.text.fill",stylers:[{saturation:36},{color:"#333333"},{lightness:40}]},{elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#f2f2f2"},{lightness:19}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#fefefe"},{lightness:20}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#fefefe"},{lightness:17},{weight:1.2}]}],dark:[{elementType:"geometry",stylers:[{color:"#242f3e"}]},{elementType:"labels.text.fill",stylers:[{color:"#746855"}]},{elementType:"labels.text.stroke",stylers:[{color:"#242f3e"}]},{featureType:"administrative.locality",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#263c3f"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#6b9a76"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#38414e"}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#212a37"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#9ca5b3"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#746855"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#1f2835"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#f3d19c"}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#2f3948"}]},{featureType:"transit.station",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#17263c"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#515c6d"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{color:"#17263c"}]}]};class l{constructor(t=null,e={}){if(this.apiKey=t,this.options=e,"undefined"==typeof window)throw new Error("google-maps is supported only in browser environment")}load(){return void 0!==this.api?Promise.resolve(this.api):void 0!==this.loader?this.loader:(window[l.CALLBACK_NAME]=()=>{if(this.api=window.google,void 0===this.resolve)throw new Error("Should not happen");this.resolve(this.api)},window.gm_authFailure=()=>{if(void 0===this.reject)throw new Error("Should not happen");this.reject(new Error("google-maps: authentication error"))},this.loader=new Promise(((t,e)=>{this.resolve=t,this.reject=e;const s=document.createElement("script");s.src=this.createUrl(),s.async=!0,s.onerror=t=>e(t),document.head.appendChild(s)})))}createUrl(){const t=[`callback=${l.CALLBACK_NAME}`];this.apiKey&&t.push(`key=${this.apiKey}`);for(let e in this.options)if(this.options.hasOwnProperty(e)){let s=this.options[e];"version"===e&&(e="v"),"libraries"===e&&(s=s.join(",")),t.push(`${e}=${s}`)}return`https://maps.googleapis.com/maps/api/js?${t.join("&")}`}}l.CALLBACK_NAME="_dk_google_maps_loader_cb";const n=class{constructor(s){t(this,s),this.selected=e(this,"selected"),this.mapClicked=e(this,"mapClicked"),this.currentLocationChanged=e(this,"currentLocationChanged"),this.invalidInput=e(this,"invalidInput"),this.defaultLat=21.419421,this.defaultLng=39.82553,this.modalActivityTitle=salla.lang.get("pages.checkout.select_your_address_from_map"),this.confirmButtonTitle=salla.lang.get("pages.checkout.confirm_address"),this.locateButtonTitle=salla.lang.get("pages.cart.detect_location"),this.locateButtonEdit=salla.lang.get("common.elements.edit"),this.searchPlaceholder=salla.lang.get("pages.checkout.search_for_address"),this.searchInputValue=null,this.formattedAddress="",this.geolocationError=!1,this.name="location",this.required=!1,this.readonly=!1,this.searchable=!1,this.zoom=10,this.theme="light",salla.lang.onLoaded((()=>{this.modalActivityTitle=salla.lang.get("pages.checkout.select_your_address_from_map"),this.confirmButtonTitle=salla.lang.get("pages.checkout.confirm_address"),this.locateButtonTitle=salla.lang.get("pages.cart.detect_location"),this.locateButtonEdit=salla.lang.get("common.elements.edit"),this.searchPlaceholder=salla.lang.get("pages.checkout.search_for_address")})),salla.onReady((()=>{this.apiKey=salla.config.get("store.settings.keys.maps")}))}formatAddress(t){return t.length>25?t.substring(0,25)+"...":t}hasCoordinate(t){if(null==t)return!1;if("number"==typeof t)return Number.isFinite(t);const e=String(t).trim();return""!==e&&Number.isFinite(Number(e))}getLatLng(){const t=this.hasCoordinate(this.selectedLat)?this.selectedLat:this.lat,e=this.hasCoordinate(this.selectedLng)?this.selectedLng:this.lng;return this.hasCoordinate(t)&&this.hasCoordinate(e)?`${t}, ${e}`:""}syncMapInputValue(){this.mapInput&&(this.mapInput.value=this.getLatLng(),this.mapInput.setCustomValidity(""))}focusLocateControl(){const t=this.host.querySelector(".s-map-location-button");t?.focus?.()}componentWillLoad(){this.hasCoordinate(this.lat)&&this.hasCoordinate(this.lng)&&(this.selectedLat=this.lat,this.selectedLng=this.lng)}getPositionAddress(t,e=!1){(new google.maps.Geocoder).geocode({location:t},((t,s)=>{s===google.maps.GeocoderStatus.OK&&(this.searchable&&(this.searchInputValue=t[0].formatted_address,this.searchInput.value=t[0].formatted_address),e&&(this.formattedAddress=t[0].formatted_address))}))}initGoogleMaps(t,e){new l(this.apiKey,t).load().then((t=>{if(this.map=new t.maps.Map(e,{center:this.lat||this.lng?{lat:this.lat,lng:this.lng}:{lat:this.defaultLat,lng:this.defaultLng},zoom:this.zoom,zoomControl:!0,mapTypeControl:!1,scaleControl:!1,streetViewControl:!1,rotateControl:!1,fullscreenControl:!1,disableDefaultUI:!1}),this.map.setOptions({styles:"light"===this.theme?o.light:o.dark}),this.marker=new t.maps.Marker({position:this.map.getCenter(),map:this.map,icon:{url:"data:image/svg+xml;utf8,"+encodeURIComponent('<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">\n<rect width="36" height="36" rx="18" fill="#5CD5C4"/>\n<path d="M18 10C17.0104 10 16.1458 10.1771 15.4062 10.5312C14.6562 10.8854 14.026 11.3542 13.5156 11.9375C13.0156 12.5104 12.6406 13.1667 12.3906 13.9062C12.1302 14.6458 12 15.401 12 16.1719C12 16.8906 12.2604 17.7656 12.7812 18.7969C13.3021 19.8281 13.8854 20.8333 14.5312 21.8125C15.1875 22.7812 15.8073 23.6406 16.3906 24.3906C16.9844 25.1302 17.349 25.5885 17.4844 25.7656C17.5469 25.8385 17.625 25.8958 17.7188 25.9375C17.8125 25.9792 17.9062 26 18 26C18.1042 26 18.1979 25.9792 18.2812 25.9375C18.375 25.8958 18.4531 25.8385 18.5156 25.7656C18.651 25.5885 19.0156 25.1302 19.6094 24.3906C20.1927 23.6406 20.8073 22.7812 21.4531 21.8125C22.1094 20.8333 22.6979 19.8281 23.2188 18.7969C23.7396 17.7656 24 16.8906 24 16.1719C24 15.401 23.8698 14.6458 23.6094 13.9062C23.3594 13.1667 22.9792 12.5104 22.4688 11.9375C21.9688 11.3542 21.3438 10.8854 20.5938 10.5312C19.8542 10.1771 18.9896 10 18 10ZM18 24.2812C17.5833 23.75 17.1094 23.1198 16.5781 22.3906C16.0365 21.651 15.526 20.901 15.0469 20.1406C14.5677 19.3698 14.1615 18.6302 13.8281 17.9219C13.4948 17.2135 13.3281 16.6302 13.3281 16.1719C13.3281 15.5885 13.4219 15.0052 13.6094 14.4219C13.7969 13.849 14.0781 13.3333 14.4531 12.875C14.8385 12.4167 15.3281 12.0469 15.9219 11.7656C16.5052 11.474 17.1979 11.3281 18 11.3281C18.8021 11.3281 19.4948 11.474 20.0781 11.7656C20.6719 12.0469 21.1562 12.4167 21.5312 12.875C21.9167 13.3333 22.2031 13.849 22.3906 14.4219C22.5781 15.0052 22.6719 15.5885 22.6719 16.1719C22.6719 16.6302 22.5052 17.2135 22.1719 17.9219C21.8385 18.6302 21.4323 19.3698 20.9531 20.1406C20.474 20.901 19.9688 21.651 19.4375 22.3906C18.8958 23.1198 18.4167 23.75 18 24.2812ZM18 13.3281C17.2604 13.3281 16.6302 13.5885 16.1094 14.1094C15.5885 14.6302 15.3281 15.2604 15.3281 16C15.3281 16.7396 15.5885 17.3698 16.1094 17.8906C16.6302 18.4115 17.2604 18.6719 18 18.6719C18.7396 18.6719 19.3698 18.4115 19.8906 17.8906C20.4115 17.3698 20.6719 16.7396 20.6719 16C20.6719 15.2604 20.4115 14.6302 19.8906 14.1094C19.3698 13.5885 18.7396 13.3281 18 13.3281ZM18 17.3281C17.6354 17.3281 17.3229 17.1979 17.0625 16.9375C16.8021 16.6771 16.6719 16.3646 16.6719 16C16.6719 15.6354 16.8021 15.3229 17.0625 15.0625C17.3229 14.8021 17.6354 14.6719 18 14.6719C18.3646 14.6719 18.6771 14.8021 18.9375 15.0625C19.1979 15.3229 19.3281 15.6354 19.3281 16C19.3281 16.3646 19.1979 16.6771 18.9375 16.9375C18.6771 17.1979 18.3646 17.3281 18 17.3281Z" fill="white"/>\n</svg>\n'),scaledSize:new t.maps.Size(30,30)}}),this.searchable){const e=new t.maps.places.SearchBox(this.searchInput);t.maps.event.addListener(e,"places_changed",(()=>{const t=e.getPlaces();t.length>0&&this.map&&(this.map.setCenter(t[0].geometry.location),this.lat=t[0].geometry.location.lat(),this.lng=t[0].geometry.location.lng(),this.marker.setPosition(t[0].geometry.location),this.searchInputValue=t[0].formatted_address,this.formattedAddress=t[0].formatted_address)}))}t.maps.event.addListener(this.map,"click",(t=>{this.readonly||(this.marker.setPosition(t.latLng),this.lat=t.latLng.lat(),this.lng=t.latLng.lng(),this.getPositionAddress(t.latLng),this.mapClicked.emit({lat:t.latLng.lat(),lng:t.latLng.lng(),address:this.formattedAddress?this.formattedAddress:null}))})),this.lat||this.lng||(this.getCurrentLocation(),this.geolocationError&&(this.map.setCenter({lat:this.lat,lng:this.lng}),this.marker.setPosition({lat:this.lat,lng:this.lng})))}))}getCurrentLocation(){navigator.geolocation&&this.map?navigator.geolocation.getCurrentPosition((t=>{const e={center:new google.maps.LatLng(t.coords.latitude,t.coords.longitude),zoom:15};this.map.setOptions(e),this.marker.setPosition(e.center),this.getPositionAddress(e.center),this.lat=t.coords.latitude,this.lng=t.coords.longitude,this.currentLocationChanged.emit({lat:t.coords.latitude,lng:t.coords.longitude,address:this.formattedAddress?this.formattedAddress:null})}),this.handleLocationError.bind(this)):(salla.log("Geolocation is not supported by this browser."),this.geolocationError=!0)}handleLocationError(t){switch(this.geolocationError=!0,t.code){case t.PERMISSION_DENIED:salla.log("User denied the request for Geolocation.");break;case t.POSITION_UNAVAILABLE:salla.log("Location information is unavailable.");break;case t.TIMEOUT:salla.log("The request to get user location timed out.");break;case t.UNKNOWN_ERROR:salla.log("An unknown error occurred.")}}componentDidLoad(){this.syncMapInputValue(),this.hasCoordinate(this.lat)&&this.hasCoordinate(this.lng)&&fetch(`https://maps.googleapis.com/maps/api/geocode/json?latlng=${this.lat},${this.lng}&key=${this.apiKey}&language=${salla.config.get("user.language_code")||document.documentElement.lang||"ar"}`).then((t=>t.json())).then((t=>{"OK"===t.status&&(this.formattedAddress=t.results[0].formatted_address,this.searchInputValue=t.results[0].formatted_address,this.searchInput&&(this.searchInput.value=t.results[0].formatted_address),this.selectedLng=this.lng,this.selectedLat=this.lat,this.syncMapInputValue())})),this.mapInput.addEventListener("invalid",(t=>{t.preventDefault(),this.host.classList.add("s-has-error"),this.focusLocateControl(),this.invalidInput.emit(t)})),this.mapInput.addEventListener("input",(()=>{this.mapInput.setCustomValidity(""),this.host.classList.remove("s-has-error")}))}async reportValidity(){return this.syncMapInputValue(),!this.mapInput||!this.required||this.readonly||this.getLatLng()?(this.mapInput?.setCustomValidity(""),this.host.classList.remove("s-has-error"),!0):this.mapInput.reportValidity()}async open(){return this.map||this.initGoogleMaps({libraries:this.searchable?["places","search"]:[],language:salla.config.get("user.language_code")||document.documentElement.lang||"ar"},this.mapElement),await this.locationModal.open()}getLocationModal(){return s("div",null,s("div",{class:"s-map-modal-title"},this.modalTitle?this.modalTitle:this.modalActivityTitle),s("div",{class:"s-map-modal-body"},s("div",{class:"s-map-element",ref:t=>this.mapElement=t}),this.readonly?"":[this.searchable&&s("div",{class:"s-map-search-wrapper"},s("input",{class:"s-map-search-input",ref:t=>this.searchInput=t,placeholder:this.searchPlaceholder})),s("salla-button",{class:"s-map-my-location-button",onClick:()=>{this.getCurrentLocation()},shape:"icon",color:"primary"},s("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>location-target</title>\n<path d="M16 9.333c-3.676 0-6.667 2.991-6.667 6.667s2.991 6.667 6.667 6.667 6.667-2.991 6.667-6.667-2.991-6.667-6.667-6.667zM16 20c-2.205 0-4-1.795-4-4s1.795-4 4-4 4 1.795 4 4-1.795 4-4 4zM30.667 14.667h-1.401c-0.627-6.289-5.643-11.305-11.932-11.932v-1.401c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v1.401c-6.289 0.627-11.305 5.643-11.932 11.932h-1.401c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333h1.401c0.628 6.289 5.643 11.305 11.932 11.932v1.401c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-1.401c6.289-0.628 11.305-5.643 11.932-11.932h1.401c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333zM16 26.667c-5.881 0-10.667-4.785-10.667-10.667s4.785-10.667 10.667-10.667 10.667 4.785 10.667 10.667-4.785 10.667-10.667 10.667z"></path>\n</svg>\n'})),s("salla-button",{class:"s-map-submit-button",color:"primary",width:"wide",onClick:()=>{let t={lat:this.lat,lng:this.lng,address:this.formattedAddress?this.formattedAddress:null};salla.event.emit("salla-map::selected",t),this.selected.emit(t),this.selectedLat=t.lat,this.selectedLng=t.lng,this.getPositionAddress(new google.maps.LatLng(t.lat,t.lng),!0),this.syncMapInputValue(),this.host.classList.remove("s-has-error"),this.mapInput.dispatchEvent(new window.Event("change",{bubbles:!0})),this.locationModal.close()}},this.confirmButtonTitle)]))}render(){return s(r,{key:"20ed1a1d4099e817164c3764341d473c1b735add",class:"s-map-wrapper"},s("salla-modal",{key:"77309d82d11bbae677a935aef0e02588c5f9fbfa",class:"s-map-modal-wrapper",noPadding:!0,ref:t=>{this.locationModal=t}},this.getLocationModal()),s("slot",{key:"57e6d352f42a3321a98925dd4136eaf0fdbb06b0",name:"button"},s("salla-button",{key:"a0c39395b18ca41f2ea31c5c5729b2ba20c17a16",onClick:()=>{this.open()},color:"primary",class:"s-map-location-button"},s("span",{key:"b9478a06c198812edeacab794fb63699ea72fd6b",class:"s-map-location-icon",innerHTML:this.formattedAddress?'\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>edit</title>\n<path d="M30.583 1.417c-1.828-1.829-5.019-1.829-6.847 0l-13.396 13.396c-0.161 0.161-0.279 0.361-0.341 0.581l-1.949 6.911c-0.131 0.464 0 0.964 0.341 1.305 0.253 0.252 0.593 0.389 0.943 0.389 0.121 0 0.243-0.016 0.361-0.051l6.911-1.949c0.22-0.061 0.419-0.179 0.581-0.34l10.455-10.453s0 0 0 0l2.941-2.941c1.887-1.888 1.887-4.96 0-6.848zM15.547 19.528l-4.284 1.208 1.208-4.284 9.265-9.265 3.076 3.076zM28.696 6.38l-1.999 1.999-3.076-3.076 1.999-1.999c0.849-0.848 2.227-0.848 3.076 0 0.848 0.848 0.848 2.227 0 3.076zM24 20c-0.737 0-1.333 0.597-1.333 1.333v4c0 2.205-1.795 4-4 4h-12c-2.205 0-4-1.795-4-4v-12c0-2.205 1.795-4 4-4h4c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333h-4c-3.676 0-6.667 2.991-6.667 6.667v12c0 3.676 2.991 6.667 6.667 6.667h12c3.676 0 6.667-2.991 6.667-6.667v-4c0-0.736-0.596-1.333-1.333-1.333z"></path>\n</svg>\n':a}),this.formattedAddress?s("div",null,this.locateButtonEdit," | ",this.formatAddress(this.formattedAddress)):this.locateButtonTitle)),s("input",{key:"d1619a934c72218d4d00b651e95743ad8d14a7a2",class:"s-map-value-input",name:this.name,required:this.required,value:this.getLatLng(),tabIndex:-1,"aria-hidden":"true",ref:t=>this.mapInput=t}))}get host(){return i(this)}};n.style='/*!twlt*/.s-map-wrapper{position:relative}.s-map-value-input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;white-space:nowrap;border:0;opacity:0;pointer-events:none}.s-map-wrapper.s-has-error .s-map-location-button{outline:2px solid rgb(248, 113, 113);outline-offset:2px}.visible{visibility:visible}.s-has-error{--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-has-error:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.s-has-error{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-map-modal-title{position:relative;margin-top:1rem;margin-bottom:1rem;padding-left:1rem;padding-right:1rem}.s-map-location-icon{margin-right:0.5rem}.s-map-location-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem;margin-right:0px}.s-map-location-icon svg{height:1rem !important;width:1rem !important}.s-map-modal-body{position:relative;overflow:hidden}.s-map-element{height:400px;width:100%}.s-map-search-wrapper{position:absolute;top:0px;z-index:1;margin:1.25rem;width:-webkit-fill-available}.s-map-search-wrapper input{height:2.5rem;width:100%;padding:0.5rem}.s-map-search-wrapper input:where([dir="rtl"],[dir="rtl"] *){text-align:right}.s-map-search-results{margin-top:0px;display:flex;height:6rem;flex-direction:column;padding:0.5rem}.s-map-modal-body .s-loading-container{position:absolute;margin:0px;padding:5rem}.s-map-my-location-button{position:absolute;bottom:1.5rem;left:0px;margin:0.5rem}.s-map-location-button .s-button-text{display:flex;align-items:center}.s-map-submit-button button{border-top-right-radius:0px;border-top-left-radius:0px;padding-top:12px;padding-bottom:12px}';const h=class{constructor(e){t(this,e),this.height="10px";try{if(this.donation){let t="string"==typeof this.donation?JSON.parse(this.donation):this.donation;t.can_donate&&t.target_amount?(t.target_end_date="0000-00-00"==t.target_end_date?null:t.target_end_date,this.value=t.collected_amount,this.target=t.target_amount,this.header=salla.lang.get("pages.products.target"),this.message=t.target_end_date?salla.lang.get("pages.products.donation_target_date")+" "+t.target_end_date:""):this.message=t.target_amount?t.target_message:""}}catch(t){salla.log("Wrong donation json")}salla.lang.onLoaded((()=>{this.header=this.header?.replace("pages.products.target",salla.lang.get("pages.products.target")),this.message=this.message?.replace("pages.products.donation_target_date",salla.lang.get("pages.products.donation_target_date"))})),salla.onReady((()=>{this.color=this.color||salla.config.get("theme.color.primary","#ffd5c4"),this.unit||(this.unit=salla.config.currency().symbol)}))}getPercentage(){return this.value/this.target*100}render(){return this.target||this.message?s("div",{class:"s-progress-bar-container"},this.header?s("div",{class:"s-progress-bar-header"},this.header):"",this.getProgressBar(),this.message?s("span",{class:"s-progress-bar-message"},this.message):""):""}getProgressBar(){return this.target?[this.hideUnits?null:s("div",{class:"s-progress-bar-target-section"},s("span",{innerHTML:`${salla.helpers.number(this.value)} ${this.unit}`}),s("span",{innerHTML:`${salla.helpers.number(this.target)} ${this.unit}`})),s("div",{class:"s-progress-bar-wrapper",style:{height:this.height}},s("div",{class:{"s-progress-bar-progress":!0,"s-progress-bar-progress-stripped":this.stripped},style:{width:`${this.getPercentage()}%`,backgroundColor:this.color}}))]:null}};h.style="/*!twlt*/.s-progress-bar-container{margin-bottom:0.625rem}.s-progress-bar-header{margin-bottom:0.375rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-progress-bar-target-section{margin-bottom:0.625rem;display:flex;justify-content:space-between;font-size:0.875rem;line-height:1.25rem}.s-progress-bar-wrapper{margin-bottom:0.375rem;width:100%;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-progress-bar-wrapper:is(.dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.s-progress-bar-progress{height:100%;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.s-progress-bar-message{margin-bottom:0.625rem;display:block;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-progress-bar-wrapper .s-progress-bar-progress-stripped{background-image:linear-gradient(-45deg, rgba(255, 255, 255, .2) 25%, transparent 25%, transparent 50%,rgba(255, 255, 255, .2) 50%,rgba(255, 255, 255, .2) 75%, transparent 75%, transparent);background-size:30px 30px}.s-reviews-summary-progress .s-progress-bar-wrapper{margin-bottom:0px}.s-reviews-summary-progress .s-progress-bar-container{margin-bottom:0px}";export{n as salla_map,h as salla_progress_bar}
4
+ import{r as t,c as e,h as s,H as r,a as i}from"./p-Q9lz4Iuq.js";import{L as a}from"./p-BO5AoBAP.js";var o={light:[{featureType:"water",elementType:"geometry",stylers:[{color:"#e9e9e9"},{lightness:17}]},{featureType:"landscape",elementType:"geometry",stylers:[{color:"#f5f5f5"},{lightness:20}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#ffffff"},{lightness:17}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#ffffff"},{lightness:29},{weight:.2}]},{featureType:"road.arterial",elementType:"geometry",stylers:[{color:"#ffffff"},{lightness:18}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#ffffff"},{lightness:16}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#f5f5f5"},{lightness:21}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#dedede"},{lightness:21}]},{elementType:"labels.text.stroke",stylers:[{visibility:"on"},{color:"#ffffff"},{lightness:16}]},{elementType:"labels.text.fill",stylers:[{saturation:36},{color:"#333333"},{lightness:40}]},{elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#f2f2f2"},{lightness:19}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#fefefe"},{lightness:20}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#fefefe"},{lightness:17},{weight:1.2}]}],dark:[{elementType:"geometry",stylers:[{color:"#242f3e"}]},{elementType:"labels.text.fill",stylers:[{color:"#746855"}]},{elementType:"labels.text.stroke",stylers:[{color:"#242f3e"}]},{featureType:"administrative.locality",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#263c3f"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#6b9a76"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#38414e"}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#212a37"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#9ca5b3"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#746855"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#1f2835"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#f3d19c"}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#2f3948"}]},{featureType:"transit.station",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#17263c"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#515c6d"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{color:"#17263c"}]}]};class l{constructor(t=null,e={}){if(this.apiKey=t,this.options=e,"undefined"==typeof window)throw new Error("google-maps is supported only in browser environment")}load(){return void 0!==this.api?Promise.resolve(this.api):void 0!==this.loader?this.loader:(window[l.CALLBACK_NAME]=()=>{if(this.api=window.google,void 0===this.resolve)throw new Error("Should not happen");this.resolve(this.api)},window.gm_authFailure=()=>{if(void 0===this.reject)throw new Error("Should not happen");this.reject(new Error("google-maps: authentication error"))},this.loader=new Promise(((t,e)=>{this.resolve=t,this.reject=e;const s=document.createElement("script");s.src=this.createUrl(),s.async=!0,s.onerror=t=>e(t),document.head.appendChild(s)})))}createUrl(){const t=[`callback=${l.CALLBACK_NAME}`];this.apiKey&&t.push(`key=${this.apiKey}`);for(let e in this.options)if(this.options.hasOwnProperty(e)){let s=this.options[e];"version"===e&&(e="v"),"libraries"===e&&(s=s.join(",")),t.push(`${e}=${s}`)}return`https://maps.googleapis.com/maps/api/js?${t.join("&")}`}}l.CALLBACK_NAME="_dk_google_maps_loader_cb";const n=class{constructor(s){t(this,s),this.selected=e(this,"selected"),this.mapClicked=e(this,"mapClicked"),this.currentLocationChanged=e(this,"currentLocationChanged"),this.invalidInput=e(this,"invalidInput"),this.defaultLat=21.419421,this.defaultLng=39.82553,this.modalActivityTitle=salla.lang.get("pages.checkout.select_your_address_from_map"),this.confirmButtonTitle=salla.lang.get("pages.checkout.confirm_address"),this.locateButtonTitle=salla.lang.get("pages.cart.detect_location"),this.locateButtonEdit=salla.lang.get("common.elements.edit"),this.searchPlaceholder=salla.lang.get("pages.checkout.search_for_address"),this.searchInputValue=null,this.formattedAddress="",this.geolocationError=!1,this.name="location",this.required=!1,this.readonly=!1,this.searchable=!1,this.zoom=10,this.theme="light",salla.lang.onLoaded((()=>{this.modalActivityTitle=salla.lang.get("pages.checkout.select_your_address_from_map"),this.confirmButtonTitle=salla.lang.get("pages.checkout.confirm_address"),this.locateButtonTitle=salla.lang.get("pages.cart.detect_location"),this.locateButtonEdit=salla.lang.get("common.elements.edit"),this.searchPlaceholder=salla.lang.get("pages.checkout.search_for_address")})),salla.onReady((()=>{this.apiKey=salla.config.get("store.settings.keys.maps")}))}formatAddress(t){return t.length>25?t.substring(0,25)+"...":t}hasCoordinate(t){if(null==t)return!1;if("number"==typeof t)return Number.isFinite(t);const e=String(t).trim();return""!==e&&Number.isFinite(Number(e))}getLatLng(){const t=this.hasCoordinate(this.selectedLat)?this.selectedLat:this.lat,e=this.hasCoordinate(this.selectedLng)?this.selectedLng:this.lng;return this.hasCoordinate(t)&&this.hasCoordinate(e)?`${t}, ${e}`:""}syncMapInputValue(){this.mapInput&&(this.mapInput.value=this.getLatLng(),this.mapInput.setCustomValidity(""))}focusLocateControl(){const t=this.host.querySelector(".s-map-location-button");t?.focus?.()}componentWillLoad(){this.hasCoordinate(this.lat)&&this.hasCoordinate(this.lng)&&(this.selectedLat=this.lat,this.selectedLng=this.lng)}getPositionAddress(t,e=!1){(new google.maps.Geocoder).geocode({location:t},((t,s)=>{s===google.maps.GeocoderStatus.OK&&(this.searchable&&(this.searchInputValue=t[0].formatted_address,this.searchInput.value=t[0].formatted_address),e&&(this.formattedAddress=t[0].formatted_address))}))}initGoogleMaps(t,e){new l(this.apiKey,t).load().then((t=>{if(this.map=new t.maps.Map(e,{center:this.lat||this.lng?{lat:this.lat,lng:this.lng}:{lat:this.defaultLat,lng:this.defaultLng},zoom:this.zoom,zoomControl:!0,mapTypeControl:!1,scaleControl:!1,streetViewControl:!1,rotateControl:!1,fullscreenControl:!1,disableDefaultUI:!1}),this.map.setOptions({styles:"light"===this.theme?o.light:o.dark}),this.marker=new t.maps.Marker({position:this.map.getCenter(),map:this.map,icon:{url:"data:image/svg+xml;utf8,"+encodeURIComponent('<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">\n<rect width="36" height="36" rx="18" fill="#5CD5C4"/>\n<path d="M18 10C17.0104 10 16.1458 10.1771 15.4062 10.5312C14.6562 10.8854 14.026 11.3542 13.5156 11.9375C13.0156 12.5104 12.6406 13.1667 12.3906 13.9062C12.1302 14.6458 12 15.401 12 16.1719C12 16.8906 12.2604 17.7656 12.7812 18.7969C13.3021 19.8281 13.8854 20.8333 14.5312 21.8125C15.1875 22.7812 15.8073 23.6406 16.3906 24.3906C16.9844 25.1302 17.349 25.5885 17.4844 25.7656C17.5469 25.8385 17.625 25.8958 17.7188 25.9375C17.8125 25.9792 17.9062 26 18 26C18.1042 26 18.1979 25.9792 18.2812 25.9375C18.375 25.8958 18.4531 25.8385 18.5156 25.7656C18.651 25.5885 19.0156 25.1302 19.6094 24.3906C20.1927 23.6406 20.8073 22.7812 21.4531 21.8125C22.1094 20.8333 22.6979 19.8281 23.2188 18.7969C23.7396 17.7656 24 16.8906 24 16.1719C24 15.401 23.8698 14.6458 23.6094 13.9062C23.3594 13.1667 22.9792 12.5104 22.4688 11.9375C21.9688 11.3542 21.3438 10.8854 20.5938 10.5312C19.8542 10.1771 18.9896 10 18 10ZM18 24.2812C17.5833 23.75 17.1094 23.1198 16.5781 22.3906C16.0365 21.651 15.526 20.901 15.0469 20.1406C14.5677 19.3698 14.1615 18.6302 13.8281 17.9219C13.4948 17.2135 13.3281 16.6302 13.3281 16.1719C13.3281 15.5885 13.4219 15.0052 13.6094 14.4219C13.7969 13.849 14.0781 13.3333 14.4531 12.875C14.8385 12.4167 15.3281 12.0469 15.9219 11.7656C16.5052 11.474 17.1979 11.3281 18 11.3281C18.8021 11.3281 19.4948 11.474 20.0781 11.7656C20.6719 12.0469 21.1562 12.4167 21.5312 12.875C21.9167 13.3333 22.2031 13.849 22.3906 14.4219C22.5781 15.0052 22.6719 15.5885 22.6719 16.1719C22.6719 16.6302 22.5052 17.2135 22.1719 17.9219C21.8385 18.6302 21.4323 19.3698 20.9531 20.1406C20.474 20.901 19.9688 21.651 19.4375 22.3906C18.8958 23.1198 18.4167 23.75 18 24.2812ZM18 13.3281C17.2604 13.3281 16.6302 13.5885 16.1094 14.1094C15.5885 14.6302 15.3281 15.2604 15.3281 16C15.3281 16.7396 15.5885 17.3698 16.1094 17.8906C16.6302 18.4115 17.2604 18.6719 18 18.6719C18.7396 18.6719 19.3698 18.4115 19.8906 17.8906C20.4115 17.3698 20.6719 16.7396 20.6719 16C20.6719 15.2604 20.4115 14.6302 19.8906 14.1094C19.3698 13.5885 18.7396 13.3281 18 13.3281ZM18 17.3281C17.6354 17.3281 17.3229 17.1979 17.0625 16.9375C16.8021 16.6771 16.6719 16.3646 16.6719 16C16.6719 15.6354 16.8021 15.3229 17.0625 15.0625C17.3229 14.8021 17.6354 14.6719 18 14.6719C18.3646 14.6719 18.6771 14.8021 18.9375 15.0625C19.1979 15.3229 19.3281 15.6354 19.3281 16C19.3281 16.3646 19.1979 16.6771 18.9375 16.9375C18.6771 17.1979 18.3646 17.3281 18 17.3281Z" fill="white"/>\n</svg>\n'),scaledSize:new t.maps.Size(30,30)}}),this.searchable){const e=new t.maps.places.SearchBox(this.searchInput);t.maps.event.addListener(e,"places_changed",(()=>{const t=e.getPlaces();t.length>0&&this.map&&(this.map.setCenter(t[0].geometry.location),this.lat=t[0].geometry.location.lat(),this.lng=t[0].geometry.location.lng(),this.marker.setPosition(t[0].geometry.location),this.searchInputValue=t[0].formatted_address,this.formattedAddress=t[0].formatted_address)}))}t.maps.event.addListener(this.map,"click",(t=>{this.readonly||(this.marker.setPosition(t.latLng),this.lat=t.latLng.lat(),this.lng=t.latLng.lng(),this.getPositionAddress(t.latLng),this.mapClicked.emit({lat:t.latLng.lat(),lng:t.latLng.lng(),address:this.formattedAddress?this.formattedAddress:null}))})),this.lat||this.lng||(this.getCurrentLocation(),this.geolocationError&&(this.map.setCenter({lat:this.lat,lng:this.lng}),this.marker.setPosition({lat:this.lat,lng:this.lng})))}))}getCurrentLocation(){navigator.geolocation&&this.map?navigator.geolocation.getCurrentPosition((t=>{const e={center:new google.maps.LatLng(t.coords.latitude,t.coords.longitude),zoom:15};this.map.setOptions(e),this.marker.setPosition(e.center),this.getPositionAddress(e.center),this.lat=t.coords.latitude,this.lng=t.coords.longitude,this.currentLocationChanged.emit({lat:t.coords.latitude,lng:t.coords.longitude,address:this.formattedAddress?this.formattedAddress:null})}),this.handleLocationError.bind(this)):(salla.log("Geolocation is not supported by this browser."),this.geolocationError=!0)}handleLocationError(t){switch(this.geolocationError=!0,t.code){case t.PERMISSION_DENIED:salla.log("User denied the request for Geolocation.");break;case t.POSITION_UNAVAILABLE:salla.log("Location information is unavailable.");break;case t.TIMEOUT:salla.log("The request to get user location timed out.");break;case t.UNKNOWN_ERROR:salla.log("An unknown error occurred.")}}componentDidLoad(){this.syncMapInputValue(),this.hasCoordinate(this.lat)&&this.hasCoordinate(this.lng)&&fetch(`https://maps.googleapis.com/maps/api/geocode/json?latlng=${this.lat},${this.lng}&key=${this.apiKey}&language=${salla.config.get("user.language_code")||document.documentElement.lang||"ar"}`).then((t=>t.json())).then((t=>{"OK"===t.status&&(this.formattedAddress=t.results[0].formatted_address,this.searchInputValue=t.results[0].formatted_address,this.searchInput&&(this.searchInput.value=t.results[0].formatted_address),this.selectedLng=this.lng,this.selectedLat=this.lat,this.syncMapInputValue())})),this.mapInput.addEventListener("invalid",(t=>{t.preventDefault(),this.host.classList.add("s-has-error"),this.focusLocateControl(),this.invalidInput.emit(t)})),this.mapInput.addEventListener("input",(()=>{this.mapInput.setCustomValidity(""),this.host.classList.remove("s-has-error")}))}async reportValidity(){return this.syncMapInputValue(),!this.mapInput||!this.required||this.readonly||this.getLatLng()?(this.mapInput?.setCustomValidity(""),this.host.classList.remove("s-has-error"),!0):this.mapInput.reportValidity()}async open(){return this.map||this.initGoogleMaps({libraries:this.searchable?["places","search"]:[],language:salla.config.get("user.language_code")||document.documentElement.lang||"ar"},this.mapElement),await this.locationModal.open()}getLocationModal(){return s("div",null,s("div",{class:"s-map-modal-title"},this.modalTitle?this.modalTitle:this.modalActivityTitle),s("div",{class:"s-map-modal-body"},s("div",{class:"s-map-element",ref:t=>this.mapElement=t}),this.readonly?"":[this.searchable&&s("div",{class:"s-map-search-wrapper"},s("input",{class:"s-map-search-input",ref:t=>this.searchInput=t,placeholder:this.searchPlaceholder})),s("salla-button",{class:"s-map-my-location-button",onClick:()=>{this.getCurrentLocation()},shape:"icon",color:"primary"},s("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>location-target</title>\n<path d="M16 9.333c-3.676 0-6.667 2.991-6.667 6.667s2.991 6.667 6.667 6.667 6.667-2.991 6.667-6.667-2.991-6.667-6.667-6.667zM16 20c-2.205 0-4-1.795-4-4s1.795-4 4-4 4 1.795 4 4-1.795 4-4 4zM30.667 14.667h-1.401c-0.627-6.289-5.643-11.305-11.932-11.932v-1.401c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v1.401c-6.289 0.627-11.305 5.643-11.932 11.932h-1.401c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333h1.401c0.628 6.289 5.643 11.305 11.932 11.932v1.401c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-1.401c6.289-0.628 11.305-5.643 11.932-11.932h1.401c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333zM16 26.667c-5.881 0-10.667-4.785-10.667-10.667s4.785-10.667 10.667-10.667 10.667 4.785 10.667 10.667-4.785 10.667-10.667 10.667z"></path>\n</svg>\n'})),s("salla-button",{class:"s-map-submit-button",color:"primary",width:"wide",onClick:()=>{let t={lat:this.lat,lng:this.lng,address:this.formattedAddress?this.formattedAddress:null};salla.event.emit("salla-map::selected",t),this.selected.emit(t),this.selectedLat=t.lat,this.selectedLng=t.lng,this.getPositionAddress(new google.maps.LatLng(t.lat,t.lng),!0),this.syncMapInputValue(),this.host.classList.remove("s-has-error"),this.mapInput.dispatchEvent(new window.Event("change",{bubbles:!0})),this.locationModal.close()}},this.confirmButtonTitle)]))}render(){return s(r,{key:"20ed1a1d4099e817164c3764341d473c1b735add",class:"s-map-wrapper"},s("salla-modal",{key:"77309d82d11bbae677a935aef0e02588c5f9fbfa",class:"s-map-modal-wrapper",noPadding:!0,ref:t=>{this.locationModal=t}},this.getLocationModal()),s("slot",{key:"57e6d352f42a3321a98925dd4136eaf0fdbb06b0",name:"button"},s("salla-button",{key:"a0c39395b18ca41f2ea31c5c5729b2ba20c17a16",onClick:()=>{this.open()},color:"primary",class:"s-map-location-button"},s("span",{key:"b9478a06c198812edeacab794fb63699ea72fd6b",class:"s-map-location-icon",innerHTML:this.formattedAddress?'\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>edit</title>\n<path d="M30.583 1.417c-1.828-1.829-5.019-1.829-6.847 0l-13.396 13.396c-0.161 0.161-0.279 0.361-0.341 0.581l-1.949 6.911c-0.131 0.464 0 0.964 0.341 1.305 0.253 0.252 0.593 0.389 0.943 0.389 0.121 0 0.243-0.016 0.361-0.051l6.911-1.949c0.22-0.061 0.419-0.179 0.581-0.34l10.455-10.453s0 0 0 0l2.941-2.941c1.887-1.888 1.887-4.96 0-6.848zM15.547 19.528l-4.284 1.208 1.208-4.284 9.265-9.265 3.076 3.076zM28.696 6.38l-1.999 1.999-3.076-3.076 1.999-1.999c0.849-0.848 2.227-0.848 3.076 0 0.848 0.848 0.848 2.227 0 3.076zM24 20c-0.737 0-1.333 0.597-1.333 1.333v4c0 2.205-1.795 4-4 4h-12c-2.205 0-4-1.795-4-4v-12c0-2.205 1.795-4 4-4h4c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333h-4c-3.676 0-6.667 2.991-6.667 6.667v12c0 3.676 2.991 6.667 6.667 6.667h12c3.676 0 6.667-2.991 6.667-6.667v-4c0-0.736-0.596-1.333-1.333-1.333z"></path>\n</svg>\n':a}),this.formattedAddress?s("div",null,this.locateButtonEdit," | ",this.formatAddress(this.formattedAddress)):this.locateButtonTitle)),s("input",{key:"d1619a934c72218d4d00b651e95743ad8d14a7a2",class:"s-map-value-input",name:this.name,required:this.required,value:this.getLatLng(),tabIndex:-1,"aria-hidden":"true",ref:t=>this.mapInput=t}))}get host(){return i(this)}};n.style='/*!twlt*/.s-map-wrapper{position:relative}.s-map-value-input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;white-space:nowrap;border:0;opacity:0;pointer-events:none}.s-map-wrapper.s-has-error .s-map-location-button{outline:2px solid rgb(248, 113, 113);outline-offset:2px}.visible{visibility:visible}.s-has-error{--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-has-error:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.s-has-error{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-map-modal-title{position:relative;margin-top:1rem;margin-bottom:1rem;padding-left:1rem;padding-right:1rem}.s-map-location-icon{margin-right:0.5rem}.s-map-location-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem;margin-right:0px}.s-map-location-icon svg{height:1rem !important;width:1rem !important}.s-map-modal-body{position:relative;overflow:hidden}.s-map-element{height:400px;width:100%}.s-map-search-wrapper{position:absolute;top:0px;z-index:1;margin:1.25rem;width:-webkit-fill-available}.s-map-search-wrapper input{height:2.5rem;width:100%;padding:0.5rem}.s-map-search-wrapper input:where([dir="rtl"],[dir="rtl"] *){text-align:right}.s-map-search-results{margin-top:0px;display:flex;height:6rem;flex-direction:column;padding:0.5rem}.s-map-modal-body .s-loading-container{position:absolute;margin:0px;padding:5rem}.s-map-my-location-button{position:absolute;bottom:1.5rem;left:0px;margin:0.5rem}.s-map-location-button .s-button-text{display:flex;align-items:center}.s-map-submit-button button{border-top-right-radius:0px;border-top-left-radius:0px;padding-top:12px;padding-bottom:12px}';const h=class{constructor(e){t(this,e),this.height="10px";try{if(this.donation){let t="string"==typeof this.donation?JSON.parse(this.donation):this.donation;t.can_donate&&t.target_amount?(t.target_end_date="0000-00-00"==t.target_end_date?null:t.target_end_date,this.value=t.collected_amount,this.target=t.target_amount,this.header=salla.lang.get("pages.products.target"),this.message=t.target_end_date?salla.lang.get("pages.products.donation_target_date")+" "+t.target_end_date:""):this.message=t.target_amount?t.target_message:""}}catch(t){salla.log("Wrong donation json")}salla.lang.onLoaded((()=>{this.header=this.header?.replace("pages.products.target",salla.lang.get("pages.products.target")),this.message=this.message?.replace("pages.products.donation_target_date",salla.lang.get("pages.products.donation_target_date"))})),salla.onReady((()=>{this.color=this.color||salla.config.get("theme.color.primary","#ffd5c4"),this.unit||(this.unit=salla.config.currency().symbol)}))}getPercentage(){return this.value/this.target*100}render(){return this.target||this.message?s("div",{class:"s-progress-bar-container"},this.header?s("div",{class:"s-progress-bar-header"},this.header):"",this.getProgressBar(),this.message?s("span",{class:"s-progress-bar-message"},this.message):""):""}getProgressBar(){return this.target?[this.hideUnits?null:s("div",{class:"s-progress-bar-target-section"},s("span",{innerHTML:`${salla.helpers.number(this.value)} ${this.unit}`}),s("span",{innerHTML:`${salla.helpers.number(this.target)} ${this.unit}`})),s("div",{class:"s-progress-bar-wrapper",style:{height:this.height}},s("div",{class:{"s-progress-bar-progress":!0,"s-progress-bar-progress-stripped":this.stripped},style:{width:`${this.getPercentage()}%`,backgroundColor:this.color}}))]:null}};h.style="/*!twlt*/.s-progress-bar-container{margin-bottom:0.625rem}.s-progress-bar-header{margin-bottom:0.375rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-progress-bar-target-section{margin-bottom:0.625rem;display:flex;justify-content:space-between;font-size:0.875rem;line-height:1.25rem}.s-progress-bar-wrapper{margin-bottom:0.375rem;width:100%;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-progress-bar-wrapper:is(.dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.s-progress-bar-progress{height:100%;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.s-progress-bar-message{margin-bottom:0.625rem;display:block;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-progress-bar-wrapper .s-progress-bar-progress-stripped{background-image:linear-gradient(-45deg, rgba(255, 255, 255, .2) 25%, transparent 25%, transparent 50%,rgba(255, 255, 255, .2) 50%,rgba(255, 255, 255, .2) 75%, transparent 75%, transparent);background-size:30px 30px}.s-reviews-summary-progress .s-progress-bar-wrapper{margin-bottom:0px}.s-reviews-summary-progress .s-progress-bar-container{margin-bottom:0px}";export{n as salla_map,h as salla_progress_bar}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as e,F as i}from"./p-BsIeN-bg.js";const r=class{constructor(e){t(this,e),this.source="header",this.useReactLink=!1,this.menus=[],this.displayAllText=""}async componentWillLoad(){return salla.onReady((()=>{if(this.displayAllText=salla.lang.get("blocks.home.display_all"),!this.sourceValue||"json"!==this.source)return this.getMenuItems();this.menus="string"==typeof this.sourceValue?JSON.parse(this.sourceValue):this.sourceValue||[]}))}getMenuItems(){return salla.api.component.getMenus(this.source).then((async({data:t})=>{this.menus=t,await salla.hooks.call("salla-menu","afterFetchMenuItems",this)})).catch((t=>{salla.logger.error("salla-menu::Error fetching menus",t)}))}hasChildren(t){return t?.children?.length>0}hasProducts(t){return t?.products?.length>0}getDesktopClasses(t,e){return`!hidden lg:!block ${e?"root-level lg:!inline-block":"relative"} ${t.products?" mega-menu":""}\n ${this.hasChildren(t)?"has-children":""}`}getAttributes(t){return t.trim().split(" ").reduce(((t,e)=>{let[i,r]=e.split("=");return t[i]=r.replace(/"/g,""),t}),{})}getMobileMenu(t,r){const l=t.image?e("img",{src:t.image,class:"rounded-full",width:"48",height:"48",alt:t.title}):null;return e("li",{class:"lg:hidden text-sm font-bold",...this.getAttributes(t.attrs)},this.hasChildren(t)?e(i,null,e("span",{class:t.image?"!py-3":""},l,t.title),e("ul",null,e("li",{class:"text-sm font-bold"},e("a",{href:t.url,class:"text-gray-500"},r)),t.children.map((t=>this.getMobileMenu(t,r))))):e("a",{href:t.url,"aria-label":t.title||"category",class:"text-gray-500 "+(t.image?"!py-3":""),...this.getAttributes(t.link_attrs)},l,e("span",null,t.title||"")))}getDesktopMenu(t,i){return e("li",{class:this.getDesktopClasses(t,i),...this.getAttributes(t.attrs)},e("a",{href:t.url,"aria-label":t.title||"category",...this.getAttributes(t.link_attrs)},e("span",null,t.title)),this.hasChildren(t)?e("div",{class:"sub-menu shadow-default "+(this.hasProducts(t)?"w-full left-0 flex":"w-56")},e("ul",{class:this.hasProducts(t)?"w-56 shrink-0 m-8 rtl:ml-0 ltr:mr-0":""},t.children.map((t=>this.getDesktopMenu(t,!1)))),this.hasProducts(t)?e("salla-products-list",{source:"selected","shadow-on-hover":!0,"source-value":`[${t.products}]`}):null):null)}getFooterMenu(t){const i=this.topnav||this.limit?t.slice(0,this.limit||3):t;return e("div",null,e("div",{class:{"s-menu-footer-list":!this.topnav,"s-menu-topnav-list":this.topnav}},i.map((t=>e("a",{key:t.id,href:t.url,target:t.target,class:{"s-menu-footer-item":!this.topnav,"s-menu-topnav-item topnav-link-item right-side":this.topnav},...t.callback?{onClick:t.callback}:{}},t.title)))))}getHeaderMenu(t){return t.map((t=>[this.getMobileMenu(t,this.displayAllText),this.getDesktopMenu(t,!0)]))}render(){return"footer"===this.source?this.getFooterMenu(this.menus):[e("nav",{key:"main-nav",id:"mobile-menu",class:"mobile-menu"},e("ul",{class:"main-menu"},this.getHeaderMenu(this.menus)),e("button",{class:"btn--close close-mobile-menu sicon-cancel lg:hidden"})),e("button",{key:"close-btn",class:"btn--close-sm close-mobile-menu sicon-cancel hidden"})]}};r.style='/*!twlt*/:host{display:block}.relative{position:relative}.left-0{left:0px}.m-8{margin:2rem}.flex{display:flex}.\\!hidden{display:none !important}.hidden{display:none}.w-56{width:14rem}.w-full{width:100%}.shrink-0{flex-shrink:0}.rounded-full{border-radius:9999px}.\\!py-3{padding-top:0.75rem !important;padding-bottom:0.75rem !important}.text-sm{font-size:0.875rem;line-height:1.25rem}.font-bold{font-weight:700}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.shadow-default{--tw-shadow:5px 10px 30px #2B2D340D;--tw-shadow-colored:5px 10px 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-menu-item{display:none !important}@media (min-width: 1024px){.s-menu-item{display:block !important}.s-menu-root-level{display:inline-block !important}}.s-menu-non-root-level{position:relative}.s-menu-products-wrapper{flex-grow:1;padding:2rem}.s-menu-products-container{display:grid;grid-template-columns:repeat(4, minmax(0, 1fr));gap:1rem}.s-menu-submenu-unordered-list{margin:2rem;width:14rem;flex-shrink:0}.s-menu-submenu-unordered-list:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}.s-menu-submenu-unordered-list:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}.s-menu-submenu-with-product{left:0px;display:flex;width:100%}.s-menu-submenu-without-product{width:14rem}.s-menu-footer-item{margin-bottom:1.25rem;display:block;font-size:0.875rem;line-height:1.25rem;line-height:1}.s-menu-footer-item:last-child{margin-bottom:0px}.s-menu-topnav-list{display:none;align-items:center;white-space:nowrap}@media (min-width: 1024px){.s-menu-topnav-list{display:flex}}.s-menu-topnav-list:where([dir="ltr"],[dir="ltr"] *){padding-right:1rem}.s-menu-topnav-list:where([dir="rtl"],[dir="rtl"] *){padding-left:1rem}.s-menu-topnav-item{display:inline-block;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-left:1rem;padding-right:1rem;padding-top:1px;padding-bottom:1px;font-size:0.875rem;line-height:1.25rem;line-height:1;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-menu-topnav-item:hover{opacity:0.8}.s-menu-topnav-item:where([dir="ltr"],[dir="ltr"] *){border-right-width:1px}.s-menu-topnav-item:first-child:where([dir="ltr"],[dir="ltr"] *){padding-left:0px}.s-menu-topnav-item:last-child:where([dir="ltr"],[dir="ltr"] *){border-width:0px;padding-right:0px}.s-menu-topnav-item:where([dir="rtl"],[dir="rtl"] *){border-left-width:1px}.s-menu-topnav-item:first-child:where([dir="rtl"],[dir="rtl"] *){padding-right:0px}.s-menu-topnav-item:last-child:where([dir="rtl"],[dir="rtl"] *){border-width:0px;padding-left:0px}@media (min-width: 1024px){.lg\\:\\!block{display:block !important}.lg\\:\\!inline-block{display:inline-block !important}.lg\\:hidden{display:none}}.ltr\\:mr-0:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}.rtl\\:ml-0:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}';export{r as salla_menu}
4
+ import{r as t,h as e,F as i}from"./p-Q9lz4Iuq.js";const r=class{constructor(e){t(this,e),this.source="header",this.useReactLink=!1,this.menus=[],this.displayAllText=""}async componentWillLoad(){return salla.onReady((()=>{if(this.displayAllText=salla.lang.get("blocks.home.display_all"),!this.sourceValue||"json"!==this.source)return this.getMenuItems();this.menus="string"==typeof this.sourceValue?JSON.parse(this.sourceValue):this.sourceValue||[]}))}getMenuItems(){return salla.api.component.getMenus(this.source).then((async({data:t})=>{this.menus=t,await salla.hooks.call("salla-menu","afterFetchMenuItems",this)})).catch((t=>{salla.logger.error("salla-menu::Error fetching menus",t)}))}hasChildren(t){return t?.children?.length>0}hasProducts(t){return t?.products?.length>0}getDesktopClasses(t,e){return`!hidden lg:!block ${e?"root-level lg:!inline-block":"relative"} ${t.products?" mega-menu":""}\n ${this.hasChildren(t)?"has-children":""}`}getAttributes(t){return t.trim().split(" ").reduce(((t,e)=>{let[i,r]=e.split("=");return t[i]=r.replace(/"/g,""),t}),{})}getMobileMenu(t,r){const l=t.image?e("img",{src:t.image,class:"rounded-full",width:"48",height:"48",alt:t.title}):null;return e("li",{class:"lg:hidden text-sm font-bold",...this.getAttributes(t.attrs)},this.hasChildren(t)?e(i,null,e("span",{class:t.image?"!py-3":""},l,t.title),e("ul",null,e("li",{class:"text-sm font-bold"},e("a",{href:t.url,class:"text-gray-500"},r)),t.children.map((t=>this.getMobileMenu(t,r))))):e("a",{href:t.url,"aria-label":t.title||"category",class:"text-gray-500 "+(t.image?"!py-3":""),...this.getAttributes(t.link_attrs)},l,e("span",null,t.title||"")))}getDesktopMenu(t,i){return e("li",{class:this.getDesktopClasses(t,i),...this.getAttributes(t.attrs)},e("a",{href:t.url,"aria-label":t.title||"category",...this.getAttributes(t.link_attrs)},e("span",null,t.title)),this.hasChildren(t)?e("div",{class:"sub-menu shadow-default "+(this.hasProducts(t)?"w-full left-0 flex":"w-56")},e("ul",{class:this.hasProducts(t)?"w-56 shrink-0 m-8 rtl:ml-0 ltr:mr-0":""},t.children.map((t=>this.getDesktopMenu(t,!1)))),this.hasProducts(t)?e("salla-products-list",{source:"selected","shadow-on-hover":!0,"source-value":`[${t.products}]`}):null):null)}getFooterMenu(t){const i=this.topnav||this.limit?t.slice(0,this.limit||3):t;return e("div",null,e("div",{class:{"s-menu-footer-list":!this.topnav,"s-menu-topnav-list":this.topnav}},i.map((t=>e("a",{key:t.id,href:t.url,target:t.target,class:{"s-menu-footer-item":!this.topnav,"s-menu-topnav-item topnav-link-item right-side":this.topnav},...t.callback?{onClick:t.callback}:{}},t.title)))))}getHeaderMenu(t){return t.map((t=>[this.getMobileMenu(t,this.displayAllText),this.getDesktopMenu(t,!0)]))}render(){return"footer"===this.source?this.getFooterMenu(this.menus):[e("nav",{key:"main-nav",id:"mobile-menu",class:"mobile-menu"},e("ul",{class:"main-menu"},this.getHeaderMenu(this.menus)),e("button",{class:"btn--close close-mobile-menu sicon-cancel lg:hidden"})),e("button",{key:"close-btn",class:"btn--close-sm close-mobile-menu sicon-cancel hidden"})]}};r.style='/*!twlt*/:host{display:block}.relative{position:relative}.left-0{left:0px}.m-8{margin:2rem}.flex{display:flex}.\\!hidden{display:none !important}.hidden{display:none}.w-56{width:14rem}.w-full{width:100%}.shrink-0{flex-shrink:0}.rounded-full{border-radius:9999px}.\\!py-3{padding-top:0.75rem !important;padding-bottom:0.75rem !important}.text-sm{font-size:0.875rem;line-height:1.25rem}.font-bold{font-weight:700}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.shadow-default{--tw-shadow:5px 10px 30px #2B2D340D;--tw-shadow-colored:5px 10px 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-menu-item{display:none !important}@media (min-width: 1024px){.s-menu-item{display:block !important}.s-menu-root-level{display:inline-block !important}}.s-menu-non-root-level{position:relative}.s-menu-products-wrapper{flex-grow:1;padding:2rem}.s-menu-products-container{display:grid;grid-template-columns:repeat(4, minmax(0, 1fr));gap:1rem}.s-menu-submenu-unordered-list{margin:2rem;width:14rem;flex-shrink:0}.s-menu-submenu-unordered-list:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}.s-menu-submenu-unordered-list:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}.s-menu-submenu-with-product{left:0px;display:flex;width:100%}.s-menu-submenu-without-product{width:14rem}.s-menu-footer-item{margin-bottom:1.25rem;display:block;font-size:0.875rem;line-height:1.25rem;line-height:1}.s-menu-footer-item:last-child{margin-bottom:0px}.s-menu-topnav-list{display:none;align-items:center;white-space:nowrap}@media (min-width: 1024px){.s-menu-topnav-list{display:flex}}.s-menu-topnav-list:where([dir="ltr"],[dir="ltr"] *){padding-right:1rem}.s-menu-topnav-list:where([dir="rtl"],[dir="rtl"] *){padding-left:1rem}.s-menu-topnav-item{display:inline-block;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-left:1rem;padding-right:1rem;padding-top:1px;padding-bottom:1px;font-size:0.875rem;line-height:1.25rem;line-height:1;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-menu-topnav-item:hover{opacity:0.8}.s-menu-topnav-item:where([dir="ltr"],[dir="ltr"] *){border-right-width:1px}.s-menu-topnav-item:first-child:where([dir="ltr"],[dir="ltr"] *){padding-left:0px}.s-menu-topnav-item:last-child:where([dir="ltr"],[dir="ltr"] *){border-width:0px;padding-right:0px}.s-menu-topnav-item:where([dir="rtl"],[dir="rtl"] *){border-left-width:1px}.s-menu-topnav-item:first-child:where([dir="rtl"],[dir="rtl"] *){padding-right:0px}.s-menu-topnav-item:last-child:where([dir="rtl"],[dir="rtl"] *){border-width:0px;padding-left:0px}@media (min-width: 1024px){.lg\\:\\!block{display:block !important}.lg\\:\\!inline-block{display:inline-block !important}.lg\\:hidden{display:none}}.ltr\\:mr-0:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}.rtl\\:ml-0:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}';export{r as salla_menu}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as e,H as a}from"./p-BsIeN-bg.js";const l=class{constructor(e){t(this,e),this.transactionsArray=[],this.isLoading=!1,this.nextPageUrl="",this.handleClick=()=>{this.loadMoreTransactions()}}componentWillLoad(){return salla.onReady().then((()=>this.loadTransactions()))}normalizeTransactions(t){if(Array.isArray(t))return{list:t,nextPageUrl:""};const e=t?.current_page??1,a=e<(t?.last_page??e)?`/balance/wallet?per_page=${t?.per_page??10}&page=${e+1}`:"";return{list:t?.data??[],nextPageUrl:a}}async loadTransactions(){this.isLoading=!0;try{let t="/balance/wallet?per_page=10&page=1",e=await salla.api.request(t);const{list:a,nextPageUrl:l}=this.normalizeTransactions(e.data.transactions);this.nextPageUrl=l,this.transactionsArray=a,this.balance=e.data.balance}catch(t){console.error("Error loading wallet transactions",t)}finally{this.isLoading=!1}}async loadMoreTransactions(){this.isLoading=!0;try{let t=this.nextPageUrl||"/balance/wallet?page=2&per_page=10",e=await salla.api.request(t);const{list:a,nextPageUrl:l}=this.normalizeTransactions(e.data.transactions);this.nextPageUrl=l,this.transactionsArray=[...this.transactionsArray,...a],this.balance=e.data.balance}catch(t){console.error("Error loading wallet transactions",t)}finally{this.isLoading=!1}}render(){return this.transactionsArray.length>0?e(a,null,e("table",{class:"s-wallet-table"},e("tbody",{class:"s-wallet-table-tbody"},e("tr",{class:"s-table__tr"},e("td",null,e("div",{class:"s-wallet-table-balance-container"},e("i",{class:"s-wallet-table-balance-icon sicon-wallet"}),e("div",null,e("div",{innerHTML:salla.money(this.balance)}),e("div",{class:"font-normal text-gray-400"}," ",salla.lang.get("pages.wallet.balance")))))))),e("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),e("table",{class:"s-wallet-table"},e("thead",{class:"s-wallet-table-head"},e("tr",{class:"s-wallet-table-head-tr"},e("th",{scope:"col"},salla.lang.get("pages.wallet.transaction_number")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.amount")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.date")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.order_no")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.transaction_type")," "))),e("tbody",{class:"s-wallet-table-tbody"},this.transactionsArray.map((t=>e("tr",{class:"s-wallet-table-tbody-tr s-wallet-table-tbody-tr-shadow animated"},e("td",{class:"s-wallet-table-tbody-tr-td"},e("div",{class:"s-wallet-table-tbody-tr-td-content"},e("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_number"),":"),t.id&&e("span",{class:"hidden md:inline-block"},"#",t.id),e("div",{class:"flex items-center md:hidden"},e("salla-button",{class:"relative",color:"dark",shape:"link","data-content":t.order_id},t.order_id&&e("span",null,"#",t.order_id))))),e("td",{id:"main123",class:"s-wallet-table-tbody-tr-td"},e("div",{id:"main124",class:"s-wallet-table-tbody-tr-td-content"},e("span",{id:"main125",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.amount"),":"),e("div",{innerHTML:salla.money(t.amount)}))),e("td",{class:"s-wallet-table-tbody-tr-td"},e("div",{class:"s-wallet-table-tbody-tr-td-content"},e("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.date"),":"),t.created_at&&new Date(1e3*t.created_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}))),e("td",{id:"main133",class:"s-wallet-table-tbody-tr-td"},e("div",{id:"main134",class:"s-wallet-table-tbody-tr-td-content"},e("span",{id:"main135",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.order_no"),":"),e("span",{class:"rtl:mr-auto ltr:ml-auto md:mx-0"},t.order_id&&e("span",null,"#",t.order_id)))),e("td",{id:"main143",class:"s-wallet-table-tbody-tr-td"},e("div",{id:"main144",class:"s-wallet-table-tbody-tr-td-content"},e("span",{id:"main145",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.expiry_date"),":"),e("span",null,t.expired_at&&new Date(1e3*t.expired_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"})))),e("td",{class:"s-wallet-table-tbody-tr-td"},e("div",{class:"s-wallet-table-tbody-tr-td-content"},e("div",null,e("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_type"),":")),e("div",{class:{"s-wallet-table-transaction-status-default":!0,"s-wallet-table-transaction-status-cashback":"cashback"===t.action_type,"s-wallet-table-transaction-status-refund":"refund"===t.action_type,"s-wallet-table-transaction-status-purchase":"purchase_by_wallet"===t.action_type}},!!t.description&&e("i",{id:t.id.toString(),class:"sicon-information text-lg rtl:ml-4 ltr:mr-4 s-wallet-table-transaction-status-icon-success"}),!!t.description&&e("salla-tooltip",{text:t.description,targetId:t.id.toString()}),e("span",null,t.title))))))))),e("div",{class:"s-infinite-scroll-wrapper"},!!this.nextPageUrl&&e("salla-button",{onClick:this.handleClick,loading:this.isLoading},salla.lang.get("common.elements.load_more")))):e(a,null,e("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),e("div",{class:"s-wallet-table-empty-state"},e("i",{class:"sicon-full-wallet"}),e("div",{class:"text-center p-3 text-xl font-bold "},salla.lang.get("pages.wallet.no_transactions")),e("div",{class:"text-center text-gray-400 text-sm font-normal "},salla.lang.get("pages.wallet.zero_balance")," ")))}};l.style='/*!twlt*/.s-wallet-table{min-width:100%}.s-wallet-table-balance-container{display:flex !important;align-items:center !important;justify-content:flex-start !important;gap:1rem}.s-wallet-table-balance-icon{border-radius:50%;width:52px;height:52px;font-size:25px;padding:16px 13px;background:var(--color-primary-reverse);color:var(--color-primary)}.s-wallet-table-empty-state{display:flex;flex-direction:column;align-items:center}.s-wallet-table-empty-state i{font-size:80px;margin:4rem 0 2rem;color:var(--infinte-color)}.s-wallet-table-transaction-status{padding:6px 19px !important;border-radius:20px;width:max-content;display:flex;align-items:center}.s-wallet-table-transaction-status-default{background:#fff6eb;color:#a46f29}.s-wallet-table-transaction-status-cashback{background:#effbf6;color:#00af6c}.s-wallet-table-transaction-status-refund{background:#ecf3fe;color:#5196f3}.s-wallet-table-transaction-status-purchase{background:#feecec;color:#f55157}.s-wallet-table-transaction-status-icons-success{color:#00af6c}.absolute{position:absolute}.relative{position:relative}.flex{display:flex}.table{display:table}.hidden{display:none}.items-center{align-items:center}.p-3{padding:0.75rem}.text-center{text-align:center}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:0.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.font-normal{font-weight:400}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-wallet-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.625rem * var(--tw-space-y-reverse))}@media (min-width: 768px){.s-wallet-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}}.s-wallet-mobile-title{display:inline-block;width:8rem;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-wallet-mobile-title{display:none}}.s-wallet-reference-id{display:none}@media (min-width: 768px){.s-wallet-reference-id{display:inline-block}}.s-wallet-buy-as-gift-icon{margin-left:0.25rem;margin-right:0.25rem;display:inline-block;color:var(--color-primary)}.s-wallet-copy-to-clipboard-button{display:flex;align-items:center}@media (min-width: 768px){.s-wallet-copy-to-clipboard-button{display:none}}.s-wallet-copy-to-clipboard-button salla-button{position:relative}.s-wallet-copy-to-clipboard-button-icon{pointer-events:none;font-size:0.75rem;line-height:1rem}.s-wallet-copy-to-clipboard-button-icon:where([dir="ltr"],[dir="ltr"] *){margin-left:0.25rem}.s-wallet-copy-to-clipboard-button-icon:where([dir="rtl"],[dir="rtl"] *){margin-right:0.25rem}@media (min-width: 768px){.s-wallet-status-container{margin-left:0px;margin-right:0px}}.s-wallet-status-container:where([dir="ltr"],[dir="ltr"] *){margin-left:auto}.s-wallet-status-container:where([dir="rtl"],[dir="rtl"] *){margin-right:auto}.s-wallet-status-container i{margin-top:0.25rem}.s-wallet-status-container i:where([dir="ltr"],[dir="ltr"] *){margin-right:0.25rem}.s-wallet-status-container i:where([dir="rtl"],[dir="rtl"] *){margin-left:0.25rem}.s-wallet-rated-text{--tw-text-opacity:1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.s-wallet-unrated-text{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-wallet-no-content{display:flex;height:100%;flex-direction:column;align-items:center;justify-content:center;padding-top:2.5rem;padding-bottom:5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-wallet-no-content .icon{margin-bottom:1rem;display:flex;height:8rem;width:8rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:3rem;line-height:1;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-wallet-no-content p{margin-bottom:1rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-wallet-table{min-width:100%;border-collapse:separate}@media (min-width: 768px){.s-wallet-table{margin-bottom:-0.75rem;--tw-border-spacing-y:1.25rem;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}}.s-wallet-table-head{margin-bottom:1.25rem;display:none;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 768px){.s-wallet-table-head{display:table-header-group}}.s-wallet-table-head-tr-th{padding-left:1.5rem;padding-right:1.5rem;text-align:start;font-size:0.875rem;line-height:1.25rem;font-weight:500;text-transform:uppercase;letter-spacing:0.05em}.s-wallet-table-head-tr-th:where([dir="ltr"],[dir="ltr"] *){text-align:left}.s-wallet-table-head-tr-th:last-child:where([dir="ltr"],[dir="ltr"] *){text-align:right}.s-wallet-table-head-tr-th:where([dir="rtl"],[dir="rtl"] *){text-align:right}.s-wallet-table-head-tr-th:last-child:where([dir="rtl"],[dir="rtl"] *){text-align:left}.s-wallet-table-tbody-tr{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;overflow:hidden;border-radius:var(--s-radius, 0.25rem);border-bottom-width:8px;border-top-width:8px;--tw-border-opacity:1;border-color:rgb(249 250 251 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}@media (min-width: 768px){.s-wallet-table-tbody-tr{display:table-row;flex-direction:row;flex-wrap:nowrap;padding:0px}}.s-wallet-table-tbody-tr-td{width:100%;white-space:nowrap;font-size:0.875rem;line-height:1.25rem}.s-wallet-table-tbody-tr-td:first-child{font-weight:700}@media (min-width: 768px){.s-wallet-table-tbody-tr-td{height:5rem;width:auto}.s-wallet-table-tbody-tr-td:last-child{text-align:end}.s-wallet-table-tbody-tr-td:first-child:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:0.375rem;border-bottom-left-radius:0.375rem}.s-wallet-table-tbody-tr-td:first-child:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:0.375rem;border-bottom-right-radius:0.375rem}}.s-wallet-table-tbody-tr-td:first-child{font-weight:700}.s-wallet-table-tbody-tr-td-content{position:relative;display:flex;align-items:center;justify-content:space-between;padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem}@media (min-width: 768px){.s-wallet-table-tbody-tr-td-content{padding-left:1.5rem;padding-right:1.5rem;padding-top:1.5rem;padding-bottom:1.5rem}}.s-wallet-table-tbody-tr-td-content:where([dir="ltr"],[dir="ltr"] *){padding-right:0.5rem}.s-wallet-table-tbody-tr-td-content:where([dir="rtl"],[dir="rtl"] *){padding-left:0.5rem}.s-wallet-table-tbody-tr a{position:absolute;top:0px;bottom:0px;display:block;width:100%}.s-wallet-table-tbody-tr a:where([dir="ltr"],[dir="ltr"] *){left:0px}.s-wallet-table-tbody-tr a:where([dir="rtl"],[dir="rtl"] *){right:0px}@media (min-width: 768px){.md\\:mx-0{margin-left:0px;margin-right:0px}.md\\:inline-block{display:inline-block}.md\\:hidden{display:none}}.ltr\\:ml-auto:where([dir="ltr"],[dir="ltr"] *){margin-left:auto}.ltr\\:mr-4:where([dir="ltr"],[dir="ltr"] *){margin-right:1rem}.rtl\\:ml-4:where([dir="rtl"],[dir="rtl"] *){margin-left:1rem}.rtl\\:mr-auto:where([dir="rtl"],[dir="rtl"] *){margin-right:auto}/*!twlt*/.s-button-btn{position:relative;display:inline-flex;flex:1 1 0%;user-select:none;flex-direction:row-reverse;align-items:center;justify-content:center;white-space:nowrap;border-radius:var(--s-radius, 0.25rem);border-style:solid;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-btn:hover{opacity:0.8}.s-button-primary{border-width:1px;border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-primary-reverse)}.s-button-primary:hover{background-color:var(--color-primary-dark)}.s-button-text{pointer-events:none;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-loader{margin-left:0.5rem;margin-right:0.5rem;display:flex;align-items:center;justify-content:center;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-button-loader::before{display:inline-block;height:1rem;content:var(--tw-content);width:1rem}@keyframes spin{to{content:var(--tw-content);transform:rotate(360deg)}}.s-button-loader::before{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;border-style:solid;border-top-color:var(--color-primary);border-left-color:var(--color-primary);border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-border-opacity:1;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-button-loader-center .s-button-loader{position:absolute;top:50%;left:50%;margin:0px !important;--tw-translate-y:-50%;--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-comments-item-like-btn .s-button-text{display:flex;flex-direction:row-reverse;gap:0.5rem}.s-infinite-scroll-wrapper{margin-top:1rem;text-align:center}.s-infinite-scroll-last{margin:0px;text-align:center}.s-infinite-scroll-error{margin:0px;text-align:center}';export{l as salla_wallet}
4
+ import{r as t,h as e,H as a}from"./p-Q9lz4Iuq.js";const l=class{constructor(e){t(this,e),this.transactionsArray=[],this.isLoading=!1,this.nextPageUrl="",this.handleClick=()=>{this.loadMoreTransactions()}}componentWillLoad(){return salla.onReady().then((()=>this.loadTransactions()))}normalizeTransactions(t){if(Array.isArray(t))return{list:t,nextPageUrl:""};const e=t?.current_page??1,a=e<(t?.last_page??e)?`/balance/wallet?per_page=${t?.per_page??10}&page=${e+1}`:"";return{list:t?.data??[],nextPageUrl:a}}async loadTransactions(){this.isLoading=!0;try{let t="/balance/wallet?per_page=10&page=1",e=await salla.api.request(t);const{list:a,nextPageUrl:l}=this.normalizeTransactions(e.data.transactions);this.nextPageUrl=l,this.transactionsArray=a,this.balance=e.data.balance}catch(t){console.error("Error loading wallet transactions",t)}finally{this.isLoading=!1}}async loadMoreTransactions(){this.isLoading=!0;try{let t=this.nextPageUrl||"/balance/wallet?page=2&per_page=10",e=await salla.api.request(t);const{list:a,nextPageUrl:l}=this.normalizeTransactions(e.data.transactions);this.nextPageUrl=l,this.transactionsArray=[...this.transactionsArray,...a],this.balance=e.data.balance}catch(t){console.error("Error loading wallet transactions",t)}finally{this.isLoading=!1}}render(){return this.transactionsArray.length>0?e(a,null,e("table",{class:"s-wallet-table"},e("tbody",{class:"s-wallet-table-tbody"},e("tr",{class:"s-table__tr"},e("td",null,e("div",{class:"s-wallet-table-balance-container"},e("i",{class:"s-wallet-table-balance-icon sicon-wallet"}),e("div",null,e("div",{innerHTML:salla.money(this.balance)}),e("div",{class:"font-normal text-gray-400"}," ",salla.lang.get("pages.wallet.balance")))))))),e("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),e("table",{class:"s-wallet-table"},e("thead",{class:"s-wallet-table-head"},e("tr",{class:"s-wallet-table-head-tr"},e("th",{scope:"col"},salla.lang.get("pages.wallet.transaction_number")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.amount")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.date")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.order_no")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.transaction_type")," "))),e("tbody",{class:"s-wallet-table-tbody"},this.transactionsArray.map((t=>e("tr",{class:"s-wallet-table-tbody-tr s-wallet-table-tbody-tr-shadow animated"},e("td",{class:"s-wallet-table-tbody-tr-td"},e("div",{class:"s-wallet-table-tbody-tr-td-content"},e("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_number"),":"),t.id&&e("span",{class:"hidden md:inline-block"},"#",t.id),e("div",{class:"flex items-center md:hidden"},e("salla-button",{class:"relative",color:"dark",shape:"link","data-content":t.order_id},t.order_id&&e("span",null,"#",t.order_id))))),e("td",{id:"main123",class:"s-wallet-table-tbody-tr-td"},e("div",{id:"main124",class:"s-wallet-table-tbody-tr-td-content"},e("span",{id:"main125",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.amount"),":"),e("div",{innerHTML:salla.money(t.amount)}))),e("td",{class:"s-wallet-table-tbody-tr-td"},e("div",{class:"s-wallet-table-tbody-tr-td-content"},e("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.date"),":"),t.created_at&&new Date(1e3*t.created_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}))),e("td",{id:"main133",class:"s-wallet-table-tbody-tr-td"},e("div",{id:"main134",class:"s-wallet-table-tbody-tr-td-content"},e("span",{id:"main135",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.order_no"),":"),e("span",{class:"rtl:mr-auto ltr:ml-auto md:mx-0"},t.order_id&&e("span",null,"#",t.order_id)))),e("td",{id:"main143",class:"s-wallet-table-tbody-tr-td"},e("div",{id:"main144",class:"s-wallet-table-tbody-tr-td-content"},e("span",{id:"main145",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.expiry_date"),":"),e("span",null,t.expired_at&&new Date(1e3*t.expired_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"})))),e("td",{class:"s-wallet-table-tbody-tr-td"},e("div",{class:"s-wallet-table-tbody-tr-td-content"},e("div",null,e("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_type"),":")),e("div",{class:{"s-wallet-table-transaction-status-default":!0,"s-wallet-table-transaction-status-cashback":"cashback"===t.action_type,"s-wallet-table-transaction-status-refund":"refund"===t.action_type,"s-wallet-table-transaction-status-purchase":"purchase_by_wallet"===t.action_type}},!!t.description&&e("i",{id:t.id.toString(),class:"sicon-information text-lg rtl:ml-4 ltr:mr-4 s-wallet-table-transaction-status-icon-success"}),!!t.description&&e("salla-tooltip",{text:t.description,targetId:t.id.toString()}),e("span",null,t.title))))))))),e("div",{class:"s-infinite-scroll-wrapper"},!!this.nextPageUrl&&e("salla-button",{onClick:this.handleClick,loading:this.isLoading},salla.lang.get("common.elements.load_more")))):e(a,null,e("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),e("div",{class:"s-wallet-table-empty-state"},e("i",{class:"sicon-full-wallet"}),e("div",{class:"text-center p-3 text-xl font-bold "},salla.lang.get("pages.wallet.no_transactions")),e("div",{class:"text-center text-gray-400 text-sm font-normal "},salla.lang.get("pages.wallet.zero_balance")," ")))}};l.style='/*!twlt*/.s-wallet-table{min-width:100%}.s-wallet-table-balance-container{display:flex !important;align-items:center !important;justify-content:flex-start !important;gap:1rem}.s-wallet-table-balance-icon{border-radius:50%;width:52px;height:52px;font-size:25px;padding:16px 13px;background:var(--color-primary-reverse);color:var(--color-primary)}.s-wallet-table-empty-state{display:flex;flex-direction:column;align-items:center}.s-wallet-table-empty-state i{font-size:80px;margin:4rem 0 2rem;color:var(--infinte-color)}.s-wallet-table-transaction-status{padding:6px 19px !important;border-radius:20px;width:max-content;display:flex;align-items:center}.s-wallet-table-transaction-status-default{background:#fff6eb;color:#a46f29}.s-wallet-table-transaction-status-cashback{background:#effbf6;color:#00af6c}.s-wallet-table-transaction-status-refund{background:#ecf3fe;color:#5196f3}.s-wallet-table-transaction-status-purchase{background:#feecec;color:#f55157}.s-wallet-table-transaction-status-icons-success{color:#00af6c}.absolute{position:absolute}.relative{position:relative}.flex{display:flex}.table{display:table}.hidden{display:none}.items-center{align-items:center}.p-3{padding:0.75rem}.text-center{text-align:center}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:0.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.font-normal{font-weight:400}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-wallet-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.625rem * var(--tw-space-y-reverse))}@media (min-width: 768px){.s-wallet-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}}.s-wallet-mobile-title{display:inline-block;width:8rem;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-wallet-mobile-title{display:none}}.s-wallet-reference-id{display:none}@media (min-width: 768px){.s-wallet-reference-id{display:inline-block}}.s-wallet-buy-as-gift-icon{margin-left:0.25rem;margin-right:0.25rem;display:inline-block;color:var(--color-primary)}.s-wallet-copy-to-clipboard-button{display:flex;align-items:center}@media (min-width: 768px){.s-wallet-copy-to-clipboard-button{display:none}}.s-wallet-copy-to-clipboard-button salla-button{position:relative}.s-wallet-copy-to-clipboard-button-icon{pointer-events:none;font-size:0.75rem;line-height:1rem}.s-wallet-copy-to-clipboard-button-icon:where([dir="ltr"],[dir="ltr"] *){margin-left:0.25rem}.s-wallet-copy-to-clipboard-button-icon:where([dir="rtl"],[dir="rtl"] *){margin-right:0.25rem}@media (min-width: 768px){.s-wallet-status-container{margin-left:0px;margin-right:0px}}.s-wallet-status-container:where([dir="ltr"],[dir="ltr"] *){margin-left:auto}.s-wallet-status-container:where([dir="rtl"],[dir="rtl"] *){margin-right:auto}.s-wallet-status-container i{margin-top:0.25rem}.s-wallet-status-container i:where([dir="ltr"],[dir="ltr"] *){margin-right:0.25rem}.s-wallet-status-container i:where([dir="rtl"],[dir="rtl"] *){margin-left:0.25rem}.s-wallet-rated-text{--tw-text-opacity:1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.s-wallet-unrated-text{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-wallet-no-content{display:flex;height:100%;flex-direction:column;align-items:center;justify-content:center;padding-top:2.5rem;padding-bottom:5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-wallet-no-content .icon{margin-bottom:1rem;display:flex;height:8rem;width:8rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:3rem;line-height:1;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-wallet-no-content p{margin-bottom:1rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-wallet-table{min-width:100%;border-collapse:separate}@media (min-width: 768px){.s-wallet-table{margin-bottom:-0.75rem;--tw-border-spacing-y:1.25rem;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}}.s-wallet-table-head{margin-bottom:1.25rem;display:none;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 768px){.s-wallet-table-head{display:table-header-group}}.s-wallet-table-head-tr-th{padding-left:1.5rem;padding-right:1.5rem;text-align:start;font-size:0.875rem;line-height:1.25rem;font-weight:500;text-transform:uppercase;letter-spacing:0.05em}.s-wallet-table-head-tr-th:where([dir="ltr"],[dir="ltr"] *){text-align:left}.s-wallet-table-head-tr-th:last-child:where([dir="ltr"],[dir="ltr"] *){text-align:right}.s-wallet-table-head-tr-th:where([dir="rtl"],[dir="rtl"] *){text-align:right}.s-wallet-table-head-tr-th:last-child:where([dir="rtl"],[dir="rtl"] *){text-align:left}.s-wallet-table-tbody-tr{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;overflow:hidden;border-radius:var(--s-radius, 0.25rem);border-bottom-width:8px;border-top-width:8px;--tw-border-opacity:1;border-color:rgb(249 250 251 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}@media (min-width: 768px){.s-wallet-table-tbody-tr{display:table-row;flex-direction:row;flex-wrap:nowrap;padding:0px}}.s-wallet-table-tbody-tr-td{width:100%;white-space:nowrap;font-size:0.875rem;line-height:1.25rem}.s-wallet-table-tbody-tr-td:first-child{font-weight:700}@media (min-width: 768px){.s-wallet-table-tbody-tr-td{height:5rem;width:auto}.s-wallet-table-tbody-tr-td:last-child{text-align:end}.s-wallet-table-tbody-tr-td:first-child:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:0.375rem;border-bottom-left-radius:0.375rem}.s-wallet-table-tbody-tr-td:first-child:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:0.375rem;border-bottom-right-radius:0.375rem}}.s-wallet-table-tbody-tr-td:first-child{font-weight:700}.s-wallet-table-tbody-tr-td-content{position:relative;display:flex;align-items:center;justify-content:space-between;padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem}@media (min-width: 768px){.s-wallet-table-tbody-tr-td-content{padding-left:1.5rem;padding-right:1.5rem;padding-top:1.5rem;padding-bottom:1.5rem}}.s-wallet-table-tbody-tr-td-content:where([dir="ltr"],[dir="ltr"] *){padding-right:0.5rem}.s-wallet-table-tbody-tr-td-content:where([dir="rtl"],[dir="rtl"] *){padding-left:0.5rem}.s-wallet-table-tbody-tr a{position:absolute;top:0px;bottom:0px;display:block;width:100%}.s-wallet-table-tbody-tr a:where([dir="ltr"],[dir="ltr"] *){left:0px}.s-wallet-table-tbody-tr a:where([dir="rtl"],[dir="rtl"] *){right:0px}@media (min-width: 768px){.md\\:mx-0{margin-left:0px;margin-right:0px}.md\\:inline-block{display:inline-block}.md\\:hidden{display:none}}.ltr\\:ml-auto:where([dir="ltr"],[dir="ltr"] *){margin-left:auto}.ltr\\:mr-4:where([dir="ltr"],[dir="ltr"] *){margin-right:1rem}.rtl\\:ml-4:where([dir="rtl"],[dir="rtl"] *){margin-left:1rem}.rtl\\:mr-auto:where([dir="rtl"],[dir="rtl"] *){margin-right:auto}/*!twlt*/.s-button-btn{position:relative;display:inline-flex;flex:1 1 0%;user-select:none;flex-direction:row-reverse;align-items:center;justify-content:center;white-space:nowrap;border-radius:var(--s-radius, 0.25rem);border-style:solid;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-btn:hover{opacity:0.8}.s-button-primary{border-width:1px;border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-primary-reverse)}.s-button-primary:hover{background-color:var(--color-primary-dark)}.s-button-text{pointer-events:none;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-loader{margin-left:0.5rem;margin-right:0.5rem;display:flex;align-items:center;justify-content:center;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-button-loader::before{display:inline-block;height:1rem;content:var(--tw-content);width:1rem}@keyframes spin{to{content:var(--tw-content);transform:rotate(360deg)}}.s-button-loader::before{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;border-style:solid;border-top-color:var(--color-primary);border-left-color:var(--color-primary);border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-border-opacity:1;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-button-loader-center .s-button-loader{position:absolute;top:50%;left:50%;margin:0px !important;--tw-translate-y:-50%;--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-comments-item-like-btn .s-button-text{display:flex;flex-direction:row-reverse;gap:0.5rem}.s-infinite-scroll-wrapper{margin-top:1rem;text-align:center}.s-infinite-scroll-last{margin:0px;text-align:center}.s-infinite-scroll-error{margin:0px;text-align:center}';export{l as salla_wallet}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,c as s,h as i,H as e,a as n}from"./p-BsIeN-bg.js";import{A as o,a as l}from"./p-Vqpj4CWE.js";const d=class{constructor(i){t(this,i),this.optionsSaved=s(this,"optionsSaved"),this.productSelected=s(this,"productSelected"),this.product=null,this.sectionId=null,this.sectionIndex=0,this.productIndex=0,this.selectedOptions={},this.optionsResetTokens={},this.isLoading=!1,this.hasUnsavedChanges=!1,this.validationErrors=[],this.isProductAlreadySelected=!1}generateCacheKey(t,s,i){return`${t||"unknown"}-${s||0}-${i||"unknown"}`}handleProductChange(t){setTimeout((()=>{this.modal&&t&&this.modal.setTitle(t.name||"")}),100),this.validationErrors=[],this.hasUnsavedChanges=!1}async open(){this.modal?(this.isLoading=!0,this.product?.name&&this.modal.setTitle(this.product.name),this.modal.open(),setTimeout((async()=>{this.product?.id&&await this.initializeSelectedOptions(),this.product?.name&&this.modal.setTitle(this.product.name),this.modal.stopLoading(),this.isLoading=!1}),300)):requestAnimationFrame((()=>this.open()))}async close(){this.modal&&this.modal.close()}async refreshOptionsState(){this.selectedOptions={...this.selectedOptions}}componentDidLoad(){this.modalOpenListener=t=>{this.product=t.product,this.sectionId=t.sectionId||null,this.sectionIndex=t.sectionIndex||0,this.productIndex=t.productIndex||0,this.isProductAlreadySelected=!!t.isProductAlreadySelected,this.open()},salla.event.on("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener=t=>{t&&t.productId&&this.clearProductOptions(t.productId,t.sectionId,t.productIndex)},salla.event.on("multiple-bundle-product-modal::clear-options",this.clearOptionsListener),this.optionChangeListener=t=>{const s=t.detail||t,{option:i,detail:e}=s,n=i||s.option_id&&this.product?.options?.find((t=>t.id===s.option_id||String(t.id)===String(s.option_id))),o=e||(s.id?s:null);this.product?.id&&n&&this.handleOptionChange(Number(this.product.id),n,o)},salla.event.on("product-options::change",this.optionChangeListener),this.checkboxChangeListener=t=>{const s=t.target;if(s&&"checkbox"===s.type&&s.name&&s.name.includes("bundle[")&&s.name.includes("][id]")){const t=s.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);if(t&&!s.checked){if("true"===s.getAttribute("data-selection-locked"))return void(s.checked=!0);const[,i,e]=t,n=s.value,o=this.host.closest("form");this.cleanupProductDeselection({sectionId:i,productIndex:parseInt(e,10),productId:n,form:o,uncheckedInput:s})}}},document.addEventListener("change",this.checkboxChangeListener)}disconnectedCallback(){this.checkboxChangeListener&&document.removeEventListener("change",this.checkboxChangeListener),this.optionChangeListener&&salla.event.off("product-options::change",this.optionChangeListener),this.modalOpenListener&&salla.event.off("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener&&salla.event.off("multiple-bundle-product-modal::clear-options",this.clearOptionsListener)}cleanupProductDeselection(t){const{sectionId:s,productIndex:i,productId:e,form:n,uncheckedInput:o}=t;if(this.clearProductOptions(e,s,i),n){const t=`bundle[${s}][${i}]`;Array.from(n.querySelectorAll(`input[name^="${t}"]`)).forEach((s=>{if(s===o)return;const i="hidden"===s.type,n=s.getAttribute("data-product-id")===String(e)&&s.name?.startsWith(t);(i||n)&&s.remove()})),requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});n.dispatchEvent(t)}))}}generateFormInputName(t,s,i){return`bundle[${t}][${s}][options][${i}]`}async initializeSelectedOptions(){if(!this.product?.id)return;const t=this.product.id,s=this.generateCacheKey(this.sectionId,this.productIndex,t),i=document.querySelector(`salla-product-options[product-id="${t}"]`);if(i)try{const t=await i.getSelectedOptions();t&&t.length>0&&(this.selectedOptions={...this.selectedOptions,[s]:t})}catch(t){console.warn("Could not initialize selected options:",t)}}clearProductOptions(t,s,i){const e={...this.selectedOptions};if(null==s||null==i||Number.isNaN(i)){const s=`-${String(t)}`,i=[];Object.keys(e).forEach((t=>{t.endsWith(s)&&(delete e[t],i.push(t))})),i.forEach((t=>this.bumpOptionsResetToken(t)))}else{const n=this.generateCacheKey(s,i,t);delete e[n],this.bumpOptionsResetToken(n)}this.selectedOptions=e,this.validationErrors=[],this.hasUnsavedChanges=!1}bumpOptionsResetToken(t){t&&(this.optionsResetTokens={...this.optionsResetTokens,[t]:(this.optionsResetTokens[t]||0)+1})}async handleOptionChange(t,s,i){const e=this.generateCacheKey(this.sectionId,this.productIndex,t),n=document.querySelector(`salla-product-options[product-id="${t}"]`);let o=[];if(n)try{o=await n.getSelectedOptions()||[]}catch(t){console.warn("Could not get current selections from component:",t)}if(o.length>0)this.selectedOptions={...this.selectedOptions,[e]:o};else if(this.selectedOptions[e]&&this.selectedOptions[e].length>0){const t=[...this.selectedOptions[e]||[]],n=t.findIndex((t=>t.option_id===s.id));n>-1?i&&null!=i.id?t[n]={...i,option_id:s.id}:t.splice(n,1):i&&null!=i.id&&t.push({...i,option_id:s.id}),this.selectedOptions={...this.selectedOptions,[e]:t}}else i&&null!=i.id&&(this.selectedOptions={...this.selectedOptions,[e]:[{...i,option_id:s.id}]});this.hasUnsavedChanges=!0,this.validationErrors=[]}async validateOptions(){if(!this.product?.options)return!0;const t=[],s=this.product.id,i=this.generateCacheKey(this.sectionId,this.productIndex,s),e=document.querySelector(`salla-product-options[product-id="${s}"]`);let n=[];if(e)try{n=await e.getSelectedOptions()||[];const t=this.selectedOptions[i]||[];(t.length>n.length||0===n.length&&t.length>0)&&(n=t)}catch(t){n=this.selectedOptions[i]||[]}else n=this.selectedOptions[i]||[];return 0===n.length&&t.push(salla.lang.get("pages.products.no_options_selected")),this.product.options.forEach((s=>{s.required&&(n.some((t=>t.option_id==s.id))||t.push(salla.lang.get("pages.products.required_option_missing",{option:s.name})))})),this.validationErrors=t,0===t.length}async onSave(t){t.preventDefault();const s=this.product?.id;if(!s)return;const i=this.generateCacheKey(this.sectionId,this.productIndex,s);if(await new Promise((t=>setTimeout(t,100))),await this.validateOptions()){if(!this.isProductAlreadySelected&&null!=this.sectionId){const t=this.host.closest("salla-multiple-bundle-product-details");if(!await(t?.canSelectBundleProduct(this.sectionId,s)))return void salla.notify.error(salla.lang.getWithDefault("pages.products.bundle_selection_limit_reached","لا يمكنك اختيار المزيد من المنتجات في هذا القسم"))}this.isLoading=!0;try{const t=document.querySelector(`salla-product-options[product-id="${s}"]`);let e=await(t?.getSelectedOptions());if((!e||0===e.length)&&this.selectedOptions[i]?.length>0&&(e=this.selectedOptions[i]),!e||0===e.length)return void(this.isLoading=!1);this.selectedOptions={...this.selectedOptions,[i]:e};const n=this.host.closest("form");if(!n)return void(this.isLoading=!1);const o=`bundle[${this.sectionId}][${this.productIndex}]`;Array.from(n.querySelectorAll(`input[name^="${o}"][type="hidden"]`)).forEach((t=>t.remove())),Array.from(n.querySelectorAll(`[data-product-id="${s}"][name^="${o}"]`)).forEach((t=>t.remove()));const l=`bundle[${this.sectionId}][${this.productIndex}][id]`,d=document.getElementById(l);if(d)d.checked=!0;else{const t=document.createElement("input");t.type="hidden",t.name=`bundle[${this.sectionId}][${this.productIndex}][id]`,t.value=String(s),t.dataset.productId=String(s),n.appendChild(t)}e.forEach((t=>{const i=t.option_id,e=document.createElement("input");e.type="hidden",e.name=this.generateFormInputName(this.sectionId,this.productIndex??0,i),e.value=String(t.id),e.dataset.productId=String(s),n.appendChild(e)}));const a=new window.Event("change",{bubbles:!0});n.dispatchEvent(a),this.optionsSaved.emit({productId:Number(s),selectedOptions:e,sectionId:this.sectionId,productIndex:this.productIndex}),this.sectionId&&this.productSelected.emit({productId:Number(s),sectionId:this.sectionId,product:this.product,fromModal:!0}),salla.notify.success(salla.lang.get("pages.products.options_saved")),this.hasUnsavedChanges=!1,this.validationErrors=[],this.modal.close()}catch(t){salla.notify.error(salla.lang.get("pages.products.options_save_error"))}finally{this.isLoading=!1}}else salla.notify.error(this.validationErrors.join(", "))}getOptionsWithSelectedState(){if(!this.product?.options)return[];const t=this.generateCacheKey(this.sectionId,this.productIndex,this.product.id),s=this.selectedOptions[t]||[];return this.product.options.map((t=>({...t,details:t.details.map((t=>{const i=s.some((s=>s.id===t.id));return{...t,is_selected:i}}))})))}render(){const t=this.product?.id,s=this.getOptionsWithSelectedState(),n=this.generateCacheKey(this.sectionId,this.productIndex,t),o=this.optionsResetTokens[n]||0,l=this.isLoading||s.some((t=>t.details.some((t=>t.is_selected&&!0===t.is_out))));return i(e,{key:"610ae038d4f9db109e3f25830e82b39a2b07a010"},i("salla-modal",{key:"b06c130448cd1862d2e879a0285fd385395cc11b",isLoading:this.isLoading,ref:t=>this.modal=t,width:"md",centered:!1,id:`s-multiple-bundle-product-options-modal-options-${t}`,class:"s-multiple-bundle-product-options-modal-wrapper"},i("div",{key:"1f8b9ffa80a40f8240ede4b8996943f7eecf4098",slot:"loading"},i("salla-skeleton",{key:"26463b16022e1f66fd66f4e9cd8907521352bac1",height:"100%",width:"100%"})),this.product?.images&&this.product?.images.length>0&&i("salla-slider",{key:"bae60782cbe4ac7dc325fd666258198cd871a52e",id:`details-slider-${this.product?.id}`,type:"thumbs",loop:!1,"auto-height":!0,"listen-to-thumbnails-option":!0,showThumbsControls:!1,controlsOuter:!1,showControls:!1,class:"s-multiple-bundle-product-options-modal-slider",verticalThumbs:!0,thumbsConfig:{centeredSlides:!0,centeredSlidesBounds:!0,slidesPerView:Math.min(5,Math.max(1,this.product?.images.length)),watchOverflow:!0,watchSlidesProgress:!0,direction:"vertical",spaceBetween:10}},i("div",{key:"998afc3297e89df7e0a6b2514a6d5f4f75152492",slot:"items"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,class:"swiper-slide"},i("img",{src:t.url,alt:t.alt||`${this.product?.name} - Image ${s+1}`,loading:"lazy",onError:t=>{t.target.style.display="none"}}))))),this.product?.images&&this.product?.images.length>1&&i("div",{key:"935a3d01a417926e904507d0a64da43c84924068",slot:"thumbs"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,"data-caption":`${this.product?.name} - Image ${s+1}`},i("img",{src:t.url,loading:"eager",class:"s-multiple-bundle-product-options-modal-slider-thumb",title:`${this.product?.name} - ${s+1}`,alt:t.alt||`${this.product?.name} - ${s+1}`,onError:t=>{t.target.style.display="none"}})))))),i("salla-product-options",{options:JSON.stringify(s),key:`${n}-reset-${o}`,"product-id":t,"unique-key":`${n}-reset-${o}`}),i("div",{key:"eeb710a27917f6134a2595ebb8e4ec485bb26254",slot:"footer"},i("div",{key:"2ae3d47c461b68d61fcaa1d8f279ae6402aedf2e",class:"s-multiple-bundle-product-options-modal-footer"},i("salla-button",{key:"436f64a89183f0e6d56b6800ad031449c49cc751",onClick:t=>this.onSave(t),loading:this.isLoading,disabled:l},this.isLoading?salla.lang.get("common.elements.saving"):salla.lang.get("common.elements.save"))))))}get host(){return n(this)}static get watchers(){return{product:["handleProductChange"]}}};d.style=":host{display:block}";const a=class{constructor(i){t(this,i),this.productSelected=s(this,"productSelected"),this.productOptionsSelected=s(this,"productOptionsSelected"),this.selectedProducts={},this.isSelectionLocked=!1,this.selectionLimit=0,this.savedOptionsByInstance={},this.handleProductClick=(t,s)=>{const i=this.selectedProducts[this.section.id]?.has(t.id)||!1,e=this.getCheckbox(this.section.id,s);if(i&&this.isSelectionLocked)return void(e&&(e.checked=!0));if(!i&&this.isMaxSelectionReached()&&1!==this.selectionLimit)return;if(1===this.selectionLimit&&!i)return void this.productSelected.emit({product:t,sectionId:this.section.id});if(!e)return;const n=!e.checked;n||(this.dispatchClearOptionsEvent(t,s),this.clearSavedOptionsState(this.section.id,s)),e.checked=n,requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});e.dispatchEvent(t)})),this.productSelected.emit({product:t,sectionId:this.section.id})},this.handleOptionsClick=t=>{!this.selectedProducts[this.section.id]?.has(t.id)&&this.isMaxSelectionReached()&&1!==this.selectionLimit||this.productOptionsSelected.emit({product:t,sectionId:this.section.id})}}getSelectedCount(){return this.selectedProducts[this.section?.id]?.size??0}isMaxSelectionReached(){return this.selectionLimit>1&&this.getSelectedCount()>=this.selectionLimit}isProductSelectionDisabled(t,s){return 0===t.quantity||!s&&this.isMaxSelectionReached()}getProductInstanceKey(t,s){return`${t}::${s}`}dispatchClearOptionsEvent(t,s){salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t.id,sectionId:this.section.id,sectionIndex:this.sectionIndex,productIndex:s})}handleOptionsSaved(t){const s=t.detail;if(!s)return;const{sectionId:i,productIndex:e,selectedOptions:n}=s;if(null==i||i!==this.section?.id)return;if(null==e||Number.isNaN(e))return;const o=this.getProductInstanceKey(i,e);if(n?.length)this.savedOptionsByInstance={...this.savedOptionsByInstance,[o]:!0};else if(this.savedOptionsByInstance[o]){const t={...this.savedOptionsByInstance};delete t[o],this.savedOptionsByInstance=t}}clearSavedOptionsState(t,s){const i=this.getProductInstanceKey(t,s);if(!this.savedOptionsByInstance[i])return;const e={...this.savedOptionsByInstance};delete e[i],this.savedOptionsByInstance=e}generateEventName(t,s){return`bundle[${t}][${s}][id]`}getCheckbox(t,s){const i=this.generateEventName(t,s);return this.host.querySelector(`input.s-multiple-bundle-product-checkbox[name="${i}"]`)}preventLockedDeselect(t,s){if(!this.isSelectionLocked||!s)return;t.preventDefault(),t.stopPropagation();const i=t.target;"checkbox"===i?.type&&(i.checked=!0)}render(){return i(e,{key:"e473b6089ee0e7026dfec042462ed827dabd0083"},i("salla-slider",{key:"492187e1a1c105c21c48543aa227888d122cfa20",type:"carousel",controlsOuter:!1,showControls:!1,id:`accordion-multiple-bundle-product-${this.section.id}`,pagination:!0,class:"s-multiple-bundle-product-wrapper-slider",sliderConfig:{spaceBetween:0}},i("div",{key:"e40e816439f3b3e1bee12ebdcea60438a45fec12",slot:"items"},this?.section?.products?.map(((t,s)=>{const e=this.selectedProducts[this.section.id]?.has(t.id)||!1,n=e&&this.isSelectionLocked,d=this.isProductSelectionDisabled(t,e),a=this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id,s)]?salla.lang.getWithDefault("pages.products.edit_selected_options","تعديل الخيارات"):salla.lang.get("pages.products.choose_from_options");let c=salla.config.get("theme.is_rtl",!0)?o:l;return i("div",{class:"s-multiple-bundle-product-slide-one-third"+(d?" s-multiple-bundle-product-slide-one-third-disabled":""),key:t.id},i("div",{class:"s-multiple-bundle-product-card"},i("div",{class:"s-multiple-bundle-product-image-wrapper",onClick:()=>this.handleProductClick(t,s)},i("input",{id:this.generateEventName(this.section.id,s),type:"checkbox",class:"s-multiple-bundle-product-checkbox",checked:e,"data-selection-locked":n?"true":void 0,name:this.generateEventName(this.section.id,s),value:t.id,onClick:t=>this.preventLockedDeselect(t,e),onChange:t=>this.preventLockedDeselect(t,e)}),i("img",{src:t.image.url||salla.url.cdn("images/s-empty.png"),loading:"lazy",alt:t.image.alt||t.name,class:"s-multiple-bundle-product-image"})),i("div",{class:"s-multiple-bundle-product-content-wrapper"},i("div",{class:"s-multiple-bundle-product-content"},i("div",{class:"s-multiple-bundle-product-details"},i("div",{class:"s-multiple-bundle-product-title-wrapper"},i("h2",{class:"s-multiple-bundle-product-title"},i("a",{href:t?.url||"#",target:"_blank",rel:"noopener noreferrer"},t.name))),i("div",{class:"s-multiple-bundle-product-price-wrapper"},i("span",{class:"s-multiple-bundle-product-price"},i("span",{innerHTML:salla.money(t.price)})),t.sale_price>0&&i("span",{class:"s-multiple-bundle-product-price-discount"},i("span",{innerHTML:salla.money(t.regular_price)})))),t.quantity_in_group>0&&0!==t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.pieces"),i("span",null,t.quantity_in_group)),0===t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.quantity_in_group_finished"))),t.options?.length>0&&i("button",{class:"s-multiple-bundle-product-button",onClick:()=>this.handleOptionsClick(t),type:"button"},a,i("span",{class:"s-multiple-bundle-product-button-icon",innerHTML:c})))))})))))}get host(){return n(this)}};a.style="";export{d as salla_multiple_bundle_product_options_modal,a as salla_multiple_bundle_product_slider}
4
+ import{r as t,c as s,h as i,H as e,a as n}from"./p-Q9lz4Iuq.js";import{A as o,a as l}from"./p-Vqpj4CWE.js";const d=class{constructor(i){t(this,i),this.optionsSaved=s(this,"optionsSaved"),this.productSelected=s(this,"productSelected"),this.product=null,this.sectionId=null,this.sectionIndex=0,this.productIndex=0,this.selectedOptions={},this.optionsResetTokens={},this.isLoading=!1,this.hasUnsavedChanges=!1,this.validationErrors=[],this.isProductAlreadySelected=!1}generateCacheKey(t,s,i){return`${t||"unknown"}-${s||0}-${i||"unknown"}`}handleProductChange(t){setTimeout((()=>{this.modal&&t&&this.modal.setTitle(t.name||"")}),100),this.validationErrors=[],this.hasUnsavedChanges=!1}async open(){this.modal?(this.isLoading=!0,this.product?.name&&this.modal.setTitle(this.product.name),this.modal.open(),setTimeout((async()=>{this.product?.id&&await this.initializeSelectedOptions(),this.product?.name&&this.modal.setTitle(this.product.name),this.modal.stopLoading(),this.isLoading=!1}),300)):requestAnimationFrame((()=>this.open()))}async close(){this.modal&&this.modal.close()}async refreshOptionsState(){this.selectedOptions={...this.selectedOptions}}componentDidLoad(){this.modalOpenListener=t=>{this.product=t.product,this.sectionId=t.sectionId||null,this.sectionIndex=t.sectionIndex||0,this.productIndex=t.productIndex||0,this.isProductAlreadySelected=!!t.isProductAlreadySelected,this.open()},salla.event.on("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener=t=>{t&&t.productId&&this.clearProductOptions(t.productId,t.sectionId,t.productIndex)},salla.event.on("multiple-bundle-product-modal::clear-options",this.clearOptionsListener),this.optionChangeListener=t=>{const s=t.detail||t,{option:i,detail:e}=s,n=i||s.option_id&&this.product?.options?.find((t=>t.id===s.option_id||String(t.id)===String(s.option_id))),o=e||(s.id?s:null);this.product?.id&&n&&this.handleOptionChange(Number(this.product.id),n,o)},salla.event.on("product-options::change",this.optionChangeListener),this.checkboxChangeListener=t=>{const s=t.target;if(s&&"checkbox"===s.type&&s.name&&s.name.includes("bundle[")&&s.name.includes("][id]")){const t=s.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);if(t&&!s.checked){if("true"===s.getAttribute("data-selection-locked"))return void(s.checked=!0);const[,i,e]=t,n=s.value,o=this.host.closest("form");this.cleanupProductDeselection({sectionId:i,productIndex:parseInt(e,10),productId:n,form:o,uncheckedInput:s})}}},document.addEventListener("change",this.checkboxChangeListener)}disconnectedCallback(){this.checkboxChangeListener&&document.removeEventListener("change",this.checkboxChangeListener),this.optionChangeListener&&salla.event.off("product-options::change",this.optionChangeListener),this.modalOpenListener&&salla.event.off("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener&&salla.event.off("multiple-bundle-product-modal::clear-options",this.clearOptionsListener)}cleanupProductDeselection(t){const{sectionId:s,productIndex:i,productId:e,form:n,uncheckedInput:o}=t;if(this.clearProductOptions(e,s,i),n){const t=`bundle[${s}][${i}]`;Array.from(n.querySelectorAll(`input[name^="${t}"]`)).forEach((s=>{if(s===o)return;const i="hidden"===s.type,n=s.getAttribute("data-product-id")===String(e)&&s.name?.startsWith(t);(i||n)&&s.remove()})),requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});n.dispatchEvent(t)}))}}generateFormInputName(t,s,i){return`bundle[${t}][${s}][options][${i}]`}async initializeSelectedOptions(){if(!this.product?.id)return;const t=this.product.id,s=this.generateCacheKey(this.sectionId,this.productIndex,t),i=document.querySelector(`salla-product-options[product-id="${t}"]`);if(i)try{const t=await i.getSelectedOptions();t&&t.length>0&&(this.selectedOptions={...this.selectedOptions,[s]:t})}catch(t){console.warn("Could not initialize selected options:",t)}}clearProductOptions(t,s,i){const e={...this.selectedOptions};if(null==s||null==i||Number.isNaN(i)){const s=`-${String(t)}`,i=[];Object.keys(e).forEach((t=>{t.endsWith(s)&&(delete e[t],i.push(t))})),i.forEach((t=>this.bumpOptionsResetToken(t)))}else{const n=this.generateCacheKey(s,i,t);delete e[n],this.bumpOptionsResetToken(n)}this.selectedOptions=e,this.validationErrors=[],this.hasUnsavedChanges=!1}bumpOptionsResetToken(t){t&&(this.optionsResetTokens={...this.optionsResetTokens,[t]:(this.optionsResetTokens[t]||0)+1})}async handleOptionChange(t,s,i){const e=this.generateCacheKey(this.sectionId,this.productIndex,t),n=document.querySelector(`salla-product-options[product-id="${t}"]`);let o=[];if(n)try{o=await n.getSelectedOptions()||[]}catch(t){console.warn("Could not get current selections from component:",t)}if(o.length>0)this.selectedOptions={...this.selectedOptions,[e]:o};else if(this.selectedOptions[e]&&this.selectedOptions[e].length>0){const t=[...this.selectedOptions[e]||[]],n=t.findIndex((t=>t.option_id===s.id));n>-1?i&&null!=i.id?t[n]={...i,option_id:s.id}:t.splice(n,1):i&&null!=i.id&&t.push({...i,option_id:s.id}),this.selectedOptions={...this.selectedOptions,[e]:t}}else i&&null!=i.id&&(this.selectedOptions={...this.selectedOptions,[e]:[{...i,option_id:s.id}]});this.hasUnsavedChanges=!0,this.validationErrors=[]}async validateOptions(){if(!this.product?.options)return!0;const t=[],s=this.product.id,i=this.generateCacheKey(this.sectionId,this.productIndex,s),e=document.querySelector(`salla-product-options[product-id="${s}"]`);let n=[];if(e)try{n=await e.getSelectedOptions()||[];const t=this.selectedOptions[i]||[];(t.length>n.length||0===n.length&&t.length>0)&&(n=t)}catch(t){n=this.selectedOptions[i]||[]}else n=this.selectedOptions[i]||[];return 0===n.length&&t.push(salla.lang.get("pages.products.no_options_selected")),this.product.options.forEach((s=>{s.required&&(n.some((t=>t.option_id==s.id))||t.push(salla.lang.get("pages.products.required_option_missing",{option:s.name})))})),this.validationErrors=t,0===t.length}async onSave(t){t.preventDefault();const s=this.product?.id;if(!s)return;const i=this.generateCacheKey(this.sectionId,this.productIndex,s);if(await new Promise((t=>setTimeout(t,100))),await this.validateOptions()){if(!this.isProductAlreadySelected&&null!=this.sectionId){const t=this.host.closest("salla-multiple-bundle-product-details");if(!await(t?.canSelectBundleProduct(this.sectionId,s)))return void salla.notify.error(salla.lang.getWithDefault("pages.products.bundle_selection_limit_reached","لا يمكنك اختيار المزيد من المنتجات في هذا القسم"))}this.isLoading=!0;try{const t=document.querySelector(`salla-product-options[product-id="${s}"]`);let e=await(t?.getSelectedOptions());if((!e||0===e.length)&&this.selectedOptions[i]?.length>0&&(e=this.selectedOptions[i]),!e||0===e.length)return void(this.isLoading=!1);this.selectedOptions={...this.selectedOptions,[i]:e};const n=this.host.closest("form");if(!n)return void(this.isLoading=!1);const o=`bundle[${this.sectionId}][${this.productIndex}]`;Array.from(n.querySelectorAll(`input[name^="${o}"][type="hidden"]`)).forEach((t=>t.remove())),Array.from(n.querySelectorAll(`[data-product-id="${s}"][name^="${o}"]`)).forEach((t=>t.remove()));const l=`bundle[${this.sectionId}][${this.productIndex}][id]`,d=document.getElementById(l);if(d)d.checked=!0;else{const t=document.createElement("input");t.type="hidden",t.name=`bundle[${this.sectionId}][${this.productIndex}][id]`,t.value=String(s),t.dataset.productId=String(s),n.appendChild(t)}e.forEach((t=>{const i=t.option_id,e=document.createElement("input");e.type="hidden",e.name=this.generateFormInputName(this.sectionId,this.productIndex??0,i),e.value=String(t.id),e.dataset.productId=String(s),n.appendChild(e)}));const a=new window.Event("change",{bubbles:!0});n.dispatchEvent(a),this.optionsSaved.emit({productId:Number(s),selectedOptions:e,sectionId:this.sectionId,productIndex:this.productIndex}),this.sectionId&&this.productSelected.emit({productId:Number(s),sectionId:this.sectionId,product:this.product,fromModal:!0}),salla.notify.success(salla.lang.get("pages.products.options_saved")),this.hasUnsavedChanges=!1,this.validationErrors=[],this.modal.close()}catch(t){salla.notify.error(salla.lang.get("pages.products.options_save_error"))}finally{this.isLoading=!1}}else salla.notify.error(this.validationErrors.join(", "))}getOptionsWithSelectedState(){if(!this.product?.options)return[];const t=this.generateCacheKey(this.sectionId,this.productIndex,this.product.id),s=this.selectedOptions[t]||[];return this.product.options.map((t=>({...t,details:t.details.map((t=>{const i=s.some((s=>s.id===t.id));return{...t,is_selected:i}}))})))}render(){const t=this.product?.id,s=this.getOptionsWithSelectedState(),n=this.generateCacheKey(this.sectionId,this.productIndex,t),o=this.optionsResetTokens[n]||0,l=this.isLoading||s.some((t=>t.details.some((t=>t.is_selected&&!0===t.is_out))));return i(e,{key:"610ae038d4f9db109e3f25830e82b39a2b07a010"},i("salla-modal",{key:"b06c130448cd1862d2e879a0285fd385395cc11b",isLoading:this.isLoading,ref:t=>this.modal=t,width:"md",centered:!1,id:`s-multiple-bundle-product-options-modal-options-${t}`,class:"s-multiple-bundle-product-options-modal-wrapper"},i("div",{key:"1f8b9ffa80a40f8240ede4b8996943f7eecf4098",slot:"loading"},i("salla-skeleton",{key:"26463b16022e1f66fd66f4e9cd8907521352bac1",height:"100%",width:"100%"})),this.product?.images&&this.product?.images.length>0&&i("salla-slider",{key:"bae60782cbe4ac7dc325fd666258198cd871a52e",id:`details-slider-${this.product?.id}`,type:"thumbs",loop:!1,"auto-height":!0,"listen-to-thumbnails-option":!0,showThumbsControls:!1,controlsOuter:!1,showControls:!1,class:"s-multiple-bundle-product-options-modal-slider",verticalThumbs:!0,thumbsConfig:{centeredSlides:!0,centeredSlidesBounds:!0,slidesPerView:Math.min(5,Math.max(1,this.product?.images.length)),watchOverflow:!0,watchSlidesProgress:!0,direction:"vertical",spaceBetween:10}},i("div",{key:"998afc3297e89df7e0a6b2514a6d5f4f75152492",slot:"items"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,class:"swiper-slide"},i("img",{src:t.url,alt:t.alt||`${this.product?.name} - Image ${s+1}`,loading:"lazy",onError:t=>{t.target.style.display="none"}}))))),this.product?.images&&this.product?.images.length>1&&i("div",{key:"935a3d01a417926e904507d0a64da43c84924068",slot:"thumbs"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,"data-caption":`${this.product?.name} - Image ${s+1}`},i("img",{src:t.url,loading:"eager",class:"s-multiple-bundle-product-options-modal-slider-thumb",title:`${this.product?.name} - ${s+1}`,alt:t.alt||`${this.product?.name} - ${s+1}`,onError:t=>{t.target.style.display="none"}})))))),i("salla-product-options",{options:JSON.stringify(s),key:`${n}-reset-${o}`,"product-id":t,"unique-key":`${n}-reset-${o}`}),i("div",{key:"eeb710a27917f6134a2595ebb8e4ec485bb26254",slot:"footer"},i("div",{key:"2ae3d47c461b68d61fcaa1d8f279ae6402aedf2e",class:"s-multiple-bundle-product-options-modal-footer"},i("salla-button",{key:"436f64a89183f0e6d56b6800ad031449c49cc751",onClick:t=>this.onSave(t),loading:this.isLoading,disabled:l},this.isLoading?salla.lang.get("common.elements.saving"):salla.lang.get("common.elements.save"))))))}get host(){return n(this)}static get watchers(){return{product:["handleProductChange"]}}};d.style=":host{display:block}";const a=class{constructor(i){t(this,i),this.productSelected=s(this,"productSelected"),this.productOptionsSelected=s(this,"productOptionsSelected"),this.selectedProducts={},this.isSelectionLocked=!1,this.selectionLimit=0,this.savedOptionsByInstance={},this.handleProductClick=(t,s)=>{const i=this.selectedProducts[this.section.id]?.has(t.id)||!1,e=this.getCheckbox(this.section.id,s);if(i&&this.isSelectionLocked)return void(e&&(e.checked=!0));if(!i&&this.isMaxSelectionReached()&&1!==this.selectionLimit)return;if(1===this.selectionLimit&&!i)return void this.productSelected.emit({product:t,sectionId:this.section.id});if(!e)return;const n=!e.checked;n||(this.dispatchClearOptionsEvent(t,s),this.clearSavedOptionsState(this.section.id,s)),e.checked=n,requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});e.dispatchEvent(t)})),this.productSelected.emit({product:t,sectionId:this.section.id})},this.handleOptionsClick=t=>{!this.selectedProducts[this.section.id]?.has(t.id)&&this.isMaxSelectionReached()&&1!==this.selectionLimit||this.productOptionsSelected.emit({product:t,sectionId:this.section.id})}}getSelectedCount(){return this.selectedProducts[this.section?.id]?.size??0}isMaxSelectionReached(){return this.selectionLimit>1&&this.getSelectedCount()>=this.selectionLimit}isProductSelectionDisabled(t,s){return 0===t.quantity||!s&&this.isMaxSelectionReached()}getProductInstanceKey(t,s){return`${t}::${s}`}dispatchClearOptionsEvent(t,s){salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t.id,sectionId:this.section.id,sectionIndex:this.sectionIndex,productIndex:s})}handleOptionsSaved(t){const s=t.detail;if(!s)return;const{sectionId:i,productIndex:e,selectedOptions:n}=s;if(null==i||i!==this.section?.id)return;if(null==e||Number.isNaN(e))return;const o=this.getProductInstanceKey(i,e);if(n?.length)this.savedOptionsByInstance={...this.savedOptionsByInstance,[o]:!0};else if(this.savedOptionsByInstance[o]){const t={...this.savedOptionsByInstance};delete t[o],this.savedOptionsByInstance=t}}clearSavedOptionsState(t,s){const i=this.getProductInstanceKey(t,s);if(!this.savedOptionsByInstance[i])return;const e={...this.savedOptionsByInstance};delete e[i],this.savedOptionsByInstance=e}generateEventName(t,s){return`bundle[${t}][${s}][id]`}getCheckbox(t,s){const i=this.generateEventName(t,s);return this.host.querySelector(`input.s-multiple-bundle-product-checkbox[name="${i}"]`)}preventLockedDeselect(t,s){if(!this.isSelectionLocked||!s)return;t.preventDefault(),t.stopPropagation();const i=t.target;"checkbox"===i?.type&&(i.checked=!0)}render(){return i(e,{key:"e473b6089ee0e7026dfec042462ed827dabd0083"},i("salla-slider",{key:"492187e1a1c105c21c48543aa227888d122cfa20",type:"carousel",controlsOuter:!1,showControls:!1,id:`accordion-multiple-bundle-product-${this.section.id}`,pagination:!0,class:"s-multiple-bundle-product-wrapper-slider",sliderConfig:{spaceBetween:0}},i("div",{key:"e40e816439f3b3e1bee12ebdcea60438a45fec12",slot:"items"},this?.section?.products?.map(((t,s)=>{const e=this.selectedProducts[this.section.id]?.has(t.id)||!1,n=e&&this.isSelectionLocked,d=this.isProductSelectionDisabled(t,e),a=this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id,s)]?salla.lang.getWithDefault("pages.products.edit_selected_options","تعديل الخيارات"):salla.lang.get("pages.products.choose_from_options");let c=salla.config.get("theme.is_rtl",!0)?o:l;return i("div",{class:"s-multiple-bundle-product-slide-one-third"+(d?" s-multiple-bundle-product-slide-one-third-disabled":""),key:t.id},i("div",{class:"s-multiple-bundle-product-card"},i("div",{class:"s-multiple-bundle-product-image-wrapper",onClick:()=>this.handleProductClick(t,s)},i("input",{id:this.generateEventName(this.section.id,s),type:"checkbox",class:"s-multiple-bundle-product-checkbox",checked:e,"data-selection-locked":n?"true":void 0,name:this.generateEventName(this.section.id,s),value:t.id,onClick:t=>this.preventLockedDeselect(t,e),onChange:t=>this.preventLockedDeselect(t,e)}),i("img",{src:t.image.url||salla.url.cdn("images/s-empty.png"),loading:"lazy",alt:t.image.alt||t.name,class:"s-multiple-bundle-product-image"})),i("div",{class:"s-multiple-bundle-product-content-wrapper"},i("div",{class:"s-multiple-bundle-product-content"},i("div",{class:"s-multiple-bundle-product-details"},i("div",{class:"s-multiple-bundle-product-title-wrapper"},i("h2",{class:"s-multiple-bundle-product-title"},i("a",{href:t?.url||"#",target:"_blank",rel:"noopener noreferrer"},t.name))),i("div",{class:"s-multiple-bundle-product-price-wrapper"},i("span",{class:"s-multiple-bundle-product-price"},i("span",{innerHTML:salla.money(t.price)})),t.sale_price>0&&i("span",{class:"s-multiple-bundle-product-price-discount"},i("span",{innerHTML:salla.money(t.regular_price)})))),t.quantity_in_group>0&&0!==t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.pieces"),i("span",null,t.quantity_in_group)),0===t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.quantity_in_group_finished"))),t.options?.length>0&&i("button",{class:"s-multiple-bundle-product-button",onClick:()=>this.handleOptionsClick(t),type:"button"},a,i("span",{class:"s-multiple-bundle-product-button-icon",innerHTML:c})))))})))))}get host(){return n(this)}};a.style="";export{d as salla_multiple_bundle_product_options_modal,a as salla_multiple_bundle_product_slider}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r,h as e,H as n,F as t}from"./p-BsIeN-bg.js";function i(r,e){if("string"!=typeof r)return r??e;const n=r.trim();if(!n)return e;try{return JSON.parse(n)}catch{return e}}function o(r){if(r)return"string"==typeof r?i(r,void 0):r}function a(r,e="ar"){const[n,t]=String(r).trim().split(":").map(Number);if(!Number.isFinite(n)||!Number.isFinite(t))return r;const i=new Date(2e3,0,1,n,t),o={hour:"numeric",minute:"2-digit",hour12:!0};try{return i.toLocaleTimeString(e,o)}catch{return i.toLocaleTimeString("ar",o)}}const s=class{constructor(e){r(this,e),this.stackCards=!1,this.isLoading=!1}componentWillLoad(){return this.getBranchData()}async getBranchData(){const r=salla.config.get("page.id");if(r){this.isLoading=!0;try{const e=await salla.order.api.getBranchDetails(r);this.branchData=this.parseBranchResponse(e)}catch(r){this.notifyApiError(r)}finally{this.isLoading=!1}}}parseBranchResponse(r){const e=r?.data?.data||r?.data||r;return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"branch")?e.branch?o(e.branch):void 0:o(e)}getApiErrorMessage(r){return r?.response?.data?.error?.message||r?.response?.data?.message}notifyApiError(r){const e=this.getApiErrorMessage(r);e&&salla.notify.error(e)}label(r,e){return salla.lang.getWithDefault(r,e)}get preparationText(){const r=this.branchData?.preparation_time_range;if(!r?.from||!r?.to)return"";const e=salla.helpers.number(r.from.value),n=salla.helpers.number(r.to.value),t=this.unitLabel(r.to.unit),i=e===n?e:`⁦${e}-${n}⁩`;return this.label("pages.orders.pickup_ready_after","جاهز للاستلام بعد :time").replace(":time",`${i} ${t}`)}unitLabel(r){const e=function(r){const e=String(r||"hour").toLowerCase();return e.startsWith("min")?"minute":e.startsWith("day")?"day":"hour"}(r);return"minute"===e?this.label("pages.checkout.minute","دقيقة"):"day"===e?this.label("pages.checkout.day","يوم"):this.label("pages.checkout.hour","ساعة")}get workingHoursItems(){const r=this.branchData;if(!r)return[];if(!0===r.always_open||1===r.always_open||"1"===r.always_open)return[this.label("pages.orders.branch_always_open","مفتوح على مدار الساعة")];const e=salla.lang.locale||"ar";return(r.working_hours||[]).filter((r=>r?.name&&r.times?.length)).map((r=>{const n=r.times[0];return`${r.name}: ${a(n.from,e)} - ${a(n.to,e)}`}))}get branchAddress(){return this.branchData?.address||""}get mapUrl(){const r=this.branchData?.location;if(null!=r?.lat&&null!=r?.lng)return`https://www.google.com/maps?q=${r.lat},${r.lng}`}get phone(){return function(r){const e=i(r,null),n=e&&"object"==typeof e?e.phone:"";return"string"==typeof n?n.trim():""}(this.branchData?.contacts)}renderDetailsColumn(){const r=this.phone;return r?e("div",{class:"s-order-branch-details"},e("div",{class:"s-order-branch-info-card"},e("span",{class:"s-order-branch-info-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>phone-talking</title>\n<path d="M18.667 8c2.941 0 5.333 2.392 5.333 5.333 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-4.412-3.588-8-8-8-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM18.667 2.667c5.881 0 10.667 4.785 10.667 10.667 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-7.352-5.981-13.333-13.333-13.333-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM26.939 17.831c-1.568-1.568-4.119-1.568-5.689 0l-2.567 2.568c-3.064-1.499-5.584-4.019-7.083-7.083l2.569-2.567c1.567-1.569 1.567-4.121-0.001-5.689l-3.88-3.881c-1.521-1.521-4.169-1.521-5.691 0l-1.847 1.847c-2.22 2.22-3.183 5.408-2.573 8.527 1.979 10.144 10.127 18.292 20.271 20.271 0.617 0.121 1.236 0.18 1.851 0.18 2.491 0 4.895-0.972 6.676-2.752l1.847-1.847c1.569-1.569 1.569-4.12 0-5.689zM28.936 25.517l-1.847 1.847c-1.591 1.591-3.876 2.281-6.131 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.597-0.397 0.959-0.397s0.701 0.14 0.959 0.397l3.883 3.883c0.528 0.528 0.528 1.389 0 1.917l-3.22 3.219c-0.383 0.384-0.496 0.959-0.288 1.457 1.815 4.34 5.344 7.868 9.684 9.684 0.5 0.205 1.075 0.095 1.457-0.288l3.219-3.219c0.528-0.531 1.389-0.529 1.917-0.001l3.883 3.883c0.529 0.529 0.529 1.389 0 1.919z"></path>\n</svg>\n'}),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.orders.branch_contacts","ارقام التواصل")),e("span",{class:"s-order-branch-info-value",dir:"ltr"},r)))):null}renderWorkingHoursCard(){const r=this.workingHoursItems;return r.length?e("div",{class:"s-order-branch-info-card s-order-branch-hours-card"},e("span",{class:"s-order-branch-info-icon","aria-hidden":"true"},e("i",{class:"sicon-calendar-alt"})),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.checkout.working_hours","ساعات العمل")),e("div",{class:"s-order-branch-hours-list"},r.map((r=>e("span",{class:"s-order-branch-hours-item"},r)))))):null}renderBranchIdentityCard(){const r=this.branchData,n=this.branchAddress,t=this.preparationText;return e("section",{class:"s-order-branch-card"},e("div",{class:"s-order-branch-location"},e("div",{class:"s-order-branch-identity"},e("span",{class:"s-order-branch-store-icon"},e("i",{class:"sicon-store","aria-hidden":"true"})),e("div",{class:"s-order-branch-text"},e("div",{class:"s-order-branch-name-row"},r?.name?e("span",{class:"s-order-branch-name"},r.name):null,t?e("span",{class:"s-order-branch-ready"},t):null),n?e("span",{class:"s-order-branch-address"},n):null)),this.mapUrl?e("div",{class:"s-order-branch-actions"},e("a",{href:this.mapUrl,target:"_blank",rel:"noopener noreferrer",class:"s-order-branch-map-link"},e("span",null,this.label("pages.orders.branch_map","موقع الفرع علي الخريطة")),e("span",{class:"s-order-branch-action-icon",innerHTML:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.95448 2.79419C9.7395 1.84477 11.132 1.37005 11.881 2.11902C12.6299 2.86799 12.1552 4.2605 11.2058 7.04551L10.5593 8.94203C9.83014 11.0809 9.46556 12.1503 8.8646 12.2388C8.70303 12.2626 8.53577 12.2483 8.37592 12.197C7.78135 12.0061 7.46705 10.8785 6.83846 8.62339C6.69903 8.12319 6.62932 7.87308 6.47057 7.68206C6.4245 7.62662 6.37338 7.5755 6.31794 7.52943C6.12692 7.37068 5.87681 7.30097 5.37661 7.16154C3.12148 6.53295 1.99391 6.21865 1.80302 5.62408C1.7517 5.46423 1.73738 5.29698 1.76117 5.1354C1.84968 4.53444 2.91911 4.16986 5.05797 3.44072L6.95448 2.79419Z" stroke="currentColor" stroke-width="1.5"/>\n</svg>\n'}))):null))}render(){return this.isLoading||!this.branchData?e(n,{class:"s-order-branch-wrapper"}):e(n,{class:"s-order-branch-wrapper"},this.stackCards?e(t,null,this.renderBranchIdentityCard(),this.renderDetailsColumn()):e("div",{class:"s-order-branch-container"},this.renderBranchIdentityCard(),this.renderDetailsColumn()),this.renderWorkingHoursCard())}};s.style="/*!twlt*/:host{display:block}.s-order-branch-ready{background-color:color-mix(in srgb, var(--color-primary) 30%, transparent)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-order-branch-wrapper{margin-bottom:1.5rem;display:flex;flex-direction:column;gap:1rem;font-family:inherit}.s-order-branch-container{display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));align-items:stretch;gap:1rem}@media (min-width: 768px){.s-order-branch-container{grid-template-columns:repeat(2, minmax(0, 1fr))}}.s-order-branch-details{display:grid;align-content:stretch;gap:1rem}.s-order-branch-info-card{display:flex;min-height:68px;align-items:center;justify-content:space-between;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:0.75rem}.s-order-branch-info-text{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:3px;text-align:start}.s-order-branch-info-label{font-size:0.75rem;line-height:1rem;line-height:1.35;color:var(--color-text-secondary,#666)}.s-order-branch-info-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.875rem;line-height:1.25rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-hours-card .s-order-branch-info-text{gap:0.5rem}.s-order-branch-hours-list{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-hours-item{display:inline-flex;align-items:center;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-border,#eee);padding-left:0.625rem;padding-right:0.625rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-info-action{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:0.5rem;background-color:var(--color-surface-secondary,#f6f6f6);color:var(--color-text-primary,#2b2d34);text-decoration-line:none}.s-order-branch-info-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:22px;color:currentColor}.s-order-branch-info-icon svg{height:1.5rem;width:1.5rem;fill:currentColor}.s-order-branch-card{display:flex;flex-direction:column;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:1rem}@media (min-width: 768px){.s-order-branch-card{padding:1.25rem}}.s-order-branch-ready{display:inline-flex;flex-shrink:0;align-items:center;white-space:nowrap;border-radius:9999px;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.75rem;padding-right:0.75rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;color:var(--color-primary-dark,#0c2519)}.s-order-branch-location{display:flex;min-height:52px;flex-direction:column;align-items:stretch;justify-content:space-between;gap:1.5rem}@media (min-width: 768px){.s-order-branch-location{flex-direction:row;align-items:center}}.s-order-branch-identity{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.75rem}.s-order-branch-store-icon{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:1.5rem;line-height:2rem;color:var(--color-text-primary,#2b2d34)}.s-order-branch-store-icon svg{height:1em;width:1em;fill:currentColor}.s-order-branch-text{display:flex;min-width:0px;flex-direction:column;gap:0.25rem;text-align:start}.s-order-branch-name-row{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;line-height:1.5rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#2b2d34)}.s-order-branch-address{overflow-wrap:break-word;font-size:0.75rem;line-height:1rem;line-height:1.45;color:var(--color-text-secondary,#666)}.s-order-branch-actions{display:flex;flex-shrink:0;flex-wrap:wrap;align-items:center;gap:0.75rem}@media (min-width: 768px){.s-order-branch-actions{flex-wrap:nowrap}}.s-order-branch-map-link{display:inline-flex;min-height:2.25rem;align-items:center;justify-content:center;gap:0.5rem;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.875rem;padding-right:0.875rem;padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;line-height:1.2;color:var(--color-primary,#236e4c);text-decoration-line:none}.s-order-branch-action-icon{display:inline-flex;align-items:center;justify-content:center;font-size:0.875rem;line-height:1.25rem;color:currentColor}.s-order-branch-action-icon svg{height:1em;width:1em}";export{s as salla_order_branch}
4
+ import{r,h as e,H as n,F as t}from"./p-Q9lz4Iuq.js";function i(r,e){if("string"!=typeof r)return r??e;const n=r.trim();if(!n)return e;try{return JSON.parse(n)}catch{return e}}function o(r){if(r)return"string"==typeof r?i(r,void 0):r}function a(r,e="ar"){const[n,t]=String(r).trim().split(":").map(Number);if(!Number.isFinite(n)||!Number.isFinite(t))return r;const i=new Date(2e3,0,1,n,t),o={hour:"numeric",minute:"2-digit",hour12:!0};try{return i.toLocaleTimeString(e,o)}catch{return i.toLocaleTimeString("ar",o)}}const s=class{constructor(e){r(this,e),this.stackCards=!1,this.isLoading=!1}componentWillLoad(){return this.getBranchData()}async getBranchData(){const r=salla.config.get("page.id");if(r){this.isLoading=!0;try{const e=await salla.order.api.getBranchDetails(r);this.branchData=this.parseBranchResponse(e)}catch(r){this.notifyApiError(r)}finally{this.isLoading=!1}}}parseBranchResponse(r){const e=r?.data?.data||r?.data||r;return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"branch")?e.branch?o(e.branch):void 0:o(e)}getApiErrorMessage(r){return r?.response?.data?.error?.message||r?.response?.data?.message}notifyApiError(r){const e=this.getApiErrorMessage(r);e&&salla.notify.error(e)}label(r,e){return salla.lang.getWithDefault(r,e)}get preparationText(){const r=this.branchData?.preparation_time_range;if(!r?.from||!r?.to)return"";const e=salla.helpers.number(r.from.value),n=salla.helpers.number(r.to.value),t=this.unitLabel(r.to.unit),i=e===n?e:`⁦${e}-${n}⁩`;return this.label("pages.orders.pickup_ready_after","جاهز للاستلام بعد :time").replace(":time",`${i} ${t}`)}unitLabel(r){const e=function(r){const e=String(r||"hour").toLowerCase();return e.startsWith("min")?"minute":e.startsWith("day")?"day":"hour"}(r);return"minute"===e?this.label("pages.checkout.minute","دقيقة"):"day"===e?this.label("pages.checkout.day","يوم"):this.label("pages.checkout.hour","ساعة")}get workingHoursItems(){const r=this.branchData;if(!r)return[];if(!0===r.always_open||1===r.always_open||"1"===r.always_open)return[this.label("pages.orders.branch_always_open","مفتوح على مدار الساعة")];const e=salla.lang.locale||"ar";return(r.working_hours||[]).filter((r=>r?.name&&r.times?.length)).map((r=>{const n=r.times[0];return`${r.name}: ${a(n.from,e)} - ${a(n.to,e)}`}))}get branchAddress(){return this.branchData?.address||""}get mapUrl(){const r=this.branchData?.location;if(null!=r?.lat&&null!=r?.lng)return`https://www.google.com/maps?q=${r.lat},${r.lng}`}get phone(){return function(r){const e=i(r,null),n=e&&"object"==typeof e?e.phone:"";return"string"==typeof n?n.trim():""}(this.branchData?.contacts)}renderDetailsColumn(){const r=this.phone;return r?e("div",{class:"s-order-branch-details"},e("div",{class:"s-order-branch-info-card"},e("span",{class:"s-order-branch-info-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>phone-talking</title>\n<path d="M18.667 8c2.941 0 5.333 2.392 5.333 5.333 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-4.412-3.588-8-8-8-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM18.667 2.667c5.881 0 10.667 4.785 10.667 10.667 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-7.352-5.981-13.333-13.333-13.333-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM26.939 17.831c-1.568-1.568-4.119-1.568-5.689 0l-2.567 2.568c-3.064-1.499-5.584-4.019-7.083-7.083l2.569-2.567c1.567-1.569 1.567-4.121-0.001-5.689l-3.88-3.881c-1.521-1.521-4.169-1.521-5.691 0l-1.847 1.847c-2.22 2.22-3.183 5.408-2.573 8.527 1.979 10.144 10.127 18.292 20.271 20.271 0.617 0.121 1.236 0.18 1.851 0.18 2.491 0 4.895-0.972 6.676-2.752l1.847-1.847c1.569-1.569 1.569-4.12 0-5.689zM28.936 25.517l-1.847 1.847c-1.591 1.591-3.876 2.281-6.131 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.597-0.397 0.959-0.397s0.701 0.14 0.959 0.397l3.883 3.883c0.528 0.528 0.528 1.389 0 1.917l-3.22 3.219c-0.383 0.384-0.496 0.959-0.288 1.457 1.815 4.34 5.344 7.868 9.684 9.684 0.5 0.205 1.075 0.095 1.457-0.288l3.219-3.219c0.528-0.531 1.389-0.529 1.917-0.001l3.883 3.883c0.529 0.529 0.529 1.389 0 1.919z"></path>\n</svg>\n'}),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.orders.branch_contacts","ارقام التواصل")),e("span",{class:"s-order-branch-info-value",dir:"ltr"},r)))):null}renderWorkingHoursCard(){const r=this.workingHoursItems;return r.length?e("div",{class:"s-order-branch-info-card s-order-branch-hours-card"},e("span",{class:"s-order-branch-info-icon","aria-hidden":"true"},e("i",{class:"sicon-calendar-alt"})),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.checkout.working_hours","ساعات العمل")),e("div",{class:"s-order-branch-hours-list"},r.map((r=>e("span",{class:"s-order-branch-hours-item"},r)))))):null}renderBranchIdentityCard(){const r=this.branchData,n=this.branchAddress,t=this.preparationText;return e("section",{class:"s-order-branch-card"},e("div",{class:"s-order-branch-location"},e("div",{class:"s-order-branch-identity"},e("span",{class:"s-order-branch-store-icon"},e("i",{class:"sicon-store","aria-hidden":"true"})),e("div",{class:"s-order-branch-text"},e("div",{class:"s-order-branch-name-row"},r?.name?e("span",{class:"s-order-branch-name"},r.name):null,t?e("span",{class:"s-order-branch-ready"},t):null),n?e("span",{class:"s-order-branch-address"},n):null)),this.mapUrl?e("div",{class:"s-order-branch-actions"},e("a",{href:this.mapUrl,target:"_blank",rel:"noopener noreferrer",class:"s-order-branch-map-link"},e("span",null,this.label("pages.orders.branch_map","موقع الفرع علي الخريطة")),e("span",{class:"s-order-branch-action-icon",innerHTML:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.95448 2.79419C9.7395 1.84477 11.132 1.37005 11.881 2.11902C12.6299 2.86799 12.1552 4.2605 11.2058 7.04551L10.5593 8.94203C9.83014 11.0809 9.46556 12.1503 8.8646 12.2388C8.70303 12.2626 8.53577 12.2483 8.37592 12.197C7.78135 12.0061 7.46705 10.8785 6.83846 8.62339C6.69903 8.12319 6.62932 7.87308 6.47057 7.68206C6.4245 7.62662 6.37338 7.5755 6.31794 7.52943C6.12692 7.37068 5.87681 7.30097 5.37661 7.16154C3.12148 6.53295 1.99391 6.21865 1.80302 5.62408C1.7517 5.46423 1.73738 5.29698 1.76117 5.1354C1.84968 4.53444 2.91911 4.16986 5.05797 3.44072L6.95448 2.79419Z" stroke="currentColor" stroke-width="1.5"/>\n</svg>\n'}))):null))}render(){return this.isLoading||!this.branchData?e(n,{class:"s-order-branch-wrapper"}):e(n,{class:"s-order-branch-wrapper"},this.stackCards?e(t,null,this.renderBranchIdentityCard(),this.renderDetailsColumn()):e("div",{class:"s-order-branch-container"},this.renderBranchIdentityCard(),this.renderDetailsColumn()),this.renderWorkingHoursCard())}};s.style="/*!twlt*/:host{display:block}.s-order-branch-ready{background-color:color-mix(in srgb, var(--color-primary) 30%, transparent)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-order-branch-wrapper{margin-bottom:1.5rem;display:flex;flex-direction:column;gap:1rem;font-family:inherit}.s-order-branch-container{display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));align-items:stretch;gap:1rem}@media (min-width: 768px){.s-order-branch-container{grid-template-columns:repeat(2, minmax(0, 1fr))}}.s-order-branch-details{display:grid;align-content:stretch;gap:1rem}.s-order-branch-info-card{display:flex;min-height:68px;align-items:center;justify-content:space-between;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:0.75rem}.s-order-branch-info-text{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:3px;text-align:start}.s-order-branch-info-label{font-size:0.75rem;line-height:1rem;line-height:1.35;color:var(--color-text-secondary,#666)}.s-order-branch-info-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.875rem;line-height:1.25rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-hours-card .s-order-branch-info-text{gap:0.5rem}.s-order-branch-hours-list{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-hours-item{display:inline-flex;align-items:center;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-border,#eee);padding-left:0.625rem;padding-right:0.625rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-info-action{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:0.5rem;background-color:var(--color-surface-secondary,#f6f6f6);color:var(--color-text-primary,#2b2d34);text-decoration-line:none}.s-order-branch-info-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:22px;color:currentColor}.s-order-branch-info-icon svg{height:1.5rem;width:1.5rem;fill:currentColor}.s-order-branch-card{display:flex;flex-direction:column;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:1rem}@media (min-width: 768px){.s-order-branch-card{padding:1.25rem}}.s-order-branch-ready{display:inline-flex;flex-shrink:0;align-items:center;white-space:nowrap;border-radius:9999px;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.75rem;padding-right:0.75rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;color:var(--color-primary-dark,#0c2519)}.s-order-branch-location{display:flex;min-height:52px;flex-direction:column;align-items:stretch;justify-content:space-between;gap:1.5rem}@media (min-width: 768px){.s-order-branch-location{flex-direction:row;align-items:center}}.s-order-branch-identity{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.75rem}.s-order-branch-store-icon{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:1.5rem;line-height:2rem;color:var(--color-text-primary,#2b2d34)}.s-order-branch-store-icon svg{height:1em;width:1em;fill:currentColor}.s-order-branch-text{display:flex;min-width:0px;flex-direction:column;gap:0.25rem;text-align:start}.s-order-branch-name-row{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;line-height:1.5rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#2b2d34)}.s-order-branch-address{overflow-wrap:break-word;font-size:0.75rem;line-height:1rem;line-height:1.45;color:var(--color-text-secondary,#666)}.s-order-branch-actions{display:flex;flex-shrink:0;flex-wrap:wrap;align-items:center;gap:0.75rem}@media (min-width: 768px){.s-order-branch-actions{flex-wrap:nowrap}}.s-order-branch-map-link{display:inline-flex;min-height:2.25rem;align-items:center;justify-content:center;gap:0.5rem;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.875rem;padding-right:0.875rem;padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;line-height:1.2;color:var(--color-primary,#236e4c);text-decoration-line:none}.s-order-branch-action-icon{display:inline-flex;align-items:center;justify-content:center;font-size:0.875rem;line-height:1.25rem;color:currentColor}.s-order-branch-action-icon svg{height:1em;width:1em}";export{s as salla_order_branch}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as s,H as i,a as e}from"./p-BsIeN-bg.js";const a=class{constructor(s){t(this,s),this.menuOpen=!1,this.hasProducts=!1,this.specificMode=!1,this.selectedIds=[],this.loadedProductCount=0,this.isSharing=!1,this.shareUrl="",this.isListSyncPaused=!1,this.translationDefaults={"pages.wishlist.share":{ar:"شارك",en:"Share"},"pages.wishlist.share_all":{ar:"مشاركة القائمة",en:"Share the list"},"pages.wishlist.share_specific":{ar:"مشاركة منتجات محددة",en:"Share specific items"},"pages.wishlist.share_list_title":{ar:"مشاركة قائمة الأمنيات",en:"Share wishlist"},"pages.wishlist.select_all":{ar:"تحديد الكل",en:"Select all"},"common.elements.cancel":{ar:"إلغاء",en:"Cancel"}},this.onSelectionChanged=t=>{this.selectedIds=t?.ids||[],this.shareUrl="",this.socialShare?.close(),this.syncLoadedProductCount()},this.onDocumentClick=t=>{this.menuOpen&&!this.host.contains(t.target)&&(this.menuOpen=!1)},this.onProductsFetched=t=>{"wishlist"===t?.source&&(this.isListSyncPaused=!1,this.syncHasProducts(!!t?.data?.length),this.syncLoadedProductCount())}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.registerTranslationDefaults(),this.loadTranslations(),Salla.event.on("salla-products-list::selection.changed",this.onSelectionChanged),Salla.event.on("salla-products-list::products.fetched",this.onProductsFetched),document.addEventListener("click",this.onDocumentClick)}componentDidLoad(){this.initPageTitleAlignment(),this.productsList=this.host.parentElement?.querySelector("salla-products-list"),this.productsList?(this.syncHasProducts(),this.productsObserver=new MutationObserver((()=>{this.syncHasProducts()})),this.productsObserver.observe(this.productsList,{childList:!0,subtree:!0})):Salla.logger?.warn?.("[salla-wishlist-actions] no sibling salla-products-list found")}disconnectedCallback(){Salla.event.off("salla-products-list::selection.changed",this.onSelectionChanged),Salla.event.off("salla-products-list::products.fetched",this.onProductsFetched),document.removeEventListener("click",this.onDocumentClick),this.productsObserver?.disconnect(),this.pageTitleObserver?.disconnect(),this.pageTitleRetryTimeout&&window.clearTimeout(this.pageTitleRetryTimeout),this.resetPageTitleAlignment()}initPageTitleAlignment(){if(this.syncPageTitleAlignment(),this.pageTitle)return;requestAnimationFrame((()=>this.syncPageTitleAlignment())),this.pageTitleRetryTimeout=window.setTimeout((()=>this.syncPageTitleAlignment()),300);const t=this.host.closest(".main-content")??this.host.parentElement;t&&!this.pageTitle&&(this.pageTitleObserver=new MutationObserver((()=>{this.pageTitle?this.pageTitleObserver?.disconnect():(this.syncPageTitleAlignment(),this.pageTitle&&this.pageTitleObserver?.disconnect())})),this.pageTitleObserver.observe(t,{childList:!0,subtree:!0}))}findPageTitle(){const t=this.host.parentElement;if(t)for(const s of Array.from(t.children)){if(s===this.host)break;if("H1"===s.tagName)return s;const t=s.querySelector("h1");if(t)return t}const s=this.host.closest(".main-content");if(s){const t=s.querySelector("h1");if(t&&!this.host.contains(t))return t}return document.querySelector(".main-content h1, main h1")}syncPageTitleAlignment(){if(this.pageTitle)return;const t=this.findPageTitle();t&&(this.pageTitle=t,t.classList.add(a.pageTitleClass))}resetPageTitleAlignment(){this.pageTitle?.classList.remove(a.pageTitleClass),this.pageTitle=void 0}registerTranslationDefaults(){const t=Object.entries(this.translationDefaults).reduce(((t,[s,i])=>(Salla.lang.get(s)===s&&(t[s]=i),t)),{});Object.keys(t).length&&Salla.lang.addBulk(t)}loadTranslations(){this.shareLabel=Salla.lang.get("pages.wishlist.share"),this.shareAllLabel=Salla.lang.get("pages.wishlist.share_all"),this.shareSpecificLabel=Salla.lang.get("pages.wishlist.share_specific"),this.selectAllLabel=Salla.lang.get("pages.wishlist.select_all"),this.cancelLabel=Salla.lang.get("common.elements.cancel"),this.shareModalTitle=Salla.lang.get("pages.wishlist.share_list_title")}get selectedCount(){return this.selectedIds.length}get isAllSelected(){return this.loadedProductCount>0&&this.selectedCount===this.loadedProductCount}get isPartiallySelected(){return this.selectedCount>0&&this.selectedCount<this.loadedProductCount}async syncLoadedProductCount(){if(!this.productsList)return void(this.loadedProductCount=0);if(this.isListSyncPaused&&this.specificMode)return;const t=await this.productsList.getLoadedProducts();this.loadedProductCount=t.length}syncSelectAllCheckboxState(){this.selectAllCheckbox&&(this.selectAllCheckbox.checked=this.isAllSelected,this.selectAllCheckbox.indeterminate=this.isPartiallySelected)}componentDidRender(){this.syncSelectAllCheckboxState()}pauseListSync(){this.isListSyncPaused=!0,window.setTimeout((()=>{this.isListSyncPaused&&(this.isListSyncPaused=!1,this.syncHasProducts())}),3e3)}async syncHasProducts(t){if(!this.isListSyncPaused||"boolean"==typeof t){if("boolean"==typeof t)this.hasProducts=t;else if(this.productsList){const t=await this.productsList.getLoadedProducts();if(0===t.length&&this.specificMode)return;this.hasProducts=t.length>0,this.loadedProductCount=t.length}else this.hasProducts=!1,this.loadedProductCount=0;this.hasProducts||(this.menuOpen=!1,this.specificMode&&await this.cancelSpecific())}}toggleMenu(){this.hasProducts&&(this.menuOpen=!this.menuOpen)}async toggleSelectAll(){this.productsList&&(this.isAllSelected?await this.productsList.clearSelection():await this.productsList.selectAll())}async shareSpecific(){this.menuOpen=!1,this.specificMode=!0,this.pauseListSync(),this.productsList&&(this.productsList.selectable=!0)}async cancelSpecific(){this.specificMode=!1,this.selectedIds=[],this.pauseListSync(),this.productsList&&(await this.productsList.clearSelection(),this.productsList.selectable=!1)}async shareAll(){this.menuOpen=!1,await this.processShare([],!0)}async shareSelected(){this.selectedCount&&await this.processShare(this.selectedIds,!1)}async processShare(t,s=!1){if((s||t?.length)&&!this.isSharing){this.isSharing=!0;try{const i=await salla.wishlist.share(t,s),e=i?.data?.url||i?.url||"";if(!e||!this.socialShare)return;this.shareUrl=e,this.socialShare.url=e,await this.socialShare.refresh(),await this.socialShare.open()}catch(t){Salla.logger?.warn?.("[salla-wishlist-actions] share failed",t)}finally{this.isSharing=!1}}}render(){return s(i,{key:"de4a2a4d63c8b5564d94b8dc0fb44a8f3680b5c4"},s("div",{key:"6b8b55564d4309018e354aa59d78759023cd80e3",class:"s-wishlist-actions"},s("div",{key:"d7596fe51a790b13dadcacaaa22cbb571f66baf3",class:"s-wishlist-actions-bar flex items-center justify-end gap-3 mb-3"},s("div",{key:"acd83930774ca11cc9e8294f694a3a7376abbf1c",class:"s-wishlist-actions-dropdown relative"},s("salla-button",{key:"98d82f820182210e0e7ac0e8709adfcb6081475b",color:"primary",fill:"outline",type:"button",disabled:!this.hasProducts,"aria-haspopup":"true","aria-expanded":this.menuOpen?"true":"false",onClick:()=>this.toggleMenu()},s("div",{key:"67d68071fa2292a02f20b4fd7e4c2ac484b8a757",class:"flex flex-row justify-center items-center gap-2"},s("svg",{key:"7b711f7fe2af9fefc4d8c0d99b5f910a776deef0",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 32 32",style:{width:"16px",height:"16px"}},s("path",{key:"ea624787c3344073a5cef9b3e487232536666ffd",d:"M26.667 21.333c-1.699 0-3.196 0.812-4.173 2.052l-11.912-5.211c0.044-0.276 0.085-0.553 0.085-0.841 0-0.472-0.081-0.923-0.197-1.359l12.361-6.952c0.971 1.009 2.328 1.644 3.836 1.644 2.941 0 5.333-2.392 5.333-5.333s-2.392-5.333-5.333-5.333-5.333 2.392-5.333 5.333c0 0.472 0.081 0.923 0.197 1.359l-12.361 6.952c-0.971-1.009-2.328-1.644-3.836-1.644-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333c1.699 0 3.196-0.812 4.173-2.052l11.912 5.211c-0.044 0.276-0.085 0.553-0.085 0.841 0 2.941 2.392 5.333 5.333 5.333s5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM26.667 2.667c1.471 0 2.667 1.196 2.667 2.667s-1.196 2.667-2.667 2.667-2.667-1.196-2.667-2.667 1.196-2.667 2.667-2.667zM5.333 20c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667zM26.667 29.333c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"})),this.shareLabel,s("svg",{key:"e282eedc748300a522d39e47447c97952e8a8373",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 32 32",style:{width:"16px",height:"16px"}},s("path",{key:"ac4f11ce0b1401d3da483802a5ac32fe4a02c337",d:"M26.212 10.996c-0.556-0.484-1.396-0.428-1.881 0.127l-8.331 9.519-8.331-9.52c-0.485-0.555-1.327-0.611-1.881-0.125s-0.609 1.328-0.124 1.881l9.333 10.667c0.253 0.291 0.617 0.456 1.003 0.456s0.749-0.165 1.003-0.456l9.333-10.667c0.485-0.553 0.429-1.396-0.124-1.881z"})))),this.menuOpen&&s("ul",{key:"a066397a5700f00d3b0b66403886d41b7f21358b",class:"s-wishlist-actions-menu absolute z-20 mt-1 bg-white rounded-lg shadow overflow-hidden"},s("li",{key:"ee40d5a36486e8573f21671ffb53aece1443db15"},s("button",{key:"c686ae70fa97719ea926864de4a4bf767492f0ca",type:"button",class:"s-wishlist-actions-menu-item",onClick:()=>this.shareAll()},this.shareAllLabel)),s("li",{key:"96ccd67e69dc1a2f086f19614163779d29eb0dd3"},s("button",{key:"0cf1e565c12148c8f4fe875a2b37a78d50e8f959",type:"button",class:"s-wishlist-actions-menu-item",onClick:()=>this.shareSpecific()},this.shareSpecificLabel)))),s("salla-social-share",{key:"728c700ea2b44d766fea3f6c2e71a81c06365466",class:"s-wishlist-actions-social",ref:t=>this.socialShare=t,url:this.shareUrl,mode:"modal",modalTitle:this.shareModalTitle},s("span",{key:"59663da21c4433cf14461a3f9553ca69e9c4fbd6",slot:"widget",class:"s-wishlist-actions-social-anchor","aria-hidden":"true"}))),this.specificMode&&s("div",{key:"ab6c6a841da23bb3011a6f0ea2bfb8feb3bf8d3f",class:"s-wishlist-actions-panel flex items-center justify-between gap-4 flex-wrap p-4 mt-3 mb-3 bg-white rounded-lg"},s("label",{key:"95594e45d0a8445e77ceb58577543630f8439e9b",class:"s-wishlist-actions-panel-select-all flex items-center gap-2 cursor-pointer"},s("input",{key:"9652181ae51b2ac2fd5a1dfe26bb4c47e824d08b",type:"checkbox",class:"s-products-list-select-checkbox s-wishlist-actions-select-all",checked:this.isAllSelected,ref:t=>this.selectAllCheckbox=t,"aria-label":this.selectAllLabel,onChange:()=>this.toggleSelectAll()}),s("span",{key:"44edd31549879720fc75ae6d6750d8f0b5e263c2",class:"s-wishlist-actions-panel-title text-sm font-bold text-gray-700"},this.shareSpecificLabel," (",this.selectedCount,")")),s("div",{key:"d3f3ab61ed24868e2cff353f821406d71aa4377b",class:"s-wishlist-actions-panel-buttons flex items-center gap-2"},s("salla-button",{key:"c21a5e80fa4c69f9112249c86f6e17512d937b6e",class:"s-wishlist-actions-cancel",color:"light",fill:"outline",type:"button",onClick:()=>this.cancelSpecific()},this.cancelLabel),s("salla-button",{key:"1894863700ac921d131629eb21d6f38d89e29cc6",class:"s-wishlist-actions-share",color:"primary",fill:"outline",type:"button",disabled:!this.selectedCount,loading:this.isSharing,onClick:()=>this.shareSelected()},this.shareLabel)))))}get host(){return e(this)}};a.pageTitleClass="s-wishlist-actions-page-title",a.style='/*!twlt*/:host{display:block}.s-wishlist-actions-menu{min-width:200px;inset-inline-end:0;inset-inline-start:auto;list-style:none;margin:0;padding:4px 0;box-shadow:0 4px 16px rgba(0, 0, 0, 0.12)}.s-wishlist-actions-menu-item{display:block;width:100%;padding:10px 16px;text-align:start;font-size:0.875rem;color:#374151;background:transparent;cursor:pointer;white-space:nowrap}.s-wishlist-actions-menu-item:hover{background-color:#f3f4f6;color:var(--color-primary)}.s-wishlist-actions-panel{box-shadow:0 1px 3px rgba(0, 0, 0, 0.08)}.s-wishlist-actions-panel-select-all{user-select:none}.s-wishlist-actions-select-all:indeterminate,.s-wishlist-actions-select-all:indeterminate:hover,.s-wishlist-actions-select-all:indeterminate:focus{background-color:var(--color-primary);border-color:var(--color-primary)}.s-wishlist-actions-select-all:indeterminate::after{content:"";position:absolute;top:50%;left:50%;width:10px;height:2px;background:#fff;border:none;transform:translate(-50%, -50%)}.s-wishlist-actions-social-anchor{display:none}h1.s-wishlist-actions-page-title{text-align:start !important}.static{position:static}.absolute{position:absolute}.relative{position:relative}.z-20{z-index:20}.mb-3{margin-bottom:0.75rem}.mt-1{margin-top:0.25rem}.mt-3{margin-top:0.75rem}.flex{display:flex}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:0.5rem}.gap-3{gap:0.75rem}.gap-4{gap:1rem}.overflow-hidden{overflow:hidden}.rounded-lg{border-radius:0.5rem}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.p-4{padding:1rem}.text-sm{font-size:0.875rem;line-height:1.25rem}.font-bold{font-weight:700}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}';export{a as salla_wishlist_actions}
4
+ import{r as t,h as s,H as i,a as e}from"./p-Q9lz4Iuq.js";const a=class{constructor(s){t(this,s),this.menuOpen=!1,this.hasProducts=!1,this.specificMode=!1,this.selectedIds=[],this.loadedProductCount=0,this.isSharing=!1,this.shareUrl="",this.isListSyncPaused=!1,this.translationDefaults={"pages.wishlist.share":{ar:"شارك",en:"Share"},"pages.wishlist.share_all":{ar:"مشاركة القائمة",en:"Share the list"},"pages.wishlist.share_specific":{ar:"مشاركة منتجات محددة",en:"Share specific items"},"pages.wishlist.share_list_title":{ar:"مشاركة قائمة الأمنيات",en:"Share wishlist"},"pages.wishlist.select_all":{ar:"تحديد الكل",en:"Select all"},"common.elements.cancel":{ar:"إلغاء",en:"Cancel"}},this.onSelectionChanged=t=>{this.selectedIds=t?.ids||[],this.shareUrl="",this.socialShare?.close(),this.syncLoadedProductCount()},this.onDocumentClick=t=>{this.menuOpen&&!this.host.contains(t.target)&&(this.menuOpen=!1)},this.onProductsFetched=t=>{"wishlist"===t?.source&&(this.isListSyncPaused=!1,this.syncHasProducts(!!t?.data?.length),this.syncLoadedProductCount())}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.registerTranslationDefaults(),this.loadTranslations(),Salla.event.on("salla-products-list::selection.changed",this.onSelectionChanged),Salla.event.on("salla-products-list::products.fetched",this.onProductsFetched),document.addEventListener("click",this.onDocumentClick)}componentDidLoad(){this.initPageTitleAlignment(),this.productsList=this.host.parentElement?.querySelector("salla-products-list"),this.productsList?(this.syncHasProducts(),this.productsObserver=new MutationObserver((()=>{this.syncHasProducts()})),this.productsObserver.observe(this.productsList,{childList:!0,subtree:!0})):Salla.logger?.warn?.("[salla-wishlist-actions] no sibling salla-products-list found")}disconnectedCallback(){Salla.event.off("salla-products-list::selection.changed",this.onSelectionChanged),Salla.event.off("salla-products-list::products.fetched",this.onProductsFetched),document.removeEventListener("click",this.onDocumentClick),this.productsObserver?.disconnect(),this.pageTitleObserver?.disconnect(),this.pageTitleRetryTimeout&&window.clearTimeout(this.pageTitleRetryTimeout),this.resetPageTitleAlignment()}initPageTitleAlignment(){if(this.syncPageTitleAlignment(),this.pageTitle)return;requestAnimationFrame((()=>this.syncPageTitleAlignment())),this.pageTitleRetryTimeout=window.setTimeout((()=>this.syncPageTitleAlignment()),300);const t=this.host.closest(".main-content")??this.host.parentElement;t&&!this.pageTitle&&(this.pageTitleObserver=new MutationObserver((()=>{this.pageTitle?this.pageTitleObserver?.disconnect():(this.syncPageTitleAlignment(),this.pageTitle&&this.pageTitleObserver?.disconnect())})),this.pageTitleObserver.observe(t,{childList:!0,subtree:!0}))}findPageTitle(){const t=this.host.parentElement;if(t)for(const s of Array.from(t.children)){if(s===this.host)break;if("H1"===s.tagName)return s;const t=s.querySelector("h1");if(t)return t}const s=this.host.closest(".main-content");if(s){const t=s.querySelector("h1");if(t&&!this.host.contains(t))return t}return document.querySelector(".main-content h1, main h1")}syncPageTitleAlignment(){if(this.pageTitle)return;const t=this.findPageTitle();t&&(this.pageTitle=t,t.classList.add(a.pageTitleClass))}resetPageTitleAlignment(){this.pageTitle?.classList.remove(a.pageTitleClass),this.pageTitle=void 0}registerTranslationDefaults(){const t=Object.entries(this.translationDefaults).reduce(((t,[s,i])=>(Salla.lang.get(s)===s&&(t[s]=i),t)),{});Object.keys(t).length&&Salla.lang.addBulk(t)}loadTranslations(){this.shareLabel=Salla.lang.get("pages.wishlist.share"),this.shareAllLabel=Salla.lang.get("pages.wishlist.share_all"),this.shareSpecificLabel=Salla.lang.get("pages.wishlist.share_specific"),this.selectAllLabel=Salla.lang.get("pages.wishlist.select_all"),this.cancelLabel=Salla.lang.get("common.elements.cancel"),this.shareModalTitle=Salla.lang.get("pages.wishlist.share_list_title")}get selectedCount(){return this.selectedIds.length}get isAllSelected(){return this.loadedProductCount>0&&this.selectedCount===this.loadedProductCount}get isPartiallySelected(){return this.selectedCount>0&&this.selectedCount<this.loadedProductCount}async syncLoadedProductCount(){if(!this.productsList)return void(this.loadedProductCount=0);if(this.isListSyncPaused&&this.specificMode)return;const t=await this.productsList.getLoadedProducts();this.loadedProductCount=t.length}syncSelectAllCheckboxState(){this.selectAllCheckbox&&(this.selectAllCheckbox.checked=this.isAllSelected,this.selectAllCheckbox.indeterminate=this.isPartiallySelected)}componentDidRender(){this.syncSelectAllCheckboxState()}pauseListSync(){this.isListSyncPaused=!0,window.setTimeout((()=>{this.isListSyncPaused&&(this.isListSyncPaused=!1,this.syncHasProducts())}),3e3)}async syncHasProducts(t){if(!this.isListSyncPaused||"boolean"==typeof t){if("boolean"==typeof t)this.hasProducts=t;else if(this.productsList){const t=await this.productsList.getLoadedProducts();if(0===t.length&&this.specificMode)return;this.hasProducts=t.length>0,this.loadedProductCount=t.length}else this.hasProducts=!1,this.loadedProductCount=0;this.hasProducts||(this.menuOpen=!1,this.specificMode&&await this.cancelSpecific())}}toggleMenu(){this.hasProducts&&(this.menuOpen=!this.menuOpen)}async toggleSelectAll(){this.productsList&&(this.isAllSelected?await this.productsList.clearSelection():await this.productsList.selectAll())}async shareSpecific(){this.menuOpen=!1,this.specificMode=!0,this.pauseListSync(),this.productsList&&(this.productsList.selectable=!0)}async cancelSpecific(){this.specificMode=!1,this.selectedIds=[],this.pauseListSync(),this.productsList&&(await this.productsList.clearSelection(),this.productsList.selectable=!1)}async shareAll(){this.menuOpen=!1,await this.processShare([],!0)}async shareSelected(){this.selectedCount&&await this.processShare(this.selectedIds,!1)}async processShare(t,s=!1){if((s||t?.length)&&!this.isSharing){this.isSharing=!0;try{const i=await salla.wishlist.share(t,s),e=i?.data?.url||i?.url||"";if(!e||!this.socialShare)return;this.shareUrl=e,this.socialShare.url=e,await this.socialShare.refresh(),await this.socialShare.open()}catch(t){Salla.logger?.warn?.("[salla-wishlist-actions] share failed",t)}finally{this.isSharing=!1}}}render(){return s(i,{key:"de4a2a4d63c8b5564d94b8dc0fb44a8f3680b5c4"},s("div",{key:"6b8b55564d4309018e354aa59d78759023cd80e3",class:"s-wishlist-actions"},s("div",{key:"d7596fe51a790b13dadcacaaa22cbb571f66baf3",class:"s-wishlist-actions-bar flex items-center justify-end gap-3 mb-3"},s("div",{key:"acd83930774ca11cc9e8294f694a3a7376abbf1c",class:"s-wishlist-actions-dropdown relative"},s("salla-button",{key:"98d82f820182210e0e7ac0e8709adfcb6081475b",color:"primary",fill:"outline",type:"button",disabled:!this.hasProducts,"aria-haspopup":"true","aria-expanded":this.menuOpen?"true":"false",onClick:()=>this.toggleMenu()},s("div",{key:"67d68071fa2292a02f20b4fd7e4c2ac484b8a757",class:"flex flex-row justify-center items-center gap-2"},s("svg",{key:"7b711f7fe2af9fefc4d8c0d99b5f910a776deef0",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 32 32",style:{width:"16px",height:"16px"}},s("path",{key:"ea624787c3344073a5cef9b3e487232536666ffd",d:"M26.667 21.333c-1.699 0-3.196 0.812-4.173 2.052l-11.912-5.211c0.044-0.276 0.085-0.553 0.085-0.841 0-0.472-0.081-0.923-0.197-1.359l12.361-6.952c0.971 1.009 2.328 1.644 3.836 1.644 2.941 0 5.333-2.392 5.333-5.333s-2.392-5.333-5.333-5.333-5.333 2.392-5.333 5.333c0 0.472 0.081 0.923 0.197 1.359l-12.361 6.952c-0.971-1.009-2.328-1.644-3.836-1.644-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333c1.699 0 3.196-0.812 4.173-2.052l11.912 5.211c-0.044 0.276-0.085 0.553-0.085 0.841 0 2.941 2.392 5.333 5.333 5.333s5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM26.667 2.667c1.471 0 2.667 1.196 2.667 2.667s-1.196 2.667-2.667 2.667-2.667-1.196-2.667-2.667 1.196-2.667 2.667-2.667zM5.333 20c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667zM26.667 29.333c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"})),this.shareLabel,s("svg",{key:"e282eedc748300a522d39e47447c97952e8a8373",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 32 32",style:{width:"16px",height:"16px"}},s("path",{key:"ac4f11ce0b1401d3da483802a5ac32fe4a02c337",d:"M26.212 10.996c-0.556-0.484-1.396-0.428-1.881 0.127l-8.331 9.519-8.331-9.52c-0.485-0.555-1.327-0.611-1.881-0.125s-0.609 1.328-0.124 1.881l9.333 10.667c0.253 0.291 0.617 0.456 1.003 0.456s0.749-0.165 1.003-0.456l9.333-10.667c0.485-0.553 0.429-1.396-0.124-1.881z"})))),this.menuOpen&&s("ul",{key:"a066397a5700f00d3b0b66403886d41b7f21358b",class:"s-wishlist-actions-menu absolute z-20 mt-1 bg-white rounded-lg shadow overflow-hidden"},s("li",{key:"ee40d5a36486e8573f21671ffb53aece1443db15"},s("button",{key:"c686ae70fa97719ea926864de4a4bf767492f0ca",type:"button",class:"s-wishlist-actions-menu-item",onClick:()=>this.shareAll()},this.shareAllLabel)),s("li",{key:"96ccd67e69dc1a2f086f19614163779d29eb0dd3"},s("button",{key:"0cf1e565c12148c8f4fe875a2b37a78d50e8f959",type:"button",class:"s-wishlist-actions-menu-item",onClick:()=>this.shareSpecific()},this.shareSpecificLabel)))),s("salla-social-share",{key:"728c700ea2b44d766fea3f6c2e71a81c06365466",class:"s-wishlist-actions-social",ref:t=>this.socialShare=t,url:this.shareUrl,mode:"modal",modalTitle:this.shareModalTitle},s("span",{key:"59663da21c4433cf14461a3f9553ca69e9c4fbd6",slot:"widget",class:"s-wishlist-actions-social-anchor","aria-hidden":"true"}))),this.specificMode&&s("div",{key:"ab6c6a841da23bb3011a6f0ea2bfb8feb3bf8d3f",class:"s-wishlist-actions-panel flex items-center justify-between gap-4 flex-wrap p-4 mt-3 mb-3 bg-white rounded-lg"},s("label",{key:"95594e45d0a8445e77ceb58577543630f8439e9b",class:"s-wishlist-actions-panel-select-all flex items-center gap-2 cursor-pointer"},s("input",{key:"9652181ae51b2ac2fd5a1dfe26bb4c47e824d08b",type:"checkbox",class:"s-products-list-select-checkbox s-wishlist-actions-select-all",checked:this.isAllSelected,ref:t=>this.selectAllCheckbox=t,"aria-label":this.selectAllLabel,onChange:()=>this.toggleSelectAll()}),s("span",{key:"44edd31549879720fc75ae6d6750d8f0b5e263c2",class:"s-wishlist-actions-panel-title text-sm font-bold text-gray-700"},this.shareSpecificLabel," (",this.selectedCount,")")),s("div",{key:"d3f3ab61ed24868e2cff353f821406d71aa4377b",class:"s-wishlist-actions-panel-buttons flex items-center gap-2"},s("salla-button",{key:"c21a5e80fa4c69f9112249c86f6e17512d937b6e",class:"s-wishlist-actions-cancel",color:"light",fill:"outline",type:"button",onClick:()=>this.cancelSpecific()},this.cancelLabel),s("salla-button",{key:"1894863700ac921d131629eb21d6f38d89e29cc6",class:"s-wishlist-actions-share",color:"primary",fill:"outline",type:"button",disabled:!this.selectedCount,loading:this.isSharing,onClick:()=>this.shareSelected()},this.shareLabel)))))}get host(){return e(this)}};a.pageTitleClass="s-wishlist-actions-page-title",a.style='/*!twlt*/:host{display:block}.s-wishlist-actions-menu{min-width:200px;inset-inline-end:0;inset-inline-start:auto;list-style:none;margin:0;padding:4px 0;box-shadow:0 4px 16px rgba(0, 0, 0, 0.12)}.s-wishlist-actions-menu-item{display:block;width:100%;padding:10px 16px;text-align:start;font-size:0.875rem;color:#374151;background:transparent;cursor:pointer;white-space:nowrap}.s-wishlist-actions-menu-item:hover{background-color:#f3f4f6;color:var(--color-primary)}.s-wishlist-actions-panel{box-shadow:0 1px 3px rgba(0, 0, 0, 0.08)}.s-wishlist-actions-panel-select-all{user-select:none}.s-wishlist-actions-select-all:indeterminate,.s-wishlist-actions-select-all:indeterminate:hover,.s-wishlist-actions-select-all:indeterminate:focus{background-color:var(--color-primary);border-color:var(--color-primary)}.s-wishlist-actions-select-all:indeterminate::after{content:"";position:absolute;top:50%;left:50%;width:10px;height:2px;background:#fff;border:none;transform:translate(-50%, -50%)}.s-wishlist-actions-social-anchor{display:none}h1.s-wishlist-actions-page-title{text-align:start !important}.static{position:static}.absolute{position:absolute}.relative{position:relative}.z-20{z-index:20}.mb-3{margin-bottom:0.75rem}.mt-1{margin-top:0.25rem}.mt-3{margin-top:0.75rem}.flex{display:flex}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:0.5rem}.gap-3{gap:0.75rem}.gap-4{gap:1rem}.overflow-hidden{overflow:hidden}.rounded-lg{border-radius:0.5rem}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.p-4{padding:1rem}.text-sm{font-size:0.875rem;line-height:1.25rem}.font-bold{font-weight:700}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}';export{a as salla_wishlist_actions}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as a,H as l,a as r}from"./p-BsIeN-bg.js";const i=class{constructor(a){t(this,a),this.alertDelay=null,this.data=salla.config.get("store.app_install_prompt"),this.open=!1,this.closing=!1}connectedCallback(){salla.onReady((()=>{if(this.data=salla.config.get("store.app_install_prompt"),this.isMobileOrTabletDevice()){if(!this.data)return salla.logger.error("Failed to retrieve salla-app-install-alert config");this.ctaLink=salla.url.get("app"),this.alertDelay=setTimeout((()=>this.open=!0),3e3)}}))}disconnectedCallback(){clearTimeout(this.alertDelay)}isMobileOrTabletDevice(t=1024){if("undefined"==typeof window||"undefined"==typeof navigator||"undefined"==typeof document)return!1;const a=window.matchMedia(`(max-width: ${t}px)`).matches,l=/Macintosh|Android|iPhone|iPad|iPod/i.test(navigator.userAgent),r="ontouchstart"in window||"ontouchend"in document||navigator.maxTouchPoints>0;return l&&a&&r}closeAlert(){salla.storage.set("app_install_prompt_disabled",!0),this.closing=!0,this.host.addEventListener("animationend",(()=>{this.closing=!1,this.open=!1}),{once:!0})}shouldShowAlert(){return!salla.config.isMobileApp()}render(){return this.data&&this.shouldShowAlert()?a(l,{class:`s-app-install-alert-wrapper ${this.open?"open":""} ${this.closing?"closing":""}`,position:this.data.position},a("div",null,a("img",{src:this.data.icon,width:"58",height:"58",alt:`${salla.config.get("store.name")}`})),a("div",{class:"s-app-install-alert-content"},a("h2",{class:"s-app-install-alert-title"},this.data.title),a("p",{class:"s-app-install-alert-sub-title"},this.data.sub_title," "," ",a("a",{href:this.ctaLink,target:"_blank","aria-label":"download app",class:"s-app-install-alert-cta"},salla.lang.getWithDefault("blocks.footer.download_app_now","حمله الآن")))),a("button",{class:"s-app-install-alert-cancel-button","aria-label":"close alert",onClick:()=>this.closeAlert()},a("i",{class:"sicon-cancel"}))):null}get host(){return r(this)}};i.style='/*!twlt*/:host{display:block}.s-app-install-alert-wrapper{display:none;flex-direction:row;align-items:center;position:fixed;left:0;right:0;width:95%;margin-top:1rem;margin-bottom:1rem;margin-left:auto;margin-right:auto;z-index:999;border-radius:0.375rem;padding:0.75rem;gap:0.5rem;background-color:color-mix(in srgb, var(--color-primary) 15%, white);filter:drop-shadow(0 4px 3px rgba(0, 0, 0, 0.07)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.06))}.s-app-install-alert-wrapper.open[position=top]{display:flex;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes slideDownFromTop{0%{transform:translateY(-100%);opacity:0}100%{transform:translateY(-0%);opacity:1}}.s-app-install-alert-wrapper.open[position=top]{animation:slideDownFromTop .6s linear;transition-duration:500ms}.s-app-install-alert-wrapper:not(.open){display:none}.s-app-install-alert-content{width:100%}.s-app-install-alert-wrapper[position=top]{top:0px}.s-app-install-alert-wrapper.open[position=bottom]{display:flex}@keyframes slideUpFromBottom{0%{transform:translateY(100%);opacity:0}100%{transform:translateY(0%);opacity:1}}.s-app-install-alert-wrapper.open[position=bottom]{animation:slideUpFromBottom .6s linear}.s-app-install-alert-wrapper[position=bottom]{bottom:0px}@keyframes slideUPFromTop{0%{transform:translateY(-0%);opacity:1}100%{transform:translateY(-100%);opacity:0}}.s-app-install-alert-wrapper[position=top].closing{animation:slideUPFromTop .6s linear}@keyframes slideDownFromBottom{0%{transform:translateY(0%);opacity:1}100%{transform:translateY(100%);opacity:0}}.s-app-install-alert-wrapper[position=bottom].closing{animation:slideDownFromBottom .6s linear}.s-app-install-alert-wrapper.closing{animation-fill-mode:forwards}.s-app-install-alert-title{max-width:95%;font-size:1rem;line-height:1.5rem;font-weight:700;color:var(--color-primary)}.s-app-install-alert-sub-title{max-width:95%;font-size:0.875rem;line-height:1.25rem;font-weight:400}.s-app-install-alert-cta{color:var(--color-primary);text-decoration-line:underline}.s-app-install-alert-cancel-button{position:absolute;top:0.5rem}.s-app-install-alert-cancel-button:where([dir="ltr"],[dir="ltr"] *){right:0.75rem}.s-app-install-alert-cancel-button:where([dir="rtl"],[dir="rtl"] *){left:0.75rem}';export{i as salla_app_install_alert}
4
+ import{r as t,h as a,H as l,a as r}from"./p-Q9lz4Iuq.js";const i=class{constructor(a){t(this,a),this.alertDelay=null,this.data=salla.config.get("store.app_install_prompt"),this.open=!1,this.closing=!1}connectedCallback(){salla.onReady((()=>{if(this.data=salla.config.get("store.app_install_prompt"),this.isMobileOrTabletDevice()){if(!this.data)return salla.logger.error("Failed to retrieve salla-app-install-alert config");this.ctaLink=salla.url.get("app"),this.alertDelay=setTimeout((()=>this.open=!0),3e3)}}))}disconnectedCallback(){clearTimeout(this.alertDelay)}isMobileOrTabletDevice(t=1024){if("undefined"==typeof window||"undefined"==typeof navigator||"undefined"==typeof document)return!1;const a=window.matchMedia(`(max-width: ${t}px)`).matches,l=/Macintosh|Android|iPhone|iPad|iPod/i.test(navigator.userAgent),r="ontouchstart"in window||"ontouchend"in document||navigator.maxTouchPoints>0;return l&&a&&r}closeAlert(){salla.storage.set("app_install_prompt_disabled",!0),this.closing=!0,this.host.addEventListener("animationend",(()=>{this.closing=!1,this.open=!1}),{once:!0})}shouldShowAlert(){return!salla.config.isMobileApp()}render(){return this.data&&this.shouldShowAlert()?a(l,{class:`s-app-install-alert-wrapper ${this.open?"open":""} ${this.closing?"closing":""}`,position:this.data.position},a("div",null,a("img",{src:this.data.icon,width:"58",height:"58",alt:`${salla.config.get("store.name")}`})),a("div",{class:"s-app-install-alert-content"},a("h2",{class:"s-app-install-alert-title"},this.data.title),a("p",{class:"s-app-install-alert-sub-title"},this.data.sub_title," "," ",a("a",{href:this.ctaLink,target:"_blank","aria-label":"download app",class:"s-app-install-alert-cta"},salla.lang.getWithDefault("blocks.footer.download_app_now","حمله الآن")))),a("button",{class:"s-app-install-alert-cancel-button","aria-label":"close alert",onClick:()=>this.closeAlert()},a("i",{class:"sicon-cancel"}))):null}get host(){return r(this)}};i.style='/*!twlt*/:host{display:block}.s-app-install-alert-wrapper{display:none;flex-direction:row;align-items:center;position:fixed;left:0;right:0;width:95%;margin-top:1rem;margin-bottom:1rem;margin-left:auto;margin-right:auto;z-index:999;border-radius:0.375rem;padding:0.75rem;gap:0.5rem;background-color:color-mix(in srgb, var(--color-primary) 15%, white);filter:drop-shadow(0 4px 3px rgba(0, 0, 0, 0.07)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.06))}.s-app-install-alert-wrapper.open[position=top]{display:flex;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes slideDownFromTop{0%{transform:translateY(-100%);opacity:0}100%{transform:translateY(-0%);opacity:1}}.s-app-install-alert-wrapper.open[position=top]{animation:slideDownFromTop .6s linear;transition-duration:500ms}.s-app-install-alert-wrapper:not(.open){display:none}.s-app-install-alert-content{width:100%}.s-app-install-alert-wrapper[position=top]{top:0px}.s-app-install-alert-wrapper.open[position=bottom]{display:flex}@keyframes slideUpFromBottom{0%{transform:translateY(100%);opacity:0}100%{transform:translateY(0%);opacity:1}}.s-app-install-alert-wrapper.open[position=bottom]{animation:slideUpFromBottom .6s linear}.s-app-install-alert-wrapper[position=bottom]{bottom:0px}@keyframes slideUPFromTop{0%{transform:translateY(-0%);opacity:1}100%{transform:translateY(-100%);opacity:0}}.s-app-install-alert-wrapper[position=top].closing{animation:slideUPFromTop .6s linear}@keyframes slideDownFromBottom{0%{transform:translateY(0%);opacity:1}100%{transform:translateY(100%);opacity:0}}.s-app-install-alert-wrapper[position=bottom].closing{animation:slideDownFromBottom .6s linear}.s-app-install-alert-wrapper.closing{animation-fill-mode:forwards}.s-app-install-alert-title{max-width:95%;font-size:1rem;line-height:1.5rem;font-weight:700;color:var(--color-primary)}.s-app-install-alert-sub-title{max-width:95%;font-size:0.875rem;line-height:1.25rem;font-weight:400}.s-app-install-alert-cta{color:var(--color-primary);text-decoration-line:underline}.s-app-install-alert-cancel-button{position:absolute;top:0.5rem}.s-app-install-alert-cancel-button:where([dir="ltr"],[dir="ltr"] *){right:0.75rem}.s-app-install-alert-cancel-button:where([dir="rtl"],[dir="rtl"] *){left:0.75rem}';export{i as salla_app_install_alert}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as t,H as i}from"./p-BsIeN-bg.js";const r=class{constructor(t){s(this,t),this.placeholderImage=salla.url.cdn("images/s-empty.png")}getProductImage(){return this.productDetails?.image?"string"==typeof this.productDetails.image?this.productDetails.image:this.productDetails.image.url||this.placeholderImage||salla.url.cdn("images/s-empty.png"):this.placeholderImage}getProductImageAlt(){return this.productDetails?.image&&"string"!=typeof this.productDetails.image?this.productDetails.image.alt||this.productDetails?.name||"":this.productDetails?.name||""}getAccordionId(){return`accordion-${this.productDetails?.id||"default"}`}getAccordionKey(){return this.productDetails?.id||"default"}shouldBeCollapsible(){return void 0!==this.collapsible?this.collapsible:this.productDetails?.options?.length>0}renderOptions(){return this.productDetails?.options?.length?t("salla-accordion-body",null,t("div",{class:"s-order-details-options"},t("salla-order-details-options",{options:this.productDetails.options}))):null}render(){if(!this.productDetails)return null;const s=this.shouldBeCollapsible();return t(i,{class:"s-order-details-bundle-wrapper"},t("salla-accordion",{key:this.getAccordionKey(),collapsed:!1,bordered:!0,collapsible:s,id:this.getAccordionId(),size:"sm"},t("salla-accordion-head",null,t("div",{class:"s-order-details-product"},t("div",{class:"s-order-details-product-content"},t("div",{class:"s-order-details-product-info"},t("div",{class:"s-order-details-product-image"},t("img",{src:this.getProductImage(),alt:this.getProductImageAlt()})),t("div",{class:"s-order-details-product-details"},t("a",{href:this.productDetails?.url||"#",class:"s-order-details-product-name"},this.productDetails?.name||""),this.productDetails?.quantity&&t("span",{class:"s-order-details-product-quantity"},"×",this.productDetails.quantity)))))),this.renderOptions()))}};r.style="";export{r as salla_order_details_multiple_bundle_product}
4
+ import{r as s,h as t,H as i}from"./p-Q9lz4Iuq.js";const r=class{constructor(t){s(this,t),this.placeholderImage=salla.url.cdn("images/s-empty.png")}getProductImage(){return this.productDetails?.image?"string"==typeof this.productDetails.image?this.productDetails.image:this.productDetails.image.url||this.placeholderImage||salla.url.cdn("images/s-empty.png"):this.placeholderImage}getProductImageAlt(){return this.productDetails?.image&&"string"!=typeof this.productDetails.image?this.productDetails.image.alt||this.productDetails?.name||"":this.productDetails?.name||""}getAccordionId(){return`accordion-${this.productDetails?.id||"default"}`}getAccordionKey(){return this.productDetails?.id||"default"}shouldBeCollapsible(){return void 0!==this.collapsible?this.collapsible:this.productDetails?.options?.length>0}renderOptions(){return this.productDetails?.options?.length?t("salla-accordion-body",null,t("div",{class:"s-order-details-options"},t("salla-order-details-options",{options:this.productDetails.options}))):null}render(){if(!this.productDetails)return null;const s=this.shouldBeCollapsible();return t(i,{class:"s-order-details-bundle-wrapper"},t("salla-accordion",{key:this.getAccordionKey(),collapsed:!1,bordered:!0,collapsible:s,id:this.getAccordionId(),size:"sm"},t("salla-accordion-head",null,t("div",{class:"s-order-details-product"},t("div",{class:"s-order-details-product-content"},t("div",{class:"s-order-details-product-info"},t("div",{class:"s-order-details-product-image"},t("img",{src:this.getProductImage(),alt:this.getProductImageAlt()})),t("div",{class:"s-order-details-product-details"},t("a",{href:this.productDetails?.url||"#",class:"s-order-details-product-name"},this.productDetails?.name||""),this.productDetails?.quantity&&t("span",{class:"s-order-details-product-quantity"},"×",this.productDetails.quantity)))))),this.renderOptions()))}};r.style="";export{r as salla_order_details_multiple_bundle_product}