| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459 |
- import"./modulepreload-polyfill-B5Qt9EMX.js";class Wt{constructor(t,e){this.x=t,this.y=e}}class yt{constructor(t,e,r,u){this.x=t,this.y=e,this.width=r,this.height=u}get center(){return new Wt(this.x+this.width/2,this.y+this.height/2)}static fromCenter(t,e,r){return new yt(t.x-e/2,t.y-r/2,e,r)}toString(){return`Rect(${this.x}, ${this.y},${this.width}, ${this.height})`}vertex(){var t=this.x,e=this.x+this.width,r=this.y,u=this.y+this.height;return[t,r,e,r,t,u,t,u,e,r,e,u]}coverRadius(t,e){var r,u;t>this.x+this.width/2?r=this.x:r=this.x+this.width,e>this.y+this.height/2?u=this.y:u=this.y+this.height;var a=t-r,f=e-u;return Math.sqrt(a*a+f*f)}centerFitTo(t){const e=Math.min(t.width/this.width,t.height/this.height),r=e*this.width,u=e*this.height,a=t.width/2-r/2,f=t.height/2-u/2;return new yt(t.x+a,t.y+f,r,u)}}function Yt(v,t,e){var r,u;t>v.x+v.width/2?r=v.x:r=v.x+v.width,e>v.y+v.height/2?u=v.y:u=v.y+v.height;var a=t-r,f=e-u;return Math.sqrt(a*a+f*f)}function pt(v,t,e,r,u,a){v[t]=e,v[t+1]=r,v[t+2]=e+u,v[t+3]=r,v[t+4]=e,v[t+5]=r+a,v[t+6]=e,v[t+7]=r+a,v[t+8]=e+u,v[t+9]=r,v[t+10]=e+u,v[t+11]=r+a}function Bt(v,t,e,r){const u=new Float32Array(12),a=0;return u[a]=v,u[a+1]=t,u[a+2]=v+e,u[a+3]=t,u[a+4]=v,u[a+5]=t+r,u[a+6]=v,u[a+7]=t+r,u[a+8]=v+e,u[a+9]=t,u[a+10]=v+e,u[a+11]=t+r,u}class It{constructor(t,e,r,u){this.duration=t,this.onUpdate=e,this.onEnd=r,this.interpolator=u,this.startTime=new Date().getTime(),this._progress=0,this.running=!0,this.ended=!1,this.canceled=!1}get progress(){return this._progress}update(){if(this.removable())return;const t=new Date().getTime()-this.startTime;t<this.duration?(this._progress=t/this.duration,this.onUpdate(this)):t>=this.duration&&(this.running?(this._progress=1,this.onUpdate(this),this.running=!1):this.end())}removable(){return this.ended||this.canceled}cancel(){this.canceled||(this.canceled=!0,this.end())}end(){this.ended||(this.onEnd(this),this.ended=!0)}value(){return this.interpolator!=null?this.interpolator.getInterpolation(this._progress):this._progress}}class jt{constructor(t,e){this.touches=[],this.distance=0,this.callbacks=e,this.el=t}removeTouch(t){let e=this.touches.findIndex(r=>r.identifier==t);e>=0&&this.touches.splice(e,1)}getTouch(t){let e=this.touches.findIndex(r=>r.identifier==t);return e>=0?this.touches[e]:null}getX(t){return t.pageX}getY(t){return t.pageY}start(t){for(var e=0;e<t.length;e++){let r=t[e];this.removeTouch(r.identifier),this.touches.push({lastX:this.getX(r),lastY:this.getY(r),dx:0,dy:0,identifier:r.identifier})}this.touches.length==1&&(this.distance=0),this.updateFocus()}updateFocus(){if(this.touches.length<2){this.scaleTracker=void 0;return}let t=this.touches[0],e=this.touches[1],r=(t.lastX+e.lastX)/2,u=(t.lastY+e.lastY)/2,a=Math.sqrt(Math.pow(e.lastX-t.lastX,2)+Math.pow(e.lastY-t.lastY,2));this.scaleTracker={focusX:r,focusY:u,distance:a}}end(t){var r,u;console.log("end");for(var e=0;e<t.length;e++)this.removeTouch(t[e].identifier);if(this.updateFocus(),this.touches.length<=0&&this.distance==0){let a=t[0];a.target,(u=(r=this.callbacks)==null?void 0:r.tap)==null||u.call(r,a.clientX,a.clientY)}}move(t){var r,u,a,f,o,n;for(var e=0;e<t.length;e++){let b=t[e],x=this.getTouch(b.identifier);if(x!=null)if(x.dx=this.getX(b)-x.lastX,x.dy=this.getY(b)-x.lastY,x.lastX=this.getX(b),x.lastY=this.getY(b),this.scaleTracker){let _=this.touches[0],A=this.touches[1],p=(_.lastX+A.lastX)/2,c=(_.lastY+A.lastY)/2,s=Math.sqrt(Math.pow(A.lastX-_.lastX,2)+Math.pow(A.lastY-_.lastY,2)),d=p-this.scaleTracker.focusX,l=c-this.scaleTracker.focusY,m=s/this.scaleTracker.distance;console.log(`dx=${d}, dy=${l}, scale=${m}, distance=${s}`),(u=(r=this.callbacks).drag)==null||u.call(r,d,l),(f=(a=this.callbacks).zoom)==null||f.call(a,m,p,c),this.scaleTracker.focusX=p,this.scaleTracker.focusY=c,this.scaleTracker.distance=s,this.distance+=Math.abs(d)+Math.abs(l)}else(n=(o=this.callbacks).drag)==null||n.call(o,x.dx,x.dy),this.distance+=Math.abs(x.dx)+Math.abs(x.dy)}}}class Ht{constructor(t,e){var r,u,a=!1,f=0,o=0,n=0;t.addEventListener("mousedown",x=>{a=!0,f=x.clientX,o=x.clientY,n=0}),document.addEventListener("mouseup",x=>{var _;a=!1,n==0&&x.target==t&&((_=e.tap)==null||_.call(e,x.offsetX,x.offsetY))}),document.addEventListener("mousemove",x=>{var _;a&&(x.preventDefault(),r=x.clientX-f,u=x.clientY-o,f=x.clientX,o=x.clientY,n+=Math.abs(r)+Math.abs(u),(_=e==null?void 0:e.drag)==null||_.call(e,r,u))}),t.addEventListener("wheel",x=>{var A;x.preventDefault();let _=x.deltaY*-.01+1;(A=e.zoom)==null||A.call(e,_,x.offsetX,x.offsetY)}),t.addEventListener("click",x=>{x.preventDefault()});const b=new jt(t,e);t.addEventListener("touchstart",x=>{x.preventDefault(),b.start(x.changedTouches)}),t.addEventListener("touchmove",x=>{b.move(x.changedTouches)}),t.addEventListener("touchend",x=>{b.end(x.changedTouches)}),t.addEventListener("touchcancel",x=>{b.end(x.changedTouches)})}}var ut;(v=>{let t=Float32Array;function e(c,s,d=null){d=d||new t(16);var l=s[0*4+0],m=s[0*4+1],E=s[0*4+2],R=s[0*4+3],C=s[1*4+0],z=s[1*4+1],B=s[1*4+2],O=s[1*4+3],L=s[2*4+0],M=s[2*4+1],$=s[2*4+2],w=s[2*4+3],D=s[3*4+0],h=s[3*4+1],I=s[3*4+2],J=s[3*4+3],G=c[0*4+0],tt=c[0*4+1],W=c[0*4+2],K=c[0*4+3],S=c[1*4+0],F=c[1*4+1],q=c[1*4+2],V=c[1*4+3],j=c[2*4+0],at=c[2*4+1],ot=c[2*4+2],et=c[2*4+3],rt=c[3*4+0],st=c[3*4+1],nt=c[3*4+2],ct=c[3*4+3];return d[0]=l*G+m*S+E*j+R*rt,d[1]=l*tt+m*F+E*at+R*st,d[2]=l*W+m*q+E*ot+R*nt,d[3]=l*K+m*V+E*et+R*ct,d[4]=C*G+z*S+B*j+O*rt,d[5]=C*tt+z*F+B*at+O*st,d[6]=C*W+z*q+B*ot+O*nt,d[7]=C*K+z*V+B*et+O*ct,d[8]=L*G+M*S+$*j+w*rt,d[9]=L*tt+M*F+$*at+w*st,d[10]=L*W+M*q+$*ot+w*nt,d[11]=L*K+M*V+$*et+w*ct,d[12]=D*G+h*S+I*j+J*rt,d[13]=D*tt+h*F+I*at+J*st,d[14]=D*W+h*q+I*ot+J*nt,d[15]=D*K+h*V+I*et+J*ct,d}v.multiply=e;function r(c=null){return c=c||new t(16),c[0]=1,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=1,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=1,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c}v.identity=r;function u(c,s,d,l=null){return l=l||new t(16),l[0]=1,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=1,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=1,l[11]=0,l[12]=c,l[13]=s,l[14]=d,l[15]=1,l}v.translation=u;function a(c,s,d,l){return l=l||new t(16),l[0]=c,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=s,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=d,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,l}v.scaling=a;function f(c,s,d,l,m){return m=m||new t(16),m[0]=s*c[0*4+0],m[1]=s*c[0*4+1],m[2]=s*c[0*4+2],m[3]=s*c[0*4+3],m[4]=d*c[1*4+0],m[5]=d*c[1*4+1],m[6]=d*c[1*4+2],m[7]=d*c[1*4+3],m[8]=l*c[2*4+0],m[9]=l*c[2*4+1],m[10]=l*c[2*4+2],m[11]=l*c[2*4+3],c!==m&&(m[12]=c[12],m[13]=c[13],m[14]=c[14],m[15]=c[15]),m}v.scale=f;function o(c,s=null){s=s||new t(16);var d=c[0*4+0],l=c[0*4+1],m=c[0*4+2],E=c[0*4+3],R=c[1*4+0],C=c[1*4+1],z=c[1*4+2],B=c[1*4+3],O=c[2*4+0],L=c[2*4+1],M=c[2*4+2],$=c[2*4+3],w=c[3*4+0],D=c[3*4+1],h=c[3*4+2],I=c[3*4+3],J=M*I,G=h*$,tt=z*I,W=h*B,K=z*$,S=M*B,F=m*I,q=h*E,V=m*$,j=M*E,at=m*B,ot=z*E,et=O*D,rt=w*L,st=R*D,nt=w*C,ct=R*L,dt=O*C,i=d*D,P=w*l,U=d*L,y=O*l,g=d*C,T=R*l,N=J*C+W*L+K*D-(G*C+tt*L+S*D),X=G*l+F*L+j*D-(J*l+q*L+V*D),k=tt*l+q*C+at*D-(W*l+F*C+ot*D),Y=S*l+V*C+ot*L-(K*l+j*C+at*L),H=1/(d*N+R*X+O*k+w*Y);return s[0]=H*N,s[1]=H*X,s[2]=H*k,s[3]=H*Y,s[4]=H*(G*R+tt*O+S*w-(J*R+W*O+K*w)),s[5]=H*(J*d+q*O+V*w-(G*d+F*O+j*w)),s[6]=H*(W*d+F*R+ot*w-(tt*d+q*R+at*w)),s[7]=H*(K*d+j*R+at*O-(S*d+V*R+ot*O)),s[8]=H*(et*B+nt*$+ct*I-(rt*B+st*$+dt*I)),s[9]=H*(rt*E+i*$+y*I-(et*E+P*$+U*I)),s[10]=H*(st*E+P*B+g*I-(nt*E+i*B+T*I)),s[11]=H*(dt*E+U*B+T*$-(ct*E+y*B+g*$)),s[12]=H*(st*M+dt*h+rt*z-(ct*h+et*z+nt*M)),s[13]=H*(U*h+et*m+P*M-(i*M+y*h+rt*m)),s[14]=H*(i*z+T*h+nt*m-(g*h+st*m+P*z)),s[15]=H*(g*M+ct*m+y*z-(U*z+T*M+dt*m)),s}v.inverse=o;function n(c,s,d=null){d=d||new t(3);var l=s[0],m=s[1],E=s[2],R=l*c[0*4+3]+m*c[1*4+3]+E*c[2*4+3]+c[3*4+3];return d[0]=(l*c[0*4+0]+m*c[1*4+0]+E*c[2*4+0]+c[3*4+0])/R,d[1]=(l*c[0*4+1]+m*c[1*4+1]+E*c[2*4+1]+c[3*4+1])/R,d[2]=(l*c[0*4+2]+m*c[1*4+2]+E*c[2*4+2]+c[3*4+2])/R,d}v.transformPoint=n;function b(c,s=null){return s=s||new t(16),s[0]=c[0],s[1]=c[1],s[2]=c[2],s[3]=c[3],s[4]=c[4],s[5]=c[5],s[6]=c[6],s[7]=c[7],s[8]=c[8],s[9]=c[9],s[10]=c[10],s[11]=c[11],s[12]=c[12],s[13]=c[13],s[14]=c[14],s[15]=c[15],s}v.copy=b;function x(c,s,d=null){return d=r(d),d[0]=2/c,d[5]=-2/s,d[12]=-1,d[13]=1,d}v.projection=x;function _(c,s,d=null){return d=r(d),d[0]=2/c,d[5]=2/s,d[12]=-1,d[13]=-1,d}v.projectionNoflipY=_;function A(c,s,d,l){let m=r();return m[0]=c,m[5]=s,m[12]=-c*d+d,m[13]=-s*l+l,m}v.scaleAt=A;function p(c,s,d,l){for(var m=0;m<16;m++)d[m]=c[m]+(s[m]-c[m])*l}v.lerp=p})(ut||(ut={}));class bt{preDraw(){}draw(){}tap(t,e,r,u){}scale(t){}dispose(){}}class Pt{constructor(t,e,r,u){this.left=t,this.top=e,this.right=r,this.bottom=u}equals(t){return this.left==t.left&&this.top==t.top&&this.right==t.right&&this.bottom==t.bottom}}class Zt{constructor(t,e,r=window){this.gl=t,this.ratio=e,this.animationFrameProvider=r,this.layers=[],this.testLayers=[],this.animators=[],this.userMat=ut.identity(),this.bestFitMat=ut.identity(),this.projectionMat=ut.identity(),this.width=0,this.height=0,this.contentWidth=0,this.contentHeight=0,this.padding=new Pt(0,0,0,0),this.pendingDraw=!1,this.isBestMatSet=!1,this.updateViewport();let u=this;window&&new Ht(t.canvas,{drag:u.drag.bind(u),zoom:u.scaleAt.bind(u),tap:u.tap.bind(u)}),ut.identity()}updateViewport(){console.log("viewport update.");const e=this.gl.canvas;this.invalidate(),(e.width!=this.width||e.height!=this.height)&&(this.width=e.width,this.height=e.height,ut.projection(this.width,this.height,this.projectionMat),this.updateBestFit())}updateBestFit(){if(this.contentWidth==0||this.width==0)return;const t=new yt(this.padding.left,this.padding.top,this.width-this.padding.right-this.padding.left,this.height-this.padding.top-this.padding.bottom),e=Math.min(t.width/this.contentWidth,t.height/this.contentHeight),r=t.center.x-this.contentWidth*e/2,u=t.center.y-this.contentHeight*e/2;ut.identity(this.bestFitMat),this.bestFitMat[0]=e,this.bestFitMat[5]=e,this.bestFitMat[12]=r,this.bestFitMat[13]=u,this.isBestMatSet||(ut.copy(this.bestFitMat,this.userMat),this.invalidate(),this.isBestMatSet=!0)}setContentPadding(t){this.padding.equals(t)||(this.padding=t,this.updateBestFit())}setContentSize(t,e){(t!=this.contentWidth||e!=this.contentWidth)&&(this.contentWidth=t,this.contentHeight=e,this.updateBestFit())}addLayer(t){this.layers.push(t),this.invalidate()}invalidate(){this.pendingDraw||(this.pendingDraw=!0,this.animationFrameProvider.requestAnimationFrame(()=>{this.draw()}))}draw(){this.animators.forEach(r=>r.update()),this.layers.forEach(r=>r.preDraw());const t=this.gl;t.viewport(0,0,this.width,this.height);let e=239/255;t.clearColor(e,e,e,1),t.clear(t.COLOR_BUFFER_BIT),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.enable(t.BLEND),t.disable(t.DEPTH_TEST),this.layers.forEach(r=>r.draw()),this.pendingDraw=!1,this.animators=this.animators.filter(r=>!r.removable()),this.animators.length>0&&this.invalidate()}get drawMatrix(){return ut.multiply(this.projectionMat,this.userMat)}drag(t,e){let r=ut.translation(t*this.ratio,e*this.ratio,0);this.userMat=ut.multiply(r,this.userMat),this.invalidate()}scaleAt(t,e,r){e*=this.ratio,r*=this.ratio;let u=ut.scaleAt(t,t,e,r);this.userMat=ut.multiply(u,this.userMat),this.layers.forEach(a=>a.scale(this.userMat[0])),this.invalidate()}tap(t,e){let r=t*this.ratio,u=e*this.ratio,[a,f]=ut.transformPoint(ut.inverse(this.userMat),new Float32Array([r,u,0]));this.layers.forEach(o=>o.tap(a,f,r,u))}addAnimator(t){this.animators.push(t),this.invalidate()}addTestLayer(t){this.testLayers.push(t),this.testLayers.length<=1&&this.layers.push(t),this.invalidate()}toggleTestLayer(){if(this.testLayers.length==0)return;let t=this.testLayers.findIndex(u=>this.layers.indexOf(u)>=0),e=(t+1)%this.testLayers.length,r=this.testLayers[e];t>=0&&(this.layers=this.layers.filter(u=>u!=this.testLayers[t])),console.log(`toggleTestLayer, layer=${r}`),this.layers.push(r),this.invalidate()}setScale(t){ut.scaling(t,t,1,this.userMat),this.invalidate()}updateUserMat(t){ut.copy(t,this.userMat),this.invalidate()}matrixAnimationTo(t,e,r,u){const a=ut.copy(this.userMat),f=new Float32Array(16),o=new It(e,()=>{ut.lerp(a,t,f,o.value()),this.updateUserMat(f)},()=>{u==null||u()},r);this.addAnimator(o)}resetToBestFit(){this.matrixAnimationTo(this.bestFitMat,600)}dispose(){for(;this.layers.length>0;){let t=this.layers.pop();t==null||t.dispose()}}}function ft(v,t,e){var r=v.createShader(t);v.shaderSource(r,e),v.compileShader(r);var u=v.getShaderParameter(r,v.COMPILE_STATUS);if(u)return r;console.log("error",v.getShaderInfoLog(r)),v.deleteShader(r)}function vt(v,t,e){var r=v.createProgram();v.attachShader(r,t),v.attachShader(r,e),v.linkProgram(r);var u=v.getProgramParameter(r,v.LINK_STATUS);if(u)return r;console.log("error",v.getProgramInfoLog(r)),v.deleteProgram(r)}function Vt(v){return new Promise((t,e)=>{let r=new Image;r.src=v,r.onload=()=>t(r),r.onerror=e})}function $t(v,t,e){return v<t?t:v>e?e:v}var Ot=(v=>(v[v.FitCenter=0]="FitCenter",v[v.Repeat=1]="Repeat",v))(Ot||{});class qt extends bt{constructor(t,e,r,u,a=0,f=e.width,o=e.height){super(),this.scene=t,this.image=e,this.width=r,this.height=u,this.texWidth=f,this.texHeight=o,this.vertexShaderCode=`
- attribute vec2 a_position;
- attribute vec2 a_texCoord;
- uniform mat4 u_matrix;
- varying vec2 v_texCoord;
- void main() {
- gl_Position = u_matrix * vec4(a_position, 0, 1);
- v_texCoord = a_texCoord;
- }
- `,this.fragmentShaderCode=`
- precision mediump float;
- uniform sampler2D u_image;
- varying vec2 v_texCoord;
- void main() {
- vec4 color = texture2D(u_image, v_texCoord);
- gl_FragColor = color;
- }
-
- `,this.vertexArray=new Float32Array(12),this.texCoordArray=new Float32Array(12);const n=t.gl;if(this.program=vt(n,ft(n,n.VERTEX_SHADER,this.vertexShaderCode),ft(n,n.FRAGMENT_SHADER,this.fragmentShaderCode)),this.aPositionLoc=n.getAttribLocation(this.program,"a_position"),this.aTexcoordLoc=n.getAttribLocation(this.program,"a_texCoord"),this.uMatrixLoc=n.getUniformLocation(this.program,"u_matrix"),pt(this.vertexArray,0,0,0,r,u),a==0){const b=new yt(0,0,r,u),x=new yt(0,0,f,o),_=b.centerFitTo(x);pt(this.texCoordArray,0,_.x/f,_.y/o,_.width/f,_.height/o)}else pt(this.texCoordArray,0,0,0,r/f,u/o);this.vertexBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this.vertexBuffer),n.bufferData(n.ARRAY_BUFFER,this.vertexArray,n.STATIC_DRAW),this.texcoordBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this.texcoordBuffer),n.bufferData(n.ARRAY_BUFFER,this.texCoordArray,n.STATIC_DRAW),this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e)}draw(){const t=this.scene.gl;t.useProgram(this.program),t.enableVertexAttribArray(this.aPositionLoc),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.vertexAttribPointer(this.aPositionLoc,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(this.aTexcoordLoc),t.bindBuffer(t.ARRAY_BUFFER,this.texcoordBuffer),t.vertexAttribPointer(this.aTexcoordLoc,2,t.FLOAT,!1,0,0),t.uniformMatrix4fv(this.uMatrixLoc,!1,this.scene.projectionMat),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.texture),t.drawArrays(t.TRIANGLES,0,6)}}class xt{constructor(t){this.color=t,this.parts=new Uint8Array(4);let e=new Uint32Array(this.parts.buffer);e[0]=t}toFloatArray(){let t=this.parts,e=new Float32Array(4);return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e[3]=t[3]/255,e}fillFloatArray(t,e,r=1){let u=this.parts;const a=u[0]/255,f=u[1]/255,o=u[2]/255,n=u[3]/255;for(var b=0;b<r;b++)t[e+4*b]=a,t[e+4*b+1]=f,t[e+4*b+2]=o,t[e+4*b+3]=n}css(){let t=this.parts;return`rgba(${t[0]},${t[1]},${t[2]},${t[3]})`}}class Kt{constructor(t,e,r,u){this.center=t,this.rect=e,this.id=r,this.colored=u}}class Jt{constructor(t,e){this.areas=t,this.color=e}get isAllColored(){return this.areas.every(t=>t.colored)}get firstUncoloredArea(){return this.areas.find(t=>!t.colored)}get progressPercent(){let t=this.areas.filter(u=>u.colored).length,e=this.areas.length;return t*100/e}}class Qt{constructor(t){this.areaGroups=t,this.areaHash=new Map,this.groupHash=new Map,t.forEach(e=>{Object.setPrototypeOf(e,Jt.prototype),e.areas.forEach(r=>{Object.setPrototypeOf(r,Kt.prototype),this.areaHash.set(r.id,r),this.groupHash.set(r.id,e)})})}get areaCount(){return this.areaGroups.reduce((t,e)=>t+e.areas.length,0)}get maxAreaCountOfGroup(){return this.areaGroups.reduce((t,e)=>Math.max(t,e.areas.length),0)}groupAreaHash(t){return t.areas.reduce((e,r)=>e.set(r.id,r),new Map)}}function Lt(v,t,e=v.NEAREST){let r=v.createTexture();return v.bindTexture(v.TEXTURE_2D,r),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,v.CLAMP_TO_EDGE),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,v.CLAMP_TO_EDGE),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,e),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,e),v.texImage2D(v.TEXTURE_2D,0,v.RGBA,v.RGBA,v.UNSIGNED_BYTE,t),r}function te(v,t){let e=v.createFramebuffer();v.bindFramebuffer(v.FRAMEBUFFER,e),v.framebufferTexture2D(v.FRAMEBUFFER,v.COLOR_ATTACHMENT0,v.TEXTURE_2D,t,0);let r=v.checkFramebufferStatus(v.FRAMEBUFFER)==v.FRAMEBUFFER_COMPLETE;return console.log(`canRead=${r}`),v.bindFramebuffer(v.FRAMEBUFFER,null),e}function zt(v,t,e,r,u){let a=Bt(t,e,r,u),f=v.createBuffer();return v.bindBuffer(v.ARRAY_BUFFER,f),v.bufferData(v.ARRAY_BUFFER,a,v.STATIC_DRAW),v.bindBuffer(v.ARRAY_BUFFER,null),f}class ee extends bt{constructor(t,e,r,u,a,f=4294901760,o=1){super(),this.scene=t,this.x=e,this.y=r,this.width=u,this.height=a,this.color=f,this.lineWidth=o,this.vertexShaderCode=`
- attribute vec2 a_position;
- uniform mat4 u_matrix;
- void main() {
- gl_Position = u_matrix * vec4(a_position, 0, 1);
- }
- `,this.fragmentShaderCode=`
- precision mediump float;
- uniform vec4 u_color;
- void main() {
- gl_FragColor = u_color;
- }
-
- `;const n=t.gl;this.program=vt(n,ft(n,n.VERTEX_SHADER,this.vertexShaderCode),ft(n,n.FRAGMENT_SHADER,this.fragmentShaderCode)),this.aPositionLoc=n.getAttribLocation(this.program,"a_position"),this.uMatrixLoc=n.getUniformLocation(this.program,"u_matrix"),this.uColorLoc=n.getUniformLocation(this.program,"u_color"),this.vertexArray=new Float32Array([e,r,e,r+a,e+u,r+a,e+u,r]),this.vertexBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this.vertexBuffer),n.bufferData(n.ARRAY_BUFFER,this.vertexArray,n.STATIC_DRAW),this.colorArray=new xt(f).toFloatArray()}draw(){const t=this.scene.gl;t.useProgram(this.program),t.enableVertexAttribArray(this.aPositionLoc),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.vertexAttribPointer(this.aPositionLoc,2,t.FLOAT,!1,0,0),t.uniformMatrix4fv(this.uMatrixLoc,!1,this.scene.drawMatrix),t.uniform4fv(this.uColorLoc,this.colorArray),t.lineWidth(this.lineWidth),t.drawArrays(t.LINE_LOOP,0,4)}}class re extends bt{constructor(t,e,r,u,a,f=4294967295,o=null){super(),this.scene=t,this.x=e,this.y=r,this.width=u,this.height=a,this.color=f,this.fragmentShader=o,this.vertexShaderCode=`
- attribute vec2 a_position;
- uniform mat4 u_matrix;
- void main() {
- gl_Position = u_matrix * vec4(a_position, 0, 1);
- }
- `,this.fragmentShaderCode=`
- precision mediump float;
- uniform vec4 u_color;
- void main() {
- gl_FragColor = u_color;
- }
-
- `,this.vertexArray=new Float32Array(12);const n=t.gl;this.program=vt(n,ft(n,n.VERTEX_SHADER,this.vertexShaderCode),ft(n,n.FRAGMENT_SHADER,o||this.fragmentShaderCode)),this.aPositionLoc=n.getAttribLocation(this.program,"a_position"),this.uMatrixLoc=n.getUniformLocation(this.program,"u_matrix"),this.uColorLoc=n.getUniformLocation(this.program,"u_color"),pt(this.vertexArray,0,e,r,u,a),this.vertexBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this.vertexBuffer),n.bufferData(n.ARRAY_BUFFER,this.vertexArray,n.STATIC_DRAW),this.colorArray=new xt(f).toFloatArray()}draw(){const t=this.scene.gl;t.useProgram(this.program),t.enableVertexAttribArray(this.aPositionLoc),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.vertexAttribPointer(this.aPositionLoc,2,t.FLOAT,!1,0,0),t.uniformMatrix4fv(this.uMatrixLoc,!1,this.scene.drawMatrix),t.uniform4fv(this.uColorLoc,this.colorArray),t.drawArrays(t.TRIANGLES,0,6)}toString(){return"BoxLayer()"}}function ie(v,t,e,r,u){const o=vt(v,ft(v,v.VERTEX_SHADER,`
- attribute vec2 a_position;
- attribute vec2 a_texCoord;
- attribute vec4 a_color;
- attribute vec4 a_destColor;
- uniform mat4 u_matrix;
- varying vec2 v_texCoord;
- varying vec4 v_color;
- varying vec4 v_destColor;
- void main() {
- gl_Position = u_matrix * vec4(a_position, 0, 1);
- v_texCoord = a_texCoord;
- v_color = a_color;
- v_destColor = a_destColor;
- }
- `),ft(v,v.FRAGMENT_SHADER,`
- precision mediump float;
- uniform sampler2D u_image;
- //uniform vec4 u_color;
- varying vec2 v_texCoord;
- varying vec4 v_color;
- varying vec4 v_destColor;
- void main() {
- vec4 color = texture2D(u_image, v_texCoord);
- float dist = distance(color, v_color);
- if(dist < 0.001) {
- gl_FragColor = v_destColor;
- }else{
- gl_FragColor = vec4(0,0,0,0);
- }
- }
- `)),n=v.createTexture();v.bindTexture(v.TEXTURE_2D,n),v.texImage2D(v.TEXTURE_2D,0,v.RGBA,r,u,0,v.RGBA,v.UNSIGNED_BYTE,null),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,v.LINEAR),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,v.LINEAR),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,v.CLAMP_TO_EDGE),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,v.CLAMP_TO_EDGE);const b=v.createFramebuffer();v.bindFramebuffer(v.FRAMEBUFFER,b),v.framebufferTexture2D(v.FRAMEBUFFER,v.COLOR_ATTACHMENT0,v.TEXTURE_2D,n,0);let x=v.getAttribLocation(o,"a_position"),_=v.getAttribLocation(o,"a_texCoord"),A=v.getAttribLocation(o,"a_color"),p=v.getAttribLocation(o,"a_destColor"),c=v.getUniformLocation(o,"u_matrix");const s=e.areaCount,d=new Float32Array(12*s),l=new Float32Array(12*s),m=new Float32Array(24*s),E=new Float32Array(24*s);for(var R=0,C=0,z=0;z<e.areaGroups.length;z++)for(var B=e.areaGroups[z],O=new xt(B.color),L=0;L<B.areas.length;L++){var M=B.areas[L];pt(d,R,M.rect.x,M.rect.y,M.rect.width,M.rect.height),pt(l,R,M.rect.x/r,M.rect.y/u,M.rect.width/r,M.rect.height/u);var $=new xt(M.id);$.fillFloatArray(m,C,6),O.fillFloatArray(E,C,6),R+=12,C+=24}v.useProgram(o);let w=v.createBuffer();v.bindBuffer(v.ARRAY_BUFFER,w),v.bufferData(v.ARRAY_BUFFER,m,v.STATIC_DRAW),v.enableVertexAttribArray(A),v.vertexAttribPointer(A,4,v.FLOAT,!1,0,0);let D=v.createBuffer();v.bindBuffer(v.ARRAY_BUFFER,D),v.bufferData(v.ARRAY_BUFFER,E,v.STATIC_DRAW),v.enableVertexAttribArray(p),v.vertexAttribPointer(p,4,v.FLOAT,!1,0,0);let h=v.createBuffer();v.bindBuffer(v.ARRAY_BUFFER,h),v.bufferData(v.ARRAY_BUFFER,d,v.STATIC_DRAW),v.enableVertexAttribArray(x),v.vertexAttribPointer(x,2,v.FLOAT,!1,0,0);let I=v.createBuffer();return v.bindBuffer(v.ARRAY_BUFFER,I),v.bufferData(v.ARRAY_BUFFER,l,v.STATIC_DRAW),v.enableVertexAttribArray(_),v.vertexAttribPointer(_,2,v.FLOAT,!1,0,0),v.viewport(0,0,r,u),v.uniformMatrix4fv(c,!1,ut.projectionNoflipY(r,u)),v.activeTexture(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,t),v.blendFunc(v.SRC_ALPHA,v.ONE_MINUS_SRC_ALPHA),v.enable(v.BLEND),v.disable(v.DEPTH_TEST),v.drawArrays(v.TRIANGLES,0,d.length/2),v.disableVertexAttribArray(A),v.disableVertexAttribArray(_),v.disableVertexAttribArray(x),v.disableVertexAttribArray(p),v.deleteBuffer(h),v.deleteBuffer(I),v.deleteBuffer(w),v.deleteBuffer(D),v.bindFramebuffer(v.FRAMEBUFFER,null),v.deleteFramebuffer(b),n}class ae{constructor(t,e,r,u,a,f,o){this.config=t,this.page=e,this.map=r,this.numberImage=u,this.taskList=a,this.special=f,this.bg=o,this.fillAreaInfo(t)}fillAreaInfo(t){for(var e=0;e<t.length;e++)for(var r=t[e],u=`${e+1}`,a=0;a<r.areas.length;a++){var f=r.areas[a];f.center.label=u,f.center.offset=0,f.center.fontHeight=0,f.colored=!1}}}class ne{constructor(t=10,e=30,r=4292730333,u=4289374890){this.maxScale=t,this.visibleFontSize=e,this.hintColorDark=r,this.hintColorLight=u}}class se{constructor(t,e,r,u=[],a=null){this.config=t,this.gl=r,this.taskList=u,this.callback=a,this.listeners=[],this._currentGroup=null,this.width=e.map.width,this.height=e.map.height,this.mapTexure=Lt(r,e.map,r.NEAREST),this.data=new Qt(e.config),this.colored=e.special?Lt(r,e.special,r.LINEAR):ie(r,this.mapTexure,this.data,this.width,this.height),this.fb=te(r,this.mapTexure);for(let o of u){let n=this.data.areaHash.get(o.id);n&&(n.colored=!0)}let f=this.data.areaGroups.find(o=>!o.isAllColored);f&&(this.currentGroup=f)}get currentGroup(){return this._currentGroup}set currentGroup(t){this._currentGroup=t,this.listeners.forEach(e=>e.onGroupChange(t))}get currentGroupIndex(){return this.currentGroup?this.data.areaGroups.findIndex(t=>t==this.currentGroup):-1}addListener(t){this.listeners.push(t)}setCurrentGroup(t){this.currentGroup=this.data.areaGroups[t]}setColored(t,e,r,u){t.colored=!0,this.taskList.push({id:t.id,color:e,x:r,y:u})}switchToNextGroup(){if(!this.currentGroup)return null;let t=this.data.areaGroups.findIndex(r=>r==this.currentGroup),e=!1;for(let r=0;r<this.data.areaGroups.length;r++)if(this.data.areaGroups[t].isAllColored)t=++t%this.data.areaGroups.length;else{e=!0;break}return e?(this.currentGroup=this.data.areaGroups[t],this.currentGroup):null}getArea(t,e,r,u){t=Math.round(t),e=Math.round(e);let a=t-r,f=e-r,o=r*2+1,n=r*2+1,b=o*n,x=new Uint8Array(b*4),_=r,A=r,p=this.gl,c=this.fb;p.bindFramebuffer(p.FRAMEBUFFER,c),p.readPixels(a,f,o,n,p.RGBA,p.UNSIGNED_BYTE,x),p.bindFramebuffer(p.FRAMEBUFFER,null);let s=new Uint32Array(x.buffer),d=new Map;for(var l=0,m=0,E=0,R=0,C=0,z=0,B=0,O=0;O<s.length;O++)if(B=s[O],B!=0&&(l=O%o,m=Math.floor(O/o),E=l-_,R=m-A,C=Math.sqrt(E*E+R*R),!(C>r))){z=1/Math.exp(C);var L=d.get(B);L==null?d.set(B,z):d.set(B,z+L)}let M=0,$;return d.forEach((w,D)=>{console.log(`id=${D}, count=${w}`);var h=u.get(D);h!=null&&!h.colored&&w>M&&($=h,M=w)}),console.log("Area hit:",$),$}dispose(){this.gl.deleteFramebuffer(this.fb),this.gl.deleteTexture(this.colored),this.gl.deleteTexture(this.mapTexure),this.listeners=[]}}class oe extends Zt{constructor(t,e,r=window){super(t,e,r)}focusToArea(t){if(this.fillerData==null)return;const e=t.center.radius*4,r=$t(Math.min(this.width/e,this.height/e),1,this.fillerData.config.maxScale),u=this.width/2,a=this.height/2,f=ut.identity();f[0]=r,f[5]=r,f[12]=-r*t.center.x+u,f[13]=-r*t.center.y+a,this.matrixAnimationTo(f,600)}hint(){if(console.log("hint"),this.fillerData==null||this.fillerData.currentGroup==null)return;let e=this.fillerData.currentGroup.firstUncoloredArea;e&&(console.log("find area:",e),this.focusToArea(e))}}class he{constructor(t,e){this.gl=t,this.fillerData=e,this.vertexShaderCode=`
- attribute vec2 a_position;
- attribute vec2 a_texCoord;
- attribute vec4 a_colorId;
- uniform mat4 u_matrix;
- varying vec2 v_texCoord;
- varying vec4 v_colorId;
- void main() {
- gl_Position = u_matrix * vec4(a_position, 0, 1);
- v_texCoord = a_texCoord;
- v_colorId = a_colorId;
- }
- `,this.fragmentShaderCode=`
- precision mediump float;
- uniform sampler2D u_map;
- varying vec2 v_texCoord;
- varying vec4 v_colorId;
- void main() {
- vec4 mapColor = texture2D(u_map, v_texCoord);
- float dist = distance(mapColor, v_colorId);
- if(dist < 0.001) {
- gl_FragColor = vec4(1, 1, 0, 1);
- }else{
- gl_FragColor = vec4(0, 0, 0, 0);
- }
- }
-
- `,this.pendingAreas=[],this.program=vt(t,ft(t,t.VERTEX_SHADER,this.vertexShaderCode),ft(t,t.FRAGMENT_SHADER,this.fragmentShaderCode)),this.aPositionLoc=t.getAttribLocation(this.program,"a_position"),this.aTexcoordLoc=t.getAttribLocation(this.program,"a_texCoord"),this.aColorIdLoc=t.getAttribLocation(this.program,"a_colorId"),this.uMatrixLoc=t.getUniformLocation(this.program,"u_matrix"),this.positionBuffer=t.createBuffer(),this.texCoordBuffer=t.createBuffer(),this.colorIdBuffer=t.createBuffer(),this.matrix=ut.projectionNoflipY(e.width,e.height),this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGB,this.fillerData.width,this.fillerData.height,0,t.RGB,t.UNSIGNED_SHORT_5_6_5,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.fb=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,this.fb),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.texture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}get width(){return this.fillerData.width}get height(){return this.fillerData.height}dispose(){this.gl.deleteTexture(this.texture),this.gl.deleteFramebuffer(this.fb),this.gl.deleteBuffer(this.positionBuffer),this.gl.deleteBuffer(this.texCoordBuffer),this.gl.deleteBuffer(this.colorIdBuffer),this.gl.deleteProgram(this.program)}addArea(t){this.pendingAreas.push(t)}flush(t=!1){if(this.pendingAreas.length<=0)return;const e=new Float32Array(12*this.pendingAreas.length),r=new Float32Array(12*this.pendingAreas.length),u=new Float32Array(24*this.pendingAreas.length);var a=0,f=0;const o=this.fillerData.width,n=this.fillerData.height;for(var b=0;b<this.pendingAreas.length;b++){var x=this.pendingAreas[b];pt(e,a,x.rect.x,x.rect.y,x.rect.width,x.rect.height),pt(r,a,x.rect.x/o,x.rect.y/n,x.rect.width/o,x.rect.height/n);var _=new xt(x.id);_.fillFloatArray(u,f,6),a+=12,f+=24}const A=this.gl;A.bindBuffer(A.ARRAY_BUFFER,this.positionBuffer),A.bufferData(A.ARRAY_BUFFER,e,A.STATIC_DRAW),A.bindBuffer(A.ARRAY_BUFFER,this.texCoordBuffer),A.bufferData(A.ARRAY_BUFFER,r,A.STATIC_DRAW),A.bindBuffer(A.ARRAY_BUFFER,this.colorIdBuffer),A.bufferData(A.ARRAY_BUFFER,u,A.STATIC_DRAW),this.draw(this.pendingAreas.length*6,t),this.pendingAreas=[]}draw(t,e=!1){const r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,this.fb),console.log("mask.fb=",this.fb),r.useProgram(this.program),r.viewport(0,0,this.fillerData.width,this.fillerData.height),e&&(r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT)),r.enableVertexAttribArray(this.aPositionLoc),r.bindBuffer(r.ARRAY_BUFFER,this.positionBuffer),r.vertexAttribPointer(this.aPositionLoc,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(this.aTexcoordLoc),r.bindBuffer(r.ARRAY_BUFFER,this.texCoordBuffer),r.vertexAttribPointer(this.aTexcoordLoc,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(this.aColorIdLoc),r.bindBuffer(r.ARRAY_BUFFER,this.colorIdBuffer),r.vertexAttribPointer(this.aColorIdLoc,4,r.FLOAT,!1,0,0),r.uniformMatrix4fv(this.uMatrixLoc,!1,this.matrix),r.bindTexture(r.TEXTURE_2D,this.fillerData.mapTexure),r.drawArrays(r.TRIANGLES,0,t),r.bindFramebuffer(r.FRAMEBUFFER,null)}}class ue extends bt{constructor(t,e){super(),this.scene=t,this.fillerData=e,this.vertexShaderCode=`
- attribute vec2 a_position;
- attribute vec2 a_texCoord;
- uniform mat4 u_matrix;
- varying vec2 v_texCoord;
- void main() {
- gl_Position = u_matrix * vec4(a_position, 0, 1);
- v_texCoord = a_texCoord;
- }
- `,this.fragmentShaderCode=`
- precision mediump float;
- uniform sampler2D u_hint;
- uniform sampler2D u_mask;
- uniform vec2 u_pixelSize;
- uniform vec4 u_scale;
- uniform vec4 u_colorDark;
- uniform vec4 u_colorLight;
-
- varying vec2 v_texCoord;
- const float w1 = 0.147761;
- const float w2 = 0.118318;
- const float w3 = 0.0947416;
-
-
- vec4 GaussianBlur(in sampler2D image, in vec2 texCoord, in vec2 pixelSize) {
- vec4 C00 = texture2D(image, texCoord + vec2(-pixelSize.x, -pixelSize.y)) * w3 ;
- vec4 C01 = texture2D(image, texCoord + vec2(0.0, -pixelSize.y)) * w2;
- vec4 C02 = texture2D(image, texCoord + vec2(pixelSize.x, -pixelSize.y)) * w3 ;
-
- vec4 C10 = texture2D(image, texCoord + vec2(-pixelSize.x, 0.0)) * w2;
- vec4 C11 = texture2D(image, texCoord + vec2(0.0, 0.0)) * w1;
- vec4 C12 = texture2D(image, texCoord + vec2(pixelSize.x, 0.0)) * w2;
-
- vec4 C20 = texture2D(image, texCoord + vec2(-pixelSize.x, pixelSize.y)) * w3;
- vec4 C21 = texture2D(image, texCoord + vec2(0.0, pixelSize.y)) * w2;
- vec4 C22 = texture2D(image, texCoord + vec2(pixelSize.x, pixelSize.y)) * w3;
-
- return
- C00 + C01 + C02 +
- C10 + C11 + C12 +
- C20 + C21 + C22 ;
- }
- void main() {
- vec4 hint = texture2D(u_hint, v_texCoord);
- vec4 mask = GaussianBlur(u_mask, v_texCoord, u_pixelSize);
- if(mask.r >= 0.4) {
- //gl_FragColor = hint;
- if(hint.r > 0.5) {
- gl_FragColor = u_colorDark;
- //gl_FragColor = vec4(1, 0, 0, 1);
- }else{
- gl_FragColor = u_colorLight;
- //gl_FragColor = vec4(0, 1, 0, 1);
- }
- }else {
- gl_FragColor = vec4(0,0,0,0);
- }
- }
-
- `,this.colorDarkArray=new Float32Array(4),this.colorLightArray=new Float32Array(4),this.fillerData.addListener(this);const r=t.gl;this.program=vt(r,ft(r,r.VERTEX_SHADER,this.vertexShaderCode),ft(r,r.FRAGMENT_SHADER,this.fragmentShaderCode)),this.aPositionLoc=r.getAttribLocation(this.program,"a_position"),this.aTexcoordLoc=r.getAttribLocation(this.program,"a_texCoord"),this.uMatrixLoc=r.getUniformLocation(this.program,"u_matrix"),this.uScaleLoc=r.getUniformLocation(this.program,"u_scale"),this.uPixelSizeLoc=r.getUniformLocation(this.program,"u_pixelSize"),this.uHintLoc=r.getUniformLocation(this.program,"u_hint"),this.uMaskLoc=r.getUniformLocation(this.program,"u_mask"),this.uColorDarkLoc=r.getUniformLocation(this.program,"u_colorDark"),this.uColorLightLoc=r.getUniformLocation(this.program,"u_colorLight"),this.vertexArray=Bt(0,0,e.width,e.height),this.texCoordArray=Bt(0,0,1,1),this.vertexBuffer=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.bufferData(r.ARRAY_BUFFER,this.vertexArray,r.STATIC_DRAW),this.texcoordBuffer=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,this.texcoordBuffer),r.bufferData(r.ARRAY_BUFFER,this.texCoordArray,r.STATIC_DRAW),this.mask=new he(r,e),this.hintTexture=this.createHintTexture(r,e.width,e.height),this.fillerData.currentGroup&&this.setGroup(this.fillerData.currentGroup)}dispose(){this.mask.dispose();let t=this.scene.gl;t.deleteProgram(this.program),t.deleteBuffer(this.vertexBuffer),t.deleteBuffer(this.texcoordBuffer),t.deleteTexture(this.hintTexture)}createHintTexture(t,e,r){let u=t.createTexture();t.bindTexture(t.TEXTURE_2D,u);const a=10,f=Math.floor(e/a),o=Math.floor(r/a),n=new Uint8Array(f*o);for(var b=0;b<o;b++){let _=b%2==0;for(var x=0;x<f;x++){_=!_;let A=b*f+x;n[A]=_?0:255}}return t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.texImage2D(t.TEXTURE_2D,0,t.LUMINANCE,f,o,0,t.LUMINANCE,t.UNSIGNED_BYTE,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),u}setGroup(t){for(var e=0;e<t.areas.length;e++)this.mask.addArea(t.areas[e]);this.mask.flush(!0),this.scene.invalidate()}onGroupChange(t){console.log("onGroupChange",t),t!=null&&this.setGroup(t)}tap(t,e,r,u){let a=this.fillerData.getArea(t,e,40,this.fillerData.data.areaHash);if(a!=null){let f=this.fillerData.data.groupHash.get(a.id);this.fillerData.currentGroup=f}}draw(){const t=this.scene.gl;t.useProgram(this.program),t.enableVertexAttribArray(this.aPositionLoc),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.vertexAttribPointer(this.aPositionLoc,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(this.aTexcoordLoc),t.bindBuffer(t.ARRAY_BUFFER,this.texcoordBuffer),t.vertexAttribPointer(this.aTexcoordLoc,2,t.FLOAT,!1,0,0),t.uniformMatrix4fv(this.uMatrixLoc,!1,this.scene.drawMatrix),t.uniform1f(this.uScaleLoc,this.scene.userMat[0]),t.uniform2f(this.uPixelSizeLoc,1/this.mask.width,1/this.mask.height),new xt(this.fillerData.config.hintColorDark).fillFloatArray(this.colorDarkArray,0),new xt(this.fillerData.config.hintColorLight).fillFloatArray(this.colorLightArray,0),t.uniform4fv(this.uColorDarkLoc,this.colorDarkArray),t.uniform4fv(this.uColorLightLoc,this.colorLightArray),t.uniform1i(this.uHintLoc,0),t.uniform1i(this.uMaskLoc,1),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.hintTexture),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this.mask.texture),t.drawArrays(t.TRIANGLES,0,6)}toString(){return"HintLayer()"}}class le extends bt{constructor(t,e,r,u,a,f,o=null){super(),this.scene=t,this.texture=e,this.texWidth=r,this.texHeight=u,this.width=a,this.height=f,this.fragmentShader=o,this.vertexShaderCode=`
- attribute vec2 a_position;
- attribute vec2 a_texCoord;
- uniform mat4 u_matrix;
- varying vec2 v_texCoord;
- void main() {
- gl_Position = u_matrix * vec4(a_position, 0, 1);
- v_texCoord = a_texCoord;
- }
- `,this.fragmentShaderCode=`
- precision mediump float;
- uniform sampler2D u_image;
- varying vec2 v_texCoord;
- void main() {
- vec4 color = texture2D(u_image, v_texCoord);
- gl_FragColor = color;
- }
-
- `,this.vertexArray=new Float32Array(12),this.texCoordArray=new Float32Array(12);const n=t.gl;this.program=vt(n,ft(n,n.VERTEX_SHADER,this.vertexShaderCode),ft(n,n.FRAGMENT_SHADER,o||this.fragmentShaderCode)),this.aPositionLoc=n.getAttribLocation(this.program,"a_position"),this.aTexcoordLoc=n.getAttribLocation(this.program,"a_texCoord"),this.uMatrixLoc=n.getUniformLocation(this.program,"u_matrix"),this.uScaleLoc=n.getUniformLocation(this.program,"u_scale"),this.uTexSizeLoc=n.getUniformLocation(this.program,"u_texSize"),pt(this.vertexArray,0,0,0,a,f),pt(this.texCoordArray,0,0,0,1,1),this.vertexBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this.vertexBuffer),n.bufferData(n.ARRAY_BUFFER,this.vertexArray,n.STATIC_DRAW),this.texcoordBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this.texcoordBuffer),n.bufferData(n.ARRAY_BUFFER,this.texCoordArray,n.STATIC_DRAW)}dispose(){let t=this.scene.gl;t.deleteProgram(this.program),t.deleteTexture(this.texture),t.deleteBuffer(this.texcoordBuffer),t.deleteBuffer(this.vertexBuffer)}get currentScale(){return this.scene.userMat[0]*(this.width/this.texWidth)}draw(){const t=this.scene.gl;t.useProgram(this.program),t.enableVertexAttribArray(this.aPositionLoc),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.vertexAttribPointer(this.aPositionLoc,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(this.aTexcoordLoc),t.bindBuffer(t.ARRAY_BUFFER,this.texcoordBuffer),t.vertexAttribPointer(this.aTexcoordLoc,2,t.FLOAT,!1,0,0),t.uniformMatrix4fv(this.uMatrixLoc,!1,this.scene.drawMatrix),t.uniform1f(this.uScaleLoc,this.currentScale),t.uniform2f(this.uTexSizeLoc,1/this.texWidth,1/this.texHeight),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.texture),t.drawArrays(t.TRIANGLES,0,6)}scale(t){}toString(){return"TextureLayer()"}}const ce=`
- precision highp float;
- uniform sampler2D u_image;
- uniform float u_scale;
- uniform vec2 u_texSize;
- varying vec2 v_texCoord;
- const float w1 = 0.147761;
- const float w2 = 0.118318;
- const float w3 = 0.0947416;
- vec4 GaussianBlur(in sampler2D image, in vec2 texCoord, in vec2 pixelSize) {
- vec4 C00 = texture2D(image, texCoord + vec2(-pixelSize.x, -pixelSize.y)) * w3 ;
- vec4 C01 = texture2D(image, texCoord + vec2(0.0, -pixelSize.y)) * w2;
- vec4 C02 = texture2D(image, texCoord + vec2(pixelSize.x, -pixelSize.y)) * w3 ;
- vec4 C10 = texture2D(image, texCoord + vec2(-pixelSize.x, 0.0)) * w2;
- vec4 C11 = texture2D(image, texCoord + vec2(0.0, 0.0)) * w1;
- vec4 C12 = texture2D(image, texCoord + vec2(pixelSize.x, 0.0)) * w2;
- vec4 C20 = texture2D(image, texCoord + vec2(-pixelSize.x, pixelSize.y)) * w3;
- vec4 C21 = texture2D(image, texCoord + vec2(0.0, pixelSize.y)) * w2;
- vec4 C22 = texture2D(image, texCoord + vec2(pixelSize.x, pixelSize.y)) * w3;
- return
- C00 + C01 + C02 +
- C10 + C11 + C12 +
- C20 + C21 + C22 ;
- }
- void main() {
- vec4 color = GaussianBlur(u_image, v_texCoord, u_texSize);
- //vec4 color = texture2D(u_image, v_texCoord);
- //if(u_scale > 100. ) {
- if(color.a >= 0.4) {
- gl_FragColor = vec4(0.15, 0.15, 0.15, 1);
- }else{
- gl_FragColor = vec4(0, 0, 0, 0);
- }
- //}else{
- // gl_FragColor = vec4(.15, 0.15, 0.15, color.a);
- //}
- }
- `;class fe extends le{constructor(t,e,r,u){const a=t.gl;let f=a.createTexture();a.bindTexture(a.TEXTURE_2D,f),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texImage2D(a.TEXTURE_2D,0,a.ALPHA,a.ALPHA,a.UNSIGNED_BYTE,e),super(t,f,e.width,e.height,r,u,ce)}}var Tt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function de(v){return v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v}function kt(v){throw new Error('Could not dynamically require "'+v+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Mt={exports:{}};/*!
- JSZip v3.10.1 - A JavaScript class for generating and reading zip files
- <http://stuartk.com/jszip>
- (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
- Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
- JSZip uses the library pako released under the MIT license :
- https://github.com/nodeca/pako/blob/main/LICENSE
- */(function(v,t){(function(e){v.exports=e()})(function(){return function e(r,u,a){function f(b,x){if(!u[b]){if(!r[b]){var _=typeof kt=="function"&&kt;if(!x&&_)return _(b,!0);if(o)return o(b,!0);var A=new Error("Cannot find module '"+b+"'");throw A.code="MODULE_NOT_FOUND",A}var p=u[b]={exports:{}};r[b][0].call(p.exports,function(c){var s=r[b][1][c];return f(s||c)},p,p.exports,e,r,u,a)}return u[b].exports}for(var o=typeof kt=="function"&&kt,n=0;n<a.length;n++)f(a[n]);return f}({1:[function(e,r,u){var a=e("./utils"),f=e("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";u.encode=function(n){for(var b,x,_,A,p,c,s,d=[],l=0,m=n.length,E=m,R=a.getTypeOf(n)!=="string";l<n.length;)E=m-l,_=R?(b=n[l++],x=l<m?n[l++]:0,l<m?n[l++]:0):(b=n.charCodeAt(l++),x=l<m?n.charCodeAt(l++):0,l<m?n.charCodeAt(l++):0),A=b>>2,p=(3&b)<<4|x>>4,c=1<E?(15&x)<<2|_>>6:64,s=2<E?63&_:64,d.push(o.charAt(A)+o.charAt(p)+o.charAt(c)+o.charAt(s));return d.join("")},u.decode=function(n){var b,x,_,A,p,c,s=0,d=0,l="data:";if(n.substr(0,l.length)===l)throw new Error("Invalid base64 input, it looks like a data url.");var m,E=3*(n=n.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(n.charAt(n.length-1)===o.charAt(64)&&E--,n.charAt(n.length-2)===o.charAt(64)&&E--,E%1!=0)throw new Error("Invalid base64 input, bad content length.");for(m=f.uint8array?new Uint8Array(0|E):new Array(0|E);s<n.length;)b=o.indexOf(n.charAt(s++))<<2|(A=o.indexOf(n.charAt(s++)))>>4,x=(15&A)<<4|(p=o.indexOf(n.charAt(s++)))>>2,_=(3&p)<<6|(c=o.indexOf(n.charAt(s++))),m[d++]=b,p!==64&&(m[d++]=x),c!==64&&(m[d++]=_);return m}},{"./support":30,"./utils":32}],2:[function(e,r,u){var a=e("./external"),f=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),n=e("./stream/DataLengthProbe");function b(x,_,A,p,c){this.compressedSize=x,this.uncompressedSize=_,this.crc32=A,this.compression=p,this.compressedContent=c}b.prototype={getContentWorker:function(){var x=new f(a.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new n("data_length")),_=this;return x.on("end",function(){if(this.streamInfo.data_length!==_.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),x},getCompressedWorker:function(){return new f(a.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},b.createWorkerFrom=function(x,_,A){return x.pipe(new o).pipe(new n("uncompressedSize")).pipe(_.compressWorker(A)).pipe(new n("compressedSize")).withStreamInfo("compression",_)},r.exports=b},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,r,u){var a=e("./stream/GenericWorker");u.STORE={magic:"\0\0",compressWorker:function(){return new a("STORE compression")},uncompressWorker:function(){return new a("STORE decompression")}},u.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,r,u){var a=e("./utils"),f=function(){for(var o,n=[],b=0;b<256;b++){o=b;for(var x=0;x<8;x++)o=1&o?3988292384^o>>>1:o>>>1;n[b]=o}return n}();r.exports=function(o,n){return o!==void 0&&o.length?a.getTypeOf(o)!=="string"?function(b,x,_,A){var p=f,c=A+_;b^=-1;for(var s=A;s<c;s++)b=b>>>8^p[255&(b^x[s])];return-1^b}(0|n,o,o.length,0):function(b,x,_,A){var p=f,c=A+_;b^=-1;for(var s=A;s<c;s++)b=b>>>8^p[255&(b^x.charCodeAt(s))];return-1^b}(0|n,o,o.length,0):0}},{"./utils":32}],5:[function(e,r,u){u.base64=!1,u.binary=!1,u.dir=!1,u.createFolders=!0,u.date=null,u.compression=null,u.compressionOptions=null,u.comment=null,u.unixPermissions=null,u.dosPermissions=null},{}],6:[function(e,r,u){var a=null;a=typeof Promise<"u"?Promise:e("lie"),r.exports={Promise:a}},{lie:37}],7:[function(e,r,u){var a=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",f=e("pako"),o=e("./utils"),n=e("./stream/GenericWorker"),b=a?"uint8array":"array";function x(_,A){n.call(this,"FlateWorker/"+_),this._pako=null,this._pakoAction=_,this._pakoOptions=A,this.meta={}}u.magic="\b\0",o.inherits(x,n),x.prototype.processChunk=function(_){this.meta=_.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(b,_.data),!1)},x.prototype.flush=function(){n.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},x.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this._pako=null},x.prototype._createPako=function(){this._pako=new f[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var _=this;this._pako.onData=function(A){_.push({data:A,meta:_.meta})}},u.compressWorker=function(_){return new x("Deflate",_)},u.uncompressWorker=function(){return new x("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,r,u){function a(p,c){var s,d="";for(s=0;s<c;s++)d+=String.fromCharCode(255&p),p>>>=8;return d}function f(p,c,s,d,l,m){var E,R,C=p.file,z=p.compression,B=m!==b.utf8encode,O=o.transformTo("string",m(C.name)),L=o.transformTo("string",b.utf8encode(C.name)),M=C.comment,$=o.transformTo("string",m(M)),w=o.transformTo("string",b.utf8encode(M)),D=L.length!==C.name.length,h=w.length!==M.length,I="",J="",G="",tt=C.dir,W=C.date,K={crc32:0,compressedSize:0,uncompressedSize:0};c&&!s||(K.crc32=p.crc32,K.compressedSize=p.compressedSize,K.uncompressedSize=p.uncompressedSize);var S=0;c&&(S|=8),B||!D&&!h||(S|=2048);var F=0,q=0;tt&&(F|=16),l==="UNIX"?(q=798,F|=function(j,at){var ot=j;return j||(ot=at?16893:33204),(65535&ot)<<16}(C.unixPermissions,tt)):(q=20,F|=function(j){return 63&(j||0)}(C.dosPermissions)),E=W.getUTCHours(),E<<=6,E|=W.getUTCMinutes(),E<<=5,E|=W.getUTCSeconds()/2,R=W.getUTCFullYear()-1980,R<<=4,R|=W.getUTCMonth()+1,R<<=5,R|=W.getUTCDate(),D&&(J=a(1,1)+a(x(O),4)+L,I+="up"+a(J.length,2)+J),h&&(G=a(1,1)+a(x($),4)+w,I+="uc"+a(G.length,2)+G);var V="";return V+=`
- \0`,V+=a(S,2),V+=z.magic,V+=a(E,2),V+=a(R,2),V+=a(K.crc32,4),V+=a(K.compressedSize,4),V+=a(K.uncompressedSize,4),V+=a(O.length,2),V+=a(I.length,2),{fileRecord:_.LOCAL_FILE_HEADER+V+O+I,dirRecord:_.CENTRAL_FILE_HEADER+a(q,2)+V+a($.length,2)+"\0\0\0\0"+a(F,4)+a(d,4)+O+I+$}}var o=e("../utils"),n=e("../stream/GenericWorker"),b=e("../utf8"),x=e("../crc32"),_=e("../signature");function A(p,c,s,d){n.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=c,this.zipPlatform=s,this.encodeFileName=d,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(A,n),A.prototype.push=function(p){var c=p.meta.percent||0,s=this.entriesCount,d=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,n.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:s?(c+100*(s-d-1))/s:100}}))},A.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var c=this.streamFiles&&!p.file.dir;if(c){var s=f(p,c,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:s.fileRecord,meta:{percent:0}})}else this.accumulate=!0},A.prototype.closedSource=function(p){this.accumulate=!1;var c=this.streamFiles&&!p.file.dir,s=f(p,c,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(s.dirRecord),c)this.push({data:function(d){return _.DATA_DESCRIPTOR+a(d.crc32,4)+a(d.compressedSize,4)+a(d.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:s.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},A.prototype.flush=function(){for(var p=this.bytesWritten,c=0;c<this.dirRecords.length;c++)this.push({data:this.dirRecords[c],meta:{percent:100}});var s=this.bytesWritten-p,d=function(l,m,E,R,C){var z=o.transformTo("string",C(R));return _.CENTRAL_DIRECTORY_END+"\0\0\0\0"+a(l,2)+a(l,2)+a(m,4)+a(E,4)+a(z.length,2)+z}(this.dirRecords.length,s,p,this.zipComment,this.encodeFileName);this.push({data:d,meta:{percent:100}})},A.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},A.prototype.registerPrevious=function(p){this._sources.push(p);var c=this;return p.on("data",function(s){c.processChunk(s)}),p.on("end",function(){c.closedSource(c.previous.streamInfo),c._sources.length?c.prepareNextSource():c.end()}),p.on("error",function(s){c.error(s)}),this},A.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},A.prototype.error=function(p){var c=this._sources;if(!n.prototype.error.call(this,p))return!1;for(var s=0;s<c.length;s++)try{c[s].error(p)}catch{}return!0},A.prototype.lock=function(){n.prototype.lock.call(this);for(var p=this._sources,c=0;c<p.length;c++)p[c].lock()},r.exports=A},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,r,u){var a=e("../compressions"),f=e("./ZipFileWorker");u.generateWorker=function(o,n,b){var x=new f(n.streamFiles,b,n.platform,n.encodeFileName),_=0;try{o.forEach(function(A,p){_++;var c=function(m,E){var R=m||E,C=a[R];if(!C)throw new Error(R+" is not a valid compression method !");return C}(p.options.compression,n.compression),s=p.options.compressionOptions||n.compressionOptions||{},d=p.dir,l=p.date;p._compressWorker(c,s).withStreamInfo("file",{name:A,dir:d,date:l,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(x)}),x.entriesCount=_}catch(A){x.error(A)}return x}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,r,u){function a(){if(!(this instanceof a))return new a;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var f=new a;for(var o in this)typeof this[o]!="function"&&(f[o]=this[o]);return f}}(a.prototype=e("./object")).loadAsync=e("./load"),a.support=e("./support"),a.defaults=e("./defaults"),a.version="3.10.1",a.loadAsync=function(f,o){return new a().loadAsync(f,o)},a.external=e("./external"),r.exports=a},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,r,u){var a=e("./utils"),f=e("./external"),o=e("./utf8"),n=e("./zipEntries"),b=e("./stream/Crc32Probe"),x=e("./nodejsUtils");function _(A){return new f.Promise(function(p,c){var s=A.decompressed.getContentWorker().pipe(new b);s.on("error",function(d){c(d)}).on("end",function(){s.streamInfo.crc32!==A.decompressed.crc32?c(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(A,p){var c=this;return p=a.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),x.isNode&&x.isStream(A)?f.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):a.prepareContent("the loaded zip file",A,!0,p.optimizedBinaryString,p.base64).then(function(s){var d=new n(p);return d.load(s),d}).then(function(s){var d=[f.Promise.resolve(s)],l=s.files;if(p.checkCRC32)for(var m=0;m<l.length;m++)d.push(_(l[m]));return f.Promise.all(d)}).then(function(s){for(var d=s.shift(),l=d.files,m=0;m<l.length;m++){var E=l[m],R=E.fileNameStr,C=a.resolve(E.fileNameStr);c.file(C,E.decompressed,{binary:!0,optimizedBinaryString:!0,date:E.date,dir:E.dir,comment:E.fileCommentStr.length?E.fileCommentStr:null,unixPermissions:E.unixPermissions,dosPermissions:E.dosPermissions,createFolders:p.createFolders}),E.dir||(c.file(C).unsafeOriginalName=R)}return d.zipComment.length&&(c.comment=d.zipComment),c})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,r,u){var a=e("../utils"),f=e("../stream/GenericWorker");function o(n,b){f.call(this,"Nodejs stream input adapter for "+n),this._upstreamEnded=!1,this._bindStream(b)}a.inherits(o,f),o.prototype._bindStream=function(n){var b=this;(this._stream=n).pause(),n.on("data",function(x){b.push({data:x,meta:{percent:0}})}).on("error",function(x){b.isPaused?this.generatedError=x:b.error(x)}).on("end",function(){b.isPaused?b._upstreamEnded=!0:b.end()})},o.prototype.pause=function(){return!!f.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!f.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,r,u){var a=e("readable-stream").Readable;function f(o,n,b){a.call(this,n),this._helper=o;var x=this;o.on("data",function(_,A){x.push(_)||x._helper.pause(),b&&b(A)}).on("error",function(_){x.emit("error",_)}).on("end",function(){x.push(null)})}e("../utils").inherits(f,a),f.prototype._read=function(){this._helper.resume()},r.exports=f},{"../utils":32,"readable-stream":16}],14:[function(e,r,u){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(a,f){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(a,f);if(typeof a=="number")throw new Error('The "data" argument must not be a number');return new Buffer(a,f)},allocBuffer:function(a){if(Buffer.alloc)return Buffer.alloc(a);var f=new Buffer(a);return f.fill(0),f},isBuffer:function(a){return Buffer.isBuffer(a)},isStream:function(a){return a&&typeof a.on=="function"&&typeof a.pause=="function"&&typeof a.resume=="function"}}},{}],15:[function(e,r,u){function a(C,z,B){var O,L=o.getTypeOf(z),M=o.extend(B||{},x);M.date=M.date||new Date,M.compression!==null&&(M.compression=M.compression.toUpperCase()),typeof M.unixPermissions=="string"&&(M.unixPermissions=parseInt(M.unixPermissions,8)),M.unixPermissions&&16384&M.unixPermissions&&(M.dir=!0),M.dosPermissions&&16&M.dosPermissions&&(M.dir=!0),M.dir&&(C=l(C)),M.createFolders&&(O=d(C))&&m.call(this,O,!0);var $=L==="string"&&M.binary===!1&&M.base64===!1;B&&B.binary!==void 0||(M.binary=!$),(z instanceof _&&z.uncompressedSize===0||M.dir||!z||z.length===0)&&(M.base64=!1,M.binary=!0,z="",M.compression="STORE",L="string");var w=null;w=z instanceof _||z instanceof n?z:c.isNode&&c.isStream(z)?new s(C,z):o.prepareContent(C,z,M.binary,M.optimizedBinaryString,M.base64);var D=new A(C,w,M);this.files[C]=D}var f=e("./utf8"),o=e("./utils"),n=e("./stream/GenericWorker"),b=e("./stream/StreamHelper"),x=e("./defaults"),_=e("./compressedObject"),A=e("./zipObject"),p=e("./generate"),c=e("./nodejsUtils"),s=e("./nodejs/NodejsStreamInputAdapter"),d=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var z=C.lastIndexOf("/");return 0<z?C.substring(0,z):""},l=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},m=function(C,z){return z=z!==void 0?z:x.createFolders,C=l(C),this.files[C]||a.call(this,C,null,{dir:!0,createFolders:z}),this.files[C]};function E(C){return Object.prototype.toString.call(C)==="[object RegExp]"}var R={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(C){var z,B,O;for(z in this.files)O=this.files[z],(B=z.slice(this.root.length,z.length))&&z.slice(0,this.root.length)===this.root&&C(B,O)},filter:function(C){var z=[];return this.forEach(function(B,O){C(B,O)&&z.push(O)}),z},file:function(C,z,B){if(arguments.length!==1)return C=this.root+C,a.call(this,C,z,B),this;if(E(C)){var O=C;return this.filter(function(M,$){return!$.dir&&O.test(M)})}var L=this.files[this.root+C];return L&&!L.dir?L:null},folder:function(C){if(!C)return this;if(E(C))return this.filter(function(L,M){return M.dir&&C.test(L)});var z=this.root+C,B=m.call(this,z),O=this.clone();return O.root=B.name,O},remove:function(C){C=this.root+C;var z=this.files[C];if(z||(C.slice(-1)!=="/"&&(C+="/"),z=this.files[C]),z&&!z.dir)delete this.files[C];else for(var B=this.filter(function(L,M){return M.name.slice(0,C.length)===C}),O=0;O<B.length;O++)delete this.files[B[O].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var z,B={};try{if((B=o.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:f.utf8encode})).type=B.type.toLowerCase(),B.compression=B.compression.toUpperCase(),B.type==="binarystring"&&(B.type="string"),!B.type)throw new Error("No output type specified.");o.checkSupport(B.type),B.platform!=="darwin"&&B.platform!=="freebsd"&&B.platform!=="linux"&&B.platform!=="sunos"||(B.platform="UNIX"),B.platform==="win32"&&(B.platform="DOS");var O=B.comment||this.comment||"";z=p.generateWorker(this,B,O)}catch(L){(z=new n("error")).error(L)}return new b(z,B.type||"string",B.mimeType)},generateAsync:function(C,z){return this.generateInternalStream(C).accumulate(z)},generateNodeStream:function(C,z){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(z)}};r.exports=R},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,r,u){r.exports=e("stream")},{stream:void 0}],17:[function(e,r,u){var a=e("./DataReader");function f(o){a.call(this,o);for(var n=0;n<this.data.length;n++)o[n]=255&o[n]}e("../utils").inherits(f,a),f.prototype.byteAt=function(o){return this.data[this.zero+o]},f.prototype.lastIndexOfSignature=function(o){for(var n=o.charCodeAt(0),b=o.charCodeAt(1),x=o.charCodeAt(2),_=o.charCodeAt(3),A=this.length-4;0<=A;--A)if(this.data[A]===n&&this.data[A+1]===b&&this.data[A+2]===x&&this.data[A+3]===_)return A-this.zero;return-1},f.prototype.readAndCheckSignature=function(o){var n=o.charCodeAt(0),b=o.charCodeAt(1),x=o.charCodeAt(2),_=o.charCodeAt(3),A=this.readData(4);return n===A[0]&&b===A[1]&&x===A[2]&&_===A[3]},f.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var n=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,n},r.exports=f},{"../utils":32,"./DataReader":18}],18:[function(e,r,u){var a=e("../utils");function f(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}f.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var n,b=0;for(this.checkOffset(o),n=this.index+o-1;n>=this.index;n--)b=(b<<8)+this.byteAt(n);return this.index+=o,b},readString:function(o){return a.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},r.exports=f},{"../utils":32}],19:[function(e,r,u){var a=e("./Uint8ArrayReader");function f(o){a.call(this,o)}e("../utils").inherits(f,a),f.prototype.readData=function(o){this.checkOffset(o);var n=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,n},r.exports=f},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,r,u){var a=e("./DataReader");function f(o){a.call(this,o)}e("../utils").inherits(f,a),f.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},f.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},f.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},f.prototype.readData=function(o){this.checkOffset(o);var n=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,n},r.exports=f},{"../utils":32,"./DataReader":18}],21:[function(e,r,u){var a=e("./ArrayReader");function f(o){a.call(this,o)}e("../utils").inherits(f,a),f.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var n=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,n},r.exports=f},{"../utils":32,"./ArrayReader":17}],22:[function(e,r,u){var a=e("../utils"),f=e("../support"),o=e("./ArrayReader"),n=e("./StringReader"),b=e("./NodeBufferReader"),x=e("./Uint8ArrayReader");r.exports=function(_){var A=a.getTypeOf(_);return a.checkSupport(A),A!=="string"||f.uint8array?A==="nodebuffer"?new b(_):f.uint8array?new x(a.transformTo("uint8array",_)):new o(a.transformTo("array",_)):new n(_)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,r,u){u.LOCAL_FILE_HEADER="PK",u.CENTRAL_FILE_HEADER="PK",u.CENTRAL_DIRECTORY_END="PK",u.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",u.ZIP64_CENTRAL_DIRECTORY_END="PK",u.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,r,u){var a=e("./GenericWorker"),f=e("../utils");function o(n){a.call(this,"ConvertWorker to "+n),this.destType=n}f.inherits(o,a),o.prototype.processChunk=function(n){this.push({data:f.transformTo(this.destType,n.data),meta:n.meta})},r.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,r,u){var a=e("./GenericWorker"),f=e("../crc32");function o(){a.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,a),o.prototype.processChunk=function(n){this.streamInfo.crc32=f(n.data,this.streamInfo.crc32||0),this.push(n)},r.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,r,u){var a=e("../utils"),f=e("./GenericWorker");function o(n){f.call(this,"DataLengthProbe for "+n),this.propName=n,this.withStreamInfo(n,0)}a.inherits(o,f),o.prototype.processChunk=function(n){if(n){var b=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=b+n.data.length}f.prototype.processChunk.call(this,n)},r.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,r,u){var a=e("../utils"),f=e("./GenericWorker");function o(n){f.call(this,"DataWorker");var b=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,n.then(function(x){b.dataIsReady=!0,b.data=x,b.max=x&&x.length||0,b.type=a.getTypeOf(x),b.isPaused||b._tickAndRepeat()},function(x){b.error(x)})}a.inherits(o,f),o.prototype.cleanUp=function(){f.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!f.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,a.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(a.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var n=null,b=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":n=this.data.substring(this.index,b);break;case"uint8array":n=this.data.subarray(this.index,b);break;case"array":case"nodebuffer":n=this.data.slice(this.index,b)}return this.index=b,this.push({data:n,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,r,u){function a(f){this.name=f||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}a.prototype={push:function(f){this.emit("data",f)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(f){this.emit("error",f)}return!0},error:function(f){return!this.isFinished&&(this.isPaused?this.generatedError=f:(this.isFinished=!0,this.emit("error",f),this.previous&&this.previous.error(f),this.cleanUp()),!0)},on:function(f,o){return this._listeners[f].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(f,o){if(this._listeners[f])for(var n=0;n<this._listeners[f].length;n++)this._listeners[f][n].call(this,o)},pipe:function(f){return f.registerPrevious(this)},registerPrevious:function(f){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=f.streamInfo,this.mergeStreamInfo(),this.previous=f;var o=this;return f.on("data",function(n){o.processChunk(n)}),f.on("end",function(){o.end()}),f.on("error",function(n){o.error(n)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var f=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),f=!0),this.previous&&this.previous.resume(),!f},flush:function(){},processChunk:function(f){this.push(f)},withStreamInfo:function(f,o){return this.extraStreamInfo[f]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var f in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,f)&&(this.streamInfo[f]=this.extraStreamInfo[f])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var f="Worker "+this.name;return this.previous?this.previous+" -> "+f:f}},r.exports=a},{}],29:[function(e,r,u){var a=e("../utils"),f=e("./ConvertWorker"),o=e("./GenericWorker"),n=e("../base64"),b=e("../support"),x=e("../external"),_=null;if(b.nodestream)try{_=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function A(c,s){return new x.Promise(function(d,l){var m=[],E=c._internalType,R=c._outputType,C=c._mimeType;c.on("data",function(z,B){m.push(z),s&&s(B)}).on("error",function(z){m=[],l(z)}).on("end",function(){try{var z=function(B,O,L){switch(B){case"blob":return a.newBlob(a.transformTo("arraybuffer",O),L);case"base64":return n.encode(O);default:return a.transformTo(B,O)}}(R,function(B,O){var L,M=0,$=null,w=0;for(L=0;L<O.length;L++)w+=O[L].length;switch(B){case"string":return O.join("");case"array":return Array.prototype.concat.apply([],O);case"uint8array":for($=new Uint8Array(w),L=0;L<O.length;L++)$.set(O[L],M),M+=O[L].length;return $;case"nodebuffer":return Buffer.concat(O);default:throw new Error("concat : unsupported type '"+B+"'")}}(E,m),C);d(z)}catch(B){l(B)}m=[]}).resume()})}function p(c,s,d){var l=s;switch(s){case"blob":case"arraybuffer":l="uint8array";break;case"base64":l="string"}try{this._internalType=l,this._outputType=s,this._mimeType=d,a.checkSupport(l),this._worker=c.pipe(new f(l)),c.lock()}catch(m){this._worker=new o("error"),this._worker.error(m)}}p.prototype={accumulate:function(c){return A(this,c)},on:function(c,s){var d=this;return c==="data"?this._worker.on(c,function(l){s.call(d,l.data,l.meta)}):this._worker.on(c,function(){a.delay(s,arguments,d)}),this},resume:function(){return a.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(c){if(a.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new _(this,{objectMode:this._outputType!=="nodebuffer"},c)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,r,u){if(u.base64=!0,u.array=!0,u.string=!0,u.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",u.nodebuffer=typeof Buffer<"u",u.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")u.blob=!1;else{var a=new ArrayBuffer(0);try{u.blob=new Blob([a],{type:"application/zip"}).size===0}catch{try{var f=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);f.append(a),u.blob=f.getBlob("application/zip").size===0}catch{u.blob=!1}}}try{u.nodestream=!!e("readable-stream").Readable}catch{u.nodestream=!1}},{"readable-stream":16}],31:[function(e,r,u){for(var a=e("./utils"),f=e("./support"),o=e("./nodejsUtils"),n=e("./stream/GenericWorker"),b=new Array(256),x=0;x<256;x++)b[x]=252<=x?6:248<=x?5:240<=x?4:224<=x?3:192<=x?2:1;b[254]=b[254]=1;function _(){n.call(this,"utf-8 decode"),this.leftOver=null}function A(){n.call(this,"utf-8 encode")}u.utf8encode=function(p){return f.nodebuffer?o.newBufferFrom(p,"utf-8"):function(c){var s,d,l,m,E,R=c.length,C=0;for(m=0;m<R;m++)(64512&(d=c.charCodeAt(m)))==55296&&m+1<R&&(64512&(l=c.charCodeAt(m+1)))==56320&&(d=65536+(d-55296<<10)+(l-56320),m++),C+=d<128?1:d<2048?2:d<65536?3:4;for(s=f.uint8array?new Uint8Array(C):new Array(C),m=E=0;E<C;m++)(64512&(d=c.charCodeAt(m)))==55296&&m+1<R&&(64512&(l=c.charCodeAt(m+1)))==56320&&(d=65536+(d-55296<<10)+(l-56320),m++),d<128?s[E++]=d:(d<2048?s[E++]=192|d>>>6:(d<65536?s[E++]=224|d>>>12:(s[E++]=240|d>>>18,s[E++]=128|d>>>12&63),s[E++]=128|d>>>6&63),s[E++]=128|63&d);return s}(p)},u.utf8decode=function(p){return f.nodebuffer?a.transformTo("nodebuffer",p).toString("utf-8"):function(c){var s,d,l,m,E=c.length,R=new Array(2*E);for(s=d=0;s<E;)if((l=c[s++])<128)R[d++]=l;else if(4<(m=b[l]))R[d++]=65533,s+=m-1;else{for(l&=m===2?31:m===3?15:7;1<m&&s<E;)l=l<<6|63&c[s++],m--;1<m?R[d++]=65533:l<65536?R[d++]=l:(l-=65536,R[d++]=55296|l>>10&1023,R[d++]=56320|1023&l)}return R.length!==d&&(R.subarray?R=R.subarray(0,d):R.length=d),a.applyFromCharCode(R)}(p=a.transformTo(f.uint8array?"uint8array":"array",p))},a.inherits(_,n),_.prototype.processChunk=function(p){var c=a.transformTo(f.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(f.uint8array){var s=c;(c=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),c.set(s,this.leftOver.length)}else c=this.leftOver.concat(c);this.leftOver=null}var d=function(m,E){var R;for((E=E||m.length)>m.length&&(E=m.length),R=E-1;0<=R&&(192&m[R])==128;)R--;return R<0||R===0?E:R+b[m[R]]>E?R:E}(c),l=c;d!==c.length&&(f.uint8array?(l=c.subarray(0,d),this.leftOver=c.subarray(d,c.length)):(l=c.slice(0,d),this.leftOver=c.slice(d,c.length))),this.push({data:u.utf8decode(l),meta:p.meta})},_.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:u.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},u.Utf8DecodeWorker=_,a.inherits(A,n),A.prototype.processChunk=function(p){this.push({data:u.utf8encode(p.data),meta:p.meta})},u.Utf8EncodeWorker=A},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,r,u){var a=e("./support"),f=e("./base64"),o=e("./nodejsUtils"),n=e("./external");function b(s){return s}function x(s,d){for(var l=0;l<s.length;++l)d[l]=255&s.charCodeAt(l);return d}e("setimmediate"),u.newBlob=function(s,d){u.checkSupport("blob");try{return new Blob([s],{type:d})}catch{try{var l=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return l.append(s),l.getBlob(d)}catch{throw new Error("Bug : can't construct the Blob.")}}};var _={stringifyByChunk:function(s,d,l){var m=[],E=0,R=s.length;if(R<=l)return String.fromCharCode.apply(null,s);for(;E<R;)d==="array"||d==="nodebuffer"?m.push(String.fromCharCode.apply(null,s.slice(E,Math.min(E+l,R)))):m.push(String.fromCharCode.apply(null,s.subarray(E,Math.min(E+l,R)))),E+=l;return m.join("")},stringifyByChar:function(s){for(var d="",l=0;l<s.length;l++)d+=String.fromCharCode(s[l]);return d},applyCanBeUsed:{uint8array:function(){try{return a.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return a.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}}()}};function A(s){var d=65536,l=u.getTypeOf(s),m=!0;if(l==="uint8array"?m=_.applyCanBeUsed.uint8array:l==="nodebuffer"&&(m=_.applyCanBeUsed.nodebuffer),m)for(;1<d;)try{return _.stringifyByChunk(s,l,d)}catch{d=Math.floor(d/2)}return _.stringifyByChar(s)}function p(s,d){for(var l=0;l<s.length;l++)d[l]=s[l];return d}u.applyFromCharCode=A;var c={};c.string={string:b,array:function(s){return x(s,new Array(s.length))},arraybuffer:function(s){return c.string.uint8array(s).buffer},uint8array:function(s){return x(s,new Uint8Array(s.length))},nodebuffer:function(s){return x(s,o.allocBuffer(s.length))}},c.array={string:A,array:b,arraybuffer:function(s){return new Uint8Array(s).buffer},uint8array:function(s){return new Uint8Array(s)},nodebuffer:function(s){return o.newBufferFrom(s)}},c.arraybuffer={string:function(s){return A(new Uint8Array(s))},array:function(s){return p(new Uint8Array(s),new Array(s.byteLength))},arraybuffer:b,uint8array:function(s){return new Uint8Array(s)},nodebuffer:function(s){return o.newBufferFrom(new Uint8Array(s))}},c.uint8array={string:A,array:function(s){return p(s,new Array(s.length))},arraybuffer:function(s){return s.buffer},uint8array:b,nodebuffer:function(s){return o.newBufferFrom(s)}},c.nodebuffer={string:A,array:function(s){return p(s,new Array(s.length))},arraybuffer:function(s){return c.nodebuffer.uint8array(s).buffer},uint8array:function(s){return p(s,new Uint8Array(s.length))},nodebuffer:b},u.transformTo=function(s,d){if(d=d||"",!s)return d;u.checkSupport(s);var l=u.getTypeOf(d);return c[l][s](d)},u.resolve=function(s){for(var d=s.split("/"),l=[],m=0;m<d.length;m++){var E=d[m];E==="."||E===""&&m!==0&&m!==d.length-1||(E===".."?l.pop():l.push(E))}return l.join("/")},u.getTypeOf=function(s){return typeof s=="string"?"string":Object.prototype.toString.call(s)==="[object Array]"?"array":a.nodebuffer&&o.isBuffer(s)?"nodebuffer":a.uint8array&&s instanceof Uint8Array?"uint8array":a.arraybuffer&&s instanceof ArrayBuffer?"arraybuffer":void 0},u.checkSupport=function(s){if(!a[s.toLowerCase()])throw new Error(s+" is not supported by this platform")},u.MAX_VALUE_16BITS=65535,u.MAX_VALUE_32BITS=-1,u.pretty=function(s){var d,l,m="";for(l=0;l<(s||"").length;l++)m+="\\x"+((d=s.charCodeAt(l))<16?"0":"")+d.toString(16).toUpperCase();return m},u.delay=function(s,d,l){setImmediate(function(){s.apply(l||null,d||[])})},u.inherits=function(s,d){function l(){}l.prototype=d.prototype,s.prototype=new l},u.extend=function(){var s,d,l={};for(s=0;s<arguments.length;s++)for(d in arguments[s])Object.prototype.hasOwnProperty.call(arguments[s],d)&&l[d]===void 0&&(l[d]=arguments[s][d]);return l},u.prepareContent=function(s,d,l,m,E){return n.Promise.resolve(d).then(function(R){return a.blob&&(R instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(R))!==-1)&&typeof FileReader<"u"?new n.Promise(function(C,z){var B=new FileReader;B.onload=function(O){C(O.target.result)},B.onerror=function(O){z(O.target.error)},B.readAsArrayBuffer(R)}):R}).then(function(R){var C=u.getTypeOf(R);return C?(C==="arraybuffer"?R=u.transformTo("uint8array",R):C==="string"&&(E?R=f.decode(R):l&&m!==!0&&(R=function(z){return x(z,a.uint8array?new Uint8Array(z.length):new Array(z.length))}(R))),R):n.Promise.reject(new Error("Can't read the data of '"+s+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,r,u){var a=e("./reader/readerFor"),f=e("./utils"),o=e("./signature"),n=e("./zipEntry"),b=e("./support");function x(_){this.files=[],this.loadOptions=_}x.prototype={checkSignature:function(_){if(!this.reader.readAndCheckSignature(_)){this.reader.index-=4;var A=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+f.pretty(A)+", expected "+f.pretty(_)+")")}},isSignature:function(_,A){var p=this.reader.index;this.reader.setIndex(_);var c=this.reader.readString(4)===A;return this.reader.setIndex(p),c},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var _=this.reader.readData(this.zipCommentLength),A=b.uint8array?"uint8array":"array",p=f.transformTo(A,_);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var _,A,p,c=this.zip64EndOfCentralSize-44;0<c;)_=this.reader.readInt(2),A=this.reader.readInt(4),p=this.reader.readData(A),this.zip64ExtensibleData[_]={id:_,length:A,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var _,A;for(_=0;_<this.files.length;_++)A=this.files[_],this.reader.setIndex(A.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),A.readLocalPart(this.reader),A.handleUTF8(),A.processAttributes()},readCentralDir:function(){var _;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(_=new n({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(_);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var _=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(_<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(_);var A=_;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===f.MAX_VALUE_16BITS||this.diskWithCentralDirStart===f.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===f.MAX_VALUE_16BITS||this.centralDirRecords===f.MAX_VALUE_16BITS||this.centralDirSize===f.MAX_VALUE_32BITS||this.centralDirOffset===f.MAX_VALUE_32BITS){if(this.zip64=!0,(_=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(_),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var c=A-p;if(0<c)this.isSignature(A,o.CENTRAL_FILE_HEADER)||(this.reader.zero=c);else if(c<0)throw new Error("Corrupted zip: missing "+Math.abs(c)+" bytes.")},prepareReader:function(_){this.reader=a(_)},load:function(_){this.prepareReader(_),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=x},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,r,u){var a=e("./reader/readerFor"),f=e("./utils"),o=e("./compressedObject"),n=e("./crc32"),b=e("./utf8"),x=e("./compressions"),_=e("./support");function A(p,c){this.options=p,this.loadOptions=c}A.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var c,s;if(p.skip(22),this.fileNameLength=p.readInt(2),s=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(s),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((c=function(d){for(var l in x)if(Object.prototype.hasOwnProperty.call(x,l)&&x[l].magic===d)return x[l];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+f.pretty(this.compressionMethod)+" unknown (inner file : "+f.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,c,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var c=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(c),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=a(this.extraFields[1].value);this.uncompressedSize===f.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===f.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===f.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===f.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var c,s,d,l=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<l;)c=p.readInt(2),s=p.readInt(2),d=p.readData(s),this.extraFields[c]={id:c,length:s,value:d};p.setIndex(l)},handleUTF8:function(){var p=_.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=b.utf8decode(this.fileName),this.fileCommentStr=b.utf8decode(this.fileComment);else{var c=this.findExtraFieldUnicodePath();if(c!==null)this.fileNameStr=c;else{var s=f.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(s)}var d=this.findExtraFieldUnicodeComment();if(d!==null)this.fileCommentStr=d;else{var l=f.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(l)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var c=a(p.value);return c.readInt(1)!==1||n(this.fileName)!==c.readInt(4)?null:b.utf8decode(c.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var c=a(p.value);return c.readInt(1)!==1||n(this.fileComment)!==c.readInt(4)?null:b.utf8decode(c.readData(p.length-5))}return null}},r.exports=A},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,r,u){function a(c,s,d){this.name=c,this.dir=d.dir,this.date=d.date,this.comment=d.comment,this.unixPermissions=d.unixPermissions,this.dosPermissions=d.dosPermissions,this._data=s,this._dataBinary=d.binary,this.options={compression:d.compression,compressionOptions:d.compressionOptions}}var f=e("./stream/StreamHelper"),o=e("./stream/DataWorker"),n=e("./utf8"),b=e("./compressedObject"),x=e("./stream/GenericWorker");a.prototype={internalStream:function(c){var s=null,d="string";try{if(!c)throw new Error("No output type specified.");var l=(d=c.toLowerCase())==="string"||d==="text";d!=="binarystring"&&d!=="text"||(d="string"),s=this._decompressWorker();var m=!this._dataBinary;m&&!l&&(s=s.pipe(new n.Utf8EncodeWorker)),!m&&l&&(s=s.pipe(new n.Utf8DecodeWorker))}catch(E){(s=new x("error")).error(E)}return new f(s,d,"")},async:function(c,s){return this.internalStream(c).accumulate(s)},nodeStream:function(c,s){return this.internalStream(c||"nodebuffer").toNodejsStream(s)},_compressWorker:function(c,s){if(this._data instanceof b&&this._data.compression.magic===c.magic)return this._data.getCompressedWorker();var d=this._decompressWorker();return this._dataBinary||(d=d.pipe(new n.Utf8EncodeWorker)),b.createWorkerFrom(d,c,s)},_decompressWorker:function(){return this._data instanceof b?this._data.getContentWorker():this._data instanceof x?this._data:new o(this._data)}};for(var _=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],A=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<_.length;p++)a.prototype[_[p]]=A;r.exports=a},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,r,u){(function(a){var f,o,n=a.MutationObserver||a.WebKitMutationObserver;if(n){var b=0,x=new n(c),_=a.document.createTextNode("");x.observe(_,{characterData:!0}),f=function(){_.data=b=++b%2}}else if(a.setImmediate||a.MessageChannel===void 0)f="document"in a&&"onreadystatechange"in a.document.createElement("script")?function(){var s=a.document.createElement("script");s.onreadystatechange=function(){c(),s.onreadystatechange=null,s.parentNode.removeChild(s),s=null},a.document.documentElement.appendChild(s)}:function(){setTimeout(c,0)};else{var A=new a.MessageChannel;A.port1.onmessage=c,f=function(){A.port2.postMessage(0)}}var p=[];function c(){var s,d;o=!0;for(var l=p.length;l;){for(d=p,p=[],s=-1;++s<l;)d[s]();l=p.length}o=!1}r.exports=function(s){p.push(s)!==1||o||f()}}).call(this,typeof Tt<"u"?Tt:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(e,r,u){var a=e("immediate");function f(){}var o={},n=["REJECTED"],b=["FULFILLED"],x=["PENDING"];function _(l){if(typeof l!="function")throw new TypeError("resolver must be a function");this.state=x,this.queue=[],this.outcome=void 0,l!==f&&s(this,l)}function A(l,m,E){this.promise=l,typeof m=="function"&&(this.onFulfilled=m,this.callFulfilled=this.otherCallFulfilled),typeof E=="function"&&(this.onRejected=E,this.callRejected=this.otherCallRejected)}function p(l,m,E){a(function(){var R;try{R=m(E)}catch(C){return o.reject(l,C)}R===l?o.reject(l,new TypeError("Cannot resolve promise with itself")):o.resolve(l,R)})}function c(l){var m=l&&l.then;if(l&&(typeof l=="object"||typeof l=="function")&&typeof m=="function")return function(){m.apply(l,arguments)}}function s(l,m){var E=!1;function R(B){E||(E=!0,o.reject(l,B))}function C(B){E||(E=!0,o.resolve(l,B))}var z=d(function(){m(C,R)});z.status==="error"&&R(z.value)}function d(l,m){var E={};try{E.value=l(m),E.status="success"}catch(R){E.status="error",E.value=R}return E}(r.exports=_).prototype.finally=function(l){if(typeof l!="function")return this;var m=this.constructor;return this.then(function(E){return m.resolve(l()).then(function(){return E})},function(E){return m.resolve(l()).then(function(){throw E})})},_.prototype.catch=function(l){return this.then(null,l)},_.prototype.then=function(l,m){if(typeof l!="function"&&this.state===b||typeof m!="function"&&this.state===n)return this;var E=new this.constructor(f);return this.state!==x?p(E,this.state===b?l:m,this.outcome):this.queue.push(new A(E,l,m)),E},A.prototype.callFulfilled=function(l){o.resolve(this.promise,l)},A.prototype.otherCallFulfilled=function(l){p(this.promise,this.onFulfilled,l)},A.prototype.callRejected=function(l){o.reject(this.promise,l)},A.prototype.otherCallRejected=function(l){p(this.promise,this.onRejected,l)},o.resolve=function(l,m){var E=d(c,m);if(E.status==="error")return o.reject(l,E.value);var R=E.value;if(R)s(l,R);else{l.state=b,l.outcome=m;for(var C=-1,z=l.queue.length;++C<z;)l.queue[C].callFulfilled(m)}return l},o.reject=function(l,m){l.state=n,l.outcome=m;for(var E=-1,R=l.queue.length;++E<R;)l.queue[E].callRejected(m);return l},_.resolve=function(l){return l instanceof this?l:o.resolve(new this(f),l)},_.reject=function(l){var m=new this(f);return o.reject(m,l)},_.all=function(l){var m=this;if(Object.prototype.toString.call(l)!=="[object Array]")return this.reject(new TypeError("must be an array"));var E=l.length,R=!1;if(!E)return this.resolve([]);for(var C=new Array(E),z=0,B=-1,O=new this(f);++B<E;)L(l[B],B);return O;function L(M,$){m.resolve(M).then(function(w){C[$]=w,++z!==E||R||(R=!0,o.resolve(O,C))},function(w){R||(R=!0,o.reject(O,w))})}},_.race=function(l){var m=this;if(Object.prototype.toString.call(l)!=="[object Array]")return this.reject(new TypeError("must be an array"));var E=l.length,R=!1;if(!E)return this.resolve([]);for(var C=-1,z=new this(f);++C<E;)B=l[C],m.resolve(B).then(function(O){R||(R=!0,o.resolve(z,O))},function(O){R||(R=!0,o.reject(z,O))});var B;return z}},{immediate:36}],38:[function(e,r,u){var a={};(0,e("./lib/utils/common").assign)(a,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),r.exports=a},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,r,u){var a=e("./zlib/deflate"),f=e("./utils/common"),o=e("./utils/strings"),n=e("./zlib/messages"),b=e("./zlib/zstream"),x=Object.prototype.toString,_=0,A=-1,p=0,c=8;function s(l){if(!(this instanceof s))return new s(l);this.options=f.assign({level:A,method:c,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},l||{});var m=this.options;m.raw&&0<m.windowBits?m.windowBits=-m.windowBits:m.gzip&&0<m.windowBits&&m.windowBits<16&&(m.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new b,this.strm.avail_out=0;var E=a.deflateInit2(this.strm,m.level,m.method,m.windowBits,m.memLevel,m.strategy);if(E!==_)throw new Error(n[E]);if(m.header&&a.deflateSetHeader(this.strm,m.header),m.dictionary){var R;if(R=typeof m.dictionary=="string"?o.string2buf(m.dictionary):x.call(m.dictionary)==="[object ArrayBuffer]"?new Uint8Array(m.dictionary):m.dictionary,(E=a.deflateSetDictionary(this.strm,R))!==_)throw new Error(n[E]);this._dict_set=!0}}function d(l,m){var E=new s(m);if(E.push(l,!0),E.err)throw E.msg||n[E.err];return E.result}s.prototype.push=function(l,m){var E,R,C=this.strm,z=this.options.chunkSize;if(this.ended)return!1;R=m===~~m?m:m===!0?4:0,typeof l=="string"?C.input=o.string2buf(l):x.call(l)==="[object ArrayBuffer]"?C.input=new Uint8Array(l):C.input=l,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new f.Buf8(z),C.next_out=0,C.avail_out=z),(E=a.deflate(C,R))!==1&&E!==_)return this.onEnd(E),!(this.ended=!0);C.avail_out!==0&&(C.avail_in!==0||R!==4&&R!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(f.shrinkBuf(C.output,C.next_out))):this.onData(f.shrinkBuf(C.output,C.next_out)))}while((0<C.avail_in||C.avail_out===0)&&E!==1);return R===4?(E=a.deflateEnd(this.strm),this.onEnd(E),this.ended=!0,E===_):R!==2||(this.onEnd(_),!(C.avail_out=0))},s.prototype.onData=function(l){this.chunks.push(l)},s.prototype.onEnd=function(l){l===_&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=f.flattenChunks(this.chunks)),this.chunks=[],this.err=l,this.msg=this.strm.msg},u.Deflate=s,u.deflate=d,u.deflateRaw=function(l,m){return(m=m||{}).raw=!0,d(l,m)},u.gzip=function(l,m){return(m=m||{}).gzip=!0,d(l,m)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,r,u){var a=e("./zlib/inflate"),f=e("./utils/common"),o=e("./utils/strings"),n=e("./zlib/constants"),b=e("./zlib/messages"),x=e("./zlib/zstream"),_=e("./zlib/gzheader"),A=Object.prototype.toString;function p(s){if(!(this instanceof p))return new p(s);this.options=f.assign({chunkSize:16384,windowBits:0,to:""},s||{});var d=this.options;d.raw&&0<=d.windowBits&&d.windowBits<16&&(d.windowBits=-d.windowBits,d.windowBits===0&&(d.windowBits=-15)),!(0<=d.windowBits&&d.windowBits<16)||s&&s.windowBits||(d.windowBits+=32),15<d.windowBits&&d.windowBits<48&&!(15&d.windowBits)&&(d.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new x,this.strm.avail_out=0;var l=a.inflateInit2(this.strm,d.windowBits);if(l!==n.Z_OK)throw new Error(b[l]);this.header=new _,a.inflateGetHeader(this.strm,this.header)}function c(s,d){var l=new p(d);if(l.push(s,!0),l.err)throw l.msg||b[l.err];return l.result}p.prototype.push=function(s,d){var l,m,E,R,C,z,B=this.strm,O=this.options.chunkSize,L=this.options.dictionary,M=!1;if(this.ended)return!1;m=d===~~d?d:d===!0?n.Z_FINISH:n.Z_NO_FLUSH,typeof s=="string"?B.input=o.binstring2buf(s):A.call(s)==="[object ArrayBuffer]"?B.input=new Uint8Array(s):B.input=s,B.next_in=0,B.avail_in=B.input.length;do{if(B.avail_out===0&&(B.output=new f.Buf8(O),B.next_out=0,B.avail_out=O),(l=a.inflate(B,n.Z_NO_FLUSH))===n.Z_NEED_DICT&&L&&(z=typeof L=="string"?o.string2buf(L):A.call(L)==="[object ArrayBuffer]"?new Uint8Array(L):L,l=a.inflateSetDictionary(this.strm,z)),l===n.Z_BUF_ERROR&&M===!0&&(l=n.Z_OK,M=!1),l!==n.Z_STREAM_END&&l!==n.Z_OK)return this.onEnd(l),!(this.ended=!0);B.next_out&&(B.avail_out!==0&&l!==n.Z_STREAM_END&&(B.avail_in!==0||m!==n.Z_FINISH&&m!==n.Z_SYNC_FLUSH)||(this.options.to==="string"?(E=o.utf8border(B.output,B.next_out),R=B.next_out-E,C=o.buf2string(B.output,E),B.next_out=R,B.avail_out=O-R,R&&f.arraySet(B.output,B.output,E,R,0),this.onData(C)):this.onData(f.shrinkBuf(B.output,B.next_out)))),B.avail_in===0&&B.avail_out===0&&(M=!0)}while((0<B.avail_in||B.avail_out===0)&&l!==n.Z_STREAM_END);return l===n.Z_STREAM_END&&(m=n.Z_FINISH),m===n.Z_FINISH?(l=a.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,l===n.Z_OK):m!==n.Z_SYNC_FLUSH||(this.onEnd(n.Z_OK),!(B.avail_out=0))},p.prototype.onData=function(s){this.chunks.push(s)},p.prototype.onEnd=function(s){s===n.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=f.flattenChunks(this.chunks)),this.chunks=[],this.err=s,this.msg=this.strm.msg},u.Inflate=p,u.inflate=c,u.inflateRaw=function(s,d){return(d=d||{}).raw=!0,c(s,d)},u.ungzip=c},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,r,u){var a=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";u.assign=function(n){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var x=b.shift();if(x){if(typeof x!="object")throw new TypeError(x+"must be non-object");for(var _ in x)x.hasOwnProperty(_)&&(n[_]=x[_])}}return n},u.shrinkBuf=function(n,b){return n.length===b?n:n.subarray?n.subarray(0,b):(n.length=b,n)};var f={arraySet:function(n,b,x,_,A){if(b.subarray&&n.subarray)n.set(b.subarray(x,x+_),A);else for(var p=0;p<_;p++)n[A+p]=b[x+p]},flattenChunks:function(n){var b,x,_,A,p,c;for(b=_=0,x=n.length;b<x;b++)_+=n[b].length;for(c=new Uint8Array(_),b=A=0,x=n.length;b<x;b++)p=n[b],c.set(p,A),A+=p.length;return c}},o={arraySet:function(n,b,x,_,A){for(var p=0;p<_;p++)n[A+p]=b[x+p]},flattenChunks:function(n){return[].concat.apply([],n)}};u.setTyped=function(n){n?(u.Buf8=Uint8Array,u.Buf16=Uint16Array,u.Buf32=Int32Array,u.assign(u,f)):(u.Buf8=Array,u.Buf16=Array,u.Buf32=Array,u.assign(u,o))},u.setTyped(a)},{}],42:[function(e,r,u){var a=e("./common"),f=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{f=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var n=new a.Buf8(256),b=0;b<256;b++)n[b]=252<=b?6:248<=b?5:240<=b?4:224<=b?3:192<=b?2:1;function x(_,A){if(A<65537&&(_.subarray&&o||!_.subarray&&f))return String.fromCharCode.apply(null,a.shrinkBuf(_,A));for(var p="",c=0;c<A;c++)p+=String.fromCharCode(_[c]);return p}n[254]=n[254]=1,u.string2buf=function(_){var A,p,c,s,d,l=_.length,m=0;for(s=0;s<l;s++)(64512&(p=_.charCodeAt(s)))==55296&&s+1<l&&(64512&(c=_.charCodeAt(s+1)))==56320&&(p=65536+(p-55296<<10)+(c-56320),s++),m+=p<128?1:p<2048?2:p<65536?3:4;for(A=new a.Buf8(m),s=d=0;d<m;s++)(64512&(p=_.charCodeAt(s)))==55296&&s+1<l&&(64512&(c=_.charCodeAt(s+1)))==56320&&(p=65536+(p-55296<<10)+(c-56320),s++),p<128?A[d++]=p:(p<2048?A[d++]=192|p>>>6:(p<65536?A[d++]=224|p>>>12:(A[d++]=240|p>>>18,A[d++]=128|p>>>12&63),A[d++]=128|p>>>6&63),A[d++]=128|63&p);return A},u.buf2binstring=function(_){return x(_,_.length)},u.binstring2buf=function(_){for(var A=new a.Buf8(_.length),p=0,c=A.length;p<c;p++)A[p]=_.charCodeAt(p);return A},u.buf2string=function(_,A){var p,c,s,d,l=A||_.length,m=new Array(2*l);for(p=c=0;p<l;)if((s=_[p++])<128)m[c++]=s;else if(4<(d=n[s]))m[c++]=65533,p+=d-1;else{for(s&=d===2?31:d===3?15:7;1<d&&p<l;)s=s<<6|63&_[p++],d--;1<d?m[c++]=65533:s<65536?m[c++]=s:(s-=65536,m[c++]=55296|s>>10&1023,m[c++]=56320|1023&s)}return x(m,c)},u.utf8border=function(_,A){var p;for((A=A||_.length)>_.length&&(A=_.length),p=A-1;0<=p&&(192&_[p])==128;)p--;return p<0||p===0?A:p+n[_[p]]>A?p:A}},{"./common":41}],43:[function(e,r,u){r.exports=function(a,f,o,n){for(var b=65535&a|0,x=a>>>16&65535|0,_=0;o!==0;){for(o-=_=2e3<o?2e3:o;x=x+(b=b+f[n++]|0)|0,--_;);b%=65521,x%=65521}return b|x<<16|0}},{}],44:[function(e,r,u){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,r,u){var a=function(){for(var f,o=[],n=0;n<256;n++){f=n;for(var b=0;b<8;b++)f=1&f?3988292384^f>>>1:f>>>1;o[n]=f}return o}();r.exports=function(f,o,n,b){var x=a,_=b+n;f^=-1;for(var A=b;A<_;A++)f=f>>>8^x[255&(f^o[A])];return-1^f}},{}],46:[function(e,r,u){var a,f=e("../utils/common"),o=e("./trees"),n=e("./adler32"),b=e("./crc32"),x=e("./messages"),_=0,A=4,p=0,c=-2,s=-1,d=4,l=2,m=8,E=9,R=286,C=30,z=19,B=2*R+1,O=15,L=3,M=258,$=M+L+1,w=42,D=113,h=1,I=2,J=3,G=4;function tt(i,P){return i.msg=x[P],P}function W(i){return(i<<1)-(4<i?9:0)}function K(i){for(var P=i.length;0<=--P;)i[P]=0}function S(i){var P=i.state,U=P.pending;U>i.avail_out&&(U=i.avail_out),U!==0&&(f.arraySet(i.output,P.pending_buf,P.pending_out,U,i.next_out),i.next_out+=U,P.pending_out+=U,i.total_out+=U,i.avail_out-=U,P.pending-=U,P.pending===0&&(P.pending_out=0))}function F(i,P){o._tr_flush_block(i,0<=i.block_start?i.block_start:-1,i.strstart-i.block_start,P),i.block_start=i.strstart,S(i.strm)}function q(i,P){i.pending_buf[i.pending++]=P}function V(i,P){i.pending_buf[i.pending++]=P>>>8&255,i.pending_buf[i.pending++]=255&P}function j(i,P){var U,y,g=i.max_chain_length,T=i.strstart,N=i.prev_length,X=i.nice_match,k=i.strstart>i.w_size-$?i.strstart-(i.w_size-$):0,Y=i.window,H=i.w_mask,Z=i.prev,Q=i.strstart+M,ht=Y[T+N-1],it=Y[T+N];i.prev_length>=i.good_match&&(g>>=2),X>i.lookahead&&(X=i.lookahead);do if(Y[(U=P)+N]===it&&Y[U+N-1]===ht&&Y[U]===Y[T]&&Y[++U]===Y[T+1]){T+=2,U++;do;while(Y[++T]===Y[++U]&&Y[++T]===Y[++U]&&Y[++T]===Y[++U]&&Y[++T]===Y[++U]&&Y[++T]===Y[++U]&&Y[++T]===Y[++U]&&Y[++T]===Y[++U]&&Y[++T]===Y[++U]&&T<Q);if(y=M-(Q-T),T=Q-M,N<y){if(i.match_start=P,X<=(N=y))break;ht=Y[T+N-1],it=Y[T+N]}}while((P=Z[P&H])>k&&--g!=0);return N<=i.lookahead?N:i.lookahead}function at(i){var P,U,y,g,T,N,X,k,Y,H,Z=i.w_size;do{if(g=i.window_size-i.lookahead-i.strstart,i.strstart>=Z+(Z-$)){for(f.arraySet(i.window,i.window,Z,Z,0),i.match_start-=Z,i.strstart-=Z,i.block_start-=Z,P=U=i.hash_size;y=i.head[--P],i.head[P]=Z<=y?y-Z:0,--U;);for(P=U=Z;y=i.prev[--P],i.prev[P]=Z<=y?y-Z:0,--U;);g+=Z}if(i.strm.avail_in===0)break;if(N=i.strm,X=i.window,k=i.strstart+i.lookahead,Y=g,H=void 0,H=N.avail_in,Y<H&&(H=Y),U=H===0?0:(N.avail_in-=H,f.arraySet(X,N.input,N.next_in,H,k),N.state.wrap===1?N.adler=n(N.adler,X,H,k):N.state.wrap===2&&(N.adler=b(N.adler,X,H,k)),N.next_in+=H,N.total_in+=H,H),i.lookahead+=U,i.lookahead+i.insert>=L)for(T=i.strstart-i.insert,i.ins_h=i.window[T],i.ins_h=(i.ins_h<<i.hash_shift^i.window[T+1])&i.hash_mask;i.insert&&(i.ins_h=(i.ins_h<<i.hash_shift^i.window[T+L-1])&i.hash_mask,i.prev[T&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=T,T++,i.insert--,!(i.lookahead+i.insert<L)););}while(i.lookahead<$&&i.strm.avail_in!==0)}function ot(i,P){for(var U,y;;){if(i.lookahead<$){if(at(i),i.lookahead<$&&P===_)return h;if(i.lookahead===0)break}if(U=0,i.lookahead>=L&&(i.ins_h=(i.ins_h<<i.hash_shift^i.window[i.strstart+L-1])&i.hash_mask,U=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),U!==0&&i.strstart-U<=i.w_size-$&&(i.match_length=j(i,U)),i.match_length>=L)if(y=o._tr_tally(i,i.strstart-i.match_start,i.match_length-L),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=L){for(i.match_length--;i.strstart++,i.ins_h=(i.ins_h<<i.hash_shift^i.window[i.strstart+L-1])&i.hash_mask,U=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart,--i.match_length!=0;);i.strstart++}else i.strstart+=i.match_length,i.match_length=0,i.ins_h=i.window[i.strstart],i.ins_h=(i.ins_h<<i.hash_shift^i.window[i.strstart+1])&i.hash_mask;else y=o._tr_tally(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(y&&(F(i,!1),i.strm.avail_out===0))return h}return i.insert=i.strstart<L-1?i.strstart:L-1,P===A?(F(i,!0),i.strm.avail_out===0?J:G):i.last_lit&&(F(i,!1),i.strm.avail_out===0)?h:I}function et(i,P){for(var U,y,g;;){if(i.lookahead<$){if(at(i),i.lookahead<$&&P===_)return h;if(i.lookahead===0)break}if(U=0,i.lookahead>=L&&(i.ins_h=(i.ins_h<<i.hash_shift^i.window[i.strstart+L-1])&i.hash_mask,U=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),i.prev_length=i.match_length,i.prev_match=i.match_start,i.match_length=L-1,U!==0&&i.prev_length<i.max_lazy_match&&i.strstart-U<=i.w_size-$&&(i.match_length=j(i,U),i.match_length<=5&&(i.strategy===1||i.match_length===L&&4096<i.strstart-i.match_start)&&(i.match_length=L-1)),i.prev_length>=L&&i.match_length<=i.prev_length){for(g=i.strstart+i.lookahead-L,y=o._tr_tally(i,i.strstart-1-i.prev_match,i.prev_length-L),i.lookahead-=i.prev_length-1,i.prev_length-=2;++i.strstart<=g&&(i.ins_h=(i.ins_h<<i.hash_shift^i.window[i.strstart+L-1])&i.hash_mask,U=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),--i.prev_length!=0;);if(i.match_available=0,i.match_length=L-1,i.strstart++,y&&(F(i,!1),i.strm.avail_out===0))return h}else if(i.match_available){if((y=o._tr_tally(i,0,i.window[i.strstart-1]))&&F(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return h}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(y=o._tr_tally(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<L-1?i.strstart:L-1,P===A?(F(i,!0),i.strm.avail_out===0?J:G):i.last_lit&&(F(i,!1),i.strm.avail_out===0)?h:I}function rt(i,P,U,y,g){this.good_length=i,this.max_lazy=P,this.nice_length=U,this.max_chain=y,this.func=g}function st(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=m,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new f.Buf16(2*B),this.dyn_dtree=new f.Buf16(2*(2*C+1)),this.bl_tree=new f.Buf16(2*(2*z+1)),K(this.dyn_ltree),K(this.dyn_dtree),K(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new f.Buf16(O+1),this.heap=new f.Buf16(2*R+1),K(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new f.Buf16(2*R+1),K(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function nt(i){var P;return i&&i.state?(i.total_in=i.total_out=0,i.data_type=l,(P=i.state).pending=0,P.pending_out=0,P.wrap<0&&(P.wrap=-P.wrap),P.status=P.wrap?w:D,i.adler=P.wrap===2?0:1,P.last_flush=_,o._tr_init(P),p):tt(i,c)}function ct(i){var P=nt(i);return P===p&&function(U){U.window_size=2*U.w_size,K(U.head),U.max_lazy_match=a[U.level].max_lazy,U.good_match=a[U.level].good_length,U.nice_match=a[U.level].nice_length,U.max_chain_length=a[U.level].max_chain,U.strstart=0,U.block_start=0,U.lookahead=0,U.insert=0,U.match_length=U.prev_length=L-1,U.match_available=0,U.ins_h=0}(i.state),P}function dt(i,P,U,y,g,T){if(!i)return c;var N=1;if(P===s&&(P=6),y<0?(N=0,y=-y):15<y&&(N=2,y-=16),g<1||E<g||U!==m||y<8||15<y||P<0||9<P||T<0||d<T)return tt(i,c);y===8&&(y=9);var X=new st;return(i.state=X).strm=i,X.wrap=N,X.gzhead=null,X.w_bits=y,X.w_size=1<<X.w_bits,X.w_mask=X.w_size-1,X.hash_bits=g+7,X.hash_size=1<<X.hash_bits,X.hash_mask=X.hash_size-1,X.hash_shift=~~((X.hash_bits+L-1)/L),X.window=new f.Buf8(2*X.w_size),X.head=new f.Buf16(X.hash_size),X.prev=new f.Buf16(X.w_size),X.lit_bufsize=1<<g+6,X.pending_buf_size=4*X.lit_bufsize,X.pending_buf=new f.Buf8(X.pending_buf_size),X.d_buf=1*X.lit_bufsize,X.l_buf=3*X.lit_bufsize,X.level=P,X.strategy=T,X.method=U,ct(i)}a=[new rt(0,0,0,0,function(i,P){var U=65535;for(U>i.pending_buf_size-5&&(U=i.pending_buf_size-5);;){if(i.lookahead<=1){if(at(i),i.lookahead===0&&P===_)return h;if(i.lookahead===0)break}i.strstart+=i.lookahead,i.lookahead=0;var y=i.block_start+U;if((i.strstart===0||i.strstart>=y)&&(i.lookahead=i.strstart-y,i.strstart=y,F(i,!1),i.strm.avail_out===0)||i.strstart-i.block_start>=i.w_size-$&&(F(i,!1),i.strm.avail_out===0))return h}return i.insert=0,P===A?(F(i,!0),i.strm.avail_out===0?J:G):(i.strstart>i.block_start&&(F(i,!1),i.strm.avail_out),h)}),new rt(4,4,8,4,ot),new rt(4,5,16,8,ot),new rt(4,6,32,32,ot),new rt(4,4,16,16,et),new rt(8,16,32,32,et),new rt(8,16,128,128,et),new rt(8,32,128,256,et),new rt(32,128,258,1024,et),new rt(32,258,258,4096,et)],u.deflateInit=function(i,P){return dt(i,P,m,15,8,0)},u.deflateInit2=dt,u.deflateReset=ct,u.deflateResetKeep=nt,u.deflateSetHeader=function(i,P){return i&&i.state?i.state.wrap!==2?c:(i.state.gzhead=P,p):c},u.deflate=function(i,P){var U,y,g,T;if(!i||!i.state||5<P||P<0)return i?tt(i,c):c;if(y=i.state,!i.output||!i.input&&i.avail_in!==0||y.status===666&&P!==A)return tt(i,i.avail_out===0?-5:c);if(y.strm=i,U=y.last_flush,y.last_flush=P,y.status===w)if(y.wrap===2)i.adler=0,q(y,31),q(y,139),q(y,8),y.gzhead?(q(y,(y.gzhead.text?1:0)+(y.gzhead.hcrc?2:0)+(y.gzhead.extra?4:0)+(y.gzhead.name?8:0)+(y.gzhead.comment?16:0)),q(y,255&y.gzhead.time),q(y,y.gzhead.time>>8&255),q(y,y.gzhead.time>>16&255),q(y,y.gzhead.time>>24&255),q(y,y.level===9?2:2<=y.strategy||y.level<2?4:0),q(y,255&y.gzhead.os),y.gzhead.extra&&y.gzhead.extra.length&&(q(y,255&y.gzhead.extra.length),q(y,y.gzhead.extra.length>>8&255)),y.gzhead.hcrc&&(i.adler=b(i.adler,y.pending_buf,y.pending,0)),y.gzindex=0,y.status=69):(q(y,0),q(y,0),q(y,0),q(y,0),q(y,0),q(y,y.level===9?2:2<=y.strategy||y.level<2?4:0),q(y,3),y.status=D);else{var N=m+(y.w_bits-8<<4)<<8;N|=(2<=y.strategy||y.level<2?0:y.level<6?1:y.level===6?2:3)<<6,y.strstart!==0&&(N|=32),N+=31-N%31,y.status=D,V(y,N),y.strstart!==0&&(V(y,i.adler>>>16),V(y,65535&i.adler)),i.adler=1}if(y.status===69)if(y.gzhead.extra){for(g=y.pending;y.gzindex<(65535&y.gzhead.extra.length)&&(y.pending!==y.pending_buf_size||(y.gzhead.hcrc&&y.pending>g&&(i.adler=b(i.adler,y.pending_buf,y.pending-g,g)),S(i),g=y.pending,y.pending!==y.pending_buf_size));)q(y,255&y.gzhead.extra[y.gzindex]),y.gzindex++;y.gzhead.hcrc&&y.pending>g&&(i.adler=b(i.adler,y.pending_buf,y.pending-g,g)),y.gzindex===y.gzhead.extra.length&&(y.gzindex=0,y.status=73)}else y.status=73;if(y.status===73)if(y.gzhead.name){g=y.pending;do{if(y.pending===y.pending_buf_size&&(y.gzhead.hcrc&&y.pending>g&&(i.adler=b(i.adler,y.pending_buf,y.pending-g,g)),S(i),g=y.pending,y.pending===y.pending_buf_size)){T=1;break}T=y.gzindex<y.gzhead.name.length?255&y.gzhead.name.charCodeAt(y.gzindex++):0,q(y,T)}while(T!==0);y.gzhead.hcrc&&y.pending>g&&(i.adler=b(i.adler,y.pending_buf,y.pending-g,g)),T===0&&(y.gzindex=0,y.status=91)}else y.status=91;if(y.status===91)if(y.gzhead.comment){g=y.pending;do{if(y.pending===y.pending_buf_size&&(y.gzhead.hcrc&&y.pending>g&&(i.adler=b(i.adler,y.pending_buf,y.pending-g,g)),S(i),g=y.pending,y.pending===y.pending_buf_size)){T=1;break}T=y.gzindex<y.gzhead.comment.length?255&y.gzhead.comment.charCodeAt(y.gzindex++):0,q(y,T)}while(T!==0);y.gzhead.hcrc&&y.pending>g&&(i.adler=b(i.adler,y.pending_buf,y.pending-g,g)),T===0&&(y.status=103)}else y.status=103;if(y.status===103&&(y.gzhead.hcrc?(y.pending+2>y.pending_buf_size&&S(i),y.pending+2<=y.pending_buf_size&&(q(y,255&i.adler),q(y,i.adler>>8&255),i.adler=0,y.status=D)):y.status=D),y.pending!==0){if(S(i),i.avail_out===0)return y.last_flush=-1,p}else if(i.avail_in===0&&W(P)<=W(U)&&P!==A)return tt(i,-5);if(y.status===666&&i.avail_in!==0)return tt(i,-5);if(i.avail_in!==0||y.lookahead!==0||P!==_&&y.status!==666){var X=y.strategy===2?function(k,Y){for(var H;;){if(k.lookahead===0&&(at(k),k.lookahead===0)){if(Y===_)return h;break}if(k.match_length=0,H=o._tr_tally(k,0,k.window[k.strstart]),k.lookahead--,k.strstart++,H&&(F(k,!1),k.strm.avail_out===0))return h}return k.insert=0,Y===A?(F(k,!0),k.strm.avail_out===0?J:G):k.last_lit&&(F(k,!1),k.strm.avail_out===0)?h:I}(y,P):y.strategy===3?function(k,Y){for(var H,Z,Q,ht,it=k.window;;){if(k.lookahead<=M){if(at(k),k.lookahead<=M&&Y===_)return h;if(k.lookahead===0)break}if(k.match_length=0,k.lookahead>=L&&0<k.strstart&&(Z=it[Q=k.strstart-1])===it[++Q]&&Z===it[++Q]&&Z===it[++Q]){ht=k.strstart+M;do;while(Z===it[++Q]&&Z===it[++Q]&&Z===it[++Q]&&Z===it[++Q]&&Z===it[++Q]&&Z===it[++Q]&&Z===it[++Q]&&Z===it[++Q]&&Q<ht);k.match_length=M-(ht-Q),k.match_length>k.lookahead&&(k.match_length=k.lookahead)}if(k.match_length>=L?(H=o._tr_tally(k,1,k.match_length-L),k.lookahead-=k.match_length,k.strstart+=k.match_length,k.match_length=0):(H=o._tr_tally(k,0,k.window[k.strstart]),k.lookahead--,k.strstart++),H&&(F(k,!1),k.strm.avail_out===0))return h}return k.insert=0,Y===A?(F(k,!0),k.strm.avail_out===0?J:G):k.last_lit&&(F(k,!1),k.strm.avail_out===0)?h:I}(y,P):a[y.level].func(y,P);if(X!==J&&X!==G||(y.status=666),X===h||X===J)return i.avail_out===0&&(y.last_flush=-1),p;if(X===I&&(P===1?o._tr_align(y):P!==5&&(o._tr_stored_block(y,0,0,!1),P===3&&(K(y.head),y.lookahead===0&&(y.strstart=0,y.block_start=0,y.insert=0))),S(i),i.avail_out===0))return y.last_flush=-1,p}return P!==A?p:y.wrap<=0?1:(y.wrap===2?(q(y,255&i.adler),q(y,i.adler>>8&255),q(y,i.adler>>16&255),q(y,i.adler>>24&255),q(y,255&i.total_in),q(y,i.total_in>>8&255),q(y,i.total_in>>16&255),q(y,i.total_in>>24&255)):(V(y,i.adler>>>16),V(y,65535&i.adler)),S(i),0<y.wrap&&(y.wrap=-y.wrap),y.pending!==0?p:1)},u.deflateEnd=function(i){var P;return i&&i.state?(P=i.state.status)!==w&&P!==69&&P!==73&&P!==91&&P!==103&&P!==D&&P!==666?tt(i,c):(i.state=null,P===D?tt(i,-3):p):c},u.deflateSetDictionary=function(i,P){var U,y,g,T,N,X,k,Y,H=P.length;if(!i||!i.state||(T=(U=i.state).wrap)===2||T===1&&U.status!==w||U.lookahead)return c;for(T===1&&(i.adler=n(i.adler,P,H,0)),U.wrap=0,H>=U.w_size&&(T===0&&(K(U.head),U.strstart=0,U.block_start=0,U.insert=0),Y=new f.Buf8(U.w_size),f.arraySet(Y,P,H-U.w_size,U.w_size,0),P=Y,H=U.w_size),N=i.avail_in,X=i.next_in,k=i.input,i.avail_in=H,i.next_in=0,i.input=P,at(U);U.lookahead>=L;){for(y=U.strstart,g=U.lookahead-(L-1);U.ins_h=(U.ins_h<<U.hash_shift^U.window[y+L-1])&U.hash_mask,U.prev[y&U.w_mask]=U.head[U.ins_h],U.head[U.ins_h]=y,y++,--g;);U.strstart=y,U.lookahead=L-1,at(U)}return U.strstart+=U.lookahead,U.block_start=U.strstart,U.insert=U.lookahead,U.lookahead=0,U.match_length=U.prev_length=L-1,U.match_available=0,i.next_in=X,i.input=k,i.avail_in=N,U.wrap=T,p},u.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,r,u){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,r,u){r.exports=function(a,f){var o,n,b,x,_,A,p,c,s,d,l,m,E,R,C,z,B,O,L,M,$,w,D,h,I;o=a.state,n=a.next_in,h=a.input,b=n+(a.avail_in-5),x=a.next_out,I=a.output,_=x-(f-a.avail_out),A=x+(a.avail_out-257),p=o.dmax,c=o.wsize,s=o.whave,d=o.wnext,l=o.window,m=o.hold,E=o.bits,R=o.lencode,C=o.distcode,z=(1<<o.lenbits)-1,B=(1<<o.distbits)-1;t:do{E<15&&(m+=h[n++]<<E,E+=8,m+=h[n++]<<E,E+=8),O=R[m&z];e:for(;;){if(m>>>=L=O>>>24,E-=L,(L=O>>>16&255)===0)I[x++]=65535&O;else{if(!(16&L)){if(!(64&L)){O=R[(65535&O)+(m&(1<<L)-1)];continue e}if(32&L){o.mode=12;break t}a.msg="invalid literal/length code",o.mode=30;break t}M=65535&O,(L&=15)&&(E<L&&(m+=h[n++]<<E,E+=8),M+=m&(1<<L)-1,m>>>=L,E-=L),E<15&&(m+=h[n++]<<E,E+=8,m+=h[n++]<<E,E+=8),O=C[m&B];r:for(;;){if(m>>>=L=O>>>24,E-=L,!(16&(L=O>>>16&255))){if(!(64&L)){O=C[(65535&O)+(m&(1<<L)-1)];continue r}a.msg="invalid distance code",o.mode=30;break t}if($=65535&O,E<(L&=15)&&(m+=h[n++]<<E,(E+=8)<L&&(m+=h[n++]<<E,E+=8)),p<($+=m&(1<<L)-1)){a.msg="invalid distance too far back",o.mode=30;break t}if(m>>>=L,E-=L,(L=x-_)<$){if(s<(L=$-L)&&o.sane){a.msg="invalid distance too far back",o.mode=30;break t}if(D=l,(w=0)===d){if(w+=c-L,L<M){for(M-=L;I[x++]=l[w++],--L;);w=x-$,D=I}}else if(d<L){if(w+=c+d-L,(L-=d)<M){for(M-=L;I[x++]=l[w++],--L;);if(w=0,d<M){for(M-=L=d;I[x++]=l[w++],--L;);w=x-$,D=I}}}else if(w+=d-L,L<M){for(M-=L;I[x++]=l[w++],--L;);w=x-$,D=I}for(;2<M;)I[x++]=D[w++],I[x++]=D[w++],I[x++]=D[w++],M-=3;M&&(I[x++]=D[w++],1<M&&(I[x++]=D[w++]))}else{for(w=x-$;I[x++]=I[w++],I[x++]=I[w++],I[x++]=I[w++],2<(M-=3););M&&(I[x++]=I[w++],1<M&&(I[x++]=I[w++]))}break}}break}}while(n<b&&x<A);n-=M=E>>3,m&=(1<<(E-=M<<3))-1,a.next_in=n,a.next_out=x,a.avail_in=n<b?b-n+5:5-(n-b),a.avail_out=x<A?A-x+257:257-(x-A),o.hold=m,o.bits=E}},{}],49:[function(e,r,u){var a=e("../utils/common"),f=e("./adler32"),o=e("./crc32"),n=e("./inffast"),b=e("./inftrees"),x=1,_=2,A=0,p=-2,c=1,s=852,d=592;function l(w){return(w>>>24&255)+(w>>>8&65280)+((65280&w)<<8)+((255&w)<<24)}function m(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new a.Buf16(320),this.work=new a.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function E(w){var D;return w&&w.state?(D=w.state,w.total_in=w.total_out=D.total=0,w.msg="",D.wrap&&(w.adler=1&D.wrap),D.mode=c,D.last=0,D.havedict=0,D.dmax=32768,D.head=null,D.hold=0,D.bits=0,D.lencode=D.lendyn=new a.Buf32(s),D.distcode=D.distdyn=new a.Buf32(d),D.sane=1,D.back=-1,A):p}function R(w){var D;return w&&w.state?((D=w.state).wsize=0,D.whave=0,D.wnext=0,E(w)):p}function C(w,D){var h,I;return w&&w.state?(I=w.state,D<0?(h=0,D=-D):(h=1+(D>>4),D<48&&(D&=15)),D&&(D<8||15<D)?p:(I.window!==null&&I.wbits!==D&&(I.window=null),I.wrap=h,I.wbits=D,R(w))):p}function z(w,D){var h,I;return w?(I=new m,(w.state=I).window=null,(h=C(w,D))!==A&&(w.state=null),h):p}var B,O,L=!0;function M(w){if(L){var D;for(B=new a.Buf32(512),O=new a.Buf32(32),D=0;D<144;)w.lens[D++]=8;for(;D<256;)w.lens[D++]=9;for(;D<280;)w.lens[D++]=7;for(;D<288;)w.lens[D++]=8;for(b(x,w.lens,0,288,B,0,w.work,{bits:9}),D=0;D<32;)w.lens[D++]=5;b(_,w.lens,0,32,O,0,w.work,{bits:5}),L=!1}w.lencode=B,w.lenbits=9,w.distcode=O,w.distbits=5}function $(w,D,h,I){var J,G=w.state;return G.window===null&&(G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new a.Buf8(G.wsize)),I>=G.wsize?(a.arraySet(G.window,D,h-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize):(I<(J=G.wsize-G.wnext)&&(J=I),a.arraySet(G.window,D,h-I,J,G.wnext),(I-=J)?(a.arraySet(G.window,D,h-I,I,0),G.wnext=I,G.whave=G.wsize):(G.wnext+=J,G.wnext===G.wsize&&(G.wnext=0),G.whave<G.wsize&&(G.whave+=J))),0}u.inflateReset=R,u.inflateReset2=C,u.inflateResetKeep=E,u.inflateInit=function(w){return z(w,15)},u.inflateInit2=z,u.inflate=function(w,D){var h,I,J,G,tt,W,K,S,F,q,V,j,at,ot,et,rt,st,nt,ct,dt,i,P,U,y,g=0,T=new a.Buf8(4),N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!w||!w.state||!w.output||!w.input&&w.avail_in!==0)return p;(h=w.state).mode===12&&(h.mode=13),tt=w.next_out,J=w.output,K=w.avail_out,G=w.next_in,I=w.input,W=w.avail_in,S=h.hold,F=h.bits,q=W,V=K,P=A;t:for(;;)switch(h.mode){case c:if(h.wrap===0){h.mode=13;break}for(;F<16;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}if(2&h.wrap&&S===35615){T[h.check=0]=255&S,T[1]=S>>>8&255,h.check=o(h.check,T,2,0),F=S=0,h.mode=2;break}if(h.flags=0,h.head&&(h.head.done=!1),!(1&h.wrap)||(((255&S)<<8)+(S>>8))%31){w.msg="incorrect header check",h.mode=30;break}if((15&S)!=8){w.msg="unknown compression method",h.mode=30;break}if(F-=4,i=8+(15&(S>>>=4)),h.wbits===0)h.wbits=i;else if(i>h.wbits){w.msg="invalid window size",h.mode=30;break}h.dmax=1<<i,w.adler=h.check=1,h.mode=512&S?10:12,F=S=0;break;case 2:for(;F<16;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}if(h.flags=S,(255&h.flags)!=8){w.msg="unknown compression method",h.mode=30;break}if(57344&h.flags){w.msg="unknown header flags set",h.mode=30;break}h.head&&(h.head.text=S>>8&1),512&h.flags&&(T[0]=255&S,T[1]=S>>>8&255,h.check=o(h.check,T,2,0)),F=S=0,h.mode=3;case 3:for(;F<32;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}h.head&&(h.head.time=S),512&h.flags&&(T[0]=255&S,T[1]=S>>>8&255,T[2]=S>>>16&255,T[3]=S>>>24&255,h.check=o(h.check,T,4,0)),F=S=0,h.mode=4;case 4:for(;F<16;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}h.head&&(h.head.xflags=255&S,h.head.os=S>>8),512&h.flags&&(T[0]=255&S,T[1]=S>>>8&255,h.check=o(h.check,T,2,0)),F=S=0,h.mode=5;case 5:if(1024&h.flags){for(;F<16;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}h.length=S,h.head&&(h.head.extra_len=S),512&h.flags&&(T[0]=255&S,T[1]=S>>>8&255,h.check=o(h.check,T,2,0)),F=S=0}else h.head&&(h.head.extra=null);h.mode=6;case 6:if(1024&h.flags&&(W<(j=h.length)&&(j=W),j&&(h.head&&(i=h.head.extra_len-h.length,h.head.extra||(h.head.extra=new Array(h.head.extra_len)),a.arraySet(h.head.extra,I,G,j,i)),512&h.flags&&(h.check=o(h.check,I,j,G)),W-=j,G+=j,h.length-=j),h.length))break t;h.length=0,h.mode=7;case 7:if(2048&h.flags){if(W===0)break t;for(j=0;i=I[G+j++],h.head&&i&&h.length<65536&&(h.head.name+=String.fromCharCode(i)),i&&j<W;);if(512&h.flags&&(h.check=o(h.check,I,j,G)),W-=j,G+=j,i)break t}else h.head&&(h.head.name=null);h.length=0,h.mode=8;case 8:if(4096&h.flags){if(W===0)break t;for(j=0;i=I[G+j++],h.head&&i&&h.length<65536&&(h.head.comment+=String.fromCharCode(i)),i&&j<W;);if(512&h.flags&&(h.check=o(h.check,I,j,G)),W-=j,G+=j,i)break t}else h.head&&(h.head.comment=null);h.mode=9;case 9:if(512&h.flags){for(;F<16;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}if(S!==(65535&h.check)){w.msg="header crc mismatch",h.mode=30;break}F=S=0}h.head&&(h.head.hcrc=h.flags>>9&1,h.head.done=!0),w.adler=h.check=0,h.mode=12;break;case 10:for(;F<32;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}w.adler=h.check=l(S),F=S=0,h.mode=11;case 11:if(h.havedict===0)return w.next_out=tt,w.avail_out=K,w.next_in=G,w.avail_in=W,h.hold=S,h.bits=F,2;w.adler=h.check=1,h.mode=12;case 12:if(D===5||D===6)break t;case 13:if(h.last){S>>>=7&F,F-=7&F,h.mode=27;break}for(;F<3;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}switch(h.last=1&S,F-=1,3&(S>>>=1)){case 0:h.mode=14;break;case 1:if(M(h),h.mode=20,D!==6)break;S>>>=2,F-=2;break t;case 2:h.mode=17;break;case 3:w.msg="invalid block type",h.mode=30}S>>>=2,F-=2;break;case 14:for(S>>>=7&F,F-=7&F;F<32;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}if((65535&S)!=(S>>>16^65535)){w.msg="invalid stored block lengths",h.mode=30;break}if(h.length=65535&S,F=S=0,h.mode=15,D===6)break t;case 15:h.mode=16;case 16:if(j=h.length){if(W<j&&(j=W),K<j&&(j=K),j===0)break t;a.arraySet(J,I,G,j,tt),W-=j,G+=j,K-=j,tt+=j,h.length-=j;break}h.mode=12;break;case 17:for(;F<14;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}if(h.nlen=257+(31&S),S>>>=5,F-=5,h.ndist=1+(31&S),S>>>=5,F-=5,h.ncode=4+(15&S),S>>>=4,F-=4,286<h.nlen||30<h.ndist){w.msg="too many length or distance symbols",h.mode=30;break}h.have=0,h.mode=18;case 18:for(;h.have<h.ncode;){for(;F<3;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}h.lens[N[h.have++]]=7&S,S>>>=3,F-=3}for(;h.have<19;)h.lens[N[h.have++]]=0;if(h.lencode=h.lendyn,h.lenbits=7,U={bits:h.lenbits},P=b(0,h.lens,0,19,h.lencode,0,h.work,U),h.lenbits=U.bits,P){w.msg="invalid code lengths set",h.mode=30;break}h.have=0,h.mode=19;case 19:for(;h.have<h.nlen+h.ndist;){for(;rt=(g=h.lencode[S&(1<<h.lenbits)-1])>>>16&255,st=65535&g,!((et=g>>>24)<=F);){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}if(st<16)S>>>=et,F-=et,h.lens[h.have++]=st;else{if(st===16){for(y=et+2;F<y;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}if(S>>>=et,F-=et,h.have===0){w.msg="invalid bit length repeat",h.mode=30;break}i=h.lens[h.have-1],j=3+(3&S),S>>>=2,F-=2}else if(st===17){for(y=et+3;F<y;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}F-=et,i=0,j=3+(7&(S>>>=et)),S>>>=3,F-=3}else{for(y=et+7;F<y;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}F-=et,i=0,j=11+(127&(S>>>=et)),S>>>=7,F-=7}if(h.have+j>h.nlen+h.ndist){w.msg="invalid bit length repeat",h.mode=30;break}for(;j--;)h.lens[h.have++]=i}}if(h.mode===30)break;if(h.lens[256]===0){w.msg="invalid code -- missing end-of-block",h.mode=30;break}if(h.lenbits=9,U={bits:h.lenbits},P=b(x,h.lens,0,h.nlen,h.lencode,0,h.work,U),h.lenbits=U.bits,P){w.msg="invalid literal/lengths set",h.mode=30;break}if(h.distbits=6,h.distcode=h.distdyn,U={bits:h.distbits},P=b(_,h.lens,h.nlen,h.ndist,h.distcode,0,h.work,U),h.distbits=U.bits,P){w.msg="invalid distances set",h.mode=30;break}if(h.mode=20,D===6)break t;case 20:h.mode=21;case 21:if(6<=W&&258<=K){w.next_out=tt,w.avail_out=K,w.next_in=G,w.avail_in=W,h.hold=S,h.bits=F,n(w,V),tt=w.next_out,J=w.output,K=w.avail_out,G=w.next_in,I=w.input,W=w.avail_in,S=h.hold,F=h.bits,h.mode===12&&(h.back=-1);break}for(h.back=0;rt=(g=h.lencode[S&(1<<h.lenbits)-1])>>>16&255,st=65535&g,!((et=g>>>24)<=F);){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}if(rt&&!(240&rt)){for(nt=et,ct=rt,dt=st;rt=(g=h.lencode[dt+((S&(1<<nt+ct)-1)>>nt)])>>>16&255,st=65535&g,!(nt+(et=g>>>24)<=F);){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}S>>>=nt,F-=nt,h.back+=nt}if(S>>>=et,F-=et,h.back+=et,h.length=st,rt===0){h.mode=26;break}if(32&rt){h.back=-1,h.mode=12;break}if(64&rt){w.msg="invalid literal/length code",h.mode=30;break}h.extra=15&rt,h.mode=22;case 22:if(h.extra){for(y=h.extra;F<y;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}h.length+=S&(1<<h.extra)-1,S>>>=h.extra,F-=h.extra,h.back+=h.extra}h.was=h.length,h.mode=23;case 23:for(;rt=(g=h.distcode[S&(1<<h.distbits)-1])>>>16&255,st=65535&g,!((et=g>>>24)<=F);){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}if(!(240&rt)){for(nt=et,ct=rt,dt=st;rt=(g=h.distcode[dt+((S&(1<<nt+ct)-1)>>nt)])>>>16&255,st=65535&g,!(nt+(et=g>>>24)<=F);){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}S>>>=nt,F-=nt,h.back+=nt}if(S>>>=et,F-=et,h.back+=et,64&rt){w.msg="invalid distance code",h.mode=30;break}h.offset=st,h.extra=15&rt,h.mode=24;case 24:if(h.extra){for(y=h.extra;F<y;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}h.offset+=S&(1<<h.extra)-1,S>>>=h.extra,F-=h.extra,h.back+=h.extra}if(h.offset>h.dmax){w.msg="invalid distance too far back",h.mode=30;break}h.mode=25;case 25:if(K===0)break t;if(j=V-K,h.offset>j){if((j=h.offset-j)>h.whave&&h.sane){w.msg="invalid distance too far back",h.mode=30;break}at=j>h.wnext?(j-=h.wnext,h.wsize-j):h.wnext-j,j>h.length&&(j=h.length),ot=h.window}else ot=J,at=tt-h.offset,j=h.length;for(K<j&&(j=K),K-=j,h.length-=j;J[tt++]=ot[at++],--j;);h.length===0&&(h.mode=21);break;case 26:if(K===0)break t;J[tt++]=h.length,K--,h.mode=21;break;case 27:if(h.wrap){for(;F<32;){if(W===0)break t;W--,S|=I[G++]<<F,F+=8}if(V-=K,w.total_out+=V,h.total+=V,V&&(w.adler=h.check=h.flags?o(h.check,J,V,tt-V):f(h.check,J,V,tt-V)),V=K,(h.flags?S:l(S))!==h.check){w.msg="incorrect data check",h.mode=30;break}F=S=0}h.mode=28;case 28:if(h.wrap&&h.flags){for(;F<32;){if(W===0)break t;W--,S+=I[G++]<<F,F+=8}if(S!==(4294967295&h.total)){w.msg="incorrect length check",h.mode=30;break}F=S=0}h.mode=29;case 29:P=1;break t;case 30:P=-3;break t;case 31:return-4;case 32:default:return p}return w.next_out=tt,w.avail_out=K,w.next_in=G,w.avail_in=W,h.hold=S,h.bits=F,(h.wsize||V!==w.avail_out&&h.mode<30&&(h.mode<27||D!==4))&&$(w,w.output,w.next_out,V-w.avail_out)?(h.mode=31,-4):(q-=w.avail_in,V-=w.avail_out,w.total_in+=q,w.total_out+=V,h.total+=V,h.wrap&&V&&(w.adler=h.check=h.flags?o(h.check,J,V,w.next_out-V):f(h.check,J,V,w.next_out-V)),w.data_type=h.bits+(h.last?64:0)+(h.mode===12?128:0)+(h.mode===20||h.mode===15?256:0),(q==0&&V===0||D===4)&&P===A&&(P=-5),P)},u.inflateEnd=function(w){if(!w||!w.state)return p;var D=w.state;return D.window&&(D.window=null),w.state=null,A},u.inflateGetHeader=function(w,D){var h;return w&&w.state&&2&(h=w.state).wrap?((h.head=D).done=!1,A):p},u.inflateSetDictionary=function(w,D){var h,I=D.length;return w&&w.state?(h=w.state).wrap!==0&&h.mode!==11?p:h.mode===11&&f(1,D,I,0)!==h.check?-3:$(w,D,I,I)?(h.mode=31,-4):(h.havedict=1,A):p},u.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,r,u){var a=e("../utils/common"),f=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],n=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],b=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(x,_,A,p,c,s,d,l){var m,E,R,C,z,B,O,L,M,$=l.bits,w=0,D=0,h=0,I=0,J=0,G=0,tt=0,W=0,K=0,S=0,F=null,q=0,V=new a.Buf16(16),j=new a.Buf16(16),at=null,ot=0;for(w=0;w<=15;w++)V[w]=0;for(D=0;D<p;D++)V[_[A+D]]++;for(J=$,I=15;1<=I&&V[I]===0;I--);if(I<J&&(J=I),I===0)return c[s++]=20971520,c[s++]=20971520,l.bits=1,0;for(h=1;h<I&&V[h]===0;h++);for(J<h&&(J=h),w=W=1;w<=15;w++)if(W<<=1,(W-=V[w])<0)return-1;if(0<W&&(x===0||I!==1))return-1;for(j[1]=0,w=1;w<15;w++)j[w+1]=j[w]+V[w];for(D=0;D<p;D++)_[A+D]!==0&&(d[j[_[A+D]]++]=D);if(B=x===0?(F=at=d,19):x===1?(F=f,q-=257,at=o,ot-=257,256):(F=n,at=b,-1),w=h,z=s,tt=D=S=0,R=-1,C=(K=1<<(G=J))-1,x===1&&852<K||x===2&&592<K)return 1;for(;;){for(O=w-tt,M=d[D]<B?(L=0,d[D]):d[D]>B?(L=at[ot+d[D]],F[q+d[D]]):(L=96,0),m=1<<w-tt,h=E=1<<G;c[z+(S>>tt)+(E-=m)]=O<<24|L<<16|M|0,E!==0;);for(m=1<<w-1;S&m;)m>>=1;if(m!==0?(S&=m-1,S+=m):S=0,D++,--V[w]==0){if(w===I)break;w=_[A+d[D]]}if(J<w&&(S&C)!==R){for(tt===0&&(tt=J),z+=h,W=1<<(G=w-tt);G+tt<I&&!((W-=V[G+tt])<=0);)G++,W<<=1;if(K+=1<<G,x===1&&852<K||x===2&&592<K)return 1;c[R=S&C]=J<<24|G<<16|z-s|0}}return S!==0&&(c[z+S]=w-tt<<24|64<<16|0),l.bits=J,0}},{"../utils/common":41}],51:[function(e,r,u){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,r,u){var a=e("../utils/common"),f=0,o=1;function n(g){for(var T=g.length;0<=--T;)g[T]=0}var b=0,x=29,_=256,A=_+1+x,p=30,c=19,s=2*A+1,d=15,l=16,m=7,E=256,R=16,C=17,z=18,B=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],O=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],L=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],$=new Array(2*(A+2));n($);var w=new Array(2*p);n(w);var D=new Array(512);n(D);var h=new Array(256);n(h);var I=new Array(x);n(I);var J,G,tt,W=new Array(p);function K(g,T,N,X,k){this.static_tree=g,this.extra_bits=T,this.extra_base=N,this.elems=X,this.max_length=k,this.has_stree=g&&g.length}function S(g,T){this.dyn_tree=g,this.max_code=0,this.stat_desc=T}function F(g){return g<256?D[g]:D[256+(g>>>7)]}function q(g,T){g.pending_buf[g.pending++]=255&T,g.pending_buf[g.pending++]=T>>>8&255}function V(g,T,N){g.bi_valid>l-N?(g.bi_buf|=T<<g.bi_valid&65535,q(g,g.bi_buf),g.bi_buf=T>>l-g.bi_valid,g.bi_valid+=N-l):(g.bi_buf|=T<<g.bi_valid&65535,g.bi_valid+=N)}function j(g,T,N){V(g,N[2*T],N[2*T+1])}function at(g,T){for(var N=0;N|=1&g,g>>>=1,N<<=1,0<--T;);return N>>>1}function ot(g,T,N){var X,k,Y=new Array(d+1),H=0;for(X=1;X<=d;X++)Y[X]=H=H+N[X-1]<<1;for(k=0;k<=T;k++){var Z=g[2*k+1];Z!==0&&(g[2*k]=at(Y[Z]++,Z))}}function et(g){var T;for(T=0;T<A;T++)g.dyn_ltree[2*T]=0;for(T=0;T<p;T++)g.dyn_dtree[2*T]=0;for(T=0;T<c;T++)g.bl_tree[2*T]=0;g.dyn_ltree[2*E]=1,g.opt_len=g.static_len=0,g.last_lit=g.matches=0}function rt(g){8<g.bi_valid?q(g,g.bi_buf):0<g.bi_valid&&(g.pending_buf[g.pending++]=g.bi_buf),g.bi_buf=0,g.bi_valid=0}function st(g,T,N,X){var k=2*T,Y=2*N;return g[k]<g[Y]||g[k]===g[Y]&&X[T]<=X[N]}function nt(g,T,N){for(var X=g.heap[N],k=N<<1;k<=g.heap_len&&(k<g.heap_len&&st(T,g.heap[k+1],g.heap[k],g.depth)&&k++,!st(T,X,g.heap[k],g.depth));)g.heap[N]=g.heap[k],N=k,k<<=1;g.heap[N]=X}function ct(g,T,N){var X,k,Y,H,Z=0;if(g.last_lit!==0)for(;X=g.pending_buf[g.d_buf+2*Z]<<8|g.pending_buf[g.d_buf+2*Z+1],k=g.pending_buf[g.l_buf+Z],Z++,X===0?j(g,k,T):(j(g,(Y=h[k])+_+1,T),(H=B[Y])!==0&&V(g,k-=I[Y],H),j(g,Y=F(--X),N),(H=O[Y])!==0&&V(g,X-=W[Y],H)),Z<g.last_lit;);j(g,E,T)}function dt(g,T){var N,X,k,Y=T.dyn_tree,H=T.stat_desc.static_tree,Z=T.stat_desc.has_stree,Q=T.stat_desc.elems,ht=-1;for(g.heap_len=0,g.heap_max=s,N=0;N<Q;N++)Y[2*N]!==0?(g.heap[++g.heap_len]=ht=N,g.depth[N]=0):Y[2*N+1]=0;for(;g.heap_len<2;)Y[2*(k=g.heap[++g.heap_len]=ht<2?++ht:0)]=1,g.depth[k]=0,g.opt_len--,Z&&(g.static_len-=H[2*k+1]);for(T.max_code=ht,N=g.heap_len>>1;1<=N;N--)nt(g,Y,N);for(k=Q;N=g.heap[1],g.heap[1]=g.heap[g.heap_len--],nt(g,Y,1),X=g.heap[1],g.heap[--g.heap_max]=N,g.heap[--g.heap_max]=X,Y[2*k]=Y[2*N]+Y[2*X],g.depth[k]=(g.depth[N]>=g.depth[X]?g.depth[N]:g.depth[X])+1,Y[2*N+1]=Y[2*X+1]=k,g.heap[1]=k++,nt(g,Y,1),2<=g.heap_len;);g.heap[--g.heap_max]=g.heap[1],function(it,mt){var At,_t,wt,lt,Rt,Ft,gt=mt.dyn_tree,Dt=mt.max_code,Nt=mt.stat_desc.static_tree,Gt=mt.stat_desc.has_stree,Xt=mt.stat_desc.extra_bits,Ut=mt.stat_desc.extra_base,Et=mt.stat_desc.max_length,Ct=0;for(lt=0;lt<=d;lt++)it.bl_count[lt]=0;for(gt[2*it.heap[it.heap_max]+1]=0,At=it.heap_max+1;At<s;At++)Et<(lt=gt[2*gt[2*(_t=it.heap[At])+1]+1]+1)&&(lt=Et,Ct++),gt[2*_t+1]=lt,Dt<_t||(it.bl_count[lt]++,Rt=0,Ut<=_t&&(Rt=Xt[_t-Ut]),Ft=gt[2*_t],it.opt_len+=Ft*(lt+Rt),Gt&&(it.static_len+=Ft*(Nt[2*_t+1]+Rt)));if(Ct!==0){do{for(lt=Et-1;it.bl_count[lt]===0;)lt--;it.bl_count[lt]--,it.bl_count[lt+1]+=2,it.bl_count[Et]--,Ct-=2}while(0<Ct);for(lt=Et;lt!==0;lt--)for(_t=it.bl_count[lt];_t!==0;)Dt<(wt=it.heap[--At])||(gt[2*wt+1]!==lt&&(it.opt_len+=(lt-gt[2*wt+1])*gt[2*wt],gt[2*wt+1]=lt),_t--)}}(g,T),ot(Y,ht,g.bl_count)}function i(g,T,N){var X,k,Y=-1,H=T[1],Z=0,Q=7,ht=4;for(H===0&&(Q=138,ht=3),T[2*(N+1)+1]=65535,X=0;X<=N;X++)k=H,H=T[2*(X+1)+1],++Z<Q&&k===H||(Z<ht?g.bl_tree[2*k]+=Z:k!==0?(k!==Y&&g.bl_tree[2*k]++,g.bl_tree[2*R]++):Z<=10?g.bl_tree[2*C]++:g.bl_tree[2*z]++,Y=k,ht=(Z=0)===H?(Q=138,3):k===H?(Q=6,3):(Q=7,4))}function P(g,T,N){var X,k,Y=-1,H=T[1],Z=0,Q=7,ht=4;for(H===0&&(Q=138,ht=3),X=0;X<=N;X++)if(k=H,H=T[2*(X+1)+1],!(++Z<Q&&k===H)){if(Z<ht)for(;j(g,k,g.bl_tree),--Z!=0;);else k!==0?(k!==Y&&(j(g,k,g.bl_tree),Z--),j(g,R,g.bl_tree),V(g,Z-3,2)):Z<=10?(j(g,C,g.bl_tree),V(g,Z-3,3)):(j(g,z,g.bl_tree),V(g,Z-11,7));Y=k,ht=(Z=0)===H?(Q=138,3):k===H?(Q=6,3):(Q=7,4)}}n(W);var U=!1;function y(g,T,N,X){V(g,(b<<1)+(X?1:0),3),function(k,Y,H,Z){rt(k),q(k,H),q(k,~H),a.arraySet(k.pending_buf,k.window,Y,H,k.pending),k.pending+=H}(g,T,N)}u._tr_init=function(g){U||(function(){var T,N,X,k,Y,H=new Array(d+1);for(k=X=0;k<x-1;k++)for(I[k]=X,T=0;T<1<<B[k];T++)h[X++]=k;for(h[X-1]=k,k=Y=0;k<16;k++)for(W[k]=Y,T=0;T<1<<O[k];T++)D[Y++]=k;for(Y>>=7;k<p;k++)for(W[k]=Y<<7,T=0;T<1<<O[k]-7;T++)D[256+Y++]=k;for(N=0;N<=d;N++)H[N]=0;for(T=0;T<=143;)$[2*T+1]=8,T++,H[8]++;for(;T<=255;)$[2*T+1]=9,T++,H[9]++;for(;T<=279;)$[2*T+1]=7,T++,H[7]++;for(;T<=287;)$[2*T+1]=8,T++,H[8]++;for(ot($,A+1,H),T=0;T<p;T++)w[2*T+1]=5,w[2*T]=at(T,5);J=new K($,B,_+1,A,d),G=new K(w,O,0,p,d),tt=new K(new Array(0),L,0,c,m)}(),U=!0),g.l_desc=new S(g.dyn_ltree,J),g.d_desc=new S(g.dyn_dtree,G),g.bl_desc=new S(g.bl_tree,tt),g.bi_buf=0,g.bi_valid=0,et(g)},u._tr_stored_block=y,u._tr_flush_block=function(g,T,N,X){var k,Y,H=0;0<g.level?(g.strm.data_type===2&&(g.strm.data_type=function(Z){var Q,ht=4093624447;for(Q=0;Q<=31;Q++,ht>>>=1)if(1&ht&&Z.dyn_ltree[2*Q]!==0)return f;if(Z.dyn_ltree[18]!==0||Z.dyn_ltree[20]!==0||Z.dyn_ltree[26]!==0)return o;for(Q=32;Q<_;Q++)if(Z.dyn_ltree[2*Q]!==0)return o;return f}(g)),dt(g,g.l_desc),dt(g,g.d_desc),H=function(Z){var Q;for(i(Z,Z.dyn_ltree,Z.l_desc.max_code),i(Z,Z.dyn_dtree,Z.d_desc.max_code),dt(Z,Z.bl_desc),Q=c-1;3<=Q&&Z.bl_tree[2*M[Q]+1]===0;Q--);return Z.opt_len+=3*(Q+1)+5+5+4,Q}(g),k=g.opt_len+3+7>>>3,(Y=g.static_len+3+7>>>3)<=k&&(k=Y)):k=Y=N+5,N+4<=k&&T!==-1?y(g,T,N,X):g.strategy===4||Y===k?(V(g,2+(X?1:0),3),ct(g,$,w)):(V(g,4+(X?1:0),3),function(Z,Q,ht,it){var mt;for(V(Z,Q-257,5),V(Z,ht-1,5),V(Z,it-4,4),mt=0;mt<it;mt++)V(Z,Z.bl_tree[2*M[mt]+1],3);P(Z,Z.dyn_ltree,Q-1),P(Z,Z.dyn_dtree,ht-1)}(g,g.l_desc.max_code+1,g.d_desc.max_code+1,H+1),ct(g,g.dyn_ltree,g.dyn_dtree)),et(g),X&&rt(g)},u._tr_tally=function(g,T,N){return g.pending_buf[g.d_buf+2*g.last_lit]=T>>>8&255,g.pending_buf[g.d_buf+2*g.last_lit+1]=255&T,g.pending_buf[g.l_buf+g.last_lit]=255&N,g.last_lit++,T===0?g.dyn_ltree[2*N]++:(g.matches++,T--,g.dyn_ltree[2*(h[N]+_+1)]++,g.dyn_dtree[2*F(T)]++),g.last_lit===g.lit_bufsize-1},u._tr_align=function(g){V(g,2,3),j(g,E,$),function(T){T.bi_valid===16?(q(T,T.bi_buf),T.bi_buf=0,T.bi_valid=0):8<=T.bi_valid&&(T.pending_buf[T.pending++]=255&T.bi_buf,T.bi_buf>>=8,T.bi_valid-=8)}(g)}},{"../utils/common":41}],53:[function(e,r,u){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,r,u){(function(a){(function(f,o){if(!f.setImmediate){var n,b,x,_,A=1,p={},c=!1,s=f.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(f);d=d&&d.setTimeout?d:f,n={}.toString.call(f.process)==="[object process]"?function(R){process.nextTick(function(){m(R)})}:function(){if(f.postMessage&&!f.importScripts){var R=!0,C=f.onmessage;return f.onmessage=function(){R=!1},f.postMessage("","*"),f.onmessage=C,R}}()?(_="setImmediate$"+Math.random()+"$",f.addEventListener?f.addEventListener("message",E,!1):f.attachEvent("onmessage",E),function(R){f.postMessage(_+R,"*")}):f.MessageChannel?((x=new MessageChannel).port1.onmessage=function(R){m(R.data)},function(R){x.port2.postMessage(R)}):s&&"onreadystatechange"in s.createElement("script")?(b=s.documentElement,function(R){var C=s.createElement("script");C.onreadystatechange=function(){m(R),C.onreadystatechange=null,b.removeChild(C),C=null},b.appendChild(C)}):function(R){setTimeout(m,0,R)},d.setImmediate=function(R){typeof R!="function"&&(R=new Function(""+R));for(var C=new Array(arguments.length-1),z=0;z<C.length;z++)C[z]=arguments[z+1];var B={callback:R,args:C};return p[A]=B,n(A),A++},d.clearImmediate=l}function l(R){delete p[R]}function m(R){if(c)setTimeout(m,0,R);else{var C=p[R];if(C){c=!0;try{(function(z){var B=z.callback,O=z.args;switch(O.length){case 0:B();break;case 1:B(O[0]);break;case 2:B(O[0],O[1]);break;case 3:B(O[0],O[1],O[2]);break;default:B.apply(o,O)}})(C)}finally{l(R),c=!1}}}}function E(R){R.source===f&&typeof R.data=="string"&&R.data.indexOf(_)===0&&m(+R.data.slice(_.length))}})(typeof self>"u"?a===void 0?this:a:self)}).call(this,typeof Tt<"u"?Tt:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Mt);var pe=Mt.exports;const me=de(pe);async function _e(v,t=void 0){let e=await fetch(v);e.headers.get("Content-Length");let r=await e.arrayBuffer();return ve(r,ge(v))}async function ve(v,t=void 0){var _,A,p,c;let e=new Uint8Array(v);if(console.log("firstByte:",e[0]),e[0]!=80){let s=xe(t);console.log("key=",t),console.log("keyBuf=",s);let d=0;for(var r=0;r<e.length;r++)d=d%s.length,e[r]=e[r]^s[d],d++}console.log("firstByte:",e[0],"length=",e.length);let u=new me;await u.loadAsync(e);let a=Object.keys(u.files);for(var f,o,n,b,x,r=0;r<a.length;r++){let d=a[r];if(!d.startsWith("__MACOSX")){if(console.log("file=",d),d.startsWith("map")){let l=await((_=u.file(d))==null?void 0:_.async("base64"));f=await St("image/png",l)}else if(d.startsWith("page")){let l=await((A=u.file(d))==null?void 0:A.async("base64"));o=await St("image/png",l)}else if(d.startsWith("special")){let l=await((p=u.file(d))==null?void 0:p.async("base64")),m=d.endsWith("png")?"image/png":"image/jpeg";b=await St(m,l)}else if(d.endsWith("json")){let l=await((c=u.file(d))==null?void 0:c.async("string"));n=JSON.parse(l)}}}return console.log("config:",n),x=await Vt("/assets/fonts/numbers_roboto_500.png"),new ae(n,o,f,x,[],b)}async function St(v,t){return new Promise((e,r)=>{let u=new Image;u.src=`data:${v};base64, ${t}`,u.onload=()=>{e(u)},u.onerror=r})}function ge(v){let e=/[0-9a-z]{24}/i.exec(v);if(e!=null)return e[0]}function xe(v){for(var t=new ArrayBuffer(v.length*2),e=new Uint16Array(t),r=0,u=v.length;r<u;r++)e[r]=v.charCodeAt(r);return e}class be extends bt{constructor(t,e,r,u){super(),this.scene=t,this.image=e,this.fillerData=r,this.bestFitScale=u,this.vertexShaderCode=`
- attribute vec2 a_position;
- attribute vec2 a_texCoord;
- uniform mat4 u_matrix;
- varying vec2 v_texCoord;
- void main() {
- gl_Position = u_matrix * vec4(a_position, 0, 1);
- v_texCoord = a_texCoord;
- }
- `,this.fragmentShaderCode=`
- precision mediump float;
- uniform sampler2D u_image;
- varying vec2 v_texCoord;
- void main() {
- vec4 color = texture2D(u_image, v_texCoord);
- gl_FragColor = color;
- }
-
- `;const a=t.gl;this.program=vt(a,ft(a,a.VERTEX_SHADER,this.vertexShaderCode),ft(a,a.FRAGMENT_SHADER,this.fragmentShaderCode)),this.aPositionLoc=a.getAttribLocation(this.program,"a_position"),this.aTexcoordLoc=a.getAttribLocation(this.program,"a_texCoord"),this.uMatrixLoc=a.getUniformLocation(this.program,"u_matrix"),this.uScaleLoc=a.getUniformLocation(this.program,"u_scale"),this.uTexSizeLoc=a.getUniformLocation(this.program,"u_texSize"),this.texture=Lt(a,e,a.LINEAR);const f=[],o=e.width/10/e.height,n=Array(4);for(var b=0;b<4;b++)n[b]=2/Math.sqrt(b*b*o*o+1);const x=1.2,_=.8;var A=0;const p=r.config,c=r.data.areaGroups;for(var b=0;b<c.length;b++)for(var s=c[b],d=0;d<s.areas.length;d++){var l=s.areas[d];if(!l.colored){A+=l.center.label.length,f.push(l.center);var m=l.center.radius*n[l.center.label.length],E=m*p.maxScale/p.visibleFontSize;E<=1?E*=x:E>1&&E<1/_?E=(1/_-x)/(1/_-1)*(E-1)+x:E>=1/_&&(E=_*E+(1/_-1)),m=E*p.visibleFontSize/p.maxScale,m*this.bestFitScale>p.visibleFontSize*1.2&&(m=p.visibleFontSize*1.2/u),l.center.fontHeight=m}}f.sort((z,B)=>B.fontHeight-z.fontHeight),this.digits=A,this.centers=f,this.vertexArray=new Float32Array(A*12),this.texCoordArray=new Float32Array(A*12);for(var R=0,b=0;b<f.length;b++){var C=f[b];this.fillVertexArray(this.vertexArray,this.texCoordArray,R,C,o),R+=12*C.label.length,C.offset=R/2}this.vertexBuffer=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bufferData(a.ARRAY_BUFFER,this.vertexArray,a.STATIC_DRAW),this.texcoordBuffer=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,this.texcoordBuffer),a.bufferData(a.ARRAY_BUFFER,this.texCoordArray,a.STATIC_DRAW)}dispose(){let t=this.scene.gl;t.deleteProgram(this.program),t.deleteBuffer(this.vertexBuffer),t.deleteBuffer(this.texcoordBuffer),t.deleteTexture(this.texture)}draw(){var t=0;const e=this.fillerData.config.maxScale-.2,r=this.scene.userMat[0];if(r>e)t=this.vertexArray.length/2;else for(var u=this.centers.length-1;u>=0;u--)if(this.centers[u].fontHeight*r>this.fillerData.config.visibleFontSize){t=this.centers[u].offset;break}const a=this.scene.gl;a.useProgram(this.program),a.enableVertexAttribArray(this.aPositionLoc),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.vertexAttribPointer(this.aPositionLoc,2,a.FLOAT,!1,0,0),a.enableVertexAttribArray(this.aTexcoordLoc),a.bindBuffer(a.ARRAY_BUFFER,this.texcoordBuffer),a.vertexAttribPointer(this.aTexcoordLoc,2,a.FLOAT,!1,0,0),a.uniformMatrix4fv(this.uMatrixLoc,!1,this.scene.drawMatrix),a.uniform1f(this.uScaleLoc,this.scene.userMat[0]),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this.texture),a.drawArrays(a.TRIANGLES,0,t)}fillVertexArray(t,e,r,u,a){const f=u.label,o=f.length,n=u.fontHeight*a,b=u.fontHeight,x=n*o,_=u.x-x/2,A=u.y-b/2;for(var p=0;p<o;p++){pt(t,r+12*p,_+p*n,A,n,b);const c=parseInt(f.substring(p,p+1));pt(e,r+12*p,c*.1,0,.1,1)}}toString(){return"NumberLayer()"}}class ye{constructor(t,e,r,u){this.area=t,this.x=e,this.y=r,this.progress=u}}class Ae{constructor(t,e){this.scene=t,this.fillerData=e,this.vertexShaderCode=`
- attribute vec2 a_position;
- attribute vec2 a_texCoord;
-
- attribute vec4 a_areaId;
- attribute vec2 a_center;
- attribute float a_progress;
- attribute float a_maxRadius;
-
- uniform mat4 u_matrix;
-
- varying vec4 v_areaId;
- varying vec2 v_center;
- varying float v_progress;
- varying float v_maxRadius;
- varying vec2 v_texCoord;
- varying vec2 v_position;
- void main() {
- gl_Position = u_matrix * vec4(a_position, 0, 1);
- v_areaId = a_areaId;
- v_center = a_center;
- v_progress = a_progress;
- v_maxRadius = a_maxRadius;
- v_texCoord = a_texCoord;
- v_position = a_position;
-
- }
- `,this.fragmentShaderCode=`
- precision mediump float;
- uniform sampler2D u_map;
- //uniform sampler2D u_colored;
- //uniform sampler2D u_mask;
- varying vec4 v_areaId;
- varying vec2 v_center;
- varying float v_progress;
- varying float v_maxRadius;
- varying vec2 v_texCoord;
- varying vec2 v_position;
-
- void main() {
- vec4 map = texture2D(u_map, v_texCoord);
- float dist = distance(map, v_areaId);
- /*
- if(dist < 0.001) {
- if(v_progress >= 1.0 ) {
- gl_FragColor = vec4(1, 1, 0, 1);
- }else{
- float dist2 = distance(v_position, v_center);
- if(dist2 < v_maxRadius * v_progress) {
- gl_FragColor = vec4(1, 1, 0, 1);
- }else{
- gl_FragColor = vec4(0, 0, 0, 0);
- }
- }
- }else{
- gl_FragColor = vec4(0, 0, 0, 0);
- }
- */
- //gl_FragColor = vec4(1, 1, 0, 1);
- //gl_FragColor = map;
- vec4 colored = vec4(1, 1, 0, 1);
-
- if(dist < 0.001) {
- if( v_progress < 1.0 ) {
- float dist2 = distance(v_position, v_center);
- float r = v_maxRadius * v_progress + 0.001;
- if(dist2 < r) {
- float f = dist2 / r;
- if(f < v_progress) {
- gl_FragColor = colored;
- }else if(v_progress < 1.0){
- float a = (f - 1.0) / (v_progress - 1.0);
- gl_FragColor = vec4(colored.xyz, a);
- }else{
- gl_FragColor = colored;
- }
- }else {
- gl_FragColor = vec4(0,0,0,0);
- }
- }else{
- gl_FragColor = colored;
- }
- }else{
- gl_FragColor = vec4(0, 0, 0, 0);
- }
- }
-
- `,this.animatingAreas=[];const r=t.gl;this.program=vt(r,ft(r,r.VERTEX_SHADER,this.vertexShaderCode),ft(r,r.FRAGMENT_SHADER,this.fragmentShaderCode)),this.aPositionLoc=r.getAttribLocation(this.program,"a_position"),this.aTexcoordLoc=r.getAttribLocation(this.program,"a_texCoord"),this.aAreaIdLoc=r.getAttribLocation(this.program,"a_areaId"),this.aCenterLoc=r.getAttribLocation(this.program,"a_center"),this.aProgressLoc=r.getAttribLocation(this.program,"a_progress"),this.aMaxRadiusLoc=r.getAttribLocation(this.program,"a_maxRadius"),this.uMatrixLoc=r.getUniformLocation(this.program,"u_matrix"),this.maxCount=e.data.maxAreaCountOfGroup,this.positionBuffer=r.createBuffer(),this.texCoordBuffer=r.createBuffer(),this.areaIdBuffer=r.createBuffer(),this.centerBuffer=r.createBuffer(),this.progressBuffer=r.createBuffer(),this.maxRadiusBuffer=r.createBuffer(),this.matrix=ut.projectionNoflipY(e.width,e.height),this.texture=r.createTexture(),r.bindTexture(r.TEXTURE_2D,this.texture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,this.fillerData.width,this.fillerData.height,0,r.RGBA,r.UNSIGNED_BYTE,null),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),this.fb=r.createFramebuffer(),r.bindFramebuffer(r.FRAMEBUFFER,this.fb),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,this.texture,0),r.bindFramebuffer(r.FRAMEBUFFER,null),this.positionArray=new Float32Array(this.maxCount*12),this.texCoordArray=new Float32Array(this.maxCount*12),this.areaIdArray=new Float32Array(this.maxCount*24),this.centerArray=new Float32Array(this.maxCount*12),this.progressArray=new Float32Array(this.maxCount*6),this.maxRadiusArray=new Float32Array(this.maxCount*6)}dispose(){let t=this.scene.gl;t.deleteBuffer(this.positionBuffer),t.deleteBuffer(this.texCoordBuffer),t.deleteBuffer(this.areaIdBuffer),t.deleteBuffer(this.centerBuffer),t.deleteBuffer(this.progressBuffer),t.deleteBuffer(this.maxRadiusBuffer),t.deleteProgram(this.program)}get width(){return this.fillerData.width}get height(){return this.fillerData.height}addArea(t,e,r){let u=new ye(t,e,r,0),a=new It(800,()=>{u.progress=a.value()},()=>{});this.scene.addAnimator(a),this.animatingAreas.push(u)}fillPoint(t,e,r,u,a){for(var f=0;f<a;f++)t[e+f*2]=r,t[e+f*2+1]=u}fillNumber(t,e,r,u){for(var a=0;a<u;a++)t[e+a]=r}flush(){if(this.animatingAreas.length<=0)return;var t=0,e=0,r=0;const u=this.fillerData.width,a=this.fillerData.height;for(var f=0;f<this.animatingAreas.length;f++){var o=this.animatingAreas[f],n=o.area;pt(this.positionArray,t,n.rect.x,n.rect.y,n.rect.width,n.rect.height),pt(this.texCoordArray,t,n.rect.x/u,n.rect.y/a,n.rect.width/u,n.rect.height/a),this.fillPoint(this.centerArray,t,o.x,o.y,6);var b=new xt(n.id);b.fillFloatArray(this.areaIdArray,e,6);var x=Yt(n.rect,o.x,o.y);console.log("rect=",n.rect,x,o.x,o.y),this.fillNumber(this.progressArray,r,o.progress,6),this.fillNumber(this.maxRadiusArray,r,x,6),t+=12,e+=24,r+=6}const _=this.scene.gl;_.bindBuffer(_.ARRAY_BUFFER,this.positionBuffer),_.bufferData(_.ARRAY_BUFFER,this.positionArray,_.STATIC_DRAW),_.bindBuffer(_.ARRAY_BUFFER,this.texCoordBuffer),_.bufferData(_.ARRAY_BUFFER,this.texCoordArray,_.STATIC_DRAW),_.bindBuffer(_.ARRAY_BUFFER,this.areaIdBuffer),_.bufferData(_.ARRAY_BUFFER,this.areaIdArray,_.STATIC_DRAW),_.bindBuffer(_.ARRAY_BUFFER,this.centerBuffer),_.bufferData(_.ARRAY_BUFFER,this.centerArray,_.STATIC_DRAW),_.bindBuffer(_.ARRAY_BUFFER,this.progressBuffer),_.bufferData(_.ARRAY_BUFFER,this.progressArray,_.STATIC_DRAW),_.bindBuffer(_.ARRAY_BUFFER,this.maxRadiusBuffer),_.bufferData(_.ARRAY_BUFFER,this.maxRadiusArray,_.STATIC_DRAW),this.draw(this.animatingAreas.length*6),this.animatingAreas=this.animatingAreas.filter(A=>A.progress<1)}draw(t){const e=this.scene.gl;e.bindFramebuffer(e.FRAMEBUFFER,this.fb),e.useProgram(this.program),e.viewport(0,0,this.fillerData.width,this.fillerData.height),e.enableVertexAttribArray(this.aPositionLoc),e.bindBuffer(e.ARRAY_BUFFER,this.positionBuffer),e.vertexAttribPointer(this.aPositionLoc,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(this.aTexcoordLoc),e.bindBuffer(e.ARRAY_BUFFER,this.texCoordBuffer),e.vertexAttribPointer(this.aTexcoordLoc,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(this.aAreaIdLoc),e.bindBuffer(e.ARRAY_BUFFER,this.areaIdBuffer),e.vertexAttribPointer(this.aAreaIdLoc,4,e.FLOAT,!1,0,0),e.enableVertexAttribArray(this.aCenterLoc),e.bindBuffer(e.ARRAY_BUFFER,this.centerBuffer),e.vertexAttribPointer(this.aCenterLoc,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(this.aProgressLoc),e.bindBuffer(e.ARRAY_BUFFER,this.progressBuffer),e.vertexAttribPointer(this.aProgressLoc,1,e.FLOAT,!1,0,0),e.enableVertexAttribArray(this.aMaxRadiusLoc),e.bindBuffer(e.ARRAY_BUFFER,this.maxRadiusBuffer),e.vertexAttribPointer(this.aMaxRadiusLoc,1,e.FLOAT,!1,0,0),e.uniformMatrix4fv(this.uMatrixLoc,!1,this.matrix),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this.fillerData.mapTexure),e.drawArrays(e.TRIANGLES,0,t),e.bindFramebuffer(e.FRAMEBUFFER,null)}}class we extends bt{constructor(t,e){super(),this.scene=t,this.fillerData=e,this.vertexShaderCode=`
- attribute vec2 a_position;
- attribute vec2 a_texCoord;
- uniform mat4 u_matrix;
- varying vec2 v_texCoord;
- void main() {
- gl_Position = u_matrix * vec4(a_position, 0, 1);
- v_texCoord = a_texCoord;
- }
- `,this.fragmentShaderCode=`
- precision mediump float;
- uniform sampler2D u_colored;
- uniform sampler2D u_mask;
- uniform vec2 u_pixelSize;
- varying vec2 v_texCoord;
- const float w1 = 0.147761;
- const float w2 = 0.118318;
- const float w3 = 0.0947416;
-
-
- vec4 GaussianBlur(in sampler2D image, in vec2 texCoord, in vec2 pixelSize) {
- vec4 C00 = texture2D(image, texCoord + vec2(-pixelSize.x, -pixelSize.y)) * w3 ;
- vec4 C01 = texture2D(image, texCoord + vec2(0.0, -pixelSize.y)) * w2;
- vec4 C02 = texture2D(image, texCoord + vec2(pixelSize.x, -pixelSize.y)) * w3 ;
-
- vec4 C10 = texture2D(image, texCoord + vec2(-pixelSize.x, 0.0)) * w2;
- vec4 C11 = texture2D(image, texCoord + vec2(0.0, 0.0)) * w1;
- vec4 C12 = texture2D(image, texCoord + vec2(pixelSize.x, 0.0)) * w2;
-
- vec4 C20 = texture2D(image, texCoord + vec2(-pixelSize.x, pixelSize.y)) * w3;
- vec4 C21 = texture2D(image, texCoord + vec2(0.0, pixelSize.y)) * w2;
- vec4 C22 = texture2D(image, texCoord + vec2(pixelSize.x, pixelSize.y)) * w3;
-
- return
- C00 + C01 + C02 +
- C10 + C11 + C12 +
- C20 + C21 + C22 ;
- }
-
- vec4 GaussianBlurR(in sampler2D image, in vec2 texCoord, in vec2 pixelSize) {
- vec4 C00 = texture2D(image, texCoord + vec2(-pixelSize.x, -pixelSize.y)) * w3 ;
- vec4 C01 = texture2D(image, texCoord + vec2(0.0, -pixelSize.y)) * w2;
- vec4 C02 = texture2D(image, texCoord + vec2(pixelSize.x, -pixelSize.y)) * w3 ;
-
- vec4 C10 = texture2D(image, texCoord + vec2(-pixelSize.x, 0.0)) * w2;
- vec4 C11 = texture2D(image, texCoord + vec2(0.0, 0.0)) * w1;
- vec4 C12 = texture2D(image, texCoord + vec2(pixelSize.x, 0.0)) * w2;
-
- vec4 C20 = texture2D(image, texCoord + vec2(-pixelSize.x, pixelSize.y)) * w3;
- vec4 C21 = texture2D(image, texCoord + vec2(0.0, pixelSize.y)) * w2;
- vec4 C22 = texture2D(image, texCoord + vec2(pixelSize.x, pixelSize.y)) * w3;
- vec4 g =
- C00 + C01 + C02 +
- C10 + C11 + C12 +
- C20 + C21 + C22 ;
- return g;
- }
-
- void main() {
- vec4 mask = GaussianBlurR(u_mask, v_texCoord, u_pixelSize);
- vec4 colored = GaussianBlur(u_colored, v_texCoord, u_pixelSize);
- //vec4 colored = texture2D(u_colored, v_texCoord);
- //gl_FragColor = vec4(colored.rgb, mask.a);
- if(mask.r >= 0.4) {
- gl_FragColor = vec4(colored.rgb, 1);
- //gl_FragColor = colored;
- }else{
- gl_FragColor = vec4(0, 0, 0, 0);
- }
- }
-
- `,this.animatableMask=new Ae(t,e);const r=t.gl;this.program=vt(r,ft(r,r.VERTEX_SHADER,this.vertexShaderCode),ft(r,r.FRAGMENT_SHADER,this.fragmentShaderCode)),this.aPositionLoc=r.getAttribLocation(this.program,"a_position"),this.aTexcoordLoc=r.getAttribLocation(this.program,"a_texCoord"),this.uMatrixLoc=r.getUniformLocation(this.program,"u_matrix"),this.uMaskLoc=r.getUniformLocation(this.program,"u_mask"),this.uColoredLoc=r.getUniformLocation(this.program,"u_colored"),this.uPixelSizeLoc=r.getUniformLocation(this.program,"u_pixelSize"),this.positionBuffer=zt(r,0,0,e.width,e.height),this.texCoordBuffer=zt(r,0,0,1,1)}dispose(){let t=this.scene.gl;this.animatableMask.dispose(),t.deleteProgram(this.program),t.deleteBuffer(this.positionBuffer),t.deleteBuffer(this.texCoordBuffer)}initTask(){let t=this.fillerData,e=t.taskList;for(let r of e){let u=t.data.areaHash.get(r.id);u&&this.animatableMask.addArea(u,u.center.x,u.center.y)}this.animatableMask.flush(),this.scene.invalidate()}draw(){console.log("WorkLayer draw()");const t=this.scene.gl;t.useProgram(this.program),t.enableVertexAttribArray(this.aPositionLoc),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.vertexAttribPointer(this.aPositionLoc,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(this.aTexcoordLoc),t.bindBuffer(t.ARRAY_BUFFER,this.texCoordBuffer),t.vertexAttribPointer(this.aTexcoordLoc,2,t.FLOAT,!1,0,0),t.uniformMatrix4fv(this.uMatrixLoc,!1,this.scene.drawMatrix),t.uniform2f(this.uPixelSizeLoc,1/this.fillerData.width,1/this.fillerData.height),t.uniform1i(this.uMaskLoc,0),t.uniform1i(this.uColoredLoc,1),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.animatableMask.texture),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this.fillerData.colored),t.drawArrays(t.TRIANGLES,0,6)}preDraw(){this.animatableMask.flush()}tap(t,e,r,u){var n;let a=this.fillerData;if(a.currentGroup==null){(n=a.callback)==null||n.onFillFailed();return}const f=a.data.groupAreaHash(a.currentGroup);let o=this.fillerData.getArea(t,e,50,f);o!=null&&(this.animatableMask.addArea(o,t,e),a.setColored(o,a.currentGroup.color,t,e),a.currentGroup.isAllColored&&a.switchToNextGroup())}}document.body.onload=function(){let v=window.location.href,t=v.substring(0,v.substring(7).indexOf("/")+7),e=v.substring(v.lastIndexOf("/"));console.log("id:",e),Ee(`${t}/proxy/zips/v2/number_mini/1501${e}.zip`)};async function Ee(v){var _,A,p;let t=document.querySelector("#canvas"),e=t.getContext("webgl2",{premultipliedAlpha:!1}),r=window.devicePixelRatio;t.width=t.clientWidth*r,t.height=t.clientHeight*r;let u=new oe(e,r);window.addEventListener("resize",()=>u.updateViewport()),(_=document.querySelector("#toggleTestLayer"))==null||_.addEventListener("click",()=>u.toggleTestLayer()),(A=document.querySelector("#reduction"))==null||A.addEventListener("click",()=>u.resetToBestFit()),(p=document.querySelector("#hint"))==null||p.addEventListener("click",()=>u.hint());let a=await _e(v),f=[],o=new se(new ne,a,e,f);u.fillerData=o,console.log("resource",a),u.setContentPadding(new Pt(50,100,50,100));let n=o.width,b=o.height;u.setContentSize(n,b),a.bg&&u.addLayer(new qt(u,a.bg,u.width,u.height,Ot.Repeat)),u.addLayer(new re(u,0,0,n,b)),u.addLayer(new ue(u,o)),u.addLayer(new be(u,a.numberImage,o,1));let x=new we(u,o);u.addLayer(x),u.addLayer(new fe(u,a.page,n,b)),u.addLayer(new ee(u,0,0,o.width,o.height,4280427042)),Re(o),Ce()}function Re(v){let t=v.data.areaGroups,e=[],r=[],u=[],a,f;for(var o=0;o<t.length;o++)a=t[o],f=new xt(a.color),a.isAllColored?(r.push(`<div class="color-btn" style="background-color:${f.css()}" onclick="selectColor(this, event, ${o})">`),r.push(`${o+1}`),r.push("</div>")):(e.push(`<div class="color-btn" style="background-color:${f.css()}" onclick="selectColor(this, event, ${o})">`),e.push(`${o+1}`),e.push("</div>"));u=e.concat(r);let n=document.querySelector("#color-btns");n!=null&&(n.innerHTML=u.join("")),window.selectColor=function(b,x,_){console.log("select",b,x,_),v.setCurrentGroup(_),document.querySelectorAll(".color-btn").forEach(A=>{A.classList.remove("color-btn-selected")}),b.classList.add("color-btn-selected")}}function Ce(){let v=document.getElementById("progress"),t=document.getElementById("percent"),e=50;t.innerText=`${e}%`,v.style.width=`${e}%`}
|