text: (function(f,g){const l=Symbol("loop"),m=Symbol("init"),n=f.requestAnimationFrame||f.webkitRequestAnimationFrame;class o{constructor(z,A={}){this.save=[],this.canvas=z,this.cxt=z.getContext("2d"),this.width=0,this.height=0,this.rows={slide:[],top:[],bottom:[]},this.filters={},this.Tween=new Proxy(new q(),{get:function(B,C){return"function"==typeof B[C]?B[C].bind(B):B[C]}}),this.leftTime=A.leftTime||2e3,this.space=A.space||10,this.unitHeight=0,this.rowNum=0,this.direction=A.direction||"rtol",this.duration=A.duration||9e3,this.type=A.type||"quad",this.timing=A.timing||"linear",this.startIndex=0,this.looped=!1,this.changeStyle(A)}add(z){z&&(this.looped&&this.countWidth([z]),this.filter(z),this.save.push(z))}clear(){this.save=[],this.startIndex=0}pause(){this.paused=!0}run(){this.paused=!1}addFilter(z,A){if(!z||!A)return!1;let[B]=[this.filters];B[z]||(B[z]=[]),B[z].find(C=>A===C)||B[z].push(A),this.doFilter()}filter(z){let A=this.filters;for(let B of Object.keys(A)){let C=A[B],[D,E]=[0,C.length];for(;D<E;D++){if(!z[B].includes(C[D])){z.hide=!1;continue}return z.hide=!0,!1}}}doFilter(){for(let[z,A,B]=[0,this.save];B=A[z++];)this.filter(B)}removeFilter(z,A){if(!z)return!1;let[B,C]=[this.filters];if(C=B[z],!C)return!1;if(!A)delete B[z];else for(let[D,E,F]=[0,C];F=E[D++];)if(F===A){B[z].splice(D-1,1);break}this.doFilter()}clearRect(){this.cxt.clearRect(0,0,this.width,this.height)}changeTiming(z,A){this.type=A||"quad",this.timing=z||"linear"}changeDirection(z){this.clear(),this.direction=z||"rtol"}font(){this.globalFont=this.globalStyle+" "+this.globalWeight+" "+this.globalSize+" "+this.globalFamily}addGradient(z,A={}){if(!z||"string"!=typeof z)return!1;let B=null;if("radial"==z)B=this.addRadialGradient(A);else if("linear"==z)B=this.addLinearGradient(A);else return!1;this.changeStyle({fontColor:B})}addLinearGradient(z){let[A,B,C,D,E]=[z.startX||0,z.startY||0,z.endX||this.width,z.endY||this.height,z.colorStops||[{point:0,color:this.globalColor},{point:1,color:this.globalColor}]],F=this.cxt.createLinearGradient(A,B,C,D);for(let G of E)F.addColorStop(G.point,G.color);return F}addRadialGradient(z){let[A,B,C,D,E,F,G]=[z.startX||this.width/2,z.startY||this.height/2,z.startR||0,z.endX||this.width/2,z.endY||this.height/2,z.endR||this.width,z.colorStops||[{point:0,color:this.globalColor},{point:1,color:this.globalColor}]],H=this.cxt.createRadialGradient(A,B,C,D,E,F);for(let I of G)H.addColorStop(I.point,I.color);return H}changeStyle(z={}){this.globalSize=z.fontSize||this.globalSize||"24px",this.globalFamily=z.fontFamily||this.globalFamily||"Microsoft JhengHei",this.globalStyle=z.fontStyle||this.globalStyle||"normal",this.globalWeight=z.fontWeight||this.globalWeight||"normal",this.globalColor=z.fontColor||this.globalColor||"#ffffff",this.opacity=z.opacity||this.opacity||1,this.globalChanged=!0}initStyle(z){this.globalChanged=!1,this.font(),z.font=this.globalFont,z.textBaseline="middle",z.fillStyle=this.globalColor,z.strokeStyle="rgba(0,0,0,0.3)",z.globalAlpha=this.opacity}reset(z=0){for(let[A,B,C,D,E]=[this.save,this.width,this.leftTime,z];E=A[D++];)"slide"==E.type?(E.x=B,E.rowRid=!1):E.leftTime=C,E.pastTime=0,E.recovery=!1;this.startIndex=z}getSize(){this.width=this.canvas.width,this.height=this.canvas.height,this.deleteRow(),this.countRows(),this.globalChanged=!0}deleteRow(){for(let[z,A,B]=[this.save,0];B=z[A++];)B.row=null}countRows(){let z=parseInt(this.globalSize)+this.space,[A,B]=[(this.height-20)/z>>0,this.rows];for(let C of Object.keys(B))B[C]=[];for(let D,C=0;C<A;C++)D={idx:C,y:z*C+20},B.slide.push(D),C>=A/2?B.bottom.push(D):B.top.push(D);this.unitHeight=z,this.rowNum=A}getRow(z){if(z.row)return z.row;const[A,B]=[this.rows,z.type],C="bottom"==B?A[B].pop():A[B].shift(),D=this["getRow_"+B]();return C&&"slide"==z.type&&(z.duration-=150*C.idx),C||D}getRow_bottom(){return{y:20+this.unitHeight*(g.random()*this.rowNum/2+this.rowNum/2<<0),speedChange:!1,tempItem:!0}}getRow_slide(){return{y:20+this.unitHeight*(g.random()*this.rowNum<<0),speedChange:!0,tempItem:!0}}getRow_top(){return{y:20+this.unitHeight*(g.random()*this.rowNum/2<<0),speedChange:!1,tempItem:!0}}countWidth(z,A=this.cxt){this.looped=!0;for(let E,[B,C,D]=[this.width,0];D=z[C++];)E=A.measureText(D.text).width>>0,D.width=E,D.height=parseInt(this.globalSize),D.x=B,D.duration=this.duration,D.pastTime=0,"slide"!=D.type&&(D.x=(B-E)/2,D.leftTime=this.leftTime)}updateStyle(z,A){A.font=this.globalStyle+" "+this.globalWeight+" "+z.fontSize+" "+this.globalFamily,A.fillStyle=z.color||this.globalColor}update(z,A,B){let[C,D,E]=[this.save,this.cxt,this.Tween[this.type]];if(this.globalChanged&&this.initStyle(D),this.looped||this.countWidth(C),this.paused)return!1;this.refresh(C);let[F,G]=[this.startIndex];for(D.clearRect(0,0,z,A);G=C[F++];){let H=G.width,I=this.getDiretionSettings(H,z);this.step(G,B,I,E,this.timing),this.draw(G,D),this.recovery(G,I)}}step(z,A,B,C,D){let[E,F]=[this.getRow(z),z.width];E.speedChange&&(E.speedChange=!1,z.duration-=5e3*g.random()>>0),z.pastTime+=A,z.leftTime?z.leftTime-=A:"",z.x="slide"==z.type&&C(D,z.pastTime,B.start,B.dist,z.duration)||z.x,z.y=z.y||E.y,z.row=E}draw(z,A){if(z.recovery||z.hide)return!1;A.save(),z.change&&this.updateStyle(z,A);let[B,C,D]=[z.text,z.x,z.y];A.fillText(B,C,D),A.strokeText(B,C,D),A.restore()}recovery(z,A){return"slide"==z.type?(z.recovery=this.recoverySlide(z,A),!1):void(z.recovery=this.recoveryStatic(z))}recoverySlide(z,A){let B=z.x;return z.rowRid||!A.flag(B)||z.row.tempItem||(this.rows[z.type].unshift(z.row),z.rowRid=!0),!(z.pastTime<=z.duration)}recoveryStatic(z){if(0<z.leftTime)return!1;let A=z.type;return z.row.tempItem||(this.rows[A].unshift(z.row),z.row=null),!0}refresh(z){let[A,B,C]=[this.startIndex,,this.rows];for(let D of Object.keys(C))C[D].sort(function(E,F){return E.y-F.y});for(;B=z[A++];){if(!B.recovery)return!1;this.startIndex=A,B.row=null}}getDiretionSettings(z,A){return"ltor"==this.direction?{start:-z,dist:z+A,flag:B=>B>=z}:{start:A,dist:-z-A,flag:B=>B<A-z}}}class p{constructor(z,A={}){this.canvas=z,this.cxt=z.getContext("2d"),this.enable=!1!==A.enable,this.startIndex=0,this.Tween=new Proxy(new q(),{get:function(B,C){return"function"==typeof B[C]?B[C].bind(B):B[C]}}),this.save=[]}add(z){if(!z||"object"!=typeof z)return!1;for(let[A,B,C]=[z.steps,0];C=A[B++];)this.initStep(C);this.save.push(z)}clear(){this.save=[],this.startIndex=0}reset(z){for(let[A,B]=[this.save];B=A[z++];)B.hide=!1}pause(){this.paused=!0}run(){this.paused=!1}enableEffect(){this.enable=!0}disableEffect(){this.enable=!1}initStep(z){z.type=z.type||"quad",z.scale=z.scale||{};let A=z.scale;A.startX=A.startX||1,A.startY=A.startY||1,A.endX=A.endX||1,A.endY=A.endY||1,A.distX=A.endX-A.startX,A.distY=A.endY-A.startY,A.timing=A.timing||"linear",z.rotate=z.rotate||{};let B=z.rotate;B.start=B.start,B.end=B.end,B.dist=B.end-B.start,B.timing=B.timing||"linear",z.translate=z.translate||{};let C=z.translate;C.endX=C.endX||0,C.startX=C.startX||0,C.endY=C.endY||0,C.startY=C.startY||0,C.distX=C.endX-C.startX,C.distY=C.endY-C.startY,C.timing=C.timing||"linear",z.skew=z.skew||{};let D=z.skew;D.startX=D.startX||0,D.startY=D.startY||0,D.endX=D.endX||0,D.endY=D.endY||0,D.distX=D.endX-D.startX,D.distY=D.endY-D.startY,D.timing=D.timing||"linear",z.opacity=z.opacity||{};let E=z.opacity;E.start=E.start||1,E.end=E.end||1,E.dist=E.end-E.start,E.timing=E.timing||"linear",z.pastTime=z.pastTime||0,z.duration=z.duration||3e3,z.fillStyle=z.fillStyle||"#ffffff",z.strokeStyle=z.strokeStyle||"#ffffff",z.radius=z.radius||10,C.distX=z.points?z.distX||0:C.distX,C.distY=z.points?z.distY||0:C.distY}getSize(){this.width=this.canvas.width,this.height=this.canvas.height}clearRect(){this.cxt.clearRect(0,0,this.width,this.height)}update(z,A,B){if(this.paused)return!1;let[C,D]=[this.canvas,this.cxt];if(D.clearRect(0,0,z,A),!this.enable)return!1;for(let[E,F,G]=[this.startIndex,this.save];G=F[E++];)if(!G.hide){let J=G.steps,K=J[G.currentIndex];this.step(G,K,B),this.draw(G,K,D),this.recovery(G,K)}}step(z,A,B){A.pastTime+=B;let[C,D]=[A.pastTime,A.duration],E=this.Tween[A.type],[F,G,H,I,J]=[A.translate,A.rotate,A.scale,A.skew,A.opacity];"polygon"==z.type&&this.stepCheckPolygon(A,z),A.x=E(F.timing,C,F.startX,F.distX,D),A.y=E(F.timing,C,F.startY,F.distY,D),A.scaleX=E(H.timing,C,H.startX,H.distX,D),A.scaleY=E(H.timing,C,H.startY,H.distY,D),A.rot=E(G.timing,C,G.start,G.dist,D),A.skewX=E(I.timing,C,I.startX,I.distX,D),A.skewY=E(I.timing,C,I.startY,I.distY,D),A.opa=E(J.timing,C,J.start,J.dist,D)}stepCheckPolygon(z,A){let B=A.currentIndex,C=z.translate;if(0==B){let[D,E,F,G]=[0,0,z.points.concat([])||[],0],[H,I]=[0];for(;I=F[H++];)D+=I.x,E+=I.y,G++;if(0>=G)return!1;C.startX=D/G,C.startY=E/G,z.firstPoint=z.points.concat([]).shift()}else if(!z.points){let D=A.steps[B-1];C.startX=D.x,C.startY=D.y,z.points=D.points,z.firstPoint=D.firstPoint}}draw(z,A,B){B.save(),!this[z.type]||this[z.type](A,B,g,g.PI/180),B.restore()}rect(z,A,B,C){let[D,E,F,G]=[z.x,z.y,z.width,z.height],[H,I]=[B.tan(z.skewX*C),B.tan(z.skewY*C)];A.beginPath(),A.transform(z.scaleX,H,I,z.scaleY,D+F/2,E+G/2),A.rotate(z.rot*B.PI/180),A.globalAlpha=z.opa,A.rect(-F/2,-G/2,F,G),A.closePath(),A.fillStyle=z.fillStyle,A.strokeStyle=z.strokeStyle,A.fill(),A.stroke()}text(z,A,B,C){let[D,E,F,G,H]=[z.fontStyle||"normal",z.fontWeight||"normal",z.fontSize||"24px",z.fontFamily||"Microsoft JhengHei",z.text||""];A.font=D+" "+E+" "+F+" "+G;let[I,J,K,L]=[z.x,z.y,A.measureText(H).width,parseInt(F)],[M,N]=[B.tan(z.skewX*C),B.tan(z.skewY*C)];A.transform(z.scaleX,M,N,z.scaleY,I+K/2,J+L/2),A.rotate(z.rot*B.PI/180),A.globalAlpha=z.opa,A.fillStyle=z.fillStyle,A.strokeStyle=z.strokeStyle,A.fillText(H,-K/2,-L/2),A.strokeText(H,-K/2,-L/2)}polygon(z,A,B,C){let D=z.points,[E,F,G]=[z.x,z.y,z.firstPoint],[H,I]=[B.tan(z.skewX*C),B.tan(z.skewY*C)],[J,K=J.startX,L=J.startY]=[z.translate];A.beginPath(),A.transform(z.scaleX,H,I,z.scaleY,E,F),A.rotate(z.rot*B.PI/180),A.globalAlpha=z.opa,A.fillStyle=z.fillStyle,A.strokeStyle=z.strokeStyle,A.moveTo(G.x-K,G.y-L);for(let[M,N]=[0];N=D[M++];)A.lineTo(N.x-K,N.y-L);A.closePath(),A.fill(),A.stroke()}circle(z,A,B,C){let[D,E,F]=[z.x,z.y,z.radius],[G,H]=[B.tan(z.skewX*C),B.tan(z.skewY*C)];A.beginPath(),A.transform(z.scaleX,G,H,z.scaleY,D+F,E+F),A.rotate(z.rot*B.PI/180),A.globalAlpha=z.opa,A.fillStyle=z.fillStyle,A.strokeStyle=z.strokeStyle,A.arc(0,0,F,0,2*B.PI,!1),A.closePath(),A.fill(),A.stroke()}recovery(z,A){A.pastTime>=A.duration&&(z.currentIndex++,A.pastTime=0),z.steps[z.currentIndex]||(z.hide=!0,z.currentIndex=0)}}class q{constructor(){}linear(z,A,B,C){return B*z/C+A}quad(z,...A){let B=this.linear;const C={linear:B,easeIn:(D,E,F,G)=>F*(D/=G)*D+E,easeOut:(D,E,F,G)=>-F*(D/=G)*(D-2)+E,easeInOut:(D,E,F,G)=>{return 1>(D/=G/2)?F/2*D*D+E:-F/2*(--D*(D-2)-1)+E}};return!!C[z]&&C[z](...A)}cubic(z,...A){let B=this.linear;const C={linear:B,easeIn:(D,E,F,G)=>F*(D/=G)*D*D+E,easeOut:(D,E,F,G)=>F*((D=D/G-1)*D*D+1)+E,easeInOut:(D,E,F,G)=>{return 1>(D/=G/2)?F/2*D*D*D+E:F/2*((D-=2)*D*D+2)+E}};return!!C[z]&&C[z](...A)}quart(z,...A){let B=this.linear;const C={linear:B,easeIn:(D,E,F,G)=>F*(D/=G)*D*D*D+E,easeOut:(D,E,F,G)=>-F*((D=D/G-1)*D*D*D-1)+E,easeInOut:(D,E,F,G)=>{return 1>(D/=G/2)?F/2*D*D*D*D+E:-F/2*((D-=2)*D*D*D-2)+E}};return!!C[z]&&C[z](...A)}quint(z,...A){let B=this.linear;const C={linear:B,easeIn:(D,E,F,G)=>F*(D/=G)*D*D*D*D+E,easeOut:(D,E,F,G)=>F*((D=D/G-1)*D*D*D*D+1)+E,easeInOut:(D,E,F,G)=>{return 1>(D/=G/2)?F/2*D*D*D*D*D+E:F/2*((D-=2)*D*D*D*D+2)+E}};return!!C[z]&&C[z](...A)}}class s{constructor(z,A={}){if(!z)throw new Error("\u6CA1\u6709\u8BBE\u7F6E\u6B63\u786E\u7684wrapper");this.wrapper=z,this.width=z.clientWidth,this.height=z.clientHeight,this.canvas=document.createElement("canvas"),this.canvas2=document.createElement("canvas"),this.normal=new o(this.canvas,A),this.effect=new p(this.canvas2,A),this.name=A.name||"",this.fps=0,this.drawing=A.auto||!1,this[m](),this[l](),A.enableEvent&&this.initEvent(A)}[m](){this.canvas.style.cssText="position:absolute;z-index:100;top:0px;left:0px;",this.canvas2.style.cssText="position:absolute;z-index:101;top:0px;left:0px;",this.setSize(),this.wrapper.appendChild(this.canvas),this.wrapper.appendChild(this.canvas2)}[l](z=this.normal,A=this.effect,B=new Date().getTime()){let C=new Date().getTime();if(!this.drawing)return z.clearRect(),A.clearRect(),!1;let[D,E,F]=[this.width,this.height,C-B];this.fps=1e3/F>>0,z.update(D,E,F),A.update(D,E,F);n(()=>{this[l](z,A,C)})}initEvent(z){let[A,B,C]=[this.canvas2,this.normal,!1];A.onmouseup=function(D){if(D=D||event,C)return!1;if(C=!0,2==D.button){let[E,F]=[D.target.getBoundingClientRect(),""],[G,H,I,J,K]=[D.clientX-E.left,D.clientY-E.top,0,B.save];for(;K=J[I++];){let[M,N,O,P]=[K.x,K.y,K.width+10,K.height];if(!(G<M||G>M+O||H<N-P/2||H>N+P/2||K.hide||K.recovery)){F=K;break}}let L=z.callback||function(){};L(F),C=!1}},A.oncontextmenu=function(D){D=D||event,D.preventDefault()}}inputData(z={}){return"object"==typeof z&&z.type&&void this.normal.add(z)}inputEffect(z={}){return"object"==typeof z&&z.type&&z.steps&&void this.effect.add(z)}clear(){this.normal.clear(),this.effect.clear()}reset(z,A){this.normal.reset(z),this.effect.reset(A)}pause(){this.normal.pause(),this.effect.pause()}run(){this.normal.run(),this.effect.run()}addFilter(z,A){this.normal.addFilter(z,A)}removeFilter(z,A){this.normal.removeFilter(z,A)}disableEffect(){this.effect.disableEffect()}enableEffect(){this.effect.enableEffect()}setSize(z=this.width,A=this.height){return!Number.isInteger(z)||0>z||!Number.isInteger(A)||0>A?!1:void(this.width=z,this.height=A,this.canvas.width=z,this.canvas.height=A,this.canvas2.width=z,this.canvas2.height=A,this.normal.getSize(),this.effect.getSize())}getSize(){return{width:this.width,height:this.height}}changeStyle(z={}){this.normal.changeStyle(z)}addGradient(z,A){this.normal.addGradient(z,A)}changeDirection(z){this.normal.changeDirection(z)}changeTiming(z,A){this.normal.changeTiming(z,A)}start(){return!this.drawing&&void(this.drawing=!0,this[l]())}stop(){this.drawing=!1}getFPS(){return this.fps}}let u=function(z,A){let B=new Proxy(new s(z,A),{get:function(D,E){return"function"==typeof D[E]?D[E].bind(D):D[E]}}),C=B;return{pause:C.pause,run:C.run,start:C.start,stop:C.stop,changeStyle:C.changeStyle,addGradient:C.addGradient,setSize:C.setSize,inputData:C.inputData,inputEffect:C.inputEffect,clear:C.clear,reset:C.reset,addFilter:C.addFilter,removeFilter:C.removeFilter,disableEffect:C.disableEffect,enableEffect:C.enableEffect,getSize:C.getSize,timing:C.changeTiming,direction:C.changeDirection,getFPS:C.getFPS}};f.DanMuer=u,"undefined"!=typeof module&&module.exports?module.exports=u:"function"==typeof define&&define.amd&&define(function(){return u})})(window,Math);