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(_,t,e){var r,u;t>_.x+_.width/2?r=_.x:r=_.x+_.width,e>_.y+_.height/2?u=_.y:u=_.y+_.height;var a=t-r,f=e-u;return Math.sqrt(a*a+f*f)}function pt(_,t,e,r,u,a){_[t]=e,_[t+1]=r,_[t+2]=e+u,_[t+3]=r,_[t+4]=e,_[t+5]=r+a,_[t+6]=e,_[t+7]=r+a,_[t+8]=e+u,_[t+9]=r,_[t+10]=e+u,_[t+11]=r+a}function Bt(_,t,e,r){const u=new Float32Array(12),a=0;return u[a]=_,u[a+1]=t,u[a+2]=_+e,u[a+3]=t,u[a+4]=_,u[a+5]=t+r,u[a+6]=_,u[a+7]=t+r,u[a+8]=_+e,u[a+9]=t,u[a+10]=_+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.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{a=!0,f=x.clientX,o=x.clientY,n=0}),document.addEventListener("mouseup",x=>{var v;a=!1,n==0&&x.target==t&&((v=e.tap)==null||v.call(e,x.offsetX,x.offsetY))}),document.addEventListener("mousemove",x=>{var v;a&&(x.preventDefault(),r=x.clientX-f,u=x.clientY-o,f=x.clientX,o=x.clientY,n+=Math.abs(r)+Math.abs(u),(v=e==null?void 0:e.drag)==null||v.call(e,r,u))}),t.addEventListener("wheel",x=>{var A;x.preventDefault();let v=x.deltaY*-.01+1;(A=e.zoom)==null||A.call(e,v,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;(_=>{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}_.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}_.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}_.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}_.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}_.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}_.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}_.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}_.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}_.projection=x;function v(c,s,d=null){return d=r(d),d[0]=2/c,d[5]=2/s,d[12]=-1,d[13]=-1,d}_.projectionNoflipY=v;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}_.scaleAt=A;function p(c,s,d,l){for(var m=0;m<16;m++)d[m]=c[m]+(s[m]-c[m])*l}_.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(_,t,e){var r=_.createShader(t);_.shaderSource(r,e),_.compileShader(r);var u=_.getShaderParameter(r,_.COMPILE_STATUS);if(u)return r;console.log("error",_.getShaderInfoLog(r)),_.deleteShader(r)}function vt(_,t,e){var r=_.createProgram();_.attachShader(r,t),_.attachShader(r,e),_.linkProgram(r);var u=_.getProgramParameter(r,_.LINK_STATUS);if(u)return r;console.log("error",_.getProgramInfoLog(r)),_.deleteProgram(r)}function Vt(_){return new Promise((t,e)=>{let r=new Image;r.src=_,r.onload=()=>t(r),r.onerror=e})}function $t(_,t,e){return _e?e:_}var Ot=(_=>(_[_.FitCenter=0]="FitCenter",_[_.Repeat=1]="Repeat",_))(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),v=b.centerFitTo(x);pt(this.texCoordArray,0,v.x/f,v.y/o,v.width/f,v.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;bt.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(_,t,e=_.NEAREST){let r=_.createTexture();return _.bindTexture(_.TEXTURE_2D,r),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,e),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,e),_.texImage2D(_.TEXTURE_2D,0,_.RGBA,_.RGBA,_.UNSIGNED_BYTE,t),r}function te(_,t){let e=_.createFramebuffer();_.bindFramebuffer(_.FRAMEBUFFER,e),_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_2D,t,0);let r=_.checkFramebufferStatus(_.FRAMEBUFFER)==_.FRAMEBUFFER_COMPLETE;return console.log(`canRead=${r}`),_.bindFramebuffer(_.FRAMEBUFFER,null),e}function zt(_,t,e,r,u){let a=Bt(t,e,r,u),f=_.createBuffer();return _.bindBuffer(_.ARRAY_BUFFER,f),_.bufferData(_.ARRAY_BUFFER,a,_.STATIC_DRAW),_.bindBuffer(_.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(_,t,e,r,u){const o=vt(_,ft(_,_.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(_,_.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=_.createTexture();_.bindTexture(_.TEXTURE_2D,n),_.texImage2D(_.TEXTURE_2D,0,_.RGBA,r,u,0,_.RGBA,_.UNSIGNED_BYTE,null),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,_.LINEAR),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.LINEAR),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE);const b=_.createFramebuffer();_.bindFramebuffer(_.FRAMEBUFFER,b),_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_2D,n,0);let x=_.getAttribLocation(o,"a_position"),v=_.getAttribLocation(o,"a_texCoord"),A=_.getAttribLocation(o,"a_color"),p=_.getAttribLocation(o,"a_destColor"),c=_.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!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;rr))){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= 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 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(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}function kt(_){throw new Error('Could not dynamically require "'+_+'". 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 (c) 2009-2016 Stuart Knightley 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(_,t){(function(e){_.exports=e()})(function(){return function e(r,u,a){function f(b,x){if(!u[b]){if(!r[b]){var v=typeof kt=="function"&&kt;if(!x&&v)return v(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>2,p=(3&b)<<4|x>>4,c=1>6:64,s=2>4,x=(15&A)<<4|(p=o.indexOf(n.charAt(s++)))>>2,v=(3&p)<<6|(c=o.indexOf(n.charAt(s++))),m[d++]=b,p!==64&&(m[d++]=x),c!==64&&(m[d++]=v);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,v,A,p,c){this.compressedSize=x,this.uncompressedSize=v,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")),v=this;return x.on("end",function(){if(this.streamInfo.data_length!==v.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,v,A){return x.pipe(new o).pipe(new n("uncompressedSize")).pipe(v.compressWorker(A)).pipe(new n("compressedSize")).withStreamInfo("compression",v)},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,v,A){var p=f,c=A+v;b^=-1;for(var s=A;s>>8^p[255&(b^x[s])];return-1^b}(0|n,o,o.length,0):function(b,x,v,A){var p=f,c=A+v;b^=-1;for(var s=A;s>>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(v,A){n.call(this,"FlateWorker/"+v),this._pako=null,this._pakoAction=v,this._pakoOptions=A,this.meta={}}u.magic="\b\0",o.inherits(x,n),x.prototype.processChunk=function(v){this.meta=v.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(b,v.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 v=this;this._pako.onData=function(A){v.push({data:A,meta:v.meta})}},u.compressWorker=function(v){return new x("Deflate",v)},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>>=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:v.LOCAL_FILE_HEADER+V+O+I,dirRecord:v.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"),v=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 v.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.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(v){var A=a.getTypeOf(v);return a.checkSupport(A),A!=="string"||f.uint8array?A==="nodebuffer"?new b(v):f.uint8array?new x(a.transformTo("uint8array",v)):new o(a.transformTo("array",v)):new n(v)}},{"../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 "+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"),v=null;if(b.nodestream)try{v=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"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 v(){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>>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>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(v,n),v.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})},v.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:u.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},u.Utf8DecodeWorker=v,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>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>>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(v){return x(v,v.length)},u.binstring2buf=function(v){for(var A=new a.Buf8(v.length),p=0,c=A.length;p>10&1023,m[c++]=56320|1023&s)}return x(m,c)},u.utf8border=function(v,A){var p;for((A=A||v.length)>v.length&&(A=v.length),p=A-1;0<=p&&(192&v[p])==128;)p--;return p<0||p===0?A:p+n[v[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,v=0;o!==0;){for(o-=v=2e3>>1:f>>>1;o[n]=f}return o}();r.exports=function(f,o,n,b){var x=a,v=b+n;f^=-1;for(var A=b;A>>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"),v=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)-(4i.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]&&Tk&&--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=L)for(T=i.strstart-i.insert,i.ins_h=i.window[T],i.ins_h=(i.ins_h<=L&&(i.ins_h=(i.ins_h<=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<=L&&(i.ins_h=(i.ins_h<=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.pending_buf_size-5&&(U=i.pending_buf_size-5);;){if(i.lookahead<=1){if(at(i),i.lookahead===0&&P===v)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>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.gzindexg&&(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.gzindexg&&(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!==v&&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===v)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===v)return h;if(k.lookahead===0)break}if(k.match_length=0,k.lookahead>=L&&0k.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=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<>>=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,E-=L),E<15&&(m+=h[n++]<>>=L=O>>>24,E-=L,!(16&(L=O>>>16&255))){if(!(64&L)){O=C[(65535&O)+(m&(1<>>=L,E-=L,(L=x-v)<$){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>3,m&=(1<<(E-=M<<3))-1,a.next_in=n,a.next_out=x,a.avail_in=n>>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=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>>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<>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++]<>>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++]<>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++]<>>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>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++]<>>=7&F,F-=7&F,h.mode=27;break}for(;F<3;){if(W===0)break t;W--,S+=I[G++]<>>=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++]<>>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>>=5,F-=5,h.ndist=1+(31&S),S>>>=5,F-=5,h.ncode=4+(15&S),S>>>=4,F-=4,286>>=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>>16&255,st=65535&g,!((et=g>>>24)<=F);){if(W===0)break t;W--,S+=I[G++]<>>=et,F-=et,h.lens[h.have++]=st;else{if(st===16){for(y=et+2;F>>=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>>=et)),S>>>=3,F-=3}else{for(y=et+7;F>>=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(v,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<>>16&255,st=65535&g,!((et=g>>>24)<=F);){if(W===0)break t;W--,S+=I[G++]<>nt)])>>>16&255,st=65535&g,!(nt+(et=g>>>24)<=F);){if(W===0)break t;W--,S+=I[G++]<>>=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>>=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<>>16&255,st=65535&g,!((et=g>>>24)<=F);){if(W===0)break t;W--,S+=I[G++]<>nt)])>>>16&255,st=65535&g,!(nt+(et=g>>>24)<=F);){if(W===0)break t;W--,S+=I[G++]<>>=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>>=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(KB?(L=at[ot+d[D]],F[q+d[D]]):(L=96,0),m=1<>tt)+(E-=m)]=O<<24|L<<16|M|0,E!==0;);for(m=1<>=1;if(m!==0?(S&=m-1,S+=m):S=0,D++,--V[w]==0){if(w===I)break;w=v[A+d[D]]}if(J>>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<>l-g.bi_valid,g.bi_valid+=N-l):(g.bi_buf|=T<>>=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>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>=7;k>>=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>>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>>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]+v+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,v,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}}()?(v="setImmediate$"+Math.random()+"$",f.addEventListener?f.addEventListener("message",E,!1):f.attachEvent("onmessage",E),function(R){f.postMessage(v+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"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(_,t=void 0){let e=await fetch(_);e.headers.get("Content-Length");let r=await e.arrayBuffer();return ve(r,ge(_))}async function ve(_,t=void 0){var v,A,p,c;let e=new Uint8Array(_);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{let u=new Image;u.src=`data:${_};base64, ${t}`,u.onload=()=>{e(u)},u.onerror=r})}function ge(_){let e=/[0-9a-z]{24}/i.exec(_);if(e!=null)return e[0]}function xe(_){for(var t=new ArrayBuffer(_.length*2),e=new Uint16Array(t),r=0,u=_.length;r1&&E<1/v?E=(1/v-x)/(1/v-1)*(E-1)+x:E>=1/v&&(E=v*E+(1/v-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;be)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,v=u.x-x/2,A=u.y-b/2;for(var p=0;p= 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;fA.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 _=window.location.href;console.log("current url:",_);let t=_.substring(0,_.indexOf("/play")),e=_.substring(_.lastIndexOf("/"));console.log("host:",t),console.log("id:",e);let r=`${t}/proxy/zips/v2/number_mini/1501${e}.zip`;t.startsWith("https://art.pcoloring.com")&&(r=`http://pcoloring.com/zips/v2/number_mini/1501${e}.zip`),console.log("zipUrl:",r),Ee(r)};async function Ee(_){var v,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()),(v=document.querySelector("#toggleTestLayer"))==null||v.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(_),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(_){let t=_.data.areaGroups,e=[],r=[],u=[],a,f;for(var o=0;o`),r.push(`${o+1}`),r.push("")):(e.push(`
`),e.push(`${o+1}`),e.push("
"));u=e.concat(r);let n=document.querySelector("#color-btns");n!=null&&(n.innerHTML=u.join("")),window.selectColor=function(b,x,v){console.log("select",b,x,v),_.setCurrentGroup(v),document.querySelectorAll(".color-btn").forEach(A=>{A.classList.remove("color-btn-selected")}),b.classList.add("color-btn-selected")}}function Ce(){let _=document.getElementById("progress"),t=document.getElementById("percent"),e=50;t.innerText=`${e}%`,_.style.width=`${e}%`}