0&&s.filters.forEach((e=>{if("brightness"===e.type)c.push({type:"color matrix",value:[e.value,0,0,0,0,0,e.value,0,0,0,0,0,e.value,0,0,0,0,0,1,0]});else if("contrast"===e.type){const t=.5*(1-e.value);c.push({type:"color matrix",value:[e.value,0,0,0,t,0,e.value,0,0,t,0,0,e.value,0,t,0,0,0,1,0]})}else if("hue-rotate"===e.type){const t=(0,p.angleToRadian)(e.value),n=Math.cos(t),r=Math.sin(t),o=.213,i=.715,a=.072;c.push({type:"color matrix",value:[o+n*(1-o)+r*-o,i+n*-i+r*-i,a+n*-a+r*(1-a),0,0,o+n*-o+.143*r,i+n*(1-i)+.14*r,a+n*-a+-.283*r,0,0,o+n*-o+r*-(1-o),i+n*-i+r*i,a+n*(1-a)+r*a,0,0,0,0,0,1,0]})}else if("saturate"===e.type){const t=2*(e.value-1)/3+1,n=-.5*(t-1);c.push({type:"color matrix",value:[t,n,n,0,0,n,t,n,0,0,n,n,t,0,0,0,0,0,1,0]})}else if("grayscale"===e.type){const t=1-e.value;c.push({type:"color matrix",value:[.2126+.7874*t,.7152-.7152*t,.0722-.0722*t,0,0,.2126-.2126*t,.7152+.2848*t,.0722-.0722*t,0,0,.2126-.2126*t,.7152-.7152*t,.0722+.9278*t,0,0,0,0,0,1,0]})}else if("sepia"===e.type){const t=1-e.value;c.push({type:"color matrix",value:[.393+.607*t,.769-.769*t,.189-.189*t,0,0,.349-.349*t,.686+.314*t,.168-.168*t,0,0,.272-.272*t,.534-.534*t,.131+.869*t,0,0,0,0,0,1,0]})}else if("invert"===e.type){const t=1-2*e.value;c.push({type:"color matrix",value:[t,0,0,0,e.value,0,t,0,0,e.value,0,0,t,0,e.value,0,0,0,1,0]})}else"opacity"===e.type?c.push({type:"color matrix",value:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,e.value,0]}):"blur"===e.type&&c.push({type:"blur",value:[0,3*e.value/7/o]},{type:"blur",value:[3*e.value/7/r,0]})})),{type:"texture",x:t,y:n,width:r,height:o,src:l,opacity:null==s?void 0:s.opacity,filters:c.length>0?c:void 0}}function A(e,t,n,r=1){return n&&(t||(t=l.m3.identity()),n.translate&&(t=l.m3.multiply(t,l.m3.translation(n.translate.x,n.translate.y))),n.base&&(n.angle||n.rotation)&&(t=l.m3.multiply(t,l.m3.translation(n.base.x,n.base.y)),n.angle?t=l.m3.multiply(t,l.m3.rotation(-(0,p.angleToRadian)(n.angle))):n.rotation&&(t=l.m3.multiply(t,l.m3.rotation(-n.rotation))),t=l.m3.multiply(t,l.m3.translation(-n.base.x,-n.base.y))),n.matrix&&(t=l.m3.multiply(t,n.matrix)),void 0!==n.opacity&&(r*=n.opacity)),e.map((e=>w(k({},e),{matrix:e.matrix?t?l.m3.multiply(t,e.matrix):e.matrix:t,opacity:void 0!==e.opacity?r*e.opacity:r})))}const M=new u.WeakmapCache,L=new u.WeakmapMap3Cache,O=new u.WeakmapMap3Cache,I=new u.WeakmapMapCache,F=new u.WeakmapMapCache;function D(e,t){(null==t?void 0:t.dashArray)&&(e.setLineDash(t.dashArray),t.dashOffset&&(e.lineDashOffset=t.dashOffset))}function B(e,t){const{start:n,end:r}=e,o=r.x-n.x,i=r.y-n.y,a=(0,c.twoPointLineToGeneralFormLine)(n,r),l=e.stops.slice(0).sort(((e,t)=>e.offset-t.offset)),u=[];let p=l[0].offset,d=l[l.length-1].offset;t.forEach((e=>{const t=(0,g.getPerpendicularPoint)(e,a),r=(0,c.getPointSideOfLine)(e,a);if((0,c.isZero)(r))u.push(0);else{const n=(0,c.getTwoPointsDistance)(t,e);r>0?u.push(n):r<0&&u.push(-n)}const s=(0,c.equals)(t.x,n.x)?(t.y-n.y)/i:(t.x-n.x)/o;sd&&(d=s)})),(0,c.equals)(p,l[0].offset)||l.unshift({offset:p,color:l[0].color}),(0,c.equals)(d,l[l.length-1].offset)||l.push({offset:d,color:l[l.length-1].color});const h=(0,c.getParallelLinesByDistance)(a,Math.max(...u))[1],m=(0,c.getParallelLinesByDistance)(a,Math.min(...u))[1],y=[],x=[];return l.forEach((e=>{const t={x:n.x+o*e.offset,y:n.y+i*e.offset},r=(0,f.getTwoGeneralFormLinesIntersectionPoint)(h,(0,g.getPerpendicular)(t,h)),a=(0,f.getTwoGeneralFormLinesIntersectionPoint)(m,(0,g.getPerpendicular)(t,m)),l=(0,s.colorNumberToRec)(e.color,e.opacity);r&&a&&(y.push(r.x,r.y,a.x,a.y),x.push(...l,...l))})),{type:"triangle strip",points:y,colors:x}}function z(e,t){let{start:n,end:r,stops:o}=e;if(n.r>r.r){const e=n;n=r,r=e,o=o.map((e=>({offset:1-e.offset,color:e.color})))}const i=r.x-n.x,a=r.y-n.y,l=r.r-n.r,u=o.slice(0).sort(((e,t)=>e.offset-t.offset)).map((e=>{const t={x:n.x+i*e.offset,y:n.y+a*e.offset,r:n.r+l*e.offset};return{color:(0,s.colorNumberToRec)(e.color,e.opacity),points:(0,c.arcToPolyline)({x:t.x,y:t.y,r:t.r,startAngle:0,endAngle:360},5)}})),p=Math.max(...t.map((e=>(0,c.getTwoPointsDistance)(e,r))));p>r.r&&u.push({color:u[u.length-1].color,points:(0,c.arcToPolyline)({x:r.x,y:r.y,r:p,startAngle:0,endAngle:360},5)});const d=[],f=[];if(n.r>0){const e=u[0],t=[],r=[];e.points.forEach((o=>{t.push(o.x,o.y,n.x,n.y),r.push(...e.color,...e.color)})),d.push(t),f.push(r)}for(let e=1;e{const a=n.points[i];r.unshift(e.x,e.y,a.x,a.y),o.unshift(...t.color,...n.color)})),d.push(r),f.push(o)}return{type:"triangle strip",points:(0,h.combineStripTriangles)(d),colors:(0,h.combineStripTriangleColors)(f)}}function U(e){const t=[];for(let n=0;nr&&(r=a),so&&(o=s)}return{xMax:r,xMin:t,yMin:n,yMax:o}}function j(e,t,n,r){var o,i;const{xMin:a,yMin:s,xMax:c,yMax:u}=n,p=null!=(o=e.width)?o:Number.MAX_SAFE_INTEGER,d=null!=(i=e.height)?i:Number.MAX_SAFE_INTEGER,f=Math.floor(a/p),g=Math.floor(c/p),h=Math.floor(s/d),m=Math.floor(u/d);for(let n=f;n<=g;n++)for(let o=h;o<=m;o++){const i=l.m3.multiply(t,l.m3.translation(n*p,o*d));for(const t of e.graphics)r(t,t.matrix?l.m3.multiply(i,t.matrix):i)}}function W(e,t){var n,r;const o=l.m3.multiply(e,l.m3.translation(t.x,t.y)),i=null!=(n=t.width)?n:t.src.width,a=null!=(r=t.height)?r:t.src.height;return{textureMatrix:l.m3.multiply(o,l.m3.scaling(i,a)),width:i,height:a}}function G(e,t,n,r,o){let i=l.m3.projection(e.width,e.height);return i=l.m3.multiply(i,l.m3.translation(t,n)),1!==r&&(i=l.m3.multiply(i,l.m3.translation(e.width/2,e.height/2)),i=l.m3.multiply(i,l.m3.scaling(r,r)),i=l.m3.multiply(i,l.m3.translation(-e.width/2,-e.height/2))),o&&(i=l.m3.multiply(i,l.m3.rotation(-o))),i}},9417:(e,t,n)=>{"use strict";n.r(t),n.d(t,{createUniformsBuffer:()=>p,createWebgpuRenderer:()=>u});var r=n(7459),o=n(7504),i=n(6581),a=n(863),s=n(5547),l=n(8485),c=(e,t,n)=>new Promise(((r,o)=>{var i=e=>{try{s(n.next(e))}catch(e){o(e)}},a=e=>{try{s(n.throw(e))}catch(e){o(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(i,a);s((n=n.apply(e,t)).next())}));function u(e){return c(this,null,(function*(){if(!navigator.gpu)return;const t=e.getContext("webgpu");if(!t)return;const n=yield navigator.gpu.requestAdapter();if(!n)return;const a=yield n.requestDevice(),c=navigator.gpu.getPreferredCanvasFormat();t.configure({device:a,format:c});const u={color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}},d=new r.Lazy((()=>a.createShaderModule({code:"struct Uniforms {\n color: vec4f,\n matrix: mat3x3f,\n };\n @group(0) @binding(0) var uniforms: Uniforms;\n \n @vertex\n fn vertex_main(@location(0) position: vec2f) -> @builtin(position) vec4f\n {\n return vec4f((uniforms.matrix * vec3(position.xy, 1)).xy, 0, 1);\n }\n \n @fragment\n fn fragment_main() -> @location(0) vec4f\n {\n return uniforms.color;\n }"}))),f=new r.Lazy((()=>a.createShaderModule({code:"struct Uniforms {\n matrix: mat3x3f,\n color: vec4f,\n };\n @group(0) @binding(0) var uniforms: Uniforms;\n @group(0) @binding(1) var mySampler: sampler;\n @group(0) @binding(2) var myTexture: texture_2d;\n\n struct VertexOutput {\n @builtin(position) position: vec4f,\n @location(0) texcoord: vec2f,\n };\n \n @vertex\n fn vertex_main(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput\n {\n var pos = array(\n vec2f(0.0, 0.0),\n vec2f(0.0, 1.0),\n vec2f(1.0, 0.0),\n vec2f(0.0, 1.0),\n vec2f(1.0, 1.0),\n vec2f(1.0, 0.0),\n );\n let xy = pos[vertexIndex];\n var vsOut: VertexOutput;\n vsOut.position = vec4f((uniforms.matrix * vec3(xy, 1)).xy, 0, 1);\n vsOut.texcoord = xy;\n return vsOut;\n }\n \n @fragment\n fn fragment_main(@location(0) texcoord: vec2f) -> @location(0) vec4f\n {\n if (texcoord.x < 0.0 || texcoord.x > 1.0 || texcoord.y < 0.0 || texcoord.y > 1.0) {\n discard;\n }\n var color = textureSample(myTexture, mySampler, texcoord) * uniforms.color;\n if (color.a < 0.1) {\n discard;\n }\n return color;\n }"}))),g=new r.Lazy((()=>a.createShaderModule({code:"struct Uniforms {\n matrix: mat3x3f,\n opacity: f32,\n };\n @group(0) @binding(0) var uniforms: Uniforms;\n @group(0) @binding(1) var mySampler: sampler;\n @group(0) @binding(2) var myTexture: texture_2d;\n\n struct VertexOutput {\n @builtin(position) position: vec4f,\n @location(0) texcoord: vec2f,\n };\n \n @vertex\n fn vertex_main(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput\n {\n var pos = array(\n vec2f(0.0, 0.0),\n vec2f(0.0, 1.0),\n vec2f(1.0, 0.0),\n vec2f(0.0, 1.0),\n vec2f(1.0, 1.0),\n vec2f(1.0, 0.0),\n );\n let xy = pos[vertexIndex];\n var vsOut: VertexOutput;\n vsOut.position = vec4f((uniforms.matrix * vec3(xy, 1)).xy, 0, 1);\n vsOut.texcoord = xy;\n return vsOut;\n }\n \n @fragment\n fn fragment_main(@location(0) texcoord: vec2f) -> @location(0) vec4f\n {\n if (texcoord.x < 0.0 || texcoord.x > 1.0 || texcoord.y < 0.0 || texcoord.y > 1.0) {\n discard;\n }\n return textureSample(myTexture, mySampler, texcoord) * vec4f(1, 1, 1, uniforms.opacity);\n }"}))),h=new r.Lazy((()=>a.createShaderModule({code:"struct Uniforms {\n matrix: mat3x3f,\n opacity: f32,\n colorMatrix: array,\n };\n @group(0) @binding(0) var uniforms: Uniforms;\n @group(0) @binding(1) var mySampler: sampler;\n @group(0) @binding(2) var myTexture: texture_2d;\n\n struct VertexOutput {\n @builtin(position) position: vec4f,\n @location(0) texcoord: vec2f,\n };\n \n @vertex\n fn vertex_main(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput\n {\n var pos = array(\n vec2f(0.0, 0.0),\n vec2f(0.0, 1.0),\n vec2f(1.0, 0.0),\n vec2f(0.0, 1.0),\n vec2f(1.0, 1.0),\n vec2f(1.0, 0.0),\n );\n let xy = pos[vertexIndex];\n var vsOut: VertexOutput;\n vsOut.position = vec4f((uniforms.matrix * vec3(xy, 1)).xy, 0, 1);\n vsOut.texcoord = xy;\n return vsOut;\n }\n \n @fragment\n fn fragment_main(@location(0) texcoord: vec2f) -> @location(0) vec4f\n {\n if (texcoord.x < 0.0 || texcoord.x > 1.0 || texcoord.y < 0.0 || texcoord.y > 1.0) {\n discard;\n }\n var c = textureSample(myTexture, mySampler, texcoord) * vec4f(1, 1, 1, uniforms.opacity);\n var r = uniforms.colorMatrix[0][0] * c.r + uniforms.colorMatrix[0][1] * c.g + uniforms.colorMatrix[0][2] * c.b + uniforms.colorMatrix[0][3] * c.a + uniforms.colorMatrix[1][0];\n var g = uniforms.colorMatrix[1][1] * c.r + uniforms.colorMatrix[1][2] * c.g + uniforms.colorMatrix[1][3] * c.b + uniforms.colorMatrix[2][0] * c.a + uniforms.colorMatrix[2][1];\n var b = uniforms.colorMatrix[2][2] * c.r + uniforms.colorMatrix[2][3] * c.g + uniforms.colorMatrix[3][0] * c.b + uniforms.colorMatrix[3][1] * c.a + uniforms.colorMatrix[3][2];\n var a = uniforms.colorMatrix[3][3] * c.r + uniforms.colorMatrix[4][0] * c.g + uniforms.colorMatrix[4][1] * c.b + uniforms.colorMatrix[4][2] * c.a + uniforms.colorMatrix[4][3];\n return vec4f(r, g, b, a);\n }"}))),m=new r.Lazy((()=>a.createShaderModule({code:"struct Uniforms {\n matrix: mat3x3f,\n opacity: f32,\n px: vec4f,\n };\n @group(0) @binding(0) var uniforms: Uniforms;\n @group(0) @binding(1) var mySampler: sampler;\n @group(0) @binding(2) var myTexture: texture_2d;\n\n struct VertexOutput {\n @builtin(position) position: vec4f,\n @location(0) texcoord: vec2f,\n };\n \n @vertex\n fn vertex_main(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput\n {\n var pos = array(\n vec2f(0.0, 0.0),\n vec2f(0.0, 1.0),\n vec2f(1.0, 0.0),\n vec2f(0.0, 1.0),\n vec2f(1.0, 1.0),\n vec2f(1.0, 0.0),\n );\n let xy = pos[vertexIndex];\n var vsOut: VertexOutput;\n vsOut.position = vec4f((uniforms.matrix * vec3(xy, 1)).xy, 0, 1);\n vsOut.texcoord = xy;\n return vsOut;\n }\n \n @fragment\n fn fragment_main(@location(0) texcoord: vec2f) -> @location(0) vec4f\n {\n if (texcoord.x < 0.0 || texcoord.x > 1.0 || texcoord.y < 0.0 || texcoord.y > 1.0) {\n discard;\n }\n var r = vec4f(0.0);\n r += textureSample(myTexture, mySampler, texcoord + vec2(-7.0*uniforms.px.x, -7.0*uniforms.px.y))*0.0044299121055113265;\n r += textureSample(myTexture, mySampler, texcoord + vec2(-6.0*uniforms.px.x, -6.0*uniforms.px.y))*0.00895781211794;\n r += textureSample(myTexture, mySampler, texcoord + vec2(-5.0*uniforms.px.x, -5.0*uniforms.px.y))*0.0215963866053;\n r += textureSample(myTexture, mySampler, texcoord + vec2(-4.0*uniforms.px.x, -4.0*uniforms.px.y))*0.0443683338718;\n r += textureSample(myTexture, mySampler, texcoord + vec2(-3.0*uniforms.px.x, -3.0*uniforms.px.y))*0.0776744219933;\n r += textureSample(myTexture, mySampler, texcoord + vec2(-2.0*uniforms.px.x, -2.0*uniforms.px.y))*0.115876621105;\n r += textureSample(myTexture, mySampler, texcoord + vec2(-1.0*uniforms.px.x, -1.0*uniforms.px.y))*0.147308056121;\n r += textureSample(myTexture, mySampler, texcoord )*0.159576912161;\n r += textureSample(myTexture, mySampler, texcoord + vec2( 1.0*uniforms.px.x, 1.0*uniforms.px.y))*0.147308056121;\n r += textureSample(myTexture, mySampler, texcoord + vec2( 2.0*uniforms.px.x, 2.0*uniforms.px.y))*0.115876621105;\n r += textureSample(myTexture, mySampler, texcoord + vec2( 3.0*uniforms.px.x, 3.0*uniforms.px.y))*0.0776744219933;\n r += textureSample(myTexture, mySampler, texcoord + vec2( 4.0*uniforms.px.x, 4.0*uniforms.px.y))*0.0443683338718;\n r += textureSample(myTexture, mySampler, texcoord + vec2( 5.0*uniforms.px.x, 5.0*uniforms.px.y))*0.0215963866053;\n r += textureSample(myTexture, mySampler, texcoord + vec2( 6.0*uniforms.px.x, 6.0*uniforms.px.y))*0.00895781211794;\n r += textureSample(myTexture, mySampler, texcoord + vec2( 7.0*uniforms.px.x, 7.0*uniforms.px.y))*0.0044299121055113265;\n return r;\n }"}))),y=new r.Lazy((()=>a.createShaderModule({code:"struct Uniforms {\n matrix: mat3x3f,\n color: vec4f,\n };\n @group(0) @binding(0) var uniforms: Uniforms;\n @group(0) @binding(1) var mySampler: sampler;\n @group(0) @binding(2) var myTexture: texture_2d;\n\n struct VertexOutput {\n @builtin(position) position: vec4f,\n @location(0) texcoord: vec2f,\n };\n \n @vertex\n fn vertex_main(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput\n {\n var pos = array(\n vec2f(0.0, 0.0),\n vec2f(0.0, 1.0),\n vec2f(1.0, 0.0),\n vec2f(0.0, 1.0),\n vec2f(1.0, 1.0),\n vec2f(1.0, 0.0),\n );\n let xy = pos[vertexIndex];\n var vsOut: VertexOutput;\n vsOut.position = vec4f((uniforms.matrix * vec3(xy, 1)).xy, 0, 1);\n vsOut.texcoord = xy;\n return vsOut;\n }\n \n @fragment\n fn fragment_main(@location(0) texcoord: vec2f) -> @location(0) vec4f\n {\n if (texcoord.x < 0.0 || texcoord.x > 1.0 || texcoord.y < 0.0 || texcoord.y > 1.0) {\n discard;\n }\n var color = textureSample(myTexture, mySampler, texcoord);\n var color2 = color * uniforms.color;\n if (color2.a < 0.1) {\n discard;\n }\n return color;\n }"}))),x=new r.Lazy((()=>a.createShaderModule({code:"struct Uniforms {\n color: vec4f,\n matrix: mat3x3f,\n };\n @group(0) @binding(0) var uniforms: Uniforms;\n\n struct VertexOutput {\n @builtin(position) position: vec4f,\n @location(0) color: vec4f,\n };\n \n @vertex\n fn vertex_main(@location(0) position: vec2f, @location(1) color: vec4f) -> VertexOutput\n {\n var vsOut: VertexOutput;\n vsOut.position = vec4f((uniforms.matrix * vec3(position.xy, 1)).xy, 0, 1);\n vsOut.color = color;\n return vsOut;\n }\n \n @fragment\n fn fragment_main(@location(0) color: vec4f) -> @location(0) vec4f\n {\n return color;\n }"}))),v=new r.Lazy((()=>a.createSampler({magFilter:"nearest",minFilter:"nearest"}))),b=new r.Lazy((()=>a.createTexture({size:[e.width,e.height],sampleCount:4,format:c,usage:GPUTextureUsage.RENDER_ATTACHMENT})),(e=>e.destroy())),C=new r.Lazy((()=>a.createTexture({format:"stencil8",sampleCount:4,size:[e.width,e.height],usage:GPUTextureUsage.RENDER_ATTACHMENT})),(e=>e.destroy())),E=new s.WeakmapCache,k=new s.WeakmapCache2,w=new s.WeakmapMap2Cache,S=new s.WeakmapCache,P=new s.MapCache2,R=e=>"color matrix"===e.type?{shaderModule:h.instance,input:{type:"vec4 array",count:5,value:e.value}}:{shaderModule:m.instance,input:{type:"vec2",value:e.value}},_=(e,t,n,r)=>a.createRenderPipeline({vertex:{module:e,entryPoint:"vertex_main",buffers:r?[r]:void 0},fragment:{module:e,entryPoint:"fragment_main",targets:"mask"===t?[]:[{format:c,blend:u}]},depthStencil:"mask"===t?{format:"stencil8",depthCompare:"always",depthWriteEnabled:!1,stencilFront:{passOp:"replace"}}:"masked"===t?{depthCompare:"always",depthWriteEnabled:!1,format:"stencil8",stencilFront:{compare:"equal"}}:void 0,primitive:n?{topology:"triangles"===n?"triangle-list":"line strip"===n?"line-strip":"lines"===n?"line-list":"triangle-strip"}:void 0,multisample:{count:4},layout:"auto"}),T=(e,t,n)=>{e.setPipeline(t),e.setBindGroup(0,a.createBindGroup({layout:t.getBindGroupLayout(0),entries:n.map(((e,t)=>({binding:t,resource:e})))}))},A=(e,t,n,r,o="normal")=>{const i=P.get(e,o,(()=>_(e,o)));T(t,i,[{buffer:p(a,n)},v.instance,r.createView()]),t.draw(6)},M=(e,t)=>a.createTexture({size:[e,t],format:c,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT}),L=(e,n=t.getCurrentTexture(),r)=>e.beginRenderPass({colorAttachments:[{clearValue:r,loadOp:r?"clear":"load",storeOp:"store",view:b.instance.createView(),resolveTarget:n.createView()}]}),O=(e,n=t.getCurrentTexture(),r=1)=>{const o=e.beginRenderPass({colorAttachments:[{view:b.instance.createView(),resolveTarget:n.createView(),loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:C.instance.createView(),stencilLoadOp:"load",stencilStoreOp:"store"}});return o.setStencilReference(r),o},I=(t,n,r,o,s,c)=>{let u;if(t.graphics.some((e=>e.pattern))){u=M(e.width,e.height);const o=a.createCommandEncoder();let i=O(o,u,0);(0,l.forEachPatternGraphicRepeatedGraphic)(t,n,r,((e,t)=>{i=F(e,t,i,o,!0,s,u)})),i.end(),a.queue.submit([o.finish()])}let p=O(o);return u?A(g.instance,p,[{type:"mat3x3",value:i.m3.projection(1,1)},{type:"number",value:null!=s?s:1}],u,"masked"):(0,l.forEachPatternGraphicRepeatedGraphic)(t,n,r,((e,t)=>{p=F(e,t,p,o,!0,s,c)})),p.end(),L(o,c)},F=(t,n,r,s,c=!1,u,h)=>{var m,v,b;const P=(0,o.mergeOpacities)(t.opacity,u),O=(0,o.mergeOpacityToColor)(t.pattern?l.defaultVec4Color:t.color,P);t.pattern&&(r.end(),r=(e=>{const t=e.beginRenderPass({colorAttachments:[],depthStencilAttachment:{view:C.instance.createView(),stencilClearValue:0,stencilLoadOp:"clear",stencilStoreOp:"store"}});return t.setStencilReference(1),t})(s));const F=t.pattern?"mask":c?"masked":"normal";if("texture"===t.type){const{textureMatrix:o,width:c,height:u}=(0,l.getTextureGraphicMatrix)(n,t);let p,d=S.get(t.src,(()=>{const e=M(t.src.width,t.src.height),n=t.src instanceof ImageBitmap?t.src:t.canvas;return n&&a.queue.copyExternalImageToTexture({source:n},{texture:e},{width:t.src.width,height:t.src.height}),e}));if(t.filters&&t.filters.length>1){const n=[];for(let r=0;r0){const e=R(t.filters[t.filters.length-1]);p=e.shaderModule,x.push({type:"number",value:null!=(v=t.opacity)?v:1},e.input)}else t.pattern?(p=y.instance,x.push({type:"vec4",value:null!=O?O:l.defaultVec4Color})):t.color?(p=f.instance,x.push({type:"vec4",value:null!=O?O:l.defaultVec4Color})):(p=g.instance,x.push({type:"number",value:null!=(b=t.opacity)?b:1}));A(p,r,x,d,F),t.pattern&&(r.end(),r=I(t.pattern,n,{xMin:t.x,yMin:t.y,xMax:t.x+c,yMax:t.y+u},s,P,h))}else{const e=t.colors?x.instance:d.instance,o=w.get(e,t.type,F,(()=>{const n=t.colors?{attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:8,format:"float32x4"}],arrayStride:24,stepMode:"vertex"}:{attributes:[{shaderLocation:0,offset:0,format:"float32x2"}],arrayStride:8,stepMode:"vertex"};return _(e,F,t.type,n)}));if(T(r,o,[{buffer:p(a,[{type:"vec4",value:O||l.defaultVec4Color},{type:"mat3x3",value:n}])}]),t.colors){const e=t.colors;r.setVertexBuffer(0,k.get(t.points,e,(()=>{const n=function(e){const t=[],n=Math.min(...e.map((e=>e.data.length/e.num)));for(let r=0;r{const e=new Float32Array(t.points),n=a.createBuffer({size:e.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});return a.queue.writeBuffer(n,0,e,0,e.length),n})));if(r.draw(t.points.length/2),t.pattern){r.end();const e=(0,l.getNumArrayPointsBounding)(t.points);r=I(t.pattern,n,e,s,P,h)}}return r};return(t,n,r,o,s,c)=>{!b.instanced||e.width===b.instance.width&&e.height===b.instance.height||b.reset(),!C.instanced||e.width===C.instance.width&&e.height===C.instance.height||C.reset();const u=(0,l.getWorldMatrix)(e,r,o,s,c),p=a.createCommandEncoder();let d=L(p,void 0,n);for(const e of t){const t=e.matrix?i.m3.multiply(u,e.matrix):u;d=F(e,t,d,p)}d.end(),a.queue.submit([p.finish()])}}))}function p(e,t){const n=(0,a.createMemoryLayoutArray)(...t),r=e.createBuffer({size:n.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});return e.queue.writeBuffer(r,0,n),r}},1948:(e,t,n)=>{"use strict";n.r(t),n.d(t,{getImageFromCache:()=>o});const r=new Map;function o(e,t){var n;const o=r.get(e);return o?Array.isArray(o)?void o.push((()=>{var e;null==(e=null==t?void 0:t.rerender)||e.call(t)})):(null==(n=null==t?void 0:t.callback)||n.call(t,o),o):(r.set(e,[]),void function(e,t){return new Promise(((n,r)=>{const o=new Image;void 0!==t&&(o.crossOrigin=t),o.onload=()=>{n(o)},o.onerror=()=>{r()},o.src=e}))}(e,null==t?void 0:t.crossOrigin).then((n=>{createImageBitmap(n).then((n=>{var o,i;const a=r.get(e);r.set(e,n),Array.isArray(a)&&a.forEach((e=>{e()})),null==(o=null==t?void 0:t.callback)||o.call(t,n),null==(i=null==t?void 0:t.rerender)||i.call(t)}))})))}},7731:(e,t,n)=>{"use strict";n.r(t);var r=n(5136),o={};for(const e in r)"default"!==e&&(o[e]=()=>r[e]);n.d(t,o);var i=n(5319);o={};for(const e in i)"default"!==e&&(o[e]=()=>i[e]);n.d(t,o);var a=n(194);o={};for(const e in a)"default"!==e&&(o[e]=()=>a[e]);n.d(t,o);var s=n(9625);o={};for(const e in s)"default"!==e&&(o[e]=()=>s[e]);n.d(t,o);var l=n(7043);o={};for(const e in l)"default"!==e&&(o[e]=()=>l[e]);n.d(t,o);var c=n(6299);o={};for(const e in c)"default"!==e&&(o[e]=()=>c[e]);n.d(t,o);var u=n(8485);o={};for(const e in u)"default"!==e&&(o[e]=()=>u[e]);n.d(t,o);var p=n(9417);o={};for(const e in p)"default"!==e&&(o[e]=()=>p[e]);n.d(t,o);var d=n(1948);o={};for(const e in d)"default"!==e&&(o[e]=()=>d[e]);n.d(t,o);var f=n(8797);o={};for(const e in f)"default"!==e&&(o[e]=()=>f[e]);n.d(t,o)},194:(e,t,n)=>{"use strict";n.r(t),n.d(t,{reactCanvasRenderTarget:()=>b});var r=n(7378),o=n(6581),i=n(8485),a=n(1948),s=n(5136),l=n(7504),c=n(3516),u=n(5395),p=Object.defineProperty,d=Object.defineProperties,f=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,h=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable,y=(e,t,n)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,x=(e,t)=>{for(var n in t||(t={}))h.call(t,n)&&y(e,n,t[n]);if(g)for(var n of g(t))m.call(t,n)&&y(e,n,t[n]);return e},v=(e,t)=>d(e,f(t));const b={type:"canvas",renderResult:(e,t,n,o)=>r.createElement(S,{width:t,height:n,attributes:null==o?void 0:o.attributes,draws:e,transform:null==o?void 0:o.transform,backgroundColor:null==o?void 0:o.backgroundColor,debug:null==o?void 0:o.debug,strokeWidthScale:null==o?void 0:o.strokeWidthScale}),renderEmpty:()=>()=>{},renderGroup:(e,t)=>(n,r,i)=>{const a=n.globalAlpha;n.save(),void 0!==(null==t?void 0:t.opacity)&&(n.globalAlpha=a*t.opacity),(null==t?void 0:t.translate)&&n.translate(t.translate.x,t.translate.y),(null==t?void 0:t.angle)&&void 0!==(null==t?void 0:t.base)&&(n.translate(t.base.x,null==t?void 0:t.base.y),n.rotate((0,c.angleToRadian)(t.angle)),n.translate(-t.base.x,-t.base.y)),(null==t?void 0:t.rotation)&&void 0!==(null==t?void 0:t.base)&&(n.translate(t.base.x,null==t?void 0:t.base.y),n.rotate(t.rotation),n.translate(-t.base.x,-t.base.y)),(null==t?void 0:t.matrix)&&n.setTransform(n.getTransform().multiply(o.m3.getTransformInit(t.matrix))),e.forEach((e=>{e(n,r,i)})),n.restore()},renderRect:(e,t,n,r,o)=>(a,s,u)=>{var p,d;a.save(),a.beginPath(),(0,i.setCanvasLineDash)(a,o),(null==o?void 0:o.angle)&&(a.translate(e+n/2,t+r/2),a.rotate((0,c.angleToRadian)(o.angle)),a.translate(-(e+n/2),-(t+r/2))),(null==o?void 0:o.rotation)&&(a.translate(e+n/2,t+r/2),a.rotate(o.rotation),a.translate(-(e+n/2),-(t+r/2))),a.rect(e,t,n,r);const f=(null!=(p=null==o?void 0:o.strokeWidth)?p:1)*s;f&&(a.lineWidth=f,a.strokeStyle=(0,l.getColorString)(null!=(d=null==o?void 0:o.strokeColor)?d:0),a.strokeRect(e,t,n,r)),C(a,s,u,o),k(a,s,u,o),a.restore()},renderPolyline(e,t){const n=null!=t?t:{},{partsStyles:r}=n,o=((e,t)=>{var n={};for(var r in e)h.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&g)for(var r of g(e))t.indexOf(r)<0&&m.call(e,r)&&(n[r]=e[r]);return n})(n,["partsStyles"]);return r&&r.length>0?(0,s.renderPartStyledPolyline)(this,r,e,o):(n,r,o)=>{var a;n.save(),n.beginPath(),(0,i.setCanvasLineDash)(n,t);for(let r=0;r(o,a,s)=>{o.save(),o.beginPath(),(0,i.setCanvasLineDash)(o,r),o.arc(e,t,n,0,2*Math.PI),C(o,a,s,r),k(o,a,s,r),o.restore()},renderEllipse:(e,t,n,r,o)=>(a,s,l)=>{var u;a.save(),a.beginPath(),(0,i.setCanvasLineDash)(a,o);const p=null!=(u=null==o?void 0:o.rotation)?u:(0,c.angleToRadian)(null==o?void 0:o.angle);a.ellipse(e,t,n,r,p,0,2*Math.PI),C(a,s,l,o),k(a,s,l,o),a.restore()},renderArc:(e,t,n,r,o,a)=>(s,l,u)=>{s.save(),s.beginPath(),(0,i.setCanvasLineDash)(s,a),s.arc(e,t,n,(0,c.angleToRadian)(r),(0,c.angleToRadian)(o),null==a?void 0:a.counterclockwise),C(s,l,u,a),k(s,l,u,a),s.restore()},renderEllipseArc:(e,t,n,r,o,a,s)=>(l,u,p)=>{var d;l.save(),l.beginPath(),(0,i.setCanvasLineDash)(l,s);const f=null!=(d=null==s?void 0:s.rotation)?d:(0,c.angleToRadian)(null==s?void 0:s.angle);l.ellipse(e,t,n,r,f,(0,c.angleToRadian)(o),(0,c.angleToRadian)(a),null==s?void 0:s.counterclockwise),C(l,u,p,s),k(l,u,p,s),l.restore()},renderPathCommands:(e,t)=>(n,r,o)=>{let a;n.save(),n.beginPath(),(0,i.setCanvasLineDash)(n,t);for(const t of e){if("move"===t.type)n.moveTo(t.to.x,t.to.y);else if("line"===t.type)n.lineTo(t.to.x,t.to.y);else if("arc"===t.type)n.arcTo(t.from.x,t.from.y,t.to.x,t.to.y,t.radius);else if("ellipseArc"===t.type){if(a){const e=(0,s.getEllipseArcByStartEnd)(a,t.rx,t.ry,t.angle,t.largeArc,t.sweep,t.to);e&&n.ellipse(e.cx,e.cy,e.rx,e.ry,(0,c.angleToRadian)(e.angle),(0,c.angleToRadian)(e.startAngle),(0,c.angleToRadian)(e.endAngle),e.counterclockwise)}}else"bezierCurve"===t.type?n.bezierCurveTo(t.cp1.x,t.cp1.y,t.cp2.x,t.cp2.y,t.to.x,t.to.y):"quadraticCurve"===t.type?n.quadraticCurveTo(t.cp.x,t.cp.y,t.to.x,t.to.y):"close"===t.type&&n.closePath();"close"!==t.type&&(a=t.to)}(null==t?void 0:t.closed)&&n.closePath(),C(n,r,o,t),k(n,r,o,t),n.restore()},renderText:(e,t,n,r,o,a,s)=>(c,u,p)=>{var d,f,g,h;c.save(),c.font=`${null!=(d=null==s?void 0:s.fontWeight)?d:"normal"} ${null!=(f=null==s?void 0:s.fontStyle)?f:"normal"} ${o}px ${a}`,c.textAlign=null!=(g=null==s?void 0:s.textAlign)?g:"left",c.textBaseline=null!=(h=null==s?void 0:s.textBaseline)?h:"alphabetic",k(c,u,p,v(x({},s),{fillColor:"number"==typeof r?r:void 0,fillPattern:void 0!==r&&"number"!=typeof r?r:void 0}),(()=>c.fillText(n,e,t))),(void 0!==(null==s?void 0:s.strokeColor)||(null==s?void 0:s.strokePattern)||(null==s?void 0:s.strokeLinearGradient)||(null==s?void 0:s.strokeRadialGradient))&&(void 0!==(null==s?void 0:s.strokeColor)?c.strokeStyle=(0,l.getColorString)(s.strokeColor,s.strokeOpacity):w(c,u,p,s),void 0!==s.strokeWidth&&(c.lineWidth=s.strokeWidth),(0,i.setCanvasLineDash)(c,s),c.strokeText(n,e,t)),c.restore()},renderImage:(e,t,n,r,o,i)=>(s,l,c)=>{const u=(0,a.getImageFromCache)(e,{rerender:c,crossOrigin:null==i?void 0:i.crossOrigin});if(u){const e=s.globalAlpha;s.save(),void 0!==(null==i?void 0:i.opacity)&&(s.globalAlpha=e*i.opacity),function(e,t){if(t&&t.length>0){const n=[];t.forEach((e=>{"hue-rotate"===e.type?n.push(`hue-rotate(${e.value}deg)`):"blur"===e.type?n.push(`blur(${e.value}px)`):"brightness"!==e.type&&"contrast"!==e.type&&"saturate"!==e.type&&"grayscale"!==e.type&&"invert"!==e.type&&"opacity"!==e.type&&"sepia"!==e.type||n.push(`${e.type}(${e.value})`)})),e.filter=n.join(" ")}}(s,null==i?void 0:i.filters),s.drawImage(u,t,n,r,o),s.restore()}},renderPath:(e,t)=>(n,r,o)=>{n.save(),n.beginPath(),(0,i.setCanvasLineDash)(n,t);for(const t of e)for(let e=0;e{i.addColorStop(e.offset,(0,l.getColorString)(e.color,e.opacity))})),e.fillStyle=i}else if(void 0!==r.fillRadialGradient){const{start:t,end:n,stops:o}=r.fillRadialGradient,i=e.createRadialGradient(t.x,t.y,t.r,n.x,n.y,n.r);o.forEach((e=>{i.addColorStop(e.offset,(0,l.getColorString)(e.color,e.opacity))})),e.fillStyle=i}o?o():e.fill("evenodd")}}function w(e,t,n,r){if(null==r?void 0:r.strokePattern){const o=E(e,r.strokePattern,t,n);o&&(e.strokeStyle=o)}else if(void 0!==(null==r?void 0:r.strokeLinearGradient)){const{start:t,end:n,stops:o}=r.strokeLinearGradient,i=e.createLinearGradient(t.x,t.y,n.x,n.y);o.forEach((e=>{i.addColorStop(e.offset,(0,l.getColorString)(e.color,e.opacity))})),e.strokeStyle=i}else if(void 0!==(null==r?void 0:r.strokeRadialGradient)){const{start:t,end:n,stops:o}=r.strokeRadialGradient,i=e.createRadialGradient(t.x,t.y,t.r,n.x,n.y,n.r);o.forEach((e=>{i.addColorStop(e.offset,(0,l.getColorString)(e.color,e.opacity))})),e.strokeStyle=i}}function S(e){const t=r.useRef(null),[n,o]=r.useState(0);return r.useEffect((()=>{t.current&&(t.current.width=e.width,t.current.height=e.height)}),[e.width,e.height]),r.useEffect((()=>{var n;if(t.current){const r=t.current.getContext("2d");if(r){const t=Date.now();r.fillStyle=(0,l.getColorString)(null!=(n=e.backgroundColor)?n:16777215),r.fillRect(0,0,r.canvas.width,r.canvas.height),r.save(),e.transform&&(r.translate(e.width/2,e.height/2),r.scale(e.transform.scale,e.transform.scale),r.translate(e.transform.x/e.transform.scale-e.width/2,e.transform.y/e.transform.scale-e.height/2),e.transform.rotate&&r.rotate(e.transform.rotate));const i=e.strokeWidthScale||1,a=()=>o((e=>e+1));for(const t of e.draws)t(r,i,a);r.restore(),e.debug&&console.info(Date.now()-t)}}}),[e.draws,t.current,e.transform,e.backgroundColor,n]),r.createElement("canvas",x({ref:t,width:e.width,height:e.height},e.attributes))}},5136:(e,t,n)=>{"use strict";n.r(t),n.d(t,{geometryLineToPathCommands:()=>w,getArcControlPoint:()=>S,getEllipseArcByStartEnd:()=>_,getGeometryLinesPoints:()=>E,getPathCommandEndPoint:()=>R,getPathCommandsPoints:()=>C,getRoundedRectPoints:()=>b,pathCommandPointsToPath:()=>P,pathCommandsToGeometryLines:()=>k,renderPartStyledPolyline:()=>v});var r=n(9195),o=n(3516),i=n(9605),a=n(6003),s=n(6632),l=n(5791),c=n(4275),u=Object.defineProperty,p=Object.defineProperties,d=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,m=(e,t,n)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y=(e,t)=>{for(var n in t||(t={}))g.call(t,n)&&m(e,n,t[n]);if(f)for(var n of f(t))h.call(t,n)&&m(e,n,t[n]);return e},x=(e,t)=>p(e,d(t));function v(e,t,n,r){return e.renderGroup([e.renderPolyline(n,x(y({},r),{skippedLines:t.map((e=>e.index))})),...t.map((({index:t,color:o,opacity:i})=>e.renderPolyline([n[t],n[t+1]],x(y({},r),{strokeColor:o,strokeOpacity:i}))))])}function b(e,t,n){return[...(0,r.arcToPolyline)({x:e.x+e.width/2-t,y:e.y-e.height/2+t,r:t,startAngle:-90,endAngle:0},n),...(0,r.arcToPolyline)({x:e.x+e.width/2-t,y:e.y+e.height/2-t,r:t,startAngle:0,endAngle:90},n),...(0,r.arcToPolyline)({x:e.x-e.width/2+t,y:e.y+e.height/2-t,r:t,startAngle:90,endAngle:180},n),...(0,r.arcToPolyline)({x:e.x-e.width/2+t,y:e.y-e.height/2+t,r:t,startAngle:180,endAngle:270},n)]}function C(e){const t=[],n=k(e);for(const e of n)t.push(E(e));return t}function E(e,t=100,n=5){const o=[];for(const i of e)Array.isArray(i)?(0===o.length&&o.push(i[0]),o.push(i[1])):"arc"===i.type?o.push(...(0,r.arcToPolyline)(i.curve,n)):"ellipse arc"===i.type?o.push(...(0,r.ellipseArcToPolyline)(i.curve,n)):"quadratic curve"===i.type?o.push(...(0,s.getQuadraticCurvePoints)(i.curve.from,i.curve.cp,i.curve.to,t)):"bezier curve"===i.type&&o.push(...(0,s.getBezierCurvePoints)(i.curve.from,i.curve.cp1,i.curve.cp2,i.curve.to,t));return o}function k(e){const t=[];let n,s,l=[];for(const c of e)if("move"===c.type)l.length>0&&(l.length>1&&t.push(l),l=[],n=void 0),s=c.to,n||(n=c.to);else if("line"===c.type)s&&l.push([s,c.to]),s=c.to;else if("arc"===c.type){if(s){const e=c.from,t=c.to,n=(0,r.twoPointLineToGeneralFormLine)(s,e),u=(0,r.twoPointLineToGeneralFormLine)(e,t),p=(0,r.getPointSideOfLine)(t,n);if((0,r.isZero)(p))s&&(l.push([s,t]),s=t);else{const e=p<0?0:1,t=(0,i.getTwoGeneralFormLinesIntersectionPoint)((0,r.getParallelLinesByDistance)(n,c.radius)[e],(0,r.getParallelLinesByDistance)(u,c.radius)[e]);if(t){const e=(0,a.getPerpendicularPoint)(t,n),i=(0,a.getPerpendicularPoint)(t,u);s&&((0,r.isSamePoint)(s,e)||l.push([s,{x:e.x,y:e.y}]),s=i);const d=(0,o.radianToAngle)((0,r.getTwoPointsRadian)(e,t)),f=(0,o.radianToAngle)((0,r.getTwoPointsRadian)(i,t));l.push({type:"arc",curve:{x:t.x,y:t.y,startAngle:d,endAngle:f,r:c.radius,counterclockwise:p>0}})}}}}else if("ellipseArc"===c.type){if(s){const e=_(s,c.rx,c.ry,c.angle,c.largeArc,c.sweep,c.to);e&&l.push({type:"ellipse arc",curve:e})}s=c.to}else"bezierCurve"===c.type?(s&&l.push({type:"bezier curve",curve:{from:s,cp1:c.cp1,cp2:c.cp2,to:c.to}}),s=c.to):"quadraticCurve"===c.type?(s&&l.push({type:"quadratic curve",curve:{from:s,cp:c.cp,to:c.to}}),s=c.to):"close"===c.type&&l.length>0&&(l.length>1&&(n&&s&&!(0,r.isSamePoint)(n,s)&&l.push([s,n]),t.push(l)),l=[],n=void 0);return l.length>0&&t.push(l),t}function w(e){const t=[];let n;for(const o of e){const{start:e,end:i}=(0,l.getGeometryLineStartAndEnd)(o);if(n&&(0,r.isSamePoint)(n,e)||t.push({type:"move",to:e}),Array.isArray(o))t.push({type:"line",to:i});else if("arc"===o.type){const e=S(o.curve);e&&t.push({type:"arc",from:e,to:i,radius:o.curve.r})}else if("ellipse arc"===o.type){const e=(0,r.getFormattedEndAngle)(o.curve),n=Math.abs(e-o.curve.startAngle)>180;t.push({type:"ellipseArc",to:i,rx:o.curve.rx,ry:o.curve.ry,angle:o.curve.angle||0,sweep:!o.curve.counterclockwise,largeArc:n})}else"quadratic curve"===o.type?t.push({type:"quadraticCurve",cp:o.curve.cp,to:o.curve.to}):"bezier curve"===o.type&&t.push({type:"bezierCurve",cp1:o.curve.cp1,cp2:o.curve.cp2,to:o.curve.to});n=i}return t}function S(e){const t=(0,r.getCirclePointAtRadian)(e,(0,o.angleToRadian)(e.startAngle)),n=(0,r.getCirclePointAtRadian)(e,(0,o.angleToRadian)(e.endAngle)),s=(0,a.getPerpendicular)(t,(0,r.twoPointLineToGeneralFormLine)(e,t)),l=(0,a.getPerpendicular)(n,(0,r.twoPointLineToGeneralFormLine)(e,n));return(0,i.getTwoGeneralFormLinesIntersectionPoint)(s,l)}function P(e){const t=[];let n;for(const o of e)n?(0,r.pointInPolygon)(o[0],n.polygon)?n.holes.push(o):(n&&t.push([n.polygon,...n.holes]),n={polygon:o,holes:[]}):n={polygon:o,holes:[]};return n&&t.push([n.polygon,...n.holes]),t}function R(e,t){if(t>=0){const n=e[t];if("close"!==n.type){if("arc"!==n.type)return n.to;const o=R(e,t-1);if(o){const e=n.from,t=n.to,s=(0,r.twoPointLineToGeneralFormLine)(o,e),l=(0,r.twoPointLineToGeneralFormLine)(e,t),c=(0,r.getPointSideOfLine)(t,s);if((0,r.isZero)(c))return n.to;const u=c<0?0:1,p=(0,i.getTwoGeneralFormLinesIntersectionPoint)((0,r.getParallelLinesByDistance)(s,n.radius)[u],(0,r.getParallelLinesByDistance)(l,n.radius)[u]);if(p){const e=(0,a.getPerpendicularPoint)(p,l),t=(0,r.getTwoPointsRadian)(e,p);return{x:p.x+n.radius*Math.cos(t),y:p.y+n.radius*Math.sin(t)}}}}}}function _(e,t,n,i,a,s,l){const u=(0,o.angleToRadian)(i),p=Math.sin(u),d=Math.cos(u),f=1/t/t,g=1/n/n,h=e.x,m=e.y,v=l.x,b=l.y,C=v-h,E=b-m,k=d*d*f+p*p*g,w=p*p*f+d*d*g,S=f-g,P=2*(S*p*d*C+w*E),R=2*(k*C+S*p*d*E)/P,_=(k*C*C+2*p*d*S*C*E+w*E*E)/P,T=(0,c.calculateEquation2)(k-2*p*d*S*R+w*R*R,-2*p*d*S*_+2*w*R*_,w*_*_-1);if(0===T.length)return;const A=T.map((e=>({x:h-e,y:m+R*e+_})));let M;M=1===A.length?0:(0,r.getPointSideOfLine)(A[0],(0,r.twoPointLineToGeneralFormLine)(e,l))>0?a===s?0:1:a!==s?0:1;const L=A[M],O={cx:L.x,cy:L.y,rx:t,ry:n,angle:i};return x(y({},O),{startAngle:(0,r.getEllipseAngle)(e,O),endAngle:(0,r.getEllipseAngle)(l,O),counterclockwise:!s})}},5319:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ellipsePolarToCartesian:()=>T,getRotateTransform:()=>A,polarToCartesian:()=>_,reactSvgRenderTarget:()=>E});var r=n(7378),o=n(7504),i=n(9195),a=n(6581),s=n(5547),l=n(5136),c=n(3516),u=n(9605),p=n(6003),d=n(5395),f=Object.defineProperty,g=Object.defineProperties,h=Object.getOwnPropertyDescriptors,m=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,v=(e,t,n)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))y.call(t,n)&&v(e,n,t[n]);if(m)for(var n of m(t))x.call(t,n)&&v(e,n,t[n]);return e},C=(e,t)=>g(e,h(t));const E={type:"svg",renderResult(e,t,n,i){var a,s,l,c,u,p,d,f,g;const h=null!=(s=null==(a=null==i?void 0:i.transform)?void 0:a.x)?s:0,m=null!=(c=null==(l=null==i?void 0:i.transform)?void 0:l.y)?c:0,y=null!=(p=null==(u=null==i?void 0:i.transform)?void 0:u.scale)?p:1,x=t/y,v=n/y,E=(t-x)/2-h/y,k=(n-v)/2-m/y,w=(null==i?void 0:i.strokeWidthScale)||1,S=null!=(f=null==(d=null==i?void 0:i.transform)?void 0:d.rotate)?f:0;return r.createElement("svg",C(b({version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:`${E} ${k} ${x} ${v}`,width:t,height:n,colorInterpolationFilters:"sRGB"},null==i?void 0:i.attributes),{style:C(b({},null==(g=null==i?void 0:i.attributes)?void 0:g.style),{backgroundColor:void 0!==(null==i?void 0:i.backgroundColor)?(0,o.getColorString)(i.backgroundColor):void 0})}),r.createElement("g",{style:{rotate:`${S}rad`}},e.map(((e,t)=>e(t,y,w)))))},renderEmpty:()=>()=>r.createElement(r.Fragment,null),renderGroup(e,t){const n=[];if((null==t?void 0:t.translate)&&n.push(`translate(${t.translate.x}, ${t.translate.y})`),null==t?void 0:t.base){const e=A(t.base.x,t.base.y,t);e&&n.push(e)}return(null==t?void 0:t.matrix)&&n.push(`matrix(${a.m3.getTransform(t.matrix).join(" ")})`),(o,i,a)=>r.createElement("g",{transform:n.join(" "),key:o,opacity:null==t?void 0:t.opacity},e.map(((e,t)=>e(t,i,a))))},renderRect:(e,t,n,o,i)=>k(((a,s,l,c)=>r.createElement("rect",C(b({x:e,y:t,width:n,height:o},P(l,c,i)),{fill:a,stroke:s,transform:A(e+n/2,t+o/2,i)}))),i),renderPolyline(e,t){const n=null!=t?t:{},{partsStyles:o}=n,i=((e,t)=>{var n={};for(var r in e)y.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&m)for(var r of m(e))t.indexOf(r)<0&&x.call(e,r)&&(n[r]=e[r]);return n})(n,["partsStyles"]);if(o&&o.length>0)return(0,l.renderPartStyledPolyline)(this,o,e,i);const a=null==t?void 0:t.skippedLines;if(a&&a.length>0){const n=e.map(((e,t)=>0===t||a.includes(t-1)?`M ${e.x} ${e.y}`:`L ${e.x} ${e.y}`)).join(" ");return k(((e,o,i,a)=>r.createElement("path",C(b({d:n},P(i,a,t)),{fill:e,stroke:o}))),t)}const s=e.map((e=>`${e.x},${e.y}`)).join(" ");return k(((e,n,o,i)=>r.createElement((null==t?void 0:t.closed)?"polygon":"polyline",C(b({points:s},P(o,i,t)),{fill:e,stroke:n}))),t)},renderPolygon(e,t){return this.renderPolyline(e,C(b({},t),{closed:!0}))},renderCircle:(e,t,n,o)=>k(((i,a,s,l)=>r.createElement("circle",C(b({cx:e,cy:t,r:n},P(s,l,o)),{fill:i,stroke:a}))),o),renderEllipse:(e,t,n,o,i)=>k(((a,s,l,c)=>r.createElement("ellipse",C(b({cx:e,cy:t,rx:n,ry:o},P(l,c,i)),{fill:a,stroke:s,transform:A(e,t,i)}))),i),renderArc(e,t,n,o,i,a){const s=_(e,t,n,i),l=_(e,t,n,o),c=i-o<=180,u=((null==a?void 0:a.counterclockwise)?!c:c)?"0":"1",p=(null==a?void 0:a.counterclockwise)?"1":"0";return k(((e,t,o,i)=>r.createElement("path",C(b({d:`M ${s.x} ${s.y} A ${n} ${n} 0 ${u} ${p} ${l.x} ${l.y}`},P(o,i,a)),{fill:e,stroke:t}))),a)},renderEllipseArc(e,t,n,o,i,a,s){const l=T(e,t,n,o,a),c=T(e,t,n,o,i),u=a-i<=180,p=((null==s?void 0:s.counterclockwise)?!u:u)?"0":"1",d=(null==s?void 0:s.counterclockwise)?"1":"0";return k(((i,a,u,f)=>r.createElement("path",C(b({d:`M ${l.x} ${l.y} A ${n} ${o} 0 ${p} ${d} ${c.x} ${c.y}`},P(u,f,s)),{fill:i,stroke:a,transform:A(e,t,s)}))),s)},renderPathCommands(e,t){let n,o="";for(const t of e)if("move"===t.type)o+=` M ${t.to.x} ${t.to.y}`,n=t.to;else if("line"===t.type)o+=` L ${t.to.x} ${t.to.y}`,n=t.to;else if("arc"===t.type){if(n){const e=t.from,r=t.to,a=(0,i.twoPointLineToGeneralFormLine)(n,e),s=(0,i.twoPointLineToGeneralFormLine)(e,r),l=(0,i.getPointSideOfLine)(r,a);if((0,i.isZero)(l))o+=` L ${r.x} ${r.y}`,n=r;else{const e=l<0?0:1,r=(0,u.getTwoGeneralFormLinesIntersectionPoint)((0,i.getParallelLinesByDistance)(a,t.radius)[e],(0,i.getParallelLinesByDistance)(s,t.radius)[e]);if(r){const e=(0,p.getPerpendicularPoint)(r,a),i=(0,p.getPerpendicularPoint)(r,s);o+=` L ${e.x} ${e.y} A ${t.radius} ${t.radius} 0 0 ${l<0?1:0} ${i.x} ${i.y}`,n=i}}}}else"ellipseArc"===t.type?(o+=` A ${t.rx} ${t.ry} ${t.angle} ${t.largeArc?1:0} ${t.sweep?1:0} ${t.to.x} ${t.to.y}`,n=t.to):"bezierCurve"===t.type?(o+=` C ${t.cp1.x} ${t.cp1.y}, ${t.cp2.x} ${t.cp2.y}, ${t.to.x} ${t.to.y}`,n=t.to):"quadraticCurve"===t.type?(o+=` Q ${t.cp.x} ${t.cp.y}, ${t.to.x} ${t.to.y}`,n=t.to):"close"===t.type&&(o+=" Z");return k(((e,n,i,a)=>r.createElement("path",C(b({d:o},P(i,a,t)),{fill:e,stroke:n}))),t)},renderText:(e,t,n,o,i,a,s)=>k(((o,l,c,u)=>{var p;return r.createElement("text",{x:e,y:t,textAnchor:"center"===(null==s?void 0:s.textAlign)?"middle":"right"===(null==s?void 0:s.textAlign)?"end":"start",alignmentBaseline:"top"===(null==s?void 0:s.textBaseline)?"before-edge":"bottom"===(null==s?void 0:s.textBaseline)?"after-edge":null!=(p=null==s?void 0:s.textBaseline)?p:"alphabetic",style:{fill:o,fontWeight:null==s?void 0:s.fontWeight,fontSize:`${i}px`,fontStyle:null==s?void 0:s.fontStyle,fontFamily:a,strokeWidth:null==s?void 0:s.strokeWidth,stroke:l,strokeDasharray:R(c,u,s),strokeDashoffset:null==s?void 0:s.dashOffset,fillOpacity:null==s?void 0:s.fillOpacity,strokeOpacity:null==s?void 0:s.strokeOpacity}},n)}),C(b({},s),{fillColor:"number"==typeof o?o:void 0,fillPattern:void 0!==o&&"number"!=typeof o?o:void 0}),!0),renderImage(e,t,n,o,i,a){return s=s=>r.createElement("image",{filter:s,href:e,x:t,y:n,width:o,height:i,preserveAspectRatio:"none",crossOrigin:null==a?void 0:a.crossOrigin,opacity:null==a?void 0:a.opacity}),l=null==a?void 0:a.filters,e=>{let t,n;if(l&&l.length>0){const e=S(l),o=[];l.forEach(((e,t)=>{if("brightness"===e.type)o.push(r.createElement("feComponentTransfer",{key:t},r.createElement("feFuncR",{type:"linear",slope:e.value}),r.createElement("feFuncG",{type:"linear",slope:e.value}),r.createElement("feFuncB",{type:"linear",slope:e.value})));else if("contrast"===e.type){const n=.5*(1-e.value);o.push(r.createElement("feComponentTransfer",{key:t},r.createElement("feFuncR",{type:"linear",slope:e.value,intercept:n}),r.createElement("feFuncG",{type:"linear",slope:e.value,intercept:n}),r.createElement("feFuncB",{type:"linear",slope:e.value,intercept:n})))}else if("hue-rotate"===e.type)o.push(r.createElement("feColorMatrix",{key:t,type:"hueRotate",values:e.value.toString()}));else if("saturate"===e.type)o.push(r.createElement("feColorMatrix",{key:t,type:"saturate",values:e.value.toString()}));else if("grayscale"===e.type){const n=1-e.value;o.push(r.createElement("feColorMatrix",{key:t,type:"matrix",values:`\n ${.2126+.7874*n} ${.7152-.7152*n} ${.0722-.0722*n} 0 0\n ${.2126-.2126*n} ${.7152+.2848*n} ${.0722-.0722*n} 0 0\n ${.2126-.2126*n} ${.7152-.7152*n} ${.0722+.9278*n} 0 0\n 0 0 0 1 0`}))}else if("invert"===e.type){const n=`${e.value} ${1-e.value}`;o.push(r.createElement("feComponentTransfer",{key:t},r.createElement("feFuncR",{type:"table",tableValues:n}),r.createElement("feFuncG",{type:"table",tableValues:n}),r.createElement("feFuncB",{type:"table",tableValues:n})))}else if("sepia"===e.type){const n=1-e.value;o.push(r.createElement("feColorMatrix",{key:t,type:"matrix",values:`\n ${.393+.607*n} ${.769-.769*n} ${.189-.189*n} 0 0\n ${.349-.349*n} ${.686+.314*n} ${.168-.168*n} 0 0\n ${.272-.272*n} ${.534-.534*n} ${.131+.869*n} 0 0\n 0 0 0 1 0`}))}else"opacity"===e.type?o.push(r.createElement("feComponentTransfer",{key:t},r.createElement("feFuncA",{type:"table",tableValues:`0 ${e.value}`}))):"blur"===e.type&&o.push(r.createElement("feGaussianBlur",{key:t,in:"SourceGraphic",stdDeviation:e.value}))})),t=r.createElement("filter",{id:e},o),n=`url(#${e})`}return r.createElement(r.Fragment,{key:e},t,s(n))};var s,l},renderPath(e,t){const n=e.map((e=>e.map(((e,t)=>0===t?`M ${e.x} ${e.y}`:`L ${e.x} ${e.y}`)).join(" "))),o=(null==t?void 0:t.clip)&&n.length>1,i=o?n.slice(1).map(((e,t)=>r.createElement("path",{key:t,d:e,fill:"black"}))):void 0;return k(((e,i,a,s)=>{let l;return o?l=n[0]:(l=n.join(" "),(null==t?void 0:t.closed)&&(l+=" Z")),r.createElement("path",C(b({d:l},P(a,s,t)),{fill:e,stroke:i,fillRule:"evenodd"}))}),t,void 0,i)}};function k(e,t,n,i){return(a,s,l)=>{let c,u,p,d=void 0!==(null==t?void 0:t.fillColor)?(0,o.getColorString)(t.fillColor):"none",f=void 0!==(null==t?void 0:t.strokeColor)?(0,o.getColorString)(t.strokeColor):n?void 0:(0,o.getColorString)(0);if(null==t?void 0:t.strokePattern){const e=S(t.strokePattern);u=r.createElement("pattern",{id:e,patternUnits:"userSpaceOnUse",width:t.strokePattern.width,height:t.strokePattern.height},t.strokePattern.pattern()(e,s,l)),f=`url(#${e})`}else if(null==t?void 0:t.strokeLinearGradient){const e=S(t.strokeLinearGradient);u=r.createElement("linearGradient",{id:e,gradientUnits:"userSpaceOnUse",x1:t.strokeLinearGradient.start.x,y1:t.strokeLinearGradient.start.y,x2:t.strokeLinearGradient.end.x,y2:t.strokeLinearGradient.end.y},t.strokeLinearGradient.stops.map((e=>r.createElement("stop",{key:e.offset,offset:e.offset,stopColor:(0,o.getColorString)(e.color,e.opacity)})))),f=`url(#${e})`}else if(null==t?void 0:t.strokeRadialGradient){const e=S(t.strokeRadialGradient);u=r.createElement("radialGradient",{id:e,gradientUnits:"userSpaceOnUse",fx:t.strokeRadialGradient.start.x,fy:t.strokeRadialGradient.start.y,fr:t.strokeRadialGradient.start.r,cx:t.strokeRadialGradient.end.x,cy:t.strokeRadialGradient.end.y,r:t.strokeRadialGradient.end.r},t.strokeRadialGradient.stops.map((e=>r.createElement("stop",{key:e.offset,offset:e.offset,stopColor:(0,o.getColorString)(e.color,e.opacity)})))),f=`url(#${e})`}if(null==t?void 0:t.fillPattern){const e=S(t.fillPattern);c=r.createElement("pattern",{id:e,patternUnits:"userSpaceOnUse",width:t.fillPattern.width,height:t.fillPattern.height},t.fillPattern.pattern()(e,s,l)),d=`url(#${e})`}else if(null==t?void 0:t.fillLinearGradient){const e=S(t.fillLinearGradient);c=r.createElement("linearGradient",{id:e,gradientUnits:"userSpaceOnUse",x1:t.fillLinearGradient.start.x,y1:t.fillLinearGradient.start.y,x2:t.fillLinearGradient.end.x,y2:t.fillLinearGradient.end.y},t.fillLinearGradient.stops.map((e=>r.createElement("stop",{key:e.offset,offset:e.offset,stopColor:(0,o.getColorString)(e.color,e.opacity)})))),d=`url(#${e})`}else if(null==t?void 0:t.fillRadialGradient){const e=S(t.fillRadialGradient);c=r.createElement("radialGradient",{id:e,gradientUnits:"userSpaceOnUse",fx:t.fillRadialGradient.start.x,fy:t.fillRadialGradient.start.y,fr:t.fillRadialGradient.start.r,cx:t.fillRadialGradient.end.x,cy:t.fillRadialGradient.end.y,r:t.fillRadialGradient.end.r},t.fillRadialGradient.stops.map((e=>r.createElement("stop",{key:e.offset,offset:e.offset,stopColor:(0,o.getColorString)(e.color,e.opacity)})))),d=`url(#${e})`}const g=e(d,f,s,l);if(null==t?void 0:t.clip){const n=S(t.clip),o=t.clip()(n,s,l);i?(c=r.createElement(r.Fragment,null,r.createElement("mask",{id:n},e("white",f,s,l),i),g),p=r.createElement("g",{mask:`url(#${n})`},o)):(c=r.createElement(r.Fragment,null,r.createElement("clipPath",{id:n},g),g),p=r.createElement("g",{clipPath:`url(#${n})`},o))}else p=g;return r.createElement(r.Fragment,{key:a},c,u,p)}}const w=new s.WeakmapCache;function S(e){return w.get(e,(()=>Math.random().toString()))}function P(e,t,n){var r,o,i,a;return{strokeWidth:null!=(r=null==n?void 0:n.strokeWidth)?r:1,vectorEffect:1===t?void 0:"non-scaling-stroke",strokeDasharray:R(e,t,n),strokeDashoffset:null==n?void 0:n.dashOffset,strokeMiterlimit:null!=(o=null==n?void 0:n.miterLimit)?o:d.defaultMiterLimit,strokeLinejoin:null!=(i=null==n?void 0:n.lineJoin)?i:"miter",strokeLinecap:null!=(a=null==n?void 0:n.lineCap)?a:"butt",fillOpacity:null==n?void 0:n.fillOpacity,strokeOpacity:null==n?void 0:n.strokeOpacity}}function R(e,t,n){if((null==n?void 0:n.dashArray)&&n.dashArray.length>0)return n.dashArray.map((n=>n*(1===t?1:e))).join(" ")}function _(e,t,n,r){return T(e,t,n,n,r)}function T(e,t,n,r,o){const i=(0,c.angleToRadian)(o);return{x:e+n*Math.cos(i),y:t+r*Math.sin(i)}}function A(e,t,n){return(null==n?void 0:n.angle)?`rotate(${n.angle},${e},${t})`:(null==n?void 0:n.rotation)?`rotate(${(0,c.radianToAngle)(n.rotation)},${e},${t})`:void 0}},9625:(e,t,n)=>{"use strict";n.r(t),n.d(t,{reactWebglRenderTarget:()=>v});var r=n(7378),o=n(9195),i=n(5136),a=n(8485),s=n(7504),l=n(3516),c=Object.defineProperty,u=Object.defineProperties,p=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable,h=(e,t,n)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,m=(e,t)=>{for(var n in t||(t={}))f.call(t,n)&&h(e,n,t[n]);if(d)for(var n of d(t))g.call(t,n)&&h(e,n,t[n]);return e},y=(e,t)=>u(e,p(t)),x=(e,t)=>{var n={};for(var r in e)f.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&d)for(var r of d(e))t.indexOf(r)<0&&g.call(e,r)&&(n[r]=e[r]);return n};const v={type:"webgl",renderResult:(e,t,n,o)=>r.createElement(b,{width:t,height:n,attributes:null==o?void 0:o.attributes,graphics:e,transform:null==o?void 0:o.transform,backgroundColor:null==o?void 0:o.backgroundColor,debug:null==o?void 0:o.debug,strokeWidthScale:null==o?void 0:o.strokeWidthScale}),renderEmpty:()=>()=>[],renderGroup:(e,t)=>(n,r,o,i)=>(0,a.getGroupGraphics)(e.map((e=>e(n,r))).flat(),o,t,i),renderRect(e,t,n,r,i){let a=[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}],s=0;if((null==i?void 0:i.angle)?s=(0,l.angleToRadian)(i.angle):(null==i?void 0:i.rotation)&&(s=i.rotation),s){const i={x:e+n/2,y:t+r/2};a=a.map((e=>(0,o.rotatePosition)(e,i,s)))}return this.renderPolygon(a,i)},renderPolyline(e,t){const n=null!=t?t:{},{partsStyles:r}=n,a=x(n,["partsStyles"]);if(r&&r.length>0)return(0,i.renderPartStyledPolyline)(this,r,e,a);const s=null!=t?t:{},{dashArray:l,closed:c}=s,u=x(s,["dashArray","closed"]);c&&(e=(0,o.polygonToPolyline)(e));const p=(0,o.dashedPolylineToLines)(e,l,null==t?void 0:t.skippedLines,null==t?void 0:t.dashOffset);return this.renderPath(p,u)},renderPolygon(e,t){return this.renderPolyline(e,y(m({},t),{closed:!0}))},renderCircle(e,t,n,r){const i=(0,o.arcToPolyline)({x:e,y:t,r:n,startAngle:0,endAngle:360},5);return this.renderPolyline(i,r)},renderEllipse(e,t,n,r,i){let a=0;(null==i?void 0:i.angle)?a=i.angle:(null==i?void 0:i.rotation)&&(a=(0,l.radianToAngle)(i.rotation));const s=(0,o.ellipseToPolygon)({cx:e,cy:t,rx:n,ry:r,angle:a},5);return this.renderPolygon(s,i)},renderArc(e,t,n,r,i,a){const s=(0,o.arcToPolyline)({x:e,y:t,r:n,startAngle:r,endAngle:i,counterclockwise:null==a?void 0:a.counterclockwise},5);return this.renderPolyline(s,a)},renderEllipseArc(e,t,n,r,i,a,s){let c=0;(null==s?void 0:s.angle)?c=s.angle:(null==s?void 0:s.rotation)&&(c=(0,l.radianToAngle)(s.rotation));const u=(0,o.ellipseArcToPolyline)({cx:e,cy:t,rx:n,ry:r,startAngle:i,endAngle:a,angle:c,counterclockwise:null==s?void 0:s.counterclockwise},5);return this.renderPolyline(u,s)},renderPathCommands(e,t){const n=(0,i.getPathCommandsPoints)(e),r=(0,i.pathCommandPointsToPath)(n);return this.renderGroup(r.map((e=>this.renderPath(e,t))))},renderText:(e,t,n,r,o,i,s)=>(l,c)=>{let u,p;u=void 0!==r&&"number"!=typeof r?{graphics:r.pattern()(l,c),width:r.width,height:r.height}:r,void 0!==(null==s?void 0:s.strokePattern)&&(p={graphics:s.strokePattern.pattern()(l,c),width:s.strokePattern.width,height:s.strokePattern.height});const d=(0,a.getTextGraphic)(e,t,n,u,o,i,y(m({},s),{strokePattern:p}));return d?[d]:[]},renderImage:(e,t,n,r,o,i)=>(s,l)=>{const c=(0,a.getImageGraphic)(e,t,n,r,o,l,i);return c?[c]:[]},renderPath:(e,t)=>(n,r)=>{let o,i;return void 0!==(null==t?void 0:t.clip)&&(o={graphics:t.clip()(n,r)}),void 0!==(null==t?void 0:t.fillPattern)&&(o={graphics:t.fillPattern.pattern()(n,r),width:t.fillPattern.width,height:t.fillPattern.height}),void 0!==(null==t?void 0:t.strokePattern)&&(i={graphics:t.strokePattern.pattern()(n,r),width:t.strokePattern.width,height:t.strokePattern.height}),(0,a.getPathGraphics)(e,n,y(m({},t),{fillPattern:o,strokePattern:i}))}};function b(e){const t=r.useRef(null),[n,o]=r.useState(0),i=r.useRef();return r.useEffect((()=>{t.current&&(t.current.width=e.width,t.current.height=e.height)}),[e.width,e.height]),r.useEffect((()=>{if(!t.current)return;const n=(0,a.createWebglRenderer)(t.current);if(!n)return;const r=()=>o((e=>e+1));i.current=(t,o,i,a,s,l,c)=>{const u=performance.now();n(t.map((e=>e(l,r))).flat(),o,i,a,s,c),e.debug&&console.info(Math.round(performance.now()-u))}}),[t.current,e.debug]),r.useEffect((()=>{var t,n,r,o,a,l,c,u,p;if(i.current){const d=null!=(n=null==(t=e.transform)?void 0:t.x)?n:0,f=null!=(o=null==(r=e.transform)?void 0:r.y)?o:0,g=null!=(l=null==(a=e.transform)?void 0:a.scale)?l:1,h=(0,s.colorNumberToRec)(null!=(c=e.backgroundColor)?c:16777215),m=null!=(u=e.strokeWidthScale)?u:1;i.current(e.graphics,h,d,f,g,m,null==(p=e.transform)?void 0:p.rotate)}}),[e.graphics,e.backgroundColor,i.current,e.transform,n]),r.createElement("canvas",m({ref:t,width:e.width,height:e.height},e.attributes))}},7043:(e,t,n)=>{"use strict";n.r(t),n.d(t,{reactWebgpuRenderTarget:()=>h});var r=n(7378),o=n(7504),i=n(9417),a=n(9625),s=Object.defineProperty,l=Object.defineProperties,c=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,p=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable,f=(e,t,n)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g=(e,t)=>{for(var n in t||(t={}))p.call(t,n)&&f(e,n,t[n]);if(u)for(var n of u(t))d.call(t,n)&&f(e,n,t[n]);return e};const h=l(g({},a.reactWebglRenderTarget),c({type:"webgpu",renderResult:(e,t,n,o)=>r.createElement(m,{width:t,height:n,attributes:null==o?void 0:o.attributes,graphics:e,transform:null==o?void 0:o.transform,backgroundColor:null==o?void 0:o.backgroundColor,debug:null==o?void 0:o.debug,strokeWidthScale:null==o?void 0:o.strokeWidthScale})}));function m(e){const t=r.useRef(null),[n,a]=r.useState(0),s=r.useRef();return r.useEffect((()=>{t.current&&(t.current.width=e.width,t.current.height=e.height)}),[e.width,e.height]),r.useEffect((()=>{t.current&&(0,i.createWebgpuRenderer)(t.current).then((t=>{if(!t)return;const n=()=>a((e=>e+1));s.current=(r,o,i,a,s,l,c)=>{const u=performance.now();t(r.map((e=>e(l,n))).flat(),o,i,a,s,c),e.debug&&console.info(Math.round(performance.now()-u))},n()}))}),[t.current,e.debug]),r.useEffect((()=>{var t,n,r,i,a,l,c,u,p;if(s.current){const d=null!=(n=null==(t=e.transform)?void 0:t.x)?n:0,f=null!=(i=null==(r=e.transform)?void 0:r.y)?i:0,g=null!=(l=null==(a=e.transform)?void 0:a.scale)?l:1,h=(0,o.colorNumberToRec)(null!=(c=e.backgroundColor)?c:16777215),m=null!=(u=e.strokeWidthScale)?u:1;s.current(e.graphics,h,d,f,g,m,null==(p=e.transform)?void 0:p.rotate)}}),[e.graphics,e.backgroundColor,s.current,e.transform,n]),r.createElement("canvas",g({ref:t,width:e.width,height:e.height},e.attributes))}},6299:(e,t,n)=>{"use strict";n.r(t),n.d(t,{reverseTransformPosition:()=>o,scaleByCursorPosition:()=>l,transformPosition:()=>i,zoomToFit:()=>a,zoomToFitPoints:()=>s});var r=n(9195);function o(e,t){return t?(e={x:(e.x-t.center.x-t.x)/t.scale+t.center.x,y:(e.y-t.center.y-t.y)/t.scale+t.center.y},t.rotate&&(e=(0,r.rotatePosition)(e,{x:0,y:0},-t.rotate)),e):e}function i(e,t){return t?(t.rotate&&(e=(0,r.rotatePosition)(e,{x:0,y:0},t.rotate)),{x:(e.x-t.center.x)*t.scale+t.center.x+t.x,y:(e.y-t.center.y)*t.scale+t.center.y+t.y}):e}function a(e,{width:t,height:n},o,i=.8){if(e&&!(0,r.equals)(e.start.x,e.end.x)&&!(0,r.equals)(e.start.y,e.end.y)){const a=Math.min(t/Math.abs(e.end.x-e.start.x),n/Math.abs(e.end.y-e.start.y))*i;return{scale:a,x:(o.x-(0,r.getTwoNumberCenter)(e.start.x,e.end.x))*a,y:(o.y-(0,r.getTwoNumberCenter)(e.start.y,e.end.y))*a}}}function s(e,{width:t,height:n},o,i=.8,a){const s=(0,r.getPointsBoundingUnsafe)(e);if(s&&!(0,r.equals)(s.start.x,s.end.x)&&!(0,r.equals)(s.start.y,s.end.y)){let l,c;if(a){const t=(0,r.getPointsBoundingUnsafe)(e.map((e=>(0,r.rotatePosition)(e,{x:0,y:0},a))));l=Math.abs(t.end.x-t.start.x),c=Math.abs(t.end.y-t.start.y)}else l=Math.abs(s.end.x-s.start.x),c=Math.abs(s.end.y-s.start.y);const u=Math.min(t/l,n/c)*i;let p=(0,r.getTwoPointCenter)(s.start,s.end);return a&&(p=(0,r.rotatePosition)(p,{x:0,y:0},a)),{scale:u,x:(o.x-p.x)*u,y:(o.y-p.y)*u}}}function l({width:e,height:t},n,r){return{setX:t=>r.x-e/2-(r.x-e/2-t)*n,setY:e=>r.y-t/2-(r.y-t/2-e)*n}}},2997:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Scrollbar:()=>p});var r=n(7378),o=n(6239),i=Object.defineProperty,a=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,c=(e,t,n)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,u=(e,t)=>{for(var n in t||(t={}))s.call(t,n)&&c(e,n,t[n]);if(a)for(var n of a(t))l.call(t,n)&&c(e,n,t[n]);return e};function p(e){const{type:t,containerSize:n,contentSize:i}=e,{onStart:a,mask:s}=(0,o.useDragMove)(void 0,{transformOffset:({x:r,y:o})=>{const i=Math.max(Math.min("vertical"===t?o:r,n-l),0);return i!==d&&e.onChange((i-c)*p),{x:r,y:o}}});if(n>=i)return null;const l=Math.max(12,i?n*n/i:0),c=(n/2-l/2)*("head"===e.align?0:"tail"===e.align?2:1),p=-(i-n)/(n-l),d=e.value/p+c,f=u({position:"absolute",userSelect:"none"},e.style),g={background:"rgba(0, 0, 0, 0.3)",borderRadius:"4px",position:"absolute",cursor:"grab"};return"vertical"===t?(f.width="8px",f.height=`${n}px`,f.right="0px",f.top="0px",g.width="8px",g.height=`${l}px`,g.top=`${d}px`):(f.height="8px",f.width=`${n}px`,f.left="0px",f.bottom="0px",g.height="8px",g.width=`${l}px`,g.left=`${d}px`),r.createElement("div",{style:f},r.createElement("div",{style:g,onMouseDown:e=>a({x:e.clientX,y:e.clientY},{["vertical"===t?"y":"x"]:d})}),s)}},7732:(e,t,n)=>{"use strict";n.r(t),n.d(t,{useAttributedTextEditor:()=>E});var r=n(7378),o=n(7310),i=n(9195),a=n(1799),s=n(2997),l=n(1301),c=n(1502),u=n(2357),p=n(8533),d=n(8137),f=Object.defineProperty,g=Object.defineProperties,h=Object.getOwnPropertyDescriptors,m=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,v=(e,t,n)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))y.call(t,n)&&v(e,n,t[n]);if(m)for(var n of m(t))x.call(t,n)&&v(e,n,t[n]);return e},C=(e,t)=>g(e,h(t));function E(e){var t,n;const[f,g]=r.useState(0),[h,m]=r.useState(),y=r.useRef(null),[x,v]=r.useState(0),[E,k]=r.useState(),[w,S]=r.useState(!1),P=t=>{var n,r,o;if(e.readOnly)return;let i,a,s=E;te?(a=te.min,i=_(te),ce.attributes&&!(null==(n=e.getReadonlyType)?void 0:n.call(e,ce.attributes))&&(s={attributes:ce.attributes,index:te.min})):(a=f,i=e.state),g(a+t.length);const l=[];let c=0,u=!1;const p=(null==(r=Y.find((e=>f===e.min)))?void 0:r.min)===a,d=(null==(o=Y.find((e=>f===e.max)))?void 0:o.max)===a;for(const e of i){const n=a-c,r=M(e);if(n>=0&&(d?n0&&l.push({attributes:e.attributes,insert:e.insert.slice(0,n)}),l.push({attributes:b(b({},e.attributes),s.attributes),insert:t}),n{if(e.readOnly)return;let o,i;te?(i=te.min,o=_(te)):(i=f,o=e.state),void 0!==r&&(i=r),g(i+n);const a=[];let s=0,l=!1;for(const e of o){const r=i-s,o=M(e);r>=0&&r<=o&&!l?(a.push({attributes:e.attributes,insert:e.insert.slice(0,r)}),a.push(...t),s+=n,a.push({attributes:e.attributes,insert:e.insert.slice(r)}),l=!0):a.push(e),s+=o}l||a.push(...t),e.setState(a)},_=t=>{g(t.min),m(void 0);const n=[];let r=0;for(const o of e.state){const e=t.min-r,i=t.max-r,a=M(o);e<0?i>=a||(i>=0?i0&&n.push({attributes:o.attributes,insert:o.insert.slice(0,e)}),i{const n=[];let r=0;for(const o of e.state){const e=t.min-r,i=t.max-r,a=M(o);e<0?i>=a?n.push(o):i>=0&&i>0&&n.push({attributes:o.attributes,insert:o.insert.slice(0,i)}):e{if(void 0===te)return;const n=T(te);return t&&e.setState(_(te)),n},M=t=>{var n;return!0===(null==(n=e.getReadonlyType)?void 0:n.call(e,t.attributes))?1:t.insert.length},L=e=>{const t=U(z(e)).location,{newSelectionStart:n,newLocation:r}=(0,d.getWordByDoubleClick)(q,t,(e=>e.insert));void 0!==n&&m(X({location:n},"min")),void 0!==r&&g(X({location:r},"max"))},O=t=>{var n;if(!t.nativeEvent.isComposing&&229!==t.keyCode&&!(null==(n=e.processInput)?void 0:n.call(e,t))&&!["CapsLock","Tab","Shift","Meta","Escape","Control"].includes(t.key)){if("Backspace"===t.key)return(()=>{if(e.readOnly)return;if(te)return void e.setState(_(te));if(0===f)return;const t=Y.find((e=>f===e.max));if(t)return g(t.min),void e.setState(_(t));g(f-1);const n=[];let r=0,o=!1;for(const t of e.state){const e=f-r,i=M(t);e>=0&&e<=i&&!o?(n.push({attributes:t.attributes,insert:t.insert.slice(0,e-1)+t.insert.slice(e)}),o=!0):n.push(t),r+=i}e.setState(n)})();if("Delete"===t.key)return(()=>{if(e.readOnly)return;if(te)return void e.setState(_(te));if(f===q.length)return;const t=Y.find((e=>f===e.min));if(t)return void e.setState(_(t));const n=[];let r=0,o=!1;for(const t of e.state){const e=f-r+1,i=M(t);e>=0&&e<=i&&!o?(n.push({attributes:t.attributes,insert:t.insert.slice(0,e-1)+t.insert.slice(e)}),o=!0):n.push(t),r+=i}e.setState(n)})();if("ArrowLeft"===t.key)return((e=!1)=>{if(!e&&te)return m(void 0),void g(te.min);0!==f&&(e&&void 0===h&&m(f),g(X({location:f-1},"min")))})(t.shiftKey);if("ArrowRight"===t.key)return((e=!1)=>{if(!e&&te)return m(void 0),void g(te.max);f!==q.length&&(e&&void 0===h&&m(f),g(X({location:f+1},"max")))})(t.shiftKey);if("ArrowUp"===t.key)return((e=!1)=>{if(!e&&te)return m(void 0),void g(te.min);e&&void 0===h&&m(f),g(ae{if(!e&&te)return m(void 0),void g(te.max);e&&void 0===h&&m(f),se>=Q.length-1?g(q.length):g(X(U({x:ie,y:ae+Q[se]+Q[se+1]/2+V},!1),"max"))})(t.shiftKey);if("Enter"===t.key)return P("\n");if((0,u.metaKeyIfMacElseCtrlKey)(t)){if("a"===t.key)return m(0),void g(q.length);if("v"===t.key)return e.readOnly||navigator.clipboard.readText().then((e=>{if(e){P(e);try{const t=JSON.parse(e);R(t,function(e){let t=0;for(const n of e)t+=n.insert.length;return t}(t))}catch(t){P(e)}}})),void t.preventDefault();if("c"===t.key||"x"===t.key){const e=A("x"===t.key);return void(e&&navigator.clipboard.writeText(JSON.stringify(e)))}}else t.preventDefault(),1===t.key.length&&P(t.key)}},I=()=>{var t,n;null==(t=e.onLocationChanged)||t.call(e,-1),null==(n=e.onBlur)||n.call(e)},F=r.useRef(),[D,B]=r.useState(),z=e=>{const t=e.target.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}},U=(t,n=!0)=>{const r=(0,o.getFlowLayoutLocation)(t,Q,K,V,e.getWidth,n);return r?(S(r.lineEnd),r):{location:K.length-1}},N=t=>{t.preventDefault();const n=z(t),r=X(U(n),"nearest");if(t.shiftKey)(void 0===h||Math.abs(h-r)