import"./modulepreload-polyfill-B5Qt9EMX.js";class ue{constructor(t,e){this.x=t,this.y=e}}class At{constructor(t,e,r,h){this.x=t,this.y=e,this.width=r,this.height=h}get center(){return new ue(this.x+this.width/2,this.y+this.height/2)}static fromCenter(t,e,r){return new At(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,h=this.y+this.height;return[t,r,e,r,t,h,t,h,e,r,e,h]}coverRadius(t,e){var r,h;t>this.x+this.width/2?r=this.x:r=this.x+this.width,e>this.y+this.height/2?h=this.y:h=this.y+this.height;var a=t-r,n=e-h;return Math.sqrt(a*a+n*n)}centerFitTo(t){const e=Math.min(t.width/this.width,t.height/this.height),r=e*this.width,h=e*this.height,a=t.width/2-r/2,n=t.height/2-h/2;return new At(t.x+a,t.y+n,r,h)}}function jt(l,t,e){var r,h;t>l.x+l.width/2?r=l.x:r=l.x+l.width,e>l.y+l.height/2?h=l.y:h=l.y+l.height;var a=t-r,n=e-h;return Math.sqrt(a*a+n*n)}function pt(l,t,e,r,h,a){l[t]=e,l[t+1]=r,l[t+2]=e+h,l[t+3]=r,l[t+4]=e,l[t+5]=r+a,l[t+6]=e,l[t+7]=r+a,l[t+8]=e+h,l[t+9]=r,l[t+10]=e+h,l[t+11]=r+a}function Pt(l,t,e,r){const h=new Float32Array(12),a=0;return h[a]=l,h[a+1]=t,h[a+2]=l+e,h[a+3]=t,h[a+4]=l,h[a+5]=t+r,h[a+6]=l,h[a+7]=t+r,h[a+8]=l+e,h[a+9]=t,h[a+10]=l+e,h[a+11]=t+r,h}class re{constructor(t,e,r,h){this.duration=t,this.onUpdate=e,this.onEnd=r,this.interpolator=h,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 fe{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,n=g.clientX,o=g.clientY,i=0}),document.addEventListener("mouseup",g=>{var _;a=!1,i==0&&g.target==t&&((_=e.tap)==null||_.call(e,g.offsetX,g.offsetY))}),document.addEventListener("mousemove",g=>{var _;a&&(g.preventDefault(),r=g.clientX-n,h=g.clientY-o,n=g.clientX,o=g.clientY,i+=Math.abs(r)+Math.abs(h),(_=e==null?void 0:e.drag)==null||_.call(e,r,h))}),t.addEventListener("wheel",g=>{var y;g.preventDefault();let _=g.deltaY*-.01+1;(y=e.zoom)==null||y.call(e,_,g.offsetX,g.offsetY)}),t.addEventListener("click",g=>{g.preventDefault()});const b=new fe(t,e);t.addEventListener("touchstart",g=>{g.preventDefault(),b.start(g.changedTouches)}),t.addEventListener("touchmove",g=>{b.move(g.changedTouches)}),t.addEventListener("touchend",g=>{b.end(g.changedTouches)}),t.addEventListener("touchcancel",g=>{b.end(g.changedTouches)})}}var lt;(l=>{let t=Float32Array;function e(p,c,f=null){f=f||new t(16);var d=c[0*4+0],v=c[0*4+1],w=c[0*4+2],R=c[0*4+3],C=c[1*4+0],U=c[1*4+1],k=c[1*4+2],O=c[1*4+3],B=c[2*4+0],P=c[2*4+1],$=c[2*4+2],E=c[2*4+3],I=c[3*4+0],u=c[3*4+1],z=c[3*4+2],K=c[3*4+3],G=p[0*4+0],tt=p[0*4+1],j=p[0*4+2],J=p[0*4+3],L=p[1*4+0],F=p[1*4+1],q=p[1*4+2],V=p[1*4+3],Y=p[2*4+0],at=p[2*4+1],st=p[2*4+2],et=p[2*4+3],rt=p[3*4+0],ot=p[3*4+1],nt=p[3*4+2],ft=p[3*4+3];return f[0]=d*G+v*L+w*Y+R*rt,f[1]=d*tt+v*F+w*at+R*ot,f[2]=d*j+v*q+w*st+R*nt,f[3]=d*J+v*V+w*et+R*ft,f[4]=C*G+U*L+k*Y+O*rt,f[5]=C*tt+U*F+k*at+O*ot,f[6]=C*j+U*q+k*st+O*nt,f[7]=C*J+U*V+k*et+O*ft,f[8]=B*G+P*L+$*Y+E*rt,f[9]=B*tt+P*F+$*at+E*ot,f[10]=B*j+P*q+$*st+E*nt,f[11]=B*J+P*V+$*et+E*ft,f[12]=I*G+u*L+z*Y+K*rt,f[13]=I*tt+u*F+z*at+K*ot,f[14]=I*j+u*q+z*st+K*nt,f[15]=I*J+u*V+z*et+K*ft,f}l.multiply=e;function r(p=null){return p=p||new t(16),p[0]=1,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=1,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=1,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p}l.identity=r;function h(p,c,f,d=null){return d=d||new t(16),d[0]=1,d[1]=0,d[2]=0,d[3]=0,d[4]=0,d[5]=1,d[6]=0,d[7]=0,d[8]=0,d[9]=0,d[10]=1,d[11]=0,d[12]=p,d[13]=c,d[14]=f,d[15]=1,d}l.translation=h;function a(p,c,f,d){return d=d||new t(16),d[0]=p,d[1]=0,d[2]=0,d[3]=0,d[4]=0,d[5]=c,d[6]=0,d[7]=0,d[8]=0,d[9]=0,d[10]=f,d[11]=0,d[12]=0,d[13]=0,d[14]=0,d[15]=1,d}l.scaling=a;function n(p,c,f,d,v){return v=v||new t(16),v[0]=c*p[0*4+0],v[1]=c*p[0*4+1],v[2]=c*p[0*4+2],v[3]=c*p[0*4+3],v[4]=f*p[1*4+0],v[5]=f*p[1*4+1],v[6]=f*p[1*4+2],v[7]=f*p[1*4+3],v[8]=d*p[2*4+0],v[9]=d*p[2*4+1],v[10]=d*p[2*4+2],v[11]=d*p[2*4+3],p!==v&&(v[12]=p[12],v[13]=p[13],v[14]=p[14],v[15]=p[15]),v}l.scale=n;function o(p,c=null){c=c||new t(16);var f=p[0*4+0],d=p[0*4+1],v=p[0*4+2],w=p[0*4+3],R=p[1*4+0],C=p[1*4+1],U=p[1*4+2],k=p[1*4+3],O=p[2*4+0],B=p[2*4+1],P=p[2*4+2],$=p[2*4+3],E=p[3*4+0],I=p[3*4+1],u=p[3*4+2],z=p[3*4+3],K=P*z,G=u*$,tt=U*z,j=u*k,J=U*$,L=P*k,F=v*z,q=u*w,V=v*$,Y=P*w,at=v*k,st=U*w,et=O*I,rt=E*B,ot=R*I,nt=E*C,ft=R*B,dt=O*C,s=f*I,M=E*d,D=f*B,A=O*d,x=f*C,T=R*d,N=K*C+j*B+J*I-(G*C+tt*B+L*I),W=G*d+F*B+Y*I-(K*d+q*B+V*I),S=tt*d+q*C+at*I-(j*d+F*C+st*I),X=L*d+V*C+st*B-(J*d+Y*C+at*B),H=1/(f*N+R*W+O*S+E*X);return c[0]=H*N,c[1]=H*W,c[2]=H*S,c[3]=H*X,c[4]=H*(G*R+tt*O+L*E-(K*R+j*O+J*E)),c[5]=H*(K*f+q*O+V*E-(G*f+F*O+Y*E)),c[6]=H*(j*f+F*R+st*E-(tt*f+q*R+at*E)),c[7]=H*(J*f+Y*R+at*O-(L*f+V*R+st*O)),c[8]=H*(et*k+nt*$+ft*z-(rt*k+ot*$+dt*z)),c[9]=H*(rt*w+s*$+A*z-(et*w+M*$+D*z)),c[10]=H*(ot*w+M*k+x*z-(nt*w+s*k+T*z)),c[11]=H*(dt*w+D*k+T*$-(ft*w+A*k+x*$)),c[12]=H*(ot*P+dt*u+rt*U-(ft*u+et*U+nt*P)),c[13]=H*(D*u+et*v+M*P-(s*P+A*u+rt*v)),c[14]=H*(s*U+T*u+nt*v-(x*u+ot*v+M*U)),c[15]=H*(x*P+ft*v+A*U-(D*U+T*P+dt*v)),c}l.inverse=o;function i(p,c,f=null){f=f||new t(3);var d=c[0],v=c[1],w=c[2],R=d*p[0*4+3]+v*p[1*4+3]+w*p[2*4+3]+p[3*4+3];return f[0]=(d*p[0*4+0]+v*p[1*4+0]+w*p[2*4+0]+p[3*4+0])/R,f[1]=(d*p[0*4+1]+v*p[1*4+1]+w*p[2*4+1]+p[3*4+1])/R,f[2]=(d*p[0*4+2]+v*p[1*4+2]+w*p[2*4+2]+p[3*4+2])/R,f}l.transformPoint=i;function b(p,c=null){return c=c||new t(16),c[0]=p[0],c[1]=p[1],c[2]=p[2],c[3]=p[3],c[4]=p[4],c[5]=p[5],c[6]=p[6],c[7]=p[7],c[8]=p[8],c[9]=p[9],c[10]=p[10],c[11]=p[11],c[12]=p[12],c[13]=p[13],c[14]=p[14],c[15]=p[15],c}l.copy=b;function g(p,c,f=null){return f=r(f),f[0]=2/p,f[5]=-2/c,f[12]=-1,f[13]=1,f}l.projection=g;function _(p,c,f=null){return f=r(f),f[0]=2/p,f[5]=2/c,f[12]=-1,f[13]=-1,f}l.projectionNoflipY=_;function y(p,c,f,d){let v=r();return v[0]=p,v[5]=c,v[12]=-p*f+f,v[13]=-c*d+d,v}l.scaleAt=y;function m(p,c,f,d){for(var v=0;v<16;v++)f[v]=p[v]+(c[v]-p[v])*d}l.lerp=m})(lt||(lt={}));class yt{preDraw(){}draw(){}tap(t,e,r,h){}scale(t){}dispose(){}}class ie{constructor(t,e,r,h){this.left=t,this.top=e,this.right=r,this.bottom=h}equals(t){return this.left==t.left&&this.top==t.top&&this.right==t.right&&this.bottom==t.bottom}}class pe{constructor(t,e,r=window){this.gl=t,this.ratio=e,this.animationFrameProvider=r,this.layers=[],this.testLayers=[],this.animators=[],this.userMat=lt.identity(),this.bestFitMat=lt.identity(),this.projectionMat=lt.identity(),this.resultMat=lt.identity(),this.width=0,this.height=0,this.contentWidth=0,this.contentHeight=0,this.padding=new ie(0,0,0,0),this.pendingDraw=!1,this.isBestMatSet=!1,this.updateViewport();let h=this;window&&new de(t.canvas,{drag:h.drag.bind(h),zoom:h.scaleAt.bind(h),tap:h.tap.bind(h)}),lt.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,lt.projection(this.width,this.height,this.projectionMat),this.updateBestFit(),this.updateResultMat())}updateBestFit(){if(this.contentWidth==0||this.width==0)return;const t=new At(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,h=t.center.y-this.contentHeight*e/2;lt.identity(this.bestFitMat),this.bestFitMat[0]=e,this.bestFitMat[5]=e,this.bestFitMat[12]=r,this.bestFitMat[13]=h,this.isBestMatSet||(lt.copy(this.bestFitMat,this.userMat),this.invalidate(),this.isBestMatSet=!0)}updateResultMat(){if(this.contentWidth==0||this.width==0)return;const t=new At(this.padding.left,this.padding.top,this.width-this.padding.right-this.padding.left,this.height-this.padding.top-this.padding.bottom);let e=this.width>this.height?.6:.7,r=this.width*e/this.contentWidth,h=this.height*e/this.contentHeight,a=Math.min(r,h);const n=t.center.x-this.contentWidth*a/2,o=t.center.y-this.contentHeight*a/(this.width>this.height?1.5:1.2);lt.identity(this.resultMat),this.resultMat[0]=a,this.resultMat[5]=a,this.resultMat[12]=n,this.resultMat[13]=o}setContentPadding(t){this.padding.equals(t)||(this.padding=t,this.updateBestFit(),this.updateResultMat())}setContentSize(t,e){(t!=this.contentWidth||e!=this.contentWidth)&&(this.contentWidth=t,this.contentHeight=e,this.updateBestFit(),this.updateResultMat())}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 lt.multiply(this.projectionMat,this.userMat)}drag(t,e){let r=lt.translation(t*this.ratio,e*this.ratio,0);this.userMat=lt.multiply(r,this.userMat),this.invalidate()}scaleAt(t,e,r){e*=this.ratio,r*=this.ratio;let h=lt.scaleAt(t,t,e,r);this.userMat=lt.multiply(h,this.userMat),this.layers.forEach(a=>a.scale(this.userMat[0])),this.invalidate()}tap(t,e){let r=t*this.ratio,h=e*this.ratio,[a,n]=lt.transformPoint(lt.inverse(this.userMat),new Float32Array([r,h,0]));this.layers.forEach(o=>o.tap(a,n,r,h))}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(h=>this.layers.indexOf(h)>=0),e=(t+1)%this.testLayers.length,r=this.testLayers[e];t>=0&&(this.layers=this.layers.filter(h=>h!=this.testLayers[t])),console.log(`toggleTestLayer, layer=${r}`),this.layers.push(r),this.invalidate()}setScale(t){lt.scaling(t,t,1,this.userMat),this.invalidate()}updateUserMat(t){lt.copy(t,this.userMat),this.invalidate()}matrixAnimationTo(t,e,r,h){const a=lt.copy(this.userMat),n=new Float32Array(16),o=new re(e,()=>{lt.lerp(a,t,n,o.value()),this.updateUserMat(n)},()=>{h==null||h()},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 ct(l,t,e){var r=l.createShader(t);l.shaderSource(r,e),l.compileShader(r);var h=l.getShaderParameter(r,l.COMPILE_STATUS);if(h)return r;console.log("error",l.getShaderInfoLog(r)),l.deleteShader(r)}function vt(l,t,e){var r=l.createProgram();l.attachShader(r,t),l.attachShader(r,e),l.linkProgram(r);var h=l.getProgramParameter(r,l.LINK_STATUS);if(h)return r;console.log("error",l.getProgramInfoLog(r)),l.deleteProgram(r)}function Ct(l){return new Promise((t,e)=>{let r=new Image;r.src=l,r.onload=()=>t(r),r.onerror=e})}function me(l,t,e){return le?e:l}function ge(l){const[t,e,r,h]=l.map(g=>g/255),a=Math.max(t,e,r),n=Math.min(t,e,r);let o,i,b=(a+n)/2;if(a===n)o=i=0;else{const g=a-n;switch(i=b>.5?g/(2-a-n):g/(a+n),a){case t:o=(e-r)/g+(e(l[l.FitCenter=0]="FitCenter",l[l.Repeat=1]="Repeat",l))(ae||{});class ye extends yt{constructor(t,e,r,h,a=0,n=e.width,o=e.height){super(),this.scene=t,this.image=e,this.width=r,this.height=h,this.texWidth=n,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 i=t.gl;if(this.program=vt(i,ct(i,i.VERTEX_SHADER,this.vertexShaderCode),ct(i,i.FRAGMENT_SHADER,this.fragmentShaderCode)),this.aPositionLoc=i.getAttribLocation(this.program,"a_position"),this.aTexcoordLoc=i.getAttribLocation(this.program,"a_texCoord"),this.uMatrixLoc=i.getUniformLocation(this.program,"u_matrix"),pt(this.vertexArray,0,0,0,r,h),a==0){const b=new At(0,0,r,h),g=new At(0,0,n,o),_=b.centerFitTo(g);pt(this.texCoordArray,0,_.x/n,_.y/o,_.width/n,_.height/o)}else pt(this.texCoordArray,0,0,0,r/n,h/o);this.vertexBuffer=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,this.vertexBuffer),i.bufferData(i.ARRAY_BUFFER,this.vertexArray,i.STATIC_DRAW),this.texcoordBuffer=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,this.texcoordBuffer),i.bufferData(i.ARRAY_BUFFER,this.texCoordArray,i.STATIC_DRAW),this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.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 gt{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 h=this.parts;const a=h[0]/255,n=h[1]/255,o=h[2]/255,i=h[3]/255;for(var b=0;bt.colored)}get firstUncoloredArea(){return this.areas.find(t=>!t.colored)}get progressPercent(){let t=this.areas.filter(h=>h.colored).length,e=this.areas.length;return t*100/e}}class Ee{constructor(t){this.areaGroups=t,this.areaHash=new Map,this.groupHash=new Map,t.forEach(e=>{Object.setPrototypeOf(e,we.prototype),e.areas.forEach(r=>{Object.setPrototypeOf(r,Ae.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)}get coloredPercent(){let t=[...this.areaHash.values()].reduce((e,r)=>r.colored===!0?e+1:e,0);return Math.round(t*100/this.areaHash.size)}}function zt(l,t,e=l.NEAREST){let r=l.createTexture();return l.bindTexture(l.TEXTURE_2D,r),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,e),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,l.RGBA,l.UNSIGNED_BYTE,t),r}function Re(l,t){let e=l.createFramebuffer();l.bindFramebuffer(l.FRAMEBUFFER,e),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,t,0);let r=l.checkFramebufferStatus(l.FRAMEBUFFER)==l.FRAMEBUFFER_COMPLETE;return console.log(`canRead=${r}`),l.bindFramebuffer(l.FRAMEBUFFER,null),e}function Xt(l,t,e,r,h){let a=Pt(t,e,r,h),n=l.createBuffer();return l.bindBuffer(l.ARRAY_BUFFER,n),l.bufferData(l.ARRAY_BUFFER,a,l.STATIC_DRAW),l.bindBuffer(l.ARRAY_BUFFER,null),n}class Ce extends yt{constructor(t,e,r,h,a,n=4294901760,o=1){super(),this.scene=t,this.x=e,this.y=r,this.width=h,this.height=a,this.color=n,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 i=t.gl;this.program=vt(i,ct(i,i.VERTEX_SHADER,this.vertexShaderCode),ct(i,i.FRAGMENT_SHADER,this.fragmentShaderCode)),this.aPositionLoc=i.getAttribLocation(this.program,"a_position"),this.uMatrixLoc=i.getUniformLocation(this.program,"u_matrix"),this.uColorLoc=i.getUniformLocation(this.program,"u_color"),this.vertexArray=new Float32Array([e,r,e,r+a,e+h,r+a,e+h,r]),this.vertexBuffer=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,this.vertexBuffer),i.bufferData(i.ARRAY_BUFFER,this.vertexArray,i.STATIC_DRAW),this.colorArray=new gt(n).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 Te extends yt{constructor(t,e,r,h,a,n=4294967295,o=null){super(),this.scene=t,this.x=e,this.y=r,this.width=h,this.height=a,this.color=n,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 i=t.gl;this.program=vt(i,ct(i,i.VERTEX_SHADER,this.vertexShaderCode),ct(i,i.FRAGMENT_SHADER,o||this.fragmentShaderCode)),this.aPositionLoc=i.getAttribLocation(this.program,"a_position"),this.uMatrixLoc=i.getUniformLocation(this.program,"u_matrix"),this.uColorLoc=i.getUniformLocation(this.program,"u_color"),pt(this.vertexArray,0,e,r,h,a),this.vertexBuffer=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,this.vertexBuffer),i.bufferData(i.ARRAY_BUFFER,this.vertexArray,i.STATIC_DRAW),this.colorArray=new gt(n).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()"}}class Se extends yt{constructor(t,e,r,h,a,n=4294901760,o=30){super(),this.scene=t,this.x=e,this.y=r,this.width=h,this.height=a,this.color=n,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 i=t.gl;this.program=vt(i,ct(i,i.VERTEX_SHADER,this.vertexShaderCode),ct(i,i.FRAGMENT_SHADER,this.fragmentShaderCode)),this.aPositionLoc=i.getAttribLocation(this.program,"a_position"),this.uMatrixLoc=i.getUniformLocation(this.program,"u_matrix"),this.uColorLoc=i.getUniformLocation(this.program,"u_color"),this.vertexArray=this.generateThickBorderVertices(e,r,h,a,o),this.vertexBuffer=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,this.vertexBuffer),i.bufferData(i.ARRAY_BUFFER,this.vertexArray,i.STATIC_DRAW),this.colorArray=new gt(n).toFloatArray()}generateThickBorderVertices(t,e,r,h,a){const n=a/2;return new Float32Array([t-n,e-n,t+r+n,e-n,t-n,e+n,t+r+n,e+n,t+r-n,e-n,t+r+n,e-n,t+r-n,e+h+n,t+r+n,e+h+n,t+r+n,e+h-n,t-n,e+h-n,t+r+n,e+h+n,t-n,e+h+n,t+n,e+h,t-n,e+h,t+n,e,t-n,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.uniformMatrix4fv(this.uMatrixLoc,!1,this.scene.drawMatrix),t.uniform4fv(this.uColorLoc,this.colorArray),t.drawArrays(t.TRIANGLE_STRIP,0,16)}}var Bt=(l=>(l[l.ColorDone=0]="ColorDone",l[l.AllDone=1]="AllDone",l[l.Hint=2]="Hint",l))(Bt||{});class Fe{constructor(){this.audioColorDone=new Audio("/assets/sound/section_done.mp3"),this.audioAllDone=new Audio("/assets/sound/color_done_02.mp3"),this.audioHint=new Audio("/assets/sound/sound_hint.mp3")}playAudio(t){switch(console.log(`play sound ${t}`),t){case 0:this.audioColorDone.play();break;case 1:this.audioAllDone.play();break;case 2:this.audioHint.play();break}}}class ke{constructor(t,e,r,h,a,n,o){this.x=e,this.y=r,this.r=h,this.dx=a,this.dy=n,this.color=o,this.a=1,this.ctx=t}draw(){let t=this.ctx;t.save(),t.globalAlpha=this.a,t.fillStyle=this.color,t.beginPath(),t.arc(this.x,this.y,this.r,0,Math.PI*2,!1),t.fill(),t.restore()}update(){this.draw(),this.a-=1/120,this.x+=this.dx,this.y+=this.dy}}class Be{constructor(t,e,r,h){this.particles=[],this.canvas=t,this.canvas.width=Math.floor(this.canvas.offsetWidth*window.devicePixelRatio),this.canvas.height=Math.floor(this.canvas.offsetHeight*window.devicePixelRatio),this.ctx=this.canvas.getContext("2d"),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.initParticles(e,r),this.onend=h}explode(){if(this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.particles.forEach((t,e)=>{t.a<=0?this.particles.splice(e,1):t.update()}),this.particles.length==0){this.onend&&this.onend();return}requestAnimationFrame(this.explode.bind(this))}initParticles(t,e){let r=xe(t,e);for(let h=0;h!o.isAllColored);n&&(this.currentGroup=n)}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}get doneBeforeCount(){let t=0;for(let e=0;er==this.currentGroup),e=!1;for(let r=0;rr))){U=1/Math.exp(C);var B=f.get(k);B==null?f.set(k,U):f.set(k,U+B)}let P=0,$;return f.forEach((E,I)=>{console.log(`id=${I}, count=${E}`);var u=h.get(I);u!=null&&!u.colored&&E>P&&($=u,P=E)}),console.log("Area hit:",$),$}dispose(){this.gl.deleteFramebuffer(this.fb),this.gl.deleteTexture(this.colored),this.gl.deleteTexture(this.mapTexure),this.listeners=[]}}class Ue extends pe{constructor(t,e,r=window){super(t,e,r)}focusToArea(t){if(this.fillerData==null)return;const e=t.center.radius*4,r=me(Math.min(this.width/e,this.height/e),1,this.fillerData.config.maxScale),h=this.width/2,a=this.height/2,n=lt.identity();n[0]=r,n[5]=r,n[12]=-r*t.center.x+h,n[13]=-r*t.center.y+a,this.matrixAnimationTo(n,600)}resetToResult(){this.matrixAnimationTo(this.resultMat,800)}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 Pe{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,ct(t,t.VERTEX_SHADER,this.vertexShaderCode),ct(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=lt.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),h=new Float32Array(24*this.pendingAreas.length);var a=0,n=0;const o=this.fillerData.width,i=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,ct(r,r.VERTEX_SHADER,this.vertexShaderCode),ct(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=Pt(0,0,e.width,e.height),this.texCoordArray=Pt(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 Pe(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 h=t.createTexture();t.bindTexture(t.TEXTURE_2D,h);const a=10,n=Math.floor(e/a),o=Math.floor(r/a),i=new Uint8Array(n*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 Ne extends Me{constructor(t,e,r,h){const a=t.gl;let n=a.createTexture();a.bindTexture(a.TEXTURE_2D,n),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,n,e.width,e.height,r,h,Oe)}}var Ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ge(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}function kt(l){throw new Error('Could not dynamically require "'+l+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var oe={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(l,t){(function(e){l.exports=e()})(function(){return function e(r,h,a){function n(b,g){if(!h[b]){if(!r[b]){var _=typeof kt=="function"&&kt;if(!g&&_)return _(b,!0);if(o)return o(b,!0);var y=new Error("Cannot find module '"+b+"'");throw y.code="MODULE_NOT_FOUND",y}var m=h[b]={exports:{}};r[b][0].call(m.exports,function(p){var c=r[b][1][p];return n(c||p)},m,m.exports,e,r,h,a)}return h[b].exports}for(var o=typeof kt=="function"&&kt,i=0;i>2,m=(3&b)<<4|g>>4,p=1>6:64,c=2>4,g=(15&y)<<4|(m=o.indexOf(i.charAt(c++)))>>2,_=(3&m)<<6|(p=o.indexOf(i.charAt(c++))),v[f++]=b,m!==64&&(v[f++]=g),p!==64&&(v[f++]=_);return v}},{"./support":30,"./utils":32}],2:[function(e,r,h){var a=e("./external"),n=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),i=e("./stream/DataLengthProbe");function b(g,_,y,m,p){this.compressedSize=g,this.uncompressedSize=_,this.crc32=y,this.compression=m,this.compressedContent=p}b.prototype={getContentWorker:function(){var g=new n(a.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new i("data_length")),_=this;return g.on("end",function(){if(this.streamInfo.data_length!==_.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),g},getCompressedWorker:function(){return new n(a.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},b.createWorkerFrom=function(g,_,y){return g.pipe(new o).pipe(new i("uncompressedSize")).pipe(_.compressWorker(y)).pipe(new i("compressedSize")).withStreamInfo("compression",_)},r.exports=b},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,r,h){var a=e("./stream/GenericWorker");h.STORE={magic:"\0\0",compressWorker:function(){return new a("STORE compression")},uncompressWorker:function(){return new a("STORE decompression")}},h.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,r,h){var a=e("./utils"),n=function(){for(var o,i=[],b=0;b<256;b++){o=b;for(var g=0;g<8;g++)o=1&o?3988292384^o>>>1:o>>>1;i[b]=o}return i}();r.exports=function(o,i){return o!==void 0&&o.length?a.getTypeOf(o)!=="string"?function(b,g,_,y){var m=n,p=y+_;b^=-1;for(var c=y;c>>8^m[255&(b^g[c])];return-1^b}(0|i,o,o.length,0):function(b,g,_,y){var m=n,p=y+_;b^=-1;for(var c=y;c>>8^m[255&(b^g.charCodeAt(c))];return-1^b}(0|i,o,o.length,0):0}},{"./utils":32}],5:[function(e,r,h){h.base64=!1,h.binary=!1,h.dir=!1,h.createFolders=!0,h.date=null,h.compression=null,h.compressionOptions=null,h.comment=null,h.unixPermissions=null,h.dosPermissions=null},{}],6:[function(e,r,h){var a=null;a=typeof Promise<"u"?Promise:e("lie"),r.exports={Promise:a}},{lie:37}],7:[function(e,r,h){var a=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",n=e("pako"),o=e("./utils"),i=e("./stream/GenericWorker"),b=a?"uint8array":"array";function g(_,y){i.call(this,"FlateWorker/"+_),this._pako=null,this._pakoAction=_,this._pakoOptions=y,this.meta={}}h.magic="\b\0",o.inherits(g,i),g.prototype.processChunk=function(_){this.meta=_.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(b,_.data),!1)},g.prototype.flush=function(){i.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},g.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this._pako=null},g.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var _=this;this._pako.onData=function(y){_.push({data:y,meta:_.meta})}},h.compressWorker=function(_){return new g("Deflate",_)},h.uncompressWorker=function(){return new g("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,r,h){function a(m,p){var c,f="";for(c=0;c>>=8;return f}function n(m,p,c,f,d,v){var w,R,C=m.file,U=m.compression,k=v!==b.utf8encode,O=o.transformTo("string",v(C.name)),B=o.transformTo("string",b.utf8encode(C.name)),P=C.comment,$=o.transformTo("string",v(P)),E=o.transformTo("string",b.utf8encode(P)),I=B.length!==C.name.length,u=E.length!==P.length,z="",K="",G="",tt=C.dir,j=C.date,J={crc32:0,compressedSize:0,uncompressedSize:0};p&&!c||(J.crc32=m.crc32,J.compressedSize=m.compressedSize,J.uncompressedSize=m.uncompressedSize);var L=0;p&&(L|=8),k||!I&&!u||(L|=2048);var F=0,q=0;tt&&(F|=16),d==="UNIX"?(q=798,F|=function(Y,at){var st=Y;return Y||(st=at?16893:33204),(65535&st)<<16}(C.unixPermissions,tt)):(q=20,F|=function(Y){return 63&(Y||0)}(C.dosPermissions)),w=j.getUTCHours(),w<<=6,w|=j.getUTCMinutes(),w<<=5,w|=j.getUTCSeconds()/2,R=j.getUTCFullYear()-1980,R<<=4,R|=j.getUTCMonth()+1,R<<=5,R|=j.getUTCDate(),I&&(K=a(1,1)+a(g(O),4)+B,z+="up"+a(K.length,2)+K),u&&(G=a(1,1)+a(g($),4)+E,z+="uc"+a(G.length,2)+G);var V="";return V+=` \0`,V+=a(L,2),V+=U.magic,V+=a(w,2),V+=a(R,2),V+=a(J.crc32,4),V+=a(J.compressedSize,4),V+=a(J.uncompressedSize,4),V+=a(O.length,2),V+=a(z.length,2),{fileRecord:_.LOCAL_FILE_HEADER+V+O+z,dirRecord:_.CENTRAL_FILE_HEADER+a(q,2)+V+a($.length,2)+"\0\0\0\0"+a(F,4)+a(f,4)+O+z+$}}var o=e("../utils"),i=e("../stream/GenericWorker"),b=e("../utf8"),g=e("../crc32"),_=e("../signature");function y(m,p,c,f){i.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=c,this.encodeFileName=f,this.streamFiles=m,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(y,i),y.prototype.push=function(m){var p=m.meta.percent||0,c=this.entriesCount,f=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,i.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:c?(p+100*(c-f-1))/c:100}}))},y.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var p=this.streamFiles&&!m.file.dir;if(p){var c=n(m,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:c.fileRecord,meta:{percent:0}})}else this.accumulate=!0},y.prototype.closedSource=function(m){this.accumulate=!1;var p=this.streamFiles&&!m.file.dir,c=n(m,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(c.dirRecord),p)this.push({data:function(f){return _.DATA_DESCRIPTOR+a(f.crc32,4)+a(f.compressedSize,4)+a(f.uncompressedSize,4)}(m),meta:{percent:100}});else for(this.push({data:c.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},y.prototype.flush=function(){for(var m=this.bytesWritten,p=0;p=this.index;i--)b=(b<<8)+this.byteAt(i);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=n},{"../utils":32}],19:[function(e,r,h){var a=e("./Uint8ArrayReader");function n(o){a.call(this,o)}e("../utils").inherits(n,a),n.prototype.readData=function(o){this.checkOffset(o);var i=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,i},r.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,r,h){var a=e("./DataReader");function n(o){a.call(this,o)}e("../utils").inherits(n,a),n.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},n.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},n.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},n.prototype.readData=function(o){this.checkOffset(o);var i=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,i},r.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,r,h){var a=e("./ArrayReader");function n(o){a.call(this,o)}e("../utils").inherits(n,a),n.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var i=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,i},r.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,r,h){var a=e("../utils"),n=e("../support"),o=e("./ArrayReader"),i=e("./StringReader"),b=e("./NodeBufferReader"),g=e("./Uint8ArrayReader");r.exports=function(_){var y=a.getTypeOf(_);return a.checkSupport(y),y!=="string"||n.uint8array?y==="nodebuffer"?new b(_):n.uint8array?new g(a.transformTo("uint8array",_)):new o(a.transformTo("array",_)):new i(_)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,r,h){h.LOCAL_FILE_HEADER="PK",h.CENTRAL_FILE_HEADER="PK",h.CENTRAL_DIRECTORY_END="PK",h.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",h.ZIP64_CENTRAL_DIRECTORY_END="PK",h.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,r,h){var a=e("./GenericWorker"),n=e("../utils");function o(i){a.call(this,"ConvertWorker to "+i),this.destType=i}n.inherits(o,a),o.prototype.processChunk=function(i){this.push({data:n.transformTo(this.destType,i.data),meta:i.meta})},r.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,r,h){var a=e("./GenericWorker"),n=e("../crc32");function o(){a.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,a),o.prototype.processChunk=function(i){this.streamInfo.crc32=n(i.data,this.streamInfo.crc32||0),this.push(i)},r.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,r,h){var a=e("../utils"),n=e("./GenericWorker");function o(i){n.call(this,"DataLengthProbe for "+i),this.propName=i,this.withStreamInfo(i,0)}a.inherits(o,n),o.prototype.processChunk=function(i){if(i){var b=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=b+i.data.length}n.prototype.processChunk.call(this,i)},r.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,r,h){var a=e("../utils"),n=e("./GenericWorker");function o(i){n.call(this,"DataWorker");var b=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,i.then(function(g){b.dataIsReady=!0,b.data=g,b.max=g&&g.length||0,b.type=a.getTypeOf(g),b.isPaused||b._tickAndRepeat()},function(g){b.error(g)})}a.inherits(o,n),o.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!n.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 i=null,b=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":i=this.data.substring(this.index,b);break;case"uint8array":i=this.data.subarray(this.index,b);break;case"array":case"nodebuffer":i=this.data.slice(this.index,b)}return this.index=b,this.push({data:i,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,r,h){function a(n){this.name=n||"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(n){this.emit("data",n)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(n){this.emit("error",n)}return!0},error:function(n){return!this.isFinished&&(this.isPaused?this.generatedError=n:(this.isFinished=!0,this.emit("error",n),this.previous&&this.previous.error(n),this.cleanUp()),!0)},on:function(n,o){return this._listeners[n].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(n,o){if(this._listeners[n])for(var i=0;i "+n:n}},r.exports=a},{}],29:[function(e,r,h){var a=e("../utils"),n=e("./ConvertWorker"),o=e("./GenericWorker"),i=e("../base64"),b=e("../support"),g=e("../external"),_=null;if(b.nodestream)try{_=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function y(p,c){return new g.Promise(function(f,d){var v=[],w=p._internalType,R=p._outputType,C=p._mimeType;p.on("data",function(U,k){v.push(U),c&&c(k)}).on("error",function(U){v=[],d(U)}).on("end",function(){try{var U=function(k,O,B){switch(k){case"blob":return a.newBlob(a.transformTo("arraybuffer",O),B);case"base64":return i.encode(O);default:return a.transformTo(k,O)}}(R,function(k,O){var B,P=0,$=null,E=0;for(B=0;B"u")h.blob=!1;else{var a=new ArrayBuffer(0);try{h.blob=new Blob([a],{type:"application/zip"}).size===0}catch{try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(a),h.blob=n.getBlob("application/zip").size===0}catch{h.blob=!1}}}try{h.nodestream=!!e("readable-stream").Readable}catch{h.nodestream=!1}},{"readable-stream":16}],31:[function(e,r,h){for(var a=e("./utils"),n=e("./support"),o=e("./nodejsUtils"),i=e("./stream/GenericWorker"),b=new Array(256),g=0;g<256;g++)b[g]=252<=g?6:248<=g?5:240<=g?4:224<=g?3:192<=g?2:1;b[254]=b[254]=1;function _(){i.call(this,"utf-8 decode"),this.leftOver=null}function y(){i.call(this,"utf-8 encode")}h.utf8encode=function(m){return n.nodebuffer?o.newBufferFrom(m,"utf-8"):function(p){var c,f,d,v,w,R=p.length,C=0;for(v=0;v>>6:(f<65536?c[w++]=224|f>>>12:(c[w++]=240|f>>>18,c[w++]=128|f>>>12&63),c[w++]=128|f>>>6&63),c[w++]=128|63&f);return c}(m)},h.utf8decode=function(m){return n.nodebuffer?a.transformTo("nodebuffer",m).toString("utf-8"):function(p){var c,f,d,v,w=p.length,R=new Array(2*w);for(c=f=0;c>10&1023,R[f++]=56320|1023&d)}return R.length!==f&&(R.subarray?R=R.subarray(0,f):R.length=f),a.applyFromCharCode(R)}(m=a.transformTo(n.uint8array?"uint8array":"array",m))},a.inherits(_,i),_.prototype.processChunk=function(m){var p=a.transformTo(n.uint8array?"uint8array":"array",m.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var c=p;(p=new Uint8Array(c.length+this.leftOver.length)).set(this.leftOver,0),p.set(c,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var f=function(v,w){var R;for((w=w||v.length)>v.length&&(w=v.length),R=w-1;0<=R&&(192&v[R])==128;)R--;return R<0||R===0?w:R+b[v[R]]>w?R:w}(p),d=p;f!==p.length&&(n.uint8array?(d=p.subarray(0,f),this.leftOver=p.subarray(f,p.length)):(d=p.slice(0,f),this.leftOver=p.slice(f,p.length))),this.push({data:h.utf8decode(d),meta:m.meta})},_.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:h.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},h.Utf8DecodeWorker=_,a.inherits(y,i),y.prototype.processChunk=function(m){this.push({data:h.utf8encode(m.data),meta:m.meta})},h.Utf8EncodeWorker=y},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,r,h){var a=e("./support"),n=e("./base64"),o=e("./nodejsUtils"),i=e("./external");function b(c){return c}function g(c,f){for(var d=0;d>8;this.dir=!!(16&this.externalFileAttributes),m==0&&(this.dosPermissions=63&this.externalFileAttributes),m==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var m=a(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=m.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=m.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=m.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=m.readInt(4))}},readExtraFields:function(m){var p,c,f,d=m.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});m.index+4>>6:(m<65536?y[f++]=224|m>>>12:(y[f++]=240|m>>>18,y[f++]=128|m>>>12&63),y[f++]=128|m>>>6&63),y[f++]=128|63&m);return y},h.buf2binstring=function(_){return g(_,_.length)},h.binstring2buf=function(_){for(var y=new a.Buf8(_.length),m=0,p=y.length;m>10&1023,v[p++]=56320|1023&c)}return g(v,p)},h.utf8border=function(_,y){var m;for((y=y||_.length)>_.length&&(y=_.length),m=y-1;0<=m&&(192&_[m])==128;)m--;return m<0||m===0?y:m+i[_[m]]>y?m:y}},{"./common":41}],43:[function(e,r,h){r.exports=function(a,n,o,i){for(var b=65535&a|0,g=a>>>16&65535|0,_=0;o!==0;){for(o-=_=2e3>>1:n>>>1;o[i]=n}return o}();r.exports=function(n,o,i,b){var g=a,_=b+i;n^=-1;for(var y=b;y<_;y++)n=n>>>8^g[255&(n^o[y])];return-1^n}},{}],46:[function(e,r,h){var a,n=e("../utils/common"),o=e("./trees"),i=e("./adler32"),b=e("./crc32"),g=e("./messages"),_=0,y=4,m=0,p=-2,c=-1,f=4,d=2,v=8,w=9,R=286,C=30,U=19,k=2*R+1,O=15,B=3,P=258,$=P+B+1,E=42,I=113,u=1,z=2,K=3,G=4;function tt(s,M){return s.msg=g[M],M}function j(s){return(s<<1)-(4s.avail_out&&(D=s.avail_out),D!==0&&(n.arraySet(s.output,M.pending_buf,M.pending_out,D,s.next_out),s.next_out+=D,M.pending_out+=D,s.total_out+=D,s.avail_out-=D,M.pending-=D,M.pending===0&&(M.pending_out=0))}function F(s,M){o._tr_flush_block(s,0<=s.block_start?s.block_start:-1,s.strstart-s.block_start,M),s.block_start=s.strstart,L(s.strm)}function q(s,M){s.pending_buf[s.pending++]=M}function V(s,M){s.pending_buf[s.pending++]=M>>>8&255,s.pending_buf[s.pending++]=255&M}function Y(s,M){var D,A,x=s.max_chain_length,T=s.strstart,N=s.prev_length,W=s.nice_match,S=s.strstart>s.w_size-$?s.strstart-(s.w_size-$):0,X=s.window,H=s.w_mask,Z=s.prev,Q=s.strstart+P,ht=X[T+N-1],it=X[T+N];s.prev_length>=s.good_match&&(x>>=2),W>s.lookahead&&(W=s.lookahead);do if(X[(D=M)+N]===it&&X[D+N-1]===ht&&X[D]===X[T]&&X[++D]===X[T+1]){T+=2,D++;do;while(X[++T]===X[++D]&&X[++T]===X[++D]&&X[++T]===X[++D]&&X[++T]===X[++D]&&X[++T]===X[++D]&&X[++T]===X[++D]&&X[++T]===X[++D]&&X[++T]===X[++D]&&TS&&--x!=0);return N<=s.lookahead?N:s.lookahead}function at(s){var M,D,A,x,T,N,W,S,X,H,Z=s.w_size;do{if(x=s.window_size-s.lookahead-s.strstart,s.strstart>=Z+(Z-$)){for(n.arraySet(s.window,s.window,Z,Z,0),s.match_start-=Z,s.strstart-=Z,s.block_start-=Z,M=D=s.hash_size;A=s.head[--M],s.head[M]=Z<=A?A-Z:0,--D;);for(M=D=Z;A=s.prev[--M],s.prev[M]=Z<=A?A-Z:0,--D;);x+=Z}if(s.strm.avail_in===0)break;if(N=s.strm,W=s.window,S=s.strstart+s.lookahead,X=x,H=void 0,H=N.avail_in,X=B)for(T=s.strstart-s.insert,s.ins_h=s.window[T],s.ins_h=(s.ins_h<=B&&(s.ins_h=(s.ins_h<=B)if(A=o._tr_tally(s,s.strstart-s.match_start,s.match_length-B),s.lookahead-=s.match_length,s.match_length<=s.max_lazy_match&&s.lookahead>=B){for(s.match_length--;s.strstart++,s.ins_h=(s.ins_h<=B&&(s.ins_h=(s.ins_h<=B&&s.match_length<=s.prev_length){for(x=s.strstart+s.lookahead-B,A=o._tr_tally(s,s.strstart-1-s.prev_match,s.prev_length-B),s.lookahead-=s.prev_length-1,s.prev_length-=2;++s.strstart<=x&&(s.ins_h=(s.ins_h<s.pending_buf_size-5&&(D=s.pending_buf_size-5);;){if(s.lookahead<=1){if(at(s),s.lookahead===0&&M===_)return u;if(s.lookahead===0)break}s.strstart+=s.lookahead,s.lookahead=0;var A=s.block_start+D;if((s.strstart===0||s.strstart>=A)&&(s.lookahead=s.strstart-A,s.strstart=A,F(s,!1),s.strm.avail_out===0)||s.strstart-s.block_start>=s.w_size-$&&(F(s,!1),s.strm.avail_out===0))return u}return s.insert=0,M===y?(F(s,!0),s.strm.avail_out===0?K:G):(s.strstart>s.block_start&&(F(s,!1),s.strm.avail_out),u)}),new rt(4,4,8,4,st),new rt(4,5,16,8,st),new rt(4,6,32,32,st),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)],h.deflateInit=function(s,M){return dt(s,M,v,15,8,0)},h.deflateInit2=dt,h.deflateReset=ft,h.deflateResetKeep=nt,h.deflateSetHeader=function(s,M){return s&&s.state?s.state.wrap!==2?p:(s.state.gzhead=M,m):p},h.deflate=function(s,M){var D,A,x,T;if(!s||!s.state||5>8&255),q(A,A.gzhead.time>>16&255),q(A,A.gzhead.time>>24&255),q(A,A.level===9?2:2<=A.strategy||A.level<2?4:0),q(A,255&A.gzhead.os),A.gzhead.extra&&A.gzhead.extra.length&&(q(A,255&A.gzhead.extra.length),q(A,A.gzhead.extra.length>>8&255)),A.gzhead.hcrc&&(s.adler=b(s.adler,A.pending_buf,A.pending,0)),A.gzindex=0,A.status=69):(q(A,0),q(A,0),q(A,0),q(A,0),q(A,0),q(A,A.level===9?2:2<=A.strategy||A.level<2?4:0),q(A,3),A.status=I);else{var N=v+(A.w_bits-8<<4)<<8;N|=(2<=A.strategy||A.level<2?0:A.level<6?1:A.level===6?2:3)<<6,A.strstart!==0&&(N|=32),N+=31-N%31,A.status=I,V(A,N),A.strstart!==0&&(V(A,s.adler>>>16),V(A,65535&s.adler)),s.adler=1}if(A.status===69)if(A.gzhead.extra){for(x=A.pending;A.gzindex<(65535&A.gzhead.extra.length)&&(A.pending!==A.pending_buf_size||(A.gzhead.hcrc&&A.pending>x&&(s.adler=b(s.adler,A.pending_buf,A.pending-x,x)),L(s),x=A.pending,A.pending!==A.pending_buf_size));)q(A,255&A.gzhead.extra[A.gzindex]),A.gzindex++;A.gzhead.hcrc&&A.pending>x&&(s.adler=b(s.adler,A.pending_buf,A.pending-x,x)),A.gzindex===A.gzhead.extra.length&&(A.gzindex=0,A.status=73)}else A.status=73;if(A.status===73)if(A.gzhead.name){x=A.pending;do{if(A.pending===A.pending_buf_size&&(A.gzhead.hcrc&&A.pending>x&&(s.adler=b(s.adler,A.pending_buf,A.pending-x,x)),L(s),x=A.pending,A.pending===A.pending_buf_size)){T=1;break}T=A.gzindexx&&(s.adler=b(s.adler,A.pending_buf,A.pending-x,x)),T===0&&(A.gzindex=0,A.status=91)}else A.status=91;if(A.status===91)if(A.gzhead.comment){x=A.pending;do{if(A.pending===A.pending_buf_size&&(A.gzhead.hcrc&&A.pending>x&&(s.adler=b(s.adler,A.pending_buf,A.pending-x,x)),L(s),x=A.pending,A.pending===A.pending_buf_size)){T=1;break}T=A.gzindexx&&(s.adler=b(s.adler,A.pending_buf,A.pending-x,x)),T===0&&(A.status=103)}else A.status=103;if(A.status===103&&(A.gzhead.hcrc?(A.pending+2>A.pending_buf_size&&L(s),A.pending+2<=A.pending_buf_size&&(q(A,255&s.adler),q(A,s.adler>>8&255),s.adler=0,A.status=I)):A.status=I),A.pending!==0){if(L(s),s.avail_out===0)return A.last_flush=-1,m}else if(s.avail_in===0&&j(M)<=j(D)&&M!==y)return tt(s,-5);if(A.status===666&&s.avail_in!==0)return tt(s,-5);if(s.avail_in!==0||A.lookahead!==0||M!==_&&A.status!==666){var W=A.strategy===2?function(S,X){for(var H;;){if(S.lookahead===0&&(at(S),S.lookahead===0)){if(X===_)return u;break}if(S.match_length=0,H=o._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++,H&&(F(S,!1),S.strm.avail_out===0))return u}return S.insert=0,X===y?(F(S,!0),S.strm.avail_out===0?K:G):S.last_lit&&(F(S,!1),S.strm.avail_out===0)?u:z}(A,M):A.strategy===3?function(S,X){for(var H,Z,Q,ht,it=S.window;;){if(S.lookahead<=P){if(at(S),S.lookahead<=P&&X===_)return u;if(S.lookahead===0)break}if(S.match_length=0,S.lookahead>=B&&0S.lookahead&&(S.match_length=S.lookahead)}if(S.match_length>=B?(H=o._tr_tally(S,1,S.match_length-B),S.lookahead-=S.match_length,S.strstart+=S.match_length,S.match_length=0):(H=o._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++),H&&(F(S,!1),S.strm.avail_out===0))return u}return S.insert=0,X===y?(F(S,!0),S.strm.avail_out===0?K:G):S.last_lit&&(F(S,!1),S.strm.avail_out===0)?u:z}(A,M):a[A.level].func(A,M);if(W!==K&&W!==G||(A.status=666),W===u||W===K)return s.avail_out===0&&(A.last_flush=-1),m;if(W===z&&(M===1?o._tr_align(A):M!==5&&(o._tr_stored_block(A,0,0,!1),M===3&&(J(A.head),A.lookahead===0&&(A.strstart=0,A.block_start=0,A.insert=0))),L(s),s.avail_out===0))return A.last_flush=-1,m}return M!==y?m:A.wrap<=0?1:(A.wrap===2?(q(A,255&s.adler),q(A,s.adler>>8&255),q(A,s.adler>>16&255),q(A,s.adler>>24&255),q(A,255&s.total_in),q(A,s.total_in>>8&255),q(A,s.total_in>>16&255),q(A,s.total_in>>24&255)):(V(A,s.adler>>>16),V(A,65535&s.adler)),L(s),0=D.w_size&&(T===0&&(J(D.head),D.strstart=0,D.block_start=0,D.insert=0),X=new n.Buf8(D.w_size),n.arraySet(X,M,H-D.w_size,D.w_size,0),M=X,H=D.w_size),N=s.avail_in,W=s.next_in,S=s.input,s.avail_in=H,s.next_in=0,s.input=M,at(D);D.lookahead>=B;){for(A=D.strstart,x=D.lookahead-(B-1);D.ins_h=(D.ins_h<>>=B=O>>>24,w-=B,(B=O>>>16&255)===0)z[g++]=65535&O;else{if(!(16&B)){if(!(64&B)){O=R[(65535&O)+(v&(1<>>=B,w-=B),w<15&&(v+=u[i++]<>>=B=O>>>24,w-=B,!(16&(B=O>>>16&255))){if(!(64&B)){O=C[(65535&O)+(v&(1<>>=B,w-=B,(B=g-_)<$){if(c<(B=$-B)&&o.sane){a.msg="invalid distance too far back",o.mode=30;break t}if(I=d,(E=0)===f){if(E+=p-B,B>3,v&=(1<<(w-=P<<3))-1,a.next_in=i,a.next_out=g,a.avail_in=i>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function v(){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 w(E){var I;return E&&E.state?(I=E.state,E.total_in=E.total_out=I.total=0,E.msg="",I.wrap&&(E.adler=1&I.wrap),I.mode=p,I.last=0,I.havedict=0,I.dmax=32768,I.head=null,I.hold=0,I.bits=0,I.lencode=I.lendyn=new a.Buf32(c),I.distcode=I.distdyn=new a.Buf32(f),I.sane=1,I.back=-1,y):m}function R(E){var I;return E&&E.state?((I=E.state).wsize=0,I.whave=0,I.wnext=0,w(E)):m}function C(E,I){var u,z;return E&&E.state?(z=E.state,I<0?(u=0,I=-I):(u=1+(I>>4),I<48&&(I&=15)),I&&(I<8||15=G.wsize?(a.arraySet(G.window,I,u-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize):(z<(K=G.wsize-G.wnext)&&(K=z),a.arraySet(G.window,I,u-z,K,G.wnext),(z-=K)?(a.arraySet(G.window,I,u-z,z,0),G.wnext=z,G.whave=G.wsize):(G.wnext+=K,G.wnext===G.wsize&&(G.wnext=0),G.whave>>8&255,u.check=o(u.check,T,2,0),F=L=0,u.mode=2;break}if(u.flags=0,u.head&&(u.head.done=!1),!(1&u.wrap)||(((255&L)<<8)+(L>>8))%31){E.msg="incorrect header check",u.mode=30;break}if((15&L)!=8){E.msg="unknown compression method",u.mode=30;break}if(F-=4,s=8+(15&(L>>>=4)),u.wbits===0)u.wbits=s;else if(s>u.wbits){E.msg="invalid window size",u.mode=30;break}u.dmax=1<>8&1),512&u.flags&&(T[0]=255&L,T[1]=L>>>8&255,u.check=o(u.check,T,2,0)),F=L=0,u.mode=3;case 3:for(;F<32;){if(j===0)break t;j--,L+=z[G++]<>>8&255,T[2]=L>>>16&255,T[3]=L>>>24&255,u.check=o(u.check,T,4,0)),F=L=0,u.mode=4;case 4:for(;F<16;){if(j===0)break t;j--,L+=z[G++]<>8),512&u.flags&&(T[0]=255&L,T[1]=L>>>8&255,u.check=o(u.check,T,2,0)),F=L=0,u.mode=5;case 5:if(1024&u.flags){for(;F<16;){if(j===0)break t;j--,L+=z[G++]<>>8&255,u.check=o(u.check,T,2,0)),F=L=0}else u.head&&(u.head.extra=null);u.mode=6;case 6:if(1024&u.flags&&(j<(Y=u.length)&&(Y=j),Y&&(u.head&&(s=u.head.extra_len-u.length,u.head.extra||(u.head.extra=new Array(u.head.extra_len)),a.arraySet(u.head.extra,z,G,Y,s)),512&u.flags&&(u.check=o(u.check,z,Y,G)),j-=Y,G+=Y,u.length-=Y),u.length))break t;u.length=0,u.mode=7;case 7:if(2048&u.flags){if(j===0)break t;for(Y=0;s=z[G+Y++],u.head&&s&&u.length<65536&&(u.head.name+=String.fromCharCode(s)),s&&Y>9&1,u.head.done=!0),E.adler=u.check=0,u.mode=12;break;case 10:for(;F<32;){if(j===0)break t;j--,L+=z[G++]<>>=7&F,F-=7&F,u.mode=27;break}for(;F<3;){if(j===0)break t;j--,L+=z[G++]<>>=1)){case 0:u.mode=14;break;case 1:if(P(u),u.mode=20,I!==6)break;L>>>=2,F-=2;break t;case 2:u.mode=17;break;case 3:E.msg="invalid block type",u.mode=30}L>>>=2,F-=2;break;case 14:for(L>>>=7&F,F-=7&F;F<32;){if(j===0)break t;j--,L+=z[G++]<>>16^65535)){E.msg="invalid stored block lengths",u.mode=30;break}if(u.length=65535&L,F=L=0,u.mode=15,I===6)break t;case 15:u.mode=16;case 16:if(Y=u.length){if(j>>=5,F-=5,u.ndist=1+(31&L),L>>>=5,F-=5,u.ncode=4+(15&L),L>>>=4,F-=4,286>>=3,F-=3}for(;u.have<19;)u.lens[N[u.have++]]=0;if(u.lencode=u.lendyn,u.lenbits=7,D={bits:u.lenbits},M=b(0,u.lens,0,19,u.lencode,0,u.work,D),u.lenbits=D.bits,M){E.msg="invalid code lengths set",u.mode=30;break}u.have=0,u.mode=19;case 19:for(;u.have>>16&255,ot=65535&x,!((et=x>>>24)<=F);){if(j===0)break t;j--,L+=z[G++]<>>=et,F-=et,u.lens[u.have++]=ot;else{if(ot===16){for(A=et+2;F>>=et,F-=et,u.have===0){E.msg="invalid bit length repeat",u.mode=30;break}s=u.lens[u.have-1],Y=3+(3&L),L>>>=2,F-=2}else if(ot===17){for(A=et+3;F>>=et)),L>>>=3,F-=3}else{for(A=et+7;F>>=et)),L>>>=7,F-=7}if(u.have+Y>u.nlen+u.ndist){E.msg="invalid bit length repeat",u.mode=30;break}for(;Y--;)u.lens[u.have++]=s}}if(u.mode===30)break;if(u.lens[256]===0){E.msg="invalid code -- missing end-of-block",u.mode=30;break}if(u.lenbits=9,D={bits:u.lenbits},M=b(g,u.lens,0,u.nlen,u.lencode,0,u.work,D),u.lenbits=D.bits,M){E.msg="invalid literal/lengths set",u.mode=30;break}if(u.distbits=6,u.distcode=u.distdyn,D={bits:u.distbits},M=b(_,u.lens,u.nlen,u.ndist,u.distcode,0,u.work,D),u.distbits=D.bits,M){E.msg="invalid distances set",u.mode=30;break}if(u.mode=20,I===6)break t;case 20:u.mode=21;case 21:if(6<=j&&258<=J){E.next_out=tt,E.avail_out=J,E.next_in=G,E.avail_in=j,u.hold=L,u.bits=F,i(E,V),tt=E.next_out,K=E.output,J=E.avail_out,G=E.next_in,z=E.input,j=E.avail_in,L=u.hold,F=u.bits,u.mode===12&&(u.back=-1);break}for(u.back=0;rt=(x=u.lencode[L&(1<>>16&255,ot=65535&x,!((et=x>>>24)<=F);){if(j===0)break t;j--,L+=z[G++]<>nt)])>>>16&255,ot=65535&x,!(nt+(et=x>>>24)<=F);){if(j===0)break t;j--,L+=z[G++]<>>=nt,F-=nt,u.back+=nt}if(L>>>=et,F-=et,u.back+=et,u.length=ot,rt===0){u.mode=26;break}if(32&rt){u.back=-1,u.mode=12;break}if(64&rt){E.msg="invalid literal/length code",u.mode=30;break}u.extra=15&rt,u.mode=22;case 22:if(u.extra){for(A=u.extra;F>>=u.extra,F-=u.extra,u.back+=u.extra}u.was=u.length,u.mode=23;case 23:for(;rt=(x=u.distcode[L&(1<>>16&255,ot=65535&x,!((et=x>>>24)<=F);){if(j===0)break t;j--,L+=z[G++]<>nt)])>>>16&255,ot=65535&x,!(nt+(et=x>>>24)<=F);){if(j===0)break t;j--,L+=z[G++]<>>=nt,F-=nt,u.back+=nt}if(L>>>=et,F-=et,u.back+=et,64&rt){E.msg="invalid distance code",u.mode=30;break}u.offset=ot,u.extra=15&rt,u.mode=24;case 24:if(u.extra){for(A=u.extra;F>>=u.extra,F-=u.extra,u.back+=u.extra}if(u.offset>u.dmax){E.msg="invalid distance too far back",u.mode=30;break}u.mode=25;case 25:if(J===0)break t;if(Y=V-J,u.offset>Y){if((Y=u.offset-Y)>u.whave&&u.sane){E.msg="invalid distance too far back",u.mode=30;break}at=Y>u.wnext?(Y-=u.wnext,u.wsize-Y):u.wnext-Y,Y>u.length&&(Y=u.length),st=u.window}else st=K,at=tt-u.offset,Y=u.length;for(Jk?(B=at[st+f[I]],F[q+f[I]]):(B=96,0),v=1<>tt)+(w-=v)]=O<<24|B<<16|P|0,w!==0;);for(v=1<>=1;if(v!==0?(L&=v-1,L+=v):L=0,I++,--V[E]==0){if(E===z)break;E=_[y+f[I]]}if(K>>7)]}function q(x,T){x.pending_buf[x.pending++]=255&T,x.pending_buf[x.pending++]=T>>>8&255}function V(x,T,N){x.bi_valid>d-N?(x.bi_buf|=T<>d-x.bi_valid,x.bi_valid+=N-d):(x.bi_buf|=T<>>=1,N<<=1,0<--T;);return N>>>1}function st(x,T,N){var W,S,X=new Array(f+1),H=0;for(W=1;W<=f;W++)X[W]=H=H+N[W-1]<<1;for(S=0;S<=T;S++){var Z=x[2*S+1];Z!==0&&(x[2*S]=at(X[Z]++,Z))}}function et(x){var T;for(T=0;T>1;1<=N;N--)nt(x,X,N);for(S=Q;N=x.heap[1],x.heap[1]=x.heap[x.heap_len--],nt(x,X,1),W=x.heap[1],x.heap[--x.heap_max]=N,x.heap[--x.heap_max]=W,X[2*S]=X[2*N]+X[2*W],x.depth[S]=(x.depth[N]>=x.depth[W]?x.depth[N]:x.depth[W])+1,X[2*N+1]=X[2*W+1]=S,x.heap[1]=S++,nt(x,X,1),2<=x.heap_len;);x.heap[--x.heap_max]=x.heap[1],function(it,mt){var wt,bt,Et,ut,Tt,Lt,xt=mt.dyn_tree,Gt=mt.max_code,he=mt.stat_desc.static_tree,le=mt.stat_desc.has_stree,ce=mt.stat_desc.extra_bits,Wt=mt.stat_desc.extra_base,Rt=mt.stat_desc.max_length,St=0;for(ut=0;ut<=f;ut++)it.bl_count[ut]=0;for(xt[2*it.heap[it.heap_max]+1]=0,wt=it.heap_max+1;wt>=7;S>>=1)if(1&ht&&Z.dyn_ltree[2*Q]!==0)return n;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 n}(x)),dt(x,x.l_desc),dt(x,x.d_desc),H=function(Z){var Q;for(s(Z,Z.dyn_ltree,Z.l_desc.max_code),s(Z,Z.dyn_dtree,Z.d_desc.max_code),dt(Z,Z.bl_desc),Q=p-1;3<=Q&&Z.bl_tree[2*P[Q]+1]===0;Q--);return Z.opt_len+=3*(Q+1)+5+5+4,Q}(x),S=x.opt_len+3+7>>>3,(X=x.static_len+3+7>>>3)<=S&&(S=X)):S=X=N+5,N+4<=S&&T!==-1?A(x,T,N,W):x.strategy===4||X===S?(V(x,2+(W?1:0),3),ft(x,$,E)):(V(x,4+(W?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,x.pending_buf[x.d_buf+2*x.last_lit+1]=255&T,x.pending_buf[x.l_buf+x.last_lit]=255&N,x.last_lit++,T===0?x.dyn_ltree[2*N]++:(x.matches++,T--,x.dyn_ltree[2*(u[N]+_+1)]++,x.dyn_dtree[2*F(T)]++),x.last_lit===x.lit_bufsize-1},h._tr_align=function(x){V(x,2,3),Y(x,w,$),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)}(x)}},{"../utils/common":41}],53:[function(e,r,h){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,h){(function(a){(function(n,o){if(!n.setImmediate){var i,b,g,_,y=1,m={},p=!1,c=n.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(n);f=f&&f.setTimeout?f:n,i={}.toString.call(n.process)==="[object process]"?function(R){process.nextTick(function(){v(R)})}:function(){if(n.postMessage&&!n.importScripts){var R=!0,C=n.onmessage;return n.onmessage=function(){R=!1},n.postMessage("","*"),n.onmessage=C,R}}()?(_="setImmediate$"+Math.random()+"$",n.addEventListener?n.addEventListener("message",w,!1):n.attachEvent("onmessage",w),function(R){n.postMessage(_+R,"*")}):n.MessageChannel?((g=new MessageChannel).port1.onmessage=function(R){v(R.data)},function(R){g.port2.postMessage(R)}):c&&"onreadystatechange"in c.createElement("script")?(b=c.documentElement,function(R){var C=c.createElement("script");C.onreadystatechange=function(){v(R),C.onreadystatechange=null,b.removeChild(C),C=null},b.appendChild(C)}):function(R){setTimeout(v,0,R)},f.setImmediate=function(R){typeof R!="function"&&(R=new Function(""+R));for(var C=new Array(arguments.length-1),U=0;U"u"?a===void 0?this:a:self)}).call(this,typeof Ft<"u"?Ft:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(oe);var We=oe.exports;const je=Ge(We);async function Xe(l,t=void 0){let e=await fetch(l);e.headers.get("Content-Length");let r=await e.arrayBuffer();return Ye(r,He(l))}async function Ye(l,t=void 0){var _,y,m,p;let e=new Uint8Array(l);if(console.log("firstByte:",e[0]),e[0]!=80){let c=Ze(t);console.log("key=",t),console.log("keyBuf=",c);let f=0;for(var r=0;r{let h=new Image;h.src=`data:${l};base64, ${t}`,h.onload=()=>{e(h)},h.onerror=r})}function He(l){let e=/[0-9a-z]{24}/i.exec(l);if(e!=null)return e[0]}function Ze(l){for(var t=new ArrayBuffer(l.length*2),e=new Uint16Array(t),r=0,h=l.length;r1&&w<1/_?w=(1/_-g)/(1/_-1)*(w-1)+g:w>=1/_&&(w=_*w+(1/_-1)),v=w*m.visibleFontSize/m.maxScale,v*this.bestFitScale>m.visibleFontSize*1.2&&(v=m.visibleFontSize*1.2/h),d.center.fontHeight=v}}n.sort((U,k)=>k.fontHeight-U.fontHeight),this.digits=y,this.centers=n,this.vertexArray=new Float32Array(y*12),this.texCoordArray=new Float32Array(y*12);for(var R=0,b=0;be)t=this.vertexArray.length/2;else for(var h=this.centers.length-1;h>=0;h--)if(this.centers[h].fontHeight*r>this.fillerData.config.visibleFontSize){t=this.centers[h].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,h,a){const n=h.label,o=n.length,i=h.fontHeight*a,b=h.fontHeight,g=i*o,_=h.x-g/2,y=h.y-b/2;for(var m=0;m= 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,ct(r,r.VERTEX_SHADER,this.vertexShaderCode),ct(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=lt.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,h=800){let a=new $e(t,e,r,0),n=new re(h,()=>{a.progress=n.value()},()=>{});this.scene.addAnimator(n),this.animatingAreas.push(a)}fillPoint(t,e,r,h,a){for(var n=0;ny.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)}initTask(){let t=this.fillerData.taskList;const e=this.fillerData.width,r=this.fillerData.height;for(let n of t){let o=this.fillerData.data.areaHash.get(n);if(o){pt(this.positionArray,0,o.rect.x,o.rect.y,o.rect.width,o.rect.height),pt(this.texCoordArray,0,o.rect.x/e,o.rect.y/r,o.rect.width/e,o.rect.height/r),this.fillPoint(this.centerArray,0,o.center.x,o.center.y,6);var h=new gt(o.id);h.fillFloatArray(this.areaIdArray,0,6);var a=jt(o.rect,o.center.x,o.center.y);console.log("rect=",o.rect,a,o.center.x,o.center.y),this.fillNumber(this.progressArray,0,1,6),this.fillNumber(this.maxRadiusArray,0,a,6);const i=this.scene.gl;i.bindBuffer(i.ARRAY_BUFFER,this.positionBuffer),i.bufferData(i.ARRAY_BUFFER,this.positionArray,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,this.texCoordBuffer),i.bufferData(i.ARRAY_BUFFER,this.texCoordArray,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,this.areaIdBuffer),i.bufferData(i.ARRAY_BUFFER,this.areaIdArray,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,this.centerBuffer),i.bufferData(i.ARRAY_BUFFER,this.centerArray,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,this.progressBuffer),i.bufferData(i.ARRAY_BUFFER,this.progressArray,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,this.maxRadiusBuffer),i.bufferData(i.ARRAY_BUFFER,this.maxRadiusArray,i.STATIC_DRAW),this.draw(6)}}}}class Je extends yt{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 qe(t,e);const r=t.gl;this.program=vt(r,ct(r,r.VERTEX_SHADER,this.vertexShaderCode),ct(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=Xt(r,0,0,e.width,e.height),this.texCoordBuffer=Xt(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(){this.animatableMask.initTask(),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,h){var i,b,g;let a=this.fillerData;if(a.currentGroup==null){(i=a.callback)==null||i.onFillFailed();return}const n=a.data.groupAreaHash(a.currentGroup);let o=this.fillerData.getArea(t,e,50,n);o!=null&&(this.animatableMask.addArea(o,t,e),a.setColored(o,a.currentGroup.color,t,e),(b=a.callback)==null||b.onFillSuccess(),a.currentGroup.isAllColored&&(a.switchToNextGroup()||(g=a.callback)==null||g.onFinish()))}async replay(){const t=this.scene.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.animatableMask.fb),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.bindFramebuffer(t.FRAMEBUFFER,null);for(let e of this.fillerData.taskList){let r=this.fillerData.data.areaHash.get(e);r&&(this.animatableMask.addArea(r,r.center.x,r.center.y,200),this.scene.invalidate(),await Ke(200))}}}const Ke=l=>new Promise(t=>setTimeout(t,l));class Qe{constructor(t={}){this.startTime=0,this.overlay=document.getElementById("loading-overlay"),this.config={minDisplayTime:500,fadeDuration:300,...t}}show(){this.startTime=Date.now(),this.overlay.classList.add("active")}async hide(){const t=Date.now()-this.startTime,e=Math.max(this.config.minDisplayTime-t,0);await new Promise(r=>setTimeout(r,e)),this.overlay.classList.remove("active"),await new Promise(r=>setTimeout(r,this.config.fadeDuration))}async wrap(t){try{return this.show(),await t}finally{await this.hide()}}}function Ot(l,t){if(!(l instanceof t))throw new TypeError("Cannot call a class as a function")}function tr(l,t){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:0,r=Math.random()*(t-l)+l;return Math.floor(r*Math.pow(10,e))/Math.pow(10,e)}function Ht(l){return l[_t(0,l.length)]}var rr=.00125,ir=5e-4,ar=9e-4,nr=1e-5,or=6,sr=80,hr=.9,lr=1.7,cr=.2,ur=.6,fr=.03,dr=.07,Zt=15,Vt=82,pr=150,mr=100,gr=250,_r=40,vr=["#fcf403","#62fc03","#f4fc03","#03e7fc","#03fca5","#a503fc","#fc03ad","#fc03c2"];function $t(l){var t=1920;return Math.log(l)/Math.log(t)}var qt=function(){function l(t){Ot(this,l);var e=t.initialPosition,r=t.direction,h=t.confettiRadius,a=t.confettiColors,n=t.emojis,o=t.emojiSize,i=t.canvasWidth,b=_t(hr,lr,3),g=b*$t(i);this.confettiSpeed={x:g,y:g},this.finalConfettiSpeedX=_t(cr,ur,3),this.rotationSpeed=n.length?.01:_t(fr,dr,3)*$t(i),this.dragForceCoefficient=_t(ir,ar,6),this.radius={x:h,y:h},this.initialRadius=h,this.rotationAngle=r==="left"?_t(0,.2,3):_t(-.2,0,3),this.emojiSize=o,this.emojiRotationAngle=_t(0,2*Math.PI),this.radiusYUpdateDirection="down";var _=r==="left"?_t(Vt,Zt)*Math.PI/180:_t(-Zt,-Vt)*Math.PI/180;this.absCos=Math.abs(Math.cos(_)),this.absSin=Math.abs(Math.sin(_));var y=_t(-pr,0),m={x:e.x+(r==="left"?-y:y)*this.absCos,y:e.y-y*this.absSin};this.currentPosition=Object.assign({},m),this.initialPosition=Object.assign({},m),this.color=n.length?null:Ht(a),this.emoji=n.length?Ht(n):null,this.createdAt=new Date().getTime(),this.direction=r}return Nt(l,[{key:"draw",value:function(e){var r=this.currentPosition,h=this.radius,a=this.color,n=this.emoji,o=this.rotationAngle,i=this.emojiRotationAngle,b=this.emojiSize,g=window.devicePixelRatio;a?(e.fillStyle=a,e.beginPath(),e.ellipse(r.x*g,r.y*g,h.x*g,h.y*g,o,0,2*Math.PI),e.fill()):n&&(e.font="".concat(b,"px serif"),e.save(),e.translate(g*r.x,g*r.y),e.rotate(i),e.textAlign="center",e.fillText(n,0,0),e.restore())}},{key:"updatePosition",value:function(e,r){var h=this.confettiSpeed,a=this.dragForceCoefficient,n=this.finalConfettiSpeedX,o=this.radiusYUpdateDirection,i=this.rotationSpeed,b=this.createdAt,g=this.direction,_=r-b;if(h.x>n&&(this.confettiSpeed.x-=a*e),this.currentPosition.x+=h.x*(g==="left"?-this.absCos:this.absCos)*e,this.currentPosition.y=this.initialPosition.y-h.y*this.absSin*_+rr*Math.pow(_,2)/2,this.rotationSpeed-=this.emoji?1e-4:nr*e,this.rotationSpeed<0&&(this.rotationSpeed=0),this.emoji){this.emojiRotationAngle+=this.rotationSpeed*e%(2*Math.PI);return}o==="down"?(this.radius.y-=e*i,this.radius.y<=0&&(this.radius.y=0,this.radiusYUpdateDirection="up")):(this.radius.y+=e*i,this.radius.y>=this.initialRadius&&(this.radius.y=this.initialRadius,this.radiusYUpdateDirection="down"))}},{key:"getIsVisibleOnCanvas",value:function(e){return this.currentPosition.y0&&arguments[0]!==void 0?arguments[0]:{};Ot(this,l),this.activeConfettiBatches=[],this.canvas=t.canvas||br(),this.canvasContext=this.canvas.getContext("2d"),this.requestAnimationFrameRequested=!1,this.lastUpdated=new Date().getTime(),this.iterationIndex=0,this.loop=this.loop.bind(this),requestAnimationFrame(this.loop)}return Nt(l,[{key:"loop",value:function(){this.requestAnimationFrameRequested=!1,er(this.canvas);var e=new Date().getTime(),r=e-this.lastUpdated,h=this.canvas.offsetHeight,a=this.iterationIndex%10===0;this.activeConfettiBatches=this.activeConfettiBatches.filter(function(n){return n.processShapes({timeDelta:r,currentTime:e},h,a),a?!n.complete():!0}),this.iterationIndex++,this.queueAnimationFrameIfNeeded(e)}},{key:"queueAnimationFrameIfNeeded",value:function(e){this.requestAnimationFrameRequested||this.activeConfettiBatches.length<1||(this.requestAnimationFrameRequested=!0,this.lastUpdated=e||new Date().getTime(),requestAnimationFrame(this.loop))}},{key:"addConfetti",value:function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=xr(e),h=r.confettiRadius,a=r.confettiNumber,n=r.confettiColors,o=r.emojis,i=r.emojiSize,b=this.canvas.getBoundingClientRect(),g=b.width,_=b.height,y=_*5/7,m={x:0,y},p={x:g,y},c=new yr(this.canvasContext),f=0;fn.updateViewport()),(R=document.querySelector("#toggleTestLayer"))==null||R.addEventListener("click",()=>n.toggleTestLayer()),(C=document.querySelector("#reduction"))==null||C.addEventListener("click",()=>n.resetToBestFit()),(U=document.querySelector("#hint"))==null||U.addEventListener("click",()=>Br(o,n)),(k=document.querySelector("#goback"))==null||k.addEventListener("click",()=>Dt(n,w,o)),(O=document.querySelector("#setting"))==null||O.addEventListener("click",()=>Dr()),(B=document.querySelector("#save"))==null||B.addEventListener("click",()=>Qt(l,f)),window.addEventListener("beforeunload",P=>Qt(l,f)),document.addEventListener("click",P=>te(P)),document.addEventListener("touchstart",P=>te(P));let b=document.getElementById("action-sheet");b.addEventListener("click",P=>ee(P)),b.addEventListener("touchstart",P=>ee(P));let g=document.getElementById("sound");g.checked=i.sound,g.addEventListener("click",P=>Ur(P,f));let _=document.getElementById("vibrate");_.checked=i.vibrate,_.addEventListener("click",P=>Pr(P,f));let y=document.getElementById("autonext");y.checked=i.autoNext,y.addEventListener("click",P=>zr(P,f));let m;l=="test"?m=await Er():m=await Xe(t),e.hide();let p=[],c=localStorage.getItem(l);c&&(p=JSON.parse(c));let f=new De(new Ie(i),m,h,p,{onFillFailed(){console.log("填充失败")},onFillSuccess(){var P;console.log("填充成功"),f.config.settings.vibrate&&Lr(),Jt(f.data.coloredPercent),Cr(f.currentGroupIndex,f.currentGroup.progressPercent),(P=f.currentGroup)!=null&&P.isAllColored&&(f.config.settings.sound&&o.playAudio(Bt.ColorDone),kr(f)),Mt=!0},onSwitchGroup(){let P=f.currentGroupIndex;console.log(`切换到下一个group ${P}`),se(P),Sr(f)},onFinish(){Dt(n,w,o)}});n.fillerData=f,console.log("resource",m),n.setContentPadding(new ie(50,50,50,220));let d=f.width,v=f.height;n.setContentSize(d,v),m.bg&&n.addLayer(new ye(n,m.bg,n.width,n.height,ae.Repeat)),n.addLayer(new Te(n,0,0,d,v)),n.addLayer(new ze(n,f)),n.addLayer(new Ve(n,m.numberImage,f,1));let w=new Je(n,f);n.addLayer(w),n.addLayer(new Ne(n,m.page,d,v)),n.addLayer(new Ce(n,0,0,f.width,f.height,4280427042)),Rr(f),Jt(f.data.coloredPercent),w.initTask(),f.data.coloredPercent>=100&&Dt(n,w,null)}async function Er(){let l="/assets/unzipped/friend",t=[fetch(`${l}/config.json`).then(i=>i.json()),Ct(`${l}/page.png`),Ct(`${l}/map.png`),Ct("/assets/fonts/numbers_roboto_500.png"),Ct("/assets/bg/seamless2.png")],[e,r,h,a,n,o]=await Promise.all(t);return new ne(e,r,h,a,[],o,n)}function Rr(l){let t=l.data.areaGroups,e=[],r=[],h=[],a,n;for(var o=0;o`),r.push(` `),r.push(`
`),r.push("✓"),r.push("
"),r.push("")):(a===l.currentGroup||a.progressPercent>0,e.push(`
`),e.push(` `),e.push(`
`),e.push(`${o+1}`),e.push("
"),e.push("
"));h=e.concat(r);let i=document.querySelector("#color-btns");i!=null&&(i.innerHTML=h.join("")),se(l.currentGroupIndex);for(var o=0;o{y.classList.remove("color-btn-container-selected")}),b.classList.add("color-btn-container-selected")}}function Jt(l){let t=document.getElementById("progress"),e=document.getElementById("percent");e.innerText=`${l}%`,t.style.width=`${l}%`}function se(l){document.querySelectorAll(".color-btn-container").forEach(e=>{e.classList.remove("color-btn-container-selected")});let t=document.getElementById(`color-btn-container-${l}`);t==null||t.classList.add("color-btn-container-selected")}function Cr(l,t){const e=document.getElementById(`color-btn-container-${l}`),r=document.getElementById(`color-btn-progress-ring-value-${l}`),a=e.clientWidth*.45,n=2*Math.PI*a,o=n-t*n/100;if(r.style.strokeDashoffset=o.toString(),t>=100){const i=document.getElementById(`color-btn-${l}`);i.innerText="✓"}}function Tr(l,t){const e=document.getElementById(`color-btn-container-${l}`),r=document.getElementById(`color-btn-progress-ring-value-${l}`),a=e.clientWidth*.45,n=2*Math.PI*a,o=n-t*n/100;r.style.strokeDasharray=`${n} ${n}`,r.style.strokeDashoffset=o.toString()}function Sr(l){let t=document.getElementById("color-btns"),e=document.body.clientWidth/(t.scrollWidth/l.data.areaGroups.length),r=document.body.clientWidth/e,h=t.scrollWidth/l.data.areaGroups.length*(l.currentGroupIndex-l.doneBeforeCount)-e*r/2+r/2;h=h<0?0:h;try{t.scroll({left:h,top:0,behavior:"smooth"})}catch(a){console.log(a),t.scrollLeft=h}}function Fr(l,t,e){let r=document.createElement("canvas");r.className="finish-ani-canvas";let h=l.getBoundingClientRect();r.style.left=`${h.left-50}px`,r.style.top=`${h.top-50}px`,r.style.width=`${h.width+100}px`,r.style.height=`${h.height+100}px`,document.body.append(r),new Be(r,t,50,()=>{e(),r.remove()}).explode()}function kr(l){let t=l.currentGroupIndex,e=new gt(l.currentGroup.color).css(),r=document.getElementById("color-btns"),h=document.getElementById(`color-btn-container-${t}`);setTimeout(()=>{h.style.visibility="hidden",Fr(h,e,()=>{r.lastElementChild.after(h),h.style.visibility="visible"})},300)}function Dt(l,t,e){const r=document.getElementById("toolbar-bottom"),h=document.getElementById("save"),a=document.getElementById("setting"),n=document.getElementById("reduction"),o=document.getElementById("hint");setTimeout(()=>{l.fillerData.config.settings.sound&&(e==null||e.playAudio(Bt.AllDone)),l.resetToResult(),r.classList.add("hidden-toolbar-bottom"),h.classList.add("hidden-toolbar-right"),a.classList.add("hidden-toolbar-right"),n.classList.add("hidden-toolbar-right"),o.classList.add("hidden-toolbar-right"),setTimeout(()=>{h.style.display="none",a.style.display="none",n.style.display="none",o.style.display="none",l.addLayer(new Se(l,-10,-10,l.fillerData.width+20,l.fillerData.height+20,4288401133,40)),t.replay()},1e3)},300);let i=document.getElementById("finish-btn");i.addEventListener("touchmove",_=>_.preventDefault()),i.style.display="flex",document.getElementById("finish-playback").addEventListener("click",()=>t.replay());let g=document.getElementById("finish-continue");g.addEventListener("mouseenter",()=>g.style.backgroundImage="linear-gradient(-180deg, #f6b061, #fe5a2c)"),g.addEventListener("mouseleave",()=>g.style.backgroundImage="linear-gradient(-180deg, #FFC787 12%, #FF9274 90%)"),g.addEventListener("click",()=>Kt()),g.addEventListener("touchstart",()=>g.style.backgroundImage="linear-gradient(-180deg, #f6b061, #fe5a2c)"),g.addEventListener("touchend",_=>{_.preventDefault(),g.style.backgroundImage="linear-gradient(-180deg, #FFC787 12%, #FF9274 90%)",Kt()}),setTimeout(()=>{Ir(),i.style.opacity="1"},1e3)}function Br(l,t){var e;(e=t.fillerData)!=null&&e.config.settings.sound&&l.playAudio(Bt.Hint),t.hint()}function Kt(){document.referrer.includes(window.location.hostname)?window.history.back():window.location.href="/"}function Lr(){var l="vibrate"in navigator;console.log("supportVibrate: "+l),l&&navigator.vibrate(30)}function Ut(l){const t=document.getElementById("toast");t&&(t.textContent=l,t.classList.remove("toast-hidden"),setTimeout(()=>t.classList.add("toast-hidden"),2500))}var Mt=!1;function Qt(l,t){const e="__storage_metadata__",r=n=>{const o=localStorage.getItem(e),i=o?JSON.parse(o):{};i[n]={progress:t.data.coloredPercent,timestamp:Date.now()},localStorage.setItem(e,JSON.stringify(i))},h=()=>{const n=localStorage.getItem(e);if(!n)return;const o=JSON.parse(n);let i;for(let b of Object.entries(o)){if(!i){i=b;continue}b[1].timestamp{localStorage.removeItem(n);const o=localStorage.getItem(e);if(!o)return;const i=JSON.parse(o);delete i[n],localStorage.setItem(e,JSON.stringify(i))};if(Mt)for(localStorage.setItem(l,JSON.stringify(t.taskList)),Mt=!1;;)try{return localStorage.setItem(l,JSON.stringify(t.taskList)),r(l),Ut("save success"),!0}catch(n){if(n.name==="QuotaExceededError"){const i=h();if(!i||i===l)return console.error("Storage full and cannot free space"),Ut("Storage full and cannot free space"),!1;a(i)}else throw n}t.data.coloredPercent<100&&Ut("nothing to save")}function Ir(){new Ar().addConfetti()}function te(l){let t=l.target,e=document.getElementById("setting");if(e==t||e.contains(t))return;let r=document.getElementById("action-sheet");r.style.bottom=="0px"&&(r.style.bottom="-1000px")}function ee(l){l.stopPropagation()}function Dr(){let l=document.getElementById("action-sheet");l.style.bottom="0px"}function Ur(l,t){if(l.target.id=="sound"){t.config.settings.sound=l.target.checked;let e=localStorage.getItem("settings")||"{}",r=JSON.parse(e);r.sound=t.config.settings.sound,localStorage.setItem("settings",JSON.stringify(r))}}function Pr(l,t){if(l.target.id=="vibrate"){t.config.settings.vibrate=l.target.checked;let e=localStorage.getItem("settings")||"{}",r=JSON.parse(e);r.vibrate=t.config.settings.vibrate,localStorage.setItem("settings",JSON.stringify(r))}}function zr(l,t){if(l.target.id=="autonext"){t.config.settings.autoNext=l.target.checked;let e=localStorage.getItem("settings")||"{}",r=JSON.parse(e);r.autoNext=t.config.settings.autoNext,localStorage.setItem("settings",JSON.stringify(r))}}