UNPKG

@aarsteinmedia/dotlottie-player

Version:

Web Component for playing Lottie animations in your web app.

4 lines 240 kB
!function(t){"use strict";let e,s,i,r,a=(s=0,()=>(s++,`__lottie_element_${s}`));var n,o,h,l,m,p,d,c,u,f,g,y,b,v,_=((n={}).Bounce="bounce",n.Normal="normal",n),w=((o={}).Complete="complete",o.Destroyed="destroyed",o.Error="error",o.Frame="frame",o.Freeze="freeze",o.Load="load",o.Loop="loop",o.Next="next",o.Pause="pause",o.Play="play",o.Previous="previous",o.Ready="ready",o.Rendered="rendered",o.Stop="stop",o),S=((h={}).Contain="xMidYMid meet",h.Cover="xMidYMid slice",h.Initial="none",h.None="xMinYMin slice",h),E=((l={}).Canvas="canvas",l.HTML="html",l.SVG="svg",l);let k=!("undefined"!=typeof window&&document);class M{constructor(t,e,s,i){this.type=t,this.currentTime=e,this.totalTime=s,this.direction=i<0?-1:1}}class x{constructor(t,e){this.type=t,this.direction=e<0?-1:1}}class P{constructor(t,e,s,i){this.type=t,this.direction=s,this.currentTime=e,this.totalTime=i}}class C{constructor(t,e,s,i){this.type=t,this.currentLoop=s,this.totalLoops=e,this.direction=i<0?-1:1}}class A{constructor(t,e,s){this.type=t,this.firstFrame=e,this.totalFrames=s}}class T{constructor(t,e){this.type=t,this.target=e}}class D{constructor(t,e){this.type="renderFrameError",this.nativeError=t,this.currentTime=e}}class I{constructor(t,e){this.type="configError",this.nativeError=t}}class F{addEventListener(t,e){return this._cbs[t]=this._cbs[t]??[],this._cbs[t].push(e),()=>{this.removeEventListener(t,e)}}removeEventListener(t,e){if(!e){this._cbs[t]=null;return}if(this._cbs[t]){let s=0,{length:i}=this._cbs[t];for(;s<i;)this._cbs[t][s]===e&&(this._cbs[t].splice(s,1),s--,i--),s++;0===this._cbs[t].length&&(this._cbs[t]=null)}}triggerEvent(t,e){if(!this._cbs[t])return;let{length:s}=this._cbs[t];for(let i=0;i<s;i++)this._cbs[t][i]?.(e)}constructor(){this._cbs={}}}var L=((m={}).Float32="float32",m.Int16="int16",m.Int32="int32",m.Uint8="uint8",m.Uint8c="uint8c",m),N=((p={}).MouseModifier="ms",p.OffsetPathModifier="op",p.PuckerAndBloatModifier="pb",p.RepeaterModifier="rp",p.RoundCornersModifier="rd",p.TrimModifier="tm",p.ZigZagModifier="zz",p),$=((d={}).Canvas="canvas",d.HTML="html",d.SVG="svg",d),V=((c={}).Ellipse="el",c.Fill="fl",c.GradientFill="gf",c.GradientStroke="gs",c.Group="gr",c.Merge="mm",c.NoStyle="no",c.OffsetPath="op",c.Path="sh",c.PolygonStar="sr",c.PuckerBloat="pb",c.Rectangle="rc",c.Repeater="rp",c.RoundedCorners="rd",c.Stroke="st",c.Transform="tr",c.Trim="tm",c.Twist="tw",c.Unknown="ms",c.ZigZag="zz",c),O=((u={}).TransformEffect="transformEffect",u),z=((f={}).MultiDimensional="multidimensiional",f.Shape="shape",f.TextSelector="textSelector",f.Transform="transform",f.UniDimensional="unidimensional",f);let R={1:"butt",2:"round",3:"square"},B={1:"miter",2:"round",3:"bevel"},q={},j=(t,e)=>1e5*Math.abs(t-e)<=Math.min(Math.abs(t),Math.abs(e)),H=t=>1e-5>=Math.abs(t),G=(t,e)=>j(t[0],e[0])&&j(t[1],e[1]),W=(i=0,()=>(i++,`__lottie_element_${i}`)),U=t=>Symbol.iterator in Object(t)&&t.length>0,Y=t=>U(t)&&"number"==typeof t[0],X=t=>!(!t||U(t))&&"_type"in t&&"ShapePath"===t._type,J=Math.PI/180,Z="http://www.w3.org/1999/xlink",K="http://www.w3.org/2000/svg",Q=!("undefined"!=typeof window&&document),tt="undefined"!=typeof navigator,te=!!tt&&/^(?:(?!chrome|android).)*safari/i.test(navigator.userAgent);class ts{constructor(t){this.audios=[],this.audioFactory=t,this._volume=1,this._isMuted=!1}addAudio(t){this.audios.push(t)}createAudio(t){return this.audioFactory?this.audioFactory(t):!Q&&"Howl"in window?new window.Howl({src:[t]}):{isPlaying:!1,play:()=>{this.isPlaying=!0},playing:()=>{throw Error(`${this.constructor.name}: Method playing is not implemented`)},rate:()=>{throw Error(`${this.constructor.name}: Method rate is not implemented`)},seek:()=>{this.isPlaying=!1},setVolume:()=>{throw Error(`${this.constructor.name}: Method setVolume is not implemented`)}}}getVolume(){return this._volume}mute(){this._isMuted=!0,this._updateVolume()}pause(){for(let t of this.audios)t.pause()}resume(){for(let t of this.audios)t.resume()}setAudioFactory(t){this.audioFactory=t}setRate(t){for(let e of this.audios)e.setRate(t)}setVolume(t){this._volume=t,this._updateVolume()}unmute(){this._isMuted=!1,this._updateVolume()}_updateVolume(){let{length:t}=this.audios;for(let e=0;e<t;e++)this.audios[e]?.volume(!this._isMuted*this._volume)}}function ti(t,e,s,i){let r,a=new XMLHttpRequest;try{a.responseType="json"}catch(t){}a.onreadystatechange=()=>{if(4===a.readyState){if(200===a.status)return void s(r=tr(a));try{r=tr(a),s(r)}catch(t){i?.(t)}}};try{a.open("GET",t,!0)}catch(s){a.open("GET",`${e}/${t}`,!0)}a.send()}function tr(t){let e=t.getResponseHeader("content-type");return e&&"json"===t.responseType&&e.includes("json")||t.response&&"object"==typeof t.response?t.response:t.response&&"string"==typeof t.response?JSON.parse(t.response):t.responseText?JSON.parse(t.responseText):null}function ta(t,e){let s,{length:i}=t;for(let a=0;a<i;a++)if("ks"in(s=t[a])&&!s.completed){if(s.completed=!0,s.hasMask){let t=s.masksProperties,{length:e}=t??[];for(let s=0;s<e;s++){let e=t?.[s]?.pt?.k;if(!e)continue;if(!U(e)){th(e);continue}let{length:i}=e;for(let t=0;t<i;t++){let s=e[t]?.e??[],i=e[t]?.s??[];s.length>0&&th(s[0]),i.length>0&&th(i[0])}}}switch(s.ty){case 0:s.layers=tn(s.refId,e),ta(s.layers,e);break;case 4:to(s.shapes);break;case 5:var r;r=s,r.t?.a?.length===0&&r.t.p}}}function tn(t,e){if(!t||!e)return;let s=function(t,e){let s=0,{length:i}=e;for(;s<i;){if(e[s]?.id===t)return e[s];s++}return null}(t,e);return s?.layers?s.layers.__used?JSON.parse(JSON.stringify(s.layers)):(s.layers.__used=!0,s.layers):null}function to(t=[]){let{length:e}=t;for(let s=e-1;s>=0;s--){if(t[s]?.ty===V.Group){to(t[s]?.it);continue}if(t[s]?.ty===V.Path){let e=t[s]?.ks?.k;if(!U(e)){th(e);continue}let{length:i}=e;for(let t=0;t<i;t++){let s=e[t]?.e,i=e[t]?.s;s&&th(s[0]),i&&th(i[0])}}}}function th(t){if(!t)return;let{length:e}=t.i;for(let s=0;s<e;s++)t.i[s][0]+=t.v[s]?.[0]??0,t.i[s][1]+=t.v[s]?.[1]??0,t.o[s][0]+=t.v[s]?.[0]??0,t.o[s][1]+=t.v[s]?.[1]??0}function tl(t,e){let s=e?e.split(".").map(Number):[100,100,100];return t[0]>s[0]||!(s[0]>t[0])&&(t[1]>s[1]||!(s[1]>t[1])&&(t[2]>s[2]||!(s[2]>t[2])&&null))}let tm=(t,e,s)=>{let{length:i}=t;for(let r=0;r<i;r++)t[r]?.ty===s&&e(t[r])},tp=(()=>{let t=[4,4,14],e=t=>{let e=t.t?.d;t.t&&e&&(t.t.d={k:[{s:e,t:0}]})};return s=>{if(!tl(t,s.v))return;tm(s.layers,e,5);let{length:i}=s.assets;for(let t=0;t<i;t++)s.assets[t]?.layers&&tm(s.assets[t]?.layers,e,5)}})(),td=(()=>{let t=[4,7,99];return e=>{if(!e.chars||tl(t,e.v))return;let{length:s}=e.chars;for(let t=0;t<s;t++){let s=e.chars[t];s?.data?.shapes&&(to(s.data.shapes),s.data.ip=0,s.data.op=99999,s.data.st=0,s.data.sr=1,s.data.ks={a:{a:0,k:[0,0]},o:{a:0,k:100},p:{a:0,k:[0,0]},r:{a:0,k:0},s:{a:0,k:[100,100]}},e.chars[t]?.t||(s.data.shapes.push({ty:V.NoStyle}),s.data.shapes[0]?.it?.push({a:{a:0,k:[0,0]},o:{a:0,k:100},p:{a:0,k:[0,0]},r:{a:0,k:0},s:{a:0,k:[100,100]},sa:{a:0,k:0},sk:{a:0,k:0},ty:V.Transform})))}}})(),tc=(()=>{let t=[5,7,15],e=t=>{let e=t.t?.p;e&&("number"==typeof e.a&&(e.a={a:0,k:e.a}),"number"==typeof e.p&&(e.p={a:0,k:e.p}),"number"==typeof e.r&&(e.r={a:0,k:e.r}))};return s=>{if(!tl(t,s.v))return;tm(s.layers,e,5);let{length:i}=s.assets;for(let t=0;t<i;t++)s.assets[t]?.layers&&tm(s.assets[t]?.layers,e,5)}})(),tu=(()=>{let t=[4,1,9],e=t=>{let{length:s}=t;for(let i=0;i<s;i++){if(t[i]?.ty===V.Group){e(t[i]?.it??[]);continue}if(t[i]?.ty!==V.Fill&&t[i]?.ty!==V.Stroke)continue;let s=t[i]?.c?.k;if(!s||"number"==typeof s)continue;if(Y(s)&&s.length>=4){s[0]/=255,s[1]/=255,s[2]/=255,s[3]/=255;continue}let{length:r}=s;for(let t=0;t<r;t++){let e=s[t];e.s[0]/=255,e.s[1]/=255,e.s[2]/=255,e.s[3]/=255,e.e[0]/=255,e.e[1]/=255,e.e[2]/=255,e.e[3]/=255}}},s=t=>{let{length:s}=t;for(let i=0;i<s;i++)t[i]?.ty===4&&e(t[i]?.shapes??[])};return e=>{if(!tl(t,e.v))return;s(e.layers);let{length:i}=e.assets;for(let t=0;t<i;t++)e.assets[t]?.layers&&s(e.assets[t]?.layers)}})(),tf=(()=>{let t=[4,4,18],e=t=>{let{length:s}=t;for(let i=s-1;i>=0;i--){if(t[i]?.ty===V.Group){e(t[i]?.it??[]);continue}if(t[i]?.ty!==V.Path)continue;let s=t[i]?.ks?.k;if(!s)continue;let r=!!t[i]?.closed;if(!U(s)){s.c=r;continue}let{length:a}=s;for(let t=0;t<a;t+=1){let e=s[t]?.e??[],i=s[t]?.s??[];e.length>0&&(e[0].c=r),i.length>0&&(i[0].c=r)}}},s=t=>{let s,{length:i}=t;for(let r=0;r<i;r++){if(s=t[r],s?.hasMask){let t=s.masksProperties,{length:e}=t??[];for(let s=0;s<e;s++){let e=t?.[s]?.pt?.k;if(!e)continue;let i=!!t[s]?.cl;if(!U(e)){e.c=i;continue}let{length:r}=e;for(let t=0;t<r;t++){let s=e[t]?.e??[],r=e[t]?.s??[];s.length>0&&(s[0].c=i),r.length>0&&(r[0].c=i)}}}s?.ty===4&&e(s.shapes)}};return e=>{if(!tl(t,e.v))return;s(e.layers);let{length:i}=e.assets;for(let t=0;t<i;t++)e.assets[t]?.layers&&s(e.assets[t]?.layers)}})(),tg={checkChars:td,checkColors:tu,checkPathProperties:tc,checkShapes:tf,completeData:function(t){t.__complete||(tu(t),tp(t),td(t),tc(t),tf(t),ta(t.layers,t.assets),function(t,e){if(!t)return;let{length:s}=t;for(let i=0;i<s;i++){if(t[i]?.t!==1)continue;let{data:s}=t[i]??{};s&&(s.layers=tn(s.refId,e)),ta(t[i]?.data?.layers??[],e)}}(t.chars,t.assets),t.__complete=!0)},completeLayers:ta},ty=1,tb,tv="Function not implemented.",t_={addEventListener:(t,e,s)=>{throw Error(tv)},dispatchEvent:t=>{throw Error(tv)},onerror:null,onmessage:t=>{throw Error("workerProxy: Method onmessage not implemented")},onmessageerror:null,postMessage:t=>{tb({data:t})},removeEventListener:(t,e,s)=>{throw Error(tv)},terminate:()=>{throw Error(tv)}},tw={postMessage:t=>{t_.onmessage&&t_.onmessage({AT_TARGET:2,bubbles:!1,BUBBLING_PHASE:3,cancelable:!1,cancelBubble:!1,CAPTURING_PHASE:1,composed:!1,composedPath:()=>{throw Error(tv)},currentTarget:null,data:t,defaultPrevented:!1,eventPhase:0,initEvent:(t,e,s)=>{throw Error(tv)},initMessageEvent:(t,e,s,i,r,a,n,o)=>{throw Error(tv)},isTrusted:!1,lastEventId:"",NONE:0,origin:"",ports:[],preventDefault:()=>{throw Error(tv)},returnValue:!1,source:null,srcElement:null,stopImmediatePropagation:()=>{throw Error(tv)},stopPropagation:()=>{throw Error(tv)},target:null,timeStamp:0,type:""})}},tS={};function tE(){e||(tb=t=>{if(tw.dataManager=tw.dataManager??tg,"loadAnimation"===t.data.type)return void ti(t.data.path,t.data.fullPath,e=>{e&&tg.completeData(e),tw.postMessage({id:t.data.id,payload:e,status:"success"})},()=>{tw.postMessage({id:t.data.id,status:"error"})});if("complete"===t.data.type){let{animation:e,id:s}=t.data;tg.completeData(e),tw.postMessage({id:s,payload:e,status:"success"});return}"loadData"===t.data.type&&ti(t.data.path,t.data.fullPath,e=>{tw.postMessage({id:t.data.id,payload:e,status:"success"})},()=>{tw.postMessage({id:t.data.id,status:"error"})})},(e=t_).onmessage=({data:t})=>{let{id:e,payload:s,status:i}=t,r=tS[e];if(tS[e]=null,"success"===i)return void r?.onComplete(s);r?.onError&&r.onError()})}function tk(t,e){ty++;let s=`processId_${ty}`;try{return tS[s]={onComplete:t,onError:e},s}catch(t){throw console.error("DataManager}:\n",t),Error("Could not create animation proccess")}}function tM(t,s,i){tE();let r=tk(s,i);e?.postMessage({fullPath:Q?t:window.location.origin+window.location.pathname,id:r,path:t,type:"loadData"})}function tx(t,s,i){tE();let r=tk(s,i);e?.postMessage({animation:t,id:r,type:"complete"})}class tP{getComposition(t){let e=0,{length:s}=this.compositions;for(;e<s;){if(this.compositions[e]?.data&&this.compositions[e]?.data?.nm===t)return this.compositions[e]?.data?.xt&&this.compositions[e]?.prepareFrame(this.currentFrame),this.compositions[e]?.compInterface;e++}return null}registerComposition(t){this.compositions.push(t)}constructor(){this.compositions=[],this.currentFrame=0}}function tC(t){return Q?null:document.createElement(t)}function tA(t){return Q?null:document.createElementNS(K,t)}class tT{constructor(){this._imageLoaded=this.imageLoaded.bind(this),this._footageLoaded=this.footageLoaded.bind(this),this.testImageLoaded=this.testImageLoaded.bind(this),this.createFootageData=this.createFootageData.bind(this),this.assetsPath="",this.path="",this.totalImages=0,this.totalFootages=0,this.loadedAssets=0,this.loadedFootagesCount=0,this.imagesLoadedCb=null,this.images=[],this.proxyImage=this._createProxyImage()}createFootageData(t){let e={assetData:t,img:null};return tM(this.getAssetsPath(t,this.assetsPath,this.path),t=>{t&&(e.img=t),this._footageLoaded()},()=>{this._footageLoaded()}),e}createImageData(t){let e=this.getAssetsPath(t,this.assetsPath,this.path),s=tA("image"),i={assetData:t,img:s};return te?this.testImageLoaded(s):s.addEventListener("load",this._imageLoaded,!1),s.addEventListener("error",()=>{this.proxyImage&&(i.img=this.proxyImage),this._imageLoaded()},!1),s.setAttributeNS(Z,"href",e),this._elementHelper?.append?this._elementHelper.append(s):this._elementHelper?.appendChild(s),i}destroy(){this.imagesLoadedCb=null,this.images.length=0}footageLoaded(){this.loadedFootagesCount++,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}getAsset(t){let e=0,{length:s}=this.images;for(;e<s;){if(this.images[e]?.assetData===t)return this.images[e]?.img??null;e++}return null}imageLoaded(){this.loadedAssets++,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}loadAssets(t,e){this.imagesLoadedCb=e;let{length:s}=t;for(let e=0;e<s;e++)if(!t[e]?.layers){if((!t[e]?.t||t[e]?.t==="seq")&&this._createImageData){this.totalImages++;let s=this._createImageData(t[e]);s&&this.images.push(s);continue}3===Number(t[e]?.t)&&(this.totalFootages++,this.images.push(this.createFootageData(t[e])))}}loadedFootages(){return this.totalFootages===this.loadedFootagesCount}loadedImages(){return this.totalImages===this.loadedAssets}setAssetsPath(t){this.assetsPath=t||""}setCacheType(t,e){t===$.SVG?(this._elementHelper=e,this._createImageData=this.createImageData.bind(this)):this._createImageData=this.createImgData.bind(this)}setPath(t){this.path=t||""}_createProxyImage(){if(Q)return null;let t=tC($.Canvas);t.width=1,t.height=1;let e=t.getContext("2d");return e&&(e.fillStyle="rgba(0,0,0,0)",e.fillRect(0,0,1,1)),t}createImgData(t){let e=this.getAssetsPath(t,this.assetsPath,this.path),s=tC("img"),i={assetData:t,img:s};return s.crossOrigin="anonymous",s.addEventListener("load",this._imageLoaded,!1),s.addEventListener("error",()=>{this.proxyImage&&(i.img=this.proxyImage),this._imageLoaded()},!1),s.src=e,i}getAssetsPath(t,e,s){if(t.e)return t.p||"";if(e){let s=t.p;return s?.indexOf("images/")!==-1&&(s=s?.split("/")[1]),`${e}${s||""}`}let i=s;return i+=t.u??"",i+=t.p??""}testImageLoaded(t){if(Q)return;let e=0,s=setInterval(()=>{(t.getBBox().width||e>500)&&(this._imageLoaded(),clearInterval(s)),e++},50)}}let tD=t=>{let e=t.split("\r\n"),s={},{length:i}=e,r=0;for(let t=0;t<i;t++){let i=e[t]?.split(":")??[];2===i.length&&(s[i[0]]=i[1]?.trim(),r++)}if(0===r)throw Error("Could not parse markers");return s};class tI extends F{constructor(){super(),this.wrapper=null,this.autoloadSegments=!1,this.onComplete=null,this.onDestroy=null,this.onEnterFrame=null,this.onLoopComplete=null,this.onSegmentStart=null,this._cbs={},this.name="",this.path="",this.isLoaded=!1,this.currentFrame=0,this.currentRawFrame=0,this.firstFrame=0,this.totalFrames=0,this.frameRate=60,this.frameMult=0,this.playSpeed=1,this.playDirection=1,this.frameModifier=1,this.playCount=0,this.animationData={},this.assets=[],this.isPaused=!0,this.autoplay=!1,this.loop=!0,this.renderer=null,this.animationID=W(),this.assetsPath="",this.timeCompleted=0,this.segmentPos=0,this.isSubframeEnabled=!0,this.segments=[],this._idle=!0,this._completedLoop=!1,this.projectInterface=new tP,this.imagePreloader=new tT,this.audioController=new ts(void 0),this.markers=[],this.configAnimation=this.configAnimation.bind(this),this.onSetupError=this.onSetupError.bind(this),this.onSegmentComplete=this.onSegmentComplete.bind(this),this.drawnFrameEvent=new M("drawnFrame",0,0,0),this.expressionsPlugin=null}adjustSegment(t,e){this.playCount=0,t[1]<t[0]?(this.frameModifier>0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=t[0]-t[1],this.timeCompleted=this.totalFrames,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.totalFrames=t[1]-t[0],this.timeCompleted=this.totalFrames,this.firstFrame=t[0],this.setCurrentRawFrameValue(.001+e)),this.trigger("segmentStart")}advanceTime(t){if(this.isPaused||!this.isLoaded)return;let e=this.currentRawFrame+t*this.frameModifier,s=!1;e>=this.totalFrames-1&&this.frameModifier>0?this.loop&&this.playCount!==this.loop?e>=this.totalFrames?(this.playCount++,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)||(s=!0,e=this.totalFrames-1):e<0?this.checkSegments(e%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&!0!==this.loop)?(this.setCurrentRawFrameValue(this.totalFrames+e%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0):(s=!0,e=0)):this.setCurrentRawFrameValue(e),s&&(this.setCurrentRawFrameValue(e),this.pause(),this.trigger("complete"))}checkLoaded(){!this.isLoaded&&this.renderer.globalData?.fontManager?.isLoaded&&(this.imagePreloader?.loadedImages()||this.renderer.rendererType!==$.Canvas)&&this.imagePreloader?.loadedFootages()&&(this.isLoaded=!0,this.renderer.initItems(),setTimeout(()=>{this.trigger("DOMLoaded")},0),this.gotoFrame(),this.autoplay&&this.play())}checkSegments(t){return this.segments.length>0&&(this.adjustSegment(this.segments.shift()??[0,0],t),!0)}configAnimation(t){try{this.animationData=t,this.initialSegment?(this.totalFrames=Math.floor(this.initialSegment[1]-this.initialSegment[0]),this.firstFrame=Math.round(this.initialSegment[0])):(this.totalFrames=Math.floor((this.animationData.op||1)-(this.animationData.ip||0)),this.firstFrame=Math.round(this.animationData.ip||0)),this.renderer.configAnimation(t),this.assets=this.animationData.assets,this.frameRate=this.animationData.fr,void 0!==this.animationData.fr&&(this.frameMult=this.animationData.fr/1e3),this.renderer.searchExtraCompositions(t.assets),this.markers=function(t){let e=[],{length:s}=t;for(let i=0;i<s;i++){if("duration"in(t[i]??{})){e.push(t[i]);continue}let s={duration:t[i].dr,time:t[i].tm};try{s.payload=JSON.parse(t[i].cm)}catch(e){try{s.payload=tD(t[i].cm)}catch(e){s.payload={name:t[i].cm}}}e.push(s)}return e}(t.markers??[]),this.trigger("config_ready"),this.preloadImages(),this.loadSegments(),this.updaFrameModifier(),this.waitForFontsLoaded(),this.isPaused&&this.audioController.pause()}catch(t){this.triggerConfigError(t)}}destroy(t){t&&this.name!==t||(this.renderer.destroy(),this.imagePreloader?.destroy(),this.trigger("destroy"),this._cbs={},this.onEnterFrame=null,this.onLoopComplete=null,this.onComplete=null,this.onSegmentStart=null,this.onDestroy=null,this.renderer=null,this.expressionsPlugin=null,this.imagePreloader=null,this.projectInterface=null)}getAssetData(t){let e=0,{length:s}=this.assets;for(;e<s;){if(t===this.assets[e]?.id)return this.assets[e];e++}return null}getAssetsPath(t){let e;if(!t)return"";if(t.e)e=t.p||"";else if(this.assetsPath){let s=t.p;s?.indexOf("images/")!==-1&&(s=s?.split("/")[1]),e=this.assetsPath+(s||"")}else e=this.path+(t.u??"")+(t.p??"");return e}getDuration(t){return t?this.totalFrames:this.totalFrames/this.frameRate}getMarkerData(t){for(let e=0;e<this.markers.length;e++)if(this.markers[e]?.payload?.name===t)return this.markers[e];return null}getPath(){return this.path}getVolume(){return this.audioController.getVolume()}goToAndPlay(t,e,s){if(s&&this.name!==s)return;let i=Number(t);if(isNaN(i)){let e=this.getMarkerData(t);e&&(e.duration?this.playSegments([e.time,e.time+e.duration],!0):this.goToAndStop(e.time,!0))}else this.goToAndStop(i,e,s);this.play()}goToAndStop(t,e,s){if(!s||this.name===s){if(isNaN(Number(t))){let e=this.getMarkerData(t);e&&this.goToAndStop(e.time,!0)}else e?this.setCurrentRawFrameValue(t):this.setCurrentRawFrameValue(t*this.frameModifier);this.pause()}}gotoFrame(){this.currentFrame=this.isSubframeEnabled?this.currentRawFrame:~~this.currentRawFrame,this.timeCompleted!==this.totalFrames&&this.currentFrame>this.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")}hide(){this.renderer.hide()}imagesLoaded(){this.trigger("loaded_images"),this.checkLoaded()}includeLayers(t){this.animationData.op&&t.op>this.animationData.op&&(this.animationData.op=t.op,this.totalFrames=Math.floor(t.op-(this.animationData.ip||0)));let{assets:e,layers:s}=this.animationData,i,{length:r}=s,a=t.layers,{length:n}=a;for(let t=0;t<n;t++)for(i=0;i<r;){if(s[i]?.id===a[t]?.id){s[i]=a[t];break}i++}for((t.chars||t.fonts)&&(this.renderer.globalData?.fontManager?.addChars(t.chars),this.renderer.globalData?.fontManager?.addFonts(t.fonts,this.renderer.globalData.defs)),r=t.assets.length,i=0;i<r;i++)e.push(t.assets[i]);this.animationData.__complete=!1,tx(this.animationData,this.onSegmentComplete)}loadNextSegment(){let{segments:t}=this.animationData;if(!t||0===t.length||!this.autoloadSegments){this.trigger("data_ready"),this.timeCompleted=this.totalFrames;return}let e=t.shift();this.timeCompleted=Number(e?.time)*this.frameRate;let s=`${this.path+(this.fileName||"")}_${this.segmentPos}.json`;this.segmentPos++,tM(s,this.includeLayers.bind(this),()=>{this.trigger("data_failed")})}loadSegments(){let{segments:t}=this.animationData;t||(this.timeCompleted=this.totalFrames),this.loadNextSegment()}mute(t){t&&this.name!==t||this.audioController.mute()}onSegmentComplete(t){this.animationData=t,this.loadNextSegment()}onSetupError(){this.trigger("data_failed")}pause(t){(!t||this.name===t)&&(this.isPaused||(this.isPaused=!0,this.trigger("_pause"),this._idle=!0,this.trigger("_idle"),this.audioController.pause()))}play(t){(!t||this.name===t)&&this.isPaused&&(this.isPaused=!1,this.trigger("_play"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))}playSegments(t,e){if(e&&(this.segments.length=0),U(t[0])){let{length:e}=t;for(let s=0;s<e;s++)this.segments.push(t[s])}else this.segments.push(t);this.segments.length>0&&e&&this.adjustSegment(this.segments.shift()??[0,0],0),this.isPaused&&this.play()}preloadImages(){this.imagePreloader&&(this.imagePreloader.setAssetsPath(this.assetsPath),this.imagePreloader.setPath(this.path),this.imagePreloader.loadAssets(this.animationData.assets,this.imagesLoaded.bind(this)))}renderFrame(t){if(this.isLoaded)try{this.expressionsPlugin?.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(t){this.triggerRenderFrameError(t)}}resetSegments(t){this.segments.length=0,this.segments.push([this.animationData.ip,this.animationData.op]),t&&this.checkSegments(0)}resize(t,e){this.renderer.updateContainerSize("number"==typeof t?t:void 0,"number"==typeof e?e:void 0)}setCurrentRawFrameValue(t){this.currentRawFrame=t,this.gotoFrame()}setData(t,e){try{let s=e;s&&"object"!=typeof s&&(s=JSON.parse(s));let i={animationData:s,wrapper:t},r=t.attributes;i.path=r.getNamedItem("data-animation-path")?.value??r.getNamedItem("data-bm-path")?.value??r.getNamedItem("bm-path")?.value??"";let a=r.getNamedItem("data-anim-type")?.value??r.getNamedItem("data-bm-type")?.value??r.getNamedItem("bm-type")?.value??r.getNamedItem("data-bm-renderer")?.value??r.getNamedItem("bm-renderer")?.value??(()=>{if(q.canvas)return $.Canvas;let t=Object.keys(q),{length:e}=t;for(let s=0;s<e;s++)if(q[t[s]])return t[s];return $.SVG})();Object.values($).includes(a)?i.animType=a:i.animType=$.Canvas;let n=r.getNamedItem("data-anim-loop")?.value??r.getNamedItem("data-bm-loop")?.value??r.getNamedItem("bm-loop")?.value??"";"false"===n?i.loop=!1:"true"===n?i.loop=!0:""!==n&&(i.loop=parseInt(n,10));let o=r.getNamedItem("data-anim-autoplay")?.value??r.getNamedItem("data-bm-autoplay")?.value??r.getNamedItem("bm-autoplay")?.value??!0;i.autoplay="false"!==o,i.name=r.getNamedItem("data-name")?.value??r.getNamedItem("data-bm-name")?.value??r.getNamedItem("bm-name")?.value??"";let h=r.getNamedItem("data-anim-prerender")?.value??r.getNamedItem("data-bm-prerender")?.value??r.getNamedItem("bm-prerender")?.value??"";"false"===h&&(i.prerender=!1),i.path?this.setParams(i):this.trigger("destroy")}catch(t){throw console.error(`${this.constructor.name}: `,t),Error(`${this.constructor.name}: Could not set data`)}}setDirection(t,e){e&&this.name!==e||(this.playDirection=t<0?-1:1,this.updaFrameModifier())}setLoop(t){this.loop=t}setParams(t){try{(t.wrapper||t.container)&&(this.wrapper=t.wrapper??t.container??null);let s=$.SVG;t.animType?s=t.animType:t.renderer&&(s=t.renderer);let i=(t=>{if(!q[t])throw Error("Could not get renderer");return q[t]})(s);this.renderer=new i(this,t.rendererSettings),this.imagePreloader?.setCacheType(s,this.renderer.globalData?.defs),this.renderer.setProjectInterface(this.projectInterface),this.animType=s,""===t.loop||null===t.loop||void 0===t.loop||!0===t.loop?this.loop=!0:!1===t.loop?this.loop=!1:this.loop=parseInt(`${t.loop}`,10),this.autoplay=!!(!("autoplay"in t)||t.autoplay),this.name=t.name??"",this.autoloadSegments=!!(!Object.hasOwn(t,"autoloadSegments")||t.autoloadSegments),this.assetsPath=t.assetsPath??this.assetsPath,this.initialSegment=t.initialSegment,t.audioFactory&&this.audioController.setAudioFactory(t.audioFactory),t.animationData?this.setupAnimation(t.animationData):t.path&&(t.path.includes("\\")?this.path=t.path.slice(0,Math.max(0,t.path.lastIndexOf("\\")+1)):this.path=t.path.slice(0,Math.max(0,t.path.lastIndexOf("/")+1)),this.fileName=t.path.slice(Math.max(0,t.path.lastIndexOf("/")+1)),this.fileName=this.fileName.slice(0,Math.max(0,this.fileName.lastIndexOf(".json"))),function(t,s,i){tE();let r=tk(s,i);e?.postMessage({fullPath:Q?t:window.location.origin+window.location.pathname,id:r,path:t,type:"loadAnimation"})}(t.path,this.configAnimation,this.onSetupError))}catch(t){throw console.error(`${this.constructor.name}: `,t),Error(`${this.constructor.name}: Could not set params`)}}setSegment(t,e){let s=-1;this.isPaused&&(this.currentRawFrame+this.firstFrame<t?s=t:this.currentRawFrame+this.firstFrame>e&&(s=e-t)),this.firstFrame=t,this.totalFrames=e-t,this.timeCompleted=this.totalFrames,-1!==s&&this.goToAndStop(s,!0)}setSpeed(t,e){e&&this.name!==e||(this.playSpeed=t,this.updaFrameModifier())}setSubframe(t){this.isSubframeEnabled=!!t}setupAnimation(t){tx(t,this.configAnimation)}setVolume(t,e){e&&this.name!==e||this.audioController.setVolume(t)}show(){this.renderer.show()}stop(t){t&&this.name!==t||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))}togglePause(t){t&&this.name!==t||(this.isPaused?this.play():this.pause())}trigger(t){try{if(!this._cbs[t])return;switch(t){case"enterFrame":this.triggerEvent(t,new M(t,this.currentFrame,this.totalFrames,this.frameModifier)),this.onEnterFrame?.(new M(t,this.currentFrame,this.totalFrames,this.frameMult));break;case"drawnFrame":this.triggerEvent(t,new P(t,this.currentFrame,this.frameModifier,this.totalFrames));break;case"loopComplete":this.triggerEvent(t,new C(t,Number(this.loop),this.playCount,this.frameMult)),this.onLoopComplete?.(new C(t,this.loop,this.playCount,this.frameMult));break;case"complete":this.triggerEvent(t,new x(t,this.frameMult)),this.onComplete?.(new x(t,this.frameMult));break;case"segmentStart":this.triggerEvent(t,new A(t,this.firstFrame,this.totalFrames)),this.onSegmentStart?.(new A(t,this.firstFrame,this.totalFrames));break;case"destroy":this.triggerEvent(t,new T(t,this)),this.onDestroy?.(new T(t,this));break;default:this.triggerEvent(t)}}catch(t){console.error(`${this.constructor.name}: `,t)}}triggerConfigError(t){let e=new I(t,this.currentFrame);this.triggerEvent("error",e),this.onError?.(e)}triggerRenderFrameError(t){let e=new D(t,this.currentFrame);this.triggerEvent("error",e),this.onError?.(e)}unmute(t){t&&this.name!==t||this.audioController.unmute()}updaFrameModifier(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection,this.audioController.setRate(this.playSpeed*this.playDirection)}updateDocumentData(t,e,s){try{let i=this.renderer.getElementByPath(t);i?.updateDocumentData([],e,s)}catch(t){console.error(this.constructor.name,t)}}waitForFontsLoaded(){if(this.renderer.globalData?.fontManager?.isLoaded)return void this.checkLoaded();setTimeout(this.waitForFontsLoaded.bind(this),20)}}let tF=!0,tL=0,tN=0,t$=0,tV=[];function tO(){++t$&&tF&&!Q&&(window.requestAnimationFrame(tz),tF=!1)}function tz(t){tL=t,Q||window.requestAnimationFrame(tB)}function tR({target:t}){let e=0;if(!t)throw Error("No animation to remove");for(;e<tN;)tV[e]?.animation===t&&(tV.splice(e,1),e--,tN-=1,t.isPaused||tj()),e++}function tB(t){let e=t-tL;for(let t=0;t<tN;t++)tV[t]?.animation.advanceTime(e);tL=t,t$&&1?Q||window.requestAnimationFrame(tB):tF=!0}function tq(t,e){t.addEventListener("destroy",tR),t.addEventListener("_active",tO),t.addEventListener("_idle",tj),tV.push({animation:t,elem:e}),tN++}function tj(){t$--}let tH=(()=>{function t(t,e){let s,i=[];switch(t){case L.Int16:case L.Uint8c:s=1;break;case L.Float32:case L.Int32:case L.Uint8:default:s=1.1}for(let t=0;t<e;t++)i.push(s);return i}return"function"==typeof Uint8ClampedArray&&"function"==typeof Float32Array?function(e,s){return e===L.Float32?new Float32Array(s):e===L.Int16?new Int16Array(s):e===L.Uint8c?new Uint8ClampedArray(s):t(e,s)}:t})();function tG(t){return Array.from({length:t})}class tW{constructor(t,e,s){this._length=0,this._maxLength=t,this._create=e,this._release=s,this.pool=tG(this._maxLength),this.newElement=this.newElement.bind(this),this.release=this.release.bind(this)}newElement(){let t;return this._length?(this._length-=1,t=this.pool[this._length]):t=this._create(),t}release(t){if(this._length===this._maxLength){var e;this.pool=[...e=this.pool,...tG(e.length)],this._maxLength*=2}this._release&&this._release(t),this.pool[this._length]=t,this._length++}}let tU=new tW(8,()=>({addedLength:0,lengths:tH(L.Float32,150),percents:tH(L.Float32,150)})),tY=new tW(8,()=>({lengths:[],totalLength:0}),t=>{if(!X(t))return;let{length:e}=t.lengths;for(let s=0;s<e;s++)tU.release(t.lengths[s]);t.lengths.length=0}),tX=tH(L.Float32,8);function tJ(t,e,s,i){let r={},a=`${t[0]}_${t[1]}_${e[0]}_${e[1]}_${s[0]}_${s[1]}_${i[0]}_${i[1]}`.replaceAll(".","p");if(!r[a]){let n=150,o,h,l=0,m,p,d=null;2===t.length&&(t[0]!==e[0]||t[1]!==e[1])&&tK(t[0],t[1],e[0],e[1],t[0]+s[0],t[1]+s[1])&&tK(t[0],t[1],e[0],e[1],e[0]+i[0],e[1]+i[1])&&(n=2);let c=new t2(n),{length:u}=s;for(let r=0;r<n;r++){p=tG(u),h=r/(n-1),m=0;for(let r=0;r<u;r++)o=Math.pow(1-h,3)*(t[r]??0)+3*Math.pow(1-h,2)*h*((t[r]??0)+(s[r]??0))+3*(1-h)*Math.pow(h,2)*((e[r]??0)+(i[r]??0))+Math.pow(h,3)*(e[r]??0),p[r]=o,null!==d&&(m+=Math.pow(Number(p[r])-Number(d[r]),2));l+=m=Math.sqrt(m),c.points[r]=new t3(m,p),d=p}c.segmentLength=l,r[a]=c}return r[a]}function tZ(t,e,s,i,r,a,n){let o=r,h=a;o<0?o=0:o>1&&(o=1);let l=t1(o,n)??0,m=t1(h=h>1?1:h,n)??0,p=1-l,d=1-m,c=p*p*p,u=l*p*p*3,f=l*l*p*3,g=l*l*l,y=p*p*d,b=l*p*d+p*l*d+p*p*m,v=l*l*d+p*l*m+l*p*m,_=l*l*m,w=p*d*d,S=l*d*d+p*m*d+p*d*m,E=l*m*d+p*m*m+l*d*m,k=l*m*m,M=d*d*d,x=m*d*d+d*m*d+d*d*m,P=m*m*d+d*m*m+m*d*m,C=m*m*m,{length:A}=t;for(let r=0;r<A;r++)tX[4*r]=Math.round((c*(t[r]??0)+u*(s[r]??0)+f*(i[r]??0)+g*(e[r]??0))*1e3)/1e3,tX[4*r+1]=Math.round((y*(t[r]??0)+b*(s[r]??0)+v*(i[r]??0)+_*(e[r]??0))*1e3)/1e3,tX[4*r+2]=Math.round((w*(t[r]??0)+S*(s[r]??0)+E*(i[r]??0)+k*(e[r]??0))*1e3)/1e3,tX[4*r+3]=Math.round((M*(t[r]??0)+x*(s[r]??0)+P*(i[r]??0)+C*(e[r]??0))*1e3)/1e3;return tX}function tK(t,e,s,i,r,a){let n=t*i+e*r+s*a-r*i-a*t-s*e;return n>-.001&&n<.001}function tQ(t,e,s,i,r,a,n,o,h){let l;if(0===s&&0===a&&0===h)return tK(t,e,i,r,n,o);let m=Math.sqrt(Math.pow(i-t,2)+Math.pow(r-e,2)+Math.pow(a-s,2)),p=Math.sqrt(Math.pow(n-t,2)+Math.pow(o-e,2)+Math.pow(h-s,2)),d=Math.sqrt(Math.pow(n-i,2)+Math.pow(o-r,2)+Math.pow(h-a,2));return(l=m>p?m>d?m-p-d:d-p-m:d>p?d-p-m:p-m-d)>-1e-4&&l<1e-4}function t0(t,e,s,i){let r,a,n=0,o,h=[],l=[],m=tU.newElement(),p=s.length;for(let d=0;d<150;d++){a=d/149,o=0;for(let n=0;n<p;n++)r=Math.pow(1-a,3)*(t[n]??0)+3*Math.pow(1-a,2)*a*(s[n]??0)+3*(1-a)*Math.pow(a,2)*(i[n]??0)+Math.pow(a,3)*(e[n]??0),h[n]=r,"number"==typeof l[n]&&(o+=Math.pow((h[n]??0)-(l[n]??0),2)),l[n]=h[n]??0;o&&(n+=o=Math.sqrt(o)),m.percents[d]=a,m.lengths[d]=n}return m.addedLength=n,m}function t1(t,{addedLength:e,lengths:s,percents:i}){let{length:r}=i,a=Math.floor((r-1)*t),n=t*e,o=0;if(a===r-1||0===a||n===s[a])return i[a];let h=(s[a]??0)>n?-1:1,l=!0;for(;l;)if((s[a]??0)<=n&&(s[a+1]??0)>n?(o=(n-(s[a]??0))/((s[a+1]??0)-(s[a]??0)),l=!1):a+=h,a<0||a>=r-1){if(a===r-1)return i[a];l=!1}return(i[a]??0)+((i[a+1]??0)-(i[a]??0))*o}class t2{constructor(t){this.segmentLength=0,this.points=Array.from({length:t})}}class t3{constructor(t,e){this.partialLength=t,this.point=e}}let t5={};function t4(t,e,s,i,r){let a=r||`bez_${t}_${e}_${s}_${i}`.replaceAll(".","p");if(t5[a])return t5[a];let n=new t6([t,e,s,i]);return t5[a]=n,n}class t6{constructor(t){this.float32ArraySupported="function"==typeof Float32Array,this.kSplineTableSize=11,this.kSampleStepSize=1/(this.kSplineTableSize-1),this.NEWTON_ITERATIONS=4,this.NEWTON_MIN_SLOPE=.001,this.SUBDIVISION_MAX_ITERATIONS=10,this.SUBDIVISION_PRECISION=1e-7,this._p=t,this._mSampleValues=this.float32ArraySupported?new Float32Array(this.kSplineTableSize):Array.from({length:this.kSplineTableSize}),this._precomputed=!1,this.get=this.get.bind(this)}_calcSampleValues(){let t=this._p[0],e=this._p[2];for(let s=0;s<this.kSplineTableSize;++s)this._mSampleValues[s]=this.calcBezier(s*this.kSampleStepSize,t??0,e??0)}_getTForX(t){let e=this._p[0],s=this._p[2],i=this._mSampleValues,r=0,a=1,n=this.kSplineTableSize-1;for(;a!==n&&Number(i[a])<=t;++a)r+=this.kSampleStepSize;let o=r+(t-Number(i[--a]))/(Number(i[a+1])-Number(i[a]))*this.kSampleStepSize,h=this.getSlope(o,e??0,s??0);return h>=this.NEWTON_MIN_SLOPE?this.newtonRaphsonIterate(t,o,e??0,s??0):0===h?o:this.binarySubdivide(t,r,r+this.kSampleStepSize,e??0,s??0)}_precompute(){let t=this._p[0],e=this._p[1],s=this._p[2],i=this._p[3];this._precomputed=!0,(t!==e||s!==i)&&this._calcSampleValues()}get(t){let e=this._p[0],s=this._p[1],i=this._p[2],r=this._p[3];return(this._precomputed||this._precompute(),e===s&&i===r)?t:0===t?0:1===t?1:this.calcBezier(this._getTForX(t),s??0,r??0)}A(t,e){return 1-3*e+3*t}B(t,e){return 3*e-6*t}binarySubdivide(t,e,s,i,r){let a=e,n=s,o,h,l=0;do h=a+(n-a)/2,(o=this.calcBezier(h,i,r)-t)>0?n=h:a=h;while(Math.abs(o)>this.SUBDIVISION_PRECISION&&++l<this.SUBDIVISION_MAX_ITERATIONS);return h}C(t){return 3*t}calcBezier(t,e,s){return((this.A(e,s)*t+this.B(e,s))*t+this.C(e))*t}getSlope(t,e,s){return 3*this.A(e,s)*t*t+2*this.B(e,s)*t+this.C(e)}newtonRaphsonIterate(t,e,s,i){let r=e;for(let e=0;e<this.NEWTON_ITERATIONS;++e){let e=this.getSlope(r,s,i);if(0===e)break;let a=this.calcBezier(r,s,i)-t;r-=a/e}return r}}class t8{addDynamicProperty(t){this.dynamicProperties.includes(t)||(this.dynamicProperties.push(t),this.container?.addDynamicProperty(this),this._isAnimated=!0)}getValue(t){throw Error(`${this.constructor.name}: Method getValue is not implemented`)}initDynamicPropertyContainer(t){this.container=t,this.dynamicProperties=[],this._mdf=!1,this._isAnimated=!1}iterateDynamicProperties(){this._mdf=!1;let{length:t}=this.dynamicProperties;for(let e=0;e<t;e++)this.dynamicProperties[e]?.getValue(),this.dynamicProperties[e]?._mdf&&(this._mdf=!0);return 0}setGroupProperty(t){}constructor(){this.dynamicProperties=[]}}let t9=t=>{let e=t[0]*J,s=t[1]*J,i=t[2]*J,r=Math.cos(e/2),a=Math.cos(s/2),n=Math.cos(i/2),o=Math.sin(e/2),h=Math.sin(s/2),l=Math.sin(i/2);return[o*h*n+r*a*l,o*a*n+r*h*l,r*h*n-o*a*l,r*a*n-o*h*l]};class t7 extends t8{addEffect(t){this.effectsSequence.push(t),this.container?.addDynamicProperty(this)}getSpeedAtTime(t){throw Error(`${this.constructor.name}: Method getSpeedAtTime is not implemented`)}getValueAtCurrentTime(){if(this._caching=this._caching??{},!this.keyframes)return;let t=Number(this.offsetTime),e=Number(this.comp?.renderedFrame)-t,s=(this.keyframes[0]?.t??0)-t,i=this.keyframes.length-1,r=(this.keyframes[i]?.t??0)-t,a=Number(this._caching.lastFrame);if(!(e===a||-999999!==a&&(a>=r&&e>=r||a<s&&e<s))){a>=e&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);let t=this.interpolateValue(e,this._caching);this.pv=t}return this._caching.lastFrame=e,this.pv}getValueAtTime(t,e){throw Error(`${this.constructor.name}: Method getValueAtTime is not implemented`)}getVelocityAtTime(t){throw Error(`${this.constructor.name}: Method getVelocityAtTime is not implemented`)}initiateExpression(t,e,s){throw Error("Method not implemented")}interpolateValue(t,e={}){let s,i=Number(this.offsetTime),r=[0,0,0];this.propType===z.MultiDimensional&&this.pv&&(r=tH(L.Float32,this.pv.length));let{keyframes:a=[],keyframesMetadata:n,propType:o}=this,h=e.lastIndex||0,l=h,m=a.length-1,p=!0,d=a[0]??{},c=a[1]??{};for(;p;){if(d=a[l]??{},c=a[l+1]??{},l===m-1&&t>=c.t-i){d.h&&(d=c),h=0;break}if(c.t-i>t){h=l;break}l<m-1?l++:(h=0,p=!1)}let u=n[l]??{},f,g,y,b,v=null,_=c.t-i,w=d.t-i;if(d.to&&d.s){u.bezierData=u.bezierData??tJ(d.s,c.s??d.e,d.to,d.ti);let{__fnct:s,bezierData:i}=u;if(t>=_||t<w){let e=t>=_?i.points.length-1:0;f=i.points[e]?.point.length??0;for(let t=0;t<f;t++)r[t]=i.points[e]?.point[t]??0}else{s?v=s:u.__fnct=v=t4(d.o.x,d.o.y,d.i.x,d.i.y,d.n).get,g=v((t-w)/(_-w));let a=i.segmentLength*g,n,o=Number(e.lastFrame)<t&&e._lastKeyframeIndex===l?e._lastAddedLength:0;for(b=Number(e.lastFrame)<t&&e._lastKeyframeIndex===l?e._lastPoint:0,p=!0,y=i.points.length;p;){if(o+=i.points[b]?.partialLength??0,0===a||0===g||b===i.points.length-1){f=i.points[b]?.point.length??0;for(let t=0;t<f;t++)r[t]=i.points[b]?.point[t]??0;break}if(a>=o&&a<o+(i.points[b+1]?.partialLength??0)){n=(a-o)/(i.points[b+1]?.partialLength??0),f=i.points[b]?.point.length??0;for(let t=0;t<f;t++)r[t]=(i.points[b]?.point[t]??0)+((i.points[b+1]?.point[t]??0)-(i.points[b]?.point[t]??0))*n;break}b<y-1?b++:p=!1}e._lastPoint=b,e._lastAddedLength=o-(i.points[b]?.partialLength??0),e._lastKeyframeIndex=l}}else{let e,i,a,n;if(m=d.s?.length||0,s=c.s??d.e,this.sh&&1!==d.h)t>=_?(r[0]=s[0],r[1]=s[1],r[2]=s[2]):t<=w&&d.s?(r[0]=d.s[0],r[1]=d.s[1],r[2]=d.s[2]):((t,e)=>{let s=e[0],i=e[1],r=e[2],a=e[3],n=Math.atan2(2*i*a-2*s*r,1-2*i*i-2*r*r),o=Math.asin(2*s*i+2*r*a),h=Math.atan2(2*s*a-2*i*r,1-2*s*s-2*r*r);t[0]=n/J,t[1]=o/J,t[2]=h/J})(r,((t,e,s)=>{let i=[0,0,0,0],r=t[0],a=t[1],n=t[2],o=t[3],h=e[0],l=e[1],m=e[2],p=e[3],d,c,u,f,g;return(c=r*h+a*l+n*m+o*p)<0&&(c=-c,h=-h,l=-l,m=-m,p=-p),1-c>1e-6?(u=Math.sin(d=Math.acos(c)),f=Math.sin((1-s)*d)/u,g=Math.sin(s*d)/u):(f=1-s,g=s),i[0]=f*r+g*h,i[1]=f*a+g*l,i[2]=f*n+g*m,i[3]=f*o+g*p,i})(t9(d.s),t9(s),(t-w)/(_-w)));else for(l=0;l<m;l++)1!==d.h&&(t>=_?g=1:t<w?g=0:(d.o.x.constructor===Array?(u.__fnct=u.__fnct??[],u.__fnct[l]?v=u.__fnct[l]:U(d.o.y)&&U(d.i.y)&&U(d.i.x)&&(e=d.o.x[l]??d.o.x[0],i=d.o.y[l]??d.o.y[0],v=t4(e??0,i??0,(a=d.i.x[l]??d.i.x[0])??0,d.i.y[l]??d.i.y[0]??0).get,u.__fnct[l]=v)):u.__fnct?v=u.__fnct:(e=d.o.x,i=d.o.y,v=t4(e,i,a=d.i.x,d.i.y).get,d.keyframeMetadata=v),g=v?.((t-w)/(_-w)))),s=c.s??d.e,void 0!==(n=1===d.h?d.s?.[l]:Number(d.s?.[l])+((s[l]??0)-Number(d.s?.[l]))*Number(g))&&(o===z.MultiDimensional?r[l]=n:r=n)}return e.lastIndex=h,r}processEffectsSequence(){if(!this.data)throw Error(`${this.constructor.name}: data (LottieLayer) is not implemented`);if(!this.elem)throw Error(`${this.constructor.name}: elem (ElementInterface) is not implemented`);if(this.elem.globalData?.frameId===this.frameId)return 0;if(0===this.effectsSequence.length)return this._mdf=!1,0;if(this.lock&&this.pv)return this.setVValue(this.pv),0;this.lock=!0,this._mdf=!!this._isFirstFrame;let t=this.effectsSequence.length,e=this.kf?this.pv:this.data.k;for(let s=0;s<t;s++)e=this.effectsSequence[s]?.(e);return this.setVValue(e),this._isFirstFrame=!1,this.lock=!1,this.frameId=this.elem.globalData?.frameId,0}setVValue(t){let e;if("number"==typeof t&&this.propType===z.UniDimensional){e=t*Number(this.mult),Math.abs(this.v-e)>1e-5&&(this.v=e,this._mdf=!0);return}let s=0,{length:i}=this.v;for(;s<i;)e=(t[s]??0)*Number(this.mult),Math.abs((this.v[s]??0)-e)>1e-5&&(this.v[s]=e,this._mdf=!0),s++}speedAtTime(t){throw Error("Method is not implemented")}valueAtTime(t,e){throw Error(`${this.constructor.name}: Method valueAtTime is not implemented`)}velocityAtTime(t){throw Error("Method is not implemented")}constructor(...t){super(...t),this.effectsSequence=[],this.initFrame=-999999,this.keyframesMetadata=[],this.offsetTime=0}}class et extends t7{constructor(t,e,s=null,i=null){let r,a,n,o;super(),this.propType=z.MultiDimensional;let{length:h}=e.k;for(let t=0;t<h-1;t++)e.k[t]?.to&&e.k[t]?.s&&e.k[t+1]?.s&&(r=e.k[t]?.s,a=e.k[t+1]?.s,n=e.k[t]?.to,o=e.k[t]?.ti,(2===r.length&&(r[0]!==a[0]||r[1]!==a[1])&&tK(r[0]??0,r[1]??0,a[0]??0,a[1]??0,r[0]??0+(n[0]??0),r[1]??0+(n[1]??0))&&tK(r[0]??0,r[1]??0,a[0]??0,a[1]??0,a[0]??0+(o[0]??0),a[1]??0+(o[1]??0))||3===r.length&&(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2])&&tQ(r[0]??0,r[1]??0,r[2]??0,a[0]??0,a[1]??0,a[2]??0,r[0]??0+(n[0]??0),r[1]??0+(n[1]??0),r[2]??0+(n[2]??0))&&tQ(r[0]??0,r[1]??0,r[2]??0,a[0]??0,a[1]??0,a[2]??0,a[0]??0+(o[0]??0),a[1]??0+(o[1]??0),a[2]??0+(o[2]??0)))&&(e.k[t].to=null,e.k[t].ti=null),(r[0]===a[0]&&r[1]===a[1]&&0===n[0]&&0===n[1]&&0===o[0]&&0===o[1]&&2===r.length||r[2]===a[2]&&0===n[2]&&0===o[2])&&(e.k[t].to=null,e.k[t].ti=null));this.effectsSequence=[this.getValueAtCurrentTime.bind(this)],this.data=e,this.keyframes=e.k,this.keyframesMetadata=[],this.offsetTime=t.data.st,this.k=!0,this.kf=!0,this._isFirstFrame=!0,this.mult=s||1,this.elem=t,this.container=i,this.comp=t.comp,this.getValue=this.processEffectsSequence,this.frameId=-1;let l=e.k[0]?.s?.length||0;this.v=tH(L.Float32,l),this.pv=tH(L.Float32,l);for(let t=0;t<l;t++)this.v[t]=this.initFrame,this.pv[t]=this.initFrame;this._caching={lastFrame:this.initFrame,lastIndex:0,value:tH(L.Float32,l)}}}class ee extends t7{constructor(t,e,s=null,i=null){super(),this.propType=z.UniDimensional,this.keyframes=e.k,this.keyframesMetadata=[],this.offsetTime=t.data.st,this.frameId=-1,this._caching={_lastKeyframeIndex:-1,lastFrame:this.initFrame,lastIndex:0,value:0},this.k=!0,this.kf=!0,this.data=e,this.mult=s||1,this.elem=t,this.container=i,this.comp=t.comp,this.v=this.initFrame,this.pv=this.initFrame,this._isFirstFrame=!0,this.getValue=this.processEffectsSequence,this.effectsSequence=[this.getValueAtCurrentTime.bind(this)]}}class es extends t7{constructor(t,e,s=null,i=null){super(),this.propType=z.MultiDimensional,this.mult=s||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;let{length:r}=e.k;this.v=tH(L.Float32,r),this.pv=tH(L.Float32,r),this.vel=tH(L.Float32,r);for(let t=0;t<r;t++)this.v[t]=(e.k[t]??0)*this.mult,this.pv[t]=e.k[t]??0;this._isFirstFrame=!0,this.effectsSequence=[],this.getValue=this.processEffectsSequence}}class ei extends t7{constructor(){super(),this.propType=!1}}class er extends t7{constructor(t,e,s=null,i=null){super(),this.propType=z.UniDimensional,this.mult=s||1,this.data=e,this.v=e.k*(s||1),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=this.processEffectsSequence}}let ea={getProp:function(t,e,s,i,r){let a,n=e;if(n&&"sid"in n&&n.sid&&(n=t.globalData?.slotManager?.getProp(n)),n?.k?.length)if("number"==typeof(n?.k)[0])a=new es(t,n,i,r);else switch(s){case 0:a=new ee(t,n,i,r);break;case 1:a=new et(t,n,i,r)}else a=new er(t,n,i,r);return(a=a??new ei).effectsSequence.length>0&&r?.addDynamicProperty(a),a}};class en{constructor(t,e,s){this.p=ea.getProp(e,t.v,0,0,s)}}class eo{constructor(t,e,s){this.p=ea.getProp(e,t.v,1,0,s)}}class eh extends en{}class el extends en{}class em extends eo{}class ep extends eo{}class ed extends en{}class ec extends en{}class eu extends en{}class ef{constructor(){this.p={}}}class eg extends t8{constructor(t,e,s){super(),this.effectElements=[],this.getValue=this.iterateDynamicProperties,this.init(t,e,s)}init(t,e,s){let i;this.data=t,this.effectElements=[],this.initDynamicPropertyContainer(e);let r=this.data.ef,{length:a}=r;for(let t=0;t<a;t++){switch(r[t]?.ty){case 0:i=new eh(r[t],e,this);break;case 1:i=new el(r[t],e,this);break;case 2:i=new em(r[t],e,this);break;case 3:i=new ep(r[t],e,this);break;case 4:case 7:i=new eu(r[t],e,this);break;case 10:i=new ed(r[t],e,this);break;case 11:i=new ec(r[t],e,this);break;case 5:i=new ey(s,e);break;default:i=new ef}this.effectElements.push(i)}}renderFrame(t){throw Error(`${this.constructor.name}: Method renderFrame is not implemented yet`)}}class ey{constructor(t,e,s){let i=t.ef??[];this.effectElements=[];let{length:r}=i;for(let s=0;s<r;s++){let r=new eg(i[s],e,t);this.effectElements.push(r)}}}function eb(t=16){return({0:"source-over",1:"multiply",10:"difference",11:"exclusion",12:"hue",13:"saturation",14:"color",15:"luminosity",2:"screen",3:"overlay",4:"darken",5:"lighten",6:"color-dodge",7:"color-burn",8:"hard-light",9:"soft-light"})[t]||""}class ev{buildAllItems(){throw Error(`${this.constructor.name}: Method buildAllItems is not implemented`)}checkLayers(t){throw Error(`${this.constructor.name}: Method checkLayers is not implemented`)}checkMasks(){if(!this.data)throw Error(`${this.constructor.name}: data (LottieLayer) is not initialized`);if(!this.data.hasMask)return!1;let t=0,{length:e}=this.data.masksProperties??[];for(;t<e;){if(this.data.masksProperties?.[t]?.mode!=="n"&&this.data.masksProperties?.[t]?.cl!==!1)return!0;t++}return!1}destroy(){}destroyBaseElement(){throw Error(`${this.constructor.name}: Method destroyBaseElement is not implemented`)}getBaseElement(){throw Error(`${this.constructor.name}: Method getBaseElement is not implemented`)}getType(){return this.type}initBaseData(t,e,s){this.globalData=e,this.comp=s,this.data=t,this.layerId=W(),this.data.sr||(this.data.sr=1),this.effectsManager=new ey(this.data,this,this.dynamicProperties)}initExpressions(){try{if(!this.data)throw Error(`${this.constructor.name}: data (LottieLayer) is not implemented`);!0;return}catch(t){console.error(this.constructor.name,t)}}setBlendMode(){if(!this.data)throw Error(`${this.constructor.name}: data (LottieLayer) is not implemented`);let t=eb(this.data.bm),e=this.baseElement??this.layerElement;if(!e)throw Error(`${this.constructor.name}: Both baseElement and layerElement are not implemented`);e.style.mixBlendMode=t}sourceRectAtTime(){throw Error(`${this.constructor.name}: Method sourceRectAtTime is not implemented`)}constructor(){this.dynamicProperties=[],this.frameDuration=1,this.itemsData=[],this.layerInterface=null,this.shapesData=[]}}class e_{constructor(){this.props=tH(L.Float32,16),this._identity=!0,this._identityCalculated=!1,this.reset()}applyToPoint(t,e,s){return{x:t*(this.props[0]??0)+e*(this.props[4]??0)+s*(this.props[8]??0)+(this.props[12]??0),y:t*(this.props[1]??0)+e*(this.props[5]??0)+s*(this.props[9]??0)+(this.props[13]??0),z:t*(this.props[2]??0)+e*(this.props[6]??0)+s*(this.props[10]??0)+(this.props[14]??0)}}applyToPointArray(t,e,s){return this.isIdentity()?[t,e,s]:[t*(this.props[0]??0)+e*(this.props[4]??0)+s*(this.props[8]??0)+(this.props[12]??0),t*(this.props[1]??0)+e*(this.props[5]??0)+s*(this.props[9]??0)+(this.props[13]??0),t*(this.props[2]??0)+e*(this.props[6]??0)+s*(this.props[10]??0)+(this.props[14]??0)]}applyToPointStringified(t,e){if(this.isIdentity())return`${t},${e}`;let s=this.props;return`${Math.round((t*(s[0]??0)+e*(s[4]??0)+(s[12]??0))*100)/100},${Math.round((t*(s[1]??0)+e*(s[5]??0)+(s[13]??0))*100)/100}`}applyToTriplePoints(t,e,s){let i=tH(L.Float32,6);if(this.isIdentity())i.set([t[0]??0,t[1]??0,e[0]??0,e[1]??0,s[0]??0,s[1]??0]);else{let r=this.props[0]??0,a=this.props[1]??0,n=this.props[4]??0,o=this.props[5]??0,h=this.props[12]??0,l=this.props[13]??0;i.set([(t[0]??0)*r+(t[1]??0)*n+h,(t[0]??0)*a+(t[1]??0)*o+l,(e[0]??0)*r+(e[1]??0)*n+h,(e[0]??0)*a+(e[1]??0)*o+l,(s[0]??0)*r+(s[1]??0)*n+h,(s[0]??0)*a+(s[1]??0)*o+l])}return i}applyToX(t,e,s){return t*(this.props[0]??0)+e*(this.props[4]??0)+s*(this.props[8]??0)+(this.props[12]??0)}applyToY(t,e,s){return t*(this.props[1]??0)+e*(this.props[5]??0)+s*(this.props[9]??0)+(this.props[13]??0)}applyToZ(t,e,s){return t*this.props[2]+e*this.props[6]+s*this.props[10]+this.props[14]}clone(t){return t.props.set(this.props),t}cloneFromProps(t){return this.props.set(t),this}equals(t){return this.props.every((e,s)=>e===t?.props[s])}getInverseMatrix(){let t=(this.props[0]??0)*(this.props[5]??0)-(this.props[1]??0)*(this.props[4]??0),e=this.props[5]/t,s=-this.props[1]/t,i=-this.props[4]/t,r=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 e_;return o.setTransform(e,s,0,0,i,r,0,0,0,0,1,0,a,n,0,1),o}inversePoint(t){return this.getInverseMatrix().applyToPoint(t[0]??0,t[1]??0,t[2]??0)}inversePoints(t){return t.map(t=>this.inversePoint(t))}isIdentity(){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}multiply(t){return this.transform(...t.props)}reset(){return this.props.set([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this}rotate(t){if(!t)return this;let e=Math.cos(t),s=Math.sin(t);return this._t(e,-s,0,0,s,e,0,0,0,0,1,0,0,0,0,1)}rotateX(t){if(!t)return this;let e=Math.cos(t),s=Math.sin(t);return this._t(1,0,0,0,0,e,-s,0,0,s,e,0,0,0,0,1)}rotateY(t){if(!t)return this;let e=Math.cos(t),s