UNPKG

dragonbones-pixijs

Version:
1 lines 207 kB
(function(I,W){typeof exports=="object"&&typeof module<"u"?W(exports,require("pixi.js")):typeof define=="function"&&define.amd?define(["exports","pixi.js"],W):(I=typeof globalThis<"u"?globalThis:I||self,W(I.DragonBonesPixi={},I.PIXI))})(this,function(I,W){"use strict";var Je=Object.defineProperty;var $e=(I,W,Ft)=>W in I?Je(I,W,{enumerable:!0,configurable:!0,writable:!0,value:Ft}):I[W]=Ft;var a=(I,W,Ft)=>($e(I,typeof W!="symbol"?W+"":W,Ft),Ft);function Ft(u){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const t in u)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(u,t);Object.defineProperty(l,t,e.get?e:{enumerable:!0,get:()=>u[t]})}}return l.default=u,Object.freeze(l)}const Gt=Ft(W);class me{constructor(l=0){a(this,"time",0);a(this,"timeScale",1);a(this,"_systemTime",0);a(this,"_animatebles",[]);a(this,"_clock",null);this.time=l,this._systemTime=new Date().getTime()*.001}advanceTime(l){l!==l&&(l=0);const t=Date.now()*.001;if(l<0&&(l=t-this._systemTime),this._systemTime=t,this.timeScale!==1&&(l*=this.timeScale),l===0)return;l<0?this.time-=l:this.time+=l;let e=0,i=0,s=this._animatebles.length;for(;e<s;++e){const n=this._animatebles[e];n!==null?(i>0&&(this._animatebles[e-i]=n,this._animatebles[e]=null),n.advanceTime(l)):i++}if(i>0){for(s=this._animatebles.length;e<s;++e){const n=this._animatebles[e];n!==null?this._animatebles[e-i]=n:i++}this._animatebles.length-=i}}contains(l){if(l===this)return!1;let t=l;for(;t!==this&&t!==null;)t=t.clock;return t===this}add(l){this._animatebles.indexOf(l)<0&&(this._animatebles.push(l),l.clock=this)}remove(l){const t=this._animatebles.indexOf(l);t>=0&&(this._animatebles[t]=null,l.clock=null)}clear(){for(const l of this._animatebles)l!==null&&(l.clock=null)}get clock(){return this._clock}set clock(l){this._clock!==l&&(this._clock!==null&&this._clock.remove(this),this._clock=l,this._clock!==null&&this._clock.add(this))}}const K=class K{constructor(){a(this,"hashCode",K._hashCode++);a(this,"_isInPool",!1)}static _returnObject(l){const t=String(l.constructor),e=t in K._maxCountMap?K._maxCountMap[t]:K._defaultMaxCount,i=K._poolsMap[t]=K._poolsMap[t]||[];i.length<e&&(l._isInPool?console.warn("The object is already in the pool."):(l._isInPool=!0,i.push(l)))}static toString(){throw new Error}static setMaxCount(l,t){if((t<0||t!==t)&&(t=0),l!==null){const e=String(l),i=e in K._poolsMap?K._poolsMap[e]:null;i!==null&&i.length>t&&(i.length=t),K._maxCountMap[e]=t}else{K._defaultMaxCount=t;for(let e in K._poolsMap){const i=K._poolsMap[e];i.length>t&&(i.length=t),e in K._maxCountMap&&(K._maxCountMap[e]=t)}}}static clearPool(l=null){if(l!==null){const t=String(l),e=t in K._poolsMap?K._poolsMap[t]:null;e!==null&&e.length>0&&(e.length=0)}else for(let t in K._poolsMap){const e=K._poolsMap[t];e.length=0}}static borrowObject(l){const t=String(l),e=t in K._poolsMap?K._poolsMap[t]:null;if(e!==null&&e.length>0){const s=e.pop();return s._isInPool=!1,s}const i=new l;return i._onClear(),i}returnToPool(){this._onClear(),K._returnObject(this)}};a(K,"_hashCode",0),a(K,"_defaultMaxCount",3e3),a(K,"_maxCountMap",{}),a(K,"_poolsMap",{});let F=K;const ct=class ct extends F{constructor(){super(...arguments);a(this,"time");a(this,"type");a(this,"name");a(this,"armature");a(this,"bone");a(this,"slot");a(this,"animationState");a(this,"actionData");a(this,"data")}static actionDataToInstance(t,e,i){t.type===q.Play?e.type=ct.FRAME_EVENT:e.type=t.type===q.Frame?ct.FRAME_EVENT:ct.SOUND_EVENT,e.name=t.name,e.armature=i,e.actionData=t,e.data=t.data,t.bone!==null&&(e.bone=i.getBone(t.bone.name)),t.slot!==null&&(e.slot=i.getSlot(t.slot.name))}static toString(){return"[class dragonBones.EventObject]"}_onClear(){this.time=0,this.type="",this.name="",this.armature=null,this.bone=null,this.slot=null,this.animationState=null,this.actionData=null,this.data=null}};a(ct,"START","start"),a(ct,"LOOP_COMPLETE","loopComplete"),a(ct,"COMPLETE","complete"),a(ct,"FADE_IN","fadeIn"),a(ct,"FADE_IN_COMPLETE","fadeInComplete"),a(ct,"FADE_OUT","fadeOut"),a(ct,"FADE_OUT_COMPLETE","fadeOutComplete"),a(ct,"FRAME_EVENT","frameEvent"),a(ct,"SOUND_EVENT","soundEvent");let j=ct;var x=(u=>(u[u.WeigthBoneCount=0]="WeigthBoneCount",u[u.WeigthFloatOffset=1]="WeigthFloatOffset",u[u.WeigthBoneIndices=2]="WeigthBoneIndices",u[u.GeometryVertexCount=0]="GeometryVertexCount",u[u.GeometryTriangleCount=1]="GeometryTriangleCount",u[u.GeometryFloatOffset=2]="GeometryFloatOffset",u[u.GeometryWeightOffset=3]="GeometryWeightOffset",u[u.GeometryVertexIndices=4]="GeometryVertexIndices",u[u.TimelineScale=0]="TimelineScale",u[u.TimelineOffset=1]="TimelineOffset",u[u.TimelineKeyFrameCount=2]="TimelineKeyFrameCount",u[u.TimelineFrameValueCount=3]="TimelineFrameValueCount",u[u.TimelineFrameValueOffset=4]="TimelineFrameValueOffset",u[u.TimelineFrameOffset=5]="TimelineFrameOffset",u[u.FramePosition=0]="FramePosition",u[u.FrameTweenType=1]="FrameTweenType",u[u.FrameTweenEasingOrCurveSampleCount=2]="FrameTweenEasingOrCurveSampleCount",u[u.FrameCurveSamples=3]="FrameCurveSamples",u[u.DeformVertexOffset=0]="DeformVertexOffset",u[u.DeformCount=1]="DeformCount",u[u.DeformValueCount=2]="DeformValueCount",u[u.DeformValueOffset=3]="DeformValueOffset",u[u.DeformFloatOffset=4]="DeformFloatOffset",u))(x||{}),Dt=(u=>(u[u.Armature=0]="Armature",u[u.MovieClip=1]="MovieClip",u[u.Stage=2]="Stage",u))(Dt||{}),$=(u=>(u[u.Bone=0]="Bone",u[u.Surface=1]="Surface",u))($||{}),L=(u=>(u[u.Image=0]="Image",u[u.Armature=1]="Armature",u[u.Mesh=2]="Mesh",u[u.BoundingBox=3]="BoundingBox",u[u.Path=4]="Path",u))(L||{}),it=(u=>(u[u.Rectangle=0]="Rectangle",u[u.Ellipse=1]="Ellipse",u[u.Polygon=2]="Polygon",u))(it||{}),q=(u=>(u[u.Play=0]="Play",u[u.Frame=10]="Frame",u[u.Sound=11]="Sound",u))(q||{}),z=(u=>(u[u.Normal=0]="Normal",u[u.Add=1]="Add",u[u.Alpha=2]="Alpha",u[u.Darken=3]="Darken",u[u.Difference=4]="Difference",u[u.Erase=5]="Erase",u[u.HardLight=6]="HardLight",u[u.Invert=7]="Invert",u[u.Layer=8]="Layer",u[u.Lighten=9]="Lighten",u[u.Multiply=10]="Multiply",u[u.Overlay=11]="Overlay",u[u.Screen=12]="Screen",u[u.Subtract=13]="Subtract",u))(z||{}),J=(u=>(u[u.None=0]="None",u[u.Line=1]="Line",u[u.Curve=2]="Curve",u[u.QuadIn=3]="QuadIn",u[u.QuadOut=4]="QuadOut",u[u.QuadInOut=5]="QuadInOut",u))(J||{}),E=(u=>(u[u.Action=0]="Action",u[u.ZOrder=1]="ZOrder",u[u.BoneAll=10]="BoneAll",u[u.BoneTranslate=11]="BoneTranslate",u[u.BoneRotate=12]="BoneRotate",u[u.BoneScale=13]="BoneScale",u[u.Surface=50]="Surface",u[u.BoneAlpha=60]="BoneAlpha",u[u.SlotDisplay=20]="SlotDisplay",u[u.SlotColor=21]="SlotColor",u[u.SlotDeform=22]="SlotDeform",u[u.SlotZIndex=23]="SlotZIndex",u[u.SlotAlpha=24]="SlotAlpha",u[u.IKConstraint=30]="IKConstraint",u[u.AnimationProgress=40]="AnimationProgress",u[u.AnimationWeight=41]="AnimationWeight",u[u.AnimationParameter=42]="AnimationParameter",u))(E||{}),vt=(u=>(u[u.None=0]="None",u[u.Additive=1]="Additive",u[u.Override=2]="Override",u))(vt||{}),mt=(u=>(u[u.SameLayer=1]="SameLayer",u[u.SameGroup=2]="SameGroup",u[u.SameLayerAndGroup=3]="SameLayerAndGroup",u[u.All=4]="All",u[u.Single=5]="Single",u))(mt||{}),dt=(u=>(u[u.None=0]="None",u[u.E1D=1]="E1D",u))(dt||{}),de=(u=>(u[u.Additive=0]="Additive",u[u.Override=1]="Override",u))(de||{}),It=(u=>(u[u.IK=0]="IK",u[u.Path=1]="Path",u))(It||{}),Et=(u=>(u[u.Fixed=0]="Fixed",u[u.Percent=1]="Percent",u))(Et||{}),Tt=(u=>(u[u.Length=0]="Length",u[u.Fixed=1]="Fixed",u[u.Percent=2]="Percent",u))(Tt||{}),pt=(u=>(u[u.Tangent=0]="Tangent",u[u.Chain=1]="Chain",u[u.ChainScale=2]="ChainScale",u))(pt||{});class ut{constructor(l){a(this,"_clock",new me);a(this,"_events",[]);a(this,"_objects",[]);a(this,"_eventManager",null);this._eventManager=l}advanceTime(l){if(this._objects.length>0){for(const t of this._objects)t.returnToPool();this._objects.length=0}if(this._clock.advanceTime(l),this._events.length>0){for(let t=0;t<this._events.length;++t){const e=this._events[t],i=e.armature;i._armatureData!==null&&(i.eventDispatcher.dispatchDBEvent(e.type,e),e.type===j.SOUND_EVENT&&this._eventManager.dispatchDBEvent(e.type,e)),this.bufferObject(e)}this._events.length=0}}bufferEvent(l){this._events.indexOf(l)<0&&this._events.push(l)}bufferObject(l){this._objects.indexOf(l)<0&&this._objects.push(l)}get clock(){return this._clock}get eventManager(){return this._eventManager}}a(ut,"VERSION","5.7.000"),a(ut,"yDown",!0),a(ut,"debug",!1),a(ut,"debugDraw",!1);class pe extends F{constructor(){super(...arguments);a(this,"pauseFadeOut");a(this,"fadeOutMode");a(this,"fadeOutTweenType");a(this,"fadeOutTime");a(this,"pauseFadeIn");a(this,"actionEnabled");a(this,"additive");a(this,"displayControl");a(this,"resetToPose");a(this,"fadeInTweenType");a(this,"playTimes");a(this,"layer");a(this,"position");a(this,"duration");a(this,"timeScale");a(this,"weight");a(this,"fadeInTime");a(this,"autoFadeOutTime");a(this,"name");a(this,"animation");a(this,"group");a(this,"boneMask",[])}static toString(){return"[class dragonBones.AnimationConfig]"}_onClear(){this.pauseFadeOut=!0,this.fadeOutMode=mt.All,this.fadeOutTweenType=J.Line,this.fadeOutTime=-1,this.actionEnabled=!0,this.additive=!1,this.displayControl=!0,this.pauseFadeIn=!0,this.resetToPose=!0,this.fadeInTweenType=J.Line,this.playTimes=-1,this.layer=0,this.position=0,this.duration=-1,this.timeScale=-100,this.weight=1,this.fadeInTime=-1,this.autoFadeOutTime=-1,this.name="",this.animation="",this.group="",this.boneMask.length=0}clear(){this._onClear()}copyFrom(t){this.pauseFadeOut=t.pauseFadeOut,this.fadeOutMode=t.fadeOutMode,this.autoFadeOutTime=t.autoFadeOutTime,this.fadeOutTweenType=t.fadeOutTweenType,this.actionEnabled=t.actionEnabled,this.additive=t.additive,this.displayControl=t.displayControl,this.pauseFadeIn=t.pauseFadeIn,this.resetToPose=t.resetToPose,this.playTimes=t.playTimes,this.layer=t.layer,this.position=t.position,this.duration=t.duration,this.timeScale=t.timeScale,this.fadeInTime=t.fadeInTime,this.fadeOutTime=t.fadeOutTime,this.fadeInTweenType=t.fadeInTweenType,this.weight=t.weight,this.name=t.name,this.animation=t.animation,this.group=t.group,this.boneMask.length=t.boneMask.length;for(let e=0,i=this.boneMask.length;e<i;++e)this.boneMask[e]=t.boneMask[e]}}class Rt extends F{constructor(){super(...arguments);a(this,"dirty");a(this,"playState");a(this,"currentPlayTimes");a(this,"currentTime");a(this,"target");a(this,"_isTween");a(this,"_valueOffset");a(this,"_frameValueOffset");a(this,"_frameOffset");a(this,"_frameRate");a(this,"_frameCount");a(this,"_frameIndex");a(this,"_frameRateR");a(this,"_position");a(this,"_duration");a(this,"_timeScale");a(this,"_timeOffset");a(this,"_animationData");a(this,"_timelineData");a(this,"_armature");a(this,"_animationState");a(this,"_actionTimeline");a(this,"_timelineArray");a(this,"_frameArray");a(this,"_valueArray");a(this,"_frameIndices")}_onClear(){this.dirty=!1,this.playState=-1,this.currentPlayTimes=0,this.currentTime=-1,this.target=null,this._isTween=!1,this._valueOffset=0,this._frameValueOffset=0,this._frameOffset=0,this._frameRate=0,this._frameCount=0,this._frameIndex=-1,this._frameRateR=0,this._position=0,this._duration=0,this._timeScale=1,this._timeOffset=0,this._animationData=null,this._timelineData=null,this._armature=null,this._animationState=null,this._actionTimeline=null,this._frameArray=null,this._valueArray=null,this._timelineArray=null,this._frameIndices=null}_setCurrentTime(t){const e=this.playState,i=this.currentPlayTimes,s=this.currentTime;if(this._actionTimeline!==null&&this._frameCount<=1)this.playState=this._actionTimeline.playState>=0?1:-1,this.currentPlayTimes=1,this.currentTime=this._actionTimeline.currentTime;else if(this._actionTimeline===null||this._timeScale!==1||this._timeOffset!==0){const n=this._animationState.playTimes,r=n*this._duration;t*=this._timeScale,this._timeOffset!==0&&(t+=this._timeOffset*this._animationData.duration),n>0&&(t>=r||t<=-r)?(this.playState<=0&&this._animationState._playheadState===3&&(this.playState=1),this.currentPlayTimes=n,t<0?this.currentTime=0:this.currentTime=this.playState===1?this._duration+1e-6:this._duration):(this.playState!==0&&this._animationState._playheadState===3&&(this.playState=0),t<0?(t=-t,this.currentPlayTimes=Math.floor(t/this._duration),this.currentTime=this._duration-t%this._duration):(this.currentPlayTimes=Math.floor(t/this._duration),this.currentTime=t%this._duration)),this.currentTime+=this._position}else this.playState=this._actionTimeline.playState,this.currentPlayTimes=this._actionTimeline.currentPlayTimes,this.currentTime=this._actionTimeline.currentTime;return this.currentPlayTimes===i&&this.currentTime===s?!1:((e<0&&this.playState!==e||this.playState<=0&&this.currentPlayTimes!==i)&&(this._frameIndex=-1),!0)}init(t,e,i){if(this._armature=t,this._animationState=e,this._timelineData=i,this._actionTimeline=this._animationState._actionTimeline,this===this._actionTimeline&&(this._actionTimeline=null),this._animationData=this._animationState.animationData,this._frameRate=this._animationData.parent.frameRate,this._frameRateR=1/this._frameRate,this._position=this._animationState._position,this._duration=this._animationState._duration,this._timelineData!==null){const s=this._animationData.parent.parent;this._frameArray=s.frameArray,this._timelineArray=s.timelineArray,this._frameIndices=s.frameIndices,this._frameCount=this._timelineArray[this._timelineData.offset+x.TimelineKeyFrameCount],this._frameValueOffset=this._timelineArray[this._timelineData.offset+x.TimelineFrameValueOffset],this._timeScale=100/this._timelineArray[this._timelineData.offset+x.TimelineScale],this._timeOffset=this._timelineArray[this._timelineData.offset+x.TimelineOffset]*.01}}fadeOut(){this.dirty=!1}update(t){if(this._setCurrentTime(t)){if(this._frameCount>1){const e=Math.floor(this.currentTime*this._frameRate),i=this._frameIndices[this._timelineData.frameIndicesOffset+e];this._frameIndex!==i&&(this._frameIndex=i,this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+x.TimelineFrameOffset+this._frameIndex],this._onArriveAtFrame())}else this._frameIndex<0&&(this._frameIndex=0,this._timelineData!==null&&(this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+x.TimelineFrameOffset]),this._onArriveAtFrame());(this._isTween||this.dirty)&&this._onUpdateFrame()}}blend(t){}}class Ot extends Rt{constructor(){super(...arguments);a(this,"_tweenType");a(this,"_curveCount");a(this,"_framePosition");a(this,"_frameDurationR");a(this,"_tweenEasing");a(this,"_tweenProgress");a(this,"_valueScale")}static _getEasingValue(t,e,i){let s=e;switch(t){case J.QuadIn:s=Math.pow(e,2);break;case J.QuadOut:s=1-Math.pow(1-e,2);break;case J.QuadInOut:s=.5*(1-Math.cos(e*Math.PI));break}return(s-e)*i+e}static _getEasingCurveValue(t,e,i,s){if(t<=0)return 0;if(t>=1)return 1;const n=i>0,r=i+1,o=Math.floor(t*r);let h=0,f=0;return n?(h=o===0?0:e[s+o-1],f=o===r-1?1e4:e[s+o]):(h=e[s+o-1],f=e[s+o]),(h+(f-h)*(t*r-o))*1e-4}_onClear(){super._onClear(),this._tweenType=J.None,this._curveCount=0,this._framePosition=0,this._frameDurationR=0,this._tweenEasing=0,this._tweenProgress=0,this._valueScale=1}_onArriveAtFrame(){if(this._frameCount>1&&(this._frameIndex!==this._frameCount-1||this._animationState.playTimes===0||this._animationState.currentPlayTimes<this._animationState.playTimes-1))if(this._tweenType=this._frameArray[this._frameOffset+x.FrameTweenType],this._isTween=this._tweenType!==J.None,this._isTween?this._tweenType===J.Curve?this._curveCount=this._frameArray[this._frameOffset+x.FrameTweenEasingOrCurveSampleCount]:this._tweenType!==J.None&&this._tweenType!==J.Line&&(this._tweenEasing=this._frameArray[this._frameOffset+x.FrameTweenEasingOrCurveSampleCount]*.01):this.dirty=!0,this._framePosition=this._frameArray[this._frameOffset]*this._frameRateR,this._frameIndex===this._frameCount-1)this._frameDurationR=1/(this._animationData.duration-this._framePosition);else{const t=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+x.TimelineFrameOffset+this._frameIndex+1],e=this._frameArray[t]*this._frameRateR-this._framePosition;e>0?this._frameDurationR=1/e:this._frameDurationR=0}else this.dirty=!0,this._isTween=!1}_onUpdateFrame(){this._isTween&&(this.dirty=!0,this._tweenProgress=(this.currentTime-this._framePosition)*this._frameDurationR,this._tweenType===J.Curve?this._tweenProgress=Ot._getEasingCurveValue(this._tweenProgress,this._frameArray,this._curveCount,this._frameOffset+x.FrameCurveSamples):this._tweenType!==J.Line&&(this._tweenProgress=Ot._getEasingValue(this._tweenType,this._tweenProgress,this._tweenEasing)))}}class Pt extends Ot{constructor(){super(...arguments);a(this,"_current");a(this,"_difference");a(this,"_result")}_onClear(){super._onClear(),this._current=0,this._difference=0,this._result=0}_onArriveAtFrame(){if(super._onArriveAtFrame(),this._timelineData!==null){const t=this._valueScale,e=this._valueArray,i=this._valueOffset+this._frameValueOffset+this._frameIndex;if(this._isTween){const s=this._frameIndex===this._frameCount-1?this._valueOffset+this._frameValueOffset:i+1;t===1?(this._current=e[i],this._difference=e[s]-this._current):(this._current=e[i]*t,this._difference=e[s]*t-this._current)}else this._result=e[i]*t}else this._result=0}_onUpdateFrame(){super._onUpdateFrame(),this._isTween&&(this._result=this._current+this._difference*this._tweenProgress)}}class Bt extends Ot{constructor(){super(...arguments);a(this,"_currentA");a(this,"_currentB");a(this,"_differenceA");a(this,"_differenceB");a(this,"_resultA");a(this,"_resultB")}_onClear(){super._onClear(),this._currentA=0,this._currentB=0,this._differenceA=0,this._differenceB=0,this._resultA=0,this._resultB=0}_onArriveAtFrame(){if(super._onArriveAtFrame(),this._timelineData!==null){const t=this._valueScale,e=this._valueArray,i=this._valueOffset+this._frameValueOffset+this._frameIndex*2;if(this._isTween){const s=this._frameIndex===this._frameCount-1?this._valueOffset+this._frameValueOffset:i+2;t===1?(this._currentA=e[i],this._currentB=e[i+1],this._differenceA=e[s]-this._currentA,this._differenceB=e[s+1]-this._currentB):(this._currentA=e[i]*t,this._currentB=e[i+1]*t,this._differenceA=e[s]*t-this._currentA,this._differenceB=e[s+1]*t-this._currentB)}else this._resultA=e[i]*t,this._resultB=e[i+1]*t}else this._resultA=0,this._resultB=0}_onUpdateFrame(){super._onUpdateFrame(),this._isTween&&(this._resultA=this._currentA+this._differenceA*this._tweenProgress,this._resultB=this._currentB+this._differenceB*this._tweenProgress)}}class Xt extends Ot{constructor(){super(...arguments);a(this,"_valueCount");a(this,"_rd",[])}_onClear(){super._onClear(),this._valueCount=0,this._rd.length=0}_onArriveAtFrame(){super._onArriveAtFrame();const t=this._valueCount,e=this._rd;if(this._timelineData!==null){const i=this._valueScale,s=this._valueArray,n=this._valueOffset+this._frameValueOffset+this._frameIndex*t;if(this._isTween){const r=this._frameIndex===this._frameCount-1?this._valueOffset+this._frameValueOffset:n+t;if(i===1)for(let o=0;o<t;++o)e[t+o]=s[r+o]-s[n+o];else for(let o=0;o<t;++o)e[t+o]=(s[r+o]-s[n+o])*i}else if(i===1)for(let r=0;r<t;++r)e[r]=s[n+r];else for(let r=0;r<t;++r)e[r]=s[n+r]*i}else for(let i=0;i<t;++i)e[i]=0}_onUpdateFrame(){if(super._onUpdateFrame(),this._isTween){const t=this._valueCount,e=this._valueScale,i=this._tweenProgress,s=this._valueArray,n=this._rd,r=this._valueOffset+this._frameValueOffset+this._frameIndex*t;if(e===1)for(let o=0;o<t;++o)n[o]=s[r+o]+n[t+o]*i;else for(let o=0;o<t;++o)n[o]=s[r+o]*e+n[t+o]*i}}}const St=class St{constructor(l=0,t=0,e=0,i=0,s=1,n=1){a(this,"x");a(this,"y");a(this,"skew");a(this,"rotation");a(this,"scaleX");a(this,"scaleY");this.x=l,this.y=t,this.skew=e,this.rotation=i,this.scaleX=s,this.scaleY=n}static normalizeRadian(l){return l=(l+Math.PI)%(Math.PI*2),l+=l>0?-Math.PI:Math.PI,l}toString(){return"[object dragonBones.Transform] x:"+this.x+" y:"+this.y+" skewX:"+this.skew*180/Math.PI+" skewY:"+this.rotation*180/Math.PI+" scaleX:"+this.scaleX+" scaleY:"+this.scaleY}copyFrom(l){return this.x=l.x,this.y=l.y,this.skew=l.skew,this.rotation=l.rotation,this.scaleX=l.scaleX,this.scaleY=l.scaleY,this}identity(){return this.x=this.y=0,this.skew=this.rotation=0,this.scaleX=this.scaleY=1,this}add(l){return this.x+=l.x,this.y+=l.y,this.skew+=l.skew,this.rotation+=l.rotation,this.scaleX*=l.scaleX,this.scaleY*=l.scaleY,this}minus(l){return this.x-=l.x,this.y-=l.y,this.skew-=l.skew,this.rotation-=l.rotation,this.scaleX/=l.scaleX,this.scaleY/=l.scaleY,this}fromMatrix(l){const t=this.scaleX,e=this.scaleY,i=St.PI_Q;this.x=l.tx,this.y=l.ty,this.rotation=Math.atan(l.b/l.a);let s=Math.atan(-l.c/l.d);return this.scaleX=this.rotation>-i&&this.rotation<i?l.a/Math.cos(this.rotation):l.b/Math.sin(this.rotation),this.scaleY=s>-i&&s<i?l.d/Math.cos(s):-l.c/Math.sin(s),t>=0&&this.scaleX<0&&(this.scaleX=-this.scaleX,this.rotation=this.rotation-Math.PI),e>=0&&this.scaleY<0&&(this.scaleY=-this.scaleY,s=s-Math.PI),this.skew=s-this.rotation,this}toMatrix(l){return this.rotation===0?(l.a=1,l.b=0):(l.a=Math.cos(this.rotation),l.b=Math.sin(this.rotation)),this.skew===0?(l.c=-l.b,l.d=l.a):(l.c=-Math.sin(this.skew+this.rotation),l.d=Math.cos(this.skew+this.rotation)),this.scaleX!==1&&(l.a*=this.scaleX,l.b*=this.scaleX),this.scaleY!==1&&(l.c*=this.scaleY,l.d*=this.scaleY),l.tx=this.x,l.ty=this.y,this}};a(St,"PI",Math.PI),a(St,"PI_D",Math.PI*2),a(St,"PI_H",Math.PI/2),a(St,"PI_Q",Math.PI/4),a(St,"RAD_DEG",180/Math.PI),a(St,"DEG_RAD",Math.PI/180);let v=St;class Xe extends Rt{static toString(){return"[class dragonBones.ActionTimelineState]"}_onCrossFrame(l){const t=this._armature.eventDispatcher;if(this._animationState.actionEnabled){const e=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+x.TimelineFrameOffset+l],i=this._frameArray[e+1],s=this._animationData.parent.actions;for(let n=0;n<i;++n){const r=this._frameArray[e+2+n],o=s[r];if(o.type===q.Play){const h=F.borrowObject(j);h.time=this._frameArray[e]/this._frameRate,h.animationState=this._animationState,j.actionDataToInstance(o,h,this._armature),this._armature._bufferAction(h,!0)}else{const h=o.type===q.Frame?j.FRAME_EVENT:j.SOUND_EVENT;if(o.type===q.Sound||t.hasDBEventListener(h)){const f=F.borrowObject(j);f.time=this._frameArray[e]/this._frameRate,f.animationState=this._animationState,j.actionDataToInstance(o,f,this._armature),this._armature._dragonBones.bufferEvent(f)}}}}}_onArriveAtFrame(){}_onUpdateFrame(){}update(l){const t=this.playState;let e=this.currentPlayTimes,i=this.currentTime;if(this._setCurrentTime(l)){const s=this._animationState._parent===null&&this._animationState.actionEnabled,n=this._armature.eventDispatcher;if(t<0)if(this.playState!==t){if(this._animationState.displayControl&&this._animationState.resetToPose&&this._armature._sortZOrder(null,0),s&&n.hasDBEventListener(j.START)){const f=F.borrowObject(j);f.type=j.START,f.armature=this._armature,f.animationState=this._animationState,this._armature._dragonBones.bufferEvent(f)}}else return;const r=this._animationState.timeScale<0;let o=null,h=null;if(s&&this.currentPlayTimes!==e&&(n.hasDBEventListener(j.LOOP_COMPLETE)&&(o=F.borrowObject(j),o.type=j.LOOP_COMPLETE,o.armature=this._armature,o.animationState=this._animationState),this.playState>0&&n.hasDBEventListener(j.COMPLETE)&&(h=F.borrowObject(j),h.type=j.COMPLETE,h.armature=this._armature,h.animationState=this._animationState)),this._frameCount>1){const f=this._timelineData,m=Math.floor(this.currentTime*this._frameRate),d=this._frameIndices[f.frameIndicesOffset+m];if(this._frameIndex!==d){let c=this._frameIndex;if(this._frameIndex=d,this._timelineArray!==null)if(this._frameOffset=this._animationData.frameOffset+this._timelineArray[f.offset+x.TimelineFrameOffset+this._frameIndex],r){if(c<0){const A=Math.floor(i*this._frameRate);c=this._frameIndices[f.frameIndicesOffset+A],this.currentPlayTimes===e&&c===d&&(c=-1)}for(;c>=0;){const A=this._animationData.frameOffset+this._timelineArray[f.offset+x.TimelineFrameOffset+c],p=this._frameArray[A]/this._frameRate;if(this._position<=p&&p<=this._position+this._duration&&this._onCrossFrame(c),o!==null&&c===0&&(this._armature._dragonBones.bufferEvent(o),o=null),c>0?c--:c=this._frameCount-1,c===d)break}}else{if(c<0){const A=Math.floor(i*this._frameRate);c=this._frameIndices[f.frameIndicesOffset+A];const p=this._animationData.frameOffset+this._timelineArray[f.offset+x.TimelineFrameOffset+c],S=this._frameArray[p]/this._frameRate;this.currentPlayTimes===e&&(i<=S?c>0?c--:c=this._frameCount-1:c===d&&(c=-1))}for(;c>=0;){c<this._frameCount-1?c++:c=0;const A=this._animationData.frameOffset+this._timelineArray[f.offset+x.TimelineFrameOffset+c],p=this._frameArray[A]/this._frameRate;if(this._position<=p&&p<=this._position+this._duration&&this._onCrossFrame(c),o!==null&&c===0&&(this._armature._dragonBones.bufferEvent(o),o=null),c===d)break}}}}else if(this._frameIndex<0&&(this._frameIndex=0,this._timelineData!==null)){this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+x.TimelineFrameOffset];const f=this._frameArray[this._frameOffset]/this._frameRate;this.currentPlayTimes===e?i<=f&&this._onCrossFrame(this._frameIndex):this._position<=f&&(!r&&o!==null&&(this._armature._dragonBones.bufferEvent(o),o=null),this._onCrossFrame(this._frameIndex))}o!==null&&this._armature._dragonBones.bufferEvent(o),h!==null&&this._armature._dragonBones.bufferEvent(h)}}setCurrentTime(l){this._setCurrentTime(l),this._frameIndex=-1}}class We extends Rt{static toString(){return"[class dragonBones.ZOrderTimelineState]"}_onArriveAtFrame(){this.playState>=0&&(this._frameArray[this._frameOffset+1]>0?this._armature._sortZOrder(this._frameArray,this._frameOffset+2):this._armature._sortZOrder(null,0))}_onUpdateFrame(){}}class ye extends Xt{static toString(){return"[class dragonBones.BoneAllTimelineState]"}_onArriveAtFrame(){super._onArriveAtFrame(),this._isTween&&this._frameIndex===this._frameCount-1&&(this._rd[2]=v.normalizeRadian(this._rd[2]),this._rd[3]=v.normalizeRadian(this._rd[3])),this._timelineData===null&&(this._rd[4]=1,this._rd[5]=1)}init(l,t,e){super.init(l,t,e),this._valueOffset=this._animationData.frameFloatOffset,this._valueCount=6,this._valueArray=this._animationData.parent.parent.frameFloatArray}fadeOut(){this.dirty=!1,this._rd[2]=v.normalizeRadian(this._rd[2]),this._rd[3]=v.normalizeRadian(this._rd[3])}blend(l){const t=this._armature.armatureData.scale,e=this._rd,i=this.target,s=i.target,n=i.blendWeight,r=s.animationPose;i.dirty>1?(r.x+=e[0]*n*t,r.y+=e[1]*n*t,r.rotation+=e[2]*n,r.skew+=e[3]*n,r.scaleX+=(e[4]-1)*n,r.scaleY+=(e[5]-1)*n):(r.x=e[0]*n*t,r.y=e[1]*n*t,r.rotation=e[2]*n,r.skew=e[3]*n,r.scaleX=(e[4]-1)*n+1,r.scaleY=(e[5]-1)*n+1),(l||this.dirty)&&(this.dirty=!1,s._transformDirty=!0)}}class je extends Bt{static toString(){return"[class dragonBones.BoneTranslateTimelineState]"}init(l,t,e){super.init(l,t,e),this._valueOffset=this._animationData.frameFloatOffset,this._valueScale=this._armature.armatureData.scale,this._valueArray=this._animationData.parent.parent.frameFloatArray}blend(l){const t=this.target,e=t.target,i=t.blendWeight,s=e.animationPose;t.dirty>1?(s.x+=this._resultA*i,s.y+=this._resultB*i):i!==1?(s.x=this._resultA*i,s.y=this._resultB*i):(s.x=this._resultA,s.y=this._resultB),(l||this.dirty)&&(this.dirty=!1,e._transformDirty=!0)}}class ze extends Bt{static toString(){return"[class dragonBones.BoneRotateTimelineState]"}_onArriveAtFrame(){super._onArriveAtFrame(),this._isTween&&this._frameIndex===this._frameCount-1&&(this._differenceA=v.normalizeRadian(this._differenceA),this._differenceB=v.normalizeRadian(this._differenceB))}init(l,t,e){super.init(l,t,e),this._valueOffset=this._animationData.frameFloatOffset,this._valueArray=this._animationData.parent.parent.frameFloatArray}fadeOut(){this.dirty=!1,this._resultA=v.normalizeRadian(this._resultA),this._resultB=v.normalizeRadian(this._resultB)}blend(l){const t=this.target,e=t.target,i=t.blendWeight,s=e.animationPose;t.dirty>1?(s.rotation+=this._resultA*i,s.skew+=this._resultB*i):i!==1?(s.rotation=this._resultA*i,s.skew=this._resultB*i):(s.rotation=this._resultA,s.skew=this._resultB),(l||this.dirty)&&(this.dirty=!1,e._transformDirty=!0)}}class He extends Bt{static toString(){return"[class dragonBones.BoneScaleTimelineState]"}_onArriveAtFrame(){super._onArriveAtFrame(),this._timelineData===null&&(this._resultA=1,this._resultB=1)}init(l,t,e){super.init(l,t,e),this._valueOffset=this._animationData.frameFloatOffset,this._valueArray=this._animationData.parent.parent.frameFloatArray}blend(l){const t=this.target,e=t.target,i=t.blendWeight,s=e.animationPose;t.dirty>1?(s.scaleX+=(this._resultA-1)*i,s.scaleY+=(this._resultB-1)*i):i!==1?(s.scaleX=(this._resultA-1)*i+1,s.scaleY=(this._resultB-1)*i+1):(s.scaleX=this._resultA,s.scaleY=this._resultB),(l||this.dirty)&&(this.dirty=!1,e._transformDirty=!0)}}class ge extends Xt{constructor(){super(...arguments);a(this,"_deformCount");a(this,"_deformOffset");a(this,"_sameValueOffset")}static toString(){return"[class dragonBones.SurfaceTimelineState]"}_onClear(){super._onClear(),this._deformCount=0,this._deformOffset=0,this._sameValueOffset=0}init(t,e,i){if(super.init(t,e,i),this._timelineData!==null){const s=this._animationData.parent.parent,n=s.frameIntArray,r=this._animationData.frameIntOffset+this._timelineArray[this._timelineData.offset+x.TimelineFrameValueCount];this._valueOffset=this._animationData.frameFloatOffset,this._valueCount=n[r+x.DeformValueCount],this._deformCount=n[r+x.DeformCount],this._deformOffset=n[r+x.DeformValueOffset],this._sameValueOffset=n[r+x.DeformFloatOffset]+this._animationData.frameFloatOffset,this._valueScale=this._armature.armatureData.scale,this._valueArray=s.frameFloatArray,this._rd.length=this._valueCount*2}else this._deformCount=this.target.target._deformVertices.length}blend(t){const e=this.target,i=e.target,s=e.blendWeight,n=i._deformVertices,r=this._valueArray;if(r!==null){const o=this._valueCount,h=this._deformOffset,f=this._sameValueOffset,m=this._rd;for(let d=0;d<this._deformCount;++d){let c=0;d<h?c=r[f+d]:d<h+o?c=m[d-h]:c=r[f+d-o],e.dirty>1?n[d]+=c*s:n[d]=c*s}}else if(e.dirty===1)for(let o=0;o<this._deformCount;++o)n[o]=0;(t||this.dirty)&&(this.dirty=!1,i._transformDirty=!0)}}class Te extends Pt{static toString(){return"[class dragonBones.AlphaTimelineState]"}_onArriveAtFrame(){super._onArriveAtFrame(),this._timelineData===null&&(this._result=1)}init(l,t,e){super.init(l,t,e),this._valueOffset=this._animationData.frameIntOffset,this._valueScale=.01,this._valueArray=this._animationData.parent.parent.frameIntArray}blend(l){const t=this.target,e=t.target,i=t.blendWeight;t.dirty>1?(e._alpha+=this._result*i,e._alpha>1&&(e._alpha=1)):e._alpha=this._result*i,(l||this.dirty)&&(this.dirty=!1,this._armature._alphaDirty=!0)}}class Ae extends Rt{static toString(){return"[class dragonBones.SlotDisplayTimelineState]"}_onArriveAtFrame(){if(this.playState>=0){const l=this.target,t=this._timelineData!==null?this._frameArray[this._frameOffset+1]:l._slotData.displayIndex;l.displayIndex!==t&&l._setDisplayIndex(t,!0)}}_onUpdateFrame(){}}class be extends Ot{constructor(){super(...arguments);a(this,"_current",[0,0,0,0,0,0,0,0]);a(this,"_difference",[0,0,0,0,0,0,0,0]);a(this,"_result",[0,0,0,0,0,0,0,0])}static toString(){return"[class dragonBones.SlotColorTimelineState]"}_onArriveAtFrame(){if(super._onArriveAtFrame(),this._timelineData!==null){const t=this._animationData.parent.parent,e=t.colorArray,i=t.frameIntArray,s=this._animationData.frameIntOffset+this._frameValueOffset+this._frameIndex;let n=i[s];n<0&&(n+=65536),this._isTween?(this._current[0]=e[n++],this._current[1]=e[n++],this._current[2]=e[n++],this._current[3]=e[n++],this._current[4]=e[n++],this._current[5]=e[n++],this._current[6]=e[n++],this._current[7]=e[n++],this._frameIndex===this._frameCount-1?n=i[this._animationData.frameIntOffset+this._frameValueOffset]:n=i[s+1],n<0&&(n+=65536),this._difference[0]=e[n++]-this._current[0],this._difference[1]=e[n++]-this._current[1],this._difference[2]=e[n++]-this._current[2],this._difference[3]=e[n++]-this._current[3],this._difference[4]=e[n++]-this._current[4],this._difference[5]=e[n++]-this._current[5],this._difference[6]=e[n++]-this._current[6],this._difference[7]=e[n++]-this._current[7]):(this._result[0]=e[n++]*.01,this._result[1]=e[n++]*.01,this._result[2]=e[n++]*.01,this._result[3]=e[n++]*.01,this._result[4]=e[n++],this._result[5]=e[n++],this._result[6]=e[n++],this._result[7]=e[n++])}else{const e=this.target.slotData.color;this._result[0]=e.alphaMultiplier,this._result[1]=e.redMultiplier,this._result[2]=e.greenMultiplier,this._result[3]=e.blueMultiplier,this._result[4]=e.alphaOffset,this._result[5]=e.redOffset,this._result[6]=e.greenOffset,this._result[7]=e.blueOffset}}_onUpdateFrame(){super._onUpdateFrame(),this._isTween&&(this._result[0]=(this._current[0]+this._difference[0]*this._tweenProgress)*.01,this._result[1]=(this._current[1]+this._difference[1]*this._tweenProgress)*.01,this._result[2]=(this._current[2]+this._difference[2]*this._tweenProgress)*.01,this._result[3]=(this._current[3]+this._difference[3]*this._tweenProgress)*.01,this._result[4]=this._current[4]+this._difference[4]*this._tweenProgress,this._result[5]=this._current[5]+this._difference[5]*this._tweenProgress,this._result[6]=this._current[6]+this._difference[6]*this._tweenProgress,this._result[7]=this._current[7]+this._difference[7]*this._tweenProgress)}fadeOut(){this._isTween=!1}update(t){if(super.update(t),this._isTween||this.dirty){const e=this.target,i=e._colorTransform;if(this._animationState._fadeState!==0||this._animationState._subFadeState!==0){if(i.alphaMultiplier!==this._result[0]||i.redMultiplier!==this._result[1]||i.greenMultiplier!==this._result[2]||i.blueMultiplier!==this._result[3]||i.alphaOffset!==this._result[4]||i.redOffset!==this._result[5]||i.greenOffset!==this._result[6]||i.blueOffset!==this._result[7]){const s=Math.pow(this._animationState._fadeProgress,4);i.alphaMultiplier+=(this._result[0]-i.alphaMultiplier)*s,i.redMultiplier+=(this._result[1]-i.redMultiplier)*s,i.greenMultiplier+=(this._result[2]-i.greenMultiplier)*s,i.blueMultiplier+=(this._result[3]-i.blueMultiplier)*s,i.alphaOffset+=(this._result[4]-i.alphaOffset)*s,i.redOffset+=(this._result[5]-i.redOffset)*s,i.greenOffset+=(this._result[6]-i.greenOffset)*s,i.blueOffset+=(this._result[7]-i.blueOffset)*s,e._colorDirty=!0}}else this.dirty&&(this.dirty=!1,(i.alphaMultiplier!==this._result[0]||i.redMultiplier!==this._result[1]||i.greenMultiplier!==this._result[2]||i.blueMultiplier!==this._result[3]||i.alphaOffset!==this._result[4]||i.redOffset!==this._result[5]||i.greenOffset!==this._result[6]||i.blueOffset!==this._result[7])&&(i.alphaMultiplier=this._result[0],i.redMultiplier=this._result[1],i.greenMultiplier=this._result[2],i.blueMultiplier=this._result[3],i.alphaOffset=this._result[4],i.redOffset=this._result[5],i.greenOffset=this._result[6],i.blueOffset=this._result[7],e._colorDirty=!0))}}}class Ke extends Pt{static toString(){return"[class dragonBones.SlotZIndexTimelineState]"}_onArriveAtFrame(){if(super._onArriveAtFrame(),this._timelineData===null){const t=this.target.target;this._result=t.slotData.zIndex}}init(l,t,e){super.init(l,t,e),this._valueOffset=this._animationData.frameIntOffset,this._valueArray=this._animationData.parent.parent.frameIntArray}blend(l){const t=this.target,e=t.target,i=t.blendWeight;t.dirty>1?e._zIndex+=this._result*i:e._zIndex=this._result*i,(l||this.dirty)&&(this.dirty=!1,this._armature._zIndexDirty=!0)}}class Se extends Xt{constructor(){super(...arguments);a(this,"geometryOffset");a(this,"displayFrame");a(this,"_deformCount");a(this,"_deformOffset");a(this,"_sameValueOffset")}static toString(){return"[class dragonBones.DeformTimelineState]"}_onClear(){super._onClear(),this.geometryOffset=0,this.displayFrame=null,this._deformCount=0,this._deformOffset=0,this._sameValueOffset=0}init(t,e,i){if(super.init(t,e,i),this._timelineData!==null){const s=this._animationData.frameIntOffset+this._timelineArray[this._timelineData.offset+x.TimelineFrameValueCount],n=this._animationData.parent.parent,r=n.frameIntArray,o=this.target.target;this.geometryOffset=r[s+x.DeformVertexOffset],this.geometryOffset<0&&(this.geometryOffset+=65536);for(let h=0,f=o.displayFrameCount;h<f;++h){const m=o.getDisplayFrameAt(h),d=m.getGeometryData();if(d!==null&&d.offset===this.geometryOffset){this.displayFrame=m,this.displayFrame.updateDeformVertices();break}}if(this.displayFrame===null){this.returnToPool();return}this._valueOffset=this._animationData.frameFloatOffset,this._valueCount=r[s+x.DeformValueCount],this._deformCount=r[s+x.DeformCount],this._deformOffset=r[s+x.DeformValueOffset],this._sameValueOffset=r[s+x.DeformFloatOffset]+this._animationData.frameFloatOffset,this._valueScale=this._armature.armatureData.scale,this._valueArray=n.frameFloatArray,this._rd.length=this._valueCount*2}else this._deformCount=this.displayFrame.deformVertices.length}blend(t){const e=this.target,i=e.target,s=e.blendWeight,n=this.displayFrame.deformVertices,r=this._valueArray;if(r!==null){const o=this._valueCount,h=this._deformOffset,f=this._sameValueOffset,m=this._rd;for(let d=0;d<this._deformCount;++d){let c=0;d<h?c=r[f+d]:d<h+o?c=m[d-h]:c=r[f+d-o],e.dirty>1?n[d]+=c*s:n[d]=c*s}}else if(e.dirty===1)for(let o=0;o<this._deformCount;++o)n[o]=0;(t||this.dirty)&&(this.dirty=!1,i._geometryData===this.displayFrame.getGeometryData()&&(i._verticesDirty=!0))}}class De extends Bt{static toString(){return"[class dragonBones.IKConstraintTimelineState]"}_onUpdateFrame(){super._onUpdateFrame();const l=this.target;if(this._timelineData!==null)l._bendPositive=this._currentA>0,l._weight=this._currentB;else{const t=l._constraintData;l._bendPositive=t.bendPositive,l._weight=t.weight}l.invalidUpdate(),this.dirty=!1}init(l,t,e){super.init(l,t,e),this._valueOffset=this._animationData.frameIntOffset,this._valueScale=.01,this._valueArray=this._animationData.parent.parent.frameIntArray}}class Ze extends Pt{static toString(){return"[class dragonBones.AnimationProgressTimelineState]"}_onUpdateFrame(){super._onUpdateFrame();const l=this.target;l._parent!==null&&(l.currentTime=this._result*l.totalTime),this.dirty=!1}init(l,t,e){super.init(l,t,e),this._valueOffset=this._animationData.frameIntOffset,this._valueScale=1e-4,this._valueArray=this._animationData.parent.parent.frameIntArray}}class qe extends Pt{static toString(){return"[class dragonBones.AnimationWeightTimelineState]"}_onUpdateFrame(){super._onUpdateFrame();const l=this.target;l._parent!==null&&(l.weight=this._result),this.dirty=!1}init(l,t,e){super.init(l,t,e),this._valueOffset=this._animationData.frameIntOffset,this._valueScale=1e-4,this._valueArray=this._animationData.parent.parent.frameIntArray}}class Qe extends Bt{static toString(){return"[class dragonBones.AnimationParametersTimelineState]"}_onUpdateFrame(){super._onUpdateFrame();const l=this.target;l._parent!==null&&(l.parameterX=this._resultA,l.parameterY=this._resultB),this.dirty=!1}init(l,t,e){super.init(l,t,e),this._valueOffset=this._animationData.frameIntOffset,this._valueScale=1e-4,this._valueArray=this._animationData.parent.parent.frameIntArray}}class Oe extends F{constructor(){super(...arguments);a(this,"actionEnabled");a(this,"additive");a(this,"displayControl");a(this,"resetToPose");a(this,"blendType");a(this,"playTimes");a(this,"layer");a(this,"timeScale");a(this,"parameterX");a(this,"parameterY");a(this,"positionX");a(this,"positionY");a(this,"autoFadeOutTime");a(this,"fadeTotalTime");a(this,"name");a(this,"group");a(this,"_timelineDirty");a(this,"_playheadState");a(this,"_fadeState");a(this,"_subFadeState");a(this,"_position");a(this,"_duration");a(this,"_weight");a(this,"_fadeTime");a(this,"_time");a(this,"_fadeProgress");a(this,"_weightResult");a(this,"_boneMask",[]);a(this,"_boneTimelines",[]);a(this,"_boneBlendTimelines",[]);a(this,"_slotTimelines",[]);a(this,"_slotBlendTimelines",[]);a(this,"_constraintTimelines",[]);a(this,"_animationTimelines",[]);a(this,"_poseTimelines",[]);a(this,"_animationData");a(this,"_armature");a(this,"_actionTimeline",null);a(this,"_zOrderTimeline",null);a(this,"_activeChildA");a(this,"_activeChildB");a(this,"_parent")}static toString(){return"[class dragonBones.AnimationState]"}_onClear(){for(const t of this._boneTimelines)t.returnToPool();for(const t of this._boneBlendTimelines)t.returnToPool();for(const t of this._slotTimelines)t.returnToPool();for(const t of this._slotBlendTimelines)t.returnToPool();for(const t of this._constraintTimelines)t.returnToPool();for(const t of this._animationTimelines){const e=t.target;e._parent===this&&(e._fadeState=1,e._subFadeState=1,e._parent=null),t.returnToPool()}this._actionTimeline!==null&&this._actionTimeline.returnToPool(),this._zOrderTimeline!==null&&this._zOrderTimeline.returnToPool(),this.actionEnabled=!1,this.additive=!1,this.displayControl=!1,this.resetToPose=!1,this.blendType=dt.None,this.playTimes=1,this.layer=0,this.timeScale=1,this._weight=1,this.parameterX=0,this.parameterY=0,this.positionX=0,this.positionY=0,this.autoFadeOutTime=0,this.fadeTotalTime=0,this.name="",this.group="",this._timelineDirty=2,this._playheadState=0,this._fadeState=-1,this._subFadeState=-1,this._position=0,this._duration=0,this._fadeTime=0,this._time=0,this._fadeProgress=0,this._weightResult=0,this._boneMask.length=0,this._boneTimelines.length=0,this._boneBlendTimelines.length=0,this._slotTimelines.length=0,this._slotBlendTimelines.length=0,this._constraintTimelines.length=0,this._animationTimelines.length=0,this._poseTimelines.length=0,this._animationData=null,this._armature=null,this._actionTimeline=null,this._zOrderTimeline=null,this._activeChildA=null,this._activeChildB=null,this._parent=null}_updateTimelines(){for(const t of this._armature._constraints){const e=this._animationData.getConstraintTimelines(t.name);if(e!==null)for(const i of e)switch(i.type){case E.IKConstraint:{const s=F.borrowObject(De);s.target=t,s.init(this._armature,this,i),this._constraintTimelines.push(s);break}}else if(this.resetToPose){const i=F.borrowObject(De);i.target=t,i.init(this._armature,this,null),this._constraintTimelines.push(i),this._poseTimelines.push(i)}}}_updateBoneAndSlotTimelines(){{const t={};for(const e of this._boneTimelines){const i=e.target.target.name;i in t||(t[i]=[]),t[i].push(e)}for(const e of this._boneBlendTimelines){const i=e.target.target.name;i in t||(t[i]=[]),t[i].push(e)}for(const e of this._armature.getBones()){const i=e.name;if(this.containsBoneMask(i))if(i in t)delete t[i];else{const s=this._animationData.getBoneTimelines(i),n=this._armature.animation.getBlendState(lt.BONE_TRANSFORM,e.name,e);if(s!==null)for(const r of s)switch(r.type){case E.BoneAll:{const o=F.borrowObject(ye);o.target=n,o.init(this._armature,this,r),this._boneTimelines.push(o);break}case E.BoneTranslate:{const o=F.borrowObject(je);o.target=n,o.init(this._armature,this,r),this._boneTimelines.push(o);break}case E.BoneRotate:{const o=F.borrowObject(ze);o.target=n,o.init(this._armature,this,r),this._boneTimelines.push(o);break}case E.BoneScale:{const o=F.borrowObject(He);o.target=n,o.init(this._armature,this,r),this._boneTimelines.push(o);break}case E.BoneAlpha:{const o=F.borrowObject(Te);o.target=this._armature.animation.getBlendState(lt.BONE_ALPHA,e.name,e),o.init(this._armature,this,r),this._boneBlendTimelines.push(o);break}case E.Surface:{const o=F.borrowObject(ge);o.target=this._armature.animation.getBlendState(lt.SURFACE,e.name,e),o.init(this._armature,this,r),this._boneBlendTimelines.push(o);break}}else if(this.resetToPose)if(e._boneData.type===$.Bone){const r=F.borrowObject(ye);r.target=n,r.init(this._armature,this,null),this._boneTimelines.push(r),this._poseTimelines.push(r)}else{const r=F.borrowObject(ge);r.target=this._armature.animation.getBlendState(lt.SURFACE,e.name,e),r.init(this._armature,this,null),this._boneBlendTimelines.push(r),this._poseTimelines.push(r)}}}for(let e in t)for(const i of t[e]){let s=this._boneTimelines.indexOf(i);s>=0&&(this._boneTimelines.splice(s,1),i.returnToPool()),s=this._boneBlendTimelines.indexOf(i),s>=0&&(this._boneBlendTimelines.splice(s,1),i.returnToPool())}}{const t={},e=[];for(const i of this._slotTimelines){const s=i.target.name;s in t||(t[s]=[]),t[s].push(i)}for(const i of this._slotBlendTimelines){const s=i.target.target.name;s in t||(t[s]=[]),t[s].push(i)}for(const i of this._armature.getSlots()){const s=i.parent.name;if(!this.containsBoneMask(s))continue;const n=i.name;if(n in t)delete t[n];else{let r=!1,o=!1;e.length=0;const h=this._animationData.getSlotTimelines(n);if(h!==null)for(const f of h)switch(f.type){case E.SlotDisplay:{const m=F.borrowObject(Ae);m.target=i,m.init(this._armature,this,f),this._slotTimelines.push(m),r=!0;break}case E.SlotZIndex:{const m=F.borrowObject(Ke);m.target=this._armature.animation.getBlendState(lt.SLOT_Z_INDEX,i.name,i),m.init(this._armature,this,f),this._slotBlendTimelines.push(m);break}case E.SlotColor:{const m=F.borrowObject(be);m.target=i,m.init(this._armature,this,f),this._slotTimelines.push(m),o=!0;break}case E.SlotDeform:{const m=F.borrowObject(Se);m.target=this._armature.animation.getBlendState(lt.SLOT_DEFORM,i.name,i),m.init(this._armature,this,f),m.target!==null?(this._slotBlendTimelines.push(m),e.push(m.geometryOffset)):m.returnToPool();break}case E.SlotAlpha:{const m=F.borrowObject(Te);m.target=this._armature.animation.getBlendState(lt.SLOT_ALPHA,i.name,i),m.init(this._armature,this,f),this._slotBlendTimelines.push(m);break}}if(this.resetToPose){if(!r){const f=F.borrowObject(Ae);f.target=i,f.init(this._armature,this,null),this._slotTimelines.push(f),this._poseTimelines.push(f)}if(!o){const f=F.borrowObject(be);f.target=i,f.init(this._armature,this,null),this._slotTimelines.push(f),this._poseTimelines.push(f)}for(let f=0,m=i.displayFrameCount;f<m;++f){const d=i.getDisplayFrameAt(f);if(d.deformVertices.length===0)continue;const c=d.getGeometryData();if(c!==null&&e.indexOf(c.offset)<0){const A=F.borrowObject(Se);A.geometryOffset=c.offset,A.displayFrame=d,A.target=this._armature.animation.getBlendState(lt.SLOT_DEFORM,i.name,i),A.init(this._armature,this,null),this._slotBlendTimelines.push(A),this._poseTimelines.push(A)}}}}}for(let i in t)for(const s of t[i]){let n=this._slotTimelines.indexOf(s);n>=0&&(this._slotTimelines.splice(n,1),s.returnToPool()),n=this._slotBlendTimelines.indexOf(s),n>=0&&(this._slotBlendTimelines.splice(n,1),s.returnToPool())}}}_advanceFadeTime(t){const e=this._fadeState>0;if(this._subFadeState<0&&(this._subFadeState=0,this._parent===null&&this.actionEnabled)){const s=e?j.FADE_OUT:j.FADE_IN;if(this._armature.eventDispatcher.hasDBEventListener(s)){const n=F.borrowObject(j);n.type=s,n.armature=this._armature,n.animationState=this,this._armature._dragonBones.bufferEvent(n)}}if(t<0&&(t=-t),this._fadeTime+=t,this._fadeTime>=this.fadeTotalTime?(this._subFadeState=1,this._fadeProgress=e?0:1):this._fadeTime>0?this._fadeProgress=e?1-this._fadeTime/this.fadeTotalTime:this._fadeTime/this.fadeTotalTime:this._fadeProgress=e?1:0,this._subFadeState>0&&(e||(this._playheadState|=1,this._fadeState=0),this._parent===null&&this.actionEnabled)){const s=e?j.FADE_OUT_COMPLETE:j.FADE_IN_COMPLETE;if(this._armature.eventDispatcher.hasDBEventListener(s)){const n=F.borrowObject(j);n.type=s,n.armature=this._armature,n.animationState=this,this._armature._dragonBones.bufferEvent(n)}}}init(t,e,i){if(this._armature===null){if(this._armature=t,this._animationData=e,this.resetToPose=i.resetToPose,this.additive=i.additive,this.displayControl=i.displayControl,this.actionEnabled=i.actionEnabled,this.blendType=e.blendType,this.layer=i.layer,this.playTimes=i.playTimes,this.timeScale=i.timeScale,this.fadeTotalTime=i.fadeInTime,this.autoFadeOutTime=i.autoFadeOutTime,this.name=i.name.length>0?i.name:i.animation,this.group=i.group,this._weight=i.weight,i.pauseFadeIn?this._playheadState=2:this._playheadState=3,i.duration<0?(this._position=0,this._duration=this._animationData.duration,i.position!==0?this.timeScale>=0?this._time=i.position:this._time=i.position-this._duration:this._time=0):(this._position=i.position,this._duration=i.duration,this._time=0),this.timeScale<0&&this._time===0&&(this._time=-1e-6),this.fadeTotalTime<=0&&(this._fadeProgress=.999999),i.boneMask.length>0){this._boneMask.length=i.boneMask.length;for(let s=0,n=this._boneMask.length;s<n;++s)this._boneMask[s]=i.boneMask[s]}this._actionTimeline=F.borrowObject(Xe),this._actionTimeline.init(this._armature,this,this._animationData.actionTimeline),this._actionTimeline.currentTime=this._time,this._actionTimeline.currentTime<0&&(this._actionTimeline.currentTime=this._duration-this._actionTimeline.currentTime),this._animationData.zOrderTimeline!==null&&(this._zOrderTimeline=F.borrowObject(We),this._zOrderTimeline.init(this._armature,this,this._animationData.zOrderTimeline))}}advanceTime(t,e){(this._fadeState!==0||this._subFadeState!==0)&&this._advanceFadeTime(t),this._playheadState===3&&(this.timeScale!==1&&(t*=this.timeScale),this._time+=t),this._timelineDirty!==0&&(this._timelineDirty===2&&this._updateTimelines(),this._timelineDirty=0,this._updateBoneAndSlotTimelines());const i=this._fadeState!==0||this._subFadeState===0,s=this._fadeState===0&&e>0;let n=!0,r=!0,o=this._time;if(this._weightResult=this._weight*this._fadeProgress,this._parent!==null&&(this._weightResult*=this._parent._weightResult),this._actionTimeline.playState<=0&&this._actionTimeline.update(o),this._weight!==0){if(s){const h=e*2;this._actionTimeline.currentTime=Math.floor(this._actionTimeline.currentTime*h)/h}if(this._zOrderTimeline!==null&&this._zOrderTimeline.playState<=0&&this._zOrderTimeline.update(o),s){const h=Math.floor(this._actionTimeline.currentTime*e);this._armature._cacheFrameIndex===h?(n=!1,r=!1):(this._armature._cacheFrameIndex=h,this._animationData.cachedFrames[h]?r=!1:this._animationData.cachedFrames[h]=!0)}if(n){let h=!1,f=null;if(r)for(let m=0,d=this._boneTimelines.length;m<d;++m){const c=t