@salla.sa/twilight-components 2.14.365 → 2.14.366
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-5FseaYGO.js → filepond-iKAI8_Ua.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-B6jRMST8.js → filepond-plugin-file-poster-DBOuyuqE.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-B5KYrf7Q.js → filepond-plugin-file-validate-size-3OjivJWc.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-D6zZbyEw.js → filepond-plugin-file-validate-type-C4wPNa1h.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-D9sIYJpS.js → filepond-plugin-image-edit-D06RnDWS.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-DCPv8T5a.js → filepond-plugin-image-exif-orientation-CbwYrnuw.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-B6ya_UMz.js → filepond-plugin-image-preview-mOmpKkFJ.js} +1 -1
- package/dist/cjs/{index-DaB0o62I.js → index-DL9nqubd.js} +6 -6
- package/dist/cjs/{index-DsLCYojB.js → index-TmWujwmX.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion-body_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
- package/dist/cjs/salla-add-product-button_4.cjs.entry.js +1 -1
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- 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-booking-field_7.cjs.entry.js +10 -10
- package/dist/cjs/salla-cart-item-offers_2.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_2.cjs.entry.js +11 -8
- package/dist/cjs/salla-custom-fields.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-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-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
- 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-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-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 +248 -177
- 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-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-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +9 -3
- package/dist/cjs/salla-products-slider.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-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/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-DE9NaT9j.js → vanilla-picker-DPu_Z0gW.js} +1 -1
- package/dist/collection/components/salla-offer/interfaces.js +2 -0
- package/dist/collection/components/salla-offer/salla-offer.css +2 -25
- package/dist/collection/components/salla-offer/salla-offer.js +256 -181
- package/dist/collection/components/salla-product-card/salla-product-card.js +29 -7
- package/dist/collection/components/salla-products-list/salla-products-list.js +27 -2
- package/dist/components/index.js +2 -2
- package/dist/components/salla-offer.js +273 -220
- package/dist/components/salla-product-card2.js +11 -7
- package/dist/components/salla-products-list2.js +9 -2
- package/dist/esm/{filepond-BGPYjCAA.js → filepond-OIAu6i0O.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-sd-w_Hri.js → filepond-plugin-file-poster-BMvjO1cc.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-CQkfT5sz.js → filepond-plugin-file-validate-size-CMCs88HU.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-Cu8nOdXD.js → filepond-plugin-file-validate-type-Bjpeuqen.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-CWpBhgby.js → filepond-plugin-image-edit-Fpoh6xBj.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-DbSLLg4E.js → filepond-plugin-image-exif-orientation-CPChwYPW.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-DXgOkLlG.js → filepond-plugin-image-preview-pLwEytag.js} +1 -1
- package/dist/esm/{index-DcD0Zbyk.js → index-CV1rqKQz.js} +6 -6
- package/dist/esm/{index-BNB-g4_5.js → index-Cs4XvAmW.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion-body_3.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +1 -1
- package/dist/esm/salla-add-product-button_4.entry.js +1 -1
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- 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-booking-field_7.entry.js +10 -10
- package/dist/esm/salla-cart-item-offers_2.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_2.entry.js +11 -8
- package/dist/esm/salla-custom-fields.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-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-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +1 -1
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.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-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 +248 -177
- 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-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-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +9 -3
- package/dist/esm/salla-products-slider.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-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/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-ErWyfb2S.js → vanilla-picker-BASTfXcg.js} +1 -1
- package/dist/twilight/{p-eaf91b32.entry.js → p-04664fcb.entry.js} +1 -1
- package/dist/twilight/{p-61b073fe.entry.js → p-0c385d73.entry.js} +1 -1
- package/dist/twilight/{p-05edd1ae.entry.js → p-0ede455c.entry.js} +1 -1
- package/dist/twilight/{p-90375d86.entry.js → p-0f1d7449.entry.js} +1 -1
- package/dist/twilight/{p-df475039.entry.js → p-134c9d22.entry.js} +1 -1
- package/dist/twilight/{p-37baa677.entry.js → p-15242c87.entry.js} +1 -1
- package/dist/twilight/{p-0a33368c.entry.js → p-1aead6d3.entry.js} +1 -1
- package/dist/twilight/{p-f0234135.entry.js → p-1f6ead7d.entry.js} +1 -1
- package/dist/twilight/{p-05b3f2ba.entry.js → p-215ed586.entry.js} +1 -1
- package/dist/twilight/{p-a3b90d18.entry.js → p-22b1bd15.entry.js} +1 -1
- package/dist/twilight/{p-e53c695d.entry.js → p-233b89ad.entry.js} +1 -1
- package/dist/twilight/{p-cf4c8fc8.entry.js → p-2405c0f7.entry.js} +1 -1
- package/dist/twilight/{p-3f99644a.entry.js → p-2c787ba0.entry.js} +1 -1
- package/dist/twilight/{p-ca43a3b7.entry.js → p-2dd98664.entry.js} +1 -1
- package/dist/twilight/{p-281ca90e.entry.js → p-3c09b198.entry.js} +1 -1
- package/dist/twilight/{p-f959adcd.entry.js → p-3c418ff7.entry.js} +1 -1
- package/dist/twilight/{p-a916b222.entry.js → p-3c6f9112.entry.js} +1 -1
- package/dist/twilight/{p-4b508998.entry.js → p-3f8b06b3.entry.js} +1 -1
- package/dist/twilight/{p-ec61d027.entry.js → p-40ec7a33.entry.js} +1 -1
- package/dist/twilight/{p-3e62ea6f.entry.js → p-4d35a32b.entry.js} +1 -1
- package/dist/twilight/{p-794141e7.entry.js → p-50f5e38d.entry.js} +1 -1
- package/dist/twilight/{p-1df500d5.entry.js → p-5485978c.entry.js} +1 -1
- package/dist/twilight/{p-eb1ee098.entry.js → p-585a349f.entry.js} +1 -1
- package/dist/twilight/{p-d4135be2.entry.js → p-58f562df.entry.js} +1 -1
- package/dist/twilight/{p-1db6e42a.entry.js → p-594d219c.entry.js} +1 -1
- package/dist/twilight/{p-D94qS2bu.js → p-5mQqqwMU.js} +1 -1
- package/dist/twilight/{p-f1865223.entry.js → p-64ac4c0c.entry.js} +1 -1
- package/dist/twilight/{p-28fa2261.entry.js → p-6aecc925.entry.js} +1 -1
- package/dist/twilight/{p-bac8dfc6.entry.js → p-6b6e2a52.entry.js} +1 -1
- package/dist/twilight/{p-5b221eda.entry.js → p-6daa8bd8.entry.js} +1 -1
- package/dist/twilight/{p-5ca44db4.entry.js → p-6dbcd99e.entry.js} +1 -1
- package/dist/twilight/{p-34690dc4.entry.js → p-6f09b53e.entry.js} +1 -1
- package/dist/twilight/{p-a12e53fb.entry.js → p-721bb258.entry.js} +1 -1
- package/dist/twilight/{p-43bed278.entry.js → p-75ab49a3.entry.js} +1 -1
- package/dist/twilight/{p-22b8f56b.entry.js → p-7bfb9d71.entry.js} +1 -1
- package/dist/twilight/{p-0f9b63f1.entry.js → p-7c8c6c47.entry.js} +1 -1
- package/dist/twilight/{p-50b01475.entry.js → p-8c2b148a.entry.js} +1 -1
- package/dist/twilight/{p-2a8e49ca.entry.js → p-907b40cd.entry.js} +1 -1
- package/dist/twilight/{p-7e971fde.entry.js → p-90eea1a9.entry.js} +1 -1
- package/dist/twilight/{p-ac4d4de4.entry.js → p-95db0124.entry.js} +1 -1
- package/dist/twilight/{p-31e390fc.entry.js → p-965fe2b3.entry.js} +1 -1
- package/dist/twilight/{p-3504a127.entry.js → p-9797a552.entry.js} +1 -1
- package/dist/twilight/{p-27198dfa.entry.js → p-9d937a82.entry.js} +1 -1
- package/dist/twilight/{p-BpwFfwom.js → p-BGB1zYFQ.js} +1 -1
- package/dist/twilight/{p-CMeOfINj.js → p-BLbGjdAU.js} +1 -1
- package/dist/twilight/{p-DcD0Zbyk.js → p-CV1rqKQz.js} +1 -1
- package/dist/twilight/{p-DI8hZjwW.js → p-CofhuO2Z.js} +1 -1
- package/dist/twilight/{p-DaQtMKKH.js → p-CvLPGpFQ.js} +1 -1
- package/dist/twilight/{p-CfS_Im-l.js → p-D5AsuzfF.js} +1 -1
- package/dist/twilight/{p-r4UR1cQJ.js → p-DbzHZVd1.js} +1 -1
- package/dist/twilight/p-a08f5eae.entry.js +4 -0
- package/dist/twilight/{p-5463603e.entry.js → p-a0a6a255.entry.js} +1 -1
- package/dist/twilight/{p-48b8702d.entry.js → p-a386b02a.entry.js} +1 -1
- package/dist/twilight/{p-62eecdc3.entry.js → p-a5df57f9.entry.js} +1 -1
- package/dist/twilight/{p-3fbb37fc.entry.js → p-ac7f094e.entry.js} +1 -1
- package/dist/twilight/{p-14d02ff1.entry.js → p-af3d4d0d.entry.js} +1 -1
- package/dist/twilight/{p-7472ce60.entry.js → p-bb0585cc.entry.js} +1 -1
- package/dist/twilight/{p-9a2691e8.entry.js → p-c0ab0fc6.entry.js} +1 -1
- package/dist/twilight/{p-4fcd9105.entry.js → p-c3f515ae.entry.js} +1 -1
- package/dist/twilight/{p-ea2ebd0c.entry.js → p-c7719ce9.entry.js} +1 -1
- package/dist/twilight/{p-38fb50ed.entry.js → p-c90a6440.entry.js} +1 -1
- package/dist/twilight/{p-eb21f677.entry.js → p-cf64bb24.entry.js} +1 -1
- package/dist/twilight/{p-0f733d50.entry.js → p-d64027b9.entry.js} +1 -1
- package/dist/twilight/{p-4afcc4e1.entry.js → p-db4f5b38.entry.js} +1 -1
- package/dist/twilight/p-de42ef8c.entry.js +4 -0
- package/dist/twilight/{p-cad7741c.entry.js → p-dfc75ce2.entry.js} +1 -1
- package/dist/twilight/{p-84920a03.entry.js → p-e0ce2c0d.entry.js} +1 -1
- package/dist/twilight/{p-bd15fbda.entry.js → p-e0e61f73.entry.js} +1 -1
- package/dist/twilight/{p-cacb3ce1.entry.js → p-e1bf6d23.entry.js} +1 -1
- package/dist/twilight/{p-3bd66c8c.entry.js → p-e2c6ed54.entry.js} +1 -1
- package/dist/twilight/{p-2e1418d2.entry.js → p-f1156ab8.entry.js} +1 -1
- package/dist/twilight/{p-d9e1559a.entry.js → p-f1be81ba.entry.js} +1 -1
- package/dist/twilight/{p-C6smOZtR.js → p-f2v0udIe.js} +1 -1
- package/dist/twilight/{p-049e7629.entry.js → p-f8fb3130.entry.js} +1 -1
- package/dist/twilight/{p-62ab3466.entry.js → p-f9fcf183.entry.js} +1 -1
- package/dist/twilight/{p-5286e950.entry.js → p-fc6ddedc.entry.js} +1 -1
- package/dist/twilight/{p-Ctf313G7.js → p-tacIS_Xg.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-offer/interfaces.d.ts +9 -7
- package/dist/types/components/salla-offer/salla-offer.d.ts +35 -36
- package/dist/types/components/salla-product-card/salla-product-card.d.ts +4 -0
- package/dist/types/components/salla-products-list/salla-products-list.d.ts +4 -0
- package/dist/types/components.d.ts +18 -2
- package/package.json +5 -5
- package/dist/twilight/p-f94c1c9a.entry.js +0 -4
- package/dist/twilight/p-fbc08feb.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t}from"./p-DcD0Zbyk.js";import{a as i}from"./p-CgtvEd63.js";import{a as e}from"./p-BedNk7k1.js";import{C as a}from"./p-BsLF_HK7.js";var l='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>gift-sharing</title>\n<path d="M5 32h-4c-0.552 0-1-0.448-1-1v0-14c0-0.552 0.448-1 1-1v0h4c0.552 0 1 0.448 1 1v0 14c0 0.552-0.448 1-1 1v0zM2 30h2v-12h-2zM19.32 30h-14.32v-2h14.32c0.693-0.005 1.329-0.242 1.837-0.637l-0.007 0.005 8.45-6.568c0.216-0.16 0.365-0.402 0.399-0.679l0-0.005c0.005-0.036 0.007-0.077 0.007-0.119 0-0.226-0.078-0.434-0.209-0.599l0.002 0.002c-0.16-0.216-0.401-0.364-0.677-0.399l-0.005-0.001c-0.034-0.004-0.073-0.007-0.113-0.007-0.227 0-0.436 0.078-0.601 0.208l0.002-0.002-7.126 5.526c-1.003 0.793-2.285 1.273-3.68 1.274h-6.6v-2h6.6c0.926-0.001 1.777-0.32 2.45-0.852l-0.008 0.006 7.126-5.526c0.492-0.39 1.122-0.625 1.807-0.625 0.135 0 0.268 0.009 0.398 0.027l-0.015-0.002c0.824 0.102 1.534 0.524 2.011 1.137l0.005 0.007c0.39 0.494 0.625 1.127 0.625 1.814 0 0.136-0.009 0.27-0.027 0.402l0.002-0.015c-0.106 0.819-0.529 1.523-1.141 1.995l-0.007 0.005-8.458 6.578c-0.834 0.649-1.894 1.043-3.047 1.050h-0.002zM11 26c-0.552 0-1-0.448-1-1s0.448-1 1-1v0c2.406-0.004 4.415-1.703 4.894-3.967l0.006-0.033h-10.9c-0.552 0-1-0.448-1-1s0.448-1 1-1v0h12c0.552 0 1 0.448 1 1v0c0 3.866-3.134 7-7 7v0zM24 12h-16c-1.105 0-2-0.895-2-2v0-2c0-1.105 0.895-2 2-2v0h16c1.105 0 2 0.895 2 2v0 2c0 1.105-0.895 2-2 2v0zM24 10v0zM8 8v2h16v-2zM23 18c-0.552 0-1-0.448-1-1v0-6c0-0.552 0.448-1 1-1s1 0.448 1 1v0 6c0 0.552-0.448 1-1 1v0zM9 16c-0.552 0-1-0.448-1-1v0-4c0-0.552 0.448-1 1-1s1 0.448 1 1v0 4c0 0.552-0.448 1-1 1v0zM16 16c-0.552 0-1-0.448-1-1v0-8c0-0.552 0.448-1 1-1s1 0.448 1 1v0 8c0 0.552-0.448 1-1 1v0zM16 8c-0.552-0-1-0.448-1-1 0-0.077 0.009-0.151 0.025-0.223l-0.001 0.007c0.314-1.849 0.963-3.5 1.887-4.961l-0.033 0.055c0.539-0.521 1.274-0.842 2.084-0.842 1.657 0 3 1.343 3 3 0 0.81-0.321 1.545-0.843 2.085l0.001-0.001c-1.405 0.891-3.056 1.541-4.824 1.845l-0.080 0.011c-0.065 0.015-0.139 0.024-0.216 0.024h-0zM19 3c-0.001 0-0.001 0-0.002 0-0.276 0-0.525 0.112-0.706 0.292l0-0c-0.391 0.669-0.703 1.444-0.897 2.264l-0.011 0.058c0.878-0.205 1.653-0.517 2.363-0.93l-0.041 0.022c0.18-0.181 0.292-0.43 0.292-0.706 0-0.551-0.446-0.999-0.998-1h-0zM16 8c-0.077-0-0.151-0.009-0.223-0.025l0.007 0.001c-1.848-0.315-3.499-0.965-4.959-1.888l0.055 0.032c-0.521-0.539-0.842-1.274-0.842-2.084 0-1.657 1.343-3 3-3 0.81 0 1.545 0.321 2.085 0.843l-0.001-0.001c0.891 1.405 1.541 3.056 1.845 4.824l0.011 0.080c0.015 0.066 0.024 0.141 0.024 0.218 0 0.552-0.448 1-1 1-0.001 0-0.001 0-0.002 0h0zM13 3c-0.001 0-0.001 0-0.002 0-0.552 0-1 0.448-1 1 0 0.277 0.112 0.527 0.294 0.708l0 0c0.669 0.391 1.444 0.703 2.264 0.897l0.058 0.011c-0.205-0.878-0.517-1.653-0.93-2.363l0.022 0.041c-0.181-0.181-0.43-0.293-0.706-0.294h-0z"></path>\n</svg>\n';const o=class{constructor(t){s(this,t),this.defaultEvent="gifting:open",this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.currentStep=1,this.showCalendar=!1,this.showGiftText=!1,this.currentLang="",this.parentClass="is-current-step-1",this.errors={},this.gift=void 0,this.selectedGiftTextOption=void 0,this.selectedCountryId=void 0,this.selectedCountryCode=void 0,this.loadingCities=!1,this.showTextArea=!1,this.selectedImage=void 0,this.uploadedImage=void 0,this.selectedText=void 0,this.hasError=!1,this.timeZone=null,this.hostId=`salla-gifting-${Math.random().toString(36).slice(2,10)}`,this.formSelector="form.product-form, form.form--product-options",salla.lang.onLoaded((()=>{this.selectImageOrUpload=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.sectionTitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love"),this.sectionSubtitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love_message"),this.sectionBtnText=salla.lang.get("blocks.buy_as_gift.send_as_a_gift"),this.giftDetails=salla.lang.get("blocks.buy_as_gift.gift_details"),this.selectGiftMessage=salla.lang.get("blocks.buy_as_gift.select_gift_message"),this.giftCustomText=salla.lang.get("blocks.buy_as_gift.gift_custom_text"),this.textId=salla.lang.get("blocks.buy_as_gift.text_id"),this.incorrectGiftText=salla.lang.get("blocks.buy_as_gift.incorrect_gift_text"),this.nextStep=salla.lang.get("blocks.buy_as_gift.next_step"),this.senderNameLabel=salla.lang.get("blocks.buy_as_gift.sender_name"),this.receiverNameFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_name"),this.receiverMobileFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_mobile"),this.receiverCountryFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_country"),this.ksa=salla.lang.get("pages.checkout.ksa"),this.selectCity=salla.lang.get("pages.checkout.select_city"),this.selectCountry=salla.lang.get("pages.checkout.select_country"),this.selectCityInfo=salla.lang.get("blocks.buy_as_gift.city_info"),this.receiverCityFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_city"),this.receiverEmailFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_email"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.sendLater=salla.lang.get("blocks.buy_as_gift.send_later"),this.selectSendDateAndTime=salla.lang.get("blocks.buy_as_gift.select_send_date_and_time"),this.canNotEditOrderAfterSelectDate=salla.lang.get("blocks.buy_as_gift.can_not_edit_order_after_select_date"),this.sendGift=salla.lang.get("blocks.buy_as_gift.send_gift"),this.donationRequired=salla.lang.get("pages.products.donation_amount_required"),this.currentLang=salla.lang.locale})),salla.event.on(this.defaultEvent,(()=>{this.open()}))}componentDidLoad(){salla.event.product.onPriceUpdated((()=>{const s=document.querySelector(".s-quantity-input-input");this.quantity=s?.value}))}getFormDataFromForm(){if(!this.formSelector)return null;const s=document.querySelector(this.formSelector);return s?new FormData(s):null}mergeObjectToFormData(s,t,i){for(let e in s){if(!s.hasOwnProperty(e)||null==s[e])continue;const a=i?`${i}[${e}]`:e;"object"!=typeof s[e]||null===s[e]||s[e]instanceof File?t.set(a,s[e]):this.mergeObjectToFormData(s[e],t,a)}return t}async open(){if(salla.config.isGuest())return salla.api.auth.setAfterLoginEvent(this.defaultEvent),void salla.event.dispatch("login::open",{withoutReload:!0});await this.modal.open();const s=this.productId?()=>salla.product.getGiftProductDetails(this.productId):()=>salla.cart.getGiftCartDetails();return await salla.api.withoutNotifier(s).then((s=>{this.gift=s.data,this.senderName=this.gift.sender_name})).catch((s=>{this.hasError=!0,this.errorMessage=s.response?.data?.error?.message||s.response?.data})).finally((()=>this.modal.stopLoading()))}async close(){return this.modal.close()}async setWrapperHeight(s=1,t=250,i=0,e=0){let a=document.querySelector(`#${this.hostId} .gift-step-${s}`);setTimeout((()=>{this.stepsWrapper.style.height=e?`${e}px`:a.offsetHeight+i+"px"}),t)}toggleCalendar(){this.showCalendar=!this.showCalendar,this.setWrapperHeight(2,150,0)}toggleGiftText(s){this.textSelect?.classList.remove("s-form-has-error");let t=s.target.children[s.target.selectedIndex].getAttribute("data-id"),i="custom"==t;this.showGiftText=i,t?(this.selectedGiftTextOption=t,this.selectedText=i?void 0:s.target.value,this.setWrapperHeight(1,150,5)):(this.textArea.value="",this.selectedText=void 0,this.selectedGiftTextOption=void 0,this.setWrapperHeight(1,150,-15))}async goToStep2(){return this.selectedGiftTextOption?"custom"!=this.selectedGiftTextOption||this.selectedText?(this.textSelect.classList.remove("s-form-has-error"),this.customTextArea.classList.remove("s-form-has-error"),this.setWrapperHeight(2,600,0),(new i.timeline).add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,50],delay:i.stagger(70),duration:1200}).add({targets:".gift-step-2",translateX:["-110%",0],opacity:[0,1]},"-=1800").add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[-50,0],delay:i.stagger(70),duration:1200,complete:()=>{this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((s=>{s.classList.remove("opacity-0"),s.removeAttribute("style")}))}},"-=1200"),this.currentStep=2,void(this.parentClass=`is-current-step-${this.currentStep}`)):(this.textSelect.classList.remove("s-form-has-error"),void this.customTextArea.classList.add("s-form-has-error")):(this.textSelect.classList.add("s-form-has-error"),void this.customTextArea.classList.remove("s-form-has-error"))}goToStep1(s){s.preventDefault();let t=new i.timeline({autoplay:!1});t.add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,-50],delay:i.stagger(70),duration:1200}).add({targets:".gift-step-1",translateX:["110%",0],opacity:[0,1]},"-=1800").add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[50,0],delay:i.stagger(70),duration:1200,complete:()=>{this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((s=>{s.classList.remove("opacity-0"),s.removeAttribute("style")}))}},"-=1200"),t.play(),this.setWrapperHeight(1,600,0),this.currentStep=1,this.parentClass=`is-current-step-${this.currentStep}`}getFilepondPlaceholder(){return`<div class="s-gifting-filepond-placeholder"><span class="s-gifting-filepond-placeholder-icon"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>images</title>\n<path d="M22.667 29.333h-13.333c-3.676 0-6.667-2.991-6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v13.333c0 5.145 4.187 9.333 9.333 9.333h13.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM22.667 5.333c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 10.667c-0.735 0-1.333-0.597-1.333-1.333s0.599-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.599 1.333-1.333 1.333zM25.333 0h-13.333c-3.676 0-6.667 2.991-6.667 6.667v13.333c0 1.055 0.268 2.040 0.707 2.927 0.039 0.099 0.088 0.188 0.151 0.277 1.137 2.053 3.301 3.463 5.809 3.463h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-3.676-2.991-6.667-6.667-6.667zM12 24c-1.244 0-2.344-0.583-3.077-1.476l5.721-7.047 6.629 8.523zM29.333 20c0 2.205-1.795 4-4 4h-0.68l-8.933-11.485c-0.251-0.32-0.633-0.511-1.039-0.515h-0.015c-0.401 0-0.781 0.181-1.035 0.492l-5.632 6.935v-12.76c0-2.205 1.795-4 4-4h13.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n</span><p class="s-gifting-filepond-placeholder-text">${this.selectImageOrUpload?this.selectImageOrUpload:""}</p></div>`}setPreview(s){this.uploader?.classList.add("has-bg");var t=document.querySelector(`#${this.hostId}.filepond-bg`)?document.querySelector(`#${this.hostId} .filepond-bg`):document.createElement("div");t.classList.add("filepond-bg"),t.classList.remove("s-hidden"),t.style.backgroundImage="url('"+s.url+"')",this.uploader?.querySelector(".filepond--root")?.appendChild(t),this.uploadedImage=s.url,this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}removePreview(){this.uploader.classList.remove("has-bg");let s=document.querySelector(`#${this.hostId} .filepond-bg`);s.removeAttribute("style"),s.classList.add("s-hidden"),this.handleRemoveImage()}handleTextAreaChange(s){this.selectedText=s.target.value,this.customTextArea.classList.remove("s-form-has-error")}handleSenderName(s){this.senderName=s.target.value}handleReceiverName(s){this.receiverName=s.target.value}handleReceiverCity(s){this.receiverCity=s.target.value}async handleCountryChange(s){const t=s.target.value;this.selectedCountryId=t;const i=this.gift?.countries?.find((s=>s.id==t));if(this.selectedCountryCode=i?.country_code,!t||0===this.gift?.countries?.length)return this.gift={...this.gift,cities:[]},this.receiverCity=void 0,void(this.selectedCountryCode=void 0);this.loadingCities=!0,this.gift={...this.gift,cities:[]},this.receiverCity=void 0;try{const s=await salla.api.request(`shipping/cities?for_branch=0&country_id=${t}`);s&&s.data&&(this.gift={...this.gift,cities:s.data})}catch(s){console.error("Error fetching cities:",s)}finally{this.loadingCities=!1}}handleUploadImage(s){this.uploadedImage=s,this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}handleRemoveImage(){this.uploadedImage="",this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}handlePhoneInputChange(s){let t=s.detail;this.receiverMobile=t.number,this.receiverCountryCode=t.country_code}handleDateTimePicker(s){this.deliveryDate=s.detail}getCalendarClasses(){return{"s-form-group":!0,"anime-item":!0,"s-gifting-calendar":!0,shown:this.showCalendar,hide:!this.showCalendar,"s-form-has-error":!!this.errors&&this.errors.deliver_at}}async submitForm(){const s=document.querySelector("#donating-amount")?.value;if(this.calendarFormGroup.classList.remove("s-form-has-error"),this.errors&&(this.errors={},this.setWrapperHeight(2,150,0)),this.showCalendar&&!this.deliveryDate)return void this.calendarFormGroup.classList.add("s-form-has-error");if(this.physicalProducts&&!this.selectedCountryId)return this.errors||(this.errors={}),this.errors["receiver.country"]=salla.lang.get("common.messages.required_field"),void this.setWrapperHeight(2,150,0);const t={text:this.selectedText,sender_name:this.senderName,quantity:this.quantity,deliver_at:this.showCalendar?this.deliveryDate:null,image_url:this.uploadedImage??this.selectedImage,donation_amount:s||null,receiver:{name:this.receiverName,country_code:this.selectedCountryCode&&this.physicalProducts?this.selectedCountryCode:this.receiverCountryCode,mobile:this.receiverMobile,...this.receiverCity&&this.physicalProducts?{city_id:this.receiverCity}:{}},has_apple_pay:salla.helpers.hasApplePay()};let i;this.productId&&this.formSelector&&(i=this.getFormDataFromForm()||new FormData,i=this.mergeObjectToFormData(t,i));const e=this.productId?()=>salla.product.addProductGiftToCart(this.productId,i,!0):()=>salla.cart.addCartGiftToCart(t,!0);return await e().then((()=>this.modal.close())).catch((s=>{s.response&&422==s.response.status?this.errors=s.response.data.error.fields:console.log(s),this.setWrapperHeight(2,150,0)}))}generateClass(){return{"s-gifting-widget":!0,"s-gifting-widget-vertical":!!this.vertical,"s-gifting-widget-horizontal":!this.vertical}}async handleGiftButtonClick(){if(this.productId&&this.formSelector){const s=document.querySelector(this.formSelector);if(!s)return void console.error("SallaGifting:: Form not found in the document!");if(!(s instanceof HTMLFormElement))return void console.error("SallaGifting:: The specified selector does not correspond to a form tag!");if(!s.reportValidity())return console.error("SallaGifting:: Form is not valid!"),void salla.error(salla.lang.get("common.messages.required_fields"))}const s=document.querySelector(`salla-product-options[product-id="${this.productId}"]`);!s||await s.reportValidity()?this.open():salla.error(salla.lang.get("common.messages.required_fields"))}render(){return[t("div",{key:"69f449221a2abf8e4d9264b46ab023eb7baca314"},t("salla-list-tile",{key:"0072bab6171c9b11e54f0c6655c408b12d554e24",class:this.generateClass()},t("div",{key:"38aa5f8decf6d9c97253c3c16b80a478d623985e",slot:"title"},this.vertical?t("span",{innerHTML:l}):"",t("h3",{key:"37fddbe7a80f38b3acca42220028208cab52ba15"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),t("div",{key:"b3bf6bff40b60a3fbace637ed69f6aa72853c04b",slot:"subtitle"},t("div",{key:"46643b7cd897524ca42c41da24e657401f85ab28"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),t("div",{key:"5129acfd67425ccfad68b3770843f11c9fa55b18",slot:"action"},t("salla-button",{key:"0e93efc647444a26198e4631614b8590f75f122e",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},t("slot",{key:"b88d95a25308cebc29b796bb2b0c25e4fa230406",name:"widget-btn-content"},t("div",{key:"4cdbaaeb2bc67f056ea348755ffbdfbc831a1a5b",class:"s-gifting-widget-action-content"},t("span",{key:"7dfec389970416df9be46c8ae5f0904dd64e17ad",innerHTML:l})," ",t("span",{key:"768f3621011bc3c984dce13ce83b3fb6cceb0171"},this.sectionBtnText)))))),t("salla-modal",{key:"b3c94ef80f955b42baecd963f5550f17a80c6fb4",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:s=>this.modal=s},t("div",{key:"c09e12eabff63ba1a781c8980b449f854affc164",slot:"loading"},t("div",{key:"dbafa39345c573eae0d045a7d23e346f7068ec0b",class:"s-gifting-skeleton"},t("div",{key:"ff247ea5c79b87ca1c76e6035813d7ecb2caeff2",class:"s-gifting-modal-header"},t("salla-skeleton",{key:"1e67bea2f1f957744c4f6f0af83ded347799916e",type:"circle",height:"5rem",width:"5rem"}),t("h2",{key:"6486434a702624358211c22e7a6b48be16d96c42",class:"s-gifting-modal-title"},t("div",{key:"688854d37e5ca46fcaa7957d3e72a52d7c706f8d",class:"s-gifting-modal-badge-wrapper"},t("salla-skeleton",{key:"9fcbb2086aa25b02effdc873bbfd45087e673de6",height:"15px",width:"150px"})))),t("div",{key:"1b9bf709a01b20e87d68f92f3cb93600214460cd",class:"s-gifting-skeleton-content"},t("salla-skeleton",{key:"ba6b0c87442412398c360da1f6e8b5094812900f",height:"10px",width:"150px"}),t("salla-skeleton",{key:"6583783ace4e2668705c47c4bcac2a33b346a72b",height:"230px"}),t("salla-skeleton",{key:"c76b038f100072d56a7cedd0438eeacc98bf7b42",height:"10px",width:"150px"}),t("salla-skeleton",{key:"1d331e7be7cd88ea5c108f331626dddc74699ed2",height:"30px"}),t("salla-skeleton",{key:"5cc3d1b8d67b7bf199219099af909591b8a8a869",height:"40px"})))),t("slot",{key:"9dc4c6f3a717e16e3527f9651b05a74ca1a6212c",name:"header"}),this.hasError?t("salla-placeholder",{alignment:"center"},t("span",{slot:"title"},this.errorMessage||salla.lang.get("common.errors.empty_results")),t("span",{slot:"description"}," ")):[t("div",{class:"s-gifting-modal-header"},t("span",{class:"s-gifting-modal-icon"},t("span",{innerHTML:l})),t("h2",{class:"s-gifting-modal-title"},t("div",{class:"s-gifting-modal-badge-wrapper"},t("div",{class:"s-gifting-modal-badge"},t("span",null,t("span",null,this.currentStep),"/2")),t("span",null,this.giftDetails)))),t("div",{class:"s-gifting-steps-wrapper "+this.parentClass,ref:s=>this.stepsWrapper=s},t("div",{class:"s-gifting-step-one gift-step-1",ref:s=>this.step1Elems=s},t("div",{class:"s-gifting-modal-uploader-title anime-item"},this.selectImageForYourGift),t("div",{class:"s-gifting-modal-uploader anime-item",ref:s=>this.uploader=s},t("span",{class:"s-gifting-remove-preview",onClick:()=>this.removePreview(),innerHTML:a}),this.selectImageOrUpload&&t("salla-file-upload",{"instant-upload":!0,name:"image_url",url:salla.url.api(salla.product.api.getUrl("giftImage")),onUploaded:s=>this.handleUploadImage(s.detail),labelIdle:this.getFilepondPlaceholder(),onRemoved:()=>this.handleRemoveImage()})),t("div",{class:"anime-item"},!this.uploadedImage&&this.gift&&this.gift.gift_images&&this.gift.gift_images.length>0?t("salla-slider",{id:"gifting-slider",loop:!1,"controls-outer":!0,class:"s-gifting-slider",type:"carousel"},t("div",{slot:"items"},this.gift&&this.gift.gift_images?this.gift?.gift_images.map((s=>t("a",{class:"s-gifting-clickable s-gifting-image",onClick:()=>this.setPreview(s)},t("img",{style:{width:"120px"},src:s.url,alt:`${s.id}`})))):"")):""),t("div",{class:"anime-item"},t("div",{class:"s-form-group s-gifting-selectText",ref:s=>this.textSelect=s},t("select",{id:"gift-text-selection",name:"gift-text-selection",class:"s-form-control s-gifting-select",onChange:s=>this.toggleGiftText(s)},t("option",{"data-id":null,selected:!0},this.selectGiftMessage),this.gift&&this.gift.gift_texts?this.gift?.gift_texts.map((s=>t("option",{"data-id":s.id,value:s.text,key:s.id},s.text))):"",t("option",{"data-id":"custom"},this.giftCustomText))),t("div",{class:this.showGiftText?"s-form-group s-gifting-textarea shown":"s-form-group s-gifting-textarea hide",ref:s=>this.customTextArea=s},t("label",{htmlFor:"gift-custom-text",class:"s-form-label"},this.giftCustomText),t("div",{class:"mt-1"},t("textarea",{onInput:s=>this.handleTextAreaChange(s),rows:4,ref:s=>this.textArea=s,name:"gift-custom-text",id:"gift-custom-text",class:"s-form-control"})))),t("div",{class:"anime-item"},t("salla-button",{color:"primary",width:"wide",onClick:()=>this.goToStep2()},t("span",null,this.nextStep)))),t("div",{class:"s-gifting-step-two gift-step-2",ref:s=>this.step2Elems=s},t("div",{class:this.errors&&this.errors.sender_name?"s-form-group s-form-has-error anime-item opacity-0":"s-form-group anime-item opacity-0"},t("label",{htmlFor:"sender_name",class:"s-form-label"},this.senderNameLabel),t("input",{type:"text",class:"s-form-control",name:"sender_name",id:"sender_name",value:this.senderName,onInput:s=>this.handleSenderName(s),placeholder:""}),this.errors&&this.errors.sender_name?t("span",{class:"s-gifting-error"},this.errors.sender_name):""),t("div",{class:this.errors&&this.errors["receiver.name"]?"s-form-group s-form-has-error anime-item opacity-0":"s-form-group anime-item opacity-0"},t("label",{htmlFor:"receiver_name",class:"s-form-label"},this.receiverNameFieldLabel),t("input",{type:"text",class:"s-form-control",name:"receiver_name",id:"receiver_name",value:"",onInput:s=>this.handleReceiverName(s),placeholder:""}),this.errors&&this.errors["receiver.name"]?t("span",{class:"s-gifting-error"},this.errors["receiver.name"]):""),t("div",{class:this.errors&&this.errors["receiver.mobile"]?"s-form-group s-form-has-error anime-item opacity-0":"s-form-group anime-item opacity-0"},t("label",{class:"s-form-label"},this.receiverMobileFieldLabel),t("salla-tel-input",{class:"s-gifting-tel-input",phone:this.receiverMobile,countryCode:this.selectedCountryCode||this.receiverCountryCode,key:`tel-input-${this.selectedCountryCode||this.receiverCountryCode||"default"}`,onPhoneEntered:s=>this.handlePhoneInputChange(s)}),this.errors&&this.errors["receiver.mobile"]?t("span",{class:"s-gifting-error"},this.errors["receiver.mobile"]):""),this.physicalProducts&&t("div",null,t("div",{class:this.errors&&this.errors["receiver.country"]?"s-form-group s-form-has-error anime-item opacity-0":"s-form-group anime-item opacity-0"},t("label",{class:"s-form-label"},this.receiverCountryFieldLabel),t("select",{name:"country",class:"s-form-control",onChange:s=>this.handleCountryChange(s),required:!0},t("option",{value:""},this.selectCountry),this.gift?.countries?.map((s=>t("option",{value:s.id},s.name)))),this.errors&&this.errors["receiver.country"]?t("span",{class:"s-gifting-error"},this.errors["receiver.country"]):""),t("div",{class:this.errors&&this.errors["receiver.city_id"]?"s-form-group s-form-has-error anime-item opacity-0":"s-form-group anime-item opacity-0"},t("label",{class:"s-form-label"},this.receiverCityFieldLabel),t("select",{name:"city","aria-label":salla.lang.get("blocks.buy_as_gift.select_city"),class:"s-form-control",onChange:s=>this.handleReceiverCity(s),disabled:this.loadingCities},t("option",{value:"",selected:!0},this.loadingCities?salla.lang.get("common.elements.loading"):this.selectCity),this.gift?.cities?.map((s=>t("option",{value:s.id},s.name)))),this.errors&&this.errors["receiver.city_id"]?t("span",{class:"s-gifting-error"},this.errors["receiver.city_id"]):""),t("div",{class:"s-gifting-info anime-item opacity-0"},t("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert</title>\n<path d="M16 13.333c-0.736 0-1.333 0.597-1.333 1.333v8c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-8c0-0.736-0.597-1.333-1.333-1.333zM16 9.327c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM27.313 4.687c-6.237-6.237-16.389-6.239-22.628 0-6.237 6.239-6.237 16.389 0 22.628 3.119 3.119 7.216 4.679 11.313 4.679s8.195-1.559 11.313-4.679c6.24-6.239 6.24-16.391 0.001-22.628zM25.428 25.428c-5.199 5.197-13.657 5.197-18.857 0-5.197-5.199-5.197-13.659 0-18.857 5.199-5.197 13.659-5.197 18.857 0 5.199 5.2 5.199 13.659 0 18.857z"></path>\n</svg>\n'}),t("span",null,this.selectCityInfo))),!this.physicalProducts&&t("div",{class:"anime-item opacity-0"},t("label",{class:"s-gifting-schedule s-gifting-clickable",htmlFor:`schedule-${this.hostId}`},t("input",{type:"checkbox",name:"schedule",id:`schedule-${this.hostId}`,onChange:()=>this.toggleCalendar(),class:"s-checkbox"}),t("span",{class:"s-form-label"}," ",this.sendLater," "))),t("div",{class:this.getCalendarClasses(),ref:s=>this.calendarFormGroup=s},t("label",{class:"s-form-label"},this.selectSendDateAndTime),t("salla-datetime-picker",{value:this.deliveryDate,placeholder:this.selectSendDateAndTime,"enable-time":!0,"date-format":"Y-m-d h:i K",onPicked:s=>this.handleDateTimePicker(s)}),t("span",{class:"s-gifting-calendar-hint"},this.canNotEditOrderAfterSelectDate)),t("div",{class:"s-gifting-step-two-footer anime-item opacity-0"},t("a",{href:"#!",innerHTML:e,onClick:s=>this.goToStep1(s)}),t("salla-button",{onClick:()=>this.submitForm(),color:"primary",width:"wide"},t("span",null,this.sendGift)))))],t("slot",{key:"2ca6746edd5e72c996633b6d0b3ccdc5009198c4",name:"footer"})))]}};o.style=".s-gifting-steps-wrapper{transition:0.2s cubic-bezier(0.55, 0, 0.1, 1) 0s}.s-gifting-select{background-image:url(\"data:image/svg+xml;utf8,<svg version='1.1' fill='gray' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><title>keyboard_arrow_down</title><path d='M9.875 11.104l6.125 6.125 6.125-6.125 1.875 1.875-8 8-8-8z'></path></svg>\");background-size:24px;background-repeat:no-repeat;background-position:99%;appearance:none}[dir=rtl] .s-gifting-select{background-position:5px}.s-gifting-widget-vertical .s-list-tile-item [slot=title]{display:flex;align-items:center;gap:1.5rem}.s-gifting-widget-vertical .s-list-tile-item-content{width:100%}";export{o as salla_gifting}
|
|
4
|
+
import{r as s,h as t}from"./p-CV1rqKQz.js";import{a as i}from"./p-CgtvEd63.js";import{a as e}from"./p-BedNk7k1.js";import{C as a}from"./p-BsLF_HK7.js";var l='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>gift-sharing</title>\n<path d="M5 32h-4c-0.552 0-1-0.448-1-1v0-14c0-0.552 0.448-1 1-1v0h4c0.552 0 1 0.448 1 1v0 14c0 0.552-0.448 1-1 1v0zM2 30h2v-12h-2zM19.32 30h-14.32v-2h14.32c0.693-0.005 1.329-0.242 1.837-0.637l-0.007 0.005 8.45-6.568c0.216-0.16 0.365-0.402 0.399-0.679l0-0.005c0.005-0.036 0.007-0.077 0.007-0.119 0-0.226-0.078-0.434-0.209-0.599l0.002 0.002c-0.16-0.216-0.401-0.364-0.677-0.399l-0.005-0.001c-0.034-0.004-0.073-0.007-0.113-0.007-0.227 0-0.436 0.078-0.601 0.208l0.002-0.002-7.126 5.526c-1.003 0.793-2.285 1.273-3.68 1.274h-6.6v-2h6.6c0.926-0.001 1.777-0.32 2.45-0.852l-0.008 0.006 7.126-5.526c0.492-0.39 1.122-0.625 1.807-0.625 0.135 0 0.268 0.009 0.398 0.027l-0.015-0.002c0.824 0.102 1.534 0.524 2.011 1.137l0.005 0.007c0.39 0.494 0.625 1.127 0.625 1.814 0 0.136-0.009 0.27-0.027 0.402l0.002-0.015c-0.106 0.819-0.529 1.523-1.141 1.995l-0.007 0.005-8.458 6.578c-0.834 0.649-1.894 1.043-3.047 1.050h-0.002zM11 26c-0.552 0-1-0.448-1-1s0.448-1 1-1v0c2.406-0.004 4.415-1.703 4.894-3.967l0.006-0.033h-10.9c-0.552 0-1-0.448-1-1s0.448-1 1-1v0h12c0.552 0 1 0.448 1 1v0c0 3.866-3.134 7-7 7v0zM24 12h-16c-1.105 0-2-0.895-2-2v0-2c0-1.105 0.895-2 2-2v0h16c1.105 0 2 0.895 2 2v0 2c0 1.105-0.895 2-2 2v0zM24 10v0zM8 8v2h16v-2zM23 18c-0.552 0-1-0.448-1-1v0-6c0-0.552 0.448-1 1-1s1 0.448 1 1v0 6c0 0.552-0.448 1-1 1v0zM9 16c-0.552 0-1-0.448-1-1v0-4c0-0.552 0.448-1 1-1s1 0.448 1 1v0 4c0 0.552-0.448 1-1 1v0zM16 16c-0.552 0-1-0.448-1-1v0-8c0-0.552 0.448-1 1-1s1 0.448 1 1v0 8c0 0.552-0.448 1-1 1v0zM16 8c-0.552-0-1-0.448-1-1 0-0.077 0.009-0.151 0.025-0.223l-0.001 0.007c0.314-1.849 0.963-3.5 1.887-4.961l-0.033 0.055c0.539-0.521 1.274-0.842 2.084-0.842 1.657 0 3 1.343 3 3 0 0.81-0.321 1.545-0.843 2.085l0.001-0.001c-1.405 0.891-3.056 1.541-4.824 1.845l-0.080 0.011c-0.065 0.015-0.139 0.024-0.216 0.024h-0zM19 3c-0.001 0-0.001 0-0.002 0-0.276 0-0.525 0.112-0.706 0.292l0-0c-0.391 0.669-0.703 1.444-0.897 2.264l-0.011 0.058c0.878-0.205 1.653-0.517 2.363-0.93l-0.041 0.022c0.18-0.181 0.292-0.43 0.292-0.706 0-0.551-0.446-0.999-0.998-1h-0zM16 8c-0.077-0-0.151-0.009-0.223-0.025l0.007 0.001c-1.848-0.315-3.499-0.965-4.959-1.888l0.055 0.032c-0.521-0.539-0.842-1.274-0.842-2.084 0-1.657 1.343-3 3-3 0.81 0 1.545 0.321 2.085 0.843l-0.001-0.001c0.891 1.405 1.541 3.056 1.845 4.824l0.011 0.080c0.015 0.066 0.024 0.141 0.024 0.218 0 0.552-0.448 1-1 1-0.001 0-0.001 0-0.002 0h0zM13 3c-0.001 0-0.001 0-0.002 0-0.552 0-1 0.448-1 1 0 0.277 0.112 0.527 0.294 0.708l0 0c0.669 0.391 1.444 0.703 2.264 0.897l0.058 0.011c-0.205-0.878-0.517-1.653-0.93-2.363l0.022 0.041c-0.181-0.181-0.43-0.293-0.706-0.294h-0z"></path>\n</svg>\n';const o=class{constructor(t){s(this,t),this.defaultEvent="gifting:open",this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.currentStep=1,this.showCalendar=!1,this.showGiftText=!1,this.currentLang="",this.parentClass="is-current-step-1",this.errors={},this.gift=void 0,this.selectedGiftTextOption=void 0,this.selectedCountryId=void 0,this.selectedCountryCode=void 0,this.loadingCities=!1,this.showTextArea=!1,this.selectedImage=void 0,this.uploadedImage=void 0,this.selectedText=void 0,this.hasError=!1,this.timeZone=null,this.hostId=`salla-gifting-${Math.random().toString(36).slice(2,10)}`,this.formSelector="form.product-form, form.form--product-options",salla.lang.onLoaded((()=>{this.selectImageOrUpload=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.sectionTitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love"),this.sectionSubtitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love_message"),this.sectionBtnText=salla.lang.get("blocks.buy_as_gift.send_as_a_gift"),this.giftDetails=salla.lang.get("blocks.buy_as_gift.gift_details"),this.selectGiftMessage=salla.lang.get("blocks.buy_as_gift.select_gift_message"),this.giftCustomText=salla.lang.get("blocks.buy_as_gift.gift_custom_text"),this.textId=salla.lang.get("blocks.buy_as_gift.text_id"),this.incorrectGiftText=salla.lang.get("blocks.buy_as_gift.incorrect_gift_text"),this.nextStep=salla.lang.get("blocks.buy_as_gift.next_step"),this.senderNameLabel=salla.lang.get("blocks.buy_as_gift.sender_name"),this.receiverNameFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_name"),this.receiverMobileFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_mobile"),this.receiverCountryFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_country"),this.ksa=salla.lang.get("pages.checkout.ksa"),this.selectCity=salla.lang.get("pages.checkout.select_city"),this.selectCountry=salla.lang.get("pages.checkout.select_country"),this.selectCityInfo=salla.lang.get("blocks.buy_as_gift.city_info"),this.receiverCityFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_city"),this.receiverEmailFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_email"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.sendLater=salla.lang.get("blocks.buy_as_gift.send_later"),this.selectSendDateAndTime=salla.lang.get("blocks.buy_as_gift.select_send_date_and_time"),this.canNotEditOrderAfterSelectDate=salla.lang.get("blocks.buy_as_gift.can_not_edit_order_after_select_date"),this.sendGift=salla.lang.get("blocks.buy_as_gift.send_gift"),this.donationRequired=salla.lang.get("pages.products.donation_amount_required"),this.currentLang=salla.lang.locale})),salla.event.on(this.defaultEvent,(()=>{this.open()}))}componentDidLoad(){salla.event.product.onPriceUpdated((()=>{const s=document.querySelector(".s-quantity-input-input");this.quantity=s?.value}))}getFormDataFromForm(){if(!this.formSelector)return null;const s=document.querySelector(this.formSelector);return s?new FormData(s):null}mergeObjectToFormData(s,t,i){for(let e in s){if(!s.hasOwnProperty(e)||null==s[e])continue;const a=i?`${i}[${e}]`:e;"object"!=typeof s[e]||null===s[e]||s[e]instanceof File?t.set(a,s[e]):this.mergeObjectToFormData(s[e],t,a)}return t}async open(){if(salla.config.isGuest())return salla.api.auth.setAfterLoginEvent(this.defaultEvent),void salla.event.dispatch("login::open",{withoutReload:!0});await this.modal.open();const s=this.productId?()=>salla.product.getGiftProductDetails(this.productId):()=>salla.cart.getGiftCartDetails();return await salla.api.withoutNotifier(s).then((s=>{this.gift=s.data,this.senderName=this.gift.sender_name})).catch((s=>{this.hasError=!0,this.errorMessage=s.response?.data?.error?.message||s.response?.data})).finally((()=>this.modal.stopLoading()))}async close(){return this.modal.close()}async setWrapperHeight(s=1,t=250,i=0,e=0){let a=document.querySelector(`#${this.hostId} .gift-step-${s}`);setTimeout((()=>{this.stepsWrapper.style.height=e?`${e}px`:a.offsetHeight+i+"px"}),t)}toggleCalendar(){this.showCalendar=!this.showCalendar,this.setWrapperHeight(2,150,0)}toggleGiftText(s){this.textSelect?.classList.remove("s-form-has-error");let t=s.target.children[s.target.selectedIndex].getAttribute("data-id"),i="custom"==t;this.showGiftText=i,t?(this.selectedGiftTextOption=t,this.selectedText=i?void 0:s.target.value,this.setWrapperHeight(1,150,5)):(this.textArea.value="",this.selectedText=void 0,this.selectedGiftTextOption=void 0,this.setWrapperHeight(1,150,-15))}async goToStep2(){return this.selectedGiftTextOption?"custom"!=this.selectedGiftTextOption||this.selectedText?(this.textSelect.classList.remove("s-form-has-error"),this.customTextArea.classList.remove("s-form-has-error"),this.setWrapperHeight(2,600,0),(new i.timeline).add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,50],delay:i.stagger(70),duration:1200}).add({targets:".gift-step-2",translateX:["-110%",0],opacity:[0,1]},"-=1800").add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[-50,0],delay:i.stagger(70),duration:1200,complete:()=>{this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((s=>{s.classList.remove("opacity-0"),s.removeAttribute("style")}))}},"-=1200"),this.currentStep=2,void(this.parentClass=`is-current-step-${this.currentStep}`)):(this.textSelect.classList.remove("s-form-has-error"),void this.customTextArea.classList.add("s-form-has-error")):(this.textSelect.classList.add("s-form-has-error"),void this.customTextArea.classList.remove("s-form-has-error"))}goToStep1(s){s.preventDefault();let t=new i.timeline({autoplay:!1});t.add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,-50],delay:i.stagger(70),duration:1200}).add({targets:".gift-step-1",translateX:["110%",0],opacity:[0,1]},"-=1800").add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[50,0],delay:i.stagger(70),duration:1200,complete:()=>{this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((s=>{s.classList.remove("opacity-0"),s.removeAttribute("style")}))}},"-=1200"),t.play(),this.setWrapperHeight(1,600,0),this.currentStep=1,this.parentClass=`is-current-step-${this.currentStep}`}getFilepondPlaceholder(){return`<div class="s-gifting-filepond-placeholder"><span class="s-gifting-filepond-placeholder-icon"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>images</title>\n<path d="M22.667 29.333h-13.333c-3.676 0-6.667-2.991-6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v13.333c0 5.145 4.187 9.333 9.333 9.333h13.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM22.667 5.333c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 10.667c-0.735 0-1.333-0.597-1.333-1.333s0.599-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.599 1.333-1.333 1.333zM25.333 0h-13.333c-3.676 0-6.667 2.991-6.667 6.667v13.333c0 1.055 0.268 2.040 0.707 2.927 0.039 0.099 0.088 0.188 0.151 0.277 1.137 2.053 3.301 3.463 5.809 3.463h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-3.676-2.991-6.667-6.667-6.667zM12 24c-1.244 0-2.344-0.583-3.077-1.476l5.721-7.047 6.629 8.523zM29.333 20c0 2.205-1.795 4-4 4h-0.68l-8.933-11.485c-0.251-0.32-0.633-0.511-1.039-0.515h-0.015c-0.401 0-0.781 0.181-1.035 0.492l-5.632 6.935v-12.76c0-2.205 1.795-4 4-4h13.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n</span><p class="s-gifting-filepond-placeholder-text">${this.selectImageOrUpload?this.selectImageOrUpload:""}</p></div>`}setPreview(s){this.uploader?.classList.add("has-bg");var t=document.querySelector(`#${this.hostId}.filepond-bg`)?document.querySelector(`#${this.hostId} .filepond-bg`):document.createElement("div");t.classList.add("filepond-bg"),t.classList.remove("s-hidden"),t.style.backgroundImage="url('"+s.url+"')",this.uploader?.querySelector(".filepond--root")?.appendChild(t),this.uploadedImage=s.url,this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}removePreview(){this.uploader.classList.remove("has-bg");let s=document.querySelector(`#${this.hostId} .filepond-bg`);s.removeAttribute("style"),s.classList.add("s-hidden"),this.handleRemoveImage()}handleTextAreaChange(s){this.selectedText=s.target.value,this.customTextArea.classList.remove("s-form-has-error")}handleSenderName(s){this.senderName=s.target.value}handleReceiverName(s){this.receiverName=s.target.value}handleReceiverCity(s){this.receiverCity=s.target.value}async handleCountryChange(s){const t=s.target.value;this.selectedCountryId=t;const i=this.gift?.countries?.find((s=>s.id==t));if(this.selectedCountryCode=i?.country_code,!t||0===this.gift?.countries?.length)return this.gift={...this.gift,cities:[]},this.receiverCity=void 0,void(this.selectedCountryCode=void 0);this.loadingCities=!0,this.gift={...this.gift,cities:[]},this.receiverCity=void 0;try{const s=await salla.api.request(`shipping/cities?for_branch=0&country_id=${t}`);s&&s.data&&(this.gift={...this.gift,cities:s.data})}catch(s){console.error("Error fetching cities:",s)}finally{this.loadingCities=!1}}handleUploadImage(s){this.uploadedImage=s,this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}handleRemoveImage(){this.uploadedImage="",this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}handlePhoneInputChange(s){let t=s.detail;this.receiverMobile=t.number,this.receiverCountryCode=t.country_code}handleDateTimePicker(s){this.deliveryDate=s.detail}getCalendarClasses(){return{"s-form-group":!0,"anime-item":!0,"s-gifting-calendar":!0,shown:this.showCalendar,hide:!this.showCalendar,"s-form-has-error":!!this.errors&&this.errors.deliver_at}}async submitForm(){const s=document.querySelector("#donating-amount")?.value;if(this.calendarFormGroup.classList.remove("s-form-has-error"),this.errors&&(this.errors={},this.setWrapperHeight(2,150,0)),this.showCalendar&&!this.deliveryDate)return void this.calendarFormGroup.classList.add("s-form-has-error");if(this.physicalProducts&&!this.selectedCountryId)return this.errors||(this.errors={}),this.errors["receiver.country"]=salla.lang.get("common.messages.required_field"),void this.setWrapperHeight(2,150,0);const t={text:this.selectedText,sender_name:this.senderName,quantity:this.quantity,deliver_at:this.showCalendar?this.deliveryDate:null,image_url:this.uploadedImage??this.selectedImage,donation_amount:s||null,receiver:{name:this.receiverName,country_code:this.selectedCountryCode&&this.physicalProducts?this.selectedCountryCode:this.receiverCountryCode,mobile:this.receiverMobile,...this.receiverCity&&this.physicalProducts?{city_id:this.receiverCity}:{}},has_apple_pay:salla.helpers.hasApplePay()};let i;this.productId&&this.formSelector&&(i=this.getFormDataFromForm()||new FormData,i=this.mergeObjectToFormData(t,i));const e=this.productId?()=>salla.product.addProductGiftToCart(this.productId,i,!0):()=>salla.cart.addCartGiftToCart(t,!0);return await e().then((()=>this.modal.close())).catch((s=>{s.response&&422==s.response.status?this.errors=s.response.data.error.fields:console.log(s),this.setWrapperHeight(2,150,0)}))}generateClass(){return{"s-gifting-widget":!0,"s-gifting-widget-vertical":!!this.vertical,"s-gifting-widget-horizontal":!this.vertical}}async handleGiftButtonClick(){if(this.productId&&this.formSelector){const s=document.querySelector(this.formSelector);if(!s)return void console.error("SallaGifting:: Form not found in the document!");if(!(s instanceof HTMLFormElement))return void console.error("SallaGifting:: The specified selector does not correspond to a form tag!");if(!s.reportValidity())return console.error("SallaGifting:: Form is not valid!"),void salla.error(salla.lang.get("common.messages.required_fields"))}const s=document.querySelector(`salla-product-options[product-id="${this.productId}"]`);!s||await s.reportValidity()?this.open():salla.error(salla.lang.get("common.messages.required_fields"))}render(){return[t("div",{key:"69f449221a2abf8e4d9264b46ab023eb7baca314"},t("salla-list-tile",{key:"0072bab6171c9b11e54f0c6655c408b12d554e24",class:this.generateClass()},t("div",{key:"38aa5f8decf6d9c97253c3c16b80a478d623985e",slot:"title"},this.vertical?t("span",{innerHTML:l}):"",t("h3",{key:"37fddbe7a80f38b3acca42220028208cab52ba15"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),t("div",{key:"b3bf6bff40b60a3fbace637ed69f6aa72853c04b",slot:"subtitle"},t("div",{key:"46643b7cd897524ca42c41da24e657401f85ab28"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),t("div",{key:"5129acfd67425ccfad68b3770843f11c9fa55b18",slot:"action"},t("salla-button",{key:"0e93efc647444a26198e4631614b8590f75f122e",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},t("slot",{key:"b88d95a25308cebc29b796bb2b0c25e4fa230406",name:"widget-btn-content"},t("div",{key:"4cdbaaeb2bc67f056ea348755ffbdfbc831a1a5b",class:"s-gifting-widget-action-content"},t("span",{key:"7dfec389970416df9be46c8ae5f0904dd64e17ad",innerHTML:l})," ",t("span",{key:"768f3621011bc3c984dce13ce83b3fb6cceb0171"},this.sectionBtnText)))))),t("salla-modal",{key:"b3c94ef80f955b42baecd963f5550f17a80c6fb4",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:s=>this.modal=s},t("div",{key:"c09e12eabff63ba1a781c8980b449f854affc164",slot:"loading"},t("div",{key:"dbafa39345c573eae0d045a7d23e346f7068ec0b",class:"s-gifting-skeleton"},t("div",{key:"ff247ea5c79b87ca1c76e6035813d7ecb2caeff2",class:"s-gifting-modal-header"},t("salla-skeleton",{key:"1e67bea2f1f957744c4f6f0af83ded347799916e",type:"circle",height:"5rem",width:"5rem"}),t("h2",{key:"6486434a702624358211c22e7a6b48be16d96c42",class:"s-gifting-modal-title"},t("div",{key:"688854d37e5ca46fcaa7957d3e72a52d7c706f8d",class:"s-gifting-modal-badge-wrapper"},t("salla-skeleton",{key:"9fcbb2086aa25b02effdc873bbfd45087e673de6",height:"15px",width:"150px"})))),t("div",{key:"1b9bf709a01b20e87d68f92f3cb93600214460cd",class:"s-gifting-skeleton-content"},t("salla-skeleton",{key:"ba6b0c87442412398c360da1f6e8b5094812900f",height:"10px",width:"150px"}),t("salla-skeleton",{key:"6583783ace4e2668705c47c4bcac2a33b346a72b",height:"230px"}),t("salla-skeleton",{key:"c76b038f100072d56a7cedd0438eeacc98bf7b42",height:"10px",width:"150px"}),t("salla-skeleton",{key:"1d331e7be7cd88ea5c108f331626dddc74699ed2",height:"30px"}),t("salla-skeleton",{key:"5cc3d1b8d67b7bf199219099af909591b8a8a869",height:"40px"})))),t("slot",{key:"9dc4c6f3a717e16e3527f9651b05a74ca1a6212c",name:"header"}),this.hasError?t("salla-placeholder",{alignment:"center"},t("span",{slot:"title"},this.errorMessage||salla.lang.get("common.errors.empty_results")),t("span",{slot:"description"}," ")):[t("div",{class:"s-gifting-modal-header"},t("span",{class:"s-gifting-modal-icon"},t("span",{innerHTML:l})),t("h2",{class:"s-gifting-modal-title"},t("div",{class:"s-gifting-modal-badge-wrapper"},t("div",{class:"s-gifting-modal-badge"},t("span",null,t("span",null,this.currentStep),"/2")),t("span",null,this.giftDetails)))),t("div",{class:"s-gifting-steps-wrapper "+this.parentClass,ref:s=>this.stepsWrapper=s},t("div",{class:"s-gifting-step-one gift-step-1",ref:s=>this.step1Elems=s},t("div",{class:"s-gifting-modal-uploader-title anime-item"},this.selectImageForYourGift),t("div",{class:"s-gifting-modal-uploader anime-item",ref:s=>this.uploader=s},t("span",{class:"s-gifting-remove-preview",onClick:()=>this.removePreview(),innerHTML:a}),this.selectImageOrUpload&&t("salla-file-upload",{"instant-upload":!0,name:"image_url",url:salla.url.api(salla.product.api.getUrl("giftImage")),onUploaded:s=>this.handleUploadImage(s.detail),labelIdle:this.getFilepondPlaceholder(),onRemoved:()=>this.handleRemoveImage()})),t("div",{class:"anime-item"},!this.uploadedImage&&this.gift&&this.gift.gift_images&&this.gift.gift_images.length>0?t("salla-slider",{id:"gifting-slider",loop:!1,"controls-outer":!0,class:"s-gifting-slider",type:"carousel"},t("div",{slot:"items"},this.gift&&this.gift.gift_images?this.gift?.gift_images.map((s=>t("a",{class:"s-gifting-clickable s-gifting-image",onClick:()=>this.setPreview(s)},t("img",{style:{width:"120px"},src:s.url,alt:`${s.id}`})))):"")):""),t("div",{class:"anime-item"},t("div",{class:"s-form-group s-gifting-selectText",ref:s=>this.textSelect=s},t("select",{id:"gift-text-selection",name:"gift-text-selection",class:"s-form-control s-gifting-select",onChange:s=>this.toggleGiftText(s)},t("option",{"data-id":null,selected:!0},this.selectGiftMessage),this.gift&&this.gift.gift_texts?this.gift?.gift_texts.map((s=>t("option",{"data-id":s.id,value:s.text,key:s.id},s.text))):"",t("option",{"data-id":"custom"},this.giftCustomText))),t("div",{class:this.showGiftText?"s-form-group s-gifting-textarea shown":"s-form-group s-gifting-textarea hide",ref:s=>this.customTextArea=s},t("label",{htmlFor:"gift-custom-text",class:"s-form-label"},this.giftCustomText),t("div",{class:"mt-1"},t("textarea",{onInput:s=>this.handleTextAreaChange(s),rows:4,ref:s=>this.textArea=s,name:"gift-custom-text",id:"gift-custom-text",class:"s-form-control"})))),t("div",{class:"anime-item"},t("salla-button",{color:"primary",width:"wide",onClick:()=>this.goToStep2()},t("span",null,this.nextStep)))),t("div",{class:"s-gifting-step-two gift-step-2",ref:s=>this.step2Elems=s},t("div",{class:this.errors&&this.errors.sender_name?"s-form-group s-form-has-error anime-item opacity-0":"s-form-group anime-item opacity-0"},t("label",{htmlFor:"sender_name",class:"s-form-label"},this.senderNameLabel),t("input",{type:"text",class:"s-form-control",name:"sender_name",id:"sender_name",value:this.senderName,onInput:s=>this.handleSenderName(s),placeholder:""}),this.errors&&this.errors.sender_name?t("span",{class:"s-gifting-error"},this.errors.sender_name):""),t("div",{class:this.errors&&this.errors["receiver.name"]?"s-form-group s-form-has-error anime-item opacity-0":"s-form-group anime-item opacity-0"},t("label",{htmlFor:"receiver_name",class:"s-form-label"},this.receiverNameFieldLabel),t("input",{type:"text",class:"s-form-control",name:"receiver_name",id:"receiver_name",value:"",onInput:s=>this.handleReceiverName(s),placeholder:""}),this.errors&&this.errors["receiver.name"]?t("span",{class:"s-gifting-error"},this.errors["receiver.name"]):""),t("div",{class:this.errors&&this.errors["receiver.mobile"]?"s-form-group s-form-has-error anime-item opacity-0":"s-form-group anime-item opacity-0"},t("label",{class:"s-form-label"},this.receiverMobileFieldLabel),t("salla-tel-input",{class:"s-gifting-tel-input",phone:this.receiverMobile,countryCode:this.selectedCountryCode||this.receiverCountryCode,key:`tel-input-${this.selectedCountryCode||this.receiverCountryCode||"default"}`,onPhoneEntered:s=>this.handlePhoneInputChange(s)}),this.errors&&this.errors["receiver.mobile"]?t("span",{class:"s-gifting-error"},this.errors["receiver.mobile"]):""),this.physicalProducts&&t("div",null,t("div",{class:this.errors&&this.errors["receiver.country"]?"s-form-group s-form-has-error anime-item opacity-0":"s-form-group anime-item opacity-0"},t("label",{class:"s-form-label"},this.receiverCountryFieldLabel),t("select",{name:"country",class:"s-form-control",onChange:s=>this.handleCountryChange(s),required:!0},t("option",{value:""},this.selectCountry),this.gift?.countries?.map((s=>t("option",{value:s.id},s.name)))),this.errors&&this.errors["receiver.country"]?t("span",{class:"s-gifting-error"},this.errors["receiver.country"]):""),t("div",{class:this.errors&&this.errors["receiver.city_id"]?"s-form-group s-form-has-error anime-item opacity-0":"s-form-group anime-item opacity-0"},t("label",{class:"s-form-label"},this.receiverCityFieldLabel),t("select",{name:"city","aria-label":salla.lang.get("blocks.buy_as_gift.select_city"),class:"s-form-control",onChange:s=>this.handleReceiverCity(s),disabled:this.loadingCities},t("option",{value:"",selected:!0},this.loadingCities?salla.lang.get("common.elements.loading"):this.selectCity),this.gift?.cities?.map((s=>t("option",{value:s.id},s.name)))),this.errors&&this.errors["receiver.city_id"]?t("span",{class:"s-gifting-error"},this.errors["receiver.city_id"]):""),t("div",{class:"s-gifting-info anime-item opacity-0"},t("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert</title>\n<path d="M16 13.333c-0.736 0-1.333 0.597-1.333 1.333v8c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-8c0-0.736-0.597-1.333-1.333-1.333zM16 9.327c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM27.313 4.687c-6.237-6.237-16.389-6.239-22.628 0-6.237 6.239-6.237 16.389 0 22.628 3.119 3.119 7.216 4.679 11.313 4.679s8.195-1.559 11.313-4.679c6.24-6.239 6.24-16.391 0.001-22.628zM25.428 25.428c-5.199 5.197-13.657 5.197-18.857 0-5.197-5.199-5.197-13.659 0-18.857 5.199-5.197 13.659-5.197 18.857 0 5.199 5.2 5.199 13.659 0 18.857z"></path>\n</svg>\n'}),t("span",null,this.selectCityInfo))),!this.physicalProducts&&t("div",{class:"anime-item opacity-0"},t("label",{class:"s-gifting-schedule s-gifting-clickable",htmlFor:`schedule-${this.hostId}`},t("input",{type:"checkbox",name:"schedule",id:`schedule-${this.hostId}`,onChange:()=>this.toggleCalendar(),class:"s-checkbox"}),t("span",{class:"s-form-label"}," ",this.sendLater," "))),t("div",{class:this.getCalendarClasses(),ref:s=>this.calendarFormGroup=s},t("label",{class:"s-form-label"},this.selectSendDateAndTime),t("salla-datetime-picker",{value:this.deliveryDate,placeholder:this.selectSendDateAndTime,"enable-time":!0,"date-format":"Y-m-d h:i K",onPicked:s=>this.handleDateTimePicker(s)}),t("span",{class:"s-gifting-calendar-hint"},this.canNotEditOrderAfterSelectDate)),t("div",{class:"s-gifting-step-two-footer anime-item opacity-0"},t("a",{href:"#!",innerHTML:e,onClick:s=>this.goToStep1(s)}),t("salla-button",{onClick:()=>this.submitForm(),color:"primary",width:"wide"},t("span",null,this.sendGift)))))],t("slot",{key:"2ca6746edd5e72c996633b6d0b3ccdc5009198c4",name:"footer"})))]}};o.style=".s-gifting-steps-wrapper{transition:0.2s cubic-bezier(0.55, 0, 0.1, 1) 0s}.s-gifting-select{background-image:url(\"data:image/svg+xml;utf8,<svg version='1.1' fill='gray' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><title>keyboard_arrow_down</title><path d='M9.875 11.104l6.125 6.125 6.125-6.125 1.875 1.875-8 8-8-8z'></path></svg>\");background-size:24px;background-repeat:no-repeat;background-position:99%;appearance:none}[dir=rtl] .s-gifting-select{background-position:5px}.s-gifting-widget-vertical .s-list-tile-item [slot=title]{display:flex;align-items:center;gap:1.5rem}.s-gifting-widget-vertical .s-list-tile-item-content{width:100%}";export{o as salla_gifting}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as t,c as s,h as i,H as e,a}from"./p-CV1rqKQz.js";import{a as o}from"./p-CgtvEd63.js";import{S as r}from"./p-DiKTtDW5.js";import{H as h}from"./p-CHf8XdiS.js";const l=class{constructor(i){t(this,i),this.productsFetched=s(this,"productsFetched"),this.autoload=!1,this.productCardComponent="custom-salla-product-card",this.page=1,this.placeholderText=salla.lang.get("pages.categories.no_products"),this.endOfText=salla.lang.get("common.elements.end_of_content"),this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more"),this.currentPage=salla.config.get("page"),this.filtersSnapshot=[],this.lastViewedProductKey="lastViewedProductId",this.filtersKey="filters",this.infiniteScrollStateKey="infiniteScrollState",this.prevCategoryIdKey="prevCategoryId",this.isProcessing=!1,this.scrollTimeout=null,this.boundScrollToLastViewedProduct=()=>this.scrollToLastViewedProduct(),this.boundHandleScroll=()=>this.handleScroll(),this.specialPagesWithoutIds={"product.index.latest":"latest","product.index.offers":"offers","product.index.search":"search","product.index.sales":"sales"},this.includes=h.parseJson(this.includes||this.host.getAttribute("includes")),Array.isArray(this.includes)||(this.includes=null),h.setIncludes(this.includes),salla.lang.onLoaded((()=>{this.placeholderText=salla.lang.get("pages.categories.no_products"),this.endOfText=salla.lang.get("common.elements.end_of_content"),this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more"),this.currentPage=salla.config.get("page")}))}connectedCallback(){"scrollRestoration"in history&&(history.scrollRestoration="manual"),window.addEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),salla.event.on("salla-filters::changed",(t=>this.setFilters(t)))}disconnectedCallback(){window.removeEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),window.removeEventListener("scroll",this.boundHandleScroll)}async setFilters(t){if(t&&JSON.stringify(t)!==JSON.stringify(this.parsedFilters))return window.scrollTo({top:0,behavior:"smooth"}),this.parsedFilters=JSON.parse(JSON.stringify(t)),this.filtersSnapshot=this.parsedFilters,"product.index"==this.currentPage?.slug&&this.parsedFilters&&this.parsedFilters.category_id&&(this.currentCategoryIdFilter=[this.parsedFilters.category_id]),this.reload()}async reload(){!this.autoload&&this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none"),this.hasInfiniteScroll&&salla.infiniteScroll.destroy(this.infiniteScroll),this.buildNextPageUrl(),this.wrapper.innerHTML="",this.hasInfiniteScroll?this.init():this.getInitialData(),this.showPlaceholder&&(this.showPlaceholder=!1,this.placeholderLoader=document.createElement("div"),this.placeholderLoader.classList.add("s-products-list-loading-wrapper"),this.placeholderLoader.style.display="inherit",this.placeholderLoader.innerHTML='<span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"></span>',this.host.insertAdjacentElement("afterend",this.placeholderLoader))}isFilterable(){return salla.config.get("store.settings.product.filters")&&this.filtersResults}isSourceWithoutValue(){return["offers","latest","sales","wishlist","top-rated","reorder"].includes(this.getSource())}animateItems(){o({targets:"salla-products-list salla-product-card",opacity:[0,1],duration:1200,translateY:[20,0],delay:function(t,s){return 100*s}})}initBaseNextPageUrl(t){this.nextPage=salla.url.api(`products?source=${t}`),this.includes?.length&&(this.nextPage+=`&includes[]=${this.includes.join("&includes[]=")}`),this.limit&&(this.nextPage+=`&per_page=${this.limit>32?32:this.limit}`),this.sortBy&&(this.nextPage+=`&sort=${this.sortBy}`),"preview"===salla.config.get("theme.mode")&&(this.nextPage+="&use_username_url=1"),this.nextPage+="&filterable=1";for(const[t,s]of Object.entries(this.parsedFilters||{}))if(["string","number"].includes(typeof s))this.nextPage+=`&filters[${encodeURIComponent(t)}]=${encodeURIComponent(s)}`;else if(Array.isArray(s))s.forEach((s=>this.nextPage+=`&filters[${encodeURIComponent(t)}][]=${encodeURIComponent(s)}`));else if("object"==typeof s)for(const[i,e]of Object.entries(s))this.nextPage+=`&filters[${encodeURIComponent(t)}][${encodeURIComponent(i)}]=${encodeURIComponent(e)}`}buildNextPageUrl(){let t=this.getSource();if("json"===t)return;const s=sessionStorage.getItem(this.infiniteScrollStateKey);if(s){const{nextPage:t}=JSON.parse(s);if(!t)return}if(this.initBaseNextPageUrl(t),!this.isSourceWithoutValue())if(["search","related","landing-page"].includes(t))this.nextPage+=`&source_value=${this.getSourceValue()}`;else try{this.nextPage+=`&source_value[]=${this.getSourceValue().join("&source_value[]=")}`}catch(s){salla.logger.warn(`source-value prop should be array of ids ex source-value="[1,2,3]" for the source [${t}]`),this.sourceValueIsValid=!1}}loading(t=!0,s=!1){if(t){let t=s&&!this.autoload?this.btnLoader:this.loader;t&&(t.style.display="inherit")}else this.autoload||this.btnLoader&&(this.btnLoader.style.display="none"),this.loader&&(this.loader.style.display="none")}getItemHTML(t){"landing-page"===this.getSource()&&(t.url="");const s=document.createElement(this.hasCustomComponent?this.productCardComponent:"salla-product-card");return s.product=t,this.compactCards&&(s.compact=!0,s.toggleAttribute("compact",!0)),this.applyLandingPageStyles(s),this.applyHorizontalCardStyles(s),s.addEventListener("click",(s=>{const i=s.target;i.closest("a")&&(h.saveProductSource(this.getSource()),this.hasInfiniteScroll&&(this.takeStateSnapshot(),sessionStorage.setItem(this.lastViewedProductKey,t.id))),i.closest("salla-add-product-button")&&h.saveAddToCartSource(this.getSource())})),s}applyLandingPageStyles(t){"landing-page"!==this.getSource()||this.hasCustomComponent||(t.toggleAttribute("hide-add-btn",!0),t.classList.add("s-product-card-fit-height"))}applyHorizontalCardStyles(t){this.horizontalCards&&(t.toggleAttribute("horizontal",!0),this.hasCustomComponent||t.toggleAttribute("shadow-on-hover",!0))}waitForResizing(t){let s=null;return new Promise((i=>{const e=new ResizeObserver((()=>{clearTimeout(s),s=setTimeout((()=>{e.disconnect(),i(null)}),160)}));e.observe(t)}))}waitForLayoutStable(t){let s=null;return new Promise((i=>{const e=new MutationObserver((()=>{clearTimeout(s),s=setTimeout((()=>{e.disconnect(),i(null)}),160)}));e.observe(t,{childList:!0,subtree:!0,attributes:!0})}))}async waitForStableLayout(t){return await Promise.allSettled([this.waitForResizing(t),this.waitForLayoutStable(t)])}scrollToLastViewedProduct(){const t=sessionStorage.getItem(this.lastViewedProductKey);t&&!salla.url.is_page("product.single")&&this.isElementLoaded(`[id*="${t}"]`).then((()=>{const s=this.wrapper?.querySelector(`[id*="${t}"]`);if(!s)return;const i=()=>{const t=()=>{s.scrollIntoView({block:"start",behavior:"instant"});const t=matchMedia("(max-width: 1024px)").matches?"header .inner":"ul.main-menu",i=window?.header_is_sticky?document.querySelector(t)?.getBoundingClientRect()?.height??56:0,e=parseInt(getComputedStyle(this.wrapper).rowGap)??16;scrollBy({top:-1*(i+e),behavior:"instant"})};requestAnimationFrame(t),s.querySelectorAll("img.lazy").forEach((s=>{const i=s,e=()=>{requestAnimationFrame(t),i.onload=i.onerror=null};i.onload=e,i.onerror=e})),this.removeScrollRestorationSession()};this.waitForStableLayout(this.host).then((()=>requestAnimationFrame(i)))}))}isElementLoaded(t){return new Promise((s=>{const i=setInterval((()=>{if(document.querySelector(t))return clearInterval(i),s(document.querySelector(t))}),50)}))}takeStateSnapshot(){const t=[];for(let s=0;s<this.wrapper.children.length;s++){const i=this.wrapper.children?.[s];t.push(i.product)}const s={pageIndex:Math.max((this.infiniteScroll?.pageIndex??1)-1,1),nextPage:this.nextPage,currentPageData:t};if(this.isFilterable()){const t=sessionStorage.getItem(this.filtersKey);sessionStorage.setItem(this.filtersKey,t||JSON.stringify(this.filtersSnapshot))}sessionStorage.setItem(this.infiniteScrollStateKey,JSON.stringify(s));let i=salla.config.get("page.id");const e=Object.keys(this.specialPagesWithoutIds).find((t=>salla.url.is_page(t)));e?i=this.specialPagesWithoutIds[e]:null!==i&&(i=String(i)),sessionStorage.setItem(this.prevCategoryIdKey,i)}removeScrollRestorationSession(){this.isFilterable()||sessionStorage.removeItem(this.filtersKey),sessionStorage.removeItem(this.infiniteScrollStateKey),sessionStorage.removeItem(this.lastViewedProductKey),sessionStorage.removeItem(this.prevCategoryIdKey)}loadStoredScrollState(){const t=sessionStorage.getItem(this.infiniteScrollStateKey),s=sessionStorage.getItem(this.filtersKey),i=sessionStorage.getItem(this.prevCategoryIdKey),e=this.specialPagesWithoutIds[salla.config.get("page.slug")]||null,a=salla.config.get("page.id"),o=salla.url.is_page("index"),r=salla.url.is_page("product.single"),h=e?i!==e:i!==String(a);if(i&&h&&!o&&!r||o&&!this.hasInfiniteScroll)return this.removeScrollRestorationSession(),this.switchToNormalBehavior=!0,!1;if(r)return this.switchToNormalBehavior=!0,!1;if(t)try{const{pageIndex:i,nextPage:e,currentPageData:a}=JSON.parse(t);if("undefined"!==s){const t=JSON.parse(s);salla.event.emit("filters::fetched",{filters:t})}this.page=i,this.nextPage=e;for(let t=0;t<a.length;t++)this.wrapper.append(this.getItemHTML(a?.[t]));return!0}catch(t){console.error("Failed to load stored scroll state:",t),this.removeScrollRestorationSession()}return!1}getSource(){return h.getProductsSource(this.source)}getSourceValue(){return this.currentCategoryIdFilter?this.currentCategoryIdFilter:h.getProductsSourceValue(this.source,this.sourceValue)}appendDataLayer(t){"object"==typeof dataLayer&&Array.isArray(dataLayer)&&dataLayer.push({event:"impressions",ecommerce:{currencyCode:salla.config.currency().code,impressions:t.map(((t,s)=>({id:t.id,name:t.name,price:t.price,brand:t.brand?.name||"",quantity:t.quantity,categories:[{name:t.category?.name||salla.config.get("page.title"),id:salla.config.get("page.id")}],category:t.category?.name||salla.config.get("page.title"),position:s+1})))}})}initiateInfiniteScroll(){if(!this.hasInfiniteScroll)return;const t=this.autoload&&this.includes&&this.includes.length>0;this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:!1,nextPage:this.nextPage,scrollThreshold:!t&&!!this.autoload&&100,loadOnScroll:!t&&this.autoload},!0),this.infiniteScroll.pageIndex=this.page,this.infiniteScroll?.on("request",(()=>{this.loading(!0,!this.autoload)})),t&&window.addEventListener("scroll",this.boundHandleScroll),this.infiniteScroll?.on("load",(async t=>{if(!this.isProcessing){this.isProcessing=!0;try{if(!t.data?.length&&2===this.infiniteScroll.pageIndex)return this.showPlaceholder=!0,salla.infiniteScroll.destroy(this.infiniteScroll),this.loading(!1),void(this.placeholderLoader&&this.placeholderLoader.remove());this.includes&&await this.injectAndProcessData(t);const s=this.handleResponse(t);this.infiniteScroll.appendItems(s),2===this.infiniteScroll.pageIndex&&(!this.autoload&&this.nextPage&&(this.loadMoreWrapper.style.display="block"),this.animateItems())}catch(t){console.error("Error during load:",t)}finally{this.isProcessing=!1}}})),this.infiniteScroll?.on("error",(()=>{console.log("Error occurred during request"),this.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden"),this.placeholderLoader&&this.placeholderLoader.remove(),this.loading(!1),this.isProcessing=!1})),salla.onReady((()=>{sessionStorage.getItem(this.infiniteScrollStateKey)||this.manualLoadNextPage()}))}handleScroll(){this.isProcessing||this.scrollTimeout||(this.scrollTimeout=setTimeout((()=>{this.scrollTimeout=null,requestAnimationFrame((()=>{const t=this.wrapper.getBoundingClientRect(),s=window.innerHeight;t.bottom-s<=200&&!this.isProcessing&&this.nextPage&&this.manualLoadNextPage()}))}),200))}manualLoadNextPage(){this.nextPage&&this.infiniteScroll.loadNextPage()}async injectAndProcessData(t){try{await h.injectExtraFieldsToResponse(t)}catch(t){console.error("Error injecting data:",t)}}getInitialData(){return this.loading(),salla.product.api.fetch({source:h.getApiSource(this.getSource()),source_value:this.getSourceValue(),limit:this.limit}).then((async t=>t.data.length?(await h.injectExtraFieldsToResponse(t),this.firstPageResponse?void this.handleResponse(t).forEach((t=>this.wrapper.append(t))):(this.firstPageResponse=t,void(this.nextPage=t.cursor?t.cursor.next:this.nextPage))):(this.showPlaceholder=!0,this.placeholderLoader&&this.placeholderLoader.remove(),void this.loading(!1))))}async loadMore(){this.infiniteScroll?.loadNextPage()}componentWillLoad(){return salla.onReady().then((()=>{this.hasCustomComponent=!!customElements.get(this.productCardComponent),this.sourceValueIsValid=!(!this.getSourceValue()&&!this.isSourceWithoutValue()),this.hasInfiniteScroll=!["json","selected","related","landing-page","recently"].includes(this.getSource())&&!this.limit;let t=new URLSearchParams(window.location.search);try{this.sortBy=this.sortBy||t.get("sort")||t.get("by"),this.parsedFilters=h.extractFiltersFromUrl(t),this.parsedFilters&&this.parsedFilters.category_id&&(this.currentCategoryIdFilter=[this.parsedFilters.category_id])}catch(t){salla.logger.warn("failed to get filters from url",t.message)}if(this.buildNextPageUrl(),this.isReady=!0,!sessionStorage.getItem(this.infiniteScrollStateKey))if(this.sourceValueIsValid){if(!this.hasInfiniteScroll){if("json"===this.getSource())return this.getSourceValue().length?void setTimeout((()=>{this.getSourceValue().map((t=>this.wrapper.append(this.getItemHTML(t))))})):void(this.showPlaceholder=!0);if("selected"!==this.getSource()||this.getSourceValue().length)return this.getInitialData();this.showPlaceholder=!0}}else salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`)}))}async componentDidLoad(){this.hasInfiniteScroll&&this.init(),await Salla.hooks.registerComponent("salla-products-list",this),this.loadStoredScrollState()?(this.autoload?!this.nextPage&&this.loading(!1):this.nextPage?this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="block"):(this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none"),this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden")),this.scrollToLastViewedProduct()):!this.firstPageResponse&&this.switchToNormalBehavior?this.getInitialData().then((()=>{this.firstPageResponse?(this.handleResponse(this.firstPageResponse,!1).forEach((t=>{this.wrapper.append(t)})),setTimeout((()=>{if(!this.autoload&&this.nextPage&&1==this.infiniteScroll.pageIndex){const t=this.host.querySelector(".s-infinite-scroll-wrapper");t&&(t.style.display="block")}}))):console.error("No response received after getInitialData.")})).catch((t=>{console.error("Error during initial data fetch:",t)})):this.firstPageResponse&&this.handleResponse(this.firstPageResponse,!1).forEach((t=>this.wrapper.append(t)))}canRender(){return this.sourceValueIsValid&&this.isReady}render(){return this.canRender()?this.showPlaceholder?i("div",{class:"s-products-list-placeholder"},i("span",{innerHTML:r}),i("p",null,this.placeholderText)):i(e,{class:"s-products-list"},i("div",{class:{"s-products-list-wrapper":!0,"s-products-list-horizontal-cards":this.horizontalCards&&!this.filtersResults,"s-products-list-vertical-cards":!this.horizontalCards&&!this.rowCards&&!this.filtersResults,"s-products-list-row-cards":this.rowCards,"s-products-list-compact-cards":this.compactCards,"s-products-list-filters-results":this.filtersResults},ref:t=>this.wrapper=t}),i("div",{class:"s-infinite-scroll-status",ref:t=>this.status=t},i("p",{class:"s-infinite-scroll-last infinite-scroll-last s-hidden"},this.endOfText),i("p",{class:"s-infinite-scroll-error infinite-scroll-error s-hidden"},this.failedLoadMore)),this.autoload&&i("div",{class:"s-products-list-loading-wrapper",style:{display:"none"},ref:t=>this.loader=t},i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"})),this.hasInfiniteScroll&&this.nextPage&&!this.autoload?i("div",{class:"s-infinite-scroll-wrapper",style:{display:"none"},ref:t=>this.loadMoreWrapper=t},i("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary"},i("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")),i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:t=>this.btnLoader=t,style:{display:"none"}}))):""):""}init(){this.initiateInfiniteScroll(),this.loading()}handleResponse(t,s=!0){if(!t)return[];let i=this.getSource(),e="";if(1===t.cursor?.current){e=h.getPageTitleForSource(i);try{if("search"===this.getSource())e=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()});else if(!e){let s=this.parsedFilters.category_id||this.getSourceValue()[0];e=t.filters?.find((t=>"category_id"===t.key))?.values?.find((t=>t.key===s))?.value??"",this.filtersSnapshot=t.filters}e+=(e?" - ":"")+salla.lang.choice("blocks.header.products_count",t.data?.length),15===t.data.length&&(e=e.replace(t.data.length,salla.lang.get("common.elements.more_than")+" "+t.data.length)),t.title=e}catch(t){salla.logger.error("Error::falid to handle response",t)}h.generateProductSchema(t.data)}this.appendDataLayer(t.data),t.nextPage=this.nextPage,t.source=this.getSource(),t.sourceValue=this.getSourceValue(),salla.event.emit("salla-products-list::products.fetched",t),this.productsFetched.emit(t),t.filters&&this.isFilterable()?(this.filtersResults=!0,this.filtersSnapshot=JSON.parse(JSON.stringify(t.filters)),salla.event.emit("filters::fetched",{filters:t.filters})):this.isFilterable()&&salla.event.emit("filters::hidden"),s&&(this.nextPage=t.cursor?t.cursor.next:this.nextPage),this.loading(!1),this.placeholderLoader&&this.placeholderLoader.remove(),this.hasInfiniteScroll&&!this.nextPage&&(this.infiniteScroll.option({scrollThreshold:!1,loadOnScroll:!1}),this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden"));const a=[];for(let s=0;s<t.data.length;s++)a.push(this.getItemHTML(t.data?.[s]));return a}get host(){return a(this)}};l.style="";export{l as salla_products_list}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as c,H as s}from"./p-
|
|
4
|
+
import{r as e,h as c,H as s}from"./p-CV1rqKQz.js";const a=class{constructor(c){e(this,c),this.translationLoaded=!1,this.icon='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>inbox</title>\n<path d="M31.984 19.797l-2.667-17.333c-0.1-0.651-0.659-1.131-1.317-1.131h-24c-0.659 0-1.217 0.48-1.317 1.131l-2.667 17.333c-0.011 0.067-0.016 0.135-0.016 0.203v6.667c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-6.667c0-0.068-0.005-0.136-0.016-0.203zM5.144 4h21.712l2.256 14.667h-9.112c-0.736 0-1.333 0.596-1.333 1.333 0 1.471-1.196 2.667-2.667 2.667s-2.667-1.196-2.667-2.667c0-0.737-0.597-1.333-1.333-1.333h-9.112zM29.333 26.667c0 0.736-0.599 1.333-1.333 1.333h-24c-0.735 0-1.333-0.597-1.333-1.333v-5.333h8.168c0.593 2.299 2.684 4 5.165 4s4.571-1.701 5.165-4h8.168z"></path>\n</svg>\n',this.alignment="left",this.iconSize="md",salla.lang.onLoaded((()=>{this.translationLoaded=!0}))}alignmentClass(){return{"s-placeholder-wrapper":!0,"s-placeholder-align-left":"left"==this.alignment,"s-placeholder-align-center":"center"==this.alignment,"s-placeholder-align-right":"right"==this.alignment}}render(){return c(s,{key:"5f8dc6c1c73a5ed21d571b692eadbf56cac2a133",class:this.alignmentClass()},c("div",{key:"56df7bf4ce025b484943ec504c20bdedbb15604e",class:`s-placeholder-icon s-placeholder-icon-${this.iconSize}`,innerHTML:this.icon}),c("div",{key:"c72a76711d4e915bc24557c7c490c2cf5899db12",class:"s-placeholder-title"},c("slot",{key:"a77295c121d95dad05657577b56bd4c220bdca03",name:"title"},c("span",{key:"de463d3b9d37bd3231dc818dca9d3d37211881ad"},salla.lang.get("common.elements.no_options")))),c("div",{key:"5af30b0673bef28cc61165969138f30638f6bc1a",class:"s-placeholder-description"},c("slot",{key:"18057d95114aa4a074c29dbc60de1b4a707fa8f5",name:"description"},c("span",{key:"1695227c9a861b78fad5a850b22f8d51e812c0ab"},salla.lang.get("common.errors.empty_results")))))}};a.style="";export{a as salla_placeholder}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t}from"./p-
|
|
4
|
+
import{r as s,h as t}from"./p-CV1rqKQz.js";import{i as a}from"./p-BsXh13x8.js";const e=class{constructor(t){s(this,t),this.codeCopied=null,this.noItemFound=!0,this.order_items=[],this.isDigitalCard=s=>"codes"===s.product.type,this.isDigitalProduct=s=>"digital"===s.product.type}async componentWillLoad(){return salla.lang.onLoaded((()=>{this.codes_text=salla.lang.get("pages.thank_you.codes"),this.copy_text=salla.lang.get("common.elements.copy"),this.files_text=salla.lang.get("pages.thank_you.files"),this.download_text=salla.lang.get("pages.thank_you.download")})),await this.getOrderItems()}copyToClipboardHandler(s){if(navigator&&"clipboard"in navigator)try{navigator.clipboard.writeText(s).then((()=>{this.codeCopied=s,this.copyCodeButtonTimeout=setTimeout((()=>{this.codeCopied=null}),3e3)}))}catch(s){salla.loggers.error("copy functionality is not supported by the browser")}}async getOrderItems(){const s=this.orderId||salla.config.get("page.id"),t="Failed to fetch order items";if(!s)throw salla.logger.error(t),new Error(t);try{const{data:{items:t=[]}}=await salla.api.request(`orders/${s}`);t.some((s=>this.isDigitalCard(s)||this.isDigitalProduct(s)))&&(this.order_items=t,this.noItemFound=!1)}catch(s){salla.logger.error(t)}}disconnectedCallback(){this.copyCodeButtonTimeout&&clearTimeout(this.copyCodeButtonTimeout)}render(){return t("ul",{key:"ca710705a5f99c2442a5fdd25a29ff7202343723",class:"s-order-summary-wrapper"},this.noItemFound?t("salla-placeholder",{alignment:"center"},t("span",{slot:"title"})):this.order_items.map((s=>this.isDigitalCard(s)?t("li",{key:s.product.id,class:"s-order-summary-item"},t("h2",{class:"s-order-summary-item-title"},this.codes_text," (",s.name,")"),s.codes.map((s=>t("div",{key:s.code,class:"s-order-summary-code-item-wrapper"},t("p",null,t("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>debit-card-back</title>\n<path d="M30 28h-28c-1.105 0-2-0.895-2-2v0-18c0-1.105 0.895-2 2-2v0h28c1.105 0 2 0.895 2 2v0 18c0 1.105-0.895 2-2 2v0zM30 26v0zM2 8v18h28v-18zM31 14h-30c-0.552 0-1-0.448-1-1s0.448-1 1-1v0h30c0.552 0 1 0.448 1 1s-0.448 1-1 1v0zM11 22h-6c-0.552 0-1-0.448-1-1s0.448-1 1-1v0h6c0.552 0 1 0.448 1 1s-0.448 1-1 1v0zM24 24c-2.209 0-4-1.791-4-4s1.791-4 4-4c2.209 0 4 1.791 4 4v0c0 2.209-1.791 4-4 4v0zM24 18c-1.105 0-2 0.895-2 2s0.895 2 2 2c1.105 0 2-0.895 2-2v0c0-1.105-0.895-2-2-2v0zM20 24c-2.209 0-4-1.791-4-4s1.791-4 4-4v0c0.002 0 0.005 0 0.007 0 1.032 0 1.972 0.398 2.673 1.048l-0.003-0.002c0.191 0.183 0.311 0.439 0.311 0.724 0 0.552-0.448 1-1 1-0.257 0-0.492-0.097-0.669-0.257l0.001 0.001c-0.345-0.319-0.807-0.514-1.315-0.514-0.002 0-0.003 0-0.005 0h0c-1.105 0-2 0.895-2 2s0.895 2 2 2v0c0.002 0 0.004 0 0.007 0 0.508 0 0.971-0.195 1.317-0.515l-0.001 0.001c0.179-0.171 0.422-0.276 0.689-0.276 0.552 0 1 0.448 1 1 0 0.295-0.128 0.56-0.331 0.743l-0.001 0.001c-0.699 0.648-1.638 1.046-2.671 1.046-0.003 0-0.007 0-0.010 0h0.001z"></path>\n</svg>\n'}),t("span",null,s.code)),t("salla-button",{class:"s-order-summary-item-copy-button "+(this.codeCopied===s.code?"copied":""),onClick:()=>this.copyToClipboardHandler(s.code),shape:"link"},t("span",{innerHTML:this.codeCopied===s.code?a:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>swap-stroke</title>\n<path d="M6.667 18.667h-2.667c-0.736 0-1.333-0.597-1.333-1.333v-13.333c0-0.736 0.597-1.333 1.333-1.333h13.333c0.736 0 1.333 0.597 1.333 1.333v2.667c0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667c0-2.205-1.795-4-4-4h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h2.667c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333zM28 10.667h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4v-13.333c0-2.205-1.795-4-4-4zM29.333 28c0 0.736-0.597 1.333-1.333 1.333h-13.333c-0.736 0-1.333-0.597-1.333-1.333v-13.333c0-0.736 0.597-1.333 1.333-1.333h13.333c0.736 0 1.333 0.597 1.333 1.333z"></path>\n</svg>\n'}),t("span",null,this.copy_text)))))):this.isDigitalProduct(s)?t("li",{key:s.product.id,class:"s-order-summary-item"},t("h2",{class:"s-order-summary-item-title"},this.files_text," (",s.name,")"),t("ul",null,s.files.map((s=>t("li",{class:"s-order-summary-digital-item-wrapper"},t("div",null,t("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>file-archive</title>\n<path d="M17.333 16h-5.333c-0.737 0-1.333 0.597-1.333 1.333v2.667c0 2.205 1.795 4 4 4s4-1.795 4-4v-2.667c0-0.736-0.596-1.333-1.333-1.333zM16 20c0 0.735-0.597 1.333-1.333 1.333s-1.333-0.599-1.333-1.333v-1.333h2.667zM17.333 12h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333zM28.943 8.391l-8-8c-0.249-0.251-0.588-0.391-0.943-0.391h-13.333c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h18.667c2.205 0 4-1.795 4-4v-18.667c0-0.353-0.14-0.693-0.391-0.943zM26.667 28c0 0.735-0.597 1.333-1.333 1.333h-18.667c-0.736 0-1.333-0.599-1.333-1.333v-24c0-0.735 0.597-1.333 1.333-1.333h12.781l7.219 7.219zM17.333 8h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333zM17.333 4h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333z"></path>\n</svg>\n'}),t("span",null,s.name)),t("a",{href:s.url,target:"_blank",class:"s-order-summary-item-download"},t("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>download</title>\n<path d="M15.056 20.941c0.123 0.124 0.271 0.221 0.435 0.289 0.163 0.067 0.336 0.103 0.509 0.103s0.347-0.036 0.509-0.103c0.164-0.068 0.311-0.165 0.435-0.289l5.332-5.332c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-3.057 3.057v-12.781c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v12.781l-3.057-3.057c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885zM25.333 26.667h-18.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h18.667c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333z"></path>\n</svg>\n'}),t("span",null,this.download_text))))))):null)))}};e.style=":host{display:block}";export{e as salla_order_summary}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as i,a as n}from"./p-
|
|
4
|
+
import{r as s,h as t,H as i,a as n}from"./p-CV1rqKQz.js";import{H as l}from"./p-CHf8XdiS.js";import"./p-CgtvEd63.js";const e=class{constructor(t){s(this,t),this.nextPage="",this.autoload=!1,this.container="salla-infinite-scroll",this.item="salla-infinite-scroll > *",this.status=document.createElement("div"),this.status.className="s-infinite-scroll-wrapper",this.status.innerHTML=`<div class="s-infinite-scroll-status" style="display:none">\n <p class="s-infinite-scroll-last infinite-scroll-last"></p>\n <p class="s-infinite-scroll-error infinite-scroll-error"></p>\n </div>\n <a href="${this.nextPage}" class="s-infinite-scroll-btn s-button-btn s-button-primary">\n <span class="s-button-text s-infinite-scroll-btn-text">${this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")}</span>\n <span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" style="display: none"></span>\n </a>`,this.btnLoader=this.status.querySelector(".s-button-loader"),salla.lang.onLoaded((()=>{this.status.querySelector(".s-button-text").innerHTML=this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more"),this.status.querySelector(".s-infinite-scroll-last").innerHTML=salla.lang.get("common.elements.end_of_content"),this.status.querySelector(".s-infinite-scroll-error").innerHTML=salla.lang.get("common.elements.failed_to_load_more")}))}loading(s=!0){let t=this.status.querySelector(".s-button-text");l.toggleElementClassIf(t,"s-button-hide","s-button-show",(()=>s)),this.btnLoader.style.display=s?"inherit":"none"}render(){return this.nextPage.length>1?t(i,{class:"s-infinite-scroll-container"},t("slot",null)):""}componentDidLoad(){if(0===this.nextPage.length)return;this.host.insertAdjacentElement("afterend",this.status);let s=this,t=salla.infiniteScroll.initiate(this.container,{history:!!this.autoload&&"push",scrollThreshold:!!this.autoload&&400,nextPage:this.nextPage,checkLastPage:'salla-infinite-scroll[next-page*=":"],salla-infinite-scroll[next-page*="."]',status:".s-infinite-scroll-status",button:this.status.querySelector(".s-button-btn"),append:this.item,path:function(){return s.nextPage.replace(/page\=(\d)/g,"page="+(this.loadCount+2))}}).on("request",(()=>this.loading())).on("load",(()=>{this.loading(!1),2==t.pageIndex&&t.option({loadOnScroll:!1}),3==t.pageIndex&&t.option({loadOnScroll:!0})})).on("error",(()=>this.loading(!1)))}get host(){return n(this)}};e.style="";export{e as salla_infinite_scroll}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as a,a as s}from"./p-
|
|
4
|
+
import{r as e,h as a,a as s}from"./p-CV1rqKQz.js";const l=class{constructor(a){e(this,a),this.hasError=!1,salla.event.on("size-guide::open",(e=>this.open(e))),salla.lang.onLoaded((()=>{this.placeholder_title=salla.lang.get("pages.products.size_guide_placeholder"),this.placeholder_description=salla.lang.get("pages.products.size_guide_placeholder_info"),this.modal_title=salla.lang.get("pages.products.size_guides")}))}async open(e){return this.modal.setTitle(this.modal_title),this.modal.open(),await salla.api.withoutNotifier((()=>salla.product.getSizeGuides(e))).then((e=>{this.guides=e.data})).catch((e=>{console.log(e),this.hasError=!0,this.placeholder_description=e.response?.data?.error?.message||e.response?.data})).finally((()=>this.modal.stopLoading()))}async close(){return this.modal.close()}showPlaceholder(){return a("salla-placeholder",{alignment:"center",iconSize:"xl"},a("div",{slot:"title"},this.placeholder_title),a("div",{slot:"description"},this.placeholder_description))}render(){return a("salla-modal",{key:"6c952c6cdd01f99332809112fd5921c4b43cd518",class:"s-product-size-guide-wrapper",id:"salla-product-size-guide-modal",isLoading:!0,"has-skeleton":!0,width:"md",ref:e=>this.modal=e},a("span",{key:"f4260144f981da0081e09895b7a065cad1fa66bc",slot:"icon",class:"s-product-size-guide-header-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>pencil-ruler</title>\n<path d="M3.057 11.609c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l6.667-6.667c0.521-0.521 0.521-1.364 0-1.885l-1.285-1.285c-1.143-1.143-2.661-1.772-4.276-1.772-1.616 0-3.135 0.629-4.276 1.772-1.143 1.141-1.772 2.66-1.772 4.276 0 1.615 0.629 3.135 1.772 4.276zM3.657 3.657c1.277-1.277 3.504-1.277 4.781 0l0.343 0.343-4.781 4.781-0.343-0.343c-0.639-0.639-0.991-1.488-0.991-2.391s0.352-1.752 0.991-2.391zM29.317 20.972c-0.2-0.707-0.932-1.119-1.645-0.921-0.709 0.2-1.121 0.937-0.921 1.645l1.987 7.041-7.041-1.987c-0.707-0.195-1.444 0.213-1.645 0.921-0.2 0.708 0.212 1.445 0.921 1.645l9.333 2.633c0.119 0.032 0.24 0.049 0.361 0.049 0.349 0 0.689-0.137 0.943-0.391 0.341-0.341 0.472-0.84 0.34-1.305zM31.609 8.772l-8.381-8.381c-0.5-0.5-1.385-0.5-1.885 0l-8.171 8.171s-0.001 0-0.001 0.001 0 0.001-0.001 0.001l-4.607 4.607s0 0-0.001 0 0 0 0 0.001l-8.171 8.171c-0.251 0.249-0.391 0.588-0.391 0.943 0 0.353 0.14 0.693 0.391 0.943l8.381 8.381c0.249 0.251 0.589 0.391 0.943 0.391s0.693-0.14 0.943-0.391l20.952-20.952c0.521-0.521 0.521-1.365 0-1.885zM9.715 28.781l-6.495-6.496 1.676-1.676 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-3.008-3.008 2.724-2.724 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.52 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.365 0-1.885l-3.008-3.008 1.677-1.677 6.496 6.496z"></path>\n</svg>\n'}),a("div",{key:"80e28a80741f103fdc788a6afa8809dfabfd64f6",slot:"loading"},a("div",{key:"e190d657a6a03e48a813c2f78321c12cf95eadcb",class:"s-product-size-guide-skeleton"},a("salla-skeleton",{key:"94cb87240b52244a86ba76893261048aa3f356d9",height:"15px",width:"25%"}),a("div",{key:"c8bba70713c78829d0973b845a3ed942cb7fa150",class:"s-product-size-guide-skeleton-header"},a("salla-skeleton",{key:"13b2fe8a4655457567d087e5763e43abb8b2d2a5",height:"40px"}),a("salla-skeleton",{key:"4b23015076c7c44794eecf85a4355264f778ef10",height:"40px"}),a("salla-skeleton",{key:"3cd58dfafb05cc2bac89ad6973247075d0dd9571",height:"40px"}),a("salla-skeleton",{key:"36f28def58893e567e6186d94ec3a84abed159ab",height:"40px"})),a("div",{key:"854881c782f372b2ed1b08874dfa4bd5d64edef2",class:"s-product-size-guide-skeleton-content"},a("salla-skeleton",{key:"a790751c95177a49135859f5810b4cd947fa4314",height:"15px",width:"25%"}),a("salla-skeleton",{key:"a9e4bd9a0bf55bd391da7f68ba85db7893f1eb81",height:"10px",width:"75%"}),a("salla-skeleton",{key:"b0f73c83abd9b6e8521dacb823d65f13f9ba54bb",height:"10px",width:"50%"}),a("salla-skeleton",{key:"fe92879eedf28801c4d267e4595e5f4aa5c7b871",height:"10px",width:"75%"}),a("salla-skeleton",{key:"652d460114bc710073adcb2e31a6627c938259c5",height:"10px",width:"100%"}),a("salla-skeleton",{key:"71f461d5256a05d4ac407b00daf2e20dccef0cf5",height:"10px",width:"25%"}),a("salla-skeleton",{key:"dbd224caad4233eb0bf8a5012fab7160d067d371",height:"10px",width:"60%"}),a("salla-skeleton",{key:"c87baa836ae0282047ccc8b7fb122a80cdf7256a",height:"10px",width:"45%"}),a("salla-skeleton",{key:"2c02db790ed567de556d7fa74f48843d156dedb6",height:"10px",width:"30%"})))),a("slot",{key:"155efc69836cfc62382a8b3f7929c7200244f4ba",name:"header"}),!this.hasError&&this.guides?[a("salla-tabs",null,this.guides.map((e=>a("salla-tab-header",{slot:"header",name:e.name},a("span",null,e.name)))),this.guides.map((e=>a("salla-tab-content",{slot:"content",name:e.name},a("div",{innerHTML:e.description})))))]:this.showPlaceholder(),a("slot",{key:"6d212a3d48df9363485e77f37f71276a1c3f8ee7",name:"footer"}))}get host(){return s(this)}};l.style="";export{l as salla_product_size_guide}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as e,H as s,a as l,F as o}from"./p-
|
|
4
|
+
import{r as t,h as e,H as s,a as l,F as o}from"./p-CV1rqKQz.js";const d=class{constructor(e){t(this,e),this.sections=[],this.itemNumber=""}deleteItem(t,e){const s=this.host.closest("form");if(s){const l=s.getAttribute("id");if(l&&"string"==typeof l){const s=l.match(/item-(\d+)/)?.[1];this.itemNumber=s||"";const o=this.host.querySelector(`#accordion-${e.id}`);salla.cart.deleteItem(`${this.itemNumber}?product_id=${e.id}§ion_id=${t}`).then((()=>o?.remove()))}}}renderRemoveButton(t,s,l=!1){return e("salla-button",{type:"button",shape:l?"btn":"icon",fill:l?"outline":"solid",size:"small",color:"danger","aria-label":"Remove from the cart",onClick:()=>this.deleteItem(t,s)},l?salla.lang.get("common.elements.delete"):e("i",{class:"sicon-cancel"}))}renderAccordionHeader(t,s){const l=s?.options&&s?.options?.length>0;return e("div",{slot:"html",class:"s-multiple-bundle-product-cart-header-wrapper"},e("div",{class:"s-multiple-bundle-product-cart-header "+(l?"":"s-multiple-bundle-product-cart-header-no-options")},e("div",{class:"s-multiple-bundle-product-cart-header-content"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-image-wrapper"},e("img",{src:s?.image?.url,alt:s?.image?.alt||s?.name,class:"s-multiple-bundle-product-cart-header-image"})),e("div",{class:"s-multiple-bundle-product-cart-header-content-details"},e("h2",{class:"s-multiple-bundle-product-cart-header-content-details-title"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-content-details-title-link"},s?.name)),e("div",{class:"s-multiple-bundle-product-cart-header-content-details-price"},e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-regular"},e("span",{innerHTML:s?.price?salla.money(s?.price):""})),s?.sale_price>0&&e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-sale"},e("span",{innerHTML:salla.money(s?.sale_price)}))),s?.quantity_in_group>0&&0!==s?.quantity&&e("p",{class:"s-multiple-bundle-product-cart-header-content-details-quantity"},e("span",null,salla.lang.get("pages.products.number_of_pieces")),e("span",null,s?.quantity_in_group)))),!l&&e("div",{class:"s-multiple-bundle-product-cart-header-remove-button"},this.renderRemoveButton(t,s,!1))))}render(){return e(s,{key:"34b9ae8c08eccee16d15f5ebff73b1d27f636e79",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"2f8d0bf68e67aa3bc21206d7282113fbfa67560b",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>t.products.map((l=>{const o={sectionId:t.id,sectionIndex:s,productId:l.id};return e("salla-accordion",{key:l.id,collapsed:!1,bordered:!0,collapsible:!!(l.options&&l.options.length>0),size:"sm",id:`accordion-${l.id}`},e("salla-accordion-head",null,this.renderAccordionHeader(String(t.id),l)),l.options&&l.options.length>0&&e("salla-accordion-body",null,e("salla-product-options",{options:JSON.stringify(l.options),key:`${l.id}-persistent`,"product-id":l.id,"bundle-context":JSON.stringify(o)}),e("div",{class:"s-multiple-bundle-product-cart-body-remove-button"},this.renderRemoveButton(String(t.id),l,!0))))}))))))}get host(){return l(this)}};d.style="";const a=class{constructor(e){t(this,e),this.sections=[],this.selectedProducts={},this.productSelectedHandler=null,this.onSelectProduct=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id,l=this.selectedProducts[t].has(s);l?(this.selectedProducts[t].delete(s),this.clearProductFormData(s,t),this.clearProductModalOptions(s,t)):this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options,wasSelected:l,isSelected:!l})},this.ensureProductSelected=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id;this.selectedProducts[t].has(s)||(this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options}))},this.onSelectProductOptions=(t,e)=>{const s=this.sections.findIndex((t=>t.id==e)),l=this.sections.find((t=>t.id==e)),o=l?.products?.findIndex((e=>e.id==t.id))??0;salla.event.dispatch("multiple-bundle-product-modal::open",{product:t,sectionId:e,sectionIndex:s,productIndex:o})},this.handleBundleSliderProductSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProduct(s,e)},this.handleBundleSliderProductOptionsSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProductOptions(e,s)}}clearProductFormData(t,e){const s=this.host.closest("form");if(e){const l=`bundle[${e}][`;Array.from(s.querySelectorAll("input")).filter((e=>e.getAttribute("data-product-id")===String(t)&&e.name&&e.name.startsWith(l))).forEach((t=>t.remove()))}else s.querySelectorAll(`[data-product-id="${t}"]`).forEach((t=>t.remove()))}clearProductModalOptions(t,e){let s=null,l=null;if(null!=e&&(s=this.sections.findIndex((t=>t.id==e)),s>-1)){const e=this.sections[s];if(e){const s=e.products?.findIndex((e=>e.id==t));l="number"==typeof s&&s>-1?s:null}}salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t,sectionId:e,sectionIndex:s,productIndex:l})}renderAccordionHeader(t,s){return e(o,null,e("h2",{slot:"title"},t?.name),t?.obligatory_products?e("span",{slot:"note"},salla.lang.get("pages.products.obligatory_products",{count:t?.obligatory_products||0})):"",e("span",{slot:"progress"},s,"/",t?.products?.length||0))}componentDidLoad(){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&(this.productSelectedHandler=t=>{const{productId:e,sectionId:s,product:l,fromModal:o}=t.detail;o?this.ensureProductSelected(s,l||{id:e}):this.onSelectProduct(s,l||{id:e})},t.addEventListener("productSelected",this.productSelectedHandler))}disconnectedCallback(){if(this.productSelectedHandler){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&t.removeEventListener("productSelected",this.productSelectedHandler),this.productSelectedHandler=null}}render(){return e(s,{key:"2a7a27e8bfc7325575fec782139828333590eb9f",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"affcb43ee67e329a9a87d6234bb91b5494a69a35",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>e("salla-accordion",{key:t.id,collapsed:0!==s},e("salla-accordion-head",null,this.renderAccordionHeader(t,this.selectedProducts[t.id]?.size||0)),e("salla-accordion-body",null,e("salla-multiple-bundle-product-slider",{section:t,sectionIndex:s,selectedProducts:this.selectedProducts,onProductSelected:this.handleBundleSliderProductSelected,onProductOptionsSelected:this.handleBundleSliderProductOptionsSelected})))))),e("salla-multiple-bundle-product-options-modal",{key:"6b9065e8f7872da72166979fc9ce61efaad21c0a"}))}get host(){return l(this)}};a.style="";export{d as salla_multiple_bundle_product_cart,a as salla_multiple_bundle_product_details}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as t,H as s}from"./p-
|
|
4
|
+
import{r as e,h as t,H as s}from"./p-CV1rqKQz.js";const a=class{constructor(t){e(this,t),this.href=void 0,this.target="_self"}generateClass(){return{"s-list-tile-item":!0,"s-list-tile-item-href":!!this.href}}render(){return t(s,{key:"1e84d5e259adbf61502fbe1ee771ce948c87f218"},t("a",{key:"5e28c64a0f1c62e6749a32859180e705f99af27e",class:this.generateClass(),href:this.href||"#",target:this.target,"aria-label":"List Tile Link"},t("div",{key:"ace3fdaae7332c4c23ab411f0b97cb0699c26ec2",class:"s-list-tile-item-icon"},t("slot",{key:"f8790cd45f2004691b156ef96d12a0f003d99899",name:"icon"})),t("div",{key:"a788d022e2afe3cd383c321f4100dafbae84f844",class:"s-list-tile-item-content"},t("div",{key:"a07afce13d054e11236ffb282901de9db3d23923",class:"s-list-tile-item-title"},t("slot",{key:"43c23495cfb026ddba8739dcc1a619ec25fe98e0",name:"title"})),t("div",{key:"db5e2767a4220ee5d658b3b9384c28d0e105febb",class:"s-list-tile-item-subtitle"},t("slot",{key:"245f602055419b1f32fa943805a72c6a207eea3f",name:"subtitle"}))),t("div",{key:"394a2d1402d3e8346cbc1ebd8d410405ed568c77",class:"s-list-tile-item-action"},t("slot",{key:"6086eb6b1f9894f5a3a77ca484c74dd06f0d468f",name:"action"}))))}};a.style="";export{a as salla_list_tile}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as e}from"./p-
|
|
4
|
+
import{r as s,h as t,H as e}from"./p-CV1rqKQz.js";const a=class{constructor(t){s(this,t),this.type="normal",this.width="100%",this.height="100%"}render(){return t(e,{key:"ad465a77b10e2f1d739c802643076f63985cfda5",class:"s-skeleton-wrapper",style:{width:this.width,height:this.height}},t("div",{key:"0b05bcfc21d3bcb85389a2a0c9b63c3a7aa28d60",class:{"s-skeleton-item":!0,"s-skeleton-item-circular":"circle"==this.type}}," "))}};a.style=":host{display:block}";export{a as salla_skeleton}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{d as t}from"./p-DcD0Zbyk.js";function n(t,n){return n.forEach((function(n){n&&"string"!=typeof n&&!Array.isArray(n)&&Object.keys(n).forEach((function(i){if("default"!==i&&!(i in t)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}}))})),Object.freeze(t)}var i,r={exports:{}},e=(i||(i=1,r.exports=function(){function t(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var i=[],r=!0,e=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(r=(o=u.next()).done)&&(i.push(o.value),i.length!==n);r=!0);}catch(t){e=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(e)throw a}}return i}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var n=function(t,n){return e(t.x*n,t.y*n)},i=function(t,n){return e(t.x+n.x,t.y+n.y)},r=function(t,n,i){var r=Math.cos(n),a=Math.sin(n),o=e(t.x-i.x,t.y-i.y);return e(i.x+r*o.x-a*o.y,i.y+a*o.x+r*o.y)},e=function(){return{x:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,y:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0}},a=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0;return"string"==typeof t?parseFloat(t)*i:"number"==typeof t?t*(r?n[r]:Math.min(n.width,n.height)):void 0},o=function(t){return null!=t},u=function(t,n){return Object.keys(n).forEach((function(i){return t.setAttribute(i,n[i])}))},c=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg",t);return n&&u(i,n),i},f={contain:"xMidYMid meet",cover:"xMidYMid slice"},E={left:"start",center:"middle",right:"end"},_=function(t){return function(n){return c(t,{id:n.id})}},s={image:function(t){var n=c("image",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0"});return n.onload=function(){n.setAttribute("opacity",t.opacity||1)},n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.src),n},rect:_("rect"),ellipse:_("ellipse"),text:_("text"),path:_("path"),line:function(t){var n=c("g",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round"}),i=c("line");n.appendChild(i);var r=c("path");n.appendChild(r);var e=c("path");return n.appendChild(e),n}},l={rect:function(t){return u(t,Object.assign({},t.rect,t.styles))},ellipse:function(t){return u(t,Object.assign({cx:t.rect.x+.5*t.rect.width,cy:t.rect.y+.5*t.rect.height,rx:.5*t.rect.width,ry:.5*t.rect.height},t.styles))},image:function(t,n){u(t,Object.assign({},t.rect,t.styles,{preserveAspectRatio:f[n.fit]||"none"}))},text:function(t,n,i,r){var e=a(n.fontSize,i,r);u(t,Object.assign({},t.rect,t.styles,{"stroke-width":0,"font-weight":n.fontWeight||"normal","font-size":e,"font-family":n.fontFamily||"sans-serif","text-anchor":E[n.textAlign]||"start"})),t.text!==n.text&&(t.text=n.text,t.textContent=n.text.length?n.text:" ")},path:function(t,n,i,r){var e;u(t,Object.assign({},t.styles,{fill:"none",d:(e=n.points.map((function(t){return{x:a(t.x,i,r,"width"),y:a(t.y,i,r,"height")}})),e.map((function(t,n){return"".concat(0===n?"M":"L"," ").concat(t.x," ").concat(t.y)})).join(" "))}))},line:function(t,o,c,f){u(t,Object.assign({},t.rect,t.styles,{fill:"none"}));var E=t.childNodes[1],_=t.childNodes[2],s=t.rect,l={x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height};if(u(t.childNodes[0],{x1:s.x,y1:s.y,x2:l.x,y2:l.y}),o.lineDecoration){E.style.display="none",_.style.display="none";var v=function(t){var n=Math.sqrt(t.x*t.x+t.y*t.y);return 0===n?{x:0,y:0}:e(t.x/n,t.y/n)}({x:l.x-s.x,y:l.y-s.y}),h=a(.05,c,f);if(-1!==o.lineDecoration.indexOf("arrow-begin")){var I=n(v,h),d=i(s,I),p=r(s,2,d),M=r(s,-2,d);u(E,{style:"display:block;",d:"M".concat(p.x,",").concat(p.y," L").concat(s.x,",").concat(s.y," L").concat(M.x,",").concat(M.y)})}if(-1!==o.lineDecoration.indexOf("arrow-end")){var g=n(v,-h),m=i(l,g),T=r(l,2,m),A=r(l,-2,m);u(_,{style:"display:block;",d:"M".concat(T.x,",").concat(T.y," L").concat(l.x,",").concat(l.y," L").concat(A.x,",").concat(A.y)})}}}},v=function(t,n,i,r,e){"path"!==n&&(t.rect=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=a(t.x,n,i,"width")||a(t.left,n,i,"width"),e=a(t.y,n,i,"height")||a(t.top,n,i,"height"),u=a(t.width,n,i,"width"),c=a(t.height,n,i,"height"),f=a(t.right,n,i,"width"),E=a(t.bottom,n,i,"height");return o(e)||(e=o(c)&&o(E)?n.height-c-E:E),o(r)||(r=o(u)&&o(f)?n.width-u-f:f),o(u)||(u=o(r)&&o(f)?n.width-r-f:0),o(c)||(c=o(e)&&o(E)?n.height-e-E:0),{x:r||0,y:e||0,width:u||0,height:c||0}}(i,r,e)),t.styles=function(t,n,i){var r=t.borderStyle||t.lineStyle||"solid",e=t.backgroundColor||t.fontColor||"transparent",o=t.borderColor||t.lineColor||"transparent",u=a(t.borderWidth||t.lineWidth,n,i);return{"stroke-linecap":t.lineCap||"round","stroke-linejoin":t.lineJoin||"round","stroke-width":u||0,"stroke-dasharray":"string"==typeof r?"":r.map((function(t){return a(t,n,i)})).join(","),stroke:o,fill:e,opacity:t.opacity||1}}(i,r,e),l[n](t,i,r,e)},h=["x","y","left","top","right","bottom","width","height"],I=function(n){var i=t(n,2),r=i[0],e=i[1],a=e.points?{}:h.reduce((function(t,n){return t[n]="string"==typeof(i=e[n])&&/%/.test(i)?parseFloat(i)/100:i,t;var i}),{});return[r,Object.assign({zIndex:0},e,a)]},d=function(t,n){return t[1].zIndex>n[1].zIndex?1:t[1].zIndex<n[1].zIndex?-1:0},p=function(n){return n.utils.createView({name:"image-preview-markup",tag:"svg",ignoreRect:!0,mixins:{apis:["width","height","crop","markup","resize","dirty"]},write:function(n){var i=n.root,r=n.props;if(r.dirty){var e=r.crop,a=r.resize,o=r.markup,u=r.width,c=r.height,f=e.width,E=e.height;if(a){var _=a.size,l=_&&_.width,h=_&&_.height,p=a.mode;l&&!h&&(h=l),h&&!l&&(l=h);var M=f<l&&E<h;if(!M||M&&a.upscale){var g,m=l/f,T=h/E;"force"===p?(f=l,E=h):("cover"===p?g=Math.max(m,T):"contain"===p&&(g=Math.min(m,T)),f*=g,E*=g)}}var A={width:u,height:c};i.element.setAttribute("width",A.width),i.element.setAttribute("height",A.height);var w=Math.min(u/f,c/E);i.element.innerHTML="";var R=i.query("GET_IMAGE_PREVIEW_MARKUP_FILTER");o.filter(R).map(I).sort(d).forEach((function(n){var r=t(n,2),e=r[0],a=r[1],o=function(t,n){return s[t](n)}(e,a);v(o,e,a,A,w),i.element.appendChild(o)}))}}})},M=function(t,n){return{x:t,y:n}},g=function(t,n){return M(t.x-n.x,t.y-n.y)},m=function(t,n){return Math.sqrt(function(t,n){return function(t,n){return t.x*n.x+t.y*n.y}(g(t,n),g(t,n))}(t,n))},T=function(t,n){var i=t,r=n,e=1.5707963267948966-n,a=Math.sin(1.5707963267948966),o=Math.sin(r),u=Math.sin(e),c=Math.cos(e),f=i/a;return M(c*(f*o),c*(f*u))},A=function(t,n,i,r){var e=2*(r.x>.5?1-r.x:r.x)*t.width,a=2*(r.y>.5?1-r.y:r.y)*t.height,o=function(t,n){var i=t.height,r=T(t.width,n),e=T(i,n),a=M(t.x+Math.abs(r.x),t.y-Math.abs(r.y)),o=M(t.x+t.width+Math.abs(e.y),t.y+Math.abs(e.x)),u=M(t.x-Math.abs(e.y),t.y+t.height-Math.abs(e.x));return{width:m(a,o),height:m(a,u)}}(n,i);return Math.max(o.width/e,o.height/a)},w=function(t,n){var i=t.width,r=i*n;return r>t.height&&(i=(r=t.height)/n),{x:.5*(t.width-i),y:.5*(t.height-r),width:i,height:r}},R=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.zoom,r=n.rotation,e=n.center,a=n.aspectRatio;a||(a=t.height/t.width);var o=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=t.height/t.width,e=1,a=r;a>n&&(e=(a=n)/r);var o=Math.max(1/e,n/a),u=t.width/(i*o*e);return{width:u,height:u*n}}(t,a,i),u=void 0===n.scaleToFit||n.scaleToFit,c=i*A(t,w({width:o.width,height:o.height},a),r,u?e:{x:.5,y:.5});return{widthFloat:o.width/c,heightFloat:o.height/c,width:Math.round(o.width/c),height:Math.round(o.height/c)}},y={type:"spring",stiffness:.5,damping:.45,mass:10},G=function(t){return t.utils.createView({name:"image-clip",tag:"div",ignoreRect:!0,mixins:{apis:["crop","markup","resize","width","height","dirty","background"],styles:["width","height","opacity"],animations:{opacity:{type:"tween",duration:250}}},didWriteView:function(t){var n=t.props;n.background&&(t.root.element.style.backgroundColor=n.background)},create:function(n){var i=n.root,r=n.props;i.ref.image=i.appendChildView(i.createChildView(function(t){return t.utils.createView({name:"image-canvas-wrapper",tag:"div",ignoreRect:!0,mixins:{apis:["crop","width","height"],styles:["originX","originY","translateX","translateY","scaleX","scaleY","rotateZ"],animations:{originX:y,originY:y,scaleX:y,scaleY:y,translateX:y,translateY:y,rotateZ:y}},create:function(n){var i=n.root,r=n.props;r.width=r.image.width,r.height=r.image.height,i.ref.bitmap=i.appendChildView(i.createChildView(function(t){return t.utils.createView({name:"image-bitmap",ignoreRect:!0,mixins:{styles:["scaleX","scaleY"]},create:function(t){t.root.appendChild(t.props.image)}})}(t),{image:r.image}))},write:function(t){var n=t.props.crop.flip,i=t.root.ref.bitmap;i.scaleX=n.horizontal?-1:1,i.scaleY=n.vertical?-1:1}})}(t),Object.assign({},r))),i.ref.createMarkup=function(){i.ref.markup||(i.ref.markup=i.appendChildView(i.createChildView(p(t),Object.assign({},r))))},i.ref.destroyMarkup=function(){i.ref.markup&&(i.removeChildView(i.ref.markup),i.ref.markup=null)};var e=i.query("GET_IMAGE_PREVIEW_TRANSPARENCY_INDICATOR");null!==e&&(i.element.dataset.transparencyIndicator="grid"===e?e:"color")},write:function(t){var n=t.root,i=t.props,r=t.shouldOptimize,e=i.crop,a=i.markup,o=i.resize,u=i.dirty,c=i.width,f=i.height;n.ref.image.crop=e;var E={width:c,height:f,center:{x:.5*c,y:.5*f}},_={width:n.ref.image.width,height:n.ref.image.height},s={x:e.center.x*_.width,y:e.center.y*_.height},l={x:E.center.x-_.width*e.center.x,y:E.center.y-_.height*e.center.y},v=2*Math.PI+e.rotation%(2*Math.PI),h=void 0===e.scaleToFit||e.scaleToFit,I=A(_,w(E,e.aspectRatio||_.height/_.width),v,h?e.center:{x:.5,y:.5}),d=e.zoom*I;a&&a.length?(n.ref.createMarkup(),n.ref.markup.width=c,n.ref.markup.height=f,n.ref.markup.resize=o,n.ref.markup.dirty=u,n.ref.markup.markup=a,n.ref.markup.crop=R(_,e)):n.ref.markup&&n.ref.destroyMarkup();var p=n.ref.image;if(r)return p.originX=null,p.originY=null,p.translateX=null,p.translateY=null,p.rotateZ=null,p.scaleX=null,void(p.scaleY=null);p.originX=s.x,p.originY=s.y,p.translateX=l.x,p.translateY=l.y,p.rotateZ=v,p.scaleX=d,p.scaleY=d}})},P=0,D=function(){self.onmessage=function(t){createImageBitmap(t.data.message.file).then((function(n){self.postMessage({id:t.data.id,message:n},[n])}))}},O=function(){self.onmessage=function(t){for(var n=t.data.message.imageData,i=t.data.message.colorMatrix,r=n.data,e=r.length,a=i[0],o=i[1],u=i[2],c=i[3],f=i[4],E=i[5],_=i[6],s=i[7],l=i[8],v=i[9],h=i[10],I=i[11],d=i[12],p=i[13],M=i[14],g=i[15],m=i[16],T=i[17],A=i[18],w=i[19],R=0,y=0,G=0,P=0,D=0;R<e;R+=4)y=r[R]/255,G=r[R+1]/255,P=r[R+2]/255,D=r[R+3]/255,r[R]=Math.max(0,Math.min(255*(y*a+G*o+P*u+D*c+f),255)),r[R+1]=Math.max(0,Math.min(255*(y*E+G*_+P*s+D*l+v),255)),r[R+2]=Math.max(0,Math.min(255*(y*h+G*I+P*d+D*p+M),255)),r[R+3]=Math.max(0,Math.min(255*(y*g+G*m+P*T+D*A+w),255));self.postMessage({id:t.data.id,message:n},[n.data.buffer])}},x={1:function(){return[1,0,0,1,0,0]},2:function(t){return[-1,0,0,1,t,0]},3:function(t,n){return[-1,0,0,-1,t,n]},4:function(t,n){return[1,0,0,-1,0,n]},5:function(){return[0,1,1,0,0,0]},6:function(t,n){return[0,1,-1,0,n,0]},7:function(t,n){return[0,-1,-1,0,n,t]},8:function(t){return[0,-1,1,0,0,t]}},L=function(t,n,i,r){n=Math.round(n),i=Math.round(i);var e=document.createElement("canvas");e.width=n,e.height=i;var a=e.getContext("2d");if(r>=5&&r<=8){var o=[i,n];n=o[0],i=o[1]}return function(t,n,i,r){-1!==r&&t.transform.apply(t,x[r](n,i))}(a,n,i,r),a.drawImage(t,0,0,n,i),e},C=function(t){return/^image/.test(t.type)&&!/svg/.test(t.type)},W=function(t){var n=Math.min(10/t.width,10/t.height),i=document.createElement("canvas"),r=i.getContext("2d"),e=i.width=Math.ceil(t.width*n),a=i.height=Math.ceil(t.height*n);r.drawImage(t,0,0,e,a);var o=null;try{o=r.getImageData(0,0,e,a).data}catch(t){return null}for(var u=o.length,c=0,f=0,E=0,_=0;_<u;_+=4)c+=o[_]*o[_],f+=o[_+1]*o[_+1],E+=o[_+2]*o[_+2];return{r:c=S(c,u),g:f=S(f,u),b:E=S(E,u)}},S=function(t,n){return Math.floor(Math.sqrt(t/(n/4)))},k=function(t){var n=t.utils.createView({name:"image-preview-overlay",tag:"div",ignoreRect:!0,create:function(t){var n=t.root,i=t.props,r='<svg width="500" height="200" viewBox="0 0 500 200" preserveAspectRatio="none">\n <defs>\n <radialGradient id="gradient-__UID__" cx=".5" cy="1.25" r="1.15">\n <stop offset=\'50%\' stop-color=\'#000000\'/>\n <stop offset=\'56%\' stop-color=\'#0a0a0a\'/>\n <stop offset=\'63%\' stop-color=\'#262626\'/>\n <stop offset=\'69%\' stop-color=\'#4f4f4f\'/>\n <stop offset=\'75%\' stop-color=\'#808080\'/>\n <stop offset=\'81%\' stop-color=\'#b1b1b1\'/>\n <stop offset=\'88%\' stop-color=\'#dadada\'/>\n <stop offset=\'94%\' stop-color=\'#f6f6f6\'/>\n <stop offset=\'100%\' stop-color=\'#ffffff\'/>\n </radialGradient>\n <mask id="mask-__UID__">\n <rect x="0" y="0" width="500" height="200" fill="url(#gradient-__UID__)"></rect>\n </mask>\n </defs>\n <rect x="0" width="500" height="200" fill="currentColor" mask="url(#mask-__UID__)"></rect>\n</svg>';if(document.querySelector("base")){var e=new URL(window.location.href.replace(window.location.hash,"")).href;r=r.replace(/url\(\#/g,"url("+e+"#")}P++,n.element.classList.add("filepond--image-preview-overlay-".concat(i.status)),n.element.innerHTML=r.replace(/__UID__/g,P)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}}),i=function(t){return t.utils.createView({name:"image-preview",tag:"div",ignoreRect:!0,mixins:{apis:["image","crop","markup","resize","dirty","background"],styles:["translateY","scaleX","scaleY","opacity"],animations:{scaleX:y,scaleY:y,translateY:y,opacity:{type:"tween",duration:400}}},create:function(n){var i=n.root,r=n.props;i.ref.clip=i.appendChildView(i.createChildView(G(t),{id:r.id,image:r.image,crop:r.crop,markup:r.markup,resize:r.resize,dirty:r.dirty,background:r.background}))},write:function(t){var n=t.root,i=t.props,r=t.shouldOptimize,e=n.ref.clip,a=i.image,o=i.crop,u=i.markup,c=i.resize,f=i.dirty;if(e.crop=o,e.markup=u,e.resize=c,e.dirty=f,e.opacity=r?0:1,!r&&!n.rect.element.hidden){var E=o.aspectRatio||a.height/a.width,_=n.rect.inner.width,s=n.rect.inner.height,l=n.query("GET_IMAGE_PREVIEW_HEIGHT"),v=n.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),h=n.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),I=n.query("GET_PANEL_ASPECT_RATIO"),d=n.query("GET_ALLOW_MULTIPLE");I&&!d&&(l=_*I,E=I);var p=null!==l?l:Math.max(v,Math.min(_*E,h)),M=p/E;M>_&&(p=(M=_)*E),p>s&&(p=s,M=s/E),e.width=M,e.height=p}}})}(t),r=t.utils.createWorker,e=function(t,n,i){return new Promise((function(e){t.ref.imageData||(t.ref.imageData=i.getContext("2d").getImageData(0,0,i.width,i.height));var a=function(t){var n;try{n=new ImageData(t.width,t.height)}catch(i){n=document.createElement("canvas").getContext("2d").createImageData(t.width,t.height)}return n.data.set(new Uint8ClampedArray(t.data)),n}(t.ref.imageData);if(!n||20!==n.length)return i.getContext("2d").putImageData(a,0,0),e();var o=r(O);o.post({imageData:a,colorMatrix:n},(function(t){i.getContext("2d").putImageData(t,0,0),o.terminate(),e()}),[a.data.buffer])}))},a=function(t){var n=t.root,r=t.image,e=t.props.id,a=n.query("GET_ITEM",{id:e});if(a){var o,u,c=a.getMetadata("crop")||{center:{x:.5,y:.5},flip:{horizontal:!1,vertical:!1},zoom:1,rotation:0,aspectRatio:null},f=n.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),E=!1;n.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(o=a.getMetadata("markup")||[],u=a.getMetadata("resize"),E=!0);var _=n.appendChildView(n.createChildView(i,{id:e,image:r,crop:c,resize:u,markup:o,dirty:E,background:f,opacity:0,scaleX:1.15,scaleY:1.15,translateY:15}),n.childViews.length);n.ref.images.push(_),_.opacity=1,_.scaleX=1,_.scaleY=1,_.translateY=0,setTimeout((function(){n.dispatch("DID_IMAGE_PREVIEW_SHOW",{id:e})}),250)}},o=function(t){var n=t.root;n.ref.overlayShadow.opacity=1,n.ref.overlayError.opacity=0,n.ref.overlaySuccess.opacity=0},u=function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlayError.opacity=1};return t.utils.createView({name:"image-preview-wrapper",create:function(t){var i=t.root;i.ref.images=[],i.ref.imageData=null,i.ref.imageViewBin=[],i.ref.overlayShadow=i.appendChildView(i.createChildView(n,{opacity:0,status:"idle"})),i.ref.overlaySuccess=i.appendChildView(i.createChildView(n,{opacity:0,status:"success"})),i.ref.overlayError=i.appendChildView(i.createChildView(n,{opacity:0,status:"failure"}))},styles:["height"],apis:["height"],destroy:function(t){t.root.ref.images.forEach((function(t){t.image.width=1,t.image.height=1}))},didWriteView:function(t){t.root.ref.images.forEach((function(t){t.dirty=!1}))},write:t.utils.createRoute({DID_IMAGE_PREVIEW_DRAW:function(t){var n=t.root,i=n.ref.images[n.ref.images.length-1];i.translateY=0,i.scaleX=1,i.scaleY=1,i.opacity=1},DID_IMAGE_PREVIEW_CONTAINER_CREATE:function(t){var n,i,r,e=t.root,a=t.props.id,o=e.query("GET_ITEM",a);if(o){var u=URL.createObjectURL(o.file);n=u,i=function(t,n){e.dispatch("DID_IMAGE_PREVIEW_CALCULATE_SIZE",{id:a,width:t,height:n})},(r=new Image).onload=function(){var t=r.naturalWidth,n=r.naturalHeight;r=null,i(t,n)},r.src=n}},DID_FINISH_CALCULATE_PREVIEWSIZE:function(t){var n,i,o,u=t.root,c=t.props,f=u.query("GET_ITEM",c.id);if(f){var E=URL.createObjectURL(f.file),_=function(){var t;(t=E,new Promise((function(n,i){var r=new Image;r.crossOrigin="Anonymous",r.onload=function(){n(r)},r.onerror=function(t){i(t)},r.src=t}))).then(s)},s=function(t){URL.revokeObjectURL(E);var n=(f.getMetadata("exif")||{}).orientation||-1,i=t.width,r=t.height;if(i&&r){if(n>=5&&n<=8){var o=[r,i];i=o[0],r=o[1]}var _=Math.max(1,.75*window.devicePixelRatio),s=u.query("GET_IMAGE_PREVIEW_ZOOM_FACTOR")*_,l=r/i,v=u.rect.element.width,h=u.rect.element.height,I=v,d=I*l;l>1?d=(I=Math.min(i,v*s))*l:I=(d=Math.min(r,h*s))/l;var p=L(t,I,d,n),M=function(){var n=u.query("GET_IMAGE_PREVIEW_CALCULATE_AVERAGE_IMAGE_COLOR")?W(data):null;f.setMetadata("color",n,!0),"close"in t&&t.close(),u.ref.overlayShadow.opacity=1,a({root:u,props:c,image:p})},g=f.getMetadata("filter");g?e(u,g,p).then(M):M()}};if(n=f.file,i=window.navigator.userAgent.match(/Firefox\/([0-9]+)\./),null!==(o=i?parseInt(i[1]):null)&&o<=58||!("createImageBitmap"in window)||!C(n))_();else{var l=r(D);l.post({file:f.file},(function(t){l.terminate(),t?s(t):_()}))}}},DID_UPDATE_ITEM_METADATA:function(t){var n,i,r=t.root,o=t.props,u=t.action;if(/crop|filter|markup|resize/.test(u.change.key)&&r.ref.images.length){var c=r.query("GET_ITEM",{id:o.id});if(c)if(/filter/.test(u.change.key))e(r,u.change.value,r.ref.images[r.ref.images.length-1].image);else if(/crop|markup|resize/.test(u.change.key)){var f=c.getMetadata("crop"),E=r.ref.images[r.ref.images.length-1];if(f&&f.aspectRatio&&E.crop&&E.crop.aspectRatio&&Math.abs(f.aspectRatio-E.crop.aspectRatio)>1e-5){var _=function(t){var n=t.root,i=n.ref.images.shift();return i.opacity=0,i.translateY=-15,n.ref.imageViewBin.push(i),i}({root:r});a({root:r,props:o,image:(n=_.image,(i=i||document.createElement("canvas")).width=n.width,i.height=n.height,i.getContext("2d").drawImage(n,0,0),i)})}else!function(t){var n=t.root,i=n.query("GET_ITEM",{id:t.props.id});if(i){var r=n.ref.images[n.ref.images.length-1];r.crop=i.getMetadata("crop"),r.background=n.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),n.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(r.dirty=!0,r.resize=i.getMetadata("resize"),r.markup=i.getMetadata("markup"))}}({root:r,props:o})}}},DID_THROW_ITEM_LOAD_ERROR:u,DID_THROW_ITEM_PROCESSING_ERROR:u,DID_THROW_ITEM_INVALID:u,DID_COMPLETE_ITEM_PROCESSING:function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlaySuccess.opacity=1},DID_START_ITEM_PROCESSING:o,DID_REVERT_ITEM_PROCESSING:o},(function(t){var n=t.root,i=n.ref.imageViewBin.filter((function(t){return 0===t.opacity}));n.ref.imageViewBin=n.ref.imageViewBin.filter((function(t){return t.opacity>0})),i.forEach((function(t){return function(t,n){t.removeChildView(n),n.image.width=1,n.image.height=1,n._destroy()}(n,t)})),i.length=0}))})},V=function(t){var n=t.addFilter,i=t.utils,r=i.Type,e=i.createRoute,a=i.isFile,o=k(t);return n("CREATE_VIEW",(function(t){var n=t.view,i=t.query;if((0,t.is)("file")&&i("GET_ALLOW_IMAGE_PREVIEW")){var r=function(t){t.root.ref.shouldRescale=!0};n.registerWriter(e({DID_RESIZE_ROOT:r,DID_STOP_RESIZE:r,DID_LOAD_ITEM:function(t){var r=t.root,e=t.props.id,u=i("GET_ITEM",e);if(u&&a(u.file)&&!u.archived){var c=u.file;if(function(t){return/^image/.test(t.type)}(c)&&i("GET_IMAGE_PREVIEW_FILTER_ITEM")(u)){var f="createImageBitmap"in(window||{}),E=i("GET_IMAGE_PREVIEW_MAX_FILE_SIZE");if(!(!f&&E&&c.size>E)){r.ref.imagePreview=n.appendChildView(n.createChildView(o,{id:e}));var _=r.query("GET_IMAGE_PREVIEW_HEIGHT");_&&r.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:u.id,height:_});var s=!f&&c.size>i("GET_IMAGE_PREVIEW_MAX_INSTANT_PREVIEW_FILE_SIZE");r.dispatch("DID_IMAGE_PREVIEW_CONTAINER_CREATE",{id:e},s)}}}},DID_IMAGE_PREVIEW_CALCULATE_SIZE:function(t){var n=t.root,i=t.action;n.ref.imageWidth=i.width,n.ref.imageHeight=i.height,n.ref.shouldRescale=!0,n.ref.shouldDrawPreview=!0,n.dispatch("KICK")},DID_UPDATE_ITEM_METADATA:function(t){"crop"===t.action.change.key&&(t.root.ref.shouldRescale=!0)}},(function(t){var n=t.root,i=t.props;n.ref.imagePreview&&(n.rect.element.hidden||(n.ref.shouldRescale&&(function(t,n){if(t.ref.imagePreview){var i=t.query("GET_ITEM",{id:n.id});if(i){var r=t.query("GET_PANEL_ASPECT_RATIO"),e=t.query("GET_ITEM_PANEL_ASPECT_RATIO"),a=t.query("GET_IMAGE_PREVIEW_HEIGHT");if(!(r||e||a)){var o=t.ref,u=o.imageWidth,c=o.imageHeight;if(u&&c){var f=t.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),E=t.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),_=(i.getMetadata("exif")||{}).orientation||-1;if(_>=5&&_<=8){var s=[c,u];u=s[0],c=s[1]}if(!C(i.file)||t.query("GET_IMAGE_PREVIEW_UPSCALE")){var l=2048/u;u*=l,c*=l}var v=c/u,h=(i.getMetadata("crop")||{}).aspectRatio||v,I=Math.max(f,Math.min(c,E)),d=Math.min(t.rect.element.width*h,I);t.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:i.id,height:d})}}}}}(n,i),n.ref.shouldRescale=!1),n.ref.shouldDrawPreview&&(requestAnimationFrame((function(){requestAnimationFrame((function(){n.dispatch("DID_FINISH_CALCULATE_PREVIEWSIZE",{id:i.id})}))})),n.ref.shouldDrawPreview=!1)))})))}})),{options:{allowImagePreview:[!0,r.BOOLEAN],imagePreviewFilterItem:[function(){return!0},r.FUNCTION],imagePreviewHeight:[null,r.INT],imagePreviewMinHeight:[44,r.INT],imagePreviewMaxHeight:[256,r.INT],imagePreviewMaxFileSize:[null,r.INT],imagePreviewZoomFactor:[2,r.INT],imagePreviewUpscale:[!1,r.BOOLEAN],imagePreviewMaxInstantPreviewFileSize:[1e6,r.INT],imagePreviewTransparencyIndicator:[null,r.STRING],imagePreviewCalculateAverageImageColor:[!1,r.BOOLEAN],imagePreviewMarkupShow:[!0,r.BOOLEAN],imagePreviewMarkupFilter:[function(){return!0},r.FUNCTION]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:V})),V}()),r.exports),a=n({__proto__:null,default:t(e)},[e]);
|
|
4
|
+
import{d as t}from"./p-CV1rqKQz.js";function n(t,n){return n.forEach((function(n){n&&"string"!=typeof n&&!Array.isArray(n)&&Object.keys(n).forEach((function(i){if("default"!==i&&!(i in t)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}}))})),Object.freeze(t)}var i,r={exports:{}},e=(i||(i=1,r.exports=function(){function t(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var i=[],r=!0,e=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(r=(o=u.next()).done)&&(i.push(o.value),i.length!==n);r=!0);}catch(t){e=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(e)throw a}}return i}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var n=function(t,n){return e(t.x*n,t.y*n)},i=function(t,n){return e(t.x+n.x,t.y+n.y)},r=function(t,n,i){var r=Math.cos(n),a=Math.sin(n),o=e(t.x-i.x,t.y-i.y);return e(i.x+r*o.x-a*o.y,i.y+a*o.x+r*o.y)},e=function(){return{x:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,y:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0}},a=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0;return"string"==typeof t?parseFloat(t)*i:"number"==typeof t?t*(r?n[r]:Math.min(n.width,n.height)):void 0},o=function(t){return null!=t},u=function(t,n){return Object.keys(n).forEach((function(i){return t.setAttribute(i,n[i])}))},c=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg",t);return n&&u(i,n),i},f={contain:"xMidYMid meet",cover:"xMidYMid slice"},E={left:"start",center:"middle",right:"end"},_=function(t){return function(n){return c(t,{id:n.id})}},s={image:function(t){var n=c("image",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0"});return n.onload=function(){n.setAttribute("opacity",t.opacity||1)},n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.src),n},rect:_("rect"),ellipse:_("ellipse"),text:_("text"),path:_("path"),line:function(t){var n=c("g",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round"}),i=c("line");n.appendChild(i);var r=c("path");n.appendChild(r);var e=c("path");return n.appendChild(e),n}},l={rect:function(t){return u(t,Object.assign({},t.rect,t.styles))},ellipse:function(t){return u(t,Object.assign({cx:t.rect.x+.5*t.rect.width,cy:t.rect.y+.5*t.rect.height,rx:.5*t.rect.width,ry:.5*t.rect.height},t.styles))},image:function(t,n){u(t,Object.assign({},t.rect,t.styles,{preserveAspectRatio:f[n.fit]||"none"}))},text:function(t,n,i,r){var e=a(n.fontSize,i,r);u(t,Object.assign({},t.rect,t.styles,{"stroke-width":0,"font-weight":n.fontWeight||"normal","font-size":e,"font-family":n.fontFamily||"sans-serif","text-anchor":E[n.textAlign]||"start"})),t.text!==n.text&&(t.text=n.text,t.textContent=n.text.length?n.text:" ")},path:function(t,n,i,r){var e;u(t,Object.assign({},t.styles,{fill:"none",d:(e=n.points.map((function(t){return{x:a(t.x,i,r,"width"),y:a(t.y,i,r,"height")}})),e.map((function(t,n){return"".concat(0===n?"M":"L"," ").concat(t.x," ").concat(t.y)})).join(" "))}))},line:function(t,o,c,f){u(t,Object.assign({},t.rect,t.styles,{fill:"none"}));var E=t.childNodes[1],_=t.childNodes[2],s=t.rect,l={x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height};if(u(t.childNodes[0],{x1:s.x,y1:s.y,x2:l.x,y2:l.y}),o.lineDecoration){E.style.display="none",_.style.display="none";var v=function(t){var n=Math.sqrt(t.x*t.x+t.y*t.y);return 0===n?{x:0,y:0}:e(t.x/n,t.y/n)}({x:l.x-s.x,y:l.y-s.y}),h=a(.05,c,f);if(-1!==o.lineDecoration.indexOf("arrow-begin")){var I=n(v,h),d=i(s,I),p=r(s,2,d),M=r(s,-2,d);u(E,{style:"display:block;",d:"M".concat(p.x,",").concat(p.y," L").concat(s.x,",").concat(s.y," L").concat(M.x,",").concat(M.y)})}if(-1!==o.lineDecoration.indexOf("arrow-end")){var g=n(v,-h),m=i(l,g),T=r(l,2,m),A=r(l,-2,m);u(_,{style:"display:block;",d:"M".concat(T.x,",").concat(T.y," L").concat(l.x,",").concat(l.y," L").concat(A.x,",").concat(A.y)})}}}},v=function(t,n,i,r,e){"path"!==n&&(t.rect=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=a(t.x,n,i,"width")||a(t.left,n,i,"width"),e=a(t.y,n,i,"height")||a(t.top,n,i,"height"),u=a(t.width,n,i,"width"),c=a(t.height,n,i,"height"),f=a(t.right,n,i,"width"),E=a(t.bottom,n,i,"height");return o(e)||(e=o(c)&&o(E)?n.height-c-E:E),o(r)||(r=o(u)&&o(f)?n.width-u-f:f),o(u)||(u=o(r)&&o(f)?n.width-r-f:0),o(c)||(c=o(e)&&o(E)?n.height-e-E:0),{x:r||0,y:e||0,width:u||0,height:c||0}}(i,r,e)),t.styles=function(t,n,i){var r=t.borderStyle||t.lineStyle||"solid",e=t.backgroundColor||t.fontColor||"transparent",o=t.borderColor||t.lineColor||"transparent",u=a(t.borderWidth||t.lineWidth,n,i);return{"stroke-linecap":t.lineCap||"round","stroke-linejoin":t.lineJoin||"round","stroke-width":u||0,"stroke-dasharray":"string"==typeof r?"":r.map((function(t){return a(t,n,i)})).join(","),stroke:o,fill:e,opacity:t.opacity||1}}(i,r,e),l[n](t,i,r,e)},h=["x","y","left","top","right","bottom","width","height"],I=function(n){var i=t(n,2),r=i[0],e=i[1],a=e.points?{}:h.reduce((function(t,n){return t[n]="string"==typeof(i=e[n])&&/%/.test(i)?parseFloat(i)/100:i,t;var i}),{});return[r,Object.assign({zIndex:0},e,a)]},d=function(t,n){return t[1].zIndex>n[1].zIndex?1:t[1].zIndex<n[1].zIndex?-1:0},p=function(n){return n.utils.createView({name:"image-preview-markup",tag:"svg",ignoreRect:!0,mixins:{apis:["width","height","crop","markup","resize","dirty"]},write:function(n){var i=n.root,r=n.props;if(r.dirty){var e=r.crop,a=r.resize,o=r.markup,u=r.width,c=r.height,f=e.width,E=e.height;if(a){var _=a.size,l=_&&_.width,h=_&&_.height,p=a.mode;l&&!h&&(h=l),h&&!l&&(l=h);var M=f<l&&E<h;if(!M||M&&a.upscale){var g,m=l/f,T=h/E;"force"===p?(f=l,E=h):("cover"===p?g=Math.max(m,T):"contain"===p&&(g=Math.min(m,T)),f*=g,E*=g)}}var A={width:u,height:c};i.element.setAttribute("width",A.width),i.element.setAttribute("height",A.height);var w=Math.min(u/f,c/E);i.element.innerHTML="";var R=i.query("GET_IMAGE_PREVIEW_MARKUP_FILTER");o.filter(R).map(I).sort(d).forEach((function(n){var r=t(n,2),e=r[0],a=r[1],o=function(t,n){return s[t](n)}(e,a);v(o,e,a,A,w),i.element.appendChild(o)}))}}})},M=function(t,n){return{x:t,y:n}},g=function(t,n){return M(t.x-n.x,t.y-n.y)},m=function(t,n){return Math.sqrt(function(t,n){return function(t,n){return t.x*n.x+t.y*n.y}(g(t,n),g(t,n))}(t,n))},T=function(t,n){var i=t,r=n,e=1.5707963267948966-n,a=Math.sin(1.5707963267948966),o=Math.sin(r),u=Math.sin(e),c=Math.cos(e),f=i/a;return M(c*(f*o),c*(f*u))},A=function(t,n,i,r){var e=2*(r.x>.5?1-r.x:r.x)*t.width,a=2*(r.y>.5?1-r.y:r.y)*t.height,o=function(t,n){var i=t.height,r=T(t.width,n),e=T(i,n),a=M(t.x+Math.abs(r.x),t.y-Math.abs(r.y)),o=M(t.x+t.width+Math.abs(e.y),t.y+Math.abs(e.x)),u=M(t.x-Math.abs(e.y),t.y+t.height-Math.abs(e.x));return{width:m(a,o),height:m(a,u)}}(n,i);return Math.max(o.width/e,o.height/a)},w=function(t,n){var i=t.width,r=i*n;return r>t.height&&(i=(r=t.height)/n),{x:.5*(t.width-i),y:.5*(t.height-r),width:i,height:r}},R=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.zoom,r=n.rotation,e=n.center,a=n.aspectRatio;a||(a=t.height/t.width);var o=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=t.height/t.width,e=1,a=r;a>n&&(e=(a=n)/r);var o=Math.max(1/e,n/a),u=t.width/(i*o*e);return{width:u,height:u*n}}(t,a,i),u=void 0===n.scaleToFit||n.scaleToFit,c=i*A(t,w({width:o.width,height:o.height},a),r,u?e:{x:.5,y:.5});return{widthFloat:o.width/c,heightFloat:o.height/c,width:Math.round(o.width/c),height:Math.round(o.height/c)}},y={type:"spring",stiffness:.5,damping:.45,mass:10},G=function(t){return t.utils.createView({name:"image-clip",tag:"div",ignoreRect:!0,mixins:{apis:["crop","markup","resize","width","height","dirty","background"],styles:["width","height","opacity"],animations:{opacity:{type:"tween",duration:250}}},didWriteView:function(t){var n=t.props;n.background&&(t.root.element.style.backgroundColor=n.background)},create:function(n){var i=n.root,r=n.props;i.ref.image=i.appendChildView(i.createChildView(function(t){return t.utils.createView({name:"image-canvas-wrapper",tag:"div",ignoreRect:!0,mixins:{apis:["crop","width","height"],styles:["originX","originY","translateX","translateY","scaleX","scaleY","rotateZ"],animations:{originX:y,originY:y,scaleX:y,scaleY:y,translateX:y,translateY:y,rotateZ:y}},create:function(n){var i=n.root,r=n.props;r.width=r.image.width,r.height=r.image.height,i.ref.bitmap=i.appendChildView(i.createChildView(function(t){return t.utils.createView({name:"image-bitmap",ignoreRect:!0,mixins:{styles:["scaleX","scaleY"]},create:function(t){t.root.appendChild(t.props.image)}})}(t),{image:r.image}))},write:function(t){var n=t.props.crop.flip,i=t.root.ref.bitmap;i.scaleX=n.horizontal?-1:1,i.scaleY=n.vertical?-1:1}})}(t),Object.assign({},r))),i.ref.createMarkup=function(){i.ref.markup||(i.ref.markup=i.appendChildView(i.createChildView(p(t),Object.assign({},r))))},i.ref.destroyMarkup=function(){i.ref.markup&&(i.removeChildView(i.ref.markup),i.ref.markup=null)};var e=i.query("GET_IMAGE_PREVIEW_TRANSPARENCY_INDICATOR");null!==e&&(i.element.dataset.transparencyIndicator="grid"===e?e:"color")},write:function(t){var n=t.root,i=t.props,r=t.shouldOptimize,e=i.crop,a=i.markup,o=i.resize,u=i.dirty,c=i.width,f=i.height;n.ref.image.crop=e;var E={width:c,height:f,center:{x:.5*c,y:.5*f}},_={width:n.ref.image.width,height:n.ref.image.height},s={x:e.center.x*_.width,y:e.center.y*_.height},l={x:E.center.x-_.width*e.center.x,y:E.center.y-_.height*e.center.y},v=2*Math.PI+e.rotation%(2*Math.PI),h=void 0===e.scaleToFit||e.scaleToFit,I=A(_,w(E,e.aspectRatio||_.height/_.width),v,h?e.center:{x:.5,y:.5}),d=e.zoom*I;a&&a.length?(n.ref.createMarkup(),n.ref.markup.width=c,n.ref.markup.height=f,n.ref.markup.resize=o,n.ref.markup.dirty=u,n.ref.markup.markup=a,n.ref.markup.crop=R(_,e)):n.ref.markup&&n.ref.destroyMarkup();var p=n.ref.image;if(r)return p.originX=null,p.originY=null,p.translateX=null,p.translateY=null,p.rotateZ=null,p.scaleX=null,void(p.scaleY=null);p.originX=s.x,p.originY=s.y,p.translateX=l.x,p.translateY=l.y,p.rotateZ=v,p.scaleX=d,p.scaleY=d}})},P=0,D=function(){self.onmessage=function(t){createImageBitmap(t.data.message.file).then((function(n){self.postMessage({id:t.data.id,message:n},[n])}))}},O=function(){self.onmessage=function(t){for(var n=t.data.message.imageData,i=t.data.message.colorMatrix,r=n.data,e=r.length,a=i[0],o=i[1],u=i[2],c=i[3],f=i[4],E=i[5],_=i[6],s=i[7],l=i[8],v=i[9],h=i[10],I=i[11],d=i[12],p=i[13],M=i[14],g=i[15],m=i[16],T=i[17],A=i[18],w=i[19],R=0,y=0,G=0,P=0,D=0;R<e;R+=4)y=r[R]/255,G=r[R+1]/255,P=r[R+2]/255,D=r[R+3]/255,r[R]=Math.max(0,Math.min(255*(y*a+G*o+P*u+D*c+f),255)),r[R+1]=Math.max(0,Math.min(255*(y*E+G*_+P*s+D*l+v),255)),r[R+2]=Math.max(0,Math.min(255*(y*h+G*I+P*d+D*p+M),255)),r[R+3]=Math.max(0,Math.min(255*(y*g+G*m+P*T+D*A+w),255));self.postMessage({id:t.data.id,message:n},[n.data.buffer])}},x={1:function(){return[1,0,0,1,0,0]},2:function(t){return[-1,0,0,1,t,0]},3:function(t,n){return[-1,0,0,-1,t,n]},4:function(t,n){return[1,0,0,-1,0,n]},5:function(){return[0,1,1,0,0,0]},6:function(t,n){return[0,1,-1,0,n,0]},7:function(t,n){return[0,-1,-1,0,n,t]},8:function(t){return[0,-1,1,0,0,t]}},L=function(t,n,i,r){n=Math.round(n),i=Math.round(i);var e=document.createElement("canvas");e.width=n,e.height=i;var a=e.getContext("2d");if(r>=5&&r<=8){var o=[i,n];n=o[0],i=o[1]}return function(t,n,i,r){-1!==r&&t.transform.apply(t,x[r](n,i))}(a,n,i,r),a.drawImage(t,0,0,n,i),e},C=function(t){return/^image/.test(t.type)&&!/svg/.test(t.type)},W=function(t){var n=Math.min(10/t.width,10/t.height),i=document.createElement("canvas"),r=i.getContext("2d"),e=i.width=Math.ceil(t.width*n),a=i.height=Math.ceil(t.height*n);r.drawImage(t,0,0,e,a);var o=null;try{o=r.getImageData(0,0,e,a).data}catch(t){return null}for(var u=o.length,c=0,f=0,E=0,_=0;_<u;_+=4)c+=o[_]*o[_],f+=o[_+1]*o[_+1],E+=o[_+2]*o[_+2];return{r:c=S(c,u),g:f=S(f,u),b:E=S(E,u)}},S=function(t,n){return Math.floor(Math.sqrt(t/(n/4)))},V=function(t){var n=t.utils.createView({name:"image-preview-overlay",tag:"div",ignoreRect:!0,create:function(t){var n=t.root,i=t.props,r='<svg width="500" height="200" viewBox="0 0 500 200" preserveAspectRatio="none">\n <defs>\n <radialGradient id="gradient-__UID__" cx=".5" cy="1.25" r="1.15">\n <stop offset=\'50%\' stop-color=\'#000000\'/>\n <stop offset=\'56%\' stop-color=\'#0a0a0a\'/>\n <stop offset=\'63%\' stop-color=\'#262626\'/>\n <stop offset=\'69%\' stop-color=\'#4f4f4f\'/>\n <stop offset=\'75%\' stop-color=\'#808080\'/>\n <stop offset=\'81%\' stop-color=\'#b1b1b1\'/>\n <stop offset=\'88%\' stop-color=\'#dadada\'/>\n <stop offset=\'94%\' stop-color=\'#f6f6f6\'/>\n <stop offset=\'100%\' stop-color=\'#ffffff\'/>\n </radialGradient>\n <mask id="mask-__UID__">\n <rect x="0" y="0" width="500" height="200" fill="url(#gradient-__UID__)"></rect>\n </mask>\n </defs>\n <rect x="0" width="500" height="200" fill="currentColor" mask="url(#mask-__UID__)"></rect>\n</svg>';if(document.querySelector("base")){var e=new URL(window.location.href.replace(window.location.hash,"")).href;r=r.replace(/url\(\#/g,"url("+e+"#")}P++,n.element.classList.add("filepond--image-preview-overlay-".concat(i.status)),n.element.innerHTML=r.replace(/__UID__/g,P)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}}),i=function(t){return t.utils.createView({name:"image-preview",tag:"div",ignoreRect:!0,mixins:{apis:["image","crop","markup","resize","dirty","background"],styles:["translateY","scaleX","scaleY","opacity"],animations:{scaleX:y,scaleY:y,translateY:y,opacity:{type:"tween",duration:400}}},create:function(n){var i=n.root,r=n.props;i.ref.clip=i.appendChildView(i.createChildView(G(t),{id:r.id,image:r.image,crop:r.crop,markup:r.markup,resize:r.resize,dirty:r.dirty,background:r.background}))},write:function(t){var n=t.root,i=t.props,r=t.shouldOptimize,e=n.ref.clip,a=i.image,o=i.crop,u=i.markup,c=i.resize,f=i.dirty;if(e.crop=o,e.markup=u,e.resize=c,e.dirty=f,e.opacity=r?0:1,!r&&!n.rect.element.hidden){var E=o.aspectRatio||a.height/a.width,_=n.rect.inner.width,s=n.rect.inner.height,l=n.query("GET_IMAGE_PREVIEW_HEIGHT"),v=n.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),h=n.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),I=n.query("GET_PANEL_ASPECT_RATIO"),d=n.query("GET_ALLOW_MULTIPLE");I&&!d&&(l=_*I,E=I);var p=null!==l?l:Math.max(v,Math.min(_*E,h)),M=p/E;M>_&&(p=(M=_)*E),p>s&&(p=s,M=s/E),e.width=M,e.height=p}}})}(t),r=t.utils.createWorker,e=function(t,n,i){return new Promise((function(e){t.ref.imageData||(t.ref.imageData=i.getContext("2d").getImageData(0,0,i.width,i.height));var a=function(t){var n;try{n=new ImageData(t.width,t.height)}catch(i){n=document.createElement("canvas").getContext("2d").createImageData(t.width,t.height)}return n.data.set(new Uint8ClampedArray(t.data)),n}(t.ref.imageData);if(!n||20!==n.length)return i.getContext("2d").putImageData(a,0,0),e();var o=r(O);o.post({imageData:a,colorMatrix:n},(function(t){i.getContext("2d").putImageData(t,0,0),o.terminate(),e()}),[a.data.buffer])}))},a=function(t){var n=t.root,r=t.image,e=t.props.id,a=n.query("GET_ITEM",{id:e});if(a){var o,u,c=a.getMetadata("crop")||{center:{x:.5,y:.5},flip:{horizontal:!1,vertical:!1},zoom:1,rotation:0,aspectRatio:null},f=n.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),E=!1;n.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(o=a.getMetadata("markup")||[],u=a.getMetadata("resize"),E=!0);var _=n.appendChildView(n.createChildView(i,{id:e,image:r,crop:c,resize:u,markup:o,dirty:E,background:f,opacity:0,scaleX:1.15,scaleY:1.15,translateY:15}),n.childViews.length);n.ref.images.push(_),_.opacity=1,_.scaleX=1,_.scaleY=1,_.translateY=0,setTimeout((function(){n.dispatch("DID_IMAGE_PREVIEW_SHOW",{id:e})}),250)}},o=function(t){var n=t.root;n.ref.overlayShadow.opacity=1,n.ref.overlayError.opacity=0,n.ref.overlaySuccess.opacity=0},u=function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlayError.opacity=1};return t.utils.createView({name:"image-preview-wrapper",create:function(t){var i=t.root;i.ref.images=[],i.ref.imageData=null,i.ref.imageViewBin=[],i.ref.overlayShadow=i.appendChildView(i.createChildView(n,{opacity:0,status:"idle"})),i.ref.overlaySuccess=i.appendChildView(i.createChildView(n,{opacity:0,status:"success"})),i.ref.overlayError=i.appendChildView(i.createChildView(n,{opacity:0,status:"failure"}))},styles:["height"],apis:["height"],destroy:function(t){t.root.ref.images.forEach((function(t){t.image.width=1,t.image.height=1}))},didWriteView:function(t){t.root.ref.images.forEach((function(t){t.dirty=!1}))},write:t.utils.createRoute({DID_IMAGE_PREVIEW_DRAW:function(t){var n=t.root,i=n.ref.images[n.ref.images.length-1];i.translateY=0,i.scaleX=1,i.scaleY=1,i.opacity=1},DID_IMAGE_PREVIEW_CONTAINER_CREATE:function(t){var n,i,r,e=t.root,a=t.props.id,o=e.query("GET_ITEM",a);if(o){var u=URL.createObjectURL(o.file);n=u,i=function(t,n){e.dispatch("DID_IMAGE_PREVIEW_CALCULATE_SIZE",{id:a,width:t,height:n})},(r=new Image).onload=function(){var t=r.naturalWidth,n=r.naturalHeight;r=null,i(t,n)},r.src=n}},DID_FINISH_CALCULATE_PREVIEWSIZE:function(t){var n,i,o,u=t.root,c=t.props,f=u.query("GET_ITEM",c.id);if(f){var E=URL.createObjectURL(f.file),_=function(){var t;(t=E,new Promise((function(n,i){var r=new Image;r.crossOrigin="Anonymous",r.onload=function(){n(r)},r.onerror=function(t){i(t)},r.src=t}))).then(s)},s=function(t){URL.revokeObjectURL(E);var n=(f.getMetadata("exif")||{}).orientation||-1,i=t.width,r=t.height;if(i&&r){if(n>=5&&n<=8){var o=[r,i];i=o[0],r=o[1]}var _=Math.max(1,.75*window.devicePixelRatio),s=u.query("GET_IMAGE_PREVIEW_ZOOM_FACTOR")*_,l=r/i,v=u.rect.element.width,h=u.rect.element.height,I=v,d=I*l;l>1?d=(I=Math.min(i,v*s))*l:I=(d=Math.min(r,h*s))/l;var p=L(t,I,d,n),M=function(){var n=u.query("GET_IMAGE_PREVIEW_CALCULATE_AVERAGE_IMAGE_COLOR")?W(data):null;f.setMetadata("color",n,!0),"close"in t&&t.close(),u.ref.overlayShadow.opacity=1,a({root:u,props:c,image:p})},g=f.getMetadata("filter");g?e(u,g,p).then(M):M()}};if(n=f.file,i=window.navigator.userAgent.match(/Firefox\/([0-9]+)\./),null!==(o=i?parseInt(i[1]):null)&&o<=58||!("createImageBitmap"in window)||!C(n))_();else{var l=r(D);l.post({file:f.file},(function(t){l.terminate(),t?s(t):_()}))}}},DID_UPDATE_ITEM_METADATA:function(t){var n,i,r=t.root,o=t.props,u=t.action;if(/crop|filter|markup|resize/.test(u.change.key)&&r.ref.images.length){var c=r.query("GET_ITEM",{id:o.id});if(c)if(/filter/.test(u.change.key))e(r,u.change.value,r.ref.images[r.ref.images.length-1].image);else if(/crop|markup|resize/.test(u.change.key)){var f=c.getMetadata("crop"),E=r.ref.images[r.ref.images.length-1];if(f&&f.aspectRatio&&E.crop&&E.crop.aspectRatio&&Math.abs(f.aspectRatio-E.crop.aspectRatio)>1e-5){var _=function(t){var n=t.root,i=n.ref.images.shift();return i.opacity=0,i.translateY=-15,n.ref.imageViewBin.push(i),i}({root:r});a({root:r,props:o,image:(n=_.image,(i=i||document.createElement("canvas")).width=n.width,i.height=n.height,i.getContext("2d").drawImage(n,0,0),i)})}else!function(t){var n=t.root,i=n.query("GET_ITEM",{id:t.props.id});if(i){var r=n.ref.images[n.ref.images.length-1];r.crop=i.getMetadata("crop"),r.background=n.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),n.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(r.dirty=!0,r.resize=i.getMetadata("resize"),r.markup=i.getMetadata("markup"))}}({root:r,props:o})}}},DID_THROW_ITEM_LOAD_ERROR:u,DID_THROW_ITEM_PROCESSING_ERROR:u,DID_THROW_ITEM_INVALID:u,DID_COMPLETE_ITEM_PROCESSING:function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlaySuccess.opacity=1},DID_START_ITEM_PROCESSING:o,DID_REVERT_ITEM_PROCESSING:o},(function(t){var n=t.root,i=n.ref.imageViewBin.filter((function(t){return 0===t.opacity}));n.ref.imageViewBin=n.ref.imageViewBin.filter((function(t){return t.opacity>0})),i.forEach((function(t){return function(t,n){t.removeChildView(n),n.image.width=1,n.image.height=1,n._destroy()}(n,t)})),i.length=0}))})},k=function(t){var n=t.addFilter,i=t.utils,r=i.Type,e=i.createRoute,a=i.isFile,o=V(t);return n("CREATE_VIEW",(function(t){var n=t.view,i=t.query;if((0,t.is)("file")&&i("GET_ALLOW_IMAGE_PREVIEW")){var r=function(t){t.root.ref.shouldRescale=!0};n.registerWriter(e({DID_RESIZE_ROOT:r,DID_STOP_RESIZE:r,DID_LOAD_ITEM:function(t){var r=t.root,e=t.props.id,u=i("GET_ITEM",e);if(u&&a(u.file)&&!u.archived){var c=u.file;if(function(t){return/^image/.test(t.type)}(c)&&i("GET_IMAGE_PREVIEW_FILTER_ITEM")(u)){var f="createImageBitmap"in(window||{}),E=i("GET_IMAGE_PREVIEW_MAX_FILE_SIZE");if(!(!f&&E&&c.size>E)){r.ref.imagePreview=n.appendChildView(n.createChildView(o,{id:e}));var _=r.query("GET_IMAGE_PREVIEW_HEIGHT");_&&r.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:u.id,height:_});var s=!f&&c.size>i("GET_IMAGE_PREVIEW_MAX_INSTANT_PREVIEW_FILE_SIZE");r.dispatch("DID_IMAGE_PREVIEW_CONTAINER_CREATE",{id:e},s)}}}},DID_IMAGE_PREVIEW_CALCULATE_SIZE:function(t){var n=t.root,i=t.action;n.ref.imageWidth=i.width,n.ref.imageHeight=i.height,n.ref.shouldRescale=!0,n.ref.shouldDrawPreview=!0,n.dispatch("KICK")},DID_UPDATE_ITEM_METADATA:function(t){"crop"===t.action.change.key&&(t.root.ref.shouldRescale=!0)}},(function(t){var n=t.root,i=t.props;n.ref.imagePreview&&(n.rect.element.hidden||(n.ref.shouldRescale&&(function(t,n){if(t.ref.imagePreview){var i=t.query("GET_ITEM",{id:n.id});if(i){var r=t.query("GET_PANEL_ASPECT_RATIO"),e=t.query("GET_ITEM_PANEL_ASPECT_RATIO"),a=t.query("GET_IMAGE_PREVIEW_HEIGHT");if(!(r||e||a)){var o=t.ref,u=o.imageWidth,c=o.imageHeight;if(u&&c){var f=t.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),E=t.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),_=(i.getMetadata("exif")||{}).orientation||-1;if(_>=5&&_<=8){var s=[c,u];u=s[0],c=s[1]}if(!C(i.file)||t.query("GET_IMAGE_PREVIEW_UPSCALE")){var l=2048/u;u*=l,c*=l}var v=c/u,h=(i.getMetadata("crop")||{}).aspectRatio||v,I=Math.max(f,Math.min(c,E)),d=Math.min(t.rect.element.width*h,I);t.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:i.id,height:d})}}}}}(n,i),n.ref.shouldRescale=!1),n.ref.shouldDrawPreview&&(requestAnimationFrame((function(){requestAnimationFrame((function(){n.dispatch("DID_FINISH_CALCULATE_PREVIEWSIZE",{id:i.id})}))})),n.ref.shouldDrawPreview=!1)))})))}})),{options:{allowImagePreview:[!0,r.BOOLEAN],imagePreviewFilterItem:[function(){return!0},r.FUNCTION],imagePreviewHeight:[null,r.INT],imagePreviewMinHeight:[44,r.INT],imagePreviewMaxHeight:[256,r.INT],imagePreviewMaxFileSize:[null,r.INT],imagePreviewZoomFactor:[2,r.INT],imagePreviewUpscale:[!1,r.BOOLEAN],imagePreviewMaxInstantPreviewFileSize:[1e6,r.INT],imagePreviewTransparencyIndicator:[null,r.STRING],imagePreviewCalculateAverageImageColor:[!1,r.BOOLEAN],imagePreviewMarkupShow:[!0,r.BOOLEAN],imagePreviewMarkupFilter:[function(){return!0},r.FUNCTION]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:k})),k}()),r.exports),a=n({__proto__:null,default:t(e)},[e]);
|
|
5
5
|
/*!
|
|
6
6
|
* FilePondPluginImagePreview 4.6.12
|
|
7
7
|
* Licensed under MIT, https://opensource.org/licenses/MIT/
|