import{c as Ot}from"./chunk-HUWAVRQ2.js";import{a as yt,b as Ct}from"./chunk-QRKRR6S3.js";import{l as Ut}from"./chunk-PC6PY622.js";import{a as q3,c as qt,d as Wt,g as jt,h as $t,i as Kt}from"./chunk-WD5N4NYR.js";import{a as lt}from"./chunk-4MO2GEVR.js";import{b as k2,c as U3,d as ft,e as U,f as _2,i as Gt,j as K3,m as n1,n as e3,o as X1}from"./chunk-MAREYZRL.js";import{a as Bt}from"./chunk-PHOD3DD2.js";import{a as ht,d as ut,f as pt,g as mt,h as dt,i as vt}from"./chunk-SV4FETYH.js";import{$ as Y4,A as A2,B as a1,C as $3,D as K1,E as bt,F as xt,G as wt,H as Et,I as Tt,J as Q1,L as Y1,M as B4,N as kt,O as Pt,Q as O4,R as G4,S as U4,T as q4,U as W4,V as N2,W as j4,X as $4,Y as K4,Z as Q4,a as gt,aa as X4,ba as At,c as R,ca as Nt,d as V1,da as J4,e as Ht,ea as It,f as zt,g as Mt,ga as Z4,h as N4,ha as Ft,i as W3,j as $1,ja as Rt,k as I4,l as F4,m as R4,ma as Dt,n as j3,p as Vt,q as P2,u as _t,w as D4,x as a2,y as St,z as Lt}from"./chunk-EQJKWD2C.js";import{Aa as Y6,Bc as nt,Cb as k4,Cc as ot,Da as T2,Fb as P4,Hb as v2,J as $6,La as G3,Ra as X2,Sb as st,Tb as rt,Ua as X6,Ya as J6,Yb as ct,a as L4,ab as T4,c as j6,d as er,e as tr,ec as it,g as C1,ga as $,gb as M1,ia as H1,la as b4,ma as x4,na as z1,nb as U1,oa as w4,ob as q1,pa as O3,pb as Z6,qb as et,qc as at,rb as tt,sa as c1,sb as W1,ta as i1,tb as J2,ub as Z2,vb as j1,wa as E4,xa as K6,ya as Q6,zc as A4}from"./chunk-6TIQTSST.js";var ts=er((exports,module)=>{"use strict";typeof navigator<"u"&&(function(t,e){typeof exports=="object"&&typeof module<"u"?module.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t.lottie=e())})(exports,function(){"use strict";var svgNS="http://www.w3.org/2000/svg",locationHref="",_useWebWorker=!1,initialDefaultFrame=-999999,setWebWorker=function(e){_useWebWorker=!!e},getWebWorker=function(){return _useWebWorker},setLocationHref=function(e){locationHref=e},getLocationHref=function(){return locationHref};function createTag(t){return document.createElement(t)}function extendPrototype(t,e){var s,r=t.length,c;for(s=0;s1?s[1]=1:s[1]<=0&&(s[1]=0),HSVtoRGB(s[0],s[1],s[2])}function addBrightnessToRGB(t,e){var s=RGBtoHSV(t[0]*255,t[1]*255,t[2]*255);return s[2]+=e,s[2]>1?s[2]=1:s[2]<0&&(s[2]=0),HSVtoRGB(s[0],s[1],s[2])}function addHueToRGB(t,e){var s=RGBtoHSV(t[0]*255,t[1]*255,t[2]*255);return s[0]+=e/360,s[0]>1?s[0]-=1:s[0]<0&&(s[0]+=1),HSVtoRGB(s[0],s[1],s[2])}var rgbToHex=(function(){var t=[],e,s;for(e=0;e<256;e+=1)s=e.toString(16),t[e]=s.length===1?"0"+s:s;return function(r,c,i){return r<0&&(r=0),c<0&&(c=0),i<0&&(i=0),"#"+t[r]+t[c]+t[i]}})(),setSubframeEnabled=function(e){subframeEnabled=!!e},getSubframeEnabled=function(){return subframeEnabled},setExpressionsPlugin=function(e){expressionsPlugin=e},getExpressionsPlugin=function(){return expressionsPlugin},setDefaultCurveSegments=function(e){defaultCurveSegments=e},getDefaultCurveSegments=function(){return defaultCurveSegments},setIdPrefix=function(e){idPrefix$1=e},getIdPrefix=function(){return idPrefix$1};function createNS(t){return document.createElementNS(svgNS,t)}function _typeof$5(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$5=function(s){return typeof s}:_typeof$5=function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},_typeof$5(t)}var dataManager=(function(){var t=1,e=[],s,r,c={onmessage:function(){},postMessage:function(C){s({data:C})}},i={postMessage:function(C){c.onmessage({data:C})}};function a(u){if(window.Worker&&window.Blob&&getWebWorker()){var C=new Blob(["var _workerSelf = self; self.onmessage = ",u.toString()],{type:"text/javascript"}),v=URL.createObjectURL(C);return new Worker(v)}return s=u,c}function n(){r||(r=a(function(C){function v(){function V(T,b){var S,M,x=T.length,k,E,F,G;for(M=0;M=0;b-=1)if(T[b].ty==="sh")if(T[b].ks.k.i)H(T[b].ks.k);else for(x=T[b].ks.k.length,M=0;MS[0]?!0:S[0]>T[0]?!1:T[1]>S[1]?!0:S[1]>T[1]?!1:T[2]>S[2]?!0:S[2]>T[2]?!1:null}var _=(function(){var T=[4,4,14];function b(M){var x=M.t.d;M.t.d={k:[{s:x,t:0}]}}function S(M){var x,k=M.length;for(x=0;x=0;x-=1)if(M[x].ty==="sh")if(M[x].ks.k.i)M[x].ks.k.c=M[x].closed;else for(F=M[x].ks.k.length,E=0;E500)&&(this._imageLoaded(),clearInterval(p)),d+=1}).bind(this),50)}function i(f){var d=r(f,this.assetsPath,this.path),p=createNS("image");isSafari?this.testImageLoaded(p):p.addEventListener("load",this._imageLoaded,!1),p.addEventListener("error",(function(){h.img=t,this._imageLoaded()}).bind(this),!1),p.setAttributeNS("http://www.w3.org/1999/xlink","href",d),this._elementHelper.append?this._elementHelper.append(p):this._elementHelper.appendChild(p);var h={img:p,assetData:f};return h}function a(f){var d=r(f,this.assetsPath,this.path),p=createTag("img");p.crossOrigin="anonymous",p.addEventListener("load",this._imageLoaded,!1),p.addEventListener("error",(function(){h.img=t,this._imageLoaded()}).bind(this),!1),p.src=d;var h={img:p,assetData:f};return h}function n(f){var d={assetData:f},p=r(f,this.assetsPath,this.path);return dataManager.loadData(p,(function(h){d.img=h,this._footageLoaded()}).bind(this),(function(){d.img={},this._footageLoaded()}).bind(this)),d}function o(f,d){this.imagesLoadedCb=d;var p,h=f.length;for(p=0;pthis.animationData.op&&(this.animationData.op=t.op,this.totalFrames=Math.floor(t.op-this.animationData.ip));var e=this.animationData.layers,s,r=e.length,c=t.layers,i,a=c.length;for(i=0;ithis.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},AnimationItem.prototype.renderFrame=function(){if(!(this.isLoaded===!1||!this.renderer))try{this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(t){this.triggerRenderFrameError(t)}},AnimationItem.prototype.play=function(t){t&&this.name!==t||this.isPaused===!0&&(this.isPaused=!1,this.trigger("_pause"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(t){t&&this.name!==t||this.isPaused===!1&&(this.isPaused=!0,this.trigger("_play"),this._idle=!0,this.trigger("_idle"),this.audioController.pause())},AnimationItem.prototype.togglePause=function(t){t&&this.name!==t||(this.isPaused===!0?this.play():this.pause())},AnimationItem.prototype.stop=function(t){t&&this.name!==t||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.getMarkerData=function(t){for(var e,s=0;s=this.totalFrames-1&&this.frameModifier>0?!this.loop||this.playCount===this.loop?this.checkSegments(e>this.totalFrames?e%this.totalFrames:0)||(s=!0,e=this.totalFrames-1):e>=this.totalFrames?(this.playCount+=1,this.checkSegments(e%this.totalFrames)||(this.setCurrentRawFrameValue(e%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(e):e<0?this.checkSegments(e%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&this.loop!==!0)?(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"))}},AnimationItem.prototype.adjustSegment=function(t,e){this.playCount=0,t[1]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")},AnimationItem.prototype.setSegment=function(t,e){var s=-1;this.isPaused&&(this.currentRawFrame+this.firstFramee&&(s=e-t)),this.firstFrame=t,this.totalFrames=e-t,this.timeCompleted=this.totalFrames,s!==-1&&this.goToAndStop(s,!0)},AnimationItem.prototype.playSegments=function(t,e){if(e&&(this.segments.length=0),_typeof$4(t[0])==="object"){var s,r=t.length;for(s=0;s=0;S-=1)e[S].animation.destroy(b)}function L(b,S,M){var x=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),k,E=x.length;for(k=0;k0?h=L:p=L;while(Math.abs(_)>i&&++w=c?V(p,A,h,H):P===0?A:g(p,_,_+o,h,H)}},t})(),pooling=(function(){function t(e){return e.concat(createSizedArray(e.length))}return{double:t}})(),poolFactory=(function(){return function(t,e,s){var r=0,c=t,i=createSizedArray(c),a={newElement:n,release:o};function n(){var l;return r?(r-=1,l=i[r]):l=e(),l}function o(l){r===c&&(i=pooling.double(i),c*=2),s&&s(l),i[r]=l,r+=1}return a}})(),bezierLengthPool=(function(){function t(){return{addedLength:0,percents:createTypedArray("float32",getDefaultCurveSegments()),lengths:createTypedArray("float32",getDefaultCurveSegments())}}return poolFactory(8,t)})(),segmentsLengthPool=(function(){function t(){return{lengths:[],totalLength:0}}function e(s){var r,c=s.lengths.length;for(r=0;r-.001&&d<.001}function s(u,C,v,g,V,f,d,p,h){if(v===0&&f===0&&h===0)return e(u,C,g,V,d,p);var H=t.sqrt(t.pow(g-u,2)+t.pow(V-C,2)+t.pow(f-v,2)),z=t.sqrt(t.pow(d-u,2)+t.pow(p-C,2)+t.pow(h-v,2)),_=t.sqrt(t.pow(d-g,2)+t.pow(p-V,2)+t.pow(h-f,2)),L;return H>z?H>_?L=H-z-_:L=_-z-H:_>z?L=_-z-H:L=z-H-_,L>-1e-4&&L<1e-4}var r=(function(){return function(u,C,v,g){var V=getDefaultCurveSegments(),f,d,p,h,H,z=0,_,L=[],w=[],N=bezierLengthPool.newElement();for(p=v.length,f=0;fd?-1:1,H=!0;H;)if(g[f]<=d&&g[f+1]>d?(p=(d-g[f])/(g[f+1]-g[f]),H=!1):f+=h,f<0||f>=V-1){if(f===V-1)return v[f];H=!1}return v[f]+(v[f+1]-v[f])*p}function l(u,C,v,g,V,f){var d=o(V,f),p=1-d,h=t.round((p*p*p*u[0]+(d*p*p+p*d*p+p*p*d)*v[0]+(d*d*p+p*d*d+d*p*d)*g[0]+d*d*d*C[0])*1e3)/1e3,H=t.round((p*p*p*u[1]+(d*p*p+p*d*p+p*p*d)*v[1]+(d*d*p+p*d*d+d*p*d)*g[1]+d*d*d*C[1])*1e3)/1e3;return[h,H]}var m=createTypedArray("float32",8);function y(u,C,v,g,V,f,d){V<0?V=0:V>1&&(V=1);var p=o(V,d);f=f>1?1:f;var h=o(f,d),H,z=u.length,_=1-p,L=1-h,w=_*_*_,N=p*_*_*3,A=p*p*_*3,P=p*p*p,I=_*_*L,D=p*_*L+_*p*L+_*_*h,T=p*p*L+_*p*h+p*_*h,b=p*p*h,S=_*L*L,M=p*L*L+_*h*L+_*L*h,x=p*h*L+_*h*h+p*L*h,k=p*h*h,E=L*L*L,F=h*L*L+L*h*L+L*L*h,G=h*h*L+L*h*h+h*L*h,B=h*h*h;for(H=0;H=w.t-d){L.h&&(L=w),h=0;break}if(w.t-d>V){h=H;break}H=S||V=S?k.points.length-1:0;for(P=k.points[E].point.length,A=0;A=B&&F=S)p[0]=x[0],p[1]=x[1],p[2]=x[2];else if(V<=M)p[0]=L.s[0],p[1]=L.s[1],p[2]=L.s[2];else{var i2=i(L.s),t2=i(x),h2=(V-M)/(S-M);c(p,r(i2,t2,h2))}else for(H=0;H=S?I=1:V1e-6?(P=Math.acos(I),D=Math.sin(P),T=Math.sin((1-d)*P)/D,b=Math.sin(d*P)/D):(T=1-d,b=d),p[0]=T*h+b*L,p[1]=T*H+b*w,p[2]=T*z+b*N,p[3]=T*_+b*A,p}function c(V,f){var d=f[0],p=f[1],h=f[2],H=f[3],z=Math.atan2(2*p*H-2*d*h,1-2*p*p-2*h*h),_=Math.asin(2*d*p+2*h*H),L=Math.atan2(2*d*H-2*p*h,1-2*d*d-2*h*h);V[0]=z/degToRads,V[1]=_/degToRads,V[2]=L/degToRads}function i(V){var f=V[0]*degToRads,d=V[1]*degToRads,p=V[2]*degToRads,h=Math.cos(f/2),H=Math.cos(d/2),z=Math.cos(p/2),_=Math.sin(f/2),L=Math.sin(d/2),w=Math.sin(p/2),N=h*H*z-_*L*w,A=_*L*z+h*H*w,P=_*H*z+h*L*w,I=h*L*z-_*H*w;return[A,P,I,N]}function a(){var V=this.comp.renderedFrame-this.offsetTime,f=this.keyframes[0].t-this.offsetTime,d=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(V===this._caching.lastFrame||this._caching.lastFrame!==t&&(this._caching.lastFrame>=d&&V>=d||this._caching.lastFrame=V&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var p=this.interpolateValue(V,this._caching);this.pv=p}return this._caching.lastFrame=V,this.pv}function n(V){var f;if(this.propType==="unidimensional")f=V*this.mult,e(this.v-f)>1e-5&&(this.v=f,this._mdf=!0);else for(var d=0,p=this.v.length;d1e-5&&(this.v[d]=f,this._mdf=!0),d+=1}function o(){if(!(this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)){if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=this._isFirstFrame;var V,f=this.effectsSequence.length,d=this.kf?this.pv:this.data.k;for(V=0;V=this._maxLength&&this.doubleArrayLength(),s){case"v":i=this.v;break;case"i":i=this.i;break;case"o":i=this.o;break;default:i=[];break}(!i[r]||i[r]&&!c)&&(i[r]=pointPool.newElement()),i[r][0]=t,i[r][1]=e},ShapePath.prototype.setTripleAt=function(t,e,s,r,c,i,a,n){this.setXYAt(t,e,"v",a,n),this.setXYAt(s,r,"o",a,n),this.setXYAt(c,i,"i",a,n)},ShapePath.prototype.reverse=function(){var t=new ShapePath;t.setPathData(this.c,this._length);var e=this.v,s=this.o,r=this.i,c=0;this.c&&(t.setTripleAt(e[0][0],e[0][1],r[0][0],r[0][1],s[0][0],s[0][1],0,!1),c=1);var i=this._length-1,a=this._length,n;for(n=c;n=D[D.length-1].t-this.offsetTime)H=D[D.length-1].s?D[D.length-1].s[0]:D[D.length-2].e[0],_=!0;else{for(var T=h,b=D.length-1,S=!0,M,x,k;S&&(M=D[T],x=D[T+1],!(x.t-this.offsetTime>f));)T=x.t-this.offsetTime)P=1;else if(fp&&f>p)||(this._caching.lastIndex=h0||S>-1e-6&&S<0?r(S*M)/M:S}function b(){var S=this.props,M=T(S[0]),x=T(S[1]),k=T(S[4]),E=T(S[5]),F=T(S[12]),G=T(S[13]);return"matrix("+M+","+x+","+k+","+E+","+F+","+G+")"}return function(){this.reset=c,this.rotate=i,this.rotateX=a,this.rotateY=n,this.rotateZ=o,this.skew=m,this.skewFromAxis=y,this.shear=l,this.scale=u,this.setTransform=C,this.translate=v,this.transform=g,this.applyToPoint=h,this.applyToX=H,this.applyToY=z,this.applyToZ=_,this.applyToPointArray=P,this.applyToTriplePoints=A,this.applyToPointStringified=I,this.toCSS=D,this.to2dCSS=b,this.clone=d,this.cloneFromProps=p,this.equals=f,this.inversePoints=N,this.inversePoint=w,this.getInverseMatrix=L,this._t=this.transform,this.isIdentity=V,this._identity=!0,this._identityCalculated=!1,this.props=createTypedArray("float32",16),this.reset()}})();function _typeof$3(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$3=function(s){return typeof s}:_typeof$3=function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},_typeof$3(t)}var lottie={},standalone="__[STANDALONE]__",animationData="__[ANIMATIONDATA]__",renderer="";function setLocation(t){setLocationHref(t)}function searchAnimations(){standalone===!0?animationManager.searchAnimations(animationData,standalone,renderer):animationManager.searchAnimations()}function setSubframeRendering(t){setSubframeEnabled(t)}function setPrefix(t){setIdPrefix(t)}function loadAnimation(t){return standalone===!0&&(t.animationData=JSON.parse(animationData)),animationManager.loadAnimation(t)}function setQuality(t){if(typeof t=="string")switch(t){case"high":setDefaultCurveSegments(200);break;default:case"medium":setDefaultCurveSegments(50);break;case"low":setDefaultCurveSegments(10);break}else!isNaN(t)&&t>1&&setDefaultCurveSegments(t);getDefaultCurveSegments()>=50?roundValues(!1):roundValues(!0)}function inBrowser(){return typeof navigator<"u"}function installPlugin(t,e){t==="expressions"&&setExpressionsPlugin(e)}function getFactory(t){switch(t){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix;default:return null}}lottie.play=animationManager.play,lottie.pause=animationManager.pause,lottie.setLocationHref=setLocation,lottie.togglePause=animationManager.togglePause,lottie.setSpeed=animationManager.setSpeed,lottie.setDirection=animationManager.setDirection,lottie.stop=animationManager.stop,lottie.searchAnimations=searchAnimations,lottie.registerAnimation=animationManager.registerAnimation,lottie.loadAnimation=loadAnimation,lottie.setSubframeRendering=setSubframeRendering,lottie.resize=animationManager.resize,lottie.goToAndStop=animationManager.goToAndStop,lottie.destroy=animationManager.destroy,lottie.setQuality=setQuality,lottie.inBrowser=inBrowser,lottie.installPlugin=installPlugin,lottie.freeze=animationManager.freeze,lottie.unfreeze=animationManager.unfreeze,lottie.setVolume=animationManager.setVolume,lottie.mute=animationManager.mute,lottie.unmute=animationManager.unmute,lottie.getRegisteredAnimations=animationManager.getRegisteredAnimations,lottie.useWebWorker=setWebWorker,lottie.setIDPrefix=setPrefix,lottie.__getFactory=getFactory,lottie.version="5.9.6";function checkReady(){document.readyState==="complete"&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(t){for(var e=queryString.split("&"),s=0;s"u"?"undefined":_typeof$3(exports))==="object"&&typeof module<"u")&&!(typeof define=="function"&&define.amd)&&(window.bodymovin=lottie)}catch(t){}var ShapeModifiers=(function(){var t={},e={};t.registerModifier=s,t.getModifier=r;function s(c,i){e[c]||(e[c]=i)}function r(c,i,a){return new e[c](i,a)}return t})();function ShapeModifier(){}ShapeModifier.prototype.initModifierProperties=function(){},ShapeModifier.prototype.addShapeToModifier=function(){},ShapeModifier.prototype.addShape=function(t){if(!this.closed){t.sh.container.addDynamicProperty(t.sh);var e={shape:t.sh,data:t,localShapeCollection:shapeCollectionPool.newShapeCollection()};this.shapes.push(e),this.addShapeToModifier(e),this._isAnimated&&t.setAsAnimated()}},ShapeModifier.prototype.init=function(t,e){this.shapes=[],this.elem=t,this.initDynamicPropertyContainer(t),this.initModifierProperties(t,e),this.frameId=initialDefaultFrame,this.closed=!1,this.k=!1,this.dynamicProperties.length?this.k=!0:this.getValue(!0)},ShapeModifier.prototype.processKeys=function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties())},extendPrototype([DynamicPropertyContainer],ShapeModifier);function TrimModifier(){}extendPrototype([ShapeModifier],TrimModifier),TrimModifier.prototype.initModifierProperties=function(t,e){this.s=PropertyFactory.getProp(t,e.s,0,.01,this),this.e=PropertyFactory.getProp(t,e.e,0,.01,this),this.o=PropertyFactory.getProp(t,e.o,0,0,this),this.sValue=0,this.eValue=0,this.getValue=this.processKeys,this.m=e.m,this._isAnimated=!!this.s.effectsSequence.length||!!this.e.effectsSequence.length||!!this.o.effectsSequence.length},TrimModifier.prototype.addShapeToModifier=function(t){t.pathsData=[]},TrimModifier.prototype.calculateShapeEdges=function(t,e,s,r,c){var i=[];e<=1?i.push({s:t,e}):t>=1?i.push({s:t-1,e:e-1}):(i.push({s:t,e:1}),i.push({s:0,e:e-1}));var a=[],n,o=i.length,l;for(n=0;nr+s)){var m,y;l.s*c<=r?m=0:m=(l.s*c-r)/s,l.e*c>=r+s?y=1:y=(l.e*c-r)/s,a.push([m,y])}return a.length||a.push([0,0]),a},TrimModifier.prototype.releasePathsData=function(t){var e,s=t.length;for(e=0;e1?e=1+r:this.s.v<0?e=0+r:e=this.s.v+r,this.e.v>1?s=1+r:this.e.v<0?s=0+r:s=this.e.v+r,e>s){var c=e;e=s,s=c}e=Math.round(e*1e4)*1e-4,s=Math.round(s*1e4)*1e-4,this.sValue=e,this.eValue=s}else e=this.sValue,s=this.eValue;var i,a,n=this.shapes.length,o,l,m,y,u,C=0;if(s===e)for(a=0;a=0;a-=1)if(g=this.shapes[a],g.shape._mdf){for(V=g.localShapeCollection,V.releaseShapes(),this.m===2&&n>1?(h=this.calculateShapeEdges(e,s,g.totalShapeLength,p,C),p+=g.totalShapeLength):h=[[f,d]],l=h.length,o=0;o=1?v.push({s:g.totalShapeLength*(f-1),e:g.totalShapeLength*(d-1)}):(v.push({s:g.totalShapeLength*f,e:g.totalShapeLength}),v.push({s:0,e:g.totalShapeLength*(d-1)}));var H=this.addShapes(g,v[0]);if(v[0].s!==v[0].e){if(v.length>1){var z=g.shape.paths.shapes[g.shape.paths._length-1];if(z.c){var _=H.pop();this.addPaths(H,V),H=this.addShapes(g,v[1],_)}else this.addPaths(H,V),H=this.addShapes(g,v[1])}this.addPaths(H,V)}}g.shape.paths=V}}},TrimModifier.prototype.addPaths=function(t,e){var s,r=t.length;for(s=0;se.e){s.c=!1;break}else e.s<=l&&e.e>=l+m.addedLength?(this.addSegment(c[i].v[n-1],c[i].o[n-1],c[i].i[n],c[i].v[n],s,y,V),V=!1):(C=bez.getNewSegment(c[i].v[n-1],c[i].v[n],c[i].o[n-1],c[i].i[n],(e.s-l)/m.addedLength,(e.e-l)/m.addedLength,u[n-1]),this.addSegmentFromArray(C,s,y,V),V=!1,s.c=!1),l+=m.addedLength,y+=1;if(c[i].c&&u.length){if(m=u[n-1],l<=e.e){var f=u[n-1].addedLength;e.s<=l&&e.e>=l+f?(this.addSegment(c[i].v[n-1],c[i].o[n-1],c[i].i[0],c[i].v[0],s,y,V),V=!1):(C=bez.getNewSegment(c[i].v[n-1],c[i].v[0],c[i].o[n-1],c[i].i[0],(e.s-l)/f,(e.e-l)/f,u[n-1]),this.addSegmentFromArray(C,s,y,V),V=!1,s.c=!1)}else s.c=!1;l+=m.addedLength,y+=1}if(s._length&&(s.setXYAt(s.v[g][0],s.v[g][1],"i",g),s.setXYAt(s.v[s._length-1][0],s.v[s._length-1][1],"o",s._length-1)),l>e.e)break;i=this.p.keyframes[this.p.keyframes.length-1].t?(m=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/l,0),y=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/l,0)):(m=this.p.pv,y=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/l,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){m=[],y=[];var u=this.px,C=this.py;u._caching.lastFrame+u.offsetTime<=u.keyframes[0].t?(m[0]=u.getValueAtTime((u.keyframes[0].t+.01)/l,0),m[1]=C.getValueAtTime((C.keyframes[0].t+.01)/l,0),y[0]=u.getValueAtTime(u.keyframes[0].t/l,0),y[1]=C.getValueAtTime(C.keyframes[0].t/l,0)):u._caching.lastFrame+u.offsetTime>=u.keyframes[u.keyframes.length-1].t?(m[0]=u.getValueAtTime(u.keyframes[u.keyframes.length-1].t/l,0),m[1]=C.getValueAtTime(C.keyframes[C.keyframes.length-1].t/l,0),y[0]=u.getValueAtTime((u.keyframes[u.keyframes.length-1].t-.01)/l,0),y[1]=C.getValueAtTime((C.keyframes[C.keyframes.length-1].t-.01)/l,0)):(m=[u.pv,C.pv],y[0]=u.getValueAtTime((u._caching.lastFrame+u.offsetTime-.01)/l,u.offsetTime),y[1]=C.getValueAtTime((C._caching.lastFrame+C.offsetTime-.01)/l,C.offsetTime))}else y=t,m=y;this.v.rotate(-Math.atan2(m[1]-y[1],m[0]-y[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function r(){if(!this.a.k)this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1;else return;if(!this.s.effectsSequence.length)this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2;else return;if(this.sk)if(!this.sk.effectsSequence.length&&!this.sa.effectsSequence.length)this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3;else return;this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):!this.rz.effectsSequence.length&&!this.ry.effectsSequence.length&&!this.rx.effectsSequence.length&&!this.or.effectsSequence.length&&(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}function c(){}function i(o){this._addDynamicProperty(o),this.elem.addDynamicProperty(o),this._isDirty=!0}function a(o,l,m){if(this.elem=o,this.frameId=-1,this.propType="transform",this.data=l,this.v=new Matrix,this.pre=new Matrix,this.appliedTransformations=0,this.initDynamicPropertyContainer(m||o),l.p&&l.p.s?(this.px=PropertyFactory.getProp(o,l.p.x,0,0,this),this.py=PropertyFactory.getProp(o,l.p.y,0,0,this),l.p.z&&(this.pz=PropertyFactory.getProp(o,l.p.z,0,0,this))):this.p=PropertyFactory.getProp(o,l.p||{k:[0,0,0]},1,0,this),l.rx){if(this.rx=PropertyFactory.getProp(o,l.rx,0,degToRads,this),this.ry=PropertyFactory.getProp(o,l.ry,0,degToRads,this),this.rz=PropertyFactory.getProp(o,l.rz,0,degToRads,this),l.or.k[0].ti){var y,u=l.or.k.length;for(y=0;y0;)s-=1,this._elements.unshift(e[s]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(t){var e,s=t.length;for(e=0;e0?Math.floor(u):Math.ceil(u),g=this.pMatrix.props,V=this.rMatrix.props,f=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var d=0;if(u>0){for(;dv;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),d-=1;C&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-C,!0),d-=C)}r=this.data.m===1?0:this._currentCopies-1,c=this.data.m===1?1:-1,i=this._currentCopies;for(var p,h;i;){if(e=this.elemsData[r].it,s=e[e.length-1].transform.mProps.v.props,h=s.length,e[e.length-1].transform.mProps._mdf=!0,e[e.length-1].transform.op._mdf=!0,e[e.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(r/(this._currentCopies-1)),d!==0){for((r!==0&&c===1||r!==this._currentCopies-1&&c===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(V[0],V[1],V[2],V[3],V[4],V[5],V[6],V[7],V[8],V[9],V[10],V[11],V[12],V[13],V[14],V[15]),this.matrix.transform(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]),this.matrix.transform(g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]),p=0;p0&&(N=!1),N){var I=createTag("style");I.setAttribute("f-forigin",z[_].fOrigin),I.setAttribute("f-origin",z[_].origin),I.setAttribute("f-family",z[_].fFamily),I.type="text/css",I.innerText="@font-face {font-family: "+z[_].fFamily+"; font-style: normal; src: url('"+z[_].fPath+"');}",H.appendChild(I)}}else if(z[_].fOrigin==="g"||z[_].origin===1){for(A=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),P=0;Pe?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var e,s=this.renderableComponents.length;for(e=0;e.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},AudioElement.prototype.show=function(){},AudioElement.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},AudioElement.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},AudioElement.prototype.resume=function(){this._canPlay=!0},AudioElement.prototype.setRate=function(t){this.audio.rate(t)},AudioElement.prototype.volume=function(t){this._volumeMultiplier=t,this._previousVolume=t*this._volume,this.audio.volume(this._previousVolume)},AudioElement.prototype.getBaseElement=function(){return null},AudioElement.prototype.destroy=function(){},AudioElement.prototype.sourceRectAtTime=function(){},AudioElement.prototype.initExpressions=function(){};function BaseRenderer(){}BaseRenderer.prototype.checkLayers=function(t){var e,s=this.layers.length,r;for(this.completeLayers=!0,e=s-1;e>=0;e-=1)this.elements[e]||(r=this.layers[e],r.ip-r.st<=t-this.layers[e].st&&r.op-r.st>t-this.layers[e].st&&this.buildItem(e)),this.completeLayers=this.elements[e]?this.completeLayers:!1;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(t){switch(t.ty){case 2:return this.createImage(t);case 0:return this.createComp(t);case 1:return this.createSolid(t);case 3:return this.createNull(t);case 4:return this.createShape(t);case 5:return this.createText(t);case 6:return this.createAudio(t);case 13:return this.createCamera(t);case 15:return this.createFootage(t);default:return this.createNull(t)}},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.createAudio=function(t){return new AudioElement(t,this.globalData,this)},BaseRenderer.prototype.createFootage=function(t){return new FootageElement(t,this.globalData,this)},BaseRenderer.prototype.buildAllItems=function(){var t,e=this.layers.length;for(t=0;t0&&(this.maskElement.setAttribute("id",u),this.element.maskedElement.setAttribute(d,"url("+getLocationHref()+"#"+u+")"),r.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}MaskElement.prototype.getMaskProperty=function(t){return this.viewData[t].prop},MaskElement.prototype.renderFrame=function(t){var e=this.element.finalTransform.mat,s,r=this.masksProperties.length;for(s=0;s1&&(r+=" C"+e.o[c-1][0]+","+e.o[c-1][1]+" "+e.i[0][0]+","+e.i[0][1]+" "+e.v[0][0]+","+e.v[0][1]),s.lastPath!==r){var a="";s.elem&&(e.c&&(a=t.inv?this.solidPath+r:r),s.elem.setAttribute("d",a)),s.lastPath=r}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var filtersFactory=(function(){var t={};t.createFilter=e,t.createAlphaToLuminanceFilter=s;function e(r,c){var i=createNS("filter");return i.setAttribute("id",r),c!==!0&&(i.setAttribute("filterUnits","objectBoundingBox"),i.setAttribute("x","0%"),i.setAttribute("y","0%"),i.setAttribute("width","100%"),i.setAttribute("height","100%")),i}function s(){var r=createNS("feColorMatrix");return r.setAttribute("type","matrix"),r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),r}return t})(),featureSupport=(function(){var t={maskType:!0};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(t.maskType=!1),t})(),registeredEffects={},idPrefix="filter_result_";function SVGEffects(t){var e,s="SourceGraphic",r=t.data.ef?t.data.ef.length:0,c=createElementID(),i=filtersFactory.createFilter(c,!0),a=0;this.filters=[];var n;for(e=0;e=0&&(r=this.shapeModifiers[e].processShapes(this._isFirstFrame),!r);e-=1);}},searchProcessedElement:function(e){for(var s=this.processedElements,r=0,c=s.length;r.01)return!1;s+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var t=0,e=this.data.k.k.length;t0;)f=u.transformers[N].mProps._mdf||f,w-=1,N-=1;if(f)for(w=H-u.styles[p].lvl,N=u.transformers.length-1;w>0;)L=u.transformers[N].mProps.v.props,_.transform(L[0],L[1],L[2],L[3],L[4],L[5],L[6],L[7],L[8],L[9],L[10],L[11],L[12],L[13],L[14],L[15]),w-=1,N-=1}else _=t;if(z=u.sh.paths,g=z._length,f){for(V="",v=0;v=1?I=.99:I<=-1&&(I=-.99);var D=A*I,T=Math.cos(P+u.a.v)*D+V[0],b=Math.sin(P+u.a.v)*D+V[1];v.setAttribute("fx",T),v.setAttribute("fy",b),g&&!u.g._collapsable&&(u.of.setAttribute("fx",T),u.of.setAttribute("fy",b))}}}function m(y,u,C){var v=u.style,g=u.d;g&&(g._mdf||C)&&g.dashStr&&(v.pElem.setAttribute("stroke-dasharray",g.dashStr),v.pElem.setAttribute("stroke-dashoffset",g.dashoffset[0])),u.c&&(u.c._mdf||C)&&v.pElem.setAttribute("stroke","rgb("+bmFloor(u.c.v[0])+","+bmFloor(u.c.v[1])+","+bmFloor(u.c.v[2])+")"),(u.o._mdf||C)&&v.pElem.setAttribute("stroke-opacity",u.o.v),(u.w._mdf||C)&&(v.pElem.setAttribute("stroke-width",u.w.v),v.msElem&&v.msElem.setAttribute("stroke-width",u.w.v))}return s})();function SVGShapeElement(t,e,s){this.shapes=[],this.shapesData=t.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(t,e,s),this.prevViewData=[]}extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement],SVGShapeElement),SVGShapeElement.prototype.initSecondaryElement=function(){},SVGShapeElement.prototype.identityMatrix=new Matrix,SVGShapeElement.prototype.buildExpressionInterface=function(){},SVGShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},SVGShapeElement.prototype.filterUniqueShapes=function(){var t,e=this.shapes.length,s,r,c=this.stylesList.length,i,a=[],n=!1;for(r=0;r1&&n&&this.setShapesAsAnimated(a)}},SVGShapeElement.prototype.setShapesAsAnimated=function(t){var e,s=t.length;for(e=0;e=0;o-=1){if(V=this.searchProcessedElement(t[o]),V?e[o]=s[V-1]:t[o]._render=a,t[o].ty==="fl"||t[o].ty==="st"||t[o].ty==="gf"||t[o].ty==="gs"||t[o].ty==="no")V?e[o].style.closed=!1:e[o]=this.createStyleElement(t[o],c),t[o]._render&&e[o].style.pElem.parentNode!==r&&r.appendChild(e[o].style.pElem),u.push(e[o].style);else if(t[o].ty==="gr"){if(!V)e[o]=this.createGroupElement(t[o]);else for(y=e[o].it.length,m=0;m1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(t){this.effectsSequence.push(t),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(t){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!t)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var e=this.currentData,s=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var r,c=this.effectsSequence.length,i=t||this.data.d.k[this.keysIndex].s;for(r=0;re);)s+=1;return this.keysIndex!==s&&(this.keysIndex=s),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(t){for(var e=[],s=0,r=t.length,c,i,a=!1;s=55296&&c<=56319?(i=t.charCodeAt(s+1),i>=56320&&i<=57343?(a||FontManager.isModifier(c,i)?(e[e.length-1]+=t.substr(s,2),a=!1):e.push(t.substr(s,2)),s+=1):e.push(t.charAt(s))):c>56319?(i=t.charCodeAt(s+1),FontManager.isZeroWidthJoiner(c,i)?(a=!0,e[e.length-1]+=t.substr(s,2),s+=1):e.push(t.charAt(s))):FontManager.isZeroWidthJoiner(c)?(e[e.length-1]+=t.charAt(s),a=!0):e.push(t.charAt(s)),s+=1;return e},TextProperty.prototype.completeTextData=function(t){t.__complete=!0;var e=this.elem.globalData.fontManager,s=this.data,r=[],c,i,a,n=0,o,l=s.m.g,m=0,y=0,u=0,C=[],v=0,g=0,V,f,d=e.getFontByName(t.f),p,h=0,H=getFontProperties(d);t.fWeight=H.weight,t.fStyle=H.style,t.finalSize=t.s,t.finalText=this.buildFinalText(t.t),i=t.finalText.length,t.finalLineHeight=t.lh;var z=t.tr/1e3*t.finalSize,_;if(t.sz)for(var L=!0,w=t.sz[0],N=t.sz[1],A,P;L;){P=this.buildFinalText(t.t),A=0,v=0,i=P.length,z=t.tr/1e3*t.finalSize;var I=-1;for(c=0;cw&&P[c]!==" "?(I===-1?i+=1:c=I,A+=t.finalLineHeight||t.finalSize*1.2,P.splice(c,I===c?1:0,"\r"),I=-1,v=0):(v+=h,v+=z);A+=d.ascent*t.finalSize/100,this.canResize&&t.finalSize>this.minimumFontSize&&Ng?v:g,v=-2*z,o="",a=!0,u+=1):o=T,e.chars?(p=e.getCharData(T,d.fStyle,e.getFontByName(t.f).fFamily),h=a?0:p.w*t.finalSize/100):h=e.measureText(o,t.f,t.finalSize),T===" "?D+=h+z:(v+=h+z+D,D=0),r.push({l:h,an:h,add:m,n:a,anIndexes:[],val:o,line:u,animatorJustifyOffset:0}),l==2){if(m+=h,o===""||o===" "||c===i-1){for((o===""||o===" ")&&(m-=h);y<=c;)r[y].an=m,r[y].ind=n,r[y].extra=h,y+=1;n+=1,m=0}}else if(l==3){if(m+=h,o===""||c===i-1){for(o===""&&(m-=h);y<=c;)r[y].an=m,r[y].ind=n,r[y].extra=h,y+=1;m=0,n+=1}}else r[n].ind=n,r[n].extra=0,n+=1;if(t.l=r,g=v>g?v:g,C.push(v),t.sz)t.boxWidth=t.sz[0],t.justifyOffset=0;else switch(t.boxWidth=g,t.j){case 1:t.justifyOffset=-t.boxWidth;break;case 2:t.justifyOffset=-t.boxWidth/2;break;default:t.justifyOffset=0}t.lineWidths=C;var b=s.a,S,M;f=b.length;var x,k,E=[];for(V=0;V0?n=this.ne.v/100:o=-this.ne.v/100,this.xe.v>0?l=1-this.xe.v/100:m=1+this.xe.v/100;var y=BezierFactory.getBezierEasing(n,o,l,m).get,u=0,C=this.finalS,v=this.finalE,g=this.data.sh;if(g===2)v===C?u=a>=v?1:0:u=t(0,e(.5/(v-C)+(a-C)/(v-C),1)),u=y(u);else if(g===3)v===C?u=a>=v?0:1:u=1-t(0,e(.5/(v-C)+(a-C)/(v-C),1)),u=y(u);else if(g===4)v===C?u=0:(u=t(0,e(.5/(v-C)+(a-C)/(v-C),1)),u<.5?u*=2:u=1-2*(u-.5)),u=y(u);else if(g===5){if(v===C)u=0;else{var V=v-C;a=e(t(0,a+.5-C),v-C);var f=-V/2+a,d=V/2;u=Math.sqrt(1-f*f/(d*d))}u=y(u)}else g===6?(v===C?u=0:(a=e(t(0,a+.5-C),v-C),u=(1+Math.cos(Math.PI+Math.PI*2*a/(v-C)))/2),u=y(u)):(a>=s(C)&&(a-C<0?u=t(0,e(e(v,1)-(C-a),1)):u=t(0,e(v-a,1))),u=y(u));if(this.sm.v!==100){var p=this.sm.v*.01;p===0&&(p=1e-8);var h=.5-p*.5;u1&&(u=1))}return u*this.a.v},getValue:function(a){this.iterateDynamicProperties(),this._mdf=a||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,a&&this.data.r===2&&(this.e.v=this._currentTextLength);var n=this.data.r===2?1:100/this.data.totalChars,o=this.o.v/n,l=this.s.v/n+o,m=this.e.v/n+o;if(l>m){var y=l;l=m,m=y}this.finalS=l,this.finalE=m}},extendPrototype([DynamicPropertyContainer],r);function c(i,a,n){return new r(i,a,n)}return{getTextSelectorProp:c}})();function TextAnimatorDataProperty(t,e,s){var r={propType:!1},c=PropertyFactory.getProp,i=e.a;this.a={r:i.r?c(t,i.r,0,degToRads,s):r,rx:i.rx?c(t,i.rx,0,degToRads,s):r,ry:i.ry?c(t,i.ry,0,degToRads,s):r,sk:i.sk?c(t,i.sk,0,degToRads,s):r,sa:i.sa?c(t,i.sa,0,degToRads,s):r,s:i.s?c(t,i.s,1,.01,s):r,a:i.a?c(t,i.a,1,0,s):r,o:i.o?c(t,i.o,0,.01,s):r,p:i.p?c(t,i.p,1,0,s):r,sw:i.sw?c(t,i.sw,0,0,s):r,sc:i.sc?c(t,i.sc,1,0,s):r,fc:i.fc?c(t,i.fc,1,0,s):r,fh:i.fh?c(t,i.fh,0,0,s):r,fs:i.fs?c(t,i.fs,0,.01,s):r,fb:i.fb?c(t,i.fb,0,.01,s):r,t:i.t?c(t,i.t,0,0,s):r},this.s=TextSelectorProp.getTextSelectorProp(t,e.s,s),this.s.t=e.s.t}function TextAnimatorProperty(t,e,s){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=t,this._renderType=e,this._elem=s,this._animatorsData=createSizedArray(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(s)}TextAnimatorProperty.prototype.searchProperties=function(){var t,e=this._textData.a.length,s,r=PropertyFactory.getProp;for(t=0;t=v+V2||!H?(w=(v+V2-V)/g.partialLength,B=h.point[0]+(g.point[0]-h.point[0])*w,Z=h.point[1]+(g.point[1]-h.point[1])*w,i.translate(-s[0]*u[m].an*.005,-(s[1]*D)*.01),f=!1):H&&(V+=g.partialLength,d+=1,d>=H.length&&(d=0,p+=1,z[p]?H=z[p].points:A.v.c?(d=0,p=0,H=z[p].points):(V-=g.partialLength,H=null)),H&&(h=g,g=H[d],_=g.partialLength));G=u[m].an/2-u[m].add,i.translate(-G,0,0)}else G=u[m].an/2-u[m].add,i.translate(-G,0,0),i.translate(-s[0]*u[m].an*.005,-s[1]*D*.01,0);for(M=0;Mt?this.textSpans[t].span:createNS(n?"g":"text"),p<=t){if(o.setAttribute("stroke-linecap","butt"),o.setAttribute("stroke-linejoin","round"),o.setAttribute("stroke-miterlimit","4"),this.textSpans[t].span=o,n){var H=createNS("g");o.appendChild(H),this.textSpans[t].childSpan=H}this.textSpans[t].span=o,this.layerElement.appendChild(o)}o.style.display="inherit"}if(l.reset(),y&&(a[t].n&&(u=-g,C+=s.yOffset,C+=v?1:0,v=!1),this.applyTextPropertiesToMatrix(s,l,a[t].line,u,C),u+=a[t].l||0,u+=g),n){h=this.globalData.fontManager.getCharData(s.finalText[t],r.fStyle,this.globalData.fontManager.getFontByName(s.f).fFamily);var z;if(h.t===1)z=new SVGCompElement(h.data,this.globalData,this);else{var _=emptyShapeData;h.data&&h.data.shapes&&(_=this.buildShapeData(h.data,s.finalSize)),z=new SVGShapeElement(_,this.globalData,this)}if(this.textSpans[t].glyph){var L=this.textSpans[t].glyph;this.textSpans[t].childSpan.removeChild(L.layerElement),L.destroy()}this.textSpans[t].glyph=z,z._debug=!0,z.prepareFrame(0),z.renderFrame(),this.textSpans[t].childSpan.appendChild(z.layerElement),h.t===1&&this.textSpans[t].childSpan.setAttribute("transform","scale("+s.finalSize/100+","+s.finalSize/100+")")}else y&&o.setAttribute("transform","translate("+l.props[12]+","+l.props[13]+")"),o.textContent=a[t].val,o.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}y&&o&&o.setAttribute("d",m)}for(;t=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].prepareFrame(t-this.layers[e].st);if(this.globalData._mdf)for(e=0;e=0;s-=1)(this.completeLayers||this.elements[s])&&(this.elements[s].prepareFrame(this.renderedFrame-this.layers[s].st),this.elements[s]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var t,e=this.layers.length;for(t=0;t=0;r-=1)a=e.transforms[r].transform.mProps.v.props,e.finalTransform.transform(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}e._mdf=i},processSequences:function(e){var s,r=this.sequenceList.length;for(s=0;s=0;i-=1){if(y=this.searchProcessedElement(t[i]),y?e[i]=s[y-1]:t[i]._shouldRender=r,t[i].ty==="fl"||t[i].ty==="st"||t[i].ty==="gf"||t[i].ty==="gs")y?e[i].style.closed=!1:e[i]=this.createStyleElement(t[i],v),l.push(e[i].style);else if(t[i].ty==="gr"){if(!y)e[i]=this.createGroupElement(t[i]);else for(o=e[i].it.length,n=0;n=0;c-=1)e[c].ty==="tr"?(a=s[c].transform,this.renderShapeTransform(t,a)):e[c].ty==="sh"||e[c].ty==="el"||e[c].ty==="rc"||e[c].ty==="sr"?this.renderPath(e[c],s[c]):e[c].ty==="fl"?this.renderFill(e[c],s[c],a):e[c].ty==="st"?this.renderStroke(e[c],s[c],a):e[c].ty==="gf"||e[c].ty==="gs"?this.renderGradientFill(e[c],s[c],a):e[c].ty==="gr"?this.renderShape(a,e[c].it,s[c].it):e[c].ty;r&&this.drawLayer()},CVShapeElement.prototype.renderStyledShape=function(t,e){if(this._isFirstFrame||e._mdf||t.transforms._mdf){var s=t.trNodes,r=e.paths,c,i,a,n=r._length;s.length=0;var o=t.transforms.finalTransform;for(a=0;a=1?m=.99:m<=-1&&(m=-.99);var y=o*m,u=Math.cos(l+e.a.v)*y+a[0],C=Math.sin(l+e.a.v)*y+a[1];c=i.createRadialGradient(u,C,0,a[0],a[1],o)}var v,g=t.g.p,V=e.g.c,f=1;for(v=0;vi&&o==="xMidYMid slice"||cs&&i==="meet"||rs&&i==="slice")?this.transformCanvas.tx=(t-this.transformCanvas.w*(e/this.transformCanvas.h))/2*this.renderConfig.dpr:n==="xMax"&&(rs&&i==="slice")?this.transformCanvas.tx=(t-this.transformCanvas.w*(e/this.transformCanvas.h))*this.renderConfig.dpr:this.transformCanvas.tx=0,o==="YMid"&&(r>s&&i==="meet"||rs&&i==="meet"||r=0;t-=1)this.elements[t]&&this.elements[t].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(t,e){if(!(this.renderedFrame===t&&this.renderConfig.clearCanvas===!0&&!e||this.destroyed||t===-1)){this.renderedFrame=t,this.globalData.frameNum=t-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=t;var s,r=this.layers.length;for(this.completeLayers||this.checkLayers(t),s=0;s=0;s-=1)(this.completeLayers||this.elements[s])&&this.elements[s].renderFrame();this.renderConfig.clearCanvas!==!0&&this.restore()}}},CanvasRendererBase.prototype.buildItem=function(t){var e=this.elements;if(!(e[t]||this.layers[t].ty===99)){var s=this.createItem(this.layers[t],this,this.globalData);e[t]=s,s.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var t=this.pendingElements.pop();t.checkParenting()}},CanvasRendererBase.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRendererBase.prototype.show=function(){this.animationItem.container.style.display="block"};function CVCompElement(t,e,s){this.completeLayers=!1,this.layers=t.layers,this.pendingElements=[],this.elements=createSizedArray(this.layers.length),this.initElement(t,e,s),this.tm=t.tm?PropertyFactory.getProp(this,t.tm,0,e.frameRate,this):{_placeholder:!0}}extendPrototype([CanvasRendererBase,ICompElement,CVBaseElement],CVCompElement),CVCompElement.prototype.renderInnerContent=function(){var t=this.canvasContext;t.beginPath(),t.moveTo(0,0),t.lineTo(this.data.w,0),t.lineTo(this.data.w,this.data.h),t.lineTo(0,this.data.h),t.lineTo(0,0),t.clip();var e,s=this.layers.length;for(e=s-1;e>=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].renderFrame()},CVCompElement.prototype.destroy=function(){var t,e=this.layers.length;for(t=e-1;t>=0;t-=1)this.elements[t]&&this.elements[t].destroy();this.layers=null,this.elements=null},CVCompElement.prototype.createComp=function(t){return new CVCompElement(t,this.globalData,this)};function CanvasRenderer(t,e){this.animationItem=t,this.renderConfig={clearCanvas:e&&e.clearCanvas!==void 0?e.clearCanvas:!0,context:e&&e.context||null,progressiveLoad:e&&e.progressiveLoad||!1,preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:e&&e.contentVisibility||"visible",className:e&&e.className||"",id:e&&e.id||""},this.renderConfig.dpr=e&&e.dpr||1,this.animationItem.wrapper&&(this.renderConfig.dpr=e&&e.dpr||window.devicePixelRatio||1),this.renderedFrame=-1,this.globalData={frameNum:-1,_mdf:!1,renderConfig:this.renderConfig,currentGlobalAlpha:-1},this.contextData=new CVContextData,this.elements=[],this.pendingElements=[],this.transformMat=new Matrix,this.completeLayers=!1,this.rendererType="canvas"}extendPrototype([CanvasRendererBase],CanvasRenderer),CanvasRenderer.prototype.createComp=function(t){return new CVCompElement(t,this.globalData,this)};function HBaseElement(){}HBaseElement.prototype={checkBlendMode:function(){},initRendererElement:function(){this.baseElement=createTag(this.data.tg||"div"),this.data.hasMask?(this.svgElement=createNS("svg"),this.layerElement=createNS("g"),this.maskedElement=this.layerElement,this.svgElement.appendChild(this.layerElement),this.baseElement.appendChild(this.svgElement)):this.layerElement=this.baseElement,styleDiv(this.baseElement)},createContainerElements:function(){this.renderableEffectsManager=new CVEffects(this),this.transformedElement=this.baseElement,this.maskedElement=this.layerElement,this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.bm!==0&&this.setBlendMode()},renderElement:function(){var e=this.transformedElement?this.transformedElement.style:{};if(this.finalTransform._matMdf){var s=this.finalTransform.mat.toCSS();e.transform=s,e.webkitTransform=s}this.finalTransform._opMdf&&(e.opacity=this.finalTransform.mProp.o.v)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},destroy:function(){this.layerElement=null,this.transformedElement=null,this.matteElement&&(this.matteElement=null),this.maskManager&&(this.maskManager.destroy(),this.maskManager=null)},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData)},addEffects:function(){},setMatte:function(){}},HBaseElement.prototype.getBaseElement=SVGBaseElement.prototype.getBaseElement,HBaseElement.prototype.destroyBaseElement=HBaseElement.prototype.destroy,HBaseElement.prototype.buildElementParenting=BaseRenderer.prototype.buildElementParenting;function HSolidElement(t,e,s){this.initElement(t,e,s)}extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],HSolidElement),HSolidElement.prototype.createContent=function(){var t;this.data.hasMask?(t=createNS("rect"),t.setAttribute("width",this.data.sw),t.setAttribute("height",this.data.sh),t.setAttribute("fill",this.data.sc),this.svgElement.setAttribute("width",this.data.sw),this.svgElement.setAttribute("height",this.data.sh)):(t=createTag("div"),t.style.width=this.data.sw+"px",t.style.height=this.data.sh+"px",t.style.backgroundColor=this.data.sc),this.layerElement.appendChild(t)};function HShapeElement(t,e,s){this.shapes=[],this.shapesData=t.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.shapesContainer=createNS("g"),this.initElement(t,e,s),this.prevViewData=[],this.currentBBox={x:999999,y:-999999,h:0,w:0}}extendPrototype([BaseElement,TransformElement,HSolidElement,SVGShapeElement,HBaseElement,HierarchyElement,FrameElement,RenderableElement],HShapeElement),HShapeElement.prototype._renderShapeFrame=HShapeElement.prototype.renderInnerContent,HShapeElement.prototype.createContent=function(){var t;if(this.baseElement.style.fontSize=0,this.data.hasMask)this.layerElement.appendChild(this.shapesContainer),t=this.svgElement;else{t=createNS("svg");var e=this.comp.data?this.comp.data:this.globalData.compSize;t.setAttribute("width",e.w),t.setAttribute("height",e.h),t.appendChild(this.shapesContainer),this.layerElement.appendChild(t)}this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.shapesContainer,0,[],!0),this.filterUniqueShapes(),this.shapeCont=t},HShapeElement.prototype.getTransformedPoint=function(t,e){var s,r=t.length;for(s=0;s0&&o<1&&c[u].push(this.calculateF(o,t,e,s,r,u))):(l=a*a-4*n*i,l>=0&&(m=(-a+bmSqrt(l))/(2*i),m>0&&m<1&&c[u].push(this.calculateF(m,t,e,s,r,u)),y=(-a-bmSqrt(l))/(2*i),y>0&&y<1&&c[u].push(this.calculateF(y,t,e,s,r,u)))));this.shapeBoundingBox.left=bmMin.apply(null,c[0]),this.shapeBoundingBox.top=bmMin.apply(null,c[1]),this.shapeBoundingBox.right=bmMax.apply(null,c[0]),this.shapeBoundingBox.bottom=bmMax.apply(null,c[1])},HShapeElement.prototype.calculateF=function(t,e,s,r,c,i){return bmPow(1-t,3)*e[i]+3*bmPow(1-t,2)*t*s[i]+3*(1-t)*bmPow(t,2)*r[i]+bmPow(t,3)*c[i]},HShapeElement.prototype.calculateBoundingBox=function(t,e){var s,r=t.length;for(s=0;ss&&(s=c)}s*=t.mult}else s=t.v*t.mult;e.x-=s,e.xMax+=s,e.y-=s,e.yMax+=s},HShapeElement.prototype.currentBoxContains=function(t){return this.currentBBox.x<=t.x&&this.currentBBox.y<=t.y&&this.currentBBox.width+this.currentBBox.x>=t.x+t.width&&this.currentBBox.height+this.currentBBox.y>=t.y+t.height},HShapeElement.prototype.renderInnerContent=function(){if(this._renderShapeFrame(),!this.hidden&&(this._isFirstFrame||this._mdf)){var t=this.tempBoundingBox,e=999999;if(t.x=e,t.xMax=-e,t.y=e,t.yMax=-e,this.calculateBoundingBox(this.itemsData,t),t.width=t.xMax=0;e-=1){var r=this.hierarchy[e].finalTransform.mProp;this.mat.translate(-r.p.v[0],-r.p.v[1],r.p.v[2]),this.mat.rotateX(-r.or.v[0]).rotateY(-r.or.v[1]).rotateZ(r.or.v[2]),this.mat.rotateX(-r.rx.v).rotateY(-r.ry.v).rotateZ(r.rz.v),this.mat.scale(1/r.s.v[0],1/r.s.v[1],1/r.s.v[2]),this.mat.translate(r.a.v[0],r.a.v[1],r.a.v[2])}if(this.p?this.mat.translate(-this.p.v[0],-this.p.v[1],this.p.v[2]):this.mat.translate(-this.px.v,-this.py.v,this.pz.v),this.a){var c;this.p?c=[this.p.v[0]-this.a.v[0],this.p.v[1]-this.a.v[1],this.p.v[2]-this.a.v[2]]:c=[this.px.v-this.a.v[0],this.py.v-this.a.v[1],this.pz.v-this.a.v[2]];var i=Math.sqrt(Math.pow(c[0],2)+Math.pow(c[1],2)+Math.pow(c[2],2)),a=[c[0]/i,c[1]/i,c[2]/i],n=Math.sqrt(a[2]*a[2]+a[0]*a[0]),o=Math.atan2(a[1],n),l=Math.atan2(a[0],-a[2]);this.mat.rotateY(l).rotateX(-o)}this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v),this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]),this.mat.translate(this.globalData.compSize.w/2,this.globalData.compSize.h/2,0),this.mat.translate(0,0,this.pe.v);var m=!this._prevMat.equals(this.mat);if((m||this.pe._mdf)&&this.comp.threeDElements){s=this.comp.threeDElements.length;var y,u,C;for(e=0;e=t)return this.threeDElements[e].perspectiveElem;e+=1}return null},HybridRendererBase.prototype.createThreeDContainer=function(t,e){var s=createTag("div"),r,c;styleDiv(s);var i=createTag("div");if(styleDiv(i),e==="3d"){r=s.style,r.width=this.globalData.compSize.w+"px",r.height=this.globalData.compSize.h+"px";var a="50% 50%";r.webkitTransformOrigin=a,r.mozTransformOrigin=a,r.transformOrigin=a,c=i.style;var n="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";c.transform=n,c.webkitTransform=n}s.appendChild(i);var o={container:i,perspectiveElem:s,startPos:t,endPos:t,type:e};return this.threeDElements.push(o),o},HybridRendererBase.prototype.build3dContainers=function(){var t,e=this.layers.length,s,r="";for(t=0;t=0;t-=1)this.resizerElem.appendChild(this.threeDElements[t].perspectiveElem)},HybridRendererBase.prototype.addTo3dContainer=function(t,e){for(var s=0,r=this.threeDElements.length;ss?(c=t/this.globalData.compSize.w,i=t/this.globalData.compSize.w,a=0,n=(e-this.globalData.compSize.h*(t/this.globalData.compSize.w))/2):(c=e/this.globalData.compSize.h,i=e/this.globalData.compSize.h,a=(t-this.globalData.compSize.w*(e/this.globalData.compSize.h))/2,n=0);var o=this.resizerElem.style;o.webkitTransform="matrix3d("+c+",0,0,0,0,"+i+",0,0,0,0,1,0,"+a+","+n+",0,1)",o.transform=o.webkitTransform},HybridRendererBase.prototype.renderFrame=SVGRenderer.prototype.renderFrame,HybridRendererBase.prototype.hide=function(){this.resizerElem.style.display="none"},HybridRendererBase.prototype.show=function(){this.resizerElem.style.display="block"},HybridRendererBase.prototype.initItems=function(){if(this.buildAllItems(),this.camera)this.camera.setup();else{var t=this.globalData.compSize.w,e=this.globalData.compSize.h,s,r=this.threeDElements.length;for(s=0;s=l;)A/=2,P/=2,I>>>=1;return(A+I)/P};return w.int32=function(){return L.g(4)|0},w.quick=function(){return L.g(4)/4294967296},w.double=w,V(d(L.S),t),(h.pass||H||function(N,A,P,I){return I&&(I.S&&v(I,L),N.state=function(){return v(L,{})}),P?(e[a]=N,A):N})(w,_,"global"in h?h.global:this==e,h.state)}e["seed"+a]=u;function C(p){var h,H=p.length,z=this,_=0,L=z.i=z.j=0,w=z.S=[];for(H||(p=[H++]);_s){var r=s;s=e,e=r}return Math.min(Math.max(t,e),s)}function radiansToDegrees(t){return t/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(t){return t*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(t,e){if(typeof t=="number"||t instanceof Number)return e=e||0,Math.abs(t-e);e||(e=helperLengthArray);var s,r=Math.min(t.length,e.length),c=0;for(s=0;s.5?l/(2-c-i):l/(c+i),c){case e:a=(s-r)/l+(s1&&(s-=1),s<1/6?t+(e-t)*6*s:s<1/2?e:s<2/3?t+(e-t)*(2/3-s)*6:t}function hslToRgb(t){var e=t[0],s=t[1],r=t[2],c,i,a;if(s===0)c=r,a=r,i=r;else{var n=r<.5?r*(1+s):r+s-r*s,o=2*r-n;c=hue2rgb(o,n,e+1/3),i=hue2rgb(o,n,e),a=hue2rgb(o,n,e-1/3)}return[c,i,a,t[3]]}function linear(t,e,s,r,c){if((r===void 0||c===void 0)&&(r=e,c=s,e=0,s=1),s=s)return c;var a=s===e?0:(t-e)/(s-e);if(!r.length)return r+(c-r)*a;var n,o=r.length,l=createTypedArray("float32",o);for(n=0;n1){for(c=0;c1?e=1:e<0&&(e=0);var a=t(e);if($bm_isInstanceOfArray(c)){var n,o=c.length,l=createTypedArray("float32",o);for(n=0;ndata.k[e].t&&tdata.k[e+1].t-t?(r=e+2,c=data.k[e+1].t):(r=e+1,c=data.k[e].t);break}r===-1&&(r=e+1,c=data.k[e].t)}var i={};return i.index=r,i.time=c/elem.comp.globalData.frameRate,i}function key(t){var e,s,r;if(!data.k.length||typeof data.k[0]=="number")throw new Error("The property has no keyframe at index "+t);t-=1,e={time:data.k[t].t/elem.comp.globalData.frameRate,value:[]};var c=Object.prototype.hasOwnProperty.call(data.k[t],"s")?data.k[t].s:data.k[t-1].e;for(r=c.length,s=0;sV.length-1)&&(C=V.length-1),p=V[V.length-1-C].t,d=f-p);var h,H,z;if(u==="pingpong"){var _=Math.floor((g-p)/d);if(_%2!==0)return this.getValueAtTime((d-(g-p)%d+p)/this.comp.globalData.frameRate,0)}else if(u==="offset"){var L=this.getValueAtTime(p/this.comp.globalData.frameRate,0),w=this.getValueAtTime(f/this.comp.globalData.frameRate,0),N=this.getValueAtTime(((g-p)%d+p)/this.comp.globalData.frameRate,0),A=Math.floor((g-p)/d);if(this.pv.length){for(z=new Array(L.length),H=z.length,h=0;h=f)return this.pv;var d,p;v?(C?d=Math.abs(this.elem.comp.globalData.frameRate*C):d=Math.max(0,this.elem.data.op-f),p=f+d):((!C||C>V.length-1)&&(C=V.length-1),p=V[C].t,d=p-f);var h,H,z;if(u==="pingpong"){var _=Math.floor((f-g)/d);if(_%2===0)return this.getValueAtTime(((f-g)%d+f)/this.comp.globalData.frameRate,0)}else if(u==="offset"){var L=this.getValueAtTime(f/this.comp.globalData.frameRate,0),w=this.getValueAtTime(p/this.comp.globalData.frameRate,0),N=this.getValueAtTime((d-(f-g)%d+f)/this.comp.globalData.frameRate,0),A=Math.floor((f-g)/d)+1;if(this.pv.length){for(z=new Array(L.length),H=z.length,h=0;h1?(V-g)/(C-1):1,d=0,p=0,h;this.pv.length?h=createTypedArray("float32",this.pv.length):h=0;for(var H;dd){var _=p,L=g.c&&p===h-1?0:p+1,w=(d-H)/f[p].addedLength;z=bez.getPointInSegment(g.v[_],g.v[L],g.o[_],g.i[L],w,f[p]);break}else H+=f[p].addedLength;p+=1}return z||(z=g.c?[g.v[0][0],g.v[0][1]]:[g.v[g._length-1][0],g.v[g._length-1][1]]),z},vectorOnPath:function(C,v,g){C==1?C=this.v.c:C==0&&(C=.999);var V=this.pointOnPath(C,v),f=this.pointOnPath(C+.001,v),d=f[0]-V[0],p=f[1]-V[1],h=Math.sqrt(Math.pow(d,2)+Math.pow(p,2));if(h===0)return[0,0];var H=g==="tangent"?[d/h,p/h]:[-p/h,d/h];return H},tangentOnPath:function(C,v){return this.vectorOnPath(C,v,"tangent")},normalOnPath:function(C,v){return this.vectorOnPath(C,v,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([m],o),extendPrototype([m],l),l.prototype.getValueAtTime=n,l.prototype.initiateExpression=ExpressionManager.initiateExpression;var y=ShapePropertyFactory.getShapeProp;ShapePropertyFactory.getShapeProp=function(u,C,v,g,V){var f=y(u,C,v,g,V);return f.propertyIndex=C.ix,f.lock=!1,v===3?expressionHelpers.searchExpressions(u,C.pt,f):v===4&&expressionHelpers.searchExpressions(u,C.ks,f),f.k&&u.addDynamicProperty(f),f}}function initialize$1(){addPropertyDecorator()}function addDecorator(){function t(){return this.data.d.x?(this.calculateExpression=ExpressionManager.initiateExpression.bind(this)(this.elem,this.data.d,this),this.addEffect(this.getExpressionValue.bind(this)),!0):null}TextProperty.prototype.getExpressionValue=function(e,s){var r=this.calculateExpression(s);if(e.t!==r){var c={};return this.copyData(c,e),c.t=r.toString(),c.__complete=!1,c}return e},TextProperty.prototype.searchProperty=function(){var e=this.searchKeyframes(),s=this.searchExpressions();return this.kf=e||s,this.kf},TextProperty.prototype.searchExpressions=t}function initialize(){addDecorator()}function SVGComposableEffect(){}SVGComposableEffect.prototype={createMergeNode:function t(e,s){var r=createNS("feMerge");r.setAttribute("result",e);var c,i;for(i=0;i=l?y=v<0?r:c:y=r+C*Math.pow((n-t)/v,1/s),m[u]=y,u+=1,i+=256/(a-1);return m.join(" ")},SVGProLevelsFilter.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){var e,s=this.filterManager.effectElements;this.feFuncRComposed&&(t||s[3].p._mdf||s[4].p._mdf||s[5].p._mdf||s[6].p._mdf||s[7].p._mdf)&&(e=this.getTableValue(s[3].p.v,s[4].p.v,s[5].p.v,s[6].p.v,s[7].p.v),this.feFuncRComposed.setAttribute("tableValues",e),this.feFuncGComposed.setAttribute("tableValues",e),this.feFuncBComposed.setAttribute("tableValues",e)),this.feFuncR&&(t||s[10].p._mdf||s[11].p._mdf||s[12].p._mdf||s[13].p._mdf||s[14].p._mdf)&&(e=this.getTableValue(s[10].p.v,s[11].p.v,s[12].p.v,s[13].p.v,s[14].p.v),this.feFuncR.setAttribute("tableValues",e)),this.feFuncG&&(t||s[17].p._mdf||s[18].p._mdf||s[19].p._mdf||s[20].p._mdf||s[21].p._mdf)&&(e=this.getTableValue(s[17].p.v,s[18].p.v,s[19].p.v,s[20].p.v,s[21].p.v),this.feFuncG.setAttribute("tableValues",e)),this.feFuncB&&(t||s[24].p._mdf||s[25].p._mdf||s[26].p._mdf||s[27].p._mdf||s[28].p._mdf)&&(e=this.getTableValue(s[24].p.v,s[25].p.v,s[26].p.v,s[27].p.v,s[28].p.v),this.feFuncB.setAttribute("tableValues",e)),this.feFuncA&&(t||s[31].p._mdf||s[32].p._mdf||s[33].p._mdf||s[34].p._mdf||s[35].p._mdf)&&(e=this.getTableValue(s[31].p.v,s[32].p.v,s[33].p.v,s[34].p.v,s[35].p.v),this.feFuncA.setAttribute("tableValues",e))}};function SVGDropShadowEffect(t,e,s,r,c){var i=e.container.globalData.renderConfig.filterSize,a=e.data.fs||i;t.setAttribute("x",a.x||i.x),t.setAttribute("y",a.y||i.y),t.setAttribute("width",a.width||i.width),t.setAttribute("height",a.height||i.height),this.filterManager=e;var n=createNS("feGaussianBlur");n.setAttribute("in","SourceAlpha"),n.setAttribute("result",r+"_drop_shadow_1"),n.setAttribute("stdDeviation","0"),this.feGaussianBlur=n,t.appendChild(n);var o=createNS("feOffset");o.setAttribute("dx","25"),o.setAttribute("dy","0"),o.setAttribute("in",r+"_drop_shadow_1"),o.setAttribute("result",r+"_drop_shadow_2"),this.feOffset=o,t.appendChild(o);var l=createNS("feFlood");l.setAttribute("flood-color","#00ff00"),l.setAttribute("flood-opacity","1"),l.setAttribute("result",r+"_drop_shadow_3"),this.feFlood=l,t.appendChild(l);var m=createNS("feComposite");m.setAttribute("in",r+"_drop_shadow_3"),m.setAttribute("in2",r+"_drop_shadow_2"),m.setAttribute("operator","in"),m.setAttribute("result",r+"_drop_shadow_4"),t.appendChild(m);var y=this.createMergeNode(r,[r+"_drop_shadow_4",c]);t.appendChild(y)}extendPrototype([SVGComposableEffect],SVGDropShadowEffect),SVGDropShadowEffect.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){if((t||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),t||this.filterManager.effectElements[0].p._mdf){var e=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",rgbToHex(Math.round(e[0]*255),Math.round(e[1]*255),Math.round(e[2]*255)))}if((t||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),t||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var s=this.filterManager.effectElements[3].p.v,r=(this.filterManager.effectElements[2].p.v-90)*degToRads,c=s*Math.cos(r),i=s*Math.sin(r);this.feOffset.setAttribute("dx",c),this.feOffset.setAttribute("dy",i)}}};var _svgMatteSymbols=[];function SVGMatte3Effect(t,e,s){this.initialized=!1,this.filterManager=e,this.filterElem=t,this.elem=s,s.matteElement=createNS("g"),s.matteElement.appendChild(s.layerElement),s.matteElement.appendChild(s.transformedElement),s.baseElement=s.matteElement}SVGMatte3Effect.prototype.findSymbol=function(t){for(var e=0,s=_svgMatteSymbols.length;e{let e=class e{constructor(){this.destroyRef=z1(Q6),this.router=z1(mt),this._currentSection=Y6(U3),this.currentSection=this._currentSection.asReadonly(),this.router.events.pipe($6(r=>r instanceof ht),gt(this.destroyRef)).subscribe(r=>{let c=r.urlAfterRedirects.replace("/","");this._currentSection.set(c||U3)})}};e.\u0275fac=function(c){return new(c||e)},e.\u0275prov=H1({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var sr=t=>({"section-active":t});function rr(t,e){if(t&1){let s=k4();J2(0,"div",4),P4("click",function(){c1(s);let c=v2(3);return i1(c.onClickMobile())})("keyup.enter",function(){c1(s);let c=v2(3);return i1(c.onClickMobile())}),j1(1,"fa-icon",5),Z2()}if(t&2){let s=v2(3);X2(),W1("icon",s.iconMenu)}}function cr(t,e){if(t&1){let s=k4();J2(0,"li",6)(1,"a",7),P4("click",function(){c1(s);let c=v2(4);return i1(c.hiddenMenuIfNeed())}),st(2),Z2()()}if(t&2){let s=e.$implicit,r=v2(4);W1("ngClass",ct(3,sr,r.currentIdSection()===s)),X2(),W1("routerLink",s),X2(),rt(s)}}function ir(t,e){if(t&1&&(J2(0,"ul",3),et(1,cr,3,5,"li",6,Z6),Z2()),t&2){let s=v2(3);X2(),tt(s.listIdsSections)}}function ar(t,e){if(t&1&&(J2(0,"nav",0),U1(1,rr,2,1,"div",2),U1(2,ir,3,0,"ul",3),Z2()),t&2){let s=v2(2);X2(),q1(s.isMobile?1:-1),X2(),q1(s.isGoneMenu&&s.isMobile?-1:2)}}function nr(t,e){if(t&1){let s=k4();J2(0,"nav",1)(1,"div",8),P4("click",function(){c1(s);let c=v2(2);return i1(c.onClickBack())})("keydown.enter",function(){c1(s);let c=v2(2);return i1(c.onClickBack())})("keydown.space",function(){c1(s);let c=v2(2);return i1(c.onClickBack())}),j1(2,"fa-icon",5),Z2()()}if(t&2){let s=v2(2);X2(2),W1("icon",s.iconBack)}}function or(t,e){if(t&1&&U1(0,ar,3,2,"nav",0)(1,nr,3,1,"nav",1),t&2){let s=v2();q1(s.listIdsSections.includes(s.currentIdSection())?0:1)}}var Jt=(()=>{let e=class e{constructor(){this.resizeService=z1(lt),this.navigator=z1(Xt),this.iconMenu=Qt,this.iconBack=Yt,this.isMobile=!1,this.currentIdSection=this.navigator.currentSection,this.isGoneMenu=!0,this.listIdsSections=Object.values(k2),it(()=>{!this.isMobile&&!this.isGoneMenu&&(this.isGoneMenu=!0),this.isMobile=this.resizeService.isMobileSize()})}onClickMobile(){this.isGoneMenu=!this.isGoneMenu}onClickBack(){window.history.back()}hiddenMenuIfNeed(){this.isGoneMenu||(this.isGoneMenu=!0)}};e.\u0275fac=function(c){return new(c||e)},e.\u0275cmp=T4({type:e,selectors:[["app-navbar"]],decls:1,vars:1,consts:[[1,"home-navbar"],[1,"back-navbar"],["tabindex","0","role","button","aria-label","Open menu",1,"container-icon"],["id","navigation-links",1,"container-links-menu"],["tabindex","0","role","button","aria-label","Open menu",1,"container-icon",3,"click","keyup.enter"],[1,"icon-menu",3,"icon"],[3,"ngClass"],[3,"click","routerLink"],["role","button","tabindex","0",1,"container-icon",3,"click","keydown.enter","keydown.space"]],template:function(c,i){c&1&&U1(0,or,2,1),c&2&&q1(i.currentIdSection()?0:-1)},dependencies:[yt,A4,at,dt],styles:[".navbar[_ngcontent-%COMP%], nav.home-navbar[_ngcontent-%COMP%], nav.back-navbar[_ngcontent-%COMP%]{display:flex;background:#000;height:45px;position:fixed;width:100%;z-index:7}nav.back-navbar[_ngcontent-%COMP%]{justify-content:flex-start}nav.home-navbar[_ngcontent-%COMP%]{justify-content:flex-end}nav.home-navbar[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{display:flex;list-style:none;width:fit-content;flex-direction:row;background:#000}nav.home-navbar[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{display:block!important;background:#0000;color:#fff;padding:0 10px;margin:0 1px;text-decoration:none;height:45px;line-height:45px;text-align:center;transition:visibility .3s linear,opacity .3s linear}nav.home-navbar[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{transition:background-color .5s linear;background:#ff000080;cursor:pointer}nav.home-navbar[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:active{transform:scale(.8);transition:transform .5s linear;background:red}@media screen and (max-width: 600px){nav.home-navbar[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:active{transform:scale(.95);transition:transform .5s linear;background:red}}@media screen and (max-width: 600px){nav.home-navbar[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{flex-direction:column;width:100%;margin:0}}@media screen and (max-width: 600px){nav.home-navbar[_ngcontent-%COMP%]{justify-content:flex-start;flex-direction:column}}.container-icon[_ngcontent-%COMP%]{font-size:20px;text-align:center;display:inline-block;vertical-align:bottom;color:#fff;width:45px;height:45px;line-height:45px;background:#0000}.container-icon[_ngcontent-%COMP%]:hover{transition:background-color .5s linear;background:#ff000080;cursor:pointer}.container-icon[_ngcontent-%COMP%]:active{transform:scale(.8);transition:transform .5s linear;background:red}.section-active[_ngcontent-%COMP%]{transition:background-color .5s linear;background:#ff000080}"]});let t=e;return t})();var Zt=(()=>{let e=class e{constructor(){this.title="Ricardo P\xE1jaro Coatl"}};e.\u0275fac=function(c){return new(c||e)},e.\u0275cmp=T4({type:e,selectors:[["app-root"]],decls:3,vars:0,template:function(c,i){c&1&&(J2(0,"main"),j1(1,"app-navbar")(2,"router-outlet"),Z2())},dependencies:[A4,Ct,Jt,ut],encapsulation:2});let t=e;return t})();var e0=[{path:"",redirectTo:`/${k2.homeId}`,pathMatch:"full"},{path:k2.homeId,loadComponent:()=>import("./chunk-2SUQVVF4.js").then(t=>t.ProfileComponent)},{path:k2.skillsId,loadComponent:()=>import("./chunk-DNZIQWFE.js").then(t=>t.SkillsComponent)},{path:k2.projectId,loadComponent:()=>import("./chunk-JIUSI4DA.js").then(t=>t.ProjectsComponent)},{path:k2.certificateId,loadComponent:()=>import("./chunk-QWVWGWU3.js").then(t=>t.CertificateComponent)},{path:k2.contactId,loadComponent:()=>import("./chunk-FG3QRRFJ.js").then(t=>t.ContactComponent)},{path:"terms-and-conditions/:projectID",loadComponent:()=>import("./chunk-FI3ITBBR.js").then(t=>t.TermsComponent)},{path:"**",redirectTo:`/${k2.homeId}`,pathMatch:"full"}];var t0="@firebase/database",s0="1.0.20";var je="";function lr(t){je=t}var se=class{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,s){s==null?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),a2(s))}get(e){let s=this.domStorage_.getItem(this.prefixedName_(e));return s==null?null:D4(s)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}};var re=class{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,s){s==null?delete this.cache_[e]:this.cache_[e]=s}get(e){return A2(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}};var A0=function(t){try{if(typeof window<"u"&&typeof window[t]<"u"){let e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new se(e)}}catch{}return new re},l1=A0("localStorage"),ce=A0("sessionStorage");var b1=new Pt("@firebase/database"),fr=(function(){let t=1;return function(){return t++}})(),N0=function(t){let e=Tt(t),s=new wt;s.update(e);let r=s.digest();return Ht.encodeByteArray(r)},f4=function(...t){let e="";for(let s=0;s{document.readyState==="complete"&&s()}),window.attachEvent("onload",s))}},w1="[MIN_NAME]",h1="[MAX_NAME]",I1=function(t,e){if(t===e)return 0;if(t===w1||e===h1)return-1;if(e===w1||t===h1)return 1;{let s=c0(t),r=c0(e);return s!==null?r!==null?s-r===0?t.length-e.length:s-r:-1:r!==null?1:ts?r.push(t.substring(c,s)):r.push(t.substring(c,c+e));return r};function H2(t,e){for(let s in t)t.hasOwnProperty(s)&&e(s,t[s])}var R0=function(t){R(!I0(t),"Invalid JSON number");let e=11,s=52,r=(1<=Math.pow(2,1-r)?(n=Math.min(Math.floor(Math.log(t)/Math.LN2),r),i=n+r,a=Math.round(t*Math.pow(2,s-n)-Math.pow(2,s))):(i=0,a=Math.round(t/Math.pow(2,1-r-s))));let l=[];for(o=s;o;o-=1)l.push(a%2?1:0),a=Math.floor(a/2);for(o=e;o;o-=1)l.push(i%2?1:0),i=Math.floor(i/2);l.push(c?1:0),l.reverse();let m=l.join(""),y="";for(o=0;o<64;o+=8){let u=parseInt(m.substr(o,8),2).toString(16);u.length===1&&(u="0"+u),y=y+u}return y.toLowerCase()},dr=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},vr=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};var gr=new RegExp("^-?(0*)\\d{1,10}$"),yr=-2147483648,Cr=2147483647,c0=function(t){if(gr.test(t)){let e=Number(t);if(e>=yr&&e<=Cr)return e}return null},u4=function(t){try{t()}catch(e){setTimeout(()=>{let s=e.stack||"";throw g2("Exception was thrown by user callback.",s),e},Math.floor(0))}},Hr=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},r4=function(t,e){let s=setTimeout(t,e);return typeof s=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(s):typeof s=="object"&&s.unref&&s.unref(),s};var ae=class{constructor(e,s){this.appCheckProvider=s,this.appName=e.name,U4(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.appCheck=s?.getImmediate({optional:!0}),this.appCheck||s?.get().then(r=>this.appCheck=r)}getToken(e){if(this.serverAppAppCheckToken){if(e)throw new Error("Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.");return Promise.resolve({token:this.serverAppAppCheckToken})}return this.appCheck?this.appCheck.getToken(e):new Promise((s,r)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(s,r):s(null)},0)})}addTokenChangeListener(e){var s;(s=this.appCheckProvider)===null||s===void 0||s.get().then(r=>r.addTokenListener(e))}notifyForInvalidToken(){g2(`Provided AppCheck credentials for the app named "${this.appName}" are invalid. This usually indicates your app was not initialized correctly.`)}};var ne=class{constructor(e,s,r){this.appName_=e,this.firebaseOptions_=s,this.authProvider_=r,this.auth_=null,this.auth_=r.getImmediate({optional:!0}),this.auth_||r.onInit(c=>this.auth_=c)}getToken(e){return this.auth_?this.auth_.getToken(e).catch(s=>s&&s.code==="auth/token-not-initialized"?(o2("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(s)):new Promise((s,r)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(s,r):s(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(s=>s.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(s=>s.removeAuthTokenListener(e))}notifyForInvalidToken(){let e='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?e+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',g2(e)}},c4=(()=>{class t{constructor(s){this.accessToken=s}getToken(s){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(s){s(this.accessToken)}removeTokenChangeListener(s){}notifyForInvalidToken(){}}t.OWNER="owner";return t})(),r3="5",D0="v",B0="s",O0="r",G0="f",U0=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,q0="ls",W0="p",oe="ac",j0="websocket",$0="long_polling";var c3=class{constructor(e,s,r,c,i=!1,a="",n=!1,o=!1,l=null){this.secure=s,this.namespace=r,this.webSocketOnly=c,this.nodeAdmin=i,this.persistenceKey=a,this.includeNamespaceInQueryParams=n,this.isUsingEmulator=o,this.emulatorOptions=l,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=l1.get("host:"+e)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&l1.set("host:"+this._host,this.internalHost))}toString(){let e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e}toURLString(){let e=this.secure?"https://":"http://",s=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${e}${this.host}/${s}`}};function zr(t){return t.host!==t.internalHost||t.isCustomHost()||t.includeNamespaceInQueryParams}function K0(t,e,s){R(typeof e=="string","typeof type must == string"),R(typeof s=="object","typeof params must == object");let r;if(e===j0)r=(t.secure?"wss://":"ws://")+t.internalHost+"/.ws?";else if(e===$0)r=(t.secure?"https://":"http://")+t.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+e);zr(t)&&(s.ns=t.namespace);let c=[];return H2(s,(i,a)=>{c.push(i+"="+a)}),r+c.join("&")}var le=class{constructor(){this.counters_={}}incrementCounter(e,s=1){A2(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=s}get(){return Mt(this.counters_)}};var Q3={},Y3={};function Ke(t){let e=t.toString();return Q3[e]||(Q3[e]=new le),Q3[e]}function Mr(t,e){let s=t.toString();return Y3[s]||(Y3[s]=e()),Y3[s]}var fe=class{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,s){this.closeAfterResponse=e,this.onClose=s,this.closeAfterResponse{this.onMessage_(r[c])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}};var i0="start",Vr="close",_r="pLPCommand",Sr="pRTLPCB",Q0="id",Y0="pw",X0="ser",Lr="cb",br="seg",xr="ts",wr="d",Er="dframe",J0=1870,Z0=30,Tr=J0-Z0,kr=25e3,Pr=3e4,he=class t{constructor(e,s,r,c,i,a,n){this.connId=e,this.repoInfo=s,this.applicationId=r,this.appCheckToken=c,this.authToken=i,this.transportSessionId=a,this.lastSessionId=n,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=h4(e),this.stats_=Ke(s),this.urlFn=o=>(this.appCheckToken&&(o[oe]=this.appCheckToken),K0(s,$0,o))}open(e,s){this.curSegmentNum=0,this.onDisconnect_=s,this.myPacketOrderer=new fe(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(Pr)),pr(()=>{if(this.isClosed_)return;this.scriptTagHolder=new ue((...i)=>{let[a,n,o,l,m]=i;if(this.incrementIncomingBytes_(i),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,a===i0)this.id=n,this.password=o;else if(a===Vr)n?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(n,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+a)},(...i)=>{let[a,n]=i;this.incrementIncomingBytes_(i),this.myPacketOrderer.handleResponse(a,n)},()=>{this.onClosed_()},this.urlFn);let r={};r[i0]="t",r[X0]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(r[Lr]=this.scriptTagHolder.uniqueCallbackIdentifier),r[D0]=r3,this.transportSessionId&&(r[B0]=this.transportSessionId),this.lastSessionId&&(r[q0]=this.lastSessionId),this.applicationId&&(r[W0]=this.applicationId),this.appCheckToken&&(r[oe]=this.appCheckToken),typeof location<"u"&&location.hostname&&U0.test(location.hostname)&&(r[O0]=G0);let c=this.urlFn(r);this.log_("Connecting via long-poll to "+c),this.scriptTagHolder.addTag(c,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){t.forceAllow_=!0}static forceDisallow(){t.forceDisallow_=!0}static isAvailable(){return P2()?!1:t.forceAllow_?!0:!t.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!dr()&&!vr()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(e){let s=a2(e);this.bytesSent+=s.length,this.stats_.incrementCounter("bytes_sent",s.length);let r=zt(s),c=F0(r,Tr);for(let i=0;idocument.domain="'+document.domain+'";<\/script>');let a=""+i+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(a),this.myIFrame.doc.close()}catch(n){o2("frame writing exception"),n.stack&&o2(n.stack),o2(n)}}}static createIFrame_(){let e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||o2("No IE domain setting required")}catch{let r=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+r+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));let e=this.onDisconnect;e&&(this.onDisconnect=null,e())}startLongPoll(e,s){for(this.myID=e,this.myPW=s,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;let e={};e[Q0]=this.myID,e[Y0]=this.myPW,e[X0]=this.currentSerial;let s=this.urlFn(e),r="",c=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+Z0+r.length<=J0;){let a=this.pendingSegs.shift();r=r+"&"+br+c+"="+a.seg+"&"+xr+c+"="+a.ts+"&"+wr+c+"="+a.d,c++}return s=s+r,this.addLongPollTag_(s,this.currentSerial),!0}else return!1}enqueueSegment(e,s,r){this.pendingSegs.push({seg:e,ts:s,d:r}),this.alive&&this.newRequest_()}addLongPollTag_(e,s){this.outstandingRequests.add(s);let r=()=>{this.outstandingRequests.delete(s),this.newRequest_()},c=setTimeout(r,Math.floor(kr)),i=()=>{clearTimeout(c),r()};this.addTag(e,i)}addTag(e,s){P2()?this.doNodeLongPoll(e,s):setTimeout(()=>{try{if(!this.sendNewPolls)return;let r=this.myIFrame.doc.createElement("script");r.type="text/javascript",r.async=!0,r.src=e,r.onload=r.onreadystatechange=function(){let c=r.readyState;(!c||c==="loaded"||c==="complete")&&(r.onload=r.onreadystatechange=null,r.parentNode&&r.parentNode.removeChild(r),s())},r.onerror=()=>{o2("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(r)}catch{}},Math.floor(1))}};var Ar=16384,Nr=45e3,i3=null;typeof MozWebSocket<"u"?i3=MozWebSocket:typeof WebSocket<"u"&&(i3=WebSocket);var Z1=(()=>{class t{constructor(s,r,c,i,a,n,o){this.connId=s,this.applicationId=c,this.appCheckToken=i,this.authToken=a,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=h4(this.connId),this.stats_=Ke(r),this.connURL=t.connectionURL_(r,n,o,i,c),this.nodeAdmin=r.nodeAdmin}static connectionURL_(s,r,c,i,a){let n={};return n[D0]=r3,!P2()&&typeof location<"u"&&location.hostname&&U0.test(location.hostname)&&(n[O0]=G0),r&&(n[B0]=r),c&&(n[q0]=c),i&&(n[oe]=i),a&&(n[W0]=a),K0(s,j0,n)}open(s,r){this.onDisconnect=r,this.onMessage=s,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,l1.set("previous_websocket_failure",!0);try{let c;if(P2()){let i=this.nodeAdmin?"AdminNode":"Node";c={headers:{"User-Agent":`Firebase/${r3}/${je}/${process.platform}/${i}`,"X-Firebase-GMPID":this.applicationId||""}},this.authToken&&(c.headers.Authorization=`Bearer ${this.authToken}`),this.appCheckToken&&(c.headers["X-Firebase-AppCheck"]=this.appCheckToken);let a=process.env,n=this.connURL.indexOf("wss://")===0?a.HTTPS_PROXY||a.https_proxy:a.HTTP_PROXY||a.http_proxy;n&&(c.proxy={origin:n})}this.mySock=new i3(this.connURL,[],c)}catch(c){this.log_("Error instantiating WebSocket.");let i=c.message||c.data;i&&this.log_(i),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=c=>{this.handleIncomingFrame(c)},this.mySock.onerror=c=>{this.log_("WebSocket error. Closing connection.");let i=c.message||c.data;i&&this.log_(i),this.onClosed_()}}start(){}static forceDisallow(){t.forceDisallow_=!0}static isAvailable(){let s=!1;if(typeof navigator<"u"&&navigator.userAgent){let r=/Android ([0-9]{0,}\.[0-9]{0,})/,c=navigator.userAgent.match(r);c&&c.length>1&&parseFloat(c[1])<4.4&&(s=!0)}return!s&&i3!==null&&!t.forceDisallow_}static previouslyFailed(){return l1.isInMemoryStorage||l1.get("previous_websocket_failure")===!0}markConnectionHealthy(){l1.remove("previous_websocket_failure")}appendFrame_(s){if(this.frames.push(s),this.frames.length===this.totalFrames){let r=this.frames.join("");this.frames=null;let c=D4(r);this.onMessage(c)}}handleNewFrameCount_(s){this.totalFrames=s,this.frames=[]}extractFrameCount_(s){if(R(this.frames===null,"We already have a frame buffer"),s.length<=6){let r=Number(s);if(!isNaN(r))return this.handleNewFrameCount_(r),null}return this.handleNewFrameCount_(1),s}handleIncomingFrame(s){if(this.mySock===null)return;let r=s.data;if(this.bytesReceived+=r.length,this.stats_.incrementCounter("bytes_received",r.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(r);else{let c=this.extractFrameCount_(r);c!==null&&this.appendFrame_(c)}}send(s){this.resetKeepAlive();let r=a2(s);this.bytesSent+=r.length,this.stats_.incrementCounter("bytes_sent",r.length);let c=F0(r,Ar);c.length>1&&this.sendString_(String(c.length));for(let i=0;i{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(Nr))}sendString_(s){try{this.mySock.send(s)}catch(r){this.log_("Exception thrown from WebSocket.send():",r.message||r.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}t.responsesRequiredToBeHealthy=2,t.healthyTimeout=3e4;return t})(),Ir=(()=>{class t{static get ALL_TRANSPORTS(){return[he,Z1]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(s){this.initTransports_(s)}initTransports_(s){let r=Z1&&Z1.isAvailable(),c=r&&!Z1.previouslyFailed();if(s.webSocketOnly&&(r||g2("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),c=!0),c)this.transports_=[Z1];else{let i=this.transports_=[];for(let a of t.ALL_TRANSPORTS)a&&a.isAvailable()&&i.push(a);t.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}t.globalTransportInitialized_=!1;return t})(),Fr=6e4,Rr=5e3,Dr=10*1024,Br=100*1024,X3="t",a0="d",Or="s",n0="r",Gr="e",o0="o",l0="a",f0="n",h0="p",Ur="h",pe=class{constructor(e,s,r,c,i,a,n,o,l,m){this.id=e,this.repoInfo_=s,this.applicationId_=r,this.appCheckToken_=c,this.authToken_=i,this.onMessage_=a,this.onReady_=n,this.onDisconnect_=o,this.onKill_=l,this.lastSessionId=m,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=h4("c:"+this.id+":"),this.transportManager_=new Ir(s),this.log_("Connection created"),this.start_()}start_(){let e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;let s=this.connReceiver_(this.conn_),r=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(s,r)},Math.floor(0));let c=e.healthyTimeout||0;c>0&&(this.healthyTimeout_=r4(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>Br?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>Dr?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(c)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(e){return s=>{e===this.conn_?this.onConnectionLost_(s):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return s=>{this.state_!==2&&(e===this.rx_?this.onPrimaryMessageReceived_(s):e===this.secondaryConn_?this.onSecondaryMessageReceived_(s):this.log_("message on old connection"))}}sendRequest(e){let s={t:"d",d:e};this.sendData_(s)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(e){if(X3 in e){let s=e[X3];s===l0?this.upgradeIfSecondaryHealthy_():s===n0?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):s===o0&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){let s=J1("t",e),r=J1("d",e);if(s==="c")this.onSecondaryControl_(r);else if(s==="d")this.pendingDataMessages.push(r);else throw new Error("Unknown protocol layer: "+s)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:h0,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:l0,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:f0,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){let s=J1("t",e),r=J1("d",e);s==="c"?this.onControl_(r):s==="d"&&this.onDataMessage_(r)}onDataMessage_(e){this.onPrimaryResponse_(),this.onMessage_(e)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(e){let s=J1(X3,e);if(a0 in e){let r=e[a0];if(s===Ur){let c=Object.assign({},r);this.repoInfo_.isUsingEmulator&&(c.h=this.repoInfo_.host),this.onHandshake_(c)}else if(s===f0){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let c=0;c{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(Fr))}onReset_(e){this.log_("Reset packet received. New host: "+e),this.repoInfo_.host=e,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(e,s){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(s,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):r4(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(Rr))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:h0,d:{}}}))}onSecondaryConnectionLost_(){let e=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===e||this.rx_===e)&&this.close()}onConnectionLost_(e){this.conn_=null,!e&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(l1.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(e){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(e)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}};var a3=class{put(e,s,r,c){}merge(e,s,r,c){}refreshAuthToken(e){}refreshAppCheckToken(e){}onDisconnectPut(e,s,r){}onDisconnectMerge(e,s,r){}onDisconnectCancel(e,s){}reportStats(e){}};var n3=class{constructor(e){this.allowedEvents_=e,this.listeners_={},R(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...s){if(Array.isArray(this.listeners_[e])){let r=[...this.listeners_[e]];for(let c=0;cs===e),"Unknown event: "+e)}};var o3=class t extends n3{static getInstance(){return new t}constructor(){super(["online"]),this.online_=!0,typeof window<"u"&&typeof window.addEventListener<"u"&&!j3()&&(window.addEventListener("online",()=>{this.online_||(this.online_=!0,this.trigger("online",!0))},!1),window.addEventListener("offline",()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))},!1))}getInitialEvent(e){return R(e==="online","Unknown event type: "+e),[this.online_]}currentlyOnline(){return this.online_}};var u0=32,p0=768,J=class{constructor(e,s){if(s===void 0){this.pieces_=e.split("/");let r=0;for(let c=0;c0&&(this.pieces_[r]=this.pieces_[c],r++);this.pieces_.length=r,this.pieceNum_=0}else this.pieces_=e,this.pieceNum_=s}toString(){let e="";for(let s=this.pieceNum_;s=t.pieces_.length?null:t.pieces_[t.pieceNum_]}function t1(t){return t.pieces_.length-t.pieceNum_}function e2(t){let e=t.pieceNum_;return e=t.pieces_.length)return null;let e=[];for(let s=t.pieceNum_;s0&&s.push(r[c])}return new J(s,0)}function q(t){return t.pieceNum_>=t.pieces_.length}function y2(t,e){let s=W(t),r=W(e);if(s===null)return e;if(s===r)return y2(e2(t),e2(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")}function r8(t,e){if(t1(t)!==t1(e))return!1;for(let s=t.pieceNum_,r=e.pieceNum_;s<=t.pieces_.length;s++,r++)if(t.pieces_[s]!==e.pieces_[r])return!1;return!0}function L2(t,e){let s=t.pieceNum_,r=e.pieceNum_;if(t1(t)>t1(e))return!1;for(;s0&&(t.byteLength_+=1),t.parts_.push(e),t.byteLength_+=Q1(e),c8(t)}function jr(t){let e=t.parts_.pop();t.byteLength_-=Q1(e),t.parts_.length>0&&(t.byteLength_-=1)}function c8(t){if(t.byteLength_>p0)throw new Error(t.errorPrefix_+"has a key path longer than "+p0+" bytes ("+t.byteLength_+").");if(t.parts_.length>u0)throw new Error(t.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+u0+") or object contains a cycle "+o1(t))}function o1(t){return t.parts_.length===0?"":"in property '"+t.parts_.join(".")+"'"}var de=class t extends n3{static getInstance(){return new t}constructor(){super(["visible"]);let e,s;typeof document<"u"&&typeof document.addEventListener<"u"&&(typeof document.hidden<"u"?(s="visibilitychange",e="hidden"):typeof document.mozHidden<"u"?(s="mozvisibilitychange",e="mozHidden"):typeof document.msHidden<"u"?(s="msvisibilitychange",e="msHidden"):typeof document.webkitHidden<"u"&&(s="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,s&&document.addEventListener(s,()=>{let r=!document[e];r!==this.visible_&&(this.visible_=r,this.trigger("visible",r))},!1)}getInitialEvent(e){return R(e==="visible","Unknown event type: "+e),[this.visible_]}};var e4=1e3,$r=300*1e3,m0=30*1e3,Kr=1.3,Qr=3e4,Yr="server_kill",d0=3,Qe=(()=>{class t extends a3{constructor(s,r,c,i,a,n,o,l){if(super(),this.repoInfo_=s,this.applicationId_=r,this.onDataUpdate_=c,this.onConnectStatus_=i,this.onServerInfoUpdate_=a,this.authTokenProvider_=n,this.appCheckTokenProvider_=o,this.authOverride_=l,this.id=t.nextPersistentConnectionId_++,this.log_=h4("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=e4,this.maxReconnectDelay_=$r,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,l&&!P2())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");de.getInstance().on("visible",this.onVisible_,this),s.host.indexOf("fblocal")===-1&&o3.getInstance().on("online",this.onOnline_,this)}sendRequest(s,r,c){let i=++this.requestNumber_,a={r:i,a:s,b:r};this.log_(a2(a)),R(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(a),c&&(this.requestCBHash_[i]=c)}get(s){this.initConnection_();let r=new W3,i={action:"g",request:{p:s._path.toString(),q:s._queryObject},onComplete:n=>{let o=n.d;n.s==="ok"?r.resolve(o):r.reject(o)}};this.outstandingGets_.push(i),this.outstandingGetCount_++;let a=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(a),r.promise}listen(s,r,c,i){this.initConnection_();let a=s._queryIdentifier,n=s._path.toString();this.log_("Listen called for "+n+" "+a),this.listens.has(n)||this.listens.set(n,new Map),R(s._queryParams.isDefault()||!s._queryParams.loadsAllData(),"listen() called for non-default but complete query"),R(!this.listens.get(n).has(a),"listen() called twice for same path/queryId.");let o={onComplete:i,hashFn:r,query:s,tag:c};this.listens.get(n).set(a,o),this.connected_&&this.sendListen_(o)}sendGet_(s){let r=this.outstandingGets_[s];this.sendRequest("g",r.request,c=>{delete this.outstandingGets_[s],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),r.onComplete&&r.onComplete(c)})}sendListen_(s){let r=s.query,c=r._path.toString(),i=r._queryIdentifier;this.log_("Listen on "+c+" for "+i);let a={p:c},n="q";s.tag&&(a.q=r._queryObject,a.t=s.tag),a.h=s.hashFn(),this.sendRequest(n,a,o=>{let l=o.d,m=o.s;t.warnOnListenWarnings_(l,r),(this.listens.get(c)&&this.listens.get(c).get(i))===s&&(this.log_("listen response",o),m!=="ok"&&this.removeListen_(c,i),s.onComplete&&s.onComplete(m,l))})}static warnOnListenWarnings_(s,r){if(s&&typeof s=="object"&&A2(s,"w")){let c=a1(s,"w");if(Array.isArray(c)&&~c.indexOf("no_index")){let i='".indexOn": "'+r._queryParams.getIndex().toString()+'"',a=r._path.toString();g2(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${i} at ${a} to your security rules for better performance.`)}}}refreshAuthToken(s){this.authToken_=s,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(s)}reduceReconnectDelayIfAdminCredential_(s){(s&&s.length===40||Lt(s))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=m0)}refreshAppCheckToken(s){this.appCheckToken_=s,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){let s=this.authToken_,r=St(s)?"auth":"gauth",c={cred:s};this.authOverride_===null?c.noauth=!0:typeof this.authOverride_=="object"&&(c.authvar=this.authOverride_),this.sendRequest(r,c,i=>{let a=i.s,n=i.d||"error";this.authToken_===s&&(a==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(a,n))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},s=>{let r=s.s,c=s.d||"error";r==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(r,c)})}unlisten(s,r){let c=s._path.toString(),i=s._queryIdentifier;this.log_("Unlisten called for "+c+" "+i),R(s._queryParams.isDefault()||!s._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(c,i)&&this.connected_&&this.sendUnlisten_(c,i,s._queryObject,r)}sendUnlisten_(s,r,c,i){this.log_("Unlisten on "+s+" for "+r);let a={p:s},n="n";i&&(a.q=c,a.t=i),this.sendRequest(n,a)}onDisconnectPut(s,r,c){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",s,r,c):this.onDisconnectRequestQueue_.push({pathString:s,action:"o",data:r,onComplete:c})}onDisconnectMerge(s,r,c){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",s,r,c):this.onDisconnectRequestQueue_.push({pathString:s,action:"om",data:r,onComplete:c})}onDisconnectCancel(s,r){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",s,null,r):this.onDisconnectRequestQueue_.push({pathString:s,action:"oc",data:null,onComplete:r})}sendOnDisconnect_(s,r,c,i){let a={p:r,d:c};this.log_("onDisconnect "+s,a),this.sendRequest(s,a,n=>{i&&setTimeout(()=>{i(n.s,n.d)},Math.floor(0))})}put(s,r,c,i){this.putInternal("p",s,r,c,i)}merge(s,r,c,i){this.putInternal("m",s,r,c,i)}putInternal(s,r,c,i,a){this.initConnection_();let n={p:r,d:c};a!==void 0&&(n.h=a),this.outstandingPuts_.push({action:s,request:n,onComplete:i}),this.outstandingPutCount_++;let o=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(o):this.log_("Buffering put: "+r)}sendPut_(s){let r=this.outstandingPuts_[s].action,c=this.outstandingPuts_[s].request,i=this.outstandingPuts_[s].onComplete;this.outstandingPuts_[s].queued=this.connected_,this.sendRequest(r,c,a=>{this.log_(r+" response",a),delete this.outstandingPuts_[s],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),i&&i(a.s,a.d)})}reportStats(s){if(this.connected_){let r={c:s};this.log_("reportStats",r),this.sendRequest("s",r,c=>{if(c.s!=="ok"){let a=c.d;this.log_("reportStats","Error sending stats: "+a)}})}}onDataMessage_(s){if("r"in s){this.log_("from server: "+a2(s));let r=s.r,c=this.requestCBHash_[r];c&&(delete this.requestCBHash_[r],c(s.b))}else{if("error"in s)throw"A server-side error has occurred: "+s.error;"a"in s&&this.onDataPush_(s.a,s.b)}}onDataPush_(s,r){this.log_("handleServerMessage",s,r),s==="d"?this.onDataUpdate_(r.p,r.d,!1,r.t):s==="m"?this.onDataUpdate_(r.p,r.d,!0,r.t):s==="c"?this.onListenRevoked_(r.p,r.q):s==="ac"?this.onAuthRevoked_(r.s,r.d):s==="apc"?this.onAppCheckRevoked_(r.s,r.d):s==="sd"?this.onSecurityDebugPacket_(r):ie("Unrecognized action received from server: "+a2(s)+` Are you using the latest client?`)}onReady_(s,r){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(s),this.lastSessionId=r,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(s){R(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(s))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(s){s&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=e4,this.realtime_||this.scheduleConnect_(0)),this.visible_=s}onOnline_(s){s?(this.log_("Browser went online."),this.reconnectDelay_=e4,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>Qr&&(this.reconnectDelay_=e4),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());let s=Math.max(0,new Date().getTime()-this.lastConnectionAttemptTime_),r=Math.max(0,this.reconnectDelay_-s);r=Math.random()*r,this.log_("Trying to reconnect in "+r+"ms"),this.scheduleConnect_(r),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*Kr)}this.onConnectStatus_(!1)}establishConnection_(){return C1(this,null,function*(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;let s=this.onDataMessage_.bind(this),r=this.onReady_.bind(this),c=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+t.nextConnectionId_++,a=this.lastSessionId,n=!1,o=null,l=function(){o?o.close():(n=!0,c())},m=function(u){R(o,"sendRequest call when we're not connected not allowed."),o.sendRequest(u)};this.realtime_={close:l,sendRequest:m};let y=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{let[u,C]=yield Promise.all([this.authTokenProvider_.getToken(y),this.appCheckTokenProvider_.getToken(y)]);n?o2("getToken() completed but was canceled"):(o2("getToken() completed. Creating connection."),this.authToken_=u&&u.accessToken,this.appCheckToken_=C&&C.token,o=new pe(i,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,s,r,c,v=>{g2(v+" ("+this.repoInfo_.toString()+")"),this.interrupt(Yr)},a))}catch(u){this.log_("Failed to get token: "+u),n||(this.repoInfo_.nodeAdmin&&g2(u),l())}}})}interrupt(s){o2("Interrupting connection for reason: "+s),this.interruptReasons_[s]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(s){o2("Resuming connection for reason: "+s),delete this.interruptReasons_[s],$3(this.interruptReasons_)&&(this.reconnectDelay_=e4,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(s){let r=s-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:r})}cancelSentTransactions_(){for(let s=0;s$e(a)).join("$"):c="default";let i=this.removeListen_(s,c);i&&i.onComplete&&i.onComplete("permission_denied")}removeListen_(s,r){let c=new J(s).toString(),i;if(this.listens.has(c)){let a=this.listens.get(c);i=a.get(r),a.delete(r),a.size===0&&this.listens.delete(c)}else i=void 0;return i}onAuthRevoked_(s,r){o2("Auth token revoked: "+s+"/"+r),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(s==="invalid_token"||s==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=d0&&(this.reconnectDelay_=m0,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(s,r){o2("App check token revoked: "+s+"/"+r),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(s==="invalid_token"||s==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=d0&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(s){this.securityDebugCallback_?this.securityDebugCallback_(s):"msg"in s&&console.log("FIREBASE: "+s.msg.replace(` `,` FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(let s of this.listens.values())for(let r of s.values())this.sendListen_(r);for(let s=0;s0}peek(){if(this.nodeStack_.length===0)return null;let e=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}},S2=(()=>{class t{constructor(s,r,c,i,a){this.key=s,this.value=r,this.color=c??t.RED,this.left=i??C2.EMPTY_NODE,this.right=a??C2.EMPTY_NODE}copy(s,r,c,i,a){return new t(s??this.key,r??this.value,c??this.color,i??this.left,a??this.right)}count(){return this.left.count()+1+this.right.count()}isEmpty(){return!1}inorderTraversal(s){return this.left.inorderTraversal(s)||!!s(this.key,this.value)||this.right.inorderTraversal(s)}reverseTraversal(s){return this.right.reverseTraversal(s)||s(this.key,this.value)||this.left.reverseTraversal(s)}min_(){return this.left.isEmpty()?this:this.left.min_()}minKey(){return this.min_().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(s,r,c){let i=this,a=c(s,i.key);return a<0?i=i.copy(null,null,null,i.left.insert(s,r,c),null):a===0?i=i.copy(null,r,null,null,null):i=i.copy(null,null,null,null,i.right.insert(s,r,c)),i.fixUp_()}removeMin_(){if(this.left.isEmpty())return C2.EMPTY_NODE;let s=this;return!s.left.isRed_()&&!s.left.left.isRed_()&&(s=s.moveRedLeft_()),s=s.copy(null,null,null,s.left.removeMin_(),null),s.fixUp_()}remove(s,r){let c,i;if(c=this,r(s,c.key)<0)!c.left.isEmpty()&&!c.left.isRed_()&&!c.left.left.isRed_()&&(c=c.moveRedLeft_()),c=c.copy(null,null,null,c.left.remove(s,r),null);else{if(c.left.isRed_()&&(c=c.rotateRight_()),!c.right.isEmpty()&&!c.right.isRed_()&&!c.right.left.isRed_()&&(c=c.moveRedRight_()),r(s,c.key)===0){if(c.right.isEmpty())return C2.EMPTY_NODE;i=c.right.min_(),c=c.copy(i.key,i.value,null,null,c.right.removeMin_())}c=c.copy(null,null,null,null,c.right.remove(s,r))}return c.fixUp_()}isRed_(){return this.color}fixUp_(){let s=this;return s.right.isRed_()&&!s.left.isRed_()&&(s=s.rotateLeft_()),s.left.isRed_()&&s.left.left.isRed_()&&(s=s.rotateRight_()),s.left.isRed_()&&s.right.isRed_()&&(s=s.colorFlip_()),s}moveRedLeft_(){let s=this.colorFlip_();return s.right.left.isRed_()&&(s=s.copy(null,null,null,null,s.right.rotateRight_()),s=s.rotateLeft_(),s=s.colorFlip_()),s}moveRedRight_(){let s=this.colorFlip_();return s.left.left.isRed_()&&(s=s.rotateRight_(),s=s.colorFlip_()),s}rotateLeft_(){let s=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,s,null)}rotateRight_(){let s=this.copy(null,null,t.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,s)}colorFlip_(){let s=this.left.copy(null,null,!this.left.color,null,null),r=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,s,r)}checkMaxDepth_(){let s=this.check_();return Math.pow(2,s)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");let s=this.left.check_();if(s!==this.right.check_())throw new Error("Black depths differ");return s+(this.isRed_()?0:1)}}return t.RED=!0,t.BLACK=!1,t})(),ve=class{copy(e,s,r,c,i){return this}insert(e,s,r){return new S2(e,s,null)}remove(e,s){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}},C2=class t{constructor(e,s=t.EMPTY_NODE){this.comparator_=e,this.root_=s}insert(e,s){return new t(this.comparator_,this.root_.insert(e,s,this.comparator_).copy(null,null,S2.BLACK,null,null))}remove(e){return new t(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,S2.BLACK,null,null))}get(e){let s,r=this.root_;for(;!r.isEmpty();){if(s=this.comparator_(e,r.key),s===0)return r.value;s<0?r=r.left:s>0&&(r=r.right)}return null}getPredecessorKey(e){let s,r=this.root_,c=null;for(;!r.isEmpty();)if(s=this.comparator_(e,r.key),s===0){if(r.left.isEmpty())return c?c.key:null;for(r=r.left;!r.right.isEmpty();)r=r.right;return r.key}else s<0?r=r.left:s>0&&(c=r,r=r.right);throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(e){return this.root_.inorderTraversal(e)}reverseTraversal(e){return this.root_.reverseTraversal(e)}getIterator(e){return new S1(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,s){return new S1(this.root_,e,this.comparator_,!1,s)}getReverseIteratorFrom(e,s){return new S1(this.root_,e,this.comparator_,!0,s)}getReverseIterator(e){return new S1(this.root_,null,this.comparator_,!0,e)}};C2.EMPTY_NODE=new ve;function Xr(t,e){return I1(t.name,e.name)}function Ye(t,e){return I1(t,e)}var ge;function Jr(t){ge=t}var i8=function(t){return typeof t=="number"?"number:"+R0(t):"string:"+t},a8=function(t){if(t.isLeafNode()){let e=t.val();R(typeof e=="string"||typeof e=="number"||typeof e=="object"&&A2(e,".sv"),"Priority must be a string or number.")}else R(t===ge||t.isEmpty(),"priority of unexpected type.");R(t===ge||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};var v0,T1=(()=>{class t{static set __childrenNodeConstructor(s){v0=s}static get __childrenNodeConstructor(){return v0}constructor(s,r=t.__childrenNodeConstructor.EMPTY_NODE){this.value_=s,this.priorityNode_=r,this.lazyHash_=null,R(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),a8(this.priorityNode_)}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(s){return new t(this.value_,s)}getImmediateChild(s){return s===".priority"?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE}getChild(s){return q(s)?this:W(s)===".priority"?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(s,r){return null}updateImmediateChild(s,r){return s===".priority"?this.updatePriority(r):r.isEmpty()&&s!==".priority"?this:t.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(s,r).updatePriority(this.priorityNode_)}updateChild(s,r){let c=W(s);return c===null?r:r.isEmpty()&&c!==".priority"?this:(R(c!==".priority"||t1(s)===1,".priority must be the last token in a path"),this.updateImmediateChild(c,t.__childrenNodeConstructor.EMPTY_NODE.updateChild(e2(s),r)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(s,r){return!1}val(s){return s&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(this.lazyHash_===null){let s="";this.priorityNode_.isEmpty()||(s+="priority:"+i8(this.priorityNode_.val())+":");let r=typeof this.value_;s+=r+":",r==="number"?s+=R0(this.value_):s+=this.value_,this.lazyHash_=N0(s)}return this.lazyHash_}getValue(){return this.value_}compareTo(s){return s===t.__childrenNodeConstructor.EMPTY_NODE?1:s instanceof t.__childrenNodeConstructor?-1:(R(s.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(s))}compareToLeafNode_(s){let r=typeof s.value_,c=typeof this.value_,i=t.VALUE_TYPE_ORDER.indexOf(r),a=t.VALUE_TYPE_ORDER.indexOf(c);return R(i>=0,"Unknown leaf type: "+r),R(a>=0,"Unknown leaf type: "+c),i===a?c==="object"?0:this.value_parseInt(Math.log(i)/tc,10),r=i=>parseInt(Array(i+1).join("1"),2);this.count=s(e+1),this.current_=this.count-1;let c=r(this.count);this.bits_=e+1&c}nextBitIsOne(){let e=!(this.bits_&1<{let a=a1(this.indexSet_,i);if(R(a,"Missing index implementation for "+i),c===_1)if(a.isDefinedOn(e.node)){let n=[],o=s.getIterator(j.Wrap),l=o.getNext();for(;l;)l.name!==e.name&&n.push(l),l=o.getNext();return n.push(e),f3(n,a.getCompare())}else return _1;else{let n=s.get(e.name),o=c;return n&&(o=o.remove(new j(e.name,n))),o.insert(e,e.node)}});return new t(r,this.indexSet_)}removeFromIndexes(e,s){let r=K1(this.indexes_,c=>{if(c===_1)return c;{let i=s.get(e.name);return i?c.remove(new j(e.name,i)):c}});return new t(r,this.indexSet_)}};var t4,r2=(()=>{class t{static get EMPTY_NODE(){return t4||(t4=new t(new C2(Ye),null,k1.Default))}constructor(s,r,c){this.children_=s,this.priorityNode_=r,this.indexMap_=c,this.lazyHash_=null,this.priorityNode_&&a8(this.priorityNode_),this.children_.isEmpty()&&R(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||t4}updatePriority(s){return this.children_.isEmpty()?this:new t(this.children_,s,this.indexMap_)}getImmediateChild(s){if(s===".priority")return this.getPriority();{let r=this.children_.get(s);return r===null?t4:r}}getChild(s){let r=W(s);return r===null?this:this.getImmediateChild(r).getChild(e2(s))}hasChild(s){return this.children_.get(s)!==null}updateImmediateChild(s,r){if(R(r,"We should always be passing snapshot nodes"),s===".priority")return this.updatePriority(r);{let c=new j(s,r),i,a;r.isEmpty()?(i=this.children_.remove(s),a=this.indexMap_.removeFromIndexes(c,this.children_)):(i=this.children_.insert(s,r),a=this.indexMap_.addToIndexes(c,this.children_));let n=i.isEmpty()?t4:this.priorityNode_;return new t(i,n,a)}}updateChild(s,r){let c=W(s);if(c===null)return r;{R(W(s)!==".priority"||t1(s)===1,".priority must be the last token in a path");let i=this.getImmediateChild(c).updateChild(e2(s),r);return this.updateImmediateChild(c,i)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(s){if(this.isEmpty())return null;let r={},c=0,i=0,a=!0;if(this.forEachChild(f2,(n,o)=>{r[n]=o.val(s),c++,a&&t.INTEGER_REGEXP_.test(n)?i=Math.max(i,Number(n)):a=!1}),!s&&a&&i<2*c){let n=[];for(let o in r)n[o]=r[o];return n}else return s&&!this.getPriority().isEmpty()&&(r[".priority"]=this.getPriority().val()),r}hash(){if(this.lazyHash_===null){let s="";this.getPriority().isEmpty()||(s+="priority:"+i8(this.getPriority().val())+":"),this.forEachChild(f2,(r,c)=>{let i=c.hash();i!==""&&(s+=":"+r+":"+i)}),this.lazyHash_=s===""?"":N0(s)}return this.lazyHash_}getPredecessorChildName(s,r,c){let i=this.resolveIndex_(c);if(i){let a=i.getPredecessorKey(new j(s,r));return a?a.name:null}else return this.children_.getPredecessorKey(s)}getFirstChildName(s){let r=this.resolveIndex_(s);if(r){let c=r.minKey();return c&&c.name}else return this.children_.minKey()}getFirstChild(s){let r=this.getFirstChildName(s);return r?new j(r,this.children_.get(r)):null}getLastChildName(s){let r=this.resolveIndex_(s);if(r){let c=r.maxKey();return c&&c.name}else return this.children_.maxKey()}getLastChild(s){let r=this.getLastChildName(s);return r?new j(r,this.children_.get(r)):null}forEachChild(s,r){let c=this.resolveIndex_(s);return c?c.inorderTraversal(i=>r(i.name,i.node)):this.children_.inorderTraversal(r)}getIterator(s){return this.getIteratorFrom(s.minPost(),s)}getIteratorFrom(s,r){let c=this.resolveIndex_(r);if(c)return c.getIteratorFrom(s,i=>i);{let i=this.children_.getIteratorFrom(s.name,j.Wrap),a=i.peek();for(;a!=null&&r.compare(a,s)<0;)i.getNext(),a=i.peek();return i}}getReverseIterator(s){return this.getReverseIteratorFrom(s.maxPost(),s)}getReverseIteratorFrom(s,r){let c=this.resolveIndex_(r);if(c)return c.getReverseIteratorFrom(s,i=>i);{let i=this.children_.getReverseIteratorFrom(s.name,j.Wrap),a=i.peek();for(;a!=null&&r.compare(a,s)>0;)i.getNext(),a=i.peek();return i}}compareTo(s){return this.isEmpty()?s.isEmpty()?0:-1:s.isLeafNode()||s.isEmpty()?1:s===p4?-1:0}withIndex(s){if(s===x1||this.indexMap_.hasIndex(s))return this;{let r=this.indexMap_.addIndex(s,this.children_);return new t(this.children_,this.priorityNode_,r)}}isIndexed(s){return s===x1||this.indexMap_.hasIndex(s)}equals(s){if(s===this)return!0;if(s.isLeafNode())return!1;{let r=s;if(this.getPriority().equals(r.getPriority()))if(this.children_.count()===r.children_.count()){let c=this.getIterator(f2),i=r.getIterator(f2),a=c.getNext(),n=i.getNext();for(;a&&n;){if(a.name!==n.name||!a.node.equals(n.node))return!1;a=c.getNext(),n=i.getNext()}return a===null&&n===null}else return!1;else return!1}}resolveIndex_(s){return s===x1?null:this.indexMap_.get(s.toString())}}return t.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,t})(),He=class extends r2{constructor(){super(new C2(Ye),r2.EMPTY_NODE,k1.Default)}compareTo(e){return e===this?0:1}equals(e){return e===this}getPriority(){return this}getImmediateChild(e){return r2.EMPTY_NODE}isEmpty(){return!1}},p4=new He;Object.defineProperties(j,{MIN:{value:new j(w1,r2.EMPTY_NODE)},MAX:{value:new j(h1,p4)}});l3.__EMPTY_NODE=r2.EMPTY_NODE;T1.__childrenNodeConstructor=r2;Jr(p4);ec(p4);var sc=!0;function l2(t,e=null){if(t===null)return r2.EMPTY_NODE;if(typeof t=="object"&&".priority"in t&&(e=t[".priority"]),R(e===null||typeof e=="string"||typeof e=="number"||typeof e=="object"&&".sv"in e,"Invalid priority type found: "+typeof e),typeof t=="object"&&".value"in t&&t[".value"]!==null&&(t=t[".value"]),typeof t!="object"||".sv"in t){let s=t;return new T1(s,l2(e))}if(!(t instanceof Array)&&sc){let s=[],r=!1;if(H2(t,(a,n)=>{if(a.substring(0,1)!=="."){let o=l2(n);o.isEmpty()||(r=r||!o.getPriority().isEmpty(),s.push(new j(a,o)))}}),s.length===0)return r2.EMPTY_NODE;let i=f3(s,Xr,a=>a.name,Ye);if(r){let a=f3(s,f2.getCompare());return new r2(i,l2(e),new k1({".priority":a},{".priority":f2}))}else return new r2(i,l2(e),k1.Default)}else{let s=r2.EMPTY_NODE;return H2(t,(r,c)=>{if(A2(t,r)&&r.substring(0,1)!=="."){let i=l2(c);(i.isLeafNode()||!i.isEmpty())&&(s=s.updateImmediateChild(r,i))}}),s.updatePriority(l2(e))}}Zr(l2);var ze=class extends E1{constructor(e){super(),this.indexPath_=e,R(!q(e)&&W(e)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(e){return e.getChild(this.indexPath_)}isDefinedOn(e){return!e.getChild(this.indexPath_).isEmpty()}compare(e,s){let r=this.extractChild(e.node),c=this.extractChild(s.node),i=r.compareTo(c);return i===0?I1(e.name,s.name):i}makePost(e,s){let r=l2(e),c=r2.EMPTY_NODE.updateChild(this.indexPath_,r);return new j(s,c)}maxPost(){let e=r2.EMPTY_NODE.updateChild(this.indexPath_,p4);return new j(h1,e)}toString(){return t8(this.indexPath_,0).join("/")}};var Me=class extends E1{compare(e,s){let r=e.node.compareTo(s.node);return r===0?I1(e.name,s.name):r}isDefinedOn(e){return!0}indexedValueChanged(e,s){return!e.equals(s)}minPost(){return j.MIN}maxPost(){return j.MAX}makePost(e,s){let r=l2(e);return new j(s,r)}toString(){return".value"}},rc=new Me;function cc(t){return{type:"value",snapshotNode:t}}function ic(t,e){return{type:"child_added",snapshotNode:e,childName:t}}function ac(t,e){return{type:"child_removed",snapshotNode:e,childName:t}}function g0(t,e,s){return{type:"child_changed",snapshotNode:e,childName:t,oldSnap:s}}function nc(t,e){return{type:"child_moved",snapshotNode:e,childName:t}}var Ve=class t{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=f2}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return R(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return R(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:w1}hasEnd(){return this.endSet_}getIndexEndValue(){return R(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return R(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:h1}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return R(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===f2}copy(){let e=new t;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.startAfterSet_=this.startAfterSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.endBeforeSet_=this.endBeforeSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e}};function y0(t){let e={};if(t.isDefault())return e;let s;if(t.index_===f2?s="$priority":t.index_===rc?s="$value":t.index_===x1?s="$key":(R(t.index_ instanceof ze,"Unrecognized index type!"),s=t.index_.toString()),e.orderBy=a2(s),t.startSet_){let r=t.startAfterSet_?"startAfter":"startAt";e[r]=a2(t.indexStartValue_),t.startNameSet_&&(e[r]+=","+a2(t.indexStartName_))}if(t.endSet_){let r=t.endBeforeSet_?"endBefore":"endAt";e[r]=a2(t.indexEndValue_),t.endNameSet_&&(e[r]+=","+a2(t.indexEndName_))}return t.limitSet_&&(t.isViewFromLeft()?e.limitToFirst=t.limit_:e.limitToLast=t.limit_),e}function C0(t){let e={};if(t.startSet_&&(e.sp=t.indexStartValue_,t.startNameSet_&&(e.sn=t.indexStartName_),e.sin=!t.startAfterSet_),t.endSet_&&(e.ep=t.indexEndValue_,t.endNameSet_&&(e.en=t.indexEndName_),e.ein=!t.endBeforeSet_),t.limitSet_){e.l=t.limit_;let s=t.viewFrom_;s===""&&(t.isViewFromLeft()?s="l":s="r"),e.vf=s}return t.index_!==f2&&(e.i=t.index_.toString()),e}var _e=class t extends a3{reportStats(e){throw new Error("Method not implemented.")}static getListenId_(e,s){return s!==void 0?"tag$"+s:(R(e._queryParams.isDefault(),"should have a tag if it's not a default query."),e._path.toString())}constructor(e,s,r,c){super(),this.repoInfo_=e,this.onDataUpdate_=s,this.authTokenProvider_=r,this.appCheckTokenProvider_=c,this.log_=h4("p:rest:"),this.listens_={}}listen(e,s,r,c){let i=e._path.toString();this.log_("Listen called for "+i+" "+e._queryIdentifier);let a=t.getListenId_(e,r),n={};this.listens_[a]=n;let o=y0(e._queryParams);this.restRequest_(i+".json",o,(l,m)=>{let y=m;if(l===404&&(y=null,l=null),l===null&&this.onDataUpdate_(i,y,!1,r),a1(this.listens_,a)===n){let u;l?l===401?u="permission_denied":u="rest_error:"+l:u="ok",c(u,null)}})}unlisten(e,s){let r=t.getListenId_(e,s);delete this.listens_[r]}get(e){let s=y0(e._queryParams),r=e._path.toString(),c=new W3;return this.restRequest_(r+".json",s,(i,a)=>{let n=a;i===404&&(n=null,i=null),i===null?(this.onDataUpdate_(r,n,!1,null),c.resolve(n)):c.reject(new Error(n))}),c.promise}refreshAuthToken(e){}restRequest_(e,s={},r){return s.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([c,i])=>{c&&c.accessToken&&(s.auth=c.accessToken),i&&i.token&&(s.ac=i.token);let a=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+e+"?ns="+this.repoInfo_.namespace+xt(s);this.log_("Sending REST request for "+a);let n=new XMLHttpRequest;n.onreadystatechange=()=>{if(r&&n.readyState===4){this.log_("REST Response for "+a+" received. status:",n.status,"response:",n.responseText);let o=null;if(n.status>=200&&n.status<300){try{o=D4(n.responseText)}catch{g2("Failed to parse JSON response for "+a+": "+n.responseText)}r(null,o)}else n.status!==401&&n.status!==404&&g2("Got unsuccessful REST response for "+a+" Status: "+n.status),r(n.status);r=null}},n.open("GET",a,!0),n.send()})}};var Se=class{constructor(){this.rootNode_=r2.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,s){this.rootNode_=this.rootNode_.updateChild(e,s)}};function h3(){return{value:null,children:new Map}}function l8(t,e,s){if(q(e))t.value=s,t.children.clear();else if(t.value!==null)t.value=t.value.updateChild(e,s);else{let r=W(e);t.children.has(r)||t.children.set(r,h3());let c=t.children.get(r);e=e2(e),l8(c,e,s)}}function Le(t,e,s){t.value!==null?s(e,t.value):oc(t,(r,c)=>{let i=new J(e.toString()+"/"+r);Le(c,i,s)})}function oc(t,e){t.children.forEach((s,r)=>{e(r,s)})}var be=class{constructor(e){this.collection_=e,this.last_=null}get(){let e=this.collection_.get(),s=Object.assign({},e);return this.last_&&H2(this.last_,(r,c)=>{s[r]=s[r]-c}),this.last_=e,s}};var H0=10*1e3,lc=30*1e3,fc=300*1e3,xe=class{constructor(e,s){this.server_=s,this.statsToReport_={},this.statsListener_=new be(e);let r=H0+(lc-H0)*Math.random();r4(this.reportStats_.bind(this),Math.floor(r))}reportStats_(){let e=this.statsListener_.get(),s={},r=!1;H2(e,(c,i)=>{i>0&&A2(this.statsToReport_,c)&&(s[c]=i,r=!0)}),r&&this.server_.reportStats(s),r4(this.reportStats_.bind(this),Math.floor(Math.random()*2*fc))}};var G2=(function(t){return t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE",t})(G2||{});function f8(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function h8(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function u8(t){return{fromUser:!1,fromServer:!0,queryId:t,tagged:!0}}var we=class t{constructor(e,s,r){this.path=e,this.affectedTree=s,this.revert=r,this.type=G2.ACK_USER_WRITE,this.source=f8()}operationForChild(e){if(q(this.path)){if(this.affectedTree.value!=null)return R(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{let s=this.affectedTree.subtree(new J(e));return new t(Y(),s,this.revert)}}else return R(W(this.path)===e,"operationForChild called for unrelated child."),new t(e2(this.path),this.affectedTree,this.revert)}};var P1=class t{constructor(e,s,r){this.source=e,this.path=s,this.snap=r,this.type=G2.OVERWRITE}operationForChild(e){return q(this.path)?new t(this.source,Y(),this.snap.getImmediateChild(e)):new t(this.source,e2(this.path),this.snap)}};var u3=class t{constructor(e,s,r){this.source=e,this.path=s,this.children=r,this.type=G2.MERGE}operationForChild(e){if(q(this.path)){let s=this.children.subtree(new J(e));return s.isEmpty()?null:s.value?new P1(this.source,Y(),s.value):new t(this.source,Y(),s)}else return R(W(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new t(this.source,e2(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}};var n4=class{constructor(e,s,r){this.node_=e,this.fullyInitialized_=s,this.filtered_=r}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(e){if(q(e))return this.isFullyInitialized()&&!this.filtered_;let s=W(e);return this.isCompleteForChild(s)}isCompleteForChild(e){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(e)}getNode(){return this.node_}};function hc(t,e,s,r){let c=[],i=[];return e.forEach(a=>{a.type==="child_changed"&&t.index_.indexedValueChanged(a.oldSnap,a.snapshotNode)&&i.push(nc(a.childName,a.snapshotNode))}),s4(t,c,"child_removed",e,r,s),s4(t,c,"child_added",e,r,s),s4(t,c,"child_moved",i,r,s),s4(t,c,"child_changed",e,r,s),s4(t,c,"value",e,r,s),c}function s4(t,e,s,r,c,i){let a=r.filter(n=>n.type===s);a.sort((n,o)=>pc(t,n,o)),a.forEach(n=>{let o=uc(t,n,i);c.forEach(l=>{l.respondsTo(n.type)&&e.push(l.createEvent(o,t.query_))})})}function uc(t,e,s){return e.type==="value"||e.type==="child_removed"||(e.prevName=s.getPredecessorChildName(e.childName,e.snapshotNode,t.index_)),e}function pc(t,e,s){if(e.childName==null||s.childName==null)throw V1("Should only compare child_ events.");let r=new j(e.childName,e.snapshotNode),c=new j(s.childName,s.snapshotNode);return t.index_.compare(r,c)}function p8(t,e){return{eventCache:t,serverCache:e}}function i4(t,e,s,r){return p8(new n4(e,s,r),t.serverCache)}function m8(t,e,s,r){return p8(t.eventCache,new n4(e,s,r))}function Ee(t){return t.eventCache.isFullyInitialized()?t.eventCache.getNode():null}function u1(t){return t.serverCache.isFullyInitialized()?t.serverCache.getNode():null}var Z3,mc=()=>(Z3||(Z3=new C2(mr)),Z3),p2=class t{static fromObject(e){let s=new t(null);return H2(e,(r,c)=>{s=s.set(new J(r),c)}),s}constructor(e,s=mc()){this.value=e,this.children=s}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,s){if(this.value!=null&&s(this.value))return{path:Y(),value:this.value};if(q(e))return null;{let r=W(e),c=this.children.get(r);if(c!==null){let i=c.findRootMostMatchingPathAndValue(e2(e),s);return i!=null?{path:n2(new J(r),i.path),value:i.value}:null}else return null}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(e){if(q(e))return this;{let s=W(e),r=this.children.get(s);return r!==null?r.subtree(e2(e)):new t(null)}}set(e,s){if(q(e))return new t(s,this.children);{let r=W(e),i=(this.children.get(r)||new t(null)).set(e2(e),s),a=this.children.insert(r,i);return new t(this.value,a)}}remove(e){if(q(e))return this.children.isEmpty()?new t(null):new t(null,this.children);{let s=W(e),r=this.children.get(s);if(r){let c=r.remove(e2(e)),i;return c.isEmpty()?i=this.children.remove(s):i=this.children.insert(s,c),this.value===null&&i.isEmpty()?new t(null):new t(this.value,i)}else return this}}get(e){if(q(e))return this.value;{let s=W(e),r=this.children.get(s);return r?r.get(e2(e)):null}}setTree(e,s){if(q(e))return s;{let r=W(e),i=(this.children.get(r)||new t(null)).setTree(e2(e),s),a;return i.isEmpty()?a=this.children.remove(r):a=this.children.insert(r,i),new t(this.value,a)}}fold(e){return this.fold_(Y(),e)}fold_(e,s){let r={};return this.children.inorderTraversal((c,i)=>{r[c]=i.fold_(n2(e,c),s)}),s(e,this.value,r)}findOnPath(e,s){return this.findOnPath_(e,Y(),s)}findOnPath_(e,s,r){let c=this.value?r(s,this.value):!1;if(c)return c;if(q(e))return null;{let i=W(e),a=this.children.get(i);return a?a.findOnPath_(e2(e),n2(s,i),r):null}}foreachOnPath(e,s){return this.foreachOnPath_(e,Y(),s)}foreachOnPath_(e,s,r){if(q(e))return this;{this.value&&r(s,this.value);let c=W(e),i=this.children.get(c);return i?i.foreachOnPath_(e2(e),n2(s,c),r):new t(null)}}foreach(e){this.foreach_(Y(),e)}foreach_(e,s){this.children.inorderTraversal((r,c)=>{c.foreach_(n2(e,r),s)}),this.value&&s(e,this.value)}foreachChild(e){this.children.inorderTraversal((s,r)=>{r.value&&e(s,r.value)})}};var b2=class t{constructor(e){this.writeTree_=e}static empty(){return new t(new p2(null))}};function a4(t,e,s){if(q(e))return new b2(new p2(s));{let r=t.writeTree_.findRootMostValueAndPath(e);if(r!=null){let c=r.path,i=r.value,a=y2(c,e);return i=i.updateChild(a,s),new b2(t.writeTree_.set(c,i))}else{let c=new p2(s),i=t.writeTree_.setTree(e,c);return new b2(i)}}}function z0(t,e,s){let r=t;return H2(s,(c,i)=>{r=a4(r,n2(e,c),i)}),r}function M0(t,e){if(q(e))return b2.empty();{let s=t.writeTree_.setTree(e,new p2(null));return new b2(s)}}function Te(t,e){return p1(t,e)!=null}function p1(t,e){let s=t.writeTree_.findRootMostValueAndPath(e);return s!=null?t.writeTree_.get(s.path).getChild(y2(s.path,e)):null}function V0(t){let e=[],s=t.writeTree_.value;return s!=null?s.isLeafNode()||s.forEachChild(f2,(r,c)=>{e.push(new j(r,c))}):t.writeTree_.children.inorderTraversal((r,c)=>{c.value!=null&&e.push(new j(r,c.value))}),e}function e1(t,e){if(q(e))return t;{let s=p1(t,e);return s!=null?new b2(new p2(s)):new b2(t.writeTree_.subtree(e))}}function ke(t){return t.writeTree_.isEmpty()}function A1(t,e){return d8(Y(),t.writeTree_,e)}function d8(t,e,s){if(e.value!=null)return s.updateChild(t,e.value);{let r=null;return e.children.inorderTraversal((c,i)=>{c===".priority"?(R(i.value!==null,"Priority writes must always be leaf nodes"),r=i.value):s=d8(n2(t,c),i,s)}),!s.getChild(t).isEmpty()&&r!==null&&(s=s.updateChild(n2(t,".priority"),r)),s}}function v8(t,e){return z8(e,t)}function dc(t,e,s,r,c){R(r>t.lastWriteId,"Stacking an older write on top of newer ones"),c===void 0&&(c=!0),t.allWrites.push({path:e,snap:s,writeId:r,visible:c}),c&&(t.visibleWrites=a4(t.visibleWrites,e,s)),t.lastWriteId=r}function vc(t,e){for(let s=0;sn.writeId===e);R(s>=0,"removeWrite called with nonexistent writeId.");let r=t.allWrites[s];t.allWrites.splice(s,1);let c=r.visible,i=!1,a=t.allWrites.length-1;for(;c&&a>=0;){let n=t.allWrites[a];n.visible&&(a>=s&&yc(n,r.path)?c=!1:L2(r.path,n.path)&&(i=!0)),a--}if(c){if(i)return Cc(t),!0;if(r.snap)t.visibleWrites=M0(t.visibleWrites,r.path);else{let n=r.children;H2(n,o=>{t.visibleWrites=M0(t.visibleWrites,n2(r.path,o))})}return!0}else return!1}function yc(t,e){if(t.snap)return L2(t.path,e);for(let s in t.children)if(t.children.hasOwnProperty(s)&&L2(n2(t.path,s),e))return!0;return!1}function Cc(t){t.visibleWrites=g8(t.allWrites,Hc,Y()),t.allWrites.length>0?t.lastWriteId=t.allWrites[t.allWrites.length-1].writeId:t.lastWriteId=-1}function Hc(t){return t.visible}function g8(t,e,s){let r=b2.empty();for(let c=0;c{r=r.updateImmediateChild(i,a)}),r;if(s){let i=e1(t.visibleWrites,e);return s.forEachChild(f2,(a,n)=>{let o=A1(e1(i,new J(a)),n);r=r.updateImmediateChild(a,o)}),V0(i).forEach(a=>{r=r.updateImmediateChild(a.name,a.node)}),r}else{let i=e1(t.visibleWrites,e);return V0(i).forEach(a=>{r=r.updateImmediateChild(a.name,a.node)}),r}}function Mc(t,e,s,r,c){R(r||c,"Either existingEventSnap or existingServerSnap must exist");let i=n2(e,s);if(Te(t.visibleWrites,i))return null;{let a=e1(t.visibleWrites,i);return ke(a)?c.getChild(s):A1(a,c.getChild(s))}}function Vc(t,e,s,r){let c=n2(e,s),i=p1(t.visibleWrites,c);if(i!=null)return i;if(r.isCompleteForChild(s)){let a=e1(t.visibleWrites,c);return A1(a,r.getNode().getImmediateChild(s))}else return null}function _c(t,e){return p1(t.visibleWrites,e)}function Sc(t,e,s,r,c,i,a){let n,o=e1(t.visibleWrites,e),l=p1(o,Y());if(l!=null)n=l;else if(s!=null)n=A1(o,s);else return[];if(n=n.withIndex(a),!n.isEmpty()&&!n.isLeafNode()){let m=[],y=a.getCompare(),u=i?n.getReverseIteratorFrom(r,a):n.getIteratorFrom(r,a),C=u.getNext();for(;C&&m.length0||!t.eventCache.isFullyInitialized()||c&&!r.getNode().equals(i)||!r.getNode().getPriority().equals(i.getPriority()))&&s.push(cc(Ee(e)))}}function V8(t,e,s,r,c,i){let a=e.eventCache;if(p3(r,s)!=null)return e;{let n,o;if(q(s))if(R(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()){let l=u1(e),m=l instanceof r2?l:r2.EMPTY_NODE,y=C8(r,m);n=t.filter.updateFullNode(e.eventCache.getNode(),y,i)}else{let l=Pe(r,u1(e));n=t.filter.updateFullNode(e.eventCache.getNode(),l,i)}else{let l=W(s);if(l===".priority"){R(t1(s)===1,"Can't have a priority with additional path components");let m=a.getNode();o=e.serverCache.getNode();let y=_0(r,s,m,o);y!=null?n=t.filter.updatePriority(m,y):n=a.getNode()}else{let m=e2(s),y;if(a.isCompleteForChild(l)){o=e.serverCache.getNode();let u=_0(r,s,a.getNode(),o);u!=null?y=a.getNode().getImmediateChild(l).updateChild(m,u):y=a.getNode().getImmediateChild(l)}else y=Xe(r,l,e.serverCache);y!=null?n=t.filter.updateChild(a.getNode(),l,y,m,c,i):n=a.getNode()}}return i4(e,n,a.isFullyInitialized()||q(s),t.filter.filtersNodes())}}function m3(t,e,s,r,c,i,a,n){let o=e.serverCache,l,m=a?t.filter:t.filter.getIndexedFilter();if(q(s))l=m.updateFullNode(o.getNode(),r,null);else if(m.filtersNodes()&&!o.isFiltered()){let C=o.getNode().updateChild(s,r);l=m.updateFullNode(o.getNode(),C,null)}else{let C=W(s);if(!o.isCompleteForPath(s)&&t1(s)>1)return e;let v=e2(s),V=o.getNode().getImmediateChild(C).updateChild(v,r);C===".priority"?l=m.updatePriority(o.getNode(),V):l=m.updateChild(o.getNode(),C,V,v,M8,null)}let y=m8(e,l,o.isFullyInitialized()||q(s),m.filtersNodes()),u=new o4(c,y,i);return V8(t,y,s,c,u,n)}function Ie(t,e,s,r,c,i,a){let n=e.eventCache,o,l,m=new o4(c,e,i);if(q(s))l=t.filter.updateFullNode(e.eventCache.getNode(),r,a),o=i4(e,l,!0,t.filter.filtersNodes());else{let y=W(s);if(y===".priority")l=t.filter.updatePriority(e.eventCache.getNode(),r),o=i4(e,l,n.isFullyInitialized(),n.isFiltered());else{let u=e2(s),C=n.getNode().getImmediateChild(y),v;if(q(u))v=r;else{let g=m.getCompleteChild(y);g!=null?e8(u)===".priority"&&g.getChild(s8(u)).isEmpty()?v=g:v=g.updateChild(u,r):v=r2.EMPTY_NODE}if(C.equals(v))o=e;else{let g=t.filter.updateChild(n.getNode(),y,v,u,m,a);o=i4(e,g,n.isFullyInitialized(),t.filter.filtersNodes())}}}return o}function S0(t,e){return t.eventCache.isCompleteForChild(e)}function Tc(t,e,s,r,c,i,a){let n=e;return r.foreach((o,l)=>{let m=n2(s,o);S0(e,W(m))&&(n=Ie(t,n,m,l,c,i,a))}),r.foreach((o,l)=>{let m=n2(s,o);S0(e,W(m))||(n=Ie(t,n,m,l,c,i,a))}),n}function L0(t,e,s){return s.foreach((r,c)=>{e=e.updateChild(r,c)}),e}function Fe(t,e,s,r,c,i,a,n){if(e.serverCache.getNode().isEmpty()&&!e.serverCache.isFullyInitialized())return e;let o=e,l;q(s)?l=r:l=new p2(null).setTree(s,r);let m=e.serverCache.getNode();return l.children.inorderTraversal((y,u)=>{if(m.hasChild(y)){let C=e.serverCache.getNode().getImmediateChild(y),v=L0(t,C,u);o=m3(t,o,new J(y),v,c,i,a,n)}}),l.children.inorderTraversal((y,u)=>{let C=!e.serverCache.isCompleteForChild(y)&&u.value===null;if(!m.hasChild(y)&&!C){let v=e.serverCache.getNode().getImmediateChild(y),g=L0(t,v,u);o=m3(t,o,new J(y),g,c,i,a,n)}}),o}function kc(t,e,s,r,c,i,a){if(p3(c,s)!=null)return e;let n=e.serverCache.isFiltered(),o=e.serverCache;if(r.value!=null){if(q(s)&&o.isFullyInitialized()||o.isCompleteForPath(s))return m3(t,e,s,o.getNode().getChild(s),c,i,n,a);if(q(s)){let l=new p2(null);return o.getNode().forEachChild(x1,(m,y)=>{l=l.set(new J(m),y)}),Fe(t,e,s,l,c,i,n,a)}else return e}else{let l=new p2(null);return r.foreach((m,y)=>{let u=n2(s,m);o.isCompleteForPath(u)&&(l=l.set(m,o.getNode().getChild(u)))}),Fe(t,e,s,l,c,i,n,a)}}function Pc(t,e,s,r,c){let i=e.serverCache,a=m8(e,i.getNode(),i.isFullyInitialized()||q(s),i.isFiltered());return V8(t,a,s,r,M8,c)}function Ac(t,e,s,r,c,i){let a;if(p3(r,s)!=null)return e;{let n=new o4(r,e,c),o=e.eventCache.getNode(),l;if(q(s)||W(s)===".priority"){let m;if(e.serverCache.isFullyInitialized())m=Pe(r,u1(e));else{let y=e.serverCache.getNode();R(y instanceof r2,"serverChildren would be complete if leaf node"),m=C8(r,y)}m=m,l=t.filter.updateFullNode(o,m,i)}else{let m=W(s),y=Xe(r,m,e.serverCache);y==null&&e.serverCache.isCompleteForChild(m)&&(y=o.getImmediateChild(m)),y!=null?l=t.filter.updateChild(o,m,y,e2(s),n,i):e.eventCache.getNode().hasChild(m)?l=t.filter.updateChild(o,m,r2.EMPTY_NODE,e2(s),n,i):l=o,l.isEmpty()&&e.serverCache.isFullyInitialized()&&(a=Pe(r,u1(e)),a.isLeafNode()&&(l=t.filter.updateFullNode(l,a,i)))}return a=e.serverCache.isFullyInitialized()||p3(r,Y())!=null,i4(e,l,a,t.filter.filtersNodes())}}function Nc(t,e){let s=u1(t.viewCache_);return s&&(t.query._queryParams.loadsAllData()||!q(e)&&!s.getImmediateChild(W(e)).isEmpty())?s.getChild(e):null}function b0(t,e,s,r){e.type===G2.MERGE&&e.source.queryId!==null&&(R(u1(t.viewCache_),"We should always have a full cache before handling merges"),R(Ee(t.viewCache_),"Missing event cache, even though we have a server cache"));let c=t.viewCache_,i=wc(t.processor_,c,e,s,r);return xc(t.processor_,i.viewCache),R(i.viewCache.serverCache.isFullyInitialized()||!c.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),t.viewCache_=i.viewCache,Ic(t,i.changes,i.viewCache.eventCache.getNode(),null)}function Ic(t,e,s,r){let c=r?[r]:t.eventRegistrations_;return hc(t.eventGenerator_,e,s,c)}var x0;function Fc(t){R(!x0,"__referenceConstructor has already been defined"),x0=t}function Je(t,e,s,r){let c=e.source.queryId;if(c!==null){let i=t.views.get(c);return R(i!=null,"SyncTree gave us an op for an invalid query."),b0(i,e,s,r)}else{let i=[];for(let a of t.views.values())i=i.concat(b0(a,e,s,r));return i}}function Ze(t,e){let s=null;for(let r of t.views.values())s=s||Nc(r,e);return s}var w0;function Rc(t){R(!w0,"__referenceConstructor has already been defined"),w0=t}var d3=class{constructor(e){this.listenProvider_=e,this.syncPointTree_=new p2(null),this.pendingWriteTree_=Lc(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}};function Dc(t,e,s,r,c){return dc(t.pendingWriteTree_,e,s,r,c),c?g3(t,new P1(f8(),e,s)):[]}function L1(t,e,s=!1){let r=vc(t.pendingWriteTree_,e);if(gc(t.pendingWriteTree_,e)){let i=new p2(null);return r.snap!=null?i=i.set(Y(),!0):H2(r.children,a=>{i=i.set(new J(a),!0)}),g3(t,new we(r.path,i,s))}else return[]}function v3(t,e,s){return g3(t,new P1(h8(),e,s))}function Bc(t,e,s){let r=p2.fromObject(s);return g3(t,new u3(h8(),e,r))}function Oc(t,e,s,r){let c=b8(t,r);if(c!=null){let i=x8(c),a=i.path,n=i.queryId,o=y2(a,e),l=new P1(u8(n),o,s);return w8(t,a,l)}else return[]}function Gc(t,e,s,r){let c=b8(t,r);if(c){let i=x8(c),a=i.path,n=i.queryId,o=y2(a,e),l=p2.fromObject(s),m=new u3(u8(n),o,l);return w8(t,a,m)}else return[]}function _8(t,e,s){let c=t.pendingWriteTree_,i=t.syncPointTree_.findOnPath(e,(a,n)=>{let o=y2(a,e),l=Ze(n,o);if(l)return l});return y8(c,e,i,s,!0)}function g3(t,e){return S8(e,t.syncPointTree_,null,v8(t.pendingWriteTree_,Y()))}function S8(t,e,s,r){if(q(t.path))return L8(t,e,s,r);{let c=e.get(Y());s==null&&c!=null&&(s=Ze(c,Y()));let i=[],a=W(t.path),n=t.operationForChild(a),o=e.children.get(a);if(o&&n){let l=s?s.getImmediateChild(a):null,m=H8(r,a);i=i.concat(S8(n,o,l,m))}return c&&(i=i.concat(Je(c,t,r,s))),i}}function L8(t,e,s,r){let c=e.get(Y());s==null&&c!=null&&(s=Ze(c,Y()));let i=[];return e.children.inorderTraversal((a,n)=>{let o=s?s.getImmediateChild(a):null,l=H8(r,a),m=t.operationForChild(a);m&&(i=i.concat(L8(m,n,o,l)))}),c&&(i=i.concat(Je(c,t,r,s))),i}function b8(t,e){return t.tagToQueryMap.get(e)}function x8(t){let e=t.indexOf("$");return R(e!==-1&&e{let l=e6(o,e.getImmediateChild(n),s);l!==o&&(i=i.updateImmediateChild(n,l))}),i}}var l4=class{constructor(e="",s=null,r={children:{},childCount:0}){this.name=e,this.parent=s,this.node=r}};function t6(t,e){let s=e instanceof J?e:new J(e),r=t,c=W(s);for(;c!==null;){let i=a1(r.node.children,c)||{children:{},childCount:0};r=new l4(c,r,i),s=e2(s),c=W(s)}return r}function F1(t){return t.node.value}function E8(t,e){t.node.value=e,Be(t)}function T8(t){return t.node.childCount>0}function Kc(t){return F1(t)===void 0&&!T8(t)}function y3(t,e){H2(t.node.children,(s,r)=>{e(new l4(s,t,r))})}function k8(t,e,s,r){s&&!r&&e(t),y3(t,c=>{k8(c,e,!0,r)}),s&&r&&e(t)}function Qc(t,e,s){let r=s?t:t.parent;for(;r!==null;){if(e(r))return!0;r=r.parent}return!1}function m4(t){return new J(t.parent===null?t.name:m4(t.parent)+"/"+t.name)}function Be(t){t.parent!==null&&Yc(t.parent,t.name,t)}function Yc(t,e,s){let r=Kc(s),c=A2(t.node.children,e);r&&c?(delete t.node.children[e],t.node.childCount--,Be(t)):!r&&!c&&(t.node.children[e]=s.node,t.node.childCount++,Be(t))}var Xc=/[\[\].#$\/\u0000-\u001F\u007F]/,Jc=/[\[\].#$\u0000-\u001F\u007F]/,ee=10*1024*1024,P8=function(t){return typeof t=="string"&&t.length!==0&&!Xc.test(t)},Zc=function(t){return typeof t=="string"&&t.length!==0&&!Jc.test(t)},e5=function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),Zc(t)};var A8=function(t,e,s){let r=s instanceof J?new me(s,t):s;if(e===void 0)throw new Error(t+"contains undefined "+o1(r));if(typeof e=="function")throw new Error(t+"contains a function "+o1(r)+" with contents = "+e.toString());if(I0(e))throw new Error(t+"contains "+e.toString()+" "+o1(r));if(typeof e=="string"&&e.length>ee/3&&Q1(e)>ee)throw new Error(t+"contains a string greater than "+ee+" utf8 bytes "+o1(r)+" ('"+e.substring(0,50)+"...')");if(e&&typeof e=="object"){let c=!1,i=!1;if(H2(e,(a,n)=>{if(a===".value")c=!0;else if(a!==".priority"&&a!==".sv"&&(i=!0,!P8(a)))throw new Error(t+" contains an invalid key ("+a+") "+o1(r)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);Wr(r,a),A8(t,n,r),jr(r)}),c&&i)throw new Error(t+' contains ".value" child '+o1(r)+" in addition to actual children.")}};var t5=function(t,e){let s=e.path.toString();if(typeof e.repoInfo.host!="string"||e.repoInfo.host.length===0||!P8(e.repoInfo.namespace)&&e.repoInfo.host.split(":")[0]!=="localhost"||s.length!==0&&!e5(s))throw new Error(Et(t,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};var Oe=class{constructor(){this.eventLists_=[],this.recursionDepth_=0}};function s5(t,e){let s=null;for(let r=0;rL2(r,e)||L2(e,r))}function r5(t,e){t.recursionDepth_++;let s=!0;for(let r=0;r{T0(t,r,c,i,a)},t.authTokenProvider_,t.appCheckProvider_),setTimeout(()=>k0(t,!0),0);else{if(typeof s<"u"&&s!==null){if(typeof s!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{a2(s)}catch(r){throw new Error("Invalid authOverride provided: "+r)}}t.persistentConnection_=new Qe(t.repoInfo_,e,(r,c,i,a)=>{T0(t,r,c,i,a)},r=>{k0(t,r)},r=>{l5(t,r)},t.authTokenProvider_,t.appCheckProvider_,s),t.server_=t.persistentConnection_}t.authTokenProvider_.addTokenChangeListener(r=>{t.server_.refreshAuthToken(r)}),t.appCheckProvider_.addTokenChangeListener(r=>{t.server_.refreshAppCheckToken(r.token)}),t.statsReporter_=Mr(t.repoInfo_,()=>new xe(t.stats_,t.server_)),t.infoData_=new Se,t.infoSyncTree_=new d3({startListening:(r,c,i,a)=>{let n=[],o=t.infoData_.getNode(r._path);return o.isEmpty()||(n=v3(t.infoSyncTree_,r._path,o),setTimeout(()=>{a("ok")},0)),n},stopListening:()=>{}}),s6(t,"connected",!1),t.serverSyncTree_=new d3({startListening:(r,c,i,a)=>(t.server_.listen(r,i,c,(n,o)=>{let l=a(n,o);m1(t.eventQueue_,r._path,l)}),[]),stopListening:(r,c)=>{t.server_.unlisten(r,c)}})}function o5(t){let s=t.infoData_.getNode(new J(".info/serverTimeOffset")).val()||0;return new Date().getTime()+s}function N8(t){return Uc({timestamp:o5(t)})}function T0(t,e,s,r,c){t.dataUpdateCount++;let i=new J(e);s=t.interceptServerDataCallback_?t.interceptServerDataCallback_(e,s):s;let a=[];if(c)if(r){let o=K1(s,l=>l2(l));a=Gc(t.serverSyncTree_,i,o,c)}else{let o=l2(s);a=Oc(t.serverSyncTree_,i,o,c)}else if(r){let o=K1(s,l=>l2(l));a=Bc(t.serverSyncTree_,i,o)}else{let o=l2(s);a=v3(t.serverSyncTree_,i,o)}let n=i;a.length>0&&(n=c6(t,i)),m1(t.eventQueue_,n,a)}function k0(t,e){s6(t,"connected",e),e===!1&&h5(t)}function l5(t,e){H2(e,(s,r)=>{s6(t,s,r)})}function s6(t,e,s){let r=new J("/.info/"+e),c=l2(s);t.infoData_.updateSnapshot(r,c);let i=v3(t.infoSyncTree_,r,c);m1(t.eventQueue_,r,i)}function f5(t){return t.nextWriteId_++}function h5(t){I8(t,"onDisconnectEvents");let e=N8(t),s=h3();Le(t.onDisconnect_,Y(),(c,i)=>{let a=jc(c,i,t.serverSyncTree_,e);l8(s,c,a)});let r=[];Le(s,Y(),(c,i)=>{r=r.concat(v3(t.serverSyncTree_,c,i));let a=d5(t,c);c6(t,a)}),t.onDisconnect_=h3(),m1(t.eventQueue_,Y(),r)}function u5(t){t.persistentConnection_&&t.persistentConnection_.interrupt(i5)}function I8(t,...e){let s="";t.persistentConnection_&&(s=t.persistentConnection_.id+":"),o2(s,...e)}function F8(t,e,s){return _8(t.serverSyncTree_,e,s)||r2.EMPTY_NODE}function r6(t,e=t.transactionQueueTree_){if(e||C3(t,e),F1(e)){let s=D8(t,e);R(s.length>0,"Sending zero length transaction queue"),s.every(c=>c.status===0)&&p5(t,m4(e),s)}else T8(e)&&y3(e,s=>{r6(t,s)})}function p5(t,e,s){let r=s.map(l=>l.currentWriteId),c=F8(t,e,r),i=c,a=c.hash();for(let l=0;l{I8(t,"transaction put response",{path:o.toString(),status:l});let m=[];if(l==="ok"){let y=[];for(let u=0;us[u].onComplete(null,!0,s[u].currentOutputSnapshotResolved)),s[u].unwatcher();C3(t,t6(t.transactionQueueTree_,e)),r6(t,t.transactionQueueTree_),m1(t.eventQueue_,e,m);for(let u=0;un.status===0).map(n=>n.currentWriteId);for(let n=0;n=a5)m=!0,y="maxretry",c=c.concat(L1(t.serverSyncTree_,o.currentWriteId,!0));else{let u=F8(t,o.path,a);o.currentInputSnapshot=u;let C=e[n].update(u.val());if(C!==void 0){A8("transaction failed: Data returned ",C,o.path);let v=l2(C);typeof C=="object"&&C!=null&&A2(C,".priority")||(v=v.updatePriority(u.getPriority()));let V=o.currentWriteId,f=N8(t),d=$c(v,u,f);o.currentOutputSnapshotRaw=v,o.currentOutputSnapshotResolved=d,o.currentWriteId=f5(t),a.splice(a.indexOf(V),1),c=c.concat(Dc(t.serverSyncTree_,o.path,d,o.currentWriteId,o.applyLocally)),c=c.concat(L1(t.serverSyncTree_,V,!0))}else m=!0,y="nodata",c=c.concat(L1(t.serverSyncTree_,o.currentWriteId,!0))}m1(t.eventQueue_,s,c),c=[],m&&(e[n].status=2,(function(u){setTimeout(u,Math.floor(0))})(e[n].unwatcher),e[n].onComplete&&(y==="nodata"?r.push(()=>e[n].onComplete(null,!1,e[n].currentInputSnapshot)):r.push(()=>e[n].onComplete(new Error(y),!1,null))))}C3(t,t.transactionQueueTree_);for(let n=0;nr.order-c.order),s}function B8(t,e,s){let r=F1(e);if(r)for(let c=0;c{B8(t,c,s)})}function C3(t,e){let s=F1(e);if(s){let r=0;for(let c=0;c0?s:void 0)}y3(e,r=>{C3(t,r)})}function d5(t,e){let s=m4(R8(t,e)),r=t6(t.transactionQueueTree_,e);return Qc(r,c=>{te(t,c)}),te(t,r),k8(r,c=>{te(t,c)}),s}function te(t,e){let s=F1(e);if(s){let r=[],c=[],i=-1;for(let a=0;a0){let c=s[r];try{c=decodeURIComponent(c.replace(/\+/g," "))}catch{}e+="/"+c}return e}function g5(t){let e={};t.charAt(0)==="?"&&(t=t.substring(1));for(let s of t.split("&")){if(s.length===0)continue;let r=s.split("=");r.length===2?e[decodeURIComponent(r[0])]=decodeURIComponent(r[1]):g2(`Invalid query segment '${s}' in query '${t}'`)}return e}var P0=function(t,e){let s=y5(t),r=s.namespace;s.domain==="firebase.com"&&U2(s.host+" is no longer supported. Please use .firebaseio.com instead"),(!r||r==="undefined")&&s.domain!=="localhost"&&U2("Cannot parse Firebase url. Please use https://.firebaseio.com"),s.secure||ur();let c=s.scheme==="ws"||s.scheme==="wss";return{repoInfo:new c3(s.host,s.secure,r,c,e,"",r!==s.subdomain),path:new J(s.pathString)}},y5=function(t){let e="",s="",r="",c="",i="",a=!0,n="https",o=443;if(typeof t=="string"){let l=t.indexOf("//");l>=0&&(n=t.substring(0,l-1),t=t.substring(l+2));let m=t.indexOf("/");m===-1&&(m=t.length);let y=t.indexOf("?");y===-1&&(y=t.length),e=t.substring(0,Math.min(m,y)),m=0?(a=n==="https"||n==="wss",o=parseInt(e.substring(l+1),10)):l=e.length;let C=e.slice(0,l);if(C.toLowerCase()==="localhost")s="localhost";else if(C.split(".").length<=2)s=C;else{let v=e.indexOf(".");r=e.substring(0,v).toLowerCase(),s=e.substring(v+1),i=r}"ns"in u&&(i=u.ns)}return{host:e,port:o,domain:s,subdomain:r,secure:a,scheme:n,pathString:c,namespace:i}};var Ue=class t{constructor(e,s,r,c){this._repo=e,this._path=s,this._queryParams=r,this._orderByCalled=c}get key(){return q(this._path)?null:e8(this._path)}get ref(){return new N1(this._repo,this._path)}get _queryIdentifier(){let e=C0(this._queryParams),s=$e(e);return s==="{}"?"default":s}get _queryObject(){return C0(this._queryParams)}isEqual(e){if(e=Y1(e),!(e instanceof t))return!1;let s=this._repo===e._repo,r=r8(this._path,e._path),c=this._queryIdentifier===e._queryIdentifier;return s&&r&&c}toJSON(){return this.toString()}toString(){return this._repo.toString()+qr(this._path)}};var N1=class t extends Ue{constructor(e,s){super(e,s,new Ve,!1)}get parent(){let e=s8(this._path);return e===null?null:new t(this._repo,e)}get root(){let e=this;for(;e.parent!==null;)e=e.parent;return e}};Fc(N1);Rc(N1);var C5="FIREBASE_DATABASE_EMULATOR_HOST",qe={},H5=!1;function z5(t,e,s,r){let c=e.lastIndexOf(":"),i=e.substring(0,c),a=$1(i);t.repoInfo_=new c3(e,a,t.repoInfo_.namespace,t.repoInfo_.webSocketOnly,t.repoInfo_.nodeAdmin,t.repoInfo_.persistenceKey,t.repoInfo_.includeNamespaceInQueryParams,!0,s),r&&(t.authTokenProvider_=r)}function M5(t,e,s,r,c){let i=r||t.options.databaseURL;i===void 0&&(t.options.projectId||U2("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),o2("Using default host for project ",t.options.projectId),i=`${t.options.projectId}-default-rtdb.firebaseio.com`);let a=P0(i,c),n=a.repoInfo,o,l;typeof process<"u"&&process.env&&(l=process.env[C5]),l?(o=!0,i=`http://${l}?ns=${n.namespace}`,a=P0(i,c),n=a.repoInfo):o=!a.repoInfo.secure;let m=c&&o?new c4(c4.OWNER):new ne(t.name,t.options,e);t5("Invalid Firebase Database URL",a),q(a.path)||U2("Database URL must point to the root of a Firebase Database (not including a child path).");let y=_5(n,t,m,new ae(t,s));return new We(y,t)}function V5(t,e){let s=qe[e];(!s||s[t.key]!==t)&&U2(`Database ${e}(${t.repoInfo_}) has already been deleted.`),u5(t),delete s[t.key]}function _5(t,e,s,r){let c=qe[e.name];c||(c={},qe[e.name]=c);let i=c[t.toURLString()];return i&&U2("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),i=new Ge(t,H5,s,r),c[t.toURLString()]=i,i}var We=class{constructor(e,s){this._repoInternal=e,this.app=s,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(n5(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new N1(this._repo,Y())),this._rootInternal}_delete(){return this._rootInternal!==null&&(V5(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(e){this._rootInternal===null&&U2("Cannot call "+e+" on a deleted database.")}};function i6(t=W4(),e){let s=G4(t,"database").getImmediate({identifier:e});if(!s._instanceStarted){let r=N4("database");r&&O8(s,...r)}return s}function O8(t,e,s,r={}){t=Y1(t),t._checkNotDeleted("useEmulator");let c=`${e}:${s}`,i=t._repoInternal;if(t._instanceStarted){if(c===t._repoInternal.repoInfo_.host&&bt(r,i.repoInfo_.emulatorOptions))return;U2("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}let a;if(i.repoInfo_.nodeAdmin)r.mockUserToken&&U2('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),a=new c4(c4.OWNER);else if(r.mockUserToken){let n=typeof r.mockUserToken=="string"?r.mockUserToken:F4(r.mockUserToken,t.app.options.projectId);a=new c4(n)}$1(e)&&(I4(e),R4("Database",!0)),z5(i,c,r,a)}function S5(t){lr(q4),O4(new B4("database",(e,{instanceIdentifier:s})=>{let r=e.getProvider("app").getImmediate(),c=e.getProvider("auth-internal"),i=e.getProvider("app-check-internal");return M5(r,c,i,s)},"PUBLIC").setMultipleInstances(!0)),N2(t0,s0,t),N2(t0,s0,"esm2017")}Qe.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)};Qe.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};S5();var d4=class{constructor(e){return e}},G8="database",a6=class{constructor(){return K4(G8)}};var n6=new b4("angularfire2.database-instances");function b5(t,e){let s=$4(G8,t,e);return s&&new d4(s)}function x5(t){return(e,s)=>{let r=e.runOutsideAngular(()=>t(s));return new d4(r)}}var w5={provide:a6,deps:[[new T2,n6]]},E5={provide:d4,useFactory:b5,deps:[[new T2,n6],Y4]};function U8(t,...e){return N2("angularfire",j4.full,"rtdb"),w4([E5,w5,{provide:n6,useFactory:x5(t),multi:!0,deps:[M1,E4,Q4,X4,[new T2,Z4],[new T2,J4],...e]}])}var Q8="firebasestorage.googleapis.com",T5="storageBucket",k5=120*1e3,P5=600*1e3;var I2=class t extends _t{constructor(e,s,r=0){super(o6(e),`Firebase Storage: ${s} (${o6(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,t.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return o6(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage} ${this.customData.serverResponse}`:this.message=this._baseMessage}},W2=(function(t){return t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment",t})(W2||{});function o6(t){return"storage/"+t}function A5(){let t="An unknown error occurred, please check the error payload for server response.";return new I2(W2.UNKNOWN,t)}function N5(){return new I2(W2.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function I5(){return new I2(W2.CANCELED,"User canceled the upload/download.")}function F5(t){return new I2(W2.INVALID_URL,"Invalid URL '"+t+"'.")}function R5(t){return new I2(W2.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function q8(t){return new I2(W2.INVALID_ARGUMENT,t)}function Y8(){return new I2(W2.APP_DELETED,"The Firebase app was deleted.")}function D5(t){return new I2(W2.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}var q2=class t{constructor(e,s){this.bucket=e,this.path_=s}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){let e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,s){let r;try{r=t.makeFromUrl(e,s)}catch{return new t(e,"")}if(r.path==="")return r;throw R5(e)}static makeFromUrl(e,s){let r=null,c="([A-Za-z0-9.\\-_]+)";function i(h){h.path.charAt(h.path.length-1)==="/"&&(h.path_=h.path_.slice(0,-1))}let a="(/(.*))?$",n=new RegExp("^gs://"+c+a,"i"),o={bucket:1,path:3};function l(h){h.path_=decodeURIComponent(h.path)}let m="v[A-Za-z0-9_]+",y=s.replace(/[.]/g,"\\."),u="(/([^?#]*).*)?$",C=new RegExp(`^https?://${y}/${m}/b/${c}/o${u}`,"i"),v={bucket:1,path:3},g=s===Q8?"(?:storage.googleapis.com|storage.cloud.google.com)":s,V="([^?#]*)",f=new RegExp(`^https?://${g}/${c}/${V}`,"i"),p=[{regex:n,indices:o,postModify:i},{regex:C,indices:v,postModify:l},{regex:f,indices:{bucket:1,path:2},postModify:l}];for(let h=0;h{c=null,t(C,o())},V)}function u(){i&&clearTimeout(i)}function C(V,...f){if(l){u();return}if(V){u(),m.call(null,V,...f);return}if(o()||a){u(),m.call(null,V,...f);return}r<64&&(r*=2);let p;n===1?(n=2,p=0):p=(r+Math.random())*1e3,y(p)}let v=!1;function g(V){v||(v=!0,u(),!l&&(c!==null?(V||(n=2),clearTimeout(c),y(0)):V||(n=1)))}return y(0),i=setTimeout(()=>{a=!0,g(!0)},s),g}function O5(t){t(!1)}function G5(t){return t!==void 0}function W8(t,e,s,r){if(rs)throw q8(`Invalid value for '${t}'. Expected ${s} or less.`)}function U5(t){let e=encodeURIComponent,s="?";for(let r in t)if(t.hasOwnProperty(r)){let c=e(r)+"="+e(t[r]);s=s+c+"&"}return s=s.slice(0,-1),s}var f6=(function(t){return t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT",t})(f6||{});function q5(t,e){let s=t>=500&&t<600,c=[408,429].indexOf(t)!==-1,i=e.indexOf(t)!==-1;return s||c||i}var h6=class{constructor(e,s,r,c,i,a,n,o,l,m,y,u=!0,C=!1){this.url_=e,this.method_=s,this.headers_=r,this.body_=c,this.successCodes_=i,this.additionalRetryCodes_=a,this.callback_=n,this.errorCallback_=o,this.timeout_=l,this.progressCallback_=m,this.connectionFactory_=y,this.retry=u,this.isUsingEmulator=C,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((v,g)=>{this.resolve_=v,this.reject_=g,this.start_()})}start_(){let e=(r,c)=>{if(c){r(!1,new R1(!1,null,!0));return}let i=this.connectionFactory_();this.pendingConnection_=i;let a=n=>{let o=n.loaded,l=n.lengthComputable?n.total:-1;this.progressCallback_!==null&&this.progressCallback_(o,l)};this.progressCallback_!==null&&i.addUploadProgressListener(a),i.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(a),this.pendingConnection_=null;let n=i.getErrorCode()===f6.NO_ERROR,o=i.getStatus();if(!n||q5(o,this.additionalRetryCodes_)&&this.retry){let m=i.getErrorCode()===f6.ABORT;r(!1,new R1(!1,null,m));return}let l=this.successCodes_.indexOf(o)!==-1;r(!0,new R1(l,i))})},s=(r,c)=>{let i=this.resolve_,a=this.reject_,n=c.connection;if(c.wasSuccessCode)try{let o=this.callback_(n,n.getResponse());G5(o)?i(o):i()}catch(o){a(o)}else if(n!==null){let o=A5();o.serverResponse=n.getErrorText(),this.errorCallback_?a(this.errorCallback_(n,o)):a(o)}else if(c.canceled){let o=this.appDelete_?Y8():I5();a(o)}else{let o=N5();a(o)}};this.canceled_?s(!1,new R1(!1,null,!0)):this.backoffId_=B5(e,s,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&O5(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}},R1=class{constructor(e,s,r){this.wasSuccessCode=e,this.connection=s,this.canceled=!!r}};function W5(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function j5(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function $5(t,e){e&&(t["X-Firebase-GMPID"]=e)}function K5(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}function Q5(t,e,s,r,c,i,a=!0,n=!1){let o=U5(t.urlParams),l=t.url+o,m=Object.assign({},t.headers);return $5(m,e),W5(m,s),j5(m,i),K5(m,r),new h6(l,t.method,m,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,c,a,n)}function Y5(t){if(t.length===0)return null;let e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function X5(t){let e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}var R7=256*1024;var u6=class t{constructor(e,s){this._service=e,s instanceof q2?this._location=s:this._location=q2.makeFromUrl(s,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,s){return new t(e,s)}get root(){let e=new q2(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return X5(this._location.path)}get storage(){return this._service}get parent(){let e=Y5(this._location.path);if(e===null)return null;let s=new q2(this._location.bucket,e);return new t(this._service,s)}_throwIfRoot(e){if(this._location.path==="")throw D5(e)}};function j8(t,e){let s=e?.[T5];return s==null?null:q2.makeFromBucketSpec(s,t)}function J5(t,e,s,r={}){t.host=`${e}:${s}`;let c=$1(e);c&&(I4(`https://${t.host}/b`),R4("Storage",!0)),t._isUsingEmulator=!0,t._protocol=c?"https":"http";let{mockUserToken:i}=r;i&&(t._overrideAuthToken=typeof i=="string"?i:F4(i,t.app.options.projectId))}var p6=class{constructor(e,s,r,c,i,a=!1){this.app=e,this._authProvider=s,this._appCheckProvider=r,this._url=c,this._firebaseVersion=i,this._isUsingEmulator=a,this._bucket=null,this._host=Q8,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=k5,this._maxUploadRetryTime=P5,this._requests=new Set,c!=null?this._bucket=q2.makeFromBucketSpec(c,this._host):this._bucket=j8(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=q2.makeFromBucketSpec(this._url,e):this._bucket=j8(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){W8("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){W8("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}_getAuthToken(){return C1(this,null,function*(){if(this._overrideAuthToken)return this._overrideAuthToken;let e=this._authProvider.getImmediate({optional:!0});if(e){let s=yield e.getToken();if(s!==null)return s.accessToken}return null})}_getAppCheckToken(){return C1(this,null,function*(){if(U4(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=this._appCheckProvider.getImmediate({optional:!0});return e?(yield e.getToken()).token:null})}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new u6(this,e)}_makeRequest(e,s,r,c,i=!0){if(this._deleted)return new l6(Y8());{let a=Q5(e,this._appId,r,c,s,this._firebaseVersion,i,this._isUsingEmulator);return this._requests.add(a),a.getPromise().then(()=>this._requests.delete(a),()=>this._requests.delete(a)),a}}makeRequestWithTokens(e,s){return C1(this,null,function*(){let[r,c]=yield Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,s,r,c).getPromise()})}},$8="@firebase/storage",K8="0.13.14";var X8="storage";function m6(t=W4(),e){t=Y1(t);let r=G4(t,X8).getImmediate({identifier:e}),c=N4("storage");return c&&J8(r,...c),r}function J8(t,e,s,r={}){J5(t,e,s,r)}function Z5(t,{instanceIdentifier:e}){let s=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),c=t.getProvider("app-check-internal");return new p6(s,r,c,e,q4)}function ei(){O4(new B4(X8,Z5,"PUBLIC").setMultipleInstances(!0)),N2($8,K8,""),N2($8,K8,"esm2017")}ei();var v4=class{constructor(e){return e}},Z8="storage",d6=class{constructor(){return K4(Z8)}};var v6=new b4("angularfire2.storage-instances");function ti(t,e){let s=$4(Z8,t,e);return s&&new v4(s)}function si(t){return(e,s)=>{let r=e.runOutsideAngular(()=>t(s));return new v4(r)}}var ri={provide:d6,deps:[[new T2,v6]]},ci={provide:v4,useFactory:ti,deps:[[new T2,v6],Y4]};function es(t,...e){return N2("angularfire",j4.full,"gcs"),w4([ci,ri,{provide:v6,useFactory:si(t),multi:!0,deps:[M1,E4,Q4,X4,[new T2,Z4],[new T2,J4],...e]}])}var Zs=tr(ts(),1);var H3=class{constructor(){this.routesToCache=new Set(ft()),this.storedRouteHandles=new Map}shouldDetach(e){return e.routeConfig?.path!=null?this.routesToCache.has(e.routeConfig.path):!1}store(e,s){e.routeConfig?.path!=null&&this.storedRouteHandles.set(e.routeConfig.path,s)}shouldAttach(e){return e.routeConfig?.path!=null?this.storedRouteHandles.has(e.routeConfig.path):!1}retrieve(e){return e.routeConfig?.path!=null&&this.storedRouteHandles.get(e.routeConfig.path)||null}shouldReuseRoute(e,s){return e.routeConfig===s.routeConfig}};function ss(t){return new $(3e3,!1)}function ii(){return new $(3100,!1)}function ai(){return new $(3101,!1)}function ni(t){return new $(3001,!1)}function oi(t){return new $(3003,!1)}function li(t){return new $(3004,!1)}function cs(t,e){return new $(3005,!1)}function is(){return new $(3006,!1)}function as(){return new $(3007,!1)}function ns(t,e){return new $(3008,!1)}function os(t){return new $(3002,!1)}function ls(t,e,s,r,c){return new $(3010,!1)}function fs(){return new $(3011,!1)}function hs(){return new $(3012,!1)}function us(){return new $(3200,!1)}function ps(){return new $(3202,!1)}function ms(){return new $(3013,!1)}function ds(t){return new $(3014,!1)}function vs(t){return new $(3015,!1)}function gs(t){return new $(3016,!1)}function ys(t,e){return new $(3404,!1)}function fi(t){return new $(3502,!1)}function Cs(t){return new $(3503,!1)}function Hs(){return new $(3300,!1)}function zs(t){return new $(3504,!1)}function Ms(t){return new $(3301,!1)}function Vs(t,e){return new $(3302,!1)}function _s(t){return new $(3303,!1)}function Ss(t,e){return new $(3400,!1)}function Ls(t){return new $(3401,!1)}function bs(t){return new $(3402,!1)}function xs(t,e){return new $(3505,!1)}function j2(t){switch(t.length){case 0:return new n1;case 1:return t[0];default:return new e3(t)}}function H6(t,e,s=new Map,r=new Map){let c=[],i=[],a=-1,n=null;if(e.forEach(o=>{let l=o.get("offset"),m=l==a,y=m&&n||new Map;o.forEach((u,C)=>{let v=C,g=u;if(C!=="offset")switch(v=t.normalizePropertyName(v,c),g){case X1:g=s.get(C);break;case _2:g=r.get(C);break;default:g=t.normalizeStyleValue(C,v,g,c);break}y.set(v,g)}),m||i.push(y),n=y,a=l}),c.length)throw fi(c);return i}function z3(t,e,s,r){switch(e){case"start":t.onStart(()=>r(s&&g6(s,"start",t)));break;case"done":t.onDone(()=>r(s&&g6(s,"done",t)));break;case"destroy":t.onDestroy(()=>r(s&&g6(s,"destroy",t)));break}}function g6(t,e,s){let r=s.totalTime,c=!!s.disabled,i=M3(t.element,t.triggerName,t.fromState,t.toState,e||t.phaseName,r??t.totalTime,c),a=t._data;return a!=null&&(i._data=a),i}function M3(t,e,s,r,c="",i=0,a){return{element:t,triggerName:e,fromState:s,toState:r,phaseName:c,totalTime:i,disabled:!!a}}function m2(t,e,s){let r=t.get(e);return r||t.set(e,r=s),r}function z6(t){let e=t.indexOf(":"),s=t.substring(1,e),r=t.slice(e+1);return[s,r]}var hi=typeof document>"u"?null:document.documentElement;function V3(t){let e=t.parentNode||t.host||null;return e===hi?null:e}function ui(t){return t.substring(1,6)=="ebkit"}var d1=null,rs=!1;function ws(t){d1||(d1=pi()||{},rs=d1.style?"WebkitAppearance"in d1.style:!1);let e=!0;return d1.style&&!ui(t)&&(e=t in d1.style,!e&&rs&&(e="Webkit"+t.charAt(0).toUpperCase()+t.slice(1)in d1.style)),e}function pi(){return typeof document<"u"?document.body:null}function M6(t,e){for(;e;){if(e===t)return!0;e=V3(e)}return!1}function V6(t,e,s){if(s)return Array.from(t.querySelectorAll(e));let r=t.querySelector(e);return r?[r]:[]}var mi=1e3,_6="{{",di="}}",S6="ng-enter",_3="ng-leave",g4="ng-trigger",y4=".ng-trigger",L6="ng-animating",S3=".ng-animating";function F2(t){if(typeof t=="number")return t;let e=t.match(/^(-?[\.\d]+)(m?s)/);return!e||e.length<2?0:y6(parseFloat(e[1]),e[2])}function y6(t,e){switch(e){case"s":return t*mi;default:return t}}function C4(t,e,s){return t.hasOwnProperty("duration")?t:gi(t,e,s)}var vi=/^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i;function gi(t,e,s){let r,c=0,i="";if(typeof t=="string"){let a=t.match(vi);if(a===null)return e.push(ss(t)),{duration:0,delay:0,easing:""};r=y6(parseFloat(a[1]),a[2]);let n=a[3];n!=null&&(c=y6(parseFloat(n),a[4]));let o=a[5];o&&(i=o)}else r=t;if(!s){let a=!1,n=e.length;r<0&&(e.push(ii()),a=!0),c<0&&(e.push(ai()),a=!0),a&&e.splice(n,0,ss(t))}return{duration:r,delay:c,easing:i}}function Es(t){return t.length?t[0]instanceof Map?t:t.map(e=>new Map(Object.entries(e))):[]}function x2(t,e,s){e.forEach((r,c)=>{let i=L3(c);s&&!s.has(c)&&s.set(c,t.style[i]),t.style[i]=r})}function s1(t,e){e.forEach((s,r)=>{let c=L3(r);t.style[c]=""})}function D1(t){return Array.isArray(t)?t.length==1?t[0]:Gt(t):t}function Ts(t,e,s){let r=e.params||{},c=b6(t);c.length&&c.forEach(i=>{r.hasOwnProperty(i)||s.push(ni(i))})}var C6=new RegExp(`${_6}\\s*(.+?)\\s*${di}`,"g");function b6(t){let e=[];if(typeof t=="string"){let s;for(;s=C6.exec(t);)e.push(s[1]);C6.lastIndex=0}return e}function B1(t,e,s){let r=`${t}`,c=r.replace(C6,(i,a)=>{let n=e[a];return n==null&&(s.push(oi(a)),n=""),n.toString()});return c==r?t:c}var yi=/-+([a-z0-9])/g;function L3(t){return t.replace(yi,(...e)=>e[1].toUpperCase())}function ks(t,e){return t===0||e===0}function Ps(t,e,s){if(s.size&&e.length){let r=e[0],c=[];if(s.forEach((i,a)=>{r.has(a)||c.push(a),r.set(a,i)}),c.length)for(let i=1;ia.set(n,b3(t,n)))}}return e}function d2(t,e,s){switch(e.type){case U.Trigger:return t.visitTrigger(e,s);case U.State:return t.visitState(e,s);case U.Transition:return t.visitTransition(e,s);case U.Sequence:return t.visitSequence(e,s);case U.Group:return t.visitGroup(e,s);case U.Animate:return t.visitAnimate(e,s);case U.Keyframes:return t.visitKeyframes(e,s);case U.Style:return t.visitStyle(e,s);case U.Reference:return t.visitReference(e,s);case U.AnimateChild:return t.visitAnimateChild(e,s);case U.AnimateRef:return t.visitAnimateRef(e,s);case U.Query:return t.visitQuery(e,s);case U.Stagger:return t.visitStagger(e,s);default:throw li(e.type)}}function b3(t,e){return window.getComputedStyle(t)[e]}var q6=(()=>{class t{validateStyleProperty(s){return ws(s)}containsElement(s,r){return M6(s,r)}getParentElement(s){return V3(s)}query(s,r,c){return V6(s,r,c)}computeStyle(s,r,c){return c||""}animate(s,r,c,i,a,n=[],o){return new n1(c,i)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=H1({token:t,factory:t.\u0275fac})}return t})(),g1=class{static NOOP=new q6},y1=class{};var Ci=new Set(["width","height","minWidth","minHeight","maxWidth","maxHeight","left","top","bottom","right","fontSize","outlineWidth","outlineOffset","paddingTop","paddingLeft","paddingBottom","paddingRight","marginTop","marginLeft","marginBottom","marginRight","borderRadius","borderWidth","borderTopWidth","borderLeftWidth","borderRightWidth","borderBottomWidth","textIndent","perspective"]),k3=class extends y1{normalizePropertyName(e,s){return L3(e)}normalizeStyleValue(e,s,r,c){let i="",a=r.toString().trim();if(Ci.has(s)&&r!==0&&r!=="0")if(typeof r=="number")i="px";else{let n=r.match(/^[+-]?[\d\.]+([a-z]*)$/);n&&n[1].length==0&&c.push(cs(e,r))}return a+i}};var P3="*";function Hi(t,e){let s=[];return typeof t=="string"?t.split(/\s*,\s*/).forEach(r=>zi(r,s,e)):s.push(t),s}function zi(t,e,s){if(t[0]==":"){let o=Mi(t,s);if(typeof o=="function"){e.push(o);return}t=o}let r=t.match(/^(\*|[-\w]+)\s*()\s*(\*|[-\w]+)$/);if(r==null||r.length<4)return s.push(vs(t)),e;let c=r[1],i=r[2],a=r[3];e.push(As(c,a));let n=c==P3&&a==P3;i[0]=="<"&&!n&&e.push(As(a,c))}function Mi(t,e){switch(t){case":enter":return"void => *";case":leave":return"* => void";case":increment":return(s,r)=>parseFloat(r)>parseFloat(s);case":decrement":return(s,r)=>parseFloat(r) *"}}var x3=new Set(["true","1"]),w3=new Set(["false","0"]);function As(t,e){let s=x3.has(t)||w3.has(t),r=x3.has(e)||w3.has(e);return(c,i)=>{let a=t==P3||t==c,n=e==P3||e==i;return!a&&s&&typeof c=="boolean"&&(a=c?x3.has(t):w3.has(t)),!n&&r&&typeof i=="boolean"&&(n=i?x3.has(e):w3.has(e)),a&&n}}var qs=":self",Vi=new RegExp(`s*${qs}s*,?`,"g");function Ws(t,e,s,r){return new P6(t).build(e,s,r)}var Ns="",P6=class{_driver;constructor(e){this._driver=e}build(e,s,r){let c=new A6(s);return this._resetContextStyleTimingState(c),d2(this,D1(e),c)}_resetContextStyleTimingState(e){e.currentQuerySelector=Ns,e.collectedStyles=new Map,e.collectedStyles.set(Ns,new Map),e.currentTime=0}visitTrigger(e,s){let r=s.queryCount=0,c=s.depCount=0,i=[],a=[];return e.name.charAt(0)=="@"&&s.errors.push(is()),e.definitions.forEach(n=>{if(this._resetContextStyleTimingState(s),n.type==U.State){let o=n,l=o.name;l.toString().split(/\s*,\s*/).forEach(m=>{o.name=m,i.push(this.visitState(o,s))}),o.name=l}else if(n.type==U.Transition){let o=this.visitTransition(n,s);r+=o.queryCount,c+=o.depCount,a.push(o)}else s.errors.push(as())}),{type:U.Trigger,name:e.name,states:i,transitions:a,queryCount:r,depCount:c,options:null}}visitState(e,s){let r=this.visitStyle(e.styles,s),c=e.options&&e.options.params||null;if(r.containsDynamicStyles){let i=new Set,a=c||{};r.styles.forEach(n=>{n instanceof Map&&n.forEach(o=>{b6(o).forEach(l=>{a.hasOwnProperty(l)||i.add(l)})})}),i.size&&s.errors.push(ns(e.name,[...i.values()]))}return{type:U.State,name:e.name,style:r,options:c?{params:c}:null}}visitTransition(e,s){s.queryCount=0,s.depCount=0;let r=d2(this,D1(e.animation),s),c=Hi(e.expr,s.errors);return{type:U.Transition,matchers:c,animation:r,queryCount:s.queryCount,depCount:s.depCount,options:v1(e.options)}}visitSequence(e,s){return{type:U.Sequence,steps:e.steps.map(r=>d2(this,r,s)),options:v1(e.options)}}visitGroup(e,s){let r=s.currentTime,c=0,i=e.steps.map(a=>{s.currentTime=r;let n=d2(this,a,s);return c=Math.max(c,s.currentTime),n});return s.currentTime=c,{type:U.Group,steps:i,options:v1(e.options)}}visitAnimate(e,s){let r=bi(e.timings,s.errors);s.currentAnimateTimings=r;let c,i=e.styles?e.styles:K3({});if(i.type==U.Keyframes)c=this.visitKeyframes(i,s);else{let a=e.styles,n=!1;if(!a){n=!0;let l={};r.easing&&(l.easing=r.easing),a=K3(l)}s.currentTime+=r.duration+r.delay;let o=this.visitStyle(a,s);o.isEmptyStep=n,c=o}return s.currentAnimateTimings=null,{type:U.Animate,timings:r,style:c,options:null}}visitStyle(e,s){let r=this._makeStyleAst(e,s);return this._validateStyleAst(r,s),r}_makeStyleAst(e,s){let r=[],c=Array.isArray(e.styles)?e.styles:[e.styles];for(let n of c)typeof n=="string"?n===_2?r.push(n):s.errors.push(os(n)):r.push(new Map(Object.entries(n)));let i=!1,a=null;return r.forEach(n=>{if(n instanceof Map&&(n.has("easing")&&(a=n.get("easing"),n.delete("easing")),!i)){for(let o of n.values())if(o.toString().indexOf(_6)>=0){i=!0;break}}}),{type:U.Style,styles:r,easing:a,offset:e.offset,containsDynamicStyles:i,options:null}}_validateStyleAst(e,s){let r=s.currentAnimateTimings,c=s.currentTime,i=s.currentTime;r&&i>0&&(i-=r.duration+r.delay),e.styles.forEach(a=>{typeof a!="string"&&a.forEach((n,o)=>{let l=s.collectedStyles.get(s.currentQuerySelector),m=l.get(o),y=!0;m&&(i!=c&&i>=m.startTime&&c<=m.endTime&&(s.errors.push(ls(o,m.startTime,m.endTime,i,c)),y=!1),i=m.startTime),y&&l.set(o,{startTime:i,endTime:c}),s.options&&Ts(n,s.options,s.errors)})})}visitKeyframes(e,s){let r={type:U.Keyframes,styles:[],options:null};if(!s.currentAnimateTimings)return s.errors.push(fs()),r;let c=1,i=0,a=[],n=!1,o=!1,l=0,m=e.steps.map(f=>{let d=this._makeStyleAst(f,s),p=d.offset!=null?d.offset:Li(d.styles),h=0;return p!=null&&(i++,h=d.offset=p),o=o||h<0||h>1,n=n||h0&&i{let p=u>0?d==C?1:u*d:a[d],h=p*V;s.currentTime=v+g.delay+h,g.duration=h,this._validateStyleAst(f,s),f.offset=p,r.styles.push(f)}),r}visitReference(e,s){return{type:U.Reference,animation:d2(this,D1(e.animation),s),options:v1(e.options)}}visitAnimateChild(e,s){return s.depCount++,{type:U.AnimateChild,options:v1(e.options)}}visitAnimateRef(e,s){return{type:U.AnimateRef,animation:this.visitReference(e.animation,s),options:v1(e.options)}}visitQuery(e,s){let r=s.currentQuerySelector,c=e.options||{};s.queryCount++,s.currentQuery=e;let[i,a]=_i(e.selector);s.currentQuerySelector=r.length?r+" "+i:i,m2(s.collectedStyles,s.currentQuerySelector,new Map);let n=d2(this,D1(e.animation),s);return s.currentQuery=null,s.currentQuerySelector=r,{type:U.Query,selector:i,limit:c.limit||0,optional:!!c.optional,includeSelf:a,animation:n,originalSelector:e.selector,options:v1(e.options)}}visitStagger(e,s){s.currentQuery||s.errors.push(ms());let r=e.timings==="full"?{duration:0,delay:0,easing:"full"}:C4(e.timings,s.errors,!0);return{type:U.Stagger,animation:d2(this,D1(e.animation),s),timings:r,options:null}}};function _i(t){let e=!!t.split(/\s*,\s*/).find(s=>s==qs);return e&&(t=t.replace(Vi,"")),t=t.replace(/@\*/g,y4).replace(/@\w+/g,s=>y4+"-"+s.slice(1)).replace(/:animating/g,S3),[t,e]}function Si(t){return t?L4({},t):null}var A6=class{errors;queryCount=0;depCount=0;currentTransition=null;currentQuery=null;currentQuerySelector=null;currentAnimateTimings=null;currentTime=0;collectedStyles=new Map;options=null;unsupportedCSSPropertiesFound=new Set;constructor(e){this.errors=e}};function Li(t){if(typeof t=="string")return null;let e=null;if(Array.isArray(t))t.forEach(s=>{if(s instanceof Map&&s.has("offset")){let r=s;e=parseFloat(r.get("offset")),r.delete("offset")}});else if(t instanceof Map&&t.has("offset")){let s=t;e=parseFloat(s.get("offset")),s.delete("offset")}return e}function bi(t,e){if(t.hasOwnProperty("duration"))return t;if(typeof t=="number"){let i=C4(t,e).duration;return x6(i,0,"")}let s=t;if(s.split(/\s+/).some(i=>i.charAt(0)=="{"&&i.charAt(1)=="{")){let i=x6(0,0,"");return i.dynamic=!0,i.strValue=s,i}let c=C4(s,e);return x6(c.duration,c.delay,c.easing)}function v1(t){return t?(t=L4({},t),t.params&&(t.params=Si(t.params))):t={},t}function x6(t,e,s){return{duration:t,delay:e,easing:s}}function W6(t,e,s,r,c,i,a=null,n=!1){return{type:1,element:t,keyframes:e,preStyleProps:s,postStyleProps:r,duration:c,delay:i,totalTime:c+i,easing:a,subTimeline:n}}var z4=class{_map=new Map;get(e){return this._map.get(e)||[]}append(e,s){let r=this._map.get(e);r||this._map.set(e,r=[]),r.push(...s)}has(e){return this._map.has(e)}clear(){this._map.clear()}},xi=1,wi=":enter",Ei=new RegExp(wi,"g"),Ti=":leave",ki=new RegExp(Ti,"g");function js(t,e,s,r,c,i=new Map,a=new Map,n,o,l=[]){return new N6().buildKeyframes(t,e,s,r,c,i,a,n,o,l)}var N6=class{buildKeyframes(e,s,r,c,i,a,n,o,l,m=[]){l=l||new z4;let y=new I6(e,s,l,c,i,m,[]);y.options=o;let u=o.delay?F2(o.delay):0;y.currentTimeline.delayNextStep(u),y.currentTimeline.setStyles([a],null,y.errors,o),d2(this,r,y);let C=y.timelines.filter(v=>v.containsAnimation());if(C.length&&n.size){let v;for(let g=C.length-1;g>=0;g--){let V=C[g];if(V.element===s){v=V;break}}v&&!v.allowOnlyTimelineStyles()&&v.setStyles([n],null,y.errors,o)}return C.length?C.map(v=>v.buildKeyframes()):[W6(s,[],[],[],0,u,"",!1)]}visitTrigger(e,s){}visitState(e,s){}visitTransition(e,s){}visitAnimateChild(e,s){let r=s.subInstructions.get(s.element);if(r){let c=s.createSubContext(e.options),i=s.currentTimeline.currentTime,a=this._visitSubInstructions(r,c,c.options);i!=a&&s.transformIntoNewTimeline(a)}s.previousNode=e}visitAnimateRef(e,s){let r=s.createSubContext(e.options);r.transformIntoNewTimeline(),this._applyAnimationRefDelays([e.options,e.animation.options],s,r),this.visitReference(e.animation,r),s.transformIntoNewTimeline(r.currentTimeline.currentTime),s.previousNode=e}_applyAnimationRefDelays(e,s,r){for(let c of e){let i=c?.delay;if(i){let a=typeof i=="number"?i:F2(B1(i,c?.params??{},s.errors));r.delayNextStep(a)}}}_visitSubInstructions(e,s,r){let i=s.currentTimeline.currentTime,a=r.duration!=null?F2(r.duration):null,n=r.delay!=null?F2(r.delay):null;return a!==0&&e.forEach(o=>{let l=s.appendInstructionToTimeline(o,a,n);i=Math.max(i,l.duration+l.delay)}),i}visitReference(e,s){s.updateOptions(e.options,!0),d2(this,e.animation,s),s.previousNode=e}visitSequence(e,s){let r=s.subContextCount,c=s,i=e.options;if(i&&(i.params||i.delay)&&(c=s.createSubContext(i),c.transformIntoNewTimeline(),i.delay!=null)){c.previousNode.type==U.Style&&(c.currentTimeline.snapshotCurrentStyles(),c.previousNode=A3);let a=F2(i.delay);c.delayNextStep(a)}e.steps.length&&(e.steps.forEach(a=>d2(this,a,c)),c.currentTimeline.applyStylesToKeyframe(),c.subContextCount>r&&c.transformIntoNewTimeline()),s.previousNode=e}visitGroup(e,s){let r=[],c=s.currentTimeline.currentTime,i=e.options&&e.options.delay?F2(e.options.delay):0;e.steps.forEach(a=>{let n=s.createSubContext(e.options);i&&n.delayNextStep(i),d2(this,a,n),c=Math.max(c,n.currentTimeline.currentTime),r.push(n.currentTimeline)}),r.forEach(a=>s.currentTimeline.mergeTimelineCollectedStyles(a)),s.transformIntoNewTimeline(c),s.previousNode=e}_visitTiming(e,s){if(e.dynamic){let r=e.strValue,c=s.params?B1(r,s.params,s.errors):r;return C4(c,s.errors)}else return{duration:e.duration,delay:e.delay,easing:e.easing}}visitAnimate(e,s){let r=s.currentAnimateTimings=this._visitTiming(e.timings,s),c=s.currentTimeline;r.delay&&(s.incrementTime(r.delay),c.snapshotCurrentStyles());let i=e.style;i.type==U.Keyframes?this.visitKeyframes(i,s):(s.incrementTime(r.duration),this.visitStyle(i,s),c.applyStylesToKeyframe()),s.currentAnimateTimings=null,s.previousNode=e}visitStyle(e,s){let r=s.currentTimeline,c=s.currentAnimateTimings;!c&&r.hasCurrentStyleProperties()&&r.forwardFrame();let i=c&&c.easing||e.easing;e.isEmptyStep?r.applyEmptyStep(i):r.setStyles(e.styles,i,s.errors,s.options),s.previousNode=e}visitKeyframes(e,s){let r=s.currentAnimateTimings,c=s.currentTimeline.duration,i=r.duration,n=s.createSubContext().currentTimeline;n.easing=r.easing,e.styles.forEach(o=>{let l=o.offset||0;n.forwardTime(l*i),n.setStyles(o.styles,o.easing,s.errors,s.options),n.applyStylesToKeyframe()}),s.currentTimeline.mergeTimelineCollectedStyles(n),s.transformIntoNewTimeline(c+i),s.previousNode=e}visitQuery(e,s){let r=s.currentTimeline.currentTime,c=e.options||{},i=c.delay?F2(c.delay):0;i&&(s.previousNode.type===U.Style||r==0&&s.currentTimeline.hasCurrentStyleProperties())&&(s.currentTimeline.snapshotCurrentStyles(),s.previousNode=A3);let a=r,n=s.invokeQuery(e.selector,e.originalSelector,e.limit,e.includeSelf,!!c.optional,s.errors);s.currentQueryTotal=n.length;let o=null;n.forEach((l,m)=>{s.currentQueryIndex=m;let y=s.createSubContext(e.options,l);i&&y.delayNextStep(i),l===s.element&&(o=y.currentTimeline),d2(this,e.animation,y),y.currentTimeline.applyStylesToKeyframe();let u=y.currentTimeline.currentTime;a=Math.max(a,u)}),s.currentQueryIndex=0,s.currentQueryTotal=0,s.transformIntoNewTimeline(a),o&&(s.currentTimeline.mergeTimelineCollectedStyles(o),s.currentTimeline.snapshotCurrentStyles()),s.previousNode=e}visitStagger(e,s){let r=s.parentContext,c=s.currentTimeline,i=e.timings,a=Math.abs(i.duration),n=a*(s.currentQueryTotal-1),o=a*s.currentQueryIndex;switch(i.duration<0?"reverse":i.easing){case"reverse":o=n-o;break;case"full":o=r.currentStaggerTime;break}let m=s.currentTimeline;o&&m.delayNextStep(o);let y=m.currentTime;d2(this,e.animation,s),s.previousNode=e,r.currentStaggerTime=c.currentTime-y+(c.startTime-r.currentTimeline.startTime)}},A3={},I6=class t{_driver;element;subInstructions;_enterClassName;_leaveClassName;errors;timelines;parentContext=null;currentTimeline;currentAnimateTimings=null;previousNode=A3;subContextCount=0;options={};currentQueryIndex=0;currentQueryTotal=0;currentStaggerTime=0;constructor(e,s,r,c,i,a,n,o){this._driver=e,this.element=s,this.subInstructions=r,this._enterClassName=c,this._leaveClassName=i,this.errors=a,this.timelines=n,this.currentTimeline=o||new N3(this._driver,s,0),n.push(this.currentTimeline)}get params(){return this.options.params}updateOptions(e,s){if(!e)return;let r=e,c=this.options;r.duration!=null&&(c.duration=F2(r.duration)),r.delay!=null&&(c.delay=F2(r.delay));let i=r.params;if(i){let a=c.params;a||(a=this.options.params={}),Object.keys(i).forEach(n=>{(!s||!a.hasOwnProperty(n))&&(a[n]=B1(i[n],a,this.errors))})}}_copyOptions(){let e={};if(this.options){let s=this.options.params;if(s){let r=e.params={};Object.keys(s).forEach(c=>{r[c]=s[c]})}}return e}createSubContext(e=null,s,r){let c=s||this.element,i=new t(this._driver,c,this.subInstructions,this._enterClassName,this._leaveClassName,this.errors,this.timelines,this.currentTimeline.fork(c,r||0));return i.previousNode=this.previousNode,i.currentAnimateTimings=this.currentAnimateTimings,i.options=this._copyOptions(),i.updateOptions(e),i.currentQueryIndex=this.currentQueryIndex,i.currentQueryTotal=this.currentQueryTotal,i.parentContext=this,this.subContextCount++,i}transformIntoNewTimeline(e){return this.previousNode=A3,this.currentTimeline=this.currentTimeline.fork(this.element,e),this.timelines.push(this.currentTimeline),this.currentTimeline}appendInstructionToTimeline(e,s,r){let c={duration:s??e.duration,delay:this.currentTimeline.currentTime+(r??0)+e.delay,easing:""},i=new F6(this._driver,e.element,e.keyframes,e.preStyleProps,e.postStyleProps,c,e.stretchStartingKeyframe);return this.timelines.push(i),c}incrementTime(e){this.currentTimeline.forwardTime(this.currentTimeline.duration+e)}delayNextStep(e){e>0&&this.currentTimeline.delayNextStep(e)}invokeQuery(e,s,r,c,i,a){let n=[];if(c&&n.push(this.element),e.length>0){e=e.replace(Ei,"."+this._enterClassName),e=e.replace(ki,"."+this._leaveClassName);let o=r!=1,l=this._driver.query(this.element,e,o);r!==0&&(l=r<0?l.slice(l.length+r,l.length):l.slice(0,r)),n.push(...l)}return!i&&n.length==0&&a.push(ds(s)),n}},N3=class t{_driver;element;startTime;_elementTimelineStylesLookup;duration=0;easing=null;_previousKeyframe=new Map;_currentKeyframe=new Map;_keyframes=new Map;_styleSummary=new Map;_localTimelineStyles=new Map;_globalTimelineStyles;_pendingStyles=new Map;_backFill=new Map;_currentEmptyStepKeyframe=null;constructor(e,s,r,c){this._driver=e,this.element=s,this.startTime=r,this._elementTimelineStylesLookup=c,this._elementTimelineStylesLookup||(this._elementTimelineStylesLookup=new Map),this._globalTimelineStyles=this._elementTimelineStylesLookup.get(s),this._globalTimelineStyles||(this._globalTimelineStyles=this._localTimelineStyles,this._elementTimelineStylesLookup.set(s,this._localTimelineStyles)),this._loadKeyframe()}containsAnimation(){switch(this._keyframes.size){case 0:return!1;case 1:return this.hasCurrentStyleProperties();default:return!0}}hasCurrentStyleProperties(){return this._currentKeyframe.size>0}get currentTime(){return this.startTime+this.duration}delayNextStep(e){let s=this._keyframes.size===1&&this._pendingStyles.size;this.duration||s?(this.forwardTime(this.currentTime+e),s&&this.snapshotCurrentStyles()):this.startTime+=e}fork(e,s){return this.applyStylesToKeyframe(),new t(this._driver,e,s||this.currentTime,this._elementTimelineStylesLookup)}_loadKeyframe(){this._currentKeyframe&&(this._previousKeyframe=this._currentKeyframe),this._currentKeyframe=this._keyframes.get(this.duration),this._currentKeyframe||(this._currentKeyframe=new Map,this._keyframes.set(this.duration,this._currentKeyframe))}forwardFrame(){this.duration+=xi,this._loadKeyframe()}forwardTime(e){this.applyStylesToKeyframe(),this.duration=e,this._loadKeyframe()}_updateStyle(e,s){this._localTimelineStyles.set(e,s),this._globalTimelineStyles.set(e,s),this._styleSummary.set(e,{time:this.currentTime,value:s})}allowOnlyTimelineStyles(){return this._currentEmptyStepKeyframe!==this._currentKeyframe}applyEmptyStep(e){e&&this._previousKeyframe.set("easing",e);for(let[s,r]of this._globalTimelineStyles)this._backFill.set(s,r||_2),this._currentKeyframe.set(s,_2);this._currentEmptyStepKeyframe=this._currentKeyframe}setStyles(e,s,r,c){s&&this._previousKeyframe.set("easing",s);let i=c&&c.params||{},a=Pi(e,this._globalTimelineStyles);for(let[n,o]of a){let l=B1(o,i,r);this._pendingStyles.set(n,l),this._localTimelineStyles.has(n)||this._backFill.set(n,this._globalTimelineStyles.get(n)??_2),this._updateStyle(n,l)}}applyStylesToKeyframe(){this._pendingStyles.size!=0&&(this._pendingStyles.forEach((e,s)=>{this._currentKeyframe.set(s,e)}),this._pendingStyles.clear(),this._localTimelineStyles.forEach((e,s)=>{this._currentKeyframe.has(s)||this._currentKeyframe.set(s,e)}))}snapshotCurrentStyles(){for(let[e,s]of this._localTimelineStyles)this._pendingStyles.set(e,s),this._updateStyle(e,s)}getFinalKeyframe(){return this._keyframes.get(this.duration)}get properties(){let e=[];for(let s in this._currentKeyframe)e.push(s);return e}mergeTimelineCollectedStyles(e){e._styleSummary.forEach((s,r)=>{let c=this._styleSummary.get(r);(!c||s.time>c.time)&&this._updateStyle(r,s.value)})}buildKeyframes(){this.applyStylesToKeyframe();let e=new Set,s=new Set,r=this._keyframes.size===1&&this.duration===0,c=[];this._keyframes.forEach((n,o)=>{let l=new Map([...this._backFill,...n]);l.forEach((m,y)=>{m===X1?e.add(y):m===_2&&s.add(y)}),r||l.set("offset",o/this.duration),c.push(l)});let i=[...e.values()],a=[...s.values()];if(r){let n=c[0],o=new Map(n);n.set("offset",0),o.set("offset",1),c=[n,o]}return W6(this.element,c,i,a,this.duration,this.startTime,this.easing,!1)}},F6=class extends N3{keyframes;preStyleProps;postStyleProps;_stretchStartingKeyframe;timings;constructor(e,s,r,c,i,a,n=!1){super(e,s,a.delay),this.keyframes=r,this.preStyleProps=c,this.postStyleProps=i,this._stretchStartingKeyframe=n,this.timings={duration:a.duration,delay:a.delay,easing:a.easing}}containsAnimation(){return this.keyframes.length>1}buildKeyframes(){let e=this.keyframes,{delay:s,duration:r,easing:c}=this.timings;if(this._stretchStartingKeyframe&&s){let i=[],a=r+s,n=s/a,o=new Map(e[0]);o.set("offset",0),i.push(o);let l=new Map(e[0]);l.set("offset",Is(n)),i.push(l);let m=e.length-1;for(let y=1;y<=m;y++){let u=new Map(e[y]),C=u.get("offset"),v=s+C*r;u.set("offset",Is(v/a)),i.push(u)}r=a,s=0,c="",e=i}return W6(this.element,e,this.preStyleProps,this.postStyleProps,r,s,c,!0)}};function Is(t,e=3){let s=Math.pow(10,e-1);return Math.round(t*s)/s}function Pi(t,e){let s=new Map,r;return t.forEach(c=>{if(c==="*"){r??=e.keys();for(let i of r)s.set(i,_2)}else for(let[i,a]of c)s.set(i,a)}),s}function Fs(t,e,s,r,c,i,a,n,o,l,m,y,u){return{type:0,element:t,triggerName:e,isRemovalTransition:c,fromState:s,fromStyles:i,toState:r,toStyles:a,timelines:n,queriedElements:o,preStyleProps:l,postStyleProps:m,totalTime:y,errors:u}}var w6={},I3=class{_triggerName;ast;_stateStyles;constructor(e,s,r){this._triggerName=e,this.ast=s,this._stateStyles=r}match(e,s,r,c){return Ai(this.ast.matchers,e,s,r,c)}buildStyles(e,s,r){let c=this._stateStyles.get("*");return e!==void 0&&(c=this._stateStyles.get(e?.toString())||c),c?c.buildStyles(s,r):new Map}build(e,s,r,c,i,a,n,o,l,m){let y=[],u=this.ast.options&&this.ast.options.params||w6,C=n&&n.params||w6,v=this.buildStyles(r,C,y),g=o&&o.params||w6,V=this.buildStyles(c,g,y),f=new Set,d=new Map,p=new Map,h=c==="void",H={params:$s(g,u),delay:this.ast.options?.delay},z=m?[]:js(e,s,this.ast.animation,i,a,v,V,H,l,y),_=0;return z.forEach(L=>{_=Math.max(L.duration+L.delay,_)}),y.length?Fs(s,this._triggerName,r,c,h,v,V,[],[],d,p,_,y):(z.forEach(L=>{let w=L.element,N=m2(d,w,new Set);L.preStyleProps.forEach(P=>N.add(P));let A=m2(p,w,new Set);L.postStyleProps.forEach(P=>A.add(P)),w!==s&&f.add(w)}),Fs(s,this._triggerName,r,c,h,v,V,z,[...f.values()],d,p,_))}};function Ai(t,e,s,r,c){return t.some(i=>i(e,s,r,c))}function $s(t,e){let s=L4({},e);return Object.entries(t).forEach(([r,c])=>{c!=null&&(s[r]=c)}),s}var R6=class{styles;defaultParams;normalizer;constructor(e,s,r){this.styles=e,this.defaultParams=s,this.normalizer=r}buildStyles(e,s){let r=new Map,c=$s(e,this.defaultParams);return this.styles.styles.forEach(i=>{typeof i!="string"&&i.forEach((a,n)=>{a&&(a=B1(a,c,s));let o=this.normalizer.normalizePropertyName(n,s);a=this.normalizer.normalizeStyleValue(n,o,a,s),r.set(n,a)})}),r}};function Ni(t,e,s){return new D6(t,e,s)}var D6=class{name;ast;_normalizer;transitionFactories=[];fallbackTransition;states=new Map;constructor(e,s,r){this.name=e,this.ast=s,this._normalizer=r,s.states.forEach(c=>{let i=c.options&&c.options.params||{};this.states.set(c.name,new R6(c.style,i,r))}),Rs(this.states,"true","1"),Rs(this.states,"false","0"),s.transitions.forEach(c=>{this.transitionFactories.push(new I3(e,c,this.states))}),this.fallbackTransition=Ii(e,this.states)}get containsQueries(){return this.ast.queryCount>0}matchTransition(e,s,r,c){return this.transitionFactories.find(a=>a.match(e,s,r,c))||null}matchStyles(e,s,r){return this.fallbackTransition.buildStyles(e,s,r)}};function Ii(t,e,s){let r=[(a,n)=>!0],c={type:U.Sequence,steps:[],options:null},i={type:U.Transition,animation:c,matchers:r,options:null,queryCount:0,depCount:0};return new I3(t,i,e)}function Rs(t,e,s){t.has(e)?t.has(s)||t.set(s,t.get(e)):t.has(s)&&t.set(e,t.get(s))}var Fi=new z4,B6=class{bodyNode;_driver;_normalizer;_animations=new Map;_playersById=new Map;players=[];constructor(e,s,r){this.bodyNode=e,this._driver=s,this._normalizer=r}register(e,s){let r=[],c=[],i=Ws(this._driver,s,r,c);if(r.length)throw Cs(r);this._animations.set(e,i)}_buildPlayer(e,s,r){let c=e.element,i=H6(this._normalizer,e.keyframes,s,r);return this._driver.animate(c,i,e.duration,e.delay,e.easing,[],!0)}create(e,s,r={}){let c=[],i=this._animations.get(e),a,n=new Map;if(i?(a=js(this._driver,s,i,S6,_3,new Map,new Map,r,Fi,c),a.forEach(m=>{let y=m2(n,m.element,new Map);m.postStyleProps.forEach(u=>y.set(u,null))})):(c.push(Hs()),a=[]),c.length)throw zs(c);n.forEach((m,y)=>{m.forEach((u,C)=>{m.set(C,this._driver.computeStyle(y,C,_2))})});let o=a.map(m=>{let y=n.get(m.element);return this._buildPlayer(m,new Map,y)}),l=j2(o);return this._playersById.set(e,l),l.onDestroy(()=>this.destroy(e)),this.players.push(l),l}destroy(e){let s=this._getPlayer(e);s.destroy(),this._playersById.delete(e);let r=this.players.indexOf(s);r>=0&&this.players.splice(r,1)}_getPlayer(e){let s=this._playersById.get(e);if(!s)throw Ms(e);return s}listen(e,s,r,c){let i=M3(s,"","","");return z3(this._getPlayer(e),r,i,c),()=>{}}command(e,s,r,c){if(r=="register"){this.register(e,c[0]);return}if(r=="create"){let a=c[0]||{};this.create(e,s,a);return}let i=this._getPlayer(e);switch(r){case"play":i.play();break;case"pause":i.pause();break;case"reset":i.reset();break;case"restart":i.restart();break;case"finish":i.finish();break;case"init":i.init();break;case"setPosition":i.setPosition(parseFloat(c[0]));break;case"destroy":this.destroy(e);break}}},Ds="ng-animate-queued",Ri=".ng-animate-queued",E6="ng-animate-disabled",Di=".ng-animate-disabled",Bi="ng-star-inserted",Oi=".ng-star-inserted",Gi=[],Ks={namespaceId:"",setForRemoval:!1,setForMove:!1,hasAnimation:!1,removedBeforeQueried:!1},Ui={namespaceId:"",setForMove:!1,setForRemoval:!1,hasAnimation:!1,removedBeforeQueried:!0},w2="__ng_removed",M4=class{namespaceId;value;options;get params(){return this.options.params}constructor(e,s=""){this.namespaceId=s;let r=e&&e.hasOwnProperty("value"),c=r?e.value:e;if(this.value=Wi(c),r){let i=e,{value:a}=i,n=j6(i,["value"]);this.options=n}else this.options={};this.options.params||(this.options.params={})}absorbOptions(e){let s=e.params;if(s){let r=this.options.params;Object.keys(s).forEach(c=>{r[c]==null&&(r[c]=s[c])})}}},H4="void",T6=new M4(H4),O6=class{id;hostElement;_engine;players=[];_triggers=new Map;_queue=[];_elementListeners=new Map;_hostClassName;constructor(e,s,r){this.id=e,this.hostElement=s,this._engine=r,this._hostClassName="ng-tns-"+e,z2(s,this._hostClassName)}listen(e,s,r,c){if(!this._triggers.has(s))throw Vs(r,s);if(r==null||r.length==0)throw _s(s);if(!ji(r))throw Ss(r,s);let i=m2(this._elementListeners,e,[]),a={name:s,phase:r,callback:c};i.push(a);let n=m2(this._engine.statesByElement,e,new Map);return n.has(s)||(z2(e,g4),z2(e,g4+"-"+s),n.set(s,T6)),()=>{this._engine.afterFlush(()=>{let o=i.indexOf(a);o>=0&&i.splice(o,1),this._triggers.has(s)||n.delete(s)})}}register(e,s){return this._triggers.has(e)?!1:(this._triggers.set(e,s),!0)}_getTrigger(e){let s=this._triggers.get(e);if(!s)throw Ls(e);return s}trigger(e,s,r,c=!0){let i=this._getTrigger(s),a=new V4(this.id,s,e),n=this._engine.statesByElement.get(e);n||(z2(e,g4),z2(e,g4+"-"+s),this._engine.statesByElement.set(e,n=new Map));let o=n.get(s),l=new M4(r,this.id);if(!(r&&r.hasOwnProperty("value"))&&o&&l.absorbOptions(o.options),n.set(s,l),o||(o=T6),!(l.value===H4)&&o.value===l.value){if(!Qi(o.params,l.params)){let g=[],V=i.matchStyles(o.value,o.params,g),f=i.matchStyles(l.value,l.params,g);g.length?this._engine.reportError(g):this._engine.afterFlush(()=>{s1(e,V),x2(e,f)})}return}let u=m2(this._engine.playersByElement,e,[]);u.forEach(g=>{g.namespaceId==this.id&&g.triggerName==s&&g.queued&&g.destroy()});let C=i.matchTransition(o.value,l.value,e,l.params),v=!1;if(!C){if(!c)return;C=i.fallbackTransition,v=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:s,transition:C,fromState:o,toState:l,player:a,isFallbackTransition:v}),v||(z2(e,Ds),a.onStart(()=>{O1(e,Ds)})),a.onDone(()=>{let g=this.players.indexOf(a);g>=0&&this.players.splice(g,1);let V=this._engine.playersByElement.get(e);if(V){let f=V.indexOf(a);f>=0&&V.splice(f,1)}}),this.players.push(a),u.push(a),a}deregister(e){this._triggers.delete(e),this._engine.statesByElement.forEach(s=>s.delete(e)),this._elementListeners.forEach((s,r)=>{this._elementListeners.set(r,s.filter(c=>c.name!=e))})}clearElementCache(e){this._engine.statesByElement.delete(e),this._elementListeners.delete(e);let s=this._engine.playersByElement.get(e);s&&(s.forEach(r=>r.destroy()),this._engine.playersByElement.delete(e))}_signalRemovalForInnerTriggers(e,s){let r=this._engine.driver.query(e,y4,!0);r.forEach(c=>{if(c[w2])return;let i=this._engine.fetchNamespacesByElement(c);i.size?i.forEach(a=>a.triggerLeaveAnimation(c,s,!1,!0)):this.clearElementCache(c)}),this._engine.afterFlushAnimationsDone(()=>r.forEach(c=>this.clearElementCache(c)))}triggerLeaveAnimation(e,s,r,c){let i=this._engine.statesByElement.get(e),a=new Map;if(i){let n=[];if(i.forEach((o,l)=>{if(a.set(l,o.value),this._triggers.has(l)){let m=this.trigger(e,l,H4,c);m&&n.push(m)}}),n.length)return this._engine.markElementAsRemoved(this.id,e,!0,s,a),r&&j2(n).onDone(()=>this._engine.processLeaveNode(e)),!0}return!1}prepareLeaveAnimationListeners(e){let s=this._elementListeners.get(e),r=this._engine.statesByElement.get(e);if(s&&r){let c=new Set;s.forEach(i=>{let a=i.name;if(c.has(a))return;c.add(a);let o=this._triggers.get(a).fallbackTransition,l=r.get(a)||T6,m=new M4(H4),y=new V4(this.id,a,e);this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:a,transition:o,fromState:l,toState:m,player:y,isFallbackTransition:!0})})}}removeNode(e,s){let r=this._engine;if(e.childElementCount&&this._signalRemovalForInnerTriggers(e,s),this.triggerLeaveAnimation(e,s,!0))return;let c=!1;if(r.totalAnimations){let i=r.players.length?r.playersByQueriedElement.get(e):[];if(i&&i.length)c=!0;else{let a=e;for(;a=a.parentNode;)if(r.statesByElement.get(a)){c=!0;break}}}if(this.prepareLeaveAnimationListeners(e),c)r.markElementAsRemoved(this.id,e,!1,s);else{let i=e[w2];(!i||i===Ks)&&(r.afterFlush(()=>this.clearElementCache(e)),r.destroyInnerAnimations(e),r._onRemovalComplete(e,s))}}insertNode(e,s){z2(e,this._hostClassName)}drainQueuedTransitions(e){let s=[];return this._queue.forEach(r=>{let c=r.player;if(c.destroyed)return;let i=r.element,a=this._elementListeners.get(i);a&&a.forEach(n=>{if(n.name==r.triggerName){let o=M3(i,r.triggerName,r.fromState.value,r.toState.value);o._data=e,z3(r.player,n.phase,o,n.callback)}}),c.markedForDestroy?this._engine.afterFlush(()=>{c.destroy()}):s.push(r)}),this._queue=[],s.sort((r,c)=>{let i=r.transition.ast.depCount,a=c.transition.ast.depCount;return i==0||a==0?i-a:this._engine.driver.containsElement(r.element,c.element)?1:-1})}destroy(e){this.players.forEach(s=>s.destroy()),this._signalRemovalForInnerTriggers(this.hostElement,e)}},G6=class{bodyNode;driver;_normalizer;players=[];newHostElements=new Map;playersByElement=new Map;playersByQueriedElement=new Map;statesByElement=new Map;disabledNodes=new Set;totalAnimations=0;totalQueuedPlayers=0;_namespaceLookup={};_namespaceList=[];_flushFns=[];_whenQuietFns=[];namespacesByHostElement=new Map;collectedEnterElements=[];collectedLeaveElements=[];onRemovalComplete=(e,s)=>{};_onRemovalComplete(e,s){this.onRemovalComplete(e,s)}constructor(e,s,r){this.bodyNode=e,this.driver=s,this._normalizer=r}get queuedPlayers(){let e=[];return this._namespaceList.forEach(s=>{s.players.forEach(r=>{r.queued&&e.push(r)})}),e}createNamespace(e,s){let r=new O6(e,s,this);return this.bodyNode&&this.driver.containsElement(this.bodyNode,s)?this._balanceNamespaceList(r,s):(this.newHostElements.set(s,r),this.collectEnterElement(s)),this._namespaceLookup[e]=r}_balanceNamespaceList(e,s){let r=this._namespaceList,c=this.namespacesByHostElement;if(r.length-1>=0){let a=!1,n=this.driver.getParentElement(s);for(;n;){let o=c.get(n);if(o){let l=r.indexOf(o);r.splice(l+1,0,e),a=!0;break}n=this.driver.getParentElement(n)}a||r.unshift(e)}else r.push(e);return c.set(s,e),e}register(e,s){let r=this._namespaceLookup[e];return r||(r=this.createNamespace(e,s)),r}registerTrigger(e,s,r){let c=this._namespaceLookup[e];c&&c.register(s,r)&&this.totalAnimations++}destroy(e,s){e&&(this.afterFlush(()=>{}),this.afterFlushAnimationsDone(()=>{let r=this._fetchNamespace(e);this.namespacesByHostElement.delete(r.hostElement);let c=this._namespaceList.indexOf(r);c>=0&&this._namespaceList.splice(c,1),r.destroy(s),delete this._namespaceLookup[e]}))}_fetchNamespace(e){return this._namespaceLookup[e]}fetchNamespacesByElement(e){let s=new Set,r=this.statesByElement.get(e);if(r){for(let c of r.values())if(c.namespaceId){let i=this._fetchNamespace(c.namespaceId);i&&s.add(i)}}return s}trigger(e,s,r,c){if(E3(s)){let i=this._fetchNamespace(e);if(i)return i.trigger(s,r,c),!0}return!1}insertNode(e,s,r,c){if(!E3(s))return;let i=s[w2];if(i&&i.setForRemoval){i.setForRemoval=!1,i.setForMove=!0;let a=this.collectedLeaveElements.indexOf(s);a>=0&&this.collectedLeaveElements.splice(a,1)}if(e){let a=this._fetchNamespace(e);a&&a.insertNode(s,r)}c&&this.collectEnterElement(s)}collectEnterElement(e){this.collectedEnterElements.push(e)}markElementAsDisabled(e,s){s?this.disabledNodes.has(e)||(this.disabledNodes.add(e),z2(e,E6)):this.disabledNodes.has(e)&&(this.disabledNodes.delete(e),O1(e,E6))}removeNode(e,s,r){if(E3(s)){let c=e?this._fetchNamespace(e):null;c?c.removeNode(s,r):this.markElementAsRemoved(e,s,!1,r);let i=this.namespacesByHostElement.get(s);i&&i.id!==e&&i.removeNode(s,r)}else this._onRemovalComplete(s,r)}markElementAsRemoved(e,s,r,c,i){this.collectedLeaveElements.push(s),s[w2]={namespaceId:e,setForRemoval:c,hasAnimation:r,removedBeforeQueried:!1,previousTriggersValues:i}}listen(e,s,r,c,i){return E3(s)?this._fetchNamespace(e).listen(s,r,c,i):()=>{}}_buildInstruction(e,s,r,c,i){return e.transition.build(this.driver,e.element,e.fromState.value,e.toState.value,r,c,e.fromState.options,e.toState.options,s,i)}destroyInnerAnimations(e){let s=this.driver.query(e,y4,!0);s.forEach(r=>this.destroyActiveAnimationsForElement(r)),this.playersByQueriedElement.size!=0&&(s=this.driver.query(e,S3,!0),s.forEach(r=>this.finishActiveQueriedAnimationOnElement(r)))}destroyActiveAnimationsForElement(e){let s=this.playersByElement.get(e);s&&s.forEach(r=>{r.queued?r.markedForDestroy=!0:r.destroy()})}finishActiveQueriedAnimationOnElement(e){let s=this.playersByQueriedElement.get(e);s&&s.forEach(r=>r.finish())}whenRenderingDone(){return new Promise(e=>{if(this.players.length)return j2(this.players).onDone(()=>e());e()})}processLeaveNode(e){let s=e[w2];if(s&&s.setForRemoval){if(e[w2]=Ks,s.namespaceId){this.destroyInnerAnimations(e);let r=this._fetchNamespace(s.namespaceId);r&&r.clearElementCache(e)}this._onRemovalComplete(e,s.setForRemoval)}e.classList?.contains(E6)&&this.markElementAsDisabled(e,!1),this.driver.query(e,Di,!0).forEach(r=>{this.markElementAsDisabled(r,!1)})}flush(e=-1){let s=[];if(this.newHostElements.size&&(this.newHostElements.forEach((r,c)=>this._balanceNamespaceList(r,c)),this.newHostElements.clear()),this.totalAnimations&&this.collectedEnterElements.length)for(let r=0;rr()),this._flushFns=[],this._whenQuietFns.length){let r=this._whenQuietFns;this._whenQuietFns=[],s.length?j2(s).onDone(()=>{r.forEach(c=>c())}):r.forEach(c=>c())}}reportError(e){throw bs(e)}_flushAnimations(e,s){let r=new z4,c=[],i=new Map,a=[],n=new Map,o=new Map,l=new Map,m=new Set;this.disabledNodes.forEach(b=>{m.add(b);let S=this.driver.query(b,Ri,!0);for(let M=0;M{let M=S6+g++;v.set(S,M),b.forEach(x=>z2(x,M))});let V=[],f=new Set,d=new Set;for(let b=0;bf.add(x)):d.add(S))}let p=new Map,h=Gs(u,Array.from(f));h.forEach((b,S)=>{let M=_3+g++;p.set(S,M),b.forEach(x=>z2(x,M))}),e.push(()=>{C.forEach((b,S)=>{let M=v.get(S);b.forEach(x=>O1(x,M))}),h.forEach((b,S)=>{let M=p.get(S);b.forEach(x=>O1(x,M))}),V.forEach(b=>{this.processLeaveNode(b)})});let H=[],z=[];for(let b=this._namespaceList.length-1;b>=0;b--)this._namespaceList[b].drainQueuedTransitions(s).forEach(M=>{let x=M.player,k=M.element;if(H.push(x),this.collectedEnterElements.length){let Q=k[w2];if(Q&&Q.setForMove){if(Q.previousTriggersValues&&Q.previousTriggersValues.has(M.triggerName)){let c2=Q.previousTriggersValues.get(M.triggerName),X=this.statesByElement.get(M.element);if(X&&X.has(M.triggerName)){let i2=X.get(M.triggerName);i2.value=c2,X.set(M.triggerName,i2)}}x.destroy();return}}let E=!y||!this.driver.containsElement(y,k),F=p.get(k),G=v.get(k),B=this._buildInstruction(M,r,G,F,E);if(B.errors&&B.errors.length){z.push(B);return}if(E){x.onStart(()=>s1(k,B.fromStyles)),x.onDestroy(()=>x2(k,B.toStyles)),c.push(x);return}if(M.isFallbackTransition){x.onStart(()=>s1(k,B.fromStyles)),x.onDestroy(()=>x2(k,B.toStyles)),c.push(x);return}let Z=[];B.timelines.forEach(Q=>{Q.stretchStartingKeyframe=!0,this.disabledNodes.has(Q.element)||Z.push(Q)}),B.timelines=Z,r.append(k,B.timelines);let K={instruction:B,player:x,element:k};a.push(K),B.queriedElements.forEach(Q=>m2(n,Q,[]).push(x)),B.preStyleProps.forEach((Q,c2)=>{if(Q.size){let X=o.get(c2);X||o.set(c2,X=new Set),Q.forEach((i2,t2)=>X.add(t2))}}),B.postStyleProps.forEach((Q,c2)=>{let X=l.get(c2);X||l.set(c2,X=new Set),Q.forEach((i2,t2)=>X.add(t2))})});if(z.length){let b=[];z.forEach(S=>{b.push(xs(S.triggerName,S.errors))}),H.forEach(S=>S.destroy()),this.reportError(b)}let _=new Map,L=new Map;a.forEach(b=>{let S=b.element;r.has(S)&&(L.set(S,S),this._beforeAnimationBuild(b.player.namespaceId,b.instruction,_))}),c.forEach(b=>{let S=b.element;this._getPreviousPlayers(S,!1,b.namespaceId,b.triggerName,null).forEach(x=>{m2(_,S,[]).push(x),x.destroy()})});let w=V.filter(b=>Us(b,o,l)),N=new Map;Os(N,this.driver,d,l,_2).forEach(b=>{Us(b,o,l)&&w.push(b)});let P=new Map;C.forEach((b,S)=>{Os(P,this.driver,new Set(b),o,X1)}),w.forEach(b=>{let S=N.get(b),M=P.get(b);N.set(b,new Map([...S?.entries()??[],...M?.entries()??[]]))});let I=[],D=[],T={};a.forEach(b=>{let{element:S,player:M,instruction:x}=b;if(r.has(S)){if(m.has(S)){M.onDestroy(()=>x2(S,x.toStyles)),M.disabled=!0,M.overrideTotalTime(x.totalTime),c.push(M);return}let k=T;if(L.size>1){let F=S,G=[];for(;F=F.parentNode;){let B=L.get(F);if(B){k=B;break}G.push(F)}G.forEach(B=>L.set(B,k))}let E=this._buildAnimation(M.namespaceId,x,_,i,P,N);if(M.setRealPlayer(E),k===T)I.push(M);else{let F=this.playersByElement.get(k);F&&F.length&&(M.parentPlayer=j2(F)),c.push(M)}}else s1(S,x.fromStyles),M.onDestroy(()=>x2(S,x.toStyles)),D.push(M),m.has(S)&&c.push(M)}),D.forEach(b=>{let S=i.get(b.element);if(S&&S.length){let M=j2(S);b.setRealPlayer(M)}}),c.forEach(b=>{b.parentPlayer?b.syncPlayerEvents(b.parentPlayer):b.destroy()});for(let b=0;b!E.destroyed);k.length?$i(this,S,k):this.processLeaveNode(S)}return V.length=0,I.forEach(b=>{this.players.push(b),b.onDone(()=>{b.destroy();let S=this.players.indexOf(b);this.players.splice(S,1)}),b.play()}),I}afterFlush(e){this._flushFns.push(e)}afterFlushAnimationsDone(e){this._whenQuietFns.push(e)}_getPreviousPlayers(e,s,r,c,i){let a=[];if(s){let n=this.playersByQueriedElement.get(e);n&&(a=n)}else{let n=this.playersByElement.get(e);if(n){let o=!i||i==H4;n.forEach(l=>{l.queued||!o&&l.triggerName!=c||a.push(l)})}}return(r||c)&&(a=a.filter(n=>!(r&&r!=n.namespaceId||c&&c!=n.triggerName))),a}_beforeAnimationBuild(e,s,r){let c=s.triggerName,i=s.element,a=s.isRemovalTransition?void 0:e,n=s.isRemovalTransition?void 0:c;for(let o of s.timelines){let l=o.element,m=l!==i,y=m2(r,l,[]);this._getPreviousPlayers(l,m,a,n,s.toState).forEach(C=>{let v=C.getRealPlayer();v.beforeDestroy&&v.beforeDestroy(),C.destroy(),y.push(C)})}s1(i,s.fromStyles)}_buildAnimation(e,s,r,c,i,a){let n=s.triggerName,o=s.element,l=[],m=new Set,y=new Set,u=s.timelines.map(v=>{let g=v.element;m.add(g);let V=g[w2];if(V&&V.removedBeforeQueried)return new n1(v.duration,v.delay);let f=g!==o,d=Ki((r.get(g)||Gi).map(_=>_.getRealPlayer())).filter(_=>{let L=_;return L.element?L.element===g:!1}),p=i.get(g),h=a.get(g),H=H6(this._normalizer,v.keyframes,p,h),z=this._buildPlayer(v,H,d);if(v.subTimeline&&c&&y.add(g),f){let _=new V4(e,n,g);_.setRealPlayer(z),l.push(_)}return z});l.forEach(v=>{m2(this.playersByQueriedElement,v.element,[]).push(v),v.onDone(()=>qi(this.playersByQueriedElement,v.element,v))}),m.forEach(v=>z2(v,L6));let C=j2(u);return C.onDestroy(()=>{m.forEach(v=>O1(v,L6)),x2(o,s.toStyles)}),y.forEach(v=>{m2(c,v,[]).push(C)}),C}_buildPlayer(e,s,r){return s.length>0?this.driver.animate(e.element,s,e.duration,e.delay,e.easing,r):new n1(e.duration,e.delay)}},V4=class{namespaceId;triggerName;element;_player=new n1;_containsRealPlayer=!1;_queuedCallbacks=new Map;destroyed=!1;parentPlayer=null;markedForDestroy=!1;disabled=!1;queued=!0;totalTime=0;constructor(e,s,r){this.namespaceId=e,this.triggerName=s,this.element=r}setRealPlayer(e){this._containsRealPlayer||(this._player=e,this._queuedCallbacks.forEach((s,r)=>{s.forEach(c=>z3(e,r,void 0,c))}),this._queuedCallbacks.clear(),this._containsRealPlayer=!0,this.overrideTotalTime(e.totalTime),this.queued=!1)}getRealPlayer(){return this._player}overrideTotalTime(e){this.totalTime=e}syncPlayerEvents(e){let s=this._player;s.triggerCallback&&e.onStart(()=>s.triggerCallback("start")),e.onDone(()=>this.finish()),e.onDestroy(()=>this.destroy())}_queueEvent(e,s){m2(this._queuedCallbacks,e,[]).push(s)}onDone(e){this.queued&&this._queueEvent("done",e),this._player.onDone(e)}onStart(e){this.queued&&this._queueEvent("start",e),this._player.onStart(e)}onDestroy(e){this.queued&&this._queueEvent("destroy",e),this._player.onDestroy(e)}init(){this._player.init()}hasStarted(){return this.queued?!1:this._player.hasStarted()}play(){!this.queued&&this._player.play()}pause(){!this.queued&&this._player.pause()}restart(){!this.queued&&this._player.restart()}finish(){this._player.finish()}destroy(){this.destroyed=!0,this._player.destroy()}reset(){!this.queued&&this._player.reset()}setPosition(e){this.queued||this._player.setPosition(e)}getPosition(){return this.queued?0:this._player.getPosition()}triggerCallback(e){let s=this._player;s.triggerCallback&&s.triggerCallback(e)}};function qi(t,e,s){let r=t.get(e);if(r){if(r.length){let c=r.indexOf(s);r.splice(c,1)}r.length==0&&t.delete(e)}return r}function Wi(t){return t??null}function E3(t){return t&&t.nodeType===1}function ji(t){return t=="start"||t=="done"}function Bs(t,e){let s=t.style.display;return t.style.display=e??"none",s}function Os(t,e,s,r,c){let i=[];s.forEach(o=>i.push(Bs(o)));let a=[];r.forEach((o,l)=>{let m=new Map;o.forEach(y=>{let u=e.computeStyle(l,y,c);m.set(y,u),(!u||u.length==0)&&(l[w2]=Ui,a.push(l))}),t.set(l,m)});let n=0;return s.forEach(o=>Bs(o,i[n++])),a}function Gs(t,e){let s=new Map;if(t.forEach(n=>s.set(n,[])),e.length==0)return s;let r=1,c=new Set(e),i=new Map;function a(n){if(!n)return r;let o=i.get(n);if(o)return o;let l=n.parentNode;return s.has(l)?o=l:c.has(l)?o=r:o=a(l),i.set(n,o),o}return e.forEach(n=>{let o=a(n);o!==r&&s.get(o).push(n)}),s}function z2(t,e){t.classList?.add(e)}function O1(t,e){t.classList?.remove(e)}function $i(t,e,s){j2(s).onDone(()=>t.processLeaveNode(e))}function Ki(t){let e=[];return Qs(t,e),e}function Qs(t,e){for(let s=0;sc.add(i)):e.set(t,r),s.delete(t),!0}var G1=class{_driver;_normalizer;_transitionEngine;_timelineEngine;_triggerCache={};onRemovalComplete=(e,s)=>{};constructor(e,s,r){this._driver=s,this._normalizer=r,this._transitionEngine=new G6(e.body,s,r),this._timelineEngine=new B6(e.body,s,r),this._transitionEngine.onRemovalComplete=(c,i)=>this.onRemovalComplete(c,i)}registerTrigger(e,s,r,c,i){let a=e+"-"+c,n=this._triggerCache[a];if(!n){let o=[],l=[],m=Ws(this._driver,i,o,l);if(o.length)throw ys(c,o);n=Ni(c,m,this._normalizer),this._triggerCache[a]=n}this._transitionEngine.registerTrigger(s,c,n)}register(e,s){this._transitionEngine.register(e,s)}destroy(e,s){this._transitionEngine.destroy(e,s)}onInsert(e,s,r,c){this._transitionEngine.insertNode(e,s,r,c)}onRemove(e,s,r){this._transitionEngine.removeNode(e,s,r)}disableAnimations(e,s){this._transitionEngine.markElementAsDisabled(e,s)}process(e,s,r,c){if(r.charAt(0)=="@"){let[i,a]=z6(r),n=c;this._timelineEngine.command(i,s,a,n)}else this._transitionEngine.trigger(e,s,r,c)}listen(e,s,r,c,i){if(r.charAt(0)=="@"){let[a,n]=z6(r);return this._timelineEngine.listen(a,s,n,i)}return this._transitionEngine.listen(e,s,r,c,i)}flush(e=-1){this._transitionEngine.flush(e)}get players(){return[...this._transitionEngine.players,...this._timelineEngine.players]}whenRenderingDone(){return this._transitionEngine.whenRenderingDone()}afterFlushAnimationsDone(e){this._transitionEngine.afterFlushAnimationsDone(e)}};function Yi(t,e){let s=null,r=null;return Array.isArray(e)&&e.length?(s=k6(e[0]),e.length>1&&(r=k6(e[e.length-1]))):e instanceof Map&&(s=k6(e)),s||r?new Xi(t,s,r):null}var Xi=(()=>{class t{_element;_startStyles;_endStyles;static initialStylesByElement=new WeakMap;_state=0;_initialStyles;constructor(s,r,c){this._element=s,this._startStyles=r,this._endStyles=c;let i=t.initialStylesByElement.get(s);i||t.initialStylesByElement.set(s,i=new Map),this._initialStyles=i}start(){this._state<1&&(this._startStyles&&x2(this._element,this._startStyles,this._initialStyles),this._state=1)}finish(){this.start(),this._state<2&&(x2(this._element,this._initialStyles),this._endStyles&&(x2(this._element,this._endStyles),this._endStyles=null),this._state=1)}destroy(){this.finish(),this._state<3&&(t.initialStylesByElement.delete(this._element),this._startStyles&&(s1(this._element,this._startStyles),this._endStyles=null),this._endStyles&&(s1(this._element,this._endStyles),this._endStyles=null),x2(this._element,this._initialStyles),this._state=3)}}return t})();function k6(t){let e=null;return t.forEach((s,r)=>{Ji(r)&&(e=e||new Map,e.set(r,s))}),e}function Ji(t){return t==="display"||t==="position"}var F3=class{element;keyframes;options;_specialStyles;_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_duration;_delay;_initialized=!1;_finished=!1;_started=!1;_destroyed=!1;_finalKeyframe;_originalOnDoneFns=[];_originalOnStartFns=[];domPlayer;time=0;parentPlayer=null;currentSnapshot=new Map;constructor(e,s,r,c){this.element=e,this.keyframes=s,this.options=r,this._specialStyles=c,this._duration=r.duration,this._delay=r.delay||0,this.time=this._duration+this._delay}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}init(){this._buildPlayer(),this._preparePlayerBeforeStart()}_buildPlayer(){if(this._initialized)return;this._initialized=!0;let e=this.keyframes;this.domPlayer=this._triggerWebAnimation(this.element,e,this.options),this._finalKeyframe=e.length?e[e.length-1]:new Map;let s=()=>this._onFinish();this.domPlayer.addEventListener("finish",s),this.onDestroy(()=>{this.domPlayer.removeEventListener("finish",s)})}_preparePlayerBeforeStart(){this._delay?this._resetDomPlayerState():this.domPlayer.pause()}_convertKeyframesToObject(e){let s=[];return e.forEach(r=>{s.push(Object.fromEntries(r))}),s}_triggerWebAnimation(e,s,r){return e.animate(this._convertKeyframesToObject(s),r)}onStart(e){this._originalOnStartFns.push(e),this._onStartFns.push(e)}onDone(e){this._originalOnDoneFns.push(e),this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}play(){this._buildPlayer(),this.hasStarted()||(this._onStartFns.forEach(e=>e()),this._onStartFns=[],this._started=!0,this._specialStyles&&this._specialStyles.start()),this.domPlayer.play()}pause(){this.init(),this.domPlayer.pause()}finish(){this.init(),this._specialStyles&&this._specialStyles.finish(),this._onFinish(),this.domPlayer.finish()}reset(){this._resetDomPlayerState(),this._destroyed=!1,this._finished=!1,this._started=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}_resetDomPlayerState(){this.domPlayer&&this.domPlayer.cancel()}restart(){this.reset(),this.play()}hasStarted(){return this._started}destroy(){this._destroyed||(this._destroyed=!0,this._resetDomPlayerState(),this._onFinish(),this._specialStyles&&this._specialStyles.destroy(),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}setPosition(e){this.domPlayer===void 0&&this.init(),this.domPlayer.currentTime=e*this.time}getPosition(){return+(this.domPlayer.currentTime??0)/this.time}get totalTime(){return this._delay+this._duration}beforeDestroy(){let e=new Map;this.hasStarted()&&this._finalKeyframe.forEach((r,c)=>{c!=="offset"&&e.set(c,this._finished?r:b3(this.element,c))}),this.currentSnapshot=e}triggerCallback(e){let s=e==="start"?this._onStartFns:this._onDoneFns;s.forEach(r=>r()),s.length=0}},R3=class{validateStyleProperty(e){return!0}validateAnimatableStyleProperty(e){return!0}containsElement(e,s){return M6(e,s)}getParentElement(e){return V3(e)}query(e,s,r){return V6(e,s,r)}computeStyle(e,s,r){return b3(e,s)}animate(e,s,r,c,i,a=[]){let n=c==0?"both":"forwards",o={duration:r,delay:c,fill:n};i&&(o.easing=i);let l=new Map,m=a.filter(C=>C instanceof F3);ks(r,c)&&m.forEach(C=>{C.currentSnapshot.forEach((v,g)=>l.set(g,v))});let y=Es(s).map(C=>new Map(C));y=Ps(e,y,l);let u=Yi(e,y);return new F3(e,y,o,u)}};var T3="@",Ys="@.disabled",D3=class{namespaceId;delegate;engine;_onDestroy;\u0275type=0;constructor(e,s,r,c){this.namespaceId=e,this.delegate=s,this.engine=r,this._onDestroy=c}get data(){return this.delegate.data}destroyNode(e){this.delegate.destroyNode?.(e)}destroy(){this.engine.destroy(this.namespaceId,this.delegate),this.engine.afterFlushAnimationsDone(()=>{queueMicrotask(()=>{this.delegate.destroy()})}),this._onDestroy?.()}createElement(e,s){return this.delegate.createElement(e,s)}createComment(e){return this.delegate.createComment(e)}createText(e){return this.delegate.createText(e)}appendChild(e,s){this.delegate.appendChild(e,s),this.engine.onInsert(this.namespaceId,s,e,!1)}insertBefore(e,s,r,c=!0){this.delegate.insertBefore(e,s,r),this.engine.onInsert(this.namespaceId,s,e,c)}removeChild(e,s,r){this.parentNode(s)&&this.engine.onRemove(this.namespaceId,s,this.delegate)}selectRootElement(e,s){return this.delegate.selectRootElement(e,s)}parentNode(e){return this.delegate.parentNode(e)}nextSibling(e){return this.delegate.nextSibling(e)}setAttribute(e,s,r,c){this.delegate.setAttribute(e,s,r,c)}removeAttribute(e,s,r){this.delegate.removeAttribute(e,s,r)}addClass(e,s){this.delegate.addClass(e,s)}removeClass(e,s){this.delegate.removeClass(e,s)}setStyle(e,s,r,c){this.delegate.setStyle(e,s,r,c)}removeStyle(e,s,r){this.delegate.removeStyle(e,s,r)}setProperty(e,s,r){s.charAt(0)==T3&&s==Ys?this.disableAnimations(e,!!r):this.delegate.setProperty(e,s,r)}setValue(e,s){this.delegate.setValue(e,s)}listen(e,s,r,c){return this.delegate.listen(e,s,r,c)}disableAnimations(e,s){this.engine.disableAnimations(e,s)}},U6=class extends D3{factory;constructor(e,s,r,c,i){super(s,r,c,i),this.factory=e,this.namespaceId=s}setProperty(e,s,r){s.charAt(0)==T3?s.charAt(1)=="."&&s==Ys?(r=r===void 0?!0:!!r,this.disableAnimations(e,r)):this.engine.process(this.namespaceId,e,s.slice(1),r):this.delegate.setProperty(e,s,r)}listen(e,s,r,c){if(s.charAt(0)==T3){let i=Zi(e),a=s.slice(1),n="";return a.charAt(0)!=T3&&([a,n]=ea(a)),this.engine.listen(this.namespaceId,i,a,n,o=>{let l=o._data||-1;this.factory.scheduleListenerCallback(l,r,o)})}return this.delegate.listen(e,s,r,c)}};function Zi(t){switch(t){case"body":return document.body;case"document":return document;case"window":return window;default:return t}}function ea(t){let e=t.indexOf("."),s=t.substring(0,e),r=t.slice(e+1);return[s,r]}var B3=class{delegate;engine;_zone;_currentId=0;_microtaskId=1;_animationCallbacksBuffer=[];_rendererCache=new Map;_cdRecurDepth=0;constructor(e,s,r){this.delegate=e,this.engine=s,this._zone=r,s.onRemovalComplete=(c,i)=>{i?.removeChild(null,c)}}createRenderer(e,s){let c=this.delegate.createRenderer(e,s);if(!e||!s?.data?.animation){let l=this._rendererCache,m=l.get(c);if(!m){let y=()=>l.delete(c);m=new D3("",c,this.engine,y),l.set(c,m)}return m}let i=s.id,a=s.id+"-"+this._currentId;this._currentId++,this.engine.register(a,e);let n=l=>{Array.isArray(l)?l.forEach(n):this.engine.registerTrigger(i,a,e,l.name,l)};return s.data.animation.forEach(n),new U6(this,a,c,this.engine)}begin(){this._cdRecurDepth++,this.delegate.begin&&this.delegate.begin()}_scheduleCountTask(){queueMicrotask(()=>{this._microtaskId++})}scheduleListenerCallback(e,s,r){if(e>=0&&es(r));return}let c=this._animationCallbacksBuffer;c.length==0&&queueMicrotask(()=>{this._zone.run(()=>{c.forEach(i=>{let[a,n]=i;a(n)}),this._animationCallbacksBuffer=[]})}),c.push([s,r])}end(){this._cdRecurDepth--,this._cdRecurDepth==0&&this._zone.runOutsideAngular(()=>{this._scheduleCountTask(),this.engine.flush(this._microtaskId)}),this.delegate.end&&this.delegate.end()}whenRenderingDone(){return this.engine.whenRenderingDone()}componentReplaced(e){this.engine.flush(),this.delegate.componentReplaced?.(e)}};var sa=(()=>{class t extends G1{constructor(s,r,c){super(s,r,c)}ngOnDestroy(){this.flush()}static \u0275fac=function(r){return new(r||t)(x4(K6),x4(g1),x4(y1))};static \u0275prov=H1({token:t,factory:t.\u0275fac})}return t})();function ra(){return new k3}function ca(t,e,s){return new B3(t,e,s)}var Xs=[{provide:y1,useFactory:ra},{provide:G1,useClass:sa},{provide:X6,useFactory:ca,deps:[nt,G1,M1]}],Nn=[{provide:g1,useClass:q6},{provide:G3,useValue:"NoopAnimations"},...Xs],ia=[{provide:g1,useFactory:()=>new R3},{provide:G3,useFactory:()=>"BrowserAnimations"},...Xs];function Js(){return J6("NgEagerAnimations"),[...ia]}q3.production&&void 0;ot(Zt,{providers:[vt(e0),{provide:pt,useClass:H3},At(()=>Nt(q3.firebase)),Kt(()=>Wt()),U8(()=>i6()),Dt(()=>Rt()),es(()=>m6()),Ft(()=>It()),$t,jt,Js(),O3(Ut),qt({positionClass:"toast-bottom-right",preventDuplicates:!0}),O3(Ot.forRoot()),Bt({player:()=>Zs.default})]}).catch(t=>console.error(t));