@salla.sa/twilight-components 2.14.450 → 2.14.452
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.
- package/dist/cjs/{filepond-u7zONIpU.js → filepond-CUDa4yzK.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-DPE2-7A4.js → filepond-plugin-file-poster-ZBZ4eV18.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-QFJIY-td.js → filepond-plugin-file-validate-size-MuHAoRee.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-CqUNeom7.js → filepond-plugin-file-validate-type-YJnozwws.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-B2Z3rRkn.js → filepond-plugin-image-edit-DoGvWbfA.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-DxoN6Z-R.js → filepond-plugin-image-exif-orientation-DHT3msJG.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-doqEZlz_.js → filepond-plugin-image-preview-Cilr0qGC.js} +1 -1
- package/dist/cjs/{functions-CZozSu7O.js → functions-BD36RfEv.js} +1 -1
- package/dist/cjs/{index-CCSZWnkr.js → index-B3yg95Y_.js} +1 -1
- package/dist/cjs/{index-tPF0UB3W.js → index-D-llXlYu.js} +12 -7
- package/dist/cjs/index.esm-DOwgk2YK.js +2444 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +21 -17
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
- package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +4611 -24
- package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map.cjs.entry.js +1 -1
- package/dist/cjs/salla-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
- package/dist/cjs/salla-progress-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-reward-action_4.cjs.entry.js +3 -3
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/salla-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/{tracked-promise-DVCwmpuo.js → tracked-promise-XWqMedEM.js} +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-DQ8iQ9l5.js → vanilla-picker-DuVcVt-y.js} +1 -1
- package/dist/collection/assets/svg/location-tag.svg +10 -0
- package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js +20 -16
- package/dist/collection/components/salla-bullet-delivery/api-service.js +6 -0
- package/dist/collection/components/salla-bullet-delivery/helpers.js +3 -1
- package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.css +128 -0
- package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +195 -20
- package/dist/components/index.esm.js +2424 -0
- package/dist/components/index.js +8 -3
- package/dist/components/salla-bottom-alert.js +20 -16
- package/dist/components/salla-bullet-delivery.js +4644 -51
- package/dist/esm/{filepond-N1L04Plt.js → filepond-B8YVLlGK.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-2E1WZVzP.js → filepond-plugin-file-poster-BVHkBLq8.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-C0LhcfOR.js → filepond-plugin-file-validate-size-Cq7xe76f.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-Be8IgUh8.js → filepond-plugin-file-validate-type-CTsg2jzF.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-CFFuq7E_.js → filepond-plugin-image-edit-B_lgP65N.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-DPCeA1B5.js → filepond-plugin-image-exif-orientation-CiQmLZE0.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-CEvNq5JJ.js → filepond-plugin-image-preview-DEDwRroB.js} +1 -1
- package/dist/esm/{functions-Ba6VuRnB.js → functions-BTVjvurG.js} +1 -1
- package/dist/esm/{index-CrNw20pf.js → index-Dimo1ZpU.js} +12 -7
- package/dist/esm/{index-IqFJsnTE.js → index-iyZKRGHO.js} +1 -1
- package/dist/esm/index.esm-BkPzCq-C.js +2424 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +1 -1
- package/dist/esm/salla-add-product-button_5.entry.js +1 -1
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +21 -17
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-booking-field_7.entry.js +10 -10
- package/dist/esm/salla-bullet-delivery_2.entry.js +4646 -59
- package/dist/esm/salla-cart-coupons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
- package/dist/esm/salla-cashback-banner.entry.js +1 -1
- package/dist/esm/salla-comment-form_8.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +1 -1
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +1 -1
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner.entry.js +2 -2
- package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
- package/dist/esm/salla-loyalty-panel.entry.js +3 -3
- package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +3 -3
- package/dist/esm/salla-loyalty-reward.entry.js +2 -2
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map.entry.js +1 -1
- package/dist/esm/salla-menu.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-next-order-coupon.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-edit-item.entry.js +1 -1
- package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
- package/dist/esm/salla-order-edit.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-placeholder.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-card-embed.entry.js +1 -1
- package/dist/esm/salla-product-card_2.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +1 -1
- package/dist/esm/salla-progress-bar.entry.js +1 -1
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +1 -1
- package/dist/esm/salla-reward-action_4.entry.js +3 -3
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/salla-skeleton.entry.js +1 -1
- package/dist/esm/salla-slider.entry.js +1 -1
- package/dist/esm/salla-social-share.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/{tracked-promise-DH7_DYgQ.js → tracked-promise-CvY0ZPlq.js} +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-NvsTGeIC.js → vanilla-picker-DR-rCO7V.js} +1 -1
- package/dist/twilight/{p-446bfa5f.entry.js → p-02189879.entry.js} +1 -1
- package/dist/twilight/{p-5c07ab28.entry.js → p-023b2fdd.entry.js} +1 -1
- package/dist/twilight/{p-1633e09a.entry.js → p-02abc240.entry.js} +1 -1
- package/dist/twilight/{p-c42fd7ea.entry.js → p-06ba7dd1.entry.js} +1 -1
- package/dist/twilight/{p-120ca46f.entry.js → p-0d1154bf.entry.js} +1 -1
- package/dist/twilight/{p-6ffe65f2.entry.js → p-0f6b0f92.entry.js} +1 -1
- package/dist/twilight/{p-f83a4131.entry.js → p-16339bf0.entry.js} +1 -1
- package/dist/twilight/{p-c8ad8625.entry.js → p-17b94783.entry.js} +1 -1
- package/dist/twilight/p-1af6d934.entry.js +4 -0
- package/dist/twilight/{p-f47cd970.entry.js → p-1b859261.entry.js} +1 -1
- package/dist/twilight/{p-3d7d52b9.entry.js → p-1e2f547d.entry.js} +1 -1
- package/dist/twilight/{p-3649da70.entry.js → p-206e6265.entry.js} +1 -1
- package/dist/twilight/{p-e034fe03.entry.js → p-266aa19a.entry.js} +1 -1
- package/dist/twilight/{p-00a2d304.entry.js → p-2b1d0041.entry.js} +1 -1
- package/dist/twilight/{p-ff148d38.entry.js → p-3e541136.entry.js} +1 -1
- package/dist/twilight/{p-5395aed1.entry.js → p-41db9b1a.entry.js} +1 -1
- package/dist/twilight/{p-46301bdd.entry.js → p-43a4763b.entry.js} +1 -1
- package/dist/twilight/{p-1726199f.entry.js → p-4523e5c0.entry.js} +1 -1
- package/dist/twilight/{p-77c69000.entry.js → p-453e432c.entry.js} +1 -1
- package/dist/twilight/{p-f011898b.entry.js → p-46039e28.entry.js} +1 -1
- package/dist/twilight/p-48da0c37.entry.js +1019 -0
- package/dist/twilight/p-4901594b.entry.js +4 -0
- package/dist/twilight/{p-eec8f211.entry.js → p-4a242b08.entry.js} +1 -1
- package/dist/twilight/{p-ba68d83b.entry.js → p-4d6914e5.entry.js} +1 -1
- package/dist/twilight/{p-bd790b16.entry.js → p-4e90d0fb.entry.js} +1 -1
- package/dist/twilight/{p-942e5b3e.entry.js → p-5088b883.entry.js} +1 -1
- package/dist/twilight/{p-a22fd70d.entry.js → p-5d44c12a.entry.js} +1 -1
- package/dist/twilight/{p-4896533c.entry.js → p-60b9640d.entry.js} +1 -1
- package/dist/twilight/{p-cf3d3103.entry.js → p-615626cd.entry.js} +1 -1
- package/dist/twilight/{p-a68644af.entry.js → p-6342b0a5.entry.js} +1 -1
- package/dist/twilight/{p-9b225829.entry.js → p-63c68634.entry.js} +1 -1
- package/dist/twilight/{p-82fdf4e7.entry.js → p-63e74f12.entry.js} +1 -1
- package/dist/twilight/{p-7988b7a5.entry.js → p-642345d6.entry.js} +1 -1
- package/dist/twilight/{p-771ca405.entry.js → p-653b4634.entry.js} +1 -1
- package/dist/twilight/{p-5e4a9088.entry.js → p-6802c454.entry.js} +1 -1
- package/dist/twilight/{p-c5e14a6d.entry.js → p-6b1aeef4.entry.js} +1 -1
- package/dist/twilight/{p-4818c549.entry.js → p-6bc83d28.entry.js} +1 -1
- package/dist/twilight/{p-9d9da993.entry.js → p-6eb716e9.entry.js} +1 -1
- package/dist/twilight/{p-83b70db5.entry.js → p-74bb0829.entry.js} +1 -1
- package/dist/twilight/{p-bac02561.entry.js → p-75f69c89.entry.js} +1 -1
- package/dist/twilight/{p-4b9070f7.entry.js → p-7edf9c5f.entry.js} +1 -1
- package/dist/twilight/{p-c1ab6774.entry.js → p-7f07b3db.entry.js} +1 -1
- package/dist/twilight/{p-1fe09ed1.entry.js → p-81288fd1.entry.js} +1 -1
- package/dist/twilight/{p-57a86efd.entry.js → p-81741aef.entry.js} +1 -1
- package/dist/twilight/{p-eff611b9.entry.js → p-884a8742.entry.js} +1 -1
- package/dist/twilight/{p-bf7f213d.entry.js → p-8eb1ea0f.entry.js} +1 -1
- package/dist/twilight/{p-2774b070.entry.js → p-8f197b19.entry.js} +1 -1
- package/dist/twilight/{p-033c9e98.entry.js → p-8f93bae7.entry.js} +1 -1
- package/dist/twilight/{p-f7376365.entry.js → p-8f9cf7be.entry.js} +1 -1
- package/dist/twilight/{p-7f99f835.entry.js → p-90933152.entry.js} +1 -1
- package/dist/twilight/{p-fc540bfc.entry.js → p-9612e6b1.entry.js} +1 -1
- package/dist/twilight/{p-b9922101.entry.js → p-965ca629.entry.js} +1 -1
- package/dist/twilight/p-98a1855a.entry.js +4 -0
- package/dist/twilight/{p-40ea40b7.entry.js → p-99299763.entry.js} +1 -1
- package/dist/twilight/{p-4c69d380.entry.js → p-9c2d73d6.entry.js} +1 -1
- package/dist/twilight/{p-Cq2l9LEk.js → p-BLQ1h81p.js} +1 -1
- package/dist/twilight/p-BkPzCq-C.js +4 -0
- package/dist/twilight/{p-Cb-27f78.js → p-C6CshMy7.js} +1 -1
- package/dist/twilight/{p-CcwaGQ9_.js → p-C_of-n0U.js} +1 -1
- package/dist/twilight/{p-CzMGWnoB.js → p-D70qx2vr.js} +1 -1
- package/dist/twilight/p-D82DKoi_.js +4 -0
- package/dist/twilight/{p-BZ_8M_tQ.js → p-DNGUZSFZ.js} +1 -1
- package/dist/twilight/{p-oPliK7PL.js → p-Dd4Vpmci.js} +1 -1
- package/dist/twilight/p-Dimo1ZpU.js +5 -0
- package/dist/twilight/{p-DD5p3dqh.js → p-Dxrx9S2J.js} +1 -1
- package/dist/twilight/{p-D1BtXmLB.js → p-ESYTDRNV.js} +1 -1
- package/dist/twilight/{p-C0GYDeEy.js → p-JpkF-q4E.js} +1 -1
- package/dist/twilight/{p-13160d7a.entry.js → p-a1add8d1.entry.js} +1 -1
- package/dist/twilight/{p-53b1b8dd.entry.js → p-a1c2765d.entry.js} +1 -1
- package/dist/twilight/{p-886d3ea9.entry.js → p-a64332cc.entry.js} +1 -1
- package/dist/twilight/{p-380c9f58.entry.js → p-a7a021e1.entry.js} +1 -1
- package/dist/twilight/{p-d36d4dd0.entry.js → p-a86e5802.entry.js} +1 -1
- package/dist/twilight/{p-1a624e8e.entry.js → p-ab456964.entry.js} +1 -1
- package/dist/twilight/{p-dabf3edb.entry.js → p-ac57d9b4.entry.js} +1 -1
- package/dist/twilight/{p-81362474.entry.js → p-addd0fd8.entry.js} +1 -1
- package/dist/twilight/{p-2fea82d1.entry.js → p-b40525ea.entry.js} +1 -1
- package/dist/twilight/{p-36b79398.entry.js → p-b4a2e25b.entry.js} +1 -1
- package/dist/twilight/{p-20ca668a.entry.js → p-b5640db5.entry.js} +1 -1
- package/dist/twilight/{p-368d6551.entry.js → p-b8eedf15.entry.js} +1 -1
- package/dist/twilight/{p-1184e75d.entry.js → p-b973cdeb.entry.js} +1 -1
- package/dist/twilight/{p-42d531d7.entry.js → p-bc324586.entry.js} +1 -1
- package/dist/twilight/{p-bca94624.entry.js → p-bc633001.entry.js} +1 -1
- package/dist/twilight/{p-09a25c7b.entry.js → p-bd2364b9.entry.js} +1 -1
- package/dist/twilight/{p-7679487d.entry.js → p-bd36fa14.entry.js} +1 -1
- package/dist/twilight/{p-db9d3135.entry.js → p-be39695f.entry.js} +1 -1
- package/dist/twilight/{p-d62d8969.entry.js → p-c19843de.entry.js} +1 -1
- package/dist/twilight/{p-f0320140.entry.js → p-c2a09e77.entry.js} +1 -1
- package/dist/twilight/{p-6a5e3e9b.entry.js → p-c5d58f7b.entry.js} +1 -1
- package/dist/twilight/{p-3160ed65.entry.js → p-cb7c5983.entry.js} +1 -1
- package/dist/twilight/{p-3bfc8662.entry.js → p-cc748f8d.entry.js} +1 -1
- package/dist/twilight/{p-33369508.entry.js → p-cf518897.entry.js} +1 -1
- package/dist/twilight/{p-84daf1b1.entry.js → p-cfa61a61.entry.js} +1 -1
- package/dist/twilight/{p-9b14cfd6.entry.js → p-d061531b.entry.js} +1 -1
- package/dist/twilight/{p-4508f1ad.entry.js → p-d288d199.entry.js} +1 -1
- package/dist/twilight/{p-50fd3bb0.entry.js → p-de91804b.entry.js} +1 -1
- package/dist/twilight/{p-3feb7ca8.entry.js → p-df78511a.entry.js} +1 -1
- package/dist/twilight/{p-084a6e4a.entry.js → p-e65d2899.entry.js} +1 -1
- package/dist/twilight/{p-2eb7be80.entry.js → p-f870a5da.entry.js} +1 -1
- package/dist/twilight/{p-BGYOHdWO.js → p-fUqHHnkG.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-bullet-delivery/api-service.d.ts +1 -0
- package/dist/types/components/salla-bullet-delivery/helpers.d.ts +3 -0
- package/dist/types/components/salla-bullet-delivery/interfaces.d.ts +3 -0
- package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +23 -1
- package/package.json +9 -5
- package/dist/twilight/p-94d03d81.entry.js +0 -4
- package/dist/twilight/p-CrNw20pf.js +0 -5
- package/dist/twilight/p-SRRlvI95.js +0 -4
- package/dist/twilight/p-a09eb593.entry.js +0 -4
- package/dist/twilight/p-d86fb5f9.entry.js +0 -4
- package/dist/twilight/p-e96b8d47.entry.js +0 -4
|
@@ -0,0 +1,1019 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as t,c as e,h as i,H as s,a as o}from"./p-Dimo1ZpU.js";import{L as a}from"./p-BO5AoBAP.js";import{S as n}from"./p-BscTeWDc.js";const r="BulletDeliveryAPI",l=t=>{const e=null==t?Number.NaN:Number(t);return!Number.isNaN(e)&&0!==e};async function h(t,e,i){try{return await t()}catch(t){return console.error(`${r}: ${i}`,t),e}}const c=new Map;function d(t){const e=c.get(t);return!e||Date.now()-e.timestamp>3e5?(c.delete(t),null):e.data}function u(t,e){c.set(t,{data:e,timestamp:Date.now()})}const p=t=>"SA"===String(t).toUpperCase(),m={async getCountries(t=!1,e){const i=e?.trim()?null:"countries_"+(t?1:0);if(i){const t=d(i);if(t)return t}const s=await h((async()=>{const i={for_branch:t?1:0};return t&&(i.for_allocation=1),e?.trim()&&(i.query=e.trim()),((await salla.api.request("shipping/countries",{params:i}))?.data??[]).map((t=>({id:t.id,code:t.code,name:t.name,has_regions:p(t.code)})))}),[],"Error getting countries");return i&&s.length>0&&u(i,s),s},async getRegions(t,e){if(!l(t))return console.warn(`${r}: getRegions called without valid country_id`),[];const i=e?.trim()?null:`regions_${t}`;if(i){const t=d(i);if(t)return t}const s=await h((async()=>{const i={};return e?.trim()&&(i.query=e.trim()),((await salla.api.request(`shipping/countries/${t}/regions`,{params:i}))?.data??[]).map((e=>({id:e.id,name:e.name,code:e.code,country_id:Number(t)})))}),[],"Error fetching regions");return i&&s.length>0&&u(i,s),s},async getCities(t,e,i){if(!l(t))return console.warn(`${r}: getCities called without valid country_id`),[];const s=i?.trim()?null:`cities_${t}_${e||"all"}`;if(s){const t=d(s);if(t)return t}const o=await h((async()=>{const s={for_branch:0,country_id:t};return e&&(s.region_id=e),i?.trim()&&(s.query=i.trim()),((await salla.api.request("shipping/cities",{params:s}))?.data??[]).map((e=>({id:e.id,name:e.name,country_id:t,...null!=e.region_id&&{region_id:e.region_id}})))}),[],"Error fetching cities");return s&&o.length>0&&u(s,o),o},getDistricts:async(t,e)=>l(t)?h((async()=>{const i={for_branch:0,city_id:t};e?.trim()&&(i.query=e.trim());const s=(await salla.api.request("shipping/districts",{params:i}))?.data;return(Array.isArray(s)?s:Array.isArray(s?.districts)?s.districts:[]).map((e=>({id:e.id,name:e.name,name_en:e.name_en,city_id:t})))}),[],"Error fetching districts"):(console.warn(`${r}: getDistricts called without valid city_id`),[]),getSavedAddresses:async()=>h((async()=>{const t=(await salla.api.request("address"))?.data;return Array.isArray(t)?t:[]}),[],"Error fetching user addresses"),async getBranches({query:t,lat:e,lng:i,country_id:s,per_page:o=20}={}){const a=t?.trim()?.length>=2||e||i||!s?null:`branches_${s}`;if(a){const t=d(a);if(t)return t}const n=await h((async()=>{const a={per_page:o};t?.trim().length>=2&&(a.query=t),e&&(a.lat=e),i&&(a.lng=i),s&&(a.country_id=s);const n=await salla.api.request("branches",{params:a});return Array.isArray(n?.data)?n.data:[]}),[],"Error fetching branches");return a&&n.length>0&&u(a,n),n},saveAddressLocation:async t=>h((async()=>{const e=await salla.api.request("address/location",{...t,for_allocation:!0},"post"),i=e?.data??e;return{success:!0,address:"object"==typeof i&&null!=i&&"id"in i?i:void 0}}),{success:!1},"Error saving address/location"),setDeliveryScope:async t=>h((async()=>(await salla.api.withoutNotifier((()=>salla.scope.change({id:t}))),salla.storage.set("scope",{...salla.storage.get("scope")||{},id:t}),!0)),!1,"Error setting delivery scope"),async allocateScope(t){const e=t=>t?.error?.message??t?.message??"Failed to allocate scope";try{const e=await salla.api.withoutNotifier((()=>salla.api.request("scopes/allocation",t,"post")));return{success:!0,data:e?.data??e}}catch(t){console.error(`${r}: Error allocating scope`,t);const i=t;return{success:!1,error:null!=i?.response?.data?e(i.response.data):i?.message??"Unknown error"}}},getAddressToken:async()=>h((async()=>{const t=await salla.api.request("address/autocomplete-token");return t?.data?.token??null}),null,"Error fetching address autocomplete token")};function g(){c.clear()}const b=t=>t*(Math.PI/180);function f(t,e,i,s){const o=b(i-t),a=b(s-e),n=Math.sin(o/2)**2+Math.cos(b(t))*Math.cos(b(i))*Math.sin(a/2)**2;return 12742*Math.atan2(Math.sqrt(n),Math.sqrt(1-n))}function v(t,e){const[i,s]=String(t).trim().split(":").map(Number);return Number.isNaN(i)||Number.isNaN(s)?t:new Date(2e3,0,1,i,s).toLocaleTimeString(e,{hour:"numeric",minute:"2-digit",hour12:!0})}const y=(t,e,i)=>{if("branch"===t.type){const e=t.branch_details?.city??t.branch_details?.name;return e?`${i} ${e}`.trim():""}if("address"===t.type&&t.address_details){const i=[t.address_details.district?.name,t.address_details.city?.name,t.address_details.country?.name].filter(Boolean).join("، ")||t.address_details.short_address||"";return i?`${e} ${i}`.trim():""}return""},w=t=>null!=t?Number(t):void 0,S=t=>w(t?.address_details?.country?.id),k=t=>t?.country_code??t?.address_details?.country?.code??"",C=t=>w(t?.address_details?.region?.id),x=t=>w(t?.address_details?.city?.id),_=t=>w(t?.address_details?.district?.id),A=t=>t?.branch_details?.id,$=t=>t?.branch_details?.latitude,M=t=>t?.branch_details?.longitude,L=t=>{if(!t||"address"!==t.type||t.address_id)return!1;const e=S(t),i=x(t),s=_(t),o=k(t),a=null!=s&&0!==Number(s),n=Boolean(t.address_details?.district?.name?.trim()),r=!p(o)||a||n;return!!(e&&i&&r)},E=(t,e,i)=>!t||!p(t)||null!=e&&0!==Number(e)&&null!=i&&("number"==typeof i?0!==i:String(i).trim().length>0),z={[GeolocationPositionError.PERMISSION_DENIED]:"Location permission denied",[GeolocationPositionError.POSITION_UNAVAILABLE]:"Location unavailable",[GeolocationPositionError.TIMEOUT]:"Location timeout"},I=globalThis,P=I.ShadowRoot&&(void 0===I.ShadyCSS||I.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,T=Symbol(),B=new WeakMap;let N=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==T)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(P&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=B.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&B.set(e,t))}return t}toString(){return this.cssText}};const D=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1]),t[0]);return new N(i,t,T)},O=P?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new N("string"==typeof t?t:t+"",void 0,T))(e)})(t):t
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*/,{is:U,defineProperty:F,getOwnPropertyDescriptor:R,getOwnPropertyNames:j,getOwnPropertySymbols:q,getPrototypeOf:Z}=Object,G=globalThis,V=G.trustedTypes,H=V?V.emptyScript:"",K=G.reactiveElementPolyfillSupport,W={toAttribute(t,e){switch(e){case Boolean:t=t?H:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},Y=(t,e)=>!U(t,e),J={attribute:!0,type:String,converter:W,reflect:!1,useDefault:!1,hasChanged:Y};Symbol.metadata??=Symbol("metadata"),G.litPropertyMetadata??=new WeakMap;let Q=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=J){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&F(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:o}=R(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const a=s?.call(this);o?.call(this,e),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??J}static _$Ei(){if(this.hasOwnProperty("elementProperties"))return;const t=Z(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty("finalized"))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty("properties")){const t=this.properties,e=[...j(t),...q(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(O(t))}else void 0!==t&&e.push(O(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(P)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of e){const e=document.createElement("style"),s=I.litNonce;void 0!==s&&e.setAttribute("nonce",s),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const o=(void 0!==i.converter?.toAttribute?i.converter:W).toAttribute(e,i.type);this._$Em=t,null==o?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:W;this._$Em=s;const a=o.fromAttribute(e,t.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(t,e,i,s=!1,o){if(void 0!==t){const a=this.constructor;if(!1===s&&(o=this[t]),i??=a.getPropertyOptions(t),!((i.hasChanged??Y)(o,e)||i.useDefault&&i.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(a._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:o},a){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,a??e??this[t]),!0!==o||void 0!==a)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};Q.elementStyles=[],Q.shadowRootOptions={mode:"open"},Q.elementProperties=new Map,Q.finalized=new Map,K?.({ReactiveElement:Q}),(G.reactiveElementVersions??=[]).push("2.1.2");
|
|
10
|
+
/**
|
|
11
|
+
* @license
|
|
12
|
+
* Copyright 2017 Google LLC
|
|
13
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
14
|
+
*/
|
|
15
|
+
const X=globalThis,tt=X.trustedTypes,et=tt?tt.createPolicy("lit-html",{createHTML:t=>t}):void 0,it="$lit$",st=`lit$${Math.random().toFixed(9).slice(2)}$`,ot="?"+st,at=`<${ot}>`,nt=document,rt=()=>nt.createComment(""),lt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,ht=Array.isArray,ct="[ \t\n\f\r]",dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ut=/-->/g,pt=/>/g,mt=RegExp(`>|${ct}(?:([^\\s"'>=/]+)(${ct}*=${ct}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),gt=/'/g,bt=/"/g,ft=/^(?:script|style|textarea|title)$/i,vt=(t,...e)=>({_$litType$:1,strings:t,values:e}),yt=Symbol.for("lit-noChange"),wt=Symbol.for("lit-nothing"),St=new WeakMap,kt=nt.createTreeWalker(nt,129);function Ct(t,e){if(!ht(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==et?et.createHTML(e):e}const xt=(t,e)=>{const i=t.length-1,s=[];let o,a=2===e?"<svg>":3===e?"<math>":"",n=dt;for(let e=0;e<i;e++){const i=t[e];let r,l,h=-1,c=0;for(;c<i.length&&(n.lastIndex=c,l=n.exec(i),null!==l);)c=n.lastIndex,n===dt?"!--"===l[1]?n=ut:void 0!==l[1]?n=pt:void 0!==l[2]?(ft.test(l[2])&&(o=RegExp("</"+l[2],"g")),n=mt):void 0!==l[3]&&(n=mt):n===mt?">"===l[0]?(n=o??dt,h=-1):void 0===l[1]?h=-2:(h=n.lastIndex-l[2].length,r=l[1],n=void 0===l[3]?mt:'"'===l[3]?bt:gt):n===bt||n===gt?n=mt:n===ut||n===pt?n=dt:(n=mt,o=void 0);const d=n===mt&&t[e+1].startsWith("/>")?" ":"";a+=n===dt?i+at:h>=0?(s.push(r),i.slice(0,h)+it+i.slice(h)+st+d):i+st+(-2===h?e:d)}return[Ct(t,a+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};let _t=class t{constructor({strings:e,_$litType$:i},s){let o;this.parts=[];let a=0,n=0;const r=e.length-1,l=this.parts,[h,c]=xt(e,i);if(this.el=t.createElement(h,s),kt.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(o=kt.nextNode())&&l.length<r;){if(1===o.nodeType){if(o.hasAttributes())for(const t of o.getAttributeNames())if(t.endsWith(it)){const e=c[n++],i=o.getAttribute(t).split(st),s=/([.?@])?(.*)/.exec(e);l.push({type:1,index:a,name:s[2],strings:i,ctor:"."===s[1]?Et:"?"===s[1]?zt:"@"===s[1]?It:Lt}),o.removeAttribute(t)}else t.startsWith(st)&&(l.push({type:6,index:a}),o.removeAttribute(t));if(ft.test(o.tagName)){const t=o.textContent.split(st),e=t.length-1;if(e>0){o.textContent=tt?tt.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],rt()),kt.nextNode(),l.push({type:2,index:++a});o.append(t[e],rt())}}}else if(8===o.nodeType)if(o.data===ot)l.push({type:2,index:a});else{let t=-1;for(;-1!==(t=o.data.indexOf(st,t+1));)l.push({type:7,index:a}),t+=st.length-1}a++}}static createElement(t,e){const i=nt.createElement("template");return i.innerHTML=t,i}};function At(t,e,i=t,s){if(e===yt)return e;let o=void 0!==s?i._$Co?.[s]:i._$Cl;const a=lt(e)?void 0:e._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),void 0===a?o=void 0:(o=new a(t),o._$AT(t,i,s)),void 0!==s?(i._$Co??=[])[s]=o:i._$Cl=o),void 0!==o&&(e=At(t,o._$AS(t,e.values),o,s)),e}let $t=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,s=(t?.creationScope??nt).importNode(e,!0);kt.currentNode=s;let o=kt.nextNode(),a=0,n=0,r=i[0];for(;void 0!==r;){if(a===r.index){let e;2===r.type?e=new Mt(o,o.nextSibling,this,t):1===r.type?e=new r.ctor(o,r.name,r.strings,this,t):6===r.type&&(e=new Pt(o,this,t)),this._$AV.push(e),r=i[++n]}a!==r?.index&&(o=kt.nextNode(),a++)}return kt.currentNode=nt,s}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}},Mt=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=wt,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=At(this,t,e),lt(t)?t===wt||null==t||""===t?(this._$AH!==wt&&this._$AR(),this._$AH=wt):t!==this._$AH&&t!==yt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>ht(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==wt&<(this._$AH)?this._$AA.nextSibling.data=t:this.T(nt.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=_t.createElement(Ct(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new $t(s,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=St.get(t.strings);return void 0===e&&St.set(t.strings,e=new _t(t)),e}k(e){ht(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,o=0;for(const a of e)o===i.length?i.push(s=new t(this.O(rt()),this.O(rt()),this,this.options)):s=i[o],s._$AI(a),o++;o<i.length&&(this._$AR(s&&s._$AB.nextSibling,o),i.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}},Lt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,o){this.type=1,this._$AH=wt,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=wt}_$AI(t,e=this,i,s){const o=this.strings;let a=!1;if(void 0===o)t=At(this,t,e,0),a=!lt(t)||t!==this._$AH&&t!==yt,a&&(this._$AH=t);else{const s=t;let n,r;for(t=o[0],n=0;n<o.length-1;n++)r=At(this,s[i+n],e,n),r===yt&&(r=this._$AH[n]),a||=!lt(r)||r!==this._$AH[n],r===wt?t=wt:t!==wt&&(t+=(r??"")+o[n+1]),this._$AH[n]=r}a&&!s&&this.j(t)}j(t){t===wt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Et=class extends Lt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===wt?void 0:t}},zt=class extends Lt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==wt)}},It=class extends Lt{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){if((t=At(this,t,e,0)??wt)===yt)return;const i=this._$AH,s=t===wt&&i!==wt||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==wt&&(i===wt||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Pt=class{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){At(this,t)}};const Tt=X.litHtmlPolyfillSupport;Tt?.(_t,Mt),(X.litHtmlVersions??=[]).push("3.3.2");const Bt=globalThis;
|
|
16
|
+
/**
|
|
17
|
+
* @license
|
|
18
|
+
* Copyright 2017 Google LLC
|
|
19
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
20
|
+
*/class Nt extends Q{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const s=i?.renderBefore??e;let o=s._$litPart$;if(void 0===o){const t=i?.renderBefore??null;s._$litPart$=o=new Mt(e.insertBefore(rt(),t),t,void 0,i??{})}return o._$AI(t),o})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return yt}}Nt._$litElement$=!0,Nt.finalized=!0,Bt.litElementHydrateSupport?.({LitElement:Nt});const Dt=Bt.litElementPolyfillSupport;Dt?.({LitElement:Nt}),(Bt.litElementVersions??=[]).push("4.2.2");const Ot=globalThis,Ut=Ot.ShadowRoot&&(void 0===Ot.ShadyCSS||Ot.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ft=Symbol(),Rt=new WeakMap;let jt=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==Ft)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(Ut&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=Rt.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Rt.set(e,t))}return t}toString(){return this.cssText}};const qt=Ut?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new jt("string"==typeof t?t:t+"",void 0,Ft))(e)})(t):t,{is:Zt,defineProperty:Gt,getOwnPropertyDescriptor:Vt,getOwnPropertyNames:Ht,getOwnPropertySymbols:Kt,getPrototypeOf:Wt}=Object,Yt=globalThis,Jt=Yt.trustedTypes,Qt=Jt?Jt.emptyScript:"",Xt=Yt.reactiveElementPolyfillSupport,te={toAttribute(t,e){switch(e){case Boolean:t=t?Qt:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},ee=(t,e)=>!Zt(t,e),ie={attribute:!0,type:String,converter:te,reflect:!1,useDefault:!1,hasChanged:ee};Symbol.metadata??=Symbol("metadata"),Yt.litPropertyMetadata??=new WeakMap;let se=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=ie){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=this.getPropertyDescriptor(t,Symbol(),e);void 0!==i&&Gt(this.prototype,t,i)}}static getPropertyDescriptor(t,e,i){const{get:s,set:o}=Vt(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const a=s?.call(this);o?.call(this,e),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ie}static _$Ei(){if(this.hasOwnProperty("elementProperties"))return;const t=Wt(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty("finalized"))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty("properties")){const t=this.properties,e=[...Ht(t),...Kt(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(qt(t))}else void 0!==t&&e.push(qt(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(Ut)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of e){const e=document.createElement("style"),s=Ot.litNonce;void 0!==s&&e.setAttribute("nonce",s),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const o=(void 0!==i.converter?.toAttribute?i.converter:te).toAttribute(e,i.type);this._$Em=t,null==o?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:te;this._$Em=s;const a=o.fromAttribute(e,t.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(t,e,i,s=!1,o){if(void 0!==t){const a=this.constructor;if(!1===s&&(o=this[t]),i??=a.getPropertyOptions(t),!((i.hasChanged??ee)(o,e)||i.useDefault&&i.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(a._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:o},a){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,a??e??this[t]),!0!==o||void 0!==a)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};se.elementStyles=[],se.shadowRootOptions={mode:"open"},se.elementProperties=new Map,se.finalized=new Map,Xt?.({ReactiveElement:se}),(Yt.reactiveElementVersions??=[]).push("2.1.2");const oe=globalThis,ae=oe.trustedTypes,ne=ae?ae.createPolicy("lit-html",{createHTML:t=>t}):void 0,re="$lit$",le=`lit$${Math.random().toFixed(9).slice(2)}$`,he="?"+le,ce=`<${he}>`,de=document,ue=()=>de.createComment(""),pe=t=>null===t||"object"!=typeof t&&"function"!=typeof t,me=Array.isArray,ge="[ \t\n\f\r]",be=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,fe=/-->/g,ve=/>/g,ye=RegExp(`>|${ge}(?:([^\\s"'>=/]+)(${ge}*=${ge}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),we=/'/g,Se=/"/g,ke=/^(?:script|style|textarea|title)$/i,Ce=(t,...e)=>({_$litType$:1,strings:t,values:e}),xe=Symbol.for("lit-noChange"),_e=Symbol.for("lit-nothing"),Ae=new WeakMap,$e=de.createTreeWalker(de,129);function Me(t,e){if(!me(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==ne?ne.createHTML(e):e}class Le{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,a=0;const n=t.length-1,r=this.parts,[l,h]=((t,e)=>{const i=t.length-1,s=[];let o,a=2===e?"<svg>":3===e?"<math>":"",n=be;for(let e=0;e<i;e++){const i=t[e];let r,l,h=-1,c=0;for(;c<i.length&&(n.lastIndex=c,l=n.exec(i),null!==l);)c=n.lastIndex,n===be?"!--"===l[1]?n=fe:void 0!==l[1]?n=ve:void 0!==l[2]?(ke.test(l[2])&&(o=RegExp("</"+l[2],"g")),n=ye):void 0!==l[3]&&(n=ye):n===ye?">"===l[0]?(n=o??be,h=-1):void 0===l[1]?h=-2:(h=n.lastIndex-l[2].length,r=l[1],n=void 0===l[3]?ye:'"'===l[3]?Se:we):n===Se||n===we?n=ye:n===fe||n===ve?n=be:(n=ye,o=void 0);const d=n===ye&&t[e+1].startsWith("/>")?" ":"";a+=n===be?i+ce:h>=0?(s.push(r),i.slice(0,h)+re+i.slice(h)+le+d):i+le+(-2===h?e:d)}return[Me(t,a+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]})(t,e);if(this.el=Le.createElement(l,i),$e.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=$e.nextNode())&&r.length<n;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(re)){const e=h[a++],i=s.getAttribute(t).split(le),n=/([.?@])?(.*)/.exec(e);r.push({type:1,index:o,name:n[2],strings:i,ctor:"."===n[1]?Te:"?"===n[1]?Be:"@"===n[1]?Ne:Pe}),s.removeAttribute(t)}else t.startsWith(le)&&(r.push({type:6,index:o}),s.removeAttribute(t));if(ke.test(s.tagName)){const t=s.textContent.split(le),e=t.length-1;if(e>0){s.textContent=ae?ae.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],ue()),$e.nextNode(),r.push({type:2,index:++o});s.append(t[e],ue())}}}else if(8===s.nodeType)if(s.data===he)r.push({type:2,index:o});else{let t=-1;for(;-1!==(t=s.data.indexOf(le,t+1));)r.push({type:7,index:o}),t+=le.length-1}o++}}static createElement(t,e){const i=de.createElement("template");return i.innerHTML=t,i}}function Ee(t,e,i=t,s){if(e===xe)return e;let o=void 0!==s?i._$Co?.[s]:i._$Cl;const a=pe(e)?void 0:e._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),void 0===a?o=void 0:(o=new a(t),o._$AT(t,i,s)),void 0!==s?(i._$Co??=[])[s]=o:i._$Cl=o),void 0!==o&&(e=Ee(t,o._$AS(t,e.values),o,s)),e}class ze{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,s=(t?.creationScope??de).importNode(e,!0);$e.currentNode=s;let o=$e.nextNode(),a=0,n=0,r=i[0];for(;void 0!==r;){if(a===r.index){let e;2===r.type?e=new Ie(o,o.nextSibling,this,t):1===r.type?e=new r.ctor(o,r.name,r.strings,this,t):6===r.type&&(e=new De(o,this,t)),this._$AV.push(e),r=i[++n]}a!==r?.index&&(o=$e.nextNode(),a++)}return $e.currentNode=de,s}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}let Ie=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=_e,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Ee(this,t,e),pe(t)?t===_e||null==t||""===t?(this._$AH!==_e&&this._$AR(),this._$AH=_e):t!==this._$AH&&t!==xe&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>me(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==_e&&pe(this._$AH)?this._$AA.nextSibling.data=t:this.T(de.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=Le.createElement(Me(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new ze(s,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=Ae.get(t.strings);return void 0===e&&Ae.set(t.strings,e=new Le(t)),e}k(e){me(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,o=0;for(const a of e)o===i.length?i.push(s=new t(this.O(ue()),this.O(ue()),this,this.options)):s=i[o],s._$AI(a),o++;o<i.length&&(this._$AR(s&&s._$AB.nextSibling,o),i.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}},Pe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,o){this.type=1,this._$AH=_e,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=_e}_$AI(t,e=this,i,s){const o=this.strings;let a=!1;if(void 0===o)t=Ee(this,t,e,0),a=!pe(t)||t!==this._$AH&&t!==xe,a&&(this._$AH=t);else{const s=t;let n,r;for(t=o[0],n=0;n<o.length-1;n++)r=Ee(this,s[i+n],e,n),r===xe&&(r=this._$AH[n]),a||=!pe(r)||r!==this._$AH[n],r===_e?t=_e:t!==_e&&(t+=(r??"")+o[n+1]),this._$AH[n]=r}a&&!s&&this.j(t)}j(t){t===_e?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}};class Te extends Pe{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===_e?void 0:t}}class Be extends Pe{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==_e)}}class Ne extends Pe{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){if((t=Ee(this,t,e,0)??_e)===xe)return;const i=this._$AH,s=t===_e&&i!==_e||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==_e&&(i===_e||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class De{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Ee(this,t)}}const Oe=oe.litHtmlPolyfillSupport;Oe?.(Le,Ie),(oe.litHtmlVersions??=[]).push("3.3.2");const Ue=globalThis;let Fe=class extends se{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const s=i?.renderBefore??e;let o=s._$litPart$;if(void 0===o){const t=i?.renderBefore??null;s._$litPart$=o=new Ie(e.insertBefore(ue(),t),t,void 0,i??{})}return o._$AI(t),o})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return xe}};Fe._$litElement$=!0,Fe.finalized=!0,Ue.litElementHydrateSupport?.({LitElement:Fe});const Re=Ue.litElementPolyfillSupport;Re?.({LitElement:Fe}),(Ue.litElementVersions??=[]).push("4.2.2");const je={attribute:!0,type:String,converter:te,reflect:!1,hasChanged:ee},qe=(t=je,e,i)=>{const{kind:s,metadata:o}=i;let a=globalThis.litPropertyMetadata.get(o);if(void 0===a&&globalThis.litPropertyMetadata.set(o,a=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),a.set(i.name,t),"accessor"===s){const{name:s}=i;return{set(i){const o=e.get.call(this);e.set.call(this,i),this.requestUpdate(s,o,t,!0,i)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=i;return function(i){const o=this[s];e.call(this,i),this.requestUpdate(s,o,t,!0,i)}}throw Error("Unsupported decorator location: "+s)};function Ze(t){return(e,i)=>"object"==typeof i?qe(t,e,i):((t,e,i)=>{const s=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),s?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}function Ge(t){return Ze({...t,state:!0,attribute:!1})}const Ve=t=>(...e)=>({_$litDirective$:t,values:e});class He{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}const Ke=Ve(class extends He{constructor(t){if(super(t),1!==t.type||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const i=t.element.classList;for(const t of this.st)t in e||(i.remove(t),this.st.delete(t));for(const t in e){const s=!!e[t];s===this.st.has(t)||this.nt?.has(t)||(s?(i.add(t),this.st.add(t)):(i.remove(t),this.st.delete(t)))}return xe}}),We={},Ye=Ve(class extends He{constructor(t){if(super(t),3!==t.type&&1!==t.type&&4!==t.type)throw Error("The `live` directive is not allowed on child or event bindings");if(!(t=>void 0===t.strings)(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===xe||e===_e)return e;const i=t.element,s=t.name;if(3===t.type){if(e===i[s])return xe}else if(4===t.type){if(!!e===i.hasAttribute(s))return xe}else if(1===t.type&&i.getAttribute(s)===e+"")return xe;return((t,e=We)=>{t._$AH=e})(t),e}}),Je=["AE","AR","AT","AU","BE","BG","BR","CA","CH","CL","CO","CZ","DE","DK","EE","ES","FI","FR","GB","GR","HK","HR","HU","ID","IE","IL","IN","IT","JP","KR","LT","LU","LV","MX","MY","NL","NO","NZ","PE","PH","PL","PT","RO","SE","SG","SI","SK","TH","TR","TW","US","VN","ZA"];function Qe(t,e){let i=null;return t.address_components?i=function(t){if(!t)return null;const e=t.find((t=>t.types?.includes("country")));return e?e.short_name:null}(t.address_components):e&&1===e.length&&(i=e[0].toUpperCase()),i?{isSupported:Je.includes(i),countryCode:i}:{isSupported:null,countryCode:null}}const Xe={en:{placeholder:"Search for an address...",noResults:"No address found for this search. Try different keywords.",errorFetchPredictions:"Unable to search for addresses. Please try again.",errorFetchDetails:"Unable to load address details. Please try again.",errorNetwork:"Network error. Please check your connection and try again.",validationRequired:"This field is required",validationPattern:"Invalid format",validationSaudiFormat:"Please enter a valid Saudi national address (format: AAAA1234)"},ar:{placeholder:"ابحث عن عنوان...",noResults:"لم يتم العثور على عنوان لهذا البحث. جرب كلمات مختلفة.",errorFetchPredictions:"تعذر البحث عن العناوين. يرجى المحاولة مرة أخرى.",errorFetchDetails:"تعذر تحميل تفاصيل العنوان. يرجى المحاولة مرة أخرى.",errorNetwork:"خطأ في الشبكة. يرجى التحقق من اتصالك والمحاولة مرة أخرى.",validationRequired:"هذا الحقل مطلوب",validationPattern:"صيغة غير صحيحة",validationSaudiFormat:"الرجاء إدخال عنوان وطني صحيح (الصيغة: AAAA1234)"},es:{placeholder:"Buscar una dirección...",noResults:"No se encontró ninguna dirección para esta búsqueda. Intenta con diferentes palabras.",errorFetchPredictions:"No se pueden buscar direcciones. Por favor, inténtelo de nuevo.",errorFetchDetails:"No se pueden cargar los detalles de la dirección. Por favor, inténtelo de nuevo.",errorNetwork:"Error de red. Verifique su conexión e inténtelo de nuevo.",validationRequired:"Este campo es obligatorio",validationPattern:"Formato inválido",validationSaudiFormat:"Por favor ingrese una dirección nacional saudí válida (formato: AAAA1234)"},fr:{placeholder:"Rechercher une adresse...",noResults:"Aucune adresse trouvée pour cette recherche. Essayez différents mots-clés.",errorFetchPredictions:"Impossible de rechercher des adresses. Veuillez réessayer.",errorFetchDetails:"Impossible de charger les détails de l'adresse. Veuillez réessayer.",errorNetwork:"Erreur réseau. Vérifiez votre connexion et réessayez.",validationRequired:"Ce champ est obligatoire",validationPattern:"Format invalide",validationSaudiFormat:"Veuillez saisir une adresse nationale saoudienne valide (format: AAAA1234)"},de:{placeholder:"Nach einer Adresse suchen...",noResults:"Keine Adresse für diese Suche gefunden. Versuchen Sie es mit anderen Stichwörtern.",errorFetchPredictions:"Adressen können nicht gesucht werden. Bitte versuchen Sie es erneut.",errorFetchDetails:"Adressdetails können nicht geladen werden. Bitte versuchen Sie es erneut.",errorNetwork:"Netzwerkfehler. Bitte überprüfen Sie Ihre Verbindung und versuchen Sie es erneut.",validationRequired:"Dieses Feld ist erforderlich",validationPattern:"Ungültiges Format",validationSaudiFormat:"Bitte geben Sie eine gültige saudi-arabische nationale Adresse ein (Format: AAAA1234)"},it:{placeholder:"Cerca un indirizzo...",noResults:"Nessun indirizzo trovato per questa ricerca. Prova con parole chiave diverse.",errorFetchPredictions:"Impossibile cercare indirizzi. Riprova.",errorFetchDetails:"Impossibile caricare i dettagli dell'indirizzo. Riprova.",errorNetwork:"Errore di rete. Controlla la connessione e riprova.",validationRequired:"Questo campo è obbligatorio",validationPattern:"Formato non valido",validationSaudiFormat:"Inserisci un indirizzo nazionale saudita valido (formato: AAAA1234)"},pt:{placeholder:"Pesquisar um endereço...",noResults:"Nenhum endereço encontrado para esta pesquisa. Tente palavras-chave diferentes.",errorFetchPredictions:"Não é possível pesquisar endereços. Por favor, tente novamente.",errorFetchDetails:"Não é possível carregar os detalhes do endereço. Por favor, tente novamente.",errorNetwork:"Erro de rede. Verifique sua conexão e tente novamente.",validationRequired:"Este campo é obrigatório",validationPattern:"Formato inválido",validationSaudiFormat:"Por favor, insira um endereço nacional saudita válido (formato: AAAA1234)"},ru:{placeholder:"Поиск адреса...",noResults:"Адрес для этого поиска не найден. Попробуйте другие ключевые слова.",errorFetchPredictions:"Невозможно выполнить поиск адресов. Пожалуйста, попробуйте еще раз.",errorFetchDetails:"Невозможно загрузить детали адреса. Пожалуйста, попробуйте еще раз.",errorNetwork:"Ошибка сети. Проверьте соединение и попробуйте еще раз.",validationRequired:"Это поле обязательно",validationPattern:"Неверный формат",validationSaudiFormat:"Пожалуйста, введите действительный национальный адрес Саудовской Аравии (формат: AAAA1234)"},ja:{placeholder:"住所を検索...",noResults:"この検索では住所が見つかりませんでした。別のキーワードをお試しください。",errorFetchPredictions:"住所を検索できません。もう一度お試しください。",errorFetchDetails:"住所の詳細を読み込めません。もう一度お試しください。",errorNetwork:"ネットワークエラー。接続を確認してもう一度お試しください。",validationRequired:"この項目は必須です",validationPattern:"無効な形式",validationSaudiFormat:"有効なサウジアラビアの国内住所を入力してください(形式:AAAA1234)"},zh:{placeholder:"搜索地址...",noResults:"未找到此搜索的地址。请尝试不同的关键词。",errorFetchPredictions:"无法搜索地址。请重试。",errorFetchDetails:"无法加载地址详情。请重试。",errorNetwork:"网络错误。请检查您的连接并重试。",validationRequired:"此字段为必填项",validationPattern:"格式无效",validationSaudiFormat:"请输入有效的沙特国家地址(格式:AAAA1234)"},ko:{placeholder:"주소 검색...",noResults:"이 검색에 대한 주소를 찾을 수 없습니다. 다른 키워드를 시도해보세요.",errorFetchPredictions:"주소를 검색할 수 없습니다. 다시 시도해주세요.",errorFetchDetails:"주소 세부정보를 불러올 수 없습니다. 다시 시도해주세요.",errorNetwork:"네트워크 오류입니다. 연결을 확인하고 다시 시도해주세요.",validationRequired:"이 필드는 필수입니다",validationPattern:"유효하지 않은 형식",validationSaudiFormat:"유효한 사우디 국가 주소를 입력하세요 (형식: AAAA1234)"},hi:{placeholder:"पता खोजें...",noResults:"इस खोज के लिए कोई पता नहीं मिला। विभिन्न कीवर्ड आज़माएं।",errorFetchPredictions:"पते खोजने में असमर्थ। कृपया पुनः प्रयास करें।",errorFetchDetails:"पते का विवरण लोड करने में असमर्थ। कृपया पुनः प्रयास करें।",errorNetwork:"नेटवर्क त्रुटि। कृपया अपना कनेक्शन जांचें और पुनः प्रयास करें।",validationRequired:"यह फ़ील्ड आवश्यक है",validationPattern:"अमान्य प्रारूप",validationSaudiFormat:"कृपया एक मान्य सऊदी राष्ट्रीय पता दर्ज करें (प्रारूप: AAAA1234)"},tr:{placeholder:"Adres ara...",noResults:"Bu arama için adres bulunamadı. Farklı anahtar kelimeler deneyin.",errorFetchPredictions:"Adresler aranamıyor. Lütfen tekrar deneyin.",errorFetchDetails:"Adres detayları yüklenemiyor. Lütfen tekrar deneyin.",errorNetwork:"Ağ hatası. Lütfen bağlantınızı kontrol edin ve tekrar deneyin.",validationRequired:"Bu alan zorunludur",validationPattern:"Geçersiz format",validationSaudiFormat:"Lütfen geçerli bir Suudi ulusal adresi girin (format: AAAA1234)"}};function ti(t="en"){return Xe[t]||Xe.en}var ei=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,si=(t,e,i,s)=>{for(var o,a=s>1?void 0:s?ii(e,i):e,n=t.length-1;n>=0;n--)(o=t[n])&&(a=(s?o(e,i,a):o(a))||a);return s&&a&&ei(e,i,a),a};let oi=class extends Fe{constructor(){super(),this.proxyUrl="https://api.salla.dev",this.authToken=null,this.placeholder="",this.defaultPlace="",this.label=null,this.className="",this.language="en",this.dir="auto",this.mode="search",this.name="",this.required=!1,this.pattern=null,this.tooltip=null,this.selectedId=null,this.errors=[],this.disabled=!1,this._value="",this._country=null,this.locationBias=null,this.locationRestriction=null,this.types=null,this._fields=["formatted_address","geometry"],this.strictBounds=!1,this.useSessionToken=!0,this.resolve=!1,this.onValidateAddress=null,this.debounceDelay=300,this.minChars=3,this.predictions=[],this.isOpen=!1,this.isLoading=!1,this.error=null,this.activeIndex=-1,this.inputValue="",this.sessionToken=null,this.validationError=null,this.touched=!1,this.showNationalAddressIcon=!1,this.abortController=null,this._internals=this.attachInternals()}set value(t){const e=this._value;this._value=t||"",this.requestUpdate("value",e)}get value(){return this._value}set country(t){this._country=null==t?null:Array.isArray(t)?t.filter((t=>t&&t.trim())).map((t=>t.trim())):t.split(",").map((t=>t.trim())).filter((t=>t))}get country(){return this._country}set fieldsStr(t){this._fields=t?t.split(",").map((t=>t.trim())).filter((t=>t)):["formatted_address","geometry"]}get fieldsStr(){return this._fields.join(",")}set fields(t){this._fields=t&&t.length>0?t:["formatted_address","geometry"]}get fields(){return this._fields}connectedCallback(){super.connectedCallback(),this.createNewSession(),this.initializeDebounce()}disconnectedCallback(){super.disconnectedCallback(),this.terminateSession(),this.cancelPendingRequest()}initializeDebounce(){this.debouncedFetch=function(t,e){let i=null;return function(...s){i&&clearTimeout(i),i=setTimeout((()=>{t.apply(this,s)}),e)}}(this.fetchPredictions.bind(this),this.debounceDelay)}firstUpdated(){const t=this.value||this.defaultPlace||"";t&&(this.inputValue=t,this.isSaudiFormMode()&&this.isShortAddressFormat(t)&&(this.showNationalAddressIcon=!0))}$nextTick(t){Promise.resolve().then(t)}isShortAddressFormat(t){return/^[a-zA-Z]{4}\d{4}$/.test(t?.trim())}updated(t){if(t.has("value")){const t=this.value||"";t!==this.inputValue&&(this.inputValue=t,this.showNationalAddressIcon=!!(this.isSaudiFormMode()&&t&&this.isShortAddressFormat(t)))}t.has("defaultPlace")&&!this.value&&this.defaultPlace!==this.inputValue&&(this.inputValue=this.defaultPlace||"",this.showNationalAddressIcon=!!(this.isSaudiFormMode()&&this.defaultPlace&&this.isShortAddressFormat(this.defaultPlace))),t.has("selectedId")&&this.selectedId&&this.selectedId!==this.inputValue&&this.isSaudiFormMode()&&this.isShortAddressFormat(this.selectedId)&&(this.inputValue=this.selectedId||"",this.showNationalAddressIcon=!0,this._internals.setFormValue(this.selectedId||"")),t.has("debounceDelay")&&this.initializeDebounce()}createNewSession(){this.useSessionToken&&(this.sessionToken=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})))}terminateSession(){this.sessionToken=null}cancelPendingRequest(){this.abortController&&(this.abortController.abort(),this.abortController=null)}isSaudiFormMode(){return"form"===this.mode&&null!==this.country&&1===this.country.length&&"sa"===this.country[0].toLowerCase()}getWhatsAppLink(){return`https://wa.me/966112898888?text=${encodeURIComponent("العنوان الوطني")}`}renderWhatsAppIcon(){return Ce`
|
|
21
|
+
<svg class="whatsapp-icon" viewBox="0 0 24 24" fill="currentColor" part="whatsapp-icon">
|
|
22
|
+
<path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/>
|
|
23
|
+
</svg>
|
|
24
|
+
`}getSaudiHelpTextContent(){return{helpText:"ar"===this.language?"لا تعرف العنوان الوطني؟":"Don't know your national address?",linkText:"ar"===this.language?"احصل على العنوان الوطني عبر الواتساب":"Get your national address via WhatsApp"}}renderSaudiFriendlyError(){let t,e;this.inputValue&&this.inputValue.trim().length>0?(t="العنوان الوطني المختصر غير صحيح (الصيغة: AAAA1234). يمكنك الحصول عليه بسهولة",e="The short national address format is incorrect (format: AAAA1234). You can easily get it"):(t="العنوان الوطني المختصر مطلوب. يمكنك الحصول عليه بسهولة",e="The short national address is required. You can easily get it");const i="ar"===this.language?"عبر الواتساب (اضغط هنا)":"via WhatsApp (click here)",s="ar"===this.language?"أو ابحث أعلاه":"or search above";return Ce`
|
|
25
|
+
<span>
|
|
26
|
+
${"ar"===this.language?t:e}
|
|
27
|
+
<a
|
|
28
|
+
href="${this.getWhatsAppLink()}"
|
|
29
|
+
target="_blank"
|
|
30
|
+
rel="noopener noreferrer"
|
|
31
|
+
class="whatsapp-link-inline"
|
|
32
|
+
part="whatsapp-link"
|
|
33
|
+
>
|
|
34
|
+
${this.renderWhatsAppIcon()}
|
|
35
|
+
${i}
|
|
36
|
+
</a>
|
|
37
|
+
${s}
|
|
38
|
+
</span>
|
|
39
|
+
`}renderSaudiHelpText(){if(!this.isSaudiFormMode()||this.validationError||this.errors&&this.errors.length>0)return"";const t="ar"===this.language?"عبر الواتساب (اضغط هنا)":"via WhatsApp (click here)",e="ar"===this.language?"أو ابحث أعلاه":"or search above";return Ce`
|
|
40
|
+
<div class="help-text" part="help-text">
|
|
41
|
+
<span>
|
|
42
|
+
${"ar"===this.language?"لا تعرف العنوان الوطني؟ احصل عليه بسهولة":"Don't know your national address? Get it easily"}
|
|
43
|
+
<a
|
|
44
|
+
href="${this.getWhatsAppLink()}"
|
|
45
|
+
target="_blank"
|
|
46
|
+
rel="noopener noreferrer"
|
|
47
|
+
class="whatsapp-link-inline"
|
|
48
|
+
part="whatsapp-link"
|
|
49
|
+
>
|
|
50
|
+
${this.renderWhatsAppIcon()}
|
|
51
|
+
${t}
|
|
52
|
+
</a>
|
|
53
|
+
${e}
|
|
54
|
+
</span>
|
|
55
|
+
</div>
|
|
56
|
+
`}async fetchPredictions(t){if(!t.trim())return this.predictions=[],this.isOpen=!1,void(this.isLoading=!1);if(t.trim().length<this.minChars)return this.predictions=[],this.isOpen=!1,void(this.isLoading=!1);this.cancelPendingRequest(),this.abortController=new AbortController;const e=this.abortController.signal;this.isLoading=!0,this.error=null;try{const i={input:t,language:this.language};this.sessionToken&&(i.sessiontoken=this.sessionToken),this.country&&this.country.length>0&&(i.country=this.country.join(",")),this.types&&this.types.length>0&&(i.types=this.types.join("|")),this.locationBias&&this.locationBias.radius&&this.locationBias.center&&(i.location=`${this.locationBias.center.lat},${this.locationBias.center.lng}`,i.radius=this.locationBias.radius.toString()),this.strictBounds&&(i.strictbounds="true");const s=new URLSearchParams(i),o=`${this.proxyUrl||""}/store/v1/checkout/address/autocomplete/query?${s.toString()}`,a={};this.authToken&&(a.Authorization=`Bearer ${this.authToken}`);const n=await fetch(o,{signal:e,headers:a});if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);const r=await n.json();r.success&&Array.isArray(r.data)?(this.error=null,r.data.length>0?(this.predictions=r.data.map((t=>({place_id:t.id,description:t.description||t.formatted_address,formatted_address:t.formatted_address,short_address:t.short_address,structured_formatting:{main_text:t.formatted_address||t.description,main_text_matched_substrings:[],secondary_text:t.description||""},types:t.types||[],geometry:t.geometry,address_components:t.address_components}))),this.isOpen=!0,this.activeIndex=-1):(this.predictions=[],this.isOpen=!0)):(this.predictions=[],this.isOpen=!0)}catch(t){if(t instanceof Error&&"AbortError"===t.name)return;this.predictions=[],this.isOpen=!0}finally{this.isLoading=!1,this.abortController=null}}async fetchPlaceDetails(t){this.isLoading=!0,this.error=null;try{const e={place_id:t,language:this.language};this.fields&&this.fields.length>0&&(e.fields=this.fields.join(",")),this.sessionToken&&(e.sessiontoken=this.sessionToken),this.country&&this.country.length>0&&(e.country=this.country.join(",")),this.resolve&&(e.resolve="true");const i=new URLSearchParams(e),s=`${this.proxyUrl||""}/store/v1/checkout/address/autocomplete/details?${i.toString()}`,o={};this.authToken&&(o.Authorization=`Bearer ${this.authToken}`);const a=await fetch(s,{headers:o});if(!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);const n=await a.json();return!n.success||n.message?(this.error=n.message||"Failed to fetch place details",null):n.success&&n.data&&n.data.id?{place_id:n.data.id,...n.data,components:n.data.address_components?.reduce(((t,e)=>(e.types?.forEach((i=>{t[i]||(t[i]=[]),t[i].push({long_name:e.long_name,short_name:e.short_name})})),t)),{})}:null}catch(t){console.error("Error fetching place details:",t);const e=ti(this.language);return this.error=t instanceof Error?t.message:e.errorFetchDetails,null}finally{this.isLoading=!1}}async validateAddress(t){try{if(!t||!t.formatted_address)return console.error("Cannot validate address - place or formatted_address is missing"),null;if(!this.onValidateAddress||"function"!=typeof this.onValidateAddress)return console.error("onValidateAddress callback is required for address validation"),null;const e=Qe(t,this.country),i=await this.onValidateAddress({place:t,sessionToken:this.sessionToken,validationSupport:e});return this.terminateSession(),i}catch(t){return console.error("Error validating address:",t),this.terminateSession(),null}}getValidationSupport(t){return Qe(t,this.country)}checkValidity(){return this.validate()}reportValidity(){this.touched=!0;const t=this.validate();return t||this.dispatchEvent(new CustomEvent("invalid",{detail:{error:this.validationError},bubbles:!0,composed:!0})),t}reset(){this.inputValue="",this.selectedId=null,this.validationError=null,this.errors=[],this.touched=!1,this.predictions=[],this.isOpen=!1,this.error=null,this.showNationalAddressIcon=!1,"form"===this.mode&&(this._internals.setFormValue(null),this._internals.setValidity({}))}formResetCallback(){this.reset()}formStateRestoreCallback(t){t&&"form"===this.mode&&(this.selectedId=t)}validate(){if("form"!==this.mode)return!0;const t=ti(this.language),e=this.inputValue||"";return this.required&&!e.trim()?(this.validationError=t.validationRequired,this._internals.setValidity({valueMissing:!0},this.validationError,this.inputElement),!1):this.isSaudiFormMode()&&e.trim()&&!this.isShortAddressFormat(e)?(this.validationError=t.validationSaudiFormat,this._internals.setValidity({patternMismatch:!0},this.validationError,this.inputElement),!1):this.pattern&&e.trim()&&!new RegExp(this.pattern).test(e)?(this.validationError=t.validationPattern,this._internals.setValidity({patternMismatch:!0},this.validationError,this.inputElement),!1):(this.validationError=null,this._internals.setValidity({}),!0)}normalizeNumerals(t){if(!t)return t;const e={"٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","०":"0","१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","০":"0","১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9"};return t.split("").map((t=>e[t]??t)).join("")}handleInput(t){if(this.disabled)return;const e=t.target,i=e.selectionStart??0,s=this.inputValue,o=e.value,a=this.normalizeNumerals(o);a!==o&&(e.value=a,requestAnimationFrame((()=>{e.setSelectionRange(i,i)}))),this.inputValue=a,this.touched=!0,this.showNationalAddressIcon&&(this.showNationalAddressIcon=!1),"form"===this.mode&&(this.validationError&&(this.validationError=null),this.selectedId=null,this._internals.setFormValue(this.inputValue||null),this.validate()),this.errors&&this.errors.length>0&&(this.errors=[]),this.inputValue.trim().length>=this.minChars&&(this.isLoading=!0),this.debouncedFetch(this.inputValue),this._value=this.inputValue,this.requestUpdate("value",s),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.inputValue},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new InputEvent("input",{data:this.inputValue,bubbles:!0,composed:!0}))}async handleSelect(t){if(this.disabled)return;this.isSaudiFormMode()&&t.place_id&&this.isShortAddressFormat(t.place_id)?(this.inputValue=t.place_id,this.showNationalAddressIcon=!0):(this.inputValue=t.formatted_address,this.showNationalAddressIcon=!1),this.isOpen=!1,this.predictions=[],this.touched=!0;let e=null;if(e="form"===this.mode?await this.fetchPlaceDetails(t.place_id):t.geometry?.location?{place_id:t.place_id,formatted_address:t.formatted_address||t.description,geometry:t.geometry,types:t.types,address_components:t.address_components}:await this.fetchPlaceDetails(t.place_id),e){this.isSaudiFormMode()&&e.place_id&&this.isShortAddressFormat(e.place_id)?(this.inputValue=e.place_id,this.showNationalAddressIcon=!0):(e.formatted_address&&(this.inputValue=e.formatted_address),this.showNationalAddressIcon=!1),"form"===this.mode&&(this.selectedId=e.place_id,this._internals.setFormValue(this.inputValue),this.validate()),this._value=this.inputValue,this.dispatchEvent(new CustomEvent("input",{detail:{value:this.inputValue},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}));const t=this.getValidationSupport(e);this.dispatchEvent(new CustomEvent("place-select",{detail:{place:e,validationSupport:t},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("place-changed",{detail:{place:e,validationSupport:t},bubbles:!0,composed:!0}))}}handleKeyDown(t){if(!this.disabled&&this.isOpen&&0!==this.predictions.length)switch(t.key){case"ArrowDown":t.preventDefault(),this.activeIndex=Math.min(this.activeIndex+1,this.predictions.length-1);break;case"ArrowUp":t.preventDefault(),this.activeIndex=Math.max(this.activeIndex-1,-1);break;case"Enter":t.preventDefault(),this.activeIndex>=0&&this.activeIndex<this.predictions.length&&this.handleSelect(this.predictions[this.activeIndex]);break;case"Escape":t.preventDefault(),this.isOpen=!1,this.activeIndex=-1}}handleBlur(){setTimeout((()=>{this.isOpen=!1,this.activeIndex=-1,"form"===this.mode&&this.touched&&this.validate(),this.dispatchEvent(new Event("blur",{bubbles:!0,composed:!0}))}),200)}handleFocus(){this.disabled||this.predictions.length>0&&(this.isOpen=!0)}renderLocationIcon(){return Ce`
|
|
57
|
+
<svg class="location-icon" fill="currentColor" viewBox="0 0 20 20">
|
|
58
|
+
<path fill-rule="evenodd" d="M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z" clip-rule="evenodd" />
|
|
59
|
+
</svg>
|
|
60
|
+
`}renderTooltip(){return this.tooltip?Ce`
|
|
61
|
+
<span class="tooltip-toggle" part="tooltip-toggle">
|
|
62
|
+
<svg class="tooltip-icon" part="tooltip-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
63
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
64
|
+
</svg>
|
|
65
|
+
<span class="tooltip-content" part="tooltip-content">${this.tooltip}</span>
|
|
66
|
+
</span>
|
|
67
|
+
`:""}renderPrediction(t,e){const i={"dropdown-item":!0,active:e===this.activeIndex};let s=t.structured_formatting.main_text;return t.short_address&&s.includes(t.short_address)&&(s=s.replace(t.short_address,"").trim(),s=s.replace(/\s*,\s*,\s*/g,", ").replace(/^\s*,\s*|\s*,\s*$/g,"").trim()),Ce`
|
|
68
|
+
<div
|
|
69
|
+
class=${Ke(i)}
|
|
70
|
+
part="dropdown-item ${e===this.activeIndex?"dropdown-item-active":""}"
|
|
71
|
+
@click=${()=>this.handleSelect(t)}
|
|
72
|
+
role="option"
|
|
73
|
+
aria-selected=${e===this.activeIndex}
|
|
74
|
+
>
|
|
75
|
+
${this.renderLocationIcon()}
|
|
76
|
+
<div class="place-info" part="place-info">
|
|
77
|
+
<div class="main-text" part="main-text">
|
|
78
|
+
${t.short_address?Ce`
|
|
79
|
+
<span class="national-address-badge" part="national-address-badge">
|
|
80
|
+
<img
|
|
81
|
+
src="https://cdn.salla.network/images/shipping/png/national-address-icon-small-min.png"
|
|
82
|
+
alt="national address icon"
|
|
83
|
+
class="national-address-icon"
|
|
84
|
+
/>
|
|
85
|
+
<span class="national-address-text">${t.short_address}</span>
|
|
86
|
+
<span class="national-address-separator">-</span>
|
|
87
|
+
</span>
|
|
88
|
+
`:""}
|
|
89
|
+
${s}
|
|
90
|
+
</div>
|
|
91
|
+
${t.structured_formatting.secondary_text?Ce`
|
|
92
|
+
<div class="secondary-text" part="secondary-text">
|
|
93
|
+
${t.structured_formatting.secondary_text}
|
|
94
|
+
</div>
|
|
95
|
+
`:""}
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
`}render(){const t={dropdown:!0,open:this.isOpen},e={"is-invalid":!("form"!==this.mode||!this.validationError)||this.errors&&this.errors.length>0,"with-national-icon":this.showNationalAddressIcon},i={required:"form"===this.mode&&this.required},s=ti(this.language),o="auto"===this.dir?function(t){return["ar"].includes(t)}(this.language)?"rtl":"ltr":this.dir,a=this.placeholder||s.placeholder,n=this.name||"salla-address-search";return Ce`
|
|
99
|
+
<div class="wrapper ${this.className}" part="wrapper" dir="${o}">
|
|
100
|
+
<div class="input-container" part="input-container">
|
|
101
|
+
${this.label?Ce`
|
|
102
|
+
<label part="label" class=${Ke(i)}>
|
|
103
|
+
<span class="label-content">
|
|
104
|
+
<span>${this.label}</span>
|
|
105
|
+
${this.renderTooltip()}
|
|
106
|
+
</span>
|
|
107
|
+
</label>
|
|
108
|
+
`:""}
|
|
109
|
+
<div class="input-wrapper">
|
|
110
|
+
<input
|
|
111
|
+
part="input"
|
|
112
|
+
class=${Ke(e)}
|
|
113
|
+
type="text"
|
|
114
|
+
name="${n}"
|
|
115
|
+
.value=${Ye(this.inputValue)}
|
|
116
|
+
placeholder=${a}
|
|
117
|
+
?disabled=${this.disabled}
|
|
118
|
+
@input=${this.handleInput}
|
|
119
|
+
@keydown=${this.handleKeyDown}
|
|
120
|
+
@blur=${this.handleBlur}
|
|
121
|
+
@focus=${this.handleFocus}
|
|
122
|
+
role="combobox"
|
|
123
|
+
aria-expanded=${this.isOpen}
|
|
124
|
+
aria-autocomplete="list"
|
|
125
|
+
aria-controls="predictions-list"
|
|
126
|
+
aria-invalid=${"form"===this.mode&&this.validationError||this.errors&&this.errors.length>0?"true":"false"}
|
|
127
|
+
aria-required=${"form"===this.mode&&this.required?"true":"false"}
|
|
128
|
+
autocomplete="off"
|
|
129
|
+
autocorrect="off"
|
|
130
|
+
autocapitalize="off"
|
|
131
|
+
spellcheck="false"
|
|
132
|
+
/>
|
|
133
|
+
${this.isLoading?Ce`<div class="loading-spinner" part="spinner"></div>`:""}
|
|
134
|
+
|
|
135
|
+
<div
|
|
136
|
+
id="predictions-list"
|
|
137
|
+
class=${Ke(t)}
|
|
138
|
+
part="dropdown"
|
|
139
|
+
role="listbox"
|
|
140
|
+
>
|
|
141
|
+
${this.predictions.length>0?this.predictions.map(((t,e)=>this.renderPrediction(t,e))):this.inputValue&&!this.isLoading?Ce`<div class="no-results" part="no-results">${s.noResults}</div>`:""}
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
${"form"===this.mode&&this.validationError?Ce`
|
|
145
|
+
<div class="validation-error" part="validation-error">
|
|
146
|
+
${this.isSaudiFormMode()?this.renderSaudiFriendlyError():Ce`<span>${this.validationError}</span>`}
|
|
147
|
+
</div>
|
|
148
|
+
`:""}
|
|
149
|
+
${this.errors&&this.errors.length>0?Ce`
|
|
150
|
+
<div class="validation-error" part="validation-error">${this.errors[0]}</div>
|
|
151
|
+
`:""}
|
|
152
|
+
${this.error?Ce`<div class="error-message" part="error">${this.error}</div>`:""}
|
|
153
|
+
${this.renderSaudiHelpText()}
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
`}};oi.formAssociated=!0,oi.styles=((t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1]),t[0]);return new jt(i,t,Ft)})`
|
|
157
|
+
:host {
|
|
158
|
+
display: block;
|
|
159
|
+
position: relative;
|
|
160
|
+
font-family: var(--salla-autocomplete-font-family, system-ui, -apple-system, sans-serif);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.wrapper {
|
|
164
|
+
position: relative;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.input-container {
|
|
168
|
+
display: flex;
|
|
169
|
+
flex-direction: column;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.input-wrapper {
|
|
173
|
+
position: relative;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
label {
|
|
177
|
+
display: block;
|
|
178
|
+
margin-bottom: var(--salla-autocomplete-label-margin, 0.5rem);
|
|
179
|
+
font-size: var(--salla-autocomplete-label-font-size, 0.875rem);
|
|
180
|
+
font-weight: var(--salla-autocomplete-label-font-weight, 500);
|
|
181
|
+
color: var(--salla-autocomplete-label-color, #374151);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
label.required::after {
|
|
185
|
+
content: ' *';
|
|
186
|
+
color: var(--salla-autocomplete-required-color, #dc2626);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.label-content {
|
|
190
|
+
display: inline-flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
gap: 0.5rem;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.tooltip-toggle {
|
|
196
|
+
position: relative;
|
|
197
|
+
display: inline-flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
cursor: help;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.tooltip-icon {
|
|
203
|
+
width: 1rem;
|
|
204
|
+
height: 1rem;
|
|
205
|
+
color: var(--salla-autocomplete-tooltip-icon-color, #6b7280);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.tooltip-content {
|
|
209
|
+
display: none;
|
|
210
|
+
position: absolute;
|
|
211
|
+
bottom: 125%;
|
|
212
|
+
left: 50%;
|
|
213
|
+
transform: translateX(-50%);
|
|
214
|
+
background: var(--salla-autocomplete-tooltip-bg, #1f2937);
|
|
215
|
+
color: var(--salla-autocomplete-tooltip-color, white);
|
|
216
|
+
padding: 0.5rem 0.75rem;
|
|
217
|
+
border-radius: 0.375rem;
|
|
218
|
+
font-size: 0.75rem;
|
|
219
|
+
line-height: 1.4;
|
|
220
|
+
white-space: nowrap;
|
|
221
|
+
z-index: 1000;
|
|
222
|
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.tooltip-content::after {
|
|
226
|
+
content: '';
|
|
227
|
+
position: absolute;
|
|
228
|
+
top: 100%;
|
|
229
|
+
left: 50%;
|
|
230
|
+
transform: translateX(-50%);
|
|
231
|
+
border: 5px solid transparent;
|
|
232
|
+
border-top-color: var(--salla-autocomplete-tooltip-bg, #1f2937);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.tooltip-toggle:hover .tooltip-content,
|
|
236
|
+
.tooltip-toggle:focus .tooltip-content {
|
|
237
|
+
display: block;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
input {
|
|
241
|
+
width: 100%;
|
|
242
|
+
padding-block: 0.75rem;
|
|
243
|
+
padding-inline-start: var(--salla-autocomplete-input-padding-start, 0.875rem);
|
|
244
|
+
padding-inline-end: var(--salla-autocomplete-input-padding-end, 2.75rem);
|
|
245
|
+
font-family: var(--salla-autocomplete-font-family, system-ui, -apple-system, sans-serif);
|
|
246
|
+
font-size: var(--salla-autocomplete-input-font-size, 1rem);
|
|
247
|
+
line-height: var(--salla-autocomplete-input-line-height, 1.5);
|
|
248
|
+
border: var(--salla-autocomplete-input-border, 1px solid #d1d5db);
|
|
249
|
+
border-radius: var(--salla-autocomplete-input-border-radius, 0.5rem);
|
|
250
|
+
background: var(--salla-autocomplete-input-background, white);
|
|
251
|
+
color: var(--salla-autocomplete-input-color, #111827);
|
|
252
|
+
outline: none;
|
|
253
|
+
transition: all 0.2s;
|
|
254
|
+
box-sizing: border-box;
|
|
255
|
+
height: var(--salla-autocomplete-input-height, auto);
|
|
256
|
+
min-height: var(--salla-autocomplete-input-height, 44px);
|
|
257
|
+
-webkit-appearance: none;
|
|
258
|
+
appearance: none;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
input.with-national-icon {
|
|
262
|
+
padding-inline-start: var(--salla-autocomplete-input-padding-start-icon, 2rem);
|
|
263
|
+
background-image: url('https://cdn.salla.network/images/shipping/png/national-address-icon-small-min.png');
|
|
264
|
+
background-repeat: no-repeat;
|
|
265
|
+
background-position: 0.75rem center;
|
|
266
|
+
background-size: 16px;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
input.with-national-icon[dir="rtl"],
|
|
270
|
+
:host([dir="rtl"]) input.with-national-icon {
|
|
271
|
+
padding-inline-start: var(--salla-autocomplete-input-padding-start, 0.875rem);
|
|
272
|
+
padding-inline-end: var(--salla-autocomplete-input-padding-end-icon, 2.75rem);
|
|
273
|
+
background-position: calc(100% - 0.75rem) center;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
@media (max-width: 640px) {
|
|
277
|
+
input {
|
|
278
|
+
font-size: var(--salla-autocomplete-input-font-size-mobile, 16px);
|
|
279
|
+
padding-block: 0.75rem;
|
|
280
|
+
padding-inline-start: var(--salla-autocomplete-input-padding-start-mobile, 0.875rem);
|
|
281
|
+
padding-inline-end: var(--salla-autocomplete-input-padding-end-mobile, 2.75rem);
|
|
282
|
+
min-height: 44px;
|
|
283
|
+
touch-action: manipulation;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
input.with-national-icon {
|
|
287
|
+
padding-inline-start: var(--salla-autocomplete-input-padding-start-icon-mobile, 2rem);
|
|
288
|
+
background-position: 0.875rem center;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
input.with-national-icon[dir="rtl"],
|
|
292
|
+
:host([dir="rtl"]) input.with-national-icon {
|
|
293
|
+
padding-inline-start: var(--salla-autocomplete-input-padding-start-mobile, 0.875rem);
|
|
294
|
+
padding-inline-end: var(--salla-autocomplete-input-padding-end-icon-mobile, 2.75rem);
|
|
295
|
+
background-position: calc(100% - 0.875rem) center;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
input:focus {
|
|
300
|
+
border-color: var(--salla-autocomplete-input-focus-border-color, #3b82f6);
|
|
301
|
+
box-shadow: var(--salla-autocomplete-input-focus-shadow, 0 0 0 3px rgba(59, 130, 246, 0.1));
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
input:disabled {
|
|
305
|
+
background-color: var(--salla-autocomplete-input-disabled-bg, #f3f4f6);
|
|
306
|
+
cursor: not-allowed;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
input.is-invalid {
|
|
310
|
+
border-color: var(--salla-autocomplete-input-error-border-color, #dc2626);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
input.is-invalid:focus {
|
|
314
|
+
border-color: var(--salla-autocomplete-input-error-border-color, #dc2626);
|
|
315
|
+
box-shadow: var(--salla-autocomplete-input-error-shadow, 0 0 0 3px rgba(220, 38, 38, 0.1));
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
input::placeholder {
|
|
319
|
+
color: var(--salla-autocomplete-input-placeholder-color, #9ca3af);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.validation-error {
|
|
323
|
+
display: flex;
|
|
324
|
+
flex-wrap: wrap;
|
|
325
|
+
align-items: center;
|
|
326
|
+
gap: 0.5rem;
|
|
327
|
+
margin-top: 0.375rem;
|
|
328
|
+
font-size: var(--salla-autocomplete-error-font-size, 0.875rem);
|
|
329
|
+
color: var(--salla-autocomplete-error-color, #dc2626);
|
|
330
|
+
line-height: 1.5;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.validation-error > span {
|
|
334
|
+
line-height: 1.5;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.whatsapp-link-inline {
|
|
338
|
+
color: var(--salla-autocomplete-whatsapp-brand-color, #25D366);
|
|
339
|
+
white-space: nowrap;
|
|
340
|
+
line-height: inherit;
|
|
341
|
+
display: inline-flex;
|
|
342
|
+
align-items: center;
|
|
343
|
+
vertical-align: middle;
|
|
344
|
+
text-decoration: underline;
|
|
345
|
+
cursor: pointer;
|
|
346
|
+
transition: all 0.2s ease;
|
|
347
|
+
gap: 0.25rem;
|
|
348
|
+
margin-inline: 0.25rem;
|
|
349
|
+
font-weight: 500;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.whatsapp-link-inline:hover {
|
|
353
|
+
color: var(--salla-autocomplete-whatsapp-brand-hover, #1da851);
|
|
354
|
+
opacity: 0.9;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.whatsapp-link-inline:active {
|
|
358
|
+
transform: scale(0.98);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.whatsapp-link-inline .whatsapp-icon {
|
|
362
|
+
color: var(--salla-autocomplete-whatsapp-brand-color, #25D366);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.help-text {
|
|
366
|
+
display: block;
|
|
367
|
+
margin-top: 0.5rem;
|
|
368
|
+
font-size: var(--salla-autocomplete-help-font-size, 0.875rem);
|
|
369
|
+
color: var(--salla-autocomplete-help-color, #6b7280);
|
|
370
|
+
line-height: 1.5;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.help-text span {
|
|
374
|
+
line-height: 1.5;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.whatsapp-icon {
|
|
378
|
+
width: 1rem;
|
|
379
|
+
height: 1rem;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.loading-spinner {
|
|
383
|
+
position: absolute;
|
|
384
|
+
inset-inline-end: 0.875rem;
|
|
385
|
+
top: 50%;
|
|
386
|
+
transform: translateY(-50%);
|
|
387
|
+
width: var(--salla-autocomplete-spinner-size, 1.25rem);
|
|
388
|
+
height: var(--salla-autocomplete-spinner-size, 1.25rem);
|
|
389
|
+
border: 2px solid var(--salla-autocomplete-spinner-border-color, #e5e7eb);
|
|
390
|
+
border-top-color: var(--salla-autocomplete-spinner-color, #3b82f6);
|
|
391
|
+
border-radius: 50%;
|
|
392
|
+
animation: spin 0.6s linear infinite;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
@media (max-width: 640px) {
|
|
396
|
+
.loading-spinner {
|
|
397
|
+
width: var(--salla-autocomplete-spinner-size-mobile, 1.375rem);
|
|
398
|
+
height: var(--salla-autocomplete-spinner-size-mobile, 1.375rem);
|
|
399
|
+
inset-inline-end: 1rem;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
@keyframes spin {
|
|
404
|
+
to { transform: translateY(-50%) rotate(360deg); }
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/* Custom scrollbar styling */
|
|
408
|
+
.dropdown::-webkit-scrollbar {
|
|
409
|
+
width: 6px;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.dropdown::-webkit-scrollbar-track {
|
|
413
|
+
background: #f1f1f1;
|
|
414
|
+
border-radius: 3px;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.dropdown::-webkit-scrollbar-thumb {
|
|
418
|
+
background: #c1c1c1;
|
|
419
|
+
border-radius: 3px;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.dropdown::-webkit-scrollbar-thumb:hover {
|
|
423
|
+
background: #a8a8a8;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.dropdown {
|
|
427
|
+
position: absolute;
|
|
428
|
+
top: 100%;
|
|
429
|
+
left: 0;
|
|
430
|
+
right: 0;
|
|
431
|
+
margin-top: var(--salla-autocomplete-dropdown-margin-top, 0.375rem);
|
|
432
|
+
background: var(--salla-autocomplete-dropdown-background, white);
|
|
433
|
+
border: var(--salla-autocomplete-dropdown-border, 1px solid #e5e7eb);
|
|
434
|
+
border-radius: var(--salla-autocomplete-dropdown-border-radius, 0.5rem);
|
|
435
|
+
box-shadow: var(--salla-autocomplete-dropdown-shadow, 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1));
|
|
436
|
+
max-height: var(--salla-autocomplete-dropdown-max-height, 240px);
|
|
437
|
+
overflow-y: auto;
|
|
438
|
+
overflow-x: hidden;
|
|
439
|
+
z-index: var(--salla-autocomplete-dropdown-z-index, 100);
|
|
440
|
+
display: none;
|
|
441
|
+
-webkit-overflow-scrolling: touch;
|
|
442
|
+
overscroll-behavior: contain;
|
|
443
|
+
scroll-behavior: smooth;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
@media (max-width: 640px) {
|
|
447
|
+
.dropdown {
|
|
448
|
+
max-height: var(--salla-autocomplete-dropdown-max-height-mobile, 25vh);
|
|
449
|
+
border-radius: var(--salla-autocomplete-dropdown-border-radius-mobile, 0.5rem);
|
|
450
|
+
margin-top: var(--salla-autocomplete-dropdown-margin-top-mobile, 0.25rem);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
@media (max-width: 640px) and (max-height: 667px) {
|
|
455
|
+
/* Smaller phones (iPhone SE, iPhone 8, etc.) */
|
|
456
|
+
.dropdown {
|
|
457
|
+
max-height: var(--salla-autocomplete-dropdown-max-height-small, 22vh);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
@media (max-width: 640px) and (min-height: 668px) and (max-height: 896px) {
|
|
462
|
+
/* Standard phones (iPhone 12, iPhone 13, etc.) */
|
|
463
|
+
.dropdown {
|
|
464
|
+
max-height: var(--salla-autocomplete-dropdown-max-height-standard, 28vh);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
@media (max-width: 640px) and (min-height: 897px) {
|
|
469
|
+
/* Larger phones (iPhone 14 Pro Max, etc.) */
|
|
470
|
+
.dropdown {
|
|
471
|
+
max-height: var(--salla-autocomplete-dropdown-max-height-large, 30vh);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.dropdown.open {
|
|
476
|
+
display: block;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.dropdown-item {
|
|
480
|
+
display: flex;
|
|
481
|
+
align-items: flex-start;
|
|
482
|
+
padding: var(--salla-autocomplete-item-padding, 0.625rem 0.75rem);
|
|
483
|
+
cursor: pointer;
|
|
484
|
+
transition: background-color 0.15s;
|
|
485
|
+
border-bottom: 1px solid var(--salla-autocomplete-item-border-color, #e5e7eb);
|
|
486
|
+
min-height: 35px;
|
|
487
|
+
-webkit-tap-highlight-color: transparent;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
@media (max-width: 640px) {
|
|
491
|
+
.dropdown-item {
|
|
492
|
+
padding: var(--salla-autocomplete-item-padding-mobile, 0.75rem 0.875rem);
|
|
493
|
+
min-height: 35px;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.dropdown-item:last-child {
|
|
498
|
+
border-bottom: none;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.dropdown-item:hover,
|
|
502
|
+
.dropdown-item.selected {
|
|
503
|
+
background-color: var(--salla-autocomplete-item-hover-bg, #f9fafb);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.dropdown-item.active {
|
|
507
|
+
background-color: var(--salla-autocomplete-item-active-bg, #eff6ff);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
@media (hover: none) and (pointer: coarse) {
|
|
511
|
+
.dropdown-item:hover {
|
|
512
|
+
background-color: transparent;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.dropdown-item:active {
|
|
516
|
+
background-color: var(--salla-autocomplete-item-active-bg, #eff6ff);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.location-icon {
|
|
521
|
+
display: none;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.place-info {
|
|
525
|
+
flex: 1;
|
|
526
|
+
min-width: 0;
|
|
527
|
+
display: flex;
|
|
528
|
+
flex-direction: column;
|
|
529
|
+
gap: 0.25rem;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.main-text {
|
|
533
|
+
font-size: var(--salla-autocomplete-main-text-font-size, 0.875rem);
|
|
534
|
+
font-weight: var(--salla-autocomplete-main-text-font-weight, 600);
|
|
535
|
+
color: var(--salla-autocomplete-main-text-color, #111827);
|
|
536
|
+
line-height: 1.4;
|
|
537
|
+
word-wrap: break-word;
|
|
538
|
+
overflow-wrap: break-word;
|
|
539
|
+
hyphens: auto;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
@media (max-width: 640px) {
|
|
543
|
+
.main-text {
|
|
544
|
+
font-size: var(--salla-autocomplete-main-text-font-size-mobile, 0.9375rem);
|
|
545
|
+
line-height: 1.3;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.main-text .highlight {
|
|
550
|
+
font-weight: var(--salla-autocomplete-highlight-font-weight, 700);
|
|
551
|
+
color: var(--salla-autocomplete-highlight-color, inherit);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.national-address-badge {
|
|
555
|
+
display: inline-flex;
|
|
556
|
+
align-items: center;
|
|
557
|
+
font-size: 0.8125rem;
|
|
558
|
+
line-height: 1;
|
|
559
|
+
vertical-align: middle;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.national-address-icon {
|
|
563
|
+
width: 11px;
|
|
564
|
+
height: auto;
|
|
565
|
+
flex-shrink: 0;
|
|
566
|
+
display: inline-block;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
.national-address-text {
|
|
570
|
+
padding-inline-start: 3px;
|
|
571
|
+
-webkit-text-fill-color: transparent;
|
|
572
|
+
background-clip: text;
|
|
573
|
+
-webkit-background-clip: text;
|
|
574
|
+
background-image: linear-gradient(135deg, #0052cc, #00b8d9 50%, #36b37e);
|
|
575
|
+
font-weight: 600;
|
|
576
|
+
display: inline-block;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
.national-address-separator {
|
|
580
|
+
padding-inline: 4px;
|
|
581
|
+
color: #6b7280;
|
|
582
|
+
display: inline-block;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
.secondary-text {
|
|
586
|
+
font-size: var(--salla-autocomplete-secondary-text-font-size, 0.75rem);
|
|
587
|
+
color: var(--salla-autocomplete-secondary-text-color, #6b7280);
|
|
588
|
+
line-height: 1.4;
|
|
589
|
+
word-wrap: break-word;
|
|
590
|
+
overflow-wrap: break-word;
|
|
591
|
+
hyphens: auto;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
@media (max-width: 640px) {
|
|
595
|
+
.secondary-text {
|
|
596
|
+
font-size: var(--salla-autocomplete-secondary-text-font-size-mobile, 0.8125rem);
|
|
597
|
+
line-height: 1.3;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
.error-message {
|
|
602
|
+
margin-top: 0.5rem;
|
|
603
|
+
font-size: var(--salla-autocomplete-error-font-size, 0.875rem);
|
|
604
|
+
color: var(--salla-autocomplete-error-color, #dc2626);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.no-results {
|
|
608
|
+
padding: 1rem;
|
|
609
|
+
text-align: start;
|
|
610
|
+
color: var(--salla-autocomplete-no-results-color, #6b7280);
|
|
611
|
+
font-size: var(--salla-autocomplete-no-results-font-size, 0.875rem);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
.no-results.error-state {
|
|
615
|
+
color: var(--salla-autocomplete-error-color, #dc2626);
|
|
616
|
+
background-color: var(--salla-autocomplete-error-bg, #fef2f2);
|
|
617
|
+
border-radius: 0.375rem;
|
|
618
|
+
margin: 0.5rem;
|
|
619
|
+
padding: 0.875rem;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
@media (max-width: 640px) {
|
|
623
|
+
.no-results {
|
|
624
|
+
padding: 0.875rem;
|
|
625
|
+
font-size: var(--salla-autocomplete-no-results-font-size-mobile, 0.8125rem);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
.no-results.error-state {
|
|
629
|
+
margin: 0.375rem;
|
|
630
|
+
padding: 0.75rem;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
`,si([Ze({type:String})],oi.prototype,"proxyUrl",2),si([Ze({type:String})],oi.prototype,"authToken",2),si([Ze({type:String})],oi.prototype,"placeholder",2),si([Ze({type:String})],oi.prototype,"defaultPlace",2),si([Ze({type:String})],oi.prototype,"label",2),si([Ze({type:String})],oi.prototype,"className",2),si([Ze({type:String})],oi.prototype,"language",2),si([Ze({type:String})],oi.prototype,"dir",2),si([Ze({type:String})],oi.prototype,"mode",2),si([Ze({type:String})],oi.prototype,"name",2),si([Ze({type:Boolean})],oi.prototype,"required",2),si([Ze({type:String})],oi.prototype,"pattern",2),si([Ze({type:String})],oi.prototype,"tooltip",2),si([Ze({type:String})],oi.prototype,"selectedId",2),si([Ze({type:Array})],oi.prototype,"errors",2),si([Ze({type:Boolean})],oi.prototype,"disabled",2),si([Ze({type:String})],oi.prototype,"value",1),si([Ze({type:String})],oi.prototype,"country",1),si([Ze({type:Object})],oi.prototype,"locationBias",2),si([Ze({type:Object})],oi.prototype,"locationRestriction",2),si([Ze({type:Array})],oi.prototype,"types",2),si([Ze({type:String})],oi.prototype,"fieldsStr",1),si([Ze({type:Array})],oi.prototype,"fields",1),si([Ze({type:Boolean})],oi.prototype,"strictBounds",2),si([Ze({type:Boolean})],oi.prototype,"useSessionToken",2),si([Ze({type:Boolean})],oi.prototype,"resolve",2),si([Ze({type:Function})],oi.prototype,"onValidateAddress",2),si([Ze({type:Number})],oi.prototype,"debounceDelay",2),si([Ze({type:Number})],oi.prototype,"minChars",2),si([Ge()],oi.prototype,"predictions",2),si([Ge()],oi.prototype,"isOpen",2),si([Ge()],oi.prototype,"isLoading",2),si([Ge()],oi.prototype,"error",2),si([Ge()],oi.prototype,"activeIndex",2),si([Ge()],oi.prototype,"inputValue",2),si([Ge()],oi.prototype,"sessionToken",2),si([Ge()],oi.prototype,"validationError",2),si([Ge()],oi.prototype,"touched",2),si([Ge()],oi.prototype,"showNationalAddressIcon",2),si([(t,e)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i))(t,e,{get(){return(t=>t.renderRoot?.querySelector("input")??null)(this)}})],oi.prototype,"inputElement",2),oi=si([(t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)})("salla-address-autocomplete")],oi);let ai=!1;const ni=new Map,ri=new Promise(((t,e)=>{typeof window>"u"?t():(window.googleMapsInitCallback=t,window.gm_authFailure=()=>{e(new Error("Google Maps authentication failed"))})})),li=t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)},hi=globalThis,ci=hi.ShadowRoot&&(void 0===hi.ShadyCSS||hi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,di=Symbol(),ui=new WeakMap;let pi=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==di)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(ci&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=ui.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&ui.set(e,t))}return t}toString(){return this.cssText}};const mi=ci?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new pi("string"==typeof t?t:t+"",void 0,di))(e)})(t):t,{is:gi,defineProperty:bi,getOwnPropertyDescriptor:fi,getOwnPropertyNames:vi,getOwnPropertySymbols:yi,getPrototypeOf:wi}=Object,Si=globalThis,ki=Si.trustedTypes,Ci=ki?ki.emptyScript:"",xi=Si.reactiveElementPolyfillSupport,_i={toAttribute(t,e){switch(e){case Boolean:t=t?Ci:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},Ai=(t,e)=>!gi(t,e),$i={attribute:!0,type:String,converter:_i,reflect:!1,useDefault:!1,hasChanged:Ai};Symbol.metadata??=Symbol("metadata"),Si.litPropertyMetadata??=new WeakMap;class Mi extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=$i){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=this.getPropertyDescriptor(t,Symbol(),e);void 0!==i&&bi(this.prototype,t,i)}}static getPropertyDescriptor(t,e,i){const{get:s,set:o}=fi(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const a=s?.call(this);o?.call(this,e),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??$i}static _$Ei(){if(this.hasOwnProperty("elementProperties"))return;const t=wi(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty("finalized"))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty("properties")){const t=this.properties,e=[...vi(t),...yi(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(mi(t))}else void 0!==t&&e.push(mi(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(ci)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of e){const e=document.createElement("style"),s=hi.litNonce;void 0!==s&&e.setAttribute("nonce",s),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const o=(void 0!==i.converter?.toAttribute?i.converter:_i).toAttribute(e,i.type);this._$Em=t,null==o?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:_i;this._$Em=s;const a=o.fromAttribute(e,t.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(t,e,i,s=!1,o){if(void 0!==t){const a=this.constructor;if(!1===s&&(o=this[t]),i??=a.getPropertyOptions(t),!((i.hasChanged??Ai)(o,e)||i.useDefault&&i.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(a._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:o},a){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,a??e??this[t]),!0!==o||void 0!==a)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}}Mi.elementStyles=[],Mi.shadowRootOptions={mode:"open"},Mi.elementProperties=new Map,Mi.finalized=new Map,xi?.({ReactiveElement:Mi}),(Si.reactiveElementVersions??=[]).push("2.1.2");const Li={attribute:!0,type:String,converter:_i,reflect:!1,hasChanged:Ai},Ei=(t=Li,e,i)=>{const{kind:s,metadata:o}=i;let a=globalThis.litPropertyMetadata.get(o);if(void 0===a&&globalThis.litPropertyMetadata.set(o,a=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),a.set(i.name,t),"accessor"===s){const{name:s}=i;return{set(i){const o=e.get.call(this);e.set.call(this,i),this.requestUpdate(s,o,t,!0,i)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=i;return function(i){const o=this[s];e.call(this,i),this.requestUpdate(s,o,t,!0,i)}}throw Error("Unsupported decorator location: "+s)};function zi(t){return(e,i)=>"object"==typeof i?Ei(t,e,i):((t,e,i)=>{const s=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),s?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}function Ii(t){return zi({...t,state:!0,attribute:!1})}function Pi(t){return(e,i)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i))(e,i,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}function Ti(t,e,i){const s=[];return e.forEach((e=>{if(!(t&&google&&google.maps&&google.maps.event))return;const o=google.maps.event.addListener(t,e,(t=>{i(e,t)}));s.push((()=>{o&&google.maps.event.removeListener(o)}))})),s}function Bi(t){t.forEach((t=>t())),t.length=0}function Ni(t,e,i){if(!t)return;const s=`set${e.charAt(0).toUpperCase()}${e.slice(1)}`;"function"==typeof t[s]?t[s](i):e in t&&(t[e]=i)}const Di={en:{buttonLabel:"Use my current location",errorTitle:"Unable to Access Location",closeButton:"Continue",loading:"Getting your location...",loadingInstructions:"Please allow location access in your browser to continue",timerMessage:"This message will auto-hide in 7 seconds or click Continue",permissionDenied:"Location access was denied. Please enable location services in your browser settings.",positionUnavailable:"Your location is currently unavailable. Please check your device settings.",timeout:"Location request timed out. Please try again.",generalError:"Unable to get your location. Please try entering your address manually.",clickToSelectLocation:"You can also choose your location by clicking on the map"},ar:{buttonLabel:"استخدم موقعي الحالي",errorTitle:"تعذر الوصول إلى الموقع",closeButton:"متابعة",loading:"جار الحصول على موقعك...",loadingInstructions:"يرجى السماح بالوصول إلى الموقع في المتصفح للمتابعة",timerMessage:"ستختفي هذه الرسالة تلقائياً بعد 7 ثوانٍ أو انقر متابعة",permissionDenied:"تم رفض الوصول إلى الموقع. يرجى تفعيل خدمات الموقع في إعدادات المتصفح.",positionUnavailable:"موقعك غير متاح حالياً. يرجى التحقق من إعدادات جهازك.",timeout:"انتهت مهلة طلب الموقع. يرجى المحاولة مرة أخرى.",generalError:"تعذر الحصول على موقعك. يرجى إدخال عنوانك يدوياً.",clickToSelectLocation:"يمكنك أيضاً اختيار موقعك بالنقر على الخريطة"},es:{buttonLabel:"Usar mi ubicación actual",errorTitle:"Error de ubicación",closeButton:"Cerrar",loading:"Obteniendo tu ubicación...",loadingInstructions:"Permite el acceso a la ubicación en tu navegador para continuar",timerMessage:"Este mensaje se ocultará automáticamente en 7 segundos o haz clic en Cerrar",permissionDenied:"Se denegó el acceso a la ubicación. Habilita los servicios de ubicación en la configuración de tu navegador.",positionUnavailable:"Tu ubicación no está disponible actualmente. Verifica la configuración de tu dispositivo.",timeout:"La solicitud de ubicación expiró. Inténtalo de nuevo.",generalError:"No se pudo obtener tu ubicación. Intenta ingresar tu dirección manualmente.",clickToSelectLocation:"Haz clic en el mapa para seleccionar una ubicación"},fr:{buttonLabel:"Utiliser ma position actuelle",errorTitle:"Erreur de localisation",closeButton:"Continuer",loading:"Obtention de votre position...",loadingInstructions:"Veuillez autoriser l'accès à la localisation dans votre navigateur pour continuer",timerMessage:"Ce message se masquera automatiquement dans 7 secondes ou cliquez sur Continuer",permissionDenied:"L'accès à la localisation a été refusé. Veuillez activer les services de localisation dans les paramètres de votre navigateur.",positionUnavailable:"Votre position n'est pas disponible actuellement. Veuillez vérifier les paramètres de votre appareil.",timeout:"La demande de localisation a expiré. Veuillez réessayer.",generalError:"Impossible d'obtenir votre position. Veuillez entrer votre adresse manuellement.",clickToSelectLocation:"Vous pouvez également choisir votre position en cliquant sur la carte"},de:{buttonLabel:"Meinen aktuellen Standort verwenden",errorTitle:"Standortfehler",closeButton:"Schließen",loading:"Getting your location...",loadingInstructions:"Please allow location access in your browser to continue",timerMessage:"This message will auto-hide in 7 seconds or click Continue",permissionDenied:"Der Zugriff auf den Standort wurde verweigert. Bitte aktivieren Sie die Standortdienste in Ihren Browsereinstellungen.",positionUnavailable:"Ihr Standort ist derzeit nicht verfügbar. Bitte überprüfen Sie Ihre Geräteeinstellungen.",timeout:"Standortanfrage ist abgelaufen. Bitte versuchen Sie es erneut.",generalError:"Ihr Standort konnte nicht abgerufen werden. Bitte geben Sie Ihre Adresse manuell ein.",clickToSelectLocation:"Klicken Sie auf die Karte, um einen Standort auszuwählen"},zh:{buttonLabel:"使用我的当前位置",errorTitle:"位置错误",closeButton:"关闭",loading:"Getting your location...",loadingInstructions:"Please allow location access in your browser to continue",timerMessage:"This message will auto-hide in 7 seconds or click Continue",permissionDenied:"位置访问被拒绝。请在浏览器设置中启用位置服务。",positionUnavailable:"您的位置当前不可用。请检查您的设备设置。",timeout:"位置请求超时。请重试。",generalError:"无法获取您的位置。请尝试手动输入地址。",clickToSelectLocation:"点击地图选择位置"},ja:{buttonLabel:"現在地を使用",errorTitle:"位置情報エラー",closeButton:"閉じる",loading:"Getting your location...",loadingInstructions:"Please allow location access in your browser to continue",timerMessage:"This message will auto-hide in 7 seconds or click Continue",permissionDenied:"位置情報へのアクセスが拒否されました。ブラウザの設定で位置情報サービスを有効にしてください。",positionUnavailable:"現在位置が利用できません。デバイスの設定を確認してください。",timeout:"位置情報リクエストがタイムアウトしました。もう一度お試しください。",generalError:"位置情報を取得できませんでした。住所を手動で入力してください。",clickToSelectLocation:"地図をクリックして場所を選択"},pt:{buttonLabel:"Usar minha localização atual",errorTitle:"Erro de localização",closeButton:"Fechar",loading:"Getting your location...",loadingInstructions:"Please allow location access in your browser to continue",timerMessage:"This message will auto-hide in 7 seconds or click Continue",permissionDenied:"O acesso à localização foi negado. Ative os serviços de localização nas configurações do navegador.",positionUnavailable:"Sua localização não está disponível no momento. Verifique as configurações do dispositivo.",timeout:"A solicitação de localização expirou. Tente novamente.",generalError:"Não foi possível obter sua localização. Tente inserir seu endereço manualmente.",clickToSelectLocation:"Clique no mapa para selecionar um local"},ru:{buttonLabel:"Использовать мое текущее местоположение",errorTitle:"Ошибка местоположения",closeButton:"Закрыть",loading:"Getting your location...",loadingInstructions:"Please allow location access in your browser to continue",timerMessage:"This message will auto-hide in 7 seconds or click Continue",permissionDenied:"Доступ к местоположению был запрещен. Включите службы определения местоположения в настройках браузера.",positionUnavailable:"Ваше местоположение в настоящее время недоступно. Проверьте настройки устройства.",timeout:"Время ожидания запроса местоположения истекло. Попробуйте еще раз.",generalError:"Не удалось получить ваше местоположение. Попробуйте ввести адрес вручную.",clickToSelectLocation:"Нажмите на карту, чтобы выбрать местоположение"},it:{buttonLabel:"Usa la mia posizione attuale",errorTitle:"Errore di posizione",closeButton:"Chiudi",loading:"Getting your location...",loadingInstructions:"Please allow location access in your browser to continue",timerMessage:"This message will auto-hide in 7 seconds or click Continue",permissionDenied:"L'accesso alla posizione è stato negato. Abilita i servizi di localizzazione nelle impostazioni del browser.",positionUnavailable:"La tua posizione non è attualmente disponibile. Controlla le impostazioni del dispositivo.",timeout:"La richiesta di posizione è scaduta. Riprova.",generalError:"Impossibile ottenere la tua posizione. Prova a inserire manualmente il tuo indirizzo.",clickToSelectLocation:"Fai clic sulla mappa per selezionare una posizione"},nl:{buttonLabel:"Gebruik mijn huidige locatie",errorTitle:"Locatiefout",closeButton:"Sluiten",loading:"Getting your location...",loadingInstructions:"Please allow location access in your browser to continue",timerMessage:"This message will auto-hide in 7 seconds or click Continue",permissionDenied:"Toegang tot locatie is geweigerd. Schakel locatieservices in in uw browserinstellingen.",positionUnavailable:"Uw locatie is momenteel niet beschikbaar. Controleer uw apparaatinstellingen.",timeout:"Locatieverzoek is verlopen. Probeer het opnieuw.",generalError:"Kan uw locatie niet ophalen. Probeer uw adres handmatig in te voeren.",clickToSelectLocation:"Klik op de kaart om een locatie te selecteren"},tr:{buttonLabel:"Mevcut konumumu kullan",errorTitle:"Konum Hatası",closeButton:"Kapat",loading:"Getting your location...",loadingInstructions:"Please allow location access in your browser to continue",timerMessage:"This message will auto-hide in 7 seconds or click Continue",permissionDenied:"Konum erişimi reddedildi. Lütfen tarayıcı ayarlarınızda konum hizmetlerini etkinleştirin.",positionUnavailable:"Konumunuz şu anda kullanılamıyor. Lütfen cihaz ayarlarınızı kontrol edin.",timeout:"Konum isteği zaman aşımına uğradı. Lütfen tekrar deneyin.",generalError:"Konumunuz alınamadı. Lütfen adresinizi manuel olarak girmeyi deneyin.",clickToSelectLocation:"Bir konum seçmek için haritaya tıklayın"},ko:{buttonLabel:"현재 위치 사용",errorTitle:"위치 오류",closeButton:"닫기",loading:"Getting your location...",loadingInstructions:"Please allow location access in your browser to continue",timerMessage:"This message will auto-hide in 7 seconds or click Continue",permissionDenied:"위치 액세스가 거부되었습니다. 브라우저 설정에서 위치 서비스를 활성화하십시오.",positionUnavailable:"현재 위치를 사용할 수 없습니다. 기기 설정을 확인하십시오.",timeout:"위치 요청 시간이 초과되었습니다. 다시 시도하십시오.",generalError:"위치를 가져올 수 없습니다. 수동으로 주소를 입력해 보십시오.",clickToSelectLocation:"지도를 클릭하여 위치를 선택하십시오"},hi:{buttonLabel:"मेरा वर्तमान स्थान उपयोग करें",errorTitle:"स्थान त्रुटि",closeButton:"बंद करें",loading:"Getting your location...",loadingInstructions:"Please allow location access in your browser to continue",timerMessage:"This message will auto-hide in 7 seconds or click Continue",permissionDenied:"स्थान पहुंच अस्वीकार कर दी गई थी। कृपया अपनी ब्राउज़र सेटिंग में स्थान सेवाएं सक्षम करें।",positionUnavailable:"आपका स्थान वर्तमान में उपलब्ध नहीं है। कृपया अपनी डिवाइस सेटिंग्स जांचें।",timeout:"स्थान अनुरोध समय समाप्त हो गया। कृपया पुनः प्रयास करें।",generalError:"आपका स्थान प्राप्त करने में असमर्थ। कृपया अपना पता मैन्युअल रूप से दर्ज करने का प्रयास करें।",clickToSelectLocation:"स्थान चुनने के लिए मानचित्र पर क्लिक करें"}},Oi=new Set(["ar","he","fa","ur"]);function Ui(t="en"){return Di[t]||Di.en}function Fi(t){return Oi.has(t)}var Ri=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,qi=(t,e,i,s)=>{for(var o,a=s>1?void 0:s?ji(e,i):e,n=t.length-1;n>=0;n--)(o=t[n])&&(a=(s?o(e,i,a):o(a))||a);return s&&a&&Ri(e,i,a),a};let Zi=class extends Nt{constructor(){super(...arguments),this.zoom=15,this.mapTypeId="roadmap",this.heading=0,this.tilt=0,this.gestureHandling="cooperative",this.minZoom=2,this.maxZoom=19,this.disableDefaultUI=!1,this.mapTypeControl=!1,this.streetViewControl=!1,this.rotateControl=!1,this.fullscreenControl=!1,this.enableGeolocation=!1,this.showLocationMarker=!0,this.geolocationOptions={maximumAge:6e4,timeout:1e4,enableHighAccuracy:!0},this.locationMarkerBackground="#4285F4",this.locationMarkerBorderColor="#1967D2",this.locationMarkerGlyphColor="#FFFFFF",this.locationMarkerScale=1.3,this.locationCircleOptions={},this.language="en",this.options={},this.enableAutocomplete=!1,this.autocompleteProxyUrl="https://api.salla.dev",this.autocompleteStrictBounds=!1,this.autocompleteResolve=!1,this.autocompleteDebounceDelay=300,this.autocompleteMinChars=3,this.geolocationLoading=!1,this.geolocationError=null,this.showLoadingOverlay=!1,this.buttonState="normal",this.eventListeners=[],this.autocompleteListenerAttached=!1}async connectedCallback(){super.connectedCallback(),Fi(this.language)&&(document.dir="rtl")}async firstUpdated(){await ri,this.createMap()}clearAutocompleteInput(){if(!this.autocompleteElement)return;const t=this.autocompleteElement.shadowRoot?.querySelector("input");t&&(t.value="",this.autocompleteElement.inputValue="",this.autocompleteElement.value="")}setupAutocompleteListener(){!this.enableAutocomplete||!this.autocompleteElement||this.autocompleteListenerAttached||(this.autocompleteElement.addEventListener("place-select",(t=>{const{place:e}=t.detail;if(e?.geometry?.location){const{lat:t,lng:i}=e.geometry.location;this.setLocation(t,i,50,!0),this.dispatchMapEvent("location_changed",{position:{lat:t,lng:i},accuracy:50,source:"autocomplete",place:{placeId:e.place_id,formattedAddress:e.formatted_address,addressComponents:e.address_components,name:e.name,types:e.types}}),this.dispatchMapEvent("autocomplete_place_selected",{place:e})}})),this.autocompleteListenerAttached=!0)}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}updated(t){super.updated(t),this.enableAutocomplete&&!this.autocompleteListenerAttached&&setTimeout((()=>this.setupAutocompleteListener()),0),this.map&&(t.has("center")&&this.center&&Ni(this.map,"center",this.center),t.has("zoom")&&void 0!==this.zoom&&Ni(this.map,"zoom",this.zoom),t.has("minZoom")&&void 0!==this.minZoom&&this.map&&this.map.setOptions({minZoom:this.minZoom}),t.has("maxZoom")&&void 0!==this.maxZoom&&this.map&&this.map.setOptions({maxZoom:this.maxZoom}),t.has("mapTypeId")&&this.mapTypeId&&Ni(this.map,"mapTypeId",this.mapTypeId),t.has("heading")&&void 0!==this.heading&&Ni(this.map,"heading",this.heading),t.has("tilt")&&void 0!==this.tilt&&Ni(this.map,"tilt",this.tilt),t.has("locationMarkerPosition")&&this.locationMarkerPosition&&this.showLocationMarker&&this.setLocation(this.locationMarkerPosition.lat,this.locationMarkerPosition.lng,this.locationMarkerPosition.accuracy))}createMap(){if(!this.mapElement)return;const t={center:this.center,zoom:this.zoom,mapId:this.mapId,mapTypeId:this.mapTypeId,heading:this.heading,tilt:this.tilt,gestureHandling:this.gestureHandling,minZoom:this.minZoom,maxZoom:this.maxZoom,disableDefaultUI:this.disableDefaultUI,zoomControl:this.zoomControl,mapTypeControl:this.mapTypeControl,scaleControl:this.scaleControl,streetViewControl:this.streetViewControl,rotateControl:this.rotateControl,fullscreenControl:this.fullscreenControl,disableDoubleClickZoom:!0,keyboardShortcuts:!1,zoomControlOptions:{position:google.maps.ControlPosition.RIGHT_BOTTOM},...this.options};this.map=new google.maps.Map(this.mapElement,t);const e=google.maps.event.addListener(this.map,"click",(t=>{if(t.latLng&&this.showLocationMarker){const e=t.latLng.lat(),i=t.latLng.lng();this.setLocation(e,i,50,!1),this.clearAutocompleteInput(),this.dispatchMapEvent("location_changed",{position:{lat:e,lng:i},accuracy:50,source:"map-click"})}}));this.eventListeners=Ti(this.map,["click","dblclick","drag","dragend","dragstart","idle","mousemove","mouseout","mouseover","resize","rightclick","tilesloaded"],((t,e)=>{this.dispatchMapEvent(t,e)})),this.eventListeners.push((()=>{e&&google.maps.event.removeListener(e)})),["center","zoom","bounds","mapTypeId"].forEach((t=>{const e=`${t}_changed`,i=google.maps.event.addListener(this.map,e,(()=>{const i=`get${t.charAt(0).toUpperCase()}${t.slice(1)}`;if("function"==typeof this.map[i]){const t=this.map[i]();this.dispatchMapEvent(e,t)}}));this.eventListeners.push((()=>{i&&google.maps.event.removeListener(i)}))})),this.dispatchEvent(new CustomEvent("gmap-ready",{detail:{map:this.map},bubbles:!0,composed:!0})),this.locationMarkerPosition&&this.showLocationMarker&&this.setLocation(this.locationMarkerPosition.lat,this.locationMarkerPosition.lng,this.locationMarkerPosition.accuracy)}dispatchMapEvent(t,e){let i=t;(t.includes("_changed")||t.startsWith("geolocation_")||t.startsWith("location_"))&&(i=`gmap-${t.replace(/_/g,"-")}`),this.dispatchEvent(new CustomEvent(i,{detail:e,bubbles:!0,composed:!0}))}cleanup(){Bi(this.eventListeners),this.locationMarker&&(this.locationMarker.map=null,this.locationMarker=void 0),this.locationCircle&&(this.locationCircle.setMap(null),this.locationCircle=void 0),this.map=void 0}panBy(t,e){this.map?.panBy(t,e)}panTo(t){this.map?.panTo(t)}panToBounds(t){this.map?.panToBounds(t)}fitBounds(t){this.map?.fitBounds(t)}resize(){this.map&&google.maps.event.trigger(this.map,"resize")}resizePreserveCenter(){if(!this.map)return;const t=this.map.getCenter();google.maps.event.trigger(this.map,"resize"),t&&this.map.setCenter(t)}setLocation(t,e,i=50,s=!0){if(!this.map)return void console.warn("GMapMap: Cannot set location before map is initialized");const o={lat:t,lng:e};s&&this.map.panTo(o),this.showLocationMarker&&this.addLocationMarker(o,i),this.dispatchMapEvent("location_changed",{position:o,accuracy:i,source:"programmatic"})}async getCurrentLocation(t=!1){if(!navigator.geolocation)throw this.dispatchMapEvent("geolocation_error",{code:"NOT_SUPPORTED",message:"Geolocation is not supported by this browser"}),t||this.showGeolocationError(this.getTranslation("generalError")),new Error("NOT_SUPPORTED");this.geolocationLoading=!0,this.buttonState="loading",this.dispatchMapEvent("geolocation_loading",{message:"Getting your location..."});const e=t?null:setTimeout((()=>{this.geolocationLoading&&(this.showLoadingOverlay=!0)}),150);return new Promise(((i,s)=>{navigator.geolocation.getCurrentPosition((t=>{const s={lat:t.coords.latitude,lng:t.coords.longitude};if(e&&clearTimeout(e),this.geolocationLoading=!1,this.showLoadingOverlay=!1,this.buttonState="success",setTimeout((()=>{this.buttonState="normal"}),2e3),this.map){this.map.panTo(s);const e=t.coords.accuracy;let i=15;i=e>1e3?12:e>500?13:e>100?14:16,this.map.setZoom(i),this.showLocationMarker&&this.addLocationMarker(s,e),this.clearAutocompleteInput()}this.dispatchMapEvent("geolocation_success",{position:s,accuracy:t.coords.accuracy,altitude:t.coords.altitude,altitudeAccuracy:t.coords.altitudeAccuracy,heading:t.coords.heading,speed:t.coords.speed,timestamp:t.timestamp}),this.dispatchMapEvent("location_changed",{position:s,accuracy:t.coords.accuracy,source:"geolocation"}),i(s)}),(i=>{e&&clearTimeout(e),this.geolocationLoading=!1,this.showLoadingOverlay=!1,this.buttonState="error",setTimeout((()=>{this.buttonState="normal"}),2e3);let o="GENERAL_ERROR",a=this.getTranslation("generalError");i.code===i.PERMISSION_DENIED?(o="PERMISSION_DENIED",a=this.getTranslation("permissionDenied")):i.code===i.POSITION_UNAVAILABLE?(o="POSITION_UNAVAILABLE",a=this.getTranslation("positionUnavailable")):i.code===i.TIMEOUT&&(o="TIMEOUT",a=this.getTranslation("timeout")),this.dispatchMapEvent("geolocation_error",{code:o,message:a,error:i}),t||this.showGeolocationError(a),s(i)}),this.geolocationOptions)}))}handleGeolocationClick(){this.geolocationError=null,this.getCurrentLocation()}async addLocationMarker(t,e){if(this.map){if(this.locationMarker&&(this.locationMarker.map=null,this.locationMarker=void 0),this.locationCircle&&(this.locationCircle.setMap(null),this.locationCircle=void 0),!this.mapId)return void console.warn("GMapMap: mapId is required for location marker. Please set the mapId property on <gmap-map>. Get a Map ID from: https://console.cloud.google.com/google/maps-apis/studio/maps");try{const{AdvancedMarkerElement:e,PinElement:i}=await google.maps.importLibrary("marker"),s=new i({background:this.locationMarkerBackground,borderColor:this.locationMarkerBorderColor,glyphColor:this.locationMarkerGlyphColor,scale:this.locationMarkerScale});this.locationMarker=new e({map:this.map,position:t,title:"Your Location (Drag to adjust)",content:s.element,gmpDraggable:!0}),this.locationMarker.addListener("dragend",(()=>{if(this.locationMarker&&this.locationCircle){const t=this.locationMarker.position,e=t.toJSON?t.toJSON():{lat:t.lat(),lng:t.lng()};this.locationCircle.setCenter(e);const i=this.locationCircle.getRadius();this.clearAutocompleteInput(),this.dispatchMapEvent("location_marker_dragend",{position:e,accuracy:i}),this.dispatchMapEvent("location_changed",{position:e,accuracy:i,source:"marker-drag"})}}))}catch(t){console.error("Error creating AdvancedMarkerElement:",t)}this.locationCircle=new google.maps.Circle({map:this.map,center:t,radius:e,fillColor:"#4285F4",fillOpacity:.15,strokeColor:"#4285F4",strokeOpacity:.4,strokeWeight:1,clickable:!1,...this.locationCircleOptions})}}showGeolocationError(t){this.geolocationError=t,setTimeout((()=>{this.geolocationError=null}),7e3)}getTranslation(t){const e={loading:this.geolocationLoadingTitle,loadingInstructions:this.geolocationLoadingInstructions,errorTitle:this.geolocationErrorTitle,closeButton:this.geolocationErrorButtonText,timerMessage:this.geolocationErrorTimerMessage,clickToSelectLocation:this.geolocationClickToSelectMessage,generalError:this.geolocationGeneralErrorMessage,permissionDenied:this.geolocationPermissionDeniedMessage,positionUnavailable:this.geolocationPositionUnavailableMessage,timeout:this.geolocationTimeoutMessage}[t];if(null!=e&&""!==e)return e;const i=Ui(this.language);return i[t]||i.generalError}get buttonLabel(){return void 0!==this.geolocationButtonLabel?this.geolocationButtonLabel:Ui(this.language).buttonLabel||""}getButtonIconColor(){switch(this.buttonState){case"loading":return"#999";case"success":return"#4285F4";case"error":return"#EA4335";default:return"#666"}}getMap(){return this.map}render(){const t=Fi(this.language)?"rtl":"ltr";return vt`
|
|
634
|
+
<div class="map-page-wrapper">
|
|
635
|
+
${this.enableAutocomplete?vt`
|
|
636
|
+
<div class="auto-complete-map-wrapper">
|
|
637
|
+
<div class="auto-complete-map-box" dir="${t}">
|
|
638
|
+
<salla-address-autocomplete
|
|
639
|
+
.proxyUrl=${this.autocompleteProxyUrl}
|
|
640
|
+
.authToken=${this.autocompleteAuthToken||null}
|
|
641
|
+
.placeholder=${this.autocompletePlaceholder||""}
|
|
642
|
+
.label=${this.autocompleteLabel||null}
|
|
643
|
+
.language=${this.language}
|
|
644
|
+
.country=${this.autocompleteCountry||null}
|
|
645
|
+
.locationBias=${this.autocompleteLocationBias||null}
|
|
646
|
+
.locationRestriction=${this.autocompleteLocationRestriction||null}
|
|
647
|
+
.types=${this.autocompleteTypes?this.autocompleteTypes.split(",").map((t=>t.trim())):null}
|
|
648
|
+
.fieldsStr=${this.autocompleteFields||null}
|
|
649
|
+
.strictBounds=${this.autocompleteStrictBounds}
|
|
650
|
+
.resolve=${this.autocompleteResolve}
|
|
651
|
+
.debounceDelay=${this.autocompleteDebounceDelay}
|
|
652
|
+
.minChars=${this.autocompleteMinChars}
|
|
653
|
+
></salla-address-autocomplete>
|
|
654
|
+
${this.autocompleteHint?vt`<span class="hint-wrapper">${this.autocompleteHint}</span>`:""}
|
|
655
|
+
</div>
|
|
656
|
+
</div>
|
|
657
|
+
`:""}
|
|
658
|
+
|
|
659
|
+
<div class="map-container">
|
|
660
|
+
<div class="map"></div>
|
|
661
|
+
<slot></slot>
|
|
662
|
+
|
|
663
|
+
${this.enableGeolocation?vt`
|
|
664
|
+
<div class="controls-overlay">
|
|
665
|
+
<button
|
|
666
|
+
class="geolocation-button ${this.buttonLabel&&this.buttonLabel.trim()?"has-label":""}"
|
|
667
|
+
@click=${this.handleGeolocationClick}
|
|
668
|
+
title="Show your location"
|
|
669
|
+
?disabled=${this.geolocationLoading}
|
|
670
|
+
>
|
|
671
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="${this.getButtonIconColor()}">
|
|
672
|
+
<path
|
|
673
|
+
d="M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3A8.994 8.994 0 0 0 13 3.06V1h-2v2.06A8.994 8.994 0 0 0 3.06 11H1v2h2.06A8.994 8.994 0 0 0 11 20.94V23h2v-2.06A8.994 8.994 0 0 0 20.94 13H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"
|
|
674
|
+
/>
|
|
675
|
+
</svg>
|
|
676
|
+
${this.buttonLabel&&this.buttonLabel.trim()?vt`<span class="label">${this.buttonLabel}</span>`:""}
|
|
677
|
+
</button>
|
|
678
|
+
</div>
|
|
679
|
+
`:""}
|
|
680
|
+
|
|
681
|
+
${this.showLoadingOverlay&&!this.geolocationError?vt`
|
|
682
|
+
<div class="loading-overlay">
|
|
683
|
+
<div class="spinner"></div>
|
|
684
|
+
<div class="title">
|
|
685
|
+
${this.getTranslation("loading")}
|
|
686
|
+
</div>
|
|
687
|
+
<div class="instructions">
|
|
688
|
+
${this.getTranslation("loadingInstructions")}
|
|
689
|
+
</div>
|
|
690
|
+
</div>
|
|
691
|
+
`:""}
|
|
692
|
+
|
|
693
|
+
${this.geolocationError&&!this.showLoadingOverlay?vt`
|
|
694
|
+
<div class="error-overlay">
|
|
695
|
+
<div class="error-icon">
|
|
696
|
+
<svg width="40" height="40" viewBox="0 0 24 24" fill="none">
|
|
697
|
+
<circle cx="12" cy="12" r="10" stroke="#ef4444" stroke-width="2" fill="none"/>
|
|
698
|
+
<path d="M12 8v4M12 16h.01" stroke="#ef4444" stroke-width="2" stroke-linecap="round"/>
|
|
699
|
+
</svg>
|
|
700
|
+
</div>
|
|
701
|
+
<div class="error-title">
|
|
702
|
+
${this.getTranslation("errorTitle")}
|
|
703
|
+
</div>
|
|
704
|
+
<div class="error-message">${this.geolocationError}</div>
|
|
705
|
+
<div class="map-hint">
|
|
706
|
+
${this.getTranslation("clickToSelectLocation")}
|
|
707
|
+
</div>
|
|
708
|
+
<div class="timer-message">
|
|
709
|
+
${this.getTranslation("timerMessage")}
|
|
710
|
+
</div>
|
|
711
|
+
<button @click=${()=>this.geolocationError=null}>
|
|
712
|
+
${this.getTranslation("closeButton")}
|
|
713
|
+
</button>
|
|
714
|
+
</div>
|
|
715
|
+
`:""}
|
|
716
|
+
</div>
|
|
717
|
+
</div>
|
|
718
|
+
`}};Zi.styles=D`
|
|
719
|
+
:host {
|
|
720
|
+
display: block;
|
|
721
|
+
position: relative;
|
|
722
|
+
width: 100%;
|
|
723
|
+
height: 400px;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
@media (max-width: 640px) {
|
|
727
|
+
:host {
|
|
728
|
+
height: 65vh;
|
|
729
|
+
min-height: 300px;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
@media (max-width: 640px) and (min-height: 700px) {
|
|
734
|
+
:host {
|
|
735
|
+
height: 65vh;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
.map-container {
|
|
740
|
+
width: 100%;
|
|
741
|
+
height: 100%;
|
|
742
|
+
position: relative;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
.map {
|
|
746
|
+
width: 100%;
|
|
747
|
+
height: 100%;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
.controls-overlay {
|
|
751
|
+
position: absolute;
|
|
752
|
+
top: 0;
|
|
753
|
+
left: 0;
|
|
754
|
+
right: 0;
|
|
755
|
+
bottom: 0;
|
|
756
|
+
pointer-events: none;
|
|
757
|
+
z-index: 40;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
.controls-overlay > * {
|
|
761
|
+
pointer-events: auto;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
.geolocation-button {
|
|
765
|
+
position: absolute;
|
|
766
|
+
bottom: 23px;
|
|
767
|
+
left: 10px;
|
|
768
|
+
right: auto;
|
|
769
|
+
background: #fff;
|
|
770
|
+
border: none;
|
|
771
|
+
border-radius: 2px;
|
|
772
|
+
box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px;
|
|
773
|
+
cursor: pointer;
|
|
774
|
+
padding: 10px;
|
|
775
|
+
height: 40px;
|
|
776
|
+
display: flex;
|
|
777
|
+
align-items: center;
|
|
778
|
+
justify-content: center;
|
|
779
|
+
gap: 8px;
|
|
780
|
+
outline: none;
|
|
781
|
+
color: rgb(86, 86, 86);
|
|
782
|
+
font-family: var(--gmap-font-family, Roboto, Arial, sans-serif);
|
|
783
|
+
font-size: 14px;
|
|
784
|
+
white-space: nowrap;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
@media (max-width: 640px) {
|
|
788
|
+
.geolocation-button {
|
|
789
|
+
bottom: 23px;
|
|
790
|
+
left: 10px;
|
|
791
|
+
right: auto;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
.geolocation-button .label {
|
|
795
|
+
display: none;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
.geolocation-button {
|
|
799
|
+
width: 40px !important;
|
|
800
|
+
padding: 10px !important;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
.geolocation-button.has-label {
|
|
805
|
+
width: auto;
|
|
806
|
+
padding: 8px 12px;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
.geolocation-button:not(.has-label) {
|
|
810
|
+
width: 40px;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
.geolocation-button:hover:not(:disabled) {
|
|
814
|
+
background: #ebebeb;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
.geolocation-button:disabled {
|
|
818
|
+
cursor: wait;
|
|
819
|
+
opacity: 0.6;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
.geolocation-button svg {
|
|
823
|
+
flex-shrink: 0;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
.geolocation-button .label {
|
|
827
|
+
font-weight: 500;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
.loading-overlay {
|
|
831
|
+
position: absolute;
|
|
832
|
+
top: 0;
|
|
833
|
+
left: 0;
|
|
834
|
+
right: 0;
|
|
835
|
+
bottom: 0;
|
|
836
|
+
background: rgba(0, 0, 0, 0.7);
|
|
837
|
+
z-index: 200;
|
|
838
|
+
display: flex;
|
|
839
|
+
flex-direction: column;
|
|
840
|
+
align-items: center;
|
|
841
|
+
justify-content: center;
|
|
842
|
+
gap: 16px;
|
|
843
|
+
padding: 16px;
|
|
844
|
+
font-family: var(--gmap-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
.loading-overlay .spinner {
|
|
848
|
+
width: 48px;
|
|
849
|
+
height: 48px;
|
|
850
|
+
border: 4px solid rgba(255, 255, 255, 0.3);
|
|
851
|
+
border-top-color: #ffffff;
|
|
852
|
+
border-radius: 50%;
|
|
853
|
+
animation: spin 1s linear infinite;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
@keyframes spin {
|
|
857
|
+
to { transform: rotate(360deg); }
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
.loading-overlay .title {
|
|
861
|
+
font-size: 18px;
|
|
862
|
+
font-weight: 600;
|
|
863
|
+
color: #ffffff;
|
|
864
|
+
margin: 0;
|
|
865
|
+
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
.loading-overlay .instructions {
|
|
869
|
+
font-size: 14px;
|
|
870
|
+
color: #ffffff;
|
|
871
|
+
line-height: 1.5;
|
|
872
|
+
margin: 0;
|
|
873
|
+
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
874
|
+
text-align: center;
|
|
875
|
+
max-width: 90%;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
.error-overlay {
|
|
879
|
+
position: absolute;
|
|
880
|
+
top: 0;
|
|
881
|
+
left: 0;
|
|
882
|
+
right: 0;
|
|
883
|
+
bottom: 0;
|
|
884
|
+
background: rgba(0, 0, 0, 0.7);
|
|
885
|
+
z-index: 200;
|
|
886
|
+
display: flex;
|
|
887
|
+
flex-direction: column;
|
|
888
|
+
align-items: center;
|
|
889
|
+
justify-content: center;
|
|
890
|
+
gap: 12px;
|
|
891
|
+
padding: 16px;
|
|
892
|
+
font-family: var(--gmap-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
.error-overlay .error-icon svg {
|
|
896
|
+
display: block;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
.error-overlay .error-title {
|
|
900
|
+
font-size: 17px;
|
|
901
|
+
font-weight: 600;
|
|
902
|
+
color: #ef4444;
|
|
903
|
+
margin: 0;
|
|
904
|
+
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
.error-overlay .error-message {
|
|
908
|
+
font-size: 14px;
|
|
909
|
+
color: #ffffff;
|
|
910
|
+
line-height: 1.4;
|
|
911
|
+
margin: 0;
|
|
912
|
+
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
913
|
+
text-align: center;
|
|
914
|
+
max-width: 90%;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
.error-overlay .map-hint {
|
|
918
|
+
font-size: 12px;
|
|
919
|
+
color: #d4d4d4;
|
|
920
|
+
line-height: 1.4;
|
|
921
|
+
margin: 0;
|
|
922
|
+
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
923
|
+
text-align: center;
|
|
924
|
+
font-style: italic;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
.error-overlay .timer-message {
|
|
928
|
+
font-size: 12px;
|
|
929
|
+
color: #d4d4d4;
|
|
930
|
+
margin: 0;
|
|
931
|
+
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
.error-overlay button {
|
|
935
|
+
margin-top: 4px;
|
|
936
|
+
padding: 8px 24px;
|
|
937
|
+
background: #ffffff;
|
|
938
|
+
color: #18181b;
|
|
939
|
+
border: none;
|
|
940
|
+
border-radius: 8px;
|
|
941
|
+
font-size: 14px;
|
|
942
|
+
font-weight: 600;
|
|
943
|
+
cursor: pointer;
|
|
944
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
.error-overlay button:hover {
|
|
948
|
+
background: #f4f4f5;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
.map-page-wrapper {
|
|
952
|
+
position: relative;
|
|
953
|
+
width: 100%;
|
|
954
|
+
height: 100%;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
.auto-complete-map-wrapper {
|
|
958
|
+
position: absolute;
|
|
959
|
+
z-index: 50;
|
|
960
|
+
padding: 1rem;
|
|
961
|
+
width: 100%;
|
|
962
|
+
top: 0;
|
|
963
|
+
left: 0;
|
|
964
|
+
right: 0;
|
|
965
|
+
pointer-events: none;
|
|
966
|
+
box-sizing: border-box;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
@media (max-width: 640px) {
|
|
970
|
+
.auto-complete-map-wrapper {
|
|
971
|
+
padding: 0.75rem 0.5rem;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
.auto-complete-map-wrapper > * {
|
|
976
|
+
pointer-events: auto;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
.auto-complete-map-box {
|
|
980
|
+
width: 100%;
|
|
981
|
+
display: flex;
|
|
982
|
+
flex-direction: column;
|
|
983
|
+
padding: 1rem;
|
|
984
|
+
background-color: #ffffffb2;
|
|
985
|
+
border-radius: 8px;
|
|
986
|
+
backdrop-filter: blur(4px);
|
|
987
|
+
box-sizing: border-box;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
@media (max-width: 640px) {
|
|
991
|
+
.auto-complete-map-box {
|
|
992
|
+
padding: 0.75rem;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
.auto-complete-map-box .hint-wrapper {
|
|
997
|
+
font-size: 12px;
|
|
998
|
+
color: #666666;
|
|
999
|
+
margin-top: 0.5rem;
|
|
1000
|
+
text-align: start;
|
|
1001
|
+
direction: inherit;
|
|
1002
|
+
}
|
|
1003
|
+
`,qi([zi({type:Object})],Zi.prototype,"center",2),qi([zi({type:Number})],Zi.prototype,"zoom",2),qi([zi({type:String,attribute:"map-id"})],Zi.prototype,"mapId",2),qi([zi({type:String,attribute:"map-type-id"})],Zi.prototype,"mapTypeId",2),qi([zi({type:Number})],Zi.prototype,"heading",2),qi([zi({type:Number})],Zi.prototype,"tilt",2),qi([zi({type:Object})],Zi.prototype,"bounds",2),qi([zi({type:String})],Zi.prototype,"gestureHandling",2),qi([zi({type:Number})],Zi.prototype,"minZoom",2),qi([zi({type:Number})],Zi.prototype,"maxZoom",2),qi([zi({type:Boolean})],Zi.prototype,"disableDefaultUI",2),qi([zi({type:Boolean})],Zi.prototype,"zoomControl",2),qi([zi({type:Boolean})],Zi.prototype,"mapTypeControl",2),qi([zi({type:Boolean})],Zi.prototype,"scaleControl",2),qi([zi({type:Boolean})],Zi.prototype,"streetViewControl",2),qi([zi({type:Boolean})],Zi.prototype,"rotateControl",2),qi([zi({type:Boolean})],Zi.prototype,"fullscreenControl",2),qi([zi({type:Boolean,attribute:"enable-geolocation"})],Zi.prototype,"enableGeolocation",2),qi([zi({type:Boolean,attribute:"show-location-marker"})],Zi.prototype,"showLocationMarker",2),qi([zi({type:Object})],Zi.prototype,"geolocationOptions",2),qi([zi({type:Object,attribute:"location-marker-position"})],Zi.prototype,"locationMarkerPosition",2),qi([zi({type:String,attribute:"location-marker-background"})],Zi.prototype,"locationMarkerBackground",2),qi([zi({type:String,attribute:"location-marker-border-color"})],Zi.prototype,"locationMarkerBorderColor",2),qi([zi({type:String,attribute:"location-marker-glyph-color"})],Zi.prototype,"locationMarkerGlyphColor",2),qi([zi({type:Number,attribute:"location-marker-scale"})],Zi.prototype,"locationMarkerScale",2),qi([zi({type:Object,attribute:"location-circle-options"})],Zi.prototype,"locationCircleOptions",2),qi([zi({type:String})],Zi.prototype,"language",2),qi([zi({type:Object})],Zi.prototype,"options",2),qi([zi({type:String,attribute:"geolocation-button-label"})],Zi.prototype,"geolocationButtonLabel",2),qi([zi({type:String,attribute:"geolocation-loading-title"})],Zi.prototype,"geolocationLoadingTitle",2),qi([zi({type:String,attribute:"geolocation-loading-instructions"})],Zi.prototype,"geolocationLoadingInstructions",2),qi([zi({type:String,attribute:"geolocation-error-title"})],Zi.prototype,"geolocationErrorTitle",2),qi([zi({type:String,attribute:"geolocation-error-button-text"})],Zi.prototype,"geolocationErrorButtonText",2),qi([zi({type:String,attribute:"geolocation-error-timer-message"})],Zi.prototype,"geolocationErrorTimerMessage",2),qi([zi({type:String,attribute:"geolocation-click-to-select-message"})],Zi.prototype,"geolocationClickToSelectMessage",2),qi([zi({type:String,attribute:"geolocation-permission-denied-message"})],Zi.prototype,"geolocationPermissionDeniedMessage",2),qi([zi({type:String,attribute:"geolocation-position-unavailable-message"})],Zi.prototype,"geolocationPositionUnavailableMessage",2),qi([zi({type:String,attribute:"geolocation-timeout-message"})],Zi.prototype,"geolocationTimeoutMessage",2),qi([zi({type:String,attribute:"geolocation-general-error-message"})],Zi.prototype,"geolocationGeneralErrorMessage",2),qi([zi({type:Boolean,attribute:"enable-autocomplete"})],Zi.prototype,"enableAutocomplete",2),qi([zi({type:String,attribute:"autocomplete-hint"})],Zi.prototype,"autocompleteHint",2),qi([zi({type:String,attribute:"autocomplete-proxy-url"})],Zi.prototype,"autocompleteProxyUrl",2),qi([zi({type:String,attribute:"autocomplete-auth-token"})],Zi.prototype,"autocompleteAuthToken",2),qi([zi({type:String,attribute:"autocomplete-placeholder"})],Zi.prototype,"autocompletePlaceholder",2),qi([zi({type:String,attribute:"autocomplete-label"})],Zi.prototype,"autocompleteLabel",2),qi([zi({type:String,attribute:"autocomplete-country"})],Zi.prototype,"autocompleteCountry",2),qi([zi({type:Object,attribute:"autocomplete-location-bias"})],Zi.prototype,"autocompleteLocationBias",2),qi([zi({type:Object,attribute:"autocomplete-location-restriction"})],Zi.prototype,"autocompleteLocationRestriction",2),qi([zi({type:String,attribute:"autocomplete-types"})],Zi.prototype,"autocompleteTypes",2),qi([zi({type:String,attribute:"autocomplete-fields"})],Zi.prototype,"autocompleteFields",2),qi([zi({type:Boolean,attribute:"autocomplete-strict-bounds"})],Zi.prototype,"autocompleteStrictBounds",2),qi([zi({type:Boolean,attribute:"autocomplete-resolve"})],Zi.prototype,"autocompleteResolve",2),qi([zi({type:Number,attribute:"autocomplete-debounce-delay"})],Zi.prototype,"autocompleteDebounceDelay",2),qi([zi({type:Number,attribute:"autocomplete-min-chars"})],Zi.prototype,"autocompleteMinChars",2),qi([Pi(".map")],Zi.prototype,"mapElement",2),qi([Pi("salla-address-autocomplete")],Zi.prototype,"autocompleteElement",2),qi([Ii()],Zi.prototype,"geolocationLoading",2),qi([Ii()],Zi.prototype,"geolocationError",2),qi([Ii()],Zi.prototype,"showLoadingOverlay",2),qi([Ii()],Zi.prototype,"buttonState",2),Zi=qi([li("gmap-map")],Zi);var Gi=Object.defineProperty,Vi=Object.getOwnPropertyDescriptor,Hi=(t,e,i,s)=>{for(var o,a=s>1?void 0:s?Vi(e,i):e,n=t.length-1;n>=0;n--)(o=t[n])&&(a=(s?o(e,i,a):o(a))||a);return s&&a&&Gi(e,i,a),a};let Ki=class extends Nt{constructor(){super(...arguments),this.title="",this.gmpDraggable=!1,this.gmpClickable=!0,this.scale=1,this.draggable=!1,this.clickable=!0,this.eventListeners=[]}async connectedCallback(){super.connectedCallback(),await this.initMarker()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}async updated(t){super.updated(t),this.marker&&(t.has("position")&&this.position&&(this.marker.position=this.normalizePosition(this.position)),t.has("title")&&this.title&&(this.marker.title=this.title),t.has("gmpDraggable")&&(this.marker.gmpDraggable=this.gmpDraggable||this.draggable),t.has("gmpClickable")&&(this.marker.gmpClickable=!1!==this.gmpClickable&&!1!==this.clickable),t.has("zIndex")&&void 0!==this.zIndex&&(this.marker.zIndex=this.zIndex),(t.has("content")||t.has("background")||t.has("borderColor")||t.has("glyphColor")||t.has("scale")||t.has("icon")||t.has("label"))&&this.updateMarkerContent())}async initMarker(){this.addEventListener("gmap-ready",(t=>{this.map=t.detail.map,this.createMarker()}));const t=this.closest("gmap-map");t?.getMap&&(this.map=t.getMap(),this.map&&await this.createMarker())}async createMarker(){if(!this.map)return void console.error("GMapMarker: No map found. Make sure the marker is inside a <gmap-map> element.");if(!this.map.get?.("mapId"))return void console.error('GMapMarker: AdvancedMarkerElement requires a mapId to be set on the map. Add mapId to your map. Example: mapId="YOUR_MAP_ID". Get a Map ID from: https://console.cloud.google.com/google/maps-apis/studio/maps');this.markerLibrary=await async function(t){if(ni.has(t))return ni.get(t);if(await ri,typeof google<"u"&&google.maps&&google.maps.importLibrary){const e=await google.maps.importLibrary(t);return ni.set(t,e),e}return google.maps[t]||google.maps}("marker");const{AdvancedMarkerElement:t,PinElement:e}=this.markerLibrary,i=this.gmpDraggable||this.draggable,s=!1!==this.gmpClickable&&!1!==this.clickable,o={map:this.map,position:this.normalizePosition(this.position),title:this.title,gmpDraggable:i,gmpClickable:s};if(void 0!==this.zIndex&&(o.zIndex=this.zIndex),this.content)if("string"==typeof this.content){const t=document.createElement("div");t.innerHTML=this.content,o.content=t}else o.content=this.content;else if(this.icon){const t=document.createElement("img");t.src=this.icon,t.style.width="32px",t.style.height="32px",o.content=t}else{const t={scale:this.scale||1};this.background&&(t.background=this.background),this.borderColor&&(t.borderColor=this.borderColor),this.glyphColor&&(t.glyphColor=this.glyphColor),this.label&&"string"==typeof this.label&&(t.glyph=this.label),this.pinElement=new e(t),this.pinElement?.element&&(o.content=this.pinElement.element)}this.marker=new t(o),this.eventListeners=Ti(this.marker,["click","drag","dragstart","dragend","gmp-click"],((t,e)=>{if("dragend"===t&&this.marker&&this.marker.position){const t=this.marker.position,e=t.toJSON?t.toJSON():{lat:t.lat(),lng:t.lng()};this.dispatchEvent(new CustomEvent("dragend",{detail:{latLng:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("gmap-position-changed",{detail:e,bubbles:!0,composed:!0}))}else this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))})),this.dispatchEvent(new CustomEvent("gmap-marker-ready",{detail:{marker:this.marker},bubbles:!0,composed:!0}))}updateMarkerContent(){if(!this.marker||!this.markerLibrary)return;const{PinElement:t}=this.markerLibrary;if(this.content)if("string"==typeof this.content){const t=document.createElement("div");t.innerHTML=this.content,this.marker.content=t}else this.marker.content=this.content;else if(this.icon){const t=document.createElement("img");t.src=this.icon,t.style.width="32px",t.style.height="32px",this.marker.content=t}else{const e={scale:this.scale||1};this.background&&(e.background=this.background),this.borderColor&&(e.borderColor=this.borderColor),this.glyphColor&&(e.glyphColor=this.glyphColor),this.label&&"string"==typeof this.label&&(e.glyph=this.label),this.pinElement=new t(e),this.pinElement?.element&&(this.marker.content=this.pinElement.element)}}normalizePosition(t){return t?{lat:"number"==typeof t.lat?t.lat:parseFloat(t.lat),lng:"number"==typeof t.lng?t.lng:parseFloat(t.lng)}:{lat:0,lng:0}}cleanup(){Bi(this.eventListeners),this.marker&&(this.marker.map=null,this.marker=void 0)}getMarker(){return this.marker}render(){return vt`<slot></slot>`}};Hi([zi({type:Object})],Ki.prototype,"position",2),Hi([zi({type:String})],Ki.prototype,"title",2),Hi([zi({type:Boolean})],Ki.prototype,"gmpDraggable",2),Hi([zi({type:Boolean})],Ki.prototype,"gmpClickable",2),Hi([zi({type:Number})],Ki.prototype,"zIndex",2),Hi([zi({type:Object})],Ki.prototype,"content",2),Hi([zi({type:String})],Ki.prototype,"background",2),Hi([zi({type:String})],Ki.prototype,"borderColor",2),Hi([zi({type:String})],Ki.prototype,"glyphColor",2),Hi([zi({type:Number})],Ki.prototype,"scale",2),Hi([zi({type:Boolean})],Ki.prototype,"draggable",2),Hi([zi({type:Boolean})],Ki.prototype,"clickable",2),Hi([zi({type:String})],Ki.prototype,"icon",2),Hi([zi({type:String})],Ki.prototype,"label",2),Hi([Ii()],Ki.prototype,"marker",2),Hi([Ii()],Ki.prototype,"map",2),Ki=Hi([li("gmap-marker")],Ki);var Wi=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,Ji=(t,e,i,s)=>{for(var o,a=s>1?void 0:s?Yi(e,i):e,n=t.length-1;n>=0;n--)(o=t[n])&&(a=(s?o(e,i,a):o(a))||a);return s&&a&&Wi(e,i,a),a};let Qi=class extends Nt{constructor(){super(...arguments),this.opened=!0,this.options={},this.eventListeners=[]}async connectedCallback(){super.connectedCallback(),await this.initInfoWindow()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}updated(t){super.updated(t),this.infoWindow&&(t.has("opened")&&(this.opened?this.open():this.close()),t.has("position")&&this.position&&!this.marker&&this.infoWindow.setPosition(this.position),t.has("zIndex")&&void 0!==this.zIndex&&this.infoWindow.setZIndex(this.zIndex))}async initInfoWindow(){const t=this.closest("gmap-marker");if(t)this.addEventListener("gmap-marker-ready",(t=>{this.marker=t.detail.marker,this.createInfoWindow()})),t.getMarker&&(this.marker=t.getMarker(),this.marker&&await this.createInfoWindow());else{const t=this.closest("gmap-map");t&&(this.addEventListener("gmap-ready",(t=>{this.map=t.detail.map,this.createInfoWindow()})),t.getMap&&(this.map=t.getMap(),this.map&&await this.createInfoWindow()))}}async createInfoWindow(){const t=document.createElement("div");t.style.cssText="min-width: 200px;";const e={content:t,...this.options};void 0!==this.zIndex&&(e.zIndex=this.zIndex),this.position&&!this.marker&&(e.position=this.position),this.infoWindow=new google.maps.InfoWindow(e),this.observeSlotContent(t),this.eventListeners=Ti(this.infoWindow,["closeclick","domready","content_changed"],(t=>{"closeclick"===t&&(this.opened=!1),this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0}))})),this.opened&&this.open()}observeSlotContent(t){this.renderSlotContent(t);const e=this.shadowRoot?.querySelector("slot");e&&e.addEventListener("slotchange",(()=>{this.renderSlotContent(t)})),this.contentObserver=new MutationObserver((()=>{this.renderSlotContent(t)})),this.contentObserver.observe(this,{childList:!0,subtree:!0,characterData:!0})}renderSlotContent(t){const e=this.shadowRoot?.querySelector("slot");if(e){const i=e.assignedNodes({flatten:!0});t.innerHTML="",i.forEach((e=>{(e.nodeType===Node.ELEMENT_NODE||e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())&&t.appendChild(e.cloneNode(!0))}))}}open(){this.infoWindow&&(this.marker?this.infoWindow.open({anchor:this.marker,map:this.map}):this.map&&this.infoWindow.open(this.map))}close(){this.infoWindow?.close()}cleanup(){Bi(this.eventListeners),this.contentObserver&&(this.contentObserver.disconnect(),this.contentObserver=void 0),this.infoWindow&&(this.infoWindow.close(),this.infoWindow=void 0)}getInfoWindow(){return this.infoWindow}render(){return vt`<slot></slot>`}};Qi.styles=D`
|
|
1004
|
+
:host {
|
|
1005
|
+
display: contents;
|
|
1006
|
+
}
|
|
1007
|
+
`,Ji([zi({type:Boolean})],Qi.prototype,"opened",2),Ji([zi({type:Object})],Qi.prototype,"position",2),Ji([zi({type:Number})],Qi.prototype,"zIndex",2),Ji([zi({type:Object})],Qi.prototype,"options",2),Ji([Ii()],Qi.prototype,"infoWindow",2),Ji([Ii()],Qi.prototype,"map",2),Ji([Ii()],Qi.prototype,"marker",2),Qi=Ji([li("gmap-info-window")],Qi);var Xi=Object.defineProperty,ts=Object.getOwnPropertyDescriptor,es=(t,e,i,s)=>{for(var o,a=s>1?void 0:s?ts(e,i):e,n=t.length-1;n>=0;n--)(o=t[n])&&(a=(s?o(e,i,a):o(a))||a);return s&&a&&Xi(e,i,a),a};let is=class extends Nt{constructor(){super(...arguments),this.path=[],this.editable=!1,this.draggable=!1,this.options={},this.eventListeners=[]}async connectedCallback(){super.connectedCallback(),await this.initPolyline()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}updated(t){super.updated(t),this.polyline&&(t.has("path")&&this.path&&this.polyline.setPath(this.path),t.has("editable")&&this.polyline.setEditable(this.editable),t.has("draggable")&&this.polyline.setDraggable(this.draggable),t.has("options")&&this.polyline.setOptions(this.options))}async initPolyline(){const t=this.closest("gmap-map");t&&(this.addEventListener("gmap-ready",(t=>{this.map=t.detail.map,this.createPolyline()})),t.getMap&&(this.map=t.getMap(),this.map&&await this.createPolyline()))}async createPolyline(){if(!this.map)return;const t={map:this.map,path:this.path,editable:this.editable,draggable:this.draggable,...this.options};this.polyline=new google.maps.Polyline(t),this.eventListeners=Ti(this.polyline,["click","dblclick","drag","dragend","dragstart","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],((t,e)=>{this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}));const e=google.maps.event.addListener(this.polyline.getPath(),"set_at",(()=>{this.emitPathChanged()})),i=google.maps.event.addListener(this.polyline.getPath(),"insert_at",(()=>{this.emitPathChanged()})),s=google.maps.event.addListener(this.polyline.getPath(),"remove_at",(()=>{this.emitPathChanged()}));this.eventListeners.push((()=>google.maps.event.removeListener(e)),(()=>google.maps.event.removeListener(i)),(()=>google.maps.event.removeListener(s)))}emitPathChanged(){if(!this.polyline)return;const t=this.polyline.getPath().getArray().map((t=>({lat:t.lat(),lng:t.lng()})));this.dispatchEvent(new CustomEvent("gmap-path-changed",{detail:t,bubbles:!0,composed:!0}))}cleanup(){Bi(this.eventListeners),this.polyline&&(this.polyline.setMap(null),this.polyline=void 0)}getPolyline(){return this.polyline}render(){return vt``}};es([zi({type:Array})],is.prototype,"path",2),es([zi({type:Boolean})],is.prototype,"editable",2),es([zi({type:Boolean})],is.prototype,"draggable",2),es([zi({type:Object})],is.prototype,"options",2),es([Ii()],is.prototype,"polyline",2),es([Ii()],is.prototype,"map",2),is=es([li("gmap-polyline")],is);var ss=Object.defineProperty,os=Object.getOwnPropertyDescriptor,as=(t,e,i,s)=>{for(var o,a=s>1?void 0:s?os(e,i):e,n=t.length-1;n>=0;n--)(o=t[n])&&(a=(s?o(e,i,a):o(a))||a);return s&&a&&ss(e,i,a),a};let ns=class extends Nt{constructor(){super(...arguments),this.editable=!1,this.draggable=!1,this.options={},this.eventListeners=[]}async connectedCallback(){super.connectedCallback(),await this.initPolygon()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}updated(t){super.updated(t),this.polygon&&(t.has("path")&&this.path&&this.polygon.setPath(this.path),t.has("paths")&&this.paths&&this.polygon.setPaths(this.paths),t.has("editable")&&this.polygon.setEditable(this.editable),t.has("draggable")&&this.polygon.setDraggable(this.draggable),t.has("options")&&this.polygon.setOptions(this.options))}async initPolygon(){const t=this.closest("gmap-map");t&&(this.addEventListener("gmap-ready",(t=>{this.map=t.detail.map,this.createPolygon()})),t.getMap&&(this.map=t.getMap(),this.map&&await this.createPolygon()))}async createPolygon(){if(!this.map)return;const t={map:this.map,editable:this.editable,draggable:this.draggable,...this.options};this.paths?t.paths=this.paths:this.path&&(t.paths=this.path),this.polygon=new google.maps.Polygon(t),this.eventListeners=Ti(this.polygon,["click","dblclick","drag","dragend","dragstart","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],((t,e)=>{this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))})),this.paths?this.bindPathsChanges():this.bindPathChanges()}bindPathChanges(){if(!this.polygon)return;const t=this.polygon.getPath(),e=google.maps.event.addListener(t,"set_at",(()=>{this.emitPathChanged()})),i=google.maps.event.addListener(t,"insert_at",(()=>{this.emitPathChanged()})),s=google.maps.event.addListener(t,"remove_at",(()=>{this.emitPathChanged()}));this.eventListeners.push((()=>google.maps.event.removeListener(e)),(()=>google.maps.event.removeListener(i)),(()=>google.maps.event.removeListener(s)))}bindPathsChanges(){this.polygon&&this.polygon.getPaths().forEach((t=>{const e=google.maps.event.addListener(t,"set_at",(()=>{this.emitPathsChanged()})),i=google.maps.event.addListener(t,"insert_at",(()=>{this.emitPathsChanged()})),s=google.maps.event.addListener(t,"remove_at",(()=>{this.emitPathsChanged()}));this.eventListeners.push((()=>google.maps.event.removeListener(e)),(()=>google.maps.event.removeListener(i)),(()=>google.maps.event.removeListener(s)))}))}emitPathChanged(){if(!this.polygon)return;const t=this.polygon.getPath().getArray().map((t=>({lat:t.lat(),lng:t.lng()})));this.dispatchEvent(new CustomEvent("gmap-path-changed",{detail:t,bubbles:!0,composed:!0}))}emitPathsChanged(){if(!this.polygon)return;const t=this.polygon.getPaths().getArray().map((t=>t.getArray().map((t=>({lat:t.lat(),lng:t.lng()})))));this.dispatchEvent(new CustomEvent("gmap-paths-changed",{detail:t,bubbles:!0,composed:!0}))}cleanup(){Bi(this.eventListeners),this.polygon&&(this.polygon.setMap(null),this.polygon=void 0)}getPolygon(){return this.polygon}render(){return vt``}};as([zi({type:Array})],ns.prototype,"path",2),as([zi({type:Array})],ns.prototype,"paths",2),as([zi({type:Boolean})],ns.prototype,"editable",2),as([zi({type:Boolean})],ns.prototype,"draggable",2),as([zi({type:Object})],ns.prototype,"options",2),as([Ii()],ns.prototype,"polygon",2),as([Ii()],ns.prototype,"map",2),ns=as([li("gmap-polygon")],ns);var rs=Object.defineProperty,ls=Object.getOwnPropertyDescriptor,hs=(t,e,i,s)=>{for(var o,a=s>1?void 0:s?ls(e,i):e,n=t.length-1;n>=0;n--)(o=t[n])&&(a=(s?o(e,i,a):o(a))||a);return s&&a&&rs(e,i,a),a};let cs=class extends Nt{constructor(){super(...arguments),this.radius=1e3,this.editable=!1,this.draggable=!1,this.options={},this.eventListeners=[]}async connectedCallback(){super.connectedCallback(),await this.initCircle()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}updated(t){super.updated(t),this.circle&&(t.has("center")&&this.center&&this.circle.setCenter(this.center),t.has("radius")&&void 0!==this.radius&&this.circle.setRadius(this.radius),t.has("editable")&&this.circle.setEditable(this.editable),t.has("draggable")&&this.circle.setDraggable(this.draggable),t.has("options")&&this.circle.setOptions(this.options))}async initCircle(){const t=this.closest("gmap-map");t&&(this.addEventListener("gmap-ready",(t=>{this.map=t.detail.map,this.createCircle()})),t.getMap&&(this.map=t.getMap(),this.map&&await this.createCircle()))}async createCircle(){if(!this.map)return;const t={map:this.map,center:this.center,radius:this.radius,editable:this.editable,draggable:this.draggable,...this.options};this.circle=new google.maps.Circle(t),this.eventListeners=Ti(this.circle,["click","dblclick","drag","dragend","dragstart","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick","center_changed","radius_changed","bounds_changed"],((t,e)=>{if("center_changed"===t){const e=this.circle.getCenter(),i=e?{lat:e.lat(),lng:e.lng()}:null;this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))}else if("radius_changed"===t){const e=this.circle.getRadius();this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}else this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}))}cleanup(){Bi(this.eventListeners),this.circle&&(this.circle.setMap(null),this.circle=void 0)}getCircle(){return this.circle}render(){return vt``}};hs([zi({type:Object})],cs.prototype,"center",2),hs([zi({type:Number})],cs.prototype,"radius",2),hs([zi({type:Boolean})],cs.prototype,"editable",2),hs([zi({type:Boolean})],cs.prototype,"draggable",2),hs([zi({type:Object})],cs.prototype,"options",2),hs([Ii()],cs.prototype,"circle",2),hs([Ii()],cs.prototype,"map",2),cs=hs([li("gmap-circle")],cs);var ds=Object.defineProperty,us=Object.getOwnPropertyDescriptor,ps=(t,e,i,s)=>{for(var o,a=s>1?void 0:s?us(e,i):e,n=t.length-1;n>=0;n--)(o=t[n])&&(a=(s?o(e,i,a):o(a))||a);return s&&a&&ds(e,i,a),a};let ms=class extends Nt{constructor(){super(...arguments),this.editable=!1,this.draggable=!1,this.options={},this.eventListeners=[]}async connectedCallback(){super.connectedCallback(),await this.initRectangle()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}updated(t){super.updated(t),this.rectangle&&(t.has("bounds")&&this.bounds&&this.rectangle.setBounds(this.bounds),t.has("editable")&&this.rectangle.setEditable(this.editable),t.has("draggable")&&this.rectangle.setDraggable(this.draggable),t.has("options")&&this.rectangle.setOptions(this.options))}async initRectangle(){const t=this.closest("gmap-map");t&&(this.addEventListener("gmap-ready",(t=>{this.map=t.detail.map,this.createRectangle()})),t.getMap&&(this.map=t.getMap(),this.map&&await this.createRectangle()))}async createRectangle(){if(!this.map)return;const t={map:this.map,bounds:this.bounds,editable:this.editable,draggable:this.draggable,...this.options};this.rectangle=new google.maps.Rectangle(t),this.eventListeners=Ti(this.rectangle,["click","dblclick","drag","dragend","dragstart","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick","bounds_changed"],((t,e)=>{if("bounds_changed"===t){const e=this.rectangle.getBounds();if(e){const i={north:e.getNorthEast().lat(),south:e.getSouthWest().lat(),east:e.getNorthEast().lng(),west:e.getSouthWest().lng()};this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))}}else this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}))}cleanup(){Bi(this.eventListeners),this.rectangle&&(this.rectangle.setMap(null),this.rectangle=void 0)}getRectangle(){return this.rectangle}render(){return vt``}};ps([zi({type:Object})],ms.prototype,"bounds",2),ps([zi({type:Boolean})],ms.prototype,"editable",2),ps([zi({type:Boolean})],ms.prototype,"draggable",2),ps([zi({type:Object})],ms.prototype,"options",2),ps([Ii()],ms.prototype,"rectangle",2),ps([Ii()],ms.prototype,"map",2),ms=ps([li("gmap-rectangle")],ms);var gs=Object.defineProperty,bs=Object.getOwnPropertyDescriptor,fs=(t,e,i,s)=>{for(var o,a=s>1?void 0:s?bs(e,i):e,n=t.length-1;n>=0;n--)(o=t[n])&&(a=(s?o(e,i,a):o(a))||a);return s&&a&&gs(e,i,a),a};let vs=class extends Nt{constructor(){super(...arguments),this.gridSize=60,this.markers=[]}async connectedCallback(){super.connectedCallback(),await this.initCluster()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}async initCluster(){const t=this.closest("gmap-map");t&&(this.addEventListener("gmap-ready",(t=>{this.map=t.detail.map,this.createCluster()})),t.getMap&&(this.map=t.getMap(),this.map&&await this.createCluster())),this.addEventListener("gmap-marker-ready",(t=>{this.addMarker(t.detail.marker)}))}async createCluster(){if(this.map)try{const t=await import("./p-BkPzCq-C.js").catch((()=>null));if(!t)return void console.error("GMapCluster: @googlemaps/markerclusterer not found. Install with: npm install @googlemaps/markerclusterer");const{MarkerClusterer:e}=t,i={map:this.map,markers:this.markers};this.gridSize&&(i.gridSize=this.gridSize),void 0!==this.maxZoom&&(i.maxZoom=this.maxZoom),this.styles&&(i.styles=this.styles),this.calculator&&(i.calculator=this.calculator),this.markerClusterer=new e(i)}catch(t){console.error("GMapCluster: Error creating cluster:",t)}}addMarker(t){this.markers.includes(t)||(this.markers.push(t),this.markerClusterer&&this.markerClusterer.addMarker(t))}cleanup(){this.markerClusterer&&(this.markerClusterer.clearMarkers(),this.markerClusterer=void 0),this.markers=[]}getClusterer(){return this.markerClusterer}render(){return vt`<slot></slot>`}};fs([zi({type:Number})],vs.prototype,"gridSize",2),fs([zi({type:Number})],vs.prototype,"maxZoom",2),fs([zi({type:Array})],vs.prototype,"styles",2),fs([zi({type:Function})],vs.prototype,"calculator",2),fs([Ii()],vs.prototype,"map",2),fs([Ii()],vs.prototype,"markerClusterer",2),fs([Ii()],vs.prototype,"markers",2),vs=fs([li("gmap-cluster")],vs);var ys=Object.defineProperty,ws=Object.getOwnPropertyDescriptor,Ss=(t,e,i,s)=>{for(var o,a=s>1?void 0:s?ws(e,i):e,n=t.length-1;n>=0;n--)(o=t[n])&&(a=(s?o(e,i,a):o(a))||a);return s&&a&&ys(e,i,a),a};let ks=class extends Nt{constructor(){super(...arguments),this.zoom=0,this.visible=!0,this.motionTracking=!0,this.options={},this.eventListeners=[]}async connectedCallback(){super.connectedCallback()}async firstUpdated(){await ri,this.createPanorama()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}updated(t){super.updated(t),this.panorama&&(t.has("position")&&this.position&&this.panorama.setPosition(this.position),t.has("pano")&&this.pano&&this.panorama.setPano(this.pano),t.has("zoom")&&void 0!==this.zoom&&this.panorama.setZoom(this.zoom),t.has("pov")&&this.pov&&this.panorama.setPov(this.pov),t.has("visible")&&this.panorama.setVisible(this.visible),t.has("motionTracking")&&this.panorama.setMotionTracking(this.motionTracking))}createPanorama(){if(!this.panoramaElement)return;const t={position:this.position,pano:this.pano,zoom:this.zoom,pov:this.pov,visible:this.visible,motionTracking:this.motionTracking,...this.options};this.panorama=new google.maps.StreetViewPanorama(this.panoramaElement,t),this.eventListeners=Ti(this.panorama,["closeclick","status_changed"],((t,e)=>{this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}))}cleanup(){Bi(this.eventListeners),this.panorama=void 0}resize(){this.panorama&&google.maps.event.trigger(this.panorama,"resize")}getPanorama(){return this.panorama}render(){return vt`<div class="panorama"></div>`}};ks.styles=D`
|
|
1008
|
+
:host {
|
|
1009
|
+
display: block;
|
|
1010
|
+
position: relative;
|
|
1011
|
+
width: 100%;
|
|
1012
|
+
height: 400px;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
.panorama {
|
|
1016
|
+
width: 100%;
|
|
1017
|
+
height: 100%;
|
|
1018
|
+
}
|
|
1019
|
+
`,Ss([zi({type:Object})],ks.prototype,"position",2),Ss([zi({type:String})],ks.prototype,"pano",2),Ss([zi({type:Number})],ks.prototype,"zoom",2),Ss([zi({type:Object})],ks.prototype,"pov",2),Ss([zi({type:Boolean})],ks.prototype,"visible",2),Ss([zi({type:Boolean})],ks.prototype,"motionTracking",2),Ss([zi({type:Object})],ks.prototype,"options",2),Ss([Pi(".panorama")],ks.prototype,"panoramaElement",2),Ss([Ii()],ks.prototype,"panorama",2),ks=Ss([li("gmap-street-view-panorama")],ks);var Cs='<svg width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M1.14453 5.83032L1.14453 9.16486C1.14453 11.0511 1.14453 11.9943 1.73032 12.5803C2.3161 13.1663 3.25891 13.1663 5.14453 13.1663L9.14453 13.1663C11.0301 13.1663 11.9729 13.1663 12.5587 12.5803C13.1445 11.9943 13.1445 11.0511 13.1445 9.16486V5.83032"\n stroke="currentcolor" stroke-linecap="round" />\n <path\n d="M9.14453 10.1619C8.68846 10.5667 7.9624 10.8285 7.14453 10.8285C6.32666 10.8285 5.60059 10.5667 5.14453 10.1619"\n stroke="currentcolor" stroke-linecap="round" />\n <path\n d="M5.90256 4.44533C5.71455 5.12426 5.03086 6.29542 3.73185 6.46516C2.58488 6.61502 1.71497 6.11437 1.49277 5.90504C1.24779 5.7353 0.689441 5.19216 0.552703 4.85269C0.415966 4.51322 0.575492 3.77771 0.689441 3.47785L1.14495 2.15892C1.25615 1.82765 1.51646 1.04411 1.78334 0.779094C2.05022 0.514073 2.59054 0.502543 2.81294 0.502543L7.48329 0.502543C8.68543 0.519525 11.3139 0.491824 11.8335 0.502545C12.3532 0.513266 12.6654 0.948828 12.7565 1.13553C13.5318 3.01341 13.8333 4.08889 13.8333 4.54717C13.7321 5.03605 13.3133 5.95787 11.8335 6.36332C10.2956 6.7847 9.42363 5.96509 9.15007 5.65043M5.27015 5.65044C5.48665 5.91635 6.16578 6.45158 7.15029 6.46516C8.1348 6.47873 8.98485 5.79188 9.28681 5.44676C9.37227 5.34492 9.55687 5.04279 9.7483 4.44533"\n stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" />\n</svg>\n ';const xs="salla-bullet-delivery-override-ip";function _s(t,e){localStorage.getItem("salla-bullet-delivery-debug")&&(void 0!==e?console.log(t,e):console.log(t))}const As=class{constructor(i){t(this,i),this.bulletDeliveryConfirmed=e(this,"bulletDeliveryConfirmed"),this.bulletDeliveryClosed=e(this,"bulletDeliveryClosed"),this.addressCreated=e(this,"addressCreated"),this.headerContextUpdate=e(this,"headerContextUpdate"),this.confirming=!1,this.pendingCartSubmitResolver=null,this.pendingCartSubmitPromise=null,this.cartSubmitConfirmationPending=!1,this.branchSearchDebounceTimer=null,this.countrySearchTimer=null,this.regionSearchTimer=null,this.citySearchTimer=null,this.districtSearchTimer=null,this.citySearchCounter=0,this.componentReady=!1,this.pendingOpen=!1,this.tabChanging=!1,this.intentStorageKey="bullet_delivery_intent",this.sessionShownKey="bullet_delivery_shown",this.incompleteIntentPromptKey="bullet_delivery_incomplete_intent_prompted",this.cartItemAddedEvent="cart::item.added",this.cartItemAddedHandler=null,this.cartSubmittingHandler=null,this.useCartEventApi=!1,this.authLoggedInHandler=null,this.authLoggedOutHandler=null,this.loginClosedHandler=null,this.hasExplicitPreselectedIdsForOpen=!1,this.bulletDeliveryOpenHandler=t=>{this.preselectedAddressId=t?.preselected_address_id,this.preselectedBranchId=t?.preselected_branch_id,this.hasExplicitPreselectedIdsForOpen=null!=t?.preselected_address_id||null!=t?.preselected_branch_id,this.open()},this.closeHandler=null,this.bulletDeliveryMobileSelectHandler=null,this.savedAddressesLoaded=!1,this.gmapRef=null,this.activeTab="address",this.isLoggedIn=!1,this.viewMode="main",this.countries=[],this.regions=[],this.cities=[],this.districts=[],this.loadingRegions=!1,this.selectedCountry=null,this.selectedRegion=null,this.selectedCity=null,this.selectedDistrict=null,this.districtName="",this.savedAddresses=[],this.selectedSavedAddress=null,this.selectedSessionAddress=!1,this.branches=[],this.filteredBranches=[],this.selectedBranch=null,this.branchSearchQuery="",this.loadingCountries=!1,this.loadingCities=!1,this.loadingDistricts=!1,this.loadingBranches=!1,this.loadingNearestBranch=!1,this.locationError="",this.savingAddress=!1,this.loadingSavedAddresses=!1,this.showCartWillBeClearedBanner=!1,this.countrySearchQuery="",this.regionSearchQuery="",this.citySearchQuery="",this.districtSearchQuery="",this.searchingCountries=!1,this.searchingRegions=!1,this.searchingCities=!1,this.searchingDistricts=!1,this.displayedCountries=[],this.displayedRegions=[],this.displayedCities=[],this.displayedDistricts=[],this.allocationOutOfCoverageMessage=null,this.mapLocationData=null,this.addressToken=null,this.loadingToken=!1,this.mapReady=!1,this.mapStep="map",this.addressDescription="",this.newAddressForm={...As.INITIAL_ADDRESS_FORM},this.handleCountrySearch=t=>{this.countrySearchQuery=t},this.handleRegionSearch=t=>{this.regionSearchQuery=t},this.handleCitySearch=t=>{if(this.citySearchQuery=t,this.citySearchTimer&&clearTimeout(this.citySearchTimer),!t.trim())return this.displayedCities=this.cities,void(this.searchingCities=!1);if(t.trim().length<As.DROPDOWN_SEARCH_MIN_CHARS)return;const e=++this.citySearchCounter;this.citySearchTimer=setTimeout((async()=>{this.searchingCities=!0;try{const i=p(this.selectedCountry?.code??"")?this.selectedRegion?.id:void 0,s=await m.getCities(this.selectedCountry?.id,i,t);e===this.citySearchCounter&&(this.displayedCities=s)}catch{e===this.citySearchCounter&&(this.displayedCities=this.cities)}finally{e===this.citySearchCounter&&(this.searchingCities=!1)}}),As.DROPDOWN_SEARCH_DEBOUNCE_MS)},this.handleDistrictSearch=t=>{this.districtSearchQuery=t},this.handleCountryDropdownClosed=()=>{this.countrySearchQuery="",this.displayedCountries=this.countries,this.searchingCountries=!1},this.handleRegionDropdownClosed=()=>{this.regionSearchQuery="",this.displayedRegions=this.regions,this.searchingRegions=!1},this.handleCityDropdownClosed=()=>{this.citySearchQuery="",this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.displayedCities=this.cities,this.searchingCities=!1},this.handleDistrictDropdownClosed=()=>{this.districtSearchQuery="",this.displayedDistricts=this.districts,this.searchingDistricts=!1},this.handleMapLocationChanged=t=>{const e=t.detail;e?.position?.lat&&e?.position?.lng&&(this.mapLocationData={lat:e.position.lat,lng:e.position.lng,shortAddress:e.place?.placeId??e.place?.place_id??void 0,formattedAddress:e.place?.formattedAddress??e.place?.formatted_address??void 0},setTimeout((()=>{const t=this.gmapRef?.locationMarker;t&&(t.gmpDraggable=!1)}),100))},this.handleMapReady=()=>{this.mapReady=!0,this.gmapRef&&"function"==typeof this.gmapRef.resize&&this.gmapRef.resize()},this.handleSubmitAddAddress=async t=>{if(t.preventDefault(),this.savingAddress)return;const e=this.hasMapLocation();if((e||this.selectedCountry&&this.selectedCity)&&(e||E(this.selectedCountry?.code,this.selectedRegion?.id,this.selectedDistrict?.id??(this.districtName?.trim()||null)))){this.savingAddress=!0;try{const t=this.buildAddressLocationPayload(),{success:e,address:i}=await m.saveAddressLocation(t);if(e){await this.loadSavedAddresses();const t=i??this.savedAddresses[0]??null;t?.is_in_coverage&&(this.selectedSessionAddress=!1,this.selectedSavedAddress=t),this.addressCreated.emit({address:t}),this.viewMode="main",this.districtName="",this.mapLocationData=null,this.mapStep="map",this.addressDescription=""}else this.isLoggedIn?Salla.notify?.error(Salla.lang.get("common.errors.error_occurred")):(Salla.notify?.error(Salla.lang.get("pages.checkout.login_to_use_saved_addresses")),this.handleLogin())}catch(t){console.error("SallaBulletDelivery: Error saving address",t),this.isLoggedIn?Salla.notify?.error(Salla.lang.get("common.errors.error_occurred")):(Salla.notify?.error(Salla.lang.get("pages.checkout.login_to_use_saved_addresses")),this.handleLogin())}finally{this.savingAddress=!1}}},this.handleCountrySelected=t=>{const e=this.countries.find((e=>String(e.id)===String(t.id)))||t;this.countrySearchQuery="",this.displayedCountries=this.countries,this.applyCountryChange(e||null)},this.handleRegionSelected=t=>{const e=this.regions.find((e=>String(e.id)===String(t.id)))||t;this.selectedRegion=e||null,this.regionSearchQuery="",this.displayedRegions=this.regions,this.updateNewAddressForm({region_id:e?.id,city_id:void 0,district_id:void 0,city:void 0,district:void 0}),e&&this.selectedCountry&&this.loadCities(this.selectedCountry.id,e.id)},this.handleCitySelected=t=>{const e=p(this.selectedCountry?.code??""),i=this.cities.find((e=>String(e.id)===String(t.id)))||t;this.selectedCity=i||null,this.selectedDistrict=null,this.districtName="",this.citySearchQuery="",this.displayedCities=this.cities,i&&(this.updateNewAddressForm({city:i,district:void 0}),e&&this.loadDistricts(i.id))},this.handleDistrictSelected=t=>{const e=this.districts.find((e=>String(e.id)===String(t.id)))||t;this.selectedDistrict=e||null,this.districtName="",this.districtSearchQuery="",this.displayedDistricts=this.districts,e&&this.updateNewAddressForm({district:e})}}get supportsPickup(){return Boolean(Salla.config.get("store.shipping.support_pickup"))||Boolean(Salla.config.get("store.support_pickup"))}get openingType(){return Salla.config.get("store.settings.bullet_delivery.settings.type")}get isRequired(){return!!Salla.config.get("store.settings.bullet_delivery.settings.is_required")}get isMobileApp(){return Salla.config.isMobileApp()}async open(){if(this.isMobileApp)Salla.event.dispatch("salla::bullet-delivery.open-sheet");else if(this.componentReady&&this.modal){this.resetState(),this.modal.open(),Salla.event.dispatch("salla::bullet-delivery.modal.opened");try{this.isLoggedIn=!this.isGuestUser();const t=this.cleanStaleGuestAddressIdIfNeeded(this.getStoredIntent());this.applyPreselectedIdsFromIntent(t);const e=!this.isLoggedIn&&"address"===t?.type&&null!=S(t)&&null!=x(t);if(this.activeTab=this.supportsPickup&&t?.type&&("address"===t.type||"branch"===t.type)?t.type:"address",this.fetchAddressToken(),this.isLoggedIn&&"address"===this.activeTab&&(this.loadingSavedAddresses=!0),await Promise.all([this.loadCountries(e),this.isLoggedIn&&"address"===this.activeTab?this.loadSavedAddresses().then((()=>{this.savedAddressesLoaded=!0})).finally((()=>{this.loadingSavedAddresses=!1})):Promise.resolve()]),this.isLoggedIn&&this.preselectedAddressId){const t=this.savedAddresses.find((t=>t.id===this.preselectedAddressId));t&&(this.selectedSessionAddress=!1,this.selectedSavedAddress=t)}if("branch"===this.activeTab){const e=$(t),i=M(t);if(null!=e&&null!=i?await this.loadBranchesWithLocation(e,i):await this.loadBranches(),this.preselectedBranchId){const t=this.branches.find((t=>t.id===this.preselectedBranchId));t&&(this.selectedBranch=t)}}await this.prefillFromSessionStorage()}catch(t){console.error("SallaBulletDelivery: Error loading data",t)}finally{this.overrideScopeSwitchUI()}}else this.pendingOpen=!0}async close(){if(!this.shouldForceNonClosable()||this.confirming)return this.cartSubmitConfirmationPending&&!this.confirming&&this.resolvePendingCartSubmit(),this.bulletDeliveryClosed.emit(),this.modal?.close()}resetState(){this.viewMode="main",this.selectedCountry=null,this.selectedRegion=null,this.selectedCity=null,this.selectedDistrict=null,this.districtName="",this.selectedSavedAddress=null,this.selectedSessionAddress=!1,this.selectedBranch=null,this.branchSearchQuery="",this.regions=[],this.cities=[],this.districts=[],this.branches=[],this.filteredBranches=[],this.newAddressForm={...As.INITIAL_ADDRESS_FORM},this.showCartWillBeClearedBanner=!1,this.allocationOutOfCoverageMessage=null,this.locationError="",this.savedAddressesLoaded=!1,this.loadingSavedAddresses=!1,this.loadingCountries=!1,this.resetSearchState()}getIntentStorage(){const t=Boolean(Salla.config.get("store.settings.bullet_delivery.settings.remember_last_session"));return Salla.storage[t?"store":"session"]}getShownStorage(){return Salla.storage.session}getStoredIntent(){return this.getIntentStorage().get(this.intentStorageKey)}isGuestUser(){return"guest"===String(Salla.config.get("user.type")??"guest")}cleanStaleGuestAddressIdIfNeeded(t){if(!this.isGuestUser()||"address"!==t?.type||!t.address_id)return t;const e={...t,address_id:void 0};return this.setStoredIntent(e),e}applyPreselectedIdsFromIntent(t){this.hasExplicitPreselectedIdsForOpen?this.hasExplicitPreselectedIdsForOpen=!1:(this.preselectedAddressId=void 0,this.preselectedBranchId=void 0,this.isGuestUser()?"branch"===t?.type&&t.branch_id&&(this.preselectedBranchId=t.branch_id):"address"===t?.type&&t.address_id?this.preselectedAddressId=t.address_id:"branch"===t?.type&&t.branch_id&&(this.preselectedBranchId=t.branch_id))}hasIncompleteUserAddressIntent(){if(this.isGuestUser())return!1;const t=this.getStoredIntent();return!(!t||"address"!==t.type||t.address_id||!t.address_details)&&L(t)}hasCompleteIntentForLoggedInUser(){if(this.isGuestUser())return!1;const t=this.getStoredIntent();return!!t&&("address"===t.type?!!t.address_id:"branch"===t.type&&!!t.branch_id)}shouldForceNonClosable(){return!this.isGuestUser()&&!!Salla.url.is_page("cart")&&!this.hasCompleteIntentForLoggedInUser()}shouldPromptIncompleteIntentThisSession(){const t=this.getShownStorage();return this.hasIncompleteUserAddressIntent()&&!0!==t.get(this.incompleteIntentPromptKey)}markIncompleteIntentPrompted(){this.getShownStorage().set(this.incompleteIntentPromptKey,!0)}setStoredIntent(t){this.getIntentStorage().set(this.intentStorageKey,t),this.overrideScopeSwitchUI()}clearBulletDeliveryStoredData(){Salla.storage.session.remove(this.intentStorageKey),Salla.storage.store.remove(this.intentStorageKey),Salla.storage.session.remove(this.sessionShownKey),Salla.storage.session.remove(this.incompleteIntentPromptKey),this.overrideScopeSwitchUI()}async prefillAddressFromStoredIntent(){const t=this.getStoredIntent();if(!t||"address"!==t.type||null==x(t))return;const e=S(t);if(!e)return;const i=this.countries.find((t=>String(t.id)===String(e)));if(!i)return;this.selectedCountry=i,this.updateNewAddressForm({country_id:Number(i.id)});const s=p(i.code),o=x(t),a=C(t),n=_(t),r=t.address_details?.district?.name,[l,h,c]=await Promise.all([s?m.getRegions(i.id):Promise.resolve([]),m.getCities(i.id,s&&null!=a?a:void 0),null!=o?m.getDistricts(Number(o)):Promise.resolve([])]);if(s&&(this.regions=l,this.displayedRegions=this.regions),this.cities=h,this.displayedCities=this.cities,this.districts=c,this.displayedDistricts=this.districts,this.loadingCities=!1,this.loadingRegions=!1,this.loadingDistricts=!1,s&&null!=a){const t=this.regions.find((t=>String(t.id)===String(a)));t&&(this.selectedRegion=t,this.updateNewAddressForm({region_id:t.id}))}if(null!=o&&this.cities.length>0){const t=this.cities.find((t=>String(t.id)===String(o)));t&&(this.selectedCity=t,this.updateNewAddressForm({city_id:t.id,city:t}))}if(this.districts.length>0){const t=this.findPrefillDistrict(n,r);t&&(this.updateNewAddressForm({district_id:t.id,district:t}),this.selectedDistrict=t)}!this.selectedDistrict&&r&&(this.districtName=r)}updateNewAddressForm(t){this.newAddressForm={...this.newAddressForm,...t}}hasBeenShownThisSession(){return!0===this.getShownStorage().get(this.sessionShownKey)}markShownThisSession(){this.getShownStorage().set(this.sessionShownKey,!0)}getIPLocationConfig(){const t="store.shipping.delivery_location",e={countryId:Salla.config.get(`${t}.country_id`),regionId:Salla.config.get(`${t}.region_id`),cityId:Salla.config.get(`${t}.city_id`),districtId:Salla.config.get(`${t}.district_id`)};return localStorage.getItem(xs)?JSON.parse(localStorage.getItem(xs)):e}async loadCountries(t=!1){this.loadingCountries=!0;const e="branch"===this.activeTab;try{this.countries=await m.getCountries(e),this.displayedCountries=this.countries;const{countryId:i,regionId:s,cityId:o,districtId:a}=this.getIPLocationConfig();_s("getIPLocationConfig",this.getIPLocationConfig());const n=i&&this.countries.length>0?this.countries.find((t=>String(t.id)===String(i))):null;n&&(this.selectedCountry=n,this.updateNewAddressForm({country_id:Number(this.selectedCountry.id)}),!t)&&(null!=s||null!=o||null!=a?await this.prefillFromIPLocation(n,{regionId:s,cityId:o,districtId:a}):p(this.selectedCountry.code)?await this.loadRegions(this.selectedCountry.id):await this.loadCities(this.selectedCountry.id))}finally{this.loadingCountries=!1}}async prefillFromIPLocation(t,e){const i=p(t.code),{regionId:s,cityId:o,districtId:a}=e,[n,r,l]=await Promise.all([i?m.getRegions(t.id):Promise.resolve([]),m.getCities(t.id,i&&null!=s?s:void 0),null!=o?m.getDistricts(Number(o)):Promise.resolve([])]);if(i&&(this.regions=n,this.displayedRegions=this.regions),this.cities=r,this.displayedCities=this.cities,this.districts=l,this.displayedDistricts=this.districts,this.loadingRegions=!1,this.loadingCities=!1,this.loadingDistricts=!1,i&&null!=s){const t=this.regions.find((t=>String(t.id)===String(s)));t&&(this.selectedRegion=t,this.updateNewAddressForm({region_id:t.id}))}if(null!=o&&this.cities.length>0){const t=this.cities.find((t=>String(t.id)===String(o)));t&&(this.selectedCity=t,this.updateNewAddressForm({city_id:t.id,city:t}))}if(null!=a&&this.districts.length>0){const t=this.findPrefillDistrict(a);t&&(this.selectedDistrict=t,this.updateNewAddressForm({district_id:t.id,district:t}))}}async loadCities(t,e){this.loadingCities=!0,this.cities=[],this.displayedCities=[],this.districts=[],this.displayedDistricts=[],this.selectedCity=null,this.selectedDistrict=null,this.districtName="";try{this.cities=await m.getCities(t,e),this.displayedCities=this.cities}finally{this.loadingCities=!1}}async loadDistricts(t){this.loadingDistricts=!0,this.districts=[],this.displayedDistricts=[],this.selectedDistrict=null,this.districtName="";try{this.districts=await m.getDistricts(t),this.displayedDistricts=this.districts}finally{this.loadingDistricts=!1}}findPrefillDistrict(t,e){if(0===this.districts.length)return;if(null!=t){const e=this.districts.find((e=>String(e.id)===String(t)));if(e)return e}const i=e?.trim().toLowerCase();return i?this.districts.find((t=>{const e=t.name?.trim().toLowerCase(),s=t.name_en?.trim().toLowerCase();return e===i||s===i})):void 0}async loadBranches(){this.loadingBranches=!0;try{this.branches=await m.getBranches({country_id:this.selectedCountry?.id}),this.filterBranches()}finally{this.loadingBranches=!1}}filterBranches(){this.filteredBranches=((t,e)=>{if(!e)return t;const i=e.toLowerCase();return t.filter((t=>t.name.toLowerCase().includes(i)||t.city?.name?.toLowerCase().includes(i)))})(this.branches,this.branchSearchQuery)}async prefillFromSessionStorage(){try{const t=this.getStoredIntent();if(!t)return;if("address"!==this.activeTab||"address"!==t.type||this.isLoggedIn||await this.prefillAddressFromStoredIntent(),"branch"===this.activeTab&&"branch"===t.type){const e=S(t);if(null!=e){const i=this.countries.find((t=>String(t.id)===String(e)));if(i){this.selectedCountry=i,this.updateNewAddressForm({country_id:Number(i.id)});const e=A(t);if(null!=e&&this.branches.length>0){const t=this.branches.find((t=>t.id===e));t&&(this.selectedBranch=t)}}}}}catch(t){console.error("[BulletDelivery] Error prefilling from session storage:",t)}}async loadSavedAddresses(){this.savedAddresses=await m.getSavedAddresses();const t=this.getStoredIntent();if(L(t))this.selectedSessionAddress=!0,this.selectedSavedAddress=null;else{const t=this.savedAddresses.find((t=>t.is_default&&!1!==t.is_in_coverage));if(t)this.selectedSavedAddress=t;else{const t=this.savedAddresses.find((t=>!1!==t.is_in_coverage));t&&(this.selectedSavedAddress=t)}}}applyCountryChange(t){this.selectedCountry=t,this.selectedRegion=null,this.regions=[],this.displayedRegions=[],this.cities=[],this.displayedCities=[],this.districts=[],this.displayedDistricts=[],this.selectedCity=null,this.selectedDistrict=null,this.districtName="",this.allocationOutOfCoverageMessage=null,this.regionSearchQuery="",this.citySearchQuery="",this.districtSearchQuery="",this.searchingRegions=!1,this.searchingCities=!1,this.searchingDistricts=!1,this.clearSearchTimers(),this.selectedCountry&&(this.updateNewAddressForm({country_id:Number(this.selectedCountry.id),region_id:void 0,city_id:void 0,district_id:void 0,city:void 0,district:void 0}),"branch"===this.activeTab?this.loadBranches():p(this.selectedCountry.code)?this.loadRegions(this.selectedCountry.id):this.loadCities(this.selectedCountry.id))}async loadRegions(t){this.loadingRegions=!0,this.regions=[],this.displayedRegions=[],this.selectedRegion=null,this.cities=[],this.displayedCities=[],this.districts=[],this.displayedDistricts=[],this.selectedCity=null,this.selectedDistrict=null,this.districtName="";try{this.regions=await m.getRegions(t),this.displayedRegions=this.regions}finally{this.loadingRegions=!1}}emitHeaderContextUpdate(t,e,i){let s="";"address"===t.type?e?s=e.district?.name&&e.city?.name?`${e.district.name}، ${e.city.name}`:e.city?.name??"":this.selectedCity?s=this.selectedDistrict?`${this.selectedDistrict.name}، ${this.selectedCity.name}`:this.selectedCity.name:t.address_details&&(s=[t.address_details.district?.name,t.address_details.city.name,t.address_details.country.name].filter(Boolean).join("، ")||t.address_details.short_address||""):i?s=i.name:t.branch_details&&(s=t.branch_details.city??t.branch_details.name);const o="address"===t.type?Salla.lang.get("mobile_app.strings.delivery"):Salla.lang.get("mobile_app.strings.pickup");this.headerContextUpdate.emit({type:t.type,display_text:s?`${o}: ${s}`:"",country_code:t.country_code,city:this.selectedCity?.name??t.address_details?.city?.name,district:this.selectedDistrict?.name??t.address_details?.district?.name,branch_name:i?.name??t.branch_details?.name})}handleBranchSearch(t){const e=t.target.value;if(this.branchSearchQuery=e,this.branchSearchDebounceTimer&&clearTimeout(this.branchSearchDebounceTimer),!e?.trim())return this.branchSearchQuery="",void this.loadBranches();this.branchSearchDebounceTimer=setTimeout((async()=>{if(!(e.trim().length<2)){this.loadingBranches=!0;try{this.branches=await m.getBranches({country_id:this.selectedCountry?.id,query:e}),this.filterBranches()}finally{this.loadingBranches=!1}}}),1e3)}clearSearchTimers(){[this.countrySearchTimer,this.regionSearchTimer,this.citySearchTimer,this.districtSearchTimer].forEach((t=>{t&&clearTimeout(t)})),this.countrySearchTimer=this.regionSearchTimer=this.citySearchTimer=this.districtSearchTimer=null}resetSearchState(){this.countrySearchQuery="",this.regionSearchQuery="",this.citySearchQuery="",this.districtSearchQuery="",this.searchingCountries=!1,this.searchingRegions=!1,this.searchingCities=!1,this.searchingDistricts=!1,this.displayedCountries=[],this.displayedRegions=[],this.displayedCities=[],this.displayedDistricts=[],this.clearSearchTimers()}async loadBranchesWithLocation(t,e){this.loadingBranches=!0;try{if(this.branches=await m.getBranches({country_id:this.selectedCountry?.id,lat:t,lng:e}),this.filterBranches(),!this.selectedCountry&&this.branches.length>0){const t=this.branches[0];if(t.country){const e=this.countries.find((e=>e.id===t.country.id));e&&(this.selectedCountry=e,this.updateNewAddressForm({country_id:Number(e.id)}))}}}finally{this.loadingBranches=!1}}async handleFindNearestBranch(){if(navigator.geolocation){this.loadingNearestBranch=!0,this.locationError="";try{const t=await new Promise(((t,e)=>{navigator.geolocation.getCurrentPosition(t,e,{enableHighAccuracy:!0,timeout:1e4,maximumAge:0})})),{latitude:e,longitude:i}=t.coords;await this.loadBranchesWithLocation(e,i);const s=function(t,e,i){let s=null,o=Number.POSITIVE_INFINITY;for(const a of t){const t=null!=a.location?.lat?Number(a.location.lat):Number.NaN,n=null!=a.location?.lng?Number(a.location.lng):Number.NaN;if(Number.isNaN(t)||Number.isNaN(n)||!1===a.is_open)continue;const r=f(e,i,t,n);r<o&&(o=r,s=a)}return s}(this.branches,e,i);s&&(this.selectedBranch=s,this.branchSearchQuery="",this.filterBranches())}catch(t){const e=t;this.locationError=z["number"==typeof e?.code?e.code:-1]??"An error occurred while detecting location"}finally{this.loadingNearestBranch=!1}}else this.locationError=Salla.lang.get("pages.checkout.current_location_not_supported")}handleBranchSelect(t){this.selectedBranch=t}handleSavedAddressSelect(t){!1!==t.is_in_coverage?(this.selectedSavedAddress=t,this.selectedSessionAddress=!1):Salla.notify?.error(Salla.lang.get("pages.checkout.shipping_not_available"))}handleSessionAddressSelect(){this.selectedSessionAddress=!0,this.selectedSavedAddress=null}async handleAddNewAddress(){this.viewMode="add-address",this.mapLocationData=null,this.fetchAddressToken();const t=this.getStoredIntent(),e=S(t);if(e&&this.countries.length>0){const t=this.countries.find((t=>t.id===e));t&&(this.selectedCountry=t,this.updateNewAddressForm({country_id:Number(t.id)}),p(t.code)?await this.loadRegions(t.id):await this.loadCities(t.id))}}handleBackToAddressList(){this.viewMode="main",this.mapLocationData=null,this.mapStep="map",this.addressDescription=""}async fetchAddressToken(){if(!this.addressToken&&!this.loadingToken){this.loadingToken=!0;try{const t=salla.config.get("store.settings.keys.maps");t&&function(t,e){if(typeof document>"u")return Promise.resolve();if(ai)return ri;let i;ai=!0,i={...t},Array.isArray(i.libraries)&&(i.libraries=i.libraries),!e&&!i.v&&(e="quarterly"),i.loading||(i.loading="async"),i.callback="googleMapsInitCallback";let s=`https://maps.googleapis.com/maps/api/js?${Object.keys(i).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(i[t])}`)).join("&")}`;e&&(s+=`&v=${e}`);const o=document.createElement("script");return o.src=s,o.async=!0,o.defer=!0,o.onerror=t=>{console.error("Failed to load Google Maps script:",t)},document.body.appendChild(o),ri}({key:t,libraries:["marker","places"],language:salla.config.get("user.language_code")||"ar"}).catch((t=>_s("Failed to load Google Maps SDK",t))),this.addressToken=await m.getAddressToken()}catch{_s("SallaBulletDelivery: Failed to fetch address token")}finally{this.loadingToken=!1}}}hasMapLocation(){return null!=this.mapLocationData?.lat&&null!=this.mapLocationData?.lng}get isMapSettingEnabled(){return Salla.config.get("store.settings.bullet_delivery.settings.map_enabled")}get isMapModeAvailable(){return this.isMapSettingEnabled&&!!salla.config.get("store.settings.keys.maps")&&!!this.addressToken}buildAddressLocationPayload(){if(this.isMapModeAvailable&&this.hasMapLocation())return{lat:this.mapLocationData.lat,lng:this.mapLocationData.lng,...this.mapLocationData.shortAddress&&{short_address:this.mapLocationData.shortAddress},...this.addressDescription?.trim()&&{description:this.addressDescription.trim()}};const t=this.selectedDistrict?.name??this.districtName?.trim()??"";return function(t){const{countryId:e,countryCode:i,regionId:s,cityId:o,districtId:a,description:n="",lat:r,lng:l,shortAddress:h}=t,c=n||"";return{country_id:Number(e)||void 0,region_id:null!=s?Number(s):void 0,city_id:null!=o?Number(o):void 0,district_id:null!=a?Number(a):void 0,description:c,...i&&p(i)&&{local:c},...null!=r&&null!=l&&{lat:r,lng:l},...h&&{short_address:h}}}({countryId:this.selectedCountry?.id??0,countryCode:this.selectedCountry?.code,regionId:this.selectedRegion?.id,cityId:this.selectedCity?.id,districtId:this.selectedDistrict?.id,description:t,lat:this.mapLocationData?.lat,lng:this.mapLocationData?.lng,shortAddress:this.mapLocationData?.shortAddress})}async handleTabChange(t){if(!this.tabChanging){this.tabChanging=!0;try{this.activeTab=t,"add-address"===this.viewMode&&(this.viewMode="main"),this.showCartWillBeClearedBanner=!1,this.allocationOutOfCoverageMessage=null,this.resetSearchState();const e="branch"===t;this.countries=await m.getCountries(e),this.displayedCountries=this.countries;const i=this.selectedCountry?.id;if(null!=i&&(this.selectedCountry=this.countries.find((t=>t.id===i))||null),!this.selectedCountry){const{countryId:t}=this.getIPLocationConfig();t&&this.countries.length>0&&(this.selectedCountry=this.countries.find((e=>String(e.id)===String(t)))||null),this.selectedCountry||1!==this.countries.length||(this.selectedCountry=this.countries[0])}if(this.selectedCountry)if("branch"===t){const t=this.getStoredIntent(),e=$(t),i=M(t);null!=e&&null!=i?await this.loadBranchesWithLocation(e,i):await this.loadBranches();const s=A(t);if(null!=s&&this.branches.length>0){const t=this.branches.find((t=>t.id===s));t&&(this.selectedBranch=t)}}else if("address"===t){if(this.isLoggedIn&&!this.savedAddressesLoaded){this.loadingSavedAddresses=!0;try{await this.loadSavedAddresses(),this.savedAddressesLoaded=!0}finally{this.loadingSavedAddresses=!1}}if(!this.isLoggedIn){const t=this.getStoredIntent();t&&x(t)&&await this.prefillAddressFromStoredIntent()}}}finally{this.tabChanging=!1}}}isConfirmDisabled(){return"branch"===this.activeTab?!this.selectedBranch:!("address"!==this.activeTab||this.isLoggedIn&&this.selectedSessionAddress||(this.isLoggedIn&&this.selectedSavedAddress?!1!==this.selectedSavedAddress.is_in_coverage:this.selectedCountry&&this.selectedCity&&E(this.selectedCountry?.code,this.selectedRegion?.id,this.selectedDistrict?.id??(this.districtName?.trim()||null))))}handleLogin(){Salla.auth.setCanRedirect(!1),Salla.event.dispatch("salla::bullet-delivery.modal.close.requested"),Salla.event.dispatch("login::open",Salla.url.is_page("cart")?{withoutReload:!0,source:"cart-submit"}:{withoutReload:!0,source:"bullet-delivery"})}resolvePendingCartSubmit(){if(!this.pendingCartSubmitResolver)return;const t=this.pendingCartSubmitResolver;this.pendingCartSubmitResolver=null,this.pendingCartSubmitPromise=null,this.cartSubmitConfirmationPending=!1,t()}buildIntentAddress(){if("address"!==this.activeTab||!this.selectedCountry||!this.selectedCity)return;const t={id:this.selectedCountry.id,name:this.selectedCountry.name,code:this.selectedCountry.code},e={id:this.selectedCity.id,name:this.selectedCity.name},i=this.selectedRegion?{id:this.selectedRegion.id,name:this.selectedRegion.name,code:this.selectedRegion.code}:void 0,s=this.selectedDistrict?{id:this.selectedDistrict.id,name:this.selectedDistrict.name}:this.districtName?{id:0,name:this.districtName}:void 0,o=this.selectedSavedAddress?.short_address;return{country:t,region:i,city:e,district:s,short_address:o}}buildIntentAddressFromSaved(t){return{country:{id:t.country?.id??t.country_id??0,name:t.country?.name??"",code:t.country?.code},region:t.region?{id:t.region.id,name:t.region.name,code:t.region.code}:void 0,city:{id:t.city?.id??t.city_id??0,name:t.city?.name??""},district:t.district?{id:t.district.id,name:t.district.name}:void 0,short_address:t.short_address}}buildIntentBranch(){if("branch"!==this.activeTab||!this.selectedBranch)return;const t=this.selectedBranch,e=null!=t.location?.lat?Number(t.location.lat):void 0,i=null!=t.location?.lng?Number(t.location.lng):void 0;return{id:t.id,name:t.name,city:t.city?.name,latitude:e,longitude:i}}buildAllocationConfirmedAddressData(t){return"address"!==this.activeTab?null:{saved_address:t??this.selectedSavedAddress??void 0,country:this.selectedCountry??void 0,region:this.selectedRegion??void 0,city:this.selectedCity??void 0,district:this.selectedDistrict??void 0,district_name:this.districtName?.trim()||void 0,short_address:t?.short_address??this.selectedSavedAddress?.short_address,form_data:{...this.newAddressForm}}}buildAllocationConfirmedAddressFromIntent(t){if("address"!==t.type)return null;const e=t.address_details,i=Number(t.country_id)||0;return{country:e?.country?{id:e.country.id,name:e.country.name,code:e.country.code??t.country_code??""}:void 0,region:e?.region?{id:Number(e.region.id),name:e.region.name,country_id:i,code:e.region.code??void 0}:void 0,city:e?.city?{id:Number(e.city.id),name:e.city.name,country_id:i}:void 0,district:e?.district?{id:Number(e.district.id),name:e.district.name,city_id:Number(e.city?.id)||0}:void 0,short_address:e?.short_address}}buildBranchFromIntent(t){if("branch"!==t.type||!t.branch_details)return null;const e=t.branch_details,i={id:e.id,name:e.name};return e.city&&(i.city={id:0,name:e.city}),null!=e.latitude&&null!=e.longitude&&(i.location={lat:String(e.latitude),lng:String(e.longitude)}),i}buildAllocationRequestFromIntent(t){if("branch"===t.type)return{type:"branch",branch_id:null!=t.branch_id?String(t.branch_id):""};if(null!=t.address_id)return{type:"address",address_id:String(t.address_id)};const e=t.address_details,i={type:"address",country_id:null!=t.country_id?String(t.country_id):"",city_id:null!=e?.city?.id?String(e.city.id):""};return null!=e?.region?.id&&(i.region_id=String(e.region.id)),null!=e?.district?.id&&(i.district_id=String(e.district.id)),i}applyMobileBulletDeliverySelection(t){if(!t||"address"!==t.type&&"branch"!==t.type)return void console.warn("SallaBulletDelivery: ignoring invalid mobile select payload",t);const e=t.allocation_headers??{},i=e["s-scope-allocation-type"]??t.type,s=e["s-scope-allocation-id"];i&&Salla.api.setHeader("s-scope-allocation-type",i),s&&Salla.api.setHeader("s-scope-allocation-id",String(s));const o=Salla.config.get("store.scope",Salla.storage.get("scope"))||{};Salla.storage.set("scope",{...o,allocation_type:i,allocation_id:s?String(s):void 0}),this.markShownThisSession();const a={...t,allocation_headers:{"s-scope-allocation-type":i,"s-scope-allocation-id":s?String(s):void 0}};this.setStoredIntent(a),g();const n=this.buildBranchFromIntent(a),r={...a,address:this.buildAllocationConfirmedAddressFromIntent(a),branch:n,allocation_request:this.buildAllocationRequestFromIntent(a),allocation_response:null};Salla.event.dispatch("salla::bullet-delivery.allocation.confirmed",r),this.bulletDeliveryConfirmed.emit({...a,branch:n??void 0}),this.emitHeaderContextUpdate(a,void 0,n??void 0),setTimeout((()=>window.location.reload()),100)}extractMobileSelectPayload(t){return t&&"object"==typeof t?"payload"in t&&t.payload?t.payload:t:null}async handleConfirm(){if(this.isConfirmDisabled()||this.confirming)return;this.confirming=!0,this.confirmBtn?.load();let t=!1;try{const e={type:this.activeTab,country_id:Number(this.selectedCountry?.id)||0,country_code:this.selectedCountry?.code||""};let i,s,o;if("address"===this.activeTab)if(this.isLoggedIn&&this.selectedSessionAddress){const t=await this.saveSessionAddressToProfile();if(!t)return Salla.notify?.error(Salla.lang.get("common.errors.error_occurred")),void this.confirmBtn?.stop();e.address_id=t.id,i=t,this.selectedSessionAddress=!1,this.selectedSavedAddress=t,e.address_details=this.buildIntentAddressFromSaved(t)}else this.isLoggedIn&&this.selectedSavedAddress?(e.address_id=this.selectedSavedAddress.id,i=this.selectedSavedAddress,e.address_details=this.buildIntentAddressFromSaved(this.selectedSavedAddress)):e.address_details=this.buildIntentAddress();else e.branch_details=this.buildIntentBranch(),e.branch_id=this.selectedBranch?.id,s=this.selectedBranch||void 0;"address"===this.activeTab?this.isLoggedIn&&this.selectedSavedAddress?o={type:"address",address_id:String(this.selectedSavedAddress.id)}:(o={type:"address",country_id:String(this.selectedCountry?.id||0),city_id:String(this.selectedCity?.id||"")},p(this.selectedCountry?.code??"")&&(this.selectedRegion?.id&&(o.region_id=String(this.selectedRegion.id)),o.district_id=String(this.selectedDistrict?.id||""))):o={type:"branch",branch_id:String(this.selectedBranch?.id||"")};const a=await m.allocateScope(o);if(!a.success){console.error("BulletDelivery: Scope allocation failed",a.error);const t=a.error||("address"===this.activeTab?Salla.lang.get("pages.checkout.address_out_of_coverage"):Salla.lang.get("pages.checkout.failed_to_set_pickup"));return this.allocationOutOfCoverageMessage=t,this.confirmBtn?.stop(),void(this.confirming=!1)}let n;if(a.data){const t=a.data;n=t.id;const i=t?.allocation?.type,s=t?.allocation?.branch_id;i&&Salla.api.setHeader("s-scope-allocation-type",i),s&&Salla.api.setHeader("s-scope-allocation-id",String(s));const o=Salla.config.get("store.scope",Salla.storage.get("scope"))||{};Salla.storage.set("scope",{...o,id:n,allocation_type:i,allocation_id:s?String(s):void 0}),e.allocation_headers={"s-scope-allocation-type":i,"s-scope-allocation-id":s?String(s):void 0}}this.markShownThisSession(),this.setStoredIntent(e),n&&(await m.setDeliveryScope(n),g());const r={...e,address:this.buildAllocationConfirmedAddressData(i),branch:s??null,allocation_request:o,allocation_response:a.data??null};Salla.event.dispatch("salla::bullet-delivery.allocation.confirmed",r),this.bulletDeliveryConfirmed.emit({...e,address:i,branch:s}),this.emitHeaderContextUpdate(e,i,s),t=!0,setTimeout((()=>{if(this.confirmBtn?.stop(),this.close(),this.confirming=!1,this.cartSubmitConfirmationPending)this.resolvePendingCartSubmit();else if(n){const t=Salla.storage.get("scope")||{};let e=Salla.helpers.addParamToUrl("scope",n);t.allocation_id&&(e=Salla.helpers.addParamToUrl("allocation_id",t.allocation_id,e)),t.allocation_type&&(e=Salla.helpers.addParamToUrl("allocation_type",t.allocation_type,e)),window.location.replace(e)}else window.location.reload()}),500)}finally{t||(this.confirming=!1)}}getCartViewConfig(t){if(!t||!Salla.url.is_page("cart"))return null;const e="branch"===t.type,i="address"===t.type;return e&&!this.supportsPickup||!e&&!i?null:{title:e?Salla.lang.get("pages.checkout.pickup_option"):Salla.lang.get("pages.checkout.delivery_option"),subtitle:y(t,Salla.lang.get("common.elements.to"),""),buttonText:Salla.lang.get("common.elements.edit"),isAddress:i,intent:t}}createCartViewElement(){const t=this.getStoredIntent(),e=this.getCartViewConfig(t);if(!e)return null;const{title:i,subtitle:s,buttonText:o,intent:n}=e,r="branch"===n.type?{preselected_branch_id:A(n)}:{preselected_address_id:n.address_id},l=document.createElement("span");l.className="s-bullet-delivery-cart-view-icon s-bullet-delivery-tab-icon",l.setAttribute("aria-hidden","true"),l.innerHTML=a;const h=document.createElement("span");h.className="s-bullet-delivery-cart-view-title",h.textContent=i;const c=document.createElement("span");c.className="s-bullet-delivery-cart-view-subtitle",c.textContent=s;const d=document.createElement("div");d.className="s-bullet-delivery-cart-view-text",d.append(h,c);const u=document.createElement("div");u.className="s-bullet-delivery-cart-view-info",u.append(l,d);const p=document.createElement("salla-button");p.className="s-bullet-delivery-cart-view-button",p.setAttribute("fill","outline"),p.setAttribute("color","primary"),p.textContent=o,p.addEventListener("click",(()=>Salla.event.emit("salla::bullet-delivery.modal.open.requested",r)));const m=document.createElement("div");return m.className="s-bullet-delivery-cart-view",m.append(u,p),m}renderTabs(){return this.supportsPickup?i("div",{class:"s-bullet-delivery-tabs"},i("button",{type:"button",class:{"s-bullet-delivery-tab":!0,"s-bullet-delivery-tab--active":"address"===this.activeTab},onClick:()=>this.handleTabChange("address")},i("span",{class:"s-bullet-delivery-tab-icon",innerHTML:a,"aria-hidden":"true"}),i("span",null,Salla.lang.get("mobile_app.strings.delivery"))),i("button",{type:"button",class:{"s-bullet-delivery-tab":!0,"s-bullet-delivery-tab--active":"branch"===this.activeTab},onClick:()=>this.handleTabChange("branch")},i("span",{class:"s-bullet-delivery-tab-icon",innerHTML:Cs,"aria-hidden":"true"}),i("span",null,Salla.lang.get("mobile_app.strings.pickup")))):null}renderAlert(t){return i("div",{class:"s-bullet-delivery-allocation-out-of-coverage",role:"alert"},i("span",{class:"s-bullet-delivery-allocation-out-of-coverage-icon","aria-hidden":"true"},i("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-hidden":"true"},i("title",null,"Information"),i("circle",{cx:"10",cy:"10",r:"9",stroke:"currentColor","stroke-width":"1.5",fill:"currentColor"}),i("text",{x:"10",y:"14","text-anchor":"middle",fill:"white","font-size":"12","font-weight":"bold"},"i"))),i("span",{class:"s-bullet-delivery-allocation-out-of-coverage-text"},t))}renderAllocationOutOfCoverageAlert(){const t=this.allocationOutOfCoverageMessage||Salla.lang.get("pages.checkout.shipping_not_available");return this.renderAlert(t)}renderCountrySelect(){return i("div",{class:"s-bullet-delivery-field"},i("salla-searchable-dropdown",{label:Salla.lang.get("blocks.buy_as_gift.receiver_country"),placeholder:Salla.lang.get("pages.checkout.select_country"),items:this.displayedCountries,selectedItem:this.selectedCountry,loading:this.loadingCountries,searching:this.searchingCountries,disabled:this.countries.length<=1,required:!0,inputId:"bullet-delivery-country",searchQuery:this.countrySearchQuery,clientSearch:!0,onItemSelected:t=>this.handleCountrySelected(t.detail),onSearchInput:t=>this.handleCountrySearch(t.detail),onDropdownClosed:()=>this.handleCountryDropdownClosed()}))}renderRegionSelect(){return p(this.selectedCountry?.code??"")&&this.selectedCountry?i("div",{class:"s-bullet-delivery-field"},i("salla-searchable-dropdown",{label:Salla.lang.get("pages.checkout.region_field"),placeholder:Salla.lang.get("pages.checkout.select_region"),items:this.displayedRegions,selectedItem:this.selectedRegion,loading:this.loadingRegions,searching:this.searchingRegions,disabled:this.loadingRegions||0===this.regions.length,required:!0,inputId:"bullet-delivery-region",searchQuery:this.regionSearchQuery,clientSearch:!0,onItemSelected:t=>this.handleRegionSelected(t.detail),onSearchInput:t=>this.handleRegionSearch(t.detail),onDropdownClosed:()=>this.handleRegionDropdownClosed()})):null}renderCityDistrictSelects(){const t=p(this.selectedCountry?.code??""),e=t,s=e&&this.selectedCity&&!this.loadingDistricts&&0===this.districts.length,o=!this.selectedCountry||t&&!this.selectedRegion||this.loadingCities||0===this.cities.length,a=!this.selectedCountry||t&&!this.selectedRegion||!this.selectedCity||this.loadingDistricts;return i("div",{class:"s-bullet-delivery-field-row"},i("div",{class:"s-bullet-delivery-field"},i("salla-searchable-dropdown",{label:Salla.lang.get("blocks.buy_as_gift.receiver_city"),placeholder:Salla.lang.get("pages.checkout.select_city"),items:this.displayedCities,selectedItem:this.selectedCity,loading:this.loadingCities,searching:this.searchingCities,disabled:o,required:!0,inputId:"bullet-delivery-city",searchQuery:this.citySearchQuery,onItemSelected:t=>this.handleCitySelected(t.detail),onSearchInput:t=>this.handleCitySearch(t.detail),onDropdownClosed:()=>this.handleCityDropdownClosed(),dropUp:!0})),e&&i("div",{class:"s-bullet-delivery-field"},s?i("div",null,i("label",{class:"s-bullet-delivery-label",htmlFor:"bullet-delivery-district"},Salla.lang.get("pages.checkout.district_field"),i("span",{class:"text-red-500"}," *")),i("input",{id:"bullet-delivery-district",type:"text",class:"form-input",placeholder:Salla.lang.get("pages.checkout.select_district"),value:this.districtName,disabled:a,onInput:t=>{this.districtName=t.target.value,this.updateNewAddressForm({district:void 0})}})):i("salla-searchable-dropdown",{label:Salla.lang.get("pages.checkout.district_field"),placeholder:Salla.lang.get("pages.checkout.select_district"),items:this.displayedDistricts,selectedItem:this.selectedDistrict,loading:this.loadingDistricts,searching:this.searchingDistricts,disabled:a||0===this.districts.length,required:!0,inputId:"bullet-delivery-district",searchQuery:this.districtSearchQuery,clientSearch:!0,onItemSelected:t=>this.handleDistrictSelected(t.detail),onSearchInput:t=>this.handleDistrictSearch(t.detail),onDropdownClosed:()=>this.handleDistrictDropdownClosed(),dropUp:!0})))}renderSavedAddressesEmptyState(){return i("div",{class:"s-bullet-delivery-saved-addresses-empty"},i("div",{class:"s-bullet-delivery-saved-addresses-empty-icon","aria-hidden":"true"},i("svg",{width:"28",height:"28",viewBox:"0 0 28 29",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("title",null,"No Saved Adresses"),i("path",{d:"M20.16 0C21.4613 0 22.6773 0.341333 23.808 1.024C24.9387 1.70667 25.8347 2.61333 26.496 3.744C27.1787 4.91733 27.52 6.18667 27.52 7.552C27.52 9.45067 26.8267 11.232 25.44 12.896C24.4587 14.0907 23.0827 15.2427 21.312 16.352H21.28C20.9387 16.5653 20.5653 16.672 20.16 16.672C19.7547 16.672 19.3813 16.5653 19.04 16.352H19.008C17.2373 15.2213 15.8613 14.0693 14.88 12.896C13.4933 11.232 12.8 9.45067 12.8 7.552C12.8 6.18667 13.1413 4.91733 13.824 3.744C14.4853 2.61333 15.3813 1.70667 16.512 1.024C17.6427 0.341333 18.8587 0 20.16 0ZM11.488 1.984C9.67467 2.368 8.04267 3.14667 6.592 4.32C5.14133 5.49333 4.01067 6.92267 3.2 8.608C2.34667 10.3573 1.92 12.224 1.92 14.208C1.92 14.72 1.952 15.2427 2.016 15.776L2.08 15.744C2.57067 15.488 2.94933 15.3067 3.216 15.2C3.48267 15.0933 3.73867 15.0933 3.984 15.2C4.22933 15.3067 4.4 15.488 4.496 15.744C4.592 16 4.58667 16.256 4.48 16.512C4.37333 16.768 4.19733 16.9493 3.952 17.056C3.70667 17.1627 3.36 17.3227 2.912 17.536L2.656 17.664C2.57067 17.7067 2.48533 17.7387 2.4 17.76C2.89067 19.4667 3.70133 20.9973 4.832 22.352C5.96267 23.7067 7.296 24.7573 8.832 25.504C10.432 26.272 12.1173 26.656 13.888 26.656C15.4667 26.656 16.9813 26.3467 18.432 25.728C19.8187 25.1307 21.0667 24.288 22.176 23.2C21.92 23.0507 21.7653 22.8373 21.712 22.56C21.6587 22.2827 21.7013 22.0267 21.84 21.792C21.9787 21.5573 22.176 21.408 22.432 21.344C22.8373 21.2587 23.2 21.12 23.52 20.928C23.6907 20.8427 23.8613 20.8 24.032 20.8C24.8 19.5413 25.3333 18.176 25.632 16.704C25.6747 16.4267 25.808 16.2133 26.032 16.064C26.256 15.9147 26.496 15.8667 26.752 15.92C27.008 15.9733 27.2107 16.1173 27.36 16.352C27.5093 16.5867 27.552 16.832 27.488 17.088C27.0613 19.2853 26.1973 21.264 24.896 23.024C23.5947 24.784 22.0053 26.1547 20.128 27.136C18.1653 28.16 16.0853 28.672 13.888 28.672C11.3707 28.672 9.03467 28.0107 6.88 26.688C4.78933 25.408 3.12533 23.68 1.888 21.504C0.629333 19.264 0 16.832 0 14.208C0 11.904 0.490667 9.73867 1.472 7.712C2.41067 5.74933 3.728 4.09067 5.424 2.736C7.12 1.38133 9.01333 0.48 11.104 0.032C11.36 -0.032 11.6 0.0106667 11.824 0.16C12.048 0.309333 12.1867 0.522667 12.24 0.8C12.2933 1.07733 12.2453 1.328 12.096 1.552C11.9467 1.776 11.744 1.92 11.488 1.984ZM14.72 7.552C14.72 8.96 15.2533 10.304 16.32 11.584C17.1733 12.5867 18.3893 13.6 19.968 14.624C20.032 14.6453 20.096 14.656 20.16 14.656C20.224 14.656 20.288 14.6453 20.352 14.624C21.9307 13.6213 23.1467 12.608 24 11.584C25.0667 10.304 25.6 8.96 25.6 7.552C25.6 6.57067 25.3547 5.65333 24.864 4.8C24.3733 3.94667 23.7067 3.26933 22.864 2.768C22.0213 2.26667 21.12 2.016 20.16 2.016C19.2 2.016 18.2987 2.26667 17.456 2.768C16.6133 3.26933 15.9467 3.94667 15.456 4.8C14.9653 5.65333 14.72 6.57067 14.72 7.552ZM17.28 7.68C17.28 6.848 17.5627 6.13867 18.128 5.552C18.6933 4.96533 19.3707 4.672 20.16 4.672C20.9493 4.672 21.6267 4.96533 22.192 5.552C22.7573 6.13867 23.04 6.848 23.04 7.68C23.04 8.512 22.7573 9.216 22.192 9.792C21.6267 10.368 20.9493 10.656 20.16 10.656C19.3707 10.656 18.6933 10.368 18.128 9.792C17.5627 9.216 17.28 8.512 17.28 7.68ZM6.752 14.688C7.62667 14.7733 8.53333 15.0293 9.472 15.456C9.70667 15.5627 9.87733 15.744 9.984 16C10.0907 16.256 10.0907 16.512 9.984 16.768C9.87733 17.024 9.70133 17.2 9.456 17.296C9.21067 17.392 8.97067 17.3867 8.736 17.28C7.94667 16.9387 7.22133 16.736 6.56 16.672C6.28267 16.6293 6.064 16.5013 5.904 16.288C5.744 16.0747 5.68 15.8293 5.712 15.552C5.744 15.2747 5.86133 15.0507 6.064 14.88C6.26667 14.7093 6.496 14.6453 6.752 14.688ZM17.6 20.544C18.304 20.864 18.976 21.0987 19.616 21.248C19.872 21.312 20.0693 21.4613 20.208 21.696C20.3467 21.9307 20.3893 22.1813 20.336 22.448C20.2827 22.7147 20.144 22.9227 19.92 23.072C19.696 23.2213 19.4453 23.264 19.168 23.2C18.4213 23.0293 17.632 22.752 16.8 22.368C16.5653 22.2613 16.4 22.08 16.304 21.824C16.208 21.568 16.2133 21.312 16.32 21.056C16.4267 20.8 16.6027 20.624 16.848 20.528C17.0933 20.432 17.344 20.4373 17.6 20.544ZM12.832 17.44C13.0027 17.568 13.248 17.7493 13.568 17.984L14.496 18.688C14.7093 18.8587 14.8373 19.0773 14.88 19.344C14.9227 19.6107 14.8693 19.856 14.72 20.08C14.5707 20.304 14.368 20.4427 14.112 20.496C13.856 20.5493 13.6107 20.5013 13.376 20.352L11.744 19.072C11.5307 18.9227 11.4027 18.7093 11.36 18.432C11.3173 18.1547 11.3707 17.904 11.52 17.68C11.6693 17.456 11.872 17.3227 12.128 17.28C12.384 17.2373 12.6187 17.2907 12.832 17.44ZM20.16 8.672C20.416 8.672 20.64 8.576 20.832 8.384C21.024 8.192 21.12 7.95733 21.12 7.68C21.12 7.40267 21.024 7.16267 20.832 6.96C20.64 6.75733 20.416 6.656 20.16 6.656C19.904 6.656 19.68 6.75733 19.488 6.96C19.296 7.16267 19.2 7.40267 19.2 7.68C19.2 7.95733 19.296 8.192 19.488 8.384C19.68 8.576 19.904 8.672 20.16 8.672Z",fill:"#666666"}))),i("p",{class:"s-bullet-delivery-saved-addresses-empty-title"},Salla.lang.get("pages.checkout.no_saved_addresses")),i("p",{class:"s-bullet-delivery-saved-addresses-empty-desc"},Salla.lang.get("pages.checkout.add_address_simplify_shipping")),i("salla-button",{onClick:()=>this.handleAddNewAddress(),onKeyUp:()=>this.handleAddNewAddress()},Salla.lang.get("pages.checkout.add_new_address")))}async saveSessionAddressToProfile(){const t=this.getStoredIntent(),e=S(t),i=x(t),s=_(t);if(!t||"address"!==t.type||!e||!i)return null;const o=k(t);if(p(o)&&!s)return null;const a=p(o),n=t.address_details?.district?.name??"",r={country_id:e,region_id:C(t),city_id:i,district_id:s,description:n};a&&(r.local=n);try{const{success:t,address:e}=await m.saveAddressLocation(r);if(!t)return null;const i=e??null;return i&&this.addressCreated.emit({address:i}),i}catch(t){return console.error("SallaBulletDelivery: Error saving session address",t),null}}renderSavedAddresses(){if(!this.isLoggedIn)return null;if(this.loadingSavedAddresses)return i("div",{class:"s-bullet-delivery-addresses-list s-scrollbar"},[1,2,3].map((t=>i("div",{key:t,class:"s-bullet-delivery-address-item s-bullet-delivery-address-item--skeleton"},i("salla-skeleton",{class:"s-bullet-delivery-skel-radio",height:"18px",width:"18px"}),i("salla-skeleton",{class:"s-bullet-delivery-skel-map",height:"36px",width:"36px"}),i("div",{class:"s-bullet-delivery-address-content"},i("div",{class:"s-bullet-delivery-address-lines"},i("salla-skeleton",{height:"18px",width:"72%"}),i("salla-skeleton",{height:"16px",width:"56%"})))))));const t=this.getStoredIntent(),e=L(t),s=e&&t?.address_details&&[t.address_details.city?.name,t.address_details.country?.name].filter(Boolean).join("، ")||"",o=e&&t?.address_details?(t.address_details.district?.name??"").trim():"";return 0!==this.savedAddresses.length||e?i("div",{class:"s-bullet-delivery-addresses-list s-scrollbar"},e&&this.renderAddressRow({key:"session-address",line1:s,line2:o,selected:this.selectedSessionAddress,onClick:()=>this.handleSessionAddressSelect()}),this.savedAddresses.map((t=>{const e=[t.building_number,t.street].filter(Boolean).join("، ")||t.formatted?.address_one||t.short_address||"",i=[t.district?.name,t.city?.name,t.country?.name].filter(Boolean).join("، "),s=(t.formatted?.address_two||i)??"",o=!1!==t.is_in_coverage;return this.renderAddressRow({key:String(t.id),line1:e,line2:s,selected:this.selectedSavedAddress?.id===t.id,disabled:!o,onClick:()=>o&&this.handleSavedAddressSelect(t)})}))):this.renderSavedAddressesEmptyState()}renderAddressRow(t){const{key:e,line1:s,line2:o,selected:a,disabled:n=!1,onClick:r}=t;return i("button",{key:e,class:{"s-bullet-delivery-address-item":!0,"s-bullet-delivery-address-item--selected":a,"s-bullet-delivery-address-item--disabled":n},type:"button",onClick:n?void 0:r,onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n||r())}},i("input",{type:"radio",name:"saved_address",class:"s-bullet-delivery-radio",checked:a,disabled:n,onClick:t=>t.stopPropagation()}),i("span",{class:"s-bullet-delivery-address-map-icon",innerHTML:'<svg width="35" height="35" viewBox="0 0 35 35" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g filter="url(#filter0_d_24181_220540)">\n <mask id="mask0_24181_220540" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="1" y="0" width="33" height="32">\n <rect x="1.90958" y="0.576577" width="30.8468" height="30.8468" rx="9.22523" fill="#D9D9D9" stroke="white" stroke-width="1.15315"/>\n </mask>\n <g mask="url(#mask0_24181_220540)">\n <rect x="1.90958" y="0.576577" width="30.8468" height="30.8468" rx="9.22523" fill="#E8E8E8" stroke="white" stroke-width="1.15315"/>\n <path d="M17.9096 6.77445L28.7204 5.33301H32.4681L32.7564 11.8195V23.6393L10.4141 23.9276V10.8105L17.9096 6.77445Z" fill="#97E7C8"/>\n <path d="M-2.70303 10.6664H10.2699M41.6934 5.47722C38.378 5.47722 34.7744 5.47722 27.8555 5.47722C20.9366 5.47722 18.4862 6.63037 15.4591 8.64839C12.4321 10.6664 10.2699 10.6664 10.2699 10.6664M10.2699 34.4502V23.6394M10.2699 10.6664V23.6394M-6.16249 23.6394H10.2699M10.2699 23.6394H21.0807M38.8105 23.6394H21.0807M21.0807 23.6394V34.4502" stroke="white" stroke-width="2.30631"/>\n <rect x="2.34202" y="1.00901" width="29.982" height="29.982" rx="8.79279" stroke="white" stroke-width="2.01802"/>\n </g>\n <g clip-path="url(#clip0_24181_220540)">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M18.069 19.8621C19.4995 18.6902 22.171 16.0948 22.171 13.0548C22.171 11.7333 21.6461 10.466 20.7117 9.5316C19.7773 8.5972 18.51 8.07227 17.1885 8.07227C15.8671 8.07227 14.5998 8.5972 13.6654 9.5316C12.731 10.466 12.2061 11.7333 12.2061 13.0548C12.2061 16.0948 14.8776 18.6902 16.3081 19.8621C16.5553 20.0679 16.8669 20.1806 17.1885 20.1806C17.5102 20.1806 17.8218 20.0679 18.069 19.8621ZM17.1885 14.1618C17.517 14.1618 17.838 14.0644 18.1111 13.8819C18.3842 13.6995 18.597 13.4401 18.7227 13.1367C18.8484 12.8333 18.8812 12.4994 18.8172 12.1773C18.7531 11.8552 18.595 11.5593 18.3627 11.3271C18.1305 11.0948 17.8346 10.9367 17.5125 10.8726C17.1904 10.8085 16.8565 10.8414 16.5531 10.9671C16.2497 11.0928 15.9903 11.3056 15.8079 11.5787C15.6254 11.8518 15.528 12.1728 15.528 12.5012C15.528 12.9416 15.703 13.364 16.0144 13.6754C16.3258 13.9868 16.7481 14.1618 17.1885 14.1618Z" fill="#55575D"/>\n </g>\n </g>\n <defs>\n <filter id="filter0_d_24181_220540" x="-0.000325561" y="0" width="34.6667" height="34.6667" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n <feFlood flood-opacity="0" result="BackgroundImageFix"/>\n <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n <feOffset dy="1.33333"/>\n <feGaussianBlur stdDeviation="0.666667"/>\n <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0"/>\n <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_24181_220540"/>\n <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_24181_220540" result="shape"/>\n </filter>\n <clipPath id="clip0_24181_220540">\n <rect width="12.1081" height="12.1081" fill="white" transform="translate(11.1338 8.07227)"/>\n </clipPath>\n </defs>\n </svg>\n ',"aria-hidden":"true"}),i("div",{class:"s-bullet-delivery-address-content"},i("div",{class:"s-bullet-delivery-address-lines"},i("span",{class:"s-bullet-delivery-address-line1"},s),i("span",{class:"s-bullet-delivery-address-line2"},o))))}renderMapSection(){const t=p(this.selectedCountry?.code??"");return i("div",{class:"s-bullet-delivery-map-container"},i("gmap-map",{ref:t=>this.gmapRef=t,zoom:16,"map-id":"DEMO_MAP_ID","enable-autocomplete":!0,"enable-geolocation":!0,"show-location-marker":!0,language:Salla.lang.getLocale?.()??document.documentElement.lang??"ar","geolocation-button-label":Salla.lang.get("pages.checkout.current_location"),"autocomplete-placeholder":Salla.lang.get("pages.checkout.search_for_address"),"autocomplete-hint":t?Salla.lang.get("pages.checkout.short_address_format_validation"):void 0,"autocomplete-country":this.selectedCountry?.code?.toLowerCase(),"autocomplete-resolve":!1,"autocomplete-auth-token":this.addressToken,"location-marker-background":"#4285F4","location-marker-border-color":"#1967D2","location-marker-glyph-color":"#FFFFFF","location-marker-scale":1.3,"onGmap-location-changed":this.handleMapLocationChanged,"onGmap-ready":this.handleMapReady}))}renderAddressConfirmation(){const t=this.mapLocationData?.formattedAddress??"",e=this.mapLocationData?.shortAddress;return i("div",{class:"s-bullet-delivery-address-confirm"},i("div",{class:"s-bullet-delivery-address-confirm-card"},i("div",{class:"s-bullet-delivery-address-confirm-details"},i("span",{class:"s-bullet-delivery-address-confirm-label"},Salla.lang.get("pages.checkout.selected_address")),i("p",{class:"s-bullet-delivery-address-confirm-text"},t),e&&i("span",{class:"s-bullet-delivery-address-confirm-tag"},e,i("span",{class:"s-bullet-delivery-address-confirm-tag-icon",innerHTML:'<svg width="13" height="15" viewBox="0 0 8.97576 11.7781" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.2453 8.52122L5.8322 8.24311L5.86126 8.20024L6.27435 8.47694L6.2453 8.52122ZM6.42386 8.25126L6.00758 7.97882C5.96896 8.03798 5.92999 8.0975 5.88995 8.15737L6.30376 8.43372C6.34414 8.37136 6.38489 8.31184 6.42386 8.25126ZM6.63572 7.92213L6.21518 7.65677L6.11244 7.81797L6.5305 8.08723L6.63572 7.92213ZM6.43484 9.81081L5.92538 9.45547C5.32487 10.316 4.76617 11.0388 4.48664 11.3927L4.97413 11.7781C5.25827 11.4182 5.82512 10.6831 6.43484 9.81081ZM3.55487 10.1647C3.44257 10.0113 3.33097 9.85652 3.22327 9.70417L2.717 10.0638C2.82611 10.2179 2.93913 10.3745 3.0525 10.5307L3.55487 10.1647ZM3.11734 9.55006L2.99688 9.37823L2.48707 9.73216L2.60965 9.90753L3.11734 9.55006ZM6.58577 9.59257L6.07206 9.24113L5.95266 9.41402L6.46248 9.76865C6.50499 9.71091 6.54538 9.65174 6.58577 9.59151V9.59257ZM2.96535 9.33607C2.46191 8.60767 2.02898 7.92319 1.68072 7.30887L1.14044 7.61461C1.49933 8.24736 1.94182 8.9453 2.4566 9.68929L2.96535 9.33607ZM7.01161 8.95416L6.49152 8.6144C6.39055 8.7678 6.28533 8.92652 6.17763 9.08453L6.69134 9.43386C6.80329 9.27018 6.911 9.11146 7.01374 8.95486L7.01161 8.95416ZM8.97363 4.48559C8.97434 3.96621 8.88471 3.45073 8.70898 2.96217L8.12442 3.17262C8.27605 3.5935 8.35364 4.03777 8.35293 4.48559C8.35293 4.99505 8.11733 5.71955 7.65216 6.63927L8.2059 6.91916C8.72599 5.89847 8.97576 5.10204 8.97576 4.4863L8.97363 4.48559ZM0.749309 5.26111C0.699001 5.09389 0.661447 4.92313 0.637001 4.75059L0.0216118 4.83208C0.0488916 5.03579 0.0921143 5.23738 0.150217 5.43436L0.749309 5.26111ZM0.621058 4.58443V4.39737L0 4.3832V4.48594C0 4.51995 5.62238e-07 4.5738 0.00389767 4.6188L0.621058 4.58443ZM1.3275 2.25361L0.820874 1.89472C0.314958 2.60824 0.0297605 3.45427 0.000709258 4.32864L0.621058 4.35061C0.645858 3.59705 0.89173 2.86793 1.3275 2.25361ZM8.69233 2.91151C8.66612 2.84065 8.63706 2.76944 8.60766 2.70106L8.03797 2.94835C8.06348 3.00752 8.08792 3.06846 8.11131 3.12939L8.69233 2.91151ZM8.52227 2.51684C8.43264 2.33367 8.33025 2.15689 8.21653 1.98754L7.70282 2.33367C7.80095 2.47928 7.88846 2.63163 7.96534 2.78964L8.52227 2.51684ZM6.33848 0.397516C5.7571 0.13393 5.12577 -0.00140612 4.48735 1.10152e-05C4.25494 1.10152e-05 4.02288 0.0177252 3.79331 0.0531534L3.88825 0.664646C4.08665 0.634178 4.28682 0.618943 4.48735 0.618589C5.0372 0.617526 5.58137 0.73444 6.08197 0.961535L6.33848 0.397516ZM3.47906 0.752862L3.31644 0.150581C3.11946 0.203369 2.92602 0.269974 2.73825 0.349688L2.97987 0.921501C3.14214 0.853125 3.30865 0.796084 3.47835 0.750382L3.47906 0.752862ZM3.84184 0.673858L3.7391 0.061657C3.6647 0.0737026 3.58959 0.0885822 3.51519 0.104525L3.64876 0.710702C3.71182 0.694051 3.77666 0.681651 3.84078 0.671023L3.84184 0.673858ZM4.68149 10.6292C4.68149 10.6253 5.02975 10.2041 5.49138 9.58159L5.08998 9.28293C4.8434 9.6156 4.63083 9.8884 4.4877 10.0705C4.2436 9.76121 3.79791 9.18302 3.32069 8.49819L2.91043 8.78481C3.63494 9.82286 4.28824 10.6218 4.29462 10.6296L4.48735 10.8659L4.68149 10.6292ZM5.57039 9.47318L5.16757 9.17629L5.10344 9.26097L5.50556 9.55821C5.52752 9.52739 5.54843 9.50117 5.56968 9.47212L5.57039 9.47318ZM6.01997 8.85035L5.60759 8.56445C5.48359 8.74123 5.35463 8.92156 5.22213 9.10154L5.62566 9.39772C5.75993 9.21278 5.89137 9.02927 6.0175 8.85L6.01997 8.85035ZM8.12194 4.47708C8.12229 3.76958 7.91539 3.07731 7.52639 2.48601L7.10833 2.76023C7.44419 3.2704 7.62311 3.86807 7.62204 4.47886C7.62204 5.12436 7.14872 6.20669 6.25309 7.60788L6.67434 7.87714C7.63196 6.37108 8.11875 5.2271 8.11875 4.47567L8.12194 4.47708ZM2.68015 7.53667C2.55863 7.34394 2.44314 7.15653 2.33791 6.97584L1.9064 7.22951C2.01481 7.41444 2.13314 7.60788 2.25785 7.8077L2.68015 7.53667ZM2.29009 6.89436L2.23801 6.80366L1.80365 7.05237L1.8568 7.14554L2.29009 6.89436ZM2.22596 6.78205C1.65627 5.78155 1.35513 4.98371 1.35513 4.47567C1.35513 4.17453 1.39835 3.87516 1.48338 3.58642L1.00368 3.44541C0.905193 3.77915 0.854885 4.12528 0.855239 4.47319C0.855239 5.07618 1.16984 5.93567 1.79161 7.02757L2.22596 6.78205ZM7.50867 2.46263C7.48812 2.43181 7.46616 2.39851 7.44455 2.36946L7.03535 2.65465C7.05413 2.68087 7.07326 2.7078 7.09133 2.73508L7.50867 2.46263ZM2.36732 2.17389L2.02579 1.8026C1.85148 1.9638 1.69312 2.14201 1.55389 2.33438L1.95777 2.62985C2.07893 2.46369 2.21604 2.30994 2.36767 2.1707L2.36732 2.17389ZM7.38396 2.28726C7.24012 2.09772 7.07786 1.9227 6.90037 1.76434L6.5677 2.13811C6.7211 2.27415 6.86104 2.42472 6.98504 2.58769L7.38396 2.28726ZM2.50726 2.04848L2.19124 1.66302C2.16183 1.68675 2.13278 1.7112 2.10373 1.73635L2.43286 2.11402C2.45731 2.08993 2.48246 2.06867 2.50726 2.04848ZM4.48664 1.34203C4.8884 1.34133 5.28626 1.41856 5.65861 1.56878L5.84602 1.10431C4.62658 0.613984 3.23744 0.819114 2.21214 1.6414L2.52568 2.03112C3.08084 1.58295 3.77311 1.34026 4.48664 1.3431V1.34203ZM4.72649 9.03245C4.86927 8.82839 5.00708 8.62609 5.13817 8.43053C5.67207 7.64862 6.15567 6.83342 6.58506 5.98987C7.08141 4.98406 7.12463 4.54723 7.12853 4.47035V4.45618C7.12853 2.99689 5.94558 1.81394 4.48628 1.81394C3.02699 1.81394 1.84404 2.99689 1.84404 4.45618V4.47035C1.84404 4.54759 1.89081 4.98406 2.3868 5.98987C2.8169 6.83342 3.3005 7.64862 3.83476 8.43053C3.96336 8.62326 4.10401 8.82874 4.24643 9.03245L4.48522 9.3754L4.72649 9.03245ZM3.0316 3.00362C3.83547 2.19975 5.13887 2.20011 5.94274 3.00398C6.32537 3.3866 6.54183 3.90456 6.54538 4.44555C6.53971 4.49374 6.48125 4.87707 6.06178 5.73018C5.64373 6.55177 5.17289 7.34571 4.6528 8.10671C4.59895 8.18749 4.54368 8.26933 4.48699 8.35223C4.43102 8.26933 4.37504 8.18784 4.32119 8.10671C3.80146 7.34536 3.33061 6.55177 2.91221 5.73018C2.48636 4.86644 2.43357 4.48346 2.42932 4.44555C2.43109 3.90421 2.64791 3.38589 3.0316 3.00362Z" fill="url(#paint0_linear_0_471)"/>\n<defs>\n<linearGradient id="paint0_linear_0_471" x1="-0.000253536" y1="5.88509" x2="8.97608" y2="5.88509" gradientUnits="userSpaceOnUse">\n<stop offset="0.2" stop-color="#4498B6"/>\n<stop offset="0.49" stop-color="#273265"/>\n<stop offset="1" stop-color="#C93732"/>\n</linearGradient>\n</defs>\n</svg>\n'}))),i("button",{type:"button",class:"s-bullet-delivery-address-confirm-edit",onClick:()=>{this.mapStep="map"}},Salla.lang.get("common.elements.edit"))),i("div",{class:"s-bullet-delivery-address-confirm-description"},i("label",{class:"s-bullet-delivery-address-confirm-description-label"},Salla.lang.get("pages.checkout.address_description"),i("span",{class:"s-bullet-delivery-address-confirm-description-optional"},Salla.lang.get("common.elements.optional"))),i("input",{type:"text",class:"s-bullet-delivery-address-confirm-description-input form-input",placeholder:Salla.lang.get("pages.checkout.address_description_placeholder"),value:this.addressDescription,onInput:t=>{this.addressDescription=t.target.value}})))}renderGuestDeliveryForm(){if(this.isMapModeAvailable)return"confirm"===this.mapStep&&this.hasMapLocation()?this.renderAddressConfirmation():this.renderMapSection();const t=p(this.selectedCountry?.code??"");return[this.renderCountrySelect(),t?this.renderRegionSelect():null,this.renderCityDistrictSelects()]}renderDeliveryTab(){return i("div",{class:{"s-bullet-delivery-content":!0,"s-bullet-delivery-content--active":"address"===this.activeTab,"s-hidden":"address"!==this.activeTab}},this.isLoggedIn?this.renderSavedAddresses():this.renderGuestDeliveryContent())}renderGuestDeliveryContent(){if(!this.isMapModeAvailable)return this.renderGuestDeliveryForm();const t=this.hasMapLocation(),e="confirm"===this.mapStep&&t,s=e?this.savingAddress?Salla.lang.get("pages.checkout.loading"):Salla.lang.get("pages.checkout.confirm_address"):Salla.lang.get("pages.checkout.confirm_location");return i("form",{onSubmit:i=>{i.preventDefault(),e||!t?this.handleSubmitAddAddress(i):this.mapStep="confirm"}},this.renderGuestDeliveryForm(),i("div",{class:"s-bullet-delivery-form-actions s-bullet-delivery-form-actions--single",style:{padding:"24px"}},i("salla-button",{type:"submit",loading:this.savingAddress,disabled:!t||this.savingAddress,width:"wide"},s),!this.isLoggedIn&&i("button",{type:"button",class:"s-bullet-delivery-login-prompt",onClick:()=>this.handleLogin()},Salla.lang.get("pages.checkout.login_to_use_saved_addresses"))))}renderBranchSearch(){return i("div",{class:"s-bullet-delivery-branch-search"},i("div",{class:"s-bullet-delivery-search-row"},i("div",{class:"s-bullet-delivery-search s-bullet-delivery-branch-search-wrap"},i("span",{class:"s-bullet-delivery-search-icon s-bullet-delivery-branch-search-icon",innerHTML:n,"aria-hidden":"true"}),i("input",{type:"text",class:"s-bullet-delivery-branch-search-input form-input",placeholder:Salla.lang.get("pages.checkout.search_for_city_or_branch"),value:this.branchSearchQuery,onInput:t=>this.handleBranchSearch(t),autocomplete:"off"})),i("button",{type:"button",class:{"s-bullet-delivery-location-btn":!0,"s-bullet-delivery-location-btn--full":!0,"s-bullet-delivery-location-btn--loading":this.loadingNearestBranch},onClick:()=>this.handleFindNearestBranch(),disabled:this.loadingNearestBranch},this.loadingNearestBranch?i("span",{class:"s-bullet-delivery-location-icon","aria-hidden":"true"},i("salla-skeleton",{height:"18px",width:"18px"})):i("span",{class:"s-bullet-delivery-location-icon",innerHTML:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M13.3258 7.65006C13.3258 10.7797 10.7888 13.3167 7.65916 13.3167C4.52955 13.3167 1.99249 10.7797 1.99249 7.65006C1.99249 4.52045 4.52955 1.9834 7.65916 1.9834C10.7888 1.9834 13.3258 4.52045 13.3258 7.65006Z"\n stroke="#555555" stroke-width="1.3" />\n <path d="M14.65 7.65039H13.3167" stroke="#555555" stroke-width="1.3" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M1.98336 7.65039L0.650024 7.65039" stroke="#555555" stroke-width="1.3"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M7.65002 0.650065L7.65002 1.9834" stroke="#555555" stroke-width="1.3"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M7.65002 13.3171L7.65002 14.6504" stroke="#555555" stroke-width="1.3"\n stroke-linecap="round" stroke-linejoin="round" />\n <path\n d="M9.64999 7.65039C9.64999 8.75496 8.75456 9.65039 7.64999 9.65039C6.54542 9.65039 5.64999 8.75496 5.64999 7.65039C5.64999 6.54582 6.54542 5.65039 7.64999 5.65039C8.75456 5.65039 9.64999 6.54582 9.64999 7.65039Z"\n stroke="#555555" stroke-width="1.3" />\n</svg>\n ',"aria-hidden":"true"}),i("span",null,Salla.lang.get("pages.checkout.nearest_to_my_location")))),this.locationError&&"branch"===this.activeTab&&i("span",{class:"s-bullet-delivery-error"},this.locationError))}renderBranchList(){return this.loadingBranches?i("div",{class:"s-bullet-delivery-branches-wrap"},i("div",{class:"s-bullet-delivery-branches-loading"},[1,2,3,4].map((t=>i("div",{key:t,class:"s-bullet-delivery-branch-skeleton"},i("salla-skeleton",{class:"s-bullet-delivery-branch-skeleton-radio",type:"circle",height:"16px",width:"16px"}),i("div",{class:"s-bullet-delivery-branch-skeleton-icon"},i("salla-skeleton",{height:"34px",width:"34px"})),i("div",{class:"s-bullet-delivery-branch-skeleton-content"},i("salla-skeleton",{class:"s-bullet-delivery-branch-skeleton-title",height:"12px",width:"124px"})),i("salla-skeleton",{class:"s-bullet-delivery-branch-skeleton-time",height:"12px",width:"88px"}),i("div",{class:"s-bullet-delivery-branch-skeleton-map"},i("salla-skeleton",{height:"32px",width:"32px"}))))))):0===this.filteredBranches.length?i("salla-placeholder",{alignment:"center",class:"s-bullet-delivery-placeholder"},i("span",{slot:"title"},Salla.lang.get("pages.checkout.no_pickup_branches_found"))):i("div",{class:"s-bullet-delivery-branches-wrap"},i("ul",{class:"s-bullet-delivery-branches-list s-scrollbar"},this.filteredBranches.map((t=>i("li",{key:t.id,class:{"s-bullet-delivery-branch-item":!0,"s-bullet-delivery-branch-item--selected":this.selectedBranch?.id===t.id,"s-bullet-delivery-branch-item--disabled":!1===t.is_open},tabIndex:!1===t.is_open?-1:0,role:"option","aria-disabled":!1===t.is_open,onClick:()=>!1!==t.is_open&&this.handleBranchSelect(t),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),!1!==t.is_open&&this.handleBranchSelect(t))}},i("input",{type:"radio",name:"branch",class:"s-bullet-delivery-radio",checked:this.selectedBranch?.id===t.id,disabled:!1===t.is_open}),i("span",{class:"s-bullet-delivery-branch-icon","aria-hidden":"true"},i("span",{innerHTML:Cs})),i("div",{class:"s-bullet-delivery-branch-info"},i("span",{class:"s-bullet-delivery-branch-name"},t.name),t.preparation_time?i("span",{class:"s-bullet-delivery-branch-prep"},`${Salla.lang.get("pages.checkout.processing_time")}: ${t.preparation_time}`):null),(()=>{const e=(s=t.working_hours,s?.[0]?.times?.[0]??null);var s;return e?i("span",{class:"s-bullet-delivery-branch-time"},function(t,e,i,s){const o=String(t).trim(),a=String(e).trim();return o&&a?"00:00"===o?`${s} ${v(a,i)}`:`${v(o,i)} - ${v(a,i)}`:""}(e.from,e.to,Salla.config.get("user.language_code")||"ar",Salla.lang.get("pages.checkout.until"))):null})(),null!=t.location?.lat&&null!=t.location?.lng&&i("a",{href:`https://www.google.com/maps?q=${t.location.lat},${t.location.lng}`,target:"_blank",rel:"noopener noreferrer",class:"s-bullet-delivery-branch-map-link",title:Salla.lang.get("common.elements.open_in_google_maps"),onClick:t=>t.stopPropagation()},i("span",{class:"s-bullet-delivery-branch-map-link-icon",innerHTML:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M7.94798 3.19336C11.1309 2.1083 12.7223 1.56578 13.5783 2.42174C14.4342 3.27771 13.8917 4.86914 12.8066 8.05201L12.0678 10.2195C11.2344 12.6639 10.8178 13.8861 10.131 13.9872C9.94631 14.0144 9.75517 13.9981 9.57248 13.9394C8.89297 13.7212 8.53377 12.4326 7.81538 9.8553C7.65604 9.28364 7.57637 8.99781 7.39494 8.7795C7.34228 8.71614 7.28386 8.65772 7.2205 8.60506C7.00219 8.42363 6.71636 8.34396 6.1447 8.18462C3.56741 7.46623 2.27876 7.10703 2.0606 6.42752C2.00195 6.24483 1.98558 6.05369 2.01277 5.86903C2.11392 5.18221 3.33613 4.76556 5.78054 3.93225L7.94798 3.19336Z"\n stroke="#555555" stroke-width="1.2" />\n</svg>\n '.replace(/mask0_25437_34440/g,`mask0_branch_${t.id}`),"aria-hidden":"true"}),i("span",{class:"sr-only"},Salla.lang.get("common.elements.open_in_google_maps"))))))))}renderPickupTab(){return i("div",{class:{"s-bullet-delivery-content":!0,"s-bullet-delivery-content--active":"branch"===this.activeTab,"s-hidden":"branch"!==this.activeTab}},this.renderCountrySelect(),this.renderBranchSearch(),this.renderBranchList())}renderAddAddressForm(){Salla.lang.get("pages.checkout.add_new_address");const t=this.isMapModeAvailable,e=p(this.selectedCountry?.code??""),s=this.hasMapLocation();let o,a;if(t)"map"===this.mapStep?(o=s,a=Salla.lang.get("pages.checkout.confirm_location")):(o=s,a=this.savingAddress?Salla.lang.get("pages.checkout.loading"):Salla.lang.get("pages.checkout.confirm_address"));else{const t=this.selectedCountry&&this.selectedCity&&(!e||this.selectedRegion)&&(!e||!!this.selectedDistrict||!!(this.districtName&&this.districtName.trim().length>0));o=s||t,a=this.savingAddress?Salla.lang.get("pages.checkout.loading"):Salla.lang.get("pages.checkout.confirm_address")}return this.savedAddresses.length>0||L(this.getStoredIntent()),i("div",{class:"s-bullet-delivery-add-address"},i("form",{class:"s-bullet-delivery-add-address-form",onSubmit:e=>{e.preventDefault(),t&&"map"===this.mapStep&&s?this.mapStep="confirm":this.handleSubmitAddAddress(e)}},this.renderGuestDeliveryForm(),i("div",{class:"s-bullet-delivery-form-actions s-bullet-delivery-form-actions--single"},i("salla-button",{type:"submit",loading:this.savingAddress,disabled:!o||this.savingAddress,class:"s-bullet-delivery-add-address-submit"},a))))}renderFooter(){if("address"===this.activeTab&&!this.isLoggedIn&&this.isMapModeAvailable)return null;const t="address"===this.activeTab&&this.isLoggedIn;return i("div",{class:"s-bullet-delivery-footer"},i("salla-button",{ref:t=>{this.confirmBtn=t},disabled:this.isConfirmDisabled(),onClick:()=>this.handleConfirm(),"loader-position":"center",width:"wide"},"branch"===this.activeTab?Salla.lang.get("pages.checkout.confirm_receipt_from_the_branch"):Salla.lang.get("pages.checkout.confirm_address")),t&&i("salla-button",{onClick:()=>this.handleAddNewAddress(),width:"wide",shape:"link"},Salla.lang.get("pages.checkout.add_new_address")),!this.isLoggedIn&&i("salla-button",{shape:"link",onClick:this.handleLogin},Salla.lang.get("pages.checkout.login_to_use_saved_addresses")))}renderMainView(){const t=this.isLoggedIn&&"address"===this.activeTab&&0===this.savedAddresses.length&&!L(this.getStoredIntent()),e="branch"===this.activeTab&&this.supportsPickup?this.renderPickupTab():this.renderDeliveryTab();return i("div",null,this.showCartWillBeClearedBanner&&this.renderAlert(Salla.lang.get("blocks.scope.empty_cart_warning")),this.allocationOutOfCoverageMessage&&this.renderAllocationOutOfCoverageAlert(),e,!t&&this.renderFooter())}handleAfterAddToCart(){if("after_add_to_cart"!==this.openingType)return;const t=this.shouldPromptIncompleteIntentThisSession();this.hasBeenShownThisSession()&&!t||this.modal?.hasAttribute?.("visible")||(t&&this.markIncompleteIntentPrompted(),this.open())}overrideScopeSwitchUI(){const t=this.getStoredIntent(),e=document.querySelector('[onclick*="scopes"]');if(!e)return;if(!t||"address"!==t.type&&"branch"!==t.type)return e.style.display="none",void(e.onclick=()=>this.open());const i=(t,e)=>t&&t.length>e?`${t.slice(0,e)}...`:t??"",s="branch"===t.type?`${Salla.lang.get("mobile_app.strings.pickup")} ${Salla.lang.get("common.elements.from")} ${i(t.branch_details?.name,20)}`:`${Salla.lang.get("mobile_app.strings.delivery")} ${Salla.lang.get("common.elements.to")} ${i(t.address_details?.city?.name,10)}`;e.style.display="inline-flex",e.onclick=()=>this.open();const o=e.querySelector('span:not([class*="sicon"]):not([class*="icon"])');if(o)o.textContent=s;else{const t=Array.from(e.childNodes).find((t=>t.nodeType===Node.TEXT_NODE&&t.textContent?.trim()));t&&(t.textContent=` ${s}`)}}async componentWillLoad(){await Salla.onReady();try{this.overrideScopeSwitchUI(),this.cartSubmittingHandler=async()=>{this.pendingCartSubmitPromise?await this.pendingCartSubmitPromise:this.hasCompleteIntentForLoggedInUser()||(this.cartSubmitConfirmationPending=!0,this.pendingCartSubmitPromise=new Promise((t=>{if(this.pendingCartSubmitResolver=t,this.isGuestUser())return Salla.auth.setCanRedirect(!1),void Salla.event.dispatch("login::open",{withoutReload:!0,source:"cart-submit"});this.open()})),await this.pendingCartSubmitPromise)},Salla.cart.event.onSubmitting(this.cartSubmittingHandler)}catch(t){console.warn("SallaBulletDelivery: overrideScopeSwitchUI failed",t)}Salla.event.on("salla::bullet-delivery.modal.open.requested",this.bulletDeliveryOpenHandler),this.closeHandler=this.close.bind(this),Salla.event.on("salla::bullet-delivery.modal.close.requested",this.closeHandler),this.isRTL=Salla.config.get("theme.is_rtl"),this.authLoggedInHandler=()=>{if(this.cartSubmitConfirmationPending)return Salla.event.dispatch("login::close"),this.hasCompleteIntentForLoggedInUser()?void this.resolvePendingCartSubmit():void(this.modal?.hasAttribute?.("visible")||this.open());this.hasIncompleteUserAddressIntent()&&(this.modal?.hasAttribute?.("visible")||this.open())},Salla.event.on("auth::logged.in",this.authLoggedInHandler),this.authLoggedOutHandler=()=>{this.clearBulletDeliveryStoredData()},Salla.event.on("auth::logged.out",this.authLoggedOutHandler),this.loginClosedHandler=()=>{this.cartSubmitConfirmationPending&&this.isGuestUser()&&(this.hasCompleteIntentForLoggedInUser()||this.resolvePendingCartSubmit())},Salla.event.on("salla-login::closed",this.loginClosedHandler),this.cartItemAddedHandler=()=>this.handleAfterAddToCart(),"function"==typeof Salla.cart?.event?.onItemAdded?(this.useCartEventApi=!0,Salla.cart.event.onItemAdded(this.cartItemAddedHandler)):Salla.event.on(this.cartItemAddedEvent,this.cartItemAddedHandler)}render(){return this.isMobileApp?null:i(s,{class:"s-bullet-delivery"},i("salla-modal",{ref:t=>{this.modal=t},isClosable:!this.isRequired&&!this.shouldForceNonClosable(),class:"s-bullet-delivery-modal",width:"sm"},i("div",{class:"s-bullet-delivery-inner"},i("div",{class:"s-bullet-delivery-header"},i("h2",{class:"s-bullet-delivery-title"},"address"===this.activeTab?Salla.lang.get("blocks.home.add_address_for_order_delivery"):Salla.lang.get("blocks.home.how_prefer_to_receive_order")),i("p",{class:"s-bullet-delivery-subtitle"},"address"===this.activeTab?Salla.lang.get("blocks.home.products_available_for_delivery_shown_while_shopping"):Salla.lang.get("blocks.home.products_available_for_delivery_or_pickup_shown_while_shopping"))),this.renderTabs(),"main"===this.viewMode&&this.renderMainView(),"add-address"===this.viewMode&&this.renderAddAddressForm())))}componentDidLoad(){if(this.componentReady=!0,this.isMobileApp)return this.hasBeenShownThisSession()||Salla.event.dispatch("salla::bullet-delivery.open-sheet"),this.bulletDeliveryMobileSelectHandler=t=>{const e=this.extractMobileSelectPayload(t);e?this.applyMobileBulletDeliverySelection(e):console.warn("SallaBulletDelivery: received empty mobile select payload",t)},void Salla.event.on("salla::bullet-delivery.select",this.bulletDeliveryMobileSelectHandler);if(this.pendingOpen)return this.pendingOpen=!1,void this.open();switch(this.openingType){case"first_visit":this.hasBeenShownThisSession()?this.shouldPromptIncompleteIntentThisSession()&&(this.markIncompleteIntentPrompted(),this.open()):this.open();break;case"on_cart_click":Salla.url.is_page("cart")&&(!0===this.getShownStorage().get(this.sessionShownKey)?this.shouldPromptIncompleteIntentThisSession()&&(this.markIncompleteIntentPrompted(),this.open()):this.open())}const t=this.createCartViewElement();t&&"function"==typeof salla?.hooks?.mount&&Salla.hooks.mount("cart:items.start",t).catch((()=>{}))}disconnectedCallback(){this.componentReady=!1,Salla.event.off("salla::bullet-delivery.modal.open.requested",this.bulletDeliveryOpenHandler),this.closeHandler&&(Salla.event.off("salla::bullet-delivery.modal.close.requested",this.closeHandler),this.closeHandler=null),this.cartItemAddedHandler&&(this.useCartEventApi&&"function"==typeof Salla.cart?.event?.offItemAdded?Salla.cart.event.offItemAdded(this.cartItemAddedHandler):Salla.event.off(this.cartItemAddedEvent,this.cartItemAddedHandler),this.cartItemAddedHandler=null),this.cartSubmittingHandler&&("function"==typeof Salla.cart?.event?.offSubmitting?Salla.cart.event.offSubmitting(this.cartSubmittingHandler):Salla.event.off("cart::submitting",this.cartSubmittingHandler),this.cartSubmittingHandler=null),this.authLoggedInHandler&&(Salla.event.off("auth::logged.in",this.authLoggedInHandler),this.authLoggedInHandler=null),this.authLoggedOutHandler&&(Salla.event.off("auth::logged.out",this.authLoggedOutHandler),this.authLoggedOutHandler=null),this.loginClosedHandler&&(Salla.event.off("salla-login::closed",this.loginClosedHandler),this.loginClosedHandler=null),this.bulletDeliveryMobileSelectHandler&&(Salla.event.off("salla::bullet-delivery.select",this.bulletDeliveryMobileSelectHandler),this.bulletDeliveryMobileSelectHandler=null)}};As.INITIAL_ADDRESS_FORM={country_id:0,is_default:!1,city_id:void 0,district_id:void 0,street:void 0,building_number:void 0,additional_number:void 0,postal_code:void 0,description:void 0},As.DROPDOWN_SEARCH_DEBOUNCE_MS=400,As.DROPDOWN_SEARCH_MIN_CHARS=2,As.style="@supports (interpolate-size: allow-keywords) and (block-size: calc-size(auto, size)) {\n .s-bullet-delivery .s-bullet-delivery-modal .s-modal-body, .s-bullet-delivery-inner {\n @apply [interpolate-size:allow-keywords];\n }\n .s-bullet-delivery .s-bullet-delivery-modal .s-modal-body {\n @apply [overflow:clip] [transition:block-size_500ms_ease];\n }\n .s-bullet-delivery-inner {\n @apply [overflow:clip] [transition:block-size_500ms_ease];\n block-size: calc-size(auto, size);\n }\n}\n\n/* Allow searchable dropdown popover to paint outside the modal body */\n.s-bullet-delivery .s-bullet-delivery-modal .s-modal-body:has(.s-searchable-dropdown--open) {\n overflow: visible !important;\n}\n\n.s-bullet-delivery-map-container {\n width: 100%;\n height: 450px;\n border-radius: 8px;\n overflow: hidden;\n margin-bottom: 12px;\n}\n.s-bullet-delivery-map-container gmap-map {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n.s-bullet-delivery-address-confirm {\n display: flex;\n flex-direction: column;\n gap: 20px;\n padding: 0 24px;\n}\n\n.s-bullet-delivery-address-confirm-card {\n display: flex;\n align-items: flex-start;\n gap: 12px;\n}\n\n.s-bullet-delivery-address-confirm-edit {\n border: 1px solid #eee;\n border-radius: 8px;\n padding: 6px 12px;\n font-size: 12px;\n font-weight: 500;\n line-height: 1;\n color: #333;\n background: white;\n cursor: pointer;\n white-space: nowrap;\n height: 32px;\n flex-shrink: 0;\n align-self: center;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n.s-bullet-delivery-address-confirm-details {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n flex: 1;\n min-width: 0;\n}\n\n.s-bullet-delivery-address-confirm-label {\n font-size: 12px;\n color: #666;\n}\n\n.s-bullet-delivery-address-confirm-text {\n font-size: 14px;\n font-weight: 700;\n color: #333;\n margin: 0;\n word-break: break-word;\n}\n\n.s-bullet-delivery-address-confirm-tag {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n border: 1px solid #eee;\n border-radius: 140px;\n padding: 4px 8px;\n font-size: 12px;\n color: #333;\n margin-top: 4px;\n}\n\n.s-bullet-delivery-address-confirm-tag-icon {\n width: 9px;\n display: inline-flex;\n flex-shrink: 0;\n}\n.s-bullet-delivery-address-confirm-tag-icon svg {\n width: 100%;\n height: 100%;\n}\n\n.s-bullet-delivery-address-confirm-description {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.s-bullet-delivery-address-confirm-description-label {\n font-size: 14px;\n font-weight: 500;\n color: #444;\n}\n\n.s-bullet-delivery-address-confirm-description-optional {\n font-weight: 400;\n color: #999;\n margin-inline-start: 4px;\n}\n\n.s-bullet-delivery-address-confirm-description-input {\n width: 100%;\n border: 1px solid #eee;\n border-radius: 8px;\n padding: 10px 12px;\n font-size: 14px;\n}\n\n.s-bullet-delivery-login-prompt {\n display: block;\n width: 100%;\n text-align: center;\n background: none;\n border: none;\n color: var(--color-primary, #004956);\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n padding: 12px 0;\n}\n\n@keyframes s-bullet-delivery-fade-in {\n from {\n opacity: 0;\n transform: translateY(6px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}";const $s=class{constructor(i){t(this,i),this.itemSelected=e(this,"itemSelected"),this.searchInput=e(this,"searchInput"),this.dropdownOpened=e(this,"dropdownOpened"),this.dropdownClosed=e(this,"dropdownClosed"),this.placeholder="",this.items=[],this.selectedItem=null,this.loading=!1,this.searching=!1,this.disabled=!1,this.required=!1,this.noResultsText="",this.inputId="",this.searchQuery="",this.clientSearch=!1,this.dropUp=!1,this.searchable=!0,this.keepParentScroll=!1,this.isOpen=!1,this.focusedIndex=-1,this.clientSearchQuery="",this.scrollableAncestor=null,this.handleTriggerClick=()=>{this.isOpen?this.close():this.open()},this.handleTriggerKeyDown=t=>{this.isOpen?this.navigateItems(t):"Enter"===t.key||" "===t.key||"ArrowDown"===t.key?(t.preventDefault(),this.open()):"Escape"===t.key&&this.close()},this.handleSearchInputChange=t=>{const e=t.target.value;this.clientSearch&&(this.clientSearchQuery=e),this.searchInput.emit(e),this.focusedIndex=-1},this.handleSearchKeyDown=t=>{this.navigateItems(t)}}connectedCallback(){this.boundHandleClickOutside=this.handleClickOutside.bind(this),document.addEventListener("mousedown",this.boundHandleClickOutside)}disconnectedCallback(){document.removeEventListener("mousedown",this.boundHandleClickOutside),this.scrollableAncestor&&(this.scrollableAncestor.style.overflow="",this.scrollableAncestor=null)}onItemsChange(){this.focusedIndex=-1}normalizeArabic(t){return t.replace(/[أإآا]/g,"ا")}get filteredItems(){if(!this.clientSearch||!this.clientSearchQuery.trim())return this.items;const t=this.normalizeArabic(this.clientSearchQuery.trim().toLowerCase());return this.items.filter((e=>{const i=this.normalizeArabic(e.name.toLowerCase()),s=e.name_en?e.name_en.toLowerCase():"";return i.includes(t)||s.includes(t)}))}getDisplayName(t){const e=salla?.config?.get("user.language_code");return e&&"ar"!==e&&t.name_en?.trim()?t.name_en.trim():t.name}handleClickOutside(t){this.isOpen&&(this.host.contains(t.target)||this.close())}findScrollableAncestor(){let t=this.host.parentElement;for(;t;){const e=getComputedStyle(t),i=e.overflowY;if("auto"===i||"scroll"===i||"hidden"===i||"clip"===e.overflow)return t;t=t.parentElement}return null}open(){this.disabled||this.loading||(this.isOpen=!0,this.focusedIndex=-1,this.keepParentScroll||(this.scrollableAncestor=this.findScrollableAncestor(),this.scrollableAncestor&&(this.scrollableAncestor.style.overflow="visible")),this.dropdownOpened.emit(),requestAnimationFrame((()=>this.searchInputRef?.focus())))}close(){this.isOpen&&(this.isOpen=!1,this.focusedIndex=-1,this.clientSearchQuery="",this.scrollableAncestor&&(this.scrollableAncestor.style.overflow="",this.scrollableAncestor=null),this.dropdownClosed.emit())}navigateItems(t){const e=this.filteredItems,i=e.length;switch(t.key){case"ArrowDown":t.preventDefault(),this.focusedIndex=i>0?(this.focusedIndex+1)%i:-1,this.scrollFocusedIntoView();break;case"ArrowUp":t.preventDefault(),this.focusedIndex=i>0?(this.focusedIndex-1+i)%i:-1,this.scrollFocusedIntoView();break;case"Enter":t.preventDefault(),this.focusedIndex>=0&&this.focusedIndex<i&&this.selectItem(e[this.focusedIndex]);break;case"Escape":t.preventDefault(),this.close()}}scrollFocusedIntoView(){this.focusedIndex<0||requestAnimationFrame((()=>{const t=this.panelRef?.querySelector(".s-searchable-dropdown-list"),e=t?.children[this.focusedIndex];e?.scrollIntoView({block:"nearest"})}))}selectItem(t){this.itemSelected.emit(t),this.close()}render(){const t=null!=this.selectedItem,e=`${this.inputId}-listbox`;return i(s,{key:"c529f2b61adbc38aa1e5403da6fdb985fe256baa",class:"s-searchable-dropdown"},i("div",{key:"88ab96afd36421fdf965b79298fa14f435adbcef",class:{"s-searchable-dropdown":!0,"s-searchable-dropdown--open":this.isOpen}},this.label&&i("label",{key:"6ee8a2d0428e1347e36eabec32a3129897481abc",class:"s-searchable-dropdown-label",htmlFor:this.inputId},this.label,this.required&&i("span",{key:"8473884ec18e73c72c79e7749264bd9c24c56ae9",class:"s-searchable-dropdown-required"}," *")),i("div",{key:"bffbea7ff0cb9466c8a852a841a21ed8351ef92d",class:{"s-searchable-dropdown-trigger":!0,"s-searchable-dropdown-trigger--disabled":this.disabled||this.loading,"s-searchable-dropdown-trigger--open":this.isOpen},role:"combobox","aria-expanded":this.isOpen?"true":"false","aria-haspopup":"listbox","aria-controls":e,"aria-disabled":this.disabled||this.loading?"true":"false",tabIndex:this.disabled||this.loading?-1:0,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown},t?i("span",{class:"s-searchable-dropdown-trigger-text"},this.getDisplayName(this.selectedItem)):i("span",{class:"s-searchable-dropdown-trigger-placeholder"},this.placeholder),i("i",{key:"e3aee1ffe1b80a9ef21f4c9cca02de0a590b0825",class:{"sicon-keyboard_arrow_down":!0,"s-searchable-dropdown-trigger-icon":!0,"s-searchable-dropdown-trigger-icon--open":this.isOpen},"aria-hidden":"true"})),this.isOpen&&i("div",{key:"7a19f2d6847b3e0dda5e0ea509df91a2f48fa098",class:{"s-searchable-dropdown-panel":!0,"s-searchable-dropdown-panel--up":this.dropUp},ref:t=>this.panelRef=t},this.searchable&&i("div",{key:"601529f76a09762a57fe7b7663ecfa1505462367",class:"s-searchable-dropdown-search-wrap"},i("i",{key:"f91e464e7efed3759837880b5a7593daa4f84ecb",class:"sicon-search s-searchable-dropdown-search-icon","aria-hidden":"true"}),i("input",{key:"f72a7e12d0a6e90bab3983258c9b08aa286bc897",ref:t=>this.searchInputRef=t,id:this.inputId,type:"text",class:"s-searchable-dropdown-search-input",placeholder:this.placeholder,value:this.clientSearch?this.clientSearchQuery:this.searchQuery,onInput:this.handleSearchInputChange,onKeyDown:this.handleSearchKeyDown,autocomplete:"off","aria-autocomplete":"list","aria-expanded":this.isOpen?"true":"false","aria-controls":e})),i("div",{key:"495aa88fc76d3d17956db7277cc98aff08b4c1af",id:e,class:"s-searchable-dropdown-list s-scrollbar",role:"listbox"},this.renderListContent()))))}renderListContent(){if(this.searching||this.loading)return i("div",{class:"s-searchable-dropdown-loading"},i("svg",{class:"s-searchable-dropdown-spinner",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round",opacity:"0.25"}),i("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round"})));const t=this.filteredItems;return 0===t.length?i("div",{class:"s-searchable-dropdown-empty"},this.noResultsText||salla?.lang?.get("common.elements.no_options")||"No results found"):t.map(((t,e)=>{const s=this.selectedItem?.id===t.id;return i("button",{key:t.id,type:"button",role:"option",class:{"s-searchable-dropdown-item":!0,"s-searchable-dropdown-item--selected":s,"s-searchable-dropdown-item--focused":this.focusedIndex===e&&!s},"aria-selected":s?"true":"false",onClick:()=>this.selectItem(t)},i("span",{class:{"s-searchable-dropdown-item-name":!0,"s-searchable-dropdown-item-name--selected":s}},this.getDisplayName(t)),s&&i("i",{class:"sicon-check s-searchable-dropdown-item-check","aria-hidden":"true"}))}))}get host(){return o(this)}static get watchers(){return{items:["onItemsChange"]}}};export{As as salla_bullet_delivery,$s as salla_searchable_dropdown}
|