Premium Addons for Elementor - Version 3.20.3

Version Description

  • Fixed: Even layout in Blog widget not working when carousel option is enabled.
  • Fixed: Premium Templates button icon not showing.
Download this release

Release Info

Developer leap13
Plugin Icon 128x128 Premium Addons for Elementor
Version 3.20.3
Comparing to
See all releases

Code changes from version 3.20.2 to 3.20.3

assets/editor/templates/js/editor.js CHANGED
@@ -864,7 +864,7 @@
864
 
865
  setTimeout(function () {
866
  var $addNewSection = window.elementor.$previewContents.find('.elementor-add-new-section'),
867
- addPremiumTemplate = "<div class='elementor-add-section-area-button pa-add-section-btn' title='Add Premium Template'><i class='fas fa-star'></i></div>",
868
  $addPremiumTemplate;
869
 
870
  if ($addNewSection.length && PremiumTempsData.PremiumTemplatesBtn) {
864
 
865
  setTimeout(function () {
866
  var $addNewSection = window.elementor.$previewContents.find('.elementor-add-new-section'),
867
+ addPremiumTemplate = "<div class='elementor-add-section-area-button pa-add-section-btn' title='Add Premium Template'><i class='eicon-star'></i></div>",
868
  $addPremiumTemplate;
869
 
870
  if ($addNewSection.length && PremiumTempsData.PremiumTemplatesBtn) {
assets/frontend/css/premium-addons.css CHANGED
@@ -2629,11 +2629,20 @@ button.premium-modal-box-modal-close {
2629
  .premium-blog-wrap ul.slick-dots {
2630
  width: 100%; }
2631
 
2632
- /* * Carousel */
2633
- /* * Even Layout */
2634
  .premium-blog-even .premium-blog-post-container {
2635
  height: 100%; }
2636
 
 
 
 
 
 
 
 
 
 
 
 
2637
  @media (max-width: 768px) {
2638
  .premium-blog-content-wrapper {
2639
  top: 0;
@@ -2886,9 +2895,6 @@ ul.premium-person-social-list {
2886
  -ms-flex-pack: center;
2887
  justify-content: center; }
2888
 
2889
- /*
2890
- * Multiple Persons
2891
- */
2892
  .premium-persons-container.multiple-persons {
2893
  display: -ms-flexbox;
2894
  display: -webkit-flex;
@@ -2932,13 +2938,11 @@ ul.premium-person-social-list {
2932
  align-items: flex-start; }
2933
 
2934
  .premium-person-style1 .slick-track {
2935
- display: -ms-flexbox;
2936
- display: -webkit-flex;
2937
- display: -moz-flex;
2938
- display: -ms-flex;
2939
  -js-display: flex;
2940
  display: -webkit-box;
 
2941
  display: -moz-box;
 
2942
  display: flex; }
2943
 
2944
  .premium-person-style1 .slick-slide {
2629
  .premium-blog-wrap ul.slick-dots {
2630
  width: 100%; }
2631
 
 
 
2632
  .premium-blog-even .premium-blog-post-container {
2633
  height: 100%; }
2634
 
2635
+ .premium-blog-even .slick-track {
2636
+ -js-display: flex;
2637
+ display: -webkit-box;
2638
+ display: -webkit-flex;
2639
+ display: -moz-box;
2640
+ display: -ms-flexbox;
2641
+ display: flex; }
2642
+
2643
+ .premium-blog-even .slick-slide {
2644
+ height: inherit !important; }
2645
+
2646
  @media (max-width: 768px) {
2647
  .premium-blog-content-wrapper {
2648
  top: 0;
2895
  -ms-flex-pack: center;
2896
  justify-content: center; }
2897
 
 
 
 
2898
  .premium-persons-container.multiple-persons {
2899
  display: -ms-flexbox;
2900
  display: -webkit-flex;
2938
  align-items: flex-start; }
2939
 
2940
  .premium-person-style1 .slick-track {
 
 
 
 
2941
  -js-display: flex;
2942
  display: -webkit-box;
2943
+ display: -webkit-flex;
2944
  display: -moz-box;
2945
+ display: -ms-flexbox;
2946
  display: flex; }
2947
 
2948
  .premium-person-style1 .slick-slide {
assets/frontend/js/lottie.js CHANGED
@@ -1,18 +1,14561 @@
1
  (function ($) {
2
 
3
  (typeof navigator !== "undefined") && (function (root, factory) {
 
4
  if (typeof define === "function" && define.amd) {
5
  define(function () {
6
  return factory(root);
7
  });
8
- } else if (typeof module === "object" && module.exports) {
9
- module.exports = factory(root);
10
- } else {
11
- root.lottie = factory(root);
12
- root.bodymovin = root.lottie;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  }
14
- }((window || {}), function (window) {
15
- "use strict"; var svgNS = "http://www.w3.org/2000/svg", locationHref = "", initialDefaultFrame = -999999, subframeEnabled = !0, expressionsPlugin, isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), cachedColors = {}, bm_rounder = Math.round, bm_rnd, bm_pow = Math.pow, bm_sqrt = Math.sqrt, bm_abs = Math.abs, bm_floor = Math.floor, bm_max = Math.max, bm_min = Math.min, blitter = 10, BMMath = {}; function ProjectInterface() { return {} } !function () { var t, e = ["abs", "acos", "acosh", "asin", "asinh", "atan", "atanh", "atan2", "ceil", "cbrt", "expm1", "clz32", "cos", "cosh", "exp", "floor", "fround", "hypot", "imul", "log", "log1p", "log2", "log10", "max", "min", "pow", "random", "round", "sign", "sin", "sinh", "sqrt", "tan", "tanh", "trunc", "E", "LN10", "LN2", "LOG10E", "LOG2E", "PI", "SQRT1_2", "SQRT2"], r = e.length; for (t = 0; t < r; t += 1)BMMath[e[t]] = Math[e[t]] }(), BMMath.random = Math.random, BMMath.abs = function (t) { if ("object" === typeof t && t.length) { var e, r = createSizedArray(t.length), i = t.length; for (e = 0; e < i; e += 1)r[e] = Math.abs(t[e]); return r } return Math.abs(t) }; var defaultCurveSegments = 150, degToRads = Math.PI / 180, roundCorner = .5519; function roundValues(t) { bm_rnd = t ? Math.round : function (t) { return t } } function styleDiv(t) { t.style.position = "absolute", t.style.top = 0, t.style.left = 0, t.style.display = "block", t.style.transformOrigin = t.style.webkitTransformOrigin = "0 0", t.style.backfaceVisibility = t.style.webkitBackfaceVisibility = "visible", t.style.transformStyle = t.style.webkitTransformStyle = t.style.mozTransformStyle = "preserve-3d" } function BMEnterFrameEvent(t, e, r, i) { this.type = t, this.currentTime = e, this.totalTime = r, this.direction = i < 0 ? -1 : 1 } function BMCompleteEvent(t, e) { this.type = t, this.direction = e < 0 ? -1 : 1 } function BMCompleteLoopEvent(t, e, r, i) { this.type = t, this.currentLoop = r, this.totalLoops = e, this.direction = i < 0 ? -1 : 1 } function BMSegmentStartEvent(t, e, r) { this.type = t, this.firstFrame = e, this.totalFrames = r } function BMDestroyEvent(t, e) { this.type = t, this.target = e } function BMRenderFrameErrorEvent(t, e) { this.type = "renderFrameError", this.nativeError = t, this.currentTime = e } function BMConfigErrorEvent(t) { this.type = "configError", this.nativeError = t } function BMAnimationConfigErrorEvent(t, e) { this.type = t, this.nativeError = e, this.currentTime = currentTime } roundValues(!1); var createElementID = (G = 0, function () { return "__lottie_element_" + ++G }), G; function HSVtoRGB(t, e, r) { var i, s, a, n, o, h, l, p; switch (h = r * (1 - e), l = r * (1 - (o = 6 * t - (n = Math.floor(6 * t))) * e), p = r * (1 - (1 - o) * e), n % 6) { case 0: i = r, s = p, a = h; break; case 1: i = l, s = r, a = h; break; case 2: i = h, s = r, a = p; break; case 3: i = h, s = l, a = r; break; case 4: i = p, s = h, a = r; break; case 5: i = r, s = h, a = l }return [i, s, a] } function RGBtoHSV(t, e, r) { var i, s = Math.max(t, e, r), a = Math.min(t, e, r), n = s - a, o = 0 === s ? 0 : n / s, h = s / 255; switch (s) { case a: i = 0; break; case t: i = e - r + n * (e < r ? 6 : 0), i /= 6 * n; break; case e: i = r - t + 2 * n, i /= 6 * n; break; case r: i = t - e + 4 * n, i /= 6 * n }return [i, o, h] } function addSaturationToRGB(t, e) { var r = RGBtoHSV(255 * t[0], 255 * t[1], 255 * t[2]); return r[1] += e, 1 < r[1] ? r[1] = 1 : r[1] <= 0 && (r[1] = 0), HSVtoRGB(r[0], r[1], r[2]) } function addBrightnessToRGB(t, e) { var r = RGBtoHSV(255 * t[0], 255 * t[1], 255 * t[2]); return r[2] += e, 1 < r[2] ? r[2] = 1 : r[2] < 0 && (r[2] = 0), HSVtoRGB(r[0], r[1], r[2]) } function addHueToRGB(t, e) { var r = RGBtoHSV(255 * t[0], 255 * t[1], 255 * t[2]); return r[0] += e / 360, 1 < r[0] ? r[0] -= 1 : r[0] < 0 && (r[0] += 1), HSVtoRGB(r[0], r[1], r[2]) } var rgbToHex = function () { var t, e, i = []; for (t = 0; t < 256; t += 1)e = t.toString(16), i[t] = 1 == e.length ? "0" + e : e; return function (t, e, r) { return t < 0 && (t = 0), e < 0 && (e = 0), r < 0 && (r = 0), "#" + i[t] + i[e] + i[r] } }(); function BaseEvent() { } BaseEvent.prototype = { triggerEvent: function (t, e) { if (this._cbs[t]) for (var r = this._cbs[t].length, i = 0; i < r; i++)this._cbs[t][i](e) }, addEventListener: function (t, e) { return this._cbs[t] || (this._cbs[t] = []), this._cbs[t].push(e), function () { this.removeEventListener(t, e) }.bind(this) }, removeEventListener: function (t, e) { if (e) { if (this._cbs[t]) { for (var r = 0, i = this._cbs[t].length; r < i;)this._cbs[t][r] === e && (this._cbs[t].splice(r, 1), r -= 1, i -= 1), r += 1; this._cbs[t].length || (this._cbs[t] = null) } } else this._cbs[t] = null } }; var createTypedArray = "function" == typeof Uint8ClampedArray && "function" == typeof Float32Array ? function (t, e) { return "float32" === t ? new Float32Array(e) : "int16" === t ? new Int16Array(e) : "uint8c" === t ? new Uint8ClampedArray(e) : void 0 } : function (t, e) { var r, i = 0, s = []; switch (t) { case "int16": case "uint8c": r = 1; break; default: r = 1.1 }for (i = 0; i < e; i += 1)s.push(r); return s }; function createSizedArray(t) { return Array.apply(null, { length: t }) } function createNS(t) { return document.createElementNS(svgNS, t) } function createTag(t) { return document.createElement(t) } function DynamicPropertyContainer() { } DynamicPropertyContainer.prototype = { addDynamicProperty: function (t) { -1 === this.dynamicProperties.indexOf(t) && (this.dynamicProperties.push(t), this.container.addDynamicProperty(this), this._isAnimated = !0) }, iterateDynamicProperties: function () { this._mdf = !1; var t, e = this.dynamicProperties.length; for (t = 0; t < e; t += 1)this.dynamicProperties[t].getValue(), this.dynamicProperties[t]._mdf && (this._mdf = !0) }, initDynamicPropertyContainer: function (t) { this.container = t, this.dynamicProperties = [], this._mdf = !1, this._isAnimated = !1 } }; var getBlendMode = (Pa = { 0: "source-over", 1: "multiply", 2: "screen", 3: "overlay", 4: "darken", 5: "lighten", 6: "color-dodge", 7: "color-burn", 8: "hard-light", 9: "soft-light", 10: "difference", 11: "exclusion", 12: "hue", 13: "saturation", 14: "color", 15: "luminosity" }, function (t) { return Pa[t] || "" }), Pa, Matrix = function () { var s = Math.cos, a = Math.sin, n = Math.tan, i = Math.round; function t() { return this.props[0] = 1, this.props[1] = 0, this.props[2] = 0, this.props[3] = 0, this.props[4] = 0, this.props[5] = 1, this.props[6] = 0, this.props[7] = 0, this.props[8] = 0, this.props[9] = 0, this.props[10] = 1, this.props[11] = 0, this.props[12] = 0, this.props[13] = 0, this.props[14] = 0, this.props[15] = 1, this } function e(t) { if (0 === t) return this; var e = s(t), r = a(t); return this._t(e, -r, 0, 0, r, e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) } function r(t) { if (0 === t) return this; var e = s(t), r = a(t); return this._t(1, 0, 0, 0, 0, e, -r, 0, 0, r, e, 0, 0, 0, 0, 1) } function o(t) { if (0 === t) return this; var e = s(t), r = a(t); return this._t(e, 0, r, 0, 0, 1, 0, 0, -r, 0, e, 0, 0, 0, 0, 1) } function h(t) { if (0 === t) return this; var e = s(t), r = a(t); return this._t(e, -r, 0, 0, r, e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) } function l(t, e) { return this._t(1, e, t, 1, 0, 0) } function p(t, e) { return this.shear(n(t), n(e)) } function m(t, e) { var r = s(e), i = a(e); return this._t(r, i, 0, 0, -i, r, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)._t(1, 0, 0, 0, n(t), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)._t(r, -i, 0, 0, i, r, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) } function f(t, e, r) { return r || 0 === r || (r = 1), 1 === t && 1 === e && 1 === r ? this : this._t(t, 0, 0, 0, 0, e, 0, 0, 0, 0, r, 0, 0, 0, 0, 1) } function c(t, e, r, i, s, a, n, o, h, l, p, m, f, c, d, u) { return this.props[0] = t, this.props[1] = e, this.props[2] = r, this.props[3] = i, this.props[4] = s, this.props[5] = a, this.props[6] = n, this.props[7] = o, this.props[8] = h, this.props[9] = l, this.props[10] = p, this.props[11] = m, this.props[12] = f, this.props[13] = c, this.props[14] = d, this.props[15] = u, this } function d(t, e, r) { return r = r || 0, 0 !== t || 0 !== e || 0 !== r ? this._t(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, t, e, r, 1) : this } function u(t, e, r, i, s, a, n, o, h, l, p, m, f, c, d, u) { var y = this.props; if (1 === t && 0 === e && 0 === r && 0 === i && 0 === s && 1 === a && 0 === n && 0 === o && 0 === h && 0 === l && 1 === p && 0 === m) return y[12] = y[12] * t + y[15] * f, y[13] = y[13] * a + y[15] * c, y[14] = y[14] * p + y[15] * d, y[15] = y[15] * u, this._identityCalculated = !1, this; var g = y[0], v = y[1], b = y[2], E = y[3], x = y[4], P = y[5], S = y[6], _ = y[7], A = y[8], C = y[9], T = y[10], k = y[11], M = y[12], D = y[13], w = y[14], F = y[15]; return y[0] = g * t + v * s + b * h + E * f, y[1] = g * e + v * a + b * l + E * c, y[2] = g * r + v * n + b * p + E * d, y[3] = g * i + v * o + b * m + E * u, y[4] = x * t + P * s + S * h + _ * f, y[5] = x * e + P * a + S * l + _ * c, y[6] = x * r + P * n + S * p + _ * d, y[7] = x * i + P * o + S * m + _ * u, y[8] = A * t + C * s + T * h + k * f, y[9] = A * e + C * a + T * l + k * c, y[10] = A * r + C * n + T * p + k * d, y[11] = A * i + C * o + T * m + k * u, y[12] = M * t + D * s + w * h + F * f, y[13] = M * e + D * a + w * l + F * c, y[14] = M * r + D * n + w * p + F * d, y[15] = M * i + D * o + w * m + F * u, this._identityCalculated = !1, this } function y() { return this._identityCalculated || (this._identity = !(1 !== this.props[0] || 0 !== this.props[1] || 0 !== this.props[2] || 0 !== this.props[3] || 0 !== this.props[4] || 1 !== this.props[5] || 0 !== this.props[6] || 0 !== this.props[7] || 0 !== this.props[8] || 0 !== this.props[9] || 1 !== this.props[10] || 0 !== this.props[11] || 0 !== this.props[12] || 0 !== this.props[13] || 0 !== this.props[14] || 1 !== this.props[15]), this._identityCalculated = !0), this._identity } function g(t) { for (var e = 0; e < 16;) { if (t.props[e] !== this.props[e]) return !1; e += 1 } return !0 } function v(t) { var e; for (e = 0; e < 16; e += 1)t.props[e] = this.props[e] } function b(t) { var e; for (e = 0; e < 16; e += 1)this.props[e] = t[e] } function E(t, e, r) { return { x: t * this.props[0] + e * this.props[4] + r * this.props[8] + this.props[12], y: t * this.props[1] + e * this.props[5] + r * this.props[9] + this.props[13], z: t * this.props[2] + e * this.props[6] + r * this.props[10] + this.props[14] } } function x(t, e, r) { return t * this.props[0] + e * this.props[4] + r * this.props[8] + this.props[12] } function P(t, e, r) { return t * this.props[1] + e * this.props[5] + r * this.props[9] + this.props[13] } function S(t, e, r) { return t * this.props[2] + e * this.props[6] + r * this.props[10] + this.props[14] } function _() { var t = this.props[0] * this.props[5] - this.props[1] * this.props[4], e = this.props[5] / t, r = -this.props[1] / t, i = -this.props[4] / t, s = this.props[0] / t, a = (this.props[4] * this.props[13] - this.props[5] * this.props[12]) / t, n = -(this.props[0] * this.props[13] - this.props[1] * this.props[12]) / t, o = new Matrix; return o.props[0] = e, o.props[1] = r, o.props[4] = i, o.props[5] = s, o.props[12] = a, o.props[13] = n, o } function A(t) { return this.getInverseMatrix().applyToPointArray(t[0], t[1], t[2] || 0) } function C(t) { var e, r = t.length, i = []; for (e = 0; e < r; e += 1)i[e] = A(t[e]); return i } function T(t, e, r) { var i = createTypedArray("float32", 6); if (this.isIdentity()) i[0] = t[0], i[1] = t[1], i[2] = e[0], i[3] = e[1], i[4] = r[0], i[5] = r[1]; else { var s = this.props[0], a = this.props[1], n = this.props[4], o = this.props[5], h = this.props[12], l = this.props[13]; i[0] = t[0] * s + t[1] * n + h, i[1] = t[0] * a + t[1] * o + l, i[2] = e[0] * s + e[1] * n + h, i[3] = e[0] * a + e[1] * o + l, i[4] = r[0] * s + r[1] * n + h, i[5] = r[0] * a + r[1] * o + l } return i } function k(t, e, r) { return this.isIdentity() ? [t, e, r] : [t * this.props[0] + e * this.props[4] + r * this.props[8] + this.props[12], t * this.props[1] + e * this.props[5] + r * this.props[9] + this.props[13], t * this.props[2] + e * this.props[6] + r * this.props[10] + this.props[14]] } function M(t, e) { if (this.isIdentity()) return t + "," + e; var r = this.props; return Math.round(100 * (t * r[0] + e * r[4] + r[12])) / 100 + "," + Math.round(100 * (t * r[1] + e * r[5] + r[13])) / 100 } function D() { for (var t = 0, e = this.props, r = "matrix3d("; t < 16;)r += i(1e4 * e[t]) / 1e4, r += 15 === t ? ")" : ",", t += 1; return r } function w(t) { return t < 1e-6 && 0 < t || -1e-6 < t && t < 0 ? i(1e4 * t) / 1e4 : t } function F() { var t = this.props; return "matrix(" + w(t[0]) + "," + w(t[1]) + "," + w(t[4]) + "," + w(t[5]) + "," + w(t[12]) + "," + w(t[13]) + ")" } return function () { this.reset = t, this.rotate = e, this.rotateX = r, this.rotateY = o, this.rotateZ = h, this.skew = p, this.skewFromAxis = m, this.shear = l, this.scale = f, this.setTransform = c, this.translate = d, this.transform = u, this.applyToPoint = E, this.applyToX = x, this.applyToY = P, this.applyToZ = S, this.applyToPointArray = k, this.applyToTriplePoints = T, this.applyToPointStringified = M, this.toCSS = D, this.to2dCSS = F, this.clone = v, this.cloneFromProps = b, this.equals = g, this.inversePoints = C, this.inversePoint = A, this.getInverseMatrix = _, this._t = this.transform, this.isIdentity = y, this._identity = !0, this._identityCalculated = !1, this.props = createTypedArray("float32", 16), this.reset() } }(); !function (o, h) { var l, p = this, m = 256, f = 6, c = "random", d = h.pow(m, f), u = h.pow(2, 52), y = 2 * u, g = m - 1; function v(t) { var e, r = t.length, n = this, i = 0, s = n.i = n.j = 0, a = n.S = []; for (r || (t = [r++]); i < m;)a[i] = i++; for (i = 0; i < m; i++)a[i] = a[s = g & s + t[i % r] + (e = a[i])], a[s] = e; n.g = function (t) { for (var e, r = 0, i = n.i, s = n.j, a = n.S; t--;)e = a[i = g & i + 1], r = r * m + a[g & (a[i] = a[s = g & s + e]) + (a[s] = e)]; return n.i = i, n.j = s, r } } function b(t, e) { return e.i = t.i, e.j = t.j, e.S = t.S.slice(), e } function E(t, e) { for (var r, i = t + "", s = 0; s < i.length;)e[g & s] = g & (r ^= 19 * e[g & s]) + i.charCodeAt(s++); return x(e) } function x(t) { return String.fromCharCode.apply(0, t) } h["seed" + c] = function (t, e, r) { var i = [], s = E(function t(e, r) { var i, s = [], a = typeof e; if (r && "object" == a) for (i in e) try { s.push(t(e[i], r - 1)) } catch (t) { } return s.length ? s : "string" == a ? e : e + "\0" }((e = !0 === e ? { entropy: !0 } : e || {}).entropy ? [t, x(o)] : null === t ? function () { try { if (l) return x(l.randomBytes(m)); var t = new Uint8Array(m); return (p.crypto || p.msCrypto).getRandomValues(t), x(t) } catch (t) { var e = p.navigator, r = e && e.plugins; return [+new Date, p, r, p.screen, x(o)] } }() : t, 3), i), a = new v(i), n = function () { for (var t = a.g(f), e = d, r = 0; t < u;)t = (t + r) * m, e *= m, r = a.g(1); for (; y <= t;)t /= 2, e /= 2, r >>>= 1; return (t + r) / e }; return n.int32 = function () { return 0 | a.g(4) }, n.quick = function () { return a.g(4) / 4294967296 }, n.double = n, E(x(a.S), o), (e.pass || r || function (t, e, r, i) { return i && (i.S && b(i, a), t.state = function () { return b(a, {}) }), r ? (h[c] = t, e) : t })(n, s, "global" in e ? e.global : this == h, e.state) }, E(h.random(), o) }([], BMMath); var BezierFactory = function () { var t = { getBezierEasing: function (t, e, r, i, s) { var a = s || ("bez_" + t + "_" + e + "_" + r + "_" + i).replace(/\./g, "p"); if (o[a]) return o[a]; var n = new h([t, e, r, i]); return o[a] = n } }, o = {}; var l = 11, p = 1 / (l - 1), e = "function" == typeof Float32Array; function i(t, e) { return 1 - 3 * e + 3 * t } function s(t, e) { return 3 * e - 6 * t } function a(t) { return 3 * t } function m(t, e, r) { return ((i(e, r) * t + s(e, r)) * t + a(e)) * t } function f(t, e, r) { return 3 * i(e, r) * t * t + 2 * s(e, r) * t + a(e) } function h(t) { this._p = t, this._mSampleValues = e ? new Float32Array(l) : new Array(l), this._precomputed = !1, this.get = this.get.bind(this) } return h.prototype = { get: function (t) { var e = this._p[0], r = this._p[1], i = this._p[2], s = this._p[3]; return this._precomputed || this._precompute(), e === r && i === s ? t : 0 === t ? 0 : 1 === t ? 1 : m(this._getTForX(t), r, s) }, _precompute: function () { var t = this._p[0], e = this._p[1], r = this._p[2], i = this._p[3]; this._precomputed = !0, t === e && r === i || this._calcSampleValues() }, _calcSampleValues: function () { for (var t = this._p[0], e = this._p[2], r = 0; r < l; ++r)this._mSampleValues[r] = m(r * p, t, e) }, _getTForX: function (t) { for (var e = this._p[0], r = this._p[2], i = this._mSampleValues, s = 0, a = 1, n = l - 1; a !== n && i[a] <= t; ++a)s += p; var o = s + (t - i[--a]) / (i[a + 1] - i[a]) * p, h = f(o, e, r); return .001 <= h ? function (t, e, r, i) { for (var s = 0; s < 4; ++s) { var a = f(e, r, i); if (0 === a) return e; e -= (m(e, r, i) - t) / a } return e }(t, o, e, r) : 0 === h ? o : function (t, e, r, i, s) { for (var a, n, o = 0; 0 < (a = m(n = e + (r - e) / 2, i, s) - t) ? r = n : e = n, 1e-7 < Math.abs(a) && ++o < 10;); return n }(t, s, s + p, e, r) } }, t }(); function extendPrototype(t, e) { var r, i, s = t.length; for (r = 0; r < s; r += 1)for (var a in i = t[r].prototype) i.hasOwnProperty(a) && (e.prototype[a] = i[a]) } function getDescriptor(t, e) { return Object.getOwnPropertyDescriptor(t, e) } function createProxyFunction(t) { function e() { } return e.prototype = t, e } function bezFunction() { Math; function y(t, e, r, i, s, a) { var n = t * i + e * s + r * a - s * i - a * t - r * e; return -.001 < n && n < .001 } var p = function (t, e, r, i) { var s, a, n, o, h, l, p = defaultCurveSegments, m = 0, f = [], c = [], d = bezier_length_pool.newElement(); for (n = r.length, s = 0; s < p; s += 1) { for (h = s / (p - 1), a = l = 0; a < n; a += 1)o = bm_pow(1 - h, 3) * t[a] + 3 * bm_pow(1 - h, 2) * h * r[a] + 3 * (1 - h) * bm_pow(h, 2) * i[a] + bm_pow(h, 3) * e[a], f[a] = o, null !== c[a] && (l += bm_pow(f[a] - c[a], 2)), c[a] = f[a]; l && (m += l = bm_sqrt(l)), d.percents[s] = h, d.lengths[s] = m } return d.addedLength = m, d }; function g(t) { this.segmentLength = 0, this.points = new Array(t) } function v(t, e) { this.partialLength = t, this.point = e } var b, t = (b = {}, function (t, e, r, i) { var s = (t[0] + "_" + t[1] + "_" + e[0] + "_" + e[1] + "_" + r[0] + "_" + r[1] + "_" + i[0] + "_" + i[1]).replace(/\./g, "p"); if (!b[s]) { var a, n, o, h, l, p, m, f = defaultCurveSegments, c = 0, d = null; 2 === t.length && (t[0] != e[0] || t[1] != e[1]) && y(t[0], t[1], e[0], e[1], t[0] + r[0], t[1] + r[1]) && y(t[0], t[1], e[0], e[1], e[0] + i[0], e[1] + i[1]) && (f = 2); var u = new g(f); for (o = r.length, a = 0; a < f; a += 1) { for (m = createSizedArray(o), l = a / (f - 1), n = p = 0; n < o; n += 1)h = bm_pow(1 - l, 3) * t[n] + 3 * bm_pow(1 - l, 2) * l * (t[n] + r[n]) + 3 * (1 - l) * bm_pow(l, 2) * (e[n] + i[n]) + bm_pow(l, 3) * e[n], m[n] = h, null !== d && (p += bm_pow(m[n] - d[n], 2)); c += p = bm_sqrt(p), u.points[a] = new v(p, m), d = m } u.segmentLength = c, b[s] = u } return b[s] }); function M(t, e) { var r = e.percents, i = e.lengths, s = r.length, a = bm_floor((s - 1) * t), n = t * e.addedLength, o = 0; if (a === s - 1 || 0 === a || n === i[a]) return r[a]; for (var h = i[a] > n ? -1 : 1, l = !0; l;)if (i[a] <= n && i[a + 1] > n ? (o = (n - i[a]) / (i[a + 1] - i[a]), l = !1) : a += h, a < 0 || s - 1 <= a) { if (a === s - 1) return r[a]; l = !1 } return r[a] + (r[a + 1] - r[a]) * o } var D = createTypedArray("float32", 8); return { getSegmentsLength: function (t) { var e, r = segments_length_pool.newElement(), i = t.c, s = t.v, a = t.o, n = t.i, o = t._length, h = r.lengths, l = 0; for (e = 0; e < o - 1; e += 1)h[e] = p(s[e], s[e + 1], a[e], n[e + 1]), l += h[e].addedLength; return i && o && (h[e] = p(s[e], s[0], a[e], n[0]), l += h[e].addedLength), r.totalLength = l, r }, getNewSegment: function (t, e, r, i, s, a, n) { var o, h = M(s = s < 0 ? 0 : 1 < s ? 1 : s, n), l = M(a = 1 < a ? 1 : a, n), p = t.length, m = 1 - h, f = 1 - l, c = m * m * m, d = h * m * m * 3, u = h * h * m * 3, y = h * h * h, g = m * m * f, v = h * m * f + m * h * f + m * m * l, b = h * h * f + m * h * l + h * m * l, E = h * h * l, x = m * f * f, P = h * f * f + m * l * f + m * f * l, S = h * l * f + m * l * l + h * f * l, _ = h * l * l, A = f * f * f, C = l * f * f + f * l * f + f * f * l, T = l * l * f + f * l * l + l * f * l, k = l * l * l; for (o = 0; o < p; o += 1)D[4 * o] = Math.round(1e3 * (c * t[o] + d * r[o] + u * i[o] + y * e[o])) / 1e3, D[4 * o + 1] = Math.round(1e3 * (g * t[o] + v * r[o] + b * i[o] + E * e[o])) / 1e3, D[4 * o + 2] = Math.round(1e3 * (x * t[o] + P * r[o] + S * i[o] + _ * e[o])) / 1e3, D[4 * o + 3] = Math.round(1e3 * (A * t[o] + C * r[o] + T * i[o] + k * e[o])) / 1e3; return D }, getPointInSegment: function (t, e, r, i, s, a) { var n = M(s, a), o = 1 - n; return [Math.round(1e3 * (o * o * o * t[0] + (n * o * o + o * n * o + o * o * n) * r[0] + (n * n * o + o * n * n + n * o * n) * i[0] + n * n * n * e[0])) / 1e3, Math.round(1e3 * (o * o * o * t[1] + (n * o * o + o * n * o + o * o * n) * r[1] + (n * n * o + o * n * n + n * o * n) * i[1] + n * n * n * e[1])) / 1e3] }, buildBezierData: t, pointOnLine2D: y, pointOnLine3D: function (t, e, r, i, s, a, n, o, h) { if (0 === r && 0 === a && 0 === h) return y(t, e, i, s, n, o); var l, p = Math.sqrt(Math.pow(i - t, 2) + Math.pow(s - e, 2) + Math.pow(a - r, 2)), m = Math.sqrt(Math.pow(n - t, 2) + Math.pow(o - e, 2) + Math.pow(h - r, 2)), f = Math.sqrt(Math.pow(n - i, 2) + Math.pow(o - s, 2) + Math.pow(h - a, 2)); return -1e-4 < (l = m < p ? f < p ? p - m - f : f - m - p : m < f ? f - m - p : m - p - f) && l < 1e-4 } } } !function () { for (var a = 0, t = ["ms", "moz", "webkit", "o"], e = 0; e < t.length && !window.requestAnimationFrame; ++e)window.requestAnimationFrame = window[t[e] + "RequestAnimationFrame"], window.cancelAnimationFrame = window[t[e] + "CancelAnimationFrame"] || window[t[e] + "CancelRequestAnimationFrame"]; window.requestAnimationFrame || (window.requestAnimationFrame = function (t, e) { var r = (new Date).getTime(), i = Math.max(0, 16 - (r - a)), s = setTimeout(function () { t(r + i) }, i); return a = r + i, s }), window.cancelAnimationFrame || (window.cancelAnimationFrame = function (t) { clearTimeout(t) }) }(); var bez = bezFunction(); function dataFunctionManager() { function m(t, e, r) { var i, s, a, n, o, h, l = t.length; for (s = 0; s < l; s += 1)if ("ks" in (i = t[s]) && !i.completed) { if (i.completed = !0, i.tt && (t[s - 1].td = i.tt), [], -1, i.hasMask) { var p = i.masksProperties; for (n = p.length, a = 0; a < n; a += 1)if (p[a].pt.k.i) d(p[a].pt.k); else for (h = p[a].pt.k.length, o = 0; o < h; o += 1)p[a].pt.k[o].s && d(p[a].pt.k[o].s[0]), p[a].pt.k[o].e && d(p[a].pt.k[o].e[0]) } 0 === i.ty ? (i.layers = f(i.refId, e), m(i.layers, e, r)) : 4 === i.ty ? c(i.shapes) : 5 == i.ty && u(i, r) } } function f(t, e) { for (var r = 0, i = e.length; r < i;) { if (e[r].id === t) return e[r].layers.__used ? JSON.parse(JSON.stringify(e[r].layers)) : (e[r].layers.__used = !0, e[r].layers); r += 1 } } function c(t) { var e, r, i; for (e = t.length - 1; 0 <= e; e -= 1)if ("sh" == t[e].ty) { if (t[e].ks.k.i) d(t[e].ks.k); else for (i = t[e].ks.k.length, r = 0; r < i; r += 1)t[e].ks.k[r].s && d(t[e].ks.k[r].s[0]), t[e].ks.k[r].e && d(t[e].ks.k[r].e[0]); !0 } else "gr" == t[e].ty && c(t[e].it) } function d(t) { var e, r = t.i.length; for (e = 0; e < r; e += 1)t.i[e][0] += t.v[e][0], t.i[e][1] += t.v[e][1], t.o[e][0] += t.v[e][0], t.o[e][1] += t.v[e][1] } function o(t, e) { var r = e ? e.split(".") : [100, 100, 100]; return t[0] > r[0] || !(r[0] > t[0]) && (t[1] > r[1] || !(r[1] > t[1]) && (t[2] > r[2] || !(r[2] > t[2]) && void 0)) } var h, r = function () { var i = [4, 4, 14]; function s(t) { var e, r, i, s = t.length; for (e = 0; e < s; e += 1)5 === t[e].ty && (r = t[e], void 0, i = r.t.d, r.t.d = { k: [{ s: i, t: 0 }] }) } return function (t) { if (o(i, t.v) && (s(t.layers), t.assets)) { var e, r = t.assets.length; for (e = 0; e < r; e += 1)t.assets[e].layers && s(t.assets[e].layers) } } }(), i = (h = [4, 7, 99], function (t) { if (t.chars && !o(h, t.v)) { var e, r, i, s, a, n = t.chars.length; for (e = 0; e < n; e += 1)if (t.chars[e].data && t.chars[e].data.shapes) for (i = (a = t.chars[e].data.shapes[0].it).length, r = 0; r < i; r += 1)(s = a[r].ks.k).__converted || (d(a[r].ks.k), s.__converted = !0) } }), s = function () { var i = [4, 1, 9]; function a(t) { var e, r, i, s = t.length; for (e = 0; e < s; e += 1)if ("gr" === t[e].ty) a(t[e].it); else if ("fl" === t[e].ty || "st" === t[e].ty) if (t[e].c.k && t[e].c.k[0].i) for (i = t[e].c.k.length, r = 0; r < i; r += 1)t[e].c.k[r].s && (t[e].c.k[r].s[0] /= 255, t[e].c.k[r].s[1] /= 255, t[e].c.k[r].s[2] /= 255, t[e].c.k[r].s[3] /= 255), t[e].c.k[r].e && (t[e].c.k[r].e[0] /= 255, t[e].c.k[r].e[1] /= 255, t[e].c.k[r].e[2] /= 255, t[e].c.k[r].e[3] /= 255); else t[e].c.k[0] /= 255, t[e].c.k[1] /= 255, t[e].c.k[2] /= 255, t[e].c.k[3] /= 255 } function s(t) { var e, r = t.length; for (e = 0; e < r; e += 1)4 === t[e].ty && a(t[e].shapes) } return function (t) { if (o(i, t.v) && (s(t.layers), t.assets)) { var e, r = t.assets.length; for (e = 0; e < r; e += 1)t.assets[e].layers && s(t.assets[e].layers) } } }(), a = function () { var i = [4, 4, 18]; function l(t) { var e, r, i; for (e = t.length - 1; 0 <= e; e -= 1)if ("sh" == t[e].ty) { if (t[e].ks.k.i) t[e].ks.k.c = t[e].closed; else for (i = t[e].ks.k.length, r = 0; r < i; r += 1)t[e].ks.k[r].s && (t[e].ks.k[r].s[0].c = t[e].closed), t[e].ks.k[r].e && (t[e].ks.k[r].e[0].c = t[e].closed); !0 } else "gr" == t[e].ty && l(t[e].it) } function s(t) { var e, r, i, s, a, n, o = t.length; for (r = 0; r < o; r += 1) { if ((e = t[r]).hasMask) { var h = e.masksProperties; for (s = h.length, i = 0; i < s; i += 1)if (h[i].pt.k.i) h[i].pt.k.c = h[i].cl; else for (n = h[i].pt.k.length, a = 0; a < n; a += 1)h[i].pt.k[a].s && (h[i].pt.k[a].s[0].c = h[i].cl), h[i].pt.k[a].e && (h[i].pt.k[a].e[0].c = h[i].cl) } 4 === e.ty && l(e.shapes) } } return function (t) { if (o(i, t.v) && (s(t.layers), t.assets)) { var e, r = t.assets.length; for (e = 0; e < r; e += 1)t.assets[e].layers && s(t.assets[e].layers) } } }(); function u(t, e) { 0 !== t.t.a.length || "m" in t.t.p || (t.singleShape = !0) } var t = { completeData: function (t, e) { t.__complete || (s(t), r(t), i(t), a(t), m(t.layers, t.assets, e), t.__complete = !0) } }; return t.checkColors = s, t.checkChars = i, t.checkShapes = a, t.completeLayers = m, t } var dataManager = dataFunctionManager(), FontManager = function () { var a = { w: 0, size: 0, shapes: [] }, t = []; function u(t, e) { var r = createTag("span"); r.style.fontFamily = e; var i = createTag("span"); i.innerHTML = "giItT1WQy@!-/#", r.style.position = "absolute", r.style.left = "-10000px", r.style.top = "-10000px", r.style.fontSize = "300px", r.style.fontVariant = "normal", r.style.fontStyle = "normal", r.style.fontWeight = "normal", r.style.letterSpacing = "0", r.appendChild(i), document.body.appendChild(r); var s = i.offsetWidth; return i.style.fontFamily = t + ", " + e, { node: i, w: s, parent: r } } t = t.concat([2304, 2305, 2306, 2307, 2362, 2363, 2364, 2364, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2387, 2388, 2389, 2390, 2391, 2402, 2403]); var e = function () { this.fonts = [], this.chars = null, this.typekitLoaded = 0, this.isLoaded = !1, this.initTime = Date.now() }; return e.getCombinedCharacterCodes = function () { return t }, e.prototype.addChars = function (t) { if (t) { this.chars || (this.chars = []); var e, r, i, s = t.length, a = this.chars.length; for (e = 0; e < s; e += 1) { for (r = 0, i = !1; r < a;)this.chars[r].style === t[e].style && this.chars[r].fFamily === t[e].fFamily && this.chars[r].ch === t[e].ch && (i = !0), r += 1; i || (this.chars.push(t[e]), a += 1) } } }, e.prototype.addFonts = function (t, e) { if (t) { if (this.chars) return this.isLoaded = !0, void (this.fonts = t.list); var r, i, s, a, n = t.list, o = n.length, h = o; for (r = 0; r < o; r += 1) { var l, p, m = !0; if (n[r].loaded = !1, n[r].monoCase = u(n[r].fFamily, "monospace"), n[r].sansCase = u(n[r].fFamily, "sans-serif"), n[r].fPath) { if ("p" === n[r].fOrigin || 3 === n[r].origin) { if (0 < (l = document.querySelectorAll('style[f-forigin="p"][f-family="' + n[r].fFamily + '"], style[f-origin="3"][f-family="' + n[r].fFamily + '"]')).length && (m = !1), m) { var f = createTag("style"); f.setAttribute("f-forigin", n[r].fOrigin), f.setAttribute("f-origin", n[r].origin), f.setAttribute("f-family", n[r].fFamily), f.type = "text/css", f.innerHTML = "@font-face {font-family: " + n[r].fFamily + "; font-style: normal; src: url('" + n[r].fPath + "');}", e.appendChild(f) } } else if ("g" === n[r].fOrigin || 1 === n[r].origin) { for (l = document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'), p = 0; p < l.length; p++)-1 !== l[p].href.indexOf(n[r].fPath) && (m = !1); if (m) { var c = createTag("link"); c.setAttribute("f-forigin", n[r].fOrigin), c.setAttribute("f-origin", n[r].origin), c.type = "text/css", c.rel = "stylesheet", c.href = n[r].fPath, document.body.appendChild(c) } } else if ("t" === n[r].fOrigin || 2 === n[r].origin) { for (l = document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]'), p = 0; p < l.length; p++)n[r].fPath === l[p].src && (m = !1); if (m) { var d = createTag("link"); d.setAttribute("f-forigin", n[r].fOrigin), d.setAttribute("f-origin", n[r].origin), d.setAttribute("rel", "stylesheet"), d.setAttribute("href", n[r].fPath), e.appendChild(d) } } } else n[r].loaded = !0, h -= 1; n[r].helper = (i = e, s = n[r], a = void 0, (a = createNS("text")).style.fontSize = "100px", a.setAttribute("font-family", s.fFamily), a.setAttribute("font-style", s.fStyle), a.setAttribute("font-weight", s.fWeight), a.textContent = "1", s.fClass ? (a.style.fontFamily = "inherit", a.setAttribute("class", s.fClass)) : a.style.fontFamily = s.fFamily, i.appendChild(a), createTag("canvas").getContext("2d").font = s.fWeight + " " + s.fStyle + " 100px " + s.fFamily, a), n[r].cache = {}, this.fonts.push(n[r]) } 0 === h ? this.isLoaded = !0 : setTimeout(this.checkLoadedFonts.bind(this), 100) } else this.isLoaded = !0 }, e.prototype.getCharData = function (t, e, r) { for (var i = 0, s = this.chars.length; i < s;) { if (this.chars[i].ch === t && this.chars[i].style === e && this.chars[i].fFamily === r) return this.chars[i]; i += 1 } return ("string" == typeof t && 13 !== t.charCodeAt(0) || !t) && console && console.warn && console.warn("Missing character from exported characters list: ", t, e, r), a }, e.prototype.getFontByName = function (t) { for (var e = 0, r = this.fonts.length; e < r;) { if (this.fonts[e].fName === t) return this.fonts[e]; e += 1 } return this.fonts[0] }, e.prototype.measureText = function (t, e, r) { var i = this.getFontByName(e), s = t.charCodeAt(0); if (!i.cache[s + 1]) { var a = i.helper; if (" " === t) { a.textContent = "|" + t + "|"; var n = a.getComputedTextLength(); a.textContent = "||"; var o = a.getComputedTextLength(); i.cache[s + 1] = (n - o) / 100 } else a.textContent = t, i.cache[s + 1] = a.getComputedTextLength() / 100 } return i.cache[s + 1] * r }, e.prototype.checkLoadedFonts = function () { var t, e, r, i = this.fonts.length, s = i; for (t = 0; t < i; t += 1)this.fonts[t].loaded ? s -= 1 : "n" === this.fonts[t].fOrigin || 0 === this.fonts[t].origin ? this.fonts[t].loaded = !0 : (e = this.fonts[t].monoCase.node, r = this.fonts[t].monoCase.w, e.offsetWidth !== r ? (s -= 1, this.fonts[t].loaded = !0) : (e = this.fonts[t].sansCase.node, r = this.fonts[t].sansCase.w, e.offsetWidth !== r && (s -= 1, this.fonts[t].loaded = !0)), this.fonts[t].loaded && (this.fonts[t].sansCase.parent.parentNode.removeChild(this.fonts[t].sansCase.parent), this.fonts[t].monoCase.parent.parentNode.removeChild(this.fonts[t].monoCase.parent))); 0 !== s && Date.now() - this.initTime < 5e3 ? setTimeout(this.checkLoadedFonts.bind(this), 20) : setTimeout(function () { this.isLoaded = !0 }.bind(this), 0) }, e.prototype.loaded = function () { return this.isLoaded }, e }(), PropertyFactory = function () { var m = initialDefaultFrame, s = Math.abs; function f(t, e) { var r, i = this.offsetTime; "multidimensional" === this.propType && (r = createTypedArray("float32", this.pv.length)); for (var s, a, n, o, h, l, p, m, f = e.lastIndex, c = f, d = this.keyframes.length - 1, u = !0; u;) { if (s = this.keyframes[c], a = this.keyframes[c + 1], c === d - 1 && t >= a.t - i) { s.h && (s = a), f = 0; break } if (a.t - i > t) { f = c; break } c < d - 1 ? c += 1 : (f = 0, u = !1) } var y, g, v, b, E, x, P, S, _, A, C = a.t - i, T = s.t - i; if (s.to) { s.bezierData || (s.bezierData = bez.buildBezierData(s.s, a.s || s.e, s.to, s.ti)); var k = s.bezierData; if (C <= t || t < T) { var M = C <= t ? k.points.length - 1 : 0; for (o = k.points[M].point.length, n = 0; n < o; n += 1)r[n] = k.points[M].point[n] } else { s.__fnct ? m = s.__fnct : (m = BezierFactory.getBezierEasing(s.o.x, s.o.y, s.i.x, s.i.y, s.n).get, s.__fnct = m), h = m((t - T) / (C - T)); var D, w = k.segmentLength * h, F = e.lastFrame < t && e._lastKeyframeIndex === c ? e._lastAddedLength : 0; for (p = e.lastFrame < t && e._lastKeyframeIndex === c ? e._lastPoint : 0, u = !0, l = k.points.length; u;) { if (F += k.points[p].partialLength, 0 === w || 0 === h || p === k.points.length - 1) { for (o = k.points[p].point.length, n = 0; n < o; n += 1)r[n] = k.points[p].point[n]; break } if (F <= w && w < F + k.points[p + 1].partialLength) { for (D = (w - F) / k.points[p + 1].partialLength, o = k.points[p].point.length, n = 0; n < o; n += 1)r[n] = k.points[p].point[n] + (k.points[p + 1].point[n] - k.points[p].point[n]) * D; break } p < l - 1 ? p += 1 : u = !1 } e._lastPoint = p, e._lastAddedLength = F - k.points[p].partialLength, e._lastKeyframeIndex = c } } else { var I, V, R, B, L; if (d = s.s.length, y = a.s || s.e, this.sh && 1 !== s.h) if (C <= t) r[0] = y[0], r[1] = y[1], r[2] = y[2]; else if (t <= T) r[0] = s.s[0], r[1] = s.s[1], r[2] = s.s[2]; else { var G = N(s.s), z = N(y); g = r, v = function (t, e, r) { var i, s, a, n, o, h = [], l = t[0], p = t[1], m = t[2], f = t[3], c = e[0], d = e[1], u = e[2], y = e[3]; (s = l * c + p * d + m * u + f * y) < 0 && (s = -s, c = -c, d = -d, u = -u, y = -y); o = 1e-6 < 1 - s ? (i = Math.acos(s), a = Math.sin(i), n = Math.sin((1 - r) * i) / a, Math.sin(r * i) / a) : (n = 1 - r, r); return h[0] = n * l + o * c, h[1] = n * p + o * d, h[2] = n * m + o * u, h[3] = n * f + o * y, h }(G, z, (t - T) / (C - T)), b = v[0], E = v[1], x = v[2], P = v[3], S = Math.atan2(2 * E * P - 2 * b * x, 1 - 2 * E * E - 2 * x * x), _ = Math.asin(2 * b * E + 2 * x * P), A = Math.atan2(2 * b * P - 2 * E * x, 1 - 2 * b * b - 2 * x * x), g[0] = S / degToRads, g[1] = _ / degToRads, g[2] = A / degToRads } else for (c = 0; c < d; c += 1)1 !== s.h && (h = C <= t ? 1 : t < T ? 0 : (s.o.x.constructor === Array ? (s.__fnct || (s.__fnct = []), s.__fnct[c] ? m = s.__fnct[c] : (I = void 0 === s.o.x[c] ? s.o.x[0] : s.o.x[c], V = void 0 === s.o.y[c] ? s.o.y[0] : s.o.y[c], R = void 0 === s.i.x[c] ? s.i.x[0] : s.i.x[c], B = void 0 === s.i.y[c] ? s.i.y[0] : s.i.y[c], m = BezierFactory.getBezierEasing(I, V, R, B).get, s.__fnct[c] = m)) : s.__fnct ? m = s.__fnct : (I = s.o.x, V = s.o.y, R = s.i.x, B = s.i.y, m = BezierFactory.getBezierEasing(I, V, R, B).get, s.__fnct = m), m((t - T) / (C - T)))), y = a.s || s.e, L = 1 === s.h ? s.s[c] : s.s[c] + (y[c] - s.s[c]) * h, "multidimensional" === this.propType ? r[c] = L : r = L } return e.lastIndex = f, r } function N(t) { var e = t[0] * degToRads, r = t[1] * degToRads, i = t[2] * degToRads, s = Math.cos(e / 2), a = Math.cos(r / 2), n = Math.cos(i / 2), o = Math.sin(e / 2), h = Math.sin(r / 2), l = Math.sin(i / 2); return [o * h * n + s * a * l, o * a * n + s * h * l, s * h * n - o * a * l, s * a * n - o * h * l] } function c() { var t = this.comp.renderedFrame - this.offsetTime, e = this.keyframes[0].t - this.offsetTime, r = this.keyframes[this.keyframes.length - 1].t - this.offsetTime; if (!(t === this._caching.lastFrame || this._caching.lastFrame !== m && (this._caching.lastFrame >= r && r <= t || this._caching.lastFrame < e && t < e))) { this._caching.lastFrame >= t && (this._caching._lastKeyframeIndex = -1, this._caching.lastIndex = 0); var i = this.interpolateValue(t, this._caching); this.pv = i } return this._caching.lastFrame = t, this.pv } function d(t) { var e; if ("unidimensional" === this.propType) e = t * this.mult, 1e-5 < s(this.v - e) && (this.v = e, this._mdf = !0); else for (var r = 0, i = this.v.length; r < i;)e = t[r] * this.mult, 1e-5 < s(this.v[r] - e) && (this.v[r] = e, this._mdf = !0), r += 1 } function u() { if (this.elem.globalData.frameId !== this.frameId && this.effectsSequence.length) if (this.lock) this.setVValue(this.pv); else { this.lock = !0, this._mdf = this._isFirstFrame; var t, e = this.effectsSequence.length, r = this.kf ? this.pv : this.data.k; for (t = 0; t < e; t += 1)r = this.effectsSequence[t](r); this.setVValue(r), this._isFirstFrame = !1, this.lock = !1, this.frameId = this.elem.globalData.frameId } } function y(t) { this.effectsSequence.push(t), this.container.addDynamicProperty(this) } function n(t, e, r, i) { this.propType = "unidimensional", this.mult = r || 1, this.data = e, this.v = r ? e.k * r : e.k, this.pv = e.k, this._mdf = !1, this.elem = t, this.container = i, this.comp = t.comp, this.k = !1, this.kf = !1, this.vel = 0, this.effectsSequence = [], this._isFirstFrame = !0, this.getValue = u, this.setVValue = d, this.addEffect = y } function o(t, e, r, i) { this.propType = "multidimensional", this.mult = r || 1, this.data = e, this._mdf = !1, this.elem = t, this.container = i, this.comp = t.comp, this.k = !1, this.kf = !1, this.frameId = -1; var s, a = e.k.length; this.v = createTypedArray("float32", a), this.pv = createTypedArray("float32", a); createTypedArray("float32", a); for (this.vel = createTypedArray("float32", a), s = 0; s < a; s += 1)this.v[s] = e.k[s] * this.mult, this.pv[s] = e.k[s]; this._isFirstFrame = !0, this.effectsSequence = [], this.getValue = u, this.setVValue = d, this.addEffect = y } function h(t, e, r, i) { this.propType = "unidimensional", this.keyframes = e.k, this.offsetTime = t.data.st, this.frameId = -1, this._caching = { lastFrame: m, lastIndex: 0, value: 0, _lastKeyframeIndex: -1 }, this.k = !0, this.kf = !0, this.data = e, this.mult = r || 1, this.elem = t, this.container = i, this.comp = t.comp, this.v = m, this.pv = m, this._isFirstFrame = !0, this.getValue = u, this.setVValue = d, this.interpolateValue = f, this.effectsSequence = [c.bind(this)], this.addEffect = y } function l(t, e, r, i) { this.propType = "multidimensional"; var s, a, n, o, h, l = e.k.length; for (s = 0; s < l - 1; s += 1)e.k[s].to && e.k[s].s && e.k[s + 1] && e.k[s + 1].s && (a = e.k[s].s, n = e.k[s + 1].s, o = e.k[s].to, h = e.k[s].ti, (2 === a.length && (a[0] !== n[0] || a[1] !== n[1]) && bez.pointOnLine2D(a[0], a[1], n[0], n[1], a[0] + o[0], a[1] + o[1]) && bez.pointOnLine2D(a[0], a[1], n[0], n[1], n[0] + h[0], n[1] + h[1]) || 3 === a.length && (a[0] !== n[0] || a[1] !== n[1] || a[2] !== n[2]) && bez.pointOnLine3D(a[0], a[1], a[2], n[0], n[1], n[2], a[0] + o[0], a[1] + o[1], a[2] + o[2]) && bez.pointOnLine3D(a[0], a[1], a[2], n[0], n[1], n[2], n[0] + h[0], n[1] + h[1], n[2] + h[2])) && (e.k[s].to = null, e.k[s].ti = null), a[0] === n[0] && a[1] === n[1] && 0 === o[0] && 0 === o[1] && 0 === h[0] && 0 === h[1] && (2 === a.length || a[2] === n[2] && 0 === o[2] && 0 === h[2]) && (e.k[s].to = null, e.k[s].ti = null)); this.effectsSequence = [c.bind(this)], this.keyframes = e.k, this.offsetTime = t.data.st, this.k = !0, this.kf = !0, this._isFirstFrame = !0, this.mult = r || 1, this.elem = t, this.container = i, this.comp = t.comp, this.getValue = u, this.setVValue = d, this.interpolateValue = f, this.frameId = -1; var p = e.k[0].s.length; for (this.v = createTypedArray("float32", p), this.pv = createTypedArray("float32", p), s = 0; s < p; s += 1)this.v[s] = m, this.pv[s] = m; this._caching = { lastFrame: m, lastIndex: 0, value: createTypedArray("float32", p) }, this.addEffect = y } return { getProp: function (t, e, r, i, s) { var a; if (e.k.length) if ("number" == typeof e.k[0]) a = new o(t, e, i, s); else switch (r) { case 0: a = new h(t, e, i, s); break; case 1: a = new l(t, e, i, s) } else a = new n(t, e, i, s); return a.effectsSequence.length && s.addDynamicProperty(a), a } } }(), TransformPropertyFactory = function () { var n = [0, 0]; function i(t, e, r) { if (this.elem = t, this.frameId = -1, this.propType = "transform", this.data = e, this.v = new Matrix, this.pre = new Matrix, this.appliedTransformations = 0, this.initDynamicPropertyContainer(r || t), e.p && e.p.s ? (this.px = PropertyFactory.getProp(t, e.p.x, 0, 0, this), this.py = PropertyFactory.getProp(t, e.p.y, 0, 0, this), e.p.z && (this.pz = PropertyFactory.getProp(t, e.p.z, 0, 0, this))) : this.p = PropertyFactory.getProp(t, e.p || { k: [0, 0, 0] }, 1, 0, this), e.rx) { if (this.rx = PropertyFactory.getProp(t, e.rx, 0, degToRads, this), this.ry = PropertyFactory.getProp(t, e.ry, 0, degToRads, this), this.rz = PropertyFactory.getProp(t, e.rz, 0, degToRads, this), e.or.k[0].ti) { var i, s = e.or.k.length; for (i = 0; i < s; i += 1)e.or.k[i].to = e.or.k[i].ti = null } this.or = PropertyFactory.getProp(t, e.or, 1, degToRads, this), this.or.sh = !0 } else this.r = PropertyFactory.getProp(t, e.r || { k: 0 }, 0, degToRads, this); e.sk && (this.sk = PropertyFactory.getProp(t, e.sk, 0, degToRads, this), this.sa = PropertyFactory.getProp(t, e.sa, 0, degToRads, this)), this.a = PropertyFactory.getProp(t, e.a || { k: [0, 0, 0] }, 1, 0, this), this.s = PropertyFactory.getProp(t, e.s || { k: [100, 100, 100] }, 1, .01, this), e.o ? this.o = PropertyFactory.getProp(t, e.o, 0, .01, t) : this.o = { _mdf: !1, v: 1 }, this._isDirty = !0, this.dynamicProperties.length || this.getValue(!0) } return i.prototype = { applyToMatrix: function (t) { var e = this._mdf; this.iterateDynamicProperties(), this._mdf = this._mdf || e, this.a && t.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]), this.s && t.scale(this.s.v[0], this.s.v[1], this.s.v[2]), this.sk && t.skewFromAxis(-this.sk.v, this.sa.v), this.r ? t.rotate(-this.r.v) : t.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]), this.data.p.s ? this.data.p.z ? t.translate(this.px.v, this.py.v, -this.pz.v) : t.translate(this.px.v, this.py.v, 0) : t.translate(this.p.v[0], this.p.v[1], -this.p.v[2]) }, getValue: function (t) { if (this.elem.globalData.frameId !== this.frameId) { if (this._isDirty && (this.precalculateMatrix(), this._isDirty = !1), this.iterateDynamicProperties(), this._mdf || t) { if (this.v.cloneFromProps(this.pre.props), this.appliedTransformations < 1 && this.v.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]), this.appliedTransformations < 2 && this.v.scale(this.s.v[0], this.s.v[1], this.s.v[2]), this.sk && this.appliedTransformations < 3 && this.v.skewFromAxis(-this.sk.v, this.sa.v), this.r && this.appliedTransformations < 4 ? this.v.rotate(-this.r.v) : !this.r && this.appliedTransformations < 4 && this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]), this.autoOriented) { var e, r, i = this.elem.globalData.frameRate; if (this.p && this.p.keyframes && this.p.getValueAtTime) r = this.p._caching.lastFrame + this.p.offsetTime <= this.p.keyframes[0].t ? (e = this.p.getValueAtTime((this.p.keyframes[0].t + .01) / i, 0), this.p.getValueAtTime(this.p.keyframes[0].t / i, 0)) : this.p._caching.lastFrame + this.p.offsetTime >= this.p.keyframes[this.p.keyframes.length - 1].t ? (e = this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length - 1].t / i, 0), this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t - .05) / i, 0)) : (e = this.p.pv, this.p.getValueAtTime((this.p._caching.lastFrame + this.p.offsetTime - .01) / i, this.p.offsetTime)); else if (this.px && this.px.keyframes && this.py.keyframes && this.px.getValueAtTime && this.py.getValueAtTime) { e = [], r = []; var s = this.px, a = this.py; s._caching.lastFrame + s.offsetTime <= s.keyframes[0].t ? (e[0] = s.getValueAtTime((s.keyframes[0].t + .01) / i, 0), e[1] = a.getValueAtTime((a.keyframes[0].t + .01) / i, 0), r[0] = s.getValueAtTime(s.keyframes[0].t / i, 0), r[1] = a.getValueAtTime(a.keyframes[0].t / i, 0)) : s._caching.lastFrame + s.offsetTime >= s.keyframes[s.keyframes.length - 1].t ? (e[0] = s.getValueAtTime(s.keyframes[s.keyframes.length - 1].t / i, 0), e[1] = a.getValueAtTime(a.keyframes[a.keyframes.length - 1].t / i, 0), r[0] = s.getValueAtTime((s.keyframes[s.keyframes.length - 1].t - .01) / i, 0), r[1] = a.getValueAtTime((a.keyframes[a.keyframes.length - 1].t - .01) / i, 0)) : (e = [s.pv, a.pv], r[0] = s.getValueAtTime((s._caching.lastFrame + s.offsetTime - .01) / i, s.offsetTime), r[1] = a.getValueAtTime((a._caching.lastFrame + a.offsetTime - .01) / i, a.offsetTime)) } else e = r = n; this.v.rotate(-Math.atan2(e[1] - r[1], e[0] - r[0])) } this.data.p && this.data.p.s ? this.data.p.z ? this.v.translate(this.px.v, this.py.v, -this.pz.v) : this.v.translate(this.px.v, this.py.v, 0) : this.v.translate(this.p.v[0], this.p.v[1], -this.p.v[2]) } this.frameId = this.elem.globalData.frameId } }, precalculateMatrix: function () { if (!this.a.k && (this.pre.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]), this.appliedTransformations = 1, !this.s.effectsSequence.length)) { if (this.pre.scale(this.s.v[0], this.s.v[1], this.s.v[2]), this.appliedTransformations = 2, this.sk) { if (this.sk.effectsSequence.length || this.sa.effectsSequence.length) return; this.pre.skewFromAxis(-this.sk.v, this.sa.v), this.appliedTransformations = 3 } if (this.r) { if (this.r.effectsSequence.length) return; this.pre.rotate(-this.r.v), this.appliedTransformations = 4 } else this.rz.effectsSequence.length || this.ry.effectsSequence.length || this.rx.effectsSequence.length || this.or.effectsSequence.length || (this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]), this.appliedTransformations = 4) } }, autoOrient: function () { } }, extendPrototype([DynamicPropertyContainer], i), i.prototype.addDynamicProperty = function (t) { this._addDynamicProperty(t), this.elem.addDynamicProperty(t), this._isDirty = !0 }, i.prototype._addDynamicProperty = DynamicPropertyContainer.prototype.addDynamicProperty, { getTransformProperty: function (t, e, r) { return new i(t, e, r) } } }(); function ShapePath() { this.c = !1, this._length = 0, this._maxLength = 8, this.v = createSizedArray(this._maxLength), this.o = createSizedArray(this._maxLength), this.i = createSizedArray(this._maxLength) } ShapePath.prototype.setPathData = function (t, e) { this.c = t, this.setLength(e); for (var r = 0; r < e;)this.v[r] = point_pool.newElement(), this.o[r] = point_pool.newElement(), this.i[r] = point_pool.newElement(), r += 1 }, ShapePath.prototype.setLength = function (t) { for (; this._maxLength < t;)this.doubleArrayLength(); this._length = t }, ShapePath.prototype.doubleArrayLength = function () { this.v = this.v.concat(createSizedArray(this._maxLength)), this.i = this.i.concat(createSizedArray(this._maxLength)), this.o = this.o.concat(createSizedArray(this._maxLength)), this._maxLength *= 2 }, ShapePath.prototype.setXYAt = function (t, e, r, i, s) { var a; switch (this._length = Math.max(this._length, i + 1), this._length >= this._maxLength && this.doubleArrayLength(), r) { case "v": a = this.v; break; case "i": a = this.i; break; case "o": a = this.o }(!a[i] || a[i] && !s) && (a[i] = point_pool.newElement()), a[i][0] = t, a[i][1] = e }, ShapePath.prototype.setTripleAt = function (t, e, r, i, s, a, n, o) { this.setXYAt(t, e, "v", n, o), this.setXYAt(r, i, "o", n, o), this.setXYAt(s, a, "i", n, o) }, ShapePath.prototype.reverse = function () { var t = new ShapePath; t.setPathData(this.c, this._length); var e = this.v, r = this.o, i = this.i, s = 0; this.c && (t.setTripleAt(e[0][0], e[0][1], i[0][0], i[0][1], r[0][0], r[0][1], 0, !1), s = 1); var a, n = this._length - 1, o = this._length; for (a = s; a < o; a += 1)t.setTripleAt(e[n][0], e[n][1], i[n][0], i[n][1], r[n][0], r[n][1], a, !1), n -= 1; return t }; var ShapePropertyFactory = function () { var s = -999999; function t(t, e, r) { var i, s, a, n, o, h, l, p, m, f = r.lastIndex, c = this.keyframes; if (t < c[0].t - this.offsetTime) i = c[0].s[0], a = !0, f = 0; else if (t >= c[c.length - 1].t - this.offsetTime) i = c[c.length - 1].s ? c[c.length - 1].s[0] : c[c.length - 2].e[0], a = !0; else { for (var d, u, y = f, g = c.length - 1, v = !0; v && (d = c[y], !((u = c[y + 1]).t - this.offsetTime > t));)y < g - 1 ? y += 1 : v = !1; if (f = y, !(a = 1 === d.h)) { if (t >= u.t - this.offsetTime) p = 1; else if (t < d.t - this.offsetTime) p = 0; else { var b; d.__fnct ? b = d.__fnct : (b = BezierFactory.getBezierEasing(d.o.x, d.o.y, d.i.x, d.i.y).get, d.__fnct = b), p = b((t - (d.t - this.offsetTime)) / (u.t - this.offsetTime - (d.t - this.offsetTime))) } s = u.s ? u.s[0] : d.e[0] } i = d.s[0] } for (h = e._length, l = i.i[0].length, r.lastIndex = f, n = 0; n < h; n += 1)for (o = 0; o < l; o += 1)m = a ? i.i[n][o] : i.i[n][o] + (s.i[n][o] - i.i[n][o]) * p, e.i[n][o] = m, m = a ? i.o[n][o] : i.o[n][o] + (s.o[n][o] - i.o[n][o]) * p, e.o[n][o] = m, m = a ? i.v[n][o] : i.v[n][o] + (s.v[n][o] - i.v[n][o]) * p, e.v[n][o] = m } function a() { this.paths = this.localShapeCollection } function e(t) { (function (t, e) { if (t._length !== e._length || t.c !== e.c) return !1; var r, i = t._length; for (r = 0; r < i; r += 1)if (t.v[r][0] !== e.v[r][0] || t.v[r][1] !== e.v[r][1] || t.o[r][0] !== e.o[r][0] || t.o[r][1] !== e.o[r][1] || t.i[r][0] !== e.i[r][0] || t.i[r][1] !== e.i[r][1]) return !1; return !0 })(this.v, t) || (this.v = shape_pool.clone(t), this.localShapeCollection.releaseShapes(), this.localShapeCollection.addShape(this.v), this._mdf = !0, this.paths = this.localShapeCollection) } function r() { if (this.elem.globalData.frameId !== this.frameId) if (this.effectsSequence.length) if (this.lock) this.setVValue(this.pv); else { this.lock = !0, this._mdf = !1; var t, e = this.kf ? this.pv : this.data.ks ? this.data.ks.k : this.data.pt.k, r = this.effectsSequence.length; for (t = 0; t < r; t += 1)e = this.effectsSequence[t](e); this.setVValue(e), this.lock = !1, this.frameId = this.elem.globalData.frameId } else this._mdf = !1 } function n(t, e, r) { this.propType = "shape", this.comp = t.comp, this.container = t, this.elem = t, this.data = e, this.k = !1, this.kf = !1, this._mdf = !1; var i = 3 === r ? e.pt.k : e.ks.k; this.v = shape_pool.clone(i), this.pv = shape_pool.clone(this.v), this.localShapeCollection = shapeCollection_pool.newShapeCollection(), this.paths = this.localShapeCollection, this.paths.addShape(this.v), this.reset = a, this.effectsSequence = [] } function i(t) { this.effectsSequence.push(t), this.container.addDynamicProperty(this) } function o(t, e, r) { this.propType = "shape", this.comp = t.comp, this.elem = t, this.container = t, this.offsetTime = t.data.st, this.keyframes = 3 === r ? e.pt.k : e.ks.k, this.k = !0, this.kf = !0; var i = this.keyframes[0].s[0].i.length; this.keyframes[0].s[0].i[0].length; this.v = shape_pool.newElement(), this.v.setPathData(this.keyframes[0].s[0].c, i), this.pv = shape_pool.clone(this.v), this.localShapeCollection = shapeCollection_pool.newShapeCollection(), this.paths = this.localShapeCollection, this.paths.addShape(this.v), this.lastFrame = s, this.reset = a, this._caching = { lastFrame: s, lastIndex: 0 }, this.effectsSequence = [function () { var t = this.comp.renderedFrame - this.offsetTime, e = this.keyframes[0].t - this.offsetTime, r = this.keyframes[this.keyframes.length - 1].t - this.offsetTime, i = this._caching.lastFrame; return i !== s && (i < e && t < e || r < i && r < t) || (this._caching.lastIndex = i < t ? this._caching.lastIndex : 0, this.interpolateShape(t, this.pv, this._caching)), this._caching.lastFrame = t, this.pv }.bind(this)] } n.prototype.interpolateShape = t, n.prototype.getValue = r, n.prototype.setVValue = e, n.prototype.addEffect = i, o.prototype.getValue = r, o.prototype.interpolateShape = t, o.prototype.setVValue = e, o.prototype.addEffect = i; var h = function () { var n = roundCorner; function t(t, e) { this.v = shape_pool.newElement(), this.v.setPathData(!0, 4), this.localShapeCollection = shapeCollection_pool.newShapeCollection(), this.paths = this.localShapeCollection, this.localShapeCollection.addShape(this.v), this.d = e.d, this.elem = t, this.comp = t.comp, this.frameId = -1, this.initDynamicPropertyContainer(t), this.p = PropertyFactory.getProp(t, e.p, 1, 0, this), this.s = PropertyFactory.getProp(t, e.s, 1, 0, this), this.dynamicProperties.length ? this.k = !0 : (this.k = !1, this.convertEllToPath()) } return t.prototype = { reset: a, getValue: function () { this.elem.globalData.frameId !== this.frameId && (this.frameId = this.elem.globalData.frameId, this.iterateDynamicProperties(), this._mdf && this.convertEllToPath()) }, convertEllToPath: function () { var t = this.p.v[0], e = this.p.v[1], r = this.s.v[0] / 2, i = this.s.v[1] / 2, s = 3 !== this.d, a = this.v; a.v[0][0] = t, a.v[0][1] = e - i, a.v[1][0] = s ? t + r : t - r, a.v[1][1] = e, a.v[2][0] = t, a.v[2][1] = e + i, a.v[3][0] = s ? t - r : t + r, a.v[3][1] = e, a.i[0][0] = s ? t - r * n : t + r * n, a.i[0][1] = e - i, a.i[1][0] = s ? t + r : t - r, a.i[1][1] = e - i * n, a.i[2][0] = s ? t + r * n : t - r * n, a.i[2][1] = e + i, a.i[3][0] = s ? t - r : t + r, a.i[3][1] = e + i * n, a.o[0][0] = s ? t + r * n : t - r * n, a.o[0][1] = e - i, a.o[1][0] = s ? t + r : t - r, a.o[1][1] = e + i * n, a.o[2][0] = s ? t - r * n : t + r * n, a.o[2][1] = e + i, a.o[3][0] = s ? t - r : t + r, a.o[3][1] = e - i * n } }, extendPrototype([DynamicPropertyContainer], t), t }(), l = function () { function t(t, e) { this.v = shape_pool.newElement(), this.v.setPathData(!0, 0), this.elem = t, this.comp = t.comp, this.data = e, this.frameId = -1, this.d = e.d, this.initDynamicPropertyContainer(t), 1 === e.sy ? (this.ir = PropertyFactory.getProp(t, e.ir, 0, 0, this), this.is = PropertyFactory.getProp(t, e.is, 0, .01, this), this.convertToPath = this.convertStarToPath) : this.convertToPath = this.convertPolygonToPath, this.pt = PropertyFactory.getProp(t, e.pt, 0, 0, this), this.p = PropertyFactory.getProp(t, e.p, 1, 0, this), this.r = PropertyFactory.getProp(t, e.r, 0, degToRads, this), this.or = PropertyFactory.getProp(t, e.or, 0, 0, this), this.os = PropertyFactory.getProp(t, e.os, 0, .01, this), this.localShapeCollection = shapeCollection_pool.newShapeCollection(), this.localShapeCollection.addShape(this.v), this.paths = this.localShapeCollection, this.dynamicProperties.length ? this.k = !0 : (this.k = !1, this.convertToPath()) } return t.prototype = { reset: a, getValue: function () { this.elem.globalData.frameId !== this.frameId && (this.frameId = this.elem.globalData.frameId, this.iterateDynamicProperties(), this._mdf && this.convertToPath()) }, convertStarToPath: function () { var t, e, r, i, s = 2 * Math.floor(this.pt.v), a = 2 * Math.PI / s, n = !0, o = this.or.v, h = this.ir.v, l = this.os.v, p = this.is.v, m = 2 * Math.PI * o / (2 * s), f = 2 * Math.PI * h / (2 * s), c = -Math.PI / 2; c += this.r.v; var d = 3 === this.data.d ? -1 : 1; for (t = this.v._length = 0; t < s; t += 1) { r = n ? l : p, i = n ? m : f; var u = (e = n ? o : h) * Math.cos(c), y = e * Math.sin(c), g = 0 === u && 0 === y ? 0 : y / Math.sqrt(u * u + y * y), v = 0 === u && 0 === y ? 0 : -u / Math.sqrt(u * u + y * y); u += +this.p.v[0], y += +this.p.v[1], this.v.setTripleAt(u, y, u - g * i * r * d, y - v * i * r * d, u + g * i * r * d, y + v * i * r * d, t, !0), n = !n, c += a * d } }, convertPolygonToPath: function () { var t, e = Math.floor(this.pt.v), r = 2 * Math.PI / e, i = this.or.v, s = this.os.v, a = 2 * Math.PI * i / (4 * e), n = -Math.PI / 2, o = 3 === this.data.d ? -1 : 1; for (n += this.r.v, t = this.v._length = 0; t < e; t += 1) { var h = i * Math.cos(n), l = i * Math.sin(n), p = 0 === h && 0 === l ? 0 : l / Math.sqrt(h * h + l * l), m = 0 === h && 0 === l ? 0 : -h / Math.sqrt(h * h + l * l); h += +this.p.v[0], l += +this.p.v[1], this.v.setTripleAt(h, l, h - p * a * s * o, l - m * a * s * o, h + p * a * s * o, l + m * a * s * o, t, !0), n += r * o } this.paths.length = 0, this.paths[0] = this.v } }, extendPrototype([DynamicPropertyContainer], t), t }(), p = function () { function t(t, e) { this.v = shape_pool.newElement(), this.v.c = !0, this.localShapeCollection = shapeCollection_pool.newShapeCollection(), this.localShapeCollection.addShape(this.v), this.paths = this.localShapeCollection, this.elem = t, this.comp = t.comp, this.frameId = -1, this.d = e.d, this.initDynamicPropertyContainer(t), this.p = PropertyFactory.getProp(t, e.p, 1, 0, this), this.s = PropertyFactory.getProp(t, e.s, 1, 0, this), this.r = PropertyFactory.getProp(t, e.r, 0, 0, this), this.dynamicProperties.length ? this.k = !0 : (this.k = !1, this.convertRectToPath()) } return t.prototype = { convertRectToPath: function () { var t = this.p.v[0], e = this.p.v[1], r = this.s.v[0] / 2, i = this.s.v[1] / 2, s = bm_min(r, i, this.r.v), a = s * (1 - roundCorner); this.v._length = 0, 2 === this.d || 1 === this.d ? (this.v.setTripleAt(t + r, e - i + s, t + r, e - i + s, t + r, e - i + a, 0, !0), this.v.setTripleAt(t + r, e + i - s, t + r, e + i - a, t + r, e + i - s, 1, !0), 0 !== s ? (this.v.setTripleAt(t + r - s, e + i, t + r - s, e + i, t + r - a, e + i, 2, !0), this.v.setTripleAt(t - r + s, e + i, t - r + a, e + i, t - r + s, e + i, 3, !0), this.v.setTripleAt(t - r, e + i - s, t - r, e + i - s, t - r, e + i - a, 4, !0), this.v.setTripleAt(t - r, e - i + s, t - r, e - i + a, t - r, e - i + s, 5, !0), this.v.setTripleAt(t - r + s, e - i, t - r + s, e - i, t - r + a, e - i, 6, !0), this.v.setTripleAt(t + r - s, e - i, t + r - a, e - i, t + r - s, e - i, 7, !0)) : (this.v.setTripleAt(t - r, e + i, t - r + a, e + i, t - r, e + i, 2), this.v.setTripleAt(t - r, e - i, t - r, e - i + a, t - r, e - i, 3))) : (this.v.setTripleAt(t + r, e - i + s, t + r, e - i + a, t + r, e - i + s, 0, !0), 0 !== s ? (this.v.setTripleAt(t + r - s, e - i, t + r - s, e - i, t + r - a, e - i, 1, !0), this.v.setTripleAt(t - r + s, e - i, t - r + a, e - i, t - r + s, e - i, 2, !0), this.v.setTripleAt(t - r, e - i + s, t - r, e - i + s, t - r, e - i + a, 3, !0), this.v.setTripleAt(t - r, e + i - s, t - r, e + i - a, t - r, e + i - s, 4, !0), this.v.setTripleAt(t - r + s, e + i, t - r + s, e + i, t - r + a, e + i, 5, !0), this.v.setTripleAt(t + r - s, e + i, t + r - a, e + i, t + r - s, e + i, 6, !0), this.v.setTripleAt(t + r, e + i - s, t + r, e + i - s, t + r, e + i - a, 7, !0)) : (this.v.setTripleAt(t - r, e - i, t - r + a, e - i, t - r, e - i, 1, !0), this.v.setTripleAt(t - r, e + i, t - r, e + i - a, t - r, e + i, 2, !0), this.v.setTripleAt(t + r, e + i, t + r - a, e + i, t + r, e + i, 3, !0))) }, getValue: function (t) { this.elem.globalData.frameId !== this.frameId && (this.frameId = this.elem.globalData.frameId, this.iterateDynamicProperties(), this._mdf && this.convertRectToPath()) }, reset: a }, extendPrototype([DynamicPropertyContainer], t), t }(); var m = { getShapeProp: function (t, e, r) { var i; return 3 === r || 4 === r ? i = (3 === r ? e.pt : e.ks).k.length ? new o(t, e, r) : new n(t, e, r) : 5 === r ? i = new p(t, e) : 6 === r ? i = new h(t, e) : 7 === r && (i = new l(t, e)), i.k && t.addDynamicProperty(i), i }, getConstructorFunction: function () { return n }, getKeyframedConstructorFunction: function () { return o } }; return m }(), ShapeModifiers = ($r = {}, _r = {}, $r.registerModifier = function (t, e) { _r[t] || (_r[t] = e) }, $r.getModifier = function (t, e, r) { return new _r[t](e, r) }, $r), $r, _r; function ShapeModifier() { } function TrimModifier() { } function RoundCornersModifier() { } function RepeaterModifier() { } function ShapeCollection() { this._length = 0, this._maxLength = 4, this.shapes = createSizedArray(this._maxLength) } function DashProperty(t, e, r, i) { this.elem = t, this.frameId = -1, this.dataProps = createSizedArray(e.length), this.renderer = r, this.k = !1, this.dashStr = "", this.dashArray = createTypedArray("float32", e.length ? e.length - 1 : 0), this.dashoffset = createTypedArray("float32", 1), this.initDynamicPropertyContainer(i); var s, a, n = e.length || 0; for (s = 0; s < n; s += 1)a = PropertyFactory.getProp(t, e[s].v, 0, 0, this), this.k = a.k || this.k, this.dataProps[s] = { n: e[s].n, p: a }; this.k || this.getValue(!0), this._isAnimated = this.k } function GradientProperty(t, e, r) { this.data = e, this.c = createTypedArray("uint8c", 4 * e.p); var i = e.k.k[0].s ? e.k.k[0].s.length - 4 * e.p : e.k.k.length - 4 * e.p; this.o = createTypedArray("float32", i), this._cmdf = !1, this._omdf = !1, this._collapsable = this.checkCollapsable(), this._hasOpacity = i, this.initDynamicPropertyContainer(r), this.prop = PropertyFactory.getProp(t, e.k, 1, null, this), this.k = this.prop.k, this.getValue(!0) } ShapeModifier.prototype.initModifierProperties = function () { }, ShapeModifier.prototype.addShapeToModifier = function () { }, ShapeModifier.prototype.addShape = function (t) { if (!this.closed) { t.sh.container.addDynamicProperty(t.sh); var e = { shape: t.sh, data: t, localShapeCollection: shapeCollection_pool.newShapeCollection() }; this.shapes.push(e), this.addShapeToModifier(e), this._isAnimated && t.setAsAnimated() } }, ShapeModifier.prototype.init = function (t, e) { this.shapes = [], this.elem = t, this.initDynamicPropertyContainer(t), this.initModifierProperties(t, e), this.frameId = initialDefaultFrame, this.closed = !1, this.k = !1, this.dynamicProperties.length ? this.k = !0 : this.getValue(!0) }, ShapeModifier.prototype.processKeys = function () { this.elem.globalData.frameId !== this.frameId && (this.frameId = this.elem.globalData.frameId, this.iterateDynamicProperties()) }, extendPrototype([DynamicPropertyContainer], ShapeModifier), extendPrototype([ShapeModifier], TrimModifier), TrimModifier.prototype.initModifierProperties = function (t, e) { this.s = PropertyFactory.getProp(t, e.s, 0, .01, this), this.e = PropertyFactory.getProp(t, e.e, 0, .01, this), this.o = PropertyFactory.getProp(t, e.o, 0, 0, this), this.sValue = 0, this.eValue = 0, this.getValue = this.processKeys, this.m = e.m, this._isAnimated = !!this.s.effectsSequence.length || !!this.e.effectsSequence.length || !!this.o.effectsSequence.length }, TrimModifier.prototype.addShapeToModifier = function (t) { t.pathsData = [] }, TrimModifier.prototype.calculateShapeEdges = function (t, e, r, i, s) { var a = []; e <= 1 ? a.push({ s: t, e: e }) : 1 <= t ? a.push({ s: t - 1, e: e - 1 }) : (a.push({ s: t, e: 1 }), a.push({ s: 0, e: e - 1 })); var n, o, h = [], l = a.length; for (n = 0; n < l; n += 1) { var p, m; if ((o = a[n]).e * s < i || o.s * s > i + r); else p = o.s * s <= i ? 0 : (o.s * s - i) / r, m = o.e * s >= i + r ? 1 : (o.e * s - i) / r, h.push([p, m]) } return h.length || h.push([0, 0]), h }, TrimModifier.prototype.releasePathsData = function (t) { var e, r = t.length; for (e = 0; e < r; e += 1)segments_length_pool.release(t[e]); return t.length = 0, t }, TrimModifier.prototype.processShapes = function (t) { var e, r, i; if (this._mdf || t) { var s = this.o.v % 360 / 360; if (s < 0 && (s += 1), e = (1 < this.s.v ? 1 : this.s.v < 0 ? 0 : this.s.v) + s, (r = (1 < this.e.v ? 1 : this.e.v < 0 ? 0 : this.e.v) + s) < e) { var a = e; e = r, r = a } e = 1e-4 * Math.round(1e4 * e), r = 1e-4 * Math.round(1e4 * r), this.sValue = e, this.eValue = r } else e = this.sValue, r = this.eValue; var n, o, h, l, p, m, f = this.shapes.length, c = 0; if (r === e) for (n = 0; n < f; n += 1)this.shapes[n].localShapeCollection.releaseShapes(), this.shapes[n].shape._mdf = !0, this.shapes[n].shape.paths = this.shapes[n].localShapeCollection; else if (1 === r && 0 === e || 0 === r && 1 === e) { if (this._mdf) for (n = 0; n < f; n += 1)this.shapes[n].pathsData.length = 0, this.shapes[n].shape._mdf = !0 } else { var d, u, y = []; for (n = 0; n < f; n += 1)if ((d = this.shapes[n]).shape._mdf || this._mdf || t || 2 === this.m) { if (h = (i = d.shape.paths)._length, m = 0, !d.shape._mdf && d.pathsData.length) m = d.totalShapeLength; else { for (l = this.releasePathsData(d.pathsData), o = 0; o < h; o += 1)p = bez.getSegmentsLength(i.shapes[o]), l.push(p), m += p.totalLength; d.totalShapeLength = m, d.pathsData = l } c += m, d.shape._mdf = !0 } else d.shape.paths = d.localShapeCollection; var g, v = e, b = r, E = 0; for (n = f - 1; 0 <= n; n -= 1)if ((d = this.shapes[n]).shape._mdf) { for ((u = d.localShapeCollection).releaseShapes(), 2 === this.m && 1 < f ? (g = this.calculateShapeEdges(e, r, d.totalShapeLength, E, c), E += d.totalShapeLength) : g = [[v, b]], h = g.length, o = 0; o < h; o += 1) { v = g[o][0], b = g[o][1], y.length = 0, b <= 1 ? y.push({ s: d.totalShapeLength * v, e: d.totalShapeLength * b }) : 1 <= v ? y.push({ s: d.totalShapeLength * (v - 1), e: d.totalShapeLength * (b - 1) }) : (y.push({ s: d.totalShapeLength * v, e: d.totalShapeLength }), y.push({ s: 0, e: d.totalShapeLength * (b - 1) })); var x = this.addShapes(d, y[0]); if (y[0].s !== y[0].e) { if (1 < y.length) if (d.shape.paths.shapes[d.shape.paths._length - 1].c) { var P = x.pop(); this.addPaths(x, u), x = this.addShapes(d, y[1], P) } else this.addPaths(x, u), x = this.addShapes(d, y[1]); this.addPaths(x, u) } } d.shape.paths = u } } }, TrimModifier.prototype.addPaths = function (t, e) { var r, i = t.length; for (r = 0; r < i; r += 1)e.addShape(t[r]) }, TrimModifier.prototype.addSegment = function (t, e, r, i, s, a, n) { s.setXYAt(e[0], e[1], "o", a), s.setXYAt(r[0], r[1], "i", a + 1), n && s.setXYAt(t[0], t[1], "v", a), s.setXYAt(i[0], i[1], "v", a + 1) }, TrimModifier.prototype.addSegmentFromArray = function (t, e, r, i) { e.setXYAt(t[1], t[5], "o", r), e.setXYAt(t[2], t[6], "i", r + 1), i && e.setXYAt(t[0], t[4], "v", r), e.setXYAt(t[3], t[7], "v", r + 1) }, TrimModifier.prototype.addShapes = function (t, e, r) { var i, s, a, n, o, h, l, p, m = t.pathsData, f = t.shape.paths.shapes, c = t.shape.paths._length, d = 0, u = [], y = !0; for (p = r ? (o = r._length, r._length) : (r = shape_pool.newElement(), o = 0), u.push(r), i = 0; i < c; i += 1) { for (h = m[i].lengths, r.c = f[i].c, a = f[i].c ? h.length : h.length + 1, s = 1; s < a; s += 1)if (d + (n = h[s - 1]).addedLength < e.s) d += n.addedLength, r.c = !1; else { if (d > e.e) { r.c = !1; break } e.s <= d && e.e >= d + n.addedLength ? (this.addSegment(f[i].v[s - 1], f[i].o[s - 1], f[i].i[s], f[i].v[s], r, o, y), y = !1) : (l = bez.getNewSegment(f[i].v[s - 1], f[i].v[s], f[i].o[s - 1], f[i].i[s], (e.s - d) / n.addedLength, (e.e - d) / n.addedLength, h[s - 1]), this.addSegmentFromArray(l, r, o, y), y = !1, r.c = !1), d += n.addedLength, o += 1 } if (f[i].c && h.length) { if (n = h[s - 1], d <= e.e) { var g = h[s - 1].addedLength; e.s <= d && e.e >= d + g ? (this.addSegment(f[i].v[s - 1], f[i].o[s - 1], f[i].i[0], f[i].v[0], r, o, y), y = !1) : (l = bez.getNewSegment(f[i].v[s - 1], f[i].v[0], f[i].o[s - 1], f[i].i[0], (e.s - d) / g, (e.e - d) / g, h[s - 1]), this.addSegmentFromArray(l, r, o, y), y = !1, r.c = !1) } else r.c = !1; d += n.addedLength, o += 1 } if (r._length && (r.setXYAt(r.v[p][0], r.v[p][1], "i", p), r.setXYAt(r.v[r._length - 1][0], r.v[r._length - 1][1], "o", r._length - 1)), d > e.e) break; i < c - 1 && (r = shape_pool.newElement(), y = !0, u.push(r), o = 0) } return u }, ShapeModifiers.registerModifier("tm", TrimModifier), extendPrototype([ShapeModifier], RoundCornersModifier), RoundCornersModifier.prototype.initModifierProperties = function (t, e) { this.getValue = this.processKeys, this.rd = PropertyFactory.getProp(t, e.r, 0, null, this), this._isAnimated = !!this.rd.effectsSequence.length }, RoundCornersModifier.prototype.processPath = function (t, e) { var r = shape_pool.newElement(); r.c = t.c; var i, s, a, n, o, h, l, p, m, f, c, d, u, y = t._length, g = 0; for (i = 0; i < y; i += 1)s = t.v[i], n = t.o[i], a = t.i[i], s[0] === n[0] && s[1] === n[1] && s[0] === a[0] && s[1] === a[1] ? 0 !== i && i !== y - 1 || t.c ? (o = 0 === i ? t.v[y - 1] : t.v[i - 1], l = (h = Math.sqrt(Math.pow(s[0] - o[0], 2) + Math.pow(s[1] - o[1], 2))) ? Math.min(h / 2, e) / h : 0, p = d = s[0] + (o[0] - s[0]) * l, m = u = s[1] - (s[1] - o[1]) * l, f = p - (p - s[0]) * roundCorner, c = m - (m - s[1]) * roundCorner, r.setTripleAt(p, m, f, c, d, u, g), g += 1, o = i === y - 1 ? t.v[0] : t.v[i + 1], l = (h = Math.sqrt(Math.pow(s[0] - o[0], 2) + Math.pow(s[1] - o[1], 2))) ? Math.min(h / 2, e) / h : 0, p = f = s[0] + (o[0] - s[0]) * l, m = c = s[1] + (o[1] - s[1]) * l, d = p - (p - s[0]) * roundCorner, u = m - (m - s[1]) * roundCorner, r.setTripleAt(p, m, f, c, d, u, g)) : r.setTripleAt(s[0], s[1], n[0], n[1], a[0], a[1], g) : r.setTripleAt(t.v[i][0], t.v[i][1], t.o[i][0], t.o[i][1], t.i[i][0], t.i[i][1], g), g += 1; return r }, RoundCornersModifier.prototype.processShapes = function (t) { var e, r, i, s, a, n, o = this.shapes.length, h = this.rd.v; if (0 !== h) for (r = 0; r < o; r += 1) { if ((a = this.shapes[r]).shape.paths, n = a.localShapeCollection, a.shape._mdf || this._mdf || t) for (n.releaseShapes(), a.shape._mdf = !0, e = a.shape.paths.shapes, s = a.shape.paths._length, i = 0; i < s; i += 1)n.addShape(this.processPath(e[i], h)); a.shape.paths = a.localShapeCollection } this.dynamicProperties.length || (this._mdf = !1) }, ShapeModifiers.registerModifier("rd", RoundCornersModifier), extendPrototype([ShapeModifier], RepeaterModifier), RepeaterModifier.prototype.initModifierProperties = function (t, e) { this.getValue = this.processKeys, this.c = PropertyFactory.getProp(t, e.c, 0, null, this), this.o = PropertyFactory.getProp(t, e.o, 0, null, this), this.tr = TransformPropertyFactory.getTransformProperty(t, e.tr, this), this.so = PropertyFactory.getProp(t, e.tr.so, 0, .01, this), this.eo = PropertyFactory.getProp(t, e.tr.eo, 0, .01, this), this.data = e, this.dynamicProperties.length || this.getValue(!0), this._isAnimated = !!this.dynamicProperties.length, this.pMatrix = new Matrix, this.rMatrix = new Matrix, this.sMatrix = new Matrix, this.tMatrix = new Matrix, this.matrix = new Matrix }, RepeaterModifier.prototype.applyTransforms = function (t, e, r, i, s, a) { var n = a ? -1 : 1, o = i.s.v[0] + (1 - i.s.v[0]) * (1 - s), h = i.s.v[1] + (1 - i.s.v[1]) * (1 - s); t.translate(i.p.v[0] * n * s, i.p.v[1] * n * s, i.p.v[2]), e.translate(-i.a.v[0], -i.a.v[1], i.a.v[2]), e.rotate(-i.r.v * n * s), e.translate(i.a.v[0], i.a.v[1], i.a.v[2]), r.translate(-i.a.v[0], -i.a.v[1], i.a.v[2]), r.scale(a ? 1 / o : o, a ? 1 / h : h), r.translate(i.a.v[0], i.a.v[1], i.a.v[2]) }, RepeaterModifier.prototype.init = function (t, e, r, i) { this.elem = t, this.arr = e, this.pos = r, this.elemsData = i, this._currentCopies = 0, this._elements = [], this._groups = [], this.frameId = -1, this.initDynamicPropertyContainer(t), this.initModifierProperties(t, e[r]); for (; 0 < r;)r -= 1, this._elements.unshift(e[r]), 1; this.dynamicProperties.length ? this.k = !0 : this.getValue(!0) }, RepeaterModifier.prototype.resetElements = function (t) { var e, r = t.length; for (e = 0; e < r; e += 1)t[e]._processed = !1, "gr" === t[e].ty && this.resetElements(t[e].it) }, RepeaterModifier.prototype.cloneElements = function (t) { t.length; var e = JSON.parse(JSON.stringify(t)); return this.resetElements(e), e }, RepeaterModifier.prototype.changeGroupRender = function (t, e) { var r, i = t.length; for (r = 0; r < i; r += 1)t[r]._render = e, "gr" === t[r].ty && this.changeGroupRender(t[r].it, e) }, RepeaterModifier.prototype.processShapes = function (t) { var e, r, i, s, a; if (this._mdf || t) { var n, o = Math.ceil(this.c.v); if (this._groups.length < o) { for (; this._groups.length < o;) { var h = { it: this.cloneElements(this._elements), ty: "gr" }; h.it.push({ a: { a: 0, ix: 1, k: [0, 0] }, nm: "Transform", o: { a: 0, ix: 7, k: 100 }, p: { a: 0, ix: 2, k: [0, 0] }, r: { a: 1, ix: 6, k: [{ s: 0, e: 0, t: 0 }, { s: 0, e: 0, t: 1 }] }, s: { a: 0, ix: 3, k: [100, 100] }, sa: { a: 0, ix: 5, k: 0 }, sk: { a: 0, ix: 4, k: 0 }, ty: "tr" }), this.arr.splice(0, 0, h), this._groups.splice(0, 0, h), this._currentCopies += 1 } this.elem.reloadShapes() } for (i = a = 0; i <= this._groups.length - 1; i += 1)n = a < o, this._groups[i]._render = n, this.changeGroupRender(this._groups[i].it, n), a += 1; this._currentCopies = o; var l = this.o.v, p = l % 1, m = 0 < l ? Math.floor(l) : Math.ceil(l), f = (this.tr.v.props, this.pMatrix.props), c = this.rMatrix.props, d = this.sMatrix.props; this.pMatrix.reset(), this.rMatrix.reset(), this.sMatrix.reset(), this.tMatrix.reset(), this.matrix.reset(); var u, y, g = 0; if (0 < l) { for (; g < m;)this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, !1), g += 1; p && (this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, p, !1), g += p) } else if (l < 0) { for (; m < g;)this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, !0), g -= 1; p && (this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, -p, !0), g -= p) } for (i = 1 === this.data.m ? 0 : this._currentCopies - 1, s = 1 === this.data.m ? 1 : -1, a = this._currentCopies; a;) { if (y = (r = (e = this.elemsData[i].it)[e.length - 1].transform.mProps.v.props).length, e[e.length - 1].transform.mProps._mdf = !0, e[e.length - 1].transform.op._mdf = !0, e[e.length - 1].transform.op.v = this.so.v + (this.eo.v - this.so.v) * (i / (this._currentCopies - 1)), 0 !== g) { for ((0 !== i && 1 === s || i !== this._currentCopies - 1 && -1 === s) && this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, !1), this.matrix.transform(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15]), this.matrix.transform(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]), this.matrix.transform(f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7], f[8], f[9], f[10], f[11], f[12], f[13], f[14], f[15]), u = 0; u < y; u += 1)r[u] = this.matrix.props[u]; this.matrix.reset() } else for (this.matrix.reset(), u = 0; u < y; u += 1)r[u] = this.matrix.props[u]; g += 1, a -= 1, i += s } } else for (a = this._currentCopies, i = 0, s = 1; a;)r = (e = this.elemsData[i].it)[e.length - 1].transform.mProps.v.props, e[e.length - 1].transform.mProps._mdf = !1, e[e.length - 1].transform.op._mdf = !1, a -= 1, i += s }, RepeaterModifier.prototype.addShape = function () { }, ShapeModifiers.registerModifier("rp", RepeaterModifier), ShapeCollection.prototype.addShape = function (t) { this._length === this._maxLength && (this.shapes = this.shapes.concat(createSizedArray(this._maxLength)), this._maxLength *= 2), this.shapes[this._length] = t, this._length += 1 }, ShapeCollection.prototype.releaseShapes = function () { var t; for (t = 0; t < this._length; t += 1)shape_pool.release(this.shapes[t]); this._length = 0 }, DashProperty.prototype.getValue = function (t) { if ((this.elem.globalData.frameId !== this.frameId || t) && (this.frameId = this.elem.globalData.frameId, this.iterateDynamicProperties(), this._mdf = this._mdf || t, this._mdf)) { var e = 0, r = this.dataProps.length; for ("svg" === this.renderer && (this.dashStr = ""), e = 0; e < r; e += 1)"o" != this.dataProps[e].n ? "svg" === this.renderer ? this.dashStr += " " + this.dataProps[e].p.v : this.dashArray[e] = this.dataProps[e].p.v : this.dashoffset[0] = this.dataProps[e].p.v } }, extendPrototype([DynamicPropertyContainer], DashProperty), GradientProperty.prototype.comparePoints = function (t, e) { for (var r = 0, i = this.o.length / 2; r < i;) { if (.01 < Math.abs(t[4 * r] - t[4 * e + 2 * r])) return !1; r += 1 } return !0 }, GradientProperty.prototype.checkCollapsable = function () { if (this.o.length / 2 != this.c.length / 4) return !1; if (this.data.k.k[0].s) for (var t = 0, e = this.data.k.k.length; t < e;) { if (!this.comparePoints(this.data.k.k[t].s, this.data.p)) return !1; t += 1 } else if (!this.comparePoints(this.data.k.k, this.data.p)) return !1; return !0 }, GradientProperty.prototype.getValue = function (t) { if (this.prop.getValue(), this._mdf = !1, this._cmdf = !1, this._omdf = !1, this.prop._mdf || t) { var e, r, i, s = 4 * this.data.p; for (e = 0; e < s; e += 1)r = e % 4 == 0 ? 100 : 255, i = Math.round(this.prop.v[e] * r), this.c[e] !== i && (this.c[e] = i, this._cmdf = !t); if (this.o.length) for (s = this.prop.v.length, e = 4 * this.data.p; e < s; e += 1)r = e % 2 == 0 ? 100 : 1, i = e % 2 == 0 ? Math.round(100 * this.prop.v[e]) : this.prop.v[e], this.o[e - 4 * this.data.p] !== i && (this.o[e - 4 * this.data.p] = i, this._omdf = !t); this._mdf = !t } }, extendPrototype([DynamicPropertyContainer], GradientProperty); var buildShapeString = function (t, e, r, i) { if (0 === e) return ""; var s, a = t.o, n = t.i, o = t.v, h = " M" + i.applyToPointStringified(o[0][0], o[0][1]); for (s = 1; s < e; s += 1)h += " C" + i.applyToPointStringified(a[s - 1][0], a[s - 1][1]) + " " + i.applyToPointStringified(n[s][0], n[s][1]) + " " + i.applyToPointStringified(o[s][0], o[s][1]); return r && e && (h += " C" + i.applyToPointStringified(a[s - 1][0], a[s - 1][1]) + " " + i.applyToPointStringified(n[0][0], n[0][1]) + " " + i.applyToPointStringified(o[0][0], o[0][1]), h += "z"), h }, ImagePreloader = function () { var s = function () { var t = createTag("canvas"); t.width = 1, t.height = 1; var e = t.getContext("2d"); return e.fillStyle = "rgba(0,0,0,0)", e.fillRect(0, 0, 1, 1), t }(); function t() { this.loadedAssets += 1, this.loadedAssets === this.totalImages && this.imagesLoadedCb && this.imagesLoadedCb(null) } function e(t) { var e = function (t, e, r) { var i = ""; if (t.e) i = t.p; else if (e) { var s = t.p; -1 !== s.indexOf("images/") && (s = s.split("/")[1]), i = e + s } else i = r, i += t.u ? t.u : "", i += t.p; return i }(t, this.assetsPath, this.path), r = createTag("img"); r.crossOrigin = "anonymous", r.addEventListener("load", this._imageLoaded.bind(this), !1), r.addEventListener("error", function () { i.img = s, this._imageLoaded() }.bind(this), !1), r.src = e; var i = { img: r, assetData: t }; return i } function r(t, e) { this.imagesLoadedCb = e; var r, i = t.length; for (r = 0; r < i; r += 1)t[r].layers || (this.totalImages += 1, this.images.push(this._createImageData(t[r]))) } function i(t) { this.path = t || "" } function a(t) { this.assetsPath = t || "" } function n(t) { for (var e = 0, r = this.images.length; e < r;) { if (this.images[e].assetData === t) return this.images[e].img; e += 1 } } function o() { this.imagesLoadedCb = null, this.images.length = 0 } function h() { return this.totalImages === this.loadedAssets } return function () { this.loadAssets = r, this.setAssetsPath = a, this.setPath = i, this.loaded = h, this.destroy = o, this.getImage = n, this._createImageData = e, this._imageLoaded = t, this.assetsPath = "", this.path = "", this.totalImages = 0, this.loadedAssets = 0, this.imagesLoadedCb = null, this.images = [] } }(), featureSupport = (sw = { maskType: !0 }, (/MSIE 10/i.test(navigator.userAgent) || /MSIE 9/i.test(navigator.userAgent) || /rv:11.0/i.test(navigator.userAgent) || /Edge\/\d./i.test(navigator.userAgent)) && (sw.maskType = !1), sw), sw, filtersFactory = (tw = {}, tw.createFilter = function (t) { var e = createNS("filter"); return e.setAttribute("id", t), e.setAttribute("filterUnits", "objectBoundingBox"), e.setAttribute("x", "0%"), e.setAttribute("y", "0%"), e.setAttribute("width", "100%"), e.setAttribute("height", "100%"), e }, tw.createAlphaToLuminanceFilter = function () { var t = createNS("feColorMatrix"); return t.setAttribute("type", "matrix"), t.setAttribute("color-interpolation-filters", "sRGB"), t.setAttribute("values", "0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"), t }, tw), tw, assetLoader = function () { function a(t) { return t.response && "object" == typeof t.response ? t.response : t.response && "string" == typeof t.response ? JSON.parse(t.response) : t.responseText ? JSON.parse(t.responseText) : void 0 } return { load: function (t, e, r) { var i, s = new XMLHttpRequest; s.open("GET", t, !0); try { s.responseType = "json" } catch (t) { } s.send(), s.onreadystatechange = function () { if (4 == s.readyState) if (200 == s.status) i = a(s), e(i); else try { i = a(s), e(i) } catch (t) { r && r(t) } } } } }(); function TextAnimatorProperty(t, e, r) { this._isFirstFrame = !0, this._hasMaskedPath = !1, this._frameId = -1, this._textData = t, this._renderType = e, this._elem = r, this._animatorsData = createSizedArray(this._textData.a.length), this._pathData = {}, this._moreOptions = { alignment: {} }, this.renderedLetters = [], this.lettersChangedFlag = !1, this.initDynamicPropertyContainer(r) } function TextAnimatorDataProperty(t, e, r) { var i = { propType: !1 }, s = PropertyFactory.getProp, a = e.a; this.a = { r: a.r ? s(t, a.r, 0, degToRads, r) : i, rx: a.rx ? s(t, a.rx, 0, degToRads, r) : i, ry: a.ry ? s(t, a.ry, 0, degToRads, r) : i, sk: a.sk ? s(t, a.sk, 0, degToRads, r) : i, sa: a.sa ? s(t, a.sa, 0, degToRads, r) : i, s: a.s ? s(t, a.s, 1, .01, r) : i, a: a.a ? s(t, a.a, 1, 0, r) : i, o: a.o ? s(t, a.o, 0, .01, r) : i, p: a.p ? s(t, a.p, 1, 0, r) : i, sw: a.sw ? s(t, a.sw, 0, 0, r) : i, sc: a.sc ? s(t, a.sc, 1, 0, r) : i, fc: a.fc ? s(t, a.fc, 1, 0, r) : i, fh: a.fh ? s(t, a.fh, 0, 0, r) : i, fs: a.fs ? s(t, a.fs, 0, .01, r) : i, fb: a.fb ? s(t, a.fb, 0, .01, r) : i, t: a.t ? s(t, a.t, 0, 0, r) : i }, this.s = TextSelectorProp.getTextSelectorProp(t, e.s, r), this.s.t = e.s.t } function LetterProps(t, e, r, i, s, a) { this.o = t, this.sw = e, this.sc = r, this.fc = i, this.m = s, this.p = a, this._mdf = { o: !0, sw: !!e, sc: !!r, fc: !!i, m: !0, p: !0 } } function TextProperty(t, e) { this._frameId = initialDefaultFrame, this.pv = "", this.v = "", this.kf = !1, this._isFirstFrame = !0, this._mdf = !1, this.data = e, this.elem = t, this.comp = this.elem.comp, this.keysIndex = 0, this.canResize = !1, this.minimumFontSize = 1, this.effectsSequence = [], this.currentData = { ascent: 0, boxWidth: this.defaultBoxWidth, f: "", fStyle: "", fWeight: "", fc: "", j: "", justifyOffset: "", l: [], lh: 0, lineWidths: [], ls: "", of: "", s: "", sc: "", sw: 0, t: 0, tr: 0, sz: 0, ps: null, fillColorAnim: !1, strokeColorAnim: !1, strokeWidthAnim: !1, yOffset: 0, finalSize: 0, finalText: [], finalLineHeight: 0, __complete: !1 }, this.copyData(this.currentData, this.data.d.k[0].s), this.searchProperty() || this.completeTextData(this.currentData) } TextAnimatorProperty.prototype.searchProperties = function () { var t, e, r = this._textData.a.length, i = PropertyFactory.getProp; for (t = 0; t < r; t += 1)e = this._textData.a[t], this._animatorsData[t] = new TextAnimatorDataProperty(this._elem, e, this); this._textData.p && "m" in this._textData.p ? (this._pathData = { f: i(this._elem, this._textData.p.f, 0, 0, this), l: i(this._elem, this._textData.p.l, 0, 0, this), r: this._textData.p.r, m: this._elem.maskManager.getMaskProperty(this._textData.p.m) }, this._hasMaskedPath = !0) : this._hasMaskedPath = !1, this._moreOptions.alignment = i(this._elem, this._textData.m.a, 1, 0, this) }, TextAnimatorProperty.prototype.getMeasures = function (t, e) { if (this.lettersChangedFlag = e, this._mdf || this._isFirstFrame || e || this._hasMaskedPath && this._pathData.m._mdf) { this._isFirstFrame = !1; var r, i, s, a, n, o, h, l, p, m, f, c, d, u, y, g, v, b, E, x = this._moreOptions.alignment.v, P = this._animatorsData, S = this._textData, _ = this.mHelper, A = this._renderType, C = this.renderedLetters.length, T = (this.data, t.l); if (this._hasMaskedPath) { if (E = this._pathData.m, !this._pathData.n || this._pathData._mdf) { var k, M = E.v; for (this._pathData.r && (M = M.reverse()), n = { tLength: 0, segments: [] }, a = M._length - 1, s = g = 0; s < a; s += 1)k = bez.buildBezierData(M.v[s], M.v[s + 1], [M.o[s][0] - M.v[s][0], M.o[s][1] - M.v[s][1]], [M.i[s + 1][0] - M.v[s + 1][0], M.i[s + 1][1] - M.v[s + 1][1]]), n.tLength += k.segmentLength, n.segments.push(k), g += k.segmentLength; s = a, E.v.c && (k = bez.buildBezierData(M.v[s], M.v[0], [M.o[s][0] - M.v[s][0], M.o[s][1] - M.v[s][1]], [M.i[0][0] - M.v[0][0], M.i[0][1] - M.v[0][1]]), n.tLength += k.segmentLength, n.segments.push(k), g += k.segmentLength), this._pathData.pi = n } if (n = this._pathData.pi, o = this._pathData.f.v, m = 1, p = !(l = f = 0), u = n.segments, o < 0 && E.v.c) for (n.tLength < Math.abs(o) && (o = -Math.abs(o) % n.tLength), m = (d = u[f = u.length - 1].points).length - 1; o < 0;)o += d[m].partialLength, (m -= 1) < 0 && (m = (d = u[f -= 1].points).length - 1); c = (d = u[f].points)[m - 1], y = (h = d[m]).partialLength } a = T.length, i = r = 0; var D, w, F, I, V = 1.2 * t.finalSize * .714, R = !0; F = P.length; var B, L, G, z, N, O, H, j, q, W, Y, X, $, K = -1, U = o, J = f, Z = m, Q = -1, tt = "", et = this.defaultPropsArray; if (2 === t.j || 1 === t.j) { var rt = 0, it = 0, st = 2 === t.j ? -.5 : -1, at = 0, nt = !0; for (s = 0; s < a; s += 1)if (T[s].n) { for (rt && (rt += it); at < s;)T[at].animatorJustifyOffset = rt, at += 1; nt = !(rt = 0) } else { for (w = 0; w < F; w += 1)(D = P[w].a).t.propType && (nt && 2 === t.j && (it += D.t.v * st), (B = P[w].s.getMult(T[s].anIndexes[w], S.a[w].s.totalChars)).length ? rt += D.t.v * B[0] * st : rt += D.t.v * B * st); nt = !1 } for (rt && (rt += it); at < s;)T[at].animatorJustifyOffset = rt, at += 1 } for (s = 0; s < a; s += 1) { if (_.reset(), N = 1, T[s].n) r = 0, i += t.yOffset, i += R ? 1 : 0, o = U, R = !1, 0, this._hasMaskedPath && (m = Z, c = (d = u[f = J].points)[m - 1], y = (h = d[m]).partialLength, l = 0), $ = W = X = tt = "", et = this.defaultPropsArray; else { if (this._hasMaskedPath) { if (Q !== T[s].line) { switch (t.j) { case 1: o += g - t.lineWidths[T[s].line]; break; case 2: o += (g - t.lineWidths[T[s].line]) / 2 }Q = T[s].line } K !== T[s].ind && (T[K] && (o += T[K].extra), o += T[s].an / 2, K = T[s].ind), o += x[0] * T[s].an / 200; var ot = 0; for (w = 0; w < F; w += 1)(D = P[w].a).p.propType && ((B = P[w].s.getMult(T[s].anIndexes[w], S.a[w].s.totalChars)).length ? ot += D.p.v[0] * B[0] : ot += D.p.v[0] * B), D.a.propType && ((B = P[w].s.getMult(T[s].anIndexes[w], S.a[w].s.totalChars)).length ? ot += D.a.v[0] * B[0] : ot += D.a.v[0] * B); for (p = !0; p;)o + ot <= l + y || !d ? (v = (o + ot - l) / h.partialLength, G = c.point[0] + (h.point[0] - c.point[0]) * v, z = c.point[1] + (h.point[1] - c.point[1]) * v, _.translate(-x[0] * T[s].an / 200, -x[1] * V / 100), p = !1) : d && (l += h.partialLength, (m += 1) >= d.length && (m = 0, d = u[f += 1] ? u[f].points : E.v.c ? u[f = m = 0].points : (l -= h.partialLength, null)), d && (c = h, y = (h = d[m]).partialLength)); L = T[s].an / 2 - T[s].add, _.translate(-L, 0, 0) } else L = T[s].an / 2 - T[s].add, _.translate(-L, 0, 0), _.translate(-x[0] * T[s].an / 200, -x[1] * V / 100, 0); for (T[s].l / 2, w = 0; w < F; w += 1)(D = P[w].a).t.propType && (B = P[w].s.getMult(T[s].anIndexes[w], S.a[w].s.totalChars), 0 === r && 0 === t.j || (this._hasMaskedPath ? B.length ? o += D.t.v * B[0] : o += D.t.v * B : B.length ? r += D.t.v * B[0] : r += D.t.v * B)); for (T[s].l / 2, t.strokeWidthAnim && (H = t.sw || 0), t.strokeColorAnim && (O = t.sc ? [t.sc[0], t.sc[1], t.sc[2]] : [0, 0, 0]), t.fillColorAnim && t.fc && (j = [t.fc[0], t.fc[1], t.fc[2]]), w = 0; w < F; w += 1)(D = P[w].a).a.propType && ((B = P[w].s.getMult(T[s].anIndexes[w], S.a[w].s.totalChars)).length ? _.translate(-D.a.v[0] * B[0], -D.a.v[1] * B[1], D.a.v[2] * B[2]) : _.translate(-D.a.v[0] * B, -D.a.v[1] * B, D.a.v[2] * B)); for (w = 0; w < F; w += 1)(D = P[w].a).s.propType && ((B = P[w].s.getMult(T[s].anIndexes[w], S.a[w].s.totalChars)).length ? _.scale(1 + (D.s.v[0] - 1) * B[0], 1 + (D.s.v[1] - 1) * B[1], 1) : _.scale(1 + (D.s.v[0] - 1) * B, 1 + (D.s.v[1] - 1) * B, 1)); for (w = 0; w < F; w += 1) { if (D = P[w].a, B = P[w].s.getMult(T[s].anIndexes[w], S.a[w].s.totalChars), D.sk.propType && (B.length ? _.skewFromAxis(-D.sk.v * B[0], D.sa.v * B[1]) : _.skewFromAxis(-D.sk.v * B, D.sa.v * B)), D.r.propType && (B.length ? _.rotateZ(-D.r.v * B[2]) : _.rotateZ(-D.r.v * B)), D.ry.propType && (B.length ? _.rotateY(D.ry.v * B[1]) : _.rotateY(D.ry.v * B)), D.rx.propType && (B.length ? _.rotateX(D.rx.v * B[0]) : _.rotateX(D.rx.v * B)), D.o.propType && (B.length ? N += (D.o.v * B[0] - N) * B[0] : N += (D.o.v * B - N) * B), t.strokeWidthAnim && D.sw.propType && (B.length ? H += D.sw.v * B[0] : H += D.sw.v * B), t.strokeColorAnim && D.sc.propType) for (q = 0; q < 3; q += 1)B.length ? O[q] = O[q] + (D.sc.v[q] - O[q]) * B[0] : O[q] = O[q] + (D.sc.v[q] - O[q]) * B; if (t.fillColorAnim && t.fc) { if (D.fc.propType) for (q = 0; q < 3; q += 1)B.length ? j[q] = j[q] + (D.fc.v[q] - j[q]) * B[0] : j[q] = j[q] + (D.fc.v[q] - j[q]) * B; D.fh.propType && (j = B.length ? addHueToRGB(j, D.fh.v * B[0]) : addHueToRGB(j, D.fh.v * B)), D.fs.propType && (j = B.length ? addSaturationToRGB(j, D.fs.v * B[0]) : addSaturationToRGB(j, D.fs.v * B)), D.fb.propType && (j = B.length ? addBrightnessToRGB(j, D.fb.v * B[0]) : addBrightnessToRGB(j, D.fb.v * B)) } } for (w = 0; w < F; w += 1)(D = P[w].a).p.propType && (B = P[w].s.getMult(T[s].anIndexes[w], S.a[w].s.totalChars), this._hasMaskedPath ? B.length ? _.translate(0, D.p.v[1] * B[0], -D.p.v[2] * B[1]) : _.translate(0, D.p.v[1] * B, -D.p.v[2] * B) : B.length ? _.translate(D.p.v[0] * B[0], D.p.v[1] * B[1], -D.p.v[2] * B[2]) : _.translate(D.p.v[0] * B, D.p.v[1] * B, -D.p.v[2] * B)); if (t.strokeWidthAnim && (W = H < 0 ? 0 : H), t.strokeColorAnim && (Y = "rgb(" + Math.round(255 * O[0]) + "," + Math.round(255 * O[1]) + "," + Math.round(255 * O[2]) + ")"), t.fillColorAnim && t.fc && (X = "rgb(" + Math.round(255 * j[0]) + "," + Math.round(255 * j[1]) + "," + Math.round(255 * j[2]) + ")"), this._hasMaskedPath) { if (_.translate(0, -t.ls), _.translate(0, x[1] * V / 100 + i, 0), S.p.p) { b = (h.point[1] - c.point[1]) / (h.point[0] - c.point[0]); var ht = 180 * Math.atan(b) / Math.PI; h.point[0] < c.point[0] && (ht += 180), _.rotate(-ht * Math.PI / 180) } _.translate(G, z, 0), o -= x[0] * T[s].an / 200, T[s + 1] && K !== T[s + 1].ind && (o += T[s].an / 2, o += t.tr / 1e3 * t.finalSize) } else { switch (_.translate(r, i, 0), t.ps && _.translate(t.ps[0], t.ps[1] + t.ascent, 0), t.j) { case 1: _.translate(T[s].animatorJustifyOffset + t.justifyOffset + (t.boxWidth - t.lineWidths[T[s].line]), 0, 0); break; case 2: _.translate(T[s].animatorJustifyOffset + t.justifyOffset + (t.boxWidth - t.lineWidths[T[s].line]) / 2, 0, 0) }_.translate(0, -t.ls), _.translate(L, 0, 0), _.translate(x[0] * T[s].an / 200, x[1] * V / 100, 0), r += T[s].l + t.tr / 1e3 * t.finalSize } "html" === A ? tt = _.toCSS() : "svg" === A ? tt = _.to2dCSS() : et = [_.props[0], _.props[1], _.props[2], _.props[3], _.props[4], _.props[5], _.props[6], _.props[7], _.props[8], _.props[9], _.props[10], _.props[11], _.props[12], _.props[13], _.props[14], _.props[15]], $ = N } this.lettersChangedFlag = C <= s ? (I = new LetterProps($, W, Y, X, tt, et), this.renderedLetters.push(I), C += 1, !0) : (I = this.renderedLetters[s]).update($, W, Y, X, tt, et) || this.lettersChangedFlag } } }, TextAnimatorProperty.prototype.getValue = function () { this._elem.globalData.frameId !== this._frameId && (this._frameId = this._elem.globalData.frameId, this.iterateDynamicProperties()) }, TextAnimatorProperty.prototype.mHelper = new Matrix, TextAnimatorProperty.prototype.defaultPropsArray = [], extendPrototype([DynamicPropertyContainer], TextAnimatorProperty), LetterProps.prototype.update = function (t, e, r, i, s, a) { this._mdf.o = !1, this._mdf.sw = !1, this._mdf.sc = !1, this._mdf.fc = !1, this._mdf.m = !1; var n = this._mdf.p = !1; return this.o !== t && (this.o = t, n = this._mdf.o = !0), this.sw !== e && (this.sw = e, n = this._mdf.sw = !0), this.sc !== r && (this.sc = r, n = this._mdf.sc = !0), this.fc !== i && (this.fc = i, n = this._mdf.fc = !0), this.m !== s && (this.m = s, n = this._mdf.m = !0), !a.length || this.p[0] === a[0] && this.p[1] === a[1] && this.p[4] === a[4] && this.p[5] === a[5] && this.p[12] === a[12] && this.p[13] === a[13] || (this.p = a, n = this._mdf.p = !0), n }, TextProperty.prototype.defaultBoxWidth = [0, 0], TextProperty.prototype.copyData = function (t, e) { for (var r in e) e.hasOwnProperty(r) && (t[r] = e[r]); return t }, TextProperty.prototype.setCurrentData = function (t) { t.__complete || this.completeTextData(t), this.currentData = t, this.currentData.boxWidth = this.currentData.boxWidth || this.defaultBoxWidth, this._mdf = !0 }, TextProperty.prototype.searchProperty = function () { return this.searchKeyframes() }, TextProperty.prototype.searchKeyframes = function () { return this.kf = 1 < this.data.d.k.length, this.kf && this.addEffect(this.getKeyframeValue.bind(this)), this.kf }, TextProperty.prototype.addEffect = function (t) { this.effectsSequence.push(t), this.elem.addDynamicProperty(this) }, TextProperty.prototype.getValue = function (t) { if (this.elem.globalData.frameId !== this.frameId && this.effectsSequence.length || t) { this.currentData.t = this.data.d.k[this.keysIndex].s.t; var e = this.currentData, r = this.keysIndex; if (this.lock) this.setCurrentData(this.currentData); else { this.lock = !0, this._mdf = !1; var i, s = this.effectsSequence.length, a = t || this.data.d.k[this.keysIndex].s; for (i = 0; i < s; i += 1)a = r !== this.keysIndex ? this.effectsSequence[i](a, a.t) : this.effectsSequence[i](this.currentData, a.t); e !== a && this.setCurrentData(a), this.pv = this.v = this.currentData, this.lock = !1, this.frameId = this.elem.globalData.frameId } } }, TextProperty.prototype.getKeyframeValue = function () { for (var t = this.data.d.k, e = this.elem.comp.renderedFrame, r = 0, i = t.length; r <= i - 1 && (t[r].s, !(r === i - 1 || t[r + 1].t > e));)r += 1; return this.keysIndex !== r && (this.keysIndex = r), this.data.d.k[this.keysIndex].s }, TextProperty.prototype.buildFinalText = function (t) { for (var e, r = FontManager.getCombinedCharacterCodes(), i = [], s = 0, a = t.length; s < a;)e = t.charCodeAt(s), -1 !== r.indexOf(e) ? i[i.length - 1] += t.charAt(s) : 55296 <= e && e <= 56319 && 56320 <= (e = t.charCodeAt(s + 1)) && e <= 57343 ? (i.push(t.substr(s, 2)), ++s) : i.push(t.charAt(s)), s += 1; return i }, TextProperty.prototype.completeTextData = function (t) { t.__complete = !0; var e, r, i, s, a, n, o, h = this.elem.globalData.fontManager, l = this.data, p = [], m = 0, f = l.m.g, c = 0, d = 0, u = 0, y = [], g = 0, v = 0, b = h.getFontByName(t.f), E = 0, x = b.fStyle ? b.fStyle.split(" ") : [], P = "normal", S = "normal"; for (r = x.length, e = 0; e < r; e += 1)switch (x[e].toLowerCase()) { case "italic": S = "italic"; break; case "bold": P = "700"; break; case "black": P = "900"; break; case "medium": P = "500"; break; case "regular": case "normal": P = "400"; break; case "light": case "thin": P = "200" }t.fWeight = b.fWeight || P, t.fStyle = S, t.finalSize = t.s, t.finalText = this.buildFinalText(t.t), r = t.finalText.length, t.finalLineHeight = t.lh; var _, A = t.tr / 1e3 * t.finalSize; if (t.sz) for (var C, T, k = !0, M = t.sz[0], D = t.sz[1]; k;) { g = C = 0, r = (T = this.buildFinalText(t.t)).length, A = t.tr / 1e3 * t.finalSize; var w = -1; for (e = 0; e < r; e += 1)_ = T[e].charCodeAt(0), i = !1, " " === T[e] ? w = e : 13 !== _ && 3 !== _ || (i = !(g = 0), C += t.finalLineHeight || 1.2 * t.finalSize), M < g + (E = h.chars ? (o = h.getCharData(T[e], b.fStyle, b.fFamily), i ? 0 : o.w * t.finalSize / 100) : h.measureText(T[e], t.f, t.finalSize)) && " " !== T[e] ? (-1 === w ? r += 1 : e = w, C += t.finalLineHeight || 1.2 * t.finalSize, T.splice(e, w === e ? 1 : 0, "\r"), w = -1, g = 0) : (g += E, g += A); C += b.ascent * t.finalSize / 100, this.canResize && t.finalSize > this.minimumFontSize && D < C ? (t.finalSize -= 1, t.finalLineHeight = t.finalSize * t.lh / t.s) : (t.finalText = T, r = t.finalText.length, k = !1) } g = -A; var F, I = E = 0; for (e = 0; e < r; e += 1)if (i = !1, _ = (F = t.finalText[e]).charCodeAt(0), " " === F ? s = "\xa0" : 13 === _ || 3 === _ ? (I = 0, y.push(g), v = v < g ? g : v, g = -2 * A, i = !(s = ""), u += 1) : s = t.finalText[e], E = h.chars ? (o = h.getCharData(F, b.fStyle, h.getFontByName(t.f).fFamily), i ? 0 : o.w * t.finalSize / 100) : h.measureText(s, t.f, t.finalSize), " " === F ? I += E + A : (g += E + A + I, I = 0), p.push({ l: E, an: E, add: c, n: i, anIndexes: [], val: s, line: u, animatorJustifyOffset: 0 }), 2 == f) { if (c += E, "" === s || "\xa0" === s || e === r - 1) { for ("" !== s && "\xa0" !== s || (c -= E); d <= e;)p[d].an = c, p[d].ind = m, p[d].extra = E, d += 1; m += 1, c = 0 } } else if (3 == f) { if (c += E, "" === s || e === r - 1) { for ("" === s && (c -= E); d <= e;)p[d].an = c, p[d].ind = m, p[d].extra = E, d += 1; c = 0, m += 1 } } else p[m].ind = m, p[m].extra = 0, m += 1; if (t.l = p, v = v < g ? g : v, y.push(g), t.sz) t.boxWidth = t.sz[0], t.justifyOffset = 0; else switch (t.boxWidth = v, t.j) { case 1: t.justifyOffset = -t.boxWidth; break; case 2: t.justifyOffset = -t.boxWidth / 2; break; default: t.justifyOffset = 0 }t.lineWidths = y; var V, R, B = l.a; n = B.length; var L, G, z = []; for (a = 0; a < n; a += 1) { for ((V = B[a]).a.sc && (t.strokeColorAnim = !0), V.a.sw && (t.strokeWidthAnim = !0), (V.a.fc || V.a.fh || V.a.fs || V.a.fb) && (t.fillColorAnim = !0), G = 0, L = V.s.b, e = 0; e < r; e += 1)(R = p[e]).anIndexes[a] = G, (1 == L && "" !== R.val || 2 == L && "" !== R.val && "\xa0" !== R.val || 3 == L && (R.n || "\xa0" == R.val || e == r - 1) || 4 == L && (R.n || e == r - 1)) && (1 === V.s.rn && z.push(G), G += 1); l.a[a].s.totalChars = G; var N, O = -1; if (1 === V.s.rn) for (e = 0; e < r; e += 1)O != (R = p[e]).anIndexes[a] && (O = R.anIndexes[a], N = z.splice(Math.floor(Math.random() * z.length), 1)[0]), R.anIndexes[a] = N } t.yOffset = t.finalLineHeight || 1.2 * t.finalSize, t.ls = t.ls || 0, t.ascent = b.ascent * t.finalSize / 100 }, TextProperty.prototype.updateDocumentData = function (t, e) { e = void 0 === e ? this.keysIndex : e; var r = this.copyData({}, this.data.d.k[e].s); r = this.copyData(r, t), this.data.d.k[e].s = r, this.recalculate(e), this.elem.addDynamicProperty(this) }, TextProperty.prototype.recalculate = function (t) { var e = this.data.d.k[t].s; e.__complete = !1, this.keysIndex = 0, this._isFirstFrame = !0, this.getValue(e) }, TextProperty.prototype.canResizeFont = function (t) { this.canResize = t, this.recalculate(this.keysIndex), this.elem.addDynamicProperty(this) }, TextProperty.prototype.setMinimumFontSize = function (t) { this.minimumFontSize = Math.floor(t) || 1, this.recalculate(this.keysIndex), this.elem.addDynamicProperty(this) }; var TextSelectorProp = function () { var c = Math.max, d = Math.min, u = Math.floor; function i(t, e) { this._currentTextLength = -1, this.k = !1, this.data = e, this.elem = t, this.comp = t.comp, this.finalS = 0, this.finalE = 0, this.initDynamicPropertyContainer(t), this.s = PropertyFactory.getProp(t, e.s || { k: 0 }, 0, 0, this), this.e = "e" in e ? PropertyFactory.getProp(t, e.e, 0, 0, this) : { v: 100 }, this.o = PropertyFactory.getProp(t, e.o || { k: 0 }, 0, 0, this), this.xe = PropertyFactory.getProp(t, e.xe || { k: 0 }, 0, 0, this), this.ne = PropertyFactory.getProp(t, e.ne || { k: 0 }, 0, 0, this), this.a = PropertyFactory.getProp(t, e.a, 0, .01, this), this.dynamicProperties.length || this.getValue() } return i.prototype = { getMult: function (t) { this._currentTextLength !== this.elem.textProperty.currentData.l.length && this.getValue(); var e = 0, r = 0, i = 1, s = 1; 0 < this.ne.v ? e = this.ne.v / 100 : r = -this.ne.v / 100, 0 < this.xe.v ? i = 1 - this.xe.v / 100 : s = 1 + this.xe.v / 100; var a = BezierFactory.getBezierEasing(e, r, i, s).get, n = 0, o = this.finalS, h = this.finalE, l = this.data.sh; if (2 === l) n = a(n = h === o ? h <= t ? 1 : 0 : c(0, d(.5 / (h - o) + (t - o) / (h - o), 1))); else if (3 === l) n = a(n = h === o ? h <= t ? 0 : 1 : 1 - c(0, d(.5 / (h - o) + (t - o) / (h - o), 1))); else if (4 === l) h === o ? n = 0 : (n = c(0, d(.5 / (h - o) + (t - o) / (h - o), 1))) < .5 ? n *= 2 : n = 1 - 2 * (n - .5), n = a(n); else if (5 === l) { if (h === o) n = 0; else { var p = h - o, m = -p / 2 + (t = d(c(0, t + .5 - o), h - o)), f = p / 2; n = Math.sqrt(1 - m * m / (f * f)) } n = a(n) } else n = 6 === l ? a(n = h === o ? 0 : (t = d(c(0, t + .5 - o), h - o), (1 + Math.cos(Math.PI + 2 * Math.PI * t / (h - o))) / 2)) : (t >= u(o) && (n = c(0, d(t - o < 0 ? d(h, 1) - (o - t) : h - t, 1))), a(n)); return n * this.a.v }, getValue: function (t) { this.iterateDynamicProperties(), this._mdf = t || this._mdf, this._currentTextLength = this.elem.textProperty.currentData.l.length || 0, t && 2 === this.data.r && (this.e.v = this._currentTextLength); var e = 2 === this.data.r ? 1 : 100 / this.data.totalChars, r = this.o.v / e, i = this.s.v / e + r, s = this.e.v / e + r; if (s < i) { var a = i; i = s, s = a } this.finalS = i, this.finalE = s } }, extendPrototype([DynamicPropertyContainer], i), { getTextSelectorProp: function (t, e, r) { return new i(t, e, r) } } }(), pool_factory = function (t, e, r, i) { var s = 0, a = t, n = createSizedArray(a); function o() { return s ? n[s -= 1] : e() } return { newElement: o, release: function (t) { s === a && (n = pooling.double(n), a *= 2), r && r(t), n[s] = t, s += 1 } } }, pooling = { double: function (t) { return t.concat(createSizedArray(t.length)) } }, point_pool = pool_factory(8, function () { return createTypedArray("float32", 2) }), shape_pool = (KA = pool_factory(4, function () { return new ShapePath }, function (t) { var e, r = t._length; for (e = 0; e < r; e += 1)point_pool.release(t.v[e]), point_pool.release(t.i[e]), point_pool.release(t.o[e]), t.v[e] = null, t.i[e] = null, t.o[e] = null; t._length = 0, t.c = !1 }), KA.clone = function (t) { var e, r = KA.newElement(), i = void 0 === t._length ? t.v.length : t._length; for (r.setLength(i), r.c = t.c, e = 0; e < i; e += 1)r.setTripleAt(t.v[e][0], t.v[e][1], t.o[e][0], t.o[e][1], t.i[e][0], t.i[e][1], e); return r }, KA), KA, shapeCollection_pool = (TA = { newShapeCollection: function () { var t; t = UA ? WA[UA -= 1] : new ShapeCollection; return t }, release: function (t) { var e, r = t._length; for (e = 0; e < r; e += 1)shape_pool.release(t.shapes[e]); t._length = 0, UA === VA && (WA = pooling.double(WA), VA *= 2); WA[UA] = t, UA += 1 } }, UA = 0, VA = 4, WA = createSizedArray(VA), TA), TA, UA, VA, WA, segments_length_pool = pool_factory(8, function () { return { lengths: [], totalLength: 0 } }, function (t) { var e, r = t.lengths.length; for (e = 0; e < r; e += 1)bezier_length_pool.release(t.lengths[e]); t.lengths.length = 0 }), bezier_length_pool = pool_factory(8, function () { return { addedLength: 0, percents: createTypedArray("float32", defaultCurveSegments), lengths: createTypedArray("float32", defaultCurveSegments) } }); function BaseRenderer() { } function SVGRenderer(t, e) { this.animationItem = t, this.layers = null, this.renderedFrame = -1, this.svgElement = createNS("svg"); var r = ""; if (e && e.title) { var i = createNS("title"), s = createElementID(); i.setAttribute("id", s), i.textContent = e.title, this.svgElement.appendChild(i), r += s } if (e && e.description) { var a = createNS("desc"), n = createElementID(); a.setAttribute("id", n), a.textContent = e.description, this.svgElement.appendChild(a), r += " " + n } r && this.svgElement.setAttribute("aria-labelledby", r); var o = createNS("defs"); this.svgElement.appendChild(o); var h = createNS("g"); this.svgElement.appendChild(h), this.layerElement = h, this.renderConfig = { preserveAspectRatio: e && e.preserveAspectRatio || "xMidYMid meet", imagePreserveAspectRatio: e && e.imagePreserveAspectRatio || "xMidYMid slice", progressiveLoad: e && e.progressiveLoad || !1, hideOnTransparent: !e || !1 !== e.hideOnTransparent, viewBoxOnly: true, viewBoxSize: e && e.viewBoxSize || !1, className: e && e.className || "", id: e && e.id || "", focusable: e && e.focusable }, this.globalData = { _mdf: !1, frameNum: -1, defs: o, renderConfig: this.renderConfig }, this.elements = [], this.pendingElements = [], this.destroyed = !1, this.rendererType = "svg" } function CanvasRenderer(t, e) { this.animationItem = t, this.renderConfig = { clearCanvas: !e || void 0 === e.clearCanvas || e.clearCanvas, context: e && e.context || null, progressiveLoad: e && e.progressiveLoad || !1, preserveAspectRatio: e && e.preserveAspectRatio || "xMidYMid meet", imagePreserveAspectRatio: e && e.imagePreserveAspectRatio || "xMidYMid slice", className: e && e.className || "", id: e && e.id || "" }, this.renderConfig.dpr = e && e.dpr || 1, this.animationItem.wrapper && (this.renderConfig.dpr = e && e.dpr || window.devicePixelRatio || 1), this.renderedFrame = -1, this.globalData = { frameNum: -1, _mdf: !1, renderConfig: this.renderConfig, currentGlobalAlpha: -1 }, this.contextData = new CVContextData, this.elements = [], this.pendingElements = [], this.transformMat = new Matrix, this.completeLayers = !1, this.rendererType = "canvas" } function HybridRenderer(t, e) { this.animationItem = t, this.layers = null, this.renderedFrame = -1, this.renderConfig = { className: e && e.className || "", imagePreserveAspectRatio: e && e.imagePreserveAspectRatio || "xMidYMid slice", hideOnTransparent: !e || !1 !== e.hideOnTransparent }, this.globalData = { _mdf: !1, frameNum: -1, renderConfig: this.renderConfig }, this.pendingElements = [], this.elements = [], this.threeDElements = [], this.destroyed = !1, this.camera = null, this.supports3d = !0, this.rendererType = "html" } function MaskElement(t, e, r) { this.data = t, this.element = e, this.globalData = r, this.storedData = [], this.masksProperties = this.data.masksProperties || [], this.maskElement = null; var i, s = this.globalData.defs, a = this.masksProperties ? this.masksProperties.length : 0; this.viewData = createSizedArray(a), this.solidPath = ""; var n, o, h, l, p, m, f, c = this.masksProperties, d = 0, u = [], y = createElementID(), g = "clipPath", v = "clip-path"; for (i = 0; i < a; i++)if (("a" !== c[i].mode && "n" !== c[i].mode || c[i].inv || 100 !== c[i].o.k || c[i].o.x) && (v = g = "mask"), "s" != c[i].mode && "i" != c[i].mode || 0 !== d ? l = null : ((l = createNS("rect")).setAttribute("fill", "#ffffff"), l.setAttribute("width", this.element.comp.data.w || 0), l.setAttribute("height", this.element.comp.data.h || 0), u.push(l)), n = createNS("path"), "n" != c[i].mode) { var b; if (d += 1, n.setAttribute("fill", "s" === c[i].mode ? "#000000" : "#ffffff"), n.setAttribute("clip-rule", "nonzero"), 0 !== c[i].x.k ? (v = g = "mask", f = PropertyFactory.getProp(this.element, c[i].x, 0, null, this.element), b = createElementID(), (p = createNS("filter")).setAttribute("id", b), (m = createNS("feMorphology")).setAttribute("operator", "erode"), m.setAttribute("in", "SourceGraphic"), m.setAttribute("radius", "0"), p.appendChild(m), s.appendChild(p), n.setAttribute("stroke", "s" === c[i].mode ? "#000000" : "#ffffff")) : f = m = null, this.storedData[i] = { elem: n, x: f, expan: m, lastPath: "", lastOperator: "", filterId: b, lastRadius: 0 }, "i" == c[i].mode) { h = u.length; var E = createNS("g"); for (o = 0; o < h; o += 1)E.appendChild(u[o]); var x = createNS("mask"); x.setAttribute("mask-type", "alpha"), x.setAttribute("id", y + "_" + d), x.appendChild(n), s.appendChild(x), E.setAttribute("mask", "url(" + locationHref + "#" + y + "_" + d + ")"), u.length = 0, u.push(E) } else u.push(n); c[i].inv && !this.solidPath && (this.solidPath = this.createLayerSolidPath()), this.viewData[i] = { elem: n, lastPath: "", op: PropertyFactory.getProp(this.element, c[i].o, 0, .01, this.element), prop: ShapePropertyFactory.getShapeProp(this.element, c[i], 3), invRect: l }, this.viewData[i].prop.k || this.drawPath(c[i], this.viewData[i].prop.v, this.viewData[i]) } else this.viewData[i] = { op: PropertyFactory.getProp(this.element, c[i].o, 0, .01, this.element), prop: ShapePropertyFactory.getShapeProp(this.element, c[i], 3), elem: n, lastPath: "" }, s.appendChild(n); for (this.maskElement = createNS(g), a = u.length, i = 0; i < a; i += 1)this.maskElement.appendChild(u[i]); 0 < d && (this.maskElement.setAttribute("id", y), this.element.maskedElement.setAttribute(v, "url(" + locationHref + "#" + y + ")"), s.appendChild(this.maskElement)), this.viewData.length && this.element.addRenderableComponent(this) } function HierarchyElement() { } function FrameElement() { } function TransformElement() { } function RenderableElement() { } function RenderableDOMElement() { } function ProcessedElement(t, e) { this.elem = t, this.pos = e } function SVGStyleData(t, e) { this.data = t, this.type = t.ty, this.d = "", this.lvl = e, this._mdf = !1, this.closed = !0 === t.hd, this.pElem = createNS("path"), this.msElem = null } function SVGShapeData(t, e, r) { this.caches = [], this.styles = [], this.transformers = t, this.lStr = "", this.sh = r, this.lvl = e, this._isAnimated = !!r.k; for (var i = 0, s = t.length; i < s;) { if (t[i].mProps.dynamicProperties.length) { this._isAnimated = !0; break } i += 1 } } function SVGTransformData(t, e, r) { this.transform = { mProps: t, op: e, container: r }, this.elements = [], this._isAnimated = this.transform.mProps.dynamicProperties.length || this.transform.op.effectsSequence.length } function SVGStrokeStyleData(t, e, r) { this.initDynamicPropertyContainer(t), this.getValue = this.iterateDynamicProperties, this.o = PropertyFactory.getProp(t, e.o, 0, .01, this), this.w = PropertyFactory.getProp(t, e.w, 0, null, this), this.d = new DashProperty(t, e.d || {}, "svg", this), this.c = PropertyFactory.getProp(t, e.c, 1, 255, this), this.style = r, this._isAnimated = !!this._isAnimated } function SVGFillStyleData(t, e, r) { this.initDynamicPropertyContainer(t), this.getValue = this.iterateDynamicProperties, this.o = PropertyFactory.getProp(t, e.o, 0, .01, this), this.c = PropertyFactory.getProp(t, e.c, 1, 255, this), this.style = r } function SVGGradientFillStyleData(t, e, r) { this.initDynamicPropertyContainer(t), this.getValue = this.iterateDynamicProperties, this.initGradientData(t, e, r) } function SVGGradientStrokeStyleData(t, e, r) { this.initDynamicPropertyContainer(t), this.getValue = this.iterateDynamicProperties, this.w = PropertyFactory.getProp(t, e.w, 0, null, this), this.d = new DashProperty(t, e.d || {}, "svg", this), this.initGradientData(t, e, r), this._isAnimated = !!this._isAnimated } function ShapeGroupData() { this.it = [], this.prevViewData = [], this.gr = createNS("g") } BaseRenderer.prototype.checkLayers = function (t) { var e, r, i = this.layers.length; for (this.completeLayers = !0, e = i - 1; 0 <= e; e--)this.elements[e] || (r = this.layers[e]).ip - r.st <= t - this.layers[e].st && r.op - r.st > t - this.layers[e].st && this.buildItem(e), this.completeLayers = !!this.elements[e] && this.completeLayers; this.checkPendingElements() }, BaseRenderer.prototype.createItem = function (t) { switch (t.ty) { case 2: return this.createImage(t); case 0: return this.createComp(t); case 1: return this.createSolid(t); case 3: return this.createNull(t); case 4: return this.createShape(t); case 5: return this.createText(t); case 13: return this.createCamera(t) }return this.createNull(t) }, BaseRenderer.prototype.createCamera = function () { throw new Error("You're using a 3d camera. Try the html renderer.") }, BaseRenderer.prototype.buildAllItems = function () { var t, e = this.layers.length; for (t = 0; t < e; t += 1)this.buildItem(t); this.checkPendingElements() }, BaseRenderer.prototype.includeLayers = function (t) { this.completeLayers = !1; var e, r, i = t.length, s = this.layers.length; for (e = 0; e < i; e += 1)for (r = 0; r < s;) { if (this.layers[r].id == t[e].id) { this.layers[r] = t[e]; break } r += 1 } }, BaseRenderer.prototype.setProjectInterface = function (t) { this.globalData.projectInterface = t }, BaseRenderer.prototype.initItems = function () { this.globalData.progressiveLoad || this.buildAllItems() }, BaseRenderer.prototype.buildElementParenting = function (t, e, r) { for (var i = this.elements, s = this.layers, a = 0, n = s.length; a < n;)s[a].ind == e && (i[a] && !0 !== i[a] ? (r.push(i[a]), i[a].setAsParent(), void 0 !== s[a].parent ? this.buildElementParenting(t, s[a].parent, r) : t.setHierarchy(r)) : (this.buildItem(a), this.addPendingElement(t))), a += 1 }, BaseRenderer.prototype.addPendingElement = function (t) { this.pendingElements.push(t) }, BaseRenderer.prototype.searchExtraCompositions = function (t) { var e, r = t.length; for (e = 0; e < r; e += 1)if (t[e].xt) { var i = this.createComp(t[e]); i.initExpressions(), this.globalData.projectInterface.registerComposition(i) } }, BaseRenderer.prototype.setupGlobalData = function (t, e) { this.globalData.fontManager = new FontManager, this.globalData.fontManager.addChars(t.chars), this.globalData.fontManager.addFonts(t.fonts, e), this.globalData.getAssetData = this.animationItem.getAssetData.bind(this.animationItem), this.globalData.getAssetsPath = this.animationItem.getAssetsPath.bind(this.animationItem), this.globalData.imageLoader = this.animationItem.imagePreloader, this.globalData.frameId = 0, this.globalData.frameRate = t.fr, this.globalData.nm = t.nm, this.globalData.compSize = { w: t.w, h: t.h } }, extendPrototype([BaseRenderer], SVGRenderer), SVGRenderer.prototype.createNull = function (t) { return new NullElement(t, this.globalData, this) }, SVGRenderer.prototype.createShape = function (t) { return new SVGShapeElement(t, this.globalData, this) }, SVGRenderer.prototype.createText = function (t) { return new SVGTextElement(t, this.globalData, this) }, SVGRenderer.prototype.createImage = function (t) { return new IImageElement(t, this.globalData, this) }, SVGRenderer.prototype.createComp = function (t) { return new SVGCompElement(t, this.globalData, this) }, SVGRenderer.prototype.createSolid = function (t) { return new ISolidElement(t, this.globalData, this) }, SVGRenderer.prototype.configAnimation = function (t) { this.svgElement.setAttribute("xmlns", "http://www.w3.org/2000/svg"), this.renderConfig.viewBoxSize ? this.svgElement.setAttribute("viewBox", this.renderConfig.viewBoxSize) : this.svgElement.setAttribute("viewBox", "0 0 " + t.w + " " + t.h), this.renderConfig.viewBoxOnly || (this.svgElement.setAttribute("width", t.w), this.svgElement.setAttribute("height", t.h), this.svgElement.style.width = "100%", this.svgElement.style.height = "100%", this.svgElement.style.transform = "translate3d(0,0,0)"), this.renderConfig.className && this.svgElement.setAttribute("class", this.renderConfig.className), this.renderConfig.id && this.svgElement.setAttribute("id", this.renderConfig.id), void 0 !== this.renderConfig.focusable && this.svgElement.setAttribute("focusable", this.renderConfig.focusable), this.svgElement.setAttribute("preserveAspectRatio", this.renderConfig.preserveAspectRatio), this.animationItem.wrapper.appendChild(this.svgElement); var e = this.globalData.defs; this.setupGlobalData(t, e), this.globalData.progressiveLoad = this.renderConfig.progressiveLoad, this.data = t; var r = createNS("clipPath"), i = createNS("rect"); i.setAttribute("width", t.w), i.setAttribute("height", t.h), i.setAttribute("x", 0), i.setAttribute("y", 0); var s = createElementID(); r.setAttribute("id", s), r.appendChild(i), this.layerElement.setAttribute("clip-path", "url(" + locationHref + "#" + s + ")"), e.appendChild(r), this.layers = t.layers, this.elements = createSizedArray(t.layers.length) }, SVGRenderer.prototype.destroy = function () { this.animationItem.wrapper.innerHTML = "", this.layerElement = null, this.globalData.defs = null; var t, e = this.layers ? this.layers.length : 0; for (t = 0; t < e; t++)this.elements[t] && this.elements[t].destroy(); this.elements.length = 0, this.destroyed = !0, this.animationItem = null }, SVGRenderer.prototype.updateContainerSize = function () { }, SVGRenderer.prototype.buildItem = function (t) { var e = this.elements; if (!e[t] && 99 != this.layers[t].ty) { e[t] = !0; var r = this.createItem(this.layers[t]); e[t] = r, expressionsPlugin && (0 === this.layers[t].ty && this.globalData.projectInterface.registerComposition(r), r.initExpressions()), this.appendElementInPos(r, t), this.layers[t].tt && (this.elements[t - 1] && !0 !== this.elements[t - 1] ? r.setMatte(e[t - 1].layerId) : (this.buildItem(t - 1), this.addPendingElement(r))) } }, SVGRenderer.prototype.checkPendingElements = function () { for (; this.pendingElements.length;) { var t = this.pendingElements.pop(); if (t.checkParenting(), t.data.tt) for (var e = 0, r = this.elements.length; e < r;) { if (this.elements[e] === t) { t.setMatte(this.elements[e - 1].layerId); break } e += 1 } } }, SVGRenderer.prototype.renderFrame = function (t) { if (this.renderedFrame !== t && !this.destroyed) { null === t ? t = this.renderedFrame : this.renderedFrame = t, this.globalData.frameNum = t, this.globalData.frameId += 1, this.globalData.projectInterface.currentFrame = t, this.globalData._mdf = !1; var e, r = this.layers.length; for (this.completeLayers || this.checkLayers(t), e = r - 1; 0 <= e; e--)(this.completeLayers || this.elements[e]) && this.elements[e].prepareFrame(t - this.layers[e].st); if (this.globalData._mdf) for (e = 0; e < r; e += 1)(this.completeLayers || this.elements[e]) && this.elements[e].renderFrame() } }, SVGRenderer.prototype.appendElementInPos = function (t, e) { var r = t.getBaseElement(); if (r) { for (var i, s = 0; s < e;)this.elements[s] && !0 !== this.elements[s] && this.elements[s].getBaseElement() && (i = this.elements[s].getBaseElement()), s += 1; i ? this.layerElement.insertBefore(r, i) : this.layerElement.appendChild(r) } }, SVGRenderer.prototype.hide = function () { this.layerElement.style.display = "none" }, SVGRenderer.prototype.show = function () { this.layerElement.style.display = "block" }, extendPrototype([BaseRenderer], CanvasRenderer), CanvasRenderer.prototype.createShape = function (t) { return new CVShapeElement(t, this.globalData, this) }, CanvasRenderer.prototype.createText = function (t) { return new CVTextElement(t, this.globalData, this) }, CanvasRenderer.prototype.createImage = function (t) { return new CVImageElement(t, this.globalData, this) }, CanvasRenderer.prototype.createComp = function (t) { return new CVCompElement(t, this.globalData, this) }, CanvasRenderer.prototype.createSolid = function (t) { return new CVSolidElement(t, this.globalData, this) }, CanvasRenderer.prototype.createNull = SVGRenderer.prototype.createNull, CanvasRenderer.prototype.ctxTransform = function (t) { if (1 !== t[0] || 0 !== t[1] || 0 !== t[4] || 1 !== t[5] || 0 !== t[12] || 0 !== t[13]) if (this.renderConfig.clearCanvas) { this.transformMat.cloneFromProps(t); var e = this.contextData.cTr.props; this.transformMat.transform(e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15]), this.contextData.cTr.cloneFromProps(this.transformMat.props); var r = this.contextData.cTr.props; this.canvasContext.setTransform(r[0], r[1], r[4], r[5], r[12], r[13]) } else this.canvasContext.transform(t[0], t[1], t[4], t[5], t[12], t[13]) }, CanvasRenderer.prototype.ctxOpacity = function (t) { if (!this.renderConfig.clearCanvas) return this.canvasContext.globalAlpha *= t < 0 ? 0 : t, void (this.globalData.currentGlobalAlpha = this.contextData.cO); this.contextData.cO *= t < 0 ? 0 : t, this.globalData.currentGlobalAlpha !== this.contextData.cO && (this.canvasContext.globalAlpha = this.contextData.cO, this.globalData.currentGlobalAlpha = this.contextData.cO) }, CanvasRenderer.prototype.reset = function () { this.renderConfig.clearCanvas ? this.contextData.reset() : this.canvasContext.restore() }, CanvasRenderer.prototype.save = function (t) { if (this.renderConfig.clearCanvas) { t && this.canvasContext.save(); var e = this.contextData.cTr.props; this.contextData._length <= this.contextData.cArrPos && this.contextData.duplicate(); var r, i = this.contextData.saved[this.contextData.cArrPos]; for (r = 0; r < 16; r += 1)i[r] = e[r]; this.contextData.savedOp[this.contextData.cArrPos] = this.contextData.cO, this.contextData.cArrPos += 1 } else this.canvasContext.save() }, CanvasRenderer.prototype.restore = function (t) { if (this.renderConfig.clearCanvas) { t && (this.canvasContext.restore(), this.globalData.blendMode = "source-over"), this.contextData.cArrPos -= 1; var e, r = this.contextData.saved[this.contextData.cArrPos], i = this.contextData.cTr.props; for (e = 0; e < 16; e += 1)i[e] = r[e]; this.canvasContext.setTransform(r[0], r[1], r[4], r[5], r[12], r[13]), r = this.contextData.savedOp[this.contextData.cArrPos], this.contextData.cO = r, this.globalData.currentGlobalAlpha !== r && (this.canvasContext.globalAlpha = r, this.globalData.currentGlobalAlpha = r) } else this.canvasContext.restore() }, CanvasRenderer.prototype.configAnimation = function (t) { this.animationItem.wrapper ? (this.animationItem.container = createTag("canvas"), this.animationItem.container.style.width = "100%", this.animationItem.container.style.height = "100%", this.animationItem.container.style.transformOrigin = this.animationItem.container.style.mozTransformOrigin = this.animationItem.container.style.webkitTransformOrigin = this.animationItem.container.style["-webkit-transform"] = "0px 0px 0px", this.animationItem.wrapper.appendChild(this.animationItem.container), this.canvasContext = this.animationItem.container.getContext("2d"), this.renderConfig.className && this.animationItem.container.setAttribute("class", this.renderConfig.className), this.renderConfig.id && this.animationItem.container.setAttribute("id", this.renderConfig.id)) : this.canvasContext = this.renderConfig.context, this.data = t, this.layers = t.layers, this.transformCanvas = { w: t.w, h: t.h, sx: 0, sy: 0, tx: 0, ty: 0 }, this.setupGlobalData(t, document.body), this.globalData.canvasContext = this.canvasContext, (this.globalData.renderer = this).globalData.isDashed = !1, this.globalData.progressiveLoad = this.renderConfig.progressiveLoad, this.globalData.transformCanvas = this.transformCanvas, this.elements = createSizedArray(t.layers.length), this.updateContainerSize() }, CanvasRenderer.prototype.updateContainerSize = function () { var t, e, r, i; if (this.reset(), this.animationItem.wrapper && this.animationItem.container ? (t = this.animationItem.wrapper.offsetWidth, e = this.animationItem.wrapper.offsetHeight, this.animationItem.container.setAttribute("width", t * this.renderConfig.dpr), this.animationItem.container.setAttribute("height", e * this.renderConfig.dpr)) : (t = this.canvasContext.canvas.width * this.renderConfig.dpr, e = this.canvasContext.canvas.height * this.renderConfig.dpr), -1 !== this.renderConfig.preserveAspectRatio.indexOf("meet") || -1 !== this.renderConfig.preserveAspectRatio.indexOf("slice")) { var s = this.renderConfig.preserveAspectRatio.split(" "), a = s[1] || "meet", n = s[0] || "xMidYMid", o = n.substr(0, 4), h = n.substr(4); r = t / e, i = this.transformCanvas.w / this.transformCanvas.h, this.transformCanvas.sy = r < i && "meet" === a || i < r && "slice" === a ? (this.transformCanvas.sx = t / (this.transformCanvas.w / this.renderConfig.dpr), t / (this.transformCanvas.w / this.renderConfig.dpr)) : (this.transformCanvas.sx = e / (this.transformCanvas.h / this.renderConfig.dpr), e / (this.transformCanvas.h / this.renderConfig.dpr)), this.transformCanvas.tx = "xMid" === o && (i < r && "meet" === a || r < i && "slice" === a) ? (t - this.transformCanvas.w * (e / this.transformCanvas.h)) / 2 * this.renderConfig.dpr : "xMax" === o && (i < r && "meet" === a || r < i && "slice" === a) ? (t - this.transformCanvas.w * (e / this.transformCanvas.h)) * this.renderConfig.dpr : 0, this.transformCanvas.ty = "YMid" === h && (r < i && "meet" === a || i < r && "slice" === a) ? (e - this.transformCanvas.h * (t / this.transformCanvas.w)) / 2 * this.renderConfig.dpr : "YMax" === h && (r < i && "meet" === a || i < r && "slice" === a) ? (e - this.transformCanvas.h * (t / this.transformCanvas.w)) * this.renderConfig.dpr : 0 } else "none" == this.renderConfig.preserveAspectRatio ? (this.transformCanvas.sx = t / (this.transformCanvas.w / this.renderConfig.dpr), this.transformCanvas.sy = e / (this.transformCanvas.h / this.renderConfig.dpr)) : (this.transformCanvas.sx = this.renderConfig.dpr, this.transformCanvas.sy = this.renderConfig.dpr), this.transformCanvas.tx = 0, this.transformCanvas.ty = 0; this.transformCanvas.props = [this.transformCanvas.sx, 0, 0, 0, 0, this.transformCanvas.sy, 0, 0, 0, 0, 1, 0, this.transformCanvas.tx, this.transformCanvas.ty, 0, 1], this.ctxTransform(this.transformCanvas.props), this.canvasContext.beginPath(), this.canvasContext.rect(0, 0, this.transformCanvas.w, this.transformCanvas.h), this.canvasContext.closePath(), this.canvasContext.clip(), this.renderFrame(this.renderedFrame, !0) }, CanvasRenderer.prototype.destroy = function () { var t; for (this.renderConfig.clearCanvas && (this.animationItem.wrapper.innerHTML = ""), t = (this.layers ? this.layers.length : 0) - 1; 0 <= t; t -= 1)this.elements[t] && this.elements[t].destroy(); this.elements.length = 0, this.globalData.canvasContext = null, this.animationItem.container = null, this.destroyed = !0 }, CanvasRenderer.prototype.renderFrame = function (t, e) { if ((this.renderedFrame !== t || !0 !== this.renderConfig.clearCanvas || e) && !this.destroyed && -1 !== t) { this.renderedFrame = t, this.globalData.frameNum = t - this.animationItem._isFirstFrame, this.globalData.frameId += 1, this.globalData._mdf = !this.renderConfig.clearCanvas || e, this.globalData.projectInterface.currentFrame = t; var r, i = this.layers.length; for (this.completeLayers || this.checkLayers(t), r = 0; r < i; r++)(this.completeLayers || this.elements[r]) && this.elements[r].prepareFrame(t - this.layers[r].st); if (this.globalData._mdf) { for (!0 === this.renderConfig.clearCanvas ? this.canvasContext.clearRect(0, 0, this.transformCanvas.w, this.transformCanvas.h) : this.save(), r = i - 1; 0 <= r; r -= 1)(this.completeLayers || this.elements[r]) && this.elements[r].renderFrame(); !0 !== this.renderConfig.clearCanvas && this.restore() } } }, CanvasRenderer.prototype.buildItem = function (t) { var e = this.elements; if (!e[t] && 99 != this.layers[t].ty) { var r = this.createItem(this.layers[t], this, this.globalData); (e[t] = r).initExpressions() } }, CanvasRenderer.prototype.checkPendingElements = function () { for (; this.pendingElements.length;) { this.pendingElements.pop().checkParenting() } }, CanvasRenderer.prototype.hide = function () { this.animationItem.container.style.display = "none" }, CanvasRenderer.prototype.show = function () { this.animationItem.container.style.display = "block" }, extendPrototype([BaseRenderer], HybridRenderer), HybridRenderer.prototype.buildItem = SVGRenderer.prototype.buildItem, HybridRenderer.prototype.checkPendingElements = function () { for (; this.pendingElements.length;) { this.pendingElements.pop().checkParenting() } }, HybridRenderer.prototype.appendElementInPos = function (t, e) { var r = t.getBaseElement(); if (r) { var i = this.layers[e]; if (i.ddd && this.supports3d) this.addTo3dContainer(r, e); else if (this.threeDElements) this.addTo3dContainer(r, e); else { for (var s, a, n = 0; n < e;)this.elements[n] && !0 !== this.elements[n] && this.elements[n].getBaseElement && (a = this.elements[n], s = (this.layers[n].ddd ? this.getThreeDContainerByPos(n) : a.getBaseElement()) || s), n += 1; s ? i.ddd && this.supports3d || this.layerElement.insertBefore(r, s) : i.ddd && this.supports3d || this.layerElement.appendChild(r) } } }, HybridRenderer.prototype.createShape = function (t) { return this.supports3d ? new HShapeElement(t, this.globalData, this) : new SVGShapeElement(t, this.globalData, this) }, HybridRenderer.prototype.createText = function (t) { return this.supports3d ? new HTextElement(t, this.globalData, this) : new SVGTextElement(t, this.globalData, this) }, HybridRenderer.prototype.createCamera = function (t) { return this.camera = new HCameraElement(t, this.globalData, this), this.camera }, HybridRenderer.prototype.createImage = function (t) { return this.supports3d ? new HImageElement(t, this.globalData, this) : new IImageElement(t, this.globalData, this) }, HybridRenderer.prototype.createComp = function (t) { return this.supports3d ? new HCompElement(t, this.globalData, this) : new SVGCompElement(t, this.globalData, this) }, HybridRenderer.prototype.createSolid = function (t) { return this.supports3d ? new HSolidElement(t, this.globalData, this) : new ISolidElement(t, this.globalData, this) }, HybridRenderer.prototype.createNull = SVGRenderer.prototype.createNull, HybridRenderer.prototype.getThreeDContainerByPos = function (t) { for (var e = 0, r = this.threeDElements.length; e < r;) { if (this.threeDElements[e].startPos <= t && this.threeDElements[e].endPos >= t) return this.threeDElements[e].perspectiveElem; e += 1 } }, HybridRenderer.prototype.createThreeDContainer = function (t, e) { var r = createTag("div"); styleDiv(r); var i = createTag("div"); styleDiv(i), "3d" === e && (r.style.width = this.globalData.compSize.w + "px", r.style.height = this.globalData.compSize.h + "px", r.style.transformOrigin = r.style.mozTransformOrigin = r.style.webkitTransformOrigin = "50% 50%", i.style.transform = i.style.webkitTransform = "matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)"), r.appendChild(i); var s = { container: i, perspectiveElem: r, startPos: t, endPos: t, type: e }; return this.threeDElements.push(s), s }, HybridRenderer.prototype.build3dContainers = function () { var t, e, r = this.layers.length, i = ""; for (t = 0; t < r; t += 1)this.layers[t].ddd && 3 !== this.layers[t].ty ? "3d" !== i && (i = "3d", e = this.createThreeDContainer(t, "3d")) : "2d" !== i && (i = "2d", e = this.createThreeDContainer(t, "2d")), e.endPos = Math.max(e.endPos, t); for (t = (r = this.threeDElements.length) - 1; 0 <= t; t--)this.resizerElem.appendChild(this.threeDElements[t].perspectiveElem) }, HybridRenderer.prototype.addTo3dContainer = function (t, e) { for (var r = 0, i = this.threeDElements.length; r < i;) { if (e <= this.threeDElements[r].endPos) { for (var s, a = this.threeDElements[r].startPos; a < e;)this.elements[a] && this.elements[a].getBaseElement && (s = this.elements[a].getBaseElement()), a += 1; s ? this.threeDElements[r].container.insertBefore(t, s) : this.threeDElements[r].container.appendChild(t); break } r += 1 } }, HybridRenderer.prototype.configAnimation = function (t) { var e = createTag("div"), r = this.animationItem.wrapper; e.style.width = t.w + "px", e.style.height = t.h + "px", styleDiv(this.resizerElem = e), e.style.transformStyle = e.style.webkitTransformStyle = e.style.mozTransformStyle = "flat", this.renderConfig.className && e.setAttribute("class", this.renderConfig.className), r.appendChild(e), e.style.overflow = "hidden"; var i = createNS("svg"); i.setAttribute("width", "1"), i.setAttribute("height", "1"), styleDiv(i), this.resizerElem.appendChild(i); var s = createNS("defs"); i.appendChild(s), this.data = t, this.setupGlobalData(t, i), this.globalData.defs = s, this.layers = t.layers, this.layerElement = this.resizerElem, this.build3dContainers(), this.updateContainerSize() }, HybridRenderer.prototype.destroy = function () { this.animationItem.wrapper.innerHTML = "", this.animationItem.container = null, this.globalData.defs = null; var t, e = this.layers ? this.layers.length : 0; for (t = 0; t < e; t++)this.elements[t].destroy(); this.elements.length = 0, this.destroyed = !0, this.animationItem = null }, HybridRenderer.prototype.updateContainerSize = function () { var t, e, r, i, s = this.animationItem.wrapper.offsetWidth, a = this.animationItem.wrapper.offsetHeight; i = s / a < this.globalData.compSize.w / this.globalData.compSize.h ? (t = s / this.globalData.compSize.w, e = s / this.globalData.compSize.w, r = 0, (a - this.globalData.compSize.h * (s / this.globalData.compSize.w)) / 2) : (t = a / this.globalData.compSize.h, e = a / this.globalData.compSize.h, r = (s - this.globalData.compSize.w * (a / this.globalData.compSize.h)) / 2, 0), this.resizerElem.style.transform = this.resizerElem.style.webkitTransform = "matrix3d(" + t + ",0,0,0,0," + e + ",0,0,0,0,1,0," + r + "," + i + ",0,1)" }, HybridRenderer.prototype.renderFrame = SVGRenderer.prototype.renderFrame, HybridRenderer.prototype.hide = function () { this.resizerElem.style.display = "none" }, HybridRenderer.prototype.show = function () { this.resizerElem.style.display = "block" }, HybridRenderer.prototype.initItems = function () { if (this.buildAllItems(), this.camera) this.camera.setup(); else { var t, e = this.globalData.compSize.w, r = this.globalData.compSize.h, i = this.threeDElements.length; for (t = 0; t < i; t += 1)this.threeDElements[t].perspectiveElem.style.perspective = this.threeDElements[t].perspectiveElem.style.webkitPerspective = Math.sqrt(Math.pow(e, 2) + Math.pow(r, 2)) + "px" } }, HybridRenderer.prototype.searchExtraCompositions = function (t) { var e, r = t.length, i = createTag("div"); for (e = 0; e < r; e += 1)if (t[e].xt) { var s = this.createComp(t[e], i, this.globalData.comp, null); s.initExpressions(), this.globalData.projectInterface.registerComposition(s) } }, MaskElement.prototype.getMaskProperty = function (t) { return this.viewData[t].prop }, MaskElement.prototype.renderFrame = function (t) { var e, r = this.element.finalTransform.mat, i = this.masksProperties.length; for (e = 0; e < i; e++)if ((this.viewData[e].prop._mdf || t) && this.drawPath(this.masksProperties[e], this.viewData[e].prop.v, this.viewData[e]), (this.viewData[e].op._mdf || t) && this.viewData[e].elem.setAttribute("fill-opacity", this.viewData[e].op.v), "n" !== this.masksProperties[e].mode && (this.viewData[e].invRect && (this.element.finalTransform.mProp._mdf || t) && this.viewData[e].invRect.setAttribute("transform", r.getInverseMatrix().to2dCSS()), this.storedData[e].x && (this.storedData[e].x._mdf || t))) { var s = this.storedData[e].expan; this.storedData[e].x.v < 0 ? ("erode" !== this.storedData[e].lastOperator && (this.storedData[e].lastOperator = "erode", this.storedData[e].elem.setAttribute("filter", "url(" + locationHref + "#" + this.storedData[e].filterId + ")")), s.setAttribute("radius", -this.storedData[e].x.v)) : ("dilate" !== this.storedData[e].lastOperator && (this.storedData[e].lastOperator = "dilate", this.storedData[e].elem.setAttribute("filter", null)), this.storedData[e].elem.setAttribute("stroke-width", 2 * this.storedData[e].x.v)) } }, MaskElement.prototype.getMaskelement = function () { return this.maskElement }, MaskElement.prototype.createLayerSolidPath = function () { var t = "M0,0 "; return t += " h" + this.globalData.compSize.w, t += " v" + this.globalData.compSize.h, t += " h-" + this.globalData.compSize.w, t += " v-" + this.globalData.compSize.h + " " }, MaskElement.prototype.drawPath = function (t, e, r) { var i, s, a = " M" + e.v[0][0] + "," + e.v[0][1]; for (s = e._length, i = 1; i < s; i += 1)a += " C" + e.o[i - 1][0] + "," + e.o[i - 1][1] + " " + e.i[i][0] + "," + e.i[i][1] + " " + e.v[i][0] + "," + e.v[i][1]; if (e.c && 1 < s && (a += " C" + e.o[i - 1][0] + "," + e.o[i - 1][1] + " " + e.i[0][0] + "," + e.i[0][1] + " " + e.v[0][0] + "," + e.v[0][1]), r.lastPath !== a) { var n = ""; r.elem && (e.c && (n = t.inv ? this.solidPath + a : a), r.elem.setAttribute("d", n)), r.lastPath = a } }, MaskElement.prototype.destroy = function () { this.element = null, this.globalData = null, this.maskElement = null, this.data = null, this.masksProperties = null }, HierarchyElement.prototype = { initHierarchy: function () { this.hierarchy = [], this._isParent = !1, this.checkParenting() }, setHierarchy: function (t) { this.hierarchy = t }, setAsParent: function () { this._isParent = !0 }, checkParenting: function () { void 0 !== this.data.parent && this.comp.buildElementParenting(this, this.data.parent, []) } }, FrameElement.prototype = { initFrame: function () { this._isFirstFrame = !1, this.dynamicProperties = [], this._mdf = !1 }, prepareProperties: function (t, e) { var r, i = this.dynamicProperties.length; for (r = 0; r < i; r += 1)(e || this._isParent && "transform" === this.dynamicProperties[r].propType) && (this.dynamicProperties[r].getValue(), this.dynamicProperties[r]._mdf && (this.globalData._mdf = !0, this._mdf = !0)) }, addDynamicProperty: function (t) { -1 === this.dynamicProperties.indexOf(t) && this.dynamicProperties.push(t) } }, TransformElement.prototype = { initTransform: function () { this.finalTransform = { mProp: this.data.ks ? TransformPropertyFactory.getTransformProperty(this, this.data.ks, this) : { o: 0 }, _matMdf: !1, _opMdf: !1, mat: new Matrix }, this.data.ao && (this.finalTransform.mProp.autoOriented = !0), this.data.ty }, renderTransform: function () { if (this.finalTransform._opMdf = this.finalTransform.mProp.o._mdf || this._isFirstFrame, this.finalTransform._matMdf = this.finalTransform.mProp._mdf || this._isFirstFrame, this.hierarchy) { var t, e = this.finalTransform.mat, r = 0, i = this.hierarchy.length; if (!this.finalTransform._matMdf) for (; r < i;) { if (this.hierarchy[r].finalTransform.mProp._mdf) { this.finalTransform._matMdf = !0; break } r += 1 } if (this.finalTransform._matMdf) for (t = this.finalTransform.mProp.v.props, e.cloneFromProps(t), r = 0; r < i; r += 1)t = this.hierarchy[r].finalTransform.mProp.v.props, e.transform(t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15]) } }, globalToLocal: function (t) { var e = []; e.push(this.finalTransform); for (var r = !0, i = this.comp; r;)i.finalTransform ? (i.data.hasMask && e.splice(0, 0, i.finalTransform), i = i.comp) : r = !1; var s, a, n = e.length; for (s = 0; s < n; s += 1)a = e[s].mat.applyToPointArray(0, 0, 0), t = [t[0] - a[0], t[1] - a[1], 0]; return t }, mHelper: new Matrix }, RenderableElement.prototype = { initRenderable: function () { this.isInRange = !1, this.hidden = !1, this.isTransparent = !1, this.renderableComponents = [] }, addRenderableComponent: function (t) { -1 === this.renderableComponents.indexOf(t) && this.renderableComponents.push(t) }, removeRenderableComponent: function (t) { -1 !== this.renderableComponents.indexOf(t) && this.renderableComponents.splice(this.renderableComponents.indexOf(t), 1) }, prepareRenderableFrame: function (t) { this.checkLayerLimits(t) }, checkTransparency: function () { this.finalTransform.mProp.o.v <= 0 ? !this.isTransparent && this.globalData.renderConfig.hideOnTransparent && (this.isTransparent = !0, this.hide()) : this.isTransparent && (this.isTransparent = !1, this.show()) }, checkLayerLimits: function (t) { this.data.ip - this.data.st <= t && this.data.op - this.data.st > t ? !0 !== this.isInRange && (this.globalData._mdf = !0, this._mdf = !0, this.isInRange = !0, this.show()) : !1 !== this.isInRange && (this.globalData._mdf = !0, this.isInRange = !1, this.hide()) }, renderRenderable: function () { var t, e = this.renderableComponents.length; for (t = 0; t < e; t += 1)this.renderableComponents[t].renderFrame(this._isFirstFrame) }, sourceRectAtTime: function () { return { top: 0, left: 0, width: 100, height: 100 } }, getLayerSize: function () { return 5 === this.data.ty ? { w: this.data.textData.width, h: this.data.textData.height } : { w: this.data.width, h: this.data.height } } }, extendPrototype([RenderableElement, createProxyFunction({ initElement: function (t, e, r) { this.initFrame(), this.initBaseData(t, e, r), this.initTransform(t, e, r), this.initHierarchy(), this.initRenderable(), this.initRendererElement(), this.createContainerElements(), this.createRenderableComponents(), this.createContent(), this.hide() }, hide: function () { this.hidden || this.isInRange && !this.isTransparent || ((this.baseElement || this.layerElement).style.display = "none", this.hidden = !0) }, show: function () { this.isInRange && !this.isTransparent && (this.data.hd || ((this.baseElement || this.layerElement).style.display = "block"), this.hidden = !1, this._isFirstFrame = !0) }, renderFrame: function () { this.data.hd || this.hidden || (this.renderTransform(), this.renderRenderable(), this.renderElement(), this.renderInnerContent(), this._isFirstFrame && (this._isFirstFrame = !1)) }, renderInnerContent: function () { }, prepareFrame: function (t) { this._mdf = !1, this.prepareRenderableFrame(t), this.prepareProperties(t, this.isInRange), this.checkTransparency() }, destroy: function () { this.innerElem = null, this.destroyBaseElement() } })], RenderableDOMElement), SVGStyleData.prototype.reset = function () { this.d = "", this._mdf = !1 }, SVGShapeData.prototype.setAsAnimated = function () { this._isAnimated = !0 }, extendPrototype([DynamicPropertyContainer], SVGStrokeStyleData), extendPrototype([DynamicPropertyContainer], SVGFillStyleData), SVGGradientFillStyleData.prototype.initGradientData = function (t, e, r) { this.o = PropertyFactory.getProp(t, e.o, 0, .01, this), this.s = PropertyFactory.getProp(t, e.s, 1, null, this), this.e = PropertyFactory.getProp(t, e.e, 1, null, this), this.h = PropertyFactory.getProp(t, e.h || { k: 0 }, 0, .01, this), this.a = PropertyFactory.getProp(t, e.a || { k: 0 }, 0, degToRads, this), this.g = new GradientProperty(t, e.g, this), this.style = r, this.stops = [], this.setGradientData(r.pElem, e), this.setGradientOpacity(e, r), this._isAnimated = !!this._isAnimated }, SVGGradientFillStyleData.prototype.setGradientData = function (t, e) { var r = createElementID(), i = createNS(1 === e.t ? "linearGradient" : "radialGradient"); i.setAttribute("id", r), i.setAttribute("spreadMethod", "pad"), i.setAttribute("gradientUnits", "userSpaceOnUse"); var s, a, n, o = []; for (n = 4 * e.g.p, a = 0; a < n; a += 4)s = createNS("stop"), i.appendChild(s), o.push(s); t.setAttribute("gf" === e.ty ? "fill" : "stroke", "url(" + locationHref + "#" + r + ")"), this.gf = i, this.cst = o }, SVGGradientFillStyleData.prototype.setGradientOpacity = function (t, e) { if (this.g._hasOpacity && !this.g._collapsable) { var r, i, s, a = createNS("mask"), n = createNS("path"); a.appendChild(n); var o = createElementID(), h = createElementID(); a.setAttribute("id", h); var l = createNS(1 === t.t ? "linearGradient" : "radialGradient"); l.setAttribute("id", o), l.setAttribute("spreadMethod", "pad"), l.setAttribute("gradientUnits", "userSpaceOnUse"), s = t.g.k.k[0].s ? t.g.k.k[0].s.length : t.g.k.k.length; var p = this.stops; for (i = 4 * t.g.p; i < s; i += 2)(r = createNS("stop")).setAttribute("stop-color", "rgb(255,255,255)"), l.appendChild(r), p.push(r); n.setAttribute("gf" === t.ty ? "fill" : "stroke", "url(" + locationHref + "#" + o + ")"), this.of = l, this.ms = a, this.ost = p, this.maskId = h, e.msElem = n } }, extendPrototype([DynamicPropertyContainer], SVGGradientFillStyleData), extendPrototype([SVGGradientFillStyleData, DynamicPropertyContainer], SVGGradientStrokeStyleData); var SVGElementsRenderer = function () { var y = new Matrix, g = new Matrix; function e(t, e, r) { (r || e.transform.op._mdf) && e.transform.container.setAttribute("opacity", e.transform.op.v), (r || e.transform.mProps._mdf) && e.transform.container.setAttribute("transform", e.transform.mProps.v.to2dCSS()) } function r(t, e, r) { var i, s, a, n, o, h, l, p, m, f, c, d = e.styles.length, u = e.lvl; for (h = 0; h < d; h += 1) { if (n = e.sh._mdf || r, e.styles[h].lvl < u) { for (p = g.reset(), f = u - e.styles[h].lvl, c = e.transformers.length - 1; !n && 0 < f;)n = e.transformers[c].mProps._mdf || n, f--, c--; if (n) for (f = u - e.styles[h].lvl, c = e.transformers.length - 1; 0 < f;)m = e.transformers[c].mProps.v.props, p.transform(m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9], m[10], m[11], m[12], m[13], m[14], m[15]), f--, c-- } else p = y; if (s = (l = e.sh.paths)._length, n) { for (a = "", i = 0; i < s; i += 1)(o = l.shapes[i]) && o._length && (a += buildShapeString(o, o._length, o.c, p)); e.caches[h] = a } else a = e.caches[h]; e.styles[h].d += !0 === t.hd ? "" : a, e.styles[h]._mdf = n || e.styles[h]._mdf } } function i(t, e, r) { var i = e.style; (e.c._mdf || r) && i.pElem.setAttribute("fill", "rgb(" + bm_floor(e.c.v[0]) + "," + bm_floor(e.c.v[1]) + "," + bm_floor(e.c.v[2]) + ")"), (e.o._mdf || r) && i.pElem.setAttribute("fill-opacity", e.o.v) } function s(t, e, r) { a(t, e, r), n(t, e, r) } function a(t, e, r) { var i, s, a, n, o, h = e.gf, l = e.g._hasOpacity, p = e.s.v, m = e.e.v; if (e.o._mdf || r) { var f = "gf" === t.ty ? "fill-opacity" : "stroke-opacity"; e.style.pElem.setAttribute(f, e.o.v) } if (e.s._mdf || r) { var c = 1 === t.t ? "x1" : "cx", d = "x1" === c ? "y1" : "cy"; h.setAttribute(c, p[0]), h.setAttribute(d, p[1]), l && !e.g._collapsable && (e.of.setAttribute(c, p[0]), e.of.setAttribute(d, p[1])) } if (e.g._cmdf || r) { i = e.cst; var u = e.g.c; for (a = i.length, s = 0; s < a; s += 1)(n = i[s]).setAttribute("offset", u[4 * s] + "%"), n.setAttribute("stop-color", "rgb(" + u[4 * s + 1] + "," + u[4 * s + 2] + "," + u[4 * s + 3] + ")") } if (l && (e.g._omdf || r)) { var y = e.g.o; for (a = (i = e.g._collapsable ? e.cst : e.ost).length, s = 0; s < a; s += 1)n = i[s], e.g._collapsable || n.setAttribute("offset", y[2 * s] + "%"), n.setAttribute("stop-opacity", y[2 * s + 1]) } if (1 === t.t) (e.e._mdf || r) && (h.setAttribute("x2", m[0]), h.setAttribute("y2", m[1]), l && !e.g._collapsable && (e.of.setAttribute("x2", m[0]), e.of.setAttribute("y2", m[1]))); else if ((e.s._mdf || e.e._mdf || r) && (o = Math.sqrt(Math.pow(p[0] - m[0], 2) + Math.pow(p[1] - m[1], 2)), h.setAttribute("r", o), l && !e.g._collapsable && e.of.setAttribute("r", o)), e.e._mdf || e.h._mdf || e.a._mdf || r) { o || (o = Math.sqrt(Math.pow(p[0] - m[0], 2) + Math.pow(p[1] - m[1], 2))); var g = Math.atan2(m[1] - p[1], m[0] - p[0]), v = o * (1 <= e.h.v ? .99 : e.h.v <= -1 ? -.99 : e.h.v), b = Math.cos(g + e.a.v) * v + p[0], E = Math.sin(g + e.a.v) * v + p[1]; h.setAttribute("fx", b), h.setAttribute("fy", E), l && !e.g._collapsable && (e.of.setAttribute("fx", b), e.of.setAttribute("fy", E)) } } function n(t, e, r) { var i = e.style, s = e.d; s && (s._mdf || r) && s.dashStr && (i.pElem.setAttribute("stroke-dasharray", s.dashStr), i.pElem.setAttribute("stroke-dashoffset", s.dashoffset[0])), e.c && (e.c._mdf || r) && i.pElem.setAttribute("stroke", "rgb(" + bm_floor(e.c.v[0]) + "," + bm_floor(e.c.v[1]) + "," + bm_floor(e.c.v[2]) + ")"), (e.o._mdf || r) && i.pElem.setAttribute("stroke-opacity", e.o.v), (e.w._mdf || r) && (i.pElem.setAttribute("stroke-width", e.w.v), i.msElem && i.msElem.setAttribute("stroke-width", e.w.v)) } return { createRenderFunction: function (t) { t.ty; switch (t.ty) { case "fl": return i; case "gf": return a; case "gs": return s; case "st": return n; case "sh": case "el": case "rc": case "sr": return r; case "tr": return e } } } }(); function ShapeTransformManager() { this.sequences = {}, this.sequenceList = [], this.transform_key_count = 0 } function CVShapeData(t, e, r, i) { this.styledShapes = [], this.tr = [0, 0, 0, 0, 0, 0]; var s = 4; "rc" == e.ty ? s = 5 : "el" == e.ty ? s = 6 : "sr" == e.ty && (s = 7), this.sh = ShapePropertyFactory.getShapeProp(t, e, s, t); var a, n, o = r.length; for (a = 0; a < o; a += 1)r[a].closed || (n = { transforms: i.addTransformSequence(r[a].transforms), trNodes: [] }, this.styledShapes.push(n), r[a].elements.push(n)) } function BaseElement() { } function NullElement(t, e, r) { this.initFrame(), this.initBaseData(t, e, r), this.initFrame(), this.initTransform(t, e, r), this.initHierarchy() } function SVGBaseElement() { } function IShapeElement() { } function ITextElement() { } function ICompElement() { } function IImageElement(t, e, r) { this.assetData = e.getAssetData(t.refId), this.initElement(t, e, r), this.sourceRect = { top: 0, left: 0, width: this.assetData.w, height: this.assetData.h } } function ISolidElement(t, e, r) { this.initElement(t, e, r) } function SVGCompElement(t, e, r) { this.layers = t.layers, this.supports3d = !0, this.completeLayers = !1, this.pendingElements = [], this.elements = this.layers ? createSizedArray(this.layers.length) : [], this.initElement(t, e, r), this.tm = t.tm ? PropertyFactory.getProp(this, t.tm, 0, e.frameRate, this) : { _placeholder: !0 } } function SVGTextElement(t, e, r) { this.textSpans = [], this.renderType = "svg", this.initElement(t, e, r) } function SVGShapeElement(t, e, r) { this.shapes = [], this.shapesData = t.shapes, this.stylesList = [], this.shapeModifiers = [], this.itemsData = [], this.processedElements = [], this.animatedContents = [], this.initElement(t, e, r), this.prevViewData = [] } function SVGTintFilter(t, e) { this.filterManager = e; var r = createNS("feColorMatrix"); if (r.setAttribute("type", "matrix"), r.setAttribute("color-interpolation-filters", "linearRGB"), r.setAttribute("values", "0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"), r.setAttribute("result", "f1"), t.appendChild(r), (r = createNS("feColorMatrix")).setAttribute("type", "matrix"), r.setAttribute("color-interpolation-filters", "sRGB"), r.setAttribute("values", "1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"), r.setAttribute("result", "f2"), t.appendChild(r), this.matrixFilter = r, 100 !== e.effectElements[2].p.v || e.effectElements[2].p.k) { var i, s = createNS("feMerge"); t.appendChild(s), (i = createNS("feMergeNode")).setAttribute("in", "SourceGraphic"), s.appendChild(i), (i = createNS("feMergeNode")).setAttribute("in", "f2"), s.appendChild(i) } } function SVGFillFilter(t, e) { this.filterManager = e; var r = createNS("feColorMatrix"); r.setAttribute("type", "matrix"), r.setAttribute("color-interpolation-filters", "sRGB"), r.setAttribute("values", "1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"), t.appendChild(r), this.matrixFilter = r } function SVGGaussianBlurEffect(t, e) { t.setAttribute("x", "-100%"), t.setAttribute("y", "-100%"), t.setAttribute("width", "300%"), t.setAttribute("height", "300%"), this.filterManager = e; var r = createNS("feGaussianBlur"); t.appendChild(r), this.feGaussianBlur = r } function SVGStrokeEffect(t, e) { this.initialized = !1, this.filterManager = e, this.elem = t, this.paths = [] } function SVGTritoneFilter(t, e) { this.filterManager = e; var r = createNS("feColorMatrix"); r.setAttribute("type", "matrix"), r.setAttribute("color-interpolation-filters", "linearRGB"), r.setAttribute("values", "0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"), r.setAttribute("result", "f1"), t.appendChild(r); var i = createNS("feComponentTransfer"); i.setAttribute("color-interpolation-filters", "sRGB"), t.appendChild(i), this.matrixFilter = i; var s = createNS("feFuncR"); s.setAttribute("type", "table"), i.appendChild(s), this.feFuncR = s; var a = createNS("feFuncG"); a.setAttribute("type", "table"), i.appendChild(a), this.feFuncG = a; var n = createNS("feFuncB"); n.setAttribute("type", "table"), i.appendChild(n), this.feFuncB = n } function SVGProLevelsFilter(t, e) { this.filterManager = e; var r = this.filterManager.effectElements, i = createNS("feComponentTransfer"); (r[10].p.k || 0 !== r[10].p.v || r[11].p.k || 1 !== r[11].p.v || r[12].p.k || 1 !== r[12].p.v || r[13].p.k || 0 !== r[13].p.v || r[14].p.k || 1 !== r[14].p.v) && (this.feFuncR = this.createFeFunc("feFuncR", i)), (r[17].p.k || 0 !== r[17].p.v || r[18].p.k || 1 !== r[18].p.v || r[19].p.k || 1 !== r[19].p.v || r[20].p.k || 0 !== r[20].p.v || r[21].p.k || 1 !== r[21].p.v) && (this.feFuncG = this.createFeFunc("feFuncG", i)), (r[24].p.k || 0 !== r[24].p.v || r[25].p.k || 1 !== r[25].p.v || r[26].p.k || 1 !== r[26].p.v || r[27].p.k || 0 !== r[27].p.v || r[28].p.k || 1 !== r[28].p.v) && (this.feFuncB = this.createFeFunc("feFuncB", i)), (r[31].p.k || 0 !== r[31].p.v || r[32].p.k || 1 !== r[32].p.v || r[33].p.k || 1 !== r[33].p.v || r[34].p.k || 0 !== r[34].p.v || r[35].p.k || 1 !== r[35].p.v) && (this.feFuncA = this.createFeFunc("feFuncA", i)), (this.feFuncR || this.feFuncG || this.feFuncB || this.feFuncA) && (i.setAttribute("color-interpolation-filters", "sRGB"), t.appendChild(i), i = createNS("feComponentTransfer")), (r[3].p.k || 0 !== r[3].p.v || r[4].p.k || 1 !== r[4].p.v || r[5].p.k || 1 !== r[5].p.v || r[6].p.k || 0 !== r[6].p.v || r[7].p.k || 1 !== r[7].p.v) && (i.setAttribute("color-interpolation-filters", "sRGB"), t.appendChild(i), this.feFuncRComposed = this.createFeFunc("feFuncR", i), this.feFuncGComposed = this.createFeFunc("feFuncG", i), this.feFuncBComposed = this.createFeFunc("feFuncB", i)) } function SVGDropShadowEffect(t, e) { t.setAttribute("x", "-100%"), t.setAttribute("y", "-100%"), t.setAttribute("width", "400%"), t.setAttribute("height", "400%"), this.filterManager = e; var r = createNS("feGaussianBlur"); r.setAttribute("in", "SourceAlpha"), r.setAttribute("result", "drop_shadow_1"), r.setAttribute("stdDeviation", "0"), this.feGaussianBlur = r, t.appendChild(r); var i = createNS("feOffset"); i.setAttribute("dx", "25"), i.setAttribute("dy", "0"), i.setAttribute("in", "drop_shadow_1"), i.setAttribute("result", "drop_shadow_2"), this.feOffset = i, t.appendChild(i); var s = createNS("feFlood"); s.setAttribute("flood-color", "#00ff00"), s.setAttribute("flood-opacity", "1"), s.setAttribute("result", "drop_shadow_3"), this.feFlood = s, t.appendChild(s); var a = createNS("feComposite"); a.setAttribute("in", "drop_shadow_3"), a.setAttribute("in2", "drop_shadow_2"), a.setAttribute("operator", "in"), a.setAttribute("result", "drop_shadow_4"), t.appendChild(a); var n, o = createNS("feMerge"); t.appendChild(o), n = createNS("feMergeNode"), o.appendChild(n), (n = createNS("feMergeNode")).setAttribute("in", "SourceGraphic"), this.feMergeNode = n, this.feMerge = o, this.originalNodeAdded = !1, o.appendChild(n) } ShapeTransformManager.prototype = { addTransformSequence: function (t) { var e, r = t.length, i = "_"; for (e = 0; e < r; e += 1)i += t[e].transform.key + "_"; var s = this.sequences[i]; return s || (s = { transforms: [].concat(t), finalTransform: new Matrix, _mdf: !1 }, this.sequences[i] = s, this.sequenceList.push(s)), s }, processSequence: function (t, e) { for (var r, i = 0, s = t.transforms.length, a = e; i < s && !e;) { if (t.transforms[i].transform.mProps._mdf) { a = !0; break } i += 1 } if (a) for (t.finalTransform.reset(), i = s - 1; 0 <= i; i -= 1)r = t.transforms[i].transform.mProps.v.props, t.finalTransform.transform(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], r[11], r[12], r[13], r[14], r[15]); t._mdf = a }, processSequences: function (t) { var e, r = this.sequenceList.length; for (e = 0; e < r; e += 1)this.processSequence(this.sequenceList[e], t) }, getNewKey: function () { return "_" + this.transform_key_count++ } }, CVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated, BaseElement.prototype = { checkMasks: function () { if (!this.data.hasMask) return !1; for (var t = 0, e = this.data.masksProperties.length; t < e;) { if ("n" !== this.data.masksProperties[t].mode && !1 !== this.data.masksProperties[t].cl) return !0; t += 1 } return !1 }, initExpressions: function () { this.layerInterface = LayerExpressionInterface(this), this.data.hasMask && this.maskManager && this.layerInterface.registerMaskInterface(this.maskManager); var t = EffectsExpressionInterface.createEffectsInterface(this, this.layerInterface); this.layerInterface.registerEffectsInterface(t), 0 === this.data.ty || this.data.xt ? this.compInterface = CompExpressionInterface(this) : 4 === this.data.ty ? (this.layerInterface.shapeInterface = ShapeExpressionInterface(this.shapesData, this.itemsData, this.layerInterface), this.layerInterface.content = this.layerInterface.shapeInterface) : 5 === this.data.ty && (this.layerInterface.textInterface = TextExpressionInterface(this), this.layerInterface.text = this.layerInterface.textInterface) }, setBlendMode: function () { var t = getBlendMode(this.data.bm); (this.baseElement || this.layerElement).style["mix-blend-mode"] = t }, initBaseData: function (t, e, r) { this.globalData = e, this.comp = r, this.data = t, this.layerId = createElementID(), this.data.sr || (this.data.sr = 1), this.effectsManager = new EffectsManager(this.data, this, this.dynamicProperties) }, getType: function () { return this.type }, sourceRectAtTime: function () { } }, NullElement.prototype.prepareFrame = function (t) { this.prepareProperties(t, !0) }, NullElement.prototype.renderFrame = function () { }, NullElement.prototype.getBaseElement = function () { return null }, NullElement.prototype.destroy = function () { }, NullElement.prototype.sourceRectAtTime = function () { }, NullElement.prototype.hide = function () { }, extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement], NullElement), SVGBaseElement.prototype = { initRendererElement: function () { this.layerElement = createNS("g") }, createContainerElements: function () { this.matteElement = createNS("g"), this.transformedElement = this.layerElement, this.maskedElement = this.layerElement, this._sizeChanged = !1; var t, e, r, i = null; if (this.data.td) { if (3 == this.data.td || 1 == this.data.td) { var s = createNS("mask"); s.setAttribute("id", this.layerId), s.setAttribute("mask-type", 3 == this.data.td ? "luminance" : "alpha"), s.appendChild(this.layerElement), i = s, this.globalData.defs.appendChild(s), featureSupport.maskType || 1 != this.data.td || (s.setAttribute("mask-type", "luminance"), t = createElementID(), e = filtersFactory.createFilter(t), this.globalData.defs.appendChild(e), e.appendChild(filtersFactory.createAlphaToLuminanceFilter()), (r = createNS("g")).appendChild(this.layerElement), i = r, s.appendChild(r), r.setAttribute("filter", "url(" + locationHref + "#" + t + ")")) } else if (2 == this.data.td) { var a = createNS("mask"); a.setAttribute("id", this.layerId), a.setAttribute("mask-type", "alpha"); var n = createNS("g"); a.appendChild(n), t = createElementID(), e = filtersFactory.createFilter(t); var o = createNS("feComponentTransfer"); o.setAttribute("in", "SourceGraphic"), e.appendChild(o); var h = createNS("feFuncA"); h.setAttribute("type", "table"), h.setAttribute("tableValues", "1.0 0.0"), o.appendChild(h), this.globalData.defs.appendChild(e); var l = createNS("rect"); l.setAttribute("width", this.comp.data.w), l.setAttribute("height", this.comp.data.h), l.setAttribute("x", "0"), l.setAttribute("y", "0"), l.setAttribute("fill", "#ffffff"), l.setAttribute("opacity", "0"), n.setAttribute("filter", "url(" + locationHref + "#" + t + ")"), n.appendChild(l), n.appendChild(this.layerElement), i = n, featureSupport.maskType || (a.setAttribute("mask-type", "luminance"), e.appendChild(filtersFactory.createAlphaToLuminanceFilter()), r = createNS("g"), n.appendChild(l), r.appendChild(this.layerElement), i = r, n.appendChild(r)), this.globalData.defs.appendChild(a) } } else this.data.tt ? (this.matteElement.appendChild(this.layerElement), i = this.matteElement, this.baseElement = this.matteElement) : this.baseElement = this.layerElement; if (this.data.ln && this.layerElement.setAttribute("id", this.data.ln), this.data.cl && this.layerElement.setAttribute("class", this.data.cl), 0 === this.data.ty && !this.data.hd) { var p = createNS("clipPath"), m = createNS("path"); m.setAttribute("d", "M0,0 L" + this.data.w + ",0 L" + this.data.w + "," + this.data.h + " L0," + this.data.h + "z"); var f = createElementID(); if (p.setAttribute("id", f), p.appendChild(m), this.globalData.defs.appendChild(p), this.checkMasks()) { var c = createNS("g"); c.setAttribute("clip-path", "url(" + locationHref + "#" + f + ")"), c.appendChild(this.layerElement), this.transformedElement = c, i ? i.appendChild(this.transformedElement) : this.baseElement = this.transformedElement } else this.layerElement.setAttribute("clip-path", "url(" + locationHref + "#" + f + ")") } 0 !== this.data.bm && this.setBlendMode() }, renderElement: function () { this.finalTransform._matMdf && this.transformedElement.setAttribute("transform", this.finalTransform.mat.to2dCSS()), this.finalTransform._opMdf && this.transformedElement.setAttribute("opacity", this.finalTransform.mProp.o.v) }, destroyBaseElement: function () { this.layerElement = null, this.matteElement = null, this.maskManager.destroy() }, getBaseElement: function () { return this.data.hd ? null : this.baseElement }, createRenderableComponents: function () { this.maskManager = new MaskElement(this.data, this, this.globalData), this.renderableEffectsManager = new SVGEffects(this) }, setMatte: function (t) { this.matteElement && this.matteElement.setAttribute("mask", "url(" + locationHref + "#" + t + ")") } }, IShapeElement.prototype = { addShapeToModifiers: function (t) { var e, r = this.shapeModifiers.length; for (e = 0; e < r; e += 1)this.shapeModifiers[e].addShape(t) }, isShapeInAnimatedModifiers: function (t) { for (var e = this.shapeModifiers.length; 0 < e;)if (this.shapeModifiers[0].isAnimatedWithShape(t)) return !0; return !1 }, renderModifiers: function () { if (this.shapeModifiers.length) { var t, e = this.shapes.length; for (t = 0; t < e; t += 1)this.shapes[t].sh.reset(); for (t = (e = this.shapeModifiers.length) - 1; 0 <= t; t -= 1)this.shapeModifiers[t].processShapes(this._isFirstFrame) } }, lcEnum: { 1: "butt", 2: "round", 3: "square" }, ljEnum: { 1: "miter", 2: "round", 3: "bevel" }, searchProcessedElement: function (t) { for (var e = this.processedElements, r = 0, i = e.length; r < i;) { if (e[r].elem === t) return e[r].pos; r += 1 } return 0 }, addProcessedElement: function (t, e) { for (var r = this.processedElements, i = r.length; i;)if (r[i -= 1].elem === t) return void (r[i].pos = e); r.push(new ProcessedElement(t, e)) }, prepareFrame: function (t) { this.prepareRenderableFrame(t), this.prepareProperties(t, this.isInRange) } }, ITextElement.prototype.initElement = function (t, e, r) { this.lettersChangedFlag = !0, this.initFrame(), this.initBaseData(t, e, r), this.textProperty = new TextProperty(this, t.t, this.dynamicProperties), this.textAnimator = new TextAnimatorProperty(t.t, this.renderType, this), this.initTransform(t, e, r), this.initHierarchy(), this.initRenderable(), this.initRendererElement(), this.createContainerElements(), this.createRenderableComponents(), this.createContent(), this.hide(), this.textAnimator.searchProperties(this.dynamicProperties) }, ITextElement.prototype.prepareFrame = function (t) { this._mdf = !1, this.prepareRenderableFrame(t), this.prepareProperties(t, this.isInRange), (this.textProperty._mdf || this.textProperty._isFirstFrame) && (this.buildNewText(), this.textProperty._isFirstFrame = !1, this.textProperty._mdf = !1) }, ITextElement.prototype.createPathShape = function (t, e) { var r, i, s = e.length, a = ""; for (r = 0; r < s; r += 1)i = e[r].ks.k, a += buildShapeString(i, i.i.length, !0, t); return a }, ITextElement.prototype.updateDocumentData = function (t, e) { this.textProperty.updateDocumentData(t, e) }, ITextElement.prototype.canResizeFont = function (t) { this.textProperty.canResizeFont(t) }, ITextElement.prototype.setMinimumFontSize = function (t) { this.textProperty.setMinimumFontSize(t) }, ITextElement.prototype.applyTextPropertiesToMatrix = function (t, e, r, i, s) { switch (t.ps && e.translate(t.ps[0], t.ps[1] + t.ascent, 0), e.translate(0, -t.ls, 0), t.j) { case 1: e.translate(t.justifyOffset + (t.boxWidth - t.lineWidths[r]), 0, 0); break; case 2: e.translate(t.justifyOffset + (t.boxWidth - t.lineWidths[r]) / 2, 0, 0) }e.translate(i, s, 0) }, ITextElement.prototype.buildColor = function (t) { return "rgb(" + Math.round(255 * t[0]) + "," + Math.round(255 * t[1]) + "," + Math.round(255 * t[2]) + ")" }, ITextElement.prototype.emptyProp = new LetterProps, ITextElement.prototype.destroy = function () { }, extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement], ICompElement), ICompElement.prototype.initElement = function (t, e, r) { this.initFrame(), this.initBaseData(t, e, r), this.initTransform(t, e, r), this.initRenderable(), this.initHierarchy(), this.initRendererElement(), this.createContainerElements(), this.createRenderableComponents(), !this.data.xt && e.progressiveLoad || this.buildAllItems(), this.hide() }, ICompElement.prototype.prepareFrame = function (t) { if (this._mdf = !1, this.prepareRenderableFrame(t), this.prepareProperties(t, this.isInRange), this.isInRange || this.data.xt) { if (this.tm._placeholder) this.renderedFrame = t / this.data.sr; else { var e = this.tm.v; e === this.data.op && (e = this.data.op - 1), this.renderedFrame = e } var r, i = this.elements.length; for (this.completeLayers || this.checkLayers(this.renderedFrame), r = i - 1; 0 <= r; r -= 1)(this.completeLayers || this.elements[r]) && (this.elements[r].prepareFrame(this.renderedFrame - this.layers[r].st), this.elements[r]._mdf && (this._mdf = !0)) } }, ICompElement.prototype.renderInnerContent = function () { var t, e = this.layers.length; for (t = 0; t < e; t += 1)(this.completeLayers || this.elements[t]) && this.elements[t].renderFrame() }, ICompElement.prototype.setElements = function (t) { this.elements = t }, ICompElement.prototype.getElements = function () { return this.elements }, ICompElement.prototype.destroyElements = function () { var t, e = this.layers.length; for (t = 0; t < e; t += 1)this.elements[t] && this.elements[t].destroy() }, ICompElement.prototype.destroy = function () { this.destroyElements(), this.destroyBaseElement() }, extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], IImageElement), IImageElement.prototype.createContent = function () { var t = this.globalData.getAssetsPath(this.assetData); this.innerElem = createNS("image"), this.innerElem.setAttribute("width", this.assetData.w + "px"), this.innerElem.setAttribute("height", this.assetData.h + "px"), this.innerElem.setAttribute("preserveAspectRatio", this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio), this.innerElem.setAttributeNS("http://www.w3.org/1999/xlink", "href", t), this.layerElement.appendChild(this.innerElem) }, IImageElement.prototype.sourceRectAtTime = function () { return this.sourceRect }, extendPrototype([IImageElement], ISolidElement), ISolidElement.prototype.createContent = function () { var t = createNS("rect"); t.setAttribute("width", this.data.sw), t.setAttribute("height", this.data.sh), t.setAttribute("fill", this.data.sc), this.layerElement.appendChild(t) }, extendPrototype([SVGRenderer, ICompElement, SVGBaseElement], SVGCompElement), extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], SVGTextElement), SVGTextElement.prototype.createContent = function () { this.data.singleShape && !this.globalData.fontManager.chars && (this.textContainer = createNS("text")) }, SVGTextElement.prototype.buildTextContents = function (t) { for (var e = 0, r = t.length, i = [], s = ""; e < r;)t[e] === String.fromCharCode(13) || t[e] === String.fromCharCode(3) ? (i.push(s), s = "") : s += t[e], e += 1; return i.push(s), i }, SVGTextElement.prototype.buildNewText = function () { var t, e, r = this.textProperty.currentData; this.renderedLetters = createSizedArray(r ? r.l.length : 0), r.fc ? this.layerElement.setAttribute("fill", this.buildColor(r.fc)) : this.layerElement.setAttribute("fill", "rgba(0,0,0,0)"), r.sc && (this.layerElement.setAttribute("stroke", this.buildColor(r.sc)), this.layerElement.setAttribute("stroke-width", r.sw)), this.layerElement.setAttribute("font-size", r.finalSize); var i = this.globalData.fontManager.getFontByName(r.f); if (i.fClass) this.layerElement.setAttribute("class", i.fClass); else { this.layerElement.setAttribute("font-family", i.fFamily); var s = r.fWeight, a = r.fStyle; this.layerElement.setAttribute("font-style", a), this.layerElement.setAttribute("font-weight", s) } this.layerElement.setAttribute("aria-label", r.t); var n, o = r.l || [], h = !!this.globalData.fontManager.chars; e = o.length; var l, p = this.mHelper, m = "", f = this.data.singleShape, c = 0, d = 0, u = !0, y = r.tr / 1e3 * r.finalSize; if (!f || h || r.sz) { var g, v, b = this.textSpans.length; for (t = 0; t < e; t += 1)h && f && 0 !== t || (n = t < b ? this.textSpans[t] : createNS(h ? "path" : "text"), b <= t && (n.setAttribute("stroke-linecap", "butt"), n.setAttribute("stroke-linejoin", "round"), n.setAttribute("stroke-miterlimit", "4"), this.textSpans[t] = n, this.layerElement.appendChild(n)), n.style.display = "inherit"), p.reset(), p.scale(r.finalSize / 100, r.finalSize / 100), f && (o[t].n && (c = -y, d += r.yOffset, d += u ? 1 : 0, u = !1), this.applyTextPropertiesToMatrix(r, p, o[t].line, c, d), c += o[t].l || 0, c += y), h ? (l = (g = (v = this.globalData.fontManager.getCharData(r.finalText[t], i.fStyle, this.globalData.fontManager.getFontByName(r.f).fFamily)) && v.data || {}).shapes ? g.shapes[0].it : [], f ? m += this.createPathShape(p, l) : n.setAttribute("d", this.createPathShape(p, l))) : (f && n.setAttribute("transform", "translate(" + p.props[12] + "," + p.props[13] + ")"), n.textContent = o[t].val, n.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve")); f && n && n.setAttribute("d", m) } else { var E = this.textContainer, x = "start"; switch (r.j) { case 1: x = "end"; break; case 2: x = "middle" }E.setAttribute("text-anchor", x), E.setAttribute("letter-spacing", y); var P = this.buildTextContents(r.finalText); for (e = P.length, d = r.ps ? r.ps[1] + r.ascent : 0, t = 0; t < e; t += 1)(n = this.textSpans[t] || createNS("tspan")).textContent = P[t], n.setAttribute("x", 0), n.setAttribute("y", d), n.style.display = "inherit", E.appendChild(n), this.textSpans[t] = n, d += r.finalLineHeight; this.layerElement.appendChild(E) } for (; t < this.textSpans.length;)this.textSpans[t].style.display = "none", t += 1; this._sizeChanged = !0 }, SVGTextElement.prototype.sourceRectAtTime = function (t) { if (this.prepareFrame(this.comp.renderedFrame - this.data.st), this.renderInnerContent(), this._sizeChanged) { this._sizeChanged = !1; var e = this.layerElement.getBBox(); this.bbox = { top: e.y, left: e.x, width: e.width, height: e.height } } return this.bbox }, SVGTextElement.prototype.renderInnerContent = function () { if (!this.data.singleShape && (this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag), this.lettersChangedFlag || this.textAnimator.lettersChangedFlag)) { var t, e; this._sizeChanged = !0; var r, i, s = this.textAnimator.renderedLetters, a = this.textProperty.currentData.l; for (e = a.length, t = 0; t < e; t += 1)a[t].n || (r = s[t], i = this.textSpans[t], r._mdf.m && i.setAttribute("transform", r.m), r._mdf.o && i.setAttribute("opacity", r.o), r._mdf.sw && i.setAttribute("stroke-width", r.sw), r._mdf.sc && i.setAttribute("stroke", r.sc), r._mdf.fc && i.setAttribute("fill", r.fc)) } }, extendPrototype([BaseElement, TransformElement, SVGBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableDOMElement], SVGShapeElement), SVGShapeElement.prototype.initSecondaryElement = function () { }, SVGShapeElement.prototype.identityMatrix = new Matrix, SVGShapeElement.prototype.buildExpressionInterface = function () { }, SVGShapeElement.prototype.createContent = function () { this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], !0), this.filterUniqueShapes() }, SVGShapeElement.prototype.filterUniqueShapes = function () { var t, e, r, i, s = this.shapes.length, a = this.stylesList.length, n = [], o = !1; for (r = 0; r < a; r += 1) { for (i = this.stylesList[r], o = !1, t = n.length = 0; t < s; t += 1)-1 !== (e = this.shapes[t]).styles.indexOf(i) && (n.push(e), o = e._isAnimated || o); 1 < n.length && o && this.setShapesAsAnimated(n) } }, SVGShapeElement.prototype.setShapesAsAnimated = function (t) { var e, r = t.length; for (e = 0; e < r; e += 1)t[e].setAsAnimated() }, SVGShapeElement.prototype.createStyleElement = function (t, e) { var r, i = new SVGStyleData(t, e), s = i.pElem; if ("st" === t.ty) r = new SVGStrokeStyleData(this, t, i); else if ("fl" === t.ty) r = new SVGFillStyleData(this, t, i); else if ("gf" === t.ty || "gs" === t.ty) { r = new ("gf" === t.ty ? SVGGradientFillStyleData : SVGGradientStrokeStyleData)(this, t, i), this.globalData.defs.appendChild(r.gf), r.maskId && (this.globalData.defs.appendChild(r.ms), this.globalData.defs.appendChild(r.of), s.setAttribute("mask", "url(" + locationHref + "#" + r.maskId + ")")) } return "st" !== t.ty && "gs" !== t.ty || (s.setAttribute("stroke-linecap", this.lcEnum[t.lc] || "round"), s.setAttribute("stroke-linejoin", this.ljEnum[t.lj] || "round"), s.setAttribute("fill-opacity", "0"), 1 === t.lj && s.setAttribute("stroke-miterlimit", t.ml)), 2 === t.r && s.setAttribute("fill-rule", "evenodd"), t.ln && s.setAttribute("id", t.ln), t.cl && s.setAttribute("class", t.cl), t.bm && (s.style["mix-blend-mode"] = getBlendMode(t.bm)), this.stylesList.push(i), this.addToAnimatedContents(t, r), r }, SVGShapeElement.prototype.createGroupElement = function (t) { var e = new ShapeGroupData; return t.ln && e.gr.setAttribute("id", t.ln), t.cl && e.gr.setAttribute("class", t.cl), t.bm && (e.gr.style["mix-blend-mode"] = getBlendMode(t.bm)), e }, SVGShapeElement.prototype.createTransformElement = function (t, e) { var r = TransformPropertyFactory.getTransformProperty(this, t, this), i = new SVGTransformData(r, r.o, e); return this.addToAnimatedContents(t, i), i }, SVGShapeElement.prototype.createShapeElement = function (t, e, r) { var i = 4; "rc" === t.ty ? i = 5 : "el" === t.ty ? i = 6 : "sr" === t.ty && (i = 7); var s = new SVGShapeData(e, r, ShapePropertyFactory.getShapeProp(this, t, i, this)); return this.shapes.push(s), this.addShapeToModifiers(s), this.addToAnimatedContents(t, s), s }, SVGShapeElement.prototype.addToAnimatedContents = function (t, e) { for (var r = 0, i = this.animatedContents.length; r < i;) { if (this.animatedContents[r].element === e) return; r += 1 } this.animatedContents.push({ fn: SVGElementsRenderer.createRenderFunction(t), element: e, data: t }) }, SVGShapeElement.prototype.setElementStyles = function (t) { var e, r = t.styles, i = this.stylesList.length; for (e = 0; e < i; e += 1)this.stylesList[e].closed || r.push(this.stylesList[e]) }, SVGShapeElement.prototype.reloadShapes = function () { this._isFirstFrame = !0; var t, e = this.itemsData.length; for (t = 0; t < e; t += 1)this.prevViewData[t] = this.itemsData[t]; for (this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], !0), this.filterUniqueShapes(), e = this.dynamicProperties.length, t = 0; t < e; t += 1)this.dynamicProperties[t].getValue(); this.renderModifiers() }, SVGShapeElement.prototype.searchShapes = function (t, e, r, i, s, a, n) { var o, h, l, p, m, f, c = [].concat(a), d = t.length - 1, u = [], y = []; for (o = d; 0 <= o; o -= 1) { if ((f = this.searchProcessedElement(t[o])) ? e[o] = r[f - 1] : t[o]._render = n, "fl" == t[o].ty || "st" == t[o].ty || "gf" == t[o].ty || "gs" == t[o].ty) f ? e[o].style.closed = !1 : e[o] = this.createStyleElement(t[o], s), t[o]._render && i.appendChild(e[o].style.pElem), u.push(e[o].style); else if ("gr" == t[o].ty) { if (f) for (l = e[o].it.length, h = 0; h < l; h += 1)e[o].prevViewData[h] = e[o].it[h]; else e[o] = this.createGroupElement(t[o]); this.searchShapes(t[o].it, e[o].it, e[o].prevViewData, e[o].gr, s + 1, c, n), t[o]._render && i.appendChild(e[o].gr) } else "tr" == t[o].ty ? (f || (e[o] = this.createTransformElement(t[o], i)), p = e[o].transform, c.push(p)) : "sh" == t[o].ty || "rc" == t[o].ty || "el" == t[o].ty || "sr" == t[o].ty ? (f || (e[o] = this.createShapeElement(t[o], c, s)), this.setElementStyles(e[o])) : "tm" == t[o].ty || "rd" == t[o].ty || "ms" == t[o].ty ? (f ? (m = e[o]).closed = !1 : ((m = ShapeModifiers.getModifier(t[o].ty)).init(this, t[o]), e[o] = m, this.shapeModifiers.push(m)), y.push(m)) : "rp" == t[o].ty && (f ? (m = e[o]).closed = !0 : (m = ShapeModifiers.getModifier(t[o].ty), (e[o] = m).init(this, t, o, e), this.shapeModifiers.push(m), n = !1), y.push(m)); this.addProcessedElement(t[o], o + 1) } for (d = u.length, o = 0; o < d; o += 1)u[o].closed = !0; for (d = y.length, o = 0; o < d; o += 1)y[o].closed = !0 }, SVGShapeElement.prototype.renderInnerContent = function () { this.renderModifiers(); var t, e = this.stylesList.length; for (t = 0; t < e; t += 1)this.stylesList[t].reset(); for (this.renderShape(), t = 0; t < e; t += 1)(this.stylesList[t]._mdf || this._isFirstFrame) && (this.stylesList[t].msElem && (this.stylesList[t].msElem.setAttribute("d", this.stylesList[t].d), this.stylesList[t].d = "M0 0" + this.stylesList[t].d), this.stylesList[t].pElem.setAttribute("d", this.stylesList[t].d || "M0 0")) }, SVGShapeElement.prototype.renderShape = function () { var t, e, r = this.animatedContents.length; for (t = 0; t < r; t += 1)e = this.animatedContents[t], (this._isFirstFrame || e.element._isAnimated) && !0 !== e.data && e.fn(e.data, e.element, this._isFirstFrame) }, SVGShapeElement.prototype.destroy = function () { this.destroyBaseElement(), this.shapesData = null, this.itemsData = null }, SVGTintFilter.prototype.renderFrame = function (t) { if (t || this.filterManager._mdf) { var e = this.filterManager.effectElements[0].p.v, r = this.filterManager.effectElements[1].p.v, i = this.filterManager.effectElements[2].p.v / 100; this.matrixFilter.setAttribute("values", r[0] - e[0] + " 0 0 0 " + e[0] + " " + (r[1] - e[1]) + " 0 0 0 " + e[1] + " " + (r[2] - e[2]) + " 0 0 0 " + e[2] + " 0 0 0 " + i + " 0") } }, SVGFillFilter.prototype.renderFrame = function (t) { if (t || this.filterManager._mdf) { var e = this.filterManager.effectElements[2].p.v, r = this.filterManager.effectElements[6].p.v; this.matrixFilter.setAttribute("values", "0 0 0 0 " + e[0] + " 0 0 0 0 " + e[1] + " 0 0 0 0 " + e[2] + " 0 0 0 " + r + " 0") } }, SVGGaussianBlurEffect.prototype.renderFrame = function (t) { if (t || this.filterManager._mdf) { var e = .3 * this.filterManager.effectElements[0].p.v, r = this.filterManager.effectElements[1].p.v, i = 3 == r ? 0 : e, s = 2 == r ? 0 : e; this.feGaussianBlur.setAttribute("stdDeviation", i + " " + s); var a = 1 == this.filterManager.effectElements[2].p.v ? "wrap" : "duplicate"; this.feGaussianBlur.setAttribute("edgeMode", a) } }, SVGStrokeEffect.prototype.initialize = function () { var t, e, r, i, s = this.elem.layerElement.children || this.elem.layerElement.childNodes; for (1 === this.filterManager.effectElements[1].p.v ? (i = this.elem.maskManager.masksProperties.length, r = 0) : i = (r = this.filterManager.effectElements[0].p.v - 1) + 1, (e = createNS("g")).setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e.setAttribute("stroke-dashoffset", 1); r < i; r += 1)t = createNS("path"), e.appendChild(t), this.paths.push({ p: t, m: r }); if (3 === this.filterManager.effectElements[10].p.v) { var a = createNS("mask"), n = createElementID(); a.setAttribute("id", n), a.setAttribute("mask-type", "alpha"), a.appendChild(e), this.elem.globalData.defs.appendChild(a); var o = createNS("g"); for (o.setAttribute("mask", "url(" + locationHref + "#" + n + ")"); s[0];)o.appendChild(s[0]); this.elem.layerElement.appendChild(o), this.masker = a, e.setAttribute("stroke", "#fff") } else if (1 === this.filterManager.effectElements[10].p.v || 2 === this.filterManager.effectElements[10].p.v) { if (2 === this.filterManager.effectElements[10].p.v) for (s = this.elem.layerElement.children || this.elem.layerElement.childNodes; s.length;)this.elem.layerElement.removeChild(s[0]); this.elem.layerElement.appendChild(e), this.elem.layerElement.removeAttribute("mask"), e.setAttribute("stroke", "#fff") } this.initialized = !0, this.pathMasker = e }, SVGStrokeEffect.prototype.renderFrame = function (t) { this.initialized || this.initialize(); var e, r, i, s = this.paths.length; for (e = 0; e < s; e += 1)if (-1 !== this.paths[e].m && (r = this.elem.maskManager.viewData[this.paths[e].m], i = this.paths[e].p, (t || this.filterManager._mdf || r.prop._mdf) && i.setAttribute("d", r.lastPath), t || this.filterManager.effectElements[9].p._mdf || this.filterManager.effectElements[4].p._mdf || this.filterManager.effectElements[7].p._mdf || this.filterManager.effectElements[8].p._mdf || r.prop._mdf)) { var a; if (0 !== this.filterManager.effectElements[7].p.v || 100 !== this.filterManager.effectElements[8].p.v) { var n = Math.min(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) / 100, o = Math.max(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) / 100, h = i.getTotalLength(); a = "0 0 0 " + h * n + " "; var l, p = h * (o - n), m = 1 + 2 * this.filterManager.effectElements[4].p.v * this.filterManager.effectElements[9].p.v / 100, f = Math.floor(p / m); for (l = 0; l < f; l += 1)a += "1 " + 2 * this.filterManager.effectElements[4].p.v * this.filterManager.effectElements[9].p.v / 100 + " "; a += "0 " + 10 * h + " 0 0" } else a = "1 " + 2 * this.filterManager.effectElements[4].p.v * this.filterManager.effectElements[9].p.v / 100; i.setAttribute("stroke-dasharray", a) } if ((t || this.filterManager.effectElements[4].p._mdf) && this.pathMasker.setAttribute("stroke-width", 2 * this.filterManager.effectElements[4].p.v), (t || this.filterManager.effectElements[6].p._mdf) && this.pathMasker.setAttribute("opacity", this.filterManager.effectElements[6].p.v), (1 === this.filterManager.effectElements[10].p.v || 2 === this.filterManager.effectElements[10].p.v) && (t || this.filterManager.effectElements[3].p._mdf)) { var c = this.filterManager.effectElements[3].p.v; this.pathMasker.setAttribute("stroke", "rgb(" + bm_floor(255 * c[0]) + "," + bm_floor(255 * c[1]) + "," + bm_floor(255 * c[2]) + ")") } }, SVGTritoneFilter.prototype.renderFrame = function (t) { if (t || this.filterManager._mdf) { var e = this.filterManager.effectElements[0].p.v, r = this.filterManager.effectElements[1].p.v, i = this.filterManager.effectElements[2].p.v, s = i[0] + " " + r[0] + " " + e[0], a = i[1] + " " + r[1] + " " + e[1], n = i[2] + " " + r[2] + " " + e[2]; this.feFuncR.setAttribute("tableValues", s), this.feFuncG.setAttribute("tableValues", a), this.feFuncB.setAttribute("tableValues", n) } }, SVGProLevelsFilter.prototype.createFeFunc = function (t, e) { var r = createNS(t); return r.setAttribute("type", "table"), e.appendChild(r), r }, SVGProLevelsFilter.prototype.getTableValue = function (t, e, r, i, s) { for (var a, n, o = 0, h = Math.min(t, e), l = Math.max(t, e), p = Array.call(null, { length: 256 }), m = 0, f = s - i, c = e - t; o <= 256;)n = (a = o / 256) <= h ? c < 0 ? s : i : l <= a ? c < 0 ? i : s : i + f * Math.pow((a - t) / c, 1 / r), p[m++] = n, o += 256 / 255; return p.join(" ") }, SVGProLevelsFilter.prototype.renderFrame = function (t) { if (t || this.filterManager._mdf) { var e, r = this.filterManager.effectElements; this.feFuncRComposed && (t || r[3].p._mdf || r[4].p._mdf || r[5].p._mdf || r[6].p._mdf || r[7].p._mdf) && (e = this.getTableValue(r[3].p.v, r[4].p.v, r[5].p.v, r[6].p.v, r[7].p.v), this.feFuncRComposed.setAttribute("tableValues", e), this.feFuncGComposed.setAttribute("tableValues", e), this.feFuncBComposed.setAttribute("tableValues", e)), this.feFuncR && (t || r[10].p._mdf || r[11].p._mdf || r[12].p._mdf || r[13].p._mdf || r[14].p._mdf) && (e = this.getTableValue(r[10].p.v, r[11].p.v, r[12].p.v, r[13].p.v, r[14].p.v), this.feFuncR.setAttribute("tableValues", e)), this.feFuncG && (t || r[17].p._mdf || r[18].p._mdf || r[19].p._mdf || r[20].p._mdf || r[21].p._mdf) && (e = this.getTableValue(r[17].p.v, r[18].p.v, r[19].p.v, r[20].p.v, r[21].p.v), this.feFuncG.setAttribute("tableValues", e)), this.feFuncB && (t || r[24].p._mdf || r[25].p._mdf || r[26].p._mdf || r[27].p._mdf || r[28].p._mdf) && (e = this.getTableValue(r[24].p.v, r[25].p.v, r[26].p.v, r[27].p.v, r[28].p.v), this.feFuncB.setAttribute("tableValues", e)), this.feFuncA && (t || r[31].p._mdf || r[32].p._mdf || r[33].p._mdf || r[34].p._mdf || r[35].p._mdf) && (e = this.getTableValue(r[31].p.v, r[32].p.v, r[33].p.v, r[34].p.v, r[35].p.v), this.feFuncA.setAttribute("tableValues", e)) } }, SVGDropShadowEffect.prototype.renderFrame = function (t) { if (t || this.filterManager._mdf) { if ((t || this.filterManager.effectElements[4].p._mdf) && this.feGaussianBlur.setAttribute("stdDeviation", this.filterManager.effectElements[4].p.v / 4), t || this.filterManager.effectElements[0].p._mdf) { var e = this.filterManager.effectElements[0].p.v; this.feFlood.setAttribute("flood-color", rgbToHex(Math.round(255 * e[0]), Math.round(255 * e[1]), Math.round(255 * e[2]))) } if ((t || this.filterManager.effectElements[1].p._mdf) && this.feFlood.setAttribute("flood-opacity", this.filterManager.effectElements[1].p.v / 255), t || this.filterManager.effectElements[2].p._mdf || this.filterManager.effectElements[3].p._mdf) { var r = this.filterManager.effectElements[3].p.v, i = (this.filterManager.effectElements[2].p.v - 90) * degToRads, s = r * Math.cos(i), a = r * Math.sin(i); this.feOffset.setAttribute("dx", s), this.feOffset.setAttribute("dy", a) } } }; var _svgMatteSymbols = []; function SVGMatte3Effect(t, e, r) { this.initialized = !1, this.filterManager = e, this.filterElem = t, (this.elem = r).matteElement = createNS("g"), r.matteElement.appendChild(r.layerElement), r.matteElement.appendChild(r.transformedElement), r.baseElement = r.matteElement } function SVGEffects(t) { var e, r, i = t.data.ef ? t.data.ef.length : 0, s = createElementID(), a = filtersFactory.createFilter(s), n = 0; for (this.filters = [], e = 0; e < i; e += 1)r = null, 20 === t.data.ef[e].ty ? (n += 1, r = new SVGTintFilter(a, t.effectsManager.effectElements[e])) : 21 === t.data.ef[e].ty ? (n += 1, r = new SVGFillFilter(a, t.effectsManager.effectElements[e])) : 22 === t.data.ef[e].ty ? r = new SVGStrokeEffect(t, t.effectsManager.effectElements[e]) : 23 === t.data.ef[e].ty ? (n += 1, r = new SVGTritoneFilter(a, t.effectsManager.effectElements[e])) : 24 === t.data.ef[e].ty ? (n += 1, r = new SVGProLevelsFilter(a, t.effectsManager.effectElements[e])) : 25 === t.data.ef[e].ty ? (n += 1, r = new SVGDropShadowEffect(a, t.effectsManager.effectElements[e])) : 28 === t.data.ef[e].ty ? r = new SVGMatte3Effect(a, t.effectsManager.effectElements[e], t) : 29 === t.data.ef[e].ty && (n += 1, r = new SVGGaussianBlurEffect(a, t.effectsManager.effectElements[e])), r && this.filters.push(r); n && (t.globalData.defs.appendChild(a), t.layerElement.setAttribute("filter", "url(" + locationHref + "#" + s + ")")), this.filters.length && t.addRenderableComponent(this) } function CVContextData() { this.saved = [], this.cArrPos = 0, this.cTr = new Matrix, this.cO = 1; var t; for (this.savedOp = createTypedArray("float32", 15), t = 0; t < 15; t += 1)this.saved[t] = createTypedArray("float32", 16); this._length = 15 } function CVBaseElement() { } function CVImageElement(t, e, r) { this.assetData = e.getAssetData(t.refId), this.img = e.imageLoader.getImage(this.assetData), this.initElement(t, e, r) } function CVCompElement(t, e, r) { this.completeLayers = !1, this.layers = t.layers, this.pendingElements = [], this.elements = createSizedArray(this.layers.length), this.initElement(t, e, r), this.tm = t.tm ? PropertyFactory.getProp(this, t.tm, 0, e.frameRate, this) : { _placeholder: !0 } } function CVMaskElement(t, e) { this.data = t, this.element = e, this.masksProperties = this.data.masksProperties || [], this.viewData = createSizedArray(this.masksProperties.length); var r, i = this.masksProperties.length, s = !1; for (r = 0; r < i; r++)"n" !== this.masksProperties[r].mode && (s = !0), this.viewData[r] = ShapePropertyFactory.getShapeProp(this.element, this.masksProperties[r], 3); (this.hasMasks = s) && this.element.addRenderableComponent(this) } function CVShapeElement(t, e, r) { this.shapes = [], this.shapesData = t.shapes, this.stylesList = [], this.itemsData = [], this.prevViewData = [], this.shapeModifiers = [], this.processedElements = [], this.transformsManager = new ShapeTransformManager, this.initElement(t, e, r) } function CVSolidElement(t, e, r) { this.initElement(t, e, r) } function CVTextElement(t, e, r) { this.textSpans = [], this.yOffset = 0, this.fillColorAnim = !1, this.strokeColorAnim = !1, this.strokeWidthAnim = !1, this.stroke = !1, this.fill = !1, this.justifyOffset = 0, this.currentRender = null, this.renderType = "canvas", this.values = { fill: "rgba(0,0,0,0)", stroke: "rgba(0,0,0,0)", sWidth: 0, fValue: "" }, this.initElement(t, e, r) } function CVEffects() { } function HBaseElement(t, e, r) { } function HSolidElement(t, e, r) { this.initElement(t, e, r) } function HCompElement(t, e, r) { this.layers = t.layers, this.supports3d = !t.hasMask, this.completeLayers = !1, this.pendingElements = [], this.elements = this.layers ? createSizedArray(this.layers.length) : [], this.initElement(t, e, r), this.tm = t.tm ? PropertyFactory.getProp(this, t.tm, 0, e.frameRate, this) : { _placeholder: !0 } } function HShapeElement(t, e, r) { this.shapes = [], this.shapesData = t.shapes, this.stylesList = [], this.shapeModifiers = [], this.itemsData = [], this.processedElements = [], this.animatedContents = [], this.shapesContainer = createNS("g"), this.initElement(t, e, r), this.prevViewData = [], this.currentBBox = { x: 999999, y: -999999, h: 0, w: 0 } } function HTextElement(t, e, r) { this.textSpans = [], this.textPaths = [], this.currentBBox = { x: 999999, y: -999999, h: 0, w: 0 }, this.renderType = "svg", this.isMasked = !1, this.initElement(t, e, r) } function HImageElement(t, e, r) { this.assetData = e.getAssetData(t.refId), this.initElement(t, e, r) } function HCameraElement(t, e, r) { this.initFrame(), this.initBaseData(t, e, r), this.initHierarchy(); var i = PropertyFactory.getProp; if (this.pe = i(this, t.pe, 0, 0, this), t.ks.p.s ? (this.px = i(this, t.ks.p.x, 1, 0, this), this.py = i(this, t.ks.p.y, 1, 0, this), this.pz = i(this, t.ks.p.z, 1, 0, this)) : this.p = i(this, t.ks.p, 1, 0, this), t.ks.a && (this.a = i(this, t.ks.a, 1, 0, this)), t.ks.or.k.length && t.ks.or.k[0].to) { var s, a = t.ks.or.k.length; for (s = 0; s < a; s += 1)t.ks.or.k[s].to = null, t.ks.or.k[s].ti = null } this.or = i(this, t.ks.or, 1, degToRads, this), this.or.sh = !0, this.rx = i(this, t.ks.rx, 0, degToRads, this), this.ry = i(this, t.ks.ry, 0, degToRads, this), this.rz = i(this, t.ks.rz, 0, degToRads, this), this.mat = new Matrix, this._prevMat = new Matrix, this._isFirstFrame = !0, this.finalTransform = { mProp: this } } function HEffects() { } SVGMatte3Effect.prototype.findSymbol = function (t) { for (var e = 0, r = _svgMatteSymbols.length; e < r;) { if (_svgMatteSymbols[e] === t) return _svgMatteSymbols[e]; e += 1 } return null }, SVGMatte3Effect.prototype.replaceInParent = function (t, e) { var r = t.layerElement.parentNode; if (r) { for (var i, s = r.children, a = 0, n = s.length; a < n && s[a] !== t.layerElement;)a += 1; a <= n - 2 && (i = s[a + 1]); var o = createNS("use"); o.setAttribute("href", "#" + e), i ? r.insertBefore(o, i) : r.appendChild(o) } }, SVGMatte3Effect.prototype.setElementAsMask = function (t, e) { if (!this.findSymbol(e)) { var r = createElementID(), i = createNS("mask"); i.setAttribute("id", e.layerId), i.setAttribute("mask-type", "alpha"), _svgMatteSymbols.push(e); var s = t.globalData.defs; s.appendChild(i); var a = createNS("symbol"); a.setAttribute("id", r), this.replaceInParent(e, r), a.appendChild(e.layerElement), s.appendChild(a); var n = createNS("use"); n.setAttribute("href", "#" + r), i.appendChild(n), e.data.hd = !1, e.show() } t.setMatte(e.layerId) }, SVGMatte3Effect.prototype.initialize = function () { for (var t = this.filterManager.effectElements[0].p.v, e = this.elem.comp.elements, r = 0, i = e.length; r < i;)e[r] && e[r].data.ind === t && this.setElementAsMask(this.elem, e[r]), r += 1; this.initialized = !0 }, SVGMatte3Effect.prototype.renderFrame = function () { this.initialized || this.initialize() }, SVGEffects.prototype.renderFrame = function (t) { var e, r = this.filters.length; for (e = 0; e < r; e += 1)this.filters[e].renderFrame(t) }, CVContextData.prototype.duplicate = function () { var t = 2 * this._length, e = this.savedOp; this.savedOp = createTypedArray("float32", t), this.savedOp.set(e); var r = 0; for (r = this._length; r < t; r += 1)this.saved[r] = createTypedArray("float32", 16); this._length = t }, CVContextData.prototype.reset = function () { this.cArrPos = 0, this.cTr.reset(), this.cO = 1 }, CVBaseElement.prototype = { createElements: function () { }, initRendererElement: function () { }, createContainerElements: function () { this.canvasContext = this.globalData.canvasContext, this.renderableEffectsManager = new CVEffects(this) }, createContent: function () { }, setBlendMode: function () { var t = this.globalData; if (t.blendMode !== this.data.bm) { t.blendMode = this.data.bm; var e = getBlendMode(this.data.bm); t.canvasContext.globalCompositeOperation = e } }, createRenderableComponents: function () { this.maskManager = new CVMaskElement(this.data, this) }, hideElement: function () { this.hidden || this.isInRange && !this.isTransparent || (this.hidden = !0) }, showElement: function () { this.isInRange && !this.isTransparent && (this.hidden = !1, this._isFirstFrame = !0, this.maskManager._isFirstFrame = !0) }, renderFrame: function () { if (!this.hidden && !this.data.hd) { this.renderTransform(), this.renderRenderable(), this.setBlendMode(); var t = 0 === this.data.ty; this.globalData.renderer.save(t), this.globalData.renderer.ctxTransform(this.finalTransform.mat.props), this.globalData.renderer.ctxOpacity(this.finalTransform.mProp.o.v), this.renderInnerContent(), this.globalData.renderer.restore(t), this.maskManager.hasMasks && this.globalData.renderer.restore(!0), this._isFirstFrame && (this._isFirstFrame = !1) } }, destroy: function () { this.canvasContext = null, this.data = null, this.globalData = null, this.maskManager.destroy() }, mHelper: new Matrix }, CVBaseElement.prototype.hide = CVBaseElement.prototype.hideElement, CVBaseElement.prototype.show = CVBaseElement.prototype.showElement, extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVImageElement), CVImageElement.prototype.initElement = SVGShapeElement.prototype.initElement, CVImageElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame, CVImageElement.prototype.createContent = function () { if (this.img.width && (this.assetData.w !== this.img.width || this.assetData.h !== this.img.height)) { var t = createTag("canvas"); t.width = this.assetData.w, t.height = this.assetData.h; var e, r, i = t.getContext("2d"), s = this.img.width, a = this.img.height, n = s / a, o = this.assetData.w / this.assetData.h, h = this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio; o < n && "xMidYMid slice" === h || n < o && "xMidYMid slice" !== h ? e = (r = a) * o : r = (e = s) / o, i.drawImage(this.img, (s - e) / 2, (a - r) / 2, e, r, 0, 0, this.assetData.w, this.assetData.h), this.img = t } }, CVImageElement.prototype.renderInnerContent = function (t) { this.canvasContext.drawImage(this.img, 0, 0) }, CVImageElement.prototype.destroy = function () { this.img = null }, extendPrototype([CanvasRenderer, ICompElement, CVBaseElement], CVCompElement), CVCompElement.prototype.renderInnerContent = function () { var t, e = this.canvasContext; for (e.beginPath(), e.moveTo(0, 0), e.lineTo(this.data.w, 0), e.lineTo(this.data.w, this.data.h), e.lineTo(0, this.data.h), e.lineTo(0, 0), e.clip(), t = this.layers.length - 1; 0 <= t; t -= 1)(this.completeLayers || this.elements[t]) && this.elements[t].renderFrame() }, CVCompElement.prototype.destroy = function () { var t; for (t = this.layers.length - 1; 0 <= t; t -= 1)this.elements[t] && this.elements[t].destroy(); this.layers = null, this.elements = null }, CVMaskElement.prototype.renderFrame = function () { if (this.hasMasks) { var t, e, r, i, s = this.element.finalTransform.mat, a = this.element.canvasContext, n = this.masksProperties.length; for (a.beginPath(), t = 0; t < n; t++)if ("n" !== this.masksProperties[t].mode) { this.masksProperties[t].inv && (a.moveTo(0, 0), a.lineTo(this.element.globalData.compSize.w, 0), a.lineTo(this.element.globalData.compSize.w, this.element.globalData.compSize.h), a.lineTo(0, this.element.globalData.compSize.h), a.lineTo(0, 0)), i = this.viewData[t].v, e = s.applyToPointArray(i.v[0][0], i.v[0][1], 0), a.moveTo(e[0], e[1]); var o, h = i._length; for (o = 1; o < h; o++)r = s.applyToTriplePoints(i.o[o - 1], i.i[o], i.v[o]), a.bezierCurveTo(r[0], r[1], r[2], r[3], r[4], r[5]); r = s.applyToTriplePoints(i.o[o - 1], i.i[0], i.v[0]), a.bezierCurveTo(r[0], r[1], r[2], r[3], r[4], r[5]) } this.element.globalData.renderer.save(!0), a.clip() } }, CVMaskElement.prototype.getMaskProperty = MaskElement.prototype.getMaskProperty, CVMaskElement.prototype.destroy = function () { this.element = null }, extendPrototype([BaseElement, TransformElement, CVBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableElement], CVShapeElement), CVShapeElement.prototype.initElement = RenderableDOMElement.prototype.initElement, CVShapeElement.prototype.transformHelper = { opacity: 1, _opMdf: !1 }, CVShapeElement.prototype.dashResetter = [], CVShapeElement.prototype.createContent = function () { this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, !0, []) }, CVShapeElement.prototype.createStyleElement = function (t, e) { var r = { data: t, type: t.ty, preTransforms: this.transformsManager.addTransformSequence(e), transforms: [], elements: [], closed: !0 === t.hd }, i = {}; if ("fl" == t.ty || "st" == t.ty ? (i.c = PropertyFactory.getProp(this, t.c, 1, 255, this), i.c.k || (r.co = "rgb(" + bm_floor(i.c.v[0]) + "," + bm_floor(i.c.v[1]) + "," + bm_floor(i.c.v[2]) + ")")) : "gf" !== t.ty && "gs" !== t.ty || (i.s = PropertyFactory.getProp(this, t.s, 1, null, this), i.e = PropertyFactory.getProp(this, t.e, 1, null, this), i.h = PropertyFactory.getProp(this, t.h || { k: 0 }, 0, .01, this), i.a = PropertyFactory.getProp(this, t.a || { k: 0 }, 0, degToRads, this), i.g = new GradientProperty(this, t.g, this)), i.o = PropertyFactory.getProp(this, t.o, 0, .01, this), "st" == t.ty || "gs" == t.ty) { if (r.lc = this.lcEnum[t.lc] || "round", r.lj = this.ljEnum[t.lj] || "round", 1 == t.lj && (r.ml = t.ml), i.w = PropertyFactory.getProp(this, t.w, 0, null, this), i.w.k || (r.wi = i.w.v), t.d) { var s = new DashProperty(this, t.d, "canvas", this); i.d = s, i.d.k || (r.da = i.d.dashArray, r.do = i.d.dashoffset[0]) } } else r.r = 2 === t.r ? "evenodd" : "nonzero"; return this.stylesList.push(r), i.style = r, i }, CVShapeElement.prototype.createGroupElement = function (t) { return { it: [], prevViewData: [] } }, CVShapeElement.prototype.createTransformElement = function (t) { return { transform: { opacity: 1, _opMdf: !1, key: this.transformsManager.getNewKey(), op: PropertyFactory.getProp(this, t.o, 0, .01, this), mProps: TransformPropertyFactory.getTransformProperty(this, t, this) } } }, CVShapeElement.prototype.createShapeElement = function (t) { var e = new CVShapeData(this, t, this.stylesList, this.transformsManager); return this.shapes.push(e), this.addShapeToModifiers(e), e }, CVShapeElement.prototype.reloadShapes = function () { this._isFirstFrame = !0; var t, e = this.itemsData.length; for (t = 0; t < e; t += 1)this.prevViewData[t] = this.itemsData[t]; for (this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, !0, []), e = this.dynamicProperties.length, t = 0; t < e; t += 1)this.dynamicProperties[t].getValue(); this.renderModifiers(), this.transformsManager.processSequences(this._isFirstFrame) }, CVShapeElement.prototype.addTransformToStyleList = function (t) { var e, r = this.stylesList.length; for (e = 0; e < r; e += 1)this.stylesList[e].closed || this.stylesList[e].transforms.push(t) }, CVShapeElement.prototype.removeTransformFromStyleList = function () { var t, e = this.stylesList.length; for (t = 0; t < e; t += 1)this.stylesList[t].closed || this.stylesList[t].transforms.pop() }, CVShapeElement.prototype.closeStyles = function (t) { var e, r = t.length; for (e = 0; e < r; e += 1)t[e].closed = !0 }, CVShapeElement.prototype.searchShapes = function (t, e, r, i, s) { var a, n, o, h, l, p, m = t.length - 1, f = [], c = [], d = [].concat(s); for (a = m; 0 <= a; a -= 1) { if ((h = this.searchProcessedElement(t[a])) ? e[a] = r[h - 1] : t[a]._shouldRender = i, "fl" == t[a].ty || "st" == t[a].ty || "gf" == t[a].ty || "gs" == t[a].ty) h ? e[a].style.closed = !1 : e[a] = this.createStyleElement(t[a], d), f.push(e[a].style); else if ("gr" == t[a].ty) { if (h) for (o = e[a].it.length, n = 0; n < o; n += 1)e[a].prevViewData[n] = e[a].it[n]; else e[a] = this.createGroupElement(t[a]); this.searchShapes(t[a].it, e[a].it, e[a].prevViewData, i, d) } else "tr" == t[a].ty ? (h || (p = this.createTransformElement(t[a]), e[a] = p), d.push(e[a]), this.addTransformToStyleList(e[a])) : "sh" == t[a].ty || "rc" == t[a].ty || "el" == t[a].ty || "sr" == t[a].ty ? h || (e[a] = this.createShapeElement(t[a])) : "tm" == t[a].ty || "rd" == t[a].ty ? (h ? (l = e[a]).closed = !1 : ((l = ShapeModifiers.getModifier(t[a].ty)).init(this, t[a]), e[a] = l, this.shapeModifiers.push(l)), c.push(l)) : "rp" == t[a].ty && (h ? (l = e[a]).closed = !0 : (l = ShapeModifiers.getModifier(t[a].ty), (e[a] = l).init(this, t, a, e), this.shapeModifiers.push(l), i = !1), c.push(l)); this.addProcessedElement(t[a], a + 1) } for (this.removeTransformFromStyleList(), this.closeStyles(f), m = c.length, a = 0; a < m; a += 1)c[a].closed = !0 }, CVShapeElement.prototype.renderInnerContent = function () { this.transformHelper.opacity = 1, this.transformHelper._opMdf = !1, this.renderModifiers(), this.transformsManager.processSequences(this._isFirstFrame), this.renderShape(this.transformHelper, this.shapesData, this.itemsData, !0) }, CVShapeElement.prototype.renderShapeTransform = function (t, e) { (t._opMdf || e.op._mdf || this._isFirstFrame) && (e.opacity = t.opacity, e.opacity *= e.op.v, e._opMdf = !0) }, CVShapeElement.prototype.drawLayer = function () { var t, e, r, i, s, a, n, o, h, l = this.stylesList.length, p = this.globalData.renderer, m = this.globalData.canvasContext; for (t = 0; t < l; t += 1)if (("st" !== (o = (h = this.stylesList[t]).type) && "gs" !== o || 0 !== h.wi) && h.data._shouldRender && 0 !== h.coOp && 0 !== this.globalData.currentGlobalAlpha) { for (p.save(), a = h.elements, "st" === o || "gs" === o ? (m.strokeStyle = "st" === o ? h.co : h.grd, m.lineWidth = h.wi, m.lineCap = h.lc, m.lineJoin = h.lj, m.miterLimit = h.ml || 0) : m.fillStyle = "fl" === o ? h.co : h.grd, p.ctxOpacity(h.coOp), "st" !== o && "gs" !== o && m.beginPath(), p.ctxTransform(h.preTransforms.finalTransform.props), r = a.length, e = 0; e < r; e += 1) { for ("st" !== o && "gs" !== o || (m.beginPath(), h.da && (m.setLineDash(h.da), m.lineDashOffset = h.do)), s = (n = a[e].trNodes).length, i = 0; i < s; i += 1)"m" == n[i].t ? m.moveTo(n[i].p[0], n[i].p[1]) : "c" == n[i].t ? m.bezierCurveTo(n[i].pts[0], n[i].pts[1], n[i].pts[2], n[i].pts[3], n[i].pts[4], n[i].pts[5]) : m.closePath(); "st" !== o && "gs" !== o || (m.stroke(), h.da && m.setLineDash(this.dashResetter)) } "st" !== o && "gs" !== o && m.fill(h.r), p.restore() } }, CVShapeElement.prototype.renderShape = function (t, e, r, i) { var s, a; for (a = t, s = e.length - 1; 0 <= s; s -= 1)"tr" == e[s].ty ? (a = r[s].transform, this.renderShapeTransform(t, a)) : "sh" == e[s].ty || "el" == e[s].ty || "rc" == e[s].ty || "sr" == e[s].ty ? this.renderPath(e[s], r[s]) : "fl" == e[s].ty ? this.renderFill(e[s], r[s], a) : "st" == e[s].ty ? this.renderStroke(e[s], r[s], a) : "gf" == e[s].ty || "gs" == e[s].ty ? this.renderGradientFill(e[s], r[s], a) : "gr" == e[s].ty ? this.renderShape(a, e[s].it, r[s].it) : e[s].ty; i && this.drawLayer() }, CVShapeElement.prototype.renderStyledShape = function (t, e) { if (this._isFirstFrame || e._mdf || t.transforms._mdf) { var r, i, s, a = t.trNodes, n = e.paths, o = n._length; a.length = 0; var h = t.transforms.finalTransform; for (s = 0; s < o; s += 1) { var l = n.shapes[s]; if (l && l.v) { for (i = l._length, r = 1; r < i; r += 1)1 === r && a.push({ t: "m", p: h.applyToPointArray(l.v[0][0], l.v[0][1], 0) }), a.push({ t: "c", pts: h.applyToTriplePoints(l.o[r - 1], l.i[r], l.v[r]) }); 1 === i && a.push({ t: "m", p: h.applyToPointArray(l.v[0][0], l.v[0][1], 0) }), l.c && i && (a.push({ t: "c", pts: h.applyToTriplePoints(l.o[r - 1], l.i[0], l.v[0]) }), a.push({ t: "z" })) } } t.trNodes = a } }, CVShapeElement.prototype.renderPath = function (t, e) { if (!0 !== t.hd && t._shouldRender) { var r, i = e.styledShapes.length; for (r = 0; r < i; r += 1)this.renderStyledShape(e.styledShapes[r], e.sh) } }, CVShapeElement.prototype.renderFill = function (t, e, r) { var i = e.style; (e.c._mdf || this._isFirstFrame) && (i.co = "rgb(" + bm_floor(e.c.v[0]) + "," + bm_floor(e.c.v[1]) + "," + bm_floor(e.c.v[2]) + ")"), (e.o._mdf || r._opMdf || this._isFirstFrame) && (i.coOp = e.o.v * r.opacity) }, CVShapeElement.prototype.renderGradientFill = function (t, e, r) { var i = e.style; if (!i.grd || e.g._mdf || e.s._mdf || e.e._mdf || 1 !== t.t && (e.h._mdf || e.a._mdf)) { var s = this.globalData.canvasContext, a = e.s.v, n = e.e.v; if (1 === t.t) f = s.createLinearGradient(a[0], a[1], n[0], n[1]); else var o = Math.sqrt(Math.pow(a[0] - n[0], 2) + Math.pow(a[1] - n[1], 2)), h = Math.atan2(n[1] - a[1], n[0] - a[0]), l = o * (1 <= e.h.v ? .99 : e.h.v <= -1 ? -.99 : e.h.v), p = Math.cos(h + e.a.v) * l + a[0], m = Math.sin(h + e.a.v) * l + a[1], f = s.createRadialGradient(p, m, 0, a[0], a[1], o); var c, d = t.g.p, u = e.g.c, y = 1; for (c = 0; c < d; c += 1)e.g._hasOpacity && e.g._collapsable && (y = e.g.o[2 * c + 1]), f.addColorStop(u[4 * c] / 100, "rgba(" + u[4 * c + 1] + "," + u[4 * c + 2] + "," + u[4 * c + 3] + "," + y + ")"); i.grd = f } i.coOp = e.o.v * r.opacity }, CVShapeElement.prototype.renderStroke = function (t, e, r) { var i = e.style, s = e.d; s && (s._mdf || this._isFirstFrame) && (i.da = s.dashArray, i.do = s.dashoffset[0]), (e.c._mdf || this._isFirstFrame) && (i.co = "rgb(" + bm_floor(e.c.v[0]) + "," + bm_floor(e.c.v[1]) + "," + bm_floor(e.c.v[2]) + ")"), (e.o._mdf || r._opMdf || this._isFirstFrame) && (i.coOp = e.o.v * r.opacity), (e.w._mdf || this._isFirstFrame) && (i.wi = e.w.v) }, CVShapeElement.prototype.destroy = function () { this.shapesData = null, this.globalData = null, this.canvasContext = null, this.stylesList.length = 0, this.itemsData.length = 0 }, extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVSolidElement), CVSolidElement.prototype.initElement = SVGShapeElement.prototype.initElement, CVSolidElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame, CVSolidElement.prototype.renderInnerContent = function () { var t = this.canvasContext; t.fillStyle = this.data.sc, t.fillRect(0, 0, this.data.sw, this.data.sh) }, extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement, ITextElement], CVTextElement), CVTextElement.prototype.tHelper = createTag("canvas").getContext("2d"), CVTextElement.prototype.buildNewText = function () { var t = this.textProperty.currentData; this.renderedLetters = createSizedArray(t.l ? t.l.length : 0); var e = !1; t.fc ? (e = !0, this.values.fill = this.buildColor(t.fc)) : this.values.fill = "rgba(0,0,0,0)", this.fill = e; var r = !1; t.sc && (r = !0, this.values.stroke = this.buildColor(t.sc), this.values.sWidth = t.sw); var i, s, a = this.globalData.fontManager.getFontByName(t.f), n = t.l, o = this.mHelper; this.stroke = r, this.values.fValue = t.finalSize + "px " + this.globalData.fontManager.getFontByName(t.f).fFamily, s = t.finalText.length; var h, l, p, m, f, c, d, u, y, g, v = this.data.singleShape, b = t.tr / 1e3 * t.finalSize, E = 0, x = 0, P = !0, S = 0; for (i = 0; i < s; i += 1) { for (l = (h = this.globalData.fontManager.getCharData(t.finalText[i], a.fStyle, this.globalData.fontManager.getFontByName(t.f).fFamily)) && h.data || {}, o.reset(), v && n[i].n && (E = -b, x += t.yOffset, x += P ? 1 : 0, P = !1), d = (f = l.shapes ? l.shapes[0].it : []).length, o.scale(t.finalSize / 100, t.finalSize / 100), v && this.applyTextPropertiesToMatrix(t, o, n[i].line, E, x), y = createSizedArray(d), c = 0; c < d; c += 1) { for (m = f[c].ks.k.i.length, u = f[c].ks.k, g = [], p = 1; p < m; p += 1)1 == p && g.push(o.applyToX(u.v[0][0], u.v[0][1], 0), o.applyToY(u.v[0][0], u.v[0][1], 0)), g.push(o.applyToX(u.o[p - 1][0], u.o[p - 1][1], 0), o.applyToY(u.o[p - 1][0], u.o[p - 1][1], 0), o.applyToX(u.i[p][0], u.i[p][1], 0), o.applyToY(u.i[p][0], u.i[p][1], 0), o.applyToX(u.v[p][0], u.v[p][1], 0), o.applyToY(u.v[p][0], u.v[p][1], 0)); g.push(o.applyToX(u.o[p - 1][0], u.o[p - 1][1], 0), o.applyToY(u.o[p - 1][0], u.o[p - 1][1], 0), o.applyToX(u.i[0][0], u.i[0][1], 0), o.applyToY(u.i[0][0], u.i[0][1], 0), o.applyToX(u.v[0][0], u.v[0][1], 0), o.applyToY(u.v[0][0], u.v[0][1], 0)), y[c] = g } v && (E += n[i].l, E += b), this.textSpans[S] ? this.textSpans[S].elem = y : this.textSpans[S] = { elem: y }, S += 1 } }, CVTextElement.prototype.renderInnerContent = function () { var t, e, r, i, s, a, n = this.canvasContext; this.finalTransform.mat.props; n.font = this.values.fValue, n.lineCap = "butt", n.lineJoin = "miter", n.miterLimit = 4, this.data.singleShape || this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag); var o, h = this.textAnimator.renderedLetters, l = this.textProperty.currentData.l; e = l.length; var p, m, f = null, c = null, d = null; for (t = 0; t < e; t += 1)if (!l[t].n) { if ((o = h[t]) && (this.globalData.renderer.save(), this.globalData.renderer.ctxTransform(o.p), this.globalData.renderer.ctxOpacity(o.o)), this.fill) { for (o && o.fc ? f !== o.fc && (f = o.fc, n.fillStyle = o.fc) : f !== this.values.fill && (f = this.values.fill, n.fillStyle = this.values.fill), i = (p = this.textSpans[t].elem).length, this.globalData.canvasContext.beginPath(), r = 0; r < i; r += 1)for (a = (m = p[r]).length, this.globalData.canvasContext.moveTo(m[0], m[1]), s = 2; s < a; s += 6)this.globalData.canvasContext.bezierCurveTo(m[s], m[s + 1], m[s + 2], m[s + 3], m[s + 4], m[s + 5]); this.globalData.canvasContext.closePath(), this.globalData.canvasContext.fill() } if (this.stroke) { for (o && o.sw ? d !== o.sw && (d = o.sw, n.lineWidth = o.sw) : d !== this.values.sWidth && (d = this.values.sWidth, n.lineWidth = this.values.sWidth), o && o.sc ? c !== o.sc && (c = o.sc, n.strokeStyle = o.sc) : c !== this.values.stroke && (c = this.values.stroke, n.strokeStyle = this.values.stroke), i = (p = this.textSpans[t].elem).length, this.globalData.canvasContext.beginPath(), r = 0; r < i; r += 1)for (a = (m = p[r]).length, this.globalData.canvasContext.moveTo(m[0], m[1]), s = 2; s < a; s += 6)this.globalData.canvasContext.bezierCurveTo(m[s], m[s + 1], m[s + 2], m[s + 3], m[s + 4], m[s + 5]); this.globalData.canvasContext.closePath(), this.globalData.canvasContext.stroke() } o && this.globalData.renderer.restore() } }, CVEffects.prototype.renderFrame = function () { }, HBaseElement.prototype = { checkBlendMode: function () { }, initRendererElement: function () { this.baseElement = createTag(this.data.tg || "div"), this.data.hasMask ? (this.svgElement = createNS("svg"), this.layerElement = createNS("g"), this.maskedElement = this.layerElement, this.svgElement.appendChild(this.layerElement), this.baseElement.appendChild(this.svgElement)) : this.layerElement = this.baseElement, styleDiv(this.baseElement) }, createContainerElements: function () { this.renderableEffectsManager = new CVEffects(this), this.transformedElement = this.baseElement, this.maskedElement = this.layerElement, this.data.ln && this.layerElement.setAttribute("id", this.data.ln), this.data.cl && this.layerElement.setAttribute("class", this.data.cl), 0 !== this.data.bm && this.setBlendMode() }, renderElement: function () { this.finalTransform._matMdf && (this.transformedElement.style.transform = this.transformedElement.style.webkitTransform = this.finalTransform.mat.toCSS()), this.finalTransform._opMdf && (this.transformedElement.style.opacity = this.finalTransform.mProp.o.v) }, renderFrame: function () { this.data.hd || this.hidden || (this.renderTransform(), this.renderRenderable(), this.renderElement(), this.renderInnerContent(), this._isFirstFrame && (this._isFirstFrame = !1)) }, destroy: function () { this.layerElement = null, this.transformedElement = null, this.matteElement && (this.matteElement = null), this.maskManager && (this.maskManager.destroy(), this.maskManager = null) }, createRenderableComponents: function () { this.maskManager = new MaskElement(this.data, this, this.globalData) }, addEffects: function () { }, setMatte: function () { } }, HBaseElement.prototype.getBaseElement = SVGBaseElement.prototype.getBaseElement, HBaseElement.prototype.destroyBaseElement = HBaseElement.prototype.destroy, HBaseElement.prototype.buildElementParenting = HybridRenderer.prototype.buildElementParenting, extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], HSolidElement), HSolidElement.prototype.createContent = function () { var t; this.data.hasMask ? ((t = createNS("rect")).setAttribute("width", this.data.sw), t.setAttribute("height", this.data.sh), t.setAttribute("fill", this.data.sc), this.svgElement.setAttribute("width", this.data.sw), this.svgElement.setAttribute("height", this.data.sh)) : ((t = createTag("div")).style.width = this.data.sw + "px", t.style.height = this.data.sh + "px", t.style.backgroundColor = this.data.sc), this.layerElement.appendChild(t) }, extendPrototype([HybridRenderer, ICompElement, HBaseElement], HCompElement), HCompElement.prototype._createBaseContainerElements = HCompElement.prototype.createContainerElements, HCompElement.prototype.createContainerElements = function () { this._createBaseContainerElements(), this.data.hasMask ? (this.svgElement.setAttribute("width", this.data.w), this.svgElement.setAttribute("height", this.data.h), this.transformedElement = this.baseElement) : this.transformedElement = this.layerElement }, HCompElement.prototype.addTo3dContainer = function (t, e) { for (var r, i = 0; i < e;)this.elements[i] && this.elements[i].getBaseElement && (r = this.elements[i].getBaseElement()), i += 1; r ? this.layerElement.insertBefore(t, r) : this.layerElement.appendChild(t) }, extendPrototype([BaseElement, TransformElement, HSolidElement, SVGShapeElement, HBaseElement, HierarchyElement, FrameElement, RenderableElement], HShapeElement), HShapeElement.prototype._renderShapeFrame = HShapeElement.prototype.renderInnerContent, HShapeElement.prototype.createContent = function () { var t; if (this.baseElement.style.fontSize = 0, this.data.hasMask) this.layerElement.appendChild(this.shapesContainer), t = this.svgElement; else { t = createNS("svg"); var e = this.comp.data ? this.comp.data : this.globalData.compSize; t.setAttribute("width", e.w), t.setAttribute("height", e.h), t.appendChild(this.shapesContainer), this.layerElement.appendChild(t) } this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.shapesContainer, 0, [], !0), this.filterUniqueShapes(), this.shapeCont = t }, HShapeElement.prototype.getTransformedPoint = function (t, e) { var r, i = t.length; for (r = 0; r < i; r += 1)e = t[r].mProps.v.applyToPointArray(e[0], e[1], 0); return e }, HShapeElement.prototype.calculateShapeBoundingBox = function (t, e) { var r, i, s, a, n, o = t.sh.v, h = t.transformers, l = o._length; if (!(l <= 1)) { for (r = 0; r < l - 1; r += 1)i = this.getTransformedPoint(h, o.v[r]), s = this.getTransformedPoint(h, o.o[r]), a = this.getTransformedPoint(h, o.i[r + 1]), n = this.getTransformedPoint(h, o.v[r + 1]), this.checkBounds(i, s, a, n, e); o.c && (i = this.getTransformedPoint(h, o.v[r]), s = this.getTransformedPoint(h, o.o[r]), a = this.getTransformedPoint(h, o.i[0]), n = this.getTransformedPoint(h, o.v[0]), this.checkBounds(i, s, a, n, e)) } }, HShapeElement.prototype.checkBounds = function (t, e, r, i, s) { this.getBoundsOfCurve(t, e, r, i); var a = this.shapeBoundingBox; s.x = bm_min(a.left, s.x), s.xMax = bm_max(a.right, s.xMax), s.y = bm_min(a.top, s.y), s.yMax = bm_max(a.bottom, s.yMax) }, HShapeElement.prototype.shapeBoundingBox = { left: 0, right: 0, top: 0, bottom: 0 }, HShapeElement.prototype.tempBoundingBox = { x: 0, xMax: 0, y: 0, yMax: 0, width: 0, height: 0 }, HShapeElement.prototype.getBoundsOfCurve = function (t, e, r, i) { for (var s, a, n, o, h, l, p, m = [[t[0], i[0]], [t[1], i[1]]], f = 0; f < 2; ++f)if (a = 6 * t[f] - 12 * e[f] + 6 * r[f], s = -3 * t[f] + 9 * e[f] - 9 * r[f] + 3 * i[f], n = 3 * e[f] - 3 * t[f], a |= 0, n |= 0, 0 !== (s |= 0)) (h = a * a - 4 * n * s) < 0 || (0 < (l = (-a + bm_sqrt(h)) / (2 * s)) && l < 1 && m[f].push(this.calculateF(l, t, e, r, i, f)), 0 < (p = (-a - bm_sqrt(h)) / (2 * s)) && p < 1 && m[f].push(this.calculateF(p, t, e, r, i, f))); else { if (0 === a) continue; 0 < (o = -n / a) && o < 1 && m[f].push(this.calculateF(o, t, e, r, i, f)) } this.shapeBoundingBox.left = bm_min.apply(null, m[0]), this.shapeBoundingBox.top = bm_min.apply(null, m[1]), this.shapeBoundingBox.right = bm_max.apply(null, m[0]), this.shapeBoundingBox.bottom = bm_max.apply(null, m[1]) }, HShapeElement.prototype.calculateF = function (t, e, r, i, s, a) { return bm_pow(1 - t, 3) * e[a] + 3 * bm_pow(1 - t, 2) * t * r[a] + 3 * (1 - t) * bm_pow(t, 2) * i[a] + bm_pow(t, 3) * s[a] }, HShapeElement.prototype.calculateBoundingBox = function (t, e) { var r, i = t.length; for (r = 0; r < i; r += 1)t[r] && t[r].sh ? this.calculateShapeBoundingBox(t[r], e) : t[r] && t[r].it && this.calculateBoundingBox(t[r].it, e) }, HShapeElement.prototype.currentBoxContains = function (t) { return this.currentBBox.x <= t.x && this.currentBBox.y <= t.y && this.currentBBox.width + this.currentBBox.x >= t.x + t.width && this.currentBBox.height + this.currentBBox.y >= t.y + t.height }, HShapeElement.prototype.renderInnerContent = function () { if (this._renderShapeFrame(), !this.hidden && (this._isFirstFrame || this._mdf)) { var t = this.tempBoundingBox, e = 999999; if (t.x = e, t.xMax = -e, t.y = e, t.yMax = -e, this.calculateBoundingBox(this.itemsData, t), t.width = t.xMax < t.x ? 0 : t.xMax - t.x, t.height = t.yMax < t.y ? 0 : t.yMax - t.y, this.currentBoxContains(t)) return; var r = !1; this.currentBBox.w !== t.width && (this.currentBBox.w = t.width, this.shapeCont.setAttribute("width", t.width), r = !0), this.currentBBox.h !== t.height && (this.currentBBox.h = t.height, this.shapeCont.setAttribute("height", t.height), r = !0), (r || this.currentBBox.x !== t.x || this.currentBBox.y !== t.y) && (this.currentBBox.w = t.width, this.currentBBox.h = t.height, this.currentBBox.x = t.x, this.currentBBox.y = t.y, this.shapeCont.setAttribute("viewBox", this.currentBBox.x + " " + this.currentBBox.y + " " + this.currentBBox.w + " " + this.currentBBox.h), this.shapeCont.style.transform = this.shapeCont.style.webkitTransform = "translate(" + this.currentBBox.x + "px," + this.currentBBox.y + "px)") } }, extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], HTextElement), HTextElement.prototype.createContent = function () { if (this.isMasked = this.checkMasks(), this.isMasked) { this.renderType = "svg", this.compW = this.comp.data.w, this.compH = this.comp.data.h, this.svgElement.setAttribute("width", this.compW), this.svgElement.setAttribute("height", this.compH); var t = createNS("g"); this.maskedElement.appendChild(t), this.innerElem = t } else this.renderType = "html", this.innerElem = this.layerElement; this.checkParenting() }, HTextElement.prototype.buildNewText = function () { var t = this.textProperty.currentData; this.renderedLetters = createSizedArray(t.l ? t.l.length : 0); var e = this.innerElem.style; e.color = e.fill = t.fc ? this.buildColor(t.fc) : "rgba(0,0,0,0)", t.sc && (e.stroke = this.buildColor(t.sc), e.strokeWidth = t.sw + "px"); var r, i, s = this.globalData.fontManager.getFontByName(t.f); if (!this.globalData.fontManager.chars) if (e.fontSize = t.finalSize + "px", e.lineHeight = t.finalSize + "px", s.fClass) this.innerElem.className = s.fClass; else { e.fontFamily = s.fFamily; var a = t.fWeight, n = t.fStyle; e.fontStyle = n, e.fontWeight = a } var o, h, l, p = t.l; i = p.length; var m, f = this.mHelper, c = "", d = 0; for (r = 0; r < i; r += 1) { if (this.globalData.fontManager.chars ? (this.textPaths[d] ? o = this.textPaths[d] : ((o = createNS("path")).setAttribute("stroke-linecap", "butt"), o.setAttribute("stroke-linejoin", "round"), o.setAttribute("stroke-miterlimit", "4")), this.isMasked || (this.textSpans[d] ? l = (h = this.textSpans[d]).children[0] : ((h = createTag("div")).style.lineHeight = 0, (l = createNS("svg")).appendChild(o), styleDiv(h)))) : this.isMasked ? o = this.textPaths[d] ? this.textPaths[d] : createNS("text") : this.textSpans[d] ? (h = this.textSpans[d], o = this.textPaths[d]) : (styleDiv(h = createTag("span")), styleDiv(o = createTag("span")), h.appendChild(o)), this.globalData.fontManager.chars) { var u, y = this.globalData.fontManager.getCharData(t.finalText[r], s.fStyle, this.globalData.fontManager.getFontByName(t.f).fFamily); if (u = y ? y.data : null, f.reset(), u && u.shapes && (m = u.shapes[0].it, f.scale(t.finalSize / 100, t.finalSize / 100), c = this.createPathShape(f, m), o.setAttribute("d", c)), this.isMasked) this.innerElem.appendChild(o); else { if (this.innerElem.appendChild(h), u && u.shapes) { document.body.appendChild(l); var g = l.getBBox(); l.setAttribute("width", g.width + 2), l.setAttribute("height", g.height + 2), l.setAttribute("viewBox", g.x - 1 + " " + (g.y - 1) + " " + (g.width + 2) + " " + (g.height + 2)), l.style.transform = l.style.webkitTransform = "translate(" + (g.x - 1) + "px," + (g.y - 1) + "px)", p[r].yOffset = g.y - 1 } else l.setAttribute("width", 1), l.setAttribute("height", 1); h.appendChild(l) } } else o.textContent = p[r].val, o.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), this.isMasked ? this.innerElem.appendChild(o) : (this.innerElem.appendChild(h), o.style.transform = o.style.webkitTransform = "translate3d(0," + -t.finalSize / 1.2 + "px,0)"); this.isMasked ? this.textSpans[d] = o : this.textSpans[d] = h, this.textSpans[d].style.display = "block", this.textPaths[d] = o, d += 1 } for (; d < this.textSpans.length;)this.textSpans[d].style.display = "none", d += 1 }, HTextElement.prototype.renderInnerContent = function () { if (this.data.singleShape) { if (!this._isFirstFrame && !this.lettersChangedFlag) return; this.isMasked && this.finalTransform._matMdf && (this.svgElement.setAttribute("viewBox", -this.finalTransform.mProp.p.v[0] + " " + -this.finalTransform.mProp.p.v[1] + " " + this.compW + " " + this.compH), this.svgElement.style.transform = this.svgElement.style.webkitTransform = "translate(" + -this.finalTransform.mProp.p.v[0] + "px," + -this.finalTransform.mProp.p.v[1] + "px)") } if (this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag), this.lettersChangedFlag || this.textAnimator.lettersChangedFlag) { var t, e, r, i, s, a = 0, n = this.textAnimator.renderedLetters, o = this.textProperty.currentData.l; for (e = o.length, t = 0; t < e; t += 1)o[t].n ? a += 1 : (i = this.textSpans[t], s = this.textPaths[t], r = n[a], a += 1, r._mdf.m && (this.isMasked ? i.setAttribute("transform", r.m) : i.style.transform = i.style.webkitTransform = r.m), i.style.opacity = r.o, r.sw && r._mdf.sw && s.setAttribute("stroke-width", r.sw), r.sc && r._mdf.sc && s.setAttribute("stroke", r.sc), r.fc && r._mdf.fc && (s.setAttribute("fill", r.fc), s.style.color = r.fc)); if (this.innerElem.getBBox && !this.hidden && (this._isFirstFrame || this._mdf)) { var h = this.innerElem.getBBox(); this.currentBBox.w !== h.width && (this.currentBBox.w = h.width, this.svgElement.setAttribute("width", h.width)), this.currentBBox.h !== h.height && (this.currentBBox.h = h.height, this.svgElement.setAttribute("height", h.height)); this.currentBBox.w === h.width + 2 && this.currentBBox.h === h.height + 2 && this.currentBBox.x === h.x - 1 && this.currentBBox.y === h.y - 1 || (this.currentBBox.w = h.width + 2, this.currentBBox.h = h.height + 2, this.currentBBox.x = h.x - 1, this.currentBBox.y = h.y - 1, this.svgElement.setAttribute("viewBox", this.currentBBox.x + " " + this.currentBBox.y + " " + this.currentBBox.w + " " + this.currentBBox.h), this.svgElement.style.transform = this.svgElement.style.webkitTransform = "translate(" + this.currentBBox.x + "px," + this.currentBBox.y + "px)") } } }, extendPrototype([BaseElement, TransformElement, HBaseElement, HSolidElement, HierarchyElement, FrameElement, RenderableElement], HImageElement), HImageElement.prototype.createContent = function () { var t = this.globalData.getAssetsPath(this.assetData), e = new Image; this.data.hasMask ? (this.imageElem = createNS("image"), this.imageElem.setAttribute("width", this.assetData.w + "px"), this.imageElem.setAttribute("height", this.assetData.h + "px"), this.imageElem.setAttributeNS("http://www.w3.org/1999/xlink", "href", t), this.layerElement.appendChild(this.imageElem), this.baseElement.setAttribute("width", this.assetData.w), this.baseElement.setAttribute("height", this.assetData.h)) : this.layerElement.appendChild(e), e.src = t, this.data.ln && this.baseElement.setAttribute("id", this.data.ln) }, extendPrototype([BaseElement, FrameElement, HierarchyElement], HCameraElement), HCameraElement.prototype.setup = function () { var t, e, r = this.comp.threeDElements.length; for (t = 0; t < r; t += 1)"3d" === (e = this.comp.threeDElements[t]).type && (e.perspectiveElem.style.perspective = e.perspectiveElem.style.webkitPerspective = this.pe.v + "px", e.container.style.transformOrigin = e.container.style.mozTransformOrigin = e.container.style.webkitTransformOrigin = "0px 0px 0px", e.perspectiveElem.style.transform = e.perspectiveElem.style.webkitTransform = "matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)") }, HCameraElement.prototype.createElements = function () { }, HCameraElement.prototype.hide = function () { }, HCameraElement.prototype.renderFrame = function () { var t, e, r = this._isFirstFrame; if (this.hierarchy) for (e = this.hierarchy.length, t = 0; t < e; t += 1)r = this.hierarchy[t].finalTransform.mProp._mdf || r; if (r || this.pe._mdf || this.p && this.p._mdf || this.px && (this.px._mdf || this.py._mdf || this.pz._mdf) || this.rx._mdf || this.ry._mdf || this.rz._mdf || this.or._mdf || this.a && this.a._mdf) { if (this.mat.reset(), this.hierarchy) for (t = e = this.hierarchy.length - 1; 0 <= t; t -= 1) { var i = this.hierarchy[t].finalTransform.mProp; this.mat.translate(-i.p.v[0], -i.p.v[1], i.p.v[2]), this.mat.rotateX(-i.or.v[0]).rotateY(-i.or.v[1]).rotateZ(i.or.v[2]), this.mat.rotateX(-i.rx.v).rotateY(-i.ry.v).rotateZ(i.rz.v), this.mat.scale(1 / i.s.v[0], 1 / i.s.v[1], 1 / i.s.v[2]), this.mat.translate(i.a.v[0], i.a.v[1], i.a.v[2]) } if (this.p ? this.mat.translate(-this.p.v[0], -this.p.v[1], this.p.v[2]) : this.mat.translate(-this.px.v, -this.py.v, this.pz.v), this.a) { var s; s = this.p ? [this.p.v[0] - this.a.v[0], this.p.v[1] - this.a.v[1], this.p.v[2] - this.a.v[2]] : [this.px.v - this.a.v[0], this.py.v - this.a.v[1], this.pz.v - this.a.v[2]]; var a = Math.sqrt(Math.pow(s[0], 2) + Math.pow(s[1], 2) + Math.pow(s[2], 2)), n = [s[0] / a, s[1] / a, s[2] / a], o = Math.sqrt(n[2] * n[2] + n[0] * n[0]), h = Math.atan2(n[1], o), l = Math.atan2(n[0], -n[2]); this.mat.rotateY(l).rotateX(-h) } this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v), this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]), this.mat.translate(this.globalData.compSize.w / 2, this.globalData.compSize.h / 2, 0), this.mat.translate(0, 0, this.pe.v); var p = !this._prevMat.equals(this.mat); if ((p || this.pe._mdf) && this.comp.threeDElements) { var m; for (e = this.comp.threeDElements.length, t = 0; t < e; t += 1)"3d" === (m = this.comp.threeDElements[t]).type && (p && (m.container.style.transform = m.container.style.webkitTransform = this.mat.toCSS()), this.pe._mdf && (m.perspectiveElem.style.perspective = m.perspectiveElem.style.webkitPerspective = this.pe.v + "px")); this.mat.clone(this._prevMat) } } this._isFirstFrame = !1 }, HCameraElement.prototype.prepareFrame = function (t) { this.prepareProperties(t, !0) }, HCameraElement.prototype.destroy = function () { }, HCameraElement.prototype.getBaseElement = function () { return null }, HEffects.prototype.renderFrame = function () { }; var animationManager = function () { var t = {}, s = [], i = 0, a = 0, n = 0, o = !0, h = !1; function r(t) { for (var e = 0, r = t.target; e < a;)s[e].animation === r && (s.splice(e, 1), e -= 1, a -= 1, r.isPaused || m()), e += 1 } function l(t, e) { if (!t) return null; for (var r = 0; r < a;) { if (s[r].elem == t && null !== s[r].elem) return s[r].animation; r += 1 } var i = new AnimationItem; return f(i, t), i.setData(t, e), i } function p() { n += 1, d() } function m() { n -= 1 } function f(t, e) { t.addEventListener("destroy", r), t.addEventListener("_active", p), t.addEventListener("_idle", m), s.push({ elem: e, animation: t }), a += 1 } function c(t) { var e, r = t - i; for (e = 0; e < a; e += 1)s[e].animation.advanceTime(r); i = t, n && !h ? window.requestAnimationFrame(c) : o = !0 } function e(t) { i = t, window.requestAnimationFrame(c) } function d() { !h && n && o && (window.requestAnimationFrame(e), o = !1) } return t.registerAnimation = l, t.loadAnimation = function (t) { var e = new AnimationItem; return f(e, null), e.setParams(t), e }, t.setSpeed = function (t, e) { var r; for (r = 0; r < a; r += 1)s[r].animation.setSpeed(t, e) }, t.setDirection = function (t, e) { var r; for (r = 0; r < a; r += 1)s[r].animation.setDirection(t, e) }, t.play = function (t) { var e; for (e = 0; e < a; e += 1)s[e].animation.play(t) }, t.pause = function (t) { var e; for (e = 0; e < a; e += 1)s[e].animation.pause(t) }, t.stop = function (t) { var e; for (e = 0; e < a; e += 1)s[e].animation.stop(t) }, t.togglePause = function (t) { var e; for (e = 0; e < a; e += 1)s[e].animation.togglePause(t) }, t.searchAnimations = function (t, e, r) { var i, s = [].concat([].slice.call(document.getElementsByClassName("lottie")), [].slice.call(document.getElementsByClassName("bodymovin"))), a = s.length; for (i = 0; i < a; i += 1)r && s[i].setAttribute("data-bm-type", r), l(s[i], t); if (e && 0 === a) { r || (r = "svg"); var n = document.getElementsByTagName("body")[0]; n.innerHTML = ""; var o = createTag("div"); o.style.width = "100%", o.style.height = "100%", o.setAttribute("data-bm-type", r), n.appendChild(o), l(o, t) } }, t.resize = function () { var t; for (t = 0; t < a; t += 1)s[t].animation.resize() }, t.goToAndStop = function (t, e, r) { var i; for (i = 0; i < a; i += 1)s[i].animation.goToAndStop(t, e, r) }, t.destroy = function (t) { var e; for (e = a - 1; 0 <= e; e -= 1)s[e].animation.destroy(t) }, t.freeze = function () { h = !0 }, t.unfreeze = function () { h = !1, d() }, t.getRegisteredAnimations = function () { var t, e = s.length, r = []; for (t = 0; t < e; t += 1)r.push(s[t].animation); return r }, t }(), AnimationItem = function () { this._cbs = [], this.name = "", this.path = "", this.isLoaded = !1, this.currentFrame = 0, this.currentRawFrame = 0, this.totalFrames = 0, this.frameRate = 0, this.frameMult = 0, this.playSpeed = 1, this.playDirection = 1, this.playCount = 0, this.animationData = {}, this.assets = [], this.isPaused = !0, this.autoplay = !1, this.loop = !0, this.renderer = null, this.animationID = createElementID(), this.assetsPath = "", this.timeCompleted = 0, this.segmentPos = 0, this.subframeEnabled = subframeEnabled, this.segments = [], this._idle = !0, this._completedLoop = !1, this.projectInterface = ProjectInterface(), this.imagePreloader = new ImagePreloader }; extendPrototype([BaseEvent], AnimationItem), AnimationItem.prototype.setParams = function (t) { t.context && (this.context = t.context), (t.wrapper || t.container) && (this.wrapper = t.wrapper || t.container); var e = t.animType ? t.animType : t.renderer ? t.renderer : "svg"; switch (e) { case "canvas": this.renderer = new CanvasRenderer(this, t.rendererSettings); break; case "svg": this.renderer = new SVGRenderer(this, t.rendererSettings); break; default: this.renderer = new HybridRenderer(this, t.rendererSettings) }this.renderer.setProjectInterface(this.projectInterface), this.animType = e, "" === t.loop || null === t.loop || (!1 === t.loop ? this.loop = !1 : !0 === t.loop ? this.loop = !0 : this.loop = parseInt(t.loop)), this.autoplay = !("autoplay" in t) || t.autoplay, this.name = t.name ? t.name : "", this.autoloadSegments = !t.hasOwnProperty("autoloadSegments") || t.autoloadSegments, this.assetsPath = t.assetsPath, t.animationData ? this.configAnimation(t.animationData) : t.path && (-1 !== t.path.lastIndexOf("\\") ? this.path = t.path.substr(0, t.path.lastIndexOf("\\") + 1) : this.path = t.path.substr(0, t.path.lastIndexOf("/") + 1), this.fileName = t.path.substr(t.path.lastIndexOf("/") + 1), this.fileName = this.fileName.substr(0, this.fileName.lastIndexOf(".json")), assetLoader.load(t.path, this.configAnimation.bind(this), function () { this.trigger("data_failed") }.bind(this))) }, AnimationItem.prototype.setData = function (t, e) { var r = { wrapper: t, animationData: e ? "object" == typeof e ? e : JSON.parse(e) : null }, i = t.attributes; r.path = i.getNamedItem("data-animation-path") ? i.getNamedItem("data-animation-path").value : i.getNamedItem("data-bm-path") ? i.getNamedItem("data-bm-path").value : i.getNamedItem("bm-path") ? i.getNamedItem("bm-path").value : "", r.animType = i.getNamedItem("data-anim-type") ? i.getNamedItem("data-anim-type").value : i.getNamedItem("data-bm-type") ? i.getNamedItem("data-bm-type").value : i.getNamedItem("bm-type") ? i.getNamedItem("bm-type").value : i.getNamedItem("data-bm-renderer") ? i.getNamedItem("data-bm-renderer").value : i.getNamedItem("bm-renderer") ? i.getNamedItem("bm-renderer").value : "canvas"; var s = i.getNamedItem("data-anim-loop") ? i.getNamedItem("data-anim-loop").value : i.getNamedItem("data-bm-loop") ? i.getNamedItem("data-bm-loop").value : i.getNamedItem("bm-loop") ? i.getNamedItem("bm-loop").value : ""; "" === s || (r.loop = "false" !== s && ("true" === s || parseInt(s))); var a = i.getNamedItem("data-anim-autoplay") ? i.getNamedItem("data-anim-autoplay").value : i.getNamedItem("data-bm-autoplay") ? i.getNamedItem("data-bm-autoplay").value : !i.getNamedItem("bm-autoplay") || i.getNamedItem("bm-autoplay").value; r.autoplay = "false" !== a, r.name = i.getNamedItem("data-name") ? i.getNamedItem("data-name").value : i.getNamedItem("data-bm-name") ? i.getNamedItem("data-bm-name").value : i.getNamedItem("bm-name") ? i.getNamedItem("bm-name").value : "", "false" === (i.getNamedItem("data-anim-prerender") ? i.getNamedItem("data-anim-prerender").value : i.getNamedItem("data-bm-prerender") ? i.getNamedItem("data-bm-prerender").value : i.getNamedItem("bm-prerender") ? i.getNamedItem("bm-prerender").value : "") && (r.prerender = !1), this.setParams(r) }, AnimationItem.prototype.includeLayers = function (t) { t.op > this.animationData.op && (this.animationData.op = t.op, this.totalFrames = Math.floor(t.op - this.animationData.ip)); var e, r, i = this.animationData.layers, s = i.length, a = t.layers, n = a.length; for (r = 0; r < n; r += 1)for (e = 0; e < s;) { if (i[e].id == a[r].id) { i[e] = a[r]; break } e += 1 } if ((t.chars || t.fonts) && (this.renderer.globalData.fontManager.addChars(t.chars), this.renderer.globalData.fontManager.addFonts(t.fonts, this.renderer.globalData.defs)), t.assets) for (s = t.assets.length, e = 0; e < s; e += 1)this.animationData.assets.push(t.assets[e]); this.animationData.__complete = !1, dataManager.completeData(this.animationData, this.renderer.globalData.fontManager), this.renderer.includeLayers(t.layers), expressionsPlugin && expressionsPlugin.initExpressions(this), this.loadNextSegment() }, AnimationItem.prototype.loadNextSegment = function () { var t = this.animationData.segments; if (!t || 0 === t.length || !this.autoloadSegments) return this.trigger("data_ready"), void (this.timeCompleted = this.totalFrames); var e = t.shift(); this.timeCompleted = e.time * this.frameRate; var r = this.path + this.fileName + "_" + this.segmentPos + ".json"; this.segmentPos += 1, assetLoader.load(r, this.includeLayers.bind(this), function () { this.trigger("data_failed") }.bind(this)) }, AnimationItem.prototype.loadSegments = function () { this.animationData.segments || (this.timeCompleted = this.totalFrames), this.loadNextSegment() }, AnimationItem.prototype.imagesLoaded = function () { this.trigger("loaded_images"), this.checkLoaded() }, AnimationItem.prototype.preloadImages = function () { this.imagePreloader.setAssetsPath(this.assetsPath), this.imagePreloader.setPath(this.path), this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this)) }, AnimationItem.prototype.configAnimation = function (t) { if (this.renderer) try { this.animationData = t, this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip), this.renderer.configAnimation(t), t.assets || (t.assets = []), this.assets = this.animationData.assets, this.frameRate = this.animationData.fr, this.firstFrame = Math.round(this.animationData.ip), this.frameMult = this.animationData.fr / 1e3, this.renderer.searchExtraCompositions(t.assets), this.trigger("config_ready"), this.preloadImages(), this.loadSegments(), this.updaFrameModifier(), this.waitForFontsLoaded() } catch (t) { this.triggerConfigError(t) } }, AnimationItem.prototype.waitForFontsLoaded = function () { this.renderer && (this.renderer.globalData.fontManager.loaded() ? this.checkLoaded() : setTimeout(this.waitForFontsLoaded.bind(this), 20)) }, AnimationItem.prototype.checkLoaded = function () { this.isLoaded || !this.renderer.globalData.fontManager.loaded() || !this.imagePreloader.loaded() && "canvas" === this.renderer.rendererType || (this.isLoaded = !0, dataManager.completeData(this.animationData, this.renderer.globalData.fontManager), expressionsPlugin && expressionsPlugin.initExpressions(this), this.renderer.initItems(), setTimeout(function () { this.trigger("DOMLoaded") }.bind(this), 0), this.gotoFrame(), this.autoplay && this.play()) }, AnimationItem.prototype.resize = function () { this.renderer.updateContainerSize() }, AnimationItem.prototype.setSubframe = function (t) { this.subframeEnabled = !!t }, AnimationItem.prototype.gotoFrame = function () { this.currentFrame = this.subframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame, this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted && (this.currentFrame = this.timeCompleted), this.trigger("enterFrame"), this.renderFrame() }, AnimationItem.prototype.renderFrame = function () { if (!1 !== this.isLoaded) try { this.renderer.renderFrame(this.currentFrame + this.firstFrame) } catch (t) { this.triggerRenderFrameError(t) } }, AnimationItem.prototype.play = function (t) { t && this.name != t || !0 === this.isPaused && (this.isPaused = !1, this._idle && (this._idle = !1, this.trigger("_active"))) }, AnimationItem.prototype.pause = function (t) { t && this.name != t || !1 === this.isPaused && (this.isPaused = !0, this._idle = !0, this.trigger("_idle")) }, AnimationItem.prototype.togglePause = function (t) { t && this.name != t || (!0 === this.isPaused ? this.play() : this.pause()) }, AnimationItem.prototype.stop = function (t) { t && this.name != t || (this.pause(), this.playCount = 0, this._completedLoop = !1, this.setCurrentRawFrameValue(0)) }, AnimationItem.prototype.goToAndStop = function (t, e, r) { r && this.name != r || (e ? this.setCurrentRawFrameValue(t) : this.setCurrentRawFrameValue(t * this.frameModifier), this.pause()) }, AnimationItem.prototype.goToAndPlay = function (t, e, r) { this.goToAndStop(t, e, r), this.play() }, AnimationItem.prototype.advanceTime = function (t) { if (!0 !== this.isPaused && !1 !== this.isLoaded) { var e = this.currentRawFrame + t * this.frameModifier, r = !1; e >= this.totalFrames - 1 && 0 < this.frameModifier ? this.loop && this.playCount !== this.loop ? e >= this.totalFrames ? (this.playCount += 1, this.checkSegments(e % this.totalFrames) || (this.setCurrentRawFrameValue(e % this.totalFrames), this._completedLoop = !0, this.trigger("loopComplete"))) : this.setCurrentRawFrameValue(e) : this.checkSegments(e > this.totalFrames ? e % this.totalFrames : 0) || (r = !0, e = this.totalFrames - 1) : e < 0 ? this.checkSegments(e % this.totalFrames) || (!this.loop || this.playCount-- <= 0 && !0 !== this.loop ? (r = !0, e = 0) : (this.setCurrentRawFrameValue(this.totalFrames + e % this.totalFrames), this._completedLoop ? this.trigger("loopComplete") : this._completedLoop = !0)) : this.setCurrentRawFrameValue(e), r && (this.setCurrentRawFrameValue(e), this.pause(), this.trigger("complete")) } }, AnimationItem.prototype.adjustSegment = function (t, e) { this.playCount = 0, t[1] < t[0] ? (0 < this.frameModifier && (this.playSpeed < 0 ? this.setSpeed(-this.playSpeed) : this.setDirection(-1)), this.timeCompleted = this.totalFrames = t[0] - t[1], this.firstFrame = t[1], this.setCurrentRawFrameValue(this.totalFrames - .001 - e)) : t[1] > t[0] && (this.frameModifier < 0 && (this.playSpeed < 0 ? this.setSpeed(-this.playSpeed) : this.setDirection(1)), this.timeCompleted = this.totalFrames = t[1] - t[0], this.firstFrame = t[0], this.setCurrentRawFrameValue(.001 + e)), this.trigger("segmentStart") }, AnimationItem.prototype.setSegment = function (t, e) { var r = -1; this.isPaused && (this.currentRawFrame + this.firstFrame < t ? r = t : this.currentRawFrame + this.firstFrame > e && (r = e - t)), this.firstFrame = t, this.timeCompleted = this.totalFrames = e - t, -1 !== r && this.goToAndStop(r, !0) }, AnimationItem.prototype.playSegments = function (t, e) { if (e && (this.segments.length = 0), "object" == typeof t[0]) { var r, i = t.length; for (r = 0; r < i; r += 1)this.segments.push(t[r]) } else this.segments.push(t); this.segments.length && e && this.adjustSegment(this.segments.shift(), 0), this.isPaused && this.play() }, AnimationItem.prototype.resetSegments = function (t) { this.segments.length = 0, this.segments.push([this.animationData.ip, this.animationData.op]), t && this.checkSegments(0) }, AnimationItem.prototype.checkSegments = function (t) { return !!this.segments.length && (this.adjustSegment(this.segments.shift(), t), !0) }, AnimationItem.prototype.destroy = function (t) { t && this.name != t || !this.renderer || (this.renderer.destroy(), this.imagePreloader.destroy(), this.trigger("destroy"), this._cbs = null, this.onEnterFrame = this.onLoopComplete = this.onComplete = this.onSegmentStart = this.onDestroy = null, this.renderer = null) }, AnimationItem.prototype.setCurrentRawFrameValue = function (t) { this.currentRawFrame = t, this.gotoFrame() }, AnimationItem.prototype.setSpeed = function (t) { this.playSpeed = t, this.updaFrameModifier() }, AnimationItem.prototype.setDirection = function (t) { this.playDirection = t < 0 ? -1 : 1, this.updaFrameModifier() }, AnimationItem.prototype.updaFrameModifier = function () { this.frameModifier = this.frameMult * this.playSpeed * this.playDirection }, AnimationItem.prototype.getPath = function () { return this.path }, AnimationItem.prototype.getAssetsPath = function (t) { var e = ""; if (t.e) e = t.p; else if (this.assetsPath) { var r = t.p; -1 !== r.indexOf("images/") && (r = r.split("/")[1]), e = this.assetsPath + r } else e = this.path, e += t.u ? t.u : "", e += t.p; return e }, AnimationItem.prototype.getAssetData = function (t) { for (var e = 0, r = this.assets.length; e < r;) { if (t == this.assets[e].id) return this.assets[e]; e += 1 } }, AnimationItem.prototype.hide = function () { this.renderer.hide() }, AnimationItem.prototype.show = function () { this.renderer.show() }, AnimationItem.prototype.getDuration = function (t) { return t ? this.totalFrames : this.totalFrames / this.frameRate }, AnimationItem.prototype.trigger = function (t) { if (this._cbs && this._cbs[t]) switch (t) { case "enterFrame": this.triggerEvent(t, new BMEnterFrameEvent(t, this.currentFrame, this.totalFrames, this.frameModifier)); break; case "loopComplete": this.triggerEvent(t, new BMCompleteLoopEvent(t, this.loop, this.playCount, this.frameMult)); break; case "complete": this.triggerEvent(t, new BMCompleteEvent(t, this.frameMult)); break; case "segmentStart": this.triggerEvent(t, new BMSegmentStartEvent(t, this.firstFrame, this.totalFrames)); break; case "destroy": this.triggerEvent(t, new BMDestroyEvent(t, this)); break; default: this.triggerEvent(t) }"enterFrame" === t && this.onEnterFrame && this.onEnterFrame.call(this, new BMEnterFrameEvent(t, this.currentFrame, this.totalFrames, this.frameMult)), "loopComplete" === t && this.onLoopComplete && this.onLoopComplete.call(this, new BMCompleteLoopEvent(t, this.loop, this.playCount, this.frameMult)), "complete" === t && this.onComplete && this.onComplete.call(this, new BMCompleteEvent(t, this.frameMult)), "segmentStart" === t && this.onSegmentStart && this.onSegmentStart.call(this, new BMSegmentStartEvent(t, this.firstFrame, this.totalFrames)), "destroy" === t && this.onDestroy && this.onDestroy.call(this, new BMDestroyEvent(t, this)) }, AnimationItem.prototype.triggerRenderFrameError = function (t) { var e = new BMRenderFrameErrorEvent(t, this.currentFrame); this.triggerEvent("error", e), this.onError && this.onError.call(this, e) }, AnimationItem.prototype.triggerConfigError = function (t) { var e = new BMConfigErrorEvent(t, this.currentFrame); this.triggerEvent("error", e), this.onError && this.onError.call(this, e) }; var Expressions = (HW = {}, HW.initExpressions = function (t) { var e = 0, r = []; function i() { var t, e = r.length; for (t = 0; t < e; t += 1)r[t].release(); r.length = 0 } t.renderer.compInterface = CompExpressionInterface(t.renderer), t.renderer.globalData.projectInterface.registerComposition(t.renderer), t.renderer.globalData.pushExpression = function () { e += 1 }, t.renderer.globalData.popExpression = function () { 0 == (e -= 1) && i() }, t.renderer.globalData.registerExpressionProperty = function (t) { -1 === r.indexOf(t) && r.push(t) } }, HW), HW; expressionsPlugin = Expressions; var ExpressionManager = function () { var ob = {}, Math = BMMath, window = null, document = null; function $bm_isInstanceOfArray(t) { return t.constructor === Array || t.constructor === Float32Array } function isNumerable(t, e) { return "number" === t || "boolean" === t || "string" === t || e instanceof Number } function $bm_neg(t) { var e = typeof t; if ("number" === e || "boolean" === e || t instanceof Number) return -t; if ($bm_isInstanceOfArray(t)) { var r, i = t.length, s = []; for (r = 0; r < i; r += 1)s[r] = -t[r]; return s } return t.propType ? t.v : void 0 } var easeInBez = BezierFactory.getBezierEasing(.333, 0, .833, .833, "easeIn").get, easeOutBez = BezierFactory.getBezierEasing(.167, .167, .667, 1, "easeOut").get, easeInOutBez = BezierFactory.getBezierEasing(.33, 0, .667, 1, "easeInOut").get; function sum(t, e) { var r = typeof t, i = typeof e; if ("string" === r || "string" === i) return t + e; if (isNumerable(r, t) && isNumerable(i, e)) return t + e; if ($bm_isInstanceOfArray(t) && isNumerable(i, e)) return (t = t.slice(0))[0] = t[0] + e, t; if (isNumerable(r, t) && $bm_isInstanceOfArray(e)) return (e = e.slice(0))[0] = t + e[0], e; if ($bm_isInstanceOfArray(t) && $bm_isInstanceOfArray(e)) { for (var s = 0, a = t.length, n = e.length, o = []; s < a || s < n;)("number" == typeof t[s] || t[s] instanceof Number) && ("number" == typeof e[s] || e[s] instanceof Number) ? o[s] = t[s] + e[s] : o[s] = void 0 === e[s] ? t[s] : t[s] || e[s], s += 1; return o } return 0 } var add = sum; function sub(t, e) { var r = typeof t, i = typeof e; if (isNumerable(r, t) && isNumerable(i, e)) return "string" === r && (t = parseInt(t)), "string" === i && (e = parseInt(e)), t - e; if ($bm_isInstanceOfArray(t) && isNumerable(i, e)) return (t = t.slice(0))[0] = t[0] - e, t; if (isNumerable(r, t) && $bm_isInstanceOfArray(e)) return (e = e.slice(0))[0] = t - e[0], e; if ($bm_isInstanceOfArray(t) && $bm_isInstanceOfArray(e)) { for (var s = 0, a = t.length, n = e.length, o = []; s < a || s < n;)("number" == typeof t[s] || t[s] instanceof Number) && ("number" == typeof e[s] || e[s] instanceof Number) ? o[s] = t[s] - e[s] : o[s] = void 0 === e[s] ? t[s] : t[s] || e[s], s += 1; return o } return 0 } function mul(t, e) { var r, i, s, a = typeof t, n = typeof e; if (isNumerable(a, t) && isNumerable(n, e)) return t * e; if ($bm_isInstanceOfArray(t) && isNumerable(n, e)) { for (s = t.length, r = createTypedArray("float32", s), i = 0; i < s; i += 1)r[i] = t[i] * e; return r } if (isNumerable(a, t) && $bm_isInstanceOfArray(e)) { for (s = e.length, r = createTypedArray("float32", s), i = 0; i < s; i += 1)r[i] = t * e[i]; return r } return 0 } function div(t, e) { var r, i, s, a = typeof t, n = typeof e; if (isNumerable(a, t) && isNumerable(n, e)) return t / e; if ($bm_isInstanceOfArray(t) && isNumerable(n, e)) { for (s = t.length, r = createTypedArray("float32", s), i = 0; i < s; i += 1)r[i] = t[i] / e; return r } if (isNumerable(a, t) && $bm_isInstanceOfArray(e)) { for (s = e.length, r = createTypedArray("float32", s), i = 0; i < s; i += 1)r[i] = t / e[i]; return r } return 0 } function mod(t, e) { return "string" == typeof t && (t = parseInt(t)), "string" == typeof e && (e = parseInt(e)), t % e } var $bm_sum = sum, $bm_sub = sub, $bm_mul = mul, $bm_div = div, $bm_mod = mod; function clamp(t, e, r) { if (r < e) { var i = r; r = e, e = i } return Math.min(Math.max(t, e), r) } function radiansToDegrees(t) { return t / degToRads } var radians_to_degrees = radiansToDegrees; function degreesToRadians(t) { return t * degToRads } var degrees_to_radians = radiansToDegrees, helperLengthArray = [0, 0, 0, 0, 0, 0]; function length(t, e) { if ("number" == typeof t || t instanceof Number) return e = e || 0, Math.abs(t - e); e || (e = helperLengthArray); var r, i = Math.min(t.length, e.length), s = 0; for (r = 0; r < i; r += 1)s += Math.pow(e[r] - t[r], 2); return Math.sqrt(s) } function normalize(t) { return div(t, length(t)) } function rgbToHsl(t) { var e, r, i = t[0], s = t[1], a = t[2], n = Math.max(i, s, a), o = Math.min(i, s, a), h = (n + o) / 2; if (n == o) e = r = 0; else { var l = n - o; switch (r = .5 < h ? l / (2 - n - o) : l / (n + o), n) { case i: e = (s - a) / l + (s < a ? 6 : 0); break; case s: e = (a - i) / l + 2; break; case a: e = (i - s) / l + 4 }e /= 6 } return [e, r, h, t[3]] } function hue2rgb(t, e, r) { return r < 0 && (r += 1), 1 < r && (r -= 1), r < 1 / 6 ? t + 6 * (e - t) * r : r < .5 ? e : r < 2 / 3 ? t + (e - t) * (2 / 3 - r) * 6 : t } function hslToRgb(t) { var e, r, i, s = t[0], a = t[1], n = t[2]; if (0 === a) e = r = i = n; else { var o = n < .5 ? n * (1 + a) : n + a - n * a, h = 2 * n - o; e = hue2rgb(h, o, s + 1 / 3), r = hue2rgb(h, o, s), i = hue2rgb(h, o, s - 1 / 3) } return [e, r, i, t[3]] } function linear(t, e, r, i, s) { if (void 0 !== i && void 0 !== s || (i = e, s = r, e = 0, r = 1), r < e) { var a = r; r = e, e = a } if (t <= e) return i; if (r <= t) return s; var n = r === e ? 0 : (t - e) / (r - e); if (!i.length) return i + (s - i) * n; var o, h = i.length, l = createTypedArray("float32", h); for (o = 0; o < h; o += 1)l[o] = i[o] + (s[o] - i[o]) * n; return l } function random(t, e) { if (void 0 === e && (void 0 === t ? (t = 0, e = 1) : (e = t, t = void 0)), e.length) { var r, i = e.length; t || (t = createTypedArray("float32", i)); var s = createTypedArray("float32", i), a = BMMath.random(); for (r = 0; r < i; r += 1)s[r] = t[r] + a * (e[r] - t[r]); return s } return void 0 === t && (t = 0), t + BMMath.random() * (e - t) } function createPath(t, e, r, i) { var s, a = t.length, n = shape_pool.newElement(); n.setPathData(!!i, a); var o, h, l = [0, 0]; for (s = 0; s < a; s += 1)o = e && e[s] ? e[s] : l, h = r && r[s] ? r[s] : l, n.setTripleAt(t[s][0], t[s][1], h[0] + t[s][0], h[1] + t[s][1], o[0] + t[s][0], o[1] + t[s][1], s, !0); return n } function initiateExpression(elem, data, property) { var val = data.x, needsVelocity = /velocity(?![\w\d])/.test(val), _needsRandom = -1 !== val.indexOf("random"), elemType = elem.data.ty, transform, $bm_transform, content, effect, thisProperty = property; thisProperty.valueAtTime = thisProperty.getValueAtTime, Object.defineProperty(thisProperty, "value", { get: function () { return thisProperty.v } }), elem.comp.frameDuration = 1 / elem.comp.globalData.frameRate, elem.comp.displayStartTime = 0; var inPoint = elem.data.ip / elem.comp.globalData.frameRate, outPoint = elem.data.op / elem.comp.globalData.frameRate, width = elem.data.sw ? elem.data.sw : 0, height = elem.data.sh ? elem.data.sh : 0, name = elem.data.nm, loopIn, loop_in, loopOut, loop_out, smooth, toWorld, fromWorld, fromComp, toComp, fromCompToSurface, position, rotation, anchorPoint, scale, thisLayer, thisComp, mask, valueAtTime, velocityAtTime, __expression_functions = [], scoped_bm_rt; if (data.xf) { var i, len = data.xf.length; for (i = 0; i < len; i += 1)__expression_functions[i] = eval("(function(){ return " + data.xf[i] + "}())") } var expression_function = eval("[function _expression_function(){" + val + ";scoped_bm_rt=$bm_rt}]")[0], numKeys = property.kf ? data.k.length : 0, active = !this.data || !0 !== this.data.hd, wiggle = function (t, e) { var r, i, s = this.pv.length ? this.pv.length : 1, a = createTypedArray("float32", s); var n = Math.floor(5 * time); for (i = r = 0; r < n;) { for (i = 0; i < s; i += 1)a[i] += -e + 2 * e * BMMath.random(); r += 1 } var o = 5 * time, h = o - Math.floor(o), l = createTypedArray("float32", s); if (1 < s) { for (i = 0; i < s; i += 1)l[i] = this.pv[i] + a[i] + (-e + 2 * e * BMMath.random()) * h; return l } return this.pv + a[0] + (-e + 2 * e * BMMath.random()) * h }.bind(this); function loopInDuration(t, e) { return loopIn(t, e, !0) } function loopOutDuration(t, e) { return loopOut(t, e, !0) } thisProperty.loopIn && (loopIn = thisProperty.loopIn.bind(thisProperty), loop_in = loopIn), thisProperty.loopOut && (loopOut = thisProperty.loopOut.bind(thisProperty), loop_out = loopOut), thisProperty.smooth && (smooth = thisProperty.smooth.bind(thisProperty)), this.getValueAtTime && (valueAtTime = this.getValueAtTime.bind(this)), this.getVelocityAtTime && (velocityAtTime = this.getVelocityAtTime.bind(this)); var comp = elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface), time, velocity, value, text, textIndex, textTotal, selectorValue; function lookAt(t, e) { var r = [e[0] - t[0], e[1] - t[1], e[2] - t[2]], i = Math.atan2(r[0], Math.sqrt(r[1] * r[1] + r[2] * r[2])) / degToRads; return [-Math.atan2(r[1], r[2]) / degToRads, i, 0] } function easeOut(t, e, r, i, s) { return applyEase(easeOutBez, t, e, r, i, s) } function easeIn(t, e, r, i, s) { return applyEase(easeInBez, t, e, r, i, s) } function ease(t, e, r, i, s) { return applyEase(easeInOutBez, t, e, r, i, s) } function applyEase(t, e, r, i, s, a) { void 0 === s ? (s = r, a = i) : e = (e - r) / (i - r); var n = t(e = 1 < e ? 1 : e < 0 ? 0 : e); if ($bm_isInstanceOfArray(s)) { var o, h = s.length, l = createTypedArray("float32", h); for (o = 0; o < h; o += 1)l[o] = (a[o] - s[o]) * n + s[o]; return l } return (a - s) * n + s } function nearestKey(t) { var e, r, i, s = data.k.length; if (data.k.length && "number" != typeof data.k[0]) if (r = -1, (t *= elem.comp.globalData.frameRate) < data.k[0].t) r = 1, i = data.k[0].t; else { for (e = 0; e < s - 1; e += 1) { if (t === data.k[e].t) { r = e + 1, i = data.k[e].t; break } if (t > data.k[e].t && t < data.k[e + 1].t) { i = t - data.k[e].t > data.k[e + 1].t - t ? (r = e + 2, data.k[e + 1].t) : (r = e + 1, data.k[e].t); break } } -1 === r && (r = e + 1, i = data.k[e].t) } else i = r = 0; var a = {}; return a.index = r, a.time = i / elem.comp.globalData.frameRate, a } function key(t) { var e, r, i; if (!data.k.length || "number" == typeof data.k[0]) throw new Error("The property has no keyframe at index " + t); t -= 1, e = { time: data.k[t].t / elem.comp.globalData.frameRate, value: [] }; var s = data.k[t].hasOwnProperty("s") ? data.k[t].s : data.k[t - 1].e; for (i = s.length, r = 0; r < i; r += 1)e[r] = s[r], e.value[r] = s[r]; return e } function framesToTime(t, e) { return e || (e = elem.comp.globalData.frameRate), t / e } function timeToFrames(t, e) { return t || 0 === t || (t = time), e || (e = elem.comp.globalData.frameRate), t * e } function seedRandom(t) { BMMath.seedrandom(randSeed + t) } function sourceRectAtTime() { return elem.sourceRectAtTime() } function substring(t, e) { return "string" == typeof value ? void 0 === e ? value.substring(t) : value.substring(t, e) : "" } function substr(t, e) { return "string" == typeof value ? void 0 === e ? value.substr(t) : value.substr(t, e) : "" } function posterizeTime(t) { time = 0 === t ? 0 : Math.floor(time * t) / t, value = valueAtTime(time) } var index = elem.data.ind, hasParent = !(!elem.hierarchy || !elem.hierarchy.length), parent, randSeed = Math.floor(1e6 * Math.random()), globalData = elem.globalData; function executeExpression(t) { return value = t, _needsRandom && seedRandom(randSeed), this.frameExpressionId === elem.globalData.frameId && "textSelector" !== this.propType ? value : ("textSelector" === this.propType && (textIndex = this.textIndex, textTotal = this.textTotal, selectorValue = this.selectorValue), thisLayer || (text = elem.layerInterface.text, thisLayer = elem.layerInterface, thisComp = elem.comp.compInterface, toWorld = thisLayer.toWorld.bind(thisLayer), fromWorld = thisLayer.fromWorld.bind(thisLayer), fromComp = thisLayer.fromComp.bind(thisLayer), toComp = thisLayer.toComp.bind(thisLayer), mask = thisLayer.mask ? thisLayer.mask.bind(thisLayer) : null, fromCompToSurface = fromComp), transform || (transform = elem.layerInterface("ADBE Transform Group"), ($bm_transform = transform) && (anchorPoint = transform.anchorPoint)), 4 !== elemType || content || (content = thisLayer("ADBE Root Vectors Group")), effect || (effect = thisLayer(4)), (hasParent = !(!elem.hierarchy || !elem.hierarchy.length)) && !parent && (parent = elem.hierarchy[0].layerInterface), time = this.comp.renderedFrame / this.comp.globalData.frameRate, needsVelocity && (velocity = velocityAtTime(time)), expression_function(), this.frameExpressionId = elem.globalData.frameId, "shape" === scoped_bm_rt.propType && (scoped_bm_rt = scoped_bm_rt.v), scoped_bm_rt) } return executeExpression } return ob.initiateExpression = initiateExpression, ob }(), expressionHelpers = { searchExpressions: function (t, e, r) { e.x && (r.k = !0, r.x = !0, r.initiateExpression = ExpressionManager.initiateExpression, r.effectsSequence.push(r.initiateExpression(t, e, r).bind(r))) }, getSpeedAtTime: function (t) { var e = this.getValueAtTime(t), r = this.getValueAtTime(t + -.01), i = 0; if (e.length) { var s; for (s = 0; s < e.length; s += 1)i += Math.pow(r[s] - e[s], 2); i = 100 * Math.sqrt(i) } else i = 0; return i }, getVelocityAtTime: function (t) { if (void 0 !== this.vel) return this.vel; var e, r, i = this.getValueAtTime(t), s = this.getValueAtTime(t + -.001); if (i.length) for (e = createTypedArray("float32", i.length), r = 0; r < i.length; r += 1)e[r] = (s[r] - i[r]) / -.001; else e = (s - i) / -.001; return e }, getValueAtTime: function (t) { return t *= this.elem.globalData.frameRate, (t -= this.offsetTime) !== this._cachingAtTime.lastFrame && (this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < t ? this._cachingAtTime.lastIndex : 0, this._cachingAtTime.value = this.interpolateValue(t, this._cachingAtTime), this._cachingAtTime.lastFrame = t), this._cachingAtTime.value }, getStaticValueAtTime: function () { return this.pv }, setGroupProperty: function (t) { this.propertyGroup = t } }; !function () { function o(t, e, r) { if (!this.k || !this.keyframes) return this.pv; t = t ? t.toLowerCase() : ""; var i, s, a, n, o, h = this.comp.renderedFrame, l = this.keyframes, p = l[l.length - 1].t; if (h <= p) return this.pv; if (r ? s = p - (i = e ? Math.abs(p - elem.comp.globalData.frameRate * e) : Math.max(0, p - this.elem.data.ip)) : ((!e || e > l.length - 1) && (e = l.length - 1), i = p - (s = l[l.length - 1 - e].t)), "pingpong" === t) { if (Math.floor((h - s) / i) % 2 != 0) return this.getValueAtTime((i - (h - s) % i + s) / this.comp.globalData.frameRate, 0) } else { if ("offset" === t) { var m = this.getValueAtTime(s / this.comp.globalData.frameRate, 0), f = this.getValueAtTime(p / this.comp.globalData.frameRate, 0), c = this.getValueAtTime(((h - s) % i + s) / this.comp.globalData.frameRate, 0), d = Math.floor((h - s) / i); if (this.pv.length) { for (n = (o = new Array(m.length)).length, a = 0; a < n; a += 1)o[a] = (f[a] - m[a]) * d + c[a]; return o } return (f - m) * d + c } if ("continue" === t) { var u = this.getValueAtTime(p / this.comp.globalData.frameRate, 0), y = this.getValueAtTime((p - .001) / this.comp.globalData.frameRate, 0); if (this.pv.length) { for (n = (o = new Array(u.length)).length, a = 0; a < n; a += 1)o[a] = u[a] + (u[a] - y[a]) * ((h - p) / this.comp.globalData.frameRate) / 5e-4; return o } return u + (h - p) / .001 * (u - y) } } return this.getValueAtTime(((h - s) % i + s) / this.comp.globalData.frameRate, 0) } function h(t, e, r) { if (!this.k) return this.pv; t = t ? t.toLowerCase() : ""; var i, s, a, n, o, h = this.comp.renderedFrame, l = this.keyframes, p = l[0].t; if (p <= h) return this.pv; if (r ? s = p + (i = e ? Math.abs(elem.comp.globalData.frameRate * e) : Math.max(0, this.elem.data.op - p)) : ((!e || e > l.length - 1) && (e = l.length - 1), i = (s = l[e].t) - p), "pingpong" === t) { if (Math.floor((p - h) / i) % 2 == 0) return this.getValueAtTime(((p - h) % i + p) / this.comp.globalData.frameRate, 0) } else { if ("offset" === t) { var m = this.getValueAtTime(p / this.comp.globalData.frameRate, 0), f = this.getValueAtTime(s / this.comp.globalData.frameRate, 0), c = this.getValueAtTime((i - (p - h) % i + p) / this.comp.globalData.frameRate, 0), d = Math.floor((p - h) / i) + 1; if (this.pv.length) { for (n = (o = new Array(m.length)).length, a = 0; a < n; a += 1)o[a] = c[a] - (f[a] - m[a]) * d; return o } return c - (f - m) * d } if ("continue" === t) { var u = this.getValueAtTime(p / this.comp.globalData.frameRate, 0), y = this.getValueAtTime((p + .001) / this.comp.globalData.frameRate, 0); if (this.pv.length) { for (n = (o = new Array(u.length)).length, a = 0; a < n; a += 1)o[a] = u[a] + (u[a] - y[a]) * (p - h) / .001; return o } return u + (u - y) * (p - h) / .001 } } return this.getValueAtTime((i - (p - h) % i + p) / this.comp.globalData.frameRate, 0) } function l(t, e) { if (!this.k) return this.pv; if (t = .5 * (t || .4), (e = Math.floor(e || 5)) <= 1) return this.pv; var r, i, s = this.comp.renderedFrame / this.comp.globalData.frameRate, a = s - t, n = 1 < e ? (s + t - a) / (e - 1) : 1, o = 0, h = 0; for (r = this.pv.length ? createTypedArray("float32", this.pv.length) : 0; o < e;) { if (i = this.getValueAtTime(a + o * n), this.pv.length) for (h = 0; h < this.pv.length; h += 1)r[h] += i[h]; else r += i; o += 1 } if (this.pv.length) for (h = 0; h < this.pv.length; h += 1)r[h] /= e; else r /= e; return r } var s = TransformPropertyFactory.getTransformProperty; TransformPropertyFactory.getTransformProperty = function (t, e, r) { var i = s(t, e, r); return i.dynamicProperties.length ? i.getValueAtTime = function (t) { console.warn("Transform at time not supported") }.bind(i) : i.getValueAtTime = function (t) { }.bind(i), i.setGroupProperty = expressionHelpers.setGroupProperty, i }; var p = PropertyFactory.getProp; PropertyFactory.getProp = function (t, e, r, i, s) { var a = p(t, e, r, i, s); a.kf ? a.getValueAtTime = expressionHelpers.getValueAtTime.bind(a) : a.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(a), a.setGroupProperty = expressionHelpers.setGroupProperty, a.loopOut = o, a.loopIn = h, a.smooth = l, a.getVelocityAtTime = expressionHelpers.getVelocityAtTime.bind(a), a.getSpeedAtTime = expressionHelpers.getSpeedAtTime.bind(a), a.numKeys = 1 === e.a ? e.k.length : 0, a.propertyIndex = e.ix; var n = 0; return 0 !== r && (n = createTypedArray("float32", 1 === e.a ? e.k[0].s.length : e.k.length)), a._cachingAtTime = { lastFrame: initialDefaultFrame, lastIndex: 0, value: n }, expressionHelpers.searchExpressions(t, e, a), a.k && s.addDynamicProperty(a), a }; var t = ShapePropertyFactory.getConstructorFunction(), e = ShapePropertyFactory.getKeyframedConstructorFunction(); function r() { } r.prototype = { vertices: function (t, e) { this.k && this.getValue(); var r = this.v; void 0 !== e && (r = this.getValueAtTime(e, 0)); var i, s = r._length, a = r[t], n = r.v, o = createSizedArray(s); for (i = 0; i < s; i += 1)o[i] = "i" === t || "o" === t ? [a[i][0] - n[i][0], a[i][1] - n[i][1]] : [a[i][0], a[i][1]]; return o }, points: function (t) { return this.vertices("v", t) }, inTangents: function (t) { return this.vertices("i", t) }, outTangents: function (t) { return this.vertices("o", t) }, isClosed: function () { return this.v.c }, pointOnPath: function (t, e) { var r = this.v; void 0 !== e && (r = this.getValueAtTime(e, 0)), this._segmentsLength || (this._segmentsLength = bez.getSegmentsLength(r)); for (var i, s = this._segmentsLength, a = s.lengths, n = s.totalLength * t, o = 0, h = a.length, l = 0; o < h;) { if (l + a[o].addedLength > n) { var p = o, m = r.c && o === h - 1 ? 0 : o + 1, f = (n - l) / a[o].addedLength; i = bez.getPointInSegment(r.v[p], r.v[m], r.o[p], r.i[m], f, a[o]); break } l += a[o].addedLength, o += 1 } return i || (i = r.c ? [r.v[0][0], r.v[0][1]] : [r.v[r._length - 1][0], r.v[r._length - 1][1]]), i }, vectorOnPath: function (t, e, r) { t = 1 == t ? this.v.c ? 0 : .999 : t; var i = this.pointOnPath(t, e), s = this.pointOnPath(t + .001, e), a = s[0] - i[0], n = s[1] - i[1], o = Math.sqrt(Math.pow(a, 2) + Math.pow(n, 2)); return 0 === o ? [0, 0] : "tangent" === r ? [a / o, n / o] : [-n / o, a / o] }, tangentOnPath: function (t, e) { return this.vectorOnPath(t, e, "tangent") }, normalOnPath: function (t, e) { return this.vectorOnPath(t, e, "normal") }, setGroupProperty: expressionHelpers.setGroupProperty, getValueAtTime: expressionHelpers.getStaticValueAtTime }, extendPrototype([r], t), extendPrototype([r], e), e.prototype.getValueAtTime = function (t) { return this._cachingAtTime || (this._cachingAtTime = { shapeValue: shape_pool.clone(this.pv), lastIndex: 0, lastTime: initialDefaultFrame }), t *= this.elem.globalData.frameRate, (t -= this.offsetTime) !== this._cachingAtTime.lastTime && (this._cachingAtTime.lastIndex = this._cachingAtTime.lastTime < t ? this._caching.lastIndex : 0, this._cachingAtTime.lastTime = t, this.interpolateShape(t, this._cachingAtTime.shapeValue, this._cachingAtTime)), this._cachingAtTime.shapeValue }, e.prototype.initiateExpression = ExpressionManager.initiateExpression; var n = ShapePropertyFactory.getShapeProp; ShapePropertyFactory.getShapeProp = function (t, e, r, i, s) { var a = n(t, e, r, i, s); return a.propertyIndex = e.ix, a.lock = !1, 3 === r ? expressionHelpers.searchExpressions(t, e.pt, a) : 4 === r && expressionHelpers.searchExpressions(t, e.ks, a), a.k && t.addDynamicProperty(a), a } }(), TextProperty.prototype.getExpressionValue = function (t, e) { var r = this.calculateExpression(e); if (t.t === r) return t; var i = {}; return this.copyData(i, t), i.t = r.toString(), i.__complete = !1, i }, TextProperty.prototype.searchProperty = function () { var t = this.searchKeyframes(), e = this.searchExpressions(); return this.kf = t || e, this.kf }, TextProperty.prototype.searchExpressions = function () { if (this.data.d.x) return this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem, this.data.d, this), this.addEffect(this.getExpressionValue.bind(this)), !0 }; var ShapeExpressionInterface = function () { function m(t, e, r) { var i, s = [], a = t ? t.length : 0; for (i = 0; i < a; i += 1)"gr" == t[i].ty ? s.push(n(t[i], e[i], r)) : "fl" == t[i].ty ? s.push(o(t[i], e[i], r)) : "st" == t[i].ty ? s.push(h(t[i], e[i], r)) : "tm" == t[i].ty ? s.push(l(t[i], e[i], r)) : "tr" == t[i].ty || ("el" == t[i].ty ? s.push(p(t[i], e[i], r)) : "sr" == t[i].ty ? s.push(f(t[i], e[i], r)) : "sh" == t[i].ty ? s.push(y(t[i], e[i], r)) : "rc" == t[i].ty ? s.push(c(t[i], e[i], r)) : "rd" == t[i].ty ? s.push(d(t[i], e[i], r)) : "rp" == t[i].ty && s.push(u(t[i], e[i], r))); return s } function n(t, e, r) { var i = function (t) { switch (t) { case "ADBE Vectors Group": case "Contents": case 2: return i.content; default: return i.transform } }; i.propertyGroup = function (t) { return 1 === t ? i : r(t - 1) }; var s, a, n, o, h, l = (s = t, a = e, n = i.propertyGroup, (h = function (t) { for (var e = 0, r = o.length; e < r;) { if (o[e]._name === t || o[e].mn === t || o[e].propertyIndex === t || o[e].ix === t || o[e].ind === t) return o[e]; e += 1 } if ("number" == typeof t) return o[t - 1] }).propertyGroup = function (t) { return 1 === t ? h : n(t - 1) }, o = m(s.it, a.it, h.propertyGroup), h.numProperties = o.length, h.propertyIndex = s.cix, h._name = s.nm, h), p = function (e, t, r) { function i(t) { return 1 == t ? s : r(--t) } t.transform.mProps.o.setGroupProperty(i), t.transform.mProps.p.setGroupProperty(i), t.transform.mProps.a.setGroupProperty(i), t.transform.mProps.s.setGroupProperty(i), t.transform.mProps.r.setGroupProperty(i), t.transform.mProps.sk && (t.transform.mProps.sk.setGroupProperty(i), t.transform.mProps.sa.setGroupProperty(i)); function s(t) { return e.a.ix === t || "Anchor Point" === t ? s.anchorPoint : e.o.ix === t || "Opacity" === t ? s.opacity : e.p.ix === t || "Position" === t ? s.position : e.r.ix === t || "Rotation" === t || "ADBE Vector Rotation" === t ? s.rotation : e.s.ix === t || "Scale" === t ? s.scale : e.sk && e.sk.ix === t || "Skew" === t ? s.skew : e.sa && e.sa.ix === t || "Skew Axis" === t ? s.skewAxis : void 0 } return t.transform.op.setGroupProperty(i), Object.defineProperties(s, { opacity: { get: ExpressionPropertyInterface(t.transform.mProps.o) }, position: { get: ExpressionPropertyInterface(t.transform.mProps.p) }, anchorPoint: { get: ExpressionPropertyInterface(t.transform.mProps.a) }, scale: { get: ExpressionPropertyInterface(t.transform.mProps.s) }, rotation: { get: ExpressionPropertyInterface(t.transform.mProps.r) }, skew: { get: ExpressionPropertyInterface(t.transform.mProps.sk) }, skewAxis: { get: ExpressionPropertyInterface(t.transform.mProps.sa) }, _name: { value: e.nm } }), s.ty = "tr", s.mn = e.mn, s.propertyGroup = r, s }(t.it[t.it.length - 1], e.it[e.it.length - 1], i.propertyGroup); return i.content = l, i.transform = p, Object.defineProperty(i, "_name", { get: function () { return t.nm } }), i.numProperties = t.np, i.propertyIndex = t.ix, i.nm = t.nm, i.mn = t.mn, i } function o(t, e, r) { function i(t) { return "Color" === t || "color" === t ? i.color : "Opacity" === t || "opacity" === t ? i.opacity : void 0 } return Object.defineProperties(i, { color: { get: ExpressionPropertyInterface(e.c) }, opacity: { get: ExpressionPropertyInterface(e.o) }, _name: { value: t.nm }, mn: { value: t.mn } }), e.c.setGroupProperty(r), e.o.setGroupProperty(r), i } function h(t, e, r) { function i(t) { return 1 === t ? ob : r(t - 1) } function s(t) { return 1 === t ? h : i(t - 1) } var a, n, o = t.d ? t.d.length : 0, h = {}; for (a = 0; a < o; a += 1)n = a, Object.defineProperty(h, t.d[n].nm, { get: ExpressionPropertyInterface(e.d.dataProps[n].p) }), e.d.dataProps[a].p.setGroupProperty(s); function l(t) { return "Color" === t || "color" === t ? l.color : "Opacity" === t || "opacity" === t ? l.opacity : "Stroke Width" === t || "stroke width" === t ? l.strokeWidth : void 0 } return Object.defineProperties(l, { color: { get: ExpressionPropertyInterface(e.c) }, opacity: { get: ExpressionPropertyInterface(e.o) }, strokeWidth: { get: ExpressionPropertyInterface(e.w) }, dash: { get: function () { return h } }, _name: { value: t.nm }, mn: { value: t.mn } }), e.c.setGroupProperty(i), e.o.setGroupProperty(i), e.w.setGroupProperty(i), l } function l(e, t, r) { function i(t) { return 1 == t ? s : r(--t) } function s(t) { return t === e.e.ix || "End" === t || "end" === t ? s.end : t === e.s.ix ? s.start : t === e.o.ix ? s.offset : void 0 } return s.propertyIndex = e.ix, t.s.setGroupProperty(i), t.e.setGroupProperty(i), t.o.setGroupProperty(i), s.propertyIndex = e.ix, s.propertyGroup = r, Object.defineProperties(s, { start: { get: ExpressionPropertyInterface(t.s) }, end: { get: ExpressionPropertyInterface(t.e) }, offset: { get: ExpressionPropertyInterface(t.o) }, _name: { value: e.nm } }), s.mn = e.mn, s } function p(e, t, r) { function i(t) { return 1 == t ? a : r(--t) } a.propertyIndex = e.ix; var s = "tm" === t.sh.ty ? t.sh.prop : t.sh; function a(t) { return e.p.ix === t ? a.position : e.s.ix === t ? a.size : void 0 } return s.s.setGroupProperty(i), s.p.setGroupProperty(i), Object.defineProperties(a, { size: { get: ExpressionPropertyInterface(s.s) }, position: { get: ExpressionPropertyInterface(s.p) }, _name: { value: e.nm } }), a.mn = e.mn, a } function f(e, t, r) { function i(t) { return 1 == t ? a : r(--t) } var s = "tm" === t.sh.ty ? t.sh.prop : t.sh; function a(t) { return e.p.ix === t ? a.position : e.r.ix === t ? a.rotation : e.pt.ix === t ? a.points : e.or.ix === t || "ADBE Vector Star Outer Radius" === t ? a.outerRadius : e.os.ix === t ? a.outerRoundness : !e.ir || e.ir.ix !== t && "ADBE Vector Star Inner Radius" !== t ? e.is && e.is.ix === t ? a.innerRoundness : void 0 : a.innerRadius } return a.propertyIndex = e.ix, s.or.setGroupProperty(i), s.os.setGroupProperty(i), s.pt.setGroupProperty(i), s.p.setGroupProperty(i), s.r.setGroupProperty(i), e.ir && (s.ir.setGroupProperty(i), s.is.setGroupProperty(i)), Object.defineProperties(a, { position: { get: ExpressionPropertyInterface(s.p) }, rotation: { get: ExpressionPropertyInterface(s.r) }, points: { get: ExpressionPropertyInterface(s.pt) }, outerRadius: { get: ExpressionPropertyInterface(s.or) }, outerRoundness: { get: ExpressionPropertyInterface(s.os) }, innerRadius: { get: ExpressionPropertyInterface(s.ir) }, innerRoundness: { get: ExpressionPropertyInterface(s.is) }, _name: { value: e.nm } }), a.mn = e.mn, a } function c(e, t, r) { function i(t) { return 1 == t ? a : r(--t) } var s = "tm" === t.sh.ty ? t.sh.prop : t.sh; function a(t) { return e.p.ix === t ? a.position : e.r.ix === t ? a.roundness : e.s.ix === t || "Size" === t || "ADBE Vector Rect Size" === t ? a.size : void 0 } return a.propertyIndex = e.ix, s.p.setGroupProperty(i), s.s.setGroupProperty(i), s.r.setGroupProperty(i), Object.defineProperties(a, { position: { get: ExpressionPropertyInterface(s.p) }, roundness: { get: ExpressionPropertyInterface(s.r) }, size: { get: ExpressionPropertyInterface(s.s) }, _name: { value: e.nm } }), a.mn = e.mn, a } function d(e, t, r) { var i = t; function s(t) { if (e.r.ix === t || "Round Corners 1" === t) return s.radius } return s.propertyIndex = e.ix, i.rd.setGroupProperty(function (t) { return 1 == t ? s : r(--t) }), Object.defineProperties(s, { radius: { get: ExpressionPropertyInterface(i.rd) }, _name: { value: e.nm } }), s.mn = e.mn, s } function u(e, t, r) { function i(t) { return 1 == t ? a : r(--t) } var s = t; function a(t) { return e.c.ix === t || "Copies" === t ? a.copies : e.o.ix === t || "Offset" === t ? a.offset : void 0 } return a.propertyIndex = e.ix, s.c.setGroupProperty(i), s.o.setGroupProperty(i), Object.defineProperties(a, { copies: { get: ExpressionPropertyInterface(s.c) }, offset: { get: ExpressionPropertyInterface(s.o) }, _name: { value: e.nm } }), a.mn = e.mn, a } function y(t, e, r) { var i = e.sh; function s(t) { if ("Shape" === t || "shape" === t || "Path" === t || "path" === t || "ADBE Vector Shape" === t || 2 === t) return s.path } return i.setGroupProperty(function (t) { return 1 == t ? s : r(--t) }), Object.defineProperties(s, { path: { get: function () { return i.k && i.getValue(), i } }, shape: { get: function () { return i.k && i.getValue(), i } }, _name: { value: t.nm }, ix: { value: t.ix }, propertyIndex: { value: t.ix }, mn: { value: t.mn } }), s } return function (t, e, r) { var i; function s(t) { if ("number" == typeof t) return i[t - 1]; for (var e = 0, r = i.length; e < r;) { if (i[e]._name === t) return i[e]; e += 1 } } return s.propertyGroup = r, i = m(t, e, s), s.numProperties = i.length, s } }(), TextExpressionInterface = function (e) { var r; function t() { } return Object.defineProperty(t, "sourceText", { get: function () { e.textProperty.getValue(); var t = e.textProperty.currentData.t; return void 0 !== t && (e.textProperty.currentData.t = void 0, (r = new String(t)).value = t || new String(t)), r } }), t }, LayerExpressionInterface = function () { function s(t, e) { var r = new Matrix; if (r.reset(), this._elem.finalTransform.mProp.applyToMatrix(r), this._elem.hierarchy && this._elem.hierarchy.length) { var i, s = this._elem.hierarchy.length; for (i = 0; i < s; i += 1)this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(r); return r.applyToPointArray(t[0], t[1], t[2] || 0) } return r.applyToPointArray(t[0], t[1], t[2] || 0) } function a(t, e) { var r = new Matrix; if (r.reset(), this._elem.finalTransform.mProp.applyToMatrix(r), this._elem.hierarchy && this._elem.hierarchy.length) { var i, s = this._elem.hierarchy.length; for (i = 0; i < s; i += 1)this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(r); return r.inversePoint(t) } return r.inversePoint(t) } function n(t) { var e = new Matrix; if (e.reset(), this._elem.finalTransform.mProp.applyToMatrix(e), this._elem.hierarchy && this._elem.hierarchy.length) { var r, i = this._elem.hierarchy.length; for (r = 0; r < i; r += 1)this._elem.hierarchy[r].finalTransform.mProp.applyToMatrix(e); return e.inversePoint(t) } return e.inversePoint(t) } function o() { return [1, 1, 1, 1] } return function (e) { var r; function i(t) { switch (t) { case "ADBE Root Vectors Group": case "Contents": case 2: return i.shapeInterface; case 1: case 6: case "Transform": case "transform": case "ADBE Transform Group": return r; case 4: case "ADBE Effect Parade": case "effects": case "Effects": return i.effect } } i.toWorld = s, i.fromWorld = a, i.toComp = s, i.fromComp = n, i.sampleImage = o, i.sourceRectAtTime = e.sourceRectAtTime.bind(e); var t = getDescriptor(r = TransformExpressionInterface((i._elem = e).finalTransform.mProp), "anchorPoint"); return Object.defineProperties(i, { hasParent: { get: function () { return e.hierarchy.length } }, parent: { get: function () { return e.hierarchy[0].layerInterface } }, rotation: getDescriptor(r, "rotation"), scale: getDescriptor(r, "scale"), position: getDescriptor(r, "position"), opacity: getDescriptor(r, "opacity"), anchorPoint: t, anchor_point: t, transform: { get: function () { return r } }, active: { get: function () { return e.isInRange } } }), i.startTime = e.data.st, i.index = e.data.ind, i.source = e.data.refId, i.height = 0 === e.data.ty ? e.data.h : 100, i.width = 0 === e.data.ty ? e.data.w : 100, i.inPoint = e.data.ip / e.comp.globalData.frameRate, i.outPoint = e.data.op / e.comp.globalData.frameRate, i._name = e.data.nm, i.registerMaskInterface = function (t) { i.mask = new MaskManagerInterface(t, e) }, i.registerEffectsInterface = function (t) { i.effect = t }, i } }(), CompExpressionInterface = function (i) { function t(t) { for (var e = 0, r = i.layers.length; e < r;) { if (i.layers[e].nm === t || i.layers[e].ind === t) return i.elements[e].layerInterface; e += 1 } return null } return Object.defineProperty(t, "_name", { value: i.data.nm }), (t.layer = t).pixelAspect = 1, t.height = i.data.h || i.globalData.compSize.h, t.width = i.data.w || i.globalData.compSize.w, t.pixelAspect = 1, t.frameDuration = 1 / i.globalData.frameRate, t.displayStartTime = 0, t.numLayers = i.layers.length, t }, TransformExpressionInterface = function (t) { function e(t) { switch (t) { case "scale": case "Scale": case "ADBE Scale": case 6: return e.scale; case "rotation": case "Rotation": case "ADBE Rotation": case "ADBE Rotate Z": case 10: return e.rotation; case "ADBE Rotate X": return e.xRotation; case "ADBE Rotate Y": return e.yRotation; case "position": case "Position": case "ADBE Position": case 2: return e.position; case "ADBE Position_0": return e.xPosition; case "ADBE Position_1": return e.yPosition; case "ADBE Position_2": return e.zPosition; case "anchorPoint": case "AnchorPoint": case "Anchor Point": case "ADBE AnchorPoint": case 1: return e.anchorPoint; case "opacity": case "Opacity": case 11: return e.opacity } } if (Object.defineProperty(e, "rotation", { get: ExpressionPropertyInterface(t.r || t.rz) }), Object.defineProperty(e, "zRotation", { get: ExpressionPropertyInterface(t.rz || t.r) }), Object.defineProperty(e, "xRotation", { get: ExpressionPropertyInterface(t.rx) }), Object.defineProperty(e, "yRotation", { get: ExpressionPropertyInterface(t.ry) }), Object.defineProperty(e, "scale", { get: ExpressionPropertyInterface(t.s) }), t.p) var r = ExpressionPropertyInterface(t.p); return Object.defineProperty(e, "position", { get: function () { return t.p ? r() : [t.px.v, t.py.v, t.pz ? t.pz.v : 0] } }), Object.defineProperty(e, "xPosition", { get: ExpressionPropertyInterface(t.px) }), Object.defineProperty(e, "yPosition", { get: ExpressionPropertyInterface(t.py) }), Object.defineProperty(e, "zPosition", { get: ExpressionPropertyInterface(t.pz) }), Object.defineProperty(e, "anchorPoint", { get: ExpressionPropertyInterface(t.a) }), Object.defineProperty(e, "opacity", { get: ExpressionPropertyInterface(t.o) }), Object.defineProperty(e, "skew", { get: ExpressionPropertyInterface(t.sk) }), Object.defineProperty(e, "skewAxis", { get: ExpressionPropertyInterface(t.sa) }), Object.defineProperty(e, "orientation", { get: ExpressionPropertyInterface(t.or) }), e }, ProjectInterface = function () { function e(t) { this.compositions.push(t) } return function () { function t(t) { for (var e = 0, r = this.compositions.length; e < r;) { if (this.compositions[e].data && this.compositions[e].data.nm === t) return this.compositions[e].prepareFrame && this.compositions[e].data.xt && this.compositions[e].prepareFrame(this.currentFrame), this.compositions[e].compInterface; e += 1 } } return t.compositions = [], t.currentFrame = 0, t.registerComposition = e, t } }(), EffectsExpressionInterface = function () { function l(s, t, e, r) { var i, a = [], n = s.ef.length; for (i = 0; i < n; i += 1)5 === s.ef[i].ty ? a.push(l(s.ef[i], t.effectElements[i], t.effectElements[i].propertyGroup, r)) : a.push(p(t.effectElements[i], s.ef[i].ty, r, o)); function o(t) { return 1 === t ? h : e(t - 1) } var h = function (t) { for (var e = s.ef, r = 0, i = e.length; r < i;) { if (t === e[r].nm || t === e[r].mn || t === e[r].ix) return 5 === e[r].ty ? a[r] : a[r](); r += 1 } return a[0]() }; return h.propertyGroup = o, "ADBE Color Control" === s.mn && Object.defineProperty(h, "color", { get: function () { return a[0]() } }), Object.defineProperty(h, "numProperties", { get: function () { return s.np } }), h.active = h.enabled = 0 !== s.en, h } function p(t, e, r, i) { var s = ExpressionPropertyInterface(t.p); return t.p.setGroupProperty && t.p.setGroupProperty(i), function () { return 10 === e ? r.comp.compInterface(t.p.v) : s() } } return { createEffectsInterface: function (s, t) { if (s.effectsManager) { var e, a = [], r = s.data.ef, i = s.effectsManager.effectElements.length; for (e = 0; e < i; e += 1)a.push(l(r[e], s.effectsManager.effectElements[e], t, s)); return function (t) { for (var e = s.data.ef || [], r = 0, i = e.length; r < i;) { if (t === e[r].nm || t === e[r].mn || t === e[r].ix) return a[r]; r += 1 } } } } } }(), MaskManagerInterface = function () { function a(t, e) { this._mask = t, this._data = e } Object.defineProperty(a.prototype, "maskPath", { get: function () { return this._mask.prop.k && this._mask.prop.getValue(), this._mask.prop } }), Object.defineProperty(a.prototype, "maskOpacity", { get: function () { return this._mask.op.k && this._mask.op.getValue(), 100 * this._mask.op.v } }); return function (e, t) { var r, i = createSizedArray(e.viewData.length), s = e.viewData.length; for (r = 0; r < s; r += 1)i[r] = new a(e.viewData[r], e.masksProperties[r]); return function (t) { for (r = 0; r < s;) { if (e.masksProperties[r].nm === t) return i[r]; r += 1 } } } }(), ExpressionPropertyInterface = function () { var s = { pv: 0, v: 0, mult: 1 }, n = { pv: [0, 0, 0], v: [0, 0, 0], mult: 1 }; function o(i, s, a) { Object.defineProperty(i, "velocity", { get: function () { return s.getVelocityAtTime(s.comp.currentFrame) } }), i.numKeys = s.keyframes ? s.keyframes.length : 0, i.key = function (t) { if (i.numKeys) { var e = ""; e = "s" in s.keyframes[t - 1] ? s.keyframes[t - 1].s : "e" in s.keyframes[t - 2] ? s.keyframes[t - 2].e : s.keyframes[t - 2].s; var r = "unidimensional" === a ? new Number(e) : Object.assign({}, e); return r.time = s.keyframes[t - 1].t / s.elem.comp.globalData.frameRate, r } return 0 }, i.valueAtTime = s.getValueAtTime, i.speedAtTime = s.getSpeedAtTime, i.velocityAtTime = s.getVelocityAtTime, i.propertyGroup = s.propertyGroup } function e() { return s } return function (t) { return t ? "unidimensional" === t.propType ? function (t) { t && "pv" in t || (t = s); var e = 1 / t.mult, r = t.pv * e, i = new Number(r); return i.value = r, o(i, t, "unidimensional"), function () { return t.k && t.getValue(), r = t.v * e, i.value !== r && ((i = new Number(r)).value = r, o(i, t, "unidimensional")), i } }(t) : function (e) { e && "pv" in e || (e = n); var r = 1 / e.mult, i = e.pv.length, s = createTypedArray("float32", i), a = createTypedArray("float32", i); return s.value = a, o(s, e, "multidimensional"), function () { e.k && e.getValue(); for (var t = 0; t < i; t += 1)s[t] = a[t] = e.v[t] * r; return s } }(t) : e } }(), q5, r5; function SliderEffect(t, e, r) { this.p = PropertyFactory.getProp(e, t.v, 0, 0, r) } function AngleEffect(t, e, r) { this.p = PropertyFactory.getProp(e, t.v, 0, 0, r) } function ColorEffect(t, e, r) { this.p = PropertyFactory.getProp(e, t.v, 1, 0, r) } function PointEffect(t, e, r) { this.p = PropertyFactory.getProp(e, t.v, 1, 0, r) } function LayerIndexEffect(t, e, r) { this.p = PropertyFactory.getProp(e, t.v, 0, 0, r) } function MaskIndexEffect(t, e, r) { this.p = PropertyFactory.getProp(e, t.v, 0, 0, r) } function CheckboxEffect(t, e, r) { this.p = PropertyFactory.getProp(e, t.v, 0, 0, r) } function NoValueEffect() { this.p = {} } function EffectsManager() { } function EffectsManager(t, e) { var r = t.ef || []; this.effectElements = []; var i, s, a = r.length; for (i = 0; i < a; i++)s = new GroupEffect(r[i], e), this.effectElements.push(s) } function GroupEffect(t, e) { this.init(t, e) } q5 = function () { function r(t, e) { return this.textIndex = t + 1, this.textTotal = e, this.v = this.getValue() * this.mult, this.v } return function (t, e) { this.pv = 1, this.comp = t.comp, this.elem = t, this.mult = .01, this.propType = "textSelector", this.textTotal = e.totalChars, this.selectorValue = 100, this.lastValue = [1, 1, 1], this.k = !0, this.x = !0, this.getValue = ExpressionManager.initiateExpression.bind(this)(t, e, this), this.getMult = r, this.getVelocityAtTime = expressionHelpers.getVelocityAtTime, this.kf ? this.getValueAtTime = expressionHelpers.getValueAtTime.bind(this) : this.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(this), this.setGroupProperty = expressionHelpers.setGroupProperty } }(), r5 = TextSelectorProp.getTextSelectorProp, TextSelectorProp.getTextSelectorProp = function (t, e, r) { return 1 === e.t ? new q5(t, e, r) : r5(t, e, r) }, extendPrototype([DynamicPropertyContainer], GroupEffect), GroupEffect.prototype.getValue = GroupEffect.prototype.iterateDynamicProperties, GroupEffect.prototype.init = function (t, e) { this.data = t, this.effectElements = [], this.initDynamicPropertyContainer(e); var r, i, s = this.data.ef.length, a = this.data.ef; for (r = 0; r < s; r += 1) { switch (i = null, a[r].ty) { case 0: i = new SliderEffect(a[r], e, this); break; case 1: i = new AngleEffect(a[r], e, this); break; case 2: i = new ColorEffect(a[r], e, this); break; case 3: i = new PointEffect(a[r], e, this); break; case 4: case 7: i = new CheckboxEffect(a[r], e, this); break; case 10: i = new LayerIndexEffect(a[r], e, this); break; case 11: i = new MaskIndexEffect(a[r], e, this); break; case 5: i = new EffectsManager(a[r], e, this); break; default: i = new NoValueEffect(a[r], e, this) }i && this.effectElements.push(i) } }; var lottie = {}, _isFrozen = !1; function setLocationHref(t) { locationHref = t } function searchAnimations() { !0 === standalone ? animationManager.searchAnimations(animationData, standalone, renderer) : animationManager.searchAnimations() } function setSubframeRendering(t) { subframeEnabled = t } function loadAnimation(t) { return !0 === standalone && (t.animationData = JSON.parse(animationData)), animationManager.loadAnimation(t) } function setQuality(t) { if ("string" == typeof t) switch (t) { case "high": defaultCurveSegments = 200; break; case "medium": defaultCurveSegments = 50; break; case "low": defaultCurveSegments = 10 } else !isNaN(t) && 1 < t && (defaultCurveSegments = t); roundValues(!(50 <= defaultCurveSegments)) } function inBrowser() { return "undefined" != typeof navigator } function installPlugin(t, e) { "expressions" === t && (expressionsPlugin = e) } function getFactory(t) { switch (t) { case "propertyFactory": return PropertyFactory; case "shapePropertyFactory": return ShapePropertyFactory; case "matrix": return Matrix } } function checkReady() { "complete" === document.readyState && (clearInterval(readyStateCheckInterval), searchAnimations()) } function getQueryVariable(t) { for (var e = queryString.split("&"), r = 0; r < e.length; r++) { var i = e[r].split("="); if (decodeURIComponent(i[0]) == t) return decodeURIComponent(i[1]) } } lottie.play = animationManager.play, lottie.pause = animationManager.pause, lottie.setLocationHref = setLocationHref, lottie.togglePause = animationManager.togglePause, lottie.setSpeed = animationManager.setSpeed, lottie.setDirection = animationManager.setDirection, lottie.stop = animationManager.stop, lottie.searchAnimations = searchAnimations, lottie.registerAnimation = animationManager.registerAnimation, lottie.loadAnimation = loadAnimation, lottie.setSubframeRendering = setSubframeRendering, lottie.resize = animationManager.resize, lottie.goToAndStop = animationManager.goToAndStop, lottie.destroy = animationManager.destroy, lottie.setQuality = setQuality, lottie.inBrowser = inBrowser, lottie.installPlugin = installPlugin, lottie.freeze = animationManager.freeze, lottie.unfreeze = animationManager.unfreeze, lottie.getRegisteredAnimations = animationManager.getRegisteredAnimations, lottie.__getFactory = getFactory, lottie.version = "5.6.4"; var standalone = "__[STANDALONE]__", animationData = "__[ANIMATIONDATA]__", renderer = ""; if (standalone) { var scripts = document.getElementsByTagName("script"), index = scripts.length - 1, myScript = scripts[index] || { src: "" }, queryString = myScript.src.replace(/^[^\?]+\??/, ""); renderer = getQueryVariable("renderer") } var readyStateCheckInterval = setInterval(checkReady, 100);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  return lottie;
17
  }));
18
 
@@ -303,17 +14846,13 @@
303
  };
304
 
305
 
306
-
307
-
308
  if ($('.premium-lottie-yes').length) {
309
 
310
  var isEditMode = elementorFrontend.isEditMode();
311
 
312
- Object.keys(window.scopes_array).forEach(function (i) {
313
- $scope = window.scopes_array[i];
314
  premiumLottieHandler($scope, isEditMode);
315
  });
316
-
317
  }
318
 
319
 
@@ -420,7 +14959,6 @@
420
 
421
  var $layer = jQuery('.elementor-repeater-item-' + layer._id);
422
 
423
-
424
  var loop = layer.lottie_loop,
425
  reverse = layer.lottie_reverse,
426
  trigger = layer.hover_action;
1
  (function ($) {
2
 
3
  (typeof navigator !== "undefined") && (function (root, factory) {
4
+
5
  if (typeof define === "function" && define.amd) {
6
  define(function () {
7
  return factory(root);
8
  });
9
+ } else if (typeof module === "object" && module.exports) {
10
+ module.exports = factory(root);
11
+ } else {
12
+ root.lottie = factory(root);
13
+ root.bodymovin = root.lottie;
14
+ }
15
+ }((window || {}), function (window) {
16
+ "use strict";
17
+ var svgNS = "http://www.w3.org/2000/svg";
18
+
19
+ var locationHref = '';
20
+
21
+ var initialDefaultFrame = -999999;
22
+
23
+ var subframeEnabled = true;
24
+ var expressionsPlugin;
25
+ var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
26
+ var cachedColors = {};
27
+ var bm_rounder = Math.round;
28
+ var bm_rnd;
29
+ var bm_pow = Math.pow;
30
+ var bm_sqrt = Math.sqrt;
31
+ var bm_abs = Math.abs;
32
+ var bm_floor = Math.floor;
33
+ var bm_max = Math.max;
34
+ var bm_min = Math.min;
35
+ var blitter = 10;
36
+
37
+ var BMMath = {};
38
+ (function () {
39
+ var propertyNames = ["abs", "acos", "acosh", "asin", "asinh", "atan", "atanh", "atan2", "ceil", "cbrt", "expm1", "clz32", "cos", "cosh", "exp", "floor", "fround", "hypot", "imul", "log", "log1p", "log2", "log10", "max", "min", "pow", "random", "round", "sign", "sin", "sinh", "sqrt", "tan", "tanh", "trunc", "E", "LN10", "LN2", "LOG10E", "LOG2E", "PI", "SQRT1_2", "SQRT2"];
40
+ var i, len = propertyNames.length;
41
+ for (i = 0; i < len; i += 1) {
42
+ BMMath[propertyNames[i]] = Math[propertyNames[i]];
43
+ }
44
+ }());
45
+
46
+ function ProjectInterface() { return {}; }
47
+
48
+ BMMath.random = Math.random;
49
+ BMMath.abs = function (val) {
50
+ var tOfVal = typeof val;
51
+ if (tOfVal === 'object' && val.length) {
52
+ var absArr = createSizedArray(val.length);
53
+ var i, len = val.length;
54
+ for (i = 0; i < len; i += 1) {
55
+ absArr[i] = Math.abs(val[i]);
56
+ }
57
+ return absArr;
58
+ }
59
+ return Math.abs(val);
60
+
61
+ };
62
+ var defaultCurveSegments = 150;
63
+ var degToRads = Math.PI / 180;
64
+ var roundCorner = 0.5519;
65
+
66
+ function roundValues(flag) {
67
+ if (flag) {
68
+ bm_rnd = Math.round;
69
+ } else {
70
+ bm_rnd = function (val) {
71
+ return val;
72
+ };
73
+ }
74
+ }
75
+ roundValues(false);
76
+
77
+ function styleDiv(element) {
78
+ element.style.position = 'absolute';
79
+ element.style.top = 0;
80
+ element.style.left = 0;
81
+ element.style.display = 'block';
82
+ element.style.transformOrigin = element.style.webkitTransformOrigin = '0 0';
83
+ element.style.backfaceVisibility = element.style.webkitBackfaceVisibility = 'visible';
84
+ element.style.transformStyle = element.style.webkitTransformStyle = element.style.mozTransformStyle = "preserve-3d";
85
+ }
86
+
87
+ function BMEnterFrameEvent(type, currentTime, totalTime, frameMultiplier) {
88
+ this.type = type;
89
+ this.currentTime = currentTime;
90
+ this.totalTime = totalTime;
91
+ this.direction = frameMultiplier < 0 ? -1 : 1;
92
+ }
93
+
94
+ function BMCompleteEvent(type, frameMultiplier) {
95
+ this.type = type;
96
+ this.direction = frameMultiplier < 0 ? -1 : 1;
97
+ }
98
+
99
+ function BMCompleteLoopEvent(type, totalLoops, currentLoop, frameMultiplier) {
100
+ this.type = type;
101
+ this.currentLoop = currentLoop;
102
+ this.totalLoops = totalLoops;
103
+ this.direction = frameMultiplier < 0 ? -1 : 1;
104
+ }
105
+
106
+ function BMSegmentStartEvent(type, firstFrame, totalFrames) {
107
+ this.type = type;
108
+ this.firstFrame = firstFrame;
109
+ this.totalFrames = totalFrames;
110
+ }
111
+
112
+ function BMDestroyEvent(type, target) {
113
+ this.type = type;
114
+ this.target = target;
115
+ }
116
+
117
+ function BMRenderFrameErrorEvent(nativeError, currentTime) {
118
+ this.type = 'renderFrameError';
119
+ this.nativeError = nativeError;
120
+ this.currentTime = currentTime;
121
+ }
122
+
123
+ function BMConfigErrorEvent(nativeError) {
124
+ this.type = 'configError';
125
+ this.nativeError = nativeError;
126
+ }
127
+
128
+ function BMAnimationConfigErrorEvent(type, nativeError) {
129
+ this.type = type;
130
+ this.nativeError = nativeError;
131
+ this.currentTime = currentTime;
132
+ }
133
+
134
+ var createElementID = (function () {
135
+ var _count = 0;
136
+ return function createID() {
137
+ return '__lottie_element_' + ++_count
138
+ }
139
+ }())
140
+
141
+ function HSVtoRGB(h, s, v) {
142
+ var r, g, b, i, f, p, q, t;
143
+ i = Math.floor(h * 6);
144
+ f = h * 6 - i;
145
+ p = v * (1 - s);
146
+ q = v * (1 - f * s);
147
+ t = v * (1 - (1 - f) * s);
148
+ switch (i % 6) {
149
+ case 0: r = v; g = t; b = p; break;
150
+ case 1: r = q; g = v; b = p; break;
151
+ case 2: r = p; g = v; b = t; break;
152
+ case 3: r = p; g = q; b = v; break;
153
+ case 4: r = t; g = p; b = v; break;
154
+ case 5: r = v; g = p; b = q; break;
155
+ }
156
+ return [r,
157
+ g,
158
+ b];
159
+ }
160
+
161
+ function RGBtoHSV(r, g, b) {
162
+ var max = Math.max(r, g, b), min = Math.min(r, g, b),
163
+ d = max - min,
164
+ h,
165
+ s = (max === 0 ? 0 : d / max),
166
+ v = max / 255;
167
+
168
+ switch (max) {
169
+ case min: h = 0; break;
170
+ case r: h = (g - b) + d * (g < b ? 6 : 0); h /= 6 * d; break;
171
+ case g: h = (b - r) + d * 2; h /= 6 * d; break;
172
+ case b: h = (r - g) + d * 4; h /= 6 * d; break;
173
+ }
174
+
175
+ return [
176
+ h,
177
+ s,
178
+ v
179
+ ];
180
+ }
181
+
182
+ function addSaturationToRGB(color, offset) {
183
+ var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);
184
+ hsv[1] += offset;
185
+ if (hsv[1] > 1) {
186
+ hsv[1] = 1;
187
+ }
188
+ else if (hsv[1] <= 0) {
189
+ hsv[1] = 0;
190
+ }
191
+ return HSVtoRGB(hsv[0], hsv[1], hsv[2]);
192
+ }
193
+
194
+ function addBrightnessToRGB(color, offset) {
195
+ var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);
196
+ hsv[2] += offset;
197
+ if (hsv[2] > 1) {
198
+ hsv[2] = 1;
199
+ }
200
+ else if (hsv[2] < 0) {
201
+ hsv[2] = 0;
202
+ }
203
+ return HSVtoRGB(hsv[0], hsv[1], hsv[2]);
204
+ }
205
+
206
+ function addHueToRGB(color, offset) {
207
+ var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);
208
+ hsv[0] += offset / 360;
209
+ if (hsv[0] > 1) {
210
+ hsv[0] -= 1;
211
+ }
212
+ else if (hsv[0] < 0) {
213
+ hsv[0] += 1;
214
+ }
215
+ return HSVtoRGB(hsv[0], hsv[1], hsv[2]);
216
+ }
217
+
218
+ var rgbToHex = (function () {
219
+ var colorMap = [];
220
+ var i;
221
+ var hex;
222
+ for (i = 0; i < 256; i += 1) {
223
+ hex = i.toString(16);
224
+ colorMap[i] = hex.length == 1 ? '0' + hex : hex;
225
+ }
226
+
227
+ return function (r, g, b) {
228
+ if (r < 0) {
229
+ r = 0;
230
+ }
231
+ if (g < 0) {
232
+ g = 0;
233
+ }
234
+ if (b < 0) {
235
+ b = 0;
236
+ }
237
+ return '#' + colorMap[r] + colorMap[g] + colorMap[b];
238
+ };
239
+ }());
240
+ function BaseEvent() { }
241
+ BaseEvent.prototype = {
242
+ triggerEvent: function (eventName, args) {
243
+ if (this._cbs[eventName]) {
244
+ var len = this._cbs[eventName].length;
245
+ for (var i = 0; i < len; i++) {
246
+ this._cbs[eventName][i](args);
247
+ }
248
+ }
249
+ },
250
+ addEventListener: function (eventName, callback) {
251
+ if (!this._cbs[eventName]) {
252
+ this._cbs[eventName] = [];
253
+ }
254
+ this._cbs[eventName].push(callback);
255
+
256
+ return function () {
257
+ this.removeEventListener(eventName, callback);
258
+ }.bind(this);
259
+ },
260
+ removeEventListener: function (eventName, callback) {
261
+ if (!callback) {
262
+ this._cbs[eventName] = null;
263
+ } else if (this._cbs[eventName]) {
264
+ var i = 0, len = this._cbs[eventName].length;
265
+ while (i < len) {
266
+ if (this._cbs[eventName][i] === callback) {
267
+ this._cbs[eventName].splice(i, 1);
268
+ i -= 1;
269
+ len -= 1;
270
+ }
271
+ i += 1;
272
+ }
273
+ if (!this._cbs[eventName].length) {
274
+ this._cbs[eventName] = null;
275
+ }
276
+ }
277
+ }
278
+ };
279
+ var createTypedArray = (function () {
280
+ function createRegularArray(type, len) {
281
+ var i = 0, arr = [], value;
282
+ switch (type) {
283
+ case 'int16':
284
+ case 'uint8c':
285
+ value = 1;
286
+ break;
287
+ default:
288
+ value = 1.1;
289
+ break;
290
+ }
291
+ for (i = 0; i < len; i += 1) {
292
+ arr.push(value);
293
+ }
294
+ return arr;
295
+ }
296
+ function createTypedArray(type, len) {
297
+ if (type === 'float32') {
298
+ return new Float32Array(len);
299
+ } else if (type === 'int16') {
300
+ return new Int16Array(len);
301
+ } else if (type === 'uint8c') {
302
+ return new Uint8ClampedArray(len);
303
+ }
304
+ }
305
+ if (typeof Uint8ClampedArray === 'function' && typeof Float32Array === 'function') {
306
+ return createTypedArray;
307
+ } else {
308
+ return createRegularArray;
309
+ }
310
+ }());
311
+
312
+ function createSizedArray(len) {
313
+ return Array.apply(null, { length: len });
314
+ }
315
+ function createNS(type) {
316
+ //return {appendChild:function(){},setAttribute:function(){},style:{}}
317
+ return document.createElementNS(svgNS, type);
318
+ }
319
+ function createTag(type) {
320
+ //return {appendChild:function(){},setAttribute:function(){},style:{}}
321
+ return document.createElement(type);
322
+ }
323
+ function DynamicPropertyContainer() { };
324
+ DynamicPropertyContainer.prototype = {
325
+ addDynamicProperty: function (prop) {
326
+ if (this.dynamicProperties.indexOf(prop) === -1) {
327
+ this.dynamicProperties.push(prop);
328
+ this.container.addDynamicProperty(this);
329
+ this._isAnimated = true;
330
+ }
331
+ },
332
+ iterateDynamicProperties: function () {
333
+ this._mdf = false;
334
+ var i, len = this.dynamicProperties.length;
335
+ for (i = 0; i < len; i += 1) {
336
+ this.dynamicProperties[i].getValue();
337
+ if (this.dynamicProperties[i]._mdf) {
338
+ this._mdf = true;
339
+ }
340
+ }
341
+ },
342
+ initDynamicPropertyContainer: function (container) {
343
+ this.container = container;
344
+ this.dynamicProperties = [];
345
+ this._mdf = false;
346
+ this._isAnimated = false;
347
+ }
348
+ }
349
+ var getBlendMode = (function () {
350
+
351
+ var blendModeEnums = {
352
+ 0: 'source-over',
353
+ 1: 'multiply',
354
+ 2: 'screen',
355
+ 3: 'overlay',
356
+ 4: 'darken',
357
+ 5: 'lighten',
358
+ 6: 'color-dodge',
359
+ 7: 'color-burn',
360
+ 8: 'hard-light',
361
+ 9: 'soft-light',
362
+ 10: 'difference',
363
+ 11: 'exclusion',
364
+ 12: 'hue',
365
+ 13: 'saturation',
366
+ 14: 'color',
367
+ 15: 'luminosity'
368
+ }
369
+
370
+ return function (mode) {
371
+ return blendModeEnums[mode] || '';
372
+ }
373
+ }())
374
+ /*!
375
+ Transformation Matrix v2.0
376
+ (c) Epistemex 2014-2015
377
+ www.epistemex.com
378
+ By Ken Fyrstenberg
379
+ Contributions by leeoniya.
380
+ License: MIT, header required.
381
+ */
382
+
383
+ /**
384
+ * 2D transformation matrix object initialized with identity matrix.
385
+ *
386
+ * The matrix can synchronize a canvas context by supplying the context
387
+ * as an argument, or later apply current absolute transform to an
388
+ * existing context.
389
+ *
390
+ * All values are handled as floating point values.
391
+ *
392
+ * @param {CanvasRenderingContext2D} [context] - Optional context to sync with Matrix
393
+ * @prop {number} a - scale x
394
+ * @prop {number} b - shear y
395
+ * @prop {number} c - shear x
396
+ * @prop {number} d - scale y
397
+ * @prop {number} e - translate x
398
+ * @prop {number} f - translate y
399
+ * @prop {CanvasRenderingContext2D|null} [context=null] - set or get current canvas context
400
+ * @constructor
401
+ */
402
+
403
+ var Matrix = (function () {
404
+
405
+ var _cos = Math.cos;
406
+ var _sin = Math.sin;
407
+ var _tan = Math.tan;
408
+ var _rnd = Math.round;
409
+
410
+ function reset() {
411
+ this.props[0] = 1;
412
+ this.props[1] = 0;
413
+ this.props[2] = 0;
414
+ this.props[3] = 0;
415
+ this.props[4] = 0;
416
+ this.props[5] = 1;
417
+ this.props[6] = 0;
418
+ this.props[7] = 0;
419
+ this.props[8] = 0;
420
+ this.props[9] = 0;
421
+ this.props[10] = 1;
422
+ this.props[11] = 0;
423
+ this.props[12] = 0;
424
+ this.props[13] = 0;
425
+ this.props[14] = 0;
426
+ this.props[15] = 1;
427
+ return this;
428
+ }
429
+
430
+ function rotate(angle) {
431
+ if (angle === 0) {
432
+ return this;
433
+ }
434
+ var mCos = _cos(angle);
435
+ var mSin = _sin(angle);
436
+ return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
437
+ }
438
+
439
+ function rotateX(angle) {
440
+ if (angle === 0) {
441
+ return this;
442
+ }
443
+ var mCos = _cos(angle);
444
+ var mSin = _sin(angle);
445
+ return this._t(1, 0, 0, 0, 0, mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1);
446
+ }
447
+
448
+ function rotateY(angle) {
449
+ if (angle === 0) {
450
+ return this;
451
+ }
452
+ var mCos = _cos(angle);
453
+ var mSin = _sin(angle);
454
+ return this._t(mCos, 0, mSin, 0, 0, 1, 0, 0, -mSin, 0, mCos, 0, 0, 0, 0, 1);
455
+ }
456
+
457
+ function rotateZ(angle) {
458
+ if (angle === 0) {
459
+ return this;
460
+ }
461
+ var mCos = _cos(angle);
462
+ var mSin = _sin(angle);
463
+ return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
464
+ }
465
+
466
+ function shear(sx, sy) {
467
+ return this._t(1, sy, sx, 1, 0, 0);
468
+ }
469
+
470
+ function skew(ax, ay) {
471
+ return this.shear(_tan(ax), _tan(ay));
472
+ }
473
+
474
+ function skewFromAxis(ax, angle) {
475
+ var mCos = _cos(angle);
476
+ var mSin = _sin(angle);
477
+ return this._t(mCos, mSin, 0, 0, -mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
478
+ ._t(1, 0, 0, 0, _tan(ax), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
479
+ ._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
480
+ //return this._t(mCos, mSin, -mSin, mCos, 0, 0)._t(1, 0, _tan(ax), 1, 0, 0)._t(mCos, -mSin, mSin, mCos, 0, 0);
481
+ }
482
+
483
+ function scale(sx, sy, sz) {
484
+ if (!sz && sz !== 0) {
485
+ sz = 1;
486
+ }
487
+ if (sx === 1 && sy === 1 && sz === 1) {
488
+ return this;
489
+ }
490
+ return this._t(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1);
491
+ }
492
+
493
+ function setTransform(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {
494
+ this.props[0] = a;
495
+ this.props[1] = b;
496
+ this.props[2] = c;
497
+ this.props[3] = d;
498
+ this.props[4] = e;
499
+ this.props[5] = f;
500
+ this.props[6] = g;
501
+ this.props[7] = h;
502
+ this.props[8] = i;
503
+ this.props[9] = j;
504
+ this.props[10] = k;
505
+ this.props[11] = l;
506
+ this.props[12] = m;
507
+ this.props[13] = n;
508
+ this.props[14] = o;
509
+ this.props[15] = p;
510
+ return this;
511
+ }
512
+
513
+ function translate(tx, ty, tz) {
514
+ tz = tz || 0;
515
+ if (tx !== 0 || ty !== 0 || tz !== 0) {
516
+ return this._t(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, tx, ty, tz, 1);
517
+ }
518
+ return this;
519
+ }
520
+
521
+ function transform(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2) {
522
+
523
+ var _p = this.props;
524
+
525
+ if (a2 === 1 && b2 === 0 && c2 === 0 && d2 === 0 && e2 === 0 && f2 === 1 && g2 === 0 && h2 === 0 && i2 === 0 && j2 === 0 && k2 === 1 && l2 === 0) {
526
+ //NOTE: commenting this condition because TurboFan deoptimizes code when present
527
+ //if(m2 !== 0 || n2 !== 0 || o2 !== 0){
528
+ _p[12] = _p[12] * a2 + _p[15] * m2;
529
+ _p[13] = _p[13] * f2 + _p[15] * n2;
530
+ _p[14] = _p[14] * k2 + _p[15] * o2;
531
+ _p[15] = _p[15] * p2;
532
+ //}
533
+ this._identityCalculated = false;
534
+ return this;
535
+ }
536
+
537
+ var a1 = _p[0];
538
+ var b1 = _p[1];
539
+ var c1 = _p[2];
540
+ var d1 = _p[3];
541
+ var e1 = _p[4];
542
+ var f1 = _p[5];
543
+ var g1 = _p[6];
544
+ var h1 = _p[7];
545
+ var i1 = _p[8];
546
+ var j1 = _p[9];
547
+ var k1 = _p[10];
548
+ var l1 = _p[11];
549
+ var m1 = _p[12];
550
+ var n1 = _p[13];
551
+ var o1 = _p[14];
552
+ var p1 = _p[15];
553
+
554
+ /* matrix order (canvas compatible):
555
+ * ace
556
+ * bdf
557
+ * 001
558
+ */
559
+ _p[0] = a1 * a2 + b1 * e2 + c1 * i2 + d1 * m2;
560
+ _p[1] = a1 * b2 + b1 * f2 + c1 * j2 + d1 * n2;
561
+ _p[2] = a1 * c2 + b1 * g2 + c1 * k2 + d1 * o2;
562
+ _p[3] = a1 * d2 + b1 * h2 + c1 * l2 + d1 * p2;
563
+
564
+ _p[4] = e1 * a2 + f1 * e2 + g1 * i2 + h1 * m2;
565
+ _p[5] = e1 * b2 + f1 * f2 + g1 * j2 + h1 * n2;
566
+ _p[6] = e1 * c2 + f1 * g2 + g1 * k2 + h1 * o2;
567
+ _p[7] = e1 * d2 + f1 * h2 + g1 * l2 + h1 * p2;
568
+
569
+ _p[8] = i1 * a2 + j1 * e2 + k1 * i2 + l1 * m2;
570
+ _p[9] = i1 * b2 + j1 * f2 + k1 * j2 + l1 * n2;
571
+ _p[10] = i1 * c2 + j1 * g2 + k1 * k2 + l1 * o2;
572
+ _p[11] = i1 * d2 + j1 * h2 + k1 * l2 + l1 * p2;
573
+
574
+ _p[12] = m1 * a2 + n1 * e2 + o1 * i2 + p1 * m2;
575
+ _p[13] = m1 * b2 + n1 * f2 + o1 * j2 + p1 * n2;
576
+ _p[14] = m1 * c2 + n1 * g2 + o1 * k2 + p1 * o2;
577
+ _p[15] = m1 * d2 + n1 * h2 + o1 * l2 + p1 * p2;
578
+
579
+ this._identityCalculated = false;
580
+ return this;
581
+ }
582
+
583
+ function isIdentity() {
584
+ if (!this._identityCalculated) {
585
+ this._identity = !(this.props[0] !== 1 || this.props[1] !== 0 || this.props[2] !== 0 || this.props[3] !== 0 || this.props[4] !== 0 || this.props[5] !== 1 || this.props[6] !== 0 || this.props[7] !== 0 || this.props[8] !== 0 || this.props[9] !== 0 || this.props[10] !== 1 || this.props[11] !== 0 || this.props[12] !== 0 || this.props[13] !== 0 || this.props[14] !== 0 || this.props[15] !== 1);
586
+ this._identityCalculated = true;
587
+ }
588
+ return this._identity;
589
+ }
590
+
591
+ function equals(matr) {
592
+ var i = 0;
593
+ while (i < 16) {
594
+ if (matr.props[i] !== this.props[i]) {
595
+ return false;
596
+ }
597
+ i += 1;
598
+ }
599
+ return true;
600
+ }
601
+
602
+ function clone(matr) {
603
+ var i;
604
+ for (i = 0; i < 16; i += 1) {
605
+ matr.props[i] = this.props[i];
606
+ }
607
+ }
608
+
609
+ function cloneFromProps(props) {
610
+ var i;
611
+ for (i = 0; i < 16; i += 1) {
612
+ this.props[i] = props[i];
613
+ }
614
+ }
615
+
616
+ function applyToPoint(x, y, z) {
617
+
618
+ return {
619
+ x: x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],
620
+ y: x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],
621
+ z: x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]
622
+ };
623
+ /*return {
624
+ x: x * me.a + y * me.c + me.e,
625
+ y: x * me.b + y * me.d + me.f
626
+ };*/
627
+ }
628
+ function applyToX(x, y, z) {
629
+ return x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12];
630
+ }
631
+ function applyToY(x, y, z) {
632
+ return x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13];
633
+ }
634
+ function applyToZ(x, y, z) {
635
+ return x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14];
636
+ }
637
+
638
+ function getInverseMatrix() {
639
+ var determinant = this.props[0] * this.props[5] - this.props[1] * this.props[4];
640
+ var a = this.props[5] / determinant;
641
+ var b = - this.props[1] / determinant;
642
+ var c = - this.props[4] / determinant;
643
+ var d = this.props[0] / determinant;
644
+ var e = (this.props[4] * this.props[13] - this.props[5] * this.props[12]) / determinant;
645
+ var f = - (this.props[0] * this.props[13] - this.props[1] * this.props[12]) / determinant;
646
+ var inverseMatrix = new Matrix();
647
+ inverseMatrix.props[0] = a;
648
+ inverseMatrix.props[1] = b;
649
+ inverseMatrix.props[4] = c;
650
+ inverseMatrix.props[5] = d;
651
+ inverseMatrix.props[12] = e;
652
+ inverseMatrix.props[13] = f;
653
+ return inverseMatrix;
654
+ }
655
+
656
+ function inversePoint(pt) {
657
+ var inverseMatrix = this.getInverseMatrix();
658
+ return inverseMatrix.applyToPointArray(pt[0], pt[1], pt[2] || 0)
659
+ }
660
+
661
+ function inversePoints(pts) {
662
+ var i, len = pts.length, retPts = [];
663
+ for (i = 0; i < len; i += 1) {
664
+ retPts[i] = inversePoint(pts[i]);
665
+ }
666
+ return retPts;
667
+ }
668
+
669
+ function applyToTriplePoints(pt1, pt2, pt3) {
670
+ var arr = createTypedArray('float32', 6);
671
+ if (this.isIdentity()) {
672
+ arr[0] = pt1[0];
673
+ arr[1] = pt1[1];
674
+ arr[2] = pt2[0];
675
+ arr[3] = pt2[1];
676
+ arr[4] = pt3[0];
677
+ arr[5] = pt3[1];
678
+ } else {
679
+ var p0 = this.props[0], p1 = this.props[1], p4 = this.props[4], p5 = this.props[5], p12 = this.props[12], p13 = this.props[13];
680
+ arr[0] = pt1[0] * p0 + pt1[1] * p4 + p12;
681
+ arr[1] = pt1[0] * p1 + pt1[1] * p5 + p13;
682
+ arr[2] = pt2[0] * p0 + pt2[1] * p4 + p12;
683
+ arr[3] = pt2[0] * p1 + pt2[1] * p5 + p13;
684
+ arr[4] = pt3[0] * p0 + pt3[1] * p4 + p12;
685
+ arr[5] = pt3[0] * p1 + pt3[1] * p5 + p13;
686
+ }
687
+ return arr;
688
+ }
689
+
690
+ function applyToPointArray(x, y, z) {
691
+ var arr;
692
+ if (this.isIdentity()) {
693
+ arr = [x, y, z];
694
+ } else {
695
+ arr = [x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12], x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13], x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]];
696
+ }
697
+ return arr;
698
+ }
699
+
700
+ function applyToPointStringified(x, y) {
701
+ if (this.isIdentity()) {
702
+ return x + ',' + y;
703
+ }
704
+ var _p = this.props;
705
+ return Math.round((x * _p[0] + y * _p[4] + _p[12]) * 100) / 100 + ',' + Math.round((x * _p[1] + y * _p[5] + _p[13]) * 100) / 100;
706
+ }
707
+
708
+ function toCSS() {
709
+ //Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.
710
+ /*if(this.isIdentity()) {
711
+ return '';
712
+ }*/
713
+ var i = 0;
714
+ var props = this.props;
715
+ var cssValue = 'matrix3d(';
716
+ var v = 10000;
717
+ while (i < 16) {
718
+ cssValue += _rnd(props[i] * v) / v;
719
+ cssValue += i === 15 ? ')' : ',';
720
+ i += 1;
721
+ }
722
+ return cssValue;
723
+ }
724
+
725
+ function roundMatrixProperty(val) {
726
+ var v = 10000;
727
+ if ((val < 0.000001 && val > 0) || (val > -0.000001 && val < 0)) {
728
+ return _rnd(val * v) / v;
729
+ }
730
+ return val;
731
+ }
732
+
733
+ function to2dCSS() {
734
+ //Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.
735
+ /*if(this.isIdentity()) {
736
+ return '';
737
+ }*/
738
+ var props = this.props;
739
+ var _a = roundMatrixProperty(props[0]);
740
+ var _b = roundMatrixProperty(props[1]);
741
+ var _c = roundMatrixProperty(props[4]);
742
+ var _d = roundMatrixProperty(props[5]);
743
+ var _e = roundMatrixProperty(props[12]);
744
+ var _f = roundMatrixProperty(props[13]);
745
+ return "matrix(" + _a + ',' + _b + ',' + _c + ',' + _d + ',' + _e + ',' + _f + ")";
746
+ }
747
+
748
+ return function () {
749
+ this.reset = reset;
750
+ this.rotate = rotate;
751
+ this.rotateX = rotateX;
752
+ this.rotateY = rotateY;
753
+ this.rotateZ = rotateZ;
754
+ this.skew = skew;
755
+ this.skewFromAxis = skewFromAxis;
756
+ this.shear = shear;
757
+ this.scale = scale;
758
+ this.setTransform = setTransform;
759
+ this.translate = translate;
760
+ this.transform = transform;
761
+ this.applyToPoint = applyToPoint;
762
+ this.applyToX = applyToX;
763
+ this.applyToY = applyToY;
764
+ this.applyToZ = applyToZ;
765
+ this.applyToPointArray = applyToPointArray;
766
+ this.applyToTriplePoints = applyToTriplePoints;
767
+ this.applyToPointStringified = applyToPointStringified;
768
+ this.toCSS = toCSS;
769
+ this.to2dCSS = to2dCSS;
770
+ this.clone = clone;
771
+ this.cloneFromProps = cloneFromProps;
772
+ this.equals = equals;
773
+ this.inversePoints = inversePoints;
774
+ this.inversePoint = inversePoint;
775
+ this.getInverseMatrix = getInverseMatrix;
776
+ this._t = this.transform;
777
+ this.isIdentity = isIdentity;
778
+ this._identity = true;
779
+ this._identityCalculated = false;
780
+
781
+ this.props = createTypedArray('float32', 16);
782
+ this.reset();
783
+ };
784
+ }());
785
+
786
+ /*
787
+ Copyright 2014 David Bau.
788
+
789
+ Permission is hereby granted, free of charge, to any person obtaining
790
+ a copy of this software and associated documentation files (the
791
+ "Software"), to deal in the Software without restriction, including
792
+ without limitation the rights to use, copy, modify, merge, publish,
793
+ distribute, sublicense, and/or sell copies of the Software, and to
794
+ permit persons to whom the Software is furnished to do so, subject to
795
+ the following conditions:
796
+
797
+ The above copyright notice and this permission notice shall be
798
+ included in all copies or substantial portions of the Software.
799
+
800
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
801
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
802
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
803
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
804
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
805
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
806
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
807
+
808
+ */
809
+
810
+ (function (pool, math) {
811
+ //
812
+ // The following constants are related to IEEE 754 limits.
813
+ //
814
+ var global = this,
815
+ width = 256, // each RC4 output is 0 <= x < 256
816
+ chunks = 6, // at least six RC4 outputs for each double
817
+ digits = 52, // there are 52 significant digits in a double
818
+ rngname = 'random', // rngname: name for Math.random and Math.seedrandom
819
+ startdenom = math.pow(width, chunks),
820
+ significance = math.pow(2, digits),
821
+ overflow = significance * 2,
822
+ mask = width - 1,
823
+ nodecrypto; // node.js crypto module, initialized at the bottom.
824
+
825
+ //
826
+ // seedrandom()
827
+ // This is the seedrandom function described above.
828
+ //
829
+ function seedrandom(seed, options, callback) {
830
+ var key = [];
831
+ options = (options === true) ? { entropy: true } : (options || {});
832
+
833
+ // Flatten the seed string or build one from local entropy if needed.
834
+ var shortseed = mixkey(flatten(
835
+ options.entropy ? [seed, tostring(pool)] :
836
+ (seed === null) ? autoseed() : seed, 3), key);
837
+
838
+ // Use the seed to initialize an ARC4 generator.
839
+ var arc4 = new ARC4(key);
840
+
841
+ // This function returns a random double in [0, 1) that contains
842
+ // randomness in every bit of the mantissa of the IEEE 754 value.
843
+ var prng = function () {
844
+ var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48
845
+ d = startdenom, // and denominator d = 2 ^ 48.
846
+ x = 0; // and no 'extra last byte'.
847
+ while (n < significance) { // Fill up all significant digits by
848
+ n = (n + x) * width; // shifting numerator and
849
+ d *= width; // denominator and generating a
850
+ x = arc4.g(1); // new least-significant-byte.
851
+ }
852
+ while (n >= overflow) { // To avoid rounding up, before adding
853
+ n /= 2; // last byte, shift everything
854
+ d /= 2; // right using integer math until
855
+ x >>>= 1; // we have exactly the desired bits.
856
+ }
857
+ return (n + x) / d; // Form the number within [0, 1).
858
+ };
859
+
860
+ prng.int32 = function () { return arc4.g(4) | 0; };
861
+ prng.quick = function () { return arc4.g(4) / 0x100000000; };
862
+ prng.double = prng;
863
+
864
+ // Mix the randomness into accumulated entropy.
865
+ mixkey(tostring(arc4.S), pool);
866
+
867
+ // Calling convention: what to return as a function of prng, seed, is_math.
868
+ return (options.pass || callback ||
869
+ function (prng, seed, is_math_call, state) {
870
+ if (state) {
871
+ // Load the arc4 state from the given state if it has an S array.
872
+ if (state.S) { copy(state, arc4); }
873
+ // Only provide the .state method if requested via options.state.
874
+ prng.state = function () { return copy(arc4, {}); };
875
+ }
876
+
877
+ // If called as a method of Math (Math.seedrandom()), mutate
878
+ // Math.random because that is how seedrandom.js has worked since v1.0.
879
+ if (is_math_call) { math[rngname] = prng; return seed; }
880
+
881
+ // Otherwise, it is a newer calling convention, so return the
882
+ // prng directly.
883
+ else return prng;
884
+ })(
885
+ prng,
886
+ shortseed,
887
+ 'global' in options ? options.global : (this == math),
888
+ options.state);
889
+ }
890
+ math['seed' + rngname] = seedrandom;
891
+
892
+ //
893
+ // ARC4
894
+ //
895
+ // An ARC4 implementation. The constructor takes a key in the form of
896
+ // an array of at most (width) integers that should be 0 <= x < (width).
897
+ //
898
+ // The g(count) method returns a pseudorandom integer that concatenates
899
+ // the next (count) outputs from ARC4. Its return value is a number x
900
+ // that is in the range 0 <= x < (width ^ count).
901
+ //
902
+ function ARC4(key) {
903
+ var t, keylen = key.length,
904
+ me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];
905
+
906
+ // The empty key [] is treated as [0].
907
+ if (!keylen) { key = [keylen++]; }
908
+
909
+ // Set up S using the standard key scheduling algorithm.
910
+ while (i < width) {
911
+ s[i] = i++;
912
+ }
913
+ for (i = 0; i < width; i++) {
914
+ s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];
915
+ s[j] = t;
916
+ }
917
+
918
+ // The "g" method returns the next (count) outputs as one number.
919
+ me.g = function (count) {
920
+ // Using instance members instead of closure state nearly doubles speed.
921
+ var t, r = 0,
922
+ i = me.i, j = me.j, s = me.S;
923
+ while (count--) {
924
+ t = s[i = mask & (i + 1)];
925
+ r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];
926
+ }
927
+ me.i = i; me.j = j;
928
+ return r;
929
+ // For robust unpredictability, the function call below automatically
930
+ // discards an initial batch of values. This is called RC4-drop[256].
931
+ // See http://google.com/search?q=rsa+fluhrer+response&btnI
932
+ };
933
+ }
934
+
935
+ //
936
+ // copy()
937
+ // Copies internal state of ARC4 to or from a plain object.
938
+ //
939
+ function copy(f, t) {
940
+ t.i = f.i;
941
+ t.j = f.j;
942
+ t.S = f.S.slice();
943
+ return t;
944
+ }
945
+
946
+ //
947
+ // flatten()
948
+ // Converts an object tree to nested arrays of strings.
949
+ //
950
+ function flatten(obj, depth) {
951
+ var result = [], typ = (typeof obj), prop;
952
+ if (depth && typ == 'object') {
953
+ for (prop in obj) {
954
+ try { result.push(flatten(obj[prop], depth - 1)); } catch (e) { }
955
+ }
956
+ }
957
+ return (result.length ? result : typ == 'string' ? obj : obj + '\0');
958
+ }
959
+
960
+ //
961
+ // mixkey()
962
+ // Mixes a string seed into a key that is an array of integers, and
963
+ // returns a shortened string seed that is equivalent to the result key.
964
+ //
965
+ function mixkey(seed, key) {
966
+ var stringseed = seed + '', smear, j = 0;
967
+ while (j < stringseed.length) {
968
+ key[mask & j] =
969
+ mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));
970
+ }
971
+ return tostring(key);
972
+ }
973
+
974
+ //
975
+ // autoseed()
976
+ // Returns an object for autoseeding, using window.crypto and Node crypto
977
+ // module if available.
978
+ //
979
+ function autoseed() {
980
+ try {
981
+ if (nodecrypto) { return tostring(nodecrypto.randomBytes(width)); }
982
+ var out = new Uint8Array(width);
983
+ (global.crypto || global.msCrypto).getRandomValues(out);
984
+ return tostring(out);
985
+ } catch (e) {
986
+ var browser = global.navigator,
987
+ plugins = browser && browser.plugins;
988
+ return [+new Date(), global, plugins, global.screen, tostring(pool)];
989
+ }
990
+ }
991
+
992
+ //
993
+ // tostring()
994
+ // Converts an array of charcodes to a string
995
+ //
996
+ function tostring(a) {
997
+ return String.fromCharCode.apply(0, a);
998
+ }
999
+
1000
+ //
1001
+ // When seedrandom.js is loaded, we immediately mix a few bits
1002
+ // from the built-in RNG into the entropy pool. Because we do
1003
+ // not want to interfere with deterministic PRNG state later,
1004
+ // seedrandom will not call math.random on its own again after
1005
+ // initialization.
1006
+ //
1007
+ mixkey(math.random(), pool);
1008
+
1009
+ //
1010
+ // Nodejs and AMD support: export the implementation as a module using
1011
+ // either convention.
1012
+ //
1013
+
1014
+ // End anonymous scope, and pass initial values.
1015
+ })(
1016
+ [], // pool: entropy pool starts empty
1017
+ BMMath // math: package containing random, pow, and seedrandom
1018
+ );
1019
+ var BezierFactory = (function () {
1020
+ /**
1021
+ * BezierEasing - use bezier curve for transition easing function
1022
+ * by Gaëtan Renaudeau 2014 - 2015 – MIT License
1023
+ *
1024
+ * Credits: is based on Firefox's nsSMILKeySpline.cpp
1025
+ * Usage:
1026
+ * var spline = BezierEasing([ 0.25, 0.1, 0.25, 1.0 ])
1027
+ * spline.get(x) => returns the easing value | x must be in [0, 1] range
1028
+ *
1029
+ */
1030
+
1031
+ var ob = {};
1032
+ ob.getBezierEasing = getBezierEasing;
1033
+ var beziers = {};
1034
+
1035
+ function getBezierEasing(a, b, c, d, nm) {
1036
+ var str = nm || ('bez_' + a + '_' + b + '_' + c + '_' + d).replace(/\./g, 'p');
1037
+ if (beziers[str]) {
1038
+ return beziers[str];
1039
+ }
1040
+ var bezEasing = new BezierEasing([a, b, c, d]);
1041
+ beziers[str] = bezEasing;
1042
+ return bezEasing;
1043
+ }
1044
+
1045
+ // These values are established by empiricism with tests (tradeoff: performance VS precision)
1046
+ var NEWTON_ITERATIONS = 4;
1047
+ var NEWTON_MIN_SLOPE = 0.001;
1048
+ var SUBDIVISION_PRECISION = 0.0000001;
1049
+ var SUBDIVISION_MAX_ITERATIONS = 10;
1050
+
1051
+ var kSplineTableSize = 11;
1052
+ var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
1053
+
1054
+ var float32ArraySupported = typeof Float32Array === "function";
1055
+
1056
+ function A(aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; }
1057
+ function B(aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; }
1058
+ function C(aA1) { return 3.0 * aA1; }
1059
+
1060
+ // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
1061
+ function calcBezier(aT, aA1, aA2) {
1062
+ return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;
1063
+ }
1064
+
1065
+ // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
1066
+ function getSlope(aT, aA1, aA2) {
1067
+ return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);
1068
+ }
1069
+
1070
+ function binarySubdivide(aX, aA, aB, mX1, mX2) {
1071
+ var currentX, currentT, i = 0;
1072
+ do {
1073
+ currentT = aA + (aB - aA) / 2.0;
1074
+ currentX = calcBezier(currentT, mX1, mX2) - aX;
1075
+ if (currentX > 0.0) {
1076
+ aB = currentT;
1077
+ } else {
1078
+ aA = currentT;
1079
+ }
1080
+ } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
1081
+ return currentT;
1082
+ }
1083
+
1084
+ function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
1085
+ for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
1086
+ var currentSlope = getSlope(aGuessT, mX1, mX2);
1087
+ if (currentSlope === 0.0) return aGuessT;
1088
+ var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
1089
+ aGuessT -= currentX / currentSlope;
1090
+ }
1091
+ return aGuessT;
1092
+ }
1093
+
1094
+ /**
1095
+ * points is an array of [ mX1, mY1, mX2, mY2 ]
1096
+ */
1097
+ function BezierEasing(points) {
1098
+ this._p = points;
1099
+ this._mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
1100
+ this._precomputed = false;
1101
+
1102
+ this.get = this.get.bind(this);
1103
+ }
1104
+
1105
+ BezierEasing.prototype = {
1106
+
1107
+ get: function (x) {
1108
+ var mX1 = this._p[0],
1109
+ mY1 = this._p[1],
1110
+ mX2 = this._p[2],
1111
+ mY2 = this._p[3];
1112
+ if (!this._precomputed) this._precompute();
1113
+ if (mX1 === mY1 && mX2 === mY2) return x; // linear
1114
+ // Because JavaScript number are imprecise, we should guarantee the extremes are right.
1115
+ if (x === 0) return 0;
1116
+ if (x === 1) return 1;
1117
+ return calcBezier(this._getTForX(x), mY1, mY2);
1118
+ },
1119
+
1120
+ // Private part
1121
+
1122
+ _precompute: function () {
1123
+ var mX1 = this._p[0],
1124
+ mY1 = this._p[1],
1125
+ mX2 = this._p[2],
1126
+ mY2 = this._p[3];
1127
+ this._precomputed = true;
1128
+ if (mX1 !== mY1 || mX2 !== mY2)
1129
+ this._calcSampleValues();
1130
+ },
1131
+
1132
+ _calcSampleValues: function () {
1133
+ var mX1 = this._p[0],
1134
+ mX2 = this._p[2];
1135
+ for (var i = 0; i < kSplineTableSize; ++i) {
1136
+ this._mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
1137
+ }
1138
+ },
1139
+
1140
+ /**
1141
+ * getTForX chose the fastest heuristic to determine the percentage value precisely from a given X projection.
1142
+ */
1143
+ _getTForX: function (aX) {
1144
+ var mX1 = this._p[0],
1145
+ mX2 = this._p[2],
1146
+ mSampleValues = this._mSampleValues;
1147
+
1148
+ var intervalStart = 0.0;
1149
+ var currentSample = 1;
1150
+ var lastSample = kSplineTableSize - 1;
1151
+
1152
+ for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) {
1153
+ intervalStart += kSampleStepSize;
1154
+ }
1155
+ --currentSample;
1156
+
1157
+ // Interpolate to provide an initial guess for t
1158
+ var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]);
1159
+ var guessForT = intervalStart + dist * kSampleStepSize;
1160
+
1161
+ var initialSlope = getSlope(guessForT, mX1, mX2);
1162
+ if (initialSlope >= NEWTON_MIN_SLOPE) {
1163
+ return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
1164
+ } else if (initialSlope === 0.0) {
1165
+ return guessForT;
1166
+ } else {
1167
+ return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
1168
+ }
1169
+ }
1170
+ };
1171
+
1172
+ return ob;
1173
+
1174
+ }());
1175
+ (function () {
1176
+ var lastTime = 0;
1177
+ var vendors = ['ms', 'moz', 'webkit', 'o'];
1178
+ for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
1179
+ window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
1180
+ window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame'];
1181
+ }
1182
+ if (!window.requestAnimationFrame)
1183
+ window.requestAnimationFrame = function (callback, element) {
1184
+ var currTime = new Date().getTime();
1185
+ var timeToCall = Math.max(0, 16 - (currTime - lastTime));
1186
+ var id = setTimeout(function () {
1187
+ callback(currTime + timeToCall);
1188
+ },
1189
+ timeToCall);
1190
+ lastTime = currTime + timeToCall;
1191
+ return id;
1192
+ };
1193
+ if (!window.cancelAnimationFrame)
1194
+ window.cancelAnimationFrame = function (id) {
1195
+ clearTimeout(id);
1196
+ };
1197
+ }());
1198
+
1199
+ function extendPrototype(sources, destination) {
1200
+ var i, len = sources.length, sourcePrototype;
1201
+ for (i = 0; i < len; i += 1) {
1202
+ sourcePrototype = sources[i].prototype;
1203
+ for (var attr in sourcePrototype) {
1204
+ if (sourcePrototype.hasOwnProperty(attr)) destination.prototype[attr] = sourcePrototype[attr];
1205
+ }
1206
+ }
1207
+ }
1208
+
1209
+ function getDescriptor(object, prop) {
1210
+ return Object.getOwnPropertyDescriptor(object, prop);
1211
+ }
1212
+
1213
+ function createProxyFunction(prototype) {
1214
+ function ProxyFunction() { }
1215
+ ProxyFunction.prototype = prototype;
1216
+ return ProxyFunction;
1217
+ }
1218
+ function bezFunction() {
1219
+
1220
+ var easingFunctions = [];
1221
+ var math = Math;
1222
+
1223
+ function pointOnLine2D(x1, y1, x2, y2, x3, y3) {
1224
+ var det1 = (x1 * y2) + (y1 * x3) + (x2 * y3) - (x3 * y2) - (y3 * x1) - (x2 * y1);
1225
+ return det1 > -0.001 && det1 < 0.001;
1226
+ }
1227
+
1228
+ function pointOnLine3D(x1, y1, z1, x2, y2, z2, x3, y3, z3) {
1229
+ if (z1 === 0 && z2 === 0 && z3 === 0) {
1230
+ return pointOnLine2D(x1, y1, x2, y2, x3, y3);
1231
+ }
1232
+ var dist1 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2) + Math.pow(z2 - z1, 2));
1233
+ var dist2 = Math.sqrt(Math.pow(x3 - x1, 2) + Math.pow(y3 - y1, 2) + Math.pow(z3 - z1, 2));
1234
+ var dist3 = Math.sqrt(Math.pow(x3 - x2, 2) + Math.pow(y3 - y2, 2) + Math.pow(z3 - z2, 2));
1235
+ var diffDist;
1236
+ if (dist1 > dist2) {
1237
+ if (dist1 > dist3) {
1238
+ diffDist = dist1 - dist2 - dist3;
1239
+ } else {
1240
+ diffDist = dist3 - dist2 - dist1;
1241
+ }
1242
+ } else if (dist3 > dist2) {
1243
+ diffDist = dist3 - dist2 - dist1;
1244
+ } else {
1245
+ diffDist = dist2 - dist1 - dist3;
1246
+ }
1247
+ return diffDist > -0.0001 && diffDist < 0.0001;
1248
+ }
1249
+
1250
+ var getBezierLength = (function () {
1251
+
1252
+ return function (pt1, pt2, pt3, pt4) {
1253
+ var curveSegments = defaultCurveSegments;
1254
+ var k;
1255
+ var i, len;
1256
+ var ptCoord, perc, addedLength = 0;
1257
+ var ptDistance;
1258
+ var point = [], lastPoint = [];
1259
+ var lengthData = bezier_length_pool.newElement();
1260
+ len = pt3.length;
1261
+ for (k = 0; k < curveSegments; k += 1) {
1262
+ perc = k / (curveSegments - 1);
1263
+ ptDistance = 0;
1264
+ for (i = 0; i < len; i += 1) {
1265
+ ptCoord = bm_pow(1 - perc, 3) * pt1[i] + 3 * bm_pow(1 - perc, 2) * perc * pt3[i] + 3 * (1 - perc) * bm_pow(perc, 2) * pt4[i] + bm_pow(perc, 3) * pt2[i];
1266
+ point[i] = ptCoord;
1267
+ if (lastPoint[i] !== null) {
1268
+ ptDistance += bm_pow(point[i] - lastPoint[i], 2);
1269
+ }
1270
+ lastPoint[i] = point[i];
1271
+ }
1272
+ if (ptDistance) {
1273
+ ptDistance = bm_sqrt(ptDistance);
1274
+ addedLength += ptDistance;
1275
+ }
1276
+ lengthData.percents[k] = perc;
1277
+ lengthData.lengths[k] = addedLength;
1278
+ }
1279
+ lengthData.addedLength = addedLength;
1280
+ return lengthData;
1281
+ };
1282
+ }());
1283
+
1284
+ function getSegmentsLength(shapeData) {
1285
+ var segmentsLength = segments_length_pool.newElement();
1286
+ var closed = shapeData.c;
1287
+ var pathV = shapeData.v;
1288
+ var pathO = shapeData.o;
1289
+ var pathI = shapeData.i;
1290
+ var i, len = shapeData._length;
1291
+ var lengths = segmentsLength.lengths;
1292
+ var totalLength = 0;
1293
+ for (i = 0; i < len - 1; i += 1) {
1294
+ lengths[i] = getBezierLength(pathV[i], pathV[i + 1], pathO[i], pathI[i + 1]);
1295
+ totalLength += lengths[i].addedLength;
1296
+ }
1297
+ if (closed && len) {
1298
+ lengths[i] = getBezierLength(pathV[i], pathV[0], pathO[i], pathI[0]);
1299
+ totalLength += lengths[i].addedLength;
1300
+ }
1301
+ segmentsLength.totalLength = totalLength;
1302
+ return segmentsLength;
1303
+ }
1304
+
1305
+ function BezierData(length) {
1306
+ this.segmentLength = 0;
1307
+ this.points = new Array(length);
1308
+ }
1309
+
1310
+ function PointData(partial, point) {
1311
+ this.partialLength = partial;
1312
+ this.point = point;
1313
+ }
1314
+
1315
+ var buildBezierData = (function () {
1316
+
1317
+ var storedData = {};
1318
+
1319
+ return function (pt1, pt2, pt3, pt4) {
1320
+ var bezierName = (pt1[0] + '_' + pt1[1] + '_' + pt2[0] + '_' + pt2[1] + '_' + pt3[0] + '_' + pt3[1] + '_' + pt4[0] + '_' + pt4[1]).replace(/\./g, 'p');
1321
+ if (!storedData[bezierName]) {
1322
+ var curveSegments = defaultCurveSegments;
1323
+ var k, i, len;
1324
+ var ptCoord, perc, addedLength = 0;
1325
+ var ptDistance;
1326
+ var point, lastPoint = null;
1327
+ if (pt1.length === 2 && (pt1[0] != pt2[0] || pt1[1] != pt2[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt1[0] + pt3[0], pt1[1] + pt3[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt2[0] + pt4[0], pt2[1] + pt4[1])) {
1328
+ curveSegments = 2;
1329
+ }
1330
+ var bezierData = new BezierData(curveSegments);
1331
+ len = pt3.length;
1332
+ for (k = 0; k < curveSegments; k += 1) {
1333
+ point = createSizedArray(len);
1334
+ perc = k / (curveSegments - 1);
1335
+ ptDistance = 0;
1336
+ for (i = 0; i < len; i += 1) {
1337
+ ptCoord = bm_pow(1 - perc, 3) * pt1[i] + 3 * bm_pow(1 - perc, 2) * perc * (pt1[i] + pt3[i]) + 3 * (1 - perc) * bm_pow(perc, 2) * (pt2[i] + pt4[i]) + bm_pow(perc, 3) * pt2[i];
1338
+ point[i] = ptCoord;
1339
+ if (lastPoint !== null) {
1340
+ ptDistance += bm_pow(point[i] - lastPoint[i], 2);
1341
+ }
1342
+ }
1343
+ ptDistance = bm_sqrt(ptDistance);
1344
+ addedLength += ptDistance;
1345
+ bezierData.points[k] = new PointData(ptDistance, point);
1346
+ lastPoint = point;
1347
+ }
1348
+ bezierData.segmentLength = addedLength;
1349
+ storedData[bezierName] = bezierData;
1350
+ }
1351
+ return storedData[bezierName];
1352
+ };
1353
+ }());
1354
+
1355
+ function getDistancePerc(perc, bezierData) {
1356
+ var percents = bezierData.percents;
1357
+ var lengths = bezierData.lengths;
1358
+ var len = percents.length;
1359
+ var initPos = bm_floor((len - 1) * perc);
1360
+ var lengthPos = perc * bezierData.addedLength;
1361
+ var lPerc = 0;
1362
+ if (initPos === len - 1 || initPos === 0 || lengthPos === lengths[initPos]) {
1363
+ return percents[initPos];
1364
+ } else {
1365
+ var dir = lengths[initPos] > lengthPos ? -1 : 1;
1366
+ var flag = true;
1367
+ while (flag) {
1368
+ if (lengths[initPos] <= lengthPos && lengths[initPos + 1] > lengthPos) {
1369
+ lPerc = (lengthPos - lengths[initPos]) / (lengths[initPos + 1] - lengths[initPos]);
1370
+ flag = false;
1371
+ } else {
1372
+ initPos += dir;
1373
+ }
1374
+ if (initPos < 0 || initPos >= len - 1) {
1375
+ //FIX for TypedArrays that don't store floating point values with enough accuracy
1376
+ if (initPos === len - 1) {
1377
+ return percents[initPos];
1378
+ }
1379
+ flag = false;
1380
+ }
1381
+ }
1382
+ return percents[initPos] + (percents[initPos + 1] - percents[initPos]) * lPerc;
1383
+ }
1384
+ }
1385
+
1386
+ function getPointInSegment(pt1, pt2, pt3, pt4, percent, bezierData) {
1387
+ var t1 = getDistancePerc(percent, bezierData);
1388
+ var u0 = 1;
1389
+ var u1 = 1 - t1;
1390
+ var ptX = Math.round((u1 * u1 * u1 * pt1[0] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[0] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[0] + t1 * t1 * t1 * pt2[0]) * 1000) / 1000;
1391
+ var ptY = Math.round((u1 * u1 * u1 * pt1[1] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[1] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[1] + t1 * t1 * t1 * pt2[1]) * 1000) / 1000;
1392
+ return [ptX, ptY];
1393
+ }
1394
+
1395
+ function getSegmentArray() {
1396
+
1397
+ }
1398
+
1399
+ var bezier_segment_points = createTypedArray('float32', 8);
1400
+
1401
+ function getNewSegment(pt1, pt2, pt3, pt4, startPerc, endPerc, bezierData) {
1402
+
1403
+ startPerc = startPerc < 0 ? 0 : startPerc > 1 ? 1 : startPerc;
1404
+ var t0 = getDistancePerc(startPerc, bezierData);
1405
+ endPerc = endPerc > 1 ? 1 : endPerc;
1406
+ var t1 = getDistancePerc(endPerc, bezierData);
1407
+ var i, len = pt1.length;
1408
+ var u0 = 1 - t0;
1409
+ var u1 = 1 - t1;
1410
+ var u0u0u0 = u0 * u0 * u0;
1411
+ var t0u0u0_3 = t0 * u0 * u0 * 3;
1412
+ var t0t0u0_3 = t0 * t0 * u0 * 3;
1413
+ var t0t0t0 = t0 * t0 * t0;
1414
+ //
1415
+ var u0u0u1 = u0 * u0 * u1;
1416
+ var t0u0u1_3 = t0 * u0 * u1 + u0 * t0 * u1 + u0 * u0 * t1;
1417
+ var t0t0u1_3 = t0 * t0 * u1 + u0 * t0 * t1 + t0 * u0 * t1;
1418
+ var t0t0t1 = t0 * t0 * t1;
1419
+ //
1420
+ var u0u1u1 = u0 * u1 * u1;
1421
+ var t0u1u1_3 = t0 * u1 * u1 + u0 * t1 * u1 + u0 * u1 * t1;
1422
+ var t0t1u1_3 = t0 * t1 * u1 + u0 * t1 * t1 + t0 * u1 * t1;
1423
+ var t0t1t1 = t0 * t1 * t1;
1424
+ //
1425
+ var u1u1u1 = u1 * u1 * u1;
1426
+ var t1u1u1_3 = t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1;
1427
+ var t1t1u1_3 = t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1;
1428
+ var t1t1t1 = t1 * t1 * t1;
1429
+ for (i = 0; i < len; i += 1) {
1430
+ bezier_segment_points[i * 4] = Math.round((u0u0u0 * pt1[i] + t0u0u0_3 * pt3[i] + t0t0u0_3 * pt4[i] + t0t0t0 * pt2[i]) * 1000) / 1000;
1431
+ bezier_segment_points[i * 4 + 1] = Math.round((u0u0u1 * pt1[i] + t0u0u1_3 * pt3[i] + t0t0u1_3 * pt4[i] + t0t0t1 * pt2[i]) * 1000) / 1000;
1432
+ bezier_segment_points[i * 4 + 2] = Math.round((u0u1u1 * pt1[i] + t0u1u1_3 * pt3[i] + t0t1u1_3 * pt4[i] + t0t1t1 * pt2[i]) * 1000) / 1000;
1433
+ bezier_segment_points[i * 4 + 3] = Math.round((u1u1u1 * pt1[i] + t1u1u1_3 * pt3[i] + t1t1u1_3 * pt4[i] + t1t1t1 * pt2[i]) * 1000) / 1000;
1434
+ }
1435
+
1436
+ return bezier_segment_points;
1437
+ }
1438
+
1439
+ return {
1440
+ getSegmentsLength: getSegmentsLength,
1441
+ getNewSegment: getNewSegment,
1442
+ getPointInSegment: getPointInSegment,
1443
+ buildBezierData: buildBezierData,
1444
+ pointOnLine2D: pointOnLine2D,
1445
+ pointOnLine3D: pointOnLine3D
1446
+ };
1447
+ }
1448
+
1449
+ var bez = bezFunction();
1450
+ function dataFunctionManager() {
1451
+
1452
+ //var tCanvasHelper = createTag('canvas').getContext('2d');
1453
+
1454
+ function completeLayers(layers, comps, fontManager) {
1455
+ var layerData;
1456
+ var animArray, lastFrame;
1457
+ var i, len = layers.length;
1458
+ var j, jLen, k, kLen;
1459
+ for (i = 0; i < len; i += 1) {
1460
+ layerData = layers[i];
1461
+ if (!('ks' in layerData) || layerData.completed) {
1462
+ continue;
1463
+ }
1464
+ layerData.completed = true;
1465
+ if (layerData.tt) {
1466
+ layers[i - 1].td = layerData.tt;
1467
+ }
1468
+ animArray = [];
1469
+ lastFrame = -1;
1470
+ if (layerData.hasMask) {
1471
+ var maskProps = layerData.masksProperties;
1472
+ jLen = maskProps.length;
1473
+ for (j = 0; j < jLen; j += 1) {
1474
+ if (maskProps[j].pt.k.i) {
1475
+ convertPathsToAbsoluteValues(maskProps[j].pt.k);
1476
+ } else {
1477
+ kLen = maskProps[j].pt.k.length;
1478
+ for (k = 0; k < kLen; k += 1) {
1479
+ if (maskProps[j].pt.k[k].s) {
1480
+ convertPathsToAbsoluteValues(maskProps[j].pt.k[k].s[0]);
1481
+ }
1482
+ if (maskProps[j].pt.k[k].e) {
1483
+ convertPathsToAbsoluteValues(maskProps[j].pt.k[k].e[0]);
1484
+ }
1485
+ }
1486
+ }
1487
+ }
1488
+ }
1489
+ if (layerData.ty === 0) {
1490
+ layerData.layers = findCompLayers(layerData.refId, comps);
1491
+ completeLayers(layerData.layers, comps, fontManager);
1492
+ } else if (layerData.ty === 4) {
1493
+ completeShapes(layerData.shapes);
1494
+ } else if (layerData.ty == 5) {
1495
+ completeText(layerData, fontManager);
1496
+ }
1497
+ }
1498
+ }
1499
+
1500
+ function findCompLayers(id, comps) {
1501
+ var i = 0, len = comps.length;
1502
+ while (i < len) {
1503
+ if (comps[i].id === id) {
1504
+ if (!comps[i].layers.__used) {
1505
+ comps[i].layers.__used = true;
1506
+ return comps[i].layers;
1507
+ }
1508
+ return JSON.parse(JSON.stringify(comps[i].layers));
1509
+ }
1510
+ i += 1;
1511
+ }
1512
+ }
1513
+
1514
+ function completeShapes(arr) {
1515
+ var i, len = arr.length;
1516
+ var j, jLen;
1517
+ var hasPaths = false;
1518
+ for (i = len - 1; i >= 0; i -= 1) {
1519
+ if (arr[i].ty == 'sh') {
1520
+ if (arr[i].ks.k.i) {
1521
+ convertPathsToAbsoluteValues(arr[i].ks.k);
1522
+ } else {
1523
+ jLen = arr[i].ks.k.length;
1524
+ for (j = 0; j < jLen; j += 1) {
1525
+ if (arr[i].ks.k[j].s) {
1526
+ convertPathsToAbsoluteValues(arr[i].ks.k[j].s[0]);
1527
+ }
1528
+ if (arr[i].ks.k[j].e) {
1529
+ convertPathsToAbsoluteValues(arr[i].ks.k[j].e[0]);
1530
+ }
1531
+ }
1532
+ }
1533
+ hasPaths = true;
1534
+ } else if (arr[i].ty == 'gr') {
1535
+ completeShapes(arr[i].it);
1536
+ }
1537
+ }
1538
+ /*if(hasPaths){
1539
+ //mx: distance
1540
+ //ss: sensitivity
1541
+ //dc: decay
1542
+ arr.splice(arr.length-1,0,{
1543
+ "ty": "ms",
1544
+ "mx":20,
1545
+ "ss":10,
1546
+ "dc":0.001,
1547
+ "maxDist":200
1548
+ });
1549
+ }*/
1550
+ }
1551
+
1552
+ function convertPathsToAbsoluteValues(path) {
1553
+ var i, len = path.i.length;
1554
+ for (i = 0; i < len; i += 1) {
1555
+ path.i[i][0] += path.v[i][0];
1556
+ path.i[i][1] += path.v[i][1];
1557
+ path.o[i][0] += path.v[i][0];
1558
+ path.o[i][1] += path.v[i][1];
1559
+ }
1560
+ }
1561
+
1562
+ function checkVersion(minimum, animVersionString) {
1563
+ var animVersion = animVersionString ? animVersionString.split('.') : [100, 100, 100];
1564
+ if (minimum[0] > animVersion[0]) {
1565
+ return true;
1566
+ } else if (animVersion[0] > minimum[0]) {
1567
+ return false;
1568
+ }
1569
+ if (minimum[1] > animVersion[1]) {
1570
+ return true;
1571
+ } else if (animVersion[1] > minimum[1]) {
1572
+ return false;
1573
+ }
1574
+ if (minimum[2] > animVersion[2]) {
1575
+ return true;
1576
+ } else if (animVersion[2] > minimum[2]) {
1577
+ return false;
1578
+ }
1579
+ }
1580
+
1581
+ var checkText = (function () {
1582
+ var minimumVersion = [4, 4, 14];
1583
+
1584
+ function updateTextLayer(textLayer) {
1585
+ var documentData = textLayer.t.d;
1586
+ textLayer.t.d = {
1587
+ k: [
1588
+ {
1589
+ s: documentData,
1590
+ t: 0
1591
+ }
1592
+ ]
1593
+ };
1594
+ }
1595
+
1596
+ function iterateLayers(layers) {
1597
+ var i, len = layers.length;
1598
+ for (i = 0; i < len; i += 1) {
1599
+ if (layers[i].ty === 5) {
1600
+ updateTextLayer(layers[i]);
1601
+ }
1602
+ }
1603
+ }
1604
+
1605
+ return function (animationData) {
1606
+ if (checkVersion(minimumVersion, animationData.v)) {
1607
+ iterateLayers(animationData.layers);
1608
+ if (animationData.assets) {
1609
+ var i, len = animationData.assets.length;
1610
+ for (i = 0; i < len; i += 1) {
1611
+ if (animationData.assets[i].layers) {
1612
+ iterateLayers(animationData.assets[i].layers);
1613
+
1614
+ }
1615
+ }
1616
+ }
1617
+ }
1618
+ };
1619
+ }());
1620
+
1621
+ var checkChars = (function () {
1622
+ var minimumVersion = [4, 7, 99];
1623
+ return function (animationData) {
1624
+ if (animationData.chars && !checkVersion(minimumVersion, animationData.v)) {
1625
+ var i, len = animationData.chars.length, j, jLen, k, kLen;
1626
+ var pathData, paths;
1627
+ for (i = 0; i < len; i += 1) {
1628
+ if (animationData.chars[i].data && animationData.chars[i].data.shapes) {
1629
+ paths = animationData.chars[i].data.shapes[0].it;
1630
+ jLen = paths.length;
1631
+
1632
+ for (j = 0; j < jLen; j += 1) {
1633
+ pathData = paths[j].ks.k;
1634
+ if (!pathData.__converted) {
1635
+ convertPathsToAbsoluteValues(paths[j].ks.k);
1636
+ pathData.__converted = true;
1637
+ }
1638
+ }
1639
+ }
1640
+ }
1641
+ }
1642
+ };
1643
+ }());
1644
+
1645
+ var checkColors = (function () {
1646
+ var minimumVersion = [4, 1, 9];
1647
+
1648
+ function iterateShapes(shapes) {
1649
+ var i, len = shapes.length;
1650
+ var j, jLen;
1651
+ for (i = 0; i < len; i += 1) {
1652
+ if (shapes[i].ty === 'gr') {
1653
+ iterateShapes(shapes[i].it);
1654
+ } else if (shapes[i].ty === 'fl' || shapes[i].ty === 'st') {
1655
+ if (shapes[i].c.k && shapes[i].c.k[0].i) {
1656
+ jLen = shapes[i].c.k.length;
1657
+ for (j = 0; j < jLen; j += 1) {
1658
+ if (shapes[i].c.k[j].s) {
1659
+ shapes[i].c.k[j].s[0] /= 255;
1660
+ shapes[i].c.k[j].s[1] /= 255;
1661
+ shapes[i].c.k[j].s[2] /= 255;
1662
+ shapes[i].c.k[j].s[3] /= 255;
1663
+ }
1664
+ if (shapes[i].c.k[j].e) {
1665
+ shapes[i].c.k[j].e[0] /= 255;
1666
+ shapes[i].c.k[j].e[1] /= 255;
1667
+ shapes[i].c.k[j].e[2] /= 255;
1668
+ shapes[i].c.k[j].e[3] /= 255;
1669
+ }
1670
+ }
1671
+ } else {
1672
+ shapes[i].c.k[0] /= 255;
1673
+ shapes[i].c.k[1] /= 255;
1674
+ shapes[i].c.k[2] /= 255;
1675
+ shapes[i].c.k[3] /= 255;
1676
+ }
1677
+ }
1678
+ }
1679
+ }
1680
+
1681
+ function iterateLayers(layers) {
1682
+ var i, len = layers.length;
1683
+ for (i = 0; i < len; i += 1) {
1684
+ if (layers[i].ty === 4) {
1685
+ iterateShapes(layers[i].shapes);
1686
+ }
1687
+ }
1688
+ }
1689
+
1690
+ return function (animationData) {
1691
+ if (checkVersion(minimumVersion, animationData.v)) {
1692
+ iterateLayers(animationData.layers);
1693
+ if (animationData.assets) {
1694
+ var i, len = animationData.assets.length;
1695
+ for (i = 0; i < len; i += 1) {
1696
+ if (animationData.assets[i].layers) {
1697
+ iterateLayers(animationData.assets[i].layers);
1698
+
1699
+ }
1700
+ }
1701
+ }
1702
+ }
1703
+ };
1704
+ }());
1705
+
1706
+ var checkShapes = (function () {
1707
+ var minimumVersion = [4, 4, 18];
1708
+
1709
+
1710
+
1711
+ function completeShapes(arr) {
1712
+ var i, len = arr.length;
1713
+ var j, jLen;
1714
+ var hasPaths = false;
1715
+ for (i = len - 1; i >= 0; i -= 1) {
1716
+ if (arr[i].ty == 'sh') {
1717
+ if (arr[i].ks.k.i) {
1718
+ arr[i].ks.k.c = arr[i].closed;
1719
+ } else {
1720
+ jLen = arr[i].ks.k.length;
1721
+ for (j = 0; j < jLen; j += 1) {
1722
+ if (arr[i].ks.k[j].s) {
1723
+ arr[i].ks.k[j].s[0].c = arr[i].closed;
1724
+ }
1725
+ if (arr[i].ks.k[j].e) {
1726
+ arr[i].ks.k[j].e[0].c = arr[i].closed;
1727
+ }
1728
+ }
1729
+ }
1730
+ hasPaths = true;
1731
+ } else if (arr[i].ty == 'gr') {
1732
+ completeShapes(arr[i].it);
1733
+ }
1734
+ }
1735
+ }
1736
+
1737
+ function iterateLayers(layers) {
1738
+ var layerData;
1739
+ var i, len = layers.length;
1740
+ var j, jLen, k, kLen;
1741
+ for (i = 0; i < len; i += 1) {
1742
+ layerData = layers[i];
1743
+ if (layerData.hasMask) {
1744
+ var maskProps = layerData.masksProperties;
1745
+ jLen = maskProps.length;
1746
+ for (j = 0; j < jLen; j += 1) {
1747
+ if (maskProps[j].pt.k.i) {
1748
+ maskProps[j].pt.k.c = maskProps[j].cl;
1749
+ } else {
1750
+ kLen = maskProps[j].pt.k.length;
1751
+ for (k = 0; k < kLen; k += 1) {
1752
+ if (maskProps[j].pt.k[k].s) {
1753
+ maskProps[j].pt.k[k].s[0].c = maskProps[j].cl;
1754
+ }
1755
+ if (maskProps[j].pt.k[k].e) {
1756
+ maskProps[j].pt.k[k].e[0].c = maskProps[j].cl;
1757
+ }
1758
+ }
1759
+ }
1760
+ }
1761
+ }
1762
+ if (layerData.ty === 4) {
1763
+ completeShapes(layerData.shapes);
1764
+ }
1765
+ }
1766
+ }
1767
+
1768
+ return function (animationData) {
1769
+ if (checkVersion(minimumVersion, animationData.v)) {
1770
+ iterateLayers(animationData.layers);
1771
+ if (animationData.assets) {
1772
+ var i, len = animationData.assets.length;
1773
+ for (i = 0; i < len; i += 1) {
1774
+ if (animationData.assets[i].layers) {
1775
+ iterateLayers(animationData.assets[i].layers);
1776
+
1777
+ }
1778
+ }
1779
+ }
1780
+ }
1781
+ };
1782
+ }());
1783
+
1784
+ function completeData(animationData, fontManager) {
1785
+ if (animationData.__complete) {
1786
+ return;
1787
+ }
1788
+ checkColors(animationData);
1789
+ checkText(animationData);
1790
+ checkChars(animationData);
1791
+ checkShapes(animationData);
1792
+ completeLayers(animationData.layers, animationData.assets, fontManager);
1793
+ animationData.__complete = true;
1794
+ //blitAnimation(animationData, animationData.assets, fontManager);
1795
+ }
1796
+
1797
+ function completeText(data, fontManager) {
1798
+ if (data.t.a.length === 0 && !('m' in data.t.p)) {
1799
+ data.singleShape = true;
1800
+ }
1801
+ }
1802
+
1803
+ var moduleOb = {};
1804
+ moduleOb.completeData = completeData;
1805
+ moduleOb.checkColors = checkColors;
1806
+ moduleOb.checkChars = checkChars;
1807
+ moduleOb.checkShapes = checkShapes;
1808
+ moduleOb.completeLayers = completeLayers;
1809
+
1810
+ return moduleOb;
1811
+ }
1812
+
1813
+ var dataManager = dataFunctionManager();
1814
+
1815
+ var FontManager = (function () {
1816
+
1817
+ var maxWaitingTime = 5000;
1818
+ var emptyChar = {
1819
+ w: 0,
1820
+ size: 0,
1821
+ shapes: []
1822
+ };
1823
+ var combinedCharacters = [];
1824
+ //Hindi characters
1825
+ combinedCharacters = combinedCharacters.concat([2304, 2305, 2306, 2307, 2362, 2363, 2364, 2364, 2366
1826
+ , 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379
1827
+ , 2380, 2381, 2382, 2383, 2387, 2388, 2389, 2390, 2391, 2402, 2403]);
1828
+
1829
+ function setUpNode(font, family) {
1830
+ var parentNode = createTag('span');
1831
+ parentNode.style.fontFamily = family;
1832
+ var node = createTag('span');
1833
+ // Characters that vary significantly among different fonts
1834
+ node.innerHTML = 'giItT1WQy@!-/#';
1835
+ // Visible - so we can measure it - but not on the screen
1836
+ parentNode.style.position = 'absolute';
1837
+ parentNode.style.left = '-10000px';
1838
+ parentNode.style.top = '-10000px';
1839
+ // Large font size makes even subtle changes obvious
1840
+ parentNode.style.fontSize = '300px';
1841
+ // Reset any font properties
1842
+ parentNode.style.fontVariant = 'normal';
1843
+ parentNode.style.fontStyle = 'normal';
1844
+ parentNode.style.fontWeight = 'normal';
1845
+ parentNode.style.letterSpacing = '0';
1846
+ parentNode.appendChild(node);
1847
+ document.body.appendChild(parentNode);
1848
+
1849
+ // Remember width with no applied web font
1850
+ var width = node.offsetWidth;
1851
+ node.style.fontFamily = font + ', ' + family;
1852
+ return { node: node, w: width, parent: parentNode };
1853
+ }
1854
+
1855
+ function checkLoadedFonts() {
1856
+ var i, len = this.fonts.length;
1857
+ var node, w;
1858
+ var loadedCount = len;
1859
+ for (i = 0; i < len; i += 1) {
1860
+ if (this.fonts[i].loaded) {
1861
+ loadedCount -= 1;
1862
+ continue;
1863
+ }
1864
+ if (this.fonts[i].fOrigin === 'n' || this.fonts[i].origin === 0) {
1865
+ this.fonts[i].loaded = true;
1866
+ } else {
1867
+ node = this.fonts[i].monoCase.node;
1868
+ w = this.fonts[i].monoCase.w;
1869
+ if (node.offsetWidth !== w) {
1870
+ loadedCount -= 1;
1871
+ this.fonts[i].loaded = true;
1872
+ } else {
1873
+ node = this.fonts[i].sansCase.node;
1874
+ w = this.fonts[i].sansCase.w;
1875
+ if (node.offsetWidth !== w) {
1876
+ loadedCount -= 1;
1877
+ this.fonts[i].loaded = true;
1878
+ }
1879
+ }
1880
+ if (this.fonts[i].loaded) {
1881
+ this.fonts[i].sansCase.parent.parentNode.removeChild(this.fonts[i].sansCase.parent);
1882
+ this.fonts[i].monoCase.parent.parentNode.removeChild(this.fonts[i].monoCase.parent);
1883
+ }
1884
+ }
1885
+ }
1886
+
1887
+ if (loadedCount !== 0 && Date.now() - this.initTime < maxWaitingTime) {
1888
+ setTimeout(this.checkLoadedFonts.bind(this), 20);
1889
+ } else {
1890
+ setTimeout(function () { this.isLoaded = true; }.bind(this), 0);
1891
+
1892
+ }
1893
+ }
1894
+
1895
+ function createHelper(def, fontData) {
1896
+ var tHelper = createNS('text');
1897
+ tHelper.style.fontSize = '100px';
1898
+ //tHelper.style.fontFamily = fontData.fFamily;
1899
+ tHelper.setAttribute('font-family', fontData.fFamily);
1900
+ tHelper.setAttribute('font-style', fontData.fStyle);
1901
+ tHelper.setAttribute('font-weight', fontData.fWeight);
1902
+ tHelper.textContent = '1';
1903
+ if (fontData.fClass) {
1904
+ tHelper.style.fontFamily = 'inherit';
1905
+ tHelper.setAttribute('class', fontData.fClass);
1906
+ } else {
1907
+ tHelper.style.fontFamily = fontData.fFamily;
1908
+ }
1909
+ def.appendChild(tHelper);
1910
+ var tCanvasHelper = createTag('canvas').getContext('2d');
1911
+ tCanvasHelper.font = fontData.fWeight + ' ' + fontData.fStyle + ' 100px ' + fontData.fFamily;
1912
+ //tCanvasHelper.font = ' 100px '+ fontData.fFamily;
1913
+ return tHelper;
1914
+ }
1915
+
1916
+ function addFonts(fontData, defs) {
1917
+ if (!fontData) {
1918
+ this.isLoaded = true;
1919
+ return;
1920
+ }
1921
+ if (this.chars) {
1922
+ this.isLoaded = true;
1923
+ this.fonts = fontData.list;
1924
+ return;
1925
+ }
1926
+
1927
+
1928
+ var fontArr = fontData.list;
1929
+ var i, len = fontArr.length;
1930
+ var _pendingFonts = len;
1931
+ for (i = 0; i < len; i += 1) {
1932
+ var shouldLoadFont = true;
1933
+ var loadedSelector;
1934
+ var j;
1935
+ fontArr[i].loaded = false;
1936
+ fontArr[i].monoCase = setUpNode(fontArr[i].fFamily, 'monospace');
1937
+ fontArr[i].sansCase = setUpNode(fontArr[i].fFamily, 'sans-serif');
1938
+ if (!fontArr[i].fPath) {
1939
+ fontArr[i].loaded = true;
1940
+ _pendingFonts -= 1;
1941
+ } else if (fontArr[i].fOrigin === 'p' || fontArr[i].origin === 3) {
1942
+ loadedSelector = document.querySelectorAll('style[f-forigin="p"][f-family="' + fontArr[i].fFamily + '"], style[f-origin="3"][f-family="' + fontArr[i].fFamily + '"]');
1943
+
1944
+ if (loadedSelector.length > 0) {
1945
+ shouldLoadFont = false;
1946
+ }
1947
+
1948
+ if (shouldLoadFont) {
1949
+ var s = createTag('style');
1950
+ s.setAttribute('f-forigin', fontArr[i].fOrigin);
1951
+ s.setAttribute('f-origin', fontArr[i].origin);
1952
+ s.setAttribute('f-family', fontArr[i].fFamily);
1953
+ s.type = "text/css";
1954
+ s.innerHTML = "@font-face {" + "font-family: " + fontArr[i].fFamily + "; font-style: normal; src: url('" + fontArr[i].fPath + "');}";
1955
+ defs.appendChild(s);
1956
+ }
1957
+ } else if (fontArr[i].fOrigin === 'g' || fontArr[i].origin === 1) {
1958
+ loadedSelector = document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]');
1959
+
1960
+ for (j = 0; j < loadedSelector.length; j++) {
1961
+ if (loadedSelector[j].href.indexOf(fontArr[i].fPath) !== -1) {
1962
+ // Font is already loaded
1963
+ shouldLoadFont = false;
1964
+ }
1965
+ }
1966
+
1967
+ if (shouldLoadFont) {
1968
+ var l = createTag('link');
1969
+ l.setAttribute('f-forigin', fontArr[i].fOrigin);
1970
+ l.setAttribute('f-origin', fontArr[i].origin);
1971
+ l.type = "text/css";
1972
+ l.rel = "stylesheet";
1973
+ l.href = fontArr[i].fPath;
1974
+ document.body.appendChild(l);
1975
+ }
1976
+ } else if (fontArr[i].fOrigin === 't' || fontArr[i].origin === 2) {
1977
+ loadedSelector = document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]');
1978
+
1979
+ for (j = 0; j < loadedSelector.length; j++) {
1980
+ if (fontArr[i].fPath === loadedSelector[j].src) {
1981
+ // Font is already loaded
1982
+ shouldLoadFont = false;
1983
+ }
1984
+ }
1985
+
1986
+ if (shouldLoadFont) {
1987
+ var sc = createTag('link');
1988
+ sc.setAttribute('f-forigin', fontArr[i].fOrigin);
1989
+ sc.setAttribute('f-origin', fontArr[i].origin);
1990
+ sc.setAttribute('rel', 'stylesheet');
1991
+ sc.setAttribute('href', fontArr[i].fPath);
1992
+ defs.appendChild(sc);
1993
+ }
1994
+ }
1995
+ fontArr[i].helper = createHelper(defs, fontArr[i]);
1996
+ fontArr[i].cache = {};
1997
+ this.fonts.push(fontArr[i]);
1998
+ }
1999
+ if (_pendingFonts === 0) {
2000
+ this.isLoaded = true;
2001
+ } else {
2002
+ //On some cases even if the font is loaded, it won't load correctly when measuring text on canvas.
2003
+ //Adding this timeout seems to fix it
2004
+ setTimeout(this.checkLoadedFonts.bind(this), 100);
2005
+ }
2006
+ }
2007
+
2008
+ function addChars(chars) {
2009
+ if (!chars) {
2010
+ return;
2011
+ }
2012
+ if (!this.chars) {
2013
+ this.chars = [];
2014
+ }
2015
+ var i, len = chars.length;
2016
+ var j, jLen = this.chars.length, found;
2017
+ for (i = 0; i < len; i += 1) {
2018
+ j = 0;
2019
+ found = false;
2020
+ while (j < jLen) {
2021
+ if (this.chars[j].style === chars[i].style && this.chars[j].fFamily === chars[i].fFamily && this.chars[j].ch === chars[i].ch) {
2022
+ found = true;
2023
+ }
2024
+ j += 1;
2025
+ }
2026
+ if (!found) {
2027
+ this.chars.push(chars[i]);
2028
+ jLen += 1;
2029
+ }
2030
+ }
2031
+ }
2032
+
2033
+ function getCharData(char, style, font) {
2034
+ var i = 0, len = this.chars.length;
2035
+ while (i < len) {
2036
+ if (this.chars[i].ch === char && this.chars[i].style === style && this.chars[i].fFamily === font) {
2037
+
2038
+ return this.chars[i];
2039
+ }
2040
+ i += 1;
2041
+ }
2042
+ if ((typeof char === 'string' && char.charCodeAt(0) !== 13 || !char) && console && console.warn) {
2043
+ console.warn('Missing character from exported characters list: ', char, style, font);
2044
+ }
2045
+ return emptyChar;
2046
+ }
2047
+
2048
+ function measureText(char, fontName, size) {
2049
+ var fontData = this.getFontByName(fontName);
2050
+ var index = char.charCodeAt(0);
2051
+ if (!fontData.cache[index + 1]) {
2052
+ var tHelper = fontData.helper;
2053
+ //Canvas version
2054
+ //fontData.cache[index] = tHelper.measureText(char).width / 100;
2055
+ //SVG version
2056
+ //console.log(tHelper.getBBox().width)
2057
+ if (char === ' ') {
2058
+ tHelper.textContent = '|' + char + '|';
2059
+ var doubleSize = tHelper.getComputedTextLength();
2060
+ tHelper.textContent = '||';
2061
+ var singleSize = tHelper.getComputedTextLength();
2062
+ fontData.cache[index + 1] = (doubleSize - singleSize) / 100;
2063
+ } else {
2064
+ tHelper.textContent = char;
2065
+ fontData.cache[index + 1] = (tHelper.getComputedTextLength()) / 100;
2066
+ }
2067
+ }
2068
+ return fontData.cache[index + 1] * size;
2069
+ }
2070
+
2071
+ function getFontByName(name) {
2072
+ var i = 0, len = this.fonts.length;
2073
+ while (i < len) {
2074
+ if (this.fonts[i].fName === name) {
2075
+ return this.fonts[i];
2076
+ }
2077
+ i += 1;
2078
+ }
2079
+ return this.fonts[0];
2080
+ }
2081
+
2082
+ function getCombinedCharacterCodes() {
2083
+ return combinedCharacters;
2084
+ }
2085
+
2086
+ function loaded() {
2087
+ return this.isLoaded;
2088
+ }
2089
+
2090
+ var Font = function () {
2091
+ this.fonts = [];
2092
+ this.chars = null;
2093
+ this.typekitLoaded = 0;
2094
+ this.isLoaded = false;
2095
+ this.initTime = Date.now();
2096
+ };
2097
+ //TODO: for now I'm adding these methods to the Class and not the prototype. Think of a better way to implement it.
2098
+ Font.getCombinedCharacterCodes = getCombinedCharacterCodes;
2099
+
2100
+ Font.prototype.addChars = addChars;
2101
+ Font.prototype.addFonts = addFonts;
2102
+ Font.prototype.getCharData = getCharData;
2103
+ Font.prototype.getFontByName = getFontByName;
2104
+ Font.prototype.measureText = measureText;
2105
+ Font.prototype.checkLoadedFonts = checkLoadedFonts;
2106
+ Font.prototype.loaded = loaded;
2107
+
2108
+ return Font;
2109
+
2110
+ }());
2111
+ var PropertyFactory = (function () {
2112
+
2113
+ var initFrame = initialDefaultFrame;
2114
+ var math_abs = Math.abs;
2115
+
2116
+ function interpolateValue(frameNum, caching) {
2117
+ var offsetTime = this.offsetTime;
2118
+ var newValue;
2119
+ if (this.propType === 'multidimensional') {
2120
+ newValue = createTypedArray('float32', this.pv.length);
2121
+ }
2122
+ var iterationIndex = caching.lastIndex;
2123
+ var i = iterationIndex;
2124
+ var len = this.keyframes.length - 1, flag = true;
2125
+ var keyData, nextKeyData;
2126
+
2127
+ while (flag) {
2128
+ keyData = this.keyframes[i];
2129
+ nextKeyData = this.keyframes[i + 1];
2130
+ if (i === len - 1 && frameNum >= nextKeyData.t - offsetTime) {
2131
+ if (keyData.h) {
2132
+ keyData = nextKeyData;
2133
+ }
2134
+ iterationIndex = 0;
2135
+ break;
2136
+ }
2137
+ if ((nextKeyData.t - offsetTime) > frameNum) {
2138
+ iterationIndex = i;
2139
+ break;
2140
+ }
2141
+ if (i < len - 1) {
2142
+ i += 1;
2143
+ } else {
2144
+ iterationIndex = 0;
2145
+ flag = false;
2146
+ }
2147
+ }
2148
+
2149
+ var k, kLen, perc, jLen, j, fnc;
2150
+ var nextKeyTime = nextKeyData.t - offsetTime;
2151
+ var keyTime = keyData.t - offsetTime;
2152
+ var endValue;
2153
+ if (keyData.to) {
2154
+ if (!keyData.bezierData) {
2155
+ keyData.bezierData = bez.buildBezierData(keyData.s, nextKeyData.s || keyData.e, keyData.to, keyData.ti);
2156
+ }
2157
+ var bezierData = keyData.bezierData;
2158
+ if (frameNum >= nextKeyTime || frameNum < keyTime) {
2159
+ var ind = frameNum >= nextKeyTime ? bezierData.points.length - 1 : 0;
2160
+ kLen = bezierData.points[ind].point.length;
2161
+ for (k = 0; k < kLen; k += 1) {
2162
+ newValue[k] = bezierData.points[ind].point[k];
2163
+ }
2164
+ // caching._lastKeyframeIndex = -1;
2165
+ } else {
2166
+ if (keyData.__fnct) {
2167
+ fnc = keyData.__fnct;
2168
+ } else {
2169
+ fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y, keyData.n).get;
2170
+ keyData.__fnct = fnc;
2171
+ }
2172
+ perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));
2173
+ var distanceInLine = bezierData.segmentLength * perc;
2174
+
2175
+ var segmentPerc;
2176
+ var addedLength = (caching.lastFrame < frameNum && caching._lastKeyframeIndex === i) ? caching._lastAddedLength : 0;
2177
+ j = (caching.lastFrame < frameNum && caching._lastKeyframeIndex === i) ? caching._lastPoint : 0;
2178
+ flag = true;
2179
+ jLen = bezierData.points.length;
2180
+ while (flag) {
2181
+ addedLength += bezierData.points[j].partialLength;
2182
+ if (distanceInLine === 0 || perc === 0 || j === bezierData.points.length - 1) {
2183
+ kLen = bezierData.points[j].point.length;
2184
+ for (k = 0; k < kLen; k += 1) {
2185
+ newValue[k] = bezierData.points[j].point[k];
2186
+ }
2187
+ break;
2188
+ } else if (distanceInLine >= addedLength && distanceInLine < addedLength + bezierData.points[j + 1].partialLength) {
2189
+ segmentPerc = (distanceInLine - addedLength) / bezierData.points[j + 1].partialLength;
2190
+ kLen = bezierData.points[j].point.length;
2191
+ for (k = 0; k < kLen; k += 1) {
2192
+ newValue[k] = bezierData.points[j].point[k] + (bezierData.points[j + 1].point[k] - bezierData.points[j].point[k]) * segmentPerc;
2193
+ }
2194
+ break;
2195
+ }
2196
+ if (j < jLen - 1) {
2197
+ j += 1;
2198
+ } else {
2199
+ flag = false;
2200
+ }
2201
+ }
2202
+ caching._lastPoint = j;
2203
+ caching._lastAddedLength = addedLength - bezierData.points[j].partialLength;
2204
+ caching._lastKeyframeIndex = i;
2205
+ }
2206
+ } else {
2207
+ var outX, outY, inX, inY, keyValue;
2208
+ len = keyData.s.length;
2209
+ endValue = nextKeyData.s || keyData.e;
2210
+ if (this.sh && keyData.h !== 1) {
2211
+ if (frameNum >= nextKeyTime) {
2212
+ newValue[0] = endValue[0];
2213
+ newValue[1] = endValue[1];
2214
+ newValue[2] = endValue[2];
2215
+ } else if (frameNum <= keyTime) {
2216
+ newValue[0] = keyData.s[0];
2217
+ newValue[1] = keyData.s[1];
2218
+ newValue[2] = keyData.s[2];
2219
+ } else {
2220
+ var quatStart = createQuaternion(keyData.s);
2221
+ var quatEnd = createQuaternion(endValue);
2222
+ var time = (frameNum - keyTime) / (nextKeyTime - keyTime);
2223
+ quaternionToEuler(newValue, slerp(quatStart, quatEnd, time));
2224
+ }
2225
+
2226
+ } else {
2227
+ for (i = 0; i < len; i += 1) {
2228
+ if (keyData.h !== 1) {
2229
+ if (frameNum >= nextKeyTime) {
2230
+ perc = 1;
2231
+ } else if (frameNum < keyTime) {
2232
+ perc = 0;
2233
+ } else {
2234
+ if (keyData.o.x.constructor === Array) {
2235
+ if (!keyData.__fnct) {
2236
+ keyData.__fnct = [];
2237
+ }
2238
+ if (!keyData.__fnct[i]) {
2239
+ outX = (typeof keyData.o.x[i] === 'undefined') ? keyData.o.x[0] : keyData.o.x[i];
2240
+ outY = (typeof keyData.o.y[i] === 'undefined') ? keyData.o.y[0] : keyData.o.y[i];
2241
+ inX = (typeof keyData.i.x[i] === 'undefined') ? keyData.i.x[0] : keyData.i.x[i];
2242
+ inY = (typeof keyData.i.y[i] === 'undefined') ? keyData.i.y[0] : keyData.i.y[i];
2243
+ fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;
2244
+ keyData.__fnct[i] = fnc;
2245
+ } else {
2246
+ fnc = keyData.__fnct[i];
2247
+ }
2248
+ } else {
2249
+ if (!keyData.__fnct) {
2250
+ outX = keyData.o.x;
2251
+ outY = keyData.o.y;
2252
+ inX = keyData.i.x;
2253
+ inY = keyData.i.y;
2254
+ fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;
2255
+ keyData.__fnct = fnc;
2256
+ } else {
2257
+ fnc = keyData.__fnct;
2258
+ }
2259
+ }
2260
+ perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));
2261
+ }
2262
+ }
2263
+
2264
+ endValue = nextKeyData.s || keyData.e;
2265
+ keyValue = keyData.h === 1 ? keyData.s[i] : keyData.s[i] + (endValue[i] - keyData.s[i]) * perc;
2266
+
2267
+ if (this.propType === 'multidimensional') {
2268
+ newValue[i] = keyValue;
2269
+ } else {
2270
+ newValue = keyValue;
2271
+ }
2272
+ }
2273
+ }
2274
+ }
2275
+ caching.lastIndex = iterationIndex;
2276
+ return newValue;
2277
+ }
2278
+
2279
+ //based on @Toji's https://github.com/toji/gl-matrix/
2280
+ function slerp(a, b, t) {
2281
+ var out = [];
2282
+ var ax = a[0], ay = a[1], az = a[2], aw = a[3],
2283
+ bx = b[0], by = b[1], bz = b[2], bw = b[3]
2284
+
2285
+ var omega, cosom, sinom, scale0, scale1;
2286
+
2287
+ cosom = ax * bx + ay * by + az * bz + aw * bw;
2288
+ if (cosom < 0.0) {
2289
+ cosom = -cosom;
2290
+ bx = -bx;
2291
+ by = -by;
2292
+ bz = -bz;
2293
+ bw = -bw;
2294
+ }
2295
+ if ((1.0 - cosom) > 0.000001) {
2296
+ omega = Math.acos(cosom);
2297
+ sinom = Math.sin(omega);
2298
+ scale0 = Math.sin((1.0 - t) * omega) / sinom;
2299
+ scale1 = Math.sin(t * omega) / sinom;
2300
+ } else {
2301
+ scale0 = 1.0 - t;
2302
+ scale1 = t;
2303
+ }
2304
+ out[0] = scale0 * ax + scale1 * bx;
2305
+ out[1] = scale0 * ay + scale1 * by;
2306
+ out[2] = scale0 * az + scale1 * bz;
2307
+ out[3] = scale0 * aw + scale1 * bw;
2308
+
2309
+ return out;
2310
+ }
2311
+
2312
+ function quaternionToEuler(out, quat) {
2313
+ var qx = quat[0];
2314
+ var qy = quat[1];
2315
+ var qz = quat[2];
2316
+ var qw = quat[3];
2317
+ var heading = Math.atan2(2 * qy * qw - 2 * qx * qz, 1 - 2 * qy * qy - 2 * qz * qz)
2318
+ var attitude = Math.asin(2 * qx * qy + 2 * qz * qw)
2319
+ var bank = Math.atan2(2 * qx * qw - 2 * qy * qz, 1 - 2 * qx * qx - 2 * qz * qz);
2320
+ out[0] = heading / degToRads;
2321
+ out[1] = attitude / degToRads;
2322
+ out[2] = bank / degToRads;
2323
+ }
2324
+
2325
+ function createQuaternion(values) {
2326
+ var heading = values[0] * degToRads;
2327
+ var attitude = values[1] * degToRads;
2328
+ var bank = values[2] * degToRads;
2329
+ var c1 = Math.cos(heading / 2);
2330
+ var c2 = Math.cos(attitude / 2);
2331
+ var c3 = Math.cos(bank / 2);
2332
+ var s1 = Math.sin(heading / 2);
2333
+ var s2 = Math.sin(attitude / 2);
2334
+ var s3 = Math.sin(bank / 2);
2335
+ var w = c1 * c2 * c3 - s1 * s2 * s3;
2336
+ var x = s1 * s2 * c3 + c1 * c2 * s3;
2337
+ var y = s1 * c2 * c3 + c1 * s2 * s3;
2338
+ var z = c1 * s2 * c3 - s1 * c2 * s3;
2339
+
2340
+ return [x, y, z, w];
2341
+ }
2342
+
2343
+ function getValueAtCurrentTime() {
2344
+ var frameNum = this.comp.renderedFrame - this.offsetTime;
2345
+ var initTime = this.keyframes[0].t - this.offsetTime;
2346
+ var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;
2347
+ if (!(frameNum === this._caching.lastFrame || (this._caching.lastFrame !== initFrame && ((this._caching.lastFrame >= endTime && frameNum >= endTime) || (this._caching.lastFrame < initTime && frameNum < initTime))))) {
2348
+ if (this._caching.lastFrame >= frameNum) {
2349
+ this._caching._lastKeyframeIndex = -1;
2350
+ this._caching.lastIndex = 0;
2351
+ }
2352
+
2353
+ var renderResult = this.interpolateValue(frameNum, this._caching);
2354
+ this.pv = renderResult;
2355
+ }
2356
+ this._caching.lastFrame = frameNum;
2357
+ return this.pv;
2358
+ }
2359
+
2360
+ function setVValue(val) {
2361
+ var multipliedValue;
2362
+ if (this.propType === 'unidimensional') {
2363
+ multipliedValue = val * this.mult;
2364
+ if (math_abs(this.v - multipliedValue) > 0.00001) {
2365
+ this.v = multipliedValue;
2366
+ this._mdf = true;
2367
+ }
2368
+ } else {
2369
+ var i = 0, len = this.v.length;
2370
+ while (i < len) {
2371
+ multipliedValue = val[i] * this.mult;
2372
+ if (math_abs(this.v[i] - multipliedValue) > 0.00001) {
2373
+ this.v[i] = multipliedValue;
2374
+ this._mdf = true;
2375
+ }
2376
+ i += 1;
2377
+ }
2378
+ }
2379
+ }
2380
+
2381
+ function processEffectsSequence() {
2382
+ if (this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) {
2383
+ return;
2384
+ }
2385
+ if (this.lock) {
2386
+ this.setVValue(this.pv);
2387
+ return;
2388
+ }
2389
+ this.lock = true;
2390
+ this._mdf = this._isFirstFrame;
2391
+ var multipliedValue;
2392
+ var i, len = this.effectsSequence.length;
2393
+ var finalValue = this.kf ? this.pv : this.data.k;
2394
+ for (i = 0; i < len; i += 1) {
2395
+ finalValue = this.effectsSequence[i](finalValue);
2396
+ }
2397
+ this.setVValue(finalValue);
2398
+ this._isFirstFrame = false;
2399
+ this.lock = false;
2400
+ this.frameId = this.elem.globalData.frameId;
2401
+ }
2402
+
2403
+ function addEffect(effectFunction) {
2404
+ this.effectsSequence.push(effectFunction);
2405
+ this.container.addDynamicProperty(this);
2406
+ }
2407
+
2408
+ function ValueProperty(elem, data, mult, container) {
2409
+ this.propType = 'unidimensional';
2410
+ this.mult = mult || 1;
2411
+ this.data = data;
2412
+ this.v = mult ? data.k * mult : data.k;
2413
+ this.pv = data.k;
2414
+ this._mdf = false;
2415
+ this.elem = elem;
2416
+ this.container = container;
2417
+ this.comp = elem.comp;
2418
+ this.k = false;
2419
+ this.kf = false;
2420
+ this.vel = 0;
2421
+ this.effectsSequence = [];
2422
+ this._isFirstFrame = true;
2423
+ this.getValue = processEffectsSequence;
2424
+ this.setVValue = setVValue;
2425
+ this.addEffect = addEffect;
2426
+ }
2427
+
2428
+ function MultiDimensionalProperty(elem, data, mult, container) {
2429
+ this.propType = 'multidimensional';
2430
+ this.mult = mult || 1;
2431
+ this.data = data;
2432
+ this._mdf = false;
2433
+ this.elem = elem;
2434
+ this.container = container;
2435
+ this.comp = elem.comp;
2436
+ this.k = false;
2437
+ this.kf = false;
2438
+ this.frameId = -1;
2439
+ var i, len = data.k.length;
2440
+ this.v = createTypedArray('float32', len);
2441
+ this.pv = createTypedArray('float32', len);
2442
+ var arr = createTypedArray('float32', len);
2443
+ this.vel = createTypedArray('float32', len);
2444
+ for (i = 0; i < len; i += 1) {
2445
+ this.v[i] = data.k[i] * this.mult;
2446
+ this.pv[i] = data.k[i];
2447
+ }
2448
+ this._isFirstFrame = true;
2449
+ this.effectsSequence = [];
2450
+ this.getValue = processEffectsSequence;
2451
+ this.setVValue = setVValue;
2452
+ this.addEffect = addEffect;
2453
+ }
2454
+
2455
+ function KeyframedValueProperty(elem, data, mult, container) {
2456
+ this.propType = 'unidimensional';
2457
+ this.keyframes = data.k;
2458
+ this.offsetTime = elem.data.st;
2459
+ this.frameId = -1;
2460
+ this._caching = { lastFrame: initFrame, lastIndex: 0, value: 0, _lastKeyframeIndex: -1 };
2461
+ this.k = true;
2462
+ this.kf = true;
2463
+ this.data = data;
2464
+ this.mult = mult || 1;
2465
+ this.elem = elem;
2466
+ this.container = container;
2467
+ this.comp = elem.comp;
2468
+ this.v = initFrame;
2469
+ this.pv = initFrame;
2470
+ this._isFirstFrame = true;
2471
+ this.getValue = processEffectsSequence;
2472
+ this.setVValue = setVValue;
2473
+ this.interpolateValue = interpolateValue;
2474
+ this.effectsSequence = [getValueAtCurrentTime.bind(this)];
2475
+ this.addEffect = addEffect;
2476
+ }
2477
+
2478
+ function KeyframedMultidimensionalProperty(elem, data, mult, container) {
2479
+ this.propType = 'multidimensional';
2480
+ var i, len = data.k.length;
2481
+ var s, e, to, ti;
2482
+ for (i = 0; i < len - 1; i += 1) {
2483
+ if (data.k[i].to && data.k[i].s && data.k[i + 1] && data.k[i + 1].s) {
2484
+ s = data.k[i].s;
2485
+ e = data.k[i + 1].s;
2486
+ to = data.k[i].to;
2487
+ ti = data.k[i].ti;
2488
+ if ((s.length === 2 && !(s[0] === e[0] && s[1] === e[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], s[0] + to[0], s[1] + to[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], e[0] + ti[0], e[1] + ti[1])) || (s.length === 3 && !(s[0] === e[0] && s[1] === e[1] && s[2] === e[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], s[0] + to[0], s[1] + to[1], s[2] + to[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], e[0] + ti[0], e[1] + ti[1], e[2] + ti[2]))) {
2489
+ data.k[i].to = null;
2490
+ data.k[i].ti = null;
2491
+ }
2492
+ if (s[0] === e[0] && s[1] === e[1] && to[0] === 0 && to[1] === 0 && ti[0] === 0 && ti[1] === 0) {
2493
+ if (s.length === 2 || (s[2] === e[2] && to[2] === 0 && ti[2] === 0)) {
2494
+ data.k[i].to = null;
2495
+ data.k[i].ti = null;
2496
+ }
2497
+ }
2498
+ }
2499
+ }
2500
+ this.effectsSequence = [getValueAtCurrentTime.bind(this)];
2501
+ this.keyframes = data.k;
2502
+ this.offsetTime = elem.data.st;
2503
+ this.k = true;
2504
+ this.kf = true;
2505
+ this._isFirstFrame = true;
2506
+ this.mult = mult || 1;
2507
+ this.elem = elem;
2508
+ this.container = container;
2509
+ this.comp = elem.comp;
2510
+ this.getValue = processEffectsSequence;
2511
+ this.setVValue = setVValue;
2512
+ this.interpolateValue = interpolateValue;
2513
+ this.frameId = -1;
2514
+ var arrLen = data.k[0].s.length;
2515
+ this.v = createTypedArray('float32', arrLen);
2516
+ this.pv = createTypedArray('float32', arrLen);
2517
+ for (i = 0; i < arrLen; i += 1) {
2518
+ this.v[i] = initFrame;
2519
+ this.pv[i] = initFrame;
2520
+ }
2521
+ this._caching = { lastFrame: initFrame, lastIndex: 0, value: createTypedArray('float32', arrLen) };
2522
+ this.addEffect = addEffect;
2523
+ }
2524
+
2525
+ function getProp(elem, data, type, mult, container) {
2526
+ var p;
2527
+ if (!data.k.length) {
2528
+ p = new ValueProperty(elem, data, mult, container);
2529
+ } else if (typeof (data.k[0]) === 'number') {
2530
+ p = new MultiDimensionalProperty(elem, data, mult, container);
2531
+ } else {
2532
+ switch (type) {
2533
+ case 0:
2534
+ p = new KeyframedValueProperty(elem, data, mult, container);
2535
+ break;
2536
+ case 1:
2537
+ p = new KeyframedMultidimensionalProperty(elem, data, mult, container);
2538
+ break;
2539
+ }
2540
+ }
2541
+ if (p.effectsSequence.length) {
2542
+ container.addDynamicProperty(p);
2543
+ }
2544
+ return p;
2545
+ }
2546
+
2547
+ var ob = {
2548
+ getProp: getProp
2549
+ };
2550
+ return ob;
2551
+ }());
2552
+ var TransformPropertyFactory = (function () {
2553
+
2554
+ var defaultVector = [0, 0]
2555
+
2556
+ function applyToMatrix(mat) {
2557
+ var _mdf = this._mdf;
2558
+ this.iterateDynamicProperties();
2559
+ this._mdf = this._mdf || _mdf;
2560
+ if (this.a) {
2561
+ mat.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
2562
+ }
2563
+ if (this.s) {
2564
+ mat.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
2565
+ }
2566
+ if (this.sk) {
2567
+ mat.skewFromAxis(-this.sk.v, this.sa.v);
2568
+ }
2569
+ if (this.r) {
2570
+ mat.rotate(-this.r.v);
2571
+ } else {
2572
+ mat.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);
2573
+ }
2574
+ if (this.data.p.s) {
2575
+ if (this.data.p.z) {
2576
+ mat.translate(this.px.v, this.py.v, -this.pz.v);
2577
+ } else {
2578
+ mat.translate(this.px.v, this.py.v, 0);
2579
+ }
2580
+ } else {
2581
+ mat.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);
2582
+ }
2583
+ }
2584
+ function processKeys(forceRender) {
2585
+ if (this.elem.globalData.frameId === this.frameId) {
2586
+ return;
2587
+ }
2588
+ if (this._isDirty) {
2589
+ this.precalculateMatrix();
2590
+ this._isDirty = false;
2591
+ }
2592
+
2593
+ this.iterateDynamicProperties();
2594
+
2595
+ if (this._mdf || forceRender) {
2596
+ this.v.cloneFromProps(this.pre.props);
2597
+ if (this.appliedTransformations < 1) {
2598
+ this.v.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
2599
+ }
2600
+ if (this.appliedTransformations < 2) {
2601
+ this.v.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
2602
+ }
2603
+ if (this.sk && this.appliedTransformations < 3) {
2604
+ this.v.skewFromAxis(-this.sk.v, this.sa.v);
2605
+ }
2606
+ if (this.r && this.appliedTransformations < 4) {
2607
+ this.v.rotate(-this.r.v);
2608
+ } else if (!this.r && this.appliedTransformations < 4) {
2609
+ this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);
2610
+ }
2611
+ if (this.autoOriented) {
2612
+ var v1, v2, frameRate = this.elem.globalData.frameRate;
2613
+ if (this.p && this.p.keyframes && this.p.getValueAtTime) {
2614
+ if (this.p._caching.lastFrame + this.p.offsetTime <= this.p.keyframes[0].t) {
2615
+ v1 = this.p.getValueAtTime((this.p.keyframes[0].t + 0.01) / frameRate, 0);
2616
+ v2 = this.p.getValueAtTime(this.p.keyframes[0].t / frameRate, 0);
2617
+ } else if (this.p._caching.lastFrame + this.p.offsetTime >= this.p.keyframes[this.p.keyframes.length - 1].t) {
2618
+ v1 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t / frameRate), 0);
2619
+ v2 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t - 0.05) / frameRate, 0);
2620
+ } else {
2621
+ v1 = this.p.pv;
2622
+ v2 = this.p.getValueAtTime((this.p._caching.lastFrame + this.p.offsetTime - 0.01) / frameRate, this.p.offsetTime);
2623
+ }
2624
+ } else if (this.px && this.px.keyframes && this.py.keyframes && this.px.getValueAtTime && this.py.getValueAtTime) {
2625
+ v1 = [];
2626
+ v2 = [];
2627
+ var px = this.px, py = this.py, frameRate;
2628
+ if (px._caching.lastFrame + px.offsetTime <= px.keyframes[0].t) {
2629
+ v1[0] = px.getValueAtTime((px.keyframes[0].t + 0.01) / frameRate, 0);
2630
+ v1[1] = py.getValueAtTime((py.keyframes[0].t + 0.01) / frameRate, 0);
2631
+ v2[0] = px.getValueAtTime((px.keyframes[0].t) / frameRate, 0);
2632
+ v2[1] = py.getValueAtTime((py.keyframes[0].t) / frameRate, 0);
2633
+ } else if (px._caching.lastFrame + px.offsetTime >= px.keyframes[px.keyframes.length - 1].t) {
2634
+ v1[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t / frameRate), 0);
2635
+ v1[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t / frameRate), 0);
2636
+ v2[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t - 0.01) / frameRate, 0);
2637
+ v2[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t - 0.01) / frameRate, 0);
2638
+ } else {
2639
+ v1 = [px.pv, py.pv];
2640
+ v2[0] = px.getValueAtTime((px._caching.lastFrame + px.offsetTime - 0.01) / frameRate, px.offsetTime);
2641
+ v2[1] = py.getValueAtTime((py._caching.lastFrame + py.offsetTime - 0.01) / frameRate, py.offsetTime);
2642
+ }
2643
+ } else {
2644
+ v1 = v2 = defaultVector
2645
+ }
2646
+ this.v.rotate(-Math.atan2(v1[1] - v2[1], v1[0] - v2[0]));
2647
+ }
2648
+ if (this.data.p && this.data.p.s) {
2649
+ if (this.data.p.z) {
2650
+ this.v.translate(this.px.v, this.py.v, -this.pz.v);
2651
+ } else {
2652
+ this.v.translate(this.px.v, this.py.v, 0);
2653
+ }
2654
+ } else {
2655
+ this.v.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);
2656
+ }
2657
+ }
2658
+ this.frameId = this.elem.globalData.frameId;
2659
+ }
2660
+
2661
+ function precalculateMatrix() {
2662
+ if (!this.a.k) {
2663
+ this.pre.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
2664
+ this.appliedTransformations = 1;
2665
+ } else {
2666
+ return;
2667
+ }
2668
+ if (!this.s.effectsSequence.length) {
2669
+ this.pre.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
2670
+ this.appliedTransformations = 2;
2671
+ } else {
2672
+ return;
2673
+ }
2674
+ if (this.sk) {
2675
+ if (!this.sk.effectsSequence.length && !this.sa.effectsSequence.length) {
2676
+ this.pre.skewFromAxis(-this.sk.v, this.sa.v);
2677
+ this.appliedTransformations = 3;
2678
+ } else {
2679
+ return;
2680
+ }
2681
+ }
2682
+ if (this.r) {
2683
+ if (!this.r.effectsSequence.length) {
2684
+ this.pre.rotate(-this.r.v);
2685
+ this.appliedTransformations = 4;
2686
+ } else {
2687
+ return;
2688
+ }
2689
+ } else if (!this.rz.effectsSequence.length && !this.ry.effectsSequence.length && !this.rx.effectsSequence.length && !this.or.effectsSequence.length) {
2690
+ this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);
2691
+ this.appliedTransformations = 4;
2692
+ }
2693
+ }
2694
+
2695
+ function autoOrient() {
2696
+ //
2697
+ //var prevP = this.getValueAtTime();
2698
+ }
2699
+
2700
+ function addDynamicProperty(prop) {
2701
+ this._addDynamicProperty(prop);
2702
+ this.elem.addDynamicProperty(prop);
2703
+ this._isDirty = true;
2704
+ }
2705
+
2706
+ function TransformProperty(elem, data, container) {
2707
+ this.elem = elem;
2708
+ this.frameId = -1;
2709
+ this.propType = 'transform';
2710
+ this.data = data;
2711
+ this.v = new Matrix();
2712
+ //Precalculated matrix with non animated properties
2713
+ this.pre = new Matrix();
2714
+ this.appliedTransformations = 0;
2715
+ this.initDynamicPropertyContainer(container || elem);
2716
+ if (data.p && data.p.s) {
2717
+ this.px = PropertyFactory.getProp(elem, data.p.x, 0, 0, this);
2718
+ this.py = PropertyFactory.getProp(elem, data.p.y, 0, 0, this);
2719
+ if (data.p.z) {
2720
+ this.pz = PropertyFactory.getProp(elem, data.p.z, 0, 0, this);
2721
+ }
2722
+ } else {
2723
+ this.p = PropertyFactory.getProp(elem, data.p || { k: [0, 0, 0] }, 1, 0, this);
2724
+ }
2725
+ if (data.rx) {
2726
+ this.rx = PropertyFactory.getProp(elem, data.rx, 0, degToRads, this);
2727
+ this.ry = PropertyFactory.getProp(elem, data.ry, 0, degToRads, this);
2728
+ this.rz = PropertyFactory.getProp(elem, data.rz, 0, degToRads, this);
2729
+ if (data.or.k[0].ti) {
2730
+ var i, len = data.or.k.length;
2731
+ for (i = 0; i < len; i += 1) {
2732
+ data.or.k[i].to = data.or.k[i].ti = null;
2733
+ }
2734
+ }
2735
+ this.or = PropertyFactory.getProp(elem, data.or, 1, degToRads, this);
2736
+ //sh Indicates it needs to be capped between -180 and 180
2737
+ this.or.sh = true;
2738
+ } else {
2739
+ this.r = PropertyFactory.getProp(elem, data.r || { k: 0 }, 0, degToRads, this);
2740
+ }
2741
+ if (data.sk) {
2742
+ this.sk = PropertyFactory.getProp(elem, data.sk, 0, degToRads, this);
2743
+ this.sa = PropertyFactory.getProp(elem, data.sa, 0, degToRads, this);
2744
+ }
2745
+ this.a = PropertyFactory.getProp(elem, data.a || { k: [0, 0, 0] }, 1, 0, this);
2746
+ this.s = PropertyFactory.getProp(elem, data.s || { k: [100, 100, 100] }, 1, 0.01, this);
2747
+ // Opacity is not part of the transform properties, that's why it won't use this.dynamicProperties. That way transforms won't get updated if opacity changes.
2748
+ if (data.o) {
2749
+ this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, elem);
2750
+ } else {
2751
+ this.o = { _mdf: false, v: 1 };
2752
+ }
2753
+ this._isDirty = true;
2754
+ if (!this.dynamicProperties.length) {
2755
+ this.getValue(true);
2756
+ }
2757
+ }
2758
+
2759
+ TransformProperty.prototype = {
2760
+ applyToMatrix: applyToMatrix,
2761
+ getValue: processKeys,
2762
+ precalculateMatrix: precalculateMatrix,
2763
+ autoOrient: autoOrient
2764
+ }
2765
+
2766
+ extendPrototype([DynamicPropertyContainer], TransformProperty);
2767
+ TransformProperty.prototype.addDynamicProperty = addDynamicProperty;
2768
+ TransformProperty.prototype._addDynamicProperty = DynamicPropertyContainer.prototype.addDynamicProperty;
2769
+
2770
+ function getTransformProperty(elem, data, container) {
2771
+ return new TransformProperty(elem, data, container);
2772
+ }
2773
+
2774
+ return {
2775
+ getTransformProperty: getTransformProperty
2776
+ };
2777
+
2778
+ }());
2779
+ function ShapePath() {
2780
+ this.c = false;
2781
+ this._length = 0;
2782
+ this._maxLength = 8;
2783
+ this.v = createSizedArray(this._maxLength);
2784
+ this.o = createSizedArray(this._maxLength);
2785
+ this.i = createSizedArray(this._maxLength);
2786
+ }
2787
+
2788
+ ShapePath.prototype.setPathData = function (closed, len) {
2789
+ this.c = closed;
2790
+ this.setLength(len);
2791
+ var i = 0;
2792
+ while (i < len) {
2793
+ this.v[i] = point_pool.newElement();
2794
+ this.o[i] = point_pool.newElement();
2795
+ this.i[i] = point_pool.newElement();
2796
+ i += 1;
2797
+ }
2798
+ };
2799
+
2800
+ ShapePath.prototype.setLength = function (len) {
2801
+ while (this._maxLength < len) {
2802
+ this.doubleArrayLength();
2803
+ }
2804
+ this._length = len;
2805
+ };
2806
+
2807
+ ShapePath.prototype.doubleArrayLength = function () {
2808
+ this.v = this.v.concat(createSizedArray(this._maxLength));
2809
+ this.i = this.i.concat(createSizedArray(this._maxLength));
2810
+ this.o = this.o.concat(createSizedArray(this._maxLength));
2811
+ this._maxLength *= 2;
2812
+ };
2813
+
2814
+ ShapePath.prototype.setXYAt = function (x, y, type, pos, replace) {
2815
+ var arr;
2816
+ this._length = Math.max(this._length, pos + 1);
2817
+ if (this._length >= this._maxLength) {
2818
+ this.doubleArrayLength();
2819
+ }
2820
+ switch (type) {
2821
+ case 'v':
2822
+ arr = this.v;
2823
+ break;
2824
+ case 'i':
2825
+ arr = this.i;
2826
+ break;
2827
+ case 'o':
2828
+ arr = this.o;
2829
+ break;
2830
+ }
2831
+ if (!arr[pos] || (arr[pos] && !replace)) {
2832
+ arr[pos] = point_pool.newElement();
2833
+ }
2834
+ arr[pos][0] = x;
2835
+ arr[pos][1] = y;
2836
+ };
2837
+
2838
+ ShapePath.prototype.setTripleAt = function (vX, vY, oX, oY, iX, iY, pos, replace) {
2839
+ this.setXYAt(vX, vY, 'v', pos, replace);
2840
+ this.setXYAt(oX, oY, 'o', pos, replace);
2841
+ this.setXYAt(iX, iY, 'i', pos, replace);
2842
+ };
2843
+
2844
+ ShapePath.prototype.reverse = function () {
2845
+ var newPath = new ShapePath();
2846
+ newPath.setPathData(this.c, this._length);
2847
+ var vertices = this.v, outPoints = this.o, inPoints = this.i;
2848
+ var init = 0;
2849
+ if (this.c) {
2850
+ newPath.setTripleAt(vertices[0][0], vertices[0][1], inPoints[0][0], inPoints[0][1], outPoints[0][0], outPoints[0][1], 0, false);
2851
+ init = 1;
2852
+ }
2853
+ var cnt = this._length - 1;
2854
+ var len = this._length;
2855
+
2856
+ var i;
2857
+ for (i = init; i < len; i += 1) {
2858
+ newPath.setTripleAt(vertices[cnt][0], vertices[cnt][1], inPoints[cnt][0], inPoints[cnt][1], outPoints[cnt][0], outPoints[cnt][1], i, false);
2859
+ cnt -= 1;
2860
+ }
2861
+ return newPath;
2862
+ };
2863
+ var ShapePropertyFactory = (function () {
2864
+
2865
+ var initFrame = -999999;
2866
+
2867
+ function interpolateShape(frameNum, previousValue, caching) {
2868
+ var iterationIndex = caching.lastIndex;
2869
+ var keyPropS, keyPropE, isHold, j, k, jLen, kLen, perc, vertexValue;
2870
+ var kf = this.keyframes;
2871
+ if (frameNum < kf[0].t - this.offsetTime) {
2872
+ keyPropS = kf[0].s[0];
2873
+ isHold = true;
2874
+ iterationIndex = 0;
2875
+ } else if (frameNum >= kf[kf.length - 1].t - this.offsetTime) {
2876
+ keyPropS = kf[kf.length - 1].s ? kf[kf.length - 1].s[0] : kf[kf.length - 2].e[0];
2877
+ /*if(kf[kf.length - 1].s){
2878
+ keyPropS = kf[kf.length - 1].s[0];
2879
+ }else{
2880
+ keyPropS = kf[kf.length - 2].e[0];
2881
+ }*/
2882
+ isHold = true;
2883
+ } else {
2884
+ var i = iterationIndex;
2885
+ var len = kf.length - 1, flag = true, keyData, nextKeyData;
2886
+ while (flag) {
2887
+ keyData = kf[i];
2888
+ nextKeyData = kf[i + 1];
2889
+ if ((nextKeyData.t - this.offsetTime) > frameNum) {
2890
+ break;
2891
+ }
2892
+ if (i < len - 1) {
2893
+ i += 1;
2894
+ } else {
2895
+ flag = false;
2896
+ }
2897
+ }
2898
+ isHold = keyData.h === 1;
2899
+ iterationIndex = i;
2900
+ if (!isHold) {
2901
+ if (frameNum >= nextKeyData.t - this.offsetTime) {
2902
+ perc = 1;
2903
+ } else if (frameNum < keyData.t - this.offsetTime) {
2904
+ perc = 0;
2905
+ } else {
2906
+ var fnc;
2907
+ if (keyData.__fnct) {
2908
+ fnc = keyData.__fnct;
2909
+ } else {
2910
+ fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y).get;
2911
+ keyData.__fnct = fnc;
2912
+ }
2913
+ perc = fnc((frameNum - (keyData.t - this.offsetTime)) / ((nextKeyData.t - this.offsetTime) - (keyData.t - this.offsetTime)));
2914
+ }
2915
+ keyPropE = nextKeyData.s ? nextKeyData.s[0] : keyData.e[0];
2916
+ }
2917
+ keyPropS = keyData.s[0];
2918
+ }
2919
+ jLen = previousValue._length;
2920
+ kLen = keyPropS.i[0].length;
2921
+ caching.lastIndex = iterationIndex;
2922
+
2923
+ for (j = 0; j < jLen; j += 1) {
2924
+ for (k = 0; k < kLen; k += 1) {
2925
+ vertexValue = isHold ? keyPropS.i[j][k] : keyPropS.i[j][k] + (keyPropE.i[j][k] - keyPropS.i[j][k]) * perc;
2926
+ previousValue.i[j][k] = vertexValue;
2927
+ vertexValue = isHold ? keyPropS.o[j][k] : keyPropS.o[j][k] + (keyPropE.o[j][k] - keyPropS.o[j][k]) * perc;
2928
+ previousValue.o[j][k] = vertexValue;
2929
+ vertexValue = isHold ? keyPropS.v[j][k] : keyPropS.v[j][k] + (keyPropE.v[j][k] - keyPropS.v[j][k]) * perc;
2930
+ previousValue.v[j][k] = vertexValue;
2931
+ }
2932
+ }
2933
+ }
2934
+
2935
+ function interpolateShapeCurrentTime() {
2936
+ var frameNum = this.comp.renderedFrame - this.offsetTime;
2937
+ var initTime = this.keyframes[0].t - this.offsetTime;
2938
+ var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;
2939
+ var lastFrame = this._caching.lastFrame;
2940
+ if (!(lastFrame !== initFrame && ((lastFrame < initTime && frameNum < initTime) || (lastFrame > endTime && frameNum > endTime)))) {
2941
+ ////
2942
+ this._caching.lastIndex = lastFrame < frameNum ? this._caching.lastIndex : 0;
2943
+ this.interpolateShape(frameNum, this.pv, this._caching);
2944
+ ////
2945
+ }
2946
+ this._caching.lastFrame = frameNum;
2947
+ return this.pv;
2948
+ }
2949
+
2950
+ function resetShape() {
2951
+ this.paths = this.localShapeCollection;
2952
+ }
2953
+
2954
+ function shapesEqual(shape1, shape2) {
2955
+ if (shape1._length !== shape2._length || shape1.c !== shape2.c) {
2956
+ return false;
2957
+ }
2958
+ var i, len = shape1._length;
2959
+ for (i = 0; i < len; i += 1) {
2960
+ if (shape1.v[i][0] !== shape2.v[i][0]
2961
+ || shape1.v[i][1] !== shape2.v[i][1]
2962
+ || shape1.o[i][0] !== shape2.o[i][0]
2963
+ || shape1.o[i][1] !== shape2.o[i][1]
2964
+ || shape1.i[i][0] !== shape2.i[i][0]
2965
+ || shape1.i[i][1] !== shape2.i[i][1]) {
2966
+ return false;
2967
+ }
2968
+ }
2969
+ return true;
2970
+ }
2971
+
2972
+ function setVValue(newPath) {
2973
+ if (!shapesEqual(this.v, newPath)) {
2974
+ this.v = shape_pool.clone(newPath);
2975
+ this.localShapeCollection.releaseShapes();
2976
+ this.localShapeCollection.addShape(this.v);
2977
+ this._mdf = true;
2978
+ this.paths = this.localShapeCollection;
2979
+ }
2980
+ }
2981
+
2982
+ function processEffectsSequence() {
2983
+ if (this.elem.globalData.frameId === this.frameId) {
2984
+ return;
2985
+ } else if (!this.effectsSequence.length) {
2986
+ this._mdf = false;
2987
+ return;
2988
+ }
2989
+ if (this.lock) {
2990
+ this.setVValue(this.pv);
2991
+ return;
2992
+ }
2993
+ this.lock = true;
2994
+ this._mdf = false;
2995
+ var finalValue = this.kf ? this.pv : this.data.ks ? this.data.ks.k : this.data.pt.k;
2996
+ var i, len = this.effectsSequence.length;
2997
+ for (i = 0; i < len; i += 1) {
2998
+ finalValue = this.effectsSequence[i](finalValue);
2999
+ }
3000
+ this.setVValue(finalValue);
3001
+ this.lock = false;
3002
+ this.frameId = this.elem.globalData.frameId;
3003
+ };
3004
+
3005
+ function ShapeProperty(elem, data, type) {
3006
+ this.propType = 'shape';
3007
+ this.comp = elem.comp;
3008
+ this.container = elem;
3009
+ this.elem = elem;
3010
+ this.data = data;
3011
+ this.k = false;
3012
+ this.kf = false;
3013
+ this._mdf = false;
3014
+ var pathData = type === 3 ? data.pt.k : data.ks.k;
3015
+ this.v = shape_pool.clone(pathData);
3016
+ this.pv = shape_pool.clone(this.v);
3017
+ this.localShapeCollection = shapeCollection_pool.newShapeCollection();
3018
+ this.paths = this.localShapeCollection;
3019
+ this.paths.addShape(this.v);
3020
+ this.reset = resetShape;
3021
+ this.effectsSequence = [];
3022
+ }
3023
+
3024
+ function addEffect(effectFunction) {
3025
+ this.effectsSequence.push(effectFunction);
3026
+ this.container.addDynamicProperty(this);
3027
+ }
3028
+
3029
+ ShapeProperty.prototype.interpolateShape = interpolateShape;
3030
+ ShapeProperty.prototype.getValue = processEffectsSequence;
3031
+ ShapeProperty.prototype.setVValue = setVValue;
3032
+ ShapeProperty.prototype.addEffect = addEffect;
3033
+
3034
+ function KeyframedShapeProperty(elem, data, type) {
3035
+ this.propType = 'shape';
3036
+ this.comp = elem.comp;
3037
+ this.elem = elem;
3038
+ this.container = elem;
3039
+ this.offsetTime = elem.data.st;
3040
+ this.keyframes = type === 3 ? data.pt.k : data.ks.k;
3041
+ this.k = true;
3042
+ this.kf = true;
3043
+ var i, len = this.keyframes[0].s[0].i.length;
3044
+ var jLen = this.keyframes[0].s[0].i[0].length;
3045
+ this.v = shape_pool.newElement();
3046
+ this.v.setPathData(this.keyframes[0].s[0].c, len);
3047
+ this.pv = shape_pool.clone(this.v);
3048
+ this.localShapeCollection = shapeCollection_pool.newShapeCollection();
3049
+ this.paths = this.localShapeCollection;
3050
+ this.paths.addShape(this.v);
3051
+ this.lastFrame = initFrame;
3052
+ this.reset = resetShape;
3053
+ this._caching = { lastFrame: initFrame, lastIndex: 0 };
3054
+ this.effectsSequence = [interpolateShapeCurrentTime.bind(this)];
3055
+ }
3056
+ KeyframedShapeProperty.prototype.getValue = processEffectsSequence;
3057
+ KeyframedShapeProperty.prototype.interpolateShape = interpolateShape;
3058
+ KeyframedShapeProperty.prototype.setVValue = setVValue;
3059
+ KeyframedShapeProperty.prototype.addEffect = addEffect;
3060
+
3061
+ var EllShapeProperty = (function () {
3062
+
3063
+ var cPoint = roundCorner;
3064
+
3065
+ function EllShapeProperty(elem, data) {
3066
+ /*this.v = {
3067
+ v: createSizedArray(4),
3068
+ i: createSizedArray(4),
3069
+ o: createSizedArray(4),
3070
+ c: true
3071
+ };*/
3072
+ this.v = shape_pool.newElement();
3073
+ this.v.setPathData(true, 4);
3074
+ this.localShapeCollection = shapeCollection_pool.newShapeCollection();
3075
+ this.paths = this.localShapeCollection;
3076
+ this.localShapeCollection.addShape(this.v);
3077
+ this.d = data.d;
3078
+ this.elem = elem;
3079
+ this.comp = elem.comp;
3080
+ this.frameId = -1;
3081
+ this.initDynamicPropertyContainer(elem);
3082
+ this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);
3083
+ this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this);
3084
+ if (this.dynamicProperties.length) {
3085
+ this.k = true;
3086
+ } else {
3087
+ this.k = false;
3088
+ this.convertEllToPath();
3089
+ }
3090
+ };
3091
+
3092
+ EllShapeProperty.prototype = {
3093
+ reset: resetShape,
3094
+ getValue: function () {
3095
+ if (this.elem.globalData.frameId === this.frameId) {
3096
+ return;
3097
+ }
3098
+ this.frameId = this.elem.globalData.frameId;
3099
+ this.iterateDynamicProperties();
3100
+
3101
+ if (this._mdf) {
3102
+ this.convertEllToPath();
3103
+ }
3104
+ },
3105
+ convertEllToPath: function () {
3106
+ var p0 = this.p.v[0], p1 = this.p.v[1], s0 = this.s.v[0] / 2, s1 = this.s.v[1] / 2;
3107
+ var _cw = this.d !== 3;
3108
+ var _v = this.v;
3109
+ _v.v[0][0] = p0;
3110
+ _v.v[0][1] = p1 - s1;
3111
+ _v.v[1][0] = _cw ? p0 + s0 : p0 - s0;
3112
+ _v.v[1][1] = p1;
3113
+ _v.v[2][0] = p0;
3114
+ _v.v[2][1] = p1 + s1;
3115
+ _v.v[3][0] = _cw ? p0 - s0 : p0 + s0;
3116
+ _v.v[3][1] = p1;
3117
+ _v.i[0][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;
3118
+ _v.i[0][1] = p1 - s1;
3119
+ _v.i[1][0] = _cw ? p0 + s0 : p0 - s0;
3120
+ _v.i[1][1] = p1 - s1 * cPoint;
3121
+ _v.i[2][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;
3122
+ _v.i[2][1] = p1 + s1;
3123
+ _v.i[3][0] = _cw ? p0 - s0 : p0 + s0;
3124
+ _v.i[3][1] = p1 + s1 * cPoint;
3125
+ _v.o[0][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;
3126
+ _v.o[0][1] = p1 - s1;
3127
+ _v.o[1][0] = _cw ? p0 + s0 : p0 - s0;
3128
+ _v.o[1][1] = p1 + s1 * cPoint;
3129
+ _v.o[2][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;
3130
+ _v.o[2][1] = p1 + s1;
3131
+ _v.o[3][0] = _cw ? p0 - s0 : p0 + s0;
3132
+ _v.o[3][1] = p1 - s1 * cPoint;
3133
+ }
3134
+ }
3135
+
3136
+ extendPrototype([DynamicPropertyContainer], EllShapeProperty);
3137
+
3138
+ return EllShapeProperty;
3139
+ }());
3140
+
3141
+ var StarShapeProperty = (function () {
3142
+
3143
+ function StarShapeProperty(elem, data) {
3144
+ this.v = shape_pool.newElement();
3145
+ this.v.setPathData(true, 0);
3146
+ this.elem = elem;
3147
+ this.comp = elem.comp;
3148
+ this.data = data;
3149
+ this.frameId = -1;
3150
+ this.d = data.d;
3151
+ this.initDynamicPropertyContainer(elem);
3152
+ if (data.sy === 1) {
3153
+ this.ir = PropertyFactory.getProp(elem, data.ir, 0, 0, this);
3154
+ this.is = PropertyFactory.getProp(elem, data.is, 0, 0.01, this);
3155
+ this.convertToPath = this.convertStarToPath;
3156
+ } else {
3157
+ this.convertToPath = this.convertPolygonToPath;
3158
+ }
3159
+ this.pt = PropertyFactory.getProp(elem, data.pt, 0, 0, this);
3160
+ this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);
3161
+ this.r = PropertyFactory.getProp(elem, data.r, 0, degToRads, this);
3162
+ this.or = PropertyFactory.getProp(elem, data.or, 0, 0, this);
3163
+ this.os = PropertyFactory.getProp(elem, data.os, 0, 0.01, this);
3164
+ this.localShapeCollection = shapeCollection_pool.newShapeCollection();
3165
+ this.localShapeCollection.addShape(this.v);
3166
+ this.paths = this.localShapeCollection;
3167
+ if (this.dynamicProperties.length) {
3168
+ this.k = true;
3169
+ } else {
3170
+ this.k = false;
3171
+ this.convertToPath();
3172
+ }
3173
+ };
3174
+
3175
+ StarShapeProperty.prototype = {
3176
+ reset: resetShape,
3177
+ getValue: function () {
3178
+ if (this.elem.globalData.frameId === this.frameId) {
3179
+ return;
3180
+ }
3181
+ this.frameId = this.elem.globalData.frameId;
3182
+ this.iterateDynamicProperties();
3183
+ if (this._mdf) {
3184
+ this.convertToPath();
3185
+ }
3186
+ },
3187
+ convertStarToPath: function () {
3188
+ var numPts = Math.floor(this.pt.v) * 2;
3189
+ var angle = Math.PI * 2 / numPts;
3190
+ /*this.v.v.length = numPts;
3191
+ this.v.i.length = numPts;
3192
+ this.v.o.length = numPts;*/
3193
+ var longFlag = true;
3194
+ var longRad = this.or.v;
3195
+ var shortRad = this.ir.v;
3196
+ var longRound = this.os.v;
3197
+ var shortRound = this.is.v;
3198
+ var longPerimSegment = 2 * Math.PI * longRad / (numPts * 2);
3199
+ var shortPerimSegment = 2 * Math.PI * shortRad / (numPts * 2);
3200
+ var i, rad, roundness, perimSegment, currentAng = -Math.PI / 2;
3201
+ currentAng += this.r.v;
3202
+ var dir = this.data.d === 3 ? -1 : 1;
3203
+ this.v._length = 0;
3204
+ for (i = 0; i < numPts; i += 1) {
3205
+ rad = longFlag ? longRad : shortRad;
3206
+ roundness = longFlag ? longRound : shortRound;
3207
+ perimSegment = longFlag ? longPerimSegment : shortPerimSegment;
3208
+ var x = rad * Math.cos(currentAng);
3209
+ var y = rad * Math.sin(currentAng);
3210
+ var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
3211
+ var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
3212
+ x += + this.p.v[0];
3213
+ y += + this.p.v[1];
3214
+ this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true);
3215
+
3216
+ /*this.v.v[i] = [x,y];
3217
+ this.v.i[i] = [x+ox*perimSegment*roundness*dir,y+oy*perimSegment*roundness*dir];
3218
+ this.v.o[i] = [x-ox*perimSegment*roundness*dir,y-oy*perimSegment*roundness*dir];
3219
+ this.v._length = numPts;*/
3220
+ longFlag = !longFlag;
3221
+ currentAng += angle * dir;
3222
+ }
3223
+ },
3224
+ convertPolygonToPath: function () {
3225
+ var numPts = Math.floor(this.pt.v);
3226
+ var angle = Math.PI * 2 / numPts;
3227
+ var rad = this.or.v;
3228
+ var roundness = this.os.v;
3229
+ var perimSegment = 2 * Math.PI * rad / (numPts * 4);
3230
+ var i, currentAng = -Math.PI / 2;
3231
+ var dir = this.data.d === 3 ? -1 : 1;
3232
+ currentAng += this.r.v;
3233
+ this.v._length = 0;
3234
+ for (i = 0; i < numPts; i += 1) {
3235
+ var x = rad * Math.cos(currentAng);
3236
+ var y = rad * Math.sin(currentAng);
3237
+ var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
3238
+ var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
3239
+ x += + this.p.v[0];
3240
+ y += + this.p.v[1];
3241
+ this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true);
3242
+ currentAng += angle * dir;
3243
+ }
3244
+ this.paths.length = 0;
3245
+ this.paths[0] = this.v;
3246
+ }
3247
+
3248
+ }
3249
+ extendPrototype([DynamicPropertyContainer], StarShapeProperty);
3250
+
3251
+ return StarShapeProperty;
3252
+ }());
3253
+
3254
+ var RectShapeProperty = (function () {
3255
+
3256
+ function RectShapeProperty(elem, data) {
3257
+ this.v = shape_pool.newElement();
3258
+ this.v.c = true;
3259
+ this.localShapeCollection = shapeCollection_pool.newShapeCollection();
3260
+ this.localShapeCollection.addShape(this.v);
3261
+ this.paths = this.localShapeCollection;
3262
+ this.elem = elem;
3263
+ this.comp = elem.comp;
3264
+ this.frameId = -1;
3265
+ this.d = data.d;
3266
+ this.initDynamicPropertyContainer(elem);
3267
+ this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);
3268
+ this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this);
3269
+ this.r = PropertyFactory.getProp(elem, data.r, 0, 0, this);
3270
+ if (this.dynamicProperties.length) {
3271
+ this.k = true;
3272
+ } else {
3273
+ this.k = false;
3274
+ this.convertRectToPath();
3275
+ }
3276
+ };
3277
+
3278
+ RectShapeProperty.prototype = {
3279
+ convertRectToPath: function () {
3280
+ var p0 = this.p.v[0], p1 = this.p.v[1], v0 = this.s.v[0] / 2, v1 = this.s.v[1] / 2;
3281
+ var round = bm_min(v0, v1, this.r.v);
3282
+ var cPoint = round * (1 - roundCorner);
3283
+ this.v._length = 0;
3284
+
3285
+ if (this.d === 2 || this.d === 1) {
3286
+ this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, 0, true);
3287
+ this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, p0 + v0, p1 + v1 - round, 1, true);
3288
+ if (round !== 0) {
3289
+ this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, 2, true);
3290
+ this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0 + round, p1 + v1, 3, true);
3291
+ this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, 4, true);
3292
+ this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1 + round, 5, true);
3293
+ this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, 6, true);
3294
+ this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, p0 + v0 - round, p1 - v1, 7, true);
3295
+ } else {
3296
+ this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0, p1 + v1, 2);
3297
+ this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1, 3);
3298
+ }
3299
+ } else {
3300
+ this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, p0 + v0, p1 - v1 + round, 0, true);
3301
+ if (round !== 0) {
3302
+ this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, 1, true);
3303
+ this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0 + round, p1 - v1, 2, true);
3304
+ this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, 3, true);
3305
+ this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1 - round, 4, true);
3306
+ this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, 5, true);
3307
+ this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0 - round, p1 + v1, 6, true);
3308
+ this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, 7, true);
3309
+ } else {
3310
+ this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0, p1 - v1, 1, true);
3311
+ this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1, 2, true);
3312
+ this.v.setTripleAt(p0 + v0, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0, p1 + v1, 3, true);
3313
+
3314
+ }
3315
+ }
3316
+ },
3317
+ getValue: function (frameNum) {
3318
+ if (this.elem.globalData.frameId === this.frameId) {
3319
+ return;
3320
+ }
3321
+ this.frameId = this.elem.globalData.frameId;
3322
+ this.iterateDynamicProperties();
3323
+ if (this._mdf) {
3324
+ this.convertRectToPath();
3325
+ }
3326
+
3327
+ },
3328
+ reset: resetShape
3329
+ }
3330
+ extendPrototype([DynamicPropertyContainer], RectShapeProperty);
3331
+
3332
+ return RectShapeProperty;
3333
+ }());
3334
+
3335
+ function getShapeProp(elem, data, type) {
3336
+ var prop;
3337
+ if (type === 3 || type === 4) {
3338
+ var dataProp = type === 3 ? data.pt : data.ks;
3339
+ var keys = dataProp.k;
3340
+ if (keys.length) {
3341
+ prop = new KeyframedShapeProperty(elem, data, type);
3342
+ } else {
3343
+ prop = new ShapeProperty(elem, data, type);
3344
+ }
3345
+ } else if (type === 5) {
3346
+ prop = new RectShapeProperty(elem, data);
3347
+ } else if (type === 6) {
3348
+ prop = new EllShapeProperty(elem, data);
3349
+ } else if (type === 7) {
3350
+ prop = new StarShapeProperty(elem, data);
3351
+ }
3352
+ if (prop.k) {
3353
+ elem.addDynamicProperty(prop);
3354
+ }
3355
+ return prop;
3356
+ }
3357
+
3358
+ function getConstructorFunction() {
3359
+ return ShapeProperty;
3360
+ }
3361
+
3362
+ function getKeyframedConstructorFunction() {
3363
+ return KeyframedShapeProperty;
3364
+ }
3365
+
3366
+ var ob = {};
3367
+ ob.getShapeProp = getShapeProp;
3368
+ ob.getConstructorFunction = getConstructorFunction;
3369
+ ob.getKeyframedConstructorFunction = getKeyframedConstructorFunction;
3370
+ return ob;
3371
+ }());
3372
+ var ShapeModifiers = (function () {
3373
+ var ob = {};
3374
+ var modifiers = {};
3375
+ ob.registerModifier = registerModifier;
3376
+ ob.getModifier = getModifier;
3377
+
3378
+ function registerModifier(nm, factory) {
3379
+ if (!modifiers[nm]) {
3380
+ modifiers[nm] = factory;
3381
+ }
3382
+ }
3383
+
3384
+ function getModifier(nm, elem, data) {
3385
+ return new modifiers[nm](elem, data);
3386
+ }
3387
+
3388
+ return ob;
3389
+ }());
3390
+
3391
+ function ShapeModifier() { }
3392
+ ShapeModifier.prototype.initModifierProperties = function () { };
3393
+ ShapeModifier.prototype.addShapeToModifier = function () { };
3394
+ ShapeModifier.prototype.addShape = function (data) {
3395
+ if (!this.closed) {
3396
+ // Adding shape to dynamic properties. It covers the case where a shape has no effects applied, to reset it's _mdf state on every tick.
3397
+ data.sh.container.addDynamicProperty(data.sh);
3398
+ var shapeData = { shape: data.sh, data: data, localShapeCollection: shapeCollection_pool.newShapeCollection() };
3399
+ this.shapes.push(shapeData);
3400
+ this.addShapeToModifier(shapeData);
3401
+ if (this._isAnimated) {
3402
+ data.setAsAnimated();
3403
+ }
3404
+ }
3405
+ };
3406
+ ShapeModifier.prototype.init = function (elem, data) {
3407
+ this.shapes = [];
3408
+ this.elem = elem;
3409
+ this.initDynamicPropertyContainer(elem);
3410
+ this.initModifierProperties(elem, data);
3411
+ this.frameId = initialDefaultFrame;
3412
+ this.closed = false;
3413
+ this.k = false;
3414
+ if (this.dynamicProperties.length) {
3415
+ this.k = true;
3416
+ } else {
3417
+ this.getValue(true);
3418
+ }
3419
+ };
3420
+ ShapeModifier.prototype.processKeys = function () {
3421
+ if (this.elem.globalData.frameId === this.frameId) {
3422
+ return;
3423
+ }
3424
+ this.frameId = this.elem.globalData.frameId;
3425
+ this.iterateDynamicProperties();
3426
+ };
3427
+
3428
+ extendPrototype([DynamicPropertyContainer], ShapeModifier);
3429
+ function TrimModifier() {
3430
+ }
3431
+ extendPrototype([ShapeModifier], TrimModifier);
3432
+ TrimModifier.prototype.initModifierProperties = function (elem, data) {
3433
+ this.s = PropertyFactory.getProp(elem, data.s, 0, 0.01, this);
3434
+ this.e = PropertyFactory.getProp(elem, data.e, 0, 0.01, this);
3435
+ this.o = PropertyFactory.getProp(elem, data.o, 0, 0, this);
3436
+ this.sValue = 0;
3437
+ this.eValue = 0;
3438
+ this.getValue = this.processKeys;
3439
+ this.m = data.m;
3440
+ this._isAnimated = !!this.s.effectsSequence.length || !!this.e.effectsSequence.length || !!this.o.effectsSequence.length;
3441
+ };
3442
+
3443
+ TrimModifier.prototype.addShapeToModifier = function (shapeData) {
3444
+ shapeData.pathsData = [];
3445
+ };
3446
+
3447
+ TrimModifier.prototype.calculateShapeEdges = function (s, e, shapeLength, addedLength, totalModifierLength) {
3448
+ var segments = [];
3449
+ if (e <= 1) {
3450
+ segments.push({
3451
+ s: s,
3452
+ e: e
3453
+ });
3454
+ } else if (s >= 1) {
3455
+ segments.push({
3456
+ s: s - 1,
3457
+ e: e - 1
3458
+ });
3459
+ } else {
3460
+ segments.push({
3461
+ s: s,
3462
+ e: 1
3463
+ });
3464
+ segments.push({
3465
+ s: 0,
3466
+ e: e - 1
3467
+ });
3468
+ }
3469
+ var shapeSegments = [];
3470
+ var i, len = segments.length, segmentOb;
3471
+ for (i = 0; i < len; i += 1) {
3472
+ segmentOb = segments[i];
3473
+ if (segmentOb.e * totalModifierLength < addedLength || segmentOb.s * totalModifierLength > addedLength + shapeLength) {
3474
+
3475
+ } else {
3476
+ var shapeS, shapeE;
3477
+ if (segmentOb.s * totalModifierLength <= addedLength) {
3478
+ shapeS = 0;
3479
+ } else {
3480
+ shapeS = (segmentOb.s * totalModifierLength - addedLength) / shapeLength;
3481
+ }
3482
+ if (segmentOb.e * totalModifierLength >= addedLength + shapeLength) {
3483
+ shapeE = 1;
3484
+ } else {
3485
+ shapeE = ((segmentOb.e * totalModifierLength - addedLength) / shapeLength);
3486
+ }
3487
+ shapeSegments.push([shapeS, shapeE]);
3488
+ }
3489
+ }
3490
+ if (!shapeSegments.length) {
3491
+ shapeSegments.push([0, 0]);
3492
+ }
3493
+ return shapeSegments;
3494
+ };
3495
+
3496
+ TrimModifier.prototype.releasePathsData = function (pathsData) {
3497
+ var i, len = pathsData.length;
3498
+ for (i = 0; i < len; i += 1) {
3499
+ segments_length_pool.release(pathsData[i]);
3500
+ }
3501
+ pathsData.length = 0;
3502
+ return pathsData;
3503
+ };
3504
+
3505
+ TrimModifier.prototype.processShapes = function (_isFirstFrame) {
3506
+ var s, e;
3507
+ if (this._mdf || _isFirstFrame) {
3508
+ var o = (this.o.v % 360) / 360;
3509
+ if (o < 0) {
3510
+ o += 1;
3511
+ }
3512
+ s = (this.s.v > 1 ? 1 : this.s.v < 0 ? 0 : this.s.v) + o;
3513
+ e = (this.e.v > 1 ? 1 : this.e.v < 0 ? 0 : this.e.v) + o;
3514
+ if (s === e) {
3515
+
3516
+ }
3517
+ if (s > e) {
3518
+ var _s = s;
3519
+ s = e;
3520
+ e = _s;
3521
+ }
3522
+ s = Math.round(s * 10000) * 0.0001;
3523
+ e = Math.round(e * 10000) * 0.0001;
3524
+ this.sValue = s;
3525
+ this.eValue = e;
3526
+ } else {
3527
+ s = this.sValue;
3528
+ e = this.eValue;
3529
+ }
3530
+ var shapePaths;
3531
+ var i, len = this.shapes.length, j, jLen;
3532
+ var pathsData, pathData, totalShapeLength, totalModifierLength = 0;
3533
+
3534
+ if (e === s) {
3535
+ for (i = 0; i < len; i += 1) {
3536
+ this.shapes[i].localShapeCollection.releaseShapes();
3537
+ this.shapes[i].shape._mdf = true;
3538
+ this.shapes[i].shape.paths = this.shapes[i].localShapeCollection;
3539
+ }
3540
+ } else if (!((e === 1 && s === 0) || (e === 0 && s === 1))) {
3541
+ var segments = [], shapeData, localShapeCollection;
3542
+ for (i = 0; i < len; i += 1) {
3543
+ shapeData = this.shapes[i];
3544
+ // if shape hasn't changed and trim properties haven't changed, cached previous path can be used
3545
+ if (!shapeData.shape._mdf && !this._mdf && !_isFirstFrame && this.m !== 2) {
3546
+ shapeData.shape.paths = shapeData.localShapeCollection;
3547
+ } else {
3548
+ shapePaths = shapeData.shape.paths;
3549
+ jLen = shapePaths._length;
3550
+ totalShapeLength = 0;
3551
+ if (!shapeData.shape._mdf && shapeData.pathsData.length) {
3552
+ totalShapeLength = shapeData.totalShapeLength;
3553
+ } else {
3554
+ pathsData = this.releasePathsData(shapeData.pathsData);
3555
+ for (j = 0; j < jLen; j += 1) {
3556
+ pathData = bez.getSegmentsLength(shapePaths.shapes[j]);
3557
+ pathsData.push(pathData);
3558
+ totalShapeLength += pathData.totalLength;
3559
+ }
3560
+ shapeData.totalShapeLength = totalShapeLength;
3561
+ shapeData.pathsData = pathsData;
3562
+ }
3563
+
3564
+ totalModifierLength += totalShapeLength;
3565
+ shapeData.shape._mdf = true;
3566
+ }
3567
+ }
3568
+ var shapeS = s, shapeE = e, addedLength = 0, edges;
3569
+ for (i = len - 1; i >= 0; i -= 1) {
3570
+ shapeData = this.shapes[i];
3571
+ if (shapeData.shape._mdf) {
3572
+ localShapeCollection = shapeData.localShapeCollection;
3573
+ localShapeCollection.releaseShapes();
3574
+ //if m === 2 means paths are trimmed individually so edges need to be found for this specific shape relative to whoel group
3575
+ if (this.m === 2 && len > 1) {
3576
+ edges = this.calculateShapeEdges(s, e, shapeData.totalShapeLength, addedLength, totalModifierLength);
3577
+ addedLength += shapeData.totalShapeLength;
3578
+ } else {
3579
+ edges = [[shapeS, shapeE]];
3580
+ }
3581
+ jLen = edges.length;
3582
+ for (j = 0; j < jLen; j += 1) {
3583
+ shapeS = edges[j][0];
3584
+ shapeE = edges[j][1];
3585
+ segments.length = 0;
3586
+ if (shapeE <= 1) {
3587
+ segments.push({
3588
+ s: shapeData.totalShapeLength * shapeS,
3589
+ e: shapeData.totalShapeLength * shapeE
3590
+ });
3591
+ } else if (shapeS >= 1) {
3592
+ segments.push({
3593
+ s: shapeData.totalShapeLength * (shapeS - 1),
3594
+ e: shapeData.totalShapeLength * (shapeE - 1)
3595
+ });
3596
+ } else {
3597
+ segments.push({
3598
+ s: shapeData.totalShapeLength * shapeS,
3599
+ e: shapeData.totalShapeLength
3600
+ });
3601
+ segments.push({
3602
+ s: 0,
3603
+ e: shapeData.totalShapeLength * (shapeE - 1)
3604
+ });
3605
+ }
3606
+ var newShapesData = this.addShapes(shapeData, segments[0]);
3607
+ if (segments[0].s !== segments[0].e) {
3608
+ if (segments.length > 1) {
3609
+ var lastShapeInCollection = shapeData.shape.paths.shapes[shapeData.shape.paths._length - 1];
3610
+ if (lastShapeInCollection.c) {
3611
+ var lastShape = newShapesData.pop();
3612
+ this.addPaths(newShapesData, localShapeCollection);
3613
+ newShapesData = this.addShapes(shapeData, segments[1], lastShape);
3614
+ } else {
3615
+ this.addPaths(newShapesData, localShapeCollection);
3616
+ newShapesData = this.addShapes(shapeData, segments[1]);
3617
+ }
3618
+ }
3619
+ this.addPaths(newShapesData, localShapeCollection);
3620
+ }
3621
+
3622
+ }
3623
+ shapeData.shape.paths = localShapeCollection;
3624
+ }
3625
+ }
3626
+ } else if (this._mdf) {
3627
+ for (i = 0; i < len; i += 1) {
3628
+ //Releasign Trim Cached paths data when no trim applied in case shapes are modified inbetween.
3629
+ //Don't remove this even if it's losing cached info.
3630
+ this.shapes[i].pathsData.length = 0;
3631
+ this.shapes[i].shape._mdf = true;
3632
+ }
3633
+ }
3634
+ };
3635
+
3636
+ TrimModifier.prototype.addPaths = function (newPaths, localShapeCollection) {
3637
+ var i, len = newPaths.length;
3638
+ for (i = 0; i < len; i += 1) {
3639
+ localShapeCollection.addShape(newPaths[i]);
3640
+ }
3641
+ };
3642
+
3643
+ TrimModifier.prototype.addSegment = function (pt1, pt2, pt3, pt4, shapePath, pos, newShape) {
3644
+ shapePath.setXYAt(pt2[0], pt2[1], 'o', pos);
3645
+ shapePath.setXYAt(pt3[0], pt3[1], 'i', pos + 1);
3646
+ if (newShape) {
3647
+ shapePath.setXYAt(pt1[0], pt1[1], 'v', pos);
3648
+ }
3649
+ shapePath.setXYAt(pt4[0], pt4[1], 'v', pos + 1);
3650
+ };
3651
+
3652
+ TrimModifier.prototype.addSegmentFromArray = function (points, shapePath, pos, newShape) {
3653
+ shapePath.setXYAt(points[1], points[5], 'o', pos);
3654
+ shapePath.setXYAt(points[2], points[6], 'i', pos + 1);
3655
+ if (newShape) {
3656
+ shapePath.setXYAt(points[0], points[4], 'v', pos);
3657
+ }
3658
+ shapePath.setXYAt(points[3], points[7], 'v', pos + 1);
3659
+ };
3660
+
3661
+ TrimModifier.prototype.addShapes = function (shapeData, shapeSegment, shapePath) {
3662
+ var pathsData = shapeData.pathsData;
3663
+ var shapePaths = shapeData.shape.paths.shapes;
3664
+ var i, len = shapeData.shape.paths._length, j, jLen;
3665
+ var addedLength = 0;
3666
+ var currentLengthData, segmentCount;
3667
+ var lengths;
3668
+ var segment;
3669
+ var shapes = [];
3670
+ var initPos;
3671
+ var newShape = true;
3672
+ if (!shapePath) {
3673
+ shapePath = shape_pool.newElement();
3674
+ segmentCount = 0;
3675
+ initPos = 0;
3676
+ } else {
3677
+ segmentCount = shapePath._length;
3678
+ initPos = shapePath._length;
3679
+ }
3680
+ shapes.push(shapePath);
3681
+ for (i = 0; i < len; i += 1) {
3682
+ lengths = pathsData[i].lengths;
3683
+ shapePath.c = shapePaths[i].c;
3684
+ jLen = shapePaths[i].c ? lengths.length : lengths.length + 1;
3685
+ for (j = 1; j < jLen; j += 1) {
3686
+ currentLengthData = lengths[j - 1];
3687
+ if (addedLength + currentLengthData.addedLength < shapeSegment.s) {
3688
+ addedLength += currentLengthData.addedLength;
3689
+ shapePath.c = false;
3690
+ } else if (addedLength > shapeSegment.e) {
3691
+ shapePath.c = false;
3692
+ break;
3693
+ } else {
3694
+ if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + currentLengthData.addedLength) {
3695
+ this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[j], shapePaths[i].v[j], shapePath, segmentCount, newShape);
3696
+ newShape = false;
3697
+ } else {
3698
+ segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[j], shapePaths[i].o[j - 1], shapePaths[i].i[j], (shapeSegment.s - addedLength) / currentLengthData.addedLength, (shapeSegment.e - addedLength) / currentLengthData.addedLength, lengths[j - 1]);
3699
+ this.addSegmentFromArray(segment, shapePath, segmentCount, newShape);
3700
+ // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);
3701
+ newShape = false;
3702
+ shapePath.c = false;
3703
+ }
3704
+ addedLength += currentLengthData.addedLength;
3705
+ segmentCount += 1;
3706
+ }
3707
+ }
3708
+ if (shapePaths[i].c && lengths.length) {
3709
+ currentLengthData = lengths[j - 1];
3710
+ if (addedLength <= shapeSegment.e) {
3711
+ var segmentLength = lengths[j - 1].addedLength;
3712
+ if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + segmentLength) {
3713
+ this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[0], shapePaths[i].v[0], shapePath, segmentCount, newShape);
3714
+ newShape = false;
3715
+ } else {
3716
+ segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[0], shapePaths[i].o[j - 1], shapePaths[i].i[0], (shapeSegment.s - addedLength) / segmentLength, (shapeSegment.e - addedLength) / segmentLength, lengths[j - 1]);
3717
+ this.addSegmentFromArray(segment, shapePath, segmentCount, newShape);
3718
+ // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);
3719
+ newShape = false;
3720
+ shapePath.c = false;
3721
+ }
3722
+ } else {
3723
+ shapePath.c = false;
3724
+ }
3725
+ addedLength += currentLengthData.addedLength;
3726
+ segmentCount += 1;
3727
+ }
3728
+ if (shapePath._length) {
3729
+ shapePath.setXYAt(shapePath.v[initPos][0], shapePath.v[initPos][1], 'i', initPos);
3730
+ shapePath.setXYAt(shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1], 'o', shapePath._length - 1);
3731
+ }
3732
+ if (addedLength > shapeSegment.e) {
3733
+ break;
3734
+ }
3735
+ if (i < len - 1) {
3736
+ shapePath = shape_pool.newElement();
3737
+ newShape = true;
3738
+ shapes.push(shapePath);
3739
+ segmentCount = 0;
3740
+ }
3741
+ }
3742
+ return shapes;
3743
+ };
3744
+
3745
+
3746
+ ShapeModifiers.registerModifier('tm', TrimModifier);
3747
+ function RoundCornersModifier() { }
3748
+ extendPrototype([ShapeModifier], RoundCornersModifier);
3749
+ RoundCornersModifier.prototype.initModifierProperties = function (elem, data) {
3750
+ this.getValue = this.processKeys;
3751
+ this.rd = PropertyFactory.getProp(elem, data.r, 0, null, this);
3752
+ this._isAnimated = !!this.rd.effectsSequence.length;
3753
+ };
3754
+
3755
+ RoundCornersModifier.prototype.processPath = function (path, round) {
3756
+ var cloned_path = shape_pool.newElement();
3757
+ cloned_path.c = path.c;
3758
+ var i, len = path._length;
3759
+ var currentV, currentI, currentO, closerV, newV, newO, newI, distance, newPosPerc, index = 0;
3760
+ var vX, vY, oX, oY, iX, iY;
3761
+ for (i = 0; i < len; i += 1) {
3762
+ currentV = path.v[i];
3763
+ currentO = path.o[i];
3764
+ currentI = path.i[i];
3765
+ if (currentV[0] === currentO[0] && currentV[1] === currentO[1] && currentV[0] === currentI[0] && currentV[1] === currentI[1]) {
3766
+ if ((i === 0 || i === len - 1) && !path.c) {
3767
+ cloned_path.setTripleAt(currentV[0], currentV[1], currentO[0], currentO[1], currentI[0], currentI[1], index);
3768
+ /*cloned_path.v[index] = currentV;
3769
+ cloned_path.o[index] = currentO;
3770
+ cloned_path.i[index] = currentI;*/
3771
+ index += 1;
3772
+ } else {
3773
+ if (i === 0) {
3774
+ closerV = path.v[len - 1];
3775
+ } else {
3776
+ closerV = path.v[i - 1];
3777
+ }
3778
+ distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2));
3779
+ newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0;
3780
+ vX = iX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc;
3781
+ vY = iY = currentV[1] - (currentV[1] - closerV[1]) * newPosPerc;
3782
+ oX = vX - (vX - currentV[0]) * roundCorner;
3783
+ oY = vY - (vY - currentV[1]) * roundCorner;
3784
+ cloned_path.setTripleAt(vX, vY, oX, oY, iX, iY, index);
3785
+ index += 1;
3786
+
3787
+ if (i === len - 1) {
3788
+ closerV = path.v[0];
3789
+ } else {
3790
+ closerV = path.v[i + 1];
3791
+ }
3792
+ distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2));
3793
+ newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0;
3794
+ vX = oX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc;
3795
+ vY = oY = currentV[1] + (closerV[1] - currentV[1]) * newPosPerc;
3796
+ iX = vX - (vX - currentV[0]) * roundCorner;
3797
+ iY = vY - (vY - currentV[1]) * roundCorner;
3798
+ cloned_path.setTripleAt(vX, vY, oX, oY, iX, iY, index);
3799
+ index += 1;
3800
+ }
3801
+ } else {
3802
+ cloned_path.setTripleAt(path.v[i][0], path.v[i][1], path.o[i][0], path.o[i][1], path.i[i][0], path.i[i][1], index);
3803
+ index += 1;
3804
+ }
3805
+ }
3806
+ return cloned_path;
3807
+ };
3808
+
3809
+ RoundCornersModifier.prototype.processShapes = function (_isFirstFrame) {
3810
+ var shapePaths;
3811
+ var i, len = this.shapes.length;
3812
+ var j, jLen;
3813
+ var rd = this.rd.v;
3814
+
3815
+ if (rd !== 0) {
3816
+ var shapeData, newPaths, localShapeCollection;
3817
+ for (i = 0; i < len; i += 1) {
3818
+ shapeData = this.shapes[i];
3819
+ newPaths = shapeData.shape.paths;
3820
+ localShapeCollection = shapeData.localShapeCollection;
3821
+ if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {
3822
+ localShapeCollection.releaseShapes();
3823
+ shapeData.shape._mdf = true;
3824
+ shapePaths = shapeData.shape.paths.shapes;
3825
+ jLen = shapeData.shape.paths._length;
3826
+ for (j = 0; j < jLen; j += 1) {
3827
+ localShapeCollection.addShape(this.processPath(shapePaths[j], rd));
3828
+ }
3829
+ }
3830
+ shapeData.shape.paths = shapeData.localShapeCollection;
3831
+ }
3832
+
3833
+ }
3834
+ if (!this.dynamicProperties.length) {
3835
+ this._mdf = false;
3836
+ }
3837
+ };
3838
+
3839
+ ShapeModifiers.registerModifier('rd', RoundCornersModifier);
3840
+ function RepeaterModifier() { }
3841
+ extendPrototype([ShapeModifier], RepeaterModifier);
3842
+
3843
+ RepeaterModifier.prototype.initModifierProperties = function (elem, data) {
3844
+ this.getValue = this.processKeys;
3845
+ this.c = PropertyFactory.getProp(elem, data.c, 0, null, this);
3846
+ this.o = PropertyFactory.getProp(elem, data.o, 0, null, this);
3847
+ this.tr = TransformPropertyFactory.getTransformProperty(elem, data.tr, this);
3848
+ this.so = PropertyFactory.getProp(elem, data.tr.so, 0, 0.01, this);
3849
+ this.eo = PropertyFactory.getProp(elem, data.tr.eo, 0, 0.01, this);
3850
+ this.data = data;
3851
+ if (!this.dynamicProperties.length) {
3852
+ this.getValue(true);
3853
+ }
3854
+ this._isAnimated = !!this.dynamicProperties.length;
3855
+ this.pMatrix = new Matrix();
3856
+ this.rMatrix = new Matrix();
3857
+ this.sMatrix = new Matrix();
3858
+ this.tMatrix = new Matrix();
3859
+ this.matrix = new Matrix();
3860
+ };
3861
+
3862
+ RepeaterModifier.prototype.applyTransforms = function (pMatrix, rMatrix, sMatrix, transform, perc, inv) {
3863
+ var dir = inv ? -1 : 1;
3864
+ var scaleX = transform.s.v[0] + (1 - transform.s.v[0]) * (1 - perc);
3865
+ var scaleY = transform.s.v[1] + (1 - transform.s.v[1]) * (1 - perc);
3866
+ pMatrix.translate(transform.p.v[0] * dir * perc, transform.p.v[1] * dir * perc, transform.p.v[2]);
3867
+ rMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);
3868
+ rMatrix.rotate(-transform.r.v * dir * perc);
3869
+ rMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);
3870
+ sMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);
3871
+ sMatrix.scale(inv ? 1 / scaleX : scaleX, inv ? 1 / scaleY : scaleY);
3872
+ sMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);
3873
+ };
3874
+
3875
+ RepeaterModifier.prototype.init = function (elem, arr, pos, elemsData) {
3876
+ this.elem = elem;
3877
+ this.arr = arr;
3878
+ this.pos = pos;
3879
+ this.elemsData = elemsData;
3880
+ this._currentCopies = 0;
3881
+ this._elements = [];
3882
+ this._groups = [];
3883
+ this.frameId = -1;
3884
+ this.initDynamicPropertyContainer(elem);
3885
+ this.initModifierProperties(elem, arr[pos]);
3886
+ var cont = 0;
3887
+ while (pos > 0) {
3888
+ pos -= 1;
3889
+ //this._elements.unshift(arr.splice(pos,1)[0]);
3890
+ this._elements.unshift(arr[pos]);
3891
+ cont += 1;
3892
+ }
3893
+ if (this.dynamicProperties.length) {
3894
+ this.k = true;
3895
+ } else {
3896
+ this.getValue(true);
3897
+ }
3898
+ };
3899
+
3900
+ RepeaterModifier.prototype.resetElements = function (elements) {
3901
+ var i, len = elements.length;
3902
+ for (i = 0; i < len; i += 1) {
3903
+ elements[i]._processed = false;
3904
+ if (elements[i].ty === 'gr') {
3905
+ this.resetElements(elements[i].it);
3906
+ }
3907
+ }
3908
+ };
3909
+
3910
+ RepeaterModifier.prototype.cloneElements = function (elements) {
3911
+ var i, len = elements.length;
3912
+ var newElements = JSON.parse(JSON.stringify(elements));
3913
+ this.resetElements(newElements);
3914
+ return newElements;
3915
+ };
3916
+
3917
+ RepeaterModifier.prototype.changeGroupRender = function (elements, renderFlag) {
3918
+ var i, len = elements.length;
3919
+ for (i = 0; i < len; i += 1) {
3920
+ elements[i]._render = renderFlag;
3921
+ if (elements[i].ty === 'gr') {
3922
+ this.changeGroupRender(elements[i].it, renderFlag);
3923
+ }
3924
+ }
3925
+ };
3926
+
3927
+ RepeaterModifier.prototype.processShapes = function (_isFirstFrame) {
3928
+ var items, itemsTransform, i, dir, cont;
3929
+ if (this._mdf || _isFirstFrame) {
3930
+ var copies = Math.ceil(this.c.v);
3931
+ if (this._groups.length < copies) {
3932
+ while (this._groups.length < copies) {
3933
+ var group = {
3934
+ it: this.cloneElements(this._elements),
3935
+ ty: 'gr'
3936
+ };
3937
+ group.it.push({ "a": { "a": 0, "ix": 1, "k": [0, 0] }, "nm": "Transform", "o": { "a": 0, "ix": 7, "k": 100 }, "p": { "a": 0, "ix": 2, "k": [0, 0] }, "r": { "a": 1, "ix": 6, "k": [{ s: 0, e: 0, t: 0 }, { s: 0, e: 0, t: 1 }] }, "s": { "a": 0, "ix": 3, "k": [100, 100] }, "sa": { "a": 0, "ix": 5, "k": 0 }, "sk": { "a": 0, "ix": 4, "k": 0 }, "ty": "tr" });
3938
+
3939
+ this.arr.splice(0, 0, group);
3940
+ this._groups.splice(0, 0, group);
3941
+ this._currentCopies += 1;
3942
+ }
3943
+ this.elem.reloadShapes();
3944
+ }
3945
+ cont = 0;
3946
+ var renderFlag;
3947
+ for (i = 0; i <= this._groups.length - 1; i += 1) {
3948
+ renderFlag = cont < copies;
3949
+ this._groups[i]._render = renderFlag;
3950
+ this.changeGroupRender(this._groups[i].it, renderFlag);
3951
+ cont += 1;
3952
+ }
3953
+
3954
+ this._currentCopies = copies;
3955
+ ////
3956
+
3957
+ var offset = this.o.v;
3958
+ var offsetModulo = offset % 1;
3959
+ var roundOffset = offset > 0 ? Math.floor(offset) : Math.ceil(offset);
3960
+ var k;
3961
+ var tMat = this.tr.v.props;
3962
+ var pProps = this.pMatrix.props;
3963
+ var rProps = this.rMatrix.props;
3964
+ var sProps = this.sMatrix.props;
3965
+ this.pMatrix.reset();
3966
+ this.rMatrix.reset();
3967
+ this.sMatrix.reset();
3968
+ this.tMatrix.reset();
3969
+ this.matrix.reset();
3970
+ var iteration = 0;
3971
+
3972
+ if (offset > 0) {
3973
+ while (iteration < roundOffset) {
3974
+ this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);
3975
+ iteration += 1;
3976
+ }
3977
+ if (offsetModulo) {
3978
+ this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, offsetModulo, false);
3979
+ iteration += offsetModulo;
3980
+ }
3981
+ } else if (offset < 0) {
3982
+ while (iteration > roundOffset) {
3983
+ this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, true);
3984
+ iteration -= 1;
3985
+ }
3986
+ if (offsetModulo) {
3987
+ this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, - offsetModulo, true);
3988
+ iteration -= offsetModulo;
3989
+ }
3990
+ }
3991
+ i = this.data.m === 1 ? 0 : this._currentCopies - 1;
3992
+ dir = this.data.m === 1 ? 1 : -1;
3993
+ cont = this._currentCopies;
3994
+ var j, jLen;
3995
+ while (cont) {
3996
+ items = this.elemsData[i].it;
3997
+ itemsTransform = items[items.length - 1].transform.mProps.v.props;
3998
+ jLen = itemsTransform.length;
3999
+ items[items.length - 1].transform.mProps._mdf = true;
4000
+ items[items.length - 1].transform.op._mdf = true;
4001
+ items[items.length - 1].transform.op.v = this.so.v + (this.eo.v - this.so.v) * (i / (this._currentCopies - 1));
4002
+ if (iteration !== 0) {
4003
+ if ((i !== 0 && dir === 1) || (i !== this._currentCopies - 1 && dir === -1)) {
4004
+ this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);
4005
+ }
4006
+ this.matrix.transform(rProps[0], rProps[1], rProps[2], rProps[3], rProps[4], rProps[5], rProps[6], rProps[7], rProps[8], rProps[9], rProps[10], rProps[11], rProps[12], rProps[13], rProps[14], rProps[15]);
4007
+ this.matrix.transform(sProps[0], sProps[1], sProps[2], sProps[3], sProps[4], sProps[5], sProps[6], sProps[7], sProps[8], sProps[9], sProps[10], sProps[11], sProps[12], sProps[13], sProps[14], sProps[15]);
4008
+ this.matrix.transform(pProps[0], pProps[1], pProps[2], pProps[3], pProps[4], pProps[5], pProps[6], pProps[7], pProps[8], pProps[9], pProps[10], pProps[11], pProps[12], pProps[13], pProps[14], pProps[15]);
4009
+
4010
+ for (j = 0; j < jLen; j += 1) {
4011
+ itemsTransform[j] = this.matrix.props[j];
4012
+ }
4013
+ this.matrix.reset();
4014
+ } else {
4015
+ this.matrix.reset();
4016
+ for (j = 0; j < jLen; j += 1) {
4017
+ itemsTransform[j] = this.matrix.props[j];
4018
+ }
4019
+ }
4020
+ iteration += 1;
4021
+ cont -= 1;
4022
+ i += dir;
4023
+ }
4024
+ } else {
4025
+ cont = this._currentCopies;
4026
+ i = 0;
4027
+ dir = 1;
4028
+ while (cont) {
4029
+ items = this.elemsData[i].it;
4030
+ itemsTransform = items[items.length - 1].transform.mProps.v.props;
4031
+ items[items.length - 1].transform.mProps._mdf = false;
4032
+ items[items.length - 1].transform.op._mdf = false;
4033
+ cont -= 1;
4034
+ i += dir;
4035
+ }
4036
+ }
4037
+ };
4038
+
4039
+ RepeaterModifier.prototype.addShape = function () { };
4040
+
4041
+ ShapeModifiers.registerModifier('rp', RepeaterModifier);
4042
+ function ShapeCollection() {
4043
+ this._length = 0;
4044
+ this._maxLength = 4;
4045
+ this.shapes = createSizedArray(this._maxLength);
4046
+ }
4047
+
4048
+ ShapeCollection.prototype.addShape = function (shapeData) {
4049
+ if (this._length === this._maxLength) {
4050
+ this.shapes = this.shapes.concat(createSizedArray(this._maxLength));
4051
+ this._maxLength *= 2;
4052
+ }
4053
+ this.shapes[this._length] = shapeData;
4054
+ this._length += 1;
4055
+ };
4056
+
4057
+ ShapeCollection.prototype.releaseShapes = function () {
4058
+ var i;
4059
+ for (i = 0; i < this._length; i += 1) {
4060
+ shape_pool.release(this.shapes[i]);
4061
+ }
4062
+ this._length = 0;
4063
+ };
4064
+ function DashProperty(elem, data, renderer, container) {
4065
+ this.elem = elem;
4066
+ this.frameId = -1;
4067
+ this.dataProps = createSizedArray(data.length);
4068
+ this.renderer = renderer;
4069
+ this.k = false;
4070
+ this.dashStr = '';
4071
+ this.dashArray = createTypedArray('float32', data.length ? data.length - 1 : 0);
4072
+ this.dashoffset = createTypedArray('float32', 1);
4073
+ this.initDynamicPropertyContainer(container);
4074
+ var i, len = data.length || 0, prop;
4075
+ for (i = 0; i < len; i += 1) {
4076
+ prop = PropertyFactory.getProp(elem, data[i].v, 0, 0, this);
4077
+ this.k = prop.k || this.k;
4078
+ this.dataProps[i] = { n: data[i].n, p: prop };
4079
+ }
4080
+ if (!this.k) {
4081
+ this.getValue(true);
4082
+ }
4083
+ this._isAnimated = this.k;
4084
+ }
4085
+
4086
+ DashProperty.prototype.getValue = function (forceRender) {
4087
+ if (this.elem.globalData.frameId === this.frameId && !forceRender) {
4088
+ return;
4089
+ }
4090
+ this.frameId = this.elem.globalData.frameId;
4091
+ this.iterateDynamicProperties();
4092
+ this._mdf = this._mdf || forceRender;
4093
+ if (this._mdf) {
4094
+ var i = 0, len = this.dataProps.length;
4095
+ if (this.renderer === 'svg') {
4096
+ this.dashStr = '';
4097
+ }
4098
+ for (i = 0; i < len; i += 1) {
4099
+ if (this.dataProps[i].n != 'o') {
4100
+ if (this.renderer === 'svg') {
4101
+ this.dashStr += ' ' + this.dataProps[i].p.v;
4102
+ } else {
4103
+ this.dashArray[i] = this.dataProps[i].p.v;
4104
+ }
4105
+ } else {
4106
+ this.dashoffset[0] = this.dataProps[i].p.v;
4107
+ }
4108
+ }
4109
+ }
4110
+ };
4111
+ extendPrototype([DynamicPropertyContainer], DashProperty);
4112
+ function GradientProperty(elem, data, container) {
4113
+ this.data = data;
4114
+ this.c = createTypedArray('uint8c', data.p * 4);
4115
+ var cLength = data.k.k[0].s ? (data.k.k[0].s.length - data.p * 4) : data.k.k.length - data.p * 4;
4116
+ this.o = createTypedArray('float32', cLength);
4117
+ this._cmdf = false;
4118
+ this._omdf = false;
4119
+ this._collapsable = this.checkCollapsable();
4120
+ this._hasOpacity = cLength;
4121
+ this.initDynamicPropertyContainer(container);
4122
+ this.prop = PropertyFactory.getProp(elem, data.k, 1, null, this);
4123
+ this.k = this.prop.k;
4124
+ this.getValue(true);
4125
+ }
4126
+
4127
+ GradientProperty.prototype.comparePoints = function (values, points) {
4128
+ var i = 0, len = this.o.length / 2, diff;
4129
+ while (i < len) {
4130
+ diff = Math.abs(values[i * 4] - values[points * 4 + i * 2]);
4131
+ if (diff > 0.01) {
4132
+ return false;
4133
+ }
4134
+ i += 1;
4135
+ }
4136
+ return true;
4137
+ };
4138
+
4139
+ GradientProperty.prototype.checkCollapsable = function () {
4140
+ if (this.o.length / 2 !== this.c.length / 4) {
4141
+ return false;
4142
+ }
4143
+ if (this.data.k.k[0].s) {
4144
+ var i = 0, len = this.data.k.k.length;
4145
+ while (i < len) {
4146
+ if (!this.comparePoints(this.data.k.k[i].s, this.data.p)) {
4147
+ return false;
4148
+ }
4149
+ i += 1;
4150
+ }
4151
+ } else if (!this.comparePoints(this.data.k.k, this.data.p)) {
4152
+ return false;
4153
+ }
4154
+ return true;
4155
+ };
4156
+
4157
+ GradientProperty.prototype.getValue = function (forceRender) {
4158
+ this.prop.getValue();
4159
+ this._mdf = false;
4160
+ this._cmdf = false;
4161
+ this._omdf = false;
4162
+ if (this.prop._mdf || forceRender) {
4163
+ var i, len = this.data.p * 4;
4164
+ var mult, val;
4165
+ for (i = 0; i < len; i += 1) {
4166
+ mult = i % 4 === 0 ? 100 : 255;
4167
+ val = Math.round(this.prop.v[i] * mult);
4168
+ if (this.c[i] !== val) {
4169
+ this.c[i] = val;
4170
+ this._cmdf = !forceRender;
4171
+ }
4172
+ }
4173
+ if (this.o.length) {
4174
+ len = this.prop.v.length;
4175
+ for (i = this.data.p * 4; i < len; i += 1) {
4176
+ mult = i % 2 === 0 ? 100 : 1;
4177
+ val = i % 2 === 0 ? Math.round(this.prop.v[i] * 100) : this.prop.v[i];
4178
+ if (this.o[i - this.data.p * 4] !== val) {
4179
+ this.o[i - this.data.p * 4] = val;
4180
+ this._omdf = !forceRender;
4181
+ }
4182
+ }
4183
+ }
4184
+ this._mdf = !forceRender;
4185
+ }
4186
+ };
4187
+
4188
+ extendPrototype([DynamicPropertyContainer], GradientProperty);
4189
+ var buildShapeString = function (pathNodes, length, closed, mat) {
4190
+ if (length === 0) {
4191
+ return '';
4192
+ }
4193
+ var _o = pathNodes.o;
4194
+ var _i = pathNodes.i;
4195
+ var _v = pathNodes.v;
4196
+ var i, shapeString = " M" + mat.applyToPointStringified(_v[0][0], _v[0][1]);
4197
+ for (i = 1; i < length; i += 1) {
4198
+ shapeString += " C" + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + " " + mat.applyToPointStringified(_i[i][0], _i[i][1]) + " " + mat.applyToPointStringified(_v[i][0], _v[i][1]);
4199
+ }
4200
+ if (closed && length) {
4201
+ shapeString += " C" + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + " " + mat.applyToPointStringified(_i[0][0], _i[0][1]) + " " + mat.applyToPointStringified(_v[0][0], _v[0][1]);
4202
+ shapeString += 'z';
4203
+ }
4204
+ return shapeString;
4205
+ }
4206
+ var ImagePreloader = (function () {
4207
+
4208
+ var proxyImage = (function () {
4209
+ var canvas = createTag('canvas');
4210
+ canvas.width = 1;
4211
+ canvas.height = 1;
4212
+ var ctx = canvas.getContext('2d');
4213
+ ctx.fillStyle = 'rgba(0,0,0,0)';
4214
+ ctx.fillRect(0, 0, 1, 1);
4215
+ return canvas;
4216
+ }())
4217
+
4218
+ function imageLoaded() {
4219
+ this.loadedAssets += 1;
4220
+ if (this.loadedAssets === this.totalImages) {
4221
+ if (this.imagesLoadedCb) {
4222
+ this.imagesLoadedCb(null);
4223
+ }
4224
+ }
4225
+ }
4226
+
4227
+ function getAssetsPath(assetData, assetsPath, original_path) {
4228
+ var path = '';
4229
+ if (assetData.e) {
4230
+ path = assetData.p;
4231
+ } else if (assetsPath) {
4232
+ var imagePath = assetData.p;
4233
+ if (imagePath.indexOf('images/') !== -1) {
4234
+ imagePath = imagePath.split('/')[1];
4235
+ }
4236
+ path = assetsPath + imagePath;
4237
+ } else {
4238
+ path = original_path;
4239
+ path += assetData.u ? assetData.u : '';
4240
+ path += assetData.p;
4241
+ }
4242
+ return path;
4243
+ }
4244
+
4245
+ function createImageData(assetData) {
4246
+ var path = getAssetsPath(assetData, this.assetsPath, this.path);
4247
+ var img = createTag('img');
4248
+ img.crossOrigin = 'anonymous';
4249
+ img.addEventListener('load', this._imageLoaded.bind(this), false);
4250
+ img.addEventListener('error', function () {
4251
+ ob.img = proxyImage;
4252
+ this._imageLoaded();
4253
+ }.bind(this), false);
4254
+ img.src = path;
4255
+ var ob = {
4256
+ img: img,
4257
+ assetData: assetData
4258
+ }
4259
+ return ob;
4260
+ }
4261
+
4262
+ function loadAssets(assets, cb) {
4263
+ this.imagesLoadedCb = cb;
4264
+ var i, len = assets.length;
4265
+ for (i = 0; i < len; i += 1) {
4266
+ if (!assets[i].layers) {
4267
+ this.totalImages += 1;
4268
+ this.images.push(this._createImageData(assets[i]));
4269
+ }
4270
+ }
4271
+ }
4272
+
4273
+ function setPath(path) {
4274
+ this.path = path || '';
4275
+ }
4276
+
4277
+ function setAssetsPath(path) {
4278
+ this.assetsPath = path || '';
4279
+ }
4280
+
4281
+ function getImage(assetData) {
4282
+ var i = 0, len = this.images.length;
4283
+ while (i < len) {
4284
+ if (this.images[i].assetData === assetData) {
4285
+ return this.images[i].img;
4286
+ }
4287
+ i += 1;
4288
+ }
4289
+ }
4290
+
4291
+ function destroy() {
4292
+ this.imagesLoadedCb = null;
4293
+ this.images.length = 0;
4294
+ }
4295
+
4296
+ function loaded() {
4297
+ return this.totalImages === this.loadedAssets;
4298
+ }
4299
+
4300
+ return function ImagePreloader() {
4301
+ this.loadAssets = loadAssets;
4302
+ this.setAssetsPath = setAssetsPath;
4303
+ this.setPath = setPath;
4304
+ this.loaded = loaded;
4305
+ this.destroy = destroy;
4306
+ this.getImage = getImage;
4307
+ this._createImageData = createImageData;
4308
+ this._imageLoaded = imageLoaded;
4309
+ this.assetsPath = '';
4310
+ this.path = '';
4311
+ this.totalImages = 0;
4312
+ this.loadedAssets = 0;
4313
+ this.imagesLoadedCb = null;
4314
+ this.images = [];
4315
+ };
4316
+ }());
4317
+ var featureSupport = (function () {
4318
+ var ob = {
4319
+ maskType: true
4320
+ };
4321
+ if (/MSIE 10/i.test(navigator.userAgent) || /MSIE 9/i.test(navigator.userAgent) || /rv:11.0/i.test(navigator.userAgent) || /Edge\/\d./i.test(navigator.userAgent)) {
4322
+ ob.maskType = false;
4323
+ }
4324
+ return ob;
4325
+ }());
4326
+ var filtersFactory = (function () {
4327
+ var ob = {};
4328
+ ob.createFilter = createFilter;
4329
+ ob.createAlphaToLuminanceFilter = createAlphaToLuminanceFilter;
4330
+
4331
+ function createFilter(filId) {
4332
+ var fil = createNS('filter');
4333
+ fil.setAttribute('id', filId);
4334
+ fil.setAttribute('filterUnits', 'objectBoundingBox');
4335
+ fil.setAttribute('x', '0%');
4336
+ fil.setAttribute('y', '0%');
4337
+ fil.setAttribute('width', '100%');
4338
+ fil.setAttribute('height', '100%');
4339
+ return fil;
4340
+ }
4341
+
4342
+ function createAlphaToLuminanceFilter() {
4343
+ var feColorMatrix = createNS('feColorMatrix');
4344
+ feColorMatrix.setAttribute('type', 'matrix');
4345
+ feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');
4346
+ feColorMatrix.setAttribute('values', '0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1');
4347
+ return feColorMatrix;
4348
+ }
4349
+
4350
+ return ob;
4351
+ }());
4352
+ var assetLoader = (function () {
4353
+
4354
+ function formatResponse(xhr) {
4355
+ if (xhr.response && typeof xhr.response === 'object') {
4356
+ return xhr.response;
4357
+ } else if (xhr.response && typeof xhr.response === 'string') {
4358
+ return JSON.parse(xhr.response);
4359
+ } else if (xhr.responseText) {
4360
+ return JSON.parse(xhr.responseText);
4361
+ }
4362
+ }
4363
+
4364
+ function loadAsset(path, callback, errorCallback) {
4365
+ var response;
4366
+ var xhr = new XMLHttpRequest();
4367
+ xhr.open('GET', path, true);
4368
+ // set responseType after calling open or IE will break.
4369
+ try {
4370
+ // This crashes on Android WebView prior to KitKat
4371
+ xhr.responseType = "json";
4372
+ } catch (err) { }
4373
+ xhr.send();
4374
+ xhr.onreadystatechange = function () {
4375
+ if (xhr.readyState == 4) {
4376
+ if (xhr.status == 200) {
4377
+ response = formatResponse(xhr);
4378
+ callback(response);
4379
+ } else {
4380
+ try {
4381
+ response = formatResponse(xhr);
4382
+ callback(response);
4383
+ } catch (err) {
4384
+ if (errorCallback) {
4385
+ errorCallback(err);
4386
+ }
4387
+ }
4388
+ }
4389
+ }
4390
+ };
4391
+ }
4392
+ return {
4393
+ load: loadAsset
4394
+ }
4395
+ }())
4396
+
4397
+ function TextAnimatorProperty(textData, renderType, elem) {
4398
+ this._isFirstFrame = true;
4399
+ this._hasMaskedPath = false;
4400
+ this._frameId = -1;
4401
+ this._textData = textData;
4402
+ this._renderType = renderType;
4403
+ this._elem = elem;
4404
+ this._animatorsData = createSizedArray(this._textData.a.length);
4405
+ this._pathData = {};
4406
+ this._moreOptions = {
4407
+ alignment: {}
4408
+ };
4409
+ this.renderedLetters = [];
4410
+ this.lettersChangedFlag = false;
4411
+ this.initDynamicPropertyContainer(elem);
4412
+
4413
+ }
4414
+
4415
+ TextAnimatorProperty.prototype.searchProperties = function () {
4416
+ var i, len = this._textData.a.length, animatorProps;
4417
+ var getProp = PropertyFactory.getProp;
4418
+ for (i = 0; i < len; i += 1) {
4419
+ animatorProps = this._textData.a[i];
4420
+ this._animatorsData[i] = new TextAnimatorDataProperty(this._elem, animatorProps, this);
4421
+ }
4422
+ if (this._textData.p && 'm' in this._textData.p) {
4423
+ this._pathData = {
4424
+ f: getProp(this._elem, this._textData.p.f, 0, 0, this),
4425
+ l: getProp(this._elem, this._textData.p.l, 0, 0, this),
4426
+ r: this._textData.p.r,
4427
+ m: this._elem.maskManager.getMaskProperty(this._textData.p.m)
4428
+ };
4429
+ this._hasMaskedPath = true;
4430
+ } else {
4431
+ this._hasMaskedPath = false;
4432
+ }
4433
+ this._moreOptions.alignment = getProp(this._elem, this._textData.m.a, 1, 0, this);
4434
+ };
4435
+
4436
+ TextAnimatorProperty.prototype.getMeasures = function (documentData, lettersChangedFlag) {
4437
+ this.lettersChangedFlag = lettersChangedFlag;
4438
+ if (!this._mdf && !this._isFirstFrame && !lettersChangedFlag && (!this._hasMaskedPath || !this._pathData.m._mdf)) {
4439
+ return;
4440
+ }
4441
+ this._isFirstFrame = false;
4442
+ var alignment = this._moreOptions.alignment.v;
4443
+ var animators = this._animatorsData;
4444
+ var textData = this._textData;
4445
+ var matrixHelper = this.mHelper;
4446
+ var renderType = this._renderType;
4447
+ var renderedLettersCount = this.renderedLetters.length;
4448
+ var data = this.data;
4449
+ var xPos, yPos;
4450
+ var i, len;
4451
+ var letters = documentData.l, pathInfo, currentLength, currentPoint, segmentLength, flag, pointInd, segmentInd, prevPoint, points, segments, partialLength, totalLength, perc, tanAngle, mask;
4452
+ if (this._hasMaskedPath) {
4453
+ mask = this._pathData.m;
4454
+ if (!this._pathData.n || this._pathData._mdf) {
4455
+ var paths = mask.v;
4456
+ if (this._pathData.r) {
4457
+ paths = paths.reverse();
4458
+ }
4459
+ // TODO: release bezier data cached from previous pathInfo: this._pathData.pi
4460
+ pathInfo = {
4461
+ tLength: 0,
4462
+ segments: []
4463
+ };
4464
+ len = paths._length - 1;
4465
+ var bezierData;
4466
+ totalLength = 0;
4467
+ for (i = 0; i < len; i += 1) {
4468
+ bezierData = bez.buildBezierData(paths.v[i]
4469
+ , paths.v[i + 1]
4470
+ , [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]]
4471
+ , [paths.i[i + 1][0] - paths.v[i + 1][0], paths.i[i + 1][1] - paths.v[i + 1][1]]);
4472
+ pathInfo.tLength += bezierData.segmentLength;
4473
+ pathInfo.segments.push(bezierData);
4474
+ totalLength += bezierData.segmentLength;
4475
+ }
4476
+ i = len;
4477
+ if (mask.v.c) {
4478
+ bezierData = bez.buildBezierData(paths.v[i]
4479
+ , paths.v[0]
4480
+ , [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]]
4481
+ , [paths.i[0][0] - paths.v[0][0], paths.i[0][1] - paths.v[0][1]]);
4482
+ pathInfo.tLength += bezierData.segmentLength;
4483
+ pathInfo.segments.push(bezierData);
4484
+ totalLength += bezierData.segmentLength;
4485
+ }
4486
+ this._pathData.pi = pathInfo;
4487
+ }
4488
+ pathInfo = this._pathData.pi;
4489
+
4490
+ currentLength = this._pathData.f.v;
4491
+ segmentInd = 0;
4492
+ pointInd = 1;
4493
+ segmentLength = 0;
4494
+ flag = true;
4495
+ segments = pathInfo.segments;
4496
+ if (currentLength < 0 && mask.v.c) {
4497
+ if (pathInfo.tLength < Math.abs(currentLength)) {
4498
+ currentLength = -Math.abs(currentLength) % pathInfo.tLength;
4499
+ }
4500
+ segmentInd = segments.length - 1;
4501
+ points = segments[segmentInd].points;
4502
+ pointInd = points.length - 1;
4503
+ while (currentLength < 0) {
4504
+ currentLength += points[pointInd].partialLength;
4505
+ pointInd -= 1;
4506
+ if (pointInd < 0) {
4507
+ segmentInd -= 1;
4508
+ points = segments[segmentInd].points;
4509
+ pointInd = points.length - 1;
4510
+ }
4511
+ }
4512
+
4513
+ }
4514
+ points = segments[segmentInd].points;
4515
+ prevPoint = points[pointInd - 1];
4516
+ currentPoint = points[pointInd];
4517
+ partialLength = currentPoint.partialLength;
4518
+ }
4519
+
4520
+
4521
+ len = letters.length;
4522
+ xPos = 0;
4523
+ yPos = 0;
4524
+ var yOff = documentData.finalSize * 1.2 * 0.714;
4525
+ var firstLine = true;
4526
+ var animatorProps, animatorSelector;
4527
+ var j, jLen;
4528
+ var letterValue;
4529
+
4530
+ jLen = animators.length;
4531
+ var lastLetter;
4532
+
4533
+ var mult, ind = -1, offf, xPathPos, yPathPos;
4534
+ var initPathPos = currentLength, initSegmentInd = segmentInd, initPointInd = pointInd, currentLine = -1;
4535
+ var elemOpacity;
4536
+ var sc, sw, fc, k;
4537
+ var lineLength = 0;
4538
+ var letterSw, letterSc, letterFc, letterM = '', letterP = this.defaultPropsArray, letterO;
4539
+
4540
+ //
4541
+ if (documentData.j === 2 || documentData.j === 1) {
4542
+ var animatorJustifyOffset = 0;
4543
+ var animatorFirstCharOffset = 0;
4544
+ var justifyOffsetMult = documentData.j === 2 ? -0.5 : -1;
4545
+ var lastIndex = 0;
4546
+ var isNewLine = true;
4547
+
4548
+ for (i = 0; i < len; i += 1) {
4549
+ if (letters[i].n) {
4550
+ if (animatorJustifyOffset) {
4551
+ animatorJustifyOffset += animatorFirstCharOffset;
4552
+ }
4553
+ while (lastIndex < i) {
4554
+ letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;
4555
+ lastIndex += 1;
4556
+ }
4557
+ animatorJustifyOffset = 0;
4558
+ isNewLine = true;
4559
+ } else {
4560
+ for (j = 0; j < jLen; j += 1) {
4561
+ animatorProps = animators[j].a;
4562
+ if (animatorProps.t.propType) {
4563
+ if (isNewLine && documentData.j === 2) {
4564
+ animatorFirstCharOffset += animatorProps.t.v * justifyOffsetMult;
4565
+ }
4566
+ animatorSelector = animators[j].s;
4567
+ mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
4568
+ if (mult.length) {
4569
+ animatorJustifyOffset += animatorProps.t.v * mult[0] * justifyOffsetMult;
4570
+ } else {
4571
+ animatorJustifyOffset += animatorProps.t.v * mult * justifyOffsetMult;
4572
+ }
4573
+ }
4574
+ }
4575
+ isNewLine = false;
4576
+ }
4577
+ }
4578
+ if (animatorJustifyOffset) {
4579
+ animatorJustifyOffset += animatorFirstCharOffset;
4580
+ }
4581
+ while (lastIndex < i) {
4582
+ letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;
4583
+ lastIndex += 1;
4584
+ }
4585
+ }
4586
+ //
4587
+
4588
+ for (i = 0; i < len; i += 1) {
4589
+
4590
+ matrixHelper.reset();
4591
+ elemOpacity = 1;
4592
+ if (letters[i].n) {
4593
+ xPos = 0;
4594
+ yPos += documentData.yOffset;
4595
+ yPos += firstLine ? 1 : 0;
4596
+ currentLength = initPathPos;
4597
+ firstLine = false;
4598
+ lineLength = 0;
4599
+ if (this._hasMaskedPath) {
4600
+ segmentInd = initSegmentInd;
4601
+ pointInd = initPointInd;
4602
+ points = segments[segmentInd].points;
4603
+ prevPoint = points[pointInd - 1];
4604
+ currentPoint = points[pointInd];
4605
+ partialLength = currentPoint.partialLength;
4606
+ segmentLength = 0;
4607
+ }
4608
+ letterO = letterSw = letterFc = letterM = '';
4609
+ letterP = this.defaultPropsArray;
4610
+ } else {
4611
+ if (this._hasMaskedPath) {
4612
+ if (currentLine !== letters[i].line) {
4613
+ switch (documentData.j) {
4614
+ case 1:
4615
+ currentLength += totalLength - documentData.lineWidths[letters[i].line];
4616
+ break;
4617
+ case 2:
4618
+ currentLength += (totalLength - documentData.lineWidths[letters[i].line]) / 2;
4619
+ break;
4620
+ }
4621
+ currentLine = letters[i].line;
4622
+ }
4623
+ if (ind !== letters[i].ind) {
4624
+ if (letters[ind]) {
4625
+ currentLength += letters[ind].extra;
4626
+ }
4627
+ currentLength += letters[i].an / 2;
4628
+ ind = letters[i].ind;
4629
+ }
4630
+ currentLength += alignment[0] * letters[i].an / 200;
4631
+ var animatorOffset = 0;
4632
+ for (j = 0; j < jLen; j += 1) {
4633
+ animatorProps = animators[j].a;
4634
+ if (animatorProps.p.propType) {
4635
+ animatorSelector = animators[j].s;
4636
+ mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
4637
+ if (mult.length) {
4638
+ animatorOffset += animatorProps.p.v[0] * mult[0];
4639
+ } else {
4640
+ animatorOffset += animatorProps.p.v[0] * mult;
4641
+ }
4642
+
4643
+ }
4644
+ if (animatorProps.a.propType) {
4645
+ animatorSelector = animators[j].s;
4646
+ mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
4647
+ if (mult.length) {
4648
+ animatorOffset += animatorProps.a.v[0] * mult[0];
4649
+ } else {
4650
+ animatorOffset += animatorProps.a.v[0] * mult;
4651
+ }
4652
+
4653
+ }
4654
+ }
4655
+ flag = true;
4656
+ while (flag) {
4657
+ if (segmentLength + partialLength >= currentLength + animatorOffset || !points) {
4658
+ perc = (currentLength + animatorOffset - segmentLength) / currentPoint.partialLength;
4659
+ xPathPos = prevPoint.point[0] + (currentPoint.point[0] - prevPoint.point[0]) * perc;
4660
+ yPathPos = prevPoint.point[1] + (currentPoint.point[1] - prevPoint.point[1]) * perc;
4661
+ matrixHelper.translate(-alignment[0] * letters[i].an / 200, -(alignment[1] * yOff / 100));
4662
+ flag = false;
4663
+ } else if (points) {
4664
+ segmentLength += currentPoint.partialLength;
4665
+ pointInd += 1;
4666
+ if (pointInd >= points.length) {
4667
+ pointInd = 0;
4668
+ segmentInd += 1;
4669
+ if (!segments[segmentInd]) {
4670
+ if (mask.v.c) {
4671
+ pointInd = 0;
4672
+ segmentInd = 0;
4673
+ points = segments[segmentInd].points;
4674
+ } else {
4675
+ segmentLength -= currentPoint.partialLength;
4676
+ points = null;
4677
+ }
4678
+ } else {
4679
+ points = segments[segmentInd].points;
4680
+ }
4681
+ }
4682
+ if (points) {
4683
+ prevPoint = currentPoint;
4684
+ currentPoint = points[pointInd];
4685
+ partialLength = currentPoint.partialLength;
4686
+ }
4687
+ }
4688
+ }
4689
+ offf = letters[i].an / 2 - letters[i].add;
4690
+ matrixHelper.translate(-offf, 0, 0);
4691
+ } else {
4692
+ offf = letters[i].an / 2 - letters[i].add;
4693
+ matrixHelper.translate(-offf, 0, 0);
4694
+
4695
+ // Grouping alignment
4696
+ matrixHelper.translate(-alignment[0] * letters[i].an / 200, -alignment[1] * yOff / 100, 0);
4697
+ }
4698
+
4699
+ lineLength += letters[i].l / 2;
4700
+ for (j = 0; j < jLen; j += 1) {
4701
+ animatorProps = animators[j].a;
4702
+ if (animatorProps.t.propType) {
4703
+ animatorSelector = animators[j].s;
4704
+ mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
4705
+ //This condition is to prevent applying tracking to first character in each line. Might be better to use a boolean "isNewLine"
4706
+ if (xPos !== 0 || documentData.j !== 0) {
4707
+ if (this._hasMaskedPath) {
4708
+ if (mult.length) {
4709
+ currentLength += animatorProps.t.v * mult[0];
4710
+ } else {
4711
+ currentLength += animatorProps.t.v * mult;
4712
+ }
4713
+ } else {
4714
+ if (mult.length) {
4715
+ xPos += animatorProps.t.v * mult[0];
4716
+ } else {
4717
+ xPos += animatorProps.t.v * mult;
4718
+ }
4719
+ }
4720
+ }
4721
+ }
4722
+ }
4723
+ lineLength += letters[i].l / 2;
4724
+ if (documentData.strokeWidthAnim) {
4725
+ sw = documentData.sw || 0;
4726
+ }
4727
+ if (documentData.strokeColorAnim) {
4728
+ if (documentData.sc) {
4729
+ sc = [documentData.sc[0], documentData.sc[1], documentData.sc[2]];
4730
+ } else {
4731
+ sc = [0, 0, 0];
4732
+ }
4733
+ }
4734
+ if (documentData.fillColorAnim && documentData.fc) {
4735
+ fc = [documentData.fc[0], documentData.fc[1], documentData.fc[2]];
4736
+ }
4737
+ for (j = 0; j < jLen; j += 1) {
4738
+ animatorProps = animators[j].a;
4739
+ if (animatorProps.a.propType) {
4740
+ animatorSelector = animators[j].s;
4741
+ mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
4742
+
4743
+ if (mult.length) {
4744
+ matrixHelper.translate(-animatorProps.a.v[0] * mult[0], -animatorProps.a.v[1] * mult[1], animatorProps.a.v[2] * mult[2]);
4745
+ } else {
4746
+ matrixHelper.translate(-animatorProps.a.v[0] * mult, -animatorProps.a.v[1] * mult, animatorProps.a.v[2] * mult);
4747
+ }
4748
+ }
4749
+ }
4750
+ for (j = 0; j < jLen; j += 1) {
4751
+ animatorProps = animators[j].a;
4752
+ if (animatorProps.s.propType) {
4753
+ animatorSelector = animators[j].s;
4754
+ mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
4755
+ if (mult.length) {
4756
+ matrixHelper.scale(1 + ((animatorProps.s.v[0] - 1) * mult[0]), 1 + ((animatorProps.s.v[1] - 1) * mult[1]), 1);
4757
+ } else {
4758
+ matrixHelper.scale(1 + ((animatorProps.s.v[0] - 1) * mult), 1 + ((animatorProps.s.v[1] - 1) * mult), 1);
4759
+ }
4760
+ }
4761
+ }
4762
+ for (j = 0; j < jLen; j += 1) {
4763
+ animatorProps = animators[j].a;
4764
+ animatorSelector = animators[j].s;
4765
+ mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
4766
+ if (animatorProps.sk.propType) {
4767
+ if (mult.length) {
4768
+ matrixHelper.skewFromAxis(-animatorProps.sk.v * mult[0], animatorProps.sa.v * mult[1]);
4769
+ } else {
4770
+ matrixHelper.skewFromAxis(-animatorProps.sk.v * mult, animatorProps.sa.v * mult);
4771
+ }
4772
+ }
4773
+ if (animatorProps.r.propType) {
4774
+ if (mult.length) {
4775
+ matrixHelper.rotateZ(-animatorProps.r.v * mult[2]);
4776
+ } else {
4777
+ matrixHelper.rotateZ(-animatorProps.r.v * mult);
4778
+ }
4779
+ }
4780
+ if (animatorProps.ry.propType) {
4781
+
4782
+ if (mult.length) {
4783
+ matrixHelper.rotateY(animatorProps.ry.v * mult[1]);
4784
+ } else {
4785
+ matrixHelper.rotateY(animatorProps.ry.v * mult);
4786
+ }
4787
+ }
4788
+ if (animatorProps.rx.propType) {
4789
+ if (mult.length) {
4790
+ matrixHelper.rotateX(animatorProps.rx.v * mult[0]);
4791
+ } else {
4792
+ matrixHelper.rotateX(animatorProps.rx.v * mult);
4793
+ }
4794
+ }
4795
+ if (animatorProps.o.propType) {
4796
+ if (mult.length) {
4797
+ elemOpacity += ((animatorProps.o.v) * mult[0] - elemOpacity) * mult[0];
4798
+ } else {
4799
+ elemOpacity += ((animatorProps.o.v) * mult - elemOpacity) * mult;
4800
+ }
4801
+ }
4802
+ if (documentData.strokeWidthAnim && animatorProps.sw.propType) {
4803
+ if (mult.length) {
4804
+ sw += animatorProps.sw.v * mult[0];
4805
+ } else {
4806
+ sw += animatorProps.sw.v * mult;
4807
+ }
4808
+ }
4809
+ if (documentData.strokeColorAnim && animatorProps.sc.propType) {
4810
+ for (k = 0; k < 3; k += 1) {
4811
+ if (mult.length) {
4812
+ sc[k] = sc[k] + (animatorProps.sc.v[k] - sc[k]) * mult[0];
4813
+ } else {
4814
+ sc[k] = sc[k] + (animatorProps.sc.v[k] - sc[k]) * mult;
4815
+ }
4816
+ }
4817
+ }
4818
+ if (documentData.fillColorAnim && documentData.fc) {
4819
+ if (animatorProps.fc.propType) {
4820
+ for (k = 0; k < 3; k += 1) {
4821
+ if (mult.length) {
4822
+ fc[k] = fc[k] + (animatorProps.fc.v[k] - fc[k]) * mult[0];
4823
+ } else {
4824
+ fc[k] = fc[k] + (animatorProps.fc.v[k] - fc[k]) * mult;
4825
+ }
4826
+ }
4827
+ }
4828
+ if (animatorProps.fh.propType) {
4829
+ if (mult.length) {
4830
+ fc = addHueToRGB(fc, animatorProps.fh.v * mult[0]);
4831
+ } else {
4832
+ fc = addHueToRGB(fc, animatorProps.fh.v * mult);
4833
+ }
4834
+ }
4835
+ if (animatorProps.fs.propType) {
4836
+ if (mult.length) {
4837
+ fc = addSaturationToRGB(fc, animatorProps.fs.v * mult[0]);
4838
+ } else {
4839
+ fc = addSaturationToRGB(fc, animatorProps.fs.v * mult);
4840
+ }
4841
+ }
4842
+ if (animatorProps.fb.propType) {
4843
+ if (mult.length) {
4844
+ fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult[0]);
4845
+ } else {
4846
+ fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult);
4847
+ }
4848
+ }
4849
+ }
4850
+ }
4851
+
4852
+ for (j = 0; j < jLen; j += 1) {
4853
+ animatorProps = animators[j].a;
4854
+
4855
+ if (animatorProps.p.propType) {
4856
+ animatorSelector = animators[j].s;
4857
+ mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
4858
+ if (this._hasMaskedPath) {
4859
+ if (mult.length) {
4860
+ matrixHelper.translate(0, animatorProps.p.v[1] * mult[0], -animatorProps.p.v[2] * mult[1]);
4861
+ } else {
4862
+ matrixHelper.translate(0, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);
4863
+ }
4864
+ } else {
4865
+ if (mult.length) {
4866
+ matrixHelper.translate(animatorProps.p.v[0] * mult[0], animatorProps.p.v[1] * mult[1], -animatorProps.p.v[2] * mult[2]);
4867
+ } else {
4868
+ matrixHelper.translate(animatorProps.p.v[0] * mult, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);
4869
+
4870
+ }
4871
+ }
4872
+ }
4873
+ }
4874
+ if (documentData.strokeWidthAnim) {
4875
+ letterSw = sw < 0 ? 0 : sw;
4876
+ }
4877
+ if (documentData.strokeColorAnim) {
4878
+ letterSc = 'rgb(' + Math.round(sc[0] * 255) + ',' + Math.round(sc[1] * 255) + ',' + Math.round(sc[2] * 255) + ')';
4879
+ }
4880
+ if (documentData.fillColorAnim && documentData.fc) {
4881
+ letterFc = 'rgb(' + Math.round(fc[0] * 255) + ',' + Math.round(fc[1] * 255) + ',' + Math.round(fc[2] * 255) + ')';
4882
+ }
4883
+
4884
+ if (this._hasMaskedPath) {
4885
+ matrixHelper.translate(0, -documentData.ls);
4886
+
4887
+ matrixHelper.translate(0, alignment[1] * yOff / 100 + yPos, 0);
4888
+ if (textData.p.p) {
4889
+ tanAngle = (currentPoint.point[1] - prevPoint.point[1]) / (currentPoint.point[0] - prevPoint.point[0]);
4890
+ var rot = Math.atan(tanAngle) * 180 / Math.PI;
4891
+ if (currentPoint.point[0] < prevPoint.point[0]) {
4892
+ rot += 180;
4893
+ }
4894
+ matrixHelper.rotate(-rot * Math.PI / 180);
4895
+ }
4896
+ matrixHelper.translate(xPathPos, yPathPos, 0);
4897
+ currentLength -= alignment[0] * letters[i].an / 200;
4898
+ if (letters[i + 1] && ind !== letters[i + 1].ind) {
4899
+ currentLength += letters[i].an / 2;
4900
+ currentLength += documentData.tr / 1000 * documentData.finalSize;
4901
+ }
4902
+ } else {
4903
+
4904
+ matrixHelper.translate(xPos, yPos, 0);
4905
+
4906
+ if (documentData.ps) {
4907
+ //matrixHelper.translate(documentData.ps[0],documentData.ps[1],0);
4908
+ matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0);
4909
+ }
4910
+ switch (documentData.j) {
4911
+ case 1:
4912
+ matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]), 0, 0);
4913
+ break;
4914
+ case 2:
4915
+ matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]) / 2, 0, 0);
4916
+ break;
4917
+ }
4918
+ matrixHelper.translate(0, -documentData.ls);
4919
+ matrixHelper.translate(offf, 0, 0);
4920
+ matrixHelper.translate(alignment[0] * letters[i].an / 200, alignment[1] * yOff / 100, 0);
4921
+ xPos += letters[i].l + documentData.tr / 1000 * documentData.finalSize;
4922
+ }
4923
+ if (renderType === 'html') {
4924
+ letterM = matrixHelper.toCSS();
4925
+ } else if (renderType === 'svg') {
4926
+ letterM = matrixHelper.to2dCSS();
4927
+ } else {
4928
+ letterP = [matrixHelper.props[0], matrixHelper.props[1], matrixHelper.props[2], matrixHelper.props[3], matrixHelper.props[4], matrixHelper.props[5], matrixHelper.props[6], matrixHelper.props[7], matrixHelper.props[8], matrixHelper.props[9], matrixHelper.props[10], matrixHelper.props[11], matrixHelper.props[12], matrixHelper.props[13], matrixHelper.props[14], matrixHelper.props[15]];
4929
+ }
4930
+ letterO = elemOpacity;
4931
+ }
4932
+
4933
+ if (renderedLettersCount <= i) {
4934
+ letterValue = new LetterProps(letterO, letterSw, letterSc, letterFc, letterM, letterP);
4935
+ this.renderedLetters.push(letterValue);
4936
+ renderedLettersCount += 1;
4937
+ this.lettersChangedFlag = true;
4938
+ } else {
4939
+ letterValue = this.renderedLetters[i];
4940
+ this.lettersChangedFlag = letterValue.update(letterO, letterSw, letterSc, letterFc, letterM, letterP) || this.lettersChangedFlag;
4941
+ }
4942
+ }
4943
+ };
4944
+
4945
+ TextAnimatorProperty.prototype.getValue = function () {
4946
+ if (this._elem.globalData.frameId === this._frameId) {
4947
+ return;
4948
+ }
4949
+ this._frameId = this._elem.globalData.frameId;
4950
+ this.iterateDynamicProperties();
4951
+ };
4952
+
4953
+ TextAnimatorProperty.prototype.mHelper = new Matrix();
4954
+ TextAnimatorProperty.prototype.defaultPropsArray = [];
4955
+ extendPrototype([DynamicPropertyContainer], TextAnimatorProperty);
4956
+ function TextAnimatorDataProperty(elem, animatorProps, container) {
4957
+ var defaultData = { propType: false };
4958
+ var getProp = PropertyFactory.getProp;
4959
+ var textAnimator_animatables = animatorProps.a;
4960
+ this.a = {
4961
+ r: textAnimator_animatables.r ? getProp(elem, textAnimator_animatables.r, 0, degToRads, container) : defaultData,
4962
+ rx: textAnimator_animatables.rx ? getProp(elem, textAnimator_animatables.rx, 0, degToRads, container) : defaultData,
4963
+ ry: textAnimator_animatables.ry ? getProp(elem, textAnimator_animatables.ry, 0, degToRads, container) : defaultData,
4964
+ sk: textAnimator_animatables.sk ? getProp(elem, textAnimator_animatables.sk, 0, degToRads, container) : defaultData,
4965
+ sa: textAnimator_animatables.sa ? getProp(elem, textAnimator_animatables.sa, 0, degToRads, container) : defaultData,
4966
+ s: textAnimator_animatables.s ? getProp(elem, textAnimator_animatables.s, 1, 0.01, container) : defaultData,
4967
+ a: textAnimator_animatables.a ? getProp(elem, textAnimator_animatables.a, 1, 0, container) : defaultData,
4968
+ o: textAnimator_animatables.o ? getProp(elem, textAnimator_animatables.o, 0, 0.01, container) : defaultData,
4969
+ p: textAnimator_animatables.p ? getProp(elem, textAnimator_animatables.p, 1, 0, container) : defaultData,
4970
+ sw: textAnimator_animatables.sw ? getProp(elem, textAnimator_animatables.sw, 0, 0, container) : defaultData,
4971
+ sc: textAnimator_animatables.sc ? getProp(elem, textAnimator_animatables.sc, 1, 0, container) : defaultData,
4972
+ fc: textAnimator_animatables.fc ? getProp(elem, textAnimator_animatables.fc, 1, 0, container) : defaultData,
4973
+ fh: textAnimator_animatables.fh ? getProp(elem, textAnimator_animatables.fh, 0, 0, container) : defaultData,
4974
+ fs: textAnimator_animatables.fs ? getProp(elem, textAnimator_animatables.fs, 0, 0.01, container) : defaultData,
4975
+ fb: textAnimator_animatables.fb ? getProp(elem, textAnimator_animatables.fb, 0, 0.01, container) : defaultData,
4976
+ t: textAnimator_animatables.t ? getProp(elem, textAnimator_animatables.t, 0, 0, container) : defaultData
4977
+ };
4978
+
4979
+ this.s = TextSelectorProp.getTextSelectorProp(elem, animatorProps.s, container);
4980
+ this.s.t = animatorProps.s.t;
4981
+ }
4982
+ function LetterProps(o, sw, sc, fc, m, p) {
4983
+ this.o = o;
4984
+ this.sw = sw;
4985
+ this.sc = sc;
4986
+ this.fc = fc;
4987
+ this.m = m;
4988
+ this.p = p;
4989
+ this._mdf = {
4990
+ o: true,
4991
+ sw: !!sw,
4992
+ sc: !!sc,
4993
+ fc: !!fc,
4994
+ m: true,
4995
+ p: true
4996
+ };
4997
+ }
4998
+
4999
+ LetterProps.prototype.update = function (o, sw, sc, fc, m, p) {
5000
+ this._mdf.o = false;
5001
+ this._mdf.sw = false;
5002
+ this._mdf.sc = false;
5003
+ this._mdf.fc = false;
5004
+ this._mdf.m = false;
5005
+ this._mdf.p = false;
5006
+ var updated = false;
5007
+
5008
+ if (this.o !== o) {
5009
+ this.o = o;
5010
+ this._mdf.o = true;
5011
+ updated = true;
5012
+ }
5013
+ if (this.sw !== sw) {
5014
+ this.sw = sw;
5015
+ this._mdf.sw = true;
5016
+ updated = true;
5017
+ }
5018
+ if (this.sc !== sc) {
5019
+ this.sc = sc;
5020
+ this._mdf.sc = true;
5021
+ updated = true;
5022
+ }
5023
+ if (this.fc !== fc) {
5024
+ this.fc = fc;
5025
+ this._mdf.fc = true;
5026
+ updated = true;
5027
+ }
5028
+ if (this.m !== m) {
5029
+ this.m = m;
5030
+ this._mdf.m = true;
5031
+ updated = true;
5032
+ }
5033
+ if (p.length && (this.p[0] !== p[0] || this.p[1] !== p[1] || this.p[4] !== p[4] || this.p[5] !== p[5] || this.p[12] !== p[12] || this.p[13] !== p[13])) {
5034
+ this.p = p;
5035
+ this._mdf.p = true;
5036
+ updated = true;
5037
+ }
5038
+ return updated;
5039
+ };
5040
+ function TextProperty(elem, data) {
5041
+ this._frameId = initialDefaultFrame;
5042
+ this.pv = '';
5043
+ this.v = '';
5044
+ this.kf = false;
5045
+ this._isFirstFrame = true;
5046
+ this._mdf = false;
5047
+ this.data = data;
5048
+ this.elem = elem;
5049
+ this.comp = this.elem.comp;
5050
+ this.keysIndex = 0;
5051
+ this.canResize = false;
5052
+ this.minimumFontSize = 1;
5053
+ this.effectsSequence = [];
5054
+ this.currentData = {
5055
+ ascent: 0,
5056
+ boxWidth: this.defaultBoxWidth,
5057
+ f: '',
5058
+ fStyle: '',
5059
+ fWeight: '',
5060
+ fc: '',
5061
+ j: '',
5062
+ justifyOffset: '',
5063
+ l: [],
5064
+ lh: 0,
5065
+ lineWidths: [],
5066
+ ls: '',
5067
+ of: '',
5068
+ s: '',
5069
+ sc: '',
5070
+ sw: 0,
5071
+ t: 0,
5072
+ tr: 0,
5073
+ sz: 0,
5074
+ ps: null,
5075
+ fillColorAnim: false,
5076
+ strokeColorAnim: false,
5077
+ strokeWidthAnim: false,
5078
+ yOffset: 0,
5079
+ finalSize: 0,
5080
+ finalText: [],
5081
+ finalLineHeight: 0,
5082
+ __complete: false
5083
+
5084
+ };
5085
+ this.copyData(this.currentData, this.data.d.k[0].s);
5086
+
5087
+ if (!this.searchProperty()) {
5088
+ this.completeTextData(this.currentData);
5089
+ }
5090
+ }
5091
+
5092
+ TextProperty.prototype.defaultBoxWidth = [0, 0];
5093
+
5094
+ TextProperty.prototype.copyData = function (obj, data) {
5095
+ for (var s in data) {
5096
+ if (data.hasOwnProperty(s)) {
5097
+ obj[s] = data[s];
5098
+ }
5099
+ }
5100
+ return obj;
5101
+ }
5102
+
5103
+ TextProperty.prototype.setCurrentData = function (data) {
5104
+ if (!data.__complete) {
5105
+ this.completeTextData(data);
5106
+ }
5107
+ this.currentData = data;
5108
+ this.currentData.boxWidth = this.currentData.boxWidth || this.defaultBoxWidth;
5109
+ this._mdf = true;
5110
+ };
5111
+
5112
+ TextProperty.prototype.searchProperty = function () {
5113
+ return this.searchKeyframes();
5114
+ };
5115
+
5116
+ TextProperty.prototype.searchKeyframes = function () {
5117
+ this.kf = this.data.d.k.length > 1;
5118
+ if (this.kf) {
5119
+ this.addEffect(this.getKeyframeValue.bind(this));
5120
+ }
5121
+ return this.kf;
5122
+ }
5123
+
5124
+ TextProperty.prototype.addEffect = function (effectFunction) {
5125
+ this.effectsSequence.push(effectFunction);
5126
+ this.elem.addDynamicProperty(this);
5127
+ };
5128
+
5129
+ TextProperty.prototype.getValue = function (_finalValue) {
5130
+ if ((this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) && !_finalValue) {
5131
+ return;
5132
+ }
5133
+ this.currentData.t = this.data.d.k[this.keysIndex].s.t;
5134
+ var currentValue = this.currentData;
5135
+ var currentIndex = this.keysIndex;
5136
+ if (this.lock) {
5137
+ this.setCurrentData(this.currentData);
5138
+ return;
5139
+ }
5140
+ this.lock = true;
5141
+ this._mdf = false;
5142
+ var multipliedValue;
5143
+ var i, len = this.effectsSequence.length;
5144
+ var finalValue = _finalValue || this.data.d.k[this.keysIndex].s;
5145
+ for (i = 0; i < len; i += 1) {
5146
+ //Checking if index changed to prevent creating a new object every time the expression updates.
5147
+ if (currentIndex !== this.keysIndex) {
5148
+ finalValue = this.effectsSequence[i](finalValue, finalValue.t);
5149
+ } else {
5150
+ finalValue = this.effectsSequence[i](this.currentData, finalValue.t);
5151
+ }
5152
+ }
5153
+ if (currentValue !== finalValue) {
5154
+ this.setCurrentData(finalValue);
5155
+ }
5156
+ this.pv = this.v = this.currentData;
5157
+ this.lock = false;
5158
+ this.frameId = this.elem.globalData.frameId;
5159
+ }
5160
+
5161
+ TextProperty.prototype.getKeyframeValue = function () {
5162
+ var textKeys = this.data.d.k, textDocumentData;
5163
+ var frameNum = this.elem.comp.renderedFrame;
5164
+ var i = 0, len = textKeys.length;
5165
+ while (i <= len - 1) {
5166
+ textDocumentData = textKeys[i].s;
5167
+ if (i === len - 1 || textKeys[i + 1].t > frameNum) {
5168
+ break;
5169
+ }
5170
+ i += 1;
5171
+ }
5172
+ if (this.keysIndex !== i) {
5173
+ this.keysIndex = i;
5174
+ }
5175
+ return this.data.d.k[this.keysIndex].s;
5176
+ };
5177
+
5178
+ TextProperty.prototype.buildFinalText = function (text) {
5179
+ var combinedCharacters = FontManager.getCombinedCharacterCodes();
5180
+ var charactersArray = [];
5181
+ var i = 0, len = text.length;
5182
+ var charCode;
5183
+ while (i < len) {
5184
+ charCode = text.charCodeAt(i);
5185
+ if (combinedCharacters.indexOf(charCode) !== -1) {
5186
+ charactersArray[charactersArray.length - 1] += text.charAt(i);
5187
+ } else {
5188
+ if (charCode >= 0xD800 && charCode <= 0xDBFF) {
5189
+ charCode = text.charCodeAt(i + 1);
5190
+ if (charCode >= 0xDC00 && charCode <= 0xDFFF) {
5191
+ charactersArray.push(text.substr(i, 2));
5192
+ ++i;
5193
+ } else {
5194
+ charactersArray.push(text.charAt(i));
5195
+ }
5196
+ } else {
5197
+ charactersArray.push(text.charAt(i));
5198
+ }
5199
+ }
5200
+ i += 1;
5201
+ }
5202
+ return charactersArray;
5203
+ }
5204
+
5205
+ TextProperty.prototype.completeTextData = function (documentData) {
5206
+ documentData.__complete = true;
5207
+ var fontManager = this.elem.globalData.fontManager;
5208
+ var data = this.data;
5209
+ var letters = [];
5210
+ var i, len;
5211
+ var newLineFlag, index = 0, val;
5212
+ var anchorGrouping = data.m.g;
5213
+ var currentSize = 0, currentPos = 0, currentLine = 0, lineWidths = [];
5214
+ var lineWidth = 0;
5215
+ var maxLineWidth = 0;
5216
+ var j, jLen;
5217
+ var fontData = fontManager.getFontByName(documentData.f);
5218
+ var charData, cLength = 0;
5219
+ var styles = fontData.fStyle ? fontData.fStyle.split(' ') : [];
5220
+
5221
+ var fWeight = 'normal', fStyle = 'normal';
5222
+ len = styles.length;
5223
+ var styleName;
5224
+ for (i = 0; i < len; i += 1) {
5225
+ styleName = styles[i].toLowerCase();
5226
+ switch (styleName) {
5227
+ case 'italic':
5228
+ fStyle = 'italic';
5229
+ break;
5230
+ case 'bold':
5231
+ fWeight = '700';
5232
+ break;
5233
+ case 'black':
5234
+ fWeight = '900';
5235
+ break;
5236
+ case 'medium':
5237
+ fWeight = '500';
5238
+ break;
5239
+ case 'regular':
5240
+ case 'normal':
5241
+ fWeight = '400';
5242
+ break;
5243
+ case 'light':
5244
+ case 'thin':
5245
+ fWeight = '200';
5246
+ break;
5247
+ }
5248
+ }
5249
+ documentData.fWeight = fontData.fWeight || fWeight;
5250
+ documentData.fStyle = fStyle;
5251
+ documentData.finalSize = documentData.s;
5252
+ documentData.finalText = this.buildFinalText(documentData.t);
5253
+ len = documentData.finalText.length;
5254
+ documentData.finalLineHeight = documentData.lh;
5255
+ var trackingOffset = documentData.tr / 1000 * documentData.finalSize;
5256
+ var charCode;
5257
+ if (documentData.sz) {
5258
+ var flag = true;
5259
+ var boxWidth = documentData.sz[0];
5260
+ var boxHeight = documentData.sz[1];
5261
+ var currentHeight, finalText;
5262
+ while (flag) {
5263
+ finalText = this.buildFinalText(documentData.t);
5264
+ currentHeight = 0;
5265
+ lineWidth = 0;
5266
+ len = finalText.length;
5267
+ trackingOffset = documentData.tr / 1000 * documentData.finalSize;
5268
+ var lastSpaceIndex = -1;
5269
+ for (i = 0; i < len; i += 1) {
5270
+ charCode = finalText[i].charCodeAt(0);
5271
+ newLineFlag = false;
5272
+ if (finalText[i] === ' ') {
5273
+ lastSpaceIndex = i;
5274
+ } else if (charCode === 13 || charCode === 3) {
5275
+ lineWidth = 0;
5276
+ newLineFlag = true;
5277
+ currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2;
5278
+ }
5279
+ if (fontManager.chars) {
5280
+ charData = fontManager.getCharData(finalText[i], fontData.fStyle, fontData.fFamily);
5281
+ cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100;
5282
+ } else {
5283
+ //tCanvasHelper.font = documentData.s + 'px '+ fontData.fFamily;
5284
+ cLength = fontManager.measureText(finalText[i], documentData.f, documentData.finalSize);
5285
+ }
5286
+ if (lineWidth + cLength > boxWidth && finalText[i] !== ' ') {
5287
+ if (lastSpaceIndex === -1) {
5288
+ len += 1;
5289
+ } else {
5290
+ i = lastSpaceIndex;
5291
+ }
5292
+ currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2;
5293
+ finalText.splice(i, lastSpaceIndex === i ? 1 : 0, "\r");
5294
+ //finalText = finalText.substr(0,i) + "\r" + finalText.substr(i === lastSpaceIndex ? i + 1 : i);
5295
+ lastSpaceIndex = -1;
5296
+ lineWidth = 0;
5297
+ } else {
5298
+ lineWidth += cLength;
5299
+ lineWidth += trackingOffset;
5300
+ }
5301
+ }
5302
+ currentHeight += fontData.ascent * documentData.finalSize / 100;
5303
+ if (this.canResize && documentData.finalSize > this.minimumFontSize && boxHeight < currentHeight) {
5304
+ documentData.finalSize -= 1;
5305
+ documentData.finalLineHeight = documentData.finalSize * documentData.lh / documentData.s;
5306
+ } else {
5307
+ documentData.finalText = finalText;
5308
+ len = documentData.finalText.length;
5309
+ flag = false;
5310
+ }
5311
+ }
5312
+
5313
+ }
5314
+ lineWidth = - trackingOffset;
5315
+ cLength = 0;
5316
+ var uncollapsedSpaces = 0;
5317
+ var currentChar;
5318
+ for (i = 0; i < len; i += 1) {
5319
+ newLineFlag = false;
5320
+ currentChar = documentData.finalText[i];
5321
+ charCode = currentChar.charCodeAt(0);
5322
+ if (currentChar === ' ') {
5323
+ val = '\u00A0';
5324
+ } else if (charCode === 13 || charCode === 3) {
5325
+ uncollapsedSpaces = 0;
5326
+ lineWidths.push(lineWidth);
5327
+ maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;
5328
+ lineWidth = - 2 * trackingOffset;
5329
+ val = '';
5330
+ newLineFlag = true;
5331
+ currentLine += 1;
5332
+ } else {
5333
+ val = documentData.finalText[i];
5334
+ }
5335
+ if (fontManager.chars) {
5336
+ charData = fontManager.getCharData(currentChar, fontData.fStyle, fontManager.getFontByName(documentData.f).fFamily);
5337
+ cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100;
5338
+ } else {
5339
+ //var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize);
5340
+ //tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily;
5341
+ cLength = fontManager.measureText(val, documentData.f, documentData.finalSize);
5342
+ }
5343
+
5344
+ //
5345
+ if (currentChar === ' ') {
5346
+ uncollapsedSpaces += cLength + trackingOffset;
5347
+ } else {
5348
+ lineWidth += cLength + trackingOffset + uncollapsedSpaces;
5349
+ uncollapsedSpaces = 0;
5350
+ }
5351
+ letters.push({ l: cLength, an: cLength, add: currentSize, n: newLineFlag, anIndexes: [], val: val, line: currentLine, animatorJustifyOffset: 0 });
5352
+ if (anchorGrouping == 2) {
5353
+ currentSize += cLength;
5354
+ if (val === '' || val === '\u00A0' || i === len - 1) {
5355
+ if (val === '' || val === '\u00A0') {
5356
+ currentSize -= cLength;
5357
+ }
5358
+ while (currentPos <= i) {
5359
+ letters[currentPos].an = currentSize;
5360
+ letters[currentPos].ind = index;
5361
+ letters[currentPos].extra = cLength;
5362
+ currentPos += 1;
5363
+ }
5364
+ index += 1;
5365
+ currentSize = 0;
5366
+ }
5367
+ } else if (anchorGrouping == 3) {
5368
+ currentSize += cLength;
5369
+ if (val === '' || i === len - 1) {
5370
+ if (val === '') {
5371
+ currentSize -= cLength;
5372
+ }
5373
+ while (currentPos <= i) {
5374
+ letters[currentPos].an = currentSize;
5375
+ letters[currentPos].ind = index;
5376
+ letters[currentPos].extra = cLength;
5377
+ currentPos += 1;
5378
+ }
5379
+ currentSize = 0;
5380
+ index += 1;
5381
+ }
5382
+ } else {
5383
+ letters[index].ind = index;
5384
+ letters[index].extra = 0;
5385
+ index += 1;
5386
+ }
5387
+ }
5388
+ documentData.l = letters;
5389
+ maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;
5390
+ lineWidths.push(lineWidth);
5391
+ if (documentData.sz) {
5392
+ documentData.boxWidth = documentData.sz[0];
5393
+ documentData.justifyOffset = 0;
5394
+ } else {
5395
+ documentData.boxWidth = maxLineWidth;
5396
+ switch (documentData.j) {
5397
+ case 1:
5398
+ documentData.justifyOffset = - documentData.boxWidth;
5399
+ break;
5400
+ case 2:
5401
+ documentData.justifyOffset = - documentData.boxWidth / 2;
5402
+ break;
5403
+ default:
5404
+ documentData.justifyOffset = 0;
5405
+ }
5406
+ }
5407
+ documentData.lineWidths = lineWidths;
5408
+
5409
+ var animators = data.a, animatorData, letterData;
5410
+ jLen = animators.length;
5411
+ var based, ind, indexes = [];
5412
+ for (j = 0; j < jLen; j += 1) {
5413
+ animatorData = animators[j];
5414
+ if (animatorData.a.sc) {
5415
+ documentData.strokeColorAnim = true;
5416
+ }
5417
+ if (animatorData.a.sw) {
5418
+ documentData.strokeWidthAnim = true;
5419
+ }
5420
+ if (animatorData.a.fc || animatorData.a.fh || animatorData.a.fs || animatorData.a.fb) {
5421
+ documentData.fillColorAnim = true;
5422
+ }
5423
+ ind = 0;
5424
+ based = animatorData.s.b;
5425
+ for (i = 0; i < len; i += 1) {
5426
+ letterData = letters[i];
5427
+ letterData.anIndexes[j] = ind;
5428
+ if ((based == 1 && letterData.val !== '') || (based == 2 && letterData.val !== '' && letterData.val !== '\u00A0') || (based == 3 && (letterData.n || letterData.val == '\u00A0' || i == len - 1)) || (based == 4 && (letterData.n || i == len - 1))) {
5429
+ if (animatorData.s.rn === 1) {
5430
+ indexes.push(ind);
5431
+ }
5432
+ ind += 1;
5433
+ }
5434
+ }
5435
+ data.a[j].s.totalChars = ind;
5436
+ var currentInd = -1, newInd;
5437
+ if (animatorData.s.rn === 1) {
5438
+ for (i = 0; i < len; i += 1) {
5439
+ letterData = letters[i];
5440
+ if (currentInd != letterData.anIndexes[j]) {
5441
+ currentInd = letterData.anIndexes[j];
5442
+ newInd = indexes.splice(Math.floor(Math.random() * indexes.length), 1)[0];
5443
+ }
5444
+ letterData.anIndexes[j] = newInd;
5445
+ }
5446
+ }
5447
+ }
5448
+ documentData.yOffset = documentData.finalLineHeight || documentData.finalSize * 1.2;
5449
+ documentData.ls = documentData.ls || 0;
5450
+ documentData.ascent = fontData.ascent * documentData.finalSize / 100;
5451
+ };
5452
+
5453
+ TextProperty.prototype.updateDocumentData = function (newData, index) {
5454
+ index = index === undefined ? this.keysIndex : index;
5455
+ var dData = this.copyData({}, this.data.d.k[index].s);
5456
+ dData = this.copyData(dData, newData);
5457
+ this.data.d.k[index].s = dData;
5458
+ this.recalculate(index);
5459
+ this.elem.addDynamicProperty(this);
5460
+ };
5461
+
5462
+ TextProperty.prototype.recalculate = function (index) {
5463
+ var dData = this.data.d.k[index].s;
5464
+ dData.__complete = false;
5465
+ this.keysIndex = 0;
5466
+ this._isFirstFrame = true;
5467
+ this.getValue(dData);
5468
+ }
5469
+
5470
+ TextProperty.prototype.canResizeFont = function (_canResize) {
5471
+ this.canResize = _canResize;
5472
+ this.recalculate(this.keysIndex);
5473
+ this.elem.addDynamicProperty(this);
5474
+ };
5475
+
5476
+ TextProperty.prototype.setMinimumFontSize = function (_fontValue) {
5477
+ this.minimumFontSize = Math.floor(_fontValue) || 1;
5478
+ this.recalculate(this.keysIndex);
5479
+ this.elem.addDynamicProperty(this);
5480
+ };
5481
+
5482
+ var TextSelectorProp = (function () {
5483
+ var max = Math.max;
5484
+ var min = Math.min;
5485
+ var floor = Math.floor;
5486
+
5487
+ function TextSelectorProp(elem, data) {
5488
+ this._currentTextLength = -1;
5489
+ this.k = false;
5490
+ this.data = data;
5491
+ this.elem = elem;
5492
+ this.comp = elem.comp;
5493
+ this.finalS = 0;
5494
+ this.finalE = 0;
5495
+ this.initDynamicPropertyContainer(elem);
5496
+ this.s = PropertyFactory.getProp(elem, data.s || { k: 0 }, 0, 0, this);
5497
+ if ('e' in data) {
5498
+ this.e = PropertyFactory.getProp(elem, data.e, 0, 0, this);
5499
+ } else {
5500
+ this.e = { v: 100 };
5501
+ }
5502
+ this.o = PropertyFactory.getProp(elem, data.o || { k: 0 }, 0, 0, this);
5503
+ this.xe = PropertyFactory.getProp(elem, data.xe || { k: 0 }, 0, 0, this);
5504
+ this.ne = PropertyFactory.getProp(elem, data.ne || { k: 0 }, 0, 0, this);
5505
+ this.a = PropertyFactory.getProp(elem, data.a, 0, 0.01, this);
5506
+ if (!this.dynamicProperties.length) {
5507
+ this.getValue();
5508
+ }
5509
+ }
5510
+
5511
+ TextSelectorProp.prototype = {
5512
+ getMult: function (ind) {
5513
+ if (this._currentTextLength !== this.elem.textProperty.currentData.l.length) {
5514
+ this.getValue();
5515
+ }
5516
+ //var easer = bez.getEasingCurve(this.ne.v/100,0,1-this.xe.v/100,1);
5517
+ var x1 = 0;
5518
+ var y1 = 0;
5519
+ var x2 = 1;
5520
+ var y2 = 1;
5521
+ if (this.ne.v > 0) {
5522
+ x1 = this.ne.v / 100.0;
5523
+ }
5524
+ else {
5525
+ y1 = -this.ne.v / 100.0;
5526
+ }
5527
+ if (this.xe.v > 0) {
5528
+ x2 = 1.0 - this.xe.v / 100.0;
5529
+ }
5530
+ else {
5531
+ y2 = 1.0 + this.xe.v / 100.0;
5532
+ }
5533
+ var easer = BezierFactory.getBezierEasing(x1, y1, x2, y2).get;
5534
+
5535
+ var mult = 0;
5536
+ var s = this.finalS;
5537
+ var e = this.finalE;
5538
+ var type = this.data.sh;
5539
+ if (type === 2) {
5540
+ if (e === s) {
5541
+ mult = ind >= e ? 1 : 0;
5542
+ } else {
5543
+ mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));
5544
+ }
5545
+ mult = easer(mult);
5546
+ } else if (type === 3) {
5547
+ if (e === s) {
5548
+ mult = ind >= e ? 0 : 1;
5549
+ } else {
5550
+ mult = 1 - max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));
5551
+ }
5552
+
5553
+ mult = easer(mult);
5554
+ } else if (type === 4) {
5555
+ if (e === s) {
5556
+ mult = 0;
5557
+ } else {
5558
+ mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));
5559
+ if (mult < 0.5) {
5560
+ mult *= 2;
5561
+ } else {
5562
+ mult = 1 - 2 * (mult - 0.5);
5563
+ }
5564
+ }
5565
+ mult = easer(mult);
5566
+ } else if (type === 5) {
5567
+ if (e === s) {
5568
+ mult = 0;
5569
+ } else {
5570
+ var tot = e - s;
5571
+ /*ind += 0.5;
5572
+ mult = -4/(tot*tot)*(ind*ind)+(4/tot)*ind;*/
5573
+ ind = min(max(0, ind + 0.5 - s), e - s);
5574
+ var x = -tot / 2 + ind;
5575
+ var a = tot / 2;
5576
+ mult = Math.sqrt(1 - (x * x) / (a * a));
5577
+ }
5578
+ mult = easer(mult);
5579
+ } else if (type === 6) {
5580
+ if (e === s) {
5581
+ mult = 0;
5582
+ } else {
5583
+ ind = min(max(0, ind + 0.5 - s), e - s);
5584
+ mult = (1 + (Math.cos((Math.PI + Math.PI * 2 * (ind) / (e - s))))) / 2;
5585
+ }
5586
+ mult = easer(mult);
5587
+ } else {
5588
+ if (ind >= floor(s)) {
5589
+ if (ind - s < 0) {
5590
+ mult = max(0, min(min(e, 1) - (s - ind), 1));
5591
+ } else {
5592
+ mult = max(0, min(e - ind, 1));
5593
+ }
5594
+ }
5595
+ mult = easer(mult);
5596
+ }
5597
+ return mult * this.a.v;
5598
+ },
5599
+ getValue: function (newCharsFlag) {
5600
+ this.iterateDynamicProperties();
5601
+ this._mdf = newCharsFlag || this._mdf;
5602
+ this._currentTextLength = this.elem.textProperty.currentData.l.length || 0;
5603
+ if (newCharsFlag && this.data.r === 2) {
5604
+ this.e.v = this._currentTextLength;
5605
+ }
5606
+ var divisor = this.data.r === 2 ? 1 : 100 / this.data.totalChars;
5607
+ var o = this.o.v / divisor;
5608
+ var s = this.s.v / divisor + o;
5609
+ var e = (this.e.v / divisor) + o;
5610
+ if (s > e) {
5611
+ var _s = s;
5612
+ s = e;
5613
+ e = _s;
5614
+ }
5615
+ this.finalS = s;
5616
+ this.finalE = e;
5617
+ }
5618
+ }
5619
+ extendPrototype([DynamicPropertyContainer], TextSelectorProp);
5620
+
5621
+ function getTextSelectorProp(elem, data, arr) {
5622
+ return new TextSelectorProp(elem, data, arr);
5623
+ }
5624
+
5625
+ return {
5626
+ getTextSelectorProp: getTextSelectorProp
5627
+ };
5628
+ }());
5629
+
5630
+
5631
+ var pool_factory = (function () {
5632
+ return function (initialLength, _create, _release, _clone) {
5633
+
5634
+ var _length = 0;
5635
+ var _maxLength = initialLength;
5636
+ var pool = createSizedArray(_maxLength);
5637
+
5638
+ var ob = {
5639
+ newElement: newElement,
5640
+ release: release
5641
+ };
5642
+
5643
+ function newElement() {
5644
+ var element;
5645
+ if (_length) {
5646
+ _length -= 1;
5647
+ element = pool[_length];
5648
+ } else {
5649
+ element = _create();
5650
+ }
5651
+ return element;
5652
+ }
5653
+
5654
+ function release(element) {
5655
+ if (_length === _maxLength) {
5656
+ pool = pooling.double(pool);
5657
+ _maxLength = _maxLength * 2;
5658
+ }
5659
+ if (_release) {
5660
+ _release(element);
5661
+ }
5662
+ pool[_length] = element;
5663
+ _length += 1;
5664
+ }
5665
+
5666
+ function clone() {
5667
+ var clonedElement = newElement();
5668
+ return _clone(clonedElement);
5669
+ }
5670
+
5671
+ return ob;
5672
+ };
5673
+ }());
5674
+
5675
+ var pooling = (function () {
5676
+
5677
+ function double(arr) {
5678
+ return arr.concat(createSizedArray(arr.length));
5679
+ }
5680
+
5681
+ return {
5682
+ double: double
5683
+ };
5684
+ }());
5685
+ var point_pool = (function () {
5686
+
5687
+ function create() {
5688
+ return createTypedArray('float32', 2);
5689
+ }
5690
+ return pool_factory(8, create);
5691
+ }());
5692
+ var shape_pool = (function () {
5693
+
5694
+ function create() {
5695
+ return new ShapePath();
5696
+ }
5697
+
5698
+ function release(shapePath) {
5699
+ var len = shapePath._length, i;
5700
+ for (i = 0; i < len; i += 1) {
5701
+ point_pool.release(shapePath.v[i]);
5702
+ point_pool.release(shapePath.i[i]);
5703
+ point_pool.release(shapePath.o[i]);
5704
+ shapePath.v[i] = null;
5705
+ shapePath.i[i] = null;
5706
+ shapePath.o[i] = null;
5707
+ }
5708
+ shapePath._length = 0;
5709
+ shapePath.c = false;
5710
+ }
5711
+
5712
+ function clone(shape) {
5713
+ var cloned = factory.newElement();
5714
+ var i, len = shape._length === undefined ? shape.v.length : shape._length;
5715
+ cloned.setLength(len);
5716
+ cloned.c = shape.c;
5717
+ var pt;
5718
+
5719
+ for (i = 0; i < len; i += 1) {
5720
+ cloned.setTripleAt(shape.v[i][0], shape.v[i][1], shape.o[i][0], shape.o[i][1], shape.i[i][0], shape.i[i][1], i);
5721
+ }
5722
+ return cloned;
5723
+ }
5724
+
5725
+ var factory = pool_factory(4, create, release);
5726
+ factory.clone = clone;
5727
+
5728
+ return factory;
5729
+ }());
5730
+ var shapeCollection_pool = (function () {
5731
+ var ob = {
5732
+ newShapeCollection: newShapeCollection,
5733
+ release: release
5734
+ };
5735
+
5736
+ var _length = 0;
5737
+ var _maxLength = 4;
5738
+ var pool = createSizedArray(_maxLength);
5739
+
5740
+ function newShapeCollection() {
5741
+ var shapeCollection;
5742
+ if (_length) {
5743
+ _length -= 1;
5744
+ shapeCollection = pool[_length];
5745
+ } else {
5746
+ shapeCollection = new ShapeCollection();
5747
+ }
5748
+ return shapeCollection;
5749
+ }
5750
+
5751
+ function release(shapeCollection) {
5752
+ var i, len = shapeCollection._length;
5753
+ for (i = 0; i < len; i += 1) {
5754
+ shape_pool.release(shapeCollection.shapes[i]);
5755
+ }
5756
+ shapeCollection._length = 0;
5757
+
5758
+ if (_length === _maxLength) {
5759
+ pool = pooling.double(pool);
5760
+ _maxLength = _maxLength * 2;
5761
+ }
5762
+ pool[_length] = shapeCollection;
5763
+ _length += 1;
5764
+ }
5765
+
5766
+ return ob;
5767
+ }());
5768
+ var segments_length_pool = (function () {
5769
+
5770
+ function create() {
5771
+ return {
5772
+ lengths: [],
5773
+ totalLength: 0
5774
+ };
5775
+ }
5776
+
5777
+ function release(element) {
5778
+ var i, len = element.lengths.length;
5779
+ for (i = 0; i < len; i += 1) {
5780
+ bezier_length_pool.release(element.lengths[i]);
5781
+ }
5782
+ element.lengths.length = 0;
5783
+ }
5784
+
5785
+ return pool_factory(8, create, release);
5786
+ }());
5787
+ var bezier_length_pool = (function () {
5788
+
5789
+ function create() {
5790
+ return {
5791
+ addedLength: 0,
5792
+ percents: createTypedArray('float32', defaultCurveSegments),
5793
+ lengths: createTypedArray('float32', defaultCurveSegments),
5794
+ };
5795
+ }
5796
+ return pool_factory(8, create);
5797
+ }());
5798
+ function BaseRenderer() { }
5799
+ BaseRenderer.prototype.checkLayers = function (num) {
5800
+ var i, len = this.layers.length, data;
5801
+ this.completeLayers = true;
5802
+ for (i = len - 1; i >= 0; i--) {
5803
+ if (!this.elements[i]) {
5804
+ data = this.layers[i];
5805
+ if (data.ip - data.st <= (num - this.layers[i].st) && data.op - data.st > (num - this.layers[i].st)) {
5806
+ this.buildItem(i);
5807
+ }
5808
+ }
5809
+ this.completeLayers = this.elements[i] ? this.completeLayers : false;
5810
+ }
5811
+ this.checkPendingElements();
5812
+ };
5813
+
5814
+ BaseRenderer.prototype.createItem = function (layer) {
5815
+ switch (layer.ty) {
5816
+ case 2:
5817
+ return this.createImage(layer);
5818
+ case 0:
5819
+ return this.createComp(layer);
5820
+ case 1:
5821
+ return this.createSolid(layer);
5822
+ case 3:
5823
+ return this.createNull(layer);
5824
+ case 4:
5825
+ return this.createShape(layer);
5826
+ case 5:
5827
+ return this.createText(layer);
5828
+ case 13:
5829
+ return this.createCamera(layer);
5830
+ }
5831
+ return this.createNull(layer);
5832
+ };
5833
+
5834
+ BaseRenderer.prototype.createCamera = function () {
5835
+ throw new Error('You\'re using a 3d camera. Try the html renderer.');
5836
+ };
5837
+
5838
+ BaseRenderer.prototype.buildAllItems = function () {
5839
+ var i, len = this.layers.length;
5840
+ for (i = 0; i < len; i += 1) {
5841
+ this.buildItem(i);
5842
+ }
5843
+ this.checkPendingElements();
5844
+ };
5845
+
5846
+ BaseRenderer.prototype.includeLayers = function (newLayers) {
5847
+ this.completeLayers = false;
5848
+ var i, len = newLayers.length;
5849
+ var j, jLen = this.layers.length;
5850
+ for (i = 0; i < len; i += 1) {
5851
+ j = 0;
5852
+ while (j < jLen) {
5853
+ if (this.layers[j].id == newLayers[i].id) {
5854
+ this.layers[j] = newLayers[i];
5855
+ break;
5856
+ }
5857
+ j += 1;
5858
+ }
5859
+ }
5860
+ };
5861
+
5862
+ BaseRenderer.prototype.setProjectInterface = function (pInterface) {
5863
+ this.globalData.projectInterface = pInterface;
5864
+ };
5865
+
5866
+ BaseRenderer.prototype.initItems = function () {
5867
+ if (!this.globalData.progressiveLoad) {
5868
+ this.buildAllItems();
5869
+ }
5870
+ };
5871
+ BaseRenderer.prototype.buildElementParenting = function (element, parentName, hierarchy) {
5872
+ var elements = this.elements;
5873
+ var layers = this.layers;
5874
+ var i = 0, len = layers.length;
5875
+ while (i < len) {
5876
+ if (layers[i].ind == parentName) {
5877
+ if (!elements[i] || elements[i] === true) {
5878
+ this.buildItem(i);
5879
+ this.addPendingElement(element);
5880
+ } else {
5881
+ hierarchy.push(elements[i]);
5882
+ elements[i].setAsParent();
5883
+ if (layers[i].parent !== undefined) {
5884
+ this.buildElementParenting(element, layers[i].parent, hierarchy);
5885
+ } else {
5886
+ element.setHierarchy(hierarchy);
5887
+ }
5888
+ }
5889
+ }
5890
+ i += 1;
5891
+ }
5892
+ };
5893
+
5894
+ BaseRenderer.prototype.addPendingElement = function (element) {
5895
+ this.pendingElements.push(element);
5896
+ };
5897
+
5898
+ BaseRenderer.prototype.searchExtraCompositions = function (assets) {
5899
+ var i, len = assets.length;
5900
+ for (i = 0; i < len; i += 1) {
5901
+ if (assets[i].xt) {
5902
+ var comp = this.createComp(assets[i]);
5903
+ comp.initExpressions();
5904
+ this.globalData.projectInterface.registerComposition(comp);
5905
+ }
5906
+ }
5907
+ };
5908
+
5909
+ BaseRenderer.prototype.setupGlobalData = function (animData, fontsContainer) {
5910
+ this.globalData.fontManager = new FontManager();
5911
+ this.globalData.fontManager.addChars(animData.chars);
5912
+ this.globalData.fontManager.addFonts(animData.fonts, fontsContainer);
5913
+ this.globalData.getAssetData = this.animationItem.getAssetData.bind(this.animationItem);
5914
+ this.globalData.getAssetsPath = this.animationItem.getAssetsPath.bind(this.animationItem);
5915
+ this.globalData.imageLoader = this.animationItem.imagePreloader;
5916
+ this.globalData.frameId = 0;
5917
+ this.globalData.frameRate = animData.fr;
5918
+ this.globalData.nm = animData.nm;
5919
+ this.globalData.compSize = {
5920
+ w: animData.w,
5921
+ h: animData.h
5922
+ }
5923
+ }
5924
+ function SVGRenderer(animationItem, config) {
5925
+ this.animationItem = animationItem;
5926
+ this.layers = null;
5927
+ this.renderedFrame = -1;
5928
+ this.svgElement = createNS('svg');
5929
+ var ariaLabel = '';
5930
+ if (config && config.title) {
5931
+ var titleElement = createNS('title');
5932
+ var titleId = createElementID();
5933
+ titleElement.setAttribute('id', titleId);
5934
+ titleElement.textContent = config.title;
5935
+ this.svgElement.appendChild(titleElement);
5936
+ ariaLabel += titleId;
5937
+ }
5938
+ if (config && config.description) {
5939
+ var descElement = createNS('desc');
5940
+ var descId = createElementID();
5941
+ descElement.setAttribute('id', descId);
5942
+ descElement.textContent = config.description;
5943
+ this.svgElement.appendChild(descElement);
5944
+ ariaLabel += ' ' + descId;
5945
+ }
5946
+ if (ariaLabel) {
5947
+ this.svgElement.setAttribute('aria-labelledby', ariaLabel)
5948
+ }
5949
+ var defs = createNS('defs');
5950
+ this.svgElement.appendChild(defs);
5951
+ var maskElement = createNS('g');
5952
+ this.svgElement.appendChild(maskElement);
5953
+ this.layerElement = maskElement;
5954
+ this.renderConfig = {
5955
+ preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',
5956
+ imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
5957
+ progressiveLoad: (config && config.progressiveLoad) || false,
5958
+ hideOnTransparent: (config && config.hideOnTransparent === false) ? false : true,
5959
+ viewBoxOnly: true,
5960
+ viewBoxSize: (config && config.viewBoxSize) || false,
5961
+ className: (config && config.className) || '',
5962
+ id: (config && config.id) || '',
5963
+ focusable: config && config.focusable,
5964
+ filterSize: {
5965
+ width: config && config.filterSize && config.filterSize.width || '100%',
5966
+ height: config && config.filterSize && config.filterSize.height || '100%',
5967
+ x: config && config.filterSize && config.filterSize.x || '0%',
5968
+ y: config && config.filterSize && config.filterSize.y || '0%',
5969
+ }
5970
+ };
5971
+
5972
+ this.globalData = {
5973
+ _mdf: false,
5974
+ frameNum: -1,
5975
+ defs: defs,
5976
+ renderConfig: this.renderConfig
5977
+ };
5978
+ this.elements = [];
5979
+ this.pendingElements = [];
5980
+ this.destroyed = false;
5981
+ this.rendererType = 'svg';
5982
+
5983
+ }
5984
+
5985
+ extendPrototype([BaseRenderer], SVGRenderer);
5986
+
5987
+ SVGRenderer.prototype.createNull = function (data) {
5988
+ return new NullElement(data, this.globalData, this);
5989
+ };
5990
+
5991
+ SVGRenderer.prototype.createShape = function (data) {
5992
+ return new SVGShapeElement(data, this.globalData, this);
5993
+ };
5994
+
5995
+ SVGRenderer.prototype.createText = function (data) {
5996
+ return new SVGTextElement(data, this.globalData, this);
5997
+
5998
+ };
5999
+
6000
+ SVGRenderer.prototype.createImage = function (data) {
6001
+ return new IImageElement(data, this.globalData, this);
6002
+ };
6003
+
6004
+ SVGRenderer.prototype.createComp = function (data) {
6005
+ return new SVGCompElement(data, this.globalData, this);
6006
+
6007
+ };
6008
+
6009
+ SVGRenderer.prototype.createSolid = function (data) {
6010
+ return new ISolidElement(data, this.globalData, this);
6011
+ };
6012
+
6013
+ SVGRenderer.prototype.configAnimation = function (animData) {
6014
+ this.svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
6015
+ if (this.renderConfig.viewBoxSize) {
6016
+ this.svgElement.setAttribute('viewBox', this.renderConfig.viewBoxSize);
6017
+ } else {
6018
+ this.svgElement.setAttribute('viewBox', '0 0 ' + animData.w + ' ' + animData.h);
6019
+ }
6020
+
6021
+ if (!this.renderConfig.viewBoxOnly) {
6022
+ this.svgElement.setAttribute('width', animData.w);
6023
+ this.svgElement.setAttribute('height', animData.h);
6024
+ this.svgElement.style.width = '100%';
6025
+ this.svgElement.style.height = '100%';
6026
+ this.svgElement.style.transform = 'translate3d(0,0,0)';
6027
+ }
6028
+ if (this.renderConfig.className) {
6029
+ this.svgElement.setAttribute('class', this.renderConfig.className);
6030
+ }
6031
+ if (this.renderConfig.id) {
6032
+ this.svgElement.setAttribute('id', this.renderConfig.id);
6033
+ }
6034
+ if (this.renderConfig.focusable !== undefined) {
6035
+ this.svgElement.setAttribute('focusable', this.renderConfig.focusable);
6036
+ }
6037
+ this.svgElement.setAttribute('preserveAspectRatio', this.renderConfig.preserveAspectRatio);
6038
+ //this.layerElement.style.transform = 'translate3d(0,0,0)';
6039
+ //this.layerElement.style.transformOrigin = this.layerElement.style.mozTransformOrigin = this.layerElement.style.webkitTransformOrigin = this.layerElement.style['-webkit-transform'] = "0px 0px 0px";
6040
+ this.animationItem.wrapper.appendChild(this.svgElement);
6041
+ //Mask animation
6042
+ var defs = this.globalData.defs;
6043
+
6044
+ this.setupGlobalData(animData, defs);
6045
+ this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;
6046
+ this.data = animData;
6047
+
6048
+ var maskElement = createNS('clipPath');
6049
+ var rect = createNS('rect');
6050
+ rect.setAttribute('width', animData.w);
6051
+ rect.setAttribute('height', animData.h);
6052
+ rect.setAttribute('x', 0);
6053
+ rect.setAttribute('y', 0);
6054
+ var maskId = createElementID();
6055
+ maskElement.setAttribute('id', maskId);
6056
+ maskElement.appendChild(rect);
6057
+ this.layerElement.setAttribute("clip-path", "url(" + locationHref + "#" + maskId + ")");
6058
+
6059
+ defs.appendChild(maskElement);
6060
+ this.layers = animData.layers;
6061
+ this.elements = createSizedArray(animData.layers.length);
6062
+ };
6063
+
6064
+
6065
+ SVGRenderer.prototype.destroy = function () {
6066
+ this.animationItem.wrapper.innerHTML = '';
6067
+ this.layerElement = null;
6068
+ this.globalData.defs = null;
6069
+ var i, len = this.layers ? this.layers.length : 0;
6070
+ for (i = 0; i < len; i++) {
6071
+ if (this.elements[i]) {
6072
+ this.elements[i].destroy();
6073
+ }
6074
+ }
6075
+ this.elements.length = 0;
6076
+ this.destroyed = true;
6077
+ this.animationItem = null;
6078
+ };
6079
+
6080
+ SVGRenderer.prototype.updateContainerSize = function () {
6081
+ };
6082
+
6083
+ SVGRenderer.prototype.buildItem = function (pos) {
6084
+ var elements = this.elements;
6085
+ if (elements[pos] || this.layers[pos].ty == 99) {
6086
+ return;
6087
+ }
6088
+ elements[pos] = true;
6089
+ var element = this.createItem(this.layers[pos]);
6090
+
6091
+ elements[pos] = element;
6092
+ if (expressionsPlugin) {
6093
+ if (this.layers[pos].ty === 0) {
6094
+ this.globalData.projectInterface.registerComposition(element);
6095
+ }
6096
+ element.initExpressions();
6097
+ }
6098
+ this.appendElementInPos(element, pos);
6099
+ if (this.layers[pos].tt) {
6100
+ if (!this.elements[pos - 1] || this.elements[pos - 1] === true) {
6101
+ this.buildItem(pos - 1);
6102
+ this.addPendingElement(element);
6103
+ } else {
6104
+ element.setMatte(elements[pos - 1].layerId);
6105
+ }
6106
+ }
6107
+ };
6108
+
6109
+ SVGRenderer.prototype.checkPendingElements = function () {
6110
+ while (this.pendingElements.length) {
6111
+ var element = this.pendingElements.pop();
6112
+ element.checkParenting();
6113
+ if (element.data.tt) {
6114
+ var i = 0, len = this.elements.length;
6115
+ while (i < len) {
6116
+ if (this.elements[i] === element) {
6117
+ element.setMatte(this.elements[i - 1].layerId);
6118
+ break;
6119
+ }
6120
+ i += 1;
6121
+ }
6122
+ }
6123
+ }
6124
+ };
6125
+
6126
+ SVGRenderer.prototype.renderFrame = function (num) {
6127
+ if (this.renderedFrame === num || this.destroyed) {
6128
+ return;
6129
+ }
6130
+ if (num === null) {
6131
+ num = this.renderedFrame;
6132
+ } else {
6133
+ this.renderedFrame = num;
6134
+ }
6135
+ // console.log('-------');
6136
+ // console.log('FRAME ',num);
6137
+ this.globalData.frameNum = num;
6138
+ this.globalData.frameId += 1;
6139
+ this.globalData.projectInterface.currentFrame = num;
6140
+ this.globalData._mdf = false;
6141
+ var i, len = this.layers.length;
6142
+ if (!this.completeLayers) {
6143
+ this.checkLayers(num);
6144
+ }
6145
+ for (i = len - 1; i >= 0; i--) {
6146
+ if (this.completeLayers || this.elements[i]) {
6147
+ this.elements[i].prepareFrame(num - this.layers[i].st);
6148
+ }
6149
+ }
6150
+ if (this.globalData._mdf) {
6151
+ for (i = 0; i < len; i += 1) {
6152
+ if (this.completeLayers || this.elements[i]) {
6153
+ this.elements[i].renderFrame();
6154
+ }
6155
+ }
6156
+ }
6157
+ };
6158
+
6159
+ SVGRenderer.prototype.appendElementInPos = function (element, pos) {
6160
+ var newElement = element.getBaseElement();
6161
+ if (!newElement) {
6162
+ return;
6163
+ }
6164
+ var i = 0;
6165
+ var nextElement;
6166
+ while (i < pos) {
6167
+ if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement()) {
6168
+ nextElement = this.elements[i].getBaseElement();
6169
+ }
6170
+ i += 1;
6171
+ }
6172
+ if (nextElement) {
6173
+ this.layerElement.insertBefore(newElement, nextElement);
6174
+ } else {
6175
+ this.layerElement.appendChild(newElement);
6176
+ }
6177
+ };
6178
+
6179
+ SVGRenderer.prototype.hide = function () {
6180
+ this.layerElement.style.display = 'none';
6181
+ };
6182
+
6183
+ SVGRenderer.prototype.show = function () {
6184
+ this.layerElement.style.display = 'block';
6185
+ };
6186
+
6187
+ function CanvasRenderer(animationItem, config) {
6188
+ this.animationItem = animationItem;
6189
+ this.renderConfig = {
6190
+ clearCanvas: (config && config.clearCanvas !== undefined) ? config.clearCanvas : true,
6191
+ context: (config && config.context) || null,
6192
+ progressiveLoad: (config && config.progressiveLoad) || false,
6193
+ preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',
6194
+ imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
6195
+ className: (config && config.className) || '',
6196
+ id: (config && config.id) || '',
6197
+ };
6198
+ this.renderConfig.dpr = (config && config.dpr) || 1;
6199
+ if (this.animationItem.wrapper) {
6200
+ this.renderConfig.dpr = (config && config.dpr) || window.devicePixelRatio || 1;
6201
+ }
6202
+ this.renderedFrame = -1;
6203
+ this.globalData = {
6204
+ frameNum: -1,
6205
+ _mdf: false,
6206
+ renderConfig: this.renderConfig,
6207
+ currentGlobalAlpha: -1
6208
+ };
6209
+ this.contextData = new CVContextData();
6210
+ this.elements = [];
6211
+ this.pendingElements = [];
6212
+ this.transformMat = new Matrix();
6213
+ this.completeLayers = false;
6214
+ this.rendererType = 'canvas';
6215
+ }
6216
+ extendPrototype([BaseRenderer], CanvasRenderer);
6217
+
6218
+ CanvasRenderer.prototype.createShape = function (data) {
6219
+ return new CVShapeElement(data, this.globalData, this);
6220
+ };
6221
+
6222
+ CanvasRenderer.prototype.createText = function (data) {
6223
+ return new CVTextElement(data, this.globalData, this);
6224
+ };
6225
+
6226
+ CanvasRenderer.prototype.createImage = function (data) {
6227
+ return new CVImageElement(data, this.globalData, this);
6228
+ };
6229
+
6230
+ CanvasRenderer.prototype.createComp = function (data) {
6231
+ return new CVCompElement(data, this.globalData, this);
6232
+ };
6233
+
6234
+ CanvasRenderer.prototype.createSolid = function (data) {
6235
+ return new CVSolidElement(data, this.globalData, this);
6236
+ };
6237
+
6238
+ CanvasRenderer.prototype.createNull = SVGRenderer.prototype.createNull;
6239
+
6240
+ CanvasRenderer.prototype.ctxTransform = function (props) {
6241
+ if (props[0] === 1 && props[1] === 0 && props[4] === 0 && props[5] === 1 && props[12] === 0 && props[13] === 0) {
6242
+ return;
6243
+ }
6244
+ if (!this.renderConfig.clearCanvas) {
6245
+ this.canvasContext.transform(props[0], props[1], props[4], props[5], props[12], props[13]);
6246
+ return;
6247
+ }
6248
+ this.transformMat.cloneFromProps(props);
6249
+ var cProps = this.contextData.cTr.props;
6250
+ this.transformMat.transform(cProps[0], cProps[1], cProps[2], cProps[3], cProps[4], cProps[5], cProps[6], cProps[7], cProps[8], cProps[9], cProps[10], cProps[11], cProps[12], cProps[13], cProps[14], cProps[15]);
6251
+ //this.contextData.cTr.transform(props[0],props[1],props[2],props[3],props[4],props[5],props[6],props[7],props[8],props[9],props[10],props[11],props[12],props[13],props[14],props[15]);
6252
+ this.contextData.cTr.cloneFromProps(this.transformMat.props);
6253
+ var trProps = this.contextData.cTr.props;
6254
+ this.canvasContext.setTransform(trProps[0], trProps[1], trProps[4], trProps[5], trProps[12], trProps[13]);
6255
+ };
6256
+
6257
+ CanvasRenderer.prototype.ctxOpacity = function (op) {
6258
+ /*if(op === 1){
6259
+ return;
6260
+ }*/
6261
+ if (!this.renderConfig.clearCanvas) {
6262
+ this.canvasContext.globalAlpha *= op < 0 ? 0 : op;
6263
+ this.globalData.currentGlobalAlpha = this.contextData.cO;
6264
+ return;
6265
+ }
6266
+ this.contextData.cO *= op < 0 ? 0 : op;
6267
+ if (this.globalData.currentGlobalAlpha !== this.contextData.cO) {
6268
+ this.canvasContext.globalAlpha = this.contextData.cO;
6269
+ this.globalData.currentGlobalAlpha = this.contextData.cO;
6270
+ }
6271
+ };
6272
+
6273
+ CanvasRenderer.prototype.reset = function () {
6274
+ if (!this.renderConfig.clearCanvas) {
6275
+ this.canvasContext.restore();
6276
+ return;
6277
+ }
6278
+ this.contextData.reset();
6279
+ };
6280
+
6281
+ CanvasRenderer.prototype.save = function (actionFlag) {
6282
+ if (!this.renderConfig.clearCanvas) {
6283
+ this.canvasContext.save();
6284
+ return;
6285
+ }
6286
+ if (actionFlag) {
6287
+ this.canvasContext.save();
6288
+ }
6289
+ var props = this.contextData.cTr.props;
6290
+ if (this.contextData._length <= this.contextData.cArrPos) {
6291
+ this.contextData.duplicate();
6292
+ }
6293
+ var i, arr = this.contextData.saved[this.contextData.cArrPos];
6294
+ for (i = 0; i < 16; i += 1) {
6295
+ arr[i] = props[i];
6296
+ }
6297
+ this.contextData.savedOp[this.contextData.cArrPos] = this.contextData.cO;
6298
+ this.contextData.cArrPos += 1;
6299
+ };
6300
+
6301
+ CanvasRenderer.prototype.restore = function (actionFlag) {
6302
+ if (!this.renderConfig.clearCanvas) {
6303
+ this.canvasContext.restore();
6304
+ return;
6305
+ }
6306
+ if (actionFlag) {
6307
+ this.canvasContext.restore();
6308
+ this.globalData.blendMode = 'source-over';
6309
+ }
6310
+ this.contextData.cArrPos -= 1;
6311
+ var popped = this.contextData.saved[this.contextData.cArrPos];
6312
+ var i, arr = this.contextData.cTr.props;
6313
+ for (i = 0; i < 16; i += 1) {
6314
+ arr[i] = popped[i];
6315
+ }
6316
+ this.canvasContext.setTransform(popped[0], popped[1], popped[4], popped[5], popped[12], popped[13]);
6317
+ popped = this.contextData.savedOp[this.contextData.cArrPos];
6318
+ this.contextData.cO = popped;
6319
+ if (this.globalData.currentGlobalAlpha !== popped) {
6320
+ this.canvasContext.globalAlpha = popped;
6321
+ this.globalData.currentGlobalAlpha = popped;
6322
+ }
6323
+ };
6324
+
6325
+ CanvasRenderer.prototype.configAnimation = function (animData) {
6326
+ if (this.animationItem.wrapper) {
6327
+ this.animationItem.container = createTag('canvas');
6328
+ this.animationItem.container.style.width = '100%';
6329
+ this.animationItem.container.style.height = '100%';
6330
+ //this.animationItem.container.style.transform = 'translate3d(0,0,0)';
6331
+ //this.animationItem.container.style.webkitTransform = 'translate3d(0,0,0)';
6332
+ this.animationItem.container.style.transformOrigin = this.animationItem.container.style.mozTransformOrigin = this.animationItem.container.style.webkitTransformOrigin = this.animationItem.container.style['-webkit-transform'] = "0px 0px 0px";
6333
+ this.animationItem.wrapper.appendChild(this.animationItem.container);
6334
+ this.canvasContext = this.animationItem.container.getContext('2d');
6335
+ if (this.renderConfig.className) {
6336
+ this.animationItem.container.setAttribute('class', this.renderConfig.className);
6337
+ }
6338
+ if (this.renderConfig.id) {
6339
+ this.animationItem.container.setAttribute('id', this.renderConfig.id);
6340
+ }
6341
+ } else {
6342
+ this.canvasContext = this.renderConfig.context;
6343
+ }
6344
+ this.data = animData;
6345
+ this.layers = animData.layers;
6346
+ this.transformCanvas = {
6347
+ w: animData.w,
6348
+ h: animData.h,
6349
+ sx: 0,
6350
+ sy: 0,
6351
+ tx: 0,
6352
+ ty: 0
6353
+ };
6354
+ this.setupGlobalData(animData, document.body);
6355
+ this.globalData.canvasContext = this.canvasContext;
6356
+ this.globalData.renderer = this;
6357
+ this.globalData.isDashed = false;
6358
+ this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;
6359
+ this.globalData.transformCanvas = this.transformCanvas;
6360
+ this.elements = createSizedArray(animData.layers.length);
6361
+
6362
+ this.updateContainerSize();
6363
+ };
6364
+
6365
+ CanvasRenderer.prototype.updateContainerSize = function () {
6366
+ this.reset();
6367
+ var elementWidth, elementHeight;
6368
+ if (this.animationItem.wrapper && this.animationItem.container) {
6369
+ elementWidth = this.animationItem.wrapper.offsetWidth;
6370
+ elementHeight = this.animationItem.wrapper.offsetHeight;
6371
+ this.animationItem.container.setAttribute('width', elementWidth * this.renderConfig.dpr);
6372
+ this.animationItem.container.setAttribute('height', elementHeight * this.renderConfig.dpr);
6373
+ } else {
6374
+ elementWidth = this.canvasContext.canvas.width * this.renderConfig.dpr;
6375
+ elementHeight = this.canvasContext.canvas.height * this.renderConfig.dpr;
6376
+ }
6377
+ var elementRel, animationRel;
6378
+ if (this.renderConfig.preserveAspectRatio.indexOf('meet') !== -1 || this.renderConfig.preserveAspectRatio.indexOf('slice') !== -1) {
6379
+ var par = this.renderConfig.preserveAspectRatio.split(' ');
6380
+ var fillType = par[1] || 'meet';
6381
+ var pos = par[0] || 'xMidYMid';
6382
+ var xPos = pos.substr(0, 4);
6383
+ var yPos = pos.substr(4);
6384
+ elementRel = elementWidth / elementHeight;
6385
+ animationRel = this.transformCanvas.w / this.transformCanvas.h;
6386
+ if (animationRel > elementRel && fillType === 'meet' || animationRel < elementRel && fillType === 'slice') {
6387
+ this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);
6388
+ this.transformCanvas.sy = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);
6389
+ } else {
6390
+ this.transformCanvas.sx = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);
6391
+ this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);
6392
+ }
6393
+
6394
+ if (xPos === 'xMid' && ((animationRel < elementRel && fillType === 'meet') || (animationRel > elementRel && fillType === 'slice'))) {
6395
+ this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) / 2 * this.renderConfig.dpr;
6396
+ } else if (xPos === 'xMax' && ((animationRel < elementRel && fillType === 'meet') || (animationRel > elementRel && fillType === 'slice'))) {
6397
+ this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) * this.renderConfig.dpr;
6398
+ } else {
6399
+ this.transformCanvas.tx = 0;
6400
+ }
6401
+ if (yPos === 'YMid' && ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice'))) {
6402
+ this.transformCanvas.ty = ((elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) / 2) * this.renderConfig.dpr;
6403
+ } else if (yPos === 'YMax' && ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice'))) {
6404
+ this.transformCanvas.ty = ((elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w))) * this.renderConfig.dpr;
6405
+ } else {
6406
+ this.transformCanvas.ty = 0;
6407
+ }
6408
+
6409
+ } else if (this.renderConfig.preserveAspectRatio == 'none') {
6410
+ this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);
6411
+ this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);
6412
+ this.transformCanvas.tx = 0;
6413
+ this.transformCanvas.ty = 0;
6414
+ } else {
6415
+ this.transformCanvas.sx = this.renderConfig.dpr;
6416
+ this.transformCanvas.sy = this.renderConfig.dpr;
6417
+ this.transformCanvas.tx = 0;
6418
+ this.transformCanvas.ty = 0;
6419
+ }
6420
+ this.transformCanvas.props = [this.transformCanvas.sx, 0, 0, 0, 0, this.transformCanvas.sy, 0, 0, 0, 0, 1, 0, this.transformCanvas.tx, this.transformCanvas.ty, 0, 1];
6421
+ /*var i, len = this.elements.length;
6422
+ for(i=0;i<len;i+=1){
6423
+ if(this.elements[i] && this.elements[i].data.ty === 0){
6424
+ this.elements[i].resize(this.globalData.transformCanvas);
6425
+ }
6426
+ }*/
6427
+ this.ctxTransform(this.transformCanvas.props);
6428
+ this.canvasContext.beginPath();
6429
+ this.canvasContext.rect(0, 0, this.transformCanvas.w, this.transformCanvas.h);
6430
+ this.canvasContext.closePath();
6431
+ this.canvasContext.clip();
6432
+
6433
+ this.renderFrame(this.renderedFrame, true);
6434
+ };
6435
+
6436
+ CanvasRenderer.prototype.destroy = function () {
6437
+ if (this.renderConfig.clearCanvas) {
6438
+ this.animationItem.wrapper.innerHTML = '';
6439
+ }
6440
+ var i, len = this.layers ? this.layers.length : 0;
6441
+ for (i = len - 1; i >= 0; i -= 1) {
6442
+ if (this.elements[i]) {
6443
+ this.elements[i].destroy();
6444
+ }
6445
+ }
6446
+ this.elements.length = 0;
6447
+ this.globalData.canvasContext = null;
6448
+ this.animationItem.container = null;
6449
+ this.destroyed = true;
6450
+ };
6451
+
6452
+ CanvasRenderer.prototype.renderFrame = function (num, forceRender) {
6453
+ if ((this.renderedFrame === num && this.renderConfig.clearCanvas === true && !forceRender) || this.destroyed || num === -1) {
6454
+ return;
6455
+ }
6456
+ this.renderedFrame = num;
6457
+ this.globalData.frameNum = num - this.animationItem._isFirstFrame;
6458
+ this.globalData.frameId += 1;
6459
+ this.globalData._mdf = !this.renderConfig.clearCanvas || forceRender;
6460
+ this.globalData.projectInterface.currentFrame = num;
6461
+
6462
+ // console.log('--------');
6463
+ // console.log('NEW: ',num);
6464
+ var i, len = this.layers.length;
6465
+ if (!this.completeLayers) {
6466
+ this.checkLayers(num);
6467
+ }
6468
+
6469
+ for (i = 0; i < len; i++) {
6470
+ if (this.completeLayers || this.elements[i]) {
6471
+ this.elements[i].prepareFrame(num - this.layers[i].st);
6472
+ }
6473
+ }
6474
+ if (this.globalData._mdf) {
6475
+ if (this.renderConfig.clearCanvas === true) {
6476
+ this.canvasContext.clearRect(0, 0, this.transformCanvas.w, this.transformCanvas.h);
6477
+ } else {
6478
+ this.save();
6479
+ }
6480
+ for (i = len - 1; i >= 0; i -= 1) {
6481
+ if (this.completeLayers || this.elements[i]) {
6482
+ this.elements[i].renderFrame();
6483
+ }
6484
+ }
6485
+ if (this.renderConfig.clearCanvas !== true) {
6486
+ this.restore();
6487
+ }
6488
+ }
6489
+ };
6490
+
6491
+ CanvasRenderer.prototype.buildItem = function (pos) {
6492
+ var elements = this.elements;
6493
+ if (elements[pos] || this.layers[pos].ty == 99) {
6494
+ return;
6495
+ }
6496
+ var element = this.createItem(this.layers[pos], this, this.globalData);
6497
+ elements[pos] = element;
6498
+ element.initExpressions();
6499
+ /*if(this.layers[pos].ty === 0){
6500
+ element.resize(this.globalData.transformCanvas);
6501
+ }*/
6502
+ };
6503
+
6504
+ CanvasRenderer.prototype.checkPendingElements = function () {
6505
+ while (this.pendingElements.length) {
6506
+ var element = this.pendingElements.pop();
6507
+ element.checkParenting();
6508
+ }
6509
+ };
6510
+
6511
+ CanvasRenderer.prototype.hide = function () {
6512
+ this.animationItem.container.style.display = 'none';
6513
+ };
6514
+
6515
+ CanvasRenderer.prototype.show = function () {
6516
+ this.animationItem.container.style.display = 'block';
6517
+ };
6518
+
6519
+ function HybridRenderer(animationItem, config) {
6520
+ this.animationItem = animationItem;
6521
+ this.layers = null;
6522
+ this.renderedFrame = -1;
6523
+ this.renderConfig = {
6524
+ className: (config && config.className) || '',
6525
+ imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
6526
+ hideOnTransparent: (config && config.hideOnTransparent === false) ? false : true,
6527
+ filterSize: {
6528
+ width: config && config.filterSize && config.filterSize.width || '400%',
6529
+ height: config && config.filterSize && config.filterSize.height || '400%',
6530
+ x: config && config.filterSize && config.filterSize.x || '-100%',
6531
+ y: config && config.filterSize && config.filterSize.y || '-100%',
6532
+ }
6533
+ };
6534
+ this.globalData = {
6535
+ _mdf: false,
6536
+ frameNum: -1,
6537
+ renderConfig: this.renderConfig
6538
+ };
6539
+ this.pendingElements = [];
6540
+ this.elements = [];
6541
+ this.threeDElements = [];
6542
+ this.destroyed = false;
6543
+ this.camera = null;
6544
+ this.supports3d = true;
6545
+ this.rendererType = 'html';
6546
+
6547
+ }
6548
+
6549
+ extendPrototype([BaseRenderer], HybridRenderer);
6550
+
6551
+ HybridRenderer.prototype.buildItem = SVGRenderer.prototype.buildItem;
6552
+
6553
+ HybridRenderer.prototype.checkPendingElements = function () {
6554
+ while (this.pendingElements.length) {
6555
+ var element = this.pendingElements.pop();
6556
+ element.checkParenting();
6557
+ }
6558
+ };
6559
+
6560
+ HybridRenderer.prototype.appendElementInPos = function (element, pos) {
6561
+ var newDOMElement = element.getBaseElement();
6562
+ if (!newDOMElement) {
6563
+ return;
6564
+ }
6565
+ var layer = this.layers[pos];
6566
+ if (!layer.ddd || !this.supports3d) {
6567
+ if (this.threeDElements) {
6568
+ this.addTo3dContainer(newDOMElement, pos);
6569
+ } else {
6570
+ var i = 0;
6571
+ var nextDOMElement, nextLayer, tmpDOMElement;
6572
+ while (i < pos) {
6573
+ if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement) {
6574
+ nextLayer = this.elements[i];
6575
+ tmpDOMElement = this.layers[i].ddd ? this.getThreeDContainerByPos(i) : nextLayer.getBaseElement();
6576
+ nextDOMElement = tmpDOMElement || nextDOMElement;
6577
+ }
6578
+ i += 1;
6579
+ }
6580
+ if (nextDOMElement) {
6581
+ if (!layer.ddd || !this.supports3d) {
6582
+ this.layerElement.insertBefore(newDOMElement, nextDOMElement);
6583
+ }
6584
+ } else {
6585
+ if (!layer.ddd || !this.supports3d) {
6586
+ this.layerElement.appendChild(newDOMElement);
6587
+ }
6588
+ }
6589
+ }
6590
+
6591
+ } else {
6592
+ this.addTo3dContainer(newDOMElement, pos);
6593
+ }
6594
+ };
6595
+
6596
+ HybridRenderer.prototype.createShape = function (data) {
6597
+ if (!this.supports3d) {
6598
+ return new SVGShapeElement(data, this.globalData, this);
6599
+ }
6600
+ return new HShapeElement(data, this.globalData, this);
6601
+ };
6602
+
6603
+ HybridRenderer.prototype.createText = function (data) {
6604
+ if (!this.supports3d) {
6605
+ return new SVGTextElement(data, this.globalData, this);
6606
+ }
6607
+ return new HTextElement(data, this.globalData, this);
6608
+ };
6609
+
6610
+ HybridRenderer.prototype.createCamera = function (data) {
6611
+ this.camera = new HCameraElement(data, this.globalData, this);
6612
+ return this.camera;
6613
+ };
6614
+
6615
+ HybridRenderer.prototype.createImage = function (data) {
6616
+ if (!this.supports3d) {
6617
+ return new IImageElement(data, this.globalData, this);
6618
+ }
6619
+ return new HImageElement(data, this.globalData, this);
6620
+ };
6621
+
6622
+ HybridRenderer.prototype.createComp = function (data) {
6623
+ if (!this.supports3d) {
6624
+ return new SVGCompElement(data, this.globalData, this);
6625
+ }
6626
+ return new HCompElement(data, this.globalData, this);
6627
+
6628
+ };
6629
+
6630
+ HybridRenderer.prototype.createSolid = function (data) {
6631
+ if (!this.supports3d) {
6632
+ return new ISolidElement(data, this.globalData, this);
6633
+ }
6634
+ return new HSolidElement(data, this.globalData, this);
6635
+ };
6636
+
6637
+ HybridRenderer.prototype.createNull = SVGRenderer.prototype.createNull;
6638
+
6639
+ HybridRenderer.prototype.getThreeDContainerByPos = function (pos) {
6640
+ var i = 0, len = this.threeDElements.length;
6641
+ while (i < len) {
6642
+ if (this.threeDElements[i].startPos <= pos && this.threeDElements[i].endPos >= pos) {
6643
+ return this.threeDElements[i].perspectiveElem;
6644
+ }
6645
+ i += 1;
6646
+ }
6647
+ };
6648
+
6649
+ HybridRenderer.prototype.createThreeDContainer = function (pos, type) {
6650
+ var perspectiveElem = createTag('div');
6651
+ styleDiv(perspectiveElem);
6652
+ var container = createTag('div');
6653
+ styleDiv(container);
6654
+ if (type === '3d') {
6655
+ perspectiveElem.style.width = this.globalData.compSize.w + 'px';
6656
+ perspectiveElem.style.height = this.globalData.compSize.h + 'px';
6657
+ perspectiveElem.style.transformOrigin = perspectiveElem.style.mozTransformOrigin = perspectiveElem.style.webkitTransformOrigin = "50% 50%";
6658
+ container.style.transform = container.style.webkitTransform = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';
6659
+ }
6660
+
6661
+ perspectiveElem.appendChild(container);
6662
+ //this.resizerElem.appendChild(perspectiveElem);
6663
+ var threeDContainerData = {
6664
+ container: container,
6665
+ perspectiveElem: perspectiveElem,
6666
+ startPos: pos,
6667
+ endPos: pos,
6668
+ type: type
6669
+ };
6670
+ this.threeDElements.push(threeDContainerData);
6671
+ return threeDContainerData;
6672
+ };
6673
+
6674
+ HybridRenderer.prototype.build3dContainers = function () {
6675
+ var i, len = this.layers.length;
6676
+ var lastThreeDContainerData;
6677
+ var currentContainer = '';
6678
+ for (i = 0; i < len; i += 1) {
6679
+ if (this.layers[i].ddd && this.layers[i].ty !== 3) {
6680
+ if (currentContainer !== '3d') {
6681
+ currentContainer = '3d';
6682
+ lastThreeDContainerData = this.createThreeDContainer(i, '3d');
6683
+ }
6684
+ lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i);
6685
+ } else {
6686
+ if (currentContainer !== '2d') {
6687
+ currentContainer = '2d';
6688
+ lastThreeDContainerData = this.createThreeDContainer(i, '2d');
6689
+ }
6690
+ lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i);
6691
+ }
6692
+ }
6693
+ len = this.threeDElements.length;
6694
+ for (i = len - 1; i >= 0; i--) {
6695
+ this.resizerElem.appendChild(this.threeDElements[i].perspectiveElem);
6696
+ }
6697
+ };
6698
+
6699
+ HybridRenderer.prototype.addTo3dContainer = function (elem, pos) {
6700
+ var i = 0, len = this.threeDElements.length;
6701
+ while (i < len) {
6702
+ if (pos <= this.threeDElements[i].endPos) {
6703
+ var j = this.threeDElements[i].startPos;
6704
+ var nextElement;
6705
+ while (j < pos) {
6706
+ if (this.elements[j] && this.elements[j].getBaseElement) {
6707
+ nextElement = this.elements[j].getBaseElement();
6708
+ }
6709
+ j += 1;
6710
+ }
6711
+ if (nextElement) {
6712
+ this.threeDElements[i].container.insertBefore(elem, nextElement);
6713
+ } else {
6714
+ this.threeDElements[i].container.appendChild(elem);
6715
+ }
6716
+ break;
6717
+ }
6718
+ i += 1;
6719
+ }
6720
+ };
6721
+
6722
+ HybridRenderer.prototype.configAnimation = function (animData) {
6723
+ var resizerElem = createTag('div');
6724
+ var wrapper = this.animationItem.wrapper;
6725
+ resizerElem.style.width = animData.w + 'px';
6726
+ resizerElem.style.height = animData.h + 'px';
6727
+ this.resizerElem = resizerElem;
6728
+ styleDiv(resizerElem);
6729
+ resizerElem.style.transformStyle = resizerElem.style.webkitTransformStyle = resizerElem.style.mozTransformStyle = "flat";
6730
+ if (this.renderConfig.className) {
6731
+ resizerElem.setAttribute('class', this.renderConfig.className);
6732
+ }
6733
+ wrapper.appendChild(resizerElem);
6734
+
6735
+ resizerElem.style.overflow = 'hidden';
6736
+ var svg = createNS('svg');
6737
+ svg.setAttribute('width', '1');
6738
+ svg.setAttribute('height', '1');
6739
+ styleDiv(svg);
6740
+ this.resizerElem.appendChild(svg);
6741
+ var defs = createNS('defs');
6742
+ svg.appendChild(defs);
6743
+ this.data = animData;
6744
+ //Mask animation
6745
+ this.setupGlobalData(animData, svg);
6746
+ this.globalData.defs = defs;
6747
+ this.layers = animData.layers;
6748
+ this.layerElement = this.resizerElem;
6749
+ this.build3dContainers();
6750
+ this.updateContainerSize();
6751
+ };
6752
+
6753
+ HybridRenderer.prototype.destroy = function () {
6754
+ this.animationItem.wrapper.innerHTML = '';
6755
+ this.animationItem.container = null;
6756
+ this.globalData.defs = null;
6757
+ var i, len = this.layers ? this.layers.length : 0;
6758
+ for (i = 0; i < len; i++) {
6759
+ this.elements[i].destroy();
6760
+ }
6761
+ this.elements.length = 0;
6762
+ this.destroyed = true;
6763
+ this.animationItem = null;
6764
+ };
6765
+
6766
+ HybridRenderer.prototype.updateContainerSize = function () {
6767
+ var elementWidth = this.animationItem.wrapper.offsetWidth;
6768
+ var elementHeight = this.animationItem.wrapper.offsetHeight;
6769
+ var elementRel = elementWidth / elementHeight;
6770
+ var animationRel = this.globalData.compSize.w / this.globalData.compSize.h;
6771
+ var sx, sy, tx, ty;
6772
+ if (animationRel > elementRel) {
6773
+ sx = elementWidth / (this.globalData.compSize.w);
6774
+ sy = elementWidth / (this.globalData.compSize.w);
6775
+ tx = 0;
6776
+ ty = ((elementHeight - this.globalData.compSize.h * (elementWidth / this.globalData.compSize.w)) / 2);
6777
+ } else {
6778
+ sx = elementHeight / (this.globalData.compSize.h);
6779
+ sy = elementHeight / (this.globalData.compSize.h);
6780
+ tx = (elementWidth - this.globalData.compSize.w * (elementHeight / this.globalData.compSize.h)) / 2;
6781
+ ty = 0;
6782
+ }
6783
+ this.resizerElem.style.transform = this.resizerElem.style.webkitTransform = 'matrix3d(' + sx + ',0,0,0,0,' + sy + ',0,0,0,0,1,0,' + tx + ',' + ty + ',0,1)';
6784
+ };
6785
+
6786
+ HybridRenderer.prototype.renderFrame = SVGRenderer.prototype.renderFrame;
6787
+
6788
+ HybridRenderer.prototype.hide = function () {
6789
+ this.resizerElem.style.display = 'none';
6790
+ };
6791
+
6792
+ HybridRenderer.prototype.show = function () {
6793
+ this.resizerElem.style.display = 'block';
6794
+ };
6795
+
6796
+ HybridRenderer.prototype.initItems = function () {
6797
+ this.buildAllItems();
6798
+ if (this.camera) {
6799
+ this.camera.setup();
6800
+ } else {
6801
+ var cWidth = this.globalData.compSize.w;
6802
+ var cHeight = this.globalData.compSize.h;
6803
+ var i, len = this.threeDElements.length;
6804
+ for (i = 0; i < len; i += 1) {
6805
+ this.threeDElements[i].perspectiveElem.style.perspective = this.threeDElements[i].perspectiveElem.style.webkitPerspective = Math.sqrt(Math.pow(cWidth, 2) + Math.pow(cHeight, 2)) + 'px';
6806
+ }
6807
+ }
6808
+ };
6809
+
6810
+ HybridRenderer.prototype.searchExtraCompositions = function (assets) {
6811
+ var i, len = assets.length;
6812
+ var floatingContainer = createTag('div');
6813
+ for (i = 0; i < len; i += 1) {
6814
+ if (assets[i].xt) {
6815
+ var comp = this.createComp(assets[i], floatingContainer, this.globalData.comp, null);
6816
+ comp.initExpressions();
6817
+ this.globalData.projectInterface.registerComposition(comp);
6818
+ }
6819
+ }
6820
+ };
6821
+
6822
+ function MaskElement(data, element, globalData) {
6823
+ this.data = data;
6824
+ this.element = element;
6825
+ this.globalData = globalData;
6826
+ this.storedData = [];
6827
+ this.masksProperties = this.data.masksProperties || [];
6828
+ this.maskElement = null;
6829
+ var defs = this.globalData.defs;
6830
+ var i, len = this.masksProperties ? this.masksProperties.length : 0;
6831
+ this.viewData = createSizedArray(len);
6832
+ this.solidPath = '';
6833
+
6834
+
6835
+ var path, properties = this.masksProperties;
6836
+ var count = 0;
6837
+ var currentMasks = [];
6838
+ var j, jLen;
6839
+ var layerId = createElementID();
6840
+ var rect, expansor, feMorph, x;
6841
+ var maskType = 'clipPath', maskRef = 'clip-path';
6842
+ for (i = 0; i < len; i++) {
6843
+ if ((properties[i].mode !== 'a' && properties[i].mode !== 'n') || properties[i].inv || properties[i].o.k !== 100 || properties[i].o.x) {
6844
+ maskType = 'mask';
6845
+ maskRef = 'mask';
6846
+ }
6847
+
6848
+ if ((properties[i].mode == 's' || properties[i].mode == 'i') && count === 0) {
6849
+ rect = createNS('rect');
6850
+ rect.setAttribute('fill', '#ffffff');
6851
+ rect.setAttribute('width', this.element.comp.data.w || 0);
6852
+ rect.setAttribute('height', this.element.comp.data.h || 0);
6853
+ currentMasks.push(rect);
6854
+ } else {
6855
+ rect = null;
6856
+ }
6857
+
6858
+ path = createNS('path');
6859
+ if (properties[i].mode == 'n') {
6860
+ // TODO move this to a factory or to a constructor
6861
+ this.viewData[i] = {
6862
+ op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),
6863
+ prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),
6864
+ elem: path,
6865
+ lastPath: ''
6866
+ };
6867
+ defs.appendChild(path);
6868
+ continue;
6869
+ }
6870
+ count += 1;
6871
+
6872
+ path.setAttribute('fill', properties[i].mode === 's' ? '#000000' : '#ffffff');
6873
+ path.setAttribute('clip-rule', 'nonzero');
6874
+ var filterID;
6875
+
6876
+ if (properties[i].x.k !== 0) {
6877
+ maskType = 'mask';
6878
+ maskRef = 'mask';
6879
+ x = PropertyFactory.getProp(this.element, properties[i].x, 0, null, this.element);
6880
+ filterID = createElementID();
6881
+ expansor = createNS('filter');
6882
+ expansor.setAttribute('id', filterID);
6883
+ feMorph = createNS('feMorphology');
6884
+ feMorph.setAttribute('operator', 'erode');
6885
+ feMorph.setAttribute('in', 'SourceGraphic');
6886
+ feMorph.setAttribute('radius', '0');
6887
+ expansor.appendChild(feMorph);
6888
+ defs.appendChild(expansor);
6889
+ path.setAttribute('stroke', properties[i].mode === 's' ? '#000000' : '#ffffff');
6890
+ } else {
6891
+ feMorph = null;
6892
+ x = null;
6893
+ }
6894
+
6895
+ // TODO move this to a factory or to a constructor
6896
+ this.storedData[i] = {
6897
+ elem: path,
6898
+ x: x,
6899
+ expan: feMorph,
6900
+ lastPath: '',
6901
+ lastOperator: '',
6902
+ filterId: filterID,
6903
+ lastRadius: 0
6904
+ };
6905
+ if (properties[i].mode == 'i') {
6906
+ jLen = currentMasks.length;
6907
+ var g = createNS('g');
6908
+ for (j = 0; j < jLen; j += 1) {
6909
+ g.appendChild(currentMasks[j]);
6910
+ }
6911
+ var mask = createNS('mask');
6912
+ mask.setAttribute('mask-type', 'alpha');
6913
+ mask.setAttribute('id', layerId + '_' + count);
6914
+ mask.appendChild(path);
6915
+ defs.appendChild(mask);
6916
+ g.setAttribute('mask', 'url(' + locationHref + '#' + layerId + '_' + count + ')');
6917
+
6918
+ currentMasks.length = 0;
6919
+ currentMasks.push(g);
6920
+ } else {
6921
+ currentMasks.push(path);
6922
+ }
6923
+ if (properties[i].inv && !this.solidPath) {
6924
+ this.solidPath = this.createLayerSolidPath();
6925
+ }
6926
+ // TODO move this to a factory or to a constructor
6927
+ this.viewData[i] = {
6928
+ elem: path,
6929
+ lastPath: '',
6930
+ op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),
6931
+ prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),
6932
+ invRect: rect
6933
+ };
6934
+ if (!this.viewData[i].prop.k) {
6935
+ this.drawPath(properties[i], this.viewData[i].prop.v, this.viewData[i]);
6936
+ }
6937
+ }
6938
+
6939
+ this.maskElement = createNS(maskType);
6940
+
6941
+ len = currentMasks.length;
6942
+ for (i = 0; i < len; i += 1) {
6943
+ this.maskElement.appendChild(currentMasks[i]);
6944
+ }
6945
+
6946
+ if (count > 0) {
6947
+ this.maskElement.setAttribute('id', layerId);
6948
+ this.element.maskedElement.setAttribute(maskRef, "url(" + locationHref + "#" + layerId + ")");
6949
+ defs.appendChild(this.maskElement);
6950
+ }
6951
+ if (this.viewData.length) {
6952
+ this.element.addRenderableComponent(this);
6953
+ }
6954
+
6955
+ }
6956
+
6957
+ MaskElement.prototype.getMaskProperty = function (pos) {
6958
+ return this.viewData[pos].prop;
6959
+ };
6960
+
6961
+ MaskElement.prototype.renderFrame = function (isFirstFrame) {
6962
+ var finalMat = this.element.finalTransform.mat;
6963
+ var i, len = this.masksProperties.length;
6964
+ for (i = 0; i < len; i++) {
6965
+ if (this.viewData[i].prop._mdf || isFirstFrame) {
6966
+ this.drawPath(this.masksProperties[i], this.viewData[i].prop.v, this.viewData[i]);
6967
+ }
6968
+ if (this.viewData[i].op._mdf || isFirstFrame) {
6969
+ this.viewData[i].elem.setAttribute('fill-opacity', this.viewData[i].op.v);
6970
+ }
6971
+ if (this.masksProperties[i].mode !== 'n') {
6972
+ if (this.viewData[i].invRect && (this.element.finalTransform.mProp._mdf || isFirstFrame)) {
6973
+ this.viewData[i].invRect.setAttribute('transform', finalMat.getInverseMatrix().to2dCSS())
6974
+ }
6975
+ if (this.storedData[i].x && (this.storedData[i].x._mdf || isFirstFrame)) {
6976
+ var feMorph = this.storedData[i].expan;
6977
+ if (this.storedData[i].x.v < 0) {
6978
+ if (this.storedData[i].lastOperator !== 'erode') {
6979
+ this.storedData[i].lastOperator = 'erode';
6980
+ this.storedData[i].elem.setAttribute('filter', 'url(' + locationHref + '#' + this.storedData[i].filterId + ')');
6981
+ }
6982
+ feMorph.setAttribute('radius', -this.storedData[i].x.v);
6983
+ } else {
6984
+ if (this.storedData[i].lastOperator !== 'dilate') {
6985
+ this.storedData[i].lastOperator = 'dilate';
6986
+ this.storedData[i].elem.setAttribute('filter', null);
6987
+ }
6988
+ this.storedData[i].elem.setAttribute('stroke-width', this.storedData[i].x.v * 2);
6989
+
6990
+ }
6991
+ }
6992
+ }
6993
+ }
6994
+ };
6995
+
6996
+ MaskElement.prototype.getMaskelement = function () {
6997
+ return this.maskElement;
6998
+ };
6999
+
7000
+ MaskElement.prototype.createLayerSolidPath = function () {
7001
+ var path = 'M0,0 ';
7002
+ path += ' h' + this.globalData.compSize.w;
7003
+ path += ' v' + this.globalData.compSize.h;
7004
+ path += ' h-' + this.globalData.compSize.w;
7005
+ path += ' v-' + this.globalData.compSize.h + ' ';
7006
+ return path;
7007
+ };
7008
+
7009
+ MaskElement.prototype.drawPath = function (pathData, pathNodes, viewData) {
7010
+ var pathString = " M" + pathNodes.v[0][0] + ',' + pathNodes.v[0][1];
7011
+ var i, len;
7012
+ len = pathNodes._length;
7013
+ for (i = 1; i < len; i += 1) {
7014
+ //pathString += " C"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + " "+pathNodes.i[i][0]+','+pathNodes.i[i][1] + " "+pathNodes.v[i][0]+','+pathNodes.v[i][1];
7015
+ pathString += " C" + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + " " + pathNodes.i[i][0] + ',' + pathNodes.i[i][1] + " " + pathNodes.v[i][0] + ',' + pathNodes.v[i][1];
7016
+ }
7017
+ //pathString += " C"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + " "+pathNodes.i[0][0]+','+pathNodes.i[0][1] + " "+pathNodes.v[0][0]+','+pathNodes.v[0][1];
7018
+ if (pathNodes.c && len > 1) {
7019
+ pathString += " C" + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + " " + pathNodes.i[0][0] + ',' + pathNodes.i[0][1] + " " + pathNodes.v[0][0] + ',' + pathNodes.v[0][1];
7020
+ }
7021
+ //pathNodes.__renderedString = pathString;
7022
+
7023
+ if (viewData.lastPath !== pathString) {
7024
+ var pathShapeValue = '';
7025
+ if (viewData.elem) {
7026
+ if (pathNodes.c) {
7027
+ pathShapeValue = pathData.inv ? this.solidPath + pathString : pathString;
7028
+ }
7029
+ viewData.elem.setAttribute('d', pathShapeValue);
7030
+ }
7031
+ viewData.lastPath = pathString;
7032
+ }
7033
+ };
7034
+
7035
+ MaskElement.prototype.destroy = function () {
7036
+ this.element = null;
7037
+ this.globalData = null;
7038
+ this.maskElement = null;
7039
+ this.data = null;
7040
+ this.masksProperties = null;
7041
+ };
7042
+
7043
+ /**
7044
+ * @file
7045
+ * Handles AE's layer parenting property.
7046
+ *
7047
+ */
7048
+
7049
+ function HierarchyElement() { }
7050
+
7051
+ HierarchyElement.prototype = {
7052
+ /**
7053
+ * @function
7054
+ * Initializes hierarchy properties
7055
+ *
7056
+ */
7057
+ initHierarchy: function () {
7058
+ //element's parent list
7059
+ this.hierarchy = [];
7060
+ //if element is parent of another layer _isParent will be true
7061
+ this._isParent = false;
7062
+ this.checkParenting();
7063
+ },
7064
+ /**
7065
+ * @function
7066
+ * Sets layer's hierarchy.
7067
+ * @param {array} hierarch
7068
+ * layer's parent list
7069
+ *
7070
+ */
7071
+ setHierarchy: function (hierarchy) {
7072
+ this.hierarchy = hierarchy;
7073
+ },
7074
+ /**
7075
+ * @function
7076
+ * Sets layer as parent.
7077
+ *
7078
+ */
7079
+ setAsParent: function () {
7080
+ this._isParent = true;
7081
+ },
7082
+ /**
7083
+ * @function
7084
+ * Searches layer's parenting chain
7085
+ *
7086
+ */
7087
+ checkParenting: function () {
7088
+ if (this.data.parent !== undefined) {
7089
+ this.comp.buildElementParenting(this, this.data.parent, []);
7090
+ }
7091
+ }
7092
+ };
7093
+ /**
7094
+ * @file
7095
+ * Handles element's layer frame update.
7096
+ * Checks layer in point and out point
7097
+ *
7098
+ */
7099
+
7100
+ function FrameElement() { }
7101
+
7102
+ FrameElement.prototype = {
7103
+ /**
7104
+ * @function
7105
+ * Initializes frame related properties.
7106
+ *
7107
+ */
7108
+ initFrame: function () {
7109
+ //set to true when inpoint is rendered
7110
+ this._isFirstFrame = false;
7111
+ //list of animated properties
7112
+ this.dynamicProperties = [];
7113
+ // If layer has been modified in current tick this will be true
7114
+ this._mdf = false;
7115
+ },
7116
+ /**
7117
+ * @function
7118
+ * Calculates all dynamic values
7119
+ *
7120
+ * @param {number} num
7121
+ * current frame number in Layer's time
7122
+ * @param {boolean} isVisible
7123
+ * if layers is currently in range
7124
+ *
7125
+ */
7126
+ prepareProperties: function (num, isVisible) {
7127
+ var i, len = this.dynamicProperties.length;
7128
+ for (i = 0; i < len; i += 1) {
7129
+ if (isVisible || (this._isParent && this.dynamicProperties[i].propType === 'transform')) {
7130
+ this.dynamicProperties[i].getValue();
7131
+ if (this.dynamicProperties[i]._mdf) {
7132
+ this.globalData._mdf = true;
7133
+ this._mdf = true;
7134
+ }
7135
+ }
7136
+ }
7137
+ },
7138
+ addDynamicProperty: function (prop) {
7139
+ if (this.dynamicProperties.indexOf(prop) === -1) {
7140
+ this.dynamicProperties.push(prop);
7141
+ }
7142
+ }
7143
+ };
7144
+ function TransformElement() { }
7145
+
7146
+ TransformElement.prototype = {
7147
+ initTransform: function () {
7148
+ this.finalTransform = {
7149
+ mProp: this.data.ks ? TransformPropertyFactory.getTransformProperty(this, this.data.ks, this) : { o: 0 },
7150
+ _matMdf: false,
7151
+ _opMdf: false,
7152
+ mat: new Matrix()
7153
+ };
7154
+ if (this.data.ao) {
7155
+ this.finalTransform.mProp.autoOriented = true;
7156
+ }
7157
+
7158
+ //TODO: check TYPE 11: Guided elements
7159
+ if (this.data.ty !== 11) {
7160
+ //this.createElements();
7161
+ }
7162
+ },
7163
+ renderTransform: function () {
7164
+
7165
+ this.finalTransform._opMdf = this.finalTransform.mProp.o._mdf || this._isFirstFrame;
7166
+ this.finalTransform._matMdf = this.finalTransform.mProp._mdf || this._isFirstFrame;
7167
+
7168
+ if (this.hierarchy) {
7169
+ var mat;
7170
+ var finalMat = this.finalTransform.mat;
7171
+ var i = 0, len = this.hierarchy.length;
7172
+ //Checking if any of the transformation matrices in the hierarchy chain has changed.
7173
+ if (!this.finalTransform._matMdf) {
7174
+ while (i < len) {
7175
+ if (this.hierarchy[i].finalTransform.mProp._mdf) {
7176
+ this.finalTransform._matMdf = true;
7177
+ break;
7178
+ }
7179
+ i += 1;
7180
+ }
7181
+ }
7182
+
7183
+ if (this.finalTransform._matMdf) {
7184
+ mat = this.finalTransform.mProp.v.props;
7185
+ finalMat.cloneFromProps(mat);
7186
+ for (i = 0; i < len; i += 1) {
7187
+ mat = this.hierarchy[i].finalTransform.mProp.v.props;
7188
+ finalMat.transform(mat[0], mat[1], mat[2], mat[3], mat[4], mat[5], mat[6], mat[7], mat[8], mat[9], mat[10], mat[11], mat[12], mat[13], mat[14], mat[15]);
7189
+ }
7190
+ }
7191
+ }
7192
+ },
7193
+ globalToLocal: function (pt) {
7194
+ var transforms = [];
7195
+ transforms.push(this.finalTransform);
7196
+ var flag = true;
7197
+ var comp = this.comp;
7198
+ while (flag) {
7199
+ if (comp.finalTransform) {
7200
+ if (comp.data.hasMask) {
7201
+ transforms.splice(0, 0, comp.finalTransform);
7202
+ }
7203
+ comp = comp.comp;
7204
+ } else {
7205
+ flag = false;
7206
+ }
7207
+ }
7208
+ var i, len = transforms.length, ptNew;
7209
+ for (i = 0; i < len; i += 1) {
7210
+ ptNew = transforms[i].mat.applyToPointArray(0, 0, 0);
7211
+ //ptNew = transforms[i].mat.applyToPointArray(pt[0],pt[1],pt[2]);
7212
+ pt = [pt[0] - ptNew[0], pt[1] - ptNew[1], 0];
7213
+ }
7214
+ return pt;
7215
+ },
7216
+ mHelper: new Matrix()
7217
+ };
7218
+ function RenderableElement() {
7219
+
7220
+ }
7221
+
7222
+ RenderableElement.prototype = {
7223
+ initRenderable: function () {
7224
+ //layer's visibility related to inpoint and outpoint. Rename isVisible to isInRange
7225
+ this.isInRange = false;
7226
+ //layer's display state
7227
+ this.hidden = false;
7228
+ // If layer's transparency equals 0, it can be hidden
7229
+ this.isTransparent = false;
7230
+ //list of animated components
7231
+ this.renderableComponents = [];
7232
+ },
7233
+ addRenderableComponent: function (component) {
7234
+ if (this.renderableComponents.indexOf(component) === -1) {
7235
+ this.renderableComponents.push(component);
7236
+ }
7237
+ },
7238
+ removeRenderableComponent: function (component) {
7239
+ if (this.renderableComponents.indexOf(component) !== -1) {
7240
+ this.renderableComponents.splice(this.renderableComponents.indexOf(component), 1);
7241
+ }
7242
+ },
7243
+ prepareRenderableFrame: function (num) {
7244
+ this.checkLayerLimits(num);
7245
+ },
7246
+ checkTransparency: function () {
7247
+ if (this.finalTransform.mProp.o.v <= 0) {
7248
+ if (!this.isTransparent && this.globalData.renderConfig.hideOnTransparent) {
7249
+ this.isTransparent = true;
7250
+ this.hide();
7251
+ }
7252
+ } else if (this.isTransparent) {
7253
+ this.isTransparent = false;
7254
+ this.show();
7255
+ }
7256
+ },
7257
+ /**
7258
+ * @function
7259
+ * Initializes frame related properties.
7260
+ *
7261
+ * @param {number} num
7262
+ * current frame number in Layer's time
7263
+ *
7264
+ */
7265
+ checkLayerLimits: function (num) {
7266
+ if (this.data.ip - this.data.st <= num && this.data.op - this.data.st > num) {
7267
+ if (this.isInRange !== true) {
7268
+ this.globalData._mdf = true;
7269
+ this._mdf = true;
7270
+ this.isInRange = true;
7271
+ this.show();
7272
+ }
7273
+ } else {
7274
+ if (this.isInRange !== false) {
7275
+ this.globalData._mdf = true;
7276
+ this.isInRange = false;
7277
+ this.hide();
7278
+ }
7279
+ }
7280
+ },
7281
+ renderRenderable: function () {
7282
+ var i, len = this.renderableComponents.length;
7283
+ for (i = 0; i < len; i += 1) {
7284
+ this.renderableComponents[i].renderFrame(this._isFirstFrame);
7285
+ }
7286
+ /*this.maskManager.renderFrame(this.finalTransform.mat);
7287
+ this.renderableEffectsManager.renderFrame(this._isFirstFrame);*/
7288
+ },
7289
+ sourceRectAtTime: function () {
7290
+ return {
7291
+ top: 0,
7292
+ left: 0,
7293
+ width: 100,
7294
+ height: 100
7295
+ };
7296
+ },
7297
+ getLayerSize: function () {
7298
+ if (this.data.ty === 5) {
7299
+ return { w: this.data.textData.width, h: this.data.textData.height };
7300
+ } else {
7301
+ return { w: this.data.width, h: this.data.height };
7302
+ }
7303
+ }
7304
+ };
7305
+ function RenderableDOMElement() { }
7306
+
7307
+ (function () {
7308
+ var _prototype = {
7309
+ initElement: function (data, globalData, comp) {
7310
+ this.initFrame();
7311
+ this.initBaseData(data, globalData, comp);
7312
+ this.initTransform(data, globalData, comp);
7313
+ this.initHierarchy();
7314
+ this.initRenderable();
7315
+ this.initRendererElement();
7316
+ this.createContainerElements();
7317
+ this.createRenderableComponents();
7318
+ this.createContent();
7319
+ this.hide();
7320
+ },
7321
+ hide: function () {
7322
+ if (!this.hidden && (!this.isInRange || this.isTransparent)) {
7323
+ var elem = this.baseElement || this.layerElement;
7324
+ elem.style.display = 'none';
7325
+ this.hidden = true;
7326
+ }
7327
+ },
7328
+ show: function () {
7329
+ if (this.isInRange && !this.isTransparent) {
7330
+ if (!this.data.hd) {
7331
+ var elem = this.baseElement || this.layerElement;
7332
+ elem.style.display = 'block';
7333
+ }
7334
+ this.hidden = false;
7335
+ this._isFirstFrame = true;
7336
+ }
7337
+ },
7338
+ renderFrame: function () {
7339
+ //If it is exported as hidden (data.hd === true) no need to render
7340
+ //If it is not visible no need to render
7341
+ if (this.data.hd || this.hidden) {
7342
+ return;
7343
+ }
7344
+ this.renderTransform();
7345
+ this.renderRenderable();
7346
+ this.renderElement();
7347
+ this.renderInnerContent();
7348
+ if (this._isFirstFrame) {
7349
+ this._isFirstFrame = false;
7350
+ }
7351
+ },
7352
+ renderInnerContent: function () { },
7353
+ prepareFrame: function (num) {
7354
+ this._mdf = false;
7355
+ this.prepareRenderableFrame(num);
7356
+ this.prepareProperties(num, this.isInRange);
7357
+ this.checkTransparency();
7358
+ },
7359
+ destroy: function () {
7360
+ this.innerElem = null;
7361
+ this.destroyBaseElement();
7362
+ }
7363
+ };
7364
+ extendPrototype([RenderableElement, createProxyFunction(_prototype)], RenderableDOMElement);
7365
+ }());
7366
+ function ProcessedElement(element, position) {
7367
+ this.elem = element;
7368
+ this.pos = position;
7369
+ }
7370
+ function SVGStyleData(data, level) {
7371
+ this.data = data;
7372
+ this.type = data.ty;
7373
+ this.d = '';
7374
+ this.lvl = level;
7375
+ this._mdf = false;
7376
+ this.closed = data.hd === true;
7377
+ this.pElem = createNS('path');
7378
+ this.msElem = null;
7379
+ }
7380
+
7381
+ SVGStyleData.prototype.reset = function () {
7382
+ this.d = '';
7383
+ this._mdf = false;
7384
+ };
7385
+ function SVGShapeData(transformers, level, shape) {
7386
+ this.caches = [];
7387
+ this.styles = [];
7388
+ this.transformers = transformers;
7389
+ this.lStr = '';
7390
+ this.sh = shape;
7391
+ this.lvl = level;
7392
+ //TODO find if there are some cases where _isAnimated can be false.
7393
+ // For now, since shapes add up with other shapes. They have to be calculated every time.
7394
+ // One way of finding out is checking if all styles associated to this shape depend only of this shape
7395
+ this._isAnimated = !!shape.k;
7396
+ // TODO: commenting this for now since all shapes are animated
7397
+ var i = 0, len = transformers.length;
7398
+ while (i < len) {
7399
+ if (transformers[i].mProps.dynamicProperties.length) {
7400
+ this._isAnimated = true;
7401
+ break;
7402
+ }
7403
+ i += 1;
7404
+ }
7405
+ }
7406
+
7407
+ SVGShapeData.prototype.setAsAnimated = function () {
7408
+ this._isAnimated = true;
7409
+ }
7410
+ function SVGTransformData(mProps, op, container) {
7411
+ this.transform = {
7412
+ mProps: mProps,
7413
+ op: op,
7414
+ container: container
7415
+ };
7416
+ this.elements = [];
7417
+ this._isAnimated = this.transform.mProps.dynamicProperties.length || this.transform.op.effectsSequence.length;
7418
+ }
7419
+ function SVGStrokeStyleData(elem, data, styleOb) {
7420
+ this.initDynamicPropertyContainer(elem);
7421
+ this.getValue = this.iterateDynamicProperties;
7422
+ this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);
7423
+ this.w = PropertyFactory.getProp(elem, data.w, 0, null, this);
7424
+ this.d = new DashProperty(elem, data.d || {}, 'svg', this);
7425
+ this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this);
7426
+ this.style = styleOb;
7427
+ this._isAnimated = !!this._isAnimated;
7428
+ }
7429
+
7430
+ extendPrototype([DynamicPropertyContainer], SVGStrokeStyleData);
7431
+ function SVGFillStyleData(elem, data, styleOb) {
7432
+ this.initDynamicPropertyContainer(elem);
7433
+ this.getValue = this.iterateDynamicProperties;
7434
+ this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);
7435
+ this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this);
7436
+ this.style = styleOb;
7437
+ }
7438
+
7439
+ extendPrototype([DynamicPropertyContainer], SVGFillStyleData);
7440
+ function SVGGradientFillStyleData(elem, data, styleOb) {
7441
+ this.initDynamicPropertyContainer(elem);
7442
+ this.getValue = this.iterateDynamicProperties;
7443
+ this.initGradientData(elem, data, styleOb);
7444
+ }
7445
+
7446
+ SVGGradientFillStyleData.prototype.initGradientData = function (elem, data, styleOb) {
7447
+ this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);
7448
+ this.s = PropertyFactory.getProp(elem, data.s, 1, null, this);
7449
+ this.e = PropertyFactory.getProp(elem, data.e, 1, null, this);
7450
+ this.h = PropertyFactory.getProp(elem, data.h || { k: 0 }, 0, 0.01, this);
7451
+ this.a = PropertyFactory.getProp(elem, data.a || { k: 0 }, 0, degToRads, this);
7452
+ this.g = new GradientProperty(elem, data.g, this);
7453
+ this.style = styleOb;
7454
+ this.stops = [];
7455
+ this.setGradientData(styleOb.pElem, data);
7456
+ this.setGradientOpacity(data, styleOb);
7457
+ this._isAnimated = !!this._isAnimated;
7458
+
7459
+ };
7460
+
7461
+ SVGGradientFillStyleData.prototype.setGradientData = function (pathElement, data) {
7462
+
7463
+ var gradientId = createElementID();
7464
+ var gfill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');
7465
+ gfill.setAttribute('id', gradientId);
7466
+ gfill.setAttribute('spreadMethod', 'pad');
7467
+ gfill.setAttribute('gradientUnits', 'userSpaceOnUse');
7468
+ var stops = [];
7469
+ var stop, j, jLen;
7470
+ jLen = data.g.p * 4;
7471
+ for (j = 0; j < jLen; j += 4) {
7472
+ stop = createNS('stop');
7473
+ gfill.appendChild(stop);
7474
+ stops.push(stop);
7475
+ }
7476
+ pathElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + locationHref + '#' + gradientId + ')');
7477
+
7478
+ this.gf = gfill;
7479
+ this.cst = stops;
7480
+ };
7481
+
7482
+ SVGGradientFillStyleData.prototype.setGradientOpacity = function (data, styleOb) {
7483
+ if (this.g._hasOpacity && !this.g._collapsable) {
7484
+ var stop, j, jLen;
7485
+ var mask = createNS("mask");
7486
+ var maskElement = createNS('path');
7487
+ mask.appendChild(maskElement);
7488
+ var opacityId = createElementID();
7489
+ var maskId = createElementID();
7490
+ mask.setAttribute('id', maskId);
7491
+ var opFill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');
7492
+ opFill.setAttribute('id', opacityId);
7493
+ opFill.setAttribute('spreadMethod', 'pad');
7494
+ opFill.setAttribute('gradientUnits', 'userSpaceOnUse');
7495
+ jLen = data.g.k.k[0].s ? data.g.k.k[0].s.length : data.g.k.k.length;
7496
+ var stops = this.stops;
7497
+ for (j = data.g.p * 4; j < jLen; j += 2) {
7498
+ stop = createNS('stop');
7499
+ stop.setAttribute('stop-color', 'rgb(255,255,255)');
7500
+ opFill.appendChild(stop);
7501
+ stops.push(stop);
7502
+ }
7503
+ maskElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + locationHref + '#' + opacityId + ')');
7504
+ this.of = opFill;
7505
+ this.ms = mask;
7506
+ this.ost = stops;
7507
+ this.maskId = maskId;
7508
+ styleOb.msElem = maskElement;
7509
+ }
7510
+ };
7511
+
7512
+ extendPrototype([DynamicPropertyContainer], SVGGradientFillStyleData);
7513
+ function SVGGradientStrokeStyleData(elem, data, styleOb) {
7514
+ this.initDynamicPropertyContainer(elem);
7515
+ this.getValue = this.iterateDynamicProperties;
7516
+ this.w = PropertyFactory.getProp(elem, data.w, 0, null, this);
7517
+ this.d = new DashProperty(elem, data.d || {}, 'svg', this);
7518
+ this.initGradientData(elem, data, styleOb);
7519
+ this._isAnimated = !!this._isAnimated;
7520
+ }
7521
+
7522
+ extendPrototype([SVGGradientFillStyleData, DynamicPropertyContainer], SVGGradientStrokeStyleData);
7523
+ function ShapeGroupData() {
7524
+ this.it = [];
7525
+ this.prevViewData = [];
7526
+ this.gr = createNS('g');
7527
+ }
7528
+ var SVGElementsRenderer = (function () {
7529
+ var _identityMatrix = new Matrix();
7530
+ var _matrixHelper = new Matrix();
7531
+
7532
+ var ob = {
7533
+ createRenderFunction: createRenderFunction
7534
+ }
7535
+
7536
+ function createRenderFunction(data) {
7537
+ var ty = data.ty;
7538
+ switch (data.ty) {
7539
+ case 'fl':
7540
+ return renderFill;
7541
+ case 'gf':
7542
+ return renderGradient;
7543
+ case 'gs':
7544
+ return renderGradientStroke;
7545
+ case 'st':
7546
+ return renderStroke;
7547
+ case 'sh':
7548
+ case 'el':
7549
+ case 'rc':
7550
+ case 'sr':
7551
+ return renderPath;
7552
+ case 'tr':
7553
+ return renderContentTransform;
7554
+ }
7555
+ }
7556
+
7557
+ function renderContentTransform(styleData, itemData, isFirstFrame) {
7558
+ if (isFirstFrame || itemData.transform.op._mdf) {
7559
+ itemData.transform.container.setAttribute('opacity', itemData.transform.op.v);
7560
+ }
7561
+ if (isFirstFrame || itemData.transform.mProps._mdf) {
7562
+ itemData.transform.container.setAttribute('transform', itemData.transform.mProps.v.to2dCSS());
7563
+ }
7564
+ }
7565
+
7566
+ function renderPath(styleData, itemData, isFirstFrame) {
7567
+ var j, jLen, pathStringTransformed, redraw, pathNodes, l, lLen = itemData.styles.length;
7568
+ var lvl = itemData.lvl;
7569
+ var paths, mat, props, iterations, k;
7570
+ for (l = 0; l < lLen; l += 1) {
7571
+ redraw = itemData.sh._mdf || isFirstFrame;
7572
+ if (itemData.styles[l].lvl < lvl) {
7573
+ mat = _matrixHelper.reset();
7574
+ iterations = lvl - itemData.styles[l].lvl;
7575
+ k = itemData.transformers.length - 1;
7576
+ while (!redraw && iterations > 0) {
7577
+ redraw = itemData.transformers[k].mProps._mdf || redraw;
7578
+ iterations--;
7579
+ k--;
7580
+ }
7581
+ if (redraw) {
7582
+ iterations = lvl - itemData.styles[l].lvl;
7583
+ k = itemData.transformers.length - 1;
7584
+ while (iterations > 0) {
7585
+ props = itemData.transformers[k].mProps.v.props;
7586
+ mat.transform(props[0], props[1], props[2], props[3], props[4], props[5], props[6], props[7], props[8], props[9], props[10], props[11], props[12], props[13], props[14], props[15]);
7587
+ iterations--;
7588
+ k--;
7589
+ }
7590
+ }
7591
+ } else {
7592
+ mat = _identityMatrix;
7593
+ }
7594
+ paths = itemData.sh.paths;
7595
+ jLen = paths._length;
7596
+ if (redraw) {
7597
+ pathStringTransformed = '';
7598
+ for (j = 0; j < jLen; j += 1) {
7599
+ pathNodes = paths.shapes[j];
7600
+ if (pathNodes && pathNodes._length) {
7601
+ pathStringTransformed += buildShapeString(pathNodes, pathNodes._length, pathNodes.c, mat);
7602
+ }
7603
+ }
7604
+ itemData.caches[l] = pathStringTransformed;
7605
+ } else {
7606
+ pathStringTransformed = itemData.caches[l];
7607
+ }
7608
+ itemData.styles[l].d += styleData.hd === true ? '' : pathStringTransformed;
7609
+ itemData.styles[l]._mdf = redraw || itemData.styles[l]._mdf;
7610
+ }
7611
+ }
7612
+
7613
+ function renderFill(styleData, itemData, isFirstFrame) {
7614
+ var styleElem = itemData.style;
7615
+
7616
+ if (itemData.c._mdf || isFirstFrame) {
7617
+ styleElem.pElem.setAttribute('fill', 'rgb(' + bm_floor(itemData.c.v[0]) + ',' + bm_floor(itemData.c.v[1]) + ',' + bm_floor(itemData.c.v[2]) + ')');
7618
+ }
7619
+ if (itemData.o._mdf || isFirstFrame) {
7620
+ styleElem.pElem.setAttribute('fill-opacity', itemData.o.v);
7621
+ }
7622
+ };
7623
+
7624
+ function renderGradientStroke(styleData, itemData, isFirstFrame) {
7625
+ renderGradient(styleData, itemData, isFirstFrame);
7626
+ renderStroke(styleData, itemData, isFirstFrame);
7627
+ }
7628
+
7629
+ function renderGradient(styleData, itemData, isFirstFrame) {
7630
+ var gfill = itemData.gf;
7631
+ var hasOpacity = itemData.g._hasOpacity;
7632
+ var pt1 = itemData.s.v, pt2 = itemData.e.v;
7633
+
7634
+ if (itemData.o._mdf || isFirstFrame) {
7635
+ var attr = styleData.ty === 'gf' ? 'fill-opacity' : 'stroke-opacity';
7636
+ itemData.style.pElem.setAttribute(attr, itemData.o.v);
7637
+ }
7638
+ if (itemData.s._mdf || isFirstFrame) {
7639
+ var attr1 = styleData.t === 1 ? 'x1' : 'cx';
7640
+ var attr2 = attr1 === 'x1' ? 'y1' : 'cy';
7641
+ gfill.setAttribute(attr1, pt1[0]);
7642
+ gfill.setAttribute(attr2, pt1[1]);
7643
+ if (hasOpacity && !itemData.g._collapsable) {
7644
+ itemData.of.setAttribute(attr1, pt1[0]);
7645
+ itemData.of.setAttribute(attr2, pt1[1]);
7646
+ }
7647
+ }
7648
+ var stops, i, len, stop;
7649
+ if (itemData.g._cmdf || isFirstFrame) {
7650
+ stops = itemData.cst;
7651
+ var cValues = itemData.g.c;
7652
+ len = stops.length;
7653
+ for (i = 0; i < len; i += 1) {
7654
+ stop = stops[i];
7655
+ stop.setAttribute('offset', cValues[i * 4] + '%');
7656
+ stop.setAttribute('stop-color', 'rgb(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ')');
7657
+ }
7658
+ }
7659
+ if (hasOpacity && (itemData.g._omdf || isFirstFrame)) {
7660
+ var oValues = itemData.g.o;
7661
+ if (itemData.g._collapsable) {
7662
+ stops = itemData.cst;
7663
+ } else {
7664
+ stops = itemData.ost;
7665
+ }
7666
+ len = stops.length;
7667
+ for (i = 0; i < len; i += 1) {
7668
+ stop = stops[i];
7669
+ if (!itemData.g._collapsable) {
7670
+ stop.setAttribute('offset', oValues[i * 2] + '%');
7671
+ }
7672
+ stop.setAttribute('stop-opacity', oValues[i * 2 + 1]);
7673
+ }
7674
+ }
7675
+ if (styleData.t === 1) {
7676
+ if (itemData.e._mdf || isFirstFrame) {
7677
+ gfill.setAttribute('x2', pt2[0]);
7678
+ gfill.setAttribute('y2', pt2[1]);
7679
+ if (hasOpacity && !itemData.g._collapsable) {
7680
+ itemData.of.setAttribute('x2', pt2[0]);
7681
+ itemData.of.setAttribute('y2', pt2[1]);
7682
+ }
7683
+ }
7684
+ } else {
7685
+ var rad;
7686
+ if (itemData.s._mdf || itemData.e._mdf || isFirstFrame) {
7687
+ rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
7688
+ gfill.setAttribute('r', rad);
7689
+ if (hasOpacity && !itemData.g._collapsable) {
7690
+ itemData.of.setAttribute('r', rad);
7691
+ }
7692
+ }
7693
+ if (itemData.e._mdf || itemData.h._mdf || itemData.a._mdf || isFirstFrame) {
7694
+ if (!rad) {
7695
+ rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
7696
+ }
7697
+ var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);
7698
+
7699
+ var percent = itemData.h.v >= 1 ? 0.99 : itemData.h.v <= -1 ? -0.99 : itemData.h.v;
7700
+ var dist = rad * percent;
7701
+ var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];
7702
+ var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];
7703
+ gfill.setAttribute('fx', x);
7704
+ gfill.setAttribute('fy', y);
7705
+ if (hasOpacity && !itemData.g._collapsable) {
7706
+ itemData.of.setAttribute('fx', x);
7707
+ itemData.of.setAttribute('fy', y);
7708
+ }
7709
+ }
7710
+ //gfill.setAttribute('fy','200');
7711
+ }
7712
+ };
7713
+
7714
+ function renderStroke(styleData, itemData, isFirstFrame) {
7715
+ var styleElem = itemData.style;
7716
+ var d = itemData.d;
7717
+ if (d && (d._mdf || isFirstFrame) && d.dashStr) {
7718
+ styleElem.pElem.setAttribute('stroke-dasharray', d.dashStr);
7719
+ styleElem.pElem.setAttribute('stroke-dashoffset', d.dashoffset[0]);
7720
+ }
7721
+ if (itemData.c && (itemData.c._mdf || isFirstFrame)) {
7722
+ styleElem.pElem.setAttribute('stroke', 'rgb(' + bm_floor(itemData.c.v[0]) + ',' + bm_floor(itemData.c.v[1]) + ',' + bm_floor(itemData.c.v[2]) + ')');
7723
+ }
7724
+ if (itemData.o._mdf || isFirstFrame) {
7725
+ styleElem.pElem.setAttribute('stroke-opacity', itemData.o.v);
7726
+ }
7727
+ if (itemData.w._mdf || isFirstFrame) {
7728
+ styleElem.pElem.setAttribute('stroke-width', itemData.w.v);
7729
+ if (styleElem.msElem) {
7730
+ styleElem.msElem.setAttribute('stroke-width', itemData.w.v);
7731
+ }
7732
+ }
7733
+ };
7734
+
7735
+ return ob;
7736
+ }())
7737
+ function ShapeTransformManager() {
7738
+ this.sequences = {};
7739
+ this.sequenceList = [];
7740
+ this.transform_key_count = 0;
7741
+ }
7742
+
7743
+ ShapeTransformManager.prototype = {
7744
+ addTransformSequence: function (transforms) {
7745
+ var i, len = transforms.length;
7746
+ var key = '_';
7747
+ for (i = 0; i < len; i += 1) {
7748
+ key += transforms[i].transform.key + '_';
7749
+ }
7750
+ var sequence = this.sequences[key];
7751
+ if (!sequence) {
7752
+ sequence = {
7753
+ transforms: [].concat(transforms),
7754
+ finalTransform: new Matrix(),
7755
+ _mdf: false
7756
+ };
7757
+ this.sequences[key] = sequence;
7758
+ this.sequenceList.push(sequence);
7759
+ }
7760
+ return sequence;
7761
+ },
7762
+ processSequence: function (sequence, isFirstFrame) {
7763
+ var i = 0, len = sequence.transforms.length, _mdf = isFirstFrame;
7764
+ while (i < len && !isFirstFrame) {
7765
+ if (sequence.transforms[i].transform.mProps._mdf) {
7766
+ _mdf = true;
7767
+ break;
7768
+ }
7769
+ i += 1
7770
+ }
7771
+ if (_mdf) {
7772
+ var props;
7773
+ sequence.finalTransform.reset();
7774
+ for (i = len - 1; i >= 0; i -= 1) {
7775
+ props = sequence.transforms[i].transform.mProps.v.props;
7776
+ sequence.finalTransform.transform(props[0], props[1], props[2], props[3], props[4], props[5], props[6], props[7], props[8], props[9], props[10], props[11], props[12], props[13], props[14], props[15]);
7777
+ }
7778
+ }
7779
+ sequence._mdf = _mdf;
7780
+
7781
+ },
7782
+ processSequences: function (isFirstFrame) {
7783
+ var i, len = this.sequenceList.length;
7784
+ for (i = 0; i < len; i += 1) {
7785
+ this.processSequence(this.sequenceList[i], isFirstFrame);
7786
+ }
7787
+
7788
+ },
7789
+ getNewKey: function () {
7790
+ return '_' + this.transform_key_count++;
7791
+ }
7792
+ }
7793
+ function CVShapeData(element, data, styles, transformsManager) {
7794
+ this.styledShapes = [];
7795
+ this.tr = [0, 0, 0, 0, 0, 0];
7796
+ var ty = 4;
7797
+ if (data.ty == 'rc') {
7798
+ ty = 5;
7799
+ } else if (data.ty == 'el') {
7800
+ ty = 6;
7801
+ } else if (data.ty == 'sr') {
7802
+ ty = 7;
7803
+ }
7804
+ this.sh = ShapePropertyFactory.getShapeProp(element, data, ty, element);
7805
+ var i, len = styles.length, styledShape;
7806
+ for (i = 0; i < len; i += 1) {
7807
+ if (!styles[i].closed) {
7808
+ styledShape = {
7809
+ transforms: transformsManager.addTransformSequence(styles[i].transforms),
7810
+ trNodes: []
7811
+ }
7812
+ this.styledShapes.push(styledShape);
7813
+ styles[i].elements.push(styledShape);
7814
+ }
7815
+ }
7816
+ }
7817
+
7818
+ CVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated;
7819
+ function BaseElement() {
7820
+ }
7821
+
7822
+ BaseElement.prototype = {
7823
+ checkMasks: function () {
7824
+ if (!this.data.hasMask) {
7825
+ return false;
7826
+ }
7827
+ var i = 0, len = this.data.masksProperties.length;
7828
+ while (i < len) {
7829
+ if ((this.data.masksProperties[i].mode !== 'n' && this.data.masksProperties[i].cl !== false)) {
7830
+ return true;
7831
+ }
7832
+ i += 1;
7833
+ }
7834
+ return false;
7835
+ },
7836
+ initExpressions: function () {
7837
+ this.layerInterface = LayerExpressionInterface(this);
7838
+ if (this.data.hasMask && this.maskManager) {
7839
+ this.layerInterface.registerMaskInterface(this.maskManager);
7840
+ }
7841
+ var effectsInterface = EffectsExpressionInterface.createEffectsInterface(this, this.layerInterface);
7842
+ this.layerInterface.registerEffectsInterface(effectsInterface);
7843
+
7844
+ if (this.data.ty === 0 || this.data.xt) {
7845
+ this.compInterface = CompExpressionInterface(this);
7846
+ } else if (this.data.ty === 4) {
7847
+ this.layerInterface.shapeInterface = ShapeExpressionInterface(this.shapesData, this.itemsData, this.layerInterface);
7848
+ this.layerInterface.content = this.layerInterface.shapeInterface;
7849
+ } else if (this.data.ty === 5) {
7850
+ this.layerInterface.textInterface = TextExpressionInterface(this);
7851
+ this.layerInterface.text = this.layerInterface.textInterface;
7852
+ }
7853
+ },
7854
+ setBlendMode: function () {
7855
+ var blendModeValue = getBlendMode(this.data.bm);
7856
+ var elem = this.baseElement || this.layerElement;
7857
+
7858
+ elem.style['mix-blend-mode'] = blendModeValue;
7859
+ },
7860
+ initBaseData: function (data, globalData, comp) {
7861
+ this.globalData = globalData;
7862
+ this.comp = comp;
7863
+ this.data = data;
7864
+ this.layerId = createElementID();
7865
+
7866
+ //Stretch factor for old animations missing this property.
7867
+ if (!this.data.sr) {
7868
+ this.data.sr = 1;
7869
+ }
7870
+ // effects manager
7871
+ this.effectsManager = new EffectsManager(this.data, this, this.dynamicProperties);
7872
+
7873
+ },
7874
+ getType: function () {
7875
+ return this.type;
7876
+ }
7877
+ , sourceRectAtTime: function () { }
7878
+ }
7879
+ function NullElement(data, globalData, comp) {
7880
+ this.initFrame();
7881
+ this.initBaseData(data, globalData, comp);
7882
+ this.initFrame();
7883
+ this.initTransform(data, globalData, comp);
7884
+ this.initHierarchy();
7885
+ }
7886
+
7887
+ NullElement.prototype.prepareFrame = function (num) {
7888
+ this.prepareProperties(num, true);
7889
+ };
7890
+
7891
+ NullElement.prototype.renderFrame = function () {
7892
+ };
7893
+
7894
+ NullElement.prototype.getBaseElement = function () {
7895
+ return null;
7896
+ };
7897
+
7898
+ NullElement.prototype.destroy = function () {
7899
+ };
7900
+
7901
+ NullElement.prototype.sourceRectAtTime = function () {
7902
+ };
7903
+
7904
+ NullElement.prototype.hide = function () {
7905
+ };
7906
+
7907
+ extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement], NullElement);
7908
+
7909
+ function SVGBaseElement() {
7910
+ }
7911
+
7912
+ SVGBaseElement.prototype = {
7913
+ initRendererElement: function () {
7914
+ this.layerElement = createNS('g');
7915
+ },
7916
+ createContainerElements: function () {
7917
+ this.matteElement = createNS('g');
7918
+ this.transformedElement = this.layerElement;
7919
+ this.maskedElement = this.layerElement;
7920
+ this._sizeChanged = false;
7921
+ var layerElementParent = null;
7922
+ //If this layer acts as a mask for the following layer
7923
+ var filId, fil, gg;
7924
+ if (this.data.td) {
7925
+ if (this.data.td == 3 || this.data.td == 1) {
7926
+ var masker = createNS('mask');
7927
+ masker.setAttribute('id', this.layerId);
7928
+ masker.setAttribute('mask-type', this.data.td == 3 ? 'luminance' : 'alpha');
7929
+ masker.appendChild(this.layerElement);
7930
+ layerElementParent = masker;
7931
+ this.globalData.defs.appendChild(masker);
7932
+ // This is only for IE and Edge when mask if of type alpha
7933
+ if (!featureSupport.maskType && this.data.td == 1) {
7934
+ masker.setAttribute('mask-type', 'luminance');
7935
+ filId = createElementID();
7936
+ fil = filtersFactory.createFilter(filId);
7937
+ this.globalData.defs.appendChild(fil);
7938
+ fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());
7939
+ gg = createNS('g');
7940
+ gg.appendChild(this.layerElement);
7941
+ layerElementParent = gg;
7942
+ masker.appendChild(gg);
7943
+ gg.setAttribute('filter', 'url(' + locationHref + '#' + filId + ')');
7944
+ }
7945
+ } else if (this.data.td == 2) {
7946
+ var maskGroup = createNS('mask');
7947
+ maskGroup.setAttribute('id', this.layerId);
7948
+ maskGroup.setAttribute('mask-type', 'alpha');
7949
+ var maskGrouper = createNS('g');
7950
+ maskGroup.appendChild(maskGrouper);
7951
+ filId = createElementID();
7952
+ fil = filtersFactory.createFilter(filId);
7953
+ ////
7954
+
7955
+ // This solution doesn't work on Android when meta tag with viewport attribute is set
7956
+ /*var feColorMatrix = createNS('feColorMatrix');
7957
+ feColorMatrix.setAttribute('type', 'matrix');
7958
+ feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');
7959
+ feColorMatrix.setAttribute('values','1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 -1 1');
7960
+ fil.appendChild(feColorMatrix);*/
7961
+ ////
7962
+ var feCTr = createNS('feComponentTransfer');
7963
+ feCTr.setAttribute('in', 'SourceGraphic');
7964
+ fil.appendChild(feCTr);
7965
+ var feFunc = createNS('feFuncA');
7966
+ feFunc.setAttribute('type', 'table');
7967
+ feFunc.setAttribute('tableValues', '1.0 0.0');
7968
+ feCTr.appendChild(feFunc);
7969
+ ////
7970
+ this.globalData.defs.appendChild(fil);
7971
+ var alphaRect = createNS('rect');
7972
+ alphaRect.setAttribute('width', this.comp.data.w);
7973
+ alphaRect.setAttribute('height', this.comp.data.h);
7974
+ alphaRect.setAttribute('x', '0');
7975
+ alphaRect.setAttribute('y', '0');
7976
+ alphaRect.setAttribute('fill', '#ffffff');
7977
+ alphaRect.setAttribute('opacity', '0');
7978
+ maskGrouper.setAttribute('filter', 'url(' + locationHref + '#' + filId + ')');
7979
+ maskGrouper.appendChild(alphaRect);
7980
+ maskGrouper.appendChild(this.layerElement);
7981
+ layerElementParent = maskGrouper;
7982
+ if (!featureSupport.maskType) {
7983
+ maskGroup.setAttribute('mask-type', 'luminance');
7984
+ fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());
7985
+ gg = createNS('g');
7986
+ maskGrouper.appendChild(alphaRect);
7987
+ gg.appendChild(this.layerElement);
7988
+ layerElementParent = gg;
7989
+ maskGrouper.appendChild(gg);
7990
+ }
7991
+ this.globalData.defs.appendChild(maskGroup);
7992
+ }
7993
+ } else if (this.data.tt) {
7994
+ this.matteElement.appendChild(this.layerElement);
7995
+ layerElementParent = this.matteElement;
7996
+ this.baseElement = this.matteElement;
7997
+ } else {
7998
+ this.baseElement = this.layerElement;
7999
+ }
8000
+ if (this.data.ln) {
8001
+ this.layerElement.setAttribute('id', this.data.ln);
8002
+ }
8003
+ if (this.data.cl) {
8004
+ this.layerElement.setAttribute('class', this.data.cl);
8005
+ }
8006
+ //Clipping compositions to hide content that exceeds boundaries. If collapsed transformations is on, component should not be clipped
8007
+ if (this.data.ty === 0 && !this.data.hd) {
8008
+ var cp = createNS('clipPath');
8009
+ var pt = createNS('path');
8010
+ pt.setAttribute('d', 'M0,0 L' + this.data.w + ',0' + ' L' + this.data.w + ',' + this.data.h + ' L0,' + this.data.h + 'z');
8011
+ var clipId = createElementID();
8012
+ cp.setAttribute('id', clipId);
8013
+ cp.appendChild(pt);
8014
+ this.globalData.defs.appendChild(cp);
8015
+
8016
+ if (this.checkMasks()) {
8017
+ var cpGroup = createNS('g');
8018
+ cpGroup.setAttribute('clip-path', 'url(' + locationHref + '#' + clipId + ')');
8019
+ cpGroup.appendChild(this.layerElement);
8020
+ this.transformedElement = cpGroup;
8021
+ if (layerElementParent) {
8022
+ layerElementParent.appendChild(this.transformedElement);
8023
+ } else {
8024
+ this.baseElement = this.transformedElement;
8025
+ }
8026
+ } else {
8027
+ this.layerElement.setAttribute('clip-path', 'url(' + locationHref + '#' + clipId + ')');
8028
+ }
8029
+
8030
+ }
8031
+ if (this.data.bm !== 0) {
8032
+ this.setBlendMode();
8033
+ }
8034
+
8035
+ },
8036
+ renderElement: function () {
8037
+ if (this.finalTransform._matMdf) {
8038
+ this.transformedElement.setAttribute('transform', this.finalTransform.mat.to2dCSS());
8039
+ }
8040
+ if (this.finalTransform._opMdf) {
8041
+ this.transformedElement.setAttribute('opacity', this.finalTransform.mProp.o.v);
8042
+ }
8043
+ },
8044
+ destroyBaseElement: function () {
8045
+ this.layerElement = null;
8046
+ this.matteElement = null;
8047
+ this.maskManager.destroy();
8048
+ },
8049
+ getBaseElement: function () {
8050
+ if (this.data.hd) {
8051
+ return null;
8052
+ }
8053
+ return this.baseElement;
8054
+ },
8055
+ createRenderableComponents: function () {
8056
+ this.maskManager = new MaskElement(this.data, this, this.globalData);
8057
+ this.renderableEffectsManager = new SVGEffects(this);
8058
+ },
8059
+ setMatte: function (id) {
8060
+ if (!this.matteElement) {
8061
+ return;
8062
+ }
8063
+ this.matteElement.setAttribute("mask", "url(" + locationHref + "#" + id + ")");
8064
+ }
8065
+ };
8066
+ function IShapeElement() {
8067
+ }
8068
+
8069
+ IShapeElement.prototype = {
8070
+ addShapeToModifiers: function (data) {
8071
+ var i, len = this.shapeModifiers.length;
8072
+ for (i = 0; i < len; i += 1) {
8073
+ this.shapeModifiers[i].addShape(data);
8074
+ }
8075
+ },
8076
+ isShapeInAnimatedModifiers: function (data) {
8077
+ var i = 0, len = this.shapeModifiers.length;
8078
+ while (i < len) {
8079
+ if (this.shapeModifiers[i].isAnimatedWithShape(data)) {
8080
+ return true;
8081
+ }
8082
+ }
8083
+ return false;
8084
+ },
8085
+ renderModifiers: function () {
8086
+ if (!this.shapeModifiers.length) {
8087
+ return;
8088
+ }
8089
+ var i, len = this.shapes.length;
8090
+ for (i = 0; i < len; i += 1) {
8091
+ this.shapes[i].sh.reset();
8092
+ }
8093
+
8094
+ len = this.shapeModifiers.length;
8095
+ for (i = len - 1; i >= 0; i -= 1) {
8096
+ this.shapeModifiers[i].processShapes(this._isFirstFrame);
8097
+ }
8098
+ },
8099
+ lcEnum: {
8100
+ '1': 'butt',
8101
+ '2': 'round',
8102
+ '3': 'square'
8103
+ },
8104
+ ljEnum: {
8105
+ '1': 'miter',
8106
+ '2': 'round',
8107
+ '3': 'bevel'
8108
+ },
8109
+ searchProcessedElement: function (elem) {
8110
+ var elements = this.processedElements;
8111
+ var i = 0, len = elements.length;
8112
+ while (i < len) {
8113
+ if (elements[i].elem === elem) {
8114
+ return elements[i].pos;
8115
+ }
8116
+ i += 1;
8117
+ }
8118
+ return 0;
8119
+ },
8120
+ addProcessedElement: function (elem, pos) {
8121
+ var elements = this.processedElements;
8122
+ var i = elements.length;
8123
+ while (i) {
8124
+ i -= 1;
8125
+ if (elements[i].elem === elem) {
8126
+ elements[i].pos = pos;
8127
+ return;
8128
+ }
8129
+ }
8130
+ elements.push(new ProcessedElement(elem, pos));
8131
+ },
8132
+ prepareFrame: function (num) {
8133
+ this.prepareRenderableFrame(num);
8134
+ this.prepareProperties(num, this.isInRange);
8135
+ }
8136
+ };
8137
+ function ITextElement() {
8138
+ }
8139
+
8140
+ ITextElement.prototype.initElement = function (data, globalData, comp) {
8141
+ this.lettersChangedFlag = true;
8142
+ this.initFrame();
8143
+ this.initBaseData(data, globalData, comp);
8144
+ this.textProperty = new TextProperty(this, data.t, this.dynamicProperties);
8145
+ this.textAnimator = new TextAnimatorProperty(data.t, this.renderType, this);
8146
+ this.initTransform(data, globalData, comp);
8147
+ this.initHierarchy();
8148
+ this.initRenderable();
8149
+ this.initRendererElement();
8150
+ this.createContainerElements();
8151
+ this.createRenderableComponents();
8152
+ this.createContent();
8153
+ this.hide();
8154
+ this.textAnimator.searchProperties(this.dynamicProperties);
8155
+ };
8156
+
8157
+ ITextElement.prototype.prepareFrame = function (num) {
8158
+ this._mdf = false;
8159
+ this.prepareRenderableFrame(num);
8160
+ this.prepareProperties(num, this.isInRange);
8161
+ if (this.textProperty._mdf || this.textProperty._isFirstFrame) {
8162
+ this.buildNewText();
8163
+ this.textProperty._isFirstFrame = false;
8164
+ this.textProperty._mdf = false;
8165
+ }
8166
+ };
8167
+
8168
+ ITextElement.prototype.createPathShape = function (matrixHelper, shapes) {
8169
+ var j, jLen = shapes.length;
8170
+ var k, kLen, pathNodes;
8171
+ var shapeStr = '';
8172
+ for (j = 0; j < jLen; j += 1) {
8173
+ pathNodes = shapes[j].ks.k;
8174
+ shapeStr += buildShapeString(pathNodes, pathNodes.i.length, true, matrixHelper);
8175
+ }
8176
+ return shapeStr;
8177
+ };
8178
+
8179
+ ITextElement.prototype.updateDocumentData = function (newData, index) {
8180
+ this.textProperty.updateDocumentData(newData, index);
8181
+ };
8182
+
8183
+ ITextElement.prototype.canResizeFont = function (_canResize) {
8184
+ this.textProperty.canResizeFont(_canResize);
8185
+ };
8186
+
8187
+ ITextElement.prototype.setMinimumFontSize = function (_fontSize) {
8188
+ this.textProperty.setMinimumFontSize(_fontSize);
8189
+ };
8190
+
8191
+ ITextElement.prototype.applyTextPropertiesToMatrix = function (documentData, matrixHelper, lineNumber, xPos, yPos) {
8192
+ if (documentData.ps) {
8193
+ matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0);
8194
+ }
8195
+ matrixHelper.translate(0, -documentData.ls, 0);
8196
+ switch (documentData.j) {
8197
+ case 1:
8198
+ matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]), 0, 0);
8199
+ break;
8200
+ case 2:
8201
+ matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]) / 2, 0, 0);
8202
+ break;
8203
+ }
8204
+ matrixHelper.translate(xPos, yPos, 0);
8205
+ };
8206
+
8207
+
8208
+ ITextElement.prototype.buildColor = function (colorData) {
8209
+ return 'rgb(' + Math.round(colorData[0] * 255) + ',' + Math.round(colorData[1] * 255) + ',' + Math.round(colorData[2] * 255) + ')';
8210
+ };
8211
+
8212
+ ITextElement.prototype.emptyProp = new LetterProps();
8213
+
8214
+ ITextElement.prototype.destroy = function () {
8215
+
8216
+ };
8217
+ function ICompElement() { }
8218
+
8219
+ extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement], ICompElement);
8220
+
8221
+ ICompElement.prototype.initElement = function (data, globalData, comp) {
8222
+ this.initFrame();
8223
+ this.initBaseData(data, globalData, comp);
8224
+ this.initTransform(data, globalData, comp);
8225
+ this.initRenderable();
8226
+ this.initHierarchy();
8227
+ this.initRendererElement();
8228
+ this.createContainerElements();
8229
+ this.createRenderableComponents();
8230
+ if (this.data.xt || !globalData.progressiveLoad) {
8231
+ this.buildAllItems();
8232
+ }
8233
+ this.hide();
8234
+ };
8235
+
8236
+ /*ICompElement.prototype.hide = function(){
8237
+ if(!this.hidden){
8238
+ this.hideElement();
8239
+ var i,len = this.elements.length;
8240
+ for( i = 0; i < len; i+=1 ){
8241
+ if(this.elements[i]){
8242
+ this.elements[i].hide();
8243
+ }
8244
+ }
8245
+ }
8246
+ };*/
8247
+
8248
+ ICompElement.prototype.prepareFrame = function (num) {
8249
+ this._mdf = false;
8250
+ this.prepareRenderableFrame(num);
8251
+ this.prepareProperties(num, this.isInRange);
8252
+ if (!this.isInRange && !this.data.xt) {
8253
+ return;
8254
+ }
8255
+
8256
+ if (!this.tm._placeholder) {
8257
+ var timeRemapped = this.tm.v;
8258
+ if (timeRemapped === this.data.op) {
8259
+ timeRemapped = this.data.op - 1;
8260
+ }
8261
+ this.renderedFrame = timeRemapped;
8262
+ } else {
8263
+ this.renderedFrame = num / this.data.sr;
8264
+ }
8265
+ var i, len = this.elements.length;
8266
+ if (!this.completeLayers) {
8267
+ this.checkLayers(this.renderedFrame);
8268
+ }
8269
+ //This iteration needs to be backwards because of how expressions connect between each other
8270
+ for (i = len - 1; i >= 0; i -= 1) {
8271
+ if (this.completeLayers || this.elements[i]) {
8272
+ this.elements[i].prepareFrame(this.renderedFrame - this.layers[i].st);
8273
+ if (this.elements[i]._mdf) {
8274
+ this._mdf = true;
8275
+ }
8276
+ }
8277
+ }
8278
+ };
8279
+
8280
+ ICompElement.prototype.renderInnerContent = function () {
8281
+ var i, len = this.layers.length;
8282
+ for (i = 0; i < len; i += 1) {
8283
+ if (this.completeLayers || this.elements[i]) {
8284
+ this.elements[i].renderFrame();
8285
+ }
8286
+ }
8287
+ };
8288
+
8289
+ ICompElement.prototype.setElements = function (elems) {
8290
+ this.elements = elems;
8291
+ };
8292
+
8293
+ ICompElement.prototype.getElements = function () {
8294
+ return this.elements;
8295
+ };
8296
+
8297
+ ICompElement.prototype.destroyElements = function () {
8298
+ var i, len = this.layers.length;
8299
+ for (i = 0; i < len; i += 1) {
8300
+ if (this.elements[i]) {
8301
+ this.elements[i].destroy();
8302
+ }
8303
+ }
8304
+ };
8305
+
8306
+ ICompElement.prototype.destroy = function () {
8307
+ this.destroyElements();
8308
+ this.destroyBaseElement();
8309
+ };
8310
+
8311
+ function IImageElement(data, globalData, comp) {
8312
+ this.assetData = globalData.getAssetData(data.refId);
8313
+ this.initElement(data, globalData, comp);
8314
+ this.sourceRect = { top: 0, left: 0, width: this.assetData.w, height: this.assetData.h };
8315
+ }
8316
+
8317
+ extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], IImageElement);
8318
+
8319
+ IImageElement.prototype.createContent = function () {
8320
+
8321
+ var assetPath = this.globalData.getAssetsPath(this.assetData);
8322
+
8323
+ this.innerElem = createNS('image');
8324
+ this.innerElem.setAttribute('width', this.assetData.w + "px");
8325
+ this.innerElem.setAttribute('height', this.assetData.h + "px");
8326
+ this.innerElem.setAttribute('preserveAspectRatio', this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio);
8327
+ this.innerElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath);
8328
+
8329
+ this.layerElement.appendChild(this.innerElem);
8330
+ };
8331
+
8332
+ IImageElement.prototype.sourceRectAtTime = function () {
8333
+ return this.sourceRect;
8334
+ }
8335
+ function ISolidElement(data, globalData, comp) {
8336
+ this.initElement(data, globalData, comp);
8337
+ }
8338
+ extendPrototype([IImageElement], ISolidElement);
8339
+
8340
+ ISolidElement.prototype.createContent = function () {
8341
+
8342
+ var rect = createNS('rect');
8343
+ ////rect.style.width = this.data.sw;
8344
+ ////rect.style.height = this.data.sh;
8345
+ ////rect.style.fill = this.data.sc;
8346
+ rect.setAttribute('width', this.data.sw);
8347
+ rect.setAttribute('height', this.data.sh);
8348
+ rect.setAttribute('fill', this.data.sc);
8349
+ this.layerElement.appendChild(rect);
8350
+ };
8351
+ function SVGCompElement(data, globalData, comp) {
8352
+ this.layers = data.layers;
8353
+ this.supports3d = true;
8354
+ this.completeLayers = false;
8355
+ this.pendingElements = [];
8356
+ this.elements = this.layers ? createSizedArray(this.layers.length) : [];
8357
+ //this.layerElement = createNS('g');
8358
+ this.initElement(data, globalData, comp);
8359
+ this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true };
8360
+ }
8361
+
8362
+ extendPrototype([SVGRenderer, ICompElement, SVGBaseElement], SVGCompElement);
8363
+ function SVGTextElement(data, globalData, comp) {
8364
+ this.textSpans = [];
8365
+ this.renderType = 'svg';
8366
+ this.initElement(data, globalData, comp);
8367
+ }
8368
+
8369
+ extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], SVGTextElement);
8370
+
8371
+ SVGTextElement.prototype.createContent = function () {
8372
+
8373
+ if (this.data.singleShape && !this.globalData.fontManager.chars) {
8374
+ this.textContainer = createNS('text');
8375
+ }
8376
+ };
8377
+
8378
+ SVGTextElement.prototype.buildTextContents = function (textArray) {
8379
+ var i = 0, len = textArray.length;
8380
+ var textContents = [], currentTextContent = '';
8381
+ while (i < len) {
8382
+ if (textArray[i] === String.fromCharCode(13) || textArray[i] === String.fromCharCode(3)) {
8383
+ textContents.push(currentTextContent);
8384
+ currentTextContent = '';
8385
+ } else {
8386
+ currentTextContent += textArray[i];
8387
+ }
8388
+ i += 1;
8389
+ }
8390
+ textContents.push(currentTextContent);
8391
+ return textContents;
8392
+ }
8393
+
8394
+ SVGTextElement.prototype.buildNewText = function () {
8395
+ var i, len;
8396
+
8397
+ var documentData = this.textProperty.currentData;
8398
+ this.renderedLetters = createSizedArray(documentData ? documentData.l.length : 0);
8399
+ if (documentData.fc) {
8400
+ this.layerElement.setAttribute('fill', this.buildColor(documentData.fc));
8401
+ } else {
8402
+ this.layerElement.setAttribute('fill', 'rgba(0,0,0,0)');
8403
+ }
8404
+ if (documentData.sc) {
8405
+ this.layerElement.setAttribute('stroke', this.buildColor(documentData.sc));
8406
+ this.layerElement.setAttribute('stroke-width', documentData.sw);
8407
+ }
8408
+ this.layerElement.setAttribute('font-size', documentData.finalSize);
8409
+ var fontData = this.globalData.fontManager.getFontByName(documentData.f);
8410
+ if (fontData.fClass) {
8411
+ this.layerElement.setAttribute('class', fontData.fClass);
8412
+ } else {
8413
+ this.layerElement.setAttribute('font-family', fontData.fFamily);
8414
+ var fWeight = documentData.fWeight, fStyle = documentData.fStyle;
8415
+ this.layerElement.setAttribute('font-style', fStyle);
8416
+ this.layerElement.setAttribute('font-weight', fWeight);
8417
+ }
8418
+ this.layerElement.setAttribute('aria-label', documentData.t);
8419
+
8420
+ var letters = documentData.l || [];
8421
+ var usesGlyphs = !!this.globalData.fontManager.chars;
8422
+ len = letters.length;
8423
+
8424
+ var tSpan;
8425
+ var matrixHelper = this.mHelper;
8426
+ var shapes, shapeStr = '', singleShape = this.data.singleShape;
8427
+ var xPos = 0, yPos = 0, firstLine = true;
8428
+ var trackingOffset = documentData.tr / 1000 * documentData.finalSize;
8429
+ if (singleShape && !usesGlyphs && !documentData.sz) {
8430
+ var tElement = this.textContainer;
8431
+ var justify = 'start';
8432
+ switch (documentData.j) {
8433
+ case 1:
8434
+ justify = 'end';
8435
+ break;
8436
+ case 2:
8437
+ justify = 'middle';
8438
+ break;
8439
+ }
8440
+ tElement.setAttribute('text-anchor', justify);
8441
+ tElement.setAttribute('letter-spacing', trackingOffset);
8442
+ var textContent = this.buildTextContents(documentData.finalText);
8443
+ len = textContent.length;
8444
+ yPos = documentData.ps ? documentData.ps[1] + documentData.ascent : 0;
8445
+ for (i = 0; i < len; i += 1) {
8446
+ tSpan = this.textSpans[i] || createNS('tspan');
8447
+ tSpan.textContent = textContent[i];
8448
+ tSpan.setAttribute('x', 0);
8449
+ tSpan.setAttribute('y', yPos);
8450
+ tSpan.style.display = 'inherit';
8451
+ tElement.appendChild(tSpan);
8452
+ this.textSpans[i] = tSpan;
8453
+ yPos += documentData.finalLineHeight;
8454
+ }
8455
+
8456
+ this.layerElement.appendChild(tElement);
8457
+ } else {
8458
+ var cachedSpansLength = this.textSpans.length;
8459
+ var shapeData, charData;
8460
+ for (i = 0; i < len; i += 1) {
8461
+ if (!usesGlyphs || !singleShape || i === 0) {
8462
+ tSpan = cachedSpansLength > i ? this.textSpans[i] : createNS(usesGlyphs ? 'path' : 'text');
8463
+ if (cachedSpansLength <= i) {
8464
+ tSpan.setAttribute('stroke-linecap', 'butt');
8465
+ tSpan.setAttribute('stroke-linejoin', 'round');
8466
+ tSpan.setAttribute('stroke-miterlimit', '4');
8467
+ this.textSpans[i] = tSpan;
8468
+ this.layerElement.appendChild(tSpan);
8469
+ }
8470
+ tSpan.style.display = 'inherit';
8471
+ }
8472
+
8473
+ matrixHelper.reset();
8474
+ matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);
8475
+ if (singleShape) {
8476
+ if (letters[i].n) {
8477
+ xPos = -trackingOffset;
8478
+ yPos += documentData.yOffset;
8479
+ yPos += firstLine ? 1 : 0;
8480
+ firstLine = false;
8481
+ }
8482
+ this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);
8483
+ xPos += letters[i].l || 0;
8484
+ //xPos += letters[i].val === ' ' ? 0 : trackingOffset;
8485
+ xPos += trackingOffset;
8486
+ }
8487
+ if (usesGlyphs) {
8488
+ charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);
8489
+ shapeData = charData && charData.data || {};
8490
+ shapes = shapeData.shapes ? shapeData.shapes[0].it : [];
8491
+ if (!singleShape) {
8492
+ tSpan.setAttribute('d', this.createPathShape(matrixHelper, shapes));
8493
+ } else {
8494
+ shapeStr += this.createPathShape(matrixHelper, shapes);
8495
+ }
8496
+ } else {
8497
+ if (singleShape) {
8498
+ tSpan.setAttribute("transform", "translate(" + matrixHelper.props[12] + "," + matrixHelper.props[13] + ")");
8499
+ }
8500
+ tSpan.textContent = letters[i].val;
8501
+ tSpan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
8502
+ }
8503
+ //
8504
+ }
8505
+ if (singleShape && tSpan) {
8506
+ tSpan.setAttribute('d', shapeStr);
8507
+ }
8508
+ }
8509
+ while (i < this.textSpans.length) {
8510
+ this.textSpans[i].style.display = 'none';
8511
+ i += 1;
8512
+ }
8513
+
8514
+ this._sizeChanged = true;
8515
+ };
8516
+
8517
+ SVGTextElement.prototype.sourceRectAtTime = function (time) {
8518
+ this.prepareFrame(this.comp.renderedFrame - this.data.st);
8519
+ this.renderInnerContent();
8520
+ if (this._sizeChanged) {
8521
+ this._sizeChanged = false;
8522
+ var textBox = this.layerElement.getBBox();
8523
+ this.bbox = {
8524
+ top: textBox.y,
8525
+ left: textBox.x,
8526
+ width: textBox.width,
8527
+ height: textBox.height
8528
+ };
8529
+ }
8530
+ return this.bbox;
8531
+ };
8532
+
8533
+ SVGTextElement.prototype.renderInnerContent = function () {
8534
+
8535
+ if (!this.data.singleShape) {
8536
+ this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
8537
+ if (this.lettersChangedFlag || this.textAnimator.lettersChangedFlag) {
8538
+ this._sizeChanged = true;
8539
+ var i, len;
8540
+ var renderedLetters = this.textAnimator.renderedLetters;
8541
+
8542
+ var letters = this.textProperty.currentData.l;
8543
+
8544
+ len = letters.length;
8545
+ var renderedLetter, textSpan;
8546
+ for (i = 0; i < len; i += 1) {
8547
+ if (letters[i].n) {
8548
+ continue;
8549
+ }
8550
+ renderedLetter = renderedLetters[i];
8551
+ textSpan = this.textSpans[i];
8552
+ if (renderedLetter._mdf.m) {
8553
+ textSpan.setAttribute('transform', renderedLetter.m);
8554
+ }
8555
+ if (renderedLetter._mdf.o) {
8556
+ textSpan.setAttribute('opacity', renderedLetter.o);
8557
+ }
8558
+ if (renderedLetter._mdf.sw) {
8559
+ textSpan.setAttribute('stroke-width', renderedLetter.sw);
8560
+ }
8561
+ if (renderedLetter._mdf.sc) {
8562
+ textSpan.setAttribute('stroke', renderedLetter.sc);
8563
+ }
8564
+ if (renderedLetter._mdf.fc) {
8565
+ textSpan.setAttribute('fill', renderedLetter.fc);
8566
+ }
8567
+ }
8568
+ }
8569
+ }
8570
+ };
8571
+
8572
+ function SVGShapeElement(data, globalData, comp) {
8573
+ //List of drawable elements
8574
+ this.shapes = [];
8575
+ // Full shape data
8576
+ this.shapesData = data.shapes;
8577
+ //List of styles that will be applied to shapes
8578
+ this.stylesList = [];
8579
+ //List of modifiers that will be applied to shapes
8580
+ this.shapeModifiers = [];
8581
+ //List of items in shape tree
8582
+ this.itemsData = [];
8583
+ //List of items in previous shape tree
8584
+ this.processedElements = [];
8585
+ // List of animated components
8586
+ this.animatedContents = [];
8587
+ this.initElement(data, globalData, comp);
8588
+ //Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
8589
+ // List of elements that have been created
8590
+ this.prevViewData = [];
8591
+ //Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
8592
+ }
8593
+
8594
+ extendPrototype([BaseElement, TransformElement, SVGBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableDOMElement], SVGShapeElement);
8595
+
8596
+ SVGShapeElement.prototype.initSecondaryElement = function () {
8597
+ };
8598
+
8599
+ SVGShapeElement.prototype.identityMatrix = new Matrix();
8600
+
8601
+ SVGShapeElement.prototype.buildExpressionInterface = function () { };
8602
+
8603
+ SVGShapeElement.prototype.createContent = function () {
8604
+ this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true);
8605
+ this.filterUniqueShapes();
8606
+ };
8607
+
8608
+ /*
8609
+ This method searches for multiple shapes that affect a single element and one of them is animated
8610
+ */
8611
+ SVGShapeElement.prototype.filterUniqueShapes = function () {
8612
+ var i, len = this.shapes.length, shape;
8613
+ var j, jLen = this.stylesList.length;
8614
+ var style, count = 0;
8615
+ var tempShapes = [];
8616
+ var areAnimated = false;
8617
+ for (j = 0; j < jLen; j += 1) {
8618
+ style = this.stylesList[j];
8619
+ areAnimated = false;
8620
+ tempShapes.length = 0;
8621
+ for (i = 0; i < len; i += 1) {
8622
+ shape = this.shapes[i];
8623
+ if (shape.styles.indexOf(style) !== -1) {
8624
+ tempShapes.push(shape);
8625
+ areAnimated = shape._isAnimated || areAnimated;
8626
+ }
8627
+ }
8628
+ if (tempShapes.length > 1 && areAnimated) {
8629
+ this.setShapesAsAnimated(tempShapes);
8630
+ }
8631
+ }
8632
+ }
8633
+
8634
+ SVGShapeElement.prototype.setShapesAsAnimated = function (shapes) {
8635
+ var i, len = shapes.length;
8636
+ for (i = 0; i < len; i += 1) {
8637
+ shapes[i].setAsAnimated();
8638
+ }
8639
+ }
8640
+
8641
+ SVGShapeElement.prototype.createStyleElement = function (data, level) {
8642
+ //TODO: prevent drawing of hidden styles
8643
+ var elementData;
8644
+ var styleOb = new SVGStyleData(data, level);
8645
+
8646
+ var pathElement = styleOb.pElem;
8647
+ if (data.ty === 'st') {
8648
+ elementData = new SVGStrokeStyleData(this, data, styleOb);
8649
+ } else if (data.ty === 'fl') {
8650
+ elementData = new SVGFillStyleData(this, data, styleOb);
8651
+ } else if (data.ty === 'gf' || data.ty === 'gs') {
8652
+ var gradientConstructor = data.ty === 'gf' ? SVGGradientFillStyleData : SVGGradientStrokeStyleData;
8653
+ elementData = new gradientConstructor(this, data, styleOb);
8654
+ this.globalData.defs.appendChild(elementData.gf);
8655
+ if (elementData.maskId) {
8656
+ this.globalData.defs.appendChild(elementData.ms);
8657
+ this.globalData.defs.appendChild(elementData.of);
8658
+ pathElement.setAttribute('mask', 'url(' + locationHref + '#' + elementData.maskId + ')');
8659
+ }
8660
+ }
8661
+
8662
+ if (data.ty === 'st' || data.ty === 'gs') {
8663
+ pathElement.setAttribute('stroke-linecap', this.lcEnum[data.lc] || 'round');
8664
+ pathElement.setAttribute('stroke-linejoin', this.ljEnum[data.lj] || 'round');
8665
+ pathElement.setAttribute('fill-opacity', '0');
8666
+ if (data.lj === 1) {
8667
+ pathElement.setAttribute('stroke-miterlimit', data.ml);
8668
+ }
8669
+ }
8670
+
8671
+ if (data.r === 2) {
8672
+ pathElement.setAttribute('fill-rule', 'evenodd');
8673
+ }
8674
+
8675
+ if (data.ln) {
8676
+ pathElement.setAttribute('id', data.ln);
8677
+ }
8678
+ if (data.cl) {
8679
+ pathElement.setAttribute('class', data.cl);
8680
+ }
8681
+ if (data.bm) {
8682
+ pathElement.style['mix-blend-mode'] = getBlendMode(data.bm);
8683
+ }
8684
+ this.stylesList.push(styleOb);
8685
+ this.addToAnimatedContents(data, elementData);
8686
+ return elementData;
8687
+ };
8688
+
8689
+ SVGShapeElement.prototype.createGroupElement = function (data) {
8690
+ var elementData = new ShapeGroupData();
8691
+ if (data.ln) {
8692
+ elementData.gr.setAttribute('id', data.ln);
8693
+ }
8694
+ if (data.cl) {
8695
+ elementData.gr.setAttribute('class', data.cl);
8696
+ }
8697
+ if (data.bm) {
8698
+ elementData.gr.style['mix-blend-mode'] = getBlendMode(data.bm);
8699
+ }
8700
+ return elementData;
8701
+ };
8702
+
8703
+ SVGShapeElement.prototype.createTransformElement = function (data, container) {
8704
+ var transformProperty = TransformPropertyFactory.getTransformProperty(this, data, this);
8705
+ var elementData = new SVGTransformData(transformProperty, transformProperty.o, container);
8706
+ this.addToAnimatedContents(data, elementData);
8707
+ return elementData;
8708
+ };
8709
+
8710
+ SVGShapeElement.prototype.createShapeElement = function (data, ownTransformers, level) {
8711
+ var ty = 4;
8712
+ if (data.ty === 'rc') {
8713
+ ty = 5;
8714
+ } else if (data.ty === 'el') {
8715
+ ty = 6;
8716
+ } else if (data.ty === 'sr') {
8717
+ ty = 7;
8718
+ }
8719
+ var shapeProperty = ShapePropertyFactory.getShapeProp(this, data, ty, this);
8720
+ var elementData = new SVGShapeData(ownTransformers, level, shapeProperty);
8721
+ this.shapes.push(elementData);
8722
+ this.addShapeToModifiers(elementData);
8723
+ this.addToAnimatedContents(data, elementData);
8724
+ return elementData;
8725
+ };
8726
+
8727
+ SVGShapeElement.prototype.addToAnimatedContents = function (data, element) {
8728
+ var i = 0, len = this.animatedContents.length;
8729
+ while (i < len) {
8730
+ if (this.animatedContents[i].element === element) {
8731
+ return;
8732
+ }
8733
+ i += 1;
8734
+ }
8735
+ this.animatedContents.push({
8736
+ fn: SVGElementsRenderer.createRenderFunction(data),
8737
+ element: element,
8738
+ data: data
8739
+ });
8740
+ };
8741
+
8742
+ SVGShapeElement.prototype.setElementStyles = function (elementData) {
8743
+ var arr = elementData.styles;
8744
+ var j, jLen = this.stylesList.length;
8745
+ for (j = 0; j < jLen; j += 1) {
8746
+ if (!this.stylesList[j].closed) {
8747
+ arr.push(this.stylesList[j]);
8748
+ }
8749
+ }
8750
+ };
8751
+
8752
+ SVGShapeElement.prototype.reloadShapes = function () {
8753
+ this._isFirstFrame = true;
8754
+ var i, len = this.itemsData.length;
8755
+ for (i = 0; i < len; i += 1) {
8756
+ this.prevViewData[i] = this.itemsData[i];
8757
+ }
8758
+ this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true);
8759
+ this.filterUniqueShapes();
8760
+ len = this.dynamicProperties.length;
8761
+ for (i = 0; i < len; i += 1) {
8762
+ this.dynamicProperties[i].getValue();
8763
+ }
8764
+ this.renderModifiers();
8765
+ };
8766
+
8767
+ SVGShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, container, level, transformers, render) {
8768
+ var ownTransformers = [].concat(transformers);
8769
+ var i, len = arr.length - 1;
8770
+ var j, jLen;
8771
+ var ownStyles = [], ownModifiers = [], styleOb, currentTransform, modifier, processedPos;
8772
+ for (i = len; i >= 0; i -= 1) {
8773
+ processedPos = this.searchProcessedElement(arr[i]);
8774
+ if (!processedPos) {
8775
+ arr[i]._render = render;
8776
+ } else {
8777
+ itemsData[i] = prevViewData[processedPos - 1];
8778
+ }
8779
+ if (arr[i].ty == 'fl' || arr[i].ty == 'st' || arr[i].ty == 'gf' || arr[i].ty == 'gs') {
8780
+ if (!processedPos) {
8781
+ itemsData[i] = this.createStyleElement(arr[i], level);
8782
+ } else {
8783
+ itemsData[i].style.closed = false;
8784
+ }
8785
+ if (arr[i]._render) {
8786
+ container.appendChild(itemsData[i].style.pElem);
8787
+ }
8788
+ ownStyles.push(itemsData[i].style);
8789
+ } else if (arr[i].ty == 'gr') {
8790
+ if (!processedPos) {
8791
+ itemsData[i] = this.createGroupElement(arr[i]);
8792
+ } else {
8793
+ jLen = itemsData[i].it.length;
8794
+ for (j = 0; j < jLen; j += 1) {
8795
+ itemsData[i].prevViewData[j] = itemsData[i].it[j];
8796
+ }
8797
+ }
8798
+ this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, itemsData[i].gr, level + 1, ownTransformers, render);
8799
+ if (arr[i]._render) {
8800
+ container.appendChild(itemsData[i].gr);
8801
+ }
8802
+ } else if (arr[i].ty == 'tr') {
8803
+ if (!processedPos) {
8804
+ itemsData[i] = this.createTransformElement(arr[i], container);
8805
+ }
8806
+ currentTransform = itemsData[i].transform;
8807
+ ownTransformers.push(currentTransform);
8808
+ } else if (arr[i].ty == 'sh' || arr[i].ty == 'rc' || arr[i].ty == 'el' || arr[i].ty == 'sr') {
8809
+ if (!processedPos) {
8810
+ itemsData[i] = this.createShapeElement(arr[i], ownTransformers, level);
8811
+ }
8812
+ this.setElementStyles(itemsData[i]);
8813
+
8814
+ } else if (arr[i].ty == 'tm' || arr[i].ty == 'rd' || arr[i].ty == 'ms') {
8815
+ if (!processedPos) {
8816
+ modifier = ShapeModifiers.getModifier(arr[i].ty);
8817
+ modifier.init(this, arr[i]);
8818
+ itemsData[i] = modifier;
8819
+ this.shapeModifiers.push(modifier);
8820
+ } else {
8821
+ modifier = itemsData[i];
8822
+ modifier.closed = false;
8823
+ }
8824
+ ownModifiers.push(modifier);
8825
+ } else if (arr[i].ty == 'rp') {
8826
+ if (!processedPos) {
8827
+ modifier = ShapeModifiers.getModifier(arr[i].ty);
8828
+ itemsData[i] = modifier;
8829
+ modifier.init(this, arr, i, itemsData);
8830
+ this.shapeModifiers.push(modifier);
8831
+ render = false;
8832
+ } else {
8833
+ modifier = itemsData[i];
8834
+ modifier.closed = true;
8835
+ }
8836
+ ownModifiers.push(modifier);
8837
+ }
8838
+ this.addProcessedElement(arr[i], i + 1);
8839
+ }
8840
+ len = ownStyles.length;
8841
+ for (i = 0; i < len; i += 1) {
8842
+ ownStyles[i].closed = true;
8843
+ }
8844
+ len = ownModifiers.length;
8845
+ for (i = 0; i < len; i += 1) {
8846
+ ownModifiers[i].closed = true;
8847
+ }
8848
+ };
8849
+
8850
+ SVGShapeElement.prototype.renderInnerContent = function () {
8851
+ this.renderModifiers();
8852
+ var i, len = this.stylesList.length;
8853
+ for (i = 0; i < len; i += 1) {
8854
+ this.stylesList[i].reset();
8855
+ }
8856
+ this.renderShape();
8857
+
8858
+ for (i = 0; i < len; i += 1) {
8859
+ if (this.stylesList[i]._mdf || this._isFirstFrame) {
8860
+ if (this.stylesList[i].msElem) {
8861
+ this.stylesList[i].msElem.setAttribute('d', this.stylesList[i].d);
8862
+ //Adding M0 0 fixes same mask bug on all browsers
8863
+ this.stylesList[i].d = 'M0 0' + this.stylesList[i].d;
8864
+ }
8865
+ this.stylesList[i].pElem.setAttribute('d', this.stylesList[i].d || 'M0 0');
8866
+ }
8867
+ }
8868
+ };
8869
+
8870
+ SVGShapeElement.prototype.renderShape = function () {
8871
+ var i, len = this.animatedContents.length;
8872
+ var animatedContent;
8873
+ for (i = 0; i < len; i += 1) {
8874
+ animatedContent = this.animatedContents[i];
8875
+ if ((this._isFirstFrame || animatedContent.element._isAnimated) && animatedContent.data !== true) {
8876
+ animatedContent.fn(animatedContent.data, animatedContent.element, this._isFirstFrame);
8877
+ }
8878
+ }
8879
+ }
8880
+
8881
+ SVGShapeElement.prototype.destroy = function () {
8882
+ this.destroyBaseElement();
8883
+ this.shapesData = null;
8884
+ this.itemsData = null;
8885
+ };
8886
+
8887
+ function SVGTintFilter(filter, filterManager) {
8888
+ this.filterManager = filterManager;
8889
+ var feColorMatrix = createNS('feColorMatrix');
8890
+ feColorMatrix.setAttribute('type', 'matrix');
8891
+ feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB');
8892
+ feColorMatrix.setAttribute('values', '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0');
8893
+ feColorMatrix.setAttribute('result', 'f1');
8894
+ filter.appendChild(feColorMatrix);
8895
+ feColorMatrix = createNS('feColorMatrix');
8896
+ feColorMatrix.setAttribute('type', 'matrix');
8897
+ feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');
8898
+ feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');
8899
+ feColorMatrix.setAttribute('result', 'f2');
8900
+ filter.appendChild(feColorMatrix);
8901
+ this.matrixFilter = feColorMatrix;
8902
+ if (filterManager.effectElements[2].p.v !== 100 || filterManager.effectElements[2].p.k) {
8903
+ var feMerge = createNS('feMerge');
8904
+ filter.appendChild(feMerge);
8905
+ var feMergeNode;
8906
+ feMergeNode = createNS('feMergeNode');
8907
+ feMergeNode.setAttribute('in', 'SourceGraphic');
8908
+ feMerge.appendChild(feMergeNode);
8909
+ feMergeNode = createNS('feMergeNode');
8910
+ feMergeNode.setAttribute('in', 'f2');
8911
+ feMerge.appendChild(feMergeNode);
8912
+ }
8913
+ }
8914
+
8915
+ SVGTintFilter.prototype.renderFrame = function (forceRender) {
8916
+ if (forceRender || this.filterManager._mdf) {
8917
+ var colorBlack = this.filterManager.effectElements[0].p.v;
8918
+ var colorWhite = this.filterManager.effectElements[1].p.v;
8919
+ var opacity = this.filterManager.effectElements[2].p.v / 100;
8920
+ this.matrixFilter.setAttribute('values', (colorWhite[0] - colorBlack[0]) + ' 0 0 0 ' + colorBlack[0] + ' ' + (colorWhite[1] - colorBlack[1]) + ' 0 0 0 ' + colorBlack[1] + ' ' + (colorWhite[2] - colorBlack[2]) + ' 0 0 0 ' + colorBlack[2] + ' 0 0 0 ' + opacity + ' 0');
8921
+ }
8922
+ };
8923
+ function SVGFillFilter(filter, filterManager) {
8924
+ this.filterManager = filterManager;
8925
+ var feColorMatrix = createNS('feColorMatrix');
8926
+ feColorMatrix.setAttribute('type', 'matrix');
8927
+ feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');
8928
+ feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');
8929
+ filter.appendChild(feColorMatrix);
8930
+ this.matrixFilter = feColorMatrix;
8931
+ }
8932
+ SVGFillFilter.prototype.renderFrame = function (forceRender) {
8933
+ if (forceRender || this.filterManager._mdf) {
8934
+ var color = this.filterManager.effectElements[2].p.v;
8935
+ var opacity = this.filterManager.effectElements[6].p.v;
8936
+ this.matrixFilter.setAttribute('values', '0 0 0 0 ' + color[0] + ' 0 0 0 0 ' + color[1] + ' 0 0 0 0 ' + color[2] + ' 0 0 0 ' + opacity + ' 0');
8937
+ }
8938
+ };
8939
+ function SVGGaussianBlurEffect(filter, filterManager) {
8940
+ // Outset the filter region by 100% on all sides to accommodate blur expansion.
8941
+ filter.setAttribute('x', '-100%');
8942
+ filter.setAttribute('y', '-100%');
8943
+ filter.setAttribute('width', '300%');
8944
+ filter.setAttribute('height', '300%');
8945
+
8946
+ this.filterManager = filterManager;
8947
+ var feGaussianBlur = createNS('feGaussianBlur');
8948
+ filter.appendChild(feGaussianBlur);
8949
+ this.feGaussianBlur = feGaussianBlur;
8950
+ }
8951
+
8952
+ SVGGaussianBlurEffect.prototype.renderFrame = function (forceRender) {
8953
+ if (forceRender || this.filterManager._mdf) {
8954
+ // Empirical value, matching AE's blur appearance.
8955
+ var kBlurrinessToSigma = 0.3;
8956
+ var sigma = this.filterManager.effectElements[0].p.v * kBlurrinessToSigma;
8957
+
8958
+ // Dimensions mapping:
8959
+ //
8960
+ // 1 -> horizontal & vertical
8961
+ // 2 -> horizontal only
8962
+ // 3 -> vertical only
8963
+ //
8964
+ var dimensions = this.filterManager.effectElements[1].p.v;
8965
+ var sigmaX = (dimensions == 3) ? 0 : sigma;
8966
+ var sigmaY = (dimensions == 2) ? 0 : sigma;
8967
+
8968
+ this.feGaussianBlur.setAttribute('stdDeviation', sigmaX + " " + sigmaY);
8969
+
8970
+ // Repeat edges mapping:
8971
+ //
8972
+ // 0 -> off -> duplicate
8973
+ // 1 -> on -> wrap
8974
+ var edgeMode = (this.filterManager.effectElements[2].p.v == 1) ? 'wrap' : 'duplicate';
8975
+ this.feGaussianBlur.setAttribute('edgeMode', edgeMode);
8976
+ }
8977
+ }
8978
+ function SVGStrokeEffect(elem, filterManager) {
8979
+ this.initialized = false;
8980
+ this.filterManager = filterManager;
8981
+ this.elem = elem;
8982
+ this.paths = [];
8983
+ }
8984
+
8985
+ SVGStrokeEffect.prototype.initialize = function () {
8986
+
8987
+ var elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;
8988
+ var path, groupPath, i, len;
8989
+ if (this.filterManager.effectElements[1].p.v === 1) {
8990
+ len = this.elem.maskManager.masksProperties.length;
8991
+ i = 0;
8992
+ } else {
8993
+ i = this.filterManager.effectElements[0].p.v - 1;
8994
+ len = i + 1;
8995
+ }
8996
+ groupPath = createNS('g');
8997
+ groupPath.setAttribute('fill', 'none');
8998
+ groupPath.setAttribute('stroke-linecap', 'round');
8999
+ groupPath.setAttribute('stroke-dashoffset', 1);
9000
+ for (i; i < len; i += 1) {
9001
+ path = createNS('path');
9002
+ groupPath.appendChild(path);
9003
+ this.paths.push({ p: path, m: i });
9004
+ }
9005
+ if (this.filterManager.effectElements[10].p.v === 3) {
9006
+ var mask = createNS('mask');
9007
+ var id = createElementID();
9008
+ mask.setAttribute('id', id);
9009
+ mask.setAttribute('mask-type', 'alpha');
9010
+ mask.appendChild(groupPath);
9011
+ this.elem.globalData.defs.appendChild(mask);
9012
+ var g = createNS('g');
9013
+ g.setAttribute('mask', 'url(' + locationHref + '#' + id + ')');
9014
+ while (elemChildren[0]) {
9015
+ g.appendChild(elemChildren[0]);
9016
+ }
9017
+ this.elem.layerElement.appendChild(g);
9018
+ this.masker = mask;
9019
+ groupPath.setAttribute('stroke', '#fff');
9020
+ } else if (this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2) {
9021
+ if (this.filterManager.effectElements[10].p.v === 2) {
9022
+ elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;
9023
+ while (elemChildren.length) {
9024
+ this.elem.layerElement.removeChild(elemChildren[0]);
9025
+ }
9026
+ }
9027
+ this.elem.layerElement.appendChild(groupPath);
9028
+ this.elem.layerElement.removeAttribute('mask');
9029
+ groupPath.setAttribute('stroke', '#fff');
9030
+ }
9031
+ this.initialized = true;
9032
+ this.pathMasker = groupPath;
9033
+ };
9034
+
9035
+ SVGStrokeEffect.prototype.renderFrame = function (forceRender) {
9036
+ if (!this.initialized) {
9037
+ this.initialize();
9038
+ }
9039
+ var i, len = this.paths.length;
9040
+ var mask, path;
9041
+ for (i = 0; i < len; i += 1) {
9042
+ if (this.paths[i].m === -1) {
9043
+ continue;
9044
+ }
9045
+ mask = this.elem.maskManager.viewData[this.paths[i].m];
9046
+ path = this.paths[i].p;
9047
+ if (forceRender || this.filterManager._mdf || mask.prop._mdf) {
9048
+ path.setAttribute('d', mask.lastPath);
9049
+ }
9050
+ if (forceRender || this.filterManager.effectElements[9].p._mdf || this.filterManager.effectElements[4].p._mdf || this.filterManager.effectElements[7].p._mdf || this.filterManager.effectElements[8].p._mdf || mask.prop._mdf) {
9051
+ var dasharrayValue;
9052
+ if (this.filterManager.effectElements[7].p.v !== 0 || this.filterManager.effectElements[8].p.v !== 100) {
9053
+ var s = Math.min(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) / 100;
9054
+ var e = Math.max(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) / 100;
9055
+ var l = path.getTotalLength();
9056
+ dasharrayValue = '0 0 0 ' + l * s + ' ';
9057
+ var lineLength = l * (e - s);
9058
+ var segment = 1 + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v / 100;
9059
+ var units = Math.floor(lineLength / segment);
9060
+ var j;
9061
+ for (j = 0; j < units; j += 1) {
9062
+ dasharrayValue += '1 ' + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v / 100 + ' ';
9063
+ }
9064
+ dasharrayValue += '0 ' + l * 10 + ' 0 0';
9065
+ } else {
9066
+ dasharrayValue = '1 ' + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v / 100;
9067
+ }
9068
+ path.setAttribute('stroke-dasharray', dasharrayValue);
9069
+ }
9070
+ }
9071
+ if (forceRender || this.filterManager.effectElements[4].p._mdf) {
9072
+ this.pathMasker.setAttribute('stroke-width', this.filterManager.effectElements[4].p.v * 2);
9073
+ }
9074
+
9075
+ if (forceRender || this.filterManager.effectElements[6].p._mdf) {
9076
+ this.pathMasker.setAttribute('opacity', this.filterManager.effectElements[6].p.v);
9077
+ }
9078
+ if (this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2) {
9079
+ if (forceRender || this.filterManager.effectElements[3].p._mdf) {
9080
+ var color = this.filterManager.effectElements[3].p.v;
9081
+ this.pathMasker.setAttribute('stroke', 'rgb(' + bm_floor(color[0] * 255) + ',' + bm_floor(color[1] * 255) + ',' + bm_floor(color[2] * 255) + ')');
9082
+ }
9083
+ }
9084
+ };
9085
+ function SVGTritoneFilter(filter, filterManager) {
9086
+ this.filterManager = filterManager;
9087
+ var feColorMatrix = createNS('feColorMatrix');
9088
+ feColorMatrix.setAttribute('type', 'matrix');
9089
+ feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB');
9090
+ feColorMatrix.setAttribute('values', '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0');
9091
+ feColorMatrix.setAttribute('result', 'f1');
9092
+ filter.appendChild(feColorMatrix);
9093
+ var feComponentTransfer = createNS('feComponentTransfer');
9094
+ feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');
9095
+ filter.appendChild(feComponentTransfer);
9096
+ this.matrixFilter = feComponentTransfer;
9097
+ var feFuncR = createNS('feFuncR');
9098
+ feFuncR.setAttribute('type', 'table');
9099
+ feComponentTransfer.appendChild(feFuncR);
9100
+ this.feFuncR = feFuncR;
9101
+ var feFuncG = createNS('feFuncG');
9102
+ feFuncG.setAttribute('type', 'table');
9103
+ feComponentTransfer.appendChild(feFuncG);
9104
+ this.feFuncG = feFuncG;
9105
+ var feFuncB = createNS('feFuncB');
9106
+ feFuncB.setAttribute('type', 'table');
9107
+ feComponentTransfer.appendChild(feFuncB);
9108
+ this.feFuncB = feFuncB;
9109
+ }
9110
+
9111
+ SVGTritoneFilter.prototype.renderFrame = function (forceRender) {
9112
+ if (forceRender || this.filterManager._mdf) {
9113
+ var color1 = this.filterManager.effectElements[0].p.v;
9114
+ var color2 = this.filterManager.effectElements[1].p.v;
9115
+ var color3 = this.filterManager.effectElements[2].p.v;
9116
+ var tableR = color3[0] + ' ' + color2[0] + ' ' + color1[0];
9117
+ var tableG = color3[1] + ' ' + color2[1] + ' ' + color1[1];
9118
+ var tableB = color3[2] + ' ' + color2[2] + ' ' + color1[2];
9119
+ this.feFuncR.setAttribute('tableValues', tableR);
9120
+ this.feFuncG.setAttribute('tableValues', tableG);
9121
+ this.feFuncB.setAttribute('tableValues', tableB);
9122
+ //var opacity = this.filterManager.effectElements[2].p.v/100;
9123
+ //this.matrixFilter.setAttribute('values',(colorWhite[0]- colorBlack[0])+' 0 0 0 '+ colorBlack[0] +' '+ (colorWhite[1]- colorBlack[1]) +' 0 0 0 '+ colorBlack[1] +' '+ (colorWhite[2]- colorBlack[2]) +' 0 0 0 '+ colorBlack[2] +' 0 0 0 ' + opacity + ' 0');
9124
+ }
9125
+ };
9126
+ function SVGProLevelsFilter(filter, filterManager) {
9127
+ this.filterManager = filterManager;
9128
+ var effectElements = this.filterManager.effectElements;
9129
+ var feComponentTransfer = createNS('feComponentTransfer');
9130
+ var feFuncR, feFuncG, feFuncB;
9131
+
9132
+ if (effectElements[10].p.k || effectElements[10].p.v !== 0 || effectElements[11].p.k || effectElements[11].p.v !== 1 || effectElements[12].p.k || effectElements[12].p.v !== 1 || effectElements[13].p.k || effectElements[13].p.v !== 0 || effectElements[14].p.k || effectElements[14].p.v !== 1) {
9133
+ this.feFuncR = this.createFeFunc('feFuncR', feComponentTransfer);
9134
+ }
9135
+ if (effectElements[17].p.k || effectElements[17].p.v !== 0 || effectElements[18].p.k || effectElements[18].p.v !== 1 || effectElements[19].p.k || effectElements[19].p.v !== 1 || effectElements[20].p.k || effectElements[20].p.v !== 0 || effectElements[21].p.k || effectElements[21].p.v !== 1) {
9136
+ this.feFuncG = this.createFeFunc('feFuncG', feComponentTransfer);
9137
+ }
9138
+ if (effectElements[24].p.k || effectElements[24].p.v !== 0 || effectElements[25].p.k || effectElements[25].p.v !== 1 || effectElements[26].p.k || effectElements[26].p.v !== 1 || effectElements[27].p.k || effectElements[27].p.v !== 0 || effectElements[28].p.k || effectElements[28].p.v !== 1) {
9139
+ this.feFuncB = this.createFeFunc('feFuncB', feComponentTransfer);
9140
+ }
9141
+ if (effectElements[31].p.k || effectElements[31].p.v !== 0 || effectElements[32].p.k || effectElements[32].p.v !== 1 || effectElements[33].p.k || effectElements[33].p.v !== 1 || effectElements[34].p.k || effectElements[34].p.v !== 0 || effectElements[35].p.k || effectElements[35].p.v !== 1) {
9142
+ this.feFuncA = this.createFeFunc('feFuncA', feComponentTransfer);
9143
+ }
9144
+
9145
+ if (this.feFuncR || this.feFuncG || this.feFuncB || this.feFuncA) {
9146
+ feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');
9147
+ filter.appendChild(feComponentTransfer);
9148
+ feComponentTransfer = createNS('feComponentTransfer');
9149
+ }
9150
+
9151
+ if (effectElements[3].p.k || effectElements[3].p.v !== 0 || effectElements[4].p.k || effectElements[4].p.v !== 1 || effectElements[5].p.k || effectElements[5].p.v !== 1 || effectElements[6].p.k || effectElements[6].p.v !== 0 || effectElements[7].p.k || effectElements[7].p.v !== 1) {
9152
+
9153
+ feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');
9154
+ filter.appendChild(feComponentTransfer);
9155
+ this.feFuncRComposed = this.createFeFunc('feFuncR', feComponentTransfer);
9156
+ this.feFuncGComposed = this.createFeFunc('feFuncG', feComponentTransfer);
9157
+ this.feFuncBComposed = this.createFeFunc('feFuncB', feComponentTransfer);
9158
+ }
9159
+ }
9160
+
9161
+ SVGProLevelsFilter.prototype.createFeFunc = function (type, feComponentTransfer) {
9162
+ var feFunc = createNS(type);
9163
+ feFunc.setAttribute('type', 'table');
9164
+ feComponentTransfer.appendChild(feFunc);
9165
+ return feFunc;
9166
+ };
9167
+
9168
+ SVGProLevelsFilter.prototype.getTableValue = function (inputBlack, inputWhite, gamma, outputBlack, outputWhite) {
9169
+ var cnt = 0;
9170
+ var segments = 256;
9171
+ var perc;
9172
+ var min = Math.min(inputBlack, inputWhite);
9173
+ var max = Math.max(inputBlack, inputWhite);
9174
+ var table = Array.call(null, { length: segments });
9175
+ var colorValue;
9176
+ var pos = 0;
9177
+ var outputDelta = outputWhite - outputBlack;
9178
+ var inputDelta = inputWhite - inputBlack;
9179
+ while (cnt <= 256) {
9180
+ perc = cnt / 256;
9181
+ if (perc <= min) {
9182
+ colorValue = inputDelta < 0 ? outputWhite : outputBlack;
9183
+ } else if (perc >= max) {
9184
+ colorValue = inputDelta < 0 ? outputBlack : outputWhite;
9185
+ } else {
9186
+ colorValue = (outputBlack + outputDelta * Math.pow((perc - inputBlack) / inputDelta, 1 / gamma));
9187
+ }
9188
+ table[pos++] = colorValue;
9189
+ cnt += 256 / (segments - 1);
9190
+ }
9191
+ return table.join(' ');
9192
+ };
9193
+
9194
+ SVGProLevelsFilter.prototype.renderFrame = function (forceRender) {
9195
+ if (forceRender || this.filterManager._mdf) {
9196
+ var val, cnt, perc, bezier;
9197
+ var effectElements = this.filterManager.effectElements;
9198
+ if (this.feFuncRComposed && (forceRender || effectElements[3].p._mdf || effectElements[4].p._mdf || effectElements[5].p._mdf || effectElements[6].p._mdf || effectElements[7].p._mdf)) {
9199
+ val = this.getTableValue(effectElements[3].p.v, effectElements[4].p.v, effectElements[5].p.v, effectElements[6].p.v, effectElements[7].p.v);
9200
+ this.feFuncRComposed.setAttribute('tableValues', val);
9201
+ this.feFuncGComposed.setAttribute('tableValues', val);
9202
+ this.feFuncBComposed.setAttribute('tableValues', val);
9203
+ }
9204
+
9205
+
9206
+ if (this.feFuncR && (forceRender || effectElements[10].p._mdf || effectElements[11].p._mdf || effectElements[12].p._mdf || effectElements[13].p._mdf || effectElements[14].p._mdf)) {
9207
+ val = this.getTableValue(effectElements[10].p.v, effectElements[11].p.v, effectElements[12].p.v, effectElements[13].p.v, effectElements[14].p.v);
9208
+ this.feFuncR.setAttribute('tableValues', val);
9209
+ }
9210
+
9211
+ if (this.feFuncG && (forceRender || effectElements[17].p._mdf || effectElements[18].p._mdf || effectElements[19].p._mdf || effectElements[20].p._mdf || effectElements[21].p._mdf)) {
9212
+ val = this.getTableValue(effectElements[17].p.v, effectElements[18].p.v, effectElements[19].p.v, effectElements[20].p.v, effectElements[21].p.v);
9213
+ this.feFuncG.setAttribute('tableValues', val);
9214
+ }
9215
+
9216
+ if (this.feFuncB && (forceRender || effectElements[24].p._mdf || effectElements[25].p._mdf || effectElements[26].p._mdf || effectElements[27].p._mdf || effectElements[28].p._mdf)) {
9217
+ val = this.getTableValue(effectElements[24].p.v, effectElements[25].p.v, effectElements[26].p.v, effectElements[27].p.v, effectElements[28].p.v);
9218
+ this.feFuncB.setAttribute('tableValues', val);
9219
+ }
9220
+
9221
+ if (this.feFuncA && (forceRender || effectElements[31].p._mdf || effectElements[32].p._mdf || effectElements[33].p._mdf || effectElements[34].p._mdf || effectElements[35].p._mdf)) {
9222
+ val = this.getTableValue(effectElements[31].p.v, effectElements[32].p.v, effectElements[33].p.v, effectElements[34].p.v, effectElements[35].p.v);
9223
+ this.feFuncA.setAttribute('tableValues', val);
9224
+ }
9225
+
9226
+ }
9227
+ };
9228
+ function SVGDropShadowEffect(filter, filterManager) {
9229
+ var filterSize = filterManager.container.globalData.renderConfig.filterSize
9230
+ filter.setAttribute('x', filterSize.x);
9231
+ filter.setAttribute('y', filterSize.y);
9232
+ filter.setAttribute('width', filterSize.width);
9233
+ filter.setAttribute('height', filterSize.height);
9234
+ this.filterManager = filterManager;
9235
+
9236
+ var feGaussianBlur = createNS('feGaussianBlur');
9237
+ feGaussianBlur.setAttribute('in', 'SourceAlpha');
9238
+ feGaussianBlur.setAttribute('result', 'drop_shadow_1');
9239
+ feGaussianBlur.setAttribute('stdDeviation', '0');
9240
+ this.feGaussianBlur = feGaussianBlur;
9241
+ filter.appendChild(feGaussianBlur);
9242
+
9243
+ var feOffset = createNS('feOffset');
9244
+ feOffset.setAttribute('dx', '25');
9245
+ feOffset.setAttribute('dy', '0');
9246
+ feOffset.setAttribute('in', 'drop_shadow_1');
9247
+ feOffset.setAttribute('result', 'drop_shadow_2');
9248
+ this.feOffset = feOffset;
9249
+ filter.appendChild(feOffset);
9250
+ var feFlood = createNS('feFlood');
9251
+ feFlood.setAttribute('flood-color', '#00ff00');
9252
+ feFlood.setAttribute('flood-opacity', '1');
9253
+ feFlood.setAttribute('result', 'drop_shadow_3');
9254
+ this.feFlood = feFlood;
9255
+ filter.appendChild(feFlood);
9256
+
9257
+ var feComposite = createNS('feComposite');
9258
+ feComposite.setAttribute('in', 'drop_shadow_3');
9259
+ feComposite.setAttribute('in2', 'drop_shadow_2');
9260
+ feComposite.setAttribute('operator', 'in');
9261
+ feComposite.setAttribute('result', 'drop_shadow_4');
9262
+ filter.appendChild(feComposite);
9263
+
9264
+
9265
+ var feMerge = createNS('feMerge');
9266
+ filter.appendChild(feMerge);
9267
+ var feMergeNode;
9268
+ feMergeNode = createNS('feMergeNode');
9269
+ feMerge.appendChild(feMergeNode);
9270
+ feMergeNode = createNS('feMergeNode');
9271
+ feMergeNode.setAttribute('in', 'SourceGraphic');
9272
+ this.feMergeNode = feMergeNode;
9273
+ this.feMerge = feMerge;
9274
+ this.originalNodeAdded = false;
9275
+ feMerge.appendChild(feMergeNode);
9276
+ }
9277
+
9278
+ SVGDropShadowEffect.prototype.renderFrame = function (forceRender) {
9279
+ if (forceRender || this.filterManager._mdf) {
9280
+ if (forceRender || this.filterManager.effectElements[4].p._mdf) {
9281
+ this.feGaussianBlur.setAttribute('stdDeviation', this.filterManager.effectElements[4].p.v / 4);
9282
+ }
9283
+ if (forceRender || this.filterManager.effectElements[0].p._mdf) {
9284
+ var col = this.filterManager.effectElements[0].p.v;
9285
+ this.feFlood.setAttribute('flood-color', rgbToHex(Math.round(col[0] * 255), Math.round(col[1] * 255), Math.round(col[2] * 255)));
9286
+ }
9287
+ if (forceRender || this.filterManager.effectElements[1].p._mdf) {
9288
+ this.feFlood.setAttribute('flood-opacity', this.filterManager.effectElements[1].p.v / 255);
9289
+ }
9290
+ if (forceRender || this.filterManager.effectElements[2].p._mdf || this.filterManager.effectElements[3].p._mdf) {
9291
+ var distance = this.filterManager.effectElements[3].p.v;
9292
+ var angle = (this.filterManager.effectElements[2].p.v - 90) * degToRads;
9293
+ var x = distance * Math.cos(angle);
9294
+ var y = distance * Math.sin(angle);
9295
+ this.feOffset.setAttribute('dx', x);
9296
+ this.feOffset.setAttribute('dy', y);
9297
+ }
9298
+ /*if(forceRender || this.filterManager.effectElements[5].p._mdf){
9299
+ if(this.filterManager.effectElements[5].p.v === 1 && this.originalNodeAdded) {
9300
+ this.feMerge.removeChild(this.feMergeNode);
9301
+ this.originalNodeAdded = false;
9302
+ } else if(this.filterManager.effectElements[5].p.v === 0 && !this.originalNodeAdded) {
9303
+ this.feMerge.appendChild(this.feMergeNode);
9304
+ this.originalNodeAdded = true;
9305
+ }
9306
+ }*/
9307
+ }
9308
+ };
9309
+ var _svgMatteSymbols = [];
9310
+
9311
+ function SVGMatte3Effect(filterElem, filterManager, elem) {
9312
+ this.initialized = false;
9313
+ this.filterManager = filterManager;
9314
+ this.filterElem = filterElem;
9315
+ this.elem = elem;
9316
+ elem.matteElement = createNS('g');
9317
+ elem.matteElement.appendChild(elem.layerElement);
9318
+ elem.matteElement.appendChild(elem.transformedElement);
9319
+ elem.baseElement = elem.matteElement;
9320
+ }
9321
+
9322
+ SVGMatte3Effect.prototype.findSymbol = function (mask) {
9323
+ var i = 0, len = _svgMatteSymbols.length;
9324
+ while (i < len) {
9325
+ if (_svgMatteSymbols[i] === mask) {
9326
+ return _svgMatteSymbols[i];
9327
+ }
9328
+ i += 1;
9329
+ }
9330
+ return null;
9331
+ };
9332
+
9333
+ SVGMatte3Effect.prototype.replaceInParent = function (mask, symbolId) {
9334
+ var parentNode = mask.layerElement.parentNode;
9335
+ if (!parentNode) {
9336
+ return;
9337
+ }
9338
+ var children = parentNode.children;
9339
+ var i = 0, len = children.length;
9340
+ while (i < len) {
9341
+ if (children[i] === mask.layerElement) {
9342
+ break;
9343
+ }
9344
+ i += 1;
9345
+ }
9346
+ var nextChild;
9347
+ if (i <= len - 2) {
9348
+ nextChild = children[i + 1];
9349
+ }
9350
+ var useElem = createNS('use');
9351
+ useElem.setAttribute('href', '#' + symbolId);
9352
+ if (nextChild) {
9353
+ parentNode.insertBefore(useElem, nextChild);
9354
+ } else {
9355
+ parentNode.appendChild(useElem);
9356
+ }
9357
+ };
9358
+
9359
+ SVGMatte3Effect.prototype.setElementAsMask = function (elem, mask) {
9360
+ if (!this.findSymbol(mask)) {
9361
+ var symbolId = createElementID();
9362
+ var masker = createNS('mask');
9363
+ masker.setAttribute('id', mask.layerId);
9364
+ masker.setAttribute('mask-type', 'alpha');
9365
+ _svgMatteSymbols.push(mask);
9366
+ var defs = elem.globalData.defs;
9367
+ defs.appendChild(masker);
9368
+ var symbol = createNS('symbol');
9369
+ symbol.setAttribute('id', symbolId);
9370
+ this.replaceInParent(mask, symbolId);
9371
+ symbol.appendChild(mask.layerElement);
9372
+ defs.appendChild(symbol);
9373
+ var useElem = createNS('use');
9374
+ useElem.setAttribute('href', '#' + symbolId);
9375
+ masker.appendChild(useElem);
9376
+ mask.data.hd = false;
9377
+ mask.show();
9378
+ }
9379
+ elem.setMatte(mask.layerId);
9380
+ };
9381
+
9382
+ SVGMatte3Effect.prototype.initialize = function () {
9383
+ var ind = this.filterManager.effectElements[0].p.v;
9384
+ var elements = this.elem.comp.elements;
9385
+ var i = 0, len = elements.length;
9386
+ while (i < len) {
9387
+ if (elements[i] && elements[i].data.ind === ind) {
9388
+ this.setElementAsMask(this.elem, elements[i]);
9389
+ }
9390
+ i += 1;
9391
+ }
9392
+ this.initialized = true;
9393
+ };
9394
+
9395
+ SVGMatte3Effect.prototype.renderFrame = function () {
9396
+ if (!this.initialized) {
9397
+ this.initialize();
9398
+ }
9399
+ };
9400
+ function SVGEffects(elem) {
9401
+ var i, len = elem.data.ef ? elem.data.ef.length : 0;
9402
+ var filId = createElementID();
9403
+ var fil = filtersFactory.createFilter(filId);
9404
+ var count = 0;
9405
+ this.filters = [];
9406
+ var filterManager;
9407
+ for (i = 0; i < len; i += 1) {
9408
+ filterManager = null;
9409
+ if (elem.data.ef[i].ty === 20) {
9410
+ count += 1;
9411
+ filterManager = new SVGTintFilter(fil, elem.effectsManager.effectElements[i]);
9412
+ } else if (elem.data.ef[i].ty === 21) {
9413
+ count += 1;
9414
+ filterManager = new SVGFillFilter(fil, elem.effectsManager.effectElements[i]);
9415
+ } else if (elem.data.ef[i].ty === 22) {
9416
+ filterManager = new SVGStrokeEffect(elem, elem.effectsManager.effectElements[i]);
9417
+ } else if (elem.data.ef[i].ty === 23) {
9418
+ count += 1;
9419
+ filterManager = new SVGTritoneFilter(fil, elem.effectsManager.effectElements[i]);
9420
+ } else if (elem.data.ef[i].ty === 24) {
9421
+ count += 1;
9422
+ filterManager = new SVGProLevelsFilter(fil, elem.effectsManager.effectElements[i]);
9423
+ } else if (elem.data.ef[i].ty === 25) {
9424
+ count += 1;
9425
+ filterManager = new SVGDropShadowEffect(fil, elem.effectsManager.effectElements[i]);
9426
+ } else if (elem.data.ef[i].ty === 28) {
9427
+ //count += 1;
9428
+ filterManager = new SVGMatte3Effect(fil, elem.effectsManager.effectElements[i], elem);
9429
+ } else if (elem.data.ef[i].ty === 29) {
9430
+ count += 1;
9431
+ filterManager = new SVGGaussianBlurEffect(fil, elem.effectsManager.effectElements[i]);
9432
+ }
9433
+ if (filterManager) {
9434
+ this.filters.push(filterManager);
9435
+ }
9436
+ }
9437
+ if (count) {
9438
+ elem.globalData.defs.appendChild(fil);
9439
+ elem.layerElement.setAttribute('filter', 'url(' + locationHref + '#' + filId + ')');
9440
+ }
9441
+ if (this.filters.length) {
9442
+ elem.addRenderableComponent(this);
9443
+ }
9444
+ }
9445
+
9446
+ SVGEffects.prototype.renderFrame = function (_isFirstFrame) {
9447
+ var i, len = this.filters.length;
9448
+ for (i = 0; i < len; i += 1) {
9449
+ this.filters[i].renderFrame(_isFirstFrame);
9450
+ }
9451
+ };
9452
+ function CVContextData() {
9453
+ this.saved = [];
9454
+ this.cArrPos = 0;
9455
+ this.cTr = new Matrix();
9456
+ this.cO = 1;
9457
+ var i, len = 15;
9458
+ this.savedOp = createTypedArray('float32', len);
9459
+ for (i = 0; i < len; i += 1) {
9460
+ this.saved[i] = createTypedArray('float32', 16);
9461
+ }
9462
+ this._length = len;
9463
+ }
9464
+
9465
+ CVContextData.prototype.duplicate = function () {
9466
+ var newLength = this._length * 2;
9467
+ var currentSavedOp = this.savedOp;
9468
+ this.savedOp = createTypedArray('float32', newLength);
9469
+ this.savedOp.set(currentSavedOp);
9470
+ var i = 0;
9471
+ for (i = this._length; i < newLength; i += 1) {
9472
+ this.saved[i] = createTypedArray('float32', 16);
9473
+ }
9474
+ this._length = newLength;
9475
+ };
9476
+
9477
+ CVContextData.prototype.reset = function () {
9478
+ this.cArrPos = 0;
9479
+ this.cTr.reset();
9480
+ this.cO = 1;
9481
+ };
9482
+ function CVBaseElement() {
9483
+ }
9484
+
9485
+ CVBaseElement.prototype = {
9486
+ createElements: function () { },
9487
+ initRendererElement: function () { },
9488
+ createContainerElements: function () {
9489
+ this.canvasContext = this.globalData.canvasContext;
9490
+ this.renderableEffectsManager = new CVEffects(this);
9491
+ },
9492
+ createContent: function () { },
9493
+ setBlendMode: function () {
9494
+ var globalData = this.globalData;
9495
+ if (globalData.blendMode !== this.data.bm) {
9496
+ globalData.blendMode = this.data.bm;
9497
+ var blendModeValue = getBlendMode(this.data.bm);
9498
+ globalData.canvasContext.globalCompositeOperation = blendModeValue;
9499
+ }
9500
+ },
9501
+ createRenderableComponents: function () {
9502
+ this.maskManager = new CVMaskElement(this.data, this);
9503
+ },
9504
+ hideElement: function () {
9505
+ if (!this.hidden && (!this.isInRange || this.isTransparent)) {
9506
+ this.hidden = true;
9507
+ }
9508
+ },
9509
+ showElement: function () {
9510
+ if (this.isInRange && !this.isTransparent) {
9511
+ this.hidden = false;
9512
+ this._isFirstFrame = true;
9513
+ this.maskManager._isFirstFrame = true;
9514
+ }
9515
+ },
9516
+ renderFrame: function () {
9517
+ if (this.hidden || this.data.hd) {
9518
+ return;
9519
+ }
9520
+ this.renderTransform();
9521
+ this.renderRenderable();
9522
+ this.setBlendMode();
9523
+ var forceRealStack = this.data.ty === 0;
9524
+ this.globalData.renderer.save(forceRealStack);
9525
+ this.globalData.renderer.ctxTransform(this.finalTransform.mat.props);
9526
+ this.globalData.renderer.ctxOpacity(this.finalTransform.mProp.o.v);
9527
+ this.renderInnerContent();
9528
+ this.globalData.renderer.restore(forceRealStack);
9529
+ if (this.maskManager.hasMasks) {
9530
+ this.globalData.renderer.restore(true);
9531
+ }
9532
+ if (this._isFirstFrame) {
9533
+ this._isFirstFrame = false;
9534
+ }
9535
+ },
9536
+ destroy: function () {
9537
+ this.canvasContext = null;
9538
+ this.data = null;
9539
+ this.globalData = null;
9540
+ this.maskManager.destroy();
9541
+ },
9542
+ mHelper: new Matrix()
9543
+ };
9544
+ CVBaseElement.prototype.hide = CVBaseElement.prototype.hideElement;
9545
+ CVBaseElement.prototype.show = CVBaseElement.prototype.showElement;
9546
+
9547
+ function CVImageElement(data, globalData, comp) {
9548
+ this.assetData = globalData.getAssetData(data.refId);
9549
+ this.img = globalData.imageLoader.getImage(this.assetData);
9550
+ this.initElement(data, globalData, comp);
9551
+ }
9552
+ extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVImageElement);
9553
+
9554
+ CVImageElement.prototype.initElement = SVGShapeElement.prototype.initElement;
9555
+ CVImageElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;
9556
+
9557
+ CVImageElement.prototype.createContent = function () {
9558
+
9559
+ if (this.img.width && (this.assetData.w !== this.img.width || this.assetData.h !== this.img.height)) {
9560
+ var canvas = createTag('canvas');
9561
+ canvas.width = this.assetData.w;
9562
+ canvas.height = this.assetData.h;
9563
+ var ctx = canvas.getContext('2d');
9564
+
9565
+ var imgW = this.img.width;
9566
+ var imgH = this.img.height;
9567
+ var imgRel = imgW / imgH;
9568
+ var canvasRel = this.assetData.w / this.assetData.h;
9569
+ var widthCrop, heightCrop;
9570
+ var par = this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio;
9571
+ if ((imgRel > canvasRel && par === 'xMidYMid slice') || (imgRel < canvasRel && par !== 'xMidYMid slice')) {
9572
+ heightCrop = imgH;
9573
+ widthCrop = heightCrop * canvasRel;
9574
+ } else {
9575
+ widthCrop = imgW;
9576
+ heightCrop = widthCrop / canvasRel;
9577
+ }
9578
+ ctx.drawImage(this.img, (imgW - widthCrop) / 2, (imgH - heightCrop) / 2, widthCrop, heightCrop, 0, 0, this.assetData.w, this.assetData.h);
9579
+ this.img = canvas;
9580
+ }
9581
+
9582
+ };
9583
+
9584
+ CVImageElement.prototype.renderInnerContent = function (parentMatrix) {
9585
+ this.canvasContext.drawImage(this.img, 0, 0);
9586
+ };
9587
+
9588
+ CVImageElement.prototype.destroy = function () {
9589
+ this.img = null;
9590
+ };
9591
+ function CVCompElement(data, globalData, comp) {
9592
+ this.completeLayers = false;
9593
+ this.layers = data.layers;
9594
+ this.pendingElements = [];
9595
+ this.elements = createSizedArray(this.layers.length);
9596
+ this.initElement(data, globalData, comp);
9597
+ this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true };
9598
+ }
9599
+
9600
+ extendPrototype([CanvasRenderer, ICompElement, CVBaseElement], CVCompElement);
9601
+
9602
+ CVCompElement.prototype.renderInnerContent = function () {
9603
+ var ctx = this.canvasContext;
9604
+ ctx.beginPath();
9605
+ ctx.moveTo(0, 0);
9606
+ ctx.lineTo(this.data.w, 0);
9607
+ ctx.lineTo(this.data.w, this.data.h);
9608
+ ctx.lineTo(0, this.data.h);
9609
+ ctx.lineTo(0, 0);
9610
+ ctx.clip();
9611
+ var i, len = this.layers.length;
9612
+ for (i = len - 1; i >= 0; i -= 1) {
9613
+ if (this.completeLayers || this.elements[i]) {
9614
+ this.elements[i].renderFrame();
9615
+ }
9616
+ }
9617
+ };
9618
+
9619
+ CVCompElement.prototype.destroy = function () {
9620
+ var i, len = this.layers.length;
9621
+ for (i = len - 1; i >= 0; i -= 1) {
9622
+ if (this.elements[i]) {
9623
+ this.elements[i].destroy();
9624
+ }
9625
+ }
9626
+ this.layers = null;
9627
+ this.elements = null;
9628
+ };
9629
+
9630
+ function CVMaskElement(data, element) {
9631
+ this.data = data;
9632
+ this.element = element;
9633
+ this.masksProperties = this.data.masksProperties || [];
9634
+ this.viewData = createSizedArray(this.masksProperties.length);
9635
+ var i, len = this.masksProperties.length, hasMasks = false;
9636
+ for (i = 0; i < len; i++) {
9637
+ if (this.masksProperties[i].mode !== 'n') {
9638
+ hasMasks = true;
9639
+ }
9640
+ this.viewData[i] = ShapePropertyFactory.getShapeProp(this.element, this.masksProperties[i], 3);
9641
+ }
9642
+ this.hasMasks = hasMasks;
9643
+ if (hasMasks) {
9644
+ this.element.addRenderableComponent(this);
9645
+ }
9646
+ }
9647
+
9648
+ CVMaskElement.prototype.renderFrame = function () {
9649
+ if (!this.hasMasks) {
9650
+ return;
9651
+ }
9652
+ var transform = this.element.finalTransform.mat;
9653
+ var ctx = this.element.canvasContext;
9654
+ var i, len = this.masksProperties.length;
9655
+ var pt, pts, data;
9656
+ ctx.beginPath();
9657
+ for (i = 0; i < len; i++) {
9658
+ if (this.masksProperties[i].mode !== 'n') {
9659
+ if (this.masksProperties[i].inv) {
9660
+ ctx.moveTo(0, 0);
9661
+ ctx.lineTo(this.element.globalData.compSize.w, 0);
9662
+ ctx.lineTo(this.element.globalData.compSize.w, this.element.globalData.compSize.h);
9663
+ ctx.lineTo(0, this.element.globalData.compSize.h);
9664
+ ctx.lineTo(0, 0);
9665
+ }
9666
+ data = this.viewData[i].v;
9667
+ pt = transform.applyToPointArray(data.v[0][0], data.v[0][1], 0);
9668
+ ctx.moveTo(pt[0], pt[1]);
9669
+ var j, jLen = data._length;
9670
+ for (j = 1; j < jLen; j++) {
9671
+ pts = transform.applyToTriplePoints(data.o[j - 1], data.i[j], data.v[j]);
9672
+ ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);
9673
+ }
9674
+ pts = transform.applyToTriplePoints(data.o[j - 1], data.i[0], data.v[0]);
9675
+ ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);
9676
+ }
9677
+ }
9678
+ this.element.globalData.renderer.save(true);
9679
+ ctx.clip();
9680
+ };
9681
+
9682
+ CVMaskElement.prototype.getMaskProperty = MaskElement.prototype.getMaskProperty;
9683
+
9684
+ CVMaskElement.prototype.destroy = function () {
9685
+ this.element = null;
9686
+ };
9687
+ function CVShapeElement(data, globalData, comp) {
9688
+ this.shapes = [];
9689
+ this.shapesData = data.shapes;
9690
+ this.stylesList = [];
9691
+ this.itemsData = [];
9692
+ this.prevViewData = [];
9693
+ this.shapeModifiers = [];
9694
+ this.processedElements = [];
9695
+ this.transformsManager = new ShapeTransformManager();
9696
+ this.initElement(data, globalData, comp);
9697
+ }
9698
+
9699
+ extendPrototype([BaseElement, TransformElement, CVBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableElement], CVShapeElement);
9700
+
9701
+ CVShapeElement.prototype.initElement = RenderableDOMElement.prototype.initElement;
9702
+
9703
+ CVShapeElement.prototype.transformHelper = { opacity: 1, _opMdf: false };
9704
+
9705
+ CVShapeElement.prototype.dashResetter = [];
9706
+
9707
+ CVShapeElement.prototype.createContent = function () {
9708
+ this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []);
9709
+ };
9710
+
9711
+ CVShapeElement.prototype.createStyleElement = function (data, transforms) {
9712
+ var styleElem = {
9713
+ data: data,
9714
+ type: data.ty,
9715
+ preTransforms: this.transformsManager.addTransformSequence(transforms),
9716
+ transforms: [],
9717
+ elements: [],
9718
+ closed: data.hd === true
9719
+ };
9720
+ var elementData = {};
9721
+ if (data.ty == 'fl' || data.ty == 'st') {
9722
+ elementData.c = PropertyFactory.getProp(this, data.c, 1, 255, this);
9723
+ if (!elementData.c.k) {
9724
+ styleElem.co = 'rgb(' + bm_floor(elementData.c.v[0]) + ',' + bm_floor(elementData.c.v[1]) + ',' + bm_floor(elementData.c.v[2]) + ')';
9725
+ }
9726
+ } else if (data.ty === 'gf' || data.ty === 'gs') {
9727
+ elementData.s = PropertyFactory.getProp(this, data.s, 1, null, this);
9728
+ elementData.e = PropertyFactory.getProp(this, data.e, 1, null, this);
9729
+ elementData.h = PropertyFactory.getProp(this, data.h || { k: 0 }, 0, 0.01, this);
9730
+ elementData.a = PropertyFactory.getProp(this, data.a || { k: 0 }, 0, degToRads, this);
9731
+ elementData.g = new GradientProperty(this, data.g, this);
9732
+ }
9733
+ elementData.o = PropertyFactory.getProp(this, data.o, 0, 0.01, this);
9734
+ if (data.ty == 'st' || data.ty == 'gs') {
9735
+ styleElem.lc = this.lcEnum[data.lc] || 'round';
9736
+ styleElem.lj = this.ljEnum[data.lj] || 'round';
9737
+ if (data.lj == 1) {
9738
+ styleElem.ml = data.ml;
9739
+ }
9740
+ elementData.w = PropertyFactory.getProp(this, data.w, 0, null, this);
9741
+ if (!elementData.w.k) {
9742
+ styleElem.wi = elementData.w.v;
9743
+ }
9744
+ if (data.d) {
9745
+ var d = new DashProperty(this, data.d, 'canvas', this);
9746
+ elementData.d = d;
9747
+ if (!elementData.d.k) {
9748
+ styleElem.da = elementData.d.dashArray;
9749
+ styleElem.do = elementData.d.dashoffset[0];
9750
+ }
9751
+ }
9752
+ } else {
9753
+ styleElem.r = data.r === 2 ? 'evenodd' : 'nonzero';
9754
+ }
9755
+ this.stylesList.push(styleElem);
9756
+ elementData.style = styleElem;
9757
+ return elementData;
9758
+ };
9759
+
9760
+ CVShapeElement.prototype.createGroupElement = function (data) {
9761
+ var elementData = {
9762
+ it: [],
9763
+ prevViewData: []
9764
+ };
9765
+ return elementData;
9766
+ };
9767
+
9768
+ CVShapeElement.prototype.createTransformElement = function (data) {
9769
+ var elementData = {
9770
+ transform: {
9771
+ opacity: 1,
9772
+ _opMdf: false,
9773
+ key: this.transformsManager.getNewKey(),
9774
+ op: PropertyFactory.getProp(this, data.o, 0, 0.01, this),
9775
+ mProps: TransformPropertyFactory.getTransformProperty(this, data, this)
9776
+ }
9777
+ };
9778
+ return elementData;
9779
+ };
9780
+
9781
+ CVShapeElement.prototype.createShapeElement = function (data) {
9782
+ var elementData = new CVShapeData(this, data, this.stylesList, this.transformsManager);
9783
+
9784
+ this.shapes.push(elementData);
9785
+ this.addShapeToModifiers(elementData);
9786
+ return elementData;
9787
+ };
9788
+
9789
+ CVShapeElement.prototype.reloadShapes = function () {
9790
+ this._isFirstFrame = true;
9791
+ var i, len = this.itemsData.length;
9792
+ for (i = 0; i < len; i += 1) {
9793
+ this.prevViewData[i] = this.itemsData[i];
9794
+ }
9795
+ this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []);
9796
+ len = this.dynamicProperties.length;
9797
+ for (i = 0; i < len; i += 1) {
9798
+ this.dynamicProperties[i].getValue();
9799
+ }
9800
+ this.renderModifiers();
9801
+ this.transformsManager.processSequences(this._isFirstFrame);
9802
+ };
9803
+
9804
+ CVShapeElement.prototype.addTransformToStyleList = function (transform) {
9805
+ var i, len = this.stylesList.length;
9806
+ for (i = 0; i < len; i += 1) {
9807
+ if (!this.stylesList[i].closed) {
9808
+ this.stylesList[i].transforms.push(transform);
9809
+ }
9810
+ }
9811
+ }
9812
+
9813
+ CVShapeElement.prototype.removeTransformFromStyleList = function () {
9814
+ var i, len = this.stylesList.length;
9815
+ for (i = 0; i < len; i += 1) {
9816
+ if (!this.stylesList[i].closed) {
9817
+ this.stylesList[i].transforms.pop();
9818
+ }
9819
+ }
9820
+ }
9821
+
9822
+ CVShapeElement.prototype.closeStyles = function (styles) {
9823
+ var i, len = styles.length, j, jLen;
9824
+ for (i = 0; i < len; i += 1) {
9825
+ styles[i].closed = true;
9826
+ }
9827
+ }
9828
+
9829
+ CVShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, shouldRender, transforms) {
9830
+ var i, len = arr.length - 1;
9831
+ var j, jLen;
9832
+ var ownStyles = [], ownModifiers = [], processedPos, modifier, currentTransform;
9833
+ var ownTransforms = [].concat(transforms);
9834
+ for (i = len; i >= 0; i -= 1) {
9835
+ processedPos = this.searchProcessedElement(arr[i]);
9836
+ if (!processedPos) {
9837
+ arr[i]._shouldRender = shouldRender;
9838
+ } else {
9839
+ itemsData[i] = prevViewData[processedPos - 1];
9840
+ }
9841
+ if (arr[i].ty == 'fl' || arr[i].ty == 'st' || arr[i].ty == 'gf' || arr[i].ty == 'gs') {
9842
+ if (!processedPos) {
9843
+ itemsData[i] = this.createStyleElement(arr[i], ownTransforms);
9844
+ } else {
9845
+ itemsData[i].style.closed = false;
9846
+ }
9847
+
9848
+ ownStyles.push(itemsData[i].style);
9849
+ } else if (arr[i].ty == 'gr') {
9850
+ if (!processedPos) {
9851
+ itemsData[i] = this.createGroupElement(arr[i]);
9852
+ } else {
9853
+ jLen = itemsData[i].it.length;
9854
+ for (j = 0; j < jLen; j += 1) {
9855
+ itemsData[i].prevViewData[j] = itemsData[i].it[j];
9856
+ }
9857
+ }
9858
+ this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, shouldRender, ownTransforms);
9859
+ } else if (arr[i].ty == 'tr') {
9860
+ if (!processedPos) {
9861
+ currentTransform = this.createTransformElement(arr[i]);
9862
+ itemsData[i] = currentTransform;
9863
+ }
9864
+ ownTransforms.push(itemsData[i]);
9865
+ this.addTransformToStyleList(itemsData[i]);
9866
+ } else if (arr[i].ty == 'sh' || arr[i].ty == 'rc' || arr[i].ty == 'el' || arr[i].ty == 'sr') {
9867
+ if (!processedPos) {
9868
+ itemsData[i] = this.createShapeElement(arr[i]);
9869
+ }
9870
+
9871
+ } else if (arr[i].ty == 'tm' || arr[i].ty == 'rd') {
9872
+ if (!processedPos) {
9873
+ modifier = ShapeModifiers.getModifier(arr[i].ty);
9874
+ modifier.init(this, arr[i]);
9875
+ itemsData[i] = modifier;
9876
+ this.shapeModifiers.push(modifier);
9877
+ } else {
9878
+ modifier = itemsData[i];
9879
+ modifier.closed = false;
9880
+ }
9881
+ ownModifiers.push(modifier);
9882
+ } else if (arr[i].ty == 'rp') {
9883
+ if (!processedPos) {
9884
+ modifier = ShapeModifiers.getModifier(arr[i].ty);
9885
+ itemsData[i] = modifier;
9886
+ modifier.init(this, arr, i, itemsData);
9887
+ this.shapeModifiers.push(modifier);
9888
+ shouldRender = false;
9889
+ } else {
9890
+ modifier = itemsData[i];
9891
+ modifier.closed = true;
9892
+ }
9893
+ ownModifiers.push(modifier);
9894
+ }
9895
+ this.addProcessedElement(arr[i], i + 1);
9896
+ }
9897
+ this.removeTransformFromStyleList();
9898
+ this.closeStyles(ownStyles);
9899
+ len = ownModifiers.length;
9900
+ for (i = 0; i < len; i += 1) {
9901
+ ownModifiers[i].closed = true;
9902
+ }
9903
+ };
9904
+
9905
+ CVShapeElement.prototype.renderInnerContent = function () {
9906
+ this.transformHelper.opacity = 1;
9907
+ this.transformHelper._opMdf = false;
9908
+ this.renderModifiers();
9909
+ this.transformsManager.processSequences(this._isFirstFrame);
9910
+ this.renderShape(this.transformHelper, this.shapesData, this.itemsData, true);
9911
+ };
9912
+
9913
+ CVShapeElement.prototype.renderShapeTransform = function (parentTransform, groupTransform) {
9914
+ var props, groupMatrix;
9915
+ if (parentTransform._opMdf || groupTransform.op._mdf || this._isFirstFrame) {
9916
+ groupTransform.opacity = parentTransform.opacity;
9917
+ groupTransform.opacity *= groupTransform.op.v;
9918
+ groupTransform._opMdf = true;
9919
+ }
9920
+ };
9921
+
9922
+ CVShapeElement.prototype.drawLayer = function () {
9923
+ var i, len = this.stylesList.length;
9924
+ var j, jLen, k, kLen, elems, nodes, renderer = this.globalData.renderer, ctx = this.globalData.canvasContext, type, currentStyle;
9925
+ for (i = 0; i < len; i += 1) {
9926
+ currentStyle = this.stylesList[i];
9927
+ type = currentStyle.type;
9928
+
9929
+ //Skipping style when
9930
+ //Stroke width equals 0
9931
+ //style should not be rendered (extra unused repeaters)
9932
+ //current opacity equals 0
9933
+ //global opacity equals 0
9934
+ if (((type === 'st' || type === 'gs') && currentStyle.wi === 0) || !currentStyle.data._shouldRender || currentStyle.coOp === 0 || this.globalData.currentGlobalAlpha === 0) {
9935
+ continue;
9936
+ }
9937
+ renderer.save();
9938
+ elems = currentStyle.elements;
9939
+ if (type === 'st' || type === 'gs') {
9940
+ ctx.strokeStyle = type === 'st' ? currentStyle.co : currentStyle.grd;
9941
+ ctx.lineWidth = currentStyle.wi;
9942
+ ctx.lineCap = currentStyle.lc;
9943
+ ctx.lineJoin = currentStyle.lj;
9944
+ ctx.miterLimit = currentStyle.ml || 0;
9945
+ } else {
9946
+ ctx.fillStyle = type === 'fl' ? currentStyle.co : currentStyle.grd;
9947
+ }
9948
+ renderer.ctxOpacity(currentStyle.coOp);
9949
+ if (type !== 'st' && type !== 'gs') {
9950
+ ctx.beginPath();
9951
+ }
9952
+ renderer.ctxTransform(currentStyle.preTransforms.finalTransform.props);
9953
+ jLen = elems.length;
9954
+ for (j = 0; j < jLen; j += 1) {
9955
+ if (type === 'st' || type === 'gs') {
9956
+ ctx.beginPath();
9957
+ if (currentStyle.da) {
9958
+ ctx.setLineDash(currentStyle.da);
9959
+ ctx.lineDashOffset = currentStyle.do;
9960
+ }
9961
+ }
9962
+ nodes = elems[j].trNodes;
9963
+ kLen = nodes.length;
9964
+
9965
+ for (k = 0; k < kLen; k += 1) {
9966
+ if (nodes[k].t == 'm') {
9967
+ ctx.moveTo(nodes[k].p[0], nodes[k].p[1]);
9968
+ } else if (nodes[k].t == 'c') {
9969
+ ctx.bezierCurveTo(nodes[k].pts[0], nodes[k].pts[1], nodes[k].pts[2], nodes[k].pts[3], nodes[k].pts[4], nodes[k].pts[5]);
9970
+ } else {
9971
+ ctx.closePath();
9972
+ }
9973
+ }
9974
+ if (type === 'st' || type === 'gs') {
9975
+ ctx.stroke();
9976
+ if (currentStyle.da) {
9977
+ ctx.setLineDash(this.dashResetter);
9978
+ }
9979
+ }
9980
+ }
9981
+ if (type !== 'st' && type !== 'gs') {
9982
+ ctx.fill(currentStyle.r);
9983
+ }
9984
+ renderer.restore();
9985
+ }
9986
+ };
9987
+
9988
+ CVShapeElement.prototype.renderShape = function (parentTransform, items, data, isMain) {
9989
+ var i, len = items.length - 1;
9990
+ var groupTransform;
9991
+ groupTransform = parentTransform;
9992
+ for (i = len; i >= 0; i -= 1) {
9993
+ if (items[i].ty == 'tr') {
9994
+ groupTransform = data[i].transform;
9995
+ this.renderShapeTransform(parentTransform, groupTransform);
9996
+ } else if (items[i].ty == 'sh' || items[i].ty == 'el' || items[i].ty == 'rc' || items[i].ty == 'sr') {
9997
+ this.renderPath(items[i], data[i]);
9998
+ } else if (items[i].ty == 'fl') {
9999
+ this.renderFill(items[i], data[i], groupTransform);
10000
+ } else if (items[i].ty == 'st') {
10001
+ this.renderStroke(items[i], data[i], groupTransform);
10002
+ } else if (items[i].ty == 'gf' || items[i].ty == 'gs') {
10003
+ this.renderGradientFill(items[i], data[i], groupTransform);
10004
+ } else if (items[i].ty == 'gr') {
10005
+ this.renderShape(groupTransform, items[i].it, data[i].it);
10006
+ } else if (items[i].ty == 'tm') {
10007
+ //
10008
+ }
10009
+ }
10010
+ if (isMain) {
10011
+ this.drawLayer();
10012
+ }
10013
+
10014
+ };
10015
+
10016
+ CVShapeElement.prototype.renderStyledShape = function (styledShape, shape) {
10017
+ if (this._isFirstFrame || shape._mdf || styledShape.transforms._mdf) {
10018
+ var shapeNodes = styledShape.trNodes;
10019
+ var paths = shape.paths;
10020
+ var i, len, j, jLen = paths._length;
10021
+ shapeNodes.length = 0;
10022
+ var groupTransformMat = styledShape.transforms.finalTransform;
10023
+ for (j = 0; j < jLen; j += 1) {
10024
+ var pathNodes = paths.shapes[j];
10025
+ if (pathNodes && pathNodes.v) {
10026
+ len = pathNodes._length;
10027
+ for (i = 1; i < len; i += 1) {
10028
+ if (i === 1) {
10029
+ shapeNodes.push({
10030
+ t: 'm',
10031
+ p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0)
10032
+ });
10033
+ }
10034
+ shapeNodes.push({
10035
+ t: 'c',
10036
+ pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[i], pathNodes.v[i])
10037
+ });
10038
+ }
10039
+ if (len === 1) {
10040
+ shapeNodes.push({
10041
+ t: 'm',
10042
+ p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0)
10043
+ });
10044
+ }
10045
+ if (pathNodes.c && len) {
10046
+ shapeNodes.push({
10047
+ t: 'c',
10048
+ pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[0], pathNodes.v[0])
10049
+ });
10050
+ shapeNodes.push({
10051
+ t: 'z'
10052
+ });
10053
+ }
10054
+ }
10055
+ }
10056
+ styledShape.trNodes = shapeNodes;
10057
+ }
10058
+ }
10059
+
10060
+ CVShapeElement.prototype.renderPath = function (pathData, itemData) {
10061
+ if (pathData.hd !== true && pathData._shouldRender) {
10062
+ var i, len = itemData.styledShapes.length;
10063
+ for (i = 0; i < len; i += 1) {
10064
+ this.renderStyledShape(itemData.styledShapes[i], itemData.sh);
10065
+ }
10066
+ }
10067
+ };
10068
+
10069
+ CVShapeElement.prototype.renderFill = function (styleData, itemData, groupTransform) {
10070
+ var styleElem = itemData.style;
10071
+
10072
+ if (itemData.c._mdf || this._isFirstFrame) {
10073
+ styleElem.co = 'rgb('
10074
+ + bm_floor(itemData.c.v[0]) + ','
10075
+ + bm_floor(itemData.c.v[1]) + ','
10076
+ + bm_floor(itemData.c.v[2]) + ')';
10077
+ }
10078
+ if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {
10079
+ styleElem.coOp = itemData.o.v * groupTransform.opacity;
10080
+ }
10081
+ };
10082
+
10083
+ CVShapeElement.prototype.renderGradientFill = function (styleData, itemData, groupTransform) {
10084
+ var styleElem = itemData.style;
10085
+ if (!styleElem.grd || itemData.g._mdf || itemData.s._mdf || itemData.e._mdf || (styleData.t !== 1 && (itemData.h._mdf || itemData.a._mdf))) {
10086
+ var ctx = this.globalData.canvasContext;
10087
+ var grd;
10088
+ var pt1 = itemData.s.v, pt2 = itemData.e.v;
10089
+ if (styleData.t === 1) {
10090
+ grd = ctx.createLinearGradient(pt1[0], pt1[1], pt2[0], pt2[1]);
10091
+ } else {
10092
+ var rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
10093
+ var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);
10094
+
10095
+ var percent = itemData.h.v >= 1 ? 0.99 : itemData.h.v <= -1 ? -0.99 : itemData.h.v;
10096
+ var dist = rad * percent;
10097
+ var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];
10098
+ var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];
10099
+ var grd = ctx.createRadialGradient(x, y, 0, pt1[0], pt1[1], rad);
10100
+ }
10101
+
10102
+ var i, len = styleData.g.p;
10103
+ var cValues = itemData.g.c;
10104
+ var opacity = 1;
10105
+
10106
+ for (i = 0; i < len; i += 1) {
10107
+ if (itemData.g._hasOpacity && itemData.g._collapsable) {
10108
+ opacity = itemData.g.o[i * 2 + 1];
10109
+ }
10110
+ grd.addColorStop(cValues[i * 4] / 100, 'rgba(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ',' + opacity + ')');
10111
+ }
10112
+ styleElem.grd = grd;
10113
+ }
10114
+ styleElem.coOp = itemData.o.v * groupTransform.opacity;
10115
+
10116
+ };
10117
+
10118
+ CVShapeElement.prototype.renderStroke = function (styleData, itemData, groupTransform) {
10119
+ var styleElem = itemData.style;
10120
+ var d = itemData.d;
10121
+ if (d && (d._mdf || this._isFirstFrame)) {
10122
+ styleElem.da = d.dashArray;
10123
+ styleElem.do = d.dashoffset[0];
10124
+ }
10125
+ if (itemData.c._mdf || this._isFirstFrame) {
10126
+ styleElem.co = 'rgb(' + bm_floor(itemData.c.v[0]) + ',' + bm_floor(itemData.c.v[1]) + ',' + bm_floor(itemData.c.v[2]) + ')';
10127
+ }
10128
+ if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {
10129
+ styleElem.coOp = itemData.o.v * groupTransform.opacity;
10130
+ }
10131
+ if (itemData.w._mdf || this._isFirstFrame) {
10132
+ styleElem.wi = itemData.w.v;
10133
+ }
10134
+ };
10135
+
10136
+
10137
+ CVShapeElement.prototype.destroy = function () {
10138
+ this.shapesData = null;
10139
+ this.globalData = null;
10140
+ this.canvasContext = null;
10141
+ this.stylesList.length = 0;
10142
+ this.itemsData.length = 0;
10143
+ };
10144
+
10145
+
10146
+ function CVSolidElement(data, globalData, comp) {
10147
+ this.initElement(data, globalData, comp);
10148
+ }
10149
+ extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVSolidElement);
10150
+
10151
+ CVSolidElement.prototype.initElement = SVGShapeElement.prototype.initElement;
10152
+ CVSolidElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;
10153
+
10154
+ CVSolidElement.prototype.renderInnerContent = function () {
10155
+ var ctx = this.canvasContext;
10156
+ ctx.fillStyle = this.data.sc;
10157
+ ctx.fillRect(0, 0, this.data.sw, this.data.sh);
10158
+ //
10159
+ };
10160
+ function CVTextElement(data, globalData, comp) {
10161
+ this.textSpans = [];
10162
+ this.yOffset = 0;
10163
+ this.fillColorAnim = false;
10164
+ this.strokeColorAnim = false;
10165
+ this.strokeWidthAnim = false;
10166
+ this.stroke = false;
10167
+ this.fill = false;
10168
+ this.justifyOffset = 0;
10169
+ this.currentRender = null;
10170
+ this.renderType = 'canvas';
10171
+ this.values = {
10172
+ fill: 'rgba(0,0,0,0)',
10173
+ stroke: 'rgba(0,0,0,0)',
10174
+ sWidth: 0,
10175
+ fValue: ''
10176
+ };
10177
+ this.initElement(data, globalData, comp);
10178
+ }
10179
+ extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement, ITextElement], CVTextElement);
10180
+
10181
+ CVTextElement.prototype.tHelper = createTag('canvas').getContext('2d');
10182
+
10183
+ CVTextElement.prototype.buildNewText = function () {
10184
+ var documentData = this.textProperty.currentData;
10185
+ this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);
10186
+
10187
+ var hasFill = false;
10188
+ if (documentData.fc) {
10189
+ hasFill = true;
10190
+ this.values.fill = this.buildColor(documentData.fc);
10191
+ } else {
10192
+ this.values.fill = 'rgba(0,0,0,0)';
10193
+ }
10194
+ this.fill = hasFill;
10195
+ var hasStroke = false;
10196
+ if (documentData.sc) {
10197
+ hasStroke = true;
10198
+ this.values.stroke = this.buildColor(documentData.sc);
10199
+ this.values.sWidth = documentData.sw;
10200
+ }
10201
+ var fontData = this.globalData.fontManager.getFontByName(documentData.f);
10202
+ var i, len;
10203
+ var letters = documentData.l;
10204
+ var matrixHelper = this.mHelper;
10205
+ this.stroke = hasStroke;
10206
+ this.values.fValue = documentData.finalSize + 'px ' + this.globalData.fontManager.getFontByName(documentData.f).fFamily;
10207
+ len = documentData.finalText.length;
10208
+ //this.tHelper.font = this.values.fValue;
10209
+ var charData, shapeData, k, kLen, shapes, j, jLen, pathNodes, commands, pathArr, singleShape = this.data.singleShape;
10210
+ var trackingOffset = documentData.tr / 1000 * documentData.finalSize;
10211
+ var xPos = 0, yPos = 0, firstLine = true;
10212
+ var cnt = 0;
10213
+ for (i = 0; i < len; i += 1) {
10214
+ charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);
10215
+ shapeData = charData && charData.data || {};
10216
+ matrixHelper.reset();
10217
+ if (singleShape && letters[i].n) {
10218
+ xPos = -trackingOffset;
10219
+ yPos += documentData.yOffset;
10220
+ yPos += firstLine ? 1 : 0;
10221
+ firstLine = false;
10222
+ }
10223
+
10224
+ shapes = shapeData.shapes ? shapeData.shapes[0].it : [];
10225
+ jLen = shapes.length;
10226
+ matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);
10227
+ if (singleShape) {
10228
+ this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);
10229
+ }
10230
+ commands = createSizedArray(jLen);
10231
+ for (j = 0; j < jLen; j += 1) {
10232
+ kLen = shapes[j].ks.k.i.length;
10233
+ pathNodes = shapes[j].ks.k;
10234
+ pathArr = [];
10235
+ for (k = 1; k < kLen; k += 1) {
10236
+ if (k == 1) {
10237
+ pathArr.push(matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0));
10238
+ }
10239
+ pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToY(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToX(pathNodes.v[k][0], pathNodes.v[k][1], 0), matrixHelper.applyToY(pathNodes.v[k][0], pathNodes.v[k][1], 0));
10240
+ }
10241
+ pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToY(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0));
10242
+ commands[j] = pathArr;
10243
+ }
10244
+ if (singleShape) {
10245
+ xPos += letters[i].l;
10246
+ xPos += trackingOffset;
10247
+ }
10248
+ if (this.textSpans[cnt]) {
10249
+ this.textSpans[cnt].elem = commands;
10250
+ } else {
10251
+ this.textSpans[cnt] = { elem: commands };
10252
+ }
10253
+ cnt += 1;
10254
+ }
10255
+ };
10256
+
10257
+ CVTextElement.prototype.renderInnerContent = function () {
10258
+ var ctx = this.canvasContext;
10259
+ var finalMat = this.finalTransform.mat.props;
10260
+ ctx.font = this.values.fValue;
10261
+ ctx.lineCap = 'butt';
10262
+ ctx.lineJoin = 'miter';
10263
+ ctx.miterLimit = 4;
10264
+
10265
+ if (!this.data.singleShape) {
10266
+ this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
10267
+ }
10268
+
10269
+ var i, len, j, jLen, k, kLen;
10270
+ var renderedLetters = this.textAnimator.renderedLetters;
10271
+
10272
+ var letters = this.textProperty.currentData.l;
10273
+
10274
+ len = letters.length;
10275
+ var renderedLetter;
10276
+ var lastFill = null, lastStroke = null, lastStrokeW = null, commands, pathArr;
10277
+ for (i = 0; i < len; i += 1) {
10278
+ if (letters[i].n) {
10279
+ continue;
10280
+ }
10281
+ renderedLetter = renderedLetters[i];
10282
+ if (renderedLetter) {
10283
+ this.globalData.renderer.save();
10284
+ this.globalData.renderer.ctxTransform(renderedLetter.p);
10285
+ this.globalData.renderer.ctxOpacity(renderedLetter.o);
10286
+ }
10287
+ if (this.fill) {
10288
+ if (renderedLetter && renderedLetter.fc) {
10289
+ if (lastFill !== renderedLetter.fc) {
10290
+ lastFill = renderedLetter.fc;
10291
+ ctx.fillStyle = renderedLetter.fc;
10292
+ }
10293
+ } else if (lastFill !== this.values.fill) {
10294
+ lastFill = this.values.fill;
10295
+ ctx.fillStyle = this.values.fill;
10296
+ }
10297
+ commands = this.textSpans[i].elem;
10298
+ jLen = commands.length;
10299
+ this.globalData.canvasContext.beginPath();
10300
+ for (j = 0; j < jLen; j += 1) {
10301
+ pathArr = commands[j];
10302
+ kLen = pathArr.length;
10303
+ this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);
10304
+ for (k = 2; k < kLen; k += 6) {
10305
+ this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);
10306
+ }
10307
+ }
10308
+ this.globalData.canvasContext.closePath();
10309
+ this.globalData.canvasContext.fill();
10310
+ ///ctx.fillText(this.textSpans[i].val,0,0);
10311
+ }
10312
+ if (this.stroke) {
10313
+ if (renderedLetter && renderedLetter.sw) {
10314
+ if (lastStrokeW !== renderedLetter.sw) {
10315
+ lastStrokeW = renderedLetter.sw;
10316
+ ctx.lineWidth = renderedLetter.sw;
10317
+ }
10318
+ } else if (lastStrokeW !== this.values.sWidth) {
10319
+ lastStrokeW = this.values.sWidth;
10320
+ ctx.lineWidth = this.values.sWidth;
10321
+ }
10322
+ if (renderedLetter && renderedLetter.sc) {
10323
+ if (lastStroke !== renderedLetter.sc) {
10324
+ lastStroke = renderedLetter.sc;
10325
+ ctx.strokeStyle = renderedLetter.sc;
10326
+ }
10327
+ } else if (lastStroke !== this.values.stroke) {
10328
+ lastStroke = this.values.stroke;
10329
+ ctx.strokeStyle = this.values.stroke;
10330
+ }
10331
+ commands = this.textSpans[i].elem;
10332
+ jLen = commands.length;
10333
+ this.globalData.canvasContext.beginPath();
10334
+ for (j = 0; j < jLen; j += 1) {
10335
+ pathArr = commands[j];
10336
+ kLen = pathArr.length;
10337
+ this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);
10338
+ for (k = 2; k < kLen; k += 6) {
10339
+ this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);
10340
+ }
10341
+ }
10342
+ this.globalData.canvasContext.closePath();
10343
+ this.globalData.canvasContext.stroke();
10344
+ ///ctx.strokeText(letters[i].val,0,0);
10345
+ }
10346
+ if (renderedLetter) {
10347
+ this.globalData.renderer.restore();
10348
+ }
10349
+ }
10350
+ };
10351
+ function CVEffects() {
10352
+
10353
+ }
10354
+ CVEffects.prototype.renderFrame = function () { };
10355
+ function HBaseElement(data, globalData, comp) { }
10356
+ HBaseElement.prototype = {
10357
+ checkBlendMode: function () { },
10358
+ initRendererElement: function () {
10359
+ this.baseElement = createTag(this.data.tg || 'div');
10360
+ if (this.data.hasMask) {
10361
+ this.svgElement = createNS('svg');
10362
+ this.layerElement = createNS('g');
10363
+ this.maskedElement = this.layerElement;
10364
+ this.svgElement.appendChild(this.layerElement);
10365
+ this.baseElement.appendChild(this.svgElement);
10366
+ } else {
10367
+ this.layerElement = this.baseElement;
10368
+ }
10369
+ styleDiv(this.baseElement);
10370
+ },
10371
+ createContainerElements: function () {
10372
+ this.renderableEffectsManager = new CVEffects(this);
10373
+ this.transformedElement = this.baseElement;
10374
+ this.maskedElement = this.layerElement;
10375
+ if (this.data.ln) {
10376
+ this.layerElement.setAttribute('id', this.data.ln);
10377
+ }
10378
+ if (this.data.cl) {
10379
+ this.layerElement.setAttribute('class', this.data.cl);
10380
+ }
10381
+ if (this.data.bm !== 0) {
10382
+ this.setBlendMode();
10383
+ }
10384
+ },
10385
+ renderElement: function () {
10386
+ if (this.finalTransform._matMdf) {
10387
+ this.transformedElement.style.transform = this.transformedElement.style.webkitTransform = this.finalTransform.mat.toCSS();
10388
+ }
10389
+ if (this.finalTransform._opMdf) {
10390
+ this.transformedElement.style.opacity = this.finalTransform.mProp.o.v;
10391
+ }
10392
+ },
10393
+ renderFrame: function () {
10394
+ //If it is exported as hidden (data.hd === true) no need to render
10395
+ //If it is not visible no need to render
10396
+ if (this.data.hd || this.hidden) {
10397
+ return;
10398
+ }
10399
+ this.renderTransform();
10400
+ this.renderRenderable();
10401
+ this.renderElement();
10402
+ this.renderInnerContent();
10403
+ if (this._isFirstFrame) {
10404
+ this._isFirstFrame = false;
10405
+ }
10406
+ },
10407
+ destroy: function () {
10408
+ this.layerElement = null;
10409
+ this.transformedElement = null;
10410
+ if (this.matteElement) {
10411
+ this.matteElement = null;
10412
+ }
10413
+ if (this.maskManager) {
10414
+ this.maskManager.destroy();
10415
+ this.maskManager = null;
10416
+ }
10417
+ },
10418
+ createRenderableComponents: function () {
10419
+ this.maskManager = new MaskElement(this.data, this, this.globalData);
10420
+ },
10421
+ addEffects: function () {
10422
+ },
10423
+ setMatte: function () { }
10424
+ };
10425
+ HBaseElement.prototype.getBaseElement = SVGBaseElement.prototype.getBaseElement;
10426
+ HBaseElement.prototype.destroyBaseElement = HBaseElement.prototype.destroy;
10427
+ HBaseElement.prototype.buildElementParenting = HybridRenderer.prototype.buildElementParenting;
10428
+ function HSolidElement(data, globalData, comp) {
10429
+ this.initElement(data, globalData, comp);
10430
+ }
10431
+ extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], HSolidElement);
10432
+
10433
+ HSolidElement.prototype.createContent = function () {
10434
+ var rect;
10435
+ if (this.data.hasMask) {
10436
+ rect = createNS('rect');
10437
+ rect.setAttribute('width', this.data.sw);
10438
+ rect.setAttribute('height', this.data.sh);
10439
+ rect.setAttribute('fill', this.data.sc);
10440
+ this.svgElement.setAttribute('width', this.data.sw);
10441
+ this.svgElement.setAttribute('height', this.data.sh);
10442
+ } else {
10443
+ rect = createTag('div');
10444
+ rect.style.width = this.data.sw + 'px';
10445
+ rect.style.height = this.data.sh + 'px';
10446
+ rect.style.backgroundColor = this.data.sc;
10447
+ }
10448
+ this.layerElement.appendChild(rect);
10449
+ };
10450
+
10451
+ function HCompElement(data, globalData, comp) {
10452
+ this.layers = data.layers;
10453
+ this.supports3d = !data.hasMask;
10454
+ this.completeLayers = false;
10455
+ this.pendingElements = [];
10456
+ this.elements = this.layers ? createSizedArray(this.layers.length) : [];
10457
+ this.initElement(data, globalData, comp);
10458
+ this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true };
10459
+ }
10460
+
10461
+ extendPrototype([HybridRenderer, ICompElement, HBaseElement], HCompElement);
10462
+ HCompElement.prototype._createBaseContainerElements = HCompElement.prototype.createContainerElements;
10463
+
10464
+ HCompElement.prototype.createContainerElements = function () {
10465
+ this._createBaseContainerElements();
10466
+ //divElement.style.clip = 'rect(0px, '+this.data.w+'px, '+this.data.h+'px, 0px)';
10467
+ if (this.data.hasMask) {
10468
+ this.svgElement.setAttribute('width', this.data.w);
10469
+ this.svgElement.setAttribute('height', this.data.h);
10470
+ this.transformedElement = this.baseElement;
10471
+ } else {
10472
+ this.transformedElement = this.layerElement;
10473
+ }
10474
+ };
10475
+
10476
+ HCompElement.prototype.addTo3dContainer = function (elem, pos) {
10477
+ var j = 0;
10478
+ var nextElement;
10479
+ while (j < pos) {
10480
+ if (this.elements[j] && this.elements[j].getBaseElement) {
10481
+ nextElement = this.elements[j].getBaseElement();
10482
+ }
10483
+ j += 1;
10484
+ }
10485
+ if (nextElement) {
10486
+ this.layerElement.insertBefore(elem, nextElement);
10487
+ } else {
10488
+ this.layerElement.appendChild(elem);
10489
+ }
10490
+ }
10491
+
10492
+ function HShapeElement(data, globalData, comp) {
10493
+ //List of drawable elements
10494
+ this.shapes = [];
10495
+ // Full shape data
10496
+ this.shapesData = data.shapes;
10497
+ //List of styles that will be applied to shapes
10498
+ this.stylesList = [];
10499
+ //List of modifiers that will be applied to shapes
10500
+ this.shapeModifiers = [];
10501
+ //List of items in shape tree
10502
+ this.itemsData = [];
10503
+ //List of items in previous shape tree
10504
+ this.processedElements = [];
10505
+ // List of animated components
10506
+ this.animatedContents = [];
10507
+ this.shapesContainer = createNS('g');
10508
+ this.initElement(data, globalData, comp);
10509
+ //Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
10510
+ // List of elements that have been created
10511
+ this.prevViewData = [];
10512
+ this.currentBBox = {
10513
+ x: 999999,
10514
+ y: -999999,
10515
+ h: 0,
10516
+ w: 0
10517
+ };
10518
+ }
10519
+ extendPrototype([BaseElement, TransformElement, HSolidElement, SVGShapeElement, HBaseElement, HierarchyElement, FrameElement, RenderableElement], HShapeElement);
10520
+ HShapeElement.prototype._renderShapeFrame = HShapeElement.prototype.renderInnerContent;
10521
+
10522
+ HShapeElement.prototype.createContent = function () {
10523
+ var cont;
10524
+ this.baseElement.style.fontSize = 0;
10525
+ if (this.data.hasMask) {
10526
+ this.layerElement.appendChild(this.shapesContainer);
10527
+ cont = this.svgElement;
10528
+ } else {
10529
+ cont = createNS('svg');
10530
+ var size = this.comp.data ? this.comp.data : this.globalData.compSize;
10531
+ cont.setAttribute('width', size.w);
10532
+ cont.setAttribute('height', size.h);
10533
+ cont.appendChild(this.shapesContainer);
10534
+ this.layerElement.appendChild(cont);
10535
+ }
10536
+
10537
+ this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.shapesContainer, 0, [], true);
10538
+ this.filterUniqueShapes();
10539
+ this.shapeCont = cont;
10540
+ };
10541
+
10542
+ HShapeElement.prototype.getTransformedPoint = function (transformers, point) {
10543
+ var i, len = transformers.length;
10544
+ for (i = 0; i < len; i += 1) {
10545
+ point = transformers[i].mProps.v.applyToPointArray(point[0], point[1], 0);
10546
+ }
10547
+ return point;
10548
+ }
10549
+
10550
+ HShapeElement.prototype.calculateShapeBoundingBox = function (item, boundingBox) {
10551
+ var shape = item.sh.v;
10552
+ var transformers = item.transformers;
10553
+ var i, len = shape._length, vPoint, oPoint, nextIPoint, nextVPoint, bounds;
10554
+ if (len <= 1) {
10555
+ return;
10556
+ }
10557
+ for (i = 0; i < len - 1; i += 1) {
10558
+ vPoint = this.getTransformedPoint(transformers, shape.v[i]);
10559
+ oPoint = this.getTransformedPoint(transformers, shape.o[i]);
10560
+ nextIPoint = this.getTransformedPoint(transformers, shape.i[i + 1]);
10561
+ nextVPoint = this.getTransformedPoint(transformers, shape.v[i + 1]);
10562
+ this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);
10563
+ }
10564
+ if (shape.c) {
10565
+ vPoint = this.getTransformedPoint(transformers, shape.v[i]);
10566
+ oPoint = this.getTransformedPoint(transformers, shape.o[i]);
10567
+ nextIPoint = this.getTransformedPoint(transformers, shape.i[0]);
10568
+ nextVPoint = this.getTransformedPoint(transformers, shape.v[0]);
10569
+ this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);
10570
+ }
10571
+ }
10572
+
10573
+ HShapeElement.prototype.checkBounds = function (vPoint, oPoint, nextIPoint, nextVPoint, boundingBox) {
10574
+ this.getBoundsOfCurve(vPoint, oPoint, nextIPoint, nextVPoint);
10575
+ var bounds = this.shapeBoundingBox;
10576
+ boundingBox.x = bm_min(bounds.left, boundingBox.x);
10577
+ boundingBox.xMax = bm_max(bounds.right, boundingBox.xMax);
10578
+ boundingBox.y = bm_min(bounds.top, boundingBox.y);
10579
+ boundingBox.yMax = bm_max(bounds.bottom, boundingBox.yMax);
10580
+ }
10581
+
10582
+ HShapeElement.prototype.shapeBoundingBox = {
10583
+ left: 0,
10584
+ right: 0,
10585
+ top: 0,
10586
+ bottom: 0,
10587
+ }
10588
+
10589
+ HShapeElement.prototype.tempBoundingBox = {
10590
+ x: 0,
10591
+ xMax: 0,
10592
+ y: 0,
10593
+ yMax: 0,
10594
+ width: 0,
10595
+ height: 0
10596
+ }
10597
+
10598
+ HShapeElement.prototype.getBoundsOfCurve = function (p0, p1, p2, p3) {
10599
+
10600
+ var bounds = [[p0[0], p3[0]], [p0[1], p3[1]]];
10601
+
10602
+ for (var a, b, c, t, b2ac, t1, t2, i = 0; i < 2; ++i) {
10603
+
10604
+ b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i];
10605
+ a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i];
10606
+ c = 3 * p1[i] - 3 * p0[i];
10607
+
10608
+ b = b | 0;
10609
+ a = a | 0;
10610
+ c = c | 0;
10611
+
10612
+ if (a === 0) {
10613
+
10614
+ if (b === 0) {
10615
+ continue;
10616
+ }
10617
+
10618
+ t = -c / b;
10619
+
10620
+ if (0 < t && t < 1) {
10621
+ bounds[i].push(this.calculateF(t, p0, p1, p2, p3, i));
10622
+ }
10623
+ continue;
10624
+ }
10625
+
10626
+ b2ac = b * b - 4 * c * a;
10627
+
10628
+ if (b2ac < 0) {
10629
+ continue;
10630
+ }
10631
+
10632
+ t1 = (-b + bm_sqrt(b2ac)) / (2 * a);
10633
+ if (0 < t1 && t1 < 1) bounds[i].push(this.calculateF(t1, p0, p1, p2, p3, i));
10634
+
10635
+ t2 = (-b - bm_sqrt(b2ac)) / (2 * a);
10636
+ if (0 < t2 && t2 < 1) bounds[i].push(this.calculateF(t2, p0, p1, p2, p3, i));
10637
+
10638
+ }
10639
+
10640
+ this.shapeBoundingBox.left = bm_min.apply(null, bounds[0]);
10641
+ this.shapeBoundingBox.top = bm_min.apply(null, bounds[1]);
10642
+ this.shapeBoundingBox.right = bm_max.apply(null, bounds[0]);
10643
+ this.shapeBoundingBox.bottom = bm_max.apply(null, bounds[1]);
10644
+ };
10645
+
10646
+ HShapeElement.prototype.calculateF = function (t, p0, p1, p2, p3, i) {
10647
+ return bm_pow(1 - t, 3) * p0[i]
10648
+ + 3 * bm_pow(1 - t, 2) * t * p1[i]
10649
+ + 3 * (1 - t) * bm_pow(t, 2) * p2[i]
10650
+ + bm_pow(t, 3) * p3[i];
10651
+ }
10652
+
10653
+ HShapeElement.prototype.calculateBoundingBox = function (itemsData, boundingBox) {
10654
+ var i, len = itemsData.length, path;
10655
+ for (i = 0; i < len; i += 1) {
10656
+ if (itemsData[i] && itemsData[i].sh) {
10657
+ this.calculateShapeBoundingBox(itemsData[i], boundingBox)
10658
+ } else if (itemsData[i] && itemsData[i].it) {
10659
+ this.calculateBoundingBox(itemsData[i].it, boundingBox)
10660
+ }
10661
+ }
10662
+ }
10663
+
10664
+ HShapeElement.prototype.currentBoxContains = function (box) {
10665
+ return this.currentBBox.x <= box.x
10666
+ && this.currentBBox.y <= box.y
10667
+ && this.currentBBox.width + this.currentBBox.x >= box.x + box.width
10668
+ && this.currentBBox.height + this.currentBBox.y >= box.y + box.height
10669
+ }
10670
+
10671
+ HShapeElement.prototype.renderInnerContent = function () {
10672
+ this._renderShapeFrame();
10673
+
10674
+ if (!this.hidden && (this._isFirstFrame || this._mdf)) {
10675
+ var tempBoundingBox = this.tempBoundingBox;
10676
+ var max = 999999;
10677
+ tempBoundingBox.x = max;
10678
+ tempBoundingBox.xMax = -max;
10679
+ tempBoundingBox.y = max;
10680
+ tempBoundingBox.yMax = -max;
10681
+ this.calculateBoundingBox(this.itemsData, tempBoundingBox);
10682
+ tempBoundingBox.width = tempBoundingBox.xMax < tempBoundingBox.x ? 0 : tempBoundingBox.xMax - tempBoundingBox.x;
10683
+ tempBoundingBox.height = tempBoundingBox.yMax < tempBoundingBox.y ? 0 : tempBoundingBox.yMax - tempBoundingBox.y;
10684
+ //var tempBoundingBox = this.shapeCont.getBBox();
10685
+ if (this.currentBoxContains(tempBoundingBox)) {
10686
+ return;
10687
+ }
10688
+ var changed = false;
10689
+ if (this.currentBBox.w !== tempBoundingBox.width) {
10690
+ this.currentBBox.w = tempBoundingBox.width;
10691
+ this.shapeCont.setAttribute('width', tempBoundingBox.width);
10692
+ changed = true;
10693
+ }
10694
+ if (this.currentBBox.h !== tempBoundingBox.height) {
10695
+ this.currentBBox.h = tempBoundingBox.height;
10696
+ this.shapeCont.setAttribute('height', tempBoundingBox.height);
10697
+ changed = true;
10698
+ }
10699
+ if (changed || this.currentBBox.x !== tempBoundingBox.x || this.currentBBox.y !== tempBoundingBox.y) {
10700
+ this.currentBBox.w = tempBoundingBox.width;
10701
+ this.currentBBox.h = tempBoundingBox.height;
10702
+ this.currentBBox.x = tempBoundingBox.x;
10703
+ this.currentBBox.y = tempBoundingBox.y;
10704
+
10705
+ this.shapeCont.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h);
10706
+ this.shapeCont.style.transform = this.shapeCont.style.webkitTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';
10707
+ }
10708
+ }
10709
+
10710
+ };
10711
+ function HTextElement(data, globalData, comp) {
10712
+ this.textSpans = [];
10713
+ this.textPaths = [];
10714
+ this.currentBBox = {
10715
+ x: 999999,
10716
+ y: -999999,
10717
+ h: 0,
10718
+ w: 0
10719
+ };
10720
+ this.renderType = 'svg';
10721
+ this.isMasked = false;
10722
+ this.initElement(data, globalData, comp);
10723
+
10724
+ }
10725
+ extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], HTextElement);
10726
+
10727
+ HTextElement.prototype.createContent = function () {
10728
+ this.isMasked = this.checkMasks();
10729
+ if (this.isMasked) {
10730
+ this.renderType = 'svg';
10731
+ this.compW = this.comp.data.w;
10732
+ this.compH = this.comp.data.h;
10733
+ this.svgElement.setAttribute('width', this.compW);
10734
+ this.svgElement.setAttribute('height', this.compH);
10735
+ var g = createNS('g');
10736
+ this.maskedElement.appendChild(g);
10737
+ this.innerElem = g;
10738
+ } else {
10739
+ this.renderType = 'html';
10740
+ this.innerElem = this.layerElement;
10741
+ }
10742
+
10743
+ this.checkParenting();
10744
+
10745
+ };
10746
+
10747
+ HTextElement.prototype.buildNewText = function () {
10748
+ var documentData = this.textProperty.currentData;
10749
+ this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);
10750
+ var innerElemStyle = this.innerElem.style;
10751
+ innerElemStyle.color = innerElemStyle.fill = documentData.fc ? this.buildColor(documentData.fc) : 'rgba(0,0,0,0)';
10752
+ if (documentData.sc) {
10753
+ innerElemStyle.stroke = this.buildColor(documentData.sc);
10754
+ innerElemStyle.strokeWidth = documentData.sw + 'px';
10755
+ }
10756
+ var fontData = this.globalData.fontManager.getFontByName(documentData.f);
10757
+ if (!this.globalData.fontManager.chars) {
10758
+ innerElemStyle.fontSize = documentData.finalSize + 'px';
10759
+ innerElemStyle.lineHeight = documentData.finalSize + 'px';
10760
+ if (fontData.fClass) {
10761
+ this.innerElem.className = fontData.fClass;
10762
+ } else {
10763
+ innerElemStyle.fontFamily = fontData.fFamily;
10764
+ var fWeight = documentData.fWeight, fStyle = documentData.fStyle;
10765
+ innerElemStyle.fontStyle = fStyle;
10766
+ innerElemStyle.fontWeight = fWeight;
10767
+ }
10768
+ }
10769
+ var i, len;
10770
+
10771
+ var letters = documentData.l;
10772
+ len = letters.length;
10773
+ var tSpan, tParent, tCont;
10774
+ var matrixHelper = this.mHelper;
10775
+ var shapes, shapeStr = '';
10776
+ var cnt = 0;
10777
+ for (i = 0; i < len; i += 1) {
10778
+ if (this.globalData.fontManager.chars) {
10779
+ if (!this.textPaths[cnt]) {
10780
+ tSpan = createNS('path');
10781
+ tSpan.setAttribute('stroke-linecap', 'butt');
10782
+ tSpan.setAttribute('stroke-linejoin', 'round');
10783
+ tSpan.setAttribute('stroke-miterlimit', '4');
10784
+ } else {
10785
+ tSpan = this.textPaths[cnt];
10786
+ }
10787
+ if (!this.isMasked) {
10788
+ if (this.textSpans[cnt]) {
10789
+ tParent = this.textSpans[cnt];
10790
+ tCont = tParent.children[0];
10791
+ } else {
10792
+
10793
+ tParent = createTag('div');
10794
+ tParent.style.lineHeight = 0;
10795
+ tCont = createNS('svg');
10796
+ tCont.appendChild(tSpan);
10797
+ styleDiv(tParent);
10798
+ }
10799
+ }
10800
+ } else {
10801
+ if (!this.isMasked) {
10802
+ if (this.textSpans[cnt]) {
10803
+ tParent = this.textSpans[cnt];
10804
+ tSpan = this.textPaths[cnt];
10805
+ } else {
10806
+ tParent = createTag('span');
10807
+ styleDiv(tParent);
10808
+ tSpan = createTag('span');
10809
+ styleDiv(tSpan);
10810
+ tParent.appendChild(tSpan);
10811
+ }
10812
+ } else {
10813
+ tSpan = this.textPaths[cnt] ? this.textPaths[cnt] : createNS('text');
10814
+ }
10815
+ }
10816
+ //tSpan.setAttribute('visibility', 'hidden');
10817
+ if (this.globalData.fontManager.chars) {
10818
+ var charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);
10819
+ var shapeData;
10820
+ if (charData) {
10821
+ shapeData = charData.data;
10822
+ } else {
10823
+ shapeData = null;
10824
+ }
10825
+ matrixHelper.reset();
10826
+ if (shapeData && shapeData.shapes) {
10827
+ shapes = shapeData.shapes[0].it;
10828
+ matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);
10829
+ shapeStr = this.createPathShape(matrixHelper, shapes);
10830
+ tSpan.setAttribute('d', shapeStr);
10831
+ }
10832
+ if (!this.isMasked) {
10833
+ this.innerElem.appendChild(tParent);
10834
+ if (shapeData && shapeData.shapes) {
10835
+
10836
+ //document.body.appendChild is needed to get exact measure of shape
10837
+ document.body.appendChild(tCont);
10838
+ var boundingBox = tCont.getBBox();
10839
+ tCont.setAttribute('width', boundingBox.width + 2);
10840
+ tCont.setAttribute('height', boundingBox.height + 2);
10841
+ tCont.setAttribute('viewBox', (boundingBox.x - 1) + ' ' + (boundingBox.y - 1) + ' ' + (boundingBox.width + 2) + ' ' + (boundingBox.height + 2));
10842
+ tCont.style.transform = tCont.style.webkitTransform = 'translate(' + (boundingBox.x - 1) + 'px,' + (boundingBox.y - 1) + 'px)';
10843
+
10844
+ letters[i].yOffset = boundingBox.y - 1;
10845
+
10846
+ } else {
10847
+ tCont.setAttribute('width', 1);
10848
+ tCont.setAttribute('height', 1);
10849
+ }
10850
+ tParent.appendChild(tCont);
10851
+ } else {
10852
+ this.innerElem.appendChild(tSpan);
10853
+ }
10854
+ } else {
10855
+ tSpan.textContent = letters[i].val;
10856
+ tSpan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
10857
+ if (!this.isMasked) {
10858
+ this.innerElem.appendChild(tParent);
10859
+ //
10860
+ tSpan.style.transform = tSpan.style.webkitTransform = 'translate3d(0,' + -documentData.finalSize / 1.2 + 'px,0)';
10861
+ } else {
10862
+ this.innerElem.appendChild(tSpan);
10863
+ }
10864
+ }
10865
+ //
10866
+ if (!this.isMasked) {
10867
+ this.textSpans[cnt] = tParent;
10868
+ } else {
10869
+ this.textSpans[cnt] = tSpan;
10870
+ }
10871
+ this.textSpans[cnt].style.display = 'block';
10872
+ this.textPaths[cnt] = tSpan;
10873
+ cnt += 1;
10874
+ }
10875
+ while (cnt < this.textSpans.length) {
10876
+ this.textSpans[cnt].style.display = 'none';
10877
+ cnt += 1;
10878
+ }
10879
+ };
10880
+
10881
+ HTextElement.prototype.renderInnerContent = function () {
10882
+
10883
+ if (this.data.singleShape) {
10884
+ if (!this._isFirstFrame && !this.lettersChangedFlag) {
10885
+ return;
10886
+ } else {
10887
+ // Todo Benchmark if using this is better than getBBox
10888
+ if (this.isMasked && this.finalTransform._matMdf) {
10889
+ this.svgElement.setAttribute('viewBox', -this.finalTransform.mProp.p.v[0] + ' ' + -this.finalTransform.mProp.p.v[1] + ' ' + this.compW + ' ' + this.compH);
10890
+ this.svgElement.style.transform = this.svgElement.style.webkitTransform = 'translate(' + -this.finalTransform.mProp.p.v[0] + 'px,' + -this.finalTransform.mProp.p.v[1] + 'px)';
10891
+ }
10892
+ }
10893
+ }
10894
+
10895
+ this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
10896
+ if (!this.lettersChangedFlag && !this.textAnimator.lettersChangedFlag) {
10897
+ return;
10898
+ }
10899
+ var i, len, count = 0;
10900
+ var renderedLetters = this.textAnimator.renderedLetters;
10901
+
10902
+ var letters = this.textProperty.currentData.l;
10903
+
10904
+ len = letters.length;
10905
+ var renderedLetter, textSpan, textPath;
10906
+ for (i = 0; i < len; i += 1) {
10907
+ if (letters[i].n) {
10908
+ count += 1;
10909
+ continue;
10910
+ }
10911
+ textSpan = this.textSpans[i];
10912
+ textPath = this.textPaths[i];
10913
+ renderedLetter = renderedLetters[count];
10914
+ count += 1;
10915
+ if (renderedLetter._mdf.m) {
10916
+ if (!this.isMasked) {
10917
+ textSpan.style.transform = textSpan.style.webkitTransform = renderedLetter.m;
10918
+ } else {
10919
+ textSpan.setAttribute('transform', renderedLetter.m);
10920
+ }
10921
+ }
10922
+ ////textSpan.setAttribute('opacity',renderedLetter.o);
10923
+ textSpan.style.opacity = renderedLetter.o;
10924
+ if (renderedLetter.sw && renderedLetter._mdf.sw) {
10925
+ textPath.setAttribute('stroke-width', renderedLetter.sw);
10926
+ }
10927
+ if (renderedLetter.sc && renderedLetter._mdf.sc) {
10928
+ textPath.setAttribute('stroke', renderedLetter.sc);
10929
+ }
10930
+ if (renderedLetter.fc && renderedLetter._mdf.fc) {
10931
+ textPath.setAttribute('fill', renderedLetter.fc);
10932
+ textPath.style.color = renderedLetter.fc;
10933
+ }
10934
+ }
10935
+
10936
+ if (this.innerElem.getBBox && !this.hidden && (this._isFirstFrame || this._mdf)) {
10937
+ var boundingBox = this.innerElem.getBBox();
10938
+
10939
+ if (this.currentBBox.w !== boundingBox.width) {
10940
+ this.currentBBox.w = boundingBox.width;
10941
+ this.svgElement.setAttribute('width', boundingBox.width);
10942
+ }
10943
+ if (this.currentBBox.h !== boundingBox.height) {
10944
+ this.currentBBox.h = boundingBox.height;
10945
+ this.svgElement.setAttribute('height', boundingBox.height);
10946
+ }
10947
+
10948
+ var margin = 1;
10949
+ if (this.currentBBox.w !== (boundingBox.width + margin * 2) || this.currentBBox.h !== (boundingBox.height + margin * 2) || this.currentBBox.x !== (boundingBox.x - margin) || this.currentBBox.y !== (boundingBox.y - margin)) {
10950
+ this.currentBBox.w = boundingBox.width + margin * 2;
10951
+ this.currentBBox.h = boundingBox.height + margin * 2;
10952
+ this.currentBBox.x = boundingBox.x - margin;
10953
+ this.currentBBox.y = boundingBox.y - margin;
10954
+
10955
+ this.svgElement.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h);
10956
+ this.svgElement.style.transform = this.svgElement.style.webkitTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';
10957
+ }
10958
+ }
10959
+ };
10960
+ function HImageElement(data, globalData, comp) {
10961
+ this.assetData = globalData.getAssetData(data.refId);
10962
+ this.initElement(data, globalData, comp);
10963
+ }
10964
+
10965
+ extendPrototype([BaseElement, TransformElement, HBaseElement, HSolidElement, HierarchyElement, FrameElement, RenderableElement], HImageElement);
10966
+
10967
+
10968
+ HImageElement.prototype.createContent = function () {
10969
+ var assetPath = this.globalData.getAssetsPath(this.assetData);
10970
+ var img = new Image();
10971
+
10972
+ if (this.data.hasMask) {
10973
+ this.imageElem = createNS('image');
10974
+ this.imageElem.setAttribute('width', this.assetData.w + "px");
10975
+ this.imageElem.setAttribute('height', this.assetData.h + "px");
10976
+ this.imageElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath);
10977
+ this.layerElement.appendChild(this.imageElem);
10978
+ this.baseElement.setAttribute('width', this.assetData.w);
10979
+ this.baseElement.setAttribute('height', this.assetData.h);
10980
+ } else {
10981
+ this.layerElement.appendChild(img);
10982
+ }
10983
+ img.src = assetPath;
10984
+ if (this.data.ln) {
10985
+ this.baseElement.setAttribute('id', this.data.ln);
10986
+ }
10987
+ };
10988
+ function HCameraElement(data, globalData, comp) {
10989
+ this.initFrame();
10990
+ this.initBaseData(data, globalData, comp);
10991
+ this.initHierarchy();
10992
+ var getProp = PropertyFactory.getProp;
10993
+ this.pe = getProp(this, data.pe, 0, 0, this);
10994
+ if (data.ks.p.s) {
10995
+ this.px = getProp(this, data.ks.p.x, 1, 0, this);
10996
+ this.py = getProp(this, data.ks.p.y, 1, 0, this);
10997
+ this.pz = getProp(this, data.ks.p.z, 1, 0, this);
10998
+ } else {
10999
+ this.p = getProp(this, data.ks.p, 1, 0, this);
11000
+ }
11001
+ if (data.ks.a) {
11002
+ this.a = getProp(this, data.ks.a, 1, 0, this);
11003
+ }
11004
+ if (data.ks.or.k.length && data.ks.or.k[0].to) {
11005
+ var i, len = data.ks.or.k.length;
11006
+ for (i = 0; i < len; i += 1) {
11007
+ data.ks.or.k[i].to = null;
11008
+ data.ks.or.k[i].ti = null;
11009
+ }
11010
+ }
11011
+ this.or = getProp(this, data.ks.or, 1, degToRads, this);
11012
+ this.or.sh = true;
11013
+ this.rx = getProp(this, data.ks.rx, 0, degToRads, this);
11014
+ this.ry = getProp(this, data.ks.ry, 0, degToRads, this);
11015
+ this.rz = getProp(this, data.ks.rz, 0, degToRads, this);
11016
+ this.mat = new Matrix();
11017
+ this._prevMat = new Matrix();
11018
+ this._isFirstFrame = true;
11019
+
11020
+ // TODO: find a better way to make the HCamera element to be compatible with the LayerInterface and TransformInterface.
11021
+ this.finalTransform = {
11022
+ mProp: this
11023
+ };
11024
+ }
11025
+ extendPrototype([BaseElement, FrameElement, HierarchyElement], HCameraElement);
11026
+
11027
+ HCameraElement.prototype.setup = function () {
11028
+ var i, len = this.comp.threeDElements.length, comp;
11029
+ for (i = 0; i < len; i += 1) {
11030
+ //[perspectiveElem,container]
11031
+ comp = this.comp.threeDElements[i];
11032
+ if (comp.type === '3d') {
11033
+ comp.perspectiveElem.style.perspective = comp.perspectiveElem.style.webkitPerspective = this.pe.v + 'px';
11034
+ comp.container.style.transformOrigin = comp.container.style.mozTransformOrigin = comp.container.style.webkitTransformOrigin = "0px 0px 0px";
11035
+ comp.perspectiveElem.style.transform = comp.perspectiveElem.style.webkitTransform = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';
11036
+ }
11037
+ }
11038
+ };
11039
+
11040
+ HCameraElement.prototype.createElements = function () {
11041
+ };
11042
+
11043
+ HCameraElement.prototype.hide = function () {
11044
+ };
11045
+
11046
+ HCameraElement.prototype.renderFrame = function () {
11047
+ var _mdf = this._isFirstFrame;
11048
+ var i, len;
11049
+ if (this.hierarchy) {
11050
+ len = this.hierarchy.length;
11051
+ for (i = 0; i < len; i += 1) {
11052
+ _mdf = this.hierarchy[i].finalTransform.mProp._mdf || _mdf;
11053
+ }
11054
+ }
11055
+ if (_mdf || this.pe._mdf || (this.p && this.p._mdf) || (this.px && (this.px._mdf || this.py._mdf || this.pz._mdf)) || this.rx._mdf || this.ry._mdf || this.rz._mdf || this.or._mdf || (this.a && this.a._mdf)) {
11056
+ this.mat.reset();
11057
+
11058
+ if (this.hierarchy) {
11059
+ var mat;
11060
+ len = this.hierarchy.length - 1;
11061
+ for (i = len; i >= 0; i -= 1) {
11062
+ var mTransf = this.hierarchy[i].finalTransform.mProp;
11063
+ this.mat.translate(-mTransf.p.v[0], -mTransf.p.v[1], mTransf.p.v[2]);
11064
+ this.mat.rotateX(-mTransf.or.v[0]).rotateY(-mTransf.or.v[1]).rotateZ(mTransf.or.v[2]);
11065
+ this.mat.rotateX(-mTransf.rx.v).rotateY(-mTransf.ry.v).rotateZ(mTransf.rz.v);
11066
+ this.mat.scale(1 / mTransf.s.v[0], 1 / mTransf.s.v[1], 1 / mTransf.s.v[2]);
11067
+ this.mat.translate(mTransf.a.v[0], mTransf.a.v[1], mTransf.a.v[2]);
11068
+ }
11069
+ }
11070
+ if (this.p) {
11071
+ this.mat.translate(-this.p.v[0], -this.p.v[1], this.p.v[2]);
11072
+ } else {
11073
+ this.mat.translate(-this.px.v, -this.py.v, this.pz.v);
11074
+ }
11075
+ if (this.a) {
11076
+ var diffVector
11077
+ if (this.p) {
11078
+ diffVector = [this.p.v[0] - this.a.v[0], this.p.v[1] - this.a.v[1], this.p.v[2] - this.a.v[2]];
11079
+ } else {
11080
+ diffVector = [this.px.v - this.a.v[0], this.py.v - this.a.v[1], this.pz.v - this.a.v[2]];
11081
+ }
11082
+ var mag = Math.sqrt(Math.pow(diffVector[0], 2) + Math.pow(diffVector[1], 2) + Math.pow(diffVector[2], 2));
11083
+ //var lookDir = getNormalizedPoint(getDiffVector(this.a.v,this.p.v));
11084
+ var lookDir = [diffVector[0] / mag, diffVector[1] / mag, diffVector[2] / mag];
11085
+ var lookLengthOnXZ = Math.sqrt(lookDir[2] * lookDir[2] + lookDir[0] * lookDir[0]);
11086
+ var m_rotationX = (Math.atan2(lookDir[1], lookLengthOnXZ));
11087
+ var m_rotationY = (Math.atan2(lookDir[0], -lookDir[2]));
11088
+ this.mat.rotateY(m_rotationY).rotateX(-m_rotationX);
11089
+
11090
+ }
11091
+ this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v);
11092
+ this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]);
11093
+ this.mat.translate(this.globalData.compSize.w / 2, this.globalData.compSize.h / 2, 0);
11094
+ this.mat.translate(0, 0, this.pe.v);
11095
+
11096
+
11097
+
11098
+
11099
+ var hasMatrixChanged = !this._prevMat.equals(this.mat);
11100
+ if ((hasMatrixChanged || this.pe._mdf) && this.comp.threeDElements) {
11101
+ len = this.comp.threeDElements.length;
11102
+ var comp;
11103
+ for (i = 0; i < len; i += 1) {
11104
+ comp = this.comp.threeDElements[i];
11105
+ if (comp.type === '3d') {
11106
+ if (hasMatrixChanged) {
11107
+ comp.container.style.transform = comp.container.style.webkitTransform = this.mat.toCSS();
11108
+ }
11109
+ if (this.pe._mdf) {
11110
+ comp.perspectiveElem.style.perspective = comp.perspectiveElem.style.webkitPerspective = this.pe.v + 'px';
11111
+ }
11112
+ }
11113
+ }
11114
+ this.mat.clone(this._prevMat);
11115
+ }
11116
+ }
11117
+ this._isFirstFrame = false;
11118
+ };
11119
+
11120
+ HCameraElement.prototype.prepareFrame = function (num) {
11121
+ this.prepareProperties(num, true);
11122
+ };
11123
+
11124
+ HCameraElement.prototype.destroy = function () {
11125
+ };
11126
+ HCameraElement.prototype.getBaseElement = function () { return null; };
11127
+ function HEffects() {
11128
+ }
11129
+ HEffects.prototype.renderFrame = function () { };
11130
+ var animationManager = (function () {
11131
+ var moduleOb = {};
11132
+ var registeredAnimations = [];
11133
+ var initTime = 0;
11134
+ var len = 0;
11135
+ var playingAnimationsNum = 0;
11136
+ var _stopped = true;
11137
+ var _isFrozen = false;
11138
+
11139
+ function removeElement(ev) {
11140
+ var i = 0;
11141
+ var animItem = ev.target;
11142
+ while (i < len) {
11143
+ if (registeredAnimations[i].animation === animItem) {
11144
+ registeredAnimations.splice(i, 1);
11145
+ i -= 1;
11146
+ len -= 1;
11147
+ if (!animItem.isPaused) {
11148
+ subtractPlayingCount();
11149
+ }
11150
+ }
11151
+ i += 1;
11152
+ }
11153
+ }
11154
+
11155
+ function registerAnimation(element, animationData) {
11156
+ if (!element) {
11157
+ return null;
11158
+ }
11159
+ var i = 0;
11160
+ while (i < len) {
11161
+ if (registeredAnimations[i].elem == element && registeredAnimations[i].elem !== null) {
11162
+ return registeredAnimations[i].animation;
11163
+ }
11164
+ i += 1;
11165
+ }
11166
+ var animItem = new AnimationItem();
11167
+ setupAnimation(animItem, element);
11168
+ animItem.setData(element, animationData);
11169
+ return animItem;
11170
+ }
11171
+
11172
+ function getRegisteredAnimations() {
11173
+ var i, len = registeredAnimations.length;
11174
+ var animations = [];
11175
+ for (i = 0; i < len; i += 1) {
11176
+ animations.push(registeredAnimations[i].animation);
11177
+ }
11178
+ return animations;
11179
+ }
11180
+
11181
+ function addPlayingCount() {
11182
+ playingAnimationsNum += 1;
11183
+ activate();
11184
+ }
11185
+
11186
+ function subtractPlayingCount() {
11187
+ playingAnimationsNum -= 1;
11188
+ }
11189
+
11190
+ function setupAnimation(animItem, element) {
11191
+ animItem.addEventListener('destroy', removeElement);
11192
+ animItem.addEventListener('_active', addPlayingCount);
11193
+ animItem.addEventListener('_idle', subtractPlayingCount);
11194
+ registeredAnimations.push({ elem: element, animation: animItem });
11195
+ len += 1;
11196
+ }
11197
+
11198
+ function loadAnimation(params) {
11199
+ var animItem = new AnimationItem();
11200
+ setupAnimation(animItem, null);
11201
+ animItem.setParams(params);
11202
+ return animItem;
11203
+ }
11204
+
11205
+
11206
+ function setSpeed(val, animation) {
11207
+ var i;
11208
+ for (i = 0; i < len; i += 1) {
11209
+ registeredAnimations[i].animation.setSpeed(val, animation);
11210
+ }
11211
+ }
11212
+
11213
+ function setDirection(val, animation) {
11214
+ var i;
11215
+ for (i = 0; i < len; i += 1) {
11216
+ registeredAnimations[i].animation.setDirection(val, animation);
11217
+ }
11218
+ }
11219
+
11220
+ function play(animation) {
11221
+ var i;
11222
+ for (i = 0; i < len; i += 1) {
11223
+ registeredAnimations[i].animation.play(animation);
11224
+ }
11225
+ }
11226
+ function resume(nowTime) {
11227
+ var elapsedTime = nowTime - initTime;
11228
+ var i;
11229
+ for (i = 0; i < len; i += 1) {
11230
+ registeredAnimations[i].animation.advanceTime(elapsedTime);
11231
+ }
11232
+ initTime = nowTime;
11233
+ if (playingAnimationsNum && !_isFrozen) {
11234
+ window.requestAnimationFrame(resume);
11235
+ } else {
11236
+ _stopped = true;
11237
+ }
11238
+ }
11239
+
11240
+ function first(nowTime) {
11241
+ initTime = nowTime;
11242
+ window.requestAnimationFrame(resume);
11243
+ }
11244
+
11245
+ function pause(animation) {
11246
+ var i;
11247
+ for (i = 0; i < len; i += 1) {
11248
+ registeredAnimations[i].animation.pause(animation);
11249
+ }
11250
+ }
11251
+
11252
+ function goToAndStop(value, isFrame, animation) {
11253
+ var i;
11254
+ for (i = 0; i < len; i += 1) {
11255
+ registeredAnimations[i].animation.goToAndStop(value, isFrame, animation);
11256
+ }
11257
+ }
11258
+
11259
+ function stop(animation) {
11260
+ var i;
11261
+ for (i = 0; i < len; i += 1) {
11262
+ registeredAnimations[i].animation.stop(animation);
11263
+ }
11264
+ }
11265
+
11266
+ function togglePause(animation) {
11267
+ var i;
11268
+ for (i = 0; i < len; i += 1) {
11269
+ registeredAnimations[i].animation.togglePause(animation);
11270
+ }
11271
+ }
11272
+
11273
+ function destroy(animation) {
11274
+ var i;
11275
+ for (i = (len - 1); i >= 0; i -= 1) {
11276
+ registeredAnimations[i].animation.destroy(animation);
11277
+ }
11278
+ }
11279
+
11280
+ function searchAnimations(animationData, standalone, renderer) {
11281
+ var animElements = [].concat([].slice.call(document.getElementsByClassName('lottie')),
11282
+ [].slice.call(document.getElementsByClassName('bodymovin')));
11283
+ var i, len = animElements.length;
11284
+ for (i = 0; i < len; i += 1) {
11285
+ if (renderer) {
11286
+ animElements[i].setAttribute('data-bm-type', renderer);
11287
+ }
11288
+ registerAnimation(animElements[i], animationData);
11289
+ }
11290
+ if (standalone && len === 0) {
11291
+ if (!renderer) {
11292
+ renderer = 'svg';
11293
+ }
11294
+ var body = document.getElementsByTagName('body')[0];
11295
+ body.innerHTML = '';
11296
+ var div = createTag('div');
11297
+ div.style.width = '100%';
11298
+ div.style.height = '100%';
11299
+ div.setAttribute('data-bm-type', renderer);
11300
+ body.appendChild(div);
11301
+ registerAnimation(div, animationData);
11302
+ }
11303
+ }
11304
+
11305
+ function resize() {
11306
+ var i;
11307
+ for (i = 0; i < len; i += 1) {
11308
+ registeredAnimations[i].animation.resize();
11309
+ }
11310
+ }
11311
+
11312
+ function activate() {
11313
+ if (!_isFrozen && playingAnimationsNum) {
11314
+ if (_stopped) {
11315
+ window.requestAnimationFrame(first);
11316
+ _stopped = false;
11317
+ }
11318
+ }
11319
+ }
11320
+
11321
+ function freeze() {
11322
+ _isFrozen = true;
11323
+ }
11324
+
11325
+ function unfreeze() {
11326
+ _isFrozen = false;
11327
+ activate();
11328
+ }
11329
+
11330
+ moduleOb.registerAnimation = registerAnimation;
11331
+ moduleOb.loadAnimation = loadAnimation;
11332
+ moduleOb.setSpeed = setSpeed;
11333
+ moduleOb.setDirection = setDirection;
11334
+ moduleOb.play = play;
11335
+ moduleOb.pause = pause;
11336
+ moduleOb.stop = stop;
11337
+ moduleOb.togglePause = togglePause;
11338
+ moduleOb.searchAnimations = searchAnimations;
11339
+ moduleOb.resize = resize;
11340
+ //moduleOb.start = start;
11341
+ moduleOb.goToAndStop = goToAndStop;
11342
+ moduleOb.destroy = destroy;
11343
+ moduleOb.freeze = freeze;
11344
+ moduleOb.unfreeze = unfreeze;
11345
+ moduleOb.getRegisteredAnimations = getRegisteredAnimations;
11346
+ return moduleOb;
11347
+ }());
11348
+
11349
+ var AnimationItem = function () {
11350
+ this._cbs = [];
11351
+ this.name = '';
11352
+ this.path = '';
11353
+ this.isLoaded = false;
11354
+ this.currentFrame = 0;
11355
+ this.currentRawFrame = 0;
11356
+ this.firstFrame = 0;
11357
+ this.totalFrames = 0;
11358
+ this.frameRate = 0;
11359
+ this.frameMult = 0;
11360
+ this.playSpeed = 1;
11361
+ this.playDirection = 1;
11362
+ this.playCount = 0;
11363
+ this.animationData = {};
11364
+ this.assets = [];
11365
+ this.isPaused = true;
11366
+ this.autoplay = false;
11367
+ this.loop = true;
11368
+ this.renderer = null;
11369
+ this.animationID = createElementID();
11370
+ this.assetsPath = '';
11371
+ this.timeCompleted = 0;
11372
+ this.segmentPos = 0;
11373
+ this.subframeEnabled = subframeEnabled;
11374
+ this.segments = [];
11375
+ this._idle = true;
11376
+ this._completedLoop = false;
11377
+ this.projectInterface = ProjectInterface();
11378
+ this.imagePreloader = new ImagePreloader();
11379
+ };
11380
+
11381
+ extendPrototype([BaseEvent], AnimationItem);
11382
+
11383
+ AnimationItem.prototype.setParams = function (params) {
11384
+ if (params.context) {
11385
+ this.context = params.context;
11386
+ }
11387
+ if (params.wrapper || params.container) {
11388
+ this.wrapper = params.wrapper || params.container;
11389
+ }
11390
+ var animType = params.animType ? params.animType : params.renderer ? params.renderer : 'svg';
11391
+ switch (animType) {
11392
+ case 'canvas':
11393
+ this.renderer = new CanvasRenderer(this, params.rendererSettings);
11394
+ break;
11395
+ case 'svg':
11396
+ this.renderer = new SVGRenderer(this, params.rendererSettings);
11397
+ break;
11398
+ default:
11399
+ this.renderer = new HybridRenderer(this, params.rendererSettings);
11400
+ break;
11401
+ }
11402
+ this.renderer.setProjectInterface(this.projectInterface);
11403
+ this.animType = animType;
11404
+
11405
+ if (params.loop === '' || params.loop === null) {
11406
+ } else if (params.loop === false) {
11407
+ this.loop = false;
11408
+ } else if (params.loop === true) {
11409
+ this.loop = true;
11410
+ } else {
11411
+ this.loop = parseInt(params.loop);
11412
+ }
11413
+ this.autoplay = 'autoplay' in params ? params.autoplay : true;
11414
+ this.name = params.name ? params.name : '';
11415
+ this.autoloadSegments = params.hasOwnProperty('autoloadSegments') ? params.autoloadSegments : true;
11416
+ this.assetsPath = params.assetsPath;
11417
+ if (params.animationData) {
11418
+ this.configAnimation(params.animationData);
11419
+ } else if (params.path) {
11420
+
11421
+ if (params.path.lastIndexOf('\\') !== -1) {
11422
+ this.path = params.path.substr(0, params.path.lastIndexOf('\\') + 1);
11423
+ } else {
11424
+ this.path = params.path.substr(0, params.path.lastIndexOf('/') + 1);
11425
+ }
11426
+ this.fileName = params.path.substr(params.path.lastIndexOf('/') + 1);
11427
+ this.fileName = this.fileName.substr(0, this.fileName.lastIndexOf('.json'));
11428
+
11429
+ assetLoader.load(params.path, this.configAnimation.bind(this), function () {
11430
+ this.trigger('data_failed');
11431
+ }.bind(this));
11432
+ }
11433
+
11434
+ this.initialSegment = params.initialSegment;
11435
+ };
11436
+
11437
+ AnimationItem.prototype.setData = function (wrapper, animationData) {
11438
+ var params = {
11439
+ wrapper: wrapper,
11440
+ animationData: animationData ? (typeof animationData === "object") ? animationData : JSON.parse(animationData) : null
11441
+ };
11442
+ var wrapperAttributes = wrapper.attributes;
11443
+
11444
+ params.path = wrapperAttributes.getNamedItem('data-animation-path') ? wrapperAttributes.getNamedItem('data-animation-path').value : wrapperAttributes.getNamedItem('data-bm-path') ? wrapperAttributes.getNamedItem('data-bm-path').value : wrapperAttributes.getNamedItem('bm-path') ? wrapperAttributes.getNamedItem('bm-path').value : '';
11445
+ params.animType = wrapperAttributes.getNamedItem('data-anim-type') ? wrapperAttributes.getNamedItem('data-anim-type').value : wrapperAttributes.getNamedItem('data-bm-type') ? wrapperAttributes.getNamedItem('data-bm-type').value : wrapperAttributes.getNamedItem('bm-type') ? wrapperAttributes.getNamedItem('bm-type').value : wrapperAttributes.getNamedItem('data-bm-renderer') ? wrapperAttributes.getNamedItem('data-bm-renderer').value : wrapperAttributes.getNamedItem('bm-renderer') ? wrapperAttributes.getNamedItem('bm-renderer').value : 'canvas';
11446
+
11447
+ var loop = wrapperAttributes.getNamedItem('data-anim-loop') ? wrapperAttributes.getNamedItem('data-anim-loop').value : wrapperAttributes.getNamedItem('data-bm-loop') ? wrapperAttributes.getNamedItem('data-bm-loop').value : wrapperAttributes.getNamedItem('bm-loop') ? wrapperAttributes.getNamedItem('bm-loop').value : '';
11448
+ if (loop === '') {
11449
+ } else if (loop === 'false') {
11450
+ params.loop = false;
11451
+ } else if (loop === 'true') {
11452
+ params.loop = true;
11453
+ } else {
11454
+ params.loop = parseInt(loop);
11455
+ }
11456
+ var autoplay = wrapperAttributes.getNamedItem('data-anim-autoplay') ? wrapperAttributes.getNamedItem('data-anim-autoplay').value : wrapperAttributes.getNamedItem('data-bm-autoplay') ? wrapperAttributes.getNamedItem('data-bm-autoplay').value : wrapperAttributes.getNamedItem('bm-autoplay') ? wrapperAttributes.getNamedItem('bm-autoplay').value : true;
11457
+ params.autoplay = autoplay !== "false";
11458
+
11459
+ params.name = wrapperAttributes.getNamedItem('data-name') ? wrapperAttributes.getNamedItem('data-name').value : wrapperAttributes.getNamedItem('data-bm-name') ? wrapperAttributes.getNamedItem('data-bm-name').value : wrapperAttributes.getNamedItem('bm-name') ? wrapperAttributes.getNamedItem('bm-name').value : '';
11460
+ var prerender = wrapperAttributes.getNamedItem('data-anim-prerender') ? wrapperAttributes.getNamedItem('data-anim-prerender').value : wrapperAttributes.getNamedItem('data-bm-prerender') ? wrapperAttributes.getNamedItem('data-bm-prerender').value : wrapperAttributes.getNamedItem('bm-prerender') ? wrapperAttributes.getNamedItem('bm-prerender').value : '';
11461
+
11462
+ if (prerender === 'false') {
11463
+ params.prerender = false;
11464
+ }
11465
+ this.setParams(params);
11466
+ };
11467
+
11468
+ AnimationItem.prototype.includeLayers = function (data) {
11469
+ if (data.op > this.animationData.op) {
11470
+ this.animationData.op = data.op;
11471
+ this.totalFrames = Math.floor(data.op - this.animationData.ip);
11472
+ }
11473
+ var layers = this.animationData.layers;
11474
+ var i, len = layers.length;
11475
+ var newLayers = data.layers;
11476
+ var j, jLen = newLayers.length;
11477
+ for (j = 0; j < jLen; j += 1) {
11478
+ i = 0;
11479
+ while (i < len) {
11480
+ if (layers[i].id == newLayers[j].id) {
11481
+ layers[i] = newLayers[j];
11482
+ break;
11483
+ }
11484
+ i += 1;
11485
+ }
11486
+ }
11487
+ if (data.chars || data.fonts) {
11488
+ this.renderer.globalData.fontManager.addChars(data.chars);
11489
+ this.renderer.globalData.fontManager.addFonts(data.fonts, this.renderer.globalData.defs);
11490
+ }
11491
+ if (data.assets) {
11492
+ len = data.assets.length;
11493
+ for (i = 0; i < len; i += 1) {
11494
+ this.animationData.assets.push(data.assets[i]);
11495
+ }
11496
+ }
11497
+ this.animationData.__complete = false;
11498
+ dataManager.completeData(this.animationData, this.renderer.globalData.fontManager);
11499
+ this.renderer.includeLayers(data.layers);
11500
+ if (expressionsPlugin) {
11501
+ expressionsPlugin.initExpressions(this);
11502
+ }
11503
+ this.loadNextSegment();
11504
+ };
11505
+
11506
+ AnimationItem.prototype.loadNextSegment = function () {
11507
+ var segments = this.animationData.segments;
11508
+ if (!segments || segments.length === 0 || !this.autoloadSegments) {
11509
+ this.trigger('data_ready');
11510
+ this.timeCompleted = this.totalFrames;
11511
+ return;
11512
+ }
11513
+ var segment = segments.shift();
11514
+ this.timeCompleted = segment.time * this.frameRate;
11515
+ var segmentPath = this.path + this.fileName + '_' + this.segmentPos + '.json';
11516
+ this.segmentPos += 1;
11517
+ assetLoader.load(segmentPath, this.includeLayers.bind(this), function () {
11518
+ this.trigger('data_failed');
11519
+ }.bind(this));
11520
+ };
11521
+
11522
+ AnimationItem.prototype.loadSegments = function () {
11523
+ var segments = this.animationData.segments;
11524
+ if (!segments) {
11525
+ this.timeCompleted = this.totalFrames;
11526
+ }
11527
+ this.loadNextSegment();
11528
+ };
11529
+
11530
+ AnimationItem.prototype.imagesLoaded = function () {
11531
+ this.trigger('loaded_images');
11532
+ this.checkLoaded()
11533
+ }
11534
+
11535
+ AnimationItem.prototype.preloadImages = function () {
11536
+ this.imagePreloader.setAssetsPath(this.assetsPath);
11537
+ this.imagePreloader.setPath(this.path);
11538
+ this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this));
11539
+ }
11540
+
11541
+ AnimationItem.prototype.configAnimation = function (animData) {
11542
+ if (!this.renderer) {
11543
+ return;
11544
+ }
11545
+ try {
11546
+ this.animationData = animData;
11547
+
11548
+ if (this.initialSegment) {
11549
+ this.totalFrames = Math.floor(this.initialSegment[1] - this.initialSegment[0]);
11550
+ this.firstFrame = Math.round(this.initialSegment[0]);
11551
+ } else {
11552
+ this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip);
11553
+ this.firstFrame = Math.round(this.animationData.ip);
11554
+ }
11555
+ this.renderer.configAnimation(animData);
11556
+ if (!animData.assets) {
11557
+ animData.assets = [];
11558
+ }
11559
+
11560
+ this.assets = this.animationData.assets;
11561
+ this.frameRate = this.animationData.fr;
11562
+ this.frameMult = this.animationData.fr / 1000;
11563
+ this.renderer.searchExtraCompositions(animData.assets);
11564
+ this.trigger('config_ready');
11565
+ this.preloadImages();
11566
+ this.loadSegments();
11567
+ this.updaFrameModifier();
11568
+ this.waitForFontsLoaded();
11569
+ } catch (error) {
11570
+ this.triggerConfigError(error);
11571
+ }
11572
+ };
11573
+
11574
+ AnimationItem.prototype.waitForFontsLoaded = function () {
11575
+ if (!this.renderer) {
11576
+ return;
11577
+ }
11578
+ if (this.renderer.globalData.fontManager.loaded()) {
11579
+ this.checkLoaded();
11580
+ } else {
11581
+ setTimeout(this.waitForFontsLoaded.bind(this), 20);
11582
+ }
11583
+ }
11584
+
11585
+ AnimationItem.prototype.checkLoaded = function () {
11586
+ if (!this.isLoaded && this.renderer.globalData.fontManager.loaded() && (this.imagePreloader.loaded() || this.renderer.rendererType !== 'canvas')) {
11587
+ this.isLoaded = true;
11588
+ dataManager.completeData(this.animationData, this.renderer.globalData.fontManager);
11589
+ if (expressionsPlugin) {
11590
+ expressionsPlugin.initExpressions(this);
11591
+ }
11592
+ this.renderer.initItems();
11593
+ setTimeout(function () {
11594
+ this.trigger('DOMLoaded');
11595
+ }.bind(this), 0);
11596
+ this.gotoFrame();
11597
+ if (this.autoplay) {
11598
+ this.play();
11599
+ }
11600
+ }
11601
+ };
11602
+
11603
+ AnimationItem.prototype.resize = function () {
11604
+ this.renderer.updateContainerSize();
11605
+ };
11606
+
11607
+ AnimationItem.prototype.setSubframe = function (flag) {
11608
+ this.subframeEnabled = flag ? true : false;
11609
+ };
11610
+
11611
+ AnimationItem.prototype.gotoFrame = function () {
11612
+ this.currentFrame = this.subframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame;
11613
+
11614
+ if (this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted) {
11615
+ this.currentFrame = this.timeCompleted;
11616
+ }
11617
+ this.trigger('enterFrame');
11618
+ this.renderFrame();
11619
+ };
11620
+
11621
+ AnimationItem.prototype.renderFrame = function () {
11622
+ if (this.isLoaded === false) {
11623
+ return;
11624
+ }
11625
+ try {
11626
+ this.renderer.renderFrame(this.currentFrame + this.firstFrame);
11627
+ } catch (error) {
11628
+ this.triggerRenderFrameError(error);
11629
+ }
11630
+ };
11631
+
11632
+ AnimationItem.prototype.play = function (name) {
11633
+ if (name && this.name != name) {
11634
+ return;
11635
+ }
11636
+ if (this.isPaused === true) {
11637
+ this.isPaused = false;
11638
+ if (this._idle) {
11639
+ this._idle = false;
11640
+ this.trigger('_active');
11641
+ }
11642
+ }
11643
+ };
11644
+
11645
+ AnimationItem.prototype.pause = function (name) {
11646
+ if (name && this.name != name) {
11647
+ return;
11648
+ }
11649
+ if (this.isPaused === false) {
11650
+ this.isPaused = true;
11651
+ this._idle = true;
11652
+ this.trigger('_idle');
11653
+ }
11654
+ };
11655
+
11656
+ AnimationItem.prototype.togglePause = function (name) {
11657
+ if (name && this.name != name) {
11658
+ return;
11659
+ }
11660
+ if (this.isPaused === true) {
11661
+ this.play();
11662
+ } else {
11663
+ this.pause();
11664
+ }
11665
+ };
11666
+
11667
+ AnimationItem.prototype.stop = function (name) {
11668
+ if (name && this.name != name) {
11669
+ return;
11670
+ }
11671
+ this.pause();
11672
+ this.playCount = 0;
11673
+ this._completedLoop = false;
11674
+ this.setCurrentRawFrameValue(0);
11675
+ };
11676
+
11677
+ AnimationItem.prototype.goToAndStop = function (value, isFrame, name) {
11678
+ if (name && this.name != name) {
11679
+ return;
11680
+ }
11681
+ if (isFrame) {
11682
+ this.setCurrentRawFrameValue(value);
11683
+ } else {
11684
+ this.setCurrentRawFrameValue(value * this.frameModifier);
11685
+ }
11686
+ this.pause();
11687
+ };
11688
+
11689
+ AnimationItem.prototype.goToAndPlay = function (value, isFrame, name) {
11690
+ this.goToAndStop(value, isFrame, name);
11691
+ this.play();
11692
+ };
11693
+
11694
+ AnimationItem.prototype.advanceTime = function (value) {
11695
+ if (this.isPaused === true || this.isLoaded === false) {
11696
+ return;
11697
+ }
11698
+ var nextValue = this.currentRawFrame + value * this.frameModifier;
11699
+ var _isComplete = false;
11700
+ // Checking if nextValue > totalFrames - 1 for addressing non looping and looping animations.
11701
+ // If animation won't loop, it should stop at totalFrames - 1. If it will loop it should complete the last frame and then loop.
11702
+ if (nextValue >= this.totalFrames - 1 && this.frameModifier > 0) {
11703
+ if (!this.loop || this.playCount === this.loop) {
11704
+ if (!this.checkSegments(nextValue > this.totalFrames ? nextValue % this.totalFrames : 0)) {
11705
+ _isComplete = true;
11706
+ nextValue = this.totalFrames - 1;
11707
+ }
11708
+ } else if (nextValue >= this.totalFrames) {
11709
+ this.playCount += 1;
11710
+ if (!this.checkSegments(nextValue % this.totalFrames)) {
11711
+ this.setCurrentRawFrameValue(nextValue % this.totalFrames);
11712
+ this._completedLoop = true;
11713
+ this.trigger('loopComplete');
11714
+ }
11715
+ } else {
11716
+ this.setCurrentRawFrameValue(nextValue);
11717
+ }
11718
+ } else if (nextValue < 0) {
11719
+ if (!this.checkSegments(nextValue % this.totalFrames)) {
11720
+ if (this.loop && !(this.playCount-- <= 0 && this.loop !== true)) {
11721
+ this.setCurrentRawFrameValue(this.totalFrames + (nextValue % this.totalFrames));
11722
+ if (!this._completedLoop) {
11723
+ this._completedLoop = true;
11724
+ } else {
11725
+ this.trigger('loopComplete');
11726
+ }
11727
+ } else {
11728
+ _isComplete = true;
11729
+ nextValue = 0;
11730
+ }
11731
+ }
11732
+ } else {
11733
+ this.setCurrentRawFrameValue(nextValue);
11734
+ }
11735
+ if (_isComplete) {
11736
+ this.setCurrentRawFrameValue(nextValue);
11737
+ this.pause();
11738
+ this.trigger('complete');
11739
+ }
11740
+ };
11741
+
11742
+ AnimationItem.prototype.adjustSegment = function (arr, offset) {
11743
+ this.playCount = 0;
11744
+ if (arr[1] < arr[0]) {
11745
+ if (this.frameModifier > 0) {
11746
+ if (this.playSpeed < 0) {
11747
+ this.setSpeed(-this.playSpeed);
11748
+ } else {
11749
+ this.setDirection(-1);
11750
+ }
11751
+ }
11752
+ this.timeCompleted = this.totalFrames = arr[0] - arr[1];
11753
+ this.firstFrame = arr[1];
11754
+ this.setCurrentRawFrameValue(this.totalFrames - 0.001 - offset);
11755
+ } else if (arr[1] > arr[0]) {
11756
+ if (this.frameModifier < 0) {
11757
+ if (this.playSpeed < 0) {
11758
+ this.setSpeed(-this.playSpeed);
11759
+ } else {
11760
+ this.setDirection(1);
11761
+ }
11762
+ }
11763
+ this.timeCompleted = this.totalFrames = arr[1] - arr[0];
11764
+ this.firstFrame = arr[0];
11765
+ this.setCurrentRawFrameValue(0.001 + offset);
11766
+ }
11767
+ this.trigger('segmentStart');
11768
+ };
11769
+ AnimationItem.prototype.setSegment = function (init, end) {
11770
+ var pendingFrame = -1;
11771
+ if (this.isPaused) {
11772
+ if (this.currentRawFrame + this.firstFrame < init) {
11773
+ pendingFrame = init;
11774
+ } else if (this.currentRawFrame + this.firstFrame > end) {
11775
+ pendingFrame = end - init;
11776
+ }
11777
+ }
11778
+
11779
+ this.firstFrame = init;
11780
+ this.timeCompleted = this.totalFrames = end - init;
11781
+ if (pendingFrame !== -1) {
11782
+ this.goToAndStop(pendingFrame, true);
11783
+ }
11784
+ };
11785
+
11786
+ AnimationItem.prototype.playSegments = function (arr, forceFlag) {
11787
+ if (forceFlag) {
11788
+ this.segments.length = 0;
11789
+ }
11790
+ if (typeof arr[0] === 'object') {
11791
+ var i, len = arr.length;
11792
+ for (i = 0; i < len; i += 1) {
11793
+ this.segments.push(arr[i]);
11794
+ }
11795
+ } else {
11796
+ this.segments.push(arr);
11797
+ }
11798
+ if (this.segments.length && forceFlag) {
11799
+ this.adjustSegment(this.segments.shift(), 0);
11800
+ }
11801
+ if (this.isPaused) {
11802
+ this.play();
11803
+ }
11804
+ };
11805
+
11806
+ AnimationItem.prototype.resetSegments = function (forceFlag) {
11807
+ this.segments.length = 0;
11808
+ this.segments.push([this.animationData.ip, this.animationData.op]);
11809
+ //this.segments.push([this.animationData.ip*this.frameRate,Math.floor(this.animationData.op - this.animationData.ip+this.animationData.ip*this.frameRate)]);
11810
+ if (forceFlag) {
11811
+ this.checkSegments(0);
11812
+ }
11813
+ };
11814
+ AnimationItem.prototype.checkSegments = function (offset) {
11815
+ if (this.segments.length) {
11816
+ this.adjustSegment(this.segments.shift(), offset);
11817
+ return true;
11818
+ }
11819
+ return false;
11820
+ };
11821
+
11822
+ AnimationItem.prototype.destroy = function (name) {
11823
+ if ((name && this.name != name) || !this.renderer) {
11824
+ return;
11825
+ }
11826
+ this.renderer.destroy();
11827
+ this.imagePreloader.destroy();
11828
+ this.trigger('destroy');
11829
+ this._cbs = null;
11830
+ this.onEnterFrame = this.onLoopComplete = this.onComplete = this.onSegmentStart = this.onDestroy = null;
11831
+ this.renderer = null;
11832
+ };
11833
+
11834
+ AnimationItem.prototype.setCurrentRawFrameValue = function (value) {
11835
+ this.currentRawFrame = value;
11836
+ this.gotoFrame();
11837
+ };
11838
+
11839
+ AnimationItem.prototype.setSpeed = function (val) {
11840
+ this.playSpeed = val;
11841
+ this.updaFrameModifier();
11842
+ };
11843
+
11844
+ AnimationItem.prototype.setDirection = function (val) {
11845
+ this.playDirection = val < 0 ? -1 : 1;
11846
+ this.updaFrameModifier();
11847
+ };
11848
+
11849
+ AnimationItem.prototype.updaFrameModifier = function () {
11850
+ this.frameModifier = this.frameMult * this.playSpeed * this.playDirection;
11851
+ };
11852
+
11853
+ AnimationItem.prototype.getPath = function () {
11854
+ return this.path;
11855
+ };
11856
+
11857
+ AnimationItem.prototype.getAssetsPath = function (assetData) {
11858
+ var path = '';
11859
+ if (assetData.e) {
11860
+ path = assetData.p;
11861
+ } else if (this.assetsPath) {
11862
+ var imagePath = assetData.p;
11863
+ if (imagePath.indexOf('images/') !== -1) {
11864
+ imagePath = imagePath.split('/')[1];
11865
+ }
11866
+ path = this.assetsPath + imagePath;
11867
+ } else {
11868
+ path = this.path;
11869
+ path += assetData.u ? assetData.u : '';
11870
+ path += assetData.p;
11871
+ }
11872
+ return path;
11873
+ };
11874
+
11875
+ AnimationItem.prototype.getAssetData = function (id) {
11876
+ var i = 0, len = this.assets.length;
11877
+ while (i < len) {
11878
+ if (id == this.assets[i].id) {
11879
+ return this.assets[i];
11880
+ }
11881
+ i += 1;
11882
+ }
11883
+ };
11884
+
11885
+ AnimationItem.prototype.hide = function () {
11886
+ this.renderer.hide();
11887
+ };
11888
+
11889
+ AnimationItem.prototype.show = function () {
11890
+ this.renderer.show();
11891
+ };
11892
+
11893
+ AnimationItem.prototype.getDuration = function (isFrame) {
11894
+ return isFrame ? this.totalFrames : this.totalFrames / this.frameRate;
11895
+ };
11896
+
11897
+ AnimationItem.prototype.trigger = function (name) {
11898
+ if (this._cbs && this._cbs[name]) {
11899
+ switch (name) {
11900
+ case 'enterFrame':
11901
+ this.triggerEvent(name, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameModifier));
11902
+ break;
11903
+ case 'loopComplete':
11904
+ this.triggerEvent(name, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult));
11905
+ break;
11906
+ case 'complete':
11907
+ this.triggerEvent(name, new BMCompleteEvent(name, this.frameMult));
11908
+ break;
11909
+ case 'segmentStart':
11910
+ this.triggerEvent(name, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames));
11911
+ break;
11912
+ case 'destroy':
11913
+ this.triggerEvent(name, new BMDestroyEvent(name, this));
11914
+ break;
11915
+ default:
11916
+ this.triggerEvent(name);
11917
+ }
11918
+ }
11919
+ if (name === 'enterFrame' && this.onEnterFrame) {
11920
+ this.onEnterFrame.call(this, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameMult));
11921
+ }
11922
+ if (name === 'loopComplete' && this.onLoopComplete) {
11923
+ this.onLoopComplete.call(this, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult));
11924
+ }
11925
+ if (name === 'complete' && this.onComplete) {
11926
+ this.onComplete.call(this, new BMCompleteEvent(name, this.frameMult));
11927
+ }
11928
+ if (name === 'segmentStart' && this.onSegmentStart) {
11929
+ this.onSegmentStart.call(this, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames));
11930
+ }
11931
+ if (name === 'destroy' && this.onDestroy) {
11932
+ this.onDestroy.call(this, new BMDestroyEvent(name, this));
11933
+ }
11934
+ };
11935
+
11936
+ AnimationItem.prototype.triggerRenderFrameError = function (nativeError) {
11937
+
11938
+ var error = new BMRenderFrameErrorEvent(nativeError, this.currentFrame);
11939
+ this.triggerEvent('error', error);
11940
+
11941
+ if (this.onError) {
11942
+ this.onError.call(this, error);
11943
+ }
11944
+ }
11945
+
11946
+ AnimationItem.prototype.triggerConfigError = function (nativeError) {
11947
+
11948
+ var error = new BMConfigErrorEvent(nativeError, this.currentFrame);
11949
+ this.triggerEvent('error', error);
11950
+
11951
+ if (this.onError) {
11952
+ this.onError.call(this, error);
11953
+ }
11954
+ }
11955
+ var Expressions = (function () {
11956
+ var ob = {};
11957
+ ob.initExpressions = initExpressions;
11958
+
11959
+
11960
+ function initExpressions(animation) {
11961
+
11962
+ var stackCount = 0;
11963
+ var registers = [];
11964
+
11965
+ function pushExpression() {
11966
+ stackCount += 1;
11967
+ }
11968
+
11969
+ function popExpression() {
11970
+ stackCount -= 1;
11971
+ if (stackCount === 0) {
11972
+ releaseInstances();
11973
+ }
11974
+ }
11975
+
11976
+ function registerExpressionProperty(expression) {
11977
+ if (registers.indexOf(expression) === -1) {
11978
+ registers.push(expression)
11979
+ }
11980
+ }
11981
+
11982
+ function releaseInstances() {
11983
+ var i, len = registers.length;
11984
+ for (i = 0; i < len; i += 1) {
11985
+ registers[i].release();
11986
+ }
11987
+ registers.length = 0;
11988
+ }
11989
+
11990
+ animation.renderer.compInterface = CompExpressionInterface(animation.renderer);
11991
+ animation.renderer.globalData.projectInterface.registerComposition(animation.renderer);
11992
+ animation.renderer.globalData.pushExpression = pushExpression;
11993
+ animation.renderer.globalData.popExpression = popExpression;
11994
+ animation.renderer.globalData.registerExpressionProperty = registerExpressionProperty;
11995
+ }
11996
+ return ob;
11997
+ }());
11998
+
11999
+ expressionsPlugin = Expressions;
12000
+
12001
+ var ExpressionManager = (function () {
12002
+ 'use strict';
12003
+ var ob = {};
12004
+ var Math = BMMath;
12005
+ var window = null;
12006
+ var document = null;
12007
+
12008
+ function $bm_isInstanceOfArray(arr) {
12009
+ return arr.constructor === Array || arr.constructor === Float32Array;
12010
+ }
12011
+
12012
+ function isNumerable(tOfV, v) {
12013
+ return tOfV === 'number' || tOfV === 'boolean' || tOfV === 'string' || v instanceof Number;
12014
+ }
12015
+
12016
+ function $bm_neg(a) {
12017
+ var tOfA = typeof a;
12018
+ if (tOfA === 'number' || tOfA === 'boolean' || a instanceof Number) {
12019
+ return -a;
12020
+ }
12021
+ if ($bm_isInstanceOfArray(a)) {
12022
+ var i, lenA = a.length;
12023
+ var retArr = [];
12024
+ for (i = 0; i < lenA; i += 1) {
12025
+ retArr[i] = -a[i];
12026
+ }
12027
+ return retArr;
12028
+ }
12029
+ if (a.propType) {
12030
+ return a.v;
12031
+ }
12032
+ }
12033
+
12034
+ var easeInBez = BezierFactory.getBezierEasing(0.333, 0, .833, .833, 'easeIn').get;
12035
+ var easeOutBez = BezierFactory.getBezierEasing(0.167, 0.167, .667, 1, 'easeOut').get;
12036
+ var easeInOutBez = BezierFactory.getBezierEasing(.33, 0, .667, 1, 'easeInOut').get;
12037
+
12038
+ function sum(a, b) {
12039
+ var tOfA = typeof a;
12040
+ var tOfB = typeof b;
12041
+ if (tOfA === 'string' || tOfB === 'string') {
12042
+ return a + b;
12043
+ }
12044
+ if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {
12045
+ return a + b;
12046
+ }
12047
+ if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {
12048
+ a = a.slice(0);
12049
+ a[0] = a[0] + b;
12050
+ return a;
12051
+ }
12052
+ if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {
12053
+ b = b.slice(0);
12054
+ b[0] = a + b[0];
12055
+ return b;
12056
+ }
12057
+ if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {
12058
+
12059
+ var i = 0, lenA = a.length, lenB = b.length;
12060
+ var retArr = [];
12061
+ while (i < lenA || i < lenB) {
12062
+ if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) {
12063
+ retArr[i] = a[i] + b[i];
12064
+ } else {
12065
+ retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i];
12066
+ }
12067
+ i += 1;
12068
+ }
12069
+ return retArr;
12070
+ }
12071
+ return 0;
12072
+ }
12073
+ var add = sum;
12074
+
12075
+ function sub(a, b) {
12076
+ var tOfA = typeof a;
12077
+ var tOfB = typeof b;
12078
+ if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {
12079
+ if (tOfA === 'string') {
12080
+ a = parseInt(a);
12081
+ }
12082
+ if (tOfB === 'string') {
12083
+ b = parseInt(b);
12084
+ }
12085
+ return a - b;
12086
+ }
12087
+ if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {
12088
+ a = a.slice(0);
12089
+ a[0] = a[0] - b;
12090
+ return a;
12091
+ }
12092
+ if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {
12093
+ b = b.slice(0);
12094
+ b[0] = a - b[0];
12095
+ return b;
12096
+ }
12097
+ if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {
12098
+ var i = 0, lenA = a.length, lenB = b.length;
12099
+ var retArr = [];
12100
+ while (i < lenA || i < lenB) {
12101
+ if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) {
12102
+ retArr[i] = a[i] - b[i];
12103
+ } else {
12104
+ retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i];
12105
+ }
12106
+ i += 1;
12107
+ }
12108
+ return retArr;
12109
+ }
12110
+ return 0;
12111
+ }
12112
+
12113
+ function mul(a, b) {
12114
+ var tOfA = typeof a;
12115
+ var tOfB = typeof b;
12116
+ var arr;
12117
+ if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {
12118
+ return a * b;
12119
+ }
12120
+
12121
+ var i, len;
12122
+ if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {
12123
+ len = a.length;
12124
+ arr = createTypedArray('float32', len);
12125
+ for (i = 0; i < len; i += 1) {
12126
+ arr[i] = a[i] * b;
12127
+ }
12128
+ return arr;
12129
+ }
12130
+ if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {
12131
+ len = b.length;
12132
+ arr = createTypedArray('float32', len);
12133
+ for (i = 0; i < len; i += 1) {
12134
+ arr[i] = a * b[i];
12135
+ }
12136
+ return arr;
12137
+ }
12138
+ return 0;
12139
+ }
12140
+
12141
+ function div(a, b) {
12142
+ var tOfA = typeof a;
12143
+ var tOfB = typeof b;
12144
+ var arr;
12145
+ if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {
12146
+ return a / b;
12147
+ }
12148
+ var i, len;
12149
+ if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {
12150
+ len = a.length;
12151
+ arr = createTypedArray('float32', len);
12152
+ for (i = 0; i < len; i += 1) {
12153
+ arr[i] = a[i] / b;
12154
+ }
12155
+ return arr;
12156
+ }
12157
+ if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {
12158
+ len = b.length;
12159
+ arr = createTypedArray('float32', len);
12160
+ for (i = 0; i < len; i += 1) {
12161
+ arr[i] = a / b[i];
12162
+ }
12163
+ return arr;
12164
+ }
12165
+ return 0;
12166
+ }
12167
+ function mod(a, b) {
12168
+ if (typeof a === 'string') {
12169
+ a = parseInt(a);
12170
+ }
12171
+ if (typeof b === 'string') {
12172
+ b = parseInt(b);
12173
+ }
12174
+ return a % b;
12175
+ }
12176
+ var $bm_sum = sum;
12177
+ var $bm_sub = sub;
12178
+ var $bm_mul = mul;
12179
+ var $bm_div = div;
12180
+ var $bm_mod = mod;
12181
+
12182
+ function clamp(num, min, max) {
12183
+ if (min > max) {
12184
+ var mm = max;
12185
+ max = min;
12186
+ min = mm;
12187
+ }
12188
+ return Math.min(Math.max(num, min), max);
12189
+ }
12190
+
12191
+ function radiansToDegrees(val) {
12192
+ return val / degToRads;
12193
+ }
12194
+ var radians_to_degrees = radiansToDegrees;
12195
+
12196
+ function degreesToRadians(val) {
12197
+ return val * degToRads;
12198
+ }
12199
+ var degrees_to_radians = radiansToDegrees;
12200
+
12201
+ var helperLengthArray = [0, 0, 0, 0, 0, 0];
12202
+
12203
+ function length(arr1, arr2) {
12204
+ if (typeof arr1 === 'number' || arr1 instanceof Number) {
12205
+ arr2 = arr2 || 0;
12206
+ return Math.abs(arr1 - arr2);
12207
+ }
12208
+ if (!arr2) {
12209
+ arr2 = helperLengthArray;
12210
+ }
12211
+ var i, len = Math.min(arr1.length, arr2.length);
12212
+ var addedLength = 0;
12213
+ for (i = 0; i < len; i += 1) {
12214
+ addedLength += Math.pow(arr2[i] - arr1[i], 2);
12215
+ }
12216
+ return Math.sqrt(addedLength);
12217
+ }
12218
+
12219
+ function normalize(vec) {
12220
+ return div(vec, length(vec));
12221
+ }
12222
+
12223
+ function rgbToHsl(val) {
12224
+ var r = val[0]; var g = val[1]; var b = val[2];
12225
+ var max = Math.max(r, g, b), min = Math.min(r, g, b);
12226
+ var h, s, l = (max + min) / 2;
12227
+
12228
+ if (max == min) {
12229
+ h = s = 0; // achromatic
12230
+ } else {
12231
+ var d = max - min;
12232
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
12233
+ switch (max) {
12234
+ case r: h = (g - b) / d + (g < b ? 6 : 0); break;
12235
+ case g: h = (b - r) / d + 2; break;
12236
+ case b: h = (r - g) / d + 4; break;
12237
+ }
12238
+ h /= 6;
12239
+ }
12240
+
12241
+ return [h, s, l, val[3]];
12242
+ }
12243
+
12244
+ function hue2rgb(p, q, t) {
12245
+ if (t < 0) t += 1;
12246
+ if (t > 1) t -= 1;
12247
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
12248
+ if (t < 1 / 2) return q;
12249
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
12250
+ return p;
12251
+ }
12252
+
12253
+ function hslToRgb(val) {
12254
+ var h = val[0];
12255
+ var s = val[1];
12256
+ var l = val[2];
12257
+
12258
+ var r, g, b;
12259
+
12260
+ if (s === 0) {
12261
+ r = g = b = l; // achromatic
12262
+ } else {
12263
+
12264
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
12265
+ var p = 2 * l - q;
12266
+ r = hue2rgb(p, q, h + 1 / 3);
12267
+ g = hue2rgb(p, q, h);
12268
+ b = hue2rgb(p, q, h - 1 / 3);
12269
+ }
12270
+
12271
+ return [r, g, b, val[3]];
12272
+ }
12273
+
12274
+ function linear(t, tMin, tMax, value1, value2) {
12275
+ if (value1 === undefined || value2 === undefined) {
12276
+ value1 = tMin;
12277
+ value2 = tMax;
12278
+ tMin = 0;
12279
+ tMax = 1;
12280
+ }
12281
+ if (tMax < tMin) {
12282
+ var _tMin = tMax;
12283
+ tMax = tMin;
12284
+ tMin = _tMin;
12285
+ }
12286
+ if (t <= tMin) {
12287
+ return value1;
12288
+ } else if (t >= tMax) {
12289
+ return value2;
12290
+ }
12291
+ var perc = tMax === tMin ? 0 : (t - tMin) / (tMax - tMin);
12292
+ if (!value1.length) {
12293
+ return value1 + (value2 - value1) * perc;
12294
+ }
12295
+ var i, len = value1.length;
12296
+ var arr = createTypedArray('float32', len);
12297
+ for (i = 0; i < len; i += 1) {
12298
+ arr[i] = value1[i] + (value2[i] - value1[i]) * perc;
12299
+ }
12300
+ return arr;
12301
+ }
12302
+ function random(min, max) {
12303
+ if (max === undefined) {
12304
+ if (min === undefined) {
12305
+ min = 0;
12306
+ max = 1;
12307
+ } else {
12308
+ max = min;
12309
+ min = undefined;
12310
+ }
12311
+ }
12312
+ if (max.length) {
12313
+ var i, len = max.length;
12314
+ if (!min) {
12315
+ min = createTypedArray('float32', len);
12316
+ }
12317
+ var arr = createTypedArray('float32', len);
12318
+ var rnd = BMMath.random();
12319
+ for (i = 0; i < len; i += 1) {
12320
+ arr[i] = min[i] + rnd * (max[i] - min[i]);
12321
+ }
12322
+ return arr;
12323
+ }
12324
+ if (min === undefined) {
12325
+ min = 0;
12326
+ }
12327
+ var rndm = BMMath.random();
12328
+ return min + rndm * (max - min);
12329
+ }
12330
+
12331
+ function createPath(points, inTangents, outTangents, closed) {
12332
+ var i, len = points.length;
12333
+ var path = shape_pool.newElement();
12334
+ path.setPathData(!!closed, len);
12335
+ var arrPlaceholder = [0, 0], inVertexPoint, outVertexPoint;
12336
+ for (i = 0; i < len; i += 1) {
12337
+ inVertexPoint = (inTangents && inTangents[i]) ? inTangents[i] : arrPlaceholder;
12338
+ outVertexPoint = (outTangents && outTangents[i]) ? outTangents[i] : arrPlaceholder;
12339
+ path.setTripleAt(points[i][0], points[i][1], outVertexPoint[0] + points[i][0], outVertexPoint[1] + points[i][1], inVertexPoint[0] + points[i][0], inVertexPoint[1] + points[i][1], i, true);
12340
+ }
12341
+ return path;
12342
+ }
12343
+
12344
+ function initiateExpression(elem, data, property) {
12345
+ var val = data.x;
12346
+ var needsVelocity = /velocity(?![\w\d])/.test(val);
12347
+ var _needsRandom = val.indexOf('random') !== -1;
12348
+ var elemType = elem.data.ty;
12349
+ var transform, $bm_transform, content, effect;
12350
+ var thisProperty = property;
12351
+ thisProperty.valueAtTime = thisProperty.getValueAtTime;
12352
+ Object.defineProperty(thisProperty, 'value', {
12353
+ get: function () {
12354
+ return thisProperty.v
12355
+ }
12356
+ })
12357
+ elem.comp.frameDuration = 1 / elem.comp.globalData.frameRate;
12358
+ elem.comp.displayStartTime = 0;
12359
+ var inPoint = elem.data.ip / elem.comp.globalData.frameRate;
12360
+ var outPoint = elem.data.op / elem.comp.globalData.frameRate;
12361
+ var width = elem.data.sw ? elem.data.sw : 0;
12362
+ var height = elem.data.sh ? elem.data.sh : 0;
12363
+ var name = elem.data.nm;
12364
+ var loopIn, loop_in, loopOut, loop_out, smooth;
12365
+ var toWorld, fromWorld, fromComp, toComp, fromCompToSurface, position, rotation, anchorPoint, scale, thisLayer, thisComp, mask, valueAtTime, velocityAtTime;
12366
+ var __expression_functions = [];
12367
+ if (data.xf) {
12368
+ var i, len = data.xf.length;
12369
+ for (i = 0; i < len; i += 1) {
12370
+ __expression_functions[i] = eval('(function(){ return ' + data.xf[i] + '}())');
12371
+ }
12372
+ }
12373
+
12374
+ var scoped_bm_rt;
12375
+ var expression_function = eval('[function _expression_function(){' + val + ';scoped_bm_rt=$bm_rt}' + ']')[0];
12376
+ var numKeys = property.kf ? data.k.length : 0;
12377
+
12378
+ var active = !this.data || this.data.hd !== true;
12379
+
12380
+ var wiggle = function wiggle(freq, amp) {
12381
+ var i, j, len = this.pv.length ? this.pv.length : 1;
12382
+ var addedAmps = createTypedArray('float32', len);
12383
+ freq = 5;
12384
+ var iterations = Math.floor(time * freq);
12385
+ i = 0;
12386
+ j = 0;
12387
+ while (i < iterations) {
12388
+ //var rnd = BMMath.random();
12389
+ for (j = 0; j < len; j += 1) {
12390
+ addedAmps[j] += -amp + amp * 2 * BMMath.random();
12391
+ //addedAmps[j] += -amp + amp*2*rnd;
12392
+ }
12393
+ i += 1;
12394
+ }
12395
+ //var rnd2 = BMMath.random();
12396
+ var periods = time * freq;
12397
+ var perc = periods - Math.floor(periods);
12398
+ var arr = createTypedArray('float32', len);
12399
+ if (len > 1) {
12400
+ for (j = 0; j < len; j += 1) {
12401
+ arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp * 2 * BMMath.random()) * perc;
12402
+ //arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp*2*rnd)*perc;
12403
+ //arr[i] = this.pv[i] + addedAmp + amp1*perc + amp2*(1-perc);
12404
+ }
12405
+ return arr;
12406
+ } else {
12407
+ return this.pv + addedAmps[0] + (-amp + amp * 2 * BMMath.random()) * perc;
12408
+ }
12409
+ }.bind(this);
12410
+
12411
+ if (thisProperty.loopIn) {
12412
+ loopIn = thisProperty.loopIn.bind(thisProperty);
12413
+ loop_in = loopIn;
12414
+ }
12415
+
12416
+ if (thisProperty.loopOut) {
12417
+ loopOut = thisProperty.loopOut.bind(thisProperty);
12418
+ loop_out = loopOut;
12419
+ }
12420
+
12421
+ if (thisProperty.smooth) {
12422
+ smooth = thisProperty.smooth.bind(thisProperty);
12423
+ }
12424
+
12425
+ function loopInDuration(type, duration) {
12426
+ return loopIn(type, duration, true);
12427
+ }
12428
+
12429
+ function loopOutDuration(type, duration) {
12430
+ return loopOut(type, duration, true);
12431
+ }
12432
+
12433
+ if (this.getValueAtTime) {
12434
+ valueAtTime = this.getValueAtTime.bind(this);
12435
+ }
12436
+
12437
+ if (this.getVelocityAtTime) {
12438
+ velocityAtTime = this.getVelocityAtTime.bind(this);
12439
+ }
12440
+
12441
+ var comp = elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface);
12442
+
12443
+ function lookAt(elem1, elem2) {
12444
+ var fVec = [elem2[0] - elem1[0], elem2[1] - elem1[1], elem2[2] - elem1[2]];
12445
+ var pitch = Math.atan2(fVec[0], Math.sqrt(fVec[1] * fVec[1] + fVec[2] * fVec[2])) / degToRads;
12446
+ var yaw = -Math.atan2(fVec[1], fVec[2]) / degToRads;
12447
+ return [yaw, pitch, 0];
12448
+ }
12449
+
12450
+ function easeOut(t, tMin, tMax, val1, val2) {
12451
+ return applyEase(easeOutBez, t, tMin, tMax, val1, val2);
12452
+ }
12453
+
12454
+ function easeIn(t, tMin, tMax, val1, val2) {
12455
+ return applyEase(easeInBez, t, tMin, tMax, val1, val2);
12456
+ }
12457
+
12458
+ function ease(t, tMin, tMax, val1, val2) {
12459
+ return applyEase(easeInOutBez, t, tMin, tMax, val1, val2);
12460
+ }
12461
+
12462
+ function applyEase(fn, t, tMin, tMax, val1, val2) {
12463
+ if (val1 === undefined) {
12464
+ val1 = tMin;
12465
+ val2 = tMax;
12466
+ } else {
12467
+ t = (t - tMin) / (tMax - tMin);
12468
+ }
12469
+ t = t > 1 ? 1 : t < 0 ? 0 : t;
12470
+ var mult = fn(t);
12471
+ if ($bm_isInstanceOfArray(val1)) {
12472
+ var i, len = val1.length;
12473
+ var arr = createTypedArray('float32', len);
12474
+ for (i = 0; i < len; i += 1) {
12475
+ arr[i] = (val2[i] - val1[i]) * mult + val1[i];
12476
+ }
12477
+ return arr;
12478
+ } else {
12479
+ return (val2 - val1) * mult + val1;
12480
+ }
12481
+ }
12482
+
12483
+ function nearestKey(time) {
12484
+ var i, len = data.k.length, index, keyTime;
12485
+ if (!data.k.length || typeof (data.k[0]) === 'number') {
12486
+ index = 0;
12487
+ keyTime = 0;
12488
+ } else {
12489
+ index = -1;
12490
+ time *= elem.comp.globalData.frameRate;
12491
+ if (time < data.k[0].t) {
12492
+ index = 1;
12493
+ keyTime = data.k[0].t;
12494
+ } else {
12495
+ for (i = 0; i < len - 1; i += 1) {
12496
+ if (time === data.k[i].t) {
12497
+ index = i + 1;
12498
+ keyTime = data.k[i].t;
12499
+ break;
12500
+ } else if (time > data.k[i].t && time < data.k[i + 1].t) {
12501
+ if (time - data.k[i].t > data.k[i + 1].t - time) {
12502
+ index = i + 2;
12503
+ keyTime = data.k[i + 1].t;
12504
+ } else {
12505
+ index = i + 1;
12506
+ keyTime = data.k[i].t;
12507
+ }
12508
+ break;
12509
+ }
12510
+ }
12511
+ if (index === -1) {
12512
+ index = i + 1;
12513
+ keyTime = data.k[i].t;
12514
+ }
12515
+ }
12516
+
12517
+ }
12518
+ var ob = {};
12519
+ ob.index = index;
12520
+ ob.time = keyTime / elem.comp.globalData.frameRate;
12521
+ return ob;
12522
+ }
12523
+
12524
+ function key(ind) {
12525
+ var ob, i, len;
12526
+ if (!data.k.length || typeof (data.k[0]) === 'number') {
12527
+ throw new Error('The property has no keyframe at index ' + ind);
12528
+ }
12529
+ ind -= 1;
12530
+ ob = {
12531
+ time: data.k[ind].t / elem.comp.globalData.frameRate,
12532
+ value: []
12533
+ };
12534
+ var arr = data.k[ind].hasOwnProperty('s') ? data.k[ind].s : data.k[ind - 1].e;
12535
+
12536
+ len = arr.length;
12537
+ for (i = 0; i < len; i += 1) {
12538
+ ob[i] = arr[i];
12539
+ ob.value[i] = arr[i]
12540
+ }
12541
+ return ob;
12542
+ }
12543
+
12544
+ function framesToTime(frames, fps) {
12545
+ if (!fps) {
12546
+ fps = elem.comp.globalData.frameRate;
12547
+ }
12548
+ return frames / fps;
12549
+ }
12550
+
12551
+ function timeToFrames(t, fps) {
12552
+ if (!t && t !== 0) {
12553
+ t = time;
12554
+ }
12555
+ if (!fps) {
12556
+ fps = elem.comp.globalData.frameRate;
12557
+ }
12558
+ return t * fps;
12559
+ }
12560
+
12561
+ function seedRandom(seed) {
12562
+ BMMath.seedrandom(randSeed + seed);
12563
+ }
12564
+
12565
+ function sourceRectAtTime() {
12566
+ return elem.sourceRectAtTime();
12567
+ }
12568
+
12569
+ function substring(init, end) {
12570
+ if (typeof value === 'string') {
12571
+ if (end === undefined) {
12572
+ return value.substring(init)
12573
+ }
12574
+ return value.substring(init, end)
12575
+ }
12576
+ return '';
12577
+ }
12578
+
12579
+ function substr(init, end) {
12580
+ if (typeof value === 'string') {
12581
+ if (end === undefined) {
12582
+ return value.substr(init)
12583
+ }
12584
+ return value.substr(init, end)
12585
+ }
12586
+ return '';
12587
+ }
12588
+
12589
+ function posterizeTime(framesPerSecond) {
12590
+ time = framesPerSecond === 0 ? 0 : Math.floor(time * framesPerSecond) / framesPerSecond
12591
+ value = valueAtTime(time)
12592
+ }
12593
+
12594
+ var time, velocity, value, text, textIndex, textTotal, selectorValue;
12595
+ var index = elem.data.ind;
12596
+ var hasParent = !!(elem.hierarchy && elem.hierarchy.length);
12597
+ var parent;
12598
+ var randSeed = Math.floor(Math.random() * 1000000);
12599
+ var globalData = elem.globalData;
12600
+ function executeExpression(_value) {
12601
+ // globalData.pushExpression();
12602
+ value = _value;
12603
+ if (_needsRandom) {
12604
+ seedRandom(randSeed);
12605
+ }
12606
+ if (this.frameExpressionId === elem.globalData.frameId && this.propType !== 'textSelector') {
12607
+ return value;
12608
+ }
12609
+ if (this.propType === 'textSelector') {
12610
+ textIndex = this.textIndex;
12611
+ textTotal = this.textTotal;
12612
+ selectorValue = this.selectorValue;
12613
+ }
12614
+ if (!thisLayer) {
12615
+ text = elem.layerInterface.text;
12616
+ thisLayer = elem.layerInterface;
12617
+ thisComp = elem.comp.compInterface;
12618
+ toWorld = thisLayer.toWorld.bind(thisLayer);
12619
+ fromWorld = thisLayer.fromWorld.bind(thisLayer);
12620
+ fromComp = thisLayer.fromComp.bind(thisLayer);
12621
+ toComp = thisLayer.toComp.bind(thisLayer);
12622
+ mask = thisLayer.mask ? thisLayer.mask.bind(thisLayer) : null;
12623
+ fromCompToSurface = fromComp;
12624
+ }
12625
+ if (!transform) {
12626
+ transform = elem.layerInterface("ADBE Transform Group");
12627
+ $bm_transform = transform;
12628
+ if (transform) {
12629
+ anchorPoint = transform.anchorPoint;
12630
+ /*position = transform.position;
12631
+ rotation = transform.rotation;
12632
+ scale = transform.scale;*/
12633
+ }
12634
+ }
12635
+
12636
+ if (elemType === 4 && !content) {
12637
+ content = thisLayer("ADBE Root Vectors Group");
12638
+ }
12639
+ if (!effect) {
12640
+ effect = thisLayer(4);
12641
+ }
12642
+ hasParent = !!(elem.hierarchy && elem.hierarchy.length);
12643
+ if (hasParent && !parent) {
12644
+ parent = elem.hierarchy[0].layerInterface;
12645
+ }
12646
+ time = this.comp.renderedFrame / this.comp.globalData.frameRate;
12647
+ if (needsVelocity) {
12648
+ velocity = velocityAtTime(time);
12649
+ }
12650
+ expression_function();
12651
+ this.frameExpressionId = elem.globalData.frameId;
12652
+
12653
+
12654
+ //TODO: Check if it's possible to return on ShapeInterface the .v value
12655
+ if (scoped_bm_rt.propType === "shape") {
12656
+ scoped_bm_rt = scoped_bm_rt.v;
12657
+ }
12658
+ // globalData.popExpression();
12659
+ return scoped_bm_rt;
12660
+ }
12661
+ return executeExpression;
12662
+ }
12663
+
12664
+ ob.initiateExpression = initiateExpression;
12665
+ return ob;
12666
+ }());
12667
+ var expressionHelpers = (function () {
12668
+
12669
+ function searchExpressions(elem, data, prop) {
12670
+ if (data.x) {
12671
+ prop.k = true;
12672
+ prop.x = true;
12673
+ prop.initiateExpression = ExpressionManager.initiateExpression;
12674
+ prop.effectsSequence.push(prop.initiateExpression(elem, data, prop).bind(prop));
12675
+ }
12676
+ }
12677
+
12678
+ function getValueAtTime(frameNum) {
12679
+ frameNum *= this.elem.globalData.frameRate;
12680
+ frameNum -= this.offsetTime;
12681
+ if (frameNum !== this._cachingAtTime.lastFrame) {
12682
+ this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0;
12683
+ this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime);
12684
+ this._cachingAtTime.lastFrame = frameNum;
12685
+ }
12686
+ return this._cachingAtTime.value;
12687
+
12688
+ }
12689
+
12690
+ function getSpeedAtTime(frameNum) {
12691
+ var delta = -0.01;
12692
+ var v1 = this.getValueAtTime(frameNum);
12693
+ var v2 = this.getValueAtTime(frameNum + delta);
12694
+ var speed = 0;
12695
+ if (v1.length) {
12696
+ var i;
12697
+ for (i = 0; i < v1.length; i += 1) {
12698
+ speed += Math.pow(v2[i] - v1[i], 2);
12699
+ }
12700
+ speed = Math.sqrt(speed) * 100;
12701
+ } else {
12702
+ speed = 0;
12703
+ }
12704
+ return speed;
12705
+ }
12706
+
12707
+ function getVelocityAtTime(frameNum) {
12708
+ if (this.vel !== undefined) {
12709
+ return this.vel;
12710
+ }
12711
+ var delta = -0.001;
12712
+ //frameNum += this.elem.data.st;
12713
+ var v1 = this.getValueAtTime(frameNum);
12714
+ var v2 = this.getValueAtTime(frameNum + delta);
12715
+ var velocity;
12716
+ if (v1.length) {
12717
+ velocity = createTypedArray('float32', v1.length);
12718
+ var i;
12719
+ for (i = 0; i < v1.length; i += 1) {
12720
+ //removing frameRate
12721
+ //if needed, don't add it here
12722
+ //velocity[i] = this.elem.globalData.frameRate*((v2[i] - v1[i])/delta);
12723
+ velocity[i] = (v2[i] - v1[i]) / delta;
12724
+ }
12725
+ } else {
12726
+ velocity = (v2 - v1) / delta;
12727
+ }
12728
+ return velocity;
12729
+ }
12730
+
12731
+ function getStaticValueAtTime() {
12732
+ return this.pv;
12733
+ }
12734
+
12735
+ function setGroupProperty(propertyGroup) {
12736
+ this.propertyGroup = propertyGroup;
12737
+ }
12738
+
12739
+ return {
12740
+ searchExpressions: searchExpressions,
12741
+ getSpeedAtTime: getSpeedAtTime,
12742
+ getVelocityAtTime: getVelocityAtTime,
12743
+ getValueAtTime: getValueAtTime,
12744
+ getStaticValueAtTime: getStaticValueAtTime,
12745
+ setGroupProperty: setGroupProperty,
12746
+ }
12747
+ }());
12748
+ (function addPropertyDecorator() {
12749
+
12750
+ function loopOut(type, duration, durationFlag) {
12751
+ if (!this.k || !this.keyframes) {
12752
+ return this.pv;
12753
+ }
12754
+ type = type ? type.toLowerCase() : '';
12755
+ var currentFrame = this.comp.renderedFrame;
12756
+ var keyframes = this.keyframes;
12757
+ var lastKeyFrame = keyframes[keyframes.length - 1].t;
12758
+ if (currentFrame <= lastKeyFrame) {
12759
+ return this.pv;
12760
+ } else {
12761
+ var cycleDuration, firstKeyFrame;
12762
+ if (!durationFlag) {
12763
+ if (!duration || duration > keyframes.length - 1) {
12764
+ duration = keyframes.length - 1;
12765
+ }
12766
+ firstKeyFrame = keyframes[keyframes.length - 1 - duration].t;
12767
+ cycleDuration = lastKeyFrame - firstKeyFrame;
12768
+ } else {
12769
+ if (!duration) {
12770
+ cycleDuration = Math.max(0, lastKeyFrame - this.elem.data.ip);
12771
+ } else {
12772
+ cycleDuration = Math.abs(lastKeyFrame - elem.comp.globalData.frameRate * duration);
12773
+ }
12774
+ firstKeyFrame = lastKeyFrame - cycleDuration;
12775
+ }
12776
+ var i, len, ret;
12777
+ if (type === 'pingpong') {
12778
+ var iterations = Math.floor((currentFrame - firstKeyFrame) / cycleDuration);
12779
+ if (iterations % 2 !== 0) {
12780
+ return this.getValueAtTime(((cycleDuration - (currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
12781
+ }
12782
+ } else if (type === 'offset') {
12783
+ var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
12784
+ var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
12785
+ var current = this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0);
12786
+ var repeats = Math.floor((currentFrame - firstKeyFrame) / cycleDuration);
12787
+ if (this.pv.length) {
12788
+ ret = new Array(initV.length);
12789
+ len = ret.length;
12790
+ for (i = 0; i < len; i += 1) {
12791
+ ret[i] = (endV[i] - initV[i]) * repeats + current[i];
12792
+ }
12793
+ return ret;
12794
+ }
12795
+ return (endV - initV) * repeats + current;
12796
+ } else if (type === 'continue') {
12797
+ var lastValue = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
12798
+ var nextLastValue = this.getValueAtTime((lastKeyFrame - 0.001) / this.comp.globalData.frameRate, 0);
12799
+ if (this.pv.length) {
12800
+ ret = new Array(lastValue.length);
12801
+ len = ret.length;
12802
+ for (i = 0; i < len; i += 1) {
12803
+ ret[i] = lastValue[i] + (lastValue[i] - nextLastValue[i]) * ((currentFrame - lastKeyFrame) / this.comp.globalData.frameRate) / 0.0005;
12804
+ }
12805
+ return ret;
12806
+ }
12807
+ return lastValue + (lastValue - nextLastValue) * (((currentFrame - lastKeyFrame)) / 0.001);
12808
+ }
12809
+ return this.getValueAtTime((((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
12810
+ }
12811
+ }
12812
+
12813
+ function loopIn(type, duration, durationFlag) {
12814
+ if (!this.k) {
12815
+ return this.pv;
12816
+ }
12817
+ type = type ? type.toLowerCase() : '';
12818
+ var currentFrame = this.comp.renderedFrame;
12819
+ var keyframes = this.keyframes;
12820
+ var firstKeyFrame = keyframes[0].t;
12821
+ if (currentFrame >= firstKeyFrame) {
12822
+ return this.pv;
12823
+ } else {
12824
+ var cycleDuration, lastKeyFrame;
12825
+ if (!durationFlag) {
12826
+ if (!duration || duration > keyframes.length - 1) {
12827
+ duration = keyframes.length - 1;
12828
+ }
12829
+ lastKeyFrame = keyframes[duration].t;
12830
+ cycleDuration = lastKeyFrame - firstKeyFrame;
12831
+ } else {
12832
+ if (!duration) {
12833
+ cycleDuration = Math.max(0, this.elem.data.op - firstKeyFrame);
12834
+ } else {
12835
+ cycleDuration = Math.abs(elem.comp.globalData.frameRate * duration);
12836
+ }
12837
+ lastKeyFrame = firstKeyFrame + cycleDuration;
12838
+ }
12839
+ var i, len, ret;
12840
+ if (type === 'pingpong') {
12841
+ var iterations = Math.floor((firstKeyFrame - currentFrame) / cycleDuration);
12842
+ if (iterations % 2 === 0) {
12843
+ return this.getValueAtTime((((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
12844
+ }
12845
+ } else if (type === 'offset') {
12846
+ var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
12847
+ var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
12848
+ var current = this.getValueAtTime((cycleDuration - (firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0);
12849
+ var repeats = Math.floor((firstKeyFrame - currentFrame) / cycleDuration) + 1;
12850
+ if (this.pv.length) {
12851
+ ret = new Array(initV.length);
12852
+ len = ret.length;
12853
+ for (i = 0; i < len; i += 1) {
12854
+ ret[i] = current[i] - (endV[i] - initV[i]) * repeats;
12855
+ }
12856
+ return ret;
12857
+ }
12858
+ return current - (endV - initV) * repeats;
12859
+ } else if (type === 'continue') {
12860
+ var firstValue = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
12861
+ var nextFirstValue = this.getValueAtTime((firstKeyFrame + 0.001) / this.comp.globalData.frameRate, 0);
12862
+ if (this.pv.length) {
12863
+ ret = new Array(firstValue.length);
12864
+ len = ret.length;
12865
+ for (i = 0; i < len; i += 1) {
12866
+ ret[i] = firstValue[i] + (firstValue[i] - nextFirstValue[i]) * (firstKeyFrame - currentFrame) / 0.001;
12867
+ }
12868
+ return ret;
12869
+ }
12870
+ return firstValue + (firstValue - nextFirstValue) * (firstKeyFrame - currentFrame) / 0.001;
12871
+ }
12872
+ return this.getValueAtTime(((cycleDuration - (firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
12873
+ }
12874
+ }
12875
+
12876
+ function smooth(width, samples) {
12877
+ if (!this.k) {
12878
+ return this.pv;
12879
+ }
12880
+ width = (width || 0.4) * 0.5;
12881
+ samples = Math.floor(samples || 5);
12882
+ if (samples <= 1) {
12883
+ return this.pv;
12884
+ }
12885
+ var currentTime = this.comp.renderedFrame / this.comp.globalData.frameRate;
12886
+ var initFrame = currentTime - width;
12887
+ var endFrame = currentTime + width;
12888
+ var sampleFrequency = samples > 1 ? (endFrame - initFrame) / (samples - 1) : 1;
12889
+ var i = 0, j = 0;
12890
+ var value;
12891
+ if (this.pv.length) {
12892
+ value = createTypedArray('float32', this.pv.length);
12893
+ } else {
12894
+ value = 0;
12895
+ }
12896
+ var sampleValue;
12897
+ while (i < samples) {
12898
+ sampleValue = this.getValueAtTime(initFrame + i * sampleFrequency);
12899
+ if (this.pv.length) {
12900
+ for (j = 0; j < this.pv.length; j += 1) {
12901
+ value[j] += sampleValue[j];
12902
+ }
12903
+ } else {
12904
+ value += sampleValue;
12905
+ }
12906
+ i += 1;
12907
+ }
12908
+ if (this.pv.length) {
12909
+ for (j = 0; j < this.pv.length; j += 1) {
12910
+ value[j] /= samples;
12911
+ }
12912
+ } else {
12913
+ value /= samples;
12914
+ }
12915
+ return value;
12916
+ }
12917
+
12918
+ function getValueAtTime(frameNum) {
12919
+ frameNum *= this.elem.globalData.frameRate;
12920
+ frameNum -= this.offsetTime;
12921
+ if (frameNum !== this._cachingAtTime.lastFrame) {
12922
+ this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0;
12923
+ this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime);
12924
+ this._cachingAtTime.lastFrame = frameNum;
12925
+ }
12926
+ return this._cachingAtTime.value;
12927
+
12928
+ }
12929
+
12930
+ function getTransformValueAtTime(time) {
12931
+ console.warn('Transform at time not supported');
12932
+ }
12933
+
12934
+ function getTransformStaticValueAtTime(time) {
12935
+
12936
+ }
12937
+
12938
+ var getTransformProperty = TransformPropertyFactory.getTransformProperty;
12939
+ TransformPropertyFactory.getTransformProperty = function (elem, data, container) {
12940
+ var prop = getTransformProperty(elem, data, container);
12941
+ if (prop.dynamicProperties.length) {
12942
+ prop.getValueAtTime = getTransformValueAtTime.bind(prop);
12943
+ } else {
12944
+ prop.getValueAtTime = getTransformStaticValueAtTime.bind(prop);
12945
+ }
12946
+ prop.setGroupProperty = expressionHelpers.setGroupProperty;
12947
+ return prop;
12948
+ };
12949
+
12950
+ var propertyGetProp = PropertyFactory.getProp;
12951
+ PropertyFactory.getProp = function (elem, data, type, mult, container) {
12952
+ var prop = propertyGetProp(elem, data, type, mult, container);
12953
+ //prop.getVelocityAtTime = getVelocityAtTime;
12954
+ //prop.loopOut = loopOut;
12955
+ //prop.loopIn = loopIn;
12956
+ if (prop.kf) {
12957
+ prop.getValueAtTime = expressionHelpers.getValueAtTime.bind(prop);
12958
+ } else {
12959
+ prop.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(prop);
12960
+ }
12961
+ prop.setGroupProperty = expressionHelpers.setGroupProperty;
12962
+ prop.loopOut = loopOut;
12963
+ prop.loopIn = loopIn;
12964
+ prop.smooth = smooth;
12965
+ prop.getVelocityAtTime = expressionHelpers.getVelocityAtTime.bind(prop);
12966
+ prop.getSpeedAtTime = expressionHelpers.getSpeedAtTime.bind(prop);
12967
+ prop.numKeys = data.a === 1 ? data.k.length : 0;
12968
+ prop.propertyIndex = data.ix;
12969
+ var value = 0;
12970
+ if (type !== 0) {
12971
+ value = createTypedArray('float32', data.a === 1 ? data.k[0].s.length : data.k.length);
12972
+ }
12973
+ prop._cachingAtTime = {
12974
+ lastFrame: initialDefaultFrame,
12975
+ lastIndex: 0,
12976
+ value: value
12977
+ };
12978
+ expressionHelpers.searchExpressions(elem, data, prop);
12979
+ if (prop.k) {
12980
+ container.addDynamicProperty(prop);
12981
+ }
12982
+
12983
+ return prop;
12984
+ };
12985
+
12986
+ function getShapeValueAtTime(frameNum) {
12987
+ //For now this caching object is created only when needed instead of creating it when the shape is initialized.
12988
+ if (!this._cachingAtTime) {
12989
+ this._cachingAtTime = {
12990
+ shapeValue: shape_pool.clone(this.pv),
12991
+ lastIndex: 0,
12992
+ lastTime: initialDefaultFrame
12993
+ };
12994
+ }
12995
+
12996
+ frameNum *= this.elem.globalData.frameRate;
12997
+ frameNum -= this.offsetTime;
12998
+ if (frameNum !== this._cachingAtTime.lastTime) {
12999
+ this._cachingAtTime.lastIndex = this._cachingAtTime.lastTime < frameNum ? this._caching.lastIndex : 0;
13000
+ this._cachingAtTime.lastTime = frameNum;
13001
+ this.interpolateShape(frameNum, this._cachingAtTime.shapeValue, this._cachingAtTime);
13002
+ }
13003
+ return this._cachingAtTime.shapeValue;
13004
+ }
13005
+
13006
+ var ShapePropertyConstructorFunction = ShapePropertyFactory.getConstructorFunction();
13007
+ var KeyframedShapePropertyConstructorFunction = ShapePropertyFactory.getKeyframedConstructorFunction();
13008
+
13009
+ function ShapeExpressions() { }
13010
+ ShapeExpressions.prototype = {
13011
+ vertices: function (prop, time) {
13012
+ if (this.k) {
13013
+ this.getValue();
13014
+ }
13015
+ var shapePath = this.v;
13016
+ if (time !== undefined) {
13017
+ shapePath = this.getValueAtTime(time, 0);
13018
+ }
13019
+ var i, len = shapePath._length;
13020
+ var vertices = shapePath[prop];
13021
+ var points = shapePath.v;
13022
+ var arr = createSizedArray(len);
13023
+ for (i = 0; i < len; i += 1) {
13024
+ if (prop === 'i' || prop === 'o') {
13025
+ arr[i] = [vertices[i][0] - points[i][0], vertices[i][1] - points[i][1]];
13026
+ } else {
13027
+ arr[i] = [vertices[i][0], vertices[i][1]];
13028
+ }
13029
+
13030
+ }
13031
+ return arr;
13032
+ },
13033
+ points: function (time) {
13034
+ return this.vertices('v', time);
13035
+ },
13036
+ inTangents: function (time) {
13037
+ return this.vertices('i', time);
13038
+ },
13039
+ outTangents: function (time) {
13040
+ return this.vertices('o', time);
13041
+ },
13042
+ isClosed: function () {
13043
+ return this.v.c;
13044
+ },
13045
+ pointOnPath: function (perc, time) {
13046
+ var shapePath = this.v;
13047
+ if (time !== undefined) {
13048
+ shapePath = this.getValueAtTime(time, 0);
13049
+ }
13050
+ if (!this._segmentsLength) {
13051
+ this._segmentsLength = bez.getSegmentsLength(shapePath);
13052
+ }
13053
+
13054
+ var segmentsLength = this._segmentsLength;
13055
+ var lengths = segmentsLength.lengths;
13056
+ var lengthPos = segmentsLength.totalLength * perc;
13057
+ var i = 0, len = lengths.length;
13058
+ var j = 0, jLen;
13059
+ var accumulatedLength = 0, pt;
13060
+ while (i < len) {
13061
+ if (accumulatedLength + lengths[i].addedLength > lengthPos) {
13062
+ var initIndex = i;
13063
+ var endIndex = (shapePath.c && i === len - 1) ? 0 : i + 1;
13064
+ var segmentPerc = (lengthPos - accumulatedLength) / lengths[i].addedLength;
13065
+ pt = bez.getPointInSegment(shapePath.v[initIndex], shapePath.v[endIndex], shapePath.o[initIndex], shapePath.i[endIndex], segmentPerc, lengths[i]);
13066
+ break;
13067
+ } else {
13068
+ accumulatedLength += lengths[i].addedLength;
13069
+ }
13070
+ i += 1;
13071
+ }
13072
+ if (!pt) {
13073
+ pt = shapePath.c ? [shapePath.v[0][0], shapePath.v[0][1]] : [shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1]];
13074
+ }
13075
+ return pt;
13076
+ },
13077
+ vectorOnPath: function (perc, time, vectorType) {
13078
+ //perc doesn't use triple equality because it can be a Number object as well as a primitive.
13079
+ perc = perc == 1 ? this.v.c ? 0 : 0.999 : perc;
13080
+ var pt1 = this.pointOnPath(perc, time);
13081
+ var pt2 = this.pointOnPath(perc + 0.001, time);
13082
+ var xLength = pt2[0] - pt1[0];
13083
+ var yLength = pt2[1] - pt1[1];
13084
+ var magnitude = Math.sqrt(Math.pow(xLength, 2) + Math.pow(yLength, 2));
13085
+ if (magnitude === 0) {
13086
+ return [0, 0];
13087
+ }
13088
+ var unitVector = vectorType === 'tangent' ? [xLength / magnitude, yLength / magnitude] : [-yLength / magnitude, xLength / magnitude];
13089
+ return unitVector;
13090
+ },
13091
+ tangentOnPath: function (perc, time) {
13092
+ return this.vectorOnPath(perc, time, 'tangent');
13093
+ },
13094
+ normalOnPath: function (perc, time) {
13095
+ return this.vectorOnPath(perc, time, 'normal');
13096
+ },
13097
+ setGroupProperty: expressionHelpers.setGroupProperty,
13098
+ getValueAtTime: expressionHelpers.getStaticValueAtTime
13099
+ };
13100
+ extendPrototype([ShapeExpressions], ShapePropertyConstructorFunction);
13101
+ extendPrototype([ShapeExpressions], KeyframedShapePropertyConstructorFunction);
13102
+ KeyframedShapePropertyConstructorFunction.prototype.getValueAtTime = getShapeValueAtTime;
13103
+ KeyframedShapePropertyConstructorFunction.prototype.initiateExpression = ExpressionManager.initiateExpression;
13104
+
13105
+ var propertyGetShapeProp = ShapePropertyFactory.getShapeProp;
13106
+ ShapePropertyFactory.getShapeProp = function (elem, data, type, arr, trims) {
13107
+ var prop = propertyGetShapeProp(elem, data, type, arr, trims);
13108
+ prop.propertyIndex = data.ix;
13109
+ prop.lock = false;
13110
+ if (type === 3) {
13111
+ expressionHelpers.searchExpressions(elem, data.pt, prop);
13112
+ } else if (type === 4) {
13113
+ expressionHelpers.searchExpressions(elem, data.ks, prop);
13114
+ }
13115
+ if (prop.k) {
13116
+ elem.addDynamicProperty(prop);
13117
+ }
13118
+ return prop;
13119
+ };
13120
+ }());
13121
+ (function addDecorator() {
13122
+
13123
+ function searchExpressions() {
13124
+ if (this.data.d.x) {
13125
+ this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem, this.data.d, this);
13126
+ this.addEffect(this.getExpressionValue.bind(this));
13127
+ return true;
13128
+ }
13129
+ }
13130
+
13131
+ TextProperty.prototype.getExpressionValue = function (currentValue, text) {
13132
+ var newValue = this.calculateExpression(text);
13133
+ if (currentValue.t !== newValue) {
13134
+ var newData = {};
13135
+ this.copyData(newData, currentValue);
13136
+ newData.t = newValue.toString();
13137
+ newData.__complete = false;
13138
+ return newData;
13139
+ }
13140
+ return currentValue;
13141
+ }
13142
+
13143
+ TextProperty.prototype.searchProperty = function () {
13144
+
13145
+ var isKeyframed = this.searchKeyframes();
13146
+ var hasExpressions = this.searchExpressions();
13147
+ this.kf = isKeyframed || hasExpressions;
13148
+ return this.kf;
13149
+ };
13150
+
13151
+ TextProperty.prototype.searchExpressions = searchExpressions;
13152
+
13153
+ }());
13154
+ var ShapeExpressionInterface = (function () {
13155
+
13156
+ function iterateElements(shapes, view, propertyGroup) {
13157
+ var arr = [];
13158
+ var i, len = shapes ? shapes.length : 0;
13159
+ for (i = 0; i < len; i += 1) {
13160
+ if (shapes[i].ty == 'gr') {
13161
+ arr.push(groupInterfaceFactory(shapes[i], view[i], propertyGroup));
13162
+ } else if (shapes[i].ty == 'fl') {
13163
+ arr.push(fillInterfaceFactory(shapes[i], view[i], propertyGroup));
13164
+ } else if (shapes[i].ty == 'st') {
13165
+ arr.push(strokeInterfaceFactory(shapes[i], view[i], propertyGroup));
13166
+ } else if (shapes[i].ty == 'tm') {
13167
+ arr.push(trimInterfaceFactory(shapes[i], view[i], propertyGroup));
13168
+ } else if (shapes[i].ty == 'tr') {
13169
+ //arr.push(transformInterfaceFactory(shapes[i],view[i],propertyGroup));
13170
+ } else if (shapes[i].ty == 'el') {
13171
+ arr.push(ellipseInterfaceFactory(shapes[i], view[i], propertyGroup));
13172
+ } else if (shapes[i].ty == 'sr') {
13173
+ arr.push(starInterfaceFactory(shapes[i], view[i], propertyGroup));
13174
+ } else if (shapes[i].ty == 'sh') {
13175
+ arr.push(pathInterfaceFactory(shapes[i], view[i], propertyGroup));
13176
+ } else if (shapes[i].ty == 'rc') {
13177
+ arr.push(rectInterfaceFactory(shapes[i], view[i], propertyGroup));
13178
+ } else if (shapes[i].ty == 'rd') {
13179
+ arr.push(roundedInterfaceFactory(shapes[i], view[i], propertyGroup));
13180
+ } else if (shapes[i].ty == 'rp') {
13181
+ arr.push(repeaterInterfaceFactory(shapes[i], view[i], propertyGroup));
13182
+ }
13183
+ }
13184
+ return arr;
13185
+ }
13186
+
13187
+ function contentsInterfaceFactory(shape, view, propertyGroup) {
13188
+ var interfaces;
13189
+ var interfaceFunction = function _interfaceFunction(value) {
13190
+ var i = 0, len = interfaces.length;
13191
+ while (i < len) {
13192
+ if (interfaces[i]._name === value || interfaces[i].mn === value || interfaces[i].propertyIndex === value || interfaces[i].ix === value || interfaces[i].ind === value) {
13193
+ return interfaces[i];
13194
+ }
13195
+ i += 1;
13196
+ }
13197
+ if (typeof value === 'number') {
13198
+ return interfaces[value - 1];
13199
+ }
13200
+ };
13201
+ interfaceFunction.propertyGroup = function (val) {
13202
+ if (val === 1) {
13203
+ return interfaceFunction;
13204
+ } else {
13205
+ return propertyGroup(val - 1);
13206
+ }
13207
+ };
13208
+ interfaces = iterateElements(shape.it, view.it, interfaceFunction.propertyGroup);
13209
+ interfaceFunction.numProperties = interfaces.length;
13210
+ interfaceFunction.propertyIndex = shape.cix;
13211
+ interfaceFunction._name = shape.nm;
13212
+
13213
+ return interfaceFunction;
13214
+ }
13215
+
13216
+ function groupInterfaceFactory(shape, view, propertyGroup) {
13217
+ var interfaceFunction = function _interfaceFunction(value) {
13218
+ switch (value) {
13219
+ case 'ADBE Vectors Group':
13220
+ case 'Contents':
13221
+ case 2:
13222
+ return interfaceFunction.content;
13223
+ //Not necessary for now. Keeping them here in case a new case appears
13224
+ //case 'ADBE Vector Transform Group':
13225
+ //case 3:
13226
+ default:
13227
+ return interfaceFunction.transform;
13228
+ }
13229
+ };
13230
+ interfaceFunction.propertyGroup = function (val) {
13231
+ if (val === 1) {
13232
+ return interfaceFunction;
13233
+ } else {
13234
+ return propertyGroup(val - 1);
13235
+ }
13236
+ };
13237
+ var content = contentsInterfaceFactory(shape, view, interfaceFunction.propertyGroup);
13238
+ var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup);
13239
+ interfaceFunction.content = content;
13240
+ interfaceFunction.transform = transformInterface;
13241
+ Object.defineProperty(interfaceFunction, '_name', {
13242
+ get: function () {
13243
+ return shape.nm;
13244
+ }
13245
+ });
13246
+ //interfaceFunction.content = interfaceFunction;
13247
+ interfaceFunction.numProperties = shape.np;
13248
+ interfaceFunction.propertyIndex = shape.ix;
13249
+ interfaceFunction.nm = shape.nm;
13250
+ interfaceFunction.mn = shape.mn;
13251
+ return interfaceFunction;
13252
+ }
13253
+
13254
+ function fillInterfaceFactory(shape, view, propertyGroup) {
13255
+ function interfaceFunction(val) {
13256
+ if (val === 'Color' || val === 'color') {
13257
+ return interfaceFunction.color;
13258
+ } else if (val === 'Opacity' || val === 'opacity') {
13259
+ return interfaceFunction.opacity;
13260
+ }
13261
+ }
13262
+ Object.defineProperties(interfaceFunction, {
13263
+ 'color': {
13264
+ get: ExpressionPropertyInterface(view.c)
13265
+ },
13266
+ 'opacity': {
13267
+ get: ExpressionPropertyInterface(view.o)
13268
+ },
13269
+ '_name': { value: shape.nm },
13270
+ 'mn': { value: shape.mn }
13271
+ });
13272
+
13273
+ view.c.setGroupProperty(propertyGroup);
13274
+ view.o.setGroupProperty(propertyGroup);
13275
+ return interfaceFunction;
13276
+ }
13277
+
13278
+ function strokeInterfaceFactory(shape, view, propertyGroup) {
13279
+ function _propertyGroup(val) {
13280
+ if (val === 1) {
13281
+ return ob;
13282
+ } else {
13283
+ return propertyGroup(val - 1);
13284
+ }
13285
+ }
13286
+ function _dashPropertyGroup(val) {
13287
+ if (val === 1) {
13288
+ return dashOb;
13289
+ } else {
13290
+ return _propertyGroup(val - 1);
13291
+ }
13292
+ }
13293
+ function addPropertyToDashOb(i) {
13294
+ Object.defineProperty(dashOb, shape.d[i].nm, {
13295
+ get: ExpressionPropertyInterface(view.d.dataProps[i].p)
13296
+ });
13297
+ }
13298
+ var i, len = shape.d ? shape.d.length : 0;
13299
+ var dashOb = {};
13300
+ for (i = 0; i < len; i += 1) {
13301
+ addPropertyToDashOb(i);
13302
+ view.d.dataProps[i].p.setGroupProperty(_dashPropertyGroup);
13303
+ }
13304
+
13305
+ function interfaceFunction(val) {
13306
+ if (val === 'Color' || val === 'color') {
13307
+ return interfaceFunction.color;
13308
+ } else if (val === 'Opacity' || val === 'opacity') {
13309
+ return interfaceFunction.opacity;
13310
+ } else if (val === 'Stroke Width' || val === 'stroke width') {
13311
+ return interfaceFunction.strokeWidth;
13312
+ }
13313
+ }
13314
+ Object.defineProperties(interfaceFunction, {
13315
+ 'color': {
13316
+ get: ExpressionPropertyInterface(view.c)
13317
+ },
13318
+ 'opacity': {
13319
+ get: ExpressionPropertyInterface(view.o)
13320
+ },
13321
+ 'strokeWidth': {
13322
+ get: ExpressionPropertyInterface(view.w)
13323
+ },
13324
+ 'dash': {
13325
+ get: function () {
13326
+ return dashOb;
13327
+ }
13328
+ },
13329
+ '_name': { value: shape.nm },
13330
+ 'mn': { value: shape.mn }
13331
+ });
13332
+
13333
+ view.c.setGroupProperty(_propertyGroup);
13334
+ view.o.setGroupProperty(_propertyGroup);
13335
+ view.w.setGroupProperty(_propertyGroup);
13336
+ return interfaceFunction;
13337
+ }
13338
+
13339
+ function trimInterfaceFactory(shape, view, propertyGroup) {
13340
+ function _propertyGroup(val) {
13341
+ if (val == 1) {
13342
+ return interfaceFunction;
13343
+ } else {
13344
+ return propertyGroup(--val);
13345
+ }
13346
+ }
13347
+ interfaceFunction.propertyIndex = shape.ix;
13348
+
13349
+ view.s.setGroupProperty(_propertyGroup);
13350
+ view.e.setGroupProperty(_propertyGroup);
13351
+ view.o.setGroupProperty(_propertyGroup);
13352
+
13353
+ function interfaceFunction(val) {
13354
+ if (val === shape.e.ix || val === 'End' || val === 'end') {
13355
+ return interfaceFunction.end;
13356
+ }
13357
+ if (val === shape.s.ix) {
13358
+ return interfaceFunction.start;
13359
+ }
13360
+ if (val === shape.o.ix) {
13361
+ return interfaceFunction.offset;
13362
+ }
13363
+ }
13364
+ interfaceFunction.propertyIndex = shape.ix;
13365
+ interfaceFunction.propertyGroup = propertyGroup;
13366
+
13367
+ Object.defineProperties(interfaceFunction, {
13368
+ 'start': {
13369
+ get: ExpressionPropertyInterface(view.s)
13370
+ },
13371
+ 'end': {
13372
+ get: ExpressionPropertyInterface(view.e)
13373
+ },
13374
+ 'offset': {
13375
+ get: ExpressionPropertyInterface(view.o)
13376
+ },
13377
+ '_name': { value: shape.nm }
13378
+ });
13379
+ interfaceFunction.mn = shape.mn;
13380
+ return interfaceFunction;
13381
+ }
13382
+
13383
+ function transformInterfaceFactory(shape, view, propertyGroup) {
13384
+ function _propertyGroup(val) {
13385
+ if (val == 1) {
13386
+ return interfaceFunction;
13387
+ } else {
13388
+ return propertyGroup(--val);
13389
+ }
13390
+ }
13391
+ view.transform.mProps.o.setGroupProperty(_propertyGroup);
13392
+ view.transform.mProps.p.setGroupProperty(_propertyGroup);
13393
+ view.transform.mProps.a.setGroupProperty(_propertyGroup);
13394
+ view.transform.mProps.s.setGroupProperty(_propertyGroup);
13395
+ view.transform.mProps.r.setGroupProperty(_propertyGroup);
13396
+ if (view.transform.mProps.sk) {
13397
+ view.transform.mProps.sk.setGroupProperty(_propertyGroup);
13398
+ view.transform.mProps.sa.setGroupProperty(_propertyGroup);
13399
+ }
13400
+ view.transform.op.setGroupProperty(_propertyGroup);
13401
+
13402
+ function interfaceFunction(value) {
13403
+ if (shape.a.ix === value || value === 'Anchor Point') {
13404
+ return interfaceFunction.anchorPoint;
13405
+ }
13406
+ if (shape.o.ix === value || value === 'Opacity') {
13407
+ return interfaceFunction.opacity;
13408
+ }
13409
+ if (shape.p.ix === value || value === 'Position') {
13410
+ return interfaceFunction.position;
13411
+ }
13412
+ if (shape.r.ix === value || value === 'Rotation' || value === 'ADBE Vector Rotation') {
13413
+ return interfaceFunction.rotation;
13414
+ }
13415
+ if (shape.s.ix === value || value === 'Scale') {
13416
+ return interfaceFunction.scale;
13417
+ }
13418
+ if (shape.sk && shape.sk.ix === value || value === 'Skew') {
13419
+ return interfaceFunction.skew;
13420
+ }
13421
+ if (shape.sa && shape.sa.ix === value || value === 'Skew Axis') {
13422
+ return interfaceFunction.skewAxis;
13423
+ }
13424
+
13425
+ }
13426
+ Object.defineProperties(interfaceFunction, {
13427
+ 'opacity': {
13428
+ get: ExpressionPropertyInterface(view.transform.mProps.o)
13429
+ },
13430
+ 'position': {
13431
+ get: ExpressionPropertyInterface(view.transform.mProps.p)
13432
+ },
13433
+ 'anchorPoint': {
13434
+ get: ExpressionPropertyInterface(view.transform.mProps.a)
13435
+ },
13436
+ 'scale': {
13437
+ get: ExpressionPropertyInterface(view.transform.mProps.s)
13438
+ },
13439
+ 'rotation': {
13440
+ get: ExpressionPropertyInterface(view.transform.mProps.r)
13441
+ },
13442
+ 'skew': {
13443
+ get: ExpressionPropertyInterface(view.transform.mProps.sk)
13444
+ },
13445
+ 'skewAxis': {
13446
+ get: ExpressionPropertyInterface(view.transform.mProps.sa)
13447
+ },
13448
+ '_name': { value: shape.nm }
13449
+ });
13450
+ interfaceFunction.ty = 'tr';
13451
+ interfaceFunction.mn = shape.mn;
13452
+ interfaceFunction.propertyGroup = propertyGroup;
13453
+ return interfaceFunction;
13454
+ }
13455
+
13456
+ function ellipseInterfaceFactory(shape, view, propertyGroup) {
13457
+ function _propertyGroup(val) {
13458
+ if (val == 1) {
13459
+ return interfaceFunction;
13460
+ } else {
13461
+ return propertyGroup(--val);
13462
+ }
13463
+ }
13464
+ interfaceFunction.propertyIndex = shape.ix;
13465
+ var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
13466
+ prop.s.setGroupProperty(_propertyGroup);
13467
+ prop.p.setGroupProperty(_propertyGroup);
13468
+ function interfaceFunction(value) {
13469
+ if (shape.p.ix === value) {
13470
+ return interfaceFunction.position;
13471
+ }
13472
+ if (shape.s.ix === value) {
13473
+ return interfaceFunction.size;
13474
+ }
13475
+ }
13476
+
13477
+ Object.defineProperties(interfaceFunction, {
13478
+ 'size': {
13479
+ get: ExpressionPropertyInterface(prop.s)
13480
+ },
13481
+ 'position': {
13482
+ get: ExpressionPropertyInterface(prop.p)
13483
+ },
13484
+ '_name': { value: shape.nm }
13485
+ });
13486
+ interfaceFunction.mn = shape.mn;
13487
+ return interfaceFunction;
13488
+ }
13489
+
13490
+ function starInterfaceFactory(shape, view, propertyGroup) {
13491
+ function _propertyGroup(val) {
13492
+ if (val == 1) {
13493
+ return interfaceFunction;
13494
+ } else {
13495
+ return propertyGroup(--val);
13496
+ }
13497
+ }
13498
+ var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
13499
+ interfaceFunction.propertyIndex = shape.ix;
13500
+ prop.or.setGroupProperty(_propertyGroup);
13501
+ prop.os.setGroupProperty(_propertyGroup);
13502
+ prop.pt.setGroupProperty(_propertyGroup);
13503
+ prop.p.setGroupProperty(_propertyGroup);
13504
+ prop.r.setGroupProperty(_propertyGroup);
13505
+ if (shape.ir) {
13506
+ prop.ir.setGroupProperty(_propertyGroup);
13507
+ prop.is.setGroupProperty(_propertyGroup);
13508
+ }
13509
+
13510
+ function interfaceFunction(value) {
13511
+ if (shape.p.ix === value) {
13512
+ return interfaceFunction.position;
13513
+ }
13514
+ if (shape.r.ix === value) {
13515
+ return interfaceFunction.rotation;
13516
+ }
13517
+ if (shape.pt.ix === value) {
13518
+ return interfaceFunction.points;
13519
+ }
13520
+ if (shape.or.ix === value || 'ADBE Vector Star Outer Radius' === value) {
13521
+ return interfaceFunction.outerRadius;
13522
+ }
13523
+ if (shape.os.ix === value) {
13524
+ return interfaceFunction.outerRoundness;
13525
+ }
13526
+ if (shape.ir && (shape.ir.ix === value || 'ADBE Vector Star Inner Radius' === value)) {
13527
+ return interfaceFunction.innerRadius;
13528
+ }
13529
+ if (shape.is && shape.is.ix === value) {
13530
+ return interfaceFunction.innerRoundness;
13531
+ }
13532
+
13533
+ }
13534
+
13535
+ Object.defineProperties(interfaceFunction, {
13536
+ 'position': {
13537
+ get: ExpressionPropertyInterface(prop.p)
13538
+ },
13539
+ 'rotation': {
13540
+ get: ExpressionPropertyInterface(prop.r)
13541
+ },
13542
+ 'points': {
13543
+ get: ExpressionPropertyInterface(prop.pt)
13544
+ },
13545
+ 'outerRadius': {
13546
+ get: ExpressionPropertyInterface(prop.or)
13547
+ },
13548
+ 'outerRoundness': {
13549
+ get: ExpressionPropertyInterface(prop.os)
13550
+ },
13551
+ 'innerRadius': {
13552
+ get: ExpressionPropertyInterface(prop.ir)
13553
+ },
13554
+ 'innerRoundness': {
13555
+ get: ExpressionPropertyInterface(prop.is)
13556
+ },
13557
+ '_name': { value: shape.nm }
13558
+ });
13559
+ interfaceFunction.mn = shape.mn;
13560
+ return interfaceFunction;
13561
+ }
13562
+
13563
+ function rectInterfaceFactory(shape, view, propertyGroup) {
13564
+ function _propertyGroup(val) {
13565
+ if (val == 1) {
13566
+ return interfaceFunction;
13567
+ } else {
13568
+ return propertyGroup(--val);
13569
+ }
13570
+ }
13571
+ var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
13572
+ interfaceFunction.propertyIndex = shape.ix;
13573
+ prop.p.setGroupProperty(_propertyGroup);
13574
+ prop.s.setGroupProperty(_propertyGroup);
13575
+ prop.r.setGroupProperty(_propertyGroup);
13576
+
13577
+ function interfaceFunction(value) {
13578
+ if (shape.p.ix === value) {
13579
+ return interfaceFunction.position;
13580
+ }
13581
+ if (shape.r.ix === value) {
13582
+ return interfaceFunction.roundness;
13583
+ }
13584
+ if (shape.s.ix === value || value === 'Size' || value === 'ADBE Vector Rect Size') {
13585
+ return interfaceFunction.size;
13586
+ }
13587
+
13588
+ }
13589
+ Object.defineProperties(interfaceFunction, {
13590
+ 'position': {
13591
+ get: ExpressionPropertyInterface(prop.p)
13592
+ },
13593
+ 'roundness': {
13594
+ get: ExpressionPropertyInterface(prop.r)
13595
+ },
13596
+ 'size': {
13597
+ get: ExpressionPropertyInterface(prop.s)
13598
+ },
13599
+ '_name': { value: shape.nm }
13600
+ });
13601
+ interfaceFunction.mn = shape.mn;
13602
+ return interfaceFunction;
13603
+ }
13604
+
13605
+ function roundedInterfaceFactory(shape, view, propertyGroup) {
13606
+ function _propertyGroup(val) {
13607
+ if (val == 1) {
13608
+ return interfaceFunction;
13609
+ } else {
13610
+ return propertyGroup(--val);
13611
+ }
13612
+ }
13613
+ var prop = view;
13614
+ interfaceFunction.propertyIndex = shape.ix;
13615
+ prop.rd.setGroupProperty(_propertyGroup);
13616
+
13617
+ function interfaceFunction(value) {
13618
+ if (shape.r.ix === value || 'Round Corners 1' === value) {
13619
+ return interfaceFunction.radius;
13620
+ }
13621
+
13622
+ }
13623
+ Object.defineProperties(interfaceFunction, {
13624
+ 'radius': {
13625
+ get: ExpressionPropertyInterface(prop.rd)
13626
+ },
13627
+ '_name': { value: shape.nm }
13628
+ });
13629
+ interfaceFunction.mn = shape.mn;
13630
+ return interfaceFunction;
13631
+ }
13632
+
13633
+ function repeaterInterfaceFactory(shape, view, propertyGroup) {
13634
+ function _propertyGroup(val) {
13635
+ if (val == 1) {
13636
+ return interfaceFunction;
13637
+ } else {
13638
+ return propertyGroup(--val);
13639
+ }
13640
+ }
13641
+ var prop = view;
13642
+ interfaceFunction.propertyIndex = shape.ix;
13643
+ prop.c.setGroupProperty(_propertyGroup);
13644
+ prop.o.setGroupProperty(_propertyGroup);
13645
+
13646
+ function interfaceFunction(value) {
13647
+ if (shape.c.ix === value || 'Copies' === value) {
13648
+ return interfaceFunction.copies;
13649
+ } else if (shape.o.ix === value || 'Offset' === value) {
13650
+ return interfaceFunction.offset;
13651
+ }
13652
+
13653
+ }
13654
+ Object.defineProperties(interfaceFunction, {
13655
+ 'copies': {
13656
+ get: ExpressionPropertyInterface(prop.c)
13657
+ },
13658
+ 'offset': {
13659
+ get: ExpressionPropertyInterface(prop.o)
13660
+ },
13661
+ '_name': { value: shape.nm }
13662
+ });
13663
+ interfaceFunction.mn = shape.mn;
13664
+ return interfaceFunction;
13665
+ }
13666
+
13667
+ function pathInterfaceFactory(shape, view, propertyGroup) {
13668
+ var prop = view.sh;
13669
+ function _propertyGroup(val) {
13670
+ if (val == 1) {
13671
+ return interfaceFunction;
13672
+ } else {
13673
+ return propertyGroup(--val);
13674
+ }
13675
+ }
13676
+ prop.setGroupProperty(_propertyGroup);
13677
+
13678
+ function interfaceFunction(val) {
13679
+ if (val === 'Shape' || val === 'shape' || val === 'Path' || val === 'path' || val === 'ADBE Vector Shape' || val === 2) {
13680
+ return interfaceFunction.path;
13681
+ }
13682
+ }
13683
+ Object.defineProperties(interfaceFunction, {
13684
+ 'path': {
13685
+ get: function () {
13686
+ if (prop.k) {
13687
+ prop.getValue();
13688
+ }
13689
+ return prop;
13690
+ }
13691
+ },
13692
+ 'shape': {
13693
+ get: function () {
13694
+ if (prop.k) {
13695
+ prop.getValue();
13696
+ }
13697
+ return prop;
13698
+ }
13699
+ },
13700
+ '_name': { value: shape.nm },
13701
+ 'ix': { value: shape.ix },
13702
+ 'propertyIndex': { value: shape.ix },
13703
+ 'mn': { value: shape.mn }
13704
+ });
13705
+ return interfaceFunction;
13706
+ }
13707
+
13708
+ return function (shapes, view, propertyGroup) {
13709
+ var interfaces;
13710
+ function _interfaceFunction(value) {
13711
+ if (typeof value === 'number') {
13712
+ return interfaces[value - 1];
13713
+ } else {
13714
+ var i = 0, len = interfaces.length;
13715
+ while (i < len) {
13716
+ if (interfaces[i]._name === value) {
13717
+ return interfaces[i];
13718
+ }
13719
+ i += 1;
13720
+ }
13721
+ }
13722
+ }
13723
+ _interfaceFunction.propertyGroup = propertyGroup;
13724
+ interfaces = iterateElements(shapes, view, _interfaceFunction);
13725
+ _interfaceFunction.numProperties = interfaces.length;
13726
+ return _interfaceFunction;
13727
+ };
13728
+ }());
13729
+
13730
+ var TextExpressionInterface = (function () {
13731
+ return function (elem) {
13732
+ var _prevValue, _sourceText;
13733
+ function _thisLayerFunction() {
13734
+ }
13735
+ Object.defineProperty(_thisLayerFunction, "sourceText", {
13736
+ get: function () {
13737
+ elem.textProperty.getValue()
13738
+ var stringValue = elem.textProperty.currentData.t;
13739
+ if (stringValue !== _prevValue) {
13740
+ elem.textProperty.currentData.t = _prevValue;
13741
+ _sourceText = new String(stringValue);
13742
+ //If stringValue is an empty string, eval returns undefined, so it has to be returned as a String primitive
13743
+ _sourceText.value = stringValue ? stringValue : new String(stringValue);
13744
+ }
13745
+ return _sourceText;
13746
+ }
13747
+ });
13748
+ return _thisLayerFunction;
13749
+ };
13750
+ }());
13751
+ var LayerExpressionInterface = (function () {
13752
+ function toWorld(arr, time) {
13753
+ var toWorldMat = new Matrix();
13754
+ toWorldMat.reset();
13755
+ var transformMat;
13756
+ if (time) {
13757
+ //Todo implement value at time on transform properties
13758
+ //transformMat = this._elem.finalTransform.mProp.getValueAtTime(time);
13759
+ transformMat = this._elem.finalTransform.mProp;
13760
+ } else {
13761
+ transformMat = this._elem.finalTransform.mProp;
13762
+ }
13763
+ transformMat.applyToMatrix(toWorldMat);
13764
+ if (this._elem.hierarchy && this._elem.hierarchy.length) {
13765
+ var i, len = this._elem.hierarchy.length;
13766
+ for (i = 0; i < len; i += 1) {
13767
+ this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);
13768
+ }
13769
+ return toWorldMat.applyToPointArray(arr[0], arr[1], arr[2] || 0);
13770
+ }
13771
+ return toWorldMat.applyToPointArray(arr[0], arr[1], arr[2] || 0);
13772
+ }
13773
+ function fromWorld(arr, time) {
13774
+ var toWorldMat = new Matrix();
13775
+ toWorldMat.reset();
13776
+ var transformMat;
13777
+ if (time) {
13778
+ //Todo implement value at time on transform properties
13779
+ //transformMat = this._elem.finalTransform.mProp.getValueAtTime(time);
13780
+ transformMat = this._elem.finalTransform.mProp;
13781
+ } else {
13782
+ transformMat = this._elem.finalTransform.mProp;
13783
+ }
13784
+ transformMat.applyToMatrix(toWorldMat);
13785
+ if (this._elem.hierarchy && this._elem.hierarchy.length) {
13786
+ var i, len = this._elem.hierarchy.length;
13787
+ for (i = 0; i < len; i += 1) {
13788
+ this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);
13789
+ }
13790
+ return toWorldMat.inversePoint(arr);
13791
+ }
13792
+ return toWorldMat.inversePoint(arr);
13793
+ }
13794
+ function fromComp(arr) {
13795
+ var toWorldMat = new Matrix();
13796
+ toWorldMat.reset();
13797
+ this._elem.finalTransform.mProp.applyToMatrix(toWorldMat);
13798
+ if (this._elem.hierarchy && this._elem.hierarchy.length) {
13799
+ var i, len = this._elem.hierarchy.length;
13800
+ for (i = 0; i < len; i += 1) {
13801
+ this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);
13802
+ }
13803
+ return toWorldMat.inversePoint(arr);
13804
+ }
13805
+ return toWorldMat.inversePoint(arr);
13806
+ }
13807
+
13808
+ function sampleImage() {
13809
+ return [1, 1, 1, 1];
13810
+ }
13811
+
13812
+
13813
+ return function (elem) {
13814
+
13815
+ var transformInterface;
13816
+
13817
+ function _registerMaskInterface(maskManager) {
13818
+ _thisLayerFunction.mask = new MaskManagerInterface(maskManager, elem);
13819
+ }
13820
+ function _registerEffectsInterface(effects) {
13821
+ _thisLayerFunction.effect = effects;
13822
+ }
13823
+
13824
+ function _thisLayerFunction(name) {
13825
+ switch (name) {
13826
+ case "ADBE Root Vectors Group":
13827
+ case "Contents":
13828
+ case 2:
13829
+ return _thisLayerFunction.shapeInterface;
13830
+ case 1:
13831
+ case 6:
13832
+ case "Transform":
13833
+ case "transform":
13834
+ case "ADBE Transform Group":
13835
+ return transformInterface;
13836
+ case 4:
13837
+ case "ADBE Effect Parade":
13838
+ case "effects":
13839
+ case "Effects":
13840
+ return _thisLayerFunction.effect;
13841
+ }
13842
+ }
13843
+ _thisLayerFunction.toWorld = toWorld;
13844
+ _thisLayerFunction.fromWorld = fromWorld;
13845
+ _thisLayerFunction.toComp = toWorld;
13846
+ _thisLayerFunction.fromComp = fromComp;
13847
+ _thisLayerFunction.sampleImage = sampleImage;
13848
+ _thisLayerFunction.sourceRectAtTime = elem.sourceRectAtTime.bind(elem);
13849
+ _thisLayerFunction._elem = elem;
13850
+ transformInterface = TransformExpressionInterface(elem.finalTransform.mProp);
13851
+ var anchorPointDescriptor = getDescriptor(transformInterface, 'anchorPoint');
13852
+ Object.defineProperties(_thisLayerFunction, {
13853
+ hasParent: {
13854
+ get: function () {
13855
+ return elem.hierarchy.length;
13856
+ }
13857
+ },
13858
+ parent: {
13859
+ get: function () {
13860
+ return elem.hierarchy[0].layerInterface;
13861
+ }
13862
+ },
13863
+ rotation: getDescriptor(transformInterface, 'rotation'),
13864
+ scale: getDescriptor(transformInterface, 'scale'),
13865
+ position: getDescriptor(transformInterface, 'position'),
13866
+ opacity: getDescriptor(transformInterface, 'opacity'),
13867
+ anchorPoint: anchorPointDescriptor,
13868
+ anchor_point: anchorPointDescriptor,
13869
+ transform: {
13870
+ get: function () {
13871
+ return transformInterface;
13872
+ }
13873
+ },
13874
+ active: {
13875
+ get: function () {
13876
+ return elem.isInRange;
13877
+ }
13878
+ }
13879
+ });
13880
+
13881
+ _thisLayerFunction.startTime = elem.data.st;
13882
+ _thisLayerFunction.index = elem.data.ind;
13883
+ _thisLayerFunction.source = elem.data.refId;
13884
+ _thisLayerFunction.height = elem.data.ty === 0 ? elem.data.h : 100;
13885
+ _thisLayerFunction.width = elem.data.ty === 0 ? elem.data.w : 100;
13886
+ _thisLayerFunction.inPoint = elem.data.ip / elem.comp.globalData.frameRate;
13887
+ _thisLayerFunction.outPoint = elem.data.op / elem.comp.globalData.frameRate;
13888
+ _thisLayerFunction._name = elem.data.nm;
13889
+
13890
+ _thisLayerFunction.registerMaskInterface = _registerMaskInterface;
13891
+ _thisLayerFunction.registerEffectsInterface = _registerEffectsInterface;
13892
+ return _thisLayerFunction;
13893
+ };
13894
+ }());
13895
+
13896
+ var CompExpressionInterface = (function () {
13897
+ return function (comp) {
13898
+ function _thisLayerFunction(name) {
13899
+ var i = 0, len = comp.layers.length;
13900
+ while (i < len) {
13901
+ if (comp.layers[i].nm === name || comp.layers[i].ind === name) {
13902
+ return comp.elements[i].layerInterface;
13903
+ }
13904
+ i += 1;
13905
+ }
13906
+ return null;
13907
+ //return {active:false};
13908
+ }
13909
+ Object.defineProperty(_thisLayerFunction, "_name", { value: comp.data.nm });
13910
+ _thisLayerFunction.layer = _thisLayerFunction;
13911
+ _thisLayerFunction.pixelAspect = 1;
13912
+ _thisLayerFunction.height = comp.data.h || comp.globalData.compSize.h;
13913
+ _thisLayerFunction.width = comp.data.w || comp.globalData.compSize.w;
13914
+ _thisLayerFunction.pixelAspect = 1;
13915
+ _thisLayerFunction.frameDuration = 1 / comp.globalData.frameRate;
13916
+ _thisLayerFunction.displayStartTime = 0;
13917
+ _thisLayerFunction.numLayers = comp.layers.length;
13918
+ return _thisLayerFunction;
13919
+ };
13920
+ }());
13921
+ var TransformExpressionInterface = (function () {
13922
+ return function (transform) {
13923
+ function _thisFunction(name) {
13924
+ switch (name) {
13925
+ case "scale":
13926
+ case "Scale":
13927
+ case "ADBE Scale":
13928
+ case 6:
13929
+ return _thisFunction.scale;
13930
+ case "rotation":
13931
+ case "Rotation":
13932
+ case "ADBE Rotation":
13933
+ case "ADBE Rotate Z":
13934
+ case 10:
13935
+ return _thisFunction.rotation;
13936
+ case "ADBE Rotate X":
13937
+ return _thisFunction.xRotation;
13938
+ case "ADBE Rotate Y":
13939
+ return _thisFunction.yRotation;
13940
+ case "position":
13941
+ case "Position":
13942
+ case "ADBE Position":
13943
+ case 2:
13944
+ return _thisFunction.position;
13945
+ case 'ADBE Position_0':
13946
+ return _thisFunction.xPosition;
13947
+ case 'ADBE Position_1':
13948
+ return _thisFunction.yPosition;
13949
+ case 'ADBE Position_2':
13950
+ return _thisFunction.zPosition;
13951
+ case "anchorPoint":
13952
+ case "AnchorPoint":
13953
+ case "Anchor Point":
13954
+ case "ADBE AnchorPoint":
13955
+ case 1:
13956
+ return _thisFunction.anchorPoint;
13957
+ case "opacity":
13958
+ case "Opacity":
13959
+ case 11:
13960
+ return _thisFunction.opacity;
13961
+ }
13962
+ }
13963
+
13964
+ Object.defineProperty(_thisFunction, "rotation", {
13965
+ get: ExpressionPropertyInterface(transform.r || transform.rz)
13966
+ });
13967
+
13968
+ Object.defineProperty(_thisFunction, "zRotation", {
13969
+ get: ExpressionPropertyInterface(transform.rz || transform.r)
13970
+ });
13971
+
13972
+ Object.defineProperty(_thisFunction, "xRotation", {
13973
+ get: ExpressionPropertyInterface(transform.rx)
13974
+ });
13975
+
13976
+ Object.defineProperty(_thisFunction, "yRotation", {
13977
+ get: ExpressionPropertyInterface(transform.ry)
13978
+ });
13979
+ Object.defineProperty(_thisFunction, "scale", {
13980
+ get: ExpressionPropertyInterface(transform.s)
13981
+ });
13982
+
13983
+ if (transform.p) {
13984
+ var _transformFactory = ExpressionPropertyInterface(transform.p);
13985
+ }
13986
+ Object.defineProperty(_thisFunction, "position", {
13987
+ get: function () {
13988
+ if (transform.p) {
13989
+ return _transformFactory();
13990
+ } else {
13991
+ return [transform.px.v, transform.py.v, transform.pz ? transform.pz.v : 0];
13992
+ }
13993
+ }
13994
+ });
13995
+
13996
+ Object.defineProperty(_thisFunction, "xPosition", {
13997
+ get: ExpressionPropertyInterface(transform.px)
13998
+ });
13999
+
14000
+ Object.defineProperty(_thisFunction, "yPosition", {
14001
+ get: ExpressionPropertyInterface(transform.py)
14002
+ });
14003
+
14004
+ Object.defineProperty(_thisFunction, "zPosition", {
14005
+ get: ExpressionPropertyInterface(transform.pz)
14006
+ });
14007
+
14008
+ Object.defineProperty(_thisFunction, "anchorPoint", {
14009
+ get: ExpressionPropertyInterface(transform.a)
14010
+ });
14011
+
14012
+ Object.defineProperty(_thisFunction, "opacity", {
14013
+ get: ExpressionPropertyInterface(transform.o)
14014
+ });
14015
+
14016
+ Object.defineProperty(_thisFunction, "skew", {
14017
+ get: ExpressionPropertyInterface(transform.sk)
14018
+ });
14019
+
14020
+ Object.defineProperty(_thisFunction, "skewAxis", {
14021
+ get: ExpressionPropertyInterface(transform.sa)
14022
+ });
14023
+
14024
+ Object.defineProperty(_thisFunction, "orientation", {
14025
+ get: ExpressionPropertyInterface(transform.or)
14026
+ });
14027
+
14028
+ return _thisFunction;
14029
+ };
14030
+ }());
14031
+ var ProjectInterface = (function () {
14032
+
14033
+ function registerComposition(comp) {
14034
+ this.compositions.push(comp);
14035
+ }
14036
+
14037
+ return function () {
14038
+ function _thisProjectFunction(name) {
14039
+ var i = 0, len = this.compositions.length;
14040
+ while (i < len) {
14041
+ if (this.compositions[i].data && this.compositions[i].data.nm === name) {
14042
+ if (this.compositions[i].prepareFrame && this.compositions[i].data.xt) {
14043
+ this.compositions[i].prepareFrame(this.currentFrame);
14044
+ }
14045
+ return this.compositions[i].compInterface;
14046
+ }
14047
+ i += 1;
14048
+ }
14049
+ }
14050
+
14051
+ _thisProjectFunction.compositions = [];
14052
+ _thisProjectFunction.currentFrame = 0;
14053
+
14054
+ _thisProjectFunction.registerComposition = registerComposition;
14055
+
14056
+
14057
+
14058
+ return _thisProjectFunction;
14059
+ };
14060
+ }());
14061
+ var EffectsExpressionInterface = (function () {
14062
+ var ob = {
14063
+ createEffectsInterface: createEffectsInterface
14064
+ };
14065
+
14066
+ function createEffectsInterface(elem, propertyGroup) {
14067
+ if (elem.effectsManager) {
14068
+
14069
+ var effectElements = [];
14070
+ var effectsData = elem.data.ef;
14071
+ var i, len = elem.effectsManager.effectElements.length;
14072
+ for (i = 0; i < len; i += 1) {
14073
+ effectElements.push(createGroupInterface(effectsData[i], elem.effectsManager.effectElements[i], propertyGroup, elem));
14074
+ }
14075
+
14076
+ return function (name) {
14077
+ var effects = elem.data.ef || [], i = 0, len = effects.length;
14078
+ while (i < len) {
14079
+ if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {
14080
+ return effectElements[i];
14081
+ }
14082
+ i += 1;
14083
+ }
14084
+ };
14085
+ }
14086
+ }
14087
+
14088
+ function createGroupInterface(data, elements, propertyGroup, elem) {
14089
+ var effectElements = [];
14090
+ var i, len = data.ef.length;
14091
+ for (i = 0; i < len; i += 1) {
14092
+ if (data.ef[i].ty === 5) {
14093
+ effectElements.push(createGroupInterface(data.ef[i], elements.effectElements[i], elements.effectElements[i].propertyGroup, elem));
14094
+ } else {
14095
+ effectElements.push(createValueInterface(elements.effectElements[i], data.ef[i].ty, elem, _propertyGroup));
14096
+ }
14097
+ }
14098
+
14099
+ function _propertyGroup(val) {
14100
+ if (val === 1) {
14101
+ return groupInterface;
14102
+ } else {
14103
+ return propertyGroup(val - 1);
14104
+ }
14105
+ }
14106
+
14107
+ var groupInterface = function (name) {
14108
+ var effects = data.ef, i = 0, len = effects.length;
14109
+ while (i < len) {
14110
+ if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {
14111
+ if (effects[i].ty === 5) {
14112
+ return effectElements[i];
14113
+ } else {
14114
+ return effectElements[i]();
14115
+ }
14116
+ }
14117
+ i += 1;
14118
+ }
14119
+ return effectElements[0]();
14120
+ };
14121
+
14122
+ groupInterface.propertyGroup = _propertyGroup;
14123
+
14124
+ if (data.mn === 'ADBE Color Control') {
14125
+ Object.defineProperty(groupInterface, 'color', {
14126
+ get: function () {
14127
+ return effectElements[0]();
14128
+ }
14129
+ });
14130
+ }
14131
+ Object.defineProperty(groupInterface, 'numProperties', {
14132
+ get: function () {
14133
+ return data.np;
14134
+ }
14135
+ });
14136
+ groupInterface.active = groupInterface.enabled = data.en !== 0;
14137
+ return groupInterface;
14138
+ }
14139
+
14140
+ function createValueInterface(element, type, elem, propertyGroup) {
14141
+ var expressionProperty = ExpressionPropertyInterface(element.p);
14142
+ function interfaceFunction() {
14143
+ if (type === 10) {
14144
+ return elem.comp.compInterface(element.p.v);
14145
+ }
14146
+ return expressionProperty();
14147
+ }
14148
+
14149
+ if (element.p.setGroupProperty) {
14150
+ element.p.setGroupProperty(propertyGroup);
14151
+ }
14152
+
14153
+ return interfaceFunction;
14154
+ }
14155
+
14156
+ return ob;
14157
+
14158
+ }());
14159
+ var MaskManagerInterface = (function () {
14160
+
14161
+ function MaskInterface(mask, data) {
14162
+ this._mask = mask;
14163
+ this._data = data;
14164
+ }
14165
+ Object.defineProperty(MaskInterface.prototype, 'maskPath', {
14166
+ get: function () {
14167
+ if (this._mask.prop.k) {
14168
+ this._mask.prop.getValue();
14169
+ }
14170
+ return this._mask.prop;
14171
+ }
14172
+ });
14173
+ Object.defineProperty(MaskInterface.prototype, 'maskOpacity', {
14174
+ get: function () {
14175
+ if (this._mask.op.k) {
14176
+ this._mask.op.getValue();
14177
+ }
14178
+ return this._mask.op.v * 100;
14179
+ }
14180
+ });
14181
+
14182
+ var MaskManager = function (maskManager, elem) {
14183
+ var _maskManager = maskManager;
14184
+ var _elem = elem;
14185
+ var _masksInterfaces = createSizedArray(maskManager.viewData.length);
14186
+ var i, len = maskManager.viewData.length;
14187
+ for (i = 0; i < len; i += 1) {
14188
+ _masksInterfaces[i] = new MaskInterface(maskManager.viewData[i], maskManager.masksProperties[i]);
14189
+ }
14190
+
14191
+ var maskFunction = function (name) {
14192
+ i = 0;
14193
+ while (i < len) {
14194
+ if (maskManager.masksProperties[i].nm === name) {
14195
+ return _masksInterfaces[i];
14196
+ }
14197
+ i += 1;
14198
+ }
14199
+ };
14200
+ return maskFunction;
14201
+ };
14202
+ return MaskManager;
14203
+ }());
14204
+
14205
+ var ExpressionPropertyInterface = (function () {
14206
+
14207
+ var defaultUnidimensionalValue = { pv: 0, v: 0, mult: 1 }
14208
+ var defaultMultidimensionalValue = { pv: [0, 0, 0], v: [0, 0, 0], mult: 1 }
14209
+
14210
+ function completeProperty(expressionValue, property, type) {
14211
+ Object.defineProperty(expressionValue, 'velocity', {
14212
+ get: function () {
14213
+ return property.getVelocityAtTime(property.comp.currentFrame);
14214
+ }
14215
+ });
14216
+ expressionValue.numKeys = property.keyframes ? property.keyframes.length : 0;
14217
+ expressionValue.key = function (pos) {
14218
+ if (!expressionValue.numKeys) {
14219
+ return 0;
14220
+ } else {
14221
+ var value = '';
14222
+ if ('s' in property.keyframes[pos - 1]) {
14223
+ value = property.keyframes[pos - 1].s;
14224
+ } else if ('e' in property.keyframes[pos - 2]) {
14225
+ value = property.keyframes[pos - 2].e;
14226
+ } else {
14227
+ value = property.keyframes[pos - 2].s;
14228
+ }
14229
+ var valueProp = type === 'unidimensional' ? new Number(value) : Object.assign({}, value);
14230
+ valueProp.time = property.keyframes[pos - 1].t / property.elem.comp.globalData.frameRate;
14231
+ return valueProp;
14232
+ }
14233
+ };
14234
+ expressionValue.valueAtTime = property.getValueAtTime;
14235
+ expressionValue.speedAtTime = property.getSpeedAtTime;
14236
+ expressionValue.velocityAtTime = property.getVelocityAtTime;
14237
+ expressionValue.propertyGroup = property.propertyGroup;
14238
+ }
14239
+
14240
+ function UnidimensionalPropertyInterface(property) {
14241
+ if (!property || !('pv' in property)) {
14242
+ property = defaultUnidimensionalValue;
14243
+ }
14244
+ var mult = 1 / property.mult;
14245
+ var val = property.pv * mult;
14246
+ var expressionValue = new Number(val);
14247
+ expressionValue.value = val;
14248
+ completeProperty(expressionValue, property, 'unidimensional');
14249
+
14250
+ return function () {
14251
+ if (property.k) {
14252
+ property.getValue();
14253
+ }
14254
+ val = property.v * mult;
14255
+ if (expressionValue.value !== val) {
14256
+ expressionValue = new Number(val);
14257
+ expressionValue.value = val;
14258
+ completeProperty(expressionValue, property, 'unidimensional');
14259
+ }
14260
+ return expressionValue;
14261
+ }
14262
+ }
14263
+
14264
+ function MultidimensionalPropertyInterface(property) {
14265
+ if (!property || !('pv' in property)) {
14266
+ property = defaultMultidimensionalValue;
14267
+ }
14268
+ var mult = 1 / property.mult;
14269
+ var len = property.pv.length;
14270
+ var expressionValue = createTypedArray('float32', len);
14271
+ var arrValue = createTypedArray('float32', len);
14272
+ expressionValue.value = arrValue;
14273
+ completeProperty(expressionValue, property, 'multidimensional');
14274
+
14275
+ return function () {
14276
+ if (property.k) {
14277
+ property.getValue();
14278
+ }
14279
+ for (var i = 0; i < len; i += 1) {
14280
+ expressionValue[i] = arrValue[i] = property.v[i] * mult;
14281
+ }
14282
+ return expressionValue;
14283
+ }
14284
+ }
14285
+
14286
+ //TODO: try to avoid using this getter
14287
+ function defaultGetter() {
14288
+ return defaultUnidimensionalValue;
14289
+ }
14290
+
14291
+ return function (property) {
14292
+ if (!property) {
14293
+ return defaultGetter;
14294
+ } else if (property.propType === 'unidimensional') {
14295
+ return UnidimensionalPropertyInterface(property);
14296
+ } else {
14297
+ return MultidimensionalPropertyInterface(property);
14298
+ }
14299
+ }
14300
+ }());
14301
+
14302
+ (function () {
14303
+
14304
+ var TextExpressionSelectorProp = (function () {
14305
+
14306
+ function getValueProxy(index, total) {
14307
+ this.textIndex = index + 1;
14308
+ this.textTotal = total;
14309
+ this.v = this.getValue() * this.mult;
14310
+ return this.v;
14311
+ }
14312
+
14313
+ return function TextExpressionSelectorProp(elem, data) {
14314
+ this.pv = 1;
14315
+ this.comp = elem.comp;
14316
+ this.elem = elem;
14317
+ this.mult = 0.01;
14318
+ this.propType = 'textSelector';
14319
+ this.textTotal = data.totalChars;
14320
+ this.selectorValue = 100;
14321
+ this.lastValue = [1, 1, 1];
14322
+ this.k = true;
14323
+ this.x = true;
14324
+ this.getValue = ExpressionManager.initiateExpression.bind(this)(elem, data, this);
14325
+ this.getMult = getValueProxy;
14326
+ this.getVelocityAtTime = expressionHelpers.getVelocityAtTime;
14327
+ if (this.kf) {
14328
+ this.getValueAtTime = expressionHelpers.getValueAtTime.bind(this);
14329
+ } else {
14330
+ this.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(this);
14331
+ }
14332
+ this.setGroupProperty = expressionHelpers.setGroupProperty;
14333
+ };
14334
+ }());
14335
+
14336
+ var propertyGetTextProp = TextSelectorProp.getTextSelectorProp;
14337
+ TextSelectorProp.getTextSelectorProp = function (elem, data, arr) {
14338
+ if (data.t === 1) {
14339
+ return new TextExpressionSelectorProp(elem, data, arr);
14340
+ } else {
14341
+ return propertyGetTextProp(elem, data, arr);
14342
+ }
14343
+ };
14344
+ }());
14345
+ function SliderEffect(data, elem, container) {
14346
+ this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
14347
  }
14348
+ function AngleEffect(data, elem, container) {
14349
+ this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
14350
+ }
14351
+ function ColorEffect(data, elem, container) {
14352
+ this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container);
14353
+ }
14354
+ function PointEffect(data, elem, container) {
14355
+ this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container);
14356
+ }
14357
+ function LayerIndexEffect(data, elem, container) {
14358
+ this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
14359
+ }
14360
+ function MaskIndexEffect(data, elem, container) {
14361
+ this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
14362
+ }
14363
+ function CheckboxEffect(data, elem, container) {
14364
+ this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
14365
+ }
14366
+ function NoValueEffect() {
14367
+ this.p = {};
14368
+ }
14369
+ function EffectsManager() { }
14370
+ function EffectsManager(data, element) {
14371
+ var effects = data.ef || [];
14372
+ this.effectElements = [];
14373
+ var i, len = effects.length;
14374
+ var effectItem;
14375
+ for (i = 0; i < len; i++) {
14376
+ effectItem = new GroupEffect(effects[i], element);
14377
+ this.effectElements.push(effectItem);
14378
+ }
14379
+ }
14380
+
14381
+ function GroupEffect(data, element) {
14382
+ this.init(data, element);
14383
+ }
14384
+
14385
+ extendPrototype([DynamicPropertyContainer], GroupEffect);
14386
+
14387
+ GroupEffect.prototype.getValue = GroupEffect.prototype.iterateDynamicProperties;
14388
+
14389
+ GroupEffect.prototype.init = function (data, element) {
14390
+ this.data = data;
14391
+ this.effectElements = [];
14392
+ this.initDynamicPropertyContainer(element);
14393
+ var i, len = this.data.ef.length;
14394
+ var eff, effects = this.data.ef;
14395
+ for (i = 0; i < len; i += 1) {
14396
+ eff = null;
14397
+ switch (effects[i].ty) {
14398
+ case 0:
14399
+ eff = new SliderEffect(effects[i], element, this);
14400
+ break;
14401
+ case 1:
14402
+ eff = new AngleEffect(effects[i], element, this);
14403
+ break;
14404
+ case 2:
14405
+ eff = new ColorEffect(effects[i], element, this);
14406
+ break;
14407
+ case 3:
14408
+ eff = new PointEffect(effects[i], element, this);
14409
+ break;
14410
+ case 4:
14411
+ case 7:
14412
+ eff = new CheckboxEffect(effects[i], element, this);
14413
+ break;
14414
+ case 10:
14415
+ eff = new LayerIndexEffect(effects[i], element, this);
14416
+ break;
14417
+ case 11:
14418
+ eff = new MaskIndexEffect(effects[i], element, this);
14419
+ break;
14420
+ case 5:
14421
+ eff = new EffectsManager(effects[i], element, this);
14422
+ break;
14423
+ //case 6:
14424
+ default:
14425
+ eff = new NoValueEffect(effects[i], element, this);
14426
+ break;
14427
+ }
14428
+ if (eff) {
14429
+ this.effectElements.push(eff);
14430
+ }
14431
+ }
14432
+ };
14433
+
14434
+ var lottie = {};
14435
+
14436
+ var _isFrozen = false;
14437
+
14438
+ function setLocationHref(href) {
14439
+ locationHref = href;
14440
+ }
14441
+
14442
+ function searchAnimations() {
14443
+ if (standalone === true) {
14444
+ animationManager.searchAnimations(animationData, standalone, renderer);
14445
+ } else {
14446
+ animationManager.searchAnimations();
14447
+ }
14448
+ }
14449
+
14450
+ function setSubframeRendering(flag) {
14451
+ subframeEnabled = flag;
14452
+ }
14453
+
14454
+ function loadAnimation(params) {
14455
+ if (standalone === true) {
14456
+ params.animationData = JSON.parse(animationData);
14457
+ }
14458
+ return animationManager.loadAnimation(params);
14459
+ }
14460
+
14461
+ function setQuality(value) {
14462
+ if (typeof value === 'string') {
14463
+ switch (value) {
14464
+ case 'high':
14465
+ defaultCurveSegments = 200;
14466
+ break;
14467
+ case 'medium':
14468
+ defaultCurveSegments = 50;
14469
+ break;
14470
+ case 'low':
14471
+ defaultCurveSegments = 10;
14472
+ break;
14473
+ }
14474
+ } else if (!isNaN(value) && value > 1) {
14475
+ defaultCurveSegments = value;
14476
+ }
14477
+ if (defaultCurveSegments >= 50) {
14478
+ roundValues(false);
14479
+ } else {
14480
+ roundValues(true);
14481
+ }
14482
+ }
14483
+
14484
+ function inBrowser() {
14485
+ return typeof navigator !== 'undefined';
14486
+ }
14487
+
14488
+ function installPlugin(type, plugin) {
14489
+ if (type === 'expressions') {
14490
+ expressionsPlugin = plugin;
14491
+ }
14492
+ }
14493
+
14494
+ function getFactory(name) {
14495
+ switch (name) {
14496
+ case "propertyFactory":
14497
+ return PropertyFactory;
14498
+ case "shapePropertyFactory":
14499
+ return ShapePropertyFactory;
14500
+ case "matrix":
14501
+ return Matrix;
14502
+ }
14503
+ }
14504
+
14505
+ lottie.play = animationManager.play;
14506
+ lottie.pause = animationManager.pause;
14507
+ lottie.setLocationHref = setLocationHref;
14508
+ lottie.togglePause = animationManager.togglePause;
14509
+ lottie.setSpeed = animationManager.setSpeed;
14510
+ lottie.setDirection = animationManager.setDirection;
14511
+ lottie.stop = animationManager.stop;
14512
+ lottie.searchAnimations = searchAnimations;
14513
+ lottie.registerAnimation = animationManager.registerAnimation;
14514
+ lottie.loadAnimation = loadAnimation;
14515
+ lottie.setSubframeRendering = setSubframeRendering;
14516
+ lottie.resize = animationManager.resize;
14517
+ //lottie.start = start;
14518
+ lottie.goToAndStop = animationManager.goToAndStop;
14519
+ lottie.destroy = animationManager.destroy;
14520
+ lottie.setQuality = setQuality;
14521
+ lottie.inBrowser = inBrowser;
14522
+ lottie.installPlugin = installPlugin;
14523
+ lottie.freeze = animationManager.freeze;
14524
+ lottie.unfreeze = animationManager.unfreeze;
14525
+ lottie.getRegisteredAnimations = animationManager.getRegisteredAnimations;
14526
+ lottie.__getFactory = getFactory;
14527
+ lottie.version = '5.6.6';
14528
+
14529
+ function checkReady() {
14530
+ if (document.readyState === "complete") {
14531
+ clearInterval(readyStateCheckInterval);
14532
+ searchAnimations();
14533
+ }
14534
+ }
14535
+
14536
+ function getQueryVariable(variable) {
14537
+ var vars = queryString.split('&');
14538
+ for (var i = 0; i < vars.length; i++) {
14539
+ var pair = vars[i].split('=');
14540
+ if (decodeURIComponent(pair[0]) == variable) {
14541
+ return decodeURIComponent(pair[1]);
14542
+ }
14543
+ }
14544
+ }
14545
+ var standalone = '__[STANDALONE]__';
14546
+ var animationData = '__[ANIMATIONDATA]__';
14547
+ var renderer = '';
14548
+ if (standalone) {
14549
+ var scripts = document.getElementsByTagName('script');
14550
+ var index = scripts.length - 1;
14551
+ var myScript = scripts[index] || {
14552
+ src: ''
14553
+ };
14554
+ var queryString = myScript.src.replace(/^[^\?]+\??/, '');
14555
+ renderer = getQueryVariable('renderer');
14556
+ }
14557
+ var readyStateCheckInterval = setInterval(checkReady, 100);
14558
+
14559
  return lottie;
14560
  }));
14561
 
14846
  };
14847
 
14848
 
 
 
14849
  if ($('.premium-lottie-yes').length) {
14850
 
14851
  var isEditMode = elementorFrontend.isEditMode();
14852
 
14853
+ Object.values(window.scopes_array).forEach(function ($scope) {
 
14854
  premiumLottieHandler($scope, isEditMode);
14855
  });
 
14856
  }
14857
 
14858
 
14959
 
14960
  var $layer = jQuery('.elementor-repeater-item-' + layer._id);
14961
 
 
14962
  var loop = layer.lottie_loop,
14963
  reverse = layer.lottie_reverse,
14964
  trigger = layer.hover_action;
assets/frontend/min-css/premium-addons.min.css CHANGED
@@ -1 +1 @@
1
- @font-face{font-family:pa-elements;src:url(../../editor/fonts/pa-elements.eot?p2y7wv);src:url(../../editor/fonts/pa-elements.eot?p2y7wv#iefix) format("embedded-opentype"),url(../../editor/fonts/pa-elements.ttf?p2y7wv) format("truetype"),url(../../editor/fonts/pa-elements.woff?p2y7wv) format("woff"),url(../../editor/fonts/pa-elements.svg?p2y7wv#pa-elements) format("svg");font-weight:400;font-style:normal}.premium-banner{overflow:hidden}.premium-banner-ib{display:block;position:relative}.premium-banner-ib img{display:block;position:relative}.premium-banner-img-wrap{display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex;height:100%}.premium-banner-img-wrap .premium-banner-ib-img{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0}.premium-banner-ib{z-index:1;overflow:hidden;margin:0 0 35px;text-align:center;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.premium-banner-ib-desc .premium-banner-read-more{z-index:100}.premium-banner-ib,.wpb_column>.wpb_wrapper .premium-banner-ib{margin-bottom:0}.elementor-widget-premium-addon-banner .premium-banner-ib-title{background:0 0}.premium-banner-ib *,.premium-banner-ib .premium-banner-ib-desc{-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.premium-banner-ib img{min-width:100%;max-width:100%;-webkit-transition:opacity .35s;transition:opacity .35s}.premium-banner-ib .premium-banner-ib-desc{padding:15px;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;top:0;left:0;width:100%;height:100%}.premium-banner-ib .premium-banner-ib-link{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1000;text-indent:200%;white-space:nowrap;font-size:0;opacity:0}.premium-banner-ib a.premium-banner-ib-link{display:block;background:0 0}.premium-banner-animation1 img{width:-webkit-calc(100% + 50px)!important;width:calc(100% + 50px)!important;max-width:-webkit-calc(100% + 50px)!important;max-width:calc(100% + 50px)!important;-webkit-transition:opacity .35s,filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,-webkit-transform .35s;-webkit-transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(-40px,0,0);transform:translate3d(-40px,0,0)}.premium-banner-animation2 .premium-banner-ib-title{padding:15px}.premium-banner-animation1 .premium-banner-ib-desc{top:auto;bottom:0;min-height:25%;height:auto;max-height:100%;text-align:left}.premium-banner-animation1 .premium-banner-ib-content,.premium-banner-animation1 .premium-banner-ib-title,.premium-banner-animation1 .premium-banner-read-more{-webkit-transform:translate3d(0,40px,0);transform:translate3d(0,40px,0);-webkit-transition-delay:50ms;transition-delay:50ms;-webkit-transition-duration:.35s;transition-duration:.35s}.premium-banner-animation1 .premium-banner-ib-title{-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s}.premium-banner-animation1 .premium-banner-ib-content,.premium-banner-animation1 .premium-banner-read-more{margin-top:10px;opacity:0;-webkit-transition:opacity .2s,-webkit-transform .35s;transition:opacity .2s,-webkit-transform .35s;transition:opacity .2s,transform .35s;transition:opacity .2s,transform .35s,-webkit-transform .35s}.premium-banner-animation1.active .premium-banner-ib-content,.premium-banner-animation1.active .premium-banner-read-more,.premium-banner-animation1:hover .premium-banner-ib-content,.premium-banner-animation1:hover .premium-banner-read-more{opacity:1;-webkit-transition-delay:50ms;transition-delay:50ms;-webkit-transition-duration:.35s;transition-duration:.35s}.premium-banner-animation1.active .premium-banner-ib-content,.premium-banner-animation1.active .premium-banner-ib-title,.premium-banner-animation1.active .premium-banner-read-more,.premium-banner-animation1.active img,.premium-banner-animation1:hover .premium-banner-ib-content,.premium-banner-animation1:hover .premium-banner-ib-title,.premium-banner-animation1:hover .premium-banner-read-more,.premium-banner-animation1:hover img{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);-webkit-transition-delay:50ms;transition-delay:50ms;-webkit-transition-duration:.35s;transition-duration:.35s}.premium-banner-animation1.scale img,.premium-banner-animation1.zoomout img{-webkit-transform:translate3d(-40px,0,0) scale(1.1);transform:translate3d(-40px,0,0) scale(1.1)}.premium-banner-ib.sepia img{-webkit-filter:sepia(30%);filter:sepia(30%)}.premium-banner-ib.bright img{-webkit-filter:brightness(1);filter:brightness(1)}.premium-banner-ib.sepia:hover img{-webkit-filter:sepia(0);filter:sepia(0)}.premium-banner-ib.bright:hover img{-webkit-filter:brightness(1.2);filter:brightness(1.2)}.premium-banner-animation1.premium-banner-min-height img,.premium-banner-animation13.premium-banner-min-height img,.premium-banner-animation2.premium-banner-min-height img,.premium-banner-animation4.premium-banner-min-height img,.premium-banner-animation5.premium-banner-min-height img,.premium-banner-animation6.premium-banner-min-height img{height:auto}.premium-banner-animation2 img{width:100%}.premium-banner-animation2 .premium-banner-ib-desc::before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;opacity:0;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0)}.premium-banner-animation2 .premium-banner-ib-title{position:absolute;top:50%;left:0;width:100%;-webkit-transition:-webkit-transform .35s,color .35s;-webkit-transition:color .35s,-webkit-transform .35s;transition:color .35s,-webkit-transform .35s;transition:transform .35s,color .35s;transition:transform .35s,color .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.premium-banner-animation2 .premium-banner-ib-content,.premium-banner-animation2 .premium-banner-ib-desc::before,.premium-banner-animation2 .premium-banner-read-more{-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s}.premium-banner-animation2 .premium-banner-ib-content,.premium-banner-animation2 .premium-banner-read-more{position:absolute;bottom:0;left:0;padding:15px;width:100%;max-height:50%;opacity:0;-webkit-transform:translate3d(0,10px,0);transform:translate3d(0,10px,0)}.premium-banner-animation2.active .premium-banner-ib-title,.premium-banner-animation2:hover .premium-banner-ib-title{-webkit-transform:translate3d(0,-40px,0);transform:translate3d(0,-40px,0)}.premium-banner-animation2.active .premium-banner-ib-desc::before,.premium-banner-animation2.active .premium-banner-read-more,.premium-banner-animation2:hover .premium-banner-ib-desc::before,.premium-banner-animation2:hover .premium-banner-read-more{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation2.active .premium-banner-ib-content,.premium-banner-animation2:hover .premium-banner-ib-content{opacity:1;-webkit-transform:translate3d(0,-30px,0);transform:translate3d(0,-30px,0)}.premium-banner-animation3 .premium-banner-ib-title{position:absolute;bottom:0;left:0;padding:15px;width:100%;text-align:left;-webkit-transform:translate3d(0,-30px,0);transform:translate3d(0,-30px,0)}.premium-banner-animation3 .premium-banner-ib-desc::before,.premium-banner-animation3 .premium-banner-ib-title{-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s}.premium-banner-animation3.active .premium-banner-ib-desc::before,.premium-banner-animation3.active .premium-banner-ib-title,.premium-banner-animation3:hover .premium-banner-ib-desc::before,.premium-banner-animation3:hover .premium-banner-ib-title{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation3 .premium-banner-ib-content{max-height:-webkit-calc(100% - 60px - 1.5em);max-height:calc(100% - 60px - 1.5em);overflow:hidden}.premium-banner-animation4 img{width:-webkit-calc(100% + 40px)!important;width:calc(100% + 40px)!important;max-width:-webkit-calc(100% + 40px)!important;max-width:calc(100% + 40px)!important}.premium-banner-animation4 .premium-banner-ib-desc{padding:30px}.premium-banner-animation4 .premium-banner-ib-desc::after{position:absolute;content:"";opacity:0}.premium-banner-animation4 .premium-banner-ib-desc::before{position:absolute;content:"";opacity:0;top:50px;right:30px;bottom:50px;left:30px;border-top:1px solid #fff;border-bottom:1px solid #fff;-webkit-transform:scale(0,1);-ms-transform:scale(0,1);transform:scale(0,1);-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}.premium-banner-animation4 .premium-banner-ib-desc::after{top:30px;right:50px;bottom:30px;left:50px;border-right:1px solid #fff;border-left:1px solid #fff;-webkit-transform:scale(1,0);-ms-transform:scale(1,0);transform:scale(1,0);-webkit-transform-origin:100% 0;-ms-transform-origin:100% 0;transform-origin:100% 0}.premium-banner-animation4 .premium-banner-ib-title{padding:50px 30px 0 30px;-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s}.premium-banner-animation4 .premium-banner-ib-content,.premium-banner-animation4 .premium-banner-read-more{padding:10px 30px;opacity:0;overflow:hidden;-webkit-transform:translate3d(0,-10px,0);transform:translate3d(0,-10px,0)}.premium-banner-animation4 .premium-banner-ib-title,.premium-banner-animation4 img{-webkit-transform:translate3d(-30px,0,0);transform:translate3d(-30px,0,0)}.premium-banner-animation4.scale img,.premium-banner-animation4.zoomout img{-webkit-transform:translate3d(-30px,0,0) scale(1.1);transform:translate3d(-30px,0,0) scale(1.1)}.premium-banner-animation4 .premium-banner-ib-content,.premium-banner-animation4 .premium-banner-read-more{-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s}.premium-banner-animation4 .premium-banner-ib-desc::after,.premium-banner-animation4 .premium-banner-ib-desc::before{-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s}.premium-banner-animation4 img{-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s}.premium-banner-animation4.active .premium-banner-ib-desc::after,.premium-banner-animation4.active .premium-banner-ib-desc::before,.premium-banner-animation4:hover .premium-banner-ib-desc::after,.premium-banner-animation4:hover .premium-banner-ib-desc::before{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-banner-animation4.active .premium-banner-ib-content,.premium-banner-animation4.active .premium-banner-ib-title,.premium-banner-animation4.active .premium-banner-read-more,.premium-banner-animation4:hover .premium-banner-ib-content,.premium-banner-animation4:hover .premium-banner-ib-title,.premium-banner-animation4:hover .premium-banner-read-more{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation4:hover .premium-banner-ib-content,.premium-banner-animation4:hover .premium-banner-ib-desc::after,.premium-banner-animation4:hover .premium-banner-ib-title,.premium-banner-animation4:hover img{-webkit-transition-delay:.15s;transition-delay:.15s}.premium-banner-animation5 .premium-banner-ib-desc{top:auto;bottom:0;padding:15px;height:auto;background:#f2f2f2;color:#3c4a50;-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}.premium-banner-animation5 .premium-banner-ib-content{position:absolute;top:auto;bottom:100%;left:0;width:100%;padding:15px;opacity:0;-webkit-transition:opacity .35s;transition:opacity .35s}.premium-banner-animation5 .premium-banner-ib-title,.premium-banner-animation5 .premium-banner-read-more{-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,200%,0);transform:translate3d(0,200%,0);text-align:center}.premium-banner-animation5 .premium-banner-ib-title{margin:10px 0}.premium-banner-animation5.active .premium-banner-ib-content,.premium-banner-animation5.active .premium-banner-ib-content *,.premium-banner-animation5:hover .premium-banner-ib-content,.premium-banner-animation5:hover .premium-banner-ib-content *{opacity:1!important;z-index:99!important;-webkit-backface-visibility:hidden!important;backface-visibility:hidden!important}.premium-banner-animation5.active .premium-banner-ib-desc,.premium-banner-animation5.active .premium-banner-ib-title,.premium-banner-animation5.active .premium-banner-read-more,.premium-banner-animation5:hover .premium-banner-ib-desc,.premium-banner-animation5:hover .premium-banner-ib-title,.premium-banner-animation5:hover .premium-banner-read-more{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}.premium-banner-animation5:hover .premium-banner-ib-title{-webkit-transition-delay:50ms;transition-delay:50ms}.premium-banner-animation5 img{-webkit-transition:opacity .35s,filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,-webkit-transform .35s;-webkit-transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-transform .35s}.premium-banner-animation2 img,.premium-banner-animation4 img,.premium-banner-animation6 img{-webkit-transition:opacity .35s,filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,-webkit-transform .35s;-webkit-transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-transform .35s}.premium-banner-animation5.scale img,.premium-banner-animation5.zoomout img{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.premium-banner-animation2.scale img,.premium-banner-animation2.zoomout img{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.premium-banner-animation6.scale img,.premium-banner-animation6.zoomout img{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.premium-banner-animation2.zoomin:hover img,.premium-banner-animation5.zoomin:hover img,.premium-banner-animation6.zoomin:hover img{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.premium-banner-animation2.zoomout:hover img,.premium-banner-animation5.zoomout:hover img,.premium-banner-animation6.zoomout:hover img{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-banner-animation2.scale:hover img,.premium-banner-animation5.scale:hover img,.premium-banner-animation6.scale:hover img{-webkit-transform:scale(1.2) rotate(5deg);-ms-transform:scale(1.2) rotate(5deg);transform:scale(1.2) rotate(5deg)}.premium-banner-animation2.grayscale:hover img,.premium-banner-animation5.grayscale:hover img,.premium-banner-animation6.grayscale:hover img{-webkit-filter:grayscale(100%);filter:grayscale(100%)}.premium-banner-animation2.blur:hover img,.premium-banner-animation5.blur:hover img{-webkit-filter:blur(3px);filter:blur(3px)}.premium-banner-animation6.blur:hover img{-webkit-filter:blur(3px);filter:blur(3px)}.premium-banner-animation6 .premium-banner-ib-desc{padding:45px}.premium-banner-animation6 .premium-banner-ib-desc::before{position:absolute;content:"";top:30px;right:30px;bottom:30px;left:30px;border:1px solid #fff}.premium-banner-animation6 .premium-banner-ib-title{margin:20px 0 10px;-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}.premium-banner-animation6 .premium-banner-ib-content,.premium-banner-animation6 .premium-banner-ib-desc::before,.premium-banner-animation6 .premium-banner-read-more{opacity:0;-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}.premium-banner-animation6 .premium-banner-read-more{margin-top:10px}.premium-banner-animation6.active .premium-banner-ib-title,.premium-banner-animation6:hover .premium-banner-ib-title{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation6.active .premium-banner-ib-content,.premium-banner-animation6.active .premium-banner-ib-desc::before,.premium-banner-animation6.active .premium-banner-read-more,.premium-banner-animation6:hover .premium-banner-ib-content,.premium-banner-animation6:hover .premium-banner-ib-desc::before,.premium-banner-animation6:hover .premium-banner-read-more{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-banner-animation8 img{-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s;-webkit-transform:scale(1.15);-ms-transform:scale(1.15);transform:scale(1.15)}.premium-banner-animation8.active img,.premium-banner-animation8:hover img{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-banner-animation8 .premium-banner-ib-title{margin-top:20%;-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,20px,0);transform:translate3d(0,20px,0)}.premium-banner-animation8.active .premium-banner-ib-title,.premium-banner-animation8:hover .premium-banner-ib-title{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation8 .premium-banner-ib-content{margin:1em 0 0;padding:35px;border:1px solid #fff;opacity:0;-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,20px,0) scale(1.1);transform:translate3d(0,20px,0) scale(1.1)}.premium-banner-animation8.active .premium-banner-ib-content,.premium-banner-animation8:hover .premium-banner-ib-content{opacity:1;-webkit-transform:translate3d(0,0,0) scale(1);transform:translate3d(0,0,0) scale(1)}.premium-banner-animation12 .premium-banner-ib-desc::after{position:absolute;content:"";right:30px;bottom:30px;left:30px;height:-webkit-calc(50% - 30px);height:calc(50% - 30px);border:7px solid #fff;-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0)}.premium-banner-animation12.active .premium-banner-ib-desc::after,.premium-banner-animation12:hover .premium-banner-ib-desc::after{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation12 .premium-banner-ib-desc{padding:45px;text-align:left}.premium-banner-animation12 .premium-banner-ib-content{position:absolute;right:60px;bottom:60px;left:60px;opacity:0;-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,-100px,0);transform:translate3d(0,-100px,0)}.premium-banner-animation12.active .premium-banner-ib-content,.premium-banner-animation12:hover .premium-banner-ib-content{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation13 img{width:-webkit-calc(100% + 20px)!important;width:calc(100% + 20px)!important;max-width:-webkit-calc(100% + 20px)!important;max-width:calc(100% + 20px)!important;-webkit-transition:opacity .35s,filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,-webkit-transform .35s;-webkit-transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(-10px,0,0);transform:translate3d(-10px,0,0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.premium-banner-animation13.scale img,.premium-banner-animation13.zoomout img{-webkit-transform:translate3d(-10px,0,0) scale(1.1);transform:translate3d(-10px,0,0) scale(1.1)}.premium-banner-animation13.none:hover img{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation1.none:hover img,.premium-banner-animation4.none:hover img{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation1.zoomin:hover img,.premium-banner-animation13.zoomin:hover img,.premium-banner-animation4.zoomin:hover img{-webkit-transform:translate3d(0,0,0) scale(1.1);transform:translate3d(0,0,0) scale(1.1)}.premium-banner-animation1.zoomout:hover img,.premium-banner-animation13.zoomout:hover img,.premium-banner-animation4.zoomout:hover img{-webkit-transform:translate3d(0,0,0) scale(1);transform:translate3d(0,0,0) scale(1)}.premium-banner-animation1.scale:hover img,.premium-banner-animation13.scale:hover img,.premium-banner-animation4.scale:hover img{-webkit-transform:translate3d(0,0,0) scale(1.2) rotate(5deg);transform:translate3d(0,0,0) scale(1.2) rotate(5deg)}.premium-banner-animation1.grayscale:hover img,.premium-banner-animation13.grayscale:hover img,.premium-banner-animation4.grayscale:hover img{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);-webkit-filter:grayscale(100%);filter:grayscale(100%)}.premium-banner-animation1.blur:hover img,.premium-banner-animation13.blur:hover img,.premium-banner-animation4.blur:hover img{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);-webkit-filter:blur(3px);filter:blur(3px)}.premium-banner-animation13 .premium-banner-ib-desc{text-align:left}.premium-banner-animation13 .premium-banner-ib-title{position:relative;overflow:hidden;padding:5px 0 10px}.premium-banner-animation13 .premium-banner-ib-title::after{position:absolute;content:"";bottom:0;left:0;width:100%;height:2px;background:#fff;-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(-101%,0,0);transform:translate3d(-101%,0,0)}.premium-banner-animation13.active .premium-banner-ib-title::after,.premium-banner-animation13:hover .premium-banner-ib-title::after{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation13 .premium-banner-ib-content,.premium-banner-animation13 .premium-banner-read-more{padding:15px 0;opacity:0;-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.premium-banner-animation13.active .premium-banner-ib-content,.premium-banner-animation13.active .premium-banner-read-more,.premium-banner-animation13:hover .premium-banner-ib-content,.premium-banner-animation13:hover .premium-banner-read-more{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-ib.premium-banner-animation5 .premium-banner-toggle-size{left:50%;width:auto!important;height:100%;max-width:none;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%)}.premium-banner-ib img{border:none;padding:0;margin:0}.premium-countdown{display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex}.pre_countdown-row{display:block;text-align:center}.countdown .pre_countdown-section{display:inline-block;max-width:100%;margin-bottom:15px;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;-js-display:inline-flex;display:-moz-inline-box;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center}.countdown .pre_countdown-section:last-child{margin-right:0}.countdown span.pre_countdown-amount{font-size:70px;line-height:1}.countdown .pre_time-mid{display:block}.premium-countdown-separator-yes .pre-countdown_separator{display:block;margin:0 50px;font-size:30px}.premium-countdown-separator-yes .pre_countdown-row .pre_countdown-section:last-child .pre-countdown_separator{display:none}.side .pre_countdown-section .pre_countdown-period{vertical-align:bottom}.countdown .pre_countdown-section .pre_countdown-period{font-size:17px;line-height:3em}.side .pre_countdown-section .pre_countdown-amount,.side .pre_countdown-section .pre_countdown-period{display:inline-block}.side .pre_countdown-section .pre_countdown-amount{margin-right:5px}.down .pre_countdown-section .pre_countdown-amount,.down .pre_countdown-section .pre_countdown-period{display:block}.premium-carousel-wrapper a.carousel-arrow,.premium-carousel-wrapper a.ver-carousel-arrow{display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;width:2em;height:2em;line-height:0;text-align:center;position:absolute;z-index:99;cursor:pointer;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;-webkit-appearance:inherit;border:none;-webkit-box-shadow:none;box-shadow:none}.premium-blog-wrap a.carousel-arrow,.premium-fb-rev-container a.carousel-arrow,.premium-hscroll-wrap a.carousel-arrow,.premium-persons-container a.carousel-arrow,.premium-twitter-feed-wrapper a.carousel-arrow{display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;width:2em;height:2em;line-height:0;text-align:center;position:absolute;z-index:99;cursor:pointer;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;-webkit-appearance:inherit;border:none;-webkit-box-shadow:none;box-shadow:none}div[class^=premium-] .slick-arrow i{display:block}.ver-carousel-arrow.carousel-next i{margin-bottom:-3px}.premium-carousel-wrapper a.slick-arrow:hover{-webkit-box-shadow:none!important;box-shadow:none!important}.premium-carousel-wrapper .premium-carousel-content-hidden{visibility:hidden}.premium-carousel-wrapper a.carousel-arrow{top:50%}.premium-blog-wrap a.carousel-arrow,.premium-fb-rev-container a.carousel-arrow,.premium-hscroll-wrap a.carousel-arrow,.premium-persons-container a.carousel-arrow,.premium-twitter-feed-wrapper a.carousel-arrow{top:50%}.premium-carousel-wrapper a.ver-carousel-arrow{left:50%}a.carousel-arrow.carousel-next{right:-20px}a.carousel-arrow.carousel-prev{left:-20px}a.ver-carousel-arrow.carousel-next{bottom:-56px}a.ver-carousel-arrow.carousel-prev{top:-45px}a.circle-bg{-webkit-border-radius:100%;border-radius:100%}a.circle-border{-webkit-border-radius:100%;border-radius:100%;border:solid #000}a.square-border{border:solid #000}.premium-blog-wrap ul.slick-dots,.premium-carousel-wrapper ul.slick-dots{list-style:none;text-align:center;margin:0;padding:0}.premium-carousel-dots-above ul.slick-dots{position:absolute;display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex;width:auto;top:50%;bottom:auto;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);-webkit-flex-direction:column;-webkit-box-orient:vertical;-webkit-box-direction:normal;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column}ul.slick-dots li{font-size:10px;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;-js-display:inline-flex;display:-moz-inline-box;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;margin:5px;width:20px;height:20px;cursor:pointer}@-webkit-keyframes hvr-ripple-out{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(1.5);transform:scale(1.5);opacity:0}}@keyframes hvr-ripple-out{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(1.5);transform:scale(1.5);opacity:0}}.premium-carousel-ripple-yes .premium-carousel-wrapper{padding-bottom:1px}.premium-carousel-ripple-yes ul.slick-dots li{position:relative}.premium-carousel-ripple-yes ul.slick-dots li i{position:relative;z-index:1}.premium-carousel-ripple-yes ul.slick-dots li:hover:before{content:"";position:absolute;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);top:0;right:0;bottom:0;left:0;-webkit-border-radius:50%;border-radius:50%;pointer-events:none;background-color:rgba(0,0,0,.15)}.premium-carousel-ripple-yes ul.slick-dots li.slick-active:hover:before{background-color:rgba(0,0,0,.3)}.premium-carousel-ripple-yes ul.slick-dots li:hover:before{-webkit-animation:hvr-ripple-out 1.3s infinite;animation:hvr-ripple-out 1.3s infinite}.premium-carousel-wrapper.premium-carousel-scale .slick-slide{-webkit-transform:scale(1.25,1.25);-ms-transform:scale(1.25,1.25);transform:scale(1.25,1.25);-webkit-transition:all .3s ease-in-out!important;transition:all .3s ease-in-out!important}.premium-carousel-wrapper.premium-carousel-scale div.slick-active{-webkit-transform:scale(1,1);-ms-transform:scale(1,1);transform:scale(1,1)}[dir=rtl] .premium-carousel-inner .slick-slide{float:right}.premium-counter-area{padding:10px 0;-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center}.premium-counter-area.top{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.premium-counter-area.right{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-webkit-flex-direction:row-reverse;-moz-box-orient:horizontal;-moz-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.premium-counter-area.right .premium-counter-icon{padding-left:20px}.premium-counter-area.left .premium-counter-icon{padding-right:20px}.premium-counter-area .premium-counter-icon .icon i.fa:before{vertical-align:text-top}.premium-counter-area .premium-counter-icon span.icon{text-align:center;display:inline-block;vertical-align:middle}.premium-counter-area .premium-counter-icon .circle{-webkit-border-radius:100%;border-radius:100%}.premium-counter-area .premium-counter-icon img,.premium-counter-area .premium-counter-icon svg{width:80px}.premium-counter-area .premium-counter-icon .premium-counter-animation svg{height:80px}.premium-counter-area .premium-counter-title{padding:0;margin:0}.premium-counter-area .premium-counter-value-wrap{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center}.premium-init-wrapper.right{text-align:right}span.icon.flex-width{width:auto!important;height:auto!important}.premium-counter-area .premium-counter-init{font-size:35px}.premium-image-separator-container{position:absolute;width:100%;z-index:2;top:auto;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-image-separator-container .premium-image-separator-link{position:absolute;z-index:9999;top:0;left:0;width:100%;height:100%;text-decoration:none}.premium-image-separator-container .premium-image-separator-link:active,.premium-image-separator-container .premium-image-separator-link:focus,.premium-image-separator-container .premium-image-separator-link:hover,.premium-image-separator-container .premium-image-separator-link:visited{-webkit-box-shadow:none!important;box-shadow:none!important;outline:0!important;border:none!important;text-decoration:none!important}.premium-image-separator-container i{padding:.1em;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-modal-box-modal-lower-close,.premium-modal-trigger-btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent}.premium-modal-trigger-btn i{-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-btn-md{padding:8px 14px;font-size:16px;line-height:1.2}.premium-btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333}.premium-btn-block{display:block;width:100%}.premium-modal-box-modal-close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000}.premium-modal-box-modal-close:focus,.premium-modal-box-modal-close:hover{color:#000;text-decoration:none;cursor:pointer}button.premium-modal-box-modal-close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.premium-modal-box-modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;-webkit-overflow-scrolling:touch;outline:0;padding:0!important;background:rgba(0,0,0,.5)}.premium-modal-box-modal .premium-modal-box-modal-dialog{position:absolute;top:0;left:50%;-webkit-transform:translate(-50%,-50%)!important;-ms-transform:translate(-50%,-50%)!important;transform:translate(-50%,-50%)!important;margin:0;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-modal-box-modal-content{overflow:hidden;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);-webkit-border-radius:6px;border-radius:6px;outline:0}.premium-modal-backdrop.premium-in{opacity:.5!important}.premium-modal-fade.premium-in{opacity:1}.premium-modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.premium-modal-backdrop.premium-modal-fade{opacity:0}.premium-modal-fade{opacity:0;-webkit-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out}.premium-modal-box-modal.premium-in .premium-modal-box-modal-dialog{-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;top:50%}.premium-modal-box-modal-header{display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-moz-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;padding:5px 15px;border-bottom:1px solid #e5e5e5}.premium-modal-box-modal-header .premium-modal-box-modal-close{margin-top:-2px}.premium-modal-box-modal-header .premium-modal-box-modal-title{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;margin:0;padding:0}.premium-modal-box-modal-header .premium-modal-box-modal-title svg{width:50px;height:60px}.premium-modal-box-modal-body{position:relative;padding:15px}.premium-modal-box-modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.premium-modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.premium-modal-trigger-text{background:0 0!important}.premium-modal-box-container{width:100%!important}.premium-modal-trigger-container .premium-modal-trigger-btn{border:none;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-modal-trigger-container .premium-modal-trigger-animation,.premium-modal-trigger-container .premium-modal-trigger-img,.premium-modal-trigger-container .premium-modal-trigger-text{cursor:pointer}.premium-modal-trigger-container .premium-modal-trigger-animation{display:inline-block;width:200px;height:200px;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-modal-box-modal-header img{width:48px;padding-right:5px}.premium-modal-box-modal-header i,.premium-modal-box-modal-header svg{padding-right:6px}.premium-modal-box-modal-close{position:relative;z-index:99}.premium-modal-box-close-button-container,.premium-modal-box-modal-close,.premium-modal-box-modal-lower-close,.premium-modal-trigger-img,.premium-modal-trigger-text{-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}@media (min-width:768px){.premium-modal-box-modal-dialog{width:700px;max-height:600px;overflow:auto}}@media (max-width:767px){.premium-modal-box-modal-dialog{width:100%;max-height:500px;overflow:auto}}.premium-progressbar-container{position:relative}.premium-progressbar-bar-wrap{position:relative;text-align:left;overflow:hidden;height:25px;margin-bottom:50px;background-color:#f5f5f5;-webkit-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.premium-progressbar-bar-wrap.premium-progressbar-dots{background-color:transparent;width:100%;-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;height:auto;-webkit-box-shadow:none;box-shadow:none}.premium-progressbar-bar-wrap .progress-segment{position:relative;width:25px;height:25px;-webkit-border-radius:50%;border-radius:50%;overflow:hidden;background-color:#f5f5f5}.premium-progressbar-bar-wrap .progress-segment.filled{background:#6ec1e4}.premium-progressbar-bar-wrap .progress-segment:not(:first-child):not(:last-child){margin:0 4px}.premium-progressbar-bar-wrap .progress-segment:first-child{margin-right:4px}.premium-progressbar-bar-wrap .progress-segment:last-child{margin-left:4px}.premium-progressbar-bar-wrap .progress-segment .segment-inner{position:absolute;top:0;left:0;height:100%;background-color:#6ec1e4}.premium-progressbar-bar{float:left;width:0%;height:100%;font-size:12px;line-height:20px;background:#6ec1e4;text-align:center;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15)}.premium-progressbar-striped .premium-progressbar-bar{background-image:-webkit-linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-webkit-linear-gradient(135deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.premium-progressbar-active .premium-progressbar-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.premium-progressbar-gradient .premium-progressbar-bar{-webkit-background-size:400% 400%!important;background-size:400% 400%!important;-webkit-animation:progress-bar-gradient 10s ease-in-out infinite;animation:progress-bar-gradient 10s ease-in-out infinite}.premium-progressbar-bar{position:absolute;overflow:hidden;line-height:20px}.premium-progressbar-container .clearfix{clear:both}.premium-progressbar-bar{-webkit-transition:width 0s ease-in-out!important;transition:width 0s ease-in-out!important}.premium-progressbar-container p:first-of-type{margin:0;float:left}.premium-progressbar-container p:nth-of-type(2){margin:0;float:right}.premium-progressbar-name{left:50%;top:0;right:0;-webkit-transform:translateX(-12.5px);-ms-transform:translateX(-12.5px);transform:translateX(-12.5px);z-index:1}.premium-progressbar-multiple-label{position:relative;float:left;width:0;left:50%}.premium-progressbar-center-label{position:relative;white-space:nowrap}.premium-progressbar-arrow{left:50%;display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-top:11px solid;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%)}.premium-progressbar-pin{border-left:1px solid;height:12px;left:50%;display:inline-block}.premium-progressbar-circle-wrap{width:200px;height:200px;position:relative;margin:0 auto}.premium-progressbar-circle-wrap .premium-progressbar-circle{position:absolute;top:0;left:0;width:100%;height:100%;-webkit-clip-path:inset(0 0 0 50%);clip-path:inset(0 0 0 50%)}.premium-progressbar-circle-wrap .premium-progressbar-circle div{position:absolute;left:0;top:0;height:100%;width:100%;border-width:6px;border-style:solid;border-color:#54595f;-webkit-border-radius:50%;border-radius:50%;-webkit-clip-path:inset(0 50% 0 0);clip-path:inset(0 50% 0 0)}.premium-progressbar-circle-wrap .premium-progressbar-circle .premium-progressbar-circle-left{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0)}.premium-progressbar-circle-wrap .premium-progressbar-circle .premium-progressbar-circle-right{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);visibility:hidden}.premium-progressbar-circle-wrap .premium-progressbar-circle-base{width:100%;height:100%;border:6px solid #eee;-webkit-border-radius:50%;border-radius:50%}.premium-progressbar-circle-wrap .premium-progressbar-circle-content{position:absolute;top:0;left:0;width:100%;height:100%;-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center}.premium-progressbar-circle-wrap .premium-lottie-animation{line-height:1}@-webkit-keyframes progress-bar-stripes{from{background-position:0 0}to{background-position:40px 0}}@keyframes progress-bar-stripes{from{background-position:0 0}to{background-position:40px 0}}@-webkit-keyframes progress-bar-gradient{0%{background-position:0 50%}50%{background-position:100% 50%}100%{background-position:0 50%}}@keyframes progress-bar-gradient{0%{background-position:0 50%}50%{background-position:100% 50%}100%{background-position:0 50%}}.premium-testimonial-box{width:100%;background:0 0;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-testimonial-box .premium-testimonial-author-info{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center}.premium-testimonial-box .premium-testimonial-company-name,.premium-testimonial-box .premium-testimonial-person-name{font-weight:600;margin:0}.premium-testimonial-container{position:relative}.premium-testimonial-img-wrapper{margin-left:auto;margin-right:auto;overflow:hidden;border-style:solid!important}.premium-testimonial-img-wrapper.circle{-webkit-border-radius:50%;border-radius:50%}.premium-testimonial-img-wrapper.rounded{-webkit-border-radius:15px;border-radius:15px}.premium-testimonial-img-wrapper img{-o-object-fit:cover;object-fit:cover;width:100%;height:100%!important}.premium-testimonial-content-wrapper{position:relative;display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column;z-index:2;width:100%;padding:20px;text-align:center}.premium-testimonial-clear-float{clear:both}.premium-testimonial-lower-quote,.premium-testimonial-upper-quote{position:absolute;z-index:1}.premium-title-container{position:relative;width:100%;clear:both;overflow:hidden}.premium-title-container .premium-title-header{position:relative;margin:0;padding:10px}.premium-title-container .premium-title-header:not(.premium-title-style7){-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center}.premium-title-container .premium-title-header svg{width:40px;height:40px}.premium-title-container .premium-title-header img{width:40px;height:40px;-o-object-fit:cover;object-fit:cover}.premium-title-container .premium-title-header a{position:absolute;top:0;left:0;width:100%;height:100%}.premium-title-container .premium-lottie-animation{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}.premium-title-icon-row .premium-title-icon{margin-right:10px}.premium-title-icon-row-reverse .premium-title-icon{margin-left:10px}.premium-title-style3,.premium-title-style4{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}.premium-title-style1,.premium-title-style2,.premium-title-style5,.premium-title-style6{-js-display:inline-flex;display:-webkit-inline-box;display:-webkit-inline-flex;display:-moz-inline-box;display:-ms-inline-flexbox;display:inline-flex}.premium-title-style7{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;-js-display:inline-flex;display:-moz-inline-box;display:inline-flex;-webkit-flex-direction:column;-ms-flex-direction:column;-webkit-box-orient:vertical;-webkit-box-direction:normal;-moz-box-orient:vertical;-moz-box-direction:normal;flex-direction:column}.premium-title-style7 .premium-title-style7-inner{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center}.premium-title-style1{border-left:3px solid #6ec1e4}.premium-title-container.style2,.premium-title-container.style4,.premium-title-container.style5,.premium-title-container.style6{border-bottom:3px solid #6ec1e4}.premium-title-style6:before{position:absolute;left:50%;bottom:0;margin-left:-2px;content:"";border:3px solid transparent}.premium-title-style7-stripe-wrap{display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex}.premium-title-style7:before{display:none}.premium-video-box-container{position:relative;height:0}.pa-aspect-ratio-11 .premium-video-box-container{padding-bottom:100%}.pa-aspect-ratio-169 .premium-video-box-container{padding-bottom:56.25%}.pa-aspect-ratio-43 .premium-video-box-container{padding-bottom:75%}.pa-aspect-ratio-32 .premium-video-box-container{padding-bottom:66.6666%}.pa-aspect-ratio-219 .premium-video-box-container{padding-bottom:42.8571%}.premium-video-box-image-container{position:absolute;top:0;left:0;width:100%;height:100%;-webkit-background-size:cover;background-size:cover;background-position:50%;cursor:pointer}.premium-video-box-play-icon-container{position:absolute;z-index:2;cursor:pointer;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);background:rgba(252,252,252,.35)}.premium-video-box-description-container{position:absolute;z-index:2;padding:5px;text-align:center;cursor:pointer;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.premium-video-box-text{margin-bottom:0!important;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-video-box-play-icon{padding:15px;-webkit-transform:translateX(4%);-ms-transform:translateX(4%);transform:translateX(4%);-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-video-box-video-container{position:absolute;top:0;left:0;z-index:2;width:100%;height:100%;-webkit-transition:opacity .8s ease-in-out;transition:opacity .8s ease-in-out;overflow:hidden;cursor:pointer}.premium-video-box-container[data-overlay=true][data-type=self] .premium-video-box-video-container{opacity:0;visibility:hidden}.premium-video-box-video-container iframe{max-width:100%;width:100%;height:100%;margin:0;line-height:1;border:none}.premium-video-box-video-container video{max-width:100%;width:100%;height:100%;margin:0;line-height:1;border:none;background-color:#000;-o-object-fit:contain;object-fit:contain}.premium-video-box-container .premium-video-box-vimeo-wrap{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;position:absolute;top:0;left:0;z-index:3;margin:10px;margin-right:10px;-webkit-transition:opacity .2s ease-out;transition:opacity .2s ease-out;margin-right:4.6em}.premium-video-box-vimeo-wrap .premium-video-box-vimeo-portrait{width:60px;height:60px;background:rgba(23,35,34,.75);margin-right:1px;-webkit-box-flex:1;-webkit-flex:1 0 auto;-ms-flex:1 0 auto;-moz-box-flex:1;flex:1 0 auto;padding:0}.premium-video-box-vimeo-portrait img{width:50px;height:50px;margin:5px;padding:0;border:0;-webkit-border-radius:50%;border-radius:50%}.premium-video-box-vimeo-wrap .premium-video-box-vimeo-headers{font-size:10px}.premium-video-box-vimeo-wrap .premium-video-box-vimeo-title{max-width:100%;font-size:2em!important;font-weight:700;margin:0;padding:.1em .2em;background:rgba(23,35,34,.75);display:inline-block;text-transform:none;line-height:normal;letter-spacing:normal}.premium-video-box-vimeo-wrap .premium-video-box-vimeo-byline{font-size:1.2em!important;font-weight:400;color:#fff;margin-top:.1em;padding:.2em .5em;background:rgba(23,35,34,.75);text-transform:none;line-height:normal;letter-spacing:normal}.premium-blog-post-container{padding:15px}.premium-blog-thumb-effect-wrapper{position:relative;overflow:hidden}.premium-blog-thumbnail-container{overflow:hidden}.premium-blog-effect-container:not(.premium-blog-bordered-effect) .premium-blog-post-link{position:absolute;top:0;left:0;width:100%;height:100%;z-index:2;padding:20px}.premium-blog-bordered-effect .premium-blog-post-link{display:block;height:100%;position:relative}.premium-blog-post-container .premium-blog-post-link:focus,.premium-blog-post-container .premium-blog-post-link:hover{-webkit-box-shadow:none!important;box-shadow:none!important;border:none!important;outline:0!important}.premium-blog-thumbnail-container .below-entry-meta,.premium-blog-thumbnail-container img{width:100%;height:100%;margin:0!important;-webkit-transition:all .4s ease-in-out;transition:all .4s ease-in-out}.premium-blog-thumb-effect-wrapper .premium-blog-scale-effect img,.premium-blog-thumb-effect-wrapper .premium-blog-zoomout-effect img{-webkit-transform:scale(1.2);-ms-transform:scale(1.2);transform:scale(1.2)}.premium-blog-thumb-effect-wrapper .premium-blog-sepia-effect img{-webkit-filter:sepia(30%);filter:sepia(30%)}.premium-blog-thumb-effect-wrapper .premium-blog-bright-effect img{-webkit-filter:brightness(1);filter:brightness(1)}.premium-blog-thumb-effect-wrapper .premium-blog-trans-effect img{-webkit-transform:translateX(-15px) scale(1.1);-ms-transform:translateX(-15px) scale(1.1);transform:translateX(-15px) scale(1.1)}.premium-blog-thumb-effect-wrapper:hover .premium-blog-zoomin-effect img{-webkit-transform:scale(1.2);-ms-transform:scale(1.2);transform:scale(1.2)}.premium-blog-thumb-effect-wrapper:hover .premium-blog-zoomout-effect img{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.premium-blog-thumb-effect-wrapper:hover .premium-blog-scale-effect img{-webkit-transform:scale(1.3) rotate(5deg);-ms-transform:scale(1.3) rotate(5deg);transform:scale(1.3) rotate(5deg)}.premium-blog-thumb-effect-wrapper:hover .premium-blog-gray-effect img{-webkit-filter:grayscale(100%);filter:grayscale(100%)}.premium-blog-thumb-effect-wrapper:hover .premium-blog-blur-effect img{-webkit-filter:blur(3px);filter:blur(3px)}.premium-blog-thumb-effect-wrapper:hover .premium-blog-sepia-effect img{-webkit-filter:sepia(0);filter:sepia(0)}.premium-blog-thumb-effect-wrapper:hover .premium-blog-bright-effect img{-webkit-filter:brightness(1.2);filter:brightness(1.2)}.premium-blog-thumb-effect-wrapper:hover .premium-blog-trans-effect img{-webkit-transform:translateX(0) scale(1.1);-ms-transform:translateX(0) scale(1.1);transform:translateX(0) scale(1.1)}.premium-blog-post-container:not(.premium-blog-skin-classic) .premium-blog-thumbnail-container:after,.premium-blog-post-container:not(.premium-blog-skin-classic) .premium-blog-thumbnail-container:before{position:absolute;content:"";z-index:1;top:50%;left:50%;opacity:0;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);-webkit-transition:all .4s linear 0s;transition:all .4s linear 0s;height:1px;width:100%;background-color:#fff}.premium-blog-post-container:not(.premium-blog-skin-classic) .premium-blog-thumbnail-container:before{width:1px;height:100%}.premium-blog-post-container:not(.premium-blog-skin-classic) .premium-blog-thumb-effect-wrapper:hover .premium-blog-thumbnail-container:after{width:20px;opacity:1}.premium-blog-post-container:not(.premium-blog-skin-classic) .premium-blog-thumb-effect-wrapper:hover .premium-blog-thumbnail-container:before{height:20px;opacity:1}.premium-blog-diagonal-container{position:absolute;top:0;left:0;width:100%;height:100%}.premium-blog-diagonal-effect:before{position:absolute;top:0;left:0;width:100%;height:100%;content:" ";z-index:1;background:rgba(255,255,255,.2);-webkit-transform:scale3d(1.9,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0);-ms-transform:scale3d(1.9,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0);transform:scale3d(1.9,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0);-webkit-transition:all .3s linear 0s;transition:all .3s linear 0s}.premium-blog-thumb-effect-wrapper:hover .premium-blog-diagonal-effect:before{-webkit-transform:scale3d(1.9,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,150%,0);-ms-transform:scale3d(1.9,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,150%,0);transform:scale3d(1.9,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,150%,0)}.premium-blog-framed-effect{position:absolute;width:-webkit-calc(100% - 30px);width:calc(100% - 30px);height:-webkit-calc(100% - 30px);height:calc(100% - 30px);top:15px;left:15px;opacity:0;-webkit-transform:scale(.3);-ms-transform:scale(.3);transform:scale(.3);-webkit-transition:all .3s linear 0s;transition:all .3s linear 0s}.premium-blog-thumb-effect-wrapper:hover .premium-blog-framed-effect{opacity:.99;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-blog-bordered-effect{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;padding:15px;-webkit-transition:all .3s linear 0s;transition:all .3s linear 0s}.premium-blog-bordered-effect .premium-blog-post-link:after,.premium-blog-bordered-effect .premium-blog-post-link:before{content:"";display:block;position:absolute;top:0;left:0;width:100%;height:100%;-webkit-transition:all .5s linear 0s;transition:all .5s linear 0s;-webkit-transition-delay:0s;transition-delay:0s;border-color:rgba(255,255,255,.45)}.premium-blog-bordered-effect .premium-blog-post-link:before{border-right:2px solid;border-left:2px solid;-webkit-transform:scale(1,0);-ms-transform:scale(1,0);transform:scale(1,0);-webkit-transform-origin:100% 0;-ms-transform-origin:100% 0;transform-origin:100% 0}.premium-blog-bordered-effect .premium-blog-post-link:after{border-top:2px solid;border-bottom:2px solid;-webkit-transform:scale(0,1);-ms-transform:scale(0,1);transform:scale(0,1);-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}.premium-blog-thumb-effect-wrapper:hover .premium-blog-bordered-effect{opacity:.99}.premium-blog-thumb-effect-wrapper:hover .premium-blog-bordered-effect .premium-blog-post-link:after,.premium-blog-thumb-effect-wrapper:hover .premium-blog-bordered-effect .premium-blog-post-link:before{-webkit-transition-delay:.15s;transition-delay:.15s;opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-blog-squares-effect,.premium-blog-squares-square-container{position:absolute;top:0;left:0;width:100%;height:100%}.premium-blog-squares-effect:after,.premium-blog-squares-effect:before{position:absolute;content:"";top:0;left:0;width:50%;height:50%;-webkit-transform:translate(-100%,-100%);-ms-transform:translate(-100%,-100%);transform:translate(-100%,-100%);opacity:.7;-webkit-transition:all .3s linear 0s;transition:all .3s linear 0s}.premium-blog-squares-square-container:after,.premium-blog-squares-square-container:before{position:absolute;content:"";top:0;left:0;width:50%;height:50%;-webkit-transform:translate(-100%,-100%);-ms-transform:translate(-100%,-100%);transform:translate(-100%,-100%);opacity:.7;-webkit-transition:all .3s linear 0s;transition:all .3s linear 0s}.premium-blog-squares-square-container:after,.premium-blog-squares-square-container:before{opacity:.8}.premium-blog-squares-effect:after{-webkit-transform:translate(200%,200%);-ms-transform:translate(200%,200%);transform:translate(200%,200%)}.premium-blog-squares-square-container:before{-webkit-transform:translate(-100%,200%);-ms-transform:translate(-100%,200%);transform:translate(-100%,200%)}.premium-blog-squares-square-container:after{-webkit-transform:translate(200%,-100%);-ms-transform:translate(200%,-100%);transform:translate(200%,-100%)}.premium-blog-thumb-effect-wrapper:hover .premium-blog-squares-effect:before{-webkit-transform:translate(0,0) scaleY(1.003) scaleX(1.003);-ms-transform:translate(0,0) scaleY(1.003) scaleX(1.003);transform:translate(0,0) scaleY(1.003) scaleX(1.003)}.premium-blog-thumb-effect-wrapper:hover .premium-blog-squares-effect:after{-webkit-transform:translate(100%,100%) scaleY(1.003) scaleX(1.003);-ms-transform:translate(100%,100%) scaleY(1.003) scaleX(1.003);transform:translate(100%,100%) scaleY(1.003) scaleX(1.003)}.premium-blog-thumb-effect-wrapper:hover .premium-blog-squares-square-container:before{-webkit-transform:translate(0,100%);-ms-transform:translate(0,100%);transform:translate(0,100%)}.premium-blog-thumb-effect-wrapper:hover .premium-blog-squares-square-container:after{-webkit-transform:translate(100%,0);-ms-transform:translate(100%,0);transform:translate(100%,0)}.premium-blog-post-container:not(.premium-blog-skin-classic) .premium-blog-content-wrapper{margin:0 10px 20px;clear:both}.premium-blog-post-container .premium-blog-content-wrapper{padding:30px}.premium-blog-skin-classic .premium-blog-thumbnail-overlay{position:absolute;top:0;left:0;display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex;-webkit-justify-content:center;-webkit-box-pack:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-ms-flex-align:center;-moz-box-align:center;align-items:center;width:100%;height:100%;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;opacity:0}.premium-blog-skin-classic .premium-blog-thumbnail-overlay a{-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-transition:all .5s ease-in-out 0s;transition:all .5s ease-in-out 0s}.premium-blog-thumb-effect-wrapper:hover .premium-blog-thumbnail-overlay{opacity:1}.premium-blog-thumb-effect-wrapper:hover .premium-blog-thumbnail-overlay a{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-blog-skin-modern .premium-blog-content-wrapper{position:relative;z-index:3;top:-50px}.premium-blog-content-wrapper.empty-thumb{top:0}.premium-blog-clear-fix{clear:both}.premium-blog-content-wrapper .premium-blog-inner-container{display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex}.premium-blog-format-container{display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;background:#eee;width:55px;height:55px;font-size:25px;margin-right:20px;text-align:center;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-blog-format-link{line-height:0}.premium-blog-format-container i{-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-blog-post-container .premium-blog-entry-title{font-size:18px;margin-bottom:0}.premium-blog-entry-meta{margin-bottom:8px}.premium-blog-entry-meta i{margin-right:3px;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-blog-post-tags-container a{-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-blog-meta-data .premium-blog-meta-separator{margin:0 5px}.premium-blog-meta-data a,.premium-blog-meta-data span{-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-blog-post-content{padding:14px 0}.premium-blog-skin-modern .premium-blog-post-content{border-top:1px solid #eaeaea}.premium-blog-post-container.cards .premium-blog-post-content{border-bottom:1px solid #eaeaea}.premium-blog-post-container.cards .premium-blog-entry-meta{padding-top:14px}.premium-blog-author-thumbnail{position:relative;padding:0 30px;width:100%;top:-10px;height:0;pointer-events:none}.premium-blog-author-thumbnail img{-webkit-border-radius:50%;border-radius:50%;width:60px;pointer-events:all;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%)}.premium-blog-post-content{margin-top:0;margin-left:75px}.premium-blog-post-tags-container{margin-top:8px;margin-left:75px}.premium-blog-entry-title a,.premium-blog-post-content .premium-blog-excerpt-link,.premium-blog-post-tags a{-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-blog-cta-full-yes .premium-blog-excerpt-link{width:100%}.premium-blog-pagination-container{padding:15px;margin-top:-30px;text-align:right}.premium-blog-pagination-container ul.page-numbers{display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex;list-style-type:none;margin:0;margin-top:10px;padding:0;border:none;-webkit-justify-content:center;-moz-justify-content:center;-ms-justify-content:center;-webkit-box-pack:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center}.premium-blog-pagination-container li{margin:0 .4em .4em 0;padding:0;text-align:center}.premium-blog-pagination-container li span{cursor:default}.premium-blog-pagination-container li .page-numbers{margin:0;text-decoration:none;color:#000;padding:0;line-height:1;font-size:1em;font-weight:400;padding:.75em;display:block;min-width:2.5em;-webkit-transition:all .2s ease-in-out;-mos-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.premium-blog-wrap{display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.premium-blog-wrap.premium-blog-col-3 .premium-blog-entry-meta,.premium-blog-wrap.premium-blog-col-3 .premium-blog-post-content,.premium-blog-wrap.premium-blog-col-3 .premium-blog-post-tags-container{margin-left:0}.premium-blog-wrap.premium-blog-col-4 .premium-blog-entry-meta,.premium-blog-wrap.premium-blog-col-4 .premium-blog-post-content,.premium-blog-wrap.premium-blog-col-4 .premium-blog-post-tags-container{margin-left:0}.premium-blog-wrap.premium-blog-col-3 .premium-blog-format-container,.premium-blog-wrap.premium-blog-col-4 .premium-blog-format-container{display:none}.premium-blog-wrap ul.slick-dots{width:100%}.premium-blog-even .premium-blog-post-container{height:100%}@media (max-width:768px){.premium-blog-content-wrapper{top:0;margin:0;padding:15px}.premium-blog-thumb-effect-wrapper{margin-bottom:15px}.premium-blog-format-container{display:none}.premium-blog-entry-meta,.premium-blog-post-content,.premium-blog-post-tags-container{margin-left:0}}.premium-person-container{position:relative}.premium-person-image-container{position:relative;text-align:center}.premium-person-image-container .premium-person-image-wrap{overflow:hidden}.premium-person-scale-effect .premium-person-image-container img,.premium-person-zoomout-effect .premium-person-image-container img{-webkit-transform:scale(1.2);-ms-transform:scale(1.2);transform:scale(1.2)}.premium-person-sepia-effect .premium-person-image-container img{-webkit-filter:sepia(30%);filter:sepia(30%)}.premium-person-bright-effect .premium-person-image-container img{-webkit-filter:brightness(1);filter:brightness(1)}.premium-person-trans-effect .premium-person-image-container img{-webkit-transform:translateX(-15px) scale(1.1);-ms-transform:translateX(-15px) scale(1.1);transform:translateX(-15px) scale(1.1)}.premium-person-zoomin-effect:hover .premium-person-image-container img{-webkit-transform:scale(1.2);-ms-transform:scale(1.2);transform:scale(1.2)}.premium-person-zoomout-effect:hover .premium-person-image-container img{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.premium-person-scale-effect:hover .premium-person-image-container img{-webkit-transform:scale(1.3) rotate(5deg);-ms-transform:scale(1.3) rotate(5deg);transform:scale(1.3) rotate(5deg)}.premium-person-grayscale-effect:hover .premium-person-image-container img{-webkit-filter:grayscale(100%);-moz-filter:grayscale(100%);-ms-filter:grayscale(100%);-o-filter:grayscale(100%);filter:grayscale(100%)}.premium-person-blur-effect:hover .premium-person-image-container img{-webkit-filter:blur(3px);-moz-filter:blur(3px);-ms-filter:blur(3px);-o-filter:blur(3px);filter:blur(3px)}.premium-person-sepia-effect:hover .premium-person-image-container img{-webkit-filter:sepia(0);filter:sepia(0)}.premium-person-bright-effect:hover .premium-person-image-container img{-webkit-filter:brightness(1.2);filter:brightness(1.2)}.premium-person-trans-effect:hover .premium-person-image-container img{-webkit-transform:translateX(0) scale(1.1);-ms-transform:translateX(0) scale(1.1);transform:translateX(0) scale(1.1)}.premium-person-container .premium-person-image-container img{width:100%;height:100%;-o-object-fit:cover;object-fit:cover;-webkit-transition:all .5s ease-in-out;transition:all .5s ease-in-out}.premium-person-style2 .premium-person-social{position:absolute;top:0;left:0;width:100%;height:100%;z-index:2;display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex;-webkit-justify-content:center;-webkit-box-pack:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-ms-flex-align:center;-moz-box-align:center;align-items:center;box-shadow:inset 0 0 120px 0 rgba(0,0,0,.5);-webkit-box-shadow:inset 0 0 120px 0 rgba(0,0,0,.5);-moz-box-shadow:inset 0 0 120px 0 rgba(0,0,0,.5);-ms-box-shadow:inset 0 0 120px 0 rgba(0,0,0,.5);-o-box-shadow:inset 0 0 120px 0 rgba(0,0,0,.5);-webkit-transition:all .5s linear 0s;transition:all .5s linear 0s;opacity:0}.premium-person-style2 .premium-person-image-container:hover .premium-person-social{opacity:1}.premium-person-list-item a{display:inline-block}.premium-person-style2 .premium-person-list-item a{opacity:0;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-transition:all .5s ease-in-out 0s;transition:all .5s ease-in-out 0s}.premium-person-style2 .premium-person-image-container:hover .premium-person-list-item a{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-person-info-container{padding:30px 15px}.premium-person-name{margin:0 0 5px;font-weight:700}.premium-person-title{margin:0 0 20px;padding:0}.premium-person-content{margin:0 0 30px}ul.premium-person-social-list{margin:0!important;padding:0}.premium-person-social-list .premium-person-list-item{display:inline;list-style:none}.premium-person-social-list li{position:relative;bottom:0;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.premium-person-social-list li i{position:relative;bottom:0;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.premium-person-defaults-yes li.premium-person-facebook:hover a{background-color:#3b5998!important}.premium-person-defaults-yes li.premium-person-twitter:hover a{background-color:#55acee!important}.premium-person-defaults-yes li.premium-person-linkedin:hover a{background-color:#0077b5!important}.premium-person-defaults-yes li.premium-person-google:hover a{background-color:#dc4e41!important}.premium-person-defaults-yes li.premium-person-youtube:hover a{background-color:#b31217!important}.premium-person-defaults-yes li.premium-person-instagram:hover a{background-color:#e4405f!important}.premium-person-defaults-yes li.premium-person-skype:hover a{background-color:#00aff0!important}.premium-person-defaults-yes li.premium-person-pinterest:hover a{background-color:#bd081c!important}.premium-person-defaults-yes li.premium-person-dribbble:hover a{background-color:#ea4c89!important}.premium-person-defaults-yes li.premium-person-mail:hover a{background-color:#b23121!important}.premium-person-defaults-yes li.premium-person-behance:hover a{background-color:#1769ff!important}.premium-person-defaults-yes li.premium-person-whatsapp:hover a{background-color:#25d366!important}.premium-person-defaults-yes li.premium-person-telegram:hover a{background-color:#08c!important}.premium-person-defaults-yes li.premium-person-site:hover a{background-color:#0055a5!important}.premium-person-social-list li:hover a{-webkit-box-shadow:none;box-shadow:none}.premium-person-social-list li a:focus{-webkit-box-shadow:none;box-shadow:none;outline:0}.premium-person-social-list li i{font-size:18px}.elementor-widget-premium-addon-person .elementor-widget-container{display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center}.premium-persons-container.multiple-persons{display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;width:100%}.premium-person-style1 .premium-person-container{overflow:hidden}.premium-person-style1 .premium-person-container .premium-person-info{position:absolute;top:auto;right:0;left:0;-webkit-transition:all .5s ease 0s;transition:all .5s ease 0s;-webkit-transform:translate3d(0,100%,0);-ms-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}.premium-person-style1 .premium-person-container:hover .premium-person-info{-webkit-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);transform:translate3d(0,0,0);bottom:-1px!important}.premium-person-style1 .premium-person-social-list li:hover{bottom:5px}.premium-person-style1.multiple-persons:not([data-persons-equal=yes]){-webkit-align-items:flex-start;-ms-flex-align:flex-start;-webkit-box-align:start;-moz-box-align:start;align-items:flex-start}.premium-person-style1 .slick-track{display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex}.premium-person-style1 .slick-slide{height:inherit!important}.premium-person-style1.multiple-persons[data-persons-equal=yes] .premium-person-image-container,.premium-person-style1.multiple-persons[data-persons-equal=yes] .premium-person-image-wrap{height:100%}.premium-person-style3 .premium-person-info-container{position:absolute;top:0;left:0;width:100%;height:100%;-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-webkit-justify-content:space-between;-moz-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.premium-person-style3 .premium-person-title-desc-wrap{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-webkit-flex-direction:row-reverse;-moz-box-orient:horizontal;-moz-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse;-webkit-box-pack:justify;-webkit-justify-content:space-between;-moz-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:start;-webkit-align-items:flex-start;-moz-box-align:start;-ms-flex-align:start;align-items:flex-start}.premium-person-style3 .premium-person-name-icons-wrap{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-moz-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:end;-webkit-align-items:flex-end;-moz-box-align:end;-ms-flex-align:end;align-items:flex-end}.premium-person-style3 .premium-person-title{opacity:0;-webkit-transition:all .3s ease;transition:all .3s ease;-webkit-transform:translateX(15px);-ms-transform:translateX(15px);transform:translateX(15px)}.premium-person-style3 .premium-person-title span{display:inline-block;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);-webkit-transform-origin:bottom;-ms-transform-origin:bottom;transform-origin:bottom}.premium-person-style3 .premium-person-name{padding-left:10px}.premium-person-style3 .premium-person-social-list{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-transform:translateY(20px);-ms-transform:translateY(20px);transform:translateY(20px);opacity:0;-webkit-transition:all .3s ease;transition:all .3s ease}.premium-person-style3 .premium-person-list-item{line-height:0}.premium-person-style3 .premium-person-list-item a{padding:5px 10px 0 0;margin:5px 0}.premium-person-style3 .premium-person-container:hover .premium-person-title{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}.premium-person-style3 .premium-person-container:hover .premium-person-social-list{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}.premium-dual-header-container .premium-dual-header-first-header,.premium-dual-header-container .premium-dual-header-second-header{position:relative;padding:0;margin:0;display:inline-block;-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0)}.premium-dual-header-first-clip .premium-dual-header-first-span,.premium-dual-header-second-clip{-webkit-text-fill-color:transparent;-webkit-background-clip:text;background-clip:text}.premium-dual-header-first-clip.stroke .premium-dual-header-first-span,.premium-dual-header-second-clip.stroke{-webkit-text-stroke-color:transparent;-webkit-text-fill-color:#fafafa;-webkit-text-stroke-width:2px}@media (max-width:500px){.premium-dual-header-container .premium-dual-header-first-header,.premium-dual-header-container .premium-dual-header-second-header{display:block;word-wrap:break-word}.premium-dual-header-first-container,.premium-dual-header-second-container{margin:0}}@media (min-width:501px){.premium-dual-header-first-container{margin-right:5px}}.premium-dual-header-first-header.gradient .premium-dual-header-first-span,.premium-dual-header-second-header.gradient{-webkit-background-size:300% 300%!important;background-size:300% 300%!important;-webkit-animation:Gradient 10s ease-in-out infinite;animation:Gradient 10s ease-in-out infinite}@-webkit-keyframes Gradient{0%{background-position:0 50%}50%{background-position:100% 50%}100%{background-position:0 50%}}@keyframes Gradient{0%{background-position:0 50%}50%{background-position:100% 50%}100%{background-position:0 50%}}.premium-fancy-text,.premium-prefix-text,.premium-suffix-text{font-size:40px}.premium-fancy-text-wrapper .premium-fancy-list-items{list-style:none}.premium-fancy-text-wrapper .premium-fancy-text-span-align{vertical-align:top}.premium-fancy-text-wrapper:not(.typing):not(.slide) .premium-fancy-text-items-wrapper{margin:0;padding:0;border:none;position:relative}.premium-fancy-text-wrapper:not(.typing):not(.slide) .premium-fancy-list-items{position:absolute;top:0;left:0;display:inline-block}.premium-fancy-text-wrapper.zoomout .premium-fancy-item-hidden{opacity:0;-webkit-animation:pa-zoom-out .8s;animation:pa-zoom-out .8s}.premium-fancy-text-wrapper.zoomout .premium-fancy-item-visible{position:relative!important;-webkit-animation:pa-zoom-in .8s;animation:pa-zoom-in .8s}.premium-fancy-text-wrapper.zoomout .premium-fancy-text-items-wrapper{-webkit-perspective:300px;perspective:300px}.premium-fancy-text-wrapper.rotate .premium-fancy-list-items{-webkit-transform-origin:50% 100%;-ms-transform-origin:50% 100%;transform-origin:50% 100%}.premium-fancy-text-wrapper.rotate .premium-fancy-item-hidden{opacity:0;-webkit-transform:rotateX(180deg);-ms-transform:rotateX(180deg);transform:rotateX(180deg);-webkit-animation:pa-rotate-out 1.2s;animation:pa-rotate-out 1.2s}.premium-fancy-text-wrapper.rotate .premium-fancy-item-visible{position:relative!important;-webkit-transform:rotateX(0);-ms-transform:rotateX(0);transform:rotateX(0);-webkit-animation:pa-rotate-in 1.2s;animation:pa-rotate-in 1.2s}.premium-fancy-text-wrapper.bar .premium-fancy-text-items-wrapper::after{position:absolute;content:"";left:0;bottom:0;width:0;height:3px;background:#000}.premium-fancy-text-wrapper.bar .premium-fancy-text-items-wrapper.active::after{width:100%;-webkit-transition:width 3s ease-in-out;transition:width 3s ease-in-out}.premium-fancy-text-wrapper.bar .premium-fancy-list-items{opacity:0}.premium-fancy-text-wrapper.bar .premium-fancy-item-visible{opacity:1;-webkit-transition:opacity 2s ease-in-out;transition:opacity 2s ease-in-out;position:relative!important}@-webkit-keyframes pa-zoom-in{0%{opacity:0;-webkit-transform:translateZ(100px);transform:translateZ(100px)}100%{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}}@keyframes pa-zoom-in{0%{opacity:0;-webkit-transform:translateZ(100px);transform:translateZ(100px)}100%{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}}@-webkit-keyframes pa-zoom-out{0%{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}100%{opacity:0;-webkit-transform:translateZ(-100px);transform:translateZ(-100px)}}@keyframes pa-zoom-out{0%{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}100%{opacity:0;-webkit-transform:translateZ(-100px);transform:translateZ(-100px)}}@-webkit-keyframes pa-rotate-in{0%{opacity:0;-webkit-transform:rotateX(180deg);transform:rotateX(180deg)}35%{opacity:0;-webkit-transform:rotateX(120deg);transform:rotateX(120deg)}65%{opacity:0}100%{opacity:1;-webkit-transform:rotateX(360deg);transform:rotateX(360deg)}}@keyframes pa-rotate-in{0%{opacity:0;-webkit-transform:rotateX(180deg);transform:rotateX(180deg)}35%{opacity:0;-webkit-transform:rotateX(120deg);transform:rotateX(120deg)}65%{opacity:0}100%{opacity:1;-webkit-transform:rotateX(360deg);transform:rotateX(360deg)}}@-webkit-keyframes pa-rotate-out{0%{opacity:1;-webkit-transform:rotateX(0);transform:rotateX(0)}35%{opacity:1;-webkit-transform:rotateX(-40deg);transform:rotateX(-40deg)}65%{opacity:0}100%{opacity:0;-webkit-transform:rotateX(180deg);transform:rotateX(180deg)}}@keyframes pa-rotate-out{0%{opacity:1;-webkit-transform:rotateX(0);transform:rotateX(0)}35%{opacity:1;-webkit-transform:rotateX(-40deg);transform:rotateX(-40deg)}65%{opacity:0}100%{opacity:0;-webkit-transform:rotateX(180deg);transform:rotateX(180deg)}}.premium-pricing-table-container{position:relative;overflow:hidden;text-align:center;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-pricing-icon-container{line-height:0}.premium-pricing-icon-container .premium-pricing-icon{display:inline-block}.premium-badge-left{position:absolute;top:0}.premium-badge-right{position:absolute;top:0;right:0}.premium-badge-left{left:0}.premium-badge-triangle.premium-badge-left .corner{width:0;height:0;border-top:150px solid;border-bottom:150px solid transparent;border-right:150px solid transparent}.premium-badge-triangle.premium-badge-right .corner{width:0;height:0;border-bottom:150px solid transparent;border-right:150px solid;border-left:150px solid transparent}.premium-badge-triangle span{position:absolute;top:35px;width:100px;text-align:center;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);display:block;text-transform:uppercase}.premium-badge-triangle.premium-badge-right span{-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);right:0}.premium-badge-circle{min-width:4em;min-height:4em;line-height:4em;text-align:center;-webkit-border-radius:100%;border-radius:100%;position:absolute;z-index:1}.premium-badge-stripe{position:absolute;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);width:15em;overflow:hidden;height:15em}.premium-badge-stripe.premium-badge-left{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0)}.premium-badge-stripe .corner{text-align:center;left:0;width:150%;-webkit-transform:translateY(-50%) translateX(-50%) translateX(35px) rotate(-45deg);-ms-transform:translateY(-50%) translateX(-50%) translateX(35px) rotate(-45deg);transform:translateY(-50%) translateX(-50%) translateX(35px) rotate(-45deg);margin-top:35px;font-size:13px;line-height:2;font-weight:800;text-transform:uppercase}.premium-badge-flag .corner{text-align:center;-webkit-border-radius:4px;border-radius:4px 4px 0 4px;padding:3px 15px;position:absolute;top:10%;right:-8px}.premium-badge-flag .corner::after,.premium-badge-flag .corner::before{content:"";display:block;position:absolute;width:0;height:0;top:100%;right:0;border-bottom:8px solid transparent}.elementor-widget-premium-addon-pricing-table .elementor-widget-container{overflow:visible!important}.premium-badge-flag .corner::after{border-left:8px solid rgba(0,0,0,.2)}.premium-pricing-price-currency{position:relative}.premium-pricing-button-container{display:block}.premium-pricing-list{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;-js-display:flex;display:-moz-box;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;-webkit-box-orient:vertical;-webkit-box-direction:normal;-moz-box-orient:vertical;-moz-box-direction:normal;flex-direction:column;list-style-type:none;margin:0}.premium-pricing-list .premium-pricing-list-item{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;-js-display:flex;display:-moz-box;display:flex;-webkit-align-items:center;-ms-flex-align:center;-webkit-box-align:center;-moz-box-align:center;align-items:center}.premium-pricing-list .premium-pricing-list-item svg{width:50px;height:50px}.premium-pricing-list .premium-pricing-list-span{position:relative}.premium-pricing-list .list-item-tooltip{border-bottom:1px dotted}.premium-pricing-list .premium-pricing-list-tooltip{position:absolute;top:-webkit-calc(100% + 1px);top:calc(100% + 1px);left:0;visibility:hidden;padding:15px 20px;-webkit-border-radius:5px;border-radius:5px;min-width:200px;overflow:hidden;text-align:left;font-size:.8rem;color:#fff;background-color:#aaa}.premium-pricing-list-span:hover .premium-pricing-list-tooltip{z-index:99;visibility:visible;opacity:1}.premium-pricing-slashed-price-value{display:inline-block;font-size:20px;font-weight:400;margin-right:5px}.premium-pricing-price-value{font-size:70px}.premium-pricing-description-container li{list-style-position:inside;text-indent:-40px}@-moz-document url-prefix(){.premium-pricing-description-container li{text-indent:0}}.premium-pricing-price-button{display:block;padding:6px 12px;line-height:1.42857143;text-align:center;color:#fff;background:#6ec1e4;margin-bottom:0;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-maps-info-container{margin-top:10px;margin-bottom:10px}.premium-maps-info-desc,.premium-maps-info-title{margin:0;padding:0}.premium-maps-container .gm-style-iw{text-align:center}.premium-maps-container .gm-style img{max-width:none!important}.premium-button{display:inline-block;position:relative;overflow:hidden;cursor:pointer;-webkit-transition:all .2s ease-in-out!important;transition:all .2s ease-in-out!important}.premium-button-sm{padding:12px 24px;font-size:14px;line-height:1}.premium-button .premium-lottie-animation,.premium-image-button .premium-lottie-animation{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}.premium-button .premium-lottie-animation svg,.premium-image-button .premium-lottie-animation svg{width:50px;height:50px}.premium-button-md{padding:14px 26px;font-size:16px;line-height:1.2}.premium-button-lg{padding:16px 28px;font-size:18px;line-height:1.3333}.premium-button-block{font-size:15px;line-height:1;padding:12px 24px;width:100%;text-align:center}.premium-button-text{display:inline-block;width:100%}.premium-button-style1-bottom,.premium-button-style1-left,.premium-button-style1-right,.premium-button-style1-top,.premium-button-style2-dshutinhor,.premium-button-style2-dshutinver,.premium-button-style2-scshutouthor,.premium-button-style2-scshutoutver,.premium-button-style2-shutinhor,.premium-button-style2-shutinver,.premium-button-style2-shutouthor,.premium-button-style2-shutoutver,.premium-button-style5-radialin,.premium-button-style5-radialout,.premium-button-style5-rectin,.premium-button-style5-rectout{display:inline-block;vertical-align:middle;-webkit-transform:perspective(1px) translateZ(0);transform:perspective(1px) translateZ(0);-webkit-box-shadow:0 0 1px transparent;box-shadow:0 0 1px transparent;position:relative;-webkit-transition-property:color;transition-property:color;-webkit-transition-duration:.15s;transition-duration:.15s}.premium-button-style1-bottom:before,.premium-button-style1-left:before,.premium-button-style1-right:before,.premium-button-style1-top:before,.premium-button-style2-dshutinhor:before,.premium-button-style2-dshutinver:before,.premium-button-style2-scshutouthor:before,.premium-button-style2-scshutoutver:before,.premium-button-style2-shutinhor:before,.premium-button-style2-shutinver:before,.premium-button-style2-shutouthor:before,.premium-button-style2-shutoutver:before,.premium-button-style5-radialin:before,.premium-button-style5-radialout:before,.premium-button-style5-rectin:before,.premium-button-style5-rectout:before{content:"";position:absolute;z-index:-1;top:0;left:0;right:0;bottom:0;-webkit-transform:scaleY(0);-ms-transform:scaleY(0);transform:scaleY(0);-webkit-transform-origin:50% 0;-ms-transform-origin:50% 0;transform-origin:50% 0;-webkit-transition-property:transform;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-transition-duration:.15s;transition-duration:.15s;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out}.premium-button-style5-radialin:before,.premium-button-style5-radialout:before{-webkit-transform-origin:50%;-ms-transform-origin:50%;transform-origin:50%;-webkit-border-radius:100%;border-radius:100%;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}.premium-button-style5-radialin:before{-webkit-transform:scale(2);-ms-transform:scale(2);transform:scale(2)}.premium-button-style5-rectin:before{-webkit-transform-origin:50%;-ms-transform-origin:50%;transform-origin:50%;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-button-style5-rectout:before{-webkit-transform-origin:50%;-ms-transform-origin:50%;transform-origin:50%;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}.premium-button-style5-rectout:hover:before{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-button-style5-rectin:hover:before{-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}.premium-button-style5-radialout:hover:before{-webkit-transform:scale(2);-ms-transform:scale(2);transform:scale(2)}.premium-button-style5-radialin:hover:before{-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}.premium-button-style1-top:before{-webkit-transform-origin:50% 100%;-ms-transform-origin:50% 100%;transform-origin:50% 100%}.premium-button-style1-right:before{-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);-webkit-transform-origin:0 50%;-ms-transform-origin:0 50%;transform-origin:0 50%}.premium-button-style1-left:before{-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);-webkit-transform-origin:100% 50%;-ms-transform-origin:100% 50%;transform-origin:100% 50%}.premium-button-style2-scshutoutver:before,.premium-button-style2-shutouthor:before{-webkit-transform:scaleY(0);-ms-transform:scaleY(0);transform:scaleY(0);-webkit-transform-origin:100% 50%;-ms-transform-origin:100% 50%;transform-origin:100% 50%}.premium-button-style2-scshutouthor:before,.premium-button-style2-shutoutver:before{-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);-webkit-transform-origin:50% 50%;-ms-transform-origin:50% 50%;transform-origin:50% 50%}.premium-button-style2-shutinhor:before{-webkit-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:50%;-ms-transform-origin:50%;transform-origin:50%}.premium-button-style2-shutinver:before{-webkit-transform:scaleY(1);-ms-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:50%;-ms-transform-origin:50%;transform-origin:50%}.premium-button-style1-bottom:hover:before,.premium-button-style1-top:hover:before{-webkit-transform:scaleY(1);-ms-transform:scaleY(1);transform:scaleY(1)}.premium-button-style1-left:hover:before,.premium-button-style1-right:hover:before,.premium-button-style2-shutouthor:hover:before,.premium-button-style2-shutoutver:hover:before{-webkit-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1)}.premium-button-style2-shutinhor:hover:before{-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0)}.premium-button-style2-shutinver:hover:before{-webkit-transform:scaleY(0);-ms-transform:scaleY(0);transform:scaleY(0)}.premium-button-style2-scshutouthor:hover:before{-webkit-transform:scaleX(.9);-ms-transform:scaleX(.9);transform:scaleX(.9)}.premium-button-style2-scshutoutver:hover:before{-webkit-transform:scaleY(.8);-ms-transform:scaleY(.8);transform:scaleY(.8)}.premium-button-style2-dshutinhor:before{top:50%;left:50%;width:120%;height:0%;-webkit-transform:translateX(-50%) translateY(-50%) rotate(-45deg);-ms-transform:translateX(-50%) translateY(-50%) rotate(-45deg);transform:translateX(-50%) translateY(-50%) rotate(-45deg);-webkit-transform-origin:50%;-ms-transform-origin:50%;transform-origin:50%;-webkit-transition-property:all;transition-property:all}.premium-button-style2-dshutinver:before{top:50%;left:50%;width:120%;height:0%;-webkit-transform:translateX(-50%) translateY(-50%) rotate(-45deg);-ms-transform:translateX(-50%) translateY(-50%) rotate(-45deg);transform:translateX(-50%) translateY(-50%) rotate(-45deg);-webkit-transform-origin:50%;-ms-transform-origin:50%;transform-origin:50%;-webkit-transition-property:all;transition-property:all;-webkit-transform:translateX(-50%) translateY(-50%) rotate(45deg);-ms-transform:translateX(-50%) translateY(-50%) rotate(45deg);transform:translateX(-50%) translateY(-50%) rotate(45deg)}.premium-button-style2-dshutinhor:hover:before,.premium-button-style2-dshutinver:hover:before{height:220%}.premium-button-style3-before i,.premium-button-style3-before svg{opacity:0;-webkit-transform:translateX(-5px);-ms-transform:translateX(-5px);transform:translateX(-5px);-webkit-transition:all .5s ease-in-out;transition:all .5s ease-in-out}.premium-button-style3-after i,.premium-button-style3-after svg{opacity:0;-webkit-transform:translateX(-5px);-ms-transform:translateX(-5px);transform:translateX(-5px);-webkit-transition:all .5s ease-in-out;transition:all .5s ease-in-out;-webkit-transform:translateX(5px);-ms-transform:translateX(5px);transform:translateX(5px)}.premium-button-style3-after:hover i,.premium-button-style3-after:hover svg{opacity:1}.premium-button-style3-before:hover i,.premium-button-style3-before:hover svg{opacity:1}.premium-button-text-icon-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;-js-display:flex;display:-moz-box;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.premium-button-text-icon-wrapper i,.premium-button-text-icon-wrapper span{-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.premium-button-style4-icon-wrapper{position:absolute;z-index:2;width:100%;text-align:center;-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;height:100%;opacity:0;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-button-style4-icon-wrapper.top{bottom:-100%;left:0}.premium-button-style4-icon-wrapper.bottom{top:-100%;left:0}.premium-button-style4-icon-wrapper.left{top:0;left:-100%}.premium-button-style4-icon-wrapper.right{top:0;right:-100%}.premium-button-style4-bottom:hover .premium-button-style4-icon-wrapper{top:0;opacity:1}.premium-button-style4-top:hover .premium-button-style4-icon-wrapper{bottom:0;opacity:1}.premium-button-style4-left:hover .premium-button-style4-icon-wrapper{left:0;opacity:1}.premium-button-style4-right:hover .premium-button-style4-icon-wrapper{right:0;opacity:1}.premium-button-style4-bottom:hover .premium-button-text-icon-wrapper{-webkit-transform:translateY(100%);-ms-transform:translateY(100%);transform:translateY(100%);opacity:0}.premium-button-style4-top:hover .premium-button-text-icon-wrapper{-webkit-transform:translateY(-100%);-ms-transform:translateY(-100%);transform:translateY(-100%);opacity:0}.premium-button-style4-left:hover .premium-button-text-icon-wrapper{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);opacity:0}.premium-button-style4-right:hover .premium-button-text-icon-wrapper{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);opacity:0}.premium-contact-form-anim-yes .wpcf7-span::after{display:block;height:2px;content:"";top:-2px;position:relative;width:0;-webkit-transition:all ease-in-out .3s;transition:all ease-in-out .3s}.premium-contact-form-anim-yes .wpcf7-span.is-focused::after{width:100%}.premium-image-button{display:inline-block;position:relative;overflow:hidden;background:#6ec1e4;cursor:pointer;-webkit-transition:all .2s ease-in-out!important;transition:all .2s ease-in-out!important}.premium-image-button:hover{background-color:#54595f}.premium-image-button-style1-bottom:before,.premium-image-button-style1-left:before,.premium-image-button-style1-right:before,.premium-image-button-style1-top:before,.premium-image-button-style4-icon-wrapper{background-color:#54595f}.premium-image-button.premium-image-button-sm{padding:12px 24px;font-size:14px;line-height:1}.premium-image-button.premium-image-button-md{padding:14px 26px;font-size:16px;line-height:1.2}.premium-image-button.premium-image-button-lg{padding:16px 28px;font-size:18px;line-height:1.3333}.premium-image-button.premium-image-button-block{font-size:15px;line-height:1;padding:12px 24px;width:100%;text-align:center}.premium-image-button-text-icon-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;-js-display:flex;display:-moz-box;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;position:relative;z-index:3;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.premium-image-button-text-icon-wrapper i,.premium-image-button-text-icon-wrapper span{-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.premium-image-button-style1-bottom:before,.premium-image-button-style1-left:before,.premium-image-button-style1-right:before,.premium-image-button-style1-top:before{-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.premium-image-button-style1-bottom:before{content:"";position:absolute;width:100%;height:0;top:0;left:0}.premium-image-button-style1-top:before{content:"";position:absolute;width:100%;height:0;bottom:0;left:0}.premium-image-button-style1-right:before{content:"";position:absolute;width:0;height:100%;bottom:0;left:0}.premium-image-button-style1-left:before{content:"";position:absolute;width:0;height:100%;top:0;right:0}.premium-image-button-style1-bottom:hover:before,.premium-image-button-style1-top:hover:before{height:100%}.premium-image-button-style1-left:hover:before,.premium-image-button-style1-right:hover:before{width:100%}.premium-image-button-diagonal-effect-bottom,.premium-image-button-diagonal-effect-left,.premium-image-button-diagonal-effect-right,.premium-image-button-diagonal-effect-top{z-index:10}.premium-image-button-diagonal-effect-bottom:before,.premium-image-button-diagonal-effect-left:before,.premium-image-button-diagonal-effect-top:before{position:absolute;top:0;left:0;width:100%;height:100%;content:"";z-index:1;background:rgba(255,255,255,.2);-webkit-transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0);-ms-transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0);transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0);-webkit-transition:all .8s ease-out;transition:all .8s ease-out}.premium-image-button-diagonal-effect-right:before{position:absolute;top:0;left:0;width:100%;height:100%;content:"";z-index:1;background:rgba(255,255,255,.2);-webkit-transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0);-ms-transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0);transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0);-webkit-transition:all .8s ease-out;transition:all .8s ease-out}.premium-image-button-diagonal-effect-right:hover:before{-webkit-transform:scale3d(14,1.4,1) rotate3d(0,0,1,-45deg) translate3d(0,-150%,0);-ms-transform:scale3d(14,1.4,1) rotate3d(0,0,1,-45deg) translate3d(0,-150%,0);transform:scale3d(14,1.4,1) rotate3d(0,0,1,-45deg) translate3d(0,-150%,0)}.premium-image-button-diagonal-effect-left:before{-webkit-transform:scale3d(14,1.4,1) rotate3d(0,0,1,-45deg) translate3d(0,-150%,0);-ms-transform:scale3d(14,1.4,1) rotate3d(0,0,1,-45deg) translate3d(0,-150%,0);transform:scale3d(14,1.4,1) rotate3d(0,0,1,-45deg) translate3d(0,-150%,0)}.premium-image-button-diagonal-effect-left:hover:before{-webkit-transform:scale3d(14,1.4,1) rotate3d(0,0,1,-45deg) translate3d(0,150%,0);-ms-transform:scale3d(14,1.4,1) rotate3d(0,0,1,-45deg) translate3d(0,150%,0);transform:scale3d(14,1.4,1) rotate3d(0,0,1,-45deg) translate3d(0,150%,0)}.premium-image-button-diagonal-effect-right:before{-webkit-transform:scale3d(14,1.4,1) rotate3d(0,0,1,-45deg) translate3d(0,150%,0);-ms-transform:scale3d(14,1.4,1) rotate3d(0,0,1,-45deg) translate3d(0,150%,0);transform:scale3d(14,1.4,1) rotate3d(0,0,1,-45deg) translate3d(0,150%,0)}.premium-image-button-diagonal-effect-top:hover:before{-webkit-transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0);-ms-transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0);transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0)}.premium-image-button-diagonal-effect-bottom:before{-webkit-transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0);-ms-transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0);transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,-150%,0)}.premium-image-button-diagonal-effect-bottom:hover:before{-webkit-transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,150%,0);-ms-transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,150%,0);transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,150%,0)}.premium-image-button-diagonal-effect-top:before{-webkit-transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,150%,0);-ms-transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,150%,0);transform:scale3d(14,1.4,1) rotate3d(0,0,1,45deg) translate3d(0,150%,0)}.premium-image-button-style4-icon-wrapper{position:absolute;z-index:2;width:100%;text-align:center;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;-js-display:flex;display:-moz-box;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;height:100%;opacity:0;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-image-button-style4-icon-wrapper.top{bottom:-100%;left:0}.premium-image-button-style4-icon-wrapper.bottom{top:-100%;left:0}.premium-image-button-style4-icon-wrapper.left{top:0;left:-100%}.premium-image-button-style4-icon-wrapper.right{top:0;right:-100%}.premium-image-button-style4-bottom:hover .premium-image-button-style4-icon-wrapper{top:0;opacity:1}.premium-image-button-style4-top:hover .premium-image-button-style4-icon-wrapper{bottom:0;opacity:1}.premium-image-button-style4-left:hover .premium-image-button-style4-icon-wrapper{left:0;opacity:1}.premium-image-button-style4-right:hover .premium-image-button-style4-icon-wrapper{right:0;opacity:1}.premium-image-button-style4-bottom:hover .premium-image-button-text-icon-wrapper{-webkit-transform:translateY(100%);-ms-transform:translateY(100%);transform:translateY(100%);opacity:0}.premium-image-button-style4-top:hover .premium-image-button-text-icon-wrapper{-webkit-transform:translateY(-100%);-ms-transform:translateY(-100%);transform:translateY(-100%);opacity:0}.premium-image-button-style4-left:hover .premium-image-button-text-icon-wrapper{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);opacity:0}.premium-image-button-style4-right:hover .premium-image-button-text-icon-wrapper{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);opacity:0}.premium-image-button-overlap-effect-horizontal:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;opacity:0;-webkit-transition:all 1s ease-in-out;transition:all 1s ease-in-out;background:rgba(255,255,255,.2);-webkit-animation-name:premium-overlap-effect-done;animation-name:premium-overlap-effect-done;-webkit-animation-duration:1s;animation-duration:1s}.premium-image-button-overlap-effect-vertical:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;opacity:0;-webkit-transition:all 1s ease-in-out;transition:all 1s ease-in-out;background:rgba(255,255,255,.2);-webkit-animation-name:premium-overlap-effect-done;animation-name:premium-overlap-effect-done;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-name:premium-overlap-ver-effect-done;animation-name:premium-overlap-ver-effect-done;-webkit-animation-duration:1s;animation-duration:1s}.premium-image-button-overlap-effect-horizontal:hover:before{-webkit-animation-name:premium-overlap-effect;animation-name:premium-overlap-effect;-webkit-animation-duration:1s;animation-duration:1s}.premium-image-button-overlap-effect-vertical:hover:before{-webkit-animation-name:premium-overlap-ver-effect;animation-name:premium-overlap-ver-effect;-webkit-animation-duration:1s;animation-duration:1s}@-webkit-keyframes premium-overlap-effect{0%{opacity:0;-webkit-transform:rotateY(0);transform:rotateY(0)}50%{opacity:1;-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}100%{opacity:0;-webkit-transform:rotateY(360deg);transform:rotateY(360deg)}}@keyframes premium-overlap-effect{0%{opacity:0;-webkit-transform:rotateY(0);transform:rotateY(0)}50%{opacity:1;-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}100%{opacity:0;-webkit-transform:rotateY(360deg);transform:rotateY(360deg)}}@-webkit-keyframes premium-overlap-effect-done{0%{opacity:0;-webkit-transform:rotateY(0);transform:rotateY(0)}50%{opacity:1;-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}100%{opacity:0;-webkit-transform:rotateY(360deg);transform:rotateY(360deg)}}@keyframes premium-overlap-effect-done{0%{opacity:0;-webkit-transform:rotateY(0);transform:rotateY(0)}50%{opacity:1;-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}100%{opacity:0;-webkit-transform:rotateY(360deg);transform:rotateY(360deg)}}@-webkit-keyframes premium-overlap-ver-effect{0%{opacity:0;-webkit-transform:rotateX(0);transform:rotateX(0)}50%{opacity:1;-webkit-transform:rotateX(180deg);transform:rotateX(180deg)}100%{opacity:0;-webkit-transform:rotateX(360deg);transform:rotateX(360deg)}}@keyframes premium-overlap-ver-effect{0%{opacity:0;-webkit-transform:rotateX(0);transform:rotateX(0)}50%{opacity:1;-webkit-transform:rotateX(180deg);transform:rotateX(180deg)}100%{opacity:0;-webkit-transform:rotateX(360deg);transform:rotateX(360deg)}}@-webkit-keyframes premium-overlap-ver-effect-done{0%{opacity:0;-webkit-transform:rotateX(0);transform:rotateX(0)}50%{opacity:1;-webkit-transform:rotateX(180deg);transform:rotateX(180deg)}100%{opacity:0;-webkit-transform:rotateX(360deg);transform:rotateX(360deg)}}@keyframes premium-overlap-ver-effect-done{0%{opacity:0;-webkit-transform:rotateX(0);transform:rotateX(0)}50%{opacity:1;-webkit-transform:rotateX(180deg);transform:rotateX(180deg)}100%{opacity:0;-webkit-transform:rotateX(360deg);transform:rotateX(360deg)}}.premium-blog-filter,.premium-img-gallery-filter{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;-js-display:flex;display:-moz-box;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center}.premium-img-gallery{clear:both;overflow:hidden}.premium-gallery-container .premium-gallery-item{padding:10px;float:left}.premium-gallery-container .grid-sizer{width:33.33%}.premium-gallery-container .pa-gallery-item{padding:10px}.premium-blog-filter .premium-blog-cats-container li a.category,.premium-img-gallery-filter .premium-gallery-cats-container li a.category{text-decoration:none;-webkit-border-radius:75px;border-radius:75px;margin:15px 5px 20px;padding:7px 20px;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-img-gallery-filter .premium-gallery-cats-container li a.category span{-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.pa-gallery-img{position:relative}.pa-gallery-img .pa-gallery-whole-link{position:absolute;top:0;left:0;width:100%;height:100%}.pa-gallery-img.style2 .pa-gallery-whole-link{z-index:99}.pa-gallery-img-container{overflow:hidden;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.pa-gallery-img-container img{display:block;width:100%;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-img-gallery.gray img{-webkit-filter:grayscale(100%);filter:grayscale(100%)}.premium-img-gallery.scale img,.premium-img-gallery.zoomout img{-webkit-transform:scale(1.2);-ms-transform:scale(1.2);transform:scale(1.2)}.premium-img-gallery.sepia img{-webkit-filter:sepia(30%);filter:sepia(30%)}.premium-img-gallery.bright img{-webkit-filter:brightness(1);filter:brightness(1)}.premium-img-gallery.trans img{-webkit-transform:translateX(-15px) scale(1.1);-ms-transform:translateX(-15px) scale(1.1);transform:translateX(-15px) scale(1.1)}.pa-gallery-img .pa-gallery-img-link,.pa-gallery-img .pa-gallery-magnific-image{outline:0}.pa-gallery-img .pa-gallery-img-link span,.pa-gallery-img .pa-gallery-magnific-image span{line-height:1;display:inline-block;opacity:0;margin:0 5px;padding:15px;-webkit-border-radius:50%;border-radius:50%}.pa-gallery-img.style2 .pa-gallery-img-link span,.pa-gallery-img.style2 .pa-gallery-magnific-image span{margin:0 5px 20px}.pa-gallery-img:hover .pa-gallery-magnific-image span{-webkit-transition:all .3s ease-in-out,opacity .5s ease-in-out .3s;transition:all .3s ease-in-out,opacity .5s ease-in-out .3s}.pa-gallery-img:hover .pa-gallery-img-link span{-webkit-transition:all .3s ease-in-out,opacity .5s ease-in-out .6s;transition:all .3s ease-in-out,opacity .5s ease-in-out .6s}.pa-gallery-img:hover .pa-gallery-img-link span,.pa-gallery-img:hover .pa-gallery-magnific-image span{opacity:1}.premium-gallery-icon-show a.pa-gallery-video-icon span{opacity:1}.premium-blog-filter ul.premium-blog-cats-container,.premium-img-gallery-filter ul.premium-gallery-cats-container{text-align:center;margin:0;padding:0}.premium-blog-filter .premium-blog-cats-container li,.premium-img-gallery-filter .premium-gallery-cats-container li{list-style:none;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;-js-display:inline-flex;display:-moz-inline-box;display:inline-flex}.premium-img-gallery.zoomin .pa-gallery-img:hover img{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.premium-img-gallery.zoomout .pa-gallery-img:hover img{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-img-gallery.scale .pa-gallery-img:hover img{-webkit-transform:scale(1.3) rotate(5deg);-ms-transform:scale(1.3) rotate(5deg);transform:scale(1.3) rotate(5deg)}.premium-img-gallery.gray .pa-gallery-img:hover img{-webkit-filter:grayscale(0);filter:grayscale(0)}.premium-img-gallery.blur .pa-gallery-img:hover img{-webkit-filter:blur(3px);filter:blur(3px)}.premium-img-gallery.sepia .pa-gallery-img:hover img{-webkit-filter:sepia(0);filter:sepia(0)}.premium-img-gallery.trans .pa-gallery-img:hover img{-webkit-transform:translateX(0) scale(1.1);-ms-transform:translateX(0) scale(1.1);transform:translateX(0) scale(1.1)}.premium-img-gallery.bright .pa-gallery-img:hover img{-webkit-filter:brightness(1.2);filter:brightness(1.2)}.pa-gallery-img .premium-gallery-caption{padding:10px}.pa-gallery-img .premium-gallery-caption .premium-gallery-img-name{margin-bottom:0}.pa-gallery-img.style1{overflow:hidden}.pa-gallery-img:not(.style2) .pa-gallery-icons-wrapper{position:absolute;top:0;left:0;width:100%;height:100%;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.pa-gallery-img:not(.style2) .pa-gallery-icons-inner-container{position:absolute;top:33.33%;width:100%;text-align:center;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);z-index:999}.pa-gallery-img.style1 .premium-gallery-caption{position:absolute;top:auto;right:0;bottom:-1px;left:0;width:100%;-webkit-transition:all .5s ease 0s;transition:all .5s ease 0s;-webkit-transform:translate3d(0,100%,0);-ms-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}.pa-gallery-img.style1:hover .premium-gallery-caption{-webkit-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);transform:translate3d(0,0,0);bottom:-1px!important}.pa-gallery-img.default .premium-gallery-caption{position:absolute;top:auto;right:0;left:0;width:100%;bottom:0}.pa-gallery-img.style2 .pa-gallery-icons-caption-container{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transition:-webkit-transform .3s,opacity .3s;-webkit-transition:opacity .3s,-webkit-transform .3s;transition:opacity .3s,-webkit-transform .3s;transition:transform .3s,opacity .3s;transition:transform .3s,opacity .3s,-webkit-transform .3s;z-index:1;background-color:rgba(108,191,226,.68);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;-js-display:flex;display:-moz-box;display:flex;text-align:center;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center}.pa-gallery-img.style2 .pa-gallery-icons-caption-cell{width:100%}.pa-gallery-img.style2:hover .pa-gallery-icons-caption-container{opacity:1;-webkit-transform:translate(15px,15px);-ms-transform:translate(15px,15px);transform:translate(15px,15px)}.premium-clearfix{clear:both}.premium-img-gallery-metro .premium-gallery-item{overflow:hidden}.premium-img-gallery-metro .pa-gallery-img,.premium-img-gallery-metro .pa-gallery-img-container{height:100%}.premium-img-gallery-metro .pa-gallery-image{min-height:100%;width:100%;-o-object-fit:fill;object-fit:fill}.premium-img-gallery .premium-gallery-item-hidden{visibility:hidden;width:0!important;height:0!important;margin:0!important;padding:0!important}.premium-gallery-load-more .premium-gallery-load-more-btn{-webkit-box-shadow:none;box-shadow:none;text-shadow:none;border:none;outline:0;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-box-align:center;align-items:center;vertical-align:bottom;cursor:pointer;line-height:1;font-style:normal;font-weight:400;background-image:none;color:#fff;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-gallery-load-more-btn{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;-js-display:inline-flex;display:-moz-inline-box;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center}.premium-loader{border:3px solid #f3f3f3;border-top-width:3px;border-top-style:solid;border-top-color:#f3f3f3;-webkit-border-radius:50%;border-radius:50%;border-top:3px solid;border-top-color:#bbb;width:30px;height:30px;-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite;margin:0 auto}.premium-gallery-load-more-btn div{margin-left:3px}.premium-gallery-load-more-btn .premium-loader{display:inline-block;width:20px;height:20px}.pa-gallery-img .pa-gallery-lightbox-wrap{display:inline-block}.pa-gallery-img .pa-gallery-video-icon,.premium-img-gallery-no-lightbox .premium-gallery-video-item .pa-gallery-img{cursor:pointer}.pa-gallery-img-container iframe{position:absolute;visibility:hidden;top:0;left:0;max-width:100%;width:100%;height:100%;margin:0;line-height:1;border:none}.pa-gallery-img-container video{position:absolute;visibility:hidden;top:0;left:0;max-width:100%;width:100%;height:100%;margin:0;line-height:1;border:none;-o-object-fit:contain;object-fit:contain}.pa-gallery-icons-caption-cell svg,.pa-gallery-icons-inner-container svg{width:14px;height:14px}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.premium-vscroll-inner{position:relative;min-height:100%}.premium-vscroll-inner .premium-vscroll-dots{position:fixed;z-index:100;opacity:1;margin-top:-32px;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-vscroll-wrap .premium-vscroll-nav-menu{opacity:1;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-vscroll-inner .premium-vscroll-dots,.premium-vscroll-wrap .premium-vscroll-dots-hide{opacity:0;visibility:hidden}.premium-vscroll-nav-dots-yes .premium-vscroll-inner .premium-vscroll-dots:not(.premium-vscroll-dots-hide){opacity:1;visibility:visible}.premium-vscroll-dots.middle{top:50%}.premium-vscroll-dots.top{top:40px}.premium-vscroll-dots.bottom{bottom:30px}.premium-vscroll-dots.right{right:17px}.premium-vscroll-dots.left{left:17px}.premium-vscroll-inner ul.premium-vscroll-dots-list,.premium-vscroll-wrap .premium-vscroll-nav-menu{margin:0!important;padding:0}.premium-vscroll-inner ul.premium-vscroll-dots-list li{width:14px;height:13px;margin:7px;position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;-js-display:flex;display:-moz-box;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;-moz-box-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-box-align:center;align-items:center;overflow:visible}.premium-vscroll-inner .premium-vscroll-dot-item .premium-vscroll-nav-link{display:block;position:relative;z-index:1;width:100%;height:100%;cursor:pointer;text-decoration:none}.premium-vscroll-inner .premium-vscroll-dot-item .premium-vscroll-nav-link span{top:2px;left:2.5px;width:8px;height:8px;border:1px solid #000;-webkit-border-radius:50%;border-radius:50%;position:absolute;z-index:1;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-vscroll-inner .premium-vscroll-dot-item.active .premium-vscroll-nav-link span{-webkit-transform:scale(1.6);-ms-transform:scale(1.6);transform:scale(1.6)}.premium-vscroll-inner .premium-vscroll-dot-item .premium-vscroll-tooltip{position:absolute;color:#fff;font-size:14px;font-family:arial,helvetica,sans-serif;white-space:nowrap;max-width:220px;padding-left:.4em;padding-right:.4em}.premium-vscroll-inner .premium-vscroll-dots.right .premium-vscroll-tooltip{right:27px}.premium-vscroll-inner .premium-vscroll-dots.lines .premium-vscroll-dot-item{width:4px;height:30px}.premium-vscroll-inner .premium-vscroll-dots.lines .premium-vscroll-dot-item span{width:100%;height:100%;-webkit-border-radius:0;border-radius:0}.premium-vscroll-inner .premium-vscroll-dots.lines .premium-vscroll-dot-item.active span{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-vscroll-inner .premium-vscroll-dots.right .premium-vscroll-tooltip::after{position:absolute;top:50%;content:"";left:-webkit-calc(100% - 1px);left:calc(100% - 1px);width:10px;height:0;border-top:6px solid transparent;border-bottom:6px solid transparent;border-left:6px solid;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%)}.premium-vscroll-inner .premium-vscroll-dots.left .premium-vscroll-tooltip{left:27px}.premium-vscroll-inner .premium-vscroll-dots.left .premium-vscroll-tooltip::after{position:absolute;top:50%;content:"";right:-webkit-calc(100% - 1px);right:calc(100% - 1px);width:10px;height:0;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:6px solid;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%)}@media (max-width:768px){.premium-vscroll-dots.right{right:7px}.premium-vscroll-dots.left{left:7px}}.premium-vscroll-nav-menu{position:fixed;top:20px;height:40px;z-index:100;padding:0;margin:0}.premium-vscroll-nav-menu.left{left:0}.premium-vscroll-nav-menu.right{right:0}.premium-vscroll-nav-menu .premium-vscroll-nav-item{display:inline-block;margin:10px;color:#000;background:#fff;background:rgba(255,255,255,.3)}.premium-vscroll-nav-menu .premium-vscroll-nav-item .premium-vscroll-nav-link{padding:9px 18px;display:block;cursor:pointer;color:#000}.premium-vscroll-nav-menu .premium-vscroll-nav-item .premium-vscroll-nav-link:hover{color:#000}.premium-vscroll-nav-menu .premium-vscroll-nav-item .premium-vscroll-nav-link:focus{outline:0}.multiscroll-nav li a:focus{outline:0}.premium-vscroll-temp .slimScrollBar{visibility:hidden}.premium-image-scroll-container,.premium-image-scroll-section{transition:all .3s ease-in-out;-webkit-transition:all .3s ease-in-out;-moz-transition:all .3s ease-in-out;-ms-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out}.premium-image-scroll-section{overflow:hidden;width:100%;position:relative}.premium-image-scroll-container{width:100%}.premium-container-scroll{overflow:auto}.premium-image-scroll-container .premium-image-scroll-horizontal{position:relative;width:100%;height:100%}.premium-image-scroll-container .premium-image-scroll-horizontal img{max-width:none;height:100%}.premium-image-scroll-container .premium-image-scroll-vertical img{width:100%;max-width:100%;height:auto}.premium-image-scroll-ver{position:relative}.premium-image-scroll-container .premium-image-scroll-overlay{background:rgba(2,2,2,.3)}.premium-image-scroll-container .premium-image-scroll-link,.premium-image-scroll-container .premium-image-scroll-overlay{position:absolute;top:0;bottom:0;left:0;right:0;z-index:4}.premium-image-scroll-content{display:inline-block;position:absolute;height:auto;top:50%;left:50%;text-align:center;z-index:5;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.premium-container-scroll-instant .premium-image-scroll-image{-webkit-transition:all 0s ease-in-out!important;transition:all 0s ease-in-out!important}.premium-image-scroll-container img{-webkit-transition:transform 3s ease-in-out;-webkit-transition:-webkit-transform 3s ease-in-out;transition:-webkit-transform 3s ease-in-out;transition:transform 3s ease-in-out;transition:transform 3s ease-in-out,-webkit-transform 3s ease-in-out}.premium-image-scroll-container .premium-image-scroll-content,.premium-image-scroll-container .premium-image-scroll-overlay{-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;opacity:1}.premium-image-scroll-container:hover .premium-image-scroll-overlay{opacity:0}.premium-image-scroll-container:hover .premium-image-scroll-content{opacity:0;visibility:hidden}.premium-image-scroll-content .premium-image-scroll-icon{display:inline-block;font-family:pa-elements!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-direction:alternate;animation-direction:alternate;-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}.pa-horizontal-mouse-scroll:before{content:"\e918"}.pa-vertical-mouse-scroll:before{content:"\e919"}.pa-horizontal-mouse-scroll{-webkit-animation-name:pa-scroll-horizontal;animation-name:pa-scroll-horizontal}.pa-vertical-mouse-scroll{-webkit-animation-name:pa-scroll-vertical;animation-name:pa-scroll-vertical}@-webkit-keyframes pa-scroll-vertical{0%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}100%{-webkit-transform:translateY(5px);-ms-transform:translateY(5px);transform:translateY(5px)}}@keyframes pa-scroll-vertical{0%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}100%{-webkit-transform:translateY(5px);-ms-transform:translateY(5px);transform:translateY(5px)}}@-webkit-keyframes pa-scroll-horizontal{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(5px);-ms-transform:translateX(5px);transform:translateX(5px)}}@keyframes pa-scroll-horizontal{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(5px);-ms-transform:translateX(5px);transform:translateX(5px)}}.premium-lottie-wrap .premium-lottie-animation{position:relative;-js-display:inline-flex;display:-webkit-inline-box;display:-webkit-inline-flex;display:-moz-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.premium-lottie-wrap .premium-lottie-animation a{position:absolute;left:0;top:0;width:100%;height:100%}
1
+ @font-face{font-family:pa-elements;src:url(../../editor/fonts/pa-elements.eot?p2y7wv);src:url(../../editor/fonts/pa-elements.eot?p2y7wv#iefix) format("embedded-opentype"),url(../../editor/fonts/pa-elements.ttf?p2y7wv) format("truetype"),url(../../editor/fonts/pa-elements.woff?p2y7wv) format("woff"),url(../../editor/fonts/pa-elements.svg?p2y7wv#pa-elements) format("svg");font-weight:400;font-style:normal}.premium-banner{overflow:hidden}.premium-banner-ib{display:block;position:relative}.premium-banner-ib img{display:block;position:relative}.premium-banner-img-wrap{display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;-js-display:flex;display:-webkit-box;display:-moz-box;display:flex;height:100%}.premium-banner-img-wrap .premium-banner-ib-img{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0}.premium-banner-ib{z-index:1;overflow:hidden;margin:0 0 35px;text-align:center;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.premium-banner-ib-desc .premium-banner-read-more{z-index:100}.premium-banner-ib,.wpb_column>.wpb_wrapper .premium-banner-ib{margin-bottom:0}.elementor-widget-premium-addon-banner .premium-banner-ib-title{background:0 0}.premium-banner-ib *,.premium-banner-ib .premium-banner-ib-desc{-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.premium-banner-ib img{min-width:100%;max-width:100%;-webkit-transition:opacity .35s;transition:opacity .35s}.premium-banner-ib .premium-banner-ib-desc{padding:15px;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;top:0;left:0;width:100%;height:100%}.premium-banner-ib .premium-banner-ib-link{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1000;text-indent:200%;white-space:nowrap;font-size:0;opacity:0}.premium-banner-ib a.premium-banner-ib-link{display:block;background:0 0}.premium-banner-animation1 img{width:-webkit-calc(100% + 50px)!important;width:calc(100% + 50px)!important;max-width:-webkit-calc(100% + 50px)!important;max-width:calc(100% + 50px)!important;-webkit-transition:opacity .35s,filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,-webkit-transform .35s;-webkit-transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(-40px,0,0);transform:translate3d(-40px,0,0)}.premium-banner-animation2 .premium-banner-ib-title{padding:15px}.premium-banner-animation1 .premium-banner-ib-desc{top:auto;bottom:0;min-height:25%;height:auto;max-height:100%;text-align:left}.premium-banner-animation1 .premium-banner-ib-content,.premium-banner-animation1 .premium-banner-ib-title,.premium-banner-animation1 .premium-banner-read-more{-webkit-transform:translate3d(0,40px,0);transform:translate3d(0,40px,0);-webkit-transition-delay:50ms;transition-delay:50ms;-webkit-transition-duration:.35s;transition-duration:.35s}.premium-banner-animation1 .premium-banner-ib-title{-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s}.premium-banner-animation1 .premium-banner-ib-content,.premium-banner-animation1 .premium-banner-read-more{margin-top:10px;opacity:0;-webkit-transition:opacity .2s,-webkit-transform .35s;transition:opacity .2s,-webkit-transform .35s;transition:opacity .2s,transform .35s;transition:opacity .2s,transform .35s,-webkit-transform .35s}.premium-banner-animation1.active .premium-banner-ib-content,.premium-banner-animation1.active .premium-banner-read-more,.premium-banner-animation1:hover .premium-banner-ib-content,.premium-banner-animation1:hover .premium-banner-read-more{opacity:1;-webkit-transition-delay:50ms;transition-delay:50ms;-webkit-transition-duration:.35s;transition-duration:.35s}.premium-banner-animation1.active .premium-banner-ib-content,.premium-banner-animation1.active .premium-banner-ib-title,.premium-banner-animation1.active .premium-banner-read-more,.premium-banner-animation1.active img,.premium-banner-animation1:hover .premium-banner-ib-content,.premium-banner-animation1:hover .premium-banner-ib-title,.premium-banner-animation1:hover .premium-banner-read-more,.premium-banner-animation1:hover img{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);-webkit-transition-delay:50ms;transition-delay:50ms;-webkit-transition-duration:.35s;transition-duration:.35s}.premium-banner-animation1.scale img,.premium-banner-animation1.zoomout img{-webkit-transform:translate3d(-40px,0,0) scale(1.1);transform:translate3d(-40px,0,0) scale(1.1)}.premium-banner-ib.sepia img{-webkit-filter:sepia(30%);filter:sepia(30%)}.premium-banner-ib.bright img{-webkit-filter:brightness(1);filter:brightness(1)}.premium-banner-ib.sepia:hover img{-webkit-filter:sepia(0);filter:sepia(0)}.premium-banner-ib.bright:hover img{-webkit-filter:brightness(1.2);filter:brightness(1.2)}.premium-banner-animation1.premium-banner-min-height img,.premium-banner-animation13.premium-banner-min-height img,.premium-banner-animation2.premium-banner-min-height img,.premium-banner-animation4.premium-banner-min-height img,.premium-banner-animation5.premium-banner-min-height img,.premium-banner-animation6.premium-banner-min-height img{height:auto}.premium-banner-animation2 img{width:100%}.premium-banner-animation2 .premium-banner-ib-desc::before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;opacity:0;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0)}.premium-banner-animation2 .premium-banner-ib-title{position:absolute;top:50%;left:0;width:100%;-webkit-transition:-webkit-transform .35s,color .35s;-webkit-transition:color .35s,-webkit-transform .35s;transition:color .35s,-webkit-transform .35s;transition:transform .35s,color .35s;transition:transform .35s,color .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.premium-banner-animation2 .premium-banner-ib-content,.premium-banner-animation2 .premium-banner-ib-desc::before,.premium-banner-animation2 .premium-banner-read-more{-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s}.premium-banner-animation2 .premium-banner-ib-content,.premium-banner-animation2 .premium-banner-read-more{position:absolute;bottom:0;left:0;padding:15px;width:100%;max-height:50%;opacity:0;-webkit-transform:translate3d(0,10px,0);transform:translate3d(0,10px,0)}.premium-banner-animation2.active .premium-banner-ib-title,.premium-banner-animation2:hover .premium-banner-ib-title{-webkit-transform:translate3d(0,-40px,0);transform:translate3d(0,-40px,0)}.premium-banner-animation2.active .premium-banner-ib-desc::before,.premium-banner-animation2.active .premium-banner-read-more,.premium-banner-animation2:hover .premium-banner-ib-desc::before,.premium-banner-animation2:hover .premium-banner-read-more{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation2.active .premium-banner-ib-content,.premium-banner-animation2:hover .premium-banner-ib-content{opacity:1;-webkit-transform:translate3d(0,-30px,0);transform:translate3d(0,-30px,0)}.premium-banner-animation3 .premium-banner-ib-title{position:absolute;bottom:0;left:0;padding:15px;width:100%;text-align:left;-webkit-transform:translate3d(0,-30px,0);transform:translate3d(0,-30px,0)}.premium-banner-animation3 .premium-banner-ib-desc::before,.premium-banner-animation3 .premium-banner-ib-title{-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s}.premium-banner-animation3.active .premium-banner-ib-desc::before,.premium-banner-animation3.active .premium-banner-ib-title,.premium-banner-animation3:hover .premium-banner-ib-desc::before,.premium-banner-animation3:hover .premium-banner-ib-title{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation3 .premium-banner-ib-content{max-height:-webkit-calc(100% - 60px - 1.5em);max-height:calc(100% - 60px - 1.5em);overflow:hidden}.premium-banner-animation4 img{width:-webkit-calc(100% + 40px)!important;width:calc(100% + 40px)!important;max-width:-webkit-calc(100% + 40px)!important;max-width:calc(100% + 40px)!important}.premium-banner-animation4 .premium-banner-ib-desc{padding:30px}.premium-banner-animation4 .premium-banner-ib-desc::after{position:absolute;content:"";opacity:0}.premium-banner-animation4 .premium-banner-ib-desc::before{position:absolute;content:"";opacity:0;top:50px;right:30px;bottom:50px;left:30px;border-top:1px solid #fff;border-bottom:1px solid #fff;-webkit-transform:scale(0,1);-ms-transform:scale(0,1);transform:scale(0,1);-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}.premium-banner-animation4 .premium-banner-ib-desc::after{top:30px;right:50px;bottom:30px;left:50px;border-right:1px solid #fff;border-left:1px solid #fff;-webkit-transform:scale(1,0);-ms-transform:scale(1,0);transform:scale(1,0);-webkit-transform-origin:100% 0;-ms-transform-origin:100% 0;transform-origin:100% 0}.premium-banner-animation4 .premium-banner-ib-title{padding:50px 30px 0 30px;-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s}.premium-banner-animation4 .premium-banner-ib-content,.premium-banner-animation4 .premium-banner-read-more{padding:10px 30px;opacity:0;overflow:hidden;-webkit-transform:translate3d(0,-10px,0);transform:translate3d(0,-10px,0)}.premium-banner-animation4 .premium-banner-ib-title,.premium-banner-animation4 img{-webkit-transform:translate3d(-30px,0,0);transform:translate3d(-30px,0,0)}.premium-banner-animation4.scale img,.premium-banner-animation4.zoomout img{-webkit-transform:translate3d(-30px,0,0) scale(1.1);transform:translate3d(-30px,0,0) scale(1.1)}.premium-banner-animation4 .premium-banner-ib-content,.premium-banner-animation4 .premium-banner-read-more{-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s}.premium-banner-animation4 .premium-banner-ib-desc::after,.premium-banner-animation4 .premium-banner-ib-desc::before{-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s}.premium-banner-animation4 img{-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s}.premium-banner-animation4.active .premium-banner-ib-desc::after,.premium-banner-animation4.active .premium-banner-ib-desc::before,.premium-banner-animation4:hover .premium-banner-ib-desc::after,.premium-banner-animation4:hover .premium-banner-ib-desc::before{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-banner-animation4.active .premium-banner-ib-content,.premium-banner-animation4.active .premium-banner-ib-title,.premium-banner-animation4.active .premium-banner-read-more,.premium-banner-animation4:hover .premium-banner-ib-content,.premium-banner-animation4:hover .premium-banner-ib-title,.premium-banner-animation4:hover .premium-banner-read-more{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation4:hover .premium-banner-ib-content,.premium-banner-animation4:hover .premium-banner-ib-desc::after,.premium-banner-animation4:hover .premium-banner-ib-title,.premium-banner-animation4:hover img{-webkit-transition-delay:.15s;transition-delay:.15s}.premium-banner-animation5 .premium-banner-ib-desc{top:auto;bottom:0;padding:15px;height:auto;background:#f2f2f2;color:#3c4a50;-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}.premium-banner-animation5 .premium-banner-ib-content{position:absolute;top:auto;bottom:100%;left:0;width:100%;padding:15px;opacity:0;-webkit-transition:opacity .35s;transition:opacity .35s}.premium-banner-animation5 .premium-banner-ib-title,.premium-banner-animation5 .premium-banner-read-more{-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,200%,0);transform:translate3d(0,200%,0);text-align:center}.premium-banner-animation5 .premium-banner-ib-title{margin:10px 0}.premium-banner-animation5.active .premium-banner-ib-content,.premium-banner-animation5.active .premium-banner-ib-content *,.premium-banner-animation5:hover .premium-banner-ib-content,.premium-banner-animation5:hover .premium-banner-ib-content *{opacity:1!important;z-index:99!important;-webkit-backface-visibility:hidden!important;backface-visibility:hidden!important}.premium-banner-animation5.active .premium-banner-ib-desc,.premium-banner-animation5.active .premium-banner-ib-title,.premium-banner-animation5.active .premium-banner-read-more,.premium-banner-animation5:hover .premium-banner-ib-desc,.premium-banner-animation5:hover .premium-banner-ib-title,.premium-banner-animation5:hover .premium-banner-read-more{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}.premium-banner-animation5:hover .premium-banner-ib-title{-webkit-transition-delay:50ms;transition-delay:50ms}.premium-banner-animation5 img{-webkit-transition:opacity .35s,filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,-webkit-transform .35s;-webkit-transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-transform .35s}.premium-banner-animation2 img,.premium-banner-animation4 img,.premium-banner-animation6 img{-webkit-transition:opacity .35s,filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,-webkit-transform .35s;-webkit-transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-transform .35s}.premium-banner-animation5.scale img,.premium-banner-animation5.zoomout img{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.premium-banner-animation2.scale img,.premium-banner-animation2.zoomout img{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.premium-banner-animation6.scale img,.premium-banner-animation6.zoomout img{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.premium-banner-animation2.zoomin:hover img,.premium-banner-animation5.zoomin:hover img,.premium-banner-animation6.zoomin:hover img{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.premium-banner-animation2.zoomout:hover img,.premium-banner-animation5.zoomout:hover img,.premium-banner-animation6.zoomout:hover img{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-banner-animation2.scale:hover img,.premium-banner-animation5.scale:hover img,.premium-banner-animation6.scale:hover img{-webkit-transform:scale(1.2) rotate(5deg);-ms-transform:scale(1.2) rotate(5deg);transform:scale(1.2) rotate(5deg)}.premium-banner-animation2.grayscale:hover img,.premium-banner-animation5.grayscale:hover img,.premium-banner-animation6.grayscale:hover img{-webkit-filter:grayscale(100%);filter:grayscale(100%)}.premium-banner-animation2.blur:hover img,.premium-banner-animation5.blur:hover img{-webkit-filter:blur(3px);filter:blur(3px)}.premium-banner-animation6.blur:hover img{-webkit-filter:blur(3px);filter:blur(3px)}.premium-banner-animation6 .premium-banner-ib-desc{padding:45px}.premium-banner-animation6 .premium-banner-ib-desc::before{position:absolute;content:"";top:30px;right:30px;bottom:30px;left:30px;border:1px solid #fff}.premium-banner-animation6 .premium-banner-ib-title{margin:20px 0 10px;-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}.premium-banner-animation6 .premium-banner-ib-content,.premium-banner-animation6 .premium-banner-ib-desc::before,.premium-banner-animation6 .premium-banner-read-more{opacity:0;-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}.premium-banner-animation6 .premium-banner-read-more{margin-top:10px}.premium-banner-animation6.active .premium-banner-ib-title,.premium-banner-animation6:hover .premium-banner-ib-title{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation6.active .premium-banner-ib-content,.premium-banner-animation6.active .premium-banner-ib-desc::before,.premium-banner-animation6.active .premium-banner-read-more,.premium-banner-animation6:hover .premium-banner-ib-content,.premium-banner-animation6:hover .premium-banner-ib-desc::before,.premium-banner-animation6:hover .premium-banner-read-more{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-banner-animation8 img{-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s;-webkit-transform:scale(1.15);-ms-transform:scale(1.15);transform:scale(1.15)}.premium-banner-animation8.active img,.premium-banner-animation8:hover img{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.premium-banner-animation8 .premium-banner-ib-title{margin-top:20%;-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,20px,0);transform:translate3d(0,20px,0)}.premium-banner-animation8.active .premium-banner-ib-title,.premium-banner-animation8:hover .premium-banner-ib-title{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation8 .premium-banner-ib-content{margin:1em 0 0;padding:35px;border:1px solid #fff;opacity:0;-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,20px,0) scale(1.1);transform:translate3d(0,20px,0) scale(1.1)}.premium-banner-animation8.active .premium-banner-ib-content,.premium-banner-animation8:hover .premium-banner-ib-content{opacity:1;-webkit-transform:translate3d(0,0,0) scale(1);transform:translate3d(0,0,0) scale(1)}.premium-banner-animation12 .premium-banner-ib-desc::after{position:absolute;content:"";right:30px;bottom:30px;left:30px;height:-webkit-calc(50% - 30px);height:calc(50% - 30px);border:7px solid #fff;-webkit-transition:-webkit-transform .35s;transition:-webkit-transform .35s;transition:transform .35s;transition:transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0)}.premium-banner-animation12.active .premium-banner-ib-desc::after,.premium-banner-animation12:hover .premium-banner-ib-desc::after{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation12 .premium-banner-ib-desc{padding:45px;text-align:left}.premium-banner-animation12 .premium-banner-ib-content{position:absolute;right:60px;bottom:60px;left:60px;opacity:0;-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s;transition:opacity .35s,transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(0,-100px,0);transform:translate3d(0,-100px,0)}.premium-banner-animation12.active .premium-banner-ib-content,.premium-banner-animation12:hover .premium-banner-ib-content{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation13 img{width:-webkit-calc(100% + 20px)!important;width:calc(100% + 20px)!important;max-width:-webkit-calc(100% + 20px)!important;max-width:calc(100% + 20px)!important;-webkit-transition:opacity .35s,filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,-webkit-transform .35s;-webkit-transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-filter .35s,-webkit-transform .35s;transition:opacity .35s,filter .35s,transform .35s,-webkit-transform .35s;-webkit-transform:translate3d(-10px,0,0);transform:translate3d(-10px,0,0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.premium-banner-animation13.scale img,.premium-banner-animation13.zoomout img{-webkit-transform:translate3d(-10px,0,0) scale(1.1);transform:translate3d(-10px,0,0) scale(1.1)}.premium-banner-animation13.none:hover img{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.premium-banner-animation1.none:hover img,.