UNPKG

@aarsteinmedia/dotlottie-player

Version:

Web Component for playing Lottie animations in your web app.

4 lines 347 kB
!function(t){"use strict";let e,s,i,r,a,n,o,h,l,p,c,m,d,u="",f=(t,e)=>1e5*Math.abs(t-e)<=Math.min(Math.abs(t),Math.abs(e)),g=t=>1e-5>=Math.abs(t),y=(t,e)=>f(t[0],e[0])&&f(t[1],e[1]),v=(s=0,()=>(s++,`${u}__lottie_element_${s}`)),b=(t,e=0,s=100)=>{let i=e,r=s;if(i>r){let t=r;r=i,i=t}return Math.min(Math.max(t,i),r)},_=(t,e)=>{let s=new Blob([t],{type:e?.mimeType??""}),i=e?.name||v(),r=URL.createObjectURL(s),a=document.createElement("a");a.href=r,a.download=i,a.hidden=!0,document.body.appendChild(a),a.click(),setTimeout(()=>{a.remove(),URL.revokeObjectURL(r)},1e3)},x=t=>{let e;if("string"==typeof t&&t&&((e=t?.split("/").pop()?.lastIndexOf("."))??0)>1&&t&&t.length-1>(e??0))return t.split(".").pop()?.toLowerCase()},w=t=>{let e=t.split(":")[1]?.split(";")[0];return e?.split("/")[1]?.split("+")[0]},E=(t,e)=>(x(t),`${t.split("/").pop()?.replace(/\.[^.]*$/,"").replaceAll(/\W+/g,"-")}`),C=(t,e)=>{if(e)return x(e)?x(e)===t?e:`${E(e)}.${t}`:`${e}.${t}`},S=t=>Symbol.iterator in Object(t)&&t.length>0,k=t=>S(t)&&"number"==typeof t[0],P=t=>!("h"in t)&&!("w"in t)&&"p"in t&&"e"in t&&"u"in t&&"id"in t,M=t=>"w"in t&&"h"in t&&!("xt"in t)&&"p"in t,A=t=>!(!t||S(t))&&"_type"in t&&"ShapePath"===t._type,T=t=>t.slice(Math.max(0,t.indexOf(",")+1)),D=t=>{if(!t)return"rgb(0,0,0)";let e=(t[0]??0)|0,s=(t[1]??0)|0,i=(t[2]??0)|0;return`rgb(${e},${s},${i})`},F=Math.PI/180,I="http://www.w3.org/1999/xlink",L="http://www.w3.org/2000/svg",$=!("u">typeof window&&document),N="u">typeof navigator,V=!!N&&/^(?:(?!chrome|android).)*safari/i.test(navigator.userAgent);var R,O,z,B,G,q,j,W,H,U,Y,J,X,K=((R={}).Float32="float32",R.Int16="int16",R.Int32="int32",R.Uint8="uint8",R.Uint8c="uint8c",R),Z=((O={}).MouseModifier="ms",O.OffsetPathModifier="op",O.PuckerAndBloatModifier="pb",O.RepeaterModifier="rp",O.RoundCornersModifier="rd",O.TrimModifier="tm",O.ZigZagModifier="zz",O),Q=((z={}).Bounce="bounce",z.Normal="normal",z),tt=((B={}).Complete="complete",B.Destroyed="destroyed",B.Error="error",B.Frame="frame",B.Freeze="freeze",B.Load="load",B.Loop="loop",B.Next="next",B.Pause="pause",B.Play="play",B.Previous="previous",B.Ready="ready",B.Rendered="rendered",B.Stop="stop",B),te=((G={}).Contain="xMidYMid meet",G.Cover="xMidYMid slice",G.Initial="none",G.None="xMinYMin slice",G),ts=((q={}).Canvas="canvas",q.HTML="html",q.SVG="svg",q),ti=((j={}).Ellipse="el",j.Fill="fl",j.GradientFill="gf",j.GradientStroke="gs",j.Group="gr",j.Merge="mm",j.NoStyle="no",j.OffsetPath="op",j.Path="sh",j.PolygonStar="sr",j.PuckerBloat="pb",j.Rectangle="rc",j.Repeater="rp",j.RoundedCorners="rd",j.Stroke="st",j.Transform="tr",j.Trim="tm",j.Twist="tw",j.Unknown="ms",j.ZigZag="zz",j),tr=((W={}).TransformEffect="transformEffect",W),ta=((H={}).MultiDimensional="multidimensiional",H.Shape="shape",H.TextSelector="textSelector",H.Transform="transform",H.UniDimensional="unidimensional",H);let tn={1:"butt",2:"round",3:"square"},to={1:"miter",2:"round",3:"bevel"};class th{constructor(t,e,s,i){this.type=t,this.currentTime=e,this.totalTime=s,this.direction=i<0?-1:1}}class tl{constructor(t,e){this.type=t,this.direction=e<0?-1:1}}class tp{constructor(t,e,s,i){this.type=t,this.direction=s,this.currentTime=e,this.totalTime=i}}class tc{constructor(t,e,s,i){this.type=t,this.currentLoop=s,this.totalLoops=e,this.direction=i<0?-1:1}}class tm{constructor(t,e,s){this.type=t,this.firstFrame=e,this.totalFrames=s}}class td{constructor(t,e){this.type=t,this.target=e}}class tu{constructor(t,e){this.type="renderFrameError",this.nativeError=t,this.currentTime=e}}class tf{constructor(t,e){this.type="configError",this.nativeError=t}}class tg{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={}}}let ty={},tv=(t,e)=>{ty[t]=e};class tb{constructor(t){this.audios=[],this._isMuted=!1,this._volume=1,this.audioFactory=t}addAudio(t){this.audios.push(t)}createAudio(t){return this.audioFactory?this.audioFactory(t):!$&&"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 t_(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=tx(a));try{r=tx(a),s(r)}catch(t){i?.(t)}}};try{a.open("GET",t,!0)}catch(s){a.open("GET",`${e}/${t}`,!0)}a.send()}function tx(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 tw(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(!S(e)){tS(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&&tS(s[0]),i.length>0&&tS(i[0])}}}switch(s.ty){case 0:s.layers=tE(s.refId,e),tw(s.layers,e);break;case 4:tC(s.shapes);break;case 5:var r;r=s,r.t?.a?.length===0&&r.t.p}}}function tE(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 tC(t=[]){let{length:e}=t;for(let s=e-1;s>=0;s--){if(t[s]?.ty===ti.Group){tC(t[s]?.it);continue}if(t[s]?.ty===ti.Path){let e=t[s]?.ks?.k;if(!S(e)){tS(e);continue}let{length:i}=e;for(let t=0;t<i;t++){let s=e[t]?.e,i=e[t]?.s;s&&tS(s[0]),i&&tS(i[0])}}}}function tS(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 tk(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 tP=(t,e,s)=>{let{length:i}=t;for(let r=0;r<i;r++)t[r]?.ty===s&&e(t[r])},tM=(i=[4,4,14],r=t=>{let e=t.t?.d;t.t&&e&&(t.t.d={k:[{s:e,t:0}]})},t=>{if(!tk(i,t.v))return;tP(t.layers,r,5);let{length:e}=t.assets;for(let s=0;s<e;s++)t.assets[s]?.layers&&tP(t.assets[s]?.layers,r,5)}),tA=(a=[4,7,99],t=>{if(!t.chars||tk(a,t.v))return;let{length:e}=t.chars;for(let s=0;s<e;s++){let e=t.chars[s];e?.data?.shapes&&(tC(e.data.shapes),e.data.ip=0,e.data.op=99999,e.data.st=0,e.data.sr=1,e.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]}},t.chars[s]?.t||(e.data.shapes.push({ty:ti.NoStyle}),e.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:ti.Transform})))}}),tT=(n=[5,7,15],o=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}))},t=>{if(!tk(n,t.v))return;tP(t.layers,o,5);let{length:e}=t.assets;for(let s=0;s<e;s++)t.assets[s]?.layers&&tP(t.assets[s]?.layers,o,5)}),tD=(h=[4,1,9],l=t=>{let{length:e}=t;for(let s=0;s<e;s++){if(t[s]?.ty===ti.Group){l(t[s]?.it??[]);continue}if(t[s]?.ty!==ti.Fill&&t[s]?.ty!==ti.Stroke)continue;let e=t[s]?.c?.k;if(!e||"number"==typeof e)continue;if(k(e)&&e.length>=4){e[0]/=255,e[1]/=255,e[2]/=255,e[3]/=255;continue}let{length:i}=e;for(let t=0;t<i;t++){let s=e[t];s.s[0]/=255,s.s[1]/=255,s.s[2]/=255,s.s[3]/=255,s.e[0]/=255,s.e[1]/=255,s.e[2]/=255,s.e[3]/=255}}},p=t=>{let{length:e}=t;for(let s=0;s<e;s++)t[s]?.ty===4&&l(t[s]?.shapes??[])},t=>{if(!tk(h,t.v))return;p(t.layers);let{length:e}=t.assets;for(let s=0;s<e;s++)t.assets[s]?.layers&&p(t.assets[s]?.layers)}),tF=(c=[4,4,18],m=t=>{let{length:e}=t;for(let s=e-1;s>=0;s--){if(t[s]?.ty===ti.Group){m(t[s]?.it??[]);continue}if(t[s]?.ty!==ti.Path)continue;let e=t[s]?.ks?.k;if(!e)continue;let i=!!t[s]?.closed;if(!S(e)){e.c=i;continue}let{length:r}=e;for(let t=0;t<r;t+=1){let s=e[t]?.e??[],r=e[t]?.s??[];s.length>0&&(s[0].c=i),r.length>0&&(r[0].c=i)}}},d=t=>{let e,{length:s}=t;for(let i=0;i<s;i++){if(e=t[i],e?.hasMask){let t=e.masksProperties,{length:s}=t??[];for(let e=0;e<s;e++){let s=t?.[e]?.pt?.k;if(!s)continue;let i=!!t[e]?.cl;if(!S(s)){s.c=i;continue}let{length:r}=s;for(let t=0;t<r;t++){let e=s[t]?.e??[],r=s[t]?.s??[];e.length>0&&(e[0].c=i),r.length>0&&(r[0].c=i)}}}e?.ty===4&&m(e.shapes)}},t=>{if(!tk(c,t.v))return;d(t.layers);let{length:e}=t.assets;for(let s=0;s<e;s++)t.assets[s]?.layers&&d(t.assets[s]?.layers)}),tI={checkChars:tA,checkColors:tD,checkPathProperties:tT,checkShapes:tF,completeData:function(t){t.__complete||(tD(t),tM(t),tA(t),tT(t),tF(t),tw(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=tE(s.refId,e)),tw(t[i]?.data?.layers??[],e)}}(t.chars,t.assets),t.__complete=!0)},completeLayers:tw},tL=!1,t$=1,tN,tV="Function not implemented.",tR={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=>{tN({data:t})},removeEventListener:(t,e,s)=>{throw Error(tV)},terminate:()=>{throw Error(tV)}},tO={postMessage:t=>{tR.onmessage&&tR.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:""})}},tz={};function tB(){e||((e=function(t){if(!$&&tL){let e=new Blob(["var _workerSelf = self; self.onmessage = ",t.toString()],{type:"text/javascript"});return new Worker(URL.createObjectURL(e))}return tN=t,tR}(t=>{if(tO.dataManager=tO.dataManager??tI,"loadAnimation"===t.data.type)return void t_(t.data.path,t.data.fullPath,e=>{e&&tI.completeData(e),tO.postMessage({id:t.data.id,payload:e,status:"success"})},()=>{tO.postMessage({id:t.data.id,status:"error"})});if("complete"===t.data.type){let{animation:e,id:s}=t.data;tI.completeData(e),tO.postMessage({id:s,payload:e,status:"success"});return}"loadData"===t.data.type&&t_(t.data.path,t.data.fullPath,e=>{tO.postMessage({id:t.data.id,payload:e,status:"success"})},()=>{tO.postMessage({id:t.data.id,status:"error"})})})).onmessage=({data:t})=>{let{id:e,payload:s,status:i}=t,r=tz[e];(tz[e]=null,"success"===i)?r?.onComplete(s):r?.onError&&r.onError()})}function tG(t,e){t$++;let s=`processId_${t$}`;try{return tz[s]={onComplete:t,onError:e},s}catch(t){throw console.error("DataManager}:\n",t),Error("Could not create animation proccess")}}function tq(t,s,i){tB();let r=tG(s,i);e?.postMessage({fullPath:$?t:window.location.origin+window.location.pathname,id:r,path:t,type:"loadData"})}function tj(t,s,i){tB();let r=tG(s,i);e?.postMessage({animation:t,id:r,type:"complete"})}let tW={interface:null,plugin:null};class tH{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}}let tU=!0;function tY(t){return $?null:document.createElement(t)}function tJ(t){return $?null:document.createElementNS(L,t)}class tX{constructor(){this.assetsPath="",this.images=[],this.imagesLoadedCb=null,this.loadedAssets=0,this.loadedFootagesCount=0,this.path="",this.totalFootages=0,this.totalImages=0,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.proxyImage=this._createProxyImage()}createFootageData(t){let e={assetData:t,img:null};return tq(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=tJ("image"),i={assetData:t,img:s};return V?this.testImageLoaded(s):s.addEventListener("load",this._imageLoaded,!1),s.addEventListener("error",()=>{this.proxyImage&&(i.img=this.proxyImage),this._imageLoaded()},!1),s.setAttributeNS(I,"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===ts.SVG?(this._elementHelper=e,this._createImageData=this.createImageData.bind(this)):this._createImageData=this.createImgData.bind(this)}setPath(t){this.path=t||""}_createProxyImage(){if($)return null;let t=tY(ts.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=tY("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($)return;let e=0,s=setInterval(()=>{(t.getBBox().width||e>500)&&(this._imageLoaded(),clearInterval(s)),e++},50)}}let tK=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(":")??[];if(2===i.length){let[t,e]=i;if(!t||!e)continue;s[t]=e.trim(),r++}}if(0===r)throw Error("Could not parse markers");return s};class tZ extends tg{constructor(){super(),this._isFirstFrame=!1,this.animationData={},this.animationID=v(),this.assets=[],this.assetsPath="",this.audioController=new tb(void 0),this.autoplay=!1,this.currentFrame=0,this.currentRawFrame=0,this.drawnFrameEvent=new tp("drawnFrame",0,1,0),this.enterFrameEvent=new th("enterFrame",0,0,1),this.enterFrameLegacyEvent=new th("enterFrame",0,0,1),this.expressionsPlugin=tW.plugin,this.firstFrame=0,this.frameModifier=1,this.frameMult=0,this.frameRate=60,this.imagePreloader=new tX,this.isLoaded=!1,this.isPaused=!0,this.isSubframeEnabled=tU,this.loop=!0,this.markers=[],this.name="",this.path="",this.playCount=0,this.playDirection=1,this.playSpeed=1,this.projectInterface=new tH,this.renderer=null,this.segmentPos=0,this.segments=[],this.timeCompleted=0,this.totalFrames=0,this.wrapper=null,this.autoloadSegments=!1,this.onComplete=null,this.onDestroy=null,this.onEnterFrame=null,this.onLoopComplete=null,this.onSegmentStart=null,this._completedLoop=!1,this._idle=!0,this._cbs={},this.configAnimation=this.configAnimation.bind(this),this.onSetupError=this.onSetupError.bind(this),this.onSegmentComplete=this.onSegmentComplete.bind(this)}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(){if(this.isLoaded||!this.renderer.globalData?.fontManager?.isLoaded||!this.imagePreloader.loadedImages()&&this.renderer.rendererType===ts.Canvas||!this.imagePreloader.loadedFootages())return;this.isLoaded=!0;let t=tW.plugin;t?.initExpressions(this),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=tK(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.updateFrameModifier(),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;["i/","images/"].some(t=>s?.includes(t))&&(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){if(isNaN(t)){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(t,e,s);this.play()}}goToAndStop(t,e,s){if(!s||this.name===s){if(isNaN(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,tj(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++,tq(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;let e=tW.plugin;e?.initExpressions(this),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),S(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.setAssetsPath(this.assetsPath),this.imagePreloader.setPath(this.path),this.imagePreloader.loadAssets(this.animationData.assets,this.imagesLoaded.bind(this))}renderFrame(t){if(!this.isLoaded)return;let e=t??this.currentFrame+this.firstFrame;try{this.expressionsPlugin?.resetFrame(),this.renderer.renderFrame(e)}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},{attributes:r}=t;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(ty.canvas)return ts.Canvas;let t=Object.keys(ty),{length:e}=t;for(let s=0;s<e;s++)if(ty[t[s]])return t[s];return ts.SVG})();Object.values(ts).includes(a)?i.animType=a:i.animType=ts.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.updateFrameModifier())}setLoop(t){this.loop=t}setParams(t){try{var s,i,r;let a;(t.wrapper||t.container)&&(this.wrapper=t.wrapper??t.container??null);let n=ts.SVG;t.animType?n=t.animType:t.renderer&&(n=t.renderer);let o=(t=>{if(!ty[t])throw Error("Could not get renderer");return ty[t]})(n);if(this.renderer=new o(this,t.rendererSettings),this.imagePreloader.setCacheType(n,this.renderer.globalData?.defs),this.renderer.setProjectInterface(this.projectInterface),this.animType=n,""===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)return void this.setupAnimation(t.animationData);if(!t.path)return;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"))),s=t.path,i=this.configAnimation,r=this.onSetupError,tB(),a=tG(i,r),e?.postMessage({fullPath:$?s:window.location.origin+window.location.pathname,id:a,path:s,type:"loadAnimation"})}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.updateFrameModifier())}setSubframe(t=!1){this.isSubframeEnabled=t}setupAnimation(t){tj(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":{let e=this.enterFrameEvent;e.type=t,e.currentTime=this.currentFrame,e.totalTime=this.totalFrames,e.direction=this.frameModifier<0?-1:1,this.triggerEvent(t,e);let s=this.enterFrameLegacyEvent;s.type=t,s.currentTime=this.currentFrame,s.totalTime=this.totalFrames,s.direction=this.frameMult<0?-1:1,this.onEnterFrame?.(s);break}case"drawnFrame":{let e=this.drawnFrameEvent;e.type=t,e.currentTime=this.currentFrame,e.direction=this.frameModifier<0?-1:1,e.totalTime=this.totalFrames,this.triggerEvent(t,e);break}case"loopComplete":this.triggerEvent(t,new tc(t,Number(this.loop),this.playCount,this.frameMult)),this.onLoopComplete?.(new tc(t,this.loop,this.playCount,this.frameMult));break;case"complete":this.triggerEvent(t,new tl(t,this.frameMult)),this.onComplete?.(new tl(t,this.frameMult));break;case"segmentStart":this.triggerEvent(t,new tm(t,this.firstFrame,this.totalFrames)),this.onSegmentStart?.(new tm(t,this.firstFrame,this.totalFrames));break;case"destroy":this.triggerEvent(t,new td(t,this)),this.onDestroy?.(new td(t,this));break;default:this.triggerEvent(t)}}catch(t){console.error(`${this.constructor.name}: `,t)}}triggerConfigError(t){let e=new tf(t,this.currentFrame);this.triggerEvent("error",e),this.onError?.(e)}triggerRenderFrameError(t){let e=new tu(t,this.currentFrame);this.triggerEvent("error",e),this.onError?.(e)}unmute(t){t&&this.name!==t||this.audioController.unmute()}updateDocumentData(t,e,s){try{let i=this.renderer.getElementByPath(t);i?.updateDocumentData([],e,s)}catch(t){console.error(this.constructor.name,t)}}updateFrameModifier(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection,this.audioController.setRate(this.playSpeed*this.playDirection)}waitForFontsLoaded(){this.renderer.globalData?.fontManager?.isLoaded?this.checkLoaded():setTimeout(this.waitForFontsLoaded.bind(this),20)}}let tQ=!0,t0=0,t1=0,t2=0,t3=[];function t5(){t2++,t2&&tQ&&!$&&(requestAnimationFrame(t4),tQ=!1)}function t4(t){t0=t,$||requestAnimationFrame(t8)}function t6({target:t}){let e=0;if(!t)throw Error("No animation to remove");for(;e<t1;)t3[e]?.animation===t&&(t3.splice(e,1),e--,t1-=1,t.isPaused||t7()),e++}function t8(t){let e=t-t0;for(let t=0;t<t1;t++){let s=t3[t];s&&s.animation.advanceTime(e)}t0=t,!t2||tQ?tQ=!0:$||requestAnimationFrame(t8)}function t9(t,e){t.addEventListener("destroy",t6),t.addEventListener("_active",t5),t.addEventListener("_idle",t7),t3.push({animation:t,elem:e}),t1++}function t7(){t2--}let et=(()=>{function t(t,e){let s,i=[];switch(t){case K.Int16:case K.Uint8c:s=1;break;case K.Float32:case K.Int32:case K.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===K.Float32?new Float32Array(s):e===K.Int16?new Int16Array(s):e===K.Uint8c?new Uint8ClampedArray(s):t(e,s)}:t})();function ee(t){return Array.from({length:t})}class es{constructor(){this.props=et(K.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=et(K.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 es;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=Math.sin(t);return this._t(e,0,s,0,0,1,0,0,-s,0,e,0,0,0,0,1)}rotateZ(t){return this.rotate(t)}scale(t,e,s=1){return 1===t&&1===e&&1===s?this:this._t(t,0,0,0,0,e,0,0,0,0,s,0,0,0,0,1)}setTransform(t,e,s,i,r,a,n,o,h,l,p,c,m,d,u,f){return this.props.set([t,e,s,i,r,a,n,o,h,l,p,c,m,d,u,f]),this}shear(t,e){return this._t(1,e,t,1,0,0)}skew(t,e){return this.shear(Math.tan(t),Math.tan(e))}skewFromAxis(t,e){let s=Math.cos(e),i=Math.sin(e);return this._t(s,i,0,0,-i,s,0,0,0,0,1,0,0,0,0,1)._t(1,0,0,0,Math.tan(t),1,0,0,0,0,1,0,0,0,0,1)._t(s,-i,0,0,i,s,0,0,0,0,1,0,0,0,0,1)}to2dCSS(){let t=this.roundMatrixProperty(this.props[0]??0),e=this.roundMatrixProperty(this.props[1]??0),s=this.roundMatrixProperty(this.props[4]??0),i=this.roundMatrixProperty(this.props[5]??0),r=this.roundMatrixProperty(this.props[12]??0),a=this.roundMatrixProperty(this.props[13]??0);return`matrix(${t},${e},${s},${i},${r},${a})`}toCSS(){let t="matrix3d(";for(let e=0;e<16;e++)t+=`${Math.round((this.props[e]??0)*1e4)/1e4}`+(15===e?")":",");return t}transform(t,e,s,i,r,a,n,o,h,l,p,c,m,d,u,f){let g=this.props;if(1===t&&0===e&&0===s&&0===i&&0===r&&1===a&&0===n&&0===o&&0===h&&0===l&&1===p&&0===c)return g[12]=(g[12]??0)*t+(g[15]??0)*m,g[13]=(g[13]??0)*a+(g[15]??0)*d,g[14]=(g[14]??0)*p+(g[15]??0)*u,g[15]*=f,this._identityCalculated=!1,this;let y=g[0]??0,v=g[1]??0,b=g[2]??0,_=g[3]??0,x=g[4]??0,w=g[5]??0,E=g[6]??0,C=g[7]??0,S=g[8]??0,k=g[9]??0,P=g[10]??0,M=g[11]??0,A=g[12]??0,T=g[13]??0,D=g[14]??0,F=g[15]??0;return g[0]=y*t+v*r+b*h+_*m,g[1]=y*e+v*a+b*l+_*d,g[2]=y*s+v*n+b*p+_*u,g[3]=y*i+v*o+b*c+_*f,g[4]=x*t+w*r+E*h+C*m,g[5]=x*e+w*a+E*l+C*d,g[6]=x*s+w*n+E*p+C*u,g[7]=x*i+w*o+E*c+C*f,g[8]=S*t+k*r+P*h+M*m,g[9]=S*e+k*a+P*l+M*d,g[10]=S*s+k*n+P*p+M*u,g[11]=S*i+k*o+P*c+M*f,g[12]=A*t+T*r+D*h+F*m,g[13]=A*e+T*a+D*l+F*d,g[14]=A*s+T*n+D*p+F*u,g[15]=A*i+T*o+D*c+F*f,this._identityCalculated=!1,this}translate(t,e,s){let i=s||0;return 0!==t||0!==e||0!==i?this._t(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1):this}_t(...t){return this.transform(...t)}roundMatrixProperty(t){return t<1e-6&&t>0||t>-1e-6&&t<0?Math.round(1e4*t)/1e4:t}}let ei="",er=()=>ei,ea=function(){let t=tJ("feColorMatrix");return t.setAttribute("type","matrix"),t.setAttribute("color-interpolation-filters","sRGB"),t.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),t},en=function(t,e){let s=tJ("filter");return s.id=t,e||(s.setAttribute("filterUnits","objectBoundingBox"),s.setAttribute("x","0%"),s.setAttribute("y","0%"),s.setAttribute("width","100%"),s.setAttribute("height","100%")),s},eo="filter_result_",eh={};class el{constructor(t){this.filters=[];let e="SourceGraphic";const s=v(),i=en(s,!0);let r=0,a;const{length:n}=t.data.ef??[];for(let s=0;s<n;s++){a=null;const{ty:n}=t.data.ef?.[s]??{ty:null},o=null!==n&&eh[n]?eh[n].effect:null;o&&n&&t.effectsManager&&(a=new o(i,t.effectsManager.effectElements[s],t,`${eo}${r}`,e),e=`${eo}${r}`,eh[n]?.countsAsEffect&&r++),a&&this.filters.push(a)}r&&(t.globalData?.defs.appendChild(i),t.layerElement?.setAttribute("filter",`url(${er()}#${s})`)),this.filters.length>0&&t.addRenderableComponent(this)}getEffects(t){let{length:e}=this.filters,s=[];for(let i=0;i<e;i++)this.filters[i]?.type===t&&s.push(this.filters[i]);return s}renderFrame(t){let{length:e}=this.filters;for(let s=0;s<e;s++)this.filters[s]?.renderFrame(t)}}let ep=(t,e,s)=>{eh[t]={countsAsEffect:s,effect:e}};class ec{constructor(t,e,s){this._length=0,this._maxLength=t,this._create=e,this._release=s,this.pool=ee(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,...ee(e.length)],this._maxLength*=2}this._release&&this._release(t),this.pool[this._length]=t,this._length++}}let em=new ec(8,()=>et(K.Float32,2));class ed{get _type(){return"ShapePath"}constructor(){this._length=0,this._maxLength=8,this.c=!1,this.lengths=[],this.v=ee(this._maxLength),this.o=ee(this._maxLength),this.i=ee(this._maxLength)}doubleArrayLength(){this.v=[...this.v,...ee(this._maxLength)],this.i=[...this.i,...ee(this._maxLength)],this.o=[...this.o,...ee(this._maxLength)],this._maxLength*=2}length(){return this._length}setLength(t){for(;this._maxLength<t;)this.doubleArrayLength();this._length=t}setPathData(t,e){this.c=t,this.setLength(e);let s=0;for(;s<e;)this.v[s]=em.newElement(),this.o[s]=em.newElement(),this.i[s]=em.newElement(),s++}setTripleAt(t,e,s,i,r,a,n,o){this.setXYAt(t,e,"v",n,o),this.setXYAt(s,i,"o",n,o),this.setXYAt(r,a,"i",n,o)}setXYAt(t,e,s,i,r){let a;switch(this._length=Math.max(this._length,i+1),this._length>=this._maxLength&&this.doubleArrayLength(),s){case"v":a=this.v;break;case"i":a=this.i;break;case"o":a=this.o;break;default:a=[]}a[i]&&r||(a[i]=em.newElement()),a[i][0]=t,a[i][1]=e}toReversed(){let t=new ed;t.setPathData(this.c,this._length);let e=this.v,s=this.o,i=this.i,r=0;this.c&&(t.setTripleAt(e[0]?.[0]??0,e[0]?.[1]??0,i[0]?.[0]??0,i[0]?.[1]??0,s[0]?.[0]??0,s[0]?.[1]??0,0,!1),r=1);let{_length:a}=this,n=a-1;for(let o=r;o<a;o++)t.setTripleAt(e[n]?.[0]??0,e[n]?.[1]??0,i[n]?.[0]??0,i[n]?.[1]??0,s[n]?.[0]??0,s[n]?.[1]??0,o,!1),n-=1;return t}}let eu=new ec(4,function(){return new ed},function(t){if(!A(t))return;let e=t._length;for(let s=0;s<e;s++)em.release(t.v[s]),em.release(t.i[s]),em.release(t.o[s]),t.v[s]=null,t.i[s]=null,t.o[s]=null;t._length=0,t.c=!1}),{newElement:ef}=eu,{release:eg}=eu;function ey(t){let e=ef(),s=t._length??t.v.length;e.setLength(s),e.c=t.c;for(let i=0;i<s;i++)e.setTripleAt(t.v[i]?.[0]??0,t.v[i]?.[1]??0,t.o[i]?.[0]??0,t.o[i]?.[1]??0,t.i[i]?.[0]??0,t.i[i]?.[1]??0,i);return e}class ev{constructor(){this._length=0,this._maxLength=4,this.shapes=ee(this._maxLength)}addShape(t){this._length===this._maxLength&&(this.shapes=[...this.shapes,...ee(this._maxLength)],this._maxLength*=2),this.shapes[this._length]=t,this._length++}releaseShapes(){for(let t=0;t<this._length;t++)eg(this.shapes[t]);this._length=0}}function eb(){return new ev}ee(4);let e_={default:150},ex=new ec(8,()=>({addedLength:0,lengths:et(K.Float32,e_.default),percents:et(K.Float32,e_.default)})),ew=new ec(8,()=>({lengths:[],totalLength:0}),t=>{if(!A(t))return;let{length:e}=t.lengths;for(let s=0;s<e;s++)ex.release(t.lengths[s]);t.lengths.length=0}),eE=et(K.Float32,8);function eC(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=e_.default,o,h,l=0,p,c,m=null;2===t.length&&(t[0]!==e[0]||t[1]!==e[1])&&eP(t[0],t[1],e[0],e[1],t[0]+s[0],t[1]+s[1])&&eP(t[0],t[1],e[0],e[1],e[0]+i[0],e[1]+i[1])&&(n=2);let d=new eD(n),{length:u}=s;for(let r=0;r<n;r++){c=ee(u),h=r/(n-1),p=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),c[r]=o,null!==m&&(p+=Math.pow(Number(c[r])-Number(m[r]),2));l+=p=Math.sqrt(p),d.points[r]=new eF(p,c),m=c}d.segmentLength=l,r[a]=d}return r[a]}function eS(t,e,s,i,r,a,n){let o=r,h=a;o<0?o=0:o>1&&(o=1);let l=eT(o,n)??0,p=eT(h=h>1?1:h,n)??0,c=1-l,m=1-p,d=c*c*c,u=l*c*c*3,f=l*l*c*3,g=l*l*l,y=c*c*m,v=l*c*m+c*l*m+c*c*p,b=l*l*m+c*l*p+l*c*p,_=l*l*p,x=c*m*m,w=l*m*m+c*p*m+c*m*p,E=l*p*m+c*p*p+l*m*p,C=l*p*p,S=m*m*m,k=p*m*m+m*p*m+m*m*p,P=p*p*m+m*p*p+p*m*p,M=p*p*p,{length:A}=t;for(let r=0;r<A;r++)eE[4*r]=Math.round((d*(t[r]??0)+u*(s[r]??0)+f*(i[r]??0)+g*(e[r]??0))*1e3)/1e3,eE[4*r+1]=Math.round((y*(t[r]??0)+v*(s[r]??0)+b*(i[r]??0)+_*(e[r]??0))*1e3)/1e3,eE[4*r+2]=Math.round((x*(t[r]??0)+w*(s[r]??0)+E*(i[r]??0)+C*(e[r]??0))*1e3)/1e3,eE[4*r+3]=Math.round((S*(t[r]??0)+k*(s[r]??0)+P*(i[r]??0)+M*(e[r]??0))*1e3)/1e3;return eE}function ek(t){let e,s=ew.newElement(),i=t.c,r=t.v,a=t.o,n=t.i,o=t._length||0,{lengths:h}=s,l=0;for(e=0;e<o-1;e++)h[e]=eA(r[e],r[e+1],a[e],n[e+1]),l+=h[e]?.addedLength??0;return i&&o&&(h[e]=eA(r[e],r[0],a[e],n[0]),l+=h[e]?.addedLength??0),s.totalLength=l,s}function eP(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 eM(t,e,s,i,r,a,n,o,h){let l;if(0===s&&0===a&&0===h)return eP(t,e,i,r,n,o);let p=Math.sqrt(Math.pow(i-t,2)+Math.pow(r-e,2)+Math.pow(a-s,2)),c=Math.sqrt(Math.pow(n-t,2)+Math.pow(o-e,2)+Math.pow(h-s,2)),m=Math.sqrt(Math.pow(n-i,2)+Math.pow(o-r,2)+Math.pow(h-a,2));return(l=p>c?p>m?p-c-m:m-c-p:m>c?m-c-p:c-p-m)>-1e-4&&l<1e-4}function eA(t,e,s,i){let r=e_.default,a,n,o=0,h,l=[],p=[],c=ex.newElement(),m=s.length;for(let d=0;d<r;d++){n=d/(r-1),h=0;for(let r=0;r<m;r++)a=Math.pow(1-n,3)*(t[r]??0)+3*Math.pow(1-n,2)*n*(s[r]??0)+3*(1-n)*Math.pow(n,2)*(i[r]??0)+Math.pow(n,3)*(e[r]??0),l[r]=a,"number"==typeof p[r]&&(h+=Math.pow((l[r]??0)-(p[r]??0),2)),p[r]=l[r]??0;h&&(o+=h=Math.sqrt(h)),c.percents[d]=n,c.lengths[d]=o}return c.addedLength=o,c}function eT(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 eD{constructor(t){this.segmentLength=0,this.points=Array.from({length:t})}}class eF{constructor(t,e){this.partialLength=t,this.point=e}}let eI=function(t,e,s,i,r,a){let n=eT(r,a)??0,o=1-n;return[Math.round((o*o*o*t[0]+(n*o*o+o*n*o+o*o*n)*s[0]+(n*n*o+o*n*n+n*o*n)*i[0]+n*n*n*e[0])*1e3)/1e3,Math.round((o*o*o*t[1]+(n*o*o+o*n*o+o*o*n)*s[1]+(n*n*o+o*n*n+n*o*n)*i[1]+n*n*n*e[1])*1e3)/1e3]},eL={};function e$(t,e,s,i,r){let a=r||`bez_${t}_${e}_${s}_${i}`.replaceAll(".","p");if(eL[a])return eL[a];let n=new eN([t,e,s,i]);return eL[a]=n,n}class eN{constructor(t){this._precomputed=!1,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.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;)r+=this.kSampleStepSize,++a;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 eV{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 eR=t=>{let e=t[0]*F,s=t[1]*F,i=t[2]*F,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 eO extends eV{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{_caching:t,comp:e,keyframes:s,offsetTime:i}=this,r=Number(e?.renderedFrame)-i,a=(s[0]?.t??0)-i,n=s.length-1,o=(s[n]?.t??0)-i,{lastFrame:h}=t;return r===h||-999999!==h&&(h>=o&&r>=o||h<a&&r<a)||(h>=r&&(t._lastKeyframeIndex=-1,t.lastIndex=0),this.pv=this.interpolateValue(r,t)),t.lastFrame=r,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,{offsetTime:i,pv:r}=this,a=[0,0,0];this.propType===ta.MultiDimensional&&r&&(a=et(K.Float32,r.length));let{keyframes:n=[],keyframesMetadata:o,propType:h}=this,l=e.lastIndex||0,p=l,c=n.length-1,m=!0,d=n[0]??{},u=n[1]??{};for(;m;){if(d=n[p]??{},u=n[p+1]??{},p===c-1&&t>=u.t-i){d.h&&(d=u),l=0;break}if(u.t-i>t){l=p;break}p<c-1?p++:(l=0,m=!1)}let f=o[p]??{},g,y,v,b,_=null,x=u.t-i,w=d.t-i;if(d.to&&d.s){f.bezierData=f.bezierData??eC(d.s,u.s??d.e,d.to,d.ti);let{__fnct:s,bezierData:i}=f;if(t>=x||t<w){let e=t>=x?i.points.length-1:0;g=i.points[e]?.point.length??0;for(let t=0;t<g;t++)a[t]=i.points[e]?.point[t]??0}else{s?_=s:f.__fnct=_=e$(d.o.x,d.o.y,d.i.x,d.i.y,d.n).get,y=_((t-w)/(x-w));let r=i.segmentLength*y,n,o=e.lastFrame<t&&e._lastKeyframeIndex===p?e._lastAddedLength:0;for(b=e.lastFrame<t&&e._lastKeyframeIndex===p?e._lastPoint:0,m=!0,v=i.points.length;m;){if(o+=i.points[b]?.partialLength??0,0===r||0===y||b===i.points.length-1){g=i.points[b]?.point.length??0;for(let t=0;t<g;t++)a[t]=i.points[b]?.point[t]??0;break}if(r>=o&&r<o+(i.points[b+1]?.partialLength??0)){n=(r-o)/(i.points[b+1]?.partialLength??0),g=i.points[b]?.point.length??0;for(let t=0;t<g;t++)a[t]=(i.points[b]?.point[t]??0)+((i.points[b+1]?.point[t]??0)-(i.points[b]?.point[t]??0))*n;break}b<v-1?b++:m=!1}e._lastPoint=b,e._lastAddedLength=o-(i.points[b]?.partialLength??0),e._lastKeyframeIndex=p}}else{let e,i,r,n;if(c=d.s?.length||0,s=u.s??d.e,this.sh&&1!==d.h)if(t>=x)a[0]=s[0],a[1]=s[1],a[2]=s[2];else if(t<=w&&d.s)a[0]=d.s[0],a[1]=d.s[1],a[2]=d.s[2];else{var E,C,k;let e,i,r,n,o,h,l,p,c,m,u,f,g,y,v,b,_,S,P,M,A,T=eR(d.s),D=eR(s);C=a,v=(E=(t-w)/(x-w),e=[0,0,0,0],i=T[0],r=T[1],n=T[2],o=T[3],h=D[0],l=D[1],(u=i*h+r*l+n*(p=D[2])+o*(c=D[3]))<0&&(u=-u,h=-h,l=-l,p=-p,c=-c),1-u>1e-6?(f=Math.sin(m=Math.acos(u)),g=Math.sin((1-E)*m)/f,y=Math.sin(E*m)/f):(g=1-E,y=E),e[0]=g*i+y*h,e[1]=g*r+y*l,e[2]=g*n+y*p,e[3]=g*o+y*c,k=e)[0],b=k[1],_=k[2],P=Math.atan2(2*b*(S=k[3])-2*v*_,1-2*b*b-2*_*_),M=Math.asin(2*v*b+2*_*S),A=Math.atan2(2*v*S-2*b*_,1-2*v*v-2*_*_),C[0]=P/F,C[1]=M/F,C[2]=A/F}else for(p=0;p<c;p++)1!==d.h&&(t>=x?y=1:t<w?y=0:(d.o.x.constructor===Array?(f.__fnct=f.__fnct??[],f.__fnct[p]?_=f.__fnct[p]:S(d.o.y)&&S(d.i.y)&&S(d.i.x)&&(e=d.o.x[p]??d.o.x[0],i=d.o.y[p]??d.o.y[0],_=e$(e??0,i??0,(r=d.i.x[p]??d.i.x[0])??0,d.i.y[p]??d.i.y[0]??0).get,f.__fnct[p]=_)):f.__fnct?_=f.__fnct:(e=d.o.x,i=d.o.y,_=e$(e,i,r=d.i.x,d.i.y).get,d.keyframeMetadata=_),y=_?.((t-w)/(x-w)))),s=u.s??d.e,void 0!==(n=1===d.h?d.s?.[p]:Number(d.s?.[p])+((s[p]??0)-Nu