=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(this.values),n=t.next(),e.label=1;case 1:return n.done?[3,4]:[4,n.value];case 2:e.sent(),e.label=3;case 3:return n=t.next(),[3,1];case 4:return[3,7];case 5:return r=e.sent(),r={error:r},[3,7];case 6:try{n&&!n.done&&(i=t.return)&&i.call(t)}finally{if(r)throw r.error}return[7];case 7:return[2]}})},Object.defineProperty(i.prototype,"rgba",{get:function(){return[this.values[0],this.values[1],this.values[2],this.values[3]]},set:function(e){this.values[0]=e[0],this.values[1]=e[1],this.values[2]=e[2],this.values[3]=e[3]},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,0,{get:function(){return this.values[0]},set:function(e){this.values[0]=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"r",{get:function(){return this.values[0]},set:function(e){this.values[0]=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,1,{get:function(){return this.values[1]},set:function(e){this.values[1]=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"g",{get:function(){return this.values[1]},set:function(e){this.values[1]=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,2,{get:function(){return this.values[2]},set:function(e){this.values[2]=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"b",{get:function(){return this.values[2]},set:function(e){this.values[2]=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,3,{get:function(){return this.values[3]},set:function(e){this.values[3]=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"a",{get:function(){return this.values[3]},set:function(e){this.values[3]=e},enumerable:!1,configurable:!0}),i.cache={},i._cache={};var U=i;function i(e,t,n,r){void 0===r&&(r=1),this.values=[0,0,0,1],this.values[0]=e,this.values[1]=t,this.values[2]=n,this.values[3]=r}e.prototype.calculateLayouts=function(e){var r=[],i=0,t="vertex"===e?this.vertexFormats:this.instanceFormats,o="vertex"===e?this.vertexLocationOffset:this.instanceLocationOffset;return t.forEach(function(e,t){var n=function(e){switch(e){case"float16x2":return 4;case"float16x4":return 8;case"float32":return Float32Array.BYTES_PER_ELEMENT;case"float32x2":return 2*Float32Array.BYTES_PER_ELEMENT;case"float32x3":return 3*Float32Array.BYTES_PER_ELEMENT;case"float32x4":return 4*Float32Array.BYTES_PER_ELEMENT;case"sint8x2":case"snorm8x2":return 2*Int8Array.BYTES_PER_ELEMENT;case"sint8x4":case"snorm8x4":return 4*Int8Array.BYTES_PER_ELEMENT;case"sint16x2":case"snorm16x2":return 2*Int16Array.BYTES_PER_ELEMENT;case"sint16x4":case"snorm16x4":return 4*Int16Array.BYTES_PER_ELEMENT;case"sint32":return Int32Array.BYTES_PER_ELEMENT;case"sint32x2":return 2*Int32Array.BYTES_PER_ELEMENT;case"sint32x3":return 3*Int32Array.BYTES_PER_ELEMENT;case"sint32x4":return 4*Int32Array.BYTES_PER_ELEMENT;case"uint32":return Uint32Array.BYTES_PER_ELEMENT;case"uint32x2":return 2*Uint32Array.BYTES_PER_ELEMENT;case"uint32x3":return 3*Uint32Array.BYTES_PER_ELEMENT;case"uint32x4":return 4*Uint32Array.BYTES_PER_ELEMENT;case"uint8x2":case"unorm8x2":return 2*Uint8Array.BYTES_PER_ELEMENT;case"uint8x4":case"unorm8x4":return 4*Uint8Array.BYTES_PER_ELEMENT;case"uint16x2":case"unorm16x2":return 2*Uint16Array.BYTES_PER_ELEMENT;case"uint16x4":case"unorm16x4":return 4*Uint16Array.BYTES_PER_ELEMENT;case"unorm10-10-10-2":return 4;default:return 0}}(e);0K&&(v=p,g=u,x=l,p=d+K*(a&&dthis.size||this.leq(i[o].key,i[t].key)){i[r[e].handle=o].node=e;break}i[r[e].handle=t].node=e,e=n}},floatUp_:function(e){for(var t,n,r=this.nodes,i=this.handles,o=r[e].handle;;){if(t=r[n=e>>1].handle,0==n||this.leq(i[t].key,i[o].key)){i[r[e].handle=o].node=e;break}i[r[e].handle=t].node=e,e=n}},init:function(){for(var e=this.size;1<=e;--e)this.floatDown_(e);this.initialized=!0},min:function(){return this.handles[this.nodes[1].handle].key},isEmpty:function(){this.size},insert:function(e){var t,n,r=++this.size;if(2*r>this.max){this.max*=2,n=this.nodes.length,this.nodes.length=this.max+1;for(var i=n;i>1].handle].key,r[n[t].handle].key)?this.floatDown_(t):this.floatUp_(t)),r[e].key=null,r[e].node=this.freeList,this.freeList=e}};var b={};function be(){this.mesh=null,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=g.WINDING_ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}b.regionBelow=function(e){return e.nodeUp.prev.key},b.regionAbove=function(e){return e.nodeUp.next.key},b.debugEvent=function(e){},b.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},b.edgeLeq=function(e,t,n){var e=e.event,t=t.eUp,n=n.eUp;return t.Dst===e?n.Dst===e?h.vertLeq(t.Org,n.Org)?h.edgeSign(n.Dst,t.Org,n.Org)<=0:0<=h.edgeSign(t.Dst,n.Org,t.Org):h.edgeSign(n.Dst,e,n.Org)<=0:n.Dst===e?0<=h.edgeSign(t.Dst,e,t.Org):(t=h.edgeEval(t.Dst,e,t.Org),h.edgeEval(n.Dst,e,n.Org)<=t)},b.deleteRegion=function(e,t){t.fixUpperEdge&&v(0===t.eUp.winding),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},b.fixUpperEdge=function(e,t,n){v(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,(t.eUp=n).activeRegion=t},b.topLeftRegion=function(e,t){for(var n,r=t.eUp.Org;(t=b.regionAbove(t)).eUp.Org===r;);if(t.fixUpperEdge){if(null===(n=e.mesh.connect(b.regionBelow(t).eUp.Sym,t.eUp.Lnext)))return null;b.fixUpperEdge(e,t,n),t=b.regionAbove(t)}return t},b.topRightRegion=function(e){for(var t=e.eUp.Dst,e=null;(e=b.regionAbove(e)).eUp.Dst===t;);return e},b.addRegionBelow=function(e,t,n){var r=new we;return r.eUp=n,r.nodeUp=e.dict.insertBefore(t.nodeUp,r),r.fixUpperEdge=!1,r.sentinel=!1,r.dirty=!1,n.activeRegion=r},b.isWindingInside=function(e,t){switch(e.windingRule){case g.WINDING_ODD:return 0!=(1&t);case g.WINDING_NONZERO:return 0!=t;case g.WINDING_POSITIVE:return 0Math.abs(e[0])&&(t=1),t=Math.abs(e[2])>Math.abs(e[t])?2:t},computeNormal_:function(e){for(var t,n,r,i,o,s=[0,0,0],a=[0,0,0],u=[0,0,0],l=[0,0,0],c=[0,0,0],f=[null,null,null],h=[null,null,null],d=this.mesh.vHead,p=d.next,v=0;v<3;++v)r=p.coords[v],a[v]=r,h[v]=p,s[v]=r,f[v]=p;for(p=d.next;p!==d;p=p.next)for(v=0;v<3;++v)(r=p.coords[v])this.bmax[0]&&(this.bmax[0]=e.s),e.tthis.bmax[1]&&(this.bmax[1]=e.t))},addWinding_:function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},tessellateMonoRegion_:function(e,t){for(r=t.anEdge,v(r.Lnext!==r&&r.Lnext.Lnext!==r);h.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;h.vertLeq(r.Org,r.Dst);r=r.Lnext);for(n=r.Lprev;r.Lnext!==n;)if(h.vertLeq(r.Dst,n.Org)){for(;n.Lnext!==r&&(h.edgeGoesLeft(n.Lnext)||h.edgeSign(n.Org,n.Dst,n.Lnext.Dst)<=0);)var n=e.connect(n.Lnext,n).Sym;n=n.Lprev}else{for(;n.Lnext!=r&&(h.edgeGoesRight(r.Lprev)||0<=h.edgeSign(r.Dst,r.Org,r.Lprev.Org));)var r=e.connect(r,r.Lprev).Sym;r=r.Lnext}for(v(n.Lnext!==r);n.Lnext.Lnext!==r;)n=e.connect(n.Lnext,n).Sym;return!0},tessellateInterior_:function(e){for(var t,n=e.fHead.next;n!==e.fHead;n=t)if(t=n.next,n.inside&&!this.tessellateMonoRegion_(e,n))return!1;return!0},discardExterior_:function(e){for(var t,n=e.fHead.next;n!==e.fHead;n=t)t=n.next,n.inside||e.zapFace(n)},setWindingNumber_:function(e,t,n){for(var r,i=e.eHead.next;i!==e.eHead;i=r)r=i.next,i.Rface.inside!==i.Lface.inside?i.winding=i.Lface.inside?t:-t:n?e.delete(i):i.winding=0},getNeighbourFace_:function(e){return e.Rface&&e.Rface.inside?e.Rface.n:-1},outputPolymesh_:function(e,t,n,r){var i,o,s,a,u,l=0,c=0;for(3L&&(Math.abs(h*l-c*f)>L&&i?(s=l*l+c*c,r=(n=n-a)*n+(a=r-u)*a,u=Math.sqrt(s),o=Math.sqrt(d),d=(s=i*Math.tan((De-Math.acos((s+d-r)/(2*u*o)))/2))/o,r=s/u,Math.abs(d-1)>L&&this._append`L${e+d*f},${t+d*h}`,this._append`A${i},${i},0,0,${+(f*aL||Math.abs(this._y1-l)>L)&&this._append`L${u},${l}`,n&&((f=f<0?f%Ie+Ie:f)>Pe?this._append`A${n},${n},0,1,${c},${e-s},${t-a}A${n},${n},0,1,${c},${this._x1=u},${this._y1=l}`:f>L&&this._append`A${n},${n},0,${+(f>=De)},${c},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}}function Fe(n){let r=3;return n.digits=function(e){if(!arguments.length)return r;if(null==e)r=null;else{var t=Math.floor(e);if(!(0<=t))throw new RangeError("invalid digits: "+e);r=t}return n},()=>new qe(r)}function Ne(e){return e.innerRadius}function Ge(e){return e.outerRadius}function ze(e){return e.startAngle}function He(e){return e.endAngle}function We(e){return e&&e.padAngle}function $e(e,t,n,r,i,o,s){var a=e-n,u=t-r,s=(s?o:-o)/A(a*a+u*u),u=s*u,s=-s*a,a=e+u,e=t+s,t=n+u,n=r+s,r=(a+t)/2,l=(e+n)/2,c=t-a,f=n-e,h=c*c+f*f,o=i-o,a=a*n-t*e,n=(f<0?-1:1)*A(Re(0,o*o*h-a*a)),t=(a*f-c*n)/h,e=(-a*c-f*n)/h,d=(a*f+c*n)/h,a=(-a*c+f*n)/h,c=t-r,f=e-l,n=d-r,h=a-l;return n*n+h*hD?S>Me-D?(I.moveTo(O*T(E),O*M(E)),I.arc(0,0,O,E,L,!k),b>D&&(I.moveTo(b*T(L),b*M(L)),I.arc(0,0,b,L,E,k))):(r=t=E,i=n=L,s=o=S,h=(c=dt.apply(this,arguments)/2)>D&&(ct?+ct.apply(this,arguments):A(b*b+O*O)),w=_=a=Be(Ce(O-b)/2,+lt.apply(this,arguments)),h>D&&(f=Ae(h/b*M(c)),h=Ae(h/O*M(c)),(o-=2*f)>D?(r+=f*=k?1:-1,i-=f):(o=0,r=i=(E+L)/2),(s-=2*h)>D?(t+=h*=k?1:-1,n-=h):(s=0,t=n=(E+L)/2)),c=O*T(t),f=O*M(t),h=b*T(i),E=b*M(i),a>D&&(d=O*T(n),p=O*M(n),v=b*T(r),g=b*M(r),SD?w>D?(u=$e(v,g,c,f,O,w,k),l=$e(d,p,h,E,O,w,k),I.moveTo(u.cx+u.x01,u.cy+u.y01),wD&&o>D?_>D?(u=$e(h,E,d,p,b,-_,k),l=$e(c,f,v,g,b,-_,k),I.lineTo(u.cx+u.x01,u.cy+u.y01),_this.miterLimit&&(l=!0),l?(S.scaleAndAdd(k,r,this._normal,-o*i),e.push(S.clone(k)),S.scaleAndAdd(k,r,zt,n*i),e.push(S.clone(k)),a.push(this._lastFlip!==-i?[t,t+2,t+3]:[t+2,t+1,t+3]),a.push([t+2,t+3,t+4]),Wt(k,Nt),S.copy(this._normal,k),S.scaleAndAdd(k,r,k,-o*i),e.push(S.clone(k)),s+=3):(jt(e,r,zt,n),a.push(1===this._lastFlip?[t,t+2,t+3]:[t+2,t+1,t+3]),i=-1,S.copy(this._normal,zt),s+=2),this._lastFlip=i):(Wt(this._normal,Ft),u&&(S.scaleAndAdd(qt,r,Ft,o),r=qt),jt(e,r,this._normal,o),a.push(1===this._lastFlip?[t,t+2,t+3]:[t+2,t+1,t+3]),s+=2),s};var Qt=q(Yt);function Zt(e,t,n,r){if((r=void 0===r?!1:r)&&n.key){r=e._geometryCache[n.key];if(r)return r}var i,o,s,a,u,l,c,f,h,d,p,v,g,r=null!=(r=t.strokeWidth)?r:1,x=null!=(x=t.strokeCap)?x:"butt",m=[],y=0,_=0,w=!1,b=!1,O=null==t.opacity?1:t.opacity,E=O*(null==t.fillOpacity?1:t.fillOpacity),L=O*(null==t.strokeOpacity?1:t.strokeOpacity),S=(n.z,n.triangles);if("transparent"===t.fill&&(E=0),t.fill&&0function(e){return e[t]},Rr=n=>{const r=n.length;return function(t){for(let e=0;es&&l(),i=s=a+1):"]"===u&&(i||Br("Access path missing open bracket: "+e),0s?l():s=a+1);return i&&Br("Access path missing closing bracket: "+e),r&&Br("Access path missing closing quote: "+e),a>s&&(a++,l()),t}(n="id")).length?s[0]:n,kr((a&&a.get||function(e){return 1===e.length?Cr(e[0]):Rr(e)})(s),[n],Lr||n),kr(e=>e,[],"identity"),kr(()=>0,[],"zero"),kr(()=>1,[],"one"),kr(()=>!0,[],"true"),kr(()=>!1,[],"false");var Ur="struct Uniforms {\n resolution: vec2,\n offset: vec2,\n};\n\n@group(0) @binding(0) var uniforms : Uniforms;\n\nstruct VertexInput {\n @location(0) position: vec2,\n}\n\nstruct InstanceInput {\n @location(1) center: vec2,\n @location(2) scale: vec2,\n @location(3) fill_color: vec4,\n @location(4) stroke_color: vec4,\n @location(5) strokewidth: f32,\n @location(6) corner_radii: vec4,\n}\n\nstruct VertexOutput {\n @builtin(position) pos: vec4,\n @location(0) uv: vec2,\n @location(1) fill: vec4,\n @location(2) stroke: vec4,\n @location(3) strokewidth: f32,\n @location(4) corner_radii: vec4,\n @location(5) scale: vec2,\n}\n\n@vertex\nfn main_vertex(\n model: VertexInput,\n instance: InstanceInput\n) -> VertexOutput {\n var output: VertexOutput;\n var u = uniforms.resolution;\n var scale = instance.scale + vec2(instance.strokewidth, instance.strokewidth);\n var pos = model.position * scale + instance.center - uniforms.offset - vec2(instance.strokewidth, instance.strokewidth) / 2.0;\n pos = pos / u;\n pos.y = 1.0 - pos.y;\n pos = pos * 2.0 - 1.0;\n output.pos = vec4(pos, 0.0, 1.0);\n output.uv = vec2(model.position.x, 1.0 - model.position.y);\n output.fill = instance.fill_color;\n output.stroke = instance.stroke_color;\n output.strokewidth = instance.strokewidth;\n output.corner_radii = instance.corner_radii;\n output.scale = instance.scale;\n return output;\n}\n\n@fragment\nfn main_fragment(in: VertexOutput) -> @location(0) vec4 {\n var col: vec4 = in.fill;\n let sw: vec2 = vec2(in.strokewidth, in.strokewidth) / in.scale;\n if in.uv.x < sw.x || in.uv.x > 1.0 - sw.x {\n col = in.stroke;\n }\n if in.uv.y < sw.y || in.uv.y > 1.0 - sw.y {\n col = in.stroke;\n }\n return col;\n}\n\nfn roundedBox(center: vec2, size: vec2, radius: vec4) -> f32 {\n var rad = radius;\n if center.x > 0.0 {\n rad.x = radius.x;\n rad.y = radius.y;\n } else {\n rad.x = radius.z;\n rad.y = radius.w;\n }\n if center.y > 0.0 {\n rad.x = rad.y;\n }\n var q = abs(center) - size + rad.x;\n return min(max(q.x, q.y), 0.0) + length(max(q, vec2(0.0))) - rad.x;\n}\n";function Tr(e){d.Renderer.call(this,e),this._options={},this._redraw=!1,this._dirty=new d.Bounds,this._tempb=new d.Bounds}var a,Mr=d.Renderer.prototype;o=Tr,a=d.Renderer,s={initialize:function(e,t,n,r){this._canvas=document.createElement("canvas");var i=this._canvas.getContext("webgpu"),i=(this._textCanvas=document.createElement("canvas"),this._textContext=this._textCanvas.getContext("2d"),e&&(e.setAttribute("style","position: relative;"),this._canvas.setAttribute("class","marks"),this._textCanvas.setAttribute("class","textCanvas"),this._textCanvas.style.position="absolute",this._textCanvas.style.top="0",this._textCanvas.style.left="0",this._textCanvas.style.zIndex="10",this._textCanvas.style.pointerEvents="none",d.domClear(e,0),e.appendChild(this._canvas),e.appendChild(this._textCanvas)),this._canvas._textCanvas=this._textCanvas,i._textContext=this._textContext,(i._renderer=this)._bgcolor="#ffffff",this._uniforms={resolution:[t,n],origin:r,dpi:window.devicePixelRatio||1},i._uniforms=this._uniforms,i._pathCache={},i._pathCacheSize=0,i._geometryCache={},i._geometryCacheSize=0,this._ctx=i,{});return i.renderBatch=!0,i.simpleLine=!0,i.debugLog=!1,i.cacheShapes=!1,i.renderLock=!0,this.wgOptions=i,this._renderCount=0,Mr.initialize.call(this,e,t,n,r)},resize:function(e,t,n){var r,i,o,s,a,u,l,c;return Mr.resize.call(this,e,t,n),r=this._canvas,i=this._ctx,o=this._width,s=this._height,a=this._origin,u=this._textCanvas,l=this._textContext,c="undefined"!=typeof HTMLElement&&r instanceof HTMLElement&&null!=r.parentNode?window.devicePixelRatio:1,r.width=o*c,r.height=s*c,u.width=o*c,u.height=s*c,l.pixelRatio=c,l.setTransform(c,0,0,c,c*a[0],c*a[1]),1!==c&&(r.style.width=o+"px",r.style.height=s+"px"),i._lineWidth=c,i._viewport={x:0,y:0,width:o,height:s,minDepth:0,maxDepth:1},i._origin=a,i._ratio=c,i._clip=[0,0,r.width,r.height],1!==(window.devicePixelRatio||1)&&(this._textCanvas.style.width=e+"px",this._textCanvas.style.height=t+"px"),this._uniforms={resolution:[e,t],origin:n,dpi:window.devicePixelRatio||1},this._ctx._uniforms=this._uniforms,this._redraw=!0,this},canvas:function(){return this._canvas},textCanvas:function(){return this._textCanvas},context:function(){return this._ctx||null},textContext:function(){return this._textContext||null},device:function(){return this._device||null},dirty:function(e){for(var t=this._tempb.clear().union(e.bounds),n=e.mark.group;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)},_reinit:function(){return V(this,void 0,void 0,function(){var t,n,r,i;return p(this,function(e){switch(e.label){case 0:return t=this.device(),n=this.context(),t&&n?[3,3]:[4,navigator.gpu.requestAdapter({powerPreference:"high-performance"})];case 1:return[4,(r=e.sent()).requestDevice()];case 2:t=e.sent(),this._adapter=r,this._device=t,i=navigator.gpu.getPreferredCanvasFormat(),w.colorFormat=i,(n=this._canvas.getContext("webgpu")).configure({device:t,format:i,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:"premultiplied"}),this._ctx=n,this.cacheShaders(),this._renderPassDescriptor=w.createRenderPassDescriptor("Bundler",this.clearColor(),this.depthTexture().createView()),e.label=3;case 3:return[2,{device:t,ctx:n}]}})})},_render:function(h){var e=this;if(!this.wgOptions.renderLock||!this._isRendering)return this._isRendering=!0,V(e,void 0,void 0,function(){var i,o,s,a,u,l,c,f=this;return p(this,function(e){switch(e.label){case 0:return[4,this._reinit()];case 1:return o=e.sent(),i=o.device,o=o.ctx,w.startFrame(),u=this._origin,s=this._width,a=this._height,t=u,n=s,r=a,u=(new d.Bounds).set(0,0,n,r).translate(-t[0],-t[1]),o._tx=0,o._ty=0,this.clear(),l=performance.now(),this.draw(i,o,h,u),c=performance.now(),this._renderPassDescriptor.colorAttachments[0].view=o.getCurrentTexture().createView(),[4,w.submitQueue2(i,this._renderPassDescriptor)];case 2:return e.sent(),requestAnimationFrame(function(){return f.renderlock(l,c)}),[2]}var t,n,r})}),this;this._lastRenderCallback=function(){return e._render(h)}},renderlock:function(e,t){var n;!0===this.wgOptions.debugLog&&(n=performance.now(),console.log("Render Time (".concat(this._renderCount++,"): ").concat((n-e).toFixed(3),"ms (Draw: ").concat((t-e).toFixed(3),"ms, WebGPU: ").concat((n-t).toFixed(3),"ms)"))),this._isRendering=!1,this.wgOptions.renderLock&&this._lastRenderCallback&&(e=this._lastRenderCallback,this._lastRenderCallback=null,e())},frame:function(){return this._lastScene&&this._render(this._lastScene,[]),this},draw:function(e,t,n,r){var i=Sr[n.marktype];null==i?console.error("Unknown mark type: '".concat(n.marktype,"'")):(t.depthTexture=this.depthTexture(),t.background=this.clearColor(),i.draw.call(this,e,t,n,r))},clear:function(){var e=this.device(),t={label:"Background",colorAttachments:[{view:this.context().getCurrentTexture().createView(),loadOp:"clear",storeOp:"store",clearValue:this.clearColor()}]},n=e.createCommandEncoder(),t=(n.beginRenderPass(t).end(),e.queue.submit([n.finish()]),this.textContext());t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,this.textCanvas().width,this.textCanvas().height),t.restore()},depthTexture:function(){return null!=this._depthTexture&&this._depthTexture.device===this._device&&this._depthTexture.width===this.canvas().width&&this._depthTexture.height===this.canvas().height||(this._depthTexture=this.device().createTexture({size:[this.canvas().width,this.canvas().height,1],format:w.depthFormat,dimension:"2d",usage:GPUTextureUsage.RENDER_ATTACHMENT}),this._depthTexture.device=this._device,this._renderPassDescriptor=w.createRenderPassDescriptor("Bundler",this.clearColor(),this.depthTexture().createView())),this._depthTexture},clearColor:function(){return this._bgcolor?U.from(this._bgcolor):{r:1,g:1,b:1,a:1}},cacheShaders:function(){var e=this.device(),t=this.context();t._shaderCache={},t._shaderCache.Symbol=e.createShaderModule({code:"struct Uniforms {\n resolution: vec2,\n offset: vec2,\n}\n\n@group(0) @binding(0) var uniforms : Uniforms;\n\nstruct VertexInput {\n @location(0) position: vec2,\n}\n\nstruct InstanceInput {\n @location(1) center: vec2,\n @location(2) radius: f32,\n @location(3) fill_color: vec4,\n @location(4) stroke_color: vec4,\n @location(5) stroke_width: f32,\n}\n\nstruct VertexOutput {\n @builtin(position) pos: vec4,\n @location(0) uv: vec2,\n @location(1) fill: vec4,\n @location(2) stroke_color: vec4,\n @location(3) stroke_width_percent: f32,\n}\n\nconst smooth_width = 0.05;\n\n@vertex\nfn main_vertex(\n model: VertexInput,\n instance: InstanceInput\n) -> VertexOutput {\n var output: VertexOutput;\n var stroke_width = instance.stroke_width / 2.0;\n var radius_with_stroke = instance.radius + stroke_width;\n var smooth_adjusted_radius = radius_with_stroke * 2.0 / (2.0 - smooth_width * 2.0);\n var pos = vec2(model.position * smooth_adjusted_radius) + instance.center - uniforms.offset;\n pos = pos / uniforms.resolution;\n pos.y = 1.0 - pos.y;\n pos = pos * 2.0 - 1.0;\n output.pos = vec4(pos, 0.0, 1.0);\n output.uv = model.position / 2.0 + vec2(0.5, 0.5);\n output.fill = instance.fill_color;\n output.stroke_color = instance.stroke_color;\n output.stroke_width_percent = stroke_width / radius_with_stroke;\n return output;\n}\n\n@fragment\nfn main_fragment(in: VertexOutput) -> @location(0) vec4 {\n let distance = distance(vec2(0.5, 0.5), in.uv);\n let smoothOuter: f32 = smoothstep(0.0, smooth_width, 0.5 - distance);\n let smoothInner: f32 = 1.0 - smoothstep(in.stroke_width_percent - smooth_width / 2.0, in.stroke_width_percent + smooth_width / 2.0, 0.5 - distance);\n return mix(vec4(in.fill.rgb, in.fill.a * smoothOuter), vec4(in.stroke_color.rgb, in.stroke_color.a * smoothOuter), smoothInner);\n}\n\nfn binaryIndicator(value: f32, edge0: f32, edge1: f32) -> f32 {\n if edge0 == edge1 {\n return 0.0;\n }\n let t = saturate((value - edge0) / (edge1 - edge0));\n return ceil(t);\n}",label:"Symbol Shader"}),t._shaderCache.Line=e.createShaderModule({code:"\nstruct VertexInput {\n @location(0) start: vec2,\n @location(1) end: vec2,\n @location(2) color: vec4,\n @location(3) stroke_width: f32,\n @location(4) resolution: vec2,\n @location(5) offset: vec2,\n};\n\n\nstruct VertexOutput {\n @builtin(position) pos: vec4,\n @location(0) uv: vec2,\n @location(1) fill: vec4,\n @location(2) smooth_width: f32,\n};\n\nconst smooth_step = 1.5;\n\n@vertex\nfn main_vertex(in: VertexInput, @builtin(vertex_index) vertexIndex: u32) -> VertexOutput {\n let start = in.start;\n let end = in.end;\n let color = in.color;\n let stroke_width = in.stroke_width;\n\n // Calculate the direction vector of the line\n let direction = normalize(end - start);\n let angle = atan2(direction.y, direction.x);\n\n // Calculate the normal vector\n let normal = normalize(vec2(-direction.y, direction.x));\n\n // Calculate the offset for width\n let adjusted_width = stroke_width + smooth_step;\n let offset = normal * ((adjusted_width) * 0.5);\n let width = stroke_width + smooth_step * 2.0;\n let length = length(end - start);\n\n // Calculate the four points of the line\n var p1 = start - offset;\n var p2 = start + offset;\n var p3 = end - offset;\n var p4 = end + offset;\n\n var vertices = array(p1, p2, p3, p2, p4, p3);\n var uvs = array(\n vec2(0.0, 0.0),\n vec2(1.0, 0.0),\n vec2(0.0, 1.0),\n vec2(1.0, 0.0),\n vec2(1.0, 1.0),\n vec2(0.0, 1.0)\n );\n var pos = vertices[vertexIndex];\n pos = (pos - in.offset) / in.resolution;\n pos.y = 1.0 - pos.y;\n pos = pos * 2.0 - 1.0;\n\n var out: VertexOutput;\n out.pos = vec4(pos, 0.0, 1.0);\n out.uv = uvs[vertexIndex];\n out.fill = color;\n out.smooth_width = adjusted_width / stroke_width - 1.0;\n return out;\n}\n\n@fragment\nfn main_fragment(in: VertexOutput) -> @location(0) vec4 {\n let sx = abs(in.uv.x - 0.5) * 2.0;\n let sy = abs(in.uv.y - 0.5) * 2.0;\n let aax: f32 = 1.0 - smoothstep(1.0 - in.smooth_width, 1.0, sx);\n // let aay: f32 = 1.0 - smoothstep(1.0 - in.smooth_length, 1.0, sy);\n return vec4(in.fill.rgb, in.fill.a * aax);\n}",label:"Line Shader"}),t._shaderCache.Rule=e.createShaderModule({code:"struct Uniforms {\n resolution: vec2,\n offset: vec2,\n}\n\n@group(0) @binding(0) var uniforms: Uniforms;\n\nstruct VertexInput {\n @location(0) position: vec2,\n @location(1) center: vec2,\n @location(2) scale: vec2,\n @location(3) stroke_color: vec4,\n}\n\nstruct VertexOutput {\n @builtin(position) pos: vec4,\n @location(1) stroke: vec4,\n}\n\n@vertex\nfn main_vertex(in: VertexInput) -> VertexOutput {\n var output : VertexOutput;\n var u = uniforms.resolution;\n var axis_offsets = calculateAxisWidthOffsets(in.scale);\n var pos = in.position * in.scale + in.center - uniforms.offset - axis_offsets;\n pos = pos / uniforms.resolution;\n pos.y = 1.0 - pos.y;\n pos = pos * 2.0 - 1.0;\n output.pos = vec4(pos, 0.0, 1.0);\n output.stroke = in.stroke_color;\n return output;\n}\n\n@fragment\nfn main_fragment(in: VertexOutput) -> @location(0) vec4 {\n return in.stroke;\n}\n\nfn calculateAxisWidthOffsets(inScale: vec2) -> vec2 {\n var x_width_offset = inScale.x;\n var y_width_offset = inScale.y;\n\n // one of them should be exactly 1.0 as its either a y or a x axis.\n if (x_width_offset > 1.0) {\n x_width_offset = 0.0;\n }\n if (y_width_offset > 1.0) {\n y_width_offset = 0.0;\n }\n return vec2(x_width_offset / 2.0, y_width_offset / 2.0);\n}",label:"Rule Shader"}),t._shaderCache.SLine=e.createShaderModule({code:"struct Uniforms {\n resolution: vec2,\n offset: vec2,\n};\n\n@group(0) @binding(0) var uniforms: Uniforms;\n\nstruct VertexInput {\n @location(0) start: vec2,\n @location(1) end: vec2,\n @location(2) color: vec4,\n @location(3) stroke_width: f32,\n};\n\n\nstruct VertexOutput {\n @builtin(position) pos: vec4,\n @location(0) uv: vec2,\n @location(1) fill: vec4,\n};\n\n@vertex\nfn main_vertex(in: VertexInput, @builtin(vertex_index) vertexIndex: u32) -> VertexOutput {\n let start = in.start;\n let end = in.end;\n let color = in.color;\n let stroke_width = in.stroke_width;\n\n // Calculate the direction vector of the line\n let direction = normalize(end - start);\n let angle = atan2(direction.y, direction.x);\n\n // Calculate the normal vector\n let normal = normalize(vec2(-direction.y, direction.x));\n\n // Calculate the offset for width\n let offset = normal * ((stroke_width) * 0.5);\n\n // Calculate the four points of the line\n var p1 = start - offset;\n var p2 = start + offset;\n var p3 = end - offset;\n var p4 = end + offset;\n\n var vertices = array(p1, p2, p3, p4, p2, p3);\n var pos = vertices[vertexIndex];\n pos = (pos - uniforms.offset) / uniforms.resolution;\n pos.y = 1.0 - pos.y;\n pos = pos * 2.0 - 1.0;\n\n var out: VertexOutput;\n out.pos = vec4(pos, 0.0, 1.0);\n let rotatedUV = vertices[vertexIndex] + uniforms.offset;\n var len = length(pos.xy);\n out.uv = vec2(- pos.x / len, pos.y / len);\n out.fill = color;\n return out;\n}\n\n@fragment\nfn main_fragment(in: VertexOutput) -> @location(0) vec4 {\n return in.fill;\n}",label:"SLine Shader"}),t._shaderCache.Path=e.createShaderModule({code:"struct Uniforms {\n resolution: vec2,\n offset: vec2,\n}\n\n@group(0) @binding(0) var uniforms : Uniforms;\n\nstruct VertexInput {\n @location(0) position: vec3,\n @location(1) fill_color: vec4,\n}\n\nstruct VertexOutput {\n @builtin(position) pos: vec4,\n @location(0) uv: vec2,\n @location(1) fill: vec4,\n}\n\n@vertex\nfn main_vertex(\n model: VertexInput\n) -> VertexOutput {\n var output: VertexOutput;\n var pos = model.position.xy - uniforms.offset;\n pos = pos / uniforms.resolution;\n pos.y = 1.0 - pos.y;\n pos = pos * 2.0 - 1.0;\n output.pos = vec4(pos, model.position.z + 0.5, 1.0);\n output.uv = pos;\n output.fill = model.fill_color;\n return output;\n}\n\n@fragment\nfn main_fragment(in: VertexOutput) -> @location(0) vec4 {\n return in.fill;\n}\n",label:"Triangle Shader"}),t._shaderCache.Rect=e.createShaderModule({code:Ur,label:"Rect Shader"}),t._shaderCache.Group=e.createShaderModule({code:Ur,label:"Group Shader"}),t._shaderCache.Arc=e.createShaderModule({code:"struct Uniforms {\r\n resolution: vec2