UNPKG

multimediaobject

Version:
3 lines (2 loc) 47.5 kB
var MultimediaObject=function(){"use strict";function t(t,e){for(var i=0,n=t.length;i<n;++i)if(!e(t[i]))return vt;return 1}function e(e,i){t(e,function(t){return i(t),1})}function i(t,e){var i=ft.createElement("script"),n=void 0;i.onload=i.onerror=i[yt]=function(){i[gt]&&!/^c|loade/.test(i[gt])||n||(i.onload=i[yt]=null,n=1,At[t]=2,e())},i.async=1,i.src=St?t+(t.indexOf("?")===-1?"?":"&")+St:t,bt.insertBefore(i,bt.lastChild)}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r=function(t){return t.constructor.toString().match(/function (.*)\(/)[1]},o=function(){function t(e){s(this,t),this.obj={},e&&this.add(e)}return a(t,[{key:"contains",value:function(t){return 1===this.obj[t]}},{key:"add",value:function(t){var e=void 0,i=void 0,n=void 0;if("string"!=typeof t&&"number"!=typeof t&&r(t).indexOf("Array")<0)throw new Error("you can only add an array, a string or a number");if("string"==typeof t||"number"==typeof t)this.obj[t]=1;else for(e=0,i=t.length;e<i;e++)n=t[e],this.obj[n]=1}}]),t}(),l=["baselineShift","border","backgroundPositionX","backgroundPositionY","borderBottom","borderBottomLeftRadius","borderBottomRightRadius","borderBottomWidth","borderImageOutset","borderImageWidth","borderLeft","borderLeftWidth","borderRadius","borderRight","borderRightWidth","borderSpacing","borderTop","borderTopLeftRadius","borderTopRightRadius","borderTopWidth","borderWidth","bottom","columnGap","columnRule","columnRuleWidth","columnWidth","cx","cy","flexBasis","fontSize","left","letterSpacing","lineHeight","marginBottom","marginLeft","marginRight","marginTop","maxHeight","maxWidth","minHeight","minWidth","motion","offset","offsetDistance","outlineOffset","outlineWidth","paddingBottom","paddingLeft","paddingRight","paddingTop","perspective","r","right","rx","ry","shapeMargin","size","strokeDasharray","strokeDashoffset","strokeWidth","tabSize","textIndent","top","width","height","wordSpacing","x","y","baseline-shift","border-bottom","border-bottom-left-radius","border-bottom-right-radius","border-bottom-width","border-image-outset","border-image-width","border-left","border-left-width","border-radius","border-right","border-right-width","border-spacing","border-top","border-top-left-radius","border-top-right-radius","border-top-width","border-width","column-gap","column-rule","column-rule-width","column-width","flex-basis","font-size","letter-spacing","line-height","margin-bottom","margin-left","margin-right","margin-top","max-height","max-width","min-height","min-width","offset-distance","padding-bottom","padding-left","padding-right","padding-top","stroke-dasharray","stroke-dashoffset","stroke-width","tab-size","text-indent","word-spacing","translateX","translateY","translateZ","translate-x","translate-y","translate-z","translate","background-position-x","background-position-y"],u=["background","flex","flexGrow","flexShrink","objectPosition","transformOrigin","alignContent","alignItems","alignSelf","alignmentBaseline","all","animation","animationDelay","animationDirection","animationDuration","animationFillMode","animationIterationCount","animationName","animationPlayState","animationTimingFunction","backfaceVisibility","background","backgroundAttachment","backgroundBlendMode","backgroundClip","backgroundColor","backgroundImage","backgroundOrigin","backgroundPosition","backgroundRepeat","backgroundRepeatX","backgroundRepeatY","borderBottomColor","borderBottomStyle","borderCollapse","borderColor","borderImage","borderImageRepeat","borderImageSlice","borderImageSource","borderLeftColor","borderLeftStyle","borderRightColor","borderRightStyle","borderStyle","borderTopColor","borderTopStyle","boxShadow","boxSizing","breakAfter","breakBefore","breakInside","bufferedRendering","captionSide","clear","clip","clipPath","color","columnCount","columnFill","columnRuleColor","columnRuleStyle","columnSpan","columns","contain","content","counterIncrement","counterReset","cursor","d","direction","display","emptyCells","fill","fillOpacity","fillRule","filter","flexDirection","flexFlow","flexWrap","float","floodColor","floodOpacity","font","fontFamily","fontFeatureSettings","fontKerning","fontStretch","fontStyle","fontVariant","fontVariantCaps","fontVariantLigatures","fontVariantNumeric","fontWeight","hyphens","imageRendering","isolation","justifyContent","lightingColor","listStyle","listStyleImage","listStylePosition","listStyleType","marker","markerEnd","markerMid","markerStart","mask","maskType","maxZoom","minZoom","mixBlendMode","objectFit","offsetPath","offsetRotation","opacity","order","orientation","orphans","outline","outlineColor","outlineStyle","overflow","overflowWrap","overflowX","overflowY","page","pageBreakAfter","pageBreakBefore","pageBreakInside","paintOrder","perspectiveOrigin","pointerEvents","position","quotes","resize","shapeImageThreshold","shapeOutside","shapeRendering","speak","src","stopColor","stopOpacity","stroke","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","tableLayout","textAlign","textAlignLast","textAnchor","textCombineUpright","textDecoration","textOrientation","textOverflow","textRendering","textShadow","textSizeAdjust","textTransform","touchAction","transform","transformStyle","transition","transitionDelay","transitionDuration","transitionProperty","transitionTimingFunction","unicodeBidi","unicodeRange","userSelect","userZoom","vectorEffect","visibility","vertical-align","verticalAlign","webkitAppearance","whiteSpace","willChange","wordBreak","wordWrap","writingMode","zIndex","zoom","flex-grow","flex-shrink","object-position","transform-origin","align-content","align-items","align-self","alignment-baseline","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-repeat-x","background-repeat-y","border-bottom-color","border-bottom-style","border-collapse","border-color","border-image","border-image-repeat","border-image-slice","border-image-source","border-left-color","border-left-style","border-right-color","border-right-style","border-style","border-top-color","border-top-style","box-shadow","box-sizing","break-after","break-before","break-inside","buffered-rendering","caption-side","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-rendering","column-count","column-fill","column-rule-color","column-rule-style","column-span","counter-increment","counter-reset","dominant-baseline","empty-cells","fill-opacity","fill-rule","flex-direction","flex-flow","flex-wrap","flood-color","flood-opacity","font-family","font-feature-settings","font-kerning","font-stretch","font-style","font-variant","font-variant-caps","font-variant-ligatures","font-variant-numeric","font-weight","image-rendering","justify-content","lighting-color","list-style","list-style-image","list-style-position","list-style-type","marker-end","marker-mid","marker-start","mask-type","max-zoom","min-zoom","mix-blend-mode","object-fit","offset-path","offset-rotation","outline-color","outline-style","overflow-wrap","overflow-x","overflow-y","page-break-after","page-break-before","page-break-inside","paint-order","perspective-origin","pointer-events","shape-image-threshold","shape-outside","shape-rendering","stop-color","stop-opacity","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","table-layout","text-align","text-align-last","text-anchor","text-combine-upright","text-decoration","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","touch-action","transform-style","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","unicode-range","user-select","user-zoom","vector-effect","webkit-app-region","webkit-appearance","webkit-background-clip","webkit-background-origin","webkit-border-after","webkit-border-after-color","webkit-border-after-style","webkit-border-before","webkit-border-before-color","webkit-border-before-style","webkit-border-end","webkit-border-end-color","webkit-border-end-style","webkit-border-image","webkit-border-start","webkit-border-start-color","webkit-border-start-style","webkit-box-align","webkit-box-decoration-break","webkit-box-direction","webkit-box-flex","webkit-box-flex-group","webkit-box-lines","webkit-box-ordinal-group","webkit-box-orient","webkit-box-pack","webkit-box-reflect","webkit-column-break-after","webkit-column-break-before","webkit-column-break-inside","webkit-font-smoothing","webkit-highlight","webkit-hyphenate-character","webkit-line-break","webkit-line-clamp","webkit-locale","webkit-margin-after-collapse","webkit-margin-before-collapse","webkit-margin-bottom-collapse","webkit-margin-collapse","webkit-margin-top-collapse","webkit-mask","webkit-mask-box-image","webkit-mask-box-image-repeat","webkit-mask-box-image-slice","webkit-mask-box-image-source","webkit-mask-clip","webkit-mask-composite","webkit-mask-image","webkit-mask-origin","webkit-mask-repeat","webkit-mask-repeat-x","webkit-mask-repeat-y","webkit-print-color-adjust","webkit-rtl-ordering","webkit-ruby-position","webkit-tap-highlight-color","webkit-text-combine","webkit-text-decorations-in-effect","webkit-text-emphasis","webkit-text-emphasis-color","webkit-text-emphasis-position","webkit-text-emphasis-style","webkit-text-fill-color","webkit-text-orientation","webkit-text-security","webkit-text-stroke-color","webkit-user-drag","webkit-user-modify","webkit-writing-mode","white-space","will-change","word-break","word-wrap","writing-mode","z-index","zoom"],h={Atoms:{block:"div",div:"div",header:"header",footer:"footer",aside:"aside",article:"article",main:"main",nav:"nav",navigation:"nav",span:"span",text:"p",p:"p",paragraphe:"p","ulist-container":"ul",ulist:"ul",ul:"ul","unordered-list":"ul","olist-container":"ol",olist:"ol",ol:"ol","ordered-list":"ol","list-element":"li",li:"li",code:"pre",pre:"pre",input:"input",textarea:"textarea",form:"form",image:"img",img:"img",button:"button",iframe:"iframe",video:"video",canvas:"canvas",audio:"audio"},regex:{DOMEvent:new RegExp("^(click|mousedown|mouseup|mousemove|change|touchstart|touchmove|touchend|input|focus|dlclick|mouseenter|mouseleave|mouseover|mouseout|blur|search|submit|play|pause|canplay|progress)$"),animatableProps:new RegExp("background-position-|background-size|background-color|translate|scale|rotate|skew|margin-|padding-|top|left|right|bottom|color|font-size|width|height|opacity","g")},sets:{pxProperties:l,degProperties:["rotate","rotate-x","rotate-y","rotate-z","rotate-x","rotate-y","rotate-z","skew","skewX","skewY","skewZ","skew-x","skew-y","skew-z"],transformProperties:["translate","translateX","translateY","translateZ","translateX","translate-x","translateY","translate-y","translate-z","scale","scaleX","scaleY","scaleZ","scale-x","scale-y","scale-z","rotate","rotateX","rotateY","rotateZ","rotate-x","rotate-y","rotate-z","skew","skewX","skewY","skewZ","skew-x","skew-y","skew-z","perspective","perspectiveX","perspectiveY","perspectiveZ","perspective-x","perspective-y","perspective-z"],styleProperties:u}},d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"block";return h.Atoms[t]},c=function(t,e,i){var n=function(){throw new Error(i)};try{e()}catch(t){n()}finally{(!t||null===t||"string"==typeof t||"number"==typeof t||t instanceof Array)&&n()}},p=function(t){return void 0===t||""===t||"false"!==t&&Boolean(t)!==!1&&Boolean(t)},m=function(t){return h.regex.DOMEvent.test(t)},f=function(t,e){for(var i=e.sort(function(t,e){return t-e}),n=0;n<i.length;n++)if(t<i[n])return i[n];return i[i.length-1]},b=new o(h.sets.pxProperties),v=new o(h.sets.degProperties),g=new o(h.sets.transformProperties),y=new o(h.sets.styleProperties),w=function(t){return h.regex.animatableProps.test(t)},k=function(t){if("string"==typeof t){var e=t.match(/-(?=\d)|\d+|\.\d+/g);return null!==e?parseFloat(e.join("")):0}return"number"!=typeof parseFloat(t)||isNaN(parseFloat(t))?0:parseFloat(t)},x=function(t){var e="";if("string"==typeof t){var i=t.match?t.match(/%|px|vh|vw|em|deg/g):null;e=null!==i?i[0]:""}return e},A=function(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})},P=function(t){var e=t.split("-"),i=["Webkit","Moz","ms"],n=void 0,s=void 0,a=void 0,r=void 0,o=void 0,l=void 0,u=void 0,h=void 0;if(void 0!==document.body.style[t])return"";for(h="",n=0,r=e.length;n<r;n++)u=e[n],h+=u.substring(0,1).toUpperCase()+u.substring(1);for(s=0,o=i.length;s<o;s++)if(l=i[s],a=l+h,void 0!==document.body.style[a])return l;return""},S=function(t){var e=P(t);return"Moz"===e?""+e+(t.substring(0,1).toUpperCase()+t.substring(1)):""!==e?"-"+e.toLowerCase()+"-"+A(t):A(t)},O=function(t,e){if(b.contains(t)){var i=x(e);return""!==i?i:"px"}return v.contains(t)?"deg":g.contains(t)?"":(y.contains(t),"")},E=function(t){if(t instanceof Array){var e=void 0,i=t.filter(function(t){return!isNaN(parseFloat(t))});return i.length>0&&(e=Math.max.apply(null,i)),e=isNaN(e)?0:e}throw new Error("getMaxOfArray only works on an array")},I=function(t,e){if(!g.contains(t))throw new Error(t+" is not a transform property");var i=0,n=void 0;i="string"==typeof e&&e.indexOf(",")>=0?e.split(","):k(e),n=O(t,e),t.indexOf("scale")>=0?n="":v.contains(t)&&(n="deg");var s=t+"("+i+n+")";if(i instanceof Array){i=i.map(function(t){return k(t)});var a="";i.forEach(function(t,e){a+=e>0?", "+t+n:""+t+n}),s=t+"("+a+")"}return{string:s,unit:n,value:i}},L=function(){var t=(new Date).getTime();return window.performance&&"function"==typeof window.performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?i:3&i|8).toString(16)})},M=function(t){return"#"===t.charAt(0)?t.substring(1,7):t},R=function(t){return parseInt(M(t).substring(0,2),16)},F=function(t){return parseInt(M(t).substring(2,4),16)},_=function(t){return parseInt(M(t).substring(4,6),16)},j=function(t){var e=void 0;if("#"===t[0])e={r:R(t),g:F(t),b:_(t),a:1};else{var i="string"==typeof t?t.indexOf("("):-1;i>=0&&(t=t.slice(i+1,t.length-1));var n="string"==typeof t?t.split(","):[0,0,0,0];e={r:parseInt(n[0],10),g:parseInt(n[1],10),b:parseInt(n[2],10),a:parseFloat(n[3]||1)}}return e},C=function(t,e,i,n){return i*t/n+e},T=function(t,e,i,n){return i*(t/=n)*t+e},D=function(t,e,i,n){return-i*(t/=n)*(t-2)+e},U=function(t,e,i,n){return(t/=n/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},z=function(t,e,i,n){return i*(t/=n)*t*t+e},V=function(t,e,i,n){return i*((t=t/n-1)*t*t+1)+e},B=function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e},X=function(t,e,i,n){return i*(t/=n)*t*t*t+e},Y=function(t,e,i,n){return-i*((t=t/n-1)*t*t*t-1)+e},N=function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},W=function(t,e,i,n){return i*(t/=n)*t*t*t*t+e},q=function(t,e,i,n){return i*((t=t/n-1)*t*t*t*t+1)+e},Z=function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},Q=function(t,e,i,n){return-i*Math.cos(t/n*(Math.PI/2))+i+e},H=function(t,e,i,n){return i*Math.sin(t/n*(Math.PI/2))+e},G=function(t,e,i,n){return-i/2*(Math.cos(Math.PI*t/n)-1)+e},J=function(t,e,i,n){return 0==t?e:i*Math.pow(2,10*(t/n-1))+e},K=function(t,e,i,n){return t==n?e+i:i*(1-Math.pow(2,-10*t/n))+e},$=function(t,e,i,n){return 0==t?e:t==n?e+i:(t/=n/2)<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(2-Math.pow(2,-10*--t))+e},tt=function(t,e,i,n){return-i*(Math.sqrt(1-(t/=n)*t)-1)+e},et=function(t,e,i,n){return i*Math.sqrt(1-(t=t/n-1)*t)+e},it=function(t,e,i,n){return(t/=n/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e},nt=function(t,e,i,n){var s=1.70158,a=0,r=i;if(0==t)return e;if(1==(t/=n))return e+i;if(a||(a=.3*n),r<Math.abs(i)){r=i;var s=a/4}else var s=a/(2*Math.PI)*Math.asin(i/r);return-(r*Math.pow(2,10*(t-=1))*Math.sin((t*n-s)*(2*Math.PI)/a))+e},st=function(t,e,i,n){var s=1.70158,a=0,r=i;if(0==t)return e;if(1==(t/=n))return e+i;if(a||(a=.3*n),r<Math.abs(i)){r=i;var s=a/4}else var s=a/(2*Math.PI)*Math.asin(i/r);return r*Math.pow(2,-10*t)*Math.sin((t*n-s)*(2*Math.PI)/a)+i+e},at=function(t,e,i,n){var s=1.70158,a=0,r=i;if(0==t)return e;if(2==(t/=n/2))return e+i;if(a||(a=n*(.3*1.5)),r<Math.abs(i)){r=i;var s=a/4}else var s=a/(2*Math.PI)*Math.asin(i/r);return t<1?-.5*(r*Math.pow(2,10*(t-=1))*Math.sin((t*n-s)*(2*Math.PI)/a))+e:r*Math.pow(2,-10*(t-=1))*Math.sin((t*n-s)*(2*Math.PI)/a)*.5+i+e},rt=function(t,e,i,n,s){return void 0==s&&(s=1.70158),i*(t/=n)*t*((s+1)*t-s)+e},ot=function(t,e,i,n,s){return void 0==s&&(s=1.70158),i*((t=t/n-1)*t*((s+1)*t+s)+1)+e},lt=function(t,e,i,n,s){return void 0==s&&(s=1.70158),(t/=n/2)<1?i/2*(t*t*((1+(s*=1.525))*t-s))+e:i/2*((t-=2)*t*((1+(s*=1.525))*t+s)+2)+e},ut=function(t,e,i,n){return i-ht(n-t,0,i,n)+e},ht=function(t,e,i,n){return(t/=n)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e},dt=function(t,e,i,n){return t<n/2?.5*ut(2*t,0,i,n)+e:.5*ht(2*t-n,0,i,n)+.5*i+e},ct=Object.freeze({linearEase:C,easeInQuad:T,easeOutQuad:D,easeInOutQuad:U,easeInCubic:z,easeOutCubic:V,easeInOutCubic:B,easeInQuart:X,easeOutQuart:Y,easeInOutQuart:N,easeInQuint:W,easeOutQuint:q,easeInOutQuint:Z,easeInSine:Q,easeOutSine:H,easeInOutSine:G,easeInExpo:J,easeOutExpo:K,easeInOutExpo:$,easeInCirc:tt,easeOutCirc:et,easeInOutCirc:it,easeInElastic:nt,easeOutElastic:st,easeInOutElastic:at,easeInBack:rt,easeOutBack:ot,easeInOutBack:lt,easeInBounce:ut,easeOutBounce:ht,easeInOutBounce:dt}),pt=function(){this.listeners={}};pt.prototype={addListener:function(t,e){return this.listeners[t]?e instanceof Function&&this.listeners[t].indexOf(e)<0&&this.listeners[t].push(e):(this.listeners[t]=[],this.addListener(t,e)),this},dispatchEvent:function(t,e,i){return e=e||{},this.listeners[t]&&(i?this.listeners[t].forEach(function(t,n){t.call(i,e)}):this.listeners[t].forEach(function(t,i){t.call(window,e)})),this},removeListener:function(t,e){var i=this.listeners[t].indexOf(e);return i>0&&this.listeners[t].splice(i,1),this}};var mt=new pt,ft=document,bt=ft.getElementsByTagName("head")[0],vt=!1,gt="readyState",yt="onreadystatechange",wt={},kt={},xt={},At={},Pt=void 0,St=void 0,Ot=function n(s,a,r){function o(t){return t.call?t():wt[t]}function l(){if(!--c){wt[d]=1,h&&h();for(var i in xt)t(i.split("|"),o)&&!e(xt[i],o)&&(xt[i]=[])}}s=s.push?s:[s];var u=a&&a.call,h=u?a:r,d=u?s.join(""):a,c=s.length;return setTimeout(function(){e(s,function t(e,n){return null===e?l():(n||/^https?:\/\//.test(e)||!Pt||(e=e.indexOf(".js")===-1?Pt+e+".js":Pt+e),At[e]?(d&&(kt[d]=1),2==At[e]?l():setTimeout(function(){t(e,!0)},0)):(At[e]=1,d&&(kt[d]=1),void i(e,l)))})},0),n};Ot.get=i,Ot.order=function(t,e,i){!function n(s){s=t.shift(),t.length?Ot(s,n):Ot(s,e,i)}()},Ot.path=function(t){Pt=t},Ot.urlArgs=function(t){St=t},Ot.ready=function(i,n,s){i=i.push?i:[i];var a=[];return!e(i,function(t){wt[t]||a.push(t)})&&t(i,function(t){return wt[t]})?n():function(t){xt[t]=xt[t]||[],xt[t].push(n),s&&s(a)}(i.join("|")),Ot},Ot.done=function(t){Ot([null],t)};var Et={namespace:"_s4mConfig",container:"scene",defaultAttributes:{video:{src:"",type:"video/mp4",controls:"true",muted:"true",loop:"true",preload:"true",playsinline:"true"},img:{src:""},iframe:{src:""},form:{name:""},input:{name:""},audio:{src:""}}};return function(){for(var t=0,e=["ms","moz","webkit","o"],i=0;i<e.length&&!window.requestAnimationFrame;++i)window.requestAnimationFrame=window[e[i]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[i]+"CancelAnimationFrame"]||window[e[i]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(e){var i=(new Date).getTime(),n=Math.max(0,16-(i-t)),s=window.setTimeout(function(){e(i+n)},n);return t=i+n,s}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}(),function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"block",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"multimediaObject",a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60;s(this,t),this.uuid=L(),this.data={},this._style={},this.style={},this.attributes={},this.events={},this._events={},this.functions={},this.selectedAnimation="default",this.currentAnimation={},this.animations={},this.breakpoints=[],this.animated=!1,this.computedAnimations=[],this.childs=[],this.dependencies=[],this.animatedProps={},this.innerHTML="",this.DOMParent=null,this.fps=a,this.then=performance.now()||Date.now(),this.interval=1e3/this.fps,this.totalIteration=0,this.counter=0,this.reverse=!1,this.repeat=0,this.animationStarted=!1,"object"===(void 0===e?"undefined":n(e))?(this.name=i||e.name,this.type=e.type||"block",this.load=!0,this.loadFromJSON(e),this.applyFunctions(),this.addDefaultParameters(),this.init(),this.applyAttributes(),this.applyStyle(),this.applyEvents(),this.applyBreakpoints(),this.applyDependencies()):(this.name=i,this.type=e,this.init(),this.addDefaultParameters())}return a(t,[{key:"init",value:function(){var e=this;this.generate(d(this.type)),this.element.innerHTML=this.innerHTML,this.getSortedSteps(),window.MultimediaObjectEditor||(this.DOMParent instanceof t||(window[Et.namespace]?this.appendElementTo(document.getElementById(window[Et.namespace].containerId)):this.appendElementTo()),this.data.autostart?this.startAnimation():this.addListener("startAfterPreload",function(){return e.startAnimation()},!0)),this.attributes.id||this.applyAttributes({id:"multimediaObject"===this.name?this.uuid:this.name}),this.addGlobalStyle()}},{key:"addDefaultParameters",value:function(){if(Et.defaultAttributes[this.type]&&!this.load)for(var t in Et.defaultAttributes[this.type])this.attributes[t]||(this.attributes[t]=Et.defaultAttributes[this.type][t]);this.data.autostart=void 0===this.data.autostart||p(this.data.autostart),this.element&&this.applyAttributes()}},{key:"checkDep",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"push",i=this.dependencies.indexOf(t);switch(e){case"splice":i>=0&&this.dependencies.splice(i,1);break;case"push":default:i<0&&this.dependencies.push(t)}}},{key:"applyDependencies",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dependencies;return e instanceof Array?e.forEach(function(e){t.checkDep(e)}):this.checkDep(e),this}},{key:"removeDependencies",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dependencies;return e instanceof Array?e.forEach(function(e){t.checkDep(e,"splice")}):this.checkDep(e,"splice"),this}},{key:"requireDependencies",value:function(t){this.dependencies.length>0?(Ot(this.dependencies,"dependencies"),Ot.ready("dependencies",t)):t()}},{key:"addGlobalStyle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.data.globalStyle,e=arguments[1];if(!t)return this;if("string"!=typeof t)throw new Error("addGlobalStyle: style is not a string");var i=document.createElement("style"),n=t;return i.innerHTML=n,i.id=this.uuid+"-style",i.type="text/css",document.head.appendChild(i),e&&window.setTimeout(e,100),this}},{key:"applyStyle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.style,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];c(t,function(){return Object.keys(t)},"style must be an object");var i=void 0,n=[],s=void 0,a=Object.keys(this._style).length;for(i in t)if(s=t[i],g.contains(i)){n.push([i,s]);var r=I(i,s),o=""+r.value+r.unit;(a<1||e)&&(this._style[i]=o),this.style[i]=o}else if(b.contains(i)){var l=""+k(s)+O(i,s);(a<1||e)&&(this._style[i]=l),this.style[i]=l,this.element.style[i]=l}else if(y.contains(i))(a<1||e)&&(this._style[i]=s),this.style[i]=s,"string"==typeof s&&s.indexOf("{{absoluteAssetURL}}")>=0&&window[Et.namespace]&&(s=s.replace("{{absoluteAssetURL}}",window.MultimediaObjectEditor?this.data.absoluteAssetURL:window[Et.namespace].absoluteAssetURL)),this.element.style[i]=s;else{var u=""+s+O(i,s);this.style[S(i)]=u,(a<1||e)&&(this._style[S(i)]=u),"string"==typeof s&&s.indexOf("{{absoluteAssetURL}}")>=0&&window[Et.namespace]&&(s=s.replace("{{absoluteAssetURL}}",window.MultimediaObjectEditor?this.data.absoluteAssetURL:window[Et.namespace].absoluteAssetURL)),this.element.style[S(i)]=s}var h=[0,1,2,3],d={x:this._style.translateX?k(this._style.translateX):0,y:this._style.translateY?k(this._style.translateY):0,z:this._style.translateZ?k(this._style.translateZ):0,xU:this._style.translateX?x(this._style.translateX):"px",yU:this._style.translateY?x(this._style.translateY):"px",zU:this._style.translateZ?x(this._style.translateZ):"px"},p={value:this._style.rotate?k(this._style.rotate):0,u:"deg"},m={x:this._style.skewX?k(this._style.skewX):0,y:this._style.skewY?k(this._style.skewY):0,u:"deg"},f={x:this._style.scaleX?k(this._style.scaleX):1,y:this._style.scaleY?k(this._style.scaleY):1};return n.length>0&&(s=n.map(function(t){return I(t[0],t[1]).string}),s.forEach(function(t){t.indexOf("translateX")>=0||t.indexOf("translate-x")>=0?(d.x=k(t),d.xU=x(t)):t.indexOf("translateY")>=0||t.indexOf("translate-y")>=0?(d.y=k(t),d.yU=x(t)):(t.indexOf("translateZ")>=0||t.indexOf("translate-z")>=0)&&(d.z=k(t),d.zU=x(t)),t.indexOf("rotate")>=0&&(p.value=k(t)),t.indexOf("scaleX")>=0||t.indexOf("scale-x")>=0?f.x=k(t):(t.indexOf("scaleY")>=0||t.indexOf("scale-y")>=0)&&(f.y=k(t)),t.indexOf("skewX")>=0||t.indexOf("skew-x")>=0?m.x=k(t):(t.indexOf("skewY")>=0||t.indexOf("skew-y")>=0)&&(m.y=k(t))}),h[0]="translate3d("+d.x+d.xU+","+d.y+d.yU+","+d.z+d.zU+")",h[1]="rotate("+p.value+p.u+")",h[2]="skew("+m.x+m.u+","+m.y+m.u+")",h[3]="scale("+f.x+","+f.y+")",h=h.filter(function(t){return!/^[0-9]/.test(t)}).join(" "),this.element.style[S("transform")]=h),mt.dispatchEvent("actualize-style",this._style),this}},{key:"applyFunctions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.functions;c(t,function(){return Object.keys(t)},"functions must be an object");for(var e in t)Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(this),e)||(this[e]=t[e],this.functions[e]=t[e]);return this}},{key:"applyAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.attributes;if(c(t,function(){return Object.keys(t)},"attributes must be an object"),Object.keys(t).length>0)for(var e in t){var i=t[e];"string"==typeof t[e]&&t[e].indexOf("{{absoluteAssetURL}}")>=0&&window[Et.namespace]&&(i=t[e].replace("{{absoluteAssetURL}}",window.MultimediaObjectEditor?this.data.absoluteAssetURL:window[Et.namespace].absoluteAssetURL)),this.attributes[e]=t[e],this.element.setAttribute(e,i)}return this}},{key:"applyBreakpoints",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.breakpoints;if(!(e instanceof Array))throw new Error("breakpoints must be an array");return e.length>0&&(e.forEach(function(e){t.breakpoints.indexOf(e)===-1&&t.breakpoints.push(e)}),this.checkBreakpoints()),this}},{key:"applyEvents",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.events;if(Object.keys(e).length>0)for(var i in e)this.events[i]=e[i],this._events[i]=this.transformEvent(e[i]),"swipe"===i?function(e){var i=!!("ontouchstart"in window)||!!("ontouchstart"in document.documentElement)||!!window.ontouchstart||!!window.onmsgesturechange||window.DocumentTouch&&window.document instanceof window.DocumentTouch,n=t,s={};n.evtStarted=!1,t.evtStart=function(t){t.preventDefault();var e=t.changedTouches?t.changedTouches[0]:t;n.evtStarted=!0,s={start:{left:e.pageX,top:e.pageY}}},t.evtEnd=function(t){if(t.preventDefault(),n.evtStarted){var i=t.changedTouches?t.changedTouches[0]:t;s.end={left:i.pageX,top:i.pageY},s.dx=s.end.left-s.start.left,s.dy=s.end.top-s.start.top,s.angle=Math.atan2(s.dy,s.dx),s.angle*=180/Math.PI,s.inMotion="touchmove"===t.type||"mousemove"===t.type,s.direction=Math.abs(s.dx)>Math.abs(s.dy)?(""+s.dx).indexOf("-")!==-1?"left":"right":(""+s.dy).indexOf("-")!==-1?"top":"bottom",n.events[e].apply(n,[t,s]),s.inMotion===!1&&(n.evtStarted=!1)}},i?(t.element.addEventListener("touchstart",t.evtStart,!1),t.element.addEventListener("touchmove",t.evtEnd,!1),t.element.addEventListener("touchend",t.evtEnd,!1)):(t.element.addEventListener("mousedown",t.evtStart,!1),t.element.addEventListener("mousemove",t.evtEnd,!1),t.element.addEventListener("mouseup",t.evtEnd,!1))}(i):m(i)?this.element.addEventListener(i,this._events[i]):this.addListener(i,this.events[i]);return this}},{key:"removeEvent",value:function(t){return m(t)?this.events[t]?(this.element.removeEventListener(t,this._events[t]),delete this.events[t],delete this._events[t]):console.log("Event does not exist"):"swipe"===t?(this.element.removeEventListener("touchstart",this.evtStart),this.element.removeEventListener("touchmove",this.evtEnd),this.element.removeEventListener("touchend",this.evtEnd),this.element.removeEventListener("mousedown",this.evtStart),this.element.removeEventListener("mousemove",this.evtEnd),this.element.removeEventListener("mouseup",this.evtEnd),delete this.events[t],delete this._events[t]):this.events[t]?(this.removeListener(t,this._events[t]),delete this.events[t],delete this._events[t]):console.log("Event does not exist"),this}},{key:"deactivateEvent",value:function(t){this.events[t]?m(t)?this.element.removeEventListener(t,this._events[t]):"swipe"===t?(this.element.removeEventListener("touchstart",this.evtStart),this.element.removeEventListener("touchmove",this.evtEnd),this.element.removeEventListener("touchend",this.evtEnd),this.element.removeEventListener("mousedown",this.evtStart),this.element.removeEventListener("mousemove",this.evtEnd),this.element.removeEventListener("mouseup",this.evtEnd)):this.removeListener(t,this._events[t]):console.log("Event does not exist")}},{key:"removeFunction",value:function(t){return this.functions[t]?delete this.functions[t]:console.log("Function does not exist"),this}},{key:"removePropertie",value:function(t,e){var i=this;switch(t){case"attributes":this.attributes[e]?(this.element.removeAttribute(e),delete this.attributes[e]):console.log(e+" attribute does not exist");break;case"data":this.data[e]?delete this.data[e]:console.log(e+" data does not exist");break;case"style":default:if(this._style[e]){this.element.style[S(e)]="",this.element.style[e]="",g.contains(e)&&(this.element.style[S("transform")]="",this.element.style.transform=""),delete this.style[e],delete this._style[e];(function(){for(var t=Object.keys(i._style),e=!1,n=0;n<t.length;n++)if(g.contains(t[n])){e=!0;break}return e})()||(delete this.style.transform,delete this._style.transform,delete this.style[S("transform")],delete this._style[S("transform")])}else this.style[e]?(g.contains(e)&&(this.element.style[S("transform")]="",this.element.style.transform=""),this.element.style[S(e)]="",this.element.style[e]="",delete this.style[e]):console.log(e+" style does not exist")}return this}},{key:"transformEvent",value:function(t){var e=this;return function(i){t.apply(e,[i])}}},{key:"checkBreakpoints",value:function(){ var t=window.MultimediaObjectEditor?"parseInt(getComputedStyle(document.getElementById('"+Et.container+"')).width)":"window.innerWidth",e=window.MultimediaObjectEditor?"parseInt(getComputedStyle(document.getElementById('"+Et.container+"')).height)":"window.innerHeight",i=void 0;if(this.breakpoints.length>0){var n={};for(var s in this._style)n[s]=this._style[s];if(this.breakpoints.forEach(function(s){var a=[];for(var r in s.querie)"orientation"===r?a.push("landscape"===s.querie[r]?t+" > "+e:e+" > "+t):a.push((/height/.test(r)?e:t)+" "+(/min/.test(r)?">=":"<=")+" "+parseInt(s.querie[r],10));if(i="",a.forEach(function(t,e){i+=e>=1?" && "+t:t}),(i=new Function("return "+i))())for(var o in s.style)n[o]=s.style[o]}),this.computedAnimations.length>0)for(var a in this.computedAnimations[this.currentIteration])n[a]=this.computedAnimations[this.currentIteration][a];return this.applyStyle(n),i()||!1}return!1}},{key:"generate",value:function(t){var e=this;return this.element=document.createElement(d(t)),this.type=d(t),window.addEventListener("resize",function(){e.checkBreakpoints()}),mt.addListener("resize-scene",function(){e.checkBreakpoints()}),this}},{key:"appendElementTo",value:function(e){var i=this;if(e){e instanceof t?e.element.appendChild(this.element):e.appendChild(this.element),this.DOMParent=e;this.childs.length>0&&this.childs.forEach(function(t,e){t.DOMParent=i,t.appendElementTo(i)})}else{document.body.appendChild(this.element),this.DOMParent=document.body;this.childs.length>0&&this.childs.forEach(function(t,e){t.DOMParent=i,t.appendElementTo(i)})}return this.initializer&&this.initializer(),this}},{key:"add",value:function(e){return this.childs.push(e),e instanceof t?this.element.appendChild(e.element):this.element.appendChild(e),e.DOMParent=this,mt.dispatchEvent("actualize-DOM-elements"),this}},{key:"remove",value:function(e){var i=this.childs.indexOf(e);return i>=0&&(this.childs.splice(i,1),e instanceof t?this.element.removeChild(e.element):this.element.removeChild(e),e.DOMParent=null),mt.dispatchEvent("actualize-DOM-elements"),this}},{key:"getComputedStyle",value:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return getComputedStyle(this.element,null).getPropertyValue(t)})},{key:"preInterpolateStep",value:function(t){var e=this;this.getSortedSteps();var i=E(this.numericSteps),n=Math.floor(i*t);this.animatedProps={};for(var s=void 0,a=0;a<this.numericSteps.length;a++){var r=this.numericSteps[a].toFixed(2);for(var o in this.currentAnimation[r])if("easing"!==o){this.animatedProps[o]||(this.animatedProps[o]={},this.animatedProps[o].label=o,this.animatedProps[o].steps={}),this.animatedProps[o].steps[r]||(this.animatedProps[o].steps[r]={});var l=Object.keys(this.animatedProps[o].steps),u=l.length>1?l[l.length-2]:void 0;if(s=u?this.animatedProps[o].steps[u]:void 0,/color/gi.test(o)){var h=j(this.currentAnimation[r][o]);this.animatedProps[o].steps[r].startValue=s?s.endValue:this._style[o]?j(this._style[o]):{r:0,g:0,b:0},this.animatedProps[o].steps[r].unit="string"==typeof this.currentAnimation[r][o]?x(this.currentAnimation[r][o]||""):"",this.animatedProps[o].steps[r].endValue=h,this.animatedProps[o].steps[r].changeInValue={r:this.animatedProps[o].steps[r].endValue.r-this.animatedProps[o].steps[r].startValue.r,g:this.animatedProps[o].steps[r].endValue.g-this.animatedProps[o].steps[r].startValue.g,b:this.animatedProps[o].steps[r].endValue.b-this.animatedProps[o].steps[r].startValue.b,a:this.animatedProps[o].steps[r].endValue.a-this.animatedProps[o].steps[r].startValue.a},this.animatedProps[o].steps[r].initIteration=u?Math.floor(u*t):0,this.animatedProps[o].steps[r].totalStepIteration=Math.floor(r*t-this.animatedProps[o].steps[r].initIteration),this.animatedProps[o].steps[r].easing=this.currentAnimation[r].easing,this.animatedProps[o].steps[r].currentIteration=0}else/\d/g.test(this.currentAnimation[r][o])?(this.animatedProps[o].steps[r].startValue=parseFloat(s?s.endValue:this._style[o]?parseFloat(this._style[o]):0),this.animatedProps[o].steps[r].unit="string"==typeof this.currentAnimation[r][o]&&/px|%|vw|vh|deg/g.test(this.currentAnimation[r][o])?x(this.currentAnimation[r][o]||""):"",this.animatedProps[o].steps[r].endValue=parseFloat(this.currentAnimation[r][o]),this.animatedProps[o].steps[r].changeInValue=parseFloat(this.animatedProps[o].steps[r].endValue-this.animatedProps[o].steps[r].startValue),this.animatedProps[o].steps[r].initIteration=u?Math.floor(u*t):0,this.animatedProps[o].steps[r].totalStepIteration=Math.floor(r*t)-this.animatedProps[o].steps[r].initIteration,this.animatedProps[o].steps[r].easing=this.currentAnimation[r].easing,this.animatedProps[o].steps[r].currentIteration=0):(this.animatedProps[o].steps[r].startValue=s?s.endValue:this._style[o]?this._style[o]:"auto",this.animatedProps[o].steps[r].unit="",this.animatedProps[o].steps[r].endValue=this.currentAnimation[r][o],this.animatedProps[o].steps[r].changeInValue=this.animatedProps[o].steps[r].endValue,this.animatedProps[o].steps[r].initIteration=u?Math.floor(u*t):0,this.animatedProps[o].steps[r].totalStepIteration=Math.floor(r*t)-this.animatedProps[o].steps[r].initIteration,this.animatedProps[o].steps[r].easing=this.currentAnimation[r].easing,this.animatedProps[o].steps[r].currentIteration=0)}}this.computedAnimations=!this.computedAnimations||[];for(var d in this.animatedProps)if(function(t){return Object.keys(e._events).join().indexOf(t)>=0}(d))for(var c in this.animatedProps[d].steps){var p=Math.floor(Number(c)*this.fps);this.computedAnimations[p]||(this.computedAnimations[p]={}),this.computedAnimations[p][d]=this.animatedProps[d].steps[c].endValue}else for(var m=0;m<=n;m++){var b=Object.keys(this.animatedProps[d].steps),v=m/n*i,g=isFinite(v)?Number(v).toFixed(2):0,y=f(g,b);if(this.computedAnimations[m]||(this.computedAnimations[m]={}),/color/gi.test(d)){var w=this.animatedProps[d].steps[y].easing||"linearEase",k=this.animatedProps[d].steps[y].currentIteration,A=this.animatedProps[d].steps[y].startValue,P=this.animatedProps[d].steps[y].endValue,S=this.animatedProps[d].steps[y].changeInValue,O=this.animatedProps[d].steps[y].totalStepIteration,I=k<O?parseInt(ct[w](k,A.r,S.r,O)):P.r,L=k<O?parseInt(ct[w](k,A.g,S.g,O)):P.g,M=k<O?parseInt(ct[w](k,A.b,S.b,O)):P.b,R=k<O?Number(ct[w](k,A.a,S.a,O).toFixed(2)):P.a;this.computedAnimations[m][d]="rgba("+I+","+L+","+M+","+R+")"}else if(/\d/g.test(this.animatedProps[d].steps[y].startValue)){var F=this.animatedProps[d].steps[y].easing||"linearEase",_=this.animatedProps[d].steps[y].currentIteration,C=this.animatedProps[d].steps[y].startValue,T=this.animatedProps[d].steps[y].endValue,D=this.animatedProps[d].steps[y].changeInValue,U=this.animatedProps[d].steps[y].totalStepIteration,z=_<U-1?ct[F](_,C,D,U):T;this.computedAnimations[m][d]=z+this.animatedProps[d].steps[y].unit}else{var V=(this.animatedProps[d].steps[y].easing,this.animatedProps[d].steps[y].currentIteration),B=this.animatedProps[d].steps[y].startValue,X=this.animatedProps[d].steps[y].endValue,Y=(this.animatedProps[d].steps[y].changeInValue,this.animatedProps[d].steps[y].totalStepIteration),N=V<Y-1?B:X;this.computedAnimations[m][d]=N+this.animatedProps[d].steps[y].unit}m>=this.animatedProps[d].steps[y].initIteration&&this.animatedProps[d].steps[y].currentIteration<=this.animatedProps[d].steps[y].totalStepIteration&&this.animatedProps[d].steps[y].currentIteration++}return this}},{key:"interpolateStep",value:function(t,e,i){var n=this.computedAnimations.length;return n<=0&&this.preInterpolateStep(i),t<=1&&!this.animationStarted&&(mt.dispatchEvent(this.uuid+"-animationStart"),this.currentIteration=t,this.applyIteration()),n>t?(this.animated=!0,this.currentIteration=t,this.applyIteration(),this.checkBreakpoints()):t>n&&n>0&&this.applyIteration(this.computedAnimations[n-1]),n===t&&(this.stopAnimation(),this.currentIteration=n-1,mt.dispatchEvent(this.uuid+"-animationEnd")),this}},{key:"applyIteration",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.computedAnimations[this.currentIteration];if(t){var e=Object.create(t);for(var i in t)w(i)||(this.dispatchEvent(i,{value:t[i]}),delete e[i]);this.applyStyle(e)}}},{key:"restartAnimation",value:function(){this.stopAnimation(),this.counter=0,this.runAnimation()}},{key:"startAnimation",value:function(){this.runAnimation()}},{key:"stopAnimation",value:function(){this.animationStarted=!1,this.animated=!1,window.cancelAnimationFrame(this.rafID)}},{key:"runAnimation",value:function(t){var e=this;if(this.rafID=window.requestAnimationFrame(function(t){return e.runAnimation(t)}),Object.keys(this.currentAnimation).length>0)if(this.now=performance.now()||Date.now(),this.delta=this.now-this.then,this.animationStarted){if(this.delta>this.interval){this.then=this.now-this.delta%this.interval,this.reverse?(this.counter<=0&&(this.counter=this.totalIteration),this.counter--):this.counter++;var i=performance.now()||Date.now(),n=(new Date(i-this.startTime),this.counter/this.totalIteration*this.totalTime);this.secondsElapsed=isFinite(n)?Number(n).toFixed(2):0,this.interpolateStep(this.counter,this.secondsElapsed,this.fps),this.counter>=this.totalIteration&&!this.reverse?this.repeat>0&&this.repeatCounter<this.repeat&&(this.counter=0,this.repeatCounter++):1==this.counter&&this.reverse&&this.repeat>0&&this.repeatCounter<this.repeat&&(this.counter=0,this.repeatCounter++)}}else this.animationStarted=!0,this.totalTime=Number(this.getSortedSteps()[this.getSortedSteps().length-1]),this.totalIteration=this.totalTime*this.fps;else this.stopAnimation()}},{key:"addListener",value:function(t,e,i){return i=i||/global/gi.test(t),i?mt.addListener(t,e):mt.addListener(this.uuid+"-"+t,e)}},{key:"removeListener",value:function(t,e,i){return i=i||/global/gi.test(t),i?e instanceof Function?mt.removeListener(t,e):mt.removeListener(t,this[e]):e instanceof Function?mt.removeListener(this.uuid+"-"+t,e):mt.removeListener(this.uuid+"-"+t,this[e])}},{key:"dispatchEvent",value:function(t,e,i){return i=i||/global/gi.test(t),i?mt.dispatchEvent(t,e,this):mt.dispatchEvent(this.uuid+"-"+t,e,this)}},{key:"changeAnimation",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";this.selectedAnimation=t,this.computedSteps=[],this.currentAnimation=this.animations[this.selectedAnimation]||{},this.animations[this.selectedAnimation]=this.animations[this.selectedAnimation]||this.currentAnimation,this.applyStyle(this._style),this.stopAnimation(),this.preInterpolateStep(this.timeline?this.timeline.fps:this.fps),this.timeline&&(this.timeline.computeSteps(),this.timeline.stop())}},{key:"addAnimationProperties",value:function(t,e){var i=this,n=Object.keys(this.animatedProps),s=e||(this.timeline?Number(this.timeline.secondsElapsed):0);return s=0===s?0:s,t.forEach(function(t){var e=t.key||t,a=t.value||i._style[e]||0;n.indexOf(e)===-1&&(i.currentAnimation[s]||(i.currentAnimation[s]={}),i.currentAnimation[s][e]=a)}),this.animations[this.selectedAnimation]=this.currentAnimation,this.preInterpolateStep(this.timeline?this.timeline.fps:this.fps),this}},{key:"deleteAnimationProperties",value:function(t){var e=this;return t.forEach(function(t,i){for(var n in e.currentAnimation)for(var s in e.currentAnimation[n])s===t&&delete e.currentAnimation[n][s]}),this.animations[this.selectedAnimation]=this.currentAnimation,this.preInterpolateStep(this.timeline.fps||this.fps),this}},{key:"deleteAnimationKeyframe",value:function(t,e){return this.currentAnimation[t]?(e?delete this.currentAnimation[t][e]:delete this.currentAnimation[t],1===Object.keys(this.currentAnimation[t]).length&&delete this.currentAnimation[t],this.animations[this.selectedAnimation]=this.currentAnimation,this.preInterpolateStep(this.timeline.fps||this.fps)):console.log("animation at "+t+" don't exist"),this}},{key:"addAnimationKeyframe",value:function(t,e,i,n){return this.currentAnimation[t]||(this.currentAnimation[t]={}),this.currentAnimation[t][e]=i,n&&(this.currentAnimation[t].easing=n),this.animations[this.selectedAnimation]=this.currentAnimation,this.preInterpolateStep(this.timeline.fps||this.fps),this}},{key:"getSortedSteps",value:function(){var t=Object.keys(this.currentAnimation).map(function(t,e){return parseFloat(t)});t.sort(function(t,e){return t-e}),this.numericSteps=t;for(var e in this.currentAnimation)/\d\.\d{2}/.test(e)?0===Object.keys(this.currentAnimation[e]).length&&delete this.currentAnimation[e]:(this.currentAnimation[parseFloat(e).toFixed(2)]=this.currentAnimation[e],delete this.currentAnimation[e]);return this.numericSteps}},{key:"getTotalAnimationTime",value:function(){return this.getSortedSteps(),this.totalAnimationTime=E(this.numericSteps),this.totalAnimationTime}},{key:"exportToJSON",value:function(){var t={};t.exportedEvents={},t.exportedFunctions={},t.childs=[];for(var e in this)void 0!==this[e]&&null!==this[e]&&("function"==typeof this[e]||this[e].element||this[e].children||this[e].elements||/exportedFunctions|exportedEvents|childs|interval|then|now|delta|animated|animationStarted|currentIteration|computedAnimations|totalTime|secondsElapsed|rafID|numericSteps|counter|totalIteration|animationStarted|direction|coords|bounds|geo|infowindow|map|marker|shop/.test(e)||(t[e]=this[e]));for(var i in this.events){var n=this.events[i].toString(),s=n.slice(n.indexOf("(")+1,n.indexOf(")")).split(","),a=n.slice(n.indexOf("{")+1,n.lastIndexOf("}"));t.exportedEvents[i]={args:s.map(function(t){return t.replace(/\s+|\n+|(\/\*\*\/\n)+/g,"")}),body:a}}for(var r in this.functions){var o=this.functions[r].toString(),l=o.slice(o.indexOf("(")+1,o.indexOf(")")).split(","),u=o.slice(o.indexOf("{")+1,o.lastIndexOf("}"));t.exportedFunctions[r]={args:l.map(function(t){return t.replace(/\s+|\n+|(\/\*\*\/\n)+/g,"")}),body:u}}return this.childs.forEach(function(e){t.childs.push(e.exportToJSON())}),t.style=this._style,t.attributes=this.attributes,t.breakpoints=this.breakpoints,t.globalStyle=this.globalStyle,t.data=this.data||{},t.currentAnimation=this.currentAnimation,t.load=!0,t.type=this.type,t.data.absoluteAssetURL=this.data.absoluteAssetURL||"./",t}},{key:"setAbsoluteAssetURL",value:function(t){window[Et.namespace]&&t&&t.data?void 0!==window[Et.namespace].absoluteAssetURL&&"undefined"!==window[Et.namespace].absoluteAssetURL&&""!==window[Et.namespace].absoluteAssetURL?this.data.absoluteAssetURL=window[Et.namespace].absoluteAssetURL:void 0!==t.data.absoluteAssetURL&&""!==t.data.absoluteAssetURL&&"./"!==t.data.absoluteAssetURL?window[Et.namespace].absoluteAssetURL=t.data.absoluteAssetURL:this.data.absoluteAssetURL="./":this.data.absoluteAssetURL=t&&t.data&&void 0!==t.data.absoluteAssetURL&&""!==t.data.absoluteAssetURL?t.data.absoluteAssetURL:"./"}},{key:"loadFromJSON",value:function(e){var i=this;for(var n in e)"animations"!==n||e.animations.default?this[n]=e[n]:(this.currentAnimation=e.animations,this.animations={},this.animations.default=e.animations);for(var s in e.exportedEvents){var a=e.exportedEvents[s].args.map(function(t){return t.replace(/\s+|\n+|(\/\*\*\/\n)+/g,"")}),r=e.exportedEvents[s].body;this.events[s]=new Function(a,r)}for(var o in e.exportedFunctions){var l=e.exportedFunctions[o].args.map(function(t){return t.replace(/\s+|\n+|(\/\*\*\/\n)+/g,"")}),u=e.exportedFunctions[o].body;this.functions[o]=new Function(l,u)}e.childs&&e.childs.forEach(function(n,s){n.load=!0,e.data&&(n.data=n.data||{},n.data.autostart=p(n.data.autostart),n.data.absoluteAssetURL=n.data.absoluteAssetURL||""),n.DOMParent=i,i.childs[s]=new t(n)}),this.uuid=L(),this.data=e.data||{},this.type=e.type,this.data.absoluteAssetURL=e.data&&e.data.absoluteAssetURL?e.data.absoluteAssetURL:"",this.data.autostart=!e.data||p(e.data.autostart),this.setAbsoluteAssetURL(e)}}]),t}()}();