@salla.sa/twilight-components 1.2.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/{salla-branches_22.cjs.entry.js → salla-branches_23.cjs.entry.js} +1540 -26
  3. package/dist/cjs/twilight-components.cjs.js +1 -1
  4. package/dist/collection/assets/flat.svg +1 -0
  5. package/dist/collection/collection-manifest.json +1 -0
  6. package/dist/collection/components/salla-loyalty/salla-loyalty.css +4 -0
  7. package/dist/collection/components/salla-loyalty/salla-loyalty.js +268 -50
  8. package/dist/collection/components/salla-modal/salla-modal.js +5 -2
  9. package/dist/collection/components/salla-placeholder/salla-placeholder.js +13 -3
  10. package/dist/collection/components/salla-search/salla-search.js +5 -4
  11. package/dist/collection/components/salla-social-share/interfaces.js +11 -0
  12. package/dist/collection/components/salla-social-share/salla-social-share.css +0 -0
  13. package/dist/collection/components/salla-social-share/salla-social-share.js +165 -0
  14. package/dist/collection/global/app.js +6 -1
  15. package/dist/components/index.d.ts +1 -0
  16. package/dist/components/index.js +1 -0
  17. package/dist/components/salla-loyalty.js +115 -22
  18. package/dist/components/salla-modal2.js +5 -2
  19. package/dist/components/salla-placeholder2.js +8 -2
  20. package/dist/components/salla-search.js +5 -4
  21. package/dist/components/salla-social-share.d.ts +11 -0
  22. package/dist/components/salla-social-share.js +1460 -0
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/{salla-branches_22.entry.js → salla-branches_23.entry.js} +1540 -27
  25. package/dist/esm/twilight-components.js +1 -1
  26. package/dist/twilight-components/p-9a8c8e0a.entry.js +4 -0
  27. package/dist/twilight-components/twilight-components.esm.js +1 -1
  28. package/dist/types/components/salla-loyalty/salla-loyalty.d.ts +40 -2
  29. package/dist/types/components/salla-modal/salla-modal.d.ts +1 -0
  30. package/dist/types/components/salla-placeholder/salla-placeholder.d.ts +3 -0
  31. package/dist/types/components/salla-search/salla-search.d.ts +1 -1
  32. package/dist/types/components/salla-social-share/interfaces.d.ts +7 -0
  33. package/dist/types/components/salla-social-share/salla-social-share.d.ts +23 -0
  34. package/dist/types/components.d.ts +98 -0
  35. package/example/assets/tailwind.css +579 -14
  36. package/package.json +3 -2
  37. package/dist/twilight-components/p-49a2ee1e.entry.js +0 -4
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { r as registerInstance, h, g as getElement, H as Host, c as createEvent } from './index-4e30ffd0.js';
5
5
  import { H as Helper } from './Helper-e1d414a5.js';
6
+ import 'https://static.addtoany.com/menu/page.js';
6
7
 
7
8
  const sallaBranchesCss = "";
8
9
 
@@ -634,6 +635,13 @@ const SallaLoginModal = class {
634
635
  };
635
636
  SallaLoginModal.style = sallaLoginModalCss;
636
637
 
638
+ const Star2 = `<!-- Generated by IcoMoon.io -->
639
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="30" height="32" viewBox="0 0 30 32">
640
+ <title>star2</title>
641
+ <path d="M29.714 11.839c0 0.321-0.232 0.625-0.464 0.857l-6.482 6.321 1.536 8.929c0.018 0.125 0.018 0.232 0.018 0.357 0 0.464-0.214 0.893-0.732 0.893-0.25 0-0.5-0.089-0.714-0.214l-8.018-4.214-8.018 4.214c-0.232 0.125-0.464 0.214-0.714 0.214-0.518 0-0.75-0.429-0.75-0.893 0-0.125 0.018-0.232 0.036-0.357l1.536-8.929-6.5-6.321c-0.214-0.232-0.446-0.536-0.446-0.857 0-0.536 0.554-0.75 1-0.821l8.964-1.304 4.018-8.125c0.161-0.339 0.464-0.732 0.875-0.732s0.714 0.393 0.875 0.732l4.018 8.125 8.964 1.304c0.429 0.071 1 0.286 1 0.821z"></path>
642
+ </svg>
643
+ `;
644
+
637
645
  const Star3 = `<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 80 80">
638
646
  <title>star3</title>
639
647
  <defs>
@@ -684,14 +692,16 @@ const Star3 = `<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" vi
684
692
  </svg>
685
693
  `;
686
694
 
687
- const CheckCircle = `<!-- Generated by IcoMoon.io -->
695
+ const CancelIcon = `<!-- Generated by IcoMoon.io -->
688
696
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
689
- <title>check-circle</title>
690
- <path d="M19.557 11.26l-4.593 6.891-2.891-1.927c-0.616-0.411-1.441-0.243-1.849 0.369-0.409 0.612-0.244 1.441 0.369 1.849l4 2.667c0.228 0.152 0.485 0.224 0.739 0.224 0.431 0 0.855-0.208 1.111-0.593l5.333-8c0.409-0.612 0.244-1.441-0.369-1.849-0.616-0.411-1.443-0.243-1.849 0.369zM16 0c-8.823 0-16 7.177-16 16s7.177 16 16 16 16-7.177 16-16-7.177-16-16-16zM16 29.333c-7.352 0-13.333-5.981-13.333-13.333s5.981-13.333 13.333-13.333 13.333 5.981 13.333 13.333-5.981 13.333-13.333 13.333z"></path>
697
+ <title>cancel</title>
698
+ <path d="M17.885 16l7.057-7.057c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-7.057 7.057-7.057-7.057c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l7.057 7.057-7.057 7.057c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l7.057-7.057 7.057 7.057c0.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.885z"></path>
691
699
  </svg>
692
700
  `;
693
701
 
694
- const sallaLoyaltyCss = "";
702
+ const GiftImg = `<svg xmlns="http://www.w3.org/2000/svg" width="54.079" height="53.191" viewBox="0 0 54.079 53.191"><defs><style>.a{fill:#ee9d0d;}.b{fill:#c7830b;}.c{fill:#ea2b2d;}.d{fill:#cb2527;}.e{fill:#6699ce;}.f{fill:#faa6b2;}.g{fill:#a6deff;}.h{fill:#eeb436;}.i{fill:#f72d2f;}</style></defs><path class="a" d="M40,248H77.3v25.88a2.1,2.1,0,0,1-2.1,2.1H42.1a2.1,2.1,0,0,1-2.1-2.1Z" transform="translate(-38.135 -222.787)"/><path class="b" d="M250.632,248.711v12.755L236.2,248h13.67Z" transform="translate(-211.463 -222.787)"/><path class="b" d="M333.957,336v3.207L330.52,336Z" transform="translate(-294.787 -300.528)"/><path class="c" d="M226.194,32.048l-.5.185a5.035,5.035,0,0,0-3.072,3.292l-.468,1.585-.759.414a5.035,5.035,0,0,0-2.422,3l8.865,8.271,5.09-5.456.262-6.205a5.191,5.191,0,0,0-7-5.083Z" transform="translate(-196.246 -31.722)"/><path class="c" d="M358.628,175.48l-.15.509a5.034,5.034,0,0,1-3.072,3.292l-1.55.577-.359.785a5.034,5.034,0,0,1-2.822,2.624L341.81,175l5.09-5.455,6.172-.69a5.191,5.191,0,0,1,5.555,6.629Z" transform="translate(-304.761 -152.837)"/><path class="d" d="M168,248h7.461v27.978H168Z" transform="translate(-151.213 -222.787)"/><path class="c" d="M40,336H77.3v7.461H40Z" transform="translate(-38.135 -300.528)"/><path class="d" d="M333.957,336v3.207L330.52,336Z" transform="translate(-294.787 -300.528)"/><path class="a" d="M2.1,0H40.8a2.1,2.1,0,0,1,2.1,2.1V9.326H0V2.1A2.1,2.1,0,0,1,2.1,0Z" transform="matrix(0.731, 0.682, -0.682, 0.731, 18.641, 4.976)"/><path class="d" d="M0,0H9.326V9.326H0Z" transform="matrix(0.731, 0.682, -0.682, 0.731, 30.912, 16.424)"/><path class="d" d="M286.857,79.389a.931.931,0,0,1-.74-.365l-.615-.8a12.516,12.516,0,0,1-2.528-9,.933.933,0,0,1,1.855.2,10.66,10.66,0,0,0,2.153,7.667l.615.8a.933.933,0,0,1-.739,1.5Z" transform="translate(-252.718 -64.113)"/><path class="c" d="M185.485,178.151l-.039.014a30.78,30.78,0,0,1-12.034,1.906l-2.381-.1,4.092,3.817-1.181,4,3.728-1.206a30.775,30.775,0,0,0,9.833-5.315l.71-.572Z" transform="translate(-153.891 -161.081)"/><path class="d" d="M363.834,194.779a12.51,12.51,0,0,1-6.93-2.1l-.843-.559a.933.933,0,1,1,1.031-1.554l.842.558a10.659,10.659,0,0,0,7.8,1.618.933.933,0,1,1,.328,1.836A12.663,12.663,0,0,1,363.834,194.779Z" transform="translate(-316.982 -171.914)"/><path class="c" d="M275,202.524l-.012.04a30.776,30.776,0,0,0-1.069,12.137l.265,2.369-4.092-3.817-3.909,1.455.945-3.8a30.776,30.776,0,0,1,4.622-10.177l.521-.748Z" transform="translate(-237.949 -180.364)"/><circle class="e" cx="1.865" cy="1.865" r="1.865" transform="translate(10.259 0.032)"/><circle class="f" cx="1.865" cy="1.865" r="1.865" transform="translate(0 21.482)"/><path class="g" d="M36.663,36.663a.933.933,0,0,1-.885-.638l-.048-.143a2.946,2.946,0,0,0-2.8-2.017.933.933,0,1,1,0-1.865A4.808,4.808,0,0,1,37.5,35.292l.048.143a.933.933,0,0,1-.885,1.228Z" transform="translate(-31.067 -31.968)"/><path class="g" d="M79.493,194.438a.929.929,0,0,1-.506-.15l-.185-.12a2.074,2.074,0,0,0-2.192-.047.933.933,0,0,1-.947-1.607,3.929,3.929,0,0,1,4.153.088l.185.12a.933.933,0,0,1-.508,1.716Z" transform="translate(-69.235 -173.283)"/><path class="h" d="M27.751,85.141l2.88,2.644,3.811-.874-1.624,3.556,2.008,3.354-3.884-.446-2.569,2.946L27.6,92.49,24,90.957l3.4-1.922Z" transform="translate(-24 -78.914)"/><path class="h" d="M82.174,227.375l-.959,3.772,2.564,2.928-3.884.254L77.9,237.673l-1.442-3.615-3.8-.862,2.993-2.488-.353-3.876,3.291,2.078Z" transform="translate(-66.992 -204.086)"/><path class="i" d="M300.471,141.9l-5.455-5.09,5.09-5.456a8.342,8.342,0,0,1,5.455,5.09Z" transform="translate(-263.422 -119.737)"/></svg>`;
703
+
704
+ const sallaLoyaltyCss = "#salla-loyalty-modal .s-swiper-button-prev button,#salla-loyalty-modal .s-swiper-button-next button{box-shadow:#32325d40 0px 6px 12px -2px, #0000004d 0px 3px 7px -3px}";
695
705
 
696
706
  const SallaLoyalty = class {
697
707
  constructor(hostRef) {
@@ -700,6 +710,35 @@ const SallaLoyalty = class {
700
710
  this.buttonLoading = false;
701
711
  this.selectedItem = undefined;
702
712
  this.askConfirmation = false;
713
+ this.is_loggedin = false;
714
+ /**
715
+ * The exchanged prize point
716
+ */
717
+ this.prizePoints = undefined;
718
+ /**
719
+ * Available customer points with which they can exchange.
720
+ */
721
+ this.customerPoints = undefined;
722
+ /**
723
+ * The exchangable prize title
724
+ */
725
+ this.prizeTitle = undefined;
726
+ /**
727
+ * Does the merchant allow to login using email
728
+ */
729
+ this.allowEmail = true;
730
+ /**
731
+ * Does the merchant/current location for visitor allow to login using mobile, By default outside KSA is `false`
732
+ */
733
+ this.allowMobile = true;
734
+ /**
735
+ * Does the merchant require registration with email & mobile
736
+ */
737
+ this.requireEmail = false;
738
+ salla.event.on('loyalty::open', () => this.open());
739
+ salla.auth.event.onLoggedIn(() => {
740
+ this.is_loggedin = true;
741
+ });
703
742
  salla.lang.onLoaded(() => {
704
743
  this.points = salla.lang.get('pages.loyalty_program.point');
705
744
  this.exchange_points = salla.lang.get('pages.loyalty_program.exchange_points');
@@ -707,8 +746,12 @@ const SallaLoyalty = class {
707
746
  this.for = salla.lang.get('pages.loyalty_program.for');
708
747
  this.confirm = salla.lang.get('pages.loyalty_program.confirm');
709
748
  this.cancel = salla.lang.get('pages.loyalty_program.cancellation');
710
- this.loyalty_placeholder = salla.lang.get('pages.loyalty.points');
711
- this.loyalty_placeholder_info = salla.lang.get('pages.loyalty.points');
749
+ this.cart_total_point_summary = salla.lang.get('pages.loyalty_program.cart_total_point_summary', { "balance": this.customerPoints });
750
+ this.cart_point_exchange_now = salla.lang.get('pages.loyalty_program.cart_point_exchange_now');
751
+ this.login_button = salla.lang.get('blocks.header.login');
752
+ if (!this.guestMessage) {
753
+ this.guestMessage = salla.lang.get('pages.loyalty_program.guest_message');
754
+ }
712
755
  });
713
756
  }
714
757
  setSelectedPrizeItem(item) {
@@ -719,24 +762,39 @@ const SallaLoyalty = class {
719
762
  this.selectedItem = undefined;
720
763
  }
721
764
  }
765
+ handleLongText(text) {
766
+ if (text.length > 150) {
767
+ return text.substring(0, 150) + '...';
768
+ }
769
+ return text;
770
+ }
722
771
  prizeItem(item) {
723
- var klass = {
772
+ let klass = {
724
773
  's-loyalty-prize-item-selected': !!this.selectedItem && this.selectedItem.id == item.id,
725
774
  "s-loyalty-prize-item": true
726
775
  };
727
- return h("div", { onClick: () => this.setSelectedPrizeItem(item), class: klass }, h("span", { class: "s-loyalty-prize-item-check", innerHTML: CheckCircle }), h("img", { class: "s-loyalty-prize-item-image", src: item.image, alt: item.name }), h("div", { class: "s-loyalty-prize-item-title" }, item.name), h("div", { class: "s-loyalty-prize-item-subtitle" }, item.description), h("div", { class: "s-loyalty-prize-item-points" }, item.cost_points, " ", this.points));
776
+ return h("div", { onClick: () => this.setSelectedPrizeItem(item), class: klass }, h("img", { class: "s-loyalty-prize-item-image", src: item.image, alt: item.name }), h("div", { class: "s-loyalty-prize-item-title" }, item.name), h("div", { class: "s-loyalty-prize-item-subtitle" }, this.handleLongText(item.description)), h("div", { class: "s-loyalty-prize-item-points" }, item.cost_points, " ", this.points, h("div", { class: "s-loyalty-prize-item-check" }, h("div", null))));
728
777
  }
729
778
  getConfirmationModal() {
730
779
  var _a, _b;
731
- return h("div", null, h("salla-placeholder", { alignment: "center", icon: Star3, class: "s-loyalty-confirmation-modal-content" }, h("div", { slot: "title", class: "s-loyalty-confirmation-title" }, this.exchange_points), h("div", { slot: "description" }, h("span", null, this.are_you_sure_to_exchange, " ( ", h("strong", null, (_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.cost_points), " ) ", this.for, " ( ", h("strong", null, (_b = this.selectedItem) === null || _b === void 0 ? void 0 : _b.name), " )"))), h("div", { class: "s-loyalty-confirmation-actions" }, h("salla-button", { fill: 'outline', width: "wide", onClick: () => this.cancelProcess() }, this.cancel), h("salla-button", { loading: this.buttonLoading, width: "wide", onClick: () => this.exchangeLoyaltyPoint() }, this.confirm)));
780
+ return [
781
+ h("salla-placeholder", { alignment: "center", icon: Star3, class: "s-loyalty-confirmation-modal-content" }, h("div", { slot: "title", class: "s-loyalty-confirmation-title" }, this.exchange_points), h("div", { slot: "description" }, this.are_you_sure_to_exchange, " ( ", h("strong", null, (_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.cost_points), " ) ", this.for, " ( ", h("strong", null, (_b = this.selectedItem) === null || _b === void 0 ? void 0 : _b.name), " )")),
782
+ h("div", { class: "s-loyalty-confirmation-actions" }, h("salla-button", { fill: 'outline', width: "wide", onClick: () => this.cancelProcess() }, this.cancel), h("salla-button", { loading: this.buttonLoading, width: "wide", onClick: () => this.exchangeLoyaltyPoint() }, this.confirm))
783
+ ];
784
+ }
785
+ getAfterExchangeUI() {
786
+ return h("slot", { name: 'points-applied-widget' }, h("salla-list-tile", { class: "s-loyalty-after-exchange" }, h("div", { slot: "title", class: "s-loyalty-after-exchange-title" }, this.prizeTitle, " \u00A0 - \u00A0 ", this.prizePoints), h("div", { slot: 'action', class: "s-loyalty-after-exchange-action" }, h("salla-button", { class: "s-loyalty-after-exchange-reset", shape: "icon", fill: 'outline', color: "danger", size: "small", onClick: () => this.resetExchange() }, h("span", { innerHTML: CancelIcon })))));
732
787
  }
733
788
  /**
734
789
  * Show loyalty modal
735
790
  */
736
791
  async open() {
792
+ if (!this.is_loggedin)
793
+ return salla.event.dispatch('login::open');
737
794
  this.modal.open();
738
795
  return await salla.loyalty.getProgram()
739
796
  .then((response) => {
797
+ console.log("🚀 ~ file: salla-loyalty.tsx ~ line 167 ~ SallaLoyalty ~ .then ~ response", response);
740
798
  this.loyaltyProgram = response.data;
741
799
  })
742
800
  .catch(e => console.log(e))
@@ -751,6 +809,17 @@ const SallaLoyalty = class {
751
809
  async close() {
752
810
  return this.modal.close();
753
811
  }
812
+ /**
813
+ *
814
+ * Cancel Exchanged prizes
815
+ */
816
+ async resetExchange() {
817
+ return await salla.loyalty.reset()
818
+ .then(() => {
819
+ this.prizePoints = undefined;
820
+ this.prizeTitle = undefined;
821
+ }).catch(e => console.log(e));
822
+ }
754
823
  /**
755
824
  * Open Confirmation modal
756
825
  */
@@ -763,7 +832,7 @@ const SallaLoyalty = class {
763
832
  * Cancel process
764
833
  */
765
834
  async cancelProcess() {
766
- await this.confirmationModal.close()
835
+ return await this.confirmationModal.close()
767
836
  .then(() => this.selectedItem = null)
768
837
  .catch(e => console.log(e));
769
838
  }
@@ -779,17 +848,32 @@ const SallaLoyalty = class {
779
848
  this.loyaltyProgram = response.data;
780
849
  })
781
850
  .catch(e => console.log(e))
782
- .finally(() => this.buttonLoading = false);
851
+ .finally(() => {
852
+ this.buttonLoading = false;
853
+ this.cancelProcess();
854
+ });
783
855
  }
784
856
  render() {
785
- return (h(Host, null, h("salla-list-tile", { id: 's-loyalty-activator' }, h("div", { slot: "icon", class: "s-loyalty-activator-icon", innerHTML: Star3 }), h("div", { slot: "subtitle" }, h("div", null, "You have 200 points that you can use for great prizes", h("salla-button", { shape: "link", color: "danger", onClick: () => this.open() }, "Get Loyalty Program")))), h("salla-modal", { id: "salla-loyalty-confirmation-modal", noPadding: true, position: 'top', width: "sm", ref: modal => this.confirmationModal = modal }, this.getConfirmationModal()), h("salla-modal", { isLoading: true, id: "salla-loyalty-modal", width: "lg", ref: modal => this.modal = modal }, !!this.loyaltyProgram ?
786
- [
787
- h("salla-list-tile", { id: 's-loyalty-header', class: "s-loyalty-header" }, h("div", { slot: "icon", class: "s-loyalty-header-icon" }, h("img", { src: "https://cdn.salla.network/custom-themes/images/flat.svg", alt: "flat" })), h("div", { slot: "title", class: "s-loyalty-header-title" }, this.loyaltyProgram.prize_promotion_title), h("div", { slot: "subtitle", class: "s-loyalty-header-subtitle" }, this.loyaltyProgram.prize_promotion_description)),
788
- h("salla-tabs", null, this.loyaltyProgram.prizes.map((prize) => h("salla-tab-header", { slot: "header", name: prize.title }, h("span", null, prize.title))), this.loyaltyProgram.prizes.map((prize) => h("salla-tab-content", { slot: "content", name: prize.title }, h("salla-swiper", { "space-between-items": "20" }, prize.items.map((item) => this.prizeItem(item)))))),
789
- h("salla-button", { disabled: !this.selectedItem, width: "wide", class: "s-loyalty-program-redeem-btn", onClick: () => this.openConfirmation() }, this.exchange_points)
790
- ]
791
- :
792
- h("salla-placeholder", { alignment: "center", iconSize: "xl" }, h("div", { slot: "title" }, this.loyalty_placeholder), h("div", { slot: "description" }, this.loyalty_placeholder_info)), h("slot", { name: "footer" }))));
857
+ // A. when the exchange is done, and we have the final prize points to show it in cart page
858
+ if (this.prizePoints) {
859
+ return this.getAfterExchangeUI();
860
+ }
861
+ return [
862
+ h("slot", { name: 'widget' }, this.customerPoints ?
863
+ h("salla-list-tile", { class: 's-loyalty-widget' }, h("div", { slot: "icon", class: "s-loyalty-widget-icon", innerHTML: Star2 }), h("div", { slot: "subtitle" }, this.is_loggedin ? this.cart_total_point_summary : this.guestMessage, h("salla-button", { shape: "link", color: "primary", onClick: () => salla.event.dispatch("loyalty::open") }, this.is_loggedin ? this.cart_point_exchange_now : this.login_button))) :
864
+ ''),
865
+ h("salla-modal", { id: "salla-loyalty-confirmation-modal", noPadding: true, position: 'top', width: "sm", ref: modal => this.confirmationModal = modal }, this.getConfirmationModal()),
866
+ h("salla-modal", { isLoading: true, id: "salla-loyalty-modal", width: "md", ref: modal => this.modal = modal }, !!this.loyaltyProgram ?
867
+ [
868
+ h("salla-list-tile", { id: 's-loyalty-header', class: "s-loyalty-header" }, h("div", { slot: "icon", class: "s-loyalty-header-icon", innerHTML: GiftImg }), h("div", { slot: "title", class: "s-loyalty-header-title" }, this.loyaltyProgram.prize_promotion_title), h("div", { slot: "subtitle", class: "s-loyalty-header-subtitle" }, this.loyaltyProgram.prize_promotion_description)),
869
+ h("salla-tabs", null, this.loyaltyProgram.prizes.map((prize) => h("salla-tab-header", { slot: "header", name: prize.title }, h("span", null, prize.title))), this.loyaltyProgram.prizes.map((prize) => h("salla-tab-content", { slot: "content", name: prize.title }, h("salla-swiper", { "space-between-items": "20" }, prize.items.map((item) => this.prizeItem(item)))))),
870
+ h("salla-button", { disabled: !this.selectedItem, width: "wide", class: "s-loyalty-program-redeem-btn", onClick: () => this.openConfirmation() }, this.exchange_points)
871
+ ]
872
+ : h("salla-placeholder", { class: "s-loyalty-placeholder", alignment: "center" })),
873
+ ];
874
+ }
875
+ componentDidLoad() {
876
+ this.is_loggedin = salla.config.isUser();
793
877
  }
794
878
  };
795
879
  SallaLoyalty.style = sallaLoyaltyCss;
@@ -912,13 +996,16 @@ const SallaModal = class {
912
996
  'sicon-check-circle2': !this.icon && this.iconStyle == 'success' && !this.imageIcon,
913
997
  };
914
998
  }
999
+ getWidth() {
1000
+ return this.isLoading ? 'sm' : this.width;
1001
+ }
915
1002
  //todo:: pref for each modal
916
1003
  render() {
917
1004
  this.host.id = this.host.id || 'salla-modal';
918
1005
  if (this.isLoading) {
919
- return (h(Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), h("div", { class: "s-modal-wrapper" }, h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.width + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, h("salla-loading", null), h("div", { class: "s-hidden" }, h("slot", null))))));
1006
+ return (h(Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), h("div", { class: "s-modal-wrapper" }, h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.getWidth() + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, h("salla-loading", null), h("div", { class: "s-hidden" }, h("slot", null))))));
920
1007
  }
921
- return (h(Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), h("div", { class: "s-modal-wrapper" }, h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.width + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, h("div", { class: { 's-modal-header': true, 's-modal-is-center': this.icon != '' || this.imageIcon != '' } }, this.isClosable ?
1008
+ return (h(Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), h("div", { class: "s-modal-wrapper" }, h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.getWidth() + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, h("div", { class: { 's-modal-header': true, 's-modal-is-center': this.icon != '' || this.imageIcon != '' } }, this.isClosable ?
922
1009
  h("button", { class: "s-modal-close", onClick: () => this.closeModal(), type: "button" }, h("span", { class: "sicon-cancel" }))
923
1010
  : '', this.modalTitle || this.subTitle ?
924
1011
  h("div", { class: "s-modal-header-inner" }, this.iconStyle || this.icon
@@ -1094,6 +1181,10 @@ const SallaPlaceholder = class {
1094
1181
  * The size of the icon. Defaults to [`md`]
1095
1182
  */
1096
1183
  this.iconSize = 'md';
1184
+ salla.lang.onLoaded(() => {
1185
+ this.default_title = salla.lang.get('common.elements.no_options');
1186
+ this.default_description = salla.lang.get('common.errors.empty_results');
1187
+ });
1097
1188
  }
1098
1189
  alignmentClass() {
1099
1190
  return {
@@ -1104,7 +1195,7 @@ const SallaPlaceholder = class {
1104
1195
  };
1105
1196
  }
1106
1197
  render() {
1107
- return (h("div", { class: this.alignmentClass() }, h("div", { class: `s-placeholder-icon s-placeholder-icon-${this.iconSize}`, innerHTML: this.icon }), h("div", { class: "s-placeholder-title" }, h("slot", { name: 'title' })), h("div", { class: "s-placeholder-description" }, h("slot", { name: 'description' }))));
1198
+ return (h("div", { class: this.alignmentClass() }, h("div", { class: `s-placeholder-icon s-placeholder-icon-${this.iconSize}`, innerHTML: this.icon }), h("div", { class: "s-placeholder-title" }, h("slot", { name: 'title' }, h("span", null, this.default_title))), h("div", { class: "s-placeholder-description" }, h("slot", { name: 'description' }, h("span", null, this.default_description)))));
1108
1199
  }
1109
1200
  };
1110
1201
  SallaPlaceholder.style = sallaPlaceholderCss;
@@ -1514,16 +1605,17 @@ const SallaSearch = class {
1514
1605
  this.height = 60;
1515
1606
  Helper.setHost(this.host);
1516
1607
  this.productSlot = ((_a = Helper.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
1517
- salla.event.on('search::open', () => this.modal.open());
1608
+ salla.event.on('search::open', () => this.open());
1518
1609
  salla.lang.onLoaded(() => {
1519
1610
  this.placeholder = salla.lang.get('blocks.header.search_placeholder');
1520
1611
  this.noResultsText = salla.lang.get('common.elements.no_options');
1521
1612
  });
1522
- salla.event.on('modalOpened', () => this.onModalOpen());
1523
1613
  salla.event.on('modalClosed', () => this.onModalClose());
1524
1614
  }
1525
- onModalOpen() {
1526
- setTimeout(() => this.searchInput.focus(), 300);
1615
+ async open() {
1616
+ if (!this.inline) {
1617
+ await this.modal.open().then(() => setTimeout(() => this.searchInput.focus(), 300));
1618
+ }
1527
1619
  }
1528
1620
  onModalClose() {
1529
1621
  this.searchInput.value = '';
@@ -1600,6 +1692,1427 @@ const SallaSearch = class {
1600
1692
  };
1601
1693
  SallaSearch.style = sallaSearchCss;
1602
1694
 
1695
+ /*
1696
+ * anime.js v3.2.1
1697
+ * (c) 2020 Julian Garnier
1698
+ * Released under the MIT license
1699
+ * animejs.com
1700
+ */
1701
+
1702
+ // Defaults
1703
+
1704
+ var defaultInstanceSettings = {
1705
+ update: null,
1706
+ begin: null,
1707
+ loopBegin: null,
1708
+ changeBegin: null,
1709
+ change: null,
1710
+ changeComplete: null,
1711
+ loopComplete: null,
1712
+ complete: null,
1713
+ loop: 1,
1714
+ direction: 'normal',
1715
+ autoplay: true,
1716
+ timelineOffset: 0
1717
+ };
1718
+
1719
+ var defaultTweenSettings = {
1720
+ duration: 1000,
1721
+ delay: 0,
1722
+ endDelay: 0,
1723
+ easing: 'easeOutElastic(1, .5)',
1724
+ round: 0
1725
+ };
1726
+
1727
+ var validTransforms = ['translateX', 'translateY', 'translateZ', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'perspective', 'matrix', 'matrix3d'];
1728
+
1729
+ // Caching
1730
+
1731
+ var cache = {
1732
+ CSS: {},
1733
+ springs: {}
1734
+ };
1735
+
1736
+ // Utils
1737
+
1738
+ function minMax(val, min, max) {
1739
+ return Math.min(Math.max(val, min), max);
1740
+ }
1741
+
1742
+ function stringContains(str, text) {
1743
+ return str.indexOf(text) > -1;
1744
+ }
1745
+
1746
+ function applyArguments(func, args) {
1747
+ return func.apply(null, args);
1748
+ }
1749
+
1750
+ var is$1 = {
1751
+ arr: function (a) { return Array.isArray(a); },
1752
+ obj: function (a) { return stringContains(Object.prototype.toString.call(a), 'Object'); },
1753
+ pth: function (a) { return is$1.obj(a) && a.hasOwnProperty('totalLength'); },
1754
+ svg: function (a) { return a instanceof SVGElement; },
1755
+ inp: function (a) { return a instanceof HTMLInputElement; },
1756
+ dom: function (a) { return a.nodeType || is$1.svg(a); },
1757
+ str: function (a) { return typeof a === 'string'; },
1758
+ fnc: function (a) { return typeof a === 'function'; },
1759
+ und: function (a) { return typeof a === 'undefined'; },
1760
+ nil: function (a) { return is$1.und(a) || a === null; },
1761
+ hex: function (a) { return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a); },
1762
+ rgb: function (a) { return /^rgb/.test(a); },
1763
+ hsl: function (a) { return /^hsl/.test(a); },
1764
+ col: function (a) { return (is$1.hex(a) || is$1.rgb(a) || is$1.hsl(a)); },
1765
+ key: function (a) { return !defaultInstanceSettings.hasOwnProperty(a) && !defaultTweenSettings.hasOwnProperty(a) && a !== 'targets' && a !== 'keyframes'; },
1766
+ };
1767
+
1768
+ // Easings
1769
+
1770
+ function parseEasingParameters(string) {
1771
+ var match = /\(([^)]+)\)/.exec(string);
1772
+ return match ? match[1].split(',').map(function (p) { return parseFloat(p); }) : [];
1773
+ }
1774
+
1775
+ // Spring solver inspired by Webkit Copyright © 2016 Apple Inc. All rights reserved. https://webkit.org/demos/spring/spring.js
1776
+
1777
+ function spring(string, duration) {
1778
+
1779
+ var params = parseEasingParameters(string);
1780
+ var mass = minMax(is$1.und(params[0]) ? 1 : params[0], .1, 100);
1781
+ var stiffness = minMax(is$1.und(params[1]) ? 100 : params[1], .1, 100);
1782
+ var damping = minMax(is$1.und(params[2]) ? 10 : params[2], .1, 100);
1783
+ var velocity = minMax(is$1.und(params[3]) ? 0 : params[3], .1, 100);
1784
+ var w0 = Math.sqrt(stiffness / mass);
1785
+ var zeta = damping / (2 * Math.sqrt(stiffness * mass));
1786
+ var wd = zeta < 1 ? w0 * Math.sqrt(1 - zeta * zeta) : 0;
1787
+ var a = 1;
1788
+ var b = zeta < 1 ? (zeta * w0 + -velocity) / wd : -velocity + w0;
1789
+
1790
+ function solver(t) {
1791
+ var progress = duration ? (duration * t) / 1000 : t;
1792
+ if (zeta < 1) {
1793
+ progress = Math.exp(-progress * zeta * w0) * (a * Math.cos(wd * progress) + b * Math.sin(wd * progress));
1794
+ } else {
1795
+ progress = (a + b * progress) * Math.exp(-progress * w0);
1796
+ }
1797
+ if (t === 0 || t === 1) { return t; }
1798
+ return 1 - progress;
1799
+ }
1800
+
1801
+ function getDuration() {
1802
+ var cached = cache.springs[string];
1803
+ if (cached) { return cached; }
1804
+ var frame = 1/6;
1805
+ var elapsed = 0;
1806
+ var rest = 0;
1807
+ while(true) {
1808
+ elapsed += frame;
1809
+ if (solver(elapsed) === 1) {
1810
+ rest++;
1811
+ if (rest >= 16) { break; }
1812
+ } else {
1813
+ rest = 0;
1814
+ }
1815
+ }
1816
+ var duration = elapsed * frame * 1000;
1817
+ cache.springs[string] = duration;
1818
+ return duration;
1819
+ }
1820
+
1821
+ return duration ? solver : getDuration;
1822
+
1823
+ }
1824
+
1825
+ // Basic steps easing implementation https://developer.mozilla.org/fr/docs/Web/CSS/transition-timing-function
1826
+
1827
+ function steps(steps) {
1828
+ if ( steps === void 0 ) steps = 10;
1829
+
1830
+ return function (t) { return Math.ceil((minMax(t, 0.000001, 1)) * steps) * (1 / steps); };
1831
+ }
1832
+
1833
+ // BezierEasing https://github.com/gre/bezier-easing
1834
+
1835
+ var bezier = (function () {
1836
+
1837
+ var kSplineTableSize = 11;
1838
+ var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
1839
+
1840
+ function A(aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1 }
1841
+ function B(aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1 }
1842
+ function C(aA1) { return 3.0 * aA1 }
1843
+
1844
+ function calcBezier(aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT }
1845
+ function getSlope(aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1) }
1846
+
1847
+ function binarySubdivide(aX, aA, aB, mX1, mX2) {
1848
+ var currentX, currentT, i = 0;
1849
+ do {
1850
+ currentT = aA + (aB - aA) / 2.0;
1851
+ currentX = calcBezier(currentT, mX1, mX2) - aX;
1852
+ if (currentX > 0.0) { aB = currentT; } else { aA = currentT; }
1853
+ } while (Math.abs(currentX) > 0.0000001 && ++i < 10);
1854
+ return currentT;
1855
+ }
1856
+
1857
+ function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
1858
+ for (var i = 0; i < 4; ++i) {
1859
+ var currentSlope = getSlope(aGuessT, mX1, mX2);
1860
+ if (currentSlope === 0.0) { return aGuessT; }
1861
+ var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
1862
+ aGuessT -= currentX / currentSlope;
1863
+ }
1864
+ return aGuessT;
1865
+ }
1866
+
1867
+ function bezier(mX1, mY1, mX2, mY2) {
1868
+
1869
+ if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) { return; }
1870
+ var sampleValues = new Float32Array(kSplineTableSize);
1871
+
1872
+ if (mX1 !== mY1 || mX2 !== mY2) {
1873
+ for (var i = 0; i < kSplineTableSize; ++i) {
1874
+ sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
1875
+ }
1876
+ }
1877
+
1878
+ function getTForX(aX) {
1879
+
1880
+ var intervalStart = 0;
1881
+ var currentSample = 1;
1882
+ var lastSample = kSplineTableSize - 1;
1883
+
1884
+ for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
1885
+ intervalStart += kSampleStepSize;
1886
+ }
1887
+
1888
+ --currentSample;
1889
+
1890
+ var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
1891
+ var guessForT = intervalStart + dist * kSampleStepSize;
1892
+ var initialSlope = getSlope(guessForT, mX1, mX2);
1893
+
1894
+ if (initialSlope >= 0.001) {
1895
+ return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
1896
+ } else if (initialSlope === 0.0) {
1897
+ return guessForT;
1898
+ } else {
1899
+ return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
1900
+ }
1901
+
1902
+ }
1903
+
1904
+ return function (x) {
1905
+ if (mX1 === mY1 && mX2 === mY2) { return x; }
1906
+ if (x === 0 || x === 1) { return x; }
1907
+ return calcBezier(getTForX(x), mY1, mY2);
1908
+ }
1909
+
1910
+ }
1911
+
1912
+ return bezier;
1913
+
1914
+ })();
1915
+
1916
+ var penner = (function () {
1917
+
1918
+ // Based on jQuery UI's implemenation of easing equations from Robert Penner (http://www.robertpenner.com/easing)
1919
+
1920
+ var eases = { linear: function () { return function (t) { return t; }; } };
1921
+
1922
+ var functionEasings = {
1923
+ Sine: function () { return function (t) { return 1 - Math.cos(t * Math.PI / 2); }; },
1924
+ Circ: function () { return function (t) { return 1 - Math.sqrt(1 - t * t); }; },
1925
+ Back: function () { return function (t) { return t * t * (3 * t - 2); }; },
1926
+ Bounce: function () { return function (t) {
1927
+ var pow2, b = 4;
1928
+ while (t < (( pow2 = Math.pow(2, --b)) - 1) / 11) {}
1929
+ return 1 / Math.pow(4, 3 - b) - 7.5625 * Math.pow(( pow2 * 3 - 2 ) / 22 - t, 2)
1930
+ }; },
1931
+ Elastic: function (amplitude, period) {
1932
+ if ( amplitude === void 0 ) amplitude = 1;
1933
+ if ( period === void 0 ) period = .5;
1934
+
1935
+ var a = minMax(amplitude, 1, 10);
1936
+ var p = minMax(period, .1, 2);
1937
+ return function (t) {
1938
+ return (t === 0 || t === 1) ? t :
1939
+ -a * Math.pow(2, 10 * (t - 1)) * Math.sin((((t - 1) - (p / (Math.PI * 2) * Math.asin(1 / a))) * (Math.PI * 2)) / p);
1940
+ }
1941
+ }
1942
+ };
1943
+
1944
+ var baseEasings = ['Quad', 'Cubic', 'Quart', 'Quint', 'Expo'];
1945
+
1946
+ baseEasings.forEach(function (name, i) {
1947
+ functionEasings[name] = function () { return function (t) { return Math.pow(t, i + 2); }; };
1948
+ });
1949
+
1950
+ Object.keys(functionEasings).forEach(function (name) {
1951
+ var easeIn = functionEasings[name];
1952
+ eases['easeIn' + name] = easeIn;
1953
+ eases['easeOut' + name] = function (a, b) { return function (t) { return 1 - easeIn(a, b)(1 - t); }; };
1954
+ eases['easeInOut' + name] = function (a, b) { return function (t) { return t < 0.5 ? easeIn(a, b)(t * 2) / 2 :
1955
+ 1 - easeIn(a, b)(t * -2 + 2) / 2; }; };
1956
+ eases['easeOutIn' + name] = function (a, b) { return function (t) { return t < 0.5 ? (1 - easeIn(a, b)(1 - t * 2)) / 2 :
1957
+ (easeIn(a, b)(t * 2 - 1) + 1) / 2; }; };
1958
+ });
1959
+
1960
+ return eases;
1961
+
1962
+ })();
1963
+
1964
+ function parseEasings(easing, duration) {
1965
+ if (is$1.fnc(easing)) { return easing; }
1966
+ var name = easing.split('(')[0];
1967
+ var ease = penner[name];
1968
+ var args = parseEasingParameters(easing);
1969
+ switch (name) {
1970
+ case 'spring' : return spring(easing, duration);
1971
+ case 'cubicBezier' : return applyArguments(bezier, args);
1972
+ case 'steps' : return applyArguments(steps, args);
1973
+ default : return applyArguments(ease, args);
1974
+ }
1975
+ }
1976
+
1977
+ // Strings
1978
+
1979
+ function selectString(str) {
1980
+ try {
1981
+ var nodes = document.querySelectorAll(str);
1982
+ return nodes;
1983
+ } catch(e) {
1984
+ return;
1985
+ }
1986
+ }
1987
+
1988
+ // Arrays
1989
+
1990
+ function filterArray(arr, callback) {
1991
+ var len = arr.length;
1992
+ var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
1993
+ var result = [];
1994
+ for (var i = 0; i < len; i++) {
1995
+ if (i in arr) {
1996
+ var val = arr[i];
1997
+ if (callback.call(thisArg, val, i, arr)) {
1998
+ result.push(val);
1999
+ }
2000
+ }
2001
+ }
2002
+ return result;
2003
+ }
2004
+
2005
+ function flattenArray(arr) {
2006
+ return arr.reduce(function (a, b) { return a.concat(is$1.arr(b) ? flattenArray(b) : b); }, []);
2007
+ }
2008
+
2009
+ function toArray(o) {
2010
+ if (is$1.arr(o)) { return o; }
2011
+ if (is$1.str(o)) { o = selectString(o) || o; }
2012
+ if (o instanceof NodeList || o instanceof HTMLCollection) { return [].slice.call(o); }
2013
+ return [o];
2014
+ }
2015
+
2016
+ function arrayContains(arr, val) {
2017
+ return arr.some(function (a) { return a === val; });
2018
+ }
2019
+
2020
+ // Objects
2021
+
2022
+ function cloneObject(o) {
2023
+ var clone = {};
2024
+ for (var p in o) { clone[p] = o[p]; }
2025
+ return clone;
2026
+ }
2027
+
2028
+ function replaceObjectProps(o1, o2) {
2029
+ var o = cloneObject(o1);
2030
+ for (var p in o1) { o[p] = o2.hasOwnProperty(p) ? o2[p] : o1[p]; }
2031
+ return o;
2032
+ }
2033
+
2034
+ function mergeObjects(o1, o2) {
2035
+ var o = cloneObject(o1);
2036
+ for (var p in o2) { o[p] = is$1.und(o1[p]) ? o2[p] : o1[p]; }
2037
+ return o;
2038
+ }
2039
+
2040
+ // Colors
2041
+
2042
+ function rgbToRgba(rgbValue) {
2043
+ var rgb = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(rgbValue);
2044
+ return rgb ? ("rgba(" + (rgb[1]) + ",1)") : rgbValue;
2045
+ }
2046
+
2047
+ function hexToRgba(hexValue) {
2048
+ var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
2049
+ var hex = hexValue.replace(rgx, function (m, r, g, b) { return r + r + g + g + b + b; } );
2050
+ var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
2051
+ var r = parseInt(rgb[1], 16);
2052
+ var g = parseInt(rgb[2], 16);
2053
+ var b = parseInt(rgb[3], 16);
2054
+ return ("rgba(" + r + "," + g + "," + b + ",1)");
2055
+ }
2056
+
2057
+ function hslToRgba(hslValue) {
2058
+ var hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(hslValue);
2059
+ var h = parseInt(hsl[1], 10) / 360;
2060
+ var s = parseInt(hsl[2], 10) / 100;
2061
+ var l = parseInt(hsl[3], 10) / 100;
2062
+ var a = hsl[4] || 1;
2063
+ function hue2rgb(p, q, t) {
2064
+ if (t < 0) { t += 1; }
2065
+ if (t > 1) { t -= 1; }
2066
+ if (t < 1/6) { return p + (q - p) * 6 * t; }
2067
+ if (t < 1/2) { return q; }
2068
+ if (t < 2/3) { return p + (q - p) * (2/3 - t) * 6; }
2069
+ return p;
2070
+ }
2071
+ var r, g, b;
2072
+ if (s == 0) {
2073
+ r = g = b = l;
2074
+ } else {
2075
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
2076
+ var p = 2 * l - q;
2077
+ r = hue2rgb(p, q, h + 1/3);
2078
+ g = hue2rgb(p, q, h);
2079
+ b = hue2rgb(p, q, h - 1/3);
2080
+ }
2081
+ return ("rgba(" + (r * 255) + "," + (g * 255) + "," + (b * 255) + "," + a + ")");
2082
+ }
2083
+
2084
+ function colorToRgb(val) {
2085
+ if (is$1.rgb(val)) { return rgbToRgba(val); }
2086
+ if (is$1.hex(val)) { return hexToRgba(val); }
2087
+ if (is$1.hsl(val)) { return hslToRgba(val); }
2088
+ }
2089
+
2090
+ // Units
2091
+
2092
+ function getUnit(val) {
2093
+ var split = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(val);
2094
+ if (split) { return split[1]; }
2095
+ }
2096
+
2097
+ function getTransformUnit(propName) {
2098
+ if (stringContains(propName, 'translate') || propName === 'perspective') { return 'px'; }
2099
+ if (stringContains(propName, 'rotate') || stringContains(propName, 'skew')) { return 'deg'; }
2100
+ }
2101
+
2102
+ // Values
2103
+
2104
+ function getFunctionValue(val, animatable) {
2105
+ if (!is$1.fnc(val)) { return val; }
2106
+ return val(animatable.target, animatable.id, animatable.total);
2107
+ }
2108
+
2109
+ function getAttribute(el, prop) {
2110
+ return el.getAttribute(prop);
2111
+ }
2112
+
2113
+ function convertPxToUnit(el, value, unit) {
2114
+ var valueUnit = getUnit(value);
2115
+ if (arrayContains([unit, 'deg', 'rad', 'turn'], valueUnit)) { return value; }
2116
+ var cached = cache.CSS[value + unit];
2117
+ if (!is$1.und(cached)) { return cached; }
2118
+ var baseline = 100;
2119
+ var tempEl = document.createElement(el.tagName);
2120
+ var parentEl = (el.parentNode && (el.parentNode !== document)) ? el.parentNode : document.body;
2121
+ parentEl.appendChild(tempEl);
2122
+ tempEl.style.position = 'absolute';
2123
+ tempEl.style.width = baseline + unit;
2124
+ var factor = baseline / tempEl.offsetWidth;
2125
+ parentEl.removeChild(tempEl);
2126
+ var convertedUnit = factor * parseFloat(value);
2127
+ cache.CSS[value + unit] = convertedUnit;
2128
+ return convertedUnit;
2129
+ }
2130
+
2131
+ function getCSSValue(el, prop, unit) {
2132
+ if (prop in el.style) {
2133
+ var uppercasePropName = prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
2134
+ var value = el.style[prop] || getComputedStyle(el).getPropertyValue(uppercasePropName) || '0';
2135
+ return unit ? convertPxToUnit(el, value, unit) : value;
2136
+ }
2137
+ }
2138
+
2139
+ function getAnimationType(el, prop) {
2140
+ if (is$1.dom(el) && !is$1.inp(el) && (!is$1.nil(getAttribute(el, prop)) || (is$1.svg(el) && el[prop]))) { return 'attribute'; }
2141
+ if (is$1.dom(el) && arrayContains(validTransforms, prop)) { return 'transform'; }
2142
+ if (is$1.dom(el) && (prop !== 'transform' && getCSSValue(el, prop))) { return 'css'; }
2143
+ if (el[prop] != null) { return 'object'; }
2144
+ }
2145
+
2146
+ function getElementTransforms(el) {
2147
+ if (!is$1.dom(el)) { return; }
2148
+ var str = el.style.transform || '';
2149
+ var reg = /(\w+)\(([^)]*)\)/g;
2150
+ var transforms = new Map();
2151
+ var m; while (m = reg.exec(str)) { transforms.set(m[1], m[2]); }
2152
+ return transforms;
2153
+ }
2154
+
2155
+ function getTransformValue(el, propName, animatable, unit) {
2156
+ var defaultVal = stringContains(propName, 'scale') ? 1 : 0 + getTransformUnit(propName);
2157
+ var value = getElementTransforms(el).get(propName) || defaultVal;
2158
+ if (animatable) {
2159
+ animatable.transforms.list.set(propName, value);
2160
+ animatable.transforms['last'] = propName;
2161
+ }
2162
+ return unit ? convertPxToUnit(el, value, unit) : value;
2163
+ }
2164
+
2165
+ function getOriginalTargetValue(target, propName, unit, animatable) {
2166
+ switch (getAnimationType(target, propName)) {
2167
+ case 'transform': return getTransformValue(target, propName, animatable, unit);
2168
+ case 'css': return getCSSValue(target, propName, unit);
2169
+ case 'attribute': return getAttribute(target, propName);
2170
+ default: return target[propName] || 0;
2171
+ }
2172
+ }
2173
+
2174
+ function getRelativeValue(to, from) {
2175
+ var operator = /^(\*=|\+=|-=)/.exec(to);
2176
+ if (!operator) { return to; }
2177
+ var u = getUnit(to) || 0;
2178
+ var x = parseFloat(from);
2179
+ var y = parseFloat(to.replace(operator[0], ''));
2180
+ switch (operator[0][0]) {
2181
+ case '+': return x + y + u;
2182
+ case '-': return x - y + u;
2183
+ case '*': return x * y + u;
2184
+ }
2185
+ }
2186
+
2187
+ function validateValue(val, unit) {
2188
+ if (is$1.col(val)) { return colorToRgb(val); }
2189
+ if (/\s/g.test(val)) { return val; }
2190
+ var originalUnit = getUnit(val);
2191
+ var unitLess = originalUnit ? val.substr(0, val.length - originalUnit.length) : val;
2192
+ if (unit) { return unitLess + unit; }
2193
+ return unitLess;
2194
+ }
2195
+
2196
+ // getTotalLength() equivalent for circle, rect, polyline, polygon and line shapes
2197
+ // adapted from https://gist.github.com/SebLambla/3e0550c496c236709744
2198
+
2199
+ function getDistance(p1, p2) {
2200
+ return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
2201
+ }
2202
+
2203
+ function getCircleLength(el) {
2204
+ return Math.PI * 2 * getAttribute(el, 'r');
2205
+ }
2206
+
2207
+ function getRectLength(el) {
2208
+ return (getAttribute(el, 'width') * 2) + (getAttribute(el, 'height') * 2);
2209
+ }
2210
+
2211
+ function getLineLength(el) {
2212
+ return getDistance(
2213
+ {x: getAttribute(el, 'x1'), y: getAttribute(el, 'y1')},
2214
+ {x: getAttribute(el, 'x2'), y: getAttribute(el, 'y2')}
2215
+ );
2216
+ }
2217
+
2218
+ function getPolylineLength(el) {
2219
+ var points = el.points;
2220
+ var totalLength = 0;
2221
+ var previousPos;
2222
+ for (var i = 0 ; i < points.numberOfItems; i++) {
2223
+ var currentPos = points.getItem(i);
2224
+ if (i > 0) { totalLength += getDistance(previousPos, currentPos); }
2225
+ previousPos = currentPos;
2226
+ }
2227
+ return totalLength;
2228
+ }
2229
+
2230
+ function getPolygonLength(el) {
2231
+ var points = el.points;
2232
+ return getPolylineLength(el) + getDistance(points.getItem(points.numberOfItems - 1), points.getItem(0));
2233
+ }
2234
+
2235
+ // Path animation
2236
+
2237
+ function getTotalLength(el) {
2238
+ if (el.getTotalLength) { return el.getTotalLength(); }
2239
+ switch(el.tagName.toLowerCase()) {
2240
+ case 'circle': return getCircleLength(el);
2241
+ case 'rect': return getRectLength(el);
2242
+ case 'line': return getLineLength(el);
2243
+ case 'polyline': return getPolylineLength(el);
2244
+ case 'polygon': return getPolygonLength(el);
2245
+ }
2246
+ }
2247
+
2248
+ function setDashoffset(el) {
2249
+ var pathLength = getTotalLength(el);
2250
+ el.setAttribute('stroke-dasharray', pathLength);
2251
+ return pathLength;
2252
+ }
2253
+
2254
+ // Motion path
2255
+
2256
+ function getParentSvgEl(el) {
2257
+ var parentEl = el.parentNode;
2258
+ while (is$1.svg(parentEl)) {
2259
+ if (!is$1.svg(parentEl.parentNode)) { break; }
2260
+ parentEl = parentEl.parentNode;
2261
+ }
2262
+ return parentEl;
2263
+ }
2264
+
2265
+ function getParentSvg(pathEl, svgData) {
2266
+ var svg = svgData || {};
2267
+ var parentSvgEl = svg.el || getParentSvgEl(pathEl);
2268
+ var rect = parentSvgEl.getBoundingClientRect();
2269
+ var viewBoxAttr = getAttribute(parentSvgEl, 'viewBox');
2270
+ var width = rect.width;
2271
+ var height = rect.height;
2272
+ var viewBox = svg.viewBox || (viewBoxAttr ? viewBoxAttr.split(' ') : [0, 0, width, height]);
2273
+ return {
2274
+ el: parentSvgEl,
2275
+ viewBox: viewBox,
2276
+ x: viewBox[0] / 1,
2277
+ y: viewBox[1] / 1,
2278
+ w: width,
2279
+ h: height,
2280
+ vW: viewBox[2],
2281
+ vH: viewBox[3]
2282
+ }
2283
+ }
2284
+
2285
+ function getPath(path, percent) {
2286
+ var pathEl = is$1.str(path) ? selectString(path)[0] : path;
2287
+ var p = percent || 100;
2288
+ return function(property) {
2289
+ return {
2290
+ property: property,
2291
+ el: pathEl,
2292
+ svg: getParentSvg(pathEl),
2293
+ totalLength: getTotalLength(pathEl) * (p / 100)
2294
+ }
2295
+ }
2296
+ }
2297
+
2298
+ function getPathProgress(path, progress, isPathTargetInsideSVG) {
2299
+ function point(offset) {
2300
+ if ( offset === void 0 ) offset = 0;
2301
+
2302
+ var l = progress + offset >= 1 ? progress + offset : 0;
2303
+ return path.el.getPointAtLength(l);
2304
+ }
2305
+ var svg = getParentSvg(path.el, path.svg);
2306
+ var p = point();
2307
+ var p0 = point(-1);
2308
+ var p1 = point(+1);
2309
+ var scaleX = isPathTargetInsideSVG ? 1 : svg.w / svg.vW;
2310
+ var scaleY = isPathTargetInsideSVG ? 1 : svg.h / svg.vH;
2311
+ switch (path.property) {
2312
+ case 'x': return (p.x - svg.x) * scaleX;
2313
+ case 'y': return (p.y - svg.y) * scaleY;
2314
+ case 'angle': return Math.atan2(p1.y - p0.y, p1.x - p0.x) * 180 / Math.PI;
2315
+ }
2316
+ }
2317
+
2318
+ // Decompose value
2319
+
2320
+ function decomposeValue(val, unit) {
2321
+ // const rgx = /-?\d*\.?\d+/g; // handles basic numbers
2322
+ // const rgx = /[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g; // handles exponents notation
2323
+ var rgx = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g; // handles exponents notation
2324
+ var value = validateValue((is$1.pth(val) ? val.totalLength : val), unit) + '';
2325
+ return {
2326
+ original: value,
2327
+ numbers: value.match(rgx) ? value.match(rgx).map(Number) : [0],
2328
+ strings: (is$1.str(val) || unit) ? value.split(rgx) : []
2329
+ }
2330
+ }
2331
+
2332
+ // Animatables
2333
+
2334
+ function parseTargets(targets) {
2335
+ var targetsArray = targets ? (flattenArray(is$1.arr(targets) ? targets.map(toArray) : toArray(targets))) : [];
2336
+ return filterArray(targetsArray, function (item, pos, self) { return self.indexOf(item) === pos; });
2337
+ }
2338
+
2339
+ function getAnimatables(targets) {
2340
+ var parsed = parseTargets(targets);
2341
+ return parsed.map(function (t, i) {
2342
+ return {target: t, id: i, total: parsed.length, transforms: { list: getElementTransforms(t) } };
2343
+ });
2344
+ }
2345
+
2346
+ // Properties
2347
+
2348
+ function normalizePropertyTweens(prop, tweenSettings) {
2349
+ var settings = cloneObject(tweenSettings);
2350
+ // Override duration if easing is a spring
2351
+ if (/^spring/.test(settings.easing)) { settings.duration = spring(settings.easing); }
2352
+ if (is$1.arr(prop)) {
2353
+ var l = prop.length;
2354
+ var isFromTo = (l === 2 && !is$1.obj(prop[0]));
2355
+ if (!isFromTo) {
2356
+ // Duration divided by the number of tweens
2357
+ if (!is$1.fnc(tweenSettings.duration)) { settings.duration = tweenSettings.duration / l; }
2358
+ } else {
2359
+ // Transform [from, to] values shorthand to a valid tween value
2360
+ prop = {value: prop};
2361
+ }
2362
+ }
2363
+ var propArray = is$1.arr(prop) ? prop : [prop];
2364
+ return propArray.map(function (v, i) {
2365
+ var obj = (is$1.obj(v) && !is$1.pth(v)) ? v : {value: v};
2366
+ // Default delay value should only be applied to the first tween
2367
+ if (is$1.und(obj.delay)) { obj.delay = !i ? tweenSettings.delay : 0; }
2368
+ // Default endDelay value should only be applied to the last tween
2369
+ if (is$1.und(obj.endDelay)) { obj.endDelay = i === propArray.length - 1 ? tweenSettings.endDelay : 0; }
2370
+ return obj;
2371
+ }).map(function (k) { return mergeObjects(k, settings); });
2372
+ }
2373
+
2374
+
2375
+ function flattenKeyframes(keyframes) {
2376
+ var propertyNames = filterArray(flattenArray(keyframes.map(function (key) { return Object.keys(key); })), function (p) { return is$1.key(p); })
2377
+ .reduce(function (a,b) { if (a.indexOf(b) < 0) { a.push(b); } return a; }, []);
2378
+ var properties = {};
2379
+ var loop = function ( i ) {
2380
+ var propName = propertyNames[i];
2381
+ properties[propName] = keyframes.map(function (key) {
2382
+ var newKey = {};
2383
+ for (var p in key) {
2384
+ if (is$1.key(p)) {
2385
+ if (p == propName) { newKey.value = key[p]; }
2386
+ } else {
2387
+ newKey[p] = key[p];
2388
+ }
2389
+ }
2390
+ return newKey;
2391
+ });
2392
+ };
2393
+
2394
+ for (var i = 0; i < propertyNames.length; i++) loop( i );
2395
+ return properties;
2396
+ }
2397
+
2398
+ function getProperties(tweenSettings, params) {
2399
+ var properties = [];
2400
+ var keyframes = params.keyframes;
2401
+ if (keyframes) { params = mergeObjects(flattenKeyframes(keyframes), params); }
2402
+ for (var p in params) {
2403
+ if (is$1.key(p)) {
2404
+ properties.push({
2405
+ name: p,
2406
+ tweens: normalizePropertyTweens(params[p], tweenSettings)
2407
+ });
2408
+ }
2409
+ }
2410
+ return properties;
2411
+ }
2412
+
2413
+ // Tweens
2414
+
2415
+ function normalizeTweenValues(tween, animatable) {
2416
+ var t = {};
2417
+ for (var p in tween) {
2418
+ var value = getFunctionValue(tween[p], animatable);
2419
+ if (is$1.arr(value)) {
2420
+ value = value.map(function (v) { return getFunctionValue(v, animatable); });
2421
+ if (value.length === 1) { value = value[0]; }
2422
+ }
2423
+ t[p] = value;
2424
+ }
2425
+ t.duration = parseFloat(t.duration);
2426
+ t.delay = parseFloat(t.delay);
2427
+ return t;
2428
+ }
2429
+
2430
+ function normalizeTweens(prop, animatable) {
2431
+ var previousTween;
2432
+ return prop.tweens.map(function (t) {
2433
+ var tween = normalizeTweenValues(t, animatable);
2434
+ var tweenValue = tween.value;
2435
+ var to = is$1.arr(tweenValue) ? tweenValue[1] : tweenValue;
2436
+ var toUnit = getUnit(to);
2437
+ var originalValue = getOriginalTargetValue(animatable.target, prop.name, toUnit, animatable);
2438
+ var previousValue = previousTween ? previousTween.to.original : originalValue;
2439
+ var from = is$1.arr(tweenValue) ? tweenValue[0] : previousValue;
2440
+ var fromUnit = getUnit(from) || getUnit(originalValue);
2441
+ var unit = toUnit || fromUnit;
2442
+ if (is$1.und(to)) { to = previousValue; }
2443
+ tween.from = decomposeValue(from, unit);
2444
+ tween.to = decomposeValue(getRelativeValue(to, from), unit);
2445
+ tween.start = previousTween ? previousTween.end : 0;
2446
+ tween.end = tween.start + tween.delay + tween.duration + tween.endDelay;
2447
+ tween.easing = parseEasings(tween.easing, tween.duration);
2448
+ tween.isPath = is$1.pth(tweenValue);
2449
+ tween.isPathTargetInsideSVG = tween.isPath && is$1.svg(animatable.target);
2450
+ tween.isColor = is$1.col(tween.from.original);
2451
+ if (tween.isColor) { tween.round = 1; }
2452
+ previousTween = tween;
2453
+ return tween;
2454
+ });
2455
+ }
2456
+
2457
+ // Tween progress
2458
+
2459
+ var setProgressValue = {
2460
+ css: function (t, p, v) { return t.style[p] = v; },
2461
+ attribute: function (t, p, v) { return t.setAttribute(p, v); },
2462
+ object: function (t, p, v) { return t[p] = v; },
2463
+ transform: function (t, p, v, transforms, manual) {
2464
+ transforms.list.set(p, v);
2465
+ if (p === transforms.last || manual) {
2466
+ var str = '';
2467
+ transforms.list.forEach(function (value, prop) { str += prop + "(" + value + ") "; });
2468
+ t.style.transform = str;
2469
+ }
2470
+ }
2471
+ };
2472
+
2473
+ // Set Value helper
2474
+
2475
+ function setTargetsValue(targets, properties) {
2476
+ var animatables = getAnimatables(targets);
2477
+ animatables.forEach(function (animatable) {
2478
+ for (var property in properties) {
2479
+ var value = getFunctionValue(properties[property], animatable);
2480
+ var target = animatable.target;
2481
+ var valueUnit = getUnit(value);
2482
+ var originalValue = getOriginalTargetValue(target, property, valueUnit, animatable);
2483
+ var unit = valueUnit || getUnit(originalValue);
2484
+ var to = getRelativeValue(validateValue(value, unit), originalValue);
2485
+ var animType = getAnimationType(target, property);
2486
+ setProgressValue[animType](target, property, to, animatable.transforms, true);
2487
+ }
2488
+ });
2489
+ }
2490
+
2491
+ // Animations
2492
+
2493
+ function createAnimation(animatable, prop) {
2494
+ var animType = getAnimationType(animatable.target, prop.name);
2495
+ if (animType) {
2496
+ var tweens = normalizeTweens(prop, animatable);
2497
+ var lastTween = tweens[tweens.length - 1];
2498
+ return {
2499
+ type: animType,
2500
+ property: prop.name,
2501
+ animatable: animatable,
2502
+ tweens: tweens,
2503
+ duration: lastTween.end,
2504
+ delay: tweens[0].delay,
2505
+ endDelay: lastTween.endDelay
2506
+ }
2507
+ }
2508
+ }
2509
+
2510
+ function getAnimations(animatables, properties) {
2511
+ return filterArray(flattenArray(animatables.map(function (animatable) {
2512
+ return properties.map(function (prop) {
2513
+ return createAnimation(animatable, prop);
2514
+ });
2515
+ })), function (a) { return !is$1.und(a); });
2516
+ }
2517
+
2518
+ // Create Instance
2519
+
2520
+ function getInstanceTimings(animations, tweenSettings) {
2521
+ var animLength = animations.length;
2522
+ var getTlOffset = function (anim) { return anim.timelineOffset ? anim.timelineOffset : 0; };
2523
+ var timings = {};
2524
+ timings.duration = animLength ? Math.max.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.duration; })) : tweenSettings.duration;
2525
+ timings.delay = animLength ? Math.min.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.delay; })) : tweenSettings.delay;
2526
+ timings.endDelay = animLength ? timings.duration - Math.max.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.duration - anim.endDelay; })) : tweenSettings.endDelay;
2527
+ return timings;
2528
+ }
2529
+
2530
+ var instanceID = 0;
2531
+
2532
+ function createNewInstance(params) {
2533
+ var instanceSettings = replaceObjectProps(defaultInstanceSettings, params);
2534
+ var tweenSettings = replaceObjectProps(defaultTweenSettings, params);
2535
+ var properties = getProperties(tweenSettings, params);
2536
+ var animatables = getAnimatables(params.targets);
2537
+ var animations = getAnimations(animatables, properties);
2538
+ var timings = getInstanceTimings(animations, tweenSettings);
2539
+ var id = instanceID;
2540
+ instanceID++;
2541
+ return mergeObjects(instanceSettings, {
2542
+ id: id,
2543
+ children: [],
2544
+ animatables: animatables,
2545
+ animations: animations,
2546
+ duration: timings.duration,
2547
+ delay: timings.delay,
2548
+ endDelay: timings.endDelay
2549
+ });
2550
+ }
2551
+
2552
+ // Core
2553
+
2554
+ var activeInstances = [];
2555
+
2556
+ var engine = (function () {
2557
+ var raf;
2558
+
2559
+ function play() {
2560
+ if (!raf && (!isDocumentHidden() || !anime.suspendWhenDocumentHidden) && activeInstances.length > 0) {
2561
+ raf = requestAnimationFrame(step);
2562
+ }
2563
+ }
2564
+ function step(t) {
2565
+ // memo on algorithm issue:
2566
+ // dangerous iteration over mutable `activeInstances`
2567
+ // (that collection may be updated from within callbacks of `tick`-ed animation instances)
2568
+ var activeInstancesLength = activeInstances.length;
2569
+ var i = 0;
2570
+ while (i < activeInstancesLength) {
2571
+ var activeInstance = activeInstances[i];
2572
+ if (!activeInstance.paused) {
2573
+ activeInstance.tick(t);
2574
+ i++;
2575
+ } else {
2576
+ activeInstances.splice(i, 1);
2577
+ activeInstancesLength--;
2578
+ }
2579
+ }
2580
+ raf = i > 0 ? requestAnimationFrame(step) : undefined;
2581
+ }
2582
+
2583
+ function handleVisibilityChange() {
2584
+ if (!anime.suspendWhenDocumentHidden) { return; }
2585
+
2586
+ if (isDocumentHidden()) {
2587
+ // suspend ticks
2588
+ raf = cancelAnimationFrame(raf);
2589
+ } else { // is back to active tab
2590
+ // first adjust animations to consider the time that ticks were suspended
2591
+ activeInstances.forEach(
2592
+ function (instance) { return instance ._onDocumentVisibility(); }
2593
+ );
2594
+ engine();
2595
+ }
2596
+ }
2597
+ if (typeof document !== 'undefined') {
2598
+ document.addEventListener('visibilitychange', handleVisibilityChange);
2599
+ }
2600
+
2601
+ return play;
2602
+ })();
2603
+
2604
+ function isDocumentHidden() {
2605
+ return !!document && document.hidden;
2606
+ }
2607
+
2608
+ // Public Instance
2609
+
2610
+ function anime(params) {
2611
+ if ( params === void 0 ) params = {};
2612
+
2613
+
2614
+ var startTime = 0, lastTime = 0, now = 0;
2615
+ var children, childrenLength = 0;
2616
+ var resolve = null;
2617
+
2618
+ function makePromise(instance) {
2619
+ var promise = window.Promise && new Promise(function (_resolve) { return resolve = _resolve; });
2620
+ instance.finished = promise;
2621
+ return promise;
2622
+ }
2623
+
2624
+ var instance = createNewInstance(params);
2625
+ makePromise(instance);
2626
+
2627
+ function toggleInstanceDirection() {
2628
+ var direction = instance.direction;
2629
+ if (direction !== 'alternate') {
2630
+ instance.direction = direction !== 'normal' ? 'normal' : 'reverse';
2631
+ }
2632
+ instance.reversed = !instance.reversed;
2633
+ children.forEach(function (child) { return child.reversed = instance.reversed; });
2634
+ }
2635
+
2636
+ function adjustTime(time) {
2637
+ return instance.reversed ? instance.duration - time : time;
2638
+ }
2639
+
2640
+ function resetTime() {
2641
+ startTime = 0;
2642
+ lastTime = adjustTime(instance.currentTime) * (1 / anime.speed);
2643
+ }
2644
+
2645
+ function seekChild(time, child) {
2646
+ if (child) { child.seek(time - child.timelineOffset); }
2647
+ }
2648
+
2649
+ function syncInstanceChildren(time) {
2650
+ if (!instance.reversePlayback) {
2651
+ for (var i = 0; i < childrenLength; i++) { seekChild(time, children[i]); }
2652
+ } else {
2653
+ for (var i$1 = childrenLength; i$1--;) { seekChild(time, children[i$1]); }
2654
+ }
2655
+ }
2656
+
2657
+ function setAnimationsProgress(insTime) {
2658
+ var i = 0;
2659
+ var animations = instance.animations;
2660
+ var animationsLength = animations.length;
2661
+ while (i < animationsLength) {
2662
+ var anim = animations[i];
2663
+ var animatable = anim.animatable;
2664
+ var tweens = anim.tweens;
2665
+ var tweenLength = tweens.length - 1;
2666
+ var tween = tweens[tweenLength];
2667
+ // Only check for keyframes if there is more than one tween
2668
+ if (tweenLength) { tween = filterArray(tweens, function (t) { return (insTime < t.end); })[0] || tween; }
2669
+ var elapsed = minMax(insTime - tween.start - tween.delay, 0, tween.duration) / tween.duration;
2670
+ var eased = isNaN(elapsed) ? 1 : tween.easing(elapsed);
2671
+ var strings = tween.to.strings;
2672
+ var round = tween.round;
2673
+ var numbers = [];
2674
+ var toNumbersLength = tween.to.numbers.length;
2675
+ var progress = (void 0);
2676
+ for (var n = 0; n < toNumbersLength; n++) {
2677
+ var value = (void 0);
2678
+ var toNumber = tween.to.numbers[n];
2679
+ var fromNumber = tween.from.numbers[n] || 0;
2680
+ if (!tween.isPath) {
2681
+ value = fromNumber + (eased * (toNumber - fromNumber));
2682
+ } else {
2683
+ value = getPathProgress(tween.value, eased * toNumber, tween.isPathTargetInsideSVG);
2684
+ }
2685
+ if (round) {
2686
+ if (!(tween.isColor && n > 2)) {
2687
+ value = Math.round(value * round) / round;
2688
+ }
2689
+ }
2690
+ numbers.push(value);
2691
+ }
2692
+ // Manual Array.reduce for better performances
2693
+ var stringsLength = strings.length;
2694
+ if (!stringsLength) {
2695
+ progress = numbers[0];
2696
+ } else {
2697
+ progress = strings[0];
2698
+ for (var s = 0; s < stringsLength; s++) {
2699
+ var b = strings[s + 1];
2700
+ var n$1 = numbers[s];
2701
+ if (!isNaN(n$1)) {
2702
+ if (!b) {
2703
+ progress += n$1 + ' ';
2704
+ } else {
2705
+ progress += n$1 + b;
2706
+ }
2707
+ }
2708
+ }
2709
+ }
2710
+ setProgressValue[anim.type](animatable.target, anim.property, progress, animatable.transforms);
2711
+ anim.currentValue = progress;
2712
+ i++;
2713
+ }
2714
+ }
2715
+
2716
+ function setCallback(cb) {
2717
+ if (instance[cb] && !instance.passThrough) { instance[cb](instance); }
2718
+ }
2719
+
2720
+ function countIteration() {
2721
+ if (instance.remaining && instance.remaining !== true) {
2722
+ instance.remaining--;
2723
+ }
2724
+ }
2725
+
2726
+ function setInstanceProgress(engineTime) {
2727
+ var insDuration = instance.duration;
2728
+ var insDelay = instance.delay;
2729
+ var insEndDelay = insDuration - instance.endDelay;
2730
+ var insTime = adjustTime(engineTime);
2731
+ instance.progress = minMax((insTime / insDuration) * 100, 0, 100);
2732
+ instance.reversePlayback = insTime < instance.currentTime;
2733
+ if (children) { syncInstanceChildren(insTime); }
2734
+ if (!instance.began && instance.currentTime > 0) {
2735
+ instance.began = true;
2736
+ setCallback('begin');
2737
+ }
2738
+ if (!instance.loopBegan && instance.currentTime > 0) {
2739
+ instance.loopBegan = true;
2740
+ setCallback('loopBegin');
2741
+ }
2742
+ if (insTime <= insDelay && instance.currentTime !== 0) {
2743
+ setAnimationsProgress(0);
2744
+ }
2745
+ if ((insTime >= insEndDelay && instance.currentTime !== insDuration) || !insDuration) {
2746
+ setAnimationsProgress(insDuration);
2747
+ }
2748
+ if (insTime > insDelay && insTime < insEndDelay) {
2749
+ if (!instance.changeBegan) {
2750
+ instance.changeBegan = true;
2751
+ instance.changeCompleted = false;
2752
+ setCallback('changeBegin');
2753
+ }
2754
+ setCallback('change');
2755
+ setAnimationsProgress(insTime);
2756
+ } else {
2757
+ if (instance.changeBegan) {
2758
+ instance.changeCompleted = true;
2759
+ instance.changeBegan = false;
2760
+ setCallback('changeComplete');
2761
+ }
2762
+ }
2763
+ instance.currentTime = minMax(insTime, 0, insDuration);
2764
+ if (instance.began) { setCallback('update'); }
2765
+ if (engineTime >= insDuration) {
2766
+ lastTime = 0;
2767
+ countIteration();
2768
+ if (!instance.remaining) {
2769
+ instance.paused = true;
2770
+ if (!instance.completed) {
2771
+ instance.completed = true;
2772
+ setCallback('loopComplete');
2773
+ setCallback('complete');
2774
+ if (!instance.passThrough && 'Promise' in window) {
2775
+ resolve();
2776
+ makePromise(instance);
2777
+ }
2778
+ }
2779
+ } else {
2780
+ startTime = now;
2781
+ setCallback('loopComplete');
2782
+ instance.loopBegan = false;
2783
+ if (instance.direction === 'alternate') {
2784
+ toggleInstanceDirection();
2785
+ }
2786
+ }
2787
+ }
2788
+ }
2789
+
2790
+ instance.reset = function() {
2791
+ var direction = instance.direction;
2792
+ instance.passThrough = false;
2793
+ instance.currentTime = 0;
2794
+ instance.progress = 0;
2795
+ instance.paused = true;
2796
+ instance.began = false;
2797
+ instance.loopBegan = false;
2798
+ instance.changeBegan = false;
2799
+ instance.completed = false;
2800
+ instance.changeCompleted = false;
2801
+ instance.reversePlayback = false;
2802
+ instance.reversed = direction === 'reverse';
2803
+ instance.remaining = instance.loop;
2804
+ children = instance.children;
2805
+ childrenLength = children.length;
2806
+ for (var i = childrenLength; i--;) { instance.children[i].reset(); }
2807
+ if (instance.reversed && instance.loop !== true || (direction === 'alternate' && instance.loop === 1)) { instance.remaining++; }
2808
+ setAnimationsProgress(instance.reversed ? instance.duration : 0);
2809
+ };
2810
+
2811
+ // internal method (for engine) to adjust animation timings before restoring engine ticks (rAF)
2812
+ instance._onDocumentVisibility = resetTime;
2813
+
2814
+ // Set Value helper
2815
+
2816
+ instance.set = function(targets, properties) {
2817
+ setTargetsValue(targets, properties);
2818
+ return instance;
2819
+ };
2820
+
2821
+ instance.tick = function(t) {
2822
+ now = t;
2823
+ if (!startTime) { startTime = now; }
2824
+ setInstanceProgress((now + (lastTime - startTime)) * anime.speed);
2825
+ };
2826
+
2827
+ instance.seek = function(time) {
2828
+ setInstanceProgress(adjustTime(time));
2829
+ };
2830
+
2831
+ instance.pause = function() {
2832
+ instance.paused = true;
2833
+ resetTime();
2834
+ };
2835
+
2836
+ instance.play = function() {
2837
+ if (!instance.paused) { return; }
2838
+ if (instance.completed) { instance.reset(); }
2839
+ instance.paused = false;
2840
+ activeInstances.push(instance);
2841
+ resetTime();
2842
+ engine();
2843
+ };
2844
+
2845
+ instance.reverse = function() {
2846
+ toggleInstanceDirection();
2847
+ instance.completed = instance.reversed ? false : true;
2848
+ resetTime();
2849
+ };
2850
+
2851
+ instance.restart = function() {
2852
+ instance.reset();
2853
+ instance.play();
2854
+ };
2855
+
2856
+ instance.remove = function(targets) {
2857
+ var targetsArray = parseTargets(targets);
2858
+ removeTargetsFromInstance(targetsArray, instance);
2859
+ };
2860
+
2861
+ instance.reset();
2862
+
2863
+ if (instance.autoplay) { instance.play(); }
2864
+
2865
+ return instance;
2866
+
2867
+ }
2868
+
2869
+ // Remove targets from animation
2870
+
2871
+ function removeTargetsFromAnimations(targetsArray, animations) {
2872
+ for (var a = animations.length; a--;) {
2873
+ if (arrayContains(targetsArray, animations[a].animatable.target)) {
2874
+ animations.splice(a, 1);
2875
+ }
2876
+ }
2877
+ }
2878
+
2879
+ function removeTargetsFromInstance(targetsArray, instance) {
2880
+ var animations = instance.animations;
2881
+ var children = instance.children;
2882
+ removeTargetsFromAnimations(targetsArray, animations);
2883
+ for (var c = children.length; c--;) {
2884
+ var child = children[c];
2885
+ var childAnimations = child.animations;
2886
+ removeTargetsFromAnimations(targetsArray, childAnimations);
2887
+ if (!childAnimations.length && !child.children.length) { children.splice(c, 1); }
2888
+ }
2889
+ if (!animations.length && !children.length) { instance.pause(); }
2890
+ }
2891
+
2892
+ function removeTargetsFromActiveInstances(targets) {
2893
+ var targetsArray = parseTargets(targets);
2894
+ for (var i = activeInstances.length; i--;) {
2895
+ var instance = activeInstances[i];
2896
+ removeTargetsFromInstance(targetsArray, instance);
2897
+ }
2898
+ }
2899
+
2900
+ // Stagger helpers
2901
+
2902
+ function stagger(val, params) {
2903
+ if ( params === void 0 ) params = {};
2904
+
2905
+ var direction = params.direction || 'normal';
2906
+ var easing = params.easing ? parseEasings(params.easing) : null;
2907
+ var grid = params.grid;
2908
+ var axis = params.axis;
2909
+ var fromIndex = params.from || 0;
2910
+ var fromFirst = fromIndex === 'first';
2911
+ var fromCenter = fromIndex === 'center';
2912
+ var fromLast = fromIndex === 'last';
2913
+ var isRange = is$1.arr(val);
2914
+ var val1 = isRange ? parseFloat(val[0]) : parseFloat(val);
2915
+ var val2 = isRange ? parseFloat(val[1]) : 0;
2916
+ var unit = getUnit(isRange ? val[1] : val) || 0;
2917
+ var start = params.start || 0 + (isRange ? val1 : 0);
2918
+ var values = [];
2919
+ var maxValue = 0;
2920
+ return function (el, i, t) {
2921
+ if (fromFirst) { fromIndex = 0; }
2922
+ if (fromCenter) { fromIndex = (t - 1) / 2; }
2923
+ if (fromLast) { fromIndex = t - 1; }
2924
+ if (!values.length) {
2925
+ for (var index = 0; index < t; index++) {
2926
+ if (!grid) {
2927
+ values.push(Math.abs(fromIndex - index));
2928
+ } else {
2929
+ var fromX = !fromCenter ? fromIndex%grid[0] : (grid[0]-1)/2;
2930
+ var fromY = !fromCenter ? Math.floor(fromIndex/grid[0]) : (grid[1]-1)/2;
2931
+ var toX = index%grid[0];
2932
+ var toY = Math.floor(index/grid[0]);
2933
+ var distanceX = fromX - toX;
2934
+ var distanceY = fromY - toY;
2935
+ var value = Math.sqrt(distanceX * distanceX + distanceY * distanceY);
2936
+ if (axis === 'x') { value = -distanceX; }
2937
+ if (axis === 'y') { value = -distanceY; }
2938
+ values.push(value);
2939
+ }
2940
+ maxValue = Math.max.apply(Math, values);
2941
+ }
2942
+ if (easing) { values = values.map(function (val) { return easing(val / maxValue) * maxValue; }); }
2943
+ if (direction === 'reverse') { values = values.map(function (val) { return axis ? (val < 0) ? val * -1 : -val : Math.abs(maxValue - val); }); }
2944
+ }
2945
+ var spacing = isRange ? (val2 - val1) / maxValue : val1;
2946
+ return start + (spacing * (Math.round(values[i] * 100) / 100)) + unit;
2947
+ }
2948
+ }
2949
+
2950
+ // Timeline
2951
+
2952
+ function timeline(params) {
2953
+ if ( params === void 0 ) params = {};
2954
+
2955
+ var tl = anime(params);
2956
+ tl.duration = 0;
2957
+ tl.add = function(instanceParams, timelineOffset) {
2958
+ var tlIndex = activeInstances.indexOf(tl);
2959
+ var children = tl.children;
2960
+ if (tlIndex > -1) { activeInstances.splice(tlIndex, 1); }
2961
+ function passThrough(ins) { ins.passThrough = true; }
2962
+ for (var i = 0; i < children.length; i++) { passThrough(children[i]); }
2963
+ var insParams = mergeObjects(instanceParams, replaceObjectProps(defaultTweenSettings, params));
2964
+ insParams.targets = insParams.targets || params.targets;
2965
+ var tlDuration = tl.duration;
2966
+ insParams.autoplay = false;
2967
+ insParams.direction = tl.direction;
2968
+ insParams.timelineOffset = is$1.und(timelineOffset) ? tlDuration : getRelativeValue(timelineOffset, tlDuration);
2969
+ passThrough(tl);
2970
+ tl.seek(insParams.timelineOffset);
2971
+ var ins = anime(insParams);
2972
+ passThrough(ins);
2973
+ children.push(ins);
2974
+ var timings = getInstanceTimings(children, params);
2975
+ tl.delay = timings.delay;
2976
+ tl.endDelay = timings.endDelay;
2977
+ tl.duration = timings.duration;
2978
+ tl.seek(0);
2979
+ tl.reset();
2980
+ if (tl.autoplay) { tl.play(); }
2981
+ return tl;
2982
+ };
2983
+ return tl;
2984
+ }
2985
+
2986
+ anime.version = '3.2.1';
2987
+ anime.speed = 1;
2988
+ // TODO:#review: naming, documentation
2989
+ anime.suspendWhenDocumentHidden = true;
2990
+ anime.running = activeInstances;
2991
+ anime.remove = removeTargetsFromActiveInstances;
2992
+ anime.get = getOriginalTargetValue;
2993
+ anime.set = setTargetsValue;
2994
+ anime.convertPx = convertPxToUnit;
2995
+ anime.path = getPath;
2996
+ anime.setDashoffset = setDashoffset;
2997
+ anime.stagger = stagger;
2998
+ anime.timeline = timeline;
2999
+ anime.easing = parseEasings;
3000
+ anime.penner = penner;
3001
+ anime.random = function (min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; };
3002
+
3003
+ const facebook = `<!-- Generated by IcoMoon.io -->
3004
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
3005
+ <title>facebook</title>
3006
+ <path d="M19 32h-6c-0.552 0-1-0.448-1-1v0-13h-3c-0.552 0-1-0.448-1-1v0-5c0-0.552 0.448-1 1-1v0h3v-4c0-3.866 3.134-7 7-7v0h4c0.552 0 1 0.448 1 1v0 5c0 0.552-0.448 1-1 1v0h-2c-0.552 0-1 0.448-1 1v0 3h5c0.552 0 1 0.448 1 1 0 0.134-0.026 0.262-0.074 0.379l0.002-0.007-2 5c-0.152 0.371-0.51 0.628-0.928 0.628h-3v13c0 0.552-0.448 1-1 1v0zM14 30h4v-13c0-0.552 0.448-1 1-1v0h3.324l1.2-3h-4.524c-0.552 0-1-0.448-1-1v0-4c0-1.657 1.343-3 3-3v0h1v-3h-3c-2.761 0-5 2.239-5 5v0 5c0 0.552-0.448 1-1 1v0h-3v3h3c0.552 0 1 0.448 1 1v0z"></path>
3007
+ </svg>
3008
+ `;
3009
+
3010
+ const twitter = `<!-- Generated by IcoMoon.io -->
3011
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
3012
+ <title>twitter</title>
3013
+ <path d="M10.436 30c-0.012 0-0.026 0-0.041 0-3.691 0-7.129-1.088-10.009-2.961l0.071 0.043c-0.279-0.181-0.46-0.49-0.46-0.842 0-0.123 0.022-0.24 0.063-0.349l-0.002 0.007c0.148-0.387 0.516-0.657 0.948-0.657 0.042 0 0.083 0.003 0.123 0.007l-0.005-0c0.399 0.049 0.86 0.077 1.328 0.077 1.836 0 3.57-0.432 5.108-1.199l-0.066 0.030c-1.941-0.823-3.42-2.412-4.079-4.377l-0.015-0.051c-0.033-0.095-0.053-0.205-0.053-0.32 0-0.255 0.096-0.488 0.253-0.665l-0.001 0.001 0.062-0.062c-1.511-1.323-2.46-3.254-2.462-5.408v-0c0-0 0-0.001 0-0.001 0-0.374 0.194-0.703 0.488-0.89l0.004-0.003c0.115-0.070 0.25-0.121 0.393-0.145l0.007-0.001c-0.534-0.978-0.848-2.141-0.848-3.379 0-1.329 0.362-2.574 0.994-3.641l-0.018 0.033c0.176-0.301 0.498-0.501 0.866-0.501 0.312 0 0.591 0.143 0.774 0.367l0.001 0.002c2.627 3.213 6.397 5.405 10.682 5.953l0.082 0.009c0-0.098 0-0.2 0-0.302 0-0.001 0-0.002 0-0.002 0-3.949 3.201-7.15 7.15-7.15 1.852 0 3.54 0.704 4.81 1.86l-0.006-0.005c1.165-0.288 2.19-0.719 3.127-1.282l-0.051 0.028c0.146-0.088 0.323-0.141 0.512-0.141 0.552 0 1 0.448 1 1 0 0.109-0.017 0.214-0.050 0.312l0.002-0.007c-0.151 0.464-0.324 0.861-0.531 1.237l0.019-0.037c0.117-0.052 0.253-0.082 0.396-0.082 0.552 0 1 0.448 1 1 0 0.208-0.064 0.401-0.172 0.561l0.002-0.004c-0.812 1.212-1.772 2.247-2.87 3.114l-0.028 0.022c0 0.1 0 0.2 0 0.306 0 0.051 0.001 0.111 0.001 0.171 0 10.12-8.204 18.324-18.324 18.324-0.062 0-0.124-0-0.186-0.001l0.009 0zM5 27.084c1.616 0.58 3.481 0.916 5.424 0.916 0.004 0 0.008 0 0.013 0h-0.001c0.048 0 0.104 0.001 0.161 0.001 9.027 0 16.344-7.317 16.344-16.344 0-0.055-0-0.11-0.001-0.165l0 0.008c0-0.256 0-0.502-0.022-0.746-0.001-0.014-0.001-0.031-0.001-0.049 0-0.335 0.165-0.632 0.418-0.813l0.003-0.002q0.312-0.222 0.6-0.466l-0.364 0.052c-0.038 0.005-0.082 0.008-0.126 0.008-0.552 0-1-0.448-1-1 0-0.363 0.193-0.68 0.482-0.856l0.004-0.003q0.222-0.134 0.428-0.286c-0.3 0.082-0.6 0.154-0.912 0.214-0.059 0.012-0.127 0.020-0.197 0.020-0.286 0-0.544-0.12-0.727-0.313l-0-0c-0.943-1.007-2.28-1.634-3.764-1.634-2.845 0-5.152 2.307-5.152 5.152 0 0.001 0 0.002 0 0.002v-0c-0 0.020-0 0.043-0 0.066 0 0.395 0.043 0.781 0.125 1.151l-0.007-0.035c0.017 0.069 0.027 0.148 0.027 0.23 0 0.242-0.086 0.463-0.228 0.636l0.001-0.002c-0.177 0.219-0.445 0.358-0.746 0.358-0.024 0-0.047-0.001-0.071-0.003l0.003 0c-4.85-0.253-9.167-2.342-12.31-5.577l-0.004-0.005c-0.098 0.376-0.155 0.808-0.155 1.253 0 1.778 0.902 3.345 2.272 4.27l0.018 0.012c0.27 0.182 0.446 0.487 0.446 0.832 0 0.552-0.448 1-1 1-0.008 0-0.015-0-0.023-0l0.001 0c-0.548-0.010-1.074-0.082-1.577-0.21l0.047 0.010c0.554 1.812 2.029 3.181 3.866 3.574l0.034 0.006c0.458 0.097 0.797 0.499 0.797 0.979 0 0.456-0.305 0.841-0.722 0.961l-0.007 0.002c-0.412 0.117-0.89 0.198-1.383 0.225l-0.017 0.001c0.926 1.304 2.415 2.156 4.105 2.2l0.007 0c0.546 0.009 0.984 0.453 0.984 1 0 0.319-0.15 0.603-0.382 0.787l-0.002 0.002c-1.596 1.249-3.522 2.154-5.625 2.568l-0.085 0.014z"></path>
3014
+ </svg>
3015
+ `;
3016
+
3017
+ const copy_link = `<!-- Generated by IcoMoon.io -->
3018
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
3019
+ <title>link</title>
3020
+ <path d="M19.247 23.019l-4.189 4.189c-2.831 2.831-7.435 2.831-10.265 0-1.371-1.372-2.125-3.193-2.125-5.132s0.755-3.761 2.125-5.133l4.189-4.191c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-4.189 4.191c-1.875 1.875-2.907 4.367-2.907 7.019s1.032 5.143 2.907 7.017 4.368 2.907 7.019 2.907 5.143-1.032 7.017-2.908l4.189-4.189c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.52-1.885 0.001zM22.276 9.724c-0.521-0.521-1.364-0.521-1.885 0l-10.667 10.667c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l10.667-10.667c0.521-0.521 0.521-1.364 0-1.885zM29.093 2.908c-1.875-1.876-4.368-2.908-7.019-2.908s-5.143 1.032-7.017 2.908l-4.189 4.188c-0.521 0.521-0.521 1.364 0 1.885s1.364 0.521 1.885 0l4.189-4.189c2.831-2.831 7.435-2.831 10.265 0 1.371 1.372 2.125 3.193 2.125 5.132s-0.755 3.761-2.125 5.133l-4.189 4.191c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l4.189-4.191c1.875-1.875 2.907-4.367 2.907-7.019s-1.032-5.143-2.907-7.016z"></path>
3021
+ </svg>
3022
+ `;
3023
+
3024
+ const email = `<!-- Generated by IcoMoon.io -->
3025
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
3026
+ <title>mail</title>
3027
+ <path d="M28 2.667h-24c-2.205 0-4 1.795-4 4v18.667c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-18.667c0-2.205-1.795-4-4-4zM29.333 25.333c0 0.735-0.599 1.333-1.333 1.333h-24c-0.735 0-1.333-0.599-1.333-1.333v-12.685l10.54 4.865c0.888 0.409 1.84 0.613 2.793 0.613s1.907-0.204 2.793-0.615l10.54-4.864zM29.333 9.711l-11.657 5.38c-1.065 0.492-2.288 0.492-3.353 0l-11.656-5.38v-3.044c0-0.735 0.599-1.333 1.333-1.333h24c0.735 0 1.333 0.599 1.333 1.333z"></path>
3028
+ </svg>
3029
+ `;
3030
+
3031
+ const whatsapp = `<!-- Generated by IcoMoon.io -->
3032
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
3033
+ <title>whatsapp</title>
3034
+ <path d="M16 32c-0.008 0-0.018 0-0.028 0-3.1 0-5.993-0.887-8.439-2.421l0.066 0.039-7.2 2.3 2.336-6.964c-1.713-2.492-2.736-5.575-2.736-8.897 0-0.020 0-0.040 0-0.060v0.003c0.009-8.833 7.167-15.991 15.999-16h0.001c8.837 0 16 7.163 16 16s-7.163 16-16 16v0zM7.906 27.424l0.4 0.264c2.169 1.449 4.837 2.312 7.707 2.312 7.732 0 14-6.268 14-14s-6.268-14-14-14c-0.004 0-0.009 0-0.013 0h0.001c-7.729 0.008-13.992 6.271-14 13.999v0.001c-0 0.010-0 0.021-0 0.032 0 3.072 1 5.909 2.693 8.206l-0.027-0.038 0.304 0.416-1.4 4.2zM20.716 24.958c-1.684-0.131-3.237-0.574-4.641-1.271l0.073 0.033c-3.098-1.456-5.634-3.668-7.438-6.405l-0.042-0.067c-1.102-1.357-1.819-3.067-1.962-4.938l-0.002-0.030c-0.001-0.036-0.001-0.078-0.001-0.12 0-1.575 0.66-2.995 1.719-4l0.002-0.002c0.547-0.52 1.289-0.839 2.105-0.839 0.033 0 0.066 0.001 0.099 0.002l-0.005-0c0.2 0 0.378 0 0.542 0.018 0.016-0.001 0.035-0.001 0.054-0.001 0.815 0 1.502 0.549 1.711 1.298l0.003 0.012 0.324 0.782c0.376 0.906 0.858 2.068 0.942 2.244 0.144 0.251 0.23 0.552 0.23 0.873 0 0.286-0.068 0.557-0.188 0.797l0.005-0.010c-0.149 0.307-0.332 0.57-0.55 0.802l0.002-0.002c-0.148 0.168-0.248 0.274-0.346 0.378s-0.172 0.18-0.26 0.284c0.575 0.92 1.237 1.713 1.992 2.406l0.008 0.008c0.829 0.758 1.802 1.373 2.872 1.8l0.064 0.022c0.369-0.266 0.672-0.6 0.896-0.985l0.008-0.015 0.174-0.232c0.328-0.484 0.875-0.798 1.495-0.798 0.249 0 0.487 0.051 0.703 0.142l-0.012-0.004c0.492 0.168 2.922 1.372 2.946 1.384l0.228 0.11c0.415 0.149 0.758 0.417 0.996 0.763l0.004 0.007c0.107 0.349 0.169 0.75 0.169 1.166 0 0.591-0.125 1.153-0.349 1.661l0.010-0.026c-0.702 1.368-1.983 2.353-3.511 2.637l-0.031 0.005c-0.309 0.071-0.663 0.112-1.028 0.112-0.004 0-0.007 0-0.011 0h0.001zM10.632 9.318c-0.028-0.002-0.062-0.004-0.095-0.004-0.245 0-0.472 0.076-0.659 0.206l0.004-0.002c-0.726 0.651-1.18 1.591-1.18 2.638 0 0.044 0.001 0.087 0.002 0.13l-0-0.006c0.122 1.404 0.662 2.662 1.495 3.671l-0.009-0.011 0.12 0.168c1.627 2.491 3.865 4.46 6.504 5.723l0.096 0.041c3.136 1.288 3.916 1.124 4.426 1.014 0.87-0.159 1.601-0.656 2.067-1.347l0.007-0.011c0.12-0.316 0.204-0.682 0.237-1.063l0.001-0.015-0.040-0.018-0.256-0.124c-0.8-0.4-2.46-1.2-2.734-1.292l-0.058 0.184c-0.346 0.501-0.684 0.934-1.045 1.347l0.015-0.017c-0.344 0.349-0.821 0.565-1.349 0.565-0.28 0-0.546-0.061-0.785-0.17l0.012 0.005c-1.403-0.547-2.609-1.301-3.646-2.239l0.010 0.009c-0.975-0.891-1.81-1.912-2.486-3.039l-0.034-0.061c-0.152-0.244-0.242-0.54-0.242-0.857 0-0.463 0.191-0.88 0.499-1.178l0-0c0.13-0.162 0.264-0.302 0.4-0.444l0.236-0.256c0.091-0.096 0.177-0.201 0.254-0.311l0.006-0.009c-0.158-0.36-0.622-1.472-0.988-2.352l-0.322-0.772-0.038-0.086c-0.188-0.010-0.302-0.016-0.426-0.016zM12.462 12.442v0.012z"></path>
3035
+ </svg>
3036
+ `;
3037
+
3038
+ var Socials;
3039
+ (function (Socials) {
3040
+ Socials["FACEBOOK"] = "facebook";
3041
+ Socials["TWITTER"] = "twitter";
3042
+ Socials["WHATSAPP"] = "whatsapp";
3043
+ Socials["EMAIL"] = "email";
3044
+ Socials["COPY_LINK"] = "copy_link";
3045
+ })(Socials || (Socials = {}));
3046
+
3047
+ const sallaSocialShareCss = "";
3048
+
3049
+ const SallaSocialShare = class {
3050
+ constructor(hostRef) {
3051
+ registerInstance(this, hostRef);
3052
+ this.opened = false;
3053
+ this.allPlatforms = [Socials.WHATSAPP, Socials.FACEBOOK, Socials.TWITTER, Socials.EMAIL, Socials.COPY_LINK];
3054
+ this.platformIcons = [{ icon: whatsapp, name: Socials.WHATSAPP }, { icon: facebook, name: Socials.FACEBOOK }, { icon: twitter, name: Socials.TWITTER }, { icon: email, name: Socials.EMAIL }, { icon: copy_link, name: Socials.COPY_LINK }];
3055
+ /**
3056
+ * page url that will be shared custom | current page url
3057
+ */
3058
+ this.url = "";
3059
+ /**
3060
+ * page url name that will be shared custom | current page url
3061
+ */
3062
+ this.urlName = "";
3063
+ /**
3064
+ * selected platforms to share | all platforms
3065
+ */
3066
+ this.platforms = this.allPlatforms;
3067
+ }
3068
+ componentWillLoad() {
3069
+ // ? this will not work if there are multiple share components on the same page, this will be applied to the first one only
3070
+ window.a2a_config = window.a2a_config || {};
3071
+ window.a2a_config.linkurl = this.url ? this.url : window.location.href;
3072
+ window.a2a_config.linkname = this.urlName ? this.urlName : document.title;
3073
+ salla.lang.onLoaded(() => {
3074
+ window.a2a_config.locale = salla.lang.locale;
3075
+ });
3076
+ }
3077
+ open() {
3078
+ this.opened = !this.opened;
3079
+ if (this.opened) {
3080
+ this.shareMenu.classList.add('opened');
3081
+ }
3082
+ else {
3083
+ this.shareMenu.classList.remove('opened');
3084
+ }
3085
+ new anime.timeline()
3086
+ .add({
3087
+ targets: this.shareMenu,
3088
+ translateY: [-50, 0],
3089
+ opacity: [0, 1],
3090
+ duration: 300,
3091
+ podding: '0',
3092
+ easing: 'easeInOutSine'
3093
+ })
3094
+ .add({
3095
+ targets: this.platformItem,
3096
+ translateZ: 0,
3097
+ translateY: [-30, 0],
3098
+ scaleY: [0, 1],
3099
+ opacity: [0, 1],
3100
+ duration: 1200,
3101
+ delay: anime.stagger(100)
3102
+ }, '-=200');
3103
+ }
3104
+ render() {
3105
+ return (h("div", { id: "s-social-share", class: "s-social-share-wrapper" }, h("slot", { name: 'widget' }, h("salla-button", { "aria-label": "Share", onClick: () => this.open(), class: "s-social-share-btn", shape: "icon", fill: "outline", color: "light" }, h("i", { class: this.opened ? "sicon-cancel" : "sicon-share-alt" }))), h("ul", { ref: el => this.shareMenu = el, class: "s-social-share-list a2a_kit share" }, this.platforms.map(platform => {
3106
+ return (h("li", { ref: el => this.platformItem = el }, h("a", { class: `a2a_button_${platform}`, "aria-label": `Share Via ${platform}` }, this.platformIcons.map((icon) => {
3107
+ if (icon.name === platform) {
3108
+ return h("span", { class: "s-social-share-icon", innerHTML: icon.icon });
3109
+ }
3110
+ }))));
3111
+ }))));
3112
+ }
3113
+ };
3114
+ SallaSocialShare.style = sallaSocialShareCss;
3115
+
1603
3116
  /**
1604
3117
  * SSR Window 4.0.2
1605
3118
  * Better handling for window object in SSR environment
@@ -8364,4 +9877,4 @@ const SallaVerify = class {
8364
9877
  };
8365
9878
  SallaVerify.style = sallaVerifyCss;
8366
9879
 
8367
- export { SallaBranches as salla_branches, SallaButton as salla_button, SallaInfiniteScroll as salla_infinite_scroll, SallaListTile as salla_list_tile, SallaLoading as salla_loading, SallaLocalizationModal as salla_localization_modal, SallaLoginModal as salla_login_modal, SallaLoyalty as salla_loyalty, SallaModal as salla_modal, SallaOfferModal as salla_offer_modal, SallaPlaceholder as salla_placeholder, SallaProductAvailability as salla_product_availability, SallaProductSizeGuide as salla_product_size_guide, SallaRatingModal as salla_rating_modal, SallaRatingStars as salla_rating_stars, SallaSearch as salla_search, SallaSwiper as salla_swiper, SallaTabContent as salla_tab_content, SallaTabHeader as salla_tab_header, SallaTabs as salla_tabs, SallaTelInput as salla_tel_input, SallaVerify as salla_verify };
9880
+ export { SallaBranches as salla_branches, SallaButton as salla_button, SallaInfiniteScroll as salla_infinite_scroll, SallaListTile as salla_list_tile, SallaLoading as salla_loading, SallaLocalizationModal as salla_localization_modal, SallaLoginModal as salla_login_modal, SallaLoyalty as salla_loyalty, SallaModal as salla_modal, SallaOfferModal as salla_offer_modal, SallaPlaceholder as salla_placeholder, SallaProductAvailability as salla_product_availability, SallaProductSizeGuide as salla_product_size_guide, SallaRatingModal as salla_rating_modal, SallaRatingStars as salla_rating_stars, SallaSearch as salla_search, SallaSocialShare as salla_social_share, SallaSwiper as salla_swiper, SallaTabContent as salla_tab_content, SallaTabHeader as salla_tab_header, SallaTabs as salla_tabs, SallaTelInput as salla_tel_input, SallaVerify as salla_verify };